]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/gnu/fs/xfs/FreeBSD/support/mutex.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / gnu / fs / xfs / FreeBSD / support / mutex.h
1 #ifndef __XFS_SUPPORT_MUTEX_H__
2 #define __XFS_SUPPORT_MUTEX_H__
3
4 #include <sys/param.h>
5 #include <sys/lock.h>
6 #include <sys/mutex.h>
7 #include <sys/sx.h>
8
9 /*
10  * Map the mutex'es from IRIX to FreeBSD. Irix holds mutexes across
11  * sleeps, so on FreeBSD we have a choice of sema, sx or lockmgr
12  * to use as a underlining implemenation. Go with sx always locked
13  * in exclusive mode for now as it gets all the benefits of witness
14  * checking.
15  */
16 typedef struct sx mutex_t;
17
18 #define mutex_init(lock, type, name)    sx_init(lock, name)
19 #define mutex_lock(lock, num)           sx_xlock(lock)
20 #define mutex_trylock(lock)             sx_try_xlock(lock)
21 #define mutex_unlock(lock)              sx_xunlock(lock)
22 #define mutex_destroy(lock)             sx_destroy(lock)
23
24 /*
25  * Type for mutex_init()
26  */
27 #define MUTEX_DEFAULT           0
28
29 #endif /* __XFS_SUPPORT_MUTEX_H__ */