* Added disk system flags for whether a partition name and partition
content name are supported. * Added file_system_module_info::flags (analogously to partition_module_info::flags) which indicate which disk device features the FS supports. * Replaced the file_system_module_info/partition_module_info::supports_*() hooks by a get_supported_operations() hook and for partitioning systems additionally a get_supported_child_operations() hook. * Updated file and partitioning systems accordingly. * Updated fs_shell accordingly. * Updated the DDM accordingly. The syscall interface remains unchanged, though. * _user_supports_initializing_partition() also checks whether the parent partitioning system is content now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22043 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -55,7 +55,8 @@ extern "C" {
|
||||
|
||||
typedef struct file_system_module_info {
|
||||
struct module_info info;
|
||||
const char *pretty_name;
|
||||
const char* pretty_name;
|
||||
uint32 flags; // DDM flags
|
||||
|
||||
/* scanning (the device is write locked) */
|
||||
float (*identify_partition)(int fd, partition_data *partition,
|
||||
@@ -205,19 +206,7 @@ typedef struct file_system_module_info {
|
||||
status_t (*rewind_query)(fs_volume fs, fs_cookie cookie);
|
||||
|
||||
/* capability querying (the device is read locked) */
|
||||
// ToDo: this will probably be combined to a single call
|
||||
bool (*supports_defragmenting)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_repairing)(partition_data *partition,
|
||||
bool checkOnly, bool *whileMounted);
|
||||
bool (*supports_resizing)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_moving)(partition_data *partition, bool *isNoOp);
|
||||
bool (*supports_setting_content_name)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_setting_content_parameters)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_initializing)(partition_data *partition);
|
||||
uint32 (*get_supported_operations)(partition_data* partition, uint32 mask);
|
||||
|
||||
bool (*validate_resize)(partition_data *partition, off_t *size);
|
||||
bool (*validate_move)(partition_data *partition, off_t *start);
|
||||
|
||||
@@ -67,35 +67,37 @@ enum {
|
||||
|
||||
// disk system flags
|
||||
enum {
|
||||
B_DISK_SYSTEM_IS_FILE_SYSTEM = 0x0001,
|
||||
B_DISK_SYSTEM_IS_FILE_SYSTEM = 0x000001,
|
||||
|
||||
// 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,
|
||||
B_DISK_SYSTEM_SUPPORTS_CHECKING = 0x000002,
|
||||
B_DISK_SYSTEM_SUPPORTS_REPAIRING = 0x000004,
|
||||
B_DISK_SYSTEM_SUPPORTS_RESIZING = 0x000008,
|
||||
B_DISK_SYSTEM_SUPPORTS_MOVING = 0x000010,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME = 0x000020,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS = 0x000040,
|
||||
B_DISK_SYSTEM_SUPPORTS_INITIALIZING = 0x000080,
|
||||
B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME = 0x000100,
|
||||
|
||||
// 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,
|
||||
B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING = 0x001000,
|
||||
B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED = 0x002000,
|
||||
B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED = 0x004000,
|
||||
B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED = 0x008000,
|
||||
B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED = 0x010000,
|
||||
B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED = 0x020000,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED = 0x040000,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED = 0x080000,
|
||||
|
||||
// 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,
|
||||
B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD = 0x001000,
|
||||
B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD = 0x002000,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_NAME = 0x004000,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE = 0x008000,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS = 0x010000,
|
||||
B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD = 0x020000,
|
||||
B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD = 0x040000,
|
||||
B_DISK_SYSTEM_SUPPORTS_NAME = 0x080000,
|
||||
};
|
||||
|
||||
// disk device job types
|
||||
|
||||
@@ -229,6 +229,8 @@
|
||||
#define B_DISK_SYSTEM_SUPPORTS_MOVING FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING
|
||||
#define B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME
|
||||
#define B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS
|
||||
#define B_DISK_SYSTEM_SUPPORTS_INITIALIZING FSSH_B_DISK_SYSTEM_SUPPORTS_INITIALIZING
|
||||
#define B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME FSSH_B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME
|
||||
|
||||
// file system specific flags
|
||||
#define B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING FSSH_B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING
|
||||
@@ -248,7 +250,7 @@
|
||||
#define B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS
|
||||
#define B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD FSSH_B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD
|
||||
#define B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD FSSH_B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD
|
||||
#define B_DISK_SYSTEM_SUPPORTS_INITIALIZING FSSH_B_DISK_SYSTEM_SUPPORTS_INITIALIZING
|
||||
#define B_DISK_SYSTEM_SUPPORTS_NAME FSSH_B_DISK_SYSTEM_SUPPORTS_NAME
|
||||
|
||||
// disk device job types
|
||||
#define B_DISK_DEVICE_JOB_BAD_TYPE FSSH_B_DISK_DEVICE_JOB_BAD_TYPE
|
||||
|
||||
@@ -67,35 +67,37 @@ enum {
|
||||
|
||||
// disk system flags
|
||||
enum {
|
||||
FSSH_B_DISK_SYSTEM_IS_FILE_SYSTEM = 0x0001,
|
||||
FSSH_B_DISK_SYSTEM_IS_FILE_SYSTEM = 0x000001,
|
||||
|
||||
// flags common for both file and partitioning systems
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_CHECKING = 0x0002,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_REPAIRING = 0x0004,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING = 0x0008,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING = 0x0010,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME = 0x0020,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS = 0x0040,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_CHECKING = 0x000002,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_REPAIRING = 0x000004,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING = 0x000008,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING = 0x000010,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME = 0x000020,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS = 0x000040,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_INITIALIZING = 0x000080,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME = 0x000100,
|
||||
|
||||
// file system specific flags
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING = 0x0100,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED = 0x0200,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED = 0x0400,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED = 0x0800,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED = 0x1000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED = 0x2000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED = 0x4000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED = 0x8000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING = 0x001000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED = 0x002000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED = 0x004000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED = 0x008000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED = 0x010000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED = 0x020000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED = 0x040000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED = 0x080000,
|
||||
|
||||
// partitioning system specific flags
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD = 0x0100,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD = 0x0200,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_NAME = 0x0400,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE = 0x0800,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS = 0x1000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD = 0x2000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD = 0x4000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_INITIALIZING = 0x8000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD = 0x001000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD = 0x002000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_NAME = 0x004000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE = 0x008000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS = 0x010000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD = 0x020000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD = 0x040000,
|
||||
FSSH_B_DISK_SYSTEM_SUPPORTS_NAME = 0x080000,
|
||||
};
|
||||
|
||||
// disk device job types
|
||||
|
||||
@@ -54,7 +54,8 @@ extern "C" {
|
||||
|
||||
typedef struct fssh_file_system_module_info {
|
||||
struct fssh_module_info info;
|
||||
const char *pretty_name;
|
||||
const char* pretty_name;
|
||||
uint32_t flags; // DDM flags
|
||||
|
||||
/* scanning (the device is write locked) */
|
||||
float (*identify_partition)(int fd, fssh_partition_data *partition,
|
||||
@@ -239,19 +240,8 @@ typedef struct fssh_file_system_module_info {
|
||||
fssh_status_t (*rewind_query)(fssh_fs_volume fs, fssh_fs_cookie cookie);
|
||||
|
||||
/* capability querying (the device is read locked) */
|
||||
// ToDo: this will probably be combined to a single call
|
||||
bool (*supports_defragmenting)(fssh_partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_repairing)(fssh_partition_data *partition,
|
||||
bool checkOnly, bool *whileMounted);
|
||||
bool (*supports_resizing)(fssh_partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_moving)(fssh_partition_data *partition, bool *isNoOp);
|
||||
bool (*supports_setting_content_name)(fssh_partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_setting_content_parameters)(fssh_partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_initializing)(fssh_partition_data *partition);
|
||||
uint32_t (*get_supported_operations)(fssh_partition_data* partition,
|
||||
uint32_t mask);
|
||||
|
||||
bool (*validate_resize)(fssh_partition_data *partition, fssh_off_t *size);
|
||||
bool (*validate_move)(fssh_partition_data *partition, fssh_off_t *start);
|
||||
|
||||
@@ -54,26 +54,19 @@ public:
|
||||
// Querying
|
||||
// Device must be read locked.
|
||||
|
||||
virtual bool SupportsDefragmenting(KPartition *partition,
|
||||
bool *whileMounted);
|
||||
virtual bool SupportsRepairing(KPartition *partition, bool checkOnly,
|
||||
bool *whileMounted);
|
||||
virtual bool SupportsResizing(KPartition *partition, bool *whileMounted);
|
||||
virtual bool SupportsResizingChild(KPartition *child);
|
||||
virtual bool SupportsMoving(KPartition *partition, bool *isNoOp);
|
||||
virtual bool SupportsMovingChild(KPartition *child);
|
||||
virtual bool SupportsSettingName(KPartition *partition);
|
||||
virtual bool SupportsSettingContentName(KPartition *partition,
|
||||
bool *whileMounted);
|
||||
virtual bool SupportsSettingType(KPartition *partition);
|
||||
virtual bool SupportsSettingParameters(KPartition *partition);
|
||||
virtual bool SupportsSettingContentParameters(KPartition *partition,
|
||||
bool *whileMounted);
|
||||
virtual bool SupportsInitializing(KPartition *partition);
|
||||
virtual uint32 GetSupportedOperations(KPartition* partition, uint32 mask);
|
||||
virtual uint32 GetSupportedChildOperations(KPartition* child, uint32 mask);
|
||||
|
||||
// for convenience
|
||||
bool SupportsOperations(KPartition* partition, uint32 operations)
|
||||
{ return (GetSupportedOperations(partition, operations) & operations)
|
||||
== operations; }
|
||||
bool SupportsChildOperations(KPartition* child, uint32 operations)
|
||||
{ return (GetSupportedChildOperations(child, operations) & operations)
|
||||
== operations; }
|
||||
|
||||
virtual bool SupportsInitializingChild(KPartition *child,
|
||||
const char *diskSystem);
|
||||
virtual bool SupportsCreatingChild(KPartition *partition);
|
||||
virtual bool SupportsDeletingChild(KPartition *child);
|
||||
const char *diskSystem);
|
||||
virtual bool IsSubSystemFor(KPartition *partition);
|
||||
|
||||
virtual bool ValidateResize(KPartition *partition, off_t *size);
|
||||
|
||||
@@ -35,17 +35,7 @@ public:
|
||||
|
||||
// Querying
|
||||
|
||||
virtual bool SupportsDefragmenting(KPartition *partition,
|
||||
bool *whileMounted);
|
||||
virtual bool SupportsRepairing(KPartition *partition, bool checkOnly,
|
||||
bool *whileMounted);
|
||||
virtual bool SupportsResizing(KPartition *partition, bool *whileMounted);
|
||||
virtual bool SupportsMoving(KPartition *partition, bool *isNoOp);
|
||||
virtual bool SupportsSettingContentName(KPartition *partition,
|
||||
bool *whileMounted);
|
||||
virtual bool SupportsSettingContentParameters(KPartition *partition,
|
||||
bool *whileMounted);
|
||||
virtual bool SupportsInitializing(KPartition *partition);
|
||||
virtual uint32 GetSupportedOperations(KPartition* partition, uint32 mask);
|
||||
|
||||
virtual bool ValidateResize(KPartition *partition, off_t *size);
|
||||
virtual bool ValidateMove(KPartition *partition, off_t *start);
|
||||
|
||||
@@ -29,9 +29,7 @@ public:
|
||||
|
||||
// Scanning
|
||||
|
||||
//! Try to identify a given partition
|
||||
virtual float Identify(KPartition *partition, void **cookie);
|
||||
//! Scan the partition
|
||||
virtual status_t Scan(KPartition *partition, void *cookie);
|
||||
virtual void FreeIdentifyCookie(KPartition *partition, void *cookie);
|
||||
virtual void FreeCookie(KPartition *partition);
|
||||
@@ -39,132 +37,75 @@ public:
|
||||
|
||||
// Querying
|
||||
|
||||
//! Check whether the add-on supports repairing this partition.
|
||||
virtual bool SupportsRepairing(KPartition *partition, bool checkOnly,
|
||||
bool *whileMounted);
|
||||
//! Check whether the add-on supports resizing this partition.
|
||||
virtual bool SupportsResizing(KPartition *partition, bool *whileMounted);
|
||||
//! Check whether the add-on supports resizing children of this partition.
|
||||
virtual bool SupportsResizingChild(KPartition *child);
|
||||
//! Check whether the add-on supports moving this partition.
|
||||
virtual bool SupportsMoving(KPartition *partition, bool *isNoOp);
|
||||
//! Check whether the add-on supports moving children of this partition.
|
||||
virtual bool SupportsMovingChild(KPartition *child);
|
||||
//! Check whether the add-on supports setting name of this partition.
|
||||
virtual bool SupportsSettingName(KPartition *partition);
|
||||
//! Check whether the add-on supports setting name to content of this partition.
|
||||
virtual bool SupportsSettingContentName(KPartition *partition,
|
||||
bool *whileMounted);
|
||||
//! Check whether the add-on supports setting type of this partition.
|
||||
virtual bool SupportsSettingType(KPartition *partition);
|
||||
//! Check whether the add-on supports setting parameters of this partition.
|
||||
virtual bool SupportsSettingParameters(KPartition *partition);
|
||||
//! Check whether the add-on supports setting parameters to content of this partition.
|
||||
virtual bool SupportsSettingContentParameters(KPartition *partition,
|
||||
bool *whileMounted);
|
||||
//! Check whether the add-on supports initializing this partition.
|
||||
virtual bool SupportsInitializing(KPartition *partition);
|
||||
//! Check whether the add-on supports initializing a child of this partition.
|
||||
virtual uint32 GetSupportedOperations(KPartition* partition, uint32 mask);
|
||||
virtual uint32 GetSupportedChildOperations(KPartition* child, uint32 mask);
|
||||
|
||||
virtual bool SupportsInitializingChild(KPartition *child,
|
||||
const char *diskSystem);
|
||||
//! Check whether the add-on supports creating children of this partition.
|
||||
virtual bool SupportsCreatingChild(KPartition *partition);
|
||||
//! Check whether the add-on supports deleting children of this partition.
|
||||
virtual bool SupportsDeletingChild(KPartition *child);
|
||||
//! Check whether the add-on is a subsystem for a given partition.
|
||||
const char *diskSystem);
|
||||
virtual bool IsSubSystemFor(KPartition *partition);
|
||||
|
||||
//! Validates parameters for resizing a partition
|
||||
virtual bool ValidateResize(KPartition *partition, off_t *size);
|
||||
//! Validates parameters for resizing a child partition
|
||||
virtual bool ValidateResizeChild(KPartition *child, off_t *size);
|
||||
//! Validates parameters for moving a partition
|
||||
virtual bool ValidateMove(KPartition *partition, off_t *start);
|
||||
//! Validates parameters for moving a child partition
|
||||
virtual bool ValidateMoveChild(KPartition *child, off_t *start);
|
||||
//! Validates parameters for setting name of a partition
|
||||
virtual bool ValidateSetName(KPartition *partition, char *name);
|
||||
//! Validates parameters for setting name to content of a partition
|
||||
virtual bool ValidateSetContentName(KPartition *partition, char *name);
|
||||
//! Validates parameters for setting type of a partition
|
||||
virtual bool ValidateSetType(KPartition *partition, const char *type);
|
||||
//! Validates parameters for setting parameters of a partition
|
||||
virtual bool ValidateSetParameters(KPartition *partition,
|
||||
const char *parameters);
|
||||
//! Validates parameters for setting parameters to content of a partition
|
||||
virtual bool ValidateSetContentParameters(KPartition *parameters,
|
||||
const char *parameters);
|
||||
//! Validates parameters for initializing a partition
|
||||
virtual bool ValidateInitialize(KPartition *partition, char *name,
|
||||
const char *parameters);
|
||||
//! Validates parameters for creating child of a partition
|
||||
virtual bool ValidateCreateChild(KPartition *partition, off_t *start,
|
||||
off_t *size, const char *type,
|
||||
const char *parameters, int32 *index);
|
||||
//! Counts partitionable spaces on a partition
|
||||
virtual int32 CountPartitionableSpaces(KPartition *partition);
|
||||
//! Retrieves a list of partitionable spaces on a partition
|
||||
virtual status_t GetPartitionableSpaces(KPartition *partition,
|
||||
partitionable_space_data *buffer,
|
||||
int32 count,
|
||||
int32 *actualCount = NULL);
|
||||
|
||||
//! Iterates through supported partition types
|
||||
virtual status_t GetNextSupportedType(KPartition *partition, int32 *cookie,
|
||||
char *type);
|
||||
//! Translates the "pretty" content type to an internal type
|
||||
virtual status_t GetTypeForContentType(const char *contentType,
|
||||
char *type);
|
||||
|
||||
// Shadow partition modification
|
||||
|
||||
//! Calls for additional modifications when shadow partition is changed
|
||||
virtual status_t ShadowPartitionChanged(KPartition *partition,
|
||||
uint32 operation);
|
||||
|
||||
// Writing
|
||||
|
||||
//! Repairs a partition
|
||||
virtual status_t Repair(KPartition *partition, bool checkOnly,
|
||||
KDiskDeviceJob *job);
|
||||
//! Resizes a partition
|
||||
virtual status_t Resize(KPartition *partition, off_t size,
|
||||
KDiskDeviceJob *job);
|
||||
//! Resizes child of a partition
|
||||
virtual status_t ResizeChild(KPartition *child, off_t size,
|
||||
KDiskDeviceJob *job);
|
||||
//! Moves a partition
|
||||
virtual status_t Move(KPartition *partition, off_t offset,
|
||||
KDiskDeviceJob *job);
|
||||
//! Moves child of a partition
|
||||
virtual status_t MoveChild(KPartition *child, off_t offset,
|
||||
KDiskDeviceJob *job);
|
||||
//! Sets name of a partition
|
||||
virtual status_t SetName(KPartition *partition, char *name,
|
||||
KDiskDeviceJob *job);
|
||||
//! Sets name of the content of a partition
|
||||
virtual status_t SetContentName(KPartition *partition, char *name,
|
||||
KDiskDeviceJob *job);
|
||||
//! Sets type of a partition
|
||||
virtual status_t SetType(KPartition *partition, char *type,
|
||||
KDiskDeviceJob *job);
|
||||
//! Sets parameters of a partition
|
||||
virtual status_t SetParameters(KPartition *partition,
|
||||
const char *parameters,
|
||||
KDiskDeviceJob *job);
|
||||
//! Sets parameters to content of a partition
|
||||
virtual status_t SetContentParameters(KPartition *partition,
|
||||
const char *parameters,
|
||||
KDiskDeviceJob *job);
|
||||
//! Creates a child partition
|
||||
virtual status_t CreateChild(KPartition *partition, off_t offset,
|
||||
off_t size, const char *type,
|
||||
const char *parameters, KDiskDeviceJob *job,
|
||||
KPartition **child = NULL,
|
||||
partition_id childID = -1);
|
||||
//! Deletes a child partition
|
||||
virtual status_t DeleteChild(KPartition *child, KDiskDeviceJob *job);
|
||||
//! Initializes a partition with this partitioning system
|
||||
virtual status_t Initialize(KPartition *partition, const char *name,
|
||||
const char *parameters, KDiskDeviceJob *job);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// ddm_modules.h
|
||||
//
|
||||
// Interface to be implemented by partition modules.
|
||||
// Interface to be implemented by partitioning modules.
|
||||
|
||||
#ifndef _K_DISK_DEVICE_MODULES_H
|
||||
#define _K_DISK_DEVICE_MODULES_H
|
||||
@@ -9,180 +9,99 @@
|
||||
#include <module.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
// partition module interface
|
||||
|
||||
// scanning
|
||||
// (the device is write locked)
|
||||
typedef float (*partition_identify_partition)(int fd,
|
||||
partition_data *partition, void **cookie);
|
||||
typedef status_t (*partition_scan_partition)(int fd,
|
||||
partition_data *partition, void *identifyCookie);
|
||||
typedef void (*partition_free_identify_partition_cookie)(
|
||||
partition_data *partition, void *cookie);
|
||||
typedef void (*partition_free_partition_cookie)(partition_data *partition);
|
||||
typedef void (*partition_free_partition_content_cookie)(
|
||||
partition_data *partition);
|
||||
|
||||
// querying
|
||||
// (the device is read locked)
|
||||
typedef bool (*partition_supports_repairing)(partition_data *partition,
|
||||
bool checkOnly);
|
||||
typedef bool (*partition_supports_resizing)(partition_data *partition);
|
||||
typedef bool (*partition_supports_resizing_child)(partition_data *partition,
|
||||
partition_data *child);
|
||||
typedef bool (*partition_supports_moving)(partition_data *partition,
|
||||
bool *isNoOp);
|
||||
typedef bool (*partition_supports_moving_child)(partition_data *partition,
|
||||
partition_data *child);
|
||||
typedef bool (*partition_supports_setting_name)(partition_data *partition);
|
||||
typedef bool (*partition_supports_setting_content_name)(
|
||||
partition_data *partition);
|
||||
typedef bool (*partition_supports_setting_type)(partition_data *partition);
|
||||
typedef bool (*partition_supports_setting_parameters)(
|
||||
partition_data *partition);
|
||||
typedef bool (*partition_supports_setting_content_parameters)(
|
||||
partition_data *partition);
|
||||
typedef bool (*partition_supports_initializing)(partition_data *partition);
|
||||
typedef bool (*partition_supports_initializing_child)(
|
||||
partition_data *partition, const char *system);
|
||||
typedef bool (*partition_supports_creating_child)(partition_data *partition);
|
||||
typedef bool (*partition_supports_deleting_child)(partition_data *partition,
|
||||
partition_data *child);
|
||||
typedef bool (*partition_is_sub_system_for)(partition_data *partition);
|
||||
|
||||
typedef bool (*partition_validate_resize)(partition_data *partition,
|
||||
off_t *size);
|
||||
typedef bool (*partition_validate_resize_child)(partition_data *partition,
|
||||
partition_data *child, off_t *size);
|
||||
typedef bool (*partition_validate_move)(partition_data *partition,
|
||||
off_t *start);
|
||||
typedef bool (*partition_validate_move_child)(partition_data *partition,
|
||||
partition_data *child, off_t *start);
|
||||
typedef bool (*partition_validate_set_name)(partition_data *partition,
|
||||
char *name);
|
||||
typedef bool (*partition_validate_set_content_name)(partition_data *partition,
|
||||
char *name);
|
||||
typedef bool (*partition_validate_set_type)(partition_data *partition,
|
||||
const char *type);
|
||||
typedef bool (*partition_validate_set_parameters)(partition_data *partition,
|
||||
const char *parameters);
|
||||
typedef bool (*partition_validate_set_content_parameters)(
|
||||
partition_data *partition, const char *parameters);
|
||||
typedef bool (*partition_validate_initialize)(partition_data *partition,
|
||||
char *name, const char *parameters);
|
||||
typedef bool (*partition_validate_create_child)(partition_data *partition,
|
||||
off_t *start, off_t *size, const char *type, const char *parameters,
|
||||
int32 *index);
|
||||
typedef status_t (*partition_get_partitionable_spaces)(
|
||||
partition_data *partition, partitionable_space_data *buffer, int32 count,
|
||||
int32 *actualCount);
|
||||
// When not implemented, a standard algorithm is used.
|
||||
|
||||
typedef status_t (*partition_get_next_supported_type)(
|
||||
partition_data *partition, int32 *cookie, char *type);
|
||||
typedef status_t (*partition_get_type_for_content_type)(
|
||||
const char *contentType, char *type);
|
||||
|
||||
// shadow partition modification
|
||||
// (device is write locked)
|
||||
typedef status_t (*partition_shadow_changed)(partition_data *partition,
|
||||
uint32 operation);
|
||||
|
||||
// writing
|
||||
// (device is NOT locked)
|
||||
typedef status_t (*partition_repair)(int fd, partition_id partition,
|
||||
bool checkOnly, disk_job_id job);
|
||||
typedef status_t (*partition_resize)(int fd, partition_id partition,
|
||||
off_t size, disk_job_id job);
|
||||
typedef status_t (*partition_resize_child)(int fd, partition_id partition,
|
||||
off_t size, disk_job_id job);
|
||||
typedef status_t (*partition_move)(int fd, partition_id partition,
|
||||
off_t offset, disk_job_id job);
|
||||
typedef status_t (*partition_move_child)(int fd, partition_id partition,
|
||||
partition_id child, off_t offset, disk_job_id job);
|
||||
typedef status_t (*partition_set_name)(int fd, partition_id partition,
|
||||
const char *name, disk_job_id job);
|
||||
typedef status_t (*partition_set_content_name)(int fd, partition_id partition,
|
||||
const char *name, disk_job_id job);
|
||||
typedef status_t (*partition_set_type)(int fd, partition_id partition,
|
||||
const char *type, disk_job_id job);
|
||||
typedef status_t (*partition_set_parameters)(int fd, partition_id partition,
|
||||
const char *parameters, disk_job_id job);
|
||||
typedef status_t (*partition_set_content_parameters)(int fd,
|
||||
partition_id partition, const char *parameters, disk_job_id job);
|
||||
typedef status_t (*partition_initialize)(int fd, partition_id partition,
|
||||
const char *name, const char *parameters, disk_job_id job);
|
||||
typedef status_t (*partition_create_child)(int fd, partition_id partition,
|
||||
off_t offset, off_t size, const char *type, const char *parameters,
|
||||
disk_job_id job, partition_id *childID);
|
||||
// childID is used for the return value, but is also an optional input
|
||||
// parameter -- -1 to be ignored
|
||||
typedef status_t (*partition_delete_child)(int fd, partition_id partition,
|
||||
partition_id child, disk_job_id job);
|
||||
|
||||
typedef struct partition_module_info {
|
||||
module_info module;
|
||||
const char *pretty_name;
|
||||
const char* pretty_name;
|
||||
uint32 flags;
|
||||
|
||||
// scanning
|
||||
partition_identify_partition identify_partition;
|
||||
partition_scan_partition scan_partition;
|
||||
partition_free_identify_partition_cookie free_identify_partition_cookie;
|
||||
partition_free_partition_cookie free_partition_cookie;
|
||||
partition_free_partition_content_cookie free_partition_content_cookie;
|
||||
// (the device is write locked)
|
||||
float (*identify_partition)(int fd, partition_data* partition,
|
||||
void** cookie);
|
||||
status_t (*scan_partition)(int fd, partition_data* partition,
|
||||
void* identifyCookie);
|
||||
void (*free_identify_partition_cookie)(partition_data* partition,
|
||||
void* cookie);
|
||||
void (*free_partition_cookie)(partition_data* partition);
|
||||
void (*free_partition_content_cookie)(partition_data* partition);
|
||||
|
||||
|
||||
// querying
|
||||
partition_supports_repairing supports_repairing;
|
||||
partition_supports_resizing supports_resizing;
|
||||
partition_supports_resizing_child supports_resizing_child;
|
||||
partition_supports_moving supports_moving;
|
||||
partition_supports_moving_child supports_moving_child;
|
||||
partition_supports_setting_name supports_setting_name;
|
||||
partition_supports_setting_content_name supports_setting_content_name;
|
||||
partition_supports_setting_type supports_setting_type;
|
||||
partition_supports_setting_parameters supports_setting_parameters;
|
||||
partition_supports_setting_content_parameters
|
||||
supports_setting_content_parameters;
|
||||
partition_supports_initializing supports_initializing;
|
||||
partition_supports_initializing_child supports_initializing_child;
|
||||
partition_supports_creating_child supports_creating_child;
|
||||
partition_supports_deleting_child supports_deleting_child;
|
||||
partition_is_sub_system_for is_sub_system_for;
|
||||
// (the device is read locked)
|
||||
uint32 (*get_supported_operations)(partition_data* partition, uint32 mask);
|
||||
uint32 (*get_supported_child_operations)(partition_data* partition,
|
||||
partition_data* child, uint32 mask);
|
||||
|
||||
bool (*supports_initializing_child)(partition_data* partition,
|
||||
const char* system);
|
||||
bool (*is_sub_system_for)(partition_data* partition);
|
||||
|
||||
bool (*validate_resize)(partition_data* partition, off_t* size);
|
||||
bool (*validate_resize_child)(partition_data* partition,
|
||||
partition_data* child, off_t* size);
|
||||
bool (*validate_move)(partition_data* partition, off_t* start);
|
||||
bool (*validate_move_child)(partition_data* partition,
|
||||
partition_data* child, off_t* start);
|
||||
bool (*validate_set_name)(partition_data* partition, char* name);
|
||||
bool (*validate_set_content_name)(partition_data* partition, char* name);
|
||||
bool (*validate_set_type)(partition_data* partition, const char* type);
|
||||
bool (*validate_set_parameters)(partition_data* partition,
|
||||
const char* parameters);
|
||||
|
||||
bool (*validate_set_content_parameters)(partition_data* partition,
|
||||
const char* parameters);
|
||||
bool (*validate_initialize)(partition_data* partition, char* name,
|
||||
const char* parameters);
|
||||
bool (*validate_create_child)(partition_data* partition, off_t* start,
|
||||
off_t* size, const char* type, const char* parameters,
|
||||
int32* index);
|
||||
status_t (*get_partitionable_spaces)(partition_data* partition,
|
||||
partitionable_space_data* buffer, int32 count,
|
||||
int32* actualCount);
|
||||
// When not implemented, a standard algorithm is used.
|
||||
|
||||
status_t (*get_next_supported_type)(partition_data* partition,
|
||||
int32* cookie, char* type);
|
||||
status_t (*get_type_for_content_type)(const char* contentType, char* type);
|
||||
|
||||
partition_validate_resize validate_resize;
|
||||
partition_validate_resize_child validate_resize_child;
|
||||
partition_validate_move validate_move;
|
||||
partition_validate_move_child validate_move_child;
|
||||
partition_validate_set_name validate_set_name;
|
||||
partition_validate_set_content_name validate_set_content_name;
|
||||
partition_validate_set_type validate_set_type;
|
||||
partition_validate_set_parameters validate_set_parameters;
|
||||
partition_validate_set_content_parameters
|
||||
validate_set_content_parameters;
|
||||
partition_validate_initialize validate_initialize;
|
||||
partition_validate_create_child validate_create_child;
|
||||
partition_get_partitionable_spaces get_partitionable_spaces;
|
||||
partition_get_next_supported_type get_next_supported_type;
|
||||
partition_get_type_for_content_type get_type_for_content_type;
|
||||
|
||||
// shadow partition modification
|
||||
partition_shadow_changed shadow_changed;
|
||||
// (device is write locked)
|
||||
status_t (*shadow_changed)(partition_data* partition, uint32 operation);
|
||||
|
||||
|
||||
// writing
|
||||
partition_repair repair;
|
||||
partition_resize resize;
|
||||
partition_resize_child resize_child;
|
||||
partition_move move;
|
||||
partition_move_child move_child;
|
||||
partition_set_name set_name;
|
||||
partition_set_content_name set_content_name;
|
||||
partition_set_type set_type;
|
||||
partition_set_parameters set_parameters;
|
||||
partition_set_content_parameters set_content_parameters;
|
||||
partition_initialize initialize;
|
||||
partition_create_child create_child;
|
||||
partition_delete_child delete_child;
|
||||
// (device is NOT locked)
|
||||
status_t (*repair)(int fd, partition_id partition, bool checkOnly,
|
||||
disk_job_id job);
|
||||
status_t (*resize)(int fd, partition_id partition, off_t size,
|
||||
disk_job_id job);
|
||||
status_t (*resize_child)(int fd, partition_id partition, off_t size,
|
||||
disk_job_id job);
|
||||
status_t (*move)(int fd, partition_id partition, off_t offset,
|
||||
disk_job_id job);
|
||||
status_t (*move_child)(int fd, partition_id partition, partition_id child,
|
||||
off_t offset, disk_job_id job);
|
||||
status_t (*set_name)(int fd, partition_id partition, const char* name,
|
||||
disk_job_id job);
|
||||
status_t (*set_content_name)(int fd, partition_id partition,
|
||||
const char* name, disk_job_id job);
|
||||
status_t (*set_type)(int fd, partition_id partition, const char* type,
|
||||
disk_job_id job);
|
||||
status_t (*set_parameters)(int fd, partition_id partition,
|
||||
const char* parameters, disk_job_id job);
|
||||
status_t (*set_content_parameters)(int fd, partition_id partition,
|
||||
const char* parameters, disk_job_id job);
|
||||
status_t (*initialize)(int fd, partition_id partition, const char* name,
|
||||
const char *parameters, disk_job_id job);
|
||||
status_t (*create_child)(int fd, partition_id partition, off_t offset,
|
||||
off_t size, const char* type, const char* parameters,
|
||||
disk_job_id job, partition_id* childID);
|
||||
// childID is used for the return value, but is also an optional input
|
||||
// parameter -- -1 to be ignored
|
||||
status_t (*delete_child)(int fd, partition_id partition, partition_id child,
|
||||
disk_job_id job);
|
||||
} partition_module_info;
|
||||
|
||||
#endif // _K_DISK_DEVICE_MODULES_H
|
||||
|
||||
@@ -2020,15 +2020,16 @@ bfs_rewind_query(void */*fs*/, void *cookie)
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
bool
|
||||
bfs_supports_initializing(partition_data *partition)
|
||||
static uint32
|
||||
bfs_get_supported_operations(partition_data* partition, uint32 mask)
|
||||
{
|
||||
// TODO: We should at least check the partition size.
|
||||
return true;
|
||||
return B_DISK_SYSTEM_SUPPORTS_INITIALIZING
|
||||
| B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
static bool
|
||||
bfs_validate_initialize(partition_data *partition, char *name,
|
||||
const char *parameters)
|
||||
{
|
||||
@@ -2037,7 +2038,7 @@ bfs_validate_initialize(partition_data *partition, char *name,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
static status_t
|
||||
bfs_initialize(int fd, partition_id partition, const char *name,
|
||||
const char *parameters, disk_job_id job)
|
||||
{
|
||||
@@ -2125,6 +2126,26 @@ static file_system_module_info sBeFileSystem = {
|
||||
|
||||
"Be File System",
|
||||
|
||||
// DDM flags
|
||||
0
|
||||
// | B_DISK_SYSTEM_SUPPORTS_CHECKING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_REPAIRING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_RESIZING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_MOVING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS
|
||||
| B_DISK_SYSTEM_SUPPORTS_INITIALIZING
|
||||
| B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME
|
||||
// | B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED
|
||||
// | B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED
|
||||
// | B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED
|
||||
// | B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED
|
||||
// | B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED
|
||||
,
|
||||
|
||||
// scanning
|
||||
bfs_identify_partition,
|
||||
bfs_scan_partition,
|
||||
@@ -2224,13 +2245,7 @@ static file_system_module_info sBeFileSystem = {
|
||||
&bfs_rewind_query,
|
||||
|
||||
/* capability querying operations */
|
||||
NULL, // supports_defragmenting
|
||||
NULL, // supports_repairing
|
||||
NULL, // supports_resizing
|
||||
NULL, // supports_moving
|
||||
NULL, // supports_setting_content_name
|
||||
NULL, // supports_setting_content_parameters
|
||||
&bfs_supports_initializing,
|
||||
&bfs_get_supported_operations,
|
||||
|
||||
NULL, // validate_resize
|
||||
NULL, // validate_move
|
||||
|
||||
@@ -2007,6 +2007,7 @@ static file_system_module_info sCDDAFileSystem = {
|
||||
},
|
||||
|
||||
"CDDA File System",
|
||||
0, // DDM flags
|
||||
|
||||
cdda_identify_partition,
|
||||
cdda_scan_partition,
|
||||
|
||||
@@ -1192,6 +1192,7 @@ static file_system_module_info sDosFileSystem = {
|
||||
},
|
||||
|
||||
"FAT32 File System",
|
||||
0, // DDM flags
|
||||
|
||||
// scanning
|
||||
dosfs_identify_partition,
|
||||
|
||||
@@ -1620,6 +1620,7 @@ static file_system_module_info sGoogleFSModule = {
|
||||
},
|
||||
|
||||
GOOGLEFS_PRETTY_NAME,
|
||||
0, // DDM flags
|
||||
|
||||
// scanning
|
||||
NULL, // fs_identify_partition,
|
||||
|
||||
@@ -972,6 +972,7 @@ static file_system_module_info sISO660FileSystem = {
|
||||
},
|
||||
|
||||
"ISO9660 File System",
|
||||
0, // DDM flags
|
||||
|
||||
// scanning
|
||||
fs_identify_partition,
|
||||
|
||||
@@ -2430,6 +2430,7 @@ static file_system_module_info sNFSModule = {
|
||||
},
|
||||
|
||||
"Network File System v2",
|
||||
0, // DDM flags
|
||||
|
||||
// scanning
|
||||
NULL, // fs_identify_partition,
|
||||
|
||||
@@ -85,6 +85,7 @@ static file_system_module_info sNTFSFileSystem = {
|
||||
},
|
||||
|
||||
"ntfs File System",
|
||||
0, // DDM flags
|
||||
|
||||
// scanning
|
||||
fs_identify_partition,
|
||||
|
||||
@@ -2070,6 +2070,7 @@ static file_system_module_info sRamFSModuleInfo = {
|
||||
},
|
||||
|
||||
"RAM File System",
|
||||
0, // DDM flags
|
||||
|
||||
// scanning
|
||||
NULL, // identify_partition()
|
||||
|
||||
@@ -650,6 +650,7 @@ static file_system_module_info sReiserFSModuleInfo = {
|
||||
},
|
||||
|
||||
"Reiser File System",
|
||||
0, // DDM flags
|
||||
|
||||
// scanning
|
||||
NULL, // identify_partition()
|
||||
|
||||
@@ -1034,6 +1034,7 @@ static file_system_module_info sUserlandFSModuleInfo = {
|
||||
},
|
||||
|
||||
"Userland File System",
|
||||
0, // DDM flags
|
||||
|
||||
// scanning
|
||||
NULL, // identify_partition()
|
||||
|
||||
@@ -264,129 +264,40 @@ pm_free_partition_content_cookie(partition_data *partition)
|
||||
// #pragma mark - Intel Partition Map - support functions
|
||||
|
||||
|
||||
// pm_supports_resizing
|
||||
static bool
|
||||
pm_supports_resizing(partition_data *partition)
|
||||
// pm_get_supported_operations
|
||||
static uint32
|
||||
pm_get_supported_operations(partition_data* partition, uint32 mask = ~0)
|
||||
{
|
||||
TRACE(("intel: pm_supports_resizing(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
return (partition && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntel));
|
||||
}
|
||||
uint32 flags = B_DISK_SYSTEM_SUPPORTS_RESIZING
|
||||
| B_DISK_SYSTEM_SUPPORTS_MOVING
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS
|
||||
| B_DISK_SYSTEM_SUPPORTS_INITIALIZING;
|
||||
|
||||
// pm_supports_resizing_child
|
||||
static bool
|
||||
pm_supports_resizing_child(partition_data *partition, partition_data *child)
|
||||
{
|
||||
TRACE(("intel: pm_supports_resizing_child(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
return (partition && child && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntel));
|
||||
}
|
||||
|
||||
// pm_supports_moving
|
||||
static bool
|
||||
pm_supports_moving(partition_data *partition, bool *isNoOp)
|
||||
{
|
||||
TRACE(("intel: pm_supports_moving(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
*isNoOp = true;
|
||||
return (partition && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntel));
|
||||
}
|
||||
|
||||
// pm_supports_moving_child
|
||||
static bool
|
||||
pm_supports_moving_child(partition_data *partition, partition_data *child)
|
||||
{
|
||||
TRACE(("intel: pm_supports_moving_child(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
return (partition && child && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntel));
|
||||
}
|
||||
|
||||
// pm_supports_setting_name
|
||||
static bool
|
||||
pm_supports_setting_name(partition_data *partition)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// pm_supports_setting_content_name
|
||||
static bool
|
||||
pm_supports_setting_content_name(partition_data *partition)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// pm_supports_setting_type
|
||||
static bool
|
||||
pm_supports_setting_type(partition_data *partition)
|
||||
{
|
||||
TRACE(("intel: pm_supports_setting_type(%ld: %lld, %lld, %ld)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size));
|
||||
|
||||
// partition should be child of "Intel Partition Map"
|
||||
partition_data *parent;
|
||||
return (partition
|
||||
&& (parent = get_parent_partition(partition->id))
|
||||
&& parent->content_type
|
||||
&& !strcmp(parent->content_type, kPartitionTypeIntel));
|
||||
}
|
||||
|
||||
// pm_supports_initializing
|
||||
static bool
|
||||
pm_supports_initializing(partition_data *partition)
|
||||
{
|
||||
TRACE(("intel: pm_supports_initializing(%ld: %lld, %lld, %ld, %s, %d, %d)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type,
|
||||
partition->child_count == 0,
|
||||
partition->content_cookie == NULL));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// pm_supports_creating_child
|
||||
static bool
|
||||
pm_supports_creating_child(partition_data *partition)
|
||||
{
|
||||
TRACE(("intel: pm_supports_creating_child(%ld: %lld, %lld, %ld, %s, %ld)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type,
|
||||
partition->child_count));
|
||||
|
||||
int32 count_spaces = 0;
|
||||
return (partition && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntel)
|
||||
&& partition->child_count < 4
|
||||
// creating child
|
||||
int32 countSpaces = 0;
|
||||
if (partition->child_count < 4
|
||||
// free space check
|
||||
&& pm_get_partitionable_spaces(partition, NULL, 0, &count_spaces)
|
||||
== B_OK
|
||||
&& count_spaces);
|
||||
&& pm_get_partitionable_spaces(partition, NULL, 0, &countSpaces) == B_OK
|
||||
&& countSpaces > 0) {
|
||||
flags |= B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
// pm_supports_deleting_child
|
||||
static bool
|
||||
pm_supports_deleting_child(partition_data *partition, partition_data *child)
|
||||
|
||||
// pm_get_supported_child_operations
|
||||
static uint32
|
||||
pm_get_supported_child_operations(partition_data* partition,
|
||||
partition_data* child, uint32 mask = ~0)
|
||||
{
|
||||
TRACE(("intel: pm_supports_deleting_child(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
return (partition && child && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntel));
|
||||
return B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD
|
||||
| B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE
|
||||
| B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD;
|
||||
}
|
||||
|
||||
|
||||
// pm_is_sub_system_for
|
||||
static bool
|
||||
pm_is_sub_system_for(partition_data *partition)
|
||||
@@ -457,7 +368,7 @@ pm_validate_resize(partition_data *partition, off_t *size)
|
||||
{
|
||||
TRACE(("intel: pm_validate_resize\n"));
|
||||
|
||||
if (!partition || !pm_supports_resizing(partition) || !size)
|
||||
if (!partition || !size)
|
||||
return false;
|
||||
|
||||
return validate_resize(partition, size);
|
||||
@@ -604,10 +515,8 @@ pm_validate_resize_child(partition_data *partition, partition_data *child,
|
||||
{
|
||||
TRACE(("intel: pm_validate_resize_child\n"));
|
||||
|
||||
if (!partition || !child || !size
|
||||
|| !pm_supports_resizing_child(partition, child)) {
|
||||
if (!partition || !child || !size)
|
||||
return false;
|
||||
}
|
||||
|
||||
return validate_resize_child(partition, child, child->offset,
|
||||
child->size, size, get_sibling_partitions_pm);
|
||||
@@ -619,8 +528,7 @@ pm_validate_move(partition_data *partition, off_t *start)
|
||||
{
|
||||
TRACE(("intel: pm_validate_move\n"));
|
||||
|
||||
bool isNoOp;
|
||||
if (!partition || !start || !pm_supports_moving(partition, &isNoOp))
|
||||
if (!partition || !start)
|
||||
return false;
|
||||
// nothing to do here
|
||||
return true;
|
||||
@@ -675,8 +583,7 @@ pm_validate_move_child(partition_data *partition, partition_data *child,
|
||||
{
|
||||
TRACE(("intel: pm_validate_move_child\n"));
|
||||
|
||||
if (!partition || !child || !start
|
||||
|| !pm_supports_moving_child(partition, child))
|
||||
if (!partition || !child || !start)
|
||||
return false;
|
||||
if (*start == child->offset)
|
||||
return true;
|
||||
@@ -721,7 +628,7 @@ pm_validate_set_type(partition_data *partition, const char *type)
|
||||
{
|
||||
TRACE(("intel: pm_validate_set_type\n"));
|
||||
|
||||
if (!partition || !pm_supports_setting_type(partition) || !type)
|
||||
if (!partition || !type)
|
||||
return false;
|
||||
|
||||
partition_data *father = get_parent_partition(partition->id);
|
||||
@@ -742,8 +649,10 @@ pm_validate_initialize(partition_data *partition, char *name,
|
||||
{
|
||||
TRACE(("intel: pm_validate_initialize\n"));
|
||||
|
||||
if (!partition || !pm_supports_initializing(partition))
|
||||
if (!partition || !(pm_get_supported_operations(partition)
|
||||
& B_DISK_SYSTEM_SUPPORTS_INITIALIZING)) {
|
||||
return false;
|
||||
}
|
||||
// name is ignored - we cannot set it to the intel partitioning map
|
||||
// TODO: check parameters - don't know whether any parameters could be set
|
||||
// to the intel partition map
|
||||
@@ -802,8 +711,9 @@ pm_validate_create_child(partition_data *partition, off_t *start, off_t *size,
|
||||
{
|
||||
TRACE(("intel: pm_validate_create_child\n"));
|
||||
|
||||
if (!partition || !pm_supports_creating_child(partition)
|
||||
|| !start || !size || !type || !index) {
|
||||
if (!partition || !(pm_get_supported_operations(partition)
|
||||
& B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD)
|
||||
|| !start || !size || !type || !index) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1535,9 +1445,6 @@ pm_delete_child(int fd, partition_id partitionID, partition_id childID,
|
||||
if (!partition || !child)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if (!pm_supports_deleting_child(partition, child))
|
||||
return B_ERROR;
|
||||
|
||||
PartitionMap *map = (PartitionMap*)partition->content_cookie;
|
||||
PrimaryPartition *primary = (PrimaryPartition*)child->cookie;
|
||||
if (!map || !primary)
|
||||
@@ -1711,142 +1618,46 @@ ep_free_partition_content_cookie(partition_data *partition)
|
||||
// #pragma mark - Intel Extended Partition - support functions
|
||||
|
||||
|
||||
// ep_supports_resizing
|
||||
static bool
|
||||
ep_supports_resizing(partition_data *partition)
|
||||
// ep_get_supported_operations
|
||||
static uint32
|
||||
ep_get_supported_operations(partition_data* partition, uint32 mask = ~0)
|
||||
{
|
||||
TRACE(("intel: ep_supports_resizing(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
|
||||
return (partition && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntelExtended));
|
||||
}
|
||||
|
||||
// ep_supports_resizing_child
|
||||
static bool
|
||||
ep_supports_resizing_child(partition_data *partition, partition_data *child)
|
||||
{
|
||||
TRACE(("intel: ep_supports_resizing_child(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
|
||||
return (partition && child && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntelExtended));
|
||||
}
|
||||
|
||||
// ep_supports_moving
|
||||
static bool
|
||||
ep_supports_moving(partition_data *partition, bool *isNoOp)
|
||||
{
|
||||
TRACE(("intel: ep_supports_moving(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
|
||||
*isNoOp = true;
|
||||
return (partition && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntelExtended));
|
||||
}
|
||||
|
||||
// ep_supports_moving_child
|
||||
static bool
|
||||
ep_supports_moving_child(partition_data *partition, partition_data *child)
|
||||
{
|
||||
TRACE(("intel: ep_supports_moving_child(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
|
||||
return (partition && child && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntelExtended));
|
||||
}
|
||||
|
||||
// ep_supports_setting_name
|
||||
static bool
|
||||
ep_supports_setting_name(partition_data *partition)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ep_supports_setting_content_name
|
||||
static bool
|
||||
ep_supports_setting_content_name(partition_data *partition)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ep_supports_setting_type
|
||||
static bool
|
||||
ep_supports_setting_type(partition_data *partition)
|
||||
{
|
||||
TRACE(("intel: ep_supports_setting_type(%ld: %lld, %lld, %ld)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size));
|
||||
|
||||
// partition should be child of "Intel Extended Partition"
|
||||
partition_data *parent;
|
||||
return (partition
|
||||
&& (parent = get_parent_partition(partition->id))
|
||||
&& parent->content_type
|
||||
&& !strcmp(parent->content_type, kPartitionTypeIntelExtended));
|
||||
}
|
||||
|
||||
// ep_supports_initializing
|
||||
static bool
|
||||
ep_supports_initializing(partition_data *partition)
|
||||
{
|
||||
// TRACE(("intel: ep_supports_initializing(%ld: %lld, %lld, %ld, %s)\n",
|
||||
// partition->id, partition->offset, partition->size,
|
||||
// partition->block_size, partition->content_type));
|
||||
|
||||
if (!partition)
|
||||
return true;
|
||||
uint32 flags = B_DISK_SYSTEM_SUPPORTS_RESIZING
|
||||
| B_DISK_SYSTEM_SUPPORTS_MOVING
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS;
|
||||
|
||||
// initializing
|
||||
if (partition_data* parent = get_parent_partition(partition->id)) {
|
||||
if (partition->type
|
||||
&& strcmp(partition->type, kPartitionTypeIntelExtended) == 0
|
||||
&& strcmp(parent->content_type, kPartitionTypeIntel) == 0) {
|
||||
return true;
|
||||
flags |= B_DISK_SYSTEM_SUPPORTS_INITIALIZING;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ep_supports_creating_child
|
||||
static bool
|
||||
ep_supports_creating_child(partition_data *partition)
|
||||
{
|
||||
TRACE(("intel: ep_supports_creating_child(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
|
||||
// creating child
|
||||
int32 countSpaces = 0;
|
||||
return (partition && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntelExtended)
|
||||
// free space check
|
||||
&& ep_get_partitionable_spaces(partition, NULL, 0, &countSpaces)
|
||||
== B_OK
|
||||
&& countSpaces);
|
||||
if (pm_get_partitionable_spaces(partition, NULL, 0, &countSpaces) == B_OK
|
||||
&& countSpaces > 0) {
|
||||
flags |= B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
// ep_supports_deleting_child
|
||||
static bool
|
||||
ep_supports_deleting_child(partition_data *partition, partition_data *child)
|
||||
|
||||
// ep_get_supported_child_operations
|
||||
static uint32
|
||||
ep_get_supported_child_operations(partition_data* partition,
|
||||
partition_data* child, uint32 mask = ~0)
|
||||
{
|
||||
TRACE(("intel: ep_supports_deleting_child(%ld: %lld, %lld, %ld, %s)\n",
|
||||
partition->id, partition->offset, partition->size,
|
||||
partition->block_size, partition->content_type));
|
||||
|
||||
|
||||
return (partition && child && partition->content_type
|
||||
&& !strcmp(partition->content_type, kPartitionTypeIntelExtended));
|
||||
return B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD
|
||||
| B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE
|
||||
| B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD;
|
||||
}
|
||||
|
||||
|
||||
// ep_is_sub_system_for
|
||||
static bool
|
||||
ep_is_sub_system_for(partition_data *partition)
|
||||
@@ -1872,7 +1683,7 @@ ep_validate_resize(partition_data *partition, off_t *size)
|
||||
{
|
||||
TRACE(("intel: ep_validate_resize\n"));
|
||||
|
||||
if (!partition || !ep_supports_resizing(partition) || !size)
|
||||
if (!partition || !size)
|
||||
return false;
|
||||
|
||||
return validate_resize(partition, size);
|
||||
@@ -1885,8 +1696,7 @@ ep_validate_resize_child(partition_data *partition, partition_data *child,
|
||||
{
|
||||
TRACE(("intel: ep_validate_resize_child\n"));
|
||||
|
||||
if (!partition || !child || !_size
|
||||
|| !ep_supports_resizing_child(partition, child))
|
||||
if (!partition || !child || !_size)
|
||||
return false;
|
||||
|
||||
// validate position
|
||||
@@ -1905,8 +1715,7 @@ ep_validate_move(partition_data *partition, off_t *start)
|
||||
{
|
||||
TRACE(("intel: ep_validate_move\n"));
|
||||
|
||||
bool isNoOp;
|
||||
if (!partition || !start || !ep_supports_moving(partition, &isNoOp))
|
||||
if (!partition || !start)
|
||||
return false;
|
||||
// nothing to do here
|
||||
return true;
|
||||
@@ -1919,8 +1728,7 @@ ep_validate_move_child(partition_data *partition, partition_data *child,
|
||||
{
|
||||
TRACE(("intel: ep_validate_move_child\n"));
|
||||
|
||||
if (!partition || !child || !_start
|
||||
|| !ep_supports_moving_child(partition, child))
|
||||
if (!partition || !child || !_start)
|
||||
return false;
|
||||
if (*_start == child->offset)
|
||||
return true;
|
||||
@@ -1951,7 +1759,7 @@ ep_validate_set_type(partition_data *partition, const char *type)
|
||||
{
|
||||
TRACE(("intel: ep_validate_set_type\n"));
|
||||
|
||||
if (!partition || !ep_supports_setting_type(partition) || !type)
|
||||
if (!partition || !type)
|
||||
return false;
|
||||
|
||||
// validity check of the type
|
||||
@@ -1965,8 +1773,10 @@ ep_validate_initialize(partition_data *partition, char *name,
|
||||
{
|
||||
TRACE(("intel: ep_validate_initialize\n"));
|
||||
|
||||
if (!partition || !ep_supports_initializing(partition))
|
||||
if (!partition || !(ep_get_supported_operations(partition)
|
||||
& B_DISK_SYSTEM_SUPPORTS_INITIALIZING)) {
|
||||
return false;
|
||||
}
|
||||
// name is ignored - we cannot set it to the Intel Extended Partition
|
||||
// TODO: check parameters - don't know whether any parameters could be set
|
||||
// to the Intel Extended Partition
|
||||
@@ -1981,7 +1791,8 @@ ep_validate_create_child(partition_data *partition, off_t *_start, off_t *_size,
|
||||
{
|
||||
TRACE(("intel: ep_validate_create_child\n"));
|
||||
|
||||
if (!partition || !ep_supports_creating_child(partition)
|
||||
if (!partition || !(ep_get_supported_operations(partition)
|
||||
& B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD)
|
||||
|| !_start || !_size || !type || !index) {
|
||||
return false;
|
||||
}
|
||||
@@ -2532,9 +2343,6 @@ ep_delete_child(int fd, partition_id partitionID, partition_id childID,
|
||||
if (!partition || !child)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if (!ep_supports_deleting_child(partition, child))
|
||||
return B_ERROR;
|
||||
|
||||
PrimaryPartition *primary = (PrimaryPartition*)partition->cookie;
|
||||
LogicalPartition *logical = (LogicalPartition*)child->cookie;
|
||||
if (!primary || !logical)
|
||||
@@ -2582,7 +2390,27 @@ static partition_module_info intel_partition_map_module =
|
||||
pm_std_ops
|
||||
},
|
||||
INTEL_PARTITION_NAME, // pretty_name
|
||||
0, // flags
|
||||
|
||||
// flags
|
||||
0
|
||||
// | B_DISK_SYSTEM_SUPPORTS_CHECKING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_REPAIRING
|
||||
| B_DISK_SYSTEM_SUPPORTS_RESIZING
|
||||
| B_DISK_SYSTEM_SUPPORTS_MOVING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS
|
||||
| B_DISK_SYSTEM_SUPPORTS_INITIALIZING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME
|
||||
|
||||
| B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD
|
||||
| B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_NAME
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS
|
||||
| B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD
|
||||
| B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD
|
||||
// | B_DISK_SYSTEM_SUPPORTS_NAME
|
||||
,
|
||||
|
||||
// scanning
|
||||
pm_identify_partition, // identify_partition
|
||||
@@ -2593,20 +2421,9 @@ static partition_module_info intel_partition_map_module =
|
||||
|
||||
#ifndef _BOOT_MODE
|
||||
// querying
|
||||
NULL, // supports_repairing
|
||||
pm_supports_resizing, // supports_resizing
|
||||
pm_supports_resizing_child, // supports_resizing_child
|
||||
pm_supports_moving, // supports_moving
|
||||
pm_supports_moving_child, // supports_moving_child
|
||||
pm_supports_setting_name, // supports_setting_name
|
||||
pm_supports_setting_content_name, // supports_setting_content_name
|
||||
pm_supports_setting_type, // supports_setting_type
|
||||
NULL, // supports_setting_parameters
|
||||
NULL, // supports_setting_content_parameters
|
||||
pm_supports_initializing, // supports_initializing
|
||||
pm_get_supported_operations, // get_supported_operations
|
||||
pm_get_supported_child_operations, // get_supported_child_operations
|
||||
NULL, // supports_initializing_child
|
||||
pm_supports_creating_child, // supports_creating_child
|
||||
pm_supports_deleting_child, // supports_deleting_child
|
||||
pm_is_sub_system_for, // is_sub_system_for
|
||||
|
||||
pm_validate_resize, // validate_resize
|
||||
@@ -2659,7 +2476,27 @@ static partition_module_info intel_extended_partition_module =
|
||||
ep_std_ops
|
||||
},
|
||||
INTEL_EXTENDED_PARTITION_NAME, // pretty_name
|
||||
0, // flags
|
||||
|
||||
// flags
|
||||
0
|
||||
// | B_DISK_SYSTEM_SUPPORTS_CHECKING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_REPAIRING
|
||||
| B_DISK_SYSTEM_SUPPORTS_RESIZING
|
||||
| B_DISK_SYSTEM_SUPPORTS_MOVING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS
|
||||
| B_DISK_SYSTEM_SUPPORTS_INITIALIZING
|
||||
// | B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME
|
||||
|
||||
| B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD
|
||||
| B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_NAME
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE
|
||||
// | B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS
|
||||
| B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD
|
||||
| B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD
|
||||
// | B_DISK_SYSTEM_SUPPORTS_NAME
|
||||
,
|
||||
|
||||
// scanning
|
||||
ep_identify_partition, // identify_partition
|
||||
@@ -2670,20 +2507,9 @@ static partition_module_info intel_extended_partition_module =
|
||||
|
||||
#ifndef _BOOT_MODE
|
||||
// querying
|
||||
NULL, // supports_repairing
|
||||
ep_supports_resizing, // supports_resizing
|
||||
ep_supports_resizing_child, // supports_resizing_child
|
||||
ep_supports_moving, // supports_moving
|
||||
ep_supports_moving_child, // supports_moving_child
|
||||
ep_supports_setting_name, // supports_setting_name
|
||||
ep_supports_setting_content_name, // supports_setting_content_name
|
||||
ep_supports_setting_type, // supports_setting_type
|
||||
NULL, // supports_setting_parameters
|
||||
NULL, // supports_setting_content_parameters
|
||||
ep_supports_initializing, // supports_initializing
|
||||
ep_get_supported_operations, // get_supported_operations
|
||||
ep_get_supported_child_operations, // get_supported_child_operations
|
||||
NULL, // supports_initializing_child
|
||||
ep_supports_creating_child, // supports_creating_child
|
||||
ep_supports_deleting_child, // supports_deleting_child
|
||||
ep_is_sub_system_for, // is_sub_system_for
|
||||
|
||||
ep_validate_resize, // validate_resize
|
||||
|
||||
@@ -171,56 +171,6 @@ static partition_module_info sSessionModule = {
|
||||
free_identify_partition_cookie, // free_identify_partition_cookie
|
||||
free_partition_cookie, // free_partition_cookie
|
||||
free_partition_content_cookie, // free_partition_content_cookie
|
||||
|
||||
// querying
|
||||
NULL, // supports_repairing
|
||||
NULL, // supports_resizing
|
||||
NULL, // supports_resizing_child
|
||||
NULL, // supports_moving
|
||||
NULL, // supports_moving_child
|
||||
NULL, // supports_setting_name
|
||||
NULL, // supports_setting_content_name
|
||||
NULL, // supports_setting_type
|
||||
NULL, // supports_setting_parameters
|
||||
NULL, // supports_setting_content_parameters
|
||||
NULL, // supports_initializing
|
||||
NULL, // supports_initializing_child
|
||||
NULL, // supports_creating_child
|
||||
NULL, // supports_deleting_child
|
||||
NULL, // is_sub_system_for
|
||||
|
||||
NULL, // validate_resize
|
||||
NULL, // validate_resize_child
|
||||
NULL, // validate_move
|
||||
NULL, // validate_move_child
|
||||
NULL, // validate_set_name
|
||||
NULL, // validate_set_content_name
|
||||
NULL, // validate_set_type
|
||||
NULL, // validate_set_parameters
|
||||
NULL, // validate_set_content_parameters
|
||||
NULL, // validate_initialize
|
||||
NULL, // validate_create_child
|
||||
NULL, // get_partitionable_spaces
|
||||
NULL, // get_next_supported_type
|
||||
NULL, // get_type_for_content_type
|
||||
|
||||
// shadow partition modification
|
||||
NULL, // shadow_changed
|
||||
|
||||
// writing
|
||||
NULL, // repair
|
||||
NULL, // resize
|
||||
NULL, // resize_child
|
||||
NULL, // move
|
||||
NULL, // move_child
|
||||
NULL, // set_name
|
||||
NULL, // set_content_name
|
||||
NULL, // set_type
|
||||
NULL, // set_parameters
|
||||
NULL, // set_content_parameters
|
||||
NULL, // initialize
|
||||
NULL, // create_child
|
||||
NULL, // delete_child
|
||||
};
|
||||
|
||||
partition_module_info *modules[] = {
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
#include "KDiskDeviceUtils.h"
|
||||
#include "KDiskSystem.h"
|
||||
|
||||
|
||||
// debugging
|
||||
//#define DBG(x)
|
||||
#define DBG(x) x
|
||||
#define OUT dprintf
|
||||
|
||||
|
||||
// constructor
|
||||
KDiskSystem::KDiskSystem(const char *name)
|
||||
: fID(_NextID()),
|
||||
@@ -26,12 +28,14 @@ KDiskSystem::KDiskSystem(const char *name)
|
||||
set_string(fName, name);
|
||||
}
|
||||
|
||||
|
||||
// destructor
|
||||
KDiskSystem::~KDiskSystem()
|
||||
{
|
||||
free(fName);
|
||||
}
|
||||
|
||||
|
||||
// Init
|
||||
status_t
|
||||
KDiskSystem::Init()
|
||||
@@ -39,6 +43,7 @@ KDiskSystem::Init()
|
||||
return (fName ? B_OK : B_NO_MEMORY);
|
||||
}
|
||||
|
||||
|
||||
// SetID
|
||||
/*void
|
||||
KDiskSystem::SetID(disk_system_id id)
|
||||
@@ -46,6 +51,7 @@ KDiskSystem::SetID(disk_system_id id)
|
||||
fID = id;
|
||||
}*/
|
||||
|
||||
|
||||
// ID
|
||||
disk_system_id
|
||||
KDiskSystem::ID() const
|
||||
@@ -53,6 +59,7 @@ KDiskSystem::ID() const
|
||||
return fID;
|
||||
}
|
||||
|
||||
|
||||
// Name
|
||||
const char *
|
||||
KDiskSystem::Name() const
|
||||
@@ -60,6 +67,7 @@ KDiskSystem::Name() const
|
||||
return fName;
|
||||
}
|
||||
|
||||
|
||||
// PrettyName
|
||||
const char *
|
||||
KDiskSystem::PrettyName()
|
||||
@@ -67,6 +75,7 @@ KDiskSystem::PrettyName()
|
||||
return fPrettyName;
|
||||
}
|
||||
|
||||
|
||||
// Flags
|
||||
uint32
|
||||
KDiskSystem::Flags() const
|
||||
@@ -74,6 +83,7 @@ KDiskSystem::Flags() const
|
||||
return fFlags;
|
||||
}
|
||||
|
||||
|
||||
// IsFileSystem
|
||||
bool
|
||||
KDiskSystem::IsFileSystem() const
|
||||
@@ -81,6 +91,7 @@ KDiskSystem::IsFileSystem() const
|
||||
return (fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM);
|
||||
}
|
||||
|
||||
|
||||
// IsPartitioningSystem
|
||||
bool
|
||||
KDiskSystem::IsPartitioningSystem() const
|
||||
@@ -88,6 +99,7 @@ KDiskSystem::IsPartitioningSystem() const
|
||||
return !(fFlags & B_DISK_SYSTEM_IS_FILE_SYSTEM);
|
||||
}
|
||||
|
||||
|
||||
// GetInfo
|
||||
void
|
||||
KDiskSystem::GetInfo(user_disk_system_info *info)
|
||||
@@ -100,6 +112,7 @@ KDiskSystem::GetInfo(user_disk_system_info *info)
|
||||
info->flags = Flags();
|
||||
}
|
||||
|
||||
|
||||
// Load
|
||||
status_t
|
||||
KDiskSystem::Load()
|
||||
@@ -113,6 +126,7 @@ KDiskSystem::Load()
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
// Unload
|
||||
void
|
||||
KDiskSystem::Unload()
|
||||
@@ -122,6 +136,7 @@ KDiskSystem::Unload()
|
||||
UnloadModule();
|
||||
}
|
||||
|
||||
|
||||
// IsLoaded
|
||||
bool
|
||||
KDiskSystem::IsLoaded() const
|
||||
@@ -130,6 +145,7 @@ KDiskSystem::IsLoaded() const
|
||||
return (fLoadCounter > 0);
|
||||
}
|
||||
|
||||
|
||||
// Identify
|
||||
float
|
||||
KDiskSystem::Identify(KPartition *partition, void **cookie)
|
||||
@@ -138,6 +154,7 @@ KDiskSystem::Identify(KPartition *partition, void **cookie)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Scan
|
||||
status_t
|
||||
KDiskSystem::Scan(KPartition *partition, void *cookie)
|
||||
@@ -146,6 +163,7 @@ KDiskSystem::Scan(KPartition *partition, void *cookie)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// FreeIdentifyCookie
|
||||
void
|
||||
KDiskSystem::FreeIdentifyCookie(KPartition *partition, void *cookie)
|
||||
@@ -153,6 +171,7 @@ KDiskSystem::FreeIdentifyCookie(KPartition *partition, void *cookie)
|
||||
// to be implemented by derived classes
|
||||
}
|
||||
|
||||
|
||||
// FreeCookie
|
||||
void
|
||||
KDiskSystem::FreeCookie(KPartition *partition)
|
||||
@@ -160,6 +179,7 @@ KDiskSystem::FreeCookie(KPartition *partition)
|
||||
// to be implemented by derived classes
|
||||
}
|
||||
|
||||
|
||||
// FreeContentCookie
|
||||
void
|
||||
KDiskSystem::FreeContentCookie(KPartition *partition)
|
||||
@@ -167,110 +187,24 @@ KDiskSystem::FreeContentCookie(KPartition *partition)
|
||||
// to be implemented by derived classes
|
||||
}
|
||||
|
||||
// SupportsDefragmenting
|
||||
bool
|
||||
KDiskSystem::SupportsDefragmenting(KPartition *partition, bool *whileMounted)
|
||||
|
||||
// GetSupportedOperations
|
||||
uint32
|
||||
KDiskSystem::GetSupportedOperations(KPartition* partition, uint32 mask)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
if (whileMounted)
|
||||
*whileMounted = false;
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// SupportsRepairing
|
||||
bool
|
||||
KDiskSystem::SupportsRepairing(KPartition *partition, bool checkOnly,
|
||||
bool *whileMounted)
|
||||
|
||||
// GetSupportedChildOperations
|
||||
uint32
|
||||
KDiskSystem::GetSupportedChildOperations(KPartition* child, uint32 mask)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
if (whileMounted)
|
||||
*whileMounted = false;
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// SupportsResizing
|
||||
bool
|
||||
KDiskSystem::SupportsResizing(KPartition *partition, bool *whileMounted)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
if (whileMounted)
|
||||
*whileMounted = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsResizingChild
|
||||
bool
|
||||
KDiskSystem::SupportsResizingChild(KPartition *child)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsMoving
|
||||
bool
|
||||
KDiskSystem::SupportsMoving(KPartition *partition, bool *isNoOp)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsMovingChild
|
||||
bool
|
||||
KDiskSystem::SupportsMovingChild(KPartition *child)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsSettingName
|
||||
bool
|
||||
KDiskSystem::SupportsSettingName(KPartition *partition)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsSettingContentName
|
||||
bool
|
||||
KDiskSystem::SupportsSettingContentName(KPartition *partition,
|
||||
bool *whileMounted)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsSettingType
|
||||
bool
|
||||
KDiskSystem::SupportsSettingType(KPartition *partition)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsSettingParameters
|
||||
bool
|
||||
KDiskSystem::SupportsSettingParameters(KPartition *partition)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsSettingContentParameters
|
||||
bool
|
||||
KDiskSystem::SupportsSettingContentParameters(KPartition *partition,
|
||||
bool *whileMounted)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsInitializing
|
||||
bool
|
||||
KDiskSystem::SupportsInitializing(KPartition *partition)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsInitializingChild
|
||||
bool
|
||||
@@ -281,21 +215,6 @@ KDiskSystem::SupportsInitializingChild(KPartition *child,
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsCreatingChild
|
||||
bool
|
||||
KDiskSystem::SupportsCreatingChild(KPartition *parent)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// SupportsDeletingChild
|
||||
bool
|
||||
KDiskSystem::SupportsDeletingChild(KPartition *child)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
}
|
||||
|
||||
// IsSubSystemFor
|
||||
bool
|
||||
@@ -305,6 +224,7 @@ KDiskSystem::IsSubSystemFor(KPartition *partition)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateResize
|
||||
bool
|
||||
KDiskSystem::ValidateResize(KPartition *partition, off_t *size)
|
||||
@@ -313,6 +233,7 @@ KDiskSystem::ValidateResize(KPartition *partition, off_t *size)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateResizeChild
|
||||
bool
|
||||
KDiskSystem::ValidateResizeChild(KPartition *child, off_t *size)
|
||||
@@ -321,6 +242,7 @@ KDiskSystem::ValidateResizeChild(KPartition *child, off_t *size)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateMove
|
||||
bool
|
||||
KDiskSystem::ValidateMove(KPartition *partition, off_t *start)
|
||||
@@ -329,6 +251,7 @@ KDiskSystem::ValidateMove(KPartition *partition, off_t *start)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateMoveChild
|
||||
bool
|
||||
KDiskSystem::ValidateMoveChild(KPartition *child, off_t *start)
|
||||
@@ -337,6 +260,7 @@ KDiskSystem::ValidateMoveChild(KPartition *child, off_t *start)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetName
|
||||
bool
|
||||
KDiskSystem::ValidateSetName(KPartition *partition, char *name)
|
||||
@@ -345,6 +269,7 @@ KDiskSystem::ValidateSetName(KPartition *partition, char *name)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetContentName
|
||||
bool
|
||||
KDiskSystem::ValidateSetContentName(KPartition *partition, char *name)
|
||||
@@ -353,6 +278,7 @@ KDiskSystem::ValidateSetContentName(KPartition *partition, char *name)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetType
|
||||
bool
|
||||
KDiskSystem::ValidateSetType(KPartition *partition, const char *type)
|
||||
@@ -361,6 +287,7 @@ KDiskSystem::ValidateSetType(KPartition *partition, const char *type)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetParameters
|
||||
bool
|
||||
KDiskSystem::ValidateSetParameters(KPartition *partition,
|
||||
@@ -370,6 +297,7 @@ KDiskSystem::ValidateSetParameters(KPartition *partition,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetContentParameters
|
||||
bool
|
||||
KDiskSystem::ValidateSetContentParameters(KPartition *partition,
|
||||
@@ -379,6 +307,7 @@ KDiskSystem::ValidateSetContentParameters(KPartition *partition,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateInitialize
|
||||
bool
|
||||
KDiskSystem::ValidateInitialize(KPartition *partition, char *name,
|
||||
@@ -388,6 +317,7 @@ KDiskSystem::ValidateInitialize(KPartition *partition, char *name,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ValidateCreateChild
|
||||
bool
|
||||
KDiskSystem::ValidateCreateChild(KPartition *partition, off_t *start,
|
||||
@@ -398,6 +328,7 @@ KDiskSystem::ValidateCreateChild(KPartition *partition, off_t *start,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// CountPartitionableSpaces
|
||||
int32
|
||||
KDiskSystem::CountPartitionableSpaces(KPartition *partition)
|
||||
@@ -406,6 +337,7 @@ KDiskSystem::CountPartitionableSpaces(KPartition *partition)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// GetPartitionableSpaces
|
||||
status_t
|
||||
KDiskSystem::GetPartitionableSpaces(KPartition *partition,
|
||||
@@ -416,6 +348,7 @@ KDiskSystem::GetPartitionableSpaces(KPartition *partition,
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// GetNextSupportedType
|
||||
status_t
|
||||
KDiskSystem::GetNextSupportedType(KPartition *partition, int32 *cookie,
|
||||
@@ -425,6 +358,7 @@ KDiskSystem::GetNextSupportedType(KPartition *partition, int32 *cookie,
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
// ShadowPartitionChanged
|
||||
status_t
|
||||
KDiskSystem::ShadowPartitionChanged(KPartition *partition, uint32 operation)
|
||||
@@ -433,6 +367,7 @@ KDiskSystem::ShadowPartitionChanged(KPartition *partition, uint32 operation)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
// GetTypeForContentType
|
||||
status_t
|
||||
KDiskSystem::GetTypeForContentType(const char *contentType, char *type)
|
||||
@@ -441,6 +376,7 @@ KDiskSystem::GetTypeForContentType(const char *contentType, char *type)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
// Defragment
|
||||
status_t
|
||||
KDiskSystem::Defragment(KPartition *partition, KDiskDeviceJob *job)
|
||||
@@ -449,6 +385,7 @@ KDiskSystem::Defragment(KPartition *partition, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Repair
|
||||
status_t
|
||||
KDiskSystem::Repair(KPartition *partition, bool checkOnly,
|
||||
@@ -458,6 +395,7 @@ KDiskSystem::Repair(KPartition *partition, bool checkOnly,
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Resize
|
||||
status_t
|
||||
KDiskSystem::Resize(KPartition *partition, off_t size, KDiskDeviceJob *job)
|
||||
@@ -466,6 +404,7 @@ KDiskSystem::Resize(KPartition *partition, off_t size, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// ResizeChild
|
||||
status_t
|
||||
KDiskSystem::ResizeChild(KPartition *child, off_t size, KDiskDeviceJob *job)
|
||||
@@ -474,6 +413,7 @@ KDiskSystem::ResizeChild(KPartition *child, off_t size, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Move
|
||||
status_t
|
||||
KDiskSystem::Move(KPartition *partition, off_t offset, KDiskDeviceJob *job)
|
||||
@@ -482,6 +422,7 @@ KDiskSystem::Move(KPartition *partition, off_t offset, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// MoveChild
|
||||
status_t
|
||||
KDiskSystem::MoveChild(KPartition *child, off_t offset, KDiskDeviceJob *job)
|
||||
@@ -490,6 +431,7 @@ KDiskSystem::MoveChild(KPartition *child, off_t offset, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// SetName
|
||||
status_t
|
||||
KDiskSystem::SetName(KPartition *partition, char *name, KDiskDeviceJob *job)
|
||||
@@ -498,6 +440,7 @@ KDiskSystem::SetName(KPartition *partition, char *name, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// SetContentName
|
||||
status_t
|
||||
KDiskSystem::SetContentName(KPartition *partition, char *name,
|
||||
@@ -507,6 +450,7 @@ KDiskSystem::SetContentName(KPartition *partition, char *name,
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// SetType
|
||||
status_t
|
||||
KDiskSystem::SetType(KPartition *partition, char *type, KDiskDeviceJob *job)
|
||||
@@ -515,6 +459,7 @@ KDiskSystem::SetType(KPartition *partition, char *type, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// SetParameters
|
||||
status_t
|
||||
KDiskSystem::SetParameters(KPartition *partition, const char *parameters,
|
||||
@@ -524,6 +469,7 @@ KDiskSystem::SetParameters(KPartition *partition, const char *parameters,
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// SetContentParameters
|
||||
status_t
|
||||
KDiskSystem::SetContentParameters(KPartition *partition,
|
||||
@@ -533,6 +479,7 @@ KDiskSystem::SetContentParameters(KPartition *partition,
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Initialize
|
||||
status_t
|
||||
KDiskSystem::Initialize(KPartition *partition, const char *name,
|
||||
@@ -542,6 +489,7 @@ KDiskSystem::Initialize(KPartition *partition, const char *name,
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// CreateChild
|
||||
status_t
|
||||
KDiskSystem::CreateChild(KPartition *partition, off_t offset, off_t size,
|
||||
@@ -553,6 +501,7 @@ KDiskSystem::CreateChild(KPartition *partition, off_t offset, off_t size,
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// DeleteChild
|
||||
status_t
|
||||
KDiskSystem::DeleteChild(KPartition *child, KDiskDeviceJob *job)
|
||||
@@ -561,6 +510,7 @@ KDiskSystem::DeleteChild(KPartition *child, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// LoadModule
|
||||
status_t
|
||||
KDiskSystem::LoadModule()
|
||||
@@ -569,6 +519,7 @@ KDiskSystem::LoadModule()
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// UnloadModule
|
||||
void
|
||||
KDiskSystem::UnloadModule()
|
||||
@@ -576,6 +527,7 @@ KDiskSystem::UnloadModule()
|
||||
// to be implemented by derived classes
|
||||
}
|
||||
|
||||
|
||||
// SetPrettyName
|
||||
status_t
|
||||
KDiskSystem::SetPrettyName(const char *name)
|
||||
@@ -583,6 +535,7 @@ KDiskSystem::SetPrettyName(const char *name)
|
||||
return set_string(fPrettyName, name);
|
||||
}
|
||||
|
||||
|
||||
// SetFlags
|
||||
void
|
||||
KDiskSystem::SetFlags(uint32 flags)
|
||||
@@ -590,6 +543,7 @@ KDiskSystem::SetFlags(uint32 flags)
|
||||
fFlags = flags;
|
||||
}
|
||||
|
||||
|
||||
// _NextID
|
||||
int32
|
||||
KDiskSystem::_NextID()
|
||||
|
||||
@@ -20,11 +20,13 @@ KFileSystem::KFileSystem(const char *name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// destructor
|
||||
KFileSystem::~KFileSystem()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Init
|
||||
status_t
|
||||
KFileSystem::Init()
|
||||
@@ -36,11 +38,12 @@ KFileSystem::Init()
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
error = SetPrettyName(fModule->pretty_name);
|
||||
SetFlags(/*fModule->flags |*/ B_DISK_SYSTEM_IS_FILE_SYSTEM);
|
||||
SetFlags(fModule->flags | B_DISK_SYSTEM_IS_FILE_SYSTEM);
|
||||
Unload();
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
// Identify
|
||||
float
|
||||
KFileSystem::Identify(KPartition *partition, void **cookie)
|
||||
@@ -56,6 +59,7 @@ KFileSystem::Identify(KPartition *partition, void **cookie)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Scan
|
||||
status_t
|
||||
KFileSystem::Scan(KPartition *partition, void *cookie)
|
||||
@@ -71,6 +75,7 @@ KFileSystem::Scan(KPartition *partition, void *cookie)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// FreeIdentifyCookie
|
||||
void
|
||||
KFileSystem::FreeIdentifyCookie(KPartition *partition, void *cookie)
|
||||
@@ -81,6 +86,7 @@ KFileSystem::FreeIdentifyCookie(KPartition *partition, void *cookie)
|
||||
cookie);
|
||||
}
|
||||
|
||||
|
||||
// FreeContentCookie
|
||||
void
|
||||
KFileSystem::FreeContentCookie(KPartition *partition)
|
||||
@@ -90,105 +96,26 @@ KFileSystem::FreeContentCookie(KPartition *partition)
|
||||
fModule->free_partition_content_cookie(partition->PartitionData());
|
||||
}
|
||||
|
||||
// SupportsDefragmenting
|
||||
bool
|
||||
KFileSystem::SupportsDefragmenting(KPartition *partition, bool *whileMounted)
|
||||
|
||||
// GetSupportedOperations
|
||||
uint32
|
||||
KFileSystem::GetSupportedOperations(KPartition* partition, uint32 mask)
|
||||
{
|
||||
bool _whileMounted = false;
|
||||
if (!whileMounted)
|
||||
whileMounted = &_whileMounted;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_defragmenting) {
|
||||
return (*whileMounted = false);
|
||||
}
|
||||
return fModule->supports_defragmenting(partition->PartitionData(),
|
||||
whileMounted);
|
||||
ASSERT(partition != NULL);
|
||||
|
||||
// Note, that for initialization, the partition's disk system does not
|
||||
// need to be this disk system.
|
||||
|
||||
if (!fModule)
|
||||
return 0;
|
||||
|
||||
if (!fModule->get_supported_operations)
|
||||
return (Flags() & mask);
|
||||
|
||||
return fModule->get_supported_operations(partition->PartitionData(), mask)
|
||||
& mask;
|
||||
}
|
||||
|
||||
// SupportsRepairing
|
||||
bool
|
||||
KFileSystem::SupportsRepairing(KPartition *partition, bool checkOnly,
|
||||
bool *whileMounted)
|
||||
{
|
||||
bool _whileMounted = false;
|
||||
if (!whileMounted)
|
||||
whileMounted = &_whileMounted;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_repairing) {
|
||||
return (*whileMounted = false);
|
||||
}
|
||||
return fModule->supports_repairing(partition->PartitionData(), checkOnly,
|
||||
whileMounted);
|
||||
}
|
||||
|
||||
// SupportsResizing
|
||||
bool
|
||||
KFileSystem::SupportsResizing(KPartition *partition, bool *whileMounted)
|
||||
{
|
||||
bool _whileMounted = false;
|
||||
if (!whileMounted)
|
||||
whileMounted = &_whileMounted;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_resizing) {
|
||||
return (*whileMounted = false);
|
||||
}
|
||||
return fModule->supports_resizing(partition->PartitionData(),
|
||||
whileMounted);
|
||||
}
|
||||
|
||||
// SupportsMoving
|
||||
bool
|
||||
KFileSystem::SupportsMoving(KPartition *partition, bool *isNoOp)
|
||||
{
|
||||
bool _isNoOp = false;
|
||||
if (!isNoOp)
|
||||
isNoOp = &_isNoOp;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_moving) {
|
||||
return (*isNoOp = false);
|
||||
}
|
||||
return fModule->supports_moving(partition->PartitionData(), isNoOp);
|
||||
}
|
||||
|
||||
// SupportsSettingContentName
|
||||
bool
|
||||
KFileSystem::SupportsSettingContentName(KPartition *partition,
|
||||
bool *whileMounted)
|
||||
{
|
||||
bool _whileMounted = false;
|
||||
if (!whileMounted)
|
||||
whileMounted = &_whileMounted;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_setting_content_name) {
|
||||
return (*whileMounted = false);
|
||||
}
|
||||
return fModule->supports_setting_content_name(partition->PartitionData(),
|
||||
whileMounted);
|
||||
}
|
||||
|
||||
// SupportsSettingContentParameters
|
||||
bool
|
||||
KFileSystem::SupportsSettingContentParameters(KPartition *partition,
|
||||
bool *whileMounted)
|
||||
{
|
||||
bool _whileMounted = false;
|
||||
if (!whileMounted)
|
||||
whileMounted = &_whileMounted;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_setting_content_parameters) {
|
||||
return (*whileMounted = false);
|
||||
}
|
||||
return fModule->supports_setting_content_parameters(
|
||||
partition->PartitionData(), whileMounted);
|
||||
}
|
||||
|
||||
// SupportsInitializing
|
||||
bool
|
||||
KFileSystem::SupportsInitializing(KPartition *partition)
|
||||
{
|
||||
return (partition && fModule && fModule->supports_initializing
|
||||
&& fModule->supports_initializing(partition->PartitionData()));
|
||||
}
|
||||
|
||||
// ValidateResize
|
||||
bool
|
||||
@@ -199,6 +126,7 @@ KFileSystem::ValidateResize(KPartition *partition, off_t *size)
|
||||
&& fModule->validate_resize(partition->PartitionData(), size));
|
||||
}
|
||||
|
||||
|
||||
// ValidateMove
|
||||
bool
|
||||
KFileSystem::ValidateMove(KPartition *partition, off_t *start)
|
||||
@@ -208,6 +136,7 @@ KFileSystem::ValidateMove(KPartition *partition, off_t *start)
|
||||
&& fModule->validate_move(partition->PartitionData(), start));
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetContentName
|
||||
bool
|
||||
KFileSystem::ValidateSetContentName(KPartition *partition, char *name)
|
||||
@@ -218,6 +147,7 @@ KFileSystem::ValidateSetContentName(KPartition *partition, char *name)
|
||||
name));
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetContentParameters
|
||||
bool
|
||||
KFileSystem::ValidateSetContentParameters(KPartition *partition,
|
||||
@@ -229,6 +159,7 @@ KFileSystem::ValidateSetContentParameters(KPartition *partition,
|
||||
partition->PartitionData(), parameters));
|
||||
}
|
||||
|
||||
|
||||
// ValidateInitialize
|
||||
bool
|
||||
KFileSystem::ValidateInitialize(KPartition *partition, char *name,
|
||||
@@ -239,6 +170,7 @@ KFileSystem::ValidateInitialize(KPartition *partition, char *name,
|
||||
parameters));
|
||||
}
|
||||
|
||||
|
||||
// ShadowPartitionChanged
|
||||
status_t
|
||||
KFileSystem::ShadowPartitionChanged(KPartition *partition, uint32 operation)
|
||||
@@ -254,6 +186,7 @@ KFileSystem::ShadowPartitionChanged(KPartition *partition, uint32 operation)
|
||||
return fModule->shadow_changed(partition->PartitionData(), operation);
|
||||
}
|
||||
|
||||
|
||||
// Defragment
|
||||
status_t
|
||||
KFileSystem::Defragment(KPartition *partition, KDiskDeviceJob *job)
|
||||
@@ -262,6 +195,7 @@ KFileSystem::Defragment(KPartition *partition, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Repair
|
||||
status_t
|
||||
KFileSystem::Repair(KPartition *partition, bool checkOnly, KDiskDeviceJob *job)
|
||||
@@ -270,6 +204,7 @@ KFileSystem::Repair(KPartition *partition, bool checkOnly, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Resize
|
||||
status_t
|
||||
KFileSystem::Resize(KPartition *partition, off_t size, KDiskDeviceJob *job)
|
||||
@@ -278,6 +213,7 @@ KFileSystem::Resize(KPartition *partition, off_t size, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Move
|
||||
status_t
|
||||
KFileSystem::Move(KPartition *partition, off_t offset, KDiskDeviceJob *job)
|
||||
@@ -286,6 +222,7 @@ KFileSystem::Move(KPartition *partition, off_t offset, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// SetContentName
|
||||
status_t
|
||||
KFileSystem::SetContentName(KPartition *partition, char *name,
|
||||
@@ -337,6 +274,7 @@ KFileSystem::Initialize(KPartition *partition, const char *name,
|
||||
}
|
||||
|
||||
|
||||
// LoadModule
|
||||
status_t
|
||||
KFileSystem::LoadModule()
|
||||
{
|
||||
@@ -346,6 +284,7 @@ KFileSystem::LoadModule()
|
||||
return get_module(Name(), (module_info **)&fModule);
|
||||
}
|
||||
|
||||
|
||||
// UnloadModule
|
||||
void
|
||||
KFileSystem::UnloadModule()
|
||||
|
||||
@@ -32,11 +32,13 @@ KPartitioningSystem::KPartitioningSystem(const char *name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// destructor
|
||||
KPartitioningSystem::~KPartitioningSystem()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Init
|
||||
status_t
|
||||
KPartitioningSystem::Init()
|
||||
@@ -53,6 +55,7 @@ KPartitioningSystem::Init()
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
// Identify
|
||||
//! Try to identify a given partition
|
||||
float
|
||||
@@ -69,6 +72,7 @@ KPartitioningSystem::Identify(KPartition *partition, void **cookie)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Scan
|
||||
//! Scan the partition
|
||||
status_t
|
||||
@@ -85,6 +89,7 @@ KPartitioningSystem::Scan(KPartition *partition, void *cookie)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// FreeIdentifyCookie
|
||||
void
|
||||
KPartitioningSystem::FreeIdentifyCookie(KPartition *partition, void *cookie)
|
||||
@@ -95,6 +100,7 @@ KPartitioningSystem::FreeIdentifyCookie(KPartition *partition, void *cookie)
|
||||
cookie);
|
||||
}
|
||||
|
||||
|
||||
// FreeCookie
|
||||
void
|
||||
KPartitioningSystem::FreeCookie(KPartition *partition)
|
||||
@@ -107,6 +113,7 @@ KPartitioningSystem::FreeCookie(KPartition *partition)
|
||||
partition->SetCookie(NULL);
|
||||
}
|
||||
|
||||
|
||||
// FreeContentCookie
|
||||
void
|
||||
KPartitioningSystem::FreeContentCookie(KPartition *partition)
|
||||
@@ -119,159 +126,46 @@ KPartitioningSystem::FreeContentCookie(KPartition *partition)
|
||||
partition->SetContentCookie(NULL);
|
||||
}
|
||||
|
||||
// SupportsRepairing
|
||||
//! Check whether the add-on supports repairing this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsRepairing(KPartition *partition, bool checkOnly,
|
||||
bool *whileMounted)
|
||||
|
||||
// GetSupportedOperations
|
||||
uint32
|
||||
KPartitioningSystem::GetSupportedOperations(KPartition* partition, uint32 mask)
|
||||
{
|
||||
bool _whileMounted = false;
|
||||
if (!whileMounted)
|
||||
whileMounted = &_whileMounted;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_repairing) {
|
||||
return (*whileMounted = false);
|
||||
}
|
||||
bool result = fModule->supports_repairing(partition->PartitionData(),
|
||||
checkOnly);
|
||||
*whileMounted = result;
|
||||
return result;
|
||||
ASSERT(partition != NULL);
|
||||
|
||||
// Note, that for initialization, the partition's disk system does not
|
||||
// need to be this disk system.
|
||||
|
||||
if (!fModule)
|
||||
return 0;
|
||||
|
||||
if (!fModule->get_supported_operations)
|
||||
return (Flags() & mask);
|
||||
|
||||
return fModule->get_supported_operations(partition->PartitionData(), mask)
|
||||
& mask;
|
||||
}
|
||||
|
||||
// SupportsResizing
|
||||
//! Check whether the add-on supports resizing this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsResizing(KPartition *partition, bool *whileMounted)
|
||||
|
||||
// GetSupportedChildOperations
|
||||
uint32
|
||||
KPartitioningSystem::GetSupportedChildOperations(KPartition* child, uint32 mask)
|
||||
{
|
||||
bool _whileMounted = false;
|
||||
if (!whileMounted)
|
||||
whileMounted = &_whileMounted;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule ||
|
||||
!fModule->supports_resizing) {
|
||||
return (*whileMounted = false);
|
||||
}
|
||||
bool result = fModule->supports_resizing(partition->PartitionData());
|
||||
*whileMounted = result;
|
||||
return result;
|
||||
ASSERT(child != NULL);
|
||||
ASSERT(child->Parent() != NULL);
|
||||
ASSERT(child->Parent()->DiskSystem() == this);
|
||||
|
||||
if (!fModule)
|
||||
return 0;
|
||||
|
||||
if (!fModule->get_supported_child_operations)
|
||||
return (Flags() & mask);
|
||||
|
||||
return fModule->get_supported_child_operations(
|
||||
child->Parent()->PartitionData(), child->PartitionData(), mask)
|
||||
& mask;
|
||||
}
|
||||
|
||||
// SupportsResizingChild
|
||||
//! Check whether the add-on supports resizing children of this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsResizingChild(KPartition *child)
|
||||
{
|
||||
return (child && child->Parent() && child->ParentDiskSystem() == this
|
||||
&& fModule && fModule->supports_resizing_child
|
||||
&& fModule->supports_resizing_child(child->Parent()->PartitionData(),
|
||||
child->PartitionData()));
|
||||
}
|
||||
|
||||
// SupportsMoving
|
||||
//! Check whether the add-on supports moving this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsMoving(KPartition *partition, bool *isNoOp)
|
||||
{
|
||||
bool _isNoOp = false;
|
||||
if (!isNoOp)
|
||||
isNoOp = &_isNoOp;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_moving) {
|
||||
return (*isNoOp = false);
|
||||
}
|
||||
return fModule->supports_moving(partition->PartitionData(), isNoOp);
|
||||
}
|
||||
|
||||
// SupportsMovingChild
|
||||
//! Check whether the add-on supports moving children of this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsMovingChild(KPartition *child)
|
||||
{
|
||||
return (child && child->Parent() && child->ParentDiskSystem() != this
|
||||
&& fModule && fModule->supports_moving_child
|
||||
&& fModule->supports_moving_child(child->Parent()->PartitionData(),
|
||||
child->PartitionData()));
|
||||
}
|
||||
|
||||
// SupportsSettingName
|
||||
//! Check whether the add-on supports setting name of this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsSettingName(KPartition *partition)
|
||||
{
|
||||
return (partition && partition->ParentDiskSystem() == this
|
||||
&& fModule && fModule->supports_setting_name
|
||||
&& fModule->supports_setting_name(partition->PartitionData()));
|
||||
}
|
||||
|
||||
// SupportsSettingContentName
|
||||
/*! Check whether the add-on supports setting name of the content of this
|
||||
partition.
|
||||
*/
|
||||
bool
|
||||
KPartitioningSystem::SupportsSettingContentName(KPartition *partition,
|
||||
bool *whileMounted)
|
||||
{
|
||||
bool _whileMounted = false;
|
||||
if (!whileMounted)
|
||||
whileMounted = &_whileMounted;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_setting_content_name) {
|
||||
return (*whileMounted = false);
|
||||
}
|
||||
bool result = fModule->supports_setting_content_name(
|
||||
partition->PartitionData());
|
||||
*whileMounted = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// SupportsSettingType
|
||||
//! Check whether the add-on supports setting type of this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsSettingType(KPartition *partition)
|
||||
{
|
||||
return (partition && partition->ParentDiskSystem() == this
|
||||
&& fModule && fModule->supports_setting_type
|
||||
&& fModule->supports_setting_type(partition->PartitionData()));
|
||||
}
|
||||
|
||||
// SupportsSettingParameters
|
||||
//! Check whether the add-on supports setting parameters of this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsSettingParameters(KPartition *partition)
|
||||
{
|
||||
return (partition && partition->ParentDiskSystem() == this
|
||||
&& fModule && fModule->supports_setting_parameters
|
||||
&& fModule->supports_setting_parameters(partition->PartitionData()));
|
||||
}
|
||||
|
||||
// SupportsSettingContentParameters
|
||||
/*! Check whether the add-on supports setting parameters of the content of this
|
||||
partition.
|
||||
*/
|
||||
bool
|
||||
KPartitioningSystem::SupportsSettingContentParameters(KPartition *partition,
|
||||
bool *whileMounted)
|
||||
{
|
||||
bool _whileMounted = false;
|
||||
if (!whileMounted)
|
||||
whileMounted = &_whileMounted;
|
||||
if (!partition || partition->DiskSystem() != this || !fModule
|
||||
|| !fModule->supports_setting_content_parameters) {
|
||||
return (*whileMounted = false);
|
||||
}
|
||||
bool result = fModule->supports_setting_content_parameters(
|
||||
partition->PartitionData());
|
||||
*whileMounted = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
// SupportsInitializing
|
||||
//! Check whether the add-on supports initializing this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsInitializing(KPartition *partition)
|
||||
{
|
||||
return (partition && fModule && fModule->supports_initializing
|
||||
&& fModule->supports_initializing(partition->PartitionData()));
|
||||
}
|
||||
|
||||
// SupportsInitializingChild
|
||||
/*! Check whether the child partition managed by this partitioning system can
|
||||
@@ -281,32 +175,19 @@ bool
|
||||
KPartitioningSystem::SupportsInitializingChild(KPartition *child,
|
||||
const char *diskSystem)
|
||||
{
|
||||
return (child && child->ParentDiskSystem() == this && diskSystem
|
||||
&& fModule && fModule->supports_initializing_child
|
||||
&& fModule->supports_initializing_child(child->PartitionData(),
|
||||
diskSystem));
|
||||
if (!child || child->ParentDiskSystem() != this || !diskSystem
|
||||
|| !fModule)
|
||||
return false;
|
||||
|
||||
// If the hook is not implemented, the parent disk system doesn't want a
|
||||
// veto.
|
||||
if (!fModule->supports_initializing_child)
|
||||
return true;
|
||||
|
||||
return fModule->supports_initializing_child(child->PartitionData(),
|
||||
diskSystem);
|
||||
}
|
||||
|
||||
// SupportsCreatingChild
|
||||
//! Check whether the add-on supports creating children of this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsCreatingChild(KPartition *partition)
|
||||
{
|
||||
return (partition && partition->DiskSystem() == this
|
||||
&& fModule && fModule->supports_creating_child
|
||||
&& fModule->supports_creating_child(partition->PartitionData()));
|
||||
}
|
||||
|
||||
// SupportsDeletingChild
|
||||
//! Check whether the add-on supports deleting children of this partition.
|
||||
bool
|
||||
KPartitioningSystem::SupportsDeletingChild(KPartition *child)
|
||||
{
|
||||
return (child && child->Parent() && child->ParentDiskSystem() == this
|
||||
&& fModule && fModule->supports_deleting_child
|
||||
&& fModule->supports_deleting_child(child->Parent()->PartitionData(),
|
||||
child->PartitionData()));
|
||||
}
|
||||
|
||||
// IsSubSystemFor
|
||||
//! Check whether the add-on is a subsystem for a given partition.
|
||||
@@ -317,6 +198,7 @@ KPartitioningSystem::IsSubSystemFor(KPartition *partition)
|
||||
&& fModule->is_sub_system_for(partition->PartitionData()));
|
||||
}
|
||||
|
||||
|
||||
// ValidateResize
|
||||
//! Validates parameters for resizing a partition
|
||||
bool
|
||||
@@ -327,6 +209,7 @@ KPartitioningSystem::ValidateResize(KPartition *partition, off_t *size)
|
||||
&& fModule->validate_resize(partition->PartitionData(), size));
|
||||
}
|
||||
|
||||
|
||||
// ValidateResizeChild
|
||||
//! Validates parameters for resizing a child partition
|
||||
bool
|
||||
@@ -339,6 +222,7 @@ KPartitioningSystem::ValidateResizeChild(KPartition *child, off_t *size)
|
||||
child->PartitionData(), size));
|
||||
}
|
||||
|
||||
|
||||
// ValidateMove
|
||||
//! Validates parameters for moving a partition
|
||||
bool
|
||||
@@ -349,6 +233,7 @@ KPartitioningSystem::ValidateMove(KPartition *partition, off_t *start)
|
||||
&& fModule->validate_move(partition->PartitionData(), start));
|
||||
}
|
||||
|
||||
|
||||
// ValidateMoveChild
|
||||
//! Validates parameters for moving a child partition
|
||||
bool
|
||||
@@ -361,6 +246,7 @@ KPartitioningSystem::ValidateMoveChild(KPartition *child, off_t *start)
|
||||
child->PartitionData(), start));
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetName
|
||||
//! Validates parameters for setting name of a partition
|
||||
bool
|
||||
@@ -372,6 +258,7 @@ KPartitioningSystem::ValidateSetName(KPartition *partition, char *name)
|
||||
&& fModule->validate_set_name(partition->PartitionData(), name));
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetContentName
|
||||
//! Validates parameters for setting name of the content of a partition
|
||||
bool
|
||||
@@ -383,6 +270,7 @@ KPartitioningSystem::ValidateSetContentName(KPartition *partition, char *name)
|
||||
name));
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetType
|
||||
//! Validates parameters for setting type of a partition
|
||||
bool
|
||||
@@ -393,6 +281,7 @@ KPartitioningSystem::ValidateSetType(KPartition *partition, const char *type)
|
||||
&& fModule->validate_set_type(partition->PartitionData(), type));
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetParameters
|
||||
//! Validates parameters for setting parameters of a partition
|
||||
bool
|
||||
@@ -405,6 +294,7 @@ KPartitioningSystem::ValidateSetParameters(KPartition *partition,
|
||||
parameters));
|
||||
}
|
||||
|
||||
|
||||
// ValidateSetContentParameters
|
||||
//! Validates parameters for setting parameters of the content of a partition
|
||||
bool
|
||||
@@ -417,6 +307,7 @@ KPartitioningSystem::ValidateSetContentParameters(KPartition *partition,
|
||||
partition->PartitionData(), parameters));
|
||||
}
|
||||
|
||||
|
||||
// ValidateInitialize
|
||||
//! Validates parameters for initializing a partition
|
||||
bool
|
||||
@@ -428,6 +319,7 @@ KPartitioningSystem::ValidateInitialize(KPartition *partition, char *name,
|
||||
parameters));
|
||||
}
|
||||
|
||||
|
||||
// ValidateCreateChild
|
||||
//! Validates parameters for creating child of a partition
|
||||
bool
|
||||
@@ -444,6 +336,7 @@ KPartitioningSystem::ValidateCreateChild(KPartition *partition, off_t *start,
|
||||
size, type, parameters, index));
|
||||
}
|
||||
|
||||
|
||||
// CountPartitionableSpaces
|
||||
//! Counts partitionable spaces on a partition
|
||||
int32
|
||||
@@ -461,6 +354,7 @@ KPartitioningSystem::CountPartitionableSpaces(KPartition *partition)
|
||||
return (error == B_OK || error == B_BUFFER_OVERFLOW ? count : 0);
|
||||
}
|
||||
|
||||
|
||||
// GetPartitionableSpaces
|
||||
//! Retrieves a list of partitionable spaces on a partition
|
||||
status_t
|
||||
@@ -479,6 +373,7 @@ KPartitioningSystem::GetPartitionableSpaces(KPartition *partition,
|
||||
buffer, count, actualCount);
|
||||
}
|
||||
|
||||
|
||||
// GetNextSupportedType
|
||||
//! Iterates through supported partition types
|
||||
status_t
|
||||
@@ -495,6 +390,7 @@ KPartitioningSystem::GetNextSupportedType(KPartition *partition, int32 *cookie,
|
||||
type);
|
||||
}
|
||||
|
||||
|
||||
// GetTypeForContentType
|
||||
//! Translates the "pretty" content type to an internal type
|
||||
status_t
|
||||
@@ -507,6 +403,7 @@ KPartitioningSystem::GetTypeForContentType(const char *contentType, char *type)
|
||||
return fModule->get_type_for_content_type(contentType, type);
|
||||
}
|
||||
|
||||
|
||||
// ShadowPartitionChanged
|
||||
//! Calls for additional modifications when shadow partition is changed
|
||||
status_t
|
||||
@@ -524,6 +421,7 @@ KPartitioningSystem::ShadowPartitionChanged(KPartition *partition,
|
||||
return fModule->shadow_changed(partition->PartitionData(), operation);
|
||||
}
|
||||
|
||||
|
||||
// Repair
|
||||
//! Repairs a partition
|
||||
status_t
|
||||
@@ -534,6 +432,7 @@ KPartitioningSystem::Repair(KPartition *partition, bool checkOnly,
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// Resize
|
||||
//! Resizes a partition
|
||||
status_t
|
||||
@@ -571,6 +470,7 @@ KPartitioningSystem::Resize(KPartition *partition, off_t size,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// ResizeChild
|
||||
//! Resizes child of a partition
|
||||
status_t
|
||||
@@ -609,6 +509,7 @@ KPartitioningSystem::ResizeChild(KPartition *child, off_t size,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Move
|
||||
//! Moves a partition
|
||||
status_t
|
||||
@@ -646,6 +547,7 @@ KPartitioningSystem::Move(KPartition *partition, off_t offset,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// MoveChild
|
||||
//! Moves child of a partition
|
||||
status_t
|
||||
@@ -685,6 +587,7 @@ KPartitioningSystem::MoveChild(KPartition *child, off_t offset,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// SetName
|
||||
//! Sets name of a partition
|
||||
status_t
|
||||
@@ -722,6 +625,7 @@ KPartitioningSystem::SetName(KPartition *partition, char *name,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// SetContentName
|
||||
//! Sets name of the content of a partition
|
||||
status_t
|
||||
@@ -760,6 +664,7 @@ KPartitioningSystem::SetContentName(KPartition *partition, char *name,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// SetType
|
||||
//! Sets type of a partition
|
||||
status_t
|
||||
@@ -797,6 +702,7 @@ KPartitioningSystem::SetType(KPartition *partition, char *type,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// SetParameters
|
||||
//! Sets parameters of a partition
|
||||
status_t
|
||||
@@ -835,6 +741,7 @@ KPartitioningSystem::SetParameters(KPartition *partition,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// SetContentParameters
|
||||
//! Sets parameters of the content of a partition
|
||||
status_t
|
||||
@@ -873,6 +780,7 @@ KPartitioningSystem::SetContentParameters(KPartition *partition,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Initialize
|
||||
//! Initializes a partition with this partitioning system
|
||||
status_t
|
||||
@@ -912,6 +820,7 @@ KPartitioningSystem::Initialize(KPartition *partition, const char *name,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// CreateChild
|
||||
//! Creates a child partition
|
||||
status_t
|
||||
@@ -954,6 +863,7 @@ KPartitioningSystem::CreateChild(KPartition *partition, off_t offset,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// DeleteChild
|
||||
//! Deletes a child partition
|
||||
status_t
|
||||
@@ -963,6 +873,7 @@ KPartitioningSystem::DeleteChild(KPartition *child, KDiskDeviceJob *job)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
// LoadModule
|
||||
status_t
|
||||
KPartitioningSystem::LoadModule()
|
||||
@@ -972,6 +883,7 @@ KPartitioningSystem::LoadModule()
|
||||
return get_module(Name(), (module_info**)&fModule);
|
||||
}
|
||||
|
||||
|
||||
// UnloadModule
|
||||
void
|
||||
KPartitioningSystem::UnloadModule()
|
||||
|
||||
@@ -97,14 +97,14 @@ BPrivate::DiskDevice::get_unmovable_descendants(KPartition *partition,
|
||||
}
|
||||
// check partition
|
||||
KDiskSystem *diskSystem = partition->DiskSystem();
|
||||
bool isNoOp = true;
|
||||
bool supports = (diskSystem
|
||||
&& diskSystem->SupportsMoving(partition, &isNoOp));
|
||||
&& diskSystem->SupportsOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_MOVING));
|
||||
if (supports) {
|
||||
unmovable[0] = partition->ID();
|
||||
unmovableSize--;
|
||||
}
|
||||
if (supports && !isNoOp && diskSystem->IsFileSystem()) {
|
||||
if (supports && diskSystem->IsFileSystem()) {
|
||||
needUnmounting[0] = partition->ID();
|
||||
needUnmountingSize--;
|
||||
}
|
||||
@@ -128,8 +128,10 @@ BPrivate::DiskDevice::validate_move_descendants(KPartition *partition,
|
||||
// check partition
|
||||
bool uninitialized = partition->IsUninitialized();
|
||||
KDiskSystem *diskSystem = partition->DiskSystem();
|
||||
bool movable = (uninitialized || diskSystem
|
||||
|| diskSystem->SupportsMoving(partition, NULL));
|
||||
bool movable = (uninitialized
|
||||
|| diskSystem && diskSystem->SupportsOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_MOVING));
|
||||
|
||||
if (markMovable)
|
||||
partition->SetAlgorithmData(movable);
|
||||
// moving partition is supported in principle, now check the new offset
|
||||
@@ -161,13 +163,24 @@ BPrivate::DiskDevice::validate_defragment_partition(KPartition *partition,
|
||||
status_t error = check_partition(partition, changeCounter, requireShadow);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// get the disk system and get the info
|
||||
KDiskSystem *diskSystem = partition->DiskSystem();
|
||||
if (!diskSystem)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
if (diskSystem->SupportsDefragmenting(partition, whileMounted))
|
||||
return B_OK;
|
||||
return B_ERROR;
|
||||
|
||||
uint32 operations = diskSystem->GetSupportedOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING
|
||||
| B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED);
|
||||
if (!(operations & B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING))
|
||||
return B_ERROR;
|
||||
|
||||
if (whileMounted) {
|
||||
*whileMounted = (operations
|
||||
& B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED);
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
// validate_repair_partition
|
||||
@@ -179,13 +192,24 @@ BPrivate::DiskDevice::validate_repair_partition(KPartition *partition,
|
||||
status_t error = check_partition(partition, changeCounter, requireShadow);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// get the disk system and get the info
|
||||
KDiskSystem *diskSystem = partition->DiskSystem();
|
||||
if (!diskSystem)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
if (diskSystem->SupportsRepairing(partition, checkOnly, whileMounted))
|
||||
return B_OK;
|
||||
return B_ERROR;
|
||||
|
||||
uint32 operations = diskSystem->GetSupportedOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_REPAIRING
|
||||
| B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED);
|
||||
if (!(operations & B_DISK_SYSTEM_SUPPORTS_REPAIRING))
|
||||
return B_ERROR;
|
||||
|
||||
if (whileMounted) {
|
||||
*whileMounted = (operations
|
||||
& B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED);
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
// validate_resize_partition
|
||||
@@ -201,12 +225,14 @@ BPrivate::DiskDevice::validate_resize_partition(KPartition *partition,
|
||||
status_t error = check_busy_partition(partition->Parent(), requireShadow);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// get the parent disk system and let it check the value
|
||||
KDiskSystem *parentDiskSystem = partition->Parent()->DiskSystem();
|
||||
if (!parentDiskSystem)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
if (!parentDiskSystem->ValidateResizeChild(partition, size))
|
||||
return B_ERROR;
|
||||
|
||||
// if contents is uninitialized, then there's no need to check anything
|
||||
// more
|
||||
if (partition->IsUninitialized())
|
||||
@@ -426,6 +452,7 @@ BPrivate::DiskDevice::validate_delete_child_partition(KPartition *partition,
|
||||
{
|
||||
if (!partition)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// check the partition
|
||||
if (!check_shadow_partition(partition, changeCounter, requireShadow)
|
||||
|| !partition->Parent()) {
|
||||
@@ -434,13 +461,17 @@ BPrivate::DiskDevice::validate_delete_child_partition(KPartition *partition,
|
||||
status_t error = check_busy_partition(partition->Parent(), requireShadow);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// get the disk system
|
||||
KDiskSystem *diskSystem = partition->Parent()->DiskSystem();
|
||||
if (!diskSystem)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
|
||||
// get the info
|
||||
if (diskSystem->SupportsDeletingChild(partition))
|
||||
if (diskSystem->SupportsChildOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_DELETING_CHILD)) {
|
||||
return B_OK;
|
||||
}
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -470,6 +470,7 @@ _user_supports_resizing_partition(partition_id partitionID,
|
||||
bool *_whileMounted)
|
||||
{
|
||||
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||
|
||||
// get the partition
|
||||
KPartition *partition = manager->ReadLockPartition(partitionID);
|
||||
if (!partition)
|
||||
@@ -485,19 +486,33 @@ _user_supports_resizing_partition(partition_id partitionID,
|
||||
|| partition->Parent()->IsDescendantBusy()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the parent disk system
|
||||
KDiskSystem *parentDiskSystem = partition->Parent()->DiskSystem();
|
||||
if (!parentDiskSystem)
|
||||
return false;
|
||||
bool result = parentDiskSystem->SupportsResizingChild(partition);
|
||||
bool result = parentDiskSystem->SupportsChildOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_RESIZING_CHILD);
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
// get the child disk system
|
||||
KDiskSystem *childDiskSystem = partition->DiskSystem();
|
||||
if (_canResizeContents) {
|
||||
bool whileMounted;
|
||||
bool canResizeContents = (childDiskSystem
|
||||
&& childDiskSystem->SupportsResizing(partition, &whileMounted));
|
||||
bool canResizeContents = false;
|
||||
bool whileMounted = false;
|
||||
if (childDiskSystem) {
|
||||
uint32 operations = childDiskSystem->GetSupportedOperations(
|
||||
partition, B_DISK_SYSTEM_SUPPORTS_RESIZING
|
||||
| B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED);
|
||||
|
||||
if (operations & B_DISK_SYSTEM_SUPPORTS_RESIZING) {
|
||||
canResizeContents = true;
|
||||
if (operations & B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED)
|
||||
whileMounted = true;
|
||||
}
|
||||
}
|
||||
|
||||
user_memcpy(_canResizeContents, &canResizeContents, sizeof(canResizeContents));
|
||||
if (_whileMounted)
|
||||
user_memcpy(_whileMounted, &whileMounted, sizeof(whileMounted));
|
||||
@@ -549,8 +564,11 @@ _user_supports_moving_partition(partition_id partitionID, int32 changeCounter,
|
||||
// get the parent disk system
|
||||
KDiskSystem *parentDiskSystem = partition->Parent()->DiskSystem();
|
||||
result = parentDiskSystem;
|
||||
if (result)
|
||||
result = parentDiskSystem->SupportsMovingChild(partition);
|
||||
if (result) {
|
||||
result = parentDiskSystem->SupportsChildOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_MOVING_CHILD);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
// check the movability of the descendants' contents
|
||||
size_t unmovableSize = bufferSize;
|
||||
@@ -591,12 +609,15 @@ _user_supports_setting_partition_name(partition_id partitionID,
|
||||
|| partition->Parent()->IsDescendantBusy()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the disk system
|
||||
KDiskSystem *diskSystem = partition->Parent()->DiskSystem();
|
||||
if (!diskSystem)
|
||||
return false;
|
||||
|
||||
// get the info
|
||||
return diskSystem->SupportsSettingName(partition);
|
||||
return diskSystem->SupportsChildOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_NAME);
|
||||
}
|
||||
|
||||
// _user_supports_setting_partition_content_name
|
||||
@@ -621,11 +642,19 @@ _user_supports_setting_partition_content_name(partition_id partitionID,
|
||||
KDiskSystem *diskSystem = partition->DiskSystem();
|
||||
if (!diskSystem)
|
||||
return false;
|
||||
|
||||
// get the info
|
||||
bool whileMounted;
|
||||
bool result = diskSystem->SupportsSettingContentName(partition, &whileMounted);
|
||||
if (result && _whileMounted)
|
||||
uint32 operations = diskSystem->GetSupportedOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED);
|
||||
|
||||
bool result = (operations & B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME);
|
||||
if (result && _whileMounted) {
|
||||
bool whileMounted = (operations
|
||||
& B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED);
|
||||
user_memcpy(_whileMounted, &whileMounted, sizeof(whileMounted));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -655,7 +684,8 @@ _user_supports_setting_partition_type(partition_id partitionID,
|
||||
if (!diskSystem)
|
||||
return false;
|
||||
// get the info
|
||||
return diskSystem->SupportsSettingType(partition);
|
||||
return diskSystem->SupportsChildOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_TYPE);
|
||||
}
|
||||
|
||||
// _user_supports_setting_partition_parameters
|
||||
@@ -684,7 +714,8 @@ _user_supports_setting_partition_parameters(partition_id partitionID,
|
||||
if (!diskSystem)
|
||||
return false;
|
||||
// get the info
|
||||
return diskSystem->SupportsSettingParameters(partition);
|
||||
return diskSystem->SupportsChildOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS);
|
||||
}
|
||||
|
||||
// _user_supports_setting_partition_content_parameters
|
||||
@@ -710,11 +741,16 @@ _user_supports_setting_partition_content_parameters(partition_id partitionID,
|
||||
if (!diskSystem)
|
||||
return false;
|
||||
// get the info
|
||||
bool whileMounted;
|
||||
bool result = diskSystem->SupportsSettingContentParameters(partition,
|
||||
&whileMounted);
|
||||
if (result && _whileMounted)
|
||||
uint32 operations = diskSystem->GetSupportedOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS
|
||||
| B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED);
|
||||
bool result = (operations
|
||||
& B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS);
|
||||
if (result && _whileMounted) {
|
||||
bool whileMounted = (operations
|
||||
& B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_PARAMETERS_WHILE_MOUNTED);
|
||||
user_memcpy(_whileMounted, &whileMounted, sizeof(whileMounted));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -731,6 +767,7 @@ _user_supports_initializing_partition(partition_id partitionID,
|
||||
if (error)
|
||||
return error;
|
||||
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||
|
||||
// get the partition
|
||||
KPartition *partition = manager->ReadLockPartition(partitionID);
|
||||
if (!partition)
|
||||
@@ -742,14 +779,31 @@ _user_supports_initializing_partition(partition_id partitionID,
|
||||
return false;
|
||||
if (partition->IsBusy() || partition->IsDescendantBusy())
|
||||
return false;
|
||||
|
||||
// get the disk system
|
||||
KDiskSystem *diskSystem = manager->LoadDiskSystem(diskSystemName);
|
||||
if (!diskSystem)
|
||||
return false;
|
||||
DiskSystemLoader loader(diskSystem, true);
|
||||
|
||||
// get the info
|
||||
return diskSystem->SupportsInitializing(partition);
|
||||
// TODO: Ask the parent partitioning system as well.
|
||||
if (!diskSystem->SupportsOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_INITIALIZING)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the parent partition's disk system
|
||||
KPartition* parentPartition = partition->Parent();
|
||||
if (!parentPartition)
|
||||
return true;
|
||||
|
||||
KDiskSystem* parentDiskSystem = parentPartition->DiskSystem();
|
||||
if (!parentDiskSystem)
|
||||
return false; // something's fishy!
|
||||
|
||||
// ask the parent disk system
|
||||
return parentDiskSystem->SupportsInitializingChild(partition,
|
||||
diskSystemName);
|
||||
}
|
||||
|
||||
// _user_supports_creating_child_partition
|
||||
@@ -774,7 +828,8 @@ _user_supports_creating_child_partition(partition_id partitionID,
|
||||
if (!diskSystem)
|
||||
return false;
|
||||
// get the info
|
||||
return diskSystem->SupportsCreatingChild(partition);
|
||||
return diskSystem->SupportsOperations(partition,
|
||||
B_DISK_SYSTEM_SUPPORTS_CREATING_CHILD);
|
||||
}
|
||||
|
||||
// _user_supports_deleting_child_partition
|
||||
|
||||
@@ -2110,6 +2110,7 @@ file_system_module_info gDeviceFileSystem = {
|
||||
},
|
||||
|
||||
"Device File System",
|
||||
0, // DDM flags
|
||||
|
||||
NULL, // identify_partition()
|
||||
NULL, // scan_partition()
|
||||
|
||||
@@ -1780,6 +1780,7 @@ file_system_module_info gPipeFileSystem = {
|
||||
},
|
||||
|
||||
"Pipe File System",
|
||||
0, // DDM flags
|
||||
|
||||
NULL, // identify_partition()
|
||||
NULL, // scan_partition()
|
||||
|
||||
@@ -1035,6 +1035,7 @@ file_system_module_info gRootFileSystem = {
|
||||
},
|
||||
|
||||
"Root File System",
|
||||
0, // DDM flags
|
||||
|
||||
NULL, // identify_partition()
|
||||
NULL, // scan_partition()
|
||||
|
||||
@@ -1036,6 +1036,7 @@ fssh_file_system_module_info gRootFileSystem = {
|
||||
},
|
||||
|
||||
"Root File System",
|
||||
0, // DDM flags
|
||||
|
||||
NULL, // identify_partition()
|
||||
NULL, // scan_partition()
|
||||
|
||||
Reference in New Issue
Block a user