QemuOpts: Drop qemu_opt_set(), rename qemu_opt_set_err(), fix use

qemu_opt_set() is a wrapper around qemu_opt_set() that reports the
error with qerror_report_err().

Most of its users assume the function can't fail.  Make them use
qemu_opt_set_err() with &error_abort, so that should the assumption
ever break, it'll break noisily.

Just two users remain, in util/qemu-config.c.  Switch them to
qemu_opt_set_err() as well, then rename qemu_opt_set_err() to
qemu_opt_set().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Markus Armbruster 2015-02-12 17:52:20 +01:00
parent 6be4194b92
commit f43e47dbf6
18 changed files with 131 additions and 131 deletions

View File

@ -5660,8 +5660,7 @@ void bdrv_img_create(const char *filename, const char *fmt,
}
if (base_filename) {
qemu_opt_set_err(opts, BLOCK_OPT_BACKING_FILE, base_filename,
&local_err);
qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename, &local_err);
if (local_err) {
error_setg(errp, "Backing file not supported for file format '%s'",
fmt);
@ -5670,7 +5669,7 @@ void bdrv_img_create(const char *filename, const char *fmt,
}
if (base_fmt) {
qemu_opt_set_err(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &local_err);
qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &local_err);
if (local_err) {
error_setg(errp, "Backing file format not supported for file "
"format '%s'", fmt);

View File

@ -1859,7 +1859,8 @@ static int qcow2_create2(const char *filename, int64_t total_size,
qemu_opt_set_number(opts, BLOCK_OPT_SIZE,
aligned_total_size + meta_size, &error_abort);
qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_lookup[prealloc]);
qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_lookup[prealloc],
&error_abort);
}
ret = bdrv_create_file(filename, opts, &local_err);

View File

@ -2926,7 +2926,7 @@ static int enable_write_target(BDRVVVFATState *s, Error **errp)
opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort);
qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512,
&error_abort);
qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:");
qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:", &error_abort);
ret = bdrv_create(bdrv_qcow, s->qcow_filename, opts, errp);
qemu_opts_del(opts);

View File

@ -187,14 +187,14 @@ QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
return NULL;
}
if (type != IF_DEFAULT) {
qemu_opt_set(opts, "if", if_name[type]);
qemu_opt_set(opts, "if", if_name[type], &error_abort);
}
if (index >= 0) {
snprintf(buf, sizeof(buf), "%d", index);
qemu_opt_set(opts, "index", buf);
qemu_opt_set(opts, "index", buf, &error_abort);
}
if (file)
qemu_opt_set(opts, "file", file);
qemu_opt_set(opts, "file", file, &error_abort);
return opts;
}
@ -584,7 +584,7 @@ static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to,
/* rename all items in opts */
while ((value = qemu_opt_get(opts, from))) {
qemu_opt_set(opts, to, value);
qemu_opt_set(opts, to, value, &error_abort);
qemu_opt_unset(opts, from);
}
}
@ -935,13 +935,14 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
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");
qemu_opt_set(devopts, "driver", "virtio-blk-s390", &error_abort);
} else {
qemu_opt_set(devopts, "driver", "virtio-blk-pci");
qemu_opt_set(devopts, "driver", "virtio-blk-pci", &error_abort);
}
qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id"));
qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id"),
&error_abort);
if (devaddr) {
qemu_opt_set(devopts, "addr", devaddr);
qemu_opt_set(devopts, "addr", devaddr, &error_abort);
}
}

View File

@ -87,7 +87,7 @@ static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
return NULL;
}
qemu_opt_set(opts, "type", "nic");
qemu_opt_set(opts, "type", "nic", &error_abort);
ret = net_client_init(opts, 0, &local_err);
if (local_err) {

View File

@ -1394,8 +1394,8 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline)
if (!opts) {
return NULL;
}
qemu_opt_set(opts, "type", "nic");
qemu_opt_set(opts, "model", "usb");
qemu_opt_set(opts, "type", "nic", &error_abort);
qemu_opt_set(opts, "model", "usb", &error_abort);
idx = net_client_init(opts, 0, &local_err);
if (local_err) {

View File

@ -683,7 +683,7 @@ static USBDevice *usb_msd_init(USBBus *bus, const char *filename)
if (strstart(filename, "format=", &p2)) {
int len = MIN(p1 - p2, sizeof(fmt));
pstrcpy(fmt, len, p2);
qemu_opt_set(opts, "format", fmt);
qemu_opt_set(opts, "format", fmt, &error_abort);
} else if (*filename != ':') {
error_report("unrecognized USB mass-storage option %s", filename);
return NULL;
@ -694,8 +694,8 @@ static USBDevice *usb_msd_init(USBBus *bus, const char *filename)
error_report("block device specification needed");
return NULL;
}
qemu_opt_set(opts, "file", filename);
qemu_opt_set(opts, "if", "none");
qemu_opt_set(opts, "file", filename, &error_abort);
qemu_opt_set(opts, "if", "none", &error_abort);
/* create host drive */
dinfo = drive_new(opts, 0);

View File

@ -68,7 +68,7 @@ int select_watchdog(const char *p)
/* add the device */
opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
&error_abort);
qemu_opt_set(opts, "driver", p);
qemu_opt_set(opts, "driver", p, &error_abort);
return 0;
}
}

View File

@ -94,9 +94,8 @@ uint64_t qemu_opt_get_number_del(QemuOpts *opts, const char *name,
uint64_t qemu_opt_get_size_del(QemuOpts *opts, const char *name,
uint64_t defval);
int qemu_opt_unset(QemuOpts *opts, const char *name);
int qemu_opt_set(QemuOpts *opts, const char *name, const char *value);
void qemu_opt_set_err(QemuOpts *opts, const char *name, const char *value,
Error **errp);
void qemu_opt_set(QemuOpts *opts, const char *name, const char *value,
Error **errp);
void qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val,
Error **errp);
void qemu_opt_set_number(QemuOpts *opts, const char *name, int64_t val,

View File

@ -970,7 +970,7 @@ void hmp_host_net_add(Monitor *mon, const QDict *qdict)
return;
}
qemu_opt_set(opts, "type", device);
qemu_opt_set(opts, "type", device, &error_abort);
net_client_init(opts, 0, &local_err);
if (local_err) {

View File

@ -772,8 +772,8 @@ int qemu_global_option(const char *str)
}
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);
qemu_opt_set(opts, "driver", driver, &error_abort);
qemu_opt_set(opts, "property", property, &error_abort);
qemu_opt_set(opts, "value", str + offset + 1, &error_abort);
return 0;
}

View File

@ -3312,14 +3312,14 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
if (strstart(filename, "mon:", &p)) {
filename = p;
qemu_opt_set(opts, "mux", "on");
qemu_opt_set(opts, "mux", "on", &error_abort);
if (strcmp(filename, "stdio") == 0) {
/* Monitor is muxed to stdio: do not exit on Ctrl+C by default
* but pass it to the guest. Handle this only for compat syntax,
* for -chardev syntax we have special option for this.
* This is what -nographic did, redirecting+muxing serial+monitor
* to stdio causing Ctrl+C to be passed to guest. */
qemu_opt_set(opts, "signal", "off");
qemu_opt_set(opts, "signal", "off", &error_abort);
}
}
@ -3329,20 +3329,20 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
strcmp(filename, "braille") == 0 ||
strcmp(filename, "testdev") == 0 ||
strcmp(filename, "stdio") == 0) {
qemu_opt_set(opts, "backend", filename);
qemu_opt_set(opts, "backend", filename, &error_abort);
return opts;
}
if (strstart(filename, "vc", &p)) {
qemu_opt_set(opts, "backend", "vc");
qemu_opt_set(opts, "backend", "vc", &error_abort);
if (*p == ':') {
if (sscanf(p+1, "%7[0-9]x%7[0-9]", width, height) == 2) {
/* pixels */
qemu_opt_set(opts, "width", width);
qemu_opt_set(opts, "height", height);
qemu_opt_set(opts, "width", width, &error_abort);
qemu_opt_set(opts, "height", height, &error_abort);
} else if (sscanf(p+1, "%7[0-9]Cx%7[0-9]C", width, height) == 2) {
/* chars */
qemu_opt_set(opts, "cols", width);
qemu_opt_set(opts, "rows", height);
qemu_opt_set(opts, "cols", width, &error_abort);
qemu_opt_set(opts, "rows", height, &error_abort);
} else {
goto fail;
}
@ -3350,22 +3350,22 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
return opts;
}
if (strcmp(filename, "con:") == 0) {
qemu_opt_set(opts, "backend", "console");
qemu_opt_set(opts, "backend", "console", &error_abort);
return opts;
}
if (strstart(filename, "COM", NULL)) {
qemu_opt_set(opts, "backend", "serial");
qemu_opt_set(opts, "path", filename);
qemu_opt_set(opts, "backend", "serial", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
if (strstart(filename, "file:", &p)) {
qemu_opt_set(opts, "backend", "file");
qemu_opt_set(opts, "path", p);
qemu_opt_set(opts, "backend", "file", &error_abort);
qemu_opt_set(opts, "path", p, &error_abort);
return opts;
}
if (strstart(filename, "pipe:", &p)) {
qemu_opt_set(opts, "backend", "pipe");
qemu_opt_set(opts, "path", p);
qemu_opt_set(opts, "backend", "pipe", &error_abort);
qemu_opt_set(opts, "path", p, &error_abort);
return opts;
}
if (strstart(filename, "tcp:", &p) ||
@ -3375,27 +3375,27 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
if (sscanf(p, ":%32[^,]%n", port, &pos) < 1)
goto fail;
}
qemu_opt_set(opts, "backend", "socket");
qemu_opt_set(opts, "host", host);
qemu_opt_set(opts, "port", port);
qemu_opt_set(opts, "backend", "socket", &error_abort);
qemu_opt_set(opts, "host", host, &error_abort);
qemu_opt_set(opts, "port", port, &error_abort);
if (p[pos] == ',') {
if (qemu_opts_do_parse(opts, p+pos+1, NULL) != 0)
goto fail;
}
if (strstart(filename, "telnet:", &p))
qemu_opt_set(opts, "telnet", "on");
qemu_opt_set(opts, "telnet", "on", &error_abort);
return opts;
}
if (strstart(filename, "udp:", &p)) {
qemu_opt_set(opts, "backend", "udp");
qemu_opt_set(opts, "backend", "udp", &error_abort);
if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port, &pos) < 2) {
host[0] = 0;
if (sscanf(p, ":%32[^@,]%n", port, &pos) < 1) {
goto fail;
}
}
qemu_opt_set(opts, "host", host);
qemu_opt_set(opts, "port", port);
qemu_opt_set(opts, "host", host, &error_abort);
qemu_opt_set(opts, "port", port, &error_abort);
if (p[pos] == '@') {
p += pos + 1;
if (sscanf(p, "%64[^:]:%32[^,]%n", host, port, &pos) < 2) {
@ -3404,26 +3404,26 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
goto fail;
}
}
qemu_opt_set(opts, "localaddr", host);
qemu_opt_set(opts, "localport", port);
qemu_opt_set(opts, "localaddr", host, &error_abort);
qemu_opt_set(opts, "localport", port, &error_abort);
}
return opts;
}
if (strstart(filename, "unix:", &p)) {
qemu_opt_set(opts, "backend", "socket");
qemu_opt_set(opts, "backend", "socket", &error_abort);
if (qemu_opts_do_parse(opts, p, "path") != 0)
goto fail;
return opts;
}
if (strstart(filename, "/dev/parport", NULL) ||
strstart(filename, "/dev/ppi", NULL)) {
qemu_opt_set(opts, "backend", "parport");
qemu_opt_set(opts, "path", filename);
qemu_opt_set(opts, "backend", "parport", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}
if (strstart(filename, "/dev/", NULL)) {
qemu_opt_set(opts, "backend", "tty");
qemu_opt_set(opts, "path", filename);
qemu_opt_set(opts, "backend", "tty", &error_abort);
qemu_opt_set(opts, "path", filename, &error_abort);
return opts;
}

View File

@ -335,7 +335,7 @@ static int add_old_style_options(const char *fmt, QemuOpts *opts,
Error *err = NULL;
if (base_filename) {
qemu_opt_set_err(opts, BLOCK_OPT_BACKING_FILE, base_filename, &err);
qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename, &err);
if (err) {
error_report("Backing file not supported for file format '%s'",
fmt);
@ -344,7 +344,7 @@ static int add_old_style_options(const char *fmt, QemuOpts *opts,
}
}
if (base_fmt) {
qemu_opt_set_err(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &err);
qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &err);
if (err) {
error_report("Backing file format not supported for file "
"format '%s'", fmt);
@ -2828,7 +2828,7 @@ static int img_resize(int argc, char **argv)
/* Parse size */
param = qemu_opts_create(&resize_options, NULL, 0, &error_abort);
qemu_opt_set_err(param, BLOCK_OPT_SIZE, size, &err);
qemu_opt_set(param, BLOCK_OPT_SIZE, size, &err);
if (err) {
error_report_err(err);
ret = -1;

View File

@ -148,13 +148,13 @@ static void test_qemu_opt_get(void)
opt = qemu_opt_get(opts, "str2");
g_assert(opt == NULL);
qemu_opt_set(opts, "str2", "value");
qemu_opt_set(opts, "str2", "value", &error_abort);
/* now we have set str2, should know about it */
opt = qemu_opt_get(opts, "str2");
g_assert_cmpstr(opt, ==, "value");
qemu_opt_set(opts, "str2", "value2");
qemu_opt_set(opts, "str2", "value2", &error_abort);
/* having reset the value, the returned should be the reset one */
opt = qemu_opt_get(opts, "str2");
@ -331,7 +331,7 @@ static void test_qemu_opt_unset(void)
g_assert_cmpstr(value, ==, "value");
/* reset it to value2 */
qemu_opt_set(opts, "key", "value2");
qemu_opt_set(opts, "key", "value2", &error_abort);
value = qemu_opt_get(opts, "key");
g_assert_cmpstr(value, ==, "value2");

View File

@ -219,6 +219,7 @@ void qemu_add_opts(QemuOptsList *list)
int qemu_set_option(const char *str)
{
Error *local_err = NULL;
char group[64], id[64], arg[64];
QemuOptsList *list;
QemuOpts *opts;
@ -242,7 +243,9 @@ int qemu_set_option(const char *str)
return -1;
}
if (qemu_opt_set(opts, arg, str+offset+1) == -1) {
qemu_opt_set(opts, arg, str + offset + 1, &local_err);
if (local_err) {
error_report_err(local_err);
return -1;
}
return 0;
@ -335,7 +338,9 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)
error_report("no group defined");
goto out;
}
if (qemu_opt_set(opts, arg, value) != 0) {
qemu_opt_set(opts, arg, value, &local_err);
if (local_err) {
error_report_err(local_err);
goto out;
}
continue;

View File

@ -548,22 +548,8 @@ static void opt_set(QemuOpts *opts, const char *name, const char *value,
}
}
int qemu_opt_set(QemuOpts *opts, const char *name, const char *value)
{
Error *local_err = NULL;
opt_set(opts, name, value, false, &local_err);
if (local_err) {
qerror_report_err(local_err);
error_free(local_err);
return -1;
}
return 0;
}
void qemu_opt_set_err(QemuOpts *opts, const char *name, const char *value,
Error **errp)
void qemu_opt_set(QemuOpts *opts, const char *name, const char *value,
Error **errp)
{
opt_set(opts, name, value, false, errp);
}
@ -701,7 +687,7 @@ void qemu_opts_set(QemuOptsList *list, const char *id,
error_propagate(errp, local_err);
return;
}
qemu_opt_set_err(opts, name, value, errp);
qemu_opt_set(opts, name, value, errp);
}
const char *qemu_opts_id(QemuOpts *opts)
@ -921,7 +907,7 @@ static void qemu_opts_from_qdict_1(const char *key, QObject *obj, void *opaque)
return;
}
qemu_opt_set_err(state->opts, key, value, state->errp);
qemu_opt_set(state->opts, key, value, state->errp);
}
/*

View File

@ -200,10 +200,12 @@ listen:
return -1;
}
snprintf(uport, sizeof(uport), "%d", inet_getport(e) - port_offset);
qemu_opt_set(opts, "host", uaddr);
qemu_opt_set(opts, "port", uport);
qemu_opt_set(opts, "ipv6", (e->ai_family == PF_INET6) ? "on" : "off");
qemu_opt_set(opts, "ipv4", (e->ai_family != PF_INET6) ? "on" : "off");
qemu_opt_set(opts, "host", uaddr, &error_abort);
qemu_opt_set(opts, "port", uport, &error_abort);
qemu_opt_set(opts, "ipv6", (e->ai_family == PF_INET6) ? "on" : "off",
&error_abort);
qemu_opt_set(opts, "ipv4", (e->ai_family != PF_INET6) ? "on" : "off",
&error_abort);
freeaddrinfo(res);
return slisten;
}
@ -586,10 +588,10 @@ static void inet_addr_to_opts(QemuOpts *opts, const InetSocketAddress *addr)
if (addr->has_to) {
char to[20];
snprintf(to, sizeof(to), "%d", addr->to);
qemu_opt_set(opts, "to", to);
qemu_opt_set(opts, "to", to, &error_abort);
}
qemu_opt_set(opts, "host", addr->host);
qemu_opt_set(opts, "port", addr->port);
qemu_opt_set(opts, "host", addr->host, &error_abort);
qemu_opt_set(opts, "port", addr->port, &error_abort);
}
int inet_listen(const char *str, char *ostr, int olen,
@ -726,7 +728,7 @@ int unix_listen_opts(QemuOpts *opts, Error **errp)
goto err;
}
close(fd);
qemu_opt_set(opts, "path", un.sun_path);
qemu_opt_set(opts, "path", un.sun_path, &error_abort);
}
unlink(un.sun_path);
@ -838,11 +840,11 @@ int unix_listen(const char *str, char *ostr, int olen, Error **errp)
if (len) {
path = g_malloc(len+1);
snprintf(path, len+1, "%.*s", len, str);
qemu_opt_set(opts, "path", path);
qemu_opt_set(opts, "path", path, &error_abort);
g_free(path);
}
} else {
qemu_opt_set(opts, "path", str);
qemu_opt_set(opts, "path", str, &error_abort);
}
sock = unix_listen_opts(opts, errp);
@ -859,7 +861,7 @@ int unix_connect(const char *path, Error **errp)
int sock;
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
qemu_opt_set(opts, "path", path);
qemu_opt_set(opts, "path", path, &error_abort);
sock = unix_connect_opts(opts, errp, NULL, NULL);
qemu_opts_del(opts);
return sock;
@ -876,7 +878,7 @@ int unix_nonblocking_connect(const char *path,
g_assert(callback != NULL);
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
qemu_opt_set(opts, "path", path);
qemu_opt_set(opts, "path", path, &error_abort);
sock = unix_connect_opts(opts, errp, callback, opaque);
qemu_opts_del(opts);
return sock;
@ -933,7 +935,7 @@ int socket_connect(SocketAddress *addr, Error **errp,
break;
case SOCKET_ADDRESS_KIND_UNIX:
qemu_opt_set(opts, "path", addr->q_unix->path);
qemu_opt_set(opts, "path", addr->q_unix->path, &error_abort);
fd = unix_connect_opts(opts, errp, callback, opaque);
break;
@ -965,7 +967,7 @@ int socket_listen(SocketAddress *addr, Error **errp)
break;
case SOCKET_ADDRESS_KIND_UNIX:
qemu_opt_set(opts, "path", addr->q_unix->path);
qemu_opt_set(opts, "path", addr->q_unix->path, &error_abort);
fd = unix_listen_opts(opts, errp);
break;
@ -990,8 +992,8 @@ int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)
case SOCKET_ADDRESS_KIND_INET:
inet_addr_to_opts(opts, remote->inet);
if (local) {
qemu_opt_set(opts, "localaddr", local->inet->host);
qemu_opt_set(opts, "localport", local->inet->port);
qemu_opt_set(opts, "localaddr", local->inet->host, &error_abort);
qemu_opt_set(opts, "localport", local->inet->port, &error_abort);
}
fd = inet_dgram_opts(opts, errp);
break;

73
vl.c
View File

@ -1096,7 +1096,7 @@ static int drive_init_func(QemuOpts *opts, void *opaque)
static int drive_enable_snapshot(QemuOpts *opts, void *opaque)
{
if (qemu_opt_get(opts, "snapshot") == NULL) {
qemu_opt_set(opts, "snapshot", "on");
qemu_opt_set(opts, "snapshot", "on", &error_abort);
}
return 0;
}
@ -2074,7 +2074,7 @@ static int balloon_parse(const char *arg)
opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
&error_abort);
}
qemu_opt_set(opts, "driver", "virtio-balloon");
qemu_opt_set(opts, "driver", "virtio-balloon", &error_abort);
return 0;
}
@ -2220,11 +2220,11 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty)
error_report_err(local_err);
exit(1);
}
qemu_opt_set(opts, "mode", mode);
qemu_opt_set(opts, "chardev", label);
qemu_opt_set(opts, "mode", mode, &error_abort);
qemu_opt_set(opts, "chardev", label, &error_abort);
qemu_opt_set_bool(opts, "pretty", pretty, &error_abort);
if (def)
qemu_opt_set(opts, "default", "on");
qemu_opt_set(opts, "default", "on", &error_abort);
monitor_device_index++;
}
@ -2336,13 +2336,13 @@ static int virtcon_parse(const char *devname)
bus_opts = qemu_opts_create(device, NULL, 0, &error_abort);
if (arch_type == QEMU_ARCH_S390X) {
qemu_opt_set(bus_opts, "driver", "virtio-serial-s390");
qemu_opt_set(bus_opts, "driver", "virtio-serial-s390", &error_abort);
} else {
qemu_opt_set(bus_opts, "driver", "virtio-serial-pci");
qemu_opt_set(bus_opts, "driver", "virtio-serial-pci", &error_abort);
}
dev_opts = qemu_opts_create(device, NULL, 0, &error_abort);
qemu_opt_set(dev_opts, "driver", "virtconsole");
qemu_opt_set(dev_opts, "driver", "virtconsole", &error_abort);
snprintf(label, sizeof(label), "virtcon%d", index);
virtcon_hds[index] = qemu_chr_new(label, devname, NULL);
@ -2351,7 +2351,7 @@ static int virtcon_parse(const char *devname)
" to character backend '%s'\n", devname);
return -1;
}
qemu_opt_set(dev_opts, "chardev", label);
qemu_opt_set(dev_opts, "chardev", label, &error_abort);
index++;
return 0;
@ -2375,7 +2375,7 @@ static int sclp_parse(const char *devname)
assert(arch_type == QEMU_ARCH_S390X);
dev_opts = qemu_opts_create(device, NULL, 0, NULL);
qemu_opt_set(dev_opts, "driver", "sclpconsole");
qemu_opt_set(dev_opts, "driver", "sclpconsole", &error_abort);
snprintf(label, sizeof(label), "sclpcon%d", index);
sclp_hds[index] = qemu_chr_new(label, devname, NULL);
@ -2384,7 +2384,7 @@ static int sclp_parse(const char *devname)
" to character backend '%s'\n", devname);
return -1;
}
qemu_opt_set(dev_opts, "chardev", label);
qemu_opt_set(dev_opts, "chardev", label, &error_abort);
index++;
return 0;
@ -2402,8 +2402,8 @@ static int debugcon_parse(const char *devname)
fprintf(stderr, "qemu: already have a debugcon device\n");
exit(1);
}
qemu_opt_set(opts, "driver", "isa-debugcon");
qemu_opt_set(opts, "chardev", "debugcon");
qemu_opt_set(opts, "driver", "isa-debugcon", &error_abort);
qemu_opt_set(opts, "chardev", "debugcon", &error_abort);
return 0;
}
@ -2973,19 +2973,23 @@ int main(int argc, char **argv, char **envp)
if (hda_opts != NULL) {
char num[16];
snprintf(num, sizeof(num), "%d", cyls);
qemu_opt_set(hda_opts, "cyls", num);
qemu_opt_set(hda_opts, "cyls", num, &error_abort);
snprintf(num, sizeof(num), "%d", heads);
qemu_opt_set(hda_opts, "heads", num);
qemu_opt_set(hda_opts, "heads", num, &error_abort);
snprintf(num, sizeof(num), "%d", secs);
qemu_opt_set(hda_opts, "secs", num);
qemu_opt_set(hda_opts, "secs", num, &error_abort);
if (translation == BIOS_ATA_TRANSLATION_LARGE) {
qemu_opt_set(hda_opts, "trans", "large");
qemu_opt_set(hda_opts, "trans", "large",
&error_abort);
} else if (translation == BIOS_ATA_TRANSLATION_RECHS) {
qemu_opt_set(hda_opts, "trans", "rechs");
qemu_opt_set(hda_opts, "trans", "rechs",
&error_abort);
} else if (translation == BIOS_ATA_TRANSLATION_LBA) {
qemu_opt_set(hda_opts, "trans", "lba");
qemu_opt_set(hda_opts, "trans", "lba",
&error_abort);
} else if (translation == BIOS_ATA_TRANSLATION_NONE) {
qemu_opt_set(hda_opts, "trans", "none");
qemu_opt_set(hda_opts, "trans", "none",
&error_abort);
}
}
}
@ -3271,24 +3275,27 @@ int main(int argc, char **argv, char **envp)
writeout = qemu_opt_get(opts, "writeout");
if (writeout) {
#ifdef CONFIG_SYNC_FILE_RANGE
qemu_opt_set(fsdev, "writeout", writeout);
qemu_opt_set(fsdev, "writeout", writeout, &error_abort);
#else
fprintf(stderr, "writeout=immediate not supported on "
"this platform\n");
exit(1);
#endif
}
qemu_opt_set(fsdev, "fsdriver", qemu_opt_get(opts, "fsdriver"));
qemu_opt_set(fsdev, "path", qemu_opt_get(opts, "path"));
qemu_opt_set(fsdev, "fsdriver",
qemu_opt_get(opts, "fsdriver"), &error_abort);
qemu_opt_set(fsdev, "path", qemu_opt_get(opts, "path"),
&error_abort);
qemu_opt_set(fsdev, "security_model",
qemu_opt_get(opts, "security_model"));
qemu_opt_get(opts, "security_model"),
&error_abort);
socket = qemu_opt_get(opts, "socket");
if (socket) {
qemu_opt_set(fsdev, "socket", socket);
qemu_opt_set(fsdev, "socket", socket, &error_abort);
}
sock_fd = qemu_opt_get(opts, "sock_fd");
if (sock_fd) {
qemu_opt_set(fsdev, "sock_fd", sock_fd);
qemu_opt_set(fsdev, "sock_fd", sock_fd, &error_abort);
}
qemu_opt_set_bool(fsdev, "readonly",
@ -3296,11 +3303,11 @@ int main(int argc, char **argv, char **envp)
&error_abort);
device = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
&error_abort);
qemu_opt_set(device, "driver", "virtio-9p-pci");
qemu_opt_set(device, "driver", "virtio-9p-pci", &error_abort);
qemu_opt_set(device, "fsdev",
qemu_opt_get(opts, "mount_tag"));
qemu_opt_get(opts, "mount_tag"), &error_abort);
qemu_opt_set(device, "mount_tag",
qemu_opt_get(opts, "mount_tag"));
qemu_opt_get(opts, "mount_tag"), &error_abort);
break;
}
case QEMU_OPTION_virtfs_synth: {
@ -3313,13 +3320,13 @@ int main(int argc, char **argv, char **envp)
fprintf(stderr, "duplicate option: %s\n", "virtfs_synth");
exit(1);
}
qemu_opt_set(fsdev, "fsdriver", "synth");
qemu_opt_set(fsdev, "fsdriver", "synth", &error_abort);
device = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
&error_abort);
qemu_opt_set(device, "driver", "virtio-9p-pci");
qemu_opt_set(device, "fsdev", "v_synth");
qemu_opt_set(device, "mount_tag", "v_synth");
qemu_opt_set(device, "driver", "virtio-9p-pci", &error_abort);
qemu_opt_set(device, "fsdev", "v_synth", &error_abort);
qemu_opt_set(device, "mount_tag", "v_synth", &error_abort);
break;
}
case QEMU_OPTION_serial: