Implemented the BDiskSystem::Supports*() methods. Added required private helper methods to BPartition.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3989 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -35,19 +35,26 @@ public:
|
|||||||
bool *whileMounted) const;
|
bool *whileMounted) const;
|
||||||
bool SupportsSettingType(BPartition *partition) const;
|
bool SupportsSettingType(BPartition *partition) const;
|
||||||
bool SupportsCreatingChild(BPartition *partition) const;
|
bool SupportsCreatingChild(BPartition *partition) const;
|
||||||
bool SupportsParentSystem(BPartition *child, const char *system) const;
|
bool SupportsDeletingChild(BPartition *child) const;
|
||||||
|
bool SupportsInitializing(BPartition *partition) const;
|
||||||
|
bool SupportsInitializingChild(BPartition *child,
|
||||||
|
const char *diskSystem) const;
|
||||||
|
|
||||||
|
bool SupportsParentSystem(BPartition *child) const;
|
||||||
|
bool SupportsParentSystem(const char *system) const;
|
||||||
// True in most cases. NULL == raw device.
|
// True in most cases. NULL == raw device.
|
||||||
bool SupportsChildSystem(BPartition *child, const char *system) const;
|
bool SupportsChildSystem(BPartition *child, const char *system) const;
|
||||||
|
bool SupportsChildSystem(const char *system) const;
|
||||||
// False for most file systems, true for most partitioning
|
// False for most file systems, true for most partitioning
|
||||||
// systems.
|
// systems.
|
||||||
|
|
||||||
status_t ValidateResize(BPartition *partition, off_t *size) const;
|
status_t ValidateResize(BPartition *partition, off_t *size) const;
|
||||||
status_t ValidateMove(BPartition *partition, off_t *start) const;
|
|
||||||
status_t ValidateResizeChild(BPartition *partition, off_t *size) const;
|
status_t ValidateResizeChild(BPartition *partition, off_t *size) const;
|
||||||
|
status_t ValidateMove(BPartition *partition, off_t *start) const;
|
||||||
status_t ValidateMoveChild(BPartition *partition, off_t *start) const;
|
status_t ValidateMoveChild(BPartition *partition, off_t *start) const;
|
||||||
status_t ValidateSetName(BPartition *partition, char *name) const;
|
status_t ValidateSetName(BPartition *partition, char *name) const;
|
||||||
status_t ValidateSetContentName(BPartition *partition, char *name) const;
|
status_t ValidateSetContentName(BPartition *partition, char *name) const;
|
||||||
status_t ValidateSetType(BPartition *partition, char *type) const;
|
status_t ValidateSetType(BPartition *partition, const char *type) const;
|
||||||
status_t ValidateCreateChild(BPartition *partition, off_t *start,
|
status_t ValidateCreateChild(BPartition *partition, off_t *start,
|
||||||
off_t *size, const char *type,
|
off_t *size, const char *type,
|
||||||
const char *parameters) const;
|
const char *parameters) const;
|
||||||
|
|||||||
@@ -134,6 +134,8 @@ private:
|
|||||||
void _Unset();
|
void _Unset();
|
||||||
|
|
||||||
bool _IsShadow() const;
|
bool _IsShadow() const;
|
||||||
|
partition_id _ShadowID() const;
|
||||||
|
disk_system_id _DiskSystem() const;
|
||||||
|
|
||||||
int32 _Level() const;
|
int32 _Level() const;
|
||||||
virtual bool _AcceptVisitor(BDiskDeviceVisitor *visitor, int32 level);
|
virtual bool _AcceptVisitor(BDiskDeviceVisitor *visitor, int32 level);
|
||||||
@@ -141,6 +143,7 @@ private:
|
|||||||
int32 level = -1);
|
int32 level = -1);
|
||||||
|
|
||||||
friend class BDiskDevice;
|
friend class BDiskDevice;
|
||||||
|
friend class BDiskSystem;
|
||||||
|
|
||||||
BDiskDevice *fDevice;
|
BDiskDevice *fDevice;
|
||||||
BPartition *fParent;
|
BPartition *fParent;
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
// by the OpenBeOS license.
|
// by the OpenBeOS license.
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
#include <DiskSystem.h>
|
|
||||||
#include <ddm_userland_interface.h>
|
#include <ddm_userland_interface.h>
|
||||||
|
#include <DiskSystem.h>
|
||||||
|
#include <Partition.h>
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
BDiskSystem::BDiskSystem()
|
BDiskSystem::BDiskSystem()
|
||||||
@@ -46,8 +47,11 @@ bool
|
|||||||
BDiskSystem::SupportsDefragmenting(BPartition *partition,
|
BDiskSystem::SupportsDefragmenting(BPartition *partition,
|
||||||
bool *whileMounted) const
|
bool *whileMounted) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK && IsFileSystem()
|
||||||
return false;
|
&& partition && partition->_IsShadow()
|
||||||
|
&& partition->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_defragmenting_partition(fID,
|
||||||
|
partition->_ShadowID(), whileMounted));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsRepairing
|
// SupportsRepairing
|
||||||
@@ -55,48 +59,65 @@ bool
|
|||||||
BDiskSystem::SupportsRepairing(BPartition *partition, bool checkOnly,
|
BDiskSystem::SupportsRepairing(BPartition *partition, bool checkOnly,
|
||||||
bool *whileMounted) const
|
bool *whileMounted) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK
|
||||||
return false;
|
&& partition && partition->_IsShadow()
|
||||||
|
&& partition->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_repairing_partition(fID, partition->_ShadowID(),
|
||||||
|
checkOnly, whileMounted));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsResizing
|
// SupportsResizing
|
||||||
bool
|
bool
|
||||||
BDiskSystem::SupportsResizing(BPartition *partition, bool *whileMounted) const
|
BDiskSystem::SupportsResizing(BPartition *partition, bool *whileMounted) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK
|
||||||
return false;
|
&& partition && partition->_IsShadow()
|
||||||
|
&& partition->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_resizing_partition(fID, partition->_ShadowID(),
|
||||||
|
whileMounted));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsResizingChild
|
// SupportsResizingChild
|
||||||
bool
|
bool
|
||||||
BDiskSystem::SupportsResizingChild(BPartition *child) const
|
BDiskSystem::SupportsResizingChild(BPartition *child) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK && IsPartitioningSystem()
|
||||||
return false;
|
&& child && child->_IsShadow() && child->Parent()
|
||||||
|
&& child->Parent()->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_resizing_child_partition(fID,
|
||||||
|
child->_ShadowID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsMoving
|
// SupportsMoving
|
||||||
bool
|
bool
|
||||||
BDiskSystem::SupportsMoving(BPartition *partition, bool *whileMounted) const
|
BDiskSystem::SupportsMoving(BPartition *partition, bool *whileMounted) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK
|
||||||
return false;
|
&& partition && partition->_IsShadow()
|
||||||
|
&& partition->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_moving_partition(fID, partition->_ShadowID(),
|
||||||
|
whileMounted));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsMovingChild
|
// SupportsMovingChild
|
||||||
bool
|
bool
|
||||||
BDiskSystem::SupportsMovingChild(BPartition *child) const
|
BDiskSystem::SupportsMovingChild(BPartition *child) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK && IsPartitioningSystem()
|
||||||
return false;
|
&& child && child->_IsShadow() && child->Parent()
|
||||||
|
&& child->Parent()->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_moving_child_partition(fID, child->_ShadowID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsSettingName
|
// SupportsSettingName
|
||||||
bool
|
bool
|
||||||
BDiskSystem::SupportsSettingName(BPartition *partition) const
|
BDiskSystem::SupportsSettingName(BPartition *partition) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK && IsPartitioningSystem()
|
||||||
return false;
|
&& partition && partition->_IsShadow() && partition->Parent()
|
||||||
|
&& partition->Parent()->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_setting_partition_name(fID,
|
||||||
|
partition->_ShadowID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsSettingContentName
|
// SupportsSettingContentName
|
||||||
@@ -104,40 +125,66 @@ bool
|
|||||||
BDiskSystem::SupportsSettingContentName(BPartition *partition,
|
BDiskSystem::SupportsSettingContentName(BPartition *partition,
|
||||||
bool *whileMounted) const
|
bool *whileMounted) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK
|
||||||
return false;
|
&& partition && partition->_IsShadow()
|
||||||
|
&& partition->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_setting_partition_content_name(fID,
|
||||||
|
partition->_ShadowID(), whileMounted));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsSettingType
|
// SupportsSettingType
|
||||||
bool
|
bool
|
||||||
BDiskSystem::SupportsSettingType(BPartition *partition) const
|
BDiskSystem::SupportsSettingType(BPartition *partition) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK && IsPartitioningSystem()
|
||||||
return false;
|
&& partition && partition->_IsShadow() && partition->Parent()
|
||||||
|
&& partition->Parent()->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_setting_partition_type(fID,
|
||||||
|
partition->_ShadowID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsCreatingChild
|
// SupportsCreatingChild
|
||||||
bool
|
bool
|
||||||
BDiskSystem::SupportsCreatingChild(BPartition *partition) const
|
BDiskSystem::SupportsCreatingChild(BPartition *partition) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK && IsPartitioningSystem()
|
||||||
return false;
|
&& partition && partition->_IsShadow()
|
||||||
|
&& partition->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_creating_child_partition(fID,
|
||||||
|
partition->_ShadowID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsParentSystem
|
// SupportsDeletingChild
|
||||||
bool
|
bool
|
||||||
BDiskSystem::SupportsParentSystem(BPartition *child, const char *system) const
|
BDiskSystem::SupportsDeletingChild(BPartition *child) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK && IsPartitioningSystem()
|
||||||
return false;
|
&& child && child->_IsShadow() && child->Parent()
|
||||||
|
&& child->Parent()->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_deleting_child_partition(fID,
|
||||||
|
child->_ShadowID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsChildSystem
|
// SupportsInitializing
|
||||||
bool
|
bool
|
||||||
BDiskSystem::SupportsChildSystem(BPartition *child, const char *system) const
|
BDiskSystem::SupportsInitializing(BPartition *partition) const
|
||||||
{
|
{
|
||||||
// not implemented
|
return (InitCheck() == B_OK
|
||||||
return false;
|
&& partition && partition->_IsShadow()
|
||||||
|
&& _kern_supports_initializing_partition(fID,
|
||||||
|
partition->_ShadowID()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// SupportsInitializingChild
|
||||||
|
bool
|
||||||
|
BDiskSystem::SupportsInitializingChild(BPartition *child,
|
||||||
|
const char *diskSystem) const
|
||||||
|
{
|
||||||
|
return (InitCheck() == B_OK && IsPartitioningSystem() && diskSystem
|
||||||
|
&& child && child->_IsShadow() && child->Parent()
|
||||||
|
&& child->Parent()->_DiskSystem() == fID
|
||||||
|
&& _kern_supports_initializing_child_partition(fID,
|
||||||
|
child->_ShadowID(), diskSystem));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateResize
|
// ValidateResize
|
||||||
@@ -148,17 +195,17 @@ BDiskSystem::ValidateResize(BPartition *partition, off_t *size) const
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateMove
|
// ValidateResizeChild
|
||||||
status_t
|
status_t
|
||||||
BDiskSystem::ValidateMove(BPartition *partition, off_t *start) const
|
BDiskSystem::ValidateResizeChild(BPartition *partition, off_t *size) const
|
||||||
{
|
{
|
||||||
// not implemented
|
// not implemented
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateResizeChild
|
// ValidateMove
|
||||||
status_t
|
status_t
|
||||||
BDiskSystem::ValidateResizeChild(BPartition *partition, off_t *size) const
|
BDiskSystem::ValidateMove(BPartition *partition, off_t *start) const
|
||||||
{
|
{
|
||||||
// not implemented
|
// not implemented
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -190,7 +237,7 @@ BDiskSystem::ValidateSetContentName(BPartition *partition, char *name) const
|
|||||||
|
|
||||||
// ValidateSetType
|
// ValidateSetType
|
||||||
status_t
|
status_t
|
||||||
BDiskSystem::ValidateSetType(BPartition *partition, char *type) const
|
BDiskSystem::ValidateSetType(BPartition *partition, const char *type) const
|
||||||
{
|
{
|
||||||
// not implemented
|
// not implemented
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|||||||
@@ -451,6 +451,20 @@ BPartition::_IsShadow() const
|
|||||||
return (fPartitionData && fPartitionData->shadow_id >= 0);
|
return (fPartitionData && fPartitionData->shadow_id >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _ShadowID
|
||||||
|
partition_id
|
||||||
|
BPartition::_ShadowID() const
|
||||||
|
{
|
||||||
|
return (fPartitionData ? fPartitionData->shadow_id : -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// _DiskSystem
|
||||||
|
disk_system_id
|
||||||
|
BPartition::_DiskSystem() const
|
||||||
|
{
|
||||||
|
return (fPartitionData ? fPartitionData->disk_system : -1);
|
||||||
|
}
|
||||||
|
|
||||||
// _Level
|
// _Level
|
||||||
int32
|
int32
|
||||||
BPartition::_Level() const
|
BPartition::_Level() const
|
||||||
|
|||||||
Reference in New Issue
Block a user