[SCM] Samba Shared Repository - branch v3-6-test updated

Jeremy Allison jra at samba.org
Fri Mar 11 02:08:42 MST 2011


The branch, v3-6-test has been updated
       via  e6b4b1b tevent/poll: use fde->additional_flags to hold the array index
       via  f23ff66 tevent: change tevent_fd->additional_flags to uint64_t
      from  a13560b s3: sid->domain_sid in winbindd_samr sam_rids_to_names

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit e6b4b1baca1169c3ac53d6afdbd6a3aac365eb4b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 2 15:22:09 2011 +0100

    tevent/poll: use fde->additional_flags to hold the array index
    
    metze
    (cherry picked from commit b7d5ddfa61d3b4c797dcee64cb23eb97cc55759c)

commit f23ff66388edee724cb3c562aa6164c1be6d1230
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Mar 2 15:20:46 2011 +0100

    tevent: change tevent_fd->additional_flags to uint64_t
    
    metze
    (cherry picked from commit 20284f2a8429b5250ffb70e7124fa81115385c58)

-----------------------------------------------------------------------

Summary of changes:
 lib/tevent/tevent_internal.h |    2 +-
 lib/tevent/tevent_poll.c     |   23 ++++++-----------------
 2 files changed, 7 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index 3d71bfd..9227f90 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -162,7 +162,7 @@ struct tevent_fd {
 	const char *handler_name;
 	const char *location;
 	/* this is private for the events_ops implementation */
-	uint16_t additional_flags;
+	uint64_t additional_flags;
 	void *additional_data;
 };
 
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c
index cda028a..712255b 100644
--- a/lib/tevent/tevent_poll.c
+++ b/lib/tevent/tevent_poll.c
@@ -35,7 +35,7 @@ struct poll_event_context {
 	 */
 	struct pollfd *fds;
 	struct tevent_fd **fd_events;
-	int num_fds;
+	uint64_t num_fds;
 
 	/* information for exiting from the event loop */
 	int exit_code;
@@ -64,7 +64,7 @@ static int poll_event_fd_destructor(struct tevent_fd *fde)
 	struct tevent_context *ev = fde->event_ctx;
 	struct poll_event_context *poll_ev = NULL;
 	struct tevent_fd *moved_fde;
-	long del_idx;
+	uint64_t del_idx = fde->additional_flags;
 
 	if (ev == NULL) {
 		goto done;
@@ -73,15 +73,10 @@ static int poll_event_fd_destructor(struct tevent_fd *fde)
 	poll_ev = talloc_get_type_abort(
 		ev->additional_data, struct poll_event_context);
 
-	/*
-	 * Assume a void * can carry enough bits to hold num_fds.
-	 */
-	del_idx = (long)(fde->additional_data);
-
 	moved_fde = poll_ev->fd_events[poll_ev->num_fds-1];
 	poll_ev->fd_events[del_idx] = moved_fde;
 	poll_ev->fds[del_idx] = poll_ev->fds[poll_ev->num_fds-1];
-	moved_fde->additional_data = (void *)del_idx;
+	moved_fde->additional_flags = del_idx;
 
 	poll_ev->num_fds -= 1;
 done:
@@ -149,10 +144,7 @@ static struct tevent_fd *poll_event_add_fd(struct tevent_context *ev,
 		pfd->events |= (POLLOUT);
 	}
 
-	/*
-	 * Assume a void * can carry enough bits to hold num_fds.
-	 */
-	fde->additional_data = (void *)(long)poll_ev->num_fds;
+	fde->additional_flags = poll_ev->num_fds;
 	poll_ev->fd_events[poll_ev->num_fds] = fde;
 
 	poll_ev->num_fds += 1;
@@ -169,7 +161,7 @@ static void poll_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
 {
 	struct poll_event_context *poll_ev = talloc_get_type_abort(
 		fde->event_ctx->additional_data, struct poll_event_context);
-	long idx;
+	uint64_t idx = fde->additional_flags;
 	uint16_t pollflags = 0;
 
 	if (flags & TEVENT_FD_READ) {
@@ -179,7 +171,6 @@ static void poll_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags)
 		pollflags |= (POLLOUT);
 	}
 
-	idx = (long)(fde->additional_data);
 	poll_ev->fds[idx].events = pollflags;
 
 	fde->flags = flags;
@@ -237,11 +228,9 @@ static int poll_event_loop_poll(struct tevent_context *ev,
 		   the handler to remove itself when called */
 		for (fde = ev->fd_events; fde; fde = fde->next) {
 			struct pollfd *pfd;
-			long pfd_idx;
+			uint64_t pfd_idx = fde->additional_flags;
 			uint16_t flags = 0;
 
-			pfd_idx = (long)(fde->additional_data);
-
 			pfd = &poll_ev->fds[pfd_idx];
 
 			if (pfd->revents & (POLLIN|POLLHUP|POLLERR)) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list