return NULL;
}
-static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
-{
- ;
-}
-
-static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
-{
- return (long)-1;
-}
-
static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
{
;
.fdopendir_fn = skel_fdopendir,
.readdir_fn = skel_readdir,
- .seekdir_fn = skel_seekdir,
- .telldir_fn = skel_telldir,
.rewind_dir_fn = skel_rewind_dir,
.mkdirat_fn = skel_mkdirat,
.closedir_fn = skel_closedir,
return SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, sbuf);
}
-static void skel_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
-{
- SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
-}
-
-static long skel_telldir(vfs_handle_struct *handle, DIR *dirp)
-{
- return SMB_VFS_NEXT_TELLDIR(handle, dirp);
-}
-
static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
{
SMB_VFS_NEXT_REWINDDIR(handle, dirp);
.fdopendir_fn = skel_fdopendir,
.readdir_fn = skel_readdir,
- .seekdir_fn = skel_seekdir,
- .telldir_fn = skel_telldir,
.rewind_dir_fn = skel_rewind_dir,
.mkdirat_fn = skel_mkdirat,
.closedir_fn = skel_closedir,
SMBPROFILE_STATS_BASIC(syscall_opendir) \
SMBPROFILE_STATS_BASIC(syscall_fdopendir) \
SMBPROFILE_STATS_BASIC(syscall_readdir) \
- SMBPROFILE_STATS_BASIC(syscall_seekdir) \
- SMBPROFILE_STATS_BASIC(syscall_telldir) \
SMBPROFILE_STATS_BASIC(syscall_rewinddir) \
SMBPROFILE_STATS_BASIC(syscall_mkdirat) \
SMBPROFILE_STATS_BASIC(syscall_closedir) \
* Change to Version 48 - will ship with 4.18
* Version 48 - Add cached_dos_attributes to struct stat_ex
* Version 48 - Add dirfsp to connectpath_fn()
+ * Change to Version 49 - will ship with 4.19
+ * Version 49 - remove seekdir and telldir
*/
-#define SMB_VFS_INTERFACE_VERSION 48
+#define SMB_VFS_INTERFACE_VERSION 49
/*
All intercepted VFS operations must be declared as static functions inside module source
struct files_struct *dirfsp,
DIR *dirp,
SMB_STRUCT_STAT *sbuf);
- void (*seekdir_fn)(struct vfs_handle_struct *handle, DIR *dirp, long offset);
- long (*telldir_fn)(struct vfs_handle_struct *handle, DIR *dirp);
void (*rewind_dir_fn)(struct vfs_handle_struct *handle, DIR *dirp);
int (*mkdirat_fn)(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
struct files_struct *dirfsp,
DIR *dirp,
SMB_STRUCT_STAT *sbuf);
-void smb_vfs_call_seekdir(struct vfs_handle_struct *handle,
- DIR *dirp, long offset);
-long smb_vfs_call_telldir(struct vfs_handle_struct *handle,
- DIR *dirp);
void smb_vfs_call_rewind_dir(struct vfs_handle_struct *handle,
DIR *dirp);
int smb_vfs_call_mkdirat(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
DIR *dirp,
SMB_STRUCT_STAT *sbuf);
-void vfs_not_implemented_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset);
-long vfs_not_implemented_telldir(vfs_handle_struct *handle, DIR *dirp);
void vfs_not_implemented_rewind_dir(vfs_handle_struct *handle, DIR *dirp);
int vfs_not_implemented_mkdirat(vfs_handle_struct *handle,
struct files_struct *dirfsp,
#define SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, sbuf) \
smb_vfs_call_readdir((handle)->next, (dirfsp), (dirp), (sbuf))
-#define SMB_VFS_SEEKDIR(conn, dirp, offset) \
- smb_vfs_call_seekdir((conn)->vfs_handles, (dirp), (offset))
-#define SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset) \
- smb_vfs_call_seekdir((handle)->next, (dirp), (offset))
-
-#define SMB_VFS_TELLDIR(conn, dirp) \
- smb_vfs_call_telldir((conn)->vfs_handles, (dirp))
-#define SMB_VFS_NEXT_TELLDIR(handle, dirp) \
- smb_vfs_call_telldir((handle)->next, (dirp))
-
#define SMB_VFS_REWINDDIR(conn, dirp) \
smb_vfs_call_rewind_dir((conn)->vfs_handles, (dirp))
#define SMB_VFS_NEXT_REWINDDIR(handle, dirp) \
| SMB_VFS_LSTAT() | [[Path][Path]] | Todo |
| SMB_VFS_MKDIRAT() | [[NsC][NsC]] | - |
| SMB_VFS_MKNODAT() | [[NsC][NsC]] | - |
-| SMB_VFS_NTIMES() | [[Path][Path]] | - |
+| SMB_VFS_NTIMES() | [[Path][Path]] | - |
| SMB_VFS_OFFLOAD_READ_RECV() | [[fsp][fsp]] | - |
| SMB_VFS_OFFLOAD_READ_SEND() | [[fsp][fsp]] | - |
| SMB_VFS_OFFLOAD_WRITE_RECV() | [[fsp][fsp]] | - |
| SMB_VFS_PWRITE_SEND() | [[fsp][fsp]] | - |
| SMB_VFS_READ_DFS_PATHAT() | [[Symlink][Symlink]] | - |
| SMB_VFS_READDIR() | [[fsp][fsp]] | - |
-| SMB_VFS_READDIR_ATTR() | [[Path][Path]] | - |
+| SMB_VFS_READDIR_ATTR() | [[Path][Path]] | - |
| SMB_VFS_READLINKAT() | [[Symlink][Symlink]] | - |
| SMB_VFS_REALPATH() | [[P2px][P2px]] | - |
| SMB_VFS_RECVFILE() | [[fsp][fsp]] | - |
| SMB_VFS_REMOVEXATTR() | [[Path][Path]] | - |
| SMB_VFS_RENAMEAT() | [[Path][Path]] | ---- |
| SMB_VFS_REWINDDIR() | [[fsp][fsp]] | - |
-| SMB_VFS_SEEKDIR() | [[fsp][fsp]] | - |
| SMB_VFS_SENDFILE() | [[fsp][fsp]] | - |
| SMB_VFS_SET_COMPRESSION() | [[fsp][fsp]] | - |
| SMB_VFS_SET_DOS_ATTRIBUTES() | [[Path][Path]] | - |
| SMB_VFS_SYS_ACL_GET_FD() | [[xpathref][xpathref]] | - |
| SMB_VFS_SYS_ACL_GET_FILE() | [[Path][Path]] | - |
| SMB_VFS_SYS_ACL_SET_FD() | [[xpathref][xpathref]] | - |
-| SMB_VFS_TELLDIR() | [[fsp][fsp]] | - |
| SMB_VFS_TRANSLATE_NAME() | [[P2px][P2px]] | - |
| SMB_VFS_UNLINKAT() | [[NsC][NsC]] | - |
|-----------------------------------+----------+--------|
- SMB_VFS_READDIR()
- SMB_VFS_RECVFILE()
- SMB_VFS_REWINDDIR()
- - SMB_VFS_SEEKDIR()
- SMB_VFS_SENDFILE()
- SMB_VFS_SET_COMPRESSION()
- SMB_VFS_STRICT_LOCK_CHECK()
- - SMB_VFS_TELLDIR()
If an fsp is provided by the SMB layer we use that, otherwise we use the
pathref fsp =smb_fname->fsp= provided by =filename_convert()=.
SMB_VFS_REMOVEXATTR() [Path] -
SMB_VFS_RENAMEAT() [Path] -
SMB_VFS_REWINDDIR() [fsp] -
- SMB_VFS_SEEKDIR() [fsp] -
SMB_VFS_SENDFILE() [fsp] -
SMB_VFS_SET_COMPRESSION() [fsp] -
SMB_VFS_SET_DOS_ATTRIBUTES() [Path] -
SMB_VFS_SYS_ACL_GET_FD() [xpathref] -
SMB_VFS_SYS_ACL_GET_FILE() [Path] -
SMB_VFS_SYS_ACL_SET_FD() [xpathref] -
- SMB_VFS_TELLDIR() [fsp] -
SMB_VFS_TRANSLATE_NAME() [P2px] -
SMB_VFS_UNLINKAT() [NsC] -
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
• SMB_VFS_READDIR()
• SMB_VFS_RECVFILE()
• SMB_VFS_REWINDDIR()
- • SMB_VFS_SEEKDIR()
• SMB_VFS_SENDFILE()
• SMB_VFS_SET_COMPRESSION()
• SMB_VFS_STRICT_LOCK_CHECK()
- • SMB_VFS_TELLDIR()
If an fsp is provided by the SMB layer we use that, otherwise we use the
pathref fsp `smb_fname->fsp' provided by `filename_convert()'.
return result;
}
-static void cephwrap_seekdir(struct vfs_handle_struct *handle, DIR *dirp, long offset)
-{
- DBG_DEBUG("[CEPH] seekdir(%p, %p, %ld)\n", handle, dirp, offset);
- ceph_seekdir(handle->data, (struct ceph_dir_result *) dirp, offset);
-}
-
-static long cephwrap_telldir(struct vfs_handle_struct *handle, DIR *dirp)
-{
- long ret;
- DBG_DEBUG("[CEPH] telldir(%p, %p)\n", handle, dirp);
- ret = ceph_telldir(handle->data, (struct ceph_dir_result *) dirp);
- DBG_DEBUG("[CEPH] telldir(...) = %ld\n", ret);
- WRAP_RETURN(ret);
-}
-
static void cephwrap_rewinddir(struct vfs_handle_struct *handle, DIR *dirp)
{
DBG_DEBUG("[CEPH] rewinddir(%p, %p)\n", handle, dirp);
.fdopendir_fn = cephwrap_fdopendir,
.readdir_fn = cephwrap_readdir,
- .seekdir_fn = cephwrap_seekdir,
- .telldir_fn = cephwrap_telldir,
.rewind_dir_fn = cephwrap_rewinddir,
.mkdirat_fn = cephwrap_mkdirat,
.closedir_fn = cephwrap_closedir,
return NT_STATUS_NOT_SUPPORTED;
}
-static void vfswrap_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
-{
- START_PROFILE(syscall_seekdir);
- seekdir(dirp, offset);
- END_PROFILE(syscall_seekdir);
-}
-
-static long vfswrap_telldir(vfs_handle_struct *handle, DIR *dirp)
-{
- long result;
- START_PROFILE(syscall_telldir);
- result = telldir(dirp);
- END_PROFILE(syscall_telldir);
- return result;
-}
-
static void vfswrap_rewinddir(vfs_handle_struct *handle, DIR *dirp)
{
START_PROFILE(syscall_rewinddir);
.fdopendir_fn = vfswrap_fdopendir,
.readdir_fn = vfswrap_readdir,
.freaddir_attr_fn = vfswrap_freaddir_attr,
- .seekdir_fn = vfswrap_seekdir,
- .telldir_fn = vfswrap_telldir,
.rewind_dir_fn = vfswrap_rewinddir,
.mkdirat_fn = vfswrap_mkdirat,
.closedir_fn = vfswrap_closedir,
return &data->directory_list[data->pos++];
}
-static void dirsort_seekdir(vfs_handle_struct *handle, DIR *dirp,
- long offset)
-{
- struct timespec current_mtime;
- struct dirsort_privates *data = NULL;
-
- SMB_VFS_HANDLE_GET_DATA(handle, data, struct dirsort_privates, return);
-
- /* Find the entry holding dirp. */
- while(data && (data->source_directory != dirp)) {
- data = data->next;
- }
- if (data == NULL) {
- return;
- }
- if (offset >= data->number_of_entries) {
- return;
- }
- data->pos = offset;
-
- if (get_sorted_dir_mtime(handle, data, ¤t_mtime) == false) {
- return;
- }
-
- if (timespec_compare(¤t_mtime, &data->mtime)) {
- /* Directory changed. We must re-read the
- cache and search for the name that was
- previously stored at the offset being
- requested, otherwise after the re-sort
- we will point to the wrong entry. The
- OS/2 incremental delete code relies on
- this. */
- unsigned int i;
- char *wanted_name = talloc_strdup(handle->conn,
- data->directory_list[offset].d_name);
- if (wanted_name == NULL) {
- return;
- }
- SMB_VFS_NEXT_REWINDDIR(handle, data->source_directory);
- open_and_sort_dir(handle, data);
- /* Now search for where we were. */
- data->pos = 0;
- for (i = 0; i < data->number_of_entries; i++) {
- if(strcmp(wanted_name, data->directory_list[i].d_name) == 0) {
- data->pos = i;
- break;
- }
- }
- TALLOC_FREE(wanted_name);
- }
-}
-
-static long dirsort_telldir(vfs_handle_struct *handle, DIR *dirp)
-{
- struct dirsort_privates *data = NULL;
- SMB_VFS_HANDLE_GET_DATA(handle, data, struct dirsort_privates,
- return -1);
-
- /* Find the entry holding dirp. */
- while(data && (data->source_directory != dirp)) {
- data = data->next;
- }
- if (data == NULL) {
- return -1;
- }
- return data->pos;
-}
-
static void dirsort_rewinddir(vfs_handle_struct *handle, DIR *dirp)
{
struct dirsort_privates *data = NULL;
static struct vfs_fn_pointers vfs_dirsort_fns = {
.fdopendir_fn = dirsort_fdopendir,
.readdir_fn = dirsort_readdir,
- .seekdir_fn = dirsort_seekdir,
- .telldir_fn = dirsort_telldir,
.rewind_dir_fn = dirsort_rewinddir,
.closedir_fn = dirsort_closedir,
};
SMB_VFS_OP_FDOPENDIR,
SMB_VFS_OP_READDIR,
- SMB_VFS_OP_SEEKDIR,
- SMB_VFS_OP_TELLDIR,
SMB_VFS_OP_REWINDDIR,
SMB_VFS_OP_MKDIRAT,
SMB_VFS_OP_CLOSEDIR,
{ SMB_VFS_OP_READ_DFS_PATHAT, "read_dfs_pathat" },
{ SMB_VFS_OP_FDOPENDIR, "fdopendir" },
{ SMB_VFS_OP_READDIR, "readdir" },
- { SMB_VFS_OP_SEEKDIR, "seekdir" },
- { SMB_VFS_OP_TELLDIR, "telldir" },
{ SMB_VFS_OP_REWINDDIR, "rewinddir" },
{ SMB_VFS_OP_MKDIRAT, "mkdirat" },
{ SMB_VFS_OP_CLOSEDIR, "closedir" },
return result;
}
-static void smb_full_audit_seekdir(vfs_handle_struct *handle,
- DIR *dirp, long offset)
-{
- SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
-
- do_log(SMB_VFS_OP_SEEKDIR, True, handle, "");
-}
-
-static long smb_full_audit_telldir(vfs_handle_struct *handle,
- DIR *dirp)
-{
- long result;
-
- result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
-
- do_log(SMB_VFS_OP_TELLDIR, True, handle, "");
-
- return result;
-}
-
static void smb_full_audit_rewinddir(vfs_handle_struct *handle,
DIR *dirp)
{
.read_dfs_pathat_fn = smb_full_audit_read_dfs_pathat,
.fdopendir_fn = smb_full_audit_fdopendir,
.readdir_fn = smb_full_audit_readdir,
- .seekdir_fn = smb_full_audit_seekdir,
- .telldir_fn = smb_full_audit_telldir,
.rewind_dir_fn = smb_full_audit_rewinddir,
.mkdirat_fn = smb_full_audit_mkdirat,
.closedir_fn = smb_full_audit_closedir,
return dirent;
}
-static long vfs_gluster_telldir(struct vfs_handle_struct *handle, DIR *dirp)
-{
- long ret;
-
- START_PROFILE(syscall_telldir);
- ret = glfs_telldir((void *)dirp);
- END_PROFILE(syscall_telldir);
-
- return ret;
-}
-
-static void vfs_gluster_seekdir(struct vfs_handle_struct *handle, DIR *dirp,
- long offset)
-{
- START_PROFILE(syscall_seekdir);
- glfs_seekdir((void *)dirp, offset);
- END_PROFILE(syscall_seekdir);
-}
-
static void vfs_gluster_rewinddir(struct vfs_handle_struct *handle, DIR *dirp)
{
START_PROFILE(syscall_rewinddir);
.fdopendir_fn = vfs_gluster_fdopendir,
.readdir_fn = vfs_gluster_readdir,
- .seekdir_fn = vfs_gluster_seekdir,
- .telldir_fn = vfs_gluster_telldir,
.rewind_dir_fn = vfs_gluster_rewinddir,
.mkdirat_fn = vfs_gluster_mkdirat,
.closedir_fn = vfs_gluster_closedir,
return d;
}
-/*
- * Success: no success result defined.
- * Failure: no failure result defined.
- */
-static void mh_seekdir(vfs_handle_struct *handle,
- DIR *dirp,
- long offset)
-{
- DEBUG(MH_INFO_DEBUG, ("Entering and leaving mh_seekdir\n"));
- SMB_VFS_NEXT_SEEKDIR(handle,
- ((mh_dirinfo_struct*)dirp)->dirstream, offset);
-}
-
-/*
- * Success: return long
- * Failure: no failure result defined.
- */
-static long mh_telldir(vfs_handle_struct *handle,
- DIR *dirp)
-{
- DEBUG(MH_INFO_DEBUG, ("Entering and leaving mh_telldir\n"));
- return SMB_VFS_NEXT_TELLDIR(handle,
- ((mh_dirinfo_struct*)dirp)->dirstream);
-}
-
/*
* Success: no success result defined.
* Failure: no failure result defined.
.fdopendir_fn = mh_fdopendir,
.readdir_fn = mh_readdir,
- .seekdir_fn = mh_seekdir,
- .telldir_fn = mh_telldir,
.rewind_dir_fn = mh_rewinddir,
.mkdirat_fn = mh_mkdirat,
.closedir_fn = mh_closedir,
return NULL;
}
-_PUBLIC_
-void vfs_not_implemented_seekdir(vfs_handle_struct *handle, DIR *dirp, long offset)
-{
- ;
-}
-
-_PUBLIC_
-long vfs_not_implemented_telldir(vfs_handle_struct *handle, DIR *dirp)
-{
- errno = ENOSYS;
- return (long)-1;
-}
-
_PUBLIC_
void vfs_not_implemented_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
{
.fdopendir_fn = vfs_not_implemented_fdopendir,
.readdir_fn = vfs_not_implemented_readdir,
- .seekdir_fn = vfs_not_implemented_seekdir,
- .telldir_fn = vfs_not_implemented_telldir,
.rewind_dir_fn = vfs_not_implemented_rewind_dir,
.mkdirat_fn = vfs_not_implemented_mkdirat,
.closedir_fn = vfs_not_implemented_closedir,
return NULL;
}
-static void shadow_copy_seekdir(struct vfs_handle_struct *handle, DIR *_dirp, long offset)
-{
- shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp;
-
- if (offset < dirp->num) {
- dirp->pos = offset ;
- }
-}
-
-static long shadow_copy_telldir(struct vfs_handle_struct *handle, DIR *_dirp)
-{
- shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp;
- return( dirp->pos ) ;
-}
-
static void shadow_copy_rewinddir(struct vfs_handle_struct *handle, DIR *_dirp)
{
shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp;
static struct vfs_fn_pointers vfs_shadow_copy_fns = {
.fdopendir_fn = shadow_copy_fdopendir,
.readdir_fn = shadow_copy_readdir,
- .seekdir_fn = shadow_copy_seekdir,
- .telldir_fn = shadow_copy_telldir,
.rewind_dir_fn = shadow_copy_rewinddir,
.closedir_fn = shadow_copy_closedir,
.get_shadow_copy_data_fn = shadow_copy_get_shadow_copy_data,
return result;
}
-static void smb_time_audit_seekdir(vfs_handle_struct *handle,
- DIR *dirp, long offset)
-{
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log("seekdir", timediff);
- }
-
-}
-
-static long smb_time_audit_telldir(vfs_handle_struct *handle,
- DIR *dirp)
-{
- long result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log("telldir", timediff);
- }
-
- return result;
-}
-
static void smb_time_audit_rewinddir(vfs_handle_struct *handle,
DIR *dirp)
{
.read_dfs_pathat_fn = smb_time_audit_read_dfs_pathat,
.fdopendir_fn = smb_time_audit_fdopendir,
.readdir_fn = smb_time_audit_readdir,
- .seekdir_fn = smb_time_audit_seekdir,
- .telldir_fn = smb_time_audit_telldir,
.rewind_dir_fn = smb_time_audit_rewinddir,
.mkdirat_fn = smb_time_audit_mkdirat,
.closedir_fn = smb_time_audit_closedir,
return NULL;
}
-static void um_seekdir(vfs_handle_struct *handle,
- DIR *dirp,
- long offset)
-{
- DEBUG(10, ("Entering and leaving um_seekdir\n"));
- SMB_VFS_NEXT_SEEKDIR(handle,
- ((um_dirinfo_struct*)dirp)->dirstream, offset);
-}
-
-static long um_telldir(vfs_handle_struct *handle,
- DIR *dirp)
-{
- DEBUG(10, ("Entering and leaving um_telldir\n"));
- return SMB_VFS_NEXT_TELLDIR(handle,
- ((um_dirinfo_struct*)dirp)->dirstream);
-}
-
static void um_rewinddir(vfs_handle_struct *handle,
DIR *dirp)
{
.fdopendir_fn = um_fdopendir,
.readdir_fn = um_readdir,
- .seekdir_fn = um_seekdir,
- .telldir_fn = um_telldir,
.rewind_dir_fn = um_rewinddir,
.mkdirat_fn = um_mkdirat,
.closedir_fn = um_closedir,
return handle->fns->readdir_fn(handle, dirfsp, dirp, sbuf);
}
-void smb_vfs_call_seekdir(struct vfs_handle_struct *handle,
- DIR *dirp, long offset)
-{
- VFS_FIND(seekdir);
- handle->fns->seekdir_fn(handle, dirp, offset);
-}
-
-long smb_vfs_call_telldir(struct vfs_handle_struct *handle,
- DIR *dirp)
-{
- VFS_FIND(telldir);
- return handle->fns->telldir_fn(handle, dirp);
-}
-
void smb_vfs_call_rewind_dir(struct vfs_handle_struct *handle,
DIR *dirp)
{