}
/** Handle a network event for a connection */
-static int cconn_handle_event(struct cconn *io) {
- int ret;
+static ssize_t cconn_handle_event(struct cconn *io) {
+ ssize_t ret;
switch (io->state) {
case CSTATE_UNCONNECTED:
ERROR("ceph plugin: cconn_handle_event(name=%s) got to illegal "
*/
static int milli_diff(const struct timeval *t1, const struct timeval *t2) {
int64_t ret;
- int sec_diff = t1->tv_sec - t2->tv_sec;
- int usec_diff = t1->tv_usec - t2->tv_usec;
+ long sec_diff = t1->tv_sec - t2->tv_sec;
+ long usec_diff = t1->tv_usec - t2->tv_usec;
ret = usec_diff / 1000;
ret += (sec_diff * 1000);
return (ret > INT_MAX) ? INT_MAX : ((ret < INT_MIN) ? INT_MIN : (int)ret);
/** This handles the actual network I/O to talk to the Ceph daemons.
*/
-static int cconn_main_loop(uint32_t request_type) {
- int ret, some_unreachable = 0;
+static ssize_t cconn_main_loop(uint32_t request_type) {
+ int some_unreachable = 0;
+ ssize_t ret;
struct timeval end_tv;
struct cconn io_array[g_num_daemons];
struct cconn *io = io_array + i;
ret = cconn_prepare(io, fds + nfds);
if (ret < 0) {
- WARNING("ceph plugin: cconn_prepare(name=%s,i=%" PRIsz ",st=%d)=%d",
+ WARNING("ceph plugin: cconn_prepare(name=%s,i=%" PRIsz ",st=%d)=%zd",
io->d->name, i, io->state, ret);
cconn_close(io);
io->request_type = ASOK_REQ_NONE;
}
RETRY_ON_EINTR(ret, poll(fds, nfds, diff));
if (ret < 0) {
- ERROR("ceph plugin: poll(2) error: %d", ret);
+ ERROR("ceph plugin: poll(2) error: %zd", ret);
goto done;
}
for (int i = 0; i < nfds; ++i) {
ret = cconn_handle_event(io);
if (ret) {
WARNING("ceph plugin: cconn_handle_event(name=%s,"
- "i=%d,st=%d): error %d",
+ "i=%d,st=%d): error %zd",
io->d->name, i, io->state, ret);
cconn_close(io);
io->request_type = ASOK_REQ_NONE;
return ret;
}
-static int ceph_read(void) { return cconn_main_loop(ASOK_REQ_DATA); }
+static int ceph_read(void) { return (int)cconn_main_loop(ASOK_REQ_DATA); }
/******* lifecycle *******/
static int ceph_init(void) {
return ENOENT;
}
- return cconn_main_loop(ASOK_REQ_VERSION);
+ return (int)cconn_main_loop(ASOK_REQ_VERSION);
}
static int ceph_shutdown(void) {