0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/init.h>
0010 #include <linux/zutil.h>
0011
0012
0013 #include "../../../lib/zlib_inflate/inftrees.h"
0014 #include "../../../lib/zlib_inflate/inflate.h"
0015 #include "../../../lib/zlib_inflate/infutil.h"
0016
0017 extern char __data_loc[];
0018 extern char _edata_loc[];
0019 extern char _sdata[];
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 int __init __inflate_kernel_data(void)
0036 {
0037 struct z_stream_s stream, *strm = &stream;
0038 struct inflate_state state;
0039 char *in = __data_loc;
0040 int rc;
0041
0042
0043 if (in[0] != 0x1f || in[1] != 0x8b || in[2] != 0x08 || in[3] & ~3)
0044 return -1;
0045 in += 10;
0046
0047 strm->workspace = &state;
0048 strm->next_in = in;
0049 strm->avail_in = _edata_loc - __data_loc;
0050 strm->next_out = _sdata;
0051 strm->avail_out = _edata_loc - __data_loc;
0052 zlib_inflateInit2(strm, -MAX_WBITS);
0053 WS(strm)->inflate_state.wsize = 0;
0054 WS(strm)->inflate_state.window = NULL;
0055 rc = zlib_inflate(strm, Z_FINISH);
0056 if (rc == Z_OK || rc == Z_STREAM_END)
0057 rc = strm->avail_out;
0058 return rc;
0059 }