当前位置: 首页>>代码示例>>C++>>正文


C++ OSIterator::getNextObject方法代码示例

本文整理汇总了C++中OSIterator::getNextObject方法的典型用法代码示例。如果您正苦于以下问题:C++ OSIterator::getNextObject方法的具体用法?C++ OSIterator::getNextObject怎么用?C++ OSIterator::getNextObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OSIterator的用法示例。


在下文中一共展示了OSIterator::getNextObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: stop

void IOGUIDPartitionScheme::stop(IOService * provider)
{
    //
    // Clean up after the media objects we published before terminating.
    //

    IOMedia *    partition;
    OSIterator * partitionIterator;

    // State our assumptions.

    assert(_partitions);

    // Detach the media objects we previously attached to the device tree.

    partitionIterator = OSCollectionIterator::withCollection(_partitions);

    if ( partitionIterator )
    {
        while ( (partition = (IOMedia *) partitionIterator->getNextObject()) )
        {
            detachMediaObjectFromDeviceTree(partition);
        }

        partitionIterator->release();
    }

    super::stop(provider);
}
开发者ID:Andromeda-OS,项目名称:PlatformKEXTs,代码行数:29,代码来源:IOGUIDPartitionScheme.cpp

示例2: buildEntryTable

IOReturn AppleLM8x::publishChildren(IOService *nub)
{
	OSIterator			*childIterator = NULL;
	IORegistryEntry		*childEntry = NULL;
    IOService			*childNub = NULL;
    IOReturn 			status;

	childIterator = nub->getChildIterator(gIODTPlane);
	if( childIterator != NULL )
	{
		// Iterate through children and create nubs
		while ( ( childEntry = (IORegistryEntry *)( childIterator->getNextObject() ) ) != NULL )
		{
			// Build Table
			status = buildEntryTable(childEntry);
			LUNtableElement++;
			
			// Publish child as IOService
			childNub = OSDynamicCast(IOService, OSMetaClass::allocClassWithName("IOService"));
		
			childNub->init(childEntry, gIODTPlane);
			childNub->attach(this);
			childNub->registerService();
			
//			DLOG("AppleLM8x::publishChildren(0x%x) published child %s\n", kLM8xAddr<<1, childEntry->getName());
		}
	
		childIterator->release();
	}

	return kIOReturnSuccess;
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:32,代码来源:AppleLM8x.cpp

示例3: processChildren

void IOPMPagingPlexus::processChildren ( void )
{
    OSIterator *	childIterator;
    IOPowerConnection *	nextChildNub;
    IORegistryEntry *	nextChild;
    IOService *		child;
    unsigned int	i;
    
    childIterator = getChildIterator(gIOPowerPlane);

    if ( childIterator ) {
        while ( (nextChild = (IORegistryEntry *)(childIterator->getNextObject())) ) {
            if ( (nextChildNub = OSDynamicCast(IOPowerConnection,nextChild)) ) {
                child = (IOService *)nextChild->getChildEntry(gIOPowerPlane);
                if ( child->pm_vars->theControllingDriver ) {
                    for ( i = 1; i < child->pm_vars->theNumberOfPowerStates; i++ ) {
                        child->pm_vars->thePowerStates[i].inputPowerRequirement |= IOPMPagingAvailable;
                    }
                }
                if ( child->pm_vars->myCurrentState ) {
                    nextChildNub->setDesiredDomainState(kIOPlexusPowerStateCount-1);
                }
            }
        }
        childIterator->release();
    }
}
开发者ID:OpenDarwin-CVS,项目名称:SEDarwin,代码行数:27,代码来源:IOPMPagingPlexus.cpp

示例4: pmem_iokit_enumerate_pci

kern_return_t pmem_iokit_enumerate_pci(pmem_pci_callback_t callback,
                                       void *ctx) {
    kern_return_t error = KERN_FAILURE;
    OSObject *obj = nullptr;
    OSDictionary *search = nullptr;
    OSIterator *iter = nullptr;
    IOPCIDevice *dev = nullptr;
    IODeviceMemory *mem = nullptr;
    IOItemCount mem_count = 0;
    int cmp;

    search = IOService::serviceMatching("IOPCIDevice");
    iter = IOService::getMatchingServices(search);
    if (!iter) {
        pmem_error("Couldn't find any PCI devices.");
        goto bail;
    }

    while ((obj = iter->getNextObject())) {
        cmp = strncmp("IOPCIDevice",
                      obj->getMetaClass()->getClassName(),
                      strlen("IOPCIDevice"));
        if (cmp != 0) {
            // I haven't seen the above return anything other than
            // PCI devices, but Apple's documentation is sparse (which
            // is a nice word for what it is) and doesn't actually
            // say anything about what's guaranteed to be returned.
            // I'd just as well rather not chance it.
            pmem_warn("Expected IOPCIDevice but got %s - skipping.",
                      obj->getMetaClass()->getClassName());
            continue;
        }
        dev = (IOPCIDevice *)obj;
        mem_count = dev->getDeviceMemoryCount();
        pmem_debug("Found PCI device %s", dev->getName());

        for (unsigned idx = 0; idx < mem_count; ++idx) {
            pmem_debug("Memory segment %d found.", idx);
            mem = dev->getDeviceMemoryWithIndex(idx);
            pmem_signal_t signal = callback(dev, mem, idx, ctx);
            if (signal == pmem_Stop) {
                error = KERN_FAILURE;
                goto bail;
            }
        }
    }

    error = KERN_SUCCESS;

bail:
    if (iter) {
        iter->release();
    }

    if (search) {
        search->release();
    }

    return error;
}
开发者ID:453483289,项目名称:rekall,代码行数:60,代码来源:iokit_pci.cpp

示例5: OSDynamicCast

IOReturn IOI2CMaxim1631::publishChildren(IOService *nub)
{
    OSIterator			*childIterator = NULL;
    IORegistryEntry		*childEntry = NULL;
    IOService			*childNub = NULL;

	childIterator = nub->getChildIterator(gIODTPlane);
	if( childIterator != NULL )
	{
		// Iterate through children and create nubs
		while ( ( childEntry = (IORegistryEntry *)( childIterator->getNextObject() ) ) != NULL )
		{
			// Publish child as IOService
			childNub = OSDynamicCast(IOService, OSMetaClass::allocClassWithName("IOService"));
		
			childNub->init(childEntry, gIODTPlane);
			childNub->attach(this);
			childNub->registerService();
                           			
			DLOG("IOI2CMaxim1631::publishChildren(0x%x) published child %s\n", getI2CAddress(), childEntry->getName());
		}
	
		childIterator->release();
	}

	return kIOReturnSuccess;
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:27,代码来源:IOI2CMaxim1631.cpp

示例6: DbgLog

IOACPIPlatformDevice * ACPIBacklightPanel::getChildWithBacklightMethods(IOACPIPlatformDevice * GPUdevice)
{
    DbgLog("%s::%s()\n", this->getName(),__FUNCTION__);
    
	OSIterator * 		iter = NULL;
	OSObject *		entry;
    
	iter =  GPUdevice->getChildIterator(gIOACPIPlane);
	if (iter)
	{
		while ( true )
		{			
			entry = iter->getNextObject();
			if (NULL == entry)
				break;
			
			if (entry->metaCast("IOACPIPlatformDevice"))
			{
				IOACPIPlatformDevice * device = (IOACPIPlatformDevice *) entry;
				
				if (hasBacklightMethods(device))
				{
					IOLog("ACPIBacklight: Found Backlight Device: %s\n", device->getName());
					return device;
				}
			}
			else {
				DbgLog("%s: getChildWithBacklightMethods() Cast Error\n", this->getName());
			}
		} //end while
		iter->release();
		DbgLog("%s: getChildWithBacklightMethods() iterator end\n", this->getName());
	}
	return NULL;
}
开发者ID:chemschool,项目名称:OS-X-ACPI-Backlight,代码行数:35,代码来源:ACPIBacklight.cpp

示例7: OSDynamicCast

IOReturn
IOI2CLM6x::createChildNubs	(
								IOService*			nub
							)
{
	OSIterator*							childIterator;
	IORegistryEntry*					childEntry;
	IOService*							childNub;

	require( ( childIterator = nub->getChildIterator( gIODTPlane ) ) != NULL, IOI2CLM6x_createChildNubs_getChildIteratorNull );

	while ( ( childEntry = ( IORegistryEntry * ) childIterator->getNextObject() ) != NULL )
	{
		childNub = OSDynamicCast( IOService, OSMetaClass::allocClassWithName( "IOService" ) );

		if ( childNub )
		{
			childNub->init( childEntry, gIODTPlane );
			childNub->attach( this );
			childNub->registerService();
		}
	}

IOI2CLM6x_createChildNubs_getChildIteratorNull:
	return( kIOReturnSuccess );
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:26,代码来源:IOI2CLM6x.cpp

示例8: getBatteryDevice

IOService * ACPIBacklightPanel::getBatteryDevice()
{
	DbgLog("%s::%s()\n", this->getName(),__FUNCTION__);
    
    OSDictionary * matching = IOService::serviceMatching("IOPMPowerSource");
	OSIterator *   iter = NULL;
	IOService * bat = NULL;
	
	if (matching)
	{
		DbgLog("%s: getBatteryDevice() serviceMatching OK\n", this->getName());
		iter = IOService::getMatchingServices(matching);
		matching->release();
	}
	
	if (iter)
	{
		DbgLog("%s: getBatteryDevice() iter OK\n", this->getName());
		
		bat = OSDynamicCast(IOService, iter->getNextObject());
		if (bat)
		{
			DbgLog("%s: getBatteryDevice() bat is of class %s\n", this->getName(), bat->getMetaClass()->getClassName());	
		}
		
		iter->release();
	}
	
	return bat;
}
开发者ID:chemschool,项目名称:OS-X-ACPI-Backlight,代码行数:30,代码来源:ACPIBacklight.cpp

示例9: OSDynamicCast

IOReturn IOI2CDriveBayGPIO::publishChildren(IOService *provider)
{
    IOReturn 			status = kIOReturnSuccess;
	OSIterator			*iter;
	IORegistryEntry		*next;
    IOService			*nub;

	if (iter = provider->getChildIterator(gIODTPlane))
	{
		// Iterate through children and create nubs
		while (next = (IORegistryEntry *)(iter->getNextObject()))
		{
			nub = OSDynamicCast(IOService, OSMetaClass::allocClassWithName("IOI2CService"));
			if (nub)
			{
				nub->init(next, gIODTPlane);
				nub->attach(this);
				nub->registerService();
			
//				DLOG("[email protected]%lx::publishChildren published child %s\n", getI2CAddress(), next->getName());
			}
		}

		iter->release();
	}

	return status;
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:28,代码来源:IOI2CDriveBayGPIO.cpp

示例10: processSiblings

void IOPMPagingPlexus::processSiblings ( IOService * aNode )
{
    OSIterator *	parentIterator;
    IORegistryEntry *	nextNub;
    IORegistryEntry *	nextParent;
    OSIterator *	siblingIterator;
    IORegistryEntry *	nextSibling;

    parentIterator = aNode->getParentIterator(gIOPowerPlane);		// iterate parents of this node

    if ( parentIterator ) {
        while ( true ) {
            if ( ! (nextNub = (IORegistryEntry *)(parentIterator->getNextObject())) ) {
                parentIterator->release();
                break;
            }
            if ( OSDynamicCast(IOPowerConnection,nextNub) ) {
                nextParent = nextNub->getParentEntry(gIOPowerPlane);
                if ( nextParent == getPMRootDomain() ) {
                    continue;				// plexus already has root's children
                }
                if ( nextParent == this ) {
                    parentIterator->release();
                    removePowerChild((IOPowerConnection *)nextNub);
                    break;
                }
                siblingIterator = nextParent->getChildIterator(gIOPowerPlane);
                                                                                // iterate children of this parent
                if ( siblingIterator ) {
                    while ( (nextSibling = (IORegistryEntry *)(siblingIterator->getNextObject())) ) {
                        if ( OSDynamicCast(IOPowerConnection,nextSibling) ) {
                            nextSibling = nextSibling->getChildEntry(gIOPowerPlane);
                            if ( nextSibling != aNode ) {			// non-ancestor of driver gets
                                addPowerChild((IOService *)nextSibling);	// plexus as parent
                            }
                        }
                    }
                    siblingIterator->release();
                }
                processSiblings((IOService *)nextParent);			// do the same thing to this parent
            }
   	}
    }
}
开发者ID:OpenDarwin-CVS,项目名称:SEDarwin,代码行数:44,代码来源:IOPMPagingPlexus.cpp

示例11: setCPUState

void MacRISC2CPU::haltCPU(void)
{
	OSIterator 		*childIterator;
	IORegistryEntry *childEntry, *childDriver;
	IOPCIBridge		*pciDriver;
	OSData			*deviceTypeString;
	UInt32			i;

  
    setCPUState(kIOCPUStateStopped);
  
    if (bootCPU)
    {
		// Some systems require special handling of Ultra-ATA at sleep.
		// Call UniN to prepare for that, if necessary
		uniN->callPlatformFunction ("setupUATAforSleep", false, (void *)0, (void *)0, (void *)0, (void *)0);

		// Notify our pci children to save their state
		if (!topLevelPCIBridgeCount) {
			// First build list of top level bridges - only need to do once as these don't change
			if ((childIterator = macRISC2PE->getChildIterator (gIOServicePlane)) != NULL) {
				while ((childEntry = (IORegistryEntry *)(childIterator->getNextObject ())) != NULL) {
					deviceTypeString = OSDynamicCast( OSData, childEntry->getProperty( "device_type" ));
					if (deviceTypeString) {
						if (!strcmp((const char *)deviceTypeString->getBytesNoCopy(), "pci")) {
							childDriver = childEntry->copyChildEntry(gIOServicePlane);
							if (childDriver) {
								pciDriver = OSDynamicCast( IOPCIBridge, childDriver );
								if (pciDriver)
									if (topLevelPCIBridgeCount < kMaxPCIBridges)
										// Remember this driver
										topLevelPCIBridges[topLevelPCIBridgeCount++] = pciDriver;
									else
										kprintf ("MacRISC2CPU::haltCPU - warning, more than %d PCI bridges - cannot save/restore them all\n", kMaxPCIBridges);
								childDriver->release();
							}
						}
					}
				}
				childIterator->release();
			}
		}
		for (i = 0; i < topLevelPCIBridgeCount; i++)
			if (pciDriver = topLevelPCIBridges[i]) {
				// Got the driver - send the message
				pciDriver->setDevicePowerState (NULL, 2);
			}
    }

   kprintf("MacRISC2CPU::haltCPU %ld Here!\n", getCPUNumber());

   processor_exit(machProcessor);
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:53,代码来源:MacRISC2CPU.cpp

示例12: setup

bool AutoThrottler::setup(OSObject* owner) {
	if (setupDone) return true;
	
	workLoop = IOWorkLoop::workLoop();
	if (workLoop == 0) return false;
	
	perfTimer = IOTimerEventSource::timerEventSource(owner, (IOTimerEventSource::Action) &perfTimerWrapper);
	if (perfTimer == 0) return false;
	
	/* from Superhai (modified by mercurysquad) */
	cpu_count = 0; OSDictionary* service;
	mach_timespec_t serviceTimeout = { 60, 0 }; // in seconds
	totalTimerEvents = 0;
	
	IOService* firstCPU = IOService::waitForService(IOService::serviceMatching("IOCPU"), &serviceTimeout);

	if (!firstCPU) {
		warn("IOKit CPUs not found. Auto-throttle may not work.\n");
		return false;
	} else {
		// we got first cpu, so the others should also be available by now. get them
		service = IOService::serviceMatching("IOCPU");
	}
	
	OSIterator* iterator = IOService::getMatchingServices(service);
	
	if (!iterator) {
		warn("IOKit CPU iterator couldn't be created. Auto-throttle may not work.\n");
		return false;
	}

	IOCPU * cpu;
	while ((cpu = OSDynamicCast(IOCPU, iterator->getNextObject())))
	{
		/*dbg("Got I/O Kit CPU %d (%u) named %s", cpu_count, (unsigned int)(cpu->getCPUNumber(), cpu->getCPUName()->getCStringNoCopy());
    */
		mach_cpu[cpu_count] = cpu->getMachProcessor();
		if (cpu_count++ > max_cpus) break;
	}
	selfHost = host_priv_self();
	if (workLoop->addEventSource(perfTimer) != kIOReturnSuccess) return false;
	currentPState = NumberOfPStates - 1;
	perfTimer->setTimeoutMS(throttleQuantum * (1 + currentPState));
	clock_get_uptime(&lastTime);
	if (!targetCPULoad) targetCPULoad = defaultTargetLoad; // % x10
	sysctl_register_oid(&sysctl__kern_cputhrottle_targetload);
	sysctl_register_oid(&sysctl__kern_cputhrottle_auto);
	setupDone = true;
	return true;
}
开发者ID:Knoflook,项目名称:xnu-speedstep-air,代码行数:50,代码来源:IntelEnhancedSpeedStep.cpp

示例13: num_kids

int num_kids(IOService *provider)
{
	int total = 1;
	//total++;
	OSIterator *kids;
	const char* poo = provider->getName();
	IOLog("name: %s \n", poo);
	if (kids = provider->getChildIterator(gIOServicePlane)) {
		IOService *nextkid;
		while (nextkid = (IOService*)kids->getNextObject()) {
			total += num_kids(nextkid);
		}
		kids->release();
	}
	return total;
}
开发者ID:engur,项目名称:Wiiji-EnGuR,代码行数:16,代码来源:virtualhid.cpp

示例14: _terminateDrivers

static IOReturn _terminateDrivers(OSDictionary * matching)
{
    OSDictionary         * dict;
    OSIterator           * iter;
    IOService            * service;
    IOReturn               ret;

    if ( !matching )
        return kIOReturnBadArgument;

    ret = kIOReturnSuccess;
    dict = 0;
    iter = IORegistryIterator::iterateOver(gIOServicePlane,
                                           kIORegistryIterateRecursively);
    if ( !iter )
        return kIOReturnNoMemory;

    UniqueProperties( matching );

    // terminate instances.
    do {
        iter->reset();
        while( (service = (IOService *)iter->getNextObject()) ) {
            dict = service->getPropertyTable();
            if ( !dict )
                continue;

            /* Terminate only for 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;

            if ( !service->terminate(kIOServiceRequired|kIOServiceSynchronous) ) {
                ret = kIOReturnUnsupported;
                break;
            }
        }
    } while( !service && !iter->isValid());
    iter->release();

    return ret;
}
开发者ID:,项目名称:,代码行数:44,代码来源:

示例15: isStartUp

bool AppleACPIBatteryDevice::isStartUp()
{
    OSDictionary * matching = IOService::serviceMatching("AppleBacklightDisplay");
	OSIterator *   iter = NULL;
	IOService * service = NULL;
	
	if (matching)
	{
		iter = IOService::getMatchingServices(matching);
		matching->release();
	}
	
	if (iter)
	{
		service = OSDynamicCast(IOService, iter->getNextObject());
		iter->release();
	}
	return (service != NULL);
}
开发者ID:htge,项目名称:AppleACPIBatteryManager,代码行数:19,代码来源:AppleACPIBatteryDevice.cpp


注:本文中的OSIterator::getNextObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。