11 #define PAGE_SIZE (1 << PAGE_SHIFT)
17 struct list_head list;
19 #define list_to_maps_list(list_head) \
20 container_of((list_head), struct maps_list, list)
22 #define BITRANGE(first, last) (((2ll << (last - first)) - 1) << first)
26 struct list_head ml; /* List of mappings which refer to this pfn */
28 unsigned long long pf; /* page frame entry from /proc/pid/pagemap */
33 #define tree_to_pageframe(tree_struct) \
34 container_of((tree_struct), struct pageframe, tree)
36 static inline void clear_pageframe(struct pageframe *pf)
38 memset(pf, 0, sizeof(*pf));
39 INIT_LIST_HEAD(&pf->ml);
42 static inline int page_present(struct pageframe *p)
44 return !!(BITRANGE(63, 63) & p->pf);
47 static inline int page_swapped(struct pageframe *p)
49 return !!(BITRANGE(62, 62) & p->pf);
52 static inline int page_shift(struct pageframe *p)
54 return (BITRANGE(55, 60) & p->pf) >> 55;
57 static inline long int pfn(struct pageframe *p)
59 return (BITRANGE(0, 54) & p->pf);
62 static inline int swap_type(struct pageframe *p)
64 return (BITRANGE(0, 4) & p->pf);
67 static inline int swap_offset(struct pageframe *p)
69 return (BITRANGE(5, 54) & p->pf) >> 5;
73 struct list_head list;
75 /* Memory segment of a mapping */
80 long int pages_present;
81 long int pages_swapped;
83 /* Name of the mapping, such as library name or something else */
85 int pid; /* Process which address space the mapping belongs to */
86 int tid; /* thread id */
89 #define list_to_maps(list_head) \
90 container_of((list_head), struct maps, list)
94 struct list_head list;
99 long int pages_present;
100 long int pages_swapped;
105 #define PARSE_PID 0x1
106 #define PARSE_MAP_NAME 0x2
107 #define PARSE_DUMP 0x8
108 #define PARSE_NOADD_TREE 0x10
109 #define PARSE_SHARED_MAPPING 0x20
112 struct list_head list;
118 struct list_head pidlist;
125 static inline void init_parse_opts(struct parse_opts *p)
127 memset(p, 0, sizeof(*p));
128 INIT_LIST_HEAD(&p->pidlist);
131 static inline struct pidlist *alloc_pidlist(void)
133 struct pidlist *p = malloc(sizeof(*p));
138 memset(p, 0, sizeof(*p));
139 INIT_LIST_HEAD(&p->list);
144 #define is_parse_option(parse_opts, flag) \
145 (!!((parse_opts)->parse_mask & (flag)))