aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-10 18:15:23 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-09-30 19:11:36 +0200
commit9bbfd245c3db021eff9f17b446404a283c302f11 (patch)
tree8956d01ce40b1f2ada9757406c32a6d3dd041aca
parent881444687571d8b23f308f76bef326ab860685b4 (diff)
downloadqemu-9bbfd245c3db021eff9f17b446404a283c302f11.zip
qemu-9bbfd245c3db021eff9f17b446404a283c302f11.tar.gz
qemu-9bbfd245c3db021eff9f17b446404a283c302f11.tar.bz2
qom: Indent existing code examples
This indents existing code examples that are not indented yet, just to make future conversion to Sphinx markup easier to review. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20200910221526.10041-7-ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--include/qom/object.h376
1 files changed, 188 insertions, 188 deletions
diff --git a/include/qom/object.h b/include/qom/object.h
index 7b58009..099a356 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -41,34 +41,34 @@ typedef struct InterfaceInfo InterfaceInfo;
*
* <example>
* <title>Creating a minimal type</title>
- * <programlisting>
- * #include "qdev.h"
- *
- * #define TYPE_MY_DEVICE "my-device"
- *
- * // No new virtual functions: we can reuse the typedef for the
- * // superclass.
- * typedef DeviceClass MyDeviceClass;
- * typedef struct MyDevice
- * {
- * DeviceState parent;
- *
- * int reg0, reg1, reg2;
- * } MyDevice;
- *
- * static const TypeInfo my_device_info = {
- * .name = TYPE_MY_DEVICE,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDevice),
- * };
- *
- * static void my_device_register_types(void)
- * {
- * type_register_static(&my_device_info);
- * }
- *
- * type_init(my_device_register_types)
- * </programlisting>
+ * <programlisting>
+ * #include "qdev.h"
+ *
+ * #define TYPE_MY_DEVICE "my-device"
+ *
+ * // No new virtual functions: we can reuse the typedef for the
+ * // superclass.
+ * typedef DeviceClass MyDeviceClass;
+ * typedef struct MyDevice
+ * {
+ * DeviceState parent;
+ *
+ * int reg0, reg1, reg2;
+ * } MyDevice;
+ *
+ * static const TypeInfo my_device_info = {
+ * .name = TYPE_MY_DEVICE,
+ * .parent = TYPE_DEVICE,
+ * .instance_size = sizeof(MyDevice),
+ * };
+ *
+ * static void my_device_register_types(void)
+ * {
+ * type_register_static(&my_device_info);
+ * }
+ *
+ * type_init(my_device_register_types)
+ * </programlisting>
* </example>
*
* In the above example, we create a simple type that is described by #TypeInfo.
@@ -79,22 +79,22 @@ typedef struct InterfaceInfo InterfaceInfo;
* DEFINE_TYPES()
*
* <example>
- * <programlisting>
- * static const TypeInfo device_types_info[] = {
- * {
- * .name = TYPE_MY_DEVICE_A,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDeviceA),
- * },
- * {
- * .name = TYPE_MY_DEVICE_B,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDeviceB),
- * },
- * };
- *
- * DEFINE_TYPES(device_types_info)
- * </programlisting>
+ * <programlisting>
+ * static const TypeInfo device_types_info[] = {
+ * {
+ * .name = TYPE_MY_DEVICE_A,
+ * .parent = TYPE_DEVICE,
+ * .instance_size = sizeof(MyDeviceA),
+ * },
+ * {
+ * .name = TYPE_MY_DEVICE_B,
+ * .parent = TYPE_DEVICE,
+ * .instance_size = sizeof(MyDeviceB),
+ * },
+ * };
+ *
+ * DEFINE_TYPES(device_types_info)
+ * </programlisting>
* </example>
*
* Every type has an #ObjectClass associated with it. #ObjectClass derivatives
@@ -143,22 +143,22 @@ typedef struct InterfaceInfo InterfaceInfo;
*
* <example>
* <title>Overriding a virtual function</title>
- * <programlisting>
- * #include "qdev.h"
- *
- * void my_device_class_init(ObjectClass *klass, void *class_data)
- * {
- * DeviceClass *dc = DEVICE_CLASS(klass);
- * dc->reset = my_device_reset;
- * }
- *
- * static const TypeInfo my_device_info = {
- * .name = TYPE_MY_DEVICE,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDevice),
- * .class_init = my_device_class_init,
- * };
- * </programlisting>
+ * <programlisting>
+ * #include "qdev.h"
+ *
+ * void my_device_class_init(ObjectClass *klass, void *class_data)
+ * {
+ * DeviceClass *dc = DEVICE_CLASS(klass);
+ * dc->reset = my_device_reset;
+ * }
+ *
+ * static const TypeInfo my_device_info = {
+ * .name = TYPE_MY_DEVICE,
+ * .parent = TYPE_DEVICE,
+ * .instance_size = sizeof(MyDevice),
+ * .class_init = my_device_class_init,
+ * };
+ * </programlisting>
* </example>
*
* Introducing new virtual methods requires a class to define its own
@@ -167,31 +167,31 @@ typedef struct InterfaceInfo InterfaceInfo;
*
* <example>
* <title>Defining an abstract class</title>
- * <programlisting>
- * #include "qdev.h"
- *
- * typedef struct MyDeviceClass
- * {
- * DeviceClass parent;
- *
- * void (*frobnicate) (MyDevice *obj);
- * } MyDeviceClass;
- *
- * static const TypeInfo my_device_info = {
- * .name = TYPE_MY_DEVICE,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDevice),
- * .abstract = true, // or set a default in my_device_class_init
- * .class_size = sizeof(MyDeviceClass),
- * };
- *
- * void my_device_frobnicate(MyDevice *obj)
- * {
- * MyDeviceClass *klass = MY_DEVICE_GET_CLASS(obj);
- *
- * klass->frobnicate(obj);
- * }
- * </programlisting>
+ * <programlisting>
+ * #include "qdev.h"
+ *
+ * typedef struct MyDeviceClass
+ * {
+ * DeviceClass parent;
+ *
+ * void (*frobnicate) (MyDevice *obj);
+ * } MyDeviceClass;
+ *
+ * static const TypeInfo my_device_info = {
+ * .name = TYPE_MY_DEVICE,
+ * .parent = TYPE_DEVICE,
+ * .instance_size = sizeof(MyDevice),
+ * .abstract = true, // or set a default in my_device_class_init
+ * .class_size = sizeof(MyDeviceClass),
+ * };
+ *
+ * void my_device_frobnicate(MyDevice *obj)
+ * {
+ * MyDeviceClass *klass = MY_DEVICE_GET_CLASS(obj);
+ *
+ * klass->frobnicate(obj);
+ * }
+ * </programlisting>
* </example>
*
* Interfaces
@@ -236,68 +236,68 @@ typedef struct InterfaceInfo InterfaceInfo;
*
* <example>
* <title>Overriding a virtual method</title>
- * <programlisting>
- * typedef struct MyState MyState;
- *
- * typedef void (*MyDoSomething)(MyState *obj);
- *
- * typedef struct MyClass {
- * ObjectClass parent_class;
- *
- * MyDoSomething do_something;
- * } MyClass;
- *
- * static void my_do_something(MyState *obj)
- * {
- * // do something
- * }
- *
- * static void my_class_init(ObjectClass *oc, void *data)
- * {
- * MyClass *mc = MY_CLASS(oc);
- *
- * mc->do_something = my_do_something;
- * }
- *
- * static const TypeInfo my_type_info = {
- * .name = TYPE_MY,
- * .parent = TYPE_OBJECT,
- * .instance_size = sizeof(MyState),
- * .class_size = sizeof(MyClass),
- * .class_init = my_class_init,
- * };
- *
- * typedef struct DerivedClass {
- * MyClass parent_class;
- *
- * MyDoSomething parent_do_something;
- * } DerivedClass;
- *
- * static void derived_do_something(MyState *obj)
- * {
- * DerivedClass *dc = DERIVED_GET_CLASS(obj);
- *
- * // do something here
- * dc->parent_do_something(obj);
- * // do something else here
- * }
- *
- * static void derived_class_init(ObjectClass *oc, void *data)
- * {
- * MyClass *mc = MY_CLASS(oc);
- * DerivedClass *dc = DERIVED_CLASS(oc);
- *
- * dc->parent_do_something = mc->do_something;
- * mc->do_something = derived_do_something;
- * }
- *
- * static const TypeInfo derived_type_info = {
- * .name = TYPE_DERIVED,
- * .parent = TYPE_MY,
- * .class_size = sizeof(DerivedClass),
- * .class_init = derived_class_init,
- * };
- * </programlisting>
+ * <programlisting>
+ * typedef struct MyState MyState;
+ *
+ * typedef void (*MyDoSomething)(MyState *obj);
+ *
+ * typedef struct MyClass {
+ * ObjectClass parent_class;
+ *
+ * MyDoSomething do_something;
+ * } MyClass;
+ *
+ * static void my_do_something(MyState *obj)
+ * {
+ * // do something
+ * }
+ *
+ * static void my_class_init(ObjectClass *oc, void *data)
+ * {
+ * MyClass *mc = MY_CLASS(oc);
+ *
+ * mc->do_something = my_do_something;
+ * }
+ *
+ * static const TypeInfo my_type_info = {
+ * .name = TYPE_MY,
+ * .parent = TYPE_OBJECT,
+ * .instance_size = sizeof(MyState),
+ * .class_size = sizeof(MyClass),
+ * .class_init = my_class_init,
+ * };
+ *
+ * typedef struct DerivedClass {
+ * MyClass parent_class;
+ *
+ * MyDoSomething parent_do_something;
+ * } DerivedClass;
+ *
+ * static void derived_do_something(MyState *obj)
+ * {
+ * DerivedClass *dc = DERIVED_GET_CLASS(obj);
+ *
+ * // do something here
+ * dc->parent_do_something(obj);
+ * // do something else here
+ * }
+ *
+ * static void derived_class_init(ObjectClass *oc, void *data)
+ * {
+ * MyClass *mc = MY_CLASS(oc);
+ * DerivedClass *dc = DERIVED_CLASS(oc);
+ *
+ * dc->parent_do_something = mc->do_something;
+ * mc->do_something = derived_do_something;
+ * }
+ *
+ * static const TypeInfo derived_type_info = {
+ * .name = TYPE_DERIVED,
+ * .parent = TYPE_MY,
+ * .class_size = sizeof(DerivedClass),
+ * .class_init = derived_class_init,
+ * };
+ * </programlisting>
* </example>
*
* Alternatively, object_class_by_name() can be used to obtain the class and
@@ -984,24 +984,24 @@ Object *object_new(const char *typename);
*
* <example>
* <title>Creating an object with properties</title>
- * <programlisting>
- * Error *err = NULL;
- * Object *obj;
- *
- * obj = object_new_with_props(TYPE_MEMORY_BACKEND_FILE,
- * object_get_objects_root(),
- * "hostmem0",
- * &err,
- * "share", "yes",
- * "mem-path", "/dev/shm/somefile",
- * "prealloc", "yes",
- * "size", "1048576",
- * NULL);
- *
- * if (!obj) {
- * error_reportf_err(err, "Cannot create memory backend: ");
- * }
- * </programlisting>
+ * <programlisting>
+ * Error *err = NULL;
+ * Object *obj;
+ *
+ * obj = object_new_with_props(TYPE_MEMORY_BACKEND_FILE,
+ * object_get_objects_root(),
+ * "hostmem0",
+ * &err,
+ * "share", "yes",
+ * "mem-path", "/dev/shm/somefile",
+ * "prealloc", "yes",
+ * "size", "1048576",
+ * NULL);
+ *
+ * if (!obj) {
+ * error_reportf_err(err, "Cannot create memory backend: ");
+ * }
+ * </programlisting>
* </example>
*
* The returned object will have one stable reference maintained
@@ -1053,20 +1053,20 @@ void object_apply_compat_props(Object *obj);
*
* <example>
* <title>Update an object's properties</title>
- * <programlisting>
- * Error *err = NULL;
- * Object *obj = ...get / create object...;
- *
- * if (!object_set_props(obj,
- * &err,
- * "share", "yes",
- * "mem-path", "/dev/shm/somefile",
- * "prealloc", "yes",
- * "size", "1048576",
- * NULL)) {
- * error_reportf_err(err, "Cannot set properties: ");
- * }
- * </programlisting>
+ * <programlisting>
+ * Error *err = NULL;
+ * Object *obj = ...get / create object...;
+ *
+ * if (!object_set_props(obj,
+ * &err,
+ * "share", "yes",
+ * "mem-path", "/dev/shm/somefile",
+ * "prealloc", "yes",
+ * "size", "1048576",
+ * NULL)) {
+ * error_reportf_err(err, "Cannot set properties: ");
+ * }
+ * </programlisting>
* </example>
*
* The returned object will have one stable reference maintained
@@ -1557,15 +1557,15 @@ typedef struct ObjectPropertyIterator {
*
* <example>
* <title>Using object property iterators</title>
- * <programlisting>
- * ObjectProperty *prop;
- * ObjectPropertyIterator iter;
- *
- * object_property_iter_init(&iter, obj);
- * while ((prop = object_property_iter_next(&iter))) {
- * ... do something with prop ...
- * }
- * </programlisting>
+ * <programlisting>
+ * ObjectProperty *prop;
+ * ObjectPropertyIterator iter;
+ *
+ * object_property_iter_init(&iter, obj);
+ * while ((prop = object_property_iter_next(&iter))) {
+ * ... do something with prop ...
+ * }
+ * </programlisting>
* </example>
*/
void object_property_iter_init(ObjectPropertyIterator *iter,