Skip to contentSkip to conversation

sfdisk (out_partition_header): improve F_MEGABYTE header [WAS: [PATCH 5/8] sfdisk: fix silly mbyte typo]

PATCH Applied Bernhard Voelker 3 participants 9 messages Apr 17, 2012 – Apr 23, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sfdisk (out_partition_header): improve F_MEGABYTE header [WAS: [PATCH 5/8] sfdisk: fix silly mbyte typo]

Quoted 10 lines · Karel Zak

Review

Quoted 4 lines · Bernhard

Maybe this is better?

(quoted diff) +1 -1
-	printf(_("Units = mebibytes of 1048576 bytes, blocks of 1024 bytes"
+	printf(_("Units = 1MiB, blocks of 1024*1024 bytes"

+1

From d54cd212b7ac410669ed61e75717acdb67de2fa3 Mon Sep 17 00:00:00 2001

From: Bernhard Voelker <[email protected]>
Date: Tue, 17 Apr 2012 10:37:21 +0200
Subject: [PATCH] sfdisk (out_partition_header): improve F_MEGABYTE header

---
 fdisk/sfdisk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fdisk/sfdisk.c +1 -1
index 95e5828..a2684fb 100644
@@ -929,7 +929,7 @@ out_partition_header(char *dev, int format, struct geometry G) {
 	printf(_("   Device Boot   Start       End    #blocks   Id  System\n"));
 	break;
     case F_MEGABYTE:
-	printf(_("Units = mebibytes of 1048576 bytes, blocks of 1024 bytes"
+	printf(_("Units = 1MiB, blocks of 1024*1024 bytes"
 		 ", counting from %d\n\n"), increment);
 	printf(_("   Device Boot Start   End    MiB    #blocks   Id  System\n"));
 	break;
Signature · 1 line
1.7.7
#1 lore raw

Re: [PATCH 5/8] sfdisk: fix silly mbyte typo

Quoted 7 lines · Bernhard Voelker
Quoted 5 lines · Karel Zak

fdisk/sfdisk.c out_partition_header(char *dev, int format, struct geometry G) { · line 932

Quoted 4 lines · Bernhard

Maybe this is better?

fdisk/sfdisk.c +1 -1
-	printf(_("Units = mebibytes of 1048576 bytes, blocks of 1024 bytes"
+	printf(_("Units = 1MiB, blocks of 1024*1024 bytes"

Blocks are 1024 bytes in this mode, as confirmed with:
sfdisk -uM -l /dev/sda

cheers,
Pádraig.

#2 lore raw

Re: [PATCH 5/8] sfdisk: fix silly mbyte typo

Quoted 11 lines · Pádraig Brady
Quoted 7 lines · Bernhard Voelker
Quoted 5 lines · Karel Zak

fdisk/sfdisk.c out_partition_header(char *dev, int format, struct geometry G) { · line 932

Quoted 4 lines · Bernhard

Maybe this is better?

fdisk/sfdisk.c +1 -1
-	printf(_("Units = mebibytes of 1048576 bytes, blocks of 1024 bytes"
+	printf(_("Units = 1MiB, blocks of 1024*1024 bytes"

Blocks are 1024 bytes in this mode, as confirmed with:
sfdisk -uM -l /dev/sda

I don't understand. What's wrong?

$ wc -c </dev/sda1
12582912000
$ echo '12582912000 / (1024*1024)' | bc
12000
$ ./sfdisk -uM -l /dev/sda | egrep 'sda1|MiB'
Units = 1MiB, blocks of 1024*1024 bytes, counting from 0
   Device Boot Start   End    MiB    #blocks   Id  System
/dev/sda1   *     1  12000  12000   12288000   83  Linux

Have a nice day,
Berny

#3 lore raw

Re: [PATCH 5/8] sfdisk: fix silly mbyte typo

Quoted 18 lines · Bernhard Voelker
Quoted 11 lines · Pádraig Brady
Quoted 7 lines · Bernhard Voelker
Quoted 5 lines · Karel Zak

fdisk/sfdisk.c out_partition_header(char *dev, int format, struct geometry G) { · line 932

Quoted 4 lines · Bernhard

Maybe this is better?

fdisk/sfdisk.c +1 -1
-	printf(_("Units = mebibytes of 1048576 bytes, blocks of 1024 bytes"
+	printf(_("Units = 1MiB, blocks of 1024*1024 bytes"

Blocks are 1024 bytes in this mode, as confirmed with:
sfdisk -uM -l /dev/sda

I don't understand. What's wrong?

$ wc -c </dev/sda1
12582912000
Quoted 7 lines
$ echo '12582912000 / (1024*1024)' | bc
12000
$ ./sfdisk -uM -l /dev/sda | egrep 'sda1|MiB'
Units = 1MiB, blocks of 1024*1024 bytes, counting from 0
   Device Boot Start   End    MiB    #blocks   Id  System
/dev/sda1   *     1  12000  12000   12288000   83  Linux

Well I thought the "blocks of" was referring to the blocks column, rather than the units?

$ echo $((12582912000 / 1024))
12288000

cheers,
Pádraig.

maintainer
#4 lore raw

Re: [PATCH 5/8] sfdisk: fix silly mbyte typo

Quoted 27 lines · Pádraig Brady
Quoted 18 lines · Bernhard Voelker
Quoted 11 lines · Pádraig Brady
Quoted 7 lines · Bernhard Voelker
Quoted 5 lines · Karel Zak

fdisk/sfdisk.c out_partition_header(char *dev, int format, struct geometry G) { · line 932

Quoted 4 lines · Bernhard

Maybe this is better?

fdisk/sfdisk.c +1 -1
-	printf(_("Units = mebibytes of 1048576 bytes, blocks of 1024 bytes"
+	printf(_("Units = 1MiB, blocks of 1024*1024 bytes"

Blocks are 1024 bytes in this mode, as confirmed with:
sfdisk -uM -l /dev/sda

I don't understand. What's wrong?

$ wc -c </dev/sda1
12582912000
Quoted 7 lines
$ echo '12582912000 / (1024*1024)' | bc
12000
$ ./sfdisk -uM -l /dev/sda | egrep 'sda1|MiB'
Units = 1MiB, blocks of 1024*1024 bytes, counting from 0
   Device Boot Start   End    MiB    #blocks   Id  System
/dev/sda1   *     1  12000  12000   12288000   83  Linux
Quoted 5 lines

Well I thought the "blocks of" was referring to the blocks column, rather than the units?

$ echo $((12582912000 / 1024))
12288000

yep, my +1 was about s/mebibytes/MiB/, I have overlooked the 1024*1024 math in the patch. Pádraig is right, (s)fdisk uses 1024 byte blocks in output (probably too keep things more confusing ;-)

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#5 lore raw

Re: [PATCH 5/8] sfdisk: fix silly mbyte typo

Quoted 3 lines · Karel Zak

yep, my +1 was about s/mebibytes/MiB/, I have overlooked the 1024*1024 math in the patch. Pádraig is right, (s)fdisk uses 1024 byte blocks in output

so KiB would be right?

Quoted 1 line

(probably too keep things more confusing ;-)

mission accomplished ...

Bye,
Berny

#6 lore raw

Re: [PATCH 5/8] sfdisk: fix silly mbyte typo

Quoted 7 lines · Bernhard Voelker
Quoted 3 lines · Karel Zak

yep, my +1 was about s/mebibytes/MiB/, I have overlooked the 1024*1024 math in the patch. Pádraig is right, (s)fdisk uses 1024 byte blocks in output

Quoted 9 lines

so KiB would be right?

Quoted 1 line

(probably too keep things more confusing ;-)

mission accomplished ...

Bye,
Berny

ah, that part refers to the "#blocks" column!

The problem starts with the "=" after "Units". A colon would maybe be more appropriate: then we could use the equal sign like in the following.

What do you think?

Have a nice day,
Berny

Quoted 1 line

From 1c59d9ca4d18d795de354003d0059dc593c6a99b Mon Sep 17 00:00:00 2001

From: Bernhard Voelker <[email protected]>
Date: Wed, 18 Apr 2012 08:47:29 +0200
Subject: [PATCH] sfdisk (out_partition_header): improve F_MEGABYTE header

---
 fdisk/sfdisk.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
fdisk/sfdisk.c +4 -4
index 95e5828..c14d127 100644
@@ -912,24 +912,24 @@ out_partition_header(char *dev, int format, struct geometry G) {
 		G.cylindersize ? _("cylinders") : _("sectors"));
     case F_CYLINDER:
 	if (G.cylindersize) {
-	    printf(_("Units = cylinders of %lu bytes, blocks of 1024 bytes"
+	    printf(_("Units: cylinders of %lu bytes, blocks of 1024 bytes"
 		     ", counting from %d\n\n"), G.cylindersize << 9, increment);
 	    printf(_("   Device Boot Start     End   #cyls    #blocks   Id  System\n"));
 	    break;
 	}
 	/* fall through */
     case F_SECTOR:
-	printf(_("Units = sectors of 512 bytes, counting from %d\n\n"),
+	printf(_("Units: sectors of 512 bytes, counting from %d\n\n"),
 	       increment);
 	printf(_("   Device Boot    Start       End   #sectors  Id  System\n"));
 	break;
     case F_BLOCK:
-	printf(_("Units = blocks of 1024 bytes, counting from %d\n\n"),
+	printf(_("Units: blocks of 1024 bytes, counting from %d\n\n"),
 	       increment);
 	printf(_("   Device Boot   Start       End    #blocks   Id  System\n"));
 	break;
     case F_MEGABYTE:
-	printf(_("Units = mebibytes of 1048576 bytes, blocks of 1024 bytes"
+	printf(_("Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes"
 		 ", counting from %d\n\n"), increment);
 	printf(_("   Device Boot Start   End    MiB    #blocks   Id  System\n"));
 	break;
Signature · 1 line
1.7.7
#7 lore raw

Re: [PATCH 5/8] sfdisk: fix silly mbyte typo

Quoted 65 lines · Bernhard Voelker
Quoted 7 lines · Bernhard Voelker
Quoted 3 lines · Karel Zak

yep, my +1 was about s/mebibytes/MiB/, I have overlooked the 1024*1024 math in the patch. Pádraig is right, (s)fdisk uses 1024 byte blocks in output

Quoted 9 lines

so KiB would be right?

Quoted 1 line

(probably too keep things more confusing ;-)

mission accomplished ...

Bye,
Berny

ah, that part refers to the "#blocks" column!

The problem starts with the "=" after "Units". A colon would maybe be more appropriate: then we could use the equal sign like in the following.

What do you think?

Have a nice day,
Berny

Quoted 1 line

From 1c59d9ca4d18d795de354003d0059dc593c6a99b Mon Sep 17 00:00:00 2001

From: Bernhard Voelker <[email protected]>
Date: Wed, 18 Apr 2012 08:47:29 +0200
Subject: [PATCH] sfdisk (out_partition_header): improve F_MEGABYTE header

---
 fdisk/sfdisk.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
fdisk/sfdisk.c +2 -3
index 95e5828..c14d127 100644
@@ -912,24 +912,24 @@ out_partition_header(char *dev, int format, struct geometry G) {
 		G.cylindersize ? _("cylinders") : _("sectors"));
     case F_CYLINDER:
 	if (G.cylindersize) {
-	    printf(_("Units = cylinders of %lu bytes, blocks of 1024 bytes"
+	    printf(_("Units: cylinders of %lu bytes, blocks of 1024 bytes"
 		     ", counting from %d\n\n"), G.cylindersize << 9, increment);
 	    printf(_("   Device Boot Start     End   #cyls    #blocks   Id  System\n"));
 	    break;
 	}
 	/* fall through */
     case F_SECTOR:
-	printf(_("Units = sectors of 512 bytes, counting from %d\n\n"),
+	printf(_("Units: sectors of 512 bytes, counting from %d\n\n"),
 	       increment);
 	printf(_("   Device Boot    Start       End   #sectors  Id  System\n"));
 	break;
     case F_BLOCK:
-	printf(_("Units = blocks of 1024 bytes, counting from %d\n\n"),

fdisk/sfdisk.c out_partition_header(char *dev, int format, struct geometry G) { · line 935

Quoted 10 lines
fdisk/sfdisk.c +2 -1
+	printf(_("Units: blocks of 1024 bytes, counting from %d\n\n"),
 	       increment);
 	printf(_("   Device Boot   Start       End    #blocks   Id  System\n"));
 	break;
     case F_MEGABYTE:
-	printf(_("Units = mebibytes of 1048576 bytes, blocks of 1024 bytes"
+	printf(_("Units: 1MiB = 1024*1024 bytes, blocks of 1024 bytes"
 		 ", counting from %d\n\n"), increment);
 	printf(_("   Device Boot Start   End    MiB    #blocks   Id  System\n"));
 	break;

+1

maintainer Applied
#8 lore raw

Re: [PATCH 5/8] sfdisk: fix silly mbyte typo

In reply to Bernhard Voelker
Quoted 2 lines · Bernhard Voelker
 fdisk/sfdisk.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com