diff options
author | David Zeuthen <davidz@redhat.com> | 2006-08-02 23:02:02 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2006-08-02 23:02:02 -0400 |
commit | 27f93b3320768981b01c155bd3dba18137e6c43e (patch) | |
tree | 8421a23b677bdce520b4e75f130071066a7584f5 /libhal-storage | |
parent | 9fd02f953ee4369aa6f7b141e67ae4331ba1fc58 (diff) |
add properties required by a hypothetical disk utility and some bug fixes
Don't mark device-mapper as volume.is_partition. Export new properties
storage.size, volume.partition.start and volume.partition.media_size.
Also define these in the spec.
Actually make the existing functions libhal_volume_is_partition() and
libhal_volume_get_partition_number() work. Also add a couple of new
functions libhal_drive_get_size(), libhal_volume_get_partition_start_offset()
and libhal_volume_get_partition_media_size().
Diffstat (limited to 'libhal-storage')
-rw-r--r-- | libhal-storage/libhal-storage.c | 29 | ||||
-rw-r--r-- | libhal-storage/libhal-storage.h | 3 |
2 files changed, 31 insertions, 1 deletions
diff --git a/libhal-storage/libhal-storage.c b/libhal-storage/libhal-storage.c index 6ce649d0..845e0065 100644 --- a/libhal-storage/libhal-storage.c +++ b/libhal-storage/libhal-storage.c @@ -708,6 +708,8 @@ struct LibHalDrive_s { dbus_bool_t no_partitions_hint; + dbus_uint64_t drive_size; + LibHalContext *hal_ctx; char **capabilities; @@ -760,6 +762,9 @@ struct LibHalVolume_s { dbus_uint64_t volume_size; dbus_uint64_t disc_capacity; + + dbus_uint64_t partition_start_offset; + dbus_uint64_t partition_media_size; }; const char * @@ -921,7 +926,7 @@ libhal_drive_from_udi (LibHalContext *hal_ctx, const char *udi) LIBHAL_PROP_EXTRACT_STRING ("storage.vendor", drive->vendor); LIBHAL_PROP_EXTRACT_STRING ("storage.model", drive->model); LIBHAL_PROP_EXTRACT_STRING ("storage.drive_type", drive->type_textual); - + LIBHAL_PROP_EXTRACT_UINT64 ("storage.size", drive->drive_size); LIBHAL_PROP_EXTRACT_STRING ("storage.icon.drive", drive->dedicated_icon_drive); LIBHAL_PROP_EXTRACT_STRING ("storage.icon.volume", drive->dedicated_icon_volume); @@ -1101,6 +1106,10 @@ libhal_volume_from_udi (LibHalContext *hal_ctx, const char *udi) LIBHAL_PROP_EXTRACT_BEGIN; + LIBHAL_PROP_EXTRACT_BOOL ("volume.is_partition", vol->is_partition); + LIBHAL_PROP_EXTRACT_INT ("volume.partition.number", vol->partition_number); + LIBHAL_PROP_EXTRACT_UINT64 ("volume.partition.start", vol->partition_start_offset); + LIBHAL_PROP_EXTRACT_UINT64 ("volume.partition.media_size", vol->partition_media_size); LIBHAL_PROP_EXTRACT_INT ("volume.partition.msdos_part_table_type", vol->msdos_part_table_type); LIBHAL_PROP_EXTRACT_INT ("block.minor", vol->device_minor); @@ -1360,6 +1369,12 @@ libhal_drive_uses_removable_media (LibHalDrive *drive) return drive->is_removable; } +dbus_uint64_t +libhal_drive_get_size (LibHalDrive *drive) +{ + return drive->drive_size; +} + LibHalDriveType libhal_drive_get_type (LibHalDrive *drive) { @@ -1504,6 +1519,18 @@ libhal_volume_get_partition_number (LibHalVolume *volume) return volume->partition_number; } +dbus_uint64_t +libhal_volume_get_partition_start_offset (LibHalVolume *volume) +{ + return volume->partition_start_offset; +} + +dbus_uint64_t +libhal_volume_get_partition_media_size (LibHalVolume *volume) +{ + return volume->partition_media_size; +} + const char * libhal_volume_get_label (LibHalVolume *volume) { diff --git a/libhal-storage/libhal-storage.h b/libhal-storage/libhal-storage.h index 700955a7..4228ff34 100644 --- a/libhal-storage/libhal-storage.h +++ b/libhal-storage/libhal-storage.h @@ -194,6 +194,7 @@ void libhal_drive_free (LibHalDrive *driv dbus_bool_t libhal_drive_is_hotpluggable (LibHalDrive *drive); dbus_bool_t libhal_drive_uses_removable_media (LibHalDrive *drive); +dbus_uint64_t libhal_drive_get_size (LibHalDrive *drive); dbus_bool_t libhal_drive_no_partitions_hint (LibHalDrive *drive); dbus_bool_t libhal_drive_requires_eject (LibHalDrive *drive); LibHalDriveType libhal_drive_get_type (LibHalDrive *drive); @@ -287,6 +288,8 @@ dbus_bool_t libhal_volume_is_mounted_read_only (LibHalVolume dbus_bool_t libhal_volume_is_partition (LibHalVolume *volume); dbus_bool_t libhal_volume_is_disc (LibHalVolume *volume); unsigned int libhal_volume_get_partition_number (LibHalVolume *volume); +dbus_uint64_t libhal_volume_get_partition_start_offset (LibHalVolume *volume); +dbus_uint64_t libhal_volume_get_partition_media_size (LibHalVolume *volume); const char *libhal_volume_get_label (LibHalVolume *volume); const char *libhal_volume_get_mount_point (LibHalVolume *volume); const char *libhal_volume_get_uuid (LibHalVolume *volume); |