All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com, vsementsov@virtuozzo.com,
	Michael Roth <mdroth@linux.vnet.ibm.com>,
	qemu-block@nongnu.org, rjones@redhat.com, qemu-devel@nongnu.org,
	stefanha@redhat.com
Subject: Re: [PATCH v5 01/12] qapi: Move GenericList to qapi/util.h
Date: Mon, 26 Oct 2020 15:18:44 +0100	[thread overview]
Message-ID: <8736215auz.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20201023183652.478921-2-eblake@redhat.com> (Eric Blake's message of "Fri, 23 Oct 2020 13:36:41 -0500")

Eric Blake <eblake@redhat.com> writes:

> Placing GenericList in util.h will make it easier for the next patch
> to promote QAPI_LIST_ADD() into a public macro without requiring more
> files to include the unrelated visitor.h.

Is this true?

You don't actually need GenericList to make use of QAPI_LIST_ADD(), do
you?  Any QAPI list type should do.

> However, we can't also move GenericAlternate; this is because it would
> introduce a circular dependency: qapi-builtin-types.h needs a complete
> definition of QEnumLookup (so it includes qapi/util.h), and
> GenericAlternate needs a complete definition of QType (declared in
> qapi-builtin-types.h).  Leaving GenericAlternate in visitor.h breaks
> the cycle, and doesn't matter since we don't have any further planned
> uses for that type outside of visitors.
>
> Suggested-by: Markus Armbruster <armbru@redhat.com>

I did suggest to consider moving GenericList and GenericAlternate next
to QAPI_LIST_ADD(), because they're (loosely) related.  We can't move
GenericAlternate.  Moving only GenericList brings GenericList and
QAPI_LIST_ADD() together, but separates the more closely related
GenericList and GenericAlternate.  Meh.

I'd leave it put.

> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  include/qapi/visitor.h | 9 +--------
>  include/qapi/util.h    | 8 ++++++++
>  2 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
> index ebc19ede7fff..8c2e1c29ad8b 100644
> --- a/include/qapi/visitor.h
> +++ b/include/qapi/visitor.h
> @@ -16,6 +16,7 @@
>  #define QAPI_VISITOR_H
>
>  #include "qapi/qapi-builtin-types.h"
> +#include "qapi/util.h"

Not necessary, qapi-builtin-types.h must include it for QEnumLookup.

>  /*
>   * The QAPI schema defines both a set of C data types, and a QMP wire
> @@ -228,14 +229,6 @@
>
>  /*** Useful types ***/
>
> -/* This struct is layout-compatible with all other *List structs
> - * created by the QAPI generator.  It is used as a typical
> - * singly-linked list. */
> -typedef struct GenericList {
> -    struct GenericList *next;
> -    char padding[];
> -} GenericList;
> -
>  /* This struct is layout-compatible with all Alternate types
>   * created by the QAPI generator. */
>  typedef struct GenericAlternate {
> diff --git a/include/qapi/util.h b/include/qapi/util.h
> index a7c3c6414874..50201896c7a4 100644
> --- a/include/qapi/util.h
> +++ b/include/qapi/util.h
> @@ -11,6 +11,14 @@
>  #ifndef QAPI_UTIL_H
>  #define QAPI_UTIL_H
>
> +/* This struct is layout-compatible with all other *List structs
> + * created by the QAPI generator.  It is used as a typical
> + * singly-linked list. */
> +typedef struct GenericList {
> +    struct GenericList *next;
> +    char padding[];
> +} GenericList;
> +
>  typedef struct QEnumLookup {
>      const char *const *array;
>      int size;



  parent reply	other threads:[~2020-10-26 14:19 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 18:36 [PATCH v5 00/12] Exposing backing-chain allocation over NBD Eric Blake
2020-10-23 18:36 ` [PATCH v5 01/12] qapi: Move GenericList to qapi/util.h Eric Blake
2020-10-24  9:06   ` Vladimir Sementsov-Ogievskiy
2020-10-26 14:18   ` Markus Armbruster [this message]
2020-10-26 14:22     ` Eric Blake
2020-10-23 18:36 ` [PATCH v5 02/12] qapi: Make QAPI_LIST_ADD() public Eric Blake
2020-10-24  9:10   ` Vladimir Sementsov-Ogievskiy
2020-10-26 14:25   ` Markus Armbruster
2020-10-26 14:37     ` Eric Blake
2020-10-26 14:38       ` Eric Blake
2020-10-23 18:36 ` [PATCH v5 03/12] nbd: Utilize QAPI_CLONE for type conversion Eric Blake
2020-10-24  9:17   ` Vladimir Sementsov-Ogievskiy
2020-10-26 14:41   ` Markus Armbruster
2020-10-23 18:36 ` [PATCH v5 04/12] nbd: Add new qemu:allocation-depth metadata context Eric Blake
2020-10-23 18:36 ` [PATCH v5 05/12] nbd: Add 'qemu-nbd -A' to expose allocation depth Eric Blake
2020-10-23 18:36 ` [PATCH v5 06/12] nbd: Update qapi to support exporting multiple bitmaps Eric Blake
2020-10-26 10:50   ` Peter Krempa
2020-10-26 13:06     ` Eric Blake
2020-10-23 18:36 ` [PATCH v5 07/12] nbd: Simplify qemu bitmap context name Eric Blake
2020-10-23 18:36 ` [PATCH v5 08/12] nbd: Refactor counting of metadata contexts Eric Blake
2020-10-23 18:36 ` [PATCH v5 09/12] nbd: Allow export of multiple bitmaps for one device Eric Blake
2020-10-23 18:36 ` [PATCH v5 10/12] block: Return depth level during bdrv_is_allocated_above Eric Blake
2020-10-24  9:49   ` Vladimir Sementsov-Ogievskiy
2020-10-26 12:26     ` Vladimir Sementsov-Ogievskiy
2020-10-23 18:36 ` [PATCH v5 11/12] nbd: Expose actual depth in qemu:allocation-depth Eric Blake
2020-10-24  9:59   ` Vladimir Sementsov-Ogievskiy
2020-10-26 12:31     ` Eric Blake
2020-10-23 18:36 ` [PATCH v5 12/12] qapi: Use QAPI_LIST_ADD() where possible Eric Blake
2020-10-23 20:23   ` Eric Blake
2020-10-23 20:23     ` Eric Blake
2020-10-23 18:44 ` [PATCH v5 00/12] Exposing backing-chain allocation over NBD Eric Blake
2020-10-26 14:54   ` Markus Armbruster

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=8736215auz.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mdroth@linux.vnet.ibm.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.