From: Anastasia Kovaleva <a.kovaleva@yadro.com>
To: <martin.petersen@oracle.com>, <michael.christie@oracle.com>
Cc: <linux-scsi@vger.kernel.org>, <target-devel@vger.kernel.org>,
<linux@yadro.com>
Subject: [RFC PATCH 1/3] target: core: Initial work on improving SCSI target logs
Date: Wed, 26 Jul 2023 14:55:07 +0300 [thread overview]
Message-ID: <20230726115509.357-2-a.kovaleva@yadro.com> (raw)
In-Reply-To: <20230726115509.357-1-a.kovaleva@yadro.com>
Introduce the new logging wrapper.
Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com>
---
include/target/target_core_base.h | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 159567359bbb..ba8c05dc3d54 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -11,6 +11,31 @@
#define TARGET_CORE_VERSION "v5.0"
+/*
+ * Unified target core logs
+ */
+#define target_sess_log(lvl, sess, fmt, ...) pr_##lvl("target " TARGET_PREFIX " (%s -> %d): " fmt, \
+ (sess)->se_node_acl->initiatorname, (sess)->se_tpg->tpg_rtpi, ##__VA_ARGS__)
+#define target_cmd_log(lvl, cmd, fmt, ...) pr_##lvl("target " TARGET_PREFIX " (%s -> %d/%lld): " fmt, \
+ (cmd)->se_sess->se_node_acl->initiatorname, (cmd)->se_lun->lun_tpg->tpg_rtpi, \
+ (cmd)->orig_fe_lun, ##__VA_ARGS__)
+#define target_log(lvl, fmt, ...) pr_##lvl("target " TARGET_PREFIX ": " fmt, ##__VA_ARGS__)
+
+#define target_sess_debug(sess, fmt, ...) target_sess_log(debug, sess, fmt, ##__VA_ARGS__)
+#define target_sess_info(sess, fmt, ...) target_sess_log(info, sess, fmt, ##__VA_ARGS__)
+#define target_sess_warn(sess, fmt, ...) target_sess_log(warn, sess, fmt, ##__VA_ARGS__)
+#define target_sess_err(sess, fmt, ...) target_sess_log(err, sess, fmt, ##__VA_ARGS__)
+
+#define target_cmd_debug(cmd, fmt, ...) target_cmd_log(debug, cmd, fmt, ##__VA_ARGS__)
+#define target_cmd_info(cmd, fmt, ...) target_cmd_log(info, cmd, fmt, ##__VA_ARGS__)
+#define target_cmd_warn(cmd, fmt, ...) target_cmd_log(warn, cmd, fmt, ##__VA_ARGS__)
+#define target_cmd_err(cmd, fmt, ...) target_cmd_log(err, cmd, fmt, ##__VA_ARGS__)
+
+#define target_debug(fmt, ...) target_log(debug, fmt, ##__VA_ARGS__)
+#define target_info(fmt, ...) target_log(info, fmt, ##__VA_ARGS__)
+#define target_warn(fmt, ...) target_log(warn, fmt, ##__VA_ARGS__)
+#define target_err(fmt, ...) target_log(err, fmt, ##__VA_ARGS__)
+
/*
* Maximum size of a CDB that can be stored in se_cmd without allocating
* memory dynamically for the CDB.
--
2.40.1
next prev parent reply other threads:[~2023-07-26 12:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 11:55 [RFC PATCH 0/3] SCSI target logs Anastasia Kovaleva
2023-07-26 11:55 ` Anastasia Kovaleva [this message]
2023-07-26 11:55 ` [RFC PATCH 2/3] target: core: apply the new wrapper to spc Anastasia Kovaleva
2023-07-26 15:15 ` Bart Van Assche
2023-07-26 16:18 ` [DMARC Error]Re: " Konstantin Shelekhin
2023-07-26 11:55 ` [RFC PATCH 3/3] target: core: apply the new wrapper to iblock Anastasia Kovaleva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230726115509.357-2-a.kovaleva@yadro.com \
--to=a.kovaleva@yadro.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@yadro.com \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox