summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 24a099f)
raw | patch | inline | side by side (parent: 24a099f)
author | Florian Forster <octo@collectd.org> | |
Wed, 14 Sep 2016 06:21:47 +0000 (08:21 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 14 Sep 2016 06:59:00 +0000 (08:59 +0200) |
Use struct initializers to initialize the array like so:
value_t values[] = {
/* ... */
};
Then initialize the value_list_t with:
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
value_t values[] = {
/* ... */
};
Then initialize the value_list_t with:
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
23 files changed:
src/disk.c | patch | blob | history | |
src/dns.c | patch | blob | history | |
src/hugepages.c | patch | blob | history | |
src/interface.c | patch | blob | history | |
src/ipvs.c | patch | blob | history | |
src/load.c | patch | blob | history | |
src/madwifi.c | patch | blob | history | |
src/memcached.c | patch | blob | history | |
src/mysql.c | patch | blob | history | |
src/netapp.c | patch | blob | history | |
src/netlink.c | patch | blob | history | |
src/openvpn.c | patch | blob | history | |
src/processes.c | patch | blob | history | |
src/routeros.c | patch | blob | history | |
src/serial.c | patch | blob | history | |
src/smart.c | patch | blob | history | |
src/tape.c | patch | blob | history | |
src/target_v5upgrade.c | patch | blob | history | |
src/teamspeak2.c | patch | blob | history | |
src/virt.c | patch | blob | history | |
src/vmem.c | patch | blob | history | |
src/vserver.c | patch | blob | history | |
src/zfs_arc.c | patch | blob | history |
diff --git a/src/disk.c b/src/disk.c
index f29029c584dce4d7375466069106e1572d2a3971..2c0d8b595dfe391e298b2582bd93cdd024c7c778 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
const char *type,
derive_t read, derive_t write)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = read;
- values[1].derive = write;
+ value_t values[] = {
+ { .derive = read },
+ { .derive = write },
+ };
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "disk", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
#if KERNEL_FREEBSD || KERNEL_LINUX
static void submit_io_time (char const *plugin_instance, derive_t io_time, derive_t weighted_time)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = io_time;
- values[1].derive = weighted_time;
+ value_t values[] = {
+ { .derive = io_time },
+ { .derive = weighted_time },
+ };
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "disk", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
diff --git a/src/dns.c b/src/dns.c
index ef80e575d1c8820f4227e105d360c15425f92529..ae53710b24783dbf5193eacd242833e07e6414af 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
static void submit_octets (derive_t queries, derive_t responses)
{
- value_t values[2];
+ value_t values[] = {
+ { .derive = queries },
+ { .derive = responses },
+ };
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = queries;
- values[1].derive = responses;
-
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "dns", sizeof (vl.plugin));
sstrncpy (vl.type, "dns_octets", sizeof (vl.type));
diff --git a/src/hugepages.c b/src/hugepages.c
index ac9441d092ecc9227e977f9971a3c0d323c614c3..c3060fefce4c1f3abd4f2042d1d106ea5c5f04ca 100644 (file)
--- a/src/hugepages.c
+++ b/src/hugepages.c
static void submit_hp(const char *plug_inst, const char *type,
const char *type_instance, gauge_t free_value, gauge_t used_value)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].gauge = free_value;
- values[1].gauge = used_value;
+ value_t values[] = {
+ { .gauge = free_value },
+ { .gauge = used_value },
+ };
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, g_plugin_name, sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plug_inst, sizeof (vl.plugin_instance));
diff --git a/src/interface.c b/src/interface.c
index b8ed6e402bf564b2185b11a1c2dee1416fef36b6..849de955ed1be50916a880c694f6eb6a5a21dbe1 100644 (file)
--- a/src/interface.c
+++ b/src/interface.c
derive_t rx,
derive_t tx)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
if (ignorelist_match (ignorelist, dev) != 0)
return;
- values[0].derive = rx;
- values[1].derive = tx;
-
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "interface", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
diff --git a/src/ipvs.c b/src/ipvs.c
index a68d20fb0ca019c021eb91c677ed0b812d6a9403..d2ceb50bc2c8ba6685f0fa69b8d44e6bdacf552c 100644 (file)
--- a/src/ipvs.c
+++ b/src/ipvs.c
static void cipvs_submit_if (const char *pi, const char *t, const char *ti,
derive_t rx, derive_t tx)
{
- value_t values[2];
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
value_list_t vl = VALUE_LIST_INIT;
- values[0].derive = rx;
- values[1].derive = tx;
-
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin));
diff --git a/src/load.c b/src/load.c
index cc3be37e03fa4e508ccd3f067f109fbef8dd88cf..a3f6bb1f8516c784e226a4cd7e8bc661fd52f41d 100644 (file)
--- a/src/load.c
+++ b/src/load.c
}
static void load_submit (gauge_t snum, gauge_t mnum, gauge_t lnum)
{
- value_t values[3];
- value_list_t vl = VALUE_LIST_INIT;
int cores = 0;
char errbuf[1024];
lnum /= cores;
}
- values[0].gauge = snum;
- values[1].gauge = mnum;
- values[2].gauge = lnum;
+ value_list_t vl = VALUE_LIST_INIT;
+ value_t values[] = {
+ { .gauge = snum },
+ { .gauge = mnum },
+ { .gauge = lnum },
+ };
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
diff --git a/src/madwifi.c b/src/madwifi.c
index f8065a6d944dc12906a5605e474a001354e8ea33..42474bc7050c313aa967e8c59a7962dccc47fbaa 100644 (file)
--- a/src/madwifi.c
+++ b/src/madwifi.c
@@ -566,10 +566,12 @@ static void submit_derive (const char *dev, const char *type, const char *ti1,
static void submit_derive2 (const char *dev, const char *type, const char *ti1,
const char *ti2, derive_t val1, derive_t val2)
{
- value_t items[2];
- items[0].derive = val1;
- items[1].derive = val2;
- submit (dev, type, ti1, ti2, items, 2);
+ value_t values[] = {
+ { .derive = val1 },
+ { .derive = val2 },
+ };
+
+ submit (dev, type, ti1, ti2, values, STATIC_ARRAY_SIZE (values));
}
static void submit_gauge (const char *dev, const char *type, const char *ti1,
diff --git a/src/memcached.c b/src/memcached.c
index 6d503ea779863aca4e7ce250d6e34bb280f69e87..77cadebb9a2962cc9a953372641325fd7fbe260c 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
static void submit_derive2 (const char *type, const char *type_inst,
derive_t value0, derive_t value1, memcached_t *st)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
- memcached_init_vl (&vl, st);
-
- values[0].derive = value0;
- values[1].derive = value1;
+ value_t values[] = {
+ { .derive = value0 },
+ { .derive = value1 },
+ };
+ memcached_init_vl (&vl, st);
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_inst != NULL)
sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
static void submit_gauge2 (const char *type, const char *type_inst,
gauge_t value0, gauge_t value1, memcached_t *st)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
- memcached_init_vl (&vl, st);
-
- values[0].gauge = value0;
- values[1].gauge = value1;
+ value_t values[] = {
+ { .gauge = value0 },
+ { .gauge = value1 },
+ };
+ memcached_init_vl (&vl, st);
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.type, type, sizeof (vl.type));
if (type_inst != NULL)
sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
diff --git a/src/mysql.c b/src/mysql.c
index d9826d9fb09f9bea7862b81a78e8e86a560cd94f..a64b0e5bc96a6125757abb17da6548a1b13473fe 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
static void traffic_submit (derive_t rx, derive_t tx, mysql_database_t *db)
{
- value_t values[2];
-
- values[0].derive = rx;
- values[1].derive = tx;
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
submit ("mysql_octets", NULL, values, STATIC_ARRAY_SIZE (values), db);
} /* void traffic_submit */
diff --git a/src/netapp.c b/src/netapp.c
index f238a6d0e82a4dd296a13c91e930eb80d6f55feb..e83a475388e5704ac39486a027f502accfcb352a 100644 (file)
--- a/src/netapp.c
+++ b/src/netapp.c
@@ -649,13 +649,13 @@ static int submit_two_derive (const char *host, const char *plugin_inst, /* {{{
const char *type, const char *type_inst, derive_t val0, derive_t val1,
cdtime_t timestamp, cdtime_t interval)
{
- value_t values[2];
-
- values[0].derive = val0;
- values[1].derive = val1;
+ value_t values[] = {
+ { .derive = val0 },
+ { .derive = val1 },
+ };
return (submit_values (host, plugin_inst, type, type_inst,
- values, 2, timestamp, interval));
+ values, STATIC_ARRAY_SIZE (values), timestamp, interval));
} /* }}} int submit_two_derive */
static int submit_derive (const char *host, const char *plugin_inst, /* {{{ */
@@ -670,13 +670,13 @@ static int submit_two_gauge (const char *host, const char *plugin_inst, /* {{{ *
const char *type, const char *type_inst, gauge_t val0, gauge_t val1,
cdtime_t timestamp, cdtime_t interval)
{
- value_t values[2];
-
- values[0].gauge = val0;
- values[1].gauge = val1;
+ value_t values[] = {
+ { .gauge = val0 },
+ { .gauge = val1 },
+ };
return (submit_values (host, plugin_inst, type, type_inst,
- values, 2, timestamp, interval));
+ values, STATIC_ARRAY_SIZE (values), timestamp, interval));
} /* }}} int submit_two_gauge */
static int submit_double (const char *host, const char *plugin_inst, /* {{{ */
diff --git a/src/netlink.c b/src/netlink.c
index dee62685558239e91af875c2d1d1560f49cef2f4..786056d49341623eff23359af52ba8fb7485eb2a 100644 (file)
--- a/src/netlink.c
+++ b/src/netlink.c
const char *type_instance,
derive_t rx, derive_t tx)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = rx;
- values[1].derive = tx;
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "netlink", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
diff --git a/src/openvpn.c b/src/openvpn.c
index 69ab9fb14dbf237459cbc19c120a3fdc773589e1..81ffa89988f218edf6ef9b6538b90d43614f1808 100644 (file)
--- a/src/openvpn.c
+++ b/src/openvpn.c
static void iostats_submit (const char *pinst, const char *tinst,
derive_t rx, derive_t tx)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = rx;
- values[1].derive = tx;
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
/* NOTE ON THE NEW NAMING SCHEMA:
* using plugin_instance to identify each vpn config (and
static void compression_submit (const char *pinst, const char *tinst,
derive_t uncompressed, derive_t compressed)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = uncompressed;
- values[1].derive = compressed;
+ value_t values[] = {
+ { .derive = uncompressed },
+ { .derive = compressed },
+ };
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
diff --git a/src/processes.c b/src/processes.c
index f07785a18f51631a118cc2becb64fd4d117c4300..f470c84caf27cf02dc7b76feb9a5d6075097c132 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
/* submit info about specific process (e.g.: memory taken, cpu usage, etc..) */
static void ps_submit_proc_list (procstat_t *ps)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
+ value_t values[2];
vl.values = values;
- vl.values_len = 2;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "processes", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, ps->name, sizeof (vl.plugin_instance));
diff --git a/src/routeros.c b/src/routeros.c
index 5fc14db5dd0b9fc0a928bbad340660318ee84809..5e8a2943f762ff5b39b34e8928eb096b6b92a203 100644 (file)
--- a/src/routeros.c
+++ b/src/routeros.c
static void cr_submit_io (cr_data_t *rd, const char *type, /* {{{ */
const char *type_instance, derive_t rx, derive_t tx)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = rx;
- values[1].derive = tx;
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
diff --git a/src/serial.c b/src/serial.c
index cf7ad2a1ed9961d4c5ae254bf02b3371a87561e2..482232024123a5f7172588716fe2b5884fe51c92 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
static void serial_submit (const char *type_instance,
derive_t rx, derive_t tx)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = rx;
- values[1].derive = tx;
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "serial", sizeof (vl.plugin));
sstrncpy (vl.type, "serial_octets", sizeof (vl.type));
diff --git a/src/smart.c b/src/smart.c
index 5b7a34b31d87d3fe364a322d50f13f177b5095f3..52e78a1586770f0458407459ed82023b70091d52 100644 (file)
--- a/src/smart.c
+++ b/src/smart.c
@@ -103,17 +103,20 @@ static void smart_handle_disk_attribute(SkDisk *d, const SkSmartAttributeParsedD
void* userdata)
{
const char *dev = userdata;
- value_t values[4];
- value_list_t vl = VALUE_LIST_INIT;
- if (!a->current_value_valid || !a->worst_value_valid) return;
- values[0].gauge = a->current_value;
- values[1].gauge = a->worst_value;
- values[2].gauge = a->threshold_valid?a->threshold:0;
- values[3].gauge = a->pretty_value;
+ if (!a->current_value_valid || !a->worst_value_valid)
+ return;
+
+ value_list_t vl = VALUE_LIST_INIT;
+ value_t values[] = {
+ { .gauge = a->current_value },
+ { .gauge = a->worst_value },
+ { .gauge = a->threshold_valid ? a->threshold : 0 },
+ { .gauge = a->pretty_value },
+ };
vl.values = values;
- vl.values_len = 4;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "smart", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, dev, sizeof (vl.plugin_instance));
diff --git a/src/tape.c b/src/tape.c
index 52da2bc69db465a6e99bf97e529f43c56a0cd5c8..8ec9bf28dcefc303a8e0cbf8495341b46cb508c6 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
const char *type,
derive_t read, derive_t write)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = read;
- values[1].derive = write;
+ value_t values[] = {
+ { .derive = read },
+ { .derive = write },
+ };
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "tape", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
diff --git a/src/target_v5upgrade.c b/src/target_v5upgrade.c
index 345ca73f4f0b7d47ee90f64e8b4de436caf58784..3f2c9583f51a31c4196f922faab05daccfb1a9c0 100644 (file)
--- a/src/target_v5upgrade.c
+++ b/src/target_v5upgrade.c
static int v5_zfs_arc_l2_bytes (const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
- value_t new_values[2];
if (vl->values_len != 2)
return (FC_TARGET_STOP);
@@ -290,8 +289,6 @@ static int v5_zfs_arc_l2_bytes (const data_set_t *ds, value_list_t *vl) /* {{{ *
memcpy (&new_vl, vl, sizeof (new_vl));
/* Reset data we can't simply copy */
- new_vl.values = new_values;
- new_vl.values_len = 2;
new_vl.meta = NULL;
/* Change the type/-instance to "io_octets-L2" */
@@ -299,8 +296,12 @@ static int v5_zfs_arc_l2_bytes (const data_set_t *ds, value_list_t *vl) /* {{{ *
sstrncpy (new_vl.type_instance, "L2", sizeof (new_vl.type_instance));
/* Copy the actual values. */
- new_vl.values[0].derive = (derive_t) vl->values[0].counter;
- new_vl.values[1].derive = (derive_t) vl->values[1].counter;
+ value_t values[] = {
+ { .derive = (derive_t) vl->values[0].counter },
+ { .derive = (derive_t) vl->values[1].counter },
+ };
+ new_vl.values = values;
+ new_vl.values_len = STATIC_ARRAY_SIZE (values);
/* Dispatch new value lists instead of this one */
plugin_dispatch_values (&new_vl);
diff --git a/src/teamspeak2.c b/src/teamspeak2.c
index f5eb26877fe170c57ed6940342595aede5595fe6..a709e79dd21308f2d8c42551c9e0f619a9a1c1cd 100644 (file)
--- a/src/teamspeak2.c
+++ b/src/teamspeak2.c
/*
* Submits the io rx/tx tuple to the collectd daemon
*/
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = rx;
- values[1].derive = tx;
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
vl.values = values;
- vl.values_len = 2;
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "teamspeak2", sizeof (vl.plugin));
diff --git a/src/virt.c b/src/virt.c
index 431ac413c45a9d3a163a4352c55b0b5937a6e7ef..99fe42db3918301e5cfce4de5a1117a76cfe26e1 100644 (file)
--- a/src/virt.c
+++ b/src/virt.c
submit_derive2 (const char *type, derive_t v0, derive_t v1,
virDomainPtr dom, const char *devname)
{
- value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
-
- init_value_list (&vl, dom);
-
- values[0].derive = v0;
- values[1].derive = v1;
- vl.values = values;
- vl.values_len = 2;
-
- sstrncpy (vl.type, type, sizeof (vl.type));
- sstrncpy (vl.type_instance, devname, sizeof (vl.type_instance));
+ value_t values[] = {
+ { .derive = v0 },
+ { .derive = v1 },
+ };
- plugin_dispatch_values (&vl);
+ submit (dom, type, devname, values, STATIC_ARRAY_SIZE (values));
} /* void submit_derive2 */
static int
diff --git a/src/vmem.c b/src/vmem.c
index 46ffa13b1108582b3de120decc22180cf569c2d3..027f7bdde163918eea9cd2b5a60d202bb1c0658f 100644 (file)
--- a/src/vmem.c
+++ b/src/vmem.c
static void submit_two (const char *plugin_instance, const char *type,
const char *type_instance, derive_t c0, derive_t c1)
{
- value_t values[2];
+ value_t values[] = {
+ { .derive = c0 },
+ { .derive = c1 },
+ };
- values[0].derive = c0;
- values[1].derive = c1;
-
- submit (plugin_instance, type, type_instance, values, 2);
+ submit (plugin_instance, type, type_instance,
+ values, STATIC_ARRAY_SIZE (values));
} /* void submit_one */
static void submit_one (const char *plugin_instance, const char *type,
diff --git a/src/vserver.c b/src/vserver.c
index c7adc5c4d966e53d710276e37c1e95e9fb022823..f3a2b5a4eeadb8dea5aaaa0ca5bdcb45db41a99b 100644 (file)
--- a/src/vserver.c
+++ b/src/vserver.c
static void traffic_submit (const char *plugin_instance,
const char *type_instance, derive_t rx, derive_t tx)
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].derive = rx;
- values[1].derive = tx;
+ value_t values[] = {
+ { .derive = rx },
+ { .derive = tx },
+ };
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
static void load_submit (const char *plugin_instance,
gauge_t snum, gauge_t mnum, gauge_t lnum)
{
- value_t values[3];
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].gauge = snum;
- values[1].gauge = mnum;
- values[2].gauge = lnum;
+ value_t values[] = {
+ { .gauge = snum },
+ { .gauge = mnum },
+ { .gauge = lnum },
+ };
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
diff --git a/src/zfs_arc.c b/src/zfs_arc.c
index e2d2da4c5deb321319c19d8e09b23984cd7fce1a..e4110859ffded2c26915b62b1a49f2fad804b43b 100644 (file)
--- a/src/zfs_arc.c
+++ b/src/zfs_arc.c
@@ -204,7 +204,6 @@ static void za_submit_ratio (const char* type_instance, gauge_t hits, gauge_t mi
static int za_read (void)
{
gauge_t arc_hits, arc_misses, l2_hits, l2_misses;
- value_t l2_io[2];
kstat_t *ksp = NULL;
#if defined(KERNEL_LINUX)
za_submit_ratio ("L2", l2_hits, l2_misses);
/* I/O */
- l2_io[0].derive = get_zfs_value(ksp, "l2_read_bytes");
- l2_io[1].derive = get_zfs_value(ksp, "l2_write_bytes");
-
- za_submit ("io_octets", "L2", l2_io, /* num values = */ 2);
+ value_t l2_io[] = {
+ { .derive = (derive_t) get_zfs_value(ksp, "l2_read_bytes") },
+ { .derive = (derive_t) get_zfs_value(ksp, "l2_write_bytes") },
+ };
+ za_submit ("io_octets", "L2", l2_io, STATIC_ARRAY_SIZE (l2_io));
#if defined(KERNEL_LINUX)
free_zfs_values (ksp);