diff options
author | Jeremy Allison <jra@samba.org> | 2010-12-17 23:08:01 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-12-18 08:59:27 +0100 |
commit | 716ea734e4cd83a2030ca2cac10056bdaab1a021 (patch) | |
tree | 8caf80f6c76f5de768896e6d0aebaf3fadbc3116 /examples | |
parent | 7157221da5bc6787b08ab26c9e83c08208b41d8a (diff) | |
download | samba-716ea734e4cd83a2030ca2cac10056bdaab1a021.tar.gz samba-716ea734e4cd83a2030ca2cac10056bdaab1a021.tar.bz2 samba-716ea734e4cd83a2030ca2cac10056bdaab1a021.zip |
Rename vfs operation posix_fallocate to just fallocate and add the vfs_fallocate_mode parameter.
It turns out we need the fallocate operations to be able to both
allocate and extend filesize, and to allocate and not extend
filesize, and posix_fallocate can only do the former. So by defining
the vfs op as posix_fallocate we lose the opportunity to use any
underlying syscalls (like Linux fallocate) that can do the latter
as well.
We don't currently use the non-extending filesize call, but now
I've changed the vfs op definition we can in the future. For the
moment simply map the fallocate op onto posix_fallocate for the
VFS_FALLOCATE_EXTEND_SIZE case and return ENOSYS for the
VFS_FALLOCATE_KEEP_SIZE case.
Jeremy.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Dec 18 08:59:27 CET 2010 on sn-devel-104
Diffstat (limited to 'examples')
-rw-r--r-- | examples/VFS/skel_opaque.c | 5 | ||||
-rw-r--r-- | examples/VFS/skel_transparent.c | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 40ee5e9d6e..e506a2060d 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -308,7 +308,8 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_ return -1; } -static int skel_posix_fallocate(vfs_handle_struct *handle, files_struct *fsp, +static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp, + enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len) { errno = ENOSYS; @@ -820,7 +821,7 @@ struct vfs_fn_pointers skel_transparent_fns = { .getwd = skel_getwd, .ntimes = skel_ntimes, .ftruncate = skel_ftruncate, - .posix_fallocate = skel_posix_fallocate, + .fallocate = skel_fallocate, .lock = skel_lock, .kernel_flock = skel_kernel_flock, .linux_setlease = skel_linux_setlease, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index ca22a30564..3ab3b63eaf 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -292,11 +292,12 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_ return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset); } -static int skel_posix_fallocate(vfs_handle_struct *handle, files_struct *fsp, +static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp, + enum vfs_fallocate_mode, SMB_OFF_T offset, SMB_OFF_T len) { - return SMB_VFS_NEXT_POSIX_FALLOCATE(handle, fsp, offset, len); + return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len); } static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) @@ -764,7 +765,7 @@ struct vfs_fn_pointers skel_transparent_fns = { .getwd = skel_getwd, .ntimes = skel_ntimes, .ftruncate = skel_ftruncate, - .posix_fallocate = skel_posix_fallocate, + .fallocate = skel_fallocate, .lock = skel_lock, .kernel_flock = skel_kernel_flock, .linux_setlease = skel_linux_setlease, |