Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / include / darwin / lustre_compat.h
1 #ifndef __DARWIN_LUSTRE_COMPAT_H__
2 #define __DARWIN_LUSTRE_COMPAT_H__
3
4 #include <libcfs/libcfs.h>
5
6 #ifdef __KERNEL__
7
8 #ifndef HLIST_HEAD
9 #define hlist_entry                     list_entry
10 #define hlist_head                      list_head
11 #define hlist_node                      list_head
12 #define hlist_del_init                  list_del_init
13 #define hlist_add_head                  list_add
14 #define hlist_for_each_safe             list_for_each_safe
15
16 /* XXX */
17 #define LOOKUP_COBD                     4096
18 #define CURRENT_SECONDS                 cfs_unix_seconds()
19
20 #endif
21
22 struct module;
23 static inline int try_module_get(struct module *module)
24 {
25         return 1;
26 }
27
28 static inline void module_put(struct module *module)
29 {
30 }
31
32 #define THIS_MODULE                     NULL
33
34 static inline void lustre_daemonize_helper(void)
35 {
36         return;
37 }
38
39 static inline int32_t ext2_set_bit(int nr, void *a)
40 {
41         int32_t old = test_bit(nr, a);
42         set_bit(nr, a);
43         return old;
44 }
45
46 static inline int32_t ext2_clear_bit(int nr, void *a)
47 {
48         int32_t old = test_bit(nr, a);
49         clear_bit(nr, a);
50         return old;
51 }
52
53 struct nameidata;
54
55 #if !defined(__DARWIN8__)
56 static inline int ll_path_lookup(const char *path, unsigned int flags, struct nameidata *nd)
57 {
58         int ret = 0;
59         NDINIT(nd, LOOKUP, FOLLOW, UIO_SYSSPACE, (char *)path, current_proc());
60         if (ret = namei(nd)){
61                 CERROR("ll_path_lookup fail!\n");
62         }
63         return ret;
64 }
65 #endif
66
67 #define to_kdev_t(dev)                  (dev)
68 #define kdev_t_to_nr(dev)               (dev)
69 #define val_to_kdev(dev)                (dev)
70
71 #define ext2_test_bit   test_bit
72
73 #endif  /* __KERNEL__ */
74
75 #endif