Skip to content

Commit

Permalink
x86/images: convert oneof to enum + optional arg
Browse files Browse the repository at this point in the history
Sadly, protobuf supports oneof keyword only from recent version 2.6.0.
On older environments protobuf-compiler will fail.
This is true for travis-ci with Ubuntu 14.04, where protobuf is 2.5.0.
Convert oneof to more stupid version with enum.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
  • Loading branch information
0x7f454c46 committed Mar 23, 2016
1 parent 499c93a commit aab4489
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions criu/arch/x86/crtools.c
Expand Up @@ -198,7 +198,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core)
assign_reg(r64, regs.native, es);
assign_reg(r64, regs.native, fs);
assign_reg(r64, regs.native, gs);
gpregs->gpregs_case = USER_X86_REGS_ENTRY__GPREGS_NATIVE;
gpregs->gpregs_case = USER_X86_REGS_CASE_T__NATIVE;
} else {
UserX86Regs32 *r32 = gpregs->compat;

Expand All @@ -219,7 +219,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core)
assign_reg(r32, regs.compat, flags);
assign_reg(r32, regs.compat, sp);
assign_reg(r32, regs.compat, ss);
gpregs->gpregs_case = USER_X86_REGS_ENTRY__GPREGS_COMPAT;
gpregs->gpregs_case = USER_X86_REGS_CASE_T__COMPAT;
}

#ifndef PTRACE_GETREGSET
Expand Down Expand Up @@ -558,7 +558,7 @@ void *mmap_seized(struct parasite_ctl *ctl,
int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r)
{
/* FIXME: rt_sigcontext for compatible tasks */
if (r->gpregs_case != USER_X86_REGS_ENTRY__GPREGS_NATIVE) {
if (r->gpregs_case != USER_X86_REGS_CASE_T__NATIVE) {
pr_err("Can't prepare rt_sigframe for compatible task restore\n");
return -1;
}
Expand Down
12 changes: 8 additions & 4 deletions images/core-x86.proto
Expand Up @@ -50,11 +50,15 @@ message user_x86_regs_32 {
required uint32 ss = 17;
}

enum user_x86_regs_case_t {
NATIVE = 1;
COMPAT = 2;
}

message user_x86_regs_entry {
oneof gpregs {
user_x86_regs_64 native = 1[(criu).hex = true];
user_x86_regs_32 compat = 2[(criu).hex = true];
}
required user_x86_regs_case_t gpregs_case = 1;
optional user_x86_regs_64 native = 2[(criu).hex = true];
optional user_x86_regs_32 compat = 3[(criu).hex = true];
}

message user_x86_xsave_entry {
Expand Down

0 comments on commit aab4489

Please sign in to comment.