[CRIU] Re: [RFC] files: Add union { addr; fd } for file entries

Pavel Emelyanov xemul at parallels.com
Wed Feb 22 10:49:01 EST 2012


On 02/22/2012 07:46 PM, Cyrill Gorcunov wrote:
> I believe distinguishing which particular name is
> used does improve readability. Since in most cases
> we refer to fdinfo_entry::addr in context of
> being file descriptor number. So when I read
> this code it makes me scratching the head, why
> the hell we use 'addr' here.
> 
> I covered 'dump' case. If I idea will be aproved
> I'll change restore case as well.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>

> diff --git a/include/image.h b/include/image.h
> index c9b7209..8bbcb60 100644
> --- a/include/image.h
> +++ b/include/image.h
> @@ -46,7 +46,10 @@ struct fdinfo_entry {
>  	u8	len;
>  	u16	flags;
>  	u32	pos;
> -	u64	addr;
> +	union {
> +		u64	addr;
> +		u64	fd;
> +	};

NAK. Entries should be plain.

>  	u8	id[FD_ID_SIZE];
>  	u8	name[0];
>  } __packed;



More information about the CRIU mailing list