projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3148 from rpv-tomsk/libvirt-1
[collectd.git]
/
src
/
md.c
diff --git
a/src/md.c
b/src/md.c
index
98cef1d
..
643dabd
100644
(file)
--- a/
src/md.c
+++ b/
src/md.c
@@
-21,9
+21,9
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
-#include "utils_ignorelist.h"
+#include "utils/common/common.h"
+#include "utils/ignorelist/ignorelist.h"
#include <sys/ioctl.h>
#include <sys/ioctl.h>
@@
-40,7
+40,7
@@
static const char *config_keys[] = {"Device", "IgnoreSelected"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
static const char *config_keys[] = {"Device", "IgnoreSelected"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static ignorelist_t *ignorelist
= NULL
;
+static ignorelist_t *ignorelist;
static int md_config(const char *key, const char *value) {
if (ignorelist == NULL)
static int md_config(const char *key, const char *value) {
if (ignorelist == NULL)
@@
-66,7
+66,7
@@
static void md_submit(const int minor, const char *type_instance,
vl.values = &(value_t){.gauge = value};
vl.values_len = 1;
sstrncpy(vl.plugin, "md", sizeof(vl.plugin));
vl.values = &(value_t){.gauge = value};
vl.values_len = 1;
sstrncpy(vl.plugin, "md", sizeof(vl.plugin));
- s
s
nprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", minor);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", minor);
sstrncpy(vl.type, "md_disks", sizeof(vl.type));
sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
sstrncpy(vl.type, "md_disks", sizeof(vl.type));
sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
@@
-74,7
+74,6
@@
static void md_submit(const int minor, const char *type_instance,
} /* void md_submit */
static void md_process(const int minor, const char *path) {
} /* void md_submit */
static void md_process(const int minor, const char *path) {
- char errbuf[1024];
int fd;
struct stat st;
mdu_array_info_t array;
int fd;
struct stat st;
mdu_array_info_t array;
@@
-82,13
+81,12
@@
static void md_process(const int minor, const char *path) {
fd = open(path, O_RDONLY);
if (fd < 0) {
fd = open(path, O_RDONLY);
if (fd < 0) {
- WARNING("md: open(%s): %s", path,
sstrerror(errno, errbuf, sizeof(errbuf))
);
+ WARNING("md: open(%s): %s", path,
STRERRNO
);
return;
}
if (fstat(fd, &st) < 0) {
return;
}
if (fstat(fd, &st) < 0) {
- WARNING("md: Unable to fstat file descriptor for %s: %s", path,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("md: Unable to fstat file descriptor for %s: %s", path, STRERRNO);
close(fd);
return;
}
close(fd);
return;
}
@@
-109,8
+107,7
@@
static void md_process(const int minor, const char *path) {
/* Retrieve md information */
if (ioctl(fd, GET_ARRAY_INFO, &array) < 0) {
/* Retrieve md information */
if (ioctl(fd, GET_ARRAY_INFO, &array) < 0) {
- WARNING("md: Unable to retrieve array info from %s: %s", path,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("md: Unable to retrieve array info from %s: %s", path, STRERRNO);
close(fd);
return;
}
close(fd);
return;
}
@@
-146,9
+143,7
@@
static int md_read(void) {
fh = fopen(PROC_DISKSTATS, "r");
if (fh == NULL) {
fh = fopen(PROC_DISKSTATS, "r");
if (fh == NULL) {
- char errbuf[1024];
- WARNING("md: Unable to open %s: %s", PROC_DISKSTATS,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("md: Unable to open %s: %s", PROC_DISKSTATS, STRERRNO);
return -1;
}
return -1;
}
@@
-180,7
+175,7
@@
static int md_read(void) {
* major/minor, but that again can be tricky if the filesystem
* with the device file is mounted using the "nodev" option.
*/
* major/minor, but that again can be tricky if the filesystem
* with the device file is mounted using the "nodev" option.
*/
- s
s
nprintf(path, sizeof(path), "%s/%s", DEV_DIR, name);
+ snprintf(path, sizeof(path), "%s/%s", DEV_DIR, name);
md_process(minor, path);
}
md_process(minor, path);
}