qdev: Move global validation to a single function
PATCH 1/1 qdev: Move global validation to a single function
This simplifies the global validation code so all its logic is contained in a single function, and fixes the following:
$ qemu-system-x86_64 -global container.xxx=y hw/core/qdev-properties-system.c:450:qdev_add_one_global: Object 0x7f8d72a03d70 is not an instance of type device Aborted (core dumped)
--- hw/core/qdev-properties-system.c | 16 ---------------- hw/core/qdev-properties.c | 25 +++++++++++++++++++------ include/hw/qdev-core.h | 5 ++--- tests/test-qdev-global-props.c | 15 ++++++++++++++- 4 files changed, 35 insertions(+), 26 deletions(-)
hw/core/qdev-properties-system.c +0 -16
@@ -439,27 +439,11 @@ PropertyInfo qdev_prop_iothread = {static int qdev_add_one_global (QemuOpts *opts,void *opaque) {GlobalProperty *g; -ObjectClass *oc; g =g_malloc0 (sizeof (*g)); g->driver =qemu_opt_get (opts,"driver" ); g->property =qemu_opt_get (opts,"property" ); g->value =qemu_opt_get (opts,"value" ); - oc =object_class_by_name (g->driver); -if (oc) { -DeviceClass *dc =DEVICE_CLASS (oc); - -if (dc->hotpluggable) { -/* If hotpluggable then skip not_used checking. */ - g->not_used = false; - }else { -/* Maybe a typo. */ - g->not_used = true; - } - }else { -/* Maybe a typo. */ - g->not_used = true; - }qdev_prop_register_global (g);return 0 ; }
hw/core/qdev-properties.c +19 -6
@@ -961,13 +961,26 @@ int qdev_prop_check_global(void)int ret =0 ; QTAILQ_FOREACH(prop, &global_props, next) { -if (!prop->not_used) { +ObjectClass *oc; +DeviceClass *dc; +if (prop->used) { +continue ; + } + oc =object_class_by_name (prop->driver); + oc =object_class_dynamic_cast (oc,TYPE_DEVICE ); +if (!oc) { +error_report ("Warning: global %s.%s has invalid class name" , + prop->driver, prop->property); + ret =1 ; +continue ; + } + dc =DEVICE_CLASS (oc); +if (!dc->hotpluggable && !prop->used) { +error_report ("Warning: global %s.%s=%s\" not used" , + prop->driver, prop->property, prop->value); + ret =1 ;continue ; } - ret =1 ; -error_report ("Warning: \"-global %s.%s=%s\" not used" , - prop->driver, prop->property, prop->value); - }return ret; }
@@ -983,7 +996,7 @@ void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename,if (strcmp (typename, prop->driver) !=0 ) {continue ; } - prop->not_used = false; + prop->used = true;object_property_parse (OBJECT (dev), prop->value, prop->property, &err);if (err !=NULL ) {error_propagate (errp, err);
include/hw/qdev-core.h +2 -3
@@ -241,8 +241,7 @@ struct PropertyInfo {/** * GlobalProperty: -* @not_used: Track use of a global property. Defaults to false in all C99 -* struct initializations. +* @used: Set to true if global property was used. * * This prevents reports of .compat_props when they are not used. */
@@ -250,7 +249,7 @@ typedef struct GlobalProperty {const char *driver;const char *property;const char *value; -bool not_used; +bool used;QTAILQ_ENTRY (GlobalProperty) next; } GlobalProperty;
tests/test-qdev-global-props.c +14 -1
@@ -143,6 +143,13 @@ static const TypeInfo dynamic_prop_type = { .class_init = dynamic_class_init, }; +#define TYPE_NONDEVICE "nondevice-type" + +static const TypeInfo nondevice_type = { + .name =TYPE_NONDEVICE , + .parent =TYPE_OBJECT , +}; +/* Test setting of static property using global properties */ static void test_dynamic_globalprop (void ) {
@@ -150,7 +157,8 @@ static void test_dynamic_globalprop(void)static GlobalProperty props[] = { {TYPE_DYNAMIC_PROPS ,"prop1" ,"101" }, {TYPE_DYNAMIC_PROPS ,"prop2" ,"102" }, - {TYPE_DYNAMIC_PROPS "-bad" ,"prop3" ,"103" , true }, + {TYPE_DYNAMIC_PROPS "-bad" ,"prop3" ,"103" }, + {TYPE_NONDEVICE ,"prop4" ,"104" }, {} };int all_used;
@@ -164,6 +172,10 @@ static void test_dynamic_globalprop(void) g_assert_cmpuint(mt->prop2, ==, 102); all_used =qdev_prop_check_global (); g_assert_cmpuint(all_used, ==, 1); +g_assert (props[0 ].used); +g_assert (props[1 ].used); +g_assert (!props[2 ].used); +g_assert (!props[3 ].used); }int main (int argc,char **argv)
@@ -173,6 +185,7 @@ int main(int argc, char **argv)module_call_init (MODULE_INIT_QOM );type_register_static (&static_prop_type);type_register_static (&dynamic_prop_type); +type_register_static (&nondevice_type);g_test_add_func ("/qdev/properties/static/default" , test_static_prop);g_test_add_func ("/qdev/properties/static/global" , test_static_globalprop);
Signature · 1 line
1.9.0
Quoted 8 lines · Eduardo Habkost
This simplifies the global validation code so all its logic is contained in a single function, and fixes the following:
$ qemu-system-x86_64 -global container.xxx=y hw/core/qdev-properties-system.c:450:qdev_add_one_global: Object 0x7f8d72a03d70 is not an instance of type device Aborted (core dumped)Signed-off-by Eduardo Habkost <[email protected]>
Quoted 156 lines
--- hw/core/qdev-properties-system.c | 16 ---------------- hw/core/qdev-properties.c | 25 +++++++++++++++++++------ include/hw/qdev-core.h | 5 ++--- tests/test-qdev-global-props.c | 15 ++++++++++++++- 4 files changed, 35 insertions(+), 26 deletions(-)hw/core/qdev-properties-system.c +0
-16@@ -439,27 +439,11 @@ PropertyInfo qdev_prop_iothread = {static int qdev_add_one_global (QemuOpts *opts,void *opaque) {GlobalProperty *g; -ObjectClass *oc; g =g_malloc0 (sizeof (*g)); g->driver =qemu_opt_get (opts,"driver" ); g->property =qemu_opt_get (opts,"property" ); g->value =qemu_opt_get (opts,"value" ); - oc =object_class_by_name (g->driver); -if (oc) { -DeviceClass *dc =DEVICE_CLASS (oc); - -if (dc->hotpluggable) { -/* If hotpluggable then skip not_used checking. */ - g->not_used = false; - }else { -/* Maybe a typo. */ - g->not_used = true; - } - }else { -/* Maybe a typo. */ - g->not_used = true; - }qdev_prop_register_global (g);return 0 ; }hw/core/qdev-properties.c +19
-6@@ -961,13 +961,26 @@ int qdev_prop_check_global(void)int ret =0 ; QTAILQ_FOREACH(prop, &global_props, next) { -if (!prop->not_used) { +ObjectClass *oc; +DeviceClass *dc; +if (prop->used) { +continue ; + } + oc =object_class_by_name (prop->driver); + oc =object_class_dynamic_cast (oc,TYPE_DEVICE ); +if (!oc) { +error_report ("Warning: global %s.%s has invalid class name" , + prop->driver, prop->property); + ret =1 ; +continue ; + } + dc =DEVICE_CLASS (oc); +if (!dc->hotpluggable && !prop->used) { +error_report ("Warning: global %s.%s=%s\" not used" , + prop->driver, prop->property, prop->value); + ret =1 ;continue ; } - ret =1 ; -error_report ("Warning: \"-global %s.%s=%s\" not used" , - prop->driver, prop->property, prop->value); - }return ret; }@@ -983,7 +996,7 @@ void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename,if (strcmp (typename, prop->driver) !=0 ) {continue ; } - prop->not_used = false; + prop->used = true;object_property_parse (OBJECT (dev), prop->value, prop->property, &err);if (err !=NULL ) {error_propagate (errp, err);include/hw/qdev-core.h +2
-3@@ -241,8 +241,7 @@ struct PropertyInfo {/** * GlobalProperty: -* @not_used: Track use of a global property. Defaults to false in all C99 -* struct initializations. +* @used: Set to true if global property was used. * * This prevents reports of .compat_props when they are not used. */ @@ -250,7 +249,7 @@ typedef struct GlobalProperty {const char *driver;const char *property;const char *value; -bool not_used; +bool used;QTAILQ_ENTRY (GlobalProperty) next; } GlobalProperty;tests/test-qdev-global-props.c +14
-1@@ -143,6 +143,13 @@ static const TypeInfo dynamic_prop_type = { .class_init = dynamic_class_init, }; +#define TYPE_NONDEVICE "nondevice-type" + +static const TypeInfo nondevice_type = { + .name =TYPE_NONDEVICE , + .parent =TYPE_OBJECT , +}; +/* Test setting of static property using global properties */ static void test_dynamic_globalprop (void ) {@@ -150,7 +157,8 @@ static void test_dynamic_globalprop(void)static GlobalProperty props[] = { {TYPE_DYNAMIC_PROPS ,"prop1" ,"101" }, {TYPE_DYNAMIC_PROPS ,"prop2" ,"102" }, - {TYPE_DYNAMIC_PROPS "-bad" ,"prop3" ,"103" , true }, + {TYPE_DYNAMIC_PROPS "-bad" ,"prop3" ,"103" }, + {TYPE_NONDEVICE ,"prop4" ,"104" }, {} };int all_used;@@ -164,6 +172,10 @@ static void test_dynamic_globalprop(void) g_assert_cmpuint(mt->prop2, ==, 102); all_used =qdev_prop_check_global (); g_assert_cmpuint(all_used, ==, 1); +g_assert (props[0 ].used); +g_assert (props[1 ].used); +g_assert (!props[2 ].used); +g_assert (!props[3 ].used); }int main (int argc,char **argv)@@ -173,6 +185,7 @@ int main(int argc, char **argv)module_call_init (MODULE_INIT_QOM );type_register_static (&static_prop_type);type_register_static (&dynamic_prop_type); +type_register_static (&nondevice_type);g_test_add_func ("/qdev/properties/static/default" , test_static_prop);g_test_add_func ("/qdev/properties/static/global" , test_static_globalprop);Signature · 1 line
1.9.0
Quoted 97 lines · Eduardo Habkost
This simplifies the global validation code so all its logic is contained in a single function, and fixes the following:
$ qemu-system-x86_64 -global container.xxx=y hw/core/qdev-properties-system.c:450:qdev_add_one_global: Object 0x7f8d72a03d70 is not an instance of type device Aborted (core dumped)Signed-off-by Eduardo Habkost <[email protected]>--- hw/core/qdev-properties-system.c | 16 ---------------- hw/core/qdev-properties.c | 25 +++++++++++++++++++------ include/hw/qdev-core.h | 5 ++--- tests/test-qdev-global-props.c | 15 ++++++++++++++- 4 files changed, 35 insertions(+), 26 deletions(-)hw/core/qdev-properties-system.c +0
-16@@ -439,27 +439,11 @@ PropertyInfo qdev_prop_iothread = {static int qdev_add_one_global (QemuOpts *opts,void *opaque) {GlobalProperty *g; -ObjectClass *oc; g =g_malloc0 (sizeof (*g)); g->driver =qemu_opt_get (opts,"driver" ); g->property =qemu_opt_get (opts,"property" ); g->value =qemu_opt_get (opts,"value" ); - oc =object_class_by_name (g->driver); -if (oc) { -DeviceClass *dc =DEVICE_CLASS (oc); - -if (dc->hotpluggable) { -/* If hotpluggable then skip not_used checking. */ - g->not_used = false; - }else { -/* Maybe a typo. */ - g->not_used = true; - } - }else { -/* Maybe a typo. */ - g->not_used = true; - }qdev_prop_register_global (g);return 0 ; }hw/core/qdev-properties.c +19
-6@@ -961,13 +961,26 @@ int qdev_prop_check_global(void)int ret =0 ; QTAILQ_FOREACH(prop, &global_props, next) { -if (!prop->not_used) { +ObjectClass *oc; +DeviceClass *dc; +if (prop->used) { +continue ; + } + oc =object_class_by_name (prop->driver); + oc =object_class_dynamic_cast (oc,TYPE_DEVICE ); +if (!oc) { +error_report ("Warning: global %s.%s has invalid class name" , + prop->driver, prop->property); + ret =1 ; +continue ; + } + dc =DEVICE_CLASS (oc); +if (!dc->hotpluggable && !prop->used) { +error_report ("Warning: global %s.%s=%s\" not used" , + prop->driver, prop->property, prop->value); + ret =1 ;continue ; } - ret =1 ; -error_report ("Warning: \"-global %s.%s=%s\" not used" , - prop->driver, prop->property, prop->value); - }return ret; }@@ -983,7 +996,7 @@ void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename,if (strcmp (typename, prop->driver) !=0 ) {continue ; } - prop->not_used = false; + prop->used = true;object_property_parse (OBJECT (dev), prop->value, prop->property, &err);if (err !=NULL ) {error_propagate (errp, err);include/hw/qdev-core.h +0
-0
include/hw/qdev-core.h struct PropertyInfo { · line 245
Quoted 7 lines
include/hw/qdev-core.h +1
-2@@ -241,8 +241,7 @@ struct PropertyInfo {/** * GlobalProperty: -* @not_used: Track use of a global property. Defaults to false in all C99 -* struct initializations. +* @used: Set to true if global property was used. *
There is a big issue with switch from not_used to used:
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global VGA.rombar=0" not used
qemu-system-x86_64: Warning: global vmware-svga.rombar=0" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global virtio-9p-pci.vectors has invalid class name
qemu-system-x86_64: Warning: global VGA.rombar=0" not used
qemu-system-x86_64: Warning: global vmware-svga.rombar=0" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global VGA.rombar=0" not used
qemu-system-x86_64: Warning: global vmware-svga.rombar=0" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global PIIX4_PM.memory-hotplug-support=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.superspeed-ports-first=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msi=off" not used
qemu-system-x86_64: Warning: global nec-usb-xhci.msix=off" not used
qemu-system-x86_64: Warning: global qxl.revision has invalid class name
qemu-system-x86_64: Warning: global qxl-vga.revision has invalid class name
qemu-system-x86_64: Warning: global VGA.mmio=off" not used
qemu-system-x86_64: Warning: global VGA.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global vmware-svga.vgamem_mb=8" not used
qemu-system-x86_64: Warning: global qxl-vga.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global qxl.vgamem_mb has invalid class name
qemu-system-x86_64: Warning: global virtio-9p-pci.vectors has invalid class name
qemu-system-x86_64: Warning: global VGA.rombar=0" not used
qemu-system-x86_64: Warning: global vmware-svga.rombar=0" not used
See thread at:
http://lists.gnu.org/archive/html/qemu-devel/2014-04/msg03513.html
-Don Slutz
Quoted 58 lines
include/hw/qdev-core.h +1
-1* This prevents reports of .compat_props when they are not used. */ @@ -250,7 +249,7 @@ typedef struct GlobalProperty {const char *driver;const char *property;const char *value; -bool not_used; +bool used;QTAILQ_ENTRY (GlobalProperty) next; } GlobalProperty;tests/test-qdev-global-props.c +14
-1@@ -143,6 +143,13 @@ static const TypeInfo dynamic_prop_type = { .class_init = dynamic_class_init, }; +#define TYPE_NONDEVICE "nondevice-type" + +static const TypeInfo nondevice_type = { + .name =TYPE_NONDEVICE , + .parent =TYPE_OBJECT , +}; +/* Test setting of static property using global properties */ static void test_dynamic_globalprop (void ) {@@ -150,7 +157,8 @@ static void test_dynamic_globalprop(void)static GlobalProperty props[] = { {TYPE_DYNAMIC_PROPS ,"prop1" ,"101" }, {TYPE_DYNAMIC_PROPS ,"prop2" ,"102" }, - {TYPE_DYNAMIC_PROPS "-bad" ,"prop3" ,"103" , true }, + {TYPE_DYNAMIC_PROPS "-bad" ,"prop3" ,"103" }, + {TYPE_NONDEVICE ,"prop4" ,"104" }, {} };int all_used;@@ -164,6 +172,10 @@ static void test_dynamic_globalprop(void) g_assert_cmpuint(mt->prop2, ==, 102); all_used =qdev_prop_check_global (); g_assert_cmpuint(all_used, ==, 1); +g_assert (props[0 ].used); +g_assert (props[1 ].used); +g_assert (!props[2 ].used); +g_assert (!props[3 ].used); }int main (int argc,char **argv)@@ -173,6 +185,7 @@ int main(int argc, char **argv)module_call_init (MODULE_INIT_QOM );type_register_static (&static_prop_type);type_register_static (&dynamic_prop_type); +type_register_static (&nondevice_type);g_test_add_func ("/qdev/properties/static/default" , test_static_prop);g_test_add_func ("/qdev/properties/static/global" , test_static_globalprop);