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 93d9ce68755d770f4c4554881ee8c50d8f452c75..aa06ea361fac4b0018cbefcd047cb333d83215ce 100644 (file)
@@ -1412,28 +1412,28 @@ err:
 }
 
 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;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
 
        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;
        }
 
-       status = SMB_VFS_NEXT_MKNOD(handle, client_path, mode, dev);
+       status = SMB_VFS_NEXT_MKNOD(handle, client_fname, mode, dev);
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }
 
@@ -1464,27 +1464,27 @@ err:
 }
 
 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;
-       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;
        }
 
-       status = SMB_VFS_NEXT_CHFLAGS(handle, client_path, flags);
+       status = SMB_VFS_NEXT_CHFLAGS(handle, client_fname, flags);
+
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }
 
@@ -1649,31 +1649,40 @@ err:
 }
 
 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;
-       char *client_path = NULL;
+       int saved_errno = 0;
+       struct smb_filename *client_fname = NULL;
 
        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);
        }
 
-       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;
        }
 
-       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:
-       TALLOC_FREE(client_path);
+       if (status == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(client_fname);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return status;
 }
 
@@ -1713,116 +1722,125 @@ err:
 }
 
 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;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
        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;
        }
 
-       ret = SMB_VFS_NEXT_GETXATTR(handle, client_path, name, value, size);
+       ret = SMB_VFS_NEXT_GETXATTR(handle, client_fname, name, value, size);
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        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 *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
        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;
        }
 
-       ret = SMB_VFS_NEXT_LISTXATTR(handle, client_path, list, size);
+       ret = SMB_VFS_NEXT_LISTXATTR(handle, client_fname, list, size);
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        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;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
 
        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;
        }
 
-       status = SMB_VFS_NEXT_REMOVEXATTR(handle, client_path, name);
+       status = SMB_VFS_NEXT_REMOVEXATTR(handle, client_fname, name);
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        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;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
 
        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);
        }
 
-       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;
        }
 
-       status = SMB_VFS_NEXT_SETXATTR(handle, client_path, name, value,
+       status = SMB_VFS_NEXT_SETXATTR(handle, client_fname, name, value,
                                       size, flags);
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return status;
 }