summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-07-01 19:06:59 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-07-01 19:06:59 +0000
commit8c03cb3e1afb199716381f536c8b9539e2930e9d (patch)
treee2231e0727dbf0e5bf79a20014bfdbc1ddd9e7c2 /sys/arch/sparc
parent223a200f49c9eab32a2ca851b3539b40399a2e04 (diff)
Perform minimal disklabel setup without needing to do the disklabel_to_sun()
dance, so that we do not depend on its behaviour. No functional change.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/dev/xd.c26
-rw-r--r--sys/arch/sparc/dev/xy.c26
-rw-r--r--sys/arch/sparc/sparc/disksubr.c4
3 files changed, 26 insertions, 30 deletions
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c
index 5fbed055bd5..1010d16b291 100644
--- a/sys/arch/sparc/dev/xd.c
+++ b/sys/arch/sparc/dev/xd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xd.c,v 1.40 2007/06/24 16:52:04 miod Exp $ */
+/* $OpenBSD: xd.c,v 1.41 2007/07/01 19:06:57 miod Exp $ */
/* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */
/*
@@ -296,17 +296,16 @@ xdgetdisklabel(xd, b)
void *b;
{
struct disklabel *lp = xd->sc_dk.dk_label;
- struct sun_disklabel *sdl = b;
+ struct sun_disklabel *sl = b;
char *err;
- extern char *disklabel_sun_to_bsd(struct sun_disklabel *,
- struct disklabel *);
bzero(lp, sizeof(struct disklabel));
- if (sdl->sl_magic == SUN_DKMAGIC)
- disklabel_sun_to_bsd(sdl, lp);
- else {
- /* Required parameters for readdisklabel() */
- lp->d_secsize = XDFM_BPS;
+ /* Required parameters for readdisklabel() */
+ lp->d_secsize = XDFM_BPS;
+ if (sl->sl_magic == SUN_DKMAGIC) {
+ lp->d_secpercyl = sl->sl_nsectors * sl->sl_ntracks;
+ DL_SETDSIZE(lp, (daddr64_t)lp->d_secpercyl * sl->sl_ncylinders);
+ } else {
lp->d_secpercyl = 1;
}
@@ -321,9 +320,9 @@ xdgetdisklabel(xd, b)
}
/* Ok, we have the label; fill in `pcyl' if there's SunOS magic */
- sdl = b;
- if (sdl->sl_magic == SUN_DKMAGIC)
- xd->pcyl = sdl->sl_pcylinders;
+ sl = b;
+ if (sl->sl_magic == SUN_DKMAGIC)
+ xd->pcyl = sl->sl_pcylinders;
else {
printf("%s: WARNING: no `pcyl' in disk label.\n",
xd->sc_dev.dv_xname);
@@ -337,8 +336,7 @@ xdgetdisklabel(xd, b)
xd->acyl = lp->d_acylinders;
xd->nhead = lp->d_ntracks;
xd->nsect = lp->d_nsectors;
- xd->sectpercyl = lp->d_secpercyl = xd->nhead * xd->nsect;
- lp->d_secsize = XDFM_BPS; /* not handled by sun->bsd */
+ xd->sectpercyl = lp->d_secpercyl;
return (XD_ERR_AOK);
}
diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c
index b4bcbc204c0..00954f8d38a 100644
--- a/sys/arch/sparc/dev/xy.c
+++ b/sys/arch/sparc/dev/xy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xy.c,v 1.37 2007/06/24 16:52:04 miod Exp $ */
+/* $OpenBSD: xy.c,v 1.38 2007/07/01 19:06:57 miod Exp $ */
/* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */
/*
@@ -236,17 +236,16 @@ xygetdisklabel(xy, b)
void *b;
{
struct disklabel *lp = xy->sc_dk.dk_label;
- struct sun_disklabel *sdl = b;
+ struct sun_disklabel *sl = b;
char *err;
- extern char *disklabel_sun_to_bsd(struct sun_disklabel *,
- struct disklabel *);
bzero(lp, sizeof(struct disklabel));
- if (sdl->sl_magic == SUN_DKMAGIC)
- disklabel_sun_to_bsd(sdl, lp);
- else {
- /* Required parameters for readdisklabel() */
- lp->d_secsize = XYFM_BPS;
+ /* Required parameters for readdisklabel() */
+ lp->d_secsize = XYFM_BPS;
+ if (sl->sl_magic == SUN_DKMAGIC) {
+ lp->d_secpercyl = sl->sl_nsectors * sl->sl_ntracks;
+ DL_SETDSIZE(lp, (daddr64_t)lp->d_secpercyl * sl->sl_ncylinders);
+ } else {
lp->d_secpercyl = 1;
}
@@ -261,9 +260,9 @@ xygetdisklabel(xy, b)
}
/* Ok, we have the label; fill in `pcyl' if there's SunOS magic */
- sdl = b;
- if (sdl->sl_magic == SUN_DKMAGIC)
- xy->pcyl = sdl->sl_pcylinders;
+ sl = b;
+ if (sl->sl_magic == SUN_DKMAGIC)
+ xy->pcyl = sl->sl_pcylinders;
else {
printf("%s: WARNING: no `pcyl' in disk label.\n",
xy->sc_dev.dv_xname);
@@ -277,8 +276,7 @@ xygetdisklabel(xy, b)
xy->acyl = lp->d_acylinders;
xy->nhead = lp->d_ntracks;
xy->nsect = lp->d_nsectors;
- xy->sectpercyl = lp->d_secpercyl = xy->nhead * xy->nsect;
- lp->d_secsize = XYFM_BPS; /* not handled by sun->bsd */
+ xy->sectpercyl = lp->d_secpercyl;
return (XY_ERR_AOK);
}
diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c
index 5d639e61a1e..7587d46c810 100644
--- a/sys/arch/sparc/sparc/disksubr.c
+++ b/sys/arch/sparc/sparc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.69 2007/06/24 16:52:05 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.70 2007/07/01 19:06:58 miod Exp $ */
/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
/*
@@ -46,7 +46,7 @@
#include "cd.h"
- char *disklabel_sun_to_bsd(struct sun_disklabel *, struct disklabel *);
+static char *disklabel_sun_to_bsd(struct sun_disklabel *, struct disklabel *);
static int disklabel_bsd_to_sun(struct disklabel *, struct sun_disklabel *);
static __inline u_int sun_extended_sum(struct sun_disklabel *, void *);