afs/viced: New UAE (unified_afs) error codes
[openafs.git] / src / afs / afs_error.c
index 35c92b5..42d3e23 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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
@@ -13,8 +13,6 @@
 #include <afsconfig.h>
 #include "afs/param.h"
 
-RCSID
-    ("$Header$");
 
 #include "afs/stds.h"
 #include "afs/sysincludes.h"   /* Standard vendor system headers */
@@ -28,7 +26,7 @@ RCSID
 #ifdef AFS_SGI62_ENV
 #include "h/hashing.h"
 #endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN60_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN_ENV)
 #include <netinet/in_var.h>
 #endif
 #endif /* !UKERNEL */
@@ -38,12 +36,10 @@ RCSID
 #include "afs/afs_util.h"
 #include "afs/unified_afs.h"
 
-#if    defined(AFS_SUN56_ENV)
+#if    defined(AFS_SUN5_ENV)
 #include <inet/led.h>
 #include <inet/common.h>
-#if     defined(AFS_SUN58_ENV)
 #include <netinet/ip6.h>
-#endif
 #include <inet/ip.h>
 #endif
 
@@ -194,6 +190,13 @@ init_et_to_sys_error(void)
     et2sys[(UAEDQUOT - ERROR_TABLE_BASE_uae)] = EDQUOT;
     et2sys[(UAENOMEDIUM - ERROR_TABLE_BASE_uae)] = ENOMEDIUM;
     et2sys[(UAEMEDIUMTYPE - ERROR_TABLE_BASE_uae)] = EMEDIUMTYPE;
+    et2sys[(UAECANCELED - ERROR_TABLE_BASE_uae)] = ECANCELED;
+    et2sys[(UAENOTRECOVERABLE - ERROR_TABLE_BASE_uae)] = ENOTRECOVERABLE;
+    et2sys[(UAENOTSUP - ERROR_TABLE_BASE_uae)] = ENOTSUP;
+    et2sys[(UAEOTHER - ERROR_TABLE_BASE_uae)] = EOTHER;
+    et2sys[(UAEOWNERDEAD - ERROR_TABLE_BASE_uae)] = EOWNERDEAD;
+    et2sys[(UAEPROCLIM - ERROR_TABLE_BASE_uae)] = EPROCLIM;
+    et2sys[(UAEDISCON - ERROR_TABLE_BASE_uae)] = EDISCON;
 }
 
 afs_int32
@@ -207,12 +210,22 @@ et_to_sys_error(afs_int32 in)
 }
 
 void
-afs_CopyError(register struct vrequest *afrom, register struct vrequest *ato)
+afs_CopyError(struct vrequest *afrom, struct vrequest *ato)
 {
+    int i = 0;
     AFS_STATCNT(afs_CopyError);
     if (!afrom->initd)
        return;
     afs_FinalizeReq(ato);
+    while (i < AFS_MAXHOSTS) {
+       ato->skipserver[i] = afrom->skipserver[i];
+       ato->lasterror[i] = afrom->lasterror[i];
+       i++;
+    }
+    if (afrom->tokenError)
+       ato->tokenError = afrom->tokenError;
+    if (afrom->idleError)
+       ato->idleError = afrom->idleError;
     if (afrom->accessError)
        ato->accessError = 1;
     if (afrom->volumeError)
@@ -225,12 +238,20 @@ afs_CopyError(register struct vrequest *afrom, register struct vrequest *ato)
 }
 
 void
-afs_FinalizeReq(register struct vrequest *areq)
+afs_FinalizeReq(struct vrequest *areq)
 {
+    int i = 0;
     AFS_STATCNT(afs_FinalizeReq);
     if (areq->initd)
        return;
+    while (i < AFS_MAXHOSTS) {
+       areq->skipserver[i] = 0;
+       areq->lasterror[i] = 0;
+       i++;
+    }
     areq->busyCount = 0;
+    areq->idleError = 0;
+    areq->tokenError = 0;
     areq->accessError = 0;
     areq->volumeError = 0;
     areq->networkError = 0;
@@ -262,7 +283,7 @@ afs_CheckCode(afs_int32 acode, struct vrequest *areq, int where)
     if (areq->volumeError == VOLBUSY)
        return EWOULDBLOCK;
     if (acode == VNOVNODE)
-       return ENOENT;
+       return EIO;
     if (acode == VDISKFULL)
        return ENOSPC;
     if (acode == VOVERQUOTA)
@@ -273,6 +294,9 @@ afs_CheckCode(afs_int32 acode, struct vrequest *areq, int where)
            ENOSPC
 #endif
            ;
+    /* Some fileservers kill overly-idle calls with VNOSERVICE. */
+    if (acode == VNOSERVICE)
+       return ETIMEDOUT;
 
     return acode;