reusing SIGAR_NAME_IS_DEV macro

This commit is contained in:
Doug MacEachern 2008-03-16 02:21:25 +00:00
parent cf8308ad60
commit 26d071a6cb
2 changed files with 5 additions and 4 deletions

View File

@ -118,6 +118,9 @@ double sigar_file_system_usage_calc_used(sigar_t *sigar,
#define SIGAR_DEV_PREFIX "/dev/" #define SIGAR_DEV_PREFIX "/dev/"
#define SIGAR_NAME_IS_DEV(dev) \
strnEQ(dev, SIGAR_DEV_PREFIX, SSTRLEN(SIGAR_DEV_PREFIX))
typedef struct { typedef struct {
char name[256]; char name[256];
int is_partition; int is_partition;

View File

@ -307,8 +307,6 @@ int sigar_mem_calc_ram(sigar_t *sigar, sigar_mem_t *mem)
#ifndef WIN32 #ifndef WIN32
#define FSNAME_IS_DEV(dev) strnEQ(dev, SIGAR_DEV_PREFIX, 5)
sigar_iodev_t *sigar_iodev_get(sigar_t *sigar, sigar_iodev_t *sigar_iodev_get(sigar_t *sigar,
const char *dirname) const char *dirname)
{ {
@ -330,7 +328,7 @@ sigar_iodev_t *sigar_iodev_get(sigar_t *sigar,
dirname = dev_name; dirname = dev_name;
is_dev = 1; is_dev = 1;
} }
else if (FSNAME_IS_DEV(dirname)) { else if (SIGAR_NAME_IS_DEV(dirname)) {
is_dev = 1; is_dev = 1;
} }
@ -393,7 +391,7 @@ sigar_iodev_t *sigar_iodev_get(sigar_t *sigar,
continue; /* already cached */ continue; /* already cached */
} }
if (FSNAME_IS_DEV(fsp->dev_name)) { if (SIGAR_NAME_IS_DEV(fsp->dev_name)) {
sigar_iodev_t *iodev; sigar_iodev_t *iodev;
ent->value = iodev = malloc(sizeof(*iodev)); ent->value = iodev = malloc(sizeof(*iodev));
SIGAR_ZERO(iodev); SIGAR_ZERO(iodev);