return;
}
- opts = qemu_opts_parse(&qemu_net_opts, opts_str ? opts_str : "", 0);
+ opts = qemu_opts_parse(qemu_find_opts("net"), opts_str ? opts_str : "", 0);
if (!opts) {
return;
}
QemuOpts *opts;
int res;
- opts = qemu_opts_from_qdict(&qemu_netdev_opts, qdict);
+ opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict);
if (!opts) {
return -1;
}
return -1;
}
qemu_del_vlan_client(vc);
- qemu_opts_del(qemu_opts_find(&qemu_netdev_opts, id));
+ qemu_opts_del(qemu_opts_find(qemu_find_opts("netdev"), id));
return 0;
}
int net_init_clients(void)
{
+ QemuOptsList *net = qemu_find_opts("net");
+
if (default_net) {
/* if no clients, we use a default config */
- qemu_opts_set(&qemu_net_opts, NULL, "type", "nic");
+ qemu_opts_set(net, NULL, "type", "nic");
#ifdef CONFIG_SLIRP
- qemu_opts_set(&qemu_net_opts, NULL, "type", "user");
+ qemu_opts_set(net, NULL, "type", "user");
#endif
}
QTAILQ_INIT(&vlans);
QTAILQ_INIT(&non_vlan_clients);
- if (qemu_opts_foreach(&qemu_netdev_opts, net_init_netdev, NULL, 1) == -1)
+ if (qemu_opts_foreach(qemu_find_opts("netdev"), net_init_netdev, NULL, 1) == -1)
return -1;
- if (qemu_opts_foreach(&qemu_net_opts, net_init_client, NULL, 1) == -1) {
+ if (qemu_opts_foreach(net, net_init_client, NULL, 1) == -1) {
return -1;
}
#include "sysemu.h"
#include "hw/qdev.h"
-QemuOptsList qemu_drive_opts = {
+static QemuOptsList qemu_drive_opts = {
.name = "drive",
.head = QTAILQ_HEAD_INITIALIZER(qemu_drive_opts.head),
.desc = {
},
};
-QemuOptsList qemu_chardev_opts = {
+static QemuOptsList qemu_chardev_opts = {
.name = "chardev",
.implied_opt_name = "backend",
.head = QTAILQ_HEAD_INITIALIZER(qemu_chardev_opts.head),
},
};
-#ifdef CONFIG_LINUX
QemuOptsList qemu_fsdev_opts = {
.name = "fsdev",
.implied_opt_name = "fstype",
{ /*End of list */ }
},
};
-#endif
-#ifdef CONFIG_LINUX
QemuOptsList qemu_virtfs_opts = {
.name = "virtfs",
.implied_opt_name = "fstype",
{ /*End of list */ }
},
};
-#endif
-QemuOptsList qemu_device_opts = {
+static QemuOptsList qemu_device_opts = {
.name = "device",
.implied_opt_name = "driver",
.head = QTAILQ_HEAD_INITIALIZER(qemu_device_opts.head),
},
};
-QemuOptsList qemu_netdev_opts = {
+static QemuOptsList qemu_netdev_opts = {
.name = "netdev",
.implied_opt_name = "type",
.head = QTAILQ_HEAD_INITIALIZER(qemu_netdev_opts.head),
},
};
-QemuOptsList qemu_net_opts = {
+static QemuOptsList qemu_net_opts = {
.name = "net",
.implied_opt_name = "type",
.head = QTAILQ_HEAD_INITIALIZER(qemu_net_opts.head),
},
};
-QemuOptsList qemu_rtc_opts = {
+static QemuOptsList qemu_rtc_opts = {
.name = "rtc",
.head = QTAILQ_HEAD_INITIALIZER(qemu_rtc_opts.head),
.desc = {
},
};
-QemuOptsList qemu_global_opts = {
+static QemuOptsList qemu_global_opts = {
.name = "global",
.head = QTAILQ_HEAD_INITIALIZER(qemu_global_opts.head),
.desc = {
},
};
-QemuOptsList qemu_mon_opts = {
+static QemuOptsList qemu_mon_opts = {
.name = "mon",
.implied_opt_name = "chardev",
.head = QTAILQ_HEAD_INITIALIZER(qemu_mon_opts.head),
},
};
-QemuOptsList qemu_cpudef_opts = {
+static QemuOptsList qemu_cpudef_opts = {
.name = "cpudef",
.head = QTAILQ_HEAD_INITIALIZER(qemu_cpudef_opts.head),
.desc = {
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;
}
}
- 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);
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;
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);
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);
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) {
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;
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);
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);
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);
}
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;
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);
}
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;
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
/* 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,
}
}
- 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);
}
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) {
}
/* 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();