aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/boot/lib/zmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/xtensa/boot/lib/zmem.c')
-rw-r--r--arch/xtensa/boot/lib/zmem.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/arch/xtensa/boot/lib/zmem.c b/arch/xtensa/boot/lib/zmem.c
index 7848f126d67d..d9862aa8ca25 100644
--- a/arch/xtensa/boot/lib/zmem.c
+++ b/arch/xtensa/boot/lib/zmem.c
@@ -1,4 +1,4 @@
1#include "zlib.h" 1#include <linux/zlib.h>
2 2
3/* bits taken from ppc */ 3/* bits taken from ppc */
4 4
@@ -9,11 +9,10 @@ void exit (void)
9 for (;;); 9 for (;;);
10} 10}
11 11
12void *zalloc(void *x, unsigned items, unsigned size) 12void *zalloc(unsigned size)
13{ 13{
14 void *p = avail_ram; 14 void *p = avail_ram;
15 15
16 size *= items;
17 size = (size + 7) & -8; 16 size = (size + 7) & -8;
18 avail_ram += size; 17 avail_ram += size;
19 if (avail_ram > end_avail) { 18 if (avail_ram > end_avail) {
@@ -24,11 +23,6 @@ void *zalloc(void *x, unsigned items, unsigned size)
24 return p; 23 return p;
25} 24}
26 25
27void zfree(void *x, void *addr, unsigned nb)
28{
29}
30
31
32#define HEAD_CRC 2 26#define HEAD_CRC 2
33#define EXTRA_FIELD 4 27#define EXTRA_FIELD 4
34#define ORIG_NAME 8 28#define ORIG_NAME 8
@@ -43,7 +37,6 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
43 int r, i, flags; 37 int r, i, flags;
44 38
45 /* skip header */ 39 /* skip header */
46
47 i = 10; 40 i = 10;
48 flags = src[3]; 41 flags = src[3];
49 if (src[2] != DEFLATED || (flags & RESERVED) != 0) { 42 if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
@@ -65,9 +58,8 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
65 exit(); 58 exit();
66 } 59 }
67 60
68 s.zalloc = zalloc; 61 s.workspace = zalloc(zlib_inflate_workspacesize());
69 s.zfree = zfree; 62 r = zlib_inflateInit2(&s, -MAX_WBITS);
70 r = inflateInit2(&s, -MAX_WBITS);
71 if (r != Z_OK) { 63 if (r != Z_OK) {
72 //puts("inflateInit2 returned "); puthex(r); puts("\n"); 64 //puts("inflateInit2 returned "); puthex(r); puts("\n");
73 exit(); 65 exit();
@@ -76,12 +68,12 @@ void gunzip (void *dst, int dstlen, unsigned char *src, int *lenp)
76 s.avail_in = *lenp - i; 68 s.avail_in = *lenp - i;
77 s.next_out = dst; 69 s.next_out = dst;
78 s.avail_out = dstlen; 70 s.avail_out = dstlen;
79 r = inflate(&s, Z_FINISH); 71 r = zlib_inflate(&s, Z_FINISH);
80 if (r != Z_OK && r != Z_STREAM_END) { 72 if (r != Z_OK && r != Z_STREAM_END) {
81 //puts("inflate returned "); puthex(r); puts("\n"); 73 //puts("inflate returned "); puthex(r); puts("\n");
82 exit(); 74 exit();
83 } 75 }
84 *lenp = s.next_out - (unsigned char *) dst; 76 *lenp = s.next_out - (unsigned char *) dst;
85 inflateEnd(&s); 77 zlib_inflateEnd(&s);
86} 78}
87 79