[CRIU] [PATCH v5 11/15] cr-restore: new list of ns shared objects introduced
Pavel Emelyanov
xemul at virtuozzo.com
Wed Jan 27 06:35:06 PST 2016
On 01/27/2016 03:04 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.
Please, s/ns_shared_object/prepare_post_cb/g .
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> ---
> cr-restore.c | 37 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 37 insertions(+)
>
> diff --git a/cr-restore.c b/cr-restore.c
> index 3254efc..330a1bf 100644
> --- a/cr-restore.c
> +++ b/cr-restore.c
> @@ -181,6 +181,39 @@ static struct collect_image_info *cinfos[] = {
> &file_locks_cinfo,
> };
>
> +struct shared_ns_object {
> + struct list_head list;
> + int (*actor)(void *data);
> + void *data;
> +};
> +
> +struct list_head shared_ns_objects = LIST_HEAD_INIT(shared_ns_objects);
> +
> +int add_shared_ns_obj(int (*actor)(void *data), void *data)
> +{
> + struct shared_ns_object *obj;
> +
> + obj = xmalloc(sizeof(*obj));
> + if (!obj)
> + return -1;
> +
> + obj->actor = actor;
> + obj->data = data;
> + list_add(&obj->list, &shared_ns_objects);
> + return 0;
> +}
> +
> +static int prepare_ns_shared(void)
> +{
> + struct shared_ns_object *o;
> +
> + list_for_each_entry(o, &shared_ns_objects, list) {
> + if (o->actor(o->data))
> + return -1;
> + }
> + return 0;
> +}
> +
> static int root_prepare_shared(void)
> {
> int ret = 0, i;
> @@ -250,6 +283,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