[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 27/43] use qemu_opts_create_nofail
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 27/43] use qemu_opts_create_nofail |
Date: |
Thu, 13 Dec 2012 16:10:34 +0100 |
From: Dong Xu Wang <address@hidden>
We will use qemu_opts_create_nofail function, it can make code
more readable.
Signed-off-by: Dong Xu Wang <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 2 +-
hw/watchdog.c | 2 +-
qemu-config.c | 4 ++--
qemu-img.c | 2 +-
qemu-sockets.c | 16 ++++++++--------
vl.c | 12 +++++-------
6 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 463f4c2..9a05e57 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -568,7 +568,7 @@ DriveInfo *drive_init(QemuOpts *opts, BlockInterfaceType
block_default_type)
break;
case IF_VIRTIO:
/* add virtio block device */
- opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(qemu_find_opts("device"));
if (arch_type == QEMU_ARCH_S390X) {
qemu_opt_set(opts, "driver", "virtio-blk-s390");
} else {
diff --git a/hw/watchdog.c b/hw/watchdog.c
index b52aced..5c82c17 100644
--- a/hw/watchdog.c
+++ b/hw/watchdog.c
@@ -66,7 +66,7 @@ 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(qemu_find_opts("device"), NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(qemu_find_opts("device"));
qemu_opt_set(opts, "driver", p);
return 0;
}
diff --git a/qemu-config.c b/qemu-config.c
index aa78fb9..54db981 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -756,7 +756,7 @@ int qemu_global_option(const char *str)
return -1;
}
- opts = qemu_opts_create(&qemu_global_opts, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(&qemu_global_opts);
qemu_opt_set(opts, "driver", driver);
qemu_opt_set(opts, "property", property);
qemu_opt_set(opts, "value", str+offset+1);
@@ -843,7 +843,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const
char *fname)
error_free(local_err);
goto out;
}
- opts = qemu_opts_create(list, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(list);
continue;
}
if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2) {
diff --git a/qemu-img.c b/qemu-img.c
index c4dae88..c989a52 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1934,7 +1934,7 @@ static int img_resize(int argc, char **argv)
}
/* Parse size */
- param = qemu_opts_create(&resize_options, NULL, 0, NULL);
+ param = qemu_opts_create_nofail(&resize_options);
if (qemu_opt_set(param, BLOCK_OPT_SIZE, size)) {
/* Error message already printed when size parsing fails */
ret = -1;
diff --git a/qemu-sockets.c b/qemu-sockets.c
index d314cf1..c52a40a 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -579,7 +579,7 @@ int inet_listen(const char *str, char *ostr, int olen,
addr = inet_parse(str, errp);
if (addr != NULL) {
- opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(&dummy_opts);
inet_addr_to_opts(opts, addr);
qapi_free_InetSocketAddress(addr);
sock = inet_listen_opts(opts, port_offset, errp);
@@ -618,7 +618,7 @@ int inet_connect(const char *str, Error **errp)
addr = inet_parse(str, errp);
if (addr != NULL) {
- opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(&dummy_opts);
inet_addr_to_opts(opts, addr);
qapi_free_InetSocketAddress(addr);
sock = inet_connect_opts(opts, errp, NULL, NULL);
@@ -652,7 +652,7 @@ int inet_nonblocking_connect(const char *str,
addr = inet_parse(str, errp);
if (addr != NULL) {
- opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(&dummy_opts);
inet_addr_to_opts(opts, addr);
qapi_free_InetSocketAddress(addr);
sock = inet_connect_opts(opts, errp, callback, opaque);
@@ -795,7 +795,7 @@ int unix_listen(const char *str, char *ostr, int olen,
Error **errp)
char *path, *optstr;
int sock, len;
- opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(&dummy_opts);
optstr = strchr(str, ',');
if (optstr) {
@@ -823,7 +823,7 @@ int unix_connect(const char *path, Error **errp)
QemuOpts *opts;
int sock;
- opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(&dummy_opts);
qemu_opt_set(opts, "path", path);
sock = unix_connect_opts(opts, errp, NULL, NULL);
qemu_opts_del(opts);
@@ -840,7 +840,7 @@ int unix_nonblocking_connect(const char *path,
g_assert(callback != NULL);
- opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(&dummy_opts);
qemu_opt_set(opts, "path", path);
sock = unix_connect_opts(opts, errp, callback, opaque);
qemu_opts_del(opts);
@@ -891,7 +891,7 @@ int socket_connect(SocketAddress *addr, Error **errp,
QemuOpts *opts;
int fd;
- opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(&dummy_opts);
switch (addr->kind) {
case SOCKET_ADDRESS_KIND_INET:
inet_addr_to_opts(opts, addr->inet);
@@ -922,7 +922,7 @@ int socket_listen(SocketAddress *addr, Error **errp)
QemuOpts *opts;
int fd;
- opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(&dummy_opts);
switch (addr->kind) {
case SOCKET_ADDRESS_KIND_INET:
inet_addr_to_opts(opts, addr->inet);
diff --git a/vl.c b/vl.c
index 6b3827c..3ebf01f 100644
--- a/vl.c
+++ b/vl.c
@@ -1996,7 +1996,7 @@ static int balloon_parse(const char *arg)
return -1;
} else {
/* create empty opts */
- opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0, NULL);
+ opts = qemu_opts_create_nofail(qemu_find_opts("device"));
}
qemu_opt_set(opts, "driver", "virtio-balloon");
return 0;
@@ -2246,14 +2246,14 @@ static int virtcon_parse(const char *devname)
exit(1);
}
- bus_opts = qemu_opts_create(device, NULL, 0, NULL);
+ bus_opts = qemu_opts_create_nofail(device);
if (arch_type == QEMU_ARCH_S390X) {
qemu_opt_set(bus_opts, "driver", "virtio-serial-s390");
} else {
qemu_opt_set(bus_opts, "driver", "virtio-serial-pci");
}
- dev_opts = qemu_opts_create(device, NULL, 0, NULL);
+ dev_opts = qemu_opts_create_nofail(device);
qemu_opt_set(dev_opts, "driver", "virtconsole");
snprintf(label, sizeof(label), "virtcon%d", index);
@@ -3105,8 +3105,7 @@ int main(int argc, char **argv, char **envp)
qemu_opt_set_bool(fsdev, "readonly",
qemu_opt_get_bool(opts, "readonly", 0));
- device = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
- NULL);
+ device = qemu_opts_create_nofail(qemu_find_opts("device"));
qemu_opt_set(device, "driver", "virtio-9p-pci");
qemu_opt_set(device, "fsdev",
qemu_opt_get(opts, "mount_tag"));
@@ -3126,8 +3125,7 @@ int main(int argc, char **argv, char **envp)
}
qemu_opt_set(fsdev, "fsdriver", "synth");
- device = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
- NULL);
+ device = qemu_opts_create_nofail(qemu_find_opts("device"));
qemu_opt_set(device, "driver", "virtio-9p-pci");
qemu_opt_set(device, "fsdev", "v_synth");
qemu_opt_set(device, "mount_tag", "v_synth");
--
1.7.6.5
- [Qemu-devel] [PATCH 05/43] block: Factor out bdrv_open_flags, (continued)
- [Qemu-devel] [PATCH 05/43] block: Factor out bdrv_open_flags, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 10/43] raw-posix: inline paio_ioctl into hdev_aio_ioctl, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 16/43] qmp: qmp_transaction(): pass Error object to bdrv_img_create(), Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 13/43] block: bdrv_img_create(): add Error ** argument, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 14/43] qemu-img: img_create(): pass Error object to bdrv_img_create(), Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 08/43] block: vpc initialize the uuid footer field, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 17/43] qmp: qmp_drive_mirror(): pass Error object to bdrv_img_create(), Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 11/43] Support default block interfaces per QEMUMachine, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 22/43] Fix error code checking for SetFilePointer() call, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 35/43] atapi: reset cdrom tray statuses on ide_reset, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 27/43] use qemu_opts_create_nofail,
Kevin Wolf <=
- [Qemu-devel] [PATCH 43/43] qcow2: Factor out handle_dependencies(), Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 30/43] blkdebug: Factor out remove_rule(), Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 33/43] qcow2: Move BLKDBG_EVENT out of the lock, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 41/43] qcow2: Enable dirty flag in qcow2_alloc_cluster_link_l2, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 39/43] qcow2: Drop l2meta.cluster_offset, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 31/43] blkdebug: Implement suspend/resume of AIO requests, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 20/43] qemu-io: Implement write -c for compressed clusters, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 26/43] introduce qemu_opts_create_nofail function, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 29/43] blkdebug: Allow usage without config file, Kevin Wolf, 2012/12/13
- [Qemu-devel] [PATCH 15/43] qemu-img: img_create(): drop unneeded goto and ret variable, Kevin Wolf, 2012/12/13