summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2011-11-20 16:33:09 +0000
committerattilio <attilio@FreeBSD.org>2011-11-20 16:33:09 +0000
commit6a69e947d3eb5ffaceb04f999c1925ed771b7546 (patch)
tree1fcde0be5ef74d1581c3a825bc7f36ff5d1c05b3 /sys/kern/kern_mutex.c
parentbf5f03ca46a93268d5d0eccc7318039bda9106d2 (diff)
downloadFreeBSD-src-6a69e947d3eb5ffaceb04f999c1925ed771b7546.zip
FreeBSD-src-6a69e947d3eb5ffaceb04f999c1925ed771b7546.tar.gz
Introduce macro stubs in the mutex implementation that will be always
defined and will allow consumers, willing to provide options, file and line to locking requests, to not worry about options redefining the interfaces. This is typically useful when there is the need to build another locking interface on top of the mutex one. The introduced functions that consumers can use are: - mtx_lock_flags_ - mtx_unlock_flags_ - mtx_lock_spin_flags_ - mtx_unlock_spin_flags_ - mtx_assert_ - thread_lock_flags_ Spare notes: - Likely we can get rid of all the 'INVARIANTS' specification in the ppbus code by using the same macro as done in this patch (but this is left to the ppbus maintainer) - all the other locking interfaces may require a similar cleanup, where the most notable case is sx which will allow a further cleanup of vm_map locking facilities - The patch should be fully compatible with older branches, thus a MFC is previewed (infact it uses all the underlying mechanisms already present). Comments review by: eadler, Ben Kaduk Discussed with: kib, jhb MFC after: 1 month
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 7666116..eddb0d3 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -274,7 +274,7 @@ _mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line)
* is already owned, it will recursively acquire the lock.
*/
int
-_mtx_trylock(struct mtx *m, int opts, const char *file, int line)
+mtx_trylock_flags_(struct mtx *m, int opts, const char *file, int line)
{
#ifdef LOCK_PROFILING
uint64_t waittime = 0;
@@ -540,7 +540,7 @@ _mtx_lock_spin(struct mtx *m, uintptr_t tid, int opts, const char *file,
#endif /* SMP */
void
-_thread_lock_flags(struct thread *td, int opts, const char *file, int line)
+thread_lock_flags_(struct thread *td, int opts, const char *file, int line)
{
struct mtx *m;
uintptr_t tid;
OpenPOWER on IntegriCloud