]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
windows-ioctl-path-availability-20070614
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 14 Jun 2007 21:58:07 +0000 (21:58 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 14 Jun 2007 21:58:07 +0000 (21:58 +0000)
fix cm_IoctlPathAvailability to return the current volume state.
0, CM_ERROR_ALLBUSY, CM_ERROR_ALLDOWN, CM_ERROR_ALLOFFLINE

modify fs.c to generate messages when the errors are received.

src/WINNT/afsd/cm_ioctl.c
src/WINNT/afsd/fs.c

index afa0b6bef31650b05dabf35bc5f1c246e4954f6c..daab721e08b71ae23fe4422890e9f1e6cca4ca29 100644 (file)
@@ -2779,8 +2779,8 @@ long cm_IoctlPathAvailability(struct smb_ioctl *ioctlp, struct cm_user *userp)
     cm_scache_t *scp;
     cm_cell_t *cellp;
     cm_volume_t *tvp;
-    cm_serverRef_t **tsrpp;
-    unsigned long volume;
+    cm_vol_state_t *statep;
+    afs_uint32 volume;
     cm_req_t req;
 
     cm_InitReq(&req);
@@ -2802,13 +2802,30 @@ long cm_IoctlPathAvailability(struct smb_ioctl *ioctlp, struct cm_user *userp)
     if (code) 
         return code;
        
-    lock_ObtainMutex(&tvp->mx);
-    tsrpp = cm_GetVolServers(tvp, volume);
-    code = cm_CheckServersStatus(*tsrpp);
-    cm_FreeServerList(tsrpp, 0);
-    lock_ReleaseMutex(&tvp->mx);
+    if (volume == tvp->rw.ID)
+        statep = &tvp->rw;
+    else if (volume == tvp->ro.ID)
+        statep = &tvp->ro;
+    else
+        statep = &tvp->bk;
+
+    switch (statep->state) {
+    case vl_online:
+    case vl_unknown:
+        code = 0;
+        break;
+    case vl_busy:
+        code = CM_ERROR_ALLBUSY;
+        break;
+    case vl_offline:
+        code = CM_ERROR_ALLOFFLINE;
+        break;
+    case vl_alldown:
+        code = CM_ERROR_ALLDOWN;
+        break;
+    }
     cm_PutVolume(tvp);
-    return 0;
+    return code;
 }       
 
 
index 6c012f5baaa25485be382e9f29a7e36ad3e572ac..fafeacd37cec79f701720432a580602c238eef45 100644 (file)
@@ -4639,10 +4639,10 @@ Die(int code, char *filename)
     else if (code == ENODEV) {
        fprintf(stderr,"%s: AFS service may not have started.\n", pn);
     }
-    else if (code == ESRCH) {
+    else if (code == ESRCH) {   /* hack */
        fprintf(stderr,"%s: Cell name not recognized.\n", pn);
     }
-    else if (code == EPIPE) {
+    else if (code == EPIPE) {   /* hack */
        fprintf(stderr,"%s: Volume name or ID not recognized.\n", pn);
     }
     else if (code == EFBIG) {
@@ -4654,6 +4654,24 @@ Die(int code, char *filename)
        else
            fprintf(stderr,"%s: Connection timed out", pn);
     }
+    else if (code == EBUSY) {
+       if (filename) 
+            fprintf(stderr,"%s: All servers are busy on which '%s' resides\n", pn, filename);
+       else 
+            fprintf(stderr,"%s: All servers are busy\n", pn);
+    } 
+    else if (code == ENXIO) {
+       if (filename) 
+            fprintf(stderr,"%s: All volume instances are offline on which '%s' resides\n", pn, filename);
+       else 
+            fprintf(stderr,"%s: All volume instances are offline\n", pn);
+    } 
+    else if (code == ENOSYS) {
+       if (filename) 
+            fprintf(stderr,"%s: All servers are down on which '%s' resides\n", pn, filename);
+       else 
+            fprintf(stderr,"%s: All servers are down\n", pn);
+    } 
     else {
        if (filename) 
             fprintf(stderr,"%s:'%s'", pn, filename);