mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-05 08:05:19 +07:00
staging: usbip: userspace: usbip_common.h: cleanup log macros
Provide better abstraction for easier modification, and align the macros for readability. Remove notice() because it is not used. Signed-off-by: matt mooney <mfm@muteddisk.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
9a20542fd2
commit
213fd4adce
@ -58,51 +58,49 @@ extern int usbip_use_syslog;
|
|||||||
extern int usbip_use_stderr;
|
extern int usbip_use_stderr;
|
||||||
extern int usbip_use_debug ;
|
extern int usbip_use_debug ;
|
||||||
|
|
||||||
#define err(fmt, args...) do { \
|
#define PROGNAME "usbip"
|
||||||
if (usbip_use_syslog) { \
|
|
||||||
syslog(LOG_ERR, "usbip err: %13s:%4d (%-12s) " fmt "\n", \
|
|
||||||
__FILE__, __LINE__, __FUNCTION__, ##args); \
|
|
||||||
} \
|
|
||||||
if (usbip_use_stderr) { \
|
|
||||||
fprintf(stderr, "usbip err: %13s:%4d (%-12s) " fmt "\n", \
|
|
||||||
__FILE__, __LINE__, __FUNCTION__, ##args); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define notice(fmt, args...) do { \
|
#define pr_fmt(fmt) "%s: %s: " fmt "\n", PROGNAME
|
||||||
if (usbip_use_syslog) { \
|
#define dbg_fmt(fmt) pr_fmt("%s:%d:[%s] " fmt), "debug", \
|
||||||
syslog(LOG_DEBUG, "usbip: " fmt, ##args); \
|
__FILE__, __LINE__, __FUNCTION__
|
||||||
} \
|
|
||||||
if (usbip_use_stderr) { \
|
|
||||||
fprintf(stderr, "usbip: " fmt "\n", ##args); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define info(fmt, args...) do { \
|
#define err(fmt, args...) \
|
||||||
if (usbip_use_syslog) { \
|
do { \
|
||||||
syslog(LOG_DEBUG, fmt, ##args); \
|
if (usbip_use_syslog) { \
|
||||||
} \
|
syslog(LOG_ERR, pr_fmt(fmt), "error", ##args); \
|
||||||
if (usbip_use_stderr) { \
|
} \
|
||||||
fprintf(stderr, fmt "\n", ##args); \
|
if (usbip_use_stderr) { \
|
||||||
} \
|
fprintf(stderr, pr_fmt(fmt), "error", ##args); \
|
||||||
} while (0)
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define dbg(fmt, args...) do { \
|
#define info(fmt, args...) \
|
||||||
if (usbip_use_debug) { \
|
do { \
|
||||||
if (usbip_use_syslog) { \
|
if (usbip_use_syslog) { \
|
||||||
syslog(LOG_DEBUG, "usbip dbg: %13s:%4d (%-12s) " fmt, \
|
syslog(LOG_INFO, pr_fmt(fmt), "info", ##args); \
|
||||||
__FILE__, __LINE__, __FUNCTION__, ##args); \
|
} \
|
||||||
} \
|
if (usbip_use_stderr) { \
|
||||||
if (usbip_use_stderr) { \
|
fprintf(stderr, pr_fmt(fmt), "info", ##args); \
|
||||||
fprintf(stderr, "usbip dbg: %13s:%4d (%-12s) " fmt "\n", \
|
} \
|
||||||
__FILE__, __LINE__, __FUNCTION__, ##args); \
|
} while (0)
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
|
#define dbg(fmt, args...) \
|
||||||
|
do { \
|
||||||
|
if (usbip_use_debug) { \
|
||||||
|
if (usbip_use_syslog) { \
|
||||||
|
syslog(LOG_DEBUG, dbg_fmt(fmt), ##args); \
|
||||||
|
} \
|
||||||
|
if (usbip_use_stderr) { \
|
||||||
|
fprintf(stderr, dbg_fmt(fmt), ##args); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define BUG() do { err("sorry, it's a bug"); abort(); } while (0)
|
#define BUG() \
|
||||||
|
do { \
|
||||||
|
err("sorry, it's a bug!"); \
|
||||||
|
abort(); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
struct usbip_usb_interface {
|
struct usbip_usb_interface {
|
||||||
uint8_t bInterfaceClass;
|
uint8_t bInterfaceClass;
|
||||||
|
Loading…
Reference in New Issue
Block a user