Commit 78a52116 authored by Fyodor's avatar Fyodor Committed by Pavel Emelyanov

pagemap-cache: add const-qualifier to pmc's vma

We need to perform dirty page tracking when dumping shmem but there
we have only const vmas so we need pmc to work with them. Also pmc concept
implies that it won't change its vmas so it would be natural to declared
them as const.
Signed-off-by: 's avatarFyodor Bocharov <fbocharov@yandex.ru>
Signed-off-by: 's avatarEugene Batalov <eabatalov89@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 38daf50f
......@@ -15,7 +15,7 @@ typedef struct {
pid_t pid; /* which process it belongs */
unsigned long start; /* start of area */
unsigned long end; /* end of area */
struct list_head *vma_head; /* list head of VMAs we're serving */
const struct list_head *vma_head; /* list head of VMAs we're serving */
u64 *map; /* local buffer */
size_t map_len; /* length of a buffer */
int fd; /* file to read PMs from */
......@@ -23,8 +23,8 @@ typedef struct {
#define PMC_INIT (pmc_t){ }
extern int pmc_init(pmc_t *pmc, pid_t pid, struct list_head *vma_head, size_t size);
extern u64 *pmc_get_map(pmc_t *pmc, struct vma_area *vma);
extern int pmc_init(pmc_t *pmc, pid_t pid, const struct list_head *vma_head, size_t size);
extern u64 *pmc_get_map(pmc_t *pmc, const struct vma_area *vma);
extern void pmc_fini(pmc_t *pmc);
#endif /* __CR_PAGEMAP_H__ */
......@@ -31,7 +31,7 @@ static inline void pmc_zap(pmc_t *pmc)
pmc->start = pmc->end = 0;
}
int pmc_init(pmc_t *pmc, pid_t pid, struct list_head *vma_head, size_t size)
int pmc_init(pmc_t *pmc, pid_t pid, const struct list_head *vma_head, size_t size)
{
size_t map_size = max(size, (size_t)PMC_SIZE);
pmc_reset(pmc);
......@@ -60,7 +60,7 @@ static inline u64 *__pmc_get_map(pmc_t *pmc, unsigned long addr)
return &pmc->map[PAGE_PFN(addr - pmc->start)];
}
static int pmc_fill_cache(pmc_t *pmc, struct vma_area *vma)
static int pmc_fill_cache(pmc_t *pmc, const struct vma_area *vma)
{
unsigned long low = vma->e->start & PMC_MASK;
unsigned long high = low + PMC_SIZE;
......@@ -129,7 +129,7 @@ static int pmc_fill_cache(pmc_t *pmc, struct vma_area *vma)
return 0;
}
u64 *pmc_get_map(pmc_t *pmc, struct vma_area *vma)
u64 *pmc_get_map(pmc_t *pmc, const struct vma_area *vma)
{
/* Hit */
if (likely(pmc->start <= vma->e->start && pmc->end >= vma->e->end))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment