Commit c860b540 authored by Stanislav Kinsburskiy's avatar Stanislav Kinsburskiy Committed by Pavel Emelyanov

pipes: export collect_one_pipe_ops() helper

This helper is used by autofs restore to add temporary pipe structures.
Signed-off-by: 's avatarStanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 87be218c
...@@ -44,6 +44,8 @@ extern int restore_pipe_data(int img_type, int pfd, u32 id, struct pipe_data_rst ...@@ -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. * A pipe doesn't have own properties, so it has no object.
*/ */
#include "images/pipe.pb-c.h"
struct pipe_info { struct pipe_info {
PipeEntry *pe; PipeEntry *pe;
struct list_head pipe_list; /* All pipe_info with the same pipe_id struct list_head pipe_list; /* All pipe_info with the same pipe_id
...@@ -54,4 +56,7 @@ struct pipe_info { ...@@ -54,4 +56,7 @@ struct pipe_info {
reopen : 1; reopen : 1;
}; };
extern int collect_one_pipe_ops(void *o, ProtobufCMessage *base,
struct file_desc_ops *ops);
#endif /* __CR_PIPES_H__ */ #endif /* __CR_PIPES_H__ */
...@@ -351,7 +351,7 @@ static struct file_desc_ops pipe_desc_ops = { ...@@ -351,7 +351,7 @@ static struct file_desc_ops pipe_desc_ops = {
.name = pipe_d_name, .name = pipe_d_name,
}; };
static int collect_one_pipe(void *o, ProtobufCMessage *base, struct cr_img *i) int collect_one_pipe_ops(void *o, ProtobufCMessage *base, struct file_desc_ops *ops)
{ {
struct pipe_info *pi = o, *tmp; struct pipe_info *pi = o, *tmp;
...@@ -362,7 +362,7 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base, struct cr_img *i) ...@@ -362,7 +362,7 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base, struct cr_img *i)
pr_info("Collected pipe entry ID %#x PIPE ID %#x\n", pr_info("Collected pipe entry ID %#x PIPE ID %#x\n",
pi->pe->id, pi->pe->pipe_id); 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; return -1;
INIT_LIST_HEAD(&pi->pipe_list); INIT_LIST_HEAD(&pi->pipe_list);
...@@ -384,6 +384,11 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base, struct cr_img *i) ...@@ -384,6 +384,11 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base, struct cr_img *i)
return 0; return 0;
} }
static int collect_one_pipe(void *o, ProtobufCMessage *base, struct cr_img *i)
{
return collect_one_pipe_ops(o, base, &pipe_desc_ops);
}
struct collect_image_info pipe_cinfo = { struct collect_image_info pipe_cinfo = {
.fd_type = CR_FD_PIPES, .fd_type = CR_FD_PIPES,
.pb_type = PB_PIPE, .pb_type = PB_PIPE,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment