s3: VFS: Change SMB_VFS_CHFLAGS to use const struct smb_filename * instead of const...
[kamenim/samba-autobuild/.git] / source3 / modules / vfs_media_harmony.c
index 360fca692976aaa4e8fc77a6fc7409d55e130f3b..37b396a5bea8a8713c57e91f6bb2cbdedda1c2d4 100644 (file)
@@ -93,7 +93,6 @@
 #define MH_INFO_DEBUG 10
 #define MH_ERR_DEBUG 0
 
-static const char* MH_MODULE_NAME = "media_harmony";
 static const char* MDB_FILENAME = "msmMMOB.mdb";
 static const size_t MDB_FILENAME_LEN = 11;
 static const char* PMR_FILENAME = "msmFMID.pmr";
@@ -190,7 +189,7 @@ static bool starts_with_media_dir(const char* media_dirname,
                size_t media_dirname_len, const char* path)
 {
        bool ret = False;
-       char* path_start;
+       const char *path_start;
 
        DEBUG(MH_INFO_DEBUG, ("Entering with media_dirname '%s' "
                              "path '%s'\n", media_dirname, path));
@@ -265,8 +264,8 @@ static int depth_from_media_dir(const char* media_dirname,
                size_t media_dirname_len, const char* path)
 {
        int transition_count = 0;
-       char* path_start;
-       char* pathPtr;
+       const char *path_start;
+       const char *pathPtr;
 
        DEBUG(MH_INFO_DEBUG, ("Entering with media_dirname '%s' "
                              "path '%s'\n", media_dirname, path));
@@ -355,7 +354,7 @@ static bool is_avid_database(
                (
                        path[path_len - avid_db_filename_len - 1] == '/'
                        ||
-                       path_len > avid_db_filename_len
+                       (path_len > avid_db_filename_len
                                + APPLE_DOUBLE_PREFIX_LEN
                                &&
                        path[path_len - avid_db_filename_len
@@ -363,7 +362,7 @@ static bool is_avid_database(
                                &&
                        is_apple_double(&path[path_len
                                - avid_db_filename_len
-                               - APPLE_DOUBLE_PREFIX_LEN])
+                               - APPLE_DOUBLE_PREFIX_LEN]))
                )
        )
        {
@@ -417,15 +416,15 @@ static int alloc_get_client_path(vfs_handle_struct *handle,
                )
                        &&
                (
-                       pathPtr - path > 0
+                       (pathPtr - path > 0
                                &&
-                       *(pathPtr - 1) == '/'
+                        *(pathPtr - 1) == '/')
                        ||
-                       pathPtr - path > APPLE_DOUBLE_PREFIX_LEN
+                       (pathPtr - path > APPLE_DOUBLE_PREFIX_LEN
                                &&
                        *(pathPtr - APPLE_DOUBLE_PREFIX_LEN - 1) == '/'
                                &&
-                       is_apple_double(pathPtr - APPLE_DOUBLE_PREFIX_LEN)
+                        is_apple_double(pathPtr - APPLE_DOUBLE_PREFIX_LEN))
                )
        )
        {
@@ -487,17 +486,15 @@ static int alloc_get_client_smb_fname(struct vfs_handle_struct *handle,
                struct smb_filename **clientFname)
 {
        int status = 0;
-       NTSTATUS copystatus;
 
        DEBUG(MH_INFO_DEBUG, ("Entering with smb_fname->base_name '%s'\n",
                              smb_fname->base_name));
 
-       copystatus = copy_smb_filename(ctx, smb_fname, clientFname);
-       if (!NT_STATUS_IS_OK(copystatus))
-       {
+       *clientFname = cp_smb_filename(ctx, smb_fname);
+       if ((*clientFname) == NULL) {
                DEBUG(MH_ERR_DEBUG, ("alloc_get_client_smb_fname "
                                        "NTERR\n"));
-               errno = map_errno_from_nt_status(copystatus);
+               errno = ENOMEM;
                status = -1;
                goto err;
        }
@@ -608,7 +605,7 @@ static int set_fake_mtime(vfs_handle_struct *handle,
 
        DEBUG(MH_INFO_DEBUG, ("Fake stat'ing '%s'\n", statPath));
        if (statFn(statPath, &fakeStat,
-                       lp_fake_dir_create_times(SNUM(handle->conn))))
+                       lp_fake_directory_create_times(SNUM(handle->conn))))
        {
                /* This can fail for legitimate reasons - i.e. the
                 * fakeStat directory doesn't exist, which is okay
@@ -763,15 +760,16 @@ err:
  * Failure: set errno, return NULL
  */
 static DIR *mh_opendir(vfs_handle_struct *handle,
-               const char *fname,
+               const struct smb_filename *smb_fname,
                const char *mask,
-               uint32 attr)
+               uint32_t attr)
 {
        struct mh_dirinfo_struct *dirInfo;
 
-       DEBUG(MH_INFO_DEBUG, ("Entering with fname '%s'\n", fname));
+       DEBUG(MH_INFO_DEBUG, ("Entering with fname '%s'\n",
+               smb_fname->base_name));
 
-       if (alloc_set_client_dirinfo(handle, fname, &dirInfo))
+       if (alloc_set_client_dirinfo(handle, smb_fname->base_name, &dirInfo))
        {
                goto err;
        }
@@ -779,17 +777,27 @@ static DIR *mh_opendir(vfs_handle_struct *handle,
        if (!dirInfo->isInMediaFiles)
        {
                dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(handle,
-                       fname, mask, attr);
+                       smb_fname, mask, attr);
        } else {
+               struct smb_filename *smb_fname_clientpath =
+                               synthetic_smb_fname(talloc_tos(),
+                                       dirInfo->clientPath,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+               if (smb_fname_clientpath == NULL) {
+                       goto err;
+               }
+
                dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(handle,
-                       dirInfo->clientPath, mask, attr);
+                       smb_fname_clientpath, mask, attr);
+               TALLOC_FREE(smb_fname_clientpath);
        }
 
        if (dirInfo->dirstream == NULL) {
                goto err;
        }
 
-out:
        /* Success is freed in closedir. */
        DEBUG(MH_INFO_DEBUG, ("Leaving with dirInfo->dirpath '%s', "
                                "dirInfo->clientPath '%s'\n",
@@ -798,7 +806,8 @@ out:
        return (DIR*)dirInfo;
 err:
        /* Failure is freed here. */
-       DEBUG(MH_ERR_DEBUG, ("Failing with fname '%s'\n", fname));
+       DEBUG(MH_ERR_DEBUG, ("Failing with fname '%s'\n",
+               smb_fname->base_name));
        TALLOC_FREE(dirInfo);
        return NULL;
 }
@@ -806,9 +815,9 @@ err:
 static DIR *mh_fdopendir(vfs_handle_struct *handle,
                files_struct *fsp,
                const char *mask,
-               uint32 attr)
+               uint32_t attr)
 {
-       struct mh_dirinfo_struct *dirInfo;
+       struct mh_dirinfo_struct *dirInfo = NULL;
        DIR *dirstream;
 
        DEBUG(MH_INFO_DEBUG, ("Entering with fsp->fsp_name->base_name '%s'\n",
@@ -1037,35 +1046,32 @@ static void mh_rewinddir(vfs_handle_struct *handle,
  * Failure: set errno, return -1
  */
 static int mh_mkdir(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                mode_t mode)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
-
+       struct smb_filename *clientFname = NULL;
+       const char *path = smb_fname->base_name;
 
        DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path));
 
        if (!is_in_media_files(path))
        {
-               status = SMB_VFS_NEXT_MKDIR(handle, path, mode);
+               status = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
                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_MKDIR(handle, clientPath, mode);
+       status = SMB_VFS_NEXT_MKDIR(handle, clientFname, mode);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path));
        return status;
@@ -1076,34 +1082,31 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_rmdir(vfs_handle_struct *handle,
-               const char *path)
+               const struct smb_filename *smb_fname)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
-
+       struct smb_filename *clientFname = NULL;
+       const char *path = smb_fname->base_name;
 
        DEBUG(MH_INFO_DEBUG, ("Entering with path '%s'\n", path));
 
        if (!is_in_media_files(path))
        {
-               status = SMB_VFS_NEXT_RMDIR(handle, path);
+               status = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
                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_RMDIR(handle, clientPath);
+       status = SMB_VFS_NEXT_RMDIR(handle, clientFname);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        DEBUG(MH_INFO_DEBUG, ("Leaving with path '%s'\n", path));
        return status;
@@ -1208,12 +1211,15 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
                uint32_t create_options,
                uint32_t file_attributes,
                uint32_t oplock_request,
+               struct smb2_lease *lease,
                uint64_t allocation_size,
                uint32_t private_flags,
                struct security_descriptor *sd,
                struct ea_list *ea_list,
                files_struct **result_fsp,
-               int *pinfo)
+               int *pinfo,
+               const struct smb2_create_blobs *in_context_blobs,
+               struct smb2_create_blobs *out_context_blobs)
 {
        NTSTATUS status;
        struct smb_filename *clientFname;
@@ -1235,12 +1241,15 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
                        create_options,
                        file_attributes,
                        oplock_request,
+                       lease,
                        allocation_size,
                        private_flags,
                        sd,
                        ea_list,
                        result_fsp,
-                       pinfo);
+                       pinfo,
+                       in_context_blobs,
+                       out_context_blobs);
                goto out;
        }
 
@@ -1271,12 +1280,15 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
                create_options,
                file_attributes,
                oplock_request,
+               lease,
                allocation_size,
                private_flags,
                sd,
                ea_list,
                result_fsp,
-               pinfo);
+               pinfo,
+               in_context_blobs,
+               out_context_blobs);
 err:
        TALLOC_FREE(clientFname);
 out:
@@ -1490,7 +1502,9 @@ static int mh_fstat(vfs_handle_struct *handle,
 out:
        DEBUG(MH_INFO_DEBUG, ("Leaving with fsp->fsp_name->st.st_ex_mtime "
                        "%s",
-                       ctime(&(fsp->fsp_name->st.st_ex_mtime.tv_sec))));
+                       fsp->fsp_name != NULL ?
+                               ctime(&(fsp->fsp_name->st.st_ex_mtime.tv_sec)) :
+                               "0"));
        return status;
 }
 
@@ -1534,33 +1548,30 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_chmod(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                mode_t mode)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_chmod\n"));
-       if (!is_in_media_files(path))
+       if (!is_in_media_files(smb_fname->base_name))
        {
-               status = SMB_VFS_NEXT_CHMOD(handle, path, mode);
+               status = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
                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_CHMOD(handle, clientPath, mode);
+       status = SMB_VFS_NEXT_CHMOD(handle, clientFname, mode);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -1570,34 +1581,31 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_chown(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                uid_t uid,
                gid_t gid)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_chown\n"));
-       if (!is_in_media_files(path))
+       if (!is_in_media_files(smb_fname->base_name))
        {
-               status = SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
+               status = SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
                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_CHOWN(handle, clientPath, uid, gid);
+       status = SMB_VFS_NEXT_CHOWN(handle, clientFname, uid, gid);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -1607,34 +1615,31 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_lchown(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                uid_t uid,
                gid_t gid)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_lchown\n"));
-       if (!is_in_media_files(path))
+       if (!is_in_media_files(smb_fname->base_name))
        {
-               status = SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
+               status = SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
                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_LCHOWN(handle, clientPath, uid, gid);
+       status = SMB_VFS_NEXT_LCHOWN(handle, clientFname, uid, gid);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -1848,34 +1853,31 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_mknod(vfs_handle_struct *handle,
-               const char *pathname,
+               const struct smb_filename *smb_fname,
                mode_t mode,
                SMB_DEV_T dev)
 {
        int status;
-       char *clientPath;
+       struct smb_filename *clientFname = NULL;
        TALLOC_CTX *ctx;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_mknod\n"));
-       if (!is_in_media_files(pathname))
-       {
-               status = SMB_VFS_NEXT_MKNOD(handle, pathname, mode, dev);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
                goto out;
        }
 
-       clientPath = NULL;
        ctx = talloc_tos();
 
-       if ((status = alloc_get_client_path(handle, ctx,
-                               pathname,
-                               &clientPath)))
-       {
+       if ((status = alloc_get_client_smb_fname(handle, ctx,
+                               smb_fname,
+                               &clientFname))) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_MKNOD(handle, clientPath, mode, dev);
+       status = SMB_VFS_NEXT_MKNOD(handle, clientFname, mode, dev);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -1921,33 +1923,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;
 }
@@ -1958,43 +1957,42 @@ out:
  */
 static NTSTATUS mh_streaminfo(struct vfs_handle_struct *handle,
                struct files_struct *fsp,
-               const char *fname,
+               const struct smb_filename *smb_fname,
                TALLOC_CTX *ctx,
                unsigned int *num_streams,
                struct stream_struct **streams)
 {
        NTSTATUS status;
-       char *clientPath;
-       TALLOC_CTX *mem_ctx;
+       int ret;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_streaminfo\n"));
-       if (!is_in_media_files(fname))
-       {
-               status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname,
-                               ctx, num_streams, streams);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_STREAMINFO(handle,
+                               fsp,
+                               smb_fname,
+                               ctx,
+                               num_streams,
+                               streams);
                goto out;
        }
 
-       clientPath = NULL;
-       mem_ctx = talloc_tos();
-
-       if (alloc_get_client_path(handle, mem_ctx,
-                               fname,
-                               &clientPath))
-       {
-               status = map_nt_error_from_unix(errno);
+       ret = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (ret != 0) {
+               status = NT_STATUS_NO_MEMORY;
                goto err;
        }
 
        /* This only works on files, so we don't have to worry about
         * our fake directory stat'ing here.
         */
-       // But what does this function do, exactly?  Does it need
-       // extra modifications for the Avid stuff?
-       status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, clientPath,
+       status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, clientFname,
                                ctx, num_streams, streams);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -2009,19 +2007,20 @@ out:
  * In this case, "name" is a path.
  */
 static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle,
-                             const char *name,
-                             uint32 security_info,
+                             const struct smb_filename *smb_fname,
+                             uint32_t security_info,
                              TALLOC_CTX *mem_ctx,
                              struct security_descriptor **ppdesc)
 {
        NTSTATUS status;
        char *clientPath;
+       struct smb_filename *client_smb_fname = NULL;
        TALLOC_CTX *ctx;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_get_nt_acl\n"));
-       if (!is_in_media_files(name))
+       if (!is_in_media_files(smb_fname->base_name))
        {
-               status = SMB_VFS_NEXT_GET_NT_ACL(handle, name,
+               status = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname,
                                                 security_info,
                                                 mem_ctx, ppdesc);
                goto out;
@@ -2031,18 +2030,29 @@ static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle,
        ctx = talloc_tos();
 
        if (alloc_get_client_path(handle, ctx,
-                               name,
+                               smb_fname->base_name,
                                &clientPath))
        {
                status = map_nt_error_from_unix(errno);
                goto err;
        }
 
-       status = SMB_VFS_NEXT_GET_NT_ACL(handle, clientPath,
+       client_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       clientPath,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (client_smb_fname == NULL) {
+               TALLOC_FREE(clientPath);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       status = SMB_VFS_NEXT_GET_NT_ACL(handle, client_smb_fname,
                                         security_info,
                                         mem_ctx, ppdesc);
 err:
        TALLOC_FREE(clientPath);
+       TALLOC_FREE(client_smb_fname);
 out:
        return status;
 }
@@ -2052,33 +2062,30 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_chmod_acl(vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                mode_t mode)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_chmod_acl\n"));
-       if (!is_in_media_files(path))
+       if (!is_in_media_files(smb_fname->base_name))
        {
-               status = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+               status = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
                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_CHMOD_ACL(handle, clientPath, mode);
+       status = SMB_VFS_NEXT_CHMOD_ACL(handle, clientFname, mode);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -2088,35 +2095,33 @@ out:
  * Failure: set errno, return NULL
  */
 static SMB_ACL_T mh_sys_acl_get_file(vfs_handle_struct *handle,
-                                    const char *path_p,
-                                    SMB_ACL_TYPE_T type,
-                                    TALLOC_CTX *mem_ctx)
+                               const struct smb_filename *smb_fname,
+                               SMB_ACL_TYPE_T type,
+                               TALLOC_CTX *mem_ctx)
 {
        SMB_ACL_T ret;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       int status;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_get_file\n"));
-       if (!is_in_media_files(path_p))
-       {
-               ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
+                               type, mem_ctx);
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if (alloc_get_client_path(handle, ctx,
-                               path_p,
-                               &clientPath))
-       {
-               ret = NULL;
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (status != 0) {
+               ret = (SMB_ACL_T)NULL;
                goto err;
        }
 
-       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, clientPath, type, mem_ctx);
+       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, clientFname, type, mem_ctx);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return ret;
 }
@@ -2127,36 +2132,32 @@ out:
  * In this case, "name" is a path.
  */
 static int mh_sys_acl_set_file(vfs_handle_struct *handle,
-               const char *name,
+               const struct smb_filename *smb_fname,
                SMB_ACL_TYPE_T acltype,
                SMB_ACL_T theacl)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_set_file\n"));
-       if (!is_in_media_files(name))
-       {
-               status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name,
+       if (!is_in_media_files(smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
                                acltype, theacl);
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if ((status = alloc_get_client_path(handle, ctx,
-                               name,
-                               &clientPath)))
-       {
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, clientPath,
+       status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, clientFname,
                        acltype, theacl);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -2166,33 +2167,28 @@ out:
  * Failure: set errno, return -1
  */
 static int mh_sys_acl_delete_def_file(vfs_handle_struct *handle,
-               const char *path)
+                       const struct smb_filename *smb_fname)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_delete_def_file\n"));
-       if (!is_in_media_files(path))
-       {
+       if (!is_in_media_files(smb_fname->base_name)) {
                status = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle,
-                               path);
+                               smb_fname);
                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_SYS_ACL_DELETE_DEF_FILE(handle, clientPath);
+       status = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, clientFname);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -2203,37 +2199,33 @@ out:
  * In this case, "name" is an attr name.
  */
 static ssize_t mh_getxattr(struct vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                const char *name,
                void *value,
                size_t size)
 {
+       int status;
+       struct smb_filename *clientFname = NULL;
        ssize_t ret;
-       char *clientPath;
-       TALLOC_CTX *ctx;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_getxattr\n"));
-       if (!is_in_media_files(path))
-       {
-               ret = SMB_VFS_NEXT_GETXATTR(handle, path, name, value,
-                               size);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               ret = SMB_VFS_NEXT_GETXATTR(handle, smb_fname,
+                                       name, value, size);
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if (alloc_get_client_path(handle, ctx,
-                               path,
-                               &clientPath))
-       {
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (status != 0) {
                ret = -1;
                goto err;
        }
-
-       ret = SMB_VFS_NEXT_GETXATTR(handle, clientPath, name, value, size);
+       ret = SMB_VFS_NEXT_GETXATTR(handle, clientFname, name, value, size);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return ret;
 }
@@ -2243,35 +2235,32 @@ out:
  * Failure: set errno, return -1
  */
 static ssize_t mh_listxattr(struct vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                char *list,
                size_t size)
 {
        ssize_t ret;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
+       int status;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_listxattr\n"));
-       if (!is_in_media_files(path))
-       {
-               ret = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               ret = SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if (alloc_get_client_path(handle, ctx,
-                               path,
-                               &clientPath))
-       {
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (status != 0) {
                ret = -1;
                goto err;
        }
 
-       ret = SMB_VFS_NEXT_LISTXATTR(handle, clientPath, list, size);
+       ret = SMB_VFS_NEXT_LISTXATTR(handle, clientFname, list, size);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return ret;
 }
@@ -2282,33 +2271,28 @@ out:
  * In this case, "name" is an attr name.
  */
 static int mh_removexattr(struct vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                const char *name)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_removexattr\n"));
-       if (!is_in_media_files(path))
-       {
-               status = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
                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_REMOVEXATTR(handle, clientPath, name);
+       status = SMB_VFS_NEXT_REMOVEXATTR(handle, clientFname, name);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return status;
 }
@@ -2319,109 +2303,31 @@ out:
  * In this case, "name" is an attr name.
  */
 static int mh_setxattr(struct vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                const char *name,
                const void *value,
                size_t size,
                int flags)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_setxattr\n"));
-       if (!is_in_media_files(path))
-       {
-               status = SMB_VFS_NEXT_SETXATTR(handle, path, name, value,
+       if (!is_in_media_files(smb_fname->base_name)) {
+               status = SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value,
                                size, flags);
                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_SETXATTR(handle, clientPath, name, value,
+       status = SMB_VFS_NEXT_SETXATTR(handle, clientFname, name, value,
                        size, flags);
-err:
-       TALLOC_FREE(clientPath);
-out:
-       return status;
-}
-
-/*
- * Success: return true
- * Failure: set errno, return false
- */
-static bool mh_is_offline(struct vfs_handle_struct *handle,
-               const struct smb_filename *fname,
-               SMB_STRUCT_STAT *sbuf)
-{
-       // check if sbuf is modified further down the chain.
-       bool ret;
-       struct smb_filename *clientFname;
-       TALLOC_CTX *ctx;
-
-       DEBUG(MH_INFO_DEBUG, ("Entering mh_is_offline\n"));
-       if (!is_in_media_files(fname->base_name))
-       {
-               ret = SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
-               goto out;
-       }
-
-       clientFname = NULL;
-       ctx = talloc_tos();
-
-       if(alloc_get_client_smb_fname(handle, ctx,
-                               fname,
-                               &clientFname))
-       {
-               ret = -1;
-               goto err;
-       }
-
-       ret = SMB_VFS_NEXT_IS_OFFLINE(handle, clientFname, sbuf);
-err:
-       TALLOC_FREE(clientFname);
-out:
-       return ret;
-}
-
-/*
- * Success: return 0 (?)
- * Failure: set errno, return -1
- */
-static int mh_set_offline(struct vfs_handle_struct *handle,
-               const struct smb_filename *fname)
-{
-       int status;
-       struct smb_filename *clientFname;
-       TALLOC_CTX *ctx;
-
-       DEBUG(MH_INFO_DEBUG, ("Entering mh_set_offline\n"));
-       if (!is_in_media_files(fname->base_name))
-       {
-               status = SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
-               goto out;
-       }
-
-       clientFname = NULL;
-       ctx = talloc_tos();
-
-       if ((status = alloc_get_client_smb_fname(handle, ctx,
-                               fname,
-                               &clientFname)))
-       {
-               goto err;
-       }
-
-       status = SMB_VFS_NEXT_SET_OFFLINE(handle, clientFname);
 err:
        TALLOC_FREE(clientFname);
 out:
@@ -2489,14 +2395,10 @@ static struct vfs_fn_pointers vfs_mh_fns = {
        .setxattr_fn = mh_setxattr,
 
        /* aio operations */
-
-       /* offline operations */
-       .is_offline_fn = mh_is_offline,
-       .set_offline_fn = mh_set_offline
 };
 
-NTSTATUS vfs_media_harmony_init(void);
-NTSTATUS vfs_media_harmony_init(void)
+NTSTATUS vfs_media_harmony_init(TALLOC_CTX *);
+NTSTATUS vfs_media_harmony_init(TALLOC_CTX *ctx)
 {
        NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
                                "media_harmony", &vfs_mh_fns);