[CRIU] [PATCH 4/4] img: Add text for known flags
Pavel Emelyanov
xemul at parallels.com
Wed Sep 16 06:17:42 PDT 2015
Currently there are open flags on reg-files and vma
flags and prot.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
protobuf/regfile.proto | 2 +-
protobuf/vma.proto | 4 ++--
pycriu/images/pb2dict.py | 23 +++++++++++++++++++++++
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/protobuf/regfile.proto b/protobuf/regfile.proto
index fc5e4b5..3a9456f 100644
--- a/protobuf/regfile.proto
+++ b/protobuf/regfile.proto
@@ -3,7 +3,7 @@ import "fown.proto";
message reg_file_entry {
required uint32 id = 1;
- required uint32 flags = 2 [(criu).hex = true];
+ required uint32 flags = 2 [(criu).flags = "rfile.flags"];
required uint64 pos = 3;
required fown_entry fown = 5;
required string name = 6;
diff --git a/protobuf/vma.proto b/protobuf/vma.proto
index b4ff578..8348360 100644
--- a/protobuf/vma.proto
+++ b/protobuf/vma.proto
@@ -5,8 +5,8 @@ message vma_entry {
required uint64 end = 2 [(criu).hex = true];
required uint64 pgoff = 3;
required uint64 shmid = 4;
- required uint32 prot = 5 [(criu).hex = true];
- required uint32 flags = 6 [(criu).hex = true];
+ required uint32 prot = 5 [(criu).flags = "mmap.prot" ];
+ required uint32 flags = 6 [(criu).flags = "mmap.flags" ];
required uint32 status = 7;
/*
* This fd thing is unused in the image, it was lost
diff --git a/pycriu/images/pb2dict.py b/pycriu/images/pb2dict.py
index 557a83b..4e717f1 100644
--- a/pycriu/images/pb2dict.py
+++ b/pycriu/images/pb2dict.py
@@ -52,7 +52,30 @@ def _marked_as_ip(field):
def _marked_as_flags(field):
return field.GetOptions().Extensions[opts_pb2.criu].flags
+mmap_prot_map = [
+ ('PROT_READ', 0x1),
+ ('PROT_WRITE', 0x2),
+ ('PROT_EXEC', 0x4),
+];
+
+mmap_flags_map = [
+ ('MAP_SHARED', 0x1),
+ ('MAP_PRIVATE', 0x2),
+ ('MAP_ANON', 0x20),
+];
+
+rfile_flags_map = [
+ ('O_WRONLY', 01),
+ ('O_RDWR', 02),
+ ('O_APPEND', 02000),
+ ('O_DIRECT', 040000),
+ ('O_LARGEFILE', 0100000),
+];
+
flags_maps = {
+ 'mmap.prot' : mmap_prot_map,
+ 'mmap.flags' : mmap_flags_map,
+ 'rfile.flags' : rfile_flags_map,
}
def map_flags(value, flags_map):
--
1.9.3
More information about the CRIU
mailing list