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 */
29 unsigned long long kpageflags;
30 unsigned long long kpagecount;
35 #define tree_to_pageframe(tree_struct) \
36 container_of((tree_struct), struct pageframe, tree)
38 static inline void clear_pageframe(struct pageframe *pf)
40 memset(pf, 0, sizeof(*pf));
41 INIT_LIST_HEAD(&pf->ml);
44 static inline int page_present(struct pageframe *p)
46 return !!(BITRANGE(63, 63) & p->pf);
49 static inline int page_swapped(struct pageframe *p)
51 return !!(BITRANGE(62, 62) & p->pf);
54 static inline int page_shift(struct pageframe *p)
56 return (BITRANGE(55, 60) & p->pf) >> 55;
59 static inline long int pfn(struct pageframe *p)
61 return (BITRANGE(0, 54) & p->pf);
64 static inline int swap_type(struct pageframe *p)
66 return (BITRANGE(0, 4) & p->pf);
69 static inline int swap_offset(struct pageframe *p)
71 return (BITRANGE(5, 54) & p->pf) >> 5;
75 struct list_head list;
77 /* Memory segment of a mapping */
82 long int pages_present;
83 long int pages_swapped;
85 /* Name of the mapping, such as library name or something else */
87 int pid; /* Process which address space the mapping belongs to */
88 int tid; /* thread id */
91 #define list_to_maps(list_head) \
92 container_of((list_head), struct maps, list)
96 struct list_head list;
101 long int pages_present;
102 long int pages_swapped;
107 #define PARSE_PID 0x1
108 #define PARSE_MAP_NAME 0x2
109 #define PARSE_DUMP 0x8
110 #define PARSE_NOADD_TREE 0x10
111 #define PARSE_SHARED_MAPPING 0x20
114 struct list_head list;
120 struct list_head pidlist;
127 static inline void init_parse_opts(struct parse_opts *p)
129 memset(p, 0, sizeof(*p));
130 INIT_LIST_HEAD(&p->pidlist);
133 static inline struct pidlist *alloc_pidlist(void)
135 struct pidlist *p = malloc(sizeof(*p));
140 memset(p, 0, sizeof(*p));
141 INIT_LIST_HEAD(&p->list);
146 #define is_parse_option(parse_opts, flag) \
147 (!!((parse_opts)->parse_mask & (flag)))