1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (c) 2003 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) && LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
29 #error sorry, lustre requires at least 2.5.69
32 #include <linux/portals_compat25.h>
34 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
35 # define PGCACHE_WRLOCK(mapping) write_lock(&mapping->page_lock)
36 # define PGCACHE_WRUNLOCK(mapping) write_unlock(&mapping->page_lock)
38 #define KDEVT_INIT(val) { .value = val }
39 #define LTIME_S(time) (time.tv_sec)
40 #define USERMODEHELPER(path, argv, envp) \
41 call_usermodehelper(path, argv, envp, 1)
42 #define ll_path_lookup path_lookup
45 #define ll_pgcache_lock(mapping) spin_lock(&mapping->page_lock)
46 #define ll_pgcache_unlock(mapping) spin_unlock(&mapping->page_lock)
50 # define PGCACHE_WRLOCK(mapping) spin_lock(&pagecache_lock)
51 # define PGCACHE_WRUNLOCK(mapping) spin_unlock(&pagecache_lock)
53 /* 2.5 uses hlists for some things, like the d_hash. we'll treat them
54 * as 2.5 and let macros drop back.. */
55 #define hlist_entry list_entry
56 #define hlist_head list_head
57 #define hlist_node list_head
58 #define HLIST_HEAD LIST_HEAD
59 #define INIT_HLIST_HEAD INIT_LIST_HEAD
60 #define hlist_del_init list_del_init
61 #define hlist_add_head list_add
62 #define hlist_for_each_safe list_for_each_safe
63 #define KDEVT_INIT(val) (val)
64 #define ext3_xattr_set_handle ext3_xattr_set
65 #define try_module_get __MOD_INC_USE_COUNT
66 #define module_put __MOD_DEC_USE_COUNT
67 #define LTIME_S(time) (time)
68 #ifndef CONFIG_RH_2_4_20
69 #define cpu_online(cpu) (cpu_online_map & (1<<cpu))
71 #define USERMODEHELPER(path, argv, envp) \
72 call_usermodehelper(path, argv, envp)
73 static inline int ll_path_lookup(const char *path, unsigned flags,
77 if (path_init(path, flags, nd))
78 error = path_walk(path, nd);
81 typedef long sector_t;
83 #define ll_pgcache_lock(mapping) spin_lock(&pagecache_lock)
84 #define ll_pgcache_unlock(mapping) spin_unlock(&pagecache_lock)
86 #endif /* end of 2.4 compat macros */
88 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
89 # define filemap_fdatasync(mapping) filemap_fdatawrite(mapping)
93 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
94 # define TryLockPage(page) TestSetPageLocked(page)
98 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
99 # define Page_Uptodate(page) PageUptodate(page)
102 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
103 #define rb_node_s rb_node
104 #define rb_root_s rb_root
105 typedef struct rb_root_s rb_root_t;
106 typedef struct rb_node_s rb_node_t;
109 #endif /* __KERNEL__ */
110 #endif /* _COMPAT25_H */