Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/sysvbfs Move bfs_file_setsize() from bfs.c to sysvbfs...



details:   https://anonhg.NetBSD.org/src/rev/a9c43390389e
branches:  trunk
changeset: 779182:a9c43390389e
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Tue May 08 14:28:55 2012 +0000

description:
Move bfs_file_setsize() from bfs.c to sysvbfs_vnops.c
(and rename it to sysvbfs_file_setsize()) because it's actually
part of vnode ops and bfs.c is also pulled by standalone bootloaders
which don't want vnode header mess.

diffstat:

 sys/fs/sysvbfs/bfs.c           |  20 ++------------------
 sys/fs/sysvbfs/bfs.h           |   3 +--
 sys/fs/sysvbfs/sysvbfs_vnops.c |  27 ++++++++++++++++++++++-----
 3 files changed, 25 insertions(+), 25 deletions(-)

diffs (138 lines):

diff -r cb3e3a4fca3b -r a9c43390389e sys/fs/sysvbfs/bfs.c
--- a/sys/fs/sysvbfs/bfs.c      Tue May 08 13:51:34 2012 +0000
+++ b/sys/fs/sysvbfs/bfs.c      Tue May 08 14:28:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bfs.c,v 1.14 2012/03/18 02:40:55 christos Exp $        */
+/*     $NetBSD: bfs.c,v 1.15 2012/05/08 14:28:55 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: bfs.c,v 1.14 2012/03/18 02:40:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bfs.c,v 1.15 2012/05/08 14:28:55 tsutsui Exp $");
 #define        BFS_DEBUG
 
 #include <sys/param.h>
@@ -57,7 +57,6 @@
 #define        __FREE(a, s, t)         free(a)
 #endif
 #include <fs/sysvbfs/bfs.h>
-#include <fs/sysvbfs/sysvbfs.h>
 
 #ifdef BFS_DEBUG
 #define        DPRINTF(on, fmt, args...)       if (on) printf(fmt, ##args)
@@ -507,21 +506,6 @@
        return true;
 }
 
-void
-bfs_file_setsize(struct vnode *v, size_t size)
-{
-       struct sysvbfs_node *bnode = v->v_data;
-       struct bfs_inode *inode = bnode->inode;
-
-       bnode->size = size;
-       uvm_vnp_setsize(v, bnode->size);
-       inode->end_sector = bnode->data_block +
-           (ROUND_SECTOR(bnode->size) >> DEV_BSHIFT) - 1;
-       inode->eof_offset_byte = bnode->data_block * DEV_BSIZE +
-           bnode->size - 1;
-       bnode->update_mtime = true;
-}
-
 bool
 bfs_dirent_lookup_by_inode(const struct bfs *bfs, int inode,
     struct bfs_dirent **dirent)
diff -r cb3e3a4fca3b -r a9c43390389e sys/fs/sysvbfs/bfs.h
--- a/sys/fs/sysvbfs/bfs.h      Tue May 08 13:51:34 2012 +0000
+++ b/sys/fs/sysvbfs/bfs.h      Tue May 08 14:28:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bfs.h,v 1.6 2012/03/18 02:40:55 christos Exp $ */
+/*     $NetBSD: bfs.h,v 1.7 2012/05/08 14:28:55 tsutsui Exp $  */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -155,7 +155,6 @@
 bool bfs_file_lookup(const struct bfs *, const char *, int *, int *,
     size_t *);
 size_t bfs_file_size(const struct bfs_inode *);
-void bfs_file_setsize(struct vnode *, size_t);
 
 bool bfs_dump(const struct bfs *);
 
diff -r cb3e3a4fca3b -r a9c43390389e sys/fs/sysvbfs/sysvbfs_vnops.c
--- a/sys/fs/sysvbfs/sysvbfs_vnops.c    Tue May 08 13:51:34 2012 +0000
+++ b/sys/fs/sysvbfs/sysvbfs_vnops.c    Tue May 08 14:28:55 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysvbfs_vnops.c,v 1.44 2012/04/29 22:53:59 chs Exp $   */
+/*     $NetBSD: sysvbfs_vnops.c,v 1.45 2012/05/08 14:28:55 tsutsui Exp $       */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.44 2012/04/29 22:53:59 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.45 2012/05/08 14:28:55 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -60,6 +60,8 @@
 MALLOC_JUSTDEFINE(M_SYSVBFS_VNODE, "sysvbfs vnode", "sysvbfs vnode structures");
 MALLOC_DECLARE(M_BFS);
 
+static void sysvbfs_file_setsize(struct vnode *, size_t);
+
 int
 sysvbfs_lookup(void *arg)
 {
@@ -373,7 +375,7 @@
                case VREG:
                        if (vp->v_mount->mnt_flag & MNT_RDONLY)
                                return EROFS;
-                       bfs_file_setsize(vp, vap->va_size);
+                       sysvbfs_file_setsize(vp, vap->va_size);
                        break;
                default:
                        return EOPNOTSUPP;
@@ -479,7 +481,7 @@
                return 0;
 
        if (bnode->size < uio->uio_offset + uio->uio_resid) {
-               bfs_file_setsize(v, uio->uio_offset + uio->uio_resid);
+               sysvbfs_file_setsize(v, uio->uio_offset + uio->uio_resid);
                extended = true;
        }
 
@@ -492,7 +494,7 @@
                DPRINTF("%s: write %ldbyte\n", __func__, sz);
        }
        if (err)
-               bfs_file_setsize(v, bnode->size - uio->uio_resid);
+               sysvbfs_file_setsize(v, bnode->size - uio->uio_resid);
 
        VN_KNOTE(v, NOTE_WRITE | (extended ? NOTE_EXTEND : 0));
 
@@ -893,3 +895,18 @@
 
        return 0;
 }
+
+static void
+sysvbfs_file_setsize(struct vnode *v, size_t size)
+{
+       struct sysvbfs_node *bnode = v->v_data;
+       struct bfs_inode *inode = bnode->inode;
+
+       bnode->size = size;
+       uvm_vnp_setsize(v, bnode->size);
+       inode->end_sector = bnode->data_block +
+           (ROUND_SECTOR(bnode->size) >> DEV_BSHIFT) - 1;
+       inode->eof_offset_byte = bnode->data_block * DEV_BSIZE +
+           bnode->size - 1;
+       bnode->update_mtime = true;
+}



Home | Main Index | Thread Index | Old Index