static struct dirent *skel_readdir(vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *dirp)
{
return NULL;
}
return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
}
-static struct dirent *skel_readdir(vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+static struct dirent *
+skel_readdir(vfs_handle_struct *handle, struct files_struct *dirfsp, DIR *dirp)
{
- return SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, sbuf);
+ return SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp);
}
static void skel_rewind_dir(vfs_handle_struct *handle, DIR *dirp)
* Version 48 - Add dirfsp to connectpath_fn()
* Change to Version 49 - will ship with 4.19
* Version 49 - remove seekdir and telldir
+ * Version 49 - remove "sbuf" argument from readdir_fn()
*/
#define SMB_VFS_INTERFACE_VERSION 49
DIR *(*fdopendir_fn)(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32_t attributes);
struct dirent *(*readdir_fn)(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf);
+ 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,
uint32_t attributes);
struct dirent *smb_vfs_call_readdir(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf);
+ 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,
const char *mask, uint32_t attr);
struct dirent *vfs_not_implemented_readdir(vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf);
+ 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_FDOPENDIR(handle, fsp, mask, attr) \
smb_vfs_call_fdopendir((handle)->next, (fsp), (mask), (attr))
-#define SMB_VFS_READDIR(conn, dirfsp, dirp, sbuf) \
- smb_vfs_call_readdir((conn)->vfs_handles, (dirfsp), (dirp), (sbuf))
-#define SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, sbuf) \
- smb_vfs_call_readdir((handle)->next, (dirfsp), (dirp), (sbuf))
+#define SMB_VFS_READDIR(conn, dirfsp, dirp) \
+ smb_vfs_call_readdir((conn)->vfs_handles, (dirfsp), (dirp))
+#define SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp) \
+ smb_vfs_call_readdir((handle)->next, (dirfsp), (dirp))
#define SMB_VFS_REWINDDIR(conn, dirp) \
smb_vfs_call_rewind_dir((conn)->vfs_handles, (dirp))
return SMB_VFS_NEXT_GET_QUOTA(handle, cap_smb_fname, qtype, id, dq);
}
-static struct dirent *cap_readdir(vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+static struct dirent *
+cap_readdir(vfs_handle_struct *handle, struct files_struct *dirfsp, DIR *dirp)
{
struct dirent *result;
struct dirent *newdirent;
size_t newnamelen;
DEBUG(3,("cap: cap_readdir\n"));
- result = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, NULL);
+ result = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp);
if (!result) {
return NULL;
}
static struct dirent *cephwrap_readdir(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *dirp)
{
struct dirent *result;
result = ceph_readdir(handle->data, (struct ceph_dir_result *) dirp);
DBG_DEBUG("[CEPH] readdir(...) = %p\n", result);
- /* Default Posix readdir() does not give us stat info.
- * Set to invalid to indicate we didn't return this info. */
- if (sbuf)
- SET_STAT_INVALID(*sbuf);
return result;
}
return result;
}
-
static struct dirent *vfswrap_readdir(vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *dirp)
{
struct dirent *result;
- bool fake_ctime = lp_fake_directory_create_times(SNUM(handle->conn));
- int flags = AT_SYMLINK_NOFOLLOW;
- SMB_STRUCT_STAT st = {0};
- int ret;
START_PROFILE(syscall_readdir);
result = readdir(dirp);
END_PROFILE(syscall_readdir);
- if (sbuf == NULL) {
- return result;
- }
- if (result == NULL) {
- return NULL;
- }
-
- /*
- * Default Posix readdir() does not give us stat info.
- * Set to invalid to indicate we didn't return this info.
- */
- SET_STAT_INVALID(*sbuf);
-
- ret = sys_fstatat(dirfd(dirp),
- result->d_name,
- &st,
- flags,
- fake_ctime);
- if (ret != 0) {
- return result;
- }
-
- /*
- * As this is an optimization, ignore it if we stat'ed a
- * symlink for non-POSIX context. Make the caller do it again
- * as we don't know if they wanted the link info, or its
- * target info.
- */
- if (S_ISLNK(st.st_ex_mode) &&
- !(dirfsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH))
- {
- return result;
- }
- *sbuf = st;
-
return result;
}
return false;
}
- dp = SMB_VFS_NEXT_READDIR(handle,
- data->fsp,
- data->source_directory,
- NULL);
+ dp = SMB_VFS_NEXT_READDIR(handle, data->fsp, data->source_directory);
if (dp == NULL) {
return false;
}
total_count++;
dp = SMB_VFS_NEXT_READDIR(handle,
data->fsp,
- data->source_directory,
- NULL);
+ data->source_directory);
} while (dp != NULL);
data->number_of_entries = total_count;
static struct dirent *dirsort_readdir(vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *dirp)
{
struct dirsort_privates *data = NULL;
struct timespec current_mtime;
static struct dirent *smb_full_audit_readdir(vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *dirp)
{
struct dirent *result;
- result = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, sbuf);
+ result = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp);
/* This operation has no reasonable error condition
* (End of dir is also failure), so always succeed.
static struct dirent *vfs_gluster_readdir(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *dirp)
{
static char direntbuf[512];
int ret;
- struct stat stat;
struct dirent *dirent = 0;
START_PROFILE(syscall_readdir);
- if (sbuf != NULL) {
- ret = glfs_readdirplus_r((void *)dirp, &stat, (void *)direntbuf,
- &dirent);
- } else {
- ret = glfs_readdir_r((void *)dirp, (void *)direntbuf, &dirent);
- }
+
+ ret = glfs_readdir_r((void *)dirp, (void *)direntbuf, &dirent);
if ((ret < 0) || (dirent == NULL)) {
END_PROFILE(syscall_readdir);
return NULL;
}
- if (sbuf != NULL) {
- SET_STAT_INVALID(*sbuf);
- if (!S_ISLNK(stat.st_mode)) {
- smb_stat_ex_from_stat(sbuf, &stat);
- }
- }
-
END_PROFILE(syscall_readdir);
return dirent;
}
* End of data: return NULL
* Failure: set errno, return NULL
*/
-static struct dirent *mh_readdir(vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+static struct dirent *
+mh_readdir(vfs_handle_struct *handle, struct files_struct *dirfsp, DIR *dirp)
{
mh_dirinfo_struct* dirInfo = (mh_dirinfo_struct*)dirp;
struct dirent *d = NULL;
if (! dirInfo->isInMediaFiles)
{
- d = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirInfo->dirstream, sbuf);
+ d = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirInfo->dirstream);
goto out;
}
bool isAppleDouble;
skip = False;
- d = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirInfo->dirstream, sbuf);
+ d = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirInfo->dirstream);
if (d == NULL)
{
_PUBLIC_
struct dirent *vfs_not_implemented_readdir(vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *dirp)
{
errno = ENOSYS;
return NULL;
while (True) {
struct dirent *d;
- d = SMB_VFS_NEXT_READDIR(handle, fsp, p, NULL);
+ d = SMB_VFS_NEXT_READDIR(handle, fsp, p);
if (d == NULL) {
break;
}
static struct dirent *shadow_copy_readdir(vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *_dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *_dirp)
{
shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp;
time(&(priv->snaps->fetch_time));
}
- while ((d = SMB_VFS_NEXT_READDIR(handle, dirfsp, p, NULL))) {
+ while ((d = SMB_VFS_NEXT_READDIR(handle, dirfsp, p))) {
char snapshot[GMT_NAME_LEN+1];
SHADOW_COPY_LABEL *tlabels;
return 0;
}
-static struct dirent *shadow_copy2_readdir(vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
-{
- struct shadow_copy2_private *priv = NULL;
- struct dirent *ent = NULL;
- struct smb_filename atname;
- struct smb_filename *full_fname = NULL;
- time_t timestamp = 0;
- char *stripped = NULL;
- char *conv = NULL;
- char *abspath = NULL;
- bool converted = false;
-
- SMB_VFS_HANDLE_GET_DATA(handle, priv, struct shadow_copy2_private,
- return NULL);
-
- ent = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, sbuf);
- if (ent == NULL) {
- return NULL;
- }
- if (sbuf == NULL) {
- return ent;
- }
- if (ISDOT(dirfsp->fsp_name->base_name) && ISDOTDOT(ent->d_name)) {
- return ent;
- }
-
- atname = (struct smb_filename) {
- .base_name = ent->d_name,
- .twrp = dirfsp->fsp_name->twrp,
- .flags = dirfsp->fsp_name->flags,
- };
-
- full_fname = full_path_from_dirfsp_atname(talloc_tos(),
- dirfsp,
- &atname);
- if (full_fname == NULL) {
- return NULL;
- }
-
- if (!shadow_copy2_strip_snapshot_converted(talloc_tos(),
- handle,
- full_fname,
- ×tamp,
- &stripped,
- &converted)) {
- TALLOC_FREE(full_fname);
- return NULL;
- }
-
- if (timestamp == 0 && !converted) {
- /* Not a snapshot path, no need for convert_sbuf() */
- TALLOC_FREE(stripped);
- TALLOC_FREE(full_fname);
- return ent;
- }
-
- if (timestamp == 0) {
- abspath = make_path_absolute(talloc_tos(),
- priv,
- full_fname->base_name);
- TALLOC_FREE(full_fname);
- if (abspath == NULL) {
- return NULL;
- }
- } else {
- conv = shadow_copy2_convert(talloc_tos(),
- handle,
- stripped,
- timestamp);
- TALLOC_FREE(stripped);
- if (conv == NULL) {
- return NULL;
- }
-
- abspath = make_path_absolute(talloc_tos(), priv, conv);
- TALLOC_FREE(conv);
- if (abspath == NULL) {
- return NULL;
- }
- }
-
- convert_sbuf(handle, abspath, sbuf);
-
- TALLOC_FREE(abspath);
- return ent;
-}
-
static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
.connect_fn = shadow_copy2_connect,
.disk_free_fn = shadow_copy2_disk_free,
.pwrite_recv_fn = shadow_copy2_pwrite_recv,
.connectpath_fn = shadow_copy2_connectpath,
.parent_pathname_fn = shadow_copy2_parent_pathname,
- .readdir_fn = shadow_copy2_readdir,
};
static_decl_vfs;
static struct dirent *smb_time_audit_readdir(vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *dirp)
{
struct dirent *result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, sbuf);
+ result = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
* End of data: return NULL
* Failure: set errno, return NULL
*/
-static struct dirent *um_readdir(vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+static struct dirent *
+um_readdir(vfs_handle_struct *handle, struct files_struct *dirfsp, DIR *dirp)
{
um_dirinfo_struct* dirInfo = (um_dirinfo_struct*)dirp;
struct dirent *d = NULL;
dirInfo->clientSubDirname));
if (!dirInfo->isInMediaFiles) {
- return SMB_VFS_NEXT_READDIR(handle, dirfsp, dirInfo->dirstream, sbuf);
+ return SMB_VFS_NEXT_READDIR(handle, dirfsp, dirInfo->dirstream);
}
do {
uintmax_t number;
skip = false;
- d = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirInfo->dirstream, sbuf);
+ d = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirInfo->dirstream);
if (d == NULL) {
break;
&how);
}
-static struct dirent *widelinks_readdir(vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
-{
- struct widelinks_config *config = NULL;
- struct dirent *result;
-
- SMB_VFS_HANDLE_GET_DATA(handle,
- config,
- struct widelinks_config,
- return NULL);
-
- result = SMB_VFS_NEXT_READDIR(handle,
- dirfsp,
- dirp,
- sbuf);
-
- if (!config->active) {
- /* Module not active. */
- return result;
- }
-
- /*
- * Prevent optimization of returning
- * the stat info. Force caller to go
- * through our LSTAT that hides symlinks.
- */
-
- if (sbuf) {
- SET_STAT_INVALID(*sbuf);
- }
- return result;
-}
-
static struct vfs_fn_pointers vfs_widelinks_fns = {
.connect_fn = widelinks_connect,
.chdir_fn = widelinks_chdir,
.getwd_fn = widelinks_getwd,
.realpath_fn = widelinks_realpath,
- .readdir_fn = widelinks_readdir
};
static_decl_vfs;
void *p,
char **talloced)
{
- struct stat_ex st = {
- .st_ex_nlink = 0,
- };
struct dirent *ptr= NULL;
const char *dname;
char *translated;
if (!p)
return(NULL);
- ptr = SMB_VFS_READDIR(conn, dirfsp, (DIR *)p, &st);
+ ptr = SMB_VFS_READDIR(conn, dirfsp, (DIR *)p);
if (!ptr)
return(NULL);
struct dirent *smb_vfs_call_readdir(struct vfs_handle_struct *handle,
struct files_struct *dirfsp,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ DIR *dirp)
{
VFS_FIND(readdir);
- return handle->fns->readdir_fn(handle, dirfsp, dirp, sbuf);
+ return handle->fns->readdir_fn(handle, dirfsp, dirp);
}
void smb_vfs_call_rewind_dir(struct vfs_handle_struct *handle,