From 1ec030398bdc6f912d9beb3bcd0db7860a92eede Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 18 Sep 2019 10:04:03 -0700 Subject: [PATCH] s3: VFS: Complete the replacement of SMB_VFS_UNLINK() -> SMB_VFS_UNLINKAT(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Thu Sep 26 18:40:53 UTC 2019 on sn-devel-184 --- examples/VFS/skel_opaque.c | 8 -------- examples/VFS/skel_transparent.c | 7 ------- source3/include/smbprofile.h | 1 - source3/include/vfs.h | 8 +------- source3/include/vfs_macros.h | 5 ----- source3/modules/vfs_default.c | 19 ------------------- source3/modules/vfs_not_implemented.c | 8 -------- source3/smbd/vfs.c | 7 ------- 8 files changed, 1 insertion(+), 62 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 2695b82ab45..59804675c8e 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -344,13 +344,6 @@ static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, return -1; } -static int skel_unlink(vfs_handle_struct *handle, - const struct smb_filename *smb_fname) -{ - errno = ENOSYS; - return -1; -} - static int skel_unlinkat(vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *smb_fname, @@ -1085,7 +1078,6 @@ static struct vfs_fn_pointers skel_opaque_fns = { .fstat_fn = skel_fstat, .lstat_fn = skel_lstat, .get_alloc_size_fn = skel_get_alloc_size, - .unlink_fn = skel_unlink, .unlinkat_fn = skel_unlinkat, .chmod_fn = skel_chmod, .fchmod_fn = skel_fchmod, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index f760730400b..c73c2a2692b 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -462,12 +462,6 @@ static uint64_t skel_get_alloc_size(struct vfs_handle_struct *handle, return SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf); } -static int skel_unlink(vfs_handle_struct *handle, - const struct smb_filename *smb_fname) -{ - return SMB_VFS_NEXT_UNLINK(handle, smb_fname); -} - static int skel_unlinkat(vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *smb_fname, @@ -1372,7 +1366,6 @@ static struct vfs_fn_pointers skel_transparent_fns = { .fstat_fn = skel_fstat, .lstat_fn = skel_lstat, .get_alloc_size_fn = skel_get_alloc_size, - .unlink_fn = skel_unlink, .unlinkat_fn = skel_unlinkat, .chmod_fn = skel_chmod, .fchmod_fn = skel_fchmod, diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h index cc54669c772..cc54dea2710 100644 --- a/source3/include/smbprofile.h +++ b/source3/include/smbprofile.h @@ -67,7 +67,6 @@ struct tevent_context; SMBPROFILE_STATS_BASIC(syscall_fstat) \ SMBPROFILE_STATS_BASIC(syscall_lstat) \ SMBPROFILE_STATS_BASIC(syscall_get_alloc_size) \ - SMBPROFILE_STATS_BASIC(syscall_unlink) \ SMBPROFILE_STATS_BASIC(syscall_unlinkat) \ SMBPROFILE_STATS_BASIC(syscall_chmod) \ SMBPROFILE_STATS_BASIC(syscall_fchmod) \ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 883989c82ad..6ba653f56c7 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -281,7 +281,7 @@ /* Version 42 - Move change_to_user() -> change_to_user_and_service() */ /* Version 42 - Move change_to_user_by_fsp() -> change_to_user_and_service_by_fsp() */ /* Version 42 - Move [un]become_user*() -> [un]become_user_without_service*() */ -/* Version 42 - Add SMB_VFS_UNLINKAT. */ +/* Version 42 - Move SMB_VFS_UNLINK -> SMB_VFS_UNLINKAT. */ #define SMB_VFS_INTERFACE_VERSION 42 @@ -777,8 +777,6 @@ struct vfs_fn_pointers { int (*fstat_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf); int (*lstat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_filename); uint64_t (*get_alloc_size_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf); - int (*unlink_fn)(struct vfs_handle_struct *handle, - const struct smb_filename *smb_fname); int (*unlinkat_fn)(struct vfs_handle_struct *handle, struct files_struct *srcdir_fsp, const struct smb_filename *smb_fname, @@ -1308,8 +1306,6 @@ int smb_vfs_call_lstat(struct vfs_handle_struct *handle, uint64_t smb_vfs_call_get_alloc_size(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf); -int smb_vfs_call_unlink(struct vfs_handle_struct *handle, - const struct smb_filename *smb_fname); int smb_vfs_call_unlinkat(struct vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *smb_fname, @@ -1749,8 +1745,6 @@ int vfs_not_implemented_lstat(vfs_handle_struct *handle, uint64_t vfs_not_implemented_get_alloc_size(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf); -int vfs_not_implemented_unlink(vfs_handle_struct *handle, - const struct smb_filename *smb_fname); int vfs_not_implemented_unlinkat(vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *smb_fname, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 055555a4b07..2979769e7d5 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -221,11 +221,6 @@ #define SMB_VFS_NEXT_GET_ALLOC_SIZE(conn, fsp, sbuf) \ smb_vfs_call_get_alloc_size((conn)->next, (fsp), (sbuf)) -#define SMB_VFS_UNLINK(conn, path) \ - smb_vfs_call_unlink((conn)->vfs_handles, (path)) -#define SMB_VFS_NEXT_UNLINK(handle, path) \ - smb_vfs_call_unlink((handle)->next, (path)) - #define SMB_VFS_UNLINKAT(conn, dirfsp, path, flags) \ smb_vfs_call_unlinkat((conn)->vfs_handles, (dirfsp), (path), (flags)) #define SMB_VFS_NEXT_UNLINKAT(handle, dirfsp, path, flags) \ diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index de6d7892d5e..781c5e06fad 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2204,24 +2204,6 @@ static uint64_t vfswrap_get_alloc_size(vfs_handle_struct *handle, return result; } -static int vfswrap_unlink(vfs_handle_struct *handle, - const struct smb_filename *smb_fname) -{ - int result = -1; - - START_PROFILE(syscall_unlink); - - if (smb_fname->stream_name) { - errno = ENOENT; - goto out; - } - result = unlink(smb_fname->base_name); - - out: - END_PROFILE(syscall_unlink); - return result; -} - static int vfswrap_unlinkat(vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *smb_fname, @@ -3511,7 +3493,6 @@ static struct vfs_fn_pointers vfs_default_fns = { .fstat_fn = vfswrap_fstat, .lstat_fn = vfswrap_lstat, .get_alloc_size_fn = vfswrap_get_alloc_size, - .unlink_fn = vfswrap_unlink, .unlinkat_fn = vfswrap_unlinkat, .chmod_fn = vfswrap_chmod, .fchmod_fn = vfswrap_fchmod, diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index 0c7a8e686f0..ffcba7bd8db 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -342,13 +342,6 @@ uint64_t vfs_not_implemented_get_alloc_size(struct vfs_handle_struct *handle, return -1; } -int vfs_not_implemented_unlink(vfs_handle_struct *handle, - const struct smb_filename *smb_fname) -{ - errno = ENOSYS; - return -1; -} - int vfs_not_implemented_unlinkat(vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *smb_fname, @@ -1089,7 +1082,6 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = { .fstat_fn = vfs_not_implemented_fstat, .lstat_fn = vfs_not_implemented_lstat, .get_alloc_size_fn = vfs_not_implemented_get_alloc_size, - .unlink_fn = vfs_not_implemented_unlink, .unlinkat_fn = vfs_not_implemented_unlinkat, .chmod_fn = vfs_not_implemented_chmod, .fchmod_fn = vfs_not_implemented_fchmod, diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 4a0c375e48e..b83cf1e4d55 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1974,13 +1974,6 @@ uint64_t smb_vfs_call_get_alloc_size(struct vfs_handle_struct *handle, return handle->fns->get_alloc_size_fn(handle, fsp, sbuf); } -int smb_vfs_call_unlink(struct vfs_handle_struct *handle, - const struct smb_filename *smb_fname) -{ - VFS_FIND(unlink); - return handle->fns->unlink_fn(handle, smb_fname); -} - int smb_vfs_call_unlinkat(struct vfs_handle_struct *handle, struct files_struct *dirfsp, const struct smb_filename *smb_fname, -- 2.47.3