]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_media_harmony. Implement linkat().
authorJeremy Allison <jra@samba.org>
Fri, 16 Aug 2019 22:57:15 +0000 (15:57 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 20 Aug 2019 21:09:28 +0000 (21:09 +0000)
Currently identical to link().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
source3/modules/vfs_media_harmony.c

index 7333236497dfcb868e6c922dd659ccc606d07026..10f5f6ca9070d650b75aa0c25b2a5dd379397fce 100644 (file)
@@ -1821,6 +1821,58 @@ out:
        return status;
 }
 
+/*
+ * Success: return 0
+ * Failure: set errno, return -1
+ */
+static int mh_linkat(vfs_handle_struct *handle,
+               files_struct *srcfsp,
+               const struct smb_filename *old_smb_fname,
+               files_struct *dstfsp,
+               const struct smb_filename *new_smb_fname,
+               int flags)
+{
+       int status;
+       struct smb_filename *oldclientFname = NULL;
+       struct smb_filename *newclientFname = NULL;
+
+       DEBUG(MH_INFO_DEBUG, ("Entering mh_linkat\n"));
+       if (!is_in_media_files(old_smb_fname->base_name) &&
+                       !is_in_media_files(new_smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_LINKAT(handle,
+                               srcfsp,
+                               old_smb_fname,
+                               dstfsp,
+                               new_smb_fname,
+                               flags);
+               goto out;
+       }
+
+       if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+                               old_smb_fname,
+                               &oldclientFname))) {
+               goto err;
+       }
+       if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+                               new_smb_fname,
+                               &newclientFname))) {
+               goto err;
+       }
+
+       status = SMB_VFS_NEXT_LINKAT(handle,
+                               srcfsp,
+                               oldclientFname,
+                               dstfsp,
+                               newclientFname,
+                               flags);
+
+err:
+       TALLOC_FREE(newclientFname);
+       TALLOC_FREE(oldclientFname);
+out:
+       return status;
+}
+
 /*
  * Success: return 0
  * Failure: set errno, return -1
@@ -2302,6 +2354,7 @@ static struct vfs_fn_pointers vfs_mh_fns = {
        .symlink_fn = mh_symlink,
        .readlink_fn = mh_readlink,
        .link_fn = mh_link,
+       .linkat_fn = mh_linkat,
        .mknod_fn = mh_mknod,
        .realpath_fn = mh_realpath,
        .chflags_fn = mh_chflags,