hugetlb: introduce generic version of prepare_hugepage_range
[muen/linux.git] / include / asm-generic / hugetlb.h
index cd9697672b796394c02777f381faecaf8c5e2a40..6c0c8b0c71e0a920eb564b1113d43146ed315625 100644 (file)
@@ -87,4 +87,19 @@ static inline pte_t huge_pte_wrprotect(pte_t pte)
 }
 #endif
 
+#ifndef __HAVE_ARCH_PREPARE_HUGEPAGE_RANGE
+static inline int prepare_hugepage_range(struct file *file,
+               unsigned long addr, unsigned long len)
+{
+       struct hstate *h = hstate_file(file);
+
+       if (len & ~huge_page_mask(h))
+               return -EINVAL;
+       if (addr & ~huge_page_mask(h))
+               return -EINVAL;
+
+       return 0;
+}
+#endif
+
 #endif /* _ASM_GENERIC_HUGETLB_H */