diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-07-09 17:07:36 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-07-09 17:07:36 +0000 |
commit | 27c996996e42e404ae86faf02f437527fad373e6 (patch) | |
tree | b6921cbb7a493eafe2712f10953c12bd56281602 /sbin | |
parent | d9b97f36c90ff553adb7ccf214e5daa40b2b6769 (diff) |
I want some of what kjell was smoking 10 years ago when he added
units handling by copying getuint() from disklabel. MBR partition id
and disklabel partition type are different beasts. So deciding to
round off a MBR partition with id FS_BSDFFS meant rounding off
NTFS partitions. And FS_SWAP partitions meant DOS FAT 12. So just
nuke rounding off for now to simplify getuint().
ok beck@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/fdisk/cmd.c | 9 | ||||
-rw-r--r-- | sbin/fdisk/misc.c | 25 | ||||
-rw-r--r-- | sbin/fdisk/misc.h | 3 |
3 files changed, 5 insertions, 32 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index ac772e4281e..dc7e30e9d0c 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.55 2012/07/09 16:45:34 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.56 2012/07/09 17:07:35 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -199,8 +199,7 @@ Xedit(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) do { pp->bs = getuint(disk, "offset", "Starting sector for this partition.", d, - disk->real->size, 0, DO_CONVERSIONS | - (pp->id == FS_BSDFFS ? DO_ROUNDING : 0)); + disk->real->size, 0, DO_CONVERSIONS); if (pp->bs == UINT_MAX) printf("Invalid offset.\n"); } while (pp->bs == UINT_MAX); @@ -213,9 +212,7 @@ Xedit(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) d = pp->ns; do { pp->ns = getuint(disk, "size", "Size of the partition.", - d, m, pp->bs , DO_CONVERSIONS | - ((pp->id == FS_BSDFFS || pp->id == FS_SWAP) ? - DO_ROUNDING : 0)); + d, m, pp->bs, DO_CONVERSIONS); if (pp->ns == UINT_MAX || pp->ns == 0) printf("Invalid size.\n"); } while (pp->ns == UINT_MAX || pp->ns == 0); diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c index 6a02eefd7d5..1563e3e0e4b 100644 --- a/sbin/fdisk/misc.c +++ b/sbin/fdisk/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.26 2012/07/09 12:45:30 krw Exp $ */ +/* $OpenBSD: misc.c,v 1.27 2012/07/09 17:07:35 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -328,29 +328,6 @@ getuint(disk_t *disk, char *prompt, char *helpstring, u_int32_t oval, } } } - if ((flags & DO_ROUNDING) && rval < UINT_MAX) { -#ifndef CYLCHECK - /* Round to nearest cylinder unless given in sectors */ - if (mult != 1) -#endif - { - u_int32_t cyls; - - /* If we round up past the end, round down instead */ - cyls = (u_int32_t)((rval / (double)secpercyl) - + 0.5); - if (cyls != 0 && secpercyl != 0) { - if ((cyls * secpercyl) - offset > maxval) - cyls--; - - if (rval != (cyls * secpercyl) - offset) { - rval = (cyls * secpercyl) - offset; - printf("Rounding to nearest cylinder: %u\n", - rval); - } - } - } - } return(rval); } diff --git a/sbin/fdisk/misc.h b/sbin/fdisk/misc.h index 9564f2abc1d..45a02215100 100644 --- a/sbin/fdisk/misc.h +++ b/sbin/fdisk/misc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.h,v 1.14 2012/07/08 18:29:28 krw Exp $ */ +/* $OpenBSD: misc.h,v 1.15 2012/07/09 17:07:35 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -47,7 +47,6 @@ extern struct unit_type unit_types[]; #define ASK_DEC 0x02 #define UNIT_TYPE_DEFAULT 1 #define DO_CONVERSIONS 0x00000001 -#define DO_ROUNDING 0x00000002 /* Prototypes */ int unit_lookup(char *); |