summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/disksubr.c49
-rw-r--r--sys/arch/alpha/include/disklabel.h6
-rw-r--r--sys/arch/amd64/amd64/disksubr.c38
-rw-r--r--sys/arch/amd64/include/disklabel.h6
-rw-r--r--sys/arch/hppa/hppa/disksubr.c49
-rw-r--r--sys/arch/hppa/include/disklabel.h6
-rw-r--r--sys/arch/i386/i386/disksubr.c38
-rw-r--r--sys/arch/i386/include/disklabel.h6
-rw-r--r--sys/arch/macppc/include/disklabel.h7
-rw-r--r--sys/arch/macppc/macppc/disksubr.c38
10 files changed, 10 insertions, 233 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c
index d9f12456d95..956a3c6a3be 100644
--- a/sys/arch/alpha/alpha/disksubr.c
+++ b/sys/arch/alpha/alpha/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.53 2006/09/16 14:56:11 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.54 2006/10/04 00:52:55 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -220,7 +220,6 @@ readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly)
int spoofonly;
{
struct dos_partition *dp = osdep->u._i386.dosparts, *dp2;
- struct dkbad *db, *bdp = &DKBAD(osdep);
char *msg = NULL, *cp;
int dospartoff, cyl, i, ourpart = -1;
dev_t dev;
@@ -389,53 +388,7 @@ donot:
/* next, dig out disk label */
msg = readbsdlabel(bp, strat, cyl, dospartoff + I386_LABELSECTOR, -1,
lp, spoofonly);
- if (msg)
- return (msg);
-
- /* obtain bad sector table if requested and present */
- if (bdp && (lp->d_flags & D_BADSECT)) {
- /*
- * get a new buffer and initialize it as callers trust the
- * buffer given to us, to point at the disklabel sector.
- */
- dev = bp->b_dev;
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
- i = 0;
- do {
- /* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
- bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
- if (lp->d_secsize > DEV_BSIZE)
- bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
- else
- bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
- bp->b_bcount = lp->d_secsize;
- bp->b_cylinder = lp->d_ncylinders - 1;
- (*strat)(bp);
-
- /* if successful, validate, otherwise try another */
- if (biowait(bp))
- msg = "bad sector table I/O error";
- else {
- db = (struct dkbad *)(bp->b_data);
-#define DKBAD_MAGIC 0x4321
- if (db->bt_mbz == 0 &&
- db->bt_flag == DKBAD_MAGIC) {
- msg = NULL;
- *bdp = *db;
- break;
- } else
- msg = "bad sector table corrupted";
- }
- } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
- i < lp->d_nsectors);
-
- /* Give back the bad block buffer. */
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
return (msg);
}
#endif
diff --git a/sys/arch/alpha/include/disklabel.h b/sys/arch/alpha/include/disklabel.h
index d0d2763be8e..a78d7d69cef 100644
--- a/sys/arch/alpha/include/disklabel.h
+++ b/sys/arch/alpha/include/disklabel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.h,v 1.15 2006/07/09 21:00:17 krw Exp $ */
+/* $OpenBSD: disklabel.h,v 1.16 2006/10/04 00:52:55 krw Exp $ */
/* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */
/*
@@ -86,7 +86,6 @@ struct dos_partition {
#define DPSECT(s) ((s) & 0x3f)
#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2))
-#include <sys/dkbad.h>
struct cpu_disklabel {
int labelsector;
union {
@@ -94,11 +93,8 @@ struct cpu_disklabel {
} _alpha;
struct {
struct dos_partition dosparts[NDOSPART];
- struct dkbad bad;
} _i386;
} u;
};
-#define DKBAD(x) ((x)->u._i386.bad)
-
#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c
index a7a3e77ad73..ff9c477ba7c 100644
--- a/sys/arch/amd64/amd64/disksubr.c
+++ b/sys/arch/amd64/amd64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.14 2006/09/16 14:56:11 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.15 2006/10/04 00:52:55 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -69,7 +69,6 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
int spoofonly;
{
struct dos_partition *dp = osdep->dosparts, *dp2;
- struct dkbad *bdp = &DKBAD(osdep);
struct buf *bp = NULL;
struct disklabel *dlp;
char *msg = NULL, *cp;
@@ -281,41 +280,6 @@ donot:
goto done;
}
- /* obtain bad sector table if requested and present */
- if (bdp && (lp->d_flags & D_BADSECT)) {
- struct dkbad *db;
-
- i = 0;
- do {
- /* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
- bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
- if (lp->d_secsize > DEV_BSIZE)
- bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
- else
- bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
- bp->b_bcount = lp->d_secsize;
- bp->b_cylinder = lp->d_ncylinders - 1;
- (*strat)(bp);
-
- /* if successful, validate, otherwise try another */
- if (biowait(bp)) {
- msg = "bad sector table I/O error";
- } else {
- db = (struct dkbad *)(bp->b_data);
-#define DKBAD_MAGIC 0x4321
- if (db->bt_mbz == 0
- && db->bt_flag == DKBAD_MAGIC) {
- msg = NULL;
- *bdp = *db;
- break;
- } else
- msg = "bad sector table corrupted";
- }
- } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
- i < lp->d_nsectors);
- }
-
done:
if (bp) {
bp->b_flags |= B_INVAL;
diff --git a/sys/arch/amd64/include/disklabel.h b/sys/arch/amd64/include/disklabel.h
index f325b8048a6..a326912037d 100644
--- a/sys/arch/amd64/include/disklabel.h
+++ b/sys/arch/amd64/include/disklabel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.h,v 1.4 2006/07/01 16:50:32 krw Exp $ */
+/* $OpenBSD: disklabel.h,v 1.5 2006/10/04 00:52:55 krw Exp $ */
/* $NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp $ */
/*
@@ -84,14 +84,10 @@ struct dos_mbr {
#define DOSMBR_SIGNATURE (0xaa55)
#define DOSMBR_SIGNATURE_OFF (0x1fe)
-#include <sys/dkbad.h>
struct cpu_disklabel {
struct dos_partition dosparts[NDOSPART];
- struct dkbad bad;
};
-#define DKBAD(x) ((x)->bad)
-
/* Isolate the relevant bits to get sector and cylinder. */
#define DPSECT(s) ((s) & 0x3f)
#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2))
diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c
index 1ef84730264..6dda9bf1166 100644
--- a/sys/arch/hppa/hppa/disksubr.c
+++ b/sys/arch/hppa/hppa/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.33 2006/09/16 14:56:11 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.34 2006/10/04 00:52:55 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -223,7 +223,6 @@ readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly)
int spoofonly;
{
struct dos_partition *dp = osdep->u._i386.dosparts, *dp2;
- struct dkbad *db, *bdp = &DKBAD(osdep);
char *msg = NULL, *cp;
int dospartoff, cyl, i, ourpart = -1;
dev_t dev;
@@ -392,53 +391,7 @@ donot:
/* next, dig out disk label */
msg = readbsdlabel(bp, strat, cyl, dospartoff + I386_LABELSECTOR, -1,
lp, spoofonly);
- if (msg)
- return (msg);
- /* obtain bad sector table if requested and present */
- if (bdp && (lp->d_flags & D_BADSECT)) {
- /*
- * get a new buffer and initialize it as callers trust the
- * buffer given to us, to point at the disklabel sector.
- */
- dev = bp->b_dev;
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- i = 0;
- do {
- /* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
- bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
- if (lp->d_secsize > DEV_BSIZE)
- bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
- else
- bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
- bp->b_bcount = lp->d_secsize;
- bp->b_cylinder = lp->d_ncylinders - 1;
- (*strat)(bp);
-
- /* if successful, validate, otherwise try another */
- if (biowait(bp))
- msg = "bad sector table I/O error";
- else {
- db = (struct dkbad *)(bp->b_data);
-#define DKBAD_MAGIC 0x4321
- if (db->bt_mbz == 0 &&
- db->bt_flag == DKBAD_MAGIC) {
- msg = NULL;
- *bdp = *db;
- break;
- } else
- msg = "bad sector table corrupted";
- }
- } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
- i < lp->d_nsectors);
-
- /* Give back the bad block buffer. */
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
return (msg);
}
#endif
diff --git a/sys/arch/hppa/include/disklabel.h b/sys/arch/hppa/include/disklabel.h
index 8f9f32a2c68..c5652c1c816 100644
--- a/sys/arch/hppa/include/disklabel.h
+++ b/sys/arch/hppa/include/disklabel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.h,v 1.12 2006/07/07 23:47:37 krw Exp $ */
+/* $OpenBSD: disklabel.h,v 1.13 2006/10/04 00:52:55 krw Exp $ */
/* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */
/*
@@ -175,13 +175,11 @@ struct hpux_label {
#define lifstob(s) ((s) * LIF_SECTSIZE)
#define lifstodb(s) ((s) * LIF_SECTSIZE / DEV_BSIZE)
-#include <sys/dkbad.h>
struct cpu_disklabel {
int labelsector;
union {
struct {
struct dos_partition dosparts[NDOSPART];
- struct dkbad bad;
} _i386;
struct {
struct lifvol lifvol;
@@ -191,6 +189,4 @@ struct cpu_disklabel {
} u;
};
-#define DKBAD(x) ((x)->u._i386.bad)
-
#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c
index 4808c305d72..6de37cead8d 100644
--- a/sys/arch/i386/i386/disksubr.c
+++ b/sys/arch/i386/i386/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.56 2006/09/19 11:06:33 jsg Exp $ */
+/* $OpenBSD: disksubr.c,v 1.57 2006/10/04 00:52:55 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -65,7 +65,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
struct cpu_disklabel *osdep, int spoofonly)
{
struct dos_partition *dp = osdep->dosparts, *dp2;
- struct dkbad *bdp = &DKBAD(osdep);
struct buf *bp = NULL;
struct disklabel *dlp;
char *msg = NULL, *cp;
@@ -277,41 +276,6 @@ donot:
goto done;
}
- /* obtain bad sector table if requested and present */
- if (bdp && (lp->d_flags & D_BADSECT)) {
- struct dkbad *db;
-
- i = 0;
- do {
- /* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
- bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
- if (lp->d_secsize > DEV_BSIZE)
- bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
- else
- bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
- bp->b_bcount = lp->d_secsize;
- bp->b_cylinder = lp->d_ncylinders - 1;
- (*strat)(bp);
-
- /* if successful, validate, otherwise try another */
- if (biowait(bp)) {
- msg = "bad sector table I/O error";
- } else {
- db = (struct dkbad *)(bp->b_data);
-#define DKBAD_MAGIC 0x4321
- if (db->bt_mbz == 0
- && db->bt_flag == DKBAD_MAGIC) {
- msg = NULL;
- *bdp = *db;
- break;
- } else
- msg = "bad sector table corrupted";
- }
- } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
- i < lp->d_nsectors);
- }
-
done:
if (bp) {
bp->b_flags |= B_INVAL;
diff --git a/sys/arch/i386/include/disklabel.h b/sys/arch/i386/include/disklabel.h
index 7510dde1d35..63f38be5bf6 100644
--- a/sys/arch/i386/include/disklabel.h
+++ b/sys/arch/i386/include/disklabel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.h,v 1.28 2006/07/01 16:50:33 krw Exp $ */
+/* $OpenBSD: disklabel.h,v 1.29 2006/10/04 00:52:55 krw Exp $ */
/* $NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp $ */
/*
@@ -84,14 +84,10 @@ struct dos_mbr {
#define DOSMBR_SIGNATURE (0xaa55)
#define DOSMBR_SIGNATURE_OFF (0x1fe)
-#include <sys/dkbad.h>
struct cpu_disklabel {
struct dos_partition dosparts[NDOSPART];
- struct dkbad bad;
};
-#define DKBAD(x) ((x)->bad)
-
/* Isolate the relevant bits to get sector and cylinder. */
#define DPSECT(s) ((s) & 0x3f)
#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2))
diff --git a/sys/arch/macppc/include/disklabel.h b/sys/arch/macppc/include/disklabel.h
index c6b3e749b29..eae1308c265 100644
--- a/sys/arch/macppc/include/disklabel.h
+++ b/sys/arch/macppc/include/disklabel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.h,v 1.7 2006/07/01 16:50:33 krw Exp $ */
+/* $OpenBSD: disklabel.h,v 1.8 2006/10/04 00:52:55 krw Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@@ -78,8 +78,6 @@ struct dos_partition {
#define DOSPTYP_OPENBSD 0xa6 /* OpenBSD partition type */
#define DOSPTYP_NETBSD 0xa9 /* NetBSD partition type */
-#include <sys/dkbad.h>
-
/* Isolate the relevant bits to get sector and cylinder. */
#define DPSECT(s) ((s) & 0x3f)
#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2))
@@ -139,9 +137,6 @@ struct cpu_disklabel {
struct dos_partition dosparts[NDOSPART];
/* only store first entry and openbsd partition */
struct part_map_entry macparts[2];
- struct dkbad bad;
};
-#define DKBAD(x) ((x)->bad)
-
#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c
index 35195b5e07b..cbdd5b90af4 100644
--- a/sys/arch/macppc/macppc/disksubr.c
+++ b/sys/arch/macppc/macppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.22 2006/09/16 14:56:11 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.23 2006/10/04 00:52:55 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -68,7 +68,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly)
{
struct dos_partition *dp = osdep->dosparts, *dp2;
- struct dkbad *bdp = &DKBAD(osdep);
struct buf *bp;
struct disklabel *dlp;
char *msg = NULL, *cp;
@@ -370,41 +369,6 @@ found_disklabel:
goto done;
}
- /* obtain bad sector table if requested and present */
- if (bdp && (lp->d_flags & D_BADSECT)) {
- struct dkbad *db;
-
- i = 0;
- do {
- /* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
- bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
- if (lp->d_secsize > DEV_BSIZE)
- bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
- else
- bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
- bp->b_bcount = lp->d_secsize;
- bp->b_cylinder = lp->d_ncylinders - 1;
- (*strat)(bp);
-
- /* if successful, validate, otherwise try another */
- if (biowait(bp)) {
- msg = "bad sector table I/O error";
- } else {
- db = (struct dkbad *)(bp->b_data);
-#define DKBAD_MAGIC 0x4321
- if (db->bt_mbz == 0
- && db->bt_flag == DKBAD_MAGIC) {
- msg = NULL;
- *bdp = *db;
- break;
- } else
- msg = "bad sector table corrupted";
- }
- } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
- i < lp->d_nsectors);
- }
-
done:
bp->b_flags |= B_INVAL;
brelse(bp);