Commit 133fe774 authored by Edgar E. Iglesias's avatar Edgar E. Iglesias

Merge remote branch 'luiz/queue/qmp' into qmpq

* luiz/queue/qmp:
  migration: qmp_migrate(): keep working after syntax error
  qerror: Remove assert_no_error()
  qemu-option: Remove qemu_opts_create_nofail
  target-i386: Remove assert_no_error usage
  hw: Remove assert_no_error usages
  qdev: Delete dead code
  error: Add error_abort
  monitor: add object-add (QMP) and object_add (HMP) command
  monitor: add object-del (QMP) and object_del (HMP) command
  qom: catch errors in object_property_add_child
  qom: fix leak for objects created with -object
  rng: initialize file descriptor to -1
  qemu-monitor: HMP cpu-add wrapper
  vl: add missing transition debug->finish_migrate

Message-Id: 1389045795-18706-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: default avatarEdgar E. Iglesias <edgar.iglesias@xilinx.com>
parents 73c69456 c9501142
...@@ -123,15 +123,15 @@ static void rng_random_init(Object *obj) ...@@ -123,15 +123,15 @@ static void rng_random_init(Object *obj)
NULL); NULL);
s->filename = g_strdup("/dev/random"); s->filename = g_strdup("/dev/random");
s->fd = -1;
} }
static void rng_random_finalize(Object *obj) static void rng_random_finalize(Object *obj)
{ {
RndRandom *s = RNG_RANDOM(obj); RndRandom *s = RNG_RANDOM(obj);
qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
if (s->fd != -1) { if (s->fd != -1) {
qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
qemu_close(s->fd); qemu_close(s->fd);
} }
......
...@@ -359,7 +359,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -359,7 +359,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
const char *filename, *config; const char *filename, *config;
int ret; int ret;
opts = qemu_opts_create_nofail(&runtime_opts); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
error_propagate(errp, local_err); error_propagate(errp, local_err);
......
...@@ -125,7 +125,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -125,7 +125,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
const char *filename, *raw; const char *filename, *raw;
int ret; int ret;
opts = qemu_opts_create_nofail(&runtime_opts); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
error_propagate(errp, local_err); error_propagate(errp, local_err);
......
...@@ -413,7 +413,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -413,7 +413,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
return -EROFS; return -EROFS;
} }
opts = qemu_opts_create_nofail(&runtime_opts); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
qerror_report_err(local_err); qerror_report_err(local_err);
......
...@@ -298,7 +298,7 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options, ...@@ -298,7 +298,7 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options,
Error *local_err = NULL; Error *local_err = NULL;
const char *filename; const char *filename;
opts = qemu_opts_create_nofail(&runtime_opts); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
qerror_report_err(local_err); qerror_report_err(local_err);
......
...@@ -1121,7 +1121,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -1121,7 +1121,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
return -EINVAL; return -EINVAL;
} }
opts = qemu_opts_create_nofail(&runtime_opts); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
qerror_report_err(local_err); qerror_report_err(local_err);
......
...@@ -205,7 +205,8 @@ static int nbd_config(BDRVNBDState *s, QDict *options, char **export) ...@@ -205,7 +205,8 @@ static int nbd_config(BDRVNBDState *s, QDict *options, char **export)
return -EINVAL; return -EINVAL;
} }
s->socket_opts = qemu_opts_create_nofail(&socket_optslist); s->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0,
&error_abort);
qemu_opts_absorb_qdict(s->socket_opts, options, &local_err); qemu_opts_absorb_qdict(s->socket_opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
......
...@@ -669,7 +669,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -669,7 +669,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
} }
/* Enable lazy_refcounts according to image and command line options */ /* Enable lazy_refcounts according to image and command line options */
opts = qemu_opts_create_nofail(&qcow2_runtime_opts); opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
error_propagate(errp, local_err); error_propagate(errp, local_err);
......
...@@ -287,7 +287,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, ...@@ -287,7 +287,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
int fd, ret; int fd, ret;
struct stat st; struct stat st;
opts = qemu_opts_create_nofail(&raw_runtime_opts); opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
error_propagate(errp, local_err); error_propagate(errp, local_err);
......
...@@ -248,7 +248,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -248,7 +248,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
s->type = FTYPE_FILE; s->type = FTYPE_FILE;
opts = qemu_opts_create_nofail(&raw_runtime_opts); opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
error_propagate(errp, local_err); error_propagate(errp, local_err);
...@@ -550,7 +550,8 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -550,7 +550,8 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
Error *local_err = NULL; Error *local_err = NULL;
const char *filename; const char *filename;
QemuOpts *opts = qemu_opts_create_nofail(&raw_runtime_opts); QemuOpts *opts = qemu_opts_create(&raw_runtime_opts, NULL, 0,
&error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
error_propagate(errp, local_err); error_propagate(errp, local_err);
......
...@@ -461,7 +461,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -461,7 +461,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
const char *filename; const char *filename;
int r; int r;
opts = qemu_opts_create_nofail(&runtime_opts); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
qerror_report_err(local_err); qerror_report_err(local_err);
......
...@@ -1383,7 +1383,7 @@ static int sd_open(BlockDriverState *bs, QDict *options, int flags, ...@@ -1383,7 +1383,7 @@ static int sd_open(BlockDriverState *bs, QDict *options, int flags,
s->bs = bs; s->bs = bs;
opts = qemu_opts_create_nofail(&runtime_opts); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
qerror_report_err(local_err); qerror_report_err(local_err);
......
...@@ -1083,7 +1083,7 @@ DLOG(if (stderr == NULL) { ...@@ -1083,7 +1083,7 @@ DLOG(if (stderr == NULL) {
setbuf(stderr, NULL); setbuf(stderr, NULL);
}) })
opts = qemu_opts_create_nofail(&runtime_opts); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err); qemu_opts_absorb_qdict(opts, options, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
qerror_report_err(local_err); qerror_report_err(local_err);
......
...@@ -682,7 +682,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type) ...@@ -682,7 +682,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
bs_opts = qdict_new(); bs_opts = qdict_new();
qemu_opts_to_qdict(all_opts, bs_opts); qemu_opts_to_qdict(all_opts, bs_opts);
legacy_opts = qemu_opts_create_nofail(&qemu_legacy_drive_opts); legacy_opts = qemu_opts_create(&qemu_legacy_drive_opts, NULL, 0,
&error_abort);
qemu_opts_absorb_qdict(legacy_opts, bs_opts, &local_err); qemu_opts_absorb_qdict(legacy_opts, bs_opts, &local_err);
if (error_is_set(&local_err)) { if (error_is_set(&local_err)) {
qerror_report_err(local_err); qerror_report_err(local_err);
...@@ -853,7 +854,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type) ...@@ -853,7 +854,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
if (type == IF_VIRTIO) { if (type == IF_VIRTIO) {
QemuOpts *devopts; QemuOpts *devopts;
devopts = qemu_opts_create_nofail(qemu_find_opts("device")); devopts = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
&error_abort);
if (arch_type == QEMU_ARCH_S390X) { if (arch_type == QEMU_ARCH_S390X) {
qemu_opt_set(devopts, "driver", "virtio-blk-s390"); qemu_opt_set(devopts, "driver", "virtio-blk-s390");
} else { } else {
......
...@@ -1241,6 +1241,34 @@ STEXI ...@@ -1241,6 +1241,34 @@ STEXI
@item netdev_del @item netdev_del
@findex netdev_del @findex netdev_del
Remove host network device. Remove host network device.
ETEXI
{
.name = "object_add",
.args_type = "object:O",
.params = "[qom-type=]type,id=str[,prop=value][,...]",
.help = "create QOM object",
.mhandler.cmd = hmp_object_add,
},
STEXI
@item object_add
@findex object_add
Create QOM object.
ETEXI
{
.name = "object_del",
.args_type = "id:s",
.params = "id",
.help = "destroy QOM object",
.mhandler.cmd = hmp_object_del,
},
STEXI
@item object_del
@findex object_del
Destroy QOM object.
ETEXI ETEXI
#ifdef CONFIG_SLIRP #ifdef CONFIG_SLIRP
...@@ -1617,6 +1645,19 @@ STEXI ...@@ -1617,6 +1645,19 @@ STEXI
Executes a qemu-io command on the given block device. Executes a qemu-io command on the given block device.
ETEXI
{
.name = "cpu-add",
.args_type = "id:i",
.params = "id",
.help = "add cpu",
.mhandler.cmd = hmp_cpu_add,
},
STEXI
@item cpu-add @var{id}
Add CPU with id @var{id}
ETEXI ETEXI
{ {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "qmp-commands.h" #include "qmp-commands.h"
#include "qemu/sockets.h" #include "qemu/sockets.h"
#include "monitor/monitor.h" #include "monitor/monitor.h"
#include "qapi/opts-visitor.h"
#include "ui/console.h" #include "ui/console.h"
#include "block/qapi.h" #include "block/qapi.h"
#include "qemu-io.h" #include "qemu-io.h"
...@@ -1354,6 +1355,63 @@ void hmp_netdev_del(Monitor *mon, const QDict *qdict) ...@@ -1354,6 +1355,63 @@ void hmp_netdev_del(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &err); hmp_handle_error(mon, &err);
} }
void hmp_object_add(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
QemuOpts *opts;
char *type = NULL;
char *id = NULL;
void *dummy = NULL;
OptsVisitor *ov;
QDict *pdict;
opts = qemu_opts_from_qdict(qemu_find_opts("object"), qdict, &err);
if (err) {
goto out;
}
ov = opts_visitor_new(opts);
pdict = qdict_clone_shallow(qdict);
visit_start_struct(opts_get_visitor(ov), &dummy, NULL, NULL, 0, &err);
if (err) {
goto out_clean;
}
qdict_del(pdict, "qom-type");
visit_type_str(opts_get_visitor(ov), &type, "qom-type", &err);
if (err) {
goto out_clean;
}
qdict_del(pdict, "id");
visit_type_str(opts_get_visitor(ov), &id, "id", &err);
if (err) {
goto out_clean;
}
object_add(type, id, pdict, opts_get_visitor(ov), &err);
if (err) {
goto out_clean;
}
visit_end_struct(opts_get_visitor(ov), &err);
if (err) {
qmp_object_del(id, NULL);
}
out_clean:
opts_visitor_cleanup(ov);
QDECREF(pdict);
qemu_opts_del(opts);
g_free(id);
g_free(type);
g_free(dummy);
out:
hmp_handle_error(mon, &err);
}
void hmp_getfd(Monitor *mon, const QDict *qdict) void hmp_getfd(Monitor *mon, const QDict *qdict)
{ {
const char *fdname = qdict_get_str(qdict, "fdname"); const char *fdname = qdict_get_str(qdict, "fdname");
...@@ -1525,6 +1583,16 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict) ...@@ -1525,6 +1583,16 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &errp); hmp_handle_error(mon, &errp);
} }
void hmp_cpu_add(Monitor *mon, const QDict *qdict)
{
int cpuid;
Error *err = NULL;
cpuid = qdict_get_int(qdict, "id");
qmp_cpu_add(cpuid, &err);
hmp_handle_error(mon, &err);
}
void hmp_chardev_add(Monitor *mon, const QDict *qdict) void hmp_chardev_add(Monitor *mon, const QDict *qdict)
{ {
const char *args = qdict_get_str(qdict, "args"); const char *args = qdict_get_str(qdict, "args");
...@@ -1564,3 +1632,12 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict) ...@@ -1564,3 +1632,12 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &err); hmp_handle_error(mon, &err);
} }
void hmp_object_del(Monitor *mon, const QDict *qdict)
{
const char *id = qdict_get_str(qdict, "id");
Error *err = NULL;
qmp_object_del(id, &err);
hmp_handle_error(mon, &err);
}
...@@ -89,5 +89,8 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict); ...@@ -89,5 +89,8 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict);
void hmp_chardev_add(Monitor *mon, const QDict *qdict); void hmp_chardev_add(Monitor *mon, const QDict *qdict);
void hmp_chardev_remove(Monitor *mon, const QDict *qdict); void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
void hmp_qemu_io(Monitor *mon, const QDict *qdict); void hmp_qemu_io(Monitor *mon, const QDict *qdict);
void hmp_cpu_add(Monitor *mon, const QDict *qdict);
void hmp_object_add(Monitor *mon, const QDict *qdict);
void hmp_object_del(Monitor *mon, const QDict *qdict);
#endif #endif
...@@ -352,21 +352,17 @@ void qdev_prop_set_drive_nofail(DeviceState *dev, const char *name, ...@@ -352,21 +352,17 @@ void qdev_prop_set_drive_nofail(DeviceState *dev, const char *name,
void qdev_prop_set_chr(DeviceState *dev, const char *name, void qdev_prop_set_chr(DeviceState *dev, const char *name,
CharDriverState *value) CharDriverState *value)
{ {
Error *errp = NULL;
assert(!value || value->label); assert(!value || value->label);
object_property_set_str(OBJECT(dev), object_property_set_str(OBJECT(dev),
value ? value->label : "", name, &errp); value ? value->label : "", name, &error_abort);
assert_no_error(errp);
} }
void qdev_prop_set_netdev(DeviceState *dev, const char *name, void qdev_prop_set_netdev(DeviceState *dev, const char *name,
NetClientState *value) NetClientState *value)
{ {
Error *errp = NULL;
assert(!value || value->name); assert(!value || value->name);
object_property_set_str(OBJECT(dev), object_property_set_str(OBJECT(dev),
value ? value->name : "", name, &errp); value ? value->name : "", name, &error_abort);
assert_no_error(errp);
} }
void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd) void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
......
...@@ -1003,73 +1003,55 @@ void qdev_prop_parse(DeviceState *dev, const char *name, const char *value, ...@@ -1003,73 +1003,55 @@ void qdev_prop_parse(DeviceState *dev, const char *name, const char *value,
void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value) void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value)
{ {
Error *errp = NULL; object_property_set_bool(OBJECT(dev), value, name, &error_abort);
object_property_set_bool(OBJECT(dev), value, name, &errp);
assert_no_error(errp);
} }
void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value) void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value)
{ {
Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &error_abort);
object_property_set_int(OBJECT(dev), value, name, &errp);
assert_no_error(errp);
} }
void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value) void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value)
{ {
Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &error_abort);
object_property_set_int(OBJECT(dev), value, name, &errp);
assert_no_error(errp);
} }
void qdev_prop_set_uint32(DeviceState *dev, const char *name, uint32_t value) void qdev_prop_set_uint32(DeviceState *dev, const char *name, uint32_t value)
{ {
Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &error_abort);
object_property_set_int(OBJECT(dev), value, name, &errp);
assert_no_error(errp);
} }
void qdev_prop_set_int32(DeviceState *dev, const char *name, int32_t value) void qdev_prop_set_int32(DeviceState *dev, const char *name, int32_t value)
{ {
Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &error_abort);
object_property_set_int(OBJECT(dev), value, name, &errp);
assert_no_error(errp);
} }
void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value) void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value)
{ {
Error *errp = NULL; object_property_set_int(OBJECT(dev), value, name, &error_abort);
object_property_set_int(OBJECT(dev), value, name, &errp);
assert_no_error(errp);
} }
void qdev_prop_set_string(DeviceState *dev, const char *name, const char *value) void qdev_prop_set_string(DeviceState *dev, const char *name, const char *value)
{ {
Error *errp = NULL; object_property_set_str(OBJECT(dev), value, name, &error_abort);
object_property_set_str(OBJECT(dev), value, name, &errp);
assert_no_error(errp);
} }
void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value) void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value)
{ {
Error *errp = NULL;
char str[2 * 6 + 5 + 1]; char str[2 * 6 + 5 + 1];
snprintf(str, sizeof(str), "%02x:%02x:%02x:%02x:%02x:%02x", snprintf(str, sizeof(str), "%02x:%02x:%02x:%02x:%02x:%02x",
value[0], value[1], value[2], value[3], value[4], value[5]); value[0], value[1], value[2], value[3], value[4], value[5]);
object_property_set_str(OBJECT(dev), str, name, &errp); object_property_set_str(OBJECT(dev), str, name, &error_abort);
assert_no_error(errp);
} }
void qdev_prop_set_enum(DeviceState *dev, const char *name, int value) void qdev_prop_set_enum(DeviceState *dev, const char *name, int value)
{ {
Property *prop; Property *prop;
Error *errp = NULL;
prop = qdev_prop_find(dev, name); prop = qdev_prop_find(dev, name);
object_property_set_str(OBJECT(dev), prop->info->enum_table[value], object_property_set_str(OBJECT(dev), prop->info->enum_table[value],
name, &errp); name, &error_abort);
assert_no_error(errp);
} }
void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value) void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value)
...@@ -1161,12 +1143,10 @@ static void set_size(Object *obj, Visitor *v, void *opaque, ...@@ -1161,12 +1143,10 @@ static void set_size(Object *obj, Visitor *v, void *opaque,
static int parse_size(DeviceState *dev, Property *prop, const char *str) static int parse_size(DeviceState *dev, Property *prop, const char *str)
{ {
uint64_t *ptr = qdev_get_prop_ptr(dev, prop); uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
Error *errp = NULL;
if (str != NULL) { if (str != NULL) {
parse_option_size(prop->name, str, ptr, &errp); parse_option_size(prop->name, str, ptr, &error_abort);
} }
assert_no_error(errp);
return 0; return 0;
} }
......
...@@ -672,14 +672,13 @@ void qdev_property_add_static(DeviceState *dev, Property *prop, ...@@ -672,14 +672,13 @@ void qdev_property_add_static(DeviceState *dev, Property *prop,
} }
if (prop->qtype == QTYPE_QBOOL) { if (prop->qtype == QTYPE_QBOOL) {
object_property_set_bool(obj, prop->defval, prop->name, &local_err); object_property_set_bool(obj, prop->defval, prop->name, &error_abort);
} else if (prop->info->enum_table) { } else if (prop->info->enum_table) {
object_property_set_str(obj, prop->info->enum_table[prop->defval], object_property_set_str(obj, prop->info->enum_table[prop->defval],
prop->name, &local_err); prop->name, &error_abort);
} else if (prop->qtype == QTYPE_QINT) { } else if (prop->qtype == QTYPE_QINT) {
object_property_set_int(obj, prop->defval, prop->name, &local_err); object_property_set_int(obj, prop->defval, prop->name, &error_abort);
} }
assert_no_error(local_err);
} }
static bool device_get_realized(Object *obj, Error **err) static bool device_get_realized(Object *obj, Error **err)
...@@ -739,7 +738,6 @@ static void device_initfn(Object *obj) ...@@ -739,7 +738,6 @@ static void device_initfn(Object *obj)
DeviceState *dev = DEVICE(obj); DeviceState *dev = DEVICE(obj);
ObjectClass *class; ObjectClass *class;
Property *prop; Property *prop;
Error *err = NULL;
if (qdev_hotplug) { if (qdev_hotplug) {
dev->hotplugged = 1; dev->hotplugged = 1;
...@@ -755,31 +753,19 @@ static void device_initfn(Object *obj) ...@@ -755,31 +753,19 @@ static void device_initfn(Object *obj)
class = object_get_class(OBJECT(dev)); class = object_get_class(OBJECT(dev));
do { 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, &err); qdev_property_add_legacy(dev, prop, &error_abort);
assert_no_error(err); qdev_property_add_static(dev, prop, &error_abort);
qdev_property_add_static(dev, prop, &err);
assert_no_error(err);
} }
class = object_class_get_parent(class); class = object_class_get_parent(class);
} while (class != object_class_by_name(TYPE_DEVICE)); } while (class != object_class_by_name(TYPE_DEVICE));
if (err != NULL) {
qerror_report_err(err);
error_free(err);
exit(1);
}
object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS, object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS,
(Object **)&dev->parent_bus, &err); (Object **)&dev->parent_bus, &error_abort);
assert_no_error(err);
} }
static void device_post_init(Object *obj) static void device_post_init(Object *obj)
{ {
DeviceState *dev = DEVICE(obj); qdev_prop_set_globals(DEVICE(obj), &error_abort);
Error *err = NULL;
qdev_prop_set_globals(dev, &err);
assert_no_error(err);
} }
/* Unlink device from bus and free the structure. */ /* Unlink device from bus and free the structure. */
......
...@@ -569,26 +569,21 @@ static void xilinx_axidma_init(Object *obj) ...@@ -569,26 +569,21 @@ static void xilinx_axidma_init(Object *obj)
{ {
XilinxAXIDMA *s = XILINX_AXI_DMA(obj); XilinxAXIDMA *s = XILINX_AXI_DMA(obj);
SysBusDevice *sbd = SYS_BUS_DEVICE(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
Error *errp = NULL;
object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE,