[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 32/32] blockdev: Remove bdrv_probe_device fie
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH v3 32/32] blockdev: Remove bdrv_probe_device field from BlockDriver |
Date: |
Wed, 6 Jul 2016 18:44:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
On 05.07.2016 17:24, Colin Lord wrote:
> This commit finalizes the separation of the BlockDriver from its
> device probing function. Now the accesses to these functions in block.c
> occur through the protocol_probes array, and each function returns a
> score and protocol name with which to find the corresponding driver.
>
> Signed-off-by: Colin Lord <address@hidden>
> ---
> block.c | 46
> ++++++++++++++++++++++++++++++-----------
> block/probe/host_cdrom.c | 23 ++++++++++++++-------
> block/probe/host_device.c | 34 ++++++++++++++++++++----------
> block/raw-posix.c | 3 ---
> block/raw-win32.c | 1 -
> include/block/block_int.h | 2 --
> include/block/probe.h | 4 ++--
> scripts/modules/module_block.py | 12 ++---------
> 8 files changed, 76 insertions(+), 49 deletions(-)
As I suggested for patch 17, I'd split the additions to block.c from the
conversion of the actual probe functions.
> diff --git a/block.c b/block.c
> index 7e441fe..bc1046b 100644
> --- a/block.c
> +++ b/block.c
> @@ -59,6 +59,7 @@
>
> typedef const char *BdrvProbeFunc(const uint8_t *buf, int buf_size,
> const char *filename, int *score);
> +typedef const char *BdrvProbeDevFunc(const char *filename, int *score);
>
> static BdrvProbeFunc *format_probes[] = {
> bochs_probe,
> @@ -76,6 +77,13 @@ static BdrvProbeFunc *format_probes[] = {
> vpc_probe
> };
>
> +static BdrvProbeDevFunc *protocol_probes[] = {
> + hdev_probe_device,
> +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__linux__)
> + cdrom_probe_device
> +#endif
> +};
> +
Same as what I've said in my reply to patch 17: I'd rather have a struct
that contains the name of the protocol and the probe function separated
from each other than have the probe function return the protocol name.
In case you decide not to follow this suggestion (nor the suggestion on
splitting this patch) though:
Reviewed-by: Max Reitz <address@hidden>
> static QTAILQ_HEAD(, BlockDriverState) graph_bdrv_states =
> QTAILQ_HEAD_INITIALIZER(graph_bdrv_states);
>
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v3 23/32] blockdev: Separate qcow2 probe from its driver, (continued)
- [Qemu-devel] [PATCH v3 26/32] blockdev: Separate vdi probe from its driver, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 29/32] blockdev: Separate vpc probe from its driver, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 31/32] blockdev: Separate out bdrv_probe_device functions, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 30/32] blockdev: Remove the .bdrv_probe field from BlockDrivers, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 32/32] blockdev: Remove bdrv_probe_device field from BlockDriver, Colin Lord, 2016/07/05
- Re: [Qemu-devel] [PATCH v3 32/32] blockdev: Remove bdrv_probe_device field from BlockDriver,
Max Reitz <=
- [Qemu-devel] [PATCH v3 16/32] blockdev: Move vpc probe to its own file, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 17/32] blockdev: Separate bochs probe from its driver, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 22/32] blockdev: Separate qcow probe from its driver, Colin Lord, 2016/07/05
- [Qemu-devel] [PATCH v3 21/32] blockdev: Separate parallels probe from its driver, Colin Lord, 2016/07/05