From: Joelle van Dyne <j@getutm.app>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
"open list:raw" <qemu-block@nongnu.org>,
Markus Armbruster <armbru@redhat.com>,
Max Reitz <mreitz@redhat.com>, Joelle van Dyne <j@getutm.app>
Subject: [PATCH v5 1/7] configure: option to disable host block devices
Date: Sun, 8 Nov 2020 15:24:18 -0800 [thread overview]
Message-ID: <20201108232425.1705-2-j@getutm.app> (raw)
In-Reply-To: <20201108232425.1705-1-j@getutm.app>
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 <j@getutm.app>
---
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=""
ninja=""
skip_meson=no
gettext=""
+host_block_device_support="yes"
bogus_os="no"
malloc_trim="auto"
@@ -5907,6 +5908,9 @@ if test "$default_devices" = "yes" ; then
else
echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak
fi
+if test "$host_block_device_support" = "yes" ; then
+ echo "CONFIG_HOST_BLOCK_DEVICE=y" >> $config_host_mak
+fi
if test "$debug_tcg" = "yes" ; then
echo "CONFIG_DEBUG_TCG=y" >> $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 += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
+summary_info += {'host block dev support': config_host.has_key('CONFIG_HOST_BLOCK_DEVICE')}
summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt}
summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
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' } }
##
@@ -2848,7 +2849,9 @@
{ 'enum': 'BlockdevDriver',
'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
- 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
+ 'gluster', 'host_cdrom',
+ {'name': 'host_device', 'if': 'defined(CONFIG_HOST_BLOCK_DEVICE)' },
+ 'http', 'https', 'iscsi',
'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
'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"
-#if defined(__APPLE__) && (__MACH__)
+#if defined(CONFIG_HOST_BLOCK_DEVICE) && defined(__APPLE__) && (__MACH__)
#include <paths.h>
#include <sys/param.h>
#include <IOKit/IOKitLib.h>
@@ -3014,6 +3014,7 @@ static BlockStatsSpecific *raw_get_specific_stats(BlockDriverState *bs)
return stats;
}
+#if defined(CONFIG_HOST_BLOCK_DEVICE)
static BlockStatsSpecific *hdev_get_specific_stats(BlockDriverState *bs)
{
BlockStatsSpecific *stats = g_new(BlockStatsSpecific, 1);
@@ -3023,6 +3024,7 @@ static BlockStatsSpecific *hdev_get_specific_stats(BlockDriverState *bs)
return stats;
}
+#endif /* CONFIG_HOST_BLOCK_DEVICE */
static QemuOptsList raw_create_opts = {
.name = "raw-create-opts",
@@ -3247,6 +3249,8 @@ BlockDriver bdrv_file = {
/***********************************************/
/* host device */
+#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 = {
};
#endif /* __FreeBSD__ */
+#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 */
}
block_init(bdrv_file_init);
--
2.28.0
next prev parent reply other threads:[~2020-11-08 23:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-08 23:24 [PATCH v5 0/7] iOS and Apple Silicon host support Joelle van Dyne
2020-11-08 23:24 ` Joelle van Dyne [this message]
2020-11-08 23:24 ` [PATCH v5 2/7] configure: cross-compiling with empty cross_prefix Joelle van Dyne
2020-11-20 10:23 ` Philippe Mathieu-Daudé
2020-11-08 23:24 ` [PATCH v5 3/7] qemu: add support for iOS host Joelle van Dyne
2020-11-08 23:24 ` [PATCH v5 4/7] coroutine: add libucontext as external library Joelle van Dyne
2020-11-09 0:01 ` Philippe Mathieu-Daudé
2020-11-08 23:24 ` [PATCH v5 5/7] slirp: update build flags for iOS resolv fix Joelle van Dyne
2020-11-08 23:24 ` [PATCH v5 6/7] tcg: implement JIT for iOS and Apple Silicon Joelle van Dyne
2020-11-20 9:08 ` Alexander Graf
2020-11-20 14:15 ` Alexander Graf
2020-11-20 14:36 ` Richard Henderson
2020-11-20 15:58 ` Joelle van Dyne
2020-11-25 1:15 ` Alexander Graf
2020-11-25 2:08 ` Joelle van Dyne
2020-12-11 10:54 ` Alexander Graf
2020-12-11 12:35 ` Stefan Hajnoczi
2020-12-11 18:47 ` Joelle van Dyne
2020-11-08 23:24 ` [PATCH v5 7/7] block: check availablity for preadv/pwritev on mac Joelle van Dyne
2020-11-20 10:32 ` Philippe Mathieu-Daudé
2020-11-20 15:49 ` Joelle van Dyne
2020-11-20 16:20 ` Philippe Mathieu-Daudé
2020-11-20 16:55 ` Joelle van Dyne
2020-11-12 16:26 ` [PATCH v5 0/7] iOS and Apple Silicon host support Stefan Hajnoczi
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=20201108232425.1705-2-j@getutm.app \
--to=j@getutm.app \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).