From 34244e10695dcd9d9279b0c3a45c2fa94b711176 Mon Sep 17 00:00:00 2001 From: pooka Date: Wed, 21 Apr 2010 16:51:24 +0000 Subject: [PATCH] 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) --- 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(-) diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index da26c11e1eea..d0f0ec7afbc2 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -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 -__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 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.418 2010/02/05 11:06:36 cegger Exp $ #include #endif #include -#ifdef WAPBL -#include -#endif #ifdef KERN_SA #include #endif @@ -581,11 +578,6 @@ main(void) /* Initialize the UUID system calls. */ uuid_init(); -#ifdef WAPBL - /* Initialize write-ahead physical block logging. */ - wapbl_init(); -#endif - machdep_init(); /* diff --git a/sys/kern/vfs_wapbl.c b/sys/kern/vfs_wapbl.c index ad15f26acf3d..d7a597ed7a27 100644 --- a/sys/kern/vfs_wapbl.c +++ b/sys/kern/vfs_wapbl.c @@ -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 -__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 #include @@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.34 2010/02/27 16:51:03 mlelstv Exp $ #include #include #include +#include #include #include #include @@ -257,13 +258,6 @@ struct wapbl_ops wapbl_ops = { .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 @@ wapbl_replay_read(struct wapbl_replay *wr, void *data, daddr_t blk, long len) } 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 --git a/sys/rump/librump/rumpvfs/rump_vfs.c b/sys/rump/librump/rumpvfs/rump_vfs.c index 1608b9aafece..3ef6390ac02c 100644 --- a/sys/rump/librump/rumpvfs/rump_vfs.c +++ b/sys/rump/librump/rumpvfs/rump_vfs.c @@ -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 -__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 #include @@ -99,7 +99,6 @@ rump_vfs_init(void) } vfsinit(); bufinit(); - wapbl_init(); cwd_sys_init(); lf_init(); spec_init(); diff --git a/sys/sys/wapbl.h b/sys/sys/wapbl.h index 6ebe73d46ade..b70df92160c2 100644 --- a/sys/sys/wapbl.h +++ b/sys/sys/wapbl.h @@ -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 @@ struct wapbl_entry { #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 *,