* [PATCH 1/5] fdisk: print a message with size and type of created partition
@ 2011-08-16 22:19 Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 2/5] fdisk: print partition deleted message Francesco Cosoleto
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Francesco Cosoleto @ 2011-08-16 22:19 UTC (permalink / raw)
To: util-linux; +Cc: Francesco Cosoleto
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
---
fdisk/Makefile.am | 2 +-
fdisk/fdisk.c | 13 +++++++++++++
fdisk/fdisk.h | 1 +
fdisk/fdisksgilabel.c | 8 +++++++-
fdisk/fdisksunlabel.c | 4 ++++
5 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/fdisk/Makefile.am b/fdisk/Makefile.am
index 7cad805..4409db5 100644
--- a/fdisk/Makefile.am
+++ b/fdisk/Makefile.am
@@ -4,7 +4,7 @@ EXTRA_DIST = README.fdisk README.cfdisk sfdisk.examples partitiontype.c
fdisk_common = i386_sys_types.c common.h gpt.c gpt.h \
$(top_srcdir)/lib/blkdev.c $(top_srcdir)/lib/wholedisk.c \
- $(top_srcdir)/lib/mbsalign.c
+ $(top_srcdir)/lib/mbsalign.c $(top_srcdir)/lib/strutils.c
if LINUX
fdisk_common += $(top_srcdir)/lib/linux_version.c
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 038536d..a08a4d4 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 */
diff --git a/fdisk/fdisk.h b/fdisk/fdisk.h
index 9b7f4c7..e289043 100644
--- a/fdisk/fdisk.h
+++ b/fdisk/fdisk.h
@@ -75,6 +75,7 @@ extern struct partition *get_part_table(int);
extern int valid_part_table_flag(unsigned char *b);
extern unsigned int read_int(unsigned int low, unsigned int dflt,
unsigned int high, unsigned int base, char *mesg);
+extern void print_partition_size(int num, unsigned long long start, unsigned long long stop, int sysid);
extern unsigned char *MBRbuffer;
extern void zeroize_mbr_buffer(void);
diff --git a/fdisk/fdisksgilabel.c b/fdisk/fdisksgilabel.c
index 8179bc1..20ed92d 100644
--- a/fdisk/fdisksgilabel.c
+++ b/fdisk/fdisksgilabel.c
@@ -570,6 +570,7 @@ sgi_set_partition(int i, unsigned int start, unsigned int length, int sys) {
set_changed(i);
if (sgi_gaps() < 0) /* rebuild freelist */
printf(_("Do You know, You got a partition overlap on the disk?\n"));
+ print_partition_size(i + 1, start, start + length, sys);
}
static void
@@ -733,7 +734,6 @@ create_sgilabel(void)
old[i].sysid = get_part_table(i)->sys_ind;
old[i].start = get_start_sect(get_part_table(i));
old[i].nsect = get_nr_sects(get_part_table(i));
- printf(_("Trying to keep parameters of partition %d.\n"), i);
if (debug)
printf(_("ID=%02x\tSTART=%d\tLENGTH=%d\n"),
old[i].sysid, old[i].start, old[i].nsect);
@@ -741,6 +741,12 @@ create_sgilabel(void)
}
}
+ for (i = 0; i < 4; i++)
+ if (old[i].sysid) {
+ printf(_("Trying to keep parameters of partitions already set.\n"));
+ break;
+ }
+
zeroize_mbr_buffer();
sgilabel->magic = SSWAP32(SGI_LABEL_MAGIC);
sgilabel->boot_part = SSWAP16(0);
diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c
index 9335e75..7d3aa09 100644
--- a/fdisk/fdisksunlabel.c
+++ b/fdisk/fdisksunlabel.c
@@ -106,6 +106,7 @@ static void set_sun_partition(int i, uint32_t start, uint32_t stop, uint16_t sys
sunlabel->partitions[i].num_sectors =
SSWAP32(stop - start);
set_changed(i);
+ print_partition_size(i + 1, start, stop, sysid);
}
void sun_nolabel(void)
@@ -250,6 +251,9 @@ void create_sunlabel(void)
} else
ndiv = cylinders * 2 / 3;
+ /* Make sure print_partition_size() uses correct sysid names */
+ disklabel = SUN_LABEL;
+
set_sun_partition(0, 0, ndiv * heads * sectors,
SUN_TAG_LINUX_NATIVE);
set_sun_partition(1, ndiv * heads * sectors,
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] fdisk: print partition deleted message
2011-08-16 22:19 [PATCH 1/5] fdisk: print a message with size and type of created partition Francesco Cosoleto
@ 2011-08-16 22:19 ` Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 3/5] fdisk: print welcome message Francesco Cosoleto
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Francesco Cosoleto @ 2011-08-16 22:19 UTC (permalink / raw)
To: util-linux; +Cc: Francesco Cosoleto
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
---
fdisk/fdisk.c | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index a08a4d4..d3fc200 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -1676,27 +1676,18 @@ delete_partition(int i) {
return; /* C/H/S not set */
pe->changed = 1;
- if (disklabel == SUN_LABEL) {
+ if (disklabel == SUN_LABEL)
sun_delete_partition(i);
- return;
- }
-
- if (disklabel == SGI_LABEL) {
+ else if (disklabel == SGI_LABEL)
sgi_delete_partition(i);
- return;
- }
-
- if (i < 4) {
+ else if (i < 4) {
if (IS_EXTENDED (p->sys_ind) && i == ext_index) {
partitions = 4;
ptes[ext_index].ext_pointer = NULL;
extended_offset = 0;
}
clear_partition(p);
- return;
- }
-
- if (!q->sys_ind && i > 4) {
+ } else if (!q->sys_ind && i > 4) {
/* the last one in the chain - just delete */
--partitions;
--i;
@@ -1733,6 +1724,7 @@ delete_partition(int i) {
/* the only logical: clear only */
clear_partition(ptes[i].part_table);
}
+ printf(_("Partition %d is deleted\n"), i + 1);
}
static void
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] fdisk: print welcome message
2011-08-16 22:19 [PATCH 1/5] fdisk: print a message with size and type of created partition Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 2/5] fdisk: print partition deleted message Francesco Cosoleto
@ 2011-08-16 22:19 ` Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 4/5] tests: add ts_fdisk_clean function to make fdisk output comparable Francesco Cosoleto
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Francesco Cosoleto @ 2011-08-16 22:19 UTC (permalink / raw)
To: util-linux; +Cc: Francesco Cosoleto
This adds a welcome message with util-linux version number, information
about fdisk behaviour that doesn't write to disk after a command (unlike
gparted) and a warning about possible data loss.
The message appears just before the first command prompt.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
---
fdisk/fdisk.c | 10 +++++-----
fdisk/fdisksgilabel.c | 4 +---
fdisk/fdisksunlabel.c | 4 +---
3 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index d3fc200..1c1f492 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -932,11 +932,7 @@ static void
create_doslabel(void) {
unsigned int id = get_random_id();
- fprintf(stderr,
- _("Building a new DOS disklabel with disk identifier 0x%08x.\n"
- "Changes will remain in memory only, until you decide to write them.\n"
- "After that, of course, the previous content won't be recoverable.\n\n"),
- id);
+ fprintf(stderr, _("Building a new DOS disklabel with disk identifier 0x%08x.\n"), id);
sun_nolabel(); /* otherwise always recognised as sun */
sgi_nolabel(); /* otherwise always recognised as sgi */
disklabel = DOS_LABEL;
@@ -3093,6 +3089,10 @@ main(int argc, char **argv) {
disklabel = DOS_LABEL;
}
+ fprintf(stderr, _("Welcome to fdisk (%s).\n\n"
+ "Changes will remain in memory only, until you decide to write them.\n"
+ "Be careful before using the write command.\n"), PACKAGE_STRING);
+
while (1) {
putchar('\n');
c = tolower(read_char(_("Command (m for help): ")));
diff --git a/fdisk/fdisksgilabel.c b/fdisk/fdisksgilabel.c
index 20ed92d..c553abc 100644
--- a/fdisk/fdisksgilabel.c
+++ b/fdisk/fdisksgilabel.c
@@ -697,9 +697,7 @@ create_sgilabel(void)
sec_fac = sector_size / 512; /* determine the sector factor */
fprintf(stderr,
- _("Building a new SGI disklabel. Changes will remain in memory only,\n"
- "until you decide to write them. After that, of course, the previous\n"
- "content will be unrecoverably lost.\n\n"));
+ _("Building a new SGI disklabel.\n"));
other_endian = (BYTE_ORDER == LITTLE_ENDIAN);
diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c
index 7d3aa09..80408dd 100644
--- a/fdisk/fdisksunlabel.c
+++ b/fdisk/fdisksunlabel.c
@@ -189,9 +189,7 @@ void create_sunlabel(void)
int res;
fprintf(stderr,
- _("Building a new sun disklabel. Changes will remain in memory only,\n"
- "until you decide to write them. After that, of course, the previous\n"
- "content won't be recoverable.\n\n"));
+ _("Building a new Sun disklabel.\n"));
#if BYTE_ORDER == LITTLE_ENDIAN
other_endian = 1;
#else
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] tests: add ts_fdisk_clean function to make fdisk output comparable
2011-08-16 22:19 [PATCH 1/5] fdisk: print a message with size and type of created partition Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 2/5] fdisk: print partition deleted message Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 3/5] fdisk: print welcome message Francesco Cosoleto
@ 2011-08-16 22:19 ` Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 5/5] tests: update fdisk and blkid MD tests Francesco Cosoleto
2011-08-17 11:21 ` [PATCH] fdisk: print a message with size and type of created partition Francesco Cosoleto
4 siblings, 0 replies; 7+ messages in thread
From: Francesco Cosoleto @ 2011-08-16 22:19 UTC (permalink / raw)
To: util-linux; +Cc: Francesco Cosoleto
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
---
tests/functions.sh | 7 +++++++
tests/ts/blkid/md-raid0-whole | 5 ++---
tests/ts/blkid/md-raid1-part | 6 ++----
tests/ts/blkid/md-raid1-whole | 5 ++---
tests/ts/fdisk/align-512-4K | 5 +----
tests/ts/fdisk/align-512-4K-63 | 5 +----
tests/ts/fdisk/align-512-4K-md | 5 +----
tests/ts/fdisk/align-512-512 | 4 +---
tests/ts/fdisk/align-512-512-topology | 5 +----
9 files changed, 18 insertions(+), 29 deletions(-)
diff --git a/tests/functions.sh b/tests/functions.sh
index 70bd45a..acfbbee 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -393,3 +393,10 @@ s/# <!-- util-linux.*-->//;
/^$/d" /etc/fstab
}
+function ts_fdisk_clean {
+ # remove non comparable parts of fdisk output
+ [ x"${DEVNAME}" != x"" ] && sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT
+ sed -i -e 's/Disk identifier:.*//g' \
+ -e 's/Building a new.*//g' \
+ $TS_OUTPUT
+}
diff --git a/tests/ts/blkid/md-raid0-whole b/tests/ts/blkid/md-raid0-whole
index 2ef7bcd..7a55c54 100755
--- a/tests/ts/blkid/md-raid0-whole
+++ b/tests/ts/blkid/md-raid0-whole
@@ -78,9 +78,8 @@ ts_log "Deinitialize devices"
ts_device_deinit $DEVICE1
ts_device_deinit $DEVICE2
-# remove disk ID and generated UUIDs
-sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT
-sed -i -e 's/Building a new.*//g' $TS_OUTPUT
+ts_fdisk_clean
+# remove generated UUIDs
sed -i -e 's/ID_FS_UUID.*//g' $TS_OUTPUT
ts_finalize
diff --git a/tests/ts/blkid/md-raid1-part b/tests/ts/blkid/md-raid1-part
index c990824..c6245c2 100755
--- a/tests/ts/blkid/md-raid1-part
+++ b/tests/ts/blkid/md-raid1-part
@@ -82,10 +82,8 @@ $TS_CMD_BLKID -p -o udev ${DEVICE}2 2>&1 | sort >> $TS_OUTPUT
sleep 3
rmmod scsi_debug
-# remove device name used, disk ID and generated UUIDs
-sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT
-sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT
-sed -i -e 's/Building a new.*//g' $TS_OUTPUT
+ts_fdisk_clean
+# remove generated UUIDs
sed -i -e 's/ID_FS_UUID.*//g' $TS_OUTPUT
ts_finalize
diff --git a/tests/ts/blkid/md-raid1-whole b/tests/ts/blkid/md-raid1-whole
index 75efc42..32e17b8 100755
--- a/tests/ts/blkid/md-raid1-whole
+++ b/tests/ts/blkid/md-raid1-whole
@@ -78,9 +78,8 @@ ts_log "Deinitialize devices"
ts_device_deinit $DEVICE1
ts_device_deinit $DEVICE2
-# remove disk ID and generated UUIDs
-sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT
-sed -i -e 's/Building a new.*//g' $TS_OUTPUT
+ts_fdisk_clean
+# remove generated UUIDs
sed -i -e 's/ID_FS_UUID.*//g' $TS_OUTPUT
ts_finalize
diff --git a/tests/ts/fdisk/align-512-4K b/tests/ts/fdisk/align-512-4K
index cf3bbc0..2885079 100755
--- a/tests/ts/fdisk/align-512-4K
+++ b/tests/ts/fdisk/align-512-4K
@@ -82,9 +82,6 @@ cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTP
sleep 3
rmmod scsi_debug
-# remove device name used and disk ID
-sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT
-sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT
-sed -i -e 's/Building a new.*//g' $TS_OUTPUT
+ts_fdisk_clean
ts_finalize
diff --git a/tests/ts/fdisk/align-512-4K-63 b/tests/ts/fdisk/align-512-4K-63
index cd44ce4..cb8b1a2 100755
--- a/tests/ts/fdisk/align-512-4K-63
+++ b/tests/ts/fdisk/align-512-4K-63
@@ -82,9 +82,6 @@ cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTP
sleep 3
rmmod scsi_debug
-# remove device name used and disk ID
-sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT
-sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT
-sed -i -e 's/Building a new.*//g' $TS_OUTPUT
+ts_fdisk_clean
ts_finalize
diff --git a/tests/ts/fdisk/align-512-4K-md b/tests/ts/fdisk/align-512-4K-md
index ba0f0c8..2aff08c 100755
--- a/tests/ts/fdisk/align-512-4K-md
+++ b/tests/ts/fdisk/align-512-4K-md
@@ -94,9 +94,6 @@ sleep 3
/sbin/mdadm -q -S ${MD_DEVICE} >> $TS_OUTPUT 2>&1
rmmod scsi_debug
-# remove device name used and disk ID
-sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT
-sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT
-sed -i -e 's/Building a new.*//g' $TS_OUTPUT
+ts_fdisk_clean
ts_finalize
diff --git a/tests/ts/fdisk/align-512-512 b/tests/ts/fdisk/align-512-512
index f60f404..82a6268 100755
--- a/tests/ts/fdisk/align-512-512
+++ b/tests/ts/fdisk/align-512-512
@@ -65,8 +65,6 @@ EOF
ts_device_deinit $DEVICE
-# remove disk ID
-sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT
-sed -i -e 's/Building a new.*//g' $TS_OUTPUT
+ts_fdisk_clean
ts_finalize
diff --git a/tests/ts/fdisk/align-512-512-topology b/tests/ts/fdisk/align-512-512-topology
index 4563765..95065dc 100755
--- a/tests/ts/fdisk/align-512-512-topology
+++ b/tests/ts/fdisk/align-512-512-topology
@@ -82,9 +82,6 @@ cat /sys/block/${DEVNAME}/${DEVNAME}{1,2,3,4,5,6,7}/alignment_offset >> $TS_OUTP
sleep 3
rmmod scsi_debug
-# remove device name used and disk ID
-sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT
-sed -i -e 's/Disk identifier:.*//g' $TS_OUTPUT
-sed -i -e 's/Building a new.*//g' $TS_OUTPUT
+ts_fdisk_clean
ts_finalize
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] tests: update fdisk and blkid MD tests
2011-08-16 22:19 [PATCH 1/5] fdisk: print a message with size and type of created partition Francesco Cosoleto
` (2 preceding siblings ...)
2011-08-16 22:19 ` [PATCH 4/5] tests: add ts_fdisk_clean function to make fdisk output comparable Francesco Cosoleto
@ 2011-08-16 22:19 ` Francesco Cosoleto
2011-08-17 11:21 ` [PATCH] fdisk: print a message with size and type of created partition Francesco Cosoleto
4 siblings, 0 replies; 7+ messages in thread
From: Francesco Cosoleto @ 2011-08-16 22:19 UTC (permalink / raw)
To: util-linux; +Cc: Francesco Cosoleto
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
---
tests/expected/blkid/md-raid0-whole | 11 +++++++----
tests/expected/blkid/md-raid1-part | 11 +++++++----
tests/expected/blkid/md-raid1-whole | 13 ++++++++-----
tests/expected/fdisk/align-512-4K | 24 ++++++++++++++++--------
tests/expected/fdisk/align-512-4K-63 | 24 ++++++++++++++++--------
tests/expected/fdisk/align-512-4K-md | 24 +++++++++++++++---------
tests/expected/fdisk/align-512-512 | 24 ++++++++++++++++--------
tests/expected/fdisk/align-512-512-topology | 24 ++++++++++++++++--------
tests/functions.sh | 1 +
9 files changed, 102 insertions(+), 54 deletions(-)
diff --git a/tests/expected/blkid/md-raid0-whole b/tests/expected/blkid/md-raid0-whole
index 54e4012..83fc54e 100644
--- a/tests/expected/blkid/md-raid0-whole
+++ b/tests/expected/blkid/md-raid0-whole
@@ -3,21 +3,24 @@ Create RAID device
Create partitions on RAID device
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-Changes will remain in memory only, until you decide to write them.
-After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): First sector (2048-204543, default 2048): Using default value 2048
-Last sector, +sectors or +size{K,M,G} (2048-204543, default 204543):
+Last sector, +sectors or +size{K,M,G} (2048-204543, default 204543): Partition 1 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): Partition number (1-4, default 2): First sector (22528-204543, default 22528): Using default value 22528
Last sector, +sectors or +size{K,M,G} (22528-204543, default 204543): Using default value 204543
+Partition 2 of type Linux and of size 88.9 MiB is set
Command (m for help):
Disk /dev/md8: 104 MB, 104726528 bytes
diff --git a/tests/expected/blkid/md-raid1-part b/tests/expected/blkid/md-raid1-part
index 659f896..df595b8 100644
--- a/tests/expected/blkid/md-raid1-part
+++ b/tests/expected/blkid/md-raid1-part
@@ -1,21 +1,24 @@
Create partitions
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-Changes will remain in memory only, until you decide to write them.
-After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): First sector (2048-104447, default 2048): Using default value 2048
-Last sector, +sectors or +size{K,M,G} (2048-104447, default 104447):
+Last sector, +sectors or +size{K,M,G} (2048-104447, default 104447): Partition 1 of type Linux and of size 25 MiB is set
+
Command (m for help): Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): Partition number (1-4, default 2): First sector (53248-104447, default 53248): Using default value 53248
Last sector, +sectors or +size{K,M,G} (53248-104447, default 104447): Using default value 104447
+Partition 2 of type Linux and of size 25 MiB is set
Command (m for help):
Disk /dev/...: 53 MB, 53477376 bytes
diff --git a/tests/expected/blkid/md-raid1-whole b/tests/expected/blkid/md-raid1-whole
index cbdbb7b..2536a5c 100644
--- a/tests/expected/blkid/md-raid1-whole
+++ b/tests/expected/blkid/md-raid1-whole
@@ -3,21 +3,24 @@ Create RAID device
Create partitions on RAID device
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-Changes will remain in memory only, until you decide to write them.
-After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): First sector (2048-102271, default 2048): Using default value 2048
-Last sector, +sectors or +size{K,M,G} (2048-102271, default 102271):
+Last sector, +sectors or +size{K,M,G} (2048-102271, default 102271): Partition 1 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): Partition number (1-4, default 2): First sector (22528-102271, default 22528): Using default value 22528
-Last sector, +sectors or +size{K,M,G} (22528-102271, default 102271):
+Last sector, +sectors or +size{K,M,G} (22528-102271, default 102271): Partition 2 of type Linux and of size 10 MiB is set
+
Command (m for help):
Disk /dev/md8: 52 MB, 52363264 bytes
2 heads, 4 sectors/track, 12784 cylinders, total 102272 sectors
diff --git a/tests/expected/fdisk/align-512-4K b/tests/expected/fdisk/align-512-4K
index ed1e03b..615d609 100644
--- a/tests/expected/fdisk/align-512-4K
+++ b/tests/expected/fdisk/align-512-4K
@@ -1,49 +1,57 @@
Create partitions
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-Changes will remain in memory only, until you decide to write them.
-After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): First sector (2048-102399, default 2048): Using default value 2048
-Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399): Partition 1 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): Partition number (1-4, default 2): First sector (22528-102399, default 22528): Using default value 22528
-Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399): Partition 2 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): Partition number (1-4, default 3): First sector (43008-102399, default 43008): Using default value 43008
-Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399): Partition 3 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): Selected partition 4
First sector (63488-102399, default 63488): Using default value 63488
Last sector, +sectors or +size{K,M,G} (63488-102399, default 102399): Using default value 102399
+Partition 4 of type Extended and of size 19 MiB is set
Command (m for help): All primary partitions are in use
Adding logical partition 5
First sector (65536-102399, default 65536): Using default value 65536
-Last sector, +sectors or +size{K,M,G} (65536-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (65536-102399, default 102399): Partition 5 of type Linux and of size 5 MiB is set
+
Command (m for help): All primary partitions are in use
Adding logical partition 6
First sector (77824-102399, default 77824): Using default value 77824
-Last sector, +sectors or +size{K,M,G} (77824-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (77824-102399, default 102399): Partition 6 of type Linux and of size 5 MiB is set
+
Command (m for help): All primary partitions are in use
Adding logical partition 7
First sector (90112-102399, default 90112): Using default value 90112
Last sector, +sectors or +size{K,M,G} (90112-102399, default 102399): Using default value 102399
+Partition 7 of type Linux and of size 6 MiB is set
Command (m for help):
Disk /dev/...: 52 MB, 52428800 bytes
diff --git a/tests/expected/fdisk/align-512-4K-63 b/tests/expected/fdisk/align-512-4K-63
index 261f54c..63cef9c 100644
--- a/tests/expected/fdisk/align-512-4K-63
+++ b/tests/expected/fdisk/align-512-4K-63
@@ -1,49 +1,57 @@
Create partitions
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-Changes will remain in memory only, until you decide to write them.
-After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): First sector (7-102399, default 7): Using default value 7
-Last sector, +sectors or +size{K,M,G} (7-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (7-102399, default 102399): Partition 1 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): Partition number (1-4, default 2): First sector (20487-102399, default 20487): Using default value 20487
-Last sector, +sectors or +size{K,M,G} (20487-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (20487-102399, default 102399): Partition 2 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): Partition number (1-4, default 3): First sector (40967-102399, default 40967): Using default value 40967
-Last sector, +sectors or +size{K,M,G} (40967-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (40967-102399, default 102399): Partition 3 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): Selected partition 4
First sector (61447-102399, default 61447): Using default value 61447
Last sector, +sectors or +size{K,M,G} (61447-102399, default 102399): Using default value 102399
+Partition 4 of type Extended and of size 20 MiB is set
Command (m for help): All primary partitions are in use
Adding logical partition 5
First sector (61454-102399, default 63487): Using default value 63487
-Last sector, +sectors or +size{K,M,G} (63487-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (63487-102399, default 102399): Partition 5 of type Linux and of size 5 MiB is set
+
Command (m for help): All primary partitions are in use
Adding logical partition 6
First sector (61454-102399, default 75775): Using default value 75775
-Last sector, +sectors or +size{K,M,G} (75775-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (75775-102399, default 102399): Partition 6 of type Linux and of size 5 MiB is set
+
Command (m for help): All primary partitions are in use
Adding logical partition 7
First sector (61454-102399, default 88063): Using default value 88063
Last sector, +sectors or +size{K,M,G} (88063-102399, default 102399): Using default value 102399
+Partition 7 of type Linux and of size 7 MiB is set
Command (m for help):
Disk /dev/...: 52 MB, 52428800 bytes
diff --git a/tests/expected/fdisk/align-512-4K-md b/tests/expected/fdisk/align-512-4K-md
index 7de6d2e..3a0e7d5 100644
--- a/tests/expected/fdisk/align-512-4K-md
+++ b/tests/expected/fdisk/align-512-4K-md
@@ -1,25 +1,28 @@
Create partitions
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-Changes will remain in memory only, until you decide to write them.
-After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): First sector (2048-102399, default 2048): Using default value 2048
-Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399): Partition 1 of type Linux and of size 20 MiB is set
+
Command (m for help): Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): Partition number (1-4, default 2): First sector (43008-102399, default 43008): Using default value 43008
Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399): Using default value 102399
+Partition 2 of type Linux and of size 29 MiB is set
Command (m for help):
Disk /dev/...: 52 MB, 52428800 bytes
@@ -43,25 +46,28 @@ Alignment offsets:
Create partitions (MD)
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-Changes will remain in memory only, until you decide to write them.
-After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): First sector (2048-100095, default 2048): Using default value 2048
-Last sector, +sectors or +size{K,M,G} (2048-100095, default 100095):
+Last sector, +sectors or +size{K,M,G} (2048-100095, default 100095): Partition 1 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): Partition number (1-4, default 2): First sector (22528-100095, default 22528): Using default value 22528
-Last sector, +sectors or +size{K,M,G} (22528-100095, default 100095):
+Last sector, +sectors or +size{K,M,G} (22528-100095, default 100095): Partition 2 of type Linux and of size 10 MiB is set
+
Command (m for help):
Disk /dev/md8: 51 MB, 51249152 bytes
2 heads, 4 sectors/track, 12512 cylinders, total 100096 sectors
diff --git a/tests/expected/fdisk/align-512-512 b/tests/expected/fdisk/align-512-512
index 13931d4..7f1cdb9 100644
--- a/tests/expected/fdisk/align-512-512
+++ b/tests/expected/fdisk/align-512-512
@@ -1,45 +1,53 @@
Create partitions
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-Changes will remain in memory only, until you decide to write them.
-After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): First sector (2048-102399, default 2048): Using default value 2048
-Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399): Partition 1 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): Partition number (1-4, default 2): First sector (22528-102399, default 22528): Using default value 22528
-Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399): Partition 2 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): Partition number (1-4, default 3): First sector (43008-102399, default 43008): Using default value 43008
-Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399): Partition 3 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): Selected partition 4
First sector (63488-102399, default 63488): Using default value 63488
Last sector, +sectors or +size{K,M,G} (63488-102399, default 102399): Using default value 102399
+Partition 4 of type Extended and of size 19 MiB is set
Command (m for help): All primary partitions are in use
Adding logical partition 5
First sector (65536-102399, default 65536): Using default value 65536
-Last sector, +sectors or +size{K,M,G} (65536-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (65536-102399, default 102399): Partition 5 of type Linux and of size 5 MiB is set
+
Command (m for help): All primary partitions are in use
Adding logical partition 6
First sector (77824-102399, default 77824): Using default value 77824
-Last sector, +sectors or +size{K,M,G} (77824-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (77824-102399, default 102399): Partition 6 of type Linux and of size 5 MiB is set
+
Command (m for help): All primary partitions are in use
Adding logical partition 7
First sector (90112-102399, default 90112): Using default value 90112
Last sector, +sectors or +size{K,M,G} (90112-102399, default 102399): Using default value 102399
+Partition 7 of type Linux and of size 6 MiB is set
Command (m for help):
Disk /dev/loop0: 52 MB, 52428800 bytes
diff --git a/tests/expected/fdisk/align-512-512-topology b/tests/expected/fdisk/align-512-512-topology
index af86955..3623f0b 100644
--- a/tests/expected/fdisk/align-512-512-topology
+++ b/tests/expected/fdisk/align-512-512-topology
@@ -1,45 +1,53 @@
Create partitions
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-Changes will remain in memory only, until you decide to write them.
-After that, of course, the previous content won't be recoverable.
-
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
+
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): First sector (2048-102399, default 2048): Using default value 2048
-Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (2048-102399, default 102399): Partition 1 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): Partition number (1-4, default 2): First sector (22528-102399, default 22528): Using default value 22528
-Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (22528-102399, default 102399): Partition 2 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): Partition number (1-4, default 3): First sector (43008-102399, default 43008): Using default value 43008
-Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (43008-102399, default 102399): Partition 3 of type Linux and of size 10 MiB is set
+
Command (m for help): Partition type:
p primary (3 primary, 0 extended, 1 free)
e extended
Select (default e): Selected partition 4
First sector (63488-102399, default 63488): Using default value 63488
Last sector, +sectors or +size{K,M,G} (63488-102399, default 102399): Using default value 102399
+Partition 4 of type Extended and of size 19 MiB is set
Command (m for help): All primary partitions are in use
Adding logical partition 5
First sector (65536-102399, default 65536): Using default value 65536
-Last sector, +sectors or +size{K,M,G} (65536-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (65536-102399, default 102399): Partition 5 of type Linux and of size 5 MiB is set
+
Command (m for help): All primary partitions are in use
Adding logical partition 6
First sector (77824-102399, default 77824): Using default value 77824
-Last sector, +sectors or +size{K,M,G} (77824-102399, default 102399):
+Last sector, +sectors or +size{K,M,G} (77824-102399, default 102399): Partition 6 of type Linux and of size 5 MiB is set
+
Command (m for help): All primary partitions are in use
Adding logical partition 7
First sector (90112-102399, default 90112): Using default value 90112
Last sector, +sectors or +size{K,M,G} (90112-102399, default 102399): Using default value 102399
+Partition 7 of type Linux and of size 6 MiB is set
Command (m for help):
Disk /dev/...: 52 MB, 52428800 bytes
diff --git a/tests/functions.sh b/tests/functions.sh
index acfbbee..71ff7da 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -398,5 +398,6 @@ function ts_fdisk_clean {
[ x"${DEVNAME}" != x"" ] && sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT
sed -i -e 's/Disk identifier:.*//g' \
-e 's/Building a new.*//g' \
+ -e 's/Welcome to fdisk.*//g' \
$TS_OUTPUT
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] fdisk: print a message with size and type of created partition
2011-08-16 22:19 [PATCH 1/5] fdisk: print a message with size and type of created partition Francesco Cosoleto
` (3 preceding siblings ...)
2011-08-16 22:19 ` [PATCH 5/5] tests: update fdisk and blkid MD tests Francesco Cosoleto
@ 2011-08-17 11:21 ` Francesco Cosoleto
2011-08-30 9:00 ` Karel Zak
4 siblings, 1 reply; 7+ messages in thread
From: Francesco Cosoleto @ 2011-08-17 11:21 UTC (permalink / raw)
To: util-linux; +Cc: Francesco Cosoleto
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
---
fdisk/Makefile.am | 2 +-
fdisk/fdisk.c | 13 +++++++++++++
fdisk/fdisk.h | 1 +
fdisk/fdisksgilabel.c | 9 ++++++++-
fdisk/fdisksunlabel.c | 4 ++++
5 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/fdisk/Makefile.am b/fdisk/Makefile.am
index 7cad805..4409db5 100644
--- a/fdisk/Makefile.am
+++ b/fdisk/Makefile.am
@@ -4,7 +4,7 @@ EXTRA_DIST = README.fdisk README.cfdisk sfdisk.examples partitiontype.c
fdisk_common = i386_sys_types.c common.h gpt.c gpt.h \
$(top_srcdir)/lib/blkdev.c $(top_srcdir)/lib/wholedisk.c \
- $(top_srcdir)/lib/mbsalign.c
+ $(top_srcdir)/lib/mbsalign.c $(top_srcdir)/lib/strutils.c
if LINUX
fdisk_common += $(top_srcdir)/lib/linux_version.c
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 038536d..a08a4d4 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 */
diff --git a/fdisk/fdisk.h b/fdisk/fdisk.h
index 9b7f4c7..e289043 100644
--- a/fdisk/fdisk.h
+++ b/fdisk/fdisk.h
@@ -75,6 +75,7 @@ extern struct partition *get_part_table(int);
extern int valid_part_table_flag(unsigned char *b);
extern unsigned int read_int(unsigned int low, unsigned int dflt,
unsigned int high, unsigned int base, char *mesg);
+extern void print_partition_size(int num, unsigned long long start, unsigned long long stop, int sysid);
extern unsigned char *MBRbuffer;
extern void zeroize_mbr_buffer(void);
diff --git a/fdisk/fdisksgilabel.c b/fdisk/fdisksgilabel.c
index 8179bc1..3595909 100644
--- a/fdisk/fdisksgilabel.c
+++ b/fdisk/fdisksgilabel.c
@@ -570,6 +570,8 @@ sgi_set_partition(int i, unsigned int start, unsigned int length, int sys) {
set_changed(i);
if (sgi_gaps() < 0) /* rebuild freelist */
printf(_("Do You know, You got a partition overlap on the disk?\n"));
+ if (length)
+ print_partition_size(i + 1, start, start + length, sys);
}
static void
@@ -733,7 +735,6 @@ create_sgilabel(void)
old[i].sysid = get_part_table(i)->sys_ind;
old[i].start = get_start_sect(get_part_table(i));
old[i].nsect = get_nr_sects(get_part_table(i));
- printf(_("Trying to keep parameters of partition %d.\n"), i);
if (debug)
printf(_("ID=%02x\tSTART=%d\tLENGTH=%d\n"),
old[i].sysid, old[i].start, old[i].nsect);
@@ -741,6 +742,12 @@ create_sgilabel(void)
}
}
+ for (i = 0; i < 4; i++)
+ if (old[i].sysid) {
+ printf(_("Trying to keep parameters of partitions already set.\n"));
+ break;
+ }
+
zeroize_mbr_buffer();
sgilabel->magic = SSWAP32(SGI_LABEL_MAGIC);
sgilabel->boot_part = SSWAP16(0);
diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c
index 9335e75..7d3aa09 100644
--- a/fdisk/fdisksunlabel.c
+++ b/fdisk/fdisksunlabel.c
@@ -106,6 +106,7 @@ static void set_sun_partition(int i, uint32_t start, uint32_t stop, uint16_t sys
sunlabel->partitions[i].num_sectors =
SSWAP32(stop - start);
set_changed(i);
+ print_partition_size(i + 1, start, stop, sysid);
}
void sun_nolabel(void)
@@ -250,6 +251,9 @@ void create_sunlabel(void)
} else
ndiv = cylinders * 2 / 3;
+ /* Make sure print_partition_size() uses correct sysid names */
+ disklabel = SUN_LABEL;
+
set_sun_partition(0, 0, ndiv * heads * sectors,
SUN_TAG_LINUX_NATIVE);
set_sun_partition(1, ndiv * heads * sectors,
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] fdisk: print a message with size and type of created partition
2011-08-17 11:21 ` [PATCH] fdisk: print a message with size and type of created partition Francesco Cosoleto
@ 2011-08-30 9:00 ` Karel Zak
0 siblings, 0 replies; 7+ messages in thread
From: Karel Zak @ 2011-08-30 9:00 UTC (permalink / raw)
To: Francesco Cosoleto; +Cc: util-linux
On Wed, Aug 17, 2011 at 01:21:12PM +0200, Francesco Cosoleto wrote:
> fdisk/Makefile.am | 2 +-
> fdisk/fdisk.c | 13 +++++++++++++
> fdisk/fdisk.h | 1 +
> fdisk/fdisksgilabel.c | 9 ++++++++-
> fdisk/fdisksunlabel.c | 4 ++++
> 5 files changed, 27 insertions(+), 2 deletions(-)
Applied (all 5 patches), thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-08-30 9:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-16 22:19 [PATCH 1/5] fdisk: print a message with size and type of created partition Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 2/5] fdisk: print partition deleted message Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 3/5] fdisk: print welcome message Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 4/5] tests: add ts_fdisk_clean function to make fdisk output comparable Francesco Cosoleto
2011-08-16 22:19 ` [PATCH 5/5] tests: update fdisk and blkid MD tests Francesco Cosoleto
2011-08-17 11:21 ` [PATCH] fdisk: print a message with size and type of created partition Francesco Cosoleto
2011-08-30 9:00 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox