All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2 3/8] qnum: QNumValue type for QNum value literals
Date: Fri, 20 Nov 2020 06:29:16 +0100	[thread overview]
Message-ID: <877dqg8ukz.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20201119182158.GX1509407@habkost.net> (Eduardo Habkost's message of "Thu, 19 Nov 2020 13:21:58 -0500")

Eduardo Habkost <ehabkost@redhat.com> writes:

> On Thu, Nov 19, 2020 at 11:24:52AM +0100, Markus Armbruster wrote:
>> Marc-André Lureau <marcandre.lureau@gmail.com> writes:
>> 
>> > On Tue, Nov 17, 2020 at 6:42 PM Eduardo Habkost <ehabkost@redhat.com> wrote:
>> >
>> >> On Tue, Nov 17, 2020 at 12:37:56PM +0400, Marc-André Lureau wrote:
>> >> > On Tue, Nov 17, 2020 at 2:43 AM Eduardo Habkost <ehabkost@redhat.com>
>> >> wrote:
>> >> >
>> >> > > Provide a separate QNumValue type that can be used for QNum value
>> >> > > literals without the referencing counting and memory allocation
>> >> > > features provided by QObject.
>> >> > >
>> >> > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>> >> > > ---
>> >> > > Changes v1 -> v2:
>> >> > > * Fix "make check" failure, by updating check-qnum unit test to
>> >> > >   use the new struct fields
>> >> > > ---
>> >> > >  include/qapi/qmp/qnum.h | 40 +++++++++++++++++++--
>> >> > >  qobject/qnum.c          | 78 ++++++++++++++++++++---------------------
>> >> > >  tests/check-qnum.c      | 14 ++++----
>> >> > >  3 files changed, 84 insertions(+), 48 deletions(-)
>> >> > >
>> >> > > diff --git a/include/qapi/qmp/qnum.h b/include/qapi/qmp/qnum.h
>> >> > > index 55c27b1c24..62fbdfda68 100644
>> >> > > --- a/include/qapi/qmp/qnum.h
>> >> > > +++ b/include/qapi/qmp/qnum.h
>> >> > > @@ -46,20 +46,56 @@ typedef enum {
>> >> > >   * in range: qnum_get_try_int() / qnum_get_try_uint() check range and
>> >> > >   * convert under the hood.
>> >> > >   */
>> >> > > -struct QNum {
>> >> > > -    struct QObjectBase_ base;
>> >> > > +
>> >> > > +/**
>> >> > > + * struct QNumValue: the value of a QNum
>> >> > > + *
>> >> > > + * QNumValue literals can be constructed using the `QNUM_VAL_INT`,
>> >> > > + * `QNUM_VAL_UINT`, and `QNUM_VAL_DOUBLE` macros.
>> >> > > + */
>> >> > > +typedef struct QNumValue {
>> >> > > +    /* private: */
>> 
>> Do we care?
>
> Are you asking if we want to make them private, or if we want to
> document them as private (assuming they are).
>
> The answer to the latter is yes ("private:" is an indication to
> kernel-doc).  The answer to the former seems to be "no", based on
> your other comments.
>
> Or maybe `kind` should be public and `u` should be private?

You're factoring out a part of struct QNum into new struct QNumValue.
struct QNum is not private before the patch.  I see no need to start
making it or parts of it private now.

When the structure of a data type is to be kept away from its users, I
prefer to keep it out of the public header, so the compiler enforces the
encapsulation.

[...]



  parent reply	other threads:[~2020-11-20  5:31 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 22:41 [PATCH v2 0/8] qom: Use qlit to represent property defaults Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 1/8] qobject: Include API docs in docs/devel/qobject.html Eduardo Habkost
2020-11-17  8:23   ` Marc-André Lureau
2020-11-19  9:37   ` Markus Armbruster
2020-11-19 18:03     ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 2/8] qnum: Make qnum_get_double() get const pointer Eduardo Habkost
2020-11-17  8:26   ` Marc-André Lureau
2020-11-16 22:41 ` [PATCH v2 3/8] qnum: QNumValue type for QNum value literals Eduardo Habkost
2020-11-17  8:37   ` Marc-André Lureau
2020-11-17 14:42     ` Eduardo Habkost
2020-11-17 14:58       ` Marc-André Lureau
2020-11-19 10:24         ` Markus Armbruster
2020-11-19 18:21           ` Eduardo Habkost
2020-11-19 20:55             ` Eduardo Habkost
2020-11-20  9:05               ` Markus Armbruster
2020-11-20  5:29             ` Markus Armbruster [this message]
2020-11-20 18:27               ` Eduardo Habkost
2020-11-23  7:51                 ` Markus Armbruster
2020-11-23 18:33                   ` Eduardo Habkost
2020-11-24  8:49                     ` Markus Armbruster
2020-11-24 14:41                       ` Eduardo Habkost
2020-11-24 15:20                         ` Markus Armbruster
2020-11-24 15:29                           ` Eduardo Habkost
2020-11-25  6:40                             ` Markus Armbruster
2020-11-25 15:01                               ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 4/8] qnum: qnum_value_is_equal() function Eduardo Habkost
2020-11-17  8:42   ` Marc-André Lureau
2020-11-17 15:49     ` Eduardo Habkost
2020-11-17 16:53       ` Marc-André Lureau
2020-11-17 17:21         ` Eduardo Habkost
2020-11-19 10:27   ` Markus Armbruster
2020-11-19 18:24     ` Eduardo Habkost
2020-11-20  6:52       ` Markus Armbruster
2020-11-20 18:22         ` Eduardo Habkost
2020-11-23  8:17           ` Markus Armbruster
2020-11-16 22:41 ` [PATCH v2 5/8] qlit: Support all types of QNums Eduardo Habkost
2020-11-17  8:52   ` Marc-André Lureau
2020-11-19 10:39     ` Markus Armbruster
2020-11-19 18:56       ` Eduardo Habkost
2020-11-20  6:55         ` Markus Armbruster
2020-11-16 22:41 ` [PATCH v2 6/8] qlit: qlit_type() function Eduardo Habkost
2020-11-17  8:53   ` Marc-André Lureau
2020-11-19 10:41   ` Markus Armbruster
2020-11-19 17:56     ` Eduardo Habkost
2020-11-16 22:41 ` [PATCH v2 7/8] qom: Make object_property_set_default() public Eduardo Habkost
2020-11-17  8:56   ` Marc-André Lureau
2020-11-16 22:41 ` [PATCH v2 8/8] qom: Use qlit to represent property defaults Eduardo Habkost
2020-11-17  9:02   ` Marc-André Lureau
2020-11-19 12:39 ` [PATCH v2 0/8] " Markus Armbruster
2020-11-19 17:13   ` Eduardo Habkost
2020-11-19 17:23     ` Paolo Bonzini
2020-11-19 17:55       ` Eduardo Habkost
2020-11-19 18:25         ` Paolo Bonzini
2020-11-19 19:05           ` Eduardo Habkost

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=877dqg8ukz.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.