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

Cyrill Gorcunov gorcunov at openvz.org
Sat Feb 11 02:57:33 EST 2012


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.

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