]> git.itanic.dy.fi Git - scan-pagemap/blob - pagemap.h
Put the processes in a linked list as well
[scan-pagemap] / pagemap.h
1 #ifndef _PAGEMAP_H
2 #define _PAGEMAP_H
3
4 #include "utils.h"
5 #include "list.h"
6 #include "bintree.h"
7
8 #define PAGE_SHIFT      12
9 #define PAGE_SIZE       (1 << PAGE_SHIFT)
10
11 struct maps;
12
13 struct maps_list {
14         struct maps *map;
15         struct list_head list;
16 };
17
18 struct pageframe {
19         struct bintree tree;
20         struct maps_list *ml;   /* List to mappings which point to this pfn */
21         unsigned long pfn;      /* page frame number */
22         int swap_type;
23         int swap_offset;
24         int page_shift;
25         int page_swapped;
26         int page_present;
27         int refcount;
28 };
29
30 #define tree_to_pageframe(tree_struct)                          \
31         container_of((tree_struct), struct pageframe, tree)
32
33 struct maps {
34         struct list_head list;
35
36         /* Memory segment of a mapping */
37         unsigned long start;
38         unsigned long end;
39         unsigned long size;
40
41         long int pages_present;
42         long int pages_swapped;
43
44         /* Name of the mapping, such as library name or something else */
45         char name[128];
46         int pid; /* Process which address space the mapping belongs to */
47 };
48
49 #define list_to_maps(list_head)                         \
50         container_of((list_head), struct maps, list)
51
52 struct process {
53         struct maps *maps;
54         struct list_head list;
55         int pid;
56         char name[256];
57 };
58
59 #endif