Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Nov 2022 01:24:27 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 597a39a77132 - stable/13 - bhyve virtio-scsi: Tidy warning and debug prints.
Message-ID:  <202211110124.2AB1ORTn027159@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

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

commit 597a39a771325235863b1319479b0eb403bf9a26
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-08-29 22:35:42 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-11-11 01:10:10 +0000

    bhyve virtio-scsi: Tidy warning and debug prints.
    
    Use a consistent prefix ("virtio-scsi: ") similar to the e1000 device
    model.
    
    Reviewed by:    mav, emaste
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D36270
    
    (cherry picked from commit 62806a7f31e3b4813c4e6b70534c41f91bfe4e12)
---
 usr.sbin/bhyve/pci_virtio_scsi.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c
index a1cf6e246182..a960afd21317 100644
--- a/usr.sbin/bhyve/pci_virtio_scsi.c
+++ b/usr.sbin/bhyve/pci_virtio_scsi.c
@@ -88,8 +88,8 @@ __FBSDID("$FreeBSD$");
 #define	VIRTIO_SCSI_F_CHANGE	(1 << 2)
 
 static int pci_vtscsi_debug = 0;
-#define	DPRINTF(params) if (pci_vtscsi_debug) PRINTLN params
-#define	WPRINTF(params) PRINTLN params
+#define	WPRINTF(msg, params...) PRINTLN("virtio-scsi: " msg, ##params)
+#define	DPRINTF(msg, params...) if (pci_vtscsi_debug) WPRINTF(msg, ##params)
 
 struct pci_vtscsi_config {
 	uint32_t num_queues;
@@ -289,8 +289,7 @@ pci_vtscsi_proc(void *arg)
 		vq_endchains(q->vsq_vq, 0);
 		pthread_mutex_unlock(&q->vsq_qmtx);
 
-		DPRINTF(("virtio-scsi: request <idx=%d> completed",
-		    req->vsr_idx));
+		DPRINTF("request <idx=%d> completed", req->vsr_idx);
 		free(req);
 	}
 
@@ -305,7 +304,7 @@ pci_vtscsi_reset(void *vsc)
 
 	sc = vsc;
 
-	DPRINTF(("vtscsi: device reset requested"));
+	DPRINTF("device reset requested");
 	vi_reset_dev(&sc->vss_vs);
 
 	/* initialize config structure */
@@ -434,13 +433,13 @@ pci_vtscsi_tmf_handle(struct pci_vtscsi_softc *sc,
 		struct sbuf *sb = sbuf_new_auto();
 		ctl_io_sbuf(io, sb);
 		sbuf_finish(sb);
-		DPRINTF(("pci_virtio_scsi: %s", sbuf_data(sb)));
+		DPRINTF("%s", sbuf_data(sb));
 		sbuf_delete(sb);
 	}
 
 	err = ioctl(sc->vss_ctl_fd, CTL_IO, io);
 	if (err != 0)
-		WPRINTF(("CTL_IO: err=%d (%s)", errno, strerror(errno)));
+		WPRINTF("CTL_IO: err=%d (%s)", errno, strerror(errno));
 
 	tmf->response = io->taskio.task_status;
 	ctl_scsi_free_io(io);
@@ -527,13 +526,13 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, struct iovec *iov_in,
 		struct sbuf *sb = sbuf_new_auto();
 		ctl_io_sbuf(io, sb);
 		sbuf_finish(sb);
-		DPRINTF(("pci_virtio_scsi: %s", sbuf_data(sb)));
+		DPRINTF("%s", sbuf_data(sb));
 		sbuf_delete(sb);
 	}
 
 	err = ioctl(sc->vss_ctl_fd, CTL_IO, io);
 	if (err != 0) {
-		WPRINTF(("CTL_IO: err=%d (%s)", errno, strerror(errno)));
+		WPRINTF("CTL_IO: err=%d (%s)", errno, strerror(errno));
 		cmd_wr->response = VIRTIO_SCSI_S_FAILURE;
 	} else {
 		cmd_wr->sense_len = MIN(io->scsiio.sense_len,
@@ -622,8 +621,7 @@ pci_vtscsi_requestq_notify(void *vsc, struct vqueue_info *vq)
 		pthread_cond_signal(&q->vsq_cv);
 		pthread_mutex_unlock(&q->vsq_mtx);
 
-		DPRINTF(("virtio-scsi: request <idx=%d> enqueued",
-		    vireq.idx));
+		DPRINTF("request <idx=%d> enqueued", vireq.idx);
 	}
 }
 
@@ -695,7 +693,7 @@ pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl)
 		devname = "/dev/cam/ctl";
 	sc->vss_ctl_fd = open(devname, O_RDWR);
 	if (sc->vss_ctl_fd < 0) {
-		WPRINTF(("cannot open %s: %s", devname, strerror(errno)));
+		WPRINTF("cannot open %s: %s", devname, strerror(errno));
 		free(sc);
 		return (1);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202211110124.2AB1ORTn027159>