aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/9p-local.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2018-01-08 11:18:23 +0100
committerGreg Kurz <groug@kaod.org>2018-01-08 11:18:23 +0100
commit65603a801e14a89701b359cd12d7c5b1764e6de1 (patch)
tree34aa64744c3e906cd3e940135a1c2aac24fecd12 /hw/9pfs/9p-local.c
parent91cda4e8f372602795e3a2f4bd2e3adaf9f82255 (diff)
downloadqemu-65603a801e14a89701b359cd12d7c5b1764e6de1.zip
qemu-65603a801e14a89701b359cd12d7c5b1764e6de1.tar.gz
qemu-65603a801e14a89701b359cd12d7c5b1764e6de1.tar.bz2
fsdev: improve error handling of backend init
This patch changes some error messages in the backend init code and convert backends to propagate QEMU Error objects instead of calling error_report(). One notable improvement is that the local backend now provides a more detailed error report when it fails to open the shared directory. Signed-off-by: Greg Kurz <groug@kaod.org>
Diffstat (limited to 'hw/9pfs/9p-local.c')
-rw-r--r--hw/9pfs/9p-local.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index e1a4b84..b25c185 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -1400,13 +1400,14 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path,
#endif
}
-static int local_init(FsContext *ctx)
+static int local_init(FsContext *ctx, Error **errp)
{
struct statfs stbuf;
LocalData *data = g_malloc(sizeof(*data));
data->mountfd = open(ctx->fs_root, O_DIRECTORY | O_RDONLY);
if (data->mountfd == -1) {
+ error_setg_errno(errp, errno, "failed to open '%s'", ctx->fs_root);
goto err;
}