mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
use qemu_opts_create_nofail
We will use qemu_opts_create_nofail function, it can make code more readable. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
dd39244978
commit
e478b448d7
6 changed files with 18 additions and 20 deletions
12
vl.c
12
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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue