From 4d31b38a0d2648e7077163f90b2cbe441bc33bf6 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsburskiy Date: Wed, 16 Mar 2016 16:17:08 +0300 Subject: [PATCH] protobuf: autofs entry introduced This entry will be used to carry all the autofs parameters, required to restore mount point. Signed-off-by: Stanislav Kinsburskiy Signed-off-by: Pavel Emelyanov --- 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 3b25ac2cf..2b31354f2 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 d6e9e54d1..ced3377f9 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 c8172bd59..7e75ede80 100644 --- a/criu/include/image-desc.h +++ b/criu/include/image-desc.h @@ -105,6 +105,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 e73da4ed5..a458c62e6 100644 --- a/criu/include/magic.h +++ b/criu/include/magic.h @@ -92,6 +92,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 6ed7f3764..6c76b494f 100644 --- a/criu/include/protobuf-desc.h +++ b/criu/include/protobuf-desc.h @@ -58,6 +58,7 @@ enum { PB_NETNS, PB_BINFMT_MISC, /* 50 */ PB_TTY_DATA, + PB_AUTOFS, /* PB_AUTOGEN_STOP */ diff --git a/criu/protobuf-desc.c b/criu/protobuf-desc.c index 511d3493e..9352a76cc 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 a8420de1c..cf50794cf 100644 --- a/images/Makefile +++ b/images/Makefile @@ -59,6 +59,7 @@ proto-obj-y += seccomp.o proto-obj-y += binfmt-misc.o proto-obj-y += time.o proto-obj-y += sysctl.o +proto-obj-y += autofs.o CFLAGS += -iquote $(obj)/ diff --git a/images/autofs.proto b/images/autofs.proto new file mode 100644 index 000000000..c6013461e --- /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 5022e684e..c593a3b85 100644 --- a/lib/py/images/images.py +++ b/lib/py/images/images.py @@ -453,6 +453,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):