[coreboot] r3903 - trunk/util/flashrom

Ward Vandewege ward at gnu.org
Mon Jan 26 03:08:25 CET 2009


On Mon, Jan 26, 2009 at 02:39:14AM +0100, Peter Stuge wrote:
> svn at coreboot.org wrote:
> > flashrom: Abstract mmap() in physmap.c and only open /dev/mem on the first physmap() call.
> ..
> 
> > +++ trunk/util/flashrom/cbtable.c	2009-01-26 01:10:48 UTC (rev 3903)
> ..
> > -	if (low_1MB == MAP_FAILED) {
> > -		perror("Can't mmap memory using " MEM_DEV);
> > -		mmap_errmsg();
> > -		exit(-2);
> > -	}
> > +	low_1MB = physmap("low megabyte", 0x0, 1024*1024);
> 
> Note that in this one instance, flashrom will now exit(1) instead of
> exit(-2) on failure. No other exit value has been changed in this
> series of commits.
> 
> I would now like to suggest a change of the exit() codes in physmap.c
> to 2 (for open) and 3 (for mmap) because 1 is already used all over
> the flashrom codebase for every type of error. Anyone against?

Acked-by: Ward Vandewege <ward at gnu.org>

Anything that checks for exit code == 1 is doing something silly at this
point - when testing for *any* errors (the only thing that was possible until
now) scripts should test for exit code != 0.

Let this be the start for a nicely documented list of error codes that make
sense :)

Thanks,
Ward.

-- 
Ward Vandewege <ward at fsf.org>
Free Software Foundation - Senior Systems Administrator




More information about the coreboot mailing list