1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef PERF_PRINT_BINARY_H
3 #define PERF_PRINT_BINARY_H
8 enum binary_printer_ops
{
9 BINARY_PRINT_DATA_BEGIN
,
10 BINARY_PRINT_LINE_BEGIN
,
12 BINARY_PRINT_NUM_DATA
,
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
,
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 */