• Home
  • Raw
  • Download

Lines Matching +full:4 +full:- +full:ch

1 // SPDX-License-Identifier: GPL-2.0-only
20 * hex_to_bin - convert a hex digit to its real value
21 * @ch: ascii character represents hex digit
23 * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad
26 int hex_to_bin(char ch) in hex_to_bin() argument
28 if ((ch >= '0') && (ch <= '9')) in hex_to_bin()
29 return ch - '0'; in hex_to_bin()
30 ch = tolower(ch); in hex_to_bin()
31 if ((ch >= 'a') && (ch <= 'f')) in hex_to_bin()
32 return ch - 'a' + 10; in hex_to_bin()
33 return -1; in hex_to_bin()
38 * hex2bin - convert an ascii hexadecimal string to its binary representation
43 * Return 0 on success, -EINVAL in case of bad input.
47 while (count--) { in hex2bin()
52 return -EINVAL; in hex2bin()
54 *dst++ = (hi << 4) | lo; in hex2bin()
61 * bin2hex - convert binary data to an ascii hexadecimal string
70 while (count--) in bin2hex()
77 * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory
81 * @groupsize: number of bytes to print at a time (1, 2, 4, 8; default = 1)
91 * The converted output is always NUL-terminated.
94 * hex_dump_to_buffer(frame->data, frame->len, 16, 1,
98 * 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO
111 u8 ch; in hex_dump_to_buffer() local
139 ret = snprintf(linebuf + lx, linebuflen - lx, in hex_dump_to_buffer()
142 if (ret >= linebuflen - lx) in hex_dump_to_buffer()
146 } else if (groupsize == 4) { in hex_dump_to_buffer()
150 ret = snprintf(linebuf + lx, linebuflen - lx, in hex_dump_to_buffer()
153 if (ret >= linebuflen - lx) in hex_dump_to_buffer()
161 ret = snprintf(linebuf + lx, linebuflen - lx, in hex_dump_to_buffer()
164 if (ret >= linebuflen - lx) in hex_dump_to_buffer()
172 ch = ptr[j]; in hex_dump_to_buffer()
173 linebuf[lx++] = hex_asc_hi(ch); in hex_dump_to_buffer()
176 linebuf[lx++] = hex_asc_lo(ch); in hex_dump_to_buffer()
182 lx--; in hex_dump_to_buffer()
195 ch = ptr[j]; in hex_dump_to_buffer()
196 linebuf[lx++] = (isascii(ch) && isprint(ch)) ? ch : '.'; in hex_dump_to_buffer()
204 return ascii ? ascii_column + len : (groupsize * 2 + 1) * ngroups - 1; in hex_dump_to_buffer()
210 * print_hex_dump - print a text hex dump to syslog for a binary blob of data
217 * @groupsize: number of bytes to print at a time (1, 2, 4, 8; default = 1)
233 * 16, 1, frame->data, frame->len, true);
235 * Example output using %DUMP_PREFIX_OFFSET and 1-byte mode:
236 * 0009ab42: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO
237 * Example output using %DUMP_PREFIX_ADDRESS and 4-byte mode:
253 remaining -= rowsize; in print_hex_dump()