From: Jeffrey Altman Date: Thu, 20 Aug 2009 13:21:53 +0000 (-0400) Subject: Windows: Ensure consistency of error code mapping X-Git-Tag: openafs-devel-1_5_62~32 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=8b5846b080d455c8764450b545c1ee3ded61aa3c;p=packages%2Fo%2Fopenafs.git Windows: Ensure consistency of error code mapping For Windows, the error mapping table used throughout the system is located in util/errmap_nt.h. This table was incomplete and WINNT/afsd/cm_utils.c added additional mapping locally. Move said error mapping to util/errmap_nt.h. When including afs/unified_afs.h it must be done after including afs/errmap_nt.h. Otherwise, undefined errors are mapped to EIO which should not be. LICENSE MIT Reviewed-on: http://gerrit.openafs.org/328 Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/cm_utils.c b/src/WINNT/afsd/cm_utils.c index 30119678b..3296f24f8 100644 --- a/src/WINNT/afsd/cm_utils.c +++ b/src/WINNT/afsd/cm_utils.c @@ -14,65 +14,16 @@ #include #include #include -#ifndef EWOULDBLOCK -#define EWOULDBLOCK WSAEWOULDBLOCK -#define EINPROGRESS WSAEINPROGRESS -#define EALREADY WSAEALREADY -#define ENOTSOCK WSAENOTSOCK -#define EDESTADDRREQ WSAEDESTADDRREQ -#define EMSGSIZE WSAEMSGSIZE -#define EPROTOTYPE WSAEPROTOTYPE -#define ENOPROTOOPT WSAENOPROTOOPT -#define EPROTONOSUPPORT WSAEPROTONOSUPPORT -#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT -#define EOPNOTSUPP WSAEOPNOTSUPP -#define EPFNOSUPPORT WSAEPFNOSUPPORT -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define EADDRINUSE WSAEADDRINUSE -#define EADDRNOTAVAIL WSAEADDRNOTAVAIL -#define ENETDOWN WSAENETDOWN -#define ENETUNREACH WSAENETUNREACH -#define ENETRESET WSAENETRESET -#define ECONNABORTED WSAECONNABORTED -#define ECONNRESET WSAECONNRESET -#define ENOBUFS WSAENOBUFS -#define EISCONN WSAEISCONN -#define ENOTCONN WSAENOTCONN -#define ESHUTDOWN WSAESHUTDOWN -#define ETOOMANYREFS WSAETOOMANYREFS -#define ETIMEDOUT WSAETIMEDOUT -#define ECONNREFUSED WSAECONNREFUSED -#ifdef ELOOP -#undef ELOOP -#endif -#define ELOOP WSAELOOP -#ifdef ENAMETOOLONG -#undef ENAMETOOLONG -#endif -#define ENAMETOOLONG WSAENAMETOOLONG -#define EHOSTDOWN WSAEHOSTDOWN -#define EHOSTUNREACH WSAEHOSTUNREACH -#ifdef ENOTEMPTY -#undef ENOTEMPTY -#endif -#define ENOTEMPTY WSAENOTEMPTY -#define EPROCLIM WSAEPROCLIM -#define EUSERS WSAEUSERS -#define EDQUOT WSAEDQUOT -#define ESTALE WSAESTALE -#define EREMOTE WSAEREMOTE -#endif /* EWOULDBLOCK */ -#include - #include #include +#define STRSAFE_NO_DEPRECATE +#include + #include "afsd.h" #include #include -#define STRSAFE_NO_DEPRECATE -#include - +#include static osi_once_t cm_utilsOnce; diff --git a/src/util/errmap_nt.h b/src/util/errmap_nt.h index 8c183ebcf..4ffdc012a 100644 --- a/src/util/errmap_nt.h +++ b/src/util/errmap_nt.h @@ -23,14 +23,52 @@ extern int nterr_nt2unix(long ntErr, int defaultErr); #define EWOULDBLOCK WSAEWOULDBLOCK #endif -#define ETIMEDOUT WSAETIMEDOUT -#define EDQUOT WSAEDQUOT -#define ELOOP WSAELOOP -#define EOPNOTSUPP WSAEOPNOTSUPP -#define ENOTSOCK WSAENOTSOCK -#define ECONNREFUSED WSAECONNREFUSED -#define ESTALE WSAESTALE - +#define EINPROGRESS WSAEINPROGRESS +#define EALREADY WSAEALREADY +#define ENOTSOCK WSAENOTSOCK +#define EDESTADDRREQ WSAEDESTADDRREQ +#define EMSGSIZE WSAEMSGSIZE +#define EPROTOTYPE WSAEPROTOTYPE +#define ENOPROTOOPT WSAENOPROTOOPT +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +#define EOPNOTSUPP WSAEOPNOTSUPP +#define EPFNOSUPPORT WSAEPFNOSUPPORT +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#define EADDRINUSE WSAEADDRINUSE +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#define ENETDOWN WSAENETDOWN +#define ENETUNREACH WSAENETUNREACH +#define ENETRESET WSAENETRESET +#define ECONNABORTED WSAECONNABORTED +#define ECONNRESET WSAECONNRESET +#define ENOBUFS WSAENOBUFS +#define EISCONN WSAEISCONN +#define ENOTCONN WSAENOTCONN +#define ESHUTDOWN WSAESHUTDOWN +#define ETOOMANYREFS WSAETOOMANYREFS +#define ETIMEDOUT WSAETIMEDOUT +#define ECONNREFUSED WSAECONNREFUSED +#ifdef ELOOP +#undef ELOOP +#endif +#define ELOOP WSAELOOP +#ifdef ENAMETOOLONG +#undef ENAMETOOLONG +#endif +#define ENAMETOOLONG WSAENAMETOOLONG +#define EHOSTDOWN WSAEHOSTDOWN +#define EHOSTUNREACH WSAEHOSTUNREACH +#ifdef ENOTEMPTY +#undef ENOTEMPTY +#endif +#define ENOTEMPTY WSAENOTEMPTY +#define EPROCLIM WSAEPROCLIM +#define EUSERS WSAEUSERS +#define EDQUOT WSAEDQUOT +#define ESTALE WSAESTALE +#define EREMOTE WSAEREMOTE +#endif /* EWOULDBLOCK */ /* New codes */ #define AFS_NT_ERRNO_BASE WSABASEERR + 1000 @@ -41,3 +79,4 @@ extern int nterr_nt2unix(long ntErr, int defaultErr); #define ENOTBLK (AFS_NT_ERRNO_BASE + 3) #endif /* OPENAFS_ERRMAP_NT_H */ +