[CRIU] [PATCH cr 3/6] crtools: don't use core->ids

Andrey Vagin avagin at openvz.org
Tue Oct 2 10:07:19 EDT 2012


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-dump.c           |   19 ++++---------------
 cr-restore.c        |    8 +-------
 include/restorer.h  |    1 -
 protobuf/core.proto |    2 +-
 4 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 4881592..1b689a3 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -748,20 +748,17 @@ static void core_entry_free(CoreEntry *core)
 		xfree(core->thread_info);
 		xfree(core->thread_core);
 		xfree(core->tc);
-		xfree(core->ids);
 	}
 }
 
 static CoreEntry *core_entry_alloc(int alloc_thread_info,
-				   int alloc_tc,
-				   int alloc_ids)
+				   int alloc_tc)
 {
 	CoreEntry *core;
 	ThreadInfoX86 *thread_info;
 	UserX86RegsEntry *gpregs;
 	UserX86FpregsEntry *fpregs;
 	TaskCoreEntry *tc;
-	TaskKobjIdsEntry *ids;
 	ThreadCoreEntry *thread_core;
 
 	core = xmalloc(sizeof(*core));
@@ -819,14 +816,6 @@ static CoreEntry *core_entry_alloc(int alloc_thread_info,
 		core->tc = tc;
 	}
 
-	if (alloc_ids) {
-		ids = xmalloc(sizeof(*ids));
-		if (!ids)
-			goto err;
-		task_kobj_ids_entry__init(ids);
-		core->ids = ids;
-	}
-
 	return core;
 err:
 	core_entry_free(core);
@@ -842,7 +831,7 @@ static int dump_task_core_all(pid_t pid, const struct proc_pid_stat *stat,
 	CoreEntry *core;
 	int ret = -1;
 
-	core = core_entry_alloc(1, 1, 1);
+	core = core_entry_alloc(1, 1);
 	if (!core)
 		return -1;
 
@@ -1253,7 +1242,7 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl, struct pid *tid)
 	pr_info("Dumping core for thread (pid: %d)\n", pid);
 	pr_info("----------------------------------------\n");
 
-	core = core_entry_alloc(1, 0, 0);
+	core = core_entry_alloc(1, 0);
 	if (!core)
 		goto err;
 
@@ -1296,7 +1285,7 @@ static int dump_one_zombie(const struct pstree_item *item,
 	CoreEntry *core;
 	int ret = -1, fd_core;
 
-	core = core_entry_alloc(0, 1, 0);
+	core = core_entry_alloc(0, 1);
 	if (core == NULL)
 		goto err;
 
diff --git a/cr-restore.c b/cr-restore.c
index d40c66b..007e13d 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -457,11 +457,6 @@ static int check_core(int pid, CoreEntry *core)
 		goto out;
 	}
 
-	if (!core->ids && core->tc->task_state != TASK_DEAD) {
-		pr_err("Core IDS data missed for non-zombie\n");
-		goto out;
-	}
-
 	ret = 0;
 out:
 	close_safe(&fd);
@@ -1404,7 +1399,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v
 	strncpy(task_args->comm, core->tc->comm, sizeof(task_args->comm));
 
 	task_args->clear_tid_addr	= core->thread_info->clear_tid_addr;
-	task_args->ids			= *core->ids;
 	task_args->gpregs		= *core->thread_info->gpregs;
 	task_args->blk_sigset		= core->tc->blk_sigset;
 
@@ -1459,7 +1453,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core, struct list_head *tgt_v
 		ret = pb_read_one(fd_core, &core, PB_CORE);
 		close(fd_core);
 
-		if (core->tc || core->ids) {
+		if (core->tc) {
 			pr_err("Thread has optional fields present %d\n",
 			       thread_args[i].pid);
 			ret = -1;
diff --git a/include/restorer.h b/include/restorer.h
index 3b9fbcf..58a5c1f 100644
--- a/include/restorer.h
+++ b/include/restorer.h
@@ -104,7 +104,6 @@ struct task_restore_core_args {
 	u64				clear_tid_addr;
 	u64				blk_sigset;
 	char				comm[TASK_COMM_LEN];
-	TaskKobjIdsEntry		ids;
 	UserX86RegsEntry		gpregs;
 
 	bool				has_futex;
diff --git a/protobuf/core.proto b/protobuf/core.proto
index 3e09bdd..8348601 100644
--- a/protobuf/core.proto
+++ b/protobuf/core.proto
@@ -81,6 +81,6 @@ message core_entry {
 	optional thread_info_x86	thread_info	= 2;
 
 	optional task_core_entry	tc		= 3;
-	optional task_kobj_ids_entry	ids		= 4;
+	optional task_kobj_ids_entry	ids		= 4; /* deprecated */
 	optional thread_core_entry	thread_core	= 5;
 }
-- 
1.7.1



More information about the CRIU mailing list