diff --git a/headers/private/storage/DiskSystem.h b/headers/private/storage/DiskSystem.h index 1c50363da2..605dba3847 100644 --- a/headers/private/storage/DiskSystem.h +++ b/headers/private/storage/DiskSystem.h @@ -40,14 +40,6 @@ public: 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. - bool SupportsChildSystem(BPartition *child, const char *system) const; - bool SupportsChildSystem(const char *system) const; - // False for most file systems, true for most partitioning - // systems. - status_t ValidateResize(BPartition *partition, off_t *size) const; status_t ValidateResizeChild(BPartition *child, off_t *size) const; status_t ValidateMove(BPartition *partition, off_t *start) const; @@ -58,6 +50,8 @@ public: status_t ValidateCreateChild(BPartition *partition, off_t *start, off_t *size, const char *type, const char *parameters) const; + status_t ValidateInitialize(BPartition *partition, char *name, + const char *parameters) const; status_t GetNextSupportedType(BPartition *partition, int32 *cookie, char *type) const; @@ -70,10 +64,12 @@ public: bool IsSubSystemFor(BPartition *parent) const; private: + status_t _SetTo(disk_system_id id); status_t _SetTo(user_disk_system_info *info); void _Unset(); friend class BDiskDeviceRoster; + friend class BPartition; disk_system_id fID; BString fName; diff --git a/src/kits/storage/DiskSystem.cpp b/src/kits/storage/DiskSystem.cpp index bdb5bd390b..3824362775 100644 --- a/src/kits/storage/DiskSystem.cpp +++ b/src/kits/storage/DiskSystem.cpp @@ -301,6 +301,20 @@ BDiskSystem::ValidateCreateChild(BPartition *partition, off_t *start, start, size, type, parameters); } +// ValidateInitialize +status_t +BDiskSystem::ValidateInitialize(BPartition *partition, char *name, + const char *parameters) const +{ + if (InitCheck() != B_OK) + return InitCheck(); +// parameters may be NULL + if (!name || !partition || !partition->_IsShadow()) + return B_BAD_VALUE; + return _kern_validate_initialize_partition(fID, partition->_ShadowID(), + name, parameters); +} + // GetNextSupportedType status_t BDiskSystem::GetNextSupportedType(BPartition *partition, int32 *cookie, @@ -351,6 +365,20 @@ BDiskSystem::IsSubSystemFor(BPartition *parent) const && _kern_is_sub_disk_system_for(fID, parent->_ShadowID())); } +// _SetTo +status_t +BDiskSystem::_SetTo(disk_system_id id) +{ + _Unset(); + if (id < 0) + return fID; + user_disk_system_info info; + status_t error = _kern_get_disk_system_info(id, &info); + if (error != B_OK) + return (fID = error); + return _SetTo(&info); +} + // _SetTo status_t BDiskSystem::_SetTo(user_disk_system_info *info)