Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / perf / util / print_binary.h
blob2a1554afc95757a9dcde5aaebb6284cf9a47ce2c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef PERF_PRINT_BINARY_H
3 #define PERF_PRINT_BINARY_H
5 #include <stddef.h>
6 #include <stdio.h>
8 enum binary_printer_ops {
9 BINARY_PRINT_DATA_BEGIN,
10 BINARY_PRINT_LINE_BEGIN,
11 BINARY_PRINT_ADDR,
12 BINARY_PRINT_NUM_DATA,
13 BINARY_PRINT_NUM_PAD,
14 BINARY_PRINT_SEP,
15 BINARY_PRINT_CHAR_DATA,
16 BINARY_PRINT_CHAR_PAD,
17 BINARY_PRINT_LINE_END,
18 BINARY_PRINT_DATA_END,
21 typedef int (*binary__fprintf_t)(enum binary_printer_ops op,
22 unsigned int val, void *extra, FILE *fp);
24 int binary__fprintf(unsigned char *data, size_t len,
25 size_t bytes_per_line, binary__fprintf_t printer,
26 void *extra, FILE *fp);
28 static inline void print_binary(unsigned char *data, size_t len,
29 size_t bytes_per_line, binary__fprintf_t printer,
30 void *extra)
32 binary__fprintf(data, len, bytes_per_line, printer, extra, stdout);
35 int is_printable_array(char *p, unsigned int len);
37 #endif /* PERF_PRINT_BINARY_H */