[CRIU] Re: [PATCH cr 1/3] mount: add abstraction layer for dumping file systems

Pavel Emelyanov xemul at parallels.com
Wed Aug 8 08:57:26 EDT 2012


On 08/08/2012 04:47 PM, Andrey Vagin wrote:
> 
> We need to dump content of some fs like binfmt_misc, tmpfs, ...
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  mount.c |   38 ++++++++++++++++++++++++--------------
>  1 files changed, 24 insertions(+), 14 deletions(-)
> 

> +	if (fstypes[me.fstype].dump && fstypes[me.fstype].dump(pm))
> +			return -1;

Indentation.

> +

> @@ -336,6 +342,7 @@ static char *resolve_source(struct mount_info *mi)
>  static int do_new_mount(struct mount_info *mi)
>  {
>  	char *src;
> +	struct fstype *tp = &fstypes[encode_fstype(mi->fstype)];
>  
>  	src = resolve_source(mi);
>  	if (!src)

> @@ -482,7 +492,7 @@ static int populate_mnt_ns(int ns_pid)
>  		pm->flags		= me->flags;
>  
>  		/* FIXME: abort unsupported early */
> -		pm->fstype		= decode_fstype(me->fstype);
> +		pm->fstype		= decode_fstype(me->fstype)->name;
>  
>  		pr_debug("\t\tGetting root for %d\n", pm->mnt_id);
>  		pm->root = xstrdup(me->root);

Decode and then encode is awful. Better store the fstype structure pointer
on the mi itself.

Thanks,
Pavel


More information about the CRIU mailing list