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 #3156 from rpv-tomsk/dns
[collectd.git]
/
src
/
nfs.c
diff --git
a/src/nfs.c
b/src/nfs.c
index
b556307
..
320caa4
100644
(file)
--- a/
src/nfs.c
+++ b/
src/nfs.c
@@
-24,8
+24,8
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#if HAVE_KSTAT_H
#include <kstat.h>
#if HAVE_KSTAT_H
#include <kstat.h>
@@
-33,9
+33,9
@@
static const char *config_keys[] = {"ReportV2", "ReportV3", "ReportV4"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
static const char *config_keys[] = {"ReportV2", "ReportV3", "ReportV4"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static
_Bool report_v2 = 1
;
-static
_Bool report_v3 = 1
;
-static
_Bool report_v4 = 1
;
+static
bool report_v2 = true
;
+static
bool report_v3 = true
;
+static
bool report_v4 = true
;
/*
see /proc/net/rpc/nfs
/*
see /proc/net/rpc/nfs
@@
-397,7
+397,7
@@
static int nfs_submit_fields_safe(int nfs_version, const char *instance,
size_t proc_names_num) {
if (fields_num != proc_names_num) {
WARNING("nfs plugin: Wrong number of fields for "
size_t proc_names_num) {
if (fields_num != proc_names_num) {
WARNING("nfs plugin: Wrong number of fields for "
- "NFSv%i %s statistics. Expected %
zu, got %zu
.",
+ "NFSv%i %s statistics. Expected %
" PRIsz ", got %" PRIsz "
.",
nfs_version, instance, proc_names_num, fields_num);
return EINVAL;
}
nfs_version, instance, proc_names_num, fields_num);
return EINVAL;
}
@@
-409,7
+409,7
@@
static int nfs_submit_fields_safe(int nfs_version, const char *instance,
static int nfs_submit_nfs4_server(const char *instance, char **fields,
size_t fields_num) {
static int nfs_submit_nfs4_server(const char *instance, char **fields,
size_t fields_num) {
- static int suppress_warning
= 0
;
+ static int suppress_warning;
size_t proc4x_names_num;
switch (fields_num) {
size_t proc4x_names_num;
switch (fields_num) {
@@
-421,7
+421,7
@@
static int nfs_submit_nfs4_server(const char *instance, char **fields,
default:
if (!suppress_warning) {
WARNING("nfs plugin: Unexpected number of fields for "
default:
if (!suppress_warning) {
WARNING("nfs plugin: Unexpected number of fields for "
- "NFSv4 %s statistics: %
zu
. ",
+ "NFSv4 %s statistics: %
" PRIsz "
. ",
instance, fields_num);
}
instance, fields_num);
}
@@
-451,7
+451,7
@@
static int nfs_submit_nfs4_client(const char *instance, char **fields,
size_t fields_num) {
size_t proc40_names_num, proc4x_names_num;
size_t fields_num) {
size_t proc40_names_num, proc4x_names_num;
- static int suppress_warning
= 0
;
+ static int suppress_warning;
switch (fields_num) {
case 34:
switch (fields_num) {
case 34:
@@
-486,9
+486,8
@@
static int nfs_submit_nfs4_client(const char *instance, char **fields,
break;
default:
if (!suppress_warning) {
break;
default:
if (!suppress_warning) {
- WARNING("nfs plugin: Unexpected number of "
- "fields for NFSv4 %s "
- "statistics: %zu. ",
+ WARNING("nfs plugin: Unexpected number of fields for NFSv4 %s "
+ "statistics: %" PRIsz ". ",
instance, fields_num);
}
instance, fields_num);
}
@@
-520,7
+519,8
@@
static int nfs_submit_nfs4_client(const char *instance, char **fields,
static void nfs_read_linux(FILE *fh, const char *inst) {
char buffer[1024];
static void nfs_read_linux(FILE *fh, const char *inst) {
char buffer[1024];
- char *fields[64];
+ // The stats line is prefixed with type and number of fields, thus plus 2
+ char *fields[MAX(NFS4_SERVER_MAX_PROC, NFS4_CLIENT_MAX_PROC) + 2];
int fields_num = 0;
if (fh == NULL)
int fields_num = 0;
if (fh == NULL)