Index: openafs/src/ntbuild.bat
diff -c openafs/src/ntbuild.bat:1.18 openafs/src/ntbuild.bat:1.18.4.1
*** openafs/src/ntbuild.bat:1.18	Wed Jul  6 10:11:28 2005
--- openafs/src/ntbuild.bat	Mon Apr 21 12:03:56 2008
***************
*** 39,45 ****
  REM                  "1300" for VC7 (.NET)
  REM                  "1310" for .NET 2003
  REM                  "1400" for VC8
! set AFSVER_CL=1310
  
  REM Location of Microsoft Visual C++ development folder (8.3 short name)
  set MSVCDIR=c:\progra~1\micros~2\vc98
--- 39,45 ----
  REM                  "1300" for VC7 (.NET)
  REM                  "1310" for .NET 2003
  REM                  "1400" for VC8
! set AFSVER_CL=1400
  
  REM Location of Microsoft Visual C++ development folder (8.3 short name)
  set MSVCDIR=c:\progra~1\micros~2\vc98
***************
*** 47,58 ****
  REM Location of Microsoft Platform SDK (8.3 short name)
  set MSSDKDIR=c:\progra~1\micros~4
  
! REM Location of npapi.h (from DDK or Platform SDK samples - 8.3 short name)
  set NTDDKDIR=c:\progra~1\micros~5
  
- REM Location of netmpr.h/netspi.h (from Windows 95/98 DDK - 8.3 short name)
- SET W9XDDKDIR=c:\progra~1\micros~6
- 
  REM ########################################################################
  REM NTMakefile optional definitions:
  REM
--- 47,55 ----
  REM Location of Microsoft Platform SDK (8.3 short name)
  set MSSDKDIR=c:\progra~1\micros~4
  
! REM Location of WDK/DDK (8.3 short name)
  set NTDDKDIR=c:\progra~1\micros~5
  
  REM ########################################################################
  REM NTMakefile optional definitions:
  REM
Index: openafs/src/WINNT/afsd/afskfw.c
diff -c openafs/src/WINNT/afsd/afskfw.c:1.28.4.16 openafs/src/WINNT/afsd/afskfw.c:1.28.4.18
*** openafs/src/WINNT/afsd/afskfw.c:1.28.4.16	Mon Feb 18 09:17:11 2008
--- openafs/src/WINNT/afsd/afskfw.c	Sun Mar 30 10:13:17 2008
***************
*** 667,677 ****
          {
              if (cache && *cache != NULL) {
                  pkrb5_cc_close(*ctx, *cache);
! 				*cache = NULL;
! 			}
  	
              pkrb5_free_context(*ctx);
! 			*ctx = NULL;
          }
      }
  
--- 667,677 ----
          {
              if (cache && *cache != NULL) {
                  pkrb5_cc_close(*ctx, *cache);
!                 *cache = NULL;
!             }
  	
              pkrb5_free_context(*ctx);
!             *ctx = NULL;
          }
      }
  
***************
*** 2734,2739 ****
--- 2734,2758 ----
  }
  
  
+ static void
+ copy_realm_of_ticket(krb5_context context, char * dest, size_t destlen, krb5_creds *v5cred) {
+     krb5_error_code code;
+     krb5_ticket *ticket;
+     size_t len;
+ 
+     code = pkrb5_decode_ticket(&v5cred->ticket, &ticket);
+     if (code == 0) {
+         len = krb5_princ_realm(context, ticket->server)->length;
+         if (len > destlen - 1)
+             len = destlen - 1;
+ 
+         strncpy(dest, krb5_princ_realm(context, ticket->server)->data, len);
+         dest[len] = '\0';
+ 
+         pkrb5_free_ticket(context, ticket);
+     }
+ }
+ 
  int
  KFW_AFS_klog(
      krb5_context alt_ctx,
***************
*** 2881,2886 ****
--- 2900,2906 ----
      else
          strcpy(CellName, cell);
  
+     /* This is for Kerberos v4 only */
      if (strlen(realm) == 0)
          strcpy(RealmName, realm_of_cell);
      else
***************
*** 2890,2945 ****
  
      if ( try_krb5 ) {
          int len;
  
-         /* First try service/cell@REALM */
-         if (code = pkrb5_build_principal(ctx, &increds.server,
-                                           (int)strlen(RealmName),
-                                           RealmName,
-                                           ServiceName,
-                                           CellName,
-                                           0)) 
-         {
-             goto cleanup;
-         }
  
          increds.client = client_principal;
          increds.times.endtime = 0;
          /* Ask for DES since that is what V4 understands */
          increds.keyblock.enctype = ENCTYPE_DES_CBC_CRC;
  
! 
!         if ( IsDebuggerPresent() ) {
!             char * cname, *sname;
!             pkrb5_unparse_name(ctx, increds.client, &cname);
!             pkrb5_unparse_name(ctx, increds.server, &sname);
!             OutputDebugString("Getting tickets for \"");
!             OutputDebugString(cname);
!             OutputDebugString("\" and service \"");
!             OutputDebugString(sname);
!             OutputDebugString("\"\n");
!             pkrb5_free_unparsed_name(ctx,cname);
!             pkrb5_free_unparsed_name(ctx,sname);
!         }
! 
!         code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
!         if (code == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!              code == KRB5KRB_ERR_GENERIC /* heimdal */ ||
!              code == KRB5KRB_AP_ERR_MSG_TYPE) {
!             /* Or service@REALM */
!             pkrb5_free_principal(ctx,increds.server);
              increds.server = 0;
              code = pkrb5_build_principal(ctx, &increds.server,
!                                           (int)strlen(RealmName),
!                                           RealmName,
!                                           ServiceName,
!                                           0);
! 
              if ( IsDebuggerPresent() ) {
                  char * cname, *sname;
                  pkrb5_unparse_name(ctx, increds.client, &cname);
                  pkrb5_unparse_name(ctx, increds.server, &sname);
!                 OutputDebugString("krb5_get_credentials() returned Service Principal Unknown\n");
!                 OutputDebugString("Trying again: getting tickets for \"");
                  OutputDebugString(cname);
                  OutputDebugString("\" and service \"");
                  OutputDebugString(sname);
--- 2910,2940 ----
  
      if ( try_krb5 ) {
          int len;
+         code = KRB5KRB_ERR_GENERIC;
  
  
          increds.client = client_principal;
          increds.times.endtime = 0;
          /* Ask for DES since that is what V4 understands */
          increds.keyblock.enctype = ENCTYPE_DES_CBC_CRC;
  
!         /* If there was a specific realm we are supposed to try
!          * then use it 
!          */
!         if (strlen(realm) != 0) {
!             /* service/cell@REALM */
              increds.server = 0;
              code = pkrb5_build_principal(ctx, &increds.server,
!                                          (int)strlen(realm),
!                                          realm,
!                                          ServiceName,
!                                          CellName,
!                                          0);
              if ( IsDebuggerPresent() ) {
                  char * cname, *sname;
                  pkrb5_unparse_name(ctx, increds.client, &cname);
                  pkrb5_unparse_name(ctx, increds.server, &sname);
!                 OutputDebugString("Getting tickets for \"");
                  OutputDebugString(cname);
                  OutputDebugString("\" and service \"");
                  OutputDebugString(sname);
***************
*** 2950,2978 ****
  
              if (!code)
                  code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
-         }
  
!         if ((code == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!               code == KRB5KRB_ERR_GENERIC /* heimdal */ ||
!               code == KRB5KRB_AP_ERR_MSG_TYPE) &&
!              strcmp(RealmName, realm_of_cell)) {
!             /* Or service/cell@REALM_OF_CELL */
!             strcpy(RealmName, realm_of_cell);
!             pkrb5_free_principal(ctx,increds.server);
!             increds.server = 0;
!             code = pkrb5_build_principal(ctx, &increds.server,
!                                          (int)strlen(RealmName),
!                                          RealmName,
!                                          ServiceName,
!                                          CellName,
!                                          0);
  
              if ( IsDebuggerPresent() ) {
                  char * cname, *sname;
                  pkrb5_unparse_name(ctx, increds.client, &cname);
                  pkrb5_unparse_name(ctx, increds.server, &sname);
!                 OutputDebugString("krb5_get_credentials() returned Service Principal Unknown\n");
!                 OutputDebugString("Trying again: getting tickets for \"");
                  OutputDebugString(cname);
                  OutputDebugString("\" and service \"");
                  OutputDebugString(sname);
--- 2945,3003 ----
  
              if (!code)
                  code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
  
!             if (code == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!                 code == KRB5_ERR_HOST_REALM_UNKNOWN ||
!                 code == KRB5KRB_ERR_GENERIC /* heimdal */ ||
!                 code == KRB5KRB_AP_ERR_MSG_TYPE) {
!                 /* Or service@REALM */
!                 pkrb5_free_principal(ctx,increds.server);
!                 increds.server = 0;
!                 code = pkrb5_build_principal(ctx, &increds.server,
!                                               (int)strlen(realm),
!                                               realm,
!                                               ServiceName,
!                                               0);
! 
!                 if ( IsDebuggerPresent() ) {
!                     char * cname, *sname;
!                     pkrb5_unparse_name(ctx, increds.client, &cname);
!                     pkrb5_unparse_name(ctx, increds.server, &sname);
!                     OutputDebugString("krb5_get_credentials() returned Service Principal Unknown\n");
!                     OutputDebugString("Trying again: getting tickets for \"");
!                     OutputDebugString(cname);
!                     OutputDebugString("\" and service \"");
!                     OutputDebugString(sname);
!                     OutputDebugString("\"\n");
!                     pkrb5_free_unparsed_name(ctx,cname);
!                     pkrb5_free_unparsed_name(ctx,sname);
!                 }
! 
!                 if (!code)
!                     code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
!             }
! 
!             if (code == 0) {
!                 /* we have a local realm for the cell */
!                 strcpy(realm_of_cell, realm);
!             }
!         } else {
!             /* Otherwise, first try service/cell@CLIENT_REALM */
!             if (code = pkrb5_build_principal(ctx, &increds.server,
!                                               (int)strlen(realm_of_user),
!                                               realm_of_user,
!                                               ServiceName,
!                                               CellName,
!                                               0)) 
!             {
!                 goto cleanup;
!             }
  
              if ( IsDebuggerPresent() ) {
                  char * cname, *sname;
                  pkrb5_unparse_name(ctx, increds.client, &cname);
                  pkrb5_unparse_name(ctx, increds.server, &sname);
!                 OutputDebugString("Getting tickets for \"");
                  OutputDebugString(cname);
                  OutputDebugString("\" and service \"");
                  OutputDebugString(sname);
***************
*** 2981,2999 ****
                  pkrb5_free_unparsed_name(ctx,sname);
              }
  
!             if (!code)
!                 code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
  
!         
!             if (code == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
                   code == KRB5KRB_ERR_GENERIC /* heimdal */ ||
! 				 code == KRB5KRB_AP_ERR_MSG_TYPE) {
!                 /* Or service@REALM_OF_CELL */
                  pkrb5_free_principal(ctx,increds.server);
                  increds.server = 0;
                  code = pkrb5_build_principal(ctx, &increds.server,
!                                               (int)strlen(RealmName),
!                                               RealmName,
                                                ServiceName,
                                                0);
  
--- 3006,3065 ----
                  pkrb5_free_unparsed_name(ctx,sname);
              }
  
!             code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
!             if (code == 0) {
!                 /* The client's realm is a local realm for the cell.
!                  * Save it so that later the pts registration will not
!                  * be performed.
!                  */
!                 strcpy(realm_of_cell, realm_of_user);
!             }
  
!             if ((code == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!                  code == KRB5_ERR_HOST_REALM_UNKNOWN ||
                   code == KRB5KRB_ERR_GENERIC /* heimdal */ ||
!                  code == KRB5KRB_AP_ERR_MSG_TYPE) && 
!                  strcmp(realm_of_user, realm_of_cell)) {
!                 /* Then service/cell@CELL_REALM */
!                 pkrb5_free_principal(ctx,increds.server);
!                 increds.server = 0;
!                 code = pkrb5_build_principal(ctx, &increds.server,
!                                               (int)strlen(realm_of_cell),
!                                               realm_of_cell,
!                                               ServiceName,
!                                               CellName,
!                                               0);
!                 if ( IsDebuggerPresent() ) {
!                     char * cname, *sname;
!                     pkrb5_unparse_name(ctx, increds.client, &cname);
!                     pkrb5_unparse_name(ctx, increds.server, &sname);
!                     OutputDebugString("krb5_get_credentials() returned Service Principal Unknown\n");
!                     OutputDebugString("Trying again: getting tickets for \"");
!                     OutputDebugString(cname);
!                     OutputDebugString("\" and service \"");
!                     OutputDebugString(sname);
!                     OutputDebugString("\"\n");
!                     pkrb5_free_unparsed_name(ctx,cname);
!                     pkrb5_free_unparsed_name(ctx,sname);
!                 }
! 
!                 if (!code)
!                     code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
! 
!                 if (!code && !strlen(realm_of_cell)) 
!                     copy_realm_of_ticket(ctx, realm_of_cell, sizeof(realm_of_cell), k5creds);
!             }
! 
!             if (code == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!                 code == KRB5_ERR_HOST_REALM_UNKNOWN ||
!                 code == KRB5KRB_ERR_GENERIC /* heimdal */ ||
!                 code == KRB5KRB_AP_ERR_MSG_TYPE) {
!                 /* Finally service@CELL_REALM */
                  pkrb5_free_principal(ctx,increds.server);
                  increds.server = 0;
                  code = pkrb5_build_principal(ctx, &increds.server,
!                                               (int)strlen(realm_of_cell),
!                                               realm_of_cell,
                                                ServiceName,
                                                0);
  
***************
*** 3013,3018 ****
--- 3079,3086 ----
  
                  if (!code)
                      code = pkrb5_get_credentials(ctx, 0, cc, &increds, &k5creds);
+                 if (!code && !strlen(realm_of_cell)) 
+                     copy_realm_of_ticket(ctx, realm_of_cell, sizeof(realm_of_cell), k5creds);
              }
          }
  
Index: openafs/src/WINNT/afsd/cm.h
diff -c openafs/src/WINNT/afsd/cm.h:1.17.2.13 openafs/src/WINNT/afsd/cm.h:1.17.2.14
*** openafs/src/WINNT/afsd/cm.h:1.17.2.13	Thu Mar 13 00:39:17 2008
--- openafs/src/WINNT/afsd/cm.h	Mon Apr 14 18:44:03 2008
***************
*** 94,99 ****
--- 94,100 ----
  #define CM_ERROR_LOCK_NOT_GRANTED       (CM_ERROR_BASE+59)
  
  /* Used by cm_FollowMountPoint and cm_FindVolumeByName */
+ /* And as an index in cm_volume_t */
  #define RWVOL	0
  #define ROVOL	1
  #define BACKVOL	2
Index: openafs/src/WINNT/afsd/cm_callback.c
diff -c openafs/src/WINNT/afsd/cm_callback.c:1.41.4.41 openafs/src/WINNT/afsd/cm_callback.c:1.41.4.43
*** openafs/src/WINNT/afsd/cm_callback.c:1.41.4.41	Wed Mar 19 09:59:30 2008
--- openafs/src/WINNT/afsd/cm_callback.c	Mon Apr 14 18:44:03 2008
***************
*** 1466,1477 ****
  
      if (cm_freelanceEnabled && 
           scp->fid.cell==AFS_FAKE_ROOT_CELL_ID && scp->fid.volume==AFS_FAKE_ROOT_VOL_ID) {
-         /* if it's something on /afs */
-         if (!(scp->fid.vnode==0x1 && scp->fid.unique==0x1)) {
-             /* if it's not root.afs */
- 	    return 1;
-         }
- 
          lock_ObtainMutex(&cm_Freelance_Lock);
          fdc = cm_fakeDirCallback;
          fgc = cm_fakeGettingCallback;
--- 1466,1471 ----
***************
*** 1813,1825 ****
      if (!volp)
          return 1;
  
!     if (volp->rw.ID == volID) {
!         statep = &volp->rw;
!     } else if (volp->ro.ID == volID) {
!         statep = &volp->ro;
!     } else if (volp->bk.ID == volID) {
!         statep = &volp->bk;
!     }
      cm_PutVolume(volp);
      if (statep->state == vl_online)
          return 1;
--- 1807,1813 ----
      if (!volp)
          return 1;
  
!     statep = cm_VolumeStateByID(volp, volID);
      cm_PutVolume(volp);
      if (statep->state == vl_online)
          return 1;
Index: openafs/src/WINNT/afsd/cm_config.c
diff -c openafs/src/WINNT/afsd/cm_config.c:1.26.4.3 openafs/src/WINNT/afsd/cm_config.c:1.26.4.4
*** openafs/src/WINNT/afsd/cm_config.c:1.26.4.3	Fri Feb  1 21:48:13 2008
--- openafs/src/WINNT/afsd/cm_config.c	Mon Apr  7 10:20:19 2008
***************
*** 192,199 ****
  	    /* now see if this is the right cell */
              if (stricmp(lineBuffer+1, cellNamep) == 0) {
  		/* found the cell we're looking for */
! 		if (newCellNamep)
  		    strcpy(newCellNamep, lineBuffer+1);
                  inRightCell = 1;
  		tracking = 0;
  #ifdef CELLSERV_DEBUG                
--- 192,201 ----
  	    /* now see if this is the right cell */
              if (stricmp(lineBuffer+1, cellNamep) == 0) {
  		/* found the cell we're looking for */
! 		if (newCellNamep) {
  		    strcpy(newCellNamep, lineBuffer+1);
+                     strlwr(newCellNamep);
+                 }
                  inRightCell = 1;
  		tracking = 0;
  #ifdef CELLSERV_DEBUG                
***************
*** 209,216 ****
  		    fclose(bestp);
  		    return -5;
  		}
! 		if (newCellNamep)
  		    strcpy(newCellNamep, lineBuffer+1);
  		inRightCell = 0;
  		tracking = 0;
  		partial = 1;
--- 211,220 ----
  		    fclose(bestp);
  		    return -5;
  		}
! 		if (newCellNamep) {
  		    strcpy(newCellNamep, lineBuffer+1);
+                     strlwr(newCellNamep);
+                 }
  		inRightCell = 0;
  		tracking = 0;
  		partial = 1;
***************
*** 302,313 ****
          for (i = 0; i < numServers; i++) {
              memcpy(&vlSockAddr.sin_addr.s_addr, &cellHostAddrs[i],
                     sizeof(long));
!            vlSockAddr.sin_family = AF_INET;
!            /* sin_port supplied by connection code */
!            if (procp)
!           (*procp)(rockp, &vlSockAddr, cellHostNames[i]);
!            if(newCellNamep)
!           strcpy(newCellNamep,cellNamep);
          }
          return 0;   /* found cell */
      }
--- 306,319 ----
          for (i = 0; i < numServers; i++) {
              memcpy(&vlSockAddr.sin_addr.s_addr, &cellHostAddrs[i],
                     sizeof(long));
!             vlSockAddr.sin_family = AF_INET;
!             /* sin_port supplied by connection code */
!             if (procp)
!                 (*procp)(rockp, &vlSockAddr, cellHostNames[i]);
!             if (newCellNamep) {
!                 strcpy(newCellNamep,cellNamep);
!                 strlwr(newCellNamep);
!             }
          }
          return 0;   /* found cell */
      }
Index: openafs/src/WINNT/afsd/cm_conn.c
diff -c openafs/src/WINNT/afsd/cm_conn.c:1.49.2.39 openafs/src/WINNT/afsd/cm_conn.c:1.49.2.41
*** openafs/src/WINNT/afsd/cm_conn.c:1.49.2.39	Thu Mar 13 00:39:17 2008
--- openafs/src/WINNT/afsd/cm_conn.c	Fri Apr 18 12:46:07 2008
***************
*** 133,139 ****
--- 133,141 ----
      
      *serversppp = cm_GetVolServers(volp, fidp->volume);
  
+     lock_ObtainRead(&cm_volumeLock);
      cm_PutVolume(volp);
+     lock_ReleaseRead(&cm_volumeLock);
      return 0;
  }
  
***************
*** 272,278 ****
      else if (errorCode == CM_ERROR_ALLDOWN) {
  	osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLDOWN.");
  	/* Servers marked DOWN will be restored by the background daemon
! 	 * thread as they become available.
  	 */
      }
  
--- 274,281 ----
      else if (errorCode == CM_ERROR_ALLDOWN) {
  	osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLDOWN.");
  	/* Servers marked DOWN will be restored by the background daemon
! 	 * thread as they become available.  The volume status is 
!          * updated as the server state changes.
  	 */
      }
  
***************
*** 281,335 ****
          /* Volume instances marked offline will be restored by the 
           * background daemon thread as they become available 
           */
!         if (timeLeft > 7 && fidp) {
!             thrd_Sleep(5000);
! 
              code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp, 
!                                     CM_GETVOL_FLAG_NO_LRU_UPDATE, 
!                                     &volp);
              if (code == 0) {
!                 if (fidp->volume == volp->rw.ID)
!                     statep = &volp->rw;
!                 else if (fidp->volume == volp->ro.ID)
!                     statep = &volp->ro;
!                 else if (fidp->volume == volp->bk.ID)
!                     statep = &volp->bk;
  
!                 if (statep->state != vl_offline && statep->state != vl_unknown) {
!                     retry = 1;
!                 } else {
!                     if (cm_CheckOfflineVolume(volp, statep->ID))
                          retry = 1;
                  }
!             
                  cm_PutVolume(volp);
              }
!         }
      }
      else if (errorCode == CM_ERROR_ALLBUSY) {
          /* Volumes that are busy cannot be determined to be non-busy 
           * without actually attempting to access them.
           */
  	osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLBUSY.");
-         if (timeLeft > 7) {
- 
-             thrd_Sleep(5000);
- 
-             if (fidp) { /* File Server query */
-                 code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp, 
-                                         CM_GETVOL_FLAG_NO_LRU_UPDATE, 
-                                         &volp);
-                 if (code == 0) {
-                     if (fidp->volume == volp->rw.ID)
-                         statep = &volp->rw;
-                     else if (fidp->volume == volp->ro.ID)
-                         statep = &volp->ro;
-                     else if (fidp->volume == volp->bk.ID)
-                         statep = &volp->bk;
  
                      if (statep->state != vl_offline && 
!                         statep->state != vl_busy &&
!                         statep->state != vl_unknown) {
                          retry = 1;
                      } else {
                          if (!serversp) {
--- 284,328 ----
          /* Volume instances marked offline will be restored by the 
           * background daemon thread as they become available 
           */
!         if (fidp) {
              code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp, 
!                                       CM_GETVOL_FLAG_NO_LRU_UPDATE, 
!                                       &volp);
              if (code == 0) {
!                 if (timeLeft > 7) {
!                     thrd_Sleep(5000);
  
!                     /* cm_CheckOfflineVolume() resets the serverRef state */
!                     if (cm_CheckOfflineVolume(volp, fidp->volume))
                          retry = 1;
+                 } else {
+                     cm_UpdateVolumeStatus(volp, fidp->volume);
                  }
!                 lock_ObtainRead(&cm_volumeLock);
                  cm_PutVolume(volp);
+                 lock_ReleaseRead(&cm_volumeLock);
+                 volp = NULL;
              }
!         } 
      }
      else if (errorCode == CM_ERROR_ALLBUSY) {
          /* Volumes that are busy cannot be determined to be non-busy 
           * without actually attempting to access them.
           */
  	osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLBUSY.");
  
+         if (fidp) { /* File Server query */
+             code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp, 
+                                      CM_GETVOL_FLAG_NO_LRU_UPDATE, 
+                                      &volp);
+             if (code == 0) {
+                 if (timeLeft > 7) {
+                     thrd_Sleep(5000);
+                     
+                     statep = cm_VolumeStateByID(volp, fidp->volume);
                      if (statep->state != vl_offline && 
!                          statep->state != vl_busy &&
!                          statep->state != vl_unknown) {
                          retry = 1;
                      } else {
                          if (!serversp) {
***************
*** 343,349 ****
                          for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
                              if (tsrp->status == srv_busy) {
                                  tsrp->status = srv_not_busy;
!                             }
                          }
                          lock_ReleaseWrite(&cm_serverLock);
                          if (free_svr_list) {
--- 336,342 ----
                          for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
                              if (tsrp->status == srv_busy) {
                                  tsrp->status = srv_not_busy;
!                             }       
                          }
                          lock_ReleaseWrite(&cm_serverLock);
                          if (free_svr_list) {
***************
*** 351,363 ****
                              *serverspp = serversp;
                          }
  
!                         cm_UpdateVolumeStatus(volp, statep->ID);
                          retry = 1;
                      }
!             
!                     cm_PutVolume(volp);
                  }
!             } else {    /* VL Server query */
                  if (serversp) {
                      lock_ObtainWrite(&cm_serverLock);
                      for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
--- 344,365 ----
                              *serverspp = serversp;
                          }
  
!                         cm_UpdateVolumeStatus(volp, fidp->volume);
                          retry = 1;
                      }
!                 } else {
!                     cm_UpdateVolumeStatus(volp, fidp->volume);
                  }
! 
!                 lock_ObtainRead(&cm_volumeLock);
!                 cm_PutVolume(volp);
!                 lock_ReleaseRead(&cm_volumeLock);
!                 volp = NULL;
!             }
!         } else {    /* VL Server query */
!             if (timeLeft > 7) {
!                 thrd_Sleep(5000);
! 
                  if (serversp) {
                      lock_ObtainWrite(&cm_serverLock);
                      for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
***************
*** 389,402 ****
                      code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp, 
                                               CM_GETVOL_FLAG_NO_LRU_UPDATE, 
                                               &volp);
!                     if (code == 0) {
!                         if (fidp->volume == volp->rw.ID)
!                             statep = &volp->rw;
!                         else if (fidp->volume == volp->ro.ID)
!                             statep = &volp->ro;
!                         else if (fidp->volume == volp->bk.ID)
!                             statep = &volp->bk;
!                     }
                  }
                  break;
              }
--- 391,398 ----
                      code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp, 
                                               CM_GETVOL_FLAG_NO_LRU_UPDATE, 
                                               &volp);
!                     if (code == 0)
!                         statep = cm_VolumeStateByID(volp, fidp->volume);
                  }
                  break;
              }
***************
*** 405,411 ****
--- 401,410 ----
          
          if (statep) {
              cm_UpdateVolumeStatus(volp, statep->ID);
+             lock_ObtainRead(&cm_volumeLock);
              cm_PutVolume(volp);
+             lock_ReleaseRead(&cm_volumeLock);
+             volp = NULL;
          }
  
          if (free_svr_list) {
***************
*** 500,513 ****
                      code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp, 
                                               CM_GETVOL_FLAG_NO_LRU_UPDATE, 
                                               &volp);
!                     if (code == 0) {
!                         if (fidp->volume == volp->rw.ID)
!                             statep = &volp->rw;
!                         else if (fidp->volume == volp->ro.ID)
!                             statep = &volp->ro;
!                         else if (fidp->volume == volp->bk.ID)
!                             statep = &volp->bk;
!                     }
                  }   
              }
          }   
--- 499,506 ----
                      code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp, 
                                               CM_GETVOL_FLAG_NO_LRU_UPDATE, 
                                               &volp);
!                     if (code == 0)
!                         cm_VolumeStateByID(volp, fidp->volume);
                  }   
              }
          }   
***************
*** 518,524 ****
--- 511,520 ----
  
          if (statep) {
              cm_UpdateVolumeStatus(volp, statep->ID);
+             lock_ObtainRead(&cm_volumeLock);
              cm_PutVolume(volp);
+             lock_ReleaseRead(&cm_volumeLock);
+             volp = NULL;
          }
  
          if (free_svr_list) {
***************
*** 540,546 ****
  		if (scp->fileType != CM_SCACHETYPE_DIRECTORY)
  		    pscp = cm_FindSCacheParent(scp);
  
- 
  		lock_ObtainWrite(&scp->rw);
  		lock_ObtainWrite(&cm_scacheLock);
  		cm_RemoveSCacheFromHashTable(scp);
--- 536,541 ----
Index: openafs/src/WINNT/afsd/cm_freelance.c
diff -c openafs/src/WINNT/afsd/cm_freelance.c:1.33.2.9 openafs/src/WINNT/afsd/cm_freelance.c:1.33.2.11
*** openafs/src/WINNT/afsd/cm_freelance.c:1.33.2.9	Sun Mar  2 23:25:40 2008
--- openafs/src/WINNT/afsd/cm_freelance.c	Fri Apr 11 13:46:24 2008
***************
*** 153,162 ****
  
      lock_InitializeMutex(&cm_Freelance_Lock, "Freelance Lock");
  
-     // make sure we sync the data version to the cached root scache_t                  
-     if (cm_data.rootSCachep && cm_data.rootSCachep->fid.cell == AFS_FAKE_ROOT_CELL_ID) 
-         cm_data.fakeDirVersion = cm_data.rootSCachep->dataVersion;                          
-                                                                                       
      // yj: first we make a call to cm_initLocalMountPoints
      // to read all the local mount points from the registry
      cm_InitLocalMountPoints();
--- 153,158 ----
***************
*** 271,277 ****
      curChunk = 13;
  
      // stick the first 2 entries "." and ".." in
-     fakeEntry.fid.unique = htonl(1);
      fakeEntry.fid.vnode = htonl(1);
      strcpy(fakeEntry.name, ".");
      currentPos = cm_FakeRootDir + curPage * CM_DIR_PAGESIZE + curChunk * CM_DIR_CHUNKSIZE;
--- 267,272 ----
***************
*** 400,417 ****
  
      osi_Log0(afsd_logp,"Invalidating local mount point scp...  ");
  
!     cm_SetFid(&aFid, AFS_FAKE_ROOT_CELL_ID, AFS_FAKE_ROOT_VOL_ID, 1, 2);
  
      lock_ObtainWrite(&cm_scacheLock);
      lock_ObtainMutex(&cm_Freelance_Lock);  /* always scache then freelance lock */
      for (i=0; i<cm_noLocalMountPoints; i++) {
          hash = CM_SCACHE_HASH(&aFid);
          for (scp=cm_data.scacheHashTablep[hash]; scp; scp=scp->nextp) {
!             if (scp->fid.volume == aFid.volume &&
!                  scp->fid.vnode == aFid.vnode &&
!                  scp->fid.unique == aFid.unique 
!                  ) {
! 
                  // mark the scp to be reused
                  cm_HoldSCacheNoLock(scp);
                  lock_ReleaseWrite(&cm_scacheLock);
--- 395,408 ----
  
      osi_Log0(afsd_logp,"Invalidating local mount point scp...  ");
  
!     cm_SetFid(&aFid, AFS_FAKE_ROOT_CELL_ID, AFS_FAKE_ROOT_VOL_ID, 1, 1);
  
      lock_ObtainWrite(&cm_scacheLock);
      lock_ObtainMutex(&cm_Freelance_Lock);  /* always scache then freelance lock */
      for (i=0; i<cm_noLocalMountPoints; i++) {
          hash = CM_SCACHE_HASH(&aFid);
          for (scp=cm_data.scacheHashTablep[hash]; scp; scp=scp->nextp) {
!             if (scp != cm_data.rootSCachep && cm_FidCmp(&scp->fid, &aFid) == 0) {
                  // mark the scp to be reused
                  cm_HoldSCacheNoLock(scp);
                  lock_ReleaseWrite(&cm_scacheLock);
***************
*** 436,442 ****
                  }
              }
          }
!         cm_SetFid(&aFid, AFS_FAKE_ROOT_CELL_ID, AFS_FAKE_ROOT_VOL_ID, aFid.vnode + 1, 2);
      }
      lock_ReleaseWrite(&cm_scacheLock);
      osi_Log0(afsd_logp,"\tall old scp cleared!");
--- 427,433 ----
                  }
              }
          }
!         cm_SetFid(&aFid, AFS_FAKE_ROOT_CELL_ID, AFS_FAKE_ROOT_VOL_ID, aFid.vnode + 1, 1);
      }
      lock_ReleaseWrite(&cm_scacheLock);
      osi_Log0(afsd_logp,"\tall old scp cleared!");
***************
*** 1104,1110 ****
  
      /* cm_reInitLocalMountPoints(); */
      if (fidp)
!         cm_SetFid(fidp, fidp->cell, fidp->volume, cm_noLocalMountPoints + 1, 1);
      cm_noteLocalMountPointChange();
      return 0;
  }
--- 1095,1101 ----
  
      /* cm_reInitLocalMountPoints(); */
      if (fidp)
!         cm_SetFid(fidp, fidp->cell, fidp->volume, ++cm_noLocalMountPoints, 1);
      cm_noteLocalMountPointChange();
      return 0;
  }
***************
*** 1163,1168 ****
--- 1154,1160 ----
  
              if (!strcmp(shortname, toremove)) {
                  RegDeleteValue( hkFreelance, szValueName );
+                 found = 1;
                  break;
              }
          }
***************
*** 1205,1220 ****
  
          fclose(fp1);
          fclose(fp2);
!         if (!found)
!             return CM_ERROR_NOSUCHFILE;
! 
!         unlink(hfile);
!         rename(hfile2, hfile);
      }
      
      lock_ReleaseMutex(&cm_Freelance_Lock);
!     cm_noteLocalMountPointChange();
!     return 0;
  }
  
  long cm_FreelanceAddSymlink(char *filename, char *destination, cm_fid_t *fidp)
--- 1197,1214 ----
  
          fclose(fp1);
          fclose(fp2);
!         if (found) {
!             unlink(hfile);
!             rename(hfile2, hfile);
!         }
      }
      
      lock_ReleaseMutex(&cm_Freelance_Lock);
!     if (found) {
!         cm_noteLocalMountPointChange();
!         return 0;
!     } else
!         return CM_ERROR_NOSUCHFILE;
  }
  
  long cm_FreelanceAddSymlink(char *filename, char *destination, cm_fid_t *fidp)
***************
*** 1318,1324 ****
  
      /* cm_reInitLocalMountPoints(); */
      if (fidp)
!         cm_SetFid(fidp, fidp->cell, fidp->volume, cm_noLocalMountPoints + 1, 1);
      cm_noteLocalMountPointChange();
      return 0;
  }
--- 1312,1318 ----
  
      /* cm_reInitLocalMountPoints(); */
      if (fidp)
!         cm_SetFid(fidp, fidp->cell, fidp->volume, ++cm_noLocalMountPoints, 1);
      cm_noteLocalMountPointChange();
      return 0;
  }
***************
*** 1372,1377 ****
--- 1366,1372 ----
  
              if (!strcmp(shortname, toremove)) {
                  RegDeleteValue( hkFreelanceSymlinks, szValueName );
+                 found = 1;
                  break;
              }
          }
***************
*** 1380,1386 ****
  #endif
      
      lock_ReleaseMutex(&cm_Freelance_Lock);
!     cm_noteLocalMountPointChange();
!     return 0;
  }
  #endif /* AFS_FREELANCE_CLIENT */
--- 1375,1384 ----
  #endif
      
      lock_ReleaseMutex(&cm_Freelance_Lock);
!     if (found) {
!         cm_noteLocalMountPointChange();
!         return 0;
!     } else
!         return CM_ERROR_NOSUCHFILE;
  }
  #endif /* AFS_FREELANCE_CLIENT */
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.40 openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.44
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.40	Wed Mar 19 09:59:30 2008
--- openafs/src/WINNT/afsd/cm_ioctl.c	Mon Apr 14 18:44:03 2008
***************
*** 587,593 ****
      AFSFetchStatus fileStatus;
      AFSVolSync volSync;
      long code;
!     AFSFid fid;
      int tlen;
      cm_req_t req;
      struct rx_connection * callp;
--- 587,593 ----
      AFSFetchStatus fileStatus;
      AFSVolSync volSync;
      long code;
!     AFSFid afid;
      int tlen;
      cm_req_t req;
      struct rx_connection * callp;
***************
*** 601,609 ****
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
          cm_SkipIoctlPath(ioctlp);
! 
!         code = cm_GetSCache(&optionsp->fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
--- 601,611 ----
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
+         cm_fid_t fid;
          cm_SkipIoctlPath(ioctlp);
!         cm_SetFid(&fid, optionsp->fid.cell, optionsp->fid.volume, 
!                   optionsp->fid.vnode, optionsp->fid.unique);
!         code = cm_GetSCache(&fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
***************
*** 618,626 ****
      } else
  #endif
      {
!         fid.Volume = scp->fid.volume;
!         fid.Vnode = scp->fid.vnode;
!         fid.Unique = scp->fid.unique;
          do {
              acl.AFSOpaque_val = ioctlp->outDatap;
              acl.AFSOpaque_len = 0;
--- 620,628 ----
      } else
  #endif
      {
!         afid.Volume = scp->fid.volume;
!         afid.Vnode = scp->fid.vnode;
!         afid.Unique = scp->fid.unique;
          do {
              acl.AFSOpaque_val = ioctlp->outDatap;
              acl.AFSOpaque_len = 0;
***************
*** 628,634 ****
              if (code) continue;
  
              callp = cm_GetRxConn(connp);
!             code = RXAFS_FetchACL(callp, &fid, &acl, &fileStatus, &volSync);
              rx_PutConnection(callp);
  
          } while (cm_Analyze(connp, userp, &req, &scp->fid, &volSync, NULL, NULL, code));
--- 630,636 ----
              if (code) continue;
  
              callp = cm_GetRxConn(connp);
!             code = RXAFS_FetchACL(callp, &afid, &acl, &fileStatus, &volSync);
              rx_PutConnection(callp);
  
          } while (cm_Analyze(connp, userp, &req, &scp->fid, &volSync, NULL, NULL, code));
***************
*** 661,668 ****
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
          cm_SkipIoctlPath(ioctlp);
!         code = cm_GetSCache(&optionsp->fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
--- 663,673 ----
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
+         cm_fid_t fid;
          cm_SkipIoctlPath(ioctlp);
!         cm_SetFid(&fid, optionsp->fid.cell, optionsp->fid.volume, 
!                   optionsp->fid.vnode, optionsp->fid.unique);
!         code = cm_GetSCache(&fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
***************
*** 791,798 ****
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
          cm_SkipIoctlPath(ioctlp);
!         code = cm_GetSCache(&optionsp->fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
--- 796,806 ----
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
+         cm_fid_t fid;
          cm_SkipIoctlPath(ioctlp);
!         cm_SetFid(&fid, optionsp->fid.cell, optionsp->fid.volume, 
!                   optionsp->fid.vnode, optionsp->fid.unique);
!         code = cm_GetSCache(&fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
***************
*** 829,836 ****
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
          cm_SkipIoctlPath(ioctlp);
!         code = cm_GetSCache(&optionsp->fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
--- 837,847 ----
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
+         cm_fid_t fid;
          cm_SkipIoctlPath(ioctlp);
!         cm_SetFid(&fid, optionsp->fid.cell, optionsp->fid.volume, 
!                   optionsp->fid.vnode, optionsp->fid.unique);
!         code = cm_GetSCache(&fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
***************
*** 976,983 ****
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
          cm_SkipIoctlPath(ioctlp);
!         code = cm_GetSCache(&optionsp->fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
--- 987,997 ----
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
+         cm_fid_t fid;
          cm_SkipIoctlPath(ioctlp);
!         cm_SetFid(&fid, optionsp->fid.cell, optionsp->fid.volume, 
!                   optionsp->fid.vnode, optionsp->fid.unique);
!         code = cm_GetSCache(&fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
***************
*** 1089,1096 ****
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
          cm_SkipIoctlPath(ioctlp);
!         code = cm_GetSCache(&optionsp->fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
--- 1103,1113 ----
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
+         cm_fid_t fid;
          cm_SkipIoctlPath(ioctlp);
!         cm_SetFid(&fid, optionsp->fid.cell, optionsp->fid.volume, 
!                   optionsp->fid.vnode, optionsp->fid.unique);
!         code = cm_GetSCache(&fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
***************
*** 1127,1134 ****
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
          cm_SkipIoctlPath(ioctlp);
!         code = cm_GetSCache(&optionsp->fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
--- 1144,1154 ----
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
+         cm_fid_t fid;
          cm_SkipIoctlPath(ioctlp);
!         cm_SetFid(&fid, optionsp->fid.cell, optionsp->fid.volume, 
!                   optionsp->fid.vnode, optionsp->fid.unique);
!         code = cm_GetSCache(&fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
***************
*** 1171,1178 ****
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
          cm_SkipIoctlPath(ioctlp);
!         code = cm_GetSCache(&optionsp->fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
--- 1191,1201 ----
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
+         cm_fid_t fid;
          cm_SkipIoctlPath(ioctlp);
!         cm_SetFid(&fid, optionsp->fid.cell, optionsp->fid.volume, 
!                   optionsp->fid.vnode, optionsp->fid.unique);
!         code = cm_GetSCache(&fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
***************
*** 1217,1223 ****
  	
          cp = ioctlp->outDatap;
          
-         lock_ObtainMutex(&tvp->mx);
          tsrpp = cm_GetVolServers(tvp, volume);
          lock_ObtainRead(&cm_serverLock);
          for (current = *tsrpp; current; current = current->next) {
--- 1240,1245 ----
***************
*** 1227,1233 ****
          }
          lock_ReleaseRead(&cm_serverLock);
          cm_FreeServerList(tsrpp, 0);
-         lock_ReleaseMutex(&tvp->mx);
  
          /* still room for terminating NULL, add it on */
          volume = 0;	/* reuse vbl */
--- 1249,1254 ----
***************
*** 1299,1342 ****
      code = cm_Lookup(dscp, cp, CM_FLAG_NOMOUNTCHASE, userp, &req, &scp);
          
      /* if something went wrong, bail out now */
!     if (code) {
!         goto done2;
!     }
          
      lock_ObtainWrite(&scp->rw);
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
                        CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
!     if (code) {     
!         lock_ReleaseWrite(&scp->rw);
!         cm_ReleaseSCache(scp);
          goto done2;
-     }
  
      /* now check that this is a real mount point */
      if (scp->fileType != CM_SCACHETYPE_MOUNTPOINT) {
-         lock_ReleaseWrite(&scp->rw);
-         cm_ReleaseSCache(scp);
          code = CM_ERROR_INVAL;
          goto done1;
      }
  
      /* time to make the RPC, so drop the lock */
      lock_ReleaseWrite(&scp->rw);
-     cm_ReleaseSCache(scp);
  
!     /* easier to do it this way */
!     code = cm_Unlink(dscp, cp, userp, &req);
      if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
          smb_NotifyChange(FILE_ACTION_REMOVED,
                            FILE_NOTIFY_CHANGE_DIR_NAME,
                            dscp, cp, NULL, TRUE);
  
-   done1:
      lock_ObtainWrite(&scp->rw);
      cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
-     lock_ReleaseWrite(&scp->rw);
  
    done2:
      cm_ReleaseSCache(dscp);
      return code;
  }
--- 1320,1370 ----
      code = cm_Lookup(dscp, cp, CM_FLAG_NOMOUNTCHASE, userp, &req, &scp);
          
      /* if something went wrong, bail out now */
!     if (code)
!         goto done3;
          
      lock_ObtainWrite(&scp->rw);
      code = cm_SyncOp(scp, NULL, userp, &req, 0,
                        CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
!     if (code)  
          goto done2;
  
      /* now check that this is a real mount point */
      if (scp->fileType != CM_SCACHETYPE_MOUNTPOINT) {
          code = CM_ERROR_INVAL;
          goto done1;
      }
  
      /* time to make the RPC, so drop the lock */
      lock_ReleaseWrite(&scp->rw);
  
! #ifdef AFS_FREELANCE_CLIENT
!     if (cm_freelanceEnabled && dscp == cm_data.rootSCachep) {
!         /* we are adding the mount point to the root dir., so call
!          * the freelance code to do the add. */
!         osi_Log0(afsd_logp,"IoctlDeleteMountPoint from Freelance root dir");
!         code = cm_FreelanceRemoveMount(cp);
!     } else 
! #endif
!     {
!         /* easier to do it this way */
!         code = cm_Unlink(dscp, cp, userp, &req);
!     }
      if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
          smb_NotifyChange(FILE_ACTION_REMOVED,
                            FILE_NOTIFY_CHANGE_DIR_NAME,
                            dscp, cp, NULL, TRUE);
  
      lock_ObtainWrite(&scp->rw);
+   done1:
      cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
  
    done2:
+     cm_DiscardSCache(scp);
+     lock_ReleaseWrite(&scp->rw);
+     cm_ReleaseSCache(scp);
+ 
+   done3:
      cm_ReleaseSCache(dscp);
      return code;
  }
***************
*** 1966,1983 ****
          osi_Log0(afsd_logp,"IoctlCreateMountPoint within Freelance root dir");
          code = cm_FreelanceAddMount(leaf, fullCell, volume, 
                                      *ioctlp->inDatap == '%', NULL);
! 	cm_ReleaseSCache(dscp);
!         return code;
!     }
  #endif
!     /* create the symlink with mode 644.  The lack of X bits tells
!      * us that it is a mount point.
!      */
!     tattr.mask = CM_ATTRMASK_UNIXMODEBITS | CM_ATTRMASK_CLIENTMODTIME;
!     tattr.unixModeBits = 0644;
!     tattr.clientModTime = time(NULL);
  
!     code = cm_SymLink(dscp, leaf, mpInfo, 0, &tattr, userp, &req);
      if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
          smb_NotifyChange(FILE_ACTION_ADDED,
                           FILE_NOTIFY_CHANGE_DIR_NAME,
--- 1994,2012 ----
          osi_Log0(afsd_logp,"IoctlCreateMountPoint within Freelance root dir");
          code = cm_FreelanceAddMount(leaf, fullCell, volume, 
                                      *ioctlp->inDatap == '%', NULL);
!     } else 
  #endif
!     {
!         /* create the symlink with mode 644.  The lack of X bits tells
!          * us that it is a mount point.
!          */
!         tattr.mask = CM_ATTRMASK_UNIXMODEBITS | CM_ATTRMASK_CLIENTMODTIME;
!         tattr.unixModeBits = 0644;
!         tattr.clientModTime = time(NULL);
  
!         code = cm_SymLink(dscp, leaf, mpInfo, 0, &tattr, userp, &req);
!     }
!     
      if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
          smb_NotifyChange(FILE_ACTION_ADDED,
                           FILE_NOTIFY_CHANGE_DIR_NAME,
***************
*** 2025,2040 ****
          }
          osi_Log0(afsd_logp,"IoctlCreateSymlink within Freelance root dir");
          code = cm_FreelanceAddSymlink(leaf, cp, NULL);
! 	cm_ReleaseSCache(dscp);
!         return code;
!     }
  #endif
  
!     /* Create symlink with mode 0755. */
!     tattr.mask = CM_ATTRMASK_UNIXMODEBITS;
!     tattr.unixModeBits = 0755;
  
-     code = cm_SymLink(dscp, leaf, cp, 0, &tattr, userp, &req);
      if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
          smb_NotifyChange(FILE_ACTION_ADDED,
                            FILE_NOTIFY_CHANGE_FILE_NAME
--- 2054,2069 ----
          }
          osi_Log0(afsd_logp,"IoctlCreateSymlink within Freelance root dir");
          code = cm_FreelanceAddSymlink(leaf, cp, NULL);
!     } else
  #endif
+     {
+         /* Create symlink with mode 0755. */
+         tattr.mask = CM_ATTRMASK_UNIXMODEBITS;
+         tattr.unixModeBits = 0755;
  
!         code = cm_SymLink(dscp, leaf, cp, 0, &tattr, userp, &req);
!     }
  
      if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
          smb_NotifyChange(FILE_ACTION_ADDED,
                            FILE_NOTIFY_CHANGE_FILE_NAME
***************
*** 2151,2167 ****
  
      cp = ioctlp->inDatap;
  
- #ifdef AFS_FREELANCE_CLIENT
-     if (cm_freelanceEnabled && dscp == cm_data.rootSCachep) {
-         /* we are adding the mount point to the root dir., so call
-          * the freelance code to do the add. */
-         osi_Log0(afsd_logp,"IoctlDeletelink from Freelance root dir");
-         code = cm_FreelanceRemoveSymlink(cp);
- 	cm_ReleaseSCache(dscp);
-         return code;
-     }
- #endif
- 
      code = cm_Lookup(dscp, cp, CM_FLAG_NOMOUNTCHASE, userp, &req, &scp);
          
      /* if something went wrong, bail out now */
--- 2180,2185 ----
***************
*** 2185,2192 ****
      /* time to make the RPC, so drop the lock */
      lock_ReleaseWrite(&scp->rw);
          
!     /* easier to do it this way */
!     code = cm_Unlink(dscp, cp, userp, &req);
      if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
          smb_NotifyChange(FILE_ACTION_REMOVED,
                            FILE_NOTIFY_CHANGE_FILE_NAME
--- 2203,2220 ----
      /* time to make the RPC, so drop the lock */
      lock_ReleaseWrite(&scp->rw);
          
! #ifdef AFS_FREELANCE_CLIENT
!     if (cm_freelanceEnabled && dscp == cm_data.rootSCachep) {
!         /* we are adding the mount point to the root dir., so call
!          * the freelance code to do the add. */
!         osi_Log0(afsd_logp,"IoctlDeletelink from Freelance root dir");
!         code = cm_FreelanceRemoveSymlink(cp);
!     } else 
! #endif
!     {
!         /* easier to do it this way */
!         code = cm_Unlink(dscp, cp, userp, &req);
!     }
      if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH))
          smb_NotifyChange(FILE_ACTION_REMOVED,
                            FILE_NOTIFY_CHANGE_FILE_NAME
***************
*** 2198,2203 ****
--- 2226,2232 ----
      cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
  
    done2:
+     cm_DiscardSCache(scp);
      lock_ReleaseWrite(&scp->rw);
      cm_ReleaseSCache(scp);
  
***************
*** 3112,3119 ****
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
          cm_SkipIoctlPath(ioctlp);
!         code = cm_GetSCache(&optionsp->fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
--- 3141,3151 ----
          flags |= (optionsp->literal ? CM_PARSE_FLAG_LITERAL : 0);
  
      if (optionsp && CM_IOCTL_QOPTS_HAVE_FID(optionsp)) {
+         cm_fid_t fid;
          cm_SkipIoctlPath(ioctlp);
!         cm_SetFid(&fid, optionsp->fid.cell, optionsp->fid.volume, 
!                   optionsp->fid.vnode, optionsp->fid.unique);
!         code = cm_GetSCache(&fid, &scp, userp, &req);
      } else {
          code = cm_ParseIoctlPath(ioctlp, userp, &req, &scp, flags);
      }
***************
*** 3140,3152 ****
          if (code) 
              return code;
  	
!         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:
--- 3172,3178 ----
          if (code) 
              return code;
  	
!         statep = cm_VolumeStateByID(tvp, volume);
          switch (statep->state) {
          case vl_online:
          case vl_unknown:
***************
*** 3241,3263 ****
      if (code)
          return code;
  	
!     if (testp->fid.volume) {
!         if (testp->fid.volume == volp->rw.ID)
!             statep = &volp->rw;
!         else if (testp->fid.volume == volp->ro.ID)
!             statep = &volp->ro;
!         else
!             statep = &volp->bk;
!     } else {
!         len = strlen(testp->volname);
! 
!         if (stricmp(".readonly", &testp->volname[len-9]) == 0)
!             statep = &volp->ro;
!         else if (stricmp(".backup", &testp->volname[len-7]) == 0)
!             statep = &volp->bk;
!         else 
!             statep = &volp->rw;
!     }
  
      if (statep) {
          statep->state = testp->state;
--- 3267,3276 ----
      if (code)
          return code;
  	
!     if (testp->fid.volume)
!         statep = cm_VolumeStateByID(volp, testp->fid.volume);
!     else
!         statep = cm_VolumeStateByName(volp, testp->volname);
  
      if (statep) {
          statep->state = testp->state;
Index: openafs/src/WINNT/afsd/cm_memmap.h
diff -c openafs/src/WINNT/afsd/cm_memmap.h:1.3.4.10 openafs/src/WINNT/afsd/cm_memmap.h:1.3.4.11
*** openafs/src/WINNT/afsd/cm_memmap.h:1.3.4.10	Wed Mar 19 20:01:59 2008
--- openafs/src/WINNT/afsd/cm_memmap.h	Mon Apr 21 11:36:49 2008
***************
*** 10,16 ****
  #ifndef CM_MEMMAP_H
  #define CM_MEMMAP_H 1
  
! #define CM_CONFIG_DATA_VERSION  2
  #define CM_CONFIG_DATA_MAGIC            ('A' | 'F'<<8 | 'S'<<16 | CM_CONFIG_DATA_VERSION<<24)
  
  typedef struct cm_config_data {
--- 10,16 ----
  #ifndef CM_MEMMAP_H
  #define CM_MEMMAP_H 1
  
! #define CM_CONFIG_DATA_VERSION  3
  #define CM_CONFIG_DATA_MAGIC            ('A' | 'F'<<8 | 'S'<<16 | CM_CONFIG_DATA_VERSION<<24)
  
  typedef struct cm_config_data {
Index: openafs/src/WINNT/afsd/cm_performance.c
diff -c openafs/src/WINNT/afsd/cm_performance.c:1.1.2.4 openafs/src/WINNT/afsd/cm_performance.c:1.1.2.5
*** openafs/src/WINNT/afsd/cm_performance.c:1.1.2.4	Thu Mar 13 00:39:17 2008
--- openafs/src/WINNT/afsd/cm_performance.c	Mon Apr 14 18:44:03 2008
***************
*** 171,178 ****
  
      lock_ObtainRead(&cm_volumeLock);
      for(volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
!         if (volp->rw.ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->rw.ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
--- 171,178 ----
  
      lock_ObtainRead(&cm_volumeLock);
      for(volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
!         if (volp->vol[RWVOL].ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->vol[RWVOL].ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
***************
*** 189,196 ****
                  cm_PerformanceInsertToHashTable(statp);
              }
          }
!         if (volp->ro.ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->ro.ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
--- 189,196 ----
                  cm_PerformanceInsertToHashTable(statp);
              }
          }
!         if (volp->vol[ROVOL].ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->vol[ROVOL].ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
***************
*** 207,214 ****
                  cm_PerformanceInsertToHashTable(statp);
              }
          }
!         if (volp->bk.ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->bk.ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
--- 207,214 ----
                  cm_PerformanceInsertToHashTable(statp);
              }
          }
!         if (volp->vol[BACKVOL].ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->vol[BACKVOL].ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
***************
*** 311,318 ****
  
      lock_ObtainRead(&cm_volumeLock);
      for(volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
!         if (volp->rw.ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->rw.ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
--- 311,318 ----
  
      lock_ObtainRead(&cm_volumeLock);
      for(volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
!         if (volp->vol[RWVOL].ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->vol[RWVOL].ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
***************
*** 329,336 ****
                  cm_PerformanceInsertToHashTable(statp);
              }
          }
!         if (volp->ro.ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->ro.ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
--- 329,336 ----
                  cm_PerformanceInsertToHashTable(statp);
              }
          }
!         if (volp->vol[ROVOL].ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->vol[ROVOL].ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
***************
*** 347,354 ****
                  cm_PerformanceInsertToHashTable(statp);
              }
          }
!         if (volp->bk.ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->bk.ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
--- 347,354 ----
                  cm_PerformanceInsertToHashTable(statp);
              }
          }
!         if (volp->vol[BACKVOL].ID) {
!             cm_SetFid(&fid, volp->cellp->cellID, volp->vol[BACKVOL].ID, 1, 1);
              hash = fid.hash % fidStatsHashTableSize;
  
              for (statp = fidStatsHashTablep[hash]; statp; statp = statp->nextp) {
Index: openafs/src/WINNT/afsd/cm_scache.c
diff -c openafs/src/WINNT/afsd/cm_scache.c:1.35.2.70 openafs/src/WINNT/afsd/cm_scache.c:1.35.2.74
*** openafs/src/WINNT/afsd/cm_scache.c:1.35.2.70	Wed Mar 19 16:18:37 2008
--- openafs/src/WINNT/afsd/cm_scache.c	Mon Apr 14 18:44:03 2008
***************
*** 639,645 ****
  #endif
  {
      long hash;
!     cm_scache_t *scp;
      long code;
      cm_volume_t *volp = NULL;
      cm_cell_t *cellp;
--- 639,645 ----
  #endif
  {
      long hash;
!     cm_scache_t *scp = NULL;
      long code;
      cm_volume_t *volp = NULL;
      cm_cell_t *cellp;
***************
*** 651,662 ****
          
      osi_assertx(fidp->cell != 0, "unassigned cell value");
  
!     if (fidp->cell== cm_data.rootFid.cell && 
!          fidp->volume==cm_data.rootFid.volume &&
!          fidp->vnode==0x0 && fidp->unique==0x0)
!     {
!         osi_Log0(afsd_logp,"cm_GetSCache called with root cell/volume and vnode=0 and unique=0");
!     }
  
      // yj: check if we have the scp, if so, we don't need
      // to do anything else
--- 651,664 ----
          
      osi_assertx(fidp->cell != 0, "unassigned cell value");
  
! #ifdef AFS_FREELANCE_CLIENT
!     special = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && 
!                fidp->volume==AFS_FAKE_ROOT_VOL_ID &&
!                !(fidp->vnode==0x1 && fidp->unique==0x1));
!     isRoot = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && 
!               fidp->volume==AFS_FAKE_ROOT_VOL_ID &&
!               fidp->vnode==0x1 && fidp->unique==0x1);
! #endif
  
      // yj: check if we have the scp, if so, we don't need
      // to do anything else
***************
*** 667,672 ****
--- 669,679 ----
  	    afsi_log("%s:%d cm_GetSCache (1) outScpp 0x%p ref %d", file, line, scp, scp->refCount);
  	    osi_Log1(afsd_logp,"cm_GetSCache (1) outScpp 0x%p", scp);
  #endif
+ #ifdef AFS_FREELANCE_CLIENT
+             if (cm_freelanceEnabled && special && 
+                 cm_data.fakeDirVersion != scp->dataVersion)
+                 break;
+ #endif
              cm_HoldSCacheNoLock(scp);
              *outScpp = scp;
              cm_AdjustScacheLRU(scp);
***************
*** 684,695 ****
      // because we have to fill in the status stuff 'coz we
      // don't want trybulkstat to fill it in for us
  #ifdef AFS_FREELANCE_CLIENT
-     special = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && 
-                fidp->volume==AFS_FAKE_ROOT_VOL_ID &&
-                !(fidp->vnode==0x1 && fidp->unique==0x1));
-     isRoot = (fidp->cell==AFS_FAKE_ROOT_CELL_ID && 
-               fidp->volume==AFS_FAKE_ROOT_VOL_ID &&
-               fidp->vnode==0x1 && fidp->unique==0x1);
      if (cm_freelanceEnabled && isRoot) {
          osi_Log0(afsd_logp,"cm_GetSCache Freelance and isRoot");
          /* freelance: if we are trying to get the root scp for the first
--- 691,696 ----
***************
*** 703,708 ****
--- 704,717 ----
          afs_uint32 fileType;
  
          osi_Log0(afsd_logp,"cm_GetSCache Freelance and special");
+ 
+         if (cm_getLocalMountPointChange()) {	// check for changes
+             cm_clearLocalMountPointChange();    // clear the changefile
+ 		    lock_ReleaseWrite(&cm_scacheLock);
+             cm_reInitLocalMountPoints();	// start reinit
+ 			lock_ObtainWrite(&cm_scacheLock);
+         }
+ 
          lock_ObtainMutex(&cm_Freelance_Lock);
          if (fidp->vnode >= 2 && fidp->vnode - 2 < cm_noLocalMountPoints) {
              strncpy(mp,(cm_localMountPoints+fidp->vnode-2)->mountPointStringp, MOUNTPOINTLEN);
***************
*** 717,723 ****
          }
          lock_ReleaseMutex(&cm_Freelance_Lock);
  
!         scp = cm_GetNewSCache();
  	if (scp == NULL) {
  	    osi_Log0(afsd_logp,"cm_GetSCache unable to obtain *new* scache entry");
              lock_ReleaseWrite(&cm_scacheLock);
--- 726,733 ----
          }
          lock_ReleaseMutex(&cm_Freelance_Lock);
  
!         if (scp == NULL)
!             scp = cm_GetNewSCache();
  	if (scp == NULL) {
  	    osi_Log0(afsd_logp,"cm_GetSCache unable to obtain *new* scache entry");
              lock_ReleaseWrite(&cm_scacheLock);
***************
*** 740,748 ****
          scp->dotdotFid.unique=1;
          scp->dotdotFid.vnode=1;
          scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO);
!         scp->nextp=cm_data.scacheHashTablep[hash];
!         cm_data.scacheHashTablep[hash]=scp;
!         scp->flags |= CM_SCACHEFLAG_INHASH;
          scp->refCount = 1;
  	osi_Log1(afsd_logp,"cm_GetSCache (freelance) sets refCount to 1 scp 0x%x", scp);
          scp->fileType = fileType;
--- 750,760 ----
          scp->dotdotFid.unique=1;
          scp->dotdotFid.vnode=1;
          scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO);
!         if (!(scp->flags & CM_SCACHEFLAG_INHASH)) {
!             scp->nextp=cm_data.scacheHashTablep[hash];
!             cm_data.scacheHashTablep[hash]=scp;
!             scp->flags |= CM_SCACHEFLAG_INHASH;
!         }
          scp->refCount = 1;
  	osi_Log1(afsd_logp,"cm_GetSCache (freelance) sets refCount to 1 scp 0x%x", scp);
          scp->fileType = fileType;
***************
*** 834,850 ****
           * to copy the dotdotFipd from the volume structure where the 
           * "master" copy is stored (defect 11489)
           */
!         if (volp->ro.ID == fidp->volume) {
  	    scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO);
              if (scp->fid.vnode == 1 && scp->fid.unique == 1)
!                 scp->dotdotFid = volp->ro.dotdotFid;
!         } else if (volp->bk.ID == fidp->volume) {
  	    scp->flags |= CM_SCACHEFLAG_RO;
              if (scp->fid.vnode == 1 && scp->fid.unique == 1)
!                 scp->dotdotFid = volp->bk.dotdotFid;
          } else {
              if (scp->fid.vnode == 1 && scp->fid.unique == 1)
!                 scp->dotdotFid = volp->rw.dotdotFid;
          }
      }
      if (volp)
--- 846,862 ----
           * to copy the dotdotFipd from the volume structure where the 
           * "master" copy is stored (defect 11489)
           */
!         if (volp->vol[ROVOL].ID == fidp->volume) {
  	    scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO);
              if (scp->fid.vnode == 1 && scp->fid.unique == 1)
!                 scp->dotdotFid = cm_VolumeStateByType(volp, ROVOL)->dotdotFid;
!         } else if (volp->vol[BACKVOL].ID == fidp->volume) {
  	    scp->flags |= CM_SCACHEFLAG_RO;
              if (scp->fid.vnode == 1 && scp->fid.unique == 1)
!                 scp->dotdotFid = cm_VolumeStateByType(volp, BACKVOL)->dotdotFid;
          } else {
              if (scp->fid.vnode == 1 && scp->fid.unique == 1)
!                 scp->dotdotFid = cm_VolumeStateByType(volp, RWVOL)->dotdotFid;
          }
      }
      if (volp)
***************
*** 906,915 ****
  {
      cm_scache_waiter_t * w;
  
-     /* Do not use the queue for asynchronous store operations */
-     if (flags == CM_SCACHESYNC_ASYNCSTORE)
-         return;
- 
      lock_ObtainWrite(&cm_scacheLock);
      if (cm_allFreeWaiters == NULL) {
          w = malloc(sizeof(*w));
--- 918,923 ----
***************
*** 936,945 ****
      cm_scache_waiter_t * w;
      int this_is_me;
  
-     /* Do not use the queue for asynchronous store operations */
-     if (flags == CM_SCACHESYNC_ASYNCSTORE)
-         return 1;
- 
      osi_Log0(afsd_logp, "cm_SyncOpCheckContinue checking for continuation");
  
      lock_ObtainRead(&cm_scacheLock);
--- 944,949 ----
Index: openafs/src/WINNT/afsd/cm_vnodeops.c
diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.72 openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.74
*** openafs/src/WINNT/afsd/cm_vnodeops.c:1.69.2.72	Wed Mar 19 16:18:37 2008
--- openafs/src/WINNT/afsd/cm_vnodeops.c	Mon Apr 14 18:44:04 2008
***************
*** 901,908 ****
          sp->ExactFound = 1;
  
      if (!sp->caseFold || matchName == shortName) {
!         sp->fid.vnode = ntohl(dep->fid.vnode);
!         sp->fid.unique = ntohl(dep->fid.unique);
          return CM_ERROR_STOPNOW;
      }
  
--- 901,907 ----
          sp->ExactFound = 1;
  
      if (!sp->caseFold || matchName == shortName) {
!         cm_SetFid(&sp->fid, sp->fid.cell, sp->fid.volume, ntohl(dep->fid.vnode), ntohl(dep->fid.unique));
          return CM_ERROR_STOPNOW;
      }
  
***************
*** 917,924 ****
      match = strcmp(matchName, sp->searchNamep);
      if (match == 0) {
          sp->ExactFound = 1;
!         sp->fid.vnode = ntohl(dep->fid.vnode);
!         sp->fid.unique = ntohl(dep->fid.unique);
          return CM_ERROR_STOPNOW;
      }
  
--- 916,922 ----
      match = strcmp(matchName, sp->searchNamep);
      if (match == 0) {
          sp->ExactFound = 1;
!         cm_SetFid(&sp->fid, sp->fid.cell, sp->fid.volume, ntohl(dep->fid.vnode), ntohl(dep->fid.unique));
          return CM_ERROR_STOPNOW;
      }
  
***************
*** 944,951 ****
      sp->NCfound = 1;
  
    inexact:
!     sp->fid.vnode = ntohl(dep->fid.vnode);
!     sp->fid.unique = ntohl(dep->fid.unique);
      return 0;
  }       
  
--- 942,948 ----
      sp->NCfound = 1;
  
    inexact:
!     cm_SetFid(&sp->fid, sp->fid.cell, sp->fid.volume, ntohl(dep->fid.vnode), ntohl(dep->fid.unique));
      return 0;
  }       
  
***************
*** 1110,1115 ****
--- 1107,1113 ----
          
      if (code == 0) {
          afs_uint32 cell, volume;
+         cm_vol_state_t *statep;
  
          cell = cellp->cellID;
          
***************
*** 1119,1127 ****
           * instead of the read-write.
           */
          if (cm_followBackupPath && 
!             volp->bk.ID != 0 &&
              (dscp->flags & (CM_SCACHEFLAG_RO|CM_SCACHEFLAG_PURERO)) == CM_SCACHEFLAG_RO &&
!             (targetType == RWVOL || targetType == ROVOL && volp->ro.ID == 0)
              ) {
              targetType = BACKVOL;
          } 
--- 1117,1125 ----
           * instead of the read-write.
           */
          if (cm_followBackupPath && 
!             volp->vol[BACKVOL].ID != 0 &&
              (dscp->flags & (CM_SCACHEFLAG_RO|CM_SCACHEFLAG_PURERO)) == CM_SCACHEFLAG_RO &&
!             (targetType == RWVOL || targetType == ROVOL && volp->vol[ROVOL].ID == 0)
              ) {
              targetType = BACKVOL;
          } 
***************
*** 1132,1156 ****
           */
          else if (mtType == '#' && targetType == RWVOL && 
                   (scp->flags & CM_SCACHEFLAG_PURERO) && 
!                  volp->ro.ID != 0) {
              targetType = ROVOL;
          }
!         if (targetType == ROVOL) {
!             volume = volp->ro.ID;
!             lock_ObtainMutex(&volp->mx);
!             volp->ro.dotdotFid = dscp->fid;
!             lock_ReleaseMutex(&volp->mx);
!         } else if (targetType == BACKVOL) {
!             volume = volp->bk.ID;
!             lock_ObtainMutex(&volp->mx);
!             volp->bk.dotdotFid = dscp->fid;
!             lock_ReleaseMutex(&volp->mx);
!         } else {
!             volume = volp->rw.ID;
!             lock_ObtainMutex(&volp->mx);
!             volp->rw.dotdotFid = dscp->fid;
!             lock_ReleaseMutex(&volp->mx);
!         }
  
          /* the rest of the fid is a magic number */
          cm_SetFid(&scp->mountRootFid, cell, volume, 1, 1);
--- 1130,1144 ----
           */
          else if (mtType == '#' && targetType == RWVOL && 
                   (scp->flags & CM_SCACHEFLAG_PURERO) && 
!                  volp->vol[ROVOL].ID != 0) {
              targetType = ROVOL;
          }
! 
!         lock_ObtainWrite(&volp->rw);
!         statep = cm_VolumeStateByType(volp, targetType);
!         volume = statep->ID;
!         statep->dotdotFid = dscp->fid;
!         lock_ReleaseWrite(&volp->rw);
  
          /* the rest of the fid is a magic number */
          cm_SetFid(&scp->mountRootFid, cell, volume, 1, 1);
***************
*** 1273,1279 ****
          }
          else if (!strchr(namep, '#') && !strchr(namep, '%') &&
                   strcmp(namep, "srvsvc") && strcmp(namep, "wkssvc") &&
!                  strcmp(namep, "ipc$")) {
              /* nonexistent dir on freelance root, so add it */
              char fullname[200] = ".";
              int  found = 0;
--- 1261,1268 ----
          }
          else if (!strchr(namep, '#') && !strchr(namep, '%') &&
                   strcmp(namep, "srvsvc") && strcmp(namep, "wkssvc") &&
!                  strcmp(namep, "ipc$")) 
!         {
              /* nonexistent dir on freelance root, so add it */
              char fullname[200] = ".";
              int  found = 0;
***************
*** 1317,1329 ****
                      return CM_ERROR_NOSUCHFILE;
              }
              tscp = NULL;   /* to force call of cm_GetSCache */
          }
      }
  
    haveFid:       
      if ( !tscp )    /* we did not find it in the dnlc */
      {
!         dnlcHit = 0;	
          code = cm_GetSCache(&rock.fid, &tscp, userp, reqp);
          if (code) 
              return code;
--- 1306,1323 ----
                      return CM_ERROR_NOSUCHFILE;
              }
              tscp = NULL;   /* to force call of cm_GetSCache */
+         } else {
+             if (flags & CM_FLAG_CHECKPATH)
+                 return CM_ERROR_NOSUCHPATH;
+             else
+                 return CM_ERROR_NOSUCHFILE;
          }
      }
  
    haveFid:       
      if ( !tscp )    /* we did not find it in the dnlc */
      {
!         dnlcHit = 0; 
          code = cm_GetSCache(&rock.fid, &tscp, userp, reqp);
          if (code) 
              return code;
***************
*** 1486,1497 ****
          goto _exit_cleanup;
  
      if (volType == BACKVOL)
!         volume = volp->bk.ID;
      else if (volType == ROVOL ||
!              (volType == RWVOL && mountType == ROVOL && volp->ro.ID != 0))
!         volume = volp->ro.ID;
      else
!         volume = volp->rw.ID;
  
      cm_SetFid(&fid, cellp->cellID, volume, 1, 1);
  
--- 1480,1491 ----
          goto _exit_cleanup;
  
      if (volType == BACKVOL)
!         volume = volp->vol[BACKVOL].ID;
      else if (volType == ROVOL ||
!              (volType == RWVOL && mountType == ROVOL && volp->vol[ROVOL].ID != 0))
!         volume = volp->vol[ROVOL].ID;
      else
!         volume = volp->vol[RWVOL].ID;
  
      cm_SetFid(&fid, cellp->cellID, volume, 1, 1);
  
***************
*** 4877,4887 ****
  
      osi_Log1(afsd_logp, "cm_LockMarkSCacheLost scp 0x%x", scp);
  
- #ifdef DEBUG
-     /* With the current code, we can't lose a lock on a RO scp */
-     osi_assertx(!(scp->flags & CM_SCACHEFLAG_RO), "CM_SCACHEFLAG_RO unexpected");
- #endif
- 
      /* cm_scacheLock needed because we are modifying fileLock->flags */
      lock_ObtainWrite(&cm_scacheLock);
  
--- 4871,4876 ----
Index: openafs/src/WINNT/afsd/cm_volume.c
diff -c openafs/src/WINNT/afsd/cm_volume.c:1.14.4.36 openafs/src/WINNT/afsd/cm_volume.c:1.14.4.38
*** openafs/src/WINNT/afsd/cm_volume.c:1.14.4.36	Wed Mar 19 16:18:37 2008
--- openafs/src/WINNT/afsd/cm_volume.c	Fri Apr 18 12:46:07 2008
***************
*** 70,84 ****
      cm_volume_t * volp;
  
      for (volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
! 
!         if (volp->rw.ID)
!             cm_VolumeStatusNotification(volp, volp->rw.ID, volp->rw.state, vl_alldown);
!         if (volp->ro.ID)
!             cm_VolumeStatusNotification(volp, volp->ro.ID, volp->ro.state, vl_alldown);
!         if (volp->bk.ID)
!             cm_VolumeStatusNotification(volp, volp->bk.ID, volp->bk.state, vl_alldown);
          volp->cbExpiresRO = 0;
!         lock_FinalizeMutex(&volp->mx);
      }
  
      return 0;
--- 70,82 ----
      cm_volume_t * volp;
  
      for (volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
!         afs_uint32 volType;
!         for ( volType = RWVOL; volType < NUM_VOL_TYPES; volType++) {
!             if (volp->vol[volType].ID)
!                 cm_VolumeStatusNotification(volp, volp->vol[volType].ID, volp->vol[volType].state, vl_alldown);
!         }
          volp->cbExpiresRO = 0;
!         lock_FinalizeRWLock(&volp->rw);
      }
  
      return 0;
***************
*** 104,123 ****
              cm_volume_t * volp;
  
              for (volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
!                 lock_InitializeMutex(&volp->mx, "cm_volume_t mutex");
                  volp->flags |= CM_VOLUMEFLAG_RESET;
!                 volp->rw.state = vl_unknown;
!                 volp->rw.serversp = NULL;
!                 volp->ro.state = vl_unknown;
!                 volp->ro.serversp = NULL;
!                 volp->bk.state = vl_unknown;
!                 volp->bk.serversp = NULL;
!                 if (volp->rw.ID)
!                     cm_VolumeStatusNotification(volp, volp->rw.ID, vl_alldown, volp->rw.state);
!                 if (volp->ro.ID)
!                     cm_VolumeStatusNotification(volp, volp->ro.ID, vl_alldown, volp->ro.state);
!                 if (volp->bk.ID)
!                     cm_VolumeStatusNotification(volp, volp->bk.ID, vl_alldown, volp->bk.state);
                  volp->cbExpiresRO = 0;
              }
          }
--- 102,117 ----
              cm_volume_t * volp;
  
              for (volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
!                 afs_uint32 volType;
! 
!                 lock_InitializeRWLock(&volp->rw, "cm_volume_t rwlock");
                  volp->flags |= CM_VOLUMEFLAG_RESET;
!                 for (volType = RWVOL; volType < NUM_VOL_TYPES; volType++) {
!                     volp->vol[volType].state = vl_unknown;
!                     volp->vol[volType].serversp = NULL;
!                     if (volp->vol[volType].ID)
!                         cm_VolumeStatusNotification(volp, volp->vol[volType].ID, vl_alldown, volp->vol[volType].state);
!                 }
                  volp->cbExpiresRO = 0;
              }
          }
***************
*** 142,148 ****
  
  
  /*
!  * Update a volume.  Caller holds volume's lock (volp->mx).
   *
   *
   *  shadow / openafs / jhutz@CS.CMU.EDU {ANDREW.CMU.EDU}  01:38    (JHutz)
--- 136,142 ----
  
  
  /*
!  * Update a volume.  Caller holds a write lock on the volume (volp->rw).
   *
   *
   *  shadow / openafs / jhutz@CS.CMU.EDU {ANDREW.CMU.EDU}  01:38    (JHutz)
***************
*** 168,174 ****
   *    RXGEN_OPCODE.
   */
  #define MULTIHOMED 1
! long cm_UpdateVolume(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *reqp,
  		     cm_volume_t *volp)
  {
      cm_conn_t *connp;
--- 162,168 ----
   *    RXGEN_OPCODE.
   */
  #define MULTIHOMED 1
! long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *reqp,
  		     cm_volume_t *volp)
  {
      cm_conn_t *connp;
***************
*** 192,208 ****
  #ifdef AFS_FREELANCE_CLIENT
      int freelance = 0;
  #endif
  
      /* clear out old bindings */
!     if (volp->rw.serversp)
!         cm_FreeServerList(&volp->rw.serversp, CM_FREESERVERLIST_DELETE);
!     if (volp->ro.serversp)
!         cm_FreeServerList(&volp->ro.serversp, CM_FREESERVERLIST_DELETE);
!     if (volp->bk.serversp)
!         cm_FreeServerList(&volp->bk.serversp, CM_FREESERVERLIST_DELETE);
  
  #ifdef AFS_FREELANCE_CLIENT
!     if ( cellp->cellID == AFS_FAKE_ROOT_CELL_ID && volp->rw.ID == AFS_FAKE_ROOT_VOL_ID ) 
      {
  	freelance = 1;
          memset(&vldbEntry, 0, sizeof(vldbEntry));
--- 186,201 ----
  #ifdef AFS_FREELANCE_CLIENT
      int freelance = 0;
  #endif
+     afs_uint32 volType;
  
      /* clear out old bindings */
!     for ( volType = RWVOL; volType < NUM_VOL_TYPES; volType++) {
!         if (volp->vol[volType].serversp)
!             cm_FreeServerList(&volp->vol[volType].serversp, CM_FREESERVERLIST_DELETE);
!     }
  
  #ifdef AFS_FREELANCE_CLIENT
!     if ( cellp->cellID == AFS_FAKE_ROOT_CELL_ID && volp->vol[RWVOL].ID == AFS_FAKE_ROOT_VOL_ID ) 
      {
  	freelance = 1;
          memset(&vldbEntry, 0, sizeof(vldbEntry));
***************
*** 213,218 ****
--- 206,222 ----
      } else
  #endif
      {
+         while (volp->flags & CM_VOLUMEFLAG_UPDATING_VL) {
+             osi_SleepW((LONG_PTR) &volp->flags, &volp->rw);
+             lock_ObtainWrite(&volp->rw);
+ 
+             if (!(volp->flags & CM_VOLUMEFLAG_RESET))
+                 return 0;
+         }
+ 
+         volp->flags |= CM_VOLUMEFLAG_UPDATING_VL;
+         lock_ReleaseWrite(&volp->rw);
+ 
          if (cellp->flags & CM_CELLFLAG_VLSERVER_INVALID)
              cm_UpdateCell(cellp, 0);
  
***************
*** 250,256 ****
       * doesn't exist we will not care about the .backup that might be left behind
       * since there should be no method to access it.  
       */
!     if (code == CM_ERROR_NOSUCHVOLUME && volp->rw.ID == 0 && strlen(volp->namep) < (VL_MAXNAMELEN - 9)) {
          char name[VL_MAXNAMELEN];
  
          snprintf(name, VL_MAXNAMELEN, "%s.readonly", volp->namep);
--- 254,260 ----
       * doesn't exist we will not care about the .backup that might be left behind
       * since there should be no method to access it.  
       */
!     if (code == CM_ERROR_NOSUCHVOLUME && volp->vol[RWVOL].ID == 0 && strlen(volp->namep) < (VL_MAXNAMELEN - 9)) {
          char name[VL_MAXNAMELEN];
  
          snprintf(name, VL_MAXNAMELEN, "%s.readonly", volp->namep);
***************
*** 284,290 ****
  	    osi_Log2(afsd_logp, "CALL VL_GetEntryByName{UNO} name %s:%s SUCCESS", 
  		      volp->cellp->name, osi_LogSaveString(afsd_logp,name));
      }
! 
      if (code == 0) {
          afs_int32 flags;
          afs_int32 nServers;
--- 288,295 ----
  	    osi_Log2(afsd_logp, "CALL VL_GetEntryByName{UNO} name %s:%s SUCCESS", 
  		      volp->cellp->name, osi_LogSaveString(afsd_logp,name));
      }
!     
!     lock_ObtainWrite(&volp->rw);
      if (code == 0) {
          afs_int32 flags;
          afs_int32 nServers;
***************
*** 408,447 ****
          }
  
          if (flags & VLF_RWEXISTS) {
!             if (volp->rw.ID != rwID) {
!                 if (volp->rw.flags & CM_VOLUMEFLAG_IN_HASH)
                      cm_RemoveVolumeFromIDHashTable(volp, RWVOL);
!                 volp->rw.ID = rwID;
                  cm_AddVolumeToIDHashTable(volp, RWVOL);
              }
          } else {
!             if (volp->rw.flags & CM_VOLUMEFLAG_IN_HASH)
                  cm_RemoveVolumeFromIDHashTable(volp, RWVOL);
!             volp->rw.ID = 0;
          }
          if (flags & VLF_ROEXISTS) {
!             if (volp->ro.ID != roID) {
!                 if (volp->ro.flags & CM_VOLUMEFLAG_IN_HASH)
                      cm_RemoveVolumeFromIDHashTable(volp, ROVOL);
!                 volp->ro.ID = roID;
                  cm_AddVolumeToIDHashTable(volp, ROVOL);
              }
          } else {
!             if (volp->ro.flags & CM_VOLUMEFLAG_IN_HASH)
                  cm_RemoveVolumeFromIDHashTable(volp, ROVOL);
!             volp->ro.ID = 0;
          }
          if (flags & VLF_BACKEXISTS) {
!             if (volp->bk.ID != bkID) {
!                 if (volp->bk.flags & CM_VOLUMEFLAG_IN_HASH)
                      cm_RemoveVolumeFromIDHashTable(volp, BACKVOL);
!                 volp->bk.ID = bkID;
                  cm_AddVolumeToIDHashTable(volp, BACKVOL);
              }
          } else {
!             if (volp->bk.flags & CM_VOLUMEFLAG_IN_HASH)
                  cm_RemoveVolumeFromIDHashTable(volp, BACKVOL);
!             volp->bk.ID = 0;
          }
          lock_ReleaseWrite(&cm_volumeLock);
          for (i=0; i<nServers; i++) {
--- 413,452 ----
          }
  
          if (flags & VLF_RWEXISTS) {
!             if (volp->vol[RWVOL].ID != rwID) {
!                 if (volp->vol[RWVOL].flags & CM_VOLUMEFLAG_IN_HASH)
                      cm_RemoveVolumeFromIDHashTable(volp, RWVOL);
!                 volp->vol[RWVOL].ID = rwID;
                  cm_AddVolumeToIDHashTable(volp, RWVOL);
              }
          } else {
!             if (volp->vol[RWVOL].flags & CM_VOLUMEFLAG_IN_HASH)
                  cm_RemoveVolumeFromIDHashTable(volp, RWVOL);
!             volp->vol[RWVOL].ID = 0;
          }
          if (flags & VLF_ROEXISTS) {
!             if (volp->vol[ROVOL].ID != roID) {
!                 if (volp->vol[ROVOL].flags & CM_VOLUMEFLAG_IN_HASH)
                      cm_RemoveVolumeFromIDHashTable(volp, ROVOL);
!                 volp->vol[ROVOL].ID = roID;
                  cm_AddVolumeToIDHashTable(volp, ROVOL);
              }
          } else {
!             if (volp->vol[ROVOL].flags & CM_VOLUMEFLAG_IN_HASH)
                  cm_RemoveVolumeFromIDHashTable(volp, ROVOL);
!             volp->vol[ROVOL].ID = 0;
          }
          if (flags & VLF_BACKEXISTS) {
!             if (volp->vol[BACKVOL].ID != bkID) {
!                 if (volp->vol[BACKVOL].flags & CM_VOLUMEFLAG_IN_HASH)
                      cm_RemoveVolumeFromIDHashTable(volp, BACKVOL);
!                 volp->vol[BACKVOL].ID = bkID;
                  cm_AddVolumeToIDHashTable(volp, BACKVOL);
              }
          } else {
!             if (volp->vol[BACKVOL].flags & CM_VOLUMEFLAG_IN_HASH)
                  cm_RemoveVolumeFromIDHashTable(volp, BACKVOL);
!             volp->vol[BACKVOL].ID = 0;
          }
          lock_ReleaseWrite(&cm_volumeLock);
          for (i=0; i<nServers; i++) {
***************
*** 472,478 ****
               */
              if ((tflags & VLSF_RWVOL) && (flags & VLF_RWEXISTS)) {
                  tsrp = cm_NewServerRef(tsp, rwID);
!                 cm_InsertServerList(&volp->rw.serversp, tsrp);
  
                  lock_ObtainWrite(&cm_serverLock);
                  tsrp->refCount--;       /* drop allocation reference */
--- 477,483 ----
               */
              if ((tflags & VLSF_RWVOL) && (flags & VLF_RWEXISTS)) {
                  tsrp = cm_NewServerRef(tsp, rwID);
!                 cm_InsertServerList(&volp->vol[RWVOL].serversp, tsrp);
  
                  lock_ObtainWrite(&cm_serverLock);
                  tsrp->refCount--;       /* drop allocation reference */
***************
*** 483,489 ****
              }
              if ((tflags & VLSF_ROVOL) && (flags & VLF_ROEXISTS)) {
                  tsrp = cm_NewServerRef(tsp, roID);
!                 cm_InsertServerList(&volp->ro.serversp, tsrp);
                  lock_ObtainWrite(&cm_serverLock);
                  tsrp->refCount--;       /* drop allocation reference */
                  lock_ReleaseWrite(&cm_serverLock);
--- 488,494 ----
              }
              if ((tflags & VLSF_ROVOL) && (flags & VLF_ROEXISTS)) {
                  tsrp = cm_NewServerRef(tsp, roID);
!                 cm_InsertServerList(&volp->vol[ROVOL].serversp, tsrp);
                  lock_ObtainWrite(&cm_serverLock);
                  tsrp->refCount--;       /* drop allocation reference */
                  lock_ReleaseWrite(&cm_serverLock);
***************
*** 499,505 ****
               */
              if ((tflags & VLSF_RWVOL) && (flags & VLF_BACKEXISTS)) {
                  tsrp = cm_NewServerRef(tsp, bkID);
!                 cm_InsertServerList(&volp->bk.serversp, tsrp);
                  lock_ObtainWrite(&cm_serverLock);
                  tsrp->refCount--;       /* drop allocation reference */
                  lock_ReleaseWrite(&cm_serverLock);
--- 504,510 ----
               */
              if ((tflags & VLSF_RWVOL) && (flags & VLF_BACKEXISTS)) {
                  tsrp = cm_NewServerRef(tsp, bkID);
!                 cm_InsertServerList(&volp->vol[BACKVOL].serversp, tsrp);
                  lock_ObtainWrite(&cm_serverLock);
                  tsrp->refCount--;       /* drop allocation reference */
                  lock_ReleaseWrite(&cm_serverLock);
***************
*** 522,528 ****
           * lists are length 1.
           */
          if (ROcount > 1) {
!             cm_RandomizeServer(&volp->ro.serversp);
          }
  
          rwNewstate = rwServers_alldown ? vl_alldown : vl_online;
--- 527,533 ----
           * lists are length 1.
           */
          if (ROcount > 1) {
!             cm_RandomizeServer(&volp->vol[ROVOL].serversp);
          }
  
          rwNewstate = rwServers_alldown ? vl_alldown : vl_online;
***************
*** 532,579 ****
          /* this volume does not exist - we should discard it */
          if (volp->flags & CM_VOLUMEFLAG_IN_HASH)
              cm_RemoveVolumeFromNameHashTable(volp);
!         if (volp->rw.flags & CM_VOLUMEFLAG_IN_HASH)
!             cm_RemoveVolumeFromIDHashTable(volp, RWVOL);
!         if (volp->ro.flags & CM_VOLUMEFLAG_IN_HASH)
!             cm_RemoveVolumeFromIDHashTable(volp, ROVOL);
!         if (volp->bk.flags & CM_VOLUMEFLAG_IN_HASH)
!             cm_RemoveVolumeFromIDHashTable(volp, BACKVOL);
  
          /* Move to the end so it will be recycled first */
          cm_MoveVolumeToLRULast(volp);
  
-         if (volp->rw.ID)
-             cm_VolumeStatusNotification(volp, volp->rw.ID, volp->rw.state, vl_alldown);
-         if (volp->ro.ID)
-             cm_VolumeStatusNotification(volp, volp->ro.ID, volp->ro.state, vl_alldown);
-         if (volp->bk.ID)
-             cm_VolumeStatusNotification(volp, volp->bk.ID, volp->bk.state, vl_alldown);
- 
-         volp->rw.ID = volp->ro.ID = volp->bk.ID = 0;
-         cm_SetFid(&volp->rw.dotdotFid, 0, 0, 0, 0);
-         cm_SetFid(&volp->ro.dotdotFid, 0, 0, 0, 0);
-         cm_SetFid(&volp->bk.dotdotFid, 0, 0, 0, 0);
          volp->namep[0] ='\0';
      } else {
          rwNewstate = roNewstate = bkNewstate = vl_alldown;
      }
  
!     if (volp->rw.state != rwNewstate) {
!         if (volp->rw.ID)
!             cm_VolumeStatusNotification(volp, volp->rw.ID, volp->rw.state, rwNewstate);
!         volp->rw.state = rwNewstate;
!     }
!     if (volp->ro.state != roNewstate) {
!         if (volp->ro.ID)
!             cm_VolumeStatusNotification(volp, volp->ro.ID, volp->ro.state, roNewstate);
!         volp->ro.state = roNewstate;
!     }
!     if (volp->bk.state != bkNewstate) {
!         if (volp->bk.ID)
!             cm_VolumeStatusNotification(volp, volp->bk.ID, volp->bk.state, bkNewstate);
!         volp->bk.state = bkNewstate;
      }
  
      return code;
  }
  
--- 537,579 ----
          /* this volume does not exist - we should discard it */
          if (volp->flags & CM_VOLUMEFLAG_IN_HASH)
              cm_RemoveVolumeFromNameHashTable(volp);
!         for ( volType = RWVOL; volType < NUM_VOL_TYPES; volType++) {
!             if (volp->vol[volType].flags & CM_VOLUMEFLAG_IN_HASH)
!                 cm_RemoveVolumeFromIDHashTable(volp, volType);
!             if (volp->vol[volType].ID) {
!                 cm_VolumeStatusNotification(volp, volp->vol[volType].ID, volp->vol[volType].state, vl_alldown);
!                 volp->vol[volType].ID = 0;
!             }
!             cm_SetFid(&volp->vol[volType].dotdotFid, 0, 0, 0, 0);
!         }
  
          /* Move to the end so it will be recycled first */
          cm_MoveVolumeToLRULast(volp);
  
          volp->namep[0] ='\0';
      } else {
          rwNewstate = roNewstate = bkNewstate = vl_alldown;
      }
  
!     if (volp->vol[RWVOL].state != rwNewstate) {
!         if (volp->vol[RWVOL].ID)
!             cm_VolumeStatusNotification(volp, volp->vol[RWVOL].ID, volp->vol[RWVOL].state, rwNewstate);
!         volp->vol[RWVOL].state = rwNewstate;
!     }
!     if (volp->vol[ROVOL].state != roNewstate) {
!         if (volp->vol[ROVOL].ID)
!             cm_VolumeStatusNotification(volp, volp->vol[ROVOL].ID, volp->vol[ROVOL].state, roNewstate);
!         volp->vol[ROVOL].state = roNewstate;
!     }
!     if (volp->vol[BACKVOL].state != bkNewstate) {
!         if (volp->vol[BACKVOL].ID)
!             cm_VolumeStatusNotification(volp, volp->vol[BACKVOL].ID, volp->vol[BACKVOL].state, bkNewstate);
!         volp->vol[BACKVOL].state = bkNewstate;
      }
  
+     volp->flags &= ~CM_VOLUMEFLAG_UPDATING_VL;
+     osi_Wakeup((LONG_PTR) &volp->flags);
+ 
      return code;
  }
  
***************
*** 594,614 ****
       * search the hash table for all three types until we find it.
       * We will search in the order of RO, RW, BK.
       */
!     for ( volp = cm_data.volumeROIDHashTablep[hash]; volp; volp = volp->ro.nextp) {
!         if ( fidp->cell == volp->cellp->cellID && fidp->volume == volp->ro.ID )
              break;
      }
      if (!volp) {
          /* try RW volumes */
!         for ( volp = cm_data.volumeRWIDHashTablep[hash]; volp; volp = volp->rw.nextp) {
!             if ( fidp->cell == volp->cellp->cellID && fidp->volume == volp->rw.ID )
                  break;
          }
      }
      if (!volp) {
          /* try BK volumes */
!         for ( volp = cm_data.volumeBKIDHashTablep[hash]; volp; volp = volp->bk.nextp) {
!             if ( fidp->cell == volp->cellp->cellID && fidp->volume == volp->bk.ID )
                  break;
          }
      }
--- 594,614 ----
       * search the hash table for all three types until we find it.
       * We will search in the order of RO, RW, BK.
       */
!     for ( volp = cm_data.volumeROIDHashTablep[hash]; volp; volp = volp->vol[ROVOL].nextp) {
!         if ( fidp->cell == volp->cellp->cellID && fidp->volume == volp->vol[ROVOL].ID )
              break;
      }
      if (!volp) {
          /* try RW volumes */
!         for ( volp = cm_data.volumeRWIDHashTablep[hash]; volp; volp = volp->vol[RWVOL].nextp) {
!             if ( fidp->cell == volp->cellp->cellID && fidp->volume == volp->vol[RWVOL].ID )
                  break;
          }
      }
      if (!volp) {
          /* try BK volumes */
!         for ( volp = cm_data.volumeBKIDHashTablep[hash]; volp; volp = volp->vol[BACKVOL].nextp) {
!             if ( fidp->cell == volp->cellp->cellID && fidp->volume == volp->vol[BACKVOL].ID )
                  break;
          }
      }
***************
*** 636,644 ****
  #ifdef SEARCH_ALL_VOLUMES
      for(volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
  	if (cellp == volp->cellp &&
! 	     ((unsigned) volumeID == volp->rw.ID ||
! 	       (unsigned) volumeID == volp->ro.ID ||
! 	       (unsigned) volumeID == volp->bk.ID))
  	    break;
      }	
  
--- 636,644 ----
  #ifdef SEARCH_ALL_VOLUMES
      for(volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
  	if (cellp == volp->cellp &&
! 	     ((unsigned) volumeID == volp->vol[RWVOL].ID ||
! 	       (unsigned) volumeID == volp->vol[ROVOL].ID ||
! 	       (unsigned) volumeID == volp->vol[BACKVOL].ID))
  	    break;
      }	
  
***************
*** 650,670 ****
       * search the hash table for all three types until we find it.
       * We will search in the order of RO, RW, BK.
       */
!     for ( volp = cm_data.volumeROIDHashTablep[hash]; volp; volp = volp->ro.nextp) {
!         if ( cellp == volp->cellp && volumeID == volp->ro.ID )
              break;
      }
      if (!volp) {
          /* try RW volumes */
!         for ( volp = cm_data.volumeRWIDHashTablep[hash]; volp; volp = volp->rw.nextp) {
!             if ( cellp == volp->cellp && volumeID == volp->rw.ID )
                  break;
          }
      }
      if (!volp) {
          /* try BK volumes */
!         for ( volp = cm_data.volumeBKIDHashTablep[hash]; volp; volp = volp->bk.nextp) {
!             if ( cellp == volp->cellp && volumeID == volp->bk.ID )
                  break;
          }
      }
--- 650,670 ----
       * search the hash table for all three types until we find it.
       * We will search in the order of RO, RW, BK.
       */
!     for ( volp = cm_data.volumeROIDHashTablep[hash]; volp; volp = volp->vol[ROVOL].nextp) {
!         if ( cellp == volp->cellp && volumeID == volp->vol[ROVOL].ID )
              break;
      }
      if (!volp) {
          /* try RW volumes */
!         for ( volp = cm_data.volumeRWIDHashTablep[hash]; volp; volp = volp->vol[RWVOL].nextp) {
!             if ( cellp == volp->cellp && volumeID == volp->vol[RWVOL].ID )
                  break;
          }
      }
      if (!volp) {
          /* try BK volumes */
!         for ( volp = cm_data.volumeBKIDHashTablep[hash]; volp; volp = volp->vol[BACKVOL].nextp) {
!             if ( cellp == volp->cellp && volumeID == volp->vol[BACKVOL].ID )
                  break;
          }
      }
***************
*** 681,695 ****
  
      /* return it held */
      if (volp) {
!         lock_ObtainMutex(&volp->mx);
          
          code = 0;
          if ((volp->flags & CM_VOLUMEFLAG_RESET) && !(flags & CM_GETVOL_FLAG_NO_RESET)) {
!             code = cm_UpdateVolume(cellp, userp, reqp, volp);
              if (code == 0)
                  volp->flags &= ~CM_VOLUMEFLAG_RESET;
          }
!         lock_ReleaseMutex(&volp->mx);
          if (code == 0) {
              *outVolpp = volp;
  
--- 681,695 ----
  
      /* return it held */
      if (volp) {
!         lock_ObtainWrite(&volp->rw);
          
          code = 0;
          if ((volp->flags & CM_VOLUMEFLAG_RESET) && !(flags & CM_GETVOL_FLAG_NO_RESET)) {
!             code = cm_UpdateVolumeLocation(cellp, userp, reqp, volp);
              if (code == 0)
                  volp->flags &= ~CM_VOLUMEFLAG_RESET;
          }
!         lock_ReleaseWrite(&volp->rw);
          if (code == 0) {
              *outVolpp = volp;
  
***************
*** 698,706 ****
                  cm_AdjustVolumeLRU(volp);
                  lock_ReleaseWrite(&cm_volumeLock);
              }
!         } else
              cm_PutVolume(volp);
! 
          return code;
      }
          
--- 698,708 ----
                  cm_AdjustVolumeLRU(volp);
                  lock_ReleaseWrite(&cm_volumeLock);
              }
!         } else {
!             lock_ObtainRead(&cm_volumeLock);
              cm_PutVolume(volp);
!             lock_ReleaseRead(&cm_volumeLock);
!         }
          return code;
      }
          
***************
*** 761,770 ****
  #endif
  
      if (!volp && (flags & CM_GETVOL_FLAG_CREATE)) {
          /* otherwise, get from VLDB */
  
  	if ( cm_data.currentVolumes >= cm_data.maxVolumes ) {
- 
  #ifdef RECYCLE_FROM_ALL_VOLUMES_LIST
  	    for (volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
  		if ( volp->refCount == 0 ) {
--- 763,772 ----
  #endif
  
      if (!volp && (flags & CM_GETVOL_FLAG_CREATE)) {
+         afs_uint32 volType;
          /* otherwise, get from VLDB */
  
  	if ( cm_data.currentVolumes >= cm_data.maxVolumes ) {
  #ifdef RECYCLE_FROM_ALL_VOLUMES_LIST
  	    for (volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
  		if ( volp->refCount == 0 ) {
***************
*** 787,793 ****
  		osi_panic("Exceeded Max Volumes", __FILE__, __LINE__);
  
              lock_ReleaseRead(&cm_volumeLock);
!             lock_ObtainMutex(&volp->mx);
              lock_ObtainWrite(&cm_volumeLock);
  
              osi_Log2(afsd_logp, "Recycling Volume %s:%s",
--- 789,795 ----
  		osi_panic("Exceeded Max Volumes", __FILE__, __LINE__);
  
              lock_ReleaseRead(&cm_volumeLock);
!             lock_ObtainWrite(&volp->rw);
              lock_ObtainWrite(&cm_volumeLock);
  
              osi_Log2(afsd_logp, "Recycling Volume %s:%s",
***************
*** 797,829 ****
                  cm_RemoveVolumeFromLRU(volp);
              if (volp->flags & CM_VOLUMEFLAG_IN_HASH)
                  cm_RemoveVolumeFromNameHashTable(volp);
-             if (volp->rw.flags & CM_VOLUMEFLAG_IN_HASH)
-                 cm_RemoveVolumeFromIDHashTable(volp, RWVOL);
-             if (volp->ro.flags & CM_VOLUMEFLAG_IN_HASH)
-                 cm_RemoveVolumeFromIDHashTable(volp, ROVOL);
-             if (volp->bk.flags & CM_VOLUMEFLAG_IN_HASH)
-                 cm_RemoveVolumeFromIDHashTable(volp, BACKVOL);
  
!             if (volp->rw.ID)
!                 cm_VolumeStatusNotification(volp, volp->rw.ID, volp->rw.state, vl_unknown);
!             if (volp->ro.ID)
!                 cm_VolumeStatusNotification(volp, volp->ro.ID, volp->ro.state, vl_unknown);
!             if (volp->bk.ID)
!                 cm_VolumeStatusNotification(volp, volp->bk.ID, volp->bk.state, vl_unknown);
! 
!             volp->rw.ID = volp->ro.ID = volp->bk.ID = 0;
!             cm_SetFid(&volp->rw.dotdotFid, 0, 0, 0, 0);
!             cm_SetFid(&volp->ro.dotdotFid, 0, 0, 0, 0);
!             cm_SetFid(&volp->bk.dotdotFid, 0, 0, 0, 0);
  	} else {
  	    volp = &cm_data.volumeBaseAddress[cm_data.currentVolumes++];
  	    memset(volp, 0, sizeof(cm_volume_t));
  	    volp->magic = CM_VOLUME_MAGIC;
  	    volp->allNextp = cm_data.allVolumesp;
  	    cm_data.allVolumesp = volp;
! 	    lock_InitializeMutex(&volp->mx, "cm_volume_t mutex");
              lock_ReleaseRead(&cm_volumeLock);
!             lock_ObtainMutex(&volp->mx);
              lock_ObtainWrite(&cm_volumeLock);
          }
  	volp->cellp = cellp;
--- 799,822 ----
                  cm_RemoveVolumeFromLRU(volp);
              if (volp->flags & CM_VOLUMEFLAG_IN_HASH)
                  cm_RemoveVolumeFromNameHashTable(volp);
  
!             for ( volType = RWVOL; volType < NUM_VOL_TYPES; volType++) {
!                 if (volp->vol[volType].flags & CM_VOLUMEFLAG_IN_HASH)
!                     cm_RemoveVolumeFromIDHashTable(volp, volType);
!                 if (volp->vol[volType].ID)
!                     cm_VolumeStatusNotification(volp, volp->vol[volType].ID, volp->vol[volType].state, vl_unknown);
!                 volp->vol[volType].ID = 0;
!                 cm_SetFid(&volp->vol[volType].dotdotFid, 0, 0, 0, 0);
!             }
  	} else {
  	    volp = &cm_data.volumeBaseAddress[cm_data.currentVolumes++];
  	    memset(volp, 0, sizeof(cm_volume_t));
  	    volp->magic = CM_VOLUME_MAGIC;
  	    volp->allNextp = cm_data.allVolumesp;
  	    cm_data.allVolumesp = volp;
! 	    lock_InitializeRWLock(&volp->rw, "cm_volume_t rwlock");
              lock_ReleaseRead(&cm_volumeLock);
!             lock_ObtainWrite(&volp->rw);
              lock_ObtainWrite(&cm_volumeLock);
          }
  	volp->cellp = cellp;
***************
*** 831,839 ****
  	volp->namep[VL_MAXNAMELEN-1] = '\0';
          volp->refCount = 1;	/* starts off held */
  	volp->flags = CM_VOLUMEFLAG_RESET;
!         volp->rw.state = volp->ro.state = volp->bk.state = vl_unknown;
!         volp->rw.nextp = volp->ro.nextp = volp->bk.nextp = NULL;
!         volp->rw.flags = volp->ro.flags = volp->bk.flags = 0;
          volp->cbExpiresRO = 0;
          cm_AddVolumeToNameHashTable(volp);
          lock_ReleaseWrite(&cm_volumeLock);
--- 824,835 ----
  	volp->namep[VL_MAXNAMELEN-1] = '\0';
          volp->refCount = 1;	/* starts off held */
  	volp->flags = CM_VOLUMEFLAG_RESET;
!     
!         for ( volType = RWVOL; volType < NUM_VOL_TYPES; volType++) {
!             volp->vol[volType].state = vl_unknown;
!             volp->vol[volType].nextp = NULL;
!             volp->vol[volType].flags = 0;
!         }
          volp->cbExpiresRO = 0;
          cm_AddVolumeToNameHashTable(volp);
          lock_ReleaseWrite(&cm_volumeLock);
***************
*** 846,864 ****
          if (!volp)
              return CM_ERROR_NOSUCHVOLUME;
  
!         lock_ObtainMutex(&volp->mx);
      }
  
      /* if we get here we are holding the mutex */
      if ((volp->flags & CM_VOLUMEFLAG_RESET) && !(flags & CM_GETVOL_FLAG_NO_RESET)) {
!         code = cm_UpdateVolume(cellp, userp, reqp, volp);
          if (code == 0)
              volp->flags &= ~CM_VOLUMEFLAG_RESET;
      }	
!     lock_ReleaseMutex(&volp->mx);
  
!     if (code == 0 && (type == BACKVOL && volp->bk.ID == 0 ||
!                       type == ROVOL && volp->ro.ID == 0))
          code = CM_ERROR_NOSUCHVOLUME;
  
      if (code == 0) {
--- 842,860 ----
          if (!volp)
              return CM_ERROR_NOSUCHVOLUME;
  
!         lock_ObtainWrite(&volp->rw);
      }
  
      /* if we get here we are holding the mutex */
      if ((volp->flags & CM_VOLUMEFLAG_RESET) && !(flags & CM_GETVOL_FLAG_NO_RESET)) {
!         code = cm_UpdateVolumeLocation(cellp, userp, reqp, volp);
          if (code == 0)
              volp->flags &= ~CM_VOLUMEFLAG_RESET;
      }	
!     lock_ReleaseWrite(&volp->rw);
  
!     if (code == 0 && (type == BACKVOL && volp->vol[BACKVOL].ID == 0 ||
!                       type == ROVOL && volp->vol[ROVOL].ID == 0))
          code = CM_ERROR_NOSUCHVOLUME;
  
      if (code == 0) {
***************
*** 869,877 ****
              cm_AdjustVolumeLRU(volp);
              lock_ReleaseWrite(&cm_volumeLock);
          }
!     } else
          cm_PutVolume(volp);
! 
      return code;
  }	
  
--- 865,875 ----
              cm_AdjustVolumeLRU(volp);
              lock_ReleaseWrite(&cm_volumeLock);
          }
!     } else {
!         lock_ObtainRead(&cm_volumeLock);
          cm_PutVolume(volp);
!         lock_ReleaseRead(&cm_volumeLock);
!     }
      return code;
  }	
  
***************
*** 894,902 ****
  #ifdef SEARCH_ALL_VOLUMES
      for(volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
  	if (cellp == volp->cellp &&
! 	     (fidp->volume == volp->rw.ID ||
! 	       fidp->volume == volp->ro.ID ||
! 	       fidp->volume == volp->bk.ID))
  	    break;
      }	
  #endif /* SEARCH_ALL_VOLUMES */
--- 892,900 ----
  #ifdef SEARCH_ALL_VOLUMES
      for(volp = cm_data.allVolumesp; volp; volp=volp->allNextp) {
  	if (cellp == volp->cellp &&
! 	     (fidp->volume == volp->vol[RWVOL].ID ||
! 	       fidp->volume == volp->vol[ROVOL].ID ||
! 	       fidp->volume == volp->vol[BACKVOL].ID))
  	    break;
      }	
  #endif /* SEARCH_ALL_VOLUMES */
***************
*** 906,926 ****
       * search the hash table for all three types until we find it.
       * We will search in the order of RO, RW, BK.
       */
!     for ( volp = cm_data.volumeROIDHashTablep[hash]; volp; volp = volp->ro.nextp) {
!         if ( cellp == volp->cellp && fidp->volume == volp->ro.ID )
              break;
      }
      if (!volp) {
          /* try RW volumes */
!         for ( volp = cm_data.volumeRWIDHashTablep[hash]; volp; volp = volp->rw.nextp) {
!             if ( cellp == volp->cellp && fidp->volume == volp->rw.ID )
                  break;
          }
      }
      if (!volp) {
          /* try BK volumes */
!         for ( volp = cm_data.volumeBKIDHashTablep[hash]; volp; volp = volp->bk.nextp) {
!             if ( cellp == volp->cellp && fidp->volume == volp->bk.ID )
                  break;
          }
      }
--- 904,924 ----
       * search the hash table for all three types until we find it.
       * We will search in the order of RO, RW, BK.
       */
!     for ( volp = cm_data.volumeROIDHashTablep[hash]; volp; volp = volp->vol[ROVOL].nextp) {
!         if ( cellp == volp->cellp && fidp->volume == volp->vol[ROVOL].ID )
              break;
      }
      if (!volp) {
          /* try RW volumes */
!         for ( volp = cm_data.volumeRWIDHashTablep[hash]; volp; volp = volp->vol[RWVOL].nextp) {
!             if ( cellp == volp->cellp && fidp->volume == volp->vol[RWVOL].ID )
                  break;
          }
      }
      if (!volp) {
          /* try BK volumes */
!         for ( volp = cm_data.volumeBKIDHashTablep[hash]; volp; volp = volp->vol[BACKVOL].nextp) {
!             if ( cellp == volp->cellp && fidp->volume == volp->vol[BACKVOL].ID )
                  break;
          }
      }
***************
*** 934,942 ****
  
      lock_ReleaseRead(&cm_volumeLock);
  
      /* update it */
      cm_data.mountRootGen = time(NULL);
!     lock_ObtainMutex(&volp->mx);
      volp->flags |= CM_VOLUMEFLAG_RESET;
  #ifdef COMMENT
      /* Mark the volume to be updated but don't update it now.
--- 932,943 ----
  
      lock_ReleaseRead(&cm_volumeLock);
  
+     if (!volp)
+         return;
+ 
      /* update it */
      cm_data.mountRootGen = time(NULL);
!     lock_ObtainWrite(&volp->rw);
      volp->flags |= CM_VOLUMEFLAG_RESET;
  #ifdef COMMENT
      /* Mark the volume to be updated but don't update it now.
***************
*** 949,961 ****
       * accessed by Name or ID the UpdateVolume call will
       * occur.
       */
!     code = cm_UpdateVolume(cellp, userp, reqp, volp);
      if (code == 0)
  	volp->flags &= ~CM_VOLUMEFLAG_RESET;
  #endif
!     lock_ReleaseMutex(&volp->mx);
  
      cm_PutVolume(volp);
  }
  
  /* find the appropriate servers from a volume */
--- 950,964 ----
       * accessed by Name or ID the UpdateVolume call will
       * occur.
       */
!     code = cm_UpdateVolumeLocation(cellp, userp, reqp, volp);
      if (code == 0)
  	volp->flags &= ~CM_VOLUMEFLAG_RESET;
  #endif
!     lock_ReleaseWrite(&volp->rw);
  
+     lock_ObtainRead(&cm_volumeLock);
      cm_PutVolume(volp);
+     lock_ReleaseRead(&cm_volumeLock);
  }
  
  /* find the appropriate servers from a volume */
***************
*** 966,977 ****
  
      lock_ObtainWrite(&cm_serverLock);
  
!     if (volume == volp->rw.ID)
!         serverspp = &volp->rw.serversp;
!     else if (volume == volp->ro.ID)
!         serverspp = &volp->ro.serversp;
!     else if (volume == volp->bk.ID)
!         serverspp = &volp->bk.serversp;
      else 
          osi_panic("bad volume ID in cm_GetVolServers", __FILE__, __LINE__);
          
--- 969,980 ----
  
      lock_ObtainWrite(&cm_serverLock);
  
!     if (volume == volp->vol[RWVOL].ID)
!         serverspp = &volp->vol[RWVOL].serversp;
!     else if (volume == volp->vol[ROVOL].ID)
!         serverspp = &volp->vol[ROVOL].serversp;
!     else if (volume == volp->vol[BACKVOL].ID)
!         serverspp = &volp->vol[BACKVOL].serversp;
      else 
          osi_panic("bad volume ID in cm_GetVolServers", __FILE__, __LINE__);
          
***************
*** 996,1007 ****
  {
      long id;
  
!     lock_ObtainMutex(&volp->mx);
!     if (volp->ro.ID && volp->ro.serversp)
! 	id = volp->ro.ID;
      else
! 	id = volp->rw.ID;
!     lock_ReleaseMutex(&volp->mx);
  
      return id;
  }
--- 999,1010 ----
  {
      long id;
  
!     lock_ObtainRead(&volp->rw);
!     if (volp->vol[ROVOL].ID && volp->vol[ROVOL].serversp)
! 	id = volp->vol[ROVOL].ID;
      else
! 	id = volp->vol[RWVOL].ID;
!     lock_ReleaseRead(&volp->rw);
  
      return id;
  }
***************
*** 1020,1028 ****
  	InterlockedIncrement(&volp->refCount);
  	lock_ReleaseRead(&cm_volumeLock);
  
! 	lock_ObtainMutex(&volp->mx);
  	volp->flags |= CM_VOLUMEFLAG_RESET;
! 	lock_ReleaseMutex(&volp->mx);
  	
          lock_ObtainRead(&cm_volumeLock);
          refCount = InterlockedDecrement(&volp->refCount);
--- 1023,1031 ----
  	InterlockedIncrement(&volp->refCount);
  	lock_ReleaseRead(&cm_volumeLock);
  
! 	lock_ObtainWrite(&volp->rw);
  	volp->flags |= CM_VOLUMEFLAG_RESET;
! 	lock_ReleaseWrite(&volp->rw);
  	
          lock_ObtainRead(&cm_volumeLock);
          refCount = InterlockedDecrement(&volp->refCount);
***************
*** 1075,1198 ****
      OfflineMsg = offLineMsg;
      MOTD = motd;
  
!     lock_ObtainMutex(&volp->mx);
  
      if (volp->flags & CM_VOLUMEFLAG_RESET) {
          cm_InitReq(&req);
!         code = cm_UpdateVolume(volp->cellp, cm_rootUserp, &req, volp);
          if (code == 0)
              volp->flags &= ~CM_VOLUMEFLAG_RESET;
      }
  
!     if (volp->rw.ID != 0 && (!volID || volID == volp->rw.ID) &&
! 		volp->rw.serversp &&
!          (volp->rw.state == vl_busy || volp->rw.state == vl_offline || volp->rw.state == vl_unknown)) {
!         cm_InitReq(&req);
! 
!         for (serversp = volp->rw.serversp; serversp; serversp = serversp->next) {
!             if (serversp->status == srv_busy || serversp->status == srv_offline)
                  serversp->status = srv_not_busy;
          }
  
!         lock_ReleaseMutex(&volp->mx);
!         do {
!             code = cm_ConnFromVolume(volp, volp->rw.ID, cm_rootUserp, &req, &connp);
!             if (code) 
!                 continue;
  
!             callp = cm_GetRxConn(connp);
!             code = RXAFS_GetVolumeStatus(callp, volp->rw.ID,
!                                           &volStat, &Name, &OfflineMsg, &MOTD);
!             rx_PutConnection(callp);        
! 
!         } while (cm_Analyze(connp, cm_rootUserp, &req, NULL, NULL, NULL, NULL, code));
!         code = cm_MapRPCError(code, &req);
! 
!         lock_ObtainMutex(&volp->mx);
!         if (code == 0 && volStat.Online) {
!             cm_VolumeStatusNotification(volp, volp->rw.ID, volp->rw.state, vl_online);
!             volp->rw.state = vl_online;
!             online = 1;
!         } else if (code == CM_ERROR_NOACCESS) {
!             cm_VolumeStatusNotification(volp, volp->rw.ID, volp->rw.state, vl_unknown);
!             volp->rw.state = vl_unknown;
!             online = 1;
          }
      }
  
!     if (volp->ro.ID != 0 && (!volID || volID == volp->ro.ID) &&
! 		volp->ro.serversp &&
!          (volp->ro.state == vl_busy || volp->ro.state == vl_offline || volp->ro.state == vl_unknown)) {
!         cm_InitReq(&req);
  
!         for (serversp = volp->ro.serversp; serversp; serversp = serversp->next) {
!             if (serversp->status == srv_busy || serversp->status == srv_offline)
                  serversp->status = srv_not_busy;
          }
  
!         lock_ReleaseMutex(&volp->mx);
!         do {
!             code = cm_ConnFromVolume(volp, volp->ro.ID, cm_rootUserp, &req, &connp);
!             if (code) 
!                 continue;
  
!             callp = cm_GetRxConn(connp);
!             code = RXAFS_GetVolumeStatus(callp, volp->ro.ID,
!                                           &volStat, &Name, &OfflineMsg, &MOTD);
!             rx_PutConnection(callp);        
! 
!         } while (cm_Analyze(connp, cm_rootUserp, &req, NULL, NULL, NULL, NULL, code));
!         code = cm_MapRPCError(code, &req);
! 
!         lock_ObtainMutex(&volp->mx);
!         if (code == 0 && volStat.Online) {
!             cm_VolumeStatusNotification(volp, volp->ro.ID, volp->ro.state, vl_online);
!             volp->ro.state = vl_online;
!             online = 1;
!         } else if (code == CM_ERROR_NOACCESS) {
!             cm_VolumeStatusNotification(volp, volp->ro.ID, volp->ro.state, vl_unknown);
!             volp->ro.state = vl_unknown;
!             online = 1;
          }
      }
  
!     if (volp->bk.ID != 0 && (!volID || volID == volp->bk.ID) &&
! 		volp->bk.serversp &&
!          (volp->bk.state == vl_busy || volp->bk.state == vl_offline || volp->bk.state == vl_unknown)) {
!         cm_InitReq(&req);
! 
!         for (serversp = volp->bk.serversp; serversp; serversp = serversp->next) {
!             if (serversp->status == srv_busy || serversp->status == srv_offline)
                  serversp->status = srv_not_busy;
          }
  
!         lock_ReleaseMutex(&volp->mx);
!         do {
!             code = cm_ConnFromVolume(volp, volp->bk.ID, cm_rootUserp, &req, &connp);
!             if (code) 
!                 continue;
  
!             callp = cm_GetRxConn(connp);
!             code = RXAFS_GetVolumeStatus(callp, volp->bk.ID,
!                                           &volStat, &Name, &OfflineMsg, &MOTD);
!             rx_PutConnection(callp);        
! 
!         } while (cm_Analyze(connp, cm_rootUserp, &req, NULL, NULL, NULL, NULL, code));
!         code = cm_MapRPCError(code, &req);
! 
!         lock_ObtainMutex(&volp->mx);
!         if (code == 0 && volStat.Online) {
!             cm_VolumeStatusNotification(volp, volp->bk.ID, volp->bk.state, vl_online);
!             volp->bk.state = vl_online;
!             online = 1;
!         } else if (code == CM_ERROR_NOACCESS) {
!             cm_VolumeStatusNotification(volp, volp->bk.ID, volp->bk.state, vl_unknown);
!             volp->bk.state = vl_unknown;
!             online = 1;
          }
      }
  
!     lock_ReleaseMutex(&volp->mx);
      return online;
  }
  
--- 1078,1213 ----
      OfflineMsg = offLineMsg;
      MOTD = motd;
  
!     lock_ObtainWrite(&volp->rw);
  
      if (volp->flags & CM_VOLUMEFLAG_RESET) {
          cm_InitReq(&req);
!         code = cm_UpdateVolumeLocation(volp->cellp, cm_rootUserp, &req, volp);
          if (code == 0)
              volp->flags &= ~CM_VOLUMEFLAG_RESET;
      }
  
!     if (volp->vol[RWVOL].ID != 0 && (!volID || volID == volp->vol[RWVOL].ID) &&
!          volp->vol[RWVOL].serversp) {
!        
!         for (serversp = volp->vol[RWVOL].serversp; serversp; serversp = serversp->next) {
!             if (serversp->status == srv_busy || serversp->status == srv_offline) {
                  serversp->status = srv_not_busy;
+                 online = 1;
+             }
          }
  
!         if (volp->vol[RWVOL].state == vl_busy || volp->vol[RWVOL].state == vl_offline || volp->vol[RWVOL].state == vl_unknown) {
!             cm_InitReq(&req);
  
!             lock_ReleaseWrite(&volp->rw);
!             do {
!                 code = cm_ConnFromVolume(volp, volp->vol[RWVOL].ID, cm_rootUserp, &req, &connp);
!                 if (code) 
!                     continue;
! 
!                 callp = cm_GetRxConn(connp);
!                 code = RXAFS_GetVolumeStatus(callp, volp->vol[RWVOL].ID,
!                                              &volStat, &Name, &OfflineMsg, &MOTD);
!                 rx_PutConnection(callp);            
! 
!             } while (cm_Analyze(connp, cm_rootUserp, &req, NULL, NULL, NULL, NULL, code));
!             code = cm_MapRPCError(code, &req);
! 
!             lock_ObtainWrite(&volp->rw);
!             if (code == 0 && volStat.Online) {
!                 cm_VolumeStatusNotification(volp, volp->vol[RWVOL].ID, volp->vol[RWVOL].state, vl_online);
!                 volp->vol[RWVOL].state = vl_online;
!                 online = 1;
!             } else if (code == CM_ERROR_NOACCESS) {
!                 cm_VolumeStatusNotification(volp, volp->vol[RWVOL].ID, volp->vol[RWVOL].state, vl_unknown);
!                 volp->vol[RWVOL].state = vl_unknown;
!                 online = 1;
!             }
          }
      }
  
!     if (volp->vol[ROVOL].ID != 0 && (!volID || volID == volp->vol[ROVOL].ID) &&
!          volp->vol[ROVOL].serversp) {
  
!         for (serversp = volp->vol[ROVOL].serversp; serversp; serversp = serversp->next) {
!             if (serversp->status == srv_busy || serversp->status == srv_offline) {
                  serversp->status = srv_not_busy;
+                 online = 1;
+             }
          }
  
!         if (volp->vol[ROVOL].state == vl_busy || volp->vol[ROVOL].state == vl_offline || volp->vol[ROVOL].state == vl_unknown) {
!             cm_InitReq(&req);
  
!             lock_ReleaseWrite(&volp->rw);
!             do {
!                 code = cm_ConnFromVolume(volp, volp->vol[ROVOL].ID, cm_rootUserp, &req, &connp);
!                 if (code) 
!                     continue;
! 
!                 callp = cm_GetRxConn(connp);
!                 code = RXAFS_GetVolumeStatus(callp, volp->vol[ROVOL].ID,
!                                               &volStat, &Name, &OfflineMsg, &MOTD);
!                 rx_PutConnection(callp);        
! 
!             } while (cm_Analyze(connp, cm_rootUserp, &req, NULL, NULL, NULL, NULL, code));
!             code = cm_MapRPCError(code, &req);
! 
!             lock_ObtainWrite(&volp->rw);
!             if (code == 0 && volStat.Online) {
!                 cm_VolumeStatusNotification(volp, volp->vol[ROVOL].ID, volp->vol[ROVOL].state, vl_online);
!                 volp->vol[ROVOL].state = vl_online;
!                 online = 1;
!             } else if (code == CM_ERROR_NOACCESS) {
!                 cm_VolumeStatusNotification(volp, volp->vol[ROVOL].ID, volp->vol[ROVOL].state, vl_unknown);
!                 volp->vol[ROVOL].state = vl_unknown;
!                 online = 1;
!             }
          }
      }
  
!     if (volp->vol[BACKVOL].ID != 0 && (!volID || volID == volp->vol[BACKVOL].ID) &&
!          volp->vol[BACKVOL].serversp) {
!         
!         for (serversp = volp->vol[BACKVOL].serversp; serversp; serversp = serversp->next) {
!             if (serversp->status == srv_busy || serversp->status == srv_offline) {
                  serversp->status = srv_not_busy;
+                 online = 1;
+             }
          }
  
!         if (volp->vol[BACKVOL].state == vl_busy || volp->vol[BACKVOL].state == vl_offline || volp->vol[BACKVOL].state == vl_unknown) {
!             cm_InitReq(&req);
  
!             lock_ReleaseWrite(&volp->rw);
!             do {
!                 code = cm_ConnFromVolume(volp, volp->vol[BACKVOL].ID, cm_rootUserp, &req, &connp);
!                 if (code) 
!                     continue;
! 
!                 callp = cm_GetRxConn(connp);
!                 code = RXAFS_GetVolumeStatus(callp, volp->vol[BACKVOL].ID,
!                                               &volStat, &Name, &OfflineMsg, &MOTD);
!                 rx_PutConnection(callp);        
! 
!             } while (cm_Analyze(connp, cm_rootUserp, &req, NULL, NULL, NULL, NULL, code));
!             code = cm_MapRPCError(code, &req);
! 
!             lock_ObtainWrite(&volp->rw);
!             if (code == 0 && volStat.Online) {
!                 cm_VolumeStatusNotification(volp, volp->vol[BACKVOL].ID, volp->vol[BACKVOL].state, vl_online);
!                 volp->vol[BACKVOL].state = vl_online;
!                 online = 1;
!             } else if (code == CM_ERROR_NOACCESS) {
!                 cm_VolumeStatusNotification(volp, volp->vol[BACKVOL].ID, volp->vol[BACKVOL].state, vl_unknown);
!                 volp->vol[BACKVOL].state = vl_unknown;
!                 online = 1;
!             }
          }
      }
  
!     lock_ReleaseWrite(&volp->rw);
      return online;
  }
  
***************
*** 1273,1284 ****
  cm_UpdateVolumeStatus(cm_volume_t *volp, afs_uint32 volID)
  {
  
!     if (volp->rw.ID == volID) {
!         cm_UpdateVolumeStatusInt(volp, &volp->rw);
!     } else if (volp->ro.ID == volID) {
!         cm_UpdateVolumeStatusInt(volp, &volp->ro);
!     } else if (volp->bk.ID == volID) {
!         cm_UpdateVolumeStatusInt(volp, &volp->bk);
      } else {
          /*
           * If we are called with volID == 0 then something has gone wrong.
--- 1288,1299 ----
  cm_UpdateVolumeStatus(cm_volume_t *volp, afs_uint32 volID)
  {
  
!     if (volp->vol[RWVOL].ID == volID) {
!         cm_UpdateVolumeStatusInt(volp, &volp->vol[RWVOL]);
!     } else if (volp->vol[ROVOL].ID == volID) {
!         cm_UpdateVolumeStatusInt(volp, &volp->vol[ROVOL]);
!     } else if (volp->vol[BACKVOL].ID == volID) {
!         cm_UpdateVolumeStatusInt(volp, &volp->vol[BACKVOL]);
      } else {
          /*
           * If we are called with volID == 0 then something has gone wrong.
***************
*** 1287,1298 ****
           * just update all of them that are known to exist.  Better to be 
           * correct than fast.
           */
!         if (volp->rw.ID != 0)
!             cm_UpdateVolumeStatusInt(volp, &volp->rw);
!         if (volp->ro.ID != 0)
!             cm_UpdateVolumeStatusInt(volp, &volp->ro);
!         if (volp->bk.ID != 0)
!             cm_UpdateVolumeStatusInt(volp, &volp->bk);
      }
  }
  
--- 1302,1312 ----
           * just update all of them that are known to exist.  Better to be 
           * correct than fast.
           */
!         afs_uint32 volType;
!         for ( volType = RWVOL; volType < NUM_VOL_TYPES; volType++) {
!             if (volp->vol[volType].ID != 0)
!                 cm_UpdateVolumeStatusInt(volp, &volp->vol[volType]);
!         }
      }
  }
  
***************
*** 1313,1328 ****
  	code = 1 ;	/* assume that list is unchanged */
  	InterlockedIncrement(&volp->refCount);
  	lock_ReleaseRead(&cm_volumeLock);
! 	lock_ObtainMutex(&volp->mx);
  
! 	if ((tsp->cellp==volp->cellp) && (volp->ro.serversp))
! 	    code =cm_ChangeRankServer(&volp->ro.serversp, tsp);
  
  	/* this volume list was changed */
  	if ( !code )
! 	    cm_RandomizeServer(&volp->ro.serversp);
  
! 	lock_ReleaseMutex(&volp->mx);
  	lock_ObtainRead(&cm_volumeLock);
          refCount = InterlockedDecrement(&volp->refCount);
  	osi_assertx(refCount >= 0, "cm_volume_t refCount underflow");
--- 1327,1342 ----
  	code = 1 ;	/* assume that list is unchanged */
  	InterlockedIncrement(&volp->refCount);
  	lock_ReleaseRead(&cm_volumeLock);
! 	lock_ObtainWrite(&volp->rw);
  
! 	if ((tsp->cellp==volp->cellp) && (volp->vol[ROVOL].serversp))
! 	    code =cm_ChangeRankServer(&volp->vol[ROVOL].serversp, tsp);
  
  	/* this volume list was changed */
  	if ( !code )
! 	    cm_RandomizeServer(&volp->vol[ROVOL].serversp);
  
! 	lock_ReleaseWrite(&volp->rw);
  	lock_ObtainRead(&cm_volumeLock);
          refCount = InterlockedDecrement(&volp->refCount);
  	osi_assertx(refCount >= 0, "cm_volume_t refCount underflow");
***************
*** 1351,1357 ****
      for (volp = cm_data.allVolumesp; volp; volp=volp->allNextp)
      {
          sprintf(output, "%s - volp=0x%p cell=%s name=%s rwID=%u roID=%u bkID=%u flags=0x%x refCount=%u\r\n", 
!                  cookie, volp, volp->cellp->name, volp->namep, volp->rw.ID, volp->ro.ID, volp->bk.ID, volp->flags, 
                   volp->refCount);
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
--- 1365,1371 ----
      for (volp = cm_data.allVolumesp; volp; volp=volp->allNextp)
      {
          sprintf(output, "%s - volp=0x%p cell=%s name=%s rwID=%u roID=%u bkID=%u flags=0x%x refCount=%u\r\n", 
!                  cookie, volp, volp->cellp->name, volp->namep, volp->vol[RWVOL].ID, volp->vol[ROVOL].ID, volp->vol[BACKVOL].ID, volp->flags, 
                   volp->refCount);
          WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
      }
***************
*** 1431,1449 ****
      int i;
      struct cm_vol_state * statep;
  
!     switch (volType) {
!     case RWVOL:
!         statep = &volp->rw;
!         break;
!     case ROVOL:                                
!         statep = &volp->ro;
!         break;
!     case BACKVOL:
!         statep = &volp->bk;
!         break;
!     default:
!         return;
!     }
  
      if (statep->flags & CM_VOLUMEFLAG_IN_HASH)
          return;
--- 1445,1451 ----
      int i;
      struct cm_vol_state * statep;
  
!     statep = cm_VolumeStateByType(volp, volType);
  
      if (statep->flags & CM_VOLUMEFLAG_IN_HASH)
          return;
***************
*** 1476,1494 ****
      struct cm_vol_state * statep;
      int i;
  	
!     switch (volType) {
!     case RWVOL:
!         statep = &volp->rw;
!         break;
!     case ROVOL:                                
!         statep = &volp->ro;
!         break;
!     case BACKVOL:
!         statep = &volp->bk;
!         break;
!     default:
!         return;
!     }
  
      if (statep->flags & CM_VOLUMEFLAG_IN_HASH) {
  	/* hash it out first */
--- 1478,1484 ----
      struct cm_vol_state * statep;
      int i;
  	
!     statep = cm_VolumeStateByType(volp, volType);
  
      if (statep->flags & CM_VOLUMEFLAG_IN_HASH) {
  	/* hash it out first */
***************
*** 1507,1512 ****
--- 1497,1504 ----
              lvolpp = &cm_data.volumeBKIDHashTablep[i];
              tvolp = cm_data.volumeBKIDHashTablep[i];
              break;
+         default:
+             osi_assertx(0, "invalid volume type");
          }
  	do {
  	    if (tvolp == volp) {
***************
*** 1516,1535 ****
  		break;
  	    }
  
!             switch (volType) {
!             case RWVOL:
!                 lvolpp = &tvolp->rw.nextp;
!                 tvolp = tvolp->rw.nextp;
!                 break;
!             case ROVOL:                                
!                 lvolpp = &tvolp->ro.nextp;
!                 tvolp = tvolp->ro.nextp;
!                 break;
!             case BACKVOL:
!                 lvolpp = &tvolp->bk.nextp;
!                 tvolp = tvolp->bk.nextp;
!                 break;
!             }
  	} while(tvolp);
      }
  }
--- 1508,1515 ----
  		break;
  	    }
  
!             lvolpp = &tvolp->vol[volType].nextp;
!             tvolp = tvolp->vol[volType].nextp;
  	} while(tvolp);
      }
  }
***************
*** 1595,1605 ****
      char volstr[CELL_MAXNAMELEN + VL_MAXNAMELEN]="";
      char *ext = "";
  
!     if (volID == volp->rw.ID)
          ext = "";
!     else if (volID == volp->ro.ID)
          ext = ".readonly";
!     else if (volID == volp->bk.ID)
          ext = ".backup";
      else
          ext = ".nomatch";
--- 1575,1585 ----
      char volstr[CELL_MAXNAMELEN + VL_MAXNAMELEN]="";
      char *ext = "";
  
!     if (volID == volp->vol[RWVOL].ID)
          ext = "";
!     else if (volID == volp->vol[ROVOL].ID)
          ext = ".readonly";
!     else if (volID == volp->vol[BACKVOL].ID)
          ext = ".backup";
      else
          ext = ".nomatch";
***************
*** 1613,1627 ****
  
  enum volstatus cm_GetVolumeStatus(cm_volume_t *volp, afs_uint32 volID)
  {
!     if (volp->rw.ID == volID) {
!         return volp->rw.state;
!     } else if (volp->ro.ID == volID) {
!         return volp->ro.state;
!     } else if (volp->bk.ID == volID) {
!         return volp->bk.state;
!     } else {
          return vl_unknown;
-     }
  }
  
  /* Renew .readonly volume callbacks that are more than
--- 1593,1603 ----
  
  enum volstatus cm_GetVolumeStatus(cm_volume_t *volp, afs_uint32 volID)
  {
!     cm_vol_state_t * statep = cm_VolumeStateByID(volp, volID);
!     if (statep)
!         return statep->state;
!     else
          return vl_unknown;
  }
  
  /* Renew .readonly volume callbacks that are more than
***************
*** 1640,1646 ****
              cm_fid_t      fid;
              cm_scache_t * scp;
  
!             cm_SetFid(&fid, volp->cellp->cellID, volp->ro.ID, 1, 1);
  
              cm_InitReq(&req);
  
--- 1616,1622 ----
              cm_fid_t      fid;
              cm_scache_t * scp;
  
!             cm_SetFid(&fid, volp->cellp->cellID, volp->vol[ROVOL].ID, 1, 1);
  
              cm_InitReq(&req);
  
***************
*** 1656,1658 ****
--- 1632,1672 ----
      }
      lock_ReleaseRead(&cm_volumeLock);
  }
+ 
+ cm_vol_state_t * 
+ cm_VolumeStateByType(cm_volume_t *volp, afs_uint32 volType)
+ {
+     return &volp->vol[volType];
+ }
+ 
+ cm_vol_state_t * 
+ cm_VolumeStateByID(cm_volume_t *volp, afs_uint32 id)
+ {
+     cm_vol_state_t * statep = NULL;
+ 
+     if (id == volp->vol[RWVOL].ID)
+         statep = &volp->vol[RWVOL];
+     else if (id == volp->vol[ROVOL].ID)
+         statep = &volp->vol[ROVOL];
+     else if (id == volp->vol[BACKVOL].ID)
+         statep = &volp->vol[BACKVOL];
+ 
+     return(statep);
+ }
+ 
+ cm_vol_state_t * 
+ cm_VolumeStateByName(cm_volume_t *volp, char *volname)
+ {
+     size_t len = strlen(volname);
+     cm_vol_state_t *statep;
+ 
+     if (stricmp(".readonly", &volname[len-9]) == 0)
+         statep = &volp->vol[ROVOL];
+     else if (stricmp(".backup", &volname[len-7]) == 0)
+         statep = &volp->vol[BACKVOL];
+     else 
+         statep = &volp->vol[RWVOL];
+ 
+     return statep;
+ }
+ 
Index: openafs/src/WINNT/afsd/cm_volume.h
diff -c openafs/src/WINNT/afsd/cm_volume.h:1.5.6.12 openafs/src/WINNT/afsd/cm_volume.h:1.5.6.13
*** openafs/src/WINNT/afsd/cm_volume.h:1.5.6.12	Wed Mar 19 16:18:37 2008
--- openafs/src/WINNT/afsd/cm_volume.h	Mon Apr 14 18:44:04 2008
***************
*** 14,28 ****
  
  #define CM_VOLUME_MAGIC    ('V' | 'O' <<8 | 'L'<<16 | 'M'<<24)
  
  typedef struct cm_vol_state {
      struct cm_volume *nextp;            /* volumeIDHashTable; by cm_volumeLock */
!     afs_uint32      ID;                 /* by mx */
      struct cm_fid dotdotFid;	        /* parent of volume root */
!     cm_serverRef_t *serversp;           /* by mx */
!     enum volstatus  state;              /* by mx */
!     afs_uint32      flags;              /* by mx */
  } cm_vol_state_t;
  
  typedef struct cm_volume {
      osi_queue_t q;                      /* LRU queue; cm_volumeLock */
      afs_uint32  magic;
--- 14,35 ----
  
  #define CM_VOLUME_MAGIC    ('V' | 'O' <<8 | 'L'<<16 | 'M'<<24)
  
+ /* 
+  *
+  */
+ 
  typedef struct cm_vol_state {
      struct cm_volume *nextp;            /* volumeIDHashTable; by cm_volumeLock */
!     afs_uint32      ID;                 /* by rw */
      struct cm_fid dotdotFid;	        /* parent of volume root */
!     cm_serverRef_t *serversp;           /* by cm_serverLock */
!     enum volstatus  state;              /* by rw */
!     afs_uint32      flags;              /* by rw */
  } cm_vol_state_t;
  
+ /* RWVOL, ROVOL, BACKVOL are defined in cm.h */
+ #define NUM_VOL_TYPES 3
+ 
  typedef struct cm_volume {
      osi_queue_t q;                      /* LRU queue; cm_volumeLock */
      afs_uint32  magic;
***************
*** 31,41 ****
      cm_cell_t *cellp;		        /* never changes */
      char namep[VL_MAXNAMELEN];		/* name of the normal volume - assigned during allocation; */
                                          /* by cm_volumeLock */
!     struct cm_vol_state rw;	        /* by cm_volumeLock */
!     struct cm_vol_state ro;		/* by cm_volumeLock */
!     struct cm_vol_state bk;		/* by cm_volumeLock */
!     osi_mutex_t mx;
!     afs_uint32 flags;			/* by mx */
      afs_int32 refCount;		        /* by Interlocked operations */
      time_t cbExpiresRO;                 /* latest RO expiration time; by cm_scacheLock */
  } cm_volume_t;
--- 38,46 ----
      cm_cell_t *cellp;		        /* never changes */
      char namep[VL_MAXNAMELEN];		/* name of the normal volume - assigned during allocation; */
                                          /* by cm_volumeLock */
!     struct cm_vol_state vol[NUM_VOL_TYPES]; /* by cm_volumeLock */
!     osi_rwlock_t rw;
!     afs_uint32 flags;			/* by rw */
      afs_int32 refCount;		        /* by Interlocked operations */
      time_t cbExpiresRO;                 /* latest RO expiration time; by cm_scacheLock */
  } cm_volume_t;
***************
*** 43,48 ****
--- 48,54 ----
  #define CM_VOLUMEFLAG_RESET	   1	/* reload this info on next use */
  #define CM_VOLUMEFLAG_IN_HASH      2
  #define CM_VOLUMEFLAG_IN_LRU_QUEUE 4
+ #define CM_VOLUMEFLAG_UPDATING_VL  8
  
  
  typedef struct cm_volumeRef {
***************
*** 126,130 ****
--- 132,142 ----
  
  extern void cm_VolumeRenewROCallbacks(void);
  
+ extern cm_vol_state_t * cm_VolumeStateByType(cm_volume_t *volp, afs_uint32 type);
+ 
+ extern cm_vol_state_t * cm_VolumeStateByID(cm_volume_t *volp, afs_uint32 id);
+ 
+ extern cm_vol_state_t * cm_VolumeStateByName(cm_volume_t *volp, char *volname);
+ 
  extern osi_rwlock_t cm_volumeLock;
  #endif /*  __CM_VOLUME_H_ENV__ */
Index: openafs/src/WINNT/aklog/aklog.c
diff -c openafs/src/WINNT/aklog/aklog.c:1.14.4.10 openafs/src/WINNT/aklog/aklog.c:1.14.4.13
*** openafs/src/WINNT/aklog/aklog.c:1.14.4.10	Fri Mar 21 20:20:24 2008
--- openafs/src/WINNT/aklog/aklog.c	Sun Mar 30 12:21:07 2008
***************
*** 14,20 ****
   */
  
  /*
!  * Copyright (c) 2007 Secure Endpoints Inc.
   *
   * All rights reserved.
   *
--- 14,20 ----
   */
  
  /*
!  * Copyright (c) 2007-2008 Secure Endpoints Inc.
   *
   * All rights reserved.
   *
***************
*** 195,201 ****
  static int usev5 = TRUE;   /* use kerberos 5? */
  static int use524 = FALSE;  /* use krb524? */
  static krb5_context context = 0;
! static krb5_ccache _krb425_ccache;
  
  void akexit(int exit_code)
  {
--- 195,201 ----
  static int usev5 = TRUE;   /* use kerberos 5? */
  static int use524 = FALSE;  /* use krb524? */
  static krb5_context context = 0;
! static krb5_ccache _krb425_ccache = 0;
  
  void akexit(int exit_code)
  {
***************
*** 239,247 ****
      static char confname[512] = { 0 };
      char username_copy[BUFSIZ];
      afs_int32 viceId;			/* AFS uid of user */
- #ifdef ALLOW_REGISTER
-     afs_int32 id;
- #endif /* ALLOW_REGISTER */
  
      if (confname[0] == '\0') {
          strncpy(confname, AFSDIR_CLIENT_ETC_DIRPATH, sizeof(confname));
--- 239,244 ----
***************
*** 297,303 ****
                  printf("doing first-time registration of %s "
                          "at %s\n", username, cell_to_use);
              }
-             id = 0;
              strncpy(aclient->name, username, MAXKTCNAMELEN - 1);
              aclient->name[MAXKTCNAMELEN - 1] = '\0';
              strcpy(aclient->instance, "");
--- 294,299 ----
***************
*** 331,337 ****
              /* copy the name because pr_CreateUser lowercases the realm */
              strncpy(username_copy, username, BUFSIZ);
  
!             *status = pr_CreateUser(username, &id);
  
              /* and restore the name to the original state */
              strncpy(username, username_copy, BUFSIZ);
--- 327,333 ----
              /* copy the name because pr_CreateUser lowercases the realm */
              strncpy(username_copy, username, BUFSIZ);
  
!             *status = pr_CreateUser(username, &viceId);
  
              /* and restore the name to the original state */
              strncpy(username, username_copy, BUFSIZ);
***************
*** 611,623 ****
  static int get_v5_user_realm(krb5_context context,char *realm)
  {
      static krb5_principal client_principal = 0;
      int i;
  
!     if (!_krb425_ccache)
!         krb5_cc_default(context, &_krb425_ccache);
!     if (!client_principal)
!         krb5_cc_get_principal(context, _krb425_ccache, &client_principal);
! 
      i = krb5_princ_realm(context, client_principal)->length;
      if (i < REALM_SZ-1) i = REALM_SZ-1;
      strncpy(realm,krb5_princ_realm(context, client_principal)->data,i);
--- 607,625 ----
  static int get_v5_user_realm(krb5_context context,char *realm)
  {
      static krb5_principal client_principal = 0;
+     krb5_error_code code;
      int i;
  
!     if (!_krb425_ccache) {
!         code = krb5_cc_default(context, &_krb425_ccache);
!         if (code)
!             return(code);
!     }
!     if (!client_principal) {
!         code = krb5_cc_get_principal(context, _krb425_ccache, &client_principal);
!         if (code)
!             return(code);
!     }
      i = krb5_princ_realm(context, client_principal)->length;
      if (i < REALM_SZ-1) i = REALM_SZ-1;
      strncpy(realm,krb5_princ_realm(context, client_principal)->data,i);
***************
*** 625,630 ****
--- 627,651 ----
      return(KSUCCESS);
  }
  
+ static void
+ copy_realm_of_ticket(krb5_context context, char * dest, size_t destlen, krb5_creds *v5cred) {
+     krb5_error_code code;
+     krb5_ticket *ticket;
+     size_t len;
+ 
+     code = krb5_decode_ticket(&v5cred->ticket, &ticket);
+     if (code == 0) {
+         len = krb5_princ_realm(context, ticket->server)->length;
+         if (len > destlen - 1)
+             len = destlen - 1;
+ 
+         strncpy(dest, krb5_princ_realm(context, ticket->server)->data, len);
+         dest[len] = '\0';
+ 
+         krb5_free_ticket(context, ticket);
+     }
+ }
+ 
  /*
  * Log to a cell.  If the cell has already been logged to, return without
  * doing anything.  Otherwise, log to it and mark that it has been logged
***************
*** 702,707 ****
--- 723,734 ----
          int retry = 1;
  	int realm_fallback = 0;
  
+         if ((status = get_v5_user_realm(context, realm_of_user)) != KSUCCESS) {
+             fprintf(stderr, "%s: Couldn't determine realm of user: %d\n",
+                      progname, status);
+             return(AKLOG_KERBEROS);
+         }
+ 
          if ( strchr(name,'.') != NULL ) {
              fprintf(stderr, "%s: Can't support principal names including a dot.\n",
                      progname);
***************
*** 709,759 ****
          }
  
        try_v5:
! 	if (realm && realm[0])
! 	    strcpy(realm_of_cell, realm);
! 	else
! 	    strcpy(realm_of_cell,
! 		    afs_realm_of_cell5(context, &ak_cellconfig, realm_fallback));
! 
! 	if (dflag)
!             printf("Getting v5 tickets: %s/%s@%s\n", name, instance, realm_of_cell);
!         status = get_v5cred(context, name, instance, realm_of_cell, 
  #ifdef HAVE_KRB4
                              use524 ? &c : NULL, 
  #else
                              NULL,
  #endif
                              &v5cred);
  
!         if (status == 0 && strcmp(realm_of_cell, "") == 0) {
!             krb5_error_code code;
!             krb5_ticket *ticket;
! 
!             code = krb5_decode_ticket(&v5cred->ticket, &ticket);
! 
!             if (code != 0) {
!                 fprintf(stderr,
!                          "%s: Couldn't decode ticket to determine realm for "
!                          "cell %s.\n",
!                          progname, cell_to_use);
!             } else {
!                 int len = krb5_princ_realm(context, ticket->server)->length;
!                 /* This really shouldn't happen. */
!                 if (len > REALM_SZ-1)
!                     len = REALM_SZ-1;
! 
!                 strncpy(realm_of_cell, krb5_princ_realm(context, ticket->server)->data, len);
!                 realm_of_cell[len] = 0;
  
!                 krb5_free_ticket(context, ticket);
              }
          }
  
! 	if (status == KRB5_ERR_HOST_REALM_UNKNOWN) {
  	    realm_fallback = 1;
  	    goto try_v5;
  	} else if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN) {
! 	    if (!realm_of_cell[0]) {
  		realm_fallback = 1;
  		goto try_v5;
  	    }
--- 736,796 ----
          }
  
        try_v5:
! 	if (realm && realm[0]) {
!             if (dflag)
!                 printf("Getting v5 tickets: %s/%s@%s\n", name, instance, realm);
!             status = get_v5cred(context, name, instance, realm, 
  #ifdef HAVE_KRB4
                              use524 ? &c : NULL, 
  #else
                              NULL,
  #endif
                              &v5cred);
+             strcpy(realm_of_cell, realm);
+         } else {
+ 	    strcpy(realm_of_cell,
+ 		    afs_realm_of_cell5(context, &ak_cellconfig, realm_fallback));
  
!             if (retry == 1 && realm_fallback == 0) {
!                 /* Only try the realm_of_user once */
!                 status = -1;
!                 if (dflag)
!                     printf("Getting v5 tickets: %s/%s@%s\n", name, instance, realm_of_user);
!                 status = get_v5cred(context, name, instance, realm_of_user, 
! #ifdef HAVE_KRB4
!                                      use524 ? &c : NULL, 
! #else
!                                      NULL,
! #endif
!                                      &v5cred);
!                 if (status == 0) {
!                     /* we have determined that the client realm 
!                      * is a valid cell realm
!                      */
!                     strcpy(realm_of_cell, realm_of_user);
!                 }
!             }
  
!             if (status != 0 && (!retry || retry && strcmp(realm_of_user,realm_of_cell))) {
!                 if (dflag)
!                     printf("Getting v5 tickets: %s/%s@%s\n", name, instance, realm_of_cell);
!                 status = get_v5cred(context, name, instance, realm_of_cell, 
! #ifdef HAVE_KRB4
!                                      use524 ? &c : NULL, 
! #else
!                                      NULL,
! #endif
!                                      &v5cred);
!                 if (!status && !strlen(realm_of_cell)) 
!                     copy_realm_of_ticket(context, realm_of_cell, sizeof(realm_of_cell), v5cred);
              }
          }
  
! 	if (!realm_fallback && status == KRB5_ERR_HOST_REALM_UNKNOWN) {
  	    realm_fallback = 1;
  	    goto try_v5;
  	} else if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN) {
! 	    if (!realm_fallback && !realm_of_cell[0]) {
  		realm_fallback = 1;
  		goto try_v5;
  	    }
***************
*** 766,772 ****
--- 803,812 ----
                                  NULL,
  #endif
                                  &v5cred);
+             if (!status && !strlen(realm_of_cell)) 
+                 copy_realm_of_ticket(context, realm_of_cell, sizeof(realm_of_cell), v5cred);
  	}
+      
          if ( status == KRB5KRB_AP_ERR_MSG_TYPE && retry ) {
              retry = 0;
  	    realm_fallback = 0;
***************
*** 890,902 ****
      }       
      else    
      {
!         if (usev5) {
!             if((status = get_v5_user_realm(context, realm_of_user)) != KSUCCESS) {
!                 fprintf(stderr, "%s: Couldn't determine realm of user: %d\n",
!                          progname, status);
!                 return(AKLOG_KERBEROS);
!             }
!         } else {
  #ifdef HAVE_KRB4
              if ((status = krb_get_tf_realm(TKT_FILE, realm_of_user)) != KSUCCESS)
              {
--- 930,936 ----
      }       
      else    
      {
!         if (!usev5) {
  #ifdef HAVE_KRB4
              if ((status = krb_get_tf_realm(TKT_FILE, realm_of_user)) != KSUCCESS)
              {
***************
*** 909,920 ****
  #endif
          }
  
!         /* For Khimaira we want to always append the realm to the name */
!         if (1 /* strcmp(realm_of_user, realm_of_cell) */)
!         {
!             strcat(username, "@");
!             strcat(username, realm_of_user);
!         }
  
          ViceIDToUsername(username, realm_of_user, realm_of_cell, cell_to_use, 
  #ifdef HAVE_KRB4
--- 943,951 ----
  #endif
          }
  
!         /* For Network Identity Manager append the realm to the name */
!         strcat(username, "@");
!         strcat(username, realm_of_user);
  
          ViceIDToUsername(username, realm_of_user, realm_of_cell, cell_to_use, 
  #ifdef HAVE_KRB4
***************
*** 1437,1449 ****
          }
      }
  
!     if (usev5)
          validate_krb5_availability();
!     else 
          validate_krb4_availability();
  
-     if(usev5)
-         krb5_init_context(&context);
  
      /* If nothing was given, log to the local cell. */
      if ((cells.nelements + paths.nelements) == 0)
--- 1468,1480 ----
          }
      }
  
!     if (usev5) {
          validate_krb5_availability();
!         if (krb5_init_context(&context))
!             return(AKLOG_KERBEROS);
!     } else 
          validate_krb4_availability();
  
  
      /* If nothing was given, log to the local cell. */
      if ((cells.nelements + paths.nelements) == 0)
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.29 openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.30
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.29	Sat Mar  8 20:09:30 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm	Mon Apr 21 11:44:06 2008
***************
*** 57,63 ****
  
  <h1>OpenAFS for Windows</h1>
  
! <h2>Version 1.5.34</h2>
  
  <p class=MsoNormal>&nbsp; </p>
  
--- 57,63 ----
  
  <h1>OpenAFS for Windows</h1>
  
! <h2>Version 1.5.35</h2>
  
  <p class=MsoNormal>&nbsp; </p>
  
***************
*** 80,86 ****
  <span
  style='font-family:Symbol'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </span></span><a
! href="ReleaseNotes/relnotes-frames.htm">OpenAFS for Windows 1.5.34
  Release Notes</a></p>
  
  <p style='margin-left:36.0pt;text-indent:-18.0pt;'>
--- 80,86 ----
  <span
  style='font-family:Symbol'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </span></span><a
! href="ReleaseNotes/relnotes-frames.htm">OpenAFS for Windows 1.5.35
  Release Notes</a></p>
  
  <p style='margin-left:36.0pt;text-indent:-18.0pt;'>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.29 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.30
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.29	Sat Mar  8 20:09:47 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm	Mon Apr 21 11:44:11 2008
***************
*** 18,24 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.34 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Revision>1</o:Revision>
--- 18,24 ----
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.35 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Revision>1</o:Revision>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.31 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.32
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.31	Sat Mar  8 20:09:47 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm	Mon Apr 21 11:44:11 2008
***************
*** 9,15 ****
  <meta name=Generator content="Microsoft Word 12">
  <meta name=Originator content="Microsoft Word 12">
  <link rel=File-List href="relnotes-frames_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.34 Release Notes</title>
  <link rel=themeData href="relnotes-frames_files/themedata.thmx">
  <link rel=colorSchemeMapping href="relnotes-frames_files/colorschememapping.xml">
  <!--[if gte mso 9]><xml>
--- 9,15 ----
  <meta name=Generator content="Microsoft Word 12">
  <meta name=Originator content="Microsoft Word 12">
  <link rel=File-List href="relnotes-frames_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.35 Release Notes</title>
  <link rel=themeData href="relnotes-frames_files/themedata.thmx">
  <link rel=colorSchemeMapping href="relnotes-frames_files/colorschememapping.xml">
  <!--[if gte mso 9]><xml>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.36 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.37
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.36	Fri Mar 21 14:09:06 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm	Mon Apr 21 11:44:11 2008
***************
*** 21,27 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.34 Release Notes</title>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
   name="PostalCode"/>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
--- 21,27 ----
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.35 Release Notes</title>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
   name="PostalCode"/>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
***************
*** 1282,1288 ****
  
  <div class=Section1>
  
! <p class=MsoTitle>OpenAFS for Windows 1.5.34<br>
  Release Notes</p>
  
  <p class=MsoBodyText>The Andrew File System (AFS) is a location-independent
--- 1282,1288 ----
  
  <div class=Section1>
  
! <p class=MsoTitle>OpenAFS for Windows 1.5.35<br>
  Release Notes</p>
  
  <p class=MsoBodyText>The Andrew File System (AFS) is a location-independent
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.30 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.31
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.30	Sat Mar  8 20:09:50 2008
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm	Mon Apr 21 11:44:12 2008
***************
*** 11,17 ****
  <meta name=Originator content="Microsoft Word 12">
  <base target=body>
  <link rel=File-List href="toc_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.34 Table of Contents</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Author>Jeffrey Altman</o:Author>
--- 11,17 ----
  <meta name=Originator content="Microsoft Word 12">
  <base target=body>
  <link rel=File-List href="toc_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.35 Table of Contents</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Author>Jeffrey Altman</o:Author>
Index: openafs/src/WINNT/install/NSIS/MakeVCRuntimeMSI.cmd
diff -c /dev/null openafs/src/WINNT/install/NSIS/MakeVCRuntimeMSI.cmd:1.1.2.2
*** /dev/null	Mon Apr 21 17:11:55 2008
--- openafs/src/WINNT/install/NSIS/MakeVCRuntimeMSI.cmd	Wed Apr  9 00:36:53 2008
***************
*** 0 ****
--- 1,20 ----
+ @echo off
+ setlocal
+ if "%1"=="debug" set DR=Debug
+ if "%1"=="retail" set DR=Retail
+ if "%DR%"=="" goto usage
+ if "%2"=="x86" set PL=Intel
+ if "%2"=="x64" set PL=x64
+ if "%PL%"=="" goto usage
+ 
+ candle vcruntime.wxs -dConfig=%DR% -dPlatform=%PL%
+ light  vcruntime.wixobj
+ 
+ echo Done!
+ goto done
+ 
+ :usage
+ 
+ echo. Usage: MakeVCRuntimeMSI.cmd {debug/retail} {x86/x64}
+ 
+ :done
Index: openafs/src/WINNT/install/NSIS/NTMakefile
diff -c openafs/src/WINNT/install/NSIS/NTMakefile:1.18.4.3 openafs/src/WINNT/install/NSIS/NTMakefile:1.18.4.4
*** openafs/src/WINNT/install/NSIS/NTMakefile:1.18.4.3	Wed Sep 19 13:58:47 2007
--- openafs/src/WINNT/install/NSIS/NTMakefile	Wed Apr  9 00:36:53 2008
***************
*** 37,47 ****
        $(EXECONLINK) 
          $(_VC_MANIFEST_EMBED_EXE)
  
  prebuild:
  !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
  !IF ("$(AFSVER_CL)"=="1400")
!    $(COPY) %SystemRoot%\System32\Msvcr80.dll $(EXEDIR)
!    $(COPY) %SystemRoot%\System32\MFC80.DLL $(EXEDIR)
  !ELSE IF ("$(AFSVER_CL)"=="1310")
     $(COPY) %SystemRoot%\System32\Msvcr71.dll $(EXEDIR)
     $(COPY) %SystemRoot%\System32\MFC71.DLL $(EXEDIR)
--- 37,64 ----
        $(EXECONLINK) 
          $(_VC_MANIFEST_EMBED_EXE)
  
+ !IF ("$(AFSDEV_BUILDTYPE)"=="FREE")
+ !IF ("$(CPU)" == "i386")
+ ARCH=x86
+ !ELSE IF ("$(CPU)" == "amd64")
+ ARCH=x64
+ !ELSE
+ ARCH=$(CPU)
+ !ENDIF
+ !ELSE
+ !IF ("$(CPU)" == "i386")
+ ARCH=Intel
+ !ELSE IF ("$(CPU)" == "amd64")
+ ARCH=x64
+ !ELSE
+ ARCH=$(CPU)
+ !ENDIF
+ !ENDIF
+ 
  prebuild:
  !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
  !IF ("$(AFSVER_CL)"=="1400")
!    $(COPY) "%VSINSTALLDIR%\SDK\v2.0\BootStrapper\Packages\vcredist_$(ARCH)\vcredist_$(ARCH).exe" $(EXEDIR)
  !ELSE IF ("$(AFSVER_CL)"=="1310")
     $(COPY) %SystemRoot%\System32\Msvcr71.dll $(EXEDIR)
     $(COPY) %SystemRoot%\System32\MFC71.DLL $(EXEDIR)
***************
*** 57,66 ****
  !ENDIF
  !ELSE # NOT FREE - CHECKED
  !IF ("$(AFSVER_CL)"=="1400")
!    $(COPY) %SystemRoot%\System32\Msvcr80d.dll $(EXEDIR)
!    $(COPY) %SystemRoot%\System32\Msvcr80d.pdb $(EXEDIR)
!    $(COPY) %SystemRoot%\System32\MFC80D.DLL $(EXEDIR)
!    $(COPY) %SystemRoot%\System32\MFC80D.pdb $(EXEDIR)
  !ELSE IF ("$(AFSVER_CL)"=="1310")
     $(COPY) %SystemRoot%\System32\Msvcr71d.dll $(EXEDIR)
     $(COPY) %SystemRoot%\System32\Msvcr71d.pdb $(EXEDIR)
--- 74,80 ----
  !ENDIF
  !ELSE # NOT FREE - CHECKED
  !IF ("$(AFSVER_CL)"=="1400")
! # Do nothing.
  !ELSE IF ("$(AFSVER_CL)"=="1310")
     $(COPY) %SystemRoot%\System32\Msvcr71d.dll $(EXEDIR)
     $(COPY) %SystemRoot%\System32\Msvcr71d.pdb $(EXEDIR)
***************
*** 93,98 ****
--- 107,113 ----
     echo. >>$(OUT)\nsi-includes.nsi                                       
  !if ("$(AFSVER_CL)" == "1400")
     echo !define CL_1400 1 >> $(OUT)\nsi-includes.nsi
+    echo !define VCREDISTNAME vcredist_$(ARCH).exe >> $(OUT)\nsi-includes.nsi
  !else if ("$(AFSVER_CL)" == "1310")
     echo !define CL_1310 1 >> $(OUT)\nsi-includes.nsi
  !else if ("$(AFSVER_CL)" == "1300")
***************
*** 105,114 ****
     echo !define DEBUG 1 >>$(OUT)\nsi-includes.nsi
  !endif
  
  build: prebuild
     "$(NSISDIR)\makensis.exe" /DINCLUDEDIR=$(OUT) OpenAFS.nsi
  
! install: $(OUT)\Service.obj $(EXEDIR)\Service.exe $(OUT)\Killer.obj $(EXEDIR)\Killer.exe $(EXEDIR)\AdminGroup.exe build
  
  clean::
     $(DEL) $(OUT)\Service.obj
--- 120,144 ----
     echo !define DEBUG 1 >>$(OUT)\nsi-includes.nsi
  !endif
  
+ !if ("$(AFSVER_CL)"=="1400") && ("$(AFSDEV_BUILDTYPE)"!="FREE")
+ MSVCMSI=$(EXEDIR)\vcruntime.msi
+ 
+ $(MSVCMSI): $(OUT)\vcruntime.wixobj
+ 	light -out $@ $**
+ 
+ $(OUT)\vcruntime.wixobj: vcruntime.wxs
+ 	candle -out $@ $** -dPlatform=$(ARCH) -dConfig=Debug
+ 
+ !else
+ MSVCMSI=
+ !endif
+ 
+ runtime: $(MSVCMSI)
+ 
  build: prebuild
     "$(NSISDIR)\makensis.exe" /DINCLUDEDIR=$(OUT) OpenAFS.nsi
  
! install: $(OUT)\Service.obj $(EXEDIR)\Service.exe $(OUT)\Killer.obj $(EXEDIR)\Killer.exe $(EXEDIR)\AdminGroup.exe runtime build
  
  clean::
     $(DEL) $(OUT)\Service.obj
***************
*** 125,128 ****
  #   $(DEL) $(EXEDIR)\Msvcr71.dll
  #   $(DEL) $(EXEDIR)\MFC42.DLL
  #   $(DEL) OpenAFSforWindows.exe
! 
--- 155,161 ----
  #   $(DEL) $(EXEDIR)\Msvcr71.dll
  #   $(DEL) $(EXEDIR)\MFC42.DLL
  #   $(DEL) OpenAFSforWindows.exe
! !if ("$(AFSVER_CL)"=="1400") && ("$(AFSDEV_BUILDTYPE)"!="FREE")
!    $(DEL) $(OUT)\vcruntime.wixobj
!    $(DEL) $(MSVCMSI)
! !endif
Index: openafs/src/WINNT/install/NSIS/OpenAFS.nsi
diff -c openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.13 openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.14
*** openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.13	Sat Mar  8 18:39:25 2008
--- openafs/src/WINNT/install/NSIS/OpenAFS.nsi	Wed Apr  9 00:36:53 2008
***************
*** 1223,1231 ****
  DoCommon:
    SetOutPath "$INSTDIR\Common"
  !IFDEF CL_1400
!    File "${SYSTEMDIR}\msvcr80d.pdb"
!    File "${SYSTEMDIR}\msvcp80d.pdb"
!    File "${SYSTEMDIR}\mfc80d.pdb"
  !ELSE
  !IFDEF CL_1310
     File "${SYSTEMDIR}\msvcr71d.pdb"
--- 1223,1229 ----
  DoCommon:
    SetOutPath "$INSTDIR\Common"
  !IFDEF CL_1400
!   ; Do nothing
  !ELSE
  !IFDEF CL_1310
     File "${SYSTEMDIR}\msvcr71d.pdb"
***************
*** 1705,1716 ****
     Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.pdb"
  !IFDEF DEBUG
  !IFDEF CL_1400
!    Delete /REBOOTOK "$INSTDIR\bin\msvcr80d.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcr80d.pdb"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcp80d.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcp80d.pdb"
!    Delete /REBOOTOK "$INSTDIR\bin\mfc80d.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\mfc80d.pdb"
  !ELSE
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.dll"
--- 1703,1712 ----
     Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.pdb"
  !IFDEF DEBUG
  !IFDEF CL_1400
!    SetOutPath "$INSTDIR\bin"
!    File "${AFS_WININSTALL_DIR}\vcruntime.msi"
!    nsExec::Exec 'msiexec /x "$INSTDIR\bin\vcruntime.msi" /passive'
!    Delete "$INSTDIR\bin\vcruntime.msi"
  !ELSE
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.dll"
***************
*** 1739,1756 ****
  !ENDIF
  !ELSE
  !IFDEF CL_1400
!    Delete /REBOOTOK "$INSTDIR\bin\mfc80.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcr80.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcp80.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80CHS.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80CHT.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80DEU.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80ENU.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80ESP.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80FRA.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80ITA.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80JPN.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80KOR.DLL"
  !ELSE
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\mfc71.dll"
--- 1735,1741 ----
  !ENDIF
  !ELSE
  !IFDEF CL_1400
!    ; Do nothing
  !ELSE
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\mfc71.dll"
***************
*** 1895,1906 ****
  
  !IFDEF DEBUG  
  !IFDEF CL_1400
!    Delete /REBOOTOK "$INSTDIR\bin\msvcr80d.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcr80d.pdb"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcp80d.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcp80d.pdb"
!    Delete /REBOOTOK "$INSTDIR\bin\mfc80d.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\mfc80d.pdb"
  !ELSE
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.dll"
--- 1880,1886 ----
  
  !IFDEF DEBUG  
  !IFDEF CL_1400
!    ; Do nothing
  !ELSE
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.dll"
***************
*** 1929,1946 ****
  !ENDIF
  !ELSE
  !IFDEF CL_1400
!    Delete /REBOOTOK "$INSTDIR\bin\mfc80.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcr80.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\msvcp80.dll"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80CHS.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80CHT.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80DEU.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80ENU.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80ESP.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80FRA.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80ITA.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80JPN.DLL"
!    Delete /REBOOTOK "$INSTDIR\bin\MFC80KOR.DLL"
  !ELSE
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\mfc71.dll"
--- 1909,1915 ----
  !ENDIF
  !ELSE
  !IFDEF CL_1400
!    ; Do nothing
  !ELSE
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\mfc71.dll"
***************
*** 2765,2782 ****
  
  !IFDEF DEBUG
  !IFDEF CL_1400
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr80d.dll" "$INSTDIR\Common\msvcr80d.dll" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp80d.dll" "$INSTDIR\Common\msvcp80d.dll" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc80d.dll" "$INSTDIR\Common\mfc80d.dll" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80CHS.DLL" "$INSTDIR\Common\MFC80CHS.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80CHT.DLL" "$INSTDIR\Common\MFC80CHT.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80DEU.DLL" "$INSTDIR\Common\MFC80DEU.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80ENU.DLL" "$INSTDIR\Common\MFC80ENU.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80ESP.DLL" "$INSTDIR\Common\MFC80ESP.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80FRA.DLL" "$INSTDIR\Common\MFC80FRA.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80ITA.DLL" "$INSTDIR\Common\MFC80ITA.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80JPN.DLL" "$INSTDIR\Common\MFC80JPN.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80KOR.DLL" "$INSTDIR\Common\MFC80KOR.DLL" "$INSTDIR"
  !ELSE
  !IFDEF CL_1310
     !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71d.dll" "$INSTDIR\Common\msvcr71d.dll" "$INSTDIR"
--- 2734,2742 ----
  
  !IFDEF DEBUG
  !IFDEF CL_1400
!    File "${AFS_WININSTALL_DIR}\vcruntime.msi"
!    nsExec::Exec 'msiexec /i "$INSTDIR\Common\vcruntime.msi" /passive'
!    Delete "$INSTDIR\Common\vcruntime.msi"
  !ELSE
  !IFDEF CL_1310
     !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr71d.dll" "$INSTDIR\Common\msvcr71d.dll" "$INSTDIR"
***************
*** 2814,2831 ****
  !ENDIF
  !ELSE
  !IFDEF CL_1400
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc80.dll" "$INSTDIR\Common\mfc80.dll" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcr80.dll" "$INSTDIR\Common\msvcr80.dll" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\msvcp80.dll" "$INSTDIR\Common\msvcp80.dll" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80CHS.DLL" "$INSTDIR\Common\MFC80CHS.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80CHT.DLL" "$INSTDIR\Common\MFC80CHT.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80DEU.DLL" "$INSTDIR\Common\MFC80DEU.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80ENU.DLL" "$INSTDIR\Common\MFC80ENU.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80ESP.DLL" "$INSTDIR\Common\MFC80ESP.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80FRA.DLL" "$INSTDIR\Common\MFC80FRA.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80ITA.DLL" "$INSTDIR\Common\MFC80ITA.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80JPN.DLL" "$INSTDIR\Common\MFC80JPN.DLL" "$INSTDIR"
!    !insertmacro ReplaceDLL "${SYSTEMDIR}\MFC80KOR.DLL" "$INSTDIR\Common\MFC80KOR.DLL" "$INSTDIR"
  !ELSE
  !IFDEF CL_1310
     !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71.dll" "$INSTDIR\Common\mfc71.dll" "$INSTDIR"
--- 2774,2782 ----
  !ENDIF
  !ELSE
  !IFDEF CL_1400
!   File "${AFS_WININSTALL_DIR}\${VCREDISTNAME}"
!   nsExec::Exec '"$INSTDIR\Common\${VCREDISTNAME}" /Q'
!   Delete "$INSTDIR\Common\${VCREDISTNAME}"
  !ELSE
  !IFDEF CL_1310
     !insertmacro ReplaceDLL "${SYSTEMDIR}\mfc71.dll" "$INSTDIR\Common\mfc71.dll" "$INSTDIR"
Index: openafs/src/WINNT/install/NSIS/vcruntime.wxs
diff -c /dev/null openafs/src/WINNT/install/NSIS/vcruntime.wxs:1.1.2.2
*** /dev/null	Mon Apr 21 17:11:55 2008
--- openafs/src/WINNT/install/NSIS/vcruntime.wxs	Wed Apr  9 00:36:53 2008
***************
*** 0 ****
--- 1,89 ----
+ <?xml version="1.0" ?>
+ <Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>
+ 
+   <?ifndef Config?>
+     <?define Config=Debug?>
+   <?endif?>
+ 
+     <Product
+        Id="????????-????-????-????-????????????"
+        Codepage="1252"
+        Language="1033"
+        Manufacturer="Microsoft Corporation"
+        Name="Visual C++ 8.0 $(var.Config) ($(var.Platform)) Runtime"
+        UpgradeCode="1184DE9F-813A-4DB3-8533-BB7D4E51D695"
+        Version="0.1.0.0"
+        >
+       <Package
+          Id="????????-????-????-????-????????????"
+          AdminImage="no"
+          Comments="Copyright (C) Microsoft Corporation, All rights reserved."
+          Compressed="yes"
+          Description="Visual C++ 8.0 $(var.Config) ($(var.Platform)) WinSXS MSM"
+          InstallerVersion="300"
+          Keywords="Installer,VC,$(var.Config),Runtime"
+          Manufacturer="Microsoft Corporation"
+          Platforms="$(var.Platform)"
+          ShortNames="no"
+          SummaryCodepage="1252"
+          />
+ 
+       <Directory Id="TARGETDIR" Name="SourceDir">
+ 	<?ifdef env.CommonProgramFiles6432?>
+ 	  <?define CPF="$(env.CommonProgramFiles(x86)"?>
+ 	<?else?>
+ 	  <?define CPF="$(env.CommonProgramFiles)"?>
+ 	<?endif?>
+ 
+ 	<?if $(var.Platform) = "x64" ?>
+ 	  <?if $(var.Config) = "Retail" ?>
+ 	    <Merge Id="MSVCRT8MEM" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_CRT_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8POL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_CRT_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8MFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_MFC_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8PFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_MFC_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8MFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_MFCLOC_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8PFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_MFCLOC_x86_x64.msm"/>
+  	  <?else?>
+ 	    <Merge Id="MSVCRT8MEM" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_DebugCRT_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8POL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_DebugCRT_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8MFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_DebugMFC_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8PFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_DebugMFC_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8MFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_MFCLOC_x86_x64.msm"/>
+ 	    <Merge Id="MSVCRT8PFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_MFCLOC_x86_x64.msm"/>
+ 	  <?endif?>
+         <?else?>
+ 	  <?if $(var.Config) = "Retail" ?>
+ 	    <Merge Id="MSVCRT8MEM" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_CRT_x86.msm"/>
+ 	    <Merge Id="MSVCRT8POL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_CRT_x86.msm"/>
+ 	    <Merge Id="MSVCRT8MFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_MFC_x86.msm"/>
+ 	    <Merge Id="MSVCRT8PFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_MFC_x86.msm"/>
+ 	    <Merge Id="MSVCRT8MFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_MFCLOC_x86.msm"/>
+ 	    <Merge Id="MSVCRT8PFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_MFCLOC_x86.msm"/>
+ 	  <?else?>
+ 	    <Merge Id="MSVCRT8MEM" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_DebugCRT_x86.msm"/>
+ 	    <Merge Id="MSVCRT8POL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_DebugCRT_x86.msm"/>
+ 	    <Merge Id="MSVCRT8MFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_DebugMFC_x86.msm"/>
+ 	    <Merge Id="MSVCRT8PFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_DebugMFC_x86.msm"/>
+ 	    <Merge Id="MSVCRT8MFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC80_MFCLOC_x86.msm"/>
+ 	    <Merge Id="MSVCRT8PFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_MFCLOC_x86.msm"/>
+ 	  <?endif?>
+ 	<?endif?>
+       </Directory>
+ 
+       <Feature Id="FeatureAll" AllowAdvertise="no" Absent="disallow"
+                Description="Install VC ++ 8.0 Runtime" Display="expand" InstallDefault="local" Level="3"
+                Title="All">
+ 	<MergeRef Id="MSVCRT8MEM"/>
+ 	<MergeRef Id="MSVCRT8POL"/>
+ 	<MergeRef Id="MSVCRT8MFC"/>
+ 	<MergeRef Id="MSVCRT8PFC"/>
+ 	<MergeRef Id="MSVCRT8MFL"/>
+ 	<MergeRef Id="MSVCRT8PFL"/>
+       </Feature>  
+ 
+       <Media Id="1" Cabinet="disk1.cab" CompressionLevel="high" EmbedCab="yes" />
+ 
+       <Property Id="INSTALLLEVEL" Value="3" />
+ 
+     </Product>
+ </Wix>
Index: openafs/src/WINNT/netidmgr_plugin/afsfuncs.c
diff -c openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.17 openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.18
*** openafs/src/WINNT/netidmgr_plugin/afsfuncs.c:1.1.2.17	Sat Jan  5 13:57:12 2008
--- openafs/src/WINNT/netidmgr_plugin/afsfuncs.c	Sat Mar 29 23:36:57 2008
***************
*** 22,28 ****
   * SOFTWARE.
   */
  
! /* $Id: afsfuncs.c,v 1.1.2.17 2008/01/05 18:57:12 jaltman Exp $ */
  
  /* Disable the 'macro redefinition' warning which is getting
     triggerred by a redefinition of the ENCRYPT and DECRYPT macros. */
--- 22,28 ----
   * SOFTWARE.
   */
  
! /* $Id: afsfuncs.c,v 1.1.2.18 2008/03/30 03:36:57 jaltman Exp $ */
  
  /* Disable the 'macro redefinition' warning which is getting
     triggerred by a redefinition of the ENCRYPT and DECRYPT macros. */
***************
*** 841,857 ****
              goto try_krb4;
          }
  
-         /* First try Service/Cell@REALM */
-         if (r = pkrb5_build_principal(context, &increds.server,
-                                          (int) strlen(RealmName),
-                                          RealmName,
-                                          ServiceName,
-                                          CellName,
-                                          0)) {
-             _reportf(L"krb5_build_principal returns %d", r);
-             goto end_krb5;
-         }
- 
          increds.client = client_principal;
          increds.times.endtime = 0;
          /* Ask for DES since that is what V4 understands */
--- 841,846 ----
***************
*** 861,912 ****
          flags = KRB5_TC_OPENCLOSE;
          r = pkrb5_cc_set_flags(context, k5cc, flags);
  #endif
!       retry_retcred:
!         r = pkrb5_get_credentials(context, 0, k5cc, &increds, &k5creds);
!         if ((r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
! 	      r == KRB5KRB_ERR_GENERIC /* Heimdal */) &&
! 	     !RealmName[0]) {
! 	    StringCbCopyA(RealmName, sizeof(RealmName), 
! 			  afs_realm_of_cell(&ak_cellconfig, TRUE));
! 
!             pkrb5_free_principal(context, increds.server);
! 	    r = pkrb5_build_principal(context, &increds.server,
! 					 (int) strlen(RealmName),
! 					 RealmName,
! 					 ServiceName,
! 					 CellName,
! 					 0);
!             if (r == 0)
!                 r = pkrb5_get_credentials(context, 0, k5cc, 
!                                           &increds, &k5creds);
! 	}
! 	if (r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!             r == KRB5KRB_ERR_GENERIC /* Heimdal */) {
!             /* Next try Service@REALM */
!             pkrb5_free_principal(context, increds.server);
!             r = pkrb5_build_principal(context, &increds.server,
!                                          (int) strlen(RealmName),
!                                          RealmName,
!                                          ServiceName,
!                                          0);
!             if (r == 0)
!                 r = pkrb5_get_credentials(context, 0, k5cc, 
!                                           &increds, &k5creds);
!         }
! 
! 	/* Check to make sure we received a valid ticket; if not remove it
! 	* and try again.  Perhaps there are two service tickets for the
! 	* same service in the ccache.
! 	*/
! 	if (r == 0 && k5creds && k5creds->times.endtime < time(NULL)) {
! 	    pkrb5_cc_remove_cred(context, k5cc, 0, k5creds);
! 	    pkrb5_free_creds(context, k5creds);
! 	    k5creds = NULL;
! 	    goto retry_retcred;
! 	}
  
!         if (r == 0 && strlen(RealmName) == 0) 
!             copy_realm_of_ticket(context, realm_of_cell, sizeof(realm_of_cell), k5creds);
  
          pkrb5_free_principal(context, increds.server);
          pkrb5_free_principal(context, client_principal);
--- 850,996 ----
          flags = KRB5_TC_OPENCLOSE;
          r = pkrb5_cc_set_flags(context, k5cc, flags);
  #endif
!         if (strlen(realm) != 0) {
!           retry_retcred_1:
!             /* First try Service/Cell@REALM */
!             if (r = pkrb5_build_principal(context, &increds.server,
!                                            (int) strlen(realm),
!                                            realm,
!                                            ServiceName,
!                                            CellName,
!                                            0)) {
!                 _reportf(L"krb5_build_principal returns %d", r);
!                 goto end_krb5;
!             }
  
!             r = pkrb5_get_credentials(context, 0, k5cc, &increds, &k5creds);
!             if (r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!                 r == KRB5_ERR_HOST_REALM_UNKNOWN ||
!                 r == KRB5KRB_ERR_GENERIC /* Heimdal */) {
!                 /* Next try Service@REALM */
!                 pkrb5_free_principal(context, increds.server);
!                 r = pkrb5_build_principal(context, &increds.server,
!                                            (int) strlen(realm),
!                                            realm,
!                                            ServiceName,
!                                            0);
!                 if (r == 0)
!                     r = pkrb5_get_credentials(context, 0, k5cc, 
!                                                &increds, &k5creds);
!             }
! 
!             /* Check to make sure we received a valid ticket; if not remove it
!              * and try again.  Perhaps there are two service tickets for the
!              * same service in the ccache.
!              */
!             if (r == 0 && k5creds && k5creds->times.endtime < time(NULL)) {
!                 pkrb5_free_principal(context, increds.server);
!                 pkrb5_cc_remove_cred(context, k5cc, 0, k5creds);
!                 pkrb5_free_creds(context, k5creds);
!                 k5creds = NULL;
!                 goto retry_retcred_1;
!             }
!         } else {
!           retry_retcred_2:
!             /* First try Service/Cell@_CLIENT_REALM */
!             if (r = pkrb5_build_principal(context, &increds.server,
!                                            (int) strlen(realm_of_user),
!                                            realm_of_user,
!                                            ServiceName,
!                                            CellName,
!                                            0)) {
!                 _reportf(L"krb5_build_principal returns %d", r);
!                 goto end_krb5;
!             }
! 
!             r = pkrb5_get_credentials(context, 0, k5cc, &increds, &k5creds);
!             if (r == 0) {
!                 /* the user realm is a valid cell realm */
!                 StringCbCopyA(realm_of_cell, sizeof(realm_of_cell), realm_of_user);
!             }
!             if (r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!                 r == KRB5_ERR_HOST_REALM_UNKNOWN ||
!                 r == KRB5KRB_ERR_GENERIC /* Heimdal */) {
!                 pkrb5_free_principal(context, increds.server);
!                 r = pkrb5_build_principal(context, &increds.server,
!                                            (int) strlen(realm_of_cell),
!                                            realm_of_cell,
!                                            ServiceName,
!                                            CellName,
!                                            0);
!                 if (r == 0)
!                     r = pkrb5_get_credentials(context, 0, k5cc, 
!                                                &increds, &k5creds);
!             }
!             if ((r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!                  r == KRB5_ERR_HOST_REALM_UNKNOWN ||
!                  r == KRB5KRB_ERR_GENERIC /* Heimdal */) &&
!                  strlen(realm_of_cell) == 0) {
!                 StringCbCopyA(realm_of_cell, sizeof(realm_of_cell), 
!                                afs_realm_of_cell(&ak_cellconfig, TRUE));
! 
!                 pkrb5_free_principal(context, increds.server);
!                 r = pkrb5_build_principal(context, &increds.server,
!                                            (int) strlen(realm_of_cell),
!                                            realm_of_cell,
!                                            ServiceName,
!                                            CellName,
!                                            0);
!                 if (r == 0)
!                     r = pkrb5_get_credentials(context, 0, k5cc, 
!                                                &increds, &k5creds);
!             }
!             if (r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!                 r == KRB5_ERR_HOST_REALM_UNKNOWN ||
!                 r == KRB5KRB_ERR_GENERIC /* Heimdal */) {
!                 /* Next try Service@REALM */
!                 StringCbCopyA(realm_of_cell, sizeof(realm_of_cell), 
!                                afs_realm_of_cell(&ak_cellconfig, FALSE));
! 
!                 pkrb5_free_principal(context, increds.server);
!                 r = pkrb5_build_principal(context, &increds.server,
!                                            (int) strlen(realm_of_cell),
!                                            realm_of_cell,
!                                            ServiceName,
!                                            0);
!                 if (r == 0)
!                     r = pkrb5_get_credentials(context, 0, k5cc, 
!                                                &increds, &k5creds);
!             }
!             if ((r == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ||
!                  r == KRB5_ERR_HOST_REALM_UNKNOWN ||
!                  r == KRB5KRB_ERR_GENERIC /* Heimdal */) &&
!                  strlen(realm_of_cell) == 0) {
!                 /* Next try Service@REALM */
!                 StringCbCopyA(realm_of_cell, sizeof(realm_of_cell), 
!                                afs_realm_of_cell(&ak_cellconfig, TRUE));
! 
!                 pkrb5_free_principal(context, increds.server);
!                 r = pkrb5_build_principal(context, &increds.server,
!                                            (int) strlen(realm_of_cell),
!                                            realm_of_cell,
!                                            ServiceName,
!                                            0);
!                 if (r == 0)
!                     r = pkrb5_get_credentials(context, 0, k5cc, 
!                                                &increds, &k5creds);
!             }
! 
!             if (r == 0 && strlen(realm_of_cell) == 0) 
!                 copy_realm_of_ticket(context, realm_of_cell, sizeof(realm_of_cell), k5creds);
! 
!             /* Check to make sure we received a valid ticket; if not remove it
!              * and try again.  Perhaps there are two service tickets for the
!              * same service in the ccache.
!              */
!             if (r == 0 && k5creds && k5creds->times.endtime < time(NULL)) {
!                 pkrb5_free_principal(context, increds.server);
!                 pkrb5_cc_remove_cred(context, k5cc, 0, k5creds);
!                 pkrb5_free_creds(context, k5creds);
!                 k5creds = NULL;
!                 goto retry_retcred_2;
!             }
!         }
  
          pkrb5_free_principal(context, increds.server);
          pkrb5_free_principal(context, client_principal);
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.110.2.14 openafs/src/afs/afs_pioctl.c:1.110.2.15
*** openafs/src/afs/afs_pioctl.c:1.110.2.14	Mon Mar 17 12:53:24 2008
--- openafs/src/afs/afs_pioctl.c	Sat Mar 22 00:19:13 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.110.2.14 2008/03/17 16:53:24 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.110.2.15 2008/03/22 04:19:13 jaltman Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
***************
*** 3850,3855 ****
--- 3850,3856 ----
      afs_uuid_create(&afs_cb_interface.uuid);
      ReleaseWriteLock(&afs_xinterface);
      ForceAllNewConnections();
+     return 0;
  }
  
  DECL_PIOCTL(PCallBackAddr)
Index: openafs/src/afs/afs_syscall.c
diff -c openafs/src/afs/afs_syscall.c:1.1.2.5 openafs/src/afs/afs_syscall.c:1.1.2.6
*** openafs/src/afs/afs_syscall.c:1.1.2.5	Mon Jun 18 13:06:24 2007
--- openafs/src/afs/afs_syscall.c	Mon Apr 21 14:59:34 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_syscall.c,v 1.1.2.5 2007/06/18 17:06:24 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/afs_syscall.c,v 1.1.2.6 2008/04/21 18:59:34 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 111,117 ****
      if (current->thread.flags & THREAD_IA32)
  
  #elif defined(AFS_PPC64_LINUX26_ENV)
!     if (current->thread_info->flags & _TIF_32BIT)
  #elif defined(AFS_PPC64_LINUX20_ENV)
      if (current->thread.flags & PPC_FLAG_32BIT)
  
--- 111,121 ----
      if (current->thread.flags & THREAD_IA32)
  
  #elif defined(AFS_PPC64_LINUX26_ENV)
! #if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
!     if (current->thread_info->flags & _TIF_32BIT) 
! #else
!     if (task_thread_info(current)->flags & _TIF_32BIT) 
! #endif      
  #elif defined(AFS_PPC64_LINUX20_ENV)
      if (current->thread.flags & PPC_FLAG_32BIT)
  
***************
*** 378,384 ****
--- 382,392 ----
      if (current->thread.flags & THREAD_IA32)
  
  #elif defined(AFS_PPC64_LINUX26_ENV)
+ #if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
      if (current->thread_info->flags & _TIF_32BIT) 
+ #else
+     if (task_thread_info(current)->flags & _TIF_32BIT) 
+ #endif      
  #elif defined(AFS_PPC64_LINUX20_ENV)
      if (current->thread.flags & PPC_FLAG_32BIT) 
  
Index: openafs/src/afs/LINUX/osi_file.c
diff -c openafs/src/afs/LINUX/osi_file.c:1.28.2.9 openafs/src/afs/LINUX/osi_file.c:1.28.2.10
*** openafs/src/afs/LINUX/osi_file.c:1.28.2.9	Sat Mar 22 20:53:46 2008
--- openafs/src/afs/LINUX/osi_file.c	Wed Mar 26 00:10:39 2008
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_file.c,v 1.28.2.9 2008/03/23 00:53:46 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include "h/module.h" /* early to avoid printf->printk mapping */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_file.c,v 1.28.2.10 2008/03/26 04:10:39 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include "h/module.h" /* early to avoid printf->printk mapping */
***************
*** 65,70 ****
--- 65,74 ----
      memset(afile, 0, sizeof(struct osi_file));
  #if defined(HAVE_IGET)
      tip = iget(afs_cacheSBp, (u_long) ainode);
+     if (!tip)
+ 	osi_Panic("Can't get inode %d\n", ainode);
+ 
+     dp = d_alloc_anon(tip);
  #else
      fid.i32.ino = ainode;
      fid.i32.gen = 0;
Index: openafs/src/afs/LINUX/osi_groups.c
diff -c openafs/src/afs/LINUX/osi_groups.c:1.28.4.12 openafs/src/afs/LINUX/osi_groups.c:1.28.4.13
*** openafs/src/afs/LINUX/osi_groups.c:1.28.4.12	Mon Mar 10 12:47:18 2008
--- openafs/src/afs/LINUX/osi_groups.c	Sat Apr 19 17:55:51 2008
***************
*** 20,26 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.28.4.12 2008/03/10 16:47:18 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 20,26 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.28.4.13 2008/04/19 21:55:51 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 51,62 ****
--- 51,64 ----
  
      crset(*cr);
  
+ #ifdef STRUCT_TASK_STRUCT_HAS_PARENT
      if (change_parent) {
  	old_info = current->parent->group_info;
  	get_group_info(group_info);
  	current->parent->group_info = group_info;
  	put_group_info(old_info);
      }
+ #endif
  
      return (0);
  }
***************
*** 625,656 ****
  void osi_keyring_init(void)
  {
      struct task_struct *p;
      
      if (__key_type_keyring == NULL) {
! #ifdef EXPORTED_TASKLIST_LOCK
  	if (&tasklist_lock)
  	    read_lock(&tasklist_lock);
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
- # ifdef EXPORTED_TASKLIST_LOCK
-  	else
  # endif
  	    rcu_read_lock();
! #endif
  	p = find_task_by_pid(1);
  	if (p && p->user->session_keyring)
  	    __key_type_keyring = p->user->session_keyring->type;
! #ifdef EXPORTED_TASKLIST_LOCK
  	if (&tasklist_lock)
  	    read_unlock(&tasklist_lock);
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
- # ifdef EXPORTED_TASKLIST_LOCK
- 	else
  # endif
  	    rcu_read_unlock();
! #endif
      }
  
      register_key_type(&key_type_afs_pag);
  }
--- 627,666 ----
  void osi_keyring_init(void)
  {
      struct task_struct *p;
+ 
+     /* If we can't lock the tasklist, either with its explicit lock,
+      * or by using the RCU lock, then we can't safely work out the 
+      * type of a keyring. So, we have to rely on the weak reference. 
+      * If that's not available, then keyring based PAGs won't work.
+      */
      
+ #if defined(EXPORTED_TASKLIST_LOCK) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(EXPORTED_RCU_READ_LOCK))
      if (__key_type_keyring == NULL) {
! # ifdef EXPORTED_TASKLIST_LOCK
  	if (&tasklist_lock)
  	    read_lock(&tasklist_lock);
  # endif
+ # if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(EXPORTED_RCU_READ_LOCK))
+ #  ifdef EXPORTED_TASKLIST_LOCK
+  	else
+ #  endif
  	    rcu_read_lock();
! # endif
  	p = find_task_by_pid(1);
  	if (p && p->user->session_keyring)
  	    __key_type_keyring = p->user->session_keyring->type;
! # ifdef EXPORTED_TASKLIST_LOCK
  	if (&tasklist_lock)
  	    read_unlock(&tasklist_lock);
  # endif
+ # if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(EXPORTED_RCU_READ_LOCK))
+ #  ifdef EXPORTED_TASKLIST_LOCK
+ 	else
+ #  endif
  	    rcu_read_unlock();
! # endif
      }
+ #endif
  
      register_key_type(&key_type_afs_pag);
  }
Index: openafs/src/afs/LINUX/osi_probe.c
diff -c openafs/src/afs/LINUX/osi_probe.c:1.11.2.13 openafs/src/afs/LINUX/osi_probe.c:1.11.2.14
*** openafs/src/afs/LINUX/osi_probe.c:1.11.2.13	Tue Aug 21 17:28:45 2007
--- openafs/src/afs/LINUX/osi_probe.c	Sun Apr  6 23:15:54 2008
***************
*** 45,50 ****
--- 45,51 ----
  
  /* Code to find the Linux syscall table */
  
+ #if defined(EXPORTED_INIT_MM)
  #ifdef OSI_PROBE_STANDALONE
  #define OSI_PROBE_DEBUG
  #endif
***************
*** 1481,1483 ****
--- 1482,1490 ----
  module_exit(osi_probe_exit);
  #endif
  #endif
+ #else
+ void *osi_find_syscall_table(int which)
+ {
+     return 0;
+ }
+ #endif /* EXPORTED_INIT_MM */
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.21 openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.25
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.21	Tue Nov 27 14:28:26 2007
--- openafs/src/afs/LINUX/osi_vnodeops.c	Tue Apr 15 08:29:37 2008
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.126.2.21 2007/11/27 19:28:26 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.126.2.25 2008/04/15 12:29:37 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 582,599 ****
  #endif
  {
      struct vrequest treq;
!     struct vcache *vcp = VTOAFS(FILE_INODE(fp));
!     cred_t *credp = crref();
      int code;
  
      AFS_GLOCK();
  
      code = afs_InitReq(&treq, credp);
      if (code)
  	goto out;
  
      ObtainSharedLock(&vcp->lock, 535);
!     if (vcp->execsOrWriters > 0) {
  	UpgradeSToWLock(&vcp->lock, 536);
  	code = afs_StoreAllSegments(vcp, &treq, AFS_SYNC | AFS_LASTSTORE);
  	ConvertWToSLock(&vcp->lock);
--- 582,607 ----
  #endif
  {
      struct vrequest treq;
!     struct vcache *vcp;
!     cred_t *credp;
      int code;
  
      AFS_GLOCK();
  
+     if ((fp->f_flags & O_ACCMODE) == O_RDONLY) { /* readers dont flush */
+ 	AFS_GUNLOCK();
+ 	return 0;
+     }
+ 
+     credp = crref();
+     vcp = VTOAFS(FILE_INODE(fp));
+ 
      code = afs_InitReq(&treq, credp);
      if (code)
  	goto out;
  
      ObtainSharedLock(&vcp->lock, 535);
!     if ((vcp->execsOrWriters > 0) && (file_count(fp) == 1)) {
  	UpgradeSToWLock(&vcp->lock, 536);
  	code = afs_StoreAllSegments(vcp, &treq, AFS_SYNC | AFS_LASTSTORE);
  	ConvertWToSLock(&vcp->lock);
***************
*** 813,820 ****
  	if (vcp == afs_globalVp)
  	    goto good_dentry;
  
! 	if (*dp->d_name.name != '/' && vcp->mvstat == 2)	/* root vnode */
! 	    check_bad_parent(dp);	/* check and correct mvid */
  
  #ifdef notdef
  	/* If the last looker changes, we should make sure the current
--- 821,834 ----
  	if (vcp == afs_globalVp)
  	    goto good_dentry;
  
! 	if (vcp->mvstat == 1) {         /* mount point */
! 	    if (vcp->mvid && (vcp->states & CMValid)) {
! 		/* a mount point, not yet replaced by its directory */
! 		goto bad_dentry;
! 	    }
! 	} else
! 	    if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */
! 		check_bad_parent(dp);	/* check and correct mvid */
  
  #ifdef notdef
  	/* If the last looker changes, we should make sure the current
Index: openafs/src/afs/VNOPS/afs_vnop_access.c
diff -c openafs/src/afs/VNOPS/afs_vnop_access.c:1.11.8.4 openafs/src/afs/VNOPS/afs_vnop_access.c:1.11.8.5
*** openafs/src/afs/VNOPS/afs_vnop_access.c:1.11.8.4	Fri Mar  7 12:31:28 2008
--- openafs/src/afs/VNOPS/afs_vnop_access.c	Wed Apr  9 09:39:19 2008
***************
*** 23,29 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_access.c,v 1.11.8.4 2008/03/07 17:31:28 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 23,29 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_access.c,v 1.11.8.5 2008/04/09 13:39:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 224,234 ****
  	return code;
      }
  
!     code = afs_VerifyVCache(avc, &treq);
!     if (code) {
! 	afs_PutFakeStat(&fakestate);
! 	code = afs_CheckCode(code, &treq, 16);
! 	return code;
      }
  
      /* if we're looking for write access and we have a read-only file system, report it */
--- 224,236 ----
  	return code;
      }
  
!     if (vType(avc) != VDIR || !afs_InReadDir(avc)) {
! 	code = afs_VerifyVCache(avc, &treq);
! 	if (code) {
! 	    afs_PutFakeStat(&fakestate);
! 	    code = afs_CheckCode(code, &treq, 16);
! 	    return code;
! 	}
      }
  
      /* if we're looking for write access and we have a read-only file system, report it */
Index: openafs/src/afs/VNOPS/afs_vnop_lookup.c
diff -c openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.72.2.5 openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.72.2.6
*** openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.72.2.5	Fri Mar  7 12:31:28 2008
--- openafs/src/afs/VNOPS/afs_vnop_lookup.c	Tue Apr 15 08:29:39 2008
***************
*** 18,24 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.72.2.5 2008/03/07 17:31:28 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.72.2.6 2008/04/15 12:29:39 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 1208,1213 ****
--- 1208,1214 ----
      register afs_int32 code;
      register afs_int32 bulkcode = 0;
      int pass = 0, hit = 0;
+     int force_eval = afs_fakestat_enable ? 0 : 1;
      long dirCookie;
      extern afs_int32 afs_mariner;	/*Writing activity to log? */
      afs_hyper_t versionNo;
***************
*** 1596,1603 ****
      }				/* sub-block just to reduce stack usage */
  
      if (tvc) {
- 	int force_eval = afs_fakestat_enable ? 0 : 1;
- 
  	if (adp->states & CForeign)
  	    tvc->states |= CForeign;
  	tvc->parentVnode = adp->fid.Fid.Vnode;
--- 1597,1602 ----
***************
*** 1618,1623 ****
--- 1617,1625 ----
  		force_eval = 1;
  	    ReleaseReadLock(&tvc->lock);
  	}
+ 	if (tvc->mvstat == 1 && (tvc->states & CMValid) && tvc->mvid != NULL)
+ 	  force_eval = 1; /* This is now almost for free, get it correct */
+ 
  #if defined(UKERNEL) && defined(AFS_WEB_ENHANCEMENTS)
  	if (!(flags & AFS_LOOKUP_NOEVAL))
  	    /* don't eval mount points */
***************
*** 1743,1749 ****
  	     * rather than the vc of the mount point itself.  we can still find the
  	     * mount point's vc in the vcache by its fid. */
  #endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */
! 	    if (!hit) {
  		osi_dnlc_enter(adp, aname, tvc, &versionNo);
  	    } else {
  #ifdef AFS_LINUX20_ENV
--- 1745,1751 ----
  	     * rather than the vc of the mount point itself.  we can still find the
  	     * mount point's vc in the vcache by its fid. */
  #endif /* UKERNEL && AFS_WEB_ENHANCEMENTS */
! 	    if (!hit && force_eval) {
  		osi_dnlc_enter(adp, aname, tvc, &versionNo);
  	    } else {
  #ifdef AFS_LINUX20_ENV
Index: openafs/src/aklog/aklog.c
diff -c openafs/src/aklog/aklog.c:1.5 openafs/src/aklog/aklog.c:1.5.4.1
*** openafs/src/aklog/aklog.c:1.5	Thu Jul 14 21:19:27 2005
--- openafs/src/aklog/aklog.c	Tue Apr  1 13:44:40 2008
***************
*** 1,19 ****
  /* 
!  * $Id: aklog.c,v 1.5 2005/07/15 01:19:27 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.5 2005/07/15 01:19:27 rra Exp $";
  #endif /* lint || SABER */
  
  #include <afs/stds.h>
  #include "aklog.h"
  
- #ifndef WINDOWS
- 
  int
  main(int argc, char *argv[])
  {
--- 1,17 ----
  /* 
!  * $Id: aklog.c,v 1.5.4.1 2008/04/01 17:44:40 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.5.4.1 2008/04/01 17:44:40 shadow Exp $";
  #endif /* lint || SABER */
  
  #include <afs/stds.h>
  #include "aklog.h"
  
  int
  main(int argc, char *argv[])
  {
***************
*** 21,107 ****
      exit(0);
  }
  
- #else /* WINDOWS */
- 
- #include <windows.h>
- #include <windowsx.h>
- 
- static void parse_cmdline();
- 
- 
- int PASCAL
- WinMain(HINSTANCE hinst, HINSTANCE hprevinstance, LPSTR cmdline, int noshow)
- {
- 	int argc = 0;
- 	char **argv;
- 
-     aklog_params params;
- 
- 	parse_cmdline(cmdline, &argv, &argc);
- 
-     aklog(argc, argv, &params);
- 
- 	return 0;
- }
- 
- /*
-  * Generate agrv/argc here from command line.
-  * Note that windows doesn't pass us the executible name, so
-  * we need to fill that in manually.
-  */
- 
- static void
- parse_cmdline(char *cmdline, char ***pargv, int *pargc)
- {
- 	char **argv;
- 	int argc = 0;
- 	char *arg, *sep = " \t";
- 	int argv_size = 10;		/* to start with */
- 
- 
- 	argv = malloc(argv_size * sizeof(char *));
- 
- 	if (!argv) {
- 		MessageBox(NULL, "Fatal Error: Out of memory", AKLOG_DIALOG_NAME, 
- 				   MB_OK | MB_ICONSTOP);
- 		exit(1);
- 	}
- 
- 	argv[argc++] = "aklog";
- 
- 	arg = strtok(cmdline, sep);
- 
- 	while(arg) {
- 		argv[argc] = strdup(arg);
- 
- 		if (!argv[argc]) {
- 			MessageBox(NULL, "Fatal Error: Out of memory", AKLOG_DIALOG_NAME, 
- 					   MB_OK | MB_ICONSTOP);
- 			exit(1);
- 		}
- 
- 		argc++;
- 
- 		if (argc == argv_size) {
- 			argv_size += 10;
- 			argv = realloc(argv, argv_size * sizeof(char *));
- 
- 			if (!argv) {
- 				MessageBox(NULL, "Fatal Error: Out of memory",
- 						   AKLOG_DIALOG_NAME, 
- 						   MB_OK | MB_ICONSTOP);
- 				exit(1);
- 			}
- 		}
- 
- 		arg = strtok(NULL, sep);
- 	}
- 
- 	argv[argc] = NULL;
- 
- 	*pargv = argv;
- 	*pargc = argc;
- }
- 
- #endif /* WINDOWS */
- 
--- 19,21 ----
Index: openafs/src/aklog/aklog.h
diff -c openafs/src/aklog/aklog.h:1.5.2.1 openafs/src/aklog/aklog.h:1.5.2.2
*** openafs/src/aklog/aklog.h:1.5.2.1	Wed Jul 11 00:31:06 2007
--- openafs/src/aklog/aklog.h	Tue Apr  1 13:44:40 2008
***************
*** 1,5 ****
  /* 
!  * $Id: aklog.h,v 1.5.2.1 2007/07/11 04:31:06 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.h,v 1.5.2.2 2008/04/01 17:44:40 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
***************
*** 8,17 ****
  #ifndef __AKLOG_H__
  #define __AKLOG_H__
  
- #if !defined(lint) && !defined(SABER)
- static char *rcsid_aklog_h = "$Id: aklog.h,v 1.5.2.1 2007/07/11 04:31:06 shadow Exp $";
- #endif /* lint || SABER */
- 
  #include <krb5.h>
  #include "linked_list.h"
  #include <afsconfig.h>
--- 8,13 ----
Index: openafs/src/aklog/aklog_main.c
diff -c openafs/src/aklog/aklog_main.c:1.12.2.12 openafs/src/aklog/aklog_main.c:1.12.2.15
*** openafs/src/aklog/aklog_main.c:1.12.2.12	Fri Jan  4 23:46:52 2008
--- openafs/src/aklog/aklog_main.c	Tue Apr  1 14:15:40 2008
***************
*** 1,5 ****
  /* 
!  * $Id: aklog_main.c,v 1.12.2.12 2008/01/05 04:46:52 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.12.2.15 2008/04/01 18:15:40 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
***************
*** 34,45 ****
   * such damages.                                                
   */
  
- #if !defined(lint) && !defined(SABER)
- static char *rcsid =
- 	"$Id: aklog_main.c,v 1.12.2.12 2008/01/05 04:46:52 shadow Exp $";
- #endif /* lint || SABER */
- 
  #include <afsconfig.h>
  #include <stdio.h>
  #include <string.h>
  #include <ctype.h>
--- 34,42 ----
   * such damages.                                                
   */
  
  #include <afsconfig.h>
+ RCSID
+      ("$Header: /cvs/openafs/src/aklog/aklog_main.c,v 1.12.2.15 2008/04/01 18:15:40 shadow Exp $");
  #include <stdio.h>
  #include <string.h>
  #include <ctype.h>
***************
*** 58,64 ****
  #include <sys/stat.h>
  #include <fcntl.h>
  
- #ifndef WINDOWS
  #include <sys/param.h>
  #include <sys/errno.h>
  #include <netdb.h>
--- 55,60 ----
***************
*** 66,82 ****
  #include <netinet/in.h>
  #include <arpa/inet.h>
  #include <pwd.h>
- #endif /* WINDOWS */
  
  #include <afs/stds.h>
  #include <krb5.h>
  
- #ifdef WINDOWS
- 
- #include <afs/auth.h>
- #include <afs/dirpath.h>
- 
- #else /* !WINDOWS */
  #ifndef HAVE_KERBEROSV_HEIM_ERR_H
  #include <afs/com_err.h>
  #endif
--- 62,71 ----
***************
*** 92,98 ****
  #include <afs/ptserver.h>
  #include <afs/ptuser.h>
  #include <afs/dirpath.h>
- #endif /* WINDOWS */
  
  #include "aklog.h"
  #include "linked_list.h"
--- 81,86 ----
***************
*** 111,116 ****
--- 99,105 ----
  #define AFS_TRY_FULL_PRINC 1
  #endif /* AFS_TRY_FULL_PRINC */
  
+ #define AKLOG_TRYAGAIN -1
  #define AKLOG_SUCCESS 0
  #define AKLOG_USAGE 1
  #define AKLOG_SOMETHINGSWRONG 2
***************
*** 152,167 ****
  static char linkedcell2[MAXCELLCHARS+1];
  static krb5_ccache  _krb425_ccache = NULL;
  
- #ifdef WINDOWS
- 
- /* libafsconf.dll */
- extern long cm_GetRootCellName();
- extern long cm_SearchCellFile();
- 
- static long cm_SearchCellFile_CallBack();
- 
- #else /* !WINDOWS */
- 
  /*
   * Why doesn't AFS provide these prototypes?
   */
--- 141,146 ----
***************
*** 178,183 ****
--- 157,166 ----
  				  char *, krb5_creds **);
  static int get_user_realm(krb5_context, char *);
  
+ #define TRYAGAIN(x) (x == AKLOG_TRYAGAIN || \
+ 		     x == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || \
+ 		     x == KRB5KRB_ERR_GENERIC)
+ 
  #if defined(HAVE_KRB5_PRINC_SIZE) || defined(krb5_princ_size)
  
  #define get_princ_str(c, p, n) krb5_princ_component(c, p, n)->data
***************
*** 299,305 ****
  
  #define deref_entry_enctype(entry)			\
      deref_keyblock_enctype(&deref_entry_keyblock(entry))
- #endif /* WINDOWS */
  
  /*
   * Provide a replacement for strerror if we don't have it
--- 282,287 ----
***************
*** 361,368 ****
      memset(local_cell, 0, sizeof(local_cell));
      memset((char *)cellconfig, 0, sizeof(*cellconfig));
  
- #ifndef WINDOWS
- 
      if (!(configdir = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH))) {
  	fprintf(stderr, 
  		"%s: can't get afs configuration (afsconf_Open(%s))\n",
--- 343,348 ----
***************
*** 389,489 ****
  
      (void) afsconf_Close(configdir);
  
- #else /* WINDOWS */
-     /*
-      * We'll try to mimic the GetCellInfo call here and fill in as much
-      * of the afsconf_cell structure as we can.
-      */
-     if (cm_GetRootCellName(local_cell)) {
- 	fprintf(stderr, "%s: can't get local cellname\n", progname);
- 	exit(AKLOG_AFS);
-     }
- 
-     if ((cell == NULL) || (cell[0] == 0))
- 	cell = local_cell;
- 
-     strcpy(cellconfig->name, cell);
- 
-     /* No way of figuring this out as far as I can tell */
-     linkedcell[0] = '\0';
- 
-     /* Initialize server info */
-     cellconfig->numServers = 0;
-     cellconfig->hostName[0][0] = "\0";
- 
-     /*
-      * Get servers of cell. cm_SearchCellFile_CallBack() gets call with
-      * each server.
-      */
-     status = (int) cm_SearchCellFile(cell, NULL, &cm_SearchCellFile_CallBack,
- 				     cellconfig /* rock */);
- 
-     switch(status) {
-     case 0:
- 	break;
- 
-     case -1:
- 	fprintf(stderr, "%s: GetWindowsDirectory() failed.\n", progname);
- 	break;
- 
-     case -2:
- 	fprintf(stderr, "%s: Couldn't open afsdcells.ini for reading\n",
- 		progname);
- 	break;
- 
-     case -3:
- 	fprintf(stderr, "%s: Couldn't find any servers for cell %s\n",
- 		progname, cell);
- 	break;
- 
-     case -4:
- 	fprintf(stderr, "%s: Badly formatted line in afsdcells.ini (does not begin with a \">\" or contain \"#\"\n",
- 		progname);
- 	break;
- 
-     default:
- 	fprintf(stderr, "%s cm_SearchCellFile returned unknown error %d\n",
- 		status);
-     }
- 
-     if (status) {
- 	exit(AKLOG_AFS);
-     }
- 
-     status = AKLOG_SUCCESS;
- 
-     
- #endif /* WINDOWS */
- 
      return(status);
  }
  
- 
- #ifdef WINDOWS
- /*
-  * Callback function for cm_SearchCellFile() in get_cellconfig() above.
-  * This function gets called once for each server that is found for the cell.
-  */
- static long
- cm_SearchCellFile_CallBack(void *rock /* cellconfig */,
- 			   struct sockaddr_in *addr, /* Not used */
- 			   char *server)
- {
-     struct afsconf_cell *cellconfig = rock;
- 
- 
-     /*
-      * Save server name and increment count of servers
-      */
-     strcpy(cellconfig->hostName[cellconfig->numServers++], server);
-     
-     return (long) 0;
- }
- 
-     
- #endif /* WINDOWS */
- 
- 
  /* 
   * Log to a cell.  If the cell has already been logged to, return without
   * doing anything.  Otherwise, log to it and mark that it has been logged
--- 369,377 ----
***************
*** 495,533 ****
      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 */
-     char secondary_instance[INST_SZ];	/* Backup instance to try */
-     int try_secondary = 0;		/* Flag to indicate if we try second */
      char realm_of_user[REALM_SZ]; /* Kerberos realm of user */
!     char realm_of_cell[REALM_SZ]; /* Kerberos realm of cell */
      char local_cell[MAXCELLCHARS+1];
      char cell_to_use[MAXCELLCHARS+1]; /* Cell to authenticate to */
      static char lastcell[MAXCELLCHARS+1] = { 0 };
- #ifndef WINDOWS
      static char confname[512] = { 0 };
- #endif
      krb5_creds *v5cred = NULL;
      struct ktc_principal aserver;
      struct ktc_principal aclient;
      struct ktc_token atoken, btoken;
  
- #ifdef ALLOW_REGISTER
-     afs_int32 id;
- #endif /* ALLOW_REGISTER */
- 
-     memset(name, 0, sizeof(name));
-     memset(primary_instance, 0, sizeof(primary_instance));
-     memset(secondary_instance, 0, sizeof(secondary_instance));
      memset(realm_of_user, 0, sizeof(realm_of_user));
-     memset(realm_of_cell, 0, sizeof(realm_of_cell));
  
- #ifndef WINDOWS
      if (confname[0] == '\0') {
  	strncpy(confname, AFSDIR_CLIENT_ETC_DIRPATH, sizeof(confname));
  	confname[sizeof(confname) - 2] = '\0';
      }
- #endif /* WINDOWS */
  
      /* NULL or empty cell returns information on local cell */
      if ((status = get_cellconfig(cell, &ak_cellconfig,
--- 383,408 ----
      char username[BUFSIZ];	/* To hold client username structure */
      afs_int32 viceId;		/* AFS uid of user */
  
      char realm_of_user[REALM_SZ]; /* Kerberos realm of user */
!     char *realm_from_princ = 0 ;  /* Calculated realm data */
!     char *realm_of_cell = 0;	  /* Pointer to realm we're using */	
!     int retry;			  /* round, and round we go ... */
!     
      char local_cell[MAXCELLCHARS+1];
      char cell_to_use[MAXCELLCHARS+1]; /* Cell to authenticate to */
      static char lastcell[MAXCELLCHARS+1] = { 0 };
      static char confname[512] = { 0 };
      krb5_creds *v5cred = NULL;
      struct ktc_principal aserver;
      struct ktc_principal aclient;
      struct ktc_token atoken, btoken;
  
      memset(realm_of_user, 0, sizeof(realm_of_user));
  
      if (confname[0] == '\0') {
  	strncpy(confname, AFSDIR_CLIENT_ETC_DIRPATH, sizeof(confname));
  	confname[sizeof(confname) - 2] = '\0';
      }
  
      /* NULL or empty cell returns information on local cell */
      if ((status = get_cellconfig(cell, &ak_cellconfig,
***************
*** 578,677 ****
  		   cell_to_use, ak_cellconfig.hostName[0]);
  	}
  
! 	/*
! 	 * Find out which realm we're supposed to authenticate to.  If one
! 	 * is not included, use the kerberos realm found in the credentials
! 	 * cache.
! 	 */
! 
! 	if (realm && realm[0]) {
! 	    strcpy(realm_of_cell, realm);
! 	    if (dflag) {
! 		printf("We were told to authenticate to realm %s.\n", realm);
! 	    }
  	}
- 	else {
- 	    char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, FALSE);
  
! 	    if (!afs_realm) {
! 		fprintf(stderr, 
! 			"%s: Couldn't figure out realm for cell %s.\n",
! 			progname, cell_to_use);
! 		exit(AKLOG_MISC);
  	    }
! 
! 	    strcpy(realm_of_cell, afs_realm);
! 
! 	    if (dflag) {
! 		if (realm_of_cell[0])
! 		    printf("We've deduced that we need to authenticate to"
! 			   " realm %s.\n", realm_of_cell);
! 		else
! 		    printf("We've deduced that we need to authenticate "
! 			   "using referrals.\n");
  	    }
- 	}
- 
- 	/* We use the afs.<cellname> convention here... 
- 	 *
- 	 * Doug Engert's original code had principals of the form:
- 	 *
- 	 * "afsx/cell@realm"
- 	 *
- 	 * in the KDC, so the name wouldn't conflict with DFS.  Since we're
- 	 * not using DFS, I changed it just to look for the following
- 	 * principals:
- 	 *
- 	 * afs/<cell>@<realm>
- 	 * afs@<realm>
- 	 *
- 	 * Because people are transitioning from afs@realm to afs/cell,
- 	 * we configure things so that if the first one isn't found, we
- 	 * try the second one.  You can select which one you prefer with
- 	 * a configure option.
- 	 */
  
! 	strcpy(name, AFSKEY);
  
! 	if (AFS_TRY_FULL_PRINC || strcasecmp(cell_to_use, realm_of_cell) != 0) {
! 	    strncpy(primary_instance, cell_to_use, sizeof(primary_instance));
! 	    primary_instance[sizeof(primary_instance)-1] = '\0';
! 	    if (strcasecmp(cell_to_use, realm_of_cell) == 0) {
! 		try_secondary = 1;
! 		secondary_instance[0] = '\0';
  	    }
! 	} else {
! 	    primary_instance[0] = '\0';
! 	    try_secondary = 1;
! 	    strncpy(secondary_instance, cell_to_use,
! 		    sizeof(secondary_instance));
! 	    secondary_instance[sizeof(secondary_instance)-1] = '\0';
  	}
! 
! 	/* 
! 	 * Extract the session key from the ticket file and hand-frob an
! 	 * afs style authenticator.
! 	 */
! 
! 	/*
! 	 * Try to obtain AFS tickets.  Because there are two valid service
! 	 * names, we will try both, but trying the more specific first.
! 	 *
! 	 *	afs/<cell>@<realm> i.e. allow for single name with "."
! 	 * 	afs@<realm>
  	 */
- 
- 	if (dflag) {
- 	    printf("Getting tickets: %s%s%s@%s\n", name,
- 		   primary_instance[0] ? "/" : "", 
- 		   primary_instance, realm_of_cell);
- 	}
- 
- 	status = get_credv5(context, name, primary_instance, realm_of_cell,
- 			    &v5cred);
- 
  #if !defined(USING_HEIMDAL) && defined(HAVE_KRB5_DECODE_TICKET)
! 	if (status == 0 && strcmp(realm_of_cell, "") == 0) {
  	    krb5_error_code code;
  	    krb5_ticket *ticket;
  
--- 453,580 ----
  		   cell_to_use, ak_cellconfig.hostName[0]);
  	}
  
! 	if ((status = get_user_realm(context, realm_of_user))) {
! 	    fprintf(stderr, "%s: Couldn't determine realm of user:)",
! 		    progname);
! 	    afs_com_err(progname, status, " while getting realm");
! 	    return(AKLOG_KERBEROS);
  	}
  
! 	retry = 1;
! 	
! 	while(retry) {
! 	    
! 	    /* Cell on command line - use that one */
! 	    if (realm && realm[0]) {
! 		realm_of_cell = realm;
! 		status = AKLOG_TRYAGAIN;
! 		if (dflag) {
! 		    printf("We were told to authenticate to realm %s.\n", 
! 			   realm);
! 		}
! 	    } else {
! 		/* Initially, try using afs/cell@USERREALM */
! 		if (dflag) {
! 		    printf("Trying to authenticate to user's realm %s.\n",
! 			   realm_of_user);
! 		}
! 		
! 		realm_of_cell = realm_of_user;
! 		status = get_credv5(context, AFSKEY, cell_to_use, 
! 				    realm_of_cell, &v5cred);
! 	    
! 		/* If that failed, try to determine the realm from the name of 
! 		 * one of the DB servers */
! 		if (TRYAGAIN(status)) {
! 		    realm_of_cell = afs_realm_of_cell(context, &ak_cellconfig, 
! 				    		      FALSE);
! 		    if (!realm_of_cell) {
! 			fprintf(stderr, 
! 				"%s: Couldn't figure out realm for cell %s.\n",
! 				progname, cell_to_use);
! 		    	exit(AKLOG_MISC);
! 	    	    }
! 
! 		    if (dflag) {
! 			if (realm_of_cell[0])
! 			    printf("We've deduced that we need to authenticate"
! 				   " to realm %s.\n", realm_of_cell);
! 		    else
! 			printf("We've deduced that we need to authenticate "
! 			       "using referrals.\n");
! 		    }
! 		}
  	    }
! 	
! 	    if (TRYAGAIN(status)) {
! 		/* If we've got the full-princ-first option, or we're in a
! 		 * different realm from the cell - use the cell name as the
! 		 * instance */
! 		if (AFS_TRY_FULL_PRINC || 
! 		    strcasecmp(cell_to_use, realm_of_cell)!=0) {
! 		    status = get_credv5(context, AFSKEY, cell_to_use, 
! 				        realm_of_cell, &v5cred);
! 
! 		    /* If we failed & we've got an empty realm, then try 
! 		     * calling afs_realm_for_cell again. */
! 		    if (TRYAGAIN(status) && !realm_of_cell[0]) {
! 			/* This time, get the realm by taking the domain 
! 			 * component of the db server and make it upper case */
! 		    	realm_of_cell = afs_realm_of_cell(context, 
! 							  &ak_cellconfig, TRUE);
! 			if (!realm_of_cell) {
! 			    fprintf(stderr,
! 				    "%s: Couldn't figure out realm for cell "
! 				    "%s.\n", progname, cell_to_use);
! 			    exit(AKLOG_MISC);
! 			}
! 			printf("We've deduced that we need to authenticate to"
! 			       " realm %s.\n", realm_of_cell);
! 		    }
! 		    status = get_credv5(context, AFSKEY, cell_to_use, 
! 				        realm_of_cell, &v5cred);
! 	    	}
! 	   
! 		/* If the realm and cell name match, then try without an 
! 		 * instance, but only if realm is non-empty */
! 	        
! 		if (TRYAGAIN(status) && 
! 		    strcasecmp(cell_to_use, realm_of_cell) == 0) {
! 		    status = get_credv5(context, AFSKEY, NULL, 
! 				        realm_of_cell, &v5cred);
!     		    if (!AFS_TRY_FULL_PRINC && TRYAGAIN(status)) {
! 		        status = get_credv5(context, AFSKEY, cell_to_use,
! 				            realm_of_cell, &v5cred);
! 		    }
! 		}
  	    }
  
! 	    /* Try to find a service principal for this cell.
! 	     * Some broken MIT libraries return KRB5KRB_AP_ERR_MSG_TYPE upon 
! 	     * the first attempt, so we try twice to be sure */
  
! 	    if (status == KRB5KRB_AP_ERR_MSG_TYPE && retry == 1)
! 		retry++;
! 	    else
! 		retry = 0;
! 	} 
! 	
! 	if (status != 0) {
! 	    if (dflag) {
! 		printf("Kerberos error code returned by get_cred : %d\n",
! 		       status);
  	    }
! 	    fprintf(stderr, "%s: Couldn't get %s AFS tickets:\n",
! 		    progname, cell_to_use);
! 	    afs_com_err(progname, status, "while getting AFS tickets");
! 	    return(AKLOG_KERBEROS);
  	}
! 	
! 	/* If we've got a valid ticket, and we still don't know the realm name
! 	 * try to figure it out from the contents of the ticket
  	 */
  #if !defined(USING_HEIMDAL) && defined(HAVE_KRB5_DECODE_TICKET)
! 	if (strcmp(realm_of_cell, "") == 0) {
  	    krb5_error_code code;
  	    krb5_ticket *ticket;
  
***************
*** 681,756 ****
  		fprintf(stderr,
  			"%s: Couldn't decode ticket to determine realm for "
  			"cell %s.\n",
! 			progname, cell_to_use);
  	    } else {
  		int len = realm_len(context, ticket->server);
  		/* This really shouldn't happen. */
  		if (len > REALM_SZ-1)
  		    len = REALM_SZ-1;
  
! 		strncpy(realm_of_cell, realm_data(context, ticket->server), 
  			len);
! 		realm_of_cell[len] = 0;
! 
  		krb5_free_ticket(context, ticket);
  	    }
  	}
  #endif
  
- 	if ((status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) &&
- 	    !realm_of_cell[0]) {
- 	    char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, TRUE);
- 
- 	    if (!afs_realm) {
- 		fprintf(stderr, 
- 			"%s: Couldn't figure out realm for cell %s.\n",
- 			progname, cell_to_use);
- 		exit(AKLOG_MISC);
- 	    }
- 
- 	    strcpy(realm_of_cell, afs_realm);
- 
- 	    if (strcasecmp(cell_to_use, realm_of_cell) == 0) {
- 		try_secondary = 1;
- 		secondary_instance[0] = '\0';
- 	    }
- 
- 	    if (dflag) {
- 		printf("We've deduced that we need to authenticate to"
- 			" realm %s.\n", realm_of_cell);
- 		printf("Getting tickets: %s%s%s@%s\n", name,
- 			primary_instance[0] ? "/" : "", 
- 			primary_instance, realm_of_cell);
- 	    }
- 
- 	    status = get_credv5(context, name, primary_instance, realm_of_cell,
- 				 &v5cred);
- 
- 	}
- 	if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) {
- 	    if (try_secondary) {
- 		if (dflag) {
- 		    printf("Principal not found, trying alternate "
- 			   "service name: %s%s%s@%s\n", name,
- 			    secondary_instance[0] ? "/" : "",
- 			    secondary_instance, realm_of_cell);
- 		}
- 		status = get_credv5(context, name, secondary_instance,
- 				    realm_of_cell, &v5cred);
- 	    }
- 	}
- 
- 	if (status) {
- 	    if (dflag) {
- 		printf("Kerberos error code returned by get_cred: %d\n",
- 			status);
- 	    }
- 	    fprintf(stderr, "%s: Couldn't get %s AFS tickets:\n",
- 		    progname, cell_to_use);
- 		afs_com_err(progname, status, "while getting AFS tickets");
- 	    return(AKLOG_KERBEROS);
- 	}
- 
  	strncpy(aserver.name, AFSKEY, MAXKTCNAMELEN - 1);
  	strncpy(aserver.instance, AFSINST, MAXKTCNAMELEN - 1);
  	strncpy(aserver.cell, cell_to_use, MAXKTCREALMLEN - 1);
--- 584,608 ----
  		fprintf(stderr,
  			"%s: Couldn't decode ticket to determine realm for "
  			"cell %s.\n",
! 		    	progname, cell_to_use);
  	    } else {
  		int len = realm_len(context, ticket->server);
  		/* This really shouldn't happen. */
  		if (len > REALM_SZ-1)
  		    len = REALM_SZ-1;
  
! 		realm_from_princ = (char *) malloc(sizeof(char) * (len+1));
! 		
! 		strncpy(realm_from_princ, realm_data(context, ticket->server), 
  			len);
! 		realm_from_princ[len] = 0;
! 		realm_of_cell = realm_from_princ;
! 		
  		krb5_free_ticket(context, ticket);
  	    }
  	}
  #endif
  
  	strncpy(aserver.name, AFSKEY, MAXKTCNAMELEN - 1);
  	strncpy(aserver.instance, AFSINST, MAXKTCNAMELEN - 1);
  	strncpy(aserver.cell, cell_to_use, MAXKTCREALMLEN - 1);
***************
*** 846,867 ****
  	noprdb = 1;
  #endif
  
- #ifndef WINDOWS
  	if (noprdb) {
- #endif
  	    if (dflag) {
  		printf("Not resolving name %s to id (-noprdb set)\n",
  			username);
  	    }
- #ifndef WINDOWS
  	}
  	else {
- 	    if ((status = get_user_realm(context, realm_of_user))) {
- 		fprintf(stderr, "%s: Couldn't determine realm of user:)",
- 			progname);
- 		afs_com_err(progname, status, " while getting realm");
- 		return(AKLOG_KERBEROS);
- 	    }
  	    if (strcmp(realm_of_user, realm_of_cell)) {
  		strcat(username, "@");
  		strcat(username, realm_of_user);
--- 698,710 ----
***************
*** 900,918 ****
  		 */
  
  #ifdef ALLOW_REGISTER
! 	if (status == 0) {
! 	    if (viceId != ANONYMOUSID) {
! #else /* ALLOW_REGISTER */
! 	    if ((status == 0) && (viceId != ANONYMOUSID))
! #endif /* ALLOW_REGISTER */
! 		sprintf (username, "AFS ID %d", (int) viceId);
! #ifdef ALLOW_REGISTER
! 	    } else if (strcmp(realm_of_user, realm_of_cell) != 0) {
  		if (dflag) {
  		    printf("doing first-time registration of %s "
  			    "at %s\n", username, cell_to_use);
  		}
! 		id = 0;
  		strncpy(aclient.name, username, MAXKTCNAMELEN - 1);
  		strcpy(aclient.instance, "");
  		strncpy(aclient.cell, realm_of_user, MAXKTCREALMLEN - 1);
--- 743,755 ----
  		 */
  
  #ifdef ALLOW_REGISTER
! 	    if ((status == 0) && (viceId == ANONYMOUSID) &&
! 	 	(strcmp(realm_of_user, realm_of_cell) != 0)) {
  		if (dflag) {
  		    printf("doing first-time registration of %s "
  			    "at %s\n", username, cell_to_use);
  		}
! 		viceId = 0;
  		strncpy(aclient.name, username, MAXKTCNAMELEN - 1);
  		strcpy(aclient.instance, "");
  		strncpy(aclient.cell, realm_of_user, MAXKTCREALMLEN - 1);
***************
*** 933,954 ****
  		    printf("Error %d\n", status);
  		}
  
! 		if ((status = pr_CreateUser(username, &id))) {
  		    fprintf(stderr, "%s: %s so unable to create remote PTS "
  			    "user %s in cell %s (status: %d).\n", progname,
! 			    error_message(status), username, cell_to_use,
  			    status);
  		} else {
  		    printf("created cross-cell entry for %s (Id %d) at %s\n",
! 			   username, id, cell_to_use);
! 		    sprintf(username, "AFS ID %d", (int) id);
  		}
  	    }
- 	}
  #endif /* ALLOW_REGISTER */
  
  	}
- #endif /* !WINDOWS */
  
  	if (dflag) {
  	    fprintf(stdout, "Set username to %s\n", username);
--- 770,792 ----
  		    printf("Error %d\n", status);
  		}
  
! 		if ((status = pr_CreateUser(username, &viceId))) {
  		    fprintf(stderr, "%s: %s so unable to create remote PTS "
  			    "user %s in cell %s (status: %d).\n", progname,
! 			    afs_error_message(status), username, cell_to_use,
  			    status);
+ 		    viceId = ANONYMOUSID;
  		} else {
  		    printf("created cross-cell entry for %s (Id %d) at %s\n",
! 			   username, viceId, cell_to_use);
  		}
  	    }
  #endif /* ALLOW_REGISTER */
  
+ 	    if ((status == 0) && (viceId != ANONYMOUSID)) {
+ 		sprintf(username, "AFS ID %d", (int) viceId);
+ 	    }
  	}
  
  	if (dflag) {
  	    fprintf(stdout, "Set username to %s\n", username);
***************
*** 974,1011 ****
  	 */
  	write(2,"",0); /* dummy write */
  #endif
- #ifndef WINDOWS
  	if ((status = ktc_SetToken(&aserver, &atoken, &aclient, afssetpag))) {
  	    fprintf(stderr, 
  		    "%s: unable to obtain tokens for cell %s (status: %d).\n",
  		    progname, cell_to_use, status);
  	    status = AKLOG_TOKEN;
  	}
- #else /* WINDOWS */
- 	/* Note switched 2nd and 3rd args */
- 	if ((status = ktc_SetToken(&aserver, &atoken, &aclient, afssetpag))) {
- 	    switch(status) {
- 	    case KTC_INVAL:
- 		fprintf(stderr, "%s: Bad ticket length", progname);
- 		break;
- 	    case KTC_PIOCTLFAIL:
- 		fprintf(stderr, "%s: Unknown error contacting AFS service",
- 			progname);
- 		break;
- 	    case KTC_NOCELL:
- 		fprintf(stderr, "%s: Cell name (%s) not recognized by AFS service",
- 			progname, realm_of_cell);
- 		break;
- 	    case KTC_NOCM:
- 		fprintf(stderr, "%s: AFS service is unavailable", progname);
- 		break;
- 	    default:
- 		fprintf(stderr, "%s: Undocumented error (%d) contacting AFS service", progname, status);
- 		break;	
- 	    }
- 	    status = AKLOG_TOKEN;	    
- 	}
- #endif /* !WINDOWS */
      }
      else
  	if (dflag) {
--- 812,823 ----
***************
*** 1015,1022 ****
      return(status);
  }
  
- #ifndef WINDOWS /* struct ViceIoctl missing */
- 
  static int get_afs_mountpoint(char *file, char *mountpoint, int size)
  {
  #ifdef AFS_SUN_ENV
--- 827,832 ----
***************
*** 1113,1120 ****
  	    ? 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);
--- 923,930 ----
  	    ? 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);
***************
*** 1158,1165 ****
      return(pathtocheck);
  }
  
- #endif /* WINDOWS */
- 
  #if 0
  /*****************************************/
  int dee_gettokens()
--- 968,973 ----
***************
*** 1190,1197 ****
  /*****************************************/
  #endif
  
- #ifndef WINDOWS /* struct ViceIoctl missing */
- 
  static void add_hosts(char *file)
  {
  #ifdef AFS_SUN_ENV
--- 998,1003 ----
***************
*** 1251,1260 ****
      }
  }
  
- #endif /* WINDOWS */
- 
- #ifndef WINDOWS /* next_path(), get_afs_mountpoint() */
- 
  /*
   * This routine descends through a path to a directory, logging to 
   * every cell it encounters along the way.
--- 1057,1062 ----
***************
*** 1342,1349 ****
      return(status);
  }
  
- #endif /* WINDOWS */
- 
  
  /* Print usage message and exit */
  static void usage(void)
--- 1144,1149 ----
***************
*** 1420,1428 ****
  	progname = argv[0];
  
      krb5_init_context(&context);
! #ifndef WINDOWS
! 	initialize_ktc_error_table ();
! #endif
  
      /* Initialize list of cells to which we have authenticated */
      (void)ll_init(&authedcells);
--- 1220,1226 ----
  	progname = argv[0];
  
      krb5_init_context(&context);
!     initialize_ktc_error_table ();
  
      /* Initialize list of cells to which we have authenticated */
      (void)ll_init(&authedcells);
***************
*** 1471,1502 ****
  		usage();
  	else if (((strcmp(argv[i], "-path") == 0) ||
  		  (strcmp(argv[i], "-p") == 0)) && !cmode)
- #ifndef WINDOWS
  	    if (++i < argc) {
  		pmode++;
  		strcpy(path, argv[i]);
  	    }
  	    else
  		usage();
- #else /* WINDOWS */
- 	{
- 	    fprintf(stderr, "%s: path mode not supported.\n", progname);
- 	    exit(AKLOG_MISC);
- 	}
- #endif /* WINDOWS */
  	    
  	else if (argv[i][0] == '-')
  	    usage();
  	else if (!pmode && !cmode) {
  	    if (strchr(argv[i], DIR) || (strcmp(argv[i], ".") == 0) ||
  		(strcmp(argv[i], "..") == 0)) {
- #ifndef WINDOWS
  		pmode++;
  		strcpy(path, argv[i]);
- #else /* WINDOWS */
- 		fprintf(stderr, "%s: path mode not supported.\n", progname);
- 		exit(AKLOG_MISC);
- #endif /* WINDOWS */
  	    }
  	    else { 
  		cmode++;
--- 1269,1288 ----
***************
*** 1537,1543 ****
  	    memset(cell, 0, sizeof(cell));
  	    memset(realm, 0, sizeof(realm));
  	}
- #ifndef WINDOWS
  	else if (pmode) {
  	    /* Add this path to list of paths */
  	    if ((cur_node = ll_add_node(&paths, ll_tail))) {
--- 1323,1328 ----
***************
*** 1558,1564 ****
  	    pmode = FALSE;
  	    memset(path, 0, sizeof(path));
  	}
- #endif /* WINDOWS */
      }
  
      /*
--- 1343,1348 ----
***************
*** 1610,1616 ****
  				status = auth_to_cell(context, linkedcell2, NULL);
  		}
  
- #ifndef WINDOWS
  		/*
  		 * Local hack - if the person has a file in their home
  		 * directory called ".xlog", read that for a list of
--- 1394,1399 ----
***************
*** 1651,1657 ****
  			}
  		    }
  		}
- #endif /* WINDOWS */
  	}
      else {
  	/* Log to all cells in the cells list first */
--- 1434,1439 ----
***************
*** 1673,1685 ****
  		}
  	}
  	
- #ifndef WINDOWS
  	/* Then, log to all paths in the paths list */
  	for (cur_node = paths.first; cur_node; cur_node = cur_node->next) {
  	    if ((status = auth_to_path(context, cur_node->data)))
  		somethingswrong++;
  	}
- #endif /* WINDOWS */
  	
  	/* 
  	 * If only one thing was logged to, we'll return the status 
--- 1455,1465 ----
***************
*** 2048,2053 ****
--- 1828,1838 ----
      krb5_creds increds;
      krb5_error_code r;
      static krb5_principal client_principal = 0;
+ 
+     if (dflag) {
+ 	printf("Getting tickets: %s%s%s@%s\n", name, (inst && inst[0])
+ 	       ? "/" : "", inst ? inst : "", realm);
+     }
      
      memset((char *)&increds, 0, sizeof(increds));
  /* ANL - instance may be ptr to a null string. Pass null then */
Index: openafs/src/aklog/asetkey.c
diff -c openafs/src/aklog/asetkey.c:1.4.4.4 openafs/src/aklog/asetkey.c:1.4.4.5
*** openafs/src/aklog/asetkey.c:1.4.4.4	Tue Oct 30 11:16:36 2007
--- openafs/src/aklog/asetkey.c	Tue Apr  1 13:44:40 2008
***************
*** 1,5 ****
  /*
!  * $Id: asetkey.c,v 1.4.4.4 2007/10/30 15:16:36 shadow Exp $
   *
   * asetkey - Manipulates an AFS KeyFile
   *
--- 1,5 ----
  /*
!  * $Id: asetkey.c,v 1.4.4.5 2008/04/01 17:44:40 shadow Exp $
   *
   * asetkey - Manipulates an AFS KeyFile
   *
***************
*** 108,114 ****
  
  	code = afsconf_AddKey(tdir, kvno, (char *) deref_key_contents(key), 1);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to set key, code %d.\n", argv[0], code);
  	    exit(1);
  	}
  	krb5_free_principal(context, principal);
--- 108,114 ----
  
  	code = afsconf_AddKey(tdir, kvno, (char *) deref_key_contents(key), 1);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to set key, code %ld.\n", argv[0], code);
  	    exit(1);
  	}
  	krb5_free_principal(context, principal);
***************
*** 124,130 ****
  	kvno = atoi(argv[2]);
  	code = afsconf_DeleteKey(tdir, kvno);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to delete key %d, (code %d)\n",
  		    argv[0], kvno, code);
  	    exit(1);
  	}
--- 124,130 ----
  	kvno = atoi(argv[2]);
  	code = afsconf_DeleteKey(tdir, kvno);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to delete key %ld, (code %ld)\n",
  		    argv[0], kvno, code);
  	    exit(1);
  	}
***************
*** 135,141 ****
  	
  	code = afsconf_GetKeys(tdir, &tkeys);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to get keys, code %d\n", argv[0], code);
  	    exit(1);
  	}
  	for(i=0;i<tkeys.nkeys;i++) {
--- 135,141 ----
  	
  	code = afsconf_GetKeys(tdir, &tkeys);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to get keys, code %ld\n", argv[0], code);
  	    exit(1);
  	}
  	for(i=0;i<tkeys.nkeys;i++) {
Index: openafs/src/aklog/klog.c
diff -c openafs/src/aklog/klog.c:1.3.2.5 openafs/src/aklog/klog.c:1.3.2.9
*** openafs/src/aklog/klog.c:1.3.2.5	Fri Nov 23 08:59:34 2007
--- openafs/src/aklog/klog.c	Fri Apr 18 16:50:16 2008
***************
*** 30,38 ****
  
  #include <stdio.h>
  #include <pwd.h>
- #if 0
  #include <afs/com_err.h>
- #endif
  #include <afs/auth.h>
  #include <afs/afsutil.h>
  #include <afs/cellconfig.h>
--- 30,36 ----
***************
*** 50,61 ****
  #define USING_HEIMDAL 1
  #endif
  
- #ifndef USING_HEIMDAL
- extern krb5_cc_ops krb5_mcc_ops;
- #endif
- 
  #include "assert.h"
! 
  
  /* This code borrowed heavily from the previous version of log.  Here is the
     intro comment for that program: */
--- 48,55 ----
  #define USING_HEIMDAL 1
  #endif
  
  #include "assert.h"
! #include "skipwrap.h"
  
  /* This code borrowed heavily from the previous version of log.  Here is the
     intro comment for that program: */
***************
*** 315,340 ****
  {
      krb5_error_code code;
      int i, type;
! #ifndef USING_HEIMDAL
      krb5_prompt_type *types;
  #endif
      struct kp_arg *kparg = (struct kp_arg *) a;
      code = krb5_prompter_posix(context, a, name, banner, num_prompts, prompts);
      if (code) return code;
! #ifndef USING_HEIMDAL
      if ((types = krb5_get_prompt_types(context)))
  #endif
      for (i = 0; i < num_prompts; ++i) {
! #ifdef USING_HEIMDAL
  	type = prompts[i].type;
  #else
! 	type = types[i];
  #endif
  #if 0
! 	printf ("i%d t%d <%.*s>\n", i,
! type,
! prompts[i].reply->length,
! prompts[i].reply->data);
  #endif
  	switch(type) {
  	case KRB5_PROMPT_TYPE_PASSWORD:
--- 309,340 ----
  {
      krb5_error_code code;
      int i, type;
! #if !defined(USING_HEIMDAL) && defined(HAVE_KRB5_GET_PROMPT_TYPES)
      krb5_prompt_type *types;
  #endif
      struct kp_arg *kparg = (struct kp_arg *) a;
      code = krb5_prompter_posix(context, a, name, banner, num_prompts, prompts);
      if (code) return code;
! #if !defined(USING_HEIMDAL) && defined(HAVE_KRB5_GET_PROMPT_TYPES)
      if ((types = krb5_get_prompt_types(context)))
  #endif
      for (i = 0; i < num_prompts; ++i) {
! #if !defined(USING_HEIMDAL) 
! #if defined(HAVE_KRB5_GET_PROMPT_TYPES)
! 	type = types[i];
! #elif defined(HAVE_KRB5_PROMPT_TYPE)	
  	type = prompts[i].type;
  #else
! 	/* AIX 5.3 krb5_get_prompt_types is missing. Um... */
! 	type = ((i == 1)&&(num_prompts == 2)) ? 
! 	  KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN : KRB5_PROMPT_TYPE_PASSWORD;
! #endif
! #else
! 	type = prompts[i].type;
  #endif
  #if 0
! 	printf ("i%d t%d <%.*s>\n", i, type, prompts[i].reply->length,
! 		prompts[i].reply->data);
  #endif
  	switch(type) {
  	case KRB5_PROMPT_TYPE_PASSWORD:
***************
*** 353,360 ****
      krb5_principal princ = 0;
      char *cell, *pname, **hrealms, *service;
      char service_temp[MAXKTCREALMLEN + 20];
-     char realm[MAXKTCREALMLEN];
-     char lrealm[MAXKTCREALMLEN];	/* uppercase copy of local cellname */
      krb5_creds incred[1], mcred[1], *outcred = 0, *afscred;
      krb5_ccache cc = 0;
      krb5_get_init_creds_opt gic_opts[1];
--- 353,358 ----
***************
*** 379,389 ****
      static int Pipe = 0;	/* reading from a pipe */
      static int Silent = 0;	/* Don't want error messages */
  
-     int local;			/* explicit cell is same a local one */
      int writeTicketFile = 0;	/* write ticket file to /tmp */
  
-     char *reason;		/* string describing errors */
- 
      service = 0;
      memset(incred, 0, sizeof *incred);
      /* blow away command line arguments */
--- 377,384 ----
***************
*** 437,443 ****
  	authtype |= env_afs_rxk5_default();
  #endif
  
!     cell = as->parms[aCELL].items ? cell = as->parms[aCELL].items->data : 0;
      if ((code = afsconf_GetCellInfo(tdir, cell, "afsprot", cellconfig))) {
  	if (cell)
  	    afs_com_err(rn, code, "Can't get cell information for '%s'", cell);
--- 432,438 ----
  	authtype |= env_afs_rxk5_default();
  #endif
  
!     cell = as->parms[aCELL].items ? as->parms[aCELL].items->data : 0;
      if ((code = afsconf_GetCellInfo(tdir, cell, "afsprot", cellconfig))) {
  	if (cell)
  	    afs_com_err(rn, code, "Can't get cell information for '%s'", cell);
***************
*** 604,614 ****
  		what = "getting default ccache";
  		code = krb5_cc_default(k5context, &cc);
  	    } else {
- #ifdef HAVE_KRB5_CC_REGISTER
- 		what = "krb5_cc_register";
- 		code = krb5_cc_register(k5context, &krb5_mcc_ops, FALSE);
- 		if (code && code != KRB5_CC_TYPE_EXISTS) goto Failed;
- #endif
  		what = "krb5_cc_resolve";
  		code = krb5_cc_resolve(k5context, "MEMORY:core", &cc);
  		if (code) goto Failed;
--- 599,604 ----
Index: openafs/src/aklog/krb_util.c
diff -c openafs/src/aklog/krb_util.c:1.4.4.1 openafs/src/aklog/krb_util.c:1.4.4.2
*** openafs/src/aklog/krb_util.c:1.4.4.1	Sat Feb 10 08:58:17 2007
--- openafs/src/aklog/krb_util.c	Tue Apr  1 13:44:41 2008
***************
*** 9,18 ****
   * <mit-copyright.h>.
   */
  
! #ifndef lint
! static char rcsid_send_to_kdc_c[] =
! "$Id: krb_util.c,v 1.4.4.1 2007/02/10 13:58:17 jaltman Exp $";
! #endif /* lint */
  
  #if 0
  #include <kerberosIV/mit-copyright.h>
--- 9,17 ----
   * <mit-copyright.h>.
   */
  
! #include <afsconfig.h>
! RCSID
!     ("$Header: /cvs/openafs/src/aklog/krb_util.c,v 1.4.4.2 2008/04/01 17:44:41 shadow Exp $");
  
  #if 0
  #include <kerberosIV/mit-copyright.h>
***************
*** 25,42 ****
  #define MAX_HSTNM 100
  #endif
  
- #ifdef WINDOWS
- 
- #include "aklog.h"		/* for struct afsconf_cell */
- 
- #else /* !WINDOWS */
- 
- #include <afs/param.h>
  #include <afs/cellconfig.h>
  
- #endif /* WINDOWS */
- 
  #include <string.h>
  
  #define S_AD_SZ sizeof(struct sockaddr_in)
  
--- 24,33 ----
  #define MAX_HSTNM 100
  #endif
  
  #include <afs/cellconfig.h>
  
  #include <string.h>
+ #include <ctype.h>
  
  #define S_AD_SZ sizeof(struct sockaddr_in)
  
***************
*** 61,68 ****
  		*p = toupper(*p);
  	}
      } else {
! 	if (retval = krb5_get_host_realm(context,
! 					 cellconfig->hostName[0], &hrealms))
  	    return 0; 
  	if(!hrealms[0]) return 0;
  	strcpy(krbrlm, hrealms[0]);
--- 52,59 ----
  		*p = toupper(*p);
  	}
      } else {
! 	if ((retval = krb5_get_host_realm(context,
! 					 cellconfig->hostName[0], &hrealms)))
  	    return 0; 
  	if(!hrealms[0]) return 0;
  	strcpy(krbrlm, hrealms[0]);
Index: openafs/src/aklog/linked_list.c
diff -c openafs/src/aklog/linked_list.c:1.2 openafs/src/aklog/linked_list.c:1.2.4.1
*** openafs/src/aklog/linked_list.c:1.2	Thu Jul 14 21:19:27 2005
--- openafs/src/aklog/linked_list.c	Tue Apr  1 13:44:41 2008
***************
*** 1,5 ****
  /* 
!  * $Id: linked_list.c,v 1.2 2005/07/15 01:19:27 rra Exp $
   * 
   * This file contains general linked list routines.
   * 
--- 1,5 ----
  /* 
!  * $Id: linked_list.c,v 1.2.4.1 2008/04/01 17:44:41 shadow Exp $
   * 
   * This file contains general linked list routines.
   * 
***************
*** 7,15 ****
   * For distribution and copying rights, see the file "mit-copyright.h"
   */
  
! #if !defined(lint) && !defined(SABER)
! static char *rcsid_list_c = "$Id: linked_list.c,v 1.2 2005/07/15 01:19:27 rra Exp $";
! #endif /* lint || SABER */
  
  #include <stdio.h>
  #include <stdlib.h>
--- 7,15 ----
   * For distribution and copying rights, see the file "mit-copyright.h"
   */
  
! #include <afsconfig.h>
! RCSID
!     ("$Header: /cvs/openafs/src/aklog/linked_list.c,v 1.2.4.1 2008/04/01 17:44:41 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 46,56 ****
      }
  
      /* This sets everything to zero, which is what we want. */
- #ifdef WINDOWS
- 	memset(list, 0, sizeof(linked_list));
- #else
      bzero((char *)list, sizeof(linked_list));
- #endif /* WINDOWS */
  }
  
  ll_node *ll_add_node(linked_list *list, ll_end which_end)
--- 46,52 ----
***************
*** 164,173 ****
        case ll_s_add:
  	/* Add a string to the list. */
  	if (!ll_string(list, ll_s_check, string)) {
! 	    if (cur_node = ll_add_node(list, ll_tail)) {
  		char *new_string;
! 		if (new_string = (char *)calloc(strlen(string) + 1, 
! 						sizeof(char))) {
  		    strcpy(new_string, string);
  		    ll_add_data(cur_node, new_string);
  		}
--- 160,169 ----
        case ll_s_add:
  	/* Add a string to the list. */
  	if (!ll_string(list, ll_s_check, string)) {
! 	    if ((cur_node = ll_add_node(list, ll_tail))) {
  		char *new_string;
! 		if ((new_string = (char *)calloc(strlen(string) + 1, 
! 						sizeof(char)))) {
  		    strcpy(new_string, string);
  		    ll_add_data(cur_node, new_string);
  		}
Index: openafs/src/aklog/linked_list.h
diff -c openafs/src/aklog/linked_list.h:1.1 openafs/src/aklog/linked_list.h:1.1.10.1
*** openafs/src/aklog/linked_list.h:1.1	Fri Nov 19 15:01:29 2004
--- openafs/src/aklog/linked_list.h	Tue Apr  1 13:44:41 2008
***************
*** 1,5 ****
  /* 
!  * $Id: linked_list.h,v 1.1 2004/11/19 20:01:29 kenh Exp $
   *
   * This is the header file for a general list linked package.
   * 
--- 1,5 ----
  /* 
!  * $Id: linked_list.h,v 1.1.10.1 2008/04/01 17:44:41 shadow Exp $
   *
   * This is the header file for a general list linked package.
   * 
***************
*** 10,19 ****
  #ifndef __LINKED_LIST_H__
  #define __LINKED_LIST_H__
  
- #if !defined(lint) && !defined(SABER)
- static char *rcsid_linked_list_h = "$Id: linked_list.h,v 1.1 2004/11/19 20:01:29 kenh Exp $";
- #endif /* lint || SABER */
- 
  #define LL_SUCCESS 0
  #define LL_FAILURE -1
  
--- 10,15 ----
Index: openafs/src/aklog/skipwrap.c
diff -c openafs/src/aklog/skipwrap.c:1.1.10.2 openafs/src/aklog/skipwrap.c:1.1.10.3
*** openafs/src/aklog/skipwrap.c:1.1.10.2	Thu Nov  1 12:51:47 2007
--- openafs/src/aklog/skipwrap.c	Tue Apr  1 13:44:41 2008
***************
*** 34,39 ****
--- 34,40 ----
  #include <stdio.h>
  #include <aklog.h>
  #include <krb5.h>
+ #include "skipwrap.h"
  
  /* evil hack */
  #define SEQUENCE 16
Index: openafs/src/aklog/skipwrap.h
diff -c /dev/null openafs/src/aklog/skipwrap.h:1.1.2.2
*** /dev/null	Mon Apr 21 17:11:56 2008
--- openafs/src/aklog/skipwrap.h	Tue Apr  1 13:44:41 2008
***************
*** 0 ****
--- 1,8 ----
+ #ifndef _AKLOG_SKIPWRAP_H
+ #define _AKLOG_SKIPWRAP_H
+ 
+ int afs_krb5_skip_ticket_wrapper(char *tix, size_t tixlen, char **enc, 
+ 				 size_t *enclen);
+ 
+ #endif
+ 
Index: openafs/src/bucoord/dump.c
diff -c openafs/src/bucoord/dump.c:1.13.6.4 openafs/src/bucoord/dump.c:1.13.6.5
*** openafs/src/bucoord/dump.c:1.13.6.4	Mon Mar 10 18:32:32 2008
--- openafs/src/bucoord/dump.c	Wed Apr  9 12:39:57 2008
***************
*** 15,21 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bucoord/dump.c,v 1.13.6.4 2008/03/10 22:32:32 shadow Exp $");
  
  #include <sys/types.h>
  #include <afs/cmd.h>
--- 15,21 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bucoord/dump.c,v 1.13.6.5 2008/04/09 16:39:57 shadow Exp $");
  
  #include <sys/types.h>
  #include <afs/cmd.h>
***************
*** 225,231 ****
  	free(tdump->portOffset);
      tdump->flags &= ~BC_DI_INUSE;
  
!     return code;
  }
  
  /* bc_StartDmpRst
--- 225,231 ----
  	free(tdump->portOffset);
      tdump->flags &= ~BC_DI_INUSE;
  
!     return (void *)code;
  }
  
  /* bc_StartDmpRst
Index: openafs/src/budb/Makefile.in
diff -c openafs/src/budb/Makefile.in:1.10.14.2 openafs/src/budb/Makefile.in:1.10.14.3
*** openafs/src/budb/Makefile.in:1.10.14.2	Thu Nov  1 12:02:28 2007
--- openafs/src/budb/Makefile.in	Wed Apr  2 15:51:55 2008
***************
*** 117,123 ****
  	${INSTALL} $? $@
  
  ${DEST}/root.server/usr/afs/bin/buserver: budb_server
! 	${INSTALL} -f $? $@
  
  #
  # Misc targets
--- 117,127 ----
  	${INSTALL} $? $@
  
  ${DEST}/root.server/usr/afs/bin/buserver: budb_server
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install buserver for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} -f $? $@ ; \
! 	fi
  
  #
  # Misc targets
***************
*** 152,158 ****
  	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvlibexecdir}/buserver: budb_server
! 	${INSTALL} -f $? $@
  
  dest: \
  	${DEST}/lib/afs/libbudb.a \
--- 156,166 ----
  	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvlibexecdir}/buserver: budb_server
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install buserver for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} -f $? $@ ; \
! 	fi
  
  dest: \
  	${DEST}/lib/afs/libbudb.a \
Index: openafs/src/budb/database.c
diff -c openafs/src/budb/database.c:1.7.14.3 openafs/src/budb/database.c:1.7.14.4
*** openafs/src/budb/database.c:1.7.14.3	Tue Oct 30 11:16:37 2007
--- openafs/src/budb/database.c	Wed Apr  2 15:51:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/database.c,v 1.7.14.3 2007/10/30 15:16:37 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/database.c,v 1.7.14.4 2008/04/02 19:51:55 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
***************
*** 89,95 ****
--- 89,97 ----
  
    error_exit:
      if (((++pollCount) % 4) == 0) {	/* Poll every 4 reads/writes */
+ #ifndef AFS_PTHREAD_ENV
  	IOMGR_Poll();
+ #endif
  	pollCount = 0;
      }
      return code;
***************
*** 121,127 ****
--- 123,131 ----
  
    error_exit:
      if (((++pollCount) % 4) == 0) {	/* Poll every 4 reads/writes */
+ #ifndef AFS_PTHREAD_ENV
  	IOMGR_Poll();
+ #endif
  	pollCount = 0;
      }
      return code;
***************
*** 154,160 ****
--- 158,166 ----
  
    error_exit:
      if (((++pollCount) % 4) == 0) {	/* Poll every 4 reads/writes */
+ #ifndef AFS_PTHREAD_ENV
  	IOMGR_Poll();
+ #endif
  	pollCount = 0;
      }
      return code;
Index: openafs/src/budb/db_dump.c
diff -c openafs/src/budb/db_dump.c:1.7.14.2 openafs/src/budb/db_dump.c:1.7.14.3
*** openafs/src/budb/db_dump.c:1.7.14.2	Mon Nov 26 16:08:41 2007
--- openafs/src/budb/db_dump.c	Wed Apr  2 15:51:55 2008
***************
*** 16,22 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_dump.c,v 1.7.14.2 2007/11/26 21:08:41 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 16,22 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/db_dump.c,v 1.7.14.3 2008/04/02 19:51:55 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
***************
*** 73,85 ****
--- 73,95 ----
      while (dumpSyncPtr->ds_bytes > 0) {
  	if (dumpSyncPtr->ds_readerStatus == DS_WAITING) {
  	    dumpSyncPtr->ds_readerStatus = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	    assert(pthread_cond_broadcast(&dumpSyncPtr->ds_readerStatus_cond) == 0);
+ #else
  	    code = LWP_SignalProcess(&dumpSyncPtr->ds_readerStatus);
  	    if (code)
  		LogError(code, "canWrite: Signal delivery failed\n");
+ #endif
  	}
  	dumpSyncPtr->ds_writerStatus = DS_WAITING;
  	ReleaseWriteLock(&dumpSyncPtr->ds_lock);
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	assert(pthread_mutex_lock(&dumpSyncPtr->ds_writerStatus_mutex) == 0);
+ 	assert(pthread_cond_wait(&dumpSyncPtr->ds_writerStatus_cond, &dumpSyncPtr->ds_writerStatus_mutex) == 0);
+ 	assert(pthread_mutex_unlock(&dumpSyncPtr->ds_writerStatus_mutex) == 0);
+ #else
  	LWP_WaitProcess(&dumpSyncPtr->ds_writerStatus);
+ #endif
  	ObtainWriteLock(&dumpSyncPtr->ds_lock);
      }
      return (1);
***************
*** 103,111 ****
--- 113,125 ----
      dumpSyncPtr->ds_bytes += nbytes;
      if (dumpSyncPtr->ds_readerStatus == DS_WAITING) {
  	dumpSyncPtr->ds_readerStatus = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	assert(pthread_cond_broadcast(&dumpSyncPtr->ds_readerStatus_cond) == 0);
+ #else
  	code = LWP_SignalProcess(&dumpSyncPtr->ds_readerStatus);
  	if (code)
  	    LogError(code, "haveWritten: Signal delivery failed\n");
+ #endif
      }
      ReleaseWriteLock(&dumpSyncPtr->ds_lock);
  }
***************
*** 127,133 ****
--- 141,153 ----
  	LogDebug(4, "doneWriting: waiting for Reader\n");
  	dumpSyncPtr->ds_writerStatus = DS_WAITING;
  	ReleaseWriteLock(&dumpSyncPtr->ds_lock);
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	assert(pthread_mutex_lock(&dumpSyncPtr->ds_writerStatus_mutex) == 0);
+ 	assert(pthread_cond_wait(&dumpSyncPtr->ds_writerStatus_cond, &dumpSyncPtr->ds_writerStatus_mutex) == 0);
+ 	assert(pthread_mutex_unlock(&dumpSyncPtr->ds_writerStatus_mutex) == 0);
+ #else
  	LWP_WaitProcess(&dumpSyncPtr->ds_writerStatus);
+ #endif
  	ObtainWriteLock(&dumpSyncPtr->ds_lock);
      }
  
***************
*** 139,147 ****
--- 159,171 ----
      else
  	dumpSyncPtr->ds_writerStatus = DS_DONE;
      dumpSyncPtr->ds_readerStatus = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+     assert(pthread_cond_broadcast(&dumpSyncPtr->ds_readerStatus_cond) == 0);
+ #else
      code = LWP_NoYieldSignal(&dumpSyncPtr->ds_readerStatus);
      if (code)
  	LogError(code, "doneWriting: Signal delivery failed\n");
+ #endif
      ReleaseWriteLock(&dumpSyncPtr->ds_lock);
  }
  
Index: openafs/src/budb/dbs_dump.c
diff -c openafs/src/budb/dbs_dump.c:1.11.14.2 openafs/src/budb/dbs_dump.c:1.11.14.3
*** openafs/src/budb/dbs_dump.c:1.11.14.2	Mon Mar 10 18:32:32 2008
--- openafs/src/budb/dbs_dump.c	Wed Apr  2 15:51:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/dbs_dump.c,v 1.11.14.2 2008/03/10 22:32:32 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/dbs_dump.c,v 1.11.14.3 2008/04/02 19:51:55 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
***************
*** 115,121 ****
--- 115,128 ----
       charListT *charListPtr;
       afs_int32 *done;
  {
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+     pthread_t dumperPid, watcherPid;
+     pthread_attr_t dumperPid_tattr;
+     pthread_attr_t watcherPid_tattr;
+ 
+ #else
      PROCESS dumperPid, watcherPid;
+ #endif
      int readSize;
      afs_int32 code = 0;
  
***************
*** 155,174 ****
--- 162,206 ----
  	if (code)
  	    ERROR(errno);
  
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	/* Initialize the condition variables and the mutexes we use
+ 	 * to signal and synchronize the reader and writer threads.
+ 	 */
+ 	assert(pthread_cond_init(&dumpSyncPtr->ds_readerStatus_cond, (const pthread_condattr_t *)0) == 0);
+ 	assert(pthread_cond_init(&dumpSyncPtr->ds_writerStatus_cond, (const pthread_condattr_t *)0) == 0);
+ 	assert(pthread_mutex_init(&dumpSyncPtr->ds_readerStatus_mutex, (const pthread_mutexattr_t *)0) == 0);
+ 	assert(pthread_mutex_init(&dumpSyncPtr->ds_writerStatus_mutex, (const pthread_mutexattr_t *)0) == 0);
+ 
+ 	/* Initialize the thread attributes and launch the thread */
+ 
+ 	assert(pthread_attr_init(&dumperPid_tattr) == 0);
+ 	assert(pthread_attr_setdetachstate(&dumperPid_tattr, PTHREAD_CREATE_DETACHED) == 0);
+ 	assert(pthread_create(&dumperPid, &dumperPid_tattr, (void *)setupDbDump, NULL) == 0);
+ 
+ #else
  	code =
  	    LWP_CreateProcess(setupDbDump, 16384, 1,
  			      (void *)dumpSyncPtr->pipeFid[1],
  			      "Database Dumper", &dumperPid);
  	if (code)
  	    goto error_exit;
+ #endif
  
  	dumpSyncPtr->dumperPid = dumperPid;
  	dumpSyncPtr->timeToLive = time(0) + DUMP_TTL_INC;
  
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	/* Initialize the thread attributes and launch the thread */
+ 
+ 	assert(pthread_attr_init(&watcherPid_tattr) == 0);
+ 	assert(pthread_attr_setdetachstate(&watcherPid_tattr, PTHREAD_CREATE_DETACHED) == 0);
+ 	assert(pthread_create(&watcherPid, &watcherPid_tattr, (void *)dumpWatcher, NULL) == 0);
+ #else
  	/* now create the watcher thread */
  	code =
  	    LWP_CreateProcess(dumpWatcher, 16384, 1, 0,
  			      "Database Dump Watchdog", &watcherPid);
+ #endif
      } else if (firstcall)
  	ERROR(BUDB_LOCKED);
  
***************
*** 185,198 ****
--- 217,240 ----
  	if (dumpSyncPtr->ds_writerStatus == DS_WAITING) {
  	    LogDebug(6, "wakup writer\n");
  	    dumpSyncPtr->ds_writerStatus = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	    assert(pthread_cond_broadcast(&dumpSyncPtr->ds_writerStatus_cond) == 0);
+ #else
  	    code = LWP_SignalProcess(&dumpSyncPtr->ds_writerStatus);
  	    if (code)
  		LogError(code, "BUDB_DumpDB: signal delivery failed\n");
+ #endif
  	}
  	LogDebug(6, "wait for writer\n");
  	dumpSyncPtr->ds_readerStatus = DS_WAITING;
  	ReleaseWriteLock(&dumpSyncPtr->ds_lock);
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+         assert(pthread_mutex_lock(&dumpSyncPtr->ds_readerStatus_mutex) == 0);
+         assert(pthread_cond_wait(&dumpSyncPtr->ds_readerStatus_cond, &dumpSyncPtr->ds_readerStatus_mutex) == 0);
+         assert(pthread_mutex_unlock(&dumpSyncPtr->ds_readerStatus_mutex) == 0);
+ #else
  	LWP_WaitProcess(&dumpSyncPtr->ds_readerStatus);
+ #endif
  	ObtainWriteLock(&dumpSyncPtr->ds_lock);
      }
  
***************
*** 217,225 ****
--- 259,271 ----
      dumpSyncPtr->ds_bytes -= readSize;
      if (dumpSyncPtr->ds_writerStatus == DS_WAITING) {
  	dumpSyncPtr->ds_writerStatus = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	assert(pthread_cond_broadcast(&dumpSyncPtr->ds_writerStatus_cond) == 0);
+ #else
  	code = LWP_SignalProcess(&dumpSyncPtr->ds_writerStatus);
  	if (code)
  	    LogError(code, "BUDB_DumpDB: signal delivery failed\n");
+ #endif
      }
  
    error_exit:
***************
*** 313,322 ****
  
  	    close(dumpSyncPtr->pipeFid[0]);
  	    close(dumpSyncPtr->pipeFid[1]);
! 
  	    code = LWP_DestroyProcess(dumpSyncPtr->dumperPid);
  	    if (code)
  		LogError(code, "dumpWatcher: failed to kill dump thread\n");
  
  	    if (dumpSyncPtr->ut) {
  		code = ubik_AbortTrans(dumpSyncPtr->ut);
--- 359,371 ----
  
  	    close(dumpSyncPtr->pipeFid[0]);
  	    close(dumpSyncPtr->pipeFid[1]);
! #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
! 	    assert(pthread_cancel(dumpSyncPtr->dumperPid) == 0);
! #else
  	    code = LWP_DestroyProcess(dumpSyncPtr->dumperPid);
  	    if (code)
  		LogError(code, "dumpWatcher: failed to kill dump thread\n");
+ #endif
  
  	    if (dumpSyncPtr->ut) {
  		code = ubik_AbortTrans(dumpSyncPtr->ut);
***************
*** 329,335 ****
--- 378,388 ----
  	}
  	/*i */
  	ReleaseWriteLock(&dumpSyncPtr->ds_lock);
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	sleep(5);
+ #else
  	IOMGR_Sleep(5);
+ #endif
      }				/*w */
  
    exit:
Index: openafs/src/budb/globals.h
diff -c openafs/src/budb/globals.h:1.3 openafs/src/budb/globals.h:1.3.14.1
*** openafs/src/budb/globals.h:1.3	Tue Jul 15 19:14:48 2003
--- openafs/src/budb/globals.h	Wed Apr  2 15:51:55 2008
***************
*** 61,70 ****
      struct Lock ds_lock;	/* for this struct. */
      afs_int32 statusFlags;	/* 0, or 1 for dump in progress */
      int pipeFid[2];		/* pipe between threads */
      char ds_writerStatus;
      char ds_readerStatus;
  
-     PROCESS dumperPid;		/* pid of dumper lwp */
      struct ubik_trans *ut;	/* dump db transaction */
      afs_int32 ds_bytes;		/* no. of bytes buffered */
      time_t timeToLive;		/* time. After this, kill the dump */
--- 61,78 ----
      struct Lock ds_lock;	/* for this struct. */
      afs_int32 statusFlags;	/* 0, or 1 for dump in progress */
      int pipeFid[2];		/* pipe between threads */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+     pthread_mutex_t ds_writerStatus_mutex;
+     pthread_mutex_t ds_readerStatus_mutex;
+     pthread_cond_t ds_writerStatus_cond;
+     pthread_cond_t ds_readerStatus_cond;
+     pthread_t dumperPid;
+ #else
+     PROCESS dumperPid;		/* pid of dumper lwp */
+ #endif
      char ds_writerStatus;
      char ds_readerStatus;
  
      struct ubik_trans *ut;	/* dump db transaction */
      afs_int32 ds_bytes;		/* no. of bytes buffered */
      time_t timeToLive;		/* time. After this, kill the dump */
Index: openafs/src/budb/ol_verify.c
diff -c openafs/src/budb/ol_verify.c:1.13.14.2 openafs/src/budb/ol_verify.c:1.13.14.3
*** openafs/src/budb/ol_verify.c:1.13.14.2	Tue Oct 30 11:16:38 2007
--- openafs/src/budb/ol_verify.c	Wed Apr  2 15:51:55 2008
***************
*** 13,19 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/ol_verify.c,v 1.13.14.2 2007/10/30 15:16:38 shadow Exp $");
  
  #include <stdio.h>
  #ifdef AFS_NT40_ENV
--- 13,19 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/ol_verify.c,v 1.13.14.3 2008/04/02 19:51:55 shadow Exp $");
  
  #include <stdio.h>
  #ifdef AFS_NT40_ENV
***************
*** 1094,1102 ****
  
  	/* check each entry */
  	for (entryIndex = 0; entryIndex < blockMap[blockIndex]->nEntries; entryIndex++) {	/*f */
  	    if ((entryIndex % 1024) == 0)
  		IOMGR_Poll();
! 
  	    bits = blockMap[blockIndex]->entries[entryIndex];
  
  	    for (i = 0; i < NMAPCs; i++)
--- 1094,1103 ----
  
  	/* check each entry */
  	for (entryIndex = 0; entryIndex < blockMap[blockIndex]->nEntries; entryIndex++) {	/*f */
+ #ifndef AFS_PTHREAD_ENV
  	    if ((entryIndex % 1024) == 0)
  		IOMGR_Poll();
! #endif
  	    bits = blockMap[blockIndex]->entries[entryIndex];
  
  	    for (i = 0; i < NMAPCs; i++)
Index: openafs/src/budb/procs.c
diff -c openafs/src/budb/procs.c:1.14.14.1 openafs/src/budb/procs.c:1.14.14.2
*** openafs/src/budb/procs.c:1.14.14.1	Tue Oct 30 11:16:38 2007
--- openafs/src/budb/procs.c	Wed Apr  2 15:51:55 2008
***************
*** 17,23 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/procs.c,v 1.14.14.1 2007/10/30 15:16:38 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 17,23 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/procs.c,v 1.14.14.2 2008/04/02 19:51:55 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
***************
*** 110,116 ****
--- 110,120 ----
  	    start = time(0);
  	else if (time(0) - start > 5)
  	    return UNOQUORUM;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	sleep(1);
+ #else
  	IOMGR_Sleep(1);
+ #endif
      }
      return 0;
  }
***************
*** 200,206 ****
--- 204,214 ----
  		Log("Waiting for quorum election\n");
  	    if (wait < 15.0)
  		wait *= 1.1;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	    sleep((int)wait);
+ #else
  	    IOMGR_Sleep((int)wait);
+ #endif
  	}
      }
      if (code)
***************
*** 1469,1475 ****
--- 1477,1487 ----
  	    }
  
  	    /* dump id is in use - wait a while */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	    sleep(1);
+ #else
  	    IOMGR_Sleep(1);
+ #endif
  	}			/*w */
      } else {
  	/* dump id supplied (e.g. for database restore) */
Index: openafs/src/budb/server.c
diff -c openafs/src/budb/server.c:1.16.2.8 openafs/src/budb/server.c:1.16.2.9
*** openafs/src/budb/server.c:1.16.2.8	Mon Mar 10 18:32:32 2008
--- openafs/src/budb/server.c	Wed Apr  2 15:51:55 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/server.c,v 1.16.2.8 2008/03/10 22:32:32 shadow Exp $");
  
  #include <fcntl.h>
  #include <sys/stat.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/server.c,v 1.16.2.9 2008/04/02 19:51:55 shadow Exp $");
  
  #include <fcntl.h>
  #include <sys/stat.h>
***************
*** 70,75 ****
--- 70,79 ----
  int debugging = 0;
  
  int rxBind = 0;
+ int lwps   = 3;
+ 
+ #define MINLWP  3
+ #define MAXLWP 16
  
  #define ADDRSPERSITE 16         /* Same global is in rx/rx_user.c */
  afs_uint32 SHostAddrs[ADDRSPERSITE];
***************
*** 167,172 ****
--- 171,182 ----
      cmd_AddParm(cptr, "-auditlog", CMD_SINGLE, CMD_OPTIONAL,
  		"audit log path");
  
+     cmd_AddParm(cptr, "-p", CMD_SINGLE, CMD_OPTIONAL,
+ 		"number of processes");
+ 
+     cmd_AddParm(cptr, "-rxbind", CMD_FLAG, CMD_OPTIONAL,
+ 		"bind the Rx socket (primary interface only)");
+ 
  }
  
  int
***************
*** 248,253 ****
--- 258,283 ----
  	    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
      }
  
+     /* user provided the number of threads    */
+     if (as->parms[8].items != 0) {
+ 	lwps = atoi(as->parms[8].items->data);
+ 	if (lwps > MAXLWP) {
+ 	    printf ("Warning: '-p %d' is too big; using %d instead\n",
+ 		lwps, MAXLWP);
+ 	    lwps = MAXLWP;
+ 	}
+ 	if (lwps < MINLWP) {
+ 	    printf ("Warning: '-p %d' is too small; using %d instead\n",
+ 		lwps, MINLWP);
+ 	    lwps = MINLWP;
+ 	}
+     }
+ 
+     /* user provided rxbind option    */
+     if (as->parms[9].items != 0) {
+ 	rxBind = 1;
+     }
+ 
      return 0;
  }
  
***************
*** 562,568 ****
  	BUDB_EXIT(3);
      }
      rx_SetMinProcs(tservice, 1);
!     rx_SetMaxProcs(tservice, 3);
      rx_SetStackSize(tservice, 10000);
  
      /* allow super users to manage RX statistics */
--- 592,598 ----
  	BUDB_EXIT(3);
      }
      rx_SetMinProcs(tservice, 1);
!     rx_SetMaxProcs(tservice, lwps);
      rx_SetStackSize(tservice, 10000);
  
      /* allow super users to manage RX statistics */
Index: openafs/src/butc/lwps.c
diff -c openafs/src/butc/lwps.c:1.14.4.4 openafs/src/butc/lwps.c:1.14.4.5
*** openafs/src/butc/lwps.c:1.14.4.4	Mon Mar 10 18:32:33 2008
--- openafs/src/butc/lwps.c	Wed Apr  9 12:39:59 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/lwps.c,v 1.14.4.4 2008/03/10 22:32:33 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/lwps.c,v 1.14.4.5 2008/04/09 16:39:59 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
***************
*** 1920,1926 ****
  
      FreeNode(taskId);
      LeaveDeviceQueue(deviceLatch);
!     return (code);
  }
  
  /* this is just scaffolding, creates new tape label with name <tapeName> */
--- 1920,1926 ----
  
      FreeNode(taskId);
      LeaveDeviceQueue(deviceLatch);
!     return (void *)(code);
  }
  
  /* this is just scaffolding, creates new tape label with name <tapeName> */
***************
*** 2282,2288 ****
  
      free(labelIfPtr);
      LeaveDeviceQueue(deviceLatch);
!     return (code);
  }
  
  /* PrintTapeLabel
--- 2282,2288 ----
  
      free(labelIfPtr);
      LeaveDeviceQueue(deviceLatch);
!     return (void *)(code);
  }
  
  /* PrintTapeLabel
Index: openafs/src/butc/tcudbprocs.c
diff -c openafs/src/butc/tcudbprocs.c:1.15.6.5 openafs/src/butc/tcudbprocs.c:1.15.6.7
*** openafs/src/butc/tcudbprocs.c:1.15.6.5	Mon Mar 10 18:32:33 2008
--- openafs/src/butc/tcudbprocs.c	Fri Apr 18 09:57:13 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcudbprocs.c,v 1.15.6.5 2008/03/10 22:32:33 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/tcudbprocs.c,v 1.15.6.7 2008/04/18 13:57:13 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 744,750 ****
  
      free(saveDbIfPtr);
      LeaveDeviceQueue(deviceLatch);
!     return (code);
  }
  
  struct rstTapeInfo {
--- 744,750 ----
  
      free(saveDbIfPtr);
      LeaveDeviceQueue(deviceLatch);
!     return (void *)(code);
  }
  
  struct rstTapeInfo {
***************
*** 1020,1026 ****
  void *
  restoreDbFromTape(void *param)
  {
!     afs_uint32 taskId = (void *)param;
      afs_int32 code = 0;
      afs_int32 i;
      struct butm_tapeInfo tapeInfo;
--- 1020,1026 ----
  void *
  restoreDbFromTape(void *param)
  {
!     afs_uint32 taskId = (afs_uint32) param;
      afs_int32 code = 0;
      afs_int32 i;
      struct butm_tapeInfo tapeInfo;
Index: openafs/src/cf/kerberos.m4
diff -c openafs/src/cf/kerberos.m4:1.7.2.6 openafs/src/cf/kerberos.m4:1.7.2.8
*** openafs/src/cf/kerberos.m4:1.7.2.6	Fri Jan  4 23:46:52 2008
--- openafs/src/cf/kerberos.m4	Fri Apr 18 16:49:58 2008
***************
*** 1,5 ****
  dnl
! dnl $Id: kerberos.m4,v 1.7.2.6 2008/01/05 04:46:52 shadow Exp $
  dnl
  dnl Kerberos autoconf glue
  dnl
--- 1,5 ----
  dnl
! dnl $Id: kerberos.m4,v 1.7.2.8 2008/04/18 20:49:58 shadow Exp $
  dnl
  dnl Kerberos autoconf glue
  dnl
***************
*** 58,64 ****
  	CPPFLAGS="$CPPFLAGS $KRB5CFLAGS"
  	save_LIBS="$LIBS"
  	LIBS="$LIBS $KRB5LIBS"
! 	AC_CHECK_FUNCS([add_to_error_table add_error_table krb5_princ_size krb5_principal_get_comp_string encode_krb5_enc_tkt_part encode_krb5_ticket krb5_c_encrypt krb5_c_encrypt_length krb5_cc_register krb5_decode_ticket])
  	AC_CHECK_FUNCS([krb5_524_convert_creds], ,
  	    [AC_CHECK_FUNCS([krb524_convert_creds_kdc], ,
  		[AC_CHECK_LIB([krb524], [krb524_convert_creds_kdc],
--- 58,64 ----
  	CPPFLAGS="$CPPFLAGS $KRB5CFLAGS"
  	save_LIBS="$LIBS"
  	LIBS="$LIBS $KRB5LIBS"
! 	AC_CHECK_FUNCS([add_to_error_table add_error_table krb5_princ_size krb5_principal_get_comp_string encode_krb5_enc_tkt_part encode_krb5_ticket krb5_c_encrypt krb5_c_encrypt_length krb5_cc_register krb5_decode_ticket krb5_get_prompt_types])
  	AC_CHECK_FUNCS([krb5_524_convert_creds], ,
  	    [AC_CHECK_FUNCS([krb524_convert_creds_kdc], ,
  		[AC_CHECK_LIB([krb524], [krb524_convert_creds_kdc],
***************
*** 91,102 ****
--- 91,116 ----
  ac_cv_krb5_creds_session_exists=no)])
  AC_MSG_RESULT($ac_cv_krb5_creds_session_exists)
  
+ AC_MSG_CHECKING(for krb5_prompt.type existence)
+ AC_CACHE_VAL(ac_cv_krb5_prompt_type_exists,
+ [
+ AC_TRY_COMPILE(
+ [#include <krb5.h>],
+ [krb5_prompt _p;
+ printf("%x\n", _p.type);], 
+ ac_cv_krb5_prompt_type_exists=yes,
+ ac_cv_krb5_prompt_type_exists=no)])
+ AC_MSG_RESULT($ac_cv_krb5_prompt_type_exists)
+ 	
  if test "x$ac_cv_krb5_creds_keyblock_exists" = "xyes"; then
  	AC_DEFINE(HAVE_KRB5_CREDS_KEYBLOCK, 1, [define if krb5_creds has keyblock])
  fi
  if test "x$ac_cv_krb5_creds_session_exists" = "xyes"; then
  	AC_DEFINE(HAVE_KRB5_CREDS_SESSION, 1, [define if krb5_creds has session])
  fi
+ if test "x$ac_cv_krb5_prompt_type_exists" = "xyes"; then
+ 	AC_DEFINE(HAVE_KRB5_PROMPT_TYPE, 1, [define if krb5_prompt has type])
+ fi
  	
  dnl	AC_CHECK_MEMBERS([krb5_creds.keyblock, krb5_creds.session],,, [#include <krb5.h>])
  	CPPFLAGS="$save_CPPFLAGS"
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.29.2.38 openafs/src/cf/linux-test4.m4:1.29.2.41
*** openafs/src/cf/linux-test4.m4:1.29.2.38	Mon Mar 10 14:52:54 2008
--- openafs/src/cf/linux-test4.m4	Sat Apr 19 17:55:47 2008
***************
*** 81,90 ****
    AC_MSG_CHECKING([for exported init_mm])
    AC_CACHE_VAL([ac_cv_linux_exports_init_mm], [
      AC_TRY_KBUILD(
! [#include <linux/modversions.h>],
! [#ifndef __ver_init_mm
! #error init_mm not exported
! #endif],
        ac_cv_linux_exports_init_mm=yes,
        ac_cv_linux_exports_init_mm=no)])
    AC_MSG_RESULT($ac_cv_linux_exports_init_mm)])
--- 81,89 ----
    AC_MSG_CHECKING([for exported init_mm])
    AC_CACHE_VAL([ac_cv_linux_exports_init_mm], [
      AC_TRY_KBUILD(
! [extern struct mm_struct init_mm;],
! [void *address = &init_mm;
! printk("%p\n", address);],
        ac_cv_linux_exports_init_mm=yes,
        ac_cv_linux_exports_init_mm=no)])
    AC_MSG_RESULT($ac_cv_linux_exports_init_mm)])
***************
*** 1000,1002 ****
--- 999,1014 ----
        ac_cv_linux_struct_nameidata_has_path=no)])
    AC_MSG_RESULT($ac_cv_linux_struct_nameidata_has_path)])
  
+ AC_DEFUN([LINUX_EXPORTS_RCU_READ_LOCK], [
+   AC_MSG_CHECKING([if rcu_read_lock is usable])
+   AC_CACHE_VAL([ac_cv_linux_exports_rcu_read_lock], [
+     AC_TRY_KBUILD(
+ [#include <linux/rcupdate.h>],
+ [rcu_read_lock();],
+       ac_cv_linux_exports_rcu_read_lock=yes,
+       ac_cv_linux_exports_rcu_read_lock=no)])
+   AC_MSG_RESULT($ac_cv_linux_exports_rcu_read_lock)
+   if test "x$ac_cv_linux_exports_rcu_read_lock" = "xyes"; then
+     AC_DEFINE([EXPORTED_RCU_READ_LOCK], 1, [define if rcu_read_lock() is usable])
+   fi])
+  
Index: openafs/src/cf/osconf.m4
diff -c openafs/src/cf/osconf.m4:1.83.2.8 openafs/src/cf/osconf.m4:1.83.2.9
*** openafs/src/cf/osconf.m4:1.83.2.8	Thu Feb 28 09:28:39 2008
--- openafs/src/cf/osconf.m4	Wed Apr  2 15:51:56 2008
***************
*** 42,48 ****
  		LEX="lex"
  		CSTATIC="-non_shared"
  		DBG="-g3"
! 		MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-pthread -lpthread -lmach -lexc -lc"
  		TXLIBS="-lcurses"
  		XCFLAGS="-D_NO_PROTO -DOSF"
--- 42,48 ----
  		LEX="lex"
  		CSTATIC="-non_shared"
  		DBG="-g3"
! 		MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-pthread -lpthread -lmach -lexc -lc"
  		TXLIBS="-lcurses"
  		XCFLAGS="-D_NO_PROTO -DOSF"
***************
*** 53,59 ****
  		LEX="flex -l"
  		DBG="-g3"
  		CSTATIC="-non_shared"
! 		MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-pthread -lpthread -lmach -lexc -lc"
  		TXLIBS="-lcurses"
  		XCFLAGS="-D_NO_PROTO -DOSF"
--- 53,59 ----
  		LEX="flex -l"
  		DBG="-g3"
  		CSTATIC="-non_shared"
! 		MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-pthread -lpthread -lmach -lexc -lc"
  		TXLIBS="-lcurses"
  		XCFLAGS="-D_NO_PROTO -DOSF"
***************
*** 65,71 ****
  		DBG="-g3"
  		CSTATIC="-non_shared"
  		LWP_OPTMZ="-O2"
! 		MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-pthread -lpthread -lmach -lexc -lc"
  		TXLIBS="-lcurses"
  		XCFLAGS="-D_NO_PROTO -DOSF"
--- 65,71 ----
  		DBG="-g3"
  		CSTATIC="-non_shared"
  		LWP_OPTMZ="-O2"
! 		MT_CFLAGS='-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-pthread -lpthread -lmach -lexc -lc"
  		TXLIBS="-lcurses"
  		XCFLAGS="-D_NO_PROTO -DOSF"
***************
*** 75,81 ****
  	alpha_linux_22)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 75,81 ----
  	alpha_linux_22)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 91,97 ****
  		CCOBJ="${CC} -fPIC"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 91,97 ----
  		CCOBJ="${CC} -fPIC"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 107,113 ****
  		CCOBJ="${CC} -fPIC"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 107,113 ----
  		CCOBJ="${CC} -fPIC"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 159,165 ****
  		LEX="/opt/langtools/bin/lex"
  		LWP_OPTMZ="-O"
  		MT_CC="/opt/ansic/bin/cc -Ae"
! 		MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-L/opt/dce/lib -ldce"
  		MV="/bin/mv"
  		OPTMZ="-O"
--- 159,165 ----
  		LEX="/opt/langtools/bin/lex"
  		LWP_OPTMZ="-O"
  		MT_CC="/opt/ansic/bin/cc -Ae"
! 		MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-L/opt/dce/lib -ldce"
  		MV="/bin/mv"
  		OPTMZ="-O"
***************
*** 188,194 ****
  		LEX="/opt/langtools/bin/lex"
  		LWP_OPTMZ="-O"
  		MT_CC="$CC"
! 		MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		MV="/bin/mv"
  		OPTMZ="-O"
--- 188,194 ----
  		LEX="/opt/langtools/bin/lex"
  		LWP_OPTMZ="-O"
  		MT_CC="$CC"
! 		MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		MV="/bin/mv"
  		OPTMZ="-O"
***************
*** 220,226 ****
  		LEX="/opt/langtools/bin/lex"
  		LWP_OPTMZ=""
  		MT_CC="$CC"
! 		MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		MV="/bin/mv"
  		OPTMZ="-O"
--- 220,226 ----
  		LEX="/opt/langtools/bin/lex"
  		LWP_OPTMZ=""
  		MT_CC="$CC"
! 		MT_CFLAGS='-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		MV="/bin/mv"
  		OPTMZ="-O"
***************
*** 244,250 ****
  
  	*fbsd_*)
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-pthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-pipe -fPIC"
--- 244,250 ----
  
  	*fbsd_*)
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-pthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-pipe -fPIC"
***************
*** 257,263 ****
  
  	*nbsd2*|*nbsd3*|*nbsd4*)
  		LEX="flex -l"
! 		MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -D_REENTRANT '
  		MT_LIBS="-lpthread" # XXX -pthread soon
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-pipe -fPIC"
--- 257,263 ----
  
  	*nbsd2*|*nbsd3*|*nbsd4*)
  		LEX="flex -l"
! 		MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -D_REENTRANT '
  		MT_LIBS="-lpthread" # XXX -pthread soon
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-pipe -fPIC"
***************
*** 284,290 ****
  	ia64_linux24|ia64_linux26)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 284,290 ----
  	ia64_linux24|ia64_linux26)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 299,305 ****
  		CCOBJ="${CC} -fPIC"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 299,305 ----
  		CCOBJ="${CC} -fPIC"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 313,319 ****
  	ppc64_linux24)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 313,319 ----
  	ppc64_linux24)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 327,333 ****
  	ppc64_linux26)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 327,333 ----
  	ppc64_linux26)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 345,351 ****
  		MT_CC="gcc -pipe"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 345,351 ----
  		MT_CC="gcc -pipe"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 363,369 ****
  		MT_CC="gcc -pipe"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		DBG=-g
  		KERN_DBG=-g
--- 363,369 ----
  		MT_CC="gcc -pipe"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		DBG=-g
  		KERN_DBG=-g
***************
*** 384,390 ****
  		MT_CC="gcc -pipe"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		DBG=-g
  		KERN_DBG=-g
--- 384,390 ----
  		MT_CC="gcc -pipe"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		DBG=-g
  		KERN_DBG=-g
***************
*** 406,412 ****
  		MT_CC="gcc -pipe"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		DBG=-g
  		KERN_DBG=-g
--- 406,412 ----
  		MT_CC="gcc -pipe"
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		DBG=-g
  		KERN_DBG=-g
***************
*** 426,432 ****
  		KRB5CFLAGS="-I/usr/include/kerberosV"
  		KRB5LIBS="-lkrb5 -lcrypto"
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-pthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-pipe -fpic"
--- 426,432 ----
  		KRB5CFLAGS="-I/usr/include/kerberosV"
  		KRB5LIBS="-lkrb5 -lcrypto"
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-pthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-pipe -fpic"
***************
*** 441,447 ****
  	parisc_linux24)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 441,447 ----
  	parisc_linux24)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 496,502 ****
  	ppc_darwin_70)
  		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration"
  		LEX="lex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}'
  		KROOT=
  		KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
  		LWP_OPTMZ="-O2"
--- 496,502 ----
  	ppc_darwin_70)
  		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration"
  		LEX="lex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}'
  		KROOT=
  		KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
  		LWP_OPTMZ="-O2"
***************
*** 511,517 ****
  	*_darwin_80)
  		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
  		LEX="lex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS} ${ARCHFLAGS}'
  		KROOT=
  		KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
  		KERN_OPTMZ="-Os"
--- 511,517 ----
  	*_darwin_80)
  		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
  		LEX="lex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -D_REENTRANT ${XCFLAGS} ${ARCHFLAGS}'
  		KROOT=
  		KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
  		KERN_OPTMZ="-Os"
***************
*** 528,534 ****
  	*_darwin_90)
  		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
  		LEX="lex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS} ${ARCHFLAGS}'
  		KROOT=
  		KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
  		LD="cc"
--- 528,534 ----
  	*_darwin_90)
  		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
  		LEX="lex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -D_REENTRANT ${XCFLAGS} ${ARCHFLAGS}'
  		KROOT=
  		KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
  		LD="cc"
***************
*** 546,552 ****
  	ppc_linux*)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 546,552 ----
  	ppc_linux*)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 563,569 ****
  		LEX="lex"
  		LIBSYS_AIX_EXP="afsl.exp"
  		MT_CC="xlc_r"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthreads"
  		SHLIB_SUFFIX="o"
  		TXLIBS="-lcurses"
--- 563,569 ----
  		LEX="lex"
  		LIBSYS_AIX_EXP="afsl.exp"
  		MT_CC="xlc_r"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthreads"
  		SHLIB_SUFFIX="o"
  		TXLIBS="-lcurses"
***************
*** 579,585 ****
  		LEX="lex"
  		LIBSYS_AIX_EXP="afsl.exp"
  		MT_CC="xlc_r"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthreads"
  		SHLIB_SUFFIX="o"
  		TXLIBS="-lcurses"
--- 579,585 ----
  		LEX="lex"
  		LIBSYS_AIX_EXP="afsl.exp"
  		MT_CC="xlc_r"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthreads"
  		SHLIB_SUFFIX="o"
  		TXLIBS="-lcurses"
***************
*** 594,600 ****
  		LEX="lex"
  		LIBSYS_AIX_EXP="afsl.exp"
  		MT_CC="xlc_r"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthreads"
  		SHLIB_SUFFIX="o"
  		TXLIBS="-lcurses"
--- 594,600 ----
  		LEX="lex"
  		LIBSYS_AIX_EXP="afsl.exp"
  		MT_CC="xlc_r"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthreads"
  		SHLIB_SUFFIX="o"
  		TXLIBS="-lcurses"
***************
*** 609,615 ****
  		LEX="lex"
  		LIBSYS_AIX_EXP="afsl.exp"
  		MT_CC="xlc_r"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthreads"
  		SHLIB_SUFFIX="o"
  		TXLIBS="-lcurses"
--- 609,615 ----
  		LEX="lex"
  		LIBSYS_AIX_EXP="afsl.exp"
  		MT_CC="xlc_r"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthreads"
  		SHLIB_SUFFIX="o"
  		TXLIBS="-lcurses"
***************
*** 626,632 ****
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
  		MT_CC="$CC"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 626,632 ----
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
  		MT_CC="$CC"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 646,652 ****
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
  		MT_CC="$CC"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 646,652 ----
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
  		MT_CC="$CC"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 665,671 ****
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
  		MT_CC="$CC"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 665,671 ----
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
  		MT_CC="$CC"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 683,689 ****
  		AFSD_LIBS="/usr/lib/libdwarf.a /usr/lib/libelf.a"
  		FSINCLUDES="-I/usr/include/sys/fs"
  		LEX="lex"
! 		MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		TXLIBS="-lcurses"
  		XCFLAGS64="-64 -mips3"
--- 683,689 ----
  		AFSD_LIBS="/usr/lib/libdwarf.a /usr/lib/libelf.a"
  		FSINCLUDES="-I/usr/include/sys/fs"
  		LEX="lex"
! 		MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		TXLIBS="-lcurses"
  		XCFLAGS64="-64 -mips3"
***************
*** 698,704 ****
  		AFSD_LIBS="/usr/lib/libdwarf.a /usr/lib/libelf.a"
  		FSINCLUDES="-I/usr/include/sys/fs"
  		LEX="lex"
! 		MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		TXLIBS="-lcurses"
  		XCFLAGS64="-D_BSD_COMPAT -64 -mips3"
--- 698,704 ----
  		AFSD_LIBS="/usr/lib/libdwarf.a /usr/lib/libelf.a"
  		FSINCLUDES="-I/usr/include/sys/fs"
  		LEX="lex"
! 		MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		TXLIBS="-lcurses"
  		XCFLAGS64="-D_BSD_COMPAT -64 -mips3"
***************
*** 712,718 ****
  		AFSD_LIBS="/usr/lib32/libdwarf.a /usr/lib32/libelf.a"
  		FSINCLUDES="-I/usr/include/sys/fs"
  		LEX="lex"
! 		MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		TXLIBS="-lcurses"
  		XCFLAGS64="-D_BSD_COMPAT -64 -mips3"
--- 712,718 ----
  		AFSD_LIBS="/usr/lib32/libdwarf.a /usr/lib32/libelf.a"
  		FSINCLUDES="-I/usr/include/sys/fs"
  		LEX="lex"
! 		MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		TXLIBS="-lcurses"
  		XCFLAGS64="-D_BSD_COMPAT -64 -mips3"
***************
*** 730,736 ****
  		LD="/usr/bin/ld"
  		LEX="lex"
  		MT_CC="/usr/bin/cc"
! 		MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		TXLIBS="-lcurses"
  		XCFLAGS64="-64 -mips3"
--- 730,736 ----
  		LD="/usr/bin/ld"
  		LEX="lex"
  		MT_CC="/usr/bin/cc"
! 		MT_CFLAGS='-D_SGI_MP_SOURCE -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		TXLIBS="-lcurses"
  		XCFLAGS64="-64 -mips3"
***************
*** 743,749 ****
  	sparc*_linux*)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- 743,749 ----
  	sparc*_linux*)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
! 		MT_CFLAGS='-DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_OPTMZ=-O2
  		PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
***************
*** 776,782 ****
  		CCOBJ="/opt/SUNWspro/bin/cc"
  		LEX="lex"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		SHLIB_CFLAGS="-KPIC"
  		TXLIBS="-lcurses"
--- 776,782 ----
  		CCOBJ="/opt/SUNWspro/bin/cc"
  		LEX="lex"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		SHLIB_CFLAGS="-KPIC"
  		TXLIBS="-lcurses"
***************
*** 794,800 ****
  		CCOBJ="/opt/SUNWspro/bin/cc"
  		LEX="lex"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 794,800 ----
  		CCOBJ="/opt/SUNWspro/bin/cc"
  		LEX="lex"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 816,822 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 816,822 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 838,844 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 838,844 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 860,866 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 860,866 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 882,888 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 882,888 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 904,910 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 904,910 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 926,932 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 926,932 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 947,953 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 947,953 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 968,974 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 968,974 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 989,995 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 989,995 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
***************
*** 1010,1016 ****
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
--- 1010,1016 ----
  		LEX="lex"
  		LD="/usr/ccs/bin/ld"
  		MT_CC="/opt/SUNWspro/bin/cc"
! 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV -DUBIK_PTHREAD_ENV ${XCFLAGS}'
  		MT_LIBS="-lpthread -lsocket"
  		PAM_CFLAGS="-KPIC"
  		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.24.2.40 openafs/src/config/NTMakefile.amd64_w2k:1.24.2.41
*** openafs/src/config/NTMakefile.amd64_w2k:1.24.2.40	Fri Mar 21 13:02:48 2008
--- openafs/src/config/NTMakefile.amd64_w2k	Mon Apr 21 11:27:55 2008
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=3400
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=3500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.84.2.39 openafs/src/config/NTMakefile.i386_nt40:1.84.2.40
*** openafs/src/config/NTMakefile.i386_nt40:1.84.2.39	Fri Mar 21 13:02:48 2008
--- openafs/src/config/NTMakefile.i386_nt40	Mon Apr 21 11:27:55 2008
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=3400
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=3500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_w2k
diff -c openafs/src/config/NTMakefile.i386_w2k:1.23.2.40 openafs/src/config/NTMakefile.i386_w2k:1.23.2.41
*** openafs/src/config/NTMakefile.i386_w2k:1.23.2.40	Fri Mar 21 13:02:48 2008
--- openafs/src/config/NTMakefile.i386_w2k	Mon Apr 21 11:27:55 2008
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=3400
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=3500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/param.i386_nbsd30.h
diff -c openafs/src/config/param.i386_nbsd30.h:1.1.10.1 openafs/src/config/param.i386_nbsd30.h:1.1.10.2
*** openafs/src/config/param.i386_nbsd30.h:1.1.10.1	Fri Oct  6 10:58:49 2006
--- openafs/src/config/param.i386_nbsd30.h	Fri Mar 28 13:12:40 2008
***************
*** 5,12 ****
  #define AFS_X86_ENV 1
  #define AFSLITTLE_ENDIAN 1
  
! #define SYS_NAME       "i386_nbsd40"
! #define SYS_NAME_ID    SYS_NAME_ID_i386_nbsd40
  
  #ifndef UKERNEL
  /* This section for kernel libafs compiles only */
--- 5,12 ----
  #define AFS_X86_ENV 1
  #define AFSLITTLE_ENDIAN 1
  
! #define SYS_NAME       "i386_nbsd30"
! #define SYS_NAME_ID    SYS_NAME_ID_i386_nbsd30
  
  #ifndef UKERNEL
  /* This section for kernel libafs compiles only */
Index: openafs/src/config/param.i386_nbsd40.h
diff -c /dev/null openafs/src/config/param.i386_nbsd40.h:1.1.2.2
*** /dev/null	Mon Apr 21 17:11:56 2008
--- openafs/src/config/param.i386_nbsd40.h	Fri Mar 28 13:12:40 2008
***************
*** 0 ****
--- 1,20 ----
+ #ifndef        AFS_I386_PARAM_H
+ #define        AFS_I386_PARAM_H
+ 
+ #define AFS_X86_XBSD_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFSLITTLE_ENDIAN 1
+ 
+ #define SYS_NAME       "i386_nbsd40"
+ #define SYS_NAME_ID    SYS_NAME_ID_i386_nbsd40
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ #endif /* AFS_I386_PARAM_H */
Index: openafs/src/libadmin/test/vos.c
diff -c openafs/src/libadmin/test/vos.c:1.9.4.1 openafs/src/libadmin/test/vos.c:1.9.4.2
*** openafs/src/libadmin/test/vos.c:1.9.4.1	Wed Oct 31 00:09:31 2007
--- openafs/src/libadmin/test/vos.c	Mon Apr 21 15:40:01 2008
***************
*** 15,24 ****
  #include <afs/param.h>
  #ifndef AFS_NT40_ENV
  #include <netdb.h>
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/libadmin/test/vos.c,v 1.9.4.1 2007/10/31 04:09:31 shadow Exp $");
  
  #include "vos.h"
  
--- 15,27 ----
  #include <afs/param.h>
  #ifndef AFS_NT40_ENV
  #include <netdb.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <afs/afsutil.h>
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/libadmin/test/vos.c,v 1.9.4.2 2008/04/21 19:40:01 shadow Exp $");
  
  #include "vos.h"
  
Index: openafs/src/libafsrpc/Makefile.in
diff -c openafs/src/libafsrpc/Makefile.in:1.36.4.2 openafs/src/libafsrpc/Makefile.in:1.36.4.3
*** openafs/src/libafsrpc/Makefile.in:1.36.4.2	Sat Nov 10 15:13:39 2007
--- openafs/src/libafsrpc/Makefile.in	Wed Apr  2 15:51:56 2008
***************
*** 112,118 ****
  CRYPT_OBJ = crypt.o
  
  LWPOBJS = \
! 	fasttime.o
  
  LIBOBJS = \
  	${RXOBJS} \
--- 112,119 ----
  CRYPT_OBJ = crypt.o
  
  LWPOBJS = \
! 	fasttime.o \
! 	lock.o
  
  LIBOBJS = \
  	${RXOBJS} \
***************
*** 272,278 ****
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.36.4.2 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
--- 273,279 ----
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.36.4.3 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
***************
*** 351,356 ****
--- 352,360 ----
  fasttime.o: ${LWP}/fasttime.c
  	${CCRULE} ${LWP}/fasttime.c
  
+ lock.o: ${LWP}/lock.c
+ 	${CCRULE} ${LWP}/lock.c
+ 
  syscall.o: ${SYS}/syscall.s
  	case "$(SYS_NAME)" in \
  	     sun4x_5* | sunx86_5*) \
Index: openafs/src/packaging/RedHat/makesrpm.pl
diff -c openafs/src/packaging/RedHat/makesrpm.pl:1.1.2.3 openafs/src/packaging/RedHat/makesrpm.pl:1.1.2.4
*** openafs/src/packaging/RedHat/makesrpm.pl:1.1.2.3	Tue Jan 15 18:43:40 2008
--- openafs/src/packaging/RedHat/makesrpm.pl	Tue Apr  8 14:36:13 2008
***************
*** 19,25 ****
  my $cellservdb = shift;
  
  if (!$srcball && !$docball) {
!   printf "Usage:  <version> <src.tar.gz> <doc.tar.gz> [<relnotes> [<changelog> [<cellservdb>]]]\n";
    exit(1);
  }
  
--- 19,25 ----
  my $cellservdb = shift;
  
  if (!$srcball && !$docball) {
!   printf "Usage:  makesrpm <src.tar.gz> <doc.tar.gz> [<relnotes> [<changelog> [<cellservdb>]]]\n";
    exit(1);
  }
  
***************
*** 42,71 ****
  my $srcdir = $tmpdir."/".$vdir;
  
  # Work out which version we're dealing with from the configure.in file
! my $version;
  my $fh = new IO::File $srcdir."/configure.in"
    or die "Unable to find unpacked configure.in file";
  while(<$fh>) {
    if (/AM_INIT_AUTOMAKE\(openafs,(.*)\)/) {
!     $version = $1;
!     last;
    }
  }
  undef $fh;
  
  # Build the RPM root
  
! print "Building version $version\n";
  File::Path::mkpath([ $tmpdir."/rpmdir/SPECS",
  		     $tmpdir."/rpmdir/SRPMS",
  		     $tmpdir."/rpmdir/SOURCES"], 0, 0755);
  
  File::Copy::copy($srcball, 
! 		 $tmpdir."/rpmdir/SOURCES/openafs-$version-src.tar.bz2")
    or die "Unable to copy $srcball into position\n";
  
  File::Copy::copy($docball,
! 		 $tmpdir."/rpmdir/SOURCES/openafs-$version-doc.tar.bz2")
    or die "Unable to copy $docball into position\n";
  
  # Populate it with all the stuff in the packaging directory, except the 
--- 42,81 ----
  my $srcdir = $tmpdir."/".$vdir;
  
  # Work out which version we're dealing with from the configure.in file
! my $afsversion;
! my $linuxver;
! my $linuxrel;
  my $fh = new IO::File $srcdir."/configure.in"
    or die "Unable to find unpacked configure.in file";
  while(<$fh>) {
    if (/AM_INIT_AUTOMAKE\(openafs,(.*)\)/) {
!     $afsversion = $1;
!     next;
!   }
!   if (/LINUX_PKGVER=(.*)/) {
!     $linuxver = $1;
!     next;
!   }
!   if (/LINUX_PKGREL=(.*)/) {
!     $linuxrel = $1;
!     next;
    }
  }
  undef $fh;
  
  # Build the RPM root
  
! print "Building version $afsversion\n";
  File::Path::mkpath([ $tmpdir."/rpmdir/SPECS",
  		     $tmpdir."/rpmdir/SRPMS",
  		     $tmpdir."/rpmdir/SOURCES"], 0, 0755);
  
  File::Copy::copy($srcball, 
! 		 $tmpdir."/rpmdir/SOURCES/openafs-$afsversion-src.tar.bz2")
    or die "Unable to copy $srcball into position\n";
  
  File::Copy::copy($docball,
! 		 $tmpdir."/rpmdir/SOURCES/openafs-$afsversion-doc.tar.bz2")
    or die "Unable to copy $docball into position\n";
  
  # Populate it with all the stuff in the packaging directory, except the 
***************
*** 90,98 ****
  
  # Create the specfile. Use sed for this, cos its easier
  system("cat ".$srcdir."/src/packaging/RedHat/openafs.spec.in | ".
!        "sed -e 's/\@VERSION\@/$version/g' ".
!        "    -e 's/\%define afsvers.*/%define afsvers $version/g' ".
!        "    -e 's/\%define pkgvers.*/%define pkgvers $version/g' > ".
         $tmpdir."/rpmdir/SPECS/openafs.spec") == 0
    or die "sed failed : $!\n";
  
--- 100,110 ----
  
  # Create the specfile. Use sed for this, cos its easier
  system("cat ".$srcdir."/src/packaging/RedHat/openafs.spec.in | ".
!        "sed -e 's/\@VERSION\@/$afsversion/g' ".
!        "    -e 's/\@LINUX_PKGVER\@/$linuxver/g' ".
!        "    -e 's/\@LINUX_PKGREL\@/$linuxrel/g' ".
!        "    -e 's/\%define afsvers.*/%define afsvers $afsversion/g' ".
!        "    -e 's/\%define pkgvers.*/%define pkgvers $linuxver/g' > ".
         $tmpdir."/rpmdir/SPECS/openafs.spec") == 0
    or die "sed failed : $!\n";
  
***************
*** 106,116 ****
  
  if ($relnotes) {
    File::Copy::copy($relnotes,
! 		   $tmpdir."/rpmdir/SOURCES/RELNOTES-$version")
    or die "Unable to copy $relnotes into position\n";
  } else {
    print "WARNING: No release notes provided. Using empty file\n";
!   system("touch $tmpdir/rpmdir/SOURCES/RELNOTES-$version");
  }
  
  if ($changelog) {
--- 118,128 ----
  
  if ($relnotes) {
    File::Copy::copy($relnotes,
! 		   $tmpdir."/rpmdir/SOURCES/RELNOTES-$afsversion")
    or die "Unable to copy $relnotes into position\n";
  } else {
    print "WARNING: No release notes provided. Using empty file\n";
!   system("touch $tmpdir/rpmdir/SOURCES/RELNOTES-$afsversion");
  }
  
  if ($changelog) {
***************
*** 128,136 ****
    or die "rpmbuild failed : $!\n";
  
  # Copy it out to somewhere useful
! File::Copy::copy("$tmpdir/rpmdir/SRPMS/openafs-$version-1.1.src.rpm",
! 	         "openafs-$version-1.1.src.rpm")
    or die "Unable to copy output RPM : $!\n";
  
! print "SRPM is openafs-$version-1.1.src.rpm\n";
  
--- 140,148 ----
    or die "rpmbuild failed : $!\n";
  
  # Copy it out to somewhere useful
! File::Copy::copy("$tmpdir/rpmdir/SRPMS/openafs-$linuxver-1.$linuxrel.src.rpm",
! 	         "openafs-$linuxver-1.$linuxrel.src.rpm")
    or die "Unable to copy output RPM : $!\n";
  
! print "SRPM is openafs-$linuxver-1.$linuxrel.src.rpm\n";
  
Index: openafs/src/packaging/RedHat/mockbuild.pl
diff -c openafs/src/packaging/RedHat/mockbuild.pl:1.1.4.2 openafs/src/packaging/RedHat/mockbuild.pl:1.1.4.3
*** openafs/src/packaging/RedHat/mockbuild.pl:1.1.4.2	Mon Feb 18 14:20:52 2008
--- openafs/src/packaging/RedHat/mockbuild.pl	Tue Apr  8 14:36:13 2008
***************
*** 17,23 ****
  my $stashbase="/disk/scratch/repository/";
  my $mockcommand = "/usr/bin/mock";
  my $buildall = 0;
! 
  my @newrpms;
  
  my %platconf = ( "fedora-5-i386" => { osver => "fc5",
--- 17,23 ----
  my $stashbase="/disk/scratch/repository/";
  my $mockcommand = "/usr/bin/mock";
  my $buildall = 0;
! my $ignorerelease = 1;
  my @newrpms;
  
  my %platconf = ( "fedora-5-i386" => { osver => "fc5",
***************
*** 97,107 ****
  	"2.6.21-2950.fc8" => { "xen" => 1} # Missing build ID
  );
  
  my @platforms = @ARGV;
  my $srpm = pop @platforms;
  
! if (!$srpm || $#platforms==-1) {
!   print "Usage: $0 <platform> [<platform> [<platform> ...] ]  <srpm>\n";
    print "    Platform may be:\n";
    foreach ("all", sort(keys(%platconf))) { print "        ".$_."\n"; };
    exit(1);
--- 97,114 ----
  	"2.6.21-2950.fc8" => { "xen" => 1} # Missing build ID
  );
  
+ my $help;
+ my $ok = GetOptions("resultdir=s" => \$resultbase,
+ 		    "help" => \$help);
+ 
  my @platforms = @ARGV;
  my $srpm = pop @platforms;
  
! if (!$ok || $help || !$srpm || $#platforms==-1) {
!   print "Usage: $0 [options] <platform> [<platform> [...]]  <srpm>\n";
!   print "    Options are : \n";
!   print "         --resultdir <dir>    Location to place output RPMS\n";
!   print "\n";
    print "    Platform may be:\n";
    foreach ("all", sort(keys(%platconf))) { print "        ".$_."\n"; };
    exit(1);
***************
*** 175,180 ****
--- 182,190 ----
  	  next if ($variant eq "xen0"); # Fedora 5 has some bad xen0 kernel-devels
  	  next if ($variant eq "smp");
        }
+       if ($platform=~/fedora-8/) {
+ 	  next if ($variant =~/debug$/); # Fedora 8 debug kernels are bad
+       }
        print "$arch : $variant : $version\n";
        $modulelist{$arch} ={} if !$modulelist{$arch};
        $modulelist{$arch}{$version} = {} if !$modulelist{$arch}{$version};
***************
*** 241,250 ****
            if (!-f $resultdir."/kmod-openafs-".$dvariant.
  		  $oafsversion."-".$oafsrelease.".".$kversion.".".
  		  $arch.".rpm") {
! 	    push @tobuild, $variant;
! 	    print $resultdir."/kmod-openafs-".$dvariant.
!                   $oafsversion."-".$oafsrelease.".".$kversion.".".
!                   $arch.".rpm is missing\n";
            }
          }
        }
--- 251,268 ----
            if (!-f $resultdir."/kmod-openafs-".$dvariant.
  		  $oafsversion."-".$oafsrelease.".".$kversion.".".
  		  $arch.".rpm") {
! 	    my @done = glob ($resultdir."/kmod-openafs-".$dvariant.
! 			     $oafsversion."-*.".$kversion.".".$arch.".rpm");
! 
! 	    if ($ignorerelease && $#done>=0) {
! 	      print "Kernel module for $kversion already exists for an".
! 	            "older release. Skipping building it this time.\n";
! 	    } else {
! 	      push @tobuild, $variant;
! 	      print $resultdir."/kmod-openafs-".$dvariant.
!                     $oafsversion."-".$oafsrelease.".".$kversion.".".
!                     $arch.".rpm is missing\n";
! 	    }
            }
          }
        }
***************
*** 289,295 ****
      if (defined($dirh)) {
        my $file;
        while (defined($file = $dirh->read)) {
!         if ( $file=~/^kernel-devel/ &&
                -f $yumcachedir.$file && ! -f $rpmstashdir.$file) {
            print "Stashing $file for later use\n";
            system("cp ".$yumcachedir.$file." ".$rpmstashdir.$file) == 0
--- 307,313 ----
      if (defined($dirh)) {
        my $file;
        while (defined($file = $dirh->read)) {
!         if ( $file=~/^kernel.*devel/ &&
                -f $yumcachedir.$file && ! -f $rpmstashdir.$file) {
            print "Stashing $file for later use\n";
            system("cp ".$yumcachedir.$file." ".$rpmstashdir.$file) == 0
Index: openafs/src/packaging/RedHat/openafs.spec.in
diff -c openafs/src/packaging/RedHat/openafs.spec.in:1.2.2.19 openafs/src/packaging/RedHat/openafs.spec.in:1.2.2.20
*** openafs/src/packaging/RedHat/openafs.spec.in:1.2.2.19	Wed Feb 13 00:28:58 2008
--- openafs/src/packaging/RedHat/openafs.spec.in	Tue Apr  8 14:36:13 2008
***************
*** 1,11 ****
! # Openafs Spec $Revision: 1.2.2.19 $
  
  %define afsvers @VERSION@
! %define pkgvers @VERSION@
  # for beta/rc releases make pkgrel 0.X.<tag>
  # for real releases make pkgrel 1 (or more for extra releases)
  #%define pkgrel 0.1.rc1
! %define pkgrel 1
  
  %if %{?osvers:0}%{!?osvers:1}
  %define osvers 1
--- 1,11 ----
! # Openafs Spec $Revision: 1.2.2.20 $
  
  %define afsvers @VERSION@
! %define pkgvers @LINUX_PKGVER@
  # for beta/rc releases make pkgrel 0.X.<tag>
  # for real releases make pkgrel 1 (or more for extra releases)
  #%define pkgrel 0.1.rc1
! %define pkgrel @LINUX_PKGREL@
  
  %if %{?osvers:0}%{!?osvers:1}
  %define osvers 1
Index: openafs/src/ptserver/Makefile.in
diff -c openafs/src/ptserver/Makefile.in:1.16.6.2 openafs/src/ptserver/Makefile.in:1.16.6.3
*** openafs/src/ptserver/Makefile.in:1.16.6.2	Thu Nov  1 12:02:29 2007
--- openafs/src/ptserver/Makefile.in	Wed Apr  2 15:51:56 2008
***************
*** 177,194 ****
  	${DESTDIR}${includedir}/afs/ptserver.h
  
  ${DEST}/root.server/usr/afs/bin/ptserver: ptserver
! 	${INSTALL} $? $@
  
  ${DEST}/bin/pts ${DEST}/root.server/usr/afs/bin/pts: pts
! 	${INSTALL} $? $@
  
  ${DEST}/root.server/usr/afs/bin/pt_util: pt_util
! 	${INSTALL} $? $@
  
  ${DEST}/lib/afs/libprot.a: libprot.a
  	${INSTALL} $? $@
  
  ${DEST}/etc/prdb_check: db_verify
  	${INSTALL} -f $? $@
  
  ${DEST}/include/afs/prclient.h: ptclient.h
--- 177,211 ----
  	${DESTDIR}${includedir}/afs/ptserver.h
  
  ${DEST}/root.server/usr/afs/bin/ptserver: ptserver
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install ptserver for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DEST}/bin/pts ${DEST}/root.server/usr/afs/bin/pts: pts
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install pts for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DEST}/root.server/usr/afs/bin/pt_util: pt_util
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install pt_util for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DEST}/lib/afs/libprot.a: libprot.a
  	${INSTALL} $? $@
  
  ${DEST}/etc/prdb_check: db_verify
+ 	if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
+ 	  echo "Don't install db_verify for ${SYS_NAME}" ; \
+ 	else \
+ 	  ${INSTALL} $? $@ ; \
+ 	fi
  	${INSTALL} -f $? $@
  
  ${DEST}/include/afs/prclient.h: ptclient.h
***************
*** 228,246 ****
  
  include ../config/Makefile.version
  ${DESTDIR}${afssrvlibexecdir}/ptserver: ptserver
! 	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvbindir}/pts: pts
! 	${INSTALL} $? $@
  
  ${DESTDIR}${bindir}/pts: pts
! 	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvsbindir}/pt_util: pt_util
! 	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvsbindir}/prdb_check: db_verify
! 	${INSTALL} -f $? $@
  
  ${DESTDIR}${libdir}/afs/libprot.a: libprot.a
  	${INSTALL} $? $@
--- 245,283 ----
  
  include ../config/Makefile.version
  ${DESTDIR}${afssrvlibexecdir}/ptserver: ptserver
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install ptserver for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DESTDIR}${afssrvbindir}/pts: pts
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install pts for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DESTDIR}${bindir}/pts: pts
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install pts for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DESTDIR}${afssrvsbindir}/pt_util: pt_util
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install pt_util for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DESTDIR}${afssrvsbindir}/prdb_check: db_verify
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install db_verify for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DESTDIR}${libdir}/afs/libprot.a: libprot.a
  	${INSTALL} $? $@
Index: openafs/src/ptserver/pt_util.c
diff -c openafs/src/ptserver/pt_util.c:1.11.4.3 openafs/src/ptserver/pt_util.c:1.11.4.4
*** openafs/src/ptserver/pt_util.c:1.11.4.3	Sat Mar  8 20:58:49 2008
--- openafs/src/ptserver/pt_util.c	Thu Mar 27 14:40:12 2008
***************
*** 1,4 ****
! /* $Id: pt_util.c,v 1.11.4.3 2008/03/09 01:58:49 jaltman Exp $ */
  
  /*
   *
--- 1,4 ----
! /* $Id: pt_util.c,v 1.11.4.4 2008/03/27 18:40:12 shadow Exp $ */
  
  /*
   *
***************
*** 23,29 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.11.4.3 2008/03/09 01:58:49 jaltman 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.11.4.4 2008/03/27 18:40:12 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <errno.h>
***************
*** 196,203 ****
  	fprintf(stderr, "pt_util: %s: Bad UBIK_MAGIC. Is %x should be %x\n",
  		pfile, ntohl(uh->magic), UBIK_MAGIC);
      memcpy(&uv, &uh->version, sizeof(struct ubik_version));
!     if (wflag && uv.epoch == 0 && uv.counter == 0) {
! 	uv.epoch = 2;		/* a ubik version of 0 or 1 has special meaning */
  	memcpy(&uh->version, &uv, sizeof(struct ubik_version));
  	lseek(dbase_fd, 0, SEEK_SET);
  	if (write(dbase_fd, buffer, HDRSIZE) < 0) {
--- 196,204 ----
  	fprintf(stderr, "pt_util: %s: Bad UBIK_MAGIC. Is %x should be %x\n",
  		pfile, ntohl(uh->magic), UBIK_MAGIC);
      memcpy(&uv, &uh->version, sizeof(struct ubik_version));
! 
!     if (wflag && ntohl(uv.epoch) == 0 && ntohl(uv.counter) == 0) {
! 	uv.epoch = htonl(2); /* a ubik version of 0 or 1 has special meaning */
  	memcpy(&uh->version, &uv, sizeof(struct ubik_version));
  	lseek(dbase_fd, 0, SEEK_SET);
  	if (write(dbase_fd, buffer, HDRSIZE) < 0) {
***************
*** 206,211 ****
--- 207,217 ----
  	    exit(1);
  	}
      }
+ 
+     /* Now that any writeback is done, swap these */
+     uv.epoch = ntohl(uv.epoch);
+     uv.counter = ntohl(uv.counter);
+ 
      fprintf(stderr, "Ubik Version is: %d.%d\n", uv.epoch, uv.counter);
      if (read(dbase_fd, &prh, sizeof(struct prheader)) < 0) {
  	fprintf(stderr, "pt_util: error reading %s: %s\n", pfile,
***************
*** 329,334 ****
--- 335,344 ----
  	exit(1);
      }
      uh = (struct ubik_hdr *)buffer;
+ 
+     uh->version.epoch = ntohl(uh->version.epoch);
+     uh->version.counter = ntohl(uh->version.counter);
+ 
      if ((uh->version.epoch != uv.epoch)
  	|| (uh->version.counter != uv.counter)) {
  	fprintf(stderr,
Index: openafs/src/ptserver/ptprocs.c
diff -c openafs/src/ptserver/ptprocs.c:1.29.2.3 openafs/src/ptserver/ptprocs.c:1.29.2.4
*** openafs/src/ptserver/ptprocs.c:1.29.2.3	Tue Oct 30 11:16:43 2007
--- openafs/src/ptserver/ptprocs.c	Wed Apr  2 15:51:56 2008
***************
*** 51,57 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptprocs.c,v 1.29.2.3 2007/10/30 15:16:43 shadow Exp $");
  
  #include <afs/stds.h>
  #include <ctype.h>
--- 51,57 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptprocs.c,v 1.29.2.4 2008/04/02 19:51:56 shadow Exp $");
  
  #include <afs/stds.h>
  #include <ctype.h>
***************
*** 647,654 ****
  		   AUD_END);
  	ViceLog(125, ("PTS_NameToID: code %d aname %s aid %d", code,
  		      aname->namelist_val[i], aid->idlist_val[i]));
! 	if (count++ > 50)
! 	    IOMGR_Poll(), count = 0;
      }
      aid->idlist_len = aname->namelist_len;
  
--- 647,658 ----
  		   AUD_END);
  	ViceLog(125, ("PTS_NameToID: code %d aname %s aid %d", code,
  		      aname->namelist_val[i], aid->idlist_val[i]));
! 	if (count++ > 50) {
! #ifndef AFS_PTHREAD_ENV
! 	    IOMGR_Poll();
! #endif
! 	    count = 0;
! 	}
      }
      aid->idlist_len = aname->namelist_len;
  
***************
*** 725,732 ****
  		  AUD_STR, aname->namelist_val[i], AUD_END);
  	ViceLog(125, ("PTS_idToName: code %d aid %d aname %s", code,
  		      aid->idlist_val[i], aname->namelist_val[i]));
! 	if (count++ > 50)
! 	    IOMGR_Poll(), count = 0;
      }
      aname->namelist_len = aid->idlist_len;
  
--- 729,740 ----
  		  AUD_STR, aname->namelist_val[i], AUD_END);
  	ViceLog(125, ("PTS_idToName: code %d aid %d aname %s", code,
  		      aid->idlist_val[i], aname->namelist_val[i]));
! 	if (count++ > 50) {
! #ifndef AFS_PTHREAD_ENV
! 	    IOMGR_Poll();
! #endif
! 	    count = 0;
! 	}
      }
      aname->namelist_len = aid->idlist_len;
  
***************
*** 821,828 ****
--- 829,838 ----
  	    if (code)
  		ABORT_WITH(tt, code);
  	    tentry.count--;	/* maintain count */
+ #ifndef AFS_PTHREAD_ENV
  	    if ((i & 3) == 0)
  		IOMGR_Poll();
+ #endif
  	}
  	tentry.next = centry.next;	/* thread out this block */
  	code = FreeBlock(tt, nptr);	/* free continuation block */
***************
*** 836,842 ****
--- 846,854 ----
  	code = ubik_EndTrans(tt);
  	if (code)
  	    return code;
+ #ifndef AFS_PTHREAD_ENV
  	IOMGR_Poll();		/* just to keep the connection alive */
+ #endif
  	code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt);
  	if (code)
  	    return code;
***************
*** 877,884 ****
--- 889,898 ----
  		if (code)
  		    ABORT_WITH(tt, code);
  		tentryg->countsg--;	/* maintain count */
+ #ifndef AFS_PTHREAD_ENV
  		if ((i & 3) == 0)
  		    IOMGR_Poll();
+ #endif
  	    }
  	    tentryg->nextsg = centry.next;	/* thread out this block */
  	    code = FreeBlock(tt, nptr);	/* free continuation block */
***************
*** 892,898 ****
--- 906,914 ----
  	    code = ubik_EndTrans(tt);
  	    if (code)
  		return code;
+ #ifndef AFS_PTHREAD_ENV
  	    IOMGR_Poll();	/* just to keep the connection alive */
+ #endif
  
  	    code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt);
  	    if (code)
***************
*** 933,940 ****
--- 949,958 ----
  	    if (code)
  		ABORT_WITH(tt, code);
  	    count++;
+ #ifndef AFS_PTHREAD_ENV
  	    if ((count & 3) == 0)
  		IOMGR_Poll();
+ #endif
  	}
  	if (count < 50)
  	    continue;
***************
*** 946,952 ****
--- 964,972 ----
  	code = ubik_EndTrans(tt);
  	if (code)
  	    return code;
+ #ifndef AFS_PTHREAD_ENV
  	IOMGR_Poll();		/* just to keep the connection alive */
+ #endif
  	code = ubik_BeginTrans(dbase, UBIK_WRITETRANS, &tt);
  	if (code)
  	    return code;
***************
*** 1662,1668 ****
--- 1682,1690 ----
  	    goto done;
  
  	if (++pollcount > 50) {
+ #ifndef AFS_PTHREAD_ENV
  	    IOMGR_Poll();
+ #endif
  	    pollcount = 0;
  	}
  
Index: openafs/src/ptserver/pts.c
diff -c openafs/src/ptserver/pts.c:1.15.2.5 openafs/src/ptserver/pts.c:1.15.2.6
*** openafs/src/ptserver/pts.c:1.15.2.5	Tue Mar 18 11:58:54 2008
--- openafs/src/ptserver/pts.c	Wed Apr  2 15:51:56 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pts.c,v 1.15.2.5 2008/03/18 15:58:54 shadow Exp $");
  
  #include <stdio.h>
  #include <string.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pts.c,v 1.15.2.6 2008/04/02 19:51:56 shadow Exp $");
  
  #include <stdio.h>
  #include <string.h>
***************
*** 108,114 ****
--- 108,118 ----
  	return 1;
      }
      delay = atoi(as->parms[0].items->data);
+ #ifdef AFS_PTHREAD_ENV
+     sleep(delay);
+ #else
      IOMGR_Sleep(delay);
+ #endif
      return 0;
  }
  
Index: openafs/src/ptserver/ptserver.c
diff -c openafs/src/ptserver/ptserver.c:1.25.2.7 openafs/src/ptserver/ptserver.c:1.25.2.8
*** openafs/src/ptserver/ptserver.c:1.25.2.7	Sun Feb  3 22:51:41 2008
--- openafs/src/ptserver/ptserver.c	Wed Apr  2 15:51:56 2008
***************
*** 112,118 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.25.2.7 2008/02/04 03:51:41 jaltman Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
--- 112,118 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.25.2.8 2008/04/02 19:51:56 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
***************
*** 522,527 ****
--- 522,531 ----
  	}
  	if (ccode == 1) {
  	    host = SHostAddrs[0];
+ 	    /* the following call is idempotent so if/when it gets called
+ 	     * again by the ubik init stuff, it doesn't really matter
+ 	     * -- klm
+ 	     */
  	    rx_InitHost(host, htons(AFSCONF_PROTPORT));
  	}
      }
Index: openafs/src/ptserver/ptutils.c
diff -c openafs/src/ptserver/ptutils.c:1.19.6.4 openafs/src/ptserver/ptutils.c:1.19.6.5
*** openafs/src/ptserver/ptutils.c:1.19.6.4	Tue Oct 30 11:16:43 2007
--- openafs/src/ptserver/ptutils.c	Wed Apr  2 15:51:56 2008
***************
*** 24,30 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptutils.c,v 1.19.6.4 2007/10/30 15:16:43 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 24,30 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptutils.c,v 1.19.6.5 2008/04/02 19:51:56 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 1300,1307 ****
  		return code;
  #endif
  	}
! 	if (count++ > 50)
! 	    IOMGR_Poll(), count = 0;
      }
  
      if (add) {			/* this is for a CPS, so tack on appropriate stuff */
--- 1300,1311 ----
  		return code;
  #endif
  	}
! 	if (count++ > 50) {
! #ifndef AFS_PTHREAD_ENV
! 	    IOMGR_Poll();
! #endif
! 	    count = 0;
! 	}
      }
  
      if (add) {			/* this is for a CPS, so tack on appropriate stuff */
***************
*** 1316,1323 ****
--- 1320,1329 ----
  		return code;
  	}
      }
+ #ifndef AFS_PTHREAD_ENV
      if (alist->prlist_len > 100)
  	IOMGR_Poll();
+ #endif
      qsort(alist->prlist_val, alist->prlist_len, sizeof(afs_int32), IDCmp);
      return PRSUCCESS;
  }
***************
*** 1376,1383 ****
  #endif
  	}
  	nptr = centry.next;
! 	if (count++ > 50)
! 	    IOMGR_Poll(), count = 0;
      }
  
      for (i = 0; i < PRSIZE; i++) {
--- 1382,1393 ----
  #endif
  	}
  	nptr = centry.next;
! 	if (count++ > 50) {
! #ifndef AFS_PTHREAD_ENV
! 	    IOMGR_Poll();
! #endif
! 	    count = 0;
! 	}
      }
  
      for (i = 0; i < PRSIZE; i++) {
***************
*** 1407,1414 ****
  		    break;
  	    }
  	    nptr = centry.next;
! 	    if (count++ > 50)
! 		IOMGR_Poll(), count = 0;
  	}
      }
      if (add) {			/* this is for a CPS, so tack on appropriate stuff */
--- 1417,1428 ----
  		    break;
  	    }
  	    nptr = centry.next;
! 	    if (count++ > 50) {
! #ifndef AFS_PTHREAD_ENV
! 		IOMGR_Poll();
! #endif
! 		count = 0;
! 	    }
  	}
      }
      if (add) {			/* this is for a CPS, so tack on appropriate stuff */
***************
*** 1423,1430 ****
--- 1437,1446 ----
  		return code;
  	}
      }
+ #ifndef AFS_PTHREAD_ENV
      if (alist->prlist_len > 100)
  	IOMGR_Poll();
+ #endif
      qsort(alist->prlist_val, alist->prlist_len, sizeof(afs_int32), IDCmp);
      return PRSUCCESS;
  }
***************
*** 1529,1536 ****
  		return code;
  	}
  	nptr = centry.next;
! 	if (count++ > 50)
! 	    IOMGR_Poll(), count = 0;
      }
  #if DEBUG_SG_MAP
      fprintf(stderr, "] for gid %d, done [flag=%s]\n", gid,
--- 1545,1556 ----
  		return code;
  	}
  	nptr = centry.next;
! 	if (count++ > 50) {
! #ifndef AFS_PTHREAD_ENV
! 	    IOMGR_Poll();
! #endif
! 	    count = 0;
! 	}
      }
  #if DEBUG_SG_MAP
      fprintf(stderr, "] for gid %d, done [flag=%s]\n", gid,
***************
*** 1589,1600 ****
  		return code;
  	}
  	nptr = centry.next;
! 	if (count++ > 50)
! 	    IOMGR_Poll(), count = 0;
      }
  
      if (alist->prlist_len > 100)
  	IOMGR_Poll();
      qsort((char *)alist->prlist_val, (int)alist->prlist_len,
  	  sizeof(afs_int32), IDCmp);
      return PRSUCCESS;
--- 1609,1626 ----
  		return code;
  	}
  	nptr = centry.next;
! 	if (count++ > 50) {
! #ifndef AFS_PTHREAD_ENV
! 	    IOMGR_Poll();
! #endif
! 	    count = 0;
! 	}
      }
  
+ #ifndef AFS_PTHREAD_ENV
      if (alist->prlist_len > 100)
  	IOMGR_Poll();
+ #endif
      qsort((char *)alist->prlist_val, (int)alist->prlist_len,
  	  sizeof(afs_int32), IDCmp);
      return PRSUCCESS;
***************
*** 1623,1633 ****
  	}
  	if (code)
  	    return code;
! 	if (count++ > 50)
! 	    IOMGR_Poll(), count = 0;
      }
      if (alist->prlist_len > 100)
  	IOMGR_Poll();
      qsort(alist->prlist_val, alist->prlist_len, sizeof(afs_int32), IDCmp);
      return PRSUCCESS;
  }
--- 1649,1665 ----
  	}
  	if (code)
  	    return code;
! 	if (count++ > 50) {
! #ifndef AFS_PTHREAD_ENV
! 	    IOMGR_Poll();
! #endif
! 	    count = 0;
! 	}
      }
+ #ifndef AFS_PTHREAD_ENV
      if (alist->prlist_len > 100)
  	IOMGR_Poll();
+ #endif
      qsort(alist->prlist_val, alist->prlist_len, sizeof(afs_int32), IDCmp);
      return PRSUCCESS;
  }
Index: openafs/src/ptserver/utils.c
diff -c openafs/src/ptserver/utils.c:1.15.14.2 openafs/src/ptserver/utils.c:1.15.14.3
*** openafs/src/ptserver/utils.c:1.15.14.2	Mon Feb  4 12:53:43 2008
--- openafs/src/ptserver/utils.c	Wed Apr  2 15:51:56 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/utils.c,v 1.15.14.2 2008/02/04 17:53:43 shadow Exp $");
  
  #include <sys/types.h>
  #include <lock.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/utils.c,v 1.15.14.3 2008/04/02 19:51:56 shadow Exp $");
  
  #include <sys/types.h>
  #include <lock.h>
***************
*** 901,907 ****
--- 901,909 ----
  	if (gid == AUTHUSERID && aid != ANONYMOUSID)
  	    return 1;
  	if (gid < 0) {
+ #ifndef AFS_PTHREAD_ENV
  	    IOMGR_Poll();
+ #endif
  	    if (IsAMemberOfSG(at, aid, gid, depth - 1))
  		return 1;
  	}
***************
*** 924,930 ****
--- 926,934 ----
  		if (gid == AUTHUSERID && aid != ANONYMOUSID)
  		    return 1;
  		if (gid < 0) {
+ #ifndef AFS_PTHREAD_ENV
  		    IOMGR_Poll();
+ #endif
  		    if (IsAMemberOfSG(at, aid, gid, depth - 1))
  			return 1;
  		}
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.56.2.7 openafs/src/rx/rx_kcommon.c:1.56.2.8
*** openafs/src/rx/rx_kcommon.c:1.56.2.7	Mon Mar 10 18:32:34 2008
--- openafs/src/rx/rx_kcommon.c	Wed Apr  9 12:40:00 2008
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.56.2.7 2008/03/10 22:32:34 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.56.2.8 2008/04/09 16:40:00 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 291,296 ****
--- 291,298 ----
  #ifdef RX_ENABLE_LOCKS
      AFS_GLOCK();
  #endif /* RX_ENABLE_LOCKS */
+ 
+     return NULL;
  }
  #endif /* !UKERNEL */
  
Index: openafs/src/tbudb/Makefile.in
diff -c /dev/null openafs/src/tbudb/Makefile.in:1.1.2.5
*** /dev/null	Mon Apr 21 17:11:57 2008
--- openafs/src/tbudb/Makefile.in	Wed Apr  2 23:54:53 2008
***************
*** 0 ****
--- 1,198 ----
+ # 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
+ # */
+ 
+ srcdir=@srcdir@
+ include @TOP_OBJDIR@/src/config/Makefile.config
+ 
+ CCRULE=${MT_CC} ${CFLAGS} ${MT_CFLAGS} -c $?
+ 
+ RX=../rx
+ UTIL=../util
+ BUDB=../budb
+ 
+ RXOBJS= rx_pthread.o rxkad_errs.o
+ 
+ UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o \
+      volparse.o flipbase64.o softsig.o hostparse.o snprintf.o pthread_glock.o
+ 
+ 
+ INCLS=\
+ 	${TOP_INCDIR}/lock.h \
+ 	${TOP_INCDIR}/ubik.h \
+ 	${TOP_INCDIR}/lwp.h \
+ 	${TOP_INCDIR}/des.h \
+ 	${TOP_INCDIR}/rx/rx.h \
+ 	${TOP_INCDIR}/rx/xdr.h \
+ 	${TOP_INCDIR}/rx/rxkad.h \
+ 	${TOP_INCDIR}/afs/auth.h \
+ 	${TOP_INCDIR}/afs/cellconfig.h \
+ 	${TOP_INCDIR}/afs/com_err.h \
+ 	${TOP_INCDIR}/afs/bubasics.h \
+ 	budb.h budb_client.h ${BUDB}/database.h
+ 
+ # library ordering defined by top level makefile
+ LIBS=${RXOBJS} ${UTILOBJS} \
+ 	${TOP_LIBDIR}/libbubasics.a \
+ 	${TOP_LIBDIR}/libubik_pthread.a \
+ 	${TOP_LIBDIR}/libafsauthent.a \
+ 	${TOP_LIBDIR}/libafsrpc.a \
+ 	${TOP_LIBDIR}/libcmd.a \
+ 	${TOP_LIBDIR}/libafsutil.a 
+ 
+ COMMON_OBJS = database.o db_alloc.o db_dump.o db_hash.o struct_ops.o ol_verify.o
+ 
+ SERVER_OBJS = ${COMMON_OBJS} budb.ss.o budb.xdr.o dbs_dump.o db_lock.o db_text.o \
+ 	procs.o server.o budb_errs.o
+ 
+ all: ${TOP_LIBDIR}/libbudb.a ${TOP_INCDIR}/afs/budb.h ${TOP_INCDIR}/afs/budb_errs.h ${TOP_INCDIR}/afs/budb_client.h budb_server ${INCLS}
+ 
+ #
+ # budb_errs.o actually depends on neither budb_client.h nor budb_errs.h
+ # but generating either of them will rebuild budb_errs.c
+ #
+ budb_errs.o: budb_errs.c budb_client.h budb_errs.h
+ 
+ budb_errs.c budb_client.h: ${BUDB}/budb_errs.et ${BUDB}/budb_client.p.h
+ 	$(RM) -f budb_client.h budb_errs.c; ${COMPILE_ET} -p ${BUDB} budb_errs -h budb_client
+ 
+ budb_errs.h: ${BUDB}/budb_errs.et
+ 	${COMPILE_ET} -p ${BUDB} budb_errs
+ 
+ #
+ # Build targets
+ #
+ 
+ rx_pthread.o: ${RX}/rx_pthread.c
+ 	${CCRULE}
+ 
+ rxkad_errs.o: ../rxkad/rxkad_errs.c
+ 	${CCRULE}
+ 
+ # get the pthreaded util stuff compiled here.  we do this instead of
+ # using the non-pthreaded libutil.a.  There probably should be a
+ # pthreaded version of this library, as we are doing with ubik itself, but...
+ #
+ 
+ assert.o: ${UTIL}/assert.c
+ 	${CCRULE}
+ 
+ uuid.o: ${UTIL}/uuid.c
+ 	${CCRULE}
+ 
+ serverLog.o: ${UTIL}/serverLog.c
+ 	${CCRULE}
+ 
+ fileutil.o: ${UTIL}/fileutil.c
+ 	${CCRULE}
+ 
+ volparse.o: ${UTIL}/volparse.c
+ 	${CCRULE}
+ 
+ flipbase64.o: ${UTIL}/flipbase64.c
+ 	${CCRULE}
+ 
+ netutils.o: ${UTIL}/netutils.c
+ 	${CCRULE}
+ 
+ dirpath.o: ${UTIL}/dirpath.c
+ 	${CCRULE}
+ 
+ softsig.o: ${UTIL}/softsig.c
+ 	${CCRULE}
+ 
+ hostparse.o: ${UTIL}/hostparse.c
+ 	${CCRULE}
+ 
+ snprintf.o: ${UTIL}/snprintf.c
+ 	${CCRULE}
+ 
+ pthread_glock.o: ${UTIL}/pthread_glock.c
+ 	${CCRULE}
+ 
+ 
+ database.o: ${BUDB}/database.c
+ 	${CCRULE}
+ 
+ db_alloc.o: ${BUDB}/db_alloc.c
+ 	${CCRULE}
+ 
+ db_dump.o: ${BUDB}/db_dump.c
+ 	${CCRULE}
+ 
+ dbs_dump.o: ${BUDB}/dbs_dump.c
+ 	${CCRULE}
+ 
+ db_lock.o:  ${BUDB}/db_lock.c
+ 	${CCRULE}
+ 
+ db_text.o:  ${BUDB}/db_text.c
+ 	${CCRULE}
+ 
+ db_hash.o: ${BUDB}/db_hash.c
+ 	${CCRULE}
+ 
+ ol_verify.o: ${BUDB}/ol_verify.c
+ 	${CCRULE}
+ 
+ procs.o: ${BUDB}/procs.c
+ 	${CCRULE}
+ 
+ struct_ops.o: ${BUDB}/struct_ops.c
+ 	${CCRULE}
+ 
+ server.o: ${BUDB}/server.c
+ 	${CCRULE}
+ 
+ 
+ budb_server: $(SERVER_OBJS) ${LIBS}
+ 	${CC} ${LDFLAGS} -o budb_server $(SERVER_OBJS) ${LIBS} ${MT_LIBS} ${XLIBS}
+ 
+ budb.cs.c: ${BUDB}/budb.rg
+ 	${RXGEN} -u -C -o $@ ${BUDB}/budb.rg
+ 
+ budb.ss.c: ${BUDB}/budb.rg
+ 	${RXGEN} -S -o $@ ${BUDB}/budb.rg
+ 
+ budb.xdr.c: ${BUDB}/budb.rg
+ 	${RXGEN} -c -o $@ ${BUDB}/budb.rg
+ 
+ budb.h: ${BUDB}/budb.rg
+ 	${RXGEN} -u -h -o $@ ${BUDB}/budb.rg
+ 
+ budb.cs.c: budb.h
+ budb.xdr.c: budb.h
+ budb.ss.c: budb.h
+ 
+ libbudb.a: budb_errs.o budb.cs.o budb.xdr.o struct_ops.o AFS_component_version_number.o
+ 	-$(RM) -f $@
+ 	$(AR) crv $@ budb_errs.o budb.cs.o budb.xdr.o struct_ops.o AFS_component_version_number.o
+ 	$(RANLIB) $@
+ 
+ #
+ # Install targets
+ #
+ install: \
+ 	${DESTDIR}${afssrvlibexecdir}/buserver
+ 
+ ${DEST}/root.server/usr/afs/bin/buserver: budb_server
+ 	${INSTALL} -f $? $@
+ 
+ #
+ # Misc targets
+ #
+ clean:
+ 	$(RM) -f *.o *~ budb_errs.[ch] budb.h budb_client.h *.a *.xdr.c \
+ 		*.ss.c *.cs.c core budb_server AFS_component_version_number.c
+ 
+ include ../config/Makefile.version
+ ${DESTDIR}${afssrvlibexecdir}/buserver: budb_server
+ 	${INSTALL} -f $? $@
+ 
+ dest: \
+ 	${DEST}/root.server/usr/afs/bin/buserver
+ 
Index: openafs/src/tests/Makefile.in
diff -c openafs/src/tests/Makefile.in:1.13.2.1 openafs/src/tests/Makefile.in:1.13.2.2
*** openafs/src/tests/Makefile.in:1.13.2.1	Mon Jan 21 14:42:13 2008
--- openafs/src/tests/Makefile.in	Mon Mar 31 11:54:02 2008
***************
*** 359,365 ****
  
  uninstall:
  
! all: run-tests dirpath.conf OpenAFS/Dirpath.pm libxfiles.a libdumpscan.a $(TEST_PROGRAMS)\
  	afsdump_scan afsdump_dirlist afsdump_extract dumptool
  	@chmod +x run-tests
  
--- 359,365 ----
  
  uninstall:
  
! all: run-tests OpenAFS/Dirpath.pm libxfiles.a libdumpscan.a $(TEST_PROGRAMS)\
  	afsdump_scan afsdump_dirlist afsdump_extract dumptool
  	@chmod +x run-tests
  
***************
*** 378,402 ****
  check-fast: run-tests $(TEST_PROGRAMS)
  	./run-tests -all -fast
  
! dirpath.conf: Makefile
! 	@echo "creating $@"
! 	@echo "# auto-generated by src/tests/Makefile"      >$@
! 	@echo "# DO NOT EDIT"                               >>$@
! 	@echo "afsconfdir=@afsconfdir@"                     >>$@
! 	@echo "viceetcdir=@viceetcdir@"                     >>$@
! 	@echo "afssrvbindir=@afssrvbindir@"                 >>$@
! 	@echo "afssrvsbindir=@afssrvsbindir@"               >>$@
! 	@echo "afssrvlibexecdir=@afssrvlibexecdir@"         >>$@
! 	@echo "afsdbdir=@afsdbdir@"                         >>$@
! 	@echo "afslogsdir=@afslogsdir@"                     >>$@
! 	@echo "afslocaldir=@afslocaldir@"                   >>$@
! 	@echo "afsbackupdir=@afsbackupdir@"                 >>$@
! 	@echo "afsbosconfigdir=@afsbosconfigdir@"           >>$@
! 	@echo "afskerneldir=@afskerneldir@"                 >>$@
! 	@echo "initdir=@sysconfdir@"                        >>$@
! 	@echo "localstatedir=@localstatedir@"               >>$@
! 	@echo "ostype=@MKAFS_OSTYPE@"                       >>$@
! 
  OpenAFS/Dirpath.pm: Makefile
  	@echo "Creating OpenAFS/Dirpath.pm"
  	@echo "# This is -*- perl -*-"                          >$@
--- 378,386 ----
  check-fast: run-tests $(TEST_PROGRAMS)
  	./run-tests -all -fast
  
! # Note: The autoconf variables are not fully expanded
! #       until make is run so we resort to creating the
! #       configuration at make time.
  OpenAFS/Dirpath.pm: Makefile
  	@echo "Creating OpenAFS/Dirpath.pm"
  	@echo "# This is -*- perl -*-"                          >$@
***************
*** 420,431 ****
  	@echo "  'afslocaldir'      => '@afslocaldir@',"        >>$@
  	@echo "  'afsbackupdir'     => '@afsbackupdir@',"       >>$@
  	@echo "  'afsbosconfigdir'  => '@afsbosconfigdir@',"    >>$@
- 	@echo "  'afskerneldir'     => '@afskerneldir@',"       >>$@
- 	@echo "  'initdir'          => '@sysconfdir@',"         >>$@
- 	@echo "  'localstatedir'    => '@localstatedir@',"      >>$@
  	@echo "  'ostype'           => '@MKAFS_OSTYPE@',"       >>$@
  	@echo "};"                                              >>$@
  	@echo ""                                                >>$@
  	@echo "1;"                                              >>$@
  
  .PHONY:		all install clean realclean distclean mostlyclean install uninstall check
--- 404,428 ----
  	@echo "  'afslocaldir'      => '@afslocaldir@',"        >>$@
  	@echo "  'afsbackupdir'     => '@afsbackupdir@',"       >>$@
  	@echo "  'afsbosconfigdir'  => '@afsbosconfigdir@',"    >>$@
  	@echo "  'ostype'           => '@MKAFS_OSTYPE@',"       >>$@
+ 	@if test "@afsconfdir@" = "/usr/afs/etc" ; then \
+ 		echo "  # transarc paths" ;\
+ 		echo "  'cachedir'     => '/usr/vice/cache'," ;\
+ 		echo "  'afsddir'      => '/usr/vice/etc'," ;\
+ 		echo "  'initdir'      => '/usr/vice/etc',"  ;\
+ 		echo "  'afskerneldir' => '/usr/vice/etc/modload'," ;\
+ 		echo "  'afswsbindir'  => '/usr/afsws/bin'," ;\
+ 	else \
+ 		echo "  # modern paths" ;\
+ 		echo "  'cachedir'     => '@localstatedir@/openafs/cache'," ;\
+ 		echo "  'afsddir'      => '@afssrvsbindir@'," ;\
+ 		echo "  'initdir'      => '@sysconfdir@',"  ;\
+ 		echo "  'afskerneldir' => '@afskerneldir@'," ;\
+ 		echo "  'afswsbindir'  => '@afssrvbindir@'," ;\
+ 	fi >>$@
  	@echo "};"                                              >>$@
  	@echo ""                                                >>$@
  	@echo "1;"                                              >>$@
  
+ 
  .PHONY:		all install clean realclean distclean mostlyclean install uninstall check
Index: openafs/src/tests/afs-newcell.pl
diff -c openafs/src/tests/afs-newcell.pl:1.1.22.1 openafs/src/tests/afs-newcell.pl:1.1.22.2
*** openafs/src/tests/afs-newcell.pl:1.1.22.1	Mon Jan 21 14:42:13 2008
--- openafs/src/tests/afs-newcell.pl	Mon Mar 31 11:54:02 2008
***************
*** 12,49 ****
  use OpenAFS::Auth;
  use Getopt::Long;
  use Pod::Usage;
  
  =head1  NAME
  
!    afs-newcell - Set up initial database server for AFS cell.
  
  =head1 SYNOPSIS
  
  B<afs-newcell>
!        B<--batch>
!        B<--debug>
!        B<--dont-unwind>
!        B<--help>
!        B<--ostype>=os
!        B<--server>=hostname
!        B<--cellname>=cell
!        B<--partition>=partition
!        B<--admin>=administrator
!        B<--kerberos-type>=authentication_type
!        B<--kerberos-realm>=realm_name
!        B<--kerberos-keytab>=keytab_file
!        B<--skip-make-keyfile>
!        B<--with-dafs>
!        B<--options-fileserver>=options
!        B<--options-volserver>=options
!        B<--options-salvageserver>=options
! 	   B<--options-salvager>=options 
  
  =head1 DESCRIPTION
  
  This script sets up the initial AFS database and configures the first
! database/file server. It also sets up an AFS cell's root volumes.  It assumes
! that you already have a fileserver and database servers installed.  The
  fileserver should have an empty root.afs. This script creates root.cell, user,
  service and populates root.afs.  
  
--- 12,50 ----
  use OpenAFS::Auth;
  use Getopt::Long;
  use Pod::Usage;
+ use Socket;
  
  =head1  NAME
  
!    afs-newcell - Set up the initial database and file server for a new OpenAFS cell.
  
  =head1 SYNOPSIS
  
  B<afs-newcell>
!        [ B<--batch> ]
!        [ B<--debug> ]
!        [ B<--unwind> ]
!        [ B<--help> ]
!        [ B<--server>=hostname ]
!        [ B<--cellname>=cell ]
!        [ B<--partition>=partition ]
!        [ B<--admin>=administrator ]
!        [ B<--kerberos-type>=authentication_type ]
!        [ B<--kerberos-realm>=realm_name ]
!        [ B<--kerberos-keytab>=keytab_file ]
!        [ B<--with-dafs> ]
!        [ B<--options-ptserver>=options ]
!        [ B<--options-vlserver>=options ]
!        [ B<--options-fileserver>=options ]
!        [ B<--options-volserver>=options ] 
!        [ B<--options-salvageserver>=options ]
!        [ B<--options-salvager>=options ]
  
  =head1 DESCRIPTION
  
  This script sets up the initial AFS database and configures the first
! database/file server. It also sets up an AFS cell's root volumes.  The
! fileserver and database server binaries must already be installed.  The
  fileserver should have an empty root.afs. This script creates root.cell, user,
  service and populates root.afs.  
  
***************
*** 88,94 ****
  You will need an administrative principal created in a Kerberos realm.  This
  principal will be added to system:administrators and thus will be able to run
  administrative commands.  Generally the user is a root instance of some
! administravie user.  For example if jruser is an administrator then it would be
  reasonable to create jruser/root and specify jruser/root as the user to be
  added in this script using the 'admin' command line option.  You will also need
  to create a keyfile for this adminstrative user which is used by the script to
--- 89,95 ----
  You will need an administrative principal created in a Kerberos realm.  This
  principal will be added to system:administrators and thus will be able to run
  administrative commands.  Generally the user is a root instance of some
! administrative user.  For example if jruser is an administrator then it would be
  reasonable to create jruser/root and specify jruser/root as the user to be
  added in this script using the 'admin' command line option.  You will also need
  to create a keyfile for this adminstrative user which is used by the script to
***************
*** 125,141 ****
  #
  sub mkvol($$$$) {
      my ($vol, $mnt, $srv, $part) = @_;
!     run("$path->{'afssrvsbindir'}/vos create $srv $part $vol -maxquota 0 -localauth");
!     unwind("$path->{'afssrvsbindir'}/vos remove $srv $part $vol -localauth");
!     run("$path->{'afssrvbindir'}/fs mkm $mnt $vol ");
!     run("$path->{'afssrvbindir'}/fs sa $mnt system:anyuser rl");
  }
  
  #-----------------------------------------------------------------------------------
  # check_program($prog) - verify the program is installed.
  #
  sub check_program($) {
!     my ($program) = @_;
    unless ( -f $program ) {
       die "error: Missing program: $program\n";
    }
--- 126,142 ----
  #
  sub mkvol($$$$) {
      my ($vol, $mnt, $srv, $part) = @_;
!     run("$path->{'afssrvsbindir'}/vos create $srv $part $vol -maxquota 0");
!     unwind("$path->{'afssrvsbindir'}/vos remove $srv $part $vol");
!     run("$path->{'afssrvbindir'}/fs mkmount $mnt $vol ");
!     run("$path->{'afssrvbindir'}/fs setacl $mnt system:anyuser rl");
  }
  
  #-----------------------------------------------------------------------------------
  # check_program($prog) - verify the program is installed.
  #
  sub check_program($) {
!   my ($program) = @_;
    unless ( -f $program ) {
       die "error: Missing program: $program\n";
    }
***************
*** 150,181 ****
  # options
  my $batch = 0;
  my $debug = 0;
! my $dont_unwind = 0;
  my $help = 0;
- my $ostype = $path->{'ostype'};
- my $server = 'localhost';
  my $cellname = 'testcell';
! my $partition = '/vicepa';
  my $admin = 'admin';
  my $kerberos_type = 'MIT';
  my $kerberos_realm = 'TESTCELL';
  my $kerberos_keytab = "$path->{'afsconfdir'}/krb5.keytab";
- my $skip_make_keyfile = 0;
  my $with_dafs = 0;
  my $options_fileserver = '';
  my $options_volserver = '';
  my $options_salvageserver = '';
  my $options_salvager = '';
  
! $server = `hostname`;
  chomp $server;
  
  GetOptions (
!        "batch" => \$batch, 
         "debug!" => \$debug,
!        "dont-unwind!" => \$dont_unwind,
         "help" => \$help,
-        "ostype=s" => \$ostype,
         "server=s" => \$server,
         "cellname=s" => \$cellname, 
         "partition=s" => \$partition,
--- 151,180 ----
  # options
  my $batch = 0;
  my $debug = 0;
! my $unwind = 1;
  my $help = 0;
  my $cellname = 'testcell';
! my $partition = 'a';
  my $admin = 'admin';
  my $kerberos_type = 'MIT';
  my $kerberos_realm = 'TESTCELL';
  my $kerberos_keytab = "$path->{'afsconfdir'}/krb5.keytab";
  my $with_dafs = 0;
+ my $options_ptserver = '';
+ my $options_vlserver = '';
  my $options_fileserver = '';
  my $options_volserver = '';
  my $options_salvageserver = '';
  my $options_salvager = '';
  
! my $server = `hostname -f`;
  chomp $server;
  
  GetOptions (
!        "batch!" => \$batch, 
         "debug!" => \$debug,
!        "unwind!" => \$unwind,
         "help" => \$help,
         "server=s" => \$server,
         "cellname=s" => \$cellname, 
         "partition=s" => \$partition,
***************
*** 183,190 ****
         "kerberos-type=s" => \$kerberos_type,
         "kerberos-realm=s" => \$kerberos_realm,
         "kerberos-keytab=s" => \$kerberos_keytab,
-        "skip-make-keyfile" => \$skip_make_keyfile,
         "with-dafs" => \$with_dafs,
         "options-fileserver=s" => \$options_fileserver,
         "options-volserver=s" => \$options_volserver,
         "options-salvageserver=s" => \$options_salvageserver,
--- 182,190 ----
         "kerberos-type=s" => \$kerberos_type,
         "kerberos-realm=s" => \$kerberos_realm,
         "kerberos-keytab=s" => \$kerberos_keytab,
         "with-dafs" => \$with_dafs,
+        "options-ptserver=s" => \$options_ptserver,
+        "options-vlserver=s" => \$options_vlserver,
         "options-fileserver=s" => \$options_fileserver,
         "options-volserver=s" => \$options_volserver,
         "options-salvageserver=s" => \$options_salvageserver,
***************
*** 196,212 ****
    exit 0;
  }
  
! # print debug messages when running commands.
  $OpenAFS::ConfigUtils::debug = $debug;
  
! #
! # Verify we have a clean slate before starting.
  #
  my @problems = ();
  my $try_rm_cell = 0;
  
  if ($> != 0) {
!   push(@problems, "This script should run as root.");
  }
  
  my @afsconfigfiles = (
--- 196,212 ----
    exit 0;
  }
  
! # To print debug messages in the run() calls.
  $OpenAFS::ConfigUtils::debug = $debug;
  
! #-----------------------------------------------------------------------------
! # Prereq: Must be root and must not already have a cell configuration.
  #
  my @problems = ();
  my $try_rm_cell = 0;
  
  if ($> != 0) {
!   push(@problems, "You must be root to run this script.");
  }
  
  my @afsconfigfiles = (
***************
*** 215,220 ****
--- 215,222 ----
    "$path->{'afsconfdir'}/UserList",
    "$path->{'afsdbdir'}/prdb.DB0",
    "$path->{'afsbosconfigdir'}/BosConfig",
+   "$path->{'afsddir'}/ThisCell",
+   "$path->{'afsddir'}/CellServDB",
  );
  foreach my $configfile (@afsconfigfiles) {
    if ( -f $configfile ) {
***************
*** 231,238 ****
    exit 1;
  }
  
! #
! # Interactive mode
  #
  unless ($batch) {
  
--- 233,240 ----
    exit 1;
  }
  
! #-----------------------------------------------------------------------------
! # Prereq: System requirements notification.
  #
  unless ($batch) {
  
***************
*** 246,265 ****
     the --partition option for alternative mount points.)
  
  2) The OpenAFS client and server binaries must be installed.
!    The init scripts to start and stop the client and servers 
!    must be installed and configured. OpenAFS/OS.pm must be 
!    configured for your system. There should be no remants
!    from a previous cell. Run afs-rmcell to remove any.
  
! 3) A Kerberos realm with Kerberos4 support must be available.
     Supported Kerberos implementations are Heimdal with
     Kth-kerberos compatibility, MIT Kerberos 5, and 
!    Kaserver (deprecated). OpenAFS/Auth.pm must be configured
!    for your system.
  
  4) A Kerberos keytab file containing the afs principal 
!    and the administrator principal must be be present at
!    $path->{'afsconfdir'}/krb5.keytab.
     See the asetkey man page for information about creating the
     keytab file.  The default name of the administrator 
     principal is 'admin'. See the --admin option for
--- 248,263 ----
     the --partition option for alternative mount points.)
  
  2) The OpenAFS client and server binaries must be installed.
!    There should be no remnants from a previous cell. 
!    Run afs-rmcell to remove any.
  
! 3) A Kerberos realm with Kerberos 4 support must be available.
     Supported Kerberos implementations are Heimdal with
     Kth-kerberos compatibility, MIT Kerberos 5, and 
!    Kaserver (deprecated). 
  
  4) A Kerberos keytab file containing the afs principal 
!    and the administrator principal must be be present.
     See the asetkey man page for information about creating the
     keytab file.  The default name of the administrator 
     principal is 'admin'. See the --admin option for
***************
*** 270,356 ****
    my $answer = prompt("Does your system meet these requirements? (yes/no)", "no");
    unless ($answer=~/^y/i ) {
      print "OK: Aborted.\n";
!   exit 0;
    }
  
!   print "\nServer options:\n"; 
!   $ostype = prompt("Which OS?", $ostype);
!   $server = prompt("What server name should be used?", $server);
!   $cellname = prompt("What cellname should be used?", $cellname);
!   $partition = prompt("What vice partition?", $partition);
!   $admin = prompt("What administrator username?", $admin);
!   if($admin =~ /@/) {
!     die "error: Please specify the username without the realm name.\n";
!   }
  
!   print "\nKerberos options:\n";
!   $kerberos_type = prompt("Which Kerberos is to be used?", $kerberos_type);
!   if ($kerberos_type!~/kaserver/i) {
!     $kerberos_realm  = prompt("What Kerberos realm?", $kerberos_realm);
!     $kerberos_keytab = prompt("What keytab file?", $kerberos_keytab);
!     $answer = prompt("Create OpenAFS KeyFile from a keytab? (yes/no)", "yes");
!     $skip_make_keyfile = ($answer=~/^y/i) ? 0 : 1;
!   }
! 
!   print "\nFileserver options:\n";
!   $answer = prompt("Use DAFS fileserver (requires DAFS build option)? (yes/no)", "no");
!   $with_dafs = ($answer=~/^y/i) ? 1 : 0;
!   $options_fileserver = prompt("fileserver options:", $options_fileserver);
!   $options_volserver = prompt("volserver options:",  $options_volserver);
!   $options_salvageserver = prompt("salvageserver options:",  $options_salvageserver);
!   $options_salvager = prompt("salvager options:", $options_salvager);
! 
!   print "\nConfirmation:\n";
!   print "OS Type                : $ostype\n";
!   print "Server name            : $server\n";
!   print "Cell name              : $cellname\n";
!   print "Partition              : $partition\n";
!   print "Administrator          : $admin\n";
!   print "Kerberos               : $kerberos_type\n";
!   if ($kerberos_type!~/kaserver/i) {
!     print "Realm                  : $kerberos_realm\n";
!     print "Keytab file            : $kerberos_keytab\n";
!     print "Make KeyFile           : ", $skip_make_keyfile ? "yes" : "no", "\n";
!   }
!   print "DAFS fileserver        : ", $with_dafs ? "yes" : "no", "\n";
!   print "fileserver options     : $options_fileserver\n";
!   print "volserver options      : $options_volserver\n";
!   print "salvagerserver options : $options_salvageserver\n";
!   print "salvager options       : $options_salvager\n";
!   print "\n";
  
!   $answer = prompt("Continue? (yes/no)", "yes");
!   unless ($answer=~/^y/i ) {
!     print "OK: Aborted.\n";
!   exit 0;
    }
  
!   # Save the options for the next time.
!   $answer = prompt("Save as command-line options? (yes/no)", "yes");
    if ($answer=~/^y/i ) {
!     my $switches = "";
!     $switches .= "--batch";
!     $switches .= " --debug"                                          if $debug;
!     $switches .= " --dont_unwind"                                    if $dont_unwind;
!     $switches .= " --ostype='$ostype'"                               if $ostype;
!     $switches .= " --server='$server'"                               if $server;
!     $switches .= " --cellname='$cellname'"                           if $cellname;
!     $switches .= " --partition='$partition'"                         if $partition;
!     $switches .= " --admin='$admin'"                                 if $admin;
!     $switches .= " --kerberos-type='$kerberos_type'"                 if $kerberos_type;
!     $switches .= " --kerberos-realm='$kerberos_realm'"               if $kerberos_realm;
!     $switches .= " --kerberos-keytab='$kerberos_keytab'"             if $kerberos_keytab;
!     $switches .= " --skip-make-keyfile"                              if $skip_make_keyfile;
!     $switches .= " --with-dafs"                                      if $with_dafs;
!     $switches .= " --options-fileserver='$options_fileserver'"       if $options_fileserver;
!     $switches .= " --options-volserver='$options_volserver'"         if $options_volserver;;
!     $switches .= " --options-salvageserver='$options_salvageserver'" if $options_salvageserver;;
!     $switches .= " --options-salvager='$options_salvager'"           if $options_salvager;
    
!     my $conf = prompt("Filename for save?", "afs-newcell.conf");
!     open(CONF, "> $conf") or die "error: Cannot open file $conf: $!\n";
!     print CONF "$switches\n";
!     close CONF;
    }
  }
  
--- 268,421 ----
    my $answer = prompt("Does your system meet these requirements? (yes/no)", "no");
    unless ($answer=~/^y/i ) {
      print "OK: Aborted.\n";
!     exit 0;
    }
+ }
  
! #-----------------------------------------------------------------------------
! # Prereq: Verify required binaries, directories, and permissions.
! #
! my $bosserver = "$path->{'afssrvsbindir'}/bosserver";
! my $bos       = "$path->{'afssrvbindir'}/bos";
! my $fs        = "$path->{'afssrvbindir'}/fs";
! my $pts       = "$path->{'afssrvbindir'}/pts";
! my $vos       = "$path->{'afssrvsbindir'}/vos";
! my $afsrc     = "$path->{'initdir'}/afs.rc";
! my $aklog     = "$path->{'afswsbindir'}/aklog";
! my $tokens    = "$path->{'afswsbindir'}/tokens";
! my $klog      = "$path->{'afswsbindir'}/klog";
! my $kas       = "$path->{'afssrvsbindir'}/kas";
  
! check_program($bosserver);
! check_program($bos);
! check_program($fs);
! check_program($pts);
! check_program($vos);
! check_program($afsrc);
! check_program($tokens);
  
! #-----------------------------------------------------------------------------
! # Prereq: Cell configuration
! #
! if ($batch) {
!   if ($kerberos_type!~/kaserver/i) {
!     check_program($aklog);
!     unless ( -f $kerberos_keytab ) {
!       die "error: Missing keytab file: $kerberos_keytab\n";
!     }
!   }
! }
! else {
!   my $answer;
!   get_options: {
!     $answer = prompt("Print afs-newcell debugging messages? (yes/no)", $debug ? "yes" : "no");
!     $debug = ($answer=~/^y/i) ? 1 : 0;
! 
!     print "\nServer options:\n"; 
!     $server = prompt("What server name should be used?", $server);
!     $cellname = prompt("What cellname should be used?", $cellname);
!     $partition = prompt("What vice partition?", $partition);
!     $admin = prompt("What administrator username?", $admin);
!     if($admin =~ /@/) {
!       die "error: Please specify the username without the realm name.\n";
!     }
!   
!     print "\nKerberos options:\n";
!     $kerberos_type = prompt("Which Kerberos is to be used?", $kerberos_type);
!     if ($kerberos_type=~/kaserver/i) {
!       check_program($klog);
!       check_program($kas);
!     }
!     else {
!       check_program($aklog);
!       $kerberos_realm = $cellname;
!       $kerberos_realm =~ tr/a-z/A-Z/;
!       $kerberos_realm = prompt("What Kerberos realm?", $kerberos_realm);
!       get_keytab: {
!         $kerberos_keytab = prompt("What keytab file?", $kerberos_keytab);
!         unless ( -f $kerberos_keytab ) {
!           print "Cannot find keytab file $kerberos_keytab\n";
!           redo get_keytab;
!         }
!       }
!     }
!   
!     print "\nDatabase Server options:\n";
!     $options_ptserver = prompt("ptserver options:", $options_ptserver);
!     $options_vlserver = prompt("vlserver options:", $options_vlserver);
! 
!     print "\nFileserver options:\n";
!     $answer = prompt("Use DAFS fileserver (requires DAFS build option)? (yes/no)", "no");
!     $with_dafs = ($answer=~/^y/i) ? 1 : 0;
!     $options_fileserver = prompt("fileserver options:", $options_fileserver);
!     $options_volserver = prompt("volserver options:",  $options_volserver);
!     $options_salvageserver = prompt("salvageserver options:",  $options_salvageserver);
!     $options_salvager = prompt("salvager options:", $options_salvager);
!   
!     print "\nConfirmation:\n";
!     print "Server name            : $server\n";
!     print "Cell name              : $cellname\n";
!     print "Partition              : $partition\n";
!     print "Administrator          : $admin\n";
!     print "Kerberos               : $kerberos_type\n";
!     if ($kerberos_type!~/kaserver/i) {
!       print "Realm                  : $kerberos_realm\n";
!       print "Keytab file            : $kerberos_keytab\n";
!     }
!     print "DAFS fileserver        : ", $with_dafs ? "yes" : "no", "\n";
!     print "ptserver options       : $options_ptserver\n";
!     print "vlserver options       : $options_vlserver\n";
!     print "fileserver options     : $options_fileserver\n";
!     print "volserver options      : $options_volserver\n";
!     print "salvagerserver options : $options_salvageserver\n";
!     print "salvager options       : $options_salvager\n";
!     print "\n";
!   
!     $answer = prompt("Correct? (yes/no/quit)", "yes");
!     exit(0)          if $answer=~/^q/i;
!     redo get_options if $answer!~/^y/i;
    }
  
!   # Save the options as a shell script for the next run.
!   $answer = prompt("Save these options? (yes/no)", "yes");
    if ($answer=~/^y/i ) {
!     my $script = '';
!     get_script_name: {
!       $script = prompt("File name for save?", "run-afs-newcell.sh");
!       last get_script_name if ! -f $script;
! 
!       $answer = prompt("File $script already exists. Overwrite? (yes/no/quit)", "no");
!       exit(0)              if $answer=~/^q/i;
!       last get_script_name if $answer=~/^yes/i;
!       redo get_script_name;
!     }
! 
!     my @switches = ();
!     push(@switches, "--batch"); # automatically added to the script
!     push(@switches, "--debug")                                          if $debug;
!     push(@switches, "--nounwind")                                       unless $unwind;
!     push(@switches, "--server='$server'")                               if $server;
!     push(@switches, "--cellname='$cellname'")                           if $cellname;
!     push(@switches, "--partition='$partition'")                         if $partition;
!     push(@switches, "--admin='$admin'")                                 if $admin;
!     push(@switches, "--kerberos-type='$kerberos_type'")                 if $kerberos_type;
!     push(@switches, "--kerberos-realm='$kerberos_realm'")               if $kerberos_realm;
!     push(@switches, "--kerberos-keytab='$kerberos_keytab'")             if $kerberos_keytab;
!     push(@switches, "--with-dafs")                                      if $with_dafs;
!     push(@switches, "--options-ptserver='$options_ptserver'")           if $options_ptserver;
!     push(@switches, "--options-vlserver='$options_vlserver'")           if $options_vlserver;
!     push(@switches, "--options-fileserver='$options_fileserver'")       if $options_fileserver;
!     push(@switches, "--options-volserver='$options_volserver'")         if $options_volserver;;
!     push(@switches, "--options-salvageserver='$options_salvageserver'") if $options_salvageserver;;
!     push(@switches, "--options-salvager='$options_salvager'")           if $options_salvager;
    
!     open(SCRIPT, "> $script") or die "error: Cannot open file $script: $!\n";
!     print SCRIPT "#!/bin/sh\n";
!     print SCRIPT "perl afs-newcell.pl \\\n";
!     print SCRIPT join(" \\\n", map("  $_", @switches));
!     print SCRIPT "\n\n";
!     close SCRIPT;
!     chmod(0755, $script);
    }
  }
  
***************
*** 358,366 ****
    print "debug: afs-newcell options\n";
    print "debug:  \$batch = '$batch'\n";
    print "debug:  \$debug = '$debug'\n";
!   print "debug:  \$dont_unwind = '$dont_unwind'\n";
    print "debug:  \$help = '$help'\n";
-   print "debug:  \$ostype = '$ostype'\n";
    print "debug:  \$server = '$server'\n";
    print "debug:  \$cellname = '$cellname'\n";
    print "debug:  \$partition = '$partition'\n";
--- 423,430 ----
    print "debug: afs-newcell options\n";
    print "debug:  \$batch = '$batch'\n";
    print "debug:  \$debug = '$debug'\n";
!   print "debug:  \$unwind = '$unwind'\n";
    print "debug:  \$help = '$help'\n";
    print "debug:  \$server = '$server'\n";
    print "debug:  \$cellname = '$cellname'\n";
    print "debug:  \$partition = '$partition'\n";
***************
*** 368,418 ****
    print "debug:  \$kerberos_type = '$kerberos_type'\n";
    print "debug:  \$kerberos_realm = '$kerberos_realm'\n";
    print "debug:  \$kerberos_keytab = '$kerberos_keytab'\n";
-   print "debug:  \$skip_make_keyfile = '$skip_make_keyfile'\n";
    print "debug:  \$with_dafs = '$with_dafs'\n";
    print "debug:  \$options_fileserver = '$options_fileserver'\n";
    print "debug:  \$options_volserver = '$options_volserver'\n";
    print "debug:  \$options_salvageserver = '$options_salvageserver'\n";
    print "debug:  \$options_salvager = '$options_salvager'\n";
  }
  
! # 
! # Create an auth object for the type of kerberos
! # to be used for authentication in our cell.
  #
  my $auth = OpenAFS::Auth::create(
        'debug'=>$debug,
        'type'=>$kerberos_type, 
        'cell'=>$cellname,
        'realm'=>$kerberos_realm,
        'keytab'=>$kerberos_keytab,
        );
  
  my $os = OpenAFS::OS::create(
        'debug'=>$debug,
-       'ostype'=>$ostype,
        );
  
! #
! # Sanity checks before we begin. Make sure we have correct
! # binaries, directories, and permissions.
! #
! 
! my $bosserver = "$path->{'afssrvsbindir'}/bosserver";
! my $bos       = "$path->{'afssrvbindir'}/bos";
! my $fs        = "$path->{'afssrvbindir'}/fs";
! my $pts       = "$path->{'afssrvbindir'}/pts";
! my $vos       = "$path->{'afssrvsbindir'}/vos";
! 
! check_program($bosserver);
! check_program($bos);
! check_program($fs);
! check_program($pts);
! check_program($vos);
! 
! 
! #
! # Sanity check admin username and convert kerberos 5 notation to afs.
  #
  if ($admin =~ /@/) {
     die "error: Please specify the username without the realm name.\n";
--- 432,508 ----
    print "debug:  \$kerberos_type = '$kerberos_type'\n";
    print "debug:  \$kerberos_realm = '$kerberos_realm'\n";
    print "debug:  \$kerberos_keytab = '$kerberos_keytab'\n";
    print "debug:  \$with_dafs = '$with_dafs'\n";
+   print "debug:  \$options_pteserver = '$options_ptserver'\n";
+   print "debug:  \$options_pteserver = '$options_vlserver'\n";
    print "debug:  \$options_fileserver = '$options_fileserver'\n";
    print "debug:  \$options_volserver = '$options_volserver'\n";
    print "debug:  \$options_salvageserver = '$options_salvageserver'\n";
    print "debug:  \$options_salvager = '$options_salvager'\n";
  }
  
! 
! #-----------------------------------------------------------------------------
! # Prereq: Sanity check the forward and reverse name resolution.
  #
+ if ($server eq 'localhost') {
+   die "error: localhost is not a valid --server parameter. Use the ip hostname of this machine.\n";
+ }
+ my $packed_ip = gethostbyname($server);
+ unless (defined $packed_ip) {
+   die "error: gethostbyname failed, $?\n";
+ }
+ my $ip_from_name = inet_ntoa($packed_ip);
+ print "debug: $server ip address is $ip_from_name\n" if $debug;
+ if ($ip_from_name=~/^127/) {
+   die "error: Loopback address $ip_from_name cannot not be used for server $server. Check your /etc/hosts file.\n";
+ }
+ 
+ my $name_from_ip  = gethostbyaddr($packed_ip, AF_INET);
+ print "debug: hostname of $ip_from_name is $name_from_ip\n" if $debug;
+ if ($name_from_ip ne $server) {
+   die "error: Name from ip $name_from_ip does not match ip from name $ip_from_name for --server $server. ".
+       " Use the correct --server parameter and verify forward and reverse name resolution is working.\n";
+ }
+ 
+ #-----------------------------------------------------------------------------
+ # Prereq: The vice partition must be available and empty.
+ #
+ unless ($partition=~/^(([a-z])|([a-h][a-z])|([i][a-v]))$/) {
+   die "error: Invalid partition id specified: $partition. Valid values are a..z and aa..iv\n";
+ }
+ unless ( -d "/vicep$partition" ) {
+   die "error: Missing fileserver partition, /vicep$partition\n";
+ }
+ if ( -d "/vicep$partition/AFSIDat" ) {
+   die "error: Fileserver partition is not empty. /vicep$partition/AFSIDat needs to be removed.\n";
+ }
+ open(LS, "ls /vicep$partition |") or 
+   die "error: ls /vicep$partition failed, $!\n";
+ while (<LS>) {
+   chomp;
+   if (/^V\d+.vol$/) {
+     die "error: Fileserver partition, /vicep$partition, is not empty.\n";
+   }
+ }
+ close LS;
+ 
+ # Prereq: authorization and platform specific objects.
  my $auth = OpenAFS::Auth::create(
        'debug'=>$debug,
        'type'=>$kerberos_type, 
        'cell'=>$cellname,
        'realm'=>$kerberos_realm,
        'keytab'=>$kerberos_keytab,
+       'admin'=>$admin,
        );
  
  my $os = OpenAFS::OS::create(
        'debug'=>$debug,
        );
  
! #-----------------------------------------------------------------------------
! # Prereq: Sanity check admin username and convert kerberos 5 notation to afs.
  #
  if ($admin =~ /@/) {
     die "error: Please specify the username without the realm name.\n";
***************
*** 420,439 ****
  my $username = $admin;
  $username=~s:/:.:g;   # convert kerberos separators to afs separators.
  
! # Shutdown the client and server, if running.
  run($os->command('client-stop'));
  run($os->command('fileserver-stop'));
  
  #
! # Attempt the client setup for this system before we try to create the cell.
! #
! $os->configure_client();
  
! #
! # Create the initial server configuration and the server administrator, temporarily running
! # with -noauth.
! #
  
  # bosserver attempts to create the following directories with these limited 
  # permissions. However, bosserver does not create parent directories as needed, so
  # the directories are not successfully created when they are more than one level
--- 510,560 ----
  my $username = $admin;
  $username=~s:/:.:g;   # convert kerberos separators to afs separators.
  
! #-----------------------------------------------------------------------------
! # Prereq: Save the paths and setup configuration in a form that is easily
! # read by the shell scripts.
! #
! open(CONF, "> dirpath.conf") or die "error: Cannot open file dirpath.conf for writing: $!\n";
! my ($n, $v);
! while(($n,$v)=each(%{$path})) {
!   print CONF "$n=$v\n";
! }
! close CONF;
! open(CONF, "> run-tests.conf") or die "error: Cannot open file run-tests.conf for writing: $!\n";
!   print CONF <<"__CONF__";
! CELLNAME=$cellname
! PARTITION=$partition
! ADMIN=$admin
! KERBEROS_TYPE=$kerberos_type
! KERBEROS_REALM=$kerberos_realm
! KERBEROS_KEYTAB=$kerberos_keytab
! __CONF__
! close CONF;
! 
! unless ($batch) {
!   my $answer = prompt("Last chance to cancel before setup begins. Continue? (yes/no)", "yes");
!   exit(0) unless $answer=~/^y/i;
! }
! 
! #-----------------------------------------------------------------------------
! # Prereq: Shutdown the client and server, if running.
! #
  run($os->command('client-stop'));
  run($os->command('fileserver-stop'));
  
+ #-----------------------------------------------------------------------------
+ # Prereq: Verify the server processes are not running.
  #
! foreach my $program ('bosserver', 'ptserver', 'vlserver', 'kaserver', 'fileserver') {
!   die "error: program is already running, $program\n" if $os->number_running($program);
! }
  
! #-----------------------------------------------------------------------------
! # Perform Platform-Specific Procedures
! $os->configure_client();
  
+ #-----------------------------------------------------------------------------
+ # WORKAROUND:
  # bosserver attempts to create the following directories with these limited 
  # permissions. However, bosserver does not create parent directories as needed, so
  # the directories are not successfully created when they are more than one level
***************
*** 451,608 ****
  run("chmod 0755 $path->{'afslogsdir'}"); 
  run("chmod 0777 $path->{'viceetcdir'}");
  
  print "debug: Starting bosserver...\n" if $debug;
  run("$path->{'afssrvsbindir'}/bosserver -noauth");
      unwind($os->command('remove', "$path->{'afsconfdir'}/ThisCell"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/CellServDB"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/UserList"));
      unwind($os->command('remove', "$path->{'afsbosconfigdir'}/BosConfig"));
      unwind($os->command('fileserver-stop'));
  
! run("$bos setcellname $server $cellname -localauth");
! run("$bos addhost $server $server -localauth");
! run("$bos adduser $server $username -localauth");
!     unwind("$bos removeuser $server $username -localauth");
! 
! #
! # Create the AFS KeyFile. (This must be done after bosserver creates the configuration files.)
  #
! unless ($skip_make_keyfile) {
!   print "debug: Making the keyfile...\n" if $debug;
!   $auth->make_keyfile();
! }
! unless ( -f "$path->{'afsconfdir'}/KeyFile") {
!   die "You do not have an AFS keyfile.  Please create this using asetkey or the bos addkey command.\n";
  }
  
! # make the krb.conf file if the realm name is different than the cell name.
! $auth->make_krb_config();
! 
! #
! # Start up the ptserver and vlserver.
  #
  print "debug: Starting the ptserver and vlserver...\n" if $debug;
! run("$bos create $server ptserver simple $path->{'afssrvlibexecdir'}/ptserver -localauth");
      unwind($os->command('remove', "$path->{'afsdbdir'}/prdb.DB0"));
      unwind($os->command('remove', "$path->{'afsdbdir'}/prdb.DBSYS1"));
!     unwind("$bos delete $server ptserver -localauth");
!     unwind("$bos stop $server ptserver -localauth");
  
! run("$path->{'afssrvbindir'}/bos create $server vlserver simple $path->{'afssrvlibexecdir'}/vlserver -localauth");
      unwind($os->command('remove', "$path->{'afsdbdir'}/vldb.DB0"));
      unwind($os->command('remove', "$path->{'afsdbdir'}/vldb.DBSYS1"));
!     unwind("$bos delete $server vlserver -localauth");
!     unwind("$bos stop $server vlserver -localauth");
  
  #
! # Start the file server.
  #
  print "debug: Starting the fileserver...\n" if $debug;
  if ($with_dafs) {
    run( "$bos create $server dafs dafs ".
!        "-cmd $path->{'afssrvlibexecdir'}/fileserver $options_fileserver ".
!        "-cmd $path->{'afssrvlibexecdir'}/volserver $options_volserver ".
!        "-cmd $path->{'afssrvlibexecdir'}/salvageserver $options_salvageserver".
!        "-cmd $path->{'afssrvlibexecdir'}/salvager $options_salvager".
!      "-localauth");
  }
  else {
    run( "$bos create $server fs fs ".
!        "-cmd $path->{'afssrvlibexecdir'}/fileserver $options_fileserver ".
!        "-cmd $path->{'afssrvlibexecdir'}/volserver $options_volserver ".
!        "-cmd $path->{'afssrvlibexecdir'}/salvager $options_salvager ".
!      "-localauth");
  }
-   unwind("$bos delete $server fs -localauth ");
-   unwind("$bos stop $server fs -localauth ");
  
! #
! # Create the AFS administrator (with the same name as the server administrator).
! #
! print "debug: Creating users...\n" if $debug;
! sleep(10); # wait to avoid "no quorum elected" errors.
! 
! run("$pts createuser -name $username -cell $cellname -noauth");
! run("$pts adduser $username system:administrators -cell $cellname -noauth");
! run("$pts membership $username -cell $cellname -noauth");
! 
! #
! # Create the root afs volume.
! #
  print "debug: Creating root.afs volume...\n" if $debug;
  run("$vos create $server $partition root.afs -cell $cellname -noauth");
      unwind($os->command('remove', "$partition/AFSIDat "));
      unwind($os->command('remove', "$partition/V*.vol"));
      unwind($os->command('remove', "$partition/Lock"));
!     unwind("$vos remove $server $partition root.afs -cell $cellname -noauth");
! 
! # The initial configuration is done, turn on authorization checking.
! #run("$bos setauth $server -authrequired on -cell $cellname -localauth");
! #    unwind("$bos setauth $server -authrequired off -cell $cellname -localauth");
! 
  
! #
! # Bring up the AFS client.
  #
  print "debug: Starting the OpenAFS client...\n" if $debug;
  run($os->command('client-start'));
      unwind($os->command('client-stop'));
  
- #
  # Run as the administrator.
! #
! $auth->authorize($admin);
  
  #
! # Create the root cell volumes, read-only and read-write.
! #
! print "debug: Creating the root volumes...\n" if $debug;
  run("$fs setacl /afs system:anyuser rl");
  
! run("$vos create $server $partition root.cell -localauth");
      unwind("$vos remove $server $partition root.cell -localauth");
  
  run("$fs mkmount /afs/$cellname root.cell -cell $cellname -fast");
      unwind("$fs rmmount /afs/$cellname");
  
  run("$fs setacl /afs/$cellname system:anyuser rl");
  run("$fs mkmount /afs/.$cellname root.cell -cell $cellname -rw");
      unwind("$fs rmmount /afs/.$cellname");
  
! #run("$fs mkmount /afs/.root.afs root.afs -rw");
! #    unwind("$fs rmmmount /afs/.root.afs");
  
- #
  # Create some volumes in our new cell.
- #
  print "debug: Creating the test volumes...\n" if $debug;
! mkvol("user", "/afs/$cellname/user", $server, $partition);
! mkvol("service", "/afs/$cellname/service", $server, $partition);
! mkvol("unrep", "/afs/$cellname/unreplicated", $server, $partition);
! 
! # make a read-only volume
! mkvol("rep", "/afs/$cellname/.replicated", $server, $partition);
! run("$fs mkmount /afs/$cellname/replicated rep.readonly");
! run("$vos addsite $server $partition rep -localauth");
! run("$vos release rep -localauth");
!     unwind("$vos remove $server $partition rep.readonly -localauth");
  
! 
! #
! # Create readonly volumes of our roots.
! #
! run("$vos addsite $server $partition root.afs -localauth");
! run("$vos addsite $server $partition root.cell -localauth");
! run("$vos release root.afs -localauth");
! run("$vos release root.cell -localauth");
!     unwind("$vos remove $server $partition root.cell.readonly -localauth");
!     unwind("$vos remove $server $partition root.afs.readonly -localauth");
  
  # done.
  @unwinds = (); # clear unwinds
  
  END {
!   if (!$dont_unwind && scalar @unwinds) {
      print "\ninfo: Error encountered, unwinding...\n"; 
      while (@unwinds) {
        eval { 
--- 572,790 ----
  run("chmod 0755 $path->{'afslogsdir'}"); 
  run("chmod 0777 $path->{'viceetcdir'}");
  
+ #-----------------------------------------------------------------------------
+ # Starting the BOS Server
+ #
+ # Start the bosserver and create the initial server configuration.
+ # Authorization is disabled by the -noauth flag.
+ #
  print "debug: Starting bosserver...\n" if $debug;
  run("$path->{'afssrvsbindir'}/bosserver -noauth");
+ if ($unwind) {
      unwind($os->command('remove', "$path->{'afsconfdir'}/ThisCell"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/CellServDB"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/UserList"));
      unwind($os->command('remove', "$path->{'afsbosconfigdir'}/BosConfig"));
      unwind($os->command('fileserver-stop'));
+ }
+ sleep(10); # allow bosserver some time to start accepting connections...
  
! #-----------------------------------------------------------------------------
! # Defining Cell Name and Membership for Server Processes
  #
! run("$bos setcellname $server $cellname -noauth");
! run("$bos addhost $server $server -noauth");
! run("$bos adduser $server $username -noauth");
! if ($unwind) {
!     unwind("$bos removeuser $server $username -noauth");
! }
! 
! # WORKAROUND:
! # The initial bosserver startup may create CellServDB entry which does
! # not match the host name retured by gethostbyaddr(). This entry will
! # cause ptserver/vlserver quorum errors and so is removed.
! open(HOSTS, "$bos listhosts $server |") or 
!   die "error: failed to run bos listhosts, $?\n";
! my @hosts = <HOSTS>;
! close HOSTS;
! foreach (@hosts) {
!   chomp;
!   if (/^\s+Host \d+ is (.*)/) {
!     my $host = $1;
!     print "debug: bos listhosts: host=[$host]\n" if $debug; 
!     if ($host ne $name_from_ip) {
!       print "debug: removing invalid host '$host' from CellServDB.\n" if $debug;
!       run("$bos removehost $server $host -noauth");
!     }
!   }
  }
  
! #-----------------------------------------------------------------------------
! # Starting the Database Server Processes
  #
  print "debug: Starting the ptserver and vlserver...\n" if $debug;
! run("$bos create $server ptserver simple -cmd \"$path->{'afssrvlibexecdir'}/ptserver $options_ptserver\" -noauth"); 
! if ($unwind) {
      unwind($os->command('remove', "$path->{'afsdbdir'}/prdb.DB0"));
      unwind($os->command('remove', "$path->{'afsdbdir'}/prdb.DBSYS1"));
!     unwind("$bos delete $server ptserver -noauth");
!     unwind("$bos stop $server ptserver -noauth");
! }
  
! run("$bos create $server vlserver simple -cmd \"$path->{'afssrvlibexecdir'}/vlserver $options_vlserver\" -noauth");
! if ($unwind) {
      unwind($os->command('remove', "$path->{'afsdbdir'}/vldb.DB0"));
      unwind($os->command('remove', "$path->{'afsdbdir'}/vldb.DBSYS1"));
!     unwind("$bos delete $server vlserver -noauth");
!     unwind("$bos stop $server vlserver -noauth");
! }
  
+ if ($kerberos_type =~ /kaserver/i) {
+   print "warning: kaserver is deprecated!\n";
+   run("$bos create $server kaserver simple -cmd \"$path->{'afssrvlibexecdir'}/kaserver $options_vlserver\" -noauth");
+   if ($unwind) {
+     unwind($os->command('remove', "$path->{'afsdbdir'}/kaserver.DB0"));
+     unwind($os->command('remove', "$path->{'afsdbdir'}/kaserver.DBSYS1"));
+     unwind("$bos delete $server kaserver -noauth");
+     unwind("$bos stop $server kaserver -noauth");
+   }
+ }
+ 
+ sleep(10); # to allow the database servers to start servicing requests.
+ 
+ #-----------------------------------------------------------------------------
+ # Initializing Cell Security
  #
! # Create the AFS administrative account and the AFS server encryption key.
! # Make the krb.conf file if the realm name is different than the cell name.
! 
! $auth->make_krb_config();
! $auth->make_keyfile();
! unless ( -f "$path->{'afsconfdir'}/KeyFile") {
!   die "Failed to create $path->{'afsconfdir'}/KeyFile. Please create this using asetkey or the bos addkey command.\n";
! }
! 
! print "debug: Creating admin user...\n" if $debug;
! run("$pts createuser -name $username -cell $cellname -noauth");
! run("$pts adduser $username system:administrators -cell $cellname -noauth");
! run("$pts membership $username -cell $cellname -noauth");
! 
! print "debug: Restarting the database servers to use the new encryption key.\n" if $debug;
! run("$bos restart $server -all -noauth");
! sleep(10); # to allow the database servers to start servicing requests.
! 
! #-----------------------------------------------------------------------------
! # Starting the File Server, Volume Server, and Salvager
  #
  print "debug: Starting the fileserver...\n" if $debug;
  if ($with_dafs) {
    run( "$bos create $server dafs dafs ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/fileserver $options_fileserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/volserver $options_volserver\"".
!        "-cmd \"$path->{'afssrvlibexecdir'}/salvageserver $options_salvageserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/salvager $options_salvager\" ".
!        "-noauth");
!   if ($unwind) {
!     unwind("$bos delete $server dafs -noauth");
!     unwind("$bos stop $server dafs -noauth");
!   }
  }
  else {
    run( "$bos create $server fs fs ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/fileserver $options_fileserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/volserver $options_volserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/salvager $options_salvager\" ".
!        "-noauth");
!   if ($unwind) {
!     unwind("$bos delete $server fs -noauth");
!     unwind("$bos stop $server fs -noauth");
!   }
  }
  
! # Create the root.afs volume.
  print "debug: Creating root.afs volume...\n" if $debug;
  run("$vos create $server $partition root.afs -cell $cellname -noauth");
+ if ($unwind) {
      unwind($os->command('remove', "$partition/AFSIDat "));
      unwind($os->command('remove', "$partition/V*.vol"));
      unwind($os->command('remove', "$partition/Lock"));
!     unwind("$vos remove $server $partition root.afs -cell $cellname -localauth");
! }
  
! #-----------------------------------------------------------------------------
! # Installing Client Functionality
  #
  print "debug: Starting the OpenAFS client...\n" if $debug;
  run($os->command('client-start'));
+ if ($unwind) {
      unwind($os->command('client-stop'));
+ }
  
  # Run as the administrator.
! $auth->authorize();
  
+ #-----------------------------------------------------------------------------
+ # Configuring the Top Levels of the AFS Filespace
  #
! print "debug: Creating the volumes...\n" if $debug;
  run("$fs setacl /afs system:anyuser rl");
  
! run("$vos create $server $partition root.cell");
! if ($unwind) {
      unwind("$vos remove $server $partition root.cell -localauth");
+ }
  
  run("$fs mkmount /afs/$cellname root.cell -cell $cellname -fast");
+ if ($unwind) {
      unwind("$fs rmmount /afs/$cellname");
+ }
  
  run("$fs setacl /afs/$cellname system:anyuser rl");
  run("$fs mkmount /afs/.$cellname root.cell -cell $cellname -rw");
+ if ($unwind) {
      unwind("$fs rmmount /afs/.$cellname");
+ }
  
! run("$fs examine /afs");
! run("$fs examine /afs/$cellname");
! 
! run("$vos addsite $server $partition root.afs");
! run("$vos addsite $server $partition root.cell");
! run("$vos release root.cell");
! run("$vos release root.afs");
! 
! run("$fs checkvolumes"); # so client notices the releases
! print "debug: the following should show root.afs.readonly\n" if $debug;
! run("$fs examine /afs");
! print "debug: the following should show root.cell.readonly\n" if $debug;
! run("$fs examine /afs/$cellname");
! print "debug: the following should show root.cell\n" if $debug;
! run("$fs examine /afs/.$cellname");
  
  # Create some volumes in our new cell.
  print "debug: Creating the test volumes...\n" if $debug;
! mkvol("user",    "/afs/.$cellname/user",         $server, $partition);
! mkvol("service", "/afs/.$cellname/service",      $server, $partition);
! mkvol("unrep",   "/afs/.$cellname/unreplicated", $server, $partition);
! mkvol("rep",     "/afs/.$cellname/replicated",   $server, $partition);
! 
! run("$vos addsite $server $partition rep");
! if ($unwind) {
!     unwind("$vos remsite $server $partition rep");
! }
! run("$vos release rep");
! run("$fs mkmount /afs/.$cellname/.replicated rep -rw");
! run("$fs setacl  /afs/.$cellname/.replicated system:anyuser rl");
  
! # Show the new volumes in the read-only path.
! run("$vos release root.cell"); 
  
  # done.
  @unwinds = (); # clear unwinds
+ print "info: DONE\n";
  
  END {
!   if ($unwind && scalar @unwinds) {
      print "\ninfo: Error encountered, unwinding...\n"; 
      while (@unwinds) {
        eval { 
Index: openafs/src/tests/afs-rmcell.pl
diff -c openafs/src/tests/afs-rmcell.pl:1.1.2.2 openafs/src/tests/afs-rmcell.pl:1.1.2.3
*** openafs/src/tests/afs-rmcell.pl:1.1.2.2	Thu Jan 24 18:50:37 2008
--- openafs/src/tests/afs-rmcell.pl	Mon Mar 31 11:54:02 2008
***************
*** 65,74 ****
  
  unless ($batch) {
    my $rl = new Term::ReadLine('afs-rmcell');
!   print "\n*** WARNING!! WARNING!! WARNING!! *** \n";
!   print "You are about to permanently DESTROY the OpenAFS configuration, database, and volumes on this machine!\n\n";
!   my $answer = $rl->readline("Do you really want to destroy the AFS cell data? (y/n) [n] ");
!   unless ($answer=~/^y/i ) {
      print "info: Aborted.\n";
      exit 0;
    }
--- 65,76 ----
  
  unless ($batch) {
    my $rl = new Term::ReadLine('afs-rmcell');
!   print "\n***  WARNING !!   WARNING !!   WARNING !!  *** \n\n";
!   print "You are about to permanently DESTROY the OpenAFS\n";
!   print "configuration, databases, and volumes on this machine!\n";
!   my $answer = $rl->readline("Do you really want to destroy the AFS cell? (destroy/no) [no] ");
!   unless ($answer eq "destroy" ) {
!     print "info: must answer 'destroy' to continue.\n" if $answer!~/^n/i;
      print "info: Aborted.\n";
      exit 0;
    }
***************
*** 87,92 ****
--- 89,96 ----
  $os->remove("$path->{'afsdbdir'}/prdb.DBSYS1");
  $os->remove("$path->{'afsdbdir'}/vldb.DB0");
  $os->remove("$path->{'afsdbdir'}/vldb.DBSYS1");
+ $os->remove("$path->{'afsdbdir'}/kaserver.DB0");
+ $os->remove("$path->{'afsdbdir'}/kaserver.DBSYS1");
  $os->remove("$path->{'afsbosconfigdir'}/BosConfig");
  $os->remove("$path->{'afslogsdir'}/*");
  $os->remove("$path->{'afslocaldir'}/*");
***************
*** 95,100 ****
--- 99,106 ----
  $os->remove("$path->{'afsconfdir'}/CellServDB");
  $os->remove("$path->{'afsconfdir'}/KeyFile");
  $os->remove("$path->{'afsconfdir'}/krb.conf");
+ $os->remove("$path->{'afsddir'}/ThisCell");
+ $os->remove("$path->{'afsddir'}/CellServDB");
  $os->remove("/vicep$partition_id/AFSIDat ");
  $os->remove("/vicep$partition_id/V*.vol");
  $os->remove("/vicep$partition_id/Lock");
Index: openafs/src/tests/run-tests.in
diff -c openafs/src/tests/run-tests.in:1.5.20.1 openafs/src/tests/run-tests.in:1.5.20.2
*** openafs/src/tests/run-tests.in:1.5.20.1	Mon Jan 21 14:42:13 2008
--- openafs/src/tests/run-tests.in	Mon Mar 31 11:54:02 2008
***************
*** 1,6 ****
  #!/bin/sh
  #
! # $Id: run-tests.in,v 1.5.20.1 2008/01/21 19:42:13 shadow Exp $
  #
  
  # Directory paths configured during the build.
--- 1,6 ----
  #!/bin/sh
  #
! # $Id: run-tests.in,v 1.5.20.2 2008/03/31 15:54:02 shadow Exp $
  #
  
  # Directory paths configured during the build.
***************
*** 8,17 ****
    . dirpath.conf
  else
    echo "error: Missing dirpath.conf file, try make dirpath.conf"
  fi
  
! if test -f run-test.conf; then
!   . run-test.conf
  fi  
  
  
--- 8,20 ----
    . dirpath.conf
  else
    echo "error: Missing dirpath.conf file, try make dirpath.conf"
+   exit 1
  fi
  
! if test -f run-tests.conf; then
!   . run-tests.conf
! else
!   echo "warning: Missing run-tests.conf, using default values."
  fi  
  
  
***************
*** 324,330 ****
    -help|--help) echo $usage; 
  	echo "tests available: $linebreak"; for a in "$ALL_TESTS"; do echo $a ; done;
  	exit 0;;
!   -version|--version) echo "$0 $Id: run-tests.in,v 1.5.20.1 2008/01/21 19:42:13 shadow Exp $"; exit 0;;
    -*) echo "$0: Bad option $1"; echo $usage; exit 1;;
    *) break;;
    esac
--- 327,333 ----
    -help|--help) echo $usage; 
  	echo "tests available: $linebreak"; for a in "$ALL_TESTS"; do echo $a ; done;
  	exit 0;;
!   -version|--version) echo "$0 $Id: run-tests.in,v 1.5.20.2 2008/03/31 15:54:02 shadow Exp $"; exit 0;;
    -*) echo "$0: Bad option $1"; echo $usage; exit 1;;
    *) break;;
    esac
***************
*** 372,377 ****
--- 375,386 ----
  export srcdir
  export objdir
  
+ # login
+ if [ "$KERBEROS_TYPE" != "kaserver" ] ; then
+   kinit -k -t $KERBEROS_KEYTAB $ADMIN || exit 1;
+   $afswsbindir/aklog -d -c $CELLNAME || exit 1;
+ fi
+ 
  echo "-------------------------------------------------"
  echo "$PACKAGE-$VERSION"
  echo "hosttype $host"
***************
*** 401,406 ****
--- 410,419 ----
    else
      b="${objdir}/$a"
    fi
+   if test "`echo $a | cut -c1`" = "#" ; then  # tests to skip
+     echo "Skipping $a"
+     continue
+   fi
    echo "Running $a"
    test "X$VERBOSE" != "X" && echo "Running test $a ($b)."
    if test "$a" = "setgroups" ; then
Index: openafs/src/tests/OpenAFS/Auth.pm
diff -c openafs/src/tests/OpenAFS/Auth.pm:1.1.2.2 openafs/src/tests/OpenAFS/Auth.pm:1.1.2.3
*** openafs/src/tests/OpenAFS/Auth.pm:1.1.2.2	Thu Jan 24 18:50:38 2008
--- openafs/src/tests/OpenAFS/Auth.pm	Mon Mar 31 11:54:05 2008
***************
*** 7,12 ****
--- 7,24 ----
  use OpenAFS::ConfigUtils;
  
  my $path = $OpenAFS::Dirpath::openafsdirpath;
+ my $classes = {
+   'mit'      => 'OpenAFS::Auth::MIT',
+   #'heimdal' => 'OpenAFS::Auth::Heimdal',
+   'kaserver' => 'OpenAFS::Auth::Kaserver',
+ };
+ 
+ my $bos       = "$path->{'afssrvbindir'}/bos";
+ my $aklog     = "$path->{'afswsbindir'}/aklog";
+ my $tokens    = "$path->{'afswsbindir'}/tokens";
+ my $asetkey   = "$path->{'afssrvbindir'}/asetkey";
+ my $kas       = "$path->{'afssrvsbindir'}/kas";
+ my $klog      = "$path->{'afswsbindir'}/klog";
  
  #
  # Create an auth type for the specified Kerberos implementation.
***************
*** 27,50 ****
  #  $auth->authorize('admin');
  #
  sub create {
    my $self = {
       # default values
       'type' => 'MIT',
-      'keytab' =>  "$path->{'afsconfdir'}/krb5.keytab",
       'cell' => '',
       'realm' => '', 
       'debug' => '0',
       # user specified values
       @_,
    };
  
-   # check for supported kerberos type.
-   my $type = $self->{'type'};
-   $self->{'type'} = _check_kerberos_type($type) or 
-     die "Unsupported kerberos type: $type\n";
- 
-   # create the sub-class for the kerberos type.
-   my $class = "OpenAFS::Auth::$self->{'type'}";
    $self = bless($self, $class);
  
    # attempt get default values.
--- 39,74 ----
  #  $auth->authorize('admin');
  #
  sub create {
+   my $parms = {@_};
+   my $type = 'mit';
+ 
+   if (defined $parms->{'type'}) {
+     $type = $parms->{'type'};
+   }
+   $type =~ tr/A-Z/a-z/;
+   my $class = $classes->{$type};
+   unless($class) {
+     die "Unsupported kerberos type: $type\n";
+   }
+   return $class->new(@_);
+ }
+ 
+ #
+ # Create an auth instance.
+ #
+ sub new {
+   my $class = shift;
    my $self = {
       # default values
       'type' => 'MIT',
       'cell' => '',
       'realm' => '', 
+      'admin' => 'admin',
       'debug' => '0',
       # user specified values
       @_,
    };
  
    $self = bless($self, $class);
  
    # attempt get default values.
***************
*** 76,94 ****
  }
  
  #
- # Check for supported kerberos type, and allow for case insensitivity.
- #
- sub _check_kerberos_type {
-   my $type = shift;
-   foreach my $supported ('MIT', 'Heimdal', 'Kaserver') {
-      if ($type =~ /^$supported$/i) {
-         return $supported;
-      }
-   }
-   return undef;
- }
- 
- #
  # Returns the cell name from the ThisCell configuration file.
  #
  sub _lookup_cell_name {
--- 100,105 ----
***************
*** 149,154 ****
--- 160,178 ----
    return $self->{'debug'};
  }
  
+ #
+ # check_program($prog) - verify the program is installed.
+ #
+ sub check_program {
+   my $self = shift;
+   my $program = shift;
+   unless ( -f $program ) {
+      die "error: Missing program: $program\n";
+   }
+   unless ( -x $program ) {
+      die "error: Not executable: $program\n";
+   }
+ }
  
  #------------------------------------------------------------------------------------
  # MIT Kerberos authorization commands.
***************
*** 159,178 ****
  use OpenAFS::ConfigUtils;
  our @ISA = ("OpenAFS::Auth");
  
  #
  # Sanity checks before we get started.
  #
  sub _sanity_check {
    my $self = shift;
!   unless (defined $path->{'afssrvbindir'}) {
!     die "error: \$path->{'afssrvbindir'} is not defined.\n";
!   }
!   unless (-f "$path->{'afssrvbindir'}/aklog") {
!     die "error: $path->{'afssrvbindir'}/aklog not found.\n";
!   }
!   unless (-x "$path->{'afssrvbindir'}/aklog") {
!     die "error: $path->{'afssrvbindir'}/aklog not executable.\n";
!   }
    unless ($self->{'realm'}) {
      die "error: Missing realm parameter Auth::create().\n";
    }
--- 183,199 ----
  use OpenAFS::ConfigUtils;
  our @ISA = ("OpenAFS::Auth");
  
+ 
  #
  # Sanity checks before we get started.
  #
  sub _sanity_check {
    my $self = shift;
! 
!   $self->check_program($aklog);
!   $self->check_program($tokens);
!   $self->check_program($asetkey);
! 
    unless ($self->{'realm'}) {
      die "error: Missing realm parameter Auth::create().\n";
    }
***************
*** 182,225 ****
    unless ( -f $self->{'keytab'} ) {
      die "error: Kerberos keytab file not found: $self->{'keytab'}\n";
    }
!   unless ( -f $self->{'keytab'} ) {
!     die "error: Keytab file not found: $self->{'keytab'}\n";
!   }
  }
  
  #
! # Create the KeyFile from the Kerberos keytab file. The keytab file
! # should be created using the Kerberos kadmin command (or with the kadmin.local command
! # as root on the KDC). See the OpenAFS asetkey man page for details.
! # 
! sub make_keyfile {
    my $self = shift;
  
-   # asetkey annoyance. The current asetkey implementation requires the ThisCell and CellServDB files
-   # to be present but they really are not needed to create the KeyFile. This check is done here
-   # rather than in the _sanity_checks() because the ThisCell/CellServerDB are created later in 
-   # the process of creating the new cell.
-   unless ( -f "$path->{'afsconfdir'}/ThisCell" ) {
-     die "error: OpenAFS configuration file is required, $path->{'afsconfdir'}/ThisCell\n";
-   }
-   unless ( -f "$path->{'afsconfdir'}/CellServDB" ) {
-     die "error: OpenAFS configuration file is required, $path->{'afsconfdir'}/CellServDB\n";
-   }
- 
-   unless ( -f "$path->{'afssrvbindir'}/asetkey" ) {
-     die "error: $path->{'afssrvbindir'}/asetkey is missing.\nWas OpenAFS built with Kerberos support?\n";
-   }
-   unless ( -x "$path->{'afssrvbindir'}/asetkey" ) {
-     die "error: Do not have execute permissions on $path->{'afssrvbindir'}/asetkey\n";
-   }
-   unless ( -d $path->{'afsconfdir'} ) {
-     die "error: OpenAFS configuration directory '$path->{'afsconfdir'}' is missing.\n";
-   }
-   unless ( -w $path->{'afsconfdir'} ) {
-     die "error: Write access to the OpenAFS configuration directory '$path->{'afsconfdir'}' is required.\n";
-   }
- 
- 
    # Run klist to get the kvno of the afs key. Search for afs/cellname@REALM
    # then afs@REALM. klist must be in the path.
    my %keys = ();
--- 203,222 ----
    unless ( -f $self->{'keytab'} ) {
      die "error: Kerberos keytab file not found: $self->{'keytab'}\n";
    }
! 
!   print "debug: Verifying the keytab and admin name, $self->{'admin'}.\n" if $self->debug;
!   run("kinit -k -t $self->{'keytab'} $self->{'admin'}");
! 
!   print "debug: Getting the afs principal and kvno from the keytab.\n" if $self->debug;
!   $self->_prepare_make_keyfile();
  }
  
  #
! # Read the keytab to find the kvno of the afs principal.
! #
! sub _prepare_make_keyfile {
    my $self = shift;
  
    # Run klist to get the kvno of the afs key. Search for afs/cellname@REALM
    # then afs@REALM. klist must be in the path.
    my %keys = ();
***************
*** 262,270 ****
      die "error: Could not find an afs key matching 'afs/$cell\@$realm' or ".
        "'afs/$cell' in keytab $self->{'keytab'}\n";
    }
  
!   # Run asetkey on the keytab to create the KeyFile. asetkey must be in the PATH.
!   run("$path->{'afssrvbindir'}/asetkey add $afs_kvno $self->{'keytab'} $afs_principal");
  }
  
  #
--- 259,295 ----
      die "error: Could not find an afs key matching 'afs/$cell\@$realm' or ".
        "'afs/$cell' in keytab $self->{'keytab'}\n";
    }
+   
+   $self->{'afs_principal'} = $afs_principal;
+   $self->{'afs_kvno'}      = $afs_kvno;
+ }
+ 
+ #
+ # Create the KeyFile from the Kerberos keytab file. The keytab file
+ # should be created using the Kerberos kadmin command (or with the kadmin.local command
+ # as root on the KDC). See the OpenAFS asetkey man page for details.
+ #
+ sub make_keyfile {
+   my $self = shift;
+   
+   # The current asetkey implementation requires the ThisCell and CellServDB files
+   # to be present but they really are not needed to create the KeyFile. A check is done here
+   # rather than in the _sanity_checks() because the ThisCell/CellServerDB are created later in 
+   # the process of creating the new cell.
+   unless ( -d $path->{'afsconfdir'} ) {
+     die "error: OpenAFS configuration directory '$path->{'afsconfdir'}' is missing.\n";
+   }
+   unless ( -w $path->{'afsconfdir'} ) {
+     die "error: Write access to the OpenAFS configuration directory '$path->{'afsconfdir'}' is required.\n";
+   }
+   unless ( -f "$path->{'afsconfdir'}/ThisCell" ) {
+     die "error: OpenAFS configuration file is required, $path->{'afsconfdir'}/ThisCell\n";
+   }
+   unless ( -f "$path->{'afsconfdir'}/CellServDB" ) {
+     die "error: OpenAFS configuration file is required, $path->{'afsconfdir'}/CellServDB\n";
+   }
  
!   run("$asetkey add $self->{'afs_kvno'} $self->{'keytab'} $self->{'afs_principal'}");
  }
  
  #
***************
*** 272,284 ****
  #
  sub authorize {
    my $self = shift;
!   my $principal = shift || 'admin';
    my $opt_aklog = "";
    $opt_aklog .= " -d" if $self->debug;
  
    run("kinit -k -t $self->{'keytab'} $principal");
!   run("$path->{'afssrvbindir'}/aklog $opt_aklog");
!   run("$path->{'afssrvbindir'}/tokens");
  }
  
  
--- 297,309 ----
  #
  sub authorize {
    my $self = shift;
!   my $principal = shift || $self->{'admin'};
    my $opt_aklog = "";
    $opt_aklog .= " -d" if $self->debug;
  
    run("kinit -k -t $self->{'keytab'} $principal");
!   run("$aklog $opt_aklog");
!   run("$tokens");
  }
  
  
***************
*** 305,310 ****
--- 330,340 ----
    }
  }
  
+ sub make_keyfile {
+   my $self = shift;
+   die "not implemented.";
+ }
+ 
  #
  # Get kerberos ticket and AFS token for the user.
  #
***************
*** 321,343 ****
  use OpenAFS::ConfigUtils;
  our @ISA = ("OpenAFS::Auth");
  
  #
  # Various checks during initialization.
  #
  sub _sanity_check {
    my $self = shift;
    unless ($self->{'realm'}) {
      die "Missing realm parameter Auth::create().\n";
    }
  }
  
  #
  # Get kerberos ticket and AFS token for the user.
  #
  sub authorize {
    my $self = shift;
    my $principal = shift || 'admin';
!   run("echo \"Proceeding w/o authentication\"|klog -pipe ${principal}\@$self->{'realm'}");
  }
  
  1;
--- 351,386 ----
  use OpenAFS::ConfigUtils;
  our @ISA = ("OpenAFS::Auth");
  
+ 
  #
  # Various checks during initialization.
  #
  sub _sanity_check {
    my $self = shift;
+   $self->check_program($kas);
+   $self->check_program($klog);
+   $self->check_program($tokens);
    unless ($self->{'realm'}) {
      die "Missing realm parameter Auth::create().\n";
    }
  }
  
+ sub make_keyfile {
+   my $self = shift;
+   run("$kas create afs -noauth");
+   run("$kas create admin -noauth");
+   run("$kas setfields admin -flags admin -noauth");
+   run("$bos addkey localhost -kvno 0 -noauth");
+ }
+ 
  #
  # Get kerberos ticket and AFS token for the user.
  #
  sub authorize {
    my $self = shift;
    my $principal = shift || 'admin';
!   #run("echo \"Proceeding w/o authentication\"|klog -pipe ${principal}\@$self->{'realm'}");
!   run("klog $principal\@$self->{'realm'}");
  }
  
  1;
Index: openafs/src/tests/OpenAFS/OS.pm
diff -c openafs/src/tests/OpenAFS/OS.pm:1.1.2.2 openafs/src/tests/OpenAFS/OS.pm:1.1.2.3
*** openafs/src/tests/OpenAFS/OS.pm:1.1.2.2	Thu Jan 24 18:50:38 2008
--- openafs/src/tests/OpenAFS/OS.pm	Mon Mar 31 11:54:05 2008
***************
*** 13,42 ****
  # and commands.
  #
  sub create {
    my $self = {
      'debug'=>0,
      'ostype'=>$path->{'ostype'},
      @_,
    };
  
-   my $class = _get_class($self->{'ostype'});
    $self = bless($self, $class);
    $self->{'commands'} = $self->get_commands();
- 
-   # Put the paths to the cache and afsd into the path
-   # table. Assume legacy paths if the the viceetcdir is set to
-   # the Transarc path.
-   if ($path->{'viceetcdir'} eq '/usr/vice/etc') {
-     # set in the makefile dest targets
-     $path->{'cachedir'} = "/usr/vice"     unless $path->{'cachedir'};  
-     $path->{'afsddir'}  = "/usr/vice/etc" unless $path->{'afsddir'};
-   }
-   else {
-     # set in the makefile install targets
-     $path->{'cachedir'} = "$path->{'localstatedir'}/openafs" unless $path->{'cachedir'};
-     $path->{'afsddir'}  = "$path->{'afssrvsbindir'}"         unless $path->{'afsddir'};
-   }  
- 
    return $self;
  }
  
--- 13,36 ----
  # and commands.
  #
  sub create {
+   my $class = _get_class($path->{'ostype'});
+   $class->new(@_);
+ }
+ 
+ #
+ # Create the OS object.
+ #
+ sub new {
+   my $class = shift;
    my $self = {
      'debug'=>0,
      'ostype'=>$path->{'ostype'},
      @_,
    };
  
    $self = bless($self, $class);
+   $self->{'syscnf'} = "$path->{'initdir'}/test-afs-rc.conf";
    $self->{'commands'} = $self->get_commands();
    return $self;
  }
  
***************
*** 156,161 ****
--- 150,165 ----
    return @pids;
  }
  
+ #
+ # Returns the number of pids found for a program name.
+ #
+ sub number_running {
+   my $self = shift;
+   my $program = shift;
+   my @pids = $self->find_pids($program);
+   return scalar @pids;
+ }
+ 
  #--------------------------------------------------------------
  package OpenAFS::OS::Linux;
  use warnings;
***************
*** 169,180 ****
  #
  sub get_commands {
    my $self = shift;
-   my $syscnf = "$path->{'initdir'}/testclient.conf";
  
    my $commands = {
!     'client-start'         => "SYSCNF=$syscnf $path->{'initdir'}/afs.rc start",
!     'client-stop'          => "SYSCNF=$syscnf $path->{'initdir'}/afs.rc stop",
!     'client-restart'       => "SYSCNF=$syscnf $path->{'initdir'}/afs.rc restart",
      'client-forcestop'     => sub { $self->client_forcestop() },
      'fileserver-start'     => sub { $self->fileserver_start() },
      'fileserver-stop'      => sub { $self->fileserver_stop() },
--- 173,183 ----
  #
  sub get_commands {
    my $self = shift;
  
    my $commands = {
!     'client-start'         => "SYSCNF=$self->{'syscnf'} $path->{'initdir'}/afs.rc start",
!     'client-stop'          => "SYSCNF=$self->{'syscnf'} $path->{'initdir'}/afs.rc stop",
!     'client-restart'       => "SYSCNF=$self->{'syscnf'} $path->{'initdir'}/afs.rc restart",
      'client-forcestop'     => sub { $self->client_forcestop() },
      'fileserver-start'     => sub { $self->fileserver_start() },
      'fileserver-stop'      => sub { $self->fileserver_stop() },
***************
*** 201,212 ****
    };
    
    my $debug = $self->{'debug'};
-   my $syscnf = "$path->{'initdir'}/testclient.conf";
  
!   open (SYSCNF, "> $syscnf") or
!     die "error: Cannot open afs.rc configuration file $syscnf, $!\n";
  
!   print "debug: creating afs.rc configuration file $syscnf\n" if $debug; 
    print SYSCNF <<"_SYSCNF_";
  AFS_CLIENT=on
  AFS_SERVER=off
--- 204,214 ----
    };
    
    my $debug = $self->{'debug'};
  
!   open (SYSCNF, "> $self->{'syscnf'}") or
!     die "error: Cannot open afs.rc configuration file $self->{'syscnf'}, $!\n";
  
!   print "debug: creating afs.rc configuration file $self->{'syscnf'}\n" if $debug; 
    print SYSCNF <<"_SYSCNF_";
  AFS_CLIENT=on
  AFS_SERVER=off
***************
*** 216,222 ****
  OPTIONS="-confdir $path->{'viceetcdir'}"
  WAIT_FOR_SALVAGE=no
  AFSDIR=/afs
! CACHEDIR=$path->{'cachedir'}/cache
  CACHEINFO=$path->{'viceetcdir'}/cacheinfo
  VERBOSE=
  AFS_POST_INIT=
--- 218,224 ----
  OPTIONS="-confdir $path->{'viceetcdir'}"
  WAIT_FOR_SALVAGE=no
  AFSDIR=/afs
! CACHEDIR=$path->{'cachedir'}
  CACHEINFO=$path->{'viceetcdir'}/cacheinfo
  VERBOSE=
  AFS_POST_INIT=
***************
*** 228,234 ****
  _SYSCNF_
    close SYSCNF;
    if ($debug) {
!     if (open(SYSCNF, "< $syscnf")) {
        while (<SYSCNF>) {
          chomp; print "debug:  $_\n";
        }
--- 230,236 ----
  _SYSCNF_
    close SYSCNF;
    if ($debug) {
!     if (open(SYSCNF, "< $self->{'syscnf'}")) {
        while (<SYSCNF>) {
          chomp; print "debug:  $_\n";
        }
***************
*** 237,246 ****
    }
  
    # Create a cache directory if none.
!   unless ( -d "$path->{'cachedir'}/cache" ) {
!     print "debug: making cache directory: $path->{'cachedir'}/cache\n" if $debug;
!     system("mkdir -p $path->{'cachedir'}/cache");
!     system("chmod 0700 $path->{'cachedir'}/cache"); 
    }
  
    # Create the local /afs directory on which the afs filespace will be mounted. 
--- 239,248 ----
    }
  
    # Create a cache directory if none.
!   unless ( -d "$path->{'cachedir'}" ) {
!     print "debug: making cache directory: $path->{'cachedir'}\n" if $debug;
!     system("mkdir -p $path->{'cachedir'}");
!     system("chmod 0700 $path->{'cachedir'}"); 
    }
  
    # Create the local /afs directory on which the afs filespace will be mounted. 
Index: openafs/src/tests/OpenAFS/config.pm
diff -c openafs/src/tests/OpenAFS/config.pm:1.1.22.1 openafs/src/tests/OpenAFS/config.pm:1.1.22.2
*** openafs/src/tests/OpenAFS/config.pm:1.1.22.1	Mon Jan 21 14:42:15 2008
--- openafs/src/tests/OpenAFS/config.pm	Mon Mar 31 11:54:05 2008
***************
*** 94,105 ****
  
  =cut
  
! @CmdPath = (split(/:/, $ENV{PATH}),
              $OpenAFS::Dirpath::openafsdirpath->{'afssrvbindir'},        # For servers
! 	    '/usr/local/bin',      # Many sites put AFS in /usr/local
! 	    '/usr/local/etc',
! 	    '/usr/afsws/bin',      # For people who use Transarc's
! 	    '/usr/afsws/etc');     # silly reccommendations
  
  =item $err_table_dir - Error table directory
  
--- 94,103 ----
  
  =cut
  
! @CmdPath = (
              $OpenAFS::Dirpath::openafsdirpath->{'afssrvbindir'},        # For servers
!             $OpenAFS::Dirpath::openafsdirpath->{'afswsbindir'},
!         );
  
  =item $err_table_dir - Error table directory
  
Index: openafs/src/tptserver/Makefile.in
diff -c /dev/null openafs/src/tptserver/Makefile.in:1.1.2.9
*** /dev/null	Mon Apr 21 17:11:57 2008
--- openafs/src/tptserver/Makefile.in	Fri Apr  4 11:40:04 2008
***************
*** 0 ****
--- 1,279 ----
+ # 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
+ 
+ srcdir=@srcdir@
+ include @TOP_OBJDIR@/src/config/Makefile.config
+ 
+ 
+ CCRULE=${MT_CC} ${CFLAGS} ${MT_CFLAGS} -c $?
+ 
+ RX=../rx
+ UTIL=../util
+ PTSERVER=../ptserver
+ 
+ RXOBJS= rx_pthread.o rxkad_errs.o
+ 
+ UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o \
+      volparse.o flipbase64.o softsig.o hostparse.o snprintf.o pthread_glock.o
+ 
+ INCLS=${TOP_INCDIR}/ubik.h \
+ 	${TOP_INCDIR}/lock.h  \
+ 	${TOP_INCDIR}/lwp.h \
+ 	${TOP_INCDIR}/rx/rx.h \
+ 	${TOP_INCDIR}/rx/xdr.h \
+ 	${TOP_INCDIR}/afs/keys.h \
+ 	${TOP_INCDIR}/afs/cellconfig.h \
+ 	${PTSERVER}/ptserver.h \
+ 	${PTSERVER}/ptclient.h \
+ 	${PTSERVER}/ptuser.h \
+ 	ptint.h \
+ 	pterror.h \
+ 	${PTSERVER}/map.h \
+ 	${PTSERVER}/ptprototypes.h
+ 
+ LINCLS=${TOP_INCDIR}/ubik.h \
+ 	${TOP_INCDIR}/lock.h \
+ 	${TOP_INCDIR}/rx/rx.h \
+ 	${TOP_INCDIR}/rx/xdr.h  \
+ 	${TOP_INCDIR}/rx/rxkad.h \
+ 	${TOP_INCDIR}/afs/auth.h \
+ 	${TOP_INCDIR}/afs/cellconfig.h \
+ 	${PTSERVER}/ptclient.h \
+ 	${PTSERVER}/ptuser.h \
+ 	ptint.h \
+ 	pterror.h
+ 
+ LIBS=${RXOBJS} ${UTILOBJS}\
+ 	${TOP_LIBDIR}/libubik_pthread.a \
+ 	${TOP_LIBDIR}/libafsauthent.a \
+ 	${TOP_LIBDIR}/libafsrpc.a \
+ 	${TOP_LIBDIR}/libcmd.a \
+ 	${TOP_LIBDIR}/libafsutil.a 
+ 
+ PTOBJS=ptuser.o pterror.o ptint.cs.o ptint.xdr.o
+ 
+ all: ptserver pts pt_util db_verify \
+ 	depinstall readgroup readpwd testpt
+ 
+ depinstall: 
+ 
+ #
+ # Build targets
+ #
+ 
+ rx_pthread.o: ${RX}/rx_pthread.c
+ 	${CCRULE}
+ 
+ rxkad_errs.o: ../rxkad/rxkad_errs.c
+ 	${CCRULE}
+ 
+ #
+ # get the pthreaded util stuff compiled here.  we do this instead of
+ # using the non-pthreaded libutil.a.  There probably should be a
+ # pthreaded version of this library, as we are doing with ubik itself, but...
+ #
+ 
+ assert.o: ${UTIL}/assert.c
+ 	${CCRULE}
+ 
+ uuid.o: ${UTIL}/uuid.c
+ 	${CCRULE}
+ 
+ serverLog.o: ${UTIL}/serverLog.c
+ 	${CCRULE}
+ 
+ fileutil.o: ${UTIL}/fileutil.c
+ 	${CCRULE}
+ 
+ volparse.o: ${UTIL}/volparse.c
+ 	${CCRULE}
+ 
+ flipbase64.o: ${UTIL}/flipbase64.c
+ 	${CCRULE}
+ 
+ netutils.o: ${UTIL}/netutils.c
+ 	${CCRULE}
+ 
+ dirpath.o: ${UTIL}/dirpath.c
+ 	${CCRULE}
+ 
+ softsig.o: ${UTIL}/softsig.c
+ 	${CCRULE}
+ 
+ hostparse.o: ${UTIL}/hostparse.c
+ 	${CCRULE}
+ 
+ snprintf.o: ${UTIL}/snprintf.c
+ 	${CCRULE}
+ 
+ pthread_glock.o: ${UTIL}/pthread_glock.c
+ 	${CCRULE}
+ 
+ 
+ ptserver.o: ${PTSERVER}/ptserver.c
+ 	${CCRULE}
+ 
+ ptutils.o: ${PTSERVER}/ptutils.c
+ 	${CCRULE}
+ 
+ ptprocs.o: ${PTSERVER}/ptprocs.c
+ 	${CCRULE}
+ 
+ utils.o: ${PTSERVER}/utils.c
+ 	${CCRULE}
+ 
+ map.o: ${PTSERVER}/map.c
+ 	${CCRULE}
+ 
+ ptint.ss.o: ptint.ss.c
+ 	${CCRULE}
+ 
+ ptint.cs.o: ptint.cs.c
+ 	${CCRULE}
+ 
+ ptint.xdr.o: ptint.xdr.c
+ 	${CCRULE}
+ 
+ ptint.cs.c: ${PTSERVER}/ptint.xg
+ 	${RXGEN} -x -C -u -o $@ ${PTSERVER}/ptint.xg
+ 
+ ptint.ss.c: ${PTSERVER}/ptint.xg
+ 	${RXGEN} -x -S -o $@ ${PTSERVER}/ptint.xg
+ 
+ ptint.xdr.c: ${PTSERVER}/ptint.xg
+ 	${RXGEN} -x -c -o $@ ${PTSERVER}/ptint.xg
+ 
+ ptint.h: ${PTSERVER}/ptint.xg
+ 	${RXGEN} -x -h -u -o $@ ${PTSERVER}/ptint.xg
+ 
+ ptint.cs.c: ptint.h
+ ptint.ss.c: ptint.h
+ ptint.xdr.c: ptint.h
+ 
+ Kptint.cs.c: ${PTSERVER}/ptint.xg Kptint.h
+ 	${RXGEN} -x -k -C -o Kptint.cs.c ${PTSERVER}/ptint.xg
+  
+ Kptint.xdr.c: ${PTSERVER}/ptint.xg
+ 	${RXGEN} -x -k -c -o Kptint.xdr.c ${PTSERVER}/ptint.xg
+  
+ Kptint.h: ${PTSERVER}/ptint.xg
+ 	${RXGEN} -x -k -h -o Kptint.h ${PTSERVER}/ptint.xg
+ 
+ display.o: ${PTSERVER}/display.c
+ 	${CCRULE}
+ 
+ ptserver: ptserver.o ptutils.o ptprocs.o ptint.ss.o ptint.xdr.o utils.o $(LIBS) ${TOP_LIBDIR}/libaudit.a map.o
+ 	${CC} ${LDFLAGS} -o ptserver ptserver.o ptutils.o ptprocs.o ptint.ss.o ptint.xdr.o utils.o map.o $(LIBS) ${MT_LIBS} ${XLIBS} ${TOP_LIBDIR}/libaudit.a
+ 
+ db_verify.o: ${PTSERVER}/db_verify.c
+ 	${CCRULE}
+ 
+ db_verify: db_verify.o pterror.o display.o $(LIBS)
+ 	$(CC) ${LDFLAGS} -o db_verify db_verify.o display.o pterror.o $(LIBS) ${MT_LIBS} ${XLIBS}
+ 
+ ptclient: ptclient.o display.o ptuser.o pterror.o ptint.cs.o ptint.xdr.o AFS_component_version_number.o $(LIBS)
+ 	$(CC) ${LDFLAGS} -o ptclient ptclient.o display.o $(PTOBJS) $(LIBS) ${MT_LIBS} ${XLIBS}
+ 
+ ptclient.o: ${PTSERVER}/ptclient.c
+ 	${CCRULE}
+ 
+ ptuser.o: ${PTSERVER}/ptuser.c
+ 	${CCRULE}
+ 
+ pterror.h pterror.c: ${PTSERVER}/pterror.et
+ 	$(RM) -f pterror.h pterror.c
+ 	${COMPILE_ET} -p ${PTSERVER} pterror
+ 
+ pts: pts.o $(PTOBJS) ${TOP_LIBDIR}/libcmd.a $(LIBS)
+ 	$(CC) ${LDFLAGS} -o pts pts.o ${TOP_LIBDIR}/libcmd.a $(PTOBJS) ${LIBS} ${MT_LIBS} ${XLIBS}
+ 
+ pts.o: ${PTSERVER}/pts.c
+ 	${CCRULE}
+ 
+ readgroup: readgroup.o $(PTOBJS) $(LIBS)
+ 	$(CC) ${CFLAGS} -o readgroup readgroup.o $(PTOBJS) ${LIBS} ${MT_LIBS} ${XLIBS}
+ 
+ readgroup.o: ${PTSERVER}/readgroup.c
+ 	${CCRULE}
+ 
+ readpwd: readpwd.o $(PTOBJS) $(LIBS)
+ 	$(CC) ${CFLAGS} -o readpwd readpwd.o $(PTOBJS) ${LIBS} ${MT_LIBS} ${XLIBS}
+ 
+ readpwd.o: ${PTSERVER}/readpwd.c
+ 	${CCRULE}
+ 
+ testpt: testpt.o $(PTOBJS) ${TOP_LIBDIR}/libcmd.a $(LIBS)
+ 	$(CC) ${CFLAGS} -o testpt testpt.o -lm ${TOP_LIBDIR}/libcmd.a $(PTOBJS) $(LIBS) ${MT_LIBS} ${XLIBS}
+ 
+ testpt.o: ${PTSERVER}/testpt.c
+ 	${CCRULE}
+ 
+ pt_util: pt_util.o ptutils.o ubik.o utils.o map.o $(PTOBJS) $(LIBS)
+ 	$(CC) ${CFLAGS} -o pt_util pt_util.o ptutils.o ubik.o utils.o map.o $(PTOBJS) ${TOP_LIBDIR}/libcmd.a $(LIBS) ${MT_LIBS} ${XLIBS}
+ 
+ pt_util.o: ${PTSERVER}/pt_util.c
+ 	${CCRULE}
+ 
+ ubik.o: ${PTSERVER}/ubik.c
+ 	${CCRULE}
+ 
+ prerror.h: pterror.h
+ 	${INSTALL} $? $@
+ 	echo '#define ERROR_TABLE_BASE_pr ERROR_TABLE_BASE_PT' >> $@
+ 
+ #
+ # Installation targets
+ #
+ install: \
+ 	${DESTDIR}${afssrvlibexecdir}/ptserver \
+ 	${DESTDIR}${afssrvbindir}/pts \
+ 	${DESTDIR}${bindir}/pts \
+ 	${DESTDIR}${afssrvsbindir}/pt_util \
+ 	${DESTDIR}${afssrvsbindir}/prdb_check 
+ 
+ ${DEST}/root.server/usr/afs/bin/ptserver: ptserver
+ 	${INSTALL} $? $@
+ 
+ ${DEST}/bin/pts ${DEST}/root.server/usr/afs/bin/pts: pts
+ 	${INSTALL} $? $@
+ 
+ ${DEST}/root.server/usr/afs/bin/pt_util: pt_util
+ 	${INSTALL} $? $@
+ 
+ ${DEST}/etc/prdb_check: db_verify
+ 	${INSTALL} -f $? $@
+ 
+ #
+ # Misc. targets
+ #
+ clean:
+ 	$(RM) -f *.a *.o ptserver ptint.cs.c ptint.ss.c ptclient ptint.xdr.c ptint.h \
+ 	pts readgroup readpwd db_verify testpt pt_util pterror.h pterror.c \
+ 	core AFS_component_version_number.c Kptint.cs.c Kptint.h Kptint.xdr.c
+ 
+ include ../config/Makefile.version
+ ${DESTDIR}${afssrvlibexecdir}/ptserver: ptserver
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afssrvbindir}/pts: pts
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${bindir}/pts: pts
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afssrvsbindir}/pt_util: pt_util
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afssrvsbindir}/prdb_check: db_verify
+ 	${INSTALL} -f $? $@
+ 
+ dest: \
+ 	${DEST}/root.server/usr/afs/bin/ptserver \
+ 	${DEST}/root.server/usr/afs/bin/pts \
+ 	${DEST}/bin/pts \
+ 	${DEST}/root.server/usr/afs/bin/pt_util \
+ 	${DEST}/etc/prdb_check
\ No newline at end of file
Index: openafs/src/tsalvaged/Makefile.in
diff -c openafs/src/tsalvaged/Makefile.in:1.1.4.1 openafs/src/tsalvaged/Makefile.in:1.1.4.2
*** openafs/src/tsalvaged/Makefile.in:1.1.4.1	Mon Nov 12 13:28:36 2007
--- openafs/src/tsalvaged/Makefile.in	Tue Apr  1 16:17:27 2008
***************
*** 184,190 ****
  install: ${INSTALL_TARGS}
  
  clean:
! 	$(RM) -f *.o salvageserver core AFS_component_version_number.c
  
  include ../config/Makefile.version
  
--- 184,190 ----
  install: ${INSTALL_TARGS}
  
  clean:
! 	$(RM) -f *.o salvageserver core AFS_component_version_number.c fssync-debug salvsync-debug
  
  include ../config/Makefile.version
  
Index: openafs/src/tubik/Makefile.in
diff -c /dev/null openafs/src/tubik/Makefile.in:1.1.2.5
*** /dev/null	Mon Apr 21 17:11:57 2008
--- openafs/src/tubik/Makefile.in	Fri Apr  4 10:52:03 2008
***************
*** 0 ****
--- 1,288 ----
+ # 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
+ 
+ srcdir=@srcdir@/../ubik
+ include @TOP_OBJDIR@/src/config/Makefile.config
+ 
+ CCRULE=${MT_CC} ${CFLAGS} ${MT_CFLAGS} -c $?
+ 
+ RX=../rx
+ UTIL=../util
+ 
+ LIBOBJS=disk.o  remote.o beacon.o recovery.o ubik.o  vote.o lock.o phys.o \
+ 	ubik_int.cs.o ubik_int.ss.o ubik_int.xdr.o ubikcmd.o \
+ 	ubikclient.o uerrors.o uinit.o
+ 
+ INCLS=${TOP_INCDIR}/lwp.h ${TOP_INCDIR}/lock.h \
+ 	${TOP_INCDIR}/rx/rx.h ${TOP_INCDIR}/rx/xdr.h \
+ 	${TOP_INCDIR}/lock.h ubik.h ubik_int.h utst_int.h
+ 
+ RXOBJS = rx_pthread.o
+ 
+ UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o \
+      volparse.o flipbase64.o softsig.o hostparse.o snprintf.o pthread_glock.o
+ 
+ LIBS=${RXOBJS} ${UTILOBJS} ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/liblwp.a \
+      ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/libcmd.a \
+      ${TOP_LIBDIR}/libsys.a ${XLIBS} \
+      ${LDFLAGS} ${MT_LIBS}
+ 
+ all: depinstall ${TOP_LIBDIR}/libubik_pthread.a udebug utst_server utst_client
+ 
+ depinstall: \
+ 	ubik_int.cs.c ubik_int.xdr.c \
+ 	${TOP_INCDIR}/ubik.h \
+ 	${TOP_INCDIR}/ubik_int.h
+ 
+ #
+ # get the pthreaded rx stuff compiled here
+ #
+ 
+ rx_pthread.o: ${RX}/rx_pthread.c
+ 	${CCRULE} -DDPF_FSLOG
+ 
+ #
+ # get the pthreaded util stuff compiled here.  we do this instead of
+ # using the non-pthreaded libutil.a.  There probably should be a
+ # pthreaded version of this library, as we are doing with ubik itself, but...
+ #
+ 
+ assert.o: ${UTIL}/assert.c
+ 	${CCRULE}
+ 
+ uuid.o: ${UTIL}/uuid.c
+ 	${CCRULE}
+ 
+ serverLog.o: ${UTIL}/serverLog.c
+ 	${CCRULE}
+ 
+ fileutil.o: ${UTIL}/fileutil.c
+ 	${CCRULE}
+ 
+ volparse.o: ${UTIL}/volparse.c
+ 	${CCRULE}
+ 
+ flipbase64.o: ${UTIL}/flipbase64.c
+ 	${CCRULE}
+ 
+ netutils.o: ${UTIL}/netutils.c
+ 	${CCRULE}
+ 
+ dirpath.o: ${UTIL}/dirpath.c
+ 	${CCRULE}
+ 
+ softsig.o: ${UTIL}/softsig.c
+ 	${CCRULE}
+ 
+ hostparse.o: ${UTIL}/hostparse.c
+ 	${CCRULE}
+ 
+ snprintf.o: ${UTIL}/snprintf.c
+ 	${CCRULE}
+ 
+ pthread_glock.o: ${UTIL}/pthread_glock.c
+ 	${CCRULE}
+ 
+ 
+ #
+ # insert comments here
+ #
+ 
+ utst_server: utst_server.o utst_int.ss.o utst_int.xdr.o libubik_pthread.a ${RXOBJS} ${UTILOBJS}
+ 	${CC} ${CFLAGS} -o utst_server utst_server.o utst_int.ss.o utst_int.xdr.o libubik_pthread.a $(LIBS)
+ 
+ utst_client: utst_client.o utst_int.cs.o utst_int.xdr.o libubik_pthread.a ${RXOBJS} ${UTILOBJS}
+ 	${CC} ${CFLAGS} -o utst_client utst_client.o utst_int.cs.o utst_int.xdr.o libubik_pthread.a $(LIBS)
+ 
+ udebug: udebug.o libubik_pthread.a ${RXOBJS} ${UTILOBJS}
+ 	${CC} ${CFLAGS} -o udebug udebug.o libubik_pthread.a $(LIBS)
+ 
+ ubik_int.cs.c: ${srcdir}/ubik_int.xg
+ 	${RXGEN} -x -C -o $@ ${srcdir}/ubik_int.xg
+ 
+ ubik_int.ss.c: ${srcdir}/ubik_int.xg
+ 	${RXGEN} -x -S -o $@ ${srcdir}/ubik_int.xg
+ 
+ ubik_int.xdr.c: ${srcdir}/ubik_int.xg
+ 	${RXGEN} -x -c -o $@ ${srcdir}/ubik_int.xg
+ 
+ ubik_int.h: ${srcdir}/ubik_int.xg
+ 	${RXGEN} -x -h -o $@ ${srcdir}/ubik_int.xg
+ 
+ ubik_int.cs.c: ubik_int.h
+ ubik_int.ss.c: ubik_int.h
+ ubik_int.xdr.c: ubik_int.h
+ 
+ Kubik_int.cs.c: ${srcdir}/ubik_int.xg Kubik_int.h
+ 	${RXGEN} -x -k -C -o Kubik_int.cs.c ${srcdir}/ubik_int.xg
+  
+ Kubik_int.xdr.c: ${srcdir}/ubik_int.xg
+ 	${RXGEN} -x -k -c -o Kubik_int.xdr.c ${srcdir}/ubik_int.xg
+  
+ Kubik_int.h: ${srcdir}/ubik_int.xg
+ 	${RXGEN} -x -k -h -o Kubik_int.h ${srcdir}/ubik_int.xg
+ 
+ #utst_int.ss.o: utst_int.ss.c utst_int.xdr.c
+ #	${CCRULE}
+ 
+ #utst_int.cs.o: utst_int.cs.c utst_int.xdr.c
+ #	${CCRULE}
+ 
+ #utst_int.xdr.o: utst_int.xdr.c utst_int.h
+ #	${CCRULE}
+ 
+ utst_int.cs.c: ${srcdir}/utst_int.xg
+ 	${RXGEN} -C -o $@ ${srcdir}/utst_int.xg
+ 
+ utst_int.ss.c: ${srcdir}/utst_int.xg
+ 	${RXGEN} -S -o $@ ${srcdir}/utst_int.xg
+ 
+ utst_int.xdr.c: ${srcdir}/utst_int.xg
+ 	${RXGEN} -c -o $@ ${srcdir}/utst_int.xg
+ 
+ utst_int.h: ${srcdir}/utst_int.xg
+ 	${RXGEN} -h -o $@ ${srcdir}/utst_int.xg
+ 
+ utst_int.cs.c: utst_int.h
+ utst_int.ss.c: utst_int.h
+ utst_int.xdr.c: utst_int.h
+ 
+ utst_server.o: ${srcdir}/utst_server.c
+ 	${CCRULE}
+ 
+ utst_client.o: ${srcdir}/utst_client.c
+ 	${CCRULE}
+ 
+ udebug.o: ${srcdir}/udebug.c
+ 	${CCRULE}
+ 
+ #	${CC} ${CFLAGS} -I. -I${TOP_INCDIR} -I${TOP_INCDIR}/afs -c ${srcdir}/udebug.c
+ 
+ uerrors.o: uerrors.c
+ 	${CCRULE}
+ 
+ uerrors.c ubik.h: ${srcdir}/uerrors.et ${srcdir}/ubik.p.h
+ 	$(RM) -f ubik.h uerrors.c
+ 	${COMPILE_ET} -p ${srcdir} uerrors -h ubik
+ 
+ libubik_pthread.a: ${INCLS} ${LIBOBJS} AFS_component_version_number.o
+ 	-$(RM) -f $@
+ 	$(AR) crc $@ ${LIBOBJS} AFS_component_version_number.o
+ 	$(RANLIB) $@
+ 
+ disk.o: ${srcdir}/disk.c
+ 	${CCRULE}
+ 
+ uinit.o: ${srcdir}/uinit.c
+ 	${CCRULE}
+ 
+ remote.o: ${srcdir}/remote.c
+ 	${CCRULE}
+ 
+ beacon.o: ${srcdir}/beacon.c
+ 	${CCRULE}
+ 
+ lock.o: ${srcdir}/lock.c
+ 	${CCRULE}
+ 
+ recovery.o: ${srcdir}/recovery.c
+ 	${CCRULE}
+ 
+ ubik.o: ${srcdir}/ubik.c
+ 	${CCRULE}
+ 
+ phys.o: ${srcdir}/phys.c
+ 	${CCRULE}
+ 
+ vote.o: ${srcdir}/vote.c
+ 	${CCRULE}
+ 
+ ubikcmd.o: ${srcdir}/ubikcmd.c
+ 	${CCRULE}
+ 
+ ubikclient.o: ${srcdir}/ubikclient.c
+ 	${CCRULE}
+ 
+ ubik_int.ss.o: ubik_int.ss.c
+ 	${CCRULE}
+ 
+ ubik_int.cs.o: ubik_int.cs.c
+ 	${CCRULE}
+ 
+ ubik_int.xdr.o: ubik_int.xdr.c
+ 	${CCRULE}
+ 
+ utst_int.ss.o: utst_int.ss.c 
+ 	${CCRULE}
+ 
+ utst_int.cs.o: utst_int.cs.c
+ 	${CCRULE}
+ 
+ utst_int.xdr.o: utst_int.xdr.c
+ 	${CCRULE}
+ 
+ #
+ # Installation targets
+ #
+ test: all
+ 
+ install: \
+ 	${DESTDIR}${libdir}/libubik_pthread.a \
+ 	${DESTDIR}${bindir}/udebug \
+ 	${DESTDIR}${afssrvbindir}/udebug
+ 
+ ${DEST}/bin/udebug ${DEST}/root.server/usr/afs/bin/udebug: udebug
+ 	${INSTALL} $? $@
+ 
+ ${DEST}/lib/libubik_pthread.a: libubik_pthread.a
+ 	${INSTALL} $? $@
+ 
+ ${DEST}/include/ubik.h: ubik.h
+ 	${INSTALL} $? $@
+ 
+ ${DEST}/include/ubik_int.h: ubik_int.h
+ 	${INSTALL} $? $@
+ 
+ #
+ # Misc. targets
+ #
+ clean:
+ 	$(RM) -f *.o utst_server utst_client udebug *.a *.cs.c *.ss.c *.xdr.c
+ 	$(RM) -f utst_int.h ubik_int.h uerrors.c ubik.h core AFS_component_version_number.c Kubik_int.h
+ 
+ include ../config/Makefile.version
+ 
+ 
+ ${DESTDIR}${libdir}/libubik_pthread.a: libubik_pthread.a
+ 	${INSTALL} $? $@
+ 
+ ${TOP_LIBDIR}/libubik_pthread.a: libubik_pthread.a
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${includedir}/ubik.h: ubik.h
+ 	${INSTALL} $? $@
+ 
+ ${TOP_INCDIR}/ubik.h: ubik.h
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${includedir}/ubik_int.h: ubik_int.h
+ 	${INSTALL} $? $@
+ 
+ ${TOP_INCDIR}/ubik_int.h: ubik_int.h
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${bindir}/udebug: udebug
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afssrvbindir}/udebug: udebug
+ 	${INSTALL} $? $@
+ 
+ dest: \
+ 	${DEST}/lib/libubik_pthread.a \
+ 	${DEST}/bin/udebug \
+ 	${DEST}/root.server/usr/afs/bin/udebug
+ 
Index: openafs/src/tvlserver/Makefile.in
diff -c /dev/null openafs/src/tvlserver/Makefile.in:1.1.2.5
*** /dev/null	Mon Apr 21 17:11:57 2008
--- openafs/src/tvlserver/Makefile.in	Wed Apr  2 23:54:55 2008
***************
*** 0 ****
--- 1,217 ----
+ # 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
+ 
+ srcdir=@srcdir@
+ include @TOP_OBJDIR@/src/config/Makefile.config
+ 
+ CC=${MT_CC}
+ CFLAGS=${COMMON_CFLAGS} ${MT_CFLAGS} 
+ CCRULE=${CC} ${CFLAGS} -c $?
+ 
+ RX=../rx
+ UTIL=../util
+ VLSERVER=../vlserver
+ 
+ RXOBJS= rx_pthread.o rxkad_errs.o
+ 
+ UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o \
+      volparse.o flipbase64.o softsig.o hostparse.o snprintf.o \
+      pthread_glock.o get_krbrlm.o
+ 
+ INCLS=${TOP_INCDIR}/ubik.h \
+              ${TOP_INCDIR}/lwp.h \
+              ${TOP_INCDIR}/lock.h  \
+              ${TOP_INCDIR}/rx/rx.h \
+              ${TOP_INCDIR}/rx/xdr.h \
+              ${TOP_INCDIR}/afs/keys.h \
+              ${TOP_INCDIR}/afs/cellconfig.h \
+ 	vlserver.h ${VLSERVER}/vlclient.h vldbint.h
+ 
+ LIBS=	${TOP_LIBDIR}/libubik_pthread.a \
+ 	${TOP_LIBDIR}/libafsauthent.a \
+ 	${TOP_LIBDIR}/libcmd.a \
+ 	${TOP_LIBDIR}/libafsrpc.a \
+ 	${TOP_LIBDIR}/libafsutil.a 
+ 
+ OBJS=vldbint.xdr.o vldbint.cs.o vl_errors.o ${RXOBJS} ${UTILOBJS} 
+ 
+ 
+ all: \
+ 	vlserver vlclient vlserver cnvldb vldb_check \
+ 	Kvldbint.cs.c Kvldbint.xdr.c vldbint.h 
+ 
+ depinstall:
+ 
+ rx_pthread.o: ${RX}/rx_pthread.c
+ 	${CCRULE}
+ 
+ rxkad_errs.o: ../rxkad/rxkad_errs.c
+ 	${CCRULE}
+ 
+ #
+ # get the pthreaded util stuff compiled here.  we do this instead of
+ # using the non-pthreaded libutil.a.  There probably should be a
+ # pthreaded version of this library, as we are doing with ubik itself, but...
+ #
+ 
+ assert.o: ${UTIL}/assert.c
+ 	${CCRULE}
+ 
+ uuid.o: ${UTIL}/uuid.c
+ 	${CCRULE}
+ 
+ serverLog.o: ${UTIL}/serverLog.c
+ 	${CCRULE}
+ 
+ fileutil.o: ${UTIL}/fileutil.c
+ 	${CCRULE}
+ 
+ volparse.o: ${UTIL}/volparse.c
+ 	${CCRULE}
+ 
+ flipbase64.o: ${UTIL}/flipbase64.c
+ 	${CCRULE}
+ 
+ netutils.o: ${UTIL}/netutils.c
+ 	${CCRULE}
+ 
+ dirpath.o: ${UTIL}/dirpath.c
+ 	${CCRULE}
+ 
+ softsig.o: ${UTIL}/softsig.c
+ 	${CCRULE}
+ 
+ hostparse.o: ${UTIL}/hostparse.c
+ 	${CCRULE}
+ 
+ snprintf.o: ${UTIL}/snprintf.c
+ 	${CCRULE}
+ 
+ pthread_glock.o: ${UTIL}/pthread_glock.c
+ 	${CCRULE}
+ 
+ get_krbrlm.o: ${UTIL}/get_krbrlm.c
+ 	${CCRULE}
+ 
+ #
+ # Other stuff
+ #
+ 
+ 
+ vldb_check: vldb_check.o ${LIBS} AFS_component_version_number.o
+ 	$(CC) ${LDFLAGS} -o vldb_check vldb_check.o AFS_component_version_number.o ${LIBS} ${MT_LIBS} ${XLIBS} 
+ 
+ vldb_check.o: ${VLSERVER}/vldb_check.c 
+ 	${CCRULE}
+ 
+ cnvldb: cnvldb.o ${LIBS} 
+ 	$(CC) ${LDFLAGS} -o cnvldb cnvldb.o ${LIBS} ${MT_LIBS} ${XLIBS}
+ 
+ cnvldb.o: ${VLSERVER}/cnvldb.c
+ 	${CCRULE}
+ 
+ sascnvldb: sascnvldb.o ${LIBS} 
+ 	$(CC) ${LDFLAGS} -o sascnvldb sascnvldb.o ${LIBS} ${MT_LIBS} ${XLIBS}
+ 
+ sascnvldb.o: ${VLSERVER}/sascnvldb.c
+ 	${CCRULE}
+ 
+ vlserver: vlserver.o vlutils.o vlprocs.o vldbint.ss.o vldbint.xdr.o $(LIBS)
+ 	$(CC) ${LDFLAGS} -o vlserver vlserver.o vlutils.o vlprocs.o vldbint.ss.o \
+ 		vldbint.xdr.o $(LIBS) ${MT_LIBS} ${XLIBS} ${TOP_LIBDIR}/libaudit.a
+ 
+ vlserver.o: ${VLSERVER}/vlserver.c 
+ 	${CCRULE}
+ 
+ vlutils.o: ${VLSERVER}/vlutils.c 
+ 	${CCRULE}
+ 
+ vlprocs.o: ${VLSERVER}/vlprocs.c 
+ 	${CCRULE}
+ 
+ vldbint.ss.o: vldbint.ss.c 
+ 	${CCRULE}
+ 
+ vldbint.cs.o: vldbint.cs.c 
+ 	${CCRULE}
+ 
+ vldbint.xdr.o: vldbint.xdr.c 
+ 	${CCRULE}
+ 
+ vldbint.cs.c: ${VLSERVER}/vldbint.xg
+ 	${RXGEN} -u -x -C -o $@ ${VLSERVER}/vldbint.xg
+ 
+ vldbint.ss.c: ${VLSERVER}/vldbint.xg
+ 	${RXGEN} -x -S -o $@ ${VLSERVER}/vldbint.xg
+ 
+ vldbint.xdr.c: ${VLSERVER}/vldbint.xg
+ 	${RXGEN} -x -c -o $@ ${VLSERVER}/vldbint.xg
+ 
+ vldbint.h: ${VLSERVER}/vldbint.xg
+ 	${RXGEN} -u -x -h -o $@ ${VLSERVER}/vldbint.xg
+ 
+ vldbint.cs.c: vldbint.h
+ vldbint.ss.c: vldbint.h
+ vldbint.xdr.c: vldbint.h
+ 
+ Kvldbint.cs.c: ${VLSERVER}/vldbint.xg
+ 	${RXGEN} -x -k -C -o $@ ${VLSERVER}/vldbint.xg
+ 
+ Kvldbint.xdr.c: ${VLSERVER}/vldbint.xg
+ 	${RXGEN} -x -k -c -o $@ ${VLSERVER}/vldbint.xg
+ 
+ vlclient: vlclient.o $(OBJS) $(LIBS) 
+ 	$(CC) ${LDFLAGS} -o vlclient vlclient.o $(OBJS) $(LIBS) ${MT_LIBS} ${XLIBS} ${TOP_LIBDIR}/libcmd.a
+ 
+ vlclient.o: ${VLSERVER}/vlclient.c
+ 	${CCRULE}
+ 
+ vl_errors.o: vl_errors.c
+ 	${CCRULE}
+ 
+ vlserver.h vl_errors.c: ${VLSERVER}/vl_errors.et ${VLSERVER}/vlserver.p.h
+ 	$(RM) -f vlserver.h vl_errors.c; ${COMPILE_ET} -p ${VLSERVER} vl_errors -h vlserver
+ 
+ system: install
+ 
+ ${DEST}/root.server/usr/afs/bin/vlserver: vlserver
+ 	${INSTALL} $? $@
+ 
+ ${DEST}/etc/vldb_convert: cnvldb
+ 	${INSTALL} -f $? $@
+ 
+ install: \
+ 	${DESTDIR}${afssrvlibexecdir}/vlserver \
+ 	${DESTDIR}${afssrvsbindir}/vldb_convert \
+ 	${DESTDIR}${afssrvsbindir}/vldb_check
+ 
+ ${DESTDIR}${afssrvlibexecdir}/vlserver: vlserver
+ 	${INSTALL} $? $@
+ 
+ ${DESTDIR}${afssrvsbindir}/vldb_convert: cnvldb
+ 	${INSTALL} -f $? $@
+ 
+ ${DESTDIR}${afssrvsbindir}/vldb_check: vldb_check
+ 	${INSTALL} $? $@
+ 
+ dest: \
+ 	${DEST}/root.server/usr/afs/bin/vlserver \
+ 	${DEST}/etc/vldb_convert \
+ 	${DEST}/etc/vldb_check
+ 
+ ${DEST}/etc/vldb_check: vldb_check
+ 	${INSTALL} $? $@
+ 
+ #
+ # Misc targets
+ #
+ include ../config/Makefile.version
+ 
+ clean:
+ 	$(RM) -f *.o *.a *.otl *.xdr.c *.cs.c *.ss.c core \
+ 		vlserver vlclient cnvldb vldbint.h vlserver.h vldb_check \
+ 		vl_errors.c AFS_component_version_number.c
Index: openafs/src/tvolser/Makefile.in
diff -c openafs/src/tvolser/Makefile.in:1.4.2.1 openafs/src/tvolser/Makefile.in:1.4.2.2
*** openafs/src/tvolser/Makefile.in:1.4.2.1	Mon Jul 31 12:19:15 2006
--- openafs/src/tvolser/Makefile.in	Thu Apr  3 12:17:58 2008
***************
*** 27,33 ****
  
  VOLSEROBJS=volmain.o volprocs.o physio.o voltrans.o volerr.o volint.cs.o dumpstuff.o  volint.ss.o volint.xdr.o vscommon.o
  
! VLSERVEROBJS=#vldbint.cs.o vldbint.xdr.o
  
  LWPOBJS=lock.o threadname.o
  
--- 27,35 ----
  
  VOLSEROBJS=volmain.o volprocs.o physio.o voltrans.o volerr.o volint.cs.o dumpstuff.o  volint.ss.o volint.xdr.o vscommon.o
  
! VLSERVEROBJS=vldbint.cs.o vldbint.xdr.o vl_errors.o
! 
! VOSOBJS= vsprocs.o vsutils.o lockprocs.o volint.xdr.o volerr.o volint.cs.o
  
  LWPOBJS=lock.o threadname.o
  
***************
*** 45,56 ****
  
  RXOBJS=rx_pthread.o
  
! objects= ${VOLSEROBJS} ${VLSERVEROBJS} ${LWPOBJS} ${LIBACLOBJS} \
  	 ${UTILOBJS} ${DIROBJS} ${VOLOBJS} ${FSINTOBJS} ${RXOBJS}
  
! LIBS=${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/util.a
  
! all: volserver
  
  COMPILE=${CC} ${CFLAGS} -c $?
  
--- 47,66 ----
  
  RXOBJS=rx_pthread.o
  
! objects= ${VOLSEROBJS} ${LWPOBJS} ${LIBACLOBJS} \
  	 ${UTILOBJS} ${DIROBJS} ${VOLOBJS} ${FSINTOBJS} ${RXOBJS}
  
! vosobjects= ${VOSOBJS} ${VLSERVEROBJS} ${LIBACLOBJS} ${UTILOBJS} ${DIROBJS} \
! 	${VOLOBJS} ${FSINTOBJS} ${RXOBJS}
! 
! LIBS=	${TOP_LIBDIR}/libcmd.a          \
! 	${TOP_LIBDIR}/libafsauthent.a   \
! 	${TOP_LIBDIR}/libafsrpc.a       \
! 	${TOP_LIBDIR}/libafsutil.a      \
! 	${TOP_LIBDIR}/libubik_pthread.a \
! 	${TOP_LIBDIR}/libusd.a
  
! all: volserver vos
  
  COMPILE=${CC} ${CFLAGS} -c $?
  
***************
*** 74,79 ****
--- 84,95 ----
  	${COMPILE}
  volint.xdr.o: ${VOLSER}/volint.xdr.c
  	${COMPILE}
+ vsprocs.o: ${VOLSER}/vsprocs.c
+ 	${COMPILE}
+ vsutils.o: ${VOLSER}/vsutils.c
+ 	${COMPILE}
+ lockprocs.o: ${VOLSER}/lockprocs.c
+ 	${COMPILE}
  
  assert.o: ${UTIL}/assert.c
  	${COMPILE}
***************
*** 114,119 ****
--- 130,141 ----
  netprocs.o: ${LIBACL}/netprocs.c
  	${COMPILE}
  
+ vlserver.h vl_errors.c: ${VLSERVER}/vl_errors.et ${VLSERVER}/vlserver.p.h
+ 	$(RM) -f vlserver.h vl_errors.c; ${COMPILE_ET} -p ${VLSERVER} vl_errors -h vlserver
+ 
+ vl_errors.o: vl_errors.c
+ 	${COMPILE}
+ 
  vldbint.cs.o: ${VLSERVER}/vldbint.cs.c
  	${COMPILE}
  
***************
*** 195,215 ****
  afsint.xdr.o: ${FSINT}/afsint.xdr.c
  	${COMPILE}
  
  volserver: ${objects} ${LIBS}
  	${CC} ${LDFLAGS} -o volserver ${objects} ${LIBS} ${MT_LIBS} ${XLIBS}
  
  ${DEST}/root.server/usr/afs/bin/volserver: volserver
  	${INSTALL} -ns $? $@
  
! install: ${DESTDIR}${afssrvlibexecdir}/volserver
  
  clean:
! 	$(RM) -f *.o volserver core AFS_component_version_number.c
  
  include ../config/Makefile.version
  
  ${DESTDIR}${afssrvlibexecdir}/volserver: volserver
  	${INSTALL} -ns $? $@
  
! dest: ${DEST}/root.server/usr/afs/bin/volserver
  
--- 217,249 ----
  afsint.xdr.o: ${FSINT}/afsint.xdr.c
  	${COMPILE}
  
+ vos.o: ${VOLSER}/vos.c
+ 	${COMPILE}
+ 
+ 
+ vos: vos.o  ${VOSOBJS} ${VLSERVEROBJS} ${LIBS}
+ 	${CC} ${LDFLAGS} -o vos vos.o ${VOSOBJS} ${VLSERVEROBJS} ${LIBS} ${MT_LIBS} ${XLIBS}
+ 
  volserver: ${objects} ${LIBS}
  	${CC} ${LDFLAGS} -o volserver ${objects} ${LIBS} ${MT_LIBS} ${XLIBS}
  
  ${DEST}/root.server/usr/afs/bin/volserver: volserver
  	${INSTALL} -ns $? $@
  
! ${DEST}/root.server/usr/afs/bin/vos: vos
! 	${INSTALL} -ns $? $@
  
+ install: ${DESTDIR}${afssrvlibexecdir}/volserver ${DESTDIR}${afssrvlibexecdir}/vos
  clean:
! 	$(RM) -f *.o volserver vos core AFS_component_version_number.c
  
  include ../config/Makefile.version
  
  ${DESTDIR}${afssrvlibexecdir}/volserver: volserver
  	${INSTALL} -ns $? $@
  
! ${DESTDIR}${afssrvlibexecdir}/vos: vos
! 	${INSTALL} -ns $? $@
! 
! dest: ${DEST}/root.server/usr/afs/bin/volserver ${DEST}/root.server/usr/afs/bin/vos
  
Index: openafs/src/ubik/beacon.c
diff -c openafs/src/ubik/beacon.c:1.21.8.3 openafs/src/ubik/beacon.c:1.21.8.5
*** openafs/src/ubik/beacon.c:1.21.8.3	Mon Mar 10 18:32:34 2008
--- openafs/src/ubik/beacon.c	Wed Apr  9 12:40:01 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/beacon.c,v 1.21.8.3 2008/03/10 22:32:34 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/beacon.c,v 1.21.8.5 2008/04/09 16:40:01 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 330,336 ****
--- 330,340 ----
  		temp = POLLTIME;
  	    tt.tv_sec = temp;
  	    tt.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	    code = select(0, 0, 0, 0, &tt);
+ #else
  	    code = IOMGR_Select(0, 0, 0, 0, &tt);
+ #endif
  	} else
  	    code = 0;
  
***************
*** 446,452 ****
  		ubik_dprint("Ubik: I am the sync site\n");
  	    ubik_amSyncSite = 1;
  	    syncSiteUntil = oldestYesVote + SMALLTIME;
! 	    LWP_NoYieldSignal(&ubik_amSyncSite);
  	} else {
  	    if (ubik_amSyncSite)
  		ubik_dprint("Ubik: I am no longer the sync site\n");
--- 450,462 ----
  		ubik_dprint("Ubik: I am the sync site\n");
  	    ubik_amSyncSite = 1;
  	    syncSiteUntil = oldestYesVote + SMALLTIME;
! #ifndef AFS_PTHREAD_ENV
! #ifndef UBIK_PTHREAD_ENV
! 		/* I did not find a corresponding LWP_WaitProcess(&ubik_amSyncSite) --
! 		   this may be a spurious signal call -- sjenkins */
! 		LWP_NoYieldSignal(&ubik_amSyncSite);
! #endif
! #endif
  	} else {
  	    if (ubik_amSyncSite)
  		ubik_dprint("Ubik: I am no longer the sync site\n");
***************
*** 455,460 ****
--- 465,471 ----
  	}
  
      }				/* while loop */
+     return NULL;
  }
  
  /* 
Index: openafs/src/ubik/disk.c
diff -c openafs/src/ubik/disk.c:1.15.4.1 openafs/src/ubik/disk.c:1.15.4.2
*** openafs/src/ubik/disk.c:1.15.4.1	Tue Oct 30 11:16:47 2007
--- openafs/src/ubik/disk.c	Wed Apr  2 15:51:56 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/disk.c,v 1.15.4.1 2007/10/30 15:16:47 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/disk.c,v 1.15.4.2 2008/04/02 19:51:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 798,805 ****
  	}
  
  	dbase->version.counter++;	/* bump commit count */
  	LWP_NoYieldSignal(&dbase->version);
! 
  	code = udisk_LogEnd(dbase, &dbase->version);
  	if (code) {
  	    dbase->version.counter--;
--- 798,808 ----
  	}
  
  	dbase->version.counter++;	/* bump commit count */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	assert(pthread_cond_broadcast(&dbase->version_cond) == 0);
+ #else
  	LWP_NoYieldSignal(&dbase->version);
! #endif
  	code = udisk_LogEnd(dbase, &dbase->version);
  	if (code) {
  	    dbase->version.counter--;
***************
*** 915,920 ****
--- 918,927 ----
      free(atrans);
  
      /* Wakeup any writers waiting in BeginTrans() */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	assert(pthread_cond_broadcast(&dbase->flags_cond) == 0);
+ #else
      LWP_NoYieldSignal(&dbase->flags);
+ #endif
      return 0;
  }
Index: openafs/src/ubik/phys.c
diff -c openafs/src/ubik/phys.c:1.9.2.2 openafs/src/ubik/phys.c:1.9.2.3
*** openafs/src/ubik/phys.c:1.9.2.2	Mon Dec 10 17:45:55 2007
--- openafs/src/ubik/phys.c	Wed Apr  2 15:51:56 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/phys.c,v 1.9.2.2 2007/12/10 22:45:55 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/phys.c,v 1.9.2.3 2008/04/02 19:51:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 23,29 ****
--- 23,36 ----
  #include <netinet/in.h>
  #endif
  #include <sys/stat.h>
+ 
+ /* #if defined (AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV) */
+ #if 0   /* temporary hack - klm */
+ /* nothing */
+ #else
  #include <lwp.h>
+ #endif
+ 
  #include <lock.h>
  #include <errno.h>
  #include <string.h>
Index: openafs/src/ubik/recovery.c
diff -c openafs/src/ubik/recovery.c:1.14.4.4 openafs/src/ubik/recovery.c:1.14.4.6
*** openafs/src/ubik/recovery.c:1.14.4.4	Mon Mar 10 18:32:34 2008
--- openafs/src/ubik/recovery.c	Wed Apr  9 12:40:01 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/recovery.c,v 1.14.4.4 2008/03/10 22:32:34 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/recovery.c,v 1.14.4.6 2008/04/09 16:40:01 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 72,78 ****
--- 72,81 ----
  urecovery_ResetState(void)
  {
      urecovery_state = 0;
+ #if !defined(AFS_PTHREAD_ENV) || !defined(UBIK_PTHREAD_ENV)
+     /*  No corresponding LWP_WaitProcess found anywhere for this -- klm */
      LWP_NoYieldSignal(&urecovery_state);
+ #endif
      return 0;
  }
  
***************
*** 83,90 ****
--- 86,96 ----
  int
  urecovery_LostServer(void)
  {
+ #if !defined(AFS_PTHREAD_ENV) || !defined(UBIK_PTHREAD_ENV)
+     /*  No corresponding LWP_WaitProcess found anywhere for this -- klm */
      LWP_NoYieldSignal(&urecovery_state);
      return 0;
+ #endif
  }
  
  /* return true iff we have a current database (called by both sync
***************
*** 363,369 ****
--- 369,379 ----
  	    adbase->version.counter = 0;
  	    (*adbase->setlabel) (adbase, 0, &adbase->version);
  	}
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	assert(pthread_cond_broadcast(&adbase->version_cond) == 0);
+ #else
  	LWP_NoYieldSignal(&adbase->version);
+ #endif
      }
      return 0;
  }
***************
*** 443,449 ****
--- 453,463 ----
  	/* Run through this loop every 4 seconds */
  	tv.tv_sec = 4;
  	tv.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	select(0, 0, 0, 0, &tv);
+ #else
  	IOMGR_Select(0, 0, 0, 0, &tv);
+ #endif
  
  	ubik_dprint("recovery running in state %x\n", urecovery_state);
  
***************
*** 678,684 ****
--- 692,702 ----
  		urecovery_state |= UBIK_RECHAVEDB;
  	    }
  	    udisk_Invalidate(ubik_dbase, 0);	/* data has changed */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	    assert(pthread_cond_broadcast(&ubik_dbase->version_cond) == 0);
+ #else
  	    LWP_NoYieldSignal(&ubik_dbase->version);
+ #endif
  	    DBRELE(ubik_dbase);
  	}
  #if defined(UBIK_PAUSE)
***************
*** 702,708 ****
--- 720,730 ----
  	    code =
  		(*ubik_dbase->setlabel) (ubik_dbase, 0, &ubik_dbase->version);
  	    udisk_Invalidate(ubik_dbase, 0);	/* data may have changed */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	    assert(pthread_cond_broadcast(&ubik_dbase->version_cond) == 0);
+ #else
  	    LWP_NoYieldSignal(&ubik_dbase->version);
+ #endif
  	    DBRELE(ubik_dbase);
  	}
  
***************
*** 731,737 ****
--- 753,763 ----
  		while ((ubik_dbase->flags & DBWRITING) && (safety < 500)) {
  		    DBRELE(ubik_dbase);
  		    /* sleep for a little while */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 		    select(0, 0, 0, 0, &tv);
+ #else
  		    IOMGR_Select(0, 0, 0, 0, &tv);
+ #endif
  		    tv.tv_usec += 10000;
  		    safety++;
  		    DBHOLD(ubik_dbase);
***************
*** 806,811 ****
--- 832,838 ----
  		urecovery_state |= UBIK_RECSENTDB;
  	}
      }
+     return NULL;
  }
  
  /*
Index: openafs/src/ubik/remote.c
diff -c openafs/src/ubik/remote.c:1.15.4.4 openafs/src/ubik/remote.c:1.15.4.5
*** openafs/src/ubik/remote.c:1.15.4.4	Wed Feb 20 15:09:05 2008
--- openafs/src/ubik/remote.c	Wed Apr  2 15:51:56 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.15.4.4 2008/02/20 20:09:05 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.15.4.5 2008/04/02 19:51:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 566,572 ****
      memcpy(&ubik_dbase->version, &tversion, sizeof(struct ubik_version));
      while (length > 0) {
  	tlen = (length > sizeof(tbuffer) ? sizeof(tbuffer) : length);
! #if !defined(OLD_URECOVERY) && defined(AFS_PTHREAD_ENV)
  	if (pass % 4 == 0)
  	    IOMGR_Poll();
  #endif
--- 566,572 ----
      memcpy(&ubik_dbase->version, &tversion, sizeof(struct ubik_version));
      while (length > 0) {
  	tlen = (length > sizeof(tbuffer) ? sizeof(tbuffer) : length);
! #if !defined(OLD_URECOVERY) && !defined(AFS_PTHREAD_ENV)
  	if (pass % 4 == 0)
  	    IOMGR_Poll();
  #endif
***************
*** 626,632 ****
--- 626,636 ----
  #endif
      memcpy(&ubik_dbase->version, avers, sizeof(struct ubik_version));
      udisk_Invalidate(dbase, file);	/* new dbase, flush disk buffers */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+     assert(pthread_cond_broadcast(&dbase->version_cond) == 0);
+ #else
      LWP_NoYieldSignal(&dbase->version);
+ #endif
      DBRELE(dbase);
    failed:
      if (code) {
Index: openafs/src/ubik/ubik.c
diff -c openafs/src/ubik/ubik.c:1.15.14.3 openafs/src/ubik/ubik.c:1.15.14.4
*** openafs/src/ubik/ubik.c:1.15.14.3	Mon Mar 10 18:32:34 2008
--- openafs/src/ubik/ubik.c	Wed Apr  2 15:51:56 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubik.c,v 1.15.14.3 2008/03/10 22:32:34 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubik.c,v 1.15.14.4 2008/04/02 19:51:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 32,37 ****
--- 32,39 ----
  #include "ubik.h"
  #include "ubik_int.h"
  
+ #include <lwp.h>   /* temporary hack by klm */
+ 
  #define ERROR_EXIT(code) {error=(code); goto error_exit;}
  
  /*  This system is organized in a hierarchical set of related modules.  Modules
***************
*** 187,193 ****
--- 189,205 ----
  {
      register struct ubik_dbase *tdb;
      register afs_int32 code;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+     pthread_t rxServerThread;        /* pthread variables */
+     pthread_t ubeacon_InteractThread;
+     pthread_t urecovery_InteractThread;
+     pthread_attr_t rxServer_tattr;
+     pthread_attr_t ubeacon_Interact_tattr;
+     pthread_attr_t urecovery_Interact_tattr;
+ #else
      PROCESS junk;
+ #endif
+ 
      afs_int32 secIndex;
      struct rx_securityClass *secClass;
  
***************
*** 220,225 ****
--- 232,244 ----
      ubik_dbase = tdb;		/* for now, only one db per server; can fix later when we have names for the other dbases */
  
      /* initialize RX */
+ 
+     /* the following call is idempotent so when/if it got called earlier,
+      * by whatever called us, it doesn't really matter -- klm */
+     code = rx_Init(myPort);
+     if (code < 0)
+ 	return code;
+ 
      ubik_callPortal = myPort;
      /* try to get an additional security object */
      ubik_sc[0] = rxnull_NewServerSecurityObject();
***************
*** 235,243 ****
--- 254,271 ----
      }
      /* for backwards compat this should keep working as it does now 
         and not host bind */
+ #if 0
+     /* This really needs to be up above, where I have put it.  It works
+      * here when we're non-pthreaded, but the code above, when using
+      * pthreads may (and almost certainly does) end up calling on a
+      * pthread resource which gets initialized by rx_Init.  The end
+      * result is that an assert fails and the program dies. -- klm
+      */
      code = rx_Init(myPort);
      if (code < 0)
  	return code;
+ #endif
+ 
      tservice =
  	rx_NewService(0, VOTE_SERVICE_ID, "VOTE", ubik_sc, 3,
  		      VOTE_ExecuteRequest);
***************
*** 262,269 ****
       * UpdateInterfaceAddr RPC that occurs in ubeacon_InitServerList. This avoids
       * the "steplock" problem in ubik initialization. Defect 11037.
       */
      LWP_CreateProcess(rx_ServerProc, rx_stackSize, RX_PROCESS_PRIORITY,
! 		      (void *)0, "rx_ServerProc", &junk);
  
      /* do basic initialization */
      code = uvote_Init();
--- 290,306 ----
       * UpdateInterfaceAddr RPC that occurs in ubeacon_InitServerList. This avoids
       * the "steplock" problem in ubik initialization. Defect 11037.
       */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ /* do assert stuff */
+     assert(pthread_attr_init(&rxServer_tattr) == 0);
+     assert(pthread_attr_setdetachstate(&rxServer_tattr, PTHREAD_CREATE_DETACHED) == 0);
+ /*    assert(pthread_attr_setstacksize(&rxServer_tattr, rx_stackSize) == 0); */
+ 
+     assert(pthread_create(&rxServerThread, &rxServer_tattr, (void *)rx_ServerProc, NULL) == 0);
+ #else
      LWP_CreateProcess(rx_ServerProc, rx_stackSize, RX_PROCESS_PRIORITY,
!               (void *)0, "rx_ServerProc", &junk);
! #endif
  
      /* do basic initialization */
      code = uvote_Init();
***************
*** 280,294 ****
--- 317,357 ----
  	return code;
  
      /* now start up async processes */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ /* do assert stuff */
+     assert(pthread_attr_init(&ubeacon_Interact_tattr) == 0);
+     assert(pthread_attr_setdetachstate(&ubeacon_Interact_tattr, PTHREAD_CREATE_DETACHED) == 0);
+ /*    assert(pthread_attr_setstacksize(&ubeacon_Interact_tattr, 16384) == 0); */
+     /*  need another attr set here for priority???  - klm */
+ 
+     assert(pthread_create(&ubeacon_InteractThread, &ubeacon_Interact_tattr,
+            (void *)ubeacon_Interact, NULL) == 0);
+ #else
      code = LWP_CreateProcess(ubeacon_Interact, 16384 /*8192 */ ,
  			     LWP_MAX_PRIORITY - 1, (void *)0, "beacon",
  			     &junk);
      if (code)
  	return code;
+ #endif
+ 
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ /* do assert stuff */
+     assert(pthread_attr_init(&urecovery_Interact_tattr) == 0);
+     assert(pthread_attr_setdetachstate(&urecovery_Interact_tattr, PTHREAD_CREATE_DETACHED) == 0);
+ /*    assert(pthread_attr_setstacksize(&urecovery_Interact_tattr, 16384) == 0); */
+     /*  need another attr set here for priority???  - klm */
+ 
+     assert(pthread_create(&urecovery_InteractThread, &urecovery_Interact_tattr,
+            (void *)urecovery_Interact, NULL) == 0);
+ 
+     return 0;  /* is this correct?  - klm */
+ #else  
      code = LWP_CreateProcess(urecovery_Interact, 16384 /*8192 */ ,
  			     LWP_MAX_PRIORITY - 1, (void *)0, "recovery",
  			     &junk);
      return code;
+ #endif
+ 
  }
  
  int
***************
*** 364,370 ****
--- 427,437 ----
  #endif
  		return UNOQUORUM;	/* a white lie */
  	    }
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	    sleep(2);
+ #else
  	    IOMGR_Sleep(2);
+ #endif
  	    DBHOLD(dbase);
  	}
  #endif /* UBIK_PAUSE */
***************
*** 382,388 ****
--- 449,461 ----
  	/* if we're writing already, wait */
  	while (dbase->flags & DBWRITING) {
  	    DBRELE(dbase);
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	    assert(pthread_mutex_lock(&dbase->flags_mutex) == 0);
+ 	    assert(pthread_cond_wait(&dbase->flags_cond, &dbase->flags_mutex) == 0);
+ 	    assert(pthread_mutex_unlock(&dbase->flags_mutex) == 0);
+ #else
  	    LWP_WaitProcess(&dbase->flags);
+ #endif
  	    DBHOLD(dbase);
  	}
  	if (!ubeacon_AmSyncSite()) {
***************
*** 571,577 ****
--- 644,654 ----
  		code = 1;
  		tv.tv_sec = 1;	/* try again after a while (ha ha) */
  		tv.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 		select(0, 0, 0, 0, &tv);
+ #else
  		IOMGR_Select(0, 0, 0, 0, &tv);	/* poll, should we wait on something? */
+ #endif
  		break;
  	    }
  	}
***************
*** 875,881 ****
--- 952,964 ----
  	/* wait until version # changes, and then return */
  	if (vcmp(*aversion, adatabase->version) != 0)
  	    return 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	assert(pthread_mutex_lock(&adatabase->version_mutex) == 0);
+ 	assert(pthread_cond_wait(&adatabase->version_cond,&adatabase->version_mutex) == 0);
+ 	assert(pthread_mutex_unlock(&adatabase->version_mutex) == 0);
+ #else
  	LWP_WaitProcess(&adatabase->version);	/* same vers, just wait */
+ #endif
      }
  }
  
Index: openafs/src/ubik/ubik.p.h
diff -c openafs/src/ubik/ubik.p.h:1.18.8.2 openafs/src/ubik/ubik.p.h:1.18.8.3
*** openafs/src/ubik/ubik.p.h:1.18.8.2	Mon Mar 10 18:32:34 2008
--- openafs/src/ubik/ubik.p.h	Wed Apr  2 15:51:56 2008
***************
*** 73,78 ****
--- 73,80 ----
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
  #include <assert.h>
+ #else
+ #include <lwp.h>
  #endif
  
  /* per-client structure for ubik */
***************
*** 170,175 ****
--- 172,183 ----
      int (*getnfiles) (struct ubik_dbase * adbase);	/* find out number of files */
      short readers;		/* number of current read transactions */
      struct ubik_version cachedVersion;	/* version of caller's cached data */
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+     pthread_cond_t version_cond;    /* condition variable to manage changes to version */
+     pthread_cond_t flags_cond;      /* condition variable to manage changes to flags */
+   pthread_mutex_t version_mutex;
+   pthread_mutex_t flags_mutex;
+ #endif
  };
  
  /* procedures for automatically authenticating ubik connections */
Index: openafs/src/ubik/utst_client.c
diff -c openafs/src/ubik/utst_client.c:1.7.14.1 openafs/src/ubik/utst_client.c:1.7.14.2
*** openafs/src/ubik/utst_client.c:1.7.14.1	Tue Oct 30 11:16:47 2007
--- openafs/src/ubik/utst_client.c	Wed Apr  2 15:51:56 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/utst_client.c,v 1.7.14.1 2007/10/30 15:16:47 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/utst_client.c,v 1.7.14.2 2008/04/02 19:51:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 149,155 ****
--- 149,159 ----
  
  		tv.tv_sec = 1;
  		tv.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 		select(0, 0, 0, 0, &tv);
+ #else
  		IOMGR_Select(0, 0, 0, 0, &tv);
+ #endif
  		printf("Repeating the SAMPLE operations again...\n");
  	    }
  	} else if (!strcmp(argv[i], "-mget")) {
***************
*** 172,178 ****
--- 176,186 ----
  
  		tv.tv_sec = 1;
  		tv.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 		select(0, 0, 0, 0, &tv);
+ #else
  		IOMGR_Select(0, 0, 0, 0, &tv);
+ #endif
  	    }
  	}
      }
Index: openafs/src/ubik/utst_server.c
diff -c openafs/src/ubik/utst_server.c:1.8.14.1 openafs/src/ubik/utst_server.c:1.8.14.2
*** openafs/src/ubik/utst_server.c:1.8.14.1	Tue Oct 30 11:16:47 2007
--- openafs/src/ubik/utst_server.c	Wed Apr  2 15:51:57 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/utst_server.c,v 1.8.14.1 2007/10/30 15:16:47 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/utst_server.c,v 1.8.14.2 2008/04/02 19:51:57 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 62,68 ****
--- 62,72 ----
      if (sleepTime) {
  	tv.tv_sec = sleepTime;
  	tv.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	select(0, 0, 0, 0, &tv);
+ #else
  	IOMGR_Select(0, 0, 0, 0, &tv);
+ #endif
      }
      /* read the original value */
      code = ubik_Read(tt, &temp, sizeof(afs_int32));
***************
*** 118,124 ****
--- 122,132 ----
      if (sleepTime) {
  	tv.tv_sec = sleepTime;
  	tv.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	select(0, 0, 0, 0, &tv);
+ #else
  	IOMGR_Select(0, 0, 0, 0, &tv);
+ #endif
      }
      /* read the value */
      code = ubik_Read(tt, &temp, sizeof(afs_int32));
***************
*** 161,167 ****
--- 169,179 ----
      if (sleepTime) {
  	tv.tv_sec = sleepTime;
  	tv.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	select(0, 0, 0, 0, &tv);
+ #else
  	IOMGR_Select(0, 0, 0, 0, &tv);
+ #endif
      }
      /* read the value */
      code = ubik_Read(tt, &temp, sizeof(afs_int32));
***************
*** 201,207 ****
--- 213,223 ----
      if (sleepTime) {
  	tv.tv_sec = sleepTime;
  	tv.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	select(0, 0, 0, 0, &tv);
+ #else
  	IOMGR_Select(0, 0, 0, 0, &tv);
+ #endif
      }
      /* shrink the file */
      code = ubik_Truncate(tt, 0);
***************
*** 242,248 ****
--- 258,268 ----
      if (sleepTime) {
  	tv.tv_sec = sleepTime;
  	tv.tv_usec = 0;
+ #if defined(AFS_PTHREAD_ENV) && defined(UBIK_PTHREAD_ENV)
+ 	select(0, 0, 0, 0, &tv);
+ #else
  	IOMGR_Select(0, 0, 0, 0, &tv);
+ #endif
      }
      /* read the original value */
      code = ubik_Read(tt, &temp, sizeof(afs_int32));
Index: openafs/src/util/Makefile.in
diff -c openafs/src/util/Makefile.in:1.32 openafs/src/util/Makefile.in:1.32.2.1
*** openafs/src/util/Makefile.in:1.32	Fri Mar 17 14:54:46 2006
--- openafs/src/util/Makefile.in	Wed Apr  2 15:51:57 2008
***************
*** 14,20 ****
  	 hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
  	 dirpath.o fileutil.o netutils.o flipbase64.o fstab.o \
  	 afs_atomlist.o afs_lhash.o snprintf.o strlcat.o strlcpy.o strnlen.o \
! 	 daemon.o rxkstats.o ${REGEX_OBJ}
  
  includes = \
  	${TOP_INCDIR}/afs/dirpath.h \
--- 14,20 ----
  	 hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
  	 dirpath.o fileutil.o netutils.o flipbase64.o fstab.o \
  	 afs_atomlist.o afs_lhash.o snprintf.o strlcat.o strlcpy.o strnlen.o \
! 	 pthread_glock.o daemon.o rxkstats.o ${REGEX_OBJ}
  
  includes = \
  	${TOP_INCDIR}/afs/dirpath.h \
***************
*** 62,67 ****
--- 62,70 ----
  	$(AR) crv util.a ${objects} AFS_component_version_number.o
  	$(RANLIB) util.a
  
+ pthread_glock.o: ${srcdir}/pthread_glock.c ${includes}
+ 	${MT_CC} ${CFLAGS} ${MT_CFLAGS} -c ${srcdir}/pthread_glock.c
+ 
  assert.o: ${srcdir}/assert.c ${includes}
  	${CCOBJ} ${CFLAGS} -c ${srcdir}/assert.c
  
Index: openafs/src/util/pthread_glock.c
diff -c openafs/src/util/pthread_glock.c:1.6 openafs/src/util/pthread_glock.c:1.6.4.2
*** openafs/src/util/pthread_glock.c:1.6	Wed Sep 21 11:13:28 2005
--- openafs/src/util/pthread_glock.c	Sat Apr  5 14:03:24 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/pthread_glock.c,v 1.6 2005/09/21 15:13:28 shadow Exp $");
  
  #if defined(AFS_NT40_ENV) && defined(AFS_PTHREAD_ENV)
  #define AFS_GRMUTEX_DECLSPEC __declspec(dllexport)
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/pthread_glock.c,v 1.6.4.2 2008/04/05 18:03:24 shadow Exp $");
  
  #if defined(AFS_NT40_ENV) && defined(AFS_PTHREAD_ENV)
  #define AFS_GRMUTEX_DECLSPEC __declspec(dllexport)
Index: openafs/src/util/rxkstats.c
diff -c openafs/src/util/rxkstats.c:1.1 openafs/src/util/rxkstats.c:1.1.6.1
*** openafs/src/util/rxkstats.c:1.1	Sat Jun 18 20:15:58 2005
--- openafs/src/util/rxkstats.c	Wed Apr  2 15:51:57 2008
***************
*** 4,9 ****
  #include <des.h>
  #include <des/stats.h>
  
! #ifndef AFS_PTHREAD_ENV 
  struct rxkad_stats rxkad_stats = { { 0 } }; 
  #endif
--- 4,11 ----
  #include <des.h>
  #include <des/stats.h>
  
! #ifndef AFS_PTHREAD_ENV
  struct rxkad_stats rxkad_stats = { { 0 } }; 
+ #else
+ rxkad_stats_t rxkad_stats = { { 0 } };
  #endif
Index: openafs/src/vlserver/Makefile.in
diff -c openafs/src/vlserver/Makefile.in:1.12.14.2 openafs/src/vlserver/Makefile.in:1.12.14.3
*** openafs/src/vlserver/Makefile.in:1.12.14.2	Thu Nov  1 12:02:30 2007
--- openafs/src/vlserver/Makefile.in	Wed Apr  2 15:51:57 2008
***************
*** 110,119 ****
  system: install
  
  ${DEST}/root.server/usr/afs/bin/vlserver: vlserver
! 	${INSTALL} $? $@
  
  ${DEST}/etc/vldb_convert: cnvldb
! 	${INSTALL} -f $? $@
  
  ${TOP_LIBDIR}/libvldb.a: libvldb.a
  	${INSTALL} $? $@
--- 110,127 ----
  system: install
  
  ${DEST}/root.server/usr/afs/bin/vlserver: vlserver
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install vlserver for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DEST}/etc/vldb_convert: cnvldb
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install cnvldb for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${TOP_LIBDIR}/libvldb.a: libvldb.a
  	${INSTALL} $? $@
***************
*** 141,150 ****
  	${DESTDIR}${afssrvsbindir}/vldb_check
  
  ${DESTDIR}${afssrvlibexecdir}/vlserver: vlserver
! 	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvsbindir}/vldb_convert: cnvldb
! 	${INSTALL} -f $? $@
  
  ${DESTDIR}${libdir}/afs/libvldb.a: libvldb.a
  	${INSTALL} $? $@
--- 149,166 ----
  	${DESTDIR}${afssrvsbindir}/vldb_check
  
  ${DESTDIR}${afssrvlibexecdir}/vlserver: vlserver
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install vlserver for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DESTDIR}${afssrvsbindir}/vldb_convert: cnvldb
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install cnvldb for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  ${DESTDIR}${libdir}/afs/libvldb.a: libvldb.a
  	${INSTALL} $? $@
***************
*** 162,168 ****
  	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvsbindir}/vldb_check: vldb_check
! 	${INSTALL} $? $@
  
  dest: \
  	${DEST}/root.server/usr/afs/bin/vlserver \
--- 178,188 ----
  	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvsbindir}/vldb_check: vldb_check
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install vldb_check for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  dest: \
  	${DEST}/root.server/usr/afs/bin/vlserver \
***************
*** 190,196 ****
  	${INSTALL} $? $@
  
  ${DEST}/etc/vldb_check: vldb_check
! 	${INSTALL} $? $@
  
  #
  # Misc targets
--- 210,220 ----
  	${INSTALL} $? $@
  
  ${DEST}/etc/vldb_check: vldb_check
! 	@if test "@ENABLE_PTHREADED_UBIK@" = "yes"; then \
! 	  echo "Don't install vldb_check for ${SYS_NAME}" ; \
! 	else \
! 	  ${INSTALL} $? $@ ; \
! 	fi
  
  #
  # Misc targets
Index: openafs/src/vlserver/NTMakefile
diff -c openafs/src/vlserver/NTMakefile:1.10.4.3 openafs/src/vlserver/NTMakefile:1.10.4.5
*** openafs/src/vlserver/NTMakefile:1.10.4.3	Sat Feb  2 08:43:26 2008
--- openafs/src/vlserver/NTMakefile	Sun Mar 30 00:17:15 2008
***************
*** 14,25 ****
  ############################################################################
  # Definitions for installing header files
  
! INCFILEDIR = $(DESTDIR)\include\afs 
  
  INCFILES = \
! 	$(INCFILEDIR)\afs\vl_opcodes.h \
! 	$(INCFILEDIR)\afs\vlserver.h \
! 	$(INCFILEDIR)\afs\vldbint.h
  
  ############################################################################
  # build afsvldb.lib
--- 14,25 ----
  ############################################################################
  # Definitions for installing header files
  
! INCFILEDIR = $(DESTDIR)\include\afs
  
  INCFILES = \
! 	$(INCFILEDIR)\vl_opcodes.h \
! 	$(INCFILEDIR)\vlserver.h \
! 	$(INCFILEDIR)\vldbint.h
  
  ############################################################################
  # build afsvldb.lib
***************
*** 87,93 ****
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
  	$(DESTDIR)\lib\cm_dns.obj
  
- 	
  $(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS)
  	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
          $(_VC_MANIFEST_EMBED_EXE)
--- 87,92 ----
***************
*** 115,121 ****
  
  vldbint.h: vldbint.xg
  	$(RXGEN) -u -x -h -o $@ vldbint.xg
! 	$(COPY) vldbint.h $(DESTDIR)\include\afs\vldbint.h
  
  ############################################################################
  # Definitions for generating files via COMPILE_ET
--- 114,120 ----
  
  vldbint.h: vldbint.xg
  	$(RXGEN) -u -x -h -o $@ vldbint.xg
! 	$(COPY) vldbint.h $(INCFILEDIR)\vldbint.h
  
  ############################################################################
  # Definitions for generating files via COMPILE_ET
***************
*** 124,130 ****
  vlserver.h vl_errors.c: vl_errors.et vlserver.p.h
  	$(DEL) vlserver.h vl_errors.c
  	$(COMPILE_ET) vl_errors  -h vlserver
! 	$(COPY) vlserver.h $(INCFILEDIR)\afs\vlserver.h
  
  ############################################################################
  # build local vldb_check
--- 123,129 ----
  vlserver.h vl_errors.c: vl_errors.et vlserver.p.h
  	$(DEL) vlserver.h vl_errors.c
  	$(COMPILE_ET) vl_errors  -h vlserver
! 	$(COPY) vlserver.h $(INCFILEDIR)\vlserver.h
  
  ############################################################################
  # build local vldb_check
Index: openafs/src/vlserver/vlprocs.c
diff -c openafs/src/vlserver/vlprocs.c:1.15.4.2 openafs/src/vlserver/vlprocs.c:1.15.4.3
*** openafs/src/vlserver/vlprocs.c:1.15.4.2	Mon Nov 26 16:08:46 2007
--- openafs/src/vlserver/vlprocs.c	Wed Apr  2 15:51:57 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlprocs.c,v 1.15.4.2 2007/11/26 21:08:46 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlprocs.c,v 1.15.4.3 2008/04/02 19:51:57 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 1135,1141 ****
--- 1135,1143 ----
  	while (nextblockindex =
  	       NextEntry(trans, nextblockindex, &tentry, &count)) {
  	    if (++pollcount > 50) {
+ #ifndef AFS_PTHREAD_ENV
  		IOMGR_Poll();
+ #endif
  		pollcount = 0;
  	    }
  	    match = 0;
***************
*** 1273,1279 ****
--- 1275,1283 ----
  	while (nextblockindex =
  	       NextEntry(trans, nextblockindex, &tentry, &count)) {
  	    if (++pollcount > 50) {
+ #ifndef AFS_PTHREAD_ENV
  		IOMGR_Poll();
+ #endif
  		pollcount = 0;
  	    }
  
***************
*** 1455,1461 ****
--- 1459,1467 ----
  	blockindex = startindex;
  	while (blockindex = NextEntry(trans, blockindex, &tentry, &count)) {
  	    if (++pollcount > 50) {
+ #ifndef AFS_PTHREAD_ENV
  		IOMGR_Poll();
+ #endif
  		pollcount = 0;
  	    }
  
***************
*** 1677,1683 ****
--- 1683,1691 ----
  	    match = 0;
  
  	    if (++pollcount > 50) {
+ #ifndef AFS_PTHREAD_ENV
  		IOMGR_Poll();
+ #endif
  		pollcount = 0;
  	    }
  
***************
*** 1803,1809 ****
--- 1811,1819 ----
  	    match = 0;
  
  	    if (++pollcount > 50) {
+ #ifndef AFS_PTHREAD_ENV
  		IOMGR_Poll();
+ #endif
  		pollcount = 0;
  	    }
  
***************
*** 3190,3196 ****
--- 3200,3208 ----
  	for (blockindex = NextEntry(atrans, 0, &tentry, &count); blockindex;
  	     blockindex = NextEntry(atrans, blockindex, &tentry, &count)) {
  	    if (++pollcount > 50) {
+ #ifndef AFS_PTHREAD_ENV
  		IOMGR_Poll();
+ #endif
  		pollcount = 0;
  	    }
  	    for (j = 0; j < NMAXNSERVERS; j++) {
Index: openafs/src/vlserver/vlserver.c
diff -c openafs/src/vlserver/vlserver.c:1.22.2.7 openafs/src/vlserver/vlserver.c:1.22.2.9
*** openafs/src/vlserver/vlserver.c:1.22.2.7	Mon Mar 10 18:32:36 2008
--- openafs/src/vlserver/vlserver.c	Wed Apr  2 15:51:57 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.22.2.7 2008/03/10 22:32:36 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.22.2.9 2008/04/02 19:51:57 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 74,80 ****
--- 74,84 ----
  static void
  CheckSignal_Signal()
  {
+ #if defined(AFS_PTHREAD_ENV)
+     CheckSignal(0);
+ #else
      IOMGR_SoftSig(CheckSignal, 0);
+ #endif
  }
  
  static void *
***************
*** 85,91 ****
  
      if (errorcode =
  	Init_VLdbase(&trans, LOCKREAD, VLGETSTATS - VL_LOWEST_OPCODE))
! 	return errorcode;
      VLog(0, ("Dump name hash table out\n"));
      for (i = 0; i < HASHSIZE; i++) {
  	HashNDump(trans, i);
--- 89,95 ----
  
      if (errorcode =
  	Init_VLdbase(&trans, LOCKREAD, VLGETSTATS - VL_LOWEST_OPCODE))
! 	return (void *)errorcode;
      VLog(0, ("Dump name hash table out\n"));
      for (i = 0; i < HASHSIZE; i++) {
  	HashNDump(trans, i);
Index: openafs/src/vol/daemon_com.c
diff -c openafs/src/vol/daemon_com.c:1.3.4.6 openafs/src/vol/daemon_com.c:1.3.4.7
*** openafs/src/vol/daemon_com.c:1.3.4.6	Fri Mar 21 12:59:14 2008
--- openafs/src/vol/daemon_com.c	Tue Apr  1 16:05:36 2008
***************
*** 22,28 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/daemon_com.c,v 1.3.4.6 2008/03/21 16:59:14 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 22,28 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/daemon_com.c,v 1.3.4.7 2008/04/01 20:05:36 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 63,73 ****
  
  /*@printflike@*/ extern void Log(const char *format, ...);
  
- #ifdef osi_Assert
- #undef osi_Assert
- #endif
- #define osi_Assert(e) (void)(e)
- 
  int (*V_BreakVolumeCallbacks) ();
  
  #define MAXHANDLERS	4	/* Up to 4 clients; must be at least 2, so that
--- 63,68 ----
Index: openafs/src/vol/fssync-client.c
diff -c openafs/src/vol/fssync-client.c:1.1.4.3 openafs/src/vol/fssync-client.c:1.1.4.4
*** openafs/src/vol/fssync-client.c:1.1.4.3	Mon Feb  4 13:51:39 2008
--- openafs/src/vol/fssync-client.c	Tue Apr  1 16:05:36 2008
***************
*** 44,50 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync-client.c,v 1.1.4.3 2008/02/04 18:51:39 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 44,50 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync-client.c,v 1.1.4.4 2008/04/01 20:05:36 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 85,95 ****
  
  /*@printflike@*/ extern void Log(const char *format, ...);
  
- #ifdef osi_Assert
- #undef osi_Assert
- #endif
- #define osi_Assert(e) (void)(e)
- 
  extern int LogLevel;
  
  static SYNC_client_state fssync_state = 
--- 85,90 ----
Index: openafs/src/vol/fssync-server.c
diff -c openafs/src/vol/fssync-server.c:1.1.4.9 openafs/src/vol/fssync-server.c:1.1.4.10
*** openafs/src/vol/fssync-server.c:1.1.4.9	Wed Mar  5 16:53:30 2008
--- openafs/src/vol/fssync-server.c	Tue Apr  1 16:05:36 2008
***************
*** 53,59 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync-server.c,v 1.1.4.9 2008/03/05 21:53:30 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 53,59 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync-server.c,v 1.1.4.10 2008/04/01 20:05:36 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 104,114 ****
  
  /*@printflike@*/ extern void Log(const char *format, ...);
  
- #ifdef osi_Assert
- #undef osi_Assert
- #endif
- #define osi_Assert(e) (void)(e)
- 
  int (*V_BreakVolumeCallbacks) ();
  
  #define MAXHANDLERS	4	/* Up to 4 clients; must be at least 2, so that
--- 104,109 ----
Index: openafs/src/vol/salvsync-client.c
diff -c openafs/src/vol/salvsync-client.c:1.1.4.3 openafs/src/vol/salvsync-client.c:1.1.4.4
*** openafs/src/vol/salvsync-client.c:1.1.4.3	Mon Feb  4 13:51:39 2008
--- openafs/src/vol/salvsync-client.c	Tue Apr  1 16:05:36 2008
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/salvsync-client.c,v 1.1.4.3 2008/02/04 18:51:39 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/salvsync-client.c,v 1.1.4.4 2008/04/01 20:05:36 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 53,64 ****
  
  /*@printflike@*/ extern void Log(const char *format, ...);
  
- #ifdef osi_Assert
- #undef osi_Assert
- #endif
- #define osi_Assert(e) (void)(e)
- 
- 
  #ifdef AFS_DEMAND_ATTACH_FS
  /*
   * SALVSYNC is a feature specific to the demand attach fileserver
--- 53,58 ----
Index: openafs/src/vol/salvsync-server.c
diff -c openafs/src/vol/salvsync-server.c:1.1.4.6 openafs/src/vol/salvsync-server.c:1.1.4.9
*** openafs/src/vol/salvsync-server.c:1.1.4.6	Wed Mar  5 16:53:30 2008
--- openafs/src/vol/salvsync-server.c	Tue Apr  1 16:29:12 2008
***************
*** 27,33 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/salvsync-server.c,v 1.1.4.6 2008/03/05 21:53:30 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 27,33 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/salvsync-server.c,v 1.1.4.9 2008/04/01 20:29:12 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 74,84 ****
  
  /*@printflike@*/ extern void Log(const char *format, ...);
  
- #ifdef osi_Assert
- #undef osi_Assert
- #endif
- #define osi_Assert(e) (void)(e)
- 
  #define MAXHANDLERS	4	/* Up to 4 clients; must be at least 2, so that
  				 * move = dump+restore can run on single server */
  
--- 74,79 ----
***************
*** 275,280 ****
--- 270,276 ----
      pthread_attr_t tattr;
  
      /* initialize the queues */
+     Lock_Init(&SALVSYNC_handler_lock);
      assert(pthread_cond_init(&salvageQueue.cv, NULL) == 0);
      for (i = 0; i <= VOLMAXPARTS; i++) {
  	queue_Init(&salvageQueue.part[i]);
***************
*** 317,329 ****
      (void)signal(SIGPIPE, SIG_IGN);
  #endif
  
-     /* set our 'thread-id' so that the host hold table works */
-     MUTEX_ENTER(&rx_stats_mutex);	/* protects rxi_pthread_hinum */
-     tid = ++rxi_pthread_hinum;
-     MUTEX_EXIT(&rx_stats_mutex);
-     pthread_setspecific(rx_thread_id_key, (void *)tid);
-     Log("Set thread id %d for SALVSYNC_syncThread\n", tid);
- 
      state->fd = SYNC_getSock(&state->endpoint);
      code = SYNC_bindSock(state);
      assert(!code);
--- 313,318 ----
Index: openafs/src/vol/vnode_inline.h
diff -c openafs/src/vol/vnode_inline.h:1.1.2.4 openafs/src/vol/vnode_inline.h:1.1.2.5
*** openafs/src/vol/vnode_inline.h:1.1.2.4	Fri Mar 14 00:42:52 2008
--- openafs/src/vol/vnode_inline.h	Mon Apr 21 14:55:48 2008
***************
*** 14,20 ****
  
  #ifdef AFS_HPUX_ENV
  #define static_inline static __inline
! #elif defined(AFS_AIX_ENV)
  #define static_inline static
  #else
  #define static_inline static inline
--- 14,20 ----
  
  #ifdef AFS_HPUX_ENV
  #define static_inline static __inline
! #elif defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV)
  #define static_inline static
  #else
  #define static_inline static inline
Index: openafs/src/vol/volume.c
diff -c openafs/src/vol/volume.c:1.43.2.17 openafs/src/vol/volume.c:1.43.2.20
*** openafs/src/vol/volume.c:1.43.2.17	Tue Mar 18 12:06:19 2008
--- openafs/src/vol/volume.c	Fri Apr  4 14:21:04 2008
***************
*** 22,28 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/volume.c,v 1.43.2.17 2008/03/18 16:06:19 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
--- 22,28 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/volume.c,v 1.43.2.20 2008/04/04 18:21:04 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
***************
*** 194,201 ****
  static int VHold(Volume * vp);
  static int VHold_r(Volume * vp);
  static void VGetBitmap_r(Error * ec, Volume * vp, VnodeClass class);
- static void GetVolumePath(Error * ec, VolId volumeId, char **partitionp,
- 			  char **namep);
  static void VReleaseVolumeHandles_r(Volume * vp);
  static void VCloseVolumeHandles_r(Volume * vp);
  static void LoadVolumeHeader(Error * ec, Volume * vp);
--- 194,199 ----
***************
*** 804,810 ****
  	    dpq->diskP = diskP;
  	    queue_Prepend(&params, dpq);
  
! 	    params.part_pass_head[diskP->device] = queue_First(&diskP->vol_list, rx_queue);
  	}
  
  	Log("VShutdown:  beginning parallel fileserver shutdown\n");
--- 802,808 ----
  	    dpq->diskP = diskP;
  	    queue_Prepend(&params, dpq);
  
! 	    params.part_pass_head[diskP->index] = queue_First(&diskP->vol_list, rx_queue);
  	}
  
  	Log("VShutdown:  beginning parallel fileserver shutdown\n");
***************
*** 849,858 ****
  	    VVByPListEndExclusive_r(diskP);
  	    Log("VShutdown:  %s stats : (pass[0]=%d, pass[1]=%d, pass[2]=%d, pass[3]=%d)\n",
  		VPartitionPath(diskP),
! 		params.stats[0][diskP->device],
! 		params.stats[1][diskP->device],
! 		params.stats[2][diskP->device],
! 		params.stats[3][diskP->device]);
  	}
  
  	Log("VShutdown:  shutdown finished using %d threads\n", params.n_threads);
--- 847,856 ----
  	    VVByPListEndExclusive_r(diskP);
  	    Log("VShutdown:  %s stats : (pass[0]=%d, pass[1]=%d, pass[2]=%d, pass[3]=%d)\n",
  		VPartitionPath(diskP),
! 		params.stats[0][diskP->index],
! 		params.stats[1][diskP->index],
! 		params.stats[2][diskP->index],
! 		params.stats[3][diskP->index]);
  	}
  
  	Log("VShutdown:  shutdown finished using %d threads\n", params.n_threads);
***************
*** 923,929 ****
  	Log("ShutdownController:  n_threads_complete=%d, n_parts_done_pass=%d\n",
  	    shadow.n_threads_complete, shadow.n_parts_done_pass);
  	for (diskP = DiskPartitionList; diskP; diskP=diskP->next) {
! 	    id = diskP->device;
  	    Log("ShutdownController:  part[%d] : (len=%d, thread_target=%d, done_pass=%d, pass_head=%p)\n",
  		id, 
  		diskP->vol_list.len,
--- 921,927 ----
  	Log("ShutdownController:  n_threads_complete=%d, n_parts_done_pass=%d\n",
  	    shadow.n_threads_complete, shadow.n_parts_done_pass);
  	for (diskP = DiskPartitionList; diskP; diskP=diskP->next) {
! 	    id = diskP->index;
  	    Log("ShutdownController:  part[%d] : (len=%d, thread_target=%d, done_pass=%d, pass_head=%p)\n",
  		id, 
  		diskP->vol_list.len,
***************
*** 977,983 ****
      /* for fairness, give every partition with volumes remaining
       * at least one thread */
      for (diskP = DiskPartitionList; diskP && thr_left; diskP = diskP->next) {
! 	id = diskP->device;
  	if (diskP->vol_list.len) {
  	    params->part_thread_target[id] = 1;
  	    thr_left--;
--- 975,981 ----
      /* for fairness, give every partition with volumes remaining
       * at least one thread */
      for (diskP = DiskPartitionList; diskP && thr_left; diskP = diskP->next) {
! 	id = diskP->index;
  	if (diskP->vol_list.len) {
  	    params->part_thread_target[id] = 1;
  	    thr_left--;
***************
*** 991,997 ****
  	int delta;
  
  	for (diskP = DiskPartitionList; diskP && thr_left; diskP = diskP->next) {
! 	    id = diskP->device;
  	    delta = (diskP->vol_list.len / thr_workload) -
  		params->part_thread_target[id];
  	    if (delta < 0) {
--- 989,995 ----
  	int delta;
  
  	for (diskP = DiskPartitionList; diskP && thr_left; diskP = diskP->next) {
! 	    id = diskP->index;
  	    delta = (diskP->vol_list.len / thr_workload) -
  		params->part_thread_target[id];
  	    if (delta < 0) {
***************
*** 1015,1021 ****
  
  	/* compute the residues */
  	for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 	    id = diskP->device;
  	    part_residue[id] = diskP->vol_list.len - 
  		(params->part_thread_target[id] * thr_workload);
  	}
--- 1013,1019 ----
  
  	/* compute the residues */
  	for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 	    id = diskP->index;
  	    part_residue[id] = diskP->vol_list.len - 
  		(params->part_thread_target[id] * thr_workload);
  	}
***************
*** 1025,1031 ****
  	while (thr_left) {
  	    max_residue = 0;
  	    for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 		id = diskP->device;
  		if (part_residue[id] > max_residue) {
  		    max_residue = part_residue[id];
  		    max_id = id;
--- 1023,1029 ----
  	while (thr_left) {
  	    max_residue = 0;
  	    for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 		id = diskP->index;
  		if (part_residue[id] > max_residue) {
  		    max_residue = part_residue[id];
  		    max_id = id;
***************
*** 1048,1054 ****
  	if (thr_left >= params->n_parts) {
  	    alloc = thr_left / params->n_parts;
  	    for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 		id = diskP->device;
  		params->part_thread_target[id] += alloc;
  		thr_left -= alloc;
  	    }
--- 1046,1052 ----
  	if (thr_left >= params->n_parts) {
  	    alloc = thr_left / params->n_parts;
  	    for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 		id = diskP->index;
  		params->part_thread_target[id] += alloc;
  		thr_left -= alloc;
  	    }
***************
*** 1056,1062 ****
  
  	/* finish off the last of the threads */
  	for (diskP = DiskPartitionList; thr_left && diskP; diskP = diskP->next) {
! 	    id = diskP->device;
  	    params->part_thread_target[id]++;
  	    thr_left--;
  	}
--- 1054,1060 ----
  
  	/* finish off the last of the threads */
  	for (diskP = DiskPartitionList; thr_left && diskP; diskP = diskP->next) {
! 	    id = diskP->index;
  	    params->part_thread_target[id]++;
  	    thr_left--;
  	}
***************
*** 1088,1099 ****
  	assert(pthread_mutex_unlock(&params->lock) == 0);
  	diskP = dpq->diskP;
  	free(dpq);
! 	id = diskP->device;
  
  	count = 0;
  	while (ShutdownVolumeWalk_r(diskP, 0, &params->part_pass_head[id]))
  	    count++;
! 	params->stats[0][diskP->device] = count;
  	assert(pthread_mutex_lock(&params->lock) == 0);
      }
  
--- 1086,1097 ----
  	assert(pthread_mutex_unlock(&params->lock) == 0);
  	diskP = dpq->diskP;
  	free(dpq);
! 	id = diskP->index;
  
  	count = 0;
  	while (ShutdownVolumeWalk_r(diskP, 0, &params->part_pass_head[id]))
  	    count++;
! 	params->stats[0][diskP->index] = count;
  	assert(pthread_mutex_lock(&params->lock) == 0);
      }
  
***************
*** 1119,1125 ****
  	found = 0;
  	/* find a disk partition to work on */
  	for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 	    id = diskP->device;
  	    if (params->part_thread_target[id] && !params->part_done_pass[id]) {
  		params->part_thread_target[id]--;
  		found = 1;
--- 1117,1123 ----
  	found = 0;
  	/* find a disk partition to work on */
  	for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 	    id = diskP->index;
  	    if (params->part_thread_target[id] && !params->part_done_pass[id]) {
  		params->part_thread_target[id]--;
  		found = 1;
***************
*** 1131,1137 ****
  	    /* hmm. for some reason the controller thread couldn't find anything for 
  	     * us to do. let's see if there's anything we can do */
  	    for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 		id = diskP->device;
  		if (diskP->vol_list.len && !params->part_done_pass[id]) {
  		    found = 1;
  		    break;
--- 1129,1135 ----
  	    /* hmm. for some reason the controller thread couldn't find anything for 
  	     * us to do. let's see if there's anything we can do */
  	    for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 		id = diskP->index;
  		if (diskP->vol_list.len && !params->part_done_pass[id]) {
  		    found = 1;
  		    break;
***************
*** 1182,1188 ****
  		    params->n_parts_done_pass = 0;
  		    params->pass++;
  		    for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 			id = diskP->device;
  			params->part_done_pass[id] = 0;
  			params->part_pass_head[id] = queue_First(&diskP->vol_list, rx_queue);
  		    }
--- 1180,1186 ----
  		    params->n_parts_done_pass = 0;
  		    params->pass++;
  		    for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
! 			id = diskP->index;
  			params->part_done_pass[id] = 0;
  			params->part_pass_head[id] = queue_First(&diskP->vol_list, rx_queue);
  		    }
***************
*** 2539,2545 ****
  VAttachVolume_r(Error * ec, VolumeId volumeId, int mode)
  {
      char *part, *name;
!     GetVolumePath(ec, volumeId, &part, &name);
      if (*ec) {
  	register Volume *vp;
  	Error error;
--- 2537,2543 ----
  VAttachVolume_r(Error * ec, VolumeId volumeId, int mode)
  {
      char *part, *name;
!     VGetVolumePath(ec, volumeId, &part, &name);
      if (*ec) {
  	register Volume *vp;
  	Error error;
***************
*** 4714,4723 ****
   *       on a vice partition, it is possible for callers to get the wrong one,
   *       depending on the order of the disk partition linked list.
   *
-  * @internal volume package internal use only.
   */
! static void
! GetVolumePath(Error * ec, VolId volumeId, char **partitionp, char **namep)
  {
      static char partition[VMAXPATHLEN], name[VMAXPATHLEN];
      char path[VMAXPATHLEN];
--- 4712,4720 ----
   *       on a vice partition, it is possible for callers to get the wrong one,
   *       depending on the order of the disk partition linked list.
   *
   */
! void
! VGetVolumePath(Error * ec, VolId volumeId, char **partitionp, char **namep)
  {
      static char partition[VMAXPATHLEN], name[VMAXPATHLEN];
      char path[VMAXPATHLEN];
Index: openafs/src/vol/volume.h
diff -c openafs/src/vol/volume.h:1.19.2.3 openafs/src/vol/volume.h:1.19.2.5
*** openafs/src/vol/volume.h:1.19.2.3	Mon Mar 17 12:05:29 2008
--- openafs/src/vol/volume.h	Fri Apr  4 15:58:45 2008
***************
*** 774,780 ****
  extern void VTakeOffline_r(register Volume * vp);
  extern void VTakeOffline(register Volume * vp);
  extern Volume * VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint);
! 
  #ifdef AFS_DEMAND_ATTACH_FS
  extern Volume *VPreAttachVolumeByName(Error * ec, char *partition, char *name);
  extern Volume *VPreAttachVolumeByName_r(Error * ec, char *partition, char *name);
--- 774,781 ----
  extern void VTakeOffline_r(register Volume * vp);
  extern void VTakeOffline(register Volume * vp);
  extern Volume * VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint);
! extern void VGetVolumePath(Error * ec, VolId volumeId, char **partitionp,
! 			   char **namep);
  #ifdef AFS_DEMAND_ATTACH_FS
  extern Volume *VPreAttachVolumeByName(Error * ec, char *partition, char *name);
  extern Volume *VPreAttachVolumeByName_r(Error * ec, char *partition, char *name);
Index: openafs/src/vol/volume_inline.h
diff -c openafs/src/vol/volume_inline.h:1.1.2.4 openafs/src/vol/volume_inline.h:1.1.2.5
*** openafs/src/vol/volume_inline.h:1.1.2.4	Fri Mar 14 00:42:52 2008
--- openafs/src/vol/volume_inline.h	Mon Apr 21 14:55:48 2008
***************
*** 14,20 ****
  
  #ifdef AFS_HPUX_ENV
  #define static_inline static __inline
! #elif defined(AFS_AIX_ENV)
  #define static_inline static
  #else
  #define static_inline static inline
--- 14,20 ----
  
  #ifdef AFS_HPUX_ENV
  #define static_inline static __inline
! #elif defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV)
  #define static_inline static
  #else
  #define static_inline static inline
Index: openafs/src/vol/vutil.c
diff -c openafs/src/vol/vutil.c:1.16.8.1 openafs/src/vol/vutil.c:1.16.8.2
*** openafs/src/vol/vutil.c:1.16.8.1	Wed Mar  5 16:53:31 2008
--- openafs/src/vol/vutil.c	Fri Apr  4 14:17:35 2008
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vutil.c,v 1.16.8.1 2008/03/05 21:53:31 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vutil.c,v 1.16.8.2 2008/04/04 18:17:35 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 128,133 ****
--- 128,134 ----
      IHandle_t *handle;
      FdHandle_t *fdP;
      Inode nearInode = 0;
+     char *part, *name;
  
      *ec = 0;
      memset(&vol, 0, sizeof(vol));
***************
*** 150,155 ****
--- 151,167 ----
      nearInodeHash(volumeId, nearInode);
      nearInode %= partition->f_files;
  #endif
+     VGetVolumePath(ec, vol.id, &part, &name);
+     if (*ec == VNOVOL || !strcmp(partition->name, part)) {
+ 	/* this case is ok */
+     } else {
+ 	/* return EXDEV if it's a clone to an alternate partition
+ 	 * otherwise assume it's a move */
+ 	if (vol.parentId != vol.id) {
+ 	    *ec = EXDEV;
+ 	    return NULL;
+ 	}
+     }
      VLockPartition_r(partname);
      memset(&tempHeader, 0, sizeof(tempHeader));
      tempHeader.stamp.magic = VOLUMEHEADERMAGIC;
Index: openafs/src/volser/NTMakefile
diff -c openafs/src/volser/NTMakefile:1.11.2.2 openafs/src/volser/NTMakefile:1.11.2.3
*** openafs/src/volser/NTMakefile:1.11.2.2	Sat Feb  2 08:43:29 2008
--- openafs/src/volser/NTMakefile	Thu Apr 10 13:52:26 2008
***************
*** 18,23 ****
--- 18,25 ----
  
  INCFILES = \
  	$(INCFILEDIR)\volser_prototypes.h \
+ 	$(INCFILEDIR)\vsutils_prototypes.h \
+ 	$(INCFILEDIR)\lockprocs_prototypes.h \
  	$(INCFILEDIR)\volser.h \
  	$(INCFILEDIR)\volint.h
  
Index: openafs/src/volser/lockprocs.c
diff -c openafs/src/volser/lockprocs.c:1.8.14.2 openafs/src/volser/lockprocs.c:1.8.14.4
*** openafs/src/volser/lockprocs.c:1.8.14.2	Mon Nov 26 16:08:46 2007
--- openafs/src/volser/lockprocs.c	Mon Apr 14 16:25:52 2008
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/lockprocs.c,v 1.8.14.2 2007/11/26 21:08:46 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/lockprocs.c,v 1.8.14.4 2008/04/14 20:25:52 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 37,51 ****
  #include "volser.h"
  #include "lockdata.h"
  
  /* Finds an index in VLDB entry that matches the volume type, server, and partition.
   * If type is zero, will match first index of ANY type (RW, BK, or RO).
   * If server is zero, will match first index of ANY server and partition 
   * Zero is a valid partition field.
   */
  int
! FindIndex(entry, server, part, type)
!      struct nvldbentry *entry;
!      afs_int32 server, part, type;
  {
      int e;
      afs_int32 error = 0;
--- 37,52 ----
  #include "volser.h"
  #include "lockdata.h"
  
+ #include "vsutils_prototypes.h"
+ #include "lockprocs_prototypes.h"
+ 
  /* Finds an index in VLDB entry that matches the volume type, server, and partition.
   * If type is zero, will match first index of ANY type (RW, BK, or RO).
   * If server is zero, will match first index of ANY server and partition 
   * Zero is a valid partition field.
   */
  int
! FindIndex(struct nvldbentry *entry, afs_int32 server, afs_int32 part, afs_int32 type)
  {
      int e;
      afs_int32 error = 0;
***************
*** 77,85 ****
  
  /* Changes the rw site only */
  void
! SetAValue(entry, oserver, opart, nserver, npart, type)
!      struct nvldbentry *entry;
!      afs_int32 oserver, opart, nserver, npart, type;
  {
      int e;
      afs_int32 error = 0;
--- 78,85 ----
  
  /* Changes the rw site only */
  void
! SetAValue(struct nvldbentry *entry, afs_int32 oserver, afs_int32 opart,
!           afs_int32 nserver, afs_int32 npart, afs_int32 type)
  {
      int e;
      afs_int32 error = 0;
***************
*** 103,128 ****
  
  /* Changes the RW site only */
  void
! Lp_SetRWValue(entry, oserver, opart, nserver, npart)
!      struct nvldbentry *entry;
!      afs_int32 oserver, opart, nserver, npart;
  {
      SetAValue(entry, oserver, opart, nserver, npart, ITSRWVOL);
  }
  
  /* Changes the RO site only */
  void
! Lp_SetROValue(entry, oserver, opart, nserver, npart)
!      struct nvldbentry *entry;
!      afs_int32 oserver, opart, nserver, npart;
  {
      SetAValue(entry, oserver, opart, nserver, npart, ITSROVOL);
  }
  
  /* Returns success if this server and partition matches the RW entry */
! Lp_Match(server, part, entry)
!      afs_int32 server, part;
!      struct nvldbentry *entry;
  {
      if (FindIndex(entry, server, part, ITSRWVOL) == -1)
  	return 0;
--- 103,126 ----
  
  /* Changes the RW site only */
  void
! Lp_SetRWValue(struct nvldbentry *entry, afs_int32 oserver, afs_int32 opart, 
!               afs_int32 nserver, afs_int32 npart)
  {
      SetAValue(entry, oserver, opart, nserver, npart, ITSRWVOL);
  }
  
  /* Changes the RO site only */
  void
! Lp_SetROValue(struct nvldbentry *entry, afs_int32 oserver, 
!               afs_int32 opart, afs_int32 nserver, afs_int32 npart)
  {
      SetAValue(entry, oserver, opart, nserver, npart, ITSROVOL);
  }
  
  /* Returns success if this server and partition matches the RW entry */
! int 
! Lp_Match(afs_int32 server, afs_int32 part,
!          struct nvldbentry *entry)
  {
      if (FindIndex(entry, server, part, ITSRWVOL) == -1)
  	return 0;
***************
*** 130,153 ****
  }
  
  /* Return the index of the RO entry (plus 1) if it exists, else return 0 */
! Lp_ROMatch(server, part, entry)
!      afs_int32 server, part;
!      struct nvldbentry *entry;
  {
      return (FindIndex(entry, server, part, ITSROVOL) + 1);
  }
  
  /* Return the index of the RW entry if it exists, else return -1 */
! Lp_GetRwIndex(entry)
!      struct nvldbentry *entry;
  {
      return (FindIndex(entry, 0, 0, ITSRWVOL));
  }
  
  /*initialize queue pointed by <ahead>*/
  void
! Lp_QInit(ahead)
!      struct qHead *ahead;
  {
      ahead->count = 0;
      ahead->next = NULL;
--- 128,149 ----
  }
  
  /* Return the index of the RO entry (plus 1) if it exists, else return 0 */
! int 
! Lp_ROMatch(afs_int32 server, afs_int32 part, struct nvldbentry *entry)
  {
      return (FindIndex(entry, server, part, ITSROVOL) + 1);
  }
  
  /* Return the index of the RW entry if it exists, else return -1 */
! int 
! Lp_GetRwIndex(struct nvldbentry *entry)
  {
      return (FindIndex(entry, 0, 0, ITSRWVOL));
  }
  
  /*initialize queue pointed by <ahead>*/
  void
! Lp_QInit(struct qHead *ahead)
  {
      ahead->count = 0;
      ahead->next = NULL;
***************
*** 155,163 ****
  
  /*add <elem> in front of queue <ahead> */
  void
! Lp_QAdd(ahead, elem)
!      struct qHead *ahead;
!      struct aqueue *elem;
  {
      struct aqueue *temp;
  
--- 151,157 ----
  
  /*add <elem> in front of queue <ahead> */
  void
! Lp_QAdd(struct qHead *ahead, struct aqueue *elem)
  {
      struct aqueue *temp;
  
***************
*** 173,183 ****
      }
  }
  
! Lp_QScan(ahead, id, success, elem)
!      struct qHead *ahead;
!      struct aqueue **elem;
!      afs_int32 id;
!      int *success;
  {
      struct aqueue *cptr;
  
--- 167,174 ----
      }
  }
  
! int 
! Lp_QScan(struct qHead *ahead, afs_int32 id, int *success, struct aqueue **elem)
  {
      struct aqueue *cptr;
  
***************
*** 197,206 ****
  /*return the element in the beginning of the queue <ahead>, free
  *the space used by that element . <success> indicates if enumeration was ok*/
  void
! Lp_QEnumerate(ahead, success, elem)
!      struct qHead *ahead;
!      struct aqueue *elem;
!      int *success;
  {
      int i;
      struct aqueue *temp;
--- 188,194 ----
  /*return the element in the beginning of the queue <ahead>, free
  *the space used by that element . <success> indicates if enumeration was ok*/
  void
! Lp_QEnumerate(struct qHead *ahead, int *success, struct aqueue *elem)
  {
      int i;
      struct aqueue *temp;
***************
*** 223,230 ****
  }
  
  void
! Lp_QTraverse(ahead)
!      struct qHead *ahead;
  {
      int count;
      struct aqueue *old, *new;
--- 211,217 ----
  }
  
  void
! Lp_QTraverse(struct qHead *ahead)
  {
      int count;
      struct aqueue *old, *new;
Index: openafs/src/volser/lockprocs_prototypes.h
diff -c /dev/null openafs/src/volser/lockprocs_prototypes.h:1.1.2.2
*** /dev/null	Mon Apr 21 17:11:58 2008
--- openafs/src/volser/lockprocs_prototypes.h	Thu Apr 10 13:52:26 2008
***************
*** 0 ****
--- 1,18 ----
+ #ifndef	_LOCKPROCS_PROTOTYPES_H
+ #define _LOCKPROCS_PROTOTYPES_H
+ extern int FindIndex(struct nvldbentry *entry, afs_int32 server, afs_int32 part, afs_int32 type);
+ extern void SetAValue(struct nvldbentry *entry, afs_int32 oserver, afs_int32 opart,
+           afs_int32 nserver, afs_int32 npart, afs_int32 type);
+ extern void Lp_SetRWValue(struct nvldbentry *entry, afs_int32 oserver, afs_int32 opart, 
+               afs_int32 nserver, afs_int32 npart);
+ extern void Lp_SetROValue(struct nvldbentry *entry, afs_int32 oserver, 
+               afs_int32 opart, afs_int32 nserver, afs_int32 npart);
+ extern int Lp_Match(afs_int32 server, afs_int32 part, struct nvldbentry *entry);
+ extern int Lp_ROMatch(afs_int32 server, afs_int32 part, struct nvldbentry *entry);
+ extern int Lp_GetRwIndex(struct nvldbentry *entry);
+ extern void Lp_QInit(struct qHead *ahead);
+ extern void Lp_QAdd(struct qHead *ahead, struct aqueue *elem);
+ extern int Lp_QScan(struct qHead *ahead, afs_int32 id, int *success, struct aqueue **elem);
+ extern void Lp_QEnumerate(struct qHead *ahead, int *success, struct aqueue *elem);
+ extern void Lp_QTraverse(struct qHead *ahead);
+ #endif
\ No newline at end of file
Index: openafs/src/volser/volmain.c
diff -c openafs/src/volser/volmain.c:1.22.2.10 openafs/src/volser/volmain.c:1.22.2.11
*** openafs/src/volser/volmain.c:1.22.2.10	Mon Mar 10 18:32:36 2008
--- openafs/src/volser/volmain.c	Thu Mar 27 12:20:39 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.22.2.10 2008/03/10 22:32:36 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.22.2.11 2008/03/27 16:20:39 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
***************
*** 84,90 ****
  struct afsconf_dir *tdir;
  static afs_int32 runningCalls = 0;
  int DoLogging = 0;
! #define MAXLWP 16
  int lwps = 9;
  int udpBufSize = 0;		/* UDP buffer size for receive */
  
--- 84,90 ----
  struct afsconf_dir *tdir;
  static afs_int32 runningCalls = 0;
  int DoLogging = 0;
! #define MAXLWP 128
  int lwps = 9;
  int udpBufSize = 0;		/* UDP buffer size for receive */
  
Index: openafs/src/volser/volser_prototypes.h
diff -c openafs/src/volser/volser_prototypes.h:1.5.8.3 openafs/src/volser/volser_prototypes.h:1.5.8.4
*** openafs/src/volser/volser_prototypes.h:1.5.8.3	Wed Mar  5 16:53:31 2008
--- openafs/src/volser/volser_prototypes.h	Thu Apr 10 13:52:26 2008
***************
*** 40,45 ****
--- 40,48 ----
  extern int UV_MoveVolume(afs_int32 afromvol, afs_int32 afromserver,
  			 afs_int32 afrompart, afs_int32 atoserver,
  			 afs_int32 atopart);
+ extern int UV_MoveVolume2(afs_int32 afromvol, afs_int32 afromserver, 
+                           afs_int32 afrompart, afs_int32 atoserver, 
+                           afs_int32 atopart, int flags);
  extern int UV_BackupVolume(afs_int32 aserver, afs_int32 apart,
  			   afs_int32 avolid);
  extern int UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver,
***************
*** 49,56 ****
  			 afs_int32 afrompart, afs_int32 fromdate,
  			 afs_int32(*DumpFunction) (), char *rock, afs_int32 flags);
  extern int UV_RestoreVolume(afs_int32 toserver, afs_int32 topart,
! 			    afs_int32 tovolid, char tovolname[], int flags,
  			    afs_int32(*WriteData) (), char *rock);
  extern int UV_LockRelease(afs_int32 volid);
  extern int UV_AddSite(afs_int32 server, afs_int32 part, afs_int32 volid, afs_int32 valid);
  extern int UV_RemoveSite(afs_int32 server, afs_int32 part, afs_int32 volid);
--- 52,62 ----
  			 afs_int32 afrompart, afs_int32 fromdate,
  			 afs_int32(*DumpFunction) (), char *rock, afs_int32 flags);
  extern int UV_RestoreVolume(afs_int32 toserver, afs_int32 topart,
! 			    afs_int32 tovolid, char tovolname[], int restoreflags,
  			    afs_int32(*WriteData) (), char *rock);
+ extern int UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid,
+                             afs_int32 toparentid, char tovolname[], int flags,
+                             afs_int32(*WriteData) (), char *rock);
  extern int UV_LockRelease(afs_int32 volid);
  extern int UV_AddSite(afs_int32 server, afs_int32 part, afs_int32 volid, afs_int32 valid);
  extern int UV_RemoveSite(afs_int32 server, afs_int32 part, afs_int32 volid);
***************
*** 99,103 ****
--- 105,124 ----
  			    afs_int32 volid, volintInfo * infop);
  extern void MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new);
  extern void MapHostToNetwork(struct nvldbentry *entry);
+ extern int UV_CopyVolume2(afs_int32 afromvol, afs_int32 afromserver, 
+                           afs_int32 afrompart, char *atovolname, 
+                           afs_int32 atoserver, afs_int32 atopart,
+                           afs_int32 atovolid, int flags);
+ extern int UV_CloneVolume(afs_int32 aserver, afs_int32 apart, afs_int32 avolid,
+                           afs_int32 acloneid, char *aname, int flags);
+ extern int UV_DumpClonedVolume(afs_int32 afromvol, afs_int32 afromserver,
+                                afs_int32 afrompart, afs_int32 fromdate,
+                                afs_int32(*DumpFunction) (), char *rock, 
+                                afs_int32 flags);
+ extern int UV_GetSize(afs_int32 afromvol, afs_int32 afromserver, 
+                       afs_int32 afrompart, afs_int32 fromdate, 
+                       struct volintSize *vol_size);
  
+ extern int verbose;
+ extern int noresolve;
  #endif
Index: openafs/src/volser/vos.c
diff -c openafs/src/volser/vos.c:1.55.2.13 openafs/src/volser/vos.c:1.55.2.16
*** openafs/src/volser/vos.c:1.55.2.13	Wed Mar  5 16:53:31 2008
--- openafs/src/volser/vos.c	Mon Apr 14 16:25:52 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.55.2.13 2008/03/05 21:53:31 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.55.2.16 2008/04/14 20:25:52 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
***************
*** 58,68 ****
--- 58,75 ----
  #include <signal.h>
  #endif
  #include "volser_prototypes.h"
+ #include "vsutils_prototypes.h"
+ #include "lockprocs_prototypes.h"
  
  #ifdef HAVE_POSIX_REGEX
  #include <regex.h>
  #endif
  
+ /* Local Prototypes */
+ int PrintDiagnostics(char *astring, afs_int32 acode);
+ int GetVolumeInfo(afs_int32 volid, afs_int32 *server, afs_int32 *part, 
+                   afs_int32 *voltype, struct nvldbentry *rentry);
+ 
  struct tqElem {
      afs_int32 volid;
      struct tqElem *next;
***************
*** 79,88 ****
  cmd_AddParm(ts, "-localauth",CMD_FLAG,CMD_OPTIONAL,"use server tickets");\
  cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");\
  cmd_AddParm(ts, "-encrypt", CMD_FLAG, CMD_OPTIONAL, "encrypt commands");\
  
  #define ERROR_EXIT(code) {error=(code); goto error_exit;}
  
- extern int verbose;
  int rxInitDone = 0;
  struct rx_connection *tconn;
  afs_int32 tserver;
--- 86,95 ----
  cmd_AddParm(ts, "-localauth",CMD_FLAG,CMD_OPTIONAL,"use server tickets");\
  cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");\
  cmd_AddParm(ts, "-encrypt", CMD_FLAG, CMD_OPTIONAL, "encrypt commands");\
+ cmd_AddParm(ts, "-noresolve", CMD_FLAG, CMD_OPTIONAL, "don't resolve addresses"); \
  
  #define ERROR_EXIT(code) {error=(code); goto error_exit;}
  
  int rxInitDone = 0;
  struct rx_connection *tconn;
  afs_int32 tserver;
***************
*** 280,287 ****
--- 287,298 ----
  	FD_ZERO(&in);
  	FD_SET((int)(ufd->handle), &in);
  	/* don't timeout if read blocks */
+ #if defined(AFS_PTHREAD_ENV)
+ 	select(((int)(ufd->handle)) + 1, &in, 0, 0, 0);
+ #else
  	IOMGR_Select(((int)(ufd->handle)) + 1, &in, 0, 0, 0);
  #endif
+ #endif
  	error = USD_READ(ufd, buffer, blksize, &nbytes);
  	if (error) {
  	    fprintf(STDERR, "File system read failed\n");
***************
*** 338,344 ****
  	USD_SEEK(ufd, filesize, SEEK_END, &currOffset);
  	hset64(filesize, hgethi(currOffset), hgetlo(currOffset)-sizeof(afs_uint32));
  	USD_SEEK(ufd, filesize, SEEK_SET, &currOffset);
! 	USD_READ(ufd, &buffer, sizeof(afs_uint32), &got);
  	if ((got != sizeof(afs_uint32)) || (ntohl(buffer) != DUMPENDMAGIC)) {
  	    fprintf(STDERR, "Signature missing from end of file '%s'\n", filename);
  	    error = VOLSERBADOP;
--- 349,355 ----
  	USD_SEEK(ufd, filesize, SEEK_END, &currOffset);
  	hset64(filesize, hgethi(currOffset), hgetlo(currOffset)-sizeof(afs_uint32));
  	USD_SEEK(ufd, filesize, SEEK_SET, &currOffset);
! 	USD_READ(ufd, (char *)&buffer, sizeof(afs_uint32), &got);
  	if ((got != sizeof(afs_uint32)) || (ntohl(buffer) != DUMPENDMAGIC)) {
  	    fprintf(STDERR, "Signature missing from end of file '%s'\n", filename);
  	    error = VOLSERBADOP;
***************
*** 390,397 ****
--- 401,412 ----
  	    FD_ZERO(&out);
  	    FD_SET((int)(ufd->handle), &out);
  	    /* don't timeout if write blocks */
+ #if defined(AFS_PTHREAD_ENV)
+ 	    select(((int)(ufd->handle)) + 1, &out, 0, 0, 0);
+ #else
  	    IOMGR_Select(((int)(ufd->handle)) + 1, 0, &out, 0, 0);
  #endif
+ #endif
  	    error =
  		USD_WRITE(ufd, &buffer[bytesread - bytesleft], bytesleft, &w);
  	    if (error) {
***************
*** 1382,1389 ****
  }
  
  static void
! PostVolumeStats(entry)
!      struct nvldbentry *entry;
  {
      SubEnumerateEntry(entry);
      /* Check for VLOP_ALLOPERS */
--- 1397,1403 ----
  }
  
  static void
! PostVolumeStats(struct nvldbentry *entry)
  {
      SubEnumerateEntry(entry);
      /* Check for VLOP_ALLOPERS */
***************
*** 2373,2379 ****
      afs_int32 volid, fromserver, toserver, frompart, topart, tovolid;
      afs_int32 code, err, flags;
      char fromPartName[10], toPartName[10], toVolName[32], *tovolume;
-     struct nvldbentry entry;
      struct diskPartition64 partition;	/* for space check */
      volintInfo *p, *q;
  
--- 2387,2392 ----
***************
*** 4077,4085 ****
      return 0;
  }
  
! GetVolumeInfo(volid, server, part, voltype, rentry)
!      afs_int32 *server, volid, *part, *voltype;
!      register struct nvldbentry *rentry;
  {
      afs_int32 vcode;
      int i, index = -1;
--- 4090,4098 ----
      return 0;
  }
  
! int
! GetVolumeInfo(afs_int32 volid, afs_int32 *server, afs_int32 *part, afs_int32 *voltype, 
!               struct nvldbentry *rentry)
  {
      afs_int32 vcode;
      int i, index = -1;
***************
*** 4998,5004 ****
      struct partList dummyPartList;
      int i, cnt;
      int printSummary=0, sumPartitions=0;
!     afs_uint64 sumFree, sumStorage, tmp;
  
      ZeroInt64(sumFree);
      ZeroInt64(sumStorage);
--- 5011,5017 ----
      struct partList dummyPartList;
      int i, cnt;
      int printSummary=0, sumPartitions=0;
!     afs_uint64 sumFree, sumStorage;
  
      ZeroInt64(sumFree);
      ZeroInt64(sumStorage);
***************
*** 5134,5140 ****
  
  static void
  print_addrs(const bulkaddrs * addrs, const afsUUID * m_uuid, int nentries,
! 	    int print, int noresolve)
  {
      afs_int32 vcode;
      afs_int32 i, j;
--- 5147,5153 ----
  
  static void
  print_addrs(const bulkaddrs * addrs, const afsUUID * m_uuid, int nentries,
! 	    int print)
  {
      afs_int32 vcode;
      afs_int32 i, j;
***************
*** 5172,5178 ****
  		m_addrs.bulkaddrs_len = 0;
  		vcode =
  		    ubik_VL_GetAddrsU(cstruct, 0, &m_attrs, &m_uuid,
! 				      &vlcb, &m_nentries, &m_addrs);
  		if (vcode) {
  		    fprintf(STDERR,
  			    "vos: could not list the multi-homed server addresses\n");
--- 5185,5191 ----
  		m_addrs.bulkaddrs_len = 0;
  		vcode =
  		    ubik_VL_GetAddrsU(cstruct, 0, &m_attrs, &m_uuid,
! 				      (afs_int32 *)&vlcb, &m_nentries, &m_addrs);
  		if (vcode) {
  		    fprintf(STDERR,
  			    "vos: could not list the multi-homed server addresses\n");
***************
*** 5222,5228 ****
  ListAddrs(register struct cmd_syndesc *as, void *arock)
  {
      afs_int32 vcode;
!     afs_int32 i, noresolve = 0, printuuid = 0;
      struct VLCallBack vlcb;
      afs_int32 nentries;
      bulkaddrs m_addrs;
--- 5235,5241 ----
  ListAddrs(register struct cmd_syndesc *as, void *arock)
  {
      afs_int32 vcode;
!     afs_int32 i, printuuid = 0;
      struct VLCallBack vlcb;
      afs_int32 nentries;
      bulkaddrs m_addrs;
***************
*** 5260,5268 ****
  	m_attrs.ipaddr = ntohl(saddr);
      }
      if (as->parms[2].items) {
- 	noresolve = 1;
-     }
-     if (as->parms[3].items) {
  	printuuid = 1;
      }
  
--- 5273,5278 ----
***************
*** 5315,5321 ****
  	    return (vcode);
  	}
  
! 	print_addrs(&m_addrs, &m_uuid, m_nentries, printuuid, noresolve);
  	i++;
  
  	if ((as->parms[1].items) || (as->parms[0].items) || (i > nentries))
--- 5325,5331 ----
  	    return (vcode);
  	}
  
! 	print_addrs(&m_addrs, &m_uuid, m_nentries, printuuid);
  	i++;
  
  	if ((as->parms[1].items) || (as->parms[0].items) || (i > nentries))
***************
*** 5599,5607 ****
      return 0;
  }
  
! PrintDiagnostics(astring, acode)
!      char *astring;
!      afs_int32 acode;
  {
      if (acode == EACCES) {
  	fprintf(STDERR,
--- 5609,5616 ----
      return 0;
  }
  
! int
! PrintDiagnostics(char *astring, afs_int32 acode)
  {
      if (acode == EACCES) {
  	fprintf(STDERR,
***************
*** 5646,5651 ****
--- 5655,5664 ----
  	verbose = 1;
      else
  	verbose = 0;
+     if (as->parms[17].items)	/* -noresolve flag set */
+ 	noresolve = 1;
+     else
+ 	noresolve = 0;
      return 0;
  }
  
***************
*** 6003,6010 ****
  			  "list the IP address of all file servers registered in the VLDB");
      cmd_AddParm(ts, "-uuid", CMD_SINGLE, CMD_OPTIONAL, "uuid of server");
      cmd_AddParm(ts, "-host", CMD_SINGLE, CMD_OPTIONAL, "address of host");
-     cmd_AddParm(ts, "-noresolve", CMD_FLAG, CMD_OPTIONAL,
- 		"don't resolve addresses");
      cmd_AddParm(ts, "-printuuid", CMD_FLAG, CMD_OPTIONAL,
  		"print uuid of hosts");
      COMMONPARMS;
--- 6016,6021 ----
Index: openafs/src/volser/vsprocs.c
diff -c openafs/src/volser/vsprocs.c:1.38.2.14 openafs/src/volser/vsprocs.c:1.38.2.17
*** openafs/src/volser/vsprocs.c:1.38.2.14	Wed Mar  5 16:53:31 2008
--- openafs/src/volser/vsprocs.c	Mon Apr 14 16:25:52 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.38.2.14 2008/03/05 21:53:31 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.38.2.17 2008/04/14 20:25:52 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 55,64 ****
  #include <afs/procmgmt.h>	/* signal(), kill(), wait(), etc. */
  #include <setjmp.h>
  
! #include <volser_prototypes.h>
  
  struct ubik_client *cstruct;
! int verbose = 0;
  
  struct release {
      afs_int32 crtime;
--- 55,66 ----
  #include <afs/procmgmt.h>	/* signal(), kill(), wait(), etc. */
  #include <setjmp.h>
  
! #include "volser_prototypes.h"
! #include "vsutils_prototypes.h"
! #include "lockprocs_prototypes.h"
  
  struct ubik_client *cstruct;
! int verbose = 0, noresolve = 0;
  
  struct release {
      afs_int32 crtime;
***************
*** 502,507 ****
--- 504,510 ----
      int i;
      char pname[10];
      int isMixed = 0;
+     char hoststr[16];
  
  #ifdef notdef
      fprintf(STDOUT, "	readWriteID %-10u ", entry->volumeId[RWVOL]);
***************
*** 541,547 ****
      for (i = 0; i < entry->nServers; i++) {
  	MapPartIdIntoName(entry->serverPartition[i], pname);
  	fprintf(STDOUT, "       server %s partition %s ",
! 		hostutil_GetNameByINet(entry->serverNumber[i]), pname);
  	if (entry->serverFlags[i] & ITSRWVOL)
  	    fprintf(STDOUT, "RW Site ");
  	else
--- 544,551 ----
      for (i = 0; i < entry->nServers; i++) {
  	MapPartIdIntoName(entry->serverPartition[i], pname);
  	fprintf(STDOUT, "       server %s partition %s ",
! 		noresolve ? afs_inet_ntoa_r(entry->serverNumber[i], hoststr) : 
!                 hostutil_GetNameByINet(entry->serverNumber[i]), pname);
  	if (entry->serverFlags[i] & ITSRWVOL)
  	    fprintf(STDOUT, "RW Site ");
  	else
***************
*** 1072,1077 ****
--- 1076,1082 ----
      afs_int32 error;
      char in, lf;		/* for test code */
      int same;
+     char hoststr[16];
  
  #ifdef	ENABLE_BUGFIX_1165
      volEntries volumeInfo;
***************
*** 1148,1154 ****
  		    char pname[10];
  		    MapPartIdIntoName(entry.serverPartition[i], pname);
  		    fprintf(STDERR, " server %s partition %s \n",
! 			    hostutil_GetNameByINet(entry.serverNumber[i]),
  			    pname);
  		}
  	    }
--- 1153,1160 ----
  		    char pname[10];
  		    MapPartIdIntoName(entry.serverPartition[i], pname);
  		    fprintf(STDERR, " server %s partition %s \n",
! 			    noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) :
!                             hostutil_GetNameByINet(entry.serverNumber[i]),
  			    pname);
  		}
  	    }
***************
*** 3027,3032 ****
--- 3033,3039 ----
      afs_int32 volid;
      struct volser_status tstatus;
      int code, rcode, tcode;
+     char hoststr[16];
  
      *connPtr = (struct rx_connection *)0;
      *transPtr = 0;
***************
*** 3048,3053 ****
--- 3055,3061 ----
      /* If the volume does not exist, create it */
      if (!volid || code) {
  	char volname[64];
+         char hoststr[16];
  
  	if (volid && (code != VNOVOL)) {
  	    PrintError("Failed to start a transaction on the RO volume.\n",
***************
*** 3062,3068 ****
  	    fprintf(STDOUT,
  		    "Creating new volume %lu on replication site %s: ",
  		    (unsigned long)volid,
! 		    hostutil_GetNameByINet(vldbEntryPtr->
  					   serverNumber[index]));
  	    fflush(STDOUT);
  	}
--- 3070,3078 ----
  	    fprintf(STDOUT,
  		    "Creating new volume %lu on replication site %s: ",
  		    (unsigned long)volid,
!                     noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
!                                                 serverNumber[index], hoststr) :
!                     hostutil_GetNameByINet(vldbEntryPtr->
  					   serverNumber[index]));
  	    fflush(STDOUT);
  	}
***************
*** 3095,3101 ****
       */
      else {
  	VPRINT2("Updating existing ro volume %u on %s ...\n", volid,
! 		hostutil_GetNameByINet(vldbEntryPtr->serverNumber[index]));
  
  	code = AFSVolGetStatus(*connPtr, *transPtr, &tstatus);
  	if (code) {
--- 3105,3113 ----
       */
      else {
  	VPRINT2("Updating existing ro volume %u on %s ...\n", volid,
!                 noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
!                                             serverNumber[index], hoststr) : 
!                 hostutil_GetNameByINet(vldbEntryPtr->serverNumber[index]));
  
  	code = AFSVolGetStatus(*connPtr, *transPtr, &tstatus);
  	if (code) {
***************
*** 3186,3191 ****
--- 3198,3204 ----
      } remembertime[NMAXNSERVERS];
      int releasecount = 0;
      struct volser_status volstatus;
+     char hoststr[16];
  
      memset((char *)remembertime, 0, sizeof(remembertime));
      memset((char *)&results, 0, sizeof(results));
***************
*** 3589,3601 ****
  	if (verbose) {
  	    fprintf(STDOUT, "Starting ForwardMulti from %lu to %u on %s",
  		    (unsigned long)cloneVolId, entry.volumeId[ROVOL],
! 		    hostutil_GetNameByINet(entry.
  					   serverNumber[times[0].
  							vldbEntryIndex]));
  
  	    for (s = 1; s < volcount; s++) {
  		fprintf(STDOUT, " and %s",
! 			hostutil_GetNameByINet(entry.
  					       serverNumber[times[s].
  							    vldbEntryIndex]));
  	    }
--- 3602,3618 ----
  	if (verbose) {
  	    fprintf(STDOUT, "Starting ForwardMulti from %lu to %u on %s",
  		    (unsigned long)cloneVolId, entry.volumeId[ROVOL],
!                     noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[0].
!                                                 vldbEntryIndex], hoststr) :
!                     hostutil_GetNameByINet(entry.
  					   serverNumber[times[0].
  							vldbEntryIndex]));
  
  	    for (s = 1; s < volcount; s++) {
  		fprintf(STDOUT, " and %s",
!                         noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[s].
!                                                     vldbEntryIndex], hoststr) :
!                         hostutil_GetNameByINet(entry.
  					       serverNumber[times[s].
  							    vldbEntryIndex]));
  	    }
***************
*** 3724,3730 ****
  	    if (!(entry.serverFlags[i] & NEW_REPSITE)) {
  		MapPartIdIntoName(entry.serverPartition[i], pname);
  		fprintf(STDERR, "\t%35s %s\n",
! 			hostutil_GetNameByINet(entry.serverNumber[i]), pname);
  	    }
  	}
  
--- 3741,3748 ----
  	    if (!(entry.serverFlags[i] & NEW_REPSITE)) {
  		MapPartIdIntoName(entry.serverPartition[i], pname);
  		fprintf(STDERR, "\t%35s %s\n",
!                         noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) :
!                         hostutil_GetNameByINet(entry.serverNumber[i]), pname);
  	    }
  	}
  
***************
*** 3795,3803 ****
  		fprintf(STDERR,
  			"Failed to end transaction on ro volume %u at server %s\n",
  			entry.volumeId[ROVOL],
! 			hostutil_GetNameByINet(htonl
! 					       (replicas[i].server.
! 						destHost)));
  		if (!error)
  		    error = code;
  	    }
--- 3813,3822 ----
  		fprintf(STDERR,
  			"Failed to end transaction on ro volume %u at server %s\n",
  			entry.volumeId[ROVOL],
!                         noresolve ? afs_inet_ntoa_r(htonl(replicas[i].server.
!                                                         destHost), hoststr) :
!                         hostutil_GetNameByINet(htonl
! 					       (replicas[i].server.destHost)));
  		if (!error)
  		    error = code;
  	    }
***************
*** 4104,4110 ****
      afs_int32 oldCreateDate, oldUpdateDate, newCreateDate, newUpdateDate;
      int index, same, errcode;
      char apartName[10];
! 
  
      memset(&cookie, 0, sizeof(cookie));
      islocked = 0;
--- 4123,4129 ----
      afs_int32 oldCreateDate, oldUpdateDate, newCreateDate, newUpdateDate;
      int index, same, errcode;
      char apartName[10];
!     char hoststr[16];
  
      memset(&cookie, 0, sizeof(cookie));
      islocked = 0;
***************
*** 4181,4186 ****
--- 4200,4206 ----
      MapPartIdIntoName(topart, partName);
      fprintf(STDOUT, "Restoring volume %s Id %lu on server %s partition %s ..",
  	    tovolreal, (unsigned long)pvolid,
+             noresolve ? afs_inet_ntoa_r(toserver, hoststr) :
  	    hostutil_GetNameByINet(toserver), partName);
      fflush(STDOUT);
      code =
***************
*** 4432,4437 ****
--- 4452,4458 ----
  			VPRINT2
  			    ("Not deleting the previous volume %u on server %s, ...",
  			     pvolid,
+                              noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) :
  			     hostutil_GetNameByINet(entry.serverNumber[index]));
  		    } else {
  			tempconn =
***************
*** 4443,4448 ****
--- 4464,4470 ----
  			VPRINT3
  			    ("Deleting the previous volume %u on server %s, partition %s ...",
  			     pvolid,
+                              noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) :
  			     hostutil_GetNameByINet(entry.serverNumber[index]),
  			     apartName);
  			code =
***************
*** 5286,5291 ****
--- 5308,5314 ----
      char pname[10];
      int pass = 0, islocked = 0, createentry, addvolume, modified, mod, doit = 1;
      afs_int32 rwvolid;
+     char hoststr[16]; 
  
      if (modentry) {
  	if (*modentry == 1)
***************
*** 5374,5385 ****
--- 5397,5412 ----
  			    fprintf(STDERR,
  				    "*** Warning: Orphaned RW volume %lu exists on %s %s\n",
  				    (unsigned long)rwvolid,
+                                     noresolve ?
+                                     afs_inet_ntoa_r(aserver, hoststr) :
  				    hostutil_GetNameByINet(aserver), pname);
  			    MapPartIdIntoName(entry.serverPartition[idx],
  					      pname);
  			    fprintf(STDERR,
  				    "    VLDB reports RW volume %lu exists on %s %s\n",
  				    (unsigned long)rwvolid,
+                                     noresolve ? 
+                                     afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
  				    hostutil_GetNameByINet(entry.
  							   serverNumber[idx]),
  				    pname);
***************
*** 5396,5401 ****
--- 5423,5430 ----
  				fprintf(STDERR,
  					"*** Warning: Orphaned BK volume %u exists on %s %s\n",
  					entry.volumeId[BACKVOL],
+                                         noresolve ?
+                                         afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
  					hostutil_GetNameByINet(entry.
  							       serverNumber
  							       [idx]), pname);
***************
*** 5403,5408 ****
--- 5432,5439 ----
  				fprintf(STDERR,
  					"    VLDB reports its RW volume %lu exists on %s %s\n",
  					(unsigned long)rwvolid,
+                                         noresolve ? 
+                                         afs_inet_ntoa_r(aserver, hoststr) :
  					hostutil_GetNameByINet(aserver),
  					pname);
  			    }
***************
*** 5473,5483 ****
--- 5504,5518 ----
  			fprintf(STDERR,
  				"*** Warning: Orphaned BK volume %lu exists on %s %s\n",
  				(unsigned long)volumeinfo->volid,
+                                 noresolve ?
+                                 afs_inet_ntoa_r(aserver, hoststr) :
  				hostutil_GetNameByINet(aserver), pname);
  			MapPartIdIntoName(entry.serverPartition[idx], pname);
  			fprintf(STDERR,
  				"    VLDB reports its RW/BK volume %lu exists on %s %s\n",
  				(unsigned long)rwvolid,
+                                 noresolve ?
+                                 afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
  				hostutil_GetNameByINet(entry.
  						       serverNumber[idx]),
  				pname);
***************
*** 5496,5501 ****
--- 5531,5538 ----
  				fprintf(STDERR,
  					"*** Warning: Orphaned BK volume %u exists on %s %s\n",
  					entry.volumeId[BACKVOL],
+                                         noresolve ?
+                                         afs_inet_ntoa_r(aserver, hoststr) :
  					hostutil_GetNameByINet(aserver),
  					pname);
  				fprintf(STDERR,
***************
*** 5508,5515 ****
  						  pname);
  				fprintf(STDERR,
  					"*** Warning: Orphaned BK volume %lu exists on %s %s\n",
! 					(unsigned long)volumeinfo->volid,
! 					hostutil_GetNameByINet(aserver),
  					pname);
  				fprintf(STDERR,
  					"    VLDB reports its BK volume ID is %u\n",
--- 5545,5554 ----
  						  pname);
  				fprintf(STDERR,
  					"*** Warning: Orphaned BK volume %lu exists on %s %s\n",
!                                         (unsigned long)volumeinfo->volid,
!                                         noresolve ?
!                                         afs_inet_ntoa_r(aserver, hoststr) :
!                                         hostutil_GetNameByINet(aserver),
  					pname);
  				fprintf(STDERR,
  					"    VLDB reports its BK volume ID is %u\n",
***************
*** 5579,5585 ****
  			    fprintf(STDERR,
  				    "*** Warning: Orphaned RO volume %u exists on %s %s\n",
  				    entry.volumeId[ROVOL],
! 				    hostutil_GetNameByINet(entry.
  							   serverNumber[j]),
  				    pname);
  			    fprintf(STDERR,
--- 5618,5626 ----
  			    fprintf(STDERR,
  				    "*** Warning: Orphaned RO volume %u exists on %s %s\n",
  				    entry.volumeId[ROVOL],
!                                     noresolve ?
!                                     afs_inet_ntoa_r(entry.serverNumber[j], hoststr) :
!                                     hostutil_GetNameByINet(entry.
  							   serverNumber[j]),
  				    pname);
  			    fprintf(STDERR,
***************
*** 5606,5613 ****
  		    MapPartIdIntoName(apart, pname);
  		    fprintf(STDERR,
  			    "*** Warning: Orphaned RO volume %lu exists on %s %s\n",
! 			    (unsigned long)volumeinfo->volid,
! 			    hostutil_GetNameByINet(aserver), pname);
  		    fprintf(STDERR,
  			    "    VLDB reports its RO volume ID is %u\n",
  			    entry.volumeId[ROVOL]);
--- 5647,5656 ----
  		    MapPartIdIntoName(apart, pname);
  		    fprintf(STDERR,
  			    "*** Warning: Orphaned RO volume %lu exists on %s %s\n",
!                             (unsigned long)volumeinfo->volid,
!                             noresolve ?
!                             afs_inet_ntoa_r(aserver, hoststr) :
!                             hostutil_GetNameByINet(aserver), pname);
  		    fprintf(STDERR,
  			    "    VLDB reports its RO volume ID is %u\n",
  			    entry.volumeId[ROVOL]);
***************
*** 5986,5991 ****
--- 6029,6035 ----
      afs_int32 failures = 0, modifications = 0, tentries = 0;
      afs_int32 modified;
      afs_uint32 maxvolid = 0;
+     char hoststr[16];
  
      volumeInfo.volEntries_val = (volintInfo *) 0;
      volumeInfo.volEntries_len = 0;
***************
*** 6037,6043 ****
  		fprintf(STDOUT,
  			"Processing volume entry %d: %s (%lu) on server %s %s...\n",
  			j + 1, vi->name, (unsigned long)vi->volid,
! 			hostutil_GetNameByINet(aserver), pname);
  		fflush(STDOUT);
  	    }
  
--- 6081,6089 ----
  		fprintf(STDOUT,
  			"Processing volume entry %d: %s (%lu) on server %s %s...\n",
  			j + 1, vi->name, (unsigned long)vi->volid,
!                         noresolve ?
!                         afs_inet_ntoa_r(aserver, hoststr) :
!                         hostutil_GetNameByINet(aserver), pname);
  		fflush(STDOUT);
  	    }
  
***************
*** 6066,6072 ****
  	if (pfail) {
  	    fprintf(STDERR,
  		    "Could not process entries on server %s partition %s\n",
! 		    hostutil_GetNameByINet(aserver), pname);
  	}
  	if (volumeInfo.volEntries_val) {
  	    free(volumeInfo.volEntries_val);
--- 6112,6120 ----
  	if (pfail) {
  	    fprintf(STDERR,
  		    "Could not process entries on server %s partition %s\n",
!                     noresolve ?
!                     afs_inet_ntoa_r(aserver, hoststr) :
!                     hostutil_GetNameByINet(aserver), pname);
  	}
  	if (volumeInfo.volEntries_val) {
  	    free(volumeInfo.volEntries_val);
***************
*** 6152,6157 ****
--- 6200,6206 ----
      int idx;
      afs_int32 code, error = 0;
      char pname[10];
+     char hoststr[16];
  
      if (modified)
  	*modified = 0;
***************
*** 6186,6192 ****
  		fprintf(STDERR,
  			"Transaction call failed for RW volume %u on server %s %s\n",
  			entry->volumeId[RWVOL],
! 			hostutil_GetNameByINet(entry->serverNumber[idx]),
  			pname);
  		ERROR_EXIT(code);
  	    }
--- 6235,6243 ----
  		fprintf(STDERR,
  			"Transaction call failed for RW volume %u on server %s %s\n",
  			entry->volumeId[RWVOL],
!                         noresolve ?
!                         afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
!                         hostutil_GetNameByINet(entry->serverNumber[idx]),
  			pname);
  		ERROR_EXIT(code);
  	    }
***************
*** 6223,6229 ****
  		fprintf(STDERR,
  			"Transaction call failed for BK volume %u on server %s %s\n",
  			entry->volumeId[BACKVOL],
! 			hostutil_GetNameByINet(entry->serverNumber[idx]),
  			pname);
  		ERROR_EXIT(code);
  	    }
--- 6274,6282 ----
  		fprintf(STDERR,
  			"Transaction call failed for BK volume %u on server %s %s\n",
  			entry->volumeId[BACKVOL],
!                         noresolve ?
!                         afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
!                         hostutil_GetNameByINet(entry->serverNumber[idx]),
  			pname);
  		ERROR_EXIT(code);
  	    }
***************
*** 6254,6259 ****
--- 6307,6313 ----
      int foundro = 0, modentry = 0;
      afs_int32 code, error = 0;
      char pname[10];
+     char hoststr[16];
  
      if (modified)
  	*modified = 0;
***************
*** 6282,6288 ****
  	    fprintf(STDERR,
  		    "Transaction call failed for RO %u on server %s %s\n",
  		    entry->volumeId[ROVOL],
! 		    hostutil_GetNameByINet(entry->serverNumber[idx]), pname);
  	    ERROR_EXIT(code);
  	}
      }
--- 6336,6344 ----
  	    fprintf(STDERR,
  		    "Transaction call failed for RO %u on server %s %s\n",
  		    entry->volumeId[ROVOL],
!                     noresolve ?
!                     afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
!                     hostutil_GetNameByINet(entry->serverNumber[idx]), pname);
  	    ERROR_EXIT(code);
  	}
      }
***************
*** 6566,6571 ****
--- 6622,6628 ----
      afs_int32 tid;
      struct rx_connection *aconn;
      int islocked;
+     char hoststr[16];
  
      error = 0;
      aconn = (struct rx_connection *)0;
***************
*** 6730,6736 ****
  		    if (!code) {
  			VPRINT2("Renamed RO volume %s on host %s\n",
  				nameBuffer,
! 				hostutil_GetNameByINet(entry->
  						       serverNumber[i]));
  			code = AFSVolEndTrans(aconn, tid, &rcode);
  			tid = 0;
--- 6787,6795 ----
  		    if (!code) {
  			VPRINT2("Renamed RO volume %s on host %s\n",
  				nameBuffer,
!                                 noresolve ?
!                                 afs_inet_ntoa_r(entry->serverNumber[i], hoststr) :
!                                 hostutil_GetNameByINet(entry->
  						       serverNumber[i]));
  			code = AFSVolEndTrans(aconn, tid, &rcode);
  			tid = 0;
Index: openafs/src/volser/vsutils.c
diff -c openafs/src/volser/vsutils.c:1.18.8.3 openafs/src/volser/vsutils.c:1.18.8.5
*** openafs/src/volser/vsutils.c:1.18.8.3	Tue Oct 30 11:16:59 2007
--- openafs/src/volser/vsutils.c	Mon Apr 14 16:25:52 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsutils.c,v 1.18.8.3 2007/10/30 15:16:59 shadow Exp $");
  
  #include <afs/stds.h>
  #include <string.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsutils.c,v 1.18.8.5 2008/04/14 20:25:52 shadow Exp $");
  
  #include <afs/stds.h>
  #include <string.h>
***************
*** 46,58 ****
  #include "volint.h"
  #include "lockdata.h"
  
  struct ubik_client *cstruct;
  static rxkad_level vsu_rxkad_level = rxkad_clear;
  
  static void
! ovlentry_to_nvlentry(oentryp, nentryp)
!      struct vldbentry *oentryp;
!      struct nvldbentry *nentryp;
  {
      register int i;
  
--- 46,59 ----
  #include "volint.h"
  #include "lockdata.h"
  
+ #include "vsutils_prototypes.h"
+ 
  struct ubik_client *cstruct;
  static rxkad_level vsu_rxkad_level = rxkad_clear;
  
  static void
! ovlentry_to_nvlentry(struct vldbentry *oentryp,
!                      struct nvldbentry *nentryp)
  {
      register int i;
  
***************
*** 70,79 ****
      nentryp->flags = oentryp->flags;
  }
  
! static
! nvlentry_to_ovlentry(nentryp, oentryp)
!      struct nvldbentry *nentryp;
!      struct vldbentry *oentryp;
  {
      register int i;
  
--- 71,79 ----
      nentryp->flags = oentryp->flags;
  }
  
! static int
! nvlentry_to_ovlentry(struct nvldbentry *nentryp,
!                      struct vldbentry *oentryp)
  {
      register int i;
  
***************
*** 101,108 ****
  
  static int newvlserver = 0;
  
! VLDB_CreateEntry(entryp)
!      struct nvldbentry *entryp;
  {
      struct vldbentry oentry;
      register int code;
--- 101,108 ----
  
  static int newvlserver = 0;
  
! int
! VLDB_CreateEntry(struct nvldbentry *entryp)
  {
      struct vldbentry oentry;
      register int code;
***************
*** 127,135 ****
      return code;
  }
  
! VLDB_GetEntryByID(volid, voltype, entryp)
!      afs_int32 volid, voltype;
!      struct nvldbentry *entryp;
  {
      struct vldbentry oentry;
      register int code;
--- 127,134 ----
      return code;
  }
  
! int
! VLDB_GetEntryByID(afs_int32 volid, afs_int32 voltype, struct nvldbentry *entryp)
  {
      struct vldbentry oentry;
      register int code;
***************
*** 154,162 ****
      return code;
  }
  
! VLDB_GetEntryByName(namep, entryp)
!      char *namep;
!      struct nvldbentry *entryp;
  {
      struct vldbentry oentry;
      register int code;
--- 153,160 ----
      return code;
  }
  
! int
! VLDB_GetEntryByName(char *namep, struct nvldbentry *entryp)
  {
      struct vldbentry oentry;
      register int code;
***************
*** 180,188 ****
      return code;
  }
  
! VLDB_ReplaceEntry(volid, voltype, entryp, releasetype)
!      afs_int32 volid, voltype, releasetype;
!      struct nvldbentry *entryp;
  {
      struct vldbentry oentry;
      register int code;
--- 178,185 ----
      return code;
  }
  
! int 
! VLDB_ReplaceEntry(afs_int32 volid, afs_int32 voltype, struct nvldbentry *entryp, afs_int32 releasetype)
  {
      struct vldbentry oentry;
      register int code;
***************
*** 212,222 ****
  }
  
  
! 
! VLDB_ListAttributes(attrp, entriesp, blkentriesp)
!      VldbListByAttributes *attrp;
!      afs_int32 *entriesp;
!      nbulkentries *blkentriesp;
  {
      bulkentries arrayEntries;
      register int code, i;
--- 209,218 ----
  }
  
  
! int
! VLDB_ListAttributes(VldbListByAttributes *attrp,
!                     afs_int32 *entriesp,
!                     nbulkentries *blkentriesp)
  {
      bulkentries arrayEntries;
      register int code, i;
***************
*** 253,266 ****
      return code;
  }
  
! VLDB_ListAttributesN2(attrp, name, thisindex, nentriesp, blkentriesp,
! 		      nextindexp)
!      VldbListByAttributes *attrp;
!      char *name;
!      afs_int32 thisindex;
!      afs_int32 *nentriesp;
!      nbulkentries *blkentriesp;
!      afs_int32 *nextindexp;
  {
      afs_int32 code;
  
--- 249,261 ----
      return code;
  }
  
! int
! VLDB_ListAttributesN2(VldbListByAttributes *attrp,
!                       char *name,
!                       afs_int32 thisindex,
!                       afs_int32 *nentriesp,
!                       nbulkentries *blkentriesp,
!                       afs_int32 *nextindexp)
  {
      afs_int32 code;
  
***************
*** 286,293 ****
  struct cacheips cacheips[GETADDRUCACHESIZE];
  int cacheip_index = 0;
  
! VLDB_IsSameAddrs(serv1, serv2, errorp)
!      afs_int32 serv1, serv2, *errorp;
  {
      register int code;
      ListAddrByAttributes attrs;
--- 281,288 ----
  struct cacheips cacheips[GETADDRUCACHESIZE];
  int cacheip_index = 0;
  
! int
! VLDB_IsSameAddrs(afs_int32 serv1, afs_int32 serv2, afs_int32 *errorp)
  {
      register int code;
      ListAddrByAttributes attrs;
***************
*** 376,383 ****
    to get a rxkad_clear connection, simply don't call this.
  */
  void
! vsu_SetCrypt(cryptflag)
!      int cryptflag;
  {
      if (cryptflag) {
  	vsu_rxkad_level = rxkad_crypt;
--- 371,377 ----
    to get a rxkad_clear connection, simply don't call this.
  */
  void
! vsu_SetCrypt(int cryptflag)
  {
      if (cryptflag) {
  	vsu_rxkad_level = rxkad_crypt;
***************
*** 391,403 ****
    Get the appropriate type of ubik client structure out from the system.
  */
  afs_int32
! vsu_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp, secproc)
!      int noAuthFlag;
!      int (*secproc) ();
!      char *cellName;
!      struct ubik_client **uclientp;
!      char *confDir;
!      afs_int32 sauth;
  {
      return ugen_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp, 
  			   secproc, "vsu_ClientInit", vsu_rxkad_level,
--- 385,392 ----
    Get the appropriate type of ubik client structure out from the system.
  */
  afs_int32
! vsu_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth,
!                struct ubik_client **uclientp, int (*secproc)())
  {
      return ugen_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp, 
  			   secproc, "vsu_ClientInit", vsu_rxkad_level,
***************
*** 410,417 ****
   * and return the result as <rname>.
   */
  int
! vsu_ExtractName(rname, name)
!      char rname[], name[];
  {
      char sname[VOLSER_OLDMAXVOLNAME + 1];
      int total;
--- 399,405 ----
   * and return the result as <rname>.
   */
  int
! vsu_ExtractName(char rname[], char name[])
  {
      char sname[VOLSER_OLDMAXVOLNAME + 1];
      int total;
***************
*** 439,450 ****
  
  /* returns 0 if failed */
  afs_uint32
! vsu_GetVolumeID(astring, acstruct, errp)
!      struct ubik_client *acstruct;
!      afs_int32 *errp;
!      char *astring;
  {
-     afs_uint32 value;
      char volname[VOLSER_OLDMAXVOLNAME + 1];
      struct nvldbentry entry;
      afs_int32 vcode = 0;
--- 427,434 ----
  
  /* returns 0 if failed */
  afs_uint32
! vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp)
  {
      char volname[VOLSER_OLDMAXVOLNAME + 1];
      struct nvldbentry entry;
      afs_int32 vcode = 0;
Index: openafs/src/volser/vsutils_prototypes.h
diff -c /dev/null openafs/src/volser/vsutils_prototypes.h:1.1.2.2
*** /dev/null	Mon Apr 21 17:11:58 2008
--- openafs/src/volser/vsutils_prototypes.h	Thu Apr 10 13:52:27 2008
***************
*** 0 ****
--- 1,17 ----
+ #ifndef	_VSUTILS_PROTOTYPES_H
+ #define _VSUTILS_PROTOTYPES_H
+ /* vsutils.c */
+ extern int VLDB_CreateEntry(struct nvldbentry *entryp);
+ extern int VLDB_GetEntryByID(afs_int32 volid, afs_int32 voltype, struct nvldbentry *entryp);
+ extern int VLDB_GetEntryByName(char *namep, struct nvldbentry *entryp);
+ extern int VLDB_ReplaceEntry(afs_int32 volid, afs_int32 voltype, struct nvldbentry *entryp, afs_int32 releasetype);
+ extern int VLDB_ListAttributes(VldbListByAttributes *attrp, afs_int32 *entriesp, nbulkentries *blkentriesp);
+ extern int VLDB_ListAttributesN2(VldbListByAttributes *attrp, char *name, afs_int32 thisindex,
+            afs_int32 *nentriesp, nbulkentries *blkentriesp, afs_int32 *nextindexp);
+ extern int VLDB_IsSameAddrs(afs_int32 serv1, afs_int32 serv2, afs_int32 *errorp);
+ extern void vsu_SetCrypt(int cryptflag);
+ extern afs_int32 vsu_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth,
+                struct ubik_client **uclientp, int (*secproc)());
+ extern int vsu_ExtractName(char rname[], char name[]);
+ extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp);
+ #endif
