本文整理汇总了C++中KPartition::IsMounted方法的典型用法代码示例。如果您正苦于以下问题:C++ KPartition::IsMounted方法的具体用法?C++ KPartition::IsMounted怎么用?C++ KPartition::IsMounted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPartition
的用法示例。
在下文中一共展示了KPartition::IsMounted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: locker
status_t
_user_uninitialize_partition(partition_id partitionID, int32* _changeCounter,
partition_id parentID, int32* _parentChangeCounter)
{
// copy parameters in
int32 changeCounter;
int32 parentChangeCounter;
bool haveParent = parentID >= 0;
status_t error = copy_from_user_value(changeCounter, _changeCounter);
if (haveParent && error == B_OK)
error = copy_from_user_value(parentChangeCounter, _parentChangeCounter);
if (error != B_OK)
return error;
// get the partition
KDiskDeviceManager* manager = KDiskDeviceManager::Default();
KPartition* partition = manager->WriteLockPartition(partitionID);
if (partition == NULL)
return B_ENTRY_NOT_FOUND;
PartitionRegistrar registrar1(partition, true);
PartitionRegistrar registrar2(partition->Device(), true);
DeviceWriteLocker locker(partition->Device(), true);
// register parent
KPartition* parent = NULL;
if (haveParent)
parent = manager->RegisterPartition(parentID);
PartitionRegistrar registrar3(parent, true);
// check change counter
if (changeCounter != partition->ChangeCounter())
return B_BAD_VALUE;
if (haveParent && parentChangeCounter != parent->ChangeCounter())
return B_BAD_VALUE;
// the partition must be initialized
if (partition->DiskSystem() == NULL)
return B_BAD_VALUE;
// check busy
if (!partition->CheckAndMarkBusy(true))
return B_BUSY;
if (partition->IsMounted() || partition->IsChildMounted())
return B_BAD_VALUE;
KDiskSystem* diskSystem = partition->DiskSystem();
locker.Unlock();
// Let the disk system uninitialize the partition. This operation is not
// mandatory. If implemented, it will destroy the on-disk structures, so
// that the disk system cannot accidentally identify the partition later on.
if (diskSystem != NULL)
diskSystem->Uninitialize(partition, DUMMY_JOB_ID);
// re-lock and uninitialize the partition object
locker.Lock();
error = partition->UninitializeContents(true);
partition->UnmarkBusy(true);
if (error != B_OK)
return error;
// return change counter
error = copy_to_user_value(_changeCounter, partition->ChangeCounter());
if (haveParent && error == B_OK)
error = copy_to_user_value(_parentChangeCounter, parent->ChangeCounter());
return error;
}