関数 | |
| static void | signal_handler (int sig, siginfo_t *info, void *unused) |
| int | linux_set_lease_sighandler (int fd) |
| int | linux_setlease (int fd, int leasetype) |
| static files_struct * | linux_oplock_receive_message (fd_set *fds) |
| static BOOL | linux_set_kernel_oplock (files_struct *fsp, int oplock_type) |
| static void | linux_release_kernel_oplock (files_struct *fsp) |
| static BOOL | linux_oplock_msg_waiting (fd_set *fds) |
| static BOOL | linux_oplocks_available (void) |
| kernel_oplocks * | linux_init_kernel_oplocks (void) |
| void | oplock_linux_dummy (void) |
変数 | |
| static SIG_ATOMIC_T | signals_received |
| static SIG_ATOMIC_T | fd_pending_array [FD_PENDING_SIZE] |
| static void signal_handler | ( | int | sig, | |
| siginfo_t * | info, | |||
| void * | unused | |||
| ) | [static] |
oplock_linux.c の 54 行で定義されています。
参照先 fd_pending_array・signals_received・sys_select_signal().
00055 { 00056 if (signals_received < FD_PENDING_SIZE - 1) { 00057 fd_pending_array[signals_received] = (SIG_ATOMIC_T)info->si_fd; 00058 signals_received++; 00059 } /* Else signal is lost. */ 00060 sys_select_signal(RT_SIGNAL_LEASE); 00061 }
| int linux_set_lease_sighandler | ( | int | fd | ) |
oplock_linux.c の 66 行で定義されています。
参照元 vfs_gpfs_setlease()・vfswrap_linux_setlease().
00067 { 00068 if (fcntl(fd, F_SETSIG, RT_SIGNAL_LEASE) == -1) { 00069 DEBUG(3,("Failed to set signal handler for kernel lease\n")); 00070 return -1; 00071 } 00072 00073 return 0; 00074 }
| int linux_setlease | ( | int | fd, | |
| int | leasetype | |||
| ) |
oplock_linux.c の 82 行で定義されています。
参照先 errno・LEASE_CAPABILITY・set_effective_capability().
参照元 vfs_gpfs_setlease()・vfswrap_linux_setlease().
00083 { 00084 int ret; 00085 00086 ret = fcntl(fd, F_SETLEASE, leasetype); 00087 if (ret == -1 && errno == EACCES) { 00088 set_effective_capability(LEASE_CAPABILITY); 00089 ret = fcntl(fd, F_SETLEASE, leasetype); 00090 } 00091 00092 return ret; 00093 }
| static files_struct* linux_oplock_receive_message | ( | fd_set * | fds | ) | [static] |
oplock_linux.c の 100 行で定義されています。
参照先 BlockSignals()・fd・fd_pending_array・file_find_fd()・signals_received.
参照元 linux_init_kernel_oplocks().
00101 { 00102 int fd; 00103 files_struct *fsp; 00104 00105 BlockSignals(True, RT_SIGNAL_LEASE); 00106 fd = fd_pending_array[0]; 00107 fsp = file_find_fd(fd); 00108 fd_pending_array[0] = (SIG_ATOMIC_T)-1; 00109 if (signals_received > 1) 00110 memmove(CONST_DISCARD(void *, &fd_pending_array[0]), 00111 CONST_DISCARD(void *, &fd_pending_array[1]), 00112 sizeof(SIG_ATOMIC_T)*(signals_received-1)); 00113 signals_received--; 00114 /* now we can receive more signals */ 00115 BlockSignals(False, RT_SIGNAL_LEASE); 00116 00117 return fsp; 00118 }
| static BOOL linux_set_kernel_oplock | ( | files_struct * | fsp, | |
| int | oplock_type | |||
| ) | [static] |
oplock_linux.c の 124 行で定義されています。
参照先 files_struct::dev・errno・fd_handle::fd・files_struct::fh・fd_handle::file_id・files_struct::fsp_name・files_struct::inode・strerror().
参照元 linux_init_kernel_oplocks().
00125 { 00126 if ( SMB_VFS_LINUX_SETLEASE(fsp,fsp->fh->fd, F_WRLCK) == -1) { 00127 DEBUG(3,("linux_set_kernel_oplock: Refused oplock on file %s, " 00128 "fd = %d, dev = %x, inode = %.0f. (%s)\n", 00129 fsp->fsp_name, fsp->fh->fd, 00130 (unsigned int)fsp->dev, (double)fsp->inode, 00131 strerror(errno))); 00132 return False; 00133 } 00134 00135 DEBUG(3,("linux_set_kernel_oplock: got kernel oplock on file %s, " 00136 "dev = %x, inode = %.0f, file_id = %lu\n", 00137 fsp->fsp_name, (unsigned int)fsp->dev, (double)fsp->inode, 00138 fsp->fh->file_id)); 00139 00140 return True; 00141 }
| static void linux_release_kernel_oplock | ( | files_struct * | fsp | ) | [static] |
oplock_linux.c の 147 行で定義されています。
参照先 dbgtext()・files_struct::dev・errno・fd_handle::fd・files_struct::fh・fd_handle::file_id・files_struct::fsp_name・files_struct::inode・strerror().
参照元 linux_init_kernel_oplocks().
00148 { 00149 if (DEBUGLVL(10)) { 00150 /* 00151 * Check and print out the current kernel 00152 * oplock state of this file. 00153 */ 00154 int state = fcntl(fsp->fh->fd, F_GETLEASE, 0); 00155 dbgtext("linux_release_kernel_oplock: file %s, dev = %x, " 00156 "inode = %.0f file_id = %lu has kernel oplock state " 00157 "of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev, 00158 (double)fsp->inode, fsp->fh->file_id, state ); 00159 } 00160 00161 /* 00162 * Remove the kernel oplock on this file. 00163 */ 00164 if ( SMB_VFS_LINUX_SETLEASE(fsp,fsp->fh->fd, F_UNLCK) == -1) { 00165 if (DEBUGLVL(0)) { 00166 dbgtext("linux_release_kernel_oplock: Error when " 00167 "removing kernel oplock on file " ); 00168 dbgtext("%s, dev = %x, inode = %.0f, file_id = %lu. " 00169 "Error was %s\n", fsp->fsp_name, 00170 (unsigned int)fsp->dev, (double)fsp->inode, 00171 fsp->fh->file_id, strerror(errno) ); 00172 } 00173 } 00174 }
| static BOOL linux_oplock_msg_waiting | ( | fd_set * | fds | ) | [static] |
oplock_linux.c の 180 行で定義されています。
参照先 signals_received.
参照元 linux_init_kernel_oplocks().
00181 { 00182 return signals_received != 0; 00183 }
| static BOOL linux_oplocks_available | ( | void | ) | [static] |
oplock_linux.c の 189 行で定義されています。
参照先 fd.
参照元 linux_init_kernel_oplocks().
00190 { 00191 int fd, ret; 00192 fd = open("/dev/null", O_RDONLY); 00193 if (fd == -1) 00194 return False; /* uggh! */ 00195 ret = fcntl(fd, F_GETLEASE, 0); 00196 close(fd); 00197 return ret == F_UNLCK; 00198 }
| struct kernel_oplocks* linux_init_kernel_oplocks | ( | void | ) |
oplock_linux.c の 204 行で定義されています。
参照先 BlockSignals()・koplocks・linux_oplock_msg_waiting()・linux_oplock_receive_message()・linux_oplocks_available()・linux_release_kernel_oplock()・linux_set_kernel_oplock()・kernel_oplocks::msg_waiting・kernel_oplocks::notification_fd・kernel_oplocks::receive_message・kernel_oplocks::release_oplock・kernel_oplocks::set_oplock・signal_handler().
参照元 init_oplocks().
00205 { 00206 static struct kernel_oplocks koplocks; 00207 struct sigaction act; 00208 00209 if (!linux_oplocks_available()) { 00210 DEBUG(3,("Linux kernel oplocks not available\n")); 00211 return NULL; 00212 } 00213 00214 ZERO_STRUCT(act); 00215 00216 act.sa_handler = NULL; 00217 act.sa_sigaction = signal_handler; 00218 act.sa_flags = SA_SIGINFO; 00219 sigemptyset( &act.sa_mask ); 00220 if (sigaction(RT_SIGNAL_LEASE, &act, NULL) != 0) { 00221 DEBUG(0,("Failed to setup RT_SIGNAL_LEASE handler\n")); 00222 return NULL; 00223 } 00224 00225 koplocks.receive_message = linux_oplock_receive_message; 00226 koplocks.set_oplock = linux_set_kernel_oplock; 00227 koplocks.release_oplock = linux_release_kernel_oplock; 00228 koplocks.msg_waiting = linux_oplock_msg_waiting; 00229 koplocks.notification_fd = -1; 00230 00231 /* the signal can start off blocked due to a bug in bash */ 00232 BlockSignals(False, RT_SIGNAL_LEASE); 00233 00234 DEBUG(3,("Linux kernel oplocks enabled\n")); 00235 00236 return &koplocks; 00237 }
| void oplock_linux_dummy | ( | void | ) |
SIG_ATOMIC_T signals_received [static] |
oplock_linux.c の 26 行で定義されています。
SIG_ATOMIC_T fd_pending_array[FD_PENDING_SIZE] [static] |
1.4.7