Module Name:    src
Committed By:   christos
Date:           Thu Nov  9 15:53:40 UTC 2017

Modified Files:
        src/sys/kern: subr_pool.c

Log Message:
make the KASSERTMSG/panic strings consistent as '%s: [%s], __func__, wchan'


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/sys/kern/subr_pool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.212 src/sys/kern/subr_pool.c:1.213
--- src/sys/kern/subr_pool.c:1.212	Thu Nov  9 10:40:23 2017
+++ src/sys/kern/subr_pool.c	Thu Nov  9 10:53:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.212 2017/11/09 15:40:23 christos Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.213 2017/11/09 15:53:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.212 2017/11/09 15:40:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.213 2017/11/09 15:53:40 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -487,7 +487,7 @@ pool_init(struct pool *pp, size_t size, 
 	 */
 	TAILQ_FOREACH(pp1, &pool_head, pr_poollist) {
 		if (pp == pp1)
-			panic("pool_init: pool %s already initialised",
+			panic("%s: [%s] already initialised", __func__,
 			    wchan);
 	}
 	if (__predict_true(!cold))
@@ -528,8 +528,8 @@ pool_init(struct pool *pp, size_t size, 
 
 	prsize = roundup(prsize, align);
 	KASSERTMSG((prsize <= palloc->pa_pagesz),
-	    "pool_init: pool item size (%zu) larger than page size (%u)",
-	    prsize, palloc->pa_pagesz);
+	    "%s: [%s] pool item size (%zu) larger than page size (%u)",
+	    __func__, wchan, prsize, palloc->pa_pagesz);
 
 	/*
 	 * Initialize the pool structure.
@@ -612,7 +612,8 @@ pool_init(struct pool *pp, size_t size, 
 			 * if you see this panic, consider to tweak
 			 * PHPOOL_MAX and PHPOOL_FREELIST_NELEM.
 			 */
-			panic("%s: too large itemsperpage(%d) for PR_NOTOUCH",
+			panic("%s: [%s] too large itemsperpage(%d) for "
+			    "PR_NOTOUCH", __func__,
 			    pp->pr_wchan, pp->pr_itemsperpage);
 		}
 		pp->pr_phpool = &phpool[idx];
@@ -700,7 +701,7 @@ pool_destroy(struct pool *pp)
 
 	KASSERT(pp->pr_cache == NULL);
 	KASSERTMSG((pp->pr_nout == 0),
-	    "pool_destroy: pool busy: still out: %u", pp->pr_nout);
+	    "%s: pool busy: still out: %u", __func__, pp->pr_nout);
 	KASSERT(LIST_EMPTY(&pp->pr_fullpages));
 	KASSERT(LIST_EMPTY(&pp->pr_partpages));
 
@@ -722,7 +723,7 @@ pool_set_drain_hook(struct pool *pp, voi
 
 	/* XXX no locking -- must be used just after pool_init() */
 	KASSERTMSG((pp->pr_drain_hook == NULL),
-	    "pool_set_drain_hook(%s): already set", pp->pr_wchan);
+	    "%s: [%s] already set", __func__, pp->pr_wchan);
 	pp->pr_drain_hook = fn;
 	pp->pr_drain_hook_arg = arg;
 }
@@ -733,7 +734,7 @@ pool_alloc_item_header(struct pool *pp, 
 	struct pool_item_header *ph;
 
 	if ((pp->pr_roflags & PR_PHINPAGE) != 0)
-		ph = (struct pool_item_header *) ((char *)storage + pp->pr_phoffset);
+		ph = (void *)((char *)storage + pp->pr_phoffset);
 	else
 		ph = pool_get(pp->pr_phpool, flags);
 
@@ -751,12 +752,12 @@ pool_get(struct pool *pp, int flags)
 	void *v;
 
 	KASSERTMSG((pp->pr_itemsperpage != 0),
-	    "pool_get: pool '%s': pr_itemsperpage is zero, "
-	    "pool not initialized?", pp->pr_wchan);
+	    "%s: [%s] pr_itemsperpage is zero, "
+	    "pool not initialized?", __func__, pp->pr_wchan);
 	KASSERTMSG((!(cpu_intr_p() || cpu_softintr_p())
 		|| pp->pr_ipl != IPL_NONE || cold || panicstr != NULL),
-	    "pool '%s' is IPL_NONE, but called from interrupt context",
-	    pp->pr_wchan);
+	    "%s: [%s] is IPL_NONE, but called from interrupt context",
+	    __func__, pp->pr_wchan);
 	if (flags & PR_WAITOK) {
 		ASSERT_SLEEPABLE();
 	}
@@ -769,7 +770,7 @@ pool_get(struct pool *pp, int flags)
 	 * the pool.
 	 */
 	KASSERTMSG((pp->pr_nout <= pp->pr_hardlimit),
-	    "pool_get: %s: crossed hard limit", pp->pr_wchan);
+	    "%s: %s: crossed hard limit", __func__, pp->pr_wchan);
 	if (__predict_false(pp->pr_nout == pp->pr_hardlimit)) {
 		if (pp->pr_drain_hook != NULL) {
 			/*
@@ -821,9 +822,8 @@ pool_get(struct pool *pp, int flags)
 		int error;
 
 		KASSERTMSG((pp->pr_nitems == 0),
-		    "pool_get: nitems inconsistent"
-		    ": %s: curpage NULL, nitems %u",
-		    pp->pr_wchan, pp->pr_nitems);
+		    "%s: [%s] curpage NULL, inconsistent nitems %u",
+		    __func__, pp->pr_wchan, pp->pr_nitems);
 
 		/*
 		 * Call the back-end page allocator for more memory.
@@ -860,21 +860,20 @@ pool_get(struct pool *pp, int flags)
 	}
 	if (pp->pr_roflags & PR_NOTOUCH) {
 		KASSERTMSG((ph->ph_nmissing < pp->pr_itemsperpage),
-		    "pool_get: %s: page empty", pp->pr_wchan);
+		    "%s: %s: page empty", __func__, pp->pr_wchan);
 		v = pr_item_notouch_get(pp, ph);
 	} else {
 		v = pi = LIST_FIRST(&ph->ph_itemlist);
 		if (__predict_false(v == NULL)) {
 			mutex_exit(&pp->pr_lock);
-			panic("pool_get: %s: page empty", pp->pr_wchan);
+			panic("%s: [%s] page empty", __func__, pp->pr_wchan);
 		}
 		KASSERTMSG((pp->pr_nitems > 0),
-		    "pool_get: nitems inconsistent"
-		    ": %s: items on itemlist, nitems %u",
-		    pp->pr_wchan, pp->pr_nitems);
+		    "%s: [%s] nitems %u inconsistent on itemlist",
+		    __func__, pp->pr_wchan, pp->pr_nitems);
 		KASSERTMSG((pi->pi_magic == PI_MAGIC),
-		    "pool_get(%s): free list modified: "
-		    "magic=%x; page %p; item addr %p",
+		    "%s: [%s] free list modified: "
+		    "magic=%x; page %p; item addr %p", __func__,
 		    pp->pr_wchan, pi->pi_magic, ph->ph_page, pi);
 
 		/*
@@ -899,7 +898,8 @@ pool_get(struct pool *pp, int flags)
 	if (ph->ph_nmissing == pp->pr_itemsperpage) {
 		KASSERTMSG(((pp->pr_roflags & PR_NOTOUCH) ||
 			LIST_EMPTY(&ph->ph_itemlist)),
-		    "pool_get: %s: nmissing inconsistent", pp->pr_wchan);
+		    "%s: [%s] nmissing (%u) inconsistent", __func__,
+			pp->pr_wchan, ph->ph_nmissing);
 		/*
 		 * This page is now full.  Move it to the full list
 		 * and select a new current page.
@@ -945,10 +945,10 @@ pool_do_put(struct pool *pp, void *v, st
 	LOCKDEBUG_MEM_CHECK(v, pp->pr_size);
 
 	KASSERTMSG((pp->pr_nout > 0),
-	    "pool_put: pool %s: putting with none out", pp->pr_wchan);
+	    "%s: [%s] putting with none out", __func__, pp->pr_wchan);
 
 	if (__predict_false((ph = pr_find_pagehead(pp, v)) == NULL)) {
-		panic("pool_put: %s: page header missing", pp->pr_wchan);
+		panic("%s: [%s] page header missing", __func__,  pp->pr_wchan);
 	}
 
 	/*
@@ -1157,7 +1157,7 @@ pool_prime_page(struct pool *pp, void *s
 	KASSERT(mutex_owned(&pp->pr_lock));
 	KASSERTMSG(((pp->pr_roflags & PR_NOALIGN) ||
 		(((uintptr_t)cp & (pp->pr_alloc->pa_pagesz - 1)) == 0)),
-	    "pool_prime_page: %s: unaligned page: %p", pp->pr_wchan, cp);
+	    "%s: [%s] unaligned page: %p", __func__, pp->pr_wchan, cp);
 
 	/*
 	 * Insert page header.
@@ -2228,8 +2228,8 @@ pool_cache_get_paddr(pool_cache_t pc, in
 
 	KASSERTMSG((!cpu_intr_p() && !cpu_softintr_p()) ||
 	    (pc->pc_pool.pr_ipl != IPL_NONE || cold || panicstr != NULL),
-	    "pool '%s' is IPL_NONE, but called from interrupt context\n",
-	    pc->pc_pool.pr_wchan);
+	    "%s: [%s] is IPL_NONE, but called from interrupt context",
+	    __func__, pc->pc_pool.pr_wchan);
 
 	if (flags & PR_WAITOK) {
 		ASSERT_SLEEPABLE();

Reply via email to