[CRIU] Re: [PATCH 1/7] files.c: fix error message

Kir Kolyshkin kir at openvz.org
Sat Feb 11 03:28:31 EST 2012


On 02/11/2012 11:57 AM, Cyrill Gorcunov wrote:
> On Sat, Feb 11, 2012 at 03:30:04AM +0400, Kir Kolyshkin wrote:
>> Use perror since read() set errno.
>>
> Thanks Kir! I've picked up all fixes but cleanup patches.
> Look, they are _not_ cleanup, but rather code churn. Having
> line up to 90-100 chars is fine, 80 chars limit is really
> old fashioned one which I'm not going to follow.
>
> It's a bit funny, but on this week the same issue came
> up on LKML, the only reasonable argument (from my POV)
> in having short lines was provided by @hpa -- to fit
> printing page.

The other pretty reason (which you can laugh at, but still) is using git 
blame.
>
> But I think things such as
>
>   int prepare_fdinfo_global()
>   {
> -	fdinfo_descs = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, 0, 0);
> +	fdinfo_descs = mmap(NULL, 4096, PROT_READ | PROT_WRITE,
> +			MAP_SHARED | MAP_ANON, 0, 0);
>
> is really making code harder to read. If we need it more
> clear we could
>
> 	const int prot = PROT_READ | PROT_WRITE;
> 	const int flags = MAP_SHARED | MAP_ANON;
>
> 	fdinfo_descs = mmap(NULL, 4096, prot, flags, 0, 0);
>
> the const will be expanded and eliminated by compiler
> anyway.
>
> 	Cyrill



More information about the CRIU mailing list