From: Jeremy Allison Date: Thu, 12 Sep 2019 18:04:18 +0000 (-0700) Subject: s3: VFS: vfs_glusterfs. Implement unlinkat(). X-Git-Tag: talloc-2.3.1~640 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ee6c9d8a42c9702914acf4d6f10342951cce7d5;p=thirdparty%2Fsamba.git s3: VFS: vfs_glusterfs. Implement unlinkat(). Note this isn't identical to unlink() as this must cope with (flags & AT_REMOVEDIR), which is identical to rmdir(). It calls either unlink or rmdir depending on the flags parameter. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index bfb97368f82..daa7c030efd 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -1294,6 +1294,25 @@ static int vfs_gluster_unlink(struct vfs_handle_struct *handle, return ret; } +static int vfs_gluster_unlinkat(struct vfs_handle_struct *handle, + struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + int flags) +{ + int ret; + + START_PROFILE(syscall_unlinkat); + SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp); + if (flags & AT_REMOVEDIR) { + ret = glfs_rmdir(handle->data, smb_fname->base_name); + } else { + ret = glfs_unlink(handle->data, smb_fname->base_name); + } + END_PROFILE(syscall_unlinkat); + + return ret; +} + static int vfs_gluster_chmod(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname, mode_t mode) @@ -1922,6 +1941,7 @@ static struct vfs_fn_pointers glusterfs_fns = { .lstat_fn = vfs_gluster_lstat, .get_alloc_size_fn = vfs_gluster_get_alloc_size, .unlink_fn = vfs_gluster_unlink, + .unlinkat_fn = vfs_gluster_unlinkat, .chmod_fn = vfs_gluster_chmod, .fchmod_fn = vfs_gluster_fchmod,