Index: openafs/src/WINNT/afsd/cm_aclent.c
diff -c openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.6 openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.7
*** openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.6	Tue Apr 19 01:11:17 2005
--- openafs/src/WINNT/afsd/cm_aclent.c	Wed Jul 13 10:29:16 2005
***************
*** 127,133 ****
--- 127,135 ----
  
      if (aclp->backp && scp != aclp->backp) {
          ascp = aclp->backp;
+         lock_ReleaseWrite(&cm_aclLock);
          lock_ObtainMutex(&ascp->mx);
+         lock_ObtainWrite(&cm_aclLock);
      }
      CleanupACLEnt(aclp);
  
Index: openafs/src/WINNT/afsd/cm_conn.c
diff -c openafs/src/WINNT/afsd/cm_conn.c:1.25.2.11 openafs/src/WINNT/afsd/cm_conn.c:1.25.2.12
*** openafs/src/WINNT/afsd/cm_conn.c:1.25.2.11	Sun Jun 12 07:45:49 2005
--- openafs/src/WINNT/afsd/cm_conn.c	Fri Jul 22 21:17:42 2005
***************
*** 146,151 ****
--- 146,152 ----
      cm_server_t *serverp = NULL;
      cm_serverRef_t **serverspp = NULL;
      cm_serverRef_t *tsrp;
+     cm_cell_t  *cellp = NULL;
      cm_ucell_t *ucellp;
      int retry = 0;
      int free_svr_list = 0;
***************
*** 200,206 ****
      if (errorCode == CM_ERROR_TIMEDOUT) {
          if (timeLeft > 5 ) {
              thrd_Sleep(3000);
!             cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL);
              retry = 1;
          }
      } 
--- 201,216 ----
      if (errorCode == CM_ERROR_TIMEDOUT) {
          if (timeLeft > 5 ) {
              thrd_Sleep(3000);
!             if (cellp == NULL && serverp)
!                 cellp = serverp->cellp;
!             if (cellp == NULL && serversp) {
!                 struct cm_serverRef * refp;
!                 for ( refp=serversp ; cellp == NULL && refp != NULL; refp=refp->next) {
!                     if ( refp->server )
!                         cellp = refp->server->cellp;
!                 }
!             }
!             cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, cellp);
              retry = 1;
          }
      } 
Index: openafs/src/WINNT/afsd/cm_scache.c
diff -c openafs/src/WINNT/afsd/cm_scache.c:1.14.2.11 openafs/src/WINNT/afsd/cm_scache.c:1.14.2.12
*** openafs/src/WINNT/afsd/cm_scache.c:1.14.2.11	Sun Jun 12 07:45:49 2005
--- openafs/src/WINNT/afsd/cm_scache.c	Fri Jul 22 21:17:42 2005
***************
*** 200,210 ****
  long
  cm_ValidateSCache(void)
  {
!     cm_scache_t * scp;
      long i;
  
!     for ( scp = cm_data.scacheLRUFirstp; scp;
!           scp = (cm_scache_t *) osi_QNext(&scp->q) ) {
          if (scp->magic != CM_SCACHE_MAGIC) {
              afsi_log("cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC");
              fprintf(stderr, "cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC\n");
--- 200,211 ----
  long
  cm_ValidateSCache(void)
  {
!     cm_scache_t * scp, *lscp;
      long i;
  
!     for ( scp = cm_data.scacheLRUFirstp, lscp = NULL, i = 0; 
!           scp;
!           lscp = scp, scp = (cm_scache_t *) osi_QNext(&scp->q), i++ ) {
          if (scp->magic != CM_SCACHE_MAGIC) {
              afsi_log("cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC");
              fprintf(stderr, "cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC\n");
***************
*** 225,234 ****
              fprintf(stderr, "cm_ValidateSCache failure: scp->volp->magic != CM_VOLUME_MAGIC\n");
              return -4;
          }
      }
  
!     for ( scp = cm_data.scacheLRULastp; scp;
!           scp = (cm_scache_t *) osi_QPrev(&scp->q) ) {
          if (scp->magic != CM_SCACHE_MAGIC) {
              afsi_log("cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC");
              fprintf(stderr, "cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC\n");
--- 226,245 ----
              fprintf(stderr, "cm_ValidateSCache failure: scp->volp->magic != CM_VOLUME_MAGIC\n");
              return -4;
          }
+         if (i > cm_data.currentSCaches ) {
+             afsi_log("cm_ValidateSCache failure: LRU First queue loops");
+             fprintf(stderr, "cm_ValidateSCache failure: LUR First queue loops\n");
+             return -13;
+         }
+         if (lscp != (cm_scache_t *) osi_QPrev(&scp->q)) {
+             afsi_log("cm_ValidateSCache failure: QPrev(scp) != previous");
+             fprintf(stderr, "cm_ValidateSCache failure: QPrev(scp) != previous\n");
+             return -15;
+         }
      }
  
!     for ( scp = cm_data.scacheLRULastp, lscp = NULL, i = 0; scp;
!           lscp = scp, scp = (cm_scache_t *) osi_QPrev(&scp->q), i++ ) {
          if (scp->magic != CM_SCACHE_MAGIC) {
              afsi_log("cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC");
              fprintf(stderr, "cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC\n");
***************
*** 249,254 ****
--- 260,275 ----
              fprintf(stderr, "cm_ValidateSCache failure: scp->volp->magic != CM_VOLUME_MAGIC\n");
              return -8;
          }
+         if (i > cm_data.currentSCaches ) {
+             afsi_log("cm_ValidateSCache failure: LRU Last queue loops");
+             fprintf(stderr, "cm_ValidateSCache failure: LUR Last queue loops\n");
+             return -14;
+         }
+         if (lscp != (cm_scache_t *) osi_QNext(&scp->q)) {
+             afsi_log("cm_ValidateSCache failure: QNext(scp) != next");
+             fprintf(stderr, "cm_ValidateSCache failure: QNext(scp) != next\n");
+             return -16;
+         }
      }
  
      for ( i=0; i < cm_data.hashTableSize; i++ ) {
Index: openafs/src/WINNT/afsd/cm_vnodeops.c
diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.19 openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.20
*** openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.19	Sun Jun  5 02:45:31 2005
--- openafs/src/WINNT/afsd/cm_vnodeops.c	Fri Jul 22 21:17:42 2005
***************
*** 2692,2697 ****
--- 2692,2701 ----
      int found = 0;
      struct rx_connection * callp;
  
+     osi_Log1(afsd_logp, "cm_Lock scp 0x%x ...", (long) scp);
+     osi_Log4(afsd_logp, "cm_Lock type 0x%x offset %d length %d timeout %d",
+              LockType, (unsigned long)LOffset.QuadPart, (unsigned long)LLength.QuadPart, Timeout);
+ 
      /* Look for a conflict.  Also, if we are asking for a shared lock,
       * look for another shared lock, so we don't have to do an RPC.
       */
***************
*** 2707,2712 ****
--- 2711,2718 ----
          q = osi_QNext(q);
      }
  
+     osi_Log1(afsd_logp, "cm_Lock found = %d", found);
+ 
      if (found)
          code = 0;
      else {
***************
*** 2715,2720 ****
--- 2721,2727 ----
          tfid.Unique = scp->fid.unique;
          lock_ReleaseMutex(&scp->mx);
          do {
+             osi_Log1(afsd_logp, "CALL SetLock scp 0x%x", (long) scp);
              code = cm_Conn(&scp->fid, userp, reqp, &connp);
              if (code) 
                  break;
***************
*** 2726,2731 ****
--- 2733,2742 ----
  
          } while (cm_Analyze(connp, userp, reqp, &scp->fid, &volSync,
                               NULL, NULL, code));
+         if (code)
+             osi_Log1(afsd_logp, "CALL SetLock FAILURE, code 0x%x", code);
+         else
+             osi_Log0(afsd_logp, "CALL SetLock SUCCESS");
          lock_ObtainMutex(&scp->mx);
          code = cm_MapRPCError(code, reqp);
      }
***************
*** 2745,2750 ****
--- 2756,2762 ----
          lock_ReleaseWrite(&cm_scacheLock);
          if (code != 0) 
              *lockpp = fileLock;
+         osi_Log1(afsd_logp, "cm_Lock Lock added 0x%x", (long) fileLock);
      }
      return code;
  }
***************
*** 2765,2770 ****
--- 2777,2785 ----
      int found = 0;
      struct rx_connection * callp;
  
+     osi_Log4(afsd_logp, "cm_Unlock scp 0x%x type 0x%x offset %d length %d",
+              (long) scp, LockType, (unsigned long)LOffset.QuadPart, (unsigned long)LLength.QuadPart);
+ 
      if (LargeIntegerLessThan(LLength, scp->length))
          smallLock = 1;
  
***************
*** 2789,2800 ****
      }
  
      /* ignore byte ranges */
!     if (smallLock && !found)
          return 0;
  
      /* don't try to unlock other people's locks */
!     if (!found)
          return CM_ERROR_WOULDBLOCK;
  
      /* discard lock record */
      osi_QRemove(&scp->fileLocks, qq);
--- 2804,2819 ----
      }
  
      /* ignore byte ranges */
!     if (smallLock && !found) {
!         osi_Log0(afsd_logp, "cm_Unlock lock not found and ignored");
          return 0;
+     }
  
      /* don't try to unlock other people's locks */
!     if (!found) {
!         osi_Log0(afsd_logp, "cm_Unlock lock not found; failure");
          return CM_ERROR_WOULDBLOCK;
+     }
  
      /* discard lock record */
      osi_QRemove(&scp->fileLocks, qq);
***************
*** 2834,2839 ****
--- 2853,2859 ----
          lock_ObtainMutex(&scp->mx);
      }
  
+     osi_Log1(afsd_logp, "cm_Unlock code 0x%x", code);
      return code;
  }
  
Index: openafs/src/WINNT/afsd/cmdebug.c
diff -c openafs/src/WINNT/afsd/cmdebug.c:1.1.2.1 openafs/src/WINNT/afsd/cmdebug.c:1.1.2.2
*** openafs/src/WINNT/afsd/cmdebug.c:1.1.2.1	Fri Mar 11 02:22:40 2005
--- openafs/src/WINNT/afsd/cmdebug.c	Fri Jul 15 08:18:30 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/WINNT/afsd/cmdebug.c,v 1.1.2.1 2005/03/11 07:22:40 shadow Exp $");
  
  
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/WINNT/afsd/cmdebug.c,v 1.1.2.2 2005/07/15 12:18:30 jaltman Exp $");
  
  
  #include <sys/types.h>
***************
*** 86,99 ****
      }
  }
  
  static int
  PrintInterfaces(struct rx_connection *aconn)
  {
      struct interfaceAddr addr;
      char * p;
      int i, code;
  
!     code = RXAFSCB_WhoAreYou(aconn, &addr);
      if (code) {
  	printf("cmdebug: error checking interfaces: %s\n",
  	       error_message(code));
--- 86,110 ----
      }
  }
  
+ #ifndef CAPABILITY_BITS
+ #define CAPABILITY_ERRORTRANS (1<<0)
+ #define CAPABILITY_BITS 1
+ #endif
+ 
  static int
  PrintInterfaces(struct rx_connection *aconn)
  {
+     Capabilities caps;
      struct interfaceAddr addr;
      char * p;
      int i, code;
  
!     caps.Capabilities_val = NULL;
!     caps.Capabilities_len = 0;
! 
!     code = RXAFSCB_TellMeAboutYourself(aconn, &addr, &caps);
!     if (code == RXGEN_OPCODE)
!         code = RXAFSCB_WhoAreYou(aconn, &addr);
      if (code) {
  	printf("cmdebug: error checking interfaces: %s\n",
  	       error_message(code));
***************
*** 114,119 ****
--- 125,143 ----
  	printf("\n");
      }
  
+     if (caps.Capabilities_val) {
+         printf("Capabilities:\n");
+         if (caps.Capabilities_val[0] & CAPABILITY_ERRORTRANS) {
+             printf("Error Translation\n");  
+         }
+         printf("\n");
+     }
+ 
+     if (caps.Capabilities_val)
+ 	free(caps.Capabilities_val);
+     caps.Capabilities_val = NULL;
+     caps.Capabilities_len = 0;
+ 
      return 0;
  }
  
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.42.2.27 openafs/src/WINNT/afsd/smb3.c:1.42.2.28
*** openafs/src/WINNT/afsd/smb3.c:1.42.2.27	Sun May 22 01:54:21 2005
--- openafs/src/WINNT/afsd/smb3.c	Fri Jul 22 21:17:43 2005
***************
*** 4783,4788 ****
--- 4783,4797 ----
      return 0;
  }       
  
+ /* The file locking code is incomplete and that which is implemented in cm_Lock()
+  * is broken.  What exists functions only because it is rarely if ever called.
+  * The tests activated by FULL_LOCKS_ONLY ensure that cm_Lock() is only called
+  * if the lock covers the entire file.  Therefore, RXAFS_SetLock is only called 
+  * rarely.   That means that AFS locks are ignored by Windows clients.
+  * When cm_Lock is re-written, undefine or better yet remove, the FULL_LOCKS_ONLY
+  * code.
+  */
+ #define FULL_LOCKS_ONLY
  long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
  {
      cm_req_t req;
***************
*** 4807,4812 ****
--- 4816,4822 ----
  
      fidp = smb_FindFID(vcp, fid, 0);
      if (!fidp || (fidp->flags & SMB_FID_IOCTL)) {
+         osi_Log0(smb_logp, "smb_ReceiveV3Locking BadFD");
          return CM_ERROR_BADFD;
      }
      /* set inp->fid so that later read calls in same msg can find fid */
***************
*** 4821,4828 ****
                        CM_SCACHESYNC_NEEDCALLBACK
  			 | CM_SCACHESYNC_GETSTATUS
  			 | CM_SCACHESYNC_LOCK);
!     if (code) 
          goto doneSync;
  
      LockType = smb_GetSMBParm(inp, 3) & 0xff;
      Timeout = (smb_GetSMBParm(inp, 5) << 16) + smb_GetSMBParm(inp, 4);
--- 4831,4840 ----
                        CM_SCACHESYNC_NEEDCALLBACK
  			 | CM_SCACHESYNC_GETSTATUS
  			 | CM_SCACHESYNC_LOCK);
!     if (code) {
!         osi_Log1(smb_logp, "smb_ReceiveV3Locking SyncOp failure code 0x%x", code);
          goto doneSync;
+     }
  
      LockType = smb_GetSMBParm(inp, 3) & 0xff;
      Timeout = (smb_GetSMBParm(inp, 5) << 16) + smb_GetSMBParm(inp, 4);
***************
*** 4848,4855 ****
              LLength.LowPart = *((DWORD *)(op + 6));
              op += 10;
          }
!         if (LargeIntegerNotEqualToZero(LOffset))
              continue;
          /* Do not check length -- length check done in cm_Unlock */
  
          code = cm_Unlock(scp, LockType, LOffset, LLength, userp, &req);
--- 4860,4872 ----
              LLength.LowPart = *((DWORD *)(op + 6));
              op += 10;
          }
! #ifdef FULL_LOCKS_ONLY
!         if (LargeIntegerNotEqualToZero(LOffset)) {
!             osi_Log2(smb_logp, "smb_ReceiveV3Locking Unlock %d offset 0x%x != Zero",
!                      i, (long)LOffset.QuadPart);
              continue;
+         }
+ #endif /* FULL_LOCKS_ONLY */
          /* Do not check length -- length check done in cm_Unlock */
  
          code = cm_Unlock(scp, LockType, LOffset, LLength, userp, &req);
***************
*** 4873,4883 ****
              LLength.LowPart = *((DWORD *)(op + 6));
              op += 10;
          }
!         if (LargeIntegerNotEqualToZero(LOffset))
              continue;
!         if (LargeIntegerLessThan(LOffset, scp->length))
              continue;
! 
          code = cm_Lock(scp, LockType, LOffset, LLength, Timeout,
                          userp, &req, &lockp);
          if (code == CM_ERROR_WOULDBLOCK && Timeout != 0) {
--- 4890,4907 ----
              LLength.LowPart = *((DWORD *)(op + 6));
              op += 10;
          }
! #ifdef FULL_LOCKS_ONLY
!         if (LargeIntegerNotEqualToZero(LOffset)) {
!             osi_Log2(smb_logp, "smb_ReceiveV3Locking Lock %d offset 0x%x != Zero",
!                      i, (long)LOffset.QuadPart);
              continue;
!         }
!         if (LargeIntegerLessThan(LOffset, scp->length)) {
!             osi_Log3(smb_logp, "smb_ReceiveV3Locking Unlock %d offset 0x%x < 0x%x",
!                      i, (long)LOffset.QuadPart, (long)scp->length.QuadPart);
              continue;
!         }
! #endif /* FULL_LOCKS_ONLY */
          code = cm_Lock(scp, LockType, LOffset, LLength, Timeout,
                          userp, &req, &lockp);
          if (code == CM_ERROR_WOULDBLOCK && Timeout != 0) {
***************
*** 4896,4908 ****
              lock_ReleaseWrite(&smb_globalLock);
              /* don't send reply immediately */
              outp->flags |= SMB_PACKETFLAG_NOSEND;
          }
!         if (code) 
              break;
      }           
  
      if (code) {
          /* release any locks acquired before the failure */
      }
      else
          smb_SetSMBDataLength(outp, 0);
--- 4920,4938 ----
              lock_ReleaseWrite(&smb_globalLock);
              /* don't send reply immediately */
              outp->flags |= SMB_PACKETFLAG_NOSEND;
+             osi_Log1(smb_logp, "smb_ReceiveV3Locking WaitingLock created 0x%x",
+                      (long) waitingLock);
+             continue;
          }
!         if (code) {
!             osi_Log1(smb_logp, "smb_ReceiveV3Locking cm_Lock failure code 0x%x", code);
              break;
+         }
      }           
  
      if (code) {
          /* release any locks acquired before the failure */
+         osi_Log0(smb_logp, "smb_ReceiveV3Locking - failure; should be releasing locks but don't!!!!");
      }
      else
          smb_SetSMBDataLength(outp, 0);
Index: openafs/src/WINNT/aklog/aklog.c
diff -c openafs/src/WINNT/aklog/aklog.c:1.5.2.11 openafs/src/WINNT/aklog/aklog.c:1.5.2.12
*** openafs/src/WINNT/aklog/aklog.c:1.5.2.11	Mon Jul 11 15:39:55 2005
--- openafs/src/WINNT/aklog/aklog.c	Fri Jul 15 08:11:02 2005
***************
*** 183,189 ****
  {
      static char lastcell[MAXCELLCHARS+1] = { 0 };
      static char confname[512] = { 0 };
!     long viceId;			/* AFS uid of user */
  #ifdef ALLOW_REGISTER
      afs_int32 id;
  #endif /* ALLOW_REGISTER */
--- 183,189 ----
  {
      static char lastcell[MAXCELLCHARS+1] = { 0 };
      static char confname[512] = { 0 };
!     afs_int32 viceId;			/* AFS uid of user */
  #ifdef ALLOW_REGISTER
      afs_int32 id;
  #endif /* ALLOW_REGISTER */
***************
*** 196,231 ****
      if (dflag)
          printf("About to resolve name %s to id\n", username);
  
- #ifdef COMMENT
-     /*
-     * Talk about DUMB!  It turns out that there is a bug in
-     * pr_Initialize -- even if you give a different cell name
-     * to it, it still uses a connection to a previous AFS server
-     * if one exists.  The way to fix this is to change the
-     * _filename_ argument to pr_Initialize - that forces it to
-     * re-initialize the connection.  We do this by adding and
-     * removing a "/" on the end of the configuration directory name.
-     */
- 
-     if (lastcell[0] != '\0' && (strcmp(lastcell, aserver->cell) != 0)) {
-         int i = strlen(confname);
-         if (confname[i - 1] == '/') {
-             confname[i - 1] = '\0';
-         } else {
-             confname[i] = '/';
-             confname[i + 1] = '\0';
-         }
-     }
- #endif
- 
      strcpy(lastcell, aserver->cell);
  
! 	if (!pr_Initialize (0, confname, aserver->cell)) {
! 		char sname[PR_MAXNAMELEN];
! 		strncpy(sname, username, PR_MAXNAMELEN);
! 		sname[PR_MAXNAMELEN-1] = '\0';
          *status = pr_SNameToId (sname, &viceId);
! 	}
  
      if (dflag)
      {
--- 196,209 ----
      if (dflag)
          printf("About to resolve name %s to id\n", username);
  
      strcpy(lastcell, aserver->cell);
  
!     if (!pr_Initialize (0, confname, aserver->cell)) {
!         char sname[PR_MAXNAMELEN];
!         strncpy(sname, username, PR_MAXNAMELEN);
!         sname[PR_MAXNAMELEN-1] = '\0';
          *status = pr_SNameToId (sname, &viceId);
!     }
  
      if (dflag)
      {
Index: openafs/src/WINNT/client_config/config.cpp
diff -c openafs/src/WINNT/client_config/config.cpp:1.5.2.3 openafs/src/WINNT/client_config/config.cpp:1.5.2.4
*** openafs/src/WINNT/client_config/config.cpp:1.5.2.3	Wed Jul  6 20:29:12 2005
--- openafs/src/WINNT/client_config/config.cpp	Fri Jul 15 07:58:52 2005
***************
*** 780,790 ****
  void Config_GetCachePath (LPTSTR pszCachePath)
  {
      if (!Config_ReadGlobalString (TEXT("CachePath"), pszCachePath, MAX_PATH)) {
!         TCHAR szPath[MAX_PATH];
!         GetWindowsDirectory(szPath, sizeof(szPath));
!         szPath[2] = 0;	/* get drive letter only */
!         strcat(szPath, "\\AFSCache");
  
          lstrcpy (pszCachePath, szPath);
      }
  }        
--- 780,809 ----
  void Config_GetCachePath (LPTSTR pszCachePath)
  {
      if (!Config_ReadGlobalString (TEXT("CachePath"), pszCachePath, MAX_PATH)) {
!         HKEY hk;
!         TCHAR szPath[ MAX_PATH ] = TEXT("");
  
+         if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT("System\\CurrentControlSet\\Control\\Session Manager\\Environment"), 0, KEY_QUERY_VALUE, &hk) == ERROR_SUCCESS)
+         {
+             DWORD dwSize = sizeof(szPath);
+             DWORD dwType = 0; 
+ 
+             if (RegQueryValueEx (hk, TEXT("TEMP"), NULL, &dwType, (PBYTE)szPath, &dwSize) == ERROR_SUCCESS)
+             {
+                 if ( dwType == REG_EXPAND_SZ ) {
+                     TCHAR szTemp[ MAX_PATH ];
+                     lstrcpy(szTemp, szPath);
+                     ExpandEnvironmentStrings(szTemp, szPath, MAX_PATH);
+                 }
+             }
+             RegCloseKey (hk);
+             lstrcat(szPath, "\\AFSCache");
+         }
+ 
+         if ( !szPath[0] ) {
+             GetWindowsDirectory(szPath, sizeof(szPath));
+             lstrcat(szPath, "\\TEMP\\AFSCache");
+         }
          lstrcpy (pszCachePath, szPath);
      }
  }        
Index: openafs/src/WINNT/client_exp/gui2fs.cpp
diff -c openafs/src/WINNT/client_exp/gui2fs.cpp:1.10.2.4 openafs/src/WINNT/client_exp/gui2fs.cpp:1.10.2.5
*** openafs/src/WINNT/client_exp/gui2fs.cpp:1.10.2.4	Wed Jul  6 20:29:14 2005
--- openafs/src/WINNT/client_exp/gui2fs.cpp	Tue Jul 19 01:06:59 2005
***************
*** 1236,1241 ****
--- 1236,1242 ----
      char lsbuffer[1024];
      register char *tp;
      char szCurItem[1024];
+ 
      strcpy(szCurItem, name);
  	
      tp = (char *)strrchr(szCurItem, '\\');
***************
*** 1274,1279 ****
--- 1275,1281 ----
      char tbuffer[1024];
      char lsbuffer[1024];
      register char *tp;
+     char szCurItem[1024];
      BOOL error = FALSE;
      CStringArray results;
      CString str;
***************
*** 1291,1296 ****
--- 1293,1312 ----
              continue;	// don't bother trying
          }
  
+         strcpy(szCurItem, files[i]);
+ 	
+         tp = (char *)strrchr(szCurItem, '\\');
+         if (tp) {
+             strncpy(tbuffer, szCurItem, code = tp - szCurItem + 1);  /* the dir name */
+             tbuffer[code] = 0;
+             tp++;   /* skip the slash */
+         } else {
+             fs_ExtractDriveLetter(szCurItem, tbuffer);
+             strcat(tbuffer, ".");
+             tp = szCurItem;
+             fs_StripDriveLetter(tp, tp, 0);
+         }
+ 
          blob.out_size = 0;
          blob.in = tp;
          blob.in_size = strlen(tp)+1;
Index: openafs/src/afs/afs_buffer.c
diff -c openafs/src/afs/afs_buffer.c:1.16.2.4 openafs/src/afs/afs_buffer.c:1.16.2.5
*** openafs/src/afs/afs_buffer.c:1.16.2.4	Sun Apr  3 14:15:35 2005
--- openafs/src/afs/afs_buffer.c	Thu Jul 28 17:33:57 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_buffer.c,v 1.16.2.4 2005/04/03 18:15:35 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_buffer.c,v 1.16.2.5 2005/07/28 21:33:57 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 130,136 ****
  #endif
  	/* Fill in each buffer with an empty indication. */
  	tb = &Buffers[i];
! 	tb->fid = 0;
  	tb->inode = 0;
  	tb->accesstime = 0;
  	tb->lockers = 0;
--- 130,136 ----
  #endif
  	/* Fill in each buffer with an empty indication. */
  	tb = &Buffers[i];
! 	tb->fid = NULLIDX;
  	tb->inode = 0;
  	tb->accesstime = 0;
  	tb->lockers = 0;
***************
*** 226,232 ****
      MReleaseWriteLock(&afs_bufferLock);
      tb->lockers++;
      if (page * AFS_BUFFER_PAGESIZE >= adc->f.chunkBytes) {
! 	tb->fid = 0;
  	tb->inode = 0;
  	tb->lockers--;
  	MReleaseWriteLock(&tb->lock);
--- 226,232 ----
      MReleaseWriteLock(&afs_bufferLock);
      tb->lockers++;
      if (page * AFS_BUFFER_PAGESIZE >= adc->f.chunkBytes) {
! 	tb->fid = NULLIDX;
  	tb->inode = 0;
  	tb->lockers--;
  	MReleaseWriteLock(&tb->lock);
***************
*** 238,244 ****
  		      AFS_BUFFER_PAGESIZE);
      afs_CFileClose(tfile);
      if (code < AFS_BUFFER_PAGESIZE) {
! 	tb->fid = 0;
  	tb->inode = 0;
  	tb->lockers--;
  	MReleaseWriteLock(&tb->lock);
--- 238,244 ----
  		      AFS_BUFFER_PAGESIZE);
      afs_CFileClose(tfile);
      if (code < AFS_BUFFER_PAGESIZE) {
! 	tb->fid = NULLIDX;
  	tb->inode = 0;
  	tb->lockers--;
  	MReleaseWriteLock(&tb->lock);
***************
*** 450,456 ****
  	for (tb = phTable[pHash(adc->index, i)]; tb; tb = tb->hashNext)
  	    if (tb->fid == adc->index) {
  		MObtainWriteLock(&tb->lock, 262);
! 		tb->fid = 0;
  		tb->inode = 0;
  		tb->dirty = 0;
  		MReleaseWriteLock(&tb->lock);
--- 450,456 ----
  	for (tb = phTable[pHash(adc->index, i)]; tb; tb = tb->hashNext)
  	    if (tb->fid == adc->index) {
  		MObtainWriteLock(&tb->lock, 262);
! 		tb->fid = NULLIDX;
  		tb->inode = 0;
  		tb->dirty = 0;
  		MReleaseWriteLock(&tb->lock);
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.81.2.17 openafs/src/afs/afs_pioctl.c:1.81.2.18
*** openafs/src/afs/afs_pioctl.c:1.81.2.17	Mon May 30 00:05:41 2005
--- openafs/src/afs/afs_pioctl.c	Thu Jul 21 00:49:18 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.81.2.17 2005/05/30 04:05:41 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.81.2.18 2005/07/21 04:49:18 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
***************
*** 2716,2722 ****
      register struct unixuser *au;
      register afs_int32 pag, error;
      int t, count, num = 0;
!     char **sysnamelist[MAXSYSNAME];
  
      AFS_STATCNT(PSetSysName);
      if (!afs_globalVFS) {
--- 2716,2722 ----
      register struct unixuser *au;
      register afs_int32 pag, error;
      int t, count, num = 0;
!     char **sysnamelist[MAXNUMSYSNAMES];
  
      AFS_STATCNT(PSetSysName);
      if (!afs_globalVFS) {
Index: openafs/src/afs/afs_prototypes.h
diff -c openafs/src/afs/afs_prototypes.h:1.53.2.10 openafs/src/afs/afs_prototypes.h:1.53.2.11
*** openafs/src/afs/afs_prototypes.h:1.53.2.10	Mon Jul 11 15:29:55 2005
--- openafs/src/afs/afs_prototypes.h	Tue Jul 12 13:49:45 2005
***************
*** 814,821 ****
  extern int afsvnumbers;
  extern afs_rwlock_t afs_xvcache;
  extern afs_lock_t afs_xvcb;
- extern struct vcache *freeVCList;
- extern struct vcache *Initial_freeVCList;
  extern struct afs_q VLRU;
  extern afs_int32 vcachegen;
  extern unsigned int afs_paniconwarn;
--- 814,819 ----
Index: openafs/src/afs/LINUX/osi_sleep.c
diff -c openafs/src/afs/LINUX/osi_sleep.c:1.22.2.1 openafs/src/afs/LINUX/osi_sleep.c:1.22.2.2
*** openafs/src/afs/LINUX/osi_sleep.c:1.22.2.1	Tue Dec  7 01:12:13 2004
--- openafs/src/afs/LINUX/osi_sleep.c	Mon Jul 25 14:14:40 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_sleep.c,v 1.22.2.1 2004/12/07 06:12:13 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_sleep.c,v 1.22.2.2 2005/07/25 18:14:40 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 193,201 ****
--- 193,203 ----
  	AFS_GUNLOCK();
  	schedule();
  #ifdef AFS_LINUX26_ENV
+ #ifdef CONFIG_PF
  	if (current->flags & PF_FREEZE)
  	    refrigerator(PF_FREEZE);
  #endif
+ #endif
  	AFS_GLOCK();
  	if (signal_pending(current)) {
  	    retval = EINTR;
***************
*** 275,283 ****
--- 277,287 ----
      } else
  	schedule_timeout(ticks);
  #ifdef AFS_LINUX26_ENV
+ #ifdef CONFIG_PF
      if (current->flags & PF_FREEZE)
  	refrigerator(PF_FREEZE);
  #endif
+ #endif
  
      AFS_GLOCK();
      remove_wait_queue(&evp->cond, &wait);
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.6 openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.8
*** openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.6	Mon Jul 11 15:29:56 2005
--- openafs/src/afs/LINUX/osi_vfsops.c	Tue Jul 26 14:27:02 2005
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.6 2005/07/11 19:29:56 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.8 2005/07/26 18:27:02 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
***************
*** 132,139 ****
--- 132,150 ----
      sb->s_magic = AFS_VFSMAGIC;
      sb->s_op = &afs_sops;	/* Super block (vfs) ops */
  #if defined(MAX_NON_LFS)
+ #ifdef AFS_64BIT_CLIENT
+ #if !defined(MAX_LFS_FILESIZE)
+ #if BITS_PER_LONG==32
+ #define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 
+ #elif BITS_PER_LONG==64
+ #define MAX_LFS_FILESIZE 0x7fffffffffffffff
+ #endif
+ #endif
+     sb->s_maxbytes = MAX_LFS_FILESIZE;
+ #else
      sb->s_maxbytes = MAX_NON_LFS;
  #endif
+ #endif
      code = afs_root(sb);
      if (code) {
  	afs_globalVFS = NULL;
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.25 openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.28
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.25	Mon Jul 11 15:29:56 2005
--- openafs/src/afs/LINUX/osi_vnodeops.c	Tue Jul 26 13:40:36 2005
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.25 2005/07/11 19:29:56 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.28 2005/07/26 17:40:36 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 73,122 ****
      if (code)
  	code = -code;
      else {
- #ifdef AFS_64BIT_CLIENT
- 	if (*offp + count > afs_vmMappingEnd) {
- 	    uio_t tuio;
- 	    struct iovec iov;
- 	    afs_int32 xfered = 0;
- 
- 	    if (*offp < afs_vmMappingEnd) {
- 		/* special case of a buffer crossing the VM mapping end */
- 		afs_int32 tcount = afs_vmMappingEnd - *offp;
- 		count -= tcount;
- 		osi_FlushPages(vcp, credp);	/* ensure stale pages are gone */
- 		AFS_GUNLOCK();
- 		code = generic_file_read(fp, buf, tcount, offp);
- 		AFS_GLOCK();
- 		if (code != tcount) {
- 		    goto done;
- 		}
- 		xfered = tcount;
- 	    }
- 	    setup_uio(&tuio, &iov, buf + xfered, (afs_offs_t) * offp, count,
- 		      UIO_READ, AFS_UIOSYS);
- 	    code = afs_read(vcp, &tuio, credp, 0, 0, 0);
- 	    xfered += count - tuio.uio_resid;
- 	    if (code != 0) {
- 		afs_Trace4(afs_iclSetp, CM_TRACE_READOP, ICL_TYPE_POINTER,
- 			   vcp, ICL_TYPE_OFFSET, offp, ICL_TYPE_INT32, -1,
- 			   ICL_TYPE_INT32, code);
- 		code = xfered;
- 		*offp += count - tuio.uio_resid;
- 	    } else {
- 		code = xfered;
- 		*offp += count;
- 	    }
- 	  done:
- 		;
- 	} else {
- #endif /* AFS_64BIT_CLIENT */
  	    osi_FlushPages(vcp, credp);	/* ensure stale pages are gone */
  	    AFS_GUNLOCK();
  	    code = generic_file_read(fp, buf, count, offp);
  	    AFS_GLOCK();
- #ifdef AFS_64BIT_CLIENT
- 	}
- #endif /* AFS_64BIT_CLIENT */
      }
  
      afs_Trace4(afs_iclSetp, CM_TRACE_READOP, ICL_TYPE_POINTER, vcp,
--- 73,82 ----
***************
*** 141,147 ****
      struct vcache *vcp = VTOAFS(fp->f_dentry->d_inode);
      struct vrequest treq;
      cred_t *credp = crref();
-     afs_offs_t toffs;
  
      AFS_GLOCK();
  
--- 101,106 ----
***************
*** 161,229 ****
      if (code)
  	code = -code;
      else {
- #ifdef AFS_64BIT_CLIENT
- 	toffs = *offp;
- 	if (fp->f_flags & O_APPEND)
- 	    toffs += vcp->m.Length;
- 	if (toffs + count > afs_vmMappingEnd) {
- 	    uio_t tuio;
- 	    struct iovec iov;
- 	    afs_size_t oldOffset = *offp;
- 	    afs_int32 xfered = 0;
- 
- 	    if (toffs < afs_vmMappingEnd) {
- 		/* special case of a buffer crossing the VM mapping end */
- 		afs_int32 tcount = afs_vmMappingEnd - *offp;
- 		count -= tcount;
- 		AFS_GUNLOCK();
- 		code = generic_file_write(fp, buf, tcount, offp);
- 		AFS_GLOCK();
- 		if (code != tcount) {
- 		    goto done;
- 		}
- 		xfered = tcount;
- 		toffs += tcount;
- 	    }
- 	    setup_uio(&tuio, &iov, buf + xfered, (afs_offs_t) toffs, count,
- 		      UIO_WRITE, AFS_UIOSYS);
- 	    code = afs_write(vcp, &tuio, fp->f_flags, credp, 0);
- 	    xfered += count - tuio.uio_resid;
- 	    if (code != 0) {
- 		code = xfered;
- 		*offp += count - tuio.uio_resid;
- 	    } else {
- 		/* Purge dirty chunks of file if there are too many dirty chunks.
- 		 * Inside the write loop, we only do this at a chunk boundary.
- 		 * Clean up partial chunk if necessary at end of loop.
- 		 */
- 		if (AFS_CHUNKBASE(tuio.afsio_offset) !=
- 		    AFS_CHUNKBASE(oldOffset)) {
- 		    ObtainWriteLock(&vcp->lock, 402);
- 		    code = afs_DoPartialWrite(vcp, &treq);
- 		    vcp->states |= CDirty;
- 		    ReleaseWriteLock(&vcp->lock);
- 		}
- 		code = xfered;
- 		*offp += count;
- 		toffs += count;
- 		ObtainWriteLock(&vcp->lock, 400);
- 		vcp->m.Date = osi_Time();	/* Set file date (for ranlib) */
- 		/* extend file */
- 		if (!(fp->f_flags & O_APPEND) && toffs > vcp->m.Length) {
- 		    vcp->m.Length = toffs;
- 		}
- 		ReleaseWriteLock(&vcp->lock);
- 	    }
- 	  done:
- 		;
- 	} else {
- #endif /* AFS_64BIT_CLIENT */
  	    AFS_GUNLOCK();
  	    code = generic_file_write(fp, buf, count, offp);
  	    AFS_GLOCK();
- #ifdef AFS_64BIT_CLIENT
- 	}
- #endif /* AFS_64BIT_CLIENT */
      }
  
      ObtainWriteLock(&vcp->lock, 530);
--- 120,128 ----
***************
*** 424,494 ****
  }
  #endif
  
- /* We need to detect unmap's after close. To do that, we need our own
-  * vm_operations_struct's. And we need to set them up for both the
-  * private and shared mappings. The fun part is that these are all static
-  * so we'll have to initialize on the fly!
-  */
- static struct vm_operations_struct afs_private_mmap_ops;
- static int afs_private_mmap_ops_inited = 0;
- static struct vm_operations_struct afs_shared_mmap_ops;
- static int afs_shared_mmap_ops_inited = 0;
- 
- static void
- afs_linux_vma_close(struct vm_area_struct *vmap)
- {
-     struct vcache *vcp;
-     cred_t *credp;
-     int need_unlock = 0;
- 
-     if (!vmap->vm_file)
- 	return;
- 
-     vcp = VTOAFS(FILE_INODE(vmap->vm_file));
-     if (!vcp)
- 	return;
- 
-     AFS_GLOCK();
-     afs_Trace4(afs_iclSetp, CM_TRACE_VM_CLOSE, ICL_TYPE_POINTER, vcp,
- 	       ICL_TYPE_INT32, vcp->mapcnt, ICL_TYPE_INT32, vcp->opens,
- 	       ICL_TYPE_INT32, vcp->execsOrWriters);
-     if ((&vcp->lock)->excl_locked == 0 || (&vcp->lock)->pid_writer == MyPidxx) {
- 	ObtainWriteLock(&vcp->lock, 532);
- 	need_unlock = 1;
-     } else
- 	printk("AFS_VMA_CLOSE(%d): Skipping Already locked vcp=%p vmap=%p\n",
- 	       MyPidxx, &vcp, &vmap);
-     if (vcp->mapcnt) {
- 	vcp->mapcnt--;
- 	if (need_unlock)
- 	    ReleaseWriteLock(&vcp->lock);
- 	if (!vcp->mapcnt) {
- 	    if (need_unlock && vcp->execsOrWriters < 2) {
- 		credp = crref();
- 		(void)afs_close(vcp, vmap->vm_file->f_flags, credp);
- 		/* only decrement the execsOrWriters flag if this is not a
- 		 * writable file. */
- 		if (!(vcp->states & CRO) )
- 		    if (! (vmap->vm_file->f_flags & (FWRITE | FTRUNC)))
- 			vcp->execsOrWriters--;
- 		vcp->states &= ~CMAPPED;
- 		crfree(credp);
- 	    } else if ((vmap->vm_file->f_flags & (FWRITE | FTRUNC)))
- 		vcp->execsOrWriters--;
- 	    /* If we did not have the lock */
- 	    if (!need_unlock) {
- 		vcp->mapcnt++;
- 		if (!vcp->execsOrWriters)
- 		    vcp->execsOrWriters = 1;
- 	    }
- 	}
-     } else {
- 	if (need_unlock)
- 	    ReleaseWriteLock(&vcp->lock);
-     }
- 
-     AFS_GUNLOCK();
- }
  
  static int
  afs_linux_mmap(struct file *fp, struct vm_area_struct *vmap)
--- 323,328 ----
***************
*** 512,570 ****
  
      /* get a validated vcache entry */
      code = afs_InitReq(&treq, credp);
-     if (!code)
- 	code = afs_VerifyVCache(vcp, &treq);
- 
-     if (!code && (vcp->states & CRO) && 
- 	(vmap->vm_file->f_flags & (FWRITE | FTRUNC)))
- 	code = EACCES;
- 
      if (code)
! 	code = -code;
!     else {
! 	osi_FlushPages(vcp, credp);	/* ensure stale pages are gone */
! 
! 	AFS_GUNLOCK();
! 	code = generic_file_mmap(fp, vmap);
! 	AFS_GLOCK();
!     }
  
!     if (code == 0) {
! 	ObtainWriteLock(&vcp->lock, 531);
! 	/* Set out vma ops so we catch the close. The following test should be
! 	 * the same as used in generic_file_mmap.
! 	 */
! 	if ((vmap->vm_flags & VM_SHARED) && (vmap->vm_flags & VM_MAYWRITE)) {
! 	    if (!afs_shared_mmap_ops_inited) {
! 		afs_shared_mmap_ops_inited = 1;
! 		afs_shared_mmap_ops = *vmap->vm_ops;
! 		afs_shared_mmap_ops.close = afs_linux_vma_close;
! 	    }
! 	    vmap->vm_ops = &afs_shared_mmap_ops;
! 	} else {
! 	    if (!afs_private_mmap_ops_inited) {
! 		afs_private_mmap_ops_inited = 1;
! 		afs_private_mmap_ops = *vmap->vm_ops;
! 		afs_private_mmap_ops.close = afs_linux_vma_close;
! 	    }
! 	    vmap->vm_ops = &afs_private_mmap_ops;
! 	}
  
  
! 	/* Add an open reference on the first mapping. */
! 	if (vcp->mapcnt == 0) {
! 	    if (!(vcp->states & CRO))
! 		vcp->execsOrWriters++;
! 	    vcp->opens++;
! 	    vcp->states |= CMAPPED;
! 	}
! 	ReleaseWriteLock(&vcp->lock);
! 	vcp->mapcnt++;
!     }
  
      AFS_GUNLOCK();
      crfree(credp);
      return code;
  }
  
  static int
--- 346,374 ----
  
      /* get a validated vcache entry */
      code = afs_InitReq(&treq, credp);
      if (code)
! 	goto out_err;
  
!     code = afs_VerifyVCache(vcp, &treq);
!     if (code)
! 	goto out_err;
  
+     osi_FlushPages(vcp, credp);	/* ensure stale pages are gone */
  
!     AFS_GUNLOCK();
!     code = generic_file_mmap(fp, vmap);
!     AFS_GLOCK();
!     if (!code)
! 	vcp->states |= CMAPPED;
  
+ out:
      AFS_GUNLOCK();
      crfree(credp);
      return code;
+ 
+ out_err:
+     code = -code;
+     goto out;
  }
  
  static int
***************
*** 793,799 ****
      struct vcache *pvc = VTOAFS(dp->d_parent->d_inode);
  
      if (vcp->mvid->Fid.Volume != pvc->fid.Fid.Volume) {	/* bad parent */
- printk("check_bad_parent(%s): bad parent vcp->mvid->Fid.Volume != pvc->fid.Fid.Volume\n", dp->d_name.name);
  	credp = crref();
  
  	/* force a lookup, so vcp->mvid is fixed up */
--- 597,602 ----
Index: openafs/src/afs/OBSD/osi_sleep.c
diff -c openafs/src/afs/OBSD/osi_sleep.c:1.7.2.1 openafs/src/afs/OBSD/osi_sleep.c:1.7.2.2
*** openafs/src/afs/OBSD/osi_sleep.c:1.7.2.1	Sun Jan 30 23:18:25 2005
--- openafs/src/afs/OBSD/osi_sleep.c	Thu Jul 28 17:48:35 2005
***************
*** 1,5 ****
  /*
!  * $Id: osi_sleep.c,v 1.7.2.1 2005/01/31 04:18:25 shadow Exp $
   */
  
  /*
--- 1,5 ----
  /*
!  * $Id: osi_sleep.c,v 1.7.2.2 2005/07/28 21:48:35 shadow Exp $
   */
  
  /*
***************
*** 45,51 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/OBSD/osi_sleep.c,v 1.7.2.1 2005/01/31 04:18:25 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afs/afsincludes.h"	/* Afs-based standard headers */
--- 45,51 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/OBSD/osi_sleep.c,v 1.7.2.2 2005/07/28 21:48:35 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 115,131 ****
  {
      AFS_ASSERT_GLOCK();
      AFS_GUNLOCK();
!     tsleep(event, PVFS, "afs", 0);
      AFS_GLOCK();
  }
  
  int
  afs_osi_SleepSig(void *event)
  {
!     AFS_ASSERT_GLOCK();
!     AFS_GUNLOCK();
!     tsleep(event, PVFS, "afs", 0);
!     AFS_GLOCK();
      return 0;
  }
  
--- 115,128 ----
  {
      AFS_ASSERT_GLOCK();
      AFS_GUNLOCK();
!     tsleep(event, PVFS, "afsslp", 0);
      AFS_GLOCK();
  }
  
  int
  afs_osi_SleepSig(void *event)
  {
!     afs_osi_Sleep(event);
      return 0;
  }
  
Index: openafs/src/afs/VNOPS/afs_vnop_create.c
diff -c openafs/src/afs/VNOPS/afs_vnop_create.c:1.16.2.4 openafs/src/afs/VNOPS/afs_vnop_create.c:1.16.2.5
*** openafs/src/afs/VNOPS/afs_vnop_create.c:1.16.2.4	Sun Jan 30 22:49:15 2005
--- openafs/src/afs/VNOPS/afs_vnop_create.c	Thu Jul 21 12:31:34 2005
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.16.2.4 2005/01/31 03:49:15 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.16.2.5 2005/07/21 16:31:34 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 414,419 ****
--- 414,421 ----
  	    }
  	    ReleaseWriteLock(&afs_xcbhash);
  	    afs_ProcessFS(tvc, &OutFidStatus, &treq);
+ 	    tvc->parentVnode = adp->fid.Fid.Vnode;
+ 	    tvc->parentUnique = adp->fid.Fid.Unique;
  	    ReleaseWriteLock(&tvc->lock);
  	    *avcp = tvc;
  	    code = 0;
Index: openafs/src/afs/VNOPS/afs_vnop_lookup.c
diff -c openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.50.2.9 openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.50.2.10
*** openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.50.2.9	Mon Jul 11 15:29:59 2005
--- openafs/src/afs/VNOPS/afs_vnop_lookup.c	Thu Jul 21 00:49:19 2005
***************
*** 18,24 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.50.2.9 2005/07/11 19:29:59 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 18,24 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.50.2.10 2005/07/21 04:49:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 432,438 ****
  	    struct sysname_info *state, struct vrequest *areq)
  {
      int num = 0;
!     char **sysnamelist[MAXSYSNAME];
  
      if (AFS_EQ_ATSYS(aname)) {
  	state->offset = 0;
--- 432,438 ----
  	    struct sysname_info *state, struct vrequest *areq)
  {
      int num = 0;
!     char **sysnamelist[MAXNUMSYSNAMES];
  
      if (AFS_EQ_ATSYS(aname)) {
  	state->offset = 0;
***************
*** 453,459 ****
  	   struct sysname_info *state)
  {
      int num = afs_sysnamecount;
!     char **sysnamelist[MAXSYSNAME];
  
      if (state->index == -1)
  	return 0;		/* No list */
--- 453,459 ----
  	   struct sysname_info *state)
  {
      int num = afs_sysnamecount;
!     char **sysnamelist[MAXNUMSYSNAMES];
  
      if (state->index == -1)
  	return 0;		/* No list */
Index: openafs/src/aklog/aklog.c
diff -c openafs/src/aklog/aklog.c:1.1.2.4 openafs/src/aklog/aklog.c:1.1.2.5
*** openafs/src/aklog/aklog.c:1.1.2.4	Mon Jul 11 15:07:00 2005
--- openafs/src/aklog/aklog.c	Fri Jul 15 12:11:24 2005
***************
*** 1,12 ****
  /* 
!  * $Id: aklog.c,v 1.1.2.4 2005/07/11 19:07:00 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
   */
  
  #if !defined(lint) && !defined(SABER)
! static char *rcsid = "$Id: aklog.c,v 1.1.2.4 2005/07/11 19:07:00 shadow Exp $";
  #endif /* lint || SABER */
  
  #include <afs/stds.h>
--- 1,12 ----
  /* 
!  * $Id: aklog.c,v 1.1.2.5 2005/07/15 16:11:24 rra Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
   */
  
  #if !defined(lint) && !defined(SABER)
! static char *rcsid = "$Id: aklog.c,v 1.1.2.5 2005/07/15 16:11:24 rra Exp $";
  #endif /* lint || SABER */
  
  #include <afs/stds.h>
***************
*** 14,28 ****
  
  #ifndef WINDOWS
  
! #ifdef __STDC__
  main(int argc, char *argv[])
- #else
- main(argc, argv)
-   int argc;
-   char *argv[];
- #endif /* __STDC__ */
  {
      aklog(argc, argv);
  }
  
  #else /* WINDOWS */
--- 14,24 ----
  
  #ifndef WINDOWS
  
! int
  main(int argc, char *argv[])
  {
      aklog(argc, argv);
+     exit(0);
  }
  
  #else /* WINDOWS */
Index: openafs/src/aklog/aklog_main.c
diff -c openafs/src/aklog/aklog_main.c:1.1.2.8 openafs/src/aklog/aklog_main.c:1.1.2.10
*** openafs/src/aklog/aklog_main.c:1.1.2.8	Mon Jul 11 15:07:46 2005
--- openafs/src/aklog/aklog_main.c	Mon Jul 18 22:51:53 2005
***************
*** 1,5 ****
  /* 
!  * $Id: aklog_main.c,v 1.1.2.8 2005/07/11 19:07:46 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
--- 1,5 ----
  /* 
!  * $Id: aklog_main.c,v 1.1.2.10 2005/07/19 02:51:53 jaltman Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
***************
*** 7,13 ****
  
  #if !defined(lint) && !defined(SABER)
  static char *rcsid =
! 	"$Id: aklog_main.c,v 1.1.2.8 2005/07/11 19:07:46 shadow Exp $";
  #endif /* lint || SABER */
  
  #include <stdio.h>
--- 7,13 ----
  
  #if !defined(lint) && !defined(SABER)
  static char *rcsid =
! 	"$Id: aklog_main.c,v 1.1.2.10 2005/07/19 02:51:53 jaltman Exp $";
  #endif /* lint || SABER */
  
  #include <stdio.h>
***************
*** 81,86 ****
--- 81,87 ----
  #include <afs/vice.h>
  #include <afs/venus.h>
  #include <afs/ptserver.h>
+ #include <afs/ptuser.h>
  #include <afs/dirpath.h>
  #endif /* WINDOWS */
  
***************
*** 259,265 ****
  {
      int status = AKLOG_SUCCESS;
      struct afsconf_dir *configdir;
-     char *dirpath;
  
      memset(local_cell, 0, sizeof(local_cell));
      memset((char *)cellconfig, 0, sizeof(*cellconfig));
--- 260,265 ----
***************
*** 392,410 ****
   * doing anything.  Otherwise, log to it and mark that it has been logged
   * to.
   */
- #ifdef __STDC__
  static int auth_to_cell(krb5_context context, char *cell, char *realm)
- #else
- static int auth_to_cell(context, cell, realm)
- 
-   krb5_context context;
-   char *cell;
-   char *realm;
- #endif /* __STDC__ */
  {
      int status = AKLOG_SUCCESS;
      char username[BUFSIZ];	/* To hold client username structure */
!     long viceId;		/* AFS uid of user */
  
      char name[ANAME_SZ];	/* Name of afs key */
      char primary_instance[INST_SZ];	/* Instance of afs key */
--- 392,402 ----
   * doing anything.  Otherwise, log to it and mark that it has been logged
   * to.
   */
  static int auth_to_cell(krb5_context context, char *cell, char *realm)
  {
      int status = AKLOG_SUCCESS;
      char username[BUFSIZ];	/* To hold client username structure */
!     afs_int32 viceId;		/* AFS uid of user */
  
      char name[ANAME_SZ];	/* Name of afs key */
      char primary_instance[INST_SZ];	/* Instance of afs key */
***************
*** 720,726 ****
  
  	    strcpy(lastcell, aserver.cell);
  
! 	    if (!pr_Initialize (0, confname, aserver.cell, 0))
  		    status = pr_SNameToId (username, &viceId);
  	    
  	    if (dflag) {
--- 712,718 ----
  
  	    strcpy(lastcell, aserver.cell);
  
! 	    if (!pr_Initialize (0, confname, aserver.cell))
  		    status = pr_SNameToId (username, &viceId);
  	    
  	    if (dflag) {
***************
*** 775,781 ****
  		 * level
  		 */
  
! 		if ((status = pr_Initialize(1L, confname, aserver.cell, 0))) {
  		    printf("Error %d\n", status);
  		}
  
--- 767,773 ----
  		 * level
  		 */
  
! 		if ((status = pr_Initialize(1L, confname, aserver.cell))) {
  		    printf("Error %d\n", status);
  		}
  
***************
*** 860,873 ****
  
  #ifndef WINDOWS /* struct ViceIoctl missing */
  
- #ifdef __STDC__
  static int get_afs_mountpoint(char *file, char *mountpoint, int size)
- #else
- static int get_afs_mountpoint(file, mountpoint, size)
-   char *file;
-   char *mountpoint;
-   int size;
- #endif /* __STDC__ */
  {
  #ifdef AFS_SUN_ENV
  	char V ='V'; /* AFS has problem on Sun with pioctl */
--- 852,858 ----
***************
*** 924,935 ****
   * to be descended.  After that, it should be called with the arguemnt
   * NULL.
   */
- #ifdef __STDC__
  static char *next_path(char *origpath)
- #else
- static char *next_path(origpath)
-   char *origpath;
- #endif /* __STDC__ */
  {
      static char path[MAXPATHLEN + 1];
      static char pathtocheck[MAXPATHLEN + 1];
--- 909,915 ----
***************
*** 968,975 ****
  	    ? elast_comp - last_comp : strlen(last_comp);
  	strncat(pathtocheck, last_comp, len);
  	memset(linkbuf, 0, sizeof(linkbuf));
! 	if ((link = readlink(pathtocheck, linkbuf, 
! 				    sizeof(linkbuf))) > 0) {
  	    if (++symlinkcount > MAXSYMLINKS) {
  		fprintf(stderr, "%s: %s\n", progname, strerror(ELOOP));
  		exit(AKLOG_BADPATH);
--- 948,955 ----
  	    ? elast_comp - last_comp : strlen(last_comp);
  	strncat(pathtocheck, last_comp, len);
  	memset(linkbuf, 0, sizeof(linkbuf));
! 	if (link = (readlink(pathtocheck, linkbuf, 
! 				    sizeof(linkbuf)) > 0)) {
  	    if (++symlinkcount > MAXSYMLINKS) {
  		fprintf(stderr, "%s: %s\n", progname, strerror(ELOOP));
  		exit(AKLOG_BADPATH);
***************
*** 1047,1058 ****
  
  #ifndef WINDOWS /* struct ViceIoctl missing */
  
- #ifdef __STDC__
  static void add_hosts(char *file)
- #else
- static void add_hosts(file)
-   char *file;
- #endif /* __STDC__ */
  {
  #ifdef AFS_SUN_ENV
  	char V = 'V'; /* AFS has problem on SunOS */
--- 1027,1033 ----
***************
*** 1119,1131 ****
   * This routine descends through a path to a directory, logging to 
   * every cell it encounters along the way.
   */
- #ifdef __STDC__
  static int auth_to_path(krb5_context context, char *path)
- #else
- static int auth_to_path(context, path)
-   krb5_context context;
-   char *path;			/* The path to which we try to authenticate */
- #endif /* __STDC__ */
  {
      int status = AKLOG_SUCCESS;
      int auth_to_cell_status = AKLOG_SUCCESS;
--- 1094,1100 ----
***************
*** 1143,1149 ****
      if (path[0] == DIR)
  	strcpy(pathtocheck, path);
      else {
! 	if (getwd(pathtocheck) == NULL) {
  	    fprintf(stderr, "Unable to find current working directory:\n");
  	    fprintf(stderr, "%s\n", pathtocheck);
  	    fprintf(stderr, "Try an absolute pathname.\n");
--- 1112,1118 ----
      if (path[0] == DIR)
  	strcpy(pathtocheck, path);
      else {
! 	if (getcwd(pathtocheck, sizeof(pathtocheck)) == NULL) {
  	    fprintf(stderr, "Unable to find current working directory:\n");
  	    fprintf(stderr, "%s\n", pathtocheck);
  	    fprintf(stderr, "Try an absolute pathname.\n");
***************
*** 1212,1222 ****
  
  
  /* Print usage message and exit */
- #ifdef __STDC__
  static void usage(void)
- #else
- static void usage()
- #endif /* __STDC__ */
  {
      fprintf(stderr, "\nUsage: %s %s%s%s\n", progname,
  	    "[-d] [[-cell | -c] cell [-k krb_realm]] ",
--- 1181,1187 ----
Index: openafs/src/aklog/krb_util.c
diff -c openafs/src/aklog/krb_util.c:1.1.2.3 openafs/src/aklog/krb_util.c:1.1.2.4
*** openafs/src/aklog/krb_util.c:1.1.2.3	Mon Jul 11 15:07:00 2005
--- openafs/src/aklog/krb_util.c	Fri Jul 15 12:11:24 2005
***************
*** 11,17 ****
  
  #ifndef lint
  static char rcsid_send_to_kdc_c[] =
! "$Id: krb_util.c,v 1.1.2.3 2005/07/11 19:07:00 shadow Exp $";
  #endif /* lint */
  
  #if 0
--- 11,17 ----
  
  #ifndef lint
  static char rcsid_send_to_kdc_c[] =
! "$Id: krb_util.c,v 1.1.2.4 2005/07/15 16:11:24 rra Exp $";
  #endif /* lint */
  
  #if 0
***************
*** 36,48 ****
  
  #endif /* WINDOWS */
  
  #define S_AD_SZ sizeof(struct sockaddr_in)
  
! char *afs_realm_of_cell(context, cellconfig)
!     krb5_context context;
!     struct afsconf_cell *cellconfig;
  {
-     char krbhst[MAX_HSTNM];
      static char krbrlm[REALM_SZ+1];
  	char **hrealms = 0;
  	krb5_error_code retval;
--- 36,47 ----
  
  #endif /* WINDOWS */
  
+ #include <string.h>
+ 
  #define S_AD_SZ sizeof(struct sockaddr_in)
  
! char *afs_realm_of_cell(krb5_context context, struct afsconf_cell *cellconfig)
  {
      static char krbrlm[REALM_SZ+1];
  	char **hrealms = 0;
  	krb5_error_code retval;
Index: openafs/src/aklog/linked_list.c
diff -c openafs/src/aklog/linked_list.c:1.1.2.1 openafs/src/aklog/linked_list.c:1.1.2.2
*** openafs/src/aklog/linked_list.c:1.1.2.1	Tue Dec  7 00:51:24 2004
--- openafs/src/aklog/linked_list.c	Fri Jul 15 12:11:24 2005
***************
*** 1,5 ****
  /* 
!  * $Id: linked_list.c,v 1.1.2.1 2004/12/07 05:51:24 shadow Exp $
   * 
   * This file contains general linked list routines.
   * 
--- 1,5 ----
  /* 
!  * $Id: linked_list.c,v 1.1.2.2 2005/07/15 16:11:24 rra Exp $
   * 
   * This file contains general linked list routines.
   * 
***************
*** 8,17 ****
   */
  
  #if !defined(lint) && !defined(SABER)
! static char *rcsid_list_c = "$Id: linked_list.c,v 1.1.2.1 2004/12/07 05:51:24 shadow Exp $";
  #endif /* lint || SABER */
  
  #include <stdio.h>
  #include "linked_list.h"
  
  #ifndef NULL
--- 8,19 ----
   */
  
  #if !defined(lint) && !defined(SABER)
! static char *rcsid_list_c = "$Id: linked_list.c,v 1.1.2.2 2005/07/15 16:11:24 rra Exp $";
  #endif /* lint || SABER */
  
  #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
  #include "linked_list.h"
  
  #ifndef NULL
***************
*** 26,34 ****
  #define FALSE 0
  #endif
  
- char *calloc();
- 
- #ifdef __STDC__
  void ll_init(linked_list *list)
    /* 
     * Requires:
--- 28,33 ----
***************
*** 40,49 ****
     *   Initializes the list to be one with no elements.  If list is
     *   NULL, prints an error message and causes the program to crash.
     */
- #else
- void ll_init(list)
-   linked_list *list;
- #endif /* __STDC__ */
  {
      if (list == NULL) {
  	fprintf(stderr, "Error: calling ll_init with null pointer.\n");
--- 39,44 ----
***************
*** 58,64 ****
  #endif /* WINDOWS */
  }
  
- #ifdef __STDC__
  ll_node *ll_add_node(linked_list *list, ll_end which_end)
    /*
     * Modifies:
--- 53,58 ----
***************
*** 70,80 ****
     *   list.h.  If there is not enough memory to allocate a node, 
     *   the program returns NULL.
     */
- #else
- ll_node *ll_add_node(list, which_end)
-   linked_list *list;
-   ll_end which_end;
- #endif /* __STDC__ */
  {
      ll_node *node = NULL;
      
--- 64,69 ----
***************
*** 110,116 ****
  }
  
  
- #ifdef __STDC__
  int ll_delete_node(linked_list *list, ll_node *node)
    /* 
     * Modifies: 
--- 99,104 ----
***************
*** 122,132 ****
     *   this routine frees node, after the routine is called, "node"
     *   won't point to valid data.
     */
- #else
- int ll_delete_node(list, node)
-   linked_list *list;
-   ll_node *node;
- #endif /* __STDC__ */
  {
      int status = LL_SUCCESS;
      ll_node *cur_node = NULL;
--- 110,115 ----
***************
*** 166,179 ****
  /* ll_add_data is a macro defined in linked_list.h */
  
  /* This routine maintains a list of strings preventing duplication. */
- #ifdef __STDC__
  int ll_string(linked_list *list, ll_s_action action, char *string)
- #else
- int ll_string(list, action, string)
-   linked_list *list;
-   ll_s_action action;
-   char *string;
- #endif /* __STDC__ */
  {
      int status = LL_SUCCESS;
      ll_node *cur_node;
--- 149,155 ----
Index: openafs/src/audit/audit.c
diff -c openafs/src/audit/audit.c:1.8.2.4 openafs/src/audit/audit.c:1.8.2.6
*** openafs/src/audit/audit.c:1.8.2.4	Mon Jul 11 18:13:39 2005
--- openafs/src/audit/audit.c	Fri Jul 29 10:32:10 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/audit/audit.c,v 1.8.2.4 2005/07/11 22:13:39 shadow Exp $");
  
  #include <fcntl.h>
  #include <stdarg.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/audit/audit.c,v 1.8.2.6 2005/07/29 14:32:10 shadow Exp $");
  
  #include <fcntl.h>
  #include <stdarg.h>
***************
*** 56,62 ****
      int vaInt;
      afs_int32 vaLong;
      char *vaStr;
!     char *vaLst;
      struct AFSFid *vaFid;
  
      vaEntry = va_arg(vaList, int);
--- 56,62 ----
      int vaInt;
      afs_int32 vaLong;
      char *vaStr;
!     va_list vaLst;
      struct AFSFid *vaFid;
  
      vaEntry = va_arg(vaList, int);
***************
*** 65,71 ****
  	case AUD_STR:		/* String */
          case AUD_NAME:          /* Name */
          case AUD_ACL:           /* ACL */
! 	    vaStr = (char *)va_arg(vaList, int);
  	    if (vaStr) {
  		strcpy(bufferPtr, vaStr);
  		bufferPtr += strlen(vaStr) + 1;
--- 65,71 ----
  	case AUD_STR:		/* String */
          case AUD_NAME:          /* Name */
          case AUD_ACL:           /* ACL */
! 	    vaStr = (char *)va_arg(vaList, char *);
  	    if (vaStr) {
  		strcpy(bufferPtr, vaStr);
  		bufferPtr += strlen(vaStr) + 1;
***************
*** 88,98 ****
  	    bufferPtr += sizeof(vaLong);
  	    break;
  	case AUD_LST:		/* Ptr to another list */
! 	    vaLst = (char *)va_arg(vaList, int);
  	    audmakebuf(audEvent, vaLst);
  	    break;
  	case AUD_FID:		/* AFSFid - contains 3 entries */
! 	    vaFid = (struct AFSFid *)va_arg(vaList, int);
  	    if (vaFid) {
  		memcpy(bufferPtr, vaFid, sizeof(struct AFSFid));
  	    } else {
--- 88,98 ----
  	    bufferPtr += sizeof(vaLong);
  	    break;
  	case AUD_LST:		/* Ptr to another list */
! 	    vaLst = va_arg(vaList, va_list);
  	    audmakebuf(audEvent, vaLst);
  	    break;
  	case AUD_FID:		/* AFSFid - contains 3 entries */
! 	    vaFid = (struct AFSFid *)va_arg(vaList, struct AFSFid *);
  	    if (vaFid) {
  		memcpy(bufferPtr, vaFid, sizeof(struct AFSFid));
  	    } else {
***************
*** 108,114 ****
  	    {
  		struct AFSCBFids *Fids;
  
! 		Fids = (struct AFSCBFids *)va_arg(vaList, int);
  		if (Fids && Fids->AFSCBFids_len) {
  		    *((u_int *) bufferPtr) = Fids->AFSCBFids_len;
  		    bufferPtr += sizeof(u_int);
--- 108,114 ----
  	    {
  		struct AFSCBFids *Fids;
  
! 		Fids = (struct AFSCBFids *)va_arg(vaList, struct AFSCBFids *);
  		if (Fids && Fids->AFSCBFids_len) {
  		    *((u_int *) bufferPtr) = Fids->AFSCBFids_len;
  		    bufferPtr += sizeof(u_int);
***************
*** 143,149 ****
      int vaInt;
      afs_int32 vaLong;
      char *vaStr;
!     char *vaLst;
      struct AFSFid *vaFid;
      struct AFSCBFids *vaFids;
      int num = LogThreadNum();
--- 143,149 ----
      int vaInt;
      afs_int32 vaLong;
      char *vaStr;
!     va_list vaLst;
      struct AFSFid *vaFid;
      struct AFSCBFids *vaFids;
      int num = LogThreadNum();
***************
*** 171,191 ****
      while (vaEntry != AUD_END) {
  	switch (vaEntry) {
  	case AUD_STR:		/* String */
! 	    vaStr = (char *)va_arg(vaList, int);
  	    if (vaStr)
  		fprintf(out,  "STR %s ", vaStr);
  	    else
  		fprintf(out,  "STR <null>");
  	    break;
  	case AUD_NAME:		/* Name */
! 	    vaStr = (char *)va_arg(vaList, int);
  	    if (vaStr)
  		fprintf(out,  "NAME %s ", vaStr);
  	    else
  		fprintf(out,  "NAME <null>");
  	    break;
  	case AUD_ACL:		/* ACL */
! 	    vaStr = (char *)va_arg(vaList, int);
  	    if (vaStr)
  		fprintf(out,  "ACL %s ", vaStr);
  	    else
--- 171,191 ----
      while (vaEntry != AUD_END) {
  	switch (vaEntry) {
  	case AUD_STR:		/* String */
! 	    vaStr = (char *)va_arg(vaList, char *);
  	    if (vaStr)
  		fprintf(out,  "STR %s ", vaStr);
  	    else
  		fprintf(out,  "STR <null>");
  	    break;
  	case AUD_NAME:		/* Name */
! 	    vaStr = (char *)va_arg(vaList, char *);
  	    if (vaStr)
  		fprintf(out,  "NAME %s ", vaStr);
  	    else
  		fprintf(out,  "NAME <null>");
  	    break;
  	case AUD_ACL:		/* ACL */
! 	    vaStr = (char *)va_arg(vaList, char *);
  	    if (vaStr)
  		fprintf(out,  "ACL %s ", vaStr);
  	    else
***************
*** 213,223 ****
  	    fprintf(out, "LONG %d ", vaLong);
  	    break;
  	case AUD_LST:		/* Ptr to another list */
! 	    vaLst = (char *)va_arg(vaList, int);
  	    printbuf(out, 1, "VALST", 0, vaLst);
  	    break;
  	case AUD_FID:		/* AFSFid - contains 3 entries */
! 	    vaFid = (struct AFSFid *)va_arg(vaList, int);
  	    if (vaFid)
  		fprintf(out, "FID %u:%u:%u ", vaFid->Volume, vaFid->Vnode,
  		       vaFid->Unique);
--- 213,223 ----
  	    fprintf(out, "LONG %d ", vaLong);
  	    break;
  	case AUD_LST:		/* Ptr to another list */
! 	    vaLst = va_arg(vaList, va_list);
  	    printbuf(out, 1, "VALST", 0, vaLst);
  	    break;
  	case AUD_FID:		/* AFSFid - contains 3 entries */
! 	    vaFid = va_arg(vaList, struct AFSFid *);
  	    if (vaFid)
  		fprintf(out, "FID %u:%u:%u ", vaFid->Volume, vaFid->Vnode,
  		       vaFid->Unique);
***************
*** 225,231 ****
  		fprintf(out, "FID %u:%u:%u ", 0, 0, 0);
  	    break;
  	case AUD_FIDS:		/* array of Fids */
! 	    vaFids = (struct AFSCBFids *)va_arg(vaList, int);
  	    vaFid = NULL;
  
  	    if (vaFids) {
--- 225,231 ----
  		fprintf(out, "FID %u:%u:%u ", 0, 0, 0);
  	    break;
  	case AUD_FIDS:		/* array of Fids */
! 	    vaFids = va_arg(vaList, struct AFSCBFids *);
  	    vaFid = NULL;
  
  	    if (vaFids) {
Index: openafs/src/audit/audit.h
diff -c openafs/src/audit/audit.h:1.5.2.3 openafs/src/audit/audit.h:1.5.2.4
*** openafs/src/audit/audit.h:1.5.2.3	Mon Jul 11 15:29:18 2005
--- openafs/src/audit/audit.h	Thu Jul 14 23:25:38 2005
***************
*** 98,103 ****
--- 98,104 ----
  #define PTS_LstOwnEvent    "AFS_PTS_LstOwn"
  #define PTS_IsMemOfEvent   "AFS_PTS_IsMemOf"
  #define PTS_UpdEntEvent    "AFS_PTS_UpdEnt"
+ #define PTS_LstSGrps       "AFS_PTS_LstSGrps"
  
  #define BUDB_StartEvent    "AFS_BUDB_Start"
  #define BUDB_FinishEvent   "AFS_BUDB_Finish"
Index: openafs/src/cf/linux-test2.m4
diff -c openafs/src/cf/linux-test2.m4:1.9.2.1 openafs/src/cf/linux-test2.m4:1.9.2.2
*** openafs/src/cf/linux-test2.m4:1.9.2.1	Mon Jul 11 15:30:01 2005
--- openafs/src/cf/linux-test2.m4	Fri Jul 29 10:49:51 2005
***************
*** 82,87 ****
--- 82,88 ----
  configdir=ifelse([$1], ,[src/config],$1)
  outputdir=ifelse([$2], ,[src/afs/LINUX],$2)
  tmpldir=ifelse([$3], ,[src/afs/LINUX],$3)
+ mkdir -p $outputdir
  cp  $tmpldir/osi_vfs.hin $outputdir/osi_vfs.h
  # chmod +x $configdir/make_vnode.pl
  # $configdir/make_vnode.pl -i $LINUX_KERNEL_PATH -t ${tmpldir} -o $outputdir
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.1.2.10 openafs/src/config/NTMakefile.amd64_w2k:1.1.2.11
*** openafs/src/config/NTMakefile.amd64_w2k:1.1.2.10	Fri Jul  1 15:47:14 2005
--- openafs/src/config/NTMakefile.amd64_w2k	Thu Jul 28 18:13:28 2005
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8500
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8600
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.46.2.25 openafs/src/config/NTMakefile.i386_nt40:1.46.2.26
*** openafs/src/config/NTMakefile.i386_nt40:1.46.2.25	Fri Jul  1 15:47:14 2005
--- openafs/src/config/NTMakefile.i386_nt40	Thu Jul 28 18:13:28 2005
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8500
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8600
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/config/NTMakefile.i386_w2k
diff -c openafs/src/config/NTMakefile.i386_w2k:1.1.2.10 openafs/src/config/NTMakefile.i386_w2k:1.1.2.11
*** openafs/src/config/NTMakefile.i386_w2k:1.1.2.10	Fri Jul  1 15:47:14 2005
--- openafs/src/config/NTMakefile.i386_w2k	Thu Jul 28 18:13:28 2005
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8500
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8600
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/libadmin/client/afs_clientAdmin.c
diff -c openafs/src/libadmin/client/afs_clientAdmin.c:1.9.2.1 openafs/src/libadmin/client/afs_clientAdmin.c:1.9.2.2
*** openafs/src/libadmin/client/afs_clientAdmin.c:1.9.2.1	Wed Aug 25 03:09:39 2004
--- openafs/src/libadmin/client/afs_clientAdmin.c	Thu Jul 21 00:57:17 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/libadmin/client/afs_clientAdmin.c,v 1.9.2.1 2004/08/25 07:09:39 shadow Exp $");
  
  #include <afs/stds.h>
  #include "afs_clientAdmin.h"
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/libadmin/client/afs_clientAdmin.c,v 1.9.2.2 2005/07/21 04:57:17 shadow Exp $");
  
  #include <afs/stds.h>
  #include "afs_clientAdmin.h"
***************
*** 754,765 ****
      int *valid;
  } afs_server_t, *afs_server_p;
  
- static afs_server_t servers[NUM_SERVER_TYPES]
- = { {AFSCONF_KAUTHSERVICE, KA_MAINTENANCE_SERVICE, 0, 0, 0},
- {AFSCONF_PROTSERVICE, PRSRV, 0, 0, 0},
- {AFSCONF_VLDBSERVICE, USER_SERVICE_ID, 0, 0, 0}
- };
- 
  /*
   * afsclient_CellOpen - Open a particular cell for work as a particular
   * user.
--- 754,759 ----
***************
*** 803,808 ****
--- 797,808 ----
      int scIndex;
      char copyCell[MAXCELLCHARS];
  
+     afs_server_t servers[NUM_SERVER_TYPES]
+       = { {AFSCONF_KAUTHSERVICE, KA_MAINTENANCE_SERVICE, 0, 0, 0},
+ 	  {AFSCONF_PROTSERVICE, PRSRV, 0, 0, 0},
+ 	  {AFSCONF_VLDBSERVICE, USER_SERVICE_ID, 0, 0, 0}
+       };
+     
      if (client_init == 0) {
  	tst = ADMCLIENTNOINIT;
  	goto fail_afsclient_CellOpen;
Index: openafs/src/libafs/MakefileProto.LINUX.in
diff -c openafs/src/libafs/MakefileProto.LINUX.in:1.40.2.10 openafs/src/libafs/MakefileProto.LINUX.in:1.40.2.11
*** openafs/src/libafs/MakefileProto.LINUX.in:1.40.2.10	Sun Apr  3 16:01:17 2005
--- openafs/src/libafs/MakefileProto.LINUX.in	Mon Jul 25 14:32:15 2005
***************
*** 50,57 ****
  CCFLAGS = $(COMMON_KERN_CFLAGS) @P5PLUS_KOPTS@
  DEFINES = $(COMMON_DEFINES) -DCPU=586
  
! <amd64_linux24>
! CCFLAGS = $(COMMON_KERN_CFLAGS) -mcmodel=kernel
  DEFINES = $(COMMON_DEFINES) 
  
  <i386_umlinux22 i386_umlinux24 i386_umlinux26>
--- 50,57 ----
  CCFLAGS = $(COMMON_KERN_CFLAGS) @P5PLUS_KOPTS@
  DEFINES = $(COMMON_DEFINES) -DCPU=586
  
! <amd64_linux24 amd64_linux26>
! CCFLAGS = $(COMMON_KERN_CFLAGS) -mcmodel=kernel -mno-red-zone
  DEFINES = $(COMMON_DEFINES) 
  
  <i386_umlinux22 i386_umlinux24 i386_umlinux26>
***************
*** 61,71 ****
  <i386_umlinux26>
  EXTRA_CFLAGS = -I$(LINUX_KERNEL_PATH)/arch/um/include -I$(LINUX_KERNEL_PATH)/arch/um/kernel/tt/include -I$(LINUX_KERNEL_PATH)/arch/um/kernel/skas/include
  
! <alpha_linux_22 alpha_linux_24>
  CCFLAGS = $(COMMON_KERN_CFLAGS) -mno-fp-regs -ffixed-8
  DEFINES = $(COMMON_DEFINES)
  
! <s390_linux22 s390_linux24>
  CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char
  DEFINES = $(COMMON_DEFINES) -D__s390__ 
  
--- 61,71 ----
  <i386_umlinux26>
  EXTRA_CFLAGS = -I$(LINUX_KERNEL_PATH)/arch/um/include -I$(LINUX_KERNEL_PATH)/arch/um/kernel/tt/include -I$(LINUX_KERNEL_PATH)/arch/um/kernel/skas/include
  
! <alpha_linux_22 alpha_linux_24 alpha_linux_26>
  CCFLAGS = $(COMMON_KERN_CFLAGS) -mno-fp-regs -ffixed-8
  DEFINES = $(COMMON_DEFINES)
  
! <s390_linux22 s390_linux24 s390_linux26>
  CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char
  DEFINES = $(COMMON_DEFINES) -D__s390__ 
  
Index: openafs/src/libafs/afs.ppc_darwin_70.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.4 openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.5
*** openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.4	Mon Jul 11 16:03:42 2005
--- openafs/src/libafs/afs.ppc_darwin_70.plist.in	Sat Jul 30 00:36:51 2005
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.85</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.3.85</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.86</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.3.86</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
Index: openafs/src/packaging/MacOS/OpenAFS.Info.plist
diff -c openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.12 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.13
*** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.12	Mon Jul 11 16:03:43 2005
--- openafs/src/packaging/MacOS/OpenAFS.Info.plist	Sat Jul 30 00:36:52 2005
***************
*** 3,15 ****
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.3.85</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.85</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
--- 3,15 ----
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.3.86</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.86</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
Index: openafs/src/packaging/MacOS/OpenAFS.info
diff -c openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.12 openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.13
*** openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.12	Mon Jul 11 16:03:43 2005
--- openafs/src/packaging/MacOS/OpenAFS.info	Sat Jul 30 00:36:52 2005
***************
*** 1,5 ****
  Title OpenAFS
! Version 1.3.85
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
--- 1,5 ----
  Title OpenAFS
! Version 1.3.86
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
Index: openafs/src/ptserver/pt_util.c
diff -c openafs/src/ptserver/pt_util.c:1.9.2.1 openafs/src/ptserver/pt_util.c:1.9.2.2
*** openafs/src/ptserver/pt_util.c:1.9.2.1	Fri Apr 15 15:40:43 2005
--- openafs/src/ptserver/pt_util.c	Fri Jul 15 15:19:36 2005
***************
*** 1,4 ****
! /* $Id: pt_util.c,v 1.9.2.1 2005/04/15 19:40:43 shadow Exp $ */
  
  /*
   *
--- 1,4 ----
! /* $Id: pt_util.c,v 1.9.2.2 2005/07/15 19:19:36 shadow Exp $ */
  
  /*
   *
***************
*** 23,29 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.9.2.1 2005/04/15 19:40:43 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <errno.h>
--- 23,29 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.9.2.2 2005/07/15 19:19:36 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <errno.h>
***************
*** 119,125 ****
  		"display only system data");
      cmd_AddParm(cs, "-xtra", CMD_FLAG, CMD_OPTIONAL,
  		"display extra users/groups");
-     cmd_Seek(cs, 10);
      cmd_AddParm(cs, "-prdb", CMD_SINGLE, CMD_OPTIONAL, "prdb file");
      cmd_AddParm(cs, "-datafile", CMD_SINGLE, CMD_OPTIONAL, "data file");
      code = cmd_Dispatch(argc, argv);
--- 119,124 ----
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.44.2.3 openafs/src/rx/rx_kcommon.c:1.44.2.4
*** openafs/src/rx/rx_kcommon.c:1.44.2.3	Fri Apr 15 14:37:14 2005
--- openafs/src/rx/rx_kcommon.c	Wed Jul 27 14:17:46 2005
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.3 2005/04/15 18:37:14 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.4 2005/07/27 18:17:46 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 127,137 ****
  	msg = "Unknown AFS panic";
  
      printf(msg, a1, a2, a3);
- #ifdef AFS_LINUX20_ENV
-     *((char *)0xffffffff) = 42;
- #else
      panic(msg);
- #endif
  }
  
  /*
--- 127,133 ----
Index: openafs/src/rx/LINUX/rx_knet.c
diff -c openafs/src/rx/LINUX/rx_knet.c:1.23.2.6 openafs/src/rx/LINUX/rx_knet.c:1.23.2.7
*** openafs/src/rx/LINUX/rx_knet.c:1.23.2.6	Fri Apr 15 14:37:17 2005
--- openafs/src/rx/LINUX/rx_knet.c	Tue Jul 26 13:42:25 2005
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.23.2.6 2005/04/15 18:37:17 shadow Exp $");
  
  #include <linux/version.h>
  #ifdef AFS_LINUX22_ENV
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.23.2.7 2005/07/26 17:42:25 shadow Exp $");
  
  #include <linux/version.h>
  #ifdef AFS_LINUX22_ENV
***************
*** 95,121 ****
   * non-zero = failure
   */
  int
! osi_NetSend(osi_socket sop, struct sockaddr_in *to, struct iovec *iov,
  	    int iovcnt, afs_int32 size, int istack)
  {
      KERNEL_SPACE_DECL;
      struct msghdr msg;
      int code;
-     struct iovec tmpvec[RX_MAXWVECS + 2];
- 
-     if (iovcnt > RX_MAXWVECS + 2) {
- 	osi_Panic("Too many (%d) iovecs passed to osi_NetSend\n", iovcnt);
-     }
  
!     if (iovcnt <= 2) {		/* avoid pointless uiomove */
! 	tmpvec[0].iov_base = iov[0].iov_base;
! 	tmpvec[0].iov_len = size;
! 	msg.msg_iovlen = 1;
!     } else {
! 	memcpy(tmpvec, iov, iovcnt * sizeof(struct iovec));
! 	msg.msg_iovlen = iovcnt;
!     }
!     msg.msg_iov = tmpvec;
      msg.msg_name = to;
      msg.msg_namelen = sizeof(*to);
      msg.msg_control = NULL;
--- 95,109 ----
   * non-zero = failure
   */
  int
! osi_NetSend(osi_socket sop, struct sockaddr_in *to, struct iovec *iovec,
  	    int iovcnt, afs_int32 size, int istack)
  {
      KERNEL_SPACE_DECL;
      struct msghdr msg;
      int code;
  
!     msg.msg_iovlen = iovcnt;
!     msg.msg_iov = iovec;
      msg.msg_name = to;
      msg.msg_namelen = sizeof(*to);
      msg.msg_control = NULL;
Index: openafs/src/viced/callback.c
diff -c openafs/src/viced/callback.c:1.55.2.9 openafs/src/viced/callback.c:1.55.2.10
*** openafs/src/viced/callback.c:1.55.2.9	Mon Apr 11 14:12:33 2005
--- openafs/src/viced/callback.c	Thu Jul 28 16:52:21 2005
***************
*** 83,89 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/callback.c,v 1.55.2.9 2005/04/11 18:12:33 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>		/* for malloc() */
--- 83,89 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/callback.c,v 1.55.2.10 2005/07/28 20:52:21 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>		/* for malloc() */
***************
*** 2070,2077 ****
  
  
  /*
! ** try multiRX probes to host. 
! ** return 0 on success, non-zero on failure
  */
  int
  MultiProbeAlternateAddress_r(struct host *host)
--- 2070,2077 ----
  
  
  /*
! ** try multi_RX probes to host. 
! ** return 0 on success, non-0 on failure
  */
  int
  MultiProbeAlternateAddress_r(struct host *host)
***************
*** 2141,2147 ****
  		     afs_inet_ntoa_r(addr[multi_i], hoststr)));
  	    H_UNLOCK;
  	    multi_Abort;
! 	}
      }
      multi_End_Ignore;
      H_LOCK;
--- 2141,2173 ----
  		     afs_inet_ntoa_r(addr[multi_i], hoststr)));
  	    H_UNLOCK;
  	    multi_Abort;
! 	} else {
! 	    ViceLog(125,
! 		    ("multiprobe failure with addr %s\n",
! 		     afs_inet_ntoa_r(addr[multi_i], hoststr)));
!             
!             /* This is less than desirable but its the best we can do.
!              * The AFS Cache Manager will return either 0 for a Uuid  
!              * match and a 1 for a non-match.   If the error is 1 we 
!              * therefore know that our mapping of IP address to Uuid 
!              * is wrong.   We should attempt to find the correct
!              * Uuid and fix the host tables.
!              */
!             if (multi_error == 1) {
!                 struct host * newhost;
! 
!                 /* remove the current alternate address from this host */
!                 H_LOCK;
!                 for (i = 0, j = 0; i < host->interface->numberOfInterfaces; i++) {
!                     if (addr[multi_i] != host->interface->addr[i]) {
!                         host->interface->addr[j] = host->interface->addr[i];
!                         j++;
!                     }
!                 }
!                 host->interface->numberOfInterfaces--;
!                 H_UNLOCK;
!             }
!         }
      }
      multi_End_Ignore;
      H_LOCK;
Index: openafs/src/viced/host.c
diff -c openafs/src/viced/host.c:1.57.2.4 openafs/src/viced/host.c:1.57.2.5
*** openafs/src/viced/host.c:1.57.2.4	Tue Jun 21 16:20:41 2005
--- openafs/src/viced/host.c	Thu Jul 28 16:52:21 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.57.2.4 2005/06/21 20:20:41 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.57.2.5 2005/07/28 20:52:21 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 1163,1186 ****
  		H_LOCK;
  	    } else if (code == 0) {
  		oldHost = h_LookupUuid_r(&identP->uuid);
  		if (oldHost) {
  		    /* This is a new address for an existing host. Update
  		     * the list of interfaces for the existing host and
  		     * delete the host structure we just allocated. */
- 		    if (!(held = h_Held_r(oldHost)))
- 			h_Hold_r(oldHost);
- 		    h_Lock_r(oldHost);
  		    ViceLog(25,
  			    ("CB: new addr %s:%d for old host %s:%d\n",
  			     afs_inet_ntoa_r(host->host, hoststr),
  			     ntohs(host->port), afs_inet_ntoa_r(oldHost->host,
  								hoststr2),
  			     ntohs(oldHost->port)));
  		    host->hostFlags |= HOSTDELETED;
  		    h_Unlock_r(host);
  		    h_Release_r(host);
  		    host = oldHost;
- 		    addInterfaceAddr_r(host, haddr);
  		} else {
  		    /* This really is a new host */
  		    hashInsertUuid_r(&identP->uuid, host);
--- 1163,1217 ----
  		H_LOCK;
  	    } else if (code == 0) {
  		oldHost = h_LookupUuid_r(&identP->uuid);
+                 if (oldHost) {
+                     int probefail = 0;
+ 
+ 		    if (!(held = h_Held_r(oldHost)))
+ 			h_Hold_r(oldHost);
+ 		    h_Lock_r(oldHost);
+ 
+                     if (oldHost->interface) {
+ 			afsUUID uuid = oldHost->interface->uuid;
+                         cb_conn = host->callback_rxcon;
+                         rx_GetConnection(cb_conn);
+ 			H_UNLOCK;
+ 			code = RXAFSCB_ProbeUuid(cb_conn, &uuid);
+                         rx_PutConnection(cb_conn);
+                         cb_conn=NULL;
+ 			H_LOCK;
+ 			if (code && MultiProbeAlternateAddress_r(oldHost)) {
+                             probefail = 1;
+                         }
+                     } else {
+                         probefail = 1;
+                     }
+ 
+                     if (probefail) {
+                         /* The old host is either does not have a Uuid,
+                          * is not responding to Probes, 
+                          * or does not have a matching Uuid. 
+                          * Delete it! */
+                         oldHost->hostFlags |= HOSTDELETED;
+                         h_Unlock_r(oldHost);
+                         h_Release_r(oldHost);
+                         oldHost = NULL;
+                     }
+                 }
  		if (oldHost) {
  		    /* This is a new address for an existing host. Update
  		     * the list of interfaces for the existing host and
  		     * delete the host structure we just allocated. */
  		    ViceLog(25,
  			    ("CB: new addr %s:%d for old host %s:%d\n",
  			     afs_inet_ntoa_r(host->host, hoststr),
  			     ntohs(host->port), afs_inet_ntoa_r(oldHost->host,
  								hoststr2),
  			     ntohs(oldHost->port)));
+ 		    addInterfaceAddr_r(oldHost, haddr);
  		    host->hostFlags |= HOSTDELETED;
  		    h_Unlock_r(host);
  		    h_Release_r(host);
  		    host = oldHost;
  		} else {
  		    /* This really is a new host */
  		    hashInsertUuid_r(&identP->uuid, host);
***************
*** 1218,1224 ****
  	    host->hostFlags |= HERRORTRANS;
  	else
  	    host->hostFlags &= ~(HERRORTRANS);
! 	host->hostFlags |= ALTADDR;	/* host structure iniatilisation complete */
  	h_Unlock_r(host);
      }
      if (caps.Capabilities_val)
--- 1249,1255 ----
  	    host->hostFlags |= HERRORTRANS;
  	else
  	    host->hostFlags &= ~(HERRORTRANS);
! 	host->hostFlags |= ALTADDR;	/* host structure initialization complete */
  	h_Unlock_r(host);
      }
      if (caps.Capabilities_val)
Index: openafs/src/vol/fssync.c
diff -c openafs/src/vol/fssync.c:1.26.2.3 openafs/src/vol/fssync.c:1.26.2.4
*** openafs/src/vol/fssync.c:1.26.2.3	Tue Apr 26 21:37:09 2005
--- openafs/src/vol/fssync.c	Thu Jul 21 01:08:03 2005
***************
*** 50,56 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync.c,v 1.26.2.3 2005/04/27 01:37:09 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 50,56 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync.c,v 1.26.2.4 2005/07/21 05:08:03 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 172,178 ****
  	if (!*timeout)
  	    break;
  	if (!(*timeout & 1))
! 	    Log(0, ("FSYNC_clientInit temporary failure (will retry)"));
  	FSYNC_clientFinis();
  	sleep(*timeout++);
      }
--- 172,178 ----
  	if (!*timeout)
  	    break;
  	if (!(*timeout & 1))
! 	    Log("FSYNC_clientInit temporary failure (will retry)");
  	FSYNC_clientFinis();
  	sleep(*timeout++);
      }
Index: openafs/src/vol/vnode.c
diff -c openafs/src/vol/vnode.c:1.19.2.3 openafs/src/vol/vnode.c:1.19.2.4
*** openafs/src/vol/vnode.c:1.19.2.3	Tue Jun 21 16:19:41 2005
--- openafs/src/vol/vnode.c	Thu Jul 28 17:11:19 2005
***************
*** 17,23 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vnode.c,v 1.19.2.3 2005/06/21 20:19:41 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
--- 17,23 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vnode.c,v 1.19.2.4 2005/07/28 21:11:19 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
***************
*** 350,357 ****
  	    VOL_UNLOCK;
  	    ObtainWriteLock(&vnp->lock);
  	    VOL_LOCK;
! 	    if (vnp->volumePtr->cacheCheck != vnp->cacheCheck)
  		goto vnrehash;
  	}
  #ifdef AFS_PTHREAD_ENV
  	vnp->writer = pthread_self();
--- 350,359 ----
  	    VOL_UNLOCK;
  	    ObtainWriteLock(&vnp->lock);
  	    VOL_LOCK;
! 	    if (vnp->volumePtr->cacheCheck != vnp->cacheCheck) {
! 		ReleaseWriteLock(&vnp->lock);
  		goto vnrehash;
+ 	    }
  	}
  #ifdef AFS_PTHREAD_ENV
  	vnp->writer = pthread_self();
