[CRIU] [PATCH 9/9] images: rename NONE to CG_NONE

Tycho Andersen tycho.andersen at canonical.com
Mon Oct 3 11:13:48 PDT 2016


with newer versions of protobuf, I get:

./crit
Traceback (most recent call last):
  File "./crit", line 7, in <module>
    import pycriu
  File "/home/ubuntu/criu/crit/pycriu/__init__.py", line 2, in <module>
    import images
  File "/home/ubuntu/criu/crit/pycriu/images/__init__.py", line 2, in <module>
    from images import *
  File "/home/ubuntu/criu/crit/pycriu/images/images.py", line 52, in <module>
    from pb import *
  File "/home/ubuntu/criu/crit/pycriu/images/pb.py", line 35, in <module>
    from packet_sock_pb2 import *
  File "/home/ubuntu/criu/crit/pycriu/images/packet_sock_pb2.py", line 18, in <module>
    import sk_opts_pb2 as sk__opts__pb2
  File "/home/ubuntu/criu/crit/pycriu/images/sk_opts_pb2.py", line 23, in <module>
    serialized_pb=_b('\n\rsk-opts.proto\"\xe2\x02\n\rsk_opts_entry\x12\x11\n\tso_sndbuf\x18\x01 \x02(\r\x12\x11\n\tso_rcvbuf\x18\x02 \x02(\r\x12\x16\n\x0eso_snd_tmo_sec\x18\x03 \x02(\x04\x12\x17\n\x0fso_snd_tmo_usec\x18\x04 \x02(\x04\x12\x16\n\x0eso_rcv_tmo_sec\x18\x05 \x02(\x04\x12\x17\n\x0fso_rcv_tmo_usec\x18\x06 \x02(\x04\x12\x11\n\treuseaddr\x18\x07 \x01(\x08\x12\x13\n\x0bso_priority\x18\x08 \x01(\r\x12\x13\n\x0bso_rcvlowat\x18\t \x01(\r\x12\x0f\n\x07so_mark\x18\n \x01(\r\x12\x13\n\x0bso_passcred\x18\x0b \x01(\x08\x12\x12\n\nso_passsec\x18\x0c \x01(\x08\x12\x14\n\x0cso_dontroute\x18\r \x01(\x08\x12\x13\n\x0bso_no_check\x18\x0e \x01(\x08\x12\x14\n\x0cso_bound_dev\x18\x0f \x01(\t\x12\x11\n\tso_filter\x18\x10 \x03(\x06*6\n\x0bsk_shutdown\x12\x08\n\x04NONE\x10\x00\x12\x08\n\x04READ\x10\x01\x12\t\n\x05WRITE\x10\x02\x12\x08\n\x04\x42OTH\x10\x03')
  File "/usr/lib/python2.7/dist-packages/google/protobuf/descriptor.py", line 827, in __new__
    return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "sk-opts.proto":
  NONE: "NONE" is already defined in file "rpc.proto".
  NONE: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it.  Therefore, "NONE" must be unique within the global scope, not just within "sk_shutdown".

this fixes that.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 criu/cr-service.c | 2 +-
 images/rpc.proto  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/criu/cr-service.c b/criu/cr-service.c
index 429aaa8..8b4af92 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -434,7 +434,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 		case CRIU_CG_MODE__IGNORE:
 			mode = CG_MODE_IGNORE;
 			break;
-		case CRIU_CG_MODE__NONE:
+		case CRIU_CG_MODE__CG_NONE:
 			mode = CG_MODE_NONE;
 			break;
 		case CRIU_CG_MODE__PROPS:
diff --git a/images/rpc.proto b/images/rpc.proto
index 7f72014..45ac19c 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -39,7 +39,7 @@ message unix_sk {
 
 enum criu_cg_mode {
 	IGNORE	= 0;
-	NONE	= 1;
+	CG_NONE	= 1;
 	PROPS	= 2;
 	SOFT	= 3;
 	FULL	= 4;
-- 
2.9.3



More information about the CRIU mailing list