関数 | |
static BOOL | prime_cache (struct vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset, size_t count) |
static int | cprime_connect (struct vfs_handle_struct *handle, const char *service, const char *user) |
static ssize_t | cprime_sendfile (struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) |
static ssize_t | cprime_read (vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t count) |
static ssize_t | cprime_pread (vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t count, SMB_OFF_T offset) |
NTSTATUS | vfs_cacheprime_init (void) |
変数 | |
static int | module_debug |
static ssize_t | g_readsz = 0 |
static void * | g_readbuf = NULL |
static vfs_op_tuple | cprime_ops [] |
static BOOL prime_cache | ( | struct vfs_handle_struct * | handle, | |
files_struct * | fsp, | |||
int | fd, | |||
SMB_OFF_T | offset, | |||
size_t | count | |||
) | [static] |
vfs_cacheprime.c の 49 行で定義されています。
参照先 files_struct::fsp_name・g_readbuf・g_readsz・handle・module_debug・sys_pread().
参照元 cprime_pread()・cprime_read()・cprime_sendfile().
00055 { 00056 SMB_OFF_T * last; 00057 ssize_t nread; 00058 00059 last = VFS_ADD_FSP_EXTENSION(handle, fsp, SMB_OFF_T); 00060 if (!last) { 00061 return False; 00062 } 00063 00064 if (*last == -1) { 00065 /* Readahead disabled. */ 00066 return False; 00067 } 00068 00069 if ((*last + g_readsz) > (offset + count)) { 00070 /* Skip readahead ... we've already been here. */ 00071 return False; 00072 } 00073 00074 DEBUG(module_debug, 00075 ("%s: doing readahead of %lld bytes at %lld for %s\n", 00076 MODULE, (long long)g_readsz, (long long)*last, 00077 fsp->fsp_name)); 00078 00079 nread = sys_pread(fd, g_readbuf, g_readsz, *last); 00080 if (nread < 0) { 00081 *last = -1; 00082 return False; 00083 } 00084 00085 *last += nread; 00086 return True; 00087 }
static int cprime_connect | ( | struct vfs_handle_struct * | handle, | |
const char * | service, | |||
const char * | user | |||
) | [static] |
vfs_cacheprime.c の 89 行で定義されています。
参照先 conv_str_size()・g_readbuf・g_readsz・handle・lp_parm_const_string()・lp_parm_int()・module_debug.
00093 { 00094 module_debug = lp_parm_int(SNUM(handle->conn), MODULE, "debug", 100); 00095 if (g_readbuf) { 00096 /* Only allocate g_readbuf once. If the config changes and 00097 * another client multiplexes onto this smbd, we don't want 00098 * to risk memory corruption. 00099 */ 00100 return SMB_VFS_NEXT_CONNECT(handle, service, user); 00101 } 00102 00103 g_readsz = conv_str_size(lp_parm_const_string(SNUM(handle->conn), 00104 MODULE, "rsize", NULL)); 00105 00106 if (g_readsz < READAHEAD_MIN) { 00107 DEBUG(module_debug, ("%s: %ld bytes of readahead " 00108 "requested, using minimum of %u\n", 00109 MODULE, (long)g_readsz, READAHEAD_MIN)); 00110 g_readsz = READAHEAD_MIN; 00111 } else if (g_readsz > READAHEAD_MAX) { 00112 DEBUG(module_debug, ("%s: %ld bytes of readahead " 00113 "requested, using maximum of %u\n", 00114 MODULE, (long)g_readsz, READAHEAD_MAX)); 00115 g_readsz = READAHEAD_MAX; 00116 } 00117 00118 if ((g_readbuf = SMB_MALLOC(g_readsz)) == NULL) { 00119 /* Turn off readahead if we can't get a buffer. */ 00120 g_readsz = 0; 00121 } 00122 00123 return SMB_VFS_NEXT_CONNECT(handle, service, user); 00124 }
static ssize_t cprime_sendfile | ( | struct vfs_handle_struct * | handle, | |
int | tofd, | |||
files_struct * | fsp, | |||
int | fromfd, | |||
const DATA_BLOB * | header, | |||
SMB_OFF_T | offset, | |||
size_t | count | |||
) | [static] |
vfs_cacheprime.c の 126 行で定義されています。
参照先 g_readbuf・handle・prime_cache().
00134 { 00135 if (g_readbuf && offset == 0) { 00136 prime_cache(handle, fsp, fromfd, offset, count); 00137 } 00138 00139 return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, fromfd, 00140 header, offset, count); 00141 }
static ssize_t cprime_read | ( | vfs_handle_struct * | handle, | |
files_struct * | fsp, | |||
int | fd, | |||
void * | data, | |||
size_t | count | |||
) | [static] |
vfs_cacheprime.c の 143 行で定義されています。
参照先 g_readbuf・handle・prime_cache().
00149 { 00150 SMB_OFF_T offset; 00151 00152 offset = SMB_VFS_LSEEK(fsp, fd, 0, SEEK_CUR); 00153 if (offset >= 0 && g_readbuf) { 00154 prime_cache(handle, fsp, fd, offset, count); 00155 SMB_VFS_LSEEK(fsp, fd, offset, SEEK_SET); 00156 } 00157 00158 return SMB_VFS_NEXT_READ(handle, fsp, fd, data, count); 00159 }
static ssize_t cprime_pread | ( | vfs_handle_struct * | handle, | |
files_struct * | fsp, | |||
int | fd, | |||
void * | data, | |||
size_t | count, | |||
SMB_OFF_T | offset | |||
) | [static] |
vfs_cacheprime.c の 161 行で定義されています。
参照先 g_readbuf・handle・prime_cache().
00168 { 00169 if (g_readbuf) { 00170 prime_cache(handle, fsp, fd, offset, count); 00171 } 00172 00173 return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, count, offset); 00174 }
NTSTATUS vfs_cacheprime_init | ( | void | ) |
vfs_cacheprime.c の 196 行で定義されています。
参照先 cprime_ops・smb_register_vfs().
00197 { 00198 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, MODULE, cprime_ops); 00199 }
int module_debug [static] |
ssize_t g_readsz = 0 [static] |
void* g_readbuf = NULL [static] |
vfs_cacheprime.c の 43 行で定義されています。
参照元 cprime_connect()・cprime_pread()・cprime_read()・cprime_sendfile()・prime_cache().
vfs_op_tuple cprime_ops[] [static] |
初期値:
{ {SMB_VFS_OP(cprime_sendfile), SMB_VFS_OP_SENDFILE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cprime_pread), SMB_VFS_OP_PREAD, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cprime_read), SMB_VFS_OP_READ, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(cprime_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }
vfs_cacheprime.c の 176 行で定義されています。