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

Andrey Vagin avagin at openvz.org
Fri Nov 23 03:24:29 EST 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 3957c1b..f958a9f 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -804,20 +804,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));
@@ -875,14 +872,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);
@@ -898,7 +887,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;
 
@@ -1312,7 +1301,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;
 
@@ -1362,7 +1351,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 37951d5..86398f9 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -721,11 +721,6 @@ static int check_core(int pid, CoreEntry *core)
 	}
 
 	if (core->tc->task_state != TASK_DEAD) {
-		if (!core->ids) {
-			pr_err("Core IDS data missed for non-zombie\n");
-			goto out;
-		}
-
 		if (!core->thread_info) {
 			pr_err("Core info data missed for non-zombie\n");
 			goto out;
@@ -1728,7 +1723,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 	strncpy(task_args->comm, core->tc->comm, sizeof(task_args->comm));
 
 	task_args->t.clear_tid_addr	= core->thread_info->clear_tid_addr;
-	task_args->ids			= *core->ids;
 	task_args->t.gpregs		= *core->thread_info->gpregs;
 	task_args->t.blk_sigset		= core->tc->blk_sigset;
 	task_args->t.has_blk_sigset	= true;
@@ -1788,7 +1782,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 		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 354ef25..51b5ddf 100644
--- a/include/restorer.h
+++ b/include/restorer.h
@@ -115,7 +115,6 @@ struct task_restore_core_args {
 	u64				mm_saved_auxv[AT_VECTOR_SIZE];
 	u32				mm_saved_auxv_size;
 	char				comm[TASK_COMM_LEN];
-	TaskKobjIdsEntry		ids;
 
 	int				*rst_tcp_socks;
 	int				rst_tcp_socks_size;
diff --git a/protobuf/core.proto b/protobuf/core.proto
index a527fe1..9499bcd 100644
--- a/protobuf/core.proto
+++ b/protobuf/core.proto
@@ -85,6 +85,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.11.7



More information about the CRIU mailing list