From 20aa2570e81b3254e492f4ec7ccaaa4933603081 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Wed, 17 Aug 2011 13:21:12 +0200 Subject: fdisk: print a message with size and type of created partition Signed-off-by: Francesco Cosoleto --- fdisk/fdisk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'fdisk/fdisk.c') diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 038536db2..a08a4d413 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -32,6 +32,7 @@ #include "wholedisk.h" #include "pathnames.h" #include "canonicalize.h" +#include "strutils.h" #include "fdisksunlabel.h" #include "fdisksgilabel.h" @@ -614,6 +615,10 @@ set_partition(int i, int doext, unsigned long long start, p->sys_ind = sysid; set_start_sect(p, start - offset); set_nr_sects(p, stop - start + 1); + + if (!doext) + print_partition_size(i + 1, start, stop, sysid); + if (dos_compatible_flag && (start/(sectors*heads) > 1023)) start = heads*sectors*1024 - 1; set_hsc(p->head, p->sector, p->cyl, start); @@ -2319,6 +2324,14 @@ get_unused_start(int part_n, return start; } +void print_partition_size(int num, unsigned long long start, unsigned long long stop, int sysid) +{ + char *str = size_to_human_string(SIZE_SUFFIX_3LETTER | SIZE_SUFFIX_SPACE, + (stop - start + 1) * sector_size); + printf(_("Partition %d of type %s and of size %s is set\n"), num, partition_type(sysid), str); + free(str); +} + static void add_partition(int n, int sys) { char mesg[256]; /* 48 does not suffice in Japanese */ -- cgit v1.2.3-55-g7522