From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org, rjones@redhat.com,
stefanha@redhat.com, Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH v4 4/7] nbd: Update qapi to support exporting multiple bitmaps
Date: Wed, 21 Oct 2020 06:19:51 +0200 [thread overview]
Message-ID: <87v9f48b2w.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <4d7d4c9b-3b32-0c13-9ec1-b326e49ca7ae@redhat.com> (Eric Blake's message of "Tue, 20 Oct 2020 13:26:19 -0500")
Eric Blake <eblake@redhat.com> writes:
> On 10/20/20 3:51 AM, Markus Armbruster wrote:
>
>>> #define QAPI_LIST_ADD(list, element) do { \
>>> typeof(list) _tmp = g_new(typeof(*(list)), 1); \
>>> _tmp->value = (element); \
>>> _tmp->next = (list); \
>>> (list) = _tmp; \
>>> } while (0)
>>>
>>>
>>> Markus, thoughts on if we should publish this macro,
>>
>> If it's widely useful.
>>
>> "git-grep -- '->value ='" matches ~200 times. A patch converting these
>> to the macro where possible would make a strong case for having the
>> macro.
>>
>>> and if so, which
>>> header would be best?
>>
>> The macro is generic: @list's type may be any of the struct TYPEList we
>> generate for the QAPI type ['TYPE'].
>>
>> We don't want to generate this macro next to each of these struct
>> definitions. A non-generic macro would go there, but let's not generate
>> almost a hundred non-generic macros where a single generic one can do
>> the job.
>
> Agreed.
>
>>
>> The closest we have to a common base is GenericList. It's in in
>> visitor.h because it's only used by visitors so far. Adding the macro
>> next it is not so smart, because we don't want non-visitor code to
>> include visitor.h just for this macro.
>
> Also agreed.
>
>>
>> Perhaps the macro should go into qapi/util.h, and perhaps GenericList
>> and GenericAlternate should move there, too.
>
> GenericList is easy, but GenericAlternate is harder: it would introduce
> a cyclic declaration dependency (generated qapi-builtin-types.h includes
> qapi/util.h for the definition of QEnumLookup, but qapi/util.h declaring
> GenericAlternate would depend on including qapi-builtin-types.h for the
> definition of QType).
You're right.
QType is a built-in QAPI type. The typedef is generated into
qapi-builtin-types.h.
It needs to be a QAPI type because it's the type of alternates'
(implicit) member @type.
I figure the easiest way to move GenericAlternate (if we want to), is
creating a new header, or rather splitting qapi/util.h into the part
needed by qapi-builtin-types.h and the part that needs
qapi-builtin-types.h.
Doesn't seem to be worth our while now. We can simply put the macro
into qapi/util.h and call it a day.
next prev parent reply other threads:[~2020-10-21 4:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-09 21:55 [PATCH v4 0/7] Exposing backing-chain allocation over NBD Eric Blake
2020-10-09 21:55 ` [PATCH v4 1/7] nbd: Utilize QAPI_CLONE for type conversion Eric Blake
2020-10-14 11:15 ` Vladimir Sementsov-Ogievskiy
2020-10-23 16:15 ` Eric Blake
2020-10-09 21:55 ` [PATCH v4 2/7] nbd: Add new qemu:allocation-depth metadata context Eric Blake
2020-10-14 11:52 ` Vladimir Sementsov-Ogievskiy
2020-10-22 21:45 ` Eric Blake
2020-10-09 21:55 ` [PATCH v4 3/7] nbd: Add 'qemu-nbd -A' to expose allocation depth Eric Blake
2020-10-09 21:55 ` [PATCH v4 4/7] nbd: Update qapi to support exporting multiple bitmaps Eric Blake
2020-10-14 12:15 ` Vladimir Sementsov-Ogievskiy
2020-10-19 21:45 ` Eric Blake
2020-10-20 8:51 ` Markus Armbruster
2020-10-20 18:26 ` Eric Blake
2020-10-21 4:19 ` Markus Armbruster [this message]
2020-10-09 21:55 ` [PATCH v4 5/7] nbd: Simplify qemu bitmap context name Eric Blake
2020-10-14 12:21 ` Vladimir Sementsov-Ogievskiy
2020-10-09 21:55 ` [PATCH v4 6/7] nbd: Refactor counting of metadata contexts Eric Blake
2020-10-14 12:27 ` Vladimir Sementsov-Ogievskiy
2020-10-09 21:55 ` [PATCH v4 7/7] nbd: Allow export of multiple bitmaps for one device Eric Blake
2020-10-14 14:42 ` Vladimir Sementsov-Ogievskiy
2020-10-15 12:59 ` Eric Blake
[not found] ` <20201016152318.80889-1-eblake@redhat.com>
2020-10-27 15:33 ` [Libguestfs] [libnbd PATCH] info: Add support for new 'qemu-nbd -A' qemu:allocation-depth Eric Blake
2020-10-27 19:40 ` Richard W.M. Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v9f48b2w.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.