Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Add a new BUF_INIT() macro which initializes b_dep and b...



details:   https://anonhg.NetBSD.org/src/rev/483d2b3da7d9
branches:  trunk
changeset: 543454:483d2b3da7d9
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Feb 25 20:35:31 2003 +0000

description:
Add a new BUF_INIT() macro which initializes b_dep and b_interlock, and
use it.  This fixes a few places where either b_dep or b_interlock were
not properly initialized.

diffstat:

 sys/arch/hp300/dev/sd.c            |   7 ++++---
 sys/arch/sparc/dev/fd.c            |   4 ++--
 sys/dev/ata/ata_raid.c             |   5 ++---
 sys/dev/ata/ld_ataraid.c           |   4 ++--
 sys/dev/ccd.c                      |   7 +++----
 sys/dev/cgd.c                      |   7 +++----
 sys/dev/isa/fd.c                   |   6 +++---
 sys/dev/raidframe/rf_netbsdkintf.c |   8 +++-----
 sys/dev/scsipi/cd.c                |   9 ++++-----
 sys/dev/vnd.c                      |   7 +++----
 sys/kern/kern_physio.c             |   6 +++---
 sys/kern/vfs_bio.c                 |   7 +++----
 sys/miscfs/genfs/genfs_vnops.c     |  19 +++++++------------
 sys/sys/buf.h                      |   8 +++++++-
 sys/ufs/lfs/lfs_bio.c              |   7 +++----
 sys/ufs/lfs/lfs_vfsops.c           |  10 ++++------
 sys/uvm/uvm_swap.c                 |  10 ++++------
 17 files changed, 60 insertions(+), 71 deletions(-)

diffs (truncated from 636 to 300 lines):

diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/arch/hp300/dev/sd.c
--- a/sys/arch/hp300/dev/sd.c   Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/arch/hp300/dev/sd.c   Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sd.c,v 1.58 2003/01/17 22:53:07 thorpej Exp $  */
+/*     $NetBSD: sd.c,v 1.59 2003/02/25 20:35:31 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.58 2003/01/17 22:53:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.59 2003/02/25 20:35:31 thorpej Exp $");
 
 #include "rnd.h"
 #include "opt_useleds.h"
@@ -352,11 +352,11 @@
                bp = malloc(sizeof *bp, M_DEVBUF, M_WAITOK);
                sc->sc_format_pid = curproc->p_pid;
                memcpy(&sc->sc_cmdstore, &cap, sizeof cap);
+               BUF_INIT(bp);
                bp->b_dev = dev;
                bp->b_flags = B_READ | B_BUSY;
                bp->b_data = (caddr_t)capbuf;
                bp->b_bcount = capbufsize;
-               LIST_INIT(&bp->b_dep);
                sdstrategy(bp);
                i = biowait(bp) ? sc->sc_sensestore.status : 0;
                free(bp, M_DEVBUF);
@@ -631,6 +631,7 @@
            M_WAITOK | M_ZERO);
        cbuf = (caddr_t)malloc(bsize, M_DEVBUF, M_WAITOK);
 
+       BUF_INIT(cbp);
        cbp->b_proc = curproc;          /* XXX */
        cbp->b_dev = bp->b_dev;
        bn = bp->b_blkno;
diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/arch/sparc/dev/fd.c
--- a/sys/arch/sparc/dev/fd.c   Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/arch/sparc/dev/fd.c   Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.103 2003/02/05 21:38:38 pk Exp $      */
+/*     $NetBSD: fd.c,v 1.104 2003/02/25 20:35:33 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -2115,7 +2115,7 @@
                return (ENOBUFS);
 
        memset((void *)bp, 0, sizeof(struct buf));
-       simple_lock_init(&bp->b_interlock);
+       BUF_INIT(bp);
        bp->b_flags = B_BUSY | B_PHYS | B_FORMAT;
        bp->b_proc = p;
        bp->b_dev = dev;
diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/dev/ata/ata_raid.c
--- a/sys/dev/ata/ata_raid.c    Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/dev/ata/ata_raid.c    Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ata_raid.c,v 1.2 2003/02/05 21:38:40 pk Exp $  */
+/*     $NetBSD: ata_raid.c,v 1.3 2003/02/25 20:35:35 thorpej Exp $     */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -296,8 +296,7 @@
        int error;
 
        bp = pool_get(&bufpool, PR_WAITOK);
-       simple_lock_init(&bp->b_interlock);
-       LIST_INIT(&bp->b_dep);
+       BUF_INIT(bp);
 
        bp->b_vp = vp;
        bp->b_dev = vp->v_rdev;
diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/dev/ata/ld_ataraid.c
--- a/sys/dev/ata/ld_ataraid.c  Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/dev/ata/ld_ataraid.c  Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_ataraid.c,v 1.3 2003/01/29 16:50:37 thorpej Exp $   */
+/*     $NetBSD: ld_ataraid.c,v 1.4 2003/02/25 20:35:35 thorpej Exp $   */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -231,6 +231,7 @@
        cbp = CBUF_GET();
        if (cbp == NULL)
                return (NULL);
+       BUF_INIT(&cbp->cb_buf);
        cbp->cb_buf.b_flags = bp->b_flags | B_CALL;
        cbp->cb_buf.b_iodone = sc->sc_iodone;
        cbp->cb_buf.b_proc = bp->b_proc;
@@ -238,7 +239,6 @@
        cbp->cb_buf.b_dev = sc->sc_vnodes[comp]->v_rdev;
        cbp->cb_buf.b_blkno = bn + sc->sc_aai->aai_offset;
        cbp->cb_buf.b_data = addr;
-       LIST_INIT(&cbp->cb_buf.b_dep);
        cbp->cb_buf.b_bcount = bcount;
 
        /* Context for iodone */
diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/dev/ccd.c
--- a/sys/dev/ccd.c     Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/dev/ccd.c     Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.82 2003/02/05 21:38:39 pk Exp $      */
+/*     $NetBSD: ccd.c,v 1.83 2003/02/25 20:35:33 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.82 2003/02/05 21:38:39 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.83 2003/02/25 20:35:33 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -802,7 +802,7 @@
        cbp = CCD_GETBUF();
        if (cbp == NULL)
                return (NULL);
-       simple_lock_init(&cbp->cb_buf.b_interlock);
+       BUF_INIT(&cbp->cb_buf);
        cbp->cb_buf.b_flags = bp->b_flags | B_CALL;
        cbp->cb_buf.b_iodone = ccdiodone;
        cbp->cb_buf.b_proc = bp->b_proc;
@@ -810,7 +810,6 @@
        cbp->cb_buf.b_blkno = cbn + cboff;
        cbp->cb_buf.b_data = addr;
        cbp->cb_buf.b_vp = ci->ci_vp;
-       LIST_INIT(&cbp->cb_buf.b_dep);
        if (cs->sc_ileave == 0)
                cbc = dbtob((u_int64_t)(ci->ci_size - cbn));
        else
diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/dev/cgd.c
--- a/sys/dev/cgd.c     Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/dev/cgd.c     Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.7 2003/02/05 21:38:40 pk Exp $ */
+/* $NetBSD: cgd.c,v 1.8 2003/02/25 20:35:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.7 2003/02/05 21:38:40 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.8 2003/02/25 20:35:34 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -307,7 +307,7 @@
                disk_unbusy(&dksc->sc_dkdev, 0, (bp->b_flags & B_READ));
                return;
        }
-       simple_lock_init(&cbp->cb_buf.b_interlock);
+       BUF_INIT(&cbp->cb_buf);
        cbp->cb_buf.b_data = newaddr;
        cbp->cb_buf.b_flags = bp->b_flags | B_CALL;
        cbp->cb_buf.b_iodone = cgdiodone;
@@ -315,7 +315,6 @@
        cbp->cb_buf.b_dev = cs->sc_tdev;
        cbp->cb_buf.b_blkno = bn;
        cbp->cb_buf.b_vp = cs->sc_tvn;
-       LIST_INIT(&cbp->cb_buf.b_dep);
        cbp->cb_buf.b_bcount = bp->b_bcount;
 
        /* context for cgdiodone */
diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/dev/isa/fd.c
--- a/sys/dev/isa/fd.c  Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/dev/isa/fd.c  Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.38 2003/02/05 22:14:01 pk Exp $       */
+/*     $NetBSD: fd.c,v 1.39 2003/02/25 20:35:35 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.38 2003/02/05 22:14:01 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.39 2003/02/25 20:35:35 thorpej Exp $");
 
 #include "rnd.h"
 #include "opt_ddb.h"
@@ -1491,7 +1491,7 @@
                return ENOBUFS;
 
        memset((void *)bp, 0, sizeof(struct buf));
-       simple_lock_init(&bp->b_interlock);
+       BUF_INIT(bp);
        bp->b_flags = B_BUSY | B_PHYS | B_FORMAT;
        bp->b_proc = p;
        bp->b_dev = dev;
diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.154 2003/02/05 21:38:40 pk Exp $  */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.155 2003/02/25 20:35:36 thorpej Exp $     */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -111,7 +111,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.154 2003/02/05 21:38:40 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.155 2003/02/25 20:35:36 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/errno.h>
@@ -1840,7 +1840,7 @@
                bp->b_error = ENOMEM;
                return (ENOMEM);
        }
-       simple_lock_init(&raidbp->rf_buf.b_interlock);
+       BUF_INIT(&raidbp->rf_buf);
 
        /*
         * context for raidiodone
@@ -1848,8 +1848,6 @@
        raidbp->rf_obp = bp;
        raidbp->req = req;
 
-       LIST_INIT(&raidbp->rf_buf.b_dep);
-
        switch (req->type) {
        case RF_IO_TYPE_NOP:    /* used primarily to unlock a locked queue */
                /* XXX need to do something extra here.. */
diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c       Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/dev/scsipi/cd.c       Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd.c,v 1.178 2003/02/05 21:38:41 pk Exp $      */
+/*     $NetBSD: cd.c,v 1.179 2003/02/25 20:35:37 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.178 2003/02/05 21:38:41 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.179 2003/02/25 20:35:37 thorpej Exp $");
 
 #include "rnd.h"
 
@@ -647,7 +647,7 @@
                        }
 
                        /* Set up the IOP to the bounce buffer. */
-                       simple_lock_init(&nbp->b_interlock);
+                       BUF_INIT(nbp);
                        nbp->b_error = 0;
                        nbp->b_proc = bp->b_proc;
                        nbp->b_vp = NULLVP;
@@ -656,7 +656,6 @@
                        nbp->b_bufsize = count;
                        nbp->b_data = bounce;
 
-                       LIST_INIT(&nbp->b_dep);
                        nbp->b_rawblkno = blkno;
 
                        /* We need to do a read-modify-write operation */
@@ -889,6 +888,7 @@
                        }
 
                        /* Set up the IOP to the bounce buffer. */
+                       BUF_INIT(nbp);
                        nbp->b_error = 0;
                        nbp->b_proc = bp->b_proc;
                        nbp->b_vp = NULLVP;
@@ -897,7 +897,6 @@
                        nbp->b_bufsize = bp->b_bufsize;
                        nbp->b_data = bp->b_data;
 
-                       LIST_INIT(&nbp->b_dep);
                        nbp->b_rawblkno = bp->b_rawblkno;
 
                        /* We need to do a read-modify-write operation */
diff -r c3a32a6f2437 -r 483d2b3da7d9 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Tue Feb 25 20:15:02 2003 +0000
+++ b/sys/dev/vnd.c     Tue Feb 25 20:35:31 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.91 2003/02/05 21:38:39 pk Exp $      */
+/*     $NetBSD: vnd.c,v 1.92 2003/02/25 20:35:34 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -98,7 +98,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.91 2003/02/05 21:38:39 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.92 2003/02/25 20:35:34 thorpej Exp $");



Home | Main Index | Thread Index | Old Index