[CRIU] [PATCH 06/16] mem/vma: Use vm_area_list_init where appropriate

Cyrill Gorcunov gorcunov at gmail.com
Fri Jul 5 18:38:01 MSK 2019


Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/cr-dump.c    | 9 +++------
 criu/proc_parse.c | 7 +------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 7f2e5edfc52a..9b891497b53f 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -109,8 +109,7 @@ void free_mappings(struct vm_area_list *vma_area_list)
 		free(vma_area);
 	}
 
-	INIT_LIST_HEAD(&vma_area_list->h);
-	vma_area_list->nr = 0;
+	vm_area_list_init(vma_area_list);
 }
 
 int collect_mappings(pid_t pid, struct vm_area_list *vma_area_list,
@@ -1139,8 +1138,7 @@ static int pre_dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie
 	struct parasite_dump_misc misc;
 	struct mem_dump_ctl mdc;
 
-	INIT_LIST_HEAD(&vmas.h);
-	vmas.nr = 0;
+	vm_area_list_init(&vmas);
 
 	pr_info("========================================\n");
 	pr_info("Pre-dumping task (pid: %d)\n", pid);
@@ -1221,8 +1219,7 @@ static int dump_one_task(struct pstree_item *item, InventoryEntry *parent_ie)
 	struct proc_posix_timers_stat proc_args;
 	struct mem_dump_ctl mdc;
 
-	INIT_LIST_HEAD(&vmas.h);
-	vmas.nr = 0;
+	vm_area_list_init(&vmas);
 
 	pr_info("========================================\n");
 	pr_info("Dumping task (pid: %d)\n", pid);
diff --git a/criu/proc_parse.c b/criu/proc_parse.c
index f6ebb1fd6f50..4c127f264062 100644
--- a/criu/proc_parse.c
+++ b/criu/proc_parse.c
@@ -705,12 +705,7 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list,
 	DIR *map_files_dir = NULL;
 	struct bfd f;
 
-	vma_area_list->nr = 0;
-	vma_area_list->nr_aios = 0;
-	vma_area_list->priv_longest = 0;
-	vma_area_list->priv_size = 0;
-	vma_area_list->shared_longest = 0;
-	INIT_LIST_HEAD(&vma_area_list->h);
+	vm_area_list_init(vma_area_list);
 
 	f.fd = open_proc(pid, "smaps");
 	if (f.fd < 0)
-- 
2.20.1



More information about the CRIU mailing list