summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2018-03-02 15:36:39 +0000
committervisa <visa@openbsd.org>2018-03-02 15:36:39 +0000
commitb5bd94102e975fcc33c889c7d43ed9e461d0c737 (patch)
tree9e58d62a433997477acd71bb7339558fc028ea6a
parentTweak a couple of long lines. (diff)
downloadwireguard-openbsd-b5bd94102e975fcc33c889c7d43ed9e461d0c737.tar.xz
wireguard-openbsd-b5bd94102e975fcc33c889c7d43ed9e461d0c737.zip
Fix the locating of the OpenBSD disklabel on media with 2048 byte
sectors (installXX.iso). The change to properly locate the disklabel, introduced after 6.0, assumed incorrectly 512 byte sectors. Diff from miod@
-rw-r--r--sys/arch/sgi/stand/boot/diskio.c13
-rw-r--r--sys/arch/sgi/stand/boot/version7
2 files changed, 13 insertions, 7 deletions
diff --git a/sys/arch/sgi/stand/boot/diskio.c b/sys/arch/sgi/stand/boot/diskio.c
index e145ac0417e..baac86d5c89 100644
--- a/sys/arch/sgi/stand/boot/diskio.c
+++ b/sys/arch/sgi/stand/boot/diskio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diskio.c,v 1.11 2016/10/05 11:55:45 visa Exp $ */
+/* $OpenBSD: diskio.c,v 1.12 2018/03/02 15:36:39 visa Exp $ */
/*
* Copyright (c) 2016 Miodrag Vallat.
@@ -73,7 +73,8 @@ diostrategy(void *devdata, int rw, daddr32_t bn, size_t reqcnt, void *addr,
arc_quad_t offset;
long result;
- blkoffset = (DL_GETPOFFSET(pp) + bn) * DEV_BSIZE;
+ blkoffset =
+ (DL_SECTOBLK(&sc->sc_label, DL_GETPOFFSET(pp)) + bn) * DEV_BSIZE;
offset.hi = blkoffset >> 32;
offset.lo = blkoffset;
@@ -222,14 +223,16 @@ dioopen(struct open_file *f, ...)
/*
* Assume the OpenBSD partition spans the whole device.
*/
-#ifdef DEBUG
- printf("No native disklabel found\n");
-#endif
lp->d_secsize = DEV_BSIZE;
lp->d_secpercyl = 1;
lp->d_npartitions = MAXPARTITIONS;
DL_SETPOFFSET(&lp->d_partitions[partition], native_offset);
DL_SETPSIZE(&lp->d_partitions[partition], -1ULL);
+#ifdef DEBUG
+ printf("No native disklabel found, "
+ "assuming partition %c starts at %lld\n",
+ 'a' + partition, native_offset);
+#endif
}
return 0;
diff --git a/sys/arch/sgi/stand/boot/version b/sys/arch/sgi/stand/boot/version
index 9fbbb89627d..f8c6a64f6cf 100644
--- a/sys/arch/sgi/stand/boot/version
+++ b/sys/arch/sgi/stand/boot/version
@@ -1,4 +1,4 @@
-/* $OpenBSD: version,v 1.9 2016/10/05 11:55:45 visa Exp $ */
+/* $OpenBSD: version,v 1.10 2018/03/02 15:36:39 visa Exp $ */
/* Public domain. Come on, this can hardly be considered as code. */
#if 0
@@ -38,6 +38,9 @@ No version strings up to 2012
Use the OpenBSD disklabel instead of assuming OpenBSD partition `a`
starts at the beginning of the volume header partition #0.
+1.9
+ Fix non-512 byte per sector media, broken in 1.8.
+
#endif
-static const char version[] = "1.8";
+static const char version[] = "1.9";