関数 | |
static BOOL | irix_oplocks_available (void) |
static files_struct * | irix_oplock_receive_message (fd_set *fds) |
static BOOL | irix_set_kernel_oplock (files_struct *fsp, int oplock_type) |
static void | irix_release_kernel_oplock (files_struct *fsp) |
static BOOL | irix_oplock_msg_waiting (fd_set *fds) |
kernel_oplocks * | irix_init_kernel_oplocks (void) |
void | oplock_irix_dummy (void) |
変数 | |
static int | oplock_pipe_write = -1 |
static int | oplock_pipe_read = -1 |
static BOOL irix_oplocks_available | ( | void | ) | [static] |
oplock_irix.c の 33 行で定義されています。
参照先 errno・fd・KERNEL_OPLOCK_CAPABILITY・set_effective_capability()・strerror()・sys_fcntl_long()・sys_getpid()・sys_open().
参照元 irix_init_kernel_oplocks().
00034 { 00035 int fd; 00036 int pfd[2]; 00037 pstring tmpname; 00038 00039 set_effective_capability(KERNEL_OPLOCK_CAPABILITY); 00040 00041 slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(), 00042 (int)sys_getpid()); 00043 00044 if(pipe(pfd) != 0) { 00045 DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error " 00046 "was %s\n", 00047 strerror(errno) )); 00048 return False; 00049 } 00050 00051 if((fd = sys_open(tmpname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600)) < 0) { 00052 DEBUG(0,("check_kernel_oplocks: Unable to open temp test file " 00053 "%s. Error was %s\n", 00054 tmpname, strerror(errno) )); 00055 unlink( tmpname ); 00056 close(pfd[0]); 00057 close(pfd[1]); 00058 return False; 00059 } 00060 00061 unlink(tmpname); 00062 00063 if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) { 00064 DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not " 00065 "available on this machine. Disabling kernel oplock " 00066 "support.\n" )); 00067 close(pfd[0]); 00068 close(pfd[1]); 00069 close(fd); 00070 return False; 00071 } 00072 00073 if(sys_fcntl_long(fd, F_OPLKACK, OP_REVOKE) < 0 ) { 00074 DEBUG(0,("check_kernel_oplocks: Error when removing kernel " 00075 "oplock. Error was %s. Disabling kernel oplock " 00076 "support.\n", strerror(errno) )); 00077 close(pfd[0]); 00078 close(pfd[1]); 00079 close(fd); 00080 return False; 00081 } 00082 00083 close(pfd[0]); 00084 close(pfd[1]); 00085 close(fd); 00086 00087 return True; 00088 }
static files_struct* irix_oplock_receive_message | ( | fd_set * | fds | ) | [static] |
oplock_irix.c の 95 行で定義されています。
参照先 files_struct::dev・errno・files_struct::fh・file_find_di_first()・fd_handle::file_id・files_struct::inode・oplock_pipe_read・smb_read_error・strerror()・sys_fcntl_ptr().
参照元 irix_init_kernel_oplocks().
00096 { 00097 extern int smb_read_error; 00098 oplock_stat_t os; 00099 char dummy; 00100 files_struct *fsp; 00101 00102 /* Ensure we only get one call per select fd set. */ 00103 FD_CLR(oplock_pipe_read, fds); 00104 00105 /* 00106 * Read one byte of zero to clear the 00107 * kernel break notify message. 00108 */ 00109 00110 if(read(oplock_pipe_read, &dummy, 1) != 1) { 00111 DEBUG(0,("irix_oplock_receive_message: read of kernel " 00112 "notification failed. Error was %s.\n", 00113 strerror(errno) )); 00114 smb_read_error = READ_ERROR; 00115 return NULL; 00116 } 00117 00118 /* 00119 * Do a query to get the 00120 * device and inode of the file that has the break 00121 * request outstanding. 00122 */ 00123 00124 if(sys_fcntl_ptr(oplock_pipe_read, F_OPLKSTAT, &os) < 0) { 00125 DEBUG(0,("irix_oplock_receive_message: fcntl of kernel " 00126 "notification failed. Error was %s.\n", 00127 strerror(errno) )); 00128 if(errno == EAGAIN) { 00129 /* 00130 * Duplicate kernel break message - ignore. 00131 */ 00132 return NULL; 00133 } 00134 smb_read_error = READ_ERROR; 00135 return NULL; 00136 } 00137 00138 /* 00139 * We only have device and inode info here - we have to guess that this 00140 * is the first fsp open with this dev,ino pair. 00141 */ 00142 00143 if ((fsp = file_find_di_first((SMB_DEV_T)os.os_dev, 00144 (SMB_INO_T)os.os_ino)) == NULL) { 00145 DEBUG(0,("irix_oplock_receive_message: unable to find open " 00146 "file with dev = %x, inode = %.0f\n", 00147 (unsigned int)os.os_dev, (double)os.os_ino )); 00148 return NULL; 00149 } 00150 00151 DEBUG(5,("irix_oplock_receive_message: kernel oplock break request " 00152 "received for dev = %x, inode = %.0f\n, file_id = %ul", 00153 (unsigned int)fsp->dev, (double)fsp->inode, 00154 fsp->fh->file_id )); 00155 00156 return fsp; 00157 }
static BOOL irix_set_kernel_oplock | ( | files_struct * | fsp, | |
int | oplock_type | |||
) | [static] |
oplock_irix.c の 163 行で定義されています。
参照先 files_struct::dev・errno・fd_handle::fd・files_struct::fh・fd_handle::file_id・files_struct::fsp_name・files_struct::inode・oplock_pipe_write・strerror()・sys_fcntl_long().
参照元 irix_init_kernel_oplocks().
00164 { 00165 if (sys_fcntl_long(fsp->fh->fd, F_OPLKREG, oplock_pipe_write) == -1) { 00166 if(errno != EAGAIN) { 00167 DEBUG(0,("irix_set_kernel_oplock: Unable to get " 00168 "kernel oplock on file %s, dev = %x, inode " 00169 "= %.0f, file_id = %ul. Error was %s\n", 00170 fsp->fsp_name, (unsigned int)fsp->dev, 00171 (double)fsp->inode, fsp->fh->file_id, 00172 strerror(errno) )); 00173 } else { 00174 DEBUG(5,("irix_set_kernel_oplock: Refused oplock on " 00175 "file %s, fd = %d, dev = %x, inode = %.0f, " 00176 "file_id = %ul. Another process had the file " 00177 "open.\n", 00178 fsp->fsp_name, fsp->fh->fd, 00179 (unsigned int)fsp->dev, (double)fsp->inode, 00180 fsp->fh->file_id )); 00181 } 00182 return False; 00183 } 00184 00185 DEBUG(10,("irix_set_kernel_oplock: got kernel oplock on file %s, dev " 00186 "= %x, inode = %.0f, file_id = %ul\n", 00187 fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, 00188 fsp->fh->file_id)); 00189 00190 return True; 00191 }
static void irix_release_kernel_oplock | ( | files_struct * | fsp | ) | [static] |
oplock_irix.c の 197 行で定義されています。
参照先 dbgtext()・files_struct::dev・errno・fd_handle::fd・files_struct::fh・fd_handle::file_id・files_struct::fsp_name・files_struct::inode・strerror()・sys_fcntl_long().
参照元 irix_init_kernel_oplocks().
00198 { 00199 if (DEBUGLVL(10)) { 00200 /* 00201 * Check and print out the current kernel 00202 * oplock state of this file. 00203 */ 00204 int state = sys_fcntl_long(fsp->fh->fd, F_OPLKACK, -1); 00205 dbgtext("irix_release_kernel_oplock: file %s, dev = %x, " 00206 "inode = %.0f file_id = %ul, has kernel oplock state " 00207 "of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, 00208 (double)fsp->inode, fsp->fh->file_id, state ); 00209 } 00210 00211 /* 00212 * Remove the kernel oplock on this file. 00213 */ 00214 if(sys_fcntl_long(fsp->fh->fd, F_OPLKACK, OP_REVOKE) < 0) { 00215 if( DEBUGLVL( 0 )) { 00216 dbgtext("irix_release_kernel_oplock: Error when " 00217 "removing kernel oplock on file " ); 00218 dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. " 00219 "Error was %s\n", 00220 fsp->fsp_name, (unsigned int)fsp->dev, 00221 (double)fsp->inode, fsp->fh->file_id, 00222 strerror(errno) ); 00223 } 00224 } 00225 }
static BOOL irix_oplock_msg_waiting | ( | fd_set * | fds | ) | [static] |
oplock_irix.c の 232 行で定義されています。
参照先 oplock_pipe_read・sys_select_intr()・timeval_set().
参照元 irix_init_kernel_oplocks().
00233 { 00234 int selrtn; 00235 fd_set myfds; 00236 struct timeval to; 00237 00238 if (oplock_pipe_read == -1) 00239 return False; 00240 00241 if (fds) { 00242 return FD_ISSET(oplock_pipe_read, fds); 00243 } 00244 00245 /* Do a zero-time select. We just need to find out if there 00246 * are any outstanding messages. We use sys_select_intr as 00247 * we need to ignore any signals. */ 00248 00249 FD_ZERO(&myfds); 00250 FD_SET(oplock_pipe_read, &myfds); 00251 00252 to = timeval_set(0, 0); 00253 selrtn = sys_select_intr(oplock_pipe_read+1,&myfds,NULL,NULL,&to); 00254 return (selrtn == 1) ? True : False; 00255 }
struct kernel_oplocks* irix_init_kernel_oplocks | ( | void | ) |
oplock_irix.c の 261 行で定義されています。
参照先 errno・irix_oplock_msg_waiting()・irix_oplock_receive_message()・irix_oplocks_available()・irix_release_kernel_oplock()・irix_set_kernel_oplock()・koplocks・kernel_oplocks::msg_waiting・kernel_oplocks::notification_fd・oplock_pipe_read・oplock_pipe_write・kernel_oplocks::receive_message・kernel_oplocks::release_oplock・kernel_oplocks::set_oplock・strerror().
参照元 init_oplocks().
00262 { 00263 int pfd[2]; 00264 static struct kernel_oplocks koplocks; 00265 00266 if (!irix_oplocks_available()) 00267 return NULL; 00268 00269 if(pipe(pfd) != 0) { 00270 DEBUG(0,("setup_kernel_oplock_pipe: Unable to create pipe. " 00271 "Error was %s\n", strerror(errno) )); 00272 return False; 00273 } 00274 00275 oplock_pipe_read = pfd[0]; 00276 oplock_pipe_write = pfd[1]; 00277 00278 koplocks.receive_message = irix_oplock_receive_message; 00279 koplocks.set_oplock = irix_set_kernel_oplock; 00280 koplocks.release_oplock = irix_release_kernel_oplock; 00281 koplocks.msg_waiting = irix_oplock_msg_waiting; 00282 koplocks.notification_fd = oplock_pipe_read; 00283 00284 return &koplocks; 00285 }
void oplock_irix_dummy | ( | void | ) |
int oplock_pipe_write = -1 [static] |
int oplock_pipe_read = -1 [static] |