* Added get_physical_partition() function, which always retrieves the
physical partition, unlike get_partition() which returns the shadow partition, if it exists. * Added B_PARTITION_SHADOW[_CHILD] partition pseudo operation values for the shadow_changed() hook, notifying a disk system, that a shadow partition has been created. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22472 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -57,6 +57,8 @@ typedef struct partitionable_space_data {
|
||||
|
||||
// operations on partitions
|
||||
enum {
|
||||
B_PARTITION_SHADOW, // indicates creation of a shadow partition
|
||||
B_PARTITION_SHADOW_CHILD, //
|
||||
B_PARTITION_DEFRAGMENT,
|
||||
B_PARTITION_REPAIR,
|
||||
B_PARTITION_RESIZE,
|
||||
@@ -95,6 +97,7 @@ int32 find_partition(const char *path);
|
||||
// disk device/partition read access
|
||||
// (read lock required)
|
||||
disk_device_data *get_disk_device(partition_id partitionID);
|
||||
partition_data *get_physical_partition(partition_id partitionID);
|
||||
partition_data *get_partition(partition_id partitionID);
|
||||
partition_data *get_parent_partition(partition_id partitionID);
|
||||
partition_data *get_child_partition(partition_id partitionID, int32 index);
|
||||
@@ -106,7 +109,7 @@ partition_data *create_child_partition(partition_id partitionID, int32 index,
|
||||
// childID is an optional input parameter -- -1 to be ignored
|
||||
bool delete_partition(partition_id partitionID);
|
||||
void partition_modified(partition_id partitionID);
|
||||
// tells the disk device manager, that the parition has been modified
|
||||
// tells the disk device manager, that the partition has been modified
|
||||
|
||||
status_t scan_partition(partition_id partitionID);
|
||||
// Service method for disks systems: Synchronously scans the partition.
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
#include "KDiskSystem.h"
|
||||
#include "KPartition.h"
|
||||
|
||||
|
||||
// debugging
|
||||
//#define DBG(x)
|
||||
#define DBG(x) x
|
||||
#define OUT dprintf
|
||||
|
||||
|
||||
// write_lock_disk_device
|
||||
disk_device_data *
|
||||
write_lock_disk_device(partition_id partitionID)
|
||||
@@ -32,6 +34,7 @@ write_lock_disk_device(partition_id partitionID)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// write_unlock_disk_device
|
||||
void
|
||||
write_unlock_disk_device(partition_id partitionID)
|
||||
@@ -47,6 +50,7 @@ write_unlock_disk_device(partition_id partitionID)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// read_lock_disk_device
|
||||
disk_device_data *
|
||||
read_lock_disk_device(partition_id partitionID)
|
||||
@@ -62,6 +66,7 @@ read_lock_disk_device(partition_id partitionID)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// read_unlock_disk_device
|
||||
void
|
||||
read_unlock_disk_device(partition_id partitionID)
|
||||
@@ -77,6 +82,7 @@ read_unlock_disk_device(partition_id partitionID)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// find_disk_device
|
||||
int32
|
||||
find_disk_device(const char *path)
|
||||
@@ -90,6 +96,7 @@ find_disk_device(const char *path)
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
// find_partition
|
||||
int32
|
||||
find_partition(const char *path)
|
||||
@@ -103,6 +110,7 @@ find_partition(const char *path)
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
// get_disk_device
|
||||
disk_device_data *
|
||||
get_disk_device(partition_id partitionID)
|
||||
@@ -112,15 +120,27 @@ get_disk_device(partition_id partitionID)
|
||||
return (device ? device->DeviceData() : NULL);
|
||||
}
|
||||
|
||||
|
||||
// get_physical_partition
|
||||
partition_data*
|
||||
get_physical_partition(partition_id partitionID)
|
||||
{
|
||||
KDiskDeviceManager* manager = KDiskDeviceManager::Default();
|
||||
KPartition* partition = manager->FindPartition(partitionID, true);
|
||||
return (partition ? partition->PartitionData() : NULL);
|
||||
}
|
||||
|
||||
|
||||
// get_partition
|
||||
partition_data *
|
||||
get_partition(partition_id partitionID)
|
||||
{
|
||||
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||
KPartition *partition = manager->FindPartition(partitionID);
|
||||
KPartition *partition = manager->FindPartition(partitionID, false);
|
||||
return (partition ? partition->PartitionData() : NULL);
|
||||
}
|
||||
|
||||
|
||||
// get_parent_partition
|
||||
partition_data *
|
||||
get_parent_partition(partition_id partitionID)
|
||||
@@ -132,6 +152,7 @@ get_parent_partition(partition_id partitionID)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// get_child_partition
|
||||
partition_data *
|
||||
get_child_partition(partition_id partitionID, int32 index)
|
||||
@@ -144,6 +165,21 @@ get_child_partition(partition_id partitionID, int32 index)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// compare_partition_data_offset
|
||||
static int
|
||||
compare_partition_data_offset(const void* _a, const void* _b)
|
||||
{
|
||||
const partition_data* a = *(const partition_data**)_a;
|
||||
const partition_data* b = *(const partition_data**)_b;
|
||||
|
||||
if (a->offset == b->offset)
|
||||
return 0;
|
||||
|
||||
return a->offset < b->offset ? -1 : 1;
|
||||
}
|
||||
|
||||
|
||||
// create_child_partition
|
||||
partition_data *
|
||||
create_child_partition(partition_id partitionID, int32 index,
|
||||
@@ -162,6 +198,7 @@ DBG(OUT(" partition %ld not found\n", partitionID));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// delete_partition
|
||||
bool
|
||||
delete_partition(partition_id partitionID)
|
||||
@@ -174,6 +211,7 @@ delete_partition(partition_id partitionID)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// partition_modified
|
||||
void
|
||||
partition_modified(partition_id partitionID)
|
||||
@@ -210,6 +248,7 @@ find_disk_system(const char *name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// update_disk_device_job_progress
|
||||
bool
|
||||
update_disk_device_job_progress(disk_job_id jobID, float progress)
|
||||
@@ -224,6 +263,7 @@ update_disk_device_job_progress(disk_job_id jobID, float progress)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// update_disk_device_job_extra_progress
|
||||
bool
|
||||
update_disk_device_job_extra_progress(disk_job_id jobID, const char *info)
|
||||
@@ -238,6 +278,7 @@ update_disk_device_job_extra_progress(disk_job_id jobID, const char *info)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// set_disk_device_job_error_message
|
||||
bool
|
||||
set_disk_device_job_error_message(disk_job_id jobID, const char *message)
|
||||
@@ -252,6 +293,7 @@ set_disk_device_job_error_message(disk_job_id jobID, const char *message)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// update_disk_device_job_interrupt_properties
|
||||
uint32
|
||||
update_disk_device_job_interrupt_properties(disk_job_id jobID,
|
||||
|
||||
Reference in New Issue
Block a user