summaryrefslogtreecommitdiffstats
path: root/source3/smbd
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2015-02-09 18:21:59 +0100
committerJeremy Allison <jra@samba.org>2015-03-09 21:27:07 +0100
commit12c0b6bf4055b0466d0a2962d5ac34ac60357de3 (patch)
treec9a8bed2fc463020192cd9191ea7cf615a9e0ebd /source3/smbd
parent3787119eb8d85d122badb22b3bcc15ed5c32765d (diff)
downloadsamba-12c0b6bf4055b0466d0a2962d5ac34ac60357de3.tar.gz
samba-12c0b6bf4055b0466d0a2962d5ac34ac60357de3.tar.xz
samba-12c0b6bf4055b0466d0a2962d5ac34ac60357de3.zip
s3/vfs: change fallocate mode flags from enum->uint32_t
The Linux fallocate syscall offers a mode parameter which can take the following flags: FALLOC_FL_KEEP_SIZE FALLOC_FL_PUNCH_HOLE (since 2.6.38) FALLOC_FL_COLLAPSE_RANGE (since 3.15) FALLOC_FL_ZERO_RANGE (since 3.14) The flags are not exclusive, e.g. FALLOC_FL_PUNCH_HOLE must be specified alongside FALLOC_FL_KEEP_SIZE. Samba currently takes a vfs_fallocate_mode enum parameter for the VFS fallocate hook, taking either an EXTEND_SIZE or KEEP_SIZE value. This commit changes the fallocate hook such that it accepts a uint32_t flags parameter, in preparation for PUNCH_HOLE and ZERO_RANGE support. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/vfs.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 381bb8d2af..1e20963da1 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -573,7 +573,8 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
if (lp_strict_allocate(SNUM(fsp->conn))) {
/* See if we have a syscall that will allocate beyond
end-of-file without changing EOF. */
- ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_KEEP_SIZE, 0, len);
+ ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_FL_KEEP_SIZE,
+ 0, len);
} else {
ret = 0;
}
@@ -728,8 +729,7 @@ int vfs_fill_sparse(files_struct *fsp, off_t len)
* emulation is being done by the libc (like on AIX with JFS1). In that
* case we do our own emulation. fallocate implementations can
* return ENOTSUP or EINVAL in cases like that. */
- ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_EXTEND_SIZE,
- offset, num_to_write);
+ ret = SMB_VFS_FALLOCATE(fsp, 0, offset, num_to_write);
if (ret == -1 && errno == ENOSPC) {
goto out;
}
@@ -2023,10 +2023,10 @@ int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle,
}
int smb_vfs_call_fallocate(struct vfs_handle_struct *handle,
- struct files_struct *fsp,
- enum vfs_fallocate_mode mode,
- off_t offset,
- off_t len)
+ struct files_struct *fsp,
+ uint32_t mode,
+ off_t offset,
+ off_t len)
{
VFS_FIND(fallocate);
return handle->fns->fallocate_fn(handle, fsp, mode, offset, len);