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:
parent
7aa79f33d8
commit
18b90323d9
@ -23,9 +23,10 @@ public:
|
||||
// void SetID(disk_system_id id);
|
||||
disk_system_id ID() 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;
|
||||
|
||||
void GetInfo(user_disk_system_info *info);
|
||||
@ -137,6 +138,7 @@ protected:
|
||||
virtual void UnloadModule();
|
||||
|
||||
status_t SetPrettyName(const char *name);
|
||||
void SetFlags(uint32 flags);
|
||||
|
||||
static int32 _NextID();
|
||||
|
||||
@ -144,6 +146,7 @@ private:
|
||||
disk_system_id fID;
|
||||
char *fName;
|
||||
char *fPrettyName;
|
||||
uint32 fFlags;
|
||||
int32 fLoadCounter;
|
||||
|
||||
static int32 fNextID;
|
||||
|
@ -20,8 +20,6 @@ public:
|
||||
|
||||
virtual status_t Init();
|
||||
|
||||
virtual bool IsFileSystem() const;
|
||||
|
||||
// Scanning
|
||||
|
||||
virtual float Identify(KPartition *partition, void **cookie);
|
||||
|
@ -17,8 +17,6 @@ public:
|
||||
|
||||
virtual status_t Init();
|
||||
|
||||
virtual bool IsFileSystem() const;
|
||||
|
||||
// Scanning
|
||||
|
||||
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 {
|
||||
module_info module;
|
||||
const char *pretty_name;
|
||||
uint32 flags;
|
||||
|
||||
// scanning
|
||||
partition_identify_partition identify_partition;
|
||||
@ -243,6 +244,7 @@ typedef status_t (*fs_set_partition_content_parameters)(int fd,
|
||||
typedef struct fs_module_info {
|
||||
module_info module;
|
||||
const char *pretty_name;
|
||||
uint32 flags;
|
||||
|
||||
// scanning
|
||||
fs_identify_partition identify_partition;
|
||||
|
@ -52,7 +52,7 @@ struct user_disk_system_info {
|
||||
disk_system_id id;
|
||||
char name[B_FILE_NAME_LENGTH]; // better B_PATH_NAME_LENGTH?
|
||||
char pretty_name[B_OS_NAME_LENGTH];
|
||||
bool file_system;
|
||||
uint32 flags;
|
||||
};
|
||||
|
||||
// userland disk device job representation
|
||||
|
@ -42,6 +42,39 @@ enum {
|
||||
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
|
||||
}
|
||||
#endif
|
||||
|
@ -263,6 +263,7 @@ static fs_module_info bfs_module = {
|
||||
// B_PLAIN_C_ERROR:
|
||||
// kPartitionTypeBFS, // pretty_name
|
||||
"BFS Filesystem", // pretty_name
|
||||
B_DISK_SYSTEM_IS_FILE_SYSTEM, // flags
|
||||
|
||||
// scanning
|
||||
bfs_identify_partition, // identify_partition
|
||||
|
@ -298,6 +298,7 @@ static partition_module_info intel_partition_map_module = {
|
||||
pm_std_ops
|
||||
},
|
||||
kPartitionTypeIntel, // pretty_name
|
||||
0, // flags
|
||||
|
||||
// scanning
|
||||
pm_identify_partition, // identify_partition
|
||||
@ -375,6 +376,7 @@ static partition_module_info intel_extended_partition_module = {
|
||||
ep_std_ops
|
||||
},
|
||||
kPartitionTypeIntelExtended, // pretty_name
|
||||
0, // flags
|
||||
|
||||
// scanning
|
||||
ep_identify_partition, // identify_partition
|
||||
|
@ -64,19 +64,25 @@ KDiskSystem::PrettyName()
|
||||
return fPrettyName;
|
||||
}
|
||||
|
||||
// Flags
|
||||
uint32
|
||||
KDiskSystem::Flags() const
|
||||
{
|
||||
return fFlags;
|
||||
}
|
||||
|
||||
// IsFileSystem
|
||||
bool
|
||||
KDiskSystem::IsFileSystem() const
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
return (fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM);
|
||||
}
|
||||
|
||||
// IsPartitioningSystem
|
||||
bool
|
||||
KDiskSystem::IsPartitioningSystem() const
|
||||
{
|
||||
return !IsFileSystem();
|
||||
return !(fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM);
|
||||
}
|
||||
|
||||
// GetInfo
|
||||
@ -88,7 +94,7 @@ KDiskSystem::GetInfo(user_disk_system_info *info)
|
||||
info->id = ID();
|
||||
strcpy(info->name, Name());
|
||||
strcpy(info->pretty_name, PrettyName());
|
||||
info->file_system = IsFileSystem();
|
||||
info->flags = Flags();
|
||||
}
|
||||
|
||||
// Load
|
||||
@ -549,6 +555,13 @@ KDiskSystem::SetPrettyName(const char *name)
|
||||
return set_string(fPrettyName, name);
|
||||
}
|
||||
|
||||
// SetFlags
|
||||
void
|
||||
KDiskSystem::SetFlags(uint32 flags)
|
||||
{
|
||||
fFlags = flags;
|
||||
}
|
||||
|
||||
// _NextID
|
||||
int32
|
||||
KDiskSystem::_NextID()
|
||||
|
@ -32,17 +32,11 @@ KFileSystem::Init()
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
error = SetPrettyName(fModule->pretty_name);
|
||||
SetFlags(fModule->flags | B_DISK_SYSTEM_IS_FILE_SYSTEM);
|
||||
Unload();
|
||||
return error;
|
||||
}
|
||||
|
||||
// IsFileSystem
|
||||
bool
|
||||
KFileSystem::IsFileSystem() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Identify
|
||||
float
|
||||
KFileSystem::Identify(KPartition *partition, void **cookie)
|
||||
|
@ -32,17 +32,11 @@ KPartitioningSystem::Init()
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
error = SetPrettyName(fModule->pretty_name);
|
||||
SetFlags(fModule->flags & ~(uint32)B_DISK_SYSTEM_IS_FILE_SYSTEM);
|
||||
Unload();
|
||||
return error;
|
||||
}
|
||||
|
||||
// IsFileSystem
|
||||
bool
|
||||
KPartitioningSystem::IsFileSystem() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Identify
|
||||
float
|
||||
KPartitioningSystem::Identify(KPartition *partition, void **cookie)
|
||||
|
Loading…
Reference in New Issue
Block a user