本文整理汇总了C++中OSNumber::unsigned64BitValue方法的典型用法代码示例。如果您正苦于以下问题:C++ OSNumber::unsigned64BitValue方法的具体用法?C++ OSNumber::unsigned64BitValue怎么用?C++ OSNumber::unsigned64BitValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSNumber
的用法示例。
在下文中一共展示了OSNumber::unsigned64BitValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OSDynamicCast
IOReturn net_habitue_device_SC101::reportMaxValidBlock(UInt64 *maxBlock)
{
OSNumber *size = OSDynamicCast(OSNumber, getProperty(gSC101DeviceSizeKey));
*maxBlock = (size ? size->unsigned64BitValue() / SECTOR_SIZE - 1 : 0);
return kIOReturnSuccess;
}
示例2: addMember
bool AppleLVMGroup::addMember(AppleRAIDMember * member)
{
if (super::addMember(member) == false) return false;
OSNumber * number = OSDynamicCast(OSNumber, member->getHeaderProperty(kAppleRAIDChunkCountKey));
if (!number) return false;
UInt64 memberBlockCount = number->unsigned64BitValue();
UInt32 memberIndex = member->getMemberIndex();
arMemberBlockCounts[memberIndex] = memberBlockCount;
// total up the block count as we go
arSetBlockCount += memberBlockCount;
arSetMediaSize = arSetBlockCount * arSetBlockSize;
// read the TOC on this member
IOBufferMemoryDescriptor * newPrimaryBuffer = readPrimaryMetaData(member);
if (newPrimaryBuffer && arPrimaryBuffer != newPrimaryBuffer) {
if (arPrimaryBuffer) arPrimaryBuffer->release();
arPrimaryBuffer = newPrimaryBuffer;
}
// scan the logical volumes in start
return true;
}
示例3: init
bool IOFireWireNub::init( OSDictionary * propTable )
{
bool success = true;
OSNumber *offset;
if( !IOService::init(propTable) )
{
success = false;
}
if( success )
{
fAuxiliary = createAuxiliary();
if( fAuxiliary == NULL )
success = false;
}
if( success )
{
offset = OSDynamicCast(OSNumber, propTable->getObject("GUID"));
if( offset )
fUniqueID = offset->unsigned64BitValue();
fConfigDirectorySet = OSSet::withCapacity(1);
if( fConfigDirectorySet == NULL )
success = false;
}
return success;
}
示例4: initWithHeader
bool AppleLVMVolume::initWithHeader(OSDictionary * props)
{
IOLog1("AppleLVMVolume::initWithHeader() entered\n");
if (lvProps) lvProps->release();
lvProps = props;
lvProps->retain();
if (!getVolumeUUID()) return false;
if (!getGroupUUID()) return false;
OSNumber * number;
number = OSDynamicCast(OSNumber, lvProps->getObject(kAppleLVMVolumeSequenceKey));
if (!number) return false;
lvSequenceNumber = number->unsigned32BitValue();
number = OSDynamicCast(OSNumber, lvProps->getObject(kAppleLVMVolumeExtentCountKey));
if (!number) return false;
lvExtentCount = number->unsigned64BitValue();
number = OSDynamicCast(OSNumber, lvProps->getObject(kAppleLVMVolumeSizeKey));
if (!number) return false;
lvClaimedSize = number->unsigned64BitValue();
OSString * type = OSDynamicCast(OSString, lvProps->getObject(kAppleLVMVolumeTypeKey));
if (!type) return false;
if (type->isEqualTo(kAppleLVMVolumeTypeConcat)) lvTypeID = kLVMTypeConcat;
if (type->isEqualTo(kAppleLVMVolumeTypeBitMap)) lvTypeID = kLVMTypeBitMap;
if (type->isEqualTo(kAppleLVMVolumeTypeSnapRO)) lvTypeID = kLVMTypeSnapRO;
if (type->isEqualTo(kAppleLVMVolumeTypeSnapRW)) lvTypeID = kLVMTypeSnapRW;
if (type->isEqualTo(kAppleLVMVolumeTypeMaster)) lvTypeID = kLVMTypeMaster;
if (!lvTypeID) return false;
lvSnapShot = NULL; // just clear these, they might not exist yet.
lvBitMap = NULL;
lvParent = NULL;
IOLog1("AppleLVMVolume::initWithHeader() successful for %s, size = %llu extent count = %llu\n",
getVolumeUUIDString(), lvClaimedSize, lvExtentCount);
return true;
}
示例5: init
bool VNodeDiskDeviceClass::init(OSDictionary *dict)
{
m_filePath = NULL;
m_vnode = NULL;
OSNumber * blockSizeObject = NULL;
OSNumber * blockNumObject = NULL;
if (super::init(dict) && dict != NULL) {
IOLog("Initializing device\n");
m_additionalInformation = (char *) "";
m_productString = (char *) (PROJECT "_" COMPONENT);
m_revisionString = (char *) VERSION;
m_vendorString = (char *) DEVELOPER;
m_filePath = OSDynamicCast(OSString, dict->getObject("VNode File Path"));
if (!m_filePath) {
IOLog("Missing file path parameter in VNode Disk\n");
return false;
}
m_filePath->retain();
blockSizeObject = OSDynamicCast(OSNumber, dict->getObject("Block Size"));
if (!blockSizeObject) {
IOLog("Missing block size parameter\n");
return false;
}
m_blockSize = blockSizeObject->unsigned64BitValue();
blockNumObject = OSDynamicCast(OSNumber, dict->getObject("Block num"));
if (!blockNumObject) {
IOLog("Missing block num parameter\n");
return false;
}
m_blockNum = blockNumObject->unsigned64BitValue();
return true;
} else {
IOLog("Unsucessfuly initialised VNode Disk Device\n");
return false;
}
}
示例6: addMember
bool AppleRAIDMirrorSet::addMember(AppleRAIDMember * member)
{
if (arExpectingLiveAdd) {
// for mirrors the set is not paused for adding while adding new
// members, mark it as a spare here to avoid having it marked broken
member->changeMemberState(kAppleRAIDMemberStateSpare, true);
}
if (super::addMember(member) == false) return false;
// set block count = member block count
OSNumber * number = OSDynamicCast(OSNumber, member->getHeaderProperty(kAppleRAIDChunkCountKey));
if (!number) return false;
arSetBlockCount = number->unsigned64BitValue();
arSetMediaSize = arSetBlockCount * arSetBlockSize;
if (arOpenLevel == kIOStorageAccessNone) startSetCompleteTimer();
return true;
}
示例7: OSDynamicCast
IOReturn
IOATABlockStorageDriver::reportMaxWriteTransfer ( UInt64 blocksize, UInt64 * max )
{
OSNumber * size;
STATUS_LOG ( ( "IOATABlockStorageDriver::reportMaxWriteTransfer called.\n" ) );
*max = blocksize * kIOATAMaximumBlockCount8Bit;
size = OSDynamicCast ( OSNumber, getProperty ( kIOMaximumBlockCountWriteKey ) );
if ( size != NULL )
{
*max = size->unsigned64BitValue ( ) * blocksize;
}
return kIOReturnSuccess;
}
示例8: 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;
}
示例9: start
bool ACPIProbe::start(IOService * provider)
{
ACPISensorsDebugLog("starting...");
if (!super::start(provider))
return false;
if (!(acpiDevice = OSDynamicCast(IOACPIPlatformDevice, provider))) {
ACPISensorsFatalLog("ACPI device not ready");
return false;
}
methods = OSArray::withCapacity(0);
OSNumber *interval = NULL;
OSNumber *timeout = NULL;
OSBoolean *logging = NULL;
OSArray *list = NULL;
// Try to load configuration from info.plist first
if (OSDictionary *configuration = getConfigurationNode())
{
OSBoolean* disable = OSDynamicCast(OSBoolean, configuration->getObject("DisableDevice"));
if (disable && disable->isTrue())
return false;
interval = OSDynamicCast(OSNumber, configuration->getObject("PollingInterval"));
timeout = OSDynamicCast(OSNumber, configuration->getObject("PollingTimeout"));
logging = OSDynamicCast(OSBoolean, configuration->getObject("LoggingEnabled"));
list = OSDynamicCast(OSArray, configuration->getObject("Methods"));
}
// Try to load configuration provided by ACPI device
else {
OSObject *object = NULL;
if (kIOReturnSuccess == acpiDevice->evaluateObject("INVL", &object) && object)
interval = OSDynamicCast(OSNumber, object);
if (kIOReturnSuccess == acpiDevice->evaluateObject("TOUT", &object) && object)
timeout = OSDynamicCast(OSNumber, object);
if (kIOReturnSuccess == acpiDevice->evaluateObject("LOGG", &object) && object) {
if (OSNumber *number = OSDynamicCast(OSNumber, object)) {
logging = OSBoolean::withBoolean(number->unsigned8BitValue() == 1);
}
}
if (kIOReturnSuccess == acpiDevice->evaluateObject("LIST", &object) && object)
list = OSDynamicCast(OSArray, object);
else
ACPISensorsErrorLog("polling methods table (LIST) not found");
}
if (interval) {
pollingInterval = (double)interval->unsigned64BitValue() / (double)1000.0;
ACPISensorsInfoLog("polling interval %lld ms", interval->unsigned64BitValue());
if (pollingInterval) {
if (timeout) {
pollingTimeout = (double)timeout->unsigned64BitValue() / 1000.0;
ACPISensorsInfoLog("polling timeout %lld ms", timeout->unsigned64BitValue());
}
if (logging) {
loggingEnabled = logging->isTrue();
ACPISensorsInfoLog("logging %s", loggingEnabled ? "enabled" : "disabled");
}
if (list) {
for (unsigned int i = 0; i < list->getCount(); i++) {
if (OSString *method = OSDynamicCast(OSString, list->getObject(i))) {
if (method->getLength() && kIOReturnSuccess == acpiDevice->validateObject(method->getCStringNoCopy())) {
methods->setObject(method);
ACPISensorsInfoLog("method \"%s\" registered", method->getCStringNoCopy());
}
else ACPISensorsErrorLog("unable to register method \"%s\"", method->getCStringNoCopy());
}
}
}
}
else ACPISensorsWarningLog("polling interval is set to zero, driver will be disabled");
}
//REVIEW_REHABMAN: just bail if no methods to call... no need to stick around...
if (!methods->getCount())
return false;
if (methods->getCount()) {
// woorkloop
if (!(workloop = getWorkLoop())) {
HWSensorsFatalLog("Failed to obtain workloop");
return false;
}
if (!(timerEventSource = IOTimerEventSource::timerEventSource( this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &ACPIProbe::woorkloopTimerEvent)))) {
ACPISensorsFatalLog("failed to initialize timer event source");
return false;
}
//.........这里部分代码省略.........
示例10: KINFO
bool net_habitue_device_SC101::init(OSDictionary *properties)
{
KINFO("init");
gSC101DeviceIDKey = OSSymbol::withCString(kSC101DeviceIDKey);
gSC101DeviceIOMaxReadSizeKey = OSSymbol::withCString(kSC101DeviceIOMaxReadSizeKey);
gSC101DeviceIOMaxWriteSizeKey = OSSymbol::withCString(kSC101DeviceIOMaxWriteSizeKey);
gSC101DevicePartitionAddressKey = OSSymbol::withCString(kSC101DevicePartitionAddressKey);
gSC101DeviceRootAddressKey = OSSymbol::withCString(kSC101DeviceRootAddressKey);
gSC101DevicePartNumberKey = OSSymbol::withCString(kSC101DevicePartNumberKey);
gSC101DeviceVersionKey = OSSymbol::withCString(kSC101DeviceVersionKey);
gSC101DeviceLabelKey = OSSymbol::withCString(kSC101DeviceLabelKey);
gSC101DeviceSizeKey = OSSymbol::withCString(kSC101DeviceSizeKey);
OSString *id = OSDynamicCast(OSString, properties->getObject(gSC101DeviceIDKey));
if (!id)
return false;
if (!super::init(properties))
return false;
OSNumber *ioMaxReadSize = OSDynamicCast(OSNumber, properties->getObject(gSC101DeviceIOMaxReadSizeKey));
if (!ioMaxReadSize ||
ioMaxReadSize->unsigned64BitValue() < SECTOR_SIZE ||
ioMaxReadSize->unsigned64BitValue() > MAX_IO_READ_SIZE ||
ioMaxReadSize->unsigned64BitValue() & (ioMaxReadSize->unsigned64BitValue() - 1))
{
ioMaxReadSize = OSNumber::withNumber(DEFAULT_IO_READ_SIZE, 64);
if (ioMaxReadSize)
{
setProperty(gSC101DeviceIOMaxReadSizeKey, ioMaxReadSize);
ioMaxReadSize->release();
}
}
OSNumber *ioMaxWriteSize = OSDynamicCast(OSNumber, properties->getObject(gSC101DeviceIOMaxWriteSizeKey));
if (!ioMaxWriteSize ||
ioMaxWriteSize->unsigned64BitValue() < SECTOR_SIZE ||
ioMaxWriteSize->unsigned64BitValue() > MAX_IO_WRITE_SIZE ||
ioMaxWriteSize->unsigned64BitValue() & (ioMaxWriteSize->unsigned64BitValue() - 1))
{
ioMaxWriteSize = OSNumber::withNumber(DEFAULT_IO_WRITE_SIZE, 64);
if (ioMaxWriteSize)
{
setProperty(gSC101DeviceIOMaxWriteSizeKey, ioMaxWriteSize);
ioMaxWriteSize->release();
}
}
nanoseconds_to_absolutetime(1000000000ULL * 60, &_resolveInterval);
_mediaStateAttached = false;
_mediaStateChanged = true;
STAILQ_INIT(&_pendingHead);
_pendingCount = 0;
STAILQ_INIT(&_outstandingHead);
_outstandingCount = 0;
return true;
}
示例11: copyProperty
bool
ZFSDatasetProxy::start(IOService *provider)
{
OSObject *property = NULL, *size = NULL;
OSString *nameString = NULL;
OSNumber *sizeNum = NULL;
OSDictionary *deviceDict = NULL, *protocolDict = NULL;
const OSSymbol *virtualSymbol = NULL, *internalSymbol = NULL;
const char *cstr = NULL;
char *pstring = NULL;
int plen = 0;
bool started = false;
size = copyProperty(kZFSPoolSizeKey, gIOServicePlane,
(kIORegistryIterateRecursively|kIORegistryIterateParents));
property = copyProperty(kZFSPoolNameKey, gIOServicePlane,
(kIORegistryIterateRecursively|kIORegistryIterateParents));
if (!size || !property) {
dprintf("couldn't get pool name or size");
goto error;
}
nameString = OSDynamicCast(OSString, property);
if (!nameString) {
dprintf("missing pool name");
goto error;
}
#if 0
/* Try hard to get the name string */
do {
nameString = OSDynamicCast(OSString, property);
if (nameString) nameString->retain();
if (!nameString) {
OSSymbol *nameSymbol;
nameSymbol = OSDynamicCast(OSSymbol, property);
if (!nameSymbol) {
dprintf("couldn't get name");
goto error;
}
nameString = OSString::withCString(
nameSymbol->getCStringNoCopy());
}
} while (0);
#endif
sizeNum = OSDynamicCast(OSNumber, size);
if (!sizeNum) {
dprintf("invalid size");
goto error;
}
_pool_bcount = sizeNum->unsigned64BitValue() / DEV_BSIZE;
sizeNum = 0;
size->release();
size = 0;
cstr = nameString->getCStringNoCopy();
if (!cstr || (plen = strlen(cstr) + 1) == 1) {
goto error;
}
pstring = (char *)IOMalloc(plen);
if (!pstring) {
goto error;
}
snprintf(pstring, plen, "%s", cstr);
productString = pstring;
pstring = 0;
if (IOBlockStorageDevice::start(provider) == false) {
dprintf("BlockStorageDevice start failed");
goto error;
}
started = true;
deviceDict = OSDynamicCast(OSDictionary,
getProperty(kIOPropertyDeviceCharacteristicsKey));
if (deviceDict) {
/* Clone a new dictionary */
deviceDict = OSDictionary::withDictionary(deviceDict);
if (!deviceDict) {
dprintf("dict clone failed");
goto error;
}
}
if (!deviceDict) {
dprintf("creating new device dict");
deviceDict = OSDictionary::withCapacity(1);
}
if (!deviceDict) {
dprintf("missing device dict");
goto error;
}
deviceDict->setObject(kIOPropertyProductNameKey, nameString);
OSSafeReleaseNULL(nameString);
//.........这里部分代码省略.........
示例12: setParamProperties
IOReturn IOHIKeyboard::setParamProperties( OSDictionary * dict )
{
OSData * data = NULL;
OSNumber * number = NULL;
IOReturn err = kIOReturnSuccess;
IOReturn err2 = kIOReturnSuccess;
unsigned char * map = NULL;
IOHIKeyboardMapper * oldMap = NULL;
bool updated = false;
UInt64 nano;
if( dict->getObject(kIOHIDResetKeyboardKey))
resetKeyboard();
IOLockLock( _deviceLock);
if ((number = OSDynamicCast(OSNumber,
dict->getObject(kIOHIDKeyRepeatKey))) ||
(data = OSDynamicCast(OSData,
dict->getObject(kIOHIDKeyRepeatKey))))
{
nano = (number) ? number->unsigned64BitValue() : *((UInt64 *) (data->getBytesNoCopy()));
if( nano < EV_MINKEYREPEAT)
nano = EV_MINKEYREPEAT;
nanoseconds_to_absolutetime(nano, &_keyRepeat);
updated = true;
}
if ((number = OSDynamicCast(OSNumber,
dict->getObject(kIOHIDInitialKeyRepeatKey))) ||
(data = OSDynamicCast(OSData,
dict->getObject(kIOHIDInitialKeyRepeatKey))))
{
nano = (number) ? number->unsigned64BitValue() : *((UInt64 *) (data->getBytesNoCopy()));
if( nano < EV_MINKEYREPEAT)
nano = EV_MINKEYREPEAT;
nanoseconds_to_absolutetime(nano, &_initialKeyRepeat);
updated = true;
}
if( (data = OSDynamicCast( OSData, dict->getObject(kIOHIDKeyMappingKey))))
{
map = (unsigned char *)IOMalloc( data->getLength() );
bcopy( data->getBytesNoCopy(), map, data->getLength() );
oldMap = _keyMap;
_keyMap = IOHIKeyboardMapper::keyboardMapper(this, map, data->getLength(), true);
if (_keyMap)
{
// point the new keymap to the IOHIDSystem, so it can set properties in it
_keyMap->setKeyboardTarget((IOService *) _keyboardEventTarget);
if (oldMap)
oldMap->release();
updated = true;
}
else
{
_keyMap = oldMap;
err = kIOReturnBadArgument;
}
}
if (NULL != (number = OSDynamicCast(OSNumber, dict->getObject(kIOHIDSubinterfaceIDKey))))
{
_deviceType = number->unsigned32BitValue();
updated = true;
}
// give the keymap a chance to update to new properties
if (_keyMap)
err2 = _keyMap->setParamProperties(dict);
IOLockUnlock( _deviceLock);
if( updated )
updateProperties();
// we can only return one error
if (err == kIOReturnSuccess)
err = err2;
return( err == kIOReturnSuccess ) ? super::setParamProperties(dict) : err;
}
示例13: OSDynamicCast
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",
//.........这里部分代码省略.........