Revision 3329f07b vl.c
b/vl.c | ||
---|---|---|
1461 | 1461 |
if (!strncmp(arg, "virtio", 6)) { |
1462 | 1462 |
if (arg[6] == ',') { |
1463 | 1463 |
/* have params -> parse them */ |
1464 |
opts = qemu_opts_parse(&qemu_device_opts, arg+7, 0);
|
|
1464 |
opts = qemu_opts_parse(qemu_find_opts("device"), arg+7, 0);
|
|
1465 | 1465 |
if (!opts) |
1466 | 1466 |
return -1; |
1467 | 1467 |
} else { |
1468 | 1468 |
/* create empty opts */ |
1469 |
opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
|
|
1469 |
opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0);
|
|
1470 | 1470 |
} |
1471 | 1471 |
qemu_opt_set(opts, "driver", "virtio-balloon-pci"); |
1472 | 1472 |
return 0; |
... | ... | |
1598 | 1598 |
} |
1599 | 1599 |
} |
1600 | 1600 |
|
1601 |
opts = qemu_opts_create(&qemu_mon_opts, label, 1);
|
|
1601 |
opts = qemu_opts_create(qemu_find_opts("mon"), label, 1);
|
|
1602 | 1602 |
if (!opts) { |
1603 | 1603 |
fprintf(stderr, "duplicate chardev: %s\n", label); |
1604 | 1604 |
exit(1); |
... | ... | |
1695 | 1695 |
|
1696 | 1696 |
static int virtcon_parse(const char *devname) |
1697 | 1697 |
{ |
1698 |
QemuOptsList *device = qemu_find_opts("device"); |
|
1698 | 1699 |
static int index = 0; |
1699 | 1700 |
char label[32]; |
1700 | 1701 |
QemuOpts *bus_opts, *dev_opts; |
... | ... | |
1706 | 1707 |
exit(1); |
1707 | 1708 |
} |
1708 | 1709 |
|
1709 |
bus_opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
|
|
1710 |
bus_opts = qemu_opts_create(device, NULL, 0);
|
|
1710 | 1711 |
qemu_opt_set(bus_opts, "driver", "virtio-serial"); |
1711 | 1712 |
|
1712 |
dev_opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
|
|
1713 |
dev_opts = qemu_opts_create(device, NULL, 0);
|
|
1713 | 1714 |
qemu_opt_set(dev_opts, "driver", "virtconsole"); |
1714 | 1715 |
|
1715 | 1716 |
snprintf(label, sizeof(label), "virtcon%d", index); |
... | ... | |
1732 | 1733 |
if (!qemu_chr_open("debugcon", devname, NULL)) { |
1733 | 1734 |
exit(1); |
1734 | 1735 |
} |
1735 |
opts = qemu_opts_create(&qemu_device_opts, "debugcon", 1);
|
|
1736 |
opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1);
|
|
1736 | 1737 |
if (!opts) { |
1737 | 1738 |
fprintf(stderr, "qemu: already have a debugcon device\n"); |
1738 | 1739 |
exit(1); |
... | ... | |
1853 | 1854 |
tb_size = 0; |
1854 | 1855 |
autostart= 1; |
1855 | 1856 |
|
1857 |
#ifdef CONFIG_VIRTFS |
|
1858 |
qemu_add_opts(&qemu_fsdev_opts); |
|
1859 |
qemu_add_opts(&qemu_virtfs_opts); |
|
1860 |
#endif |
|
1861 |
|
|
1856 | 1862 |
/* first pass of option parsing */ |
1857 | 1863 |
optind = 1; |
1858 | 1864 |
while (optind < argc) { |
... | ... | |
2104 | 2110 |
fd_bootchk = 0; |
2105 | 2111 |
break; |
2106 | 2112 |
case QEMU_OPTION_netdev: |
2107 |
if (net_client_parse(&qemu_netdev_opts, optarg) == -1) {
|
|
2113 |
if (net_client_parse(qemu_find_opts("netdev"), optarg) == -1) {
|
|
2108 | 2114 |
exit(1); |
2109 | 2115 |
} |
2110 | 2116 |
break; |
2111 | 2117 |
case QEMU_OPTION_net: |
2112 |
if (net_client_parse(&qemu_net_opts, optarg) == -1) {
|
|
2118 |
if (net_client_parse(qemu_find_opts("net"), optarg) == -1) {
|
|
2113 | 2119 |
exit(1); |
2114 | 2120 |
} |
2115 | 2121 |
break; |
... | ... | |
2268 | 2274 |
default_monitor = 0; |
2269 | 2275 |
break; |
2270 | 2276 |
case QEMU_OPTION_mon: |
2271 |
opts = qemu_opts_parse(&qemu_mon_opts, optarg, 1);
|
|
2277 |
opts = qemu_opts_parse(qemu_find_opts("mon"), optarg, 1);
|
|
2272 | 2278 |
if (!opts) { |
2273 | 2279 |
exit(1); |
2274 | 2280 |
} |
2275 | 2281 |
default_monitor = 0; |
2276 | 2282 |
break; |
2277 | 2283 |
case QEMU_OPTION_chardev: |
2278 |
opts = qemu_opts_parse(&qemu_chardev_opts, optarg, 1);
|
|
2284 |
opts = qemu_opts_parse(qemu_find_opts("chardev"), optarg, 1);
|
|
2279 | 2285 |
if (!opts) { |
2280 | 2286 |
exit(1); |
2281 | 2287 |
} |
2282 | 2288 |
break; |
2283 | 2289 |
#ifdef CONFIG_VIRTFS |
2284 | 2290 |
case QEMU_OPTION_fsdev: |
2285 |
opts = qemu_opts_parse(&qemu_fsdev_opts, optarg, 1);
|
|
2291 |
opts = qemu_opts_parse(qemu_find_opts("fsdev"), optarg, 1);
|
|
2286 | 2292 |
if (!opts) { |
2287 | 2293 |
fprintf(stderr, "parse error: %s\n", optarg); |
2288 | 2294 |
exit(1); |
... | ... | |
2293 | 2299 |
char *arg_9p = NULL; |
2294 | 2300 |
int len = 0; |
2295 | 2301 |
|
2296 |
opts = qemu_opts_parse(&qemu_virtfs_opts, optarg, 1);
|
|
2302 |
opts = qemu_opts_parse(qemu_find_opts("virtfs"), optarg, 1);
|
|
2297 | 2303 |
if (!opts) { |
2298 | 2304 |
fprintf(stderr, "parse error: %s\n", optarg); |
2299 | 2305 |
exit(1); |
... | ... | |
2330 | 2336 |
qemu_opt_get(opts, "mount_tag"), |
2331 | 2337 |
qemu_opt_get(opts, "mount_tag")); |
2332 | 2338 |
|
2333 |
if (!qemu_opts_parse(&qemu_fsdev_opts, arg_fsdev, 1)) {
|
|
2339 |
if (!qemu_opts_parse(qemu_find_opts("fsdev"), arg_fsdev, 1)) {
|
|
2334 | 2340 |
fprintf(stderr, "parse error [fsdev]: %s\n", optarg); |
2335 | 2341 |
exit(1); |
2336 | 2342 |
} |
2337 | 2343 |
|
2338 |
if (!qemu_opts_parse(&qemu_device_opts, arg_9p, 1)) {
|
|
2344 |
if (!qemu_opts_parse(qemu_find_opts("device"), arg_9p, 1)) {
|
|
2339 | 2345 |
fprintf(stderr, "parse error [device]: %s\n", optarg); |
2340 | 2346 |
exit(1); |
2341 | 2347 |
} |
... | ... | |
2432 | 2438 |
add_device_config(DEV_USB, optarg); |
2433 | 2439 |
break; |
2434 | 2440 |
case QEMU_OPTION_device: |
2435 |
if (!qemu_opts_parse(&qemu_device_opts, optarg, 1)) {
|
|
2441 |
if (!qemu_opts_parse(qemu_find_opts("device"), optarg, 1)) {
|
|
2436 | 2442 |
exit(1); |
2437 | 2443 |
} |
2438 | 2444 |
break; |
... | ... | |
2528 | 2534 |
configure_rtc_date_offset(optarg, 1); |
2529 | 2535 |
break; |
2530 | 2536 |
case QEMU_OPTION_rtc: |
2531 |
opts = qemu_opts_parse(&qemu_rtc_opts, optarg, 0);
|
|
2537 |
opts = qemu_opts_parse(qemu_find_opts("rtc"), optarg, 0);
|
|
2532 | 2538 |
if (!opts) { |
2533 | 2539 |
exit(1); |
2534 | 2540 |
} |
... | ... | |
2636 | 2642 |
exit(1); |
2637 | 2643 |
} |
2638 | 2644 |
|
2639 |
qemu_opts_foreach(&qemu_device_opts, default_driver_check, NULL, 0);
|
|
2640 |
qemu_opts_foreach(&qemu_global_opts, default_driver_check, NULL, 0);
|
|
2645 |
qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, 0);
|
|
2646 |
qemu_opts_foreach(qemu_find_opts("global"), default_driver_check, NULL, 0);
|
|
2641 | 2647 |
|
2642 | 2648 |
if (machine->no_serial) { |
2643 | 2649 |
default_serial = 0; |
... | ... | |
2691 | 2697 |
|
2692 | 2698 |
socket_init(); |
2693 | 2699 |
|
2694 |
if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0)
|
|
2700 |
if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0)
|
|
2695 | 2701 |
exit(1); |
2696 | 2702 |
#ifdef CONFIG_VIRTFS |
2697 |
if (qemu_opts_foreach(&qemu_fsdev_opts, fsdev_init_func, NULL, 1) != 0) {
|
|
2703 |
if (qemu_opts_foreach(qemu_find_opts("fsdev"), fsdev_init_func, NULL, 1) != 0) {
|
|
2698 | 2704 |
exit(1); |
2699 | 2705 |
} |
2700 | 2706 |
#endif |
... | ... | |
2778 | 2784 |
|
2779 | 2785 |
/* open the virtual block devices */ |
2780 | 2786 |
if (snapshot) |
2781 |
qemu_opts_foreach(&qemu_drive_opts, drive_enable_snapshot, NULL, 0);
|
|
2782 |
if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, &machine->use_scsi, 1) != 0)
|
|
2787 |
qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot, NULL, 0);
|
|
2788 |
if (qemu_opts_foreach(qemu_find_opts("drive"), drive_init_func, &machine->use_scsi, 1) != 0)
|
|
2783 | 2789 |
exit(1); |
2784 | 2790 |
|
2785 | 2791 |
register_savevm_live(NULL, "ram", 0, 4, NULL, ram_save_live, NULL, |
... | ... | |
2827 | 2833 |
} |
2828 | 2834 |
} |
2829 | 2835 |
|
2830 |
if (qemu_opts_foreach(&qemu_mon_opts, mon_init_func, NULL, 1) != 0) {
|
|
2836 |
if (qemu_opts_foreach(qemu_find_opts("mon"), mon_init_func, NULL, 1) != 0) {
|
|
2831 | 2837 |
exit(1); |
2832 | 2838 |
} |
2833 | 2839 |
|
... | ... | |
2842 | 2848 |
|
2843 | 2849 |
module_call_init(MODULE_INIT_DEVICE); |
2844 | 2850 |
|
2845 |
if (qemu_opts_foreach(&qemu_device_opts, device_help_func, NULL, 0) != 0)
|
|
2851 |
if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0) != 0)
|
|
2846 | 2852 |
exit(0); |
2847 | 2853 |
|
2848 | 2854 |
if (watchdog) { |
... | ... | |
2875 | 2881 |
} |
2876 | 2882 |
|
2877 | 2883 |
/* init generic devices */ |
2878 |
if (qemu_opts_foreach(&qemu_device_opts, device_init_func, NULL, 1) != 0)
|
|
2884 |
if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1) != 0)
|
|
2879 | 2885 |
exit(1); |
2880 | 2886 |
|
2881 | 2887 |
net_check_clients(); |
Also available in: Unified diff