s3: VFS: Change SMB_VFS_SYMLINK to use const struct smb_filename * instead of const...
[kai/samba-autobuild/.git] / source3 / modules / vfs_media_harmony.c
index 99a5e9b6979bb74f3bf48ba56f48dece856678e0..ca8d6ce1a6dbb1998344a2c835b9b90378db47af 100644 (file)
@@ -632,36 +632,35 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_statvfs(struct vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                struct vfs_statvfs_struct *statbuf)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
-       DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path));
+       DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n",
+                       smb_fname->base_name));
 
-       if (!is_in_media_files(path))
+       if (!is_in_media_files(smb_fname->base_name))
        {
-               status = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
+               status = SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf);
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if ((status = alloc_get_client_path(handle, ctx,
-                               path,
-                               &clientPath)))
-       {
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_STATVFS(handle, clientPath, statbuf);
+       status = SMB_VFS_NEXT_STATVFS(handle, clientFname, statbuf);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
-       DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path));
+       DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n",
+                       smb_fname->base_name));
        return status;
 }
 
@@ -1720,47 +1719,41 @@ out:
  * Success: return 0
  * Failure: set errno, return -1
  */
+
 static int mh_symlink(vfs_handle_struct *handle,
-               const char *oldpath,
-               const char *newpath)
+               const char *link_contents,
+               const struct smb_filename *new_smb_fname)
 {
-       int status;
-       char *oldClientPath;
-       char *newClientPath;
-       TALLOC_CTX *ctx;
+       int status = -1;
+       char *client_link_contents = NULL;
+       struct smb_filename *newclientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_symlink\n"));
-       if (!is_in_media_files(oldpath) && !is_in_media_files(newpath))
-       {
-               status = SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
+       if (!is_in_media_files(link_contents) &&
+                       !is_in_media_files(new_smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_SYMLINK(handle,
+                               link_contents,
+                               new_smb_fname);
                goto out;
        }
 
-       oldClientPath = NULL;
-       newClientPath = NULL;
-       ctx = talloc_tos();
-
-       if ((status = alloc_get_client_path(handle, ctx,
-                               oldpath,
-                               &oldClientPath)))
-       {
+       if ((status = alloc_get_client_path(handle, talloc_tos(),
+                               link_contents,
+                               &client_link_contents))) {
                goto err;
        }
-
-       if ((status = alloc_get_client_path(handle, ctx,
-                               newpath,
-                               &newClientPath)))
-       {
+       if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+                               new_smb_fname,
+                               &newclientFname))) {
                goto err;
        }
 
        status = SMB_VFS_NEXT_SYMLINK(handle,
-                       oldClientPath,
-                       newClientPath);
-
+                               client_link_contents,
+                               newclientFname);
 err:
-       TALLOC_FREE(newClientPath);
-       TALLOC_FREE(oldClientPath);
+       TALLOC_FREE(client_link_contents);
+       TALLOC_FREE(newclientFname);
 out:
        return status;
 }
@@ -1770,34 +1763,28 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_readlink(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                char *buf,
                size_t bufsiz)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_readlink\n"));
-       if (!is_in_media_files(path))
-       {
-               status = SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz);
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if ((status = alloc_get_client_path(handle, ctx,
-                               path,
-                               &clientPath)))
-       {
+       if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+                               smb_fname,
+                               &clientFname))) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_READLINK(handle, clientPath, buf, bufsiz);
+       status = SMB_VFS_NEXT_READLINK(handle, clientFname, buf, bufsiz);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -1807,43 +1794,37 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_link(vfs_handle_struct *handle,
-               const char *oldpath,
-               const char *newpath)
+               const struct smb_filename *old_smb_fname,
+               const struct smb_filename *new_smb_fname)
 {
        int status;
-       char *oldClientPath;
-       char *newClientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *oldclientFname = NULL;
+       struct smb_filename *newclientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_link\n"));
-       if (!is_in_media_files(oldpath) && !is_in_media_files(newpath))
-       {
-               status = SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
+       if (!is_in_media_files(old_smb_fname->base_name) &&
+                       !is_in_media_files(new_smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_LINK(handle,
+                               old_smb_fname,
+                               new_smb_fname);
                goto out;
        }
 
-       oldClientPath = NULL;
-       newClientPath = NULL;
-       ctx = talloc_tos();
-
-       if ((status = alloc_get_client_path(handle, ctx,
-                               oldpath,
-                               &oldClientPath)))
-       {
+       if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+                               old_smb_fname,
+                               &oldclientFname))) {
                goto err;
        }
-
-       if ((status = alloc_get_client_path(handle, ctx,
-                               newpath,
-                               &newClientPath)))
-       {
+       if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
+                               new_smb_fname,
+                               &newclientFname))) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_LINK(handle, oldClientPath, newClientPath);
+       status = SMB_VFS_NEXT_LINK(handle, oldclientFname, newclientFname);
 err:
-       TALLOC_FREE(newClientPath);
-       TALLOC_FREE(oldClientPath);
+       TALLOC_FREE(newclientFname);
+       TALLOC_FREE(oldclientFname);
 out:
        return status;
 }
@@ -1923,33 +1904,30 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_chflags(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                unsigned int flags)
 {
        int status;
-       char *clientPath;
+       struct smb_filename *clientFname = NULL;
        TALLOC_CTX *ctx;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_chflags\n"));
-       if (!is_in_media_files(path))
-       {
-               status = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
                goto out;
        }
 
-       clientPath = NULL;
        ctx = talloc_tos();
 
-       if ((status = alloc_get_client_path(handle, ctx,
-                               path,
-                               &clientPath)))
-       {
+       if ((status = alloc_get_client_smb_fname(handle, ctx,
+                               smb_fname,
+                               &clientFname))) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_CHFLAGS(handle, clientPath, flags);
+       status = SMB_VFS_NEXT_CHFLAGS(handle, clientFname, flags);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }