projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src/daemon/common_test.c: Avoid nesting composite literals.
[collectd.git]
/
src
/
tape.c
diff --git
a/src/tape.c
b/src/tape.c
index
5b5cdb4
..
c7d56c7
100644
(file)
--- a/
src/tape.c
+++ b/
src/tape.c
@@
-21,6
+21,7
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
@@
-58,23
+59,22
@@
static int tape_init (void)
static void tape_submit (const char *plugin_instance,
const char *type,
static void tape_submit (const char *plugin_instance,
const char *type,
-
counter_t read, counter
_t write)
+
derive_t read, derive
_t write)
{
{
- value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
value_list_t vl = VALUE_LIST_INIT;
-
- values[0].counter = read;
- values[1].counter = write;
+ value_t values[] = {
+ { .derive = read },
+ { .derive = write },
+ };
vl.values = values;
vl.values = values;
- vl.values_len = 2;
- vl.time = time (NULL);
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.plugin, "tape", sizeof (vl.plugin));
sstrncpy (vl.plugin, "tape", sizeof (vl.plugin));
- strncpy (vl.plugin_instance, plugin_instance,
+ s
s
trncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
sizeof (vl.plugin_instance));
+ sstrncpy (vl.type, type, sizeof (vl.type));
- plugin_dispatch_values (
type,
&vl);
+ plugin_dispatch_values (&vl);
} /* void tape_submit */
static int tape_read (void)
} /* void tape_submit */
static int tape_read (void)
@@
-98,7
+98,6
@@
static int tape_read (void)
# error "kstat_io_t does not have the required members"
#endif
static kstat_io_t kio;
# error "kstat_io_t does not have the required members"
#endif
static kstat_io_t kio;
- int i;
if (kc == NULL)
return (-1);
if (kc == NULL)
return (-1);
@@
-106,7
+105,7
@@
static int tape_read (void)
if (numtape <= 0)
return (-1);
if (numtape <= 0)
return (-1);
- for (i = 0; i < numtape; i++)
+ for (i
nt i
= 0; i < numtape; i++)
{
if (kstat_read (kc, ksp[i], &kio) == -1)
continue;
{
if (kstat_read (kc, ksp[i], &kio) == -1)
continue;