X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fnetapp.c;h=45395ae04b0daf7c7fc9656a5c09b94388711bf9;hb=3fae5596643f1e361eb18c3d65448f8bc02fdd80;hp=51a6331811ad18993804c397962187781e4dcfb4;hpb=f14bb45d570e0b34bdd3a2a0cadfe414c3dfda40;p=collectd.git diff --git a/src/netapp.c b/src/netapp.c index 51a63318..45395ae0 100644 --- a/src/netapp.c +++ b/src/netapp.c @@ -879,7 +879,7 @@ static cdtime_t cna_child_get_cdtime (na_elem_t *data) /* {{{ */ } /* }}} cdtime_t cna_child_get_cdtime */ -/* +/* * Query functions * * These functions are called with appropriate data returned by the libnetapp @@ -889,15 +889,13 @@ static cdtime_t cna_child_get_cdtime (na_elem_t *data) /* {{{ */ static int cna_handle_wafl_data (const char *hostname, cfg_wafl_t *cfg_wafl, /* {{{ */ na_elem_t *data, cdtime_t interval) { - cfg_wafl_t perf_data; + cfg_wafl_t perf_data = { 0 }; const char *plugin_inst; na_elem_t *instances; na_elem_t *counter; na_elem_iter_t counter_iter; - memset (&perf_data, 0, sizeof (perf_data)); - perf_data.timestamp = cna_child_get_cdtime (data); instances = na_elem_child(na_elem_child (data, "instances"), "instance-data"); @@ -1062,7 +1060,7 @@ static int cna_handle_disk_data (const char *hostname, /* {{{ */ if ((cfg_disk == NULL) || (data == NULL)) return (EINVAL); - + timestamp = cna_child_get_cdtime (data); instances = na_elem_child (data, "instances"); @@ -1081,12 +1079,11 @@ static int cna_handle_disk_data (const char *hostname, /* {{{ */ instance = na_iterator_next(&instance_iter)) { disk_t *old_data; - disk_t new_data; + disk_t new_data = { 0 }; na_elem_iter_t counter_iterator; na_elem_t *counter; - memset (&new_data, 0, sizeof (new_data)); new_data.timestamp = timestamp; new_data.disk_busy_percent = NAN; @@ -1254,7 +1251,7 @@ static int cna_handle_volume_perf_data (const char *hostname, /* {{{ */ na_elem_t *elem_instances; na_elem_iter_t iter_instances; na_elem_t *elem_instance; - + timestamp = cna_child_get_cdtime (data); elem_instances = na_elem_child(data, "instances"); @@ -1273,14 +1270,13 @@ static int cna_handle_volume_perf_data (const char *hostname, /* {{{ */ { const char *name; - data_volume_perf_t perf_data; + data_volume_perf_t perf_data = { 0 }; data_volume_perf_t *v; na_elem_t *elem_counters; na_elem_iter_t iter_counters; na_elem_t *elem_counter; - memset (&perf_data, 0, sizeof (perf_data)); perf_data.timestamp = timestamp; name = na_child_get_string (elem_instance, "name"); @@ -1519,9 +1515,8 @@ static int cna_submit_volume_usage_data (const char *hostname, /* {{{ */ static int cna_change_volume_status (const char *hostname, /* {{{ */ data_volume_usage_t *v) { - notification_t n; + notification_t n = { 0 }; - memset (&n, 0, sizeof (n)); n.time = cdtime (); sstrncpy (n.host, hostname, sizeof (n.host)); sstrncpy (n.plugin, "netapp", sizeof (n.plugin)); @@ -1733,7 +1728,7 @@ static int cna_handle_volume_usage_data (const host_config_t *host, /* {{{ */ if ((v->flags & CFG_VOLUME_USAGE_SNAP) != 0) cna_handle_volume_snap_usage(host, v); - + if ((v->flags & CFG_VOLUME_USAGE_DF) == 0) continue; @@ -2128,7 +2123,7 @@ static int cna_handle_system_data (const char *hostname, /* {{{ */ const char *instance; cdtime_t timestamp; - + timestamp = cna_child_get_cdtime (data); instances = na_elem_child(na_elem_child (data, "instances"), "instance-data"); @@ -2195,7 +2190,7 @@ static int cna_handle_system_data (const char *hostname, /* {{{ */ && (HAS_ALL_FLAGS (counter_flags, 0x01 | 0x02))) submit_two_derive (hostname, instance, "disk_octets", NULL, disk_read, disk_written, timestamp, interval); - + if ((cfg_system->flags & CFG_SYSTEM_NET) && (HAS_ALL_FLAGS (counter_flags, 0x04 | 0x08))) submit_two_derive (hostname, instance, "if_octets", NULL, @@ -2437,10 +2432,10 @@ static int cna_config_volume_performance (host_config_t *host, /* {{{ */ host->cfg_volume_perf = cfg_volume_perf; } cfg_volume_perf = host->cfg_volume_perf; - + for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *item = ci->children + i; - + /* if (!item || !item->key || !*item->key) continue; */ if (strcasecmp(item->key, "Interval") == 0) cna_config_get_interval (item, &cfg_volume_perf->interval); @@ -2573,10 +2568,10 @@ static int cna_config_disk(host_config_t *host, oconfig_item_t *ci) { /* {{{ */ host->cfg_disk = cfg_disk; } cfg_disk = host->cfg_disk; - + for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *item = ci->children + i; - + /* if (!item || !item->key || !*item->key) continue; */ if (strcasecmp(item->key, "Interval") == 0) cna_config_get_interval (item, &cfg_disk->interval); @@ -2619,7 +2614,7 @@ static int cna_config_wafl(host_config_t *host, oconfig_item_t *ci) /* {{{ */ for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *item = ci->children + i; - + if (strcasecmp(item->key, "Interval") == 0) cna_config_get_interval (item, &cfg_wafl->interval); else if (!strcasecmp(item->key, "GetNameCache")) @@ -2700,10 +2695,10 @@ static int cna_config_volume_usage(host_config_t *host, /* {{{ */ host->cfg_volume_usage = cfg_volume_usage; } cfg_volume_usage = host->cfg_volume_usage; - + for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *item = ci->children + i; - + /* if (!item || !item->key || !*item->key) continue; */ if (strcasecmp(item->key, "Interval") == 0) cna_config_get_interval (item, &cfg_volume_usage->interval); @@ -2895,7 +2890,7 @@ static int cna_read (user_data_t *ud); static int cna_register_host (host_config_t *host) /* {{{ */ { char cb_name[256]; - user_data_t ud; + user_data_t ud = { 0 }; if (host->vfiler) ssnprintf (cb_name, sizeof (cb_name), "netapp-%s-%s", @@ -2903,7 +2898,6 @@ static int cna_register_host (host_config_t *host) /* {{{ */ else ssnprintf (cb_name, sizeof (cb_name), "netapp-%s", host->name); - memset (&ud, 0, sizeof (ud)); ud.data = host; ud.free_func = (void (*) (void *)) free_host_config; @@ -3074,9 +3068,8 @@ static int cna_init_host (host_config_t *host) /* {{{ */ static int cna_init (void) /* {{{ */ { - char err[256]; + char err[256] = { 0 }; - memset (err, 0, sizeof (err)); if (!na_startup(err, sizeof(err))) { err[sizeof (err) - 1] = 0; ERROR("netapp plugin: Error initializing netapp API: %s", err);