Source-Changes-HG archive

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

[src/trunk]: src/share/man/man9 Remove \& from example code. Cargo-culted fr...



details:   https://anonhg.NetBSD.org/src/rev/84aec0848c16
branches:  trunk
changeset: 337001:84aec0848c16
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Mar 29 21:08:08 2015 +0000

description:
Remove \& from example code.  Cargo-culted from I forget where.

diffstat:

 share/man/man9/bufferio.9 |  93 +++++++++++++++++++++++-----------------------
 1 files changed, 47 insertions(+), 46 deletions(-)

diffs (114 lines):

diff -r ac527e020817 -r 84aec0848c16 share/man/man9/bufferio.9
--- a/share/man/man9/bufferio.9 Sun Mar 29 21:06:26 2015 +0000
+++ b/share/man/man9/bufferio.9 Sun Mar 29 21:08:08 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: bufferio.9,v 1.3 2015/03/29 21:06:26 riastradh Exp $
+.\"    $NetBSD: bufferio.9,v 1.4 2015/03/29 21:08:08 riastradh Exp $
 .\"
 .\" Copyright (c) 2015 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -96,6 +96,7 @@
 and must not call
 .Fn biowait bp .
 .El
+which is zero.
 .It Fa bp Ns Li "->b_data"
 Pointer to kernel virtual address of source/target for transfer.
 .It Fa bp Ns Li "->b_bcount"
@@ -198,51 +199,51 @@
 .Pp
 For example:
 .Bd -literal -offset abcd
-\&struct buf *mbp, *bp;
-\&size_t skipped = 0;
-\&unsigned i;
-\&int error = 0;
-\&
-\&mbp = getiobuf(vp, true);
-\&mbp->b_data = data;
-\&mbp->b_resid = mbp->b_bcount = datalen;
-\&mbp->b_flags = B_WRITE;
-\&
-\&KASSERT(i < nsegs);
-\&for (i = 0; i < nsegs; i++) {
-\&     struct vnode *devvp;
-\&     daddr_t blkno;
-\&
-\&     vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-\&     error = VOP_BMAP(vp, i*segsz, &devvp, &blkno, NULL);
-\&     VOP_UNLOCK(vp);
-\&     if (error == 0 && nbn == -1)
-\&             error = EIO;
-\&     if (error) {
-\&             skipped += segsz;
-\&             break;
-\&     }
-\&
-\&     bp = getiobuf(vp, true);
-\&     nestiobuf_setup(bp, mbp, i*segsz, segsz);
-\&     bp->b_blkno = blkno;
-\&     if (i == nsegs - 1)     /* Last segment.  */
-\&             break;
-\&     VOP_STRATEGY(devvp, bp);
-\&}
-\&
-\&/*
-\& * Account v_numoutput for master write.
-\& * (Must not vn_lock before last VOP_STRATEGY!)
-\& */
-\&mutex_enter(&vp->v_interlock);
-\&vp->v_numoutput++;
-\&mutex_exit(&vp->v_interlock);
-\&
-\&if (skipped)
-\&     nestiobuf_done(mbp, skipped, error);
-\&else
-\&     VOP_STRATEGY(devvp, bp);
+struct buf *mbp, *bp;
+size_t skipped = 0;
+unsigned i;
+int error = 0;
+
+mbp = getiobuf(vp, true);
+mbp->b_data = data;
+mbp->b_resid = mbp->b_bcount = datalen;
+mbp->b_flags = B_WRITE;
+
+KASSERT(i < nsegs);
+for (i = 0; i < nsegs; i++) {
+       struct vnode *devvp;
+       daddr_t blkno;
+
+       vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+       error = VOP_BMAP(vp, i*segsz, &devvp, &blkno, NULL);
+       VOP_UNLOCK(vp);
+       if (error == 0 && nbn == -1)
+               error = EIO;
+       if (error) {
+               skipped += segsz;
+               break;
+       }
+
+       bp = getiobuf(vp, true);
+       nestiobuf_setup(bp, mbp, i*segsz, segsz);
+       bp->b_blkno = blkno;
+       if (i == nsegs - 1)     /* Last segment.  */
+               break;
+       VOP_STRATEGY(devvp, bp);
+}
+
+/*
+ * Account v_numoutput for master write.
+ * (Must not vn_lock before last VOP_STRATEGY!)
+ */
+mutex_enter(&vp->v_interlock);
+vp->v_numoutput++;
+mutex_exit(&vp->v_interlock);
+
+if (skipped)
+       nestiobuf_done(mbp, skipped, error);
+else
+       VOP_STRATEGY(devvp, bp);
 .Ed
 .Sh BLOCK DEVICE DRIVERS
 Block device drivers implement a



Home | Main Index | Thread Index | Old Index