summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-01-26 17:19:40 -0800
committerTim Prouty <tprouty@samba.org>2009-01-29 15:29:33 -0800
commit60d058442ee8a95a3d5c3f8e04cf15249509ceb2 (patch)
tree1e233527d27e2cb4e4a1e718f60554a3ed6c9699 /source3/modules
parentb8f7cdbd79918bba0fea181f97fff5ab0c79192d (diff)
downloadsamba-60d058442ee8a95a3d5c3f8e04cf15249509ceb2.tar.gz
samba-60d058442ee8a95a3d5c3f8e04cf15249509ceb2.tar.bz2
samba-60d058442ee8a95a3d5c3f8e04cf15249509ceb2.zip
s3 onefs: Add the OneFS implementation of SMB_VFS_GET_ALLOC_SIZE
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_onefs.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/modules/vfs_onefs.c b/source3/modules/vfs_onefs.c
index e048e89589..e2f272aa11 100644
--- a/source3/modules/vfs_onefs.c
+++ b/source3/modules/vfs_onefs.c
@@ -40,6 +40,31 @@ static int onefs_open(vfs_handle_struct *handle, const char *fname,
return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
}
+static uint64_t onefs_get_alloc_size(struct vfs_handle_struct *handle, files_struct *fsp,
+ const SMB_STRUCT_STAT *sbuf)
+{
+ uint64_t result;
+
+ START_PROFILE(syscall_get_alloc_size);
+
+ if(S_ISDIR(sbuf->st_mode)) {
+ result = 0;
+ goto out;
+ }
+
+ /* Just use the file size since st_blocks is unreliable on OneFS. */
+ result = get_file_size_stat(sbuf);
+
+ if (fsp && fsp->initial_allocation_size)
+ result = MAX(result,fsp->initial_allocation_size);
+
+ result = smb_roundup(handle->conn, result);
+
+ out:
+ END_PROFILE(syscall_get_alloc_size);
+ return result;
+}
+
static int onefs_statvfs(vfs_handle_struct *handle, const char *path,
vfs_statvfs_struct *statbuf)
{
@@ -123,6 +148,8 @@ static vfs_op_tuple onefs_ops[] = {
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(onefs_lstat), SMB_VFS_OP_LSTAT,
SMB_VFS_LAYER_TRANSPARENT},
+ {SMB_VFS_OP(onefs_get_alloc_size), SMB_VFS_OP_GET_ALLOC_SIZE,
+ SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(onefs_unlink), SMB_VFS_OP_UNLINK,
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(onefs_ntimes), SMB_VFS_OP_NTIMES,