summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2022-01-06 15:59:05 +0100
committerJeremy Allison <jra@samba.org>2022-03-10 18:23:35 +0000
commit812cb602e3be3ffc4400cff1df63295cf2f4cd21 (patch)
treec452c68f00842f48ca880dea8210f1a86c67457a /examples
parentc51f9ab233e548010816f9774784880340fa8c79 (diff)
downloadsamba-812cb602e3be3ffc4400cff1df63295cf2f4cd21.tar.gz
vfs: Add SMB_VFS_FSTATAT
Useful if you want to stat/fstat/lstat relative to a directory without doing chdir first. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/VFS/skel_opaque.c12
-rw-r--r--examples/VFS/skel_transparent.c11
2 files changed, 23 insertions, 0 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index cc7bb880d5c..e39668ed2a8 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -345,6 +345,17 @@ static int skel_lstat(vfs_handle_struct *handle,
return -1;
}
+static int skel_fstatat(
+ struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ SMB_STRUCT_STAT *sbuf,
+ int flags)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
struct files_struct *fsp,
const SMB_STRUCT_STAT *sbuf)
@@ -1001,6 +1012,7 @@ static struct vfs_fn_pointers skel_opaque_fns = {
.stat_fn = skel_stat,
.fstat_fn = skel_fstat,
.lstat_fn = skel_lstat,
+ .fstatat_fn = skel_fstatat,
.get_alloc_size_fn = skel_get_alloc_size,
.unlinkat_fn = skel_unlinkat,
.fchmod_fn = skel_fchmod,
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index e145881b704..5508e084abd 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -473,6 +473,16 @@ static int skel_lstat(vfs_handle_struct *handle,
return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
}
+static int skel_fstatat(
+ struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ SMB_STRUCT_STAT *sbuf,
+ int flags)
+{
+ return SMB_VFS_NEXT_FSTATAT(handle, dirfsp, smb_fname, sbuf, flags);
+}
+
static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle,
struct files_struct *fsp,
const SMB_STRUCT_STAT *sbuf)
@@ -1316,6 +1326,7 @@ static struct vfs_fn_pointers skel_transparent_fns = {
.stat_fn = skel_stat,
.fstat_fn = skel_fstat,
.lstat_fn = skel_lstat,
+ .fstatat_fn = skel_fstatat,
.get_alloc_size_fn = skel_get_alloc_size,
.unlinkat_fn = skel_unlinkat,
.fchmod_fn = skel_fchmod,