Convert POOL_INITs to proper cons/destructors.

This commit is contained in:
pooka 2009-09-12 12:52:21 +00:00
parent 58c74e6160
commit df6e37fb47
3 changed files with 27 additions and 21 deletions

View File

@ -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 * Copyright (c) 2000-2001 Boris Popov
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/kernel.h> #include <sys/kernel.h>
@ -176,6 +176,7 @@ nsmbattach(int num)
smb_sm_done(); smb_sm_done();
return; return;
} }
smb_rqpool_init();
} }
#endif /* __NetBSD__ */ #endif /* __NetBSD__ */
@ -256,6 +257,7 @@ nsmb_dev_close(dev_t dev, int flag, int fmt, struct lwp *l)
#ifndef __NetBSD__ #ifndef __NetBSD__
destroy_dev(dev); destroy_dev(dev);
#endif #endif
smb_rqpool_fini();
splx(s); splx(s);
return 0; return 0;
} }

View File

@ -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 * Copyright (c) 2000-2001, Boris Popov
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -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); MODULE_DEPEND(netsmb, libmchain, 1, 1, 1);
#endif #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, static int smb_rq_init(struct smb_rq *, struct smb_connobj *, u_char,
struct smb_cred *); struct smb_cred *);
static int smb_rq_getenv(struct smb_connobj *layer, 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 *); struct smb_cred *);
static int smb_t2_reply(struct smb_t2rq *t2p); static int smb_t2_reply(struct smb_t2rq *t2p);
#ifndef __NetBSD__ static struct pool smbrq_pool, smbt2rq_pool;
int
smb_rqinit(void) void
smb_rqpool_init(void)
{ {
pool_init(&smbrq_pool, sizeof(struct smb_rq), 0, 0, 0,
"smbrqpl", &pool_allocator_nointr, IPL_NONE); pool_init(&smbrq_pool, sizeof(struct smb_rq), 0, 0, 0, "smbrqpl",
pool_init(&smbt2rq_pool, sizeof(struct smb_t2rq), 0, 0, 0, &pool_allocator_nointr, IPL_NONE);
"smbt2pl", &pool_allocator_nointr, IPL_NONE); pool_init(&smbt2rq_pool, sizeof(struct smb_t2rq), 0, 0, 0, "smbt2pl",
return (0); &pool_allocator_nointr, IPL_NONE);
}
void
smb_rqpool_fini(void)
{
pool_destroy(&smbrq_pool);
pool_destroy(&smbt2rq_pool);
} }
#endif
int int
smb_rq_alloc(struct smb_connobj *layer, u_char cmd, struct smb_cred *scred, smb_rq_alloc(struct smb_connobj *layer, u_char cmd, struct smb_cred *scred,

View File

@ -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 * Copyright (c) 2000-2001, Boris Popov
@ -131,6 +131,9 @@ struct smb_t2rq {
struct smb_vc * t2_vc; 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, int smb_rq_alloc(struct smb_connobj *layer, u_char cmd,
struct smb_cred *scred, struct smb_rq **rqpp); struct smb_cred *scred, struct smb_rq **rqpp);
void smb_rq_done(struct smb_rq *rqp); void smb_rq_done(struct smb_rq *rqp);