Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Make this work on some m68k ports which like puttin...
details: https://anonhg.NetBSD.org/src/rev/3498ab1eb676
branches: trunk
changeset: 749351:3498ab1eb676
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Nov 27 13:29:33 2009 +0000
description:
Make this work on some m68k ports which like putting the disklabel
in the third sector (or have copypasted disklabel.h from a port
which likes doing that ;).
diffstat:
sys/kern/subr_disk_mbr.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (65 lines):
diff -r 6e149fe2208c -r 3498ab1eb676 sys/kern/subr_disk_mbr.c
--- a/sys/kern/subr_disk_mbr.c Fri Nov 27 12:37:19 2009 +0000
+++ b/sys/kern/subr_disk_mbr.c Fri Nov 27 13:29:33 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_disk_mbr.c,v 1.37 2009/11/23 13:40:11 pooka Exp $ */
+/* $NetBSD: subr_disk_mbr.c,v 1.38 2009/11/27 13:29:33 pooka Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.37 2009/11/23 13:40:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk_mbr.c,v 1.38 2009/11/27 13:29:33 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -79,11 +79,13 @@
typedef struct mbr_partition mbr_partition_t;
/*
- * We allocate a buffer 2 sectors large, and look in both....
+ * We allocate a buffer 3 sectors large, and look in all....
* That means we find labels written by other ports with different offsets.
* LABELSECTOR and LABELOFFSET are only used if the disk doesn't have a label.
*/
-#if LABELSECTOR > 1 || LABELOFFSET > 512
+#define SCANBLOCKS 3
+#define DISKLABEL_SIZE 404
+#if LABELSECTOR*DEV_BSIZE + LABELOFFSET > SCANBLOCKS*DEV_BSIZE - DISKLABEL_SIZE
#error Invalid LABELSECTOR or LABELOFFSET
#endif
@@ -428,10 +430,10 @@
/*
* Get a buffer big enough to read a disklabel in and initialize it
- * make it two sectors long for the validate_label(); see comment at
+ * make it three sectors long for the validate_label(); see comment at
* start of file.
*/
- a.bp = geteblk(2 * (int)lp->d_secsize);
+ a.bp = geteblk(SCANBLOCKS * (int)lp->d_secsize);
a.bp->b_dev = dev;
if (osdep)
@@ -572,7 +574,7 @@
int error;
/* Next, dig out disk label */
- if (read_sector(a, label_sector, 2)) {
+ if (read_sector(a, label_sector, SCANBLOCKS)) {
a->msg = "disk label read failed";
return SCAN_ERROR;
}
@@ -706,7 +708,7 @@
a.strat = strat;
/* get a buffer and initialize it */
- a.bp = geteblk(2 * (int)lp->d_secsize);
+ a.bp = geteblk(SCANBLOCKS * (int)lp->d_secsize);
a.bp->b_dev = dev;
/* osdep => we expect an mbr with label in netbsd ptn */
Home |
Main Index |
Thread Index |
Old Index