Index: dev/rnd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/rnd.c,v
retrieving revision 1.42
diff -d -p -u -r1.42 rnd.c
--- dev/rnd.c	29 Jun 2003 22:30:01 -0000	1.42
+++ dev/rnd.c	5 Apr 2004 05:46:14 -0000
@@ -128,7 +128,7 @@ volatile u_int32_t rnd_status;
 /*
  * Memory pool; accessed only at splhigh().
  */
-struct pool rnd_mempool;
+POOL_INIT(rnd_mempool, sizeof(rnd_sample_t), 0, 0, 0, "rndsample", NULL);
 
 /*
  * Our random pool.  This is defined here rather than using the general
@@ -321,9 +321,6 @@ rnd_init(void)
 	LIST_INIT(&rnd_sources);
 	SIMPLEQ_INIT(&rnd_samples);
 
-	pool_init(&rnd_mempool, sizeof(rnd_sample_t), 0, 0, 0, "rndsample",
-	    NULL);
-
 	rndpool_init(&rnd_pool);
 
 	/* Mix *something*, *anything* into the pool to help it get started. 
Index: fs/adosfs/advfsops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/adosfs/advfsops.c,v
retrieving revision 1.11
diff -d -p -u -r1.11 advfsops.c
--- fs/adosfs/advfsops.c	27 Mar 2004 04:43:43 -0000	1.11
+++ fs/adosfs/advfsops.c	5 Apr 2004 05:46:20 -0000
@@ -79,7 +79,8 @@ int adosfs_loadbitmap __P((struct adosfs
 
 struct simplelock adosfs_hashlock;
 
-struct pool adosfs_node_pool;
+POOL_INIT(adosfs_node_pool, sizeof(struct anode), 0, 0, 0, "adosndpl", \
+    &pool_allocator_nointr);
 
 MALLOC_DEFINE(M_ADOSFSMNT, "adosfs mount", "adosfs mount structures");
 MALLOC_DEFINE(M_ANODE, "adosfs anode", "adosfs anode structures and tables");
@@ -818,9 +819,6 @@ adosfs_init()
 	malloc_type_attach(M_ADOSFSBITMAP);
 #endif
 	simple_lock_init(&adosfs_hashlock);
-
-	pool_init(&adosfs_node_pool, sizeof(struct anode), 0, 0, 0,
-	    "adosndpl", &pool_allocator_nointr);
 }
 
 void
Index: fs/cd9660/cd9660_node.c
===================================================================
RCS file: /cvsroot/src/sys/fs/cd9660/cd9660_node.c,v
retrieving revision 1.6
diff -d -p -u -r1.6 cd9660_node.c
--- fs/cd9660/cd9660_node.c	27 Mar 2004 04:43:43 -0000	1.6
+++ fs/cd9660/cd9660_node.c	5 Apr 2004 05:46:20 -0000
@@ -74,7 +74,8 @@ u_long idvhash;
 
 extern int prtactive;	/* 1 => print out reclaim of active vnodes */
 
-struct pool cd9660_node_pool;
+POOL_INIT(cd9660_node_pool, sizeof(struct iso_node), 0, 0, 0, "cd9660nopl", \
+    &pool_allocator_nointr);
 
 static u_int cd9660_chars2ui __P((u_char *, int));
 
@@ -94,8 +95,6 @@ cd9660_init()
 	idvhashtbl = hashinit(desiredvnodes / 8, HASH_LIST, M_ISOFSMNT,
 	    M_WAITOK, &idvhash);
 #endif
-	pool_init(&cd9660_node_pool, sizeof(struct iso_node), 0, 0, 0,
-	    "cd9660nopl", &pool_allocator_nointr);
 }
 
 /*
Index: fs/filecorefs/filecore_node.c
===================================================================
RCS file: /cvsroot/src/sys/fs/filecorefs/filecore_node.c,v
retrieving revision 1.3
diff -d -p -u -r1.3 filecore_node.c
--- fs/filecorefs/filecore_node.c	27 Mar 2004 04:43:43 -0000	1.3
+++ fs/filecorefs/filecore_node.c	5 Apr 2004 05:46:20 -0000
@@ -95,7 +95,8 @@ u_long filecorehash;
 #define	INOHASH(device, inum)	(((device) + ((inum)>>12)) & filecorehash)
 struct simplelock filecore_ihash_slock;
 
-struct pool filecore_node_pool;
+POOL_INIT(filecore_node_pool, sizeof(struct filecore_node), 0, 0, 0, \
+    "filecrnopl", &pool_allocator_nointr);
 
 extern int prtactive;	/* 1 => print out reclaim of active vnodes */
 
@@ -111,8 +112,6 @@ filecore_init()
 	filecorehashtbl = hashinit(desiredvnodes, HASH_LIST, M_FILECOREMNT,
 	    M_WAITOK, &filecorehash);
 	simple_lock_init(&filecore_ihash_slock);
-	pool_init(&filecore_node_pool, sizeof(struct filecore_node),
-	    0, 0, 0, "filecrnopl", &pool_allocator_nointr);
 }
 
 /*
Index: fs/msdosfs/msdosfs_denode.c
===================================================================
RCS file: /cvsroot/src/sys/fs/msdosfs/msdosfs_denode.c,v
retrieving revision 1.5
diff -d -p -u -r1.5 msdosfs_denode.c
--- fs/msdosfs/msdosfs_denode.c	27 Mar 2004 04:43:43 -0000	1.5
+++ fs/msdosfs/msdosfs_denode.c	5 Apr 2004 05:46:21 -0000
@@ -77,7 +77,8 @@ u_long dehash;			/* size of hash table -
 
 struct simplelock msdosfs_ihash_slock;
 
-struct pool msdosfs_denode_pool;
+POOL_INIT(msdosfs_denode_pool, sizeof(struct denode), 0, 0, 0, "msdosnopl", \
+    &pool_allocator_nointr);
 
 extern int prtactive;
 
@@ -105,8 +106,6 @@ msdosfs_init()
 	dehashtbl = hashinit(desiredvnodes / 2, HASH_LIST, M_MSDOSFSMNT,
 	    M_WAITOK, &dehash);
 	simple_lock_init(&msdosfs_ihash_slock);
-	pool_init(&msdosfs_denode_pool, sizeof(struct denode), 0, 0, 0,
-	    "msdosnopl", &pool_allocator_nointr);
 }
 
 /*
Index: fs/smbfs/smbfs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/smbfs/smbfs_vfsops.c,v
retrieving revision 1.34
diff -d -p -u -r1.34 smbfs_vfsops.c
--- fs/smbfs/smbfs_vfsops.c	24 Mar 2004 15:34:52 -0000	1.34
+++ fs/smbfs/smbfs_vfsops.c	5 Apr 2004 05:46:22 -0000
@@ -109,7 +109,8 @@ int smbfs_vget(struct mount *mp, ino_t i
 int smbfs_fhtovp(struct mount *, struct fid *, struct vnode **);
 int smbfs_vptofh(struct vnode *, struct fid *);
 
-extern struct pool smbfs_node_pool;
+POOL_INIT(smbfs_node_pool, sizeof(struct smbnode), 0, 0, 0, "smbfsnopl", \
+    &pool_allocator_nointr);
 extern struct vnodeopv_desc smbfs_vnodeop_opv_desc;
 
 static const struct vnodeopv_desc *smbfs_vnodeopv_descs[] = {
@@ -357,9 +358,6 @@ smbfs_quotactl(mp, cmd, uid, arg, p)
 void
 smbfs_init(void)
 {
-	pool_init(&smbfs_node_pool, sizeof(struct smbnode), 0, 0, 0,
-		"smbfsnopl", &pool_allocator_nointr);
-
 #ifdef _LKM
 	/* Need explicit attach if LKM */
 	malloc_type_attach(M_SMBNODENAME);
Index: kern/init_main.c
===================================================================
RCS file: /cvsroot/src/sys/kern/init_main.c,v
retrieving revision 1.235
diff -d -p -u -r1.235 init_main.c
--- kern/init_main.c	28 Mar 2004 22:43:56 -0000	1.235
+++ kern/init_main.c	5 Apr 2004 05:46:22 -0000
@@ -111,6 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c,
 #include <sys/disk.h>
 #include <sys/exec.h>
 #include <sys/socketvar.h>
+#include <sys/lockf.h>
 #include <sys/protosw.h>
 #include <sys/reboot.h>
 #include <sys/user.h>
@@ -251,6 +252,9 @@ main(void)
 	/* Do machine-dependent initialization. */
 	cpu_startup();
 
+	/* Initialise pools. */
+	link_pool_init();
+
 	/* Initialize callouts. */
 	callout_startup();
 
@@ -263,9 +267,6 @@ main(void)
 	 */
 	mbinit();
 
-	/* Initialize kqueues. */
-	kqueue_init();
-
 	/* Initialize sockets. */
 	soinit();
 
@@ -290,9 +291,7 @@ main(void)
 	/* Initialize the sysctl subsystem. */
 	sysctl_init();
 
-	/*
-	 * Initialize process and pgrp structures.
-	 */
+	/* Initialize process and pgrp structures. */
 	procinit();
 
 #ifdef LKM
@@ -333,7 +332,6 @@ main(void)
 	p->p_ucred->cr_ngroups = 1;	/* group 0 */
 
 	/* Create the file descriptor table. */
-	finit();
 	p->p_fd = &filedesc0.fd_fd;
 	fdinit1(&filedesc0);
 
@@ -586,11 +584,6 @@ main(void)
 	/* Initialize exec structures */
 	exec_init(1);
 
-#ifndef PIPE_SOCKETPAIR
-	/* Initialize pipe structures */
-	pipe_init();
-#endif
-
 	/*
 	 * Okay, now we can let init(8) exec!  It's off to userland!
 	 */
Index: kern/kern_descrip.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_descrip.c,v
retrieving revision 1.123
diff -d -p -u -r1.123 kern_descrip.c
--- kern/kern_descrip.c	7 Jan 2004 09:26:29 -0000	1.123
+++ kern/kern_descrip.c	5 Apr 2004 05:46:23 -0000
@@ -69,9 +69,12 @@ __KERNEL_RCSID(0, "$NetBSD: kern_descrip
  */
 struct filelist	filehead;	/* head of list of open files */
 int		nfiles;		/* actual number of open files */
-struct pool	file_pool;	/* memory pool for file structures */
-struct pool	cwdi_pool;	/* memory pool for cwdinfo structures */
-struct pool	filedesc0_pool;	/* memory pool for filedesc0 structures */
+POOL_INIT(file_pool, sizeof(struct file), 0, 0, 0, "filepl", \
+    &pool_allocator_nointr);
+POOL_INIT(cwdi_pool, sizeof(struct cwdinfo), 0, 0, 0, "cwdipl", \
+    &pool_allocator_nointr);
+POOL_INIT(filedesc0_pool, sizeof(struct filedesc0), 0, 0, 0, "fdescpl", \
+    &pool_allocator_nointr);
 
 /* Global file list lock */
 static struct simplelock filelist_slock = SIMPLELOCK_INITIALIZER;
@@ -860,21 +863,6 @@ fdavail(struct proc *p, int n)
 }
 
 /*
- * Initialize the data structures necessary for managing files.
- */
-void
-finit(void)
-{
-
-	pool_init(&file_pool, sizeof(struct file), 0, 0, 0, "filepl",
-	    &pool_allocator_nointr);
-	pool_init(&cwdi_pool, sizeof(struct cwdinfo), 0, 0, 0, "cwdipl",
-	    &pool_allocator_nointr);
-	pool_init(&filedesc0_pool, sizeof(struct filedesc0), 0, 0, 0, "fdescpl",
-	    &pool_allocator_nointr);
-}
-
-/*
  * Create a new open file structure and allocate
  * a file descriptor for the process that refers to it.
  */
Index: kern/kern_event.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_event.c,v
retrieving revision 1.19
diff -d -p -u -r1.19 kern_event.c
--- kern/kern_event.c	14 Feb 2004 11:56:28 -0000	1.19
+++ kern/kern_event.c	5 Apr 2004 05:46:23 -0000
@@ -103,8 +103,8 @@ static const struct filterops file_filto
 static struct filterops timer_filtops =
 	{ 0, filt_timerattach, filt_timerdetach, filt_timer };
 
-struct pool	kqueue_pool;
-struct pool	knote_pool;
+POOL_INIT(kqueue_pool, sizeof(struct kqueue), 0, 0, 0, "kqueuepl", NULL);
+POOL_INIT(knote_pool, sizeof(struct knote), 0, 0, 0, "knotepl", NULL);
 static int	kq_ncallouts = 0;
 static int	kq_calloutmax = (4 * 1024);
 
@@ -152,21 +152,6 @@ static int		user_kfilterc;		/* current o
 static int		user_kfiltermaxc;	/* max size so far */
 
 /*
- * kqueue_init:
- *
- *	Initialize the kqueue/knote facility.
- */
-void
-kqueue_init(void)
-{
-
-	pool_init(&kqueue_pool, sizeof(struct kqueue), 0, 0, 0, "kqueuepl",
-	    NULL);
-	pool_init(&knote_pool, sizeof(struct knote), 0, 0, 0, "knotepl",
-	    NULL);
-}
-
-/*
  * Find kfilter entry by name, or NULL if not found.
  */
 static const struct kfilter *
Index: kern/kern_kcont.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_kcont.c,v
retrieving revision 1.9
diff -d -p -u -r1.9 kern_kcont.c
--- kern/kern_kcont.c	27 Mar 2004 00:42:38 -0000	1.9
+++ kern/kern_kcont.c	5 Apr 2004 05:46:23 -0000
@@ -86,7 +86,7 @@ static void *kc_si_softserial;
 /*
  * Pool allocator structure.
  */
-static struct pool kc_pool;
+POOL_INIT(kc_pool, sizeof(struct kc), 0, 0, 0, "kcpl", NULL);
 
 /*
  * Process-context continuation queue.
@@ -398,8 +398,6 @@ kcont_init(void)
 	    kcont_run_softserial, &kcq_softserial);
 #endif	/* __HAVE_GENERIC_SOFT_INTERRUPTS */
 
-	pool_init(&kc_pool, sizeof(struct kc), 0, 0, 0, "kcpl", NULL);
-
 	/*
 	 * Create kc_queue for process-context continuations, and
 	 * a worker kthread to process the queue. (Fine-grained SMP
Index: kern/kern_malloc_debug.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_malloc_debug.c,v
retrieving revision 1.11
diff -d -p -u -r1.11 kern_malloc_debug.c
--- kern/kern_malloc_debug.c	24 Oct 2003 00:53:43 -0000	1.11
+++ kern/kern_malloc_debug.c	5 Apr 2004 05:46:23 -0000
@@ -109,7 +109,8 @@ int debug_malloc_frees;
 int debug_malloc_pages;
 int debug_malloc_chunks_on_freelist;
 
-struct pool debug_malloc_pool;
+POOL_INIT(debug_malloc_pool, sizeof(struct debug_malloc_entry), 0, 0, 0, \
+    "mdbepl", NULL);
 
 int
 debug_malloc(unsigned long size, struct malloc_type *type, int flags,
@@ -220,9 +221,6 @@ debug_malloc_init(void)
 	debug_malloc_frees = 0;
 	debug_malloc_pages = 0;
 	debug_malloc_chunks_on_freelist = 0;
-
-	pool_init(&debug_malloc_pool, sizeof(struct debug_malloc_entry),
-	    0, 0, 0, "mdbepl", NULL);
 }
 
 /*
Index: kern/kern_proc.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_proc.c,v
retrieving revision 1.75
diff -d -p -u -r1.75 kern_proc.c
--- kern/kern_proc.c	14 Mar 2004 01:08:47 -0000	1.75
+++ kern/kern_proc.c	5 Apr 2004 05:46:25 -0000
@@ -166,24 +166,39 @@ static uint pid_alloc_cnt;	/* number of 
 static uint next_free_pt, last_free_pt;
 static pid_t pid_max = PID_MAX;		/* largest value we allocate */
 
-struct pool proc_pool;
-struct pool lwp_pool;
-struct pool lwp_uc_pool;
-struct pool pcred_pool;
-struct pool plimit_pool;
-struct pool pstats_pool;
-struct pool pgrp_pool;
-struct pool rusage_pool;
-struct pool ras_pool;
-struct pool sadata_pool;
-struct pool saupcall_pool;
-struct pool sastack_pool;
-struct pool savp_pool;
-struct pool ptimer_pool;
+POOL_INIT(proc_pool, sizeof(struct proc), 0, 0, 0, "procpl", \
+    &pool_allocator_nointr);
+POOL_INIT(lwp_pool, sizeof(struct lwp), 0, 0, 0, "lwppl", \
+    &pool_allocator_nointr);
+POOL_INIT(lwp_uc_pool, sizeof(ucontext_t), 0, 0, 0, "lwpucpl", \
+    &pool_allocator_nointr);
+POOL_INIT(pgrp_pool, sizeof(struct pgrp), 0, 0, 0, "pgrppl", \
+    &pool_allocator_nointr);
+POOL_INIT(pcred_pool, sizeof(struct pcred), 0, 0, 0, "pcredpl", \
+    &pool_allocator_nointr);
+POOL_INIT(plimit_pool, sizeof(struct plimit), 0, 0, 0, "plimitpl", \
+    &pool_allocator_nointr);
+POOL_INIT(pstats_pool, sizeof(struct pstats), 0, 0, 0, "pstatspl", \
+    &pool_allocator_nointr);
+POOL_INIT(rusage_pool, sizeof(struct rusage), 0, 0, 0, "rusgepl", \
+    &pool_allocator_nointr);
+POOL_INIT(ras_pool, sizeof(struct ras), 0, 0, 0, "raspl", \
+    &pool_allocator_nointr);
+POOL_INIT(sadata_pool, sizeof(struct sadata), 0, 0, 0, "sadatapl", \
+    &pool_allocator_nointr);
+POOL_INIT(saupcall_pool, sizeof(struct sadata_upcall), 0, 0, 0, "saupcpl", \
+    &pool_allocator_nointr);
+POOL_INIT(sastack_pool, sizeof(struct sastack), 0, 0, 0, "sastackpl", \
+    &pool_allocator_nointr);
+POOL_INIT(savp_pool, sizeof(struct sadata_vp), 0, 0, 0, "savppl", \
+    &pool_allocator_nointr);
+POOL_INIT(ptimer_pool, sizeof(struct ptimer), 0, 0, 0, "ptimerpl", \
+    &pool_allocator_nointr);
+POOL_INIT(session_pool, sizeof(struct session), 0, 0, 0, "sessionpl", \
+    &pool_allocator_nointr);
 
 MALLOC_DEFINE(M_EMULDATA, "emuldata", "Per-process emulation data");
 MALLOC_DEFINE(M_PROC, "proc", "Proc structures");
-MALLOC_DEFINE(M_SESSION, "session", "session header");
 MALLOC_DEFINE(M_SUBPROC, "subproc", "Proc sub-structures");
 
 /*
@@ -236,35 +251,6 @@ procinit(void)
 
 	uihashtbl =
 	    hashinit(maxproc / 16, HASH_LIST, M_PROC, M_WAITOK, &uihash);
-
-	pool_init(&proc_pool, sizeof(struct proc), 0, 0, 0, "procpl",
-	    &pool_allocator_nointr);
-	pool_init(&lwp_pool, sizeof(struct lwp), 0, 0, 0, "lwppl",
-	    &pool_allocator_nointr);
-	pool_init(&lwp_uc_pool, sizeof(ucontext_t), 0, 0, 0, "lwpucpl",
-	    &pool_allocator_nointr);
-	pool_init(&pgrp_pool, sizeof(struct pgrp), 0, 0, 0, "pgrppl",
-	    &pool_allocator_nointr);
-	pool_init(&pcred_pool, sizeof(struct pcred), 0, 0, 0, "pcredpl",
-	    &pool_allocator_nointr);
-	pool_init(&plimit_pool, sizeof(struct plimit), 0, 0, 0, "plimitpl",
-	    &pool_allocator_nointr);
-	pool_init(&pstats_pool, sizeof(struct pstats), 0, 0, 0, "pstatspl",
-	    &pool_allocator_nointr);
-	pool_init(&rusage_pool, sizeof(struct rusage), 0, 0, 0, "rusgepl",
-	    &pool_allocator_nointr);
-	pool_init(&ras_pool, sizeof(struct ras), 0, 0, 0, "raspl",
-	    &pool_allocator_nointr);
-	pool_init(&sadata_pool, sizeof(struct sadata), 0, 0, 0, "sadatapl",
-	    &pool_allocator_nointr);
-	pool_init(&saupcall_pool, sizeof(struct sadata_upcall), 0, 0, 0,
-	    "saupcpl", &pool_allocator_nointr);
-	pool_init(&sastack_pool, sizeof(struct sastack), 0, 0, 0, "sastackpl",
-	    &pool_allocator_nointr);
-	pool_init(&savp_pool, sizeof(struct sadata_vp), 0, 0, 0, "savppl",
-	    &pool_allocator_nointr);
-	pool_init(&ptimer_pool, sizeof(struct ptimer), 0, 0, 0, "ptimerpl",
-	    &pool_allocator_nointr);
 }
 
 /*
@@ -679,8 +665,7 @@ enterpgrp(struct proc *p, pid_t pgid, in
 		new_pgrp = NULL;
 	}
 	if (mksess)
-		MALLOC(sess, struct session *, sizeof(struct session),
-			    M_SESSION, M_WAITOK);
+		sess = pool_get(&session_pool, M_WAITOK);
 	else
 		sess = NULL;
 
@@ -797,7 +782,7 @@ enterpgrp(struct proc *p, pid_t pgid, in
     done:
 	proclist_unlock_write(s);
 	if (sess != NULL)
-		free(sess, M_SESSION);
+		pool_put(&session_pool, sess);
 	if (new_pgrp != NULL)
 		pool_put(&pgrp_pool, new_pgrp);
 	if (pg_id != NO_PGID)
@@ -927,7 +912,7 @@ sessdelete(struct session *ss)
 
 	pg_free(ss->s_sid);
 
-	FREE(ss, M_SESSION);
+	pool_put(&session_pool, ss);
 }
 
 /*
Index: kern/kern_prot.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_prot.c,v
retrieving revision 1.80
diff -d -p -u -r1.80 kern_prot.c
--- kern/kern_prot.c	7 Aug 2003 16:31:47 -0000	1.80
+++ kern/kern_prot.c	5 Apr 2004 05:46:25 -0000
@@ -52,14 +52,15 @@ __KERNEL_RCSID(0, "$NetBSD: kern_prot.c,
 #include <sys/proc.h>
 #include <sys/timeb.h>
 #include <sys/times.h>
-#include <sys/malloc.h>
+#include <sys/pool.h>
 #include <sys/syslog.h>
 
 #include <sys/mount.h>
 #include <sys/sa.h>
 #include <sys/syscallargs.h>
 
-MALLOC_DEFINE(M_CRED, "cred", "credentials");
+POOL_INIT(cred_pool, sizeof(struct ucred), 0, 0, 0, "credpl", \
+    &pool_allocator_nointr);
 
 int	sys_getpid(struct lwp *, void *, register_t *);
 int	sys_getpid_with_ppid(struct lwp *, void *, register_t *);
@@ -616,8 +617,8 @@ crget(void)
 {
 	struct ucred *cr;
 
-	MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK);
-	memset((caddr_t)cr, 0, sizeof(*cr));
+	cr = pool_get(&cred_pool, PR_WAITOK);
+	memset(cr, 0, sizeof(*cr));
 	cr->cr_ref = 1;
 	return (cr);
 }
@@ -631,7 +632,7 @@ crfree(struct ucred *cr)
 {
 
 	if (--cr->cr_ref == 0)
-		FREE((caddr_t)cr, M_CRED);
+		pool_put(&cred_pool, cr);
 }
 
 /*
Index: kern/kern_sig.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_sig.c,v
retrieving revision 1.193
diff -d -p -u -r1.193 kern_sig.c
--- kern/kern_sig.c	3 Apr 2004 19:46:10 -0000	1.193
+++ kern/kern_sig.c	5 Apr 2004 05:46:26 -0000
@@ -89,9 +89,11 @@ static void	kpsignal2(struct proc *, con
 
 sigset_t	contsigmask, stopsigmask, sigcantmask, sigtrapmask;
 
-struct pool	sigacts_pool;	/* memory pool for sigacts structures */
-struct pool	siginfo_pool;	/* memory pool for siginfo structures */
-struct pool	ksiginfo_pool;	/* memory pool for ksiginfo structures */
+POOL_INIT(sigacts_pool, sizeof(struct sigacts), 0, 0, 0, "sigapl", \
+    &pool_allocator_nointr);
+POOL_INIT(siginfo_pool, sizeof(siginfo_t), 0, 0, 0, "siginfo", \
+    &pool_allocator_nointr);
+POOL_INIT(ksiginfo_pool, sizeof(ksiginfo_t), 0, 0, 0, "ksiginfo", NULL);
 
 /*
  * Can process p, with pcred pc, send the signal signum to process q?
@@ -203,12 +205,7 @@ ksiginfo_exithook(struct proc *p, void *
 void
 signal_init(void)
 {
-	pool_init(&sigacts_pool, sizeof(struct sigacts), 0, 0, 0, "sigapl",
-	    &pool_allocator_nointr);
-	pool_init(&siginfo_pool, sizeof(siginfo_t), 0, 0, 0, "siginfo",
-	    &pool_allocator_nointr);
-	pool_init(&ksiginfo_pool, sizeof(ksiginfo_t), 0, 0, 0, "ksiginfo",
-	    NULL);
+
 	exithook_establish(ksiginfo_exithook, NULL);
 	exechook_establish(ksiginfo_exithook, NULL);
 
Index: kern/kern_systrace.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_systrace.c,v
retrieving revision 1.37
diff -d -p -u -r1.37 kern_systrace.c
--- kern/kern_systrace.c	14 Mar 2004 00:48:58 -0000	1.37
+++ kern/kern_systrace.c	5 Apr 2004 05:46:27 -0000
@@ -199,9 +199,18 @@ static struct fileops systracefops = {
 #endif
 };
 
+#ifdef __NetBSD__
+POOL_INIT(systr_proc_pl, sizeof(struct str_process), 0, 0, 0, "strprocpl", \
+    NULL);
+POOL_INIT(systr_policy_pl, sizeof(struct str_policy), 0, 0, 0, "strpolpl", \
+    NULL);
+POOL_INIT(systr_msgcontainer_pl, sizeof(struct str_msgcontainer), 0, 0, 0, \
+    "strmsgpl", NULL);
+#else
 struct pool systr_proc_pl;
 struct pool systr_policy_pl;
 struct pool systr_msgcontainer_pl;
+#endif
 
 int systrace_debug = 0;
 struct lock systrace_lck;
@@ -563,12 +572,15 @@ systrace_unlock(void)
 void
 systrace_init(void)
 {
+
+#ifndef __NetBSD__
 	pool_init(&systr_proc_pl, sizeof(struct str_process), 0, 0, 0,
 	    "strprocpl", NULL);
 	pool_init(&systr_policy_pl, sizeof(struct str_policy), 0, 0, 0,
 	    "strpolpl", NULL);
 	pool_init(&systr_msgcontainer_pl, sizeof(struct str_msgcontainer),
 	    0, 0, 0, "strmsgpl", NULL);
+#endif
 	lockinit(&systrace_lck, PLOCK, "systrace", 0, 0);
 }
 
Index: kern/subr_pool.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_pool.c,v
retrieving revision 1.93
diff -d -p -u -r1.93 subr_pool.c
--- kern/subr_pool.c	8 Mar 2004 22:48:09 -0000	1.93
+++ kern/subr_pool.c	5 Apr 2004 05:46:28 -0000
@@ -357,6 +357,21 @@ pr_rmpage(struct pool *pp, struct pool_i
 }
 
 /*
+ * Initialize all the pools listed in the "pools" link set.
+ */
+void
+link_pool_init(void)
+{
+	__link_set_decl(pools, struct link_pool_init);
+	struct link_pool_init * const *pi;
+
+	__link_set_foreach(pi, pools)
+		pool_init((*pi)->pp, (*pi)->size, (*pi)->align,
+		    (*pi)->align_offset, (*pi)->flags, (*pi)->wchan,
+		    (*pi)->palloc);
+}
+
+/*
  * Initialize the given pool resource structure.
  *
  * We export this routine to allow other kernel parts to declare
Index: kern/sys_pipe.c
===================================================================
RCS file: /cvsroot/src/sys/kern/sys_pipe.c,v
retrieving revision 1.55
diff -d -p -u -r1.55 sys_pipe.c
--- kern/sys_pipe.c	24 Mar 2004 20:25:28 -0000	1.55
+++ kern/sys_pipe.c	5 Apr 2004 05:46:37 -0000
@@ -202,7 +202,8 @@ static int pipe_loan_alloc(struct pipe *
 static void pipe_loan_free(struct pipe *);
 #endif /* PIPE_NODIRECT */
 
-static struct pool pipe_pool;
+static POOL_INIT(pipe_pool, sizeof(struct pipe), 0, 0, 0, "pipepl", \
+    &pool_allocator_nointr);
 
 /*
  * The pipe system call for the DTYPE_PIPE type of pipes
@@ -1507,14 +1508,3 @@ SYSCTL_SETUP(sysctl_kern_pipe_setup, "sy
 		       NULL, 0, &amountpipekva, 0,
 		       CTL_KERN, KERN_PIPE, KERN_PIPE_KVASIZE, CTL_EOL);
 }
-
-/*
- * Initialize pipe structs.
- */
-void
-pipe_init(void)
-{
-
-	pool_init(&pipe_pool, sizeof(struct pipe), 0, 0, 0, "pipepl",
-	    &pool_allocator_nointr);
-}
Index: kern/sysv_shm.c
===================================================================
RCS file: /cvsroot/src/sys/kern/sysv_shm.c,v
retrieving revision 1.76
diff -d -p -u -r1.76 sysv_shm.c
--- kern/sysv_shm.c	23 Mar 2004 13:22:33 -0000	1.76
+++ kern/sysv_shm.c	5 Apr 2004 05:46:37 -0000
@@ -122,7 +122,8 @@ struct shmmap_entry {
 	int shmid;
 };
 
-static struct pool shmmap_entry_pool;
+static POOL_INIT(shmmap_entry_pool, sizeof(struct shmmap_entry), 0, 0, 0, \
+    "shmmp", 0);
 
 struct shmmap_state {
 	unsigned int nitems;
@@ -713,7 +714,4 @@ shminit()
 	shm_last_free = 0;
 	shm_nused = 0;
 	shm_committed = 0;
-
-	pool_init(&shmmap_entry_pool, sizeof(struct shmmap_entry), 0, 0, 0,
-		  "shmmp", 0);
 }
Index: kern/tty.c
===================================================================
RCS file: /cvsroot/src/sys/kern/tty.c,v
retrieving revision 1.165
diff -d -p -u -r1.165 tty.c
--- kern/tty.c	24 Mar 2004 15:34:53 -0000	1.165
+++ kern/tty.c	5 Apr 2004 05:46:38 -0000
@@ -171,7 +171,8 @@ struct simplelock ttylist_slock = SIMPLE
 struct ttylist_head ttylist;	/* TAILQ_HEAD */
 int tty_count;
 
-struct pool tty_pool;
+POOL_INIT(tty_pool, sizeof(struct tty), 0, 0, 0, "ttypl", \
+    &pool_allocator_nointr);
 
 u_int64_t tk_cancc;
 u_int64_t tk_nin;
@@ -2499,9 +2500,6 @@ tty_init(void)
 
 	TAILQ_INIT(&ttylist);
 	tty_count = 0;
-
-	pool_init(&tty_pool, sizeof(struct tty), 0, 0, 0, "ttypl",
-	    &pool_allocator_nointr);
 }
 
 /*
Index: kern/uipc_socket.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_socket.c,v
retrieving revision 1.97
diff -d -p -u -r1.97 uipc_socket.c
--- kern/uipc_socket.c	24 Mar 2004 15:34:53 -0000	1.97
+++ kern/uipc_socket.c	5 Apr 2004 05:46:39 -0000
@@ -94,7 +94,7 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_socket.
 
 #include <uvm/uvm.h>
 
-struct pool	socket_pool;
+POOL_INIT(socket_pool, sizeof(struct socket), 0, 0, 0, "sockpl", NULL);
 
 MALLOC_DEFINE(M_SOOPTS, "soopts", "socket options");
 MALLOC_DEFINE(M_SONAME, "soname", "socket name");
@@ -130,9 +130,6 @@ soinit(void)
 	if (sb_max_set(sb_max))
 		panic("bad initial sb_max value: %lu\n", sb_max);
 
-	pool_init(&socket_pool, sizeof(struct socket), 0, 0, 0,
-	    "sockpl", NULL);
-
 #ifdef SOSEND_COUNTERS
 	evcnt_attach_static(&sosend_loan_big);
 	evcnt_attach_static(&sosend_copy_big);
Index: kern/vfs_cache.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_cache.c,v
retrieving revision 1.54
diff -d -p -u -r1.54 vfs_cache.c
--- kern/vfs_cache.c	1 Sep 2003 12:13:55 -0000	1.54
+++ kern/vfs_cache.c	5 Apr 2004 05:46:40 -0000
@@ -85,7 +85,8 @@ u_long	ncvhash;			/* size of hash table 
 TAILQ_HEAD(, namecache) nclruhead;		/* LRU chain */
 struct	nchstats nchstats;		/* cache effectiveness statistics */
 
-struct pool namecache_pool;
+POOL_INIT(namecache_pool, sizeof(struct namecache), 0, 0, 0, "ncachepl", \
+    &pool_allocator_nointr);
 
 MALLOC_DEFINE(M_CACHE, "namecache", "Dynamically allocated cache entries");
 
@@ -476,8 +477,6 @@ nchinit(void)
 #else
 	    hashinit(desiredvnodes/8, HASH_LIST, M_CACHE, M_WAITOK, &ncvhash);
 #endif
-	pool_init(&namecache_pool, sizeof(struct namecache), 0, 0, 0,
-	    "ncachepl", &pool_allocator_nointr);
 }
 
 /*
Index: kern/vfs_lockf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_lockf.c,v
retrieving revision 1.34
diff -d -p -u -r1.34 vfs_lockf.c
--- kern/vfs_lockf.c	25 Oct 2003 09:13:41 -0000	1.34
+++ kern/vfs_lockf.c	5 Apr 2004 05:46:41 -0000
@@ -43,11 +43,12 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_lockf.c,
 #include <sys/file.h>
 #include <sys/proc.h>
 #include <sys/vnode.h>
-#include <sys/malloc.h>
+#include <sys/pool.h>
 #include <sys/fcntl.h>
 #include <sys/lockf.h>
 
-MALLOC_DEFINE(M_LOCKF, "lockf", "Byte-range locking structures");
+POOL_INIT(lockfpool, sizeof(struct lockf), 0, 0, 0, "lockfpl", \
+    &pool_allocator_nointr);
 
 /*
  * This variable controls the maximum number of processes that will
@@ -82,8 +83,6 @@ static void lf_printlist(char *, struct 
  * Misc cleanups: "caddr_t id" should be visible in the API as a
  * "struct proc *".
  * (This requires rototilling all VFS's which support advisory locking).
- *
- * Use pools for lock allocation.
  */
 
 /*
@@ -143,8 +142,7 @@ lf_advlock(struct vop_advlock_args *ap, 
 			/*
 			 * byte-range lock might need one more lock.
 			 */
-			MALLOC(sparelock, struct lockf *, sizeof(*lock),
-			    M_LOCKF, M_WAITOK);
+			sparelock = pool_get(&lockfpool, PR_WAITOK);
 			if (sparelock == NULL) {
 				error = ENOMEM;
 				goto quit;
@@ -161,7 +159,7 @@ lf_advlock(struct vop_advlock_args *ap, 
 		return EINVAL;
 	}
 
-	MALLOC(lock, struct lockf *, sizeof(*lock), M_LOCKF, M_WAITOK);
+	lock = pool_get(&lockfpool, PR_WAITOK);
 	if (lock == NULL) {
 		error = ENOMEM;
 		goto quit;
@@ -233,9 +231,9 @@ quit_unlock:
 	simple_unlock(interlock);
 quit:
 	if (lock)
-		FREE(lock, M_LOCKF);
+		pool_put(&lockfpool, lock);
 	if (sparelock)
-		FREE(sparelock, M_LOCKF);
+		pool_put(&lockfpool, sparelock);
 
 	return error;
 }
@@ -273,7 +271,7 @@ lf_setlock(struct lockf *lock, struct lo
 		 * Free the structure and return if nonblocking.
 		 */
 		if ((lock->lf_flags & F_WAIT) == 0) {
-			FREE(lock, M_LOCKF);
+			pool_put(&lockfpool, lock);
 			return EAGAIN;
 		}
 		/*
@@ -306,7 +304,7 @@ lf_setlock(struct lockf *lock, struct lo
 					break;
 				wlwp = waitblock->lf_lwp;
 				if (wlwp == lock->lf_lwp) {
-					free(lock, M_LOCKF);
+					pool_put(&lockfpool, lock);
 					return EDEADLK;
 				}
 			}
@@ -316,7 +314,7 @@ lf_setlock(struct lockf *lock, struct lo
 			 * a cycle to be safe.
 			 */
 			if (i >= maxlockdepth) {
-				free(lock, M_LOCKF);
+				pool_put(&lockfpool, lock);
 				return EDEADLK;
 			}
 		}
@@ -358,7 +356,7 @@ lf_setlock(struct lockf *lock, struct lo
 			lock->lf_next = NOLOCKF;
 		}
 		if (error) {
-			free(lock, M_LOCKF);
+			pool_put(&lockfpool, lock);
 			return error;
 		}
 	}
@@ -404,7 +402,7 @@ lf_setlock(struct lockf *lock, struct lo
 			    overlap->lf_type == F_WRLCK)
 				lf_wakelock(overlap);
 			overlap->lf_type = lock->lf_type;
-			FREE(lock, M_LOCKF);
+			pool_put(&lockfpool, lock);
 			lock = overlap; /* for debug output below */
 			break;
 
@@ -413,7 +411,7 @@ lf_setlock(struct lockf *lock, struct lo
 			 * Check for common starting point and different types.
 			 */
 			if (overlap->lf_type == lock->lf_type) {
-				free(lock, M_LOCKF);
+				pool_put(&lockfpool, lock);
 				lock = overlap; /* for debug output below */
 				break;
 			}
@@ -454,7 +452,7 @@ lf_setlock(struct lockf *lock, struct lo
 				needtolink = 0;
 			} else
 				*prev = overlap->lf_next;
-			free(overlap, M_LOCKF);
+			pool_put(&lockfpool, overlap);
 			continue;
 
 		case 4: /* overlap starts before lock */
@@ -526,7 +524,7 @@ lf_clearlock(struct lockf *unlock, struc
 
 		case 1: /* overlap == lock */
 			*prev = overlap->lf_next;
-			FREE(overlap, M_LOCKF);
+			pool_put(&lockfpool, overlap);
 			break;
 
 		case 2: /* overlap contains lock: split it */
@@ -541,7 +539,7 @@ lf_clearlock(struct lockf *unlock, struc
 		case 3: /* lock contains overlap */
 			*prev = overlap->lf_next;
 			lf = overlap->lf_next;
-			free(overlap, M_LOCKF);
+			pool_put(&lockfpool, overlap);
 			continue;
 
 		case 4: /* overlap starts before lock */
Index: kern/vfs_subr.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_subr.c,v
retrieving revision 1.218
diff -d -p -u -r1.218 vfs_subr.c
--- kern/vfs_subr.c	24 Mar 2004 15:34:53 -0000	1.218
+++ kern/vfs_subr.c	5 Apr 2004 05:46:43 -0000
@@ -170,7 +170,8 @@ struct mount *rootfs;
 struct vnode *rootvnode;
 struct device *root_device;			/* root device */
 
-struct pool vnode_pool;				/* memory pool for vnodes */
+POOL_INIT(vnode_pool, sizeof(struct vnode), 0, 0, 0, "vnodepl", \
+    &pool_allocator_nointr);
 
 MALLOC_DEFINE(M_VNODE, "vnodes", "Dynamically allocated vnodes");
 
@@ -200,9 +201,6 @@ void
 vntblinit()
 {
 
-	pool_init(&vnode_pool, sizeof(struct vnode), 0, 0, 0, "vnodepl",
-	    &pool_allocator_nointr);
-
 	/*
 	 * Initialize the filesystem syncer.
 	 */
Index: net/route.c
===================================================================
RCS file: /cvsroot/src/sys/net/route.c,v
retrieving revision 1.58
diff -d -p -u -r1.58 route.c
--- net/route.c	7 Aug 2003 16:32:57 -0000	1.58
+++ net/route.c	5 Apr 2004 05:46:44 -0000
@@ -135,8 +135,8 @@ struct	radix_node_head *rt_tables[AF_MAX
 int	rttrash;		/* routes not in table but not freed */
 struct	sockaddr wildcard;	/* zero valued cookie for wildcard searches */
 
-struct pool rtentry_pool;	/* pool for rtentry structures */
-struct pool rttimer_pool;	/* pool for rttimer structures */
+POOL_INIT(rtentry_pool, sizeof(struct rtentry), 0, 0, 0, "rtentpl", NULL);
+POOL_INIT(rttimer_pool, sizeof(struct rttimer), 0, 0, 0, "rttmrpl", NULL);
 
 struct callout rt_timer_ch; /* callout for rt_timer_timer() */
 
@@ -159,9 +159,6 @@ void
 route_init()
 {
 
-	pool_init(&rtentry_pool, sizeof(struct rtentry), 0, 0, 0, "rtentpl",
-	    NULL);
-
 	rn_init();	/* initialize all zeroes, all ones, mask table */
 	rtable_init((void **)rt_tables);
 }
@@ -873,9 +870,6 @@ rt_timer_init()
 {
 	assert(rt_init_done == 0);
 
-	pool_init(&rttimer_pool, sizeof(struct rttimer), 0, 0, 0, "rttmrpl",
-	    NULL);
-
 	LIST_INIT(&rttimer_queue_head);
 	callout_init(&rt_timer_ch);
 	callout_reset(&rt_timer_ch, hz, rt_timer_timer, NULL);
Index: netinet/igmp.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/igmp.c,v
retrieving revision 1.36
diff -d -p -u -r1.36 igmp.c
--- netinet/igmp.c	22 Aug 2003 21:53:02 -0000	1.36
+++ netinet/igmp.c	5 Apr 2004 05:46:45 -0000
@@ -65,7 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.3
 
 #define IP_MULTICASTOPTS	0
 
-struct pool igmp_rti_pool;
+POOL_INIT(igmp_rti_pool, sizeof(struct router_info), 0, 0, 0, "igmppl", NULL);
 struct igmpstat igmpstat;
 int igmp_timers_are_running;
 static LIST_HEAD(, router_info) rti_head = LIST_HEAD_INITIALIZER(rti_head);
@@ -75,14 +75,6 @@ static int rti_fill __P((struct in_multi
 static struct router_info *rti_find __P((struct ifnet *));
 static void rti_delete(struct ifnet *);
 
-void
-igmp_init()
-{
-	igmp_timers_are_running = 0;
-	pool_init(&igmp_rti_pool, sizeof(struct router_info), 0, 0, 0, "igmppl",
-	    NULL);
-}
-
 static int
 rti_fill(inm)
 	struct in_multi *inm;
Index: netinet/igmp_var.h
===================================================================
RCS file: /cvsroot/src/sys/netinet/igmp_var.h,v
retrieving revision 1.18
diff -d -p -u -r1.18 igmp_var.h
--- netinet/igmp_var.h	7 Oct 2003 21:24:56 -0000	1.18
+++ netinet/igmp_var.h	5 Apr 2004 05:46:45 -0000
@@ -113,7 +113,6 @@ extern	struct igmpstat igmpstat;
 #define	IGMP_HDR_ALIGNED_P(ig)	((((vaddr_t) (ig)) & 3) == 0)
 #endif
 
-void	igmp_init __P((void));
 void	igmp_input __P((struct mbuf *, ...));
 int	igmp_joingroup __P((struct in_multi *));
 void	igmp_leavegroup __P((struct in_multi *));
Index: netinet/in_pcb.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/in_pcb.c,v
retrieving revision 1.94
diff -d -p -u -r1.94 in_pcb.c
--- netinet/in_pcb.c	2 Mar 2004 02:26:28 -0000	1.94
+++ netinet/in_pcb.c	5 Apr 2004 05:46:46 -0000
@@ -157,20 +157,13 @@ int	anonportmax = IPPORT_ANONMAX;
 int	lowportmin  = IPPORT_RESERVEDMIN;
 int	lowportmax  = IPPORT_RESERVEDMAX;
 
-struct pool inpcb_pool;
+POOL_INIT(inpcb_pool, sizeof(struct inpcb), 0, 0, 0, "inpcbpl", NULL);
 
 void
 in_pcbinit(table, bindhashsize, connecthashsize)
 	struct inpcbtable *table;
 	int bindhashsize, connecthashsize;
 {
-	static int inpcb_pool_initialized;
-
-	if (inpcb_pool_initialized == 0) {
-		pool_init(&inpcb_pool, sizeof(struct inpcb), 0, 0, 0,
-		    "inpcbpl", NULL);
-		inpcb_pool_initialized = 1;
-	}
 
 	CIRCLEQ_INIT(&table->inpt_queue);
 	table->inpt_porthashtbl = hashinit(bindhashsize, HASH_LIST, M_PCB,
Index: netinet/in_proto.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/in_proto.c,v
retrieving revision 1.62
diff -d -p -u -r1.62 in_proto.c
--- netinet/in_proto.c	4 Dec 2003 19:38:24 -0000	1.62
+++ netinet/in_proto.c	5 Apr 2004 05:46:46 -0000
@@ -235,7 +235,7 @@ struct protosw inetsw[] = {
 { SOCK_RAW,	&inetdomain,	IPPROTO_IGMP,	PR_ATOMIC|PR_ADDR|PR_LASTHDR,
   igmp_input,	rip_output,	rip_ctlinput,	rip_ctloutput,
   rip_usrreq,
-  igmp_init,	igmp_fasttimo,	igmp_slowtimo,	0,
+  NULL,		igmp_fasttimo,	igmp_slowtimo,	0,
 },
 #ifdef TPIP
 { SOCK_SEQPACKET,&inetdomain,	IPPROTO_TP,	PR_CONNREQUIRED|PR_WANTRCVD|PR_LISTEN|PR_LASTHDR|PR_ABRTACPTDIS,
Index: netinet/ip_flow.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/ip_flow.c,v
retrieving revision 1.27
diff -d -p -u -r1.27 ip_flow.c
--- netinet/ip_flow.c	12 Dec 2003 21:17:59 -0000	1.27
+++ netinet/ip_flow.c	5 Apr 2004 05:46:46 -0000
@@ -65,7 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: ip_flow.c,v 
 #include <netinet/in_var.h>
 #include <netinet/ip_var.h>
 
-struct pool ipflow_pool;
+POOL_INIT(ipflow_pool, sizeof(struct ipflow), 0, 0, 0, "ipflowpl", NULL);
 
 LIST_HEAD(ipflowhead, ipflow);
 
@@ -131,9 +131,6 @@ ipflow_init()
 {
 	int i;
 
-	pool_init(&ipflow_pool, sizeof(struct ipflow), 0, 0, 0, "ipflowpl",
-	    NULL);
-
 	LIST_INIT(&ipflowlist);
 	for (i = 0; i < IPFLOW_HASHSIZE; i++)
 		LIST_INIT(&ipflowtable[i]);
Index: netinet/ip_input.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/ip_input.c,v
retrieving revision 1.198
diff -d -p -u -r1.198 ip_input.c
--- netinet/ip_input.c	1 Apr 2004 22:47:55 -0000	1.198
+++ netinet/ip_input.c	5 Apr 2004 05:46:48 -0000
@@ -333,8 +333,8 @@ do {									\
 
 #define	IPQ_UNLOCK()		ipq_unlock()
 
-struct pool inmulti_pool;
-struct pool ipqent_pool;
+POOL_INIT(inmulti_pool, sizeof(struct in_multi), 0, 0, 0, "inmltpl", NULL);
+POOL_INIT(ipqent_pool, sizeof(struct ipqent), 0, 0, 0, "ipqepl", NULL);
 
 #ifdef INET_CSUM_COUNTERS
 #include <sys/device.h>
@@ -396,11 +396,6 @@ ip_init()
 	struct protosw *pr;
 	int i;
 
-	pool_init(&inmulti_pool, sizeof(struct in_multi), 0, 0, 0, "inmltpl",
-	    NULL);
-	pool_init(&ipqent_pool, sizeof(struct ipqent), 0, 0, 0, "ipqepl",
-	    NULL);
-
 	pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW);
 	if (pr == 0)
 		panic("ip_init");
Index: netinet/tcp_input.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/tcp_input.c,v
retrieving revision 1.191
diff -d -p -u -r1.191 tcp_input.c
--- netinet/tcp_input.c	29 Mar 2004 04:59:02 -0000	1.191
+++ netinet/tcp_input.c	5 Apr 2004 05:46:51 -0000
@@ -2830,7 +2828,7 @@ do {									\
 		pool_put(&syn_cache_pool, (sc));			\
 } while (/*CONSTCOND*/0)
 
-struct pool syn_cache_pool;
+POOL_INIT(syn_cache_pool, sizeof(struct syn_cache), 0, 0, 0, "synpl", NULL);
 
 /*
  * We don't estimate RTT with SYNs, so each packet starts with the default
@@ -2855,10 +2853,6 @@ syn_cache_init()
 	/* Initialize the hash buckets. */
 	for (i = 0; i < tcp_syn_cache_size; i++)
 		TAILQ_INIT(&tcp_syn_cache[i].sch_bucket);
-
-	/* Initialize the syn cache pool. */
-	pool_init(&syn_cache_pool, sizeof(struct syn_cache), 0, 0, 0,
-	    "synpl", NULL);
 }
 
 void
Index: netinet/tcp_subr.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.160
diff -d -p -u -r1.160 tcp_subr.c
--- netinet/tcp_subr.c	7 Jan 2004 19:15:43 -0000	1.160
+++ netinet/tcp_subr.c	5 Apr 2004 05:46:53 -0000
@@ -225,7 +225,7 @@ void	tcp_mtudisc __P((struct inpcb *, in
 void	tcp6_mtudisc __P((struct in6pcb *, int));
 #endif
 
-struct pool tcpcb_pool;
+POOL_INIT(tcpcb_pool, sizeof(struct tcpcb), 0, 0, 0, "tcpcbpl", NULL);
 
 #ifdef TCP_CSUM_COUNTERS
 #include <sys/device.h>
@@ -314,8 +314,6 @@ tcp_init()
 	/* Initialize the TCPCB template. */
 	tcp_tcpcb_template();
 
-	pool_init(&tcpcb_pool, sizeof(struct tcpcb), 0, 0, 0, "tcpcbpl",
-	    NULL);
 	in_pcbinit(&tcbtable, tcbhashsize, tcbhashsize);
 
 	hlen = sizeof(struct ip) + sizeof(struct tcphdr);
Index: netinet6/in6_pcb.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/in6_pcb.c,v
retrieving revision 1.62
diff -d -p -u -r1.62 in6_pcb.c
--- netinet6/in6_pcb.c	29 Mar 2004 04:59:03 -0000	1.62
+++ netinet6/in6_pcb.c	5 Apr 2004 05:46:54 -0000
@@ -123,20 +123,13 @@ int ip6_anonportmax = IPV6PORT_ANONMAX;
 int ip6_lowportmin  = IPV6PORT_RESERVEDMIN;
 int ip6_lowportmax  = IPV6PORT_RESERVEDMAX;
 
-struct pool in6pcb_pool;
+POOL_INIT(in6pcb_pool, sizeof(struct in6pcb), 0, 0, 0, "in6pcbpl", NULL);
 
 void
 in6_pcbinit(table, bindhashsize, connecthashsize)
 	struct inpcbtable *table;
 	int bindhashsize, connecthashsize;
 {
-	static int in6pcb_pool_initialized;
-
-	if (in6pcb_pool_initialized == 0) {
-		pool_init(&in6pcb_pool, sizeof(struct in6pcb), 0, 0, 0,
-		    "in6pcbpl", NULL);
-		in6pcb_pool_initialized = 1;
-	}
 
 	in_pcbinit(table, bindhashsize, connecthashsize);
 	table->inpt_lastport = (u_int16_t)ip6_anonportmax;
Index: netsmb/smb_dev.c
===================================================================
RCS file: /cvsroot/src/sys/netsmb/smb_dev.c,v
retrieving revision 1.18
diff -d -p -u -r1.18 smb_dev.c
--- netsmb/smb_dev.c	29 Jun 2003 22:32:10 -0000	1.18
+++ netsmb/smb_dev.c	5 Apr 2004 05:46:54 -0000
@@ -176,8 +176,6 @@ nsmbattach(int num)
 		smb_sm_done();
 		return;
 	}
-
-	smb_rqinit();
 }
 #endif /* __NetBSD__ */
 
Index: netsmb/smb_rq.c
===================================================================
RCS file: /cvsroot/src/sys/netsmb/smb_rq.c,v
retrieving revision 1.24
diff -d -p -u -r1.24 smb_rq.c
--- netsmb/smb_rq.c	29 Jun 2003 22:32:10 -0000	1.24
+++ netsmb/smb_rq.c	5 Apr 2004 05:46:55 -0000
@@ -57,8 +57,12 @@ __KERNEL_RCSID(0, "$NetBSD: smb_rq.c,v 1
 MODULE_DEPEND(netsmb, libmchain, 1, 1, 1);
 #endif
 
-static struct pool smbrq_pool;
-static struct pool smbt2rq_pool;
+#ifdef __NetBSD__
+POOL_INIT(smbrq_pool, sizeof(struct smb_rq), 0, 0, 0, "smbrqpl", \
+    &pool_allocator_nointr);
+POOL_INIT(smbt2rq_pool, sizeof(struct smb_t2rq), 0, 0, 0, "smbt2pl", \
+    &pool_allocator_nointr);
+#endif
 
 static int  smb_rq_init(struct smb_rq *, struct smb_connobj *, u_char,
 		struct smb_cred *);
@@ -69,6 +73,7 @@ static int  smb_t2_init(struct smb_t2rq 
 		struct smb_cred *);
 static int  smb_t2_reply(struct smb_t2rq *t2p);
 
+#ifndef __NetBSD__
 int
 smb_rqinit(void)
 {
@@ -78,6 +83,7 @@ smb_rqinit(void)
 		"smbt2pl", &pool_allocator_nointr);
 	return (0);
 }
+#endif
 
 int
 smb_rq_alloc(struct smb_connobj *layer, u_char cmd, struct smb_cred *scred,
Index: netsmb/smb_rq.h
===================================================================
RCS file: /cvsroot/src/sys/netsmb/smb_rq.h,v
retrieving revision 1.10
diff -d -p -u -r1.10 smb_rq.h
--- netsmb/smb_rq.h	24 Feb 2004 15:22:01 -0000	1.10
+++ netsmb/smb_rq.h	5 Apr 2004 05:46:55 -0000
@@ -127,8 +127,6 @@ struct smb_t2rq {
 	struct smb_vc * t2_vc;
 };
 
-int  smb_rqinit(void);
-
 int  smb_rq_alloc(struct smb_connobj *layer, u_char cmd,
 	struct smb_cred *scred, struct smb_rq **rqpp);
 void smb_rq_done(struct smb_rq *rqp);
Index: nfs/nfs_node.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_node.c,v
retrieving revision 1.73
diff -d -p -u -r1.73 nfs_node.c
--- nfs/nfs_node.c	12 Mar 2004 16:52:37 -0000	1.73
+++ nfs/nfs_node.c	5 Apr 2004 05:46:55 -0000
@@ -63,8 +63,10 @@ struct nfsnodehashhead *nfsnodehashtbl;
 u_long nfsnodehash;
 struct lock nfs_hashlock;
 
-struct pool nfs_node_pool;		/* memory pool for nfs nodes */
-struct pool nfs_vattr_pool;		/* memory pool for nfs vattrs */
+POOL_INIT(nfs_node_pool, sizeof(struct nfsnode), 0, 0, 0, "nfsnodepl", \
+    &pool_allocator_nointr);
+POOL_INIT(nfs_vattr_pool, sizeof(struct vattr), 0, 0, 0, "nfsvapl", \
+    &pool_allocator_nointr);
 
 MALLOC_DEFINE(M_NFSBIGFH, "NFS bigfh", "NFS big filehandle");
 MALLOC_DEFINE(M_NFSNODE, "NFS node", "NFS vnode private part");
@@ -94,11 +96,6 @@ nfs_nhinit()
 	nfsnodehashtbl = hashinit(desiredvnodes, HASH_LIST, M_NFSNODE,
 	    M_WAITOK, &nfsnodehash);
 	lockinit(&nfs_hashlock, PINOD, "nfs_hashlock", 0, 0);
-
-	pool_init(&nfs_node_pool, sizeof(struct nfsnode), 0, 0, 0, "nfsnodepl",
-	    &pool_allocator_nointr);
-	pool_init(&nfs_vattr_pool, sizeof(struct vattr), 0, 0, 0, "nfsvapl",
-	    &pool_allocator_nointr);
 }
 
 /*
Index: sys/event.h
===================================================================
RCS file: /cvsroot/src/sys/sys/event.h,v
retrieving revision 1.12
diff -d -p -u -r1.12 event.h
--- sys/event.h	22 Feb 2004 17:45:26 -0000	1.12
+++ sys/event.h	5 Apr 2004 05:46:55 -0000
@@ -200,8 +200,6 @@ struct knote {
 
 struct proc;
 
-void		kqueue_init(void);
-
 void	knote(struct klist *, long);
 void	knote_remove(struct proc *, struct klist *);
 void	knote_fdclose(struct proc *, int);
Index: sys/file.h
===================================================================
RCS file: /cvsroot/src/sys/sys/file.h,v
retrieving revision 1.48
diff -d -p -u -r1.48 file.h
--- sys/file.h	22 Sep 2003 13:00:04 -0000	1.48
+++ sys/file.h	5 Apr 2004 05:46:55 -0000
@@ -160,8 +160,6 @@ int	dofilereadv(struct proc *, int, stru
 int	dofilewritev(struct proc *, int, struct file *,
 	    const struct iovec *, int, off_t *, int, register_t *);
 
-void	finit(void);
-
 int	fsetown(struct proc *, pid_t *, int, const void *);
 int	fgetown(struct proc *, pid_t, int, void *);
 void	fownsignal(pid_t, int, int, int, void *);
Index: sys/lockf.h
===================================================================
RCS file: /cvsroot/src/sys/sys/lockf.h,v
retrieving revision 1.14
diff -d -p -u -r1.14 lockf.h
--- sys/lockf.h	7 Aug 2003 16:34:07 -0000	1.14
+++ sys/lockf.h	5 Apr 2004 05:46:55 -0000
@@ -69,9 +69,7 @@ struct lockf {
 #define MAXDEPTH 50
 
 #ifdef _KERNEL
-
 int lf_advlock(struct vop_advlock_args *, struct lockf **, off_t);
-
 #endif /* _KERNEL */
 
 #endif /* !_SYS_LOCKF_H_ */
Index: sys/pipe.h
===================================================================
RCS file: /cvsroot/src/sys/sys/pipe.h,v
retrieving revision 1.13
diff -d -p -u -r1.13 pipe.h
--- sys/pipe.h	12 Feb 2003 21:54:15 -0000	1.13
+++ sys/pipe.h	5 Apr 2004 05:46:56 -0000
@@ -134,7 +134,6 @@ struct pipe {
 }
 
 #ifdef _KERNEL
-void pipe_init __P((void));
 int sysctl_dopipe __P((int *, u_int, void *, size_t *, void *, size_t));
 
 #define PIPE_LOCK(pipe)		simple_lock(&(pipe)->pipe_slock);
Index: sys/pool.h
===================================================================
RCS file: /cvsroot/src/sys/sys/pool.h,v
retrieving revision 1.42
diff -d -p -u -r1.42 pool.h
--- sys/pool.h	9 Jan 2004 19:00:16 -0000	1.42
+++ sys/pool.h	5 Apr 2004 05:46:56 -0000
@@ -216,6 +216,24 @@ struct pool {
 extern struct pool_allocator pool_allocator_kmem;
 extern struct pool_allocator pool_allocator_nointr;
 
+struct link_pool_init {	/* same as args to pool_init() */
+	struct pool *pp;
+	size_t size;
+	u_int align;
+	u_int align_offset;
+	int flags;
+	char *wchan;
+	struct pool_allocator *palloc;
+};
+#define	POOL_INIT(pp, size, align, align_offset, flags, wchan, palloc)	\
+struct pool pp;								\
+static const struct link_pool_init _link_ ## pp[1] = {			\
+	{ &pp, size, align, align_offset, flags, wchan, palloc }	\
+};									\
+__link_set_add_data(pools, _link_ ## pp)
+
+void		link_pool_init(void);
+
 void		pool_init(struct pool *, size_t, u_int, u_int,
 		    int, const char *, struct pool_allocator *);
 void		pool_destroy(struct pool *);
Index: ufs/ext2fs/ext2fs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ext2fs/ext2fs_vfsops.c,v
retrieving revision 1.66
diff -d -p -u -r1.66 ext2fs_vfsops.c
--- ufs/ext2fs/ext2fs_vfsops.c	24 Mar 2004 15:34:55 -0000	1.66
+++ ufs/ext2fs/ext2fs_vfsops.c	5 Apr 2004 05:46:57 -0000
@@ -146,8 +146,13 @@ struct genfs_ops ext2fs_genfsops = {
 	genfs_gop_write,
 };
 
-struct pool ext2fs_inode_pool;
-struct pool ext2fs_dinode_pool;
+/*
+ * XXX Same structure as FFS inodes?  Should we share a common pool?
+ */
+POOL_INIT(ext2fs_inode_pool, sizeof(struct inode), 0, 0, 0, "ext2fsinopl", \
+    &pool_allocator_nointr);
+POOL_INIT(ext2fs_dinode_pool, sizeof(struct ext2fs_dinode), 0, 0, 0, \
+    "ext2dinopl", &pool_allocator_nointr);
 
 extern u_long ext2gennumber;
 
@@ -155,14 +160,6 @@ void
 ext2fs_init()
 {
 	ufs_init();
-
-	/*
-	 * XXX Same structure as FFS inodes?  Should we share a common pool?
-	 */
-	pool_init(&ext2fs_inode_pool, sizeof(struct inode), 0, 0, 0,
-	    "ext2fsinopl", &pool_allocator_nointr);
-	pool_init(&ext2fs_dinode_pool, sizeof(struct ext2fs_dinode), 0, 0, 0,
-	    "ext2dinopl", &pool_allocator_nointr);
 }
 
 void
Index: ufs/ffs/ffs_softdep.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_softdep.c,v
retrieving revision 1.57
diff -d -p -u -r1.57 ffs_softdep.c
--- ufs/ffs/ffs_softdep.c	11 Mar 2004 11:50:43 -0000	1.57
+++ ufs/ffs/ffs_softdep.c	5 Apr 2004 05:47:01 -0000
@@ -57,7 +57,9 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_softdep.
 #include <ufs/ufs/ufs_bswap.h>
 
 #include <uvm/uvm.h>
-struct pool sdpcpool;
+
+static POOL_INIT(sdpcpool, sizeof(struct buf), 0, 0, 0, "sdpcpool", \
+    &pool_allocator_nointr);
 u_int softdep_lockedbufs;
 
 extern struct simplelock bqueue_slock; /* XXX */
@@ -380,20 +382,34 @@ sema_release(semap)
  * Memory management.
  */
 
-static struct pool pagedep_pool;
-static struct pool inodedep_pool;
-static struct pool newblk_pool;
-static struct pool bmsafemap_pool;
-static struct pool allocdirect_pool;
-static struct pool indirdep_pool;
-static struct pool allocindir_pool;
-static struct pool freefrag_pool;
-static struct pool freeblks_pool;
-static struct pool freefile_pool;
-static struct pool diradd_pool;
-static struct pool mkdir_pool;
-static struct pool dirrem_pool;
-static struct pool newdirblk_pool;
+static POOL_INIT(pagedep_pool, sizeof(struct pagedep), 0, 0, 0, "pagedeppl", \
+    &pool_allocator_nointr);
+static POOL_INIT(inodedep_pool, sizeof(struct inodedep), 0, 0, 0, \
+    "inodedeppl", &pool_allocator_nointr);
+static POOL_INIT(newblk_pool, sizeof(struct newblk), 0, 0, 0, "newblkpl", \
+    &pool_allocator_nointr);
+static POOL_INIT(bmsafemap_pool, sizeof(struct bmsafemap), 0, 0, 0, \
+    "bmsafemappl", &pool_allocator_nointr);
+static POOL_INIT(allocdirect_pool, sizeof(struct allocdirect), 0, 0, 0, \
+    "allocdirectpl", &pool_allocator_nointr);
+static POOL_INIT(indirdep_pool, sizeof(struct indirdep), 0, 0, 0, \
+    "indirdeppl", &pool_allocator_nointr);
+static POOL_INIT(allocindir_pool, sizeof(struct allocindir), 0, 0, 0, \
+    "allocindirpl", &pool_allocator_nointr);
+static POOL_INIT(freefrag_pool, sizeof(struct freefrag), 0, 0, 0, \
+    "freefragpl", &pool_allocator_nointr);
+static POOL_INIT(freeblks_pool, sizeof(struct freeblks), 0, 0, 0, \
+    "freeblkspl", &pool_allocator_nointr);
+static POOL_INIT(freefile_pool, sizeof(struct freefile), 0, 0, 0, \
+    "freefilepl", &pool_allocator_nointr);
+static POOL_INIT(diradd_pool, sizeof(struct diradd), 0, 0, 0, "diraddpl", \
+    &pool_allocator_nointr);
+static POOL_INIT(mkdir_pool, sizeof(struct mkdir), 0, 0, 0, "mkdirpl", \
+    &pool_allocator_nointr);
+static POOL_INIT(dirrem_pool, sizeof(struct dirrem), 0, 0, 0, "dirrempl", \
+    &pool_allocator_nointr);
+static POOL_INIT(newdirblk_pool, sizeof (struct newdirblk), 0, 0, 0, \
+    "newdirblkpl", &pool_allocator_nointr);
 
 static __inline void
 softdep_free(struct worklist *item, int type)
@@ -1199,40 +1215,9 @@ softdep_initialize()
 	newblk_hashtbl = hashinit(64, HASH_LIST, M_NEWBLK, M_WAITOK,
 	    &newblk_hash);
 	sema_init(&newblk_in_progress, "newblk", PRIBIO, 0);
-	pool_init(&sdpcpool, sizeof(struct buf), 0, 0, 0, "sdpcpool",
-	    &pool_allocator_nointr);
 	for (i = 0; i < PCBPHASHSIZE; i++) {
 		LIST_INIT(&pcbphashhead[i]);
 	}
-
-	pool_init(&pagedep_pool, sizeof(struct pagedep), 0, 0, 0,
-	    "pagedeppl", &pool_allocator_nointr);
-	pool_init(&inodedep_pool, sizeof(struct inodedep), 0, 0, 0,
-	    "inodedeppl", &pool_allocator_nointr);
-	pool_init(&newblk_pool, sizeof(struct newblk), 0, 0, 0,
-	    "newblkpl", &pool_allocator_nointr);
-	pool_init(&bmsafemap_pool, sizeof(struct bmsafemap), 0, 0, 0,
-	    "bmsafemappl", &pool_allocator_nointr);
-	pool_init(&allocdirect_pool, sizeof(struct allocdirect), 0, 0, 0,
-	    "allocdirectpl", &pool_allocator_nointr);
-	pool_init(&indirdep_pool, sizeof(struct indirdep), 0, 0, 0,
-	    "indirdeppl", &pool_allocator_nointr);
-	pool_init(&allocindir_pool, sizeof(struct allocindir), 0, 0, 0,
-	    "allocindirpl", &pool_allocator_nointr);
-	pool_init(&freefrag_pool, sizeof(struct freefrag), 0, 0, 0,
-	    "freefragpl", &pool_allocator_nointr);
-	pool_init(&freeblks_pool, sizeof(struct freeblks), 0, 0, 0,
-	    "freeblkspl", &pool_allocator_nointr);
-	pool_init(&freefile_pool, sizeof(struct freefile), 0, 0, 0,
-	    "freefilepl", &pool_allocator_nointr);
-	pool_init(&diradd_pool, sizeof(struct diradd), 0, 0, 0,
-	    "diraddpl", &pool_allocator_nointr);
-	pool_init(&mkdir_pool, sizeof(struct mkdir), 0, 0, 0,
-	    "mkdirpl", &pool_allocator_nointr);
-	pool_init(&dirrem_pool, sizeof(struct dirrem), 0, 0, 0,
-	    "dirrempl", &pool_allocator_nointr);
-	pool_init(&newdirblk_pool, sizeof (struct newdirblk), 0, 0, 0,
-	    "newdirblkpl", &pool_allocator_nointr);
 }
 
 /*
Index: ufs/ffs/ffs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.140
diff -d -p -u -r1.140 ffs_vfsops.c
--- ufs/ffs/ffs_vfsops.c	27 Mar 2004 12:40:46 -0000	1.140
+++ ufs/ffs/ffs_vfsops.c	5 Apr 2004 05:47:02 -0000
@@ -117,9 +117,12 @@ struct genfs_ops ffs_genfsops = {
 	genfs_gop_write,
 };
 
-struct pool ffs_inode_pool;
-struct pool ffs_dinode1_pool;
-struct pool ffs_dinode2_pool;
+POOL_INIT(ffs_inode_pool, sizeof(struct inode), 0, 0, 0, "ffsinopl", \
+    &pool_allocator_nointr);
+POOL_INIT(ffs_dinode1_pool, sizeof(struct ufs1_dinode), 0, 0, 0, "dino1pl", \
+    &pool_allocator_nointr);
+POOL_INIT(ffs_dinode2_pool, sizeof(struct ufs2_dinode), 0, 0, 0, "dino2pl", \
+    &pool_allocator_nointr);
 
 static void ffs_oldfscompat_read(struct fs *, struct ufsmount *,
 				   daddr_t);
@@ -1542,13 +1545,6 @@ ffs_init()
 
 	softdep_initialize();
 	ufs_init();
-
-	pool_init(&ffs_inode_pool, sizeof(struct inode), 0, 0, 0, "ffsinopl",
-	    &pool_allocator_nointr);
-	pool_init(&ffs_dinode1_pool, sizeof(struct ufs1_dinode), 0, 0, 0,
-	    "dino1pl", &pool_allocator_nointr);
-	pool_init(&ffs_dinode2_pool, sizeof(struct ufs2_dinode), 0, 0, 0,
-	    "dino2pl", &pool_allocator_nointr);
 }
 
 void
Index: ufs/lfs/lfs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/lfs/lfs_vfsops.c,v
retrieving revision 1.146
diff -d -p -u -r1.146 lfs_vfsops.c
--- ufs/lfs/lfs_vfsops.c	27 Mar 2004 04:43:44 -0000	1.146
+++ ufs/lfs/lfs_vfsops.c	5 Apr 2004 05:47:05 -0000
@@ -162,9 +162,15 @@ struct genfs_ops lfs_genfsops = {
 	lfs_gop_write,
 };
 
-struct pool lfs_inode_pool;
-struct pool lfs_dinode_pool;
-struct pool lfs_inoext_pool;
+/*
+ * XXX Same structure as FFS inodes?  Should we share a common pool?
+ */
+POOL_INIT(lfs_inode_pool, sizeof(struct inode), 0, 0, 0, "lfsinopl", \
+    &pool_allocator_nointr);
+POOL_INIT(lfs_dinode_pool, sizeof(struct ufs1_dinode), 0, 0, 0, "lfsdinopl", \
+    &pool_allocator_nointr);
+POOL_INIT(lfs_inoext_pool, sizeof(struct lfs_inode_ext), 8, 0, 0, \
+    "lfsinoextpl", &pool_allocator_nointr);
 
 /*
  * The writer daemon.  UVM keeps track of how many dirty pages we are holding
@@ -254,15 +260,6 @@ lfs_init()
 #endif
 	ufs_init();
 
-	/*
-	 * XXX Same structure as FFS inodes?  Should we share a common pool?
-	 */
-	pool_init(&lfs_inode_pool, sizeof(struct inode), 0, 0, 0,
-		  "lfsinopl", &pool_allocator_nointr);
-	pool_init(&lfs_dinode_pool, sizeof(struct ufs1_dinode), 0, 0, 0,
-		  "lfsdinopl", &pool_allocator_nointr);
-	pool_init(&lfs_inoext_pool, sizeof(struct lfs_inode_ext), 8, 0, 0,
-		  "lfsinoextpl", &pool_allocator_nointr);
 #ifdef DEBUG
 	memset(lfs_log, 0, sizeof(lfs_log));
 #endif
Index: uvm/uvm_amap.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_amap.c,v
retrieving revision 1.53
diff -d -p -u -r1.53 uvm_amap.c
--- uvm/uvm_amap.c	24 Mar 2004 07:50:48 -0000	1.53
+++ uvm/uvm_amap.c	5 Apr 2004 05:47:05 -0000
@@ -66,8 +66,8 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v
  * memory from an amap (it currently goes through the kernel uobj, so
  * we are ok).
  */
-
-struct pool uvm_amap_pool;
+POOL_INIT(uvm_amap_pool, sizeof(struct vm_amap), 0, 0, 0, "amappl", \
+    &pool_allocator_nointr);
 
 MALLOC_DEFINE(M_UVMAMAP, "UVM amap", "UVM amap and related structures");
 
@@ -154,22 +154,6 @@ pp_setreflen(ppref, offset, ref, len)
 #endif
 
 /*
- * amap_init: called at boot time to init global amap data structures
- */
-
-void
-amap_init(void)
-{
-
-	/*
-	 * Initialize the vm_amap pool.
-	 */
-
-	pool_init(&uvm_amap_pool, sizeof(struct vm_amap), 0, 0, 0,
-	    "amappl", &pool_allocator_nointr);
-}
-
-/*
  * amap_alloc1: internal function that allocates an amap, but does not
  *	init the overlay.
  *
Index: uvm/uvm_amap.h
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_amap.h,v
retrieving revision 1.23
diff -d -p -u -r1.23 uvm_amap.h
--- uvm/uvm_amap.h	24 Mar 2004 07:55:01 -0000	1.23
+++ uvm/uvm_amap.h	5 Apr 2004 05:47:06 -0000
@@ -97,8 +97,6 @@ int		amap_flags	/* get amap's flags */
 			(struct vm_amap *);
 void		amap_free	/* free amap */
 			(struct vm_amap *);
-void		amap_init	/* init amap module (at boot time) */
-			(void);
 void		amap_lock	/* lock amap */
 			(struct vm_amap *);
 AMAP_INLINE
Index: uvm/uvm_aobj.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_aobj.c,v
retrieving revision 1.63
diff -d -p -u -r1.63 uvm_aobj.c
--- uvm/uvm_aobj.c	5 Apr 2004 01:39:07 -0000	1.63
+++ uvm/uvm_aobj.c	5 Apr 2004 05:47:07 -0000
@@ -137,9 +137,10 @@ LIST_HEAD(uao_swhash, uao_swhash_elt);
 
 /*
  * uao_swhash_elt_pool: pool of uao_swhash_elt structures
+ * NOTE: Pages for this pool must not come from a pageable kernel map!
  */
-
-struct pool uao_swhash_elt_pool;
+POOL_INIT(uao_swhash_elt_pool, sizeof(struct uao_swhash_elt), 0, 0, 0, \
+    "uaoeltpl", NULL);
 
 /*
  * uvm_aobj: the actual anon-backed uvm_object
@@ -166,8 +167,8 @@ struct uvm_aobj {
 /*
  * uvm_aobj_pool: pool of uvm_aobj structures
  */
-
-struct pool uvm_aobj_pool;
+POOL_INIT(uvm_aobj_pool, sizeof(struct uvm_aobj), 0, 0, 0, "aobjpl", \
+    &pool_allocator_nointr);
 
 MALLOC_DEFINE(M_UVMAOBJ, "UVM aobj", "UVM aobj and related structures");
 
@@ -578,16 +579,6 @@ uao_init(void)
 	uao_initialized = TRUE;
 	LIST_INIT(&uao_list);
 	simple_lock_init(&uao_list_lock);
-
-	/*
-	 * NOTE: Pages for this pool must not come from a pageable
-	 * kernel map!
-	 */
-
-	pool_init(&uao_swhash_elt_pool, sizeof(struct uao_swhash_elt),
-	    0, 0, 0, "uaoeltpl", NULL);
-	pool_init(&uvm_aobj_pool, sizeof(struct uvm_aobj), 0, 0, 0,
-	    "aobjpl", &pool_allocator_nointr);
 }
 
 /*
Index: uvm/uvm_init.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_init.c,v
retrieving revision 1.19
diff -d -p -u -r1.19 uvm_init.c
--- uvm/uvm_init.c	26 Oct 2003 08:05:00 -0000	1.19
+++ uvm/uvm_init.c	5 Apr 2004 05:47:08 -0000
@@ -136,10 +136,9 @@ uvm_init()
 	uvm_pager_init();
 
 	/*
-	 * step 8: init anonymous memory systems (both amap and anons)
+	 * step 8: init anonymous memory systems
 	 */
 
-	amap_init();		/* init amap module */
 	uvm_anon_init();	/* allocate initial anons */
 
 	/*
Index: uvm/uvm_map.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_map.c,v
retrieving revision 1.165
diff -d -p -u -r1.165 uvm_map.c
--- uvm/uvm_map.c	30 Mar 2004 12:59:09 -0000	1.165
+++ uvm/uvm_map.c	5 Apr 2004 05:47:11 -0000
@@ -113,14 +113,17 @@ const char vmmapbsy[] = "vmmapbsy";
  * pool for vmspace structures.
  */
 
-struct pool uvm_vmspace_pool;
+POOL_INIT(uvm_vmspace_pool, sizeof(struct vmspace), 0, 0, 0, "vmsppl", \
+    &pool_allocator_nointr);
 
 /*
  * pool for dynamically-allocated map entries.
  */
 
-struct pool uvm_map_entry_pool;
-struct pool uvm_map_entry_kmem_pool;
+POOL_INIT(uvm_map_entry_pool, sizeof(struct vm_map_entry), 0, 0, 0, "vmmpepl", \
+    &pool_allocator_nointr);
+POOL_INIT(uvm_map_entry_kmem_pool, sizeof(struct vm_map_entry), 0, 0, 0, \
+    "vmmpekpl", NULL);
 
 MALLOC_DEFINE(M_VMMAP, "VM map", "VM map structures");
 MALLOC_DEFINE(M_VMPMAP, "VM pmap", "VM pmap");
@@ -554,16 +557,6 @@ uvm_map_init(void)
 		kernel_map_entry[lcv].next = uvm.kentry_free;
 		uvm.kentry_free = &kernel_map_entry[lcv];
 	}
-
-	/*
-	 * initialize the map-related pools.
-	 */
-	pool_init(&uvm_vmspace_pool, sizeof(struct vmspace),
-	    0, 0, 0, "vmsppl", &pool_allocator_nointr);
-	pool_init(&uvm_map_entry_pool, sizeof(struct vm_map_entry),
-	    0, 0, 0, "vmmpepl", &pool_allocator_nointr);
-	pool_init(&uvm_map_entry_kmem_pool, sizeof(struct vm_map_entry),
-	    0, 0, 0, "vmmpekpl", NULL);
 }
 
 /*
Index: uvm/uvm_swap.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_swap.c,v
retrieving revision 1.85
diff -d -p -u -r1.85 uvm_swap.c
--- uvm/uvm_swap.c	24 Mar 2004 07:50:49 -0000	1.85
+++ uvm/uvm_swap.c	5 Apr 2004 05:47:12 -0000
@@ -180,8 +180,8 @@ struct vndbuf {
 /*
  * We keep a of pool vndbuf's and vndxfer structures.
  */
-static struct pool vndxfer_pool;
-static struct pool vndbuf_pool;
+POOL_INIT(vndxfer_pool, sizeof(struct vndxfer), 0, 0, 0, "swp vnx", NULL);
+POOL_INIT(vndbuf_pool, sizeof(struct vndbuf), 0, 0, 0, "swp vnd", NULL);
 
 #define	getvndxfer(vnx)	do {						\
 	int s = splbio();						\
@@ -287,16 +287,6 @@ uvm_swap_init()
 		panic("uvm_swap_init: extent_create failed");
 
 	/*
-	 * allocate pools for structures used for swapping to files.
-	 */
-
-	pool_init(&vndxfer_pool, sizeof(struct vndxfer), 0, 0, 0,
-	    "swp vnx", NULL);
-
-	pool_init(&vndbuf_pool, sizeof(struct vndbuf), 0, 0, 0,
-	    "swp vnd", NULL);
-
-	/*
 	 * done!
 	 */
 	UVMHIST_LOG(pdhist, "<- done", 0, 0, 0, 0);