[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 13/17] hw/9pfs: Translate Windows errno to Linux value
From: |
Bin Meng |
Subject: |
[PATCH v3 13/17] hw/9pfs: Translate Windows errno to Linux value |
Date: |
Mon, 19 Dec 2022 18:20:17 +0800 |
From: Guohuai Shi <guohuai.shi@windriver.com>
Some of Windows error numbers have different value from Linux ones.
For example, ENOTEMPTY is defined to 39 in Linux, but is defined to
41 in Windows. So deleting a directory from a Linux guest on top
of QEMU from a Windows host complains:
# rmdir tmp
rmdir: 'tmp': Unknown error 41
This commit provides error number translation from Windows to Linux.
It can make Linux guest OS happy with the error number when running
on top of QEMU from a Windows host.
Signed-off-by: Guohuai Shi <guohuai.shi@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
(no changes since v1)
hw/9pfs/9p-util.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h
index 0ef67a53ce..4f386f40f2 100644
--- a/hw/9pfs/9p-util.h
+++ b/hw/9pfs/9p-util.h
@@ -67,9 +67,9 @@ static inline int errno_to_dotl(int err)
{
#if defined(CONFIG_LINUX)
/* nothing to translate (Linux -> Linux) */
-#elif defined(CONFIG_DARWIN)
+#elif defined(CONFIG_DARWIN) || defined(CONFIG_WIN32)
/*
- * translation mandatory for macOS hosts
+ * translation mandatory for different hosts
*
* FIXME: Only most important errnos translated here yet, this should be
* extended to as many errnos being translated as possible in future.
@@ -78,9 +78,17 @@ static inline int errno_to_dotl(int err)
case ENAMETOOLONG: return L_ENAMETOOLONG;
case ENOTEMPTY: return L_ENOTEMPTY;
case ELOOP: return L_ELOOP;
+#ifdef CONFIG_DARWIN
case ENOATTR: return L_ENODATA;
case ENOTSUP return L_EOPNOTSUPP;
case EOPNOTSUPP: return L_EOPNOTSUPP;
+#endif
+#ifdef CONFIG_WIN32
+ case EDEADLK: return L_EDEADLK;
+ case ENOLCK: return L_ENOLCK;
+ case ENOSYS: return L_ENOSYS;
+ case EILSEQ: return L_EILSEQ;
+#endif
}
#else
#error Missing errno translation to Linux for this host system
--
2.25.1
- [PATCH v3 04/17] hw/9pfs: Add missing definitions for Windows, (continued)
- [PATCH v3 04/17] hw/9pfs: Add missing definitions for Windows, Bin Meng, 2022/12/19
- [PATCH v3 07/17] hw/9pfs: Support getting current directory offset for Windows, Bin Meng, 2022/12/19
- [PATCH v3 06/17] hw/9pfs: Update the local fs driver to support Windows, Bin Meng, 2022/12/19
- [PATCH v3 09/17] hw/9pfs: Add a helper qemu_stat_blksize(), Bin Meng, 2022/12/19
- [PATCH v3 17/17] meson.build: Turn on virtfs for Windows, Bin Meng, 2022/12/19
- [PATCH v3 01/17] qemu/xattr.h: Exclude <sys/xattr.h> for Windows, Bin Meng, 2022/12/19
- [PATCH v3 10/17] hw/9pfs: Disable unsupported flags and features for Windows, Bin Meng, 2022/12/19
- [PATCH v3 11/17] hw/9pfs: Update v9fs_set_fd_limit() for Windows, Bin Meng, 2022/12/19
- [PATCH v3 13/17] hw/9pfs: Translate Windows errno to Linux value,
Bin Meng <=
- [PATCH v3 03/17] hw/9pfs: Replace the direct call to xxxat() APIs with a wrapper, Bin Meng, 2022/12/19
- [PATCH v3 14/17] fsdev: Disable proxy fs driver on Windows, Bin Meng, 2022/12/19
- [PATCH v3 12/17] hw/9pfs: Add Linux error number definition, Bin Meng, 2022/12/19
- Re: [PATCH v3 00/17] hw/9pfs: Add 9pfs support for Windows, Christian Schoenebeck, 2022/12/21