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


C++ IOFree函数代码示例

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


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


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