Source-Changes-HG archive

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

[src/trunk]: src/sys Reduce #ifdef spew by attaching wapbl as a module.



details:   https://anonhg.NetBSD.org/src/rev/19f2f7202c27
branches:  trunk
changeset: 754142:19f2f7202c27
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Apr 21 16:51:24 2010 +0000

description:
Reduce #ifdef spew by attaching wapbl as a module.
(no, it's still too ifdef-ridden to be able to actually do anything
useful and module-like like load into any kernel)

diffstat:

 sys/kern/init_main.c                |  12 ++----------
 sys/kern/vfs_wapbl.c                |  33 ++++++++++++++++++++++++---------
 sys/rump/librump/rumpvfs/rump_vfs.c |   5 ++---
 sys/sys/wapbl.h                     |   4 +---
 4 files changed, 29 insertions(+), 25 deletions(-)

diffs (149 lines):

diff -r d258db765e0e -r 19f2f7202c27 sys/kern/init_main.c
--- a/sys/kern/init_main.c      Wed Apr 21 16:35:09 2010 +0000
+++ b/sys/kern/init_main.c      Wed Apr 21 16:51:24 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_main.c,v 1.418 2010/02/05 11:06:36 cegger Exp $   */
+/*     $NetBSD: init_main.c,v 1.419 2010/04/21 16:51:24 pooka Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.418 2010/02/05 11:06:36 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.419 2010/04/21 16:51:24 pooka Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipsec.h"
@@ -194,9 +194,6 @@
 #include <sys/ktrace.h>
 #endif
 #include <sys/kauth.h>
-#ifdef WAPBL
-#include <sys/wapbl.h>
-#endif
 #ifdef KERN_SA
 #include <sys/savar.h>
 #endif
@@ -581,11 +578,6 @@
        /* Initialize the UUID system calls. */
        uuid_init();
 
-#ifdef WAPBL
-       /* Initialize write-ahead physical block logging. */
-       wapbl_init();
-#endif
-
        machdep_init();
 
        /*
diff -r d258db765e0e -r 19f2f7202c27 sys/kern/vfs_wapbl.c
--- a/sys/kern/vfs_wapbl.c      Wed Apr 21 16:35:09 2010 +0000
+++ b/sys/kern/vfs_wapbl.c      Wed Apr 21 16:51:24 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_wapbl.c,v 1.34 2010/02/27 16:51:03 mlelstv Exp $   */
+/*     $NetBSD: vfs_wapbl.c,v 1.35 2010/04/21 16:51:24 pooka Exp $     */
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.34 2010/02/27 16:51:03 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.35 2010/04/21 16:51:24 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -49,6 +49,7 @@
 #include <sys/vnode.h>
 #include <sys/file.h>
 #include <sys/malloc.h>
+#include <sys/module.h>
 #include <sys/resourcevar.h>
 #include <sys/conf.h>
 #include <sys/mount.h>
@@ -257,13 +258,6 @@
        .wo_wapbl_biodone       = wapbl_biodone,
 };
 
-void
-wapbl_init(void)
-{
-
-       malloc_type_attach(M_WAPBL);
-}
-
 static int
 wapbl_start_flush_inodes(struct wapbl *wl, struct wapbl_replay *wr)
 {
@@ -2712,3 +2706,24 @@
        }
        return 0;
 }
+
+/*
+ * This is not really a module now, but maybe on it's way to
+ * being one some day.
+ */
+MODULE(MODULE_CLASS_VFS, wapbl, NULL);
+
+static int
+wapbl_modcmd(modcmd_t cmd, void *arg)
+{
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               malloc_type_attach(M_WAPBL);
+               return 0;
+       case MODULE_CMD_FINI:
+               return EOPNOTSUPP;
+       default:
+               return ENOTTY;
+       }
+}
diff -r d258db765e0e -r 19f2f7202c27 sys/rump/librump/rumpvfs/rump_vfs.c
--- a/sys/rump/librump/rumpvfs/rump_vfs.c       Wed Apr 21 16:35:09 2010 +0000
+++ b/sys/rump/librump/rumpvfs/rump_vfs.c       Wed Apr 21 16:51:24 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_vfs.c,v 1.45 2010/04/12 22:19:17 pooka Exp $      */
+/*     $NetBSD: rump_vfs.c,v 1.46 2010/04/21 16:51:24 pooka Exp $      */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.45 2010/04/12 22:19:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.46 2010/04/21 16:51:24 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -99,7 +99,6 @@
        }
        vfsinit();
        bufinit();
-       wapbl_init();
        cwd_sys_init();
        lf_init();
        spec_init();
diff -r d258db765e0e -r 19f2f7202c27 sys/sys/wapbl.h
--- a/sys/sys/wapbl.h   Wed Apr 21 16:35:09 2010 +0000
+++ b/sys/sys/wapbl.h   Wed Apr 21 16:51:24 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wapbl.h,v 1.10 2009/04/10 21:14:14 ad Exp $    */
+/*     $NetBSD: wapbl.h,v 1.11 2010/04/21 16:51:24 pooka Exp $ */
 
 /*-
  * Copyright (c) 2003,2008 The NetBSD Foundation, Inc.
@@ -109,8 +109,6 @@
 #endif
 };
 
-void   wapbl_init(void);
-
 /* Start using a log */
 int    wapbl_start(struct wapbl **, struct mount *, struct vnode *, daddr_t,
                    size_t, size_t, struct wapbl_replay *,



Home | Main Index | Thread Index | Old Index