summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2019-02-15 14:20:07 +0530
committerAmar Tumballi <amarts@redhat.com>2019-02-18 02:45:40 +0000
commit776ba851c6ee6c265253d44cf1d6e4e3d4a21772 (patch)
tree045cc2bd91b72048bc8a54eac67b3e605c85e3ae /libglusterfs/src
parentfc133767e5ed705f246547cdfa5b7a2db5dcd53f (diff)
downloadglusterfs-776ba851c6ee6c265253d44cf1d6e4e3d4a21772.tar.gz
glusterfs-776ba851c6ee6c265253d44cf1d6e4e3d4a21772.tar.xz
glusterfs-776ba851c6ee6c265253d44cf1d6e4e3d4a21772.zip
socket: socket event handlers now return void
Problem: Returning any value from socket event handlers to the event sub-system doesn't make sense since event sub-system cannot handle socket sub-system errors. Solution: Change return type of all socket event handlers to 'void' Change-Id: I70dc2c57f12b7ea2fae41120f71aa0d7fe0b2b6f Fixes: bz#1651246 Signed-off-by: Milind Changire <mchangir@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/event-epoll.c7
-rw-r--r--libglusterfs/src/event-poll.c14
-rw-r--r--libglusterfs/src/event.c7
-rw-r--r--libglusterfs/src/glusterfs/gf-event.h6
4 files changed, 16 insertions, 18 deletions
diff --git a/libglusterfs/src/event-epoll.c b/libglusterfs/src/event-epoll.c
index dbf3faf6e6..0cec47e605 100644
--- a/libglusterfs/src/event-epoll.c
+++ b/libglusterfs/src/event-epoll.c
@@ -645,10 +645,9 @@ pre_unlock:
goto out;
if (!handled_error_previously) {
- ret = handler(fd, idx, gen, data,
- (event->events & (EPOLLIN | EPOLLPRI)),
- (event->events & (EPOLLOUT)),
- (event->events & (EPOLLERR | EPOLLHUP)), 0);
+ handler(fd, idx, gen, data, (event->events & (EPOLLIN | EPOLLPRI)),
+ (event->events & (EPOLLOUT)),
+ (event->events & (EPOLLERR | EPOLLHUP)), 0);
}
out:
event_slot_unref(event_pool, slot, idx);
diff --git a/libglusterfs/src/event-poll.c b/libglusterfs/src/event-poll.c
index 735ec2e020..14dc5e3180 100644
--- a/libglusterfs/src/event-poll.c
+++ b/libglusterfs/src/event-poll.c
@@ -35,7 +35,7 @@ event_register_poll(struct event_pool *event_pool, int fd,
event_handler_t handler, void *data, int poll_in,
int poll_out, char notify_poller_death);
-static int
+static void
__flush_fd(int fd, int idx, int gen, void *data, int poll_in, int poll_out,
int poll_err, char event_thread_died)
{
@@ -43,7 +43,7 @@ __flush_fd(int fd, int idx, int gen, void *data, int poll_in, int poll_out,
int ret = -1;
if (!poll_in)
- return ret;
+ return;
do {
ret = sys_read(fd, buf, 64);
@@ -55,7 +55,7 @@ __flush_fd(int fd, int idx, int gen, void *data, int poll_in, int poll_out,
}
} while (ret == 64);
- return ret;
+ return;
}
static int
@@ -375,10 +375,10 @@ unlock:
pthread_mutex_unlock(&event_pool->mutex);
if (handler)
- ret = handler(ufds[i].fd, idx, 0, data,
- (ufds[i].revents & (POLLIN | POLLPRI)),
- (ufds[i].revents & (POLLOUT)),
- (ufds[i].revents & (POLLERR | POLLHUP | POLLNVAL)), 0);
+ handler(ufds[i].fd, idx, 0, data,
+ (ufds[i].revents & (POLLIN | POLLPRI)),
+ (ufds[i].revents & (POLLOUT)),
+ (ufds[i].revents & (POLLERR | POLLHUP | POLLNVAL)), 0);
return ret;
}
diff --git a/libglusterfs/src/event.c b/libglusterfs/src/event.c
index d602313362..527df5106f 100644
--- a/libglusterfs/src/event.c
+++ b/libglusterfs/src/event.c
@@ -159,12 +159,12 @@ out:
return ret;
}
-int
+void
poller_destroy_handler(int fd, int idx, int gen, void *data, int poll_out,
int poll_in, int poll_err, char event_thread_exit)
{
struct event_destroy_data *destroy = NULL;
- int readfd = -1, ret = -1;
+ int readfd = -1;
char buf = '\0';
destroy = data;
@@ -176,11 +176,10 @@ poller_destroy_handler(int fd, int idx, int gen, void *data, int poll_out,
while (sys_read(readfd, &buf, 1) > 0) {
}
- ret = 0;
out:
event_handled(destroy->pool, fd, idx, gen);
- return ret;
+ return;
}
/* This function destroys all the poller threads.
diff --git a/libglusterfs/src/glusterfs/gf-event.h b/libglusterfs/src/glusterfs/gf-event.h
index 5d92a2dd28..0305194d71 100644
--- a/libglusterfs/src/glusterfs/gf-event.h
+++ b/libglusterfs/src/glusterfs/gf-event.h
@@ -23,9 +23,9 @@ struct event_data {
int gen;
} __attribute__((__packed__, __may_alias__));
-typedef int (*event_handler_t)(int fd, int idx, int gen, void *data,
- int poll_in, int poll_out, int poll_err,
- char event_thread_exit);
+typedef void (*event_handler_t)(int fd, int idx, int gen, void *data,
+ int poll_in, int poll_out, int poll_err,
+ char event_thread_exit);
#define EVENT_EPOLL_TABLES 1024
#define EVENT_EPOLL_SLOTS 1024