From 13a452eaeed61d03d32e79bdb067ffa8bbb994e6 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 11 Jun 2003 22:00:59 +0000 Subject: [PATCH] Added an Init() amd dealt with the PrettyName(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3478 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/disk_device_manager/KDiskSystem.h | 7 +++++-- .../disk_device_manager/KPartitioningSystem.h | 4 ++++ .../core/disk_device_manager/KDiskSystem.cpp | 19 +++++++++++++++++-- .../KPartitioningSystem.cpp | 15 +++++++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/headers/private/kernel/disk_device_manager/KDiskSystem.h b/headers/private/kernel/disk_device_manager/KDiskSystem.h index a5289f8ed3..62ab750769 100644 --- a/headers/private/kernel/disk_device_manager/KDiskSystem.h +++ b/headers/private/kernel/disk_device_manager/KDiskSystem.h @@ -16,12 +16,12 @@ public: KDiskSystem(const char *name); virtual ~KDiskSystem(); + virtual status_t Init(); + void SetID(disk_system_id id); disk_system_id ID() const; const char *Name() const; virtual const char *PrettyName(); - // TODO: Add an Init(), make PrettyName() non-virtual and add a - // protected setter. virtual bool IsFileSystem() const; bool IsPartitioningSystem() const; @@ -108,9 +108,12 @@ protected: virtual status_t LoadModule(); virtual void UnloadModule(); + status_t SetPrettyName(const char *name); + private: disk_system_id fID; char *fName; + char *fPrettyName; int32 fLoadCounter; }; diff --git a/headers/private/kernel/disk_device_manager/KPartitioningSystem.h b/headers/private/kernel/disk_device_manager/KPartitioningSystem.h index d44ffa19c2..665d742f22 100644 --- a/headers/private/kernel/disk_device_manager/KPartitioningSystem.h +++ b/headers/private/kernel/disk_device_manager/KPartitioningSystem.h @@ -5,6 +5,8 @@ #include "KDiskSystem.h" +struct partition_module_info; + namespace BPrivate { namespace DiskDevice { @@ -13,6 +15,8 @@ public: KPartitioningSystem(const char *name); virtual ~KPartitioningSystem(); + virtual status_t Init(); + virtual bool IsFileSystem() const; // Scanning diff --git a/src/kernel/core/disk_device_manager/KDiskSystem.cpp b/src/kernel/core/disk_device_manager/KDiskSystem.cpp index 8f4b158a66..daef43a860 100644 --- a/src/kernel/core/disk_device_manager/KDiskSystem.cpp +++ b/src/kernel/core/disk_device_manager/KDiskSystem.cpp @@ -9,6 +9,7 @@ KDiskSystem::KDiskSystem(const char *name) : fID(-1), fName(NULL), + fPrettyName(NULL), fLoadCounter(0) { } @@ -19,6 +20,14 @@ KDiskSystem::~KDiskSystem() free(fName); } +// Init +status_t +KDiskSystem::Init() +{ + // to be implemented by derived classes + return B_OK; +} + // SetID void KDiskSystem::SetID(disk_system_id id) @@ -44,8 +53,7 @@ KDiskSystem::Name() const const char * KDiskSystem::PrettyName() { - // to be implemented by derived classes - return NULL; + return fPrettyName; } // IsFileSystem @@ -392,3 +400,10 @@ KDiskSystem::UnloadModule() // to be implemented by derived classes } +// SetPrettyName +status_t +KDiskSystem::SetPrettyName(const char *name) +{ + return set_string(fPrettyName, name); +} + diff --git a/src/kernel/core/disk_device_manager/KPartitioningSystem.cpp b/src/kernel/core/disk_device_manager/KPartitioningSystem.cpp index 871cd71ec8..b325c26ca2 100644 --- a/src/kernel/core/disk_device_manager/KPartitioningSystem.cpp +++ b/src/kernel/core/disk_device_manager/KPartitioningSystem.cpp @@ -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 bool KPartitioningSystem::IsFileSystem() const