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


C++ OSBoolean类代码示例

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


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

示例1: OSDynamicCast

// GetPlistValue
UInt32 
VoodooPState::getPlistValue(OSDictionary * dictionary,
						   const char * symbol)
{
	OSObject * object = 0;
	OSBoolean * boolean = false;
	OSNumber * number = 0;
	OSString * string = 0;
	object = dictionary->getObject(symbol);
	if (object && (OSTypeIDInst(object) == OSTypeID(OSBoolean)))
	{
		boolean = OSDynamicCast(OSBoolean, object);
		return boolean->getValue();
	}
	if (object && (OSTypeIDInst(object) == OSTypeID(OSNumber)))
	{
		number = OSDynamicCast(OSNumber, object);
		return number->unsigned32BitValue();
	}
	if (object && (OSTypeIDInst(object) == OSTypeID(OSString)))
	{
		string = OSDynamicCast(OSString, object);
		// Implement string to number conversion
	}
	return 0;
}
开发者ID:andyvand,项目名称:Intel-OS-X-LAN-Driver,代码行数:27,代码来源:VoodooPState.cpp

示例2: OSDynamicCast

bool iTCOWatchdog::init (OSDictionary* dict)
{
    OSNumber *nkey;
    OSBoolean *bkey;
    bool res;
    
    //DbgPrint(drvid, "init\n");
    res = super::init(dict);
    
    Timeout = DEFAULT_TIMEOUT;
    SelfFeeding = false;
    WorkaroundBug = false;
    
    if ((conf = OSDynamicCast(OSDictionary, getProperty("Settings"))) &&
        (nkey = OSDynamicCast(OSNumber, conf->getObject("Timeout"))))
        Timeout = nkey->unsigned32BitValue();
    if (conf && (bkey = OSDynamicCast(OSBoolean, conf->getObject("SelfFeeding"))))
        SelfFeeding = bkey->isTrue();
    if (conf && (bkey = OSDynamicCast(OSBoolean, conf->getObject("UnsafeWorkaroundBIOSBug"))))
        WorkaroundBug = bkey->isTrue();
    
    first_run = true;
    is_active = SMIWereEnabled = false;
    
    GCSMem.range = NULL; GCSMem.map = NULL;
    
    lock = IOSimpleLockAlloc();
    
    return res;
}
开发者ID:bigmagic,项目名称:osx-goodies,代码行数:30,代码来源:iTCOWatchdog.cpp

示例3: OSDynamicCast

UInt32 ACPIBacklightPanel::queryACPICurentBrightnessLevel()
{
    //DbgLog("%s::%s()\n", this->getName(),__FUNCTION__);

    if (_backlightHandler)
        return _backlightHandler->getBacklightLevel();
    
    UInt32 level = minAC;
    const char* method = _extended ? "XBQC" : "_BQC";
	if (kIOReturnSuccess == backLightDevice->evaluateInteger(method, &level))
	{
		//DbgLog("%s: queryACPICurentBrightnessLevel %s = %d\n", this->getName(), method, level);
        
        OSBoolean * useIdx = OSDynamicCast(OSBoolean, getProperty("BQC use index"));
        if (useIdx && useIdx->isTrue())
        {
            OSArray * levels = queryACPISupportedBrightnessLevels();
            if (levels)
            {
                OSNumber *num = OSDynamicCast(OSNumber, levels->getObject(level));
                if (num)
                    level = num->unsigned32BitValue();
                levels->release();
            }
        }
        //DbgLog("%s: queryACPICurentBrightnessLevel returning %d\n", this->getName(), level);
	}
	else {
		IOLog("ACPIBacklight: Error in queryACPICurentBrightnessLevel %s\n", method);
	}
    //some laptops didn't return anything on startup, return then max value (first entry in _BCL):
	return level;
}
开发者ID:chemschool,项目名称:OS-X-ACPI-Backlight,代码行数:33,代码来源:ACPIBacklight.cpp

示例4: OSDynamicCast

void SuperIO::LoadConfiguration(IOService* provider) {
	m_Service = provider;
	
	OSBoolean* fanControl = OSDynamicCast(OSBoolean, provider->getProperty("Enable Fan Control"));	
	m_FanControl = fanControl->getValue();
	
	OSBoolean* alternateRegisters = OSDynamicCast(OSBoolean, provider->getProperty("Register number alternative variant"));
	m_AlternateRegisters = alternateRegisters->getValue();
		
	OSArray* fanIDs = OSDynamicCast(OSArray, provider->getProperty("Fan Names"));	
	if (fanIDs) fanIDs = OSArray::withArray(fanIDs);	
    if (fanIDs)  {
		UInt32 count = fanIDs->getCount();
		
		if(count > 5)
			count = 5;
		
		for (UInt32 i = 0; i < count; i++) {
			OSString* name = OSDynamicCast(OSString, fanIDs->getObject(i)); 
			FanName[i] = name->getCStringNoCopy();
		}
		
		fanIDs->release();
    }
}
开发者ID:AppleLife,项目名称:FakeSMC,代码行数:25,代码来源:SuperIO.cpp

示例5: HWSensorsFatalLog

bool TZSensors::start(IOService * provider)
{
	if (!super::start(provider))
        return false;
    
	acpiDevice = (IOACPIPlatformDevice *)provider;
	
	if (!acpiDevice) {
        HWSensorsFatalLog("ACPI device not ready");
        return false;
    }
    
    if (OSDictionary *configuration = getConfigurationNode()) {
        OSBoolean* disable = OSDynamicCast(OSBoolean, configuration->getObject("DisableDevice"));
        if (disable && disable->isTrue())
            return false;
    }

    // On some computers (eg. RehabMan's ProBook 4530s), the system will hang on startup
    // if kernel cache is used, because of the early call to updateTemperatures and/or
    // updateTachometers.  At least that is the case with an SSD and a valid pre-linked
    // kernel, along with kernel cache enabled.  This 1000ms sleep seems to fix the problem,
    // enabling a clean boot with TZSensors enabled.
    //
    // On the ProBook this is the case with both TZSensors and PTIDSensors, although
    // PTIDSensors can be avoided by using DropSSDT=Yes (because PTID device is in an SSDT)
    //
    // And in the case of TZSensors it even happens (intermittently) without kernel cache.

    IOSleep(1000);

    OSObject *object = NULL;

    if(kIOReturnSuccess == acpiDevice->evaluateObject("_TMP", &object) && object) {
        for (UInt8 i = 0; i < 0xf; i++) {
            char key[5];
            
            snprintf(key, 5, KEY_FORMAT_THERMALZONE_TEMPERATURE, i);
            
            if (!isKeyHandled(key)) {
                if (addSensor(key, TYPE_SP78, TYPE_SPXX_SIZE, kFakeSMCTemperatureSensor, 0)) {
                    break;
                }
            }
        }
    }
    
    registerService();
    
    HWSensorsInfoLog("started on %s", acpiDevice->getName());
    
    return true;
}
开发者ID:gbrigens,项目名称:OS-X-FakeSMC-kozlek,代码行数:53,代码来源:TZSensors.cpp

示例6: XTRACE

IOService *AppleUSBCDC::probe(IOService *provider, SInt32 *score)
{
	IOUSBDevice *newDevice = NULL;
	UInt8		classValue = 0;
    OSNumber	*classInfo = NULL;
	SInt32		newScore = 0;
    IOService   *res;
	
	XTRACE(this, 0, *score, "probe");
	
	OSBoolean *boolObj = OSDynamicCast(OSBoolean, provider->getProperty("kCDCDoNotMatchThisDevice"));
    if (boolObj && boolObj->isTrue())
    {
        XTRACE(this, 0, *score, "probe - provider doesn't want us to match");
        return NULL;
    }
	
		// Check the device class, we need to handle Miscellaneous or Composite class a little different
	
	classInfo = (OSNumber *)provider->getProperty("bDeviceClass");
    if (classInfo)
    {
        classValue = classInfo->unsigned32BitValue();
		if ((classValue == kUSBCompositeClass) || (classValue == kUSBMiscellaneousClass))
		{
			newDevice = OSDynamicCast(IOUSBDevice, provider);
			if(!newDevice)
			{
				XTRACE(this, 0, 0, "probe - provider invalid");
			} else {
					// Check if it has CDC interfaces
					
				if (checkDevice(newDevice))
				{
					newScore = 1;			// We need to see the device before the Composite driver does
				} else {
					XTRACE(this, 0, 0, "probe - Composite or Micsellaneous class but not CDC");
					return NULL;			// We're not interested
				}
			}
		}
	}

	*score += newScore;
	
    res = super::probe(provider, score);
	
	XTRACE(this, 0, *score, "probe - Exit");
    
    return res;
    
}/* end probe */
开发者ID:Kiichi77,项目名称:MacOSX,代码行数:52,代码来源:AppleUSBCDC.cpp

示例7: getACStatus

bool getACStatus()
{
	IOService * batteryDevice = getBatteryDevice();
	
	if (NULL != batteryDevice)
	{
		OSObject * obj = batteryDevice->getProperty("ExternalConnected");
		OSBoolean * status = OSDynamicCast(OSBoolean, obj);
        if (status)
            return status->getValue();
	}
    return true;
}
开发者ID:htge,项目名称:AutoDisableTurboBoost,代码行数:13,代码来源:Battery.cpp

示例8: DEBUG_LOG

ApplePS2CypressTouchPad* ApplePS2CypressTouchPad::probe( IOService * provider, SInt32 * score )
{
    DEBUG_LOG("ApplePS2CypressTouchPad::probe entered...\n");
    //
    // The driver has been instructed to verify the presence of the actual
    // hardware we represent. We are guaranteed by the controller that the
    // mouse clock is enabled and the mouse itself is disabled (thus it
    // won't send any asynchronous mouse data that may mess up the
    // responses expected by the commands we send it).
    //

    bool                  success = false;
    
    if (!super::probe(provider, score))
        return 0;
    OSDictionary* list = OSDynamicCast(OSDictionary, getProperty(kPlatformProfile));
    ApplePS2Device* d = (ApplePS2Device*)provider;
    OSDictionary* config = d->getController()->makeConfigurationNode(list, "Cypress Touchpad"); //ApplePS2Controller::makeConfigurationNode(list);
    if (config)
    {
        // if DisableDevice is Yes, then do not load at all...
        OSBoolean* disable = OSDynamicCast(OSBoolean, config->getObject(kDisableDevice));
        if (disable && disable->isTrue())
        {
            config->release();
            return false;
        }
#ifdef DEBUG
        // save configuration for later/diagnostics...
        setProperty(kMergedConfiguration, config);
#endif
    }
    _device = (ApplePS2MouseDevice *) d;

    cypressReset();
    success = cypressReadFwVersion();
    if (success &&_touchPadVersion > 11)
      {
	_tapFrameMax = 11;
	_lockFrameMin = 80; // sync packet rate is superior on > 11 firmware ... should be good ... (not tested) ...
      }
    _device = 0;
    DEBUG_LOG("CYPRESS: ApplePS2CypressTouchPad::probe leaving.\n");

    return (success) ? this : 0;
}
开发者ID:ulysse31,项目名称:voodoops2controllercypress,代码行数:46,代码来源:VoodooPS2CypressTouchPad.cpp

示例9: setParamProperties

IOReturn ApplePS2Mouse::setParamProperties( OSDictionary * config )
{
	if (NULL == config)
		return 0;
    
    const struct {const char *name; int *var;} int32vars[]={
        {"DefaultResolution",               &defres},
        {"ResolutionMode",                  &resmode},
        {"ScrollResolution",                &scrollres},
        {"MouseYInverter",                  &mouseyinverter},
        {"WakeDelay",                       &wakedelay},
    };
    const struct {const char *name; int *var;} boolvars[]={
        {"ForceDefaultResolution",          &forceres},
        {"ForceSetResolution",              &forcesetres},
        {"ActLikeTrackpad",                 &actliketrackpad},
        {"DisableLEDUpdating",              &noled},
    };
    const struct {const char* name; bool* var;} lowbitvars[]={
        {"TrackpadScroll",                  &scroll},
        {"OutsidezoneNoAction When Typing", &outzone_wt},
        {"PalmNoAction Permanent",          &palm},
        {"PalmNoAction When Typing",        &palm_wt},
    };
    
    OSNumber *num;
    OSBoolean *bl;
    
    // boolean config items
    for (int i = 0; i < countof(boolvars); i++)
        if ((bl=OSDynamicCast (OSBoolean,config->getObject (boolvars[i].name))))
            *boolvars[i].var = bl->isTrue();
    // lowbit config items
	for (int i = 0; i < countof(lowbitvars); i++)
		if ((num=OSDynamicCast (OSNumber,config->getObject(lowbitvars[i].name))))
			*lowbitvars[i].var = (num->unsigned32BitValue()&0x1)?true:false;
    // 32-bit config items
    for (int i = 0; i < countof(int32vars);i++)
        if ((num=OSDynamicCast (OSNumber,config->getObject (int32vars[i].name))))
            *int32vars[i].var = num->unsigned32BitValue();
    
    // convert to IOFixed format...
    defres <<= 16;
    
    return super::setParamProperties(config);
}
开发者ID:deftsp,项目名称:OS-X-Voodoo-PS2-Controller,代码行数:46,代码来源:VoodooPS2Mouse.cpp

示例10: OSDynamicCast

// Read the settings from the registry
void Xbox360Peripheral::readSettings(void)
{
    OSBoolean *value = NULL;
    OSNumber *number = NULL;
    OSDictionary *dataDictionary = OSDynamicCast(OSDictionary, getProperty(kDriverSettingKey));
    
    if (dataDictionary == NULL) return;
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertLeftX"));
    if (value != NULL) invertLeftX = value->getValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertLeftY"));
    if (value != NULL) invertLeftY = value->getValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertRightX"));
    if (value != NULL) invertRightX = value->getValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertRightY"));
    if (value != NULL) invertRightY = value->getValue();
    number = OSDynamicCast(OSNumber, dataDictionary->getObject("DeadzoneLeft"));
    if (number != NULL) deadzoneLeft = number->unsigned32BitValue();
    number = OSDynamicCast(OSNumber, dataDictionary->getObject("DeadzoneRight"));
    if (number != NULL) deadzoneRight = number->unsigned32BitValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("RelativeLeft"));
    if (value != NULL) relativeLeft = value->getValue();
    value = OSDynamicCast(OSBoolean, dataDictionary->getObject("RelativeRight"));
    if (value != NULL) relativeRight=value->getValue();
    
#if 0
    IOLog("Xbox360Peripheral preferences loaded:\n  invertLeft X: %s, Y: %s\n   invertRight X: %s, Y:%s\n  deadzone Left: %d, Right: %d\n\n",
            invertLeftX?"True":"False",invertLeftY?"True":"False",
            invertRightX?"True":"False",invertRightY?"True":"False",
            deadzoneLeft,deadzoneRight);
#endif
}
开发者ID:miroswan,项目名称:360Controller,代码行数:32,代码来源:_60Controller.cpp

示例11: checkACStatusThread

static void checkACStatusThread(thread_call_param_t	param0,
                           thread_call_param_t	param1)
{
    int i=0;
    const int retryTimes = 10;
    
    while (!isStatusThreadCanCancel && i<retryTimes) {
        if(NULL == commmonBatteryDevice)
        {
            IOLog("Can't find battery device, retry %d...\n", retryTimes-i);
            commmonBatteryDevice = getBatteryDevice();
            IOSleep(3000);
            i++;
            continue;
        }
        
		OSObject * obj = commmonBatteryDevice->getProperty("ExternalConnected");
		OSBoolean * status = OSDynamicCast(OSBoolean, obj);
        if (!status)
        {
            IOLog("Battery status get failed.\n");
            break;
        }
        if(ACStatusChangedCallback)
        {
            bool batStatus = status->getValue();
            if(batStatus != ACStatus)
            {
                //IOLog("Battery status changed.\n");
                ACStatus = batStatus;
                ACStatusChangedCallback(batStatus);
            }
        }
        else
            ACStatus = status->getValue();
        
        IOSleep(ACStatus?1000:5000);//1s=1000ms
    }
    
    if(i == 10)
        IOLog("Can't find battery device, exit.\n");
    else
        IOLog("Battery thread cancelled.\n");
    isStatusThreadCancelled = true;
}
开发者ID:htge,项目名称:AutoDisableTurboBoost,代码行数:45,代码来源:Battery.cpp

示例12: DbgLog

bool ACPIBacklightPanel::getACStatus()
{
    DbgLog("%s::%s()\n", this->getName(),__FUNCTION__);
    
	IOService * batteryDevice = getBatteryDevice();
	
	if (NULL != batteryDevice)
	{
		OSObject * obj = batteryDevice->getProperty("ExternalConnected");
		OSBoolean * status = OSDynamicCast(OSBoolean, obj);
        if (status)
        {
            DbgLog("%s: getACStatus() AC is %d\n", this->getName(), status->getValue());
            return status->getValue();
        }
        else
            DbgLog("%s: getACStatus() unable to get \"ExternalConnected\" property\n", this->getName());
	}
    return true;
}
开发者ID:chemschool,项目名称:OS-X-ACPI-Backlight,代码行数:20,代码来源:ACPIBacklight.cpp

示例13: OSDynamicCast

bool ApplePS2SentelicFSP::init(OSDictionary* dict)
{
    //
    // Initialize this object's minimal state. This is invoked right after this
    // object is instantiated.
    //
    
    if (!super::init(dict))
        return false;
	
    // find config specific to Platform Profile
    OSDictionary* list = OSDynamicCast(OSDictionary, dict->getObject(kPlatformProfile));
    OSDictionary* config = ApplePS2Controller::makeConfigurationNode(list);
    if (config)
    {
        // if DisableDevice is Yes, then do not load at all...
        OSBoolean* disable = OSDynamicCast(OSBoolean, config->getObject(kDisableDevice));
        if (disable && disable->isTrue())
        {
            config->release();
            return false;
        }
#ifdef DEBUG
        // save configuration for later/diagnostics...
        setProperty(kMergedConfiguration, config);
#endif
    }
    
    // initialize state
    _device                    = 0;
    _interruptHandlerInstalled = false;
    _packetByteCount           = 0;
    _resolution                = (100) << 16; // (100 dpi, 4 counts/mm)
    _touchPadModeByte          = kModeByteValueGesturesDisabled;
    
    OSSafeRelease(config);
	
    return true;
}
开发者ID:DarwinX,项目名称:OS-X-Voodoo-PS2-Controller,代码行数:39,代码来源:VoodooPS2SentelicFSP.cpp

示例14: setProperty

void ApplePS2Mouse::setParamPropertiesGated(OSDictionary * config)
{
	if (NULL == config)
		return;
    
    const struct {const char *name; int *var;} int32vars[]={
        {"DefaultResolution",               &defres},
        {"ResolutionMode",                  &resmode},
        {"ScrollResolution",                &scrollres},
        {"MouseYInverter",                  &mouseyinverter},
        {"ScrollYInverter",                 &scrollyinverter},
        {"WakeDelay",                       &wakedelay},
        {"MouseCount",                      &mousecount},
        {"ButtonCount",                     &_buttonCount},
    };
    const struct {const char *name; int *var;} boolvars[]={
        {"ForceDefaultResolution",          &forceres},
        {"ForceSetResolution",              &forcesetres},
        {"ActLikeTrackpad",                 &actliketrackpad},
        {"DisableLEDUpdating",              &noled},
        {"FakeMiddleButton",                &_fakemiddlebutton},
    };
    const struct {const char* name; bool* var;} lowbitvars[]={
        {"TrackpadScroll",                  &scroll},
        {"OutsidezoneNoAction When Typing", &outzone_wt},
        {"PalmNoAction Permanent",          &palm},
        {"PalmNoAction When Typing",        &palm_wt},
        {"USBMouseStopsTrackpad",           &usb_mouse_stops_trackpad},
    };
    const struct {const char* name; uint64_t* var; } int64vars[]={
        {"MiddleClickTime",                 &_maxmiddleclicktime},
    };
    
    
    OSNumber *num;
    OSBoolean *bl;
    
    int oldmousecount = mousecount;
    bool old_usb_mouse_stops_trackpad = usb_mouse_stops_trackpad;
    
    // 64-bit config items
    for (int i = 0; i < countof(int64vars); i++)
        if ((num=OSDynamicCast(OSNumber, config->getObject(int64vars[i].name))))
        {
            *int64vars[i].var = num->unsigned64BitValue();
            setProperty(int64vars[i].name, *int64vars[i].var, 64);
        }
    // boolean config items
    for (int i = 0; i < countof(boolvars); i++)
        if ((bl=OSDynamicCast (OSBoolean,config->getObject (boolvars[i].name))))
        {
            *boolvars[i].var = bl->isTrue();
            setProperty(boolvars[i].name, *boolvars[i].var ? kOSBooleanTrue : kOSBooleanFalse);
        }
    // lowbit config items
	for (int i = 0; i < countof(lowbitvars); i++)
		if ((num=OSDynamicCast (OSNumber,config->getObject(lowbitvars[i].name))))
        {
			*lowbitvars[i].var = (num->unsigned32BitValue()&0x1)?true:false;
            setProperty(lowbitvars[i].name, *lowbitvars[i].var ? 1 : 0, 32);
        }
    // 32-bit config items
    for (int i = 0; i < countof(int32vars);i++)
        if ((num=OSDynamicCast (OSNumber,config->getObject (int32vars[i].name))))
        {
            *int32vars[i].var = num->unsigned32BitValue();
            setProperty(int32vars[i].name, *int32vars[i].var, 32);
        }
    
    // check for special terminating sequence from PS2Daemon
    if (-1 == mousecount)
    {
        // when system is shutting down/restarting we want to force LED off
        if (ledpresent && !noled)
            setTouchpadLED(0x10);
        mousecount = oldmousecount;
    }
    
    // disable trackpad when USB mouse is plugged in
    // check for mouse count changing...
    if ((oldmousecount != 0) != (mousecount != 0) || old_usb_mouse_stops_trackpad != usb_mouse_stops_trackpad)
    {
        // either last mouse removed or first mouse added
        ignoreall = (mousecount != 0) && usb_mouse_stops_trackpad;
        updateTouchpadLED();
    }
    
    // convert to IOFixed format...
    defres <<= 16;
}
开发者ID:KrisLee,项目名称:OS-X-Voodoo-PS2-Controller,代码行数:90,代码来源:VoodooPS2Mouse.cpp

示例15: return

bool
net_lundman_zfs_zvol_device::attach(IOService* provider)
{
	OSDictionary *protocolCharacteristics = 0;
	OSDictionary *deviceCharacteristics = 0;
	OSDictionary *storageFeatures = 0;
	OSBoolean *unmapFeature = 0;
	OSString *dataString = 0;
	OSNumber *dataNumber = 0;

	if (super::attach(provider) == false)
		return (false);
	m_provider = OSDynamicCast(net_lundman_zfs_zvol, provider);
	if (m_provider == NULL)
		return (false);

	/*
	 * We want to set some additional properties for ZVOLs, in
	 * particular, "Virtual Device", and type "File"
	 * (or is Internal better?)
	 *
	 * Finally "Generic" type.
	 *
	 * These properties are defined in *protocol* characteristics
	 */

	protocolCharacteristics = OSDictionary::withCapacity(3);

	if (!protocolCharacteristics) {
		IOLog("failed to create dict for protocolCharacteristics.\n");
		return (true);
	}

	dataString = OSString::withCString(
	    kIOPropertyPhysicalInterconnectTypeVirtual);

	if (!dataString) {
		IOLog("could not create interconnect type string\n");
		return (true);
	}
	protocolCharacteristics->setObject(
	    kIOPropertyPhysicalInterconnectTypeKey, dataString);

	dataString->release();
	dataString = 0;

	dataString = OSString::withCString(kIOPropertyInterconnectFileKey);
	if (!dataString) {
		IOLog("could not create interconnect location string\n");
		return (true);
	}
	protocolCharacteristics->setObject(
	    kIOPropertyPhysicalInterconnectLocationKey, dataString);

	dataString->release();
	dataString = 0;

	setProperty(kIOPropertyProtocolCharacteristicsKey,
	    protocolCharacteristics);

	protocolCharacteristics->release();
	protocolCharacteristics = 0;

	/*
	 * We want to set some additional properties for ZVOLs, in
	 * particular, physical block size (volblocksize) of the
	 * underlying ZVOL, and 'logical' block size presented by
	 * the virtual disk. Also set physical bytes per sector.
	 *
	 * These properties are defined in *device* characteristics
	 */

	deviceCharacteristics = OSDictionary::withCapacity(3);

	if (!deviceCharacteristics) {
		IOLog("failed to create dict for deviceCharacteristics.\n");
		return (true);
	}

	/* Set logical block size to ZVOL_BSIZE (512b) */
	dataNumber =	OSNumber::withNumber(ZVOL_BSIZE,
	    8 * sizeof (ZVOL_BSIZE));

	deviceCharacteristics->setObject(kIOPropertyLogicalBlockSizeKey,
	    dataNumber);

	dprintf("logicalBlockSize %llu\n",
	    dataNumber->unsigned64BitValue());

	dataNumber->release();
	dataNumber	= 0;

	/* Set physical block size to match volblocksize property */
	dataNumber =	OSNumber::withNumber(zv->zv_volblocksize,
	    8 * sizeof (zv->zv_volblocksize));

	deviceCharacteristics->setObject(kIOPropertyPhysicalBlockSizeKey,
	    dataNumber);

	dprintf("physicalBlockSize %llu\n",
//.........这里部分代码省略.........
开发者ID:tokyovigilante,项目名称:zfs,代码行数:101,代码来源:zvolIO.cpp


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