summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/stand/libsa
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-07-19 16:12:11 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-07-19 16:12:11 +0000
commita1e6d89b0067d68adc48bbc68959c3287d104561 (patch)
tree68a5cb55cbcd6d7bedb048efc39a8f8f4733432d /sys/arch/amd64/stand/libsa
parentba4d3248f452954f0223beb7f47812a30527289d (diff)
Use DEV_BSIZE instead of 512 where appropriate. Use DL_SECTOBLK()
where appropriate. Noop for disks with 512-byte sectors. i.e. the only kind currently allowed in softraid volumes. But starts laying the groundwork to allow disks with other sector sizes. ok jsing@
Diffstat (limited to 'sys/arch/amd64/stand/libsa')
-rw-r--r--sys/arch/amd64/stand/libsa/softraid.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/arch/amd64/stand/libsa/softraid.c b/sys/arch/amd64/stand/libsa/softraid.c
index 16582514cd4..89fea751496 100644
--- a/sys/arch/amd64/stand/libsa/softraid.c
+++ b/sys/arch/amd64/stand/libsa/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.9 2015/05/29 13:54:26 krw Exp $ */
+/* $OpenBSD: softraid.c,v 1.10 2015/07/19 16:12:10 krw Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
@@ -150,7 +150,7 @@ srprobe(void)
SLIST_INIT(&sr_volumes);
SLIST_INIT(&sr_keydisks);
- md = alloc(SR_META_SIZE * 512);
+ md = alloc(SR_META_SIZE * DEV_BSIZE);
TAILQ_FOREACH(dip, &disklist, list) {
@@ -170,8 +170,9 @@ srprobe(void)
continue;
/* Read softraid metadata. */
- bzero(md, SR_META_SIZE * 512);
- off = DL_GETPOFFSET(pp) + SR_META_OFFSET;
+ bzero(md, SR_META_SIZE * DEV_BSIZE);
+ off = DL_SECTOBLK(&dip->disklabel, DL_GETPOFFSET(pp));
+ off += SR_META_OFFSET;
error = biosd_io(F_READ, &dip->bios_info, off,
SR_META_SIZE, md);
if (error)
@@ -314,7 +315,7 @@ srprobe(void)
bv->sbv_flags & BIOC_SCBOOTABLE ? "*" : "");
}
- explicit_bzero(md, SR_META_SIZE * 512);
+ explicit_bzero(md, SR_META_SIZE * DEV_BSIZE);
free(md, 0);
}