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)
This commit is contained in:
pooka 2010-04-21 16:51:24 +00:00
parent 14f78ca302
commit 34244e1069
4 changed files with 29 additions and 25 deletions

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.418 2010/02/05 11:06:36 cegger Exp $
#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 @@ main(void)
/* Initialize the UUID system calls. */
uuid_init();
#ifdef WAPBL
/* Initialize write-ahead physical block logging. */
wapbl_init();
#endif
machdep_init();
/*

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.34 2010/02/27 16:51:03 mlelstv Exp $
#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 @@ 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;
}
}

View File

@ -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 @@ rump_vfs_init(void)
}
vfsinit();
bufinit();
wapbl_init();
cwd_sys_init();
lf_init();
spec_init();

View File

@ -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 *,