[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory en
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries |
Date: |
Fri, 1 Feb 2019 11:08:22 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
On 1/31/19 7:46 AM, Andrey Shinkevich wrote:
> In the 'Format specific information' section of the 'qemu-img info'
> command output, the supplemental information about existing QCOW2
> bitmaps will be shown, such as a bitmap name, flags and granularity:
>
> +
> +static Qcow2BitmapInfoFlagsList *get_bitmap_info_flags(uint32_t flags)
> +{
> + Qcow2BitmapInfoFlagsList *list = NULL;
> + Qcow2BitmapInfoFlagsList **plist = &list;
> + int i;
> +
> + static const struct {
> + int bme; /* Bitmap directory entry flags */
> + int info; /* The flags to report to the user */
> + } map[] = {
> + { BME_FLAG_IN_USE, QCOW2_BITMAP_INFO_FLAGS_IN_USE },
> + { BME_FLAG_AUTO, QCOW2_BITMAP_INFO_FLAGS_AUTO },
> + };
> +
> + int map_size = sizeof(map) / sizeof(map[0]);
We have the ARRAY_SIZE() macro for this.
> +
> + for (i = 0; i < map_size; ++i) {
> + if (flags & map[i].bme) {
> + Qcow2BitmapInfoFlagsList *entry =
> + g_new0(Qcow2BitmapInfoFlagsList, 1);
> + entry->value = map[i].info;
> + *plist = entry;
> + plist = &entry->next;
> + flags &= ~map[i].bme;
> + }
> + }
> + /* Check if the BME_* mapping above is complete */
> + assert(!flags);
> +
> + info->flags = get_bitmap_info_flags(bm->flags & ~BME_RESERVED_FLAGS);
> + info->unknown_flags = bm->flags & BME_RESERVED_FLAGS;
> + info->has_unknown_flags = !!info->unknown_flags;
Glad you liked my idea for better sanity checking.
If that's the only change needed, I don't mind making it as part of
staging for a pull request (of course, review comments on 3/3 may still
result in a v12 for other reasons).
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Vladimir Sementsov-Ogievskiy, 2019/02/01
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries,
Eric Blake <=
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Kevin Wolf, 2019/02/01
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Markus Armbruster, 2019/02/01
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Eric Blake, 2019/02/01
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Markus Armbruster, 2019/02/01
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Eric Blake, 2019/02/01
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Markus Armbruster, 2019/02/04
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Vladimir Sementsov-Ogievskiy, 2019/02/04
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Eric Blake, 2019/02/04
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Vladimir Sementsov-Ogievskiy, 2019/02/04
- Re: [Qemu-devel] [PATCH v11 2/3] qemu-img info lists bitmap directory entries, Vladimir Sementsov-Ogievskiy, 2019/02/04