[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH v3 0/6] include: Auto-generate the sizes lookup

From: Eric Blake
Subject: Re: [Qemu-block] [PATCH v3 0/6] include: Auto-generate the sizes lookup table
Date: Thu, 10 Jan 2019 14:28:24 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

On 1/10/19 2:21 PM, Eric Blake wrote:
> On 1/10/19 1:26 PM, Eric Blake wrote:
>> On 1/10/19 1:18 PM, Eric Blake wrote:
>>> Patches speak louder than words.  This is my counter-proposal to
>>> Leonid's thread on how best to respresent the S_*iB macros in units.h,
>>> where my proposal is that we don't need them at all. (hence my subject
>>> line, even though it is completely unrelated to the series)
>>> True, my diffstat is even bigger, but I think it is more maintainable
>>> in the long run (if calling QemuOpts maintainable is even appropriate).
>> I wasn't brave enough to assert that def_value_str was used only with
>> QEMU_OPT_STRING, and that all uses of QEMU_OPT_{BOOL,NUMBER,SIZE} with a
>> default value are either defaulting to 0 or using def_value_int; that's
>> a bigger auditing task followup that could be given as a BiteSizedTask,
>> if you like this series.
> Hmm - I wonder if Coccinelle is powerful enough to find all QemuOptDesc
> initializers that .type to something other than QEMU_OPT_STRING and also
> set .def_value_str; including initializers that did not use C99
> named-member initialization (if we have any of those). (Those are the
> candidates to start using .def_value_int)

Then again, if we were consistent at C99 initializers, a grep may be
powerful enough:

$ git grep -A3 '\.type *= *QEMU_OPT_\(BOOL\|NUMBER\|SIZE\)' | grep -B3
block/parallels.c:            .type = QEMU_OPT_SIZE,
block/parallels.c-            .help = "Preallocation size on image
block/parallels.c-            .def_value_str = "128M",
block/qcow2.c:            .type = QEMU_OPT_BOOL,
block/qcow2.c-            .help = "Postpone refcount updates",
block/qcow2.c-            .def_value_str = "off"
block/qcow2.c:            .type = QEMU_OPT_NUMBER,
block/qcow2.c-            .help = "Width of a reference count entry in
block/qcow2.c-            .def_value_str = "16"
block/vdi.c:            .type = QEMU_OPT_BOOL,
block/vdi.c-            .help = "VDI static (pre-allocated) image",
block/vdi.c-            .def_value_str = "off"
block/vmdk.c:            .type = QEMU_OPT_BOOL,
block/vmdk.c-            .help = "VMDK version 6 image",
block/vmdk.c-            .def_value_str = "off"
block/vxhs.c:            .type = QEMU_OPT_NUMBER,
block/vxhs.c-            .help = "port number on which VxHSD is
listening (default 9999)",
block/vxhs.c-            .def_value_str = "9999"

and where the def_value_str = "off" defaults can probably be deleted.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]