本文整理匯總了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",
//.........這裏部分代碼省略.........