void DldIOShadowFile::LockShared() { assert( this->rwLock ); assert( preemption_enabled() ); IORWLockRead( this->rwLock ); };
bool IOCatalogue::startMatching( OSDictionary * matching ) { OSCollectionIterator * iter; OSDictionary * dict; OSOrderedSet * set; OSArray * array; const OSSymbol * key; unsigned int idx; if ( !matching ) return false; set = OSOrderedSet::withCapacity(10, IOServiceOrdering, (void *)gIOProbeScoreKey); if ( !set ) return false; iter = OSCollectionIterator::withCollection(personalities); if (!iter) { set->release(); return false; } IORWLockRead(lock); while ((key = (const OSSymbol *) iter->getNextObject())) { array = (OSArray *) personalities->getObject(key); if (array) for (idx = 0; (dict = (OSDictionary *) array->getObject(idx)); idx++) { /* This comparison must be done with only the keys in the * "matching" dict to enable general matching. */ if (dict->isEqualTo(matching, matching)) { set->setObject(dict); } } } // Start device matching. if ( set->getCount() > 0 ) { IOService::catalogNewDrivers(set); generation++; } IORWLockUnlock(lock); set->release(); iter->release(); return true; }
/********************************************************************* * Is personality already in the catalog? *********************************************************************/ OSOrderedSet * IOCatalogue::findDrivers( OSDictionary * matching, SInt32 * generationCount) { OSCollectionIterator * iter; OSDictionary * dict; OSOrderedSet * set; OSArray * array; const OSSymbol * key; unsigned int idx; OSKext::uniquePersonalityProperties(matching); set = OSOrderedSet::withCapacity( 1, IOServiceOrdering, (void *)gIOProbeScoreKey ); if (!set) return (0); iter = OSCollectionIterator::withCollection(personalities); if (!iter) { set->release(); return (0); } IORWLockRead(lock); while ((key = (const OSSymbol *) iter->getNextObject())) { array = (OSArray *) personalities->getObject(key); if (array) for (idx = 0; (dict = (OSDictionary *) array->getObject(idx)); idx++) { /* This comparison must be done with only the keys in the * "matching" dict to enable general searches. */ if ( dict->isEqualTo(matching, matching) ) set->setObject(dict); } } *generationCount = getGenerationCount(); IORWLockUnlock(lock); iter->release(); return set; }
OSOrderedSet * IOCatalogue::findDrivers( IOService * service, SInt32 * generationCount) { OSDictionary * nextTable; OSOrderedSet * set; OSArray * array; const OSMetaClass * meta; unsigned int idx; set = OSOrderedSet::withCapacity( 1, IOServiceOrdering, (void *)gIOProbeScoreKey ); if( !set ) return( 0 ); IORWLockRead(lock); meta = service->getMetaClass(); while (meta) { array = (OSArray *) personalities->getObject(meta->getClassNameSymbol()); if (array) for (idx = 0; (nextTable = (OSDictionary *) array->getObject(idx)); idx++) { set->setObject(nextTable); } if (meta == &IOService::gMetaClass) break; meta = meta->getSuperClass(); } *generationCount = getGenerationCount(); IORWLockUnlock(lock); return( set ); }