summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2022-06-03 15:53:29 +0200
committerJeremy Allison <jra@samba.org>2022-08-06 01:43:50 +0000
commit5fc016f26852a1cc1d7809919ff00cc0404e23e3 (patch)
treedb391ac330045c54731107c5452be14dd1e38fb0 /examples
parent5aaf38949aba3176f43719c4c0ec29ae1398f962 (diff)
downloadsamba-5fc016f26852a1cc1d7809919ff00cc0404e23e3.tar.gz
vfs: change openat propotype to match linux openat2
The Linux prototype for openat2 looks like this: long openat2(int dirfd, const char *pathname, struct open_how *how, size_t size); where "struct open_how" is defined in "linux/openat2.h". It is designed to be extensible with further flags. The "size" parameter is required because there is no type checking between userland and kernelspace, so the way for Linux to find which version of open_how is being passed in is looking at the size: "open_how" is expected to only every grow with additional fields, should a change be necessary in the future. Samba does not have this problem, we can typecheck the struct and pointers, we expect all VFS modules to be compiled against the current vfs.h. For now this adds no functionality, but it will make further patches much smaller. Pair-programmed-with: Stefan Metzmacher <metze@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/VFS/skel_opaque.c3
-rw-r--r--examples/VFS/skel_transparent.c5
2 files changed, 3 insertions, 5 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 23614b660d9..61c343f5434 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -197,8 +197,7 @@ static int skel_openat(struct vfs_handle_struct *handle,
const struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
struct files_struct *fsp,
- int flags,
- mode_t mode)
+ const struct vfs_open_how *how)
{
errno = ENOSYS;
return -1;
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 9fc211c5e2e..8fb8644ad09 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -206,10 +206,9 @@ static int skel_openat(struct vfs_handle_struct *handle,
const struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
struct files_struct *fsp,
- int flags,
- mode_t mode)
+ const struct vfs_open_how *how)
{
- return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+ return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, how);
}
static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,