summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 946aff0)
raw | patch | inline | side by side (parent: 946aff0)
author | Deyan Chepishev <dchepishev@superhosting.bg> | |
Fri, 28 Oct 2016 08:31:19 +0000 (11:31 +0300) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 28 Oct 2016 11:40:58 +0000 (13:40 +0200) |
src/virt.c | patch | blob | history |
diff --git a/src/virt.c b/src/virt.c
index 416383f391dab103da71d513d8aaf460d3c91799..ef55414528b5b88bc16da8cbf1f8158ab9dfef5a 100644 (file)
--- a/src/virt.c
+++ b/src/virt.c
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libgen.h>
-#include <stdbool.h>
/* Plugin name */
#define PLUGIN_NAME "virt"
};
/* BlockDeviceFormatBasename */
-_Bool blockdevice_format_basename = false;
+_Bool blockdevice_format_basename = 0;
static enum bd_field blockdevice_format = target;
static enum if_field interface_format = if_name;
}
if (strcasecmp (key, "BlockDeviceFormatBasename") == 0) {
if (strcasecmp (value, "true") == 0)
- blockdevice_format_basename = true;
+ blockdevice_format_basename = 1;
else if (strcasecmp (value, "false") == 0)
- blockdevice_format_basename = false;
+ blockdevice_format_basename = 0;
else {
ERROR (PLUGIN_NAME " plugin: unknown BlockDeviceFormatBasename: %s", value);
return -1;
continue;
char *type_instance = NULL;
- if( blockdevice_format_basename && blockdevice_format == source ) //valid only if we use "source" (full path to the device)
- {
+ if (blockdevice_format_basename && blockdevice_format == source)
type_instance = strdup(basename(block_devices[i].path));
- }
else
- {
type_instance = strdup(block_devices[i].path);
- }
if ((stats.rd_req != -1) && (stats.wr_req != -1))
submit_derive2 ("disk_ops",
(derive_t) stats.rd_req, (derive_t) stats.wr_req,
xpath_ctx = xmlXPathNewContext (xml_doc);
/* Block devices. */
- char * bd_xmlpath = "/domain/devices/disk/target[@dev]"; //the default behavior
- if( blockdevice_format == source )
- {
+ char *bd_xmlpath = "/domain/devices/disk/target[@dev]";
+ if (blockdevice_format == source)
bd_xmlpath = "/domain/devices/disk/source[@dev]";
- }
xpath_obj = xmlXPathEval ((xmlChar *) bd_xmlpath, xpath_ctx);
if (xpath_obj == NULL || xpath_obj->type != XPATH_NODESET ||