watt = pow (10.0, (dbm / 10.0)) / 1000.0;
- return (watt);
+ return watt;
}
#endif
static void wireless_submit(const char *plugin_instance, const char *type,
double value) {
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- values[0].gauge = value;
-
- vl.values = values;
+ vl.values = &(value_t){.gauge = value};
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "wireless", sizeof(vl.plugin));
sstrncpy(vl.plugin_instance, plugin_instance, sizeof(vl.plugin_instance));
sstrncpy(vl.type, type, sizeof(vl.type));
static double wireless_percent_to_power(double quality) {
assert((quality >= 0.0) && (quality <= 100.0));
- return ((quality * (POWER_MAX - POWER_MIN)) + POWER_MIN);
+ return (quality * (POWER_MAX - POWER_MIN)) + POWER_MIN;
} /* double wireless_percent_to_power */
static int wireless_read(void) {
/* there are a variety of names for the wireless device */
if ((fh = fopen(WIRELESS_PROC_FILE, "r")) == NULL) {
- char errbuf[1024];
- WARNING("wireless: fopen: %s", sstrerror(errno, errbuf, sizeof(errbuf)));
- return (-1);
+ WARNING("wireless: fopen: %s", STRERRNO);
+ return -1;
}
devices_found = 0;
/* If no wireless devices are present return an error, so the plugin
* code delays our read function. */
if (devices_found == 0)
- return (-1);
+ return -1;
#endif /* KERNEL_LINUX */
- return (0);
+ return 0;
} /* int wireless_read */
void module_register(void) {