2 * Copyright 2000, International Business Machines Corporation and others.
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
11 * rx_kmutex.h - mutex and condition variable macros for kernel environment.
13 * Linux implementation.
14 * This are noops until such time as the kernel no longer has a global lock.
19 #include "rx/rx_kernel.h" /* for osi_Panic() */
21 /* AFS_GLOBAL_RXLOCK_KERNEL is defined so that the busy tq code paths are
22 * used. The thread can sleep when sending packets.
24 #define AFS_GLOBAL_RXLOCK_KERNEL 1
27 #define RX_ENABLE_LOCKS 1
29 #ifndef _LINUX_CODA_FS_I
30 #define _LINUX_CODA_FS_I
31 struct coda_inode_info {
34 #include "linux/wait.h"
35 #include "linux/sched.h"
37 typedef struct afs_kmutex {
42 #ifndef set_current_state
43 #define set_current_state(X) current->state=X
46 typedef struct afs_kcondvar {
48 #if defined(AFS_LINUX24_ENV)
49 wait_queue_head_t waitq;
51 struct wait_queue *waitq;
56 MUTEX_ISMINE(afs_kmutex_t * l)
58 return l->owner == current->pid;
61 #define MUTEX_INIT(a,b,c,d) afs_mutex_init(a)
62 #define MUTEX_DESTROY(a)
63 #define MUTEX_ENTER afs_mutex_enter
64 #define MUTEX_TRYENTER afs_mutex_tryenter
65 #define MUTEX_EXIT afs_mutex_exit
67 #if defined(AFS_LINUX24_ENV)
68 #define CV_INIT(cv,b,c,d) do { (cv)->seq = 0; init_waitqueue_head(&(cv)->waitq); } while (0)
70 #define CV_INIT(cv,b,c,d) do { (cv)->seq = 0; init_waitqueue(&(cv)->waitq); } while (0)
72 #define CV_DESTROY(cv)
73 #define CV_WAIT_SIG(cv, m) afs_cv_wait(cv, m, 1)
74 #define CV_WAIT(cv, m) afs_cv_wait(cv, m, 0)
75 #define CV_TIMEDWAIT afs_cv_timedwait
77 #define CV_SIGNAL(cv) do { ++(cv)->seq; wake_up(&(cv)->waitq); } while (0)
78 #if defined(AFS_LINUX24_ENV)
79 #define CV_BROADCAST(cv) do { ++(cv)->seq; wake_up_all(&(cv)->waitq); } while (0)
81 #define CV_BROADCAST(cv) do { ++(cv)->seq; wake_up(&(cv)->waitq); } while (0)
84 #endif /* RX_KMUTEX_H_ */