From 4746f79d50d804b0e9d5d5cc0d4796dee54d052c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Oct 2008 01:59:36 +0200 Subject: Use {u,}int64_t instead of SMB_BIG_{U,}INT. --- source3/lib/fsusage.c | 20 +++++++++--------- source3/lib/select.c | 2 +- source3/lib/smbldap.c | 2 +- source3/lib/sysquotas_4A.c | 16 +++++++-------- source3/lib/sysquotas_linux.c | 48 +++++++++++++++++++++---------------------- source3/lib/sysquotas_xfs.c | 16 +++++++-------- source3/lib/util_str.c | 10 +++------ 7 files changed, 55 insertions(+), 59 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/fsusage.c b/source3/lib/fsusage.c index 66ffb9f442..43eb84705b 100644 --- a/source3/lib/fsusage.c +++ b/source3/lib/fsusage.c @@ -23,7 +23,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; @@ -44,10 +44,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) @@ -55,7 +55,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) @@ -66,7 +66,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) @@ -88,7 +88,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; @@ -98,12 +98,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 @@ -124,10 +124,10 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) #if defined(STAT_STATVFS) || defined(STAT_STATVFS64) /* SVR4 */ #if defined HAVE_FRSIZE # 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) #else # define CONVERT_BLOCKS(B) \ - adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512) + adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_bsize, (uint64_t)512) #endif #ifdef STAT_STATVFS64 diff --git a/source3/lib/select.c b/source3/lib/select.c index c3da6a9bba..1bb1a75909 100644 --- a/source3/lib/select.c +++ b/source3/lib/select.c @@ -161,7 +161,7 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf errorfds_buf = *errorfds; if (ptval && (errno == EINTR)) { struct timeval now_time; - SMB_BIG_INT tdif; + int64_t tdif; GetTimeOfDay(&now_time); tdif = usec_time_diff(&end_time, &now_time); diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index 93494d6dad..f5e152bb95 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -1211,7 +1211,7 @@ static int smbldap_search_ext(struct smbldap_state *ldap_state, if (ldap_state->last_rebind.tv_sec > 0) { struct timeval tval; - SMB_BIG_INT tdiff = 0; + int64_t tdiff = 0; int sleep_time = 0; ZERO_STRUCT(tval); diff --git a/source3/lib/sysquotas_4A.c b/source3/lib/sysquotas_4A.c index f185bba6df..8a1b12238c 100644 --- a/source3/lib/sysquotas_4A.c +++ b/source3/lib/sysquotas_4A.c @@ -89,7 +89,7 @@ int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt int ret = -1; uint32 qflags = 0; struct dqblk D; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; + uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE; ZERO_STRUCT(D); ZERO_STRUCT(*dp); @@ -162,12 +162,12 @@ int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt } dp->bsize = bsize; - dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit; - dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit; - dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit; - dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit; - dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes; - dp->curblocks = (SMB_BIG_UINT)D.dqb_curblocks; + dp->softlimit = (uint64_t)D.dqb_bsoftlimit; + dp->hardlimit = (uint64_t)D.dqb_bhardlimit; + dp->ihardlimit = (uint64_t)D.dqb_ihardlimit; + dp->isoftlimit = (uint64_t)D.dqb_isoftlimit; + dp->curinodes = (uint64_t)D.dqb_curinodes; + dp->curblocks = (uint64_t)D.dqb_curblocks; dp->qflags = qflags; @@ -184,7 +184,7 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt uint32 qflags = 0; uint32 oldqflags = 0; struct dqblk D; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; + uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE; ZERO_STRUCT(D); diff --git a/source3/lib/sysquotas_linux.c b/source3/lib/sysquotas_linux.c index f9a0464086..5720328764 100644 --- a/source3/lib/sysquotas_linux.c +++ b/source3/lib/sysquotas_linux.c @@ -41,7 +41,7 @@ static int sys_get_linux_v1_quota(const char *path, const char *bdev, enum SMB_Q int ret = -1; uint32 qflags = 0; struct v1_kern_dqblk D; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; + uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE; ZERO_STRUCT(D); @@ -88,12 +88,12 @@ static int sys_get_linux_v1_quota(const char *path, const char *bdev, enum SMB_Q } dp->bsize = bsize; - dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit; - dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit; - dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit; - dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit; - dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes; - dp->curblocks = (SMB_BIG_UINT)D.dqb_curblocks; + dp->softlimit = (uint64_t)D.dqb_bsoftlimit; + dp->hardlimit = (uint64_t)D.dqb_bhardlimit; + dp->ihardlimit = (uint64_t)D.dqb_ihardlimit; + dp->isoftlimit = (uint64_t)D.dqb_isoftlimit; + dp->curinodes = (uint64_t)D.dqb_curinodes; + dp->curblocks = (uint64_t)D.dqb_curblocks; dp->qflags = qflags; @@ -110,7 +110,7 @@ static int sys_set_linux_v1_quota(const char *path, const char *bdev, enum SMB_Q uint32 qflags = 0; uint32 oldqflags = 0; struct v1_kern_dqblk D; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; + uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE; ZERO_STRUCT(D); @@ -175,7 +175,7 @@ static int sys_get_linux_v2_quota(const char *path, const char *bdev, enum SMB_Q int ret = -1; uint32 qflags = 0; struct v2_kern_dqblk D; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; + uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE; ZERO_STRUCT(D); @@ -222,12 +222,12 @@ static int sys_get_linux_v2_quota(const char *path, const char *bdev, enum SMB_Q } dp->bsize = bsize; - dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit; - dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit; - dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit; - dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit; - dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes; - dp->curblocks = (SMB_BIG_UINT)D.dqb_curspace/bsize; + dp->softlimit = (uint64_t)D.dqb_bsoftlimit; + dp->hardlimit = (uint64_t)D.dqb_bhardlimit; + dp->ihardlimit = (uint64_t)D.dqb_ihardlimit; + dp->isoftlimit = (uint64_t)D.dqb_isoftlimit; + dp->curinodes = (uint64_t)D.dqb_curinodes; + dp->curblocks = (uint64_t)D.dqb_curspace/bsize; dp->qflags = qflags; @@ -244,7 +244,7 @@ static int sys_set_linux_v2_quota(const char *path, const char *bdev, enum SMB_Q uint32 qflags = 0; uint32 oldqflags = 0; struct v2_kern_dqblk D; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; + uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE; ZERO_STRUCT(D); @@ -309,7 +309,7 @@ static int sys_get_linux_gen_quota(const char *path, const char *bdev, enum SMB_ int ret = -1; uint32 qflags = 0; struct if_dqblk D; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; + uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE; ZERO_STRUCT(D); @@ -356,12 +356,12 @@ static int sys_get_linux_gen_quota(const char *path, const char *bdev, enum SMB_ } dp->bsize = bsize; - dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit; - dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit; - dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit; - dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit; - dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes; - dp->curblocks = (SMB_BIG_UINT)D.dqb_curspace/bsize; + dp->softlimit = (uint64_t)D.dqb_bsoftlimit; + dp->hardlimit = (uint64_t)D.dqb_bhardlimit; + dp->ihardlimit = (uint64_t)D.dqb_ihardlimit; + dp->isoftlimit = (uint64_t)D.dqb_isoftlimit; + dp->curinodes = (uint64_t)D.dqb_curinodes; + dp->curblocks = (uint64_t)D.dqb_curspace/bsize; dp->qflags = qflags; @@ -378,7 +378,7 @@ static int sys_set_linux_gen_quota(const char *path, const char *bdev, enum SMB_ uint32 qflags = 0; uint32 oldqflags = 0; struct if_dqblk D; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE; + uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE; ZERO_STRUCT(D); diff --git a/source3/lib/sysquotas_xfs.c b/source3/lib/sysquotas_xfs.c index 30538c167b..1e438e9a6d 100644 --- a/source3/lib/sysquotas_xfs.c +++ b/source3/lib/sysquotas_xfs.c @@ -76,7 +76,7 @@ int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt { int ret = -1; uint32 qflags = 0; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)BBSIZE; + uint64_t bsize = (uint64_t)BBSIZE; struct fs_disk_quota D; struct fs_quota_stat F; ZERO_STRUCT(D); @@ -145,12 +145,12 @@ int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt } dp->bsize = bsize; - dp->softlimit = (SMB_BIG_UINT)D.d_blk_softlimit; - dp->hardlimit = (SMB_BIG_UINT)D.d_blk_hardlimit; - dp->ihardlimit = (SMB_BIG_UINT)D.d_ino_hardlimit; - dp->isoftlimit = (SMB_BIG_UINT)D.d_ino_softlimit; - dp->curinodes = (SMB_BIG_UINT)D.d_icount; - dp->curblocks = (SMB_BIG_UINT)D.d_bcount; + dp->softlimit = (uint64_t)D.d_blk_softlimit; + dp->hardlimit = (uint64_t)D.d_blk_hardlimit; + dp->ihardlimit = (uint64_t)D.d_ino_hardlimit; + dp->isoftlimit = (uint64_t)D.d_ino_softlimit; + dp->curinodes = (uint64_t)D.d_icount; + dp->curblocks = (uint64_t)D.d_bcount; dp->qflags = qflags; return ret; @@ -163,7 +163,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt { int ret = -1; uint32 qflags = 0; - SMB_BIG_UINT bsize = (SMB_BIG_UINT)BBSIZE; + uint64_t bsize = (uint64_t)BBSIZE; struct fs_disk_quota D; struct fs_quota_stat F; int q_on = 0; diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index b0a7cb072d..5d1893a85b 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -2279,10 +2279,10 @@ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data) } /* read a SMB_BIG_UINT from a string */ -SMB_BIG_UINT STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr) +uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr) { - SMB_BIG_UINT val = -1; + uint64_t val = -1; const char *p = nptr; if (!p) { @@ -2295,11 +2295,7 @@ SMB_BIG_UINT STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr) while (*p && isspace(*p)) p++; -#ifdef LARGE_SMB_OFF_T - sscanf(p,"%llu",&val); -#else /* LARGE_SMB_OFF_T */ - sscanf(p,"%lu",&val); -#endif /* LARGE_SMB_OFF_T */ + sscanf(p,"%"PRIu64,&val); if (entptr) { while (*p && isdigit(*p)) p++; -- cgit