Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156432
b: refs/heads/master
c: b1af431
h: refs/heads/master
v: v3
  • Loading branch information
Phillip Lougher authored and Linus Torvalds committed Aug 7, 2009
1 parent 8068d5c commit 05dfffa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: daeb6b6fbe27049f465c48a7d0ee5555c3b84064
refs/heads/master: b1af4315d823a2b6659c5b14bc17f7bc61878ef4
22 changes: 16 additions & 6 deletions trunk/lib/decompress_bunzip2.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@
*/


#ifndef STATIC
#ifdef STATIC
#define PREBOOT
#else
#include <linux/decompress/bunzip2.h>
#endif /* !STATIC */
#endif /* STATIC */

#include <linux/decompress/mm.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -681,9 +683,7 @@ STATIC int INIT bunzip2(unsigned char *buf, int len,
set_error_fn(error_fn);
if (flush)
outbuf = malloc(BZIP2_IOBUF_SIZE);
else
len -= 4; /* Uncompressed size hack active in pre-boot
environment */

if (!outbuf) {
error("Could not allocate output bufer");
return -1;
Expand Down Expand Up @@ -733,4 +733,14 @@ STATIC int INIT bunzip2(unsigned char *buf, int len,
return i;
}

#define decompress bunzip2
#ifdef PREBOOT
STATIC int INIT decompress(unsigned char *buf, int len,
int(*fill)(void*, unsigned int),
int(*flush)(void*, unsigned int),
unsigned char *outbuf,
int *pos,
void(*error_fn)(char *x))
{
return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error_fn);
}
#endif
21 changes: 16 additions & 5 deletions trunk/lib/decompress_unlzma.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
*Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

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

Expand Down Expand Up @@ -543,9 +545,7 @@ STATIC inline int INIT unlzma(unsigned char *buf, int in_len,
int ret = -1;

set_error_fn(error_fn);
if (!flush)
in_len -= 4; /* Uncompressed size hack active in pre-boot
environment */

if (buf)
inbuf = buf;
else
Expand Down Expand Up @@ -645,4 +645,15 @@ STATIC inline int INIT unlzma(unsigned char *buf, int in_len,
return ret;
}

#define decompress unlzma
#ifdef PREBOOT
STATIC int INIT decompress(unsigned char *buf, int in_len,
int(*fill)(void*, unsigned int),
int(*flush)(void*, unsigned int),
unsigned char *output,
int *posp,
void(*error_fn)(char *x)
)
{
return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn);
}
#endif

0 comments on commit 05dfffa

Please sign in to comment.