Browse files

disklabel32/64: Add support for 'T' size specifier.

  • Loading branch information...
1 parent dfce795 commit f61a91d2f3ef66a042f017dc669d5063333a35c6 Sascha Wildner committed Aug 3, 2012
Showing with 28 additions and 18 deletions.
  1. +13 −9 sbin/disklabel32/disklabel.c
  2. +5 −4 sbin/disklabel32/disklabel32.8
  3. +5 −4 sbin/disklabel64/disklabel64.8
  4. +5 −1 sbin/disklabel64/disklabel64.c
View
22 sbin/disklabel32/disklabel.c
@@ -1270,22 +1270,26 @@ checklabel(struct disklabel32 *lp)
case '%':
total_percent += size;
break;
- case 'k':
- case 'K':
+ case 't':
+ case 'T':
size *= 1024ULL;
- break;
- case 'm':
- case 'M':
- size *= 1024ULL * 1024ULL;
- break;
+ /* FALLTHROUGH */
case 'g':
case 'G':
- size *= 1024ULL * 1024ULL * 1024ULL;
+ size *= 1024ULL;
+ /* FALLTHROUGH */
+ case 'm':
+ case 'M':
+ size *= 1024ULL;
+ /* FALLTHROUGH */
+ case 'k':
+ case 'K':
+ size *= 1024ULL;
break;
case '\0':
break;
default:
- Warning("unknown size specifier '%c' (K/M/G are valid)",part_size_type[i]);
+ Warning("unknown size specifier '%c' (K/M/G/T are valid)",part_size_type[i]);
break;
}
/* don't count %'s yet */
View
9 sbin/disklabel32/disklabel32.8
@@ -34,9 +34,8 @@
.\"
.\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94
.\" $FreeBSD: src/sbin/disklabel/disklabel.8,v 1.15.2.22 2003/04/17 17:56:34 trhodes Exp $
-.\" $DragonFly: src/sbin/disklabel/disklabel.8,v 1.30 2008/09/16 20:45:36 thomas Exp $
.\"
-.Dd September 28, 2009
+.Dd August 3, 2012
.Dt DISKLABEL32 8
.Os
.Sh NAME
@@ -684,6 +683,8 @@ The size of the partition in sectors,
(megabytes - 1024*1024),
.Cm G
(gigabytes - 1024*1024*1024),
+.Cm T
+(gigabytes - 1024*1024*1024*1024),
.Cm %
(percentage of free space
.Em after
@@ -700,9 +701,9 @@ a size of
.Cm *
indicates the entire disk.
Lowercase versions of
-.Cm K , M ,
+.Cm K , M , G ,
and
-.Cm G
+.Cm T
are allowed.
Size and type should be specified without any spaces between them.
.Pp
View
9 sbin/disklabel64/disklabel64.8
@@ -34,9 +34,8 @@
.\"
.\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94
.\" $FreeBSD: src/sbin/disklabel/disklabel.8,v 1.15.2.22 2003/04/17 17:56:34 trhodes Exp $
-.\" $DragonFly: src/sbin/disklabel64/disklabel64.8,v 1.13 2008/09/16 20:45:36 thomas Exp $
.\"
-.Dd September 28, 2009
+.Dd August 3, 2012
.Dt DISKLABEL64 8
.Os
.Sh NAME
@@ -676,6 +675,8 @@ The size of the partition in sectors,
(megabytes - 1024*1024),
.Cm G
(gigabytes - 1024*1024*1024),
+.Cm T
+(terabytes - 1024*1024*1024*1024),
.Cm %
(percentage of free space
.Em after
@@ -685,9 +686,9 @@ removing any fixed-size partitions),
.Em after
fixed-size and percentage partitions).
Lowercase versions of
-.Cm K , M ,
+.Cm K , M , G ,
and
-.Cm G
+.Cm T
are allowed.
Size and type should be specified without any spaces between them.
.Pp
View
6 sbin/disklabel64/disklabel64.c
@@ -1112,6 +1112,10 @@ getasciipartspec(char *tp, struct disklabel64 *lp, int part,
case '*':
mpx = 0;
break;
+ case 't':
+ case 'T':
+ mpx *= 1024ULL;
+ /* fall through */
case 'g':
case 'G':
mpx *= 1024ULL;
@@ -1126,7 +1130,7 @@ getasciipartspec(char *tp, struct disklabel64 *lp, int part,
r = 0; /* eat the suffix */
break;
default:
- Warning("unknown size specifier '%c' (*/%%/K/M/G are valid)",
+ Warning("unknown size specifier '%c' (*/%%/K/M/G/T are valid)",
r);
return(1);
}

0 comments on commit f61a91d

Please sign in to comment.