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 ll_path_lookup path_lookup
43 #define ll_pgcache_lock(mapping) spin_lock(&mapping->page_lock)
44 #define ll_pgcache_unlock(mapping) spin_unlock(&mapping->page_lock)
48 # define PGCACHE_WRLOCK(mapping) spin_lock(&pagecache_lock)
49 # define PGCACHE_WRUNLOCK(mapping) spin_unlock(&pagecache_lock)
51 /* 2.5 uses hlists for some things, like the d_hash. we'll treat them
52 * as 2.5 and let macros drop back.. */
53 #define hlist_entry list_entry
54 #define hlist_head list_head
55 #define hlist_node list_head
56 #define HLIST_HEAD LIST_HEAD
57 #define INIT_HLIST_HEAD INIT_LIST_HEAD
58 #define hlist_del_init list_del_init
59 #define hlist_add_head list_add
60 #define hlist_for_each_safe list_for_each_safe
61 #define KDEVT_INIT(val) (val)
62 #define ext3_xattr_set_handle ext3_xattr_set
63 #define try_module_get __MOD_INC_USE_COUNT
64 #define module_put __MOD_DEC_USE_COUNT
65 #define LTIME_S(time) (time)
66 #ifndef CONFIG_RH_2_4_20
67 #define cpu_online(cpu) (cpu_online_map & (1<<cpu))
70 static inline int ll_path_lookup(const char *path, unsigned flags,
74 if (path_init(path, flags, nd))
75 error = path_walk(path, nd);
78 typedef long sector_t;
80 #define ll_pgcache_lock(mapping) spin_lock(&pagecache_lock)
81 #define ll_pgcache_unlock(mapping) spin_unlock(&pagecache_lock)
83 #endif /* end of 2.4 compat macros */
85 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
86 # define filemap_fdatasync(mapping) filemap_fdatawrite(mapping)
90 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
91 # define TryLockPage(page) TestSetPageLocked(page)
95 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
96 # define Page_Uptodate(page) PageUptodate(page)
99 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
100 #define rb_node_s rb_node
101 #define rb_root_s rb_root
102 typedef struct rb_root_s rb_root_t;
103 typedef struct rb_node_s rb_node_t;
106 #endif /* __KERNEL__ */
107 #endif /* _COMPAT25_H */