From: Amit Shah <amit.shah@redhat.com>
To: Kusanagi Kouichi <slash@ac.auone-net.jp>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] char: Allow devices to use a single multiplexed chardev.
Date: Mon, 25 Apr 2011 15:27:20 +0530 [thread overview]
Message-ID: <20110425095720.GA8308@amit-x200.redhat.com> (raw)
In-Reply-To: <20110422125943.2F24E6FC039@msa105.auone-net.jp>
On (Fri) 22 Apr 2011 [21:59:42], Kusanagi Kouichi wrote:
> This fixes regression caused by commit
> 2d6c1ef40f3678ab47a4d14fb5dadaa486bfcda6
> ("char: Prevent multiple devices opening same chardev").
What's the regression? How do I test it?
> Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
> ---
> hw/qdev-properties.c | 4 ++--
> qemu-char.c | 5 ++++-
> qemu-char.h | 2 +-
> 3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index 1088a26..0eed712 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -354,10 +354,10 @@ static int parse_chr(DeviceState *dev, Property *prop, const char *str)
> if (*ptr == NULL) {
> return -ENOENT;
> }
> - if ((*ptr)->assigned) {
> + if ((*ptr)->avail < 1) {
> return -EEXIST;
> }
> - (*ptr)->assigned = 1;
> + --(*ptr)->avail;
> return 0;
> }
>
> diff --git a/qemu-char.c b/qemu-char.c
> index 03858d4..f08f2b8 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -199,7 +199,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
> {
> if (!opaque) {
> /* chr driver being released. */
> - s->assigned = 0;
> + ++s->avail;
> }
Will just checking for handlers (fd_can_read, fd_read, fd_write not
NULL) here help instead of this patch?
> s->chr_can_read = fd_can_read;
> s->chr_read = fd_read;
> @@ -2544,7 +2544,10 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
> snprintf(base->label, len, "%s-base", qemu_opts_id(opts));
> chr = qemu_chr_open_mux(base);
> chr->filename = base->filename;
> + chr->avail = MAX_MUX;
> QTAILQ_INSERT_TAIL(&chardevs, chr, next);
> + } else {
> + chr->avail = 1;
> }
> chr->label = qemu_strdup(qemu_opts_id(opts));
> return chr;
> diff --git a/qemu-char.h b/qemu-char.h
> index fb96eef..ebf3641 100644
> --- a/qemu-char.h
> +++ b/qemu-char.h
> @@ -70,7 +70,7 @@ struct CharDriverState {
> char *label;
> char *filename;
> int opened;
> - int assigned; /* chardev assigned to a device */
> + int avail;
> QTAILQ_ENTRY(CharDriverState) next;
> };
>
> --
> 1.7.4.4
>
>
Amit
next prev parent reply other threads:[~2011-04-25 9:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-22 12:59 [Qemu-devel] [PATCH] char: Allow devices to use a single multiplexed chardev Kusanagi Kouichi
2011-04-25 9:57 ` Amit Shah [this message]
2011-04-25 15:30 ` Kusanagi Kouichi
2011-04-26 4:32 ` Amit Shah
-- strict thread matches above, loose matches on Subject: below --
2011-04-26 10:19 Kusanagi Kouichi
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=20110425095720.GA8308@amit-x200.redhat.com \
--to=amit.shah@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=slash@ac.auone-net.jp \
/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).