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
This commit is contained in:
John Baldwin 2022-08-29 15:35:42 -07:00
parent 7afe342dcb
commit 62806a7f31

View File

@ -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);
}