From: Joelle van Dyne <j@getutm.app> Date: Mon, 15 Mar 2021 18:03:40 +0000 (-0700) Subject: block: detect DKIOCGETBLOCKCOUNT/SIZE before use X-Git-Tag: v6.1.0-rc0~52^2~6 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=09e20abddaf94ff27dcced1df81f69a713627a94;p=users%2Fdwmw2%2Fqemu.git block: detect DKIOCGETBLOCKCOUNT/SIZE before use iOS hosts do not have these defined so we fallback to the default behaviour. Co-authored-by: Warner Losh <imp@bsdimp.com> Signed-off-by: Joelle van Dyne <j@getutm.app> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- diff --git a/block/file-posix.c b/block/file-posix.c index f16d987c07..74b8216077 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2341,7 +2341,7 @@ again: } } #endif -#if defined(__APPLE__) && defined(__MACH__) +#if defined(DKIOCGETBLOCKCOUNT) && defined(DKIOCGETBLOCKSIZE) if (size == 0) { uint64_t sectors = 0; uint32_t sector_size = 0;