qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@gmail.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: Roman Bolshakov <r.bolshakov@yadro.com>,
	Will Cohen <wwcohen@gmail.com>,
	Christian Schoenebeck <qemu_oss@crudebyte.com>,
	Cameron Esfahani <dirty@apple.com>
Subject: Re: [PATCH v6 07/15] block/file-posix: Remove a deprecation warning on macOS 12
Date: Sat, 19 Feb 2022 03:11:33 +0900	[thread overview]
Message-ID: <907eb058-01ff-0542-c057-7ecb3fd46cac@gmail.com> (raw)
In-Reply-To: <20220215080307.69550-8-f4bug@amsat.org>

Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Tested-by: Akihiko Odaki <akihiko.odaki@gmail.com>

On 2022/02/15 17:02, Philippe Mathieu-Daudé via wrote:
> 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>
> 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 1f1756e192..13393ad296 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -3319,17 +3319,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;
> @@ -3342,7 +3348,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",



  reply	other threads:[~2022-02-18 18:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15  8:02 [PATCH v6 00/15] host: Support macOS 12 Philippe Mathieu-Daudé via
2022-02-15  8:02 ` [PATCH v6 01/15] MAINTAINERS: Add Akihiko Odaki to macOS-relateds Philippe Mathieu-Daudé via
2022-02-15  8:02 ` [PATCH v6 02/15] configure: Allow passing extra Objective C compiler flags Philippe Mathieu-Daudé via
2022-02-18 18:08   ` Akihiko Odaki
2022-02-15  8:02 ` [PATCH v6 03/15] tests/fp/berkeley-testfloat-3: Ignore ignored #pragma directives Philippe Mathieu-Daudé via
2022-02-18 18:09   ` Akihiko Odaki
2022-02-15  8:02 ` [PATCH v6 04/15] hvf: Use standard CR0 and CR4 register definitions Philippe Mathieu-Daudé via
2022-02-15  8:02 ` [PATCH v6 05/15] hvf: Make hvf_get_segments() / hvf_put_segments() local Philippe Mathieu-Daudé via
2022-02-15  8:02 ` [PATCH v6 06/15] hvf: Remove deprecated hv_vcpu_flush() calls Philippe Mathieu-Daudé via
2022-02-15  8:02 ` [PATCH v6 07/15] block/file-posix: Remove a deprecation warning on macOS 12 Philippe Mathieu-Daudé via
2022-02-18 18:11   ` Akihiko Odaki [this message]
2022-02-15  8:03 ` [PATCH v6 08/15] audio/coreaudio: " Philippe Mathieu-Daudé via
2022-02-18 18:26   ` Akihiko Odaki
2022-02-15  8:03 ` [PATCH v6 09/15] audio/dbus: Fix building with modules on macOS Philippe Mathieu-Daudé via
2022-02-15  8:03 ` [PATCH v6 10/15] ui/cocoa: Remove allowedFileTypes restriction in SavePanel Philippe Mathieu-Daudé via
2022-02-18 18:28   ` Akihiko Odaki
2022-02-15  8:03 ` [PATCH v6 11/15] ui/cocoa: Add Services menu Philippe Mathieu-Daudé via
2022-02-15 16:38   ` Will Cohen
2022-02-18 17:33   ` Peter Maydell
2022-02-18 17:49     ` Akihiko Odaki
2022-02-18 18:18       ` Christian Schoenebeck
2022-02-15  8:03 ` [PATCH v6 12/15] ui/cocoa: Do not alert even without block devices Philippe Mathieu-Daudé via
2022-02-15  8:03 ` [PATCH v6 13/15] ui/cocoa: Fix the leak of qemu_console_get_label Philippe Mathieu-Daudé via
2022-02-15  8:03 ` [PATCH v6 14/15] lcitool: Refresh Philippe Mathieu-Daudé via
2022-02-15  8:03 ` [PATCH v6 15/15] gitlab-ci: Support macOS 12 via cirrus-run Philippe Mathieu-Daudé via

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=907eb058-01ff-0542-c057-7ecb3fd46cac@gmail.com \
    --to=akihiko.odaki@gmail.com \
    --cc=dirty@apple.com \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    --cc=r.bolshakov@yadro.com \
    --cc=wwcohen@gmail.com \
    /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).