[CRIU] [PATCH 1/4] remap: add remap_type field and use it

Pavel Emelyanov xemul at parallels.com
Mon Sep 15 07:28:48 PDT 2014


On 09/13/2014 04:43 AM, Tycho Andersen wrote:

> @@ -375,10 +393,9 @@ static int dump_ghost_remap(char *path, const struct stat *st,
>  		return -1;
>  
>  dump_entry:
> -	BUG_ON(gf->id & REMAP_GHOST);
> -
>  	rpe.orig_id = id;
> -	rpe.remap_id = gf->id | REMAP_GHOST;

The remap_id should be preserved.

> +	rpe.has_remap_type = true;
> +	rpe.remap_type = REMAP_TYPE__GHOST;
>  
>  	return pb_write_one(fdset_fd(glob_fdset, CR_FD_REMAP_FPATH),
>  			&rpe, PB_REMAP_FPATH);
> diff --git a/protobuf/remap-file-path.proto b/protobuf/remap-file-path.proto
> index faeb745..cb8568f 100644
> --- a/protobuf/remap-file-path.proto
> +++ b/protobuf/remap-file-path.proto
> @@ -1,4 +1,10 @@
> +enum remap_type {
> +  LINKED		= 0;
> +  GHOST 		= 1;
> +};
> +
>  message remap_file_path_entry {
>  	required uint32		orig_id		= 1;
>  	required uint32		remap_id	= 2;
> +	optional uint32		remap_type	= 3;

Since we have the remap_type enum for this, let's make this
field be optional remap_type, not uint32. This would make the
pb perser to check this value being the one from enum for us.

>  }
> 



More information about the CRIU mailing list