aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-01-29 06:48:55 -0700
committerMarkus Armbruster <armbru@redhat.com>2016-02-08 17:29:56 +0100
commitd7bce9999df85c56c8cb1fcffd944d51bff8ff48 (patch)
treec58182b775b0a02781f7818b9c8d32ba7923840d /hw/core
parent51e72bc1dd6ace6e91d675f41a1f09bd00ab8043 (diff)
qom: Swap 'name' next to visitor in ObjectPropertyAccessor
Similar to the previous patch, it's nice to have all functions in the tree that involve a visitor and a name for conversion to or from QAPI to consistently stick the 'name' parameter next to the Visitor parameter. Done by manually changing include/qom/object.h and qom/object.c, then running this Coccinelle script and touching up the fallout (Coccinelle insisted on adding some trailing whitespace). @ rule1 @ identifier fn; typedef Object, Visitor, Error; identifier obj, v, opaque, name, errp; @@ void fn - (Object *obj, Visitor *v, void *opaque, const char *name, + (Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { ... } @@ identifier rule1.fn; expression obj, v, opaque, name, errp; @@ fn(obj, v, - opaque, name, + name, opaque, errp) Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1454075341-13658-20-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/machine.c14
-rw-r--r--hw/core/qdev-properties-system.c32
-rw-r--r--hw/core/qdev-properties.c116
-rw-r--r--hw/core/qdev.c5
4 files changed, 84 insertions, 83 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 03d9a951b2..6d1a0d8eeb 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -34,7 +34,7 @@ static void machine_set_accel(Object *obj, const char *value, Error **errp)
}
static void machine_set_kernel_irqchip(Object *obj, Visitor *v,
- void *opaque, const char *name,
+ const char *name, void *opaque,
Error **errp)
{
Error *err = NULL;
@@ -69,7 +69,7 @@ static void machine_set_kernel_irqchip(Object *obj, Visitor *v,
}
static void machine_get_kvm_shadow_mem(Object *obj, Visitor *v,
- void *opaque, const char *name,
+ const char *name, void *opaque,
Error **errp)
{
MachineState *ms = MACHINE(obj);
@@ -79,7 +79,7 @@ static void machine_get_kvm_shadow_mem(Object *obj, Visitor *v,
}
static void machine_set_kvm_shadow_mem(Object *obj, Visitor *v,
- void *opaque, const char *name,
+ const char *name, void *opaque,
Error **errp)
{
MachineState *ms = MACHINE(obj);
@@ -171,8 +171,8 @@ static void machine_set_dumpdtb(Object *obj, const char *value, Error **errp)
}
static void machine_get_phandle_start(Object *obj, Visitor *v,
- void *opaque, const char *name,
- Error **errp)
+ const char *name, void *opaque,
+ Error **errp)
{
MachineState *ms = MACHINE(obj);
int64_t value = ms->phandle_start;
@@ -181,8 +181,8 @@ static void machine_get_phandle_start(Object *obj, Visitor *v,
}
static void machine_set_phandle_start(Object *obj, Visitor *v,
- void *opaque, const char *name,
- Error **errp)
+ const char *name, void *opaque,
+ Error **errp)
{
MachineState *ms = MACHINE(obj);
Error *error = NULL;
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index acbe403c63..e10cede749 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -112,14 +112,14 @@ static char *print_drive(void *ptr)
return g_strdup(blk_name(ptr));
}
-static void get_drive(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
get_pointer(obj, v, opaque, print_drive, name, errp);
}
-static void set_drive(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_drive(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
set_pointer(obj, v, opaque, parse_drive, name, errp);
}
@@ -173,14 +173,14 @@ static char *print_chr(void *ptr)
return g_strdup(val);
}
-static void get_chr(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
get_pointer(obj, v, opaque, print_chr, name, errp);
}
-static void set_chr(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
set_pointer(obj, v, opaque, parse_chr, name, errp);
}
@@ -194,8 +194,8 @@ PropertyInfo qdev_prop_chr = {
};
/* --- netdev device --- */
-static void get_netdev(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_netdev(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -206,8 +206,8 @@ static void get_netdev(Object *obj, Visitor *v, void *opaque,
g_free(p);
}
-static void set_netdev(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_netdev(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -293,8 +293,8 @@ static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t len)
return snprintf(dest, len, "<null>");
}
-static void get_vlan(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_vlan(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -311,8 +311,8 @@ static void get_vlan(Object *obj, Visitor *v, void *opaque,
visit_type_int32(v, name, &id, errp);
}
-static void set_vlan(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_vlan(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 77f354233f..6a9289921f 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -42,8 +42,8 @@ void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
return ptr;
}
-static void get_enum(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_enum(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -53,8 +53,8 @@ static void get_enum(Object *obj, Visitor *v, void *opaque,
prop->info->name, errp);
}
-static void set_enum(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -88,8 +88,8 @@ static void bit_prop_set(DeviceState *dev, Property *props, bool val)
}
}
-static void prop_get_bit(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void prop_get_bit(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -99,8 +99,8 @@ static void prop_get_bit(Object *obj, Visitor *v, void *opaque,
visit_type_bool(v, name, &value, errp);
}
-static void prop_set_bit(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void prop_set_bit(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -146,8 +146,8 @@ static void bit64_prop_set(DeviceState *dev, Property *props, bool val)
}
}
-static void prop_get_bit64(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void prop_get_bit64(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -157,8 +157,8 @@ static void prop_get_bit64(Object *obj, Visitor *v, void *opaque,
visit_type_bool(v, name, &value, errp);
}
-static void prop_set_bit64(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void prop_set_bit64(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -187,8 +187,8 @@ PropertyInfo qdev_prop_bit64 = {
/* --- bool --- */
-static void get_bool(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_bool(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -197,8 +197,8 @@ static void get_bool(Object *obj, Visitor *v, void *opaque,
visit_type_bool(v, name, ptr, errp);
}
-static void set_bool(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_bool(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -220,8 +220,8 @@ PropertyInfo qdev_prop_bool = {
/* --- 8bit integer --- */
-static void get_uint8(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_uint8(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -230,8 +230,8 @@ static void get_uint8(Object *obj, Visitor *v, void *opaque,
visit_type_uint8(v, name, ptr, errp);
}
-static void set_uint8(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_uint8(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -253,8 +253,8 @@ PropertyInfo qdev_prop_uint8 = {
/* --- 16bit integer --- */
-static void get_uint16(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_uint16(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -263,8 +263,8 @@ static void get_uint16(Object *obj, Visitor *v, void *opaque,
visit_type_uint16(v, name, ptr, errp);
}
-static void set_uint16(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_uint16(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -286,8 +286,8 @@ PropertyInfo qdev_prop_uint16 = {
/* --- 32bit integer --- */
-static void get_uint32(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_uint32(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -296,8 +296,8 @@ static void get_uint32(Object *obj, Visitor *v, void *opaque,
visit_type_uint32(v, name, ptr, errp);
}
-static void set_uint32(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_uint32(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -311,8 +311,8 @@ static void set_uint32(Object *obj, Visitor *v, void *opaque,
visit_type_uint32(v, name, ptr, errp);
}
-static void get_int32(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_int32(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -321,8 +321,8 @@ static void get_int32(Object *obj, Visitor *v, void *opaque,
visit_type_int32(v, name, ptr, errp);
}
-static void set_int32(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_int32(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -350,8 +350,8 @@ PropertyInfo qdev_prop_int32 = {
/* --- 64bit integer --- */
-static void get_uint64(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_uint64(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -360,8 +360,8 @@ static void get_uint64(Object *obj, Visitor *v, void *opaque,
visit_type_uint64(v, name, ptr, errp);
}
-static void set_uint64(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_uint64(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -389,8 +389,8 @@ static void release_string(Object *obj, const char *name, void *opaque)
g_free(*(char **)qdev_get_prop_ptr(DEVICE(obj), prop));
}
-static void get_string(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_string(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -404,8 +404,8 @@ static void get_string(Object *obj, Visitor *v, void *opaque,
}
}
-static void set_string(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_string(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -448,8 +448,8 @@ PropertyInfo qdev_prop_ptr = {
* 01:02:03:04:05:06
* 01-02-03-04-05-06
*/
-static void get_mac(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -464,8 +464,8 @@ static void get_mac(Object *obj, Visitor *v, void *opaque,
visit_type_str(v, name, &p, errp);
}
-static void set_mac(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -558,8 +558,8 @@ PropertyInfo qdev_prop_fdc_drive_type = {
/*
* bus-local address, i.e. "$slot" or "$slot.$fn"
*/
-static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -629,8 +629,8 @@ PropertyInfo qdev_prop_pci_devfn = {
/* --- blocksize --- */
-static void set_blocksize(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_blocksize(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -676,8 +676,8 @@ PropertyInfo qdev_prop_blocksize = {
/* --- pci host address --- */
-static void get_pci_host_devaddr(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -697,8 +697,8 @@ static void get_pci_host_devaddr(Object *obj, Visitor *v, void *opaque,
* Parse [<domain>:]<bus>:<slot>.<func>
* if <domain> is not supplied, it's assumed to be 0.
*/
-static void set_pci_host_devaddr(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -811,8 +811,8 @@ static void array_element_release(Object *obj, const char *name, void *opaque)
g_free(p);
}
-static void set_prop_arraylen(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
{
/* Setter for the property which defines the length of a
* variable-sized property array. As well as actually setting the
@@ -1094,8 +1094,8 @@ void qdev_prop_set_globals(DeviceState *dev)
/* --- 64bit unsigned int 'size' type --- */
-static void get_size(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void get_size(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
@@ -1104,8 +1104,8 @@ static void get_size(Object *obj, Visitor *v, void *opaque,
visit_type_size(v, name, ptr, errp);
}
-static void set_size(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void set_size(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index c731bb2032..db41aa1f26 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -893,8 +893,9 @@ char *qdev_get_dev_path(DeviceState *dev)
* Legacy property handling
*/
-static void qdev_get_legacy_property(Object *obj, Visitor *v, void *opaque,
- const char *name, Error **errp)
+static void qdev_get_legacy_property(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;