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


C++ KPartition::IsMounted方法代码示例

本文整理汇总了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;
}
开发者ID:looncraz,项目名称:haiku,代码行数:74,代码来源:ddm_userland_interface.cpp


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