[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[chunkd patch 5/6] Drop fd from struct server_poll



This field seems completely unnecessary.

Signed-off-by: Pete Zaitcev <zaitcev@xxxxxxxxxx>

---
 server/chunkd.h |    1 -
 server/cldu.c   |    7 ++++---
 server/server.c |    4 +---
 3 files changed, 5 insertions(+), 7 deletions(-)

commit 0f030f2d37a7d868752429632b98041821e1f57d
Author: Master <zaitcev@xxxxxxxxxxxxxxxxxx>
Date:   Thu May 20 21:36:02 2010 -0600

    Drop fd from server_poll, it's unnecessary.

diff --git a/server/chunkd.h b/server/chunkd.h
index 47e6f95..228ece3 100644
--- a/server/chunkd.h
+++ b/server/chunkd.h
@@ -170,7 +170,6 @@ struct server_stats {
 };
 
 struct server_poll {
-	int			fd;		/* fd to poll for events */
 	short			events;		/* POLL* from poll.h */
 	bool			busy;		/* if true, do not poll us */
 
diff --git a/server/cldu.c b/server/cldu.c
index a57c2d5..3d59063 100644
--- a/server/cldu.c
+++ b/server/cldu.c
@@ -474,6 +474,7 @@ int cld_begin(const char *thishost, uint32_t nid, char *infopath,
 {
 	static struct cld_session *cs = &ses;
 	struct server_poll *sp;
+	int rfd;
 	int retry_cnt;
 	int newactive;
 
@@ -525,6 +526,7 @@ int cld_begin(const char *thishost, uint32_t nid, char *infopath,
 		applog(LOG_ERR, "Cannot open pipe: %s", strerror(errno));
 		goto err_pipe;
 	}
+	rfd = cs->event_pipe[0];
 
 	sp = calloc(1, sizeof(*sp));
 	if (!sp) {
@@ -532,12 +534,11 @@ int cld_begin(const char *thishost, uint32_t nid, char *infopath,
 		goto err_sp;
 	}
 
-	sp->fd = cs->event_pipe[0];
 	sp->events = POLLIN;
 	sp->cb = cldu_pipe_event;
 	sp->userdata = cs;
 
-	g_hash_table_insert(chunkd_srv.fd_info, GINT_TO_POINTER(sp->fd), sp);
+	g_hash_table_insert(chunkd_srv.fd_info, GINT_TO_POINTER(rfd), sp);
 
 	/*
 	 * FIXME: We should find next suitable host according to
@@ -559,7 +560,7 @@ int cld_begin(const char *thishost, uint32_t nid, char *infopath,
 	return 0;
 
 err_net:
-	g_hash_table_remove(chunkd_srv.fd_info, GINT_TO_POINTER(sp->fd));
+	g_hash_table_remove(chunkd_srv.fd_info, GINT_TO_POINTER(rfd));
 err_sp:
 	close(cs->event_pipe[0]);
 	close(cs->event_pipe[1]);
diff --git a/server/server.c b/server/server.c
index 2d2f6c3..801f26c 100644
--- a/server/server.c
+++ b/server/server.c
@@ -1374,7 +1374,6 @@ static bool tcp_srv_event(int fd, short events, void *userdata)
 	if (!sp)
 		goto err_out_fd;
 
-	sp->fd = cli->fd;
 	sp->events = POLLIN;
 	sp->cb = tcp_cli_event;
 	sp->userdata = cli;
@@ -1476,7 +1475,6 @@ static int net_open_socket(const struct listen_cfg *cfg,
 		goto err_out_fd;
 	}
 
-	sp->fd = fd;
 	sp->events = POLLIN;
 	sp->cb = tcp_srv_event;
 	sp->userdata = sock;
@@ -1710,7 +1708,7 @@ static int main_loop(void)
 			sp->busy = true;
 
 			/* call callback, shutting down server if requested */
-			runrunrun = sp->cb(sp->fd, pfd->revents, sp->userdata);
+			runrunrun = sp->cb(pfd->fd, pfd->revents, sp->userdata);
 			if (!runrunrun) {
 				server_running = false;
 				break;
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux