summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-06-18 21:45:22 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-06-18 21:45:22 +0000
commit7f976c165a96163324cee0dc14a56cb772e5a41c (patch)
tree179d9394aedc71c70723187934bfe16a8b29f184 /sys
parent5cf6efc5d7baa0e482b834460a844d7b397270aa (diff)
Don't use cpu_disklabel as local storage. Use local variables and discard
the unneeded info when done with it. Another empty struct cpu_disklabel. ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/hppa64/hppa64/disksubr.c29
-rw-r--r--sys/arch/hppa64/include/disklabel.h9
2 files changed, 10 insertions, 28 deletions
diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c
index 351fad5bb06..93489f7e7d5 100644
--- a/sys/arch/hppa64/hppa64/disksubr.c
+++ b/sys/arch/hppa64/hppa64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.50 2007/06/18 07:10:31 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.51 2007/06/18 21:45:21 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -101,8 +101,9 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
{
struct buf *dbp = NULL;
struct lifdir *p;
+ struct lifvol *lvp;
char *msg = NULL;
- int fsoff = 0;
+ int fsoff = 0, i;
/* read LIF volume header */
bp->b_blkno = btodb(LIF_VOLSTART);
@@ -113,17 +114,15 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
if (biowait(bp))
return "LIF volume header I/O error";
- bcopy(bp->b_data, &osdep->u._hppa.lifvol, sizeof(struct lifvol));
- if (osdep->u._hppa.lifvol.vol_id != LIF_VOL_ID) {
- fsoff = 0;
+ lvp = (struct lifvol *)bp->b_data;
+ if (lvp->vol_id != LIF_VOL_ID)
goto finished;
- }
dbp = geteblk(LIF_DIRSIZE);
dbp->b_dev = bp->b_dev;
/* read LIF directory */
- dbp->b_blkno = lifstodb(osdep->u._hppa.lifvol.vol_addr);
+ dbp->b_blkno = lifstodb(lvp->vol_addr);
dbp->b_bcount = lp->d_secsize;
dbp->b_flags = B_BUSY | B_READ;
dbp->b_cylinder = dbp->b_blkno / lp->d_secpercyl;
@@ -134,13 +133,9 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
goto done;
}
- bcopy(dbp->b_data, osdep->u._hppa.lifdir, LIF_DIRSIZE);
-
/* scan for LIF_DIR_FS dir entry */
- for (fsoff = -1, p = &osdep->u._hppa.lifdir[0];
- fsoff < 0 && p < &osdep->u._hppa.lifdir[LIF_NUMDIR]; p++) {
- if (p->dir_type == LIF_DIR_FS ||
- p->dir_type == LIF_DIR_HPLBL)
+ for (i=0, p=(struct lifdir *)dbp->b_data; i < LIF_NUMDIR; p++, i++) {
+ if (p->dir_type == LIF_DIR_FS || p->dir_type == LIF_DIR_HPLBL)
break;
}
@@ -171,10 +166,7 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
goto done;
}
- bcopy(dbp->b_data, &osdep->u._hppa.hplabel,
- sizeof(osdep->u._hppa.hplabel));
-
- hl = &osdep->u._hppa.hplabel;
+ hl = (struct hpux_label *)dbp->b_data;
if (hl->hl_magic1 != hl->hl_magic2 ||
hl->hl_magic != HPUX_MAGIC || hl->hl_version != 1) {
msg = "HPUX label magic mismatch";
@@ -222,9 +214,6 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
}
finished:
- /* if no suitable lifdir entry found assume zero */
- if (fsoff < 0)
- fsoff = 0;
if (partoffp)
*partoffp = fsoff;
diff --git a/sys/arch/hppa64/include/disklabel.h b/sys/arch/hppa64/include/disklabel.h
index 6d169f67286..cce08f14a6d 100644
--- a/sys/arch/hppa64/include/disklabel.h
+++ b/sys/arch/hppa64/include/disklabel.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.h,v 1.13 2007/06/17 15:05:08 krw Exp $ */
+/* $OpenBSD: disklabel.h,v 1.14 2007/06/18 21:45:21 krw Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@@ -127,13 +127,6 @@ struct hpux_label {
#define lifstodb(s) ((s) * LIF_SECTSIZE / DEV_BSIZE)
struct cpu_disklabel {
- union {
- struct {
- struct lifvol lifvol;
- struct lifdir lifdir[LIF_NUMDIR];
- struct hpux_label hplabel;
- } _hppa;
- } u;
};
#endif /* _MACHINE_DISKLABEL_H_ */