return ret; \
} while (0) \
+/*
+ * XXX: Convert osc_canonicalize_path to use talloc instead of malloc.
+ */
#define SHADOW_NEXT_SMB_FNAME(op, args, rtype) do { \
char *smb_base_name_tmp = NULL; \
char *cpath = NULL; \
return ret; \
} while (0) \
-
-/*
- * XXX: Convert osc_canonicalize_path to use talloc instead of malloc.
- */
-#define SHADOW_NEXT_SMB_FNAME_CONST(op, args, rtype) do { \
- struct smb_filename *smb_fname_tmp = NULL; \
- char *cpath = NULL; \
- char *snap_component = NULL; \
- rtype ret; \
- if (shadow_copy_match_name(smb_fname->base_name, \
- &snap_component)) { \
- cpath = osc_canonicalize_path(smb_fname->base_name, \
- snap_component); \
- smb_fname->base_name = cpath; \
- } \
- status = create_synthetic_smb_fname(talloc_tos(), \
- cpath ?: smb_fname->base_name, \
- smb_fname->stream_name, &smb_fname->st, \
- &smb_fname_tmp); \
- if (!NT_STATUS_IS_OK(status)) { \
- errno = map_errno_from_nt_status(status); \
- return ret; \
- } \
- ret = SMB_VFS_NEXT_ ## op args; \
- TALLOC_FREE(smb_fname_tmp) \
- SAFE_FREE(cpath); \
- return ret; \
- } while (0) \
-
-
-
static uint64_t
onefs_shadow_copy_disk_free(vfs_handle_struct *handle, const char *path,
bool small_query, uint64_t *bsize, uint64_t *dfree,
uint32_t file_attributes,
uint32_t oplock_request,
uint64_t allocation_size,
+ uint32_t private_flags,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result,
access_mask, share_access,
create_disposition, create_options,
file_attributes, oplock_request,
- allocation_size, sd, ea_list, result, pinfo),
+ allocation_size, private_flags,
+ sd, ea_list, result, pinfo),
NTSTATUS);
}
static int
onefs_shadow_copy_unlink(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname)
+ const struct smb_filename *smb_fname_in)
{
- SHADOW_NEXT_SMB_FNAME_CONST(UNLINK,
- (handle, smb_fname_tmp),
- int);
+ struct smb_filename *smb_fname = NULL;
+ NTSTATUS status;
+
+ status = copy_smb_filename(talloc_tos(), smb_fname_in, &smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ return -1;
+ }
+
+ SHADOW_NEXT_SMB_FNAME(UNLINK,
+ (handle, smb_fname),
+ int);
}
static int
}
static int
-onefs_shadow_copy_ntimes(vfs_handle_struct *handle, const char *path,
+onefs_shadow_copy_ntimes(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname_in,
struct smb_file_time *ft)
{
- SHADOW_NEXT(NTIMES,
- (handle, cpath ?: path, ft),
- int);
+ struct smb_filename *smb_fname = NULL;
+ NTSTATUS status;
+
+ status = copy_smb_filename(talloc_tos(), smb_fname_in, &smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ return -1;
+ }
+
+ SHADOW_NEXT_SMB_FNAME(NTIMES,
+ (handle, smb_fname, ft),
+ int);
}
/**
* XXX: macro-ize
*/
-static bool
+static int
onefs_shadow_copy_symlink(vfs_handle_struct *handle,
const char *oldpath, const char *newpath)
{
}
static char *
-onefs_shadow_copy_realpath(vfs_handle_struct *handle, const char *path,
- char *resolved_path)
+onefs_shadow_copy_realpath(vfs_handle_struct *handle, const char *path)
{
SHADOW_NEXT(REALPATH,
- (handle, cpath ?: path, resolved_path),
+ (handle, cpath ?: path),
char *);
}
/* VFS operations structure */
-static vfs_op_tuple onefs_shadow_copy_ops[] = {
-
- /* Disk operations */
-
- {SMB_VFS_OP(onefs_shadow_copy_disk_free), SMB_VFS_OP_DISK_FREE,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_get_shadow_copy_data),
- SMB_VFS_OP_GET_SHADOW_COPY_DATA, SMB_VFS_LAYER_OPAQUE},
- {SMB_VFS_OP(onefs_shadow_copy_statvfs), SMB_VFS_OP_STATVFS,
- SMB_VFS_LAYER_TRANSPARENT},
-
- /* Directory operations */
-
- {SMB_VFS_OP(onefs_shadow_copy_opendir), SMB_VFS_OP_OPENDIR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_mkdir), SMB_VFS_OP_MKDIR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_rmdir), SMB_VFS_OP_RMDIR,
- SMB_VFS_LAYER_TRANSPARENT},
-
- /* File operations */
-
- {SMB_VFS_OP(onefs_shadow_copy_open), SMB_VFS_OP_OPEN,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_create_file), SMB_VFS_OP_CREATE_FILE,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_rename), SMB_VFS_OP_RENAME,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_stat), SMB_VFS_OP_STAT,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_stat), SMB_VFS_OP_STAT,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_lstat), SMB_VFS_OP_LSTAT,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_unlink), SMB_VFS_OP_UNLINK,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_chmod), SMB_VFS_OP_CHMOD,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_chown), SMB_VFS_OP_CHOWN,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_lchown), SMB_VFS_OP_LCHOWN,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_chdir), SMB_VFS_OP_CHDIR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_ntimes), SMB_VFS_OP_NTIMES,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_symlink), SMB_VFS_OP_SYMLINK,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_readlink), SMB_VFS_OP_READLINK,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_link), SMB_VFS_OP_LINK,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_mknod), SMB_VFS_OP_MKNOD,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_realpath), SMB_VFS_OP_REALPATH,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_chflags), SMB_VFS_OP_CHFLAGS,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_streaminfo), SMB_VFS_OP_STREAMINFO,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_get_real_filename),
- SMB_VFS_OP_GET_REAL_FILENAME, SMB_VFS_LAYER_TRANSPARENT},
-
- /* NT File ACL operations */
-
- {SMB_VFS_OP(onefs_shadow_copy_get_nt_acl), SMB_VFS_OP_GET_NT_ACL,
- SMB_VFS_LAYER_TRANSPARENT},
-
- /* POSIX ACL operations */
-
- {SMB_VFS_OP(onefs_shadow_copy_chmod_acl), SMB_VFS_OP_CHMOD_ACL,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_sys_acl_get_file),
- SMB_VFS_OP_SYS_ACL_GET_FILE, SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_sys_acl_set_file),
- SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_sys_acl_delete_def_file),
- SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, SMB_VFS_LAYER_TRANSPARENT},
-
- /* EA operations. */
-
- {SMB_VFS_OP(onefs_shadow_copy_getxattr), SMB_VFS_OP_GETXATTR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_lgetxattr), SMB_VFS_OP_LGETXATTR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_listxattr), SMB_VFS_OP_LISTXATTR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_llistxattr), SMB_VFS_OP_LLISTXATTR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_removexattr), SMB_VFS_OP_REMOVEXATTR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_lremovexattr), SMB_VFS_OP_LREMOVEXATTR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_setxattr), SMB_VFS_OP_SETXATTR,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_lsetxattr), SMB_VFS_OP_LSETXATTR,
- SMB_VFS_LAYER_TRANSPARENT},
-
- /* offline operations */
- {SMB_VFS_OP(onefs_shadow_copy_is_offline), SMB_VFS_OP_IS_OFFLINE,
- SMB_VFS_LAYER_TRANSPARENT},
- {SMB_VFS_OP(onefs_shadow_copy_set_offline), SMB_VFS_OP_SET_OFFLINE,
- SMB_VFS_LAYER_TRANSPARENT},
-
- {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
+static struct vfs_fn_pointers onefs_shadow_copy_fns = {
+ .disk_free = onefs_shadow_copy_disk_free,
+ .get_shadow_copy_data = onefs_shadow_copy_get_shadow_copy_data,
+ .statvfs = onefs_shadow_copy_statvfs,
+ .opendir = onefs_shadow_copy_opendir,
+ .mkdir = onefs_shadow_copy_mkdir,
+ .rmdir = onefs_shadow_copy_rmdir,
+ .open = onefs_shadow_copy_open,
+ .create_file = onefs_shadow_copy_create_file,
+ .rename = onefs_shadow_copy_rename,
+ .stat = onefs_shadow_copy_stat,
+ .stat = onefs_shadow_copy_stat,
+ .lstat = onefs_shadow_copy_lstat,
+ .unlink = onefs_shadow_copy_unlink,
+ .chmod = onefs_shadow_copy_chmod,
+ .chown = onefs_shadow_copy_chown,
+ .lchown = onefs_shadow_copy_lchown,
+ .chdir = onefs_shadow_copy_chdir,
+ .ntimes = onefs_shadow_copy_ntimes,
+ .symlink = onefs_shadow_copy_symlink,
+ .vfs_readlink = onefs_shadow_copy_readlink,
+ .link = onefs_shadow_copy_link,
+ .mknod = onefs_shadow_copy_mknod,
+ .realpath = onefs_shadow_copy_realpath,
+ .chflags = onefs_shadow_copy_chflags,
+ .streaminfo = onefs_shadow_copy_streaminfo,
+ .get_real_filename = onefs_shadow_copy_get_real_filename,
+ .get_nt_acl = onefs_shadow_copy_get_nt_acl,
+ .chmod_acl = onefs_shadow_copy_chmod_acl,
+ .sys_acl_get_file = onefs_shadow_copy_sys_acl_get_file,
+ .sys_acl_set_file = onefs_shadow_copy_sys_acl_set_file,
+ .sys_acl_delete_def_file = onefs_shadow_copy_sys_acl_delete_def_file,
+ .getxattr = onefs_shadow_copy_getxattr,
+ .lgetxattr = onefs_shadow_copy_lgetxattr,
+ .listxattr = onefs_shadow_copy_listxattr,
+ .llistxattr = onefs_shadow_copy_llistxattr,
+ .removexattr = onefs_shadow_copy_removexattr,
+ .lremovexattr = onefs_shadow_copy_lremovexattr,
+ .setxattr = onefs_shadow_copy_setxattr,
+ .lsetxattr = onefs_shadow_copy_lsetxattr,
+ .is_offline = onefs_shadow_copy_is_offline,
+ .set_offline = onefs_shadow_copy_set_offline,
};
NTSTATUS vfs_shadow_copy_init(void)
ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
"onefs_shadow_copy",
- onefs_shadow_copy_ops);
+ &onefs_shadow_copy_fns);
if (!NT_STATUS_IS_OK(ret))
return ret;