* Added ShadowPartitionChanged() to KDiskSystem and respective hooks
to the module interfaces. So the disk system will be informed, when a shadow partition has changed and it is allowed to do necessary adjustions (e.g. adjusting the cookie, the parameters, or on partitioning system initialization even creating special child partitions (apple partitioning system)). * Added `int32 *index' parameter to ValidateCreateChild(). So the partitioning system can report at which index the new child shall be inserted. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4065 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -85,7 +85,7 @@ public:
|
||||
const char *parameters);
|
||||
virtual bool ValidateCreateChild(KPartition *partition, off_t *start,
|
||||
off_t *size, const char *type,
|
||||
const char *parameters);
|
||||
const char *parameters, int32 *index);
|
||||
virtual int32 CountPartitionableSpaces(KPartition *partition);
|
||||
virtual status_t GetPartitionableSpaces(KPartition *partition,
|
||||
partitionable_space_data *buffer,
|
||||
@@ -97,6 +97,12 @@ public:
|
||||
virtual status_t GetTypeForContentType(const char *contentType,
|
||||
char *type);
|
||||
|
||||
// Shadow partition modification
|
||||
// Device must be write locked.
|
||||
|
||||
virtual status_t ShadowPartitionChanged(KPartition *partition,
|
||||
uint32 operation);
|
||||
|
||||
// Writing
|
||||
// Device should not be locked.
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ public:
|
||||
virtual bool ValidateInitialize(KPartition *partition, char *name,
|
||||
const char *parameters);
|
||||
|
||||
// Shadow partition modification
|
||||
|
||||
virtual status_t ShadowPartitionChanged(KPartition *partition,
|
||||
uint32 operation);
|
||||
|
||||
// Writing
|
||||
|
||||
virtual status_t Defragment(KPartition *partition, KDiskDeviceJob *job);
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
const char *parameters);
|
||||
virtual bool ValidateCreateChild(KPartition *partition, off_t *start,
|
||||
off_t *size, const char *type,
|
||||
const char *parameters);
|
||||
const char *parameters, int32 *index);
|
||||
virtual int32 CountPartitionableSpaces(KPartition *partition);
|
||||
virtual status_t GetPartitionableSpaces(KPartition *partition,
|
||||
partitionable_space_data *buffer,
|
||||
@@ -74,6 +74,11 @@ public:
|
||||
virtual status_t GetTypeForContentType(const char *contentType,
|
||||
char *type);
|
||||
|
||||
// Shadow partition modification
|
||||
|
||||
virtual status_t ShadowPartitionChanged(KPartition *partition,
|
||||
uint32 operation);
|
||||
|
||||
// Writing
|
||||
|
||||
virtual status_t Repair(KPartition *partition, bool checkOnly,
|
||||
|
||||
@@ -71,8 +71,8 @@ typedef bool (*partition_validate_set_content_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);
|
||||
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);
|
||||
@@ -83,6 +83,11 @@ typedef status_t (*partition_get_next_supported_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,
|
||||
@@ -161,6 +166,9 @@ typedef struct partition_module_info {
|
||||
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;
|
||||
|
||||
// writing
|
||||
partition_repair repair;
|
||||
partition_resize resize;
|
||||
@@ -214,6 +222,11 @@ typedef bool (*fs_validate_set_content_parameters)(partition_data *partition,
|
||||
typedef bool (*fs_validate_initialize)(partition_data *partition, char *name,
|
||||
const char *parameters);
|
||||
|
||||
// shadow partition modification
|
||||
// (device is write locked)
|
||||
typedef status_t (*fs_shadow_changed)(partition_data *partition,
|
||||
uint32 operation);
|
||||
|
||||
// writing
|
||||
// (the device is NOT locked)
|
||||
typedef status_t (*fs_defragment)(int fd, partition_id partition,
|
||||
@@ -261,6 +274,9 @@ typedef struct fs_module_info {
|
||||
validate_set_content_parameters;
|
||||
fs_validate_initialize validate_initialize;
|
||||
|
||||
// shadow partition modification
|
||||
fs_shadow_changed shadow_changed;
|
||||
|
||||
// writing
|
||||
fs_defragment defragment;
|
||||
fs_repair repair;
|
||||
|
||||
@@ -286,6 +286,9 @@ static fs_module_info bfs_module = {
|
||||
NULL, // validate_set_content_parameters
|
||||
NULL, // validate_initialize
|
||||
|
||||
// shadow partition modification
|
||||
NULL, // shadow_changed
|
||||
|
||||
// writing
|
||||
NULL, // defragment
|
||||
NULL, // repair
|
||||
|
||||
@@ -347,6 +347,9 @@ static partition_module_info intel_partition_map_module = {
|
||||
NULL, // get_next_supported_type
|
||||
NULL, // get_type_for_content_type
|
||||
|
||||
// shadow partition modification
|
||||
NULL, // shadow_changed
|
||||
|
||||
// writing
|
||||
NULL, // repair
|
||||
NULL, // resize
|
||||
@@ -427,6 +430,9 @@ static partition_module_info intel_extended_partition_module = {
|
||||
NULL, // get_next_supported_type
|
||||
NULL, // get_type_for_content_type
|
||||
|
||||
// shadow partition modification
|
||||
NULL, // shadow_changed
|
||||
|
||||
// writing
|
||||
NULL, // repair
|
||||
NULL, // resize
|
||||
|
||||
@@ -389,7 +389,7 @@ KDiskSystem::ValidateInitialize(KPartition *partition, char *name,
|
||||
bool
|
||||
KDiskSystem::ValidateCreateChild(KPartition *partition, off_t *start,
|
||||
off_t *size, const char *type,
|
||||
const char *parameters)
|
||||
const char *parameters, int32 *index)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return false;
|
||||
@@ -422,6 +422,14 @@ KDiskSystem::GetNextSupportedType(KPartition *partition, int32 *cookie,
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
// ShadowPartitionChanged
|
||||
status_t
|
||||
KDiskSystem::ShadowPartitionChanged(KPartition *partition, uint32 operation)
|
||||
{
|
||||
// to be implemented by derived classes
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
// GetTypeForContentType
|
||||
status_t
|
||||
KDiskSystem::GetTypeForContentType(const char *contentType, char *type)
|
||||
|
||||
@@ -235,6 +235,21 @@ KFileSystem::ValidateInitialize(KPartition *partition, char *name,
|
||||
parameters));
|
||||
}
|
||||
|
||||
// ShadowPartitionChanged
|
||||
status_t
|
||||
KFileSystem::ShadowPartitionChanged(KPartition *partition, uint32 operation)
|
||||
{
|
||||
if (!partition)
|
||||
return B_BAD_VALUE;
|
||||
if (!fModule)
|
||||
return B_ERROR;
|
||||
// If not implemented, we assume, that the file system doesn't have to
|
||||
// make any additional changes.
|
||||
if (!fModule->shadow_changed)
|
||||
return B_OK;
|
||||
return fModule->shadow_changed(partition->PartitionData(), operation);
|
||||
}
|
||||
|
||||
// Defragment
|
||||
status_t
|
||||
KFileSystem::Defragment(KPartition *partition, KDiskDeviceJob *job)
|
||||
|
||||
@@ -386,13 +386,17 @@ KPartitioningSystem::ValidateInitialize(KPartition *partition, char *name,
|
||||
bool
|
||||
KPartitioningSystem::ValidateCreateChild(KPartition *partition, off_t *start,
|
||||
off_t *size, const char *type,
|
||||
const char *parameters)
|
||||
const char *parameters, int32 *index)
|
||||
{
|
||||
int32 _index = 0;
|
||||
if (!index)
|
||||
index = &_index;
|
||||
return (partition && start && size && type
|
||||
&& partition->DiskSystem() == this && fModule
|
||||
&& fModule->validate_create_child
|
||||
&& fModule->validate_create_child(partition->PartitionData(),
|
||||
start, size, type, parameters));
|
||||
start, size, type, parameters,
|
||||
index));
|
||||
}
|
||||
|
||||
// CountPartitionableSpaces
|
||||
@@ -455,6 +459,22 @@ KPartitioningSystem::GetTypeForContentType(const char *contentType, char *type)
|
||||
return fModule->get_type_for_content_type(contentType, type);
|
||||
}
|
||||
|
||||
// ShadowPartitionChanged
|
||||
status_t
|
||||
KPartitioningSystem::ShadowPartitionChanged(KPartition *partition,
|
||||
uint32 operation)
|
||||
{
|
||||
if (!partition)
|
||||
return B_BAD_VALUE;
|
||||
if (!fModule)
|
||||
return B_ERROR;
|
||||
// If not implemented, we assume, that the partitioning system doesn't
|
||||
// have to make any additional changes.
|
||||
if (!fModule->shadow_changed)
|
||||
return B_OK;
|
||||
return fModule->shadow_changed(partition->PartitionData(), operation);
|
||||
}
|
||||
|
||||
// Repair
|
||||
status_t
|
||||
KPartitioningSystem::Repair(KPartition *partition, bool checkOnly,
|
||||
|
||||
Reference in New Issue
Block a user