Author: pjd
Date: Wed Nov 16 21:51:17 2011
New Revision: 227588
URL: http://svn.freebsd.org/changeset/base/227588
Log:
Constify arguments for locking KPIs where possible.
This enables locking consumers to pass their own structures around as const
and
be able to assert locks embedded into those structures.
Reviewed by: ed, kib, jhb
Modified:
head/share/man/man9/lock.9
head/share/man/man9/mutex.9
head/share/man/man9/rmlock.9
head/share/man/man9/rwlock.9
head/share/man/man9/sx.9
head/sys/kern/kern_lock.c
head/sys/kern/kern_mutex.c
head/sys/kern/kern_rmlock.c
head/sys/kern/kern_rwlock.c
head/sys/kern/kern_sx.c
head/sys/kern/subr_witness.c
head/sys/sys/lock.h
head/sys/sys/lockmgr.h
head/sys/sys/mutex.h
head/sys/sys/rmlock.h
head/sys/sys/rwlock.h
head/sys/sys/sx.h
Modified: head/share/man/man9/lock.9
==
--- head/share/man/man9/lock.9 Wed Nov 16 21:37:45 2011(r227587)
+++ head/share/man/man9/lock.9 Wed Nov 16 21:51:17 2011(r227588)
@@ -26,7 +26,7 @@
.\
.\ $FreeBSD$
.\
-.Dd June 16, 2009
+.Dd November 16, 2011
.Dt LOCK 9
.Os
.Sh NAME
@@ -60,20 +60,20 @@
.Ft void
.Fn lockmgr_disown struct lock *lkp
.Ft void
-.Fn lockmgr_printinfo struct lock *lkp
+.Fn lockmgr_printinfo const struct lock *lkp
.Ft int
-.Fn lockmgr_recursed struct lock *lkp
+.Fn lockmgr_recursed const struct lock *lkp
.Ft int
.Fn lockmgr_rw struct lock *lkp u_int flags struct rwlock *ilk
.Ft int
-.Fn lockmgr_waiters struct lock *lkp
+.Fn lockmgr_waiters const struct lock *lkp
.Ft int
-.Fn lockstatus struct lock *lkp
+.Fn lockstatus const struct lock *lkp
.Pp
.Cd options INVARIANTS
.Cd options INVARIANT_SUPPORT
.Ft void
-.Fn lockmgr_assert struct lock *lkp int what
+.Fn lockmgr_assert const struct lock *lkp int what
.Sh DESCRIPTION
The
.Fn lockinit
Modified: head/share/man/man9/mutex.9
==
--- head/share/man/man9/mutex.9 Wed Nov 16 21:37:45 2011(r227587)
+++ head/share/man/man9/mutex.9 Wed Nov 16 21:51:17 2011(r227588)
@@ -28,7 +28,7 @@
.\from BSDI $Id: mutex.4,v 1.1.2.3 1998/04/27 22:53:13 ewv Exp $
.\ $FreeBSD$
.\
-.Dd December 21, 2006
+.Dd November 16, 2011
.Dt MUTEX 9
.Os
.Sh NAME
@@ -83,16 +83,16 @@
.Ft int
.Fn mtx_sleep void *chan struct mtx *mtx int priority const char
*wmesg int timo
.Ft int
-.Fn mtx_initialized struct mtx *mutex
+.Fn mtx_initialized const struct mtx *mutex
.Ft int
-.Fn mtx_owned struct mtx *mutex
+.Fn mtx_owned const struct mtx *mutex
.Ft int
-.Fn mtx_recursed struct mtx *mutex
+.Fn mtx_recursed const struct mtx *mutex
.Pp
.Cd options INVARIANTS
.Cd options INVARIANT_SUPPORT
.Ft void
-.Fn mtx_assert struct mtx *mutex int what
+.Fn mtx_assert const struct mtx *mutex int what
.In sys/kernel.h
.Fn MTX_SYSINIT name struct mtx *mtx const char *description int opts
.Sh DESCRIPTION
Modified: head/share/man/man9/rmlock.9
==
--- head/share/man/man9/rmlock.9Wed Nov 16 21:37:45 2011
(r227587)
+++ head/share/man/man9/rmlock.9Wed Nov 16 21:51:17 2011
(r227588)
@@ -26,7 +26,7 @@
.\ $FreeBSD$
.\
.\ Based on rwlock.9 man page
-.Dd November 10, 2007
+.Dd November 16, 2011
.Dt RMLOCK 9
.Os
.Sh NAME
@@ -63,7 +63,7 @@
.Ft void
.Fn rm_wunlock struct rmlock *rm
.Ft int
-.Fn rm_wowned struct rmlock *rm
+.Fn rm_wowned const struct rmlock *rm
.In sys/kernel.h
.Fn RM_SYSINIT name struct rmlock *rm const char *desc int opts
.Sh DESCRIPTION
@@ -208,7 +208,7 @@ This functions destroys a lock previousl
The
.Fa rm
lock must be unlocked.
-.It Fn rm_wowned struct rmlock *rm
+.It Fn rm_wowned const struct rmlock *rm
This function returns a non-zero value if the current thread owns an
exclusive lock on
.Fa rm .
Modified: head/share/man/man9/rwlock.9
==
--- head/share/man/man9/rwlock.9Wed Nov 16 21:37:45 2011
(r227587)
+++ head/share/man/man9/rwlock.9Wed Nov 16 21:51:17 2011
(r227588)
@@ -24,7 +24,7 @@
.\
.\ $FreeBSD$
.\
-.Dd April 1, 2008
+.Dd November 16, 2011
.Dt RWLOCK 9
.Os
.Sh NAME
@@ -78,14 +78,14 @@
.Ft int
.Fn rw_sleep void *chan struct rwlock *rw int priority const char
*wmesg int timo
.Ft int
-.Fn rw_initialized struct rwlock *rw
+.Fn rw_initialized const struct rwlock *rw
.Ft int
-.Fn rw_wowned struct rwlock *rw
+.Fn rw_wowned const struct rwlock *rw
.Pp
.Cd options INVARIANTS
.Cd options INVARIANT_SUPPORT
.Ft void
-.Fn rw_assert struct rwlock *rw int what
+.Fn rw_assert const struct rwlock *rw int what
.In sys/kernel.h
.Fn RW_SYSINIT name struct rwlock *rw const char *desc
.Sh DESCRIPTION
@@ -231,7 +231,7 @@ while waiting for an event.
For more details on the parameters to this function,
see
.Xr sleep 9 .
-.It Fn