Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\hexdump.c Create Date:2022-07-28 06:26:09
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory*@buf: data blob to dump*@len: number of bytes in the @buf*@rowsize: number of bytes to print per line; must be 16 or 32*@groupsize: number of bytes to print at a time (1, 2, 4, 8;

Proto:int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, char *linebuf, size_t linebuflen, bool ascii)

Type:int

Parameter:

TypeParameterName
const void *buf
size_tlen
introwsize
intgroupsize
char *linebuf
size_tlinebuflen
boolascii
108  ptr = buf
111  lx = 0
115  If rowsize != 16 && rowsize != 32 Then rowsize = 16
118  If len > rowsize Then len = rowsize
120  If Not s_power_of_2() - check if a value is a power of two*@n: the value to check* Determine whether some value is a power of two, where zero is* *not* considered a power of two.* Return: true if @n is a power of 2, otherwise false. || groupsize > 8 Then groupsize = 1
122  If len % groupsize != 0 Then groupsize = 1
125  ngroups = len / groupsize
126  ascii_column = rowsize * 2 + rowsize / groupsize + 1
128  If Not linebuflen Then Go to overflow1
131  If Not len Then Go to nil
134  If groupsize == 8 Then
135  ptr8 = buf
137  When j < ngroups cycle
141  If ret >= linebuflen - lx Then Go to overflow1
143  lx += ret
145  Else if groupsize == 4 Then
146  ptr4 = buf
148  When j < ngroups cycle
152  If ret >= linebuflen - lx Then Go to overflow1
154  lx += ret
156  Else if groupsize == 2 Then
157  ptr2 = buf
159  When j < ngroups cycle
163  If ret >= linebuflen - lx Then Go to overflow1
165  lx += ret
167  Else
168  When j < len cycle
169  If linebuflen < lx + 2 Then Go to overflow2
171  ch = ptr[j]
172  linebuf[lx++] = hex_asc_hi(ch)
173  If linebuflen < lx + 2 Then Go to overflow2
175  linebuf[lx++] = hex_asc_lo(ch)
176  If linebuflen < lx + 2 Then Go to overflow2
178  linebuf[lx++] = ' '
180  If j Then lx--
183  If Not ascii Then Go to nil
186  When lx < ascii_column cycle
187  If linebuflen < lx + 2 Then Go to overflow2
189  linebuf[lx++] = ' '
191  When j < len cycle
192  If linebuflen < lx + 2 Then Go to overflow2
194  ch = ptr[j]
195  linebuf[lx++] = If isascii(ch) && isprint(ch) Then ch Else '.'
197  nil :
198  linebuf[lx] = '\0'
199  Return lx
200  overflow2 :
201  linebuf[lx++] = '\0'
202  overflow1 :
203  Return If ascii Then ascii_column + len Else ( groupsize * 2 + 1) * ngroups - 1
Caller
NameDescribe
print_hex_dumpprint_hex_dump - print a text hex dump to syslog for a binary blob of data*@level: kernel log level (e
test_hexdump
test_hexdump_overflow
seq_buf_hex_dumpseq_buf_hex_dump - print formatted hex dump into the sequence buffer*@s: seq_buf descriptor*@prefix_str: string to prefix each line with;* caller supplies trailing spaces for alignment if desired*@prefix_type: controls whether prefix of an offset,