vserver 1.9.3
[linux-2.6.git] / arch / ppc / boot / common / misc-common.c
index 868fa81..7acd03b 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdarg.h>    /* for va_ bits */
 #include <linux/config.h>
 #include <linux/string.h>
-#include "zlib.h"
+#include <linux/zlib.h>
 #include "nonstdio.h"
 
 /* If we're on a PReP, assume we have a keyboard controller
@@ -202,11 +202,10 @@ void error(char *x)
        while(1);       /* Halt */
 }
 
-void *zalloc(void *x, unsigned items, unsigned size)
+static void *zalloc(unsigned size)
 {
        void *p = avail_ram;
 
-       size *= items;
        size = (size + 7) & -8;
        avail_ram += size;
        if (avail_ram > end_avail) {
@@ -216,18 +215,12 @@ void *zalloc(void *x, unsigned items, unsigned size)
        return p;
 }
 
-void zfree(void *x, void *addr, unsigned nb)
-{
-}
-
 #define HEAD_CRC       2
 #define EXTRA_FIELD    4
 #define ORIG_NAME      8
 #define COMMENT                0x10
 #define RESERVED       0xe0
 
-#define DEFLATED       8
-
 void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
 {
        z_stream s;
@@ -236,7 +229,7 @@ void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
        /* skip header */
        i = 10;
        flags = src[3];
-       if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
+       if (src[2] != Z_DEFLATED || (flags & RESERVED) != 0) {
                puts("bad gzipped data\n");
                exit();
        }
@@ -255,24 +248,24 @@ void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
                exit();
        }
 
-       s.zalloc = zalloc;
-       s.zfree = zfree;
-       r = inflateInit2(&s, -MAX_WBITS);
+       /* Initialize ourself. */
+       s.workspace = zalloc(zlib_inflate_workspacesize());
+       r = zlib_inflateInit2(&s, -MAX_WBITS);
        if (r != Z_OK) {
-               puts("inflateInit2 returned "); puthex(r); puts("\n");
+               puts("zlib_inflateInit2 returned "); puthex(r); puts("\n");
                exit();
        }
        s.next_in = src + i;
        s.avail_in = *lenp - i;
        s.next_out = dst;
        s.avail_out = dstlen;
-       r = inflate(&s, Z_FINISH);
+       r = zlib_inflate(&s, Z_FINISH);
        if (r != Z_OK && r != Z_STREAM_END) {
                puts("inflate returned "); puthex(r); puts("\n");
                exit();
        }
        *lenp = s.next_out - (unsigned char *) dst;
-       inflateEnd(&s);
+       zlib_inflateEnd(&s);
 }
 
 void
@@ -526,6 +519,11 @@ _dump_buf(unsigned char *p, int s)
  * on others it's an offset from a given location. -- Tom
  */
 
+void ISA_init(unsigned long base)
+{
+       ISA_io = (unsigned char *)base;
+}
+
 void
 outb(int port, unsigned char val)
 {