From 2b221cbb1f9384a2920c0c75d68247b96e7a6af3 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 16 Mar 2004 10:10:41 +0000 Subject: [PATCH] set GLIBTOP_MAX_FSUSAGE properly, use gint in the headers instead of int 2004-03-15 Bastien Nocera * include/glibtop/fsusage.h: set GLIBTOP_MAX_FSUSAGE properly, use gint in the headers instead of int (Closes: #125049) 2004-03-15 Bastien Nocera * fsusage.c: * fsusage.h: remove use of uintmax_t --- ChangeLog | 5 +++++ include/glibtop/fsusage.h | 4 ++-- sysdeps/common/ChangeLog | 5 +++++ sysdeps/common/fsusage.c | 25 +++++++------------------ sysdeps/common/fsusage.h | 12 +++++++----- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40eac863..4f87ec5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-03-15 Bastien Nocera + + * include/glibtop/fsusage.h: set GLIBTOP_MAX_FSUSAGE properly, + use gint in the headers instead of int (Closes: #125049) + 2004-03-11 Kjartan Maraas * configure.in: Up versions etc. diff --git a/include/glibtop/fsusage.h b/include/glibtop/fsusage.h index fea3ecf3..7691c6bf 100644 --- a/include/glibtop/fsusage.h +++ b/include/glibtop/fsusage.h @@ -35,7 +35,7 @@ G_BEGIN_DECLS #define GLIBTOP_FSUSAGE_FFREE 4 #define GLIBTOP_FSUSAGE_BLOCK_SIZE 6 -#define GLIBTOP_MAX_FSUSAGE 5 +#define GLIBTOP_MAX_FSUSAGE 6 typedef struct _glibtop_fsusage glibtop_fsusage; @@ -48,7 +48,7 @@ struct _glibtop_fsusage bavail, /* Free blocks available to non-superuser. */ files, /* Total file nodes. */ ffree; /* Free file nodes. */ - int block_size; /* Size of a block in bytes. */ + gint block_size; /* Size of a block in bytes. */ }; #define glibtop_get_fsusage(fsusage,disk) glibtop_get_fsusage_l(glibtop_global_server, fsusage, disk) diff --git a/sysdeps/common/ChangeLog b/sysdeps/common/ChangeLog index cc999a80..1f413790 100644 --- a/sysdeps/common/ChangeLog +++ b/sysdeps/common/ChangeLog @@ -1,3 +1,8 @@ +2004-03-15 Bastien Nocera + + * fsusage.c: + * fsusage.h: remove use of uintmax_t + 2004-03-09 Bastien Nocera * fsusage.c: fix build (we don't have "full-read.h" here) diff --git a/sysdeps/common/fsusage.c b/sysdeps/common/fsusage.c index 7ef917a8..ca52b5f3 100644 --- a/sysdeps/common/fsusage.c +++ b/sysdeps/common/fsusage.c @@ -20,17 +20,6 @@ # include #endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#ifndef UINTMAX_MAX -# define UINTMAX_MAX ((uintmax_t) -1) -#endif - #include #include #include "fsusage.h" @@ -81,23 +70,23 @@ int statvfs (); /* Many space usage primitives use all 1 bits to denote a value that is not applicable or unknown. Propagate this information by returning - a uintmax_t value that is all 1 bits if X is all 1 bits, even if X - is unsigned and narrower than uintmax_t. */ + a guint64 value that is all 1 bits if X is all 1 bits, even if X + is unsigned and narrower than guint64. */ #define PROPAGATE_ALL_ONES(x) \ - ((sizeof (x) < sizeof (uintmax_t) \ + ((sizeof (x) < sizeof (guint64) \ && (~ (x) == (sizeof (x) < sizeof (int) \ ? - (1 << (sizeof (x) * CHAR_BIT)) \ : 0))) \ - ? UINTMAX_MAX : (x)) + ? G_MAXUINT64 : (x)) -/* Extract the top bit of X as an uintmax_t value. */ +/* Extract the top bit of X as an guint64 value. */ #define EXTRACT_TOP_BIT(x) ((x) \ - & ((uintmax_t) 1 << (sizeof (x) * CHAR_BIT - 1))) + & ((guint64) 1 << (sizeof (x) * CHAR_BIT - 1))) /* If a value is negative, many space usage primitives store it into an integer variable by assignment, even if the variable's type is unsigned. So, if a space usage variable X's top bit is set, convert X to the - uintmax_t value V such that (- (uintmax_t) V) is the negative of + guint64 value V such that (- (guint64) V) is the negative of the original value. If X's top bit is clear, just yield X. Use PROPAGATE_TOP_BIT if the original value might be negative; otherwise, use PROPAGATE_ALL_ONES. */ diff --git a/sysdeps/common/fsusage.h b/sysdeps/common/fsusage.h index b3390631..845f60dd 100644 --- a/sysdeps/common/fsusage.h +++ b/sysdeps/common/fsusage.h @@ -17,18 +17,20 @@ /* Space usage statistics for a filesystem. Blocks are 512-byte. */ +#include + #if !defined FSUSAGE_H_ # define FSUSAGE_H_ struct fs_usage { int fsu_blocksize; /* Size of a block. */ - uintmax_t fsu_blocks; /* Total blocks. */ - uintmax_t fsu_bfree; /* Free blocks available to superuser. */ - uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */ + guint64 fsu_blocks; /* Total blocks. */ + guint64 fsu_bfree; /* Free blocks available to superuser. */ + guint64 fsu_bavail; /* Free blocks available to non-superuser. */ int fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */ - uintmax_t fsu_files; /* Total file nodes. */ - uintmax_t fsu_ffree; /* Free file nodes. */ + guint64 fsu_files; /* Total file nodes. */ + guint64 fsu_ffree; /* Free file nodes. */ }; # ifndef PARAMS