Whamcloud - gitweb
b=15625
[fs/lustre-release.git] / lustre / include / liblustre.h
index 4a89f50..79ffd50 100644 (file)
 #define __LINUX_SPINLOCK_H
 #endif
 
+#include <libcfs/libcfs.h>
+#include <lnet/lnet.h>
+#include <libcfs/user-bitops.h>
+
 #include <sys/mman.h>
 #ifdef HAVE_STDINT_H
 # include <stdint.h>
@@ -47,9 +51,6 @@
 #ifdef HAVE_SYS_IOCTL_H
 # include <sys/ioctl.h>
 #endif
-#ifndef _IOWR
-# include "ioctl.h"
-#endif
 
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <assert.h>
 
+#include <libcfs/libcfs.h>
 #include <libcfs/list.h>
 #include <lnet/lnet.h>
-#include <libcfs/kp30.h>
 #include <libcfs/user-bitops.h>
 
+#ifndef _IOWR
+# include "ioctl.h"
+#endif
+
 /* definitions for liblustre */
 
 #ifdef __CYGWIN__
 
-#define CFS_PAGE_SHIFT 12
-#define CFS_PAGE_SIZE (1UL << CFS_PAGE_SHIFT)
-#define CFS_PAGE_MASK (~((__u64)CFS_PAGE_SIZE-1))
 #define loff_t long long
 #define ERESTART 2001
 typedef unsigned short umode_t;
 
 #endif
 
-#ifndef CURRENT_SECONDS
-# define CURRENT_SECONDS time(0)
-#endif
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) ((sizeof (a))/(sizeof ((a)[0])))
@@ -165,24 +164,6 @@ struct file; /* forward ref */
 typedef int (write_proc_t)(struct file *file, const char *buffer,
                            unsigned long count, void *data);
 
-#define NIPQUAD(addr) \
-        ((unsigned char *)&addr)[0], \
-        ((unsigned char *)&addr)[1], \
-        ((unsigned char *)&addr)[2], \
-        ((unsigned char *)&addr)[3]
-
-#if defined(__LITTLE_ENDIAN)
-#define HIPQUAD(addr) \
-        ((unsigned char *)&addr)[3], \
-        ((unsigned char *)&addr)[2], \
-        ((unsigned char *)&addr)[1], \
-        ((unsigned char *)&addr)[0]
-#elif defined(__BIG_ENDIAN)
-#define HIPQUAD NIPQUAD
-#else
-#error "Undefined byteorder??"
-#endif /* __LITTLE_ENDIAN */
-
 /* bits ops */
 
 /* a long can be more than 32 bits, so use BITS_PER_LONG
@@ -299,7 +280,7 @@ typedef spinlock_t rwlock_t;
 #define read_unlock(l)          spin_unlock(l)
 #define write_lock(l)           spin_lock(l)
 #define write_unlock(l)         spin_unlock(l)
-
+#define rwlock_init(l)          spin_lock_init(l)
 
 #define min(x,y) ((x)<(y) ? (x) : (y))
 #define max(x,y) ((x)>(y) ? (x) : (y))
@@ -608,9 +589,9 @@ static inline int capable(int cap)
 
 #define DECLARE_WAIT_QUEUE_HEAD(HEAD)                           \
         wait_queue_head_t HEAD = {                              \
-                .sleepers = LIST_HEAD_INIT(HEAD.sleepers)       \
+                .sleepers = CFS_LIST_HEAD_INIT(HEAD.sleepers)   \
         }
-#define init_waitqueue_head(l) INIT_LIST_HEAD(&(l)->sleepers)
+#define init_waitqueue_head(l) CFS_INIT_LIST_HEAD(&(l)->sleepers)
 #define wake_up(l) do { int a; a++; } while (0)
 #define TASK_INTERRUPTIBLE 0
 #define TASK_UNINTERRUPTIBLE 1
@@ -681,7 +662,7 @@ static inline int timer_pending(struct timer_list *l)
 
 static inline int init_timer(struct timer_list *l)
 {
-        INIT_LIST_HEAD(&l->tl_list);
+        CFS_INIT_LIST_HEAD(&l->tl_list);
         return 0;
 }