Whamcloud - gitweb
Obsolete CURRENT_SECONDS and use cfs_time_current_sec() instead.
[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
19 #endif
20
21 struct module;
22 static inline int try_module_get(struct module *module)
23 {
24         return 1;
25 }
26
27 static inline void module_put(struct module *module)
28 {
29 }
30
31 #define THIS_MODULE                     NULL
32
33 static inline void lustre_daemonize_helper(void)
34 {
35         return;
36 }
37
38 static inline int32_t ext2_set_bit(int nr, void *a)
39 {
40         int32_t old = test_bit(nr, a);
41         set_bit(nr, a);
42         return old;
43 }
44
45 static inline int32_t ext2_clear_bit(int nr, void *a)
46 {
47         int32_t old = test_bit(nr, a);
48         clear_bit(nr, a);
49         return old;
50 }
51
52 struct nameidata;
53
54 #if !defined(__DARWIN8__)
55 static inline int ll_path_lookup(const char *path, unsigned int flags, struct nameidata *nd)
56 {
57         int ret = 0;
58         NDINIT(nd, LOOKUP, FOLLOW, UIO_SYSSPACE, (char *)path, current_proc());
59         if (ret = namei(nd)){
60                 CERROR("ll_path_lookup fail!\n");
61         }
62         return ret;
63 }
64 #endif
65
66 #define to_kdev_t(dev)                  (dev)
67 #define kdev_t_to_nr(dev)               (dev)
68 #define val_to_kdev(dev)                (dev)
69
70 #define ext2_test_bit   test_bit
71
72 #endif  /* __KERNEL__ */
73
74 #endif