summaryrefslogtreecommitdiff
path: root/source4/lib/fsusage.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-25 13:57:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:14 -0500
commit579c13da43d5b40ac6d6c1436399fbc1d8dfd054 (patch)
tree42299570746f2d7f80356b689cb15e3db6c53d3c /source4/lib/fsusage.c
parent81e8de9ca85fe9a6658beb1dab0d231c13cda063 (diff)
downloadsamba-579c13da43d5b40ac6d6c1436399fbc1d8dfd054.tar.gz
samba-579c13da43d5b40ac6d6c1436399fbc1d8dfd054.tar.bz2
samba-579c13da43d5b40ac6d6c1436399fbc1d8dfd054.zip
r873: converted samba4 to use real 64 bit integers instead of
structures. This was suggested by metze recently. I checked on the build farm and all the machines we have support 64 bit ints, and support the LL suffix for 64 bit constants. I suspect some won't support strtoll() and related functions, so we will probably need replacements for those. (This used to be commit 9a9244a1c66654c12abe4379661cba83a73c4c21)
Diffstat (limited to 'source4/lib/fsusage.c')
-rw-r--r--source4/lib/fsusage.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source4/lib/fsusage.c b/source4/lib/fsusage.c
index bb7cff0645..bff6fdda03 100644
--- a/source4/lib/fsusage.c
+++ b/source4/lib/fsusage.c
@@ -24,7 +24,7 @@
/* Return the number of TOSIZE-byte blocks used by
BLOCKS FROMSIZE-byte blocks, rounding away from zero.
*/
-static SMB_BIG_UINT adjust_blocks(SMB_BIG_UINT blocks, SMB_BIG_UINT fromsize, SMB_BIG_UINT tosize)
+static uint64_t adjust_blocks(uint64_t blocks, uint64_t fromsize, uint64_t tosize)
{
if (fromsize == tosize) /* e.g., from 512 to 512 */
return blocks;
@@ -40,10 +40,10 @@ static SMB_BIG_UINT adjust_blocks(SMB_BIG_UINT blocks, SMB_BIG_UINT fromsize, SM
results are returned in *dfree and *dsize, in 512 byte units
*/
-int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+int sys_fsusage(const char *path, uint64_t *dfree, uint64_t *dsize)
{
#ifdef STAT_STATFS3_OSF1
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_fsize, (SMB_BIG_UINT)512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_fsize, (uint64_t)512)
struct statfs fsd;
if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
@@ -51,7 +51,7 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#endif /* STAT_STATFS3_OSF1 */
#ifdef STAT_STATFS2_FS_DATA /* Ultrix */
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)1024, (SMB_BIG_UINT)512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)1024, (uint64_t)512)
struct fs_data fsd;
if (statfs (path, &fsd) != 1)
@@ -62,7 +62,7 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#endif /* STAT_STATFS2_FS_DATA */
#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_bsize, (uint64_t)512)
struct statfs fsd;
if (statfs (path, &fsd) < 0)
@@ -84,7 +84,7 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#ifdef STAT_STATFS2_FSIZE /* 4.4BSD */
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_fsize, (SMB_BIG_UINT)512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_fsize, (uint64_t)512)
struct statfs fsd;
@@ -94,12 +94,12 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
# if _AIX || defined(_CRAY)
-# define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
+# define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_bsize, (uint64_t)512)
# ifdef _CRAY
# define f_bavail f_bfree
# endif
# else
-# define CONVERT_BLOCKS(B) ((SMB_BIG_UINT)B)
+# define CONVERT_BLOCKS(B) ((uint64_t)B)
# ifndef _SEQUENT_ /* _SEQUENT_ is DYNIX/ptx */
# ifndef DOLPHIN /* DOLPHIN 3.8.alfa/7.18 has f_bavail */
# define f_bavail f_bfree
@@ -119,7 +119,7 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#if defined(STAT_STATVFS) || defined(STAT_STATVFS64) /* SVR4 */
# define CONVERT_BLOCKS(B) \
- adjust_blocks ((SMB_BIG_UINT)(B), fsd.f_frsize ? (SMB_BIG_UINT)fsd.f_frsize : (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
+ adjust_blocks ((uint64_t)(B), fsd.f_frsize ? (uint64_t)fsd.f_frsize : (uint64_t)fsd.f_bsize, (uint64_t)512)
#ifdef STAT_STATVFS64
struct statvfs64 fsd;