162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * RDMA Network Block Driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
662306a36Sopenharmony_ci * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
762306a36Sopenharmony_ci * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci#ifndef RNBD_LOG_H
1062306a36Sopenharmony_ci#define RNBD_LOG_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include "rnbd-clt.h"
1362306a36Sopenharmony_ci#include "rnbd-srv.h"
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define rnbd_clt_log(fn, dev, fmt, ...) (				\
1662306a36Sopenharmony_ci		fn("<%s@%s> " fmt, (dev)->pathname,			\
1762306a36Sopenharmony_ci		(dev)->sess->sessname,					\
1862306a36Sopenharmony_ci		   ##__VA_ARGS__))
1962306a36Sopenharmony_ci#define rnbd_srv_log(fn, dev, fmt, ...) (				\
2062306a36Sopenharmony_ci			fn("<%s@%s>: " fmt, (dev)->pathname,		\
2162306a36Sopenharmony_ci			   (dev)->sess->sessname, ##__VA_ARGS__))
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#define rnbd_clt_err(dev, fmt, ...)	\
2462306a36Sopenharmony_ci	rnbd_clt_log(pr_err, dev, fmt, ##__VA_ARGS__)
2562306a36Sopenharmony_ci#define rnbd_clt_err_rl(dev, fmt, ...)	\
2662306a36Sopenharmony_ci	rnbd_clt_log(pr_err_ratelimited, dev, fmt, ##__VA_ARGS__)
2762306a36Sopenharmony_ci#define rnbd_clt_info(dev, fmt, ...) \
2862306a36Sopenharmony_ci	rnbd_clt_log(pr_info, dev, fmt, ##__VA_ARGS__)
2962306a36Sopenharmony_ci#define rnbd_clt_info_rl(dev, fmt, ...) \
3062306a36Sopenharmony_ci	rnbd_clt_log(pr_info_ratelimited, dev, fmt, ##__VA_ARGS__)
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define rnbd_srv_err(dev, fmt, ...)	\
3362306a36Sopenharmony_ci	rnbd_srv_log(pr_err, dev, fmt, ##__VA_ARGS__)
3462306a36Sopenharmony_ci#define rnbd_srv_err_rl(dev, fmt, ...)	\
3562306a36Sopenharmony_ci	rnbd_srv_log(pr_err_ratelimited, dev, fmt, ##__VA_ARGS__)
3662306a36Sopenharmony_ci#define rnbd_srv_info(dev, fmt, ...) \
3762306a36Sopenharmony_ci	rnbd_srv_log(pr_info, dev, fmt, ##__VA_ARGS__)
3862306a36Sopenharmony_ci#define rnbd_srv_info_rl(dev, fmt, ...) \
3962306a36Sopenharmony_ci	rnbd_srv_log(pr_info_ratelimited, dev, fmt, ##__VA_ARGS__)
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#endif /* RNBD_LOG_H */
42