#include "qemu-option.h"
#include "qemu-config.h"
#include "qemu-objects.h"
+#ifdef CONFIG_LINUX
+#include "fsdev/qemu-fsdev.h"
+#endif
#include "disas.h"
static void restore_boot_devices(void *opaque)
{
char *standard_boot_devices = opaque;
+ static int first = 1;
+
+ /* Restore boot order and remove ourselves after the first boot */
+ if (first) {
+ first = 0;
+ return;
+ }
qemu_boot_set(standard_boot_devices);
vm_running = 1;
vm_state_notify(1, 0);
resume_all_vcpus();
+ monitor_protocol_event(QEVENT_RESUME, NULL);
}
}
return 0;
}
+#ifdef CONFIG_LINUX
+static int fsdev_init_func(QemuOpts *opts, void *opaque)
+{
+ int ret;
+ ret = qemu_fsdev_add(opts);
+
+ return ret;
+}
+#endif
+
static int mon_init_func(QemuOpts *opts, void *opaque)
{
CharDriverState *chr;
case QEMU_OPTION_cpu:
/* hw initialization will check this */
if (*optarg == '?') {
-/* XXX: implement xxx_cpu_list for targets that still miss it */
-#if defined(cpu_list_id)
- cpu_list_id(stdout, &fprintf, optarg);
-#elif defined(cpu_list)
- cpu_list(stdout, &fprintf); /* deprecated */
-#endif
+ list_cpus(stdout, &fprintf, optarg);
exit(0);
} else {
cpu_model = optarg;
exit(1);
}
break;
+#ifdef CONFIG_LINUX
+ case QEMU_OPTION_fsdev:
+ opts = qemu_opts_parse(&qemu_fsdev_opts, optarg, 1);
+ if (!opts) {
+ fprintf(stderr, "parse error: %s\n", optarg);
+ exit(1);
+ }
+ break;
+ case QEMU_OPTION_virtfs: {
+ char *arg_fsdev = NULL;
+ char *arg_9p = NULL;
+ int len = 0;
+
+ opts = qemu_opts_parse(&qemu_virtfs_opts, optarg, 1);
+ if (!opts) {
+ fprintf(stderr, "parse error: %s\n", optarg);
+ exit(1);
+ }
+
+ len = strlen(",id=,path=");
+ len += strlen(qemu_opt_get(opts, "fstype"));
+ len += strlen(qemu_opt_get(opts, "mount_tag"));
+ len += strlen(qemu_opt_get(opts, "path"));
+ arg_fsdev = qemu_malloc((len + 1) * sizeof(*arg_fsdev));
+
+ if (!arg_fsdev) {
+ fprintf(stderr, "No memory to parse -fsdev for %s\n",
+ optarg);
+ exit(1);
+ }
+
+ sprintf(arg_fsdev, "%s,id=%s,path=%s",
+ qemu_opt_get(opts, "fstype"),
+ qemu_opt_get(opts, "mount_tag"),
+ qemu_opt_get(opts, "path"));
+
+ len = strlen("virtio-9p-pci,fsdev=,mount_tag=");
+ len += 2*strlen(qemu_opt_get(opts, "mount_tag"));
+ arg_9p = qemu_malloc((len + 1) * sizeof(*arg_9p));
+
+ if (!arg_9p) {
+ fprintf(stderr, "No memory to parse -device for %s\n",
+ optarg);
+ exit(1);
+ }
+
+ sprintf(arg_9p, "virtio-9p-pci,fsdev=%s,mount_tag=%s",
+ qemu_opt_get(opts, "mount_tag"),
+ qemu_opt_get(opts, "mount_tag"));
+
+ if (!qemu_opts_parse(&qemu_fsdev_opts, arg_fsdev, 1)) {
+ fprintf(stderr, "parse error [fsdev]: %s\n", optarg);
+ exit(1);
+ }
+
+ if (!qemu_opts_parse(&qemu_device_opts, arg_9p, 1)) {
+ fprintf(stderr, "parse error [device]: %s\n", optarg);
+ exit(1);
+ }
+
+ qemu_free(arg_fsdev);
+ qemu_free(arg_9p);
+ break;
+ }
+#endif
case QEMU_OPTION_serial:
add_device_config(DEV_SERIAL, optarg);
default_serial = 0;
if (default_vga)
vga_interface_type = VGA_CIRRUS;
+ socket_init();
+
if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0)
exit(1);
+#ifdef CONFIG_LINUX
+ if (qemu_opts_foreach(&qemu_fsdev_opts, fsdev_init_func, NULL, 1) != 0) {
+ exit(1);
+ }
+#endif
#ifndef _WIN32
if (daemonize) {
}
configure_icount(icount_option);
- socket_init();
-
if (net_init_clients() < 0) {
exit(1);
}