virtio-9p: improve error message routine. 88/28788/1
authorKitae Kim <kt920.kim@samsung.com>
Thu, 16 Oct 2014 07:28:10 +0000 (16:28 +0900)
committerKitae Kim <kt920.kim@samsung.com>
Thu, 16 Oct 2014 07:44:01 +0000 (16:44 +0900)
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 <kt920.kim@samsung.com>
hw/9pfs/virtio-9p-device.c

index 519b6e3c83ee8bda1c36c642b6ee9abb5ed416df..e7b5a5a32cbea43b2a36c4178e33cd83976952ef 100644 (file)
@@ -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);