Added flags for disk systems.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4009 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2003-07-18 18:41:21 +00:00
parent 7aa79f33d8
commit 18b90323d9
11 changed files with 63 additions and 25 deletions
@@ -23,9 +23,10 @@ public:
// 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(); const char *PrettyName();
uint32 Flags() const;
virtual bool IsFileSystem() const; bool IsFileSystem() const;
bool IsPartitioningSystem() const; bool IsPartitioningSystem() const;
void GetInfo(user_disk_system_info *info); void GetInfo(user_disk_system_info *info);
@@ -137,6 +138,7 @@ protected:
virtual void UnloadModule(); virtual void UnloadModule();
status_t SetPrettyName(const char *name); status_t SetPrettyName(const char *name);
void SetFlags(uint32 flags);
static int32 _NextID(); static int32 _NextID();
@@ -144,6 +146,7 @@ private:
disk_system_id fID; disk_system_id fID;
char *fName; char *fName;
char *fPrettyName; char *fPrettyName;
uint32 fFlags;
int32 fLoadCounter; int32 fLoadCounter;
static int32 fNextID; static int32 fNextID;
@@ -20,8 +20,6 @@ public:
virtual status_t Init(); virtual status_t Init();
virtual bool IsFileSystem() const;
// Scanning // Scanning
virtual float Identify(KPartition *partition, void **cookie); virtual float Identify(KPartition *partition, void **cookie);
@@ -17,8 +17,6 @@ public:
virtual status_t Init(); virtual status_t Init();
virtual bool IsFileSystem() const;
// Scanning // Scanning
virtual float Identify(KPartition *partition, void **cookie); virtual float Identify(KPartition *partition, void **cookie);
@@ -117,6 +117,7 @@ typedef status_t (*partition_set_partition_content_parameters)(int fd,
typedef struct partition_module_info { typedef struct partition_module_info {
module_info module; module_info module;
const char *pretty_name; const char *pretty_name;
uint32 flags;
// scanning // scanning
partition_identify_partition identify_partition; partition_identify_partition identify_partition;
@@ -243,6 +244,7 @@ typedef status_t (*fs_set_partition_content_parameters)(int fd,
typedef struct fs_module_info { typedef struct fs_module_info {
module_info module; module_info module;
const char *pretty_name; const char *pretty_name;
uint32 flags;
// scanning // scanning
fs_identify_partition identify_partition; fs_identify_partition identify_partition;
@@ -52,7 +52,7 @@ struct user_disk_system_info {
disk_system_id id; disk_system_id id;
char name[B_FILE_NAME_LENGTH]; // better B_PATH_NAME_LENGTH? char name[B_FILE_NAME_LENGTH]; // better B_PATH_NAME_LENGTH?
char pretty_name[B_OS_NAME_LENGTH]; char pretty_name[B_OS_NAME_LENGTH];
bool file_system; uint32 flags;
}; };
// userland disk device job representation // userland disk device job representation
+33
View File
@@ -42,6 +42,39 @@ enum {
B_DISK_DEVICE_WRITE_ONCE = 0x08, B_DISK_DEVICE_WRITE_ONCE = 0x08,
}; };
// disk system flags
enum {
B_DISK_SYSTEM_IS_FILE_SYSTEM = 0x0001,
// flags common for both file and partitioning systems
B_DISK_SYSTEM_SUPPORTS_CHECKING = 0x0002,
B_DISK_SYSTEM_SUPPORTS_REPAIRING = 0x0004,
B_DISK_SYSTEM_SUPPORTS_RESIZING = 0x0008,
B_DISK_SYSTEM_SUPPORTS_MOVING = 0x0010,
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME = 0x0020,
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS = 0x0040,
// file system specific flags
B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING = 0x0100,
B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED = 0x0200,
B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED = 0x0400,
B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED = 0x0800,
B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED = 0x1000,
B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED = 0x2000,
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED = 0x4000,
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED = 0x8000,
// partitioning system specific flags
B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD = 0x0100,
B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD = 0x0200,
B_DISK_SYSTEM_SUPPORTS_SETTING_NAME = 0x0400,
B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE = 0x0800,
B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS = 0x1000,
B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD = 0x2000,
B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD = 0x4000,
B_DISK_SYSTEM_SUPPORTS_INITIALIZING = 0x8000,
};
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
+1
View File
@@ -263,6 +263,7 @@ static fs_module_info bfs_module = {
// B_PLAIN_C_ERROR: // B_PLAIN_C_ERROR:
// kPartitionTypeBFS, // pretty_name // kPartitionTypeBFS, // pretty_name
"BFS Filesystem", // pretty_name "BFS Filesystem", // pretty_name
B_DISK_SYSTEM_IS_FILE_SYSTEM, // flags
// scanning // scanning
bfs_identify_partition, // identify_partition bfs_identify_partition, // identify_partition
@@ -298,6 +298,7 @@ static partition_module_info intel_partition_map_module = {
pm_std_ops pm_std_ops
}, },
kPartitionTypeIntel, // pretty_name kPartitionTypeIntel, // pretty_name
0, // flags
// scanning // scanning
pm_identify_partition, // identify_partition pm_identify_partition, // identify_partition
@@ -375,6 +376,7 @@ static partition_module_info intel_extended_partition_module = {
ep_std_ops ep_std_ops
}, },
kPartitionTypeIntelExtended, // pretty_name kPartitionTypeIntelExtended, // pretty_name
0, // flags
// scanning // scanning
ep_identify_partition, // identify_partition ep_identify_partition, // identify_partition
@@ -64,19 +64,25 @@ KDiskSystem::PrettyName()
return fPrettyName; return fPrettyName;
} }
// Flags
uint32
KDiskSystem::Flags() const
{
return fFlags;
}
// IsFileSystem // IsFileSystem
bool bool
KDiskSystem::IsFileSystem() const KDiskSystem::IsFileSystem() const
{ {
// to be implemented by derived classes return (fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM);
return false;
} }
// IsPartitioningSystem // IsPartitioningSystem
bool bool
KDiskSystem::IsPartitioningSystem() const KDiskSystem::IsPartitioningSystem() const
{ {
return !IsFileSystem(); return !(fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM);
} }
// GetInfo // GetInfo
@@ -88,7 +94,7 @@ KDiskSystem::GetInfo(user_disk_system_info *info)
info->id = ID(); info->id = ID();
strcpy(info->name, Name()); strcpy(info->name, Name());
strcpy(info->pretty_name, PrettyName()); strcpy(info->pretty_name, PrettyName());
info->file_system = IsFileSystem(); info->flags = Flags();
} }
// Load // Load
@@ -549,6 +555,13 @@ KDiskSystem::SetPrettyName(const char *name)
return set_string(fPrettyName, name); return set_string(fPrettyName, name);
} }
// SetFlags
void
KDiskSystem::SetFlags(uint32 flags)
{
fFlags = flags;
}
// _NextID // _NextID
int32 int32
KDiskSystem::_NextID() KDiskSystem::_NextID()
@@ -32,17 +32,11 @@ KFileSystem::Init()
if (error != B_OK) if (error != B_OK)
return error; return error;
error = SetPrettyName(fModule->pretty_name); error = SetPrettyName(fModule->pretty_name);
SetFlags(fModule->flags | B_DISK_SYSTEM_IS_FILE_SYSTEM);
Unload(); Unload();
return error; return error;
} }
// IsFileSystem
bool
KFileSystem::IsFileSystem() const
{
return true;
}
// Identify // Identify
float float
KFileSystem::Identify(KPartition *partition, void **cookie) KFileSystem::Identify(KPartition *partition, void **cookie)
@@ -32,17 +32,11 @@ KPartitioningSystem::Init()
if (error != B_OK) if (error != B_OK)
return error; return error;
error = SetPrettyName(fModule->pretty_name); error = SetPrettyName(fModule->pretty_name);
SetFlags(fModule->flags & ~(uint32)B_DISK_SYSTEM_IS_FILE_SYSTEM);
Unload(); Unload();
return error; return error;
} }
// IsFileSystem
bool
KPartitioningSystem::IsFileSystem() const
{
return false;
}
// Identify // Identify
float float
KPartitioningSystem::Identify(KPartition *partition, void **cookie) KPartitioningSystem::Identify(KPartition *partition, void **cookie)