diff options
author | Greg Kurz | 2018-01-08 11:18:23 +0100 |
---|---|---|
committer | Greg Kurz | 2018-01-08 11:18:23 +0100 |
commit | 91cda4e8f372602795e3a2f4bd2e3adaf9f82255 (patch) | |
tree | 115dc65d98c40f424f805483ea3ce15e091e3916 /fsdev | |
parent | tests: virtio-9p: set DRIVER_OK before using the device (diff) | |
download | qemu-91cda4e8f372602795e3a2f4bd2e3adaf9f82255.tar.gz qemu-91cda4e8f372602795e3a2f4bd2e3adaf9f82255.tar.xz qemu-91cda4e8f372602795e3a2f4bd2e3adaf9f82255.zip |
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>
Diffstat (limited to 'fsdev')
-rw-r--r-- | fsdev/file-op-9p.h | 2 | ||||
-rw-r--r-- | fsdev/qemu-fsdev.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index 32125100ce..b6d4eaffe3 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -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 *); diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c index 266e442b87..941e309657 100644 --- a/fsdev/qemu-fsdev.c +++ b/fsdev/qemu-fsdev.c @@ -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; |