]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_glusterfs. Implement unlinkat().
authorJeremy Allison <jra@samba.org>
Thu, 12 Sep 2019 18:04:18 +0000 (11:04 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 26 Sep 2019 17:20:45 +0000 (17:20 +0000)
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>
source3/modules/vfs_glusterfs.c

index bfb97368f827f982da6b060cf29c44c0fef766c9..daa7c030efd77a6f4aa5d30f9280fb2868a18bab 100644 (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,