#ifndef LIBLUSTRE_H__
#define LIBLUSTRE_H__
-#include <asm/byteorder.h>
#include <sys/mman.h>
+#include <asm/byteorder.h>
#ifndef __CYGWIN__
#include <stdint.h>
#include <asm/page.h>
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
-#define loff_t __u64
+#define loff_t long long
#define ERESTART 2001
typedef unsigned short umode_t;
#define __MOD_DEC_USE_COUNT(m) do {} while (0)
#define MOD_INC_USE_COUNT do {} while (0)
#define MOD_DEC_USE_COUNT do {} while (0)
-#define try_module_get __MOD_INC_USE_COUNT
-#define module_put __MOD_DEC_USE_COUNT
+static inline void __module_get(struct module *module)
+{
+}
+
+static inline int try_module_get(struct module *module)
+{
+ return 1;
+}
+
+static inline void module_put(struct module *module)
+{
+}
/* module initialization */
extern int init_obdclass(void);
/* general stuff */
-#define jiffies 0
#define EXPORT_SYMBOL(S)
-typedef int spinlock_t;
+typedef struct { } spinlock_t;
typedef __u64 kdev_t;
-#define SPIN_LOCK_UNLOCKED 0
+#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
#define LASSERT_SPIN_LOCKED(lock) do {} while(0)
static inline void spin_lock(spinlock_t *l) {return;}
#endif
};
+/* 2.4 defines */
+#define PAGE_LIST_ENTRY list
+#define PAGE_LIST(page) ((page)->list)
+
#define kmap(page) (page)->addr
#define kunmap(a) do {} while (0)
int count;
};
-#define down(a) do {} while (0)
-#define up(a) do {} while (0)
-#define down_read(a) do {} while (0)
-#define up_read(a) do {} while (0)
-#define down_write(a) do {} while (0)
-#define up_write(a) do {} while (0)
-#define sema_init(a,b) do {} while (0)
-#define init_rwsem(a) do {} while (0)
+/* use the macro's argument to avoid unused warnings */
+#define down(a) do { (void)a; } while (0)
+#define up(a) do { (void)a; } while (0)
+#define down_read(a) do { (void)a; } while (0)
+#define up_read(a) do { (void)a; } while (0)
+#define down_write(a) do { (void)a; } while (0)
+#define up_write(a) do { (void)a; } while (0)
+#define sema_init(a,b) do { (void)a; } while (0)
+#define init_rwsem(a) do { (void)a; } while (0)
#define DECLARE_MUTEX(name) \
struct semaphore name = { 1 }
static inline void init_MUTEX (struct semaphore *sem)
#define del_wait_queue(p) do { list_del(&(p)->sleeping); } while (0)
#define remove_wait_queue(q,p) do { list_del(&(p)->sleeping); } while (0)
+#define DECLARE_WAIT_QUEUE_HEAD(HEAD) \
+ wait_queue_head_t HEAD = { \
+ .sleepers = LIST_HEAD_INIT(HEAD.sleepers) \
+ }
#define init_waitqueue_head(l) INIT_LIST_HEAD(&(l)->sleepers)
#define wake_up(l) do { int a; a++; } while (0)
#define TASK_INTERRUPTIBLE 0
#define SIGNAL_MASK_ASSERT()
#define KERN_INFO
+#include <sys/time.h>
+#if HZ != 1
+#error "liblustre's jiffies currently expects HZ to be 1"
+#endif
+#define jiffies \
+({ \
+ unsigned long _ret = 0; \
+ struct timeval tv; \
+ if (gettimeofday(&tv, NULL) == 0) \
+ _ret = tv.tv_sec; \
+ _ret; \
+})
+#define time_after(a, b) ((long)(b) - (long)(a) > 0)
+#define time_before(a, b) time_after(b,a)
struct timer_list {
struct list_head tl_list;
free(l);
}
-#define time_after(a, b) \
-({ \
- 1; \
-})
-
typedef struct { volatile int counter; } atomic_t;
#define atomic_read(a) ((a)->counter)