[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API
From: |
Amit Shah |
Subject: |
Re: [Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API |
Date: |
Tue, 22 Feb 2011 20:09:02 +0530 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On (Tue) 22 Feb 2011 [15:28:02], Avi Kivity wrote:
> On 02/22/2011 12:18 PM, Amit Shah wrote:
> >Introduce a new iohandler api that doesn't have multiple callbacks.
> >Instead, a single callback and a mask of events that got set will be
> >passed on to the handler. This will ease our transition to a poll()
> >interface instead of the current select() that happens on the fds.
> >
> >
> >+
> >+/* iohandler masks */
> >+#define IOH_MASK_CAN_READ (1U<< 0)
> >+#define IOH_MASK_READ (1U<< 1)
> >+#define IOH_MASK_WRITE (1U<< 2)
> >+
> >+typedef int IOAllHandler(void *opaque, unsigned int mask);
>
> Strange name.
IOHandler is taken. I plan to switch back to IOHandler when the older
one is removed.
> Drop the opaque, instead put the IOHandler in there (or maybe the
> CharDev?) and use container_of().
Can put the IOHandler there; the chardev is just one user of
iohandlers, and there are others.
> >+
> >+int assign_iohandler(int fd, IOAllHandler *handler, unsigned int mask,
> >+ void *opaque);
> >+int remove_iohandler(int fd);
> >+int update_fd_mask(int fd, unsigned int mask);
> >+int get_fd_mask(int fd, unsigned int *mask);
> >+
>
> iohandler_init(IOHandler *ioh, int fd, IOEventHandler *handler,
> unsigned mask)
> iohandler_del(IOHandler *ioh)
> iohandler_set_event_mask(IOHandler *ioh, unsigned mask)
> iohandler_event_mask(IOHandler *ioh)
>
> No opaques, use an object as a key so you don't have to search for it.
Thanks!
Amit
- [Qemu-devel] [PATCH 1/7] iohandlers: Mark current implementation as 'old', (continued)
[Qemu-devel] [PATCH 2/7] iohandlers: Introduce a new API, Amit Shah, 2011/02/22
[Qemu-devel] Re: [PATCH 2/7] iohandlers: Introduce a new API, Anthony Liguori, 2011/02/22
[Qemu-devel] [PATCH 3/7] char: tcp: Use new iohandler api, Amit Shah, 2011/02/22
[Qemu-devel] [PATCH 4/7] char: udp: Use new iohandler api, Amit Shah, 2011/02/22
[Qemu-devel] [PATCH 5/7] char: fd: Use new iohandler api, Amit Shah, 2011/02/22
[Qemu-devel] [PATCH 6/7] char: stdio: Use new iohandler api, Amit Shah, 2011/02/22
[Qemu-devel] [PATCH 7/7] char: pty: Use new iohandler api, Amit Shah, 2011/02/22