Changeset 77 for trunk/samba/source/smbd/oplock_irix.c
- Timestamp:
- Sep 30, 2007, 3:42:50 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/samba/source/smbd/oplock_irix.c
r1 r77 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2of the License, or8 the Free Software Foundation; either version 3 of the License, or 9 9 (at your option) any later version. 10 10 … … 15 15 16 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 along with this program. If not, see <http://www.gnu.org/licenses/>. 19 18 */ 20 19 … … 35 34 int fd; 36 35 int pfd[2]; 37 pstring tmpname; 36 TALLOC_CTX *ctx = talloc_stackframe(); 37 char *tmpname = NULL; 38 38 39 39 set_effective_capability(KERNEL_OPLOCK_CAPABILITY); 40 40 41 slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(), 42 (int)sys_getpid()); 41 tmpname = talloc_asprintf(ctx, 42 "%s/koplock.%d", 43 lp_lockdir(), 44 (int)sys_getpid()); 45 if (!tmpname) { 46 TALLOC_FREE(ctx); 47 return False; 48 } 43 49 44 50 if(pipe(pfd) != 0) { … … 46 52 "was %s\n", 47 53 strerror(errno) )); 54 TALLOC_FREE(ctx); 48 55 return False; 49 56 } … … 56 63 close(pfd[0]); 57 64 close(pfd[1]); 65 TALLOC_FREE(ctx); 58 66 return False; 59 67 } 60 68 61 69 unlink(tmpname); 70 71 TALLOC_FREE(ctx); 62 72 63 73 if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) { … … 98 108 oplock_stat_t os; 99 109 char dummy; 110 struct file_id fileid; 100 111 files_struct *fsp; 101 112 … … 139 150 * We only have device and inode info here - we have to guess that this 140 151 * is the first fsp open with this dev,ino pair. 152 * 153 * NOTE: this doesn't work if any VFS modules overloads 154 * the file_id_create() hook! 141 155 */ 142 156 143 if ((fsp = file_find_di_first((SMB_DEV_T)os.os_dev, 144 (SMB_INO_T)os.os_ino)) == NULL) { 157 fileid = file_id_create_dev((SMB_DEV_T)os.os_dev, 158 (SMB_INO_T)os.os_ino); 159 if ((fsp = file_find_di_first(fileid)) == NULL) { 145 160 DEBUG(0,("irix_oplock_receive_message: unable to find open " 146 161 "file with dev = %x, inode = %.0f\n", … … 150 165 151 166 DEBUG(5,("irix_oplock_receive_message: kernel oplock break request " 152 "received for dev = %x, inode = %.0f\n, file_id = %ul",153 (unsigned int)fsp->dev, (double)fsp->inode,154 fsp->fh-> file_id ));167 "received for file_id %s gen_id = %ul", 168 file_id_string_tos(&fsp->file_id), 169 fsp->fh->gen_id )); 155 170 156 171 return fsp; … … 166 181 if(errno != EAGAIN) { 167 182 DEBUG(0,("irix_set_kernel_oplock: Unable to get " 168 "kernel oplock on file %s, dev = %x, inode"169 " = %.0f, file_id = %ul. Error was %s\n",170 fsp->fsp_name, (unsigned int)fsp->dev,171 (double)fsp->inode, fsp->fh->file_id,183 "kernel oplock on file %s, file_id %s " 184 "gen_id = %ul. Error was %s\n", 185 fsp->fsp_name, file_id_string_tos(&fsp->file_id), 186 fsp->fh->gen_id, 172 187 strerror(errno) )); 173 188 } else { 174 189 DEBUG(5,("irix_set_kernel_oplock: Refused oplock on " 175 "file %s, fd = %d, dev = %x, inode = %.0f, "176 " file_id = %ul. Another process had the file "190 "file %s, fd = %d, file_id = 5s, " 191 "gen_id = %ul. Another process had the file " 177 192 "open.\n", 178 193 fsp->fsp_name, fsp->fh->fd, 179 (unsigned int)fsp->dev, (double)fsp->inode,180 fsp->fh-> file_id ));194 file_id_string_tos(&fsp->file_id), 195 fsp->fh->gen_id )); 181 196 } 182 197 return False; 183 198 } 184 199 185 DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, dev"186 " = %x, inode = %.0f, file_id = %ul\n",187 fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode,188 fsp->fh-> file_id));200 DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, file_id = %s " 201 "gen_id = %ul\n", 202 fsp->fsp_name, file_id_string_tos(&fsp->file_id), 203 fsp->fh->gen_id)); 189 204 190 205 return True; … … 203 218 */ 204 219 int state = sys_fcntl_long(fsp->fh->fd, F_OPLKACK, -1); 205 dbgtext("irix_release_kernel_oplock: file %s, dev = %x,"206 " inode = %.0f file_id = %ul, has kernel oplock state "207 "of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev,208 (double)fsp->inode, fsp->fh->file_id, state );220 dbgtext("irix_release_kernel_oplock: file %s, file_id = %s" 221 "gen_id = %ul, has kernel oplock state " 222 "of %x.\n", fsp->fsp_name, file_id_string_tos(&fsp->file_id), 223 fsp->fh->gen_id, state ); 209 224 } 210 225 … … 216 231 dbgtext("irix_release_kernel_oplock: Error when " 217 232 "removing kernel oplock on file " ); 218 dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. "233 dbgtext("%s, file_id = %s gen_id = %ul. " 219 234 "Error was %s\n", 220 fsp->fsp_name, (unsigned int)fsp->dev,221 (double)fsp->inode, fsp->fh->file_id,235 fsp->fsp_name, file_id_string_tos(&fsp->file_id), 236 fsp->fh->gen_id, 222 237 strerror(errno) ); 223 238 }
Note:
See TracChangeset
for help on using the changeset viewer.