qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: virtio-fs@redhat.com,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option
Date: Tue, 3 Sep 2019 18:26:44 +0100	[thread overview]
Message-ID: <20190903172644.GS2744@work-vm> (raw)
In-Reply-To: <20190827095437.18819-3-stefanha@redhat.com>

* Stefan Hajnoczi (stefanha@redhat.com) wrote:
> Add the --print-capabilities option as per vhost-user.rst "Backend
> programs conventions".  Currently there are no advertised features.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

That looks OK to me, but can someone who understands the json
requirement explain what says whether a 'features' entry is optional?

Dave

> ---
>  docs/interop/vhost-user.json       |  4 +++-
>  contrib/virtiofsd/fuse_lowlevel.h  |  1 +
>  contrib/virtiofsd/helper.c         |  2 ++
>  contrib/virtiofsd/passthrough_ll.c | 12 ++++++++++++
>  4 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/interop/vhost-user.json b/docs/interop/vhost-user.json
> index da6aaf51c8..d4ea1f7ac5 100644
> --- a/docs/interop/vhost-user.json
> +++ b/docs/interop/vhost-user.json
> @@ -31,6 +31,7 @@
>  # @rproc-serial: virtio remoteproc serial link
>  # @scsi: virtio scsi
>  # @vsock: virtio vsock transport
> +# @fs: virtio fs (since 4.2)
>  #
>  # Since: 4.0
>  ##
> @@ -50,7 +51,8 @@
>        'rpmsg',
>        'rproc-serial',
>        'scsi',
> -      'vsock'
> +      'vsock',
> +      'fs'
>    ]
>  }
>  
> diff --git a/contrib/virtiofsd/fuse_lowlevel.h b/contrib/virtiofsd/fuse_lowlevel.h
> index b441d3dfed..e3d8747571 100644
> --- a/contrib/virtiofsd/fuse_lowlevel.h
> +++ b/contrib/virtiofsd/fuse_lowlevel.h
> @@ -1796,6 +1796,7 @@ struct fuse_cmdline_opts {
>  	int nodefault_subtype;
>  	int show_version;
>  	int show_help;
> +	int print_capabilities;
>  	int clone_fd;
>  	int syslog;
>  	int log_level;
> diff --git a/contrib/virtiofsd/helper.c b/contrib/virtiofsd/helper.c
> index 8d8bca889b..84bf1c834d 100644
> --- a/contrib/virtiofsd/helper.c
> +++ b/contrib/virtiofsd/helper.c
> @@ -35,6 +35,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
>  	FUSE_HELPER_OPT("--help",	show_help),
>  	FUSE_HELPER_OPT("-V",		show_version),
>  	FUSE_HELPER_OPT("--version",	show_version),
> +	FUSE_HELPER_OPT("--print-capabilities", print_capabilities),
>  	FUSE_HELPER_OPT("-d",		debug),
>  	FUSE_HELPER_OPT("debug",	debug),
>  	FUSE_HELPER_OPT("-d",		foreground),
> @@ -137,6 +138,7 @@ void fuse_cmdline_help(void)
>  {
>  	printf("    -h   --help                print help\n"
>  	       "    -V   --version             print version\n"
> +	       "    --print-capabilities       print vhost-user.json\n"
>  	       "    -d   -o debug              enable debug output (implies -f)\n"
>  	       "    --syslog                   log to syslog (default stderr)\n"
>  	       "    -f                         foreground operation\n"
> diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
> index 0ef01b7e3f..e2e20f22cd 100644
> --- a/contrib/virtiofsd/passthrough_ll.c
> +++ b/contrib/virtiofsd/passthrough_ll.c
> @@ -2879,6 +2879,14 @@ static void fuse_lo_data_cleanup(struct lo_data *lo)
>          free((char *)lo->source);
>  }
>  
> +/* Print vhost-user.json backend program capabilities */
> +static void print_capabilities(void)
> +{
> +	printf("{\n");
> +	printf("  \"type\": \"fs\"\n");
> +	printf("}\n");
> +}
> +
>  int main(int argc, char *argv[])
>  {
>  	struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
> @@ -2931,6 +2939,10 @@ int main(int argc, char *argv[])
>  		fuse_lowlevel_version();
>  		ret = 0;
>  		goto err_out1;
> +	} else if (opts.print_capabilities) {
> +		print_capabilities();
> +		ret = 0;
> +		goto err_out1;
>  	}
>  
>  	if (fuse_opt_parse(&args, &lo, lo_opts, NULL)== -1)
> -- 
> 2.21.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


  reply	other threads:[~2019-09-03 17:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27  9:54 [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Stefan Hajnoczi
2019-08-27  9:54 ` [Qemu-devel] [PATCH 1/4] virtiofsd: make -f (foreground) the default Stefan Hajnoczi
2019-09-03 17:17   ` Dr. David Alan Gilbert
2019-08-27  9:54 ` [Qemu-devel] [PATCH 2/4] virtiofsd: add --print-capabilities option Stefan Hajnoczi
2019-09-03 17:26   ` Dr. David Alan Gilbert [this message]
2019-09-04 15:51     ` Stefan Hajnoczi
2019-09-12 11:12       ` Stefan Hajnoczi
2019-09-12 12:40   ` Marc-André Lureau
2019-08-27  9:54 ` [Qemu-devel] [PATCH 3/4] virtiofsd: install virtiofsd in libexec Stefan Hajnoczi
2019-09-03 17:29   ` Dr. David Alan Gilbert
2019-08-27  9:54 ` [Qemu-devel] [PATCH 4/4] virtiofsd: add vhost-user.json file Stefan Hajnoczi
2019-09-03 17:31   ` Dr. David Alan Gilbert
2019-09-03 17:32 ` [Qemu-devel] [PATCH 0/4] virtiofsd: implement vhost-user.rst "Backend program conventions" Dr. David Alan Gilbert

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=20190903172644.GS2744@work-vm \
    --to=dgilbert@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=virtio-fs@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).