1/* @title: Reverse map */
2#pragma once
3#include <types/types.h>
4struct folio;
5struct mm;
6struct vma_range;
7
8/* The way that rmap goes is:
9 *
10 * page -> folio -> mapping object (file_vma, anon_vma) ->
11 * traverse interval tree -> for each matching avc -> vma_range -> addr
12 */
13
14/* visitor invoked for each confirmed (mm, va) mapping the folio */
15typedef void (*rmap_visit_fn)(struct mm *mm, vaddr_t va, struct folio *f,
16 void *private);
17
18void rmap_walk_anon(struct folio *f, rmap_visit_fn visit, void *private);
19
20/* fault path: first PTE to map this folio */
21void folio_add_anon_rmap(struct folio *f, struct vma_range *vm_area,
22 vaddr_t va);
23
24/* additional mapper */
25void folio_add_anon_rmap_shared(struct folio *f, struct vma_range *vm_area);
26
27/* a PTE stops mapping it */
28void folio_remove_rmap(struct folio *f, struct vma_range *vm_area);
29
30void folio_add_anon_rmap_new(struct folio *f, struct vma_range *vm_area,
31 vaddr_t va);
32