From nobody Fri Dec 19 06:56:55 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1604878106; cv=none; d=zohomail.com; s=zohoarc; b=IuuGSrud8JpYN74SZ3FibS1SD//Y07QHR+2l9lch5uxiu+mS3/4fgMjJXyKKJBfEqXmdL9w+Cyz3Uu8HRnEN9QU5pIdtnTyvsy0Jsl/e8dGngei8NqeFyGq6p5lAFgan5sxJl3j47WeYdnARqTQsUZgEQCrMX84I+s2UHEIHkkU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604878106; 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=eTDNRgkwVFVIO6gfDAlg28i26N+Iawwag3UMxHNMUOo=; b=TZ1LjngCKM19icX3xOcwwb5jUQ/S5nBz5d5ov+dZTAA3Hmja+ChKApdqfp1RrajMp+mDvwv4i0sPnURxC0xCP3y5nuzGl65PxQU0kMtUxNaOq3AOWUr2iSbzuJx1yT0abXDuYlrWOjE7NZrjk9rZAwkO/wSxQ9dLc5sjC2VgdaM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604878106312539.9253983601377; Sun, 8 Nov 2020 15:28:26 -0800 (PST) Received: from localhost ([::1]:39312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kbu6j-0002cR-6V for importer@patchew.org; Sun, 08 Nov 2020 18:28:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kbu2y-0000lC-6W; Sun, 08 Nov 2020 18:24:32 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45187) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kbu2w-0000FN-HF; Sun, 08 Nov 2020 18:24:31 -0500 Received: by mail-pg1-f196.google.com with SMTP id 62so5230341pgg.12; Sun, 08 Nov 2020 15:24:29 -0800 (PST) Received: from localhost.localdomain ([73.93.154.215]) by smtp.gmail.com with ESMTPSA id z3sm8275171pgl.73.2020.11.08.15.24.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Nov 2020 15:24:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eTDNRgkwVFVIO6gfDAlg28i26N+Iawwag3UMxHNMUOo=; b=fCdr5u3B4kR7B2u6hwcAro5q6k/MXZ6ae8Tk4DWQoQ27nuquovu7s4nNZMFRkVW5Zh tG5wd7qJRZ3It//H5mkKPgjE1ZKKpVkdcmVAUKF/GMmqDh6UgzRdSOT8bVmv1rLkg8Zf bX8dLkuQg9EUGhScK7f4cdCmdRy0ALARvFD6eNuuCDOJIx1/zjuajFu2k1e1Isnm+1vT zDJ3USIYlv8YmdER2RDf83SMkyea2atcj5GhaLxeTbpAknX0RQtyM2Qq/B5kRUtEjEhU IBgIGlJGTDRhVVO5ccE+Zg5PGhz83mKcuYtQ21U8MUjRTd21VzhxJb9oQ4gXOsTBoC0U RGfw== X-Gm-Message-State: AOAM53003WFon/rZxBTXnN/OAU5rymQp1TrRXl+dRXkvOl3QdFgNP9uI n7BjxlP/bkHQk3lrivOD6YZEbVUcuk8= X-Google-Smtp-Source: ABdhPJzAmwZwiKBAmCqLw77426IMKrUqwxHuY/jI+c/8k6HlnAcDPZqfwKeOpjNR14vN2MJJKZ1Lxw== X-Received: by 2002:a63:4c12:: with SMTP id z18mr6379260pga.143.1604877868542; Sun, 08 Nov 2020 15:24:28 -0800 (PST) From: Joelle van Dyne To: qemu-devel@nongnu.org Subject: [PATCH v5 1/7] configure: option to disable host block devices Date: Sun, 8 Nov 2020 15:24:18 -0800 Message-Id: <20201108232425.1705-2-j@getutm.app> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201108232425.1705-1-j@getutm.app> References: <20201108232425.1705-1-j@getutm.app> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=209.85.215.196; envelope-from=osy86github@gmail.com; helo=mail-pg1-f196.google.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/08 18:24:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , "open list:raw" , Markus Armbruster , Max Reitz , Joelle van Dyne Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Some hosts (iOS) have a sandboxed filesystem and do not provide low-level APIs for interfacing with host block devices. Signed-off-by: Joelle van Dyne --- configure | 4 ++++ meson.build | 1 + qapi/block-core.json | 10 +++++++--- block/file-posix.c | 10 +++++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 2c3c69f118..97a879808d 100755 --- a/configure +++ b/configure @@ -448,6 +448,7 @@ meson=3D"" ninja=3D"" skip_meson=3Dno gettext=3D"" +host_block_device_support=3D"yes" =20 bogus_os=3D"no" malloc_trim=3D"auto" @@ -5907,6 +5908,9 @@ if test "$default_devices" =3D "yes" ; then else echo "CONFIG_MINIKCONF_MODE=3D--allnoconfig" >> $config_host_mak fi +if test "$host_block_device_support" =3D "yes" ; then + echo "CONFIG_HOST_BLOCK_DEVICE=3Dy" >> $config_host_mak +fi if test "$debug_tcg" =3D "yes" ; then echo "CONFIG_DEBUG_TCG=3Dy" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 39ac5cf6d8..fd822346e7 100644 --- a/meson.build +++ b/meson.build @@ -2166,6 +2166,7 @@ summary_info +=3D {'vvfat support': config_host.h= as_key('CONFIG_VVFAT')} summary_info +=3D {'qed support': config_host.has_key('CONFIG_QED')} summary_info +=3D {'parallels support': config_host.has_key('CONFIG_PARALL= ELS')} summary_info +=3D {'sheepdog support': config_host.has_key('CONFIG_SHEEPD= OG')} +summary_info +=3D {'host block dev support': config_host.has_key('CONFIG_H= OST_BLOCK_DEVICE')} summary_info +=3D {'capstone': capstone_opt =3D=3D 'disabled' ? f= alse : capstone_opt} summary_info +=3D {'libpmem support': config_host.has_key('CONFIG_LIBPME= M')} summary_info +=3D {'libdaxctl support': config_host.has_key('CONFIG_LIBDAX= CTL')} diff --git a/qapi/block-core.json b/qapi/block-core.json index 1b8b4156b4..408be635ae 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -980,7 +980,8 @@ 'discriminator': 'driver', 'data': { 'file': 'BlockStatsSpecificFile', - 'host_device': 'BlockStatsSpecificFile', + 'host_device': { 'type': 'BlockStatsSpecificFile', + 'if': 'defined(CONFIG_HOST_BLOCK_DEVICE)' }, 'nvme': 'BlockStatsSpecificNvme' } } =20 ## @@ -2848,7 +2849,9 @@ { 'enum': 'BlockdevDriver', 'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs', 'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ft= ps', - 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscs= i', + 'gluster', 'host_cdrom', + {'name': 'host_device', 'if': 'defined(CONFIG_HOST_BLOCK_DEVIC= E)' }, + 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallel= s', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd', { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' }, @@ -4016,7 +4019,8 @@ 'ftps': 'BlockdevOptionsCurlFtps', 'gluster': 'BlockdevOptionsGluster', 'host_cdrom': 'BlockdevOptionsFile', - 'host_device':'BlockdevOptionsFile', + 'host_device': { 'type': 'BlockdevOptionsFile', + 'if': 'defined(CONFIG_HOST_BLOCK_DEVICE)' }, 'http': 'BlockdevOptionsCurlHttp', 'https': 'BlockdevOptionsCurlHttps', 'iscsi': 'BlockdevOptionsIscsi', diff --git a/block/file-posix.c b/block/file-posix.c index c63926d592..a0fa9aad3a 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -41,7 +41,7 @@ #include "scsi/pr-manager.h" #include "scsi/constants.h" =20 -#if defined(__APPLE__) && (__MACH__) +#if defined(CONFIG_HOST_BLOCK_DEVICE) && defined(__APPLE__) && (__MACH__) #include #include #include @@ -3014,6 +3014,7 @@ static BlockStatsSpecific *raw_get_specific_stats(Blo= ckDriverState *bs) return stats; } =20 +#if defined(CONFIG_HOST_BLOCK_DEVICE) static BlockStatsSpecific *hdev_get_specific_stats(BlockDriverState *bs) { BlockStatsSpecific *stats =3D g_new(BlockStatsSpecific, 1); @@ -3023,6 +3024,7 @@ static BlockStatsSpecific *hdev_get_specific_stats(Bl= ockDriverState *bs) =20 return stats; } +#endif /* CONFIG_HOST_BLOCK_DEVICE */ =20 static QemuOptsList raw_create_opts =3D { .name =3D "raw-create-opts", @@ -3247,6 +3249,8 @@ BlockDriver bdrv_file =3D { /***********************************************/ /* host device */ =20 +#if defined(CONFIG_HOST_BLOCK_DEVICE) + #if defined(__APPLE__) && defined(__MACH__) static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath, CFIndex maxPathSize, int flags); @@ -3872,6 +3876,8 @@ static BlockDriver bdrv_host_cdrom =3D { }; #endif /* __FreeBSD__ */ =20 +#endif /* CONFIG_HOST_BLOCK_DEVICE */ + static void bdrv_file_init(void) { /* @@ -3879,6 +3885,7 @@ static void bdrv_file_init(void) * registered last will get probed first. */ bdrv_register(&bdrv_file); +#if defined(CONFIG_HOST_BLOCK_DEVICE) bdrv_register(&bdrv_host_device); #ifdef __linux__ bdrv_register(&bdrv_host_cdrom); @@ -3886,6 +3893,7 @@ static void bdrv_file_init(void) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) bdrv_register(&bdrv_host_cdrom); #endif +#endif /* CONFIG_HOST_BLOCK_DEVICE */ } =20 block_init(bdrv_file_init); --=20 2.28.0