Linux Audio

Check our new training course

Loading...
v6.8
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 *  Copyright IBM Corp. 2016
 4 *  Author(s): Holger Dengler (hd@linux.vnet.ibm.com)
 5 *	       Harald Freudenberger <freude@de.ibm.com>
 6 */
 7#ifndef ZCRYPT_DEBUG_H
 8#define ZCRYPT_DEBUG_H
 9
10#include <asm/debug.h>
 
11
12#define DBF_ERR		3	/* error conditions   */
13#define DBF_WARN	4	/* warning conditions */
14#define DBF_INFO	5	/* informational      */
15#define DBF_DEBUG	6	/* for debugging only */
16
17#define RC2ERR(rc) ((rc) ? DBF_ERR : DBF_INFO)
18#define RC2WARN(rc) ((rc) ? DBF_WARN : DBF_INFO)
19
20#define DBF_MAX_SPRINTF_ARGS 6
21
22#define ZCRYPT_DBF(...)					\
23	debug_sprintf_event(zcrypt_dbf_info, ##__VA_ARGS__)
24#define ZCRYPT_DBF_ERR(...)					\
25	debug_sprintf_event(zcrypt_dbf_info, DBF_ERR, ##__VA_ARGS__)
26#define ZCRYPT_DBF_WARN(...)					\
27	debug_sprintf_event(zcrypt_dbf_info, DBF_WARN, ##__VA_ARGS__)
28#define ZCRYPT_DBF_INFO(...)					\
29	debug_sprintf_event(zcrypt_dbf_info, DBF_INFO, ##__VA_ARGS__)
30#define ZCRYPT_DBF_DBG(...)					\
31	debug_sprintf_event(zcrypt_dbf_info, DBF_DEBUG, ##__VA_ARGS__)
32
33extern debug_info_t *zcrypt_dbf_info;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
35int zcrypt_debug_init(void);
36void zcrypt_debug_exit(void);
37
38#endif /* ZCRYPT_DEBUG_H */
v3.15
 
 1/*
 2 *  Copyright IBM Corp. 2012
 3 *  Author(s): Holger Dengler (hd@linux.vnet.ibm.com)
 
 4 */
 5#ifndef ZCRYPT_DEBUG_H
 6#define ZCRYPT_DEBUG_H
 7
 8#include <asm/debug.h>
 9#include "zcrypt_api.h"
10
11/* that gives us 15 characters in the text event views */
12#define ZCRYPT_DBF_LEN	16
 
 
13
14#define DBF_ERR		3	/* error conditions	*/
15#define DBF_WARN	4	/* warning conditions	*/
16#define DBF_INFO	6	/* informational	*/
 
17
18#define RC2WARN(rc) ((rc) ? DBF_WARN : DBF_INFO)
 
 
 
 
 
 
 
 
 
19
20#define ZCRYPT_DBF_COMMON(level, text...) \
21	do { \
22		if (debug_level_enabled(zcrypt_dbf_common, level)) { \
23			char debug_buffer[ZCRYPT_DBF_LEN]; \
24			snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \
25			debug_text_event(zcrypt_dbf_common, level, \
26					 debug_buffer); \
27		} \
28	} while (0)
29
30#define ZCRYPT_DBF_DEVICES(level, text...) \
31	do { \
32		if (debug_level_enabled(zcrypt_dbf_devices, level)) { \
33			char debug_buffer[ZCRYPT_DBF_LEN]; \
34			snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \
35			debug_text_event(zcrypt_dbf_devices, level, \
36					 debug_buffer); \
37		} \
38	} while (0)
39
40#define ZCRYPT_DBF_DEV(level, device, text...) \
41	do { \
42		if (debug_level_enabled(device->dbf_area, level)) { \
43			char debug_buffer[ZCRYPT_DBF_LEN]; \
44			snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \
45			debug_text_event(device->dbf_area, level, \
46					 debug_buffer); \
47		} \
48	} while (0)
49
50int zcrypt_debug_init(void);
51void zcrypt_debug_exit(void);
52
53#endif /* ZCRYPT_DEBUG_H */