#ifndef _PAGEMAP_H #define _PAGEMAP_H #include "utils.h" #include "list.h" #include "bintree.h" #define PAGE_SHIFT 12 #define PAGE_SIZE (1 << PAGE_SHIFT) struct maps; struct maps_list { struct maps *map; struct list_head list; }; struct pageframe { struct bintree tree; struct maps_list *ml; /* List to mappings which point to this pfn */ unsigned long pfn; /* page frame number */ int swap_type; int swap_offset; int page_shift; int page_swapped; int page_present; int refcount; }; #define tree_to_pageframe(tree_struct) \ container_of((tree_struct), struct pageframe, tree) struct maps { struct list_head list; /* Memory segment of a mapping */ unsigned long start; unsigned long end; unsigned long size; long int pages_present; long int pages_swapped; /* Name of the mapping, such as library name or something else */ char name[128]; int pid; /* Process which address space the mapping belongs to */ int tid; /* thread id */ }; #define list_to_maps(list_head) \ container_of((list_head), struct maps, list) struct process { struct maps *maps; struct list_head list; int pid; int tid; char name[256]; long int pages_present; long int pages_swapped; }; #define PARSE_PID 0x1 #define PARSE_MAP_NAME 0x2 #define PARSE_PROCESS_NAME 0x4 struct parse_opts { int parse_mask; int pid; char *name; int with_threads; }; #endif