Added missing methods in the header and a partial implementation in the source file.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3908 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2003-07-08 23:32:52 +00:00
parent 2942bfb5fb
commit e6fb8288f7
2 changed files with 307 additions and 9 deletions

View File

@ -7,20 +7,33 @@
#define _DISK_SYSTEM_H
#include <DiskDeviceDefs.h>
#include <String.h>
class BPartition;
struct user_disk_system_info;
class BDiskSystem {
public:
BDiskSystem();
~BDiskSystem();
status_t InitCheck() const;
const char *Name() const;
const char *PrettyName() const;
bool SupportsDefragmenting(BPartition *partition, bool *whileMounted) const;
bool SupportsRepairing(BPartition *partition, bool checkOnly, bool *whileMounted) const;
bool SupportsDefragmenting(BPartition *partition,
bool *whileMounted) const;
bool SupportsRepairing(BPartition *partition, bool checkOnly,
bool *whileMounted) const;
bool SupportsResizing(BPartition *partition, bool *whileMounted) const;
bool SupportsResizingChild(BPartition *child) const;
bool SupportsMoving(BPartition *partition, bool *whileMounted) const;
bool SupportsMovingChild(BPartition *child) const;
bool SupportsSettingName(BPartition *partition) const;
bool SupportsSettingContentName(BPartition *partition,
bool *whileMounted) const;
bool SupportsSettingType(BPartition *partition) const;
bool SupportsCreatingChild(BPartition *partition) const;
bool SupportsParentSystem(BPartition *child, const char *system) const;
// True in most cases. NULL == raw device.
@ -28,17 +41,37 @@ public:
// False for most file systems, true for most partitioning
// systems.
bool ValidateResize(BPartition *partition, off_t *size) const;
bool ValidateMove(BPartition *partition, off_t *start) const;
bool ValidateResizeChild(BPartition *partition, off_t *size) const;
bool ValidateMoveChild(BPartition *partition, off_t *start) const;
bool ValidateCreateChild(BPartition *partition, off_t *start, off_t *size,
const char *type, const char *parameters) const;
// TODO: We must be able to enumerate the types the system supports.
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 ValidateMoveChild(BPartition *partition, off_t *start) const;
status_t ValidateSetName(BPartition *partition, char *name) const;
status_t ValidateSetContentName(BPartition *partition, char *name) const;
status_t ValidateSetType(BPartition *partition, char *type) const;
status_t ValidateCreateChild(BPartition *partition, off_t *start,
off_t *size, const char *type,
const char *parameters) const;
status_t GetNextSupportedType(BPartition *partition, int32 *cookie,
char *type) const;
// Returns all types the disk system supports for children of the
// supplied partition.
status_t GetTypeForContentType(const char *contentType, char *type) const;
bool IsPartitioningSystem() const;
bool IsFileSystem() const;
bool IsSubSystemFor(BPartition *parent) const;
private:
status_t _SetTo(user_disk_system_info *info);
void _Unset();
friend class BDiskDeviceRoster;
disk_system_id fID;
BString fName;
BString fPrettyName;
bool fFileSystem;
};
#endif // _DISK_SYSTEM_H

View File

@ -4,3 +4,268 @@
//---------------------------------------------------------------------
#include <DiskSystem.h>
#include <ddm_userland_interface.h>
// constructor
BDiskSystem::BDiskSystem()
: fID(B_NO_INIT),
fName(),
fPrettyName(),
fFileSystem(false)
{
}
// destructor
BDiskSystem::~BDiskSystem()
{
}
// InitCheck
status_t
BDiskSystem::InitCheck() const
{
return (fID > 0 ? B_OK : fID);
}
// Name
const char *
BDiskSystem::Name() const
{
return fName.String();
}
// PrettyName
const char *
BDiskSystem::PrettyName() const
{
return fPrettyName.String();
}
// SupportsDefragmenting
bool
BDiskSystem::SupportsDefragmenting(BPartition *partition,
bool *whileMounted) const
{
// not implemented
return false;
}
// SupportsRepairing
bool
BDiskSystem::SupportsRepairing(BPartition *partition, bool checkOnly,
bool *whileMounted) const
{
// not implemented
return false;
}
// SupportsResizing
bool
BDiskSystem::SupportsResizing(BPartition *partition, bool *whileMounted) const
{
// not implemented
return false;
}
// SupportsResizingChild
bool
BDiskSystem::SupportsResizingChild(BPartition *child) const
{
// not implemented
return false;
}
// SupportsMoving
bool
BDiskSystem::SupportsMoving(BPartition *partition, bool *whileMounted) const
{
// not implemented
return false;
}
// SupportsMovingChild
bool
BDiskSystem::SupportsMovingChild(BPartition *child) const
{
// not implemented
return false;
}
// SupportsSettingName
bool
BDiskSystem::SupportsSettingName(BPartition *partition) const
{
// not implemented
return false;
}
// SupportsSettingContentName
bool
BDiskSystem::SupportsSettingContentName(BPartition *partition,
bool *whileMounted) const
{
// not implemented
return false;
}
// SupportsSettingType
bool
BDiskSystem::SupportsSettingType(BPartition *partition) const
{
// not implemented
return false;
}
// SupportsCreatingChild
bool
BDiskSystem::SupportsCreatingChild(BPartition *partition) const
{
// not implemented
return false;
}
// SupportsParentSystem
bool
BDiskSystem::SupportsParentSystem(BPartition *child, const char *system) const
{
// not implemented
return false;
}
// SupportsChildSystem
bool
BDiskSystem::SupportsChildSystem(BPartition *child, const char *system) const
{
// not implemented
return false;
}
// ValidateResize
status_t
BDiskSystem::ValidateResize(BPartition *partition, off_t *size) const
{
// not implemented
return B_ERROR;
}
// ValidateMove
status_t
BDiskSystem::ValidateMove(BPartition *partition, off_t *start) const
{
// not implemented
return B_ERROR;
}
// ValidateResizeChild
status_t
BDiskSystem::ValidateResizeChild(BPartition *partition, off_t *size) const
{
// not implemented
return B_ERROR;
}
// ValidateMoveChild
status_t
BDiskSystem::ValidateMoveChild(BPartition *partition, off_t *start) const
{
// not implemented
return B_ERROR;
}
// ValidateSetName
status_t
BDiskSystem::ValidateSetName(BPartition *partition, char *name) const
{
// not implemented
return B_ERROR;
}
// ValidateSetContentName
status_t
BDiskSystem::ValidateSetContentName(BPartition *partition, char *name) const
{
// not implemented
return B_ERROR;
}
// ValidateSetType
status_t
BDiskSystem::ValidateSetType(BPartition *partition, char *type) const
{
// not implemented
return B_ERROR;
}
// ValidateCreateChild
status_t
BDiskSystem::ValidateCreateChild(BPartition *partition, off_t *start,
off_t *size, const char *type,
const char *parameters) const
{
// not implemented
return B_ERROR;
}
// GetNextSupportedType
status_t
BDiskSystem::GetNextSupportedType(BPartition *partition, int32 *cookie,
char *type) const
{
// not implemented
return B_ERROR;
}
// GetTypeForContentType
status_t
BDiskSystem::GetTypeForContentType(const char *contentType, char *type) const
{
// not implemented
return B_ERROR;
}
// IsPartitioningSystem
bool
BDiskSystem::IsPartitioningSystem() const
{
return (InitCheck() == B_OK && !fFileSystem);
}
// IsFileSystem
bool
BDiskSystem::IsFileSystem() const
{
return (InitCheck() == B_OK && fFileSystem);
}
// IsSubSystemFor
bool
BDiskSystem::IsSubSystemFor(BPartition *parent) const
{
// not implemented
return false;
}
// _SetTo
status_t
BDiskSystem::_SetTo(user_disk_system_info *info)
{
_Unset();
if (!info)
return (fID = B_BAD_VALUE);
fID = info->id;
fName = info->name;
fPrettyName = info->pretty_name;
fFileSystem = info->file_system;
return B_OK;
}
// _Unset
void
BDiskSystem::_Unset()
{
fID = B_NO_INIT;
fName = (const char*)NULL;
fPrettyName = (const char*)NULL;
fFileSystem = false;
}