From a1954178563727366f1861992413fea058d041b5 Mon Sep 17 00:00:00 2001 From: pschwan Date: Thu, 10 Jul 2003 18:42:21 +0000 Subject: [PATCH] this is a large portion of the outstanding changes on b_ad, almost all of which look trivial and readily acceptable to b_devel. landing first on b_unify to fix a few bugs and test more heavily --- lustre/include/linux/lustre_compat25.h | 70 +++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 4275a10..4c3e086 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -23,22 +23,65 @@ #ifndef _COMPAT25_H #define _COMPAT25_H -#include +#ifdef __KERNEL__ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -#define KDEVT_VAL(dev, val) dev.value = 0 -#else -#define KDEVT_VAL(dev, val) dev = 0 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) && LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69) +#error sorry, lustre requires at least 2.5.69 #endif +#include + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) # define PGCACHE_WRLOCK(mapping) write_lock(&mapping->page_lock) # define PGCACHE_WRUNLOCK(mapping) write_unlock(&mapping->page_lock) -#else + +#define KDEVT_INIT(val) { .value = val } +#define LTIME_S(time) (time.tv_sec) +#define USERMODEHELPER(path, argv, envp) \ + call_usermodehelper(path, argv, envp, 1) +#define ll_path_lookup path_lookup + + +#define ll_pgcache_lock(mapping) spin_lock(&mapping->page_lock) +#define ll_pgcache_unlock(mapping) spin_unlock(&mapping->page_lock) + +#else /* 2.4.. */ + # define PGCACHE_WRLOCK(mapping) spin_lock(&pagecache_lock) # define PGCACHE_WRUNLOCK(mapping) spin_unlock(&pagecache_lock) -#endif +/* 2.5 uses hlists for some things, like the d_hash. we'll treat them + * as 2.5 and let macros drop back.. */ +#define hlist_entry list_entry +#define hlist_head list_head +#define hlist_node list_head +#define HLIST_HEAD LIST_HEAD +#define INIT_HLIST_HEAD INIT_LIST_HEAD +#define hlist_del_init list_del_init +#define hlist_add_head list_add +#define hlist_for_each_safe list_for_each_safe +#define KDEVT_INIT(val) (val) +#define ext3_xattr_set_handle ext3_xattr_set +#define try_module_get __MOD_INC_USE_COUNT +#define module_put __MOD_DEC_USE_COUNT +#define LTIME_S(time) (time) +#define cpu_online(cpu) (cpu_online_map & (1<= KERNEL_VERSION(2,5,0) # define filemap_fdatasync(mapping) filemap_fdatawrite(mapping) @@ -54,18 +97,6 @@ # define Page_Uptodate(page) PageUptodate(page) #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -# define USERMODEHELPER(path, argv, envp) call_usermodehelper(path, argv, envp, 0) -#else -# define USERMODEHELPER(path, argv, envp) call_usermodehelper(path, argv, envp) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -# define LL_CHECK_DIRTY(sb) do { }while(0) -#else -# define LL_CHECK_DIRTY(sb) ll_check_dirty(sb) -#endif - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) #define rb_node_s rb_node #define rb_root_s rb_root @@ -73,4 +104,5 @@ typedef struct rb_root_s rb_root_t; typedef struct rb_node_s rb_node_t; #endif +#endif /* __KERNEL__ */ #endif /* _COMPAT25_H */ -- 1.8.3.1