From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Zhao Liu <zhao1.liu@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Eduardo Habkost <eduardo@habkost.net>,
qemu-devel@nongnu.org
Subject: Re: [Question] What is the definition of “private” fields in QOM?
Date: Mon, 21 Oct 2024 09:35:22 +0100 [thread overview]
Message-ID: <ZxYSSp1wkifLy3tV@redhat.com> (raw)
In-Reply-To: <ZxPZ5oUDRcVroh7o@intel.com>
On Sun, Oct 20, 2024 at 12:10:14AM +0800, Zhao Liu wrote:
> Hi maintainers and list,
>
> In the QOM structure, the class and object structs have two members:
> parent_class and parent_obj, which are often marked as "< private >" in
> the comment.
>
> I couldn’t find information on why to define ‘private’ and ‘public’,
> even in the earliest QOM commits and the patch emails I could find.
>
> Does ‘private’ refer to the internal implementation code of QOM, or does
> it refer to the specific code that defines and implements this object
> and its class?
>
> I understand the original idea of private field indicates it cannot be
> accessed directly out of the "private" scope.
I see two scenarios
* Devices where the structs are in the include/..../<blah>.h
The private/public comments are a message to other code in QEMU about
which fields are OK to access directly, and which should not be accessed.
* Devices where the structs are in the ../<blah>.c
The private/public comments look entirely pointless, as everything
is private to the .c file.
99% of the time it seems the "parent" / "parent_obj" fields are the only
one marked private. There are a handful of classes where other fields are
under the private comment, but not many.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2024-10-21 8:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-19 16:10 [Question] What is the definition of “private” fields in QOM? Zhao Liu
2024-10-21 8:35 ` Daniel P. Berrangé [this message]
2024-10-21 9:22 ` Zhao Liu
2024-10-21 9:25 ` Peter Maydell
2024-10-21 14:22 ` Zhao Liu
2024-10-21 14:20 ` Peter Maydell
2024-10-21 15:18 ` Zhao Liu
2024-10-21 15:06 ` Peter Maydell
2024-10-21 15:41 ` Zhao Liu
2024-10-21 16:47 ` Peter Maydell
2024-10-22 3:08 ` Junjie Mao
2024-10-22 8:42 ` Peter Maydell
2024-10-22 15:09 ` Zhao Liu
2024-10-22 15:01 ` Zhao Liu
2024-10-21 18:46 ` BALATON Zoltan
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=ZxYSSp1wkifLy3tV@redhat.com \
--to=berrange@redhat.com \
--cc=eduardo@habkost.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhao1.liu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).