projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Auto-Merge pull request #2736 from rpv-tomsk/collectd-collectd-5.8
[collectd.git]
/
src
/
ted.c
diff --git
a/src/ted.c
b/src/ted.c
index
fbfd95d
..
3b64b75
100644
(file)
--- a/
src/ted.c
+++ b/
src/ted.c
@@
-88,8
+88,8
@@
static int ted_read_value(double *ret_power, double *ret_voltage) {
status = write(fd, pkt_request, sizeof(pkt_request));
if (status <= 0) {
status = write(fd, pkt_request, sizeof(pkt_request));
if (status <= 0) {
- ERROR("ted plugin:
s
write failed.");
- return
(-1)
;
+ ERROR("ted plugin: write failed.");
+ return
-1
;
}
/* Loop until we find the end of the package */
}
/* Loop until we find the end of the package */
@@
-104,7
+104,7
@@
static int ted_read_value(double *ret_power, double *ret_voltage) {
{
WARNING("ted plugin: Timeout while waiting for file descriptor "
"to become ready.");
{
WARNING("ted plugin: Timeout while waiting for file descriptor "
"to become ready.");
- return
(-1)
;
+ return
-1
;
} else if ((status < 0) && ((errno == EAGAIN) || (errno == EINTR))) {
/* Some signal or something. Start over.. */
continue;
} else if ((status < 0) && ((errno == EAGAIN) || (errno == EINTR))) {
/* Some signal or something. Start over.. */
continue;
@@
-112,7
+112,7
@@
static int ted_read_value(double *ret_power, double *ret_voltage) {
char errbuf[1024];
ERROR("ted plugin: select failed: %s",
sstrerror(errno, errbuf, sizeof(errbuf)));
char errbuf[1024];
ERROR("ted plugin: select failed: %s",
sstrerror(errno, errbuf, sizeof(errbuf)));
- return
(-1)
;
+ return
-1
;
}
receive_buffer_length = read(fd, receive_buffer, sizeof(receive_buffer));
}
receive_buffer_length = read(fd, receive_buffer, sizeof(receive_buffer));
@@
-122,15
+122,15
@@
static int ted_read_value(double *ret_power, double *ret_voltage) {
continue;
ERROR("ted plugin: read(2) failed: %s",
sstrerror(errno, errbuf, sizeof(errbuf)));
continue;
ERROR("ted plugin: read(2) failed: %s",
sstrerror(errno, errbuf, sizeof(errbuf)));
- return
(-1)
;
+ return
-1
;
} else if (receive_buffer_length == 0) {
/* Should we close the FD in this case? */
WARNING("ted plugin: Received EOF from file descriptor.");
} else if (receive_buffer_length == 0) {
/* Should we close the FD in this case? */
WARNING("ted plugin: Received EOF from file descriptor.");
- return
(-1)
;
+ return
-1
;
} else if (((size_t)receive_buffer_length) > sizeof(receive_buffer)) {
ERROR("ted plugin: read(2) returned invalid value %zi.",
receive_buffer_length);
} else if (((size_t)receive_buffer_length) > sizeof(receive_buffer)) {
ERROR("ted plugin: read(2) returned invalid value %zi.",
receive_buffer_length);
- return
(-1)
;
+ return
-1
;
}
/*
}
/*
@@
-175,7
+175,7
@@
static int ted_read_value(double *ret_power, double *ret_voltage) {
/* Check for errors inside the loop. */
if ((end_flag == 0) || (package_buffer_pos != EXPECTED_PACKAGE_LENGTH))
/* Check for errors inside the loop. */
if ((end_flag == 0) || (package_buffer_pos != EXPECTED_PACKAGE_LENGTH))
- return
(-1)
;
+ return
-1
;
/*
* Power is at positions 247 and 248 (LSB first) in [10kW].
/*
* Power is at positions 247 and 248 (LSB first) in [10kW].
@@
-190,7
+190,7
@@
static int ted_read_value(double *ret_power, double *ret_voltage) {
((int)package_buffer[251]));
/* success */
((int)package_buffer[251]));
/* success */
- return
(0)
;
+ return
0
;
} /* int ted_read_value */
static int ted_open_device(void) {
} /* int ted_read_value */
static int ted_open_device(void) {
@@
-198,7
+198,7
@@
static int ted_open_device(void) {
struct termios options;
if (fd >= 0)
struct termios options;
if (fd >= 0)
- return
(0)
;
+ return
0
;
dev = DEFAULT_DEVICE;
if (conf_device != NULL)
dev = DEFAULT_DEVICE;
if (conf_device != NULL)
@@
-207,7
+207,7
@@
static int ted_open_device(void) {
fd = open(dev, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);
if (fd < 0) {
ERROR("ted plugin: Unable to open device %s.", dev);
fd = open(dev, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);
if (fd < 0) {
ERROR("ted plugin: Unable to open device %s.", dev);
- return
(-1)
;
+ return
-1
;
}
/* Get the current options for the port... */
}
/* Get the current options for the port... */
@@
-224,7
+224,7
@@
static int ted_open_device(void) {
tcsetattr(fd, TCSANOW, &options);
INFO("ted plugin: Successfully opened %s.", dev);
tcsetattr(fd, TCSANOW, &options);
INFO("ted plugin: Successfully opened %s.", dev);
- return
(0)
;
+ return
0
;
} /* int ted_open_device */
static void ted_submit(const char *type, double value) {
} /* int ted_open_device */
static void ted_submit(const char *type, double value) {
@@
-248,15
+248,15
@@
static int ted_config(const char *key, const char *value) {
tmp = atoi(value);
if (tmp < 0) {
WARNING("ted plugin: Invalid retry count: %i", tmp);
tmp = atoi(value);
if (tmp < 0) {
WARNING("ted plugin: Invalid retry count: %i", tmp);
- return
(1)
;
+ return
1
;
}
conf_retries = tmp;
} else {
ERROR("ted plugin: Unknown config option: %s", key);
}
conf_retries = tmp;
} else {
ERROR("ted plugin: Unknown config option: %s", key);
- return
(-1)
;
+ return
-1
;
}
}
- return
(0)
;
+ return
0
;
} /* int ted_config */
static int ted_read(void) {
} /* int ted_config */
static int ted_read(void) {
@@
-266,7
+266,7
@@
static int ted_read(void) {
status = ted_open_device();
if (status != 0)
status = ted_open_device();
if (status != 0)
- return
(-1)
;
+ return
-1
;
power = NAN;
voltage = NAN;
power = NAN;
voltage = NAN;
@@
-277,12
+277,12
@@
static int ted_read(void) {
}
if (status != 0)
}
if (status != 0)
- return
(-1)
;
+ return
-1
;
ted_submit("power", power);
ted_submit("voltage", voltage);
ted_submit("power", power);
ted_submit("voltage", voltage);
- return
(0)
;
+ return
0
;
} /* int ted_read */
static int ted_shutdown(void) {
} /* int ted_read */
static int ted_shutdown(void) {
@@
-291,7
+291,7
@@
static int ted_shutdown(void) {
fd = -1;
}
fd = -1;
}
- return
(0)
;
+ return
0
;
} /* int ted_shutdown */
void module_register(void) {
} /* int ted_shutdown */
void module_register(void) {