From f62d7fa89725ed83a25a6da0112a4fd720c34cd0 Mon Sep 17 00:00:00 2001 From: miod Date: Wed, 14 Jan 2015 21:13:46 +0000 Subject: [PATCH] Make the special buffer used for the few sector I/O at attach time a per-softc member, rather than a global. No functional change. --- sys/arch/sparc/dev/xd.c | 11 ++++++----- sys/arch/sparc/dev/xdvar.h | 3 ++- sys/arch/sparc/dev/xy.c | 11 ++++++----- sys/arch/sparc/dev/xyvar.h | 3 ++- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c index ee58b1691cf..36f05375f69 100644 --- a/sys/arch/sparc/dev/xd.c +++ b/sys/arch/sparc/dev/xd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xd.c,v 1.66 2015/01/14 19:02:59 miod Exp $ */ +/* $OpenBSD: xd.c,v 1.67 2015/01/14 21:13:46 miod Exp $ */ /* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */ /* @@ -266,15 +266,16 @@ struct xdc_attach_args { /* this is the "aux" args to xdattach */ * start: disk label fix code (XXX) */ -static void *xd_labeldata; - static void xddummystrat(bp) struct buf *bp; { + struct xd_softc *xd; + + xd = (struct xd_softc *)xd_cd.cd_devs[DISKUNIT(bp->b_dev)]; if (bp->b_bcount != XDFM_BPS) panic("xddummystrat"); - bcopy(xd_labeldata, bp->b_data, XDFM_BPS); + bcopy(xd->xd_labeldata, bp->b_data, XDFM_BPS); bp->b_flags |= B_DONE; } @@ -299,7 +300,7 @@ xdgetdisklabel(xd, b) lp->d_type = DTYPE_SMD; /* We already have the label data in `b'; setup for dummy strategy */ - xd_labeldata = b; + xd->xd_labeldata = b; error = readdisklabel(MAKEDISKDEV(0, xd->sc_dev.dv_unit, RAW_PART), xddummystrat, lp, 0); diff --git a/sys/arch/sparc/dev/xdvar.h b/sys/arch/sparc/dev/xdvar.h index 20d4e6139e0..d6fc6ef6a43 100644 --- a/sys/arch/sparc/dev/xdvar.h +++ b/sys/arch/sparc/dev/xdvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xdvar.h,v 1.8 2014/07/11 16:35:40 jsg Exp $ */ +/* $OpenBSD: xdvar.h,v 1.9 2015/01/14 21:13:46 miod Exp $ */ /* $NetBSD: xdvar.h,v 1.5 1996/03/31 22:38:56 pk Exp $ */ /* @@ -107,6 +107,7 @@ struct xd_softc { u_char nhead; /* number of heads */ u_char nsect; /* number of sectors per track */ u_char hw_spt; /* as above, but includes spare sectors */ + void *xd_labeldata; /* temporary sector buffer */ struct dkbad dkb; /* bad144 sectors */ }; diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c index 8d7aebd1e99..3be42a1dfcb 100644 --- a/sys/arch/sparc/dev/xy.c +++ b/sys/arch/sparc/dev/xy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xy.c,v 1.63 2015/01/14 19:02:59 miod Exp $ */ +/* $OpenBSD: xy.c,v 1.64 2015/01/14 21:13:46 miod Exp $ */ /* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */ /* @@ -204,15 +204,16 @@ struct xyc_attach_args { /* this is the "aux" args to xyattach */ * start: disk label fix code (XXX) */ -static void *xy_labeldata; - static void xydummystrat(bp) struct buf *bp; { + struct xy_softc *xy; + + xy = (struct xy_softc *)xy_cd.cd_devs[DISKUNIT(bp->b_dev)]; if (bp->b_bcount != XYFM_BPS) panic("xydummystrat"); - bcopy(xy_labeldata, bp->b_data, XYFM_BPS); + bcopy(xy->xy_labeldata, bp->b_data, XYFM_BPS); bp->b_flags |= B_DONE; } @@ -237,7 +238,7 @@ xygetdisklabel(xy, b) lp->d_type = DTYPE_SMD; /* We already have the label data in `b'; setup for dummy strategy */ - xy_labeldata = b; + xy->xy_labeldata = b; error = readdisklabel(MAKEDISKDEV(0, xy->sc_dev.dv_unit, RAW_PART), xydummystrat, lp, 0); diff --git a/sys/arch/sparc/dev/xyvar.h b/sys/arch/sparc/dev/xyvar.h index deabca52bca..8a3a81f61fe 100644 --- a/sys/arch/sparc/dev/xyvar.h +++ b/sys/arch/sparc/dev/xyvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xyvar.h,v 1.9 2014/07/11 16:35:40 jsg Exp $ */ +/* $OpenBSD: xyvar.h,v 1.10 2015/01/14 21:13:46 miod Exp $ */ /* $NetBSD: xyvar.h,v 1.4 1996/03/31 22:39:04 pk Exp $ */ /* @@ -109,6 +109,7 @@ struct xy_softc { u_char nsect; /* number of sectors per track */ u_char hw_spt; /* as above, but includes spare sectors */ struct xy_iorq *xyrq; /* this disk's ioreq structure */ + void *xy_labeldata; /* temporary sector buffer */ struct bufq xy_bufq; /* queue'd I/O requests */ struct dkbad dkb; /* bad144 sectors */ }; -- 2.20.1