s3: Add a new SMB_VFS_GET_ALLOC_SIZE vfs operation
authorTim Prouty <tprouty@samba.org>
Mon, 26 Jan 2009 23:39:40 +0000 (15:39 -0800)
committerTim Prouty <tprouty@samba.org>
Thu, 29 Jan 2009 23:29:33 +0000 (15:29 -0800)
This allows module implementors to customize what allocation size is
returned to the client.

13 files changed:
source3/include/proto.h
source3/include/smbprofile.h
source3/include/vfs.h
source3/include/vfs_macros.h
source3/lib/util.c
source3/modules/onefs_streams.c
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_streams_depot.c
source3/modules/vfs_streams_xattr.c
source3/smbd/nttrans.c
source3/smbd/reply.c
source3/smbd/trans2.c

index af5181eca6be533a20e27e5fa7a2bdb009a9e4a0..71e2145b83281dca4957bcf2696be6dcfa7036d4 100644 (file)
@@ -1128,6 +1128,7 @@ bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
 bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
 bool socket_exist(const char *fname);
 bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st);
+uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
 SMB_OFF_T get_file_size(char *file_name);
 char *attrib_string(uint16 mode);
 void show_msg(char *buf);
@@ -7377,7 +7378,6 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
 /* The following definitions come from smbd/trans2.c  */
 
 uint64_t smb_roundup(connection_struct *conn, uint64_t val);
-uint64_t get_allocation_size(connection_struct *conn, files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
 NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
                      files_struct *fsp, const char *fname,
                      const char *ea_name, struct ea_struct *pea);
index 8945708ca3375adb127a22226b36e9cd1dcdede7..131416b68520258e0525bffe5e8252f3aaae2d56 100644 (file)
@@ -127,6 +127,10 @@ enum profile_stats_values
 #define syscall_lstat_count __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, count)
 #define syscall_lstat_time __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, time)
 
+       PR_VALUE_SYSCALL_GET_ALLOC_SIZE,
+#define syscall_get_alloc_size_count __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, count)
+#define syscall_get_alloc_size_time __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, time)
+
        PR_VALUE_SYSCALL_UNLINK,
 #define syscall_unlink_count __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, count)
 #define syscall_unlink_time __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, time)
index 5df71da9057dfb725925f8fde32747147c3c37ba..e9115ab8075d8f14836a4c9c3b7e9d4fd457941b 100644 (file)
 /* Changed to version 25 - Jelmer's change from SMB_BIG_UINT to uint64_t. */
 /* Leave at 25 - not yet released. Add create_file call. -- tprouty. */
 /* Leave at 25 - not yet released. Add create time to ntimes. -- tstecher. */
+/* Leave at 25 - not yet released. Add get_alloc_size call. -- tprouty. */
 
 #define SMB_VFS_INTERFACE_VERSION 25
 
@@ -189,6 +190,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_STAT,
        SMB_VFS_OP_FSTAT,
        SMB_VFS_OP_LSTAT,
+       SMB_VFS_OP_GET_ALLOC_SIZE,
        SMB_VFS_OP_UNLINK,
        SMB_VFS_OP_CHMOD,
        SMB_VFS_OP_FCHMOD,
@@ -342,6 +344,7 @@ struct vfs_ops {
                int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf);
                int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
                int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
+               uint64_t (*get_alloc_size)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
                int (*unlink)(struct vfs_handle_struct *handle, const char *path);
                int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
                int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
@@ -496,6 +499,7 @@ struct vfs_ops {
                struct vfs_handle_struct *stat;
                struct vfs_handle_struct *fstat;
                struct vfs_handle_struct *lstat;
+               struct vfs_handle_struct *get_alloc_size;
                struct vfs_handle_struct *unlink;
                struct vfs_handle_struct *chmod;
                struct vfs_handle_struct *fchmod;
index c6ccd4912a1ec576af0f13515ceec35a26661780..e7a9cfdc764457aebdb122a8bba497c6e1877e92 100644 (file)
@@ -62,6 +62,7 @@
 #define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf)))
 #define SMB_VFS_FSTAT(fsp, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp), (sbuf)))
 #define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf)))
+#define SMB_VFS_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs.ops.get_alloc_size((conn)->vfs.handles.get_alloc_size, (fsp), (sbuf)))
 #define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path)))
 #define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode)))
 #define SMB_VFS_FCHMOD(fsp, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf)))
 #define SMB_VFS_OPAQUE_FSTAT(fsp, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp), (sbuf)))
 #define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf)))
+#define SMB_VFS_OPAQUE_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs_opaque.ops.get_alloc_size((conn)->vfs_opaque.handles.get_alloc_size, (fsp), (sbuf)))
 #define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path)))
 #define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode)))
 #define SMB_VFS_OPAQUE_FCHMOD(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf)))
 #define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp), (sbuf)))
 #define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf)))
+#define SMB_VFS_NEXT_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs_next.ops.get_alloc_size((conn)->vfs_next.handles.get_alloc_size, (fsp), (sbuf)))
 #define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path)))
 #define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode)))
 #define SMB_VFS_NEXT_FCHMOD(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (mode)))
index 2485d1def575049c50e88a3762d9a1cf2d5fa4ea..195065a1e0bd13118efe55c26d3d948da899b3e8 100644 (file)
@@ -541,6 +541,15 @@ bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st)
        return ret;
 }
 
+/*******************************************************************
+ Returns the size in bytes of the named given the stat struct.
+********************************************************************/
+
+uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf)
+{
+       return sbuf->st_size;
+}
+
 /*******************************************************************
  Returns the size in bytes of the named file.
 ********************************************************************/
@@ -551,7 +560,7 @@ SMB_OFF_T get_file_size(char *file_name)
        buf.st_size = 0;
        if(sys_stat(file_name,&buf) != 0)
                return (SMB_OFF_T)-1;
-       return(buf.st_size);
+       return get_file_size_stat(&buf);
 }
 
 /*******************************************************************
index e9543e237f42577117f7d0fa8ca864ed8319ab4d..78b0fd61bf5de0813cf57fc515677e3dc6bab528 100644 (file)
@@ -533,8 +533,8 @@ static NTSTATUS walk_onefs_streams(connection_struct *conn, files_struct *fsp,
                if (!add_one_stream(state->mem_ctx,
                                    &state->num_streams, &state->streams,
                                    dp->d_name, stream_sbuf.st_size,
-                                   get_allocation_size(conn, NULL,
-                                                       &stream_sbuf))) {
+                                   SMB_VFS_GET_ALLOC_SIZE(conn, NULL,
+                                                          &stream_sbuf))) {
                        state->status = NT_STATUS_NO_MEMORY;
                        break;
                }
@@ -594,8 +594,8 @@ NTSTATUS onefs_streaminfo(vfs_handle_struct *handle,
                if (!add_one_stream(mem_ctx,
                                    &state.num_streams, &state.streams,
                                    "", sbuf.st_size,
-                                   get_allocation_size(handle->conn, fsp,
-                                                       &sbuf))) {
+                                   SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp,
+                                                          &sbuf))) {
                        return NT_STATUS_NO_MEMORY;
                }
        }
index a9aabab76854ca43ee82a5ecbc21a1654bb75b72..f8ac3e85d3b26f02b47f2be7e9f870a2a82c033a 100644 (file)
@@ -551,6 +551,39 @@ int vfswrap_lstat(vfs_handle_struct *handle,  const char *path, SMB_STRUCT_STAT
        return result;
 }
 
+/********************************************************************
+ Given a stat buffer return the allocated size on disk, taking into
+ account sparse files.
+********************************************************************/
+static uint64_t vfswrap_get_alloc_size(vfs_handle_struct *handle,
+                                      struct 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;
+       }
+
+#if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
+       result = (uint64_t)STAT_ST_BLOCKSIZE * (uint64_t)sbuf->st_blocks;
+#else
+       result = get_file_size_stat(sbuf);
+#endif
+
+       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 vfswrap_unlink(vfs_handle_struct *handle,  const char *path)
 {
        int result;
@@ -1043,7 +1076,7 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
        }
 
        streams->size = sbuf.st_size;
-       streams->alloc_size = get_allocation_size(handle->conn, fsp, &sbuf);
+       streams->alloc_size = SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, &sbuf);
 
        streams->name = talloc_strdup(streams, "::$DATA");
        if (streams->name == NULL) {
@@ -1443,6 +1476,8 @@ static vfs_op_tuple vfs_default_ops[] = {
         SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_lstat),     SMB_VFS_OP_LSTAT,
         SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(vfswrap_get_alloc_size),    SMB_VFS_OP_GET_ALLOC_SIZE,
+        SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_unlink),    SMB_VFS_OP_UNLINK,
         SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_chmod),     SMB_VFS_OP_CHMOD,
index 73758a2d9d8a768aadbc25b055717e5aba900e04..c6d62fdd879ed15739928ef2fd1a6f5d379f9f1c 100644 (file)
@@ -155,6 +155,8 @@ static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
                       SMB_STRUCT_STAT *sbuf);
 static int smb_full_audit_lstat(vfs_handle_struct *handle,
                       const char *path, SMB_STRUCT_STAT *sbuf);
+static int smb_full_audit_get_alloc_size(vfs_handle_struct *handle,
+                      files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
 static int smb_full_audit_unlink(vfs_handle_struct *handle,
                        const char *path);
 static int smb_full_audit_chmod(vfs_handle_struct *handle,
@@ -403,6 +405,8 @@ static vfs_op_tuple audit_op_tuples[] = {
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_lstat),      SMB_VFS_OP_LSTAT,
         SMB_VFS_LAYER_LOGGER},
+       {SMB_VFS_OP(smb_full_audit_get_alloc_size),     SMB_VFS_OP_GET_ALLOC_SIZE,
+        SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_unlink),     SMB_VFS_OP_UNLINK,
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_chmod),      SMB_VFS_OP_CHMOD,
@@ -597,6 +601,7 @@ static struct {
        { SMB_VFS_OP_STAT,      "stat" },
        { SMB_VFS_OP_FSTAT,     "fstat" },
        { SMB_VFS_OP_LSTAT,     "lstat" },
+       { SMB_VFS_OP_GET_ALLOC_SIZE,    "get_alloc_size" },
        { SMB_VFS_OP_UNLINK,    "unlink" },
        { SMB_VFS_OP_CHMOD,     "chmod" },
        { SMB_VFS_OP_FCHMOD,    "fchmod" },
@@ -1325,6 +1330,18 @@ static int smb_full_audit_lstat(vfs_handle_struct *handle,
        return result;    
 }
 
+static int smb_full_audit_get_alloc_size(vfs_handle_struct *handle,
+                      files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
+{
+       int result;
+
+       result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
+
+       do_log(SMB_VFS_OP_GET_ALLOC_SIZE, (result >= 0), handle, "%d", result);
+
+       return result;
+}
+
 static int smb_full_audit_unlink(vfs_handle_struct *handle,
                        const char *path)
 {
index 54c17db1ce22847e89011d5ff337f8a7f9ba8b96..77efb277de09ce2acbc2fff9b06d1507f9a7bd83 100644 (file)
@@ -648,8 +648,8 @@ static bool collect_one_stream(const char *dirname,
        if (!add_one_stream(state->mem_ctx,
                            &state->num_streams, &state->streams,
                            dirent, sbuf.st_size,
-                           get_allocation_size(
-                                   state->handle->conn, NULL, &sbuf))) {
+                           SMB_VFS_GET_ALLOC_SIZE(state->handle->conn, NULL,
+                                                  &sbuf))) {
                state->status = NT_STATUS_NO_MEMORY;
                return false;
        }
@@ -693,8 +693,8 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
                if (!add_one_stream(mem_ctx,
                                    &state.num_streams, &state.streams,
                                    "::$DATA", sbuf.st_size,
-                                   get_allocation_size(handle->conn, fsp,
-                                                       &sbuf))) {
+                                   SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp,
+                                                          &sbuf))) {
                        return NT_STATUS_NO_MEMORY;
                }
        }
index 1df4932167d77f45dfdc033faeccc52393202356..37473439dd8251e7d60173c82369fb2d1de5347e 100644 (file)
@@ -732,8 +732,8 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle,
                if (!add_one_stream(mem_ctx,
                                    &state.num_streams, &state.streams,
                                    "::$DATA", sbuf.st_size,
-                                   get_allocation_size(handle->conn, fsp,
-                                                       &sbuf))) {
+                                   SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp,
+                                                          &sbuf))) {
                        return NT_STATUS_NO_MEMORY;
                }
        }
index 1ee3edbdbeaf1b2bed788f22ee11066ed2a30d68..0ad4df6e90dcc1accf2d995bf1c0fed91ff3ae22 100644 (file)
@@ -621,7 +621,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
        p += 8;
        SIVAL(p,0,fattr); /* File Attributes. */
        p += 4;
-       SOFF_T(p, 0, get_allocation_size(conn,fsp,&sbuf));
+       SOFF_T(p, 0, SMB_VFS_GET_ALLOC_SIZE(conn,fsp,&sbuf));
        p += 8;
        SOFF_T(p,0,file_len);
        p += 8;
@@ -1086,7 +1086,7 @@ static void call_nt_transact_create(connection_struct *conn,
        p += 8;
        SIVAL(p,0,fattr); /* File Attributes. */
        p += 4;
-       SOFF_T(p, 0, get_allocation_size(conn,fsp,&sbuf));
+       SOFF_T(p, 0, SMB_VFS_GET_ALLOC_SIZE(conn,fsp,&sbuf));
        p += 8;
        SOFF_T(p,0,file_len);
        p += 8;
index 52dab0a0139692e203143d5083cd3e83d8a857ce..25d50470ff8f0edeb965803b93d9bee68944df01 100644 (file)
@@ -1816,7 +1816,7 @@ void reply_open_and_X(struct smb_request *req)
                        END_PROFILE(SMBopenX);
                        return;
                }
-               sbuf.st_size = get_allocation_size(conn,fsp,&sbuf);
+               sbuf.st_size = SMB_VFS_GET_ALLOC_SIZE(conn,fsp,&sbuf);
        }
 
        fattr = dos_mode(conn,fsp->fsp_name,&sbuf);
@@ -7281,7 +7281,7 @@ void reply_getattrE(struct smb_request *req)
                SIVAL(req->outbuf, smb_vwv6, 0);
                SIVAL(req->outbuf, smb_vwv8, 0);
        } else {
-               uint32 allocation_size = get_allocation_size(conn,fsp, &sbuf);
+               uint32 allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn,fsp, &sbuf);
                SIVAL(req->outbuf, smb_vwv6, (uint32)sbuf.st_size);
                SIVAL(req->outbuf, smb_vwv8, allocation_size);
        }
index 1b161d533898ac31f1b3c75c368b4e97cd2d989a..6c082a8273e64a59dbce0b75881a394cc07b84fb 100644 (file)
@@ -29,7 +29,6 @@
 
 extern enum protocol_types Protocol;
 
-#define get_file_size(sbuf) ((sbuf).st_size)
 #define DIR_ENTRY_SAFETY_MARGIN 4096
 
 static char *store_file_unix_basic(connection_struct *conn,
@@ -59,31 +58,6 @@ uint64_t smb_roundup(connection_struct *conn, uint64_t val)
        return val;
 }
 
-/********************************************************************
- Given a stat buffer return the allocated size on disk, taking into
- account sparse files.
-********************************************************************/
-
-uint64_t get_allocation_size(connection_struct *conn, files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
-{
-       uint64_t ret;
-
-       if(S_ISDIR(sbuf->st_mode)) {
-               return 0;
-       }
-
-#if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
-       ret = (uint64_t)STAT_ST_BLOCKSIZE * (uint64_t)sbuf->st_blocks;
-#else
-       ret = (uint64_t)get_file_size(*sbuf);
-#endif
-
-       if (fsp && fsp->initial_allocation_size)
-               ret = MAX(ret,fsp->initial_allocation_size);
-
-       return smb_roundup(conn, ret);
-}
-
 /****************************************************************************
  Utility functions for dealing with extended attributes.
 ****************************************************************************/
@@ -1034,7 +1008,7 @@ static void call_trans2open(connection_struct *conn,
                return;
        }
 
-       size = get_file_size(sbuf);
+       size = get_file_size_stat(&sbuf);
        fattr = dos_mode(conn,fsp->fsp_name,&sbuf);
        mtime = sbuf.st_mtime;
        inode = sbuf.st_ino;
@@ -1424,9 +1398,9 @@ static bool get_lanman2_dir_entry(TALLOC_CTX *ctx,
                        }
 
                        if (!(mode & aDIR)) {
-                               file_size = get_file_size(sbuf);
+                               file_size = get_file_size_stat(&sbuf);
                        }
-                       allocation_size = get_allocation_size(conn,NULL,&sbuf);
+                       allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn,NULL,&sbuf);
 
                        mdate_ts = get_mtimespec(&sbuf);
                        adate_ts = get_atimespec(&sbuf);
@@ -3523,10 +3497,10 @@ static char *store_file_unix_basic(connection_struct *conn,
        DEBUG(10,("store_file_unix_basic: SMB_QUERY_FILE_UNIX_BASIC\n"));
        DEBUG(4,("store_file_unix_basic: st_mode=%o\n",(int)psbuf->st_mode));
 
-       SOFF_T(pdata,0,get_file_size(*psbuf));             /* File size 64 Bit */
+       SOFF_T(pdata,0,get_file_size_stat(psbuf));             /* File size 64 Bit */
        pdata += 8;
 
-       SOFF_T(pdata,0,get_allocation_size(conn,fsp,psbuf)); /* Number of bytes used on disk - 64 Bit */
+       SOFF_T(pdata,0,SMB_VFS_GET_ALLOC_SIZE(conn,fsp,psbuf)); /* Number of bytes used on disk - 64 Bit */
        pdata += 8;
 
        put_long_date_timespec(pdata,get_ctimespec(psbuf));       /* Change Time 64 Bit */
@@ -4094,7 +4068,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
 
        fullpathname = fname;
        if (!(mode & aDIR))
-               file_size = get_file_size(sbuf);
+               file_size = get_file_size_stat(&sbuf);
 
        /* Pull out any data sent here before we realloc. */
        switch (info_level) {
@@ -4180,7 +4154,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
        mtime_ts = get_mtimespec(&sbuf);
        atime_ts = get_atimespec(&sbuf);
 
-       allocation_size = get_allocation_size(conn,fsp,&sbuf);
+       allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn,fsp,&sbuf);
 
        if (!fsp) {
                /* Do we have this path open ? */
@@ -4188,7 +4162,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
                fileid = vfs_file_id_from_sbuf(conn, &sbuf);
                fsp1 = file_find_di_first(fileid);
                if (fsp1 && fsp1->initial_allocation_size) {
-                       allocation_size = get_allocation_size(conn, fsp1, &sbuf);
+                       allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn, fsp1, &sbuf);
                }
        }
 
@@ -5044,7 +5018,7 @@ static NTSTATUS smb_set_file_size(connection_struct *conn,
 
        DEBUG(6,("smb_set_file_size: size: %.0f ", (double)size));
 
-       if (size == get_file_size(*psbuf)) {
+       if (size == get_file_size_stat(psbuf)) {
                return NT_STATUS_OK;
        }
 
@@ -5832,7 +5806,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
        if (fsp && fsp->fh->fd != -1) {
                /* Open file handle. */
                /* Only change if needed. */
-               if (allocation_size != get_file_size(*psbuf)) {
+               if (allocation_size != get_file_size_stat(psbuf)) {
                        if (vfs_allocate_file_space(fsp, allocation_size) == -1) {
                                return map_nt_error_from_unix(errno);
                        }
@@ -5874,7 +5848,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
        }
 
        /* Only change if needed. */
-       if (allocation_size != get_file_size(*psbuf)) {
+       if (allocation_size != get_file_size_stat(psbuf)) {
                if (vfs_allocate_file_space(new_fsp, allocation_size) == -1) {
                        status = map_nt_error_from_unix(errno);
                        close_file(req, new_fsp, NORMAL_CLOSE);
@@ -6101,7 +6075,7 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
 
                /* Ensure we don't try and change anything else. */
                raw_unixmode = SMB_MODE_NO_CHANGE;
-               size = get_file_size(*psbuf);
+               size = get_file_size_stat(psbuf);
                ft.atime = get_atimespec(psbuf);
                ft.mtime = get_mtimespec(psbuf);
                /* 
@@ -6117,7 +6091,7 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
         * */
 
        if (!size) {
-               size = get_file_size(*psbuf);
+               size = get_file_size_stat(psbuf);
        }
 #endif