本文整理汇总了C++中OSBoolean::release方法的典型用法代码示例。如果您正苦于以下问题:C++ OSBoolean::release方法的具体用法?C++ OSBoolean::release怎么用?C++ OSBoolean::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSBoolean
的用法示例。
在下文中一共展示了OSBoolean::release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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",
//.........这里部分代码省略.........