diff options
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 56 |
1 files changed, 31 insertions, 25 deletions
@@ -1461,12 +1461,12 @@ static int balloon_parse(const char *arg) if (!strncmp(arg, "virtio", 6)) { if (arg[6] == ',') { /* have params -> parse them */ - opts = qemu_opts_parse(&qemu_device_opts, arg+7, 0); + opts = qemu_opts_parse(qemu_find_opts("device"), arg+7, 0); if (!opts) return -1; } else { /* create empty opts */ - opts = qemu_opts_create(&qemu_device_opts, NULL, 0); + opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0); } qemu_opt_set(opts, "driver", "virtio-balloon-pci"); return 0; @@ -1598,7 +1598,7 @@ static void monitor_parse(const char *optarg, const char *mode) } } - opts = qemu_opts_create(&qemu_mon_opts, label, 1); + opts = qemu_opts_create(qemu_find_opts("mon"), label, 1); if (!opts) { fprintf(stderr, "duplicate chardev: %s\n", label); exit(1); @@ -1695,6 +1695,7 @@ static int parallel_parse(const char *devname) static int virtcon_parse(const char *devname) { + QemuOptsList *device = qemu_find_opts("device"); static int index = 0; char label[32]; QemuOpts *bus_opts, *dev_opts; @@ -1706,10 +1707,10 @@ static int virtcon_parse(const char *devname) exit(1); } - bus_opts = qemu_opts_create(&qemu_device_opts, NULL, 0); + bus_opts = qemu_opts_create(device, NULL, 0); qemu_opt_set(bus_opts, "driver", "virtio-serial"); - dev_opts = qemu_opts_create(&qemu_device_opts, NULL, 0); + dev_opts = qemu_opts_create(device, NULL, 0); qemu_opt_set(dev_opts, "driver", "virtconsole"); snprintf(label, sizeof(label), "virtcon%d", index); @@ -1732,7 +1733,7 @@ static int debugcon_parse(const char *devname) if (!qemu_chr_open("debugcon", devname, NULL)) { exit(1); } - opts = qemu_opts_create(&qemu_device_opts, "debugcon", 1); + opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1); if (!opts) { fprintf(stderr, "qemu: already have a debugcon device\n"); exit(1); @@ -1853,6 +1854,11 @@ int main(int argc, char **argv, char **envp) tb_size = 0; autostart= 1; +#ifdef CONFIG_VIRTFS + qemu_add_opts(&qemu_fsdev_opts); + qemu_add_opts(&qemu_virtfs_opts); +#endif + /* first pass of option parsing */ optind = 1; while (optind < argc) { @@ -2104,12 +2110,12 @@ int main(int argc, char **argv, char **envp) fd_bootchk = 0; break; case QEMU_OPTION_netdev: - if (net_client_parse(&qemu_netdev_opts, optarg) == -1) { + if (net_client_parse(qemu_find_opts("netdev"), optarg) == -1) { exit(1); } break; case QEMU_OPTION_net: - if (net_client_parse(&qemu_net_opts, optarg) == -1) { + if (net_client_parse(qemu_find_opts("net"), optarg) == -1) { exit(1); } break; @@ -2268,21 +2274,21 @@ int main(int argc, char **argv, char **envp) default_monitor = 0; break; case QEMU_OPTION_mon: - opts = qemu_opts_parse(&qemu_mon_opts, optarg, 1); + opts = qemu_opts_parse(qemu_find_opts("mon"), optarg, 1); if (!opts) { exit(1); } default_monitor = 0; break; case QEMU_OPTION_chardev: - opts = qemu_opts_parse(&qemu_chardev_opts, optarg, 1); + opts = qemu_opts_parse(qemu_find_opts("chardev"), optarg, 1); if (!opts) { exit(1); } break; #ifdef CONFIG_VIRTFS case QEMU_OPTION_fsdev: - opts = qemu_opts_parse(&qemu_fsdev_opts, optarg, 1); + opts = qemu_opts_parse(qemu_find_opts("fsdev"), optarg, 1); if (!opts) { fprintf(stderr, "parse error: %s\n", optarg); exit(1); @@ -2293,7 +2299,7 @@ int main(int argc, char **argv, char **envp) char *arg_9p = NULL; int len = 0; - opts = qemu_opts_parse(&qemu_virtfs_opts, optarg, 1); + opts = qemu_opts_parse(qemu_find_opts("virtfs"), optarg, 1); if (!opts) { fprintf(stderr, "parse error: %s\n", optarg); exit(1); @@ -2330,12 +2336,12 @@ int main(int argc, char **argv, char **envp) qemu_opt_get(opts, "mount_tag"), qemu_opt_get(opts, "mount_tag")); - if (!qemu_opts_parse(&qemu_fsdev_opts, arg_fsdev, 1)) { + if (!qemu_opts_parse(qemu_find_opts("fsdev"), arg_fsdev, 1)) { fprintf(stderr, "parse error [fsdev]: %s\n", optarg); exit(1); } - if (!qemu_opts_parse(&qemu_device_opts, arg_9p, 1)) { + if (!qemu_opts_parse(qemu_find_opts("device"), arg_9p, 1)) { fprintf(stderr, "parse error [device]: %s\n", optarg); exit(1); } @@ -2432,7 +2438,7 @@ int main(int argc, char **argv, char **envp) add_device_config(DEV_USB, optarg); break; case QEMU_OPTION_device: - if (!qemu_opts_parse(&qemu_device_opts, optarg, 1)) { + if (!qemu_opts_parse(qemu_find_opts("device"), optarg, 1)) { exit(1); } break; @@ -2528,7 +2534,7 @@ int main(int argc, char **argv, char **envp) configure_rtc_date_offset(optarg, 1); break; case QEMU_OPTION_rtc: - opts = qemu_opts_parse(&qemu_rtc_opts, optarg, 0); + opts = qemu_opts_parse(qemu_find_opts("rtc"), optarg, 0); if (!opts) { exit(1); } @@ -2636,8 +2642,8 @@ int main(int argc, char **argv, char **envp) exit(1); } - qemu_opts_foreach(&qemu_device_opts, default_driver_check, NULL, 0); - qemu_opts_foreach(&qemu_global_opts, default_driver_check, NULL, 0); + qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, 0); + qemu_opts_foreach(qemu_find_opts("global"), default_driver_check, NULL, 0); if (machine->no_serial) { default_serial = 0; @@ -2691,10 +2697,10 @@ int main(int argc, char **argv, char **envp) socket_init(); - if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0) + if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0) exit(1); #ifdef CONFIG_VIRTFS - if (qemu_opts_foreach(&qemu_fsdev_opts, fsdev_init_func, NULL, 1) != 0) { + if (qemu_opts_foreach(qemu_find_opts("fsdev"), fsdev_init_func, NULL, 1) != 0) { exit(1); } #endif @@ -2778,8 +2784,8 @@ int main(int argc, char **argv, char **envp) /* open the virtual block devices */ if (snapshot) - qemu_opts_foreach(&qemu_drive_opts, drive_enable_snapshot, NULL, 0); - if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, &machine->use_scsi, 1) != 0) + qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot, NULL, 0); + if (qemu_opts_foreach(qemu_find_opts("drive"), drive_init_func, &machine->use_scsi, 1) != 0) exit(1); register_savevm_live(NULL, "ram", 0, 4, NULL, ram_save_live, NULL, @@ -2827,7 +2833,7 @@ int main(int argc, char **argv, char **envp) } } - if (qemu_opts_foreach(&qemu_mon_opts, mon_init_func, NULL, 1) != 0) { + if (qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, 1) != 0) { exit(1); } @@ -2842,7 +2848,7 @@ int main(int argc, char **argv, char **envp) module_call_init(MODULE_INIT_DEVICE); - if (qemu_opts_foreach(&qemu_device_opts, device_help_func, NULL, 0) != 0) + if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0) != 0) exit(0); if (watchdog) { @@ -2875,7 +2881,7 @@ int main(int argc, char **argv, char **envp) } /* init generic devices */ - if (qemu_opts_foreach(&qemu_device_opts, device_init_func, NULL, 1) != 0) + if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1) != 0) exit(1); net_check_clients(); |