diff options
Diffstat (limited to 'tools/testing/vma/include/dup.h')
| -rw-r--r-- | tools/testing/vma/include/dup.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h index 535747d7fee4..7ed165c8d9bc 100644 --- a/tools/testing/vma/include/dup.h +++ b/tools/testing/vma/include/dup.h @@ -1548,3 +1548,19 @@ static inline pgprot_t vma_get_page_prot(vma_flags_t vma_flags) return vm_get_page_prot(vm_flags); } + +static inline pgoff_t linear_page_delta(const struct vm_area_struct *vma, + const unsigned long address) +{ + return (address - vma->vm_start) >> PAGE_SHIFT; +} + +static inline pgoff_t linear_page_index(const struct vm_area_struct *vma, + const unsigned long address) +{ + pgoff_t pgoff; + + pgoff = linear_page_delta(vma, address); + pgoff += vma_start_pgoff(vma); + return pgoff; +} |
