[Qemu-devel] [PATCH 0/1] block: Eliminate the S_1KiB, S_2KiB, ... macros

Markus Armbruster posted 1 patch 5 years, 2 months ago
Test asan passed
Test checkpatch passed
Test docker-clang@ubuntu passed
Test docker-mingw@fedora passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190111191401.18317-1-armbru@redhat.com
Maintainers: Max Reitz <mreitz@redhat.com>, Stefan Weil <sw@weilnetz.de>, Kevin Wolf <kwolf@redhat.com>
block/qcow2.h        | 10 +++---
block/vdi.c          |  3 +-
include/qemu/units.h | 73 --------------------------------------------
3 files changed, 7 insertions(+), 79 deletions(-)
[Qemu-devel] [PATCH 0/1] block: Eliminate the S_1KiB, S_2KiB, ... macros
Posted by Markus Armbruster 5 years, 2 months ago
Back in September, Leonid Block added a whole bunch of macros (commit
540b8492618) to improve readability of qcow2.h a bit (commit
b6a95c6d100).  He later used them to fix the "vdi" driver's parameter
cluster_size's default value (commit 3dd5b8f4718).  He has now
proposed a further patch[1] to auto-generate these macros.  That patch
feels overengineered to me.

On closer examination, I found I dislike the macros before his new
patch.  So did Eric Blake.

The macros exist because the common KiB, MiB, ... macros aren't usable
when you need a literal rather than a constant expression.
stringify() does, and we use it to define the QemuOpts default value.

Eric proposed to improve QemuOpts to accept integer default values,
too[2].  Before I review that patch series, I want to establish a
"stupidest solution that can possibly work" baseline.  And that's what
this patch is.

[1] [PATCH v2 0/1] include: Auto-generate the sizes lookup table
Message-ID: <20190103213320.2653-1-lbloch@janustech.com>

[2] [PATCH v3 0/6] include: Auto-generate the sizes lookup table
Message-Id: <20190110191901.5082-1-eblake@redhat.com>

Markus Armbruster (1):
  block: Eliminate the S_1KiB, S_2KiB, ... macros

 block/qcow2.h        | 10 +++---
 block/vdi.c          |  3 +-
 include/qemu/units.h | 73 --------------------------------------------
 3 files changed, 7 insertions(+), 79 deletions(-)

-- 
2.17.2


Re: [Qemu-devel] [PATCH 0/1] block: Eliminate the S_1KiB, S_2KiB, ... macros
Posted by Leonid Bloch 5 years, 2 months ago
On 1/11/19 9:14 PM, Markus Armbruster wrote:
> Back in September, Leonid Block added a whole bunch of macros (commit

* Bloch. :)

> 540b8492618) to improve readability of qcow2.h a bit (commit
> b6a95c6d100).  He later used them to fix the "vdi" driver's parameter
> cluster_size's default value (commit 3dd5b8f4718).  He has now
> proposed a further patch[1] to auto-generate these macros.  That patch
> feels overengineered to me.
> 
> On closer examination, I found I dislike the macros before his new
> patch.  So did Eric Blake.
> 
> The macros exist because the common KiB, MiB, ... macros aren't usable
> when you need a literal rather than a constant expression.
> stringify() does, and we use it to define the QemuOpts default value.
> 
> Eric proposed to improve QemuOpts to accept integer default values,
> too[2].  Before I review that patch series, I want to establish a
> "stupidest solution that can possibly work" baseline.  And that's what
> this patch is.
> 
> [1] [PATCH v2 0/1] include: Auto-generate the sizes lookup table
> Message-ID: <20190103213320.2653-1-lbloch@janustech.com>
> 
> [2] [PATCH v3 0/6] include: Auto-generate the sizes lookup table
> Message-Id: <20190110191901.5082-1-eblake@redhat.com>
> 
> Markus Armbruster (1):
>    block: Eliminate the S_1KiB, S_2KiB, ... macros
> 
>   block/qcow2.h        | 10 +++---
>   block/vdi.c          |  3 +-
>   include/qemu/units.h | 73 --------------------------------------------
>   3 files changed, 7 insertions(+), 79 deletions(-)
> 
Re: [Qemu-devel] [PATCH 0/1] block: Eliminate the S_1KiB, S_2KiB, ... macros
Posted by Markus Armbruster 5 years, 2 months ago
Leonid Bloch <lbloch@janustech.com> writes:

> On 1/11/19 9:14 PM, Markus Armbruster wrote:
>> Back in September, Leonid Block added a whole bunch of macros (commit
>
> * Bloch. :)

I apologize for my carelessness.  Explanation, no excuse:

    $ git-log --author=armbru -Sblock -i --oneline | wc -l
    167
    $ git-log --author=armbru -Sbloch -i --oneline | wc -l
    0

Déformation professionnelle...

[...]

Re: [Qemu-devel] [PATCH 0/1] block: Eliminate the S_1KiB, S_2KiB, ... macros
Posted by Kevin Wolf 5 years, 2 months ago
Am 11.01.2019 um 20:14 hat Markus Armbruster geschrieben:
> Back in September, Leonid Block added a whole bunch of macros (commit
> 540b8492618) to improve readability of qcow2.h a bit (commit
> b6a95c6d100).  He later used them to fix the "vdi" driver's parameter
> cluster_size's default value (commit 3dd5b8f4718).  He has now
> proposed a further patch[1] to auto-generate these macros.  That patch
> feels overengineered to me.
> 
> On closer examination, I found I dislike the macros before his new
> patch.  So did Eric Blake.
> 
> The macros exist because the common KiB, MiB, ... macros aren't usable
> when you need a literal rather than a constant expression.
> stringify() does, and we use it to define the QemuOpts default value.
> 
> Eric proposed to improve QemuOpts to accept integer default values,
> too[2].  Before I review that patch series, I want to establish a
> "stupidest solution that can possibly work" baseline.  And that's what
> this patch is.
> 
> [1] [PATCH v2 0/1] include: Auto-generate the sizes lookup table
> Message-ID: <20190103213320.2653-1-lbloch@janustech.com>
> 
> [2] [PATCH v3 0/6] include: Auto-generate the sizes lookup table
> Message-Id: <20190110191901.5082-1-eblake@redhat.com>

Thanks, applied to the block branch.

Kevin