[CRIU] [PATCH v6 03/13] protobuf: autofs entry introduced

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Wed Jan 27 09:57:04 PST 2016


This entry will be used to carry all the autofs parameters, required to
restore mount point.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 image-desc.c            |    1 +
 include/fs-magic.h      |    4 ++++
 include/image-desc.h    |    2 ++
 include/magic.h         |    1 +
 include/protobuf-desc.h |    1 +
 protobuf-desc.c         |    1 +
 protobuf/Makefile       |    1 +
 protobuf/autofs.proto   |   13 +++++++++++++
 pycriu/images/images.py |    1 +
 9 files changed, 25 insertions(+)
 create mode 100644 protobuf/autofs.proto

diff --git a/image-desc.c b/image-desc.c
index 9fb96c8..05fbb2f 100644
--- a/image-desc.c
+++ b/image-desc.c
@@ -79,6 +79,7 @@ struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX] = {
 	FD_ENTRY_F(IP6TABLES,	"ip6tables-%d", O_NOBUF),
 	FD_ENTRY_F(TMPFS_IMG,	"tmpfs-%d.tar.gz", O_NOBUF),
 	FD_ENTRY_F(TMPFS_DEV,	"tmpfs-dev-%d.tar.gz", O_NOBUF),
+	FD_ENTRY_F(AUTOFS,	"autofs-%d", O_NOBUF),
 	FD_ENTRY(BINFMT_MISC,	"binfmt-misc-%d"),
 	FD_ENTRY(TTY_FILES,	"tty"),
 	FD_ENTRY(TTY_INFO,	"tty-info"),
diff --git a/include/fs-magic.h b/include/fs-magic.h
index d6e9e54..ced3377 100644
--- a/include/fs-magic.h
+++ b/include/fs-magic.h
@@ -49,4 +49,8 @@
 #define BINFMTFS_MAGIC		0x42494e4d
 #endif
 
+#ifndef AUTOFS_SUPER_MAGIC
+#define AUTOFS_SUPER_MAGIC	0x0187
+#endif
+
 #endif /* __CR_FS_MAGIC_H__ */
diff --git a/include/image-desc.h b/include/image-desc.h
index 90933e9..53ae805 100644
--- a/include/image-desc.h
+++ b/include/image-desc.h
@@ -102,6 +102,8 @@ enum {
 	CR_FD_FANOTIFY_MARK,
 	CR_FD_EVENTPOLL_TFD,
 
+	CR_FD_AUTOFS,
+
 	CR_FD_MAX
 };
 
diff --git a/include/magic.h b/include/magic.h
index 3cb3766..c2da78d 100644
--- a/include/magic.h
+++ b/include/magic.h
@@ -91,6 +91,7 @@
 #define USERNS_MAGIC		0x55474906 /* Kazan */
 #define SECCOMP_MAGIC		0x64413049 /* Kostomuksha */
 #define BINFMT_MISC_MAGIC	0x67343323 /* Apatity */
+#define AUTOFS_MAGIC		0x49353943 /* Sochi */
 
 #define IFADDR_MAGIC		RAW_IMAGE_MAGIC
 #define ROUTE_MAGIC		RAW_IMAGE_MAGIC
diff --git a/include/protobuf-desc.h b/include/protobuf-desc.h
index bb66a86..a851f12 100644
--- a/include/protobuf-desc.h
+++ b/include/protobuf-desc.h
@@ -57,6 +57,7 @@ enum {
 	PB_USERNS,
 	PB_NETNS,
 	PB_BINFMT_MISC,		/* 50 */
+	PB_AUTOFS,
 
 	/* PB_AUTOGEN_STOP */
 
diff --git a/protobuf-desc.c b/protobuf-desc.c
index c80ebb7..0d691aa 100644
--- a/protobuf-desc.c
+++ b/protobuf-desc.c
@@ -63,6 +63,7 @@
 #include "protobuf/userns.pb-c.h"
 #include "protobuf/seccomp.pb-c.h"
 #include "protobuf/binfmt-misc.pb-c.h"
+#include "protobuf/autofs.pb-c.h"
 
 struct cr_pb_message_desc cr_pb_descs[PB_MAX];
 
diff --git a/protobuf/Makefile b/protobuf/Makefile
index 12089a2..bac0277 100644
--- a/protobuf/Makefile
+++ b/protobuf/Makefile
@@ -58,6 +58,7 @@ proto-obj-y	+= opts.o
 proto-obj-y	+= seccomp.o
 proto-obj-y	+= binfmt-misc.o
 proto-obj-y	+= time.o
+proto-obj-y	+= autofs.o
 
 CFLAGS		+= -I$(obj)/
 
diff --git a/protobuf/autofs.proto b/protobuf/autofs.proto
new file mode 100644
index 0000000..c601346
--- /dev/null
+++ b/protobuf/autofs.proto
@@ -0,0 +1,13 @@
+message autofs_entry {
+	required int32		fd			= 1;
+	required int32		pgrp			= 2;
+	required int32		timeout			= 3;
+	required int32		minproto		= 4;
+	required int32		maxproto		= 5;
+	required int32		mode			= 6;
+
+	optional int32		uid			= 7;
+	optional int32		gid			= 8;
+
+	optional int32		read_fd			= 9;
+}
diff --git a/pycriu/images/images.py b/pycriu/images/images.py
index d4e883f..0bc0a1f 100644
--- a/pycriu/images/images.py
+++ b/pycriu/images/images.py
@@ -391,6 +391,7 @@ handlers = {
 	'NETNS'			: entry_handler(netns_entry),
 	'USERNS'		: entry_handler(userns_entry),
 	'SECCOMP'		: entry_handler(seccomp_entry),
+	'AUTOFS'		: entry_handler(autofs_entry),
 	}
 
 def __rhandler(f):



More information about the CRIU mailing list