1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2019-09-12 11:04:18 -07:00 committed by Ralph Boehme
parent 6c28a7749b
commit 1ee6c9d8a4

View File

@ -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,