git: ffbe54c2175c - stable/12 - bhyve virtio-scsi: Tidy warning and debug prints.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 11 Nov 2022 01:24:35 UTC
The branch stable/12 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ffbe54c2175cf55a39f9123867c5b2598c93a029 commit ffbe54c2175cf55a39f9123867c5b2598c93a029 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:13:13 +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 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index 0c2342134b3d..542098631f90 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -87,8 +87,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; @@ -288,8 +288,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); } @@ -304,7 +303,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 */ @@ -433,13 +432,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); @@ -526,13 +525,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, @@ -629,7 +628,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", idx)); + DPRINTF("request <idx=%d> enqueued", idx); } } @@ -694,7 +693,7 @@ pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) 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); }