[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/21] block/file-posix: Remove a deprecation warning on macOS 12
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 06/21] block/file-posix: Remove a deprecation warning on macOS 12 |
Date: |
Tue, 15 Mar 2022 13:53:35 +0100 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
When building on macOS 12 we get:
block/file-posix.c:3335:18: warning: 'IOMasterPort' is deprecated: first
deprecated in macOS 12.0 [-Wdeprecated-declarations]
kernResult = IOMasterPort( MACH_PORT_NULL, &masterPort );
^~~~~~~~~~~~
IOMainPort
Replace by IOMainPort, redefining it to IOMasterPort if not available.
Suggested-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed by: Cameron Esfahani <dirty@apple.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Tested-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
block/file-posix.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c
index c000a61db2..39a3d6dbe6 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -3320,17 +3320,23 @@ BlockDriver bdrv_file = {
#if defined(__APPLE__) && defined(__MACH__)
static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath,
CFIndex maxPathSize, int flags);
+
+#if !defined(MAC_OS_VERSION_12_0) \
+ || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_12_0)
+#define IOMainPort IOMasterPort
+#endif
+
static char *FindEjectableOpticalMedia(io_iterator_t *mediaIterator)
{
kern_return_t kernResult = KERN_FAILURE;
- mach_port_t masterPort;
+ mach_port_t mainPort;
CFMutableDictionaryRef classesToMatch;
const char *matching_array[] = {kIODVDMediaClass, kIOCDMediaClass};
char *mediaType = NULL;
- kernResult = IOMasterPort( MACH_PORT_NULL, &masterPort );
+ kernResult = IOMainPort(MACH_PORT_NULL, &mainPort);
if ( KERN_SUCCESS != kernResult ) {
- printf( "IOMasterPort returned %d\n", kernResult );
+ printf("IOMainPort returned %d\n", kernResult);
}
int index;
@@ -3343,7 +3349,7 @@ static char *FindEjectableOpticalMedia(io_iterator_t
*mediaIterator)
}
CFDictionarySetValue(classesToMatch, CFSTR(kIOMediaEjectableKey),
kCFBooleanTrue);
- kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch,
+ kernResult = IOServiceGetMatchingServices(mainPort, classesToMatch,
mediaIterator);
if (kernResult != KERN_SUCCESS) {
error_report("Note: IOServiceGetMatchingServices returned %d",
--
2.34.1
- [PULL 00/21] Darwin patches for 2022-03-15, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 01/21] configure: Allow passing extra Objective C compiler flags, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 02/21] tests/fp/berkeley-testfloat-3: Ignore ignored #pragma directives, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 03/21] hvf: Use standard CR0 and CR4 register definitions, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 04/21] hvf: Make hvf_get_segments() / hvf_put_segments() local, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 05/21] hvf: Remove deprecated hv_vcpu_flush() calls, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 06/21] block/file-posix: Remove a deprecation warning on macOS 12,
Philippe Mathieu-Daudé <=
- [PULL 07/21] audio/coreaudio: Remove a deprecation warning on macOS 12, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 08/21] audio/dbus: Fix building with modules on macOS, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 09/21] audio: Log context for audio bug, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 10/21] coreaudio: Always return 0 in handle_voice_change, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 11/21] audio: Rename coreaudio extension to use Objective-C compiler, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 12/21] osdep: Avoid using Clang-specific __builtin_available(), Philippe Mathieu-Daudé, 2022/03/15
- [PULL 13/21] meson: Resolve the entitlement.sh script once for good, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 14/21] meson: Log QEMU_CXXFLAGS content in summary, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 15/21] configure: Pass filtered QEMU_OBJCFLAGS to meson, Philippe Mathieu-Daudé, 2022/03/15
- [PULL 16/21] ui/cocoa: Constify qkeycode translation arrays, Philippe Mathieu-Daudé, 2022/03/15