From: Lei Li <lilei@linux.vnet.ibm.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] chardev: Get filename for new qapi backend
Date: Wed, 15 May 2013 15:26:07 +0800 [thread overview]
Message-ID: <5193388F.1020609@linux.vnet.ibm.com> (raw)
In-Reply-To: <51931F75.8040107@redhat.com>
On 05/15/2013 01:39 PM, Gerd Hoffmann wrote:
> On 05/15/13 05:52, Lei Li wrote:
>> This patch add the filename when the new qapi backend init from opts.
>>
>> Commit 2c5f488293c7d0cd095635c74157c2526e2c4947 add support for
>> qapi-based chardev initialization, but miss the filename of the
>> char device as below:
>>
>> (qemu) info chardev
>> parallel0: filename=(null)
>> serial0: filename=(null)
>> compat_monitor0: filename=(null)
>> @@ -3276,6 +3276,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
>> ChardevReturn *ret = NULL;
>> const char *id = qemu_opts_id(opts);
>> const char *bid = NULL;
>> + char *filename = g_strdup(qemu_opt_get(opts, "backend"));
>>
>> if (qemu_opt_get_bool(opts, "mux", 0)) {
>> bid = g_strdup_printf("%s-base", id);
>> @@ -3308,6 +3309,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
>> }
>>
>> chr = qemu_chr_find(id);
>> + chr->filename = filename;
> That should happen in qmp_chardev_add(), so filename is set consistently
> for every chardev no matter how it gets created.
Yeah, I was hesitant to add it here for that it does not looks very logical...
But I am not sure about the best place for it..
> Take care to not overwrite filename, some functions
> (qmp_chardev_open_socket for example) do set chr->filename already.
Yes, for the char device pipe, pty, socket, they set chr->filename in their
own open functions. But I think the overwrite will not happen because
it will not get "backend" by qemu_opt_get() for these chardevs.
>
> Maybe it's better to put that into the individual qmp_chardev_open_*
> functions anyway.
OK, I'll have a try and see if everyone like it, I don't have better idea.
>
> cheers,
> Gerd
>
>
>
--
Lei
next prev parent reply other threads:[~2013-05-15 7:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 3:52 [Qemu-devel] [PATCH] chardev: Get filename for new qapi backend Lei Li
2013-05-15 5:39 ` Gerd Hoffmann
2013-05-15 7:03 ` Lei Li
2013-05-15 7:26 ` Lei Li [this message]
2013-05-17 8:35 ` Lei Li
2013-05-22 22:59 ` 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=5193388F.1020609@linux.vnet.ibm.com \
--to=lilei@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=kraxel@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).