/* #endif HAVE_LIBKSTAT */
#elif defined(HAVE_LIBSTATGRAB)
-/* #endif HAVE_LIBKSTATGRAB */
+/* #endif HAVE_LIBSTATGRAB */
#elif HAVE_PERFSTAT
static perfstat_disk_t *stat_disk;
#error "No applicable input method."
#endif
-#if HAVE_LIBUDEV
+#if HAVE_UDEV_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_LIBUDEV
+#if HAVE_UDEV_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_LIBUDEV
+#if HAVE_UDEV_H
if (conf_udev_name_attr != NULL) {
handle_udev = udev_new();
if (handle_udev == NULL) {
return (-1);
}
}
-#endif /* HAVE_LIBUDEV */
+#endif /* HAVE_UDEV_H */
/* #endif KERNEL_LINUX */
#elif KERNEL_FREEBSD
static int disk_shutdown(void) {
#if KERNEL_LINUX
-#if HAVE_LIBUDEV
+#if HAVE_UDEV_H
if (handle_udev != NULL)
udev_unref(handle_udev);
-#endif /* HAVE_LIBUDEV */
+#endif /* HAVE_UDEV_H */
#endif /* KERNEL_LINUX */
return (0);
} /* int disk_shutdown */
static void disk_submit(const char *plugin_instance, const char *type,
derive_t read, derive_t write) {
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = read;
- values[1].derive = write;
+ value_t values[] = {
+ {.derive = read}, {.derive = write},
+ };
vl.values = values;
- vl.values_len = 2;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
+ vl.values_len = STATIC_ARRAY_SIZE(values);
sstrncpy(vl.plugin, "disk", sizeof(vl.plugin));
sstrncpy(vl.plugin_instance, plugin_instance, sizeof(vl.plugin_instance));
sstrncpy(vl.type, type, sizeof(vl.type));
#if KERNEL_FREEBSD || KERNEL_LINUX
static void submit_io_time(char const *plugin_instance, derive_t io_time,
derive_t weighted_time) {
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = io_time;
- values[1].derive = weighted_time;
+ value_t values[] = {
+ {.derive = io_time}, {.derive = weighted_time},
+ };
vl.values = values;
- vl.values_len = 2;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
+ vl.values_len = STATIC_ARRAY_SIZE(values);
sstrncpy(vl.plugin, "disk", sizeof(vl.plugin));
sstrncpy(vl.plugin_instance, plugin_instance, sizeof(vl.plugin_instance));
sstrncpy(vl.type, "disk_io_time", sizeof(vl.type));
#if KERNEL_LINUX
static void submit_in_progress(char const *disk_name, gauge_t in_progress) {
- value_t v;
value_list_t vl = VALUE_LIST_INIT;
- v.gauge = in_progress;
-
- vl.values = &v;
+ vl.values = &(value_t){.gauge = in_progress};
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "disk", sizeof(vl.plugin));
sstrncpy(vl.plugin_instance, disk_name, sizeof(vl.plugin_instance));
sstrncpy(vl.type, "pending_operations", sizeof(vl.type));
}
#endif
-#if HAVE_LIBUDEV
+#if HAVE_UDEV_H
/**
* Attempt to provide an rename disk instance from an assigned udev attribute.
*
output_name = disk_name;
-#if HAVE_LIBUDEV
+#if HAVE_UDEV_H
char *alt_name = NULL;
if (conf_udev_name_attr != NULL) {
alt_name =
#endif
if (ignorelist_match(ignorelist, output_name) != 0) {
-#if HAVE_LIBUDEV
+#if HAVE_UDEV_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_LIBUDEV
+#if HAVE_UDEV_H
/* release udev-based alternate name, if allocated */
sfree(alt_name);
#endif