From 1de9d8d6b90bb7345642bb3ca0f81035ac20ffe9 Mon Sep 17 00:00:00 2001 From: Kitae Kim Date: Thu, 16 Oct 2014 16:28:10 +0900 Subject: [PATCH] virtio-9p: improve error message routine. Register error message routine to show the message as a dialog, because local_init function on Windows and Mac OS X does not check virtfs parameters. Change-Id: I49a295433631b76473adce179bba665fc9823991 Signed-off-by: Kitae Kim --- hw/9pfs/virtio-9p-device.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index 519b6e3c83..e7b5a5a32c 100644 --- a/hw/9pfs/virtio-9p-device.c +++ b/hw/9pfs/virtio-9p-device.c @@ -108,9 +108,9 @@ static void virtio_9p_device_realize(DeviceState *dev, Error **errp) " and export path:%s", s->fsconf.fsdev_id, s->ctx.fs_root); #ifdef CONFIG_MARU char *path = get_canonical_path(s->ctx.fs_root); - maru_register_exit_msg(MARU_EXIT_UNKNOWN, "Failed to find the file sharing path." - " Check if the path is correct or not.\n\n%s", path); - + maru_register_exit_msg(MARU_EXIT_UNKNOWN, + "Virtio-9p Failed to initialize fs-driver with id: %s" + " and export path: %s", s->fsconf.fsdev_id, path); g_free(path); #endif goto out; @@ -130,19 +130,31 @@ static void virtio_9p_device_realize(DeviceState *dev, Error **errp) if (s->ops->name_to_path(&s->ctx, NULL, "/", &path) < 0) { #else if (s->ops->name_to_path(&s->ctx, NULL, "\\", &path) < 0) { -#endif +#endif /* CONFIG_WIN32 */ #else if (s->ops->name_to_path(&s->ctx, NULL, "/", &path) < 0) { -#endif +#endif /* CONFIG_MARU */ error_setg(errp, "error in converting name to path %s", strerror(errno)); goto out; } if (s->ops->lstat(&s->ctx, &path, &stat)) { error_setg(errp, "share path %s does not exist", fse->path); +#ifdef CONFIG_MARU + char *path = get_canonical_path(fse->path); + maru_register_exit_msg(MARU_EXIT_UNKNOWN, + "share path %s does not exist", path); + g_free(path); +#endif goto out; } else if (!S_ISDIR(stat.st_mode)) { error_setg(errp, "share path %s is not a directory", fse->path); +#ifdef CONFIG_MARU + char *path = get_canonical_path(fse->path); + maru_register_exit_msg(MARU_EXIT_UNKNOWN, + "share path %s is not a directory", path); + g_free(path); +#endif goto out; } v9fs_path_free(&path); -- 2.34.1