Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Np9XH-00022z-P9 for qemu-devel@nongnu.org; Tue, 09 Mar 2010 19:12:27 -0500 Received: from [199.232.76.173] (port=39359 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Np9XH-00021s-66 for qemu-devel@nongnu.org; Tue, 09 Mar 2010 19:12:27 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Np9XF-0003bl-PA for qemu-devel@nongnu.org; Tue, 09 Mar 2010 19:12:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34104) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Np9XF-0003bh-AN for qemu-devel@nongnu.org; Tue, 09 Mar 2010 19:12:25 -0500 From: Juan Quintela In-Reply-To: <4B96E0C3.4070903@codemonkey.ws> (Anthony Liguori's message of "Tue, 09 Mar 2010 17:58:59 -0600") References: <4B96E0C3.4070903@codemonkey.ws> Date: Wed, 10 Mar 2010 01:12:09 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH 0/9] Clear fd handlers List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org Anthony Liguori wrote: > On 03/09/2010 05:53 PM, malc wrote: >> On Tue, 9 Mar 2010, Juan Quintela wrote: >>> - convert io_handlers to one QLIST This part removes lines :) >>> - once there fix bt that don't need poll at all (having a poll function that always return true >>> is the equivalent of not having one). This one also removes lines. >>> - remove cast to (void *)(unsigned long) for things that already >>> were pointers Cleanup. same lines. >>> - IOCanRWHandler is only used for reads -> rename it (almost no users). cleanup. same lines. >>> ToDo: >>> - to remove the export of qemu_set_fd_handlers2() we need a solution for tap. >>> Tap is the only user in qemu that uses poll, read and write, and it changes in very imaginative >>> ways: >>> qemu_set_fd_handler2(s->fd, >>> s->read_poll ? tap_can_send : NULL, >>> s->read_poll ? tap_send : NULL, >>> s->write_poll ? tap_writable : NULL, >>> s); >>> >>> No ideas about how to transform this into something that don't use NULL's in any of its fields >>> other than a row of if's. for removing the poll function. I need some help here. >>> >>> - removal of poll function. comment of qemu_set_fd_handler2() >>> /* XXX: fd_read_poll should be suppressed, but an API change is >>> necessary in the character devices to suppress fd_can_read(). */ >>> >>> But qemu-char.c is a complex beast, and would preffer to 1st get this patches in, and then >>> work on the other stuff. on that one looking at it, but it has at least two indirections. Only 4 users left here. Will try to look at it. >>> >> What's the point if it ends up adding 48 lines of code? >> readability? I got confused continously with: qemu_set_fd_handler2(s->fd, NULL, foo, NULL, state); qemu_set_fd_handler2(s->fd, NULL, NULL, bar, state); And not all functions name make clear than foo means read and bar means write. > Yeah, I think this would be more interesting if it eliminated the > can_read handlers altogether. Fully, agree. Indirections of qemu-char.c are "interesting". tap is only user of poll, read and write and the only one that adds/remove functions continously. Was waiting for tips, hints, past ideas about how to remove that fd_can funtions. Regards, Juan.