All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Rebase: Add printk indexing to scsi drivers.
@ 2022-04-13 21:47 Jonathan Lassoff
  2022-04-13 21:47 ` [PATCH 1/1] " Jonathan Lassoff
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Lassoff @ 2022-04-13 21:47 UTC (permalink / raw)
  To: linux-scsi; +Cc: Martin K . Petersen, James E . J . Bottomley, Jonathan Lassoff

Just rebasing this patch to keep it current.

Jonathan Lassoff (1):
  Add printk indexing to scsi drivers.

 drivers/scsi/scsi_logging.c | 7 ++++---
 include/scsi/scsi_device.h  | 8 +++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] Add printk indexing to scsi drivers.
  2022-04-13 21:47 [PATCH 0/1] Rebase: Add printk indexing to scsi drivers Jonathan Lassoff
@ 2022-04-13 21:47 ` Jonathan Lassoff
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Lassoff @ 2022-04-13 21:47 UTC (permalink / raw)
  To: linux-scsi; +Cc: Martin K . Petersen, James E . J . Bottomley, Jonathan Lassoff

The printk index collects some of the format strings and locations.
Kernel developers, packagers, and operators can examine the index
contents to see what may get printed out to the kernel message buffer.
This can be useful for developers of message matchers or documentation
to detect changes from release to release, without requiring any kind of
coordination or commitment from the Kernel developer community.

So that detailed SCSI driver messages are captured by this printk index,
this patch wraps sdev_prefix_printk with a macro.
---
 drivers/scsi/scsi_logging.c | 7 ++++---
 include/scsi/scsi_device.h  | 8 +++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c
index b02af340c2d3..a348d931472e 100644
--- a/drivers/scsi/scsi_logging.c
+++ b/drivers/scsi/scsi_logging.c
@@ -53,7 +53,8 @@ static size_t sdev_format_header(char *logbuf, size_t logbuf_len,
 	return off;
 }
 
-void sdev_prefix_printk(const char *level, const struct scsi_device *sdev,
+
+void _sdev_prefix_printk(const char *level, const struct scsi_device *sdev,
 			const char *name, const char *fmt, ...)
 {
 	va_list args;
@@ -75,10 +76,10 @@ void sdev_prefix_printk(const char *level, const struct scsi_device *sdev,
 		off += vscnprintf(logbuf + off, logbuf_len - off, fmt, args);
 		va_end(args);
 	}
-	dev_printk(level, &sdev->sdev_gendev, "%s", logbuf);
+	_dev_printk(level, &sdev->sdev_gendev, "%s", logbuf);
 	scsi_log_release_buffer(logbuf);
 }
-EXPORT_SYMBOL(sdev_prefix_printk);
+EXPORT_SYMBOL(_sdev_prefix_printk);
 
 void scmd_printk(const char *level, const struct scsi_cmnd *scmd,
 		const char *fmt, ...)
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 57e3e239a1fc..f9dcbd8dc51e 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -263,9 +263,15 @@ struct scsi_device {
  * as a string pointer
  */
 __printf(4, 5) void
-sdev_prefix_printk(const char *, const struct scsi_device *, const char *,
+_sdev_prefix_printk(const char *, const struct scsi_device *, const char *,
 		const char *, ...);
 
+#define sdev_prefix_printk(level, sdev, name, fmt, ...)             \
+({                                                                  \
+		printk_index_subsys_emit("%s %s: [%s] ", level, fmt);       \
+		_sdev_prefix_printk(level, sdev, name, fmt, ##__VA_ARGS__); \
+})
+
 #define sdev_printk(l, sdev, fmt, a...)				\
 	sdev_prefix_printk(l, sdev, NULL, fmt, ##a)
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 1/1] Add printk indexing to scsi drivers.
  2022-04-13 22:02 [PATCH 0/1] Rebase: " Jonathan Lassoff
@ 2022-04-13 22:02 ` Jonathan Lassoff
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Lassoff @ 2022-04-13 22:02 UTC (permalink / raw)
  To: linux-scsi; +Cc: Martin K . Petersen, James E . J . Bottomley, Jonathan Lassoff

The printk index collects some of the format strings and locations.
Kernel developers, packagers, and operators can examine the index
contents to see what may get printed out to the kernel message buffer.
This can be useful for developers of message matchers or documentation
to detect changes from release to release, without requiring any kind of
coordination or commitment from the Kernel developer community.

So that detailed SCSI driver messages are captured by this printk index,
this patch wraps sdev_prefix_printk with a macro.

Signed-off-by: Jonathan Lassoff <jof@thejof.com>
---
 drivers/scsi/scsi_logging.c | 7 ++++---
 include/scsi/scsi_device.h  | 8 +++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c
index b02af340c2d3..a348d931472e 100644
--- a/drivers/scsi/scsi_logging.c
+++ b/drivers/scsi/scsi_logging.c
@@ -53,7 +53,8 @@ static size_t sdev_format_header(char *logbuf, size_t logbuf_len,
 	return off;
 }
 
-void sdev_prefix_printk(const char *level, const struct scsi_device *sdev,
+
+void _sdev_prefix_printk(const char *level, const struct scsi_device *sdev,
 			const char *name, const char *fmt, ...)
 {
 	va_list args;
@@ -75,10 +76,10 @@ void sdev_prefix_printk(const char *level, const struct scsi_device *sdev,
 		off += vscnprintf(logbuf + off, logbuf_len - off, fmt, args);
 		va_end(args);
 	}
-	dev_printk(level, &sdev->sdev_gendev, "%s", logbuf);
+	_dev_printk(level, &sdev->sdev_gendev, "%s", logbuf);
 	scsi_log_release_buffer(logbuf);
 }
-EXPORT_SYMBOL(sdev_prefix_printk);
+EXPORT_SYMBOL(_sdev_prefix_printk);
 
 void scmd_printk(const char *level, const struct scsi_cmnd *scmd,
 		const char *fmt, ...)
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 57e3e239a1fc..f9dcbd8dc51e 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -263,9 +263,15 @@ struct scsi_device {
  * as a string pointer
  */
 __printf(4, 5) void
-sdev_prefix_printk(const char *, const struct scsi_device *, const char *,
+_sdev_prefix_printk(const char *, const struct scsi_device *, const char *,
 		const char *, ...);
 
+#define sdev_prefix_printk(level, sdev, name, fmt, ...)             \
+({                                                                  \
+		printk_index_subsys_emit("%s %s: [%s] ", level, fmt);       \
+		_sdev_prefix_printk(level, sdev, name, fmt, ##__VA_ARGS__); \
+})
+
 #define sdev_printk(l, sdev, fmt, a...)				\
 	sdev_prefix_printk(l, sdev, NULL, fmt, ##a)
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-13 22:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 21:47 [PATCH 0/1] Rebase: Add printk indexing to scsi drivers Jonathan Lassoff
2022-04-13 21:47 ` [PATCH 1/1] " Jonathan Lassoff
2022-04-13 22:02 [PATCH 0/1] Rebase: " Jonathan Lassoff
2022-04-13 22:02 ` [PATCH 1/1] " Jonathan Lassoff

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.