Re: [PATCH 1/6] lib/decompress_*: only include <linux/slab.h> ifSTATIC is not defined

From: Phillip Lougher
Date: Tue Aug 04 2009 - 22:06:48 EST


Andrew Morton wrote:
On Wed, 05 Aug 2009 01:47:57 +0100 Phillip Lougher <phillip@xxxxxxxxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/