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)
37 * OBD need working random driver, thus all our
38 * initialization routines must be called after device
39 * driver initialization
41 #define module_init(a) late_initcall(a)
43 /* XXX our code should be using the 2.6 calls, not the other way around */
44 #define TryLockPage(page) TestSetPageLocked(page)
45 #define filemap_fdatasync(mapping) filemap_fdatawrite(mapping)
46 #define Page_Uptodate(page) PageUptodate(page)
48 #define KDEVT_INIT(val) (val)
50 #define LTIME_S(time) (time.tv_sec)
51 #define ll_path_lookup path_lookup
52 #define ll_permission permission
54 #define ll_pgcache_lock(mapping) spin_lock(&mapping->page_lock)
55 #define ll_pgcache_unlock(mapping) spin_unlock(&mapping->page_lock)
57 #define ll_vfs_create(a,b,c,d) vfs_create(a,b,c,d)
59 #define ll_dev_t dev_t
61 #define to_kdev_t(dev) (dev)
62 #define kdev_t_to_nr(dev) (dev)
63 #define val_to_kdev(dev) (dev)
64 #define ILOOKUP(sb, ino, test, data) ilookup5(sb, ino, test, data);
66 #include <linux/writeback.h>
68 static inline void lustre_daemonize_helper(void)
70 LASSERT(current->signal != NULL);
71 current->signal->session = 1;
72 current->signal->pgrp = 1;
73 current->signal->tty = NULL;
76 #define rb_node_s rb_node
77 #define rb_root_s rb_root
78 typedef struct rb_root_s rb_root_t;
79 typedef struct rb_node_s rb_node_t;
83 #define ll_vfs_create(a,b,c,d) vfs_create(a,b,c)
84 #define ll_permission(a,b,c) permission(a,b)
85 #define ILOOKUP(sb, ino, test, data) ilookup4(sb, ino, test, data);
86 #define DCACHE_DISCONNECTED DCACHE_NFSD_DISCONNECTED
89 static inline void clear_page_dirty(struct page *page)
95 /* 2.5 uses hlists for some things, like the d_hash. we'll treat them
96 * as 2.5 and let macros drop back.. */
97 #ifndef HLIST_HEAD /* until we get a kernel newer than l28 */
98 #define hlist_entry list_entry
99 #define hlist_head list_head
100 #define hlist_node list_head
101 #define HLIST_HEAD LIST_HEAD
102 #define INIT_HLIST_HEAD INIT_LIST_HEAD
103 #define hlist_del_init list_del_init
104 #define hlist_add_head list_add
105 #define hlist_for_each_safe list_for_each_safe
107 #define KDEVT_INIT(val) (val)
108 #define ext3_xattr_set_handle ext3_xattr_set
109 #define extN_xattr_set_handle extN_xattr_set
110 #define try_module_get __MOD_INC_USE_COUNT
111 #define module_put __MOD_DEC_USE_COUNT
112 #define LTIME_S(time) (time)
113 #ifndef CONFIG_RH_2_4_20
114 #define cpu_online(cpu) (cpu_online_map & (1<<cpu))
117 static inline int ll_path_lookup(const char *path, unsigned flags,
118 struct nameidata *nd)
121 if (path_init(path, flags, nd))
122 error = path_walk(path, nd);
125 #define ll_permission(a,b,c) permission(a,b)
126 typedef long sector_t;
128 #define ll_pgcache_lock(mapping) spin_lock(&pagecache_lock)
129 #define ll_pgcache_unlock(mapping) spin_unlock(&pagecache_lock)
131 static inline void __d_drop(struct dentry *dentry)
133 list_del(&dentry->d_hash);
134 INIT_LIST_HEAD(&dentry->d_hash);
137 static inline void lustre_daemonize_helper(void)
139 current->session = 1;
144 #ifndef conditional_schedule
145 #define conditional_schedule() if (unlikely(need_resched())) schedule()
148 #endif /* end of 2.4 compat macros */
150 #endif /* __KERNEL__ */
151 #endif /* _COMPAT25_H */