[PATCH 2/3] Remove redundancy between get_memory_ranges_proc_iomem() and get_memory_ranges_sysfs()
horms at verge.net.au
Tue Jul 8 20:41:39 EDT 2008
On Mon, Jul 07, 2008 at 04:43:41PM +0200, Bernhard Walle wrote:
> With the previous patch, we have a duplication between that both functions
> for following tasks:
> - don't report the interrupt table as RAM,
> - set the mem_min and mem_max limits for kdump.
> This patch removes that redundancy into the function get_memory_ranges()
> that calls both functions internally.
these patches seem fine to me, but I am still having minor troubles
with missing defines. For the record, I am seeing the problems with
gcc-3.4.5 + glibc-2.3.6. Yes, I know this is old, but it would
be nice if this minor issue didn't break it.
1. The snippet below looks good, but it needs to be included
in or berfore " [PATCH 1/3] Parse /sys/firmware/memmap".
> diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
> index cdac6f3..2ad450d 100644
> --- a/kexec/firmware_memmap.c
> +++ b/kexec/firmware_memmap.c
> @@ -31,6 +31,13 @@
> #include "firmware_memmap.h"
> #include "kexec.h"
> + * If the system is too old for ULLONG_MAX, define it here.
> + */
> +#ifndef ULLONG_MAX
> +# define ULLONG_MAX (~0ULL)
> * The full path to the sysfs interface that provides the memory map.
2. I did not realise this at the time that I sent my previous response,
but LLONG_MAX is also a problem. I believe that the following
code, based on your code above, fixes the problem.
* If the system is too old for LLONG_MAX, define it here.
#define LLONG_MAX (~0ULL >> 1)
I have verified on i386 using gcc-3.4.5 + glibc-2.3.6 and gcc-4.3.1 +
glibc-2.7 that this value is 9223372036854775807 (=2^63-1), which is
what the latter provides as LLONG_MAX.
Just for good measure, I have also verified, using the same method, that
your code gives 18446744073709551615 (=2^64-1), which matches the value
internally provided by gcc-4.3.1 + glibc-2.7.
More information about the kexec