git: 0be27bde5f67 - main - cam/nvme: Remove spurious newline during periph detach announcement
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Aug 2023 22:26:06 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0be27bde5f673fc89643ea460b9cb94fc3316dd1 commit 0be27bde5f673fc89643ea460b9cb94fc3316dd1 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-08-01 22:19:50 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-08-01 22:19:50 +0000 cam/nvme: Remove spurious newline during periph detach announcement Other protocol denounce routines use a "short" variant of announce that does not include a trailing newline. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D41176 --- sys/cam/nvme/nvme_all.c | 9 ++++++++- sys/cam/nvme/nvme_all.h | 2 ++ sys/cam/nvme/nvme_xpt.c | 7 ++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/cam/nvme/nvme_all.c b/sys/cam/nvme/nvme_all.c index 0ab37b861ca2..5350dbd1bcdb 100644 --- a/sys/cam/nvme/nvme_all.c +++ b/sys/cam/nvme/nvme_all.c @@ -89,7 +89,14 @@ void nvme_print_ident(const struct nvme_controller_data *cdata, const struct nvme_namespace_data *data, struct sbuf *sb) { + nvme_print_ident_short(cdata, data, sb); + sbuf_printf(sb, "\n"); +} +void +nvme_print_ident_short(const struct nvme_controller_data *cdata, + const struct nvme_namespace_data *data, struct sbuf *sb) +{ sbuf_printf(sb, "<"); cam_strvis_sbuf(sb, cdata->mn, sizeof(cdata->mn), CAM_STRVIS_FLAG_NONASCII_SPC); @@ -99,7 +106,7 @@ nvme_print_ident(const struct nvme_controller_data *cdata, sbuf_printf(sb, " "); cam_strvis_sbuf(sb, cdata->sn, sizeof(cdata->sn), CAM_STRVIS_FLAG_NONASCII_SPC); - sbuf_printf(sb, ">\n"); + sbuf_printf(sb, ">"); } /* XXX need to do nvme admin opcodes too, but those aren't used yet by nda */ diff --git a/sys/cam/nvme/nvme_all.h b/sys/cam/nvme/nvme_all.h index ef932fd8efc3..9bdbeb219a90 100644 --- a/sys/cam/nvme/nvme_all.h +++ b/sys/cam/nvme/nvme_all.h @@ -42,6 +42,8 @@ int nvme_identify_match(caddr_t identbuffer, caddr_t table_entry); struct sbuf; void nvme_print_ident(const struct nvme_controller_data *, const struct nvme_namespace_data *, struct sbuf *); +void nvme_print_ident_short(const struct nvme_controller_data *, + const struct nvme_namespace_data *, struct sbuf *); const char *nvme_op_string(const struct nvme_command *, int admin); const char *nvme_cmd_string(const struct nvme_command *, char *, size_t); void nvme_cmd_sbuf(const struct nvme_command *, struct sbuf *sb); diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c index 3222ec1e9dc3..0662f476536c 100644 --- a/sys/cam/nvme/nvme_xpt.c +++ b/sys/cam/nvme/nvme_xpt.c @@ -838,8 +838,13 @@ nvme_proto_announce(struct cam_ed *device) static void nvme_proto_denounce(struct cam_ed *device) { + struct sbuf sb; + char buffer[120]; - nvme_proto_announce(device); + sbuf_new(&sb, buffer, sizeof(buffer), SBUF_FIXEDLEN); + nvme_print_ident_short(device->nvme_cdata, device->nvme_data, &sb); + sbuf_finish(&sb); + sbuf_putbuf(&sb); } static void