[CRIU] [PATCH] mount: Add PB entries for FS types

Cyrill Gorcunov gorcunov at openvz.org
Mon Mar 18 12:01:04 EDT 2013


mnt_entry::fstype is a part of image ABI, thus we need
to provide some "common" encoding outside tools would
know about this field encoding.

Thus we instorduce fstype enum in .proto file and use it
in source code as well.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 mount.c            | 14 +++++++-------
 protobuf/mnt.proto | 10 ++++++++++
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/mount.c b/mount.c
index 3a45de2..1427e6a 100644
--- a/mount.c
+++ b/mount.c
@@ -342,13 +342,13 @@ out:
 }
 
 static struct fstype fstypes[] = {
-	{ "unsupported" },
-	{ "proc" },
-	{ "sysfs" },
-	{ "devtmpfs" },
-	{ "binfmt_misc", binfmt_misc_dump },
-	{ "tmpfs", tmpfs_dump, tmpfs_restore },
-	{ "devpts" },
+	[FSTYPE__UNSUPPORTED]	= { "unsupported" },
+	[FSTYPE__PROC]		= { "proc" },
+	[FSTYPE__SYSFS]		= { "sysfs" },
+	[FSTYPE__DEVTMPFS]	= { "devtmpfs" },
+	[FSTYPE__BINFMT_MISC]	= { "binfmt_misc", binfmt_misc_dump },
+	[FSTYPE__TMPFS]		= { "tmpfs", tmpfs_dump, tmpfs_restore },
+	[FSTYPE__DEVPTS]	= { "devpts" },
 };
 
 struct fstype *find_fstype_by_name(char *fst)
diff --git a/protobuf/mnt.proto b/protobuf/mnt.proto
index 25aed8f..0c529ac 100644
--- a/protobuf/mnt.proto
+++ b/protobuf/mnt.proto
@@ -1,3 +1,13 @@
+enum fstype {
+	UNSUPPORTED		= 0;
+	PROC			= 1;
+	SYSFS			= 2;
+	DEVTMPFS		= 3;
+	BINFMT_MISC		= 4;
+	TMPFS			= 5;
+	DEVPTS			= 6;
+};
+
 message mnt_entry {
 	required uint32		fstype			= 1;
 	required uint32		mnt_id			= 2;
-- 
1.8.1.4



More information about the CRIU mailing list