X-Git-Url: http://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2FWINNT%2Fafsd%2Fcm_utils.c;h=314bb44f4d7696db6d59228ee3cda60c6e48baa5;hp=114e54d4057d97baa3914deef47b1123fcc723c6;hb=14408c7e88c198d80ce89e90e209f48685da89da;hpb=87c10e8d7f05dbbdf12ee9e8651dcec07e08af3f diff --git a/src/WINNT/afsd/cm_utils.c b/src/WINNT/afsd/cm_utils.c index 114e54d..314bb44 100644 --- a/src/WINNT/afsd/cm_utils.c +++ b/src/WINNT/afsd/cm_utils.c @@ -1,19 +1,21 @@ -/* - * Copyright (C) 1998, 1989 Transarc Corporation - All rights reserved - * - * (C) COPYRIGHT IBM CORPORATION 1987, 1988 - * LICENSED MATERIALS - PROPERTY OF IBM - * - * +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html */ #include #include +#ifndef DJGPP #include +#include +#endif /* !DJGPP */ #include #include -#include #include #include @@ -28,70 +30,87 @@ cm_space_t *cm_spaceListp; long cm_MapRPCError(long error, cm_req_t *reqp) { - if (error == 0) return 0; - - /* If we had to stop retrying, report our saved error code. */ - if (reqp && error == CM_ERROR_TIMEDOUT) { - if (reqp->accessError) - return reqp->accessError; - if (reqp->volumeError) - return reqp->volumeError; - if (reqp->rpcError) - return reqp->rpcError; - return error; - } - - if (error < 0) error = CM_ERROR_TIMEDOUT; - else if (error == 30) error = CM_ERROR_READONLY; - else if (error == 13) error = CM_ERROR_NOACCESS; - else if (error == 18) error = CM_ERROR_CROSSDEVLINK; - else if (error == 17) error = CM_ERROR_EXISTS; - else if (error == 20) error = CM_ERROR_NOTDIR; - else if (error == 2) error = CM_ERROR_NOSUCHFILE; - else if (error == 11 /* EAGAIN, most servers */ - || error == 35) /* EAGAIN, Digital UNIX */ - error = CM_ERROR_WOULDBLOCK; - else if (error == VDISKFULL - || error == 28) /* ENOSPC */ - error = CM_ERROR_SPACE; - else if (error == VOVERQUOTA - || error == 49 /* EDQUOT on Solaris */ - || error == 88 /* EDQUOT on AIX */ - || error == 69 /* EDQUOT on Digital UNIX and HPUX */ - || error == 122 /* EDQUOT on Linux */ - || error == 1133) /* EDQUOT on Irix */ - error = CM_ERROR_QUOTA; - else if (error == VNOVNODE) error = CM_ERROR_BADFD; + if (error == 0) + return 0; + + /* If we had to stop retrying, report our saved error code. */ + if (reqp && error == CM_ERROR_TIMEDOUT) { + if (reqp->accessError) + return reqp->accessError; + if (reqp->volumeError) + return reqp->volumeError; + if (reqp->rpcError) + return reqp->rpcError; return error; + } + + if (error < 0) + error = CM_ERROR_TIMEDOUT; + else if (error == 30) + error = CM_ERROR_READONLY; + else if (error == 13) + error = CM_ERROR_NOACCESS; + else if (error == 18) + error = CM_ERROR_CROSSDEVLINK; + else if (error == 17) + error = CM_ERROR_EXISTS; + else if (error == 20) + error = CM_ERROR_NOTDIR; + else if (error == 2) + error = CM_ERROR_NOSUCHFILE; + else if (error == 11 /* EAGAIN, most servers */ + || error == 35) /* EAGAIN, Digital UNIX */ + error = CM_ERROR_WOULDBLOCK; + else if (error == VDISKFULL + || error == 28) /* ENOSPC */ + error = CM_ERROR_SPACE; + else if (error == VOVERQUOTA + || error == 49 /* EDQUOT on Solaris */ + || error == 88 /* EDQUOT on AIX */ + || error == 69 /* EDQUOT on Digital UNIX and HPUX */ + || error == 122 /* EDQUOT on Linux */ + || error == 1133) /* EDQUOT on Irix */ + error = CM_ERROR_QUOTA; + else if (error == VNOVNODE) + error = CM_ERROR_BADFD; + else if (error == 21) + return CM_ERROR_ISDIR; + return error; } long cm_MapRPCErrorRmdir(long error, cm_req_t *reqp) { - if (error == 0) return 0; - - /* If we had to stop retrying, report our saved error code. */ - if (reqp && error == CM_ERROR_TIMEDOUT) { - if (reqp->accessError) - return reqp->accessError; - if (reqp->volumeError) - return reqp->volumeError; - if (reqp->rpcError) - return reqp->rpcError; - return error; - } - - if (error < 0) error = CM_ERROR_TIMEDOUT; - else if (error == 30) error = CM_ERROR_READONLY; - else if (error == 20) error = CM_ERROR_NOTDIR; - else if (error == 13) error = CM_ERROR_NOACCESS; - else if (error == 2) error = CM_ERROR_NOSUCHFILE; - else if (error == 17 /* AIX */ - || error == 66 /* SunOS 4, Digital UNIX */ - || error == 93 /* Solaris 2, IRIX */ - || error == 247) /* HP/UX */ - error = CM_ERROR_NOTEMPTY; + if (error == 0) + return 0; + + /* If we had to stop retrying, report our saved error code. */ + if (reqp && error == CM_ERROR_TIMEDOUT) { + if (reqp->accessError) + return reqp->accessError; + if (reqp->volumeError) + return reqp->volumeError; + if (reqp->rpcError) + return reqp->rpcError; return error; -} + } + + if (error < 0) + error = CM_ERROR_TIMEDOUT; + else if (error == 30) + error = CM_ERROR_READONLY; + else if (error == 20) + error = CM_ERROR_NOTDIR; + else if (error == 13) + error = CM_ERROR_NOACCESS; + else if (error == 2) + error = CM_ERROR_NOSUCHFILE; + else if (error == 17 /* AIX */ + || error == 66 /* SunOS 4, Digital UNIX */ + || error == 93 /* Solaris 2, IRIX */ + || error == 247) /* HP/UX */ + error = CM_ERROR_NOTEMPTY; + return error; +} long cm_MapVLRPCError(long error, cm_req_t *reqp) { @@ -108,8 +127,10 @@ long cm_MapVLRPCError(long error, cm_req_t *reqp) return error; } - if (error < 0) error = CM_ERROR_TIMEDOUT; - else if (error == VL_NOENT) error = CM_ERROR_NOSUCHVOLUME; + if (error < 0) + error = CM_ERROR_TIMEDOUT; + else if (error == VL_NOENT) + error = CM_ERROR_NOSUCHVOLUME; return error; } @@ -127,6 +148,7 @@ cm_space_t *cm_GetSpace(void) cm_spaceListp = tsp->nextp; } else tsp = (cm_space_t *) malloc(sizeof(cm_space_t)); + (void) memset(tsp, 0, sizeof(cm_space_t)); lock_ReleaseWrite(&cm_utilsLock); return tsp;