[CRIU] [PATCH v7 03/15] protobuf: autofs entry introduced

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Mon Mar 14 07:58:46 PDT 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>
---
 criu/image-desc.c            |    1 +
 criu/include/fs-magic.h      |    4 ++++
 criu/include/image-desc.h    |    2 ++
 criu/include/magic.h         |    1 +
 criu/include/protobuf-desc.h |    1 +
 criu/protobuf-desc.c         |    1 +
 images/Makefile              |    1 +
 images/autofs.proto          |   13 +++++++++++++
 lib/py/images/images.py      |    1 +
 9 files changed, 25 insertions(+)
 create mode 100644 images/autofs.proto

diff --git a/criu/image-desc.c b/criu/image-desc.c
index de0fe93..2949c59 100644
--- a/criu/image-desc.c
+++ b/criu/image-desc.c
@@ -78,6 +78,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/criu/include/fs-magic.h b/criu/include/fs-magic.h
index d6e9e54..ced3377 100644
--- a/criu/include/fs-magic.h
+++ b/criu/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/criu/include/image-desc.h b/criu/include/image-desc.h
index 532ced8..e39db39 100644
--- a/criu/include/image-desc.h
+++ b/criu/include/image-desc.h
@@ -104,6 +104,8 @@ enum {
 	CR_FD_FANOTIFY_MARK,
 	CR_FD_EVENTPOLL_TFD,
 
+	CR_FD_AUTOFS,
+
 	CR_FD_MAX
 };
 
diff --git a/criu/include/magic.h b/criu/include/magic.h
index b11a70e..8fb6b18 100644
--- a/criu/include/magic.h
+++ b/criu/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/criu/include/protobuf-desc.h b/criu/include/protobuf-desc.h
index bb66a86..a851f12 100644
--- a/criu/include/protobuf-desc.h
+++ b/criu/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/criu/protobuf-desc.c b/criu/protobuf-desc.c
index 511d349..9352a76 100644
--- a/criu/protobuf-desc.c
+++ b/criu/protobuf-desc.c
@@ -63,6 +63,7 @@
 #include "images/userns.pb-c.h"
 #include "images/seccomp.pb-c.h"
 #include "images/binfmt-misc.pb-c.h"
+#include "images/autofs.pb-c.h"
 
 struct cr_pb_message_desc cr_pb_descs[PB_MAX];
 
diff --git a/images/Makefile b/images/Makefile
index 16ecb6a..ea0db79 100644
--- a/images/Makefile
+++ b/images/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		+= -iquote $(obj)/
 
diff --git a/images/autofs.proto b/images/autofs.proto
new file mode 100644
index 0000000..c601346
--- /dev/null
+++ b/images/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/lib/py/images/images.py b/lib/py/images/images.py
index d4e883f..0bc0a1f 100644
--- a/lib/py/images/images.py
+++ b/lib/py/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