diff options
author | Jeremy Allison <jra@samba.org> | 2004-11-09 22:49:28 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:53:11 -0500 |
commit | c0406ae1b04a60318ba18abb168b610d8c223005 (patch) | |
tree | 5da7bbbfea881461879ba3eff4902432647ce92e /source3/smbd | |
parent | 2d0f5486f085e0db4528fb3f72ca311c73c36b92 (diff) | |
download | samba-c0406ae1b04a60318ba18abb168b610d8c223005.tar.gz samba-c0406ae1b04a60318ba18abb168b610d8c223005.tar.bz2 samba-c0406ae1b04a60318ba18abb168b610d8c223005.zip |
r3642: Extend vfs to add seekdir/telldir/rewinddir. Yes I know I have to
fix the modules too... First step in fixing out large directories
problem.
Jeremy.
(This used to be commit 344e9dd33a936b429fefb67cd748ac009a1bab10)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/trans2.c | 16 | ||||
-rw-r--r-- | source3/smbd/vfs-wrap.c | 31 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 7 |
3 files changed, 41 insertions, 13 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index ac282ed95f..4c0d5731eb 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1329,9 +1329,10 @@ static int call_trans2findfirst(connection_struct *conn, char *inbuf, char *outb char *pdata = *ppdata; int dirtype = SVAL(params,0); int maxentries = SVAL(params,2); - BOOL close_after_first = BITSETW(params+4,0); - BOOL close_if_end = BITSETW(params+4,1); - BOOL requires_resume_key = BITSETW(params+4,2); + uint16 findfirst_flags = SVAL(params,4); + BOOL close_after_first = (findfirst_flags & FLAG_TRANS2_FIND_CLOSE); + BOOL close_if_end = (findfirst_flags & FLAG_TRANS2_FIND_CLOSE_IF_END); + BOOL requires_resume_key = (findfirst_flags & FLAG_TRANS2_FIND_REQUIRE_RESUME); int info_level = SVAL(params,6); pstring directory; pstring mask; @@ -1555,10 +1556,11 @@ static int call_trans2findnext(connection_struct *conn, char *inbuf, char *outbu int maxentries = SVAL(params,2); uint16 info_level = SVAL(params,4); uint32 resume_key = IVAL(params,6); - BOOL close_after_request = BITSETW(params+10,0); - BOOL close_if_end = BITSETW(params+10,1); - BOOL requires_resume_key = BITSETW(params+10,2); - BOOL continue_bit = BITSETW(params+10,3); + uint16 findnext_flags = SVAL(params,10); + BOOL close_after_request = (findnext_flags & FLAG_TRANS2_FIND_CLOSE); + BOOL close_if_end = (findnext_flags & FLAG_TRANS2_FIND_CLOSE_IF_END); + BOOL requires_resume_key = (findnext_flags & FLAG_TRANS2_FIND_REQUIRE_RESUME); + BOOL continue_bit = (findnext_flags & FLAG_TRANS2_FIND_CONTINUE); pstring resume_name; pstring mask; pstring directory; diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c index 5393dfc755..1444d0e875 100644 --- a/source3/smbd/vfs-wrap.c +++ b/source3/smbd/vfs-wrap.c @@ -93,21 +93,44 @@ DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const c DIR *result; START_PROFILE(syscall_opendir); - result = opendir(fname); + result = sys_opendir(fname); END_PROFILE(syscall_opendir); return result; } -struct dirent *vfswrap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +SMB_STRUCT_DIRENT *vfswrap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) { struct dirent *result; START_PROFILE(syscall_readdir); - result = readdir(dirp); + result = sys_readdir(dirp); END_PROFILE(syscall_readdir); return result; } +void vfswrap_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset) +{ + START_PROFILE(syscall_seekdir); + sys_seekdir(dirp, offset); + END_PROFILE(syscall_seekdir); +} + +long vfswrap_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +{ + long result; + START_PROFILE(syscall_telldir); + result = sys_telldir(dirp); + END_PROFILE(syscall_telldir); + return result; +} + +void vfswrap_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +{ + START_PROFILE(syscall_rewinddir); + sys_rewinddir(dirp); + END_PROFILE(syscall_rewinddir); +} + int vfswrap_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode) { int result; @@ -152,7 +175,7 @@ int vfswrap_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *di int result; START_PROFILE(syscall_closedir); - result = closedir(dirp); + result = sys_closedir(dirp); END_PROFILE(syscall_closedir); return result; } diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 0328558fe8..f30a555900 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -62,6 +62,9 @@ static struct vfs_ops default_vfs = { vfswrap_opendir, vfswrap_readdir, + vfswrap_seekdir, + vfswrap_telldir, + vfswrap_rewinddir, vfswrap_mkdir, vfswrap_rmdir, vfswrap_closedir, @@ -611,13 +614,13 @@ SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n) char *vfs_readdirname(connection_struct *conn, void *p) { - struct dirent *ptr= NULL; + SMB_STRUCT_DIRENT *ptr= NULL; char *dname; if (!p) return(NULL); - ptr = (struct dirent *)SMB_VFS_READDIR(conn,p); + ptr = SMB_VFS_READDIR(conn,p); if (!ptr) return(NULL); |