[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 8/9] docs/devel: mention the spacing requirement for QOM
From: |
Alex Bennée |
Subject: |
[PATCH 8/9] docs/devel: mention the spacing requirement for QOM |
Date: |
Thu, 20 Apr 2023 16:57:22 +0100 |
We have a more complete document on QOM but we should at least mention
the style requirements in the style guide.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
docs/devel/qom.rst | 2 ++
docs/devel/style.rst | 29 +++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst
index 3e34b07c98..c9237950d0 100644
--- a/docs/devel/qom.rst
+++ b/docs/devel/qom.rst
@@ -1,3 +1,5 @@
+.. _qom:
+
===========================
The QEMU Object Model (QOM)
===========================
diff --git a/docs/devel/style.rst b/docs/devel/style.rst
index 5bc6f2f095..0bd01f3fca 100644
--- a/docs/devel/style.rst
+++ b/docs/devel/style.rst
@@ -628,6 +628,35 @@ are still some caveats to beware of
QEMU Specific Idioms
********************
+QEMU Object Model Declarations
+==============================
+
+The QEMU Object Model (QOM) provides a framework for handling objects
+in the base C language. The first declaration of a storage or class
+structure should always be the parent and leave a visual space between
+that declaration and the new code.
+
+.. code-block:: c
+
+ typedef struct MyDeviceState {
+ DeviceState parent_obj;
+
+ /* Properties */
+ int prop_a;
+ char *prob_b;
+ /* Other stuff */
+ int internal_state;
+ } MyDeviceState;
+
+ typedef struct MyDeviceClass {
+ ObjectClass parent_class;
+
+ void (*new_fn1)(void);
+ bool (*new_fn2)(CPUState *);
+ } MyDeviceClass;
+
+See :ref:`qom` for more details.
+
Error handling and reporting
============================
--
2.39.2
- [PATCH 0/9] docs: various (style, punctuation and typo fixes), Alex Bennée, 2023/04/20
- [PATCH 1/9] docs/devel/kconfig.rst: Fix incorrect markup, Alex Bennée, 2023/04/20
- [PATCH 4/9] docs/cxl: Fix sentence, Alex Bennée, 2023/04/20
- [PATCH 2/9] qemu-options.hx: Update descriptions of memory options for NUMA node, Alex Bennée, 2023/04/20
- [PATCH 7/9] docs/devel: make a statement about includes, Alex Bennée, 2023/04/20
- [PATCH 8/9] docs/devel: mention the spacing requirement for QOM,
Alex Bennée <=
- Re: [PATCH 8/9] docs/devel: mention the spacing requirement for QOM, Juan Quintela, 2023/04/20
- [PATCH 6/9] docs/system: remove excessive punctuation from guest-loader docs, Alex Bennée, 2023/04/20
- [PATCH 3/9] docs: Fix typo (wphx => whpx), Alex Bennée, 2023/04/20
- [PATCH 9/9] docs/style: call out the use of GUARD macros, Alex Bennée, 2023/04/20