qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu list <qemu-devel@nongnu.org>, Paul Brook <paul@codesourcery.com>
Subject: [Qemu-devel] Re: [PATCH 2/5] char: Introduce char_set/remove_fd_handlers()
Date: Tue, 11 Jan 2011 22:53:05 +0530	[thread overview]
Message-ID: <20110111172305.GB4092@amit-x200.redhat.com> (raw)
In-Reply-To: <4D2C7D48.6060000@redhat.com>

On (Tue) Jan 11 2011 [16:54:48], Gerd Hoffmann wrote:
> On 01/11/11 16:38, Amit Shah wrote:
> >On (Tue) Jan 11 2011 [15:39:46], Gerd Hoffmann wrote:
> >>On 01/11/11 12:10, Amit Shah wrote:
> >>>Introduce a char-specific wrapper to qemu_set_fd_handler functions.
> >>>This wrapper is useful to add / remove a write handler easily.  Write
> >>>handlers are only used when the backend is blocked and cannot receive
> >>>any more input.
> >>
> >>I'd suggest to add flags to enable/disable handlers to
> >>IOHandlerRecord instead.  And helper functions to set/clear them of
> >>course.
> >>
> >>With that in place you also can move the handlers to a separate
> >>struct simliar to the new QemuChrHandlers struct from patch #1.
> >
> >I'm planning to do that later -- when more backends get involved, which
> >have multiple fds (one for in, one for out).
> 
> Moving the handlers to a separate struct is clearly a incremental
> cleanup which can follow later.  Using enable/disable flags will
> probably simplify the interfaces for the non-blocking mode and thus
> simplify the whole patch series so I think this should be done now.

Agree -- but it looks to be a big patch.  I have some initial work done,
and hence am not converting anything other than unix/tcp backends.  The
proposed interface here is local to this file, and just a couple of
callers.  No big deal to change it once this is in.

(The struct for that will look like:

struct fd_handler {
	int fd;

	IOHandler *read;
	IOHandler *write;
	IOCanReadHandler *read_poll;

	bool read_enabled, write_enabled, read_poll_enabled;

	void (*set_read_handler)(IOHandler *read_handler);
	void (*set_write_handler)(IOHandler *write_handler);
	void (*set_readpoll_handler)(IOCanReadHandler *read_poll_handler);
}

This has to be embedded in the CharDriverState for each fd for each
backend.

Also: we also want to be able to select() on all fds so that we can
detect disconnection events as they happen.  So we also need an array
somewhere.)

		Amit

  reply	other threads:[~2011-01-11 17:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11 11:10 [Qemu-devel] [PATCH v9 0/5] char: Add support for nonblocking writes Amit Shah
2011-01-11 11:10 ` [Qemu-devel] [PATCH 1/5] char: Add a QemuChrHandlers struct to initialise chardev handlers Amit Shah
2011-01-11 14:17   ` [Qemu-devel] " Gerd Hoffmann
2011-01-11 17:13   ` [Qemu-devel] " Blue Swirl
2011-01-12  6:07     ` Amit Shah
2011-01-12 18:01       ` Michael Roth
2011-01-12 19:03         ` Blue Swirl
2011-01-13  6:14           ` Amit Shah
2011-01-13 21:29             ` Blue Swirl
2011-01-11 11:10 ` [Qemu-devel] [PATCH 2/5] char: Introduce char_set/remove_fd_handlers() Amit Shah
2011-01-11 14:39   ` [Qemu-devel] " Gerd Hoffmann
2011-01-11 15:38     ` Amit Shah
2011-01-11 15:54       ` Gerd Hoffmann
2011-01-11 17:23         ` Amit Shah [this message]
2011-01-12  9:11           ` Gerd Hoffmann
2011-01-11 11:10 ` [Qemu-devel] [PATCH 3/5] char: Add framework for a 'write unblocked' callback Amit Shah
2011-01-11 14:43   ` [Qemu-devel] " Gerd Hoffmann
2011-01-11 11:10 ` [Qemu-devel] [PATCH 4/5] char: Update send_all() to handle nonblocking chardev write requests Amit Shah
2011-01-11 11:10 ` [Qemu-devel] [PATCH 5/5] char: Equip the unix/tcp backend to handle nonblocking writes Amit Shah
2011-01-11 13:38   ` [Qemu-devel] " Paolo Bonzini
2011-01-12  6:16     ` Amit Shah

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=20110111172305.GB4092@amit-x200.redhat.com \
    --to=amit.shah@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).