From patchwork Thu Jan 23 11:57:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 1227970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fkXNfb8H; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 483Nfn4sz5z9sSL for ; Fri, 24 Jan 2020 00:39:29 +1100 (AEDT) Received: from localhost ([::1]:57152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuchj-0007ug-9v for incoming@patchwork.ozlabs.org; Thu, 23 Jan 2020 08:39:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40475) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iub90-0002IC-P2 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 06:59:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iub8z-00057p-BA for qemu-devel@nongnu.org; Thu, 23 Jan 2020 06:59:30 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:47023 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iub8z-00057R-7V for qemu-devel@nongnu.org; Thu, 23 Jan 2020 06:59:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579780768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lj9ybDQyvN3fBqhUPDkPLVFN9fpotOGLEAZ1wOYsfuk=; b=fkXNfb8H9tN+U0l/GtMTlGNqnY4xBt3Hjxe/T5947LbgOHSij3IPu7fEKFtXMg63Ken4Os hwoI+MKwwUfRtgBUEz5GNJq7/62FtHVXT2Elny9Qv5qs9LqDvMCVZlqhgcdMQ+AIaWUazn 2Iq7EM4vOf01q4860Ulpiat1aT2SchE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-180-2kWfQZWEMPmG7r4UG4AMOg-1; Thu, 23 Jan 2020 06:59:27 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5CA8B8010C9 for ; Thu, 23 Jan 2020 11:59:26 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.36.118.0]) by smtp.corp.redhat.com (Postfix) with ESMTP id A45841CB; Thu, 23 Jan 2020 11:59:25 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, stefanha@redhat.com Subject: [PULL 032/111] virtiofsd: add --print-capabilities option Date: Thu, 23 Jan 2020 11:57:22 +0000 Message-Id: <20200123115841.138849-33-dgilbert@redhat.com> In-Reply-To: <20200123115841.138849-1-dgilbert@redhat.com> References: <20200123115841.138849-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: 2kWfQZWEMPmG7r4UG4AMOg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi Add the --print-capabilities option as per vhost-user.rst "Backend programs conventions". Currently there are no advertised features. Signed-off-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrangé Signed-off-by: Dr. David Alan Gilbert --- docs/interop/vhost-user.json | 4 +++- tools/virtiofsd/fuse_lowlevel.h | 1 + tools/virtiofsd/helper.c | 2 ++ tools/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 ce0ef74db5..ef8ac5941f 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/tools/virtiofsd/fuse_lowlevel.h b/tools/virtiofsd/fuse_lowlevel.h index f6b34700af..0d61df8110 100644 --- a/tools/virtiofsd/fuse_lowlevel.h +++ b/tools/virtiofsd/fuse_lowlevel.h @@ -1794,6 +1794,7 @@ struct fuse_cmdline_opts { int nodefault_subtype; int show_version; int show_help; + int print_capabilities; unsigned int max_idle_threads; }; diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c index a3645fc807..b8ec5ac8dc 100644 --- a/tools/virtiofsd/helper.c +++ b/tools/virtiofsd/helper.c @@ -40,6 +40,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), @@ -135,6 +136,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" " -f foreground operation\n" " --daemonize run in background\n" diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c index 037c5d7b26..cd27c09f59 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -1298,6 +1298,14 @@ static struct fuse_lowlevel_ops lo_oper = { .lseek = lo_lseek, }; +/* 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); @@ -1328,6 +1336,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) {