rx: Get rid of AFS_GLOBAL_RXLOCK_KERNEL
[openafs.git] / src / rx / UKERNEL / rx_kmutex.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*
11  * rx_kmutex.h - mutex and condition variable macros for kernel environment.
12  *
13  * User-space implementation.
14  */
15
16 #ifndef _RX_KMUTEX_H_
17 #define _RX_KMUTEX_H_
18
19 #define RX_ENABLE_LOCKS         1
20
21 #define afs_kmutex_t            usr_mutex_t
22 #define afs_kcondvar_t          usr_cond_t
23 #define MUTEX_INIT(A,B,C,D)     usr_mutex_init(A)
24 #define MUTEX_ENTER(A)          usr_mutex_lock(A)
25 #define MUTEX_TRYENTER(A)       usr_mutex_trylock(A)
26 #define MUTEX_ISMINE(A)         (1)
27 #define MUTEX_EXIT(A)           usr_mutex_unlock(A)
28 #define MUTEX_DESTROY(A)        usr_mutex_destroy(A)
29 #define CV_INIT(A,B,C,D)        usr_cond_init(A)
30 #define CV_TIMEDWAIT(A,B,C)     usr_cond_timedwait(A,B,C)
31 #define CV_SIGNAL(A)            usr_cond_signal(A)
32 #define CV_BROADCAST(A)         usr_cond_broadcast(A)
33 #define CV_DESTROY(A)           usr_cond_destroy(A)
34 #define CV_WAIT(_cv, _lck)      { \
35                                     int isGlockOwner = ISAFS_GLOCK(); \
36                                     if (isGlockOwner) { \
37                                         AFS_GUNLOCK(); \
38                                     } \
39                                     usr_cond_wait(_cv, _lck); \
40                                     if (isGlockOwner) { \
41                                         MUTEX_EXIT(_lck); \
42                                         AFS_GLOCK(); \
43                                         MUTEX_ENTER(_lck); \
44                                     } \
45                                 }
46
47 #ifndef UKERNEL
48 extern void osirx_AssertMine(afs_kmutex_t * lockaddr, char *msg);
49 #endif
50
51 #define SPLVAR
52 #define NETPRI
53 #define USERPRI
54
55 #endif /* _RX_KMUTEX_H_ */