From d8d5d4c7428683da04fa4c8b344504e7044f9b1c Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Mon, 18 Nov 2013 14:54:30 +0100 Subject: vfs: add [GET/SET]_COMPRESSION hooks The VFS interfaces are sychronous, as the operations only modify meta-data. These hooks are dependent on support for transparent compression by the underlying filesystem - vfs_default returns INVALID_DEVICE_REQUEST. Support for other filesystems providing transparent comression, such as Btrfs and ZFS, can be added in future. The get_compression function takes fsp and smb_fname arguments. The smb_fname argument is needed due to the current dosmode() code-path. Signed-off-by: David Disseldorp Reviewed-by: Jeremy Allison --- examples/VFS/skel_opaque.c | 19 +++++++++++++++++++ examples/VFS/skel_transparent.c | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'examples/VFS') diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 53c64cafb8..5abea20dd0 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -528,6 +528,23 @@ static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle, return NT_STATUS_OK; } +static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle, + TALLOC_CTX *mem_ctx, + struct files_struct *fsp, + struct smb_filename *smb_fname, + uint16_t *_compression_fmt) +{ + return NT_STATUS_INVALID_DEVICE_REQUEST; +} + +static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle, + TALLOC_CTX *mem_ctx, + struct files_struct *fsp, + uint16_t compression_fmt) +{ + return NT_STATUS_INVALID_DEVICE_REQUEST; +} + static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *fname, @@ -867,6 +884,8 @@ struct vfs_fn_pointers skel_opaque_fns = { .file_id_create_fn = skel_file_id_create, .copy_chunk_send_fn = skel_copy_chunk_send, .copy_chunk_recv_fn = skel_copy_chunk_recv, + .get_compression_fn = skel_get_compression, + .set_compression_fn = skel_set_compression, .streaminfo_fn = skel_streaminfo, .get_real_filename_fn = skel_get_real_filename, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 99feadec60..f042b2aead 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -645,6 +645,25 @@ static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle, return NT_STATUS_OK; } +static NTSTATUS skel_get_compression(struct vfs_handle_struct *handle, + TALLOC_CTX *mem_ctx, + struct files_struct *fsp, + struct smb_filename *smb_fname, + uint16_t *_compression_fmt) +{ + return SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname, + _compression_fmt); +} + +static NTSTATUS skel_set_compression(struct vfs_handle_struct *handle, + TALLOC_CTX *mem_ctx, + struct files_struct *fsp, + uint16_t compression_fmt) +{ + return SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp, + compression_fmt); +} + static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *fname, @@ -973,6 +992,8 @@ struct vfs_fn_pointers skel_transparent_fns = { .file_id_create_fn = skel_file_id_create, .copy_chunk_send_fn = skel_copy_chunk_send, .copy_chunk_recv_fn = skel_copy_chunk_recv, + .get_compression_fn = skel_get_compression, + .set_compression_fn = skel_set_compression, .streaminfo_fn = skel_streaminfo, .get_real_filename_fn = skel_get_real_filename, -- cgit