From ef00eb90e56dfac2d823582cec92abf1fa9905f1 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Tue, 15 Jan 2013 17:22:59 +0100 Subject: 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 --- source3/include/vfs_macros.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/include/vfs_macros.h') 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) \ -- cgit