mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
fsdev: improve error handling of backend opts parsing
This patch changes some error messages in the backend opts parsing code and convert backends to propagate QEMU Error objects instead of calling error_report(). Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
+1
-1
@@ -103,7 +103,7 @@ void cred_init(FsCred *);
|
||||
|
||||
struct FileOperations
|
||||
{
|
||||
int (*parse_opts)(QemuOpts *, FsDriverEntry *);
|
||||
int (*parse_opts)(QemuOpts *, FsDriverEntry *, Error **errp);
|
||||
int (*init)(FsContext *);
|
||||
void (*cleanup)(FsContext *);
|
||||
int (*lstat)(FsContext *, V9fsPath *, struct stat *);
|
||||
|
||||
+3
-1
@@ -37,6 +37,7 @@ int qemu_fsdev_add(QemuOpts *opts)
|
||||
const char *fsdriver = qemu_opt_get(opts, "fsdriver");
|
||||
const char *writeout = qemu_opt_get(opts, "writeout");
|
||||
bool ro = qemu_opt_get_bool(opts, "readonly", 0);
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!fsdev_id) {
|
||||
error_report("fsdev: No id specified");
|
||||
@@ -74,7 +75,8 @@ int qemu_fsdev_add(QemuOpts *opts)
|
||||
}
|
||||
|
||||
if (fsle->fse.ops->parse_opts) {
|
||||
if (fsle->fse.ops->parse_opts(opts, &fsle->fse)) {
|
||||
if (fsle->fse.ops->parse_opts(opts, &fsle->fse, &local_err)) {
|
||||
error_report_err(local_err);
|
||||
g_free(fsle->fse.fsdev_id);
|
||||
g_free(fsle);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user