git: 76b2e3907ced - main - cam xpt_*nounce_periph*: Various fixes for periphs without a protocol
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Aug 2023 22:26:07 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=76b2e3907cede6456897d2f950911d45ae627d8b
commit 76b2e3907cede6456897d2f950911d45ae627d8b
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-08-01 22:20:25 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-08-01 22:20:25 +0000
cam xpt_*nounce_periph*: Various fixes for periphs without a protocol
If the periph doesn't have a valid protocol, these routines emit
fallback messages. However, the fallback messages duplicated the
periph name and unit number, and in the case of *denounce* included a
spurious newline.
Reviewed by: mav, imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41177
---
sys/cam/cam_xpt.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index b85da5f30a3b..61d24c120841 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -1067,9 +1067,7 @@ xpt_announce_periph(struct cam_periph *periph, char *announce_string)
if (proto)
proto->ops->announce(path->device);
else
- printf("%s%d: Unknown protocol device %d\n",
- periph->periph_name, periph->unit_number,
- path->device->protocol);
+ printf("Unknown protocol device %d\n", path->device->protocol);
if (path->device->serial_num_len > 0) {
/* Don't wrap the screen - print only the first 60 chars */
printf("%s%d: Serial Number %.60s\n", periph->periph_name,
@@ -1124,8 +1122,7 @@ xpt_announce_periph_sbuf(struct cam_periph *periph, struct sbuf *sb,
if (proto)
proto->ops->announce_sbuf(path->device, sb);
else
- sbuf_printf(sb, "%s%d: Unknown protocol device %d\n",
- periph->periph_name, periph->unit_number,
+ sbuf_printf(sb, "Unknown protocol device %d\n",
path->device->protocol);
if (path->device->serial_num_len > 0) {
/* Don't wrap the screen - print only the first 60 chars */
@@ -1191,9 +1188,7 @@ xpt_denounce_periph(struct cam_periph *periph)
if (proto)
proto->ops->denounce(path->device);
else
- printf("%s%d: Unknown protocol device %d\n",
- periph->periph_name, periph->unit_number,
- path->device->protocol);
+ printf("Unknown protocol device %d", path->device->protocol);
if (path->device->serial_num_len > 0)
printf(" s/n %.60s", path->device->serial_num);
printf(" detached\n");
@@ -1231,8 +1226,7 @@ xpt_denounce_periph_sbuf(struct cam_periph *periph, struct sbuf *sb)
if (proto)
proto->ops->denounce_sbuf(path->device, sb);
else
- sbuf_printf(sb, "%s%d: Unknown protocol device %d\n",
- periph->periph_name, periph->unit_number,
+ sbuf_printf(sb, "Unknown protocol device %d",
path->device->protocol);
if (path->device->serial_num_len > 0)
sbuf_printf(sb, " s/n %.60s", path->device->serial_num);