struct maps;
+struct maps_list {
+ struct maps *map;
+ struct list_head list;
+};
+
struct pageframe {
struct bintree tree;
- struct maps *maps; /* List to mappings which point to this pfn */
+ struct maps_list *ml; /* List to mappings which point to this pfn */
unsigned long pfn; /* page frame number */
int swap_type;
int swap_offset;
#include "parse.h"
#include "pagemap.h"
+static struct maps_list *alloc_maplist(void)
+{
+ struct maps_list *map;
+
+ map = malloc(sizeof *map);
+ if (map == NULL)
+ goto err;
+
+ memset(map, 0, sizeof(*map));
+ INIT_LIST_HEAD(&map->list);
+err:
+ return map;
+}
+
static struct maps *alloc_map(void)
{
struct maps *map;
static int parse_pageframe(FILE *file, struct pageframe *pf_tree,
struct maps *maps)
{
- struct maps *map, *tmp;
+ struct maps *map;
+ struct maps_list *tmp;
struct pageframe *match, *pageframe;
long start, len, i;
unsigned long long pf;
* Add a link from the physical page to this
* process's page map
*/
- if (!match->maps) {
- match->maps = alloc_map();
- *match->maps = *map;
- INIT_LIST_HEAD(&match->maps->list);
+ if (!match->ml) {
+ match->ml = alloc_maplist();
+ match->ml->map = map;
} else {
- tmp = alloc_map();
- *tmp = *map;
- list_add(&match->maps->list, &tmp->list);
+ tmp = alloc_maplist();
+ tmp->map = map;
+ list_add(&match->ml->list, &tmp->list);
}
}
}