Re: [PATCH 1/6] lib/decompress_*: only include if STATIC is not defined

Phillip Lougher
2009-08-05T02:06:42Z

Andrew Morton wrote:
> On Wed, 05 Aug 2009 01:47:57 +0100 Phillip Lougher <phillip@lougher.demon.co.uk> wrote:
>
>>
>> What do you normally do in this situation?
>
> I normally fix the rejects ;)
>
> But I'd like to confirm that the two patches don't fix the same thing
> via different means. Lacking a full description of Albin's "issues",
> that's hard to determine. They do appear to be unrelated.
>

No they're not fixing the same thing.

Albin's patch is moving #include <slab.h> inside the #ifndef STATIC ...
#endif code segment. This ensures that <slab.h>
isn't included when the file is being built in the stripped down
pre-boot environment. I imagine Albin's issues is that slab.h
pulls in a lot of definitions unnecessary in the pre-boot
environment and which rely on things which are missing
in the stripped down pre-boot environment.

My changes to the #ifndef STATIC logic defines PREBOOT if
STATIC is defined. My patch uses the PREBOOT definition
later to define the decompress wrapper function, which is only
needed in the preboot environment.

i.e.

#ifdef STATIC
#define PREBOOT
#else
#include <linux/decompress/unlzma.h>
#endif

...
Lots of code
...

#ifdef PREBOOT
static int INIT decompress.....
#endif

Obvious question, why doesn't my patch use STATIC here rather than
PREBOOT? The header file <linux/decompress/unlzma.h> defines STATIC, .i.e
the #ifndef STATIC case defines STATIC via an include file, which makes
decisions on STATIC later in the file impossible.

>> I'm happy to send a revised
>> bzip2-lzma-remove-nasty-uncompressed-size-hack-in-pre-boot-environment.patch
>> that would apply cleanly on-top of Alvin's patch, but, this will obviously
>> create dependencies on his patch being applied.
>
> Reworked
> lib-decompress_-only-include-linux-slabh-if-static-is-not-defined.patch:

The patch looks OK.

Thanks

Phillip