Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/makefs/ffs buf is generic; it has nothing to do wit...



details:   https://anonhg.NetBSD.org/src/rev/1bc1e311e56d
branches:  trunk
changeset: 784521:1bc1e311e56d
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jan 30 17:29:05 2013 +0000

description:
buf is generic; it has nothing to do with ffs and will eventually be moved.
gc sectorize.

diffstat:

 usr.sbin/makefs/ffs/buf.c |  28 +++++++++-------------------
 usr.sbin/makefs/ffs/buf.h |   4 ++--
 2 files changed, 11 insertions(+), 21 deletions(-)

diffs (104 lines):

diff -r ab3cafefcf5b -r 1bc1e311e56d usr.sbin/makefs/ffs/buf.c
--- a/usr.sbin/makefs/ffs/buf.c Wed Jan 30 16:01:45 2013 +0000
+++ b/usr.sbin/makefs/ffs/buf.c Wed Jan 30 17:29:05 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buf.c,v 1.17 2013/01/28 21:03:29 christos Exp $        */
+/*     $NetBSD: buf.c,v 1.18 2013/01/30 17:29:05 christos Exp $        */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: buf.c,v 1.17 2013/01/28 21:03:29 christos Exp $");
+__RCSID("$NetBSD: buf.c,v 1.18 2013/01/30 17:29:05 christos Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -55,14 +55,7 @@
 #include <util.h>
 
 #include "makefs.h"
-
-#include <ufs/ufs/dinode.h>
-#include <ufs/ffs/fs.h>
-
-#include "ffs/buf.h"
-#include "ffs/ufs_inode.h"
-
-extern int sectorsize;         /* XXX: from ffs.c & mkfs.c */
+#include "buf.h"
 
 TAILQ_HEAD(buftailhead,buf) buftail;
 
@@ -72,15 +65,14 @@
 {
        off_t   offset;
        ssize_t rv;
-       struct fs *fs = vp->fs;
+       fsinfo_t *fs = vp->fs;
 
-       assert (fs != NULL);
        assert (bpp != NULL);
 
        if (debug & DEBUG_BUF_BREAD)
                printf("bread: blkno %lld size %d\n", (long long)blkno, size);
        *bpp = getblk(vp, blkno, size, 0, 0);
-       offset = (*bpp)->b_blkno * sectorsize;  /* XXX */
+       offset = (*bpp)->b_blkno * fs->sectorsize;
        if (debug & DEBUG_BUF_BREAD)
                printf("bread: blkno %lld offset %lld bcount %ld\n",
                    (long long)(*bpp)->b_blkno, (long long) offset,
@@ -138,9 +130,10 @@
        off_t   offset;
        ssize_t rv;
        int     bytes;
+       fsinfo_t *fs = bp->b_fs;
 
        assert (bp != NULL);
-       offset = bp->b_blkno * sectorsize;      /* XXX */
+       offset = bp->b_blkno * fs->sectorsize;
        bytes  = bp->b_bcount;
        if (debug & DEBUG_BUF_BWRITE)
                printf("bwrite: blkno %lld offset %lld bcount %d\n",
@@ -190,10 +183,7 @@
        static int buftailinitted;
        struct buf *bp;
        void *n;
-       int fd = vp->fd;
-       struct fs *fs = vp->fs;
 
-       assert (fs != NULL);
        if (debug & DEBUG_BUF_GETBLK)
                printf("getblk: blkno %lld size %d\n", (long long)blkno, size);
 
@@ -214,8 +204,8 @@
                bp = ecalloc(1, sizeof(*bp));
                bp->b_bufsize = 0;
                bp->b_blkno = bp->b_lblkno = blkno;
-               bp->b_fd = fd;
-               bp->b_fs = fs;
+               bp->b_fd = vp->fd;
+               bp->b_fs = vp->fs;
                bp->b_data = NULL;
                TAILQ_INSERT_HEAD(&buftail, bp, b_tailq);
        }
diff -r ab3cafefcf5b -r 1bc1e311e56d usr.sbin/makefs/ffs/buf.h
--- a/usr.sbin/makefs/ffs/buf.h Wed Jan 30 16:01:45 2013 +0000
+++ b/usr.sbin/makefs/ffs/buf.h Wed Jan 30 17:29:05 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buf.h,v 1.7 2013/01/28 21:03:29 christos Exp $ */
+/*     $NetBSD: buf.h,v 1.8 2013/01/30 17:29:05 christos Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -69,7 +69,7 @@
        daddr_t         b_blkno;
        daddr_t         b_lblkno;
        int             b_fd;
-       struct fs *     b_fs;
+       void *          b_fs;
 
        TAILQ_ENTRY(buf)        b_tailq;
 };



Home | Main Index | Thread Index | Old Index