[CRIU] [PATCH v7 08/15] pipes: export collect_one_pipe_ops() helper

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Mon Mar 14 07:59:17 PDT 2016


This helper is used by autofs restore to add temporary pipe structures.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 criu/include/pipes.h |    5 +++++
 criu/pipes.c         |    9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/criu/include/pipes.h b/criu/include/pipes.h
index d5c81f5..06db31b 100644
--- a/criu/include/pipes.h
+++ b/criu/include/pipes.h
@@ -44,6 +44,8 @@ extern int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst
  * A pipe doesn't have own properties, so it has no object.
  */
 
+#include "images/pipe.pb-c.h"
+
 struct pipe_info {
 	PipeEntry		*pe;
 	struct list_head	pipe_list;	/* All pipe_info with the same pipe_id
@@ -54,4 +56,7 @@ struct pipe_info {
 				reopen : 1;
 };
 
+extern int collect_one_pipe_ops(void *o, ProtobufCMessage *base,
+				struct file_desc_ops *ops);
+
 #endif /* __CR_PIPES_H__ */
diff --git a/criu/pipes.c b/criu/pipes.c
index e11e53c..b458c6b 100644
--- a/criu/pipes.c
+++ b/criu/pipes.c
@@ -371,7 +371,7 @@ static struct file_desc_ops pipe_desc_ops = {
 	.name		= pipe_d_name,
 };
 
-static int collect_one_pipe(void *o, ProtobufCMessage *base)
+int collect_one_pipe_ops(void *o, ProtobufCMessage *base, struct file_desc_ops *ops)
 {
 	struct pipe_info *pi = o, *tmp;
 
@@ -382,7 +382,7 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base)
 	pr_info("Collected pipe entry ID %#x PIPE ID %#x\n",
 			pi->pe->id, pi->pe->pipe_id);
 
-	if (file_desc_add(&pi->d, pi->pe->id, &pipe_desc_ops))
+	if (file_desc_add(&pi->d, pi->pe->id, ops))
 		return -1;
 
 	INIT_LIST_HEAD(&pi->pipe_list);
@@ -400,6 +400,11 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base)
 	return 0;
 }
 
+static int collect_one_pipe(void *o, ProtobufCMessage *base)
+{
+	return collect_one_pipe_ops(o, base, &pipe_desc_ops);
+}
+
 struct collect_image_info pipe_cinfo = {
 	.fd_type = CR_FD_PIPES,
 	.pb_type = PB_PIPE,



More information about the CRIU mailing list