set GLIBTOP_MAX_FSUSAGE properly, use gint in the headers instead of int
2004-03-15 Bastien Nocera <hadess@hadess.net> * include/glibtop/fsusage.h: set GLIBTOP_MAX_FSUSAGE properly, use gint in the headers instead of int (Closes: #125049) 2004-03-15 Bastien Nocera <hadess@hadess.net> * fsusage.c: * fsusage.h: remove use of uintmax_t
This commit is contained in:
committed by
Bastien Nocera
parent
1cffda35ec
commit
2b221cbb1f
@@ -1,3 +1,8 @@
|
|||||||
|
2004-03-15 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
* include/glibtop/fsusage.h: set GLIBTOP_MAX_FSUSAGE properly,
|
||||||
|
use gint in the headers instead of int (Closes: #125049)
|
||||||
|
|
||||||
2004-03-11 Kjartan Maraas <kmaraas@gnome.org>
|
2004-03-11 Kjartan Maraas <kmaraas@gnome.org>
|
||||||
|
|
||||||
* configure.in: Up versions etc.
|
* configure.in: Up versions etc.
|
||||||
|
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
|
|||||||
#define GLIBTOP_FSUSAGE_FFREE 4
|
#define GLIBTOP_FSUSAGE_FFREE 4
|
||||||
#define GLIBTOP_FSUSAGE_BLOCK_SIZE 6
|
#define GLIBTOP_FSUSAGE_BLOCK_SIZE 6
|
||||||
|
|
||||||
#define GLIBTOP_MAX_FSUSAGE 5
|
#define GLIBTOP_MAX_FSUSAGE 6
|
||||||
|
|
||||||
|
|
||||||
typedef struct _glibtop_fsusage glibtop_fsusage;
|
typedef struct _glibtop_fsusage glibtop_fsusage;
|
||||||
@@ -48,7 +48,7 @@ struct _glibtop_fsusage
|
|||||||
bavail, /* Free blocks available to non-superuser. */
|
bavail, /* Free blocks available to non-superuser. */
|
||||||
files, /* Total file nodes. */
|
files, /* Total file nodes. */
|
||||||
ffree; /* Free 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)
|
#define glibtop_get_fsusage(fsusage,disk) glibtop_get_fsusage_l(glibtop_global_server, fsusage, disk)
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2004-03-15 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
* fsusage.c:
|
||||||
|
* fsusage.h: remove use of uintmax_t
|
||||||
|
|
||||||
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
* fsusage.c: fix build (we don't have "full-read.h" here)
|
* fsusage.c: fix build (we don't have "full-read.h" here)
|
||||||
|
@@ -20,17 +20,6 @@
|
|||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_INTTYPES_H
|
|
||||||
# include <inttypes.h>
|
|
||||||
#else
|
|
||||||
# if HAVE_STDINT_H
|
|
||||||
# include <stdint.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifndef UINTMAX_MAX
|
|
||||||
# define UINTMAX_MAX ((uintmax_t) -1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "fsusage.h"
|
#include "fsusage.h"
|
||||||
@@ -81,23 +70,23 @@ int statvfs ();
|
|||||||
|
|
||||||
/* Many space usage primitives use all 1 bits to denote a value that is
|
/* Many space usage primitives use all 1 bits to denote a value that is
|
||||||
not applicable or unknown. Propagate this information by returning
|
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
|
a guint64 value that is all 1 bits if X is all 1 bits, even if X
|
||||||
is unsigned and narrower than uintmax_t. */
|
is unsigned and narrower than guint64. */
|
||||||
#define PROPAGATE_ALL_ONES(x) \
|
#define PROPAGATE_ALL_ONES(x) \
|
||||||
((sizeof (x) < sizeof (uintmax_t) \
|
((sizeof (x) < sizeof (guint64) \
|
||||||
&& (~ (x) == (sizeof (x) < sizeof (int) \
|
&& (~ (x) == (sizeof (x) < sizeof (int) \
|
||||||
? - (1 << (sizeof (x) * CHAR_BIT)) \
|
? - (1 << (sizeof (x) * CHAR_BIT)) \
|
||||||
: 0))) \
|
: 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) \
|
#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
|
/* 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.
|
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
|
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.
|
the original value. If X's top bit is clear, just yield X.
|
||||||
Use PROPAGATE_TOP_BIT if the original value might be negative;
|
Use PROPAGATE_TOP_BIT if the original value might be negative;
|
||||||
otherwise, use PROPAGATE_ALL_ONES. */
|
otherwise, use PROPAGATE_ALL_ONES. */
|
||||||
|
@@ -17,18 +17,20 @@
|
|||||||
|
|
||||||
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
|
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
#if !defined FSUSAGE_H_
|
#if !defined FSUSAGE_H_
|
||||||
# define FSUSAGE_H_
|
# define FSUSAGE_H_
|
||||||
|
|
||||||
struct fs_usage
|
struct fs_usage
|
||||||
{
|
{
|
||||||
int fsu_blocksize; /* Size of a block. */
|
int fsu_blocksize; /* Size of a block. */
|
||||||
uintmax_t fsu_blocks; /* Total blocks. */
|
guint64 fsu_blocks; /* Total blocks. */
|
||||||
uintmax_t fsu_bfree; /* Free blocks available to superuser. */
|
guint64 fsu_bfree; /* Free blocks available to superuser. */
|
||||||
uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */
|
guint64 fsu_bavail; /* Free blocks available to non-superuser. */
|
||||||
int fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */
|
int fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */
|
||||||
uintmax_t fsu_files; /* Total file nodes. */
|
guint64 fsu_files; /* Total file nodes. */
|
||||||
uintmax_t fsu_ffree; /* Free file nodes. */
|
guint64 fsu_ffree; /* Free file nodes. */
|
||||||
};
|
};
|
||||||
|
|
||||||
# ifndef PARAMS
|
# ifndef PARAMS
|
||||||
|
Reference in New Issue
Block a user