#ifndef __COMPAT_ASM_PGTABLE_H_
#define __COMPAT_ASM_PGTABLE_H_
-#include <linux/version.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#include_next <asm/pgtable.h>
+#ifndef pte_offset_kernel
#define pte_offset_kernel(dir,address) pte_offset(dir,address)
-
#endif
-#include_next <asm/pgtable.h>
-
#endif /* __COMPAT_ASM_PGTABLE_H_ */
#define VM_OFFSET(a) ((a)->vm_pgoff * PAGE_SIZE)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,10) \
+ && LINUX_VERSION_CODE < KERNEL_VERSION(2,5,3)
+#include <asm/tlb.h> /* look for tlb_vma() macro for "statm" patch */
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,3) && !defined(tlb_vma)
#define REMAP_PAGE_RANGE(a,b,c,d,e) remap_page_range(b,c,d,e)
#else
#define REMAP_PAGE_RANGE(a,b,c,d,e) remap_page_range(a,b,c,d,e)