Wipe out the last vestiges of POOL_INIT with one swift stroke. In

most cases, use a proper constructor.  For proplib, give a local
equivalent of POOL_INIT for the kernel object implementation.  This
way the code structure can be preserved, and a local link set is
not hazardous anyway (unless proplib is split to several modules,
but that'll be the day).

tested by booting a kernel in qemu and compile-testing i386/ALL
This commit is contained in:
pooka 2009-09-13 18:45:10 +00:00
parent 42b8a9234e
commit fbd53556dc
23 changed files with 189 additions and 101 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: proplib.h,v 1.6 2008/04/28 20:22:51 martin Exp $ */
/* $NetBSD: proplib.h,v 1.7 2009/09/13 18:45:10 pooka Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -43,4 +43,8 @@
#include <prop/plistref.h>
#ifdef _KERNEL
void prop_kern_init(void);
#endif
#endif /* _PROPLIB_PROPLIB_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: prop_kern.c,v 1.9 2008/04/28 20:22:53 martin Exp $ */
/* $NetBSD: prop_kern.c,v 1.10 2009/09/13 18:45:10 pooka Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -224,12 +224,27 @@ prop_dictionary_sendrecv_ioctl(prop_dictionary_t dict, int fd,
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/resource.h>
#include <sys/pool.h>
#include <uvm/uvm.h>
#include "prop_object_impl.h"
/* Arbitrary limit ioctl input to 64KB */
unsigned int prop_object_copyin_limit = 65536;
/* initialize proplib for use in the kernel */
void
prop_kern_init(void)
{
__link_set_decl(prop_linkpools, struct prop_pool_init);
struct prop_pool_init * const *pi;
__link_set_foreach(pi, prop_linkpools)
pool_init((*pi)->pp, (*pi)->size, 0, 0, 0, (*pi)->wchan,
&pool_allocator_nointr, IPL_NONE);
}
static int
_prop_object_copyin_ioctl(const struct plistref *pref, const prop_type_t type,
const u_long cmd, prop_object_t *objp)

View File

@ -1,4 +1,4 @@
/* $NetBSD: prop_object_impl.h,v 1.29 2009/01/03 18:31:34 pooka Exp $ */
/* $NetBSD: prop_object_impl.h,v 1.30 2009/09/13 18:45:10 pooka Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -263,8 +263,17 @@ struct _prop_object_iterator {
#define _PROP_POOL_GET(p) pool_get(&(p), PR_WAITOK)
#define _PROP_POOL_PUT(p, v) pool_put(&(p), (v))
#define _PROP_POOL_INIT(p, s, d) \
POOL_INIT(p, s, 0, 0, 0, d, &pool_allocator_nointr, IPL_NONE);
struct prop_pool_init {
struct pool *pp;
size_t size;
const char *wchan;
};
#define _PROP_POOL_INIT(pp, size, wchan) \
struct pool pp; \
static const struct prop_pool_init _link_ ## pp[1] = { \
{ &pp, size, wchan } \
}; \
__link_set_add_rodata(prop_linkpools, _link_ ## pp);
#define _PROP_MALLOC_DEFINE(t, s, l) \
MALLOC_DEFINE(t, s, l);

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_sa.c,v 1.10 2009/04/16 07:42:28 skrll Exp $ */
/* $NetBSD: compat_sa.c,v 1.11 2009/09/13 18:45:10 pooka Exp $ */
/*-
* Copyright (c) 2001, 2004, 2005, 2006 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
#include "opt_ktrace.h"
#include "opt_multiprocessor.h"
#include "opt_sa.h"
__KERNEL_RCSID(0, "$NetBSD: compat_sa.c,v 1.10 2009/04/16 07:42:28 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: compat_sa.c,v 1.11 2009/09/13 18:45:10 pooka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -82,26 +82,22 @@ __KERNEL_RCSID(0, "$NetBSD: compat_sa.c,v 1.10 2009/04/16 07:42:28 skrll Exp $")
/*
* memory pool for sadata structures
*/
static POOL_INIT(sadata_pool, sizeof(struct sadata), 0, 0, 0, "sadatapl",
&pool_allocator_nointr, IPL_NONE);
static struct pool sadata_pool;
/*
* memory pool for pending upcalls
*/
static POOL_INIT(saupcall_pool, sizeof(struct sadata_upcall), 0, 0, 0,
"saupcpl", &pool_allocator_nointr, IPL_NONE);
static struct pool saupcall_pool;
/*
* memory pool for sastack structs
*/
static POOL_INIT(sastack_pool, sizeof(struct sastack), 0, 0, 0, "sastackpl",
&pool_allocator_nointr, IPL_NONE);
static struct pool sastack_pool;
/*
* memory pool for sadata_vp structures
*/
static POOL_INIT(savp_pool, sizeof(struct sadata_vp), 0, 0, 0, "savppl",
&pool_allocator_nointr, IPL_NONE);
static struct pool savp_pool;
static struct sadata_vp *sa_newsavp(struct proc *);
static void sa_freevp(struct proc *, struct sadata *, struct sadata_vp *);
@ -165,6 +161,20 @@ RB_GENERATE(sasttree, sastack, sast_node, sast_compare);
kmutex_t saupcall_mutex;
SIMPLEQ_HEAD(, sadata_upcall) saupcall_freelist;
void
sa_init(void)
{
pool_init(&sadata_pool, sizeof(struct sadata), 0, 0, 0, "sadatapl",
&pool_allocator_nointr, IPL_NONE);
pool_init(&saupcall_pool, sizeof(struct sadata_upcall), 0, 0, 0,
"saupcpl", &pool_allocator_nointr, IPL_NONE);
pool_init(&sastack_pool, sizeof(struct sastack), 0, 0, 0, "sastackpl",
&pool_allocator_nointr, IPL_NONE);
pool_init(&savp_pool, sizeof(struct sadata_vp), 0, 0, 0, "savppl",
&pool_allocator_nointr, IPL_NONE);
}
/*
* sa_critpath API
* permit other parts of the kernel to make SA_LWP_STATE_{UN,}LOCK calls.

View File

@ -1,4 +1,4 @@
/* $NetBSD: ata.c,v 1.106 2009/05/12 12:10:29 cegger Exp $ */
/* $NetBSD: ata.c,v 1.107 2009/09/13 18:45:10 pooka Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.106 2009/05/12 12:10:29 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.107 2009/09/13 18:45:10 pooka Exp $");
#include "opt_ata.h"
@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.106 2009/05/12 12:10:29 cegger Exp $");
#include <sys/simplelock.h>
#include <sys/intr.h>
#include <sys/bus.h>
#include <sys/once.h>
#include <dev/ata/ataconf.h>
#include <dev/ata/atareg.h>
@ -78,8 +79,7 @@ int atadebug_mask = 0;
#define ATADEBUG_PRINT(args, level)
#endif
POOL_INIT(ata_xfer_pool, sizeof(struct ata_xfer), 0, 0, 0, "ataspl", NULL,
IPL_BIO);
static struct pool ata_xfer_pool;
/*
* A queue of atabus instances, used to ensure the same bus probe order
@ -429,6 +429,15 @@ atabus_match(device_t parent, cfdata_t cf, void *aux)
return (1);
}
static int
atabus_xferpool_init(void)
{
pool_init(&ata_xfer_pool, sizeof(struct ata_xfer), 0, 0, 0, "ataspl",
NULL, IPL_BIO);
return 0;
}
/*
* atabus_attach:
*
@ -440,6 +449,7 @@ atabus_attach(device_t parent, device_t self, void *aux)
struct atabus_softc *sc = device_private(self);
struct ata_channel *chp = aux;
struct atabus_initq *initq;
static ONCE_DECL(poolinit_ctrl);
int error;
sc->sc_chan = chp;
@ -452,6 +462,8 @@ atabus_attach(device_t parent, device_t self, void *aux)
if (ata_addref(chp))
return;
RUN_ONCE(&poolinit_ctrl, atabus_xferpool_init);
initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK);
initq->atabus_sc = sc;
TAILQ_INSERT_TAIL(&atabus_initq_head, initq, atabus_initq);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rnd.c,v 1.74 2009/09/08 20:57:59 pooka Exp $ */
/* $NetBSD: rnd.c,v 1.75 2009/09/13 18:45:10 pooka Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.74 2009/09/08 20:57:59 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.75 2009/09/13 18:45:10 pooka Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.74 2009/09/08 20:57:59 pooka Exp $");
#include <sys/vnode.h>
#include <sys/pool.h>
#include <sys/kauth.h>
#include <sys/once.h>
#ifdef __HAVE_CPU_COUNTER
#include <machine/cpu_counter.h>
@ -117,8 +118,7 @@ volatile u_int32_t rnd_status;
/*
* Memory pool for sample buffers
*/
POOL_INIT(rnd_mempool, sizeof(rnd_sample_t), 0, 0, 0, "rndsample", NULL,
IPL_VM);
static struct pool rnd_mempool;
/*
* Our random pool. This is defined here rather than using the general
@ -268,6 +268,16 @@ rnd_estimate_entropy(rndsource_t *rs, u_int32_t t)
return (1);
}
static int
rnd_mempool_init(void)
{
pool_init(&rnd_mempool, sizeof(rnd_sample_t), 0, 0, 0, "rndsample",
NULL, IPL_VM);
return 0;
}
static ONCE_DECL(rnd_mempoolinit_ctrl);
/*
* "Attach" the random device. This is an (almost) empty stub, since
* pseudo-devices don't get attached until after config, after the
@ -279,6 +289,8 @@ rndattach(int num)
{
u_int32_t c;
RUN_ONCE(&rnd_mempoolinit_ctrl, rnd_mempool_init);
/* Trap unwary players who don't call rnd_init() early */
KASSERT(rnd_ready);
@ -816,6 +828,8 @@ rnd_attach_source(rndsource_element_t *rs, const char *name, u_int32_t type,
{
u_int32_t ts;
RUN_ONCE(&rnd_mempoolinit_ctrl, rnd_mempool_init);
ts = rnd_counter();
strlcpy(rs->data.name, name, sizeof(rs->data.name));

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.398 2009/09/03 15:20:08 pooka Exp $ */
/* $NetBSD: init_main.c,v 1.399 2009/09/13 18:45:10 pooka Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@ -97,13 +97,14 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.398 2009/09/03 15:20:08 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.399 2009/09/13 18:45:10 pooka Exp $");
#include "opt_ddb.h"
#include "opt_ipsec.h"
#include "opt_modular.h"
#include "opt_ntp.h"
#include "opt_pipe.h"
#include "opt_sa.h"
#include "opt_syscall_debug.h"
#include "opt_sysv.h"
#include "opt_fileassoc.h"
@ -195,6 +196,9 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.398 2009/09/03 15:20:08 pooka Exp $"
#ifdef WAPBL
#include <sys/wapbl.h>
#endif
#ifdef KERN_SA
#include <sys/savar.h>
#endif
#include <net80211/ieee80211_netbsd.h>
#include <sys/syscall.h>
@ -228,6 +232,8 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.398 2009/09/03 15:20:08 pooka Exp $"
#include <secmodel/secmodel.h>
#include <prop/proplib.h>
#ifdef COMPAT_50
#include <compat/sys/time.h>
struct timeval50 boottime50;
@ -311,6 +317,8 @@ main(void)
uvm_init();
prop_kern_init();
#if ((NKSYMS > 0) || (NDDB > 0) || (NMODULAR > 0))
ksyms_init();
#endif
@ -360,6 +368,9 @@ main(void)
#endif
/* Initialize process and pgrp structures. */
#ifdef KERN_SA
sa_init();
#endif
procinit();
lwpinit();

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_lwp.c,v 1.132 2009/07/10 23:07:54 dyoung Exp $ */
/* $NetBSD: kern_lwp.c,v 1.133 2009/09/13 18:45:11 pooka Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@ -210,7 +210,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.132 2009/07/10 23:07:54 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.133 2009/09/13 18:45:11 pooka Exp $");
#include "opt_ddb.h"
#include "opt_lockdebug.h"
@ -243,8 +243,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.132 2009/07/10 23:07:54 dyoung Exp $"
struct lwplist alllwp = LIST_HEAD_INITIALIZER(alllwp);
POOL_INIT(lwp_uc_pool, sizeof(ucontext_t), 0, 0, 0, "lwpucpl",
&pool_allocator_nointr, IPL_NONE);
struct pool lwp_uc_pool;
static pool_cache_t lwp_cache;
static specificdata_domain_t lwp_specificdata_domain;
@ -253,6 +252,8 @@ void
lwpinit(void)
{
pool_init(&lwp_uc_pool, sizeof(ucontext_t), 0, 0, 0, "lwpucpl",
&pool_allocator_nointr, IPL_NONE);
lwp_specificdata_domain = specificdata_domain_create();
KASSERT(lwp_specificdata_domain != NULL);
lwp_sys_init();

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_malloc.c,v 1.126 2009/01/07 21:06:31 pooka Exp $ */
/* $NetBSD: kern_malloc.c,v 1.127 2009/09/13 18:45:11 pooka Exp $ */
/*
* Copyright (c) 1987, 1991, 1993
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.126 2009/01/07 21:06:31 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.127 2009/09/13 18:45:11 pooka Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -941,6 +941,10 @@ kmeminit(void)
/* Attach all of the statically-linked malloc types. */
__link_set_foreach(ksp, malloc_types)
malloc_type_attach(*ksp);
#ifdef MALLOC_DEBUG
debug_malloc_init();
#endif
}
#ifdef DDB

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_malloc_debug.c,v 1.20 2008/08/07 01:40:21 matt Exp $ */
/* $NetBSD: kern_malloc_debug.c,v 1.21 2009/09/13 18:45:11 pooka Exp $ */
/*
* Copyright (c) 1999, 2000 Artur Grabowski <art@openbsd.org>
@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_malloc_debug.c,v 1.20 2008/08/07 01:40:21 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_malloc_debug.c,v 1.21 2009/09/13 18:45:11 pooka Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -111,8 +111,15 @@ int debug_malloc_frees;
int debug_malloc_pages;
int debug_malloc_chunks_on_freelist;
POOL_INIT(debug_malloc_pool, sizeof(struct debug_malloc_entry), 0, 0, 0,
"mdbepl", NULL, IPL_VM);
static struct pool debug_malloc_pool;
void
debug_malloc_init(void)
{
pool_init(&debug_malloc_pool, sizeof(struct debug_malloc_entry),
0, 0, 0, "mdbepl", NULL, IPL_VM);
}
int
debug_malloc(unsigned long size, struct malloc_type *type, int flags,

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_time.c,v 1.160 2009/03/29 19:21:19 christos Exp $ */
/* $NetBSD: kern_time.c,v 1.161 2009/09/13 18:45:11 pooka Exp $ */
/*-
* Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.160 2009/03/29 19:21:19 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.161 2009/09/13 18:45:11 pooka Exp $");
#include <sys/param.h>
#include <sys/resourcevar.h>
@ -93,10 +93,7 @@ kmutex_t timer_lock;
static void *timer_sih;
static TAILQ_HEAD(, ptimer) timer_queue;
POOL_INIT(ptimer_pool, sizeof(struct ptimer), 0, 0, 0, "ptimerpl",
&pool_allocator_nointr, IPL_NONE);
POOL_INIT(ptimers_pool, sizeof(struct ptimers), 0, 0, 0, "ptimerspl",
&pool_allocator_nointr, IPL_NONE);
struct pool ptimer_pool, ptimers_pool;
/*
* Initialize timekeeping.
@ -105,7 +102,10 @@ void
time_init(void)
{
/* nothing yet */
pool_init(&ptimer_pool, sizeof(struct ptimer), 0, 0, 0, "ptimerpl",
&pool_allocator_nointr, IPL_NONE);
pool_init(&ptimers_pool, sizeof(struct ptimers), 0, 0, 0, "ptimerspl",
&pool_allocator_nointr, IPL_NONE);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_pool.c,v 1.173 2009/08/29 00:09:02 rmind Exp $ */
/* $NetBSD: subr_pool.c,v 1.174 2009/09/13 18:45:11 pooka Exp $ */
/*-
* Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.173 2009/08/29 00:09:02 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.174 2009/09/13 18:45:11 pooka Exp $");
#include "opt_ddb.h"
#include "opt_pool.h"
@ -587,17 +587,10 @@ void
pool_subsystem_init(void)
{
struct pool_allocator *pa;
__link_set_decl(pools, struct link_pool_init);
struct link_pool_init * const *pi;
mutex_init(&pool_head_lock, MUTEX_DEFAULT, IPL_NONE);
cv_init(&pool_busy, "poolbusy");
__link_set_foreach(pi, pools)
pool_init((*pi)->pp, (*pi)->size, (*pi)->align,
(*pi)->align_offset, (*pi)->flags, (*pi)->wchan,
(*pi)->palloc, (*pi)->ipl);
while ((pa = SLIST_FIRST(&pa_deferinitq)) != NULL) {
KASSERT(pa->pa_backingmapptr != NULL);
KASSERT(*pa->pa_backingmapptr != NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt_proto.c,v 1.11 2009/08/10 18:25:20 plunky Exp $ */
/* $NetBSD: bt_proto.c,v 1.12 2009/09/13 18:45:11 pooka Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bt_proto.c,v 1.11 2009/08/10 18:25:20 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: bt_proto.c,v 1.12 2009/09/13 18:45:11 pooka Exp $");
#include <sys/param.h>
#include <sys/domain.h>
@ -97,6 +97,7 @@ const struct protosw btsw[] = {
.pr_flags = (PR_CONNREQUIRED | PR_ATOMIC | PR_LISTEN),
.pr_ctloutput = l2cap_ctloutput,
.pr_usrreq = l2cap_usrreq,
.pr_init = l2cap_init,
},
{ /* RFCOMM */
.pr_type = SOCK_STREAM,
@ -105,6 +106,7 @@ const struct protosw btsw[] = {
.pr_flags = (PR_CONNREQUIRED | PR_LISTEN | PR_WANTRCVD),
.pr_ctloutput = rfcomm_ctloutput,
.pr_usrreq = rfcomm_usrreq,
.pr_init = rfcomm_init,
},
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: l2cap.h,v 1.8 2008/09/08 23:36:55 gmcgarry Exp $ */
/* $NetBSD: l2cap.h,v 1.9 2009/09/13 18:45:11 pooka Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -54,7 +54,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: l2cap.h,v 1.8 2008/09/08 23:36:55 gmcgarry Exp $
* $Id: l2cap.h,v 1.9 2009/09/13 18:45:11 pooka Exp $
* $FreeBSD: src/sys/netgraph/bluetooth/include/l2cap.h,v 1.4 2005/08/31 18:13:23 emax Exp $
*/
@ -455,6 +455,7 @@ int l2cap_request_alloc(struct l2cap_channel *, uint8_t);
struct l2cap_req *l2cap_request_lookup(struct hci_link *, uint8_t);
void l2cap_request_free(struct l2cap_req *);
void l2cap_rtx(void *);
void l2cap_init(void);
/* l2cap_signal.c */
void l2cap_recv_signal(struct mbuf *, struct hci_link *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: l2cap_misc.c,v 1.6 2008/04/24 11:38:37 ad Exp $ */
/* $NetBSD: l2cap_misc.c,v 1.7 2009/09/13 18:45:11 pooka Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: l2cap_misc.c,v 1.6 2008/04/24 11:38:37 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: l2cap_misc.c,v 1.7 2009/09/13 18:45:11 pooka Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -49,10 +49,7 @@ struct l2cap_channel_list
struct l2cap_channel_list
l2cap_listen_list = LIST_HEAD_INITIALIZER(l2cap_listen_list);
POOL_INIT(l2cap_req_pool, sizeof(struct l2cap_req), 0, 0, 0, "l2cap_req", NULL,
IPL_SOFTNET);
POOL_INIT(l2cap_pdu_pool, sizeof(struct l2cap_pdu), 0, 0, 0, "l2cap_pdu", NULL,
IPL_SOFTNET);
struct pool l2cap_req_pool, l2cap_pdu_pool;
const l2cap_qos_t l2cap_default_qos = {
0, /* flags */
@ -70,6 +67,16 @@ const l2cap_qos_t l2cap_default_qos = {
int l2cap_response_timeout = 30; /* seconds */
int l2cap_response_extended_timeout = 180; /* seconds */
void
l2cap_init(void)
{
pool_init(&l2cap_req_pool, sizeof(struct l2cap_req), 0, 0, 0,
"l2cap_req", NULL, IPL_SOFTNET);
pool_init(&l2cap_pdu_pool, sizeof(struct l2cap_pdu), 0, 0, 0,
"l2cap_pdu", NULL, IPL_SOFTNET);
}
/*
* Set Link Mode on channel
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: rfcomm.h,v 1.8 2008/09/08 23:36:55 gmcgarry Exp $ */
/* $NetBSD: rfcomm.h,v 1.9 2009/09/13 18:45:11 pooka Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -55,7 +55,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: rfcomm.h,v 1.8 2008/09/08 23:36:55 gmcgarry Exp $
* $Id: rfcomm.h,v 1.9 2009/09/13 18:45:11 pooka Exp $
* $FreeBSD: src/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h,v 1.4 2005/01/11 01:39:53 emax Exp $
*/
@ -401,6 +401,7 @@ void rfcomm_session_free(struct rfcomm_session *);
int rfcomm_session_send_frame(struct rfcomm_session *, int, int);
int rfcomm_session_send_uih(struct rfcomm_session *, struct rfcomm_dlc *, int, struct mbuf *);
int rfcomm_session_send_mcc(struct rfcomm_session *, int, uint8_t, void *, int);
void rfcomm_init(void);
/* rfcomm_socket.c */
int rfcomm_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rfcomm_session.c,v 1.14 2008/08/06 15:01:24 plunky Exp $ */
/* $NetBSD: rfcomm_session.c,v 1.15 2009/09/13 18:45:11 pooka Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rfcomm_session.c,v 1.14 2008/08/06 15:01:24 plunky Exp $");
__KERNEL_RCSID(0, "$NetBSD: rfcomm_session.c,v 1.15 2009/09/13 18:45:11 pooka Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -95,8 +95,7 @@ struct rfcomm_session_list
struct rfcomm_session_list
rfcomm_session_listen = LIST_HEAD_INITIALIZER(rfcomm_session_listen);
POOL_INIT(rfcomm_credit_pool, sizeof(struct rfcomm_credit),
0, 0, 0, "rfcomm_credit", NULL, IPL_SOFTNET);
static struct pool rfcomm_credit_pool;
/*
* RFCOMM System Parameters (see section 5.3)
@ -152,6 +151,14 @@ static const uint8_t crctable[256] = { /* reversed, 8-bit, poly=0x07 */
#define FCS(f, d) crctable[(f) ^ (d)]
void
rfcomm_init(void)
{
pool_init(&rfcomm_credit_pool, sizeof(struct rfcomm_credit),
0, 0, 0, "rfcomm_credit", NULL, IPL_SOFTNET);
}
/*
* rfcomm_session_alloc(list, sockaddr)
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: igmp.c,v 1.49 2008/05/04 07:22:14 thorpej Exp $ */
/* $NetBSD: igmp.c,v 1.50 2009/09/13 18:45:11 pooka Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.49 2008/05/04 07:22:14 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.50 2009/09/13 18:45:11 pooka Exp $");
#include "opt_mrouting.h"
@ -68,8 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: igmp.c,v 1.49 2008/05/04 07:22:14 thorpej Exp $");
#define IP_MULTICASTOPTS 0
POOL_INIT(igmp_rti_pool, sizeof(struct router_info), 0, 0, 0, "igmppl", NULL,
IPL_SOFTNET);
static struct pool igmp_rti_pool;
static percpu_t *igmpstat_percpu;
@ -150,6 +149,8 @@ void
igmp_init(void)
{
pool_init(&igmp_rti_pool, sizeof(struct router_info), 0, 0, 0,
"igmppl", NULL, IPL_SOFTNET);
igmpstat_percpu = percpu_alloc(sizeof(uint64_t) * IGMP_NSTATS);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: malloc.h,v 1.104 2009/01/07 21:06:31 pooka Exp $ */
/* $NetBSD: malloc.h,v 1.105 2009/09/13 18:45:11 pooka Exp $ */
/*
* Copyright (c) 1987, 1993
@ -105,6 +105,7 @@ void kern_free(void *, struct malloc_type *);
#endif /* MALLOCLOG */
#ifdef MALLOC_DEBUG
void debug_malloc_init(void);
int debug_malloc(unsigned long, struct malloc_type *, int, void **);
int debug_free(void *, struct malloc_type *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pool.h,v 1.64 2008/07/04 16:38:59 ad Exp $ */
/* $NetBSD: pool.h,v 1.65 2009/09/13 18:45:12 pooka Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2000, 2007 The NetBSD Foundation, Inc.
@ -265,23 +265,6 @@ extern struct pool_allocator pool_allocator_kmem_fullpage;
extern struct pool_allocator pool_allocator_nointr_fullpage;
#endif
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;
const char *wchan;
struct pool_allocator *palloc;
int ipl;
};
#define POOL_INIT(pp, size, align, align_offset, flags, wchan, palloc, ipl)\
struct pool pp; \
static const struct link_pool_init _link_ ## pp[1] = { \
{ &pp, size, align, align_offset, flags, wchan, palloc, ipl } \
}; \
__link_set_add_rodata(pools, _link_ ## pp)
void pool_subsystem_init(void);
void pool_init(struct pool *, size_t, u_int, u_int,

View File

@ -1,4 +1,4 @@
/* $NetBSD: savar.h,v 1.28 2008/10/17 08:16:57 cegger Exp $ */
/* $NetBSD: savar.h,v 1.29 2009/09/13 18:45:12 pooka Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -170,6 +170,8 @@ struct sadata {
#define SA_MAXNUMSTACKS 16 /* Maximum number of upcall stacks per VP. */
void sa_init(void);
struct sadata_upcall *sadata_upcall_alloc(int);
void sadata_upcall_free(struct sadata_upcall *);
void sadata_upcall_drain(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_aobj.c,v 1.106 2009/02/18 13:16:58 yamt Exp $ */
/* $NetBSD: uvm_aobj.c,v 1.107 2009/09/13 18:45:12 pooka Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.106 2009/02/18 13:16:58 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.107 2009/09/13 18:45:12 pooka Exp $");
#include "opt_uvmhist.h"
@ -140,8 +140,7 @@ 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!
*/
static POOL_INIT(uao_swhash_elt_pool, sizeof(struct uao_swhash_elt), 0, 0, 0,
"uaoeltpl", NULL, IPL_VM);
static struct pool uao_swhash_elt_pool;
static struct pool_cache uvm_aobj_cache;
@ -552,6 +551,8 @@ uao_init(void)
mutex_init(&uao_list_lock, MUTEX_DEFAULT, IPL_NONE);
pool_cache_bootstrap(&uvm_aobj_cache, sizeof(struct uvm_aobj), 0, 0,
0, "aobj", NULL, IPL_NONE, NULL, NULL, NULL);
pool_init(&uao_swhash_elt_pool, sizeof(struct uao_swhash_elt),
0, 0, 0, "uaoeltpl", NULL, IPL_VM);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_swap.c,v 1.145 2009/03/01 01:13:14 mrg Exp $ */
/* $NetBSD: uvm_swap.c,v 1.146 2009/09/13 18:45:12 pooka Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.145 2009/03/01 01:13:14 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.146 2009/09/13 18:45:12 pooka Exp $");
#include "fs_nfs.h"
#include "opt_uvmhist.h"
@ -204,10 +204,7 @@ struct swapent50 {
/*
* We keep a of pool vndbuf's and vndxfer structures.
*/
POOL_INIT(vndxfer_pool, sizeof(struct vndxfer), 0, 0, 0, "swp vnx", NULL,
IPL_BIO);
POOL_INIT(vndbuf_pool, sizeof(struct vndbuf), 0, 0, 0, "swp vnd", NULL,
IPL_BIO);
static struct pool vndxfer_pool, vndbuf_pool;
/*
* local variables
@ -313,6 +310,11 @@ uvm_swap_init(void)
CTLTYPE_INT, "swapout",
SYSCTL_DESCR("Set 0 to disable swapout of kernel stacks"),
NULL, 0, &uvm.swapout_enabled, 0, CTL_VM, CTL_CREATE, CTL_EOL);
pool_init(&vndxfer_pool, sizeof(struct vndxfer), 0, 0, 0, "swp vnx",
NULL, IPL_BIO);
pool_init(&vndbuf_pool, sizeof(struct vndbuf), 0, 0, 0, "swp vnd",
NULL, IPL_BIO);
}
/*