mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
qemu-option: Remove qemu_opts_create_nofail
This is a boiler-plate _nofail variant of qemu_opts_create. Remove and use error_abort in call sites. null/0 arguments needs to be added for the id and fail_if_exists fields in affected callsites due to argument inconsistency between the normal and no_fail variants. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
committed by
Luiz Capitulino
parent
00b8105324
commit
87ea75d5e1
+1
-1
@@ -359,7 +359,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
const char *filename, *config;
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
const char *filename, *raw;
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
|
||||
+1
-1
@@ -413,7 +413,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
qerror_report_err(local_err);
|
||||
|
||||
+1
-1
@@ -298,7 +298,7 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options,
|
||||
Error *local_err = NULL;
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
qerror_report_err(local_err);
|
||||
|
||||
+1
-1
@@ -1109,7 +1109,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
qerror_report_err(local_err);
|
||||
|
||||
+2
-1
@@ -205,7 +205,8 @@ static int nbd_config(BDRVNBDState *s, QDict *options, char **export)
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
|
||||
+1
-1
@@ -669,7 +669,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
}
|
||||
|
||||
/* 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);
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
|
||||
+1
-1
@@ -287,7 +287,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
|
||||
int fd, ret;
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
|
||||
+3
-2
@@ -248,7 +248,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
@@ -550,7 +550,8 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error *local_err = NULL;
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
|
||||
+1
-1
@@ -461,7 +461,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
const char *filename;
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
qerror_report_err(local_err);
|
||||
|
||||
+1
-1
@@ -1383,7 +1383,7 @@ static int sd_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
qerror_report_err(local_err);
|
||||
|
||||
+1
-1
@@ -1083,7 +1083,7 @@ DLOG(if (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);
|
||||
if (error_is_set(&local_err)) {
|
||||
qerror_report_err(local_err);
|
||||
|
||||
+4
-2
@@ -682,7 +682,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
bs_opts = qdict_new();
|
||||
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);
|
||||
if (error_is_set(&local_err)) {
|
||||
qerror_report_err(local_err);
|
||||
@@ -853,7 +854,8 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
|
||||
if (type == IF_VIRTIO) {
|
||||
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) {
|
||||
qemu_opt_set(devopts, "driver", "virtio-blk-s390");
|
||||
} else {
|
||||
|
||||
@@ -66,7 +66,8 @@ int select_watchdog(const char *p)
|
||||
QLIST_FOREACH(model, &watchdog_list, entry) {
|
||||
if (strcasecmp(model->wdt_name, p) == 0) {
|
||||
/* add the device */
|
||||
opts = qemu_opts_create_nofail(qemu_find_opts("device"));
|
||||
opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
|
||||
&error_abort);
|
||||
qemu_opt_set(opts, "driver", p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,6 @@ int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
|
||||
QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id);
|
||||
QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
|
||||
int fail_if_exists, Error **errp);
|
||||
QemuOpts *qemu_opts_create_nofail(QemuOptsList *list);
|
||||
void qemu_opts_reset(QemuOptsList *list);
|
||||
void qemu_opts_loc_restore(QemuOpts *opts);
|
||||
int qemu_opts_set(QemuOptsList *list, const char *id,
|
||||
|
||||
+1
-1
@@ -730,7 +730,7 @@ int qemu_global_option(const char *str)
|
||||
return -1;
|
||||
}
|
||||
|
||||
opts = qemu_opts_create_nofail(&qemu_global_opts);
|
||||
opts = qemu_opts_create(&qemu_global_opts, NULL, 0, &error_abort);
|
||||
qemu_opt_set(opts, "driver", driver);
|
||||
qemu_opt_set(opts, "property", property);
|
||||
qemu_opt_set(opts, "value", str+offset+1);
|
||||
|
||||
+1
-1
@@ -2564,7 +2564,7 @@ static int img_resize(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Parse size */
|
||||
param = qemu_opts_create_nofail(&resize_options);
|
||||
param = qemu_opts_create(&resize_options, NULL, 0, &error_abort);
|
||||
if (qemu_opt_set(param, BLOCK_OPT_SIZE, size)) {
|
||||
/* Error message already printed when size parsing fails */
|
||||
ret = -1;
|
||||
|
||||
+1
-1
@@ -311,7 +311,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)
|
||||
error_free(local_err);
|
||||
goto out;
|
||||
}
|
||||
opts = qemu_opts_create_nofail(list);
|
||||
opts = qemu_opts_create(list, NULL, 0, &error_abort);
|
||||
continue;
|
||||
}
|
||||
if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2) {
|
||||
|
||||
@@ -791,15 +791,6 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
|
||||
return opts;
|
||||
}
|
||||
|
||||
QemuOpts *qemu_opts_create_nofail(QemuOptsList *list)
|
||||
{
|
||||
QemuOpts *opts;
|
||||
Error *errp = NULL;
|
||||
opts = qemu_opts_create(list, NULL, 0, &errp);
|
||||
assert_no_error(errp);
|
||||
return opts;
|
||||
}
|
||||
|
||||
void qemu_opts_reset(QemuOptsList *list)
|
||||
{
|
||||
QemuOpts *opts, *next_opts;
|
||||
|
||||
+9
-9
@@ -578,7 +578,7 @@ int inet_listen(const char *str, char *ostr, int olen,
|
||||
|
||||
addr = inet_parse(str, errp);
|
||||
if (addr != NULL) {
|
||||
opts = qemu_opts_create_nofail(&socket_optslist);
|
||||
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
|
||||
inet_addr_to_opts(opts, addr);
|
||||
qapi_free_InetSocketAddress(addr);
|
||||
sock = inet_listen_opts(opts, port_offset, errp);
|
||||
@@ -617,7 +617,7 @@ int inet_connect(const char *str, Error **errp)
|
||||
|
||||
addr = inet_parse(str, errp);
|
||||
if (addr != NULL) {
|
||||
opts = qemu_opts_create_nofail(&socket_optslist);
|
||||
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
|
||||
inet_addr_to_opts(opts, addr);
|
||||
qapi_free_InetSocketAddress(addr);
|
||||
sock = inet_connect_opts(opts, errp, NULL, NULL);
|
||||
@@ -651,7 +651,7 @@ int inet_nonblocking_connect(const char *str,
|
||||
|
||||
addr = inet_parse(str, errp);
|
||||
if (addr != NULL) {
|
||||
opts = qemu_opts_create_nofail(&socket_optslist);
|
||||
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
|
||||
inet_addr_to_opts(opts, addr);
|
||||
qapi_free_InetSocketAddress(addr);
|
||||
sock = inet_connect_opts(opts, errp, callback, opaque);
|
||||
@@ -794,7 +794,7 @@ int unix_listen(const char *str, char *ostr, int olen, Error **errp)
|
||||
char *path, *optstr;
|
||||
int sock, len;
|
||||
|
||||
opts = qemu_opts_create_nofail(&socket_optslist);
|
||||
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
|
||||
|
||||
optstr = strchr(str, ',');
|
||||
if (optstr) {
|
||||
@@ -822,7 +822,7 @@ int unix_connect(const char *path, Error **errp)
|
||||
QemuOpts *opts;
|
||||
int sock;
|
||||
|
||||
opts = qemu_opts_create_nofail(&socket_optslist);
|
||||
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
|
||||
qemu_opt_set(opts, "path", path);
|
||||
sock = unix_connect_opts(opts, errp, NULL, NULL);
|
||||
qemu_opts_del(opts);
|
||||
@@ -839,7 +839,7 @@ int unix_nonblocking_connect(const char *path,
|
||||
|
||||
g_assert(callback != NULL);
|
||||
|
||||
opts = qemu_opts_create_nofail(&socket_optslist);
|
||||
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
|
||||
qemu_opt_set(opts, "path", path);
|
||||
sock = unix_connect_opts(opts, errp, callback, opaque);
|
||||
qemu_opts_del(opts);
|
||||
@@ -889,7 +889,7 @@ int socket_connect(SocketAddress *addr, Error **errp,
|
||||
QemuOpts *opts;
|
||||
int fd;
|
||||
|
||||
opts = qemu_opts_create_nofail(&socket_optslist);
|
||||
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
|
||||
switch (addr->kind) {
|
||||
case SOCKET_ADDRESS_KIND_INET:
|
||||
inet_addr_to_opts(opts, addr->inet);
|
||||
@@ -921,7 +921,7 @@ int socket_listen(SocketAddress *addr, Error **errp)
|
||||
QemuOpts *opts;
|
||||
int fd;
|
||||
|
||||
opts = qemu_opts_create_nofail(&socket_optslist);
|
||||
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
|
||||
switch (addr->kind) {
|
||||
case SOCKET_ADDRESS_KIND_INET:
|
||||
inet_addr_to_opts(opts, addr->inet);
|
||||
@@ -949,7 +949,7 @@ int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)
|
||||
QemuOpts *opts;
|
||||
int fd;
|
||||
|
||||
opts = qemu_opts_create_nofail(&socket_optslist);
|
||||
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
|
||||
switch (remote->kind) {
|
||||
case SOCKET_ADDRESS_KIND_INET:
|
||||
qemu_opt_set(opts, "host", remote->inet->host);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user