Module Name:    src
Committed By:   christos
Date:           Sat Sep 16 23:55:33 UTC 2017

Modified Files:
        src/sys/kern: kern_lock.c kern_mutex.c kern_rwlock.c subr_lockdebug.c

Log Message:
more const


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/kern/kern_lock.c
cvs rdiff -u -r1.66 -r1.67 src/sys/kern/kern_mutex.c
cvs rdiff -u -r1.46 -r1.47 src/sys/kern/kern_rwlock.c
cvs rdiff -u -r1.57 -r1.58 src/sys/kern/subr_lockdebug.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/kern_lock.c
diff -u src/sys/kern/kern_lock.c:1.158 src/sys/kern/kern_lock.c:1.159
--- src/sys/kern/kern_lock.c:1.158	Wed Jan 25 23:11:56 2017
+++ src/sys/kern/kern_lock.c	Sat Sep 16 19:55:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lock.c,v 1.158 2017/01/26 04:11:56 christos Exp $	*/
+/*	$NetBSD: kern_lock.c,v 1.159 2017/09/16 23:55:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.158 2017/01/26 04:11:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.159 2017/09/16 23:55:33 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -113,7 +113,7 @@ do {									\
 #define	_KERNEL_LOCK_ASSERT(cond)	/* nothing */
 #endif
 
-void	_kernel_lock_dump(volatile void *);
+void	_kernel_lock_dump(const volatile void *);
 
 lockops_t _kernel_lock_ops = {
 	"Kernel lock",
@@ -138,7 +138,7 @@ CTASSERT(CACHE_LINE_SIZE >= sizeof(__cpu
  * Print debugging information about the kernel lock.
  */
 void
-_kernel_lock_dump(volatile void *junk)
+_kernel_lock_dump(const volatile void *junk)
 {
 	struct cpu_info *ci = curcpu();
 

Index: src/sys/kern/kern_mutex.c
diff -u src/sys/kern/kern_mutex.c:1.66 src/sys/kern/kern_mutex.c:1.67
--- src/sys/kern/kern_mutex.c:1.66	Sat Sep 16 19:25:34 2017
+++ src/sys/kern/kern_mutex.c	Sat Sep 16 19:55:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex.c,v 1.66 2017/09/16 23:25:34 christos Exp $	*/
+/*	$NetBSD: kern_mutex.c,v 1.67 2017/09/16 23:55:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define	__MUTEX_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.66 2017/09/16 23:25:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.67 2017/09/16 23:55:33 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -264,8 +264,9 @@ __strong_alias(mutex_spin_enter,mutex_ve
 __strong_alias(mutex_spin_exit,mutex_vector_exit);
 #endif
 
-static void	mutex_abort(const char *, size_t, kmutex_t *, const char *);
-static void	mutex_dump(volatile void *);
+static void	mutex_abort(const char *, size_t, const kmutex_t *,
+    const char *);
+static void	mutex_dump(const volatile void *);
 
 lockops_t mutex_spin_lockops = {
 	"Mutex",
@@ -293,9 +294,9 @@ syncobj_t mutex_syncobj = {
  *	Dump the contents of a mutex structure.
  */
 void
-mutex_dump(volatile void *cookie)
+mutex_dump(const volatile void *cookie)
 {
-	volatile kmutex_t *mtx = cookie;
+	const volatile kmutex_t *mtx = cookie;
 
 	printf_nolog("owner field  : %#018lx wait/spin: %16d/%d\n",
 	    (long)MUTEX_OWNER(mtx->mtx_owner), MUTEX_HAS_WAITERS(mtx),
@@ -310,7 +311,7 @@ mutex_dump(volatile void *cookie)
  *	we ask the compiler to not inline it.
  */
 void __noinline
-mutex_abort(const char *func, size_t line, kmutex_t *mtx, const char *msg)
+mutex_abort(const char *func, size_t line, const kmutex_t *mtx, const char *msg)
 {
 
 	LOCKDEBUG_ABORT(func, line, mtx, (MUTEX_SPIN_P(mtx) ?

Index: src/sys/kern/kern_rwlock.c
diff -u src/sys/kern/kern_rwlock.c:1.46 src/sys/kern/kern_rwlock.c:1.47
--- src/sys/kern/kern_rwlock.c:1.46	Wed Jan 25 23:11:56 2017
+++ src/sys/kern/kern_rwlock.c	Sat Sep 16 19:55:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rwlock.c,v 1.46 2017/01/26 04:11:56 christos Exp $	*/
+/*	$NetBSD: kern_rwlock.c,v 1.47 2017/09/16 23:55:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.46 2017/01/26 04:11:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.47 2017/09/16 23:55:33 christos Exp $");
 
 #define	__RWLOCK_PRIVATE
 
@@ -112,7 +112,7 @@ do {									\
 #endif /* defined(LOCKDEBUG) */
 
 static void	rw_abort(const char *, size_t, krwlock_t *, const char *);
-static void	rw_dump(volatile void *);
+static void	rw_dump(const volatile void *);
 static lwp_t	*rw_owner(wchan_t);
 
 static inline uintptr_t
@@ -167,9 +167,9 @@ syncobj_t rw_syncobj = {
  *	Dump the contents of a rwlock structure.
  */
 static void
-rw_dump(volatile void *cookie)
+rw_dump(const volatile void *cookie)
 {
-	volatile krwlock_t *rw = cookie;
+	const volatile krwlock_t *rw = cookie;
 
 	printf_nolog("owner/count  : %#018lx flags    : %#018x\n",
 	    (long)RW_OWNER(rw), (int)RW_FLAGS(rw));

Index: src/sys/kern/subr_lockdebug.c
diff -u src/sys/kern/subr_lockdebug.c:1.57 src/sys/kern/subr_lockdebug.c:1.58
--- src/sys/kern/subr_lockdebug.c:1.57	Wed May 31 22:45:13 2017
+++ src/sys/kern/subr_lockdebug.c	Sat Sep 16 19:55:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_lockdebug.c,v 1.57 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: subr_lockdebug.c,v 1.58 2017/09/16 23:55:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.57 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.58 2017/09/16 23:55:33 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -145,14 +145,14 @@ static const rb_tree_ops_t ld_rb_tree_op
 };
 
 static inline lockdebug_t *
-lockdebug_lookup1(volatile void *lock)
+lockdebug_lookup1(const volatile void *lock)
 {
 	lockdebug_t *ld;
 	struct cpu_info *ci;
 
 	ci = curcpu();
 	__cpu_simple_lock(&ci->ci_data.cpu_ld_lock);
-	ld = (lockdebug_t *)rb_tree_find_node(&ld_rb_tree, __UNVOLATILE(lock));
+	ld = rb_tree_find_node(&ld_rb_tree, (void *)(intptr_t)lock);
 	__cpu_simple_unlock(&ci->ci_data.cpu_ld_lock);
 	if (ld == NULL) {
 		return NULL;
@@ -190,7 +190,7 @@ lockdebug_unlock_cpus(void)
  *	Find a lockdebug structure by a pointer to a lock and return it locked.
  */
 static inline lockdebug_t *
-lockdebug_lookup(const char *func, size_t line, volatile void *lock,
+lockdebug_lookup(const char *func, size_t line, const volatile void *lock,
     uintptr_t where)
 {
 	lockdebug_t *ld;
@@ -420,7 +420,7 @@ lockdebug_more(int s)
  */
 void
 lockdebug_wantlock(const char *func, size_t line,
-    volatile void *lock, uintptr_t where, int shared)
+    const volatile void *lock, uintptr_t where, int shared)
 {
 	struct lwp *l = curlwp;
 	lockdebug_t *ld;
@@ -842,7 +842,7 @@ lockdebug_lock_print(void *addr, void (*
  *	An error has been trapped - dump lock info and call panic().
  */
 void
-lockdebug_abort(const char *func, size_t line, volatile void *lock,
+lockdebug_abort(const char *func, size_t line, const volatile void *lock,
     lockops_t *ops, const char *msg)
 {
 #ifdef LOCKDEBUG

Reply via email to