diff options
Diffstat (limited to 'qemu/hw/core/qdev-properties-system.c')
-rw-r--r-- | qemu/hw/core/qdev-properties-system.c | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/qemu/hw/core/qdev-properties-system.c b/qemu/hw/core/qdev-properties-system.c index 921e799db..891219ae0 100644 --- a/qemu/hw/core/qdev-properties-system.c +++ b/qemu/hw/core/qdev-properties-system.c @@ -10,8 +10,10 @@ * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "net/net.h" #include "hw/qdev.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" @@ -30,7 +32,7 @@ static void get_pointer(Object *obj, Visitor *v, Property *prop, char *p; p = *ptr ? print(*ptr) : g_strdup(""); - visit_type_str(v, &p, name, errp); + visit_type_str(v, name, &p, errp); g_free(p); } @@ -50,7 +52,7 @@ static void set_pointer(Object *obj, Visitor *v, Property *prop, return; } - visit_type_str(v, &str, name, &local_err); + visit_type_str(v, name, &str, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -111,14 +113,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); } @@ -172,14 +174,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); } @@ -193,20 +195,20 @@ 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; NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop); char *p = g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : ""); - visit_type_str(v, &p, name, errp); + visit_type_str(v, name, &p, errp); 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; @@ -222,7 +224,7 @@ static void set_netdev(Object *obj, Visitor *v, void *opaque, return; } - visit_type_str(v, &str, name, &local_err); + visit_type_str(v, name, &str, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -292,8 +294,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; @@ -307,11 +309,11 @@ static void get_vlan(Object *obj, Visitor *v, void *opaque, } } - visit_type_int32(v, &id, name, errp); + 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; @@ -326,7 +328,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque, return; } - visit_type_int32(v, &id, name, &local_err); + visit_type_int32(v, name, &id, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -364,18 +366,6 @@ void qdev_prop_set_drive(DeviceState *dev, const char *name, name, errp); } -void qdev_prop_set_drive_nofail(DeviceState *dev, const char *name, - BlockBackend *value) -{ - Error *err = NULL; - - qdev_prop_set_drive(dev, name, value, &err); - if (err) { - error_report_err(err); - exit(1); - } -} - void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState *value) { |