OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/rx/UKERNEL/rx_kmutex.h
00001 /*
00002  * Copyright 2000, International Business Machines Corporation and others.
00003  * All Rights Reserved.
00004  *
00005  * This software has been released under the terms of the IBM Public
00006  * License.  For details, see the LICENSE file in the top-level source
00007  * directory or online at http://www.openafs.org/dl/license10.html
00008  */
00009 
00010 /*
00011  * rx_kmutex.h - mutex and condition variable macros for kernel environment.
00012  *
00013  * User-space implementation.
00014  */
00015 
00016 #ifndef _RX_KMUTEX_H_
00017 #define _RX_KMUTEX_H_
00018 
00019 #define AFS_GLOBAL_RXLOCK_KERNEL
00020 #define RX_ENABLE_LOCKS         1
00021 
00022 #define afs_kmutex_t            usr_mutex_t
00023 #define afs_kcondvar_t          usr_cond_t
00024 #define MUTEX_INIT(A,B,C,D)     usr_mutex_init(A)
00025 #define MUTEX_ENTER(A)          usr_mutex_lock(A)
00026 #define MUTEX_TRYENTER(A)       usr_mutex_trylock(A)
00027 #define MUTEX_ISMINE(A)         (1)
00028 #define MUTEX_EXIT(A)           usr_mutex_unlock(A)
00029 #define MUTEX_DESTROY(A)        usr_mutex_destroy(A)
00030 #define CV_INIT(A,B,C,D)        usr_cond_init(A)
00031 #define CV_TIMEDWAIT(A,B,C)     usr_cond_timedwait(A,B,C)
00032 #define CV_SIGNAL(A)            usr_cond_signal(A)
00033 #define CV_BROADCAST(A)         usr_cond_broadcast(A)
00034 #define CV_DESTROY(A)           usr_cond_destroy(A)
00035 #define CV_WAIT(_cv, _lck)      { \
00036                                     int isGlockOwner = ISAFS_GLOCK(); \
00037                                     if (isGlockOwner) { \
00038                                         AFS_GUNLOCK(); \
00039                                     } \
00040                                     usr_cond_wait(_cv, _lck); \
00041                                     if (isGlockOwner) { \
00042                                         MUTEX_EXIT(_lck); \
00043                                         AFS_GLOCK(); \
00044                                         MUTEX_ENTER(_lck); \
00045                                     } \
00046                                 }
00047 
00048 #ifndef UKERNEL
00049 extern void osirx_AssertMine(afs_kmutex_t * lockaddr, char *msg);
00050 #endif
00051 
00052 #define SPLVAR
00053 #define NETPRI
00054 #define USERPRI
00055 
00056 #endif /* _RX_KMUTEX_H_ */
 All Data Structures Files Functions Variables