From nobody Fri May 3 10:06:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16414270364631012.8171496241573; Wed, 5 Jan 2022 15:57:16 -0800 (PST) Received: from localhost ([::1]:43978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5G9a-0004Kl-TF for importer@patchew.org; Wed, 05 Jan 2022 18:57:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5G8e-0003dz-Dj; Wed, 05 Jan 2022 18:56:16 -0500 Received: from [2a00:1450:4864:20::436] (port=34619 helo=mail-wr1-x436.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5G8Z-0007PW-D0; Wed, 05 Jan 2022 18:56:12 -0500 Received: by mail-wr1-x436.google.com with SMTP id h23so1440855wrc.1; Wed, 05 Jan 2022 15:56:10 -0800 (PST) Received: from nuc.. (83.red-83-50-87.dynamicip.rima-tde.net. [83.50.87.83]) by smtp.gmail.com with ESMTPSA id ba18sm395903wrb.40.2022.01.05.15.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 15:56:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kDAd1vBFe4hWcDSW7xvS8jiBEbdnQnlbGBH8BB1Tmfs=; b=V+c8OinRWYAjTW6KB+8RdbV512v5LNgHRx0zl+XbEAlJmBwFGO3qPOOSW1ngAeCero HcMomX0Ey/p2nXOPzwcdBRAuxpJI7oQaw00BiFZjKNAmDY/QA427vd+FwPziUjVRxZ9L EBYUSfvewi8YeLiKxwfomFS6is+3EB8E8qYc8EKweq3arW06R9/+XOniTft5jFWA5rYo SJn/IjRV2OSPJjXPSu8T2ZFTGZWOuyspKl1GExX0es+Ll6ZAHPg9PTmL89wgsomDAONz TsSjZWntTgNGMjOC0IGiN67UiaXbXUXlpn5t+UGmRRr4gctlmyYYyVrsXo0fGtt8FAcK eJ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=kDAd1vBFe4hWcDSW7xvS8jiBEbdnQnlbGBH8BB1Tmfs=; b=KKPRYLcC3ut+/2sBd6Zd62LDEg3Jiwn/8rxay3E4pKdhXK+XPi5xf8JeDReHv5+YFQ RZe5UcTdah8Ny7m97evaz47Kj+TEPNmzwD+jndZapIRnSBmm8GyU8Ng5ECjp7ysJ/vSy tOMcl716QmfpqBW22isVXvqb0D2JNFGEWtjPC/LcgIPcsZMJ1zvDPJlNu5zwdh3E02xs AZZvBhc5gyF8l5ezf92qonvanJhq4Uyz9B/AHj4wUe0i/aWSPd6/hn5Ztm6ypAZeJNcv ybkXRcYzbAWraP+EQyK23Tg+ImxPRfd21fRk47Ji5yXjHq36hLF0dwBjlgbSTtfvvDTy qNTg== X-Gm-Message-State: AOAM5307V1BHQoPkMj0Mqmq2PBzvJVplRzcuwof1r3cRPjdyoETxjv46 ff1rVXlgyygK5zJsJLPzzt4WcSPm6VEFwQ== X-Google-Smtp-Source: ABdhPJwP5wLUgXGNEEesWLDz5U3tShhLNWYdTYEJV60jgLVFBr1+RzIL/UqUuU4tA8WLVB+sIi8niw== X-Received: by 2002:a5d:598c:: with SMTP id n12mr50398456wri.541.1641426969292; Wed, 05 Jan 2022 15:56:09 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH] block/file-posix: Remove a deprecation warning on macOS 12 Date: Thu, 6 Jan 2022 00:56:07 +0100 Message-Id: <20220105235607.212848-1-f4bug@amsat.org> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::436 (failed) 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=2a00:1450:4864:20::436; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, Hanna Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Arbuckle , Roman Bolshakov , Joelle van Dyne Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1641427038852100001 When building on macOS 12 we get: ../block/file-posix.c:3335:18: warning: 'IOMasterPort' is deprecated: fir= st deprecated in macOS 12.0 [-Wdeprecated-declarations] kernResult =3D IOMasterPort( MACH_PORT_NULL, &masterPort ); ^~~~~~~~~~~~ IOMainPort Use IOMainPort (define it to IOMasterPort on macOS < 12), and replace 'master' by 'main' in a variable name. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/file-posix.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index b283093e5b..0dcfce1856 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -3324,17 +3324,22 @@ BlockDriver bdrv_file =3D { #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) +#define IOMainPort IOMasterPort +#endif + static char *FindEjectableOpticalMedia(io_iterator_t *mediaIterator) { kern_return_t kernResult =3D KERN_FAILURE; - mach_port_t masterPort; + mach_port_t mainPort; CFMutableDictionaryRef classesToMatch; const char *matching_array[] =3D {kIODVDMediaClass, kIOCDMediaClass}; char *mediaType =3D NULL; =20 - kernResult =3D IOMasterPort( MACH_PORT_NULL, &masterPort ); + kernResult =3D IOMainPort(MACH_PORT_NULL, &mainPort); if ( KERN_SUCCESS !=3D kernResult ) { - printf( "IOMasterPort returned %d\n", kernResult ); + printf("IOMainPort returned %d\n", kernResult); } =20 int index; @@ -3347,7 +3352,7 @@ static char *FindEjectableOpticalMedia(io_iterator_t = *mediaIterator) } CFDictionarySetValue(classesToMatch, CFSTR(kIOMediaEjectableKey), kCFBooleanTrue); - kernResult =3D IOServiceGetMatchingServices(masterPort, classesToM= atch, + kernResult =3D IOServiceGetMatchingServices(mainPort, classesToMat= ch, mediaIterator); if (kernResult !=3D KERN_SUCCESS) { error_report("Note: IOServiceGetMatchingServices returned %d", --=20 2.33.1