From nobody Mon Feb 9 12:25:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571317775; cv=none; d=zoho.com; s=zohoarc; b=OTx0Zp+XLwU8+zK6SDT5IDNTOEJqETFlT7ZqBE5r5QhIcEpaoR09eMZ6gvJmQbMWHx2RbdBgWin/QF/dcK881zs5MXnDgu9mjyMSHWh/xCQj8uHJbOHVYbHIFDZ9/3FLzGNzHn3CRk5HBadRS8sotJKQ5fM4kjJDth9JP6/9OhI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571317775; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LHis4pO6JS8mdEa0E41BiVLfotAVdHz7bzr0XJ4Igzg=; b=a4Q2BbebaT2XyDBNHoGmQswofyc6KgAkoLlwc2hca0n9TckSvoFwQwslL8UU9+Jy/96L27yQTqENKANvssXiiWelZcAZqkxnZ0C/vf249bShiQ9RjhpmPmWA/2T+PqYSJl6mI009UOa7lAeB0TbYRMeOfzG4kM5c5nmtzRZpZ/0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571317775135554.9176900238032; Thu, 17 Oct 2019 06:09:35 -0700 (PDT) Received: from localhost ([::1]:46880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5X3-0007Tz-Mn for importer@patchew.org; Thu, 17 Oct 2019 09:09:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59857) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5S0-0000ZQ-Ra for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:04:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL5Rz-0008Nu-Dk for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:04:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39872) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iL5Rw-0008Lb-AL; Thu, 17 Oct 2019 09:04:16 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89F7C19D04A; Thu, 17 Oct 2019 13:04:15 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-24.ams2.redhat.com [10.36.117.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 097521001B11; Thu, 17 Oct 2019 13:04:13 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Subject: [RFC PATCH 05/18] qemu-storage-daemon: Add --blockdev option Date: Thu, 17 Oct 2019 15:01:51 +0200 Message-Id: <20191017130204.16131-6-kwolf@redhat.com> In-Reply-To: <20191017130204.16131-1-kwolf@redhat.com> References: <20191017130204.16131-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 17 Oct 2019 13:04:15 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 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: , Cc: kwolf@redhat.com, pkrempa@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This adds a --blockdev option to the storage daemon that works the same as the -blockdev option of the system emulator. In order to be able to link with blockdev.o, we also need to change stream.o from common-obj to block-obj, which is where all other block jobs already are. Signed-off-by: Kevin Wolf --- qemu-storage-daemon.c | 29 +++++++++++++++++++++++++++++ Makefile | 5 ++++- Makefile.objs | 7 +++++++ block/Makefile.objs | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/qemu-storage-daemon.c b/qemu-storage-daemon.c index 48d6af43a6..904e3c3a46 100644 --- a/qemu-storage-daemon.c +++ b/qemu-storage-daemon.c @@ -28,6 +28,10 @@ #include "crypto/init.h" =20 #include "qapi/error.h" +#include "qapi/qapi-visit-block-core.h" +#include "qapi/qapi-commands-block-core.h" +#include "qapi/qobject-input-visitor.h" + #include "qemu-common.h" #include "qemu-version.h" #include "qemu/config-file.h" @@ -53,6 +57,13 @@ static void help(void) " specify tracing options\n" " -V, --version output version information and exit\n" "\n" +" --blockdev [driver=3D][,node-name=3D][,discard=3Dignore|unma= p]\n" +" [,cache.direct=3Don|off][,cache.no-flush=3Don|off]\n" +" [,read-only=3Don|off][,auto-read-only=3Don|off]\n" +" [,force-share=3Don|off][,detect-zeroes=3Don|off|unmap]\n" +" [,driver specific parameters...]\n" +" configure a block backend\n" +"\n" " --object define a QOM object such as 'secret' for\n" " passwords and/or encryption keys\n" "\n" @@ -62,6 +73,7 @@ QEMU_HELP_BOTTOM "\n", =20 enum { OPTION_OBJECT =3D 256, + OPTION_BLOCKDEV, }; =20 static QemuOptsList qemu_object_opts =3D { @@ -82,6 +94,7 @@ static int process_options(int argc, char *argv[], Error = **errp) static const struct option long_options[] =3D { {"help", no_argument, 0, 'h'}, {"object", required_argument, 0, OPTION_OBJECT}, + {"blockdev", required_argument, 0, OPTION_BLOCKDEV}, {"version", no_argument, 0, 'V'}, {"trace", required_argument, NULL, 'T'}, {0, 0, 0, 0} @@ -123,6 +136,22 @@ static int process_options(int argc, char *argv[], Err= or **errp) qemu_opts_del(opts); break; } + break; + case OPTION_BLOCKDEV: + { + Visitor *v; + BlockdevOptions *options; + + v =3D qobject_input_visitor_new_str(optarg, "driver", + &error_fatal); + + visit_type_BlockdevOptions(v, NULL, &options, &error_fatal= ); + visit_free(v); + + qmp_blockdev_add(options, &error_fatal); + qapi_free_BlockdevOptions(options); + break; + } } } if (optind !=3D argc) { diff --git a/Makefile b/Makefile index 76338d0ab4..b913d4d736 100644 --- a/Makefile +++ b/Makefile @@ -432,6 +432,8 @@ dummy :=3D $(call unnest-vars,, \ qga-vss-dll-obj-y \ block-obj-y \ block-obj-m \ + storage-daemon-obj-y \ + storage-daemon-obj-m \ crypto-obj-y \ crypto-user-obj-y \ qom-obj-y \ @@ -469,6 +471,7 @@ TARGET_DIRS_RULES :=3D $(foreach t, all clean install, = $(addsuffix /$(t), $(TARGET SOFTMMU_ALL_RULES=3D$(filter %-softmmu/all, $(TARGET_DIRS_RULES)) $(SOFTMMU_ALL_RULES): $(authz-obj-y) $(SOFTMMU_ALL_RULES): $(block-obj-y) +$(SOFTMMU_ALL_RULES): $(storage-daemon-obj-y) $(SOFTMMU_ALL_RULES): $(chardev-obj-y) $(SOFTMMU_ALL_RULES): $(crypto-obj-y) $(SOFTMMU_ALL_RULES): $(io-obj-y) @@ -558,7 +561,7 @@ qemu-img.o: qemu-img-cmds.h qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y= ) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y= ) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) = $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) -qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block= -obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) +qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block= -obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(storage-daemon-obj-y) $(= COMMON_LDADDS) =20 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS) =20 diff --git a/Makefile.objs b/Makefile.objs index abcbd89654..00fdf54500 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -37,6 +37,13 @@ qom-obj-y =3D qom/ =20 io-obj-y =3D io/ =20 +####################################################################### +# storage-daemon-obj-y is code used by qemu-storage-daemon (these objects = are +# used for system emulation, too, but specified separately there) + +storage-daemon-obj-y =3D block/ +storage-daemon-obj-y +=3D blockdev.o iothread.o + ###################################################################### # Target independent part of system emulation. The long term path is to # suppress *all* target specific code in case of system emulation, i.e. a diff --git a/block/Makefile.objs b/block/Makefile.objs index e394fe0b6c..d24fc93b7f 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -44,7 +44,7 @@ block-obj-y +=3D crypto.o block-obj-y +=3D aio_task.o block-obj-y +=3D backup-top.o =20 -common-obj-y +=3D stream.o +block-obj-y +=3D stream.o =20 nfs.o-libs :=3D $(LIBNFS_LIBS) iscsi.o-cflags :=3D $(LIBISCSI_CFLAGS) --=20 2.20.1