linux-updates-20060309
[openafs.git] / src / rx / LINUX / rx_kmutex.h
index 8e08f00..6ea4faf 100644 (file)
 struct coda_inode_info {
 };
 #endif
-#include "linux/wait.h"
-#include "linux/sched.h"
+#include <linux/version.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+#include <linux/mutex.h>
+#else
+#include <asm/semaphore.h>
+#endif
 
 typedef struct afs_kmutex {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+    struct mutex mutex;
+#else
     struct semaphore sem;
+#endif
     int owner;
 } afs_kmutex_t;
 
@@ -65,9 +75,9 @@ MUTEX_ISMINE(afs_kmutex_t * l)
 #define MUTEX_EXIT             afs_mutex_exit
 
 #if defined(AFS_LINUX24_ENV)
-#define CV_INIT(cv,b,c,d)      do { (cv)->seq = 0; init_waitqueue_head(&(cv)->waitq); } while (0)
+#define CV_INIT(cv,b,c,d)       do { (cv)->seq = 0; init_waitqueue_head(&(cv)->waitq); } while (0)
 #else
-#define CV_INIT(cv,b,c,d)      init_waitqueue((struct wait_queue**)(cv))
+#define CV_INIT(cv,b,c,d)      do { (cv)->seq = 0; init_waitqueue(&(cv)->waitq); } while (0)
 #endif
 #define CV_DESTROY(cv)
 #define CV_WAIT_SIG(cv, m)     afs_cv_wait(cv, m, 1)