Subject: Re: kern/13232: POOL_DIAGNOSTIC && pool.h
To: None <lha@stacken.kth.se, tech-kern@netbsd.org>
From: Assar Westerlund <assar@netbsd.org>
List: tech-kern
Date: 06/19/2001 17:08:17
--text follows this line--
lha@stacken.kth.se writes:
> 	Kernels (I tried with 1.5W) build with POOL_DIAGNOSTIC can't
> 	load lkm with built w/o.

The appended patch should fix this.  Any comments?

/assar

Index: kern/subr_pool.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/subr_pool.c,v
retrieving revision 1.59
diff -u -w -r1.59 subr_pool.c
--- kern/subr_pool.c	2001/06/05 18:51:04	1.59
+++ kern/subr_pool.c	2001/06/19 14:27:25
@@ -576,11 +576,7 @@
  * Grab an item from the pool; must be called at appropriate spl level
  */
 void *
-#ifdef POOL_DIAGNOSTIC
 _pool_get(struct pool *pp, int flags, const char *file, long line)
-#else
-pool_get(struct pool *pp, int flags)
-#endif
 {
 	struct pool_item *pi;
 	struct pool_item_header *ph;
@@ -946,7 +942,6 @@
 /*
  * Return resource to the pool; must be called at appropriate spl level
  */
-#ifdef POOL_DIAGNOSTIC
 void
 _pool_put(struct pool *pp, void *v, const char *file, long line)
 {
@@ -961,24 +956,7 @@
 	pr_leave(pp);
 	simple_unlock(&pp->pr_slock);
 }
-#undef pool_put
-#endif /* POOL_DIAGNOSTIC */
-
-void
-pool_put(struct pool *pp, void *v)
-{
-
-	simple_lock(&pp->pr_slock);
-
-	pool_do_put(pp, v);
-
-	simple_unlock(&pp->pr_slock);
-}
 
-#ifdef POOL_DIAGNOSTIC
-#define		pool_put(h, v)	_pool_put((h), (v), __FILE__, __LINE__)
-#endif
-
 /*
  * Add N items to the pool.
  */
@@ -1249,11 +1227,7 @@
  * Release all complete pages that have not been used recently.
  */
 void
-#ifdef POOL_DIAGNOSTIC
 _pool_reclaim(struct pool *pp, const char *file, long line)
-#else
-pool_reclaim(struct pool *pp)
-#endif
 {
 	struct pool_item_header *ph, *phnext;
 	struct pool_cache *pc;
@@ -1806,7 +1780,7 @@
 {
 
 	simple_lock(&pc->pc_slock);
-	pool_cache_do_invalidate(pc, 0, pool_put);
+	pool_cache_do_invalidate(pc, 0, pool_do_put);
 	simple_unlock(&pc->pc_slock);
 }
 
Index: sys/pool.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/pool.h,v
retrieving revision 1.27
diff -u -w -r1.27 pool.h
--- sys/pool.h	2001/06/06 22:00:17	1.27
+++ sys/pool.h	2001/06/19 14:27:25
@@ -180,21 +180,12 @@
 				 int);
 void		pool_destroy(struct pool *);
 
-void		*pool_get(struct pool *, int);
-void		pool_put(struct pool *, void *);
-void		pool_reclaim(struct pool *);
-
-#ifdef POOL_DIAGNOSTIC
-/*
- * These versions do reentrancy checking.
- */
 void		*_pool_get(struct pool *, int, const char *, long);
 void		_pool_put(struct pool *, void *, const char *, long);
 void		_pool_reclaim(struct pool *, const char *, long);
 #define		pool_get(h, f)	_pool_get((h), (f), __FILE__, __LINE__)
 #define		pool_put(h, v)	_pool_put((h), (v), __FILE__, __LINE__)
 #define		pool_reclaim(h)	_pool_reclaim((h), __FILE__, __LINE__)
-#endif /* POOL_DIAGNOSTIC */
 
 int		pool_prime(struct pool *, int);
 void		pool_setlowat(struct pool *, int);