[CRIU] [PATCH v7 09/15] cr-restore: new list of ns shared objects introduced

Pavel Emelyanov xemul at virtuozzo.com
Wed Mar 16 03:21:59 PDT 2016


On 03/14/2016 05:59 PM, Stanislav Kinsburskiy wrote:
> Autofs restore needs to create some shared data structures to be able to pass
> data to actual autofs master.
> But on mount restore stage shared data is not configured yet.
> This list of objects and their actors is processed after all mounts and shared
> data are restored to let autofs to create the objects.

There's a naming mess in the patch :) ns_shared vs post_cb. Please, unify.

> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> ---
>  criu/cr-restore.c |   37 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index 9d74959..2162579 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -180,6 +180,39 @@ static struct collect_image_info *cinfos[] = {
>  	&file_locks_cinfo,
>  };
>  
> +struct prepare_post_cb {
> +	struct list_head list;
> +	int (*actor)(void *data);
> +	void *data;
> +};
> +
> +struct list_head prepare_post_cbs = LIST_HEAD_INIT(prepare_post_cbs);
> +
> +int add_prepare_post_cb(int (*actor)(void *data), void *data)
> +{
> +	struct prepare_post_cb *obj;
> +
> +	obj = xmalloc(sizeof(*obj));
> +	if (!obj)
> +		return -1;
> +
> +	obj->actor = actor;
> +	obj->data = data;
> +	list_add(&obj->list, &prepare_post_cbs);
> +	return 0;
> +}
> +
> +static int prepare_ns_shared(void)
> +{
> +	struct prepare_post_cb *o;
> +
> +	list_for_each_entry(o, &prepare_post_cbs, list) {
> +		if (o->actor(o->data))
> +			return -1;
> +	}
> +	return 0;
> +}
> +
>  static int root_prepare_shared(void)
>  {
>  	int ret = 0, i;
> @@ -249,6 +282,10 @@ static int root_prepare_shared(void)
>  	if (ret)
>  		goto err;
>  
> +	ret = prepare_ns_shared();
> +	if (ret)
> +		goto err;
> +
>  	show_saved_shmems();
>  	show_saved_files();
>  err:
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> .
> 



More information about the CRIU mailing list