diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index f4d4d5a71f0d..7478c6d7557f 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -1,4 +1,4 @@ -/* $NetBSD: smb_dev.c,v 1.31 2009/09/01 12:23:36 pooka Exp $ */ +/* $NetBSD: smb_dev.c,v 1.32 2009/09/12 12:52:21 pooka Exp $ */ /* * Copyright (c) 2000-2001 Boris Popov @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.31 2009/09/01 12:23:36 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.32 2009/09/12 12:52:21 pooka Exp $"); #include #include @@ -176,6 +176,7 @@ nsmbattach(int num) smb_sm_done(); return; } + smb_rqpool_init(); } #endif /* __NetBSD__ */ @@ -256,6 +257,7 @@ nsmb_dev_close(dev_t dev, int flag, int fmt, struct lwp *l) #ifndef __NetBSD__ destroy_dev(dev); #endif + smb_rqpool_fini(); splx(s); return 0; } diff --git a/sys/netsmb/smb_rq.c b/sys/netsmb/smb_rq.c index c92763524972..1e4b0649b900 100644 --- a/sys/netsmb/smb_rq.c +++ b/sys/netsmb/smb_rq.c @@ -1,4 +1,4 @@ -/* $NetBSD: smb_rq.c,v 1.32 2009/07/06 11:46:49 njoly Exp $ */ +/* $NetBSD: smb_rq.c,v 1.33 2009/09/12 12:52:21 pooka Exp $ */ /* * Copyright (c) 2000-2001, Boris Popov @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: smb_rq.c,v 1.32 2009/07/06 11:46:49 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smb_rq.c,v 1.33 2009/09/12 12:52:21 pooka Exp $"); #include #include @@ -57,13 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: smb_rq.c,v 1.32 2009/07/06 11:46:49 njoly Exp $"); MODULE_DEPEND(netsmb, libmchain, 1, 1, 1); #endif -#ifdef __NetBSD__ -POOL_INIT(smbrq_pool, sizeof(struct smb_rq), 0, 0, 0, "smbrqpl", - &pool_allocator_nointr, IPL_NONE); -POOL_INIT(smbt2rq_pool, sizeof(struct smb_t2rq), 0, 0, 0, "smbt2pl", - &pool_allocator_nointr, IPL_NONE); -#endif - static int smb_rq_init(struct smb_rq *, struct smb_connobj *, u_char, struct smb_cred *); static int smb_rq_getenv(struct smb_connobj *layer, @@ -73,17 +66,25 @@ static int smb_t2_init(struct smb_t2rq *, struct smb_connobj *, u_short, struct smb_cred *); static int smb_t2_reply(struct smb_t2rq *t2p); -#ifndef __NetBSD__ -int -smb_rqinit(void) +static struct pool smbrq_pool, smbt2rq_pool; + +void +smb_rqpool_init(void) { - pool_init(&smbrq_pool, sizeof(struct smb_rq), 0, 0, 0, - "smbrqpl", &pool_allocator_nointr, IPL_NONE); - pool_init(&smbt2rq_pool, sizeof(struct smb_t2rq), 0, 0, 0, - "smbt2pl", &pool_allocator_nointr, IPL_NONE); - return (0); + + pool_init(&smbrq_pool, sizeof(struct smb_rq), 0, 0, 0, "smbrqpl", + &pool_allocator_nointr, IPL_NONE); + pool_init(&smbt2rq_pool, sizeof(struct smb_t2rq), 0, 0, 0, "smbt2pl", + &pool_allocator_nointr, IPL_NONE); +} + +void +smb_rqpool_fini(void) +{ + + pool_destroy(&smbrq_pool); + pool_destroy(&smbt2rq_pool); } -#endif int smb_rq_alloc(struct smb_connobj *layer, u_char cmd, struct smb_cred *scred, diff --git a/sys/netsmb/smb_rq.h b/sys/netsmb/smb_rq.h index bc246068c36f..737cf58d0b43 100644 --- a/sys/netsmb/smb_rq.h +++ b/sys/netsmb/smb_rq.h @@ -1,4 +1,4 @@ -/* $NetBSD: smb_rq.h,v 1.12 2005/12/11 00:06:21 elad Exp $ */ +/* $NetBSD: smb_rq.h,v 1.13 2009/09/12 12:52:21 pooka Exp $ */ /* * Copyright (c) 2000-2001, Boris Popov @@ -131,6 +131,9 @@ struct smb_t2rq { struct smb_vc * t2_vc; }; +void smb_rqpool_init(void); +void smb_rqpool_fini(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);