struct skel_cc_state {
uint64_t unused;
};
-static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle,
+static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct files_struct *src_fsp,
return tevent_req_post(req, ev);
}
-static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle,
+static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
struct tevent_req *req,
off_t *copied)
{
.file_id_create_fn = skel_file_id_create,
.offload_read_send_fn = skel_offload_read_send,
.offload_read_recv_fn = skel_offload_read_recv,
- .copy_chunk_send_fn = skel_copy_chunk_send,
- .copy_chunk_recv_fn = skel_copy_chunk_recv,
+ .offload_write_send_fn = skel_offload_write_send,
+ .offload_write_recv_fn = skel_offload_write_recv,
.get_compression_fn = skel_get_compression,
.set_compression_fn = skel_set_compression,
return NT_STATUS_OK;
}
-struct skel_cc_state {
+struct skel_offload_write_state {
struct vfs_handle_struct *handle;
off_t copied;
};
-static void skel_copy_chunk_done(struct tevent_req *subreq);
+static void skel_offload_write_done(struct tevent_req *subreq);
-static struct tevent_req *skel_copy_chunk_send(struct vfs_handle_struct *handle,
+static struct tevent_req *skel_offload_write_send(struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct files_struct *src_fsp,
{
struct tevent_req *req;
struct tevent_req *subreq;
- struct skel_cc_state *cc_state;
+ struct skel_offload_write_state *state;
- req = tevent_req_create(mem_ctx, &cc_state, struct skel_cc_state);
+ req = tevent_req_create(mem_ctx, &state, struct skel_offload_write_state);
if (req == NULL) {
return NULL;
}
- cc_state->handle = handle;
- subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, cc_state, ev,
+ state->handle = handle;
+ 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, skel_copy_chunk_done, req);
+ tevent_req_set_callback(subreq, skel_offload_write_done, req);
return req;
}
-static void skel_copy_chunk_done(struct tevent_req *subreq)
+static void skel_offload_write_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(
subreq, struct tevent_req);
- struct skel_cc_state *cc_state
- = tevent_req_data(req, struct skel_cc_state);
+ struct skel_offload_write_state *state
+ = tevent_req_data(req, struct skel_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;
tevent_req_done(req);
}
-static NTSTATUS skel_copy_chunk_recv(struct vfs_handle_struct *handle,
+static NTSTATUS skel_offload_write_recv(struct vfs_handle_struct *handle,
struct tevent_req *req,
off_t *copied)
{
- struct skel_cc_state *cc_state
- = tevent_req_data(req, struct skel_cc_state);
+ struct skel_offload_write_state *state
+ = tevent_req_data(req, struct skel_offload_write_state);
NTSTATUS status;
- *copied = cc_state->copied;
+ *copied = state->copied;
if (tevent_req_is_nterror(req, &status)) {
tevent_req_received(req);
return status;
.file_id_create_fn = skel_file_id_create,
.offload_read_send_fn = skel_offload_read_send,
.offload_read_recv_fn = skel_offload_read_recv,
- .copy_chunk_send_fn = skel_copy_chunk_send,
- .copy_chunk_recv_fn = skel_copy_chunk_recv,
+ .offload_write_send_fn = skel_offload_write_send,
+ .offload_write_recv_fn = skel_offload_write_recv,
.get_compression_fn = skel_get_compression,
.set_compression_fn = skel_set_compression,
/* 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
};
/*
- * @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 {
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,
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,
#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))
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,
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);
}
* 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,
return tevent_req_post(req, ev);
}
tevent_req_set_callback(cc_state->subreq,
- btrfs_copy_chunk_done,
+ btrfs_offload_write_done,
req);
return req;
}
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,
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);
}
(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,
}
/* wait for subreq completion */
tevent_req_set_callback(cc_state->subreq,
- btrfs_copy_chunk_done,
+ btrfs_offload_write_done,
req);
return req;
}
}
/* 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);
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)) {
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)
{
.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,
return NT_STATUS_OK;
}
-struct vfs_cc_state {
+struct vfswrap_offload_write_state {
struct tevent_context *ev;
uint8_t *buf;
bool read_lck_locked;
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,
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);
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,
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);
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,
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);
return;
}
- status = copy_chunk_loop(req);
+ status = vfswrap_offload_write_loop(req);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return;
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)) {
.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,
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;
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,
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;
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) &&
}
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,
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;
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);
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)) {
return status;
}
- *copied = fruit_copy_chunk_state->copied;
+ *copied = state->copied;
tevent_req_received(req);
return NT_STATUS_OK;
.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,
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,
{ 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" },
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,
{
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;
}
.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,
.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,
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,
{
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;
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;
.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,
}
/* 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;
}
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;
}
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,
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,
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)) {
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,