diff options
author | Simon Horman <horms@verge.net.au> | 2009-11-30 16:29:08 +1100 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2009-11-30 16:49:09 +1100 |
commit | 523cc35be9ba3cae86b145de5b540c5b7e3bb43f (patch) | |
tree | 54fc15b38d0f36fcc2781d6c572b94f5db904238 | |
parent | 4c2d9b93150d36d15bf75b050ed97cabd9a94774 (diff) |
lzma: Move the bulk of kexec-lzma.h into lzma.c
There isn't any need for anything in kexec-lzma.h other
than a declaration of zlib_decompress_file().
Other being cleaner it also fixes a build problem when
lzma support isn't being compiled in.
$ make all
i686-unknown-linux-gnu-gcc -Wall -Wextra -O2 -fomit-frame-pointer -pipe -fno-strict-aliasing -Wall -Wstrict-prototypes -I/home/horms/local/opt/crosstool/i686/gcc-3.4.5-glibc-2.3.6/i686-unknown-linux-gnu/include -I./include -I./util_lib/include -Iinclude/ -I./kexec/arch/i386/include -c
-MD -o kexec/kexec.o kexec/kexec.c
In file included from kexec/kexec.c:47:
kexec/kexec-lzma.h:8:18: lzma.h: No such file or directory
kexec/kexec.c: In function `locate_hole':
kexec/kexec.c:203: warning: comparison between signed and unsigned
It ought to be possible to just provide a stub for zlib_decompress_file()
in kexec-lzma.h and not compile lzma.c at all in the case where
lzma support isn't being compiled in. However I see no obvious way
to do this with the existing build system. So I'd like to deal
with that as a separate possible change.
Changes as suggested by Eric W. Biederman.
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | kexec/kexec-lzma.h | 23 | ||||
-rw-r--r-- | kexec/lzma.c | 21 |
2 files changed, 20 insertions, 24 deletions
diff --git a/kexec/kexec-lzma.h b/kexec/kexec-lzma.h index c78cdf7..d3b751a 100644 --- a/kexec/kexec-lzma.h +++ b/kexec/kexec-lzma.h @@ -1,29 +1,8 @@ #ifndef __KEXEC_LZMA_H #define __KEXEC_LZMA_H -#include <stdio.h> #include <sys/types.h> -#include <unistd.h> -#include <inttypes.h> -#include <lzma.h> - -#include "config.h" - -#ifdef HAVE_LIBLZMA -#define kBufferSize (1 << 15) - -typedef struct lzfile { - uint8_t buf[kBufferSize]; - lzma_stream strm; - FILE *file; - int encoding; - int eof; -} LZFILE; - -LZFILE *lzopen(const char *path, const char *mode); -int lzclose(LZFILE *lzfile); -ssize_t lzread(LZFILE *lzfile, void *buf, size_t len); -#endif /* HAVE_LIBLZMA */ char *lzma_decompress_file(const char *filename, off_t *r_size); + #endif /* __KEXEC_LZMA_H */ diff --git a/kexec/lzma.c b/kexec/lzma.c index 5329cd8..20bc1ea 100644 --- a/kexec/lzma.c +++ b/kexec/lzma.c @@ -1,4 +1,9 @@ +#include <unistd.h> +#include <sys/types.h> + #include "kexec-lzma.h" +#include "config.h" + #ifdef HAVE_LIBLZMA #define _GNU_SOURCE #include <stdio.h> @@ -7,14 +12,26 @@ #include <stdlib.h> #include <errno.h> #include <limits.h> -#include <sys/types.h> #include <sys/stat.h> -#include <unistd.h> #include <ctype.h> #include <lzma.h> #include "kexec.h" +#define kBufferSize (1 << 15) + +typedef struct lzfile { + uint8_t buf[kBufferSize]; + lzma_stream strm; + FILE *file; + int encoding; + int eof; +} LZFILE; + +LZFILE *lzopen(const char *path, const char *mode); +int lzclose(LZFILE *lzfile); +ssize_t lzread(LZFILE *lzfile, void *buf, size_t len); + static LZFILE *lzopen_internal(const char *path, const char *mode, int fd) { int level = 5; |