Whamcloud - gitweb
LU-1756 kernel: cleanup lustre_compat25.h
[fs/lustre-release.git] / lustre / include / linux / lustre_compat25.h
index 28ca758..6a9c060 100644 (file)
 
 #include <linux/lustre_patchless_compat.h>
 
-/* Some old kernels (like 2.6.9) may not define such SEEK_XXX. So the
- * definition allows to compile lustre client on more OS platforms. */
-#ifndef SEEK_SET
- #define SEEK_SET 0
- #define SEEK_CUR 1
- #define SEEK_END 2
-#endif
-
 #ifdef HAVE_FS_STRUCT_RWLOCK
 # define LOCK_FS_STRUCT(fs)   cfs_write_lock(&(fs)->lock)
 # define UNLOCK_FS_STRUCT(fs) cfs_write_unlock(&(fs)->lock)
@@ -111,13 +103,6 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #define current_ngroups current_cred()->group_info->ngroups
 #define current_groups current_cred()->group_info->small_block
 
-#ifndef page_private
-#define page_private(page) ((page)->private)
-#define set_page_private(page, v) ((page)->private = (v))
-#endif
-
-#define ll_kernel_locked()      kernel_locked()
-
 /*
  * OBD need working random driver, thus all our
  * initialization routines must be called after device
@@ -128,18 +113,11 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #define module_init(a)     late_initcall(a)
 #endif
 
-/* XXX our code should be using the 2.6 calls, not the other way around */
-#ifdef HAVE_TRYLOCK_PAGE
-#define TestSetPageLocked(page)         (!trylock_page(page))
+#ifndef HAVE_TRYLOCK_PAGE
+#define trylock_page(page)             (!TestSetPageLocked(page))
 #endif
 
-#define Page_Uptodate(page)             PageUptodate(page)
-#define ll_redirty_page(page)           set_page_dirty(page)
-
-#define KDEVT_INIT(val)                 (val)
-
 #define LTIME_S(time)                   (time.tv_sec)
-#define ll_path_lookup                  path_lookup
 
 #ifdef HAVE_EXPORT_INODE_PERMISSION
 #define ll_permission(inode,mask,nd)    inode_permission(inode,mask)
@@ -147,12 +125,15 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #define ll_permission(inode,mask,nd)    permission(inode,mask,nd)
 #endif
 
-#ifdef HAVE_GENERIC_PERMISSION_4ARGS
-#define ll_generic_permission(inode, mask, flags, check_acl) \
-        generic_permission(inode, mask, flags, check_acl)
+#ifdef HAVE_GENERIC_PERMISSION_2ARGS
+# define ll_generic_permission(inode, mask, flags, check_acl) \
+        generic_permission(inode, mask)
+#elif defined HAVE_GENERIC_PERMISSION_4ARGS
+# define ll_generic_permission(inode, mask, flags, check_acl) \
+        generic_permission(inode, mask, flags, check_acl)
 #else
-#define ll_generic_permission(inode, mask, flags, check_acl) \
-        generic_permission(inode, mask, check_acl)
+# define ll_generic_permission(inode, mask, flags, check_acl) \
+        generic_permission(inode, mask, check_acl)
 #endif
 
 #define ll_pgcache_lock(mapping)          cfs_spin_lock(&mapping->page_lock)
@@ -332,11 +313,7 @@ int ll_unregister_blkdev(unsigned int dev, const char *name)
 #define ll_invalidate_bdev(a,b)         invalidate_bdev((a))
 #endif
 
-#ifdef HAVE_INODE_BLKSIZE
-#define ll_inode_blksize(a)     (a)->i_blksize
-#else
 #define ll_inode_blksize(a)     (1<<(a)->i_blkbits)
-#endif
 
 #ifdef HAVE_FS_RENAME_DOES_D_MOVE
 #define LL_RENAME_DOES_D_MOVE   FS_RENAME_DOES_D_MOVE
@@ -554,16 +531,6 @@ static inline int ll_crypto_hmac(struct crypto_tfm *tfm,
 #define ll_crypto_tfm_alg_max_keysize  crypto_tfm_alg_max_keysize
 #endif /* HAVE_ASYNC_BLOCK_CIPHER */
 
-#ifdef HAVE_FILE_REMOVE_SUID
-# define ll_remove_suid(file, mnt)       file_remove_suid(file)
-#else
-# ifdef HAVE_SECURITY_PLUG
-#  define ll_remove_suid(file,mnt)      remove_suid(file->f_dentry,mnt)
-# else
-#  define ll_remove_suid(file,mnt)      remove_suid(file->f_dentry)
-# endif
-#endif
-
 #ifdef HAVE_SECURITY_PLUG
 #define ll_vfs_rmdir(dir,entry,mnt)             vfs_rmdir(dir,entry,mnt)
 #define ll_vfs_mkdir(inode,dir,mnt,mode)        vfs_mkdir(inode,dir,mnt,mode)
@@ -610,46 +577,24 @@ static inline int ll_crypto_hmac(struct crypto_tfm *tfm,
 #define cfs_path_put(nd)     path_release(nd)
 #endif
 
-#ifndef abs
-static inline int abs(int x)
-{
-        return (x < 0) ? -x : x;
-}
-#endif
-
-#ifndef labs
-static inline long labs(long x)
-{
-        return (x < 0) ? -x : x;
-}
-#endif /* HAVE_REGISTER_SHRINKER */
-
-#ifdef HAVE_INVALIDATE_INODE_PAGES
-#define invalidate_mapping_pages(mapping,s,e) invalidate_inode_pages(mapping)
-#endif
-
 #ifndef HAVE_SIMPLE_SETATTR
 #define simple_setattr(dentry, ops) inode_setattr((dentry)->d_inode, ops)
 #endif
 
 #ifndef SLAB_DESTROY_BY_RCU
-#define CFS_SLAB_DESTROY_BY_RCU 0
-#else
-#define CFS_SLAB_DESTROY_BY_RCU SLAB_DESTROY_BY_RCU
+#define SLAB_DESTROY_BY_RCU 0
 #endif
 
-#ifdef HAVE_SB_HAS_QUOTA_ACTIVE
-#define ll_sb_has_quota_active(sb, type) sb_has_quota_active(sb, type)
-#else
-#define ll_sb_has_quota_active(sb, type) sb_has_quota_enabled(sb, type)
+#ifndef HAVE_SB_HAS_QUOTA_ACTIVE
+#define sb_has_quota_active(sb, type) sb_has_quota_enabled(sb, type)
 #endif
 
-#ifdef HAVE_SB_ANY_QUOTA_LOADED
-#define ll_sb_any_quota_active(sb) sb_any_quota_loaded(sb)
-#elif defined(HAVE_SB_ANY_QUOTA_ACTIVE)
-#define ll_sb_any_quota_active(sb) sb_any_quota_active(sb)
-#else
-#define ll_sb_any_quota_active(sb) sb_any_quota_enabled(sb)
+#ifndef HAVE_SB_ANY_QUOTA_LOADED
+# ifdef HAVE_SB_ANY_QUOTA_ACTIVE
+# define sb_any_quota_loaded(sb) sb_any_quota_active(sb)
+# else
+# define sb_any_quota_loaded(sb) sb_any_quota_enabled(sb)
+# endif
 #endif
 
 static inline int