]> git.itanic.dy.fi Git - scan-pagemap/blob - pagemap.h
Add support for parsing all threads, not just thead parents
[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         int tid; /* thread id */
48 };
49
50 #define list_to_maps(list_head)                         \
51         container_of((list_head), struct maps, list)
52
53 struct process {
54         struct maps *maps;
55         struct list_head list;
56         int pid;
57         int tid;
58         char name[256];
59
60         long int pages_present;
61         long int pages_swapped;
62 };
63
64 #define PARSE_PID       0x1
65 #define PARSE_MAP_NAME  0x2
66
67 struct parse_opts {
68         int parse_mask;
69         int pid;
70         char *map_name;
71 };
72
73 #endif