xref: /openbmc/linux/drivers/block/rnbd/rnbd-log.h (revision 842ed298)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * RDMA Network Block Driver
4  *
5  * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
6  * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
7  * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
8  */
9 #ifndef RNBD_LOG_H
10 #define RNBD_LOG_H
11 
12 #include "rnbd-clt.h"
13 #include "rnbd-srv.h"
14 
15 #define rnbd_clt_log(fn, dev, fmt, ...) (				\
16 		fn("<%s@%s> " fmt, (dev)->pathname,			\
17 		(dev)->sess->sessname,					\
18 		   ##__VA_ARGS__))
19 #define rnbd_srv_log(fn, dev, fmt, ...) (				\
20 			fn("<%s@%s>: " fmt, (dev)->pathname,		\
21 			   (dev)->sess->sessname, ##__VA_ARGS__))
22 
23 #define rnbd_clt_err(dev, fmt, ...)	\
24 	rnbd_clt_log(pr_err, dev, fmt, ##__VA_ARGS__)
25 #define rnbd_clt_err_rl(dev, fmt, ...)	\
26 	rnbd_clt_log(pr_err_ratelimited, dev, fmt, ##__VA_ARGS__)
27 #define rnbd_clt_info(dev, fmt, ...) \
28 	rnbd_clt_log(pr_info, dev, fmt, ##__VA_ARGS__)
29 #define rnbd_clt_info_rl(dev, fmt, ...) \
30 	rnbd_clt_log(pr_info_ratelimited, dev, fmt, ##__VA_ARGS__)
31 
32 #define rnbd_srv_err(dev, fmt, ...)	\
33 	rnbd_srv_log(pr_err, dev, fmt, ##__VA_ARGS__)
34 #define rnbd_srv_err_rl(dev, fmt, ...)	\
35 	rnbd_srv_log(pr_err_ratelimited, dev, fmt, ##__VA_ARGS__)
36 #define rnbd_srv_info(dev, fmt, ...) \
37 	rnbd_srv_log(pr_info, dev, fmt, ##__VA_ARGS__)
38 #define rnbd_srv_info_rl(dev, fmt, ...) \
39 	rnbd_srv_log(pr_info_ratelimited, dev, fmt, ##__VA_ARGS__)
40 
41 #endif /* RNBD_LOG_H */
42