[CRIU] [PATCH 1/3] criu: arch, x86 -- Rename registers mode

Cyrill Gorcunov gorcunov at openvz.org
Wed Jul 6 14:15:23 PDT 2016


@gpregs_case is a bit vague name, lets
define traditional @mode here.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/arch/x86/crtools.c           | 14 +++++++-------
 criu/arch/x86/include/asm/types.h |  7 +++----
 images/core-x86.proto             |  4 ++--
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c
index d7a6d105cdf5..28b8e9af6590 100644
--- a/criu/arch/x86/crtools.c
+++ b/criu/arch/x86/crtools.c
@@ -252,7 +252,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core)
 		assign_reg(gpregs, regs.native, es);
 		assign_reg(gpregs, regs.native, fs);
 		assign_reg(gpregs, regs.native, gs);
-		gpregs->gpregs_case = USER_X86_REGS_CASE_T__NATIVE;
+		gpregs->mode = USER_X86_REGS_MODE__NATIVE;
 	} else {
 		assign_reg(gpregs, regs.compat, bx);
 		assign_reg(gpregs, regs.compat, cx);
@@ -271,9 +271,9 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core)
 		assign_reg(gpregs, regs.compat, flags);
 		assign_reg(gpregs, regs.compat, sp);
 		assign_reg(gpregs, regs.compat, ss);
-		gpregs->gpregs_case = USER_X86_REGS_CASE_T__COMPAT;
+		gpregs->mode = USER_X86_REGS_MODE__COMPAT;
 	}
-	gpregs->has_gpregs_case = true;
+	gpregs->has_mode = true;
 
 #ifndef PTRACE_GETREGSET
 # define PTRACE_GETREGSET 0x4204
@@ -682,15 +682,15 @@ static void restore_native_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
 
 int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
 {
-	switch (r->gpregs_case) {
-		case USER_X86_REGS_CASE_T__NATIVE:
+	switch (r->mode) {
+		case USER_X86_REGS_MODE__NATIVE:
 			restore_native_gpregs(f, r);
 			break;
-		case USER_X86_REGS_CASE_T__COMPAT:
+		case USER_X86_REGS_MODE__COMPAT:
 			restore_compat_gpregs(f, r);
 			break;
 		default:
-			pr_err("Can't prepare rt_sigframe: regs_case corrupt\n");
+			pr_err("Can't prepare rt_sigframe: registers mode corrupted (%d)\n", r->mode);
 			return -1;
 	}
 	return 0;
diff --git a/criu/arch/x86/include/asm/types.h b/criu/arch/x86/include/asm/types.h
index a24d7b815506..3bb02f309d86 100644
--- a/criu/arch/x86/include/asm/types.h
+++ b/criu/arch/x86/include/asm/types.h
@@ -153,11 +153,10 @@ static inline bool user_regs_native(user_regs_struct_t *pregs)
 		((pregs)->native.name = (val)) : ((pregs)->compat.name = (val)))
 static inline int core_is_compat(CoreEntry *c)
 {
-	switch (c->thread_info->gpregs->gpregs_case)
-	{
-		case USER_X86_REGS_CASE_T__NATIVE:
+	switch (c->thread_info->gpregs->mode) {
+		case USER_X86_REGS_MODE__NATIVE:
 			return 0;
-		case USER_X86_REGS_CASE_T__COMPAT:
+		case USER_X86_REGS_MODE__COMPAT:
 			return 1;
 		default:
 			return -1;
diff --git a/images/core-x86.proto b/images/core-x86.proto
index 663276c90ce4..d4b791dbcd73 100644
--- a/images/core-x86.proto
+++ b/images/core-x86.proto
@@ -2,7 +2,7 @@ syntax = "proto2";
 
 import "opts.proto";
 
-enum user_x86_regs_case_t {
+enum user_x86_regs_mode {
 	NATIVE = 1;
 	COMPAT = 2;
 }
@@ -36,7 +36,7 @@ message user_x86_regs_entry {
 	required uint64			es		= 25;
 	required uint64			fs		= 26;
 	required uint64			gs		= 27;
-	optional user_x86_regs_case_t	gpregs_case	= 28 [default = NATIVE];
+	optional user_x86_regs_mode	mode		= 28 [default = NATIVE];
 }
 
 message user_x86_xsave_entry {
-- 
2.7.4



More information about the CRIU mailing list