[dovecot-cvs] dovecot/src/lib ioloop-internal.h, 1.10, 1.11 ioloop-poll.c, 1.21, 1.22 ioloop-select.c, 1.16, 1.17 ioloop.c, 1.22, 1.23

cras at dovecot.org cras at dovecot.org
Mon Aug 23 16:47:34 EEST 2004


Update of /home/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv14139

Modified Files:
	ioloop-internal.h ioloop-poll.c ioloop-select.c ioloop.c 
Log Message:
Internal I/O loop API change in preparation for epoll support. Patch by
Andrey Panin.



Index: ioloop-internal.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/ioloop-internal.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ioloop-internal.h	7 Sep 2003 01:52:06 -0000	1.10
+++ ioloop-internal.h	23 Aug 2004 13:47:32 -0000	1.11
@@ -53,10 +53,8 @@
 void timeout_destroy(struct ioloop *ioloop, struct timeout **timeout_p);
 
 /* I/O handler calls */
-void io_loop_handle_add(struct ioloop *ioloop, int fd,
-			enum io_condition condition);
-void io_loop_handle_remove(struct ioloop *ioloop, int fd,
-			   enum io_condition condition);
+void io_loop_handle_add(struct ioloop *ioloop, struct io *io);
+void io_loop_handle_remove(struct ioloop *ioloop, struct io *io);
 
 void io_loop_handler_init(struct ioloop *ioloop);
 void io_loop_handler_deinit(struct ioloop *ioloop);

Index: ioloop-poll.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/ioloop-poll.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- ioloop-poll.c	26 Aug 2003 21:18:16 -0000	1.21
+++ ioloop-poll.c	23 Aug 2004 13:47:32 -0000	1.22
@@ -45,12 +45,12 @@
 #define IO_POLL_INPUT (POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL)
 #define IO_POLL_OUTPUT (POLLOUT|POLLERR|POLLHUP|POLLNVAL)
 
-void io_loop_handle_add(struct ioloop *ioloop, int fd,
-			enum io_condition condition)
+void io_loop_handle_add(struct ioloop *ioloop, struct io *io)
 {
 	struct ioloop_handler_data *data = ioloop->handler_data;
+	enum io_condition condition = io->condition;
 	unsigned int old_size;
-	int index;
+	int index, fd = io->fd;
 
 	if ((unsigned int) fd >= data->idx_size) {
                 /* grow the fd -> index array */
@@ -97,11 +97,11 @@
 		data->fds[index].events |= IO_POLL_OUTPUT;
 }
 
-void io_loop_handle_remove(struct ioloop *ioloop, int fd,
-			   enum io_condition condition)
+void io_loop_handle_remove(struct ioloop *ioloop,  struct io *io)
 {
 	struct ioloop_handler_data *data = ioloop->handler_data;
-	int index;
+	enum io_condition condition = io->condition;
+	int index, fd = io->fd;
 
 	index = data->fd_index[fd];
 	i_assert(index >= 0 && (unsigned int) index < data->fds_size);

Index: ioloop-select.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/ioloop-select.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- ioloop-select.c	26 Aug 2003 21:18:16 -0000	1.16
+++ ioloop-select.c	23 Aug 2004 13:47:32 -0000	1.17
@@ -30,9 +30,11 @@
         p_free(ioloop->pool, ioloop->handler_data);
 }
 
-void io_loop_handle_add(struct ioloop *ioloop, int fd,
-			enum io_condition condition)
+void io_loop_handle_add(struct ioloop *ioloop, struct io *io)
 {
+	enum io_condition condition = io->condition;
+	int fd = io->fd;
+
 	i_assert(fd >= 0);
 
 	if (fd >= FD_SETSIZE)
@@ -44,9 +46,11 @@
 		FD_SET(fd, &ioloop->handler_data->write_fds);
 }
 
-void io_loop_handle_remove(struct ioloop *ioloop, int fd,
-			   enum io_condition condition)
+void io_loop_handle_remove(struct ioloop *ioloop, struct io *io)
 {
+	enum io_condition condition = io->condition;
+	int fd = io->fd;
+
 	i_assert(fd >= 0 && fd < FD_SETSIZE);
 
         if (condition & IO_READ)

Index: ioloop.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/ioloop.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ioloop.c	19 Jun 2004 20:07:51 -0000	1.22
+++ ioloop.c	23 Aug 2004 13:47:32 -0000	1.23
@@ -56,7 +56,7 @@
 	if (io->fd > current_ioloop->highest_fd)
 		current_ioloop->highest_fd = io->fd;
 
-	io_loop_handle_add(current_ioloop, io->fd, io->condition);
+	io_loop_handle_add(current_ioloop, io);
 
 	/* have to append it, or io_destroy() breaks */
         io_p = &current_ioloop->ios;
@@ -79,7 +79,7 @@
 	i_assert(io->fd <= current_ioloop->highest_fd);
 
 	/* notify the real I/O handler */
-	io_loop_handle_remove(current_ioloop, io->fd, io->condition);
+	io_loop_handle_remove(current_ioloop, io);
 
 	io->destroyed = TRUE;
 



More information about the dovecot-cvs mailing list