From 8bea49a74b6455c0b4e2066ba40ef3fa6a0a3fc0 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Thu, 20 Feb 2014 18:33:00 +0400 Subject: [PATCH] pagemap-cache: Use page.h helpers Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- include/pagemap-cache.h | 6 +++--- mem.c | 2 +- pagemap-cache.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/pagemap-cache.h b/include/pagemap-cache.h index f4d9c4e43..48e366c7f 100644 --- a/include/pagemap-cache.h +++ b/include/pagemap-cache.h @@ -2,14 +2,14 @@ #define __CR_PAGEMAP_H__ #include -#include "asm/types.h" +#include "asm-generic/page.h" +#include "asm/int.h" #include "list.h" struct vma_area; -#define PAGEMAP_PFN(addr) ((addr) / PAGE_SIZE) -#define PAGEMAP_PFN_OFF(addr) (PAGEMAP_PFN(addr) * sizeof(u64)) +#define PAGEMAP_PFN_OFF(addr) (PAGE_PFN(addr) * sizeof(u64)) typedef struct { pid_t pid; /* which process it belongs */ diff --git a/mem.c b/mem.c index 7d7609aa2..b6681d161 100644 --- a/mem.c +++ b/mem.c @@ -108,7 +108,7 @@ static inline bool page_in_parent(u64 pme) static int generate_iovs(struct vma_area *vma, struct page_pipe *pp, u64 *map, u64 *off) { - u64 *at = &map[PAGEMAP_PFN(*off)]; + u64 *at = &map[PAGE_PFN(*off)]; unsigned long pfn, nr_to_scan; unsigned long pages[2] = {}; diff --git a/pagemap-cache.c b/pagemap-cache.c index b102345ca..9def58783 100644 --- a/pagemap-cache.c +++ b/pagemap-cache.c @@ -17,7 +17,7 @@ #define PMC_MASK (~(PMC_SIZE - 1)) #define PMC_SIZE_GAP (PMC_SIZE / 4) -#define PAGEMAP_LEN(addr) (PAGEMAP_PFN(addr) * sizeof(u64)) +#define PAGEMAP_LEN(addr) (PAGE_PFN(addr) * sizeof(u64)) static inline void pmc_reset(pmc_t *pmc) { @@ -56,7 +56,7 @@ int pmc_init(pmc_t *pmc, pid_t pid, struct list_head *vma_head, size_t size) static inline u64 *__pmc_get_map(pmc_t *pmc, unsigned long addr) { - return &pmc->map[PAGEMAP_PFN(addr - pmc->start)]; + return &pmc->map[PAGE_PFN(addr - pmc->start)]; } static int pmc_fill_cache(pmc_t *pmc, struct vma_area *vma)