IOReturn IOPlatformExpert::callPlatformFunction(const OSSymbol *functionName, bool waitForFunction, void *param1, void *param2, void *param3, void *param4) { IOService *service, *_resources; if (waitForFunction) { _resources = waitForService(resourceMatching(functionName)); } else { _resources = getResourceService(); } if (_resources == 0) return kIOReturnUnsupported; service = OSDynamicCast(IOService, _resources->getProperty(functionName)); if (service == 0) return kIOReturnUnsupported; return service->callPlatformFunction(functionName, waitForFunction, param1, param2, param3, param4); }
bool IOHIDevice::start(IOService * provider) { if (!super::start(provider)) return false; // RY: If the kIOHIDVirtualHIDevice property isn't // set scan the up provider chain to determine if // this is a resource or if the provider is another // IOHIDevice. Also propegate value is property // was already set in provider. if (!getProperty(kIOHIDVirtualHIDevice)) { OSObject * prop; while (provider) { prop = provider->copyProperty(kIOHIDVirtualHIDevice); if ( OSDynamicCast(OSBoolean, prop) ) { setProperty(kIOHIDVirtualHIDevice, prop); break; } else if ( provider == getResourceService() || OSDynamicCast(IOHIDevice, provider) ) { setProperty(kIOHIDVirtualHIDevice, kOSBooleanTrue); break; } provider = provider->getProvider(); OSSafeReleaseNULL(prop); } OSSafeReleaseNULL(prop); if ( !provider ) setProperty(kIOHIDVirtualHIDevice, kOSBooleanFalse); } updateProperties(); return true; }
bool AppleFileSystemDriver::start(IOService * provider) { OSDictionary * matching; OSString * uuidString; const char * uuidCString; IOService * resourceService; OSDictionary * dict; DEBUG_LOG("%s[%p]::%s\n", getName(), this, __func__); DEBUG_LOG("%s provider is '%s'\n", getName(), provider->getName()); do { resourceService = getResourceService(); if (resourceService == 0) break; uuidString = OSDynamicCast( OSString, resourceService->getProperty("boot-uuid") ); if (uuidString) { _uuidString = uuidString; _uuidString->retain(); uuidCString = uuidString->getCStringNoCopy(); DEBUG_LOG("%s: got UUID string '%s'\n", getName(), uuidCString); if (uuid_parse(uuidCString, _uuid) != 0) { IOLog("%s: Invalid UUID string '%s'\n", getName(), uuidCString); break; } } else { IOLog("%s: Error getting boot-uuid property\n", getName()); break; } // Match IOMedia objects matching our criteria (from kext .plist) dict = OSDynamicCast( OSDictionary, getProperty( kMediaMatchKey ) ); if (dict == 0) break; dict = OSDictionary::withDictionary(dict); if (dict == 0) break; matching = IOService::serviceMatching( "IOMedia", dict ); if ( matching == 0 ) return false; // Retain for asynchronous matching notification retain(); // Set up notification for newly-appearing devices. // This will also notify us about existing devices. _notifier = IOService::addMatchingNotification( gIOMatchedNotification, matching, &mediaNotificationHandler, this, 0 ); matching->release(); DEBUG_LOG("%s[%p]::%s finishes TRUE\n", getName(), this, __func__); return true; } while (false); DEBUG_LOG("%s[%p]::%s finishes false\n", getName(), this, __func__); return false; }