From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>,
Paul Brook <paul@codesourcery.com>,
Gerd Hoffmann <kraxel@redhat.com>,
qemu list <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1/5] char: Add a QemuChrHandlers struct to initialise chardev handlers
Date: Wed, 12 Jan 2011 12:01:03 -0600 [thread overview]
Message-ID: <4D2DEC5F.6050708@linux.vnet.ibm.com> (raw)
In-Reply-To: <20110112060743.GB12381@amit-x200.redhat.com>
On 01/12/2011 12:07 AM, Amit Shah wrote:
> On (Tue) Jan 11 2011 [17:13:15], Blue Swirl wrote:
>>> +static QemuChrHandlers gdb_handlers = {
>>> + .fd_can_read = gdb_chr_can_receive,
>>> + .fd_read = gdb_chr_receive,
>>> + .fd_event = gdb_chr_event,
>>> +};
>>
>> These structures should be const.
>
> Hm, I had that but looks like it got lost in some rebase. Added again.
>
>>> @@ -190,15 +190,19 @@ void qemu_chr_send_event(CharDriverState *s, int event)
>>> s->chr_send_event(s, event);
>>> }
>>>
>>> +static QemuChrHandlers null_handlers = {
>>> + /* All handlers are initialised to NULL */
>>> +};
>>> +
>>> void qemu_chr_add_handlers(CharDriverState *s,
>>> - IOCanReadHandler *fd_can_read,
>>> - IOReadHandler *fd_read,
>>> - IOEventHandler *fd_event,
>>> - void *opaque)
>>> -{
>>> - s->chr_can_read = fd_can_read;
>>> - s->chr_read = fd_read;
>>> - s->chr_event = fd_event;
>>> + QemuChrHandlers *handlers, void *opaque)
>>> +{
>>
>> Here we could also check if (!s) and return if so. This would simplify
>> the callers a bit.
>
> Simplified in what way?
I assume for reducing the need to have to check s->chr != NULL everytime
beforehand. It's safer and would save a lot on repetitive code as well.
>
> Amit
>
next prev parent reply other threads:[~2011-01-12 18:01 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 [this message]
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
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=4D2DEC5F.6050708@linux.vnet.ibm.com \
--to=mdroth@linux.vnet.ibm.com \
--cc=amit.shah@redhat.com \
--cc=blauwirbel@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.