[CRIU] [PATCH 2/5] autofs: Add FD_TYPES__AUTOFS_PIPE type

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jun 1 04:34:42 PDT 2017


Add a fake fd type for autofs. This allows functions
like find_file_desc() work as expected, without
having two different file_desc with the same type
and same id.

Also, later, it will allow to delete autofs_create_fle()
and to use generic helper.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/autofs.c       |    2 ++
 images/fdinfo.proto |    3 +++
 2 files changed, 5 insertions(+)

diff --git a/criu/autofs.c b/criu/autofs.c
index 3c84c99f3..9567b955d 100644
--- a/criu/autofs.c
+++ b/criu/autofs.c
@@ -904,6 +904,7 @@ static int autofs_create_pipe(struct pstree_item *task, autofs_info_t *i,
 		return -1;
 	memcpy(ops, pi->d.ops, sizeof(*ops));
 	ops->open = autofs_open_pipefd;
+	ops->type = FD_TYPES__AUTOFS_PIPE;
 
 	pe = shmalloc(sizeof(*pe));
 	if (!pe)
@@ -922,6 +923,7 @@ static int autofs_create_pipe(struct pstree_item *task, autofs_info_t *i,
 	fe = dup_fdinfo(ple->fe, fd, flags);
 	if (!fe)
 		return -1;
+	fe->type = FD_TYPES__AUTOFS_PIPE;
 
 	return autofs_create_fle(task, fe, &i->pi.d);
 }
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index 56506690c..d511dffdc 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -19,6 +19,9 @@ enum fd_types {
 	TUNF		= 15;
 	EXT		= 16;
 	TIMERFD		= 17;
+
+	/* Any number above the real used. Not stored to image */
+	AUTOFS_PIPE	= 65535;
 }
 
 message fdinfo_entry {



More information about the CRIU mailing list