]> git.itanic.dy.fi Git - scan-pagemap/blob - pagemap.h
b06afb69f142755c0e5f2c7239b2fa2b72f6d13f
[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 #define list_to_maps_list(list_head)                            \
18         container_of((list_head), struct maps_list, list)
19
20 struct pageframe {
21         struct bintree tree;
22         struct maps_list ml;    /* List to mappings which point to this pfn */
23         unsigned long pfn;      /* page frame number */
24         int swap_type;
25         int swap_offset;
26         int page_shift;
27         int page_swapped;
28         int page_present;
29         int refcount;
30 };
31
32 #define tree_to_pageframe(tree_struct)                          \
33         container_of((tree_struct), struct pageframe, tree)
34
35 struct maps {
36         struct list_head list;
37
38         /* Memory segment of a mapping */
39         unsigned long start;
40         unsigned long end;
41         unsigned long size;
42
43         long int pages_present;
44         long int pages_swapped;
45
46         /* Name of the mapping, such as library name or something else */
47         char name[128];
48         int pid; /* Process which address space the mapping belongs to */
49         int tid; /* thread id */
50 };
51
52 #define list_to_maps(list_head)                         \
53         container_of((list_head), struct maps, list)
54
55 struct process {
56         struct maps *maps;
57         struct list_head list;
58         int pid;
59         int tid;
60         char name[256];
61
62         long int pages_present;
63         long int pages_swapped;
64 };
65
66 #define PARSE_PID               0x1
67 #define PARSE_MAP_NAME          0x2
68 #define PARSE_PROCESS_NAME      0x4
69 #define PARSE_DUMP              0x8
70 #define PARSE_NOADD_TREE        0x10
71
72 struct parse_opts {
73         int parse_mask;
74         int pid;
75         char *name;
76         int with_threads;
77 };
78
79 #endif