On Tue, Nov 12, 2019 at 12:06:46PM +0100, Bjoern Walk wrote:
Ján Tomko <jtomko(a)redhat.com> [2019-11-12, 10:47AM +0100]:
> > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> > index fd4bafef..7b775159 100644
> > --- a/src/qemu/qemu_hotplug.c
> > +++ b/src/qemu/qemu_hotplug.c
> > @@ -2790,6 +2790,8 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
> > {
> > int ret = -1;
> > g_autofree char *devstr = NULL;
> > + char *devName = NULL;
> > + bool releaseaddr = false;
Having these scoped for the whole function is excessive. Especially the
misleading releaseaddr, which is never used.
> > bool added = false;
> > bool teardowncgroup = false;
> > bool teardownlabel = false;
> > @@ -2805,6 +2807,10 @@ qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
> > return -1;
> > break;
> > case VIR_MDEV_MODEL_TYPE_VFIO_CCW:
> > + devName = hostdev->source.subsys.u.mdev.uuidstr;
> > + if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev,
devName) < 0)
>
> vfio-ccw is not really a virtio device, is it?
The naming of that function is rather odd and misleading. It sets the
address type of the device if not set and generates the correct address,
exactly what we need here.
Oh right, not even VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 seems to
be virtio-related.
Somewhere on my TODO-list I have a point to go over the address
generation for CCW and clean it up. For now, this must suffice.
It does seem to be more complicated than it needs to be.
With the declarations moved into the switch case:
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
and pushed.
Jano