All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: [chunkd patch 5/6] Drop fd from struct server_poll
Date: Thu, 20 May 2010 22:54:38 -0600	[thread overview]
Message-ID: <20100520225438.46ff6b93@redhat.com> (raw)

This field seems completely unnecessary.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>

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

commit 0f030f2d37a7d868752429632b98041821e1f57d
Author: Master <zaitcev@lembas.zaitcev.lan>
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;

                 reply	other threads:[~2010-05-21  4:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100520225438.46ff6b93@redhat.com \
    --to=zaitcev@redhat.com \
    --cc=hail-devel@vger.kernel.org \
    --cc=jeff@garzik.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.