Added an Init() amd dealt with the PrettyName().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3478 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2003-06-11 22:00:59 +00:00
parent 450c7dd609
commit 13a452eaee
4 changed files with 41 additions and 4 deletions

View File

@ -16,12 +16,12 @@ public:
KDiskSystem(const char *name); KDiskSystem(const char *name);
virtual ~KDiskSystem(); virtual ~KDiskSystem();
virtual status_t Init();
void SetID(disk_system_id id); void SetID(disk_system_id id);
disk_system_id ID() const; disk_system_id ID() const;
const char *Name() const; const char *Name() const;
virtual const char *PrettyName(); virtual const char *PrettyName();
// TODO: Add an Init(), make PrettyName() non-virtual and add a
// protected setter.
virtual bool IsFileSystem() const; virtual bool IsFileSystem() const;
bool IsPartitioningSystem() const; bool IsPartitioningSystem() const;
@ -108,9 +108,12 @@ protected:
virtual status_t LoadModule(); virtual status_t LoadModule();
virtual void UnloadModule(); virtual void UnloadModule();
status_t SetPrettyName(const char *name);
private: private:
disk_system_id fID; disk_system_id fID;
char *fName; char *fName;
char *fPrettyName;
int32 fLoadCounter; int32 fLoadCounter;
}; };

View File

@ -5,6 +5,8 @@
#include "KDiskSystem.h" #include "KDiskSystem.h"
struct partition_module_info;
namespace BPrivate { namespace BPrivate {
namespace DiskDevice { namespace DiskDevice {
@ -13,6 +15,8 @@ public:
KPartitioningSystem(const char *name); KPartitioningSystem(const char *name);
virtual ~KPartitioningSystem(); virtual ~KPartitioningSystem();
virtual status_t Init();
virtual bool IsFileSystem() const; virtual bool IsFileSystem() const;
// Scanning // Scanning

View File

@ -9,6 +9,7 @@
KDiskSystem::KDiskSystem(const char *name) KDiskSystem::KDiskSystem(const char *name)
: fID(-1), : fID(-1),
fName(NULL), fName(NULL),
fPrettyName(NULL),
fLoadCounter(0) fLoadCounter(0)
{ {
} }
@ -19,6 +20,14 @@ KDiskSystem::~KDiskSystem()
free(fName); free(fName);
} }
// Init
status_t
KDiskSystem::Init()
{
// to be implemented by derived classes
return B_OK;
}
// SetID // SetID
void void
KDiskSystem::SetID(disk_system_id id) KDiskSystem::SetID(disk_system_id id)
@ -44,8 +53,7 @@ KDiskSystem::Name() const
const char * const char *
KDiskSystem::PrettyName() KDiskSystem::PrettyName()
{ {
// to be implemented by derived classes return fPrettyName;
return NULL;
} }
// IsFileSystem // IsFileSystem
@ -392,3 +400,10 @@ KDiskSystem::UnloadModule()
// to be implemented by derived classes // to be implemented by derived classes
} }
// SetPrettyName
status_t
KDiskSystem::SetPrettyName(const char *name)
{
return set_string(fPrettyName, name);
}

View File

@ -20,6 +20,21 @@ KPartitioningSystem::~KPartitioningSystem()
{ {
} }
// Init
status_t
KPartitioningSystem::Init()
{
status_t error = KDiskSystem::Init();
if (error != B_OK)
return error;
error = Load();
if (error != B_OK)
return error;
error = SetPrettyName(fModule->pretty_name);
Unload();
return error;
}
// IsFileSystem // IsFileSystem
bool bool
KPartitioningSystem::IsFileSystem() const KPartitioningSystem::IsFileSystem() const