/*
- * Virtio 9p
+ * 9p
*
* Copyright IBM, Corp. 2010
*
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
- *
*/
-#include <stdio.h>
-#include <string.h>
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "qemu-fsdev.h"
#include "qemu/queue.h"
-#include "qemu/osdep.h"
-#include "qemu-common.h"
#include "qemu/config-file.h"
+#include "qemu/error-report.h"
+#include "qemu/option.h"
-static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries =
+static QTAILQ_HEAD(, FsDriverListEntry) fsdriver_entries =
QTAILQ_HEAD_INITIALIZER(fsdriver_entries);
static FsDriverTable FsDrivers[] = {
{ .name = "local", .ops = &local_ops},
-#ifdef CONFIG_OPEN_BY_HANDLE
- { .name = "handle", .ops = &handle_ops},
-#endif
{ .name = "synth", .ops = &synth_ops},
{ .name = "proxy", .ops = &proxy_ops},
};
-int qemu_fsdev_add(QemuOpts *opts)
+int qemu_fsdev_add(QemuOpts *opts, Error **errp)
{
int i;
struct FsDriverListEntry *fsle;
bool ro = qemu_opt_get_bool(opts, "readonly", 0);
if (!fsdev_id) {
- fprintf(stderr, "fsdev: No id specified\n");
+ error_setg(errp, "fsdev: No id specified");
return -1;
}
}
if (i == ARRAY_SIZE(FsDrivers)) {
- fprintf(stderr, "fsdev: fsdriver %s not found\n", fsdriver);
+ error_setg(errp, "fsdev: fsdriver %s not found", fsdriver);
return -1;
}
} else {
- fprintf(stderr, "fsdev: No fsdriver specified\n");
+ error_setg(errp, "fsdev: No fsdriver specified");
return -1;
}
}
if (fsle->fse.ops->parse_opts) {
- if (fsle->fse.ops->parse_opts(opts, &fsle->fse)) {
+ if (fsle->fse.ops->parse_opts(opts, &fsle->fse, errp)) {
+ g_free(fsle->fse.fsdev_id);
+ g_free(fsle);
return -1;
}
}
}
return NULL;
}
-
-static void fsdev_register_config(void)
-{
- qemu_add_opts(&qemu_fsdev_opts);
- qemu_add_opts(&qemu_virtfs_opts);
-}
-machine_init(fsdev_register_config);
-