X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnfs.c;h=c128c8173fea1a494333da877765ab8f9bf208fb;hb=3d74a63ae43c1786eb9b966e2209c24c5643dae8;hp=0948bc79a6534f23a39c2d305b3b4869d0cd5204;hpb=10b10a6718dbb87c6890d4bc821a6e21c8b7b527;p=collectd.git diff --git a/src/nfs.c b/src/nfs.c index 0948bc79..c128c817 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -23,6 +23,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" @@ -345,8 +346,6 @@ static int nfs_init (void) #elif HAVE_LIBKSTAT static int nfs_init (void) { - kstat_t *ksp_chain = NULL; - nfs2_ksp_client = NULL; nfs2_ksp_server = NULL; nfs3_ksp_client = NULL; @@ -357,7 +356,7 @@ static int nfs_init (void) if (kc == NULL) return (-1); - for (ksp_chain = kc->kc_chain; ksp_chain != NULL; + for (kstat_t *ksp_chain = kc->kc_chain; ksp_chain != NULL; ksp_chain = ksp_chain->ks_next) { if (strncmp (ksp_chain->ks_module, "nfs", 3) != 0) @@ -385,7 +384,6 @@ static void nfs_procedures_submit (const char *plugin_instance, value_t *values, size_t values_num) { value_list_t vl = VALUE_LIST_INIT; - size_t i; vl.values_len = 1; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); @@ -394,7 +392,7 @@ static void nfs_procedures_submit (const char *plugin_instance, sizeof (vl.plugin_instance)); sstrncpy (vl.type, "nfs_procedure", sizeof (vl.type)); - for (i = 0; i < values_num; i++) + for (size_t i = 0; i < values_num; i++) { vl.values = values + i; sstrncpy (vl.type_instance, type_instances[i], @@ -409,12 +407,11 @@ static void nfs_submit_fields (int nfs_version, const char *instance, { char plugin_instance[DATA_MAX_NAME_LEN]; value_t values[fields_num]; - size_t i; ssnprintf (plugin_instance, sizeof (plugin_instance), "v%i%s", nfs_version, instance); - for (i = 0; i < fields_num; i++) + for (size_t i = 0; i < fields_num; i++) (void) parse_value (fields[i], &values[i], DS_TYPE_DERIVE); nfs_procedures_submit (plugin_instance, proc_names, values, @@ -608,7 +605,6 @@ static int nfs_read_kstat (kstat_t *ksp, int nfs_version, const char *inst, { char plugin_instance[DATA_MAX_NAME_LEN]; value_t values[proc_names_num]; - size_t i; if (ksp == NULL) return (EINVAL); @@ -617,7 +613,7 @@ static int nfs_read_kstat (kstat_t *ksp, int nfs_version, const char *inst, nfs_version, inst); kstat_read(kc, ksp, NULL); - for (i = 0; i < proc_names_num; i++) + for (size_t i = 0; i < proc_names_num; i++) { /* The name passed to kstat_data_lookup() doesn't have the * "const" modifier, so we need to copy the name here. */