s3: VFS: Change SMB_VFS_CHFLAGS to use const struct smb_filename * instead of const...
[kamenim/samba-autobuild/.git] / source3 / modules / vfs_unityed_media.c
index b4d7dc09b492ec5d753ce8f3ff2ef8199aef7b40..aa06ea361fac4b0018cbefcd047cb333d83215ce 100644 (file)
@@ -551,24 +551,36 @@ err:
  * Failure: set errno, return NULL
  */
 static DIR *um_opendir(vfs_handle_struct *handle,
  * Failure: set errno, return NULL
  */
 static DIR *um_opendir(vfs_handle_struct *handle,
-                      const char *fname,
+                      const struct smb_filename *smb_fname,
                       const char *mask,
                       uint32_t attr)
 {
        struct um_dirinfo_struct *dirInfo;
 
                       const char *mask,
                       uint32_t attr)
 {
        struct um_dirinfo_struct *dirInfo;
 
-       DEBUG(10, ("Entering with fname '%s'\n", fname));
+       DEBUG(10, ("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;
        }
 
        if (!dirInfo->isInMediaFiles) {
                dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(
                goto err;
        }
 
        if (!dirInfo->isInMediaFiles) {
                dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(
-                       handle, fname, mask, attr);
+                       handle, smb_fname, mask, attr);
        } else {
        } else {
+               struct smb_filename *client_smb_fname =
+                       synthetic_smb_fname(talloc_tos(),
+                                       dirInfo->clientPath,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+               if (client_smb_fname == NULL) {
+                       goto err;
+               }
+
                dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(
                dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(
-                       handle, dirInfo->clientPath, mask, attr);
+                       handle, client_smb_fname, mask, attr);
+
+               TALLOC_FREE(client_smb_fname);
        }
 
        if (dirInfo->dirstream == NULL) {
        }
 
        if (dirInfo->dirstream == NULL) {
@@ -582,7 +594,7 @@ static DIR *um_opendir(vfs_handle_struct *handle,
        return (DIR*)dirInfo;
 
 err:
        return (DIR*)dirInfo;
 
 err:
-       DEBUG(1, ("Failing with fname '%s'\n", fname));
+       DEBUG(1, ("Failing with fname '%s'\n", smb_fname->base_name));
        TALLOC_FREE(dirInfo);
        return NULL;
 }
        TALLOC_FREE(dirInfo);
        return NULL;
 }
@@ -766,62 +778,58 @@ static void um_rewinddir(vfs_handle_struct *handle,
 }
 
 static int um_mkdir(vfs_handle_struct *handle,
 }
 
 static int um_mkdir(vfs_handle_struct *handle,
-                   const char *path,
+                   const struct smb_filename *smb_fname,
                    mode_t mode)
 {
        int status;
                    mode_t mode)
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
-
+       const char *path = smb_fname->base_name;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering with path '%s'\n", path));
 
        if (!is_in_media_files(path) || !is_in_media_dir(path)) {
 
        DEBUG(10, ("Entering with path '%s'\n", path));
 
        if (!is_in_media_files(path) || !is_in_media_dir(path)) {
-               return SMB_VFS_NEXT_MKDIR(handle, path, mode);
+               return SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
        }
 
        }
 
-       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,
+                               &client_fname);
+       if (status != 0) {
                goto err;
        }
 
                goto err;
        }
 
-       status = SMB_VFS_NEXT_MKDIR(handle, clientPath, mode);
+       status = SMB_VFS_NEXT_MKDIR(handle, client_fname, mode);
 err:
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(client_fname);
        DEBUG(10, ("Leaving with path '%s'\n", path));
        return status;
 }
 
 static int um_rmdir(vfs_handle_struct *handle,
        DEBUG(10, ("Leaving with path '%s'\n", path));
        return status;
 }
 
 static int um_rmdir(vfs_handle_struct *handle,
-                   const char *path)
+                   const struct smb_filename *smb_fname)
 {
        int status;
 {
        int status;
-       char *clientPath;
-       TALLOC_CTX *ctx;
-
+       const char *path = smb_fname->base_name;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering with path '%s'\n", path));
 
        if (!is_in_media_files(path)) {
 
        DEBUG(10, ("Entering with path '%s'\n", path));
 
        if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_RMDIR(handle, path);
+               return SMB_VFS_NEXT_RMDIR(handle, smb_fname);
        }
 
        }
 
-       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,
+                               &client_fname);
+       if (status != 0) {
                goto err;
        }
 
                goto err;
        }
 
-       status = SMB_VFS_NEXT_RMDIR(handle, clientPath);
+       status = SMB_VFS_NEXT_RMDIR(handle, client_fname);
 err:
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(client_fname);
        DEBUG(10, ("Leaving with path '%s'\n", path));
        return status;
 }
        DEBUG(10, ("Leaving with path '%s'\n", path));
        return status;
 }
@@ -1172,81 +1180,87 @@ err:
 }
 
 static int um_chmod(vfs_handle_struct *handle,
 }
 
 static int um_chmod(vfs_handle_struct *handle,
-                   const char *path,
-                   mode_t mode)
+                       const struct smb_filename *smb_fname,
+                       mode_t mode)
 {
        int status;
 {
        int status;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_chmod\n"));
 
 
        DEBUG(10, ("Entering um_chmod\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_CHMOD(handle, path, mode);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                goto err;
        }
 
        if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_CHMOD(handle, client_path, mode);
+       status = SMB_VFS_NEXT_CHMOD(handle, client_fname, mode);
 
 err:
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }
 
 static int um_chown(vfs_handle_struct *handle,
        return status;
 }
 
 static int um_chown(vfs_handle_struct *handle,
-                   const char *path,
-                   uid_t uid,
-                   gid_t gid)
+                       const struct smb_filename *smb_fname,
+                       uid_t uid,
+                       gid_t gid)
 {
        int status;
 {
        int status;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_chown\n"));
 
 
        DEBUG(10, ("Entering um_chown\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                goto err;
        }
 
        if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_CHOWN(handle, client_path, uid, gid);
+       status = SMB_VFS_NEXT_CHOWN(handle, client_fname, uid, gid);
 
 err:
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }
 
 static int um_lchown(vfs_handle_struct *handle,
        return status;
 }
 
 static int um_lchown(vfs_handle_struct *handle,
-                    const char *path,
-                    uid_t uid,
-                    gid_t gid)
+                       const struct smb_filename *smb_fname,
+                       uid_t uid,
+                       gid_t gid)
 {
        int status;
 {
        int status;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_lchown\n"));
 
        DEBUG(10, ("Entering um_lchown\n"));
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                goto err;
        }
 
        if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_LCHOWN(handle, client_path, uid, gid);
+       status = SMB_VFS_NEXT_LCHOWN(handle, client_fname, uid, gid);
 
 err:
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }
 
        return status;
 }
 
@@ -1398,28 +1412,28 @@ err:
 }
 
 static int um_mknod(vfs_handle_struct *handle,
 }
 
 static int um_mknod(vfs_handle_struct *handle,
-                   const char *pathname,
+                   const struct smb_filename *smb_fname,
                    mode_t mode,
                    SMB_DEV_T dev)
 {
        int status;
                    mode_t mode,
                    SMB_DEV_T dev)
 {
        int status;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_mknod\n"));
 
        DEBUG(10, ("Entering um_mknod\n"));
-       if (!is_in_media_files(pathname)) {
-               return SMB_VFS_NEXT_MKNOD(handle, pathname, mode, dev);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      pathname, &client_path);
+       status = alloc_get_client_smb_fname(handle, talloc_tos(),
+                                           smb_fname, &client_fname);
        if (status != 0) {
                goto err;
        }
 
        if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_MKNOD(handle, client_path, mode, dev);
+       status = SMB_VFS_NEXT_MKNOD(handle, client_fname, mode, dev);
 
 err:
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }
 
        return status;
 }
 
@@ -1450,52 +1464,54 @@ err:
 }
 
 static int um_chflags(vfs_handle_struct *handle,
 }
 
 static int um_chflags(vfs_handle_struct *handle,
-                     const char *path,
-                     unsigned int flags)
+                       const struct smb_filename *smb_fname,
+                       unsigned int flags)
 {
        int status;
 {
        int status;
-       char *client_path = NULL;
-
-       DEBUG(10, ("Entering um_chflags\n"));
+       struct smb_filename *client_fname = NULL;
 
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+       DEBUG(10, ("Entering um_mknod\n"));
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle, talloc_tos(),
+                                           smb_fname, &client_fname);
        if (status != 0) {
                goto err;
        }
 
        if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_CHFLAGS(handle, client_path, flags);
+       status = SMB_VFS_NEXT_CHFLAGS(handle, client_fname, flags);
+
 err:
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }
 
 static NTSTATUS um_streaminfo(struct vfs_handle_struct *handle,
                              struct files_struct *fsp,
        return status;
 }
 
 static NTSTATUS um_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;
                              TALLOC_CTX *ctx,
                              unsigned int *num_streams,
                              struct stream_struct **streams)
 {
        NTSTATUS status;
-       char *client_path = NULL;
        int ret;
        int ret;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_streaminfo\n"));
 
 
        DEBUG(10, ("Entering um_streaminfo\n"));
 
-       if (!is_in_media_files(fname)) {
-               return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname,
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname,
                                               ctx, num_streams, streams);
        }
 
                                               ctx, num_streams, streams);
        }
 
-       ret = alloc_get_client_path(handle, talloc_tos(),
-                                   fname, &client_path);
+       ret = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (ret != 0) {
        if (ret != 0) {
-               status = map_nt_error_from_unix(errno);
+               status = NT_STATUS_NO_MEMORY;
                goto err;
        }
 
                goto err;
        }
 
@@ -1505,10 +1521,10 @@ static NTSTATUS um_streaminfo(struct vfs_handle_struct *handle,
         * function do, exactly?  Does it need extra modifications for
         * the Avid stuff?
         */
         * function do, exactly?  Does it need extra modifications for
         * the Avid stuff?
         */
-       status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, client_path,
+       status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, client_fname,
                                         ctx, num_streams, streams);
 err:
                                         ctx, num_streams, streams);
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }
 
        return status;
 }
 
@@ -1518,310 +1534,311 @@ err:
  */
 
 static NTSTATUS um_get_nt_acl(vfs_handle_struct *handle,
  */
 
 static NTSTATUS um_get_nt_acl(vfs_handle_struct *handle,
-                             const char *name,
+                             const struct smb_filename *smb_fname,
                              uint32_t security_info,
                              TALLOC_CTX *mem_ctx,
                              struct security_descriptor **ppdesc)
 {
        NTSTATUS status;
        char *client_path = NULL;
                              uint32_t security_info,
                              TALLOC_CTX *mem_ctx,
                              struct security_descriptor **ppdesc)
 {
        NTSTATUS status;
        char *client_path = NULL;
+       struct smb_filename *client_smb_fname = NULL;
        int ret;
 
        DEBUG(10, ("Entering um_get_nt_acl\n"));
 
        int ret;
 
        DEBUG(10, ("Entering um_get_nt_acl\n"));
 
-       if (!is_in_media_files(name)) {
-               return SMB_VFS_NEXT_GET_NT_ACL(handle, name,
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname,
                                               security_info,
                                               mem_ctx, ppdesc);
        }
 
        ret = alloc_get_client_path(handle, talloc_tos(),
                                               security_info,
                                               mem_ctx, ppdesc);
        }
 
        ret = alloc_get_client_path(handle, talloc_tos(),
-                                   name, &client_path);
+                                   smb_fname->base_name, &client_path);
        if (ret != 0) {
                status = map_nt_error_from_unix(errno);
                goto err;
        }
 
        if (ret != 0) {
                status = map_nt_error_from_unix(errno);
                goto err;
        }
 
-       status = SMB_VFS_NEXT_GET_NT_ACL(handle, client_path,
+       client_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       client_path,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (client_smb_fname == NULL) {
+               TALLOC_FREE(client_path);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       status = SMB_VFS_NEXT_GET_NT_ACL(handle, client_smb_fname,
                                         security_info,
                                         mem_ctx, ppdesc);
 err:
                                         security_info,
                                         mem_ctx, ppdesc);
 err:
+       TALLOC_FREE(client_smb_fname);
        TALLOC_FREE(client_path);
        return status;
 }
 
 static int um_chmod_acl(vfs_handle_struct *handle,
        TALLOC_FREE(client_path);
        return status;
 }
 
 static int um_chmod_acl(vfs_handle_struct *handle,
-                       const char *path,
+                       const struct smb_filename *smb_fname,
                        mode_t mode)
 {
        int status;
                        mode_t mode)
 {
        int status;
-       char *client_path = NULL;
+       int saved_errno;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_chmod_acl\n"));
 
 
        DEBUG(10, ("Entering um_chmod_acl\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                goto err;
        }
        if (status != 0) {
                goto err;
        }
-
-       status = SMB_VFS_NEXT_CHMOD_ACL(handle, client_path, mode);
+       status = SMB_VFS_NEXT_CHMOD_ACL(handle, client_fname, mode);
 
 err:
 
 err:
-       TALLOC_FREE(client_path);
+       saved_errno = errno;
+       TALLOC_FREE(client_fname);
+       errno = saved_errno;
        return status;
 }
 
 static SMB_ACL_T um_sys_acl_get_file(vfs_handle_struct *handle,
        return status;
 }
 
 static SMB_ACL_T um_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;
 {
        SMB_ACL_T ret;
-       char *client_path = NULL;
+       int saved_errno = 0;
+       struct smb_filename *client_fname = NULL;
        int status;
 
        DEBUG(10, ("Entering um_sys_acl_get_file\n"));
 
        int status;
 
        DEBUG(10, ("Entering um_sys_acl_get_file\n"));
 
-       if (!is_in_media_files(path_p)) {
-               return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p,
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
                                                     type, mem_ctx);
        }
 
                                                     type, mem_ctx);
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path_p, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
        if (status != 0) {
-               ret = NULL;
+               ret = (SMB_ACL_T)NULL;
                goto err;
        }
 
                goto err;
        }
 
-       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, client_path, type, mem_ctx);
+       ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, client_fname,
+                               type, mem_ctx);
 
 err:
 
 err:
-       TALLOC_FREE(client_path);
+       if (ret == (SMB_ACL_T)NULL) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(client_fname);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return ret;
 }
 
 static int um_sys_acl_set_file(vfs_handle_struct *handle,
        return ret;
 }
 
 static int um_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;
                               SMB_ACL_TYPE_T acltype,
                               SMB_ACL_T theacl)
 {
        int status;
-       char *client_path = NULL;
+       int saved_errno = 0;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_sys_acl_set_file\n"));
 
 
        DEBUG(10, ("Entering um_sys_acl_set_file\n"));
 
-       if (!is_in_media_files(name)) {
-               return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name,
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
                                                     acltype, theacl);
        }
 
                                                     acltype, theacl);
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      name, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                goto err;
        }
 
        if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, client_path,
+       status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, client_fname,
                                               acltype, theacl);
 
 err:
                                               acltype, theacl);
 
 err:
-       TALLOC_FREE(client_path);
+       if (status == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(client_fname);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return status;
 }
 
 static int um_sys_acl_delete_def_file(vfs_handle_struct *handle,
        return status;
 }
 
 static int um_sys_acl_delete_def_file(vfs_handle_struct *handle,
-                                     const char *path)
+                               const struct smb_filename *smb_fname)
 {
        int status;
 {
        int status;
-       char *client_path = NULL;
+       int saved_errno = 0;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_sys_acl_delete_def_file\n"));
 
 
        DEBUG(10, ("Entering um_sys_acl_delete_def_file\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle,
+                               smb_fname);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                           path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                goto err;
        }
 
        if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, client_path);
+       status = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, client_fname);
 
 err:
 
 err:
-       TALLOC_FREE(client_path);
+       if (status == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(client_fname);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return status;
 }
 
 static ssize_t um_getxattr(struct vfs_handle_struct *handle,
        return status;
 }
 
 static ssize_t um_getxattr(struct vfs_handle_struct *handle,
-                          const char *path,
+                          const struct smb_filename *smb_fname,
                           const char *name,
                           void *value,
                           size_t size)
 {
        ssize_t ret;
                           const char *name,
                           void *value,
                           size_t size)
 {
        ssize_t ret;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
        int status;
 
        DEBUG(10, ("Entering um_getxattr\n"));
        int status;
 
        DEBUG(10, ("Entering um_getxattr\n"));
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_GETXATTR(handle, smb_fname,
+                               name, value, size);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                ret = -1;
                goto err;
        }
 
        if (status != 0) {
                ret = -1;
                goto err;
        }
 
-       ret = SMB_VFS_NEXT_GETXATTR(handle, client_path, name, value, size);
+       ret = SMB_VFS_NEXT_GETXATTR(handle, client_fname, name, value, size);
 err:
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return ret;
 }
 
 static ssize_t um_listxattr(struct vfs_handle_struct *handle,
        return ret;
 }
 
 static ssize_t um_listxattr(struct vfs_handle_struct *handle,
-                           const char *path,
+                           const struct smb_filename *smb_fname,
                            char *list,
                            size_t size)
 {
        ssize_t ret;
                            char *list,
                            size_t size)
 {
        ssize_t ret;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
        int status;
 
        DEBUG(10, ("Entering um_listxattr\n"));
 
        int status;
 
        DEBUG(10, ("Entering um_listxattr\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                ret = -1;
                goto err;
        }
 
        if (status != 0) {
                ret = -1;
                goto err;
        }
 
-       ret = SMB_VFS_NEXT_LISTXATTR(handle, client_path, list, size);
+       ret = SMB_VFS_NEXT_LISTXATTR(handle, client_fname, list, size);
 
 err:
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return ret;
 }
 
 static int um_removexattr(struct vfs_handle_struct *handle,
        return ret;
 }
 
 static int um_removexattr(struct vfs_handle_struct *handle,
-                         const char *path,
+                         const struct smb_filename *smb_fname,
                          const char *name)
 {
        int status;
                          const char *name)
 {
        int status;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_removexattr\n"));
 
 
        DEBUG(10, ("Entering um_removexattr\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
        }
 
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                goto err;
        }
 
        if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_REMOVEXATTR(handle, client_path, name);
+       status = SMB_VFS_NEXT_REMOVEXATTR(handle, client_fname, name);
 
 err:
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }
 
 static int um_setxattr(struct vfs_handle_struct *handle,
        return status;
 }
 
 static int um_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;
                       const char *name,
                       const void *value,
                       size_t size,
                       int flags)
 {
        int status;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
 
        DEBUG(10, ("Entering um_setxattr\n"));
 
 
        DEBUG(10, ("Entering um_setxattr\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_SETXATTR(handle, path, name, value,
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value,
                                             size, flags);
        }
 
                                             size, flags);
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                goto err;
        }
 
        if (status != 0) {
                goto err;
        }
 
-       status = SMB_VFS_NEXT_SETXATTR(handle, client_path, name, value,
+       status = SMB_VFS_NEXT_SETXATTR(handle, client_fname, name, value,
                                       size, flags);
 
                                       size, flags);
 
-err:
-       TALLOC_FREE(client_path);
-       return status;
-}
-
-static bool um_is_offline(struct vfs_handle_struct *handle,
-                         const struct smb_filename *fname,
-                         SMB_STRUCT_STAT *sbuf)
-{
-       bool ret;
-       struct smb_filename *client_fname = NULL;
-       int status;
-
-       DEBUG(10, ("Entering um_is_offline\n"));
-
-       if (!is_in_media_files(fname->base_name)) {
-               return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
-       }
-
-       status = alloc_get_client_smb_fname(handle, talloc_tos(),
-                                           fname, &client_fname);
-       if (status != 0) {
-               ret = false;
-               goto err;
-       }
-
-       ret = SMB_VFS_NEXT_IS_OFFLINE(handle, client_fname, sbuf);
-
-err:
-       TALLOC_FREE(client_fname);
-       return ret;
-}
-
-static int um_set_offline(struct vfs_handle_struct *handle,
-                         const struct smb_filename *fname)
-{
-       int status;
-       struct smb_filename *client_fname = NULL;
-
-       DEBUG(10, ("Entering um_set_offline\n"));
-
-       if (!is_in_media_files(fname->base_name)) {
-               return SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
-       }
-
-       status = alloc_get_client_smb_fname(handle, talloc_tos(),
-                                           fname, &client_fname);
-       if (status != 0) {
-               goto err;
-       }
-
-       status = SMB_VFS_NEXT_SET_OFFLINE(handle, client_fname);
-
 err:
        TALLOC_FREE(client_fname);
        return status;
 err:
        TALLOC_FREE(client_fname);
        return status;
@@ -1924,16 +1941,10 @@ static struct vfs_fn_pointers vfs_um_fns = {
        .listxattr_fn = um_listxattr,
        .removexattr_fn = um_removexattr,
        .setxattr_fn = um_setxattr,
        .listxattr_fn = um_listxattr,
        .removexattr_fn = um_removexattr,
        .setxattr_fn = um_setxattr,
-
-       /* aio operations */
-
-       /* offline operations */
-       .is_offline_fn = um_is_offline,
-       .set_offline_fn = um_set_offline
 };
 
 };
 
-NTSTATUS vfs_unityed_media_init(void);
-NTSTATUS vfs_unityed_media_init(void)
+NTSTATUS vfs_unityed_media_init(TALLOC_CTX *);
+NTSTATUS vfs_unityed_media_init(TALLOC_CTX *ctx)
 {
        NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
                                        "unityed_media", &vfs_um_fns);
 {
        NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
                                        "unityed_media", &vfs_um_fns);