summaryrefslogtreecommitdiffstats
path: root/fdisk/fdisk.c
diff options
context:
space:
mode:
authorFrancesco Cosoleto2011-08-17 13:21:12 +0200
committerKarel Zak2011-08-30 10:53:22 +0200
commit20aa2570e81b3254e492f4ec7ccaaa4933603081 (patch)
treedb988db96d812b535c9c097d6afdb8faa333a905 /fdisk/fdisk.c
parentbuild-sys: don't install ru/ddate.1 if ddate disabled (diff)
downloadkernel-qcow2-util-linux-20aa2570e81b3254e492f4ec7ccaaa4933603081.tar.gz
kernel-qcow2-util-linux-20aa2570e81b3254e492f4ec7ccaaa4933603081.tar.xz
kernel-qcow2-util-linux-20aa2570e81b3254e492f4ec7ccaaa4933603081.zip
fdisk: print a message with size and type of created partition
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r--fdisk/fdisk.c13
1 files changed, 13 insertions, 0 deletions
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 */