git: 950162c4d33a - stable/14 - ctl: Use ctl_io_sbuf in ctl_process_done

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 02 Jan 2024 20:52:37 UTC
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=950162c4d33ab033fe084e152203c2ec149e2b39

commit 950162c4d33ab033fe084e152203c2ec149e2b39
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-10-16 22:47:09 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-02 19:20:37 +0000

    ctl: Use ctl_io_sbuf in ctl_process_done
    
    This reduces a second copy of (mostly) the same code.
    
    Reviewed by:    ken, imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D42210
    
    (cherry picked from commit e846a3e0168f9188a6eccedd52707c63fd83cba2)
---
 sys/cam/ctl/ctl.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index 6faecb0da0a4..a315c5ef7df3 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -13035,25 +13035,7 @@ ctl_process_done(union ctl_io *io)
 		ctl_scsi_path_string(io, path_str, sizeof(path_str));
 		sbuf_new(&sb, str, sizeof(str), SBUF_FIXEDLEN);
 
-		sbuf_cat(&sb, path_str);
-		switch (io->io_hdr.io_type) {
-		case CTL_IO_SCSI:
-			ctl_scsi_command_string(&io->scsiio, NULL, &sb);
-			sbuf_printf(&sb, "\n");
-			sbuf_cat(&sb, path_str);
-			sbuf_printf(&sb, "Tag: 0x%jx/%d, Prio: %d\n",
-				    io->scsiio.tag_num, io->scsiio.tag_type,
-				    io->scsiio.priority);
-			break;
-		case CTL_IO_TASK:
-			sbuf_printf(&sb, "Task Action: %d Tag: 0x%jx/%d\n",
-				    io->taskio.task_action,
-				    io->taskio.tag_num, io->taskio.tag_type);
-			break;
-		default:
-			panic("%s: Invalid CTL I/O type %d\n",
-			    __func__, io->io_hdr.io_type);
-		}
+		ctl_io_sbuf(io, &sb);
 		sbuf_cat(&sb, path_str);
 		sbuf_printf(&sb, "ctl_process_done: %jd seconds\n",
 			    (intmax_t)time_uptime - io->io_hdr.start_time);