Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\decompress_inflate.c Create Date:2022-07-28 06:16:41
Last Modify:2020-03-15 22:47:18 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Included from initramfs et al code

Proto:STATIC int __attribute__((__section__(".init.text"))) __attribute__((__cold__))__gunzip(unsigned char *buf, long len, long (*fill)(void *, unsigned long ), long (*flush)(void *, unsigned long ), unsigned char *out_buf, long out_len, long *pos, void (*error)(char *x))

Type:int

Parameter:

TypeParameterName
unsigned char *buf
longlen
long (*fill
long (*flush
unsigned char *out_buf
longout_len
long *pos
void (*error
48  rc = -1
49  If flush Then
50  out_len = 0x8000
51  out_buf = Use defines rather than static inline in order to avoid spurious* warnings when not needed (indeed large_malloc / large_free are not* needed by inflate (out_len)
52  Else
53  If Not out_len Then out_len = ~0 - out_buf
56  If Not out_buf Then
57  error("Out of memory while allocating output buffer")
58  Go to gunzip_nomem1
61  If buf Then zbuf = buf
63  Else
64  zbuf = Use defines rather than static inline in order to avoid spurious* warnings when not needed (indeed large_malloc / large_free are not* needed by inflate (GZIP_IOBUF_SIZE)
65  len = 0
67  If Not zbuf Then
68  error("Out of memory while allocating input buffer")
69  Go to gunzip_nomem2
72  strm = Use defines rather than static inline in order to avoid spurious* warnings when not needed (indeed large_malloc / large_free are not* needed by inflate ( size of strm )
73  If (strm == NULL) Then
74  error("Out of memory while allocating z_stream")
75  Go to gunzip_nomem3
78  memory allocated for this stream = Use defines rather than static inline in order to avoid spurious* warnings when not needed (indeed large_malloc / large_free are not* needed by inflate (flush ? All dynamically allocated data structures for this stream are freed : sizeof(structinflate_state))
80  If ( memory allocated for this stream == NULL) Then
81  error("Out of memory while allocating workspace")
82  Go to gunzip_nomem4
85  If Not fill Then fill = nofill
88  If len == 0 Then len = fill(zbuf, GZIP_IOBUF_SIZE)
92  If len < 10 || zbuf[0] != 0x1f || zbuf[1] != 0x8b || zbuf[2] != 0x08 Then
94  If pos Then pos = 0
96  error("Not a gzip file")
97  Go to gunzip_5
103  next input byte = zbuf + 10
104  number of bytes available at next_in = len - 10
106  If zbuf[3] & 0x8 Then
107  Do
114  error("header error")
115  Go to gunzip_5
118  When next input byte ++ cycle
121  next output byte should be put there = out_buf
122  remaining free space at next_out = out_len
124  rc = zlib_inflateInit2(strm, - 32K LZ77 window )
126  If Not flush Then
127  wsize = 0
128  window = NULL
131  When rc == Allowed flush values; see deflate() and inflate() below for details cycle
135  If len < 0 Then
136  rc = -1
137  error("read error")
138  Break
143  rc = late() uses a state machine to process as much input data and generate asmuch output data as possible before returning
148  If l != flush(out_buf, l) Then
149  rc = -1
150  error("write error")
151  Break
158  If rc == Z_STREAM_END Then
159  rc = 0
160  Break
162  error("uncompression error")
163  rc = -1
167  late decompresses as much data as possible, and stops when the inputbuffer becomes empty or the output buffer becomes full. It may introducesome output latency (reading input without producing any output) except whenforced to flush.
168  If pos Then pos = next input byte - zbuf + 8
172  gunzip_5 :
173  free( memory allocated for this stream )
174  gunzip_nomem4 :
175  free(strm)
176  gunzip_nomem3 :
177  If Not buf Then free(zbuf)
179  gunzip_nomem2 :
180  If flush Then free(out_buf)
182  gunzip_nomem1 :
183  Return rc
Caller
NameDescribe
__decompress