git: 62806a7f31e3 - main - bhyve virtio-scsi: Tidy warning and debug prints.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Aug 2022 22:37:54 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=62806a7f31e3b4813c4e6b70534c41f91bfe4e12
commit 62806a7f31e3b4813c4e6b70534c41f91bfe4e12
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-08-29 22:35:42 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-08-29 22:37:15 +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
---
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 6f7dceb05d92..6d867e7e3b56 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);
}