void IOHIDEventQueue::removeElement( IOHIDElementPrivate * element ) { OSCollectionIterator * iterator; IOHIDElementPrivate * temp; UInt32 size = 0; UInt32 maxSize = DEFAULT_HID_ENTRY_SIZE; if ( !element || !_elementSet || !_elementSet->containsObject( element )) return; _elementSet->removeObject( element ); if ( NULL != (iterator = OSCollectionIterator::withCollection(_elementSet)) ) { while ( NULL != (temp = (IOHIDElementPrivate *)iterator->getNextObject()) ) { size = temp->getElementValueSize() + sizeof(void *); if ( maxSize < size ) maxSize = size; } iterator->release(); } _maxEntrySize = maxSize; }
void ARMIO::publishBelow( IORegistryEntry * root ) { OSCollectionIterator * kids; IORegistryEntry * next; IOService * nub; // infanticide kids = IODTFindMatchingEntries( root, kIODTRecursive, deleteList() ); if( kids) { while( (next = (IORegistryEntry *)kids->getNextObject())) { next->detachAll( gIODTPlane); } kids->release(); } // publish everything below, minus excludeList kids = IODTFindMatchingEntries( root, kIODTRecursive | kIODTExclusive, excludeList()); if( kids) { while( (next = (IORegistryEntry *)kids->getNextObject())) { if( 0 == (nub = createNub( next ))) continue; nub->attach( this ); processNub(nub); nub->registerService(); } kids->release(); } }
/* static */ void OSMetaClass::printInstanceCounts() { OSCollectionIterator * classes; OSSymbol * className; OSMetaClass * meta; IOLockLock(sAllClassesLock); classes = OSCollectionIterator::withCollection(sAllClassesDict); assert(classes); while( (className = (OSSymbol *)classes->getNextObject())) { meta = (OSMetaClass *)sAllClassesDict->getObject(className); assert(meta); printf("%24s count: %03d x 0x%03x = 0x%06x\n", className->getCStringNoCopy(), meta->getInstanceCount(), meta->getClassSize(), meta->getInstanceCount() * meta->getClassSize() ); } printf("\n"); classes->release(); IOLockUnlock(sAllClassesLock); return; }
bool IOAudioSelectorControl::valueExists(SInt32 selectionValue) { bool found = false; OSCollectionIterator *iterator; assert(availableSelections); iterator = OSCollectionIterator::withCollection(availableSelections); if (iterator) { OSDictionary *selection; while ( (selection = (OSDictionary *)iterator->getNextObject()) ) { OSNumber *sValue; sValue = (OSNumber *)selection->getObject(kIOAudioSelectorControlSelectionValueKey); if (sValue && ((SInt32)sValue->unsigned32BitValue() == selectionValue)) { found = true; break; } } iterator->release(); } return found; }
// Returns true on success, false on an error condition. bool OSDictionary::merge(const OSDictionary *srcDict) { const OSSymbol * sym; OSCollectionIterator * iter; if ( !OSDynamicCast(OSDictionary, srcDict) ) return false; iter = OSCollectionIterator::withCollection(const_cast<OSDictionary *>(srcDict)); if ( !iter ) return false; while ( (sym = (const OSSymbol *)iter->getNextObject()) ) { const OSMetaClassBase * obj; obj = srcDict->getObject(sym); if ( !setObject(sym, obj) ) { iter->release(); return false; } } iter->release(); return true; }
void OSMetaClass::reportModInstances(const char *kmodName) { OSSet *kmodClasses; OSCollectionIterator *iter; OSMetaClass *checkClass; kmodClasses = OSDynamicCast(OSSet, sKModClassesDict->getObject(kmodName)); if (!kmodClasses) return; iter = OSCollectionIterator::withCollection(kmodClasses); if (!iter) return; while ( (checkClass = (OSMetaClass *) iter->getNextObject()) ) if (checkClass->getInstanceCount()) { printf("%s: %s has %d instance(s)\n", kmodName, checkClass->getClassName(), checkClass->getInstanceCount()); } iter->release(); }
void IOAudioPort::deactivateAudioControls() { OSCollectionIterator *iterator; if (!audioControls) { return; } iterator = OSCollectionIterator::withCollection(audioControls); if (iterator) { IOAudioControl *control; while ( (control = (IOAudioControl *)iterator->getNextObject()) ) { // Should we check to see if we're the provider? if (!isInactive()) { control->terminate(); } } iterator->release(); } audioControls->flushCollection(); }
void IOFireWireUserClientIniter::mergeProperties( IORegistryEntry * dest, OSDictionary * src ) { //IOLog( "IOFireWireUserClientIniter<0x%08lx>::mergeProperties - dest = 0x%08lx, src = 0x%08lx\n", this, dest, src ); if( !dest || !src ) return; OSCollectionIterator* srcIterator = OSCollectionIterator::withCollection( src ); OSSymbol* keyObject = NULL; OSObject* destObject = NULL; OSObject* srcObject = NULL; while( NULL != (keyObject = OSDynamicCast(OSSymbol, srcIterator->getNextObject())) ) { srcObject = src->getObject(keyObject); destObject = dest->getProperty(keyObject); OSDictionary * destDictionary = OSDynamicCast( OSDictionary, destObject ); OSDictionary * srcDictionary = OSDynamicCast( OSDictionary, srcObject ); if( destDictionary && srcDictionary ) { // if there's already already a property defined in the destination // and the source and destination are dictionaries, we need to do // a recursive merge // shallow copy the destination directory destDictionary = OSDictionary::withDictionary( destDictionary ); // recurse mergeDictionaries( destDictionary, srcDictionary ); // set the property dest->setProperty( keyObject, destDictionary ); destDictionary->release(); } else { // if the property is not already in destination dictionary // or both source a destination are not dictionaries // then we can set the property without merging // any dictionaries in the source should already // have been deep copied before we began merging dest->setProperty( keyObject, srcObject ); } } // have to release this, or we'll leak. srcIterator->release(); //IOLog( "IOFireWireUserClientIniter<0x%08lx>::mergeProperties - return\n", this ); }
bool IOCatalogue::removePersonalities(OSArray * personalitiesToRemove) { bool result = true; OSArray * arrayCopy = NULL; // do not release OSCollectionIterator * iterator = NULL; // must release OSDictionary * personality = NULL; // do not release OSDictionary * checkPersonality = NULL; // do not release unsigned int count, i; // remove configs from catalog. arrayCopy = OSArray::withArray(array); if (!arrayCopy) { result = false; goto finish; } iterator = OSCollectionIterator::withCollection(arrayCopy); arrayCopy->release(); if (!iterator) { result = false; goto finish; } array->flushCollection(); count = personalitiesToRemove->getCount(); /* Go through the old catalog's list of personalities and add back any that * are *not* found in 'personalitiesToRemove'. */ while ((personality = (OSDictionary *)iterator->getNextObject())) { bool found = false; for (i = 0; i < count; i++) { checkPersonality = OSDynamicCast(OSDictionary, personalitiesToRemove->getObject(i)); /* Do isEqualTo() with the single-arg version to make an exact * comparison (unlike _removeDrivers() above). */ if (personality->isEqualTo(checkPersonality)) { found = true; break; } } if (!found) { array->setObject(personality); } } finish: OSSafeRelease(iterator); return result; }
/********************************************************************* * Remove drivers from the catalog which match the * properties in the matching dictionary. *********************************************************************/ bool IOCatalogue::removeDrivers( OSDictionary * matching, bool doNubMatching) { OSOrderedSet * set; OSCollectionIterator * iter; OSDictionary * dict; 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); } IORWLockWrite(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); array->removeObject(idx); idx--; } } // Start device matching. if ( doNubMatching && (set->getCount() > 0) ) { IOService::catalogNewDrivers(set); generation++; } } IORWLockUnlock(lock); set->release(); iter->release(); return true; }
void PAEngine::sendNotification(UInt32 notificationType, UInt32 value) { OSCollectionIterator *iter = OSCollectionIterator::withCollection(virtualDeviceArray); PAVirtualDevice *dev; while ((dev = OSDynamicCast(PAVirtualDevice, iter->getNextObject()))) dev->sendNotification(notificationType, value); iter->release(); }
OSCollectionIterator * OSCollectionIterator::withCollection(const OSCollection *inColl) { OSCollectionIterator *me = new OSCollectionIterator; if (me && !me->initWithCollection(inColl)) { me->release(); return 0; } return me; }
bool IOHIDUserClientIniter::mergeDictionaryIntoDictionary(OSDictionary * parentSourceDictionary, OSDictionary * parentTargetDictionary) { OSCollectionIterator* srcIterator = NULL; OSSymbol* keyObject = NULL; bool result = false; if (!parentSourceDictionary || !parentTargetDictionary) return false ; // Get our source dictionary // srcIterator = OSCollectionIterator::withCollection(parentSourceDictionary); while (NULL != (keyObject = OSDynamicCast(OSSymbol, srcIterator->getNextObject()))) { OSDictionary * childSourceDictionary = NULL; OSDictionary * childTargetDictionary = NULL; OSObject * childTargetObject = NULL; // Check to see if our destination already has the same entry. // childTargetObject = parentTargetDictionary->getObject(keyObject); if ( childTargetObject ) childTargetDictionary = OSDynamicCast(OSDictionary, childTargetObject); // See if our source entry is also a dictionary // childSourceDictionary = OSDynamicCast(OSDictionary, parentSourceDictionary->getObject(keyObject)); if ( childTargetDictionary && childSourceDictionary) { // Our destination dictionary already has the entry for this same object AND our // source is also a dcitionary, so we need to recursively add it. // result = mergeDictionaryIntoDictionary(childSourceDictionary, childTargetDictionary) ; if ( !result ) break; } else { // We have a property that we need to merge into our parent dictionary. // result = parentTargetDictionary->setObject(keyObject, parentSourceDictionary->getObject(keyObject)) ; if ( !result ) break; } } srcIterator->release(); return result; }
IOReturn IOAudioSelectorControl::replaceAvailableSelection(SInt32 selectionValue, OSString *selectionDescription) { OSCollectionIterator *iterator; OSArray *newSelections; OSArray *oldAvailableSelections; IOReturn result = kIOReturnSuccess; assert(availableSelections); oldAvailableSelections = availableSelections; newSelections = OSArray::withArray(availableSelections); if (!newSelections) return kIOReturnNoMemory; iterator = OSCollectionIterator::withCollection(newSelections); if (iterator) { OSDictionary * selection; UInt32 index; index = 0; while ( (selection = (OSDictionary *)iterator->getNextObject() )) { OSNumber * sValue; sValue = (OSNumber *)selection->getObject(kIOAudioSelectorControlSelectionValueKey); if (sValue && ((SInt32)sValue->unsigned32BitValue() == selectionValue)) { // Replace the selected dictionary in the array newSelections->replaceObject(index, selectionDescription); result = kIOReturnSuccess; break; } index++; } availableSelections = newSelections; setProperty(kIOAudioSelectorControlAvailableSelectionsKey, availableSelections); oldAvailableSelections->release(); iterator->release(); } if (kIOReturnSuccess == result) { sendChangeNotification(kIOAudioControlRangeChangeNotification); } return result; }
OSDictionary* IOFireWireUserClientIniter::dictionaryDeepCopy( OSDictionary* srcDictionary) { //IOLog( "IOFireWireUserClientIniter<0x%08lx>::dictionaryDeepCopy - srcDictionary = 0x%08lx\n", this, srcDictionary ); OSDictionary* result = NULL; OSObject* srcObject = NULL; OSCollectionIterator* srcIterator = NULL; OSSymbol* keyObject = NULL; result = OSDictionary::withCapacity(srcDictionary->getCount()); if (result) { srcIterator = OSCollectionIterator::withCollection(srcDictionary); if (srcIterator) { while ( (keyObject = OSDynamicCast(OSSymbol, srcIterator->getNextObject())) ) { srcObject = srcDictionary->getObject(keyObject); if (OSDynamicCast(OSDictionary, srcObject)) { srcObject = dictionaryDeepCopy((OSDictionary*)srcObject); result->setObject(keyObject, srcObject); // copyDictionaryProperty creates a new dictionary, so we should release // it after we add it to our dictionary srcObject->release(); } else { result->setObject(keyObject, srcObject); } } srcIterator->release(); } } //IOLog( "IOFireWireUserClientIniter<0x%08lx>::dictionaryDeepCopy - return\n", this ); return result; }
/* static */ void OSMetaClass::serializeClassDictionary(OSDictionary * serializeDictionary) { OSDictionary * classDict = NULL; IOLockLock(sAllClassesLock); classDict = OSDictionary::withCapacity(sAllClassesDict->getCount()); if (!classDict) { goto finish; } do { OSCollectionIterator * classes; const OSSymbol * className; classes = OSCollectionIterator::withCollection(sAllClassesDict); if (!classes) { break; } while ((className = (const OSSymbol *)classes->getNextObject())) { const OSMetaClass * meta; OSNumber * count; meta = (OSMetaClass *)sAllClassesDict->getObject(className); count = OSNumber::withNumber(meta->getInstanceCount(), 32); if (count) { classDict->setObject(className, count); count->release(); } } classes->release(); serializeDictionary->setObject("Classes", classDict); } while (0); finish: OSSafeRelease(classDict); IOLockUnlock(sAllClassesLock); return; }
/********************************************************************* * 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; }
bool CLASS::mergeProperties( OSDictionary * dict ) { bool success = true; OSCollectionIterator * iter = OSCollectionIterator::withCollection(dict); if ( iter ) { const OSSymbol * key; while ((key = (const OSSymbol *) iter->getNextObject())) { if (setProperty(key, dict->getObject(key)) == false) { success = false; break; } } iter->release(); } return success; }
OSMetaClass::~OSMetaClass() { do { OSCollectionIterator *iter; if (sAllClassesDict) sAllClassesDict->removeObject(className); iter = OSCollectionIterator::withCollection(sKModClassesDict); if (!iter) break; OSSymbol *iterKey; while ( (iterKey = (OSSymbol *) iter->getNextObject()) ) { OSSet *kmodClassSet; kmodClassSet = (OSSet *) sKModClassesDict->getObject(iterKey); if (kmodClassSet && kmodClassSet->containsObject(this)) { kmodClassSet->removeObject(this); break; } } iter->release(); } while (false); if (sStalled) { unsigned int i; // First pass find class in stalled list for (i = 0; i < sStalled->count; i++) if (this == sStalled->classes[i]) break; if (i < sStalled->count) { sStalled->count--; if (i < sStalled->count) memmove(&sStalled->classes[i], &sStalled->classes[i+1], (sStalled->count - i) * sizeof(OSMetaClass *)); } return; } }
void PAEngine::removeVirtualDeviceWithRefcon(void *refCon) { OSCollectionIterator *iter = OSCollectionIterator::withCollection(virtualDeviceArray); PAVirtualDevice *dev; while ((dev = OSDynamicCast(PAVirtualDevice, iter->getNextObject()))) { UInt index = virtualDeviceArray->getNextIndexOfObject((OSMetaClassBase *) dev, 0); if (dev->refCon == refCon) { if (state == kIOAudioEngineRunning) dev->sendNotification(kPAVirtualDeviceUserClientNotificationEngineStopped, 0); dev->detachFromParent(this, gIOServicePlane); dev->stop(this); dev->terminate(0); virtualDeviceArray->removeObject(index); } } iter->release(); }
void AppleGPIO::publishStrings(OSCollection *strings) { OSCollectionIterator *strIter; OSSymbol *key; if (!strings) return; strIter = OSCollectionIterator::withCollection(strings); if (strIter) { while ((key = OSDynamicCast(OSSymbol, strIter->getNextObject())) != 0) { //DLOG("AppleGPIO::publishStrings 0x%x %s\n", // fGPIOID, key->getCStringNoCopy()); publishResource(key, this); } strIter->release(); } }
static KeyboardReserved * GetKeyboardReservedStructEventForService(IOHIKeyboard *service, UInt32 * index = 0) { KeyboardReserved * retVal = 0; if (gKeyboardReservedArray) { OSCollectionIterator * iterator = 0; iterator = OSCollectionIterator::withCollection(gKeyboardReservedArray); if (iterator) { bool done = false; while (!done) { OSObject * obj = 0; while (!done && (NULL != (obj = iterator->getNextObject()))) { OSData * data = OSDynamicCast(OSData, obj); if (data) { retVal = (KeyboardReserved *)data->getBytesNoCopy(); if (retVal && (retVal->service == service)) { if (index) *index = gKeyboardReservedArray->getNextIndexOfObject(obj, 0); done = true; } else { retVal = 0; } } } if (iterator->isValid()) { done = true; } else { iterator->reset(); } } iterator->release(); } } return retVal; }
bool OSDictionary::isEqualTo(const OSDictionary *srcDict, const OSCollection *keys) const { OSCollectionIterator * iter; unsigned int keysCount; const OSMetaClassBase * obj1; const OSMetaClassBase * obj2; OSString * aKey; bool ret; if ( this == srcDict ) return true; keysCount = keys->getCount(); if ( (count < keysCount) || (srcDict->getCount() < keysCount) ) return false; iter = OSCollectionIterator::withCollection(keys); if ( !iter ) return false; ret = true; while ( (aKey = OSDynamicCast(OSString, iter->getNextObject())) ) { obj1 = getObject(aKey); obj2 = srcDict->getObject(aKey); if ( !obj1 || !obj2 ) { ret = false; break; } if ( !obj1->isEqualTo(obj2) ) { ret = false; break; } } iter->release(); return ret; }
void IOAudioPort::registerService(IOOptionBits options) { super::registerService(options); if (audioControls && !isRegistered) { OSCollectionIterator *iterator; iterator = OSCollectionIterator::withCollection(audioControls); if (iterator) { IOAudioControl *control; while ( (control = (IOAudioControl *)iterator->getNextObject()) ) { if (control->getProvider() == this) { control->registerService(); } } iterator->release(); } } isRegistered = true; }
bool OSMetaClass::modHasInstance(const char *kmodName) { bool result = false; if (!loadLock) { loadLock = mutex_alloc(ETAP_IO_AHA); mutex_lock(loadLock); } else mutex_lock(loadLock); do { OSSet *kmodClasses; OSCollectionIterator *iter; OSMetaClass *checkClass; kmodClasses = OSDynamicCast(OSSet, sKModClassesDict->getObject(kmodName)); if (!kmodClasses) break; iter = OSCollectionIterator::withCollection(kmodClasses); if (!iter) break; while ( (checkClass = (OSMetaClass *) iter->getNextObject()) ) if (checkClass->getInstanceCount()) { result = true; break; } iter->release(); } while (false); mutex_unlock(loadLock); return result; }
static IOReturn _removeDrivers( OSArray * array, OSDictionary * matching ) { OSCollectionIterator * tables; OSDictionary * dict; OSArray * arrayCopy; IOReturn ret = kIOReturnSuccess; // remove configs from catalog. arrayCopy = OSArray::withCapacity(100); if ( !arrayCopy ) return kIOReturnNoMemory; tables = OSCollectionIterator::withCollection(arrayCopy); arrayCopy->release(); if ( !tables ) return kIOReturnNoMemory; arrayCopy->merge(array); array->flushCollection(); tables->reset(); while ( (dict = (OSDictionary *)tables->getNextObject()) ) { /* Remove from the catalogue's array any personalities * that match the matching dictionary. * This comparison must be done with only the keys in the * "matching" dict to enable general matching. */ if ( dict->isEqualTo(matching, matching) ) continue; array->setObject(dict); } tables->release(); return ret; }
bool driver::init(OSDictionary *properties) { OSArray *speedArray = NULL; OSCollectionIterator *speedIterator = NULL; OSString *speedKey; chkpoint("Initializing\n"); if (super::init(properties) == false) fail("super::init"); speedArray = OSDynamicCast(OSArray, getProperty(kVID)); if (speedArray == NULL) fail("no " kVID "!\n"); speedIterator = OSCollectionIterator::withCollection(speedArray); if (speedIterator == NULL) fail("no speediterator!\n"); speedIterator->reset(); while (speedKey = (OSString *)speedIterator->getNextObject()) { sscanf(speedKey->getCStringNoCopy(),"%d,%d,%x",&speedstep_cpu_setting[num_speeds].cpuMhz,&speedstep_cpu_setting[num_speeds].cpuMv,&speedstep_cpu_setting[num_speeds].VID); if (speedstep_cpu_setting[num_speeds].cpuMhz<=100 || speedstep_cpu_setting[num_speeds].cpuMv<=700 || speedstep_cpu_setting[num_speeds].VID < 0xFF) { // Some sane values - 700mv is the absolute minimum possible? bzero(&speedstep_cpu_setting[num_speeds],sizeof(speedstep_cpu_t)); err("Ignoring invalid mhz,mv specified = %s\n",speedKey->getCStringNoCopy()); } else { //speedstep_cpu_setting[num_speeds].VID=VID(speedstep_cpu_setting[num_speeds].cpuMhz,speedstep_cpu_setting[num_speeds].cpuMv); info("Identified configured speed %uMhz, %umv, VID=0x%04x\n",speedstep_cpu_setting[num_speeds].cpuMhz,speedstep_cpu_setting[num_speeds].cpuMv,speedstep_cpu_setting[num_speeds].VID); num_speeds++; } } if (!num_speeds) fail("No valid speeds given"); // No valid settings, bail! dbg("%d speed settings used\n", num_speeds); eist_lock=IOSimpleLockAlloc(); if (!eist_lock) fail("IOSimpleLockAlloc"); return(true); fail: return(false); }
bool SoundflowerDevice::createAudioEngines() { OSArray* audioEngineArray = OSDynamicCast(OSArray, getProperty(AUDIO_ENGINES_KEY)); OSCollectionIterator* audioEngineIterator; OSDictionary* audioEngineDict; if (!audioEngineArray) { IOLog("SoundflowerDevice[%p]::createAudioEngine() - Error: no AudioEngine array in personality.\n", this); return false; } audioEngineIterator = OSCollectionIterator::withCollection(audioEngineArray); if (!audioEngineIterator) { IOLog("SoundflowerDevice: no audio engines available.\n"); return true; } while ((audioEngineDict = (OSDictionary*)audioEngineIterator->getNextObject())) { SoundflowerEngine* audioEngine = NULL; if (OSDynamicCast(OSDictionary, audioEngineDict) == NULL) continue; audioEngine = new SoundflowerEngine; if (!audioEngine) continue; if (!audioEngine->init(audioEngineDict)) continue; initControls(audioEngine); activateAudioEngine(audioEngine); // increments refcount and manages the object audioEngine->release(); // decrement refcount so object is released when the manager eventually releases it } audioEngineIterator->release(); return true; }
void OSMetaClass::serializeClassDictionary(OSDictionary *serializeDictionary) { OSDictionary *classDict; classDict = OSDictionary::withCapacity(sAllClassesDict->getCount()); if (!classDict) return; mutex_lock(loadLock); do { OSCollectionIterator *classes; const OSSymbol *className; classes = OSCollectionIterator::withCollection(sAllClassesDict); if (!classes) break; while ((className = (const OSSymbol *) classes->getNextObject())) { const OSMetaClass *meta; OSNumber *count; meta = (OSMetaClass *) sAllClassesDict->getObject(className); count = OSNumber::withNumber(meta->getInstanceCount(), 32); if (count) { classDict->setObject(className, count); count->release(); } } classes->release(); serializeDictionary->setObject("Classes", classDict); } while (0); mutex_unlock(loadLock); classDict->release(); }
IOReturn IOCatalogue::_removeDrivers(OSDictionary * matching) { IOReturn ret = kIOReturnSuccess; OSCollectionIterator * iter; OSDictionary * dict; OSArray * array; const OSSymbol * key; unsigned int idx; // remove configs from catalog. iter = OSCollectionIterator::withCollection(personalities); if (!iter) return (kIOReturnNoMemory); while ((key = (const OSSymbol *) iter->getNextObject())) { array = (OSArray *) personalities->getObject(key); if (array) for (idx = 0; (dict = (OSDictionary *) array->getObject(idx)); idx++) { /* Remove from the catalogue's array any personalities * that match the matching dictionary. * This comparison must be done with only the keys in the * "matching" dict to enable general matching. */ if (dict->isEqualTo(matching, matching)) { array->removeObject(idx); idx--; } } } iter->release(); return ret; }