diff options
author | Ralph Boehme <slow@samba.org> | 2017-06-04 13:50:33 +0200 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2017-07-03 19:59:08 +0200 |
commit | 64bedefa117b4861a752c4e2fc3f5e775eb7f542 (patch) | |
tree | 163d6b87accce620193f4125fb4a886cd426ea47 /source3 | |
parent | 67ed1edba75e967d7d8d4157f918b50d23c47b0b (diff) | |
download | samba-64bedefa117b4861a752c4e2fc3f5e775eb7f542.tar.gz |
s3/vfs: rename SMB_VFS_COPY_CHUNK_SEND/RECV to SMB_VFS_OFFLOAD_WRITE_SEND/RECV
No change in behaviour, just a rename in preperation of more changes to
SMB_VFS_OFFLOAD_WRITE_SEND. It helps keeping the diff of the actual
changes smaller.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/vfs.h | 66 | ||||
-rw-r--r-- | source3/include/vfs_macros.h | 18 | ||||
-rw-r--r-- | source3/modules/vfs_btrfs.c | 28 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 78 | ||||
-rw-r--r-- | source3/modules/vfs_fruit.c | 46 | ||||
-rw-r--r-- | source3/modules/vfs_full_audit.c | 24 | ||||
-rw-r--r-- | source3/modules/vfs_glusterfs.c | 2 | ||||
-rw-r--r-- | source3/modules/vfs_time_audit.c | 45 | ||||
-rw-r--r-- | source3/smbd/smb2_ioctl_filesys.c | 22 | ||||
-rw-r--r-- | source3/smbd/smb2_ioctl_network_fs.c | 6 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 34 |
11 files changed, 188 insertions, 181 deletions
diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 295c005fbd6..c11ce51f670 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -239,6 +239,8 @@ /* Version 37 - Change connectpath from char * to struct smb_filename * */ /* Version 37 - Add SMB_VFS_OFFLOAD_READ_SEND/RECV */ +/* Version 37 - Rename SMB_VFS_COPY_CHUNK_SEND/RECV to + SMB_VFS_OFFLOAD_READ_SEND/RECV */ #define SMB_VFS_INTERFACE_VERSION 37 @@ -592,17 +594,17 @@ enum vfs_fallocate_flags { }; /* - * @VFS_COPY_CHUNK_FL_MUST_CLONE: indicates that copy_chunk_send_fn() copy must + * @VFS_OFFLOAD_WRITE_FL_MUST_CLONE: indicates that offload_write_send_fn() copy must * be handled as a COW clone, AKA reflink. - * @VFS_COPY_CHUNK_FL_MASK_ALL: all valid copychunk flags. + * @VFS_OFFLOAD_WRITE_FL_MASK_ALL: all valid flags. */ -enum vfs_copy_chunk_flags { - VFS_COPY_CHUNK_FL_MUST_CLONE = 0x0001, - VFS_COPY_CHUNK_FL_IGNORE_LOCKS = 0x0002, +enum vfs_offload_write_flags { + VFS_OFFLOAD_WRITE_FL_MUST_CLONE = 0x0001, + VFS_OFFLOAD_WRITE_FL_IGNORE_LOCKS = 0x0002, - VFS_COPY_CHUNK_FL_MASK_ALL = - (VFS_COPY_CHUNK_FL_MUST_CLONE - | VFS_COPY_CHUNK_FL_IGNORE_LOCKS), + VFS_OFFLOAD_WRITE_FL_MASK_ALL = + (VFS_OFFLOAD_WRITE_FL_MUST_CLONE + | VFS_OFFLOAD_WRITE_FL_IGNORE_LOCKS), }; struct vfs_aio_state { @@ -794,18 +796,18 @@ struct vfs_fn_pointers { struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, DATA_BLOB *token_blob); - struct tevent_req *(*copy_chunk_send_fn)(struct vfs_handle_struct *handle, - TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct files_struct *src_fsp, - off_t src_off, - struct files_struct *dest_fsp, - off_t dest_off, - off_t to_copy, - uint32_t flags); - NTSTATUS (*copy_chunk_recv_fn)(struct vfs_handle_struct *handle, - struct tevent_req *req, - off_t *copied); + struct tevent_req *(*offload_write_send_fn)(struct vfs_handle_struct *handle, + TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct files_struct *src_fsp, + off_t src_off, + struct files_struct *dest_fsp, + off_t dest_off, + off_t to_copy, + uint32_t flags); + NTSTATUS (*offload_write_recv_fn)(struct vfs_handle_struct *handle, + struct tevent_req *req, + off_t *copied); NTSTATUS (*get_compression_fn)(struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, struct files_struct *fsp, @@ -1374,18 +1376,18 @@ NTSTATUS smb_vfs_call_offload_read_recv(struct tevent_req *req, struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, DATA_BLOB *token_blob); -struct tevent_req *smb_vfs_call_copy_chunk_send(struct vfs_handle_struct *handle, - TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct files_struct *src_fsp, - off_t src_off, - struct files_struct *dest_fsp, - off_t dest_off, - off_t num, - uint32_t flags); -NTSTATUS smb_vfs_call_copy_chunk_recv(struct vfs_handle_struct *handle, - struct tevent_req *req, - off_t *copied); +struct tevent_req *smb_vfs_call_offload_write_send(struct vfs_handle_struct *handle, + TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct files_struct *src_fsp, + off_t src_off, + struct files_struct *dest_fsp, + off_t dest_off, + off_t num, + uint32_t flags); +NTSTATUS smb_vfs_call_offload_write_recv(struct vfs_handle_struct *handle, + struct tevent_req *req, + off_t *copied); NTSTATUS smb_vfs_call_get_compression(struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, struct files_struct *fsp, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 65c7b7e091e..2d810d0aa80 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -425,15 +425,15 @@ #define SMB_VFS_NEXT_OFFLOAD_READ_RECV(req, handle, mem_ctx, token_blob) \ smb_vfs_call_offload_read_recv((req), (handle)->next, (mem_ctx), (token_blob)) -#define SMB_VFS_COPY_CHUNK_SEND(conn, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num, flags) \ - smb_vfs_call_copy_chunk_send((conn)->vfs_handles, (mem_ctx), (ev), (src_fsp), (src_off), (dest_fsp), (dest_off), (num), (flags)) -#define SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num, flags) \ - smb_vfs_call_copy_chunk_send((handle)->next, (mem_ctx), (ev), (src_fsp), (src_off), (dest_fsp), (dest_off), (num), (flags)) - -#define SMB_VFS_COPY_CHUNK_RECV(conn, req, copied) \ - smb_vfs_call_copy_chunk_recv((conn)->vfs_handles, (req), (copied)) -#define SMB_VFS_NEXT_COPY_CHUNK_RECV(handle, req, copied) \ - smb_vfs_call_copy_chunk_recv((handle)->next, (req), (copied)) +#define SMB_VFS_OFFLOAD_WRITE_SEND(conn, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num, flags) \ + smb_vfs_call_offload_write_send((conn)->vfs_handles, (mem_ctx), (ev), (src_fsp), (src_off), (dest_fsp), (dest_off), (num), (flags)) +#define SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num, flags) \ + smb_vfs_call_offload_write_send((handle)->next, (mem_ctx), (ev), (src_fsp), (src_off), (dest_fsp), (dest_off), (num), (flags)) + +#define SMB_VFS_OFFLOAD_WRITE_RECV(conn, req, copied) \ + smb_vfs_call_offload_write_recv((conn)->vfs_handles, (req), (copied)) +#define SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(handle, req, copied) \ + smb_vfs_call_offload_write_recv((handle)->next, (req), (copied)) #define SMB_VFS_GET_COMPRESSION(conn, mem_ctx, fsp, smb_fname, _compression_fmt) \ smb_vfs_call_get_compression((conn)->vfs_handles, (mem_ctx), (fsp), (smb_fname), (_compression_fmt)) diff --git a/source3/modules/vfs_btrfs.c b/source3/modules/vfs_btrfs.c index b175a8437ce..79175378efc 100644 --- a/source3/modules/vfs_btrfs.c +++ b/source3/modules/vfs_btrfs.c @@ -201,9 +201,9 @@ struct btrfs_cc_state { off_t copied; struct tevent_req *subreq; /* non-null if passed to next VFS fn */ }; -static void btrfs_copy_chunk_done(struct tevent_req *subreq); +static void btrfs_offload_write_done(struct tevent_req *subreq); -static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle, +static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct files_struct *src_fsp, @@ -226,7 +226,7 @@ static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle return NULL; } - if (flags & ~VFS_COPY_CHUNK_FL_MASK_ALL) { + if (flags & ~VFS_OFFLOAD_WRITE_FL_MASK_ALL) { tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); return tevent_req_post(req, ev); } @@ -239,7 +239,7 @@ static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle * all data from @src_offset->EOF! This is certainly not what * the caller expects, and not what vfs_default does. */ - cc_state->subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, + cc_state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, cc_state, ev, src_fsp, src_off, @@ -250,7 +250,7 @@ static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle return tevent_req_post(req, ev); } tevent_req_set_callback(cc_state->subreq, - btrfs_copy_chunk_done, + btrfs_offload_write_done, req); return req; } @@ -271,7 +271,7 @@ static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle return tevent_req_post(req, ev); } - if (!(flags & VFS_COPY_CHUNK_FL_IGNORE_LOCKS)) { + if (!(flags & VFS_OFFLOAD_WRITE_FL_IGNORE_LOCKS)) { init_strict_lock_struct(src_fsp, src_fsp->op->global->open_persistent_id, src_off, @@ -303,7 +303,7 @@ static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle cr_args.src_length = (uint64_t)num; ret = ioctl(dest_fsp->fh->fd, BTRFS_IOC_CLONE_RANGE, &cr_args); - if (!(flags & VFS_COPY_CHUNK_FL_IGNORE_LOCKS)) { + if (!(flags & VFS_OFFLOAD_WRITE_FL_IGNORE_LOCKS)) { SMB_VFS_STRICT_UNLOCK(dest_fsp->conn, dest_fsp, &dest_lck); SMB_VFS_STRICT_UNLOCK(src_fsp->conn, src_fsp, &src_lck); } @@ -321,7 +321,7 @@ static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle (unsigned long long)cr_args.src_offset, dest_fsp->fh->fd, (unsigned long long)cr_args.dest_offset)); - cc_state->subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, + cc_state->subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, cc_state, ev, src_fsp, src_off, @@ -333,7 +333,7 @@ static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle } /* wait for subreq completion */ tevent_req_set_callback(cc_state->subreq, - btrfs_copy_chunk_done, + btrfs_offload_write_done, req); return req; } @@ -346,7 +346,7 @@ static struct tevent_req *btrfs_copy_chunk_send(struct vfs_handle_struct *handle } /* only used if the request is passed through to next VFS module */ -static void btrfs_copy_chunk_done(struct tevent_req *subreq) +static void btrfs_offload_write_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data( subreq, struct tevent_req); @@ -354,7 +354,7 @@ static void btrfs_copy_chunk_done(struct tevent_req *subreq) struct btrfs_cc_state); NTSTATUS status; - status = SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state->handle, + status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(cc_state->handle, cc_state->subreq, &cc_state->copied); if (tevent_req_nterror(req, status)) { @@ -363,7 +363,7 @@ static void btrfs_copy_chunk_done(struct tevent_req *subreq) tevent_req_done(req); } -static NTSTATUS btrfs_copy_chunk_recv(struct vfs_handle_struct *handle, +static NTSTATUS btrfs_offload_write_recv(struct vfs_handle_struct *handle, struct tevent_req *req, off_t *copied) { @@ -800,8 +800,8 @@ static struct vfs_fn_pointers btrfs_fns = { .fs_capabilities_fn = btrfs_fs_capabilities, .offload_read_send_fn = btrfs_offload_read_send, .offload_read_recv_fn = btrfs_offload_read_recv, - .copy_chunk_send_fn = btrfs_copy_chunk_send, - .copy_chunk_recv_fn = btrfs_copy_chunk_recv, + .offload_write_send_fn = btrfs_offload_write_send, + .offload_write_recv_fn = btrfs_offload_write_recv, .get_compression_fn = btrfs_get_compression, .set_compression_fn = btrfs_set_compression, .snap_check_path_fn = btrfs_snap_check_path, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 4b5e6f15f13..291f39b60f2 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1682,7 +1682,7 @@ static NTSTATUS vfswrap_offload_read_recv(struct tevent_req *req, return NT_STATUS_OK; } -struct vfs_cc_state { +struct vfswrap_offload_write_state { struct tevent_context *ev; uint8_t *buf; bool read_lck_locked; @@ -1699,42 +1699,44 @@ struct vfs_cc_state { uint32_t flags; }; -static NTSTATUS copy_chunk_loop(struct tevent_req *req); +static NTSTATUS vfswrap_offload_write_loop(struct tevent_req *req); -static struct tevent_req *vfswrap_copy_chunk_send(struct vfs_handle_struct *handle, - TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct files_struct *src_fsp, - off_t src_off, - struct files_struct *dest_fsp, - off_t dest_off, - off_t to_copy, - uint32_t flags) +static struct tevent_req *vfswrap_offload_write_send( + struct vfs_handle_struct *handle, + TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct files_struct *src_fsp, + off_t src_off, + struct files_struct *dest_fsp, + off_t dest_off, + off_t to_copy, + uint32_t flags) { struct tevent_req *req; - struct vfs_cc_state *state = NULL; + struct vfswrap_offload_write_state *state = NULL; size_t num = MIN(to_copy, COPYCHUNK_MAX_TOTAL_LEN); NTSTATUS status; DBG_DEBUG("server side copy chunk of length %" PRIu64 "\n", to_copy); - req = tevent_req_create(mem_ctx, &state, struct vfs_cc_state); + req = tevent_req_create(mem_ctx, &state, + struct vfswrap_offload_write_state); if (req == NULL) { return NULL; } - if (flags & ~VFS_COPY_CHUNK_FL_MASK_ALL) { + if (flags & ~VFS_OFFLOAD_WRITE_FL_MASK_ALL) { tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); return tevent_req_post(req, ev); } - if (flags & VFS_COPY_CHUNK_FL_MUST_CLONE) { + if (flags & VFS_OFFLOAD_WRITE_FL_MUST_CLONE) { DEBUG(10, ("COW clones not supported by vfs_default\n")); tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); return tevent_req_post(req, ev); } - *state = (struct vfs_cc_state) { + *state = (struct vfswrap_offload_write_state) { .ev = ev, .src_fsp = src_fsp, .src_off = src_off, @@ -1778,7 +1780,7 @@ static struct tevent_req *vfswrap_copy_chunk_send(struct vfs_handle_struct *hand return tevent_req_post(req, ev); } - status = copy_chunk_loop(req); + status = vfswrap_offload_write_loop(req); if (!NT_STATUS_IS_OK(status)) { tevent_req_nterror(req, status); return tevent_req_post(req, ev); @@ -1787,17 +1789,18 @@ static struct tevent_req *vfswrap_copy_chunk_send(struct vfs_handle_struct *hand return req; } -static void vfswrap_copy_chunk_read_done(struct tevent_req *subreq); +static void vfswrap_offload_write_read_done(struct tevent_req *subreq); -static NTSTATUS copy_chunk_loop(struct tevent_req *req) +static NTSTATUS vfswrap_offload_write_loop(struct tevent_req *req) { - struct vfs_cc_state *state = tevent_req_data(req, struct vfs_cc_state); + struct vfswrap_offload_write_state *state = tevent_req_data( + req, struct vfswrap_offload_write_state); struct tevent_req *subreq = NULL; bool ok; state->next_io_size = MIN(state->remaining, talloc_array_length(state->buf)); - if (!(state->flags & VFS_COPY_CHUNK_FL_IGNORE_LOCKS)) { + if (!(state->flags & VFS_OFFLOAD_WRITE_FL_IGNORE_LOCKS)) { init_strict_lock_struct(state->src_fsp, state->src_fsp->op->global->open_persistent_id, state->src_off, @@ -1822,23 +1825,24 @@ static NTSTATUS copy_chunk_loop(struct tevent_req *req) if (subreq == NULL) { return NT_STATUS_NO_MEMORY; } - tevent_req_set_callback(subreq, vfswrap_copy_chunk_read_done, req); + tevent_req_set_callback(subreq, vfswrap_offload_write_read_done, req); return NT_STATUS_OK; } -static void vfswrap_copy_chunk_write_done(struct tevent_req *subreq); +static void vfswrap_offload_write_write_done(struct tevent_req *subreq); -static void vfswrap_copy_chunk_read_done(struct tevent_req *subreq) +static void vfswrap_offload_write_read_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data( subreq, struct tevent_req); - struct vfs_cc_state *state = tevent_req_data(req, struct vfs_cc_state); + struct vfswrap_offload_write_state *state = tevent_req_data( + req, struct vfswrap_offload_write_state); struct vfs_aio_state aio_state; ssize_t nread; bool ok; - if (!(state->flags & VFS_COPY_CHUNK_FL_IGNORE_LOCKS)) { + if (!(state->flags & VFS_OFFLOAD_WRITE_FL_IGNORE_LOCKS)) { SMB_VFS_STRICT_UNLOCK(state->src_fsp->conn, state->src_fsp, &state->read_lck); @@ -1861,7 +1865,7 @@ static void vfswrap_copy_chunk_read_done(struct tevent_req *subreq) state->src_off += nread; - if (!(state->flags & VFS_COPY_CHUNK_FL_IGNORE_LOCKS)) { + if (!(state->flags & VFS_OFFLOAD_WRITE_FL_IGNORE_LOCKS)) { init_strict_lock_struct(state->dst_fsp, state->dst_fsp->op->global->open_persistent_id, state->dst_off, @@ -1888,19 +1892,20 @@ static void vfswrap_copy_chunk_read_done(struct tevent_req *subreq) tevent_req_nterror(req, NT_STATUS_NO_MEMORY); return; } - tevent_req_set_callback(subreq, vfswrap_copy_chunk_write_done, req); + tevent_req_set_callback(subreq, vfswrap_offload_write_write_done, req); } -static void vfswrap_copy_chunk_write_done(struct tevent_req *subreq) +static void vfswrap_offload_write_write_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data( subreq, struct tevent_req); - struct vfs_cc_state *state = tevent_req_data(req, struct vfs_cc_state); + struct vfswrap_offload_write_state *state = tevent_req_data( + req, struct vfswrap_offload_write_state); struct vfs_aio_state aio_state; ssize_t nwritten; NTSTATUS status; - if (!(state->flags & VFS_COPY_CHUNK_FL_IGNORE_LOCKS)) { + if (!(state->flags & VFS_OFFLOAD_WRITE_FL_IGNORE_LOCKS)) { SMB_VFS_STRICT_UNLOCK(state->dst_fsp->conn, state->dst_fsp, &state->write_lck); @@ -1933,7 +1938,7 @@ static void vfswrap_copy_chunk_write_done(struct tevent_req *subreq) return; } - status = copy_chunk_loop(req); + status = vfswrap_offload_write_loop(req); if (!NT_STATUS_IS_OK(status)) { tevent_req_nterror(req, status); return; @@ -1942,11 +1947,12 @@ static void vfswrap_copy_chunk_write_done(struct tevent_req *subreq) return; } -static NTSTATUS vfswrap_copy_chunk_recv(struct vfs_handle_struct *handle, +static NTSTATUS vfswrap_offload_write_recv(struct vfs_handle_struct *handle, struct tevent_req *req, off_t *copied) { - struct vfs_cc_state *state = tevent_req_data(req, struct vfs_cc_state); + struct vfswrap_offload_write_state *state = tevent_req_data( + req, struct vfswrap_offload_write_state); NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { @@ -3079,8 +3085,8 @@ static struct vfs_fn_pointers vfs_default_fns = { .fget_dos_attributes_fn = vfswrap_fget_dos_attributes, .offload_read_send_fn = vfswrap_offload_read_send, .offload_read_recv_fn = vfswrap_offload_read_recv, - .copy_chunk_send_fn = vfswrap_copy_chunk_send, - .copy_chunk_recv_fn = vfswrap_copy_chunk_recv, + .offload_write_send_fn = vfswrap_offload_write_send, + .offload_write_recv_fn = vfswrap_offload_write_recv, .get_compression_fn = vfswrap_get_compression, .set_compression_fn = vfswrap_set_compression, diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 20d15b39af7..279366ca08c 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -5473,7 +5473,7 @@ static NTSTATUS fruit_offload_read_recv(struct tevent_req *req, return NT_STATUS_OK; } -struct fruit_copy_chunk_state { +struct fruit_offload_write_state { struct vfs_handle_struct *handle; off_t copied; struct files_struct *src_fsp; @@ -5481,8 +5481,8 @@ struct fruit_copy_chunk_state { bool is_copyfile; }; -static void fruit_copy_chunk_done(struct tevent_req *subreq); -static struct tevent_req *fruit_copy_chunk_send(struct vfs_handle_struct *handle, +static void fruit_offload_write_done(struct tevent_req *subreq); +static struct tevent_req *fruit_offload_write_send(struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct files_struct *src_fsp, @@ -5493,7 +5493,7 @@ static struct tevent_req *fruit_copy_chunk_send(struct vfs_handle_struct *handle uint32_t flags) { struct tevent_req *req, *subreq; - struct fruit_copy_chunk_state *fruit_copy_chunk_state; + struct fruit_offload_write_state *state; NTSTATUS status; struct fruit_config_data *config; off_t to_copy = num; @@ -5505,19 +5505,19 @@ static struct tevent_req *fruit_copy_chunk_send(struct vfs_handle_struct *handle struct fruit_config_data, return NULL); - req = tevent_req_create(mem_ctx, &fruit_copy_chunk_state, - struct fruit_copy_chunk_state); + req = tevent_req_create(mem_ctx, &state, + struct fruit_offload_write_state); if (req == NULL) { return NULL; } - fruit_copy_chunk_state->handle = handle; - fruit_copy_chunk_state->src_fsp = src_fsp; - fruit_copy_chunk_state->dst_fsp = dest_fsp; + state->handle = handle; + state->src_fsp = src_fsp; + state->dst_fsp = dest_fsp; /* * Check if this a OS X copyfile style copychunk request with * a requested chunk count of 0 that was translated to a - * copy_chunk_send VFS call overloading the parameters src_off + * offload_write_send VFS call overloading the parameters src_off * = dest_off = num = 0. */ if ((src_off == 0) && (dest_off == 0) && (num == 0) && @@ -5530,10 +5530,10 @@ static struct tevent_req *fruit_copy_chunk_send(struct vfs_handle_struct *handle } to_copy = src_fsp->fsp_name->st.st_ex_size; - fruit_copy_chunk_state->is_copyfile = true; + state->is_copyfile = true; } - subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, + subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, mem_ctx, ev, src_fsp, @@ -5546,16 +5546,16 @@ static struct tevent_req *fruit_copy_chunk_send(struct vfs_handle_struct *handle return tevent_req_post(req, ev); } - tevent_req_set_callback(subreq, fruit_copy_chunk_done, req); + tevent_req_set_callback(subreq, fruit_offload_write_done, req); return req; } -static void fruit_copy_chunk_done(struct tevent_req *subreq) +static void fruit_offload_write_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data( subreq, struct tevent_req); - struct fruit_copy_chunk_state *state = tevent_req_data( - req, struct fruit_copy_chunk_state); + struct fruit_offload_write_state *state = tevent_req_data( + req, struct fruit_offload_write_state); NTSTATUS status; unsigned int num_streams = 0; struct stream_struct *streams = NULL; @@ -5563,7 +5563,7 @@ static void fruit_copy_chunk_done(struct tevent_req *subreq) struct smb_filename *src_fname_tmp = NULL; struct smb_filename *dst_fname_tmp = NULL; - status = SMB_VFS_NEXT_COPY_CHUNK_RECV(state->handle, + status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle, subreq, &state->copied); TALLOC_FREE(subreq); @@ -5651,12 +5651,12 @@ static void fruit_copy_chunk_done(struct tevent_req *subreq) tevent_req_done(req); } -static NTSTATUS fruit_copy_chunk_recv(struct vfs_handle_struct *handle, +static NTSTATUS fruit_offload_write_recv(struct vfs_handle_struct *handle, struct tevent_req *req, off_t *copied) { - struct fruit_copy_chunk_state *fruit_copy_chunk_state = tevent_req_data( - req, struct fruit_copy_chunk_state); + struct fruit_offload_write_state *state = tevent_req_data( + req, struct fruit_offload_write_state); NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { @@ -5667,7 +5667,7 @@ static NTSTATUS fruit_copy_chunk_recv(struct vfs_handle_struct *handle, return status; } - *copied = fruit_copy_chunk_state->copied; + *copied = state->copied; tevent_req_received(req); return NT_STATUS_OK; @@ -5700,8 +5700,8 @@ static struct vfs_fn_pointers vfs_fruit_fns = { .readdir_attr_fn = fruit_readdir_attr, .offload_read_send_fn = fruit_offload_read_send, .offload_read_recv_fn = fruit_offload_read_recv, - .copy_chunk_send_fn = fruit_copy_chunk_send, - .copy_chunk_recv_fn = fruit_copy_chunk_recv, + .offload_write_send_fn = fruit_offload_write_send, + .offload_write_recv_fn = fruit_offload_write_recv, /* NT ACL operations */ .fget_nt_acl_fn = fruit_fget_nt_acl, diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index abf74074fbe..f9d14a8e845 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -170,8 +170,8 @@ typedef enum _vfs_op_type { SMB_VFS_OP_FSCTL, SMB_VFS_OP_OFFLOAD_READ_SEND, SMB_VFS_OP_OFFLOAD_READ_RECV, - SMB_VFS_OP_COPY_CHUNK_SEND, - SMB_VFS_OP_COPY_CHUNK_RECV, + SMB_VFS_OP_OFFLOAD_WRITE_SEND, + SMB_VFS_OP_OFFLOAD_WRITE_RECV, SMB_VFS_OP_GET_COMPRESSION, SMB_VFS_OP_SET_COMPRESSION, SMB_VFS_OP_SNAP_CHECK_PATH, @@ -314,8 +314,8 @@ static struct { { SMB_VFS_OP_FSCTL, "fsctl" }, { SMB_VFS_OP_OFFLOAD_READ_SEND, "offload_read_send" }, { SMB_VFS_OP_OFFLOAD_READ_RECV, "offload_read_recv" }, - { SMB_VFS_OP_COPY_CHUNK_SEND, "copy_chunk_send" }, - { SMB_VFS_OP_COPY_CHUNK_RECV, "copy_chunk_recv" }, + { SMB_VFS_OP_OFFLOAD_WRITE_SEND, "offload_write_send" }, + { SMB_VFS_OP_OFFLOAD_WRITE_RECV, "offload_write_recv" }, { SMB_VFS_OP_GET_COMPRESSION, "get_compression" }, { SMB_VFS_OP_SET_COMPRESSION, "set_compression" }, { SMB_VFS_OP_SNAP_CHECK_PATH, "snap_check_path" }, @@ -1941,7 +1941,7 @@ static NTSTATUS smb_full_audit_offload_read_recv( return status; } -static struct tevent_req *smb_full_audit_copy_chunk_send(struct vfs_handle_struct *handle, +static struct tevent_req *smb_full_audit_offload_write_send(struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct files_struct *src_fsp, @@ -1953,24 +1953,24 @@ static struct tevent_req *smb_full_audit_copy_chunk_send(struct vfs_handle_struc { struct tevent_req *req; - req = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, mem_ctx, ev, src_fsp, + req = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num, flags); - do_log(SMB_VFS_OP_COPY_CHUNK_SEND, req, handle, ""); + do_log(SMB_VFS_OP_OFFLOAD_WRITE_SEND, req, handle, ""); return req; } -static NTSTATUS smb_full_audit_copy_chunk_recv(struct vfs_handle_struct *handle, +static NTSTATUS smb_full_audit_offload_write_recv(struct vfs_handle_struct *handle, struct tevent_req *req, off_t *copied) { NTSTATUS result; - result = SMB_VFS_NEXT_COPY_CHUNK_RECV(handle, req, copied); + result = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(handle, req, copied); - do_log(SMB_VFS_OP_COPY_CHUNK_RECV, NT_STATUS_IS_OK(result), handle, ""); + do_log(SMB_VFS_OP_OFFLOAD_WRITE_RECV, NT_STATUS_IS_OK(result), handle, ""); return result; } @@ -2576,8 +2576,8 @@ static struct vfs_fn_pointers vfs_full_audit_fns = { .file_id_create_fn = smb_full_audit_file_id_create, .offload_read_send_fn = smb_full_audit_offload_read_send, .offload_read_recv_fn = smb_full_audit_offload_read_recv, - .copy_chunk_send_fn = smb_full_audit_copy_chunk_send, - .copy_chunk_recv_fn = smb_full_audit_copy_chunk_recv, + .offload_write_send_fn = smb_full_audit_offload_write_send, + .offload_write_recv_fn = smb_full_audit_offload_write_recv, .get_compression_fn = smb_full_audit_get_compression, .set_compression_fn = smb_full_audit_set_compression, .snap_check_path_fn = smb_full_audit_snap_check_path, diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index b6bc1682d1f..1dafe8d4089 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -1473,8 +1473,6 @@ static struct vfs_fn_pointers glusterfs_fns = { .realpath_fn = vfs_gluster_realpath, .chflags_fn = vfs_gluster_chflags, .file_id_create_fn = NULL, - .copy_chunk_send_fn = NULL, - .copy_chunk_recv_fn = NULL, .streaminfo_fn = NULL, .get_real_filename_fn = vfs_gluster_get_real_filename, .connectpath_fn = vfs_gluster_connectpath, diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index a13adfa9225..6dc03fb7a04 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1995,14 +1995,14 @@ static NTSTATUS smb_time_audit_offload_read_recv( return NT_STATUS_OK; } -struct time_audit_cc_state { +struct time_audit_offload_write_state { struct timespec ts_send; struct vfs_handle_struct *handle; off_t copied; }; -static void smb_time_audit_copy_chunk_done(struct tevent_req *subreq); +static void smb_time_audit_offload_write_done(struct tevent_req *subreq); -static struct tevent_req *smb_time_audit_copy_chunk_send(struct vfs_handle_struct *handle, +static struct tevent_req *smb_time_audit_offload_write_send(struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct files_struct *src_fsp, @@ -2014,37 +2014,38 @@ static struct tevent_req *smb_time_audit_copy_chunk_send(struct vfs_handle_struc { struct tevent_req *req; struct tevent_req *subreq; - struct time_audit_cc_state *cc_state; + struct time_audit_offload_write_state *state; - req = tevent_req_create(mem_ctx, &cc_state, struct time_audit_cc_state); + req = tevent_req_create(mem_ctx, &state, + struct time_audit_offload_write_state); if (req == NULL) { return NULL; } - cc_state->handle = handle; - clock_gettime_mono(&cc_state->ts_send); - subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, cc_state, ev, + state->handle = handle; + clock_gettime_mono(&state->ts_send); + subreq = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, state, ev, src_fsp, src_off, dest_fsp, dest_off, num, flags); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } - tevent_req_set_callback(subreq, smb_time_audit_copy_chunk_done, req); + tevent_req_set_callback(subreq, smb_time_audit_offload_write_done, req); return req; } -static void smb_time_audit_copy_chunk_done(struct tevent_req *subreq) +static void smb_time_audit_offload_write_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data( subreq, struct tevent_req); - struct time_audit_cc_state *cc_state - = tevent_req_data(req, struct time_audit_cc_state); + struct time_audit_offload_write_state *state = tevent_req_data( + req, struct time_audit_offload_write_state); NTSTATUS status; - status = SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state->handle, + status = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(state->handle, subreq, - &cc_state->copied); + &state->copied); TALLOC_FREE(subreq); if (tevent_req_nterror(req, status)) { return; @@ -2052,23 +2053,23 @@ static void smb_time_audit_copy_chunk_done(struct tevent_req *subreq) tevent_req_done(req); } -static NTSTATUS smb_time_audit_copy_chunk_recv(struct vfs_handle_struct *handle, +static NTSTATUS smb_time_audit_offload_write_recv(struct vfs_handle_struct *handle, struct tevent_req *req, off_t *copied) { - struct time_audit_cc_state *cc_state - = tevent_req_data(req, struct time_audit_cc_state); + struct time_audit_offload_write_state *state = tevent_req_data( + req, struct time_audit_offload_write_state); struct timespec ts_recv; double timediff; NTSTATUS status; clock_gettime_mono(&ts_recv); - timediff = nsec_time_diff(&ts_recv, &cc_state->ts_send)*1.0e-9; + timediff = nsec_time_diff(&ts_recv, &state->ts_send)*1.0e-9; if (timediff > audit_timeout) { - smb_time_audit_log("copy_chunk", timediff); + smb_time_audit_log("offload_write", timediff); } - *copied = cc_state->copied; + *copied = state->copied; if (tevent_req_is_nterror(req, &status)) { tevent_req_received(req); return status; @@ -2771,8 +2772,8 @@ static struct vfs_fn_pointers vfs_time_audit_fns = { .file_id_create_fn = smb_time_audit_file_id_create, .offload_read_send_fn = smb_time_audit_offload_read_send, .offload_read_recv_fn = smb_time_audit_offload_read_recv, - .copy_chunk_send_fn = smb_time_audit_copy_chunk_send, - .copy_chunk_recv_fn = smb_time_audit_copy_chunk_recv, + .offload_write_send_fn = smb_time_audit_offload_write_send, + .offload_write_recv_fn = smb_time_audit_offload_write_recv, .get_compression_fn = smb_time_audit_get_compression, .set_compression_fn = smb_time_audit_set_compression, .snap_check_path_fn = smb_time_audit_snap_check_path, diff --git a/source3/smbd/smb2_ioctl_filesys.c b/source3/smbd/smb2_ioctl_filesys.c index 7008a473f4c..5bbeadabcb9 100644 --- a/source3/smbd/smb2_ioctl_filesys.c +++ b/source3/smbd/smb2_ioctl_filesys.c @@ -289,16 +289,16 @@ static void fsctl_dup_extents_offload_read_done(struct tevent_req *subreq) } /* tell the VFS to ignore locks across the clone, matching ReFS */ - subreq = SMB_VFS_COPY_CHUNK_SEND(state->dst_fsp->conn, - state, - state->ev, - state->src_fsp, - state->dup_extents.source_off, - state->dst_fsp, - state->dup_extents.target_off, - state->dup_extents.byte_count, - VFS_COPY_CHUNK_FL_MUST_CLONE - | VFS_COPY_CHUNK_FL_IGNORE_LOCKS); + subreq = SMB_VFS_OFFLOAD_WRITE_SEND(state->dst_fsp->conn, + state, + state->ev, + state->src_fsp, + state->dup_extents.source_off, + state->dst_fsp, + state->dup_extents.target_off, + state->dup_extents.byte_count, + VFS_OFFLOAD_WRITE_FL_MUST_CLONE + | VFS_OFFLOAD_WRITE_FL_IGNORE_LOCKS); if (tevent_req_nomem(subreq, req)) { return; } @@ -315,7 +315,7 @@ static void fsctl_dup_extents_vfs_done(struct tevent_req *subreq) off_t nb_chunk; NTSTATUS status; - status = SMB_VFS_COPY_CHUNK_RECV(state->conn, subreq, &nb_chunk); + status = SMB_VFS_OFFLOAD_WRITE_RECV(state->conn, subreq, &nb_chunk); TALLOC_FREE(subreq); if (tevent_req_nterror(req, status)) { return; diff --git a/source3/smbd/smb2_ioctl_network_fs.c b/source3/smbd/smb2_ioctl_network_fs.c index acb17c3b0c7..82432baf94f 100644 --- a/source3/smbd/smb2_ioctl_network_fs.c +++ b/source3/smbd/smb2_ioctl_network_fs.c @@ -340,7 +340,7 @@ static NTSTATUS fsctl_srv_copychunk_loop(struct tevent_req *req) } state->aapl_copyfile = true; - subreq = SMB_VFS_COPY_CHUNK_SEND(state->dst_fsp->conn, + subreq = SMB_VFS_OFFLOAD_WRITE_SEND(state->dst_fsp->conn, state, state->ev, state->src_fsp, @@ -360,7 +360,7 @@ static NTSTATUS fsctl_srv_copychunk_loop(struct tevent_req *req) chunk = &state->cc_copy.chunks[state->current_chunk]; length = next_merged_io(state); - subreq = SMB_VFS_COPY_CHUNK_SEND(state->dst_fsp->conn, + subreq = SMB_VFS_OFFLOAD_WRITE_SEND(state->dst_fsp->conn, state, state->ev, state->src_fsp, @@ -386,7 +386,7 @@ static void fsctl_srv_copychunk_vfs_done(struct tevent_req *subreq) off_t chunk_nwritten; NTSTATUS status; - status = SMB_VFS_COPY_CHUNK_RECV(state->conn, subreq, + status = SMB_VFS_OFFLOAD_WRITE_RECV(state->conn, subreq, &chunk_nwritten); TALLOC_FREE(subreq); if (!NT_STATUS_IS_OK(status)) { diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 2088dbe7979..7bd94ab22b1 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2374,28 +2374,28 @@ NTSTATUS smb_vfs_call_offload_read_recv(struct tevent_req *req, return handle->fns->offload_read_recv_fn(req, handle, mem_ctx, token_blob); } -struct tevent_req *smb_vfs_call_copy_chunk_send(struct vfs_handle_struct *handle, - TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct files_struct *src_fsp, - off_t src_off, - struct files_struct *dest_fsp, - off_t dest_off, - off_t num, - uint32_t flags) -{ - VFS_FIND(copy_chunk_send); - return handle->fns->copy_chunk_send_fn(handle, mem_ctx, ev, src_fsp, +struct tevent_req *smb_vfs_call_offload_write_send(struct vfs_handle_struct *handle, + TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct files_struct *src_fsp, + off_t src_off, + struct files_struct *dest_fsp, + off_t dest_off, + off_t num, + uint32_t flags) +{ + VFS_FIND(offload_write_send); + return handle->fns->offload_write_send_fn(handle, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num, flags); } -NTSTATUS smb_vfs_call_copy_chunk_recv(struct vfs_handle_struct *handle, - struct tevent_req *req, - off_t *copied) +NTSTATUS smb_vfs_call_offload_write_recv(struct vfs_handle_struct *handle, + struct tevent_req *req, + off_t *copied) { - VFS_FIND(copy_chunk_recv); - return handle->fns->copy_chunk_recv_fn(handle, req, copied); + VFS_FIND(offload_write_recv); + return handle->fns->offload_write_recv_fn(handle, req, copied); } NTSTATUS smb_vfs_call_get_compression(vfs_handle_struct *handle, |