[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/12] hw/xen: automatically assign device index to block dev
From: |
Kevin Wolf |
Subject: |
Re: [PATCH 11/12] hw/xen: automatically assign device index to block devices |
Date: |
Tue, 17 Oct 2023 12:21:52 +0200 |
Am 16.10.2023 um 17:19 hat David Woodhouse geschrieben:
> From: David Woodhouse <dwmw@amazon.co.uk>
>
> There's no need to force the user to assign a vdev. We can automatically
> assign one, starting at xvda and searching until we find the first disk
> name that's unused.
>
> This means we can now allow '-drive if=xen,file=xxx' to work without an
> explicit separate -driver argument, just like if=virtio.
>
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> @@ -34,6 +34,31 @@ static char *xen_block_get_name(XenDevice *xendev, Error
> **errp)
> XenBlockDevice *blockdev = XEN_BLOCK_DEVICE(xendev);
> XenBlockVdev *vdev = &blockdev->props.vdev;
>
> + if (blockdev->props.vdev.type == XEN_BLOCK_VDEV_TYPE_INVALID) {
> + char name[11];
> + int disk = 0;
> + unsigned long idx;
> +
> + /* Find an unoccupied device name */
> + while (disk < (1 << 20)) {
I like your optimism that we can handle a million disks. :-)
I haven't reviewed the Xen part in detail, but the patch looks fine on
the block layer side.
Acked-by: Kevin Wolf <kwolf@redhat.com>
- [PATCH 0/12] Get Xen PV shim running in qemu, David Woodhouse, 2023/10/16
- [PATCH 10/12] hw/xen: automatically assign device index to console devices, David Woodhouse, 2023/10/16
- [PATCH 06/12] hw/xen: add get_frontend_path() method to XenDeviceClass, David Woodhouse, 2023/10/16
- [PATCH 07/12] hw/xen: update Xen console to XenDevice model, David Woodhouse, 2023/10/16
- [PATCH 01/12] i386/xen: fix per-vCPU upcall vector for Xen emulation, David Woodhouse, 2023/10/16
- [PATCH 04/12] i386/xen: advertise XEN_HVM_CPUID_UPCALL_VECTOR in CPUID, David Woodhouse, 2023/10/16
- [PATCH 11/12] hw/xen: automatically assign device index to block devices, David Woodhouse, 2023/10/16
- Re: [PATCH 11/12] hw/xen: automatically assign device index to block devices, Kevin Wolf, 2023/10/18