Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Unpacks the next block and sets up for the inverse burrows-wheeler step.

Proto:static int __attribute__((__section__(".init.text"))) __attribute__((__cold__))get_next_block(struct bunzip_data *bd)

Type:int

Parameter:

TypeParameterName
struct bunzip_data *bd
158  struct group_data * hufGroup = NULL
159  int * base = NULL
160  int * limit = NULL
166  dbuf = Intermediate buffer and its size (in bytes)
167  dbufSize = Intermediate buffer and its size (in bytes)
168  selectors = Selectors = 15 bits
169  byteCount = byteCount
170  symToByte = symToByte
171  mtfSymbol = mtfSymbol
175  i = Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian
176  j = Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian
177  The CRC values stored in the block header and calculated from thedata = Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian
178  If i == 0x177245 && j == 0x385090 Then Return RETVAL_LAST_BLOCK
180  If i != 0x314159 || j != 0x265359 Then Return RETVAL_NOT_BZIP_DATA
185  If Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian Then Return RETVAL_OBSOLETE_INPUT
187  origPtr = Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian
188  If origPtr >= dbufSize Then Return RETVAL_DATA_ERROR
195  t = Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian
196  symTotal = 0
197  When i < 16 cycle
198  If t & 1 << 15 - i Then
200  When j < 16 cycle If k & 1 << 15 - j Then
202  symToByte[symTotal++] = 16 * i + j
206  groupCount = Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian
207  If groupCount < 2 || groupCount > Constants for Huffman coding Then Return RETVAL_DATA_ERROR
214  nSelectors = Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian
215  If Not nSelectors Then Return RETVAL_DATA_ERROR
217  When i < groupCount cycle mtfSymbol[i] = i
219  When i < nSelectors cycle
221  When Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian cycle If j >= groupCount Then
223  Return RETVAL_DATA_ERROR
225  uc = mtfSymbol[j]
226  When j cycle mtfSymbol[j] = mtfSymbol[j - 1]
228  mtfSymbol[0] = selectors[i] = uc
233  symCount = symTotal + 2
234  When j < groupCount cycle
235  unsigned char length[258], temp[21]
246  t = Return the next nnn bits of input. All reads from the compressed inputare done through this function. All reads are big endian - 1
247  When i < symCount cycle
248  cycle
269  length[i] = t + 1
272  minLen = maxLen = length[0]
274  When i < symCount cycle
275  If length[i] > maxLen Then maxLen = length[i]
277  Else if length[i] < minLen Then minLen = length[i]
296  hufGroup = Huffman coding tables + j
297  minLen = minLen
298  maxLen = maxLen
303  base = base - 1
304  limit = We have an extra slot at the end of limit[] for a sentinal value. - 1
307  pp = 0
308  When i <= maxLen cycle
309  temp[i] = limit[i] = 0
310  When t < symCount cycle If length[t] == i Then
312  permute[pp++] = t
315  When i < symCount cycle temp[length[i]]++
323  pp = t = 0
324  When i < maxLen cycle
325  pp += temp[i]
336  limit[i] = (pp << maxLen - i ) - 1
337  pp <<= 1
338  base[i + 1] = pp - (t += temp[i])
341  limit[maxLen + 1] = INT_MAX
342  limit[maxLen] = pp + temp[maxLen] - 1
343  base[minLen] = 0
352  When i < 256 cycle
353  byteCount[i] = 0
354  mtfSymbol[i] = i
357  runPos = dbufCount = symCount = selector = 0
358  cycle
360  If Not symCount-- Then
362  If selector >= nSelectors Then Return RETVAL_DATA_ERROR
365  base = base - 1
380  When inbufBitCount < maxLen cycle
381  If , outbufPos == inbufCount Then
387  inbufBitCount += 8
389  inbufBitCount -= maxLen
390  j = inbufBits >> inbufBitCount & (1 << maxLen) - 1
392  got_huff_bits :
395  i = minLen
396  When j > limit[i] cycle
397  ++i
398  inbufBitCount += maxLen - i
400  If i > maxLen || (j = (j >> maxLen - i ) - base[i] ) >= 256 literals + RUNA + RUNB Then Return RETVAL_DATA_ERROR
404  nextSym = permute[j]
410  If nextSym <= SYMBOL_RUNB Then
413  If Not runPos Then
414  runPos = 1
415  t = 0
427  t += runPos << nextSym
430  runPos <<= 1
431  Continue
439  If runPos Then
440  runPos = 0
441  If dbufCount + t >= dbufSize Then Return RETVAL_DATA_ERROR
444  uc = symToByte[mtfSymbol[0]]
445  byteCount[uc] += t
446  When t-- cycle
447  dbuf[dbufCount++] = uc
450  If nextSym > symTotal Then Break
461  If dbufCount >= dbufSize Then Return RETVAL_DATA_ERROR
463  i = nextSym - 1
464  uc = mtfSymbol[i]
470  Do
471  mtfSymbol[i] = mtfSymbol[i - 1]
472  When --i cycle
473  mtfSymbol[0] = uc
474  uc = symToByte[uc]
476  byteCount[uc]++
477  dbuf[dbufCount++] = uc
487  j = 0
488  When i < 256 cycle
489  k = j + byteCount[i]
490  byteCount[i] = j
491  j = k
494  When i < dbufCount cycle
495  uc = dbuf[i] & 0xff
496  dbuf[byteCount[uc]] |= i << 8
497  byteCount[uc]++
503  If dbufCount Then
504  If origPtr >= dbufCount Then Return RETVAL_DATA_ERROR
506  State for interrupting output loop = dbuf[origPtr]
507  State for interrupting output loop = State for interrupting output loop & 0xff
508  State for interrupting output loop >>= 8
509  State for interrupting output loop = 5
511  State for interrupting output loop = dbufCount
513  Return Status return values
Caller
NameDescribe
read_bunzipUndo burrows-wheeler transform on intermediate buffer to produce output.If start_bunzip was initialized with out_fd =-1, then up to len bytes ofdata are written to outbuf. Return value is number of bytes written orerror (all errors are negative numbers)