assert(options != NULL && bs->options != options);
opts = qemu_opts_create(&bdrv_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fail_opts;
/* Process generic block layer options */
opts = qemu_opts_create(&bdrv_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, reopen_state->options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, reopen_state->options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto error;
/* Parse -o options */
if (options) {
- qemu_opts_do_parse(opts, options, NULL, &local_err);
- if (local_err) {
+ if (!qemu_opts_do_parse(opts, options, NULL, &local_err)) {
goto out;
}
}
}
if (base_filename) {
- qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename, &local_err);
- if (local_err) {
+ if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename,
+ &local_err)) {
error_setg(errp, "Backing file not supported for file format '%s'",
fmt);
goto out;
}
if (base_fmt) {
- qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &local_err);
- if (local_err) {
+ if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &local_err)) {
error_setg(errp, "Backing file format not supported for file "
"format '%s'", fmt);
goto out;
uint64_t align;
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto out;
bool log_append;
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
ret = -EINVAL;
error_propagate(errp, local_err);
goto fail;
int ret;
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fail;
bs->file->bs->supported_write_flags;
opts = qemu_opts_create(opts_spec, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
goto cleanup;
}
qemu_mutex_init(&s->mutex);
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
goto out_noclean;
}
OnOffAuto locking;
opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fail;
/* Handle options changes */
opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, state->options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, state->options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto out;
s->type = FTYPE_FILE;
opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fail;
QemuOpts *opts = qemu_opts_create(&raw_runtime_opts, NULL, 0,
&error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto done;
/* create opts info from runtime_json_opts list */
opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
goto out;
}
/* create opts info from runtime_type_opts list */
opts = qemu_opts_create(&runtime_type_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, backing_options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, backing_options, &local_err)) {
goto out;
}
if (gsconf->type == SOCKET_ADDRESS_TYPE_INET) {
/* create opts info from runtime_inet_opts list */
opts = qemu_opts_create(&runtime_inet_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, backing_options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, backing_options, &local_err)) {
goto out;
}
} else {
/* create opts info from runtime_unix_opts list */
opts = qemu_opts_create(&runtime_unix_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, backing_options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, backing_options, &local_err)) {
goto out;
}
const char *filename, *logfile;
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto out;
int i, ret = 0, timeout = 0, lun;
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto out;
int ret = -EINVAL;
opts = qemu_opts_create(&nbd_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
goto error;
}
goto fail_options;
}
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err != NULL) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
goto fail_options;
}
encryptfmt = qdict_get_try_str(encryptopts, "format");
opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fail;
}
opts = qemu_opts_create(&quorum_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
ret = -EINVAL;
goto exit;
}
int ret;
opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto end;
ret = -EINVAL;
opts = qemu_opts_create(&replication_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
goto fail;
}
s->aio_context = bdrv_get_aio_context(bs);
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto err_no_fd;
/* Translate legacy options */
opts = qemu_opts_create(&ssh_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
goto fail;
}
Error *local_err = NULL;
QemuOpts *opts = qemu_opts_create(&throttle_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fin;
}
opts = qemu_opts_create(&vpc_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fail;
#endif
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
error_propagate(errp, local_err);
ret = -EINVAL;
goto fail;
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
tcp_opts = qemu_opts_create(&runtime_tcp_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
ret = -EINVAL;
goto out;
}
/* get the 'server.' arguments */
qdict_extract_subqdict(options, &backing_options, VXHS_OPT_SERVER".");
- qemu_opts_absorb_qdict(tcp_opts, backing_options, &local_err);
- if (local_err != NULL) {
+ if (!qemu_opts_absorb_qdict(tcp_opts, backing_options, &local_err)) {
ret = -EINVAL;
goto out;
}
goto err_no_opts;
}
- qemu_opts_absorb_qdict(opts, bs_opts, &error);
- if (error) {
+ if (!qemu_opts_absorb_qdict(opts, bs_opts, &error)) {
error_propagate(errp, error);
goto early_err;
}
};
for (i = 0; i < ARRAY_SIZE(opt_renames); i++) {
- qemu_opt_rename(all_opts, opt_renames[i].from, opt_renames[i].to,
- &local_err);
- if (local_err) {
+ if (!qemu_opt_rename(all_opts, opt_renames[i].from,
+ opt_renames[i].to, &local_err)) {
error_propagate(errp, local_err);
return NULL;
}
legacy_opts = qemu_opts_create(&qemu_legacy_drive_opts, NULL, 0,
&error_abort);
- qemu_opts_absorb_qdict(legacy_opts, bs_opts, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(legacy_opts, bs_opts, &local_err)) {
error_propagate(errp, local_err);
goto fail;
}
qemu_opt_set(opts, "host", host, &error_abort);
qemu_opt_set(opts, "port", port, &error_abort);
if (p[pos] == ',') {
- qemu_opts_do_parse(opts, p+pos+1, NULL, &local_err);
- if (local_err) {
+ if (!qemu_opts_do_parse(opts, p + pos + 1, NULL, &local_err)) {
error_report_err(local_err);
goto fail;
}
}
if (strstart(filename, "unix:", &p)) {
qemu_opt_set(opts, "backend", "socket", &error_abort);
- qemu_opts_do_parse(opts, p, "path", &local_err);
- if (local_err) {
+ if (!qemu_opts_do_parse(opts, p, "path", &local_err)) {
error_report_err(local_err);
goto fail;
}
break;
case 'l': /* shm size */
- parse_option_size("shm_size", optarg, &args->shm_size, &err);
- if (err) {
+ if (!parse_option_size("shm_size", optarg, &args->shm_size,
+ &err)) {
error_report_err(err);
ivshmem_server_help(argv[0]);
exit(1);
}
qdev_set_parent_bus(n->primary_dev, n->primary_bus);
n->primary_should_be_hidden = false;
- qemu_opt_set_bool(n->primary_device_opts,
- "partially_hotplugged", true, &err);
- if (err) {
+ if (!qemu_opt_set_bool(n->primary_device_opts,
+ "partially_hotplugged", true, &err)) {
goto out;
}
hotplug_ctrl = qdev_get_hotplug_handler(n->primary_dev);
int size;
struct smbios_table *table; /* legacy mode only */
- qemu_opts_validate(opts, qemu_smbios_file_opts, &err);
- if (err) {
+ if (!qemu_opts_validate(opts, qemu_smbios_file_opts, &err)) {
error_propagate(errp, err);
return;
}
switch (type) {
case 0:
- qemu_opts_validate(opts, qemu_smbios_type0_opts, &err);
- if (err) {
+ if (!qemu_opts_validate(opts, qemu_smbios_type0_opts, &err)) {
error_propagate(errp, err);
return;
}
}
return;
case 1:
- qemu_opts_validate(opts, qemu_smbios_type1_opts, &err);
- if (err) {
+ if (!qemu_opts_validate(opts, qemu_smbios_type1_opts, &err)) {
error_propagate(errp, err);
return;
}
}
return;
case 2:
- qemu_opts_validate(opts, qemu_smbios_type2_opts, &err);
- if (err) {
+ if (!qemu_opts_validate(opts, qemu_smbios_type2_opts, &err)) {
error_propagate(errp, err);
return;
}
save_opt(&type2.location, opts, "location");
return;
case 3:
- qemu_opts_validate(opts, qemu_smbios_type3_opts, &err);
- if (err) {
+ if (!qemu_opts_validate(opts, qemu_smbios_type3_opts, &err)) {
error_propagate(errp, err);
return;
}
save_opt(&type3.sku, opts, "sku");
return;
case 4:
- qemu_opts_validate(opts, qemu_smbios_type4_opts, &err);
- if (err) {
+ if (!qemu_opts_validate(opts, qemu_smbios_type4_opts, &err)) {
error_propagate(errp, err);
return;
}
save_opt(&type4.part, opts, "part");
return;
case 11:
- qemu_opts_validate(opts, qemu_smbios_type11_opts, &err);
- if (err) {
+ if (!qemu_opts_validate(opts, qemu_smbios_type11_opts, &err)) {
error_propagate(errp, err);
return;
}
save_opt_list(&type11.nvalues, &type11.values, opts, "value");
return;
case 17:
- qemu_opts_validate(opts, qemu_smbios_type17_opts, &err);
- if (err) {
+ if (!qemu_opts_validate(opts, qemu_smbios_type17_opts, &err)) {
error_propagate(errp, err);
return;
}
uint64_t val;
assert(siv->lm == LM_NONE);
- parse_option_size(name, siv->string, &val, &err);
- if (err) {
+ if (!parse_option_size(name, siv->string, &val, &err)) {
error_propagate(errp, err);
return;
}
Error *err = NULL;
if (base_filename) {
- qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename, &err);
- if (err) {
+ if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename,
+ &err)) {
error_report("Backing file not supported for file format '%s'",
fmt);
error_free(err);
}
}
if (base_fmt) {
- qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &err);
- if (err) {
+ if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &err)) {
error_report("Backing file format not supported for file "
"format '%s'", fmt);
error_free(err);
opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
if (options) {
- qemu_opts_do_parse(opts, options, NULL, &local_err);
- if (local_err) {
+ if (!qemu_opts_do_parse(opts, options, NULL, &local_err)) {
error_report_err(local_err);
ret = -1;
goto out;
/* Parse size */
param = qemu_opts_create(&resize_options, NULL, 0, &error_abort);
- qemu_opt_set(param, BLOCK_OPT_SIZE, size, &err);
- if (err) {
+ if (!qemu_opt_set(param, BLOCK_OPT_SIZE, size, &err)) {
error_report_err(err);
ret = -1;
qemu_opts_del(param);
amend_opts = qemu_opts_append(amend_opts, bs->drv->amend_opts);
opts = qemu_opts_create(amend_opts, NULL, 0, &error_abort);
- qemu_opts_do_parse(opts, options, NULL, &err);
-
- if (err) {
+ if (!qemu_opts_do_parse(opts, options, NULL, &err)) {
/* Try to parse options using the create options */
Error *err1 = NULL;
amend_opts = qemu_opts_append(amend_opts, bs->drv->create_opts);
create_opts = qemu_opts_append(create_opts, bdrv_file.create_opts);
opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
if (options) {
- qemu_opts_do_parse(opts, options, NULL, &local_err);
- if (local_err) {
+ if (!qemu_opts_do_parse(opts, options, NULL, &local_err)) {
error_report_err(local_err);
error_report("Invalid options for file format '%s'", out_fmt);
goto out;
}
/* validate backend specific opts */
- qemu_opts_validate(opts, be->opts, &local_err);
- if (local_err) {
+ if (!qemu_opts_validate(opts, be->opts, &local_err)) {
error_propagate(errp, local_err);
return 1;
}
return -1;
}
- qemu_opt_set(opts, arg, str + offset + 1, &local_err);
- if (local_err) {
+ if (!qemu_opt_set(opts, arg, str + offset + 1, &local_err)) {
error_report_err(local_err);
return -1;
}
error_report("no group defined");
goto out;
}
- qemu_opt_set(opts, arg, value, &local_err);
- if (local_err) {
+ if (!qemu_opt_set(opts, arg, value, &local_err)) {
error_report_err(local_err);
goto out;
}
goto out;
}
- qemu_opts_absorb_qdict(subopts, subqdict, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(subopts, subqdict, &local_err)) {
error_propagate(errp, local_err);
goto out;
}
goto out;
}
- qemu_opts_absorb_qdict(subopts, section, &local_err);
- if (local_err) {
+ if (!qemu_opts_absorb_qdict(subopts, section, &local_err)) {
error_propagate(errp, local_err);
qemu_opts_del(subopts);
goto out;
}
opt->desc = desc;
- qemu_opt_parse(opt, &local_err);
- if (local_err) {
+ if (!qemu_opt_parse(opt, &local_err)) {
error_propagate(errp, local_err);
return false;
}
return NULL;
}
- opts_do_parse(opts, params, firstname, defaults, help_wanted, &local_err);
- if (local_err) {
+ if (!opts_do_parse(opts, params, firstname, defaults, help_wanted,
+ &local_err)) {
error_propagate(errp, local_err);
qemu_opts_del(opts);
return NULL;
for (entry = qdict_first(qdict);
entry;
entry = qdict_next(qdict, entry)) {
- qemu_opts_from_qdict_entry(opts, entry, &local_err);
- if (local_err) {
+ if (!qemu_opts_from_qdict_entry(opts, entry, &local_err)) {
error_propagate(errp, local_err);
qemu_opts_del(opts);
return NULL;
next = qdict_next(qdict, entry);
if (find_desc_by_name(opts->list->desc, entry->key)) {
- qemu_opts_from_qdict_entry(opts, entry, &local_err);
- if (local_err) {
+ if (!qemu_opts_from_qdict_entry(opts, entry, &local_err)) {
error_propagate(errp, local_err);
return false;
}
return false;
}
- qemu_opt_parse(opt, &local_err);
- if (local_err) {
+ if (!qemu_opt_parse(opt, &local_err)) {
error_propagate(errp, local_err);
return false;
}