git: f5cebe73940c - main - cam/xpt: Put all messages on one line

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 04 Feb 2025 18:31:49 UTC
The branch main has been updated by imp:

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

commit f5cebe73940cb77df71438fd0aa4876af881a7d6
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-02-04 17:01:06 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-02-04 18:29:38 +0000

    cam/xpt: Put all messages on one line
    
    Make all error messages from *xpt.c be greppable by putting them on one
    line, "outdenting" where necessary to keep things under about 90
    columns. More of cam could use this treatment, but not finding a message
    in xpt is what prompted this round.
    
    Sponsored by:           Netflix
---
 sys/cam/ata/ata_xpt.c   | 39 +++++++++++++++++------------------
 sys/cam/cam_iosched.c   |  7 +++----
 sys/cam/cam_xpt.c       | 40 +++++++++++++++++------------------
 sys/cam/mmc/mmc_xpt.c   | 17 ++++++++-------
 sys/cam/nvme/nvme_xpt.c | 12 +++++------
 sys/cam/scsi/scsi_xpt.c | 55 ++++++++++++++++++++++++-------------------------
 6 files changed, 83 insertions(+), 87 deletions(-)

diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c
index 7bdddc98511b..61cffeda6f0c 100644
--- a/sys/cam/ata/ata_xpt.c
+++ b/sys/cam/ata/ata_xpt.c
@@ -266,16 +266,16 @@ aproberegister(struct cam_periph *periph, void *arg)
 
 	request_ccb = (union ccb *)arg;
 	if (request_ccb == NULL) {
-		printf("proberegister: no probe CCB, "
-		       "can't register device\n");
+		printf(
+		    "proberegister: no probe CCB, can't register device\n");
 		return(CAM_REQ_CMP_ERR);
 	}
 
 	softc = (aprobe_softc *)malloc(sizeof(*softc), M_CAMXPT, M_ZERO | M_NOWAIT);
 
 	if (softc == NULL) {
-		printf("proberegister: Unable to probe new device. "
-		       "Unable to allocate softc\n");
+		printf(
+	"proberegister: Unable to probe new device. Unable to allocate softc\n");
 		return(CAM_REQ_CMP_ERR);
 	}
 	TAILQ_INIT(&softc->request_ccbs);
@@ -1509,8 +1509,8 @@ scan_next:
 		if (status != CAM_REQ_CMP) {
 			if (request_ccb->ccb_h.func_code == XPT_SCAN_LUN)
 				mtx_unlock(mtx);
-			printf("xpt_scan_bus: xpt_create_path failed"
-			    " with status %#x, bus scan halted\n",
+			printf(
+	"xpt_scan_bus: xpt_create_path failed with status %#x, bus scan halted\n",
 			    status);
 			xpt_free_ccb(work_ccb);
 			xpt_free_ccb((union ccb *)scan_info->cpi);
@@ -1563,8 +1563,8 @@ ata_scan_lun(struct cam_periph *periph, struct cam_path *path,
 	if (request_ccb == NULL) {
 		request_ccb = xpt_alloc_ccb_nowait();
 		if (request_ccb == NULL) {
-			xpt_print(path, "xpt_scan_lun: can't allocate CCB, "
-			    "can't continue\n");
+			xpt_print(path,
+			    "xpt_scan_lun: can't allocate CCB, can't continue\n");
 			return;
 		}
 		status = xpt_create_path(&new_path, NULL,
@@ -1572,8 +1572,8 @@ ata_scan_lun(struct cam_periph *periph, struct cam_path *path,
 					  path->target->target_id,
 					  path->device->lun_id);
 		if (status != CAM_REQ_CMP) {
-			xpt_print(path, "xpt_scan_lun: can't create path, "
-			    "can't continue\n");
+			xpt_print(path,
+			    "xpt_scan_lun: can't create path, can't continue\n");
 			xpt_free_ccb(request_ccb);
 			return;
 		}
@@ -1607,8 +1607,8 @@ ata_scan_lun(struct cam_periph *periph, struct cam_path *path,
 					  request_ccb);
 
 		if (status != CAM_REQ_CMP) {
-			xpt_print(path, "xpt_scan_lun: cam_alloc_periph "
-			    "returned an error, can't continue probe\n");
+			xpt_print(path,
+	"xpt_scan_lun: cam_alloc_periph returned an error, can't continue probe\n");
 			request_ccb->ccb_h.status = status;
 			xpt_done(request_ccb);
 		}
@@ -1784,8 +1784,7 @@ ata_action(union ccb *start_ccb)
 
 	if (start_ccb->ccb_h.func_code != XPT_ATA_IO) {
 		KASSERT((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) == 0,
-		    ("%s: ccb %p, func_code %#x should not be allocated "
-		    "from UMA zone\n",
+		    ("%s: ccb %p, func_code %#x should not be allocated from UMA zone\n",
 		    __func__, start_ccb, start_ccb->ccb_h.func_code));
 	}
 
@@ -1925,9 +1924,9 @@ ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path,
 
 	if (cts->protocol_version > device->protocol_version) {
 		if (bootverbose) {
-			xpt_print(path, "Down reving Protocol "
-			    "Version from %d to %d?\n", cts->protocol_version,
-			    device->protocol_version);
+			xpt_print(path,
+			    "Down reving Protocol Version from %d to %d?\n",
+			    cts->protocol_version, device->protocol_version);
 		}
 		cts->protocol_version = device->protocol_version;
 	}
@@ -1950,9 +1949,9 @@ ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path,
 
 	if (cts->transport_version > device->transport_version) {
 		if (bootverbose) {
-			xpt_print(path, "Down reving Transport "
-			    "Version from %d to %d?\n", cts->transport_version,
-			    device->transport_version);
+			xpt_print(path,
+			    "Down reving Transport Version from %d to %d?\n",
+			    cts->transport_version, device->transport_version);
 		}
 		cts->transport_version = device->transport_version;
 	}
diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c
index 15e98b7cb39d..a7b7eb3cc4e9 100644
--- a/sys/cam/cam_iosched.c
+++ b/sys/cam/cam_iosched.c
@@ -1378,8 +1378,7 @@ cam_iosched_get_write(struct cam_iosched_softc *isc)
 	if (bioq_first(&isc->bio_queue) && isc->current_read_bias) {
 		if (iosched_debug)
 			printf(
-			    "Reads present and current_read_bias is %d queued "
-			    "writes %d queued reads %d\n",
+	"Reads present and current_read_bias is %d queued writes %d queued reads %d\n",
 			    isc->current_read_bias, isc->write_stats.queued,
 			    isc->read_stats.queued);
 		isc->current_read_bias--;
@@ -1487,8 +1486,8 @@ cam_iosched_get_trim(struct cam_iosched_softc *isc)
 	if (do_dynamic_iosched) {
 		if (bioq_first(&isc->bio_queue) && isc->current_read_bias) {
 			if (iosched_debug)
-				printf("Reads present and current_read_bias is %d"
-				    " queued trims %d queued reads %d\n",
+				printf(
+		"Reads present and current_read_bias is %d queued trims %d queued reads %d\n",
 				    isc->current_read_bias, isc->trim_stats.queued,
 				    isc->read_stats.queued);
 			isc->current_read_bias--;
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 68aa6faae9a3..8428125d5e99 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -723,10 +723,9 @@ xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *
 			 * kernel.
 			 */
 			if (base_periph_found) {
-				printf("xptioctl: pass driver is not in the "
-				       "kernel\n");
-				printf("xptioctl: put \"device pass\" in "
-				       "your kernel config file\n");
+				printf(
+		"xptioctl: pass driver is not in the kernel\n"
+		"xptioctl: put \"device pass\" in your kernel config file\n");
 			}
 		}
 		xpt_unlock_buses();
@@ -923,8 +922,9 @@ xpt_init(void *dummy)
 		return (ENOMEM);
 
 	if ((error = xpt_bus_register(xpt_sim, NULL, 0)) != CAM_SUCCESS) {
-		printf("xpt_init: xpt_bus_register failed with errno %d,"
-		       " failing attach\n", error);
+		printf(
+		    "xpt_init: xpt_bus_register failed with errno %d, failing attach\n",
+		    error);
 		return (EINVAL);
 	}
 
@@ -936,8 +936,9 @@ xpt_init(void *dummy)
 	if ((status = xpt_create_path(&path, NULL, CAM_XPT_PATH_ID,
 				      CAM_TARGET_WILDCARD,
 				      CAM_LUN_WILDCARD)) != CAM_REQ_CMP) {
-		printf("xpt_init: xpt_create_path failed with status %#x,"
-		       " failing attach\n", status);
+		printf(
+	"xpt_init: xpt_create_path failed with status %#x, failing attach\n",
+		    status);
 		return (EINVAL);
 	}
 	xpt_path_lock(path);
@@ -962,8 +963,7 @@ xpt_init(void *dummy)
 		}
 	}
 	if (cam_num_doneqs < 1) {
-		printf("xpt_init: Cannot init completion queues "
-		       "- failing attach\n");
+		printf("xpt_init: Cannot init completion queues - failing attach\n");
 		return (ENOMEM);
 	}
 
@@ -971,8 +971,7 @@ xpt_init(void *dummy)
 	STAILQ_INIT(&cam_async.cam_doneq);
 	if (kproc_kthread_add(xpt_async_td, &cam_async,
 		&cam_proc, NULL, 0, 0, "cam", "async") != 0) {
-		printf("xpt_init: Cannot init async thread "
-		       "- failing attach\n");
+		printf("xpt_init: Cannot init async thread - failing attach\n");
 		return (ENOMEM);
 	}
 
@@ -4060,12 +4059,11 @@ xptpathid(const char *sim_name, int sim_unit, int sim_bus)
 			pathid = dunit;
 			break;
 		} else {
-			printf("Ambiguous scbus configuration for %s%d "
-			       "bus %d, cannot wire down.  The kernel "
-			       "config entry for scbus%d should "
-			       "specify a controller bus.\n"
-			       "Scbus will be assigned dynamically.\n",
-			       sim_name, sim_unit, sim_bus, dunit);
+			printf(
+"Ambiguous scbus configuration for %s%d bus %d, cannot wire down.  The kernel\n"
+"config entry for scbus%d should specify a controller bus.\n"
+"Scbus will be assigned dynamically.\n",
+			    sim_name, sim_unit, sim_bus, dunit);
 			break;
 		}
 	}
@@ -5036,9 +5034,9 @@ xpt_config(void *arg)
 		if (xpt_create_path(&cam_dpath, NULL,
 				    CAM_DEBUG_BUS, CAM_DEBUG_TARGET,
 				    CAM_DEBUG_LUN) != CAM_REQ_CMP) {
-			printf("xpt_config: xpt_create_path() failed for debug"
-			       " target %d:%d:%d, debugging disabled\n",
-			       CAM_DEBUG_BUS, CAM_DEBUG_TARGET, CAM_DEBUG_LUN);
+			printf(
+"xpt_config: xpt_create_path() failed for debug target %d:%d:%d, debugging disabled\n",
+			    CAM_DEBUG_BUS, CAM_DEBUG_TARGET, CAM_DEBUG_LUN);
 			cam_dflags = CAM_DEBUG_NONE;
 		}
 	} else
diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c
index 0947e0addf59..b7f1e5bce868 100644
--- a/sys/cam/mmc/mmc_xpt.c
+++ b/sys/cam/mmc/mmc_xpt.c
@@ -283,8 +283,8 @@ mmc_scan_lun(struct cam_periph *periph, struct cam_path *path,
 					  path, NULL, 0,
 					  request_ccb);
                 if (status != CAM_REQ_CMP) {
-			xpt_print(path, "xpt_scan_lun: cam_alloc_periph "
-                                  "returned an error, can't continue probe\n");
+			xpt_print(path,
+	"xpt_scan_lun: cam_alloc_periph returned an error, can't continue probe\n");
 		}
 		request_ccb->ccb_h.status = status;
 		xpt_done(request_ccb);
@@ -516,16 +516,16 @@ mmcprobe_register(struct cam_periph *periph, void *arg)
 
 	request_ccb = (union ccb *)arg;
 	if (request_ccb == NULL) {
-		printf("mmcprobe_register: no probe CCB, "
-		       "can't register device\n");
+		printf(
+		    "mmcprobe_register: no probe CCB, can't register device\n");
 		return(CAM_REQ_CMP_ERR);
 	}
 
 	softc = (mmcprobe_softc *)malloc(sizeof(*softc), M_CAMXPT, M_NOWAIT);
 
 	if (softc == NULL) {
-		printf("proberegister: Unable to probe new device. "
-		       "Unable to allocate softc\n");
+		printf(
+	"proberegister: Unable to probe new device. Unable to allocate softc\n");
 		return(CAM_REQ_CMP_ERR);
 	}
 
@@ -539,8 +539,9 @@ mmcprobe_register(struct cam_periph *periph, void *arg)
 
         memset(&periph->path->device->mmc_ident_data, 0, sizeof(struct mmc_params));
 	if (status != 0) {
-		printf("proberegister: cam_periph_acquire failed (status=%d)\n",
-			status);
+		printf(
+		    "proberegister: cam_periph_acquire failed (status=%d)\n",
+		    status);
 		return (CAM_REQ_CMP_ERR);
 	}
 	CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, ("Probe started\n"));
diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c
index d2cb6ff11fd4..47c0bde1df37 100644
--- a/sys/cam/nvme/nvme_xpt.c
+++ b/sys/cam/nvme/nvme_xpt.c
@@ -204,16 +204,16 @@ nvme_probe_register(struct cam_periph *periph, void *arg)
 
 	request_ccb = (union ccb *)arg;
 	if (request_ccb == NULL) {
-		printf("nvme_probe_register: no probe CCB, "
-		       "can't register device\n");
+		printf(
+		    "nvme_probe_register: no probe CCB, can't register device\n");
 		return(CAM_REQ_CMP_ERR);
 	}
 
 	softc = (nvme_probe_softc *)malloc(sizeof(*softc), M_CAMXPT, M_ZERO | M_NOWAIT);
 
 	if (softc == NULL) {
-		printf("nvme_probe_register: Unable to probe new device. "
-		       "Unable to allocate softc\n");
+		printf(
+	"nvme_probe_register: Unable to probe new device. Unable to allocate softc\n");
 		return(CAM_REQ_CMP_ERR);
 	}
 	TAILQ_INIT(&softc->request_ccbs);
@@ -579,8 +579,8 @@ nvme_scan_lun(struct cam_periph *periph, struct cam_path *path,
 					  request_ccb);
 
 		if (status != CAM_REQ_CMP) {
-			xpt_print(path, "xpt_scan_lun: cam_alloc_periph "
-			    "returned an error, can't continue probe\n");
+			xpt_print(path,
+	"xpt_scan_lun: cam_alloc_periph returned an error, can't continue probe\n");
 			request_ccb->ccb_h.status = status;
 			xpt_done(request_ccb);
 		}
diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c
index 45aae4a50669..21cb6beaf1fb 100644
--- a/sys/cam/scsi/scsi_xpt.c
+++ b/sys/cam/scsi/scsi_xpt.c
@@ -646,16 +646,14 @@ proberegister(struct cam_periph *periph, void *arg)
 
 	request_ccb = (union ccb *)arg;
 	if (request_ccb == NULL) {
-		printf("proberegister: no probe CCB, "
-		       "can't register device\n");
+		printf("proberegister: no probe CCB, can't register device\n");
 		return(CAM_REQ_CMP_ERR);
 	}
 
 	softc = (probe_softc *)malloc(sizeof(*softc), M_CAMXPT, M_NOWAIT);
 
 	if (softc == NULL) {
-		printf("proberegister: Unable to probe new device. "
-		       "Unable to allocate softc\n");
+		printf("proberegister: Unable to probe new device. Unable to allocate softc\n");
 		return(CAM_REQ_CMP_ERR);
 	}
 	TAILQ_INIT(&softc->request_ccbs);
@@ -864,8 +862,8 @@ again:
 					/*timeout*/60000);
 			break;
 		}
-		xpt_print(periph->path, "Unable to mode sense control page - "
-		    "malloc failure\n");
+		xpt_print(periph->path,
+		    "Unable to mode sense control page - malloc failure\n");
 		PROBE_SET_ACTION(softc, PROBE_SUPPORTED_VPD_LIST);
 	}
 	/* FALLTHROUGH */
@@ -1000,8 +998,8 @@ done:
 		inquiry_len = roundup2(SID_ADDITIONAL_LENGTH(inq_buf), 2);
 		inq_buf = malloc(inquiry_len, M_CAMXPT, M_NOWAIT);
 		if (inq_buf == NULL) {
-			xpt_print(periph->path, "malloc failure- skipping Basic"
-			    "Domain Validation\n");
+			xpt_print(periph->path,
+			    "malloc failure- skipping Basic Domain Validation\n");
 			PROBE_SET_ACTION(softc, PROBE_DV_EXIT);
 			scsi_test_unit_ready(csio,
 					     /*retries*/4,
@@ -2035,9 +2033,9 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
 						 request_ccb->ccb_h.path_id,
 						 i, 0);
 			if (status != CAM_REQ_CMP) {
-				printf("scsi_scan_bus: xpt_create_path failed"
-				       " with status %#x, bus scan halted\n",
-				       status);
+				printf(
+		"scsi_scan_bus: xpt_create_path failed with status %#x, bus scan halted\n",
+				    status);
 				free(scan_info, M_CAMXPT);
 				request_ccb->ccb_h.status = status;
 				xpt_free_ccb(work_ccb);
@@ -2230,8 +2228,8 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
 			    scan_info->counter, 0);
 			if (status != CAM_REQ_CMP) {
 				mtx_unlock(mtx);
-				printf("scsi_scan_bus: xpt_create_path failed"
-				    " with status %#x, bus scan halted\n",
+				printf(
+		"scsi_scan_bus: xpt_create_path failed with status %#x, bus scan halted\n",
 			       	    status);
 				xpt_free_ccb(request_ccb);
 				xpt_free_ccb((union ccb *)scan_info->cpi);
@@ -2260,9 +2258,9 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
 			 */
 			xpt_free_path(oldpath);
 			if (status != CAM_REQ_CMP) {
-				printf("scsi_scan_bus: xpt_create_path failed "
-				       "with status %#x, halting LUN scan\n",
-			 	       status);
+				printf(
+		"scsi_scan_bus: xpt_create_path failed with status %#x, halting LUN scan\n",
+				    status);
 				goto hop_again;
 			}
 			xpt_setup_ccb(&request_ccb->ccb_h, path,
@@ -2323,8 +2321,8 @@ scsi_scan_lun(struct cam_periph *periph, struct cam_path *path,
 	if (request_ccb == NULL) {
 		request_ccb = xpt_alloc_ccb_nowait();
 		if (request_ccb == NULL) {
-			xpt_print(path, "scsi_scan_lun: can't allocate CCB, "
-			    "can't continue\n");
+			xpt_print(path,
+			    "scsi_scan_lun: can't allocate CCB, can't continue\n");
 			return;
 		}
 		status = xpt_create_path(&new_path, NULL,
@@ -2332,8 +2330,8 @@ scsi_scan_lun(struct cam_periph *periph, struct cam_path *path,
 					  path->target->target_id,
 					  path->device->lun_id);
 		if (status != CAM_REQ_CMP) {
-			xpt_print(path, "scsi_scan_lun: can't create path, "
-			    "can't continue\n");
+			xpt_print(path,
+			    "scsi_scan_lun: can't create path, can't continue\n");
 			xpt_free_ccb(request_ccb);
 			return;
 		}
@@ -2366,8 +2364,8 @@ scsi_scan_lun(struct cam_periph *periph, struct cam_path *path,
 					  request_ccb);
 
 		if (status != CAM_REQ_CMP) {
-			xpt_print(path, "scsi_scan_lun: cam_alloc_periph "
-			    "returned an error, can't continue probe\n");
+			xpt_print(path,
+	    "scsi_scan_lun: cam_alloc_periph returned an error, can't continue probe\n");
 			request_ccb->ccb_h.status = status;
 			xpt_done(request_ccb);
 		}
@@ -2619,8 +2617,7 @@ scsi_action(union ccb *start_ccb)
 
 	if (start_ccb->ccb_h.func_code != XPT_SCSI_IO) {
 		KASSERT((start_ccb->ccb_h.alloc_flags & CAM_CCB_FROM_UMA) == 0,
-		    ("%s: ccb %p, func_code %#x should not be allocated "
-		    "from UMA zone\n",
+		    ("%s: ccb %p, func_code %#x should not be allocated from UMA zone\n",
 		    __func__, start_ccb, start_ccb->ccb_h.func_code));
 	}
 
@@ -2687,8 +2684,9 @@ scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path
 
 	if (cts->protocol_version > device->protocol_version) {
 		if (bootverbose) {
-			xpt_print(path, "Down reving Protocol "
-			    "Version from %d to %d?\n", cts->protocol_version,
+			xpt_print(path,
+			    "Down reving Protocol Version from %d to %d?\n",
+			    cts->protocol_version,
 			    device->protocol_version);
 		}
 		cts->protocol_version = device->protocol_version;
@@ -2712,8 +2710,9 @@ scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path
 
 	if (cts->transport_version > device->transport_version) {
 		if (bootverbose) {
-			xpt_print(path, "Down reving Transport "
-			    "Version from %d to %d?\n", cts->transport_version,
+			xpt_print(path,
+			    "Down reving Transport Version from %d to %d?\n",
+			    cts->transport_version,
 			    device->transport_version);
 		}
 		cts->transport_version = device->transport_version;