qdev: rename DeviceClass.props

Ensure that conflicts in the future will cause a syntax error.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-01-23 12:11:38 +01:00
parent 4f67d30b5e
commit 385d8f222a
5 changed files with 13 additions and 8 deletions

View File

@ -1071,7 +1071,7 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name)
/* device properties */
class = object_get_class(OBJECT(dev));
do {
prop = qdev_prop_walk(DEVICE_CLASS(class)->props, name);
prop = qdev_prop_walk(DEVICE_CLASS(class)->props_, name);
if (prop) {
return prop;
}

View File

@ -751,7 +751,7 @@ void qdev_alias_all_properties(DeviceState *target, Object *source)
do {
DeviceClass *dc = DEVICE_CLASS(class);
for (prop = dc->props; prop && prop->name; prop++) {
for (prop = dc->props_; prop && prop->name; prop++) {
object_property_add_alias(source, prop->name,
OBJECT(target), prop->name,
&error_abort);
@ -954,7 +954,7 @@ static void device_initfn(Object *obj)
class = object_get_class(OBJECT(dev));
do {
for (prop = DEVICE_CLASS(class)->props; prop && prop->name; prop++) {
for (prop = DEVICE_CLASS(class)->props_; prop && prop->name; prop++) {
qdev_property_add_legacy(dev, prop, &error_abort);
qdev_property_add_static(dev, prop);
}
@ -1013,7 +1013,7 @@ static void device_class_base_init(ObjectClass *class, void *data)
/* We explicitly look up properties in the superclasses,
* so do not propagate them to the subclasses.
*/
klass->props = NULL;
klass->props_ = NULL;
}
static void device_unparent(Object *obj)
@ -1063,7 +1063,7 @@ static void device_class_init(ObjectClass *class, void *data)
void device_class_set_props(DeviceClass *dc, Property *props)
{
dc->props = props;
dc->props_ = props;
}
void device_class_set_parent_reset(DeviceClass *dc,

View File

@ -100,7 +100,12 @@ typedef struct DeviceClass {
DECLARE_BITMAP(categories, DEVICE_CATEGORY_MAX);
const char *fw_name;
const char *desc;
Property *props;
/*
* The underscore at the end ensures a compile-time error if someone
* assigns to dc->props instead of using device_class_set_props.
*/
Property *props_;
/*
* Can this device be instantiated with -device / device_add?

View File

@ -748,7 +748,7 @@ static void qdev_print(Monitor *mon, DeviceState *dev, int indent)
}
class = object_get_class(OBJECT(dev));
do {
qdev_print_props(mon, dev, DEVICE_CLASS(class)->props, indent);
qdev_print_props(mon, dev, DEVICE_CLASS(class)->props_, indent);
class = object_class_get_parent(class);
} while (class != object_class_by_name(TYPE_DEVICE));
bus_print_dev(dev->parent_bus, mon, dev, indent);

View File

@ -137,7 +137,7 @@ static ObjectPropertyInfo *make_device_property_info(ObjectClass *klass,
Property *prop;
do {
for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) {
for (prop = DEVICE_CLASS(klass)->props_; prop && prop->name; prop++) {
if (strcmp(name, prop->name) != 0) {
continue;
}