diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 2002-01-18 08:33:11 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 2002-01-18 08:33:11 +0000 |
commit | 4abdd7d2f8cea4f749015419d3966ee70325b5ca (patch) | |
tree | 222f4e30704e6e1066e990b849b1e28d173c7b64 /sbin/fdisk/cmd.c | |
parent | ee68995a525cd46f081c7c744bdb693f23c871a1 (diff) |
Add disklabel-style editing for size/offset values in
the partition tables. These values may now contain units,
such as "300k" "500M" or "2G".
(sectors, bytes, and cylinders are also supported.)
This should largely eliminate the need for a calculator
when using fdisk on large disks.
Diffstat (limited to 'sbin/fdisk/cmd.c')
-rw-r--r-- | sbin/fdisk/cmd.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index 470b0128a98..2781adbaae9 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.28 2001/01/28 00:56:07 weingart Exp $ */ +/* $OpenBSD: cmd.c,v 1.29 2002/01/18 08:33:10 kjell Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -175,15 +175,20 @@ Xedit(cmd, disk, mbr, tt, offset) u_int m; /* Get data */ - EDIT("Partition offset", ASK_DEC, pp->bs, 0, - disk->real->size, NULL); + pp->bs = getuint(disk, "offset", + "Starting sector for this partition.", pp->bs, + disk->real->size, 0, DO_CONVERSIONS | + (pp->id == FS_BSDFFS ? DO_ROUNDING : 0)); + m = MAX(pp->ns, disk->real->size - pp->bs); if ( m > disk->real->size - pp->bs) { /* dont have default value extend beyond end of disk */ m = disk->real->size - pp->bs; } - EDIT("Partition size", ASK_DEC, pp->ns, 1, - m, NULL); + pp->ns = getuint(disk, "size", "Size of the partition.", + pp->ns, m, pp->bs , DO_CONVERSIONS | + ((pp->id == FS_BSDFFS || pp->id == FS_SWAP) ? + DO_ROUNDING : 0)); /* Fix up CHS values */ PRT_fix_CHS(disk, pp, pn); |