From: Guohuai Shi <guohuai....@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....@windriver.com> Signed-off-by: Bin Meng <bin.m...@windriver.com> --- hw/9pfs/9p-util.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 281fdcbf8c..145a3117dc 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -69,9 +69,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. @@ -86,6 +86,7 @@ static inline int errno_to_dotl(int err) case ELOOP: err = L_ELOOP; break; +#ifdef CONFIG_DARWIN case ENOATTR: err = L_ENODATA; break; @@ -95,6 +96,21 @@ static inline int errno_to_dotl(int err) case EOPNOTSUPP: err = L_EOPNOTSUPP; break; +#endif +#ifdef CONFIG_WIN32 + case EDEADLK: + err = L_EDEADLK; + break; + case ENOLCK: + err = L_ENOLCK; + break; + case ENOSYS: + err = L_ENOSYS; + break; + case EILSEQ: + err = L_EILSEQ; + break; +#endif default: break; } -- 2.25.1