Implemented _kern_get_partitionable_spaces(). Got rid of user_partitionable_space_data.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4031 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3ee6c178d5
commit
71a5281923
@ -4,6 +4,7 @@
|
||||
#define _DISK_DEVICE_MANAGER_USERLAND_INTERFACE_H
|
||||
|
||||
#include <DiskDeviceDefs.h>
|
||||
#include <disk_device_manager.h>
|
||||
#include <OS.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -41,12 +42,6 @@ struct user_disk_device_data {
|
||||
user_partition_data device_partition_data;
|
||||
};
|
||||
|
||||
// userland partitionable space representation
|
||||
struct user_partitionable_space_data {
|
||||
off_t offset;
|
||||
off_t size;
|
||||
};
|
||||
|
||||
// userland partitionable space representation
|
||||
struct user_disk_system_info {
|
||||
disk_system_id id;
|
||||
@ -77,11 +72,6 @@ status_t _kern_get_partition_data(partition_id partitionID, bool shadow,
|
||||
user_partition_data *buffer,
|
||||
size_t bufferSize, size_t *neededSize);
|
||||
// Dangerous?!
|
||||
status_t _kern_get_partitionable_spaces(partition_id partitionID, bool shadow,
|
||||
user_partitionable_space_data *buffer,
|
||||
size_t bufferSize, size_t *neededSize);
|
||||
// Pass the partition change counter? If GetPartitionInfo() is only
|
||||
// allowed, when the device is locked, then we wouldn't need it.
|
||||
|
||||
partition_id _kern_register_file_device(const char *filename);
|
||||
status_t _kern_unregister_file_device(partition_id deviceID,
|
||||
@ -138,6 +128,9 @@ status_t _kern_validate_create_child_partition(partition_id partitionID,
|
||||
off_t *offset, off_t *size,
|
||||
const char *type,
|
||||
const char *parameters);
|
||||
status_t _kern_get_partitionable_spaces(partition_id partitionID,
|
||||
partitionable_space_data *buffer,
|
||||
int32 count, int32 *actualCount);
|
||||
status_t _kern_get_next_supported_partition_type(partition_id partitionID,
|
||||
int32 *cookie, char *type);
|
||||
status_t _kern_get_partition_type_for_content_type(disk_system_id diskSystemID,
|
||||
|
@ -189,6 +189,33 @@ _kern_get_disk_device_data(partition_id id, bool deviceOnly, bool shadow,
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
// _kern_get_partitionable_spaces
|
||||
status_t
|
||||
_kern_get_partitionable_spaces(partition_id partitionID,
|
||||
partitionable_space_data *buffer,
|
||||
int32 count, int32 *actualCount)
|
||||
{
|
||||
if (!buffer && count > 0)
|
||||
return B_BAD_VALUE;
|
||||
// get the partition
|
||||
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
|
||||
KPartition *partition = manager->ReadLockPartition(partitionID);
|
||||
if (!partition)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
PartitionRegistrar registrar1(partition, true);
|
||||
PartitionRegistrar registrar2(partition->Device(), true);
|
||||
DeviceReadLocker locker(partition->Device(), true);
|
||||
if (!check_shadow_partition(partition))
|
||||
return B_BAD_VALUE;
|
||||
// get the disk system
|
||||
KDiskSystem *diskSystem = partition->DiskSystem();
|
||||
if (!diskSystem)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
// get the info
|
||||
return diskSystem->GetPartitionableSpaces(partition, buffer, count,
|
||||
actualCount);
|
||||
}
|
||||
|
||||
// _kern_register_file_device
|
||||
partition_id
|
||||
_kern_register_file_device(const char *filename)
|
||||
|
Loading…
Reference in New Issue
Block a user