pipe: Run master resolve via post_cb engine

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Pavel Emelyanov 2016-03-24 16:00:35 +03:00
parent 3b288ca392
commit 92eb5ff594
3 changed files with 7 additions and 4 deletions

View file

@ -268,8 +268,6 @@ static int root_prepare_shared(void)
if (ret < 0)
goto err;
mark_pipe_master();
ret = tty_setup_slavery();
if (ret)
goto err;

View file

@ -6,7 +6,6 @@
extern struct collect_image_info pipe_cinfo;
extern int collect_pipes(void);
extern void mark_pipe_master(void);
extern const struct fdtype_ops pipe_dump_ops;
static inline u32 pipe_id(const struct fd_parms *p)

View file

@ -5,6 +5,7 @@
#include <stdlib.h>
#include <sys/mman.h>
#include "crtools.h"
#include "imgset.h"
#include "image.h"
#include "files.h"
@ -93,7 +94,7 @@ int collect_pipe_data(int img_type, struct pipe_data_rst **hash)
}
/* Choose who will restore a pipe. */
void mark_pipe_master(void)
static int mark_pipe_master(void *unused)
{
LIST_HEAD(head);
@ -156,6 +157,7 @@ void mark_pipe_master(void)
}
list_splice(&head, &pipes);
return 0;
}
static struct pipe_data_rst *pd_hash_pipes[PIPE_DATA_HASH_SIZE];
@ -394,6 +396,10 @@ static int collect_one_pipe(void *o, ProtobufCMessage *base)
list_add(&pi->pipe_list, &tmp->pipe_list);
}
if (list_empty(&pipes))
if (add_post_prepare_cb(mark_pipe_master, NULL))
return -1;
list_add_tail(&pi->list, &pipes);
return 0;