Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs - access the ffs and ext2fs itimes functions through...



details:   https://anonhg.NetBSD.org/src/rev/032e125b128b
branches:  trunk
changeset: 584303:032e125b128b
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Sep 12 20:23:03 2005 +0000

description:
- access the ffs and ext2fs itimes functions through a pointer, so that
  if the filesystem is not compiled in the kernel still links. Probably
  a better solution is to use weak symbols.
- move the filesystem-specific itime macros to the filesystem header files.

diffstat:

 sys/ufs/ext2fs/ext2fs_extern.h |   6 +++++-
 sys/ufs/ext2fs/ext2fs_vfsops.c |   6 ++++--
 sys/ufs/ffs/ffs_extern.h       |   6 +++++-
 sys/ufs/ffs/ffs_vfsops.c       |   6 ++++--
 sys/ufs/ufs/inode.h            |  15 ++++++---------
 sys/ufs/ufs/ufs_vnops.c        |   6 ++++--
 6 files changed, 28 insertions(+), 17 deletions(-)

diffs (169 lines):

diff -r 1e0b879adaef -r 032e125b128b sys/ufs/ext2fs/ext2fs_extern.h
--- a/sys/ufs/ext2fs/ext2fs_extern.h    Mon Sep 12 20:21:18 2005 +0000
+++ b/sys/ufs/ext2fs/ext2fs_extern.h    Mon Sep 12 20:23:03 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_extern.h,v 1.27 2005/09/12 16:24:41 christos Exp $      */
+/*     $NetBSD: ext2fs_extern.h,v 1.28 2005/09/12 20:23:03 christos Exp $      */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -86,6 +86,10 @@
 extern struct pool ext2fs_inode_pool;          /* memory pool for inodes */
 extern struct pool ext2fs_dinode_pool;         /* memory pool for dinodes */
 
+#define        EXT2FS_ITIMES(ip, acc, mod, cre) \
+       while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
+               ext2fs_itimes(ip, acc, mod, cre)
+
 __BEGIN_DECLS
 
 /* ext2fs_alloc.c */
diff -r 1e0b879adaef -r 032e125b128b sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c    Mon Sep 12 20:21:18 2005 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c    Mon Sep 12 20:23:03 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_vfsops.c,v 1.89 2005/08/30 22:01:12 xtraeme Exp $       */
+/*     $NetBSD: ext2fs_vfsops.c,v 1.90 2005/09/12 20:23:03 christos Exp $      */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.89 2005/08/30 22:01:12 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.90 2005/09/12 20:23:03 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -171,6 +171,7 @@
            "ext2dinopl", &pool_allocator_nointr);
 #endif
        ufs_init();
+       ext2fs_itimesfn = ext2fs_itimes;
 }
 
 void
@@ -187,6 +188,7 @@
        pool_destroy(&ext2fs_inode_pool);
        pool_destroy(&ext2fs_dinode_pool);
 #endif
+       ext2fs_itimesfn = NULL;
 }
 
 /*
diff -r 1e0b879adaef -r 032e125b128b sys/ufs/ffs/ffs_extern.h
--- a/sys/ufs/ffs/ffs_extern.h  Mon Sep 12 20:21:18 2005 +0000
+++ b/sys/ufs/ffs/ffs_extern.h  Mon Sep 12 20:23:03 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_extern.h,v 1.46 2005/09/12 16:24:41 christos Exp $ */
+/*     $NetBSD: ffs_extern.h,v 1.47 2005/09/12 20:23:03 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -53,6 +53,10 @@
        { "log_changeopt", CTLTYPE_INT }, \
 }
 
+#define        FFS_ITIMES(ip, acc, mod, cre) \
+       while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
+               ffs_itimes(ip, acc, mod, cre)
+
 struct buf;
 struct fid;
 struct fs;
diff -r 1e0b879adaef -r 032e125b128b sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Mon Sep 12 20:21:18 2005 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Mon Sep 12 20:23:03 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.170 2005/08/28 19:37:59 thorpej Exp $ */
+/*     $NetBSD: ffs_vfsops.c,v 1.171 2005/09/12 20:23:03 christos Exp $        */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.170 2005/08/28 19:37:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.171 2005/09/12 20:23:03 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1558,6 +1558,7 @@
        if (ffs_initcount++ > 0)
                return;
 
+       ffs_itimesfn = ffs_itimes;
 #ifdef _LKM
        pool_init(&ffs_inode_pool, sizeof(struct inode), 0, 0, 0,
                  "ffsinopl", &pool_allocator_nointr);
@@ -1590,6 +1591,7 @@
        pool_destroy(&ffs_dinode1_pool);
        pool_destroy(&ffs_inode_pool);
 #endif
+       ffs_itimesfn = NULL;
 }
 
 SYSCTL_SETUP(sysctl_vfs_ffs_setup, "sysctl vfs.ffs subtree setup")
diff -r 1e0b879adaef -r 032e125b128b sys/ufs/ufs/inode.h
--- a/sys/ufs/ufs/inode.h       Mon Sep 12 20:21:18 2005 +0000
+++ b/sys/ufs/ufs/inode.h       Mon Sep 12 20:23:03 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inode.h,v 1.43 2005/09/12 16:24:41 christos Exp $      */
+/*     $NetBSD: inode.h,v 1.44 2005/09/12 20:23:04 christos Exp $      */
 
 /*
  * Copyright (c) 1982, 1989, 1993
@@ -266,19 +266,16 @@
 #define        VTOI(vp)        ((struct inode *)(vp)->v_data)
 #define        ITOV(ip)        ((ip)->i_vnode)
 
-#define        FFS_ITIMES(ip, acc, mod, cre) \
-       while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
-               ffs_itimes(ip, acc, mod, cre)
+typedef void (*ufs_itimes_t)(struct inode *ip, const struct timespec *,
+    const struct timespec *, const struct timespec *);
 
-#define        EXT2FS_ITIMES(ip, acc, mod, cre) \
-       while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
-               ext2fs_itimes(ip, acc, mod, cre)
+extern ufs_itimes_t ffs_itimesfn, ext2fs_itimesfn;
 
 #define        ITIMES(ip, acc, mod, cre) \
        while ((ip)->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE | IN_MODIFY)) \
                IS_EXT2_VNODE((ip)->i_vnode) ? \
-                       ext2fs_itimes(ip, acc, mod, cre) : \
-                       ffs_itimes(ip, acc, mod, cre)
+                   (*ext2fs_itimesfn)(ip, acc, mod, cre) : \
+                   (*ffs_itimesfn)(ip, acc, mod, cre)
 
 /* Determine if soft dependencies are being done */
 #define        DOINGSOFTDEP(vp)        ((vp)->v_mount->mnt_flag & MNT_SOFTDEP)
diff -r 1e0b879adaef -r 032e125b128b sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c   Mon Sep 12 20:21:18 2005 +0000
+++ b/sys/ufs/ufs/ufs_vnops.c   Mon Sep 12 20:23:03 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_vnops.c,v 1.133 2005/09/12 16:24:41 christos Exp $ */
+/*     $NetBSD: ufs_vnops.c,v 1.134 2005/09/12 20:23:04 christos Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993, 1995
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.133 2005/09/12 16:24:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.134 2005/09/12 20:23:04 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -90,6 +90,8 @@
        0,      DIRBLKSIZ - 12, DT_DIR, 2,      ".."
 };
 
+ufs_itimes_t ffs_itimesfn = NULL, ext2fs_itimesfn = NULL;
+
 /*
  * Create a regular file
  */



Home | Main Index | Thread Index | Old Index