[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 02/16] qcow2: Use endof()
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 02/16] qcow2: Use endof() |
Date: |
Mon, 19 Aug 2019 14:09:41 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 8/19/19 1:55 PM, Max Reitz wrote:
> Signed-off-by: Max Reitz <address@hidden>
> ---
> block/qcow2-snapshot.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
What, the file got larger in spite of using a helper macro for ease of
readability? Good thing that 'lines of code' is not the only metric of
goodness ;)
>
> diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
> index d0e7fa9311..752883e5c3 100644
> --- a/block/qcow2-snapshot.c
> +++ b/block/qcow2-snapshot.c
> @@ -92,11 +92,12 @@ int qcow2_read_snapshots(BlockDriverState *bs)
> }
> offset += extra_data_size;
>
> - if (extra_data_size >= 8) {
> + if (extra_data_size >= endof(QCowSnapshotExtraData,
> + vm_state_size_large)) {
> sn->vm_state_size = be64_to_cpu(extra.vm_state_size_large);
> }
>
> - if (extra_data_size >= 16) {
> + if (extra_data_size >= endof(QCowSnapshotExtraData, disk_size)) {
Yes, that is nicer.
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
- [Qemu-devel] [PATCH v2 00/16] qcow2: Let check -r all repair some snapshot bits, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 01/16] include: Move endof() up from hw/virtio/virtio.h, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 02/16] qcow2: Use endof(), Max Reitz, 2019/08/19
- Re: [Qemu-devel] [PATCH v2 02/16] qcow2: Use endof(),
Eric Blake <=
- [Qemu-devel] [PATCH v2 03/16] qcow2: Add Error ** to qcow2_read_snapshots(), Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 04/16] qcow2: Keep unknown extra snapshot data, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 05/16] qcow2: Make qcow2_write_snapshots() public, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 06/16] qcow2: Put qcow2_upgrade() into its own function, Max Reitz, 2019/08/19
- [Qemu-devel] [PATCH v2 07/16] qcow2: Write v3-compliant snapshot list on upgrade, Max Reitz, 2019/08/19