From: Luiz Capitulino <lcapitulino@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-char: Introduce Buffered driver
Date: Wed, 10 Nov 2010 11:43:52 -0200 [thread overview]
Message-ID: <20101110114352.3f1a28ca@doriath> (raw)
In-Reply-To: <m339r9e210.fsf@blackfin.pond.sub.org>
On Wed, 10 Nov 2010 14:33:47 +0100
Markus Armbruster <armbru@redhat.com> wrote:
> Luiz Capitulino <lcapitulino@redhat.com> writes:
>
> > On Wed, 10 Nov 2010 13:56:39 +0100
> > Markus Armbruster <armbru@redhat.com> wrote:
> >
> >> Luiz Capitulino <lcapitulino@redhat.com> writes:
> >>
> >> > On Wed, 10 Nov 2010 10:26:15 +0100
> >> > Markus Armbruster <armbru@redhat.com> wrote:
> [...]
> >> >> Unlike normal character drivers, this one can't be closed with
> >> >> qemu_chr_close(), can it? What happens if someone calls
> >> >> qemu_chr_close() on it?
> >> >
> >> > I guess it will explode, because this driver is not in the chardevs list
> >> > and our CharDriverState instance is allocated on the stack.
> >> >
> >> > Does a function comment solves the problem or do you have something else
> >> > in mind?
> >>
> >> A general OO rule: Having different constructors for different sub-types
> >> is okay, but once constructed, you should be able to use the objects
> >> without knowing of what sub-type they are. That includes destruction.
> >
> > We will have to add our MemoryDriver to the chardevs list, this has some
> > implications like being visible in qemu_chr_info() and qemu_chr_find(),
> > likely to also imply that we should choose a chr->filename.
>
> Not if we formalize the notion of an "internal use only" character
> device. Say, !chr->filename means it's internal, and internal ones
> aren't in chardevs. Make qemu_chr_close()'s QTAILQ_REMOVE() conditional
> !chr->filename.
Yes, it's doable. But this kind of change will make this series intrusive,
for example, is it really impossible to create !chr->filename via the
normal means (eg. from the user)? What if we break something else with this
change?
> > Another detail is that we'll have to dynamically alocate our CharDriverState
> > instance. Not a problem, but adds a few more lines of code and a
> > qemu_free(). None of this is needed today.
>
> I doubt the alloc/free matters.
>
> > Really worth it?
>
> Your call.
I don't think so, unless we have a real need for it (and this can be done
later anyway).
> But if you decide not to, please add a suitable assertion to
> qemu_chr_close(), to make it obvious what went wrong when an internal
> character device explodes there.
>
> >> Exceptions prove the rule. Maybe this is one, maybe not.
> [...]
>
next prev parent reply other threads:[~2010-11-10 13:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-25 20:06 [Qemu-devel] [RFC 0/2]: QMP: Human Monitor passthrough Luiz Capitulino
2010-10-25 20:06 ` [Qemu-devel] [PATCH 1/2] qemu-char: Introduce Buffered driver Luiz Capitulino
2010-11-10 9:26 ` Markus Armbruster
2010-11-10 12:32 ` Luiz Capitulino
2010-11-10 12:56 ` Markus Armbruster
2010-11-10 13:12 ` Luiz Capitulino
2010-11-10 13:33 ` Markus Armbruster
2010-11-10 13:43 ` Luiz Capitulino [this message]
2010-10-25 20:06 ` [Qemu-devel] [PATCH 2/2] QMP: Introduce Human Monitor passthrough command Luiz Capitulino
2010-11-10 10:03 ` Markus Armbruster
2010-11-10 12:42 ` Luiz Capitulino
2010-10-27 19:37 ` [Qemu-devel] [RFC 0/2]: QMP: Human Monitor passthrough Anthony Liguori
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=20101110114352.3f1a28ca@doriath \
--to=lcapitulino@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.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).