summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@suse.de>2013-01-15 17:22:59 +0100
committerJeremy Allison <jra@samba.org>2013-01-16 23:15:06 +0100
commitef00eb90e56dfac2d823582cec92abf1fa9905f1 (patch)
tree3a582f5ce6ae0a1da9e55de2a380a79fa4bd8bdd /source3/include
parent2bde9636888067210dc38523b6fafaa0b179ec3b (diff)
downloadsamba-ef00eb90e56dfac2d823582cec92abf1fa9905f1.tar.gz
samba-ef00eb90e56dfac2d823582cec92abf1fa9905f1.tar.bz2
samba-ef00eb90e56dfac2d823582cec92abf1fa9905f1.zip
s3-vfs: add copy_chunk vfs hooks
copy_chunk copies n bytes from a source file at a specific offset to a destination file at a given offset. This interface will be used in handling smb2 FSCTL_SRV_COPYCHUNK ioctl requests. Use a pread/pwrite loop in vfs_default, so that requests referring to the same src and dest file are possible. Provide send and receive hooks for copy chunk VFS interface, allowing asynchronous behaviour. Check whether the request source offset + length exceeds the current size. Return STATUS_INVALID_VIEW_SIZE under such a condition, matching Windows server behaviour. Reviewed by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/vfs.h25
-rw-r--r--source3/include/vfs_macros.h10
2 files changed, 34 insertions, 1 deletions
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 2bce1b7956..d60cb5e73b 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -151,6 +151,7 @@
/* Leave at 31 - not yet released. Make struct vuid_cache_entry in
connection_struct a pointer. */
/* Leave at 31 - not yet released. Add share_access to vuid_cache_entry. */
+/* Leave at 31 - not yet released. add SMB_VFS_COPY_CHUNK() */
#define SMB_VFS_INTERFACE_VERSION 31
@@ -615,6 +616,17 @@ struct vfs_fn_pointers {
int (*chflags_fn)(struct vfs_handle_struct *handle, const char *path, unsigned int flags);
struct file_id (*file_id_create_fn)(struct vfs_handle_struct *handle,
const SMB_STRUCT_STAT *sbuf);
+ 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 num);
+ NTSTATUS (*copy_chunk_recv_fn)(struct vfs_handle_struct *handle,
+ struct tevent_req *req,
+ off_t *copied);
NTSTATUS (*streaminfo_fn)(struct vfs_handle_struct *handle,
struct files_struct *fsp,
@@ -1086,7 +1098,18 @@ NTSTATUS smb_vfs_call_fsctl(struct vfs_handle_struct *handle,
uint32_t in_len,
uint8_t **_out_data,
uint32_t max_out_len,
- uint32_t *out_len);
+ uint32_t *out_len);
+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);
+NTSTATUS smb_vfs_call_copy_chunk_recv(struct vfs_handle_struct *handle,
+ struct tevent_req *req,
+ off_t *copied);
NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32 security_info,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 331fe001be..364a4ca6e1 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -399,6 +399,16 @@
#define SMB_VFS_NEXT_FSCTL(handle, fsp, ctx, function, req_flags, in_data, in_len, out_data, max_out_len, out_len) \
smb_vfs_call_fsctl((handle)->next, (fsp), (ctx), (function), (req_flags), (in_data), (in_len), (out_data), (max_out_len), (out_len))
+#define SMB_VFS_COPY_CHUNK_SEND(conn, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num) \
+ smb_vfs_call_copy_chunk_send((conn)->vfs_handles, (mem_ctx), (ev), (src_fsp), (src_off), (dest_fsp), (dest_off), (num))
+#define SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num) \
+ smb_vfs_call_copy_chunk_send((handle)->next, (mem_ctx), (ev), (src_fsp), (src_off), (dest_fsp), (dest_off), (num))
+
+#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_FGET_NT_ACL(fsp, security_info, mem_ctx, ppdesc) \
smb_vfs_call_fget_nt_acl((fsp)->conn->vfs_handles, (fsp), (security_info), (mem_ctx), (ppdesc))
#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx, ppdesc) \