From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Alexander Bulekov <alxndr@bu.edu>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
qemu-devel@nongnu.org, stefanha@redhat.com,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH] chardev: enable distinct input for -chardev file
Date: Mon, 4 May 2020 10:34:23 +0100 [thread overview]
Message-ID: <20200504093423.GF115875@redhat.com> (raw)
In-Reply-To: <20200501172559.6470-1-alxndr@bu.edu>
On Fri, May 01, 2020 at 01:25:59PM -0400, Alexander Bulekov wrote:
> char-file already supports distinct paths for input/output but it was
> only possible to specify a distinct input through QMP. With this change,
> we can also specify a distinct input with the -chardev file argument:
> qemu -chardev file,id=char1,path=/out/file,in=/in/file
>
> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> ---
> chardev/char-file.c | 5 +++++
> chardev/char.c | 3 +++
> qemu-options.hx | 7 +++++--
> 3 files changed, 13 insertions(+), 2 deletions(-)
>
> The naming here is awkward, with path= really turning into "out" when
> in= is specified, though i'm not sure about what is a good solution.
>
> diff --git a/chardev/char-file.c b/chardev/char-file.c
> index 2fd80707e5..cc742cc234 100644
> --- a/chardev/char-file.c
> +++ b/chardev/char-file.c
> @@ -100,6 +100,7 @@ static void qemu_chr_parse_file_out(QemuOpts *opts, ChardevBackend *backend,
> Error **errp)
> {
> const char *path = qemu_opt_get(opts, "path");
> + const char *in = qemu_opt_get(opts, "in");
> ChardevFile *file;
>
> backend->type = CHARDEV_BACKEND_KIND_FILE;
> @@ -110,6 +111,10 @@ static void qemu_chr_parse_file_out(QemuOpts *opts, ChardevBackend *backend,
> file = backend->u.file.data = g_new0(ChardevFile, 1);
> qemu_chr_parse_common(opts, qapi_ChardevFile_base(file));
> file->out = g_strdup(path);
> + if (in) {
> + file->has_in = true;
> + file->in = g_strdup(qemu_opt_get(opts, "in"));
> + }
>
> file->has_append = true;
> file->append = qemu_opt_get_bool(opts, "append", false);
> diff --git a/chardev/char.c b/chardev/char.c
> index e77564060d..797574f205 100644
> --- a/chardev/char.c
> +++ b/chardev/char.c
> @@ -849,6 +849,9 @@ QemuOptsList qemu_chardev_opts = {
> },{
> .name = "path",
> .type = QEMU_OPT_STRING,
> + },{
> + .name = "in",
> + .type = QEMU_OPT_STRING,
> },{
> .name = "host",
> .type = QEMU_OPT_STRING,
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 292d4e7c0c..bbb091872f 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2938,7 +2938,7 @@ DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
> "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n"
> " [,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
> "-chardev ringbuf,id=id[,size=size][,logfile=PATH][,logappend=on|off]\n"
> - "-chardev file,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
> + "-chardev file,id=id,path=path[,in=PATH][,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
> "-chardev pipe,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
> #ifdef _WIN32
> "-chardev console,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
> @@ -3137,13 +3137,16 @@ The available backends are:
> Create a ring buffer with fixed size ``size``. size must be a power
> of two and defaults to ``64K``.
>
> -``-chardev file,id=id,path=path``
> +``-chardev file,id=id,path=path,in=in``
> Log all traffic received from the guest to a file.
>
> ``path`` specifies the path of the file to be opened. This file will
> be created if it does not already exist, and overwritten if it does.
> ``path`` is required.
>
> + ``in`` specifies a separate file as the input to the chardev. If
> + ``in`` is omitted, ``path`` is used for both input and output
I'd suggest "pathin" rather than just "in"
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2020-05-04 9:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-01 17:25 [PATCH] chardev: enable distinct input for -chardev file Alexander Bulekov
2020-05-01 17:34 ` Marc-André Lureau
2020-05-01 17:46 ` no-reply
2020-05-04 9:34 ` Daniel P. Berrangé [this message]
2020-05-04 13:40 ` Stefan Hajnoczi
2020-05-04 14:00 ` Alexander Bulekov
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=20200504093423.GF115875@redhat.com \
--to=berrange@redhat.com \
--cc=alxndr@bu.edu \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).