• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IOFree函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IOFree函数的典型用法代码示例。如果您正苦于以下问题:C++ IOFree函数的具体用法?C++ IOFree怎么用?C++ IOFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: IOMalloc

IOReturn HoRNDIS::getHardwareAddress(IOEthernetAddress *ea) {
	UInt32	  i;
	void *buf;
	unsigned char *bp;
	int rlen = -1;
	int rv;
	
	buf = IOMalloc(RNDIS_CMD_BUF_SZ);
	if (!buf)
		return kIOReturnNoMemory;
	
	rv = rndisQuery(buf, OID_802_3_PERMANENT_ADDRESS, 48, (void **) &bp, &rlen);
	if (rv < 0) {
		LOG(V_ERROR, "getHardwareAddress OID failed?");
		IOFree(buf, RNDIS_CMD_BUF_SZ);
		return kIOReturnIOError;
	}
	LOG(V_DEBUG, "MAC Address %02x:%02x:%02x:%02x:%02x:%02x -- rlen %d",
	      bp[0], bp[1], bp[2], bp[3], bp[4], bp[5],
	      rlen);
	
	for (i=0; i<6; i++)
		ea->bytes[i] = bp[i];
	
	IOFree(buf, RNDIS_CMD_BUF_SZ);
	return kIOReturnSuccess;
}
开发者ID:burnsra,项目名称:HoRNDIS,代码行数:27,代码来源:HoRNDIS.cpp


示例2: GetMaxPacketSize

// Queue a read on a controller
bool WirelessGamingReceiver::QueueRead(int index)
{
    IOUSBCompletion complete;
    IOReturn err;
    WGRREAD *data;
    
    data = (WGRREAD*)IOMalloc(sizeof(WGRREAD));
    if (data == NULL)
        return false;
    data->index = index;
    data->buffer = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, GetMaxPacketSize(connections[index].controllerIn));
    if (data->buffer == NULL)
    {
        IOFree(data, sizeof(WGRREAD));
        return false;
    }

    complete.target = this;
    complete.action = _ReadComplete;
    complete.parameter = data;
    
    err = connections[index].controllerIn->Read(data->buffer, 0, 0, data->buffer->getLength(), &complete);
    if (err == kIOReturnSuccess)
        return true;
        
    data->buffer->release();
    IOFree(data, sizeof(WGRREAD));
    
//    IOLog("read - failed to start (0x%.8x)\n", err);
    return false;
}
开发者ID:derekvanvliet,项目名称:Xbox360ControllerManager,代码行数:32,代码来源:WirelessGamingReceiver.cpp


示例3: LOG

bool HoRNDIS::rndisSetPacketFilter(uint32_t filter) {
	union {
		unsigned char *buf;
		struct rndis_msg_hdr *hdr;
		struct rndis_set *set;
		struct rndis_set_c *set_c;
	} u;
	int rc;
	
	u.buf = (unsigned char *)IOMalloc(RNDIS_CMD_BUF_SZ);
	if (!u.buf) {
		LOG(V_ERROR, "out of memory?");
		return false;;
	}
	
	memset(u.buf, 0, sizeof *u.set);
	u.set->msg_type = RNDIS_MSG_SET;
	u.set->msg_len = cpu_to_le32(4 + sizeof *u.set);
	u.set->oid = OID_GEN_CURRENT_PACKET_FILTER;
	u.set->len = cpu_to_le32(4);
	u.set->offset = cpu_to_le32((sizeof *u.set) - 8);
	*(uint32_t *)(u.buf + sizeof *u.set) = filter;
	
	rc = rndisCommand(u.hdr, RNDIS_CMD_BUF_SZ);
	if (rc != kIOReturnSuccess) {
		LOG(V_ERROR, "SET not successful?");
		IOFree(u.buf, RNDIS_CMD_BUF_SZ);
		return false;
	}
	
	IOFree(u.buf, RNDIS_CMD_BUF_SZ);
	
	return true;
}
开发者ID:burnsra,项目名称:HoRNDIS,代码行数:34,代码来源:HoRNDIS.cpp


示例4: IOLog

void VoodooI2CHIDDevice::stop(IOService* device) {
    
    IOLog("I2C HID Device is stopping\n");
    
    destroy_wrapper();
    
    if (hid_device->timerSource){
        hid_device->timerSource->cancelTimeout();
        hid_device->timerSource->release();
        hid_device->timerSource = NULL;
    }
    
    //hid_device->workLoop->removeEventSource(hid_device->interruptSource);
    //hid_device->interruptSource->disable();
    hid_device->interruptSource = NULL;
    
    hid_device->workLoop->release();
    hid_device->workLoop = NULL;
    
    
    
    
    i2c_hid_free_buffers(ihid, HID_MIN_BUFFER_SIZE);
    IOFree(ihid, sizeof(i2c_hid));
    
    IOFree(hid_device, sizeof(I2CDevice));
    
    //hid_device->provider->close(this);
    
}
开发者ID:nuudles,项目名称:VoodooI2C,代码行数:30,代码来源:VoodooI2CHIDDevice.cpp


示例5: IOFree

void VoodooI2CHIDDevice::i2c_hid_free_buffers(i2c_hid *ihid, UInt report_size) {
    IOFree(ihid->inbuf, report_size);
    IOFree(ihid->argsbuf, report_size);
    IOFree(ihid->cmdbuf, sizeof(UInt8) + sizeof(UInt16) + sizeof(UInt16) + report_size);
    ihid->inbuf = NULL;
    ihid->cmdbuf = NULL;
    ihid->argsbuf = NULL;
    ihid->bufsize = 0;
}
开发者ID:nuudles,项目名称:VoodooI2C,代码行数:9,代码来源:VoodooI2CHIDDevice.cpp


示例6: IOFree

void SuperIOSensor::free()
{
	if (name)
		IOFree(name, 5);
	
	if (type)
		IOFree(type, 5);
	
	OSObject::free();
}
开发者ID:Beshuta,项目名称:HWSensors,代码行数:10,代码来源:SuperIOFamily.cpp


示例7: vm_delete

void vm_delete(VM* vm) {
	if (vm->cpus) {
		for (int i = 0; i < vm->num_cpus; i++) {
			if (vm->cpus[i])
				cpu_delete(vm->cpus[i]);			
		}
		IOFree(vm->cpus, sizeof(CPU*) * vm->num_cpus);
	}
	IOFree(vm, sizeof(VM));
	LOG("destroyed VM");
}
开发者ID:cocoajunkie,项目名称:vm,代码行数:11,代码来源:VM.cpp


示例8: IOFree

void FakeSMCKey::free() 
{
	if (key)
		IOFree(key, 5);
	
	if (type)
		IOFree(type, 5);
	
	if (value)
		IOFree(value, size);
	
	super::free(); 
}
开发者ID:ritzcarltn,项目名称:HWSensors,代码行数:13,代码来源:FakeSMCKey.cpp


示例9: IOFree

void eqMac2DriverEngine::free()
{
	//IOLog("eqMac2DriverEngine[%p]::free()\n", this);
    
    if (mBuffer) {
        IOFree(mBuffer, mBufferSize);
        mBuffer = NULL;
    }
    if (mThruBuffer) {
        IOFree(mThruBuffer, mBufferSize);
        mThruBuffer = NULL;
    }
    super::free();
}
开发者ID:Laurinus,项目名称:eqMac2,代码行数:14,代码来源:eqMac2DriverEngine.cpp


示例10: IOFree

void BluetoothClusterEngine::free()
{
  //IOLog("BluetoothClusterEngine[%p]::free()\n", this);
    
    if (mBuffer) {
        IOFree(mBuffer, mBufferSize);
        mBuffer = NULL;
    }
    if (mThruBuffer) {
        IOFree(mThruBuffer, mBufferSize);
        mThruBuffer = NULL;
    }
    super::free();
}
开发者ID:MWPainter,项目名称:-Not-Working-Currently-Ad-Hoc-Bluetooth-Surround-Sound,代码行数:14,代码来源:BluetoothClusterEngine.cpp


示例11: IOFree

void SoundflowerEngine::free()
{
	//IOLog("SoundflowerEngine[%p]::free()\n", this);
    
    if (mBuffer) {
        IOFree(mBuffer, mBufferSize);
        mBuffer = NULL;
    }
    if (mThruBuffer) {
        IOFree(mThruBuffer, mBufferSize);
        mThruBuffer = NULL;
    }
    super::free();
}
开发者ID:AntonTrapp,项目名称:Soundflower,代码行数:14,代码来源:SoundflowerEngine.cpp


示例12: protoss_unload

void protoss_unload() {
    protoss_stop();
    if(trace_start) {
        IOLog("trace_ptr was %d\n", trace_ptr - trace_start);
        IOFree(trace_start);
        trace_start = NULL;
        trace_ptr = NULL;
    }
    if(watch_start) {
        //IOLog("watch_ptr was %d\n", watch_ptr - watch_start);
        IOFree(watch_start);
        watch_start = NULL;
        watch_ptr = NULL;
    }
}
开发者ID:Bluerise,项目名称:white,代码行数:15,代码来源:protoss.c


示例13: stop

void REACConnection::deinit() {
    stop();

    if (NULL != dataStream) {
        dataStream->release();
        dataStream = NULL;
    }

    if (NULL != deviceInfo) {
        IOFree(deviceInfo, sizeof(REACDeviceInfo));
    }

    if (NULL != filterCommandGate) {
        workLoop->removeEventSource(filterCommandGate);
        filterCommandGate->release();
        filterCommandGate = NULL;
    }

    if (NULL != workLoop) {
        workLoop->release();
    }

    if (NULL != timerEventSource) {
        timerEventSource->cancelTimeout();
        workLoop->removeEventSource(timerEventSource);
        timerEventSource->release();
        timerEventSource = NULL;
    }

    if (NULL != interface) {
        ifnet_release(interface);
        interface = NULL;
    }
}
开发者ID:psmokotnin,项目名称:reacdriver,代码行数:34,代码来源:REACConnection.cpp


示例14: memcpy

bool GeforceSensors::shadowBios()
{
    struct nouveau_device *device = &card;

    //try to load bios from registry first from "vbios" property created by Chameleon boolloader
    if (OSData *vbios = OSDynamicCast(OSData, pciDevice->getProperty("vbios"))) {
        device->bios.size = vbios->getLength();
        device->bios.data = (u8*)IOMalloc(card.bios.size);
        memcpy(device->bios.data, vbios->getBytesNoCopy(), device->bios.size);
    }

    if (!device->bios.data || !device->bios.size || nouveau_bios_score(device, true) < 1) {
        if (nouveau_bios_shadow(device)) {
            //nv_info(device, "early shadow VBIOS succeeded\n");
        }
        else {
            if (device->bios.data && device->bios.size) {
                IOFree(card.bios.data, card.bios.size);
                device->bios.data = NULL;
                device->bios.size = 0;
            }
            return false;
        }
    }

    return true;
}
开发者ID:MagOO33,项目名称:HWSensors,代码行数:27,代码来源:GeforceSensors.cpp


示例15: sizeof

bool
IOSCSITape::GrowDeviceMinorNumberMemory(void)
{
	IOSCSITape **newDevices;
	int cur_size = sizeof(IOSCSITape *) *  deviceCount;
	int new_size = sizeof(IOSCSITape *) * (deviceCount + GROW_FACTOR);
	
	newDevices = (IOSCSITape **)IOMalloc(new_size);
	
	if (!newDevices)
		return false;
	
	bzero(newDevices, new_size);
	
	if (deviceCount)
	{
		memcpy(newDevices, devices, cur_size);
		IOFree(devices, cur_size);
	}
	
	devices = newDevices;
	deviceCount += GROW_FACTOR;
	
	return true;
}
开发者ID:cyranodb,项目名称:ioscsitape,代码行数:25,代码来源:IOSCSITape.cpp


示例16: SlotPtr

int32_t CLASS::CleanupControlEndpoint(uint8_t slot, bool justDisable)
{
	TRBStruct localTrb = { 0U };
	SlotStruct* pSlot;
	ringStruct* pRing;

	if (justDisable)
		goto do_disable;
	pSlot = SlotPtr(slot);
	pRing = pSlot->ringArrayForEndpoint[1];
	if (pRing) {
		DeallocRing(pRing);
		IOFree(pRing, sizeof *pRing);
		pSlot->ringArrayForEndpoint[1] = 0;
	}
	if (pSlot->md) {
		pSlot->md->complete();
		pSlot->md->release();
		pSlot->md = 0;
		pSlot->ctx = 0;
		pSlot->physAddr = 0U;
	}
	_addressMapper.Slot[0] = 0U;
	_addressMapper.Active[0] = false;

do_disable:
	localTrb.d = XHCI_TRB_3_SLOT_SET(static_cast<uint32_t>(slot));
	return WaitForCMD(&localTrb, XHCI_TRB_TYPE_DISABLE_SLOT, 0);
}
开发者ID:Paulac55,项目名称:OS-X-Generic-USB3,代码行数:29,代码来源:Slots.cpp


示例17: IOFree

//==============================================================================
// IOHIDEvent::initWithCapacity
//==============================================================================
bool IOHIDEvent::initWithCapacity(IOByteCount capacity)
{
    if (!super::init())
        return false;

    if (_data && (!capacity || _capacity < capacity) ) {
        // clean out old data's storage if it isn't big enough
        IOFree(_data, _capacity);
        _data = 0;
    }

    _capacity = capacity;

    if ( !_capacity )
        return false;

    if ( !_data && !(_data = (IOHIDEventData *) IOMalloc(_capacity)))
        return false;

    bzero(_data, _capacity);
    _data->size = _capacity;
    _children = NULL;
    
    clock_get_uptime(&_creationTimeStamp);

    return true;
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:30,代码来源:IOHIDEvent.cpp


示例18: IOFree

bool FakeSMCKey::setValueFromBuffer(const void *aBuffer, UInt8 aSize)
{
	if (!aBuffer || aSize == 0) 
		return false;
	
	if (aSize != size) {
		if (value)
			IOFree(value, size);
		
		size = aSize;
		
		if (!(value = IOMalloc(size)))
			return false;
	}
	
	bcopy(aBuffer, value, size);
	
	if (handler) {       
		IOReturn result = handler->callPlatformFunction(kFakeSMCSetValueCallback, false, (void *)key, (void *)value, (void *)size, 0);
		
		if (kIOReturnSuccess != result)
			HWSensorsWarningLog("value changed event callback error for key %s, return 0x%x", key, result);
	}
	
	return true;
}
开发者ID:alexandrezia,项目名称:HWSensors,代码行数:26,代码来源:FakeSMCKey.cpp


示例19: OSDynamicCast

bool VoodooI2CHIDDevice::probe(IOService* device) {

    
    hid_device = (I2CDevice *)IOMalloc(sizeof(I2CDevice));
    
    //hid_device->_dev = _controller->_dev;
    
    if (!super::start(device))
        return false;
    
    
    hid_device->provider = OSDynamicCast(IOACPIPlatformDevice, device);
    hid_device->provider->retain();
    
    int ret = i2c_get_slave_address(hid_device);
    if (ret < 0){
        IOLog("%s::%s::Failed to get a slave address for an I2C device, aborting.\n", getName(), _controller->_dev->name);
        IOFree(hid_device, sizeof(I2CDevice));
        return false;
    }
    
    
    IOLog("%s::%s::HID Probe called for i2c 0x%02x\n", getName(), _controller->_dev->name, hid_device->addr);
    
    initHIDDevice(hid_device);
    
    //super::stop(device);
    return 0;
}
开发者ID:nuudles,项目名称:VoodooI2C,代码行数:29,代码来源:VoodooI2CHIDDevice.cpp


示例20: IOLockLock

void IOHIKeyboard::free()
// Description:	Go Away. Be careful when freeing the lock.
{
    IOLock * lock = NULL;

    if ( _deviceLock )
    {
      lock = _deviceLock;
      IOLockLock( lock);
      _deviceLock = NULL;
    }

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

    if( _keyState )
        IOFree( _keyState, _keyStateSize);

    // RY: MENTAL NOTE Do this last
    if ( lock )
    {
      IOLockUnlock( lock);
      IOLockFree( lock);
    }
    
    super::free();
}
开发者ID:MomandDad,项目名称:netbook-installer,代码行数:28,代码来源:IOHIKeyboard.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IOGetByTag函数代码示例发布时间:2022-05-30
下一篇:
C++ IOException函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap