static mach_port_t io_master_port = MACH_PORT_NULL;
/* This defaults to false for backwards compatibility. Please fix in the next
* major version. */
-static _Bool use_bsd_name = 0;
+static bool use_bsd_name;
/* #endif HAVE_IOKIT_IOKITLIB_H */
#elif KERNEL_LINUX
derive_t avg_read_time;
derive_t avg_write_time;
- _Bool has_merged;
- _Bool has_in_progress;
- _Bool has_io_time;
+ bool has_merged;
+ bool has_in_progress;
+ bool has_io_time;
struct diskstats *next;
} diskstats_t;
/* #endif KERNEL_FREEBSD */
#elif HAVE_LIBKSTAT
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
#define MAX_NUMDISK 1024
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMDISK];
#error "No applicable input method."
#endif
-#if HAVE_UDEV_H
+#if HAVE_LIBUDEV_H
#include <libudev.h>
static char *conf_udev_name_attr = NULL;
"on Mach / Mac OS X and will be ignored.");
#endif
} else if (strcasecmp("UdevNameAttr", key) == 0) {
-#if HAVE_UDEV_H
+#if HAVE_LIBUDEV_H
if (conf_udev_name_attr != NULL) {
free(conf_udev_name_attr);
conf_udev_name_attr = NULL;
/* #endif HAVE_IOKIT_IOKITLIB_H */
#elif KERNEL_LINUX
-#if HAVE_UDEV_H
+#if HAVE_LIBUDEV_H
if (conf_udev_name_attr != NULL) {
handle_udev = udev_new();
if (handle_udev == NULL) {
return -1;
}
}
-#endif /* HAVE_UDEV_H */
+#endif /* HAVE_LIBUDEV_H */
/* #endif KERNEL_LINUX */
#elif KERNEL_FREEBSD
static int disk_shutdown(void) {
#if KERNEL_LINUX
-#if HAVE_UDEV_H
+#if HAVE_LIBUDEV_H
if (handle_udev != NULL)
udev_unref(handle_udev);
-#endif /* HAVE_UDEV_H */
+#endif /* HAVE_LIBUDEV_H */
#endif /* KERNEL_LINUX */
return 0;
} /* int disk_shutdown */
}
#endif
-#if HAVE_UDEV_H
+#if HAVE_LIBUDEV_H
/**
* Attempt to provide an rename disk instance from an assigned udev attribute.
*
/* Get the list of all disk objects. */
if (IOServiceGetMatchingServices(
- io_master_port, IOServiceMatching(kIOBlockStorageDriverClass),
- &disk_list) != kIOReturnSuccess) {
+ io_master_port, IOServiceMatching(kIOBlockStorageDriverClass),
+ &disk_list) != kIOReturnSuccess) {
ERROR("disk plugin: IOServiceGetMatchingServices failed.");
return -1;
}
sstrncpy(disk_name, props_disk_name_bsd, sizeof(disk_name));
else {
ERROR("disk plugin: can't find bsd disk name.");
- snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major,
- disk_minor);
+ snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
}
} else
snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
output_name = disk_name;
-#if HAVE_UDEV_H
+#if HAVE_LIBUDEV_H
char *alt_name = NULL;
if (conf_udev_name_attr != NULL) {
alt_name =
#endif
if (ignorelist_match(ignorelist, output_name) != 0) {
-#if HAVE_UDEV_H
+#if HAVE_LIBUDEV_H
/* release udev-based alternate name, if allocated */
sfree(alt_name);
#endif
submit_io_time(output_name, io_time, weighted_time);
} /* if (is_disk) */
-#if HAVE_UDEV_H
+#if HAVE_LIBUDEV_H
/* release udev-based alternate name, if allocated */
sfree(alt_name);
#endif
int rnumdisk;
if ((numdisk = perfstat_disk(NULL, NULL, sizeof(perfstat_disk_t), 0)) < 0) {
- char errbuf[1024];
- WARNING("disk plugin: perfstat_disk: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("disk plugin: perfstat_disk: %s", STRERRNO);
return -1;
}
firstpath.name[0] = '\0';
if ((rnumdisk = perfstat_disk(&firstpath, stat_disk, sizeof(perfstat_disk_t),
numdisk)) < 0) {
- char errbuf[1024];
- WARNING("disk plugin: perfstat_disk : %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("disk plugin: perfstat_disk : %s", STRERRNO);
return -1;
}