summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-27 09:43:21 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-02-27 09:43:21 +0000
commit7fe34980153780f95cc612f6d0a4e9800c530011 (patch)
tree8ac245e4ed1e2bbf20cfddeae04b7b321741c353
parentcc3168f1451f2932dea676a480d95729d9900183 (diff)
From NetBSD: update to 960217 sources
-rw-r--r--sys/dev/audio.c51
-rw-r--r--sys/dev/audiovar.h3
-rw-r--r--sys/dev/ccd.c171
-rw-r--r--sys/dev/cons.c9
-rw-r--r--sys/dev/cons.h5
-rw-r--r--sys/dev/vnd.c68
6 files changed, 208 insertions, 99 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 123faa0fe78..0daedec302c 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,5 @@
-/* $NetBSD: audio.c,v 1.14 1996/01/07 06:21:02 mycroft Exp $ */
+/* $OpenBSD: audio.c,v 1.4 1996/02/27 09:43:15 niklas Exp $ */
+/* $NetBSD: audio.c,v 1.17 1996/02/16 02:25:43 mycroft Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -140,6 +141,7 @@ void audiostartr __P((struct audio_softc *));
void audiostartp __P((struct audio_softc *));
void audio_rint __P((struct audio_softc *));
void audio_pint __P((struct audio_softc *));
+void audio_rpint __P((struct audio_softc *));
int audio_calc_blksize __P((struct audio_softc *));
void audio_silence_fill __P((struct audio_softc *, u_char *, int));
@@ -441,11 +443,8 @@ audio_initbufs(sc)
audio_init_ring(&sc->rr, sc->sc_blksize);
audio_init_ring(&sc->pr, sc->sc_blksize);
- sc->sc_lowat = 1;
- if (nblk == 1)
- sc->sc_hiwat = 1;
- else
- sc->sc_hiwat = nblk - sc->sc_lowat;
+ sc->sc_lowat = nblk / 2;
+ sc->sc_hiwat = nblk;
}
static inline int
@@ -934,18 +933,15 @@ audio_write(dev, uio, ioflag)
error = 0;
while (uio->uio_resid > 0) {
- int watermark = sc->sc_hiwat;
- while (cb->nblk > watermark) {
- DPRINTF(("audio_write: nblk=%d watermark=%d\n", cb->nblk, watermark));
- if (ioflag & IO_NDELAY) {
- error = EWOULDBLOCK;
- return (error);
- }
- error = audio_sleep(&sc->sc_wchan, "aud wr");
- if (error != 0) {
- return (error);
- }
- watermark = sc->sc_lowat;
+ if (cb->nblk >= sc->sc_hiwat) {
+ do {
+ DPRINTF(("audio_write: nblk=%d hiwat=%d lowat=%d\n", cb->nblk, sc->sc_hiwat, sc->sc_lowat));
+ if (ioflag & IO_NDELAY)
+ return (EWOULDBLOCK);
+ error = audio_sleep(&sc->sc_wchan, "aud wr");
+ if (error)
+ return (error);
+ } while (cb->nblk >= sc->sc_lowat);
}
#if 0
if (cb->nblk == 0 &&
@@ -1223,7 +1219,7 @@ audiostartp(sc)
if (sc->pr.nblk > 0) {
u_char *hp = sc->pr.hp;
if (rval = sc->hw_if->start_output(sc->hw_hdl, hp, sc->sc_blksize,
- audio_pint, (void *)sc)) {
+ audio_rpint, (void *)sc)) {
DPRINTF(("audiostartp: failed: %d\n", rval));
}
else {
@@ -1237,6 +1233,19 @@ audiostartp(sc)
}
/*
+ * Use this routine as DMA callback if we played user data. We need to
+ * account for user data and silence separately.
+ */
+void
+audio_rpint(sc)
+ struct audio_softc *sc;
+{
+
+ sc->pr.nblk--;
+ audio_pint(sc); /* 'twas a real audio block */
+}
+
+/*
* Called from HW driver module on completion of dma output.
* Start output of new block, wrap in ring buffer if needed.
* If no more buffers to play, output zero instead.
@@ -1258,7 +1267,7 @@ audio_pint(sc)
* always fails and the output is always silence after the
* first block.
*/
- if (--cb->nblk > 0) {
+ if (cb->nblk > 0) {
hp = cb->hp;
if (cb->cb_pause) {
cb->cb_pdrops++;
@@ -1274,7 +1283,7 @@ audio_pint(sc)
Dprintf("audio_pint: hp=0x%x cc=%d\n", hp, cc);
#endif
if (err = hw->start_output(sc->hw_hdl, hp, cc,
- audio_pint, (void *)sc)) {
+ audio_rpint, (void *)sc)) {
DPRINTF(("audio_pint restart failed: %d\n", err));
audio_clear(sc);
}
diff --git a/sys/dev/audiovar.h b/sys/dev/audiovar.h
index c4858f310b7..1b7587d6aaa 100644
--- a/sys/dev/audiovar.h
+++ b/sys/dev/audiovar.h
@@ -1,4 +1,5 @@
-/* $NetBSD: audiovar.h,v 1.3 1995/05/08 22:01:44 brezak Exp $ */
+/* $OpenBSD: audiovar.h,v 1.2 1996/02/27 09:43:17 niklas Exp $ */
+/* $NetBSD: audiovar.h,v 1.5 1996/02/16 02:25:44 mycroft Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index 6d657fa7844..cab34525248 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,7 +1,8 @@
-/* $NetBSD: ccd.c,v 1.23 1996/01/07 22:03:28 thorpej Exp $ */
+/* $OpenBSD: ccd.c,v 1.6 1996/02/27 09:43:17 niklas Exp $ */
+/* $NetBSD: ccd.c,v 1.27 1996/02/11 18:04:01 thorpej Exp $ */
/*
- * Copyright (c) 1995 Jason R. Thorpe.
+ * Copyright (c) 1995, 1996 Jason R. Thorpe.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -83,6 +84,9 @@
* Mail Stop 258-6
* NASA Ames Research Center
* Moffett Field, CA 94035
+ *
+ * Mirroring support based on code written by Satoshi Asami
+ * and Nisha Talagala.
*/
#include <sys/param.h>
@@ -109,12 +113,12 @@
#endif
#ifdef DEBUG
-int ccddebug = 0x00;
#define CCDB_FOLLOW 0x01
#define CCDB_INIT 0x02
#define CCDB_IO 0x04
#define CCDB_LABEL 0x08
#define CCDB_VNODE 0x10
+int ccddebug = 0x00;
#endif
#define ccdunit(x) DISKUNIT(x)
@@ -124,6 +128,9 @@ struct ccdbuf {
struct buf *cb_obp; /* ptr. to original I/O buf */
int cb_unit; /* target unit */
int cb_comp; /* target component */
+ int cb_flags; /* misc. flags */
+
+#define CBF_MIRROR 0x01 /* we're for a mirror component */
};
#define getccdbuf() \
@@ -153,8 +160,8 @@ static void ccdinterleave __P((struct ccd_softc *, int));
static void ccdintr __P((struct ccd_softc *, struct buf *));
static int ccdinit __P((struct ccddevice *, char **, struct proc *));
static int ccdlookup __P((char *, struct proc *p, struct vnode **));
-static struct ccdbuf *ccdbuffer __P((struct ccd_softc *, struct buf *,
- daddr_t, caddr_t, long));
+static void ccdbuffer __P((struct ccd_softc *, struct buf *,
+ daddr_t, caddr_t, long, struct ccdbuf **));
static void ccdgetdisklabel __P((dev_t));
static void ccdmakedisklabel __P((struct ccd_softc *));
static int ccdlock __P((struct ccd_softc *));
@@ -354,6 +361,34 @@ ccdinit(ccd, cpaths, p)
}
/*
+ * Mirroring support requires uniform interleave and
+ * and even number of components.
+ */
+ if (ccd->ccd_flags & CCDF_MIRROR) {
+ ccd->ccd_flags |= CCDF_UNIFORM;
+ if (cs->sc_ileave == 0) {
+#ifdef DEBUG
+ if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
+ printf("%s: mirroring requires interleave\n",
+ cs->sc_xname);
+#endif
+ free(ci->ci_path, M_DEVBUF);
+ free(cs->sc_cinfo, M_DEVBUF);
+ return (EINVAL);
+ }
+ if (cs->sc_nccdisks % 2) {
+#ifdef DEBUG
+ if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
+ printf("%s: mirroring requires even # of components\n",
+ cs->sc_xname);
+#endif
+ free(ci->ci_path, M_DEVBUF);
+ free(cs->sc_cinfo, M_DEVBUF);
+ return (EINVAL);
+ }
+ }
+
+ /*
* If uniform interleave is desired set all sizes to that of
* the smallest component.
*/
@@ -361,7 +396,11 @@ ccdinit(ccd, cpaths, p)
for (ci = cs->sc_cinfo;
ci < &cs->sc_cinfo[cs->sc_nccdisks]; ci++)
ci->ci_size = minsize;
- cs->sc_size = cs->sc_nccdisks * minsize;
+
+ if (ccd->ccd_flags & CCDF_MIRROR)
+ cs->sc_size = (cs->sc_nccdisks / 2) * minsize;
+ else
+ cs->sc_size = cs->sc_nccdisks * minsize;
}
/*
@@ -526,10 +565,13 @@ ccdopen(dev, flags, fmt, p)
ccdgetdisklabel(dev);
/* Check that the partition exists. */
- if (part != RAW_PART && ((part > lp->d_npartitions) ||
- (lp->d_partitions[part].p_fstype == FS_UNUSED))) {
- error = ENXIO;
- goto done;
+ if (part != RAW_PART) {
+ if (((cs->sc_flags & CCDF_INITED) == 0) ||
+ ((part > lp->d_npartitions) ||
+ (lp->d_partitions[part].p_fstype == FS_UNUSED))) {
+ error = ENXIO;
+ goto done;
+ }
}
/* Prevent our unit from being unconfigured while open. */
@@ -647,7 +689,7 @@ ccdstart(cs, bp)
register struct buf *bp;
{
register long bcount, rcount;
- struct ccdbuf *cbp;
+ struct ccdbuf *cbp[4];
caddr_t addr;
daddr_t bn;
struct partition *pp;
@@ -674,11 +716,21 @@ ccdstart(cs, bp)
*/
addr = bp->b_data;
for (bcount = bp->b_bcount; bcount > 0; bcount -= rcount) {
- cbp = ccdbuffer(cs, bp, bn, addr, bcount);
- rcount = cbp->cb_buf.b_bcount;
- if ((cbp->cb_buf.b_flags & B_READ) == 0)
- cbp->cb_buf.b_vp->v_numoutput++;
- VOP_STRATEGY(&cbp->cb_buf);
+ ccdbuffer(cs, bp, bn, addr, bcount, cbp);
+ rcount = cbp[0]->cb_buf.b_bcount;
+ if ((cbp[0]->cb_buf.b_flags & B_READ) == 0)
+ cbp[0]->cb_buf.b_vp->v_numoutput++;
+ VOP_STRATEGY(&cbp[0]->cb_buf);
+
+ /*
+ * Mirror requires additional write.
+ */
+ if ((cs->sc_cflags & CCDF_MIRROR) &&
+ ((cbp[0]->cb_buf.b_flags & B_READ) == 0)) {
+ cbp[1]->cb_buf.b_vp->v_numoutput++;
+ VOP_STRATEGY(&cbp[1]->cb_buf);
+ }
+
bn += btodb(rcount);
addr += rcount;
}
@@ -687,15 +739,16 @@ ccdstart(cs, bp)
/*
* Build a component buffer header.
*/
-static struct ccdbuf *
-ccdbuffer(cs, bp, bn, addr, bcount)
+static void
+ccdbuffer(cs, bp, bn, addr, bcount, cbpp)
register struct ccd_softc *cs;
struct buf *bp;
daddr_t bn;
caddr_t addr;
long bcount;
+ struct ccdbuf **cbpp;
{
- register struct ccdcinfo *ci;
+ register struct ccdcinfo *ci, *ci2;
register struct ccdbuf *cbp;
register daddr_t cbn, cboff;
@@ -739,8 +792,19 @@ ccdbuffer(cs, bp, bn, addr, bcount)
ccdisk = ii->ii_index[0];
cbn = ii->ii_startoff + off;
} else {
- ccdisk = ii->ii_index[off % ii->ii_ndisk];
- cbn = ii->ii_startoff + off / ii->ii_ndisk;
+ if (cs->sc_cflags & CCDF_MIRROR) {
+ ccdisk =
+ ii->ii_index[off % (ii->ii_ndisk / 2)];
+ cbn = ii->ii_startoff +
+ (off / (ii->ii_ndisk / 2));
+ /* Mirrored data */
+ ci2 =
+ &cs->sc_cinfo[ccdisk + (ii->ii_ndisk / 2)];
+ } else {
+ /* Normal case. */
+ ccdisk = ii->ii_index[off % ii->ii_ndisk];
+ cbn = ii->ii_startoff + off / ii->ii_ndisk;
+ }
}
cbn *= cs->sc_ileave;
ci = &cs->sc_cinfo[ccdisk];
@@ -750,6 +814,7 @@ ccdbuffer(cs, bp, bn, addr, bcount)
* Fill in the component buf structure.
*/
cbp = getccdbuf();
+ cbp->cb_flags = 0;
cbp->cb_buf.b_flags = bp->b_flags | B_CALL;
cbp->cb_buf.b_iodone = (void (*)())ccdiodone;
cbp->cb_buf.b_proc = bp->b_proc;
@@ -771,13 +836,30 @@ ccdbuffer(cs, bp, bn, addr, bcount)
cbp->cb_unit = cs - ccd_softc;
cbp->cb_comp = ci - cs->sc_cinfo;
+ /* First buffer is dealt with. */
+ cbpp[0] = cbp;
+
#ifdef DEBUG
if (ccddebug & CCDB_IO)
printf(" dev %x(u%d): cbp %x bn %d addr %x bcnt %d\n",
ci->ci_dev, ci-cs->sc_cinfo, cbp, cbp->cb_buf.b_blkno,
cbp->cb_buf.b_data, cbp->cb_buf.b_bcount);
#endif
- return (cbp);
+
+ /*
+ * Mirrors have an additional write operation that is nearly
+ * identical to the first.
+ */
+ if ((cs->sc_cflags & CCDF_MIRROR) &&
+ ((cbp->cb_buf.b_flags & B_READ) == 0)) {
+ cbp = getccdbuf();
+ *cbp = *cbpp[0];
+ cbp->cb_flags = CBF_MIRROR;
+ cbp->cb_buf.b_dev = ci2->ci_dev; /* XXX */
+ cbp->cb_buf.b_vp = ci2->ci_vp;
+ cbp->cb_comp = ci2 - cs->sc_cinfo;
+ cbpp[1] = cbp;
+ }
}
static void
@@ -811,15 +893,19 @@ ccdiodone(cbp)
register struct buf *bp = cbp->cb_obp;
register int unit = cbp->cb_unit;
struct ccd_softc *cs = &ccd_softc[unit];
- int count, s;
+ int count, cbflags, s;
+ char *comptype;
s = splbio();
#ifdef DEBUG
if (ccddebug & CCDB_FOLLOW)
printf("ccdiodone(%x)\n", cbp);
if (ccddebug & CCDB_IO) {
- printf("ccdiodone: bp %x bcount %d resid %d\n",
- bp, bp->b_bcount, bp->b_resid);
+ if (cbp->cb_flags & CBF_MIRROR)
+ printf("ccdiodone: mirror component\n");
+ else
+ printf("ccdiodone: bp %x bcount %d resid %d\n",
+ bp, bp->b_bcount, bp->b_resid);
printf(" dev %x(u%d), cbp %x bn %d addr %x bcnt %d\n",
cbp->cb_buf.b_dev, cbp->cb_comp, cbp,
cbp->cb_buf.b_blkno, cbp->cb_buf.b_data,
@@ -828,24 +914,35 @@ ccdiodone(cbp)
#endif
if (cbp->cb_buf.b_flags & B_ERROR) {
- bp->b_flags |= B_ERROR;
- bp->b_error = cbp->cb_buf.b_error ? cbp->cb_buf.b_error : EIO;
-#ifdef DEBUG
- printf("%s: error %d on component %d\n",
- cs->sc_xname, bp->b_error, cbp->cb_comp);
-#endif
+ if (cbp->cb_flags & CBF_MIRROR)
+ comptype = " (mirror)";
+ else {
+ bp->b_flags |= B_ERROR;
+ bp->b_error = cbp->cb_buf.b_error ?
+ cbp->cb_buf.b_error : EIO;
+ comptype = "";
+ }
+
+ printf("%s: error %d on component %d%s\n",
+ cs->sc_xname, bp->b_error, cbp->cb_comp, comptype);
}
count = cbp->cb_buf.b_bcount;
+ cbflags = cbp->cb_flags;
putccdbuf(cbp);
/*
* If all done, "interrupt".
+ *
+ * Note that mirror component buffers aren't counted against
+ * the original I/O buffer.
*/
- bp->b_resid -= count;
- if (bp->b_resid < 0)
- panic("ccdiodone: count");
- if (bp->b_resid == 0)
- ccdintr(&ccd_softc[unit], bp);
+ if ((cbflags & CBF_MIRROR) == 0) {
+ bp->b_resid -= count;
+ if (bp->b_resid < 0)
+ panic("ccdiodone: count");
+ if (bp->b_resid == 0)
+ ccdintr(&ccd_softc[unit], bp);
+ }
splx(s);
}
@@ -1089,7 +1186,7 @@ ccdioctl(dev, cmd, data, flag, p)
bcopy(&ccd, &ccddevs[unit], sizeof(ccd));
/* Detatch the disk. */
- disk_detatch(&cs->sc_dkdev);
+ disk_detach(&cs->sc_dkdev);
/* This must be atomic. */
s = splhigh();
diff --git a/sys/dev/cons.c b/sys/dev/cons.c
index ba39691c29e..3643121b7db 100644
--- a/sys/dev/cons.c
+++ b/sys/dev/cons.c
@@ -1,4 +1,5 @@
-/* $NetBSD: cons.c,v 1.28 1995/11/25 00:03:35 cgd Exp $ */
+/* $OpenBSD: cons.c,v 1.3 1996/02/27 09:43:19 niklas Exp $ */
+/* $NetBSD: cons.c,v 1.29 1996/02/04 02:04:08 christos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -228,19 +229,19 @@ cngetc()
return ((*cn_tab->cn_getc)(cn_tab->cn_dev));
}
-int
+void
cnputc(c)
register int c;
{
if (cn_tab == NULL)
- return 0; /* XXX should be void */
+ return;
+
if (c) {
(*cn_tab->cn_putc)(cn_tab->cn_dev, c);
if (c == '\n')
(*cn_tab->cn_putc)(cn_tab->cn_dev, '\r');
}
- return 0; /* XXX should be void */
}
void
diff --git a/sys/dev/cons.h b/sys/dev/cons.h
index 5ff2b7776c1..155c2aa30cf 100644
--- a/sys/dev/cons.h
+++ b/sys/dev/cons.h
@@ -1,4 +1,5 @@
-/* $NetBSD: cons.h,v 1.12 1995/11/25 00:03:41 cgd Exp $ */
+/* $OpenBSD: cons.h,v 1.3 1996/02/27 09:43:19 niklas Exp $ */
+/* $NetBSD: cons.h,v 1.13 1996/02/04 02:04:17 christos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -79,7 +80,7 @@ int cnwrite __P((dev_t, struct uio *, int));
int cnioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
int cnselect __P((dev_t, int, struct proc *));
int cngetc __P((void));
-int cnputc __P((int));
+void cnputc __P((int));
void nullcnpollc __P((dev_t, int));
/* console-specific types */
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 921ca9981cb..262d1a19dbd 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,5 @@
-/* $NetBSD: vnd.c,v 1.23 1996/01/07 22:03:33 thorpej Exp $ */
+/* $OpenBSD: vnd.c,v 1.4 1996/02/27 09:43:20 niklas Exp $ */
+/* $NetBSD: vnd.c,v 1.24 1996/02/10 00:11:44 christos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -125,13 +126,9 @@ struct vnd_softc {
struct vnd_softc *vnd_softc;
int numvnd = 0;
-/* {b,c}devsw[] function prototypes */
-dev_type_open(vndopen);
-dev_type_close(vndclose);
-dev_type_strategy(vndstrategy);
-dev_type_ioctl(vndioctl);
-dev_type_read(vndread);
-dev_type_write(vndwrite);
+/* {b,c}devsw[] function prototypes XXX: move them to dev_conf.h */
+bdev_decl(vnd);
+cdev_decl(vnd);
/* called by main() at boot time */
void vndattach __P((int));
@@ -140,6 +137,8 @@ void vndclear __P((struct vnd_softc *));
void vndstart __P((struct vnd_softc *));
int vndsetcred __P((struct vnd_softc *, struct ucred *));
void vndthrottle __P((struct vnd_softc *, struct vnode *));
+void vndiodone __P((struct buf *));
+void vndshutdown __P((void));
static int vndlock __P((struct vnd_softc *));
static void vndunlock __P((struct vnd_softc *));
@@ -180,13 +179,13 @@ vndopen(dev, flags, mode, p)
#ifdef DEBUG
if (vnddebug & VDB_FOLLOW)
- printf("vndopen(%x, %x, %x, %x)\n", dev, flags, mode, p);
+ printf("vndopen(%x, %x, %x, %p)\n", dev, flags, mode, p);
#endif
if (unit >= numvnd)
return (ENXIO);
sc = &vnd_softc[unit];
- if (error = vndlock(sc))
+ if ((error = vndlock(sc)) != 0)
return (error);
part = DISKPART(dev);
@@ -221,14 +220,14 @@ vndclose(dev, flags, mode, p)
#ifdef DEBUG
if (vnddebug & VDB_FOLLOW)
- printf("vndclose(%x, %x, %x, %x)\n", dev, flags, mode, p);
+ printf("vndclose(%x, %x, %x, %p)\n", dev, flags, mode, p);
#endif
if (unit >= numvnd)
return (ENXIO);
sc = &vnd_softc[unit];
- if (error = vndlock(sc))
+ if ((error = vndlock(sc)) != 0)
return (error);
part = DISKPART(dev);
@@ -265,11 +264,10 @@ vndstrategy(bp)
register int bn, bsize, resid;
register caddr_t addr;
int sz, flags, error;
- extern void vndiodone();
#ifdef DEBUG
if (vnddebug & VDB_FOLLOW)
- printf("vndstrategy(%x): unit %d\n", bp, unit);
+ printf("vndstrategy(%p): unit %d\n", bp, unit);
#endif
if ((vnd->sc_flags & VNF_INITED) == 0) {
bp->b_error = ENXIO;
@@ -308,7 +306,7 @@ vndstrategy(bp)
nra = 0;
#endif
- if (off = bn % bsize)
+ if ((off = bn % bsize) != 0)
sz = bsize - off;
else
sz = (1 + nra) * bsize;
@@ -316,7 +314,7 @@ vndstrategy(bp)
sz = resid;
#ifdef DEBUG
if (vnddebug & VDB_IO)
- printf("vndstrategy: vp %x/%x bn %x/%x sz %x\n",
+ printf("vndstrategy: vp %p/%p bn %x/%x sz %x\n",
vnd->sc_vp, vp, bn, nbn, sz);
#endif
@@ -396,7 +394,7 @@ vndstart(vnd)
vnd->sc_tab.b_actf = bp->b_actf;
#ifdef DEBUG
if (vnddebug & VDB_IO)
- printf("vndstart(%d): bp %x vp %x blkno %x addr %x cnt %x\n",
+ printf("vndstart(%d): bp %p vp %p blkno %x addr %p cnt %x\n",
vnd-vnd_softc, bp, bp->b_vp, bp->b_blkno, bp->b_data,
bp->b_bcount);
#endif
@@ -410,9 +408,10 @@ vndstart(vnd)
}
void
-vndiodone(vbp)
- register struct vndbuf *vbp;
+vndiodone(bp)
+ struct buf *bp;
{
+ register struct vndbuf *vbp = (struct vndbuf *) bp;
register struct buf *pbp = vbp->vb_obp;
register struct vnd_softc *vnd = &vnd_softc[vndunit(pbp->b_dev)];
int s;
@@ -420,7 +419,7 @@ vndiodone(vbp)
s = splbio();
#ifdef DEBUG
if (vnddebug & VDB_IO)
- printf("vndiodone(%d): vbp %x vp %x blkno %x addr %x cnt %x\n",
+ printf("vndiodone(%d): vbp %p vp %p blkno %x addr %p cnt %x\n",
vnd-vnd_softc, vbp, vbp->vb_buf.b_vp, vbp->vb_buf.b_blkno,
vbp->vb_buf.b_data, vbp->vb_buf.b_bcount);
#endif
@@ -428,7 +427,7 @@ vndiodone(vbp)
if (vbp->vb_buf.b_error) {
#ifdef DEBUG
if (vnddebug & VDB_IO)
- printf("vndiodone: vbp %x error %d\n", vbp,
+ printf("vndiodone: vbp %p error %d\n", vbp,
vbp->vb_buf.b_error);
#endif
pbp->b_flags |= B_ERROR;
@@ -440,7 +439,7 @@ vndiodone(vbp)
if (pbp->b_resid == 0) {
#ifdef DEBUG
if (vnddebug & VDB_IO)
- printf("vndiodone: pbp %x iodone\n", pbp);
+ printf("vndiodone: pbp %p iodone\n", pbp);
#endif
biodone(pbp);
}
@@ -463,7 +462,7 @@ vndread(dev, uio, flags)
#ifdef DEBUG
if (vnddebug & VDB_FOLLOW)
- printf("vndread(%x, %x)\n", dev, uio);
+ printf("vndread(%x, %p)\n", dev, uio);
#endif
if (unit >= numvnd)
@@ -488,7 +487,7 @@ vndwrite(dev, uio, flags)
#ifdef DEBUG
if (vnddebug & VDB_FOLLOW)
- printf("vndwrite(%x, %x)\n", dev, uio);
+ printf("vndwrite(%x, %p)\n", dev, uio);
#endif
if (unit >= numvnd)
@@ -519,7 +518,7 @@ vndioctl(dev, cmd, data, flag, p)
#ifdef DEBUG
if (vnddebug & VDB_FOLLOW)
- printf("vndioctl(%x, %lx, %x, %x, %x): unit %d\n",
+ printf("vndioctl(%x, %lx, %p, %x, %p): unit %d\n",
dev, cmd, data, flag, p, unit);
#endif
error = suser(p->p_ucred, &p->p_acflag);
@@ -536,7 +535,7 @@ vndioctl(dev, cmd, data, flag, p)
if (vnd->sc_flags & VNF_INITED)
return (EBUSY);
- if (error = vndlock(vnd))
+ if ((error = vndlock(vnd)) != 0)
return (error);
/*
@@ -546,11 +545,12 @@ vndioctl(dev, cmd, data, flag, p)
* have to worry about them.
*/
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, vio->vnd_file, p);
- if (error = vn_open(&nd, FREAD|FWRITE, 0)) {
+ if ((error = vn_open(&nd, FREAD|FWRITE, 0)) != 0) {
vndunlock(vnd);
return(error);
}
- if (error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, p)) {
+ error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, p);
+ if (error) {
VOP_UNLOCK(nd.ni_vp);
(void) vn_close(nd.ni_vp, FREAD|FWRITE, p->p_ucred, p);
vndunlock(vnd);
@@ -559,7 +559,7 @@ vndioctl(dev, cmd, data, flag, p)
VOP_UNLOCK(nd.ni_vp);
vnd->sc_vp = nd.ni_vp;
vnd->sc_size = btodb(vattr.va_size); /* note truncation */
- if (error = vndsetcred(vnd, p->p_ucred)) {
+ if ((error = vndsetcred(vnd, p->p_ucred)) != 0) {
(void) vn_close(nd.ni_vp, FREAD|FWRITE, p->p_ucred, p);
vndunlock(vnd);
return(error);
@@ -569,7 +569,7 @@ vndioctl(dev, cmd, data, flag, p)
vnd->sc_flags |= VNF_INITED;
#ifdef DEBUG
if (vnddebug & VDB_INIT)
- printf("vndioctl: SET vp %x size %x\n",
+ printf("vndioctl: SET vp %p size %x\n",
vnd->sc_vp, vnd->sc_size);
#endif
@@ -587,7 +587,7 @@ vndioctl(dev, cmd, data, flag, p)
if ((vnd->sc_flags & VNF_INITED) == 0)
return (ENXIO);
- if (error = vndlock(vnd))
+ if ((error = vndlock(vnd)) != 0)
return (error);
/*
@@ -611,7 +611,7 @@ vndioctl(dev, cmd, data, flag, p)
#endif
/* Detatch the disk. */
- disk_detatch(&vnd->sc_dkdev);
+ disk_detach(&vnd->sc_dkdev);
/* This must be atomic. */
s = splhigh();
@@ -677,7 +677,7 @@ vndthrottle(vnd, vp)
struct vnode *vp;
{
#ifdef NFSCLIENT
- extern int (**nfsv2_vnodeop_p)();
+ extern int (**nfsv2_vnodeop_p) __P((void *));
if (vp->v_op == nfsv2_vnodeop_p)
vnd->sc_maxactive = 2;
@@ -708,7 +708,7 @@ vndclear(vnd)
#ifdef DEBUG
if (vnddebug & VDB_FOLLOW)
- printf("vndclear(%x): vp %x\n", vp);
+ printf("vndclear(%p): vp %p\n", vnd, vp);
#endif
vnd->sc_flags &= ~VNF_INITED;
if (vp == (struct vnode *)0)