diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-06-18 21:38:43 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-06-18 21:38:43 +0000 |
commit | 5cf6efc5d7baa0e482b834460a844d7b397270aa (patch) | |
tree | df0cc3d691547be58ee25330ea38ff4ccb98c981 /sys/arch/hppa | |
parent | af04f50410d5980cead976b0df3d65863d436f9c (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/arch/hppa')
-rw-r--r-- | sys/arch/hppa/hppa/disksubr.c | 29 | ||||
-rw-r--r-- | sys/arch/hppa/include/disklabel.h | 9 |
2 files changed, 10 insertions, 28 deletions
diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c index c63e2cb9f41..6767c74ca78 100644 --- a/sys/arch/hppa/hppa/disksubr.c +++ b/sys/arch/hppa/hppa/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.67 2007/06/18 07:10:29 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.68 2007/06/18 21:38:42 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/hppa/include/disklabel.h b/sys/arch/hppa/include/disklabel.h index 7432fc1d628..cecaaa7c40d 100644 --- a/sys/arch/hppa/include/disklabel.h +++ b/sys/arch/hppa/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.19 2007/06/17 15:05:08 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.20 2007/06/18 21:38:42 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_ */ |