aboutsummaryrefslogtreecommitdiffstats
path: root/com32/hdt/hdt-cli-disk.c
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-04-20 19:31:13 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-04-20 19:31:13 -0700
commitea5513d344a9c53a967bdb17bbe8c098e414ba70 (patch)
tree97f8af30faf828d255032edd74075b0aaa8570ee /com32/hdt/hdt-cli-disk.c
parentc2853e856c694259d0e93509db6d99d6bd0bfc8f (diff)
downloadhdt-ea5513d344a9c53a967bdb17bbe8c098e414ba70.tar.gz
hdt-ea5513d344a9c53a967bdb17bbe8c098e414ba70.tar.xz
hdt-ea5513d344a9c53a967bdb17bbe8c098e414ba70.zip
hdt: Use IEC 60027 standard for capacity (CLI)
Impact: add hdt-util.c for generic helpers Display size of partitions in kibi, mebi, gibi ot tebibytes. There is no point in displaying the number of sectors in the CLI, a human readable size is more useful. Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/hdt/hdt-cli-disk.c')
-rw-r--r--com32/hdt/hdt-cli-disk.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c
index c71ea510..7cc40a17 100644
--- a/com32/hdt/hdt-cli-disk.c
+++ b/com32/hdt/hdt-cli-disk.c
@@ -37,9 +37,9 @@
#include "hdt-cli.h"
#include "hdt-common.h"
+#include "hdt-util.h"
static void process_br(struct driveinfo *drive_info, struct part_entry *ptab, int start);
-
/**
* show_partition_information - print information about a partition
* @ptab: part_entry describing the partition
@@ -54,12 +54,16 @@ static void process_br(struct driveinfo *drive_info, struct part_entry *ptab, in
**/
static void show_partition_information(struct part_entry *ptab, int i)
{
+ char size[8];
char *parttype;
+
+ sectors_to_size(ptab->length, size);
get_label(ptab->ostype, &parttype);
- more_printf(" %d %s %8d %8d %8d %02X %s\n",
+ more_printf(" %d %s %8d %8d %s %02X %s\n",
i, (ptab->active_flag == 0x80) ? " x " : " ",
ptab->start_lba,
- ptab->start_lba + ptab->length, ptab->length,
+ ptab->start_lba + ptab->length,
+ size,
ptab->ostype, parttype);
free(parttype);
}
@@ -141,7 +145,7 @@ void main_show_disk(int argc __unused, char **argv __unused,
continue;
}
- more_printf(" # Boot Start End Blocks Id Type\n");
+ more_printf(" # Boot Start End Size Id Type\n");
struct part_entry *ptab = (struct part_entry *)(mbr + PARTITION_TABLES_OFFSET);
process_br(d, ptab, 0);
}