rename deprecated constant kIOMasterPortDefault

This constant is now deprecated since macOS 12.0 and a new constant
named kIOMainPortDefault is provided. There is a fallback in place
that retains compatibility for older macOS versions.

https://developer.apple.com/documentation/iokit/kiomasterportdefault

[ gsi: tweak style to match existing code base ]
This commit is contained in:
André Fonseca 2023-08-28 15:28:22 +02:00 committed by Gerhard Sittig
parent 6f9b03e597
commit 323881f8a4
2 changed files with 5 additions and 2 deletions

View File

@ -93,6 +93,9 @@
#include <IOKit/serial/ioss.h>
#include <sys/syslimits.h>
#include <mach/mach_time.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED < 120000 /* Before macOS 12 */
#define kIOMainPortDefault kIOMasterPortDefault
#endif
#endif
#ifdef __linux__
#include <dirent.h>

View File

@ -42,7 +42,7 @@ SP_PRIV enum sp_return get_port_details(struct sp_port *port)
if (!(classes = IOServiceMatching(kIOSerialBSDServiceValue)))
RETURN_FAIL("IOServiceMatching() failed");
if (IOServiceGetMatchingServices(kIOMasterPortDefault, classes,
if (IOServiceGetMatchingServices(kIOMainPortDefault, classes,
&iter) != KERN_SUCCESS)
RETURN_FAIL("IOServiceGetMatchingServices() failed");
@ -210,7 +210,7 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list)
}
DEBUG("Getting matching services");
if (IOServiceGetMatchingServices(kIOMasterPortDefault, classes,
if (IOServiceGetMatchingServices(kIOMainPortDefault, classes,
&iter) != KERN_SUCCESS) {
SET_FAIL(ret, "IOServiceGetMatchingServices() failed");
goto out_done;