diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2021-12-01 22:37:31 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2021-12-01 22:37:31 +0000 |
commit | c59c7303bbb93cf9f628081618744f46ff2476f6 (patch) | |
tree | 39f9b4ca4bd0fe143252e4b06ef3b61b4f60f2ca /sbin | |
parent | f9d60f1e0c4d0ff8e7b0a1fb0a35d2b57a16bf1c (diff) |
Remove the MBR_init() "#ifdef defined(__macppc__) ||
defined(__mips__)" chunk that rounded the start of the default
OpenBSD partition to a cylinder boundary. The value has been
immediately re-rounded to a power of 2 block since r1.25 in 2009.
Eliminates wasted space when no /usr/mdec/mbr partition
0 information is available.
'-b' becomes available to architectures other than amd64 and
i386, taking precedence over /usr/mdec/mbr partition 0
information. The latter being present only in macppc and loongson
/usr/mdec/mbr files.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/fdisk/mbr.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c index 67b2eda71df..ac911074f5c 100644 --- a/sbin/fdisk/mbr.c +++ b/sbin/fdisk/mbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.c,v 1.111 2021/11/25 15:40:26 krw Exp $ */ +/* $OpenBSD: mbr.c,v 1.112 2021/12/01 22:37:30 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -63,8 +63,12 @@ MBR_init(struct mbr *mbr) memset(&bootprt, 0, sizeof(bootprt)); disksz = disk.dk_cylinders * spc; /* Use only complete cylinders. */ - memcpy(&dp, &default_dmbr.dmbr_parts[0], sizeof(dp)); - PRT_parse(&dp, 0, 0, &bootprt); + if (disk.dk_bootprt.prt_ns > 0) { + bootprt = disk.dk_bootprt; + } else { + memcpy(&dp, &default_dmbr.dmbr_parts[0], sizeof(dp)); + PRT_parse(&dp, 0, 0, &bootprt); + } if (bootprt.prt_ns > 0) obsdprt.prt_bs = bootprt.prt_bs + bootprt.prt_ns; @@ -73,17 +77,6 @@ MBR_init(struct mbr *mbr) else obsdprt.prt_bs = 1; -#if defined(__powerpc__) || defined(__mips__) - /* Now fix up for the MS-DOS boot partition on PowerPC/MIPS. */ - if (obsdprt.prt_bs % spc != 0) - obsdprt.prt_bs += spc - (obsdprt.prt_bs % spc); -#else - if (disk.dk_bootprt.prt_ns > 0) { - bootprt = disk.dk_bootprt; - obsdprt.prt_bs = bootprt.prt_bs + bootprt.prt_ns; - } -#endif - /* Start OpenBSD MBR partition on a power of 2 block number. */ daddr = 1; while (daddr < DL_SECTOBLK(&dl, obsdprt.prt_bs)) |