Skip to content

Commit

Permalink
qdev: Add const qualifier to PropertyInfo definitions
Browse files Browse the repository at this point in the history
The remaining non-const ones are in e1000e which modifies description at
runtime. They can be addressed separatedly.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170714021509.23681-6-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Fam Zheng authored and bonzini committed Jul 14, 2017
1 parent 75ab905 commit 1b6b7d1
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 61 deletions.
8 changes: 4 additions & 4 deletions hw/core/qdev-properties-system.c
Expand Up @@ -159,7 +159,7 @@ static void set_drive(Object *obj, Visitor *v, const char *name, void *opaque,
set_pointer(obj, v, opaque, parse_drive, name, errp);
}

PropertyInfo qdev_prop_drive = {
const PropertyInfo qdev_prop_drive = {
.name = "str",
.description = "Node name or ID of a block device to use as a backend",
.get = get_drive,
Expand Down Expand Up @@ -228,7 +228,7 @@ static void release_chr(Object *obj, const char *name, void *opaque)
qemu_chr_fe_deinit(be, false);
}

PropertyInfo qdev_prop_chr = {
const PropertyInfo qdev_prop_chr = {
.name = "str",
.description = "ID of a chardev to use as a backend",
.get = get_chr,
Expand Down Expand Up @@ -313,7 +313,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,
g_free(str);
}

PropertyInfo qdev_prop_netdev = {
const PropertyInfo qdev_prop_netdev = {
.name = "str",
.description = "ID of a netdev to use as a backend",
.get = get_netdev,
Expand Down Expand Up @@ -393,7 +393,7 @@ static void set_vlan(Object *obj, Visitor *v, const char *name, void *opaque,
*ptr = hubport;
}

PropertyInfo qdev_prop_vlan = {
const PropertyInfo qdev_prop_vlan = {
.name = "int32",
.description = "Integer VLAN id to connect to",
.print = print_vlan,
Expand Down
44 changes: 22 additions & 22 deletions hw/core/qdev-properties.c
Expand Up @@ -132,7 +132,7 @@ static void set_default_value_bool(Object *obj, const Property *prop)
object_property_set_bool(obj, prop->defval.u, prop->name, &error_abort);
}

PropertyInfo qdev_prop_bit = {
const PropertyInfo qdev_prop_bit = {
.name = "bool",
.description = "on/off",
.get = prop_get_bit,
Expand Down Expand Up @@ -191,7 +191,7 @@ static void prop_set_bit64(Object *obj, Visitor *v, const char *name,
bit64_prop_set(dev, prop, value);
}

PropertyInfo qdev_prop_bit64 = {
const PropertyInfo qdev_prop_bit64 = {
.name = "bool",
.description = "on/off",
.get = prop_get_bit64,
Expand Down Expand Up @@ -226,7 +226,7 @@ static void set_bool(Object *obj, Visitor *v, const char *name, void *opaque,
visit_type_bool(v, name, ptr, errp);
}

PropertyInfo qdev_prop_bool = {
const PropertyInfo qdev_prop_bool = {
.name = "bool",
.get = get_bool,
.set = set_bool,
Expand Down Expand Up @@ -270,7 +270,7 @@ static void set_default_value_uint(Object *obj, const Property *prop)
object_property_set_uint(obj, prop->defval.u, prop->name, &error_abort);
}

PropertyInfo qdev_prop_uint8 = {
const PropertyInfo qdev_prop_uint8 = {
.name = "uint8",
.get = get_uint8,
.set = set_uint8,
Expand Down Expand Up @@ -304,7 +304,7 @@ static void set_uint16(Object *obj, Visitor *v, const char *name,
visit_type_uint16(v, name, ptr, errp);
}

PropertyInfo qdev_prop_uint16 = {
const PropertyInfo qdev_prop_uint16 = {
.name = "uint16",
.get = get_uint16,
.set = set_uint16,
Expand Down Expand Up @@ -363,14 +363,14 @@ static void set_int32(Object *obj, Visitor *v, const char *name, void *opaque,
visit_type_int32(v, name, ptr, errp);
}

PropertyInfo qdev_prop_uint32 = {
const PropertyInfo qdev_prop_uint32 = {
.name = "uint32",
.get = get_uint32,
.set = set_uint32,
.set_default_value = set_default_value_uint,
};

PropertyInfo qdev_prop_int32 = {
const PropertyInfo qdev_prop_int32 = {
.name = "int32",
.get = get_int32,
.set = set_int32,
Expand Down Expand Up @@ -404,7 +404,7 @@ static void set_uint64(Object *obj, Visitor *v, const char *name,
visit_type_uint64(v, name, ptr, errp);
}

PropertyInfo qdev_prop_uint64 = {
const PropertyInfo qdev_prop_uint64 = {
.name = "uint64",
.get = get_uint64,
.set = set_uint64,
Expand Down Expand Up @@ -457,7 +457,7 @@ static void set_string(Object *obj, Visitor *v, const char *name,
*ptr = str;
}

PropertyInfo qdev_prop_string = {
const PropertyInfo qdev_prop_string = {
.name = "str",
.release = release_string,
.get = get_string,
Expand All @@ -467,7 +467,7 @@ PropertyInfo qdev_prop_string = {
/* --- pointer --- */

/* Not a proper property, just for dirty hacks. TODO Remove it! */
PropertyInfo qdev_prop_ptr = {
const PropertyInfo qdev_prop_ptr = {
.name = "ptr",
};

Expand Down Expand Up @@ -541,7 +541,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
g_free(str);
}

PropertyInfo qdev_prop_macaddr = {
const PropertyInfo qdev_prop_macaddr = {
.name = "str",
.description = "Ethernet 6-byte MAC Address, example: 52:54:00:12:34:56",
.get = get_mac,
Expand All @@ -550,7 +550,7 @@ PropertyInfo qdev_prop_macaddr = {

/* --- on/off/auto --- */

PropertyInfo qdev_prop_on_off_auto = {
const PropertyInfo qdev_prop_on_off_auto = {
.name = "OnOffAuto",
.description = "on/off/auto",
.enum_table = OnOffAuto_lookup,
Expand All @@ -563,7 +563,7 @@ PropertyInfo qdev_prop_on_off_auto = {

QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) != sizeof(int));

PropertyInfo qdev_prop_losttickpolicy = {
const PropertyInfo qdev_prop_losttickpolicy = {
.name = "LostTickPolicy",
.enum_table = LostTickPolicy_lookup,
.get = get_enum,
Expand All @@ -575,7 +575,7 @@ PropertyInfo qdev_prop_losttickpolicy = {

QEMU_BUILD_BUG_ON(sizeof(BlockdevOnError) != sizeof(int));

PropertyInfo qdev_prop_blockdev_on_error = {
const PropertyInfo qdev_prop_blockdev_on_error = {
.name = "BlockdevOnError",
.description = "Error handling policy, "
"report/ignore/enospc/stop/auto",
Expand All @@ -589,7 +589,7 @@ PropertyInfo qdev_prop_blockdev_on_error = {

QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));

PropertyInfo qdev_prop_bios_chs_trans = {
const PropertyInfo qdev_prop_bios_chs_trans = {
.name = "BiosAtaTranslation",
.description = "Logical CHS translation algorithm, "
"auto/none/lba/large/rechs",
Expand All @@ -601,7 +601,7 @@ PropertyInfo qdev_prop_bios_chs_trans = {

/* --- FDC default drive types */

PropertyInfo qdev_prop_fdc_drive_type = {
const PropertyInfo qdev_prop_fdc_drive_type = {
.name = "FdcDriveType",
.description = "FDC drive type, "
"144/288/120/none/auto",
Expand Down Expand Up @@ -677,7 +677,7 @@ static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest,
}
}

PropertyInfo qdev_prop_pci_devfn = {
const PropertyInfo qdev_prop_pci_devfn = {
.name = "int32",
.description = "Slot and optional function number, example: 06.0 or 06",
.print = print_pci_devfn,
Expand Down Expand Up @@ -726,7 +726,7 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name,
*ptr = value;
}

PropertyInfo qdev_prop_blocksize = {
const PropertyInfo qdev_prop_blocksize = {
.name = "uint16",
.description = "A power of two between 512 and 32768",
.get = get_uint16,
Expand Down Expand Up @@ -841,7 +841,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
g_free(str);
}

PropertyInfo qdev_prop_pci_host_devaddr = {
const PropertyInfo qdev_prop_pci_host_devaddr = {
.name = "str",
.description = "Address (bus/device/function) of "
"the host device, example: 04:10.0",
Expand Down Expand Up @@ -950,7 +950,7 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,
}
}

PropertyInfo qdev_prop_arraylen = {
const PropertyInfo qdev_prop_arraylen = {
.name = "uint32",
.get = get_uint32,
.set = set_prop_arraylen,
Expand Down Expand Up @@ -1208,7 +1208,7 @@ static void set_size(Object *obj, Visitor *v, const char *name, void *opaque,
visit_type_size(v, name, ptr, errp);
}

PropertyInfo qdev_prop_size = {
const PropertyInfo qdev_prop_size = {
.name = "size",
.get = get_size,
.set = set_size,
Expand All @@ -1228,7 +1228,7 @@ static void create_link_property(Object *obj, Property *prop, Error **errp)
errp);
}

PropertyInfo qdev_prop_link = {
const PropertyInfo qdev_prop_link = {
.name = "link",
.create = create_link_property,
};
4 changes: 2 additions & 2 deletions hw/s390x/css.c
Expand Up @@ -2095,15 +2095,15 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name,
g_free(str);
}

PropertyInfo css_devid_propinfo = {
const PropertyInfo css_devid_propinfo = {
.name = "str",
.description = "Identifier of an I/O device in the channel "
"subsystem, example: fe.1.23ab",
.get = get_css_devid,
.set = set_css_devid,
};

PropertyInfo css_devid_ro_propinfo = {
const PropertyInfo css_devid_ro_propinfo = {
.name = "str",
.description = "Read-only identifier of an I/O device in the channel "
"subsystem, example: fe.1.23ab",
Expand Down
2 changes: 1 addition & 1 deletion hw/s390x/s390-pci-bus.c
Expand Up @@ -1015,7 +1015,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name,
zpci->fid_defined = true;
}

static PropertyInfo s390_pci_fid_propinfo = {
static const PropertyInfo s390_pci_fid_propinfo = {
.name = "zpci_fid",
.get = s390_pci_get_fid,
.set = s390_pci_set_fid,
Expand Down
4 changes: 2 additions & 2 deletions include/hw/qdev-core.h
Expand Up @@ -223,15 +223,15 @@ struct BusState {

struct Property {
const char *name;
PropertyInfo *info;
const PropertyInfo *info;
ptrdiff_t offset;
uint8_t bitnr;
union {
int64_t i;
uint64_t u;
} defval;
int arrayoffset;
PropertyInfo *arrayinfo;
const PropertyInfo *arrayinfo;
int arrayfieldsize;
const char *link_type;
};
Expand Down
52 changes: 26 additions & 26 deletions include/hw/qdev-properties.h
Expand Up @@ -5,32 +5,32 @@

/*** qdev-properties.c ***/

extern PropertyInfo qdev_prop_bit;
extern PropertyInfo qdev_prop_bit64;
extern PropertyInfo qdev_prop_bool;
extern PropertyInfo qdev_prop_uint8;
extern PropertyInfo qdev_prop_uint16;
extern PropertyInfo qdev_prop_uint32;
extern PropertyInfo qdev_prop_int32;
extern PropertyInfo qdev_prop_uint64;
extern PropertyInfo qdev_prop_size;
extern PropertyInfo qdev_prop_string;
extern PropertyInfo qdev_prop_chr;
extern PropertyInfo qdev_prop_ptr;
extern PropertyInfo qdev_prop_macaddr;
extern PropertyInfo qdev_prop_on_off_auto;
extern PropertyInfo qdev_prop_losttickpolicy;
extern PropertyInfo qdev_prop_blockdev_on_error;
extern PropertyInfo qdev_prop_bios_chs_trans;
extern PropertyInfo qdev_prop_fdc_drive_type;
extern PropertyInfo qdev_prop_drive;
extern PropertyInfo qdev_prop_netdev;
extern PropertyInfo qdev_prop_vlan;
extern PropertyInfo qdev_prop_pci_devfn;
extern PropertyInfo qdev_prop_blocksize;
extern PropertyInfo qdev_prop_pci_host_devaddr;
extern PropertyInfo qdev_prop_arraylen;
extern PropertyInfo qdev_prop_link;
extern const PropertyInfo qdev_prop_bit;
extern const PropertyInfo qdev_prop_bit64;
extern const PropertyInfo qdev_prop_bool;
extern const PropertyInfo qdev_prop_uint8;
extern const PropertyInfo qdev_prop_uint16;
extern const PropertyInfo qdev_prop_uint32;
extern const PropertyInfo qdev_prop_int32;
extern const PropertyInfo qdev_prop_uint64;
extern const PropertyInfo qdev_prop_size;
extern const PropertyInfo qdev_prop_string;
extern const PropertyInfo qdev_prop_chr;
extern const PropertyInfo qdev_prop_ptr;
extern const PropertyInfo qdev_prop_macaddr;
extern const PropertyInfo qdev_prop_on_off_auto;
extern const PropertyInfo qdev_prop_losttickpolicy;
extern const PropertyInfo qdev_prop_blockdev_on_error;
extern const PropertyInfo qdev_prop_bios_chs_trans;
extern const PropertyInfo qdev_prop_fdc_drive_type;
extern const PropertyInfo qdev_prop_drive;
extern const PropertyInfo qdev_prop_netdev;
extern const PropertyInfo qdev_prop_vlan;
extern const PropertyInfo qdev_prop_pci_devfn;
extern const PropertyInfo qdev_prop_blocksize;
extern const PropertyInfo qdev_prop_pci_host_devaddr;
extern const PropertyInfo qdev_prop_arraylen;
extern const PropertyInfo qdev_prop_link;

#define DEFINE_PROP(_name, _state, _field, _prop, _type) { \
.name = (_name), \
Expand Down
4 changes: 2 additions & 2 deletions include/hw/s390x/css.h
Expand Up @@ -112,7 +112,7 @@ typedef struct CssDevId {
bool valid;
} CssDevId;

extern PropertyInfo css_devid_propinfo;
extern const PropertyInfo css_devid_propinfo;

#define DEFINE_PROP_CSS_DEV_ID(_n, _s, _f) \
DEFINE_PROP(_n, _s, _f, css_devid_propinfo, CssDevId)
Expand Down Expand Up @@ -196,7 +196,7 @@ int css_do_rchp(uint8_t cssid, uint8_t chpid);
bool css_present(uint8_t cssid);
#endif

extern PropertyInfo css_devid_ro_propinfo;
extern const PropertyInfo css_devid_ro_propinfo;

#define DEFINE_PROP_CSS_DEV_ID_RO(_n, _s, _f) \
DEFINE_PROP(_n, _s, _f, css_devid_ro_propinfo, CssDevId)
Expand Down
2 changes: 1 addition & 1 deletion target/i386/cpu.c
Expand Up @@ -1961,7 +1961,7 @@ static void x86_set_hv_spinlocks(Object *obj, Visitor *v, const char *name,
cpu->hyperv_spinlock_attempts = value;
}

static PropertyInfo qdev_prop_spinlocks = {
static const PropertyInfo qdev_prop_spinlocks = {
.name = "int",
.get = x86_get_hv_spinlocks,
.set = x86_set_hv_spinlocks,
Expand Down
2 changes: 1 addition & 1 deletion target/ppc/translate_init.c
Expand Up @@ -8435,7 +8435,7 @@ static void getset_compat_deprecated(Object *obj, Visitor *v, const char *name,
visit_type_null(v, name, NULL);
}

static PropertyInfo ppc_compat_deprecated_propinfo = {
static const PropertyInfo ppc_compat_deprecated_propinfo = {
.name = "str",
.description = "compatibility mode (deprecated)",
.get = getset_compat_deprecated,
Expand Down

0 comments on commit 1b6b7d1

Please sign in to comment.