dm:use acrn-dm logger function instread of fprintf

use acrn-dm logger function instread of fprintf,
this helps the stability testing log capture.

Tracked-On: #4098
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Cao Minggui <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
Mingqiang Chi
2019-11-13 14:20:36 +08:00
committed by wenlingz
parent 5375a1613b
commit a59205f6a2
24 changed files with 168 additions and 227 deletions

View File

@@ -159,7 +159,7 @@ is_pci_gvt(struct pci_vdev *dev)
static void
pci_parse_slot_usage(char *aopt)
{
fprintf(stderr, "Invalid PCI slot info field \"%s\"\n", aopt);
pr_err("Invalid PCI slot info field \"%s\"\n", aopt);
}
int
@@ -863,7 +863,7 @@ pci_emul_init(struct vmctx *ctx, struct pci_vdev_ops *ops, int bus, int slot,
pdi = calloc(1, sizeof(struct pci_vdev));
if (!pdi) {
fprintf(stderr, "%s: calloc returns NULL\n", __func__);
pr_err("%s: calloc returns NULL\n", __func__);
return -1;
}
@@ -2439,7 +2439,7 @@ pci_get_vdev_info(int slot)
if (si != NULL)
dev = si->si_funcs[0].fi_devi;
else
fprintf(stderr, "slot=%d is empty!\n", slot);
pr_err("slot=%d is empty!\n", slot);
return dev;
}

View File

@@ -145,8 +145,7 @@ gvt_init_config(struct pci_gvt *gvt)
ret = pci_emul_alloc_bar(gvt->gvt_pi, 0, PCIBAR_MEM32,
16 * 1024 * 1024);
if (ret != 0) {
fprintf(stderr,
"allocate gvt pci bar[0] failed\n");
pr_err("allocate gvt pci bar[0] failed\n");
return -1;
}
@@ -179,16 +178,14 @@ gvt_init_config(struct pci_gvt *gvt)
ret = pci_emul_alloc_bar(gvt->gvt_pi, 2, PCIBAR_MEM32,
aperture_size * 1024 * 1024);
if (ret != 0) {
fprintf(stderr,
"allocate gvt pci bar[2] failed\n");
pr_err("allocate gvt pci bar[2] failed\n");
return -1;
}
/* same as host, lagecy vga usage */
ret = pci_emul_alloc_bar(gvt->gvt_pi, 4, PCIBAR_IO, 64);
if (ret != 0) {
fprintf(stderr,
"allocate gvt pci bar[4] failed\n");
pr_err("allocate gvt pci bar[4] failed\n");
return -1;
}

View File

@@ -202,7 +202,7 @@ lpc_init(struct vmctx *ctx)
if (uart_legacy_alloc(unit,
&lpc_uart->iobase,
&lpc_uart->irq) != 0) {
fprintf(stderr, "Unable to allocate resources for "
pr_err("Unable to allocate resources for "
"LPC device %s\n", name);
goto init_failed;
}
@@ -401,7 +401,7 @@ pci_lpc_init(struct vmctx *ctx, struct pci_vdev *pi, char *opts)
* Do not allow more than one LPC bridge to be configured.
*/
if (lpc_bridge != NULL) {
fprintf(stderr, "Only one LPC bridge is allowed.\n");
pr_err("Only one LPC bridge is allowed.\n");
return -1;
}
@@ -411,7 +411,7 @@ pci_lpc_init(struct vmctx *ctx, struct pci_vdev *pi, char *opts)
* all legacy i/o ports behind bus 0.
*/
if (pi->bus != 0) {
fprintf(stderr, "LPC bridge can be present only on bus 0.\n");
pr_err("LPC bridge can be present only on bus 0.\n");
return -1;
}

View File

@@ -88,7 +88,7 @@ pci_uart_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
dev->arg = uart_set_backend(pci_uart_intr_assert, pci_uart_intr_deassert, dev, opts);
if (dev->arg == NULL) {
fprintf(stderr, "Unable to initialize backend '%s' for "
pr_err("Unable to initialize backend '%s' for "
"pci uart at %d:%d\n", opts, dev->slot, dev->func);
return -1;
}

View File

@@ -64,7 +64,7 @@ virtio_start_timer(struct acrn_timer *timer, time_t sec, time_t nsec)
ts.it_value.tv_sec = sec;
ts.it_value.tv_nsec = nsec;
if (acrn_timer_settime(timer, &ts) != 0) {
fprintf(stderr, "acrn timer set time failed\n");
pr_err("acrn timer set time failed\n");
return;
}
}
@@ -98,8 +98,7 @@ virtio_poll_timer(void *arg, uint64_t nexp)
else if (vops->qnotify)
(*vops->qnotify)(DEV_STRUCT(base), vq);
else
fprintf(stderr,
"%s: qnotify queue %d: missing vq/vops notify\r\n",
pr_err("%s: qnotify queue %d: missing vq/vops notify\r\n",
name, i);
}
@@ -131,8 +130,7 @@ virtio_linkup(struct virtio_base *base, struct virtio_ops *vops,
/* base and pci_virtio_dev addresses must match */
if ((void *)base != pci_virtio_dev) {
fprintf(stderr,
"virtio_base and pci_virtio_dev addresses don't match!\n");
pr_err("virtio_base and pci_virtio_dev addresses don't match!\n");
return;
}
base->vops = vops;
@@ -461,8 +459,7 @@ vq_getchain(struct virtio_vq_info *vq, uint16_t *pidx,
return 0;
if (ndesc > vq->qsize) {
/* XXX need better way to diagnose issues */
fprintf(stderr,
"%s: ndesc (%u) out of range, driver confused?\r\n",
pr_err("%s: ndesc (%u) out of range, driver confused?\r\n",
name, (u_int)ndesc);
return -1;
}
@@ -480,8 +477,7 @@ vq_getchain(struct virtio_vq_info *vq, uint16_t *pidx,
vq->last_avail++;
for (i = 0; i < VQ_MAX_DESCRIPTORS; next = vdir->next) {
if (next >= vq->qsize) {
fprintf(stderr,
"%s: descriptor index %u out of range, "
pr_err("%s: descriptor index %u out of range, "
"driver confused?\r\n",
name, next);
return -1;
@@ -492,16 +488,14 @@ vq_getchain(struct virtio_vq_info *vq, uint16_t *pidx,
i++;
} else if ((base->device_caps &
(1 << VIRTIO_RING_F_INDIRECT_DESC)) == 0) {
fprintf(stderr,
"%s: descriptor has forbidden INDIRECT flag, "
pr_err("%s: descriptor has forbidden INDIRECT flag, "
"driver confused?\r\n",
name);
return -1;
} else {
n_indir = vdir->len / 16;
if ((vdir->len & 0xf) || n_indir == 0) {
fprintf(stderr,
"%s: invalid indir len 0x%x, "
pr_err("%s: invalid indir len 0x%x, "
"driver confused?\r\n",
name, (u_int)vdir->len);
return -1;
@@ -519,8 +513,7 @@ vq_getchain(struct virtio_vq_info *vq, uint16_t *pidx,
for (;;) {
vp = &vindir[next];
if (vp->flags & VRING_DESC_F_INDIRECT) {
fprintf(stderr,
"%s: indirect desc has INDIR flag,"
pr_err("%s: indirect desc has INDIR flag,"
" driver confused?\r\n",
name);
return -1;
@@ -532,8 +525,7 @@ vq_getchain(struct virtio_vq_info *vq, uint16_t *pidx,
break;
next = vp->next;
if (next >= n_indir) {
fprintf(stderr,
"%s: invalid next %u > %u, "
pr_err("%s: invalid next %u > %u, "
"driver confused?\r\n",
name, (u_int)next, n_indir);
return -1;
@@ -544,8 +536,7 @@ vq_getchain(struct virtio_vq_info *vq, uint16_t *pidx,
return i;
}
loopy:
fprintf(stderr,
"%s: descriptor loop? count > %d - driver confused?\r\n",
pr_err("%s: descriptor loop? count > %d - driver confused?\r\n",
name, i);
return -1;
}
@@ -811,12 +802,10 @@ bad:
if (cr == NULL || cr->size != size) {
if (cr != NULL) {
/* offset must be OK, so size must be bad */
fprintf(stderr,
"%s: read from %s: bad size %d\r\n",
pr_err("%s: read from %s: bad size %d\r\n",
name, cr->name, size);
} else {
fprintf(stderr,
"%s: read from bad offset/size %jd/%d\r\n",
pr_err("%s: read from bad offset/size %jd/%d\r\n",
name, (uintmax_t)offset, size);
}
goto done;
@@ -922,16 +911,13 @@ bad:
if (cr != NULL) {
/* offset must be OK, wrong size and/or reg is R/O */
if (cr->size != size)
fprintf(stderr,
"%s: write to %s: bad size %d\r\n",
pr_err("%s: write to %s: bad size %d\r\n",
name, cr->name, size);
if (cr->ro)
fprintf(stderr,
"%s: write to read-only reg %s\r\n",
pr_err("%s: write to read-only reg %s\r\n",
name, cr->name);
} else {
fprintf(stderr,
"%s: write to bad offset/size %jd/%d\r\n",
pr_err("%s: write to bad offset/size %jd/%d\r\n",
name, (uintmax_t)offset, size);
}
goto done;
@@ -959,7 +945,7 @@ bad:
break;
case VIRTIO_PCI_QUEUE_NOTIFY:
if (value >= vops->nvq) {
fprintf(stderr, "%s: queue %d notify out of range\r\n",
pr_err("%s: queue %d notify out of range\r\n",
name, (int)value);
goto done;
}
@@ -969,8 +955,7 @@ bad:
else if (vops->qnotify)
(*vops->qnotify)(DEV_STRUCT(base), vq);
else
fprintf(stderr,
"%s: qnotify queue %d: missing vq/vops notify\r\n",
pr_err("%s: qnotify queue %d: missing vq/vops notify\r\n",
name, (int)value);
break;
case VIRTIO_PCI_STATUS:
@@ -1004,8 +989,7 @@ bad:
goto done;
bad_qindex:
fprintf(stderr,
"%s: write config reg %s: curq %d >= max %d\r\n",
pr_err("%s: write config reg %s: curq %d >= max %d\r\n",
name, cr->name, base->curq, vops->nvq);
done:
if (base->mtx)
@@ -1065,8 +1049,7 @@ virtio_set_modern_mmio_bar(struct virtio_base *base, int barnum)
vops = base->vops;
if (vops->cfgsize > VIRTIO_CAP_DEVICE_SIZE) {
fprintf(stderr,
"%s: cfgsize %lu > max %d\r\n",
pr_err("%s: cfgsize %lu > max %d\r\n",
vops->name, vops->cfgsize, VIRTIO_CAP_DEVICE_SIZE);
return -1;
}
@@ -1077,8 +1060,7 @@ virtio_set_modern_mmio_bar(struct virtio_base *base, int barnum)
cap.length = VIRTIO_CAP_COMMON_SIZE;
rc = pci_emul_add_capability(base->dev, (u_char *)&cap, sizeof(cap));
if (rc != 0) {
fprintf(stderr,
"pci emulation add common configuration capability failed\n");
pr_err("pci emulation add common configuration capability failed\n");
return -1;
}
@@ -1088,8 +1070,7 @@ virtio_set_modern_mmio_bar(struct virtio_base *base, int barnum)
cap.length = VIRTIO_CAP_ISR_SIZE;
rc = pci_emul_add_capability(base->dev, (u_char *)&cap, sizeof(cap));
if (rc != 0) {
fprintf(stderr,
"pci emulation add isr status capability failed\n");
pr_err("pci emulation add isr status capability failed\n");
return -1;
}
@@ -1099,8 +1080,7 @@ virtio_set_modern_mmio_bar(struct virtio_base *base, int barnum)
cap.length = VIRTIO_CAP_DEVICE_SIZE;
rc = pci_emul_add_capability(base->dev, (u_char *)&cap, sizeof(cap));
if (rc != 0) {
fprintf(stderr,
"pci emulation add device specific configuration capability failed\n");
pr_err("pci emulation add device specific configuration capability failed\n");
return -1;
}
@@ -1108,16 +1088,14 @@ virtio_set_modern_mmio_bar(struct virtio_base *base, int barnum)
rc = pci_emul_add_capability(base->dev, (u_char *)&notify,
sizeof(notify));
if (rc != 0) {
fprintf(stderr,
"pci emulation add notification capability failed\n");
pr_err("pci emulation add notification capability failed\n");
return -1;
}
/* pci alternative configuration access capability */
rc = pci_emul_add_capability(base->dev, (u_char *)&cfg, sizeof(cfg));
if (rc != 0) {
fprintf(stderr,
"pci emulation add alternative configuration access capability failed\n");
pr_err("pci emulation add alternative configuration access capability failed\n");
return -1;
}
@@ -1125,15 +1103,13 @@ virtio_set_modern_mmio_bar(struct virtio_base *base, int barnum)
rc = pci_emul_alloc_bar(base->dev, barnum, PCIBAR_MEM64,
VIRTIO_MODERN_MEM_BAR_SIZE);
if (rc != 0) {
fprintf(stderr,
"allocate and register modern memory bar failed\n");
pr_err("allocate and register modern memory bar failed\n");
return -1;
}
base->cfg_coff = virtio_find_capability(base, VIRTIO_PCI_CAP_PCI_CFG);
if (base->cfg_coff < 0) {
fprintf(stderr,
"%s: VIRTIO_PCI_CAP_PCI_CFG not found\r\n",
pr_err("%s: VIRTIO_PCI_CAP_PCI_CFG not found\r\n",
vops->name);
return -1;
}
@@ -1164,16 +1140,14 @@ virtio_set_modern_pio_bar(struct virtio_base *base, int barnum)
rc = pci_emul_add_capability(base->dev, (u_char *)&notify_pio,
sizeof(notify_pio));
if (rc != 0) {
fprintf(stderr,
"pci emulation add notification capability for virtio modern PIO BAR failed\n");
pr_err("pci emulation add notification capability for virtio modern PIO BAR failed\n");
return -1;
}
/* allocate and register modern pio bar */
rc = pci_emul_alloc_bar(base->dev, barnum, PCIBAR_IO, 4);
if (rc != 0) {
fprintf(stderr,
"allocate and register modern pio bar failed\n");
pr_err("allocate and register modern pio bar failed\n");
return -1;
}
@@ -1261,12 +1235,10 @@ virtio_common_cfg_read(struct pci_vdev *dev, uint64_t offset, int size)
if (cr == NULL || cr->size != size) {
if (cr != NULL) {
/* offset must be OK, so size must be bad */
fprintf(stderr,
"%s: read from %s: bad size %d\r\n",
pr_err("%s: read from %s: bad size %d\r\n",
name, cr->name, size);
} else {
fprintf(stderr,
"%s: read from bad offset/size %jd/%d\r\n",
pr_err("%s: read from bad offset/size %jd/%d\r\n",
name, (uintmax_t)offset, size);
}
@@ -1378,16 +1350,13 @@ virtio_common_cfg_write(struct pci_vdev *dev, uint64_t offset, int size,
if (cr != NULL) {
/* offset must be OK, wrong size and/or reg is R/O */
if (cr->size != size)
fprintf(stderr,
"%s: write to %s: bad size %d\r\n",
pr_err("%s: write to %s: bad size %d\r\n",
name, cr->name, size);
if (cr->ro)
fprintf(stderr,
"%s: write to read-only reg %s\r\n",
pr_err("%s: write to read-only reg %s\r\n",
name, cr->name);
} else {
fprintf(stderr,
"%s: write to bad offset/size %jd/%d\r\n",
pr_err("%s: write to bad offset/size %jd/%d\r\n",
name, (uintmax_t)offset, size);
}
@@ -1491,8 +1460,7 @@ virtio_common_cfg_write(struct pci_vdev *dev, uint64_t offset, int size,
return;
bad_qindex:
fprintf(stderr,
"%s: write config reg %s: curq %d >= max %d\r\n",
pr_err("%s: write config reg %s: curq %d >= max %d\r\n",
name, cr->name, base->curq, vops->nvq);
}
@@ -1527,16 +1495,14 @@ virtio_device_cfg_read(struct pci_vdev *dev, uint64_t offset, int size)
max = vops->cfgsize ? vops->cfgsize : 0x100000000;
if (offset + size > max) {
fprintf(stderr,
"%s: reading from 0x%lx size %d exceeds limit\r\n",
pr_err("%s: reading from 0x%lx size %d exceeds limit\r\n",
name, offset, size);
return value;
}
error = (*vops->cfgread)(DEV_STRUCT(base), offset, size, &value);
if (error) {
fprintf(stderr,
"%s: reading from 0x%lx size %d failed %d\r\n",
pr_err("%s: reading from 0x%lx size %d failed %d\r\n",
name, offset, size, error);
value = size == 1 ? 0xff : size == 2 ? 0xffff : 0xffffffff;
}
@@ -1559,16 +1525,14 @@ virtio_device_cfg_write(struct pci_vdev *dev, uint64_t offset, int size,
max = vops->cfgsize ? vops->cfgsize : 0x100000000;
if (offset + size > max) {
fprintf(stderr,
"%s: writing to 0x%lx size %d exceeds limit\r\n",
pr_err("%s: writing to 0x%lx size %d exceeds limit\r\n",
name, offset, size);
return;
}
error = (*vops->cfgwrite)(DEV_STRUCT(base), offset, size, value);
if (error)
fprintf(stderr,
"%s: writing ot 0x%lx size %d failed %d\r\n",
pr_err("%s: writing ot 0x%lx size %d failed %d\r\n",
name, offset, size, error);
}
@@ -1591,8 +1555,7 @@ virtio_notify_cfg_write(struct pci_vdev *dev, uint64_t offset, int size,
name = vops->name;
if (idx >= vops->nvq) {
fprintf(stderr,
"%s: queue %lu notify out of range\r\n", name, idx);
pr_err("%s: queue %lu notify out of range\r\n", name, idx);
return;
}
@@ -1602,8 +1565,7 @@ virtio_notify_cfg_write(struct pci_vdev *dev, uint64_t offset, int size,
else if (vops->qnotify)
(*vops->qnotify)(DEV_STRUCT(base), vq);
else
fprintf(stderr,
"%s: qnotify queue %lu: missing vq/vops notify\r\n",
pr_err("%s: qnotify queue %lu: missing vq/vops notify\r\n",
name, idx);
}
@@ -1623,16 +1585,14 @@ virtio_pci_modern_mmio_read(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
value = size == 1 ? 0xff : size == 2 ? 0xffff : 0xffffffff;
if (size != 1 && size != 2 && size != 4) {
fprintf(stderr,
"%s: read from [%d:0x%lx] bad size %d\r\n",
pr_err("%s: read from [%d:0x%lx] bad size %d\r\n",
name, baridx, offset, size);
return value;
}
capid = virtio_get_cap_id(offset, size);
if (capid < 0) {
fprintf(stderr,
"%s: read from [%d:0x%lx] bad range %d\r\n",
pr_err("%s: read from [%d:0x%lx] bad range %d\r\n",
name, baridx, offset, size);
return value;
}
@@ -1654,8 +1614,7 @@ virtio_pci_modern_mmio_read(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
value = virtio_device_cfg_read(dev, offset, size);
break;
default: /* guest driver should not read from notify region */
fprintf(stderr,
"%s: read from [%d:0x%lx] size %d not supported\r\n",
pr_err("%s: read from [%d:0x%lx] size %d not supported\r\n",
name, baridx, offset, size);
}
@@ -1679,16 +1638,14 @@ virtio_pci_modern_mmio_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
name = vops->name;
if (size != 1 && size != 2 && size != 4) {
fprintf(stderr,
"%s: write to [%d:0x%lx] bad size %d\r\n",
pr_err("%s: write to [%d:0x%lx] bad size %d\r\n",
name, baridx, offset, size);
return;
}
capid = virtio_get_cap_id(offset, size);
if (capid < 0) {
fprintf(stderr,
"%s: write to [%d:0x%lx] bad range %d\r\n",
pr_err("%s: write to [%d:0x%lx] bad range %d\r\n",
name, baridx, offset, size);
return;
}
@@ -1710,8 +1667,7 @@ virtio_pci_modern_mmio_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
virtio_notify_cfg_write(dev, offset, size, value);
break;
default: /* guest driver should not write to ISR region */
fprintf(stderr,
"%s: write to [%d:0x%lx] size %d not supported\r\n",
pr_err("%s: write to [%d:0x%lx] size %d not supported\r\n",
name, baridx, offset, size);
}
@@ -1744,15 +1700,13 @@ virtio_pci_modern_pio_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
idx = value;
if (size != 1 && size != 2 && size != 4) {
fprintf(stderr,
"%s: write to [%d:0x%lx] bad size %d\r\n",
pr_err("%s: write to [%d:0x%lx] bad size %d\r\n",
name, baridx, offset, size);
return;
}
if (idx >= vops->nvq) {
fprintf(stderr,
"%s: queue %lu notify out of range\r\n", name, idx);
pr_err("%s: queue %lu notify out of range\r\n", name, idx);
return;
}
@@ -1765,8 +1719,7 @@ virtio_pci_modern_pio_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
else if (vops->qnotify)
(*vops->qnotify)(DEV_STRUCT(base), vq);
else
fprintf(stderr,
"%s: qnotify queue %lu: missing vq/vops notify\r\n",
pr_err("%s: qnotify queue %lu: missing vq/vops notify\r\n",
name, idx);
if (base->mtx)
@@ -1813,7 +1766,7 @@ virtio_pci_read(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
return virtio_pci_modern_pio_read(ctx, vcpu, dev, baridx,
offset, size);
fprintf(stderr, "%s: read unexpected baridx %d\r\n",
pr_err("%s: read unexpected baridx %d\r\n",
base->vops->name, baridx);
return size == 1 ? 0xff : size == 2 ? 0xffff : 0xffffffff;
}
@@ -1866,7 +1819,7 @@ virtio_pci_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
return;
}
fprintf(stderr, "%s: write unexpected baridx %d\r\n",
pr_err("%s: write unexpected baridx %d\r\n",
base->vops->name, baridx);
}

View File

@@ -565,7 +565,7 @@ virtio_blk_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
register_vm_monitor_blkrescan = true;
if (monitor_register_vm_ops(&virtio_blk_rescan_ops, ctx,
"virtio_blk_rescan") < 0)
fprintf(stderr, "Rescan registration to VM monitor failed\n");
pr_err("Rescan registration to VM monitor failed\n");
}
return 0;
@@ -654,24 +654,24 @@ virtio_blk_rescan(struct vmctx *ctx, struct pci_vdev *dev, char *newpath)
struct virtio_blk *blk = (struct virtio_blk *) dev->arg;
if (!blk) {
fprintf(stderr, "Invalid virtio_blk device!\n");
pr_err("Invalid virtio_blk device!\n");
goto end;
}
/* validate inputs for virtio-blk blockrescan */
if (newpath == NULL) {
fprintf(stderr, "no path info available\n");
pr_err("no path info available\n");
goto end;
}
if (strstr(newpath, "nodisk") != NULL) {
fprintf(stderr, "no valid backend file found\n");
pr_err("no valid backend file found\n");
goto end;
}
if (snprintf(bident, sizeof(bident), "%d:%d",
dev->slot, dev->func) >= sizeof(bident)) {
fprintf(stderr, "bident error, please check slot and func\n");
pr_err("bident error, please check slot and func\n");
goto end;
}
@@ -680,15 +680,15 @@ virtio_blk_rescan(struct vmctx *ctx, struct pci_vdev *dev, char *newpath)
* If this is the case, blk->bc would be null.
*/
if (blk->bc) {
fprintf(stderr, "Replacing valid backend file not supported!\n");
pr_err("Replacing valid backend file not supported!\n");
goto end;
}
fprintf(stderr, "name=%s, Path=%s, ident=%s\n", dev->name, newpath, bident);
pr_err("name=%s, Path=%s, ident=%s\n", dev->name, newpath, bident);
/* update the bctxt for the virtio-blk device */
bctxt = blockif_open(newpath, bident);
if (bctxt == NULL) {
fprintf(stderr, "Error opening backing file\n");
pr_err("Error opening backing file\n");
goto end;
}
@@ -725,30 +725,30 @@ vm_monitor_blkrescan(void *arg, char *devargs)
if ((str_slot != NULL) && (str_newpath != NULL)) {
error = dm_strtoi(str_slot, &str_slot, 10, &slot);
if (error) {
fprintf(stderr, "Incorrect slot, error=0x%x!\n", error);
pr_err("Incorrect slot, error=0x%x!\n", error);
goto end;
}
} else {
fprintf(stderr, "Slot info or path not available!");
pr_err("Slot info or path not available!");
error = -1;
goto end;
}
dev = pci_get_vdev_info(slot);
if (dev == NULL) {
fprintf(stderr, "vdev info failed for Slot %d\n!", slot);
pr_err("vdev info failed for Slot %d\n!", slot);
error = -1;
goto end;
}
if (strstr(dev->name, "virtio-blk") == NULL) {
error = -1;
fprintf(stderr, "virtio-blk only supports rescan: found %s at slot %d\n", dev->name, slot);
pr_err("virtio-blk only supports rescan: found %s at slot %d\n", dev->name, slot);
} else {
error = virtio_blk_rescan(ctx, dev, str_newpath);
if (error) {
fprintf(stderr, "virtio-blk rescan failed!");
pr_err("virtio-blk rescan failed!");
}
}
end:

View File

@@ -639,7 +639,7 @@ virtio_net_parsemac(char *mac_str, uint8_t *mac_addr)
if (ea == NULL || ETHER_IS_MULTICAST(ea->ether_addr_octet) ||
memcmp(ea->ether_addr_octet, zero_addr, ETHER_ADDR_LEN)
== 0) {
fprintf(stderr, "Invalid MAC %s\n", mac_str);
pr_err("Invalid MAC %s\n", mac_str);
return -1;
}
memcpy(mac_addr, ea->ether_addr_octet, ETHER_ADDR_LEN);
@@ -998,7 +998,7 @@ virtio_net_teardown(void *param)
close(net->tapfd);
net->tapfd = -1;
} else
fprintf(stderr, "net->tapfd is -1!\n");
pr_err("net->tapfd is -1!\n");
free(net);
}
@@ -1027,7 +1027,7 @@ virtio_net_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
DPRINTF(("%s: done\n", __func__));
} else
fprintf(stderr, "%s: NULL!\n", __func__);
pr_err("%s: NULL!\n", __func__);
}
static struct vhost_net *