Index: openafs/src/NTMakefile
diff -c openafs/src/NTMakefile:1.27.2.14 openafs/src/NTMakefile:1.27.2.15
*** openafs/src/NTMakefile:1.27.2.14	Thu Apr  2 03:41:50 2009
--- openafs/src/NTMakefile	Mon May 25 20:54:25 2009
***************
*** 29,34 ****
--- 29,40 ----
  DESTDIR=$(AFSROOT)\dest\$(SYS_NAME)
  !ENDIF
  
+ !IFNDEF NOCYGWIN
+ WIXCYGOPT=-dCygwinArchives
+ !ELSE
+ WIXCYGOPT=
+ !ENDIF
+ 
  CD = cd
  MKDIR = mkdir
  
***************
*** 37,43 ****
  NTMAKE_HEADERS = nmake /nologo  /f ntmakefile install_headers
  NTMAKE_OBJS = nmake /nologo /f ntmakefile install_objs
  
! #debug statement support jumping to last know error
  DOCD=$(SRC)\DOLASTCMP.BAT
  
  config:
--- 43,49 ----
  NTMAKE_HEADERS = nmake /nologo  /f ntmakefile install_headers
  NTMAKE_OBJS = nmake /nologo /f ntmakefile install_objs
  
! #debug statement support jumping to last known error
  DOCD=$(SRC)\DOLASTCMP.BAT
  
  config:
***************
*** 660,669 ****
     $(NTMAKE)
     $(CD) ..\..
  
! NSIS.i386: loopback man-pages
     @echo ***** Making NSIS Installer
!    $(DOCD) $(SRC)\WINNT\install\NSIS
!    $(CD) $(SRC)\WINNT\install\NSIS
     $(NTMAKE)
     $(CD) ..\..\..\..
  
--- 666,689 ----
     $(NTMAKE)
     $(CD) ..\..
  
! documentation:
!    @echo ***** $@
!    $(DOCD) $(DOC)\xml\ReleaseNotesWindows
!    $(CD) $(DOC)\xml\ReleaseNotesWindows
!    $(NTMAKE)
!    $(DOCD) ..\UserGuide
!    $(CD) ..\UserGuide
!    $(NTMAKE)
!    $(DOCD) ..\AdminGuide
!    $(CD) ..\AdminGuide
!    $(NTMAKE)
!    $(DOCD) ..\..\..
!    $(CD) ..\..\..
! 
! NSIS.i386: loopback man-pages documentation
     @echo ***** Making NSIS Installer
!    $(DOCD) $(SRC)\WINNT\install\$@
!    $(CD) $(SRC)\WINNT\install\$@
     $(NTMAKE)
     $(CD) ..\..\..\..
  
***************
*** 672,688 ****
  
  NSIS: NSIS.$(CPU)
  
! wix: loopback man-pages
     @echo ***** Making Wix MSI Installer
     $(DOCD) $(SRC)\WINNT\install\$@
     $(CD) $(SRC)\WINNT\install\$@
     $(NTMAKE)
     $(CD) ..\..\..\..
  
! media: install man-pages NSIS wix
  
! install-nsis: install man-pages NSIS
  
! install-wix: install man-pages wix
  
  
--- 692,708 ----
  
  NSIS: NSIS.$(CPU)
  
! wix: loopback man-pages documentation
     @echo ***** Making Wix MSI Installer
     $(DOCD) $(SRC)\WINNT\install\$@
     $(CD) $(SRC)\WINNT\install\$@
     $(NTMAKE)
     $(CD) ..\..\..\..
  
! media: install NSIS wix
  
! install-nsis: install NSIS
  
! install-wix: install wix
  
  
Index: openafs/src/JAVA/libjafs/ACL.c
diff -c openafs/src/JAVA/libjafs/ACL.c:1.4 openafs/src/JAVA/libjafs/ACL.c:1.4.4.1
*** openafs/src/JAVA/libjafs/ACL.c:1.4	Fri Oct 14 22:12:24 2005
--- openafs/src/JAVA/libjafs/ACL.c	Tue May 26 20:13:47 2009
***************
*** 21,26 ****
--- 21,27 ----
  
  #include <afs/param.h>
  #include <afs/stds.h>
+ #include <errno.h>
  
  #include "Internal.h"
  #include "org_openafs_jafs_ACL.h"
***************
*** 54,60 ****
  
  #define ACL_LEN      1024
  
! extern int errno;
  
  /**
   * Returns a formatted string representing the ACL for the specified path.
--- 55,66 ----
  
  #define ACL_LEN      1024
  
! #ifndef ERROR_H
! #define ERROR_H
! #endif
! 
! extern int error_intr;
! extern int error_nomem;
  
  /**
   * Returns a formatted string representing the ACL for the specified path.
Index: openafs/src/JAVA/libjafs/FileInputStream.c
diff -c openafs/src/JAVA/libjafs/FileInputStream.c:1.4 openafs/src/JAVA/libjafs/FileInputStream.c:1.4.4.1
*** openafs/src/JAVA/libjafs/FileInputStream.c:1.4	Fri Oct 14 22:12:24 2005
--- openafs/src/JAVA/libjafs/FileInputStream.c	Tue May 26 20:13:47 2009
***************
*** 21,26 ****
--- 21,27 ----
  
  #include "Internal.h"
  #include "org_openafs_jafs_FileInputStream.h"
+ #include <errno.h>
  
  #include <fcntl.h>
  
***************
*** 28,35 ****
  #include "dmalloc.h"
  #endif
  
- extern int errno;
- 
  /**
   * Be carefull with the memory management:
   *
--- 29,34 ----
Index: openafs/src/JAVA/libjafs/Internal.c
diff -c openafs/src/JAVA/libjafs/Internal.c:1.5 openafs/src/JAVA/libjafs/Internal.c:1.5.4.1
*** openafs/src/JAVA/libjafs/Internal.c:1.5	Fri Oct 14 22:12:24 2005
--- openafs/src/JAVA/libjafs/Internal.c	Tue May 26 20:13:47 2009
***************
*** 20,32 ****
   */
  
  #include "Internal.h"
  
  #ifdef DMALLOC
  #include "dmalloc.h"
  #endif
  
- extern int errno;
- 
  #ifndef LIBJUAFS
  // user class and fields //
  jclass userCls = 0;
--- 20,31 ----
   */
  
  #include "Internal.h"
+ #include <errno.h>
  
  #ifdef DMALLOC
  #include "dmalloc.h"
  #endif
  
  #ifndef LIBJUAFS
  // user class and fields //
  jclass userCls = 0;
Index: openafs/src/WINNT/afsd/NTMakefile
diff -c openafs/src/WINNT/afsd/NTMakefile:1.46.2.15 openafs/src/WINNT/afsd/NTMakefile:1.46.2.17
*** openafs/src/WINNT/afsd/NTMakefile:1.46.2.15	Sat Oct 18 13:01:19 2008
--- openafs/src/WINNT/afsd/NTMakefile	Mon May 25 17:31:21 2009
***************
*** 138,144 ****
  	$(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $**
  
  FSOBJS=$(OUT)\fs.obj \
!        $(OUT)\fs_utils.obj
  
  CMDBGOBJS=$(OUT)\cmdebug.obj
  
--- 138,145 ----
  	$(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $**
  
  FSOBJS=$(OUT)\fs.obj \
!        $(OUT)\fs_utils.obj \
!        $(OUT)\cm_nls.obj
  
  CMDBGOBJS=$(OUT)\cmdebug.obj
  
***************
*** 182,188 ****
  ############################################################################
  # libafsconf.dll
  
! CONF_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\libafsconf.dll
  
  CONF_DLLLIBS = \
      $(DESTDIR)\lib\afs\afsutil.lib \
--- 183,189 ----
  ############################################################################
  # libafsconf.dll
  
! CONF_DLLFILE = $(DESTDIR)\lib\libafsconf.dll
  
  CONF_DLLLIBS = \
      $(DESTDIR)\lib\afs\afsutil.lib \
***************
*** 193,200 ****
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
! 	$(COPY) $*.lib $(ILIBDIR)
! 	$(DEL) $*.lib $*.exp
  
  ############################################################################
  # lanahelper.lib
--- 194,201 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
! 	$(MAKECYGLIB) --input-def libafsconf.def
! 	$(DEL) $*.exp
  
  ############################################################################
  # lanahelper.lib
***************
*** 284,293 ****
  ############################################################################
  # Install target; primary makefile target
  
! install_objs: $(OUT)\cm_dns.obj $(OUT)\cm_config.obj $(OUT)\cm_nls.obj $(LANAHELPERLIB) $(OUT)\afsicf.obj
!      $(COPY) $(OUT)\cm_dns.obj $(DESTDIR)\lib
!      $(COPY) $(OUT)\cm_nls.obj $(DESTDIR)\lib
!      $(COPY) $(OUT)\cm_config.obj $(DESTDIR)\lib
       $(COPY) $(OUT)\afsicf.obj $(DESTDIR)\lib
  
  install_headers: $(IDLFILES) $(INCFILES)
--- 285,291 ----
  ############################################################################
  # Install target; primary makefile target
  
! install_objs: $(CONF_DLLFILE) $(LANAHELPERLIB) $(OUT)\afsicf.obj
       $(COPY) $(OUT)\afsicf.obj $(DESTDIR)\lib
  
  install_headers: $(IDLFILES) $(INCFILES)
***************
*** 344,351 ****
  	$(DESTDIR)\lib\afsrx.lib \
  	$(DESTDIR)\lib\afslwp.lib \
  	$(DESTDIR)\lib\libosi.lib \
! 	$(DESTDIR)\lib\libafsconf.lib \
!         $(DESTDIR)\lib\cm_nls.obj
  
  EXELIBS2 = \
          $(DESTDIR)\lib\afsrpc.lib \
--- 342,348 ----
  	$(DESTDIR)\lib\afsrx.lib \
  	$(DESTDIR)\lib\afslwp.lib \
  	$(DESTDIR)\lib\libosi.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  EXELIBS2 = \
          $(DESTDIR)\lib\afsrpc.lib \
Index: openafs/src/WINNT/afsd/afsd_eventmessages.mc
diff -c openafs/src/WINNT/afsd/afsd_eventmessages.mc:1.4.4.4 openafs/src/WINNT/afsd/afsd_eventmessages.mc:1.4.4.5
*** openafs/src/WINNT/afsd/afsd_eventmessages.mc:1.4.4.4	Sat Mar 28 19:17:44 2009
--- openafs/src/WINNT/afsd/afsd_eventmessages.mc	Mon May 11 10:16:32 2009
***************
*** 163,169 ****
  Facility=System
  SymbolicName=MSG_RX_HARD_DEAD_TIME_EXCEEDED
  Language=English
! Hard Dead Time exceeded when communicating with server %1
  .
  
  MessageId=
--- 163,169 ----
  Facility=System
  SymbolicName=MSG_RX_HARD_DEAD_TIME_EXCEEDED
  Language=English
! Hard or Idle Dead Time exceeded when communicating with server %1
  .
  
  MessageId=
Index: openafs/src/WINNT/afsd/afsd_init.c
diff -c openafs/src/WINNT/afsd/afsd_init.c:1.79.2.55 openafs/src/WINNT/afsd/afsd_init.c:1.79.2.56
*** openafs/src/WINNT/afsd/afsd_init.c:1.79.2.55	Wed Apr  1 13:29:24 2009
--- openafs/src/WINNT/afsd/afsd_init.c	Tue Apr  7 10:05:44 2009
***************
*** 86,93 ****
  long cm_HostAddr;
  unsigned short cm_callbackport = CM_DEFAULT_CALLBACKPORT;
  
! char cm_NetbiosName[MAX_NB_NAME_LENGTH] = "";
! clientchar_t cm_NetbiosNameC[MAX_NB_NAME_LENGTH] = _C("");
  
  char cm_CachePath[MAX_PATH];
  DWORD cm_ValidateCache = 1;
--- 86,93 ----
  long cm_HostAddr;
  unsigned short cm_callbackport = CM_DEFAULT_CALLBACKPORT;
  
! char cm_NetbiosName[MAX_NB_NAME_LENGTH] = "NOT.YET.SET";
! clientchar_t cm_NetbiosNameC[MAX_NB_NAME_LENGTH] = _C("NOT.YET.SET");
  
  char cm_CachePath[MAX_PATH];
  DWORD cm_ValidateCache = 1;
***************
*** 240,398 ****
      CloseHandle(handle);
  }
  
- static void
- configureBackConnectionHostNames(void)
- {
-     /* On Windows XP SP2, Windows 2003 SP1, and all future Windows operating systems
-      * there is a restriction on the use of SMB authentication on loopback connections.
-      * There are two work arounds available:
-      * 
-      *   (1) We can disable the check for matching host names.  This does not
-      *   require a reboot:
-      *   [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
-      *     "DisableLoopbackCheck"=dword:00000001
-      *
-      *   (2) We can add the AFS SMB/CIFS service name to an approved list.  This
-      *   does require a reboot:
-      *   [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0]
-      *     "BackConnectionHostNames"=multi-sz
-      *
-      * The algorithm will be:
-      *   (1) Check to see if cm_NetbiosName exists in the BackConnectionHostNames list
-      *   (2a) If not, add it to the list.  (This will not take effect until the next reboot.)
-      *   (2b1)    and check to see if DisableLoopbackCheck is set.
-      *   (2b2)    If not set, set the DisableLoopbackCheck value to 0x1 
-      *   (2b3)                and create HKLM\SOFTWARE\OpenAFS\Client  UnsetDisableLoopbackCheck
-      *   (2c) else If cm_NetbiosName exists in the BackConnectionHostNames list,
-      *             check for the UnsetDisableLoopbackCheck value.  
-      *             If set, set the DisableLoopbackCheck flag to 0x0 
-      *             and delete the UnsetDisableLoopbackCheck value
-      *
-      * Starting in Longhorn Beta 1, an entry in the BackConnectionHostNames value will
-      * force Windows to use the loopback authentication mechanism for the specified 
-      * services.
-      */
-     HKEY hkLsa;
-     HKEY hkMSV10;
-     HKEY hkClient;
-     DWORD dwType;
-     DWORD dwSize, dwAllocSize;
-     DWORD dwValue;
-     PBYTE pHostNames = NULL, pName = NULL;
-     BOOL  bNameFound = FALSE;   
- 
-     if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, 
-                        "SYSTEM\\CurrentControlSet\\Control\\Lsa\\MSV1_0",
-                        0,
-                        KEY_READ|KEY_WRITE,
-                        &hkMSV10) == ERROR_SUCCESS )
-     {
-         if ((RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, 
- 			     &dwType, NULL, &dwAllocSize) == ERROR_SUCCESS) &&
-             (dwType == REG_MULTI_SZ)) 
-         {
- 	    dwAllocSize += 1 /* in case the source string is not nul terminated */
- 		+ strlen(cm_NetbiosName) + 2;
- 	    pHostNames = malloc(dwAllocSize);
- 	    dwSize = dwAllocSize;
-             if (RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, &dwType, 
- 				 pHostNames, &dwSize) == ERROR_SUCCESS) 
-             {
- 		for (pName = pHostNames; 
- 		     (pName - pHostNames < (int) dwSize) && *pName ; 
- 		     pName += strlen(pName) + 1)
- 		{
- 		    if ( !stricmp(pName, cm_NetbiosName) ) {
- 			bNameFound = TRUE;
- 			break;
- 		    }   
- 		}
- 	    }
-         }
-              
-         if ( !bNameFound ) {
-             size_t size = strlen(cm_NetbiosName) + 2;
-             if ( !pHostNames ) {
-                 pHostNames = malloc(size);
- 		pName = pHostNames;
-             }
-             StringCbCopyA(pName, size, cm_NetbiosName);
-             pName += size - 1;
-             *pName = '\0';  /* add a second nul terminator */
- 
-             dwType = REG_MULTI_SZ;
- 	    dwSize = pName - pHostNames + 1;
-             RegSetValueEx( hkMSV10, "BackConnectionHostNames", 0, dwType, pHostNames, dwSize);
- 
-             if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, 
-                                "SYSTEM\\CurrentControlSet\\Control\\Lsa",
-                                0,
-                                KEY_READ|KEY_WRITE,
-                                &hkLsa) == ERROR_SUCCESS )
-             {
-                 dwSize = sizeof(DWORD);
-                 if ( RegQueryValueEx( hkLsa, "DisableLoopbackCheck", 0, &dwType, (LPBYTE)&dwValue, &dwSize) != ERROR_SUCCESS ||
-                      dwValue == 0 ) {
-                     dwType = REG_DWORD;
-                     dwSize = sizeof(DWORD);
-                     dwValue = 1;
-                     RegSetValueEx( hkLsa, "DisableLoopbackCheck", 0, dwType, (LPBYTE)&dwValue, dwSize);
- 
-                     if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, 
-                                         AFSREG_CLT_OPENAFS_SUBKEY,
-                                         0,
-                                         NULL,
-                                         REG_OPTION_NON_VOLATILE,
-                                         KEY_READ|KEY_WRITE,
-                                         NULL,
-                                         &hkClient,
-                                         NULL) == ERROR_SUCCESS) {
- 
-                         dwType = REG_DWORD;
-                         dwSize = sizeof(DWORD);
-                         dwValue = 1;
-                         RegSetValueEx( hkClient, "RemoveDisableLoopbackCheck", 0, dwType, (LPBYTE)&dwValue, dwSize);
-                         RegCloseKey(hkClient);
-                     }
-                     RegCloseKey(hkLsa);
-                 }
-             }
-         } else {
-             if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, 
-                                 AFSREG_CLT_OPENAFS_SUBKEY,
-                                 0,
-                                 NULL,
-                                 REG_OPTION_NON_VOLATILE,
-                                 KEY_READ|KEY_WRITE,
-                                 NULL,
-                                 &hkClient,
-                                 NULL) == ERROR_SUCCESS) {
- 
-                 dwSize = sizeof(DWORD);
-                 if ( RegQueryValueEx( hkClient, "RemoveDisableLoopbackCheck", 0, &dwType, (LPBYTE)&dwValue, &dwSize) == ERROR_SUCCESS &&
-                      dwValue == 1 ) {
-                     if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, 
-                                        "SYSTEM\\CurrentControlSet\\Control\\Lsa",
-                                        0,
-                                        KEY_READ|KEY_WRITE,
-                                        &hkLsa) == ERROR_SUCCESS )
-                     {
-                         RegDeleteValue(hkLsa, "DisableLoopbackCheck");
-                         RegCloseKey(hkLsa);
-                     }
-                 }
-                 RegDeleteValue(hkClient, "RemoveDisableLoopbackCheck");
-                 RegCloseKey(hkClient);
-             }
-         }
-         RegCloseKey(hkMSV10);
-     }
- 
-     if (pHostNames)
- 	free(pHostNames);
- }
- 
- 
  static void afsd_InitServerPreferences(void)
  {
      HKEY hkPrefs = 0;
--- 240,245 ----
***************
*** 900,914 ****
                              (LPBYTE) cm_mountRootC, &cm_mountRootCLen);
      if (code == ERROR_SUCCESS) {
          afsi_log("Mount root %S", cm_mountRootC);
!         cm_mountRootCLen = cm_ClientStrLen(cm_mountRootC);
      } else {
          cm_ClientStrCpy(cm_mountRootC, lengthof(cm_mountRootC), _C("/afs"));
!         cm_mountRootCLen = cm_ClientStrLen(cm_mountRootC);
          /* Don't log */
      }
  
      cm_ClientStringToFsString(cm_mountRootC, -1, cm_mountRoot, lengthof(cm_mountRoot));
!     cm_mountRootLen = cm_FsStrLen(cm_mountRoot);
  
      dummyLen = sizeof(buf);
      code = RegQueryValueEx(parmKey, "CachePath", NULL, &regType,
--- 747,761 ----
                              (LPBYTE) cm_mountRootC, &cm_mountRootCLen);
      if (code == ERROR_SUCCESS) {
          afsi_log("Mount root %S", cm_mountRootC);
!         cm_mountRootCLen = (DWORD)cm_ClientStrLen(cm_mountRootC);
      } else {
          cm_ClientStrCpy(cm_mountRootC, lengthof(cm_mountRootC), _C("/afs"));
!         cm_mountRootCLen = (DWORD)cm_ClientStrLen(cm_mountRootC);
          /* Don't log */
      }
  
      cm_ClientStringToFsString(cm_mountRootC, -1, cm_mountRoot, lengthof(cm_mountRoot));
!     cm_mountRootLen = (DWORD)cm_FsStrLen(cm_mountRoot);
  
      dummyLen = sizeof(buf);
      code = RegQueryValueEx(parmKey, "CachePath", NULL, &regType,
***************
*** 1327,1335 ****
      cm_initParams.setTime = 0;
      cm_initParams.memCache = 1;
  
-     /* Ensure the AFS Netbios Name is registered to allow loopback access */
-     configureBackConnectionHostNames();
- 
      /* init user daemon, and other packages */
      cm_InitUser();
  
--- 1174,1179 ----
Index: openafs/src/WINNT/afsd/afskfw.c
diff -c openafs/src/WINNT/afsd/afskfw.c:1.28.4.22 openafs/src/WINNT/afsd/afskfw.c:1.28.4.23
*** openafs/src/WINNT/afsd/afskfw.c:1.28.4.22	Mon Feb 23 09:28:49 2009
--- openafs/src/WINNT/afsd/afskfw.c	Mon May 25 18:06:37 2009
***************
*** 76,81 ****
--- 76,82 ----
  #include <rx/rxkad.h>
  
  #include <WINNT\afsreg.h>
+ #include "cm.h"
  
  /*
   * TIMING _____________________________________________________________________
***************
*** 375,381 ****
  
  /* Static Prototypes */
  char *afs_realm_of_cell(krb5_context, struct afsconf_cell *);
! static long get_cellconfig_callback(void *, struct sockaddr_in *, char *);
  int KFW_AFS_get_cellconfig(char *, struct afsconf_cell *, char *);
  static krb5_error_code KRB5_CALLCONV KRB5_prompter( krb5_context context,
             void *data, const char *name, const char *banner, int num_prompts,
--- 376,382 ----
  
  /* Static Prototypes */
  char *afs_realm_of_cell(krb5_context, struct afsconf_cell *);
! static long get_cellconfig_callback(void *, struct sockaddr_in *, char *, unsigned short);
  int KFW_AFS_get_cellconfig(char *, struct afsconf_cell *, char *);
  static krb5_error_code KRB5_CALLCONV KRB5_prompter( krb5_context context,
             void *data, const char *name, const char *banner, int num_prompts,
***************
*** 3390,3396 ****
  /**************************************/
  /* KFW_AFS_get_cellconfig():          */
  /**************************************/
! int 
  KFW_AFS_get_cellconfig(char *cell, struct afsconf_cell *cellconfig, char *local_cell)
  {
      int	rc;
--- 3391,3397 ----
  /**************************************/
  /* KFW_AFS_get_cellconfig():          */
  /**************************************/
! int
  KFW_AFS_get_cellconfig(char *cell, struct afsconf_cell *cellconfig, char *local_cell)
  {
      int	rc;
***************
*** 3409,3416 ****
      if (strlen(cell) == 0)
          strcpy(cell, local_cell);
  
!     /* WIN32: cm_SearchCellFile(cell, pcallback, pdata) */
!     rc = cm_SearchCellFileEx(cell, newcell, linkedcell, get_cellconfig_callback, (void*)cellconfig);
  #ifdef AFS_AFSDB_ENV
      if (rc != 0) {
          int ttl;
--- 3410,3418 ----
      if (strlen(cell) == 0)
          strcpy(cell, local_cell);
  
!     rc = cm_SearchCellRegistry(1, cell, newcell, linkedcell, get_cellconfig_callback, (void*)cellconfig);
!     if (rc && rc != CM_ERROR_FORCE_DNS_LOOKUP)
!         rc = cm_SearchCellFileEx(cell, newcell, linkedcell, get_cellconfig_callback, (void*)cellconfig);
  #ifdef AFS_AFSDB_ENV
      if (rc != 0) {
          int ttl;
***************
*** 3430,3436 ****
  /* get_cellconfig_callback():         */
  /**************************************/
  static long 
! get_cellconfig_callback(void *cellconfig, struct sockaddr_in *addrp, char *namep)
  {
      struct afsconf_cell *cc = (struct afsconf_cell *)cellconfig;
  
--- 3432,3438 ----
  /* get_cellconfig_callback():         */
  /**************************************/
  static long 
! get_cellconfig_callback(void *cellconfig, struct sockaddr_in *addrp, char *namep, unsigned short ipRank)
  {
      struct afsconf_cell *cc = (struct afsconf_cell *)cellconfig;
  
Index: openafs/src/WINNT/afsd/cm.h
diff -c openafs/src/WINNT/afsd/cm.h:1.17.2.18 openafs/src/WINNT/afsd/cm.h:1.17.2.19
*** openafs/src/WINNT/afsd/cm.h:1.17.2.18	Thu Oct  2 08:14:02 2008
--- openafs/src/WINNT/afsd/cm.h	Mon May 25 18:06:37 2009
***************
*** 100,105 ****
--- 100,106 ----
  #define CM_ERROR_NOSUCHDEVICE           (CM_ERROR_BASE+58)
  #define CM_ERROR_LOCK_NOT_GRANTED       (CM_ERROR_BASE+59)
  #define CM_ERROR_NOTINCACHE             (CM_ERROR_BASE+60)
+ #define CM_ERROR_FORCE_DNS_LOOKUP       (CM_ERROR_BASE+61)
  
  /* Used by cm_FollowMountPoint and cm_FindVolumeByName */
  /* And as an index in cm_volume_t */
Index: openafs/src/WINNT/afsd/cm_cell.c
diff -c openafs/src/WINNT/afsd/cm_cell.c:1.23.2.28 openafs/src/WINNT/afsd/cm_cell.c:1.23.2.29
*** openafs/src/WINNT/afsd/cm_cell.c:1.23.2.28	Sun Mar  1 23:45:15 2009
--- openafs/src/WINNT/afsd/cm_cell.c	Mon May 25 18:06:37 2009
***************
*** 28,34 ****
   *
   * At the present time the return value is ignored by the caller.
   */
! long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *hostnamep)
  {
      cm_server_t *tsp;
      cm_serverRef_t *tsrp;
--- 28,34 ----
   *
   * At the present time the return value is ignored by the caller.
   */
! long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *hostnamep, unsigned short ipRank)
  {
      cm_server_t *tsp;
      cm_serverRef_t *tsrp;
***************
*** 54,59 ****
--- 54,61 ----
      else
          tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp, NULL, probe ? 0 : CM_FLAG_NOPROBE);
  
+     tsp->ipRank = ipRank;
+ 
      /* Insert the vlserver into a sorted list, sorted by server rank */
      tsrp = cm_NewServerRef(tsp, 0);
      cm_InsertServerList(&cellp->vlServersp, tsrp);
***************
*** 99,105 ****
  
          rock.cellp = cp;
          rock.flags = flags;
!         code = cm_SearchCellFileEx(cp->name, NULL, cp->linkedName, cm_AddCellProc, &rock);
          if (code == 0) {
              lock_ObtainMutex(&cp->mx);
  	    cp->timeout = time(0) + 7200;
--- 101,109 ----
  
          rock.cellp = cp;
          rock.flags = flags;
!         code = cm_SearchCellRegistry(1, cp->name, NULL, cp->linkedName, cm_AddCellProc, &rock);
!         if (code && code != CM_ERROR_FORCE_DNS_LOOKUP)
!             code = cm_SearchCellFileEx(cp->name, NULL, cp->linkedName, cm_AddCellProc, &rock);
          if (code == 0) {
              lock_ObtainMutex(&cp->mx);
  	    cp->timeout = time(0) + 7200;
***************
*** 271,277 ****
  
          rock.cellp = cp;
          rock.flags = flags;
!         code = cm_SearchCellFileEx(namep, fullname, linkedName, cm_AddCellProc, &rock);
          if (code) {
              osi_Log4(afsd_logp,"in cm_GetCell_gen cm_SearchCellFileEx(%s) returns code= %d fullname= %s linkedName= %s", 
                        osi_LogSaveString(afsd_logp,namep), code, osi_LogSaveString(afsd_logp,fullname),
--- 275,283 ----
  
          rock.cellp = cp;
          rock.flags = flags;
!         code = cm_SearchCellRegistry(1, namep, fullname, linkedName, cm_AddCellProc, &rock);
!         if (code && code != CM_ERROR_FORCE_DNS_LOOKUP)
!             code = cm_SearchCellFileEx(namep, fullname, linkedName, cm_AddCellProc, &rock);
          if (code) {
              osi_Log4(afsd_logp,"in cm_GetCell_gen cm_SearchCellFileEx(%s) returns code= %d fullname= %s linkedName= %s", 
                        osi_LogSaveString(afsd_logp,namep), code, osi_LogSaveString(afsd_logp,fullname),
Index: openafs/src/WINNT/afsd/cm_cell.h
diff -c openafs/src/WINNT/afsd/cm_cell.h:1.7.6.11 openafs/src/WINNT/afsd/cm_cell.h:1.7.6.12
*** openafs/src/WINNT/afsd/cm_cell.h:1.7.6.11	Mon Nov  3 14:56:06 2008
--- openafs/src/WINNT/afsd/cm_cell.h	Mon May 25 18:06:37 2009
***************
*** 72,78 ****
  
  extern void cm_AddCellToIDHashTable(cm_cell_t * cellp);
  
! extern long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *namep);
  
  extern cm_cell_t *cm_UpdateCell(cm_cell_t * cp, afs_uint32 flags);
  
--- 72,79 ----
  
  extern void cm_AddCellToIDHashTable(cm_cell_t * cellp);
  
! extern long cm_AddCellProc(void *rockp, struct sockaddr_in *addrp, char *namep, 
!                            unsigned short ipRank);
  
  extern cm_cell_t *cm_UpdateCell(cm_cell_t * cp, afs_uint32 flags);
  
Index: openafs/src/WINNT/afsd/cm_config.c
diff -c openafs/src/WINNT/afsd/cm_config.c:1.26.4.12 openafs/src/WINNT/afsd/cm_config.c:1.26.4.13
*** openafs/src/WINNT/afsd/cm_config.c:1.26.4.12	Mon Feb 23 09:28:49 2009
--- openafs/src/WINNT/afsd/cm_config.c	Mon May 25 18:06:37 2009
***************
*** 294,300 ****
                      vlSockAddr.sin_family = AF_INET;
                      /* sin_port supplied by connection code */
  		    if (procp)
! 			(*procp)(rockp, &vlSockAddr, valuep);
                      foundCell = 1;
  		}
                  if (!thp) {
--- 294,300 ----
                      vlSockAddr.sin_family = AF_INET;
                      /* sin_port supplied by connection code */
  		    if (procp)
! 			(*procp)(rockp, &vlSockAddr, valuep, 0);
                      foundCell = 1;
  		}
                  if (!thp) {
***************
*** 318,324 ****
                          vlSockAddr.sin_family = AF_INET;
                          /* sin_port supplied by connection code */
                          if (procp)
!                             (*procp)(rockp, &vlSockAddr, valuep);
                          foundCell = 1;
                      }
                  }
--- 318,324 ----
                          vlSockAddr.sin_family = AF_INET;
                          /* sin_port supplied by connection code */
                          if (procp)
!                             (*procp)(rockp, &vlSockAddr, valuep, 0);
                          foundCell = 1;
                      }
                  }
***************
*** 330,343 ****
      return (foundCell) ? 0 : -11;
  }
  
  /* newCellNamep is required to be CELL_MAXNAMELEN in size */
  long cm_SearchCellByDNS(char *cellNamep, char *newCellNamep, int *ttl,
!                cm_configProc_t *procp, void *rockp)
  {
  #ifdef AFS_AFSDB_ENV
      int rc;
      int  cellHostAddrs[AFSMAXCELLHOSTS];
      char cellHostNames[AFSMAXCELLHOSTS][MAXHOSTCHARS];
      int numServers;
      int i;
      struct sockaddr_in vlSockAddr;
--- 330,668 ----
      return (foundCell) ? 0 : -11;
  }
  
+ /*
+  * The CellServDB registry schema is as follows:
+  *
+  * HKLM\SOFTWARE\OpenAFS\Client\CellServDB\[cellname]\
+  *   "LinkedCell"    REG_SZ "[cellname]" 
+  *   "Description"   REG_SZ "[comment]"
+  *   "ForceDNS"      DWORD  {0,1}
+  *
+  * HKLM\SOFTWARE\OpenAFS\Client\CellServDB\[cellname]\[servername]\
+  *   "HostName"      REG_SZ "[hostname]" 
+  *   "IPv4Address"   REG_SZ "[address]" 
+  *   "IPv6Address"   REG_SZ "[address]"   <future>
+  *   "Comment"       REG_SZ "[comment]"
+  *   "Rank"          DWORD  "0..65535"
+  *   "Clone"         DWORD  "{0,1}"
+  *   "vlserver"      DWORD  "7003"        <future>
+  *   "ptserver"      DWORD  ...           <future>
+  *
+  * ForceDNS is implied non-zero if there are no [servername]
+  * keys under the [cellname] key.  Otherwise, ForceDNS is zero.
+  * If [servername] keys are specified and none of them evaluate
+  * to a valid server configuration, the return code is success.
+  * This prevents failover to the CellServDB file or DNS.
+  */
+ long cm_SearchCellRegistry(afs_uint32 client, 
+                            char *cellNamep, char *newCellNamep,
+                            char *linkedNamep,
+                            cm_configProc_t *procp, void *rockp)
+ {
+     HKEY hkCellServDB = 0, hkCellName = 0, hkServerName = 0;
+     DWORD dwType, dwSize;
+     DWORD dwCells, dwServers, dwForceDNS;
+     DWORD dwIndex, dwRank;
+     unsigned short ipRank;
+     LONG code;
+     FILETIME ftLastWriteTime;
+     char szCellName[CELL_MAXNAMELEN];
+     char szServerName[MAXHOSTCHARS];
+     char szHostName[MAXHOSTCHARS];
+     char szAddr[64];
+     struct hostent *thp;
+     struct sockaddr_in vlSockAddr;
+     char * s;
+ 
+     if ( IsWindowsModule(cellNamep) )
+ 	return -1;
+ 
+     /* No Server CellServDB list (yet) */
+     if ( !client )
+         return CM_ERROR_NOSUCHCELL;
+ 
+     if (RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+                       AFSREG_CLT_OPENAFS_SUBKEY "\\CellServDB",
+                       0,
+                       KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
+                       &hkCellServDB) != ERROR_SUCCESS)
+         return CM_ERROR_NOSUCHCELL;
+ 
+     if (RegOpenKeyEx( hkCellServDB, 
+                       cellNamep,
+                       0,
+                       KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
+                       &hkCellName) != ERROR_SUCCESS) {
+         BOOL bFound = 0;
+ 
+         /* We did not find an exact match.  Much search for partial matches. */
+ 
+         code = RegQueryInfoKey( hkCellServDB,
+                                 NULL,  /* lpClass */
+                                 NULL,  /* lpcClass */
+                                 NULL,  /* lpReserved */
+                                 &dwCells,  /* lpcSubKeys */
+                                 NULL,  /* lpcMaxSubKeyLen */
+                                 NULL,  /* lpcMaxClassLen */
+                                 NULL,  /* lpcValues */
+                                 NULL,  /* lpcMaxValueNameLen */
+                                 NULL,  /* lpcMaxValueLen */
+                                 NULL,  /* lpcbSecurityDescriptor */
+                                 &ftLastWriteTime /* lpftLastWriteTime */
+                                 );
+         if (code != ERROR_SUCCESS)
+             dwCells = 0;
+ 
+         /* 
+          * We search the entire list to ensure that there is only
+          * one prefix match.  If there is more than one, we return none.
+          */
+         for ( dwIndex = 0; dwIndex < dwCells; dwIndex++ ) {
+             dwSize = CELL_MAXNAMELEN;
+             code = RegEnumKeyEx( hkCellServDB, dwIndex, szCellName, &dwSize, NULL, 
+                                  NULL, NULL, &ftLastWriteTime);
+             if (code != ERROR_SUCCESS)
+                 continue;
+             szCellName[CELL_MAXNAMELEN-1] = '\0';
+             strlwr(szCellName);
+ 
+             /* if not a prefix match, try the next key */
+             if (strncmp(cellNamep, szCellName, strlen(cellNamep)))
+                 continue;
+ 
+             /* If we have a prefix match and we already found another
+              * match, return neither */
+             if (hkCellName) {
+                 bFound = 0;
+                 RegCloseKey( hkCellName);
+                 break;
+             }
+ 
+             if (RegOpenKeyEx( hkCellServDB, 
+                               szCellName,
+                               0,
+                               KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
+                               &hkCellName) != ERROR_SUCCESS)
+                 continue;
+ 
+             if (newCellNamep) {
+                 strncpy(newCellNamep, szCellName, CELL_MAXNAMELEN);
+                 newCellNamep[CELL_MAXNAMELEN-1] = '\0';
+             }
+             bFound = 1;
+         }
+ 
+         if ( !bFound ) {
+             if (newCellNamep)
+                 newCellNamep[0] = '\0';
+             RegCloseKey(hkCellServDB);
+             return CM_ERROR_NOSUCHCELL;
+         }
+     } else if (newCellNamep) {
+         strncpy(newCellNamep, cellNamep, CELL_MAXNAMELEN);
+         newCellNamep[CELL_MAXNAMELEN-1] = '\0';
+         strlwr(newCellNamep);
+     }
+ 
+     if (linkedNamep) {
+         dwSize = CELL_MAXNAMELEN;
+         code = RegQueryValueEx(hkCellName, "LinkedCell", NULL, &dwType,
+                                 (BYTE *) linkedNamep, &dwSize);
+         if (code == ERROR_SUCCESS && dwType == REG_SZ) {
+             linkedNamep[CELL_MAXNAMELEN-1] = '\0';
+             strlwr(linkedNamep);
+         } else {
+             linkedNamep[0] = '\0';
+         }
+     }
+ 
+     /* Check to see if DNS lookups are required */
+     dwSize = sizeof(DWORD);
+     code = RegQueryValueEx(hkCellName, "ForceDNS", NULL, &dwType,
+                             (BYTE *) &dwForceDNS, &dwSize);
+     if (code == ERROR_SUCCESS && dwType == REG_DWORD) {
+         if (dwForceDNS)
+             goto done;
+     } else {
+         dwForceDNS = 0;
+     }
+ 
+     /* 
+      * Using the defined server list.  Enumerate and populate
+      * the server list for the cell.
+      */
+     code = RegQueryInfoKey( hkCellName,
+                             NULL,  /* lpClass */
+                             NULL,  /* lpcClass */
+                             NULL,  /* lpReserved */
+                             &dwServers,  /* lpcSubKeys */
+                             NULL,  /* lpcMaxSubKeyLen */
+                             NULL,  /* lpcMaxClassLen */
+                             NULL,  /* lpcValues */
+                             NULL,  /* lpcMaxValueNameLen */
+                             NULL,  /* lpcMaxValueLen */
+                             NULL,  /* lpcbSecurityDescriptor */
+                             &ftLastWriteTime /* lpftLastWriteTime */
+                             );
+     if (code != ERROR_SUCCESS)
+         dwServers = 0;
+ 
+     for ( dwIndex = 0; dwIndex < dwServers; dwIndex++ ) {
+         dwSize = MAXHOSTCHARS;
+         code = RegEnumKeyEx( hkCellName, dwIndex, szServerName, &dwSize, NULL, 
+                              NULL, NULL, &ftLastWriteTime);
+         if (code != ERROR_SUCCESS)
+             continue;
+ 
+         szServerName[MAXHOSTCHARS-1] = '\0';
+         if (RegOpenKeyEx( hkCellName, 
+                           szServerName,
+                           0,
+                           KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
+                           &hkServerName) != ERROR_SUCCESS)
+             continue;
+ 
+         /* We have a handle to a valid server key.  Now we need 
+          * to add the server to the cell */
+         
+         /* First, see if there is an alternate hostname specified */
+         dwSize = MAXHOSTCHARS;
+         code = RegQueryValueEx(hkServerName, "HostName", NULL, &dwType,
+                                 (BYTE *) szHostName, &dwSize);
+         if (code == ERROR_SUCCESS && dwType == REG_SZ) {
+             szHostName[MAXHOSTCHARS-1] = '\0';
+             strlwr(szHostName);
+             s = szHostName;
+         } else {
+             s = szServerName;
+         }
+ 
+         dwSize = sizeof(DWORD);
+         code = RegQueryValueEx(hkServerName, "Rank", NULL, &dwType,
+                                 (BYTE *) &dwRank, &dwSize);
+         if (code == ERROR_SUCCESS && dwType == REG_DWORD) {
+             ipRank = (unsigned short)(dwRank <= 65535 ? dwRank : 65535);
+         } else {
+             ipRank = 0;
+         }
+ 
+         dwSize = sizeof(szAddr);
+         code = RegQueryValueEx(hkServerName, "IPv4Address", NULL, &dwType,
+                                 (BYTE *) szAddr, &dwSize);
+         if (code == ERROR_SUCCESS && dwType == REG_SZ) {
+             szAddr[63] = '\0';
+         } else {
+             szAddr[0] = '\0';
+         }
+ 
+         WSASetLastError(0);
+         thp = gethostbyname(s);
+         if (thp) {
+             memcpy(&vlSockAddr.sin_addr.s_addr, thp->h_addr, sizeof(long));
+             vlSockAddr.sin_family = AF_INET;
+             /* sin_port supplied by connection code */
+             if (procp)
+                 (*procp)(rockp, &vlSockAddr, s, ipRank);
+         } else if (szAddr[0]) {
+             afs_uint32 ip_addr;
+             unsigned int c1, c2, c3, c4;
+ 
+             /* Since there is no gethostbyname() data 
+              * available we will read the IP address
+              * stored in the CellServDB file
+              */
+             code = sscanf(szAddr, " %u.%u.%u.%u",
+                            &c1, &c2, &c3, &c4);
+             if (code == 4 && c1<256 && c2<256 && c3<256 && c4<256) {
+                 unsigned char * tp = (unsigned char *) &ip_addr;
+                 *tp++ = c1;
+                 *tp++ = c2;
+                 *tp++ = c3;
+                 *tp++ = c4;
+                 memcpy(&vlSockAddr.sin_addr.s_addr, &ip_addr,
+                         sizeof(long));
+                 vlSockAddr.sin_family = AF_INET;
+                 /* sin_port supplied by connection code */
+                 if (procp)
+                     (*procp)(rockp, &vlSockAddr, s, ipRank);
+             }
+         }
+ 
+         RegCloseKey( hkServerName);
+     }
+ 
+   done:
+     RegCloseKey(hkCellName);
+     RegCloseKey(hkCellServDB);
+ 
+     return ((dwForceDNS || dwServers == 0) ? CM_ERROR_FORCE_DNS_LOOKUP : 0);
+ }
+ 
+ long cm_EnumerateCellRegistry(afs_uint32 client, cm_enumCellRegistryProc_t *procp, void *rockp)
+ {
+     HKEY hkCellServDB = 0;
+     DWORD dwType, dwSize;
+     DWORD dwCells;
+     DWORD dwIndex;
+     LONG code;
+     FILETIME ftLastWriteTime;
+     char szCellName[CELL_MAXNAMELEN];
+ 
+     /* No server CellServDB in the registry. */
+     if (!client || procp == NULL)
+         return 0;
+ 
+     if (RegOpenKeyEx( HKEY_LOCAL_MACHINE,
+                       AFSREG_CLT_OPENAFS_SUBKEY "\\CellServDB",
+                       0,
+                       KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
+                       &hkCellServDB) != ERROR_SUCCESS)
+         return 0;
+ 
+     code = RegQueryInfoKey( hkCellServDB,
+                             NULL,  /* lpClass */
+                             NULL,  /* lpcClass */
+                             NULL,  /* lpReserved */
+                             &dwCells,  /* lpcSubKeys */
+                             NULL,  /* lpcMaxSubKeyLen */
+                             NULL,  /* lpcMaxClassLen */
+                             NULL,  /* lpcValues */
+                             NULL,  /* lpcMaxValueNameLen */
+                             NULL,  /* lpcMaxValueLen */
+                             NULL,  /* lpcbSecurityDescriptor */
+                             &ftLastWriteTime /* lpftLastWriteTime */
+                             );
+     if (code != ERROR_SUCCESS)
+         dwCells = 0;
+ 
+     /* 
+      * Enumerate each Cell and 
+      */
+     for ( dwIndex = 0; dwIndex < dwCells; dwIndex++ ) {
+         dwSize = CELL_MAXNAMELEN;
+         code = RegEnumKeyEx( hkCellServDB, dwIndex, szCellName, &dwSize, NULL, 
+                              NULL, NULL, &ftLastWriteTime);
+         if (code != ERROR_SUCCESS)
+             continue;
+         szCellName[CELL_MAXNAMELEN-1] = '\0';
+         strlwr(szCellName);
+ 
+         (*procp)(rockp, szCellName);
+     }
+ 
+     RegCloseKey(hkCellServDB);
+     return 0;
+ }
+ 
  /* newCellNamep is required to be CELL_MAXNAMELEN in size */
  long cm_SearchCellByDNS(char *cellNamep, char *newCellNamep, int *ttl,
!                         cm_configProc_t *procp, void *rockp)
  {
  #ifdef AFS_AFSDB_ENV
      int rc;
      int  cellHostAddrs[AFSMAXCELLHOSTS];
      char cellHostNames[AFSMAXCELLHOSTS][MAXHOSTCHARS];
+     unsigned short ipRanks[AFSMAXCELLHOSTS];
      int numServers;
      int i;
      struct sockaddr_in vlSockAddr;
***************
*** 346,352 ****
  #endif
      if ( IsWindowsModule(cellNamep) )
  	return -1;
!     rc = getAFSServer(cellNamep, cellHostAddrs, cellHostNames, &numServers, ttl);
      if (rc == 0 && numServers > 0) {     /* found the cell */
          for (i = 0; i < numServers; i++) {
              memcpy(&vlSockAddr.sin_addr.s_addr, &cellHostAddrs[i],
--- 671,677 ----
  #endif
      if ( IsWindowsModule(cellNamep) )
  	return -1;
!     rc = getAFSServer(cellNamep, cellHostAddrs, cellHostNames, ipRanks, &numServers, ttl);
      if (rc == 0 && numServers > 0) {     /* found the cell */
          for (i = 0; i < numServers; i++) {
              memcpy(&vlSockAddr.sin_addr.s_addr, &cellHostAddrs[i],
***************
*** 354,365 ****
              vlSockAddr.sin_family = AF_INET;
              /* sin_port supplied by connection code */
              if (procp)
!                 (*procp)(rockp, &vlSockAddr, cellHostNames[i]);
!             if (newCellNamep) {
!                 strncpy(newCellNamep,cellNamep,CELL_MAXNAMELEN);
!                 newCellNamep[CELL_MAXNAMELEN-1] = '\0';
!                 strlwr(newCellNamep);
!             }
          }
          return 0;   /* found cell */
      }
--- 679,690 ----
              vlSockAddr.sin_family = AF_INET;
              /* sin_port supplied by connection code */
              if (procp)
!                 (*procp)(rockp, &vlSockAddr, cellHostNames[i], ipRanks[i]);
!         }
!         if (newCellNamep) {
!             strncpy(newCellNamep,cellNamep,CELL_MAXNAMELEN);
!             newCellNamep[CELL_MAXNAMELEN-1] = '\0';
!             strlwr(newCellNamep);
          }
          return 0;   /* found cell */
      }
Index: openafs/src/WINNT/afsd/cm_config.h
diff -c openafs/src/WINNT/afsd/cm_config.h:1.8.6.9 openafs/src/WINNT/afsd/cm_config.h:1.8.6.10
*** openafs/src/WINNT/afsd/cm_config.h:1.8.6.9	Mon Nov  3 14:56:06 2008
--- openafs/src/WINNT/afsd/cm_config.h	Mon May 25 18:06:37 2009
***************
*** 26,32 ****
  
  typedef FILE cm_configFile_t;
  
! typedef long (cm_configProc_t)(void *rockp, struct sockaddr_in *addrp, char *namep);
  
  extern long cm_GetRootCellName(char *namep);
  
--- 26,34 ----
  
  typedef FILE cm_configFile_t;
  
! typedef long (cm_configProc_t)(void *rockp, struct sockaddr_in *addrp, char *namep, unsigned short);
! 
! typedef long (cm_enumCellRegistryProc_t)(void *rockp, char *cellNamep);
  
  extern long cm_GetRootCellName(char *namep);
  
***************
*** 37,42 ****
--- 39,53 ----
                                  char *linkedNamep,
                                  cm_configProc_t *procp, void *rockp);
  
+ extern long cm_SearchCellRegistry(afs_uint32 client, 
+                                   char *cellNamep, char *newCellNamep,
+                                   char *linkedNamep,
+                                   cm_configProc_t *procp, void *rockp);
+ 
+ extern long cm_EnumerateCellRegistry(afs_uint32 client, 
+                                      cm_enumCellRegistryProc_t *procp, 
+                                      void *rockp);
+ 
  extern long cm_SearchCellByDNS(char *cellNamep, char *newCellNamep, int *ttl,
                                 cm_configProc_t *procp, void *rockp);
  
Index: openafs/src/WINNT/afsd/cm_conn.c
diff -c openafs/src/WINNT/afsd/cm_conn.c:1.49.2.55 openafs/src/WINNT/afsd/cm_conn.c:1.49.2.56
*** openafs/src/WINNT/afsd/cm_conn.c:1.49.2.55	Thu Feb 12 16:30:16 2009
--- openafs/src/WINNT/afsd/cm_conn.c	Mon May 11 10:16:32 2009
***************
*** 107,113 ****
  	    HardDeadtimeout = (unsigned short) RDRtimeout;
              afsi_log("HardDeadTimeout is %d", HardDeadtimeout);
          }
! 	if (ConnDeadtimeout == 0) {
  	    IdleDeadtimeout = (unsigned short) RDRtimeout;
              afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout);
          }
--- 107,113 ----
  	    HardDeadtimeout = (unsigned short) RDRtimeout;
              afsi_log("HardDeadTimeout is %d", HardDeadtimeout);
          }
! 	if (IdleDeadtimeout == 0) {
  	    IdleDeadtimeout = (unsigned short) RDRtimeout;
              afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout);
          }
***************
*** 604,610 ****
  
      /* RX codes */
      else if (errorCode == RX_CALL_TIMEOUT) {
!         /* server took longer than hardDeadTime 
           * don't mark server as down but don't retry
           * this is to prevent the SMB session from timing out
           * In addition, we log an event to the event log 
--- 604,611 ----
  
      /* RX codes */
      else if (errorCode == RX_CALL_TIMEOUT) {
!         /* RPC took longer than hardDeadTime or the server
!          * reported idle for longer than idleDeadTime
           * don't mark server as down but don't retry
           * this is to prevent the SMB session from timing out
           * In addition, we log an event to the event log 
***************
*** 620,630 ****
  
              LogEvent(EVENTLOG_WARNING_TYPE, MSG_RX_HARD_DEAD_TIME_EXCEEDED, addr);
  	  
!             osi_Log1(afsd_logp, "cm_Analyze: hardDeadTime exceeded addr[%s]",
                       osi_LogSaveString(afsd_logp,addr));
              reqp->tokenIdleErrorServp = serverp;
              reqp->idleError++;
-             retry = 1;
          }
      }
      else if (errorCode >= -64 && errorCode < 0) {
--- 621,630 ----
  
              LogEvent(EVENTLOG_WARNING_TYPE, MSG_RX_HARD_DEAD_TIME_EXCEEDED, addr);
  	  
!             osi_Log1(afsd_logp, "cm_Analyze: hardDeadTime or idleDeadTime exceeded addr[%s]",
                       osi_LogSaveString(afsd_logp,addr));
              reqp->tokenIdleErrorServp = serverp;
              reqp->idleError++;
          }
      }
      else if (errorCode >= -64 && errorCode < 0) {
Index: openafs/src/WINNT/afsd/cm_dcache.c
diff -c openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.35 openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.36
*** openafs/src/WINNT/afsd/cm_dcache.c:1.30.2.35	Tue Jan 27 12:06:23 2009
--- openafs/src/WINNT/afsd/cm_dcache.c	Mon May 11 12:22:35 2009
***************
*** 88,110 ****
  
      cm_AFSFidFromFid(&tfid, &scp->fid);
  
      code = cm_SetupStoreBIOD(scp, offsetp, length, &biod, userp, reqp);
      if (code) {
          osi_Log1(afsd_logp, "cm_SetupStoreBIOD code %x", code);
          lock_ReleaseWrite(&scp->rw);
          return code;
      }
  
      if (biod.length == 0) {
          osi_Log0(afsd_logp, "cm_SetupStoreBIOD length 0");
          lock_ReleaseWrite(&scp->rw);
-         cm_ReleaseBIOD(&biod, 1, 0);	/* should be a NOOP */
          return 0;
      }
  
-     /* Serialize StoreData RPC's; for rationale see cm_scache.c */
-     (void) cm_SyncOp(scp, NULL, userp, reqp, 0, CM_SCACHESYNC_STOREDATA_EXCL);
- 
      /* prepare the output status for the store */
      scp->mask |= CM_SCACHEMASK_CLIENTMODTIME;
      cm_StatusFromAttr(&inStatus, scp, NULL);
--- 88,112 ----
  
      cm_AFSFidFromFid(&tfid, &scp->fid);
  
+     /* Serialize StoreData RPC's; for rationale see cm_scache.c */
+     (void) cm_SyncOp(scp, NULL, userp, reqp, 0, CM_SCACHESYNC_STOREDATA_EXCL);
+ 
      code = cm_SetupStoreBIOD(scp, offsetp, length, &biod, userp, reqp);
      if (code) {
          osi_Log1(afsd_logp, "cm_SetupStoreBIOD code %x", code);
+         cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_STOREDATA_EXCL);
          lock_ReleaseWrite(&scp->rw);
          return code;
      }
  
      if (biod.length == 0) {
          osi_Log0(afsd_logp, "cm_SetupStoreBIOD length 0");
+         cm_ReleaseBIOD(&biod, 1, 0, 1);	/* should be a NOOP */
+         cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_STOREDATA_EXCL);
          lock_ReleaseWrite(&scp->rw);
          return 0;
      }
  
      /* prepare the output status for the store */
      scp->mask |= CM_SCACHEMASK_CLIENTMODTIME;
      cm_StatusFromAttr(&inStatus, scp, NULL);
***************
*** 261,266 ****
--- 263,269 ----
      /* now, clean up our state */
      lock_ObtainWrite(&scp->rw);
  
+     cm_ReleaseBIOD(&biod, 1, code, 1);
      cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_STOREDATA_EXCL);
  
      if (code == 0) {
***************
*** 302,308 ****
              scp->flags |= CM_SCACHEFLAG_OVERQUOTA;
      }
      lock_ReleaseWrite(&scp->rw);
-     cm_ReleaseBIOD(&biod, 1, code);
  
      return code;
  }
--- 305,310 ----
***************
*** 1254,1260 ****
  /* release a bulk I/O structure that was setup by cm_SetupFetchBIOD or by
   * cm_SetupStoreBIOD
   */
! void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed)
  {
      cm_scache_t *scp;		/* do not release; not held in biop */
      cm_buf_t *bufp;
--- 1256,1262 ----
  /* release a bulk I/O structure that was setup by cm_SetupFetchBIOD or by
   * cm_SetupStoreBIOD
   */
! void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed, int scp_locked)
  {
      cm_scache_t *scp;		/* do not release; not held in biop */
      cm_buf_t *bufp;
***************
*** 1285,1290 ****
--- 1287,1294 ----
  	    osi_QDFree(qdp);
  
  	    /* now, mark I/O as done, unlock the buffer and release it */
+             if (scp_locked)
+                 lock_ReleaseWrite(&scp->rw);
  	    lock_ObtainMutex(&bufp->mx);
  	    lock_ObtainWrite(&scp->rw);
  	    cm_SyncOpDone(scp, bufp, flags);
***************
*** 1303,1317 ****
                  }
  	    }
  
! 	    lock_ReleaseWrite(&scp->rw);
  	    lock_ReleaseMutex(&bufp->mx);
  	    buf_Release(bufp);
  	    bufp = NULL;
  	}
      } else {
! 	lock_ObtainWrite(&scp->rw);
  	cm_SyncOpDone(scp, NULL, flags);
! 	lock_ReleaseWrite(&scp->rw);
      }
  
      /* clean things out */
--- 1307,1324 ----
                  }
  	    }
  
!             if (!scp_locked)
!                 lock_ReleaseWrite(&scp->rw);
  	    lock_ReleaseMutex(&bufp->mx);
  	    buf_Release(bufp);
  	    bufp = NULL;
  	}
      } else {
! 	if (!scp_locked)
!             lock_ObtainWrite(&scp->rw);
  	cm_SyncOpDone(scp, NULL, flags);
!         if (!scp_locked)
!             lock_ReleaseWrite(&scp->rw);
      }
  
      /* clean things out */
***************
*** 1394,1411 ****
                  memset(bufp->datap, 0, cm_data.buf_blockSize);
              bufp->dataVersion = scp->dataVersion;
          }
!         lock_ReleaseWrite(&scp->rw);
!         cm_ReleaseBIOD(&biod, 0, 0);
!         lock_ObtainWrite(&scp->rw);
          return 0;
      } else if ((bufp->dataVersion == CM_BUF_VERSION_BAD || bufp->dataVersion < scp->bufDataVersionLow)
                  && (scp->mask & CM_SCACHEMASK_TRUNCPOS) &&
                  LargeIntegerGreaterThanOrEqualTo(bufp->offset, scp->truncPos)) {
          memset(bufp->datap, 0, cm_data.buf_blockSize);
          bufp->dataVersion = scp->dataVersion;
!         lock_ReleaseWrite(&scp->rw);
!         cm_ReleaseBIOD(&biod, 0, 0);
!         lock_ObtainWrite(&scp->rw);
          return 0;
      }
  
--- 1401,1414 ----
                  memset(bufp->datap, 0, cm_data.buf_blockSize);
              bufp->dataVersion = scp->dataVersion;
          }
!         cm_ReleaseBIOD(&biod, 0, 0, 1);
          return 0;
      } else if ((bufp->dataVersion == CM_BUF_VERSION_BAD || bufp->dataVersion < scp->bufDataVersionLow)
                  && (scp->mask & CM_SCACHEMASK_TRUNCPOS) &&
                  LargeIntegerGreaterThanOrEqualTo(bufp->offset, scp->truncPos)) {
          memset(bufp->datap, 0, cm_data.buf_blockSize);
          bufp->dataVersion = scp->dataVersion;
!         cm_ReleaseBIOD(&biod, 0, 0, 1);
          return 0;
      }
  
***************
*** 1711,1719 ****
      }
  
      /* release scatter/gather I/O structure (buffers, locks) */
!     lock_ReleaseWrite(&scp->rw);
!     cm_ReleaseBIOD(&biod, 0, code);
!     lock_ObtainWrite(&scp->rw);
  
      if (code == 0) 
          cm_MergeStatus(NULL, scp, &afsStatus, &volSync, userp, 0);
--- 1714,1720 ----
      }
  
      /* release scatter/gather I/O structure (buffers, locks) */
!     cm_ReleaseBIOD(&biod, 0, code, 1);
  
      if (code == 0) 
          cm_MergeStatus(NULL, scp, &afsStatus, &volSync, userp, 0);
Index: openafs/src/WINNT/afsd/cm_dcache.h
diff -c openafs/src/WINNT/afsd/cm_dcache.h:1.4.4.6 openafs/src/WINNT/afsd/cm_dcache.h:1.4.4.7
*** openafs/src/WINNT/afsd/cm_dcache.h:1.4.4.6	Thu Feb 28 12:17:15 2008
--- openafs/src/WINNT/afsd/cm_dcache.h	Mon May 11 12:22:35 2009
***************
*** 38,44 ****
  extern long cm_SetupFetchBIOD(cm_scache_t *scp, osi_hyper_t *offsetp,
  	cm_bulkIO_t *biop, cm_user_t *up, cm_req_t *reqp);
  
! extern void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed);
  
  extern long cm_SetupStoreBIOD(cm_scache_t *scp, osi_hyper_t *inOffsetp,
  	long inSize, cm_bulkIO_t *biop, cm_user_t *userp, cm_req_t *reqp);
--- 38,44 ----
  extern long cm_SetupFetchBIOD(cm_scache_t *scp, osi_hyper_t *offsetp,
  	cm_bulkIO_t *biop, cm_user_t *up, cm_req_t *reqp);
  
! extern void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed, int scp_locked);
  
  extern long cm_SetupStoreBIOD(cm_scache_t *scp, osi_hyper_t *inOffsetp,
  	long inSize, cm_bulkIO_t *biop, cm_user_t *userp, cm_req_t *reqp);
Index: openafs/src/WINNT/afsd/cm_dns.c
diff -c openafs/src/WINNT/afsd/cm_dns.c:1.12.4.5 openafs/src/WINNT/afsd/cm_dns.c:1.12.4.6
*** openafs/src/WINNT/afsd/cm_dns.c:1.12.4.5	Wed Aug  6 01:11:31 2008
--- openafs/src/WINNT/afsd/cm_dns.c	Mon May 25 18:06:37 2009
***************
*** 482,488 ****
  
  };
  
! void processReplyBuffer_AFSDB(SOCKET commSock, PDNS_HDR replyBuff, int *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS], int *numServers, int *ttl)
    /*PAFS_SRV_LIST (srvList)*/
  {
    u_char *ptr = (u_char *) replyBuff;
--- 482,489 ----
  
  };
  
! void processReplyBuffer_AFSDB(SOCKET commSock, PDNS_HDR replyBuff, int *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS], 
!                               unsigned short ipRanks[], int *numServers, int *ttl)
    /*PAFS_SRV_LIST (srvList)*/
  {
    u_char *ptr = (u_char *) replyBuff;
***************
*** 535,540 ****
--- 536,542 ----
        memcpy(&cellHostAddrs[srvCount], &addr.s_addr, sizeof(addr.s_addr));
  	  strncpy(cellHostNames[srvCount], hostName, CELL_MAXNAMELEN);
  	  cellHostNames[srvCount][CELL_MAXNAMELEN-1] = '\0';
+       ipRanks[srvCount] = 0;
        srvCount++;
      }
      else {
***************
*** 621,627 ****
  #endif /* DNSAPI_ENV */
  
  int getAFSServer(char *cellName, int *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS], 
!                  int *numServers, int *ttl)
  {
  #ifndef DNSAPI_ENV
      SOCKET commSock;
--- 623,629 ----
  #endif /* DNSAPI_ENV */
  
  int getAFSServer(char *cellName, int *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS], 
!                  unsigned short ipRanks[], int *numServers, int *ttl)
  {
  #ifndef DNSAPI_ENV
      SOCKET commSock;
***************
*** 664,669 ****
--- 666,672 ----
  
      rc = send_DNS_AFSDB_Query(cellName,commSock,sockAddr, buffer);
      if (rc < 0) {
+         closesocket(commSock);
          fprintf(stderr,"getAFSServer: send_DNS_AFSDB_Query failed\n");
          *numServers = 0;
          return -1;
***************
*** 673,679 ****
    
      /*printReplyBuffer_AFSDB(pDNShdr);*/
      if (pDNShdr)
!         processReplyBuffer_AFSDB(commSock, pDNShdr, cellHostAddrs, cellHostNames, numServers, ttl);
      else
          *numServers = 0;
  
--- 676,682 ----
    
      /*printReplyBuffer_AFSDB(pDNShdr);*/
      if (pDNShdr)
!         processReplyBuffer_AFSDB(commSock, pDNShdr, cellHostAddrs, cellHostNames, ipRanks, numServers, ttl);
      else
          *numServers = 0;
  
***************
*** 683,689 ****
      else
          return 0;
  #else /* DNSAPI_ENV */
!     PDNS_RECORD pDnsCell, pDnsIter, pDnsVol,pDnsVolIter, pDnsCIter;
      int i;
      struct sockaddr_in vlSockAddr;
      char query[1024];
--- 686,692 ----
      else
          return 0;
  #else /* DNSAPI_ENV */
!     PDNS_RECORD pDnsCell, pDnsIter, pDnsVol, pDnsVolIter, pDnsCIter;
      int i;
      struct sockaddr_in vlSockAddr;
      char query[1024];
***************
*** 707,716 ****
  
          /* go through the returned records */
          for (pDnsIter = pDnsCell;pDnsIter; pDnsIter = pDnsIter->pNext) {
!             /* if we find an AFSDB record with Preference set to 1, we found a volserver */
              if (pDnsIter->wType == DNS_TYPE_AFSDB && pDnsIter->Data.Afsdb.wPreference == 1) {
                  StringCbCopyA(cellHostNames[*numServers], sizeof(cellHostNames[*numServers]),
                                pDnsIter->Data.Afsdb.pNameExchange);
                  (*numServers)++;
                  
                  if (!*ttl) 
--- 710,720 ----
  
          /* go through the returned records */
          for (pDnsIter = pDnsCell;pDnsIter; pDnsIter = pDnsIter->pNext) {
!             /* if we find an AFSDB record with Preference set to 1, we found a afs3-vlserver */
              if (pDnsIter->wType == DNS_TYPE_AFSDB && pDnsIter->Data.Afsdb.wPreference == 1) {
                  StringCbCopyA(cellHostNames[*numServers], sizeof(cellHostNames[*numServers]),
                                pDnsIter->Data.Afsdb.pNameExchange);
+                 ipRanks[*numServers] = 0;
                  (*numServers)++;
                  
                  if (!*ttl) 
***************
*** 726,739 ****
          /* now check if there are any A records in the results */
          for (pDnsIter = pDnsCell; pDnsIter; pDnsIter = pDnsIter->pNext) {
              if(pDnsIter->wType == DNS_TYPE_A)
!                 /* check if its for one of the volservers */
                  for (i=0;i<*numServers;i++)
                      if(cm_stricmp_utf8(pDnsIter->pName, cellHostNames[i]) == 0)
                          cellHostAddrs[i] = pDnsIter->Data.A.IpAddress;
          }
  
          for (i=0;i<*numServers;i++) {
!             /* if we don't have an IP yet, then we should try resolving the volserver hostname
              in a separate query. */
              if (!cellHostAddrs[i]) {
                  if (DnsQuery_A(cellHostNames[i], DNS_TYPE_A, DNS_QUERY_STANDARD, NULL, &pDnsVol, NULL) == ERROR_SUCCESS) {
--- 730,743 ----
          /* now check if there are any A records in the results */
          for (pDnsIter = pDnsCell; pDnsIter; pDnsIter = pDnsIter->pNext) {
              if(pDnsIter->wType == DNS_TYPE_A)
!                 /* check if its for one of the afs3-vlservers */
                  for (i=0;i<*numServers;i++)
                      if(cm_stricmp_utf8(pDnsIter->pName, cellHostNames[i]) == 0)
                          cellHostAddrs[i] = pDnsIter->Data.A.IpAddress;
          }
  
          for (i=0;i<*numServers;i++) {
!             /* if we don't have an IP yet, then we should try resolving the afs3-vlserver hostname
              in a separate query. */
              if (!cellHostAddrs[i]) {
                  if (DnsQuery_A(cellHostNames[i], DNS_TYPE_A, DNS_QUERY_STANDARD, NULL, &pDnsVol, NULL) == ERROR_SUCCESS) {
***************
*** 756,768 ****
                              /* TODO: if the additional section is missing, then do another lookup for the CNAME */
                          }
                      }
!                     /* we are done with the volserver lookup */
                      DnsRecordListFree(pDnsVol, DnsFreeRecordListDeep);
                  }
              }
          }
          DnsRecordListFree(pDnsCell, DnsFreeRecordListDeep);
      }
  
      if ( *numServers > 0 )
          return 0;
--- 760,842 ----
                              /* TODO: if the additional section is missing, then do another lookup for the CNAME */
                          }
                      }
!                     /* we are done with the afs3-vlserver lookup */
                      DnsRecordListFree(pDnsVol, DnsFreeRecordListDeep);
                  }
              }
          }
          DnsRecordListFree(pDnsCell, DnsFreeRecordListDeep);
      }
+     else {
+         /* query the SRV _afs3-vlserver._udp records of cell */
+         StringCbPrintf(query, sizeof(query), "_afs3-vlserver._udp.%s", cellName);
+         if (query[strlen(query)-1] != '.') {
+             StringCbCatA(query, sizeof(query), ".");
+         }
+         
+         if (DnsQuery_A(query, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &pDnsCell, NULL) == ERROR_SUCCESS) {
+             memset((void*) &vlSockAddr, 0, sizeof(vlSockAddr));
+ 
+             /* go through the returned records */
+             for (pDnsIter = pDnsCell;pDnsIter; pDnsIter = pDnsIter->pNext) {
+                 /* if we find an SRV record, we found a afs3-vlserver */
+                 if (pDnsIter->wType == DNS_TYPE_SRV) {
+                     StringCbCopyA(cellHostNames[*numServers], sizeof(cellHostNames[*numServers]),
+                                    pDnsIter->Data.SRV.pNameTarget);
+                     ipRanks[*numServers] = pDnsIter->Data.SRV.wPriority;
+                     (*numServers)++;
+ 
+                     if (!*ttl) 
+                         *ttl = pDnsIter->dwTtl;
+                     if (*numServers == AFSMAXCELLHOSTS) 
+                         break;
+                 }
+             }
+ 
+             for (i=0;i<*numServers;i++) 
+                 cellHostAddrs[i] = 0;
+ 
+             /* now check if there are any A records in the results */
+             for (pDnsIter = pDnsCell; pDnsIter; pDnsIter = pDnsIter->pNext) {
+                 if(pDnsIter->wType == DNS_TYPE_A)
+                     /* check if its for one of the afs3-vlservers */
+                     for (i=0;i<*numServers;i++)
+                         if(cm_stricmp_utf8(pDnsIter->pName, cellHostNames[i]) == 0)
+                             cellHostAddrs[i] = pDnsIter->Data.A.IpAddress;
+             }
+ 
+             for (i=0;i<*numServers;i++) {
+                 /* if we don't have an IP yet, then we should try resolving the afs3-vlserver hostname
+                 in a separate query. */
+                 if (!cellHostAddrs[i]) {
+                     if (DnsQuery_A(cellHostNames[i], DNS_TYPE_A, DNS_QUERY_STANDARD, NULL, &pDnsVol, NULL) == ERROR_SUCCESS) {
+                         for (pDnsVolIter = pDnsVol; pDnsVolIter; pDnsVolIter=pDnsVolIter->pNext) {
+                             /* if we get an A record, keep it */
+                             if (pDnsVolIter->wType == DNS_TYPE_A && cm_stricmp_utf8(cellHostNames[i], pDnsVolIter->pName)==0) {
+                                 cellHostAddrs[i] = pDnsVolIter->Data.A.IpAddress;
+                                 break;
+                             }
+                             /* if we get a CNAME, look for a corresponding A record */
+                             if (pDnsVolIter->wType == DNS_TYPE_CNAME && cm_stricmp_utf8(cellHostNames[i], pDnsVolIter->pName)==0) {
+                                 for (pDnsCIter=pDnsVolIter; pDnsCIter; pDnsCIter=pDnsCIter->pNext) {
+                                     if (pDnsCIter->wType == DNS_TYPE_A && cm_stricmp_utf8(pDnsVolIter->Data.CNAME.pNameHost, pDnsCIter->pName)==0) {
+                                         cellHostAddrs[i] = pDnsCIter->Data.A.IpAddress;
+                                         break;
+                                     }
+                                 }
+                                 if (cellHostAddrs[i]) 
+                                     break;
+                                 /* TODO: if the additional section is missing, then do another lookup for the CNAME */
+                             }
+                         }
+                         /* we are done with the afs3-vlserver lookup */
+                         DnsRecordListFree(pDnsVol, DnsFreeRecordListDeep);
+                     }
+                 }
+             }
+             DnsRecordListFree(pDnsCell, DnsFreeRecordListDeep);
+         }
+     }
  
      if ( *numServers > 0 )
          return 0;
***************
*** 773,778 ****
--- 847,853 ----
  
  int getAFSServerW(cm_unichar_t *cellName, int *cellHostAddrs,
                    cm_unichar_t cellHostNames[][MAXHOSTCHARS], 
+                   unsigned short ipRanks[],
                    int *numServers, int *ttl)
  {
  #ifdef DNSAPI_ENV
***************
*** 801,810 ****
  
          /* go through the returned records */
          for (pDnsIter = pDnsCell;pDnsIter; pDnsIter = pDnsIter->pNext) {
!             /* if we find an AFSDB record with Preference set to 1, we found a volserver */
              if (pDnsIter->wType == DNS_TYPE_AFSDB && pDnsIter->Data.Afsdb.wPreference == 1) {
                  StringCbCopyW(cellHostNames[*numServers], sizeof(cellHostNames[*numServers]),
                                pDnsIter->Data.Afsdb.pNameExchange);
                  (*numServers)++;
                  
                  if (!*ttl) 
--- 876,886 ----
  
          /* go through the returned records */
          for (pDnsIter = pDnsCell;pDnsIter; pDnsIter = pDnsIter->pNext) {
!             /* if we find an AFSDB record with Preference set to 1, we found a afs3-vlserver */
              if (pDnsIter->wType == DNS_TYPE_AFSDB && pDnsIter->Data.Afsdb.wPreference == 1) {
                  StringCbCopyW(cellHostNames[*numServers], sizeof(cellHostNames[*numServers]),
                                pDnsIter->Data.Afsdb.pNameExchange);
+                 ipRanks[*numServers] = 0;
                  (*numServers)++;
                  
                  if (!*ttl) 
***************
*** 820,833 ****
          /* now check if there are any A records in the results */
          for (pDnsIter = pDnsCell; pDnsIter; pDnsIter = pDnsIter->pNext) {
              if(pDnsIter->wType == DNS_TYPE_A)
!                 /* check if its for one of the volservers */
                  for (i=0;i<*numServers;i++)
                      if(cm_stricmp_utf16(pDnsIter->pName, cellHostNames[i]) == 0)
                          cellHostAddrs[i] = pDnsIter->Data.A.IpAddress;
          }
  
          for (i=0;i<*numServers;i++) {
!             /* if we don't have an IP yet, then we should try resolving the volserver hostname
                 in a separate query. */
              if (!cellHostAddrs[i]) {
                  if (DnsQuery_W(cellHostNames[i], DNS_TYPE_A, DNS_QUERY_STANDARD, NULL,
--- 896,909 ----
          /* now check if there are any A records in the results */
          for (pDnsIter = pDnsCell; pDnsIter; pDnsIter = pDnsIter->pNext) {
              if(pDnsIter->wType == DNS_TYPE_A)
!                 /* check if its for one of the afs3-vlservers */
                  for (i=0;i<*numServers;i++)
                      if(cm_stricmp_utf16(pDnsIter->pName, cellHostNames[i]) == 0)
                          cellHostAddrs[i] = pDnsIter->Data.A.IpAddress;
          }
  
          for (i=0;i<*numServers;i++) {
!             /* if we don't have an IP yet, then we should try resolving the afs3-vlserver hostname
                 in a separate query. */
              if (!cellHostAddrs[i]) {
                  if (DnsQuery_W(cellHostNames[i], DNS_TYPE_A, DNS_QUERY_STANDARD, NULL,
***************
*** 851,863 ****
                              /* TODO: if the additional section is missing, then do another lookup for the CNAME */
                          }
                      }
!                     /* we are done with the volserver lookup */
                      DnsRecordListFree((PDNS_RECORD) pDnsVol, DnsFreeRecordListDeep);
                  }
              }
          }
          DnsRecordListFree((PDNS_RECORD) pDnsCell, DnsFreeRecordListDeep);
      }
  
      if ( *numServers > 0 )
          return 0;
--- 927,1011 ----
                              /* TODO: if the additional section is missing, then do another lookup for the CNAME */
                          }
                      }
!                     /* we are done with the afs3-vlserver lookup */
                      DnsRecordListFree((PDNS_RECORD) pDnsVol, DnsFreeRecordListDeep);
                  }
              }
          }
          DnsRecordListFree((PDNS_RECORD) pDnsCell, DnsFreeRecordListDeep);
      }
+     else {
+         /* query the SRV _afs3-vlserver._udp records of cell */
+         StringCbPrintfW(query, sizeof(query), L"_afs3-vlserver._udp.%S", cellName);
+         if (query[wcslen(query)-1] != L'.') {
+             StringCbCatW(query, sizeof(query), L".");
+         }
+ 
+         if (DnsQuery_W(query, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, (PDNS_RECORD *) &pDnsCell,
+                         NULL) == ERROR_SUCCESS) {
+             memset((void*) &vlSockAddr, 0, sizeof(vlSockAddr));
+ 
+             /* go through the returned records */
+             for (pDnsIter = pDnsCell; pDnsIter; pDnsIter = pDnsIter->pNext) {
+                 /* if we find an SRV record, we found a afs3-vlserver */
+                 if (pDnsIter->wType == DNS_TYPE_SRV) {
+                     StringCbCopyW(cellHostNames[*numServers], sizeof(cellHostNames[*numServers]),
+                                    pDnsIter->Data.SRV.pNameTarget);
+                     ipRanks[*numServers] = pDnsIter->Data.SRV.wPriority;
+                     (*numServers)++;
+                 
+                     if (!*ttl) 
+                         *ttl = pDnsIter->dwTtl;
+                     if (*numServers == AFSMAXCELLHOSTS) 
+                         break;
+                 }
+             }
+ 
+             for (i=0;i<*numServers;i++) 
+                 cellHostAddrs[i] = 0;
+ 
+             /* now check if there are any A records in the results */
+             for (pDnsIter = pDnsCell; pDnsIter; pDnsIter = pDnsIter->pNext) {
+                 if(pDnsIter->wType == DNS_TYPE_A)
+                     /* check if its for one of the afs3-vlservers */
+                     for (i=0;i<*numServers;i++)
+                         if(cm_stricmp_utf16(pDnsIter->pName, cellHostNames[i]) == 0)
+                             cellHostAddrs[i] = pDnsIter->Data.A.IpAddress;
+             }
+ 
+             for (i=0;i<*numServers;i++) {
+                 /* if we don't have an IP yet, then we should try resolving the afs3-vlserver hostname
+                 in a separate query. */
+                 if (!cellHostAddrs[i]) {
+                     if (DnsQuery_W(cellHostNames[i], DNS_TYPE_A, DNS_QUERY_STANDARD, NULL,
+                                     (PDNS_RECORD *) &pDnsVol, NULL) == ERROR_SUCCESS) {
+                         for (pDnsVolIter = pDnsVol; pDnsVolIter; pDnsVolIter=pDnsVolIter->pNext) {
+                             /* if we get an A record, keep it */
+                             if (pDnsVolIter->wType == DNS_TYPE_A && cm_stricmp_utf16(cellHostNames[i], pDnsVolIter->pName)==0) {
+                                 cellHostAddrs[i] = pDnsVolIter->Data.A.IpAddress;
+                                 break;
+                             }
+                             /* if we get a CNAME, look for a corresponding A record */
+                             if (pDnsVolIter->wType == DNS_TYPE_CNAME && cm_stricmp_utf16(cellHostNames[i], pDnsVolIter->pName)==0) {
+                                 for (pDnsCIter=pDnsVolIter; pDnsCIter; pDnsCIter=pDnsCIter->pNext) {
+                                     if (pDnsCIter->wType == DNS_TYPE_A && cm_stricmp_utf16(pDnsVolIter->Data.CNAME.pNameHost, pDnsCIter->pName)==0) {
+                                         cellHostAddrs[i] = pDnsCIter->Data.A.IpAddress;
+                                         break;
+                                     }
+                                 }
+                                 if (cellHostAddrs[i]) 
+                                     break;
+                                 /* TODO: if the additional section is missing, then do another lookup for the CNAME */
+                             }
+                         }
+                         /* we are done with the afs3-vlserver lookup */
+                         DnsRecordListFree((PDNS_RECORD) pDnsVol, DnsFreeRecordListDeep);
+                     }
+                 }
+             }
+             DnsRecordListFree((PDNS_RECORD) pDnsCell, DnsFreeRecordListDeep);
+         }
+     }
  
      if ( *numServers > 0 )
          return 0;
Index: openafs/src/WINNT/afsd/cm_dns.h
diff -c openafs/src/WINNT/afsd/cm_dns.h:1.2.14.1 openafs/src/WINNT/afsd/cm_dns.h:1.2.14.2
*** openafs/src/WINNT/afsd/cm_dns.h:1.2.14.1	Thu Jun 26 12:38:29 2008
--- openafs/src/WINNT/afsd/cm_dns.h	Mon May 25 18:06:37 2009
***************
*** 13,24 ****
  
  /* this function will continue to return cell server
     names for the given cell, ending in null */
! int getAFSServer(char *cellname, int *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS], int *numServers, int *ttl);
  
  /* Same as above, but using cm_unichar_t.  Note that this functon will
     only be defined for DNSAPI_ENV. */
  int getAFSServerW(cm_unichar_t *cellName, int *cellHostAddrs,
                    cm_unichar_t cellHostNames[][MAXHOSTCHARS], 
                    int *numServers, int *ttl);
  
  /* a supplement for the DJGPP gethostbyname ... which 
--- 13,26 ----
  
  /* this function will continue to return cell server
     names for the given cell, ending in null */
! int getAFSServer(char *cellname, int *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS], 
!                  unsigned short ipRanks[], int *numServers, int *ttl);
  
  /* Same as above, but using cm_unichar_t.  Note that this functon will
     only be defined for DNSAPI_ENV. */
  int getAFSServerW(cm_unichar_t *cellName, int *cellHostAddrs,
                    cm_unichar_t cellHostNames[][MAXHOSTCHARS], 
+                   unsigned short ipRanks[],
                    int *numServers, int *ttl);
  
  /* a supplement for the DJGPP gethostbyname ... which 
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.69 openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.72
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.73.2.69	Sat Mar 14 00:59:34 2009
--- openafs/src/WINNT/afsd/cm_ioctl.c	Mon May 25 18:06:37 2009
***************
*** 102,111 ****
  
      code = buf_FlushCleanPages(scp, userp, reqp);
          
      lock_ObtainWrite(&scp->rw);
      cm_DiscardSCache(scp);
!     if (scp->fileType == CM_SCACHETYPE_DIRECTORY)
!         cm_ResetSCacheDirectory(scp);
      lock_ReleaseWrite(&scp->rw);
  
      osi_Log2(afsd_logp,"cm_FlushFile scp 0x%x returns error: [%x]",scp, code);
--- 102,115 ----
  
      code = buf_FlushCleanPages(scp, userp, reqp);
          
+     if (scp->fileType == CM_SCACHETYPE_DIRECTORY)
+         lock_ObtainWrite(&scp->dirlock);
      lock_ObtainWrite(&scp->rw);
      cm_DiscardSCache(scp);
!     if (scp->fileType == CM_SCACHETYPE_DIRECTORY) {
!         cm_ResetSCacheDirectory(scp, 1);
!         lock_ReleaseWrite(&scp->dirlock);
!     }
      lock_ReleaseWrite(&scp->rw);
  
      osi_Log2(afsd_logp,"cm_FlushFile scp 0x%x returns error: [%x]",scp, code);
***************
*** 1404,1410 ****
  
          rock.cellp = cp;
          rock.flags = 0;
!         code = cm_SearchCellFileEx(cp->name, cp->name, cp->linkedName, cm_AddCellProc, &rock);
  #ifdef AFS_AFSDB_ENV
          if (code) {
              if (cm_dnsEnabled) {
--- 1408,1416 ----
  
          rock.cellp = cp;
          rock.flags = 0;
!         code = cm_SearchCellRegistry(1, cp->name, cp->name, cp->linkedName, cm_AddCellProc, &rock);
!         if (code && code != CM_ERROR_FORCE_DNS_LOOKUP)
!             code = cm_SearchCellFileEx(cp->name, cp->name, cp->linkedName, cm_AddCellProc, &rock);
  #ifdef AFS_AFSDB_ENV
          if (code) {
              if (cm_dnsEnabled) {
Index: openafs/src/WINNT/afsd/cm_scache.c
diff -c openafs/src/WINNT/afsd/cm_scache.c:1.35.2.91 openafs/src/WINNT/afsd/cm_scache.c:1.35.2.92
*** openafs/src/WINNT/afsd/cm_scache.c:1.35.2.91	Sat Feb 28 11:19:26 2009
--- openafs/src/WINNT/afsd/cm_scache.c	Fri May 22 10:48:21 2009
***************
*** 76,92 ****
  }
  
  /* called with cm_scacheLock and scp write-locked */
! void cm_ResetSCacheDirectory(cm_scache_t *scp)
  {
  #ifdef USE_BPLUS
      /* destroy directory Bplus Tree */
      if (scp->dirBplus) {
          LARGE_INTEGER start, end;
          QueryPerformanceCounter(&start);
          bplus_free_tree++;
          freeBtree(scp->dirBplus);
          scp->dirBplus = NULL;
          QueryPerformanceCounter(&end);
  
          bplus_free_time += (end.QuadPart - start.QuadPart);
      }
--- 76,111 ----
  }
  
  /* called with cm_scacheLock and scp write-locked */
! void cm_ResetSCacheDirectory(cm_scache_t *scp, afs_int32 dirlock)
  {
  #ifdef USE_BPLUS
      /* destroy directory Bplus Tree */
      if (scp->dirBplus) {
          LARGE_INTEGER start, end;
+ 
+         if (!dirlock && !lock_TryWrite(&scp->dirlock)) {
+             /* 
+              * We are not holding the dirlock and obtaining it
+              * requires that we drop the scp->rw.  As a result
+              * we will leave the dirBplus tree intact but 
+              * invalidate the version number so that whatever
+              * operation is currently active can safely complete
+              * but the contents will be ignored on the next 
+              * directory operation.
+              */
+             scp->dirDataVersion = CM_SCACHE_VERSION_BAD;
+             return;
+         }
+ 
          QueryPerformanceCounter(&start);
          bplus_free_tree++;
          freeBtree(scp->dirBplus);
          scp->dirBplus = NULL;
+         scp->dirDataVersion = CM_SCACHE_VERSION_BAD;
          QueryPerformanceCounter(&end);
+         
+         if (!dirlock) 
+             lock_ReleaseWrite(&scp->dirlock);
  
          bplus_free_time += (end.QuadPart - start.QuadPart);
      }
***************
*** 222,228 ****
       */
      cm_FreeAllACLEnts(scp);
  
!     cm_ResetSCacheDirectory(scp);
      return 0;
  }
  
--- 241,247 ----
       */
      cm_FreeAllACLEnts(scp);
  
!     cm_ResetSCacheDirectory(scp, 0);
      return 0;
  }
  
Index: openafs/src/WINNT/afsd/cm_scache.h
diff -c openafs/src/WINNT/afsd/cm_scache.h:1.21.2.31 openafs/src/WINNT/afsd/cm_scache.h:1.21.2.32
*** openafs/src/WINNT/afsd/cm_scache.h:1.21.2.31	Sat Feb 28 11:19:26 2009
--- openafs/src/WINNT/afsd/cm_scache.h	Fri May 22 10:48:21 2009
***************
*** 419,423 ****
  
  extern int cm_DumpSCache(FILE *outputFile, char *cookie, int lock);
  
! extern void cm_ResetSCacheDirectory(cm_scache_t *scp);
  #endif /*  __CM_SCACHE_H_ENV__ */
--- 419,423 ----
  
  extern int cm_DumpSCache(FILE *outputFile, char *cookie, int lock);
  
! extern void cm_ResetSCacheDirectory(cm_scache_t *scp, afs_int32 locked);
  #endif /*  __CM_SCACHE_H_ENV__ */
Index: openafs/src/WINNT/afsd/fs.c
diff -c openafs/src/WINNT/afsd/fs.c:1.32.4.27 openafs/src/WINNT/afsd/fs.c:1.32.4.29
*** openafs/src/WINNT/afsd/fs.c:1.32.4.27	Sun Nov 30 15:24:38 2008
--- openafs/src/WINNT/afsd/fs.c	Mon May 11 10:04:52 2009
***************
*** 246,258 ****
  InAFS(char *apath)
  {
      struct ViceIoctl blob;
      afs_int32 code;
  
!     blob.in_size = 0;
!     blob.out_size = MAXSIZE;
!     blob.out = space;
  
!     code = pioctl_utf8(apath, VIOC_FILE_CELL_NAME, &blob, 1);
      if (code) {
  	if ((errno == EINVAL) || (errno == ENOENT)) 
              return 0;
--- 246,265 ----
  InAFS(char *apath)
  {
      struct ViceIoctl blob;
+     cm_ioctlQueryOptions_t options;
+     cm_fid_t fid;
      afs_int32 code;
  
!     memset(&options, 0, sizeof(options));
!     options.size = sizeof(options);
!     options.field_flags |= CM_IOCTL_QOPTS_FIELD_LITERAL;
!     options.literal = 1;
!     blob.in_size = options.size;    /* no variable length data */
!     blob.in = &options;
!     blob.out_size = sizeof(cm_fid_t);
!     blob.out = (char *) &fid;
  
!     code = pioctl_utf8(apath, VIOCGETFID, &blob, 1);
      if (code) {
  	if ((errno == EINVAL) || (errno == ENOENT)) 
              return 0;
***************
*** 3779,3784 ****
--- 3786,3849 ----
  }
  
  static int
+ GetFidCmd(struct cmd_syndesc *as, void *arock)
+ {
+     afs_int32 code;
+     struct ViceIoctl blob;
+     struct cmd_item *ti;
+     int error = 0;
+     int literal = 0;
+     cm_ioctlQueryOptions_t options;
+ 
+     if (as->parms[1].items)
+         literal = 1;
+ 
+     SetDotDefault(&as->parms[0].items);
+     for(ti=as->parms[0].items; ti; ti=ti->next) {
+         cm_fid_t fid;
+         afs_uint32 filetype;
+ 	afs_uint32 owner[2];
+ 	char cell[CELL_MAXNAMELEN];
+ 
+         /* once per file */
+         memset(&fid, 0, sizeof(fid));
+         memset(&options, 0, sizeof(options));
+         filetype = 0;
+         options.size = sizeof(options);
+         options.field_flags |= CM_IOCTL_QOPTS_FIELD_LITERAL;
+         options.literal = literal;
+ 	blob.in_size = options.size;    /* no variable length data */
+         blob.in = &options;
+ 
+         blob.out_size = sizeof(cm_fid_t);
+         blob.out = (char *) &fid;
+         if (0 == pioctl_utf8(ti->data, VIOCGETFID, &blob, 1)) {
+             options.field_flags |= CM_IOCTL_QOPTS_FIELD_FID;
+             options.fid = fid;
+         } else {
+ 	    Die(errno, ti->data);
+ 	    error = 1;
+ 	    continue;
+         }
+ 
+         blob.out_size = sizeof(filetype);
+         blob.out = &filetype;
+ 
+         code = pioctl_utf8(ti->data, VIOC_GETFILETYPE, &blob, 1);
+ 
+         blob.out_size = CELL_MAXNAMELEN;
+         blob.out = cell;
+ 
+         code = pioctl_utf8(ti->data, VIOC_FILE_CELL_NAME, &blob, 1);
+         printf("%s %s (%u.%u.%u) contained in cell %s\n",
+                 filetypestr(filetype),
+                 ti->data, fid.volume, fid.vnode, fid.unique,
+                 code ? "unknown-cell" : cell);
+     }
+     return error;
+ }
+ 
+ static int
  UuidCmd(struct cmd_syndesc *asp, void *arock)
  {
      long code;
***************
*** 5002,5007 ****
--- 5067,5076 ----
      cmd_AddParm(ts, "-on", CMD_FLAG, CMD_OPTIONAL, "enable Unicode on new connections");
      cmd_AddParm(ts, "-off", CMD_FLAG, CMD_OPTIONAL, "disable Unicode on new connections");
  
+     ts = cmd_CreateSyntax("getfid", GetFidCmd, NULL, "get file id for object(s) in afs");
+     cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
+     cmd_AddParm(ts, "-literal", CMD_FLAG, CMD_OPTIONAL, "literal evaluation of mountpoints and symlinks");
+ 
      code = cmd_Dispatch(argc, argv);
  
      if (rxInitDone) 
Index: openafs/src/WINNT/afsd/libafsconf.def
diff -c openafs/src/WINNT/afsd/libafsconf.def:1.4.6.2 openafs/src/WINNT/afsd/libafsconf.def:1.4.6.3
*** openafs/src/WINNT/afsd/libafsconf.def:1.4.6.2	Mon Nov  3 14:56:07 2008
--- openafs/src/WINNT/afsd/libafsconf.def	Mon May 25 18:06:37 2009
***************
*** 25,27 ****
--- 25,29 ----
          afs_uuid_equal                  @18
          cm_GetCellServDB                @19
  	cm_SearchCellFileEx		@20
+         cm_SearchCellRegistry           @21
+         cm_EnumerateCellRegistry        @22
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.118.2.124 openafs/src/WINNT/afsd/smb.c:1.118.2.127
*** openafs/src/WINNT/afsd/smb.c:1.118.2.124	Sat Apr  4 16:16:36 2009
--- openafs/src/WINNT/afsd/smb.c	Mon May 25 18:06:37 2009
***************
*** 2095,2101 ****
          }
          /* Get the full name for this cell */
          cellname = cm_ClientStringToFsStringAlloc(p, -1, NULL);
!         code = cm_SearchCellFile(cellname, ftemp, 0, 0);
  #ifdef AFS_AFSDB_ENV
          if (code && cm_dnsEnabled) {
              int ttl;
--- 2095,2103 ----
          }
          /* Get the full name for this cell */
          cellname = cm_ClientStringToFsStringAlloc(p, -1, NULL);
!         code = cm_SearchCellRegistry(1, cellname, ftemp, 0, 0, 0);
!         if (code && code != CM_ERROR_FORCE_DNS_LOOKUP)
!             code = cm_SearchCellFile(cellname, ftemp, 0, 0);
  #ifdef AFS_AFSDB_ENV
          if (code && cm_dnsEnabled) {
              int ttl;
***************
*** 9416,9421 ****
--- 9418,9712 ----
  }
  
  static void
+ configureBackConnectionHostNames(void)
+ {
+     /* On Windows XP SP2, Windows 2003 SP1, and all future Windows operating systems
+      * there is a restriction on the use of SMB authentication on loopback connections.
+      * There are two work arounds available:
+      * 
+      *   (1) We can disable the check for matching host names.  This does not
+      *   require a reboot:
+      *   [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
+      *     "DisableLoopbackCheck"=dword:00000001
+      *
+      *   (2) We can add the AFS SMB/CIFS service name to an approved list.  This
+      *   does require a reboot:
+      *   [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0]
+      *     "BackConnectionHostNames"=multi-sz
+      *
+      * The algorithm will be:
+      *   (1) Check to see if cm_NetbiosName exists in the BackConnectionHostNames list
+      *   (2a) If not, add it to the list.  (This will not take effect until the next reboot.)
+      *   (2b1)    and check to see if DisableLoopbackCheck is set.
+      *   (2b2)    If not set, set the DisableLoopbackCheck value to 0x1 
+      *   (2b3)                and create HKLM\SOFTWARE\OpenAFS\Client  UnsetDisableLoopbackCheck
+      *   (2c) else If cm_NetbiosName exists in the BackConnectionHostNames list,
+      *             check for the UnsetDisableLoopbackCheck value.  
+      *             If set, set the DisableLoopbackCheck flag to 0x0 
+      *             and delete the UnsetDisableLoopbackCheck value
+      *
+      * Starting in Longhorn Beta 1, an entry in the BackConnectionHostNames value will
+      * force Windows to use the loopback authentication mechanism for the specified 
+      * services.
+      * 
+      * Do not permit the "DisableLoopbackCheck" value to be removed within the same
+      * service session that set it.  
+      */
+     HKEY hkLsa;
+     HKEY hkMSV10;
+     HKEY hkClient;
+     DWORD dwType;
+     DWORD dwSize, dwAllocSize;
+     DWORD dwValue;
+     PBYTE pHostNames = NULL, pName = NULL;
+     BOOL  bNameFound = FALSE;   
+     static BOOL bLoopbackCheckDisabled = FALSE;
+ 
+     /* BackConnectionHostNames and DisableLoopbackCheck */
+     if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, 
+                        "SYSTEM\\CurrentControlSet\\Control\\Lsa\\MSV1_0",
+                        0,
+                        KEY_READ|KEY_WRITE,
+                        &hkMSV10) == ERROR_SUCCESS )
+     {
+         if ((RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, 
+ 			     &dwType, NULL, &dwAllocSize) == ERROR_SUCCESS) &&
+             (dwType == REG_MULTI_SZ)) 
+         {
+ 	    dwAllocSize += 1 /* in case the source string is not nul terminated */
+ 		+ (DWORD)strlen(cm_NetbiosName) + 2;
+ 	    pHostNames = malloc(dwAllocSize);
+ 	    dwSize = dwAllocSize;
+             if (RegQueryValueEx( hkMSV10, "BackConnectionHostNames", 0, &dwType, 
+ 				 pHostNames, &dwSize) == ERROR_SUCCESS) 
+             {
+ 		for (pName = pHostNames; 
+ 		     (pName - pHostNames < (int) dwSize) && *pName ; 
+ 		     pName += strlen(pName) + 1)
+ 		{
+ 		    if ( !stricmp(pName, cm_NetbiosName) ) {
+ 			bNameFound = TRUE;
+ 			break;
+ 		    }   
+ 		}
+ 	    }
+         }
+              
+         if ( !bNameFound ) {
+             size_t size = strlen(cm_NetbiosName) + 2;
+             if ( !pHostNames ) {
+                 pHostNames = malloc(size);
+ 		pName = pHostNames;
+             }
+             StringCbCopyA(pName, size, cm_NetbiosName);
+             pName += size - 1;
+             *pName = '\0';  /* add a second nul terminator */
+ 
+             dwType = REG_MULTI_SZ;
+ 	    dwSize = (DWORD)(pName - pHostNames + 1);
+             RegSetValueEx( hkMSV10, "BackConnectionHostNames", 0, dwType, pHostNames, dwSize);
+ 
+             if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, 
+                                "SYSTEM\\CurrentControlSet\\Control\\Lsa",
+                                0,
+                                KEY_READ|KEY_WRITE,
+                                &hkLsa) == ERROR_SUCCESS )
+             {
+                 dwSize = sizeof(DWORD);
+                 if ( RegQueryValueEx( hkLsa, "DisableLoopbackCheck", 0, &dwType, (LPBYTE)&dwValue, &dwSize) != ERROR_SUCCESS ||
+                      dwValue == 0 ) {
+                     dwType = REG_DWORD;
+                     dwSize = sizeof(DWORD);
+                     dwValue = 1;
+                     RegSetValueEx( hkLsa, "DisableLoopbackCheck", 0, dwType, (LPBYTE)&dwValue, dwSize);
+ 
+                     if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, 
+                                         AFSREG_CLT_OPENAFS_SUBKEY,
+                                         0,
+                                         NULL,
+                                         REG_OPTION_NON_VOLATILE,
+                                         KEY_READ|KEY_WRITE,
+                                         NULL,
+                                         &hkClient,
+                                         NULL) == ERROR_SUCCESS) {
+ 
+                         dwType = REG_DWORD;
+                         dwSize = sizeof(DWORD);
+                         dwValue = 1;
+                         RegSetValueEx( hkClient, "RemoveDisableLoopbackCheck", 0, dwType, (LPBYTE)&dwValue, dwSize);
+                         bLoopbackCheckDisabled = TRUE;
+                         RegCloseKey(hkClient);
+                     }
+                     RegCloseKey(hkLsa);
+                 }
+             }
+         } else if (!bLoopbackCheckDisabled) {
+             if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, 
+                                 AFSREG_CLT_OPENAFS_SUBKEY,
+                                 0,
+                                 NULL,
+                                 REG_OPTION_NON_VOLATILE,
+                                 KEY_READ|KEY_WRITE,
+                                 NULL,
+                                 &hkClient,
+                                 NULL) == ERROR_SUCCESS) {
+ 
+                 dwSize = sizeof(DWORD);
+                 if ( RegQueryValueEx( hkClient, "RemoveDisableLoopbackCheck", 0, &dwType, (LPBYTE)&dwValue, &dwSize) == ERROR_SUCCESS &&
+                      dwValue == 1 ) {
+                     if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, 
+                                        "SYSTEM\\CurrentControlSet\\Control\\Lsa",
+                                        0,
+                                        KEY_READ|KEY_WRITE,
+                                        &hkLsa) == ERROR_SUCCESS )
+                     {
+                         RegDeleteValue(hkLsa, "DisableLoopbackCheck");
+                         RegCloseKey(hkLsa);
+                     }
+                 }
+                 RegDeleteValue(hkClient, "RemoveDisableLoopbackCheck");
+                 RegCloseKey(hkClient);
+             }
+         }
+ 
+         if (pHostNames) {
+             free(pHostNames);
+             pHostNames = NULL;
+         }
+ 
+         RegCloseKey(hkMSV10);
+     }
+ }
+ 
+ 
+ static void
+ configureExtendedSMBSessionTimeouts(void)
+ {
+     /*
+      * In a Hot Fix to Windows 2003 SP2, the smb redirector was given the following
+      * new functionality:
+      *
+      *  [HKLM\SYSTEM\CurrentControlSet\Services\LanManWorkstation\Parameters]
+      *   "ReconnectableServers"            REG_MULTI_SZ
+      *   "ExtendedSessTimeout"             REG_DWORD  (seconds)
+      *   "ServersWithExtendedSessTimeout"  REG_MULTI_SZ 
+      *  
+      * These values can be used to prevent the smb redirector from timing out
+      * smb connection to the afs smb server prematurely.
+      */
+     HKEY hkLanMan;
+     DWORD dwType;
+     DWORD dwSize, dwAllocSize;
+     DWORD dwValue;
+     PBYTE pHostNames = NULL, pName = NULL;
+     BOOL  bNameFound = FALSE;   
+ 
+     if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, 
+                        "SYSTEM\\CurrentControlSet\\Services\\LanManWorkstation\\Parameters",
+                        0,
+                        KEY_READ|KEY_WRITE,
+                        &hkLanMan) == ERROR_SUCCESS )
+     {
+         if ((RegQueryValueEx( hkLanMan, "ReconnectableServers", 0, 
+ 			     &dwType, NULL, &dwAllocSize) == ERROR_SUCCESS) &&
+             (dwType == REG_MULTI_SZ)) 
+         {
+ 	    dwAllocSize += 1 /* in case the source string is not nul terminated */
+ 		+ (DWORD)strlen(cm_NetbiosName) + 2;
+ 	    pHostNames = malloc(dwAllocSize);
+ 	    dwSize = dwAllocSize;
+             if (RegQueryValueEx( hkLanMan, "ReconnectableServers", 0, &dwType, 
+ 				 pHostNames, &dwSize) == ERROR_SUCCESS) 
+             {
+ 		for (pName = pHostNames; 
+ 		     (pName - pHostNames < (int) dwSize) && *pName ; 
+ 		     pName += strlen(pName) + 1)
+ 		{
+ 		    if ( !stricmp(pName, cm_NetbiosName) ) {
+ 			bNameFound = TRUE;
+ 			break;
+ 		    }   
+ 		}
+ 	    }
+         }
+              
+         if ( !bNameFound ) {
+             size_t size = strlen(cm_NetbiosName) + 2;
+             if ( !pHostNames ) {
+                 pHostNames = malloc(size);
+ 		pName = pHostNames;
+             }
+             StringCbCopyA(pName, size, cm_NetbiosName);
+             pName += size - 1;
+             *pName = '\0';  /* add a second nul terminator */
+ 
+             dwType = REG_MULTI_SZ;
+ 	    dwSize = (DWORD)(pName - pHostNames + 1);
+             RegSetValueEx( hkLanMan, "ReconnectableServers", 0, dwType, pHostNames, dwSize);
+         }
+ 
+         if (pHostNames) {
+             free(pHostNames);
+             pHostNames = NULL;
+         }
+         
+         if ((RegQueryValueEx( hkLanMan, "ServersWithExtendedSessTimeout", 0, 
+ 			     &dwType, NULL, &dwAllocSize) == ERROR_SUCCESS) &&
+             (dwType == REG_MULTI_SZ)) 
+         {
+ 	    dwAllocSize += 1 /* in case the source string is not nul terminated */
+ 		+ (DWORD)strlen(cm_NetbiosName) + 2;
+ 	    pHostNames = malloc(dwAllocSize);
+ 	    dwSize = dwAllocSize;
+             if (RegQueryValueEx( hkLanMan, "ServersWithExtendedSessTimeout", 0, &dwType, 
+ 				 pHostNames, &dwSize) == ERROR_SUCCESS) 
+             {
+ 		for (pName = pHostNames; 
+ 		     (pName - pHostNames < (int) dwSize) && *pName ; 
+ 		     pName += strlen(pName) + 1)
+ 		{
+ 		    if ( !stricmp(pName, cm_NetbiosName) ) {
+ 			bNameFound = TRUE;
+ 			break;
+ 		    }   
+ 		}
+ 	    }
+         }
+              
+         if ( !bNameFound ) {
+             size_t size = strlen(cm_NetbiosName) + 2;
+             if ( !pHostNames ) {
+                 pHostNames = malloc(size);
+ 		pName = pHostNames;
+             }
+             StringCbCopyA(pName, size, cm_NetbiosName);
+             pName += size - 1;
+             *pName = '\0';  /* add a second nul terminator */
+ 
+             dwType = REG_MULTI_SZ;
+ 	    dwSize = (DWORD)(pName - pHostNames + 1);
+             RegSetValueEx( hkLanMan, "ServersWithExtendedSessTimeout", 0, dwType, pHostNames, dwSize);
+         }
+ 
+         if (pHostNames) {
+             free(pHostNames);
+             pHostNames = NULL;
+         }
+ 
+         if ((RegQueryValueEx( hkLanMan, "ExtendedSessTimeout", 0, 
+                               &dwType, (LPBYTE)&dwValue, &dwAllocSize) != ERROR_SUCCESS) ||
+              (dwType != REG_DWORD)) 
+         {
+             dwType = REG_DWORD;
+ 	    dwSize = sizeof(dwValue);
+             dwValue = 600;      /* 10 minutes */
+             RegSetValueEx( hkLanMan, "ExtendedSessTimeout", 0, dwType, (const BYTE *)&dwValue, dwSize);
+         }
+         RegCloseKey(hkLanMan);
+     }
+ }
+ 
+ static void
  smb_LanAdapterChangeThread(void *param)
  {
      /* 
***************
*** 9709,9714 ****
--- 10000,10011 ----
      }
  
      afsi_log("smb_StartListeners");
+     /* Ensure the AFS Netbios Name is registered to allow loopback access */
+     configureBackConnectionHostNames();
+ 
+     /* Configure Extended SMB Session Timeouts */
+     configureExtendedSMBSessionTimeouts();
+ 
      smb_ListenerState = SMB_LISTENER_STARTED;
      cm_VolStatus_Network_Started(cm_NetbiosName
  #ifdef _WIN64
Index: openafs/src/WINNT/client_exp/gui2fs.cpp
diff -c openafs/src/WINNT/client_exp/gui2fs.cpp:1.19.4.8 openafs/src/WINNT/client_exp/gui2fs.cpp:1.19.4.9
*** openafs/src/WINNT/client_exp/gui2fs.cpp:1.19.4.8	Sat Oct 18 00:12:35 2008
--- openafs/src/WINNT/client_exp/gui2fs.cpp	Thu May  7 10:53:25 2009
***************
*** 36,41 ****
--- 36,46 ----
  #include <afs/auth.h>
  #include <WINNT\afsreg.h>
  #include <cm.h>
+ #include <cm_nls.h>
+ #include <osi.h>
+ #include <cm_user.h>
+ #include <cm_scache.h>
+ #include <cm_ioctl.h>
  }
  
  #define STRSAFE_NO_DEPRECATE
***************
*** 1151,1156 ****
--- 1156,1163 ----
  BOOL IsPathInAfs(const CString & strPath)
  {
      struct ViceIoctl blob;
+     cm_ioctlQueryOptions_t options;
+     cm_fid_t fid;
      int code;
  
      HOURGLASS hourglass;
***************
*** 1160,1172 ****
      debugBuf.Format(_T("IsPathInAfs(%s)"), strPath);
      OutputDebugString(debugBuf);
  
!     blob.in_size = 0;
!     blob.out_size = MAXSIZE;
!     blob.out = space;
  
!     code = pioctl_T(strPath, VIOC_FILE_CELL_NAME, &blob, 1);
  
!     debugBuf.Format(_T("VIOC_FILE_CELL_NAME=%d"), code);
      OutputDebugString(debugBuf);
  
      if (code) {
--- 1167,1184 ----
      debugBuf.Format(_T("IsPathInAfs(%s)"), strPath);
      OutputDebugString(debugBuf);
  
!     memset(&options, 0, sizeof(options));
!     options.size = sizeof(options);
!     options.field_flags |= CM_IOCTL_QOPTS_FIELD_LITERAL;
!     options.literal = 1;
!     blob.in_size = options.size;    /* no variable length data */
!     blob.in = &options;
!     blob.out_size = sizeof(cm_fid_t);
!     blob.out = (char *) &fid;
  
!     code = pioctl_T(strPath, VIOCGETFID, &blob, 1);
  
!     debugBuf.Format(_T("VIOCGETFID=%d"), code);
      OutputDebugString(debugBuf);
  
      if (code) {
***************
*** 1624,1630 ****
  
      HOURGLASS hourglass;
  
! 	    {
          CString str;
          str.Format(_T("IsSymlink(%s)"), strName);
          OutputDebugString(str);
--- 1636,1642 ----
  
      HOURGLASS hourglass;
  
!     {
          CString str;
          str.Format(_T("IsSymlink(%s)"), strName);
          OutputDebugString(str);
Index: openafs/src/WINNT/client_osi/NTMakefile
diff -c openafs/src/WINNT/client_osi/NTMakefile:1.10.4.4 openafs/src/WINNT/client_osi/NTMakefile:1.10.4.5
*** openafs/src/WINNT/client_osi/NTMakefile:1.10.4.4	Wed Jul  2 08:48:58 2008
--- openafs/src/WINNT/client_osi/NTMakefile	Wed May 20 23:26:15 2009
***************
*** 79,84 ****
--- 79,85 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def libosi.def
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
  
Index: openafs/src/WINNT/install/NSIS/OpenAFS.nsi
diff -c openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.21 openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.24
*** openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.88.4.21	Thu Oct 16 21:41:37 2008
--- openafs/src/WINNT/install/NSIS/OpenAFS.nsi	Wed May 27 09:55:58 2009
***************
*** 546,552 ****
    SetOutPath "$INSTDIR\Client\Program"
    File "${AFS_CLIENT_BUILDDIR}\afsshare.exe"
    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\libosi.dll" "$INSTDIR\Client\Program\libosi.dll" "$INSTDIR"
-   !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\libafsconf.dll" "$INSTDIR\Client\Program\libafsconf.dll" "$INSTDIR"
    File "${AFS_CLIENT_BUILDDIR}\klog.exe"
    File "${AFS_CLIENT_BUILDDIR}\tokens.exe"
    File "${AFS_CLIENT_BUILDDIR}\unlog.exe"
--- 546,551 ----
***************
*** 559,565 ****
    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afsd_service.exe" "$INSTDIR\Client\Program\afsd_service.exe" "$INSTDIR"
    File "${AFS_CLIENT_BUILDDIR}\symlink.exe"
    File "${AFS_DESTDIR}\bin\kpasswd.exe"
!   File "${AFS_SERVER_BUILDDIR}\pts.exe"
    File "${AFS_SERVER_BUILDDIR}\bos.exe"
    File "${AFS_SERVER_BUILDDIR}\kas.exe"
    File "${AFS_SERVER_BUILDDIR}\vos.exe"
--- 558,564 ----
    !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afsd_service.exe" "$INSTDIR\Client\Program\afsd_service.exe" "$INSTDIR"
    File "${AFS_CLIENT_BUILDDIR}\symlink.exe"
    File "${AFS_DESTDIR}\bin\kpasswd.exe"
!   File "${AFS_DESTDIR}\bin\pts.exe"
    File "${AFS_SERVER_BUILDDIR}\bos.exe"
    File "${AFS_SERVER_BUILDDIR}\kas.exe"
    File "${AFS_SERVER_BUILDDIR}\vos.exe"
***************
*** 576,581 ****
--- 575,582 ----
    File "${AFS_CLIENT_BUILDDIR}\afscpcc.exe"
  
    ; Remove the binaries from the old location if present
+   Delete /REBOOTOK "$INSTDIR\Client\Program\libafsconf.dll"
+   Delete "$INSTDIR\Client\Program\libafsconf.pdb"
    Delete /REBOOTOK "$SYSDIR\afslogon.dll"
    Delete "$SYSDIR\afscpcc.exe"
    Delete "$SYSDIR\afslogon.pdb"
***************
*** 869,874 ****
--- 870,877 ----
    File "${AFS_SERVER_BUILDDIR}\vlserver.exe"
    File "${AFS_SERVER_BUILDDIR}\volinfo.exe"
    File "${AFS_SERVER_BUILDDIR}\volserver.exe"
+   File "${AFS_DESTDIR}\bin\ptclient.exe"
+   File "${AFS_DESTDIR}\bin\pt_util.exe"
   
   ;AFS Server common files
   SetOutPath "$INSTDIR\Common"
***************
*** 1031,1038 ****
     File "..\..\..\..\doc\man-pages\html\5\*"
     SetOutPath "$INSTDIR\Documentation\html\CmdRef\8"
     File "..\..\..\..\doc\man-pages\html\8\*"
!    SetOutPath "$INSTDIR\Documentation\html\SysAdminGd"
!    File "..\..\doc\install\Documentation\en_US\html\SysAdminGd\*"
     goto DoneLanguage
     
  DoGerman:
--- 1034,1042 ----
     File "..\..\..\..\doc\man-pages\html\5\*"
     SetOutPath "$INSTDIR\Documentation\html\CmdRef\8"
     File "..\..\..\..\doc\man-pages\html\8\*"
!    SetOutPath "$INSTDIR\Documentation\"
!    File /oname=AdminGuide.chm "..\..\..\..\doc\xml\AdminGuide\htmlhelp.chm"
!    File /oname=UserGuide.chm "..\..\..\..\doc\xml\AdminGuide\htmlhelp.chm"
     goto DoneLanguage
     
  DoGerman:
***************
*** 1160,1166 ****
    SetOutPath "$INSTDIR\Client\Program"
    File "${AFS_CLIENT_BUILDDIR}\afsshare.pdb"
    File "${AFS_CLIENT_BUILDDIR}\libosi.pdb"
!   File "${AFS_CLIENT_BUILDDIR}\libafsconf.pdb"
    File "${AFS_CLIENT_BUILDDIR}\klog.pdb"
    File "${AFS_CLIENT_BUILDDIR}\tokens.pdb"
    File "${AFS_CLIENT_BUILDDIR}\unlog.pdb"
--- 1164,1171 ----
    SetOutPath "$INSTDIR\Client\Program"
    File "${AFS_CLIENT_BUILDDIR}\afsshare.pdb"
    File "${AFS_CLIENT_BUILDDIR}\libosi.pdb"
!   ; remove old location if present
!   Delete "$INSTDIR\Client\Program\libafsconf.pdb"
    File "${AFS_CLIENT_BUILDDIR}\klog.pdb"
    File "${AFS_CLIENT_BUILDDIR}\tokens.pdb"
    File "${AFS_CLIENT_BUILDDIR}\unlog.pdb"
***************
*** 1206,1211 ****
--- 1211,1218 ----
    File "${AFS_ETC_BUILDDIR}\fms.pdb"
    File "${AFS_SERVER_BUILDDIR}\kaserver.pdb"
    File "${AFS_SERVER_BUILDDIR}\ptserver.pdb"
+   File "${AFS_DESTDIR}\bin\ptclient.pdb"
+   File "${AFS_DESTDIR}\bin\pt_util.pdb"
    File "${AFS_SERVER_BUILDDIR}\salvager.pdb"
    File "${AFS_SERVER_BUILDDIR}\upclient.pdb"
    File "${AFS_SERVER_BUILDDIR}\upserver.pdb"
***************
*** 1267,1272 ****
--- 1274,1280 ----
     File "${AFS_DESTDIR}\lib\afsauthent.pdb"
     File "${AFS_DESTDIR}\lib\afspthread.pdb"
     File "${AFS_DESTDIR}\lib\afsrpc.pdb"
+    File "${AFS_DESTDIR}\lib\libafsconf.pdb"
     File "${AFS_SERVER_BUILDDIR}\afsclientadmin.pdb"
     File "${AFS_SERVER_BUILDDIR}\afsprocmgmt.pdb"
     File "${AFS_SERVER_BUILDDIR}\afsvosadmin.pdb"
***************
*** 1685,1694 ****
    Delete "$INSTDIR\Documentation\html\CmdRef\5\*"
    Delete "$INSTDIR\Documentation\html\CmdRef\8\*"
    Delete "$INSTDIR\Documentation\html\CmdRef\*"
-   Delete "$INSTDIR\Documentation\html\ReleaseNotes\logo_files\*"
-   Delete "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files\*"
-   Delete "$INSTDIR\Documentation\html\ReleaseNotes\*"
-   Delete "$INSTDIR\Documentation\html\SysAdminGd\*"
  
     Delete /REBOOTOK "$INSTDIR\Common\afs_config.exe"
     Delete /REBOOTOK "$INSTDIR\Common\afs_shl_ext.dll"
--- 1693,1698 ----
***************
*** 1887,1894 ****
    Delete /REBOOTOK "$INSTDIR\Client\Program\afscpcc.pdb"
  
    RMDir /r "$INSTDIR\Documentation\html\CmdRef"
-   RMDir /r "$INSTDIR\Documentation\html\ReleaseNotes"
-   RMDir /r "$INSTDIR\Documentation\html\SysAdminGd"
    RMDIr /r "$INSTDIR\Documentation\html"
    
    RMDir "$INSTDIR\Documentation"
--- 1891,1896 ----
***************
*** 2032,2037 ****
--- 2034,2040 ----
    Delete "$SMPROGRAMS\OpenAFS\Control Center\Account Manager.lnk"
    Delete "$SMPROGRAMS\OpenAFS\Control Center\Server Manager.lnk"
    RMDIR "$SMPROGRAMS\OpenAFS\Control Center"
+   RMDir /r "$SMPROGRAMS\OpenAFS\Documentation"
    RMDir /r "$SMPROGRAMS\OpenAFS\Client"
    RMDir /r "$SMPROGRAMS\OpenAFS"
    Delete "$SMSTARTUP\AFS Credentials.lnk"
***************
*** 2774,2780 ****
     File "${AFS_CLIENT_BUILDDIR}\afs_config.exe"
    !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsauthent.dll" "$INSTDIR\Common\afsauthent.dll" "$INSTDIR"
    !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afspthread.dll" "$INSTDIR\Common\afspthread.dll" "$INSTDIR"
!   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsrpc.dll" "$INSTDIR\Common\afsrpc.dll" "$INSTDIR"
    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsadminutil.dll"    "$INSTDIR\Common\afsadminutil.dll"    "$INSTDIR"
    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsclientadmin.dll"  "$INSTDIR\Common\afsclientadmin.dll"  "$INSTDIR" 
    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsprocmgmt.dll"     "$INSTDIR\Common\afsprocmgmt.dll"     "$INSTDIR" 
--- 2777,2784 ----
     File "${AFS_CLIENT_BUILDDIR}\afs_config.exe"
    !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsauthent.dll" "$INSTDIR\Common\afsauthent.dll" "$INSTDIR"
    !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afspthread.dll" "$INSTDIR\Common\afspthread.dll" "$INSTDIR"
!   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\afsrpc.dll"     "$INSTDIR\Common\afsrpc.dll"     "$INSTDIR"
!   !insertmacro ReplaceDLL "${AFS_DESTDIR}\lib\libafsconf.dll" "$INSTDIR\Common\libafsconf.dll" "$INSTDIR"
    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsadminutil.dll"    "$INSTDIR\Common\afsadminutil.dll"    "$INSTDIR"
    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsclientadmin.dll"  "$INSTDIR\Common\afsclientadmin.dll"  "$INSTDIR" 
    !insertmacro ReplaceDLL "${AFS_SERVER_BUILDDIR}\afsprocmgmt.dll"     "$INSTDIR\Common\afsprocmgmt.dll"     "$INSTDIR" 
***************
*** 2882,2887 ****
--- 2886,2895 ----
  !ENDIF
  !ENDIF
  
+    ; Cleanup old documentation as the file names may have changed
+    DELETE "$SMPROGRAMS\OpenAFS\Documentation.lnk"
+    RMDIR /R "$INSTDIR\Documentation"
+ 
     StrCmp $LANGUAGE ${LANG_ENGLISH} DoEnglish
     StrCmp $LANGUAGE ${LANG_GERMAN} DoGerman
     StrCmp $LANGUAGE ${LANG_SPANISH} DoSpanish
***************
*** 2894,2910 ****
  DoEnglish:
  
     SetOutPath "$INSTDIR\Documentation"
!    File "..\..\doc\install\Documentation\en_US\README.TXT"
!    SetOutPath "$INSTDIR\Documentation\html"
!    File "..\..\doc\install\Documentation\en_US\html\*"
!    SetOutPath "$INSTDIR\Documentation\html\index_files"
!    File "..\..\doc\install\Documentation\en_US\html\index_files\*"
!    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes"
!    File "..\..\doc\install\Documentation\en_US\html\ReleaseNotes\*"
!    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\logo_files"
!    File "..\..\doc\install\Documentation\en_US\html\ReleaseNotes\logo_files\*"
!    SetOutPath "$INSTDIR\Documentation\html\ReleaseNotes\relnotes_files"
!    File "..\..\doc\install\Documentation\en_US\html\ReleaseNotes\relnotes_files\*"
  
     SetOutPath "$INSTDIR\Client\Program"
     !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1033.dll"    "$INSTDIR\Client\Program\afscreds_1033.dll" "$INSTDIR"
--- 2902,2911 ----
  DoEnglish:
  
     SetOutPath "$INSTDIR\Documentation"
!    File /oname=ReleaseNotes.chm "..\..\..\..\doc\xml\ReleaseNotesWindows\htmlhelp.chm"
! 
!    CreateDirectory "$SMPROGRAMS\OpenAFS\Documentation"
!    CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation\Release Notes.lnk" "$INSTDIR\Documentation\ReleaseNotes.chm"
  
     SetOutPath "$INSTDIR\Client\Program"
     !insertmacro ReplaceDLL "${AFS_CLIENT_BUILDDIR}\afscreds_1033.dll"    "$INSTDIR\Client\Program\afscreds_1033.dll" "$INSTDIR"
***************
*** 3380,3389 ****
     
  done:
  
!   ; Write start menu shortcut
!   SetOutPath "$SMPROGRAMS\OpenAFS"
!   CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation.lnk" "$INSTDIR\Documentation\html\index.htm"
!   
  
  FunctionEnd
  
--- 3381,3392 ----
     
  done:
  
!    ; Write start menu shortcut
!    SetOutPath "$SMPROGRAMS\OpenAFS"
!    CreateDirectory "$SMPROGRAMS\OpenAFS\Documentation"
!    CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation\Reference Manual.lnk" "$INSTDIR\Documentation\html\CmdRef\index.html"
!    CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation\Administrator Guide.lnk" "$INSTDIR\Documentation\AdminGuide.chm"
!    CreateShortCut "$SMPROGRAMS\OpenAFS\Documentation\User Guide.lnk" "$INSTDIR\Documentation\UserGuide.chm"
  
  FunctionEnd
  
Index: openafs/src/WINNT/install/wix/NTMakefile
diff -c openafs/src/WINNT/install/wix/NTMakefile:1.9.2.4 openafs/src/WINNT/install/wix/NTMakefile:1.9.2.5
*** openafs/src/WINNT/install/wix/NTMakefile:1.9.2.4	Wed Jul  2 08:49:01 2008
--- openafs/src/WINNT/install/wix/NTMakefile	Wed May 20 01:03:51 2009
***************
*** 35,40 ****
--- 35,45 ----
  !IF ("$(CPU)" == "i386")
  BINWIXOBJ  = $(OUT)\openafs-32bit-tools-$(LANG).wixobj
  !ENDIF
+ !IFNDEF NOCYGWIN
+ WIXCYGOPT=-dCygwinArchives
+ !ELSE
+ WIXCYGOPT=
+ !ENDIF
  
  LANGUAGES=en_US de_DE es_ES ja_JP ko_KR pt_BR zh_CN zh_TW
  
***************
*** 83,89 ****
  		-dIDNMRedistDir=$(MSIDNNLS)\\REDIST 	\
  		-v0 \
  		-w0 \
!         $(AFSDEV_AUXWIXDEFINES)	openafs.wxs
  
  !IF ("$(CPU)" == "i386")
  $(BINWIXOBJ): oafwbins.wxs $(WIXINCLUDES)
--- 88,94 ----
  		-dIDNMRedistDir=$(MSIDNNLS)\\REDIST 	\
  		-v0 \
  		-w0 \
! 		$(WIXCYGOPT) $(AFSDEV_AUXWIXDEFINES)	openafs.wxs
  
  !IF ("$(CPU)" == "i386")
  $(BINWIXOBJ): oafwbins.wxs $(WIXINCLUDES)
***************
*** 98,104 ****
  		-dCellDbFile=CellServDB \
  		-v0 \
  		-w0 \
!         $(AFSDEV_AUXWIXDEFINES)	oafwbins.wxs
  
  $(BINMSIFILE): $(BINWIXOBJ)
  	light -nologo -out $(BINMSIFILE) \
--- 103,109 ----
  		-dCellDbFile=CellServDB \
  		-v0 \
  		-w0 \
!         $(WIXCYGOPT) $(AFSDEV_AUXWIXDEFINES)	oafwbins.wxs
  
  $(BINMSIFILE): $(BINWIXOBJ)
  	light -nologo -out $(BINMSIFILE) \
Index: openafs/src/WINNT/install/wix/feature.wxi
diff -c openafs/src/WINNT/install/wix/feature.wxi:1.14.2.11 openafs/src/WINNT/install/wix/feature.wxi:1.14.2.14
*** openafs/src/WINNT/install/wix/feature.wxi:1.14.2.11	Sun Jun 29 01:07:12 2008
--- openafs/src/WINNT/install/wix/feature.wxi	Wed May 27 09:55:58 2009
***************
*** 10,19 ****
             <ComponentRef Id="efl_uninstall_EXE" />
  
             <ComponentRef Id="cmp_Release_Notes_en_US" />
-            <ComponentRef Id="cmf_index2_HTM_en_US" />
-            <ComponentRef Id="cmp_index_files_en_US" />
-            <ComponentRef Id="cmp_logo_files_en_US" />
-            <ComponentRef Id="cmp_relnotes_files_en_US" />
    <?endif?>
  
    <?ifndef BinsOnly ?>
--- 10,15 ----
***************
*** 66,72 ****
  
  		<ComponentRef Id="cmp_CommonDir" />
  
-                 <ComponentRef Id="efl_Readme_TXT_$(var.Language)" />
                  <ComponentRef Id="efl_CellServDB" />
                  <ComponentRef Id="cpf_CellServDB" />
                  <ComponentRef Id="cmf_afs_cpa_CPL" />
--- 62,67 ----
***************
*** 147,154 ****
                  <ComponentRef Id="cmf_afs_nt_HLP_$(var.Language)" />
                  <ComponentRef Id="cmp_Lang_$(var.Language)" />
              
-                 <ComponentRef Id="efl_Readme_TXT_$(var.Language)" />
- 
                  <ComponentRef Id="cmf_vlserver_EXE" />
                  <ComponentRef Id="cmf_volinfo_EXE" />
                  <ComponentRef Id="cmf_volserver_EXE" />
--- 142,147 ----
***************
*** 163,168 ****
--- 156,163 ----
                  <ComponentRef Id="cmf_butc_EXE" />
                  <ComponentRef Id="cmf_kaserver_EXE" />
                  <ComponentRef Id="cmf_ptserver_EXE" />
+                 <ComponentRef Id="cmf_ptclient_EXE" />
+                 <ComponentRef Id="cmf_pt_util_EXE" />
                  <ComponentRef Id="cmf_salvager_EXE" />
                  <ComponentRef Id="cmf_upclient_EXE" />
                  <ComponentRef Id="cmf_upserver_EXE" />
***************
*** 229,236 ****
  				</Feature>
              <?endif?>
              
-                 <ComponentRef Id="efl_Readme_TXT_$(var.Language)" />
-                 
                  <!-- Runtime -->
                  <?include runtime.wxi?>
              </Feature>
--- 224,229 ----
***************
*** 239,245 ****
  
  				<ComponentRef Id="rcm_SDK" />
  
-                 <ComponentRef Id="efl_Readme_TXT_$(var.Language)" />                
  				<ComponentRef Id="cmp_SDK_Sample" />
  				<ComponentRef Id="cmp_SDK_Include" />
  				<ComponentRef Id="cmp_SDK_Include_afs" />
--- 232,237 ----
***************
*** 247,252 ****
--- 239,248 ----
  				<ComponentRef Id="cmp_SDK_Include_Winnt" />
  				<ComponentRef Id="cmp_SDK_Lib" />
  				<ComponentRef Id="cmp_SDK_Lib_Afs" />
+                 <?ifdef CygwinArchives ?>
+                 <ComponentRef Id="cmp_SDK_Lib_Cygwin" />
+                 <ComponentRef Id="cmp_SDK_Lib_Afs_Cygwin" />
+                 <?endif?>
  
  			<?ifdef DebugSyms?>
  				<Feature Id="feaSDKDebug" AllowAdvertise="no" Description="$(loc.StrAFSSDKDebugLongDesc)" Display="expand"
***************
*** 262,275 ****
                  Display="expand" InstallDefault="followParent" Level="130" Title="$(loc.StrAFSDocDesc)">
  
          	<ComponentRef Id="rcm_Documentation" />
-                 
-                 <ComponentRef Id="efl_Readme_TXT_$(var.Language)" />                
-                 <ComponentRef Id="efl_DocHtml_en_US" />
                  <ComponentRef Id="cmp_Cmd_Ref_en_US" />
                  <ComponentRef Id="cmp_Cmd_Ref_1_en_US" />
                  <ComponentRef Id="cmp_Cmd_Ref_5_en_US" />
                  <ComponentRef Id="cmp_Cmd_Ref_8_en_US" />
                  <ComponentRef Id="cmp_Sys_Admin_Guide_en_US" />
  
                  <ComponentRef Id="cmf_afs_nt_HLP_en_US" />
                  <ComponentRef Id="cmp_Lang_en_US" />
--- 258,269 ----
                  Display="expand" InstallDefault="followParent" Level="130" Title="$(loc.StrAFSDocDesc)">
  
          	<ComponentRef Id="rcm_Documentation" />
                  <ComponentRef Id="cmp_Cmd_Ref_en_US" />
                  <ComponentRef Id="cmp_Cmd_Ref_1_en_US" />
                  <ComponentRef Id="cmp_Cmd_Ref_5_en_US" />
                  <ComponentRef Id="cmp_Cmd_Ref_8_en_US" />
                  <ComponentRef Id="cmp_Sys_Admin_Guide_en_US" />
+                 <ComponentRef Id="cmp_User_Guide_en_US" />
  
                  <ComponentRef Id="cmf_afs_nt_HLP_en_US" />
                  <ComponentRef Id="cmp_Lang_en_US" />
Index: openafs/src/WINNT/install/wix/files.wxi
diff -c openafs/src/WINNT/install/wix/files.wxi:1.22.2.24 openafs/src/WINNT/install/wix/files.wxi:1.22.2.31
*** openafs/src/WINNT/install/wix/files.wxi:1.22.2.24	Tue Jul 15 17:19:34 2008
--- openafs/src/WINNT/install/wix/files.wxi	Wed May 27 09:55:58 2009
***************
*** 48,53 ****
--- 48,56 ----
                  <Component Win64="$(var.Win64)" Id="cmf_afsrpc_DLL" Guid="$(var.cmf_afsrpc_DLL_guid)">
                      <File Id="fileafsrpc_DLL" Name="afsrpc.dll" LongName="afsrpc.dll" KeyPath="yes" DiskId="1" src="$(var.LibDir)\afsrpc.dll"/>
                  </Component>
+                 <Component Win64="$(var.Win64)" Id="cmf_libafsconf_DLL" Guid="$(var.cmf_libafsconf_DLL_guid)">
+                     <File Id="filelibafsconf_DLL" Name="libafscf.dll" LongName="libafsconf.dll" KeyPath="yes" DiskId="1"  src="$(var.LibDir)\libafsconf.dll"/>
+                 </Component>
                  <Component Win64="$(var.Win64)" Id="cmf_afsauthent2_DLL" Guid="$(var.cmf_afsauthent2_DLL_guid)">
                      <File Id="fileafsauthent2_DLL" Name="afsauth.dll" LongName="afsauthent.dll" KeyPath="yes" DiskId="1" src="$(var.LibDir)\afsauthent.dll"/>
                  </Component>
***************
*** 77,82 ****
--- 80,86 ----
                <?endif?>
                  <Component Win64="$(var.Win64)" Id="cmp_CommonCommonDebug" Guid="$(var.cmp_CommonCommonDebug_guid)">
                      <File Id="fileafsrpc_PDB" Name="afsrpc.pdb" LongName="afsrpc.pdb" KeyPath="yes" DiskId="1" src="$(var.LibDir)\afsrpc.pdb"/>
+                     <File Id="filelibafsconf_PDB" Name="libafscf.pdb" LongName="libafsconf.pdb" DiskId="1" src="$(var.LibDir)\libafsconf.pdb"/>
                      <File Id="fileafsauthent_PDB" Name="afsauth.pdb" LongName="afsauthent.pdb" DiskId="1" src="$(var.LibDir)\afsauthent.pdb"/>
                      <File Id="fileafspthread_PDB" Name="afspthrd.pdb" LongName="afspthread.pdb" DiskId="1" src="$(var.LibDir)\afspthread.pdb"/>
                      <File Id="fileTaAfsAppLib_PDB" Name="TaAfsApL.pdb" LongName="TaAfsAppLib.pdb" DiskId="1" src="$(var.ServerDir)\TaAfsAppLib.pdb"/>
***************
*** 141,148 ****
  
                  <!-- Runtime libraries -->
            <?ifndef Debug?>
! 			<!-- Note that for AFSVER_CL=1400, the runtime libraries are included via merge modules
! 			     at the TARGETDIR level, since we use shared assemblies instead of private assemblies. -->
              <?if $(env.AFSVER_CL) = "1310"?>
  				<?ifdef comment?>
  					While we would love to just use the merge modules, they are unfortunately
--- 145,156 ----
  
                  <!-- Runtime libraries -->
            <?ifndef Debug?>
! 
! 			<!-- Note that for AFSVER_CL=1400 and 1500, the runtime
! 			     libraries are included via merge modules at the
! 			     TARGETDIR level, since we use shared assemblies
! 			     instead of private assemblies. -->
! 
              <?if $(env.AFSVER_CL) = "1310"?>
  				<?ifdef comment?>
  					While we would love to just use the merge modules, they are unfortunately
***************
*** 313,398 ****
    <?endif?>
  
    <?ifndef BinsOnly?>
-          <?if $(var.Language) = "en_US"?>
-             <Component Id="efl_Readme_TXT_en_US" Guid="959DC63A-6C67-4B51-9F7D-2CDEE91F0099">
-                 <File Id="fileREADME_TXT_en_US" Name="README.txt" LongName="README.txt" DiskId="1" src="$(var.SrcDir)\WINNT\doc\install\Documentation\en_US\README.txt"/>
-             </Component>
-          <?endif?>
-                         
-          <?if $(var.Language) = "zh_TW"?>
-             <Component Id="efl_Readme_TXT_zh_TW" Guid="BF25CD95-7BCD-4B0C-9999-B246199236F6">
-                 <File Id="fileREADME_TXT_zh_TW" Name="README.txt" LongName="README.txt" DiskId="1" src="$(var.SrcDir)\WINNT\doc\install\Documentation\zh_TW\README.txt"/>
-             </Component>
-          <?endif?>
-                         
-          <?if $(var.Language) = "de_DE"?>
-             <Component Id="efl_Readme_TXT_de_DE" Guid="5F1433F0-C57D-46C8-857B-4265B95CEF24">
-                 <File Id="fileREADME_TXT_de_DE" Name="README.txt" LongName="README.txt" DiskId="1" src="$(var.SrcDir)\WINNT\doc\install\Documentation\de_DE\README.txt"/>
-             </Component>
-          <?endif?>
-                         
-          <?if $(var.Language) = "es_ES"?>
-             <Component Id="efl_Readme_TXT_es_ES" Guid="8B0C573E-B33E-4EC5-8B3B-C08347FFAB79">
-                 <File Id="fileREADME_TXT_es_ES" Name="README.txt" LongName="README.txt" DiskId="1" src="$(var.SrcDir)\WINNT\doc\install\Documentation\es_ES\README.txt"/>
-             </Component>
-          <?endif?>
-                         
-          <?if $(var.Language) = "ja_JP"?>
-             <Component Id="efl_Readme_TXT_ja_JP" Guid="5A15925E-00EB-4B00-A5BE-7461EE7D6C95">
-                 <File Id="fileREADME_TXT_ja_JP" Name="README.txt" LongName="README.txt" DiskId="1" src="$(var.SrcDir)\WINNT\doc\install\Documentation\ja_JP\README.txt"/>
-             </Component>
-          <?endif?>
-                         
-          <?if $(var.Language) = "ko_KR"?>
-             <Component Id="efl_Readme_TXT_ko_KR" Guid="715D4A97-6356-41E8-8660-76D74DC88495">
-                 <File Id="fileREADME_TXT_ko_KR" Name="README.txt" LongName="README.txt" DiskId="1" src="$(var.SrcDir)\WINNT\doc\install\Documentation\ko_KR\README.txt"/>
-             </Component>
-          <?endif?>
-      
-          <?if $(var.Language) = "pt_BR"?>
-             <Component Id="efl_Readme_TXT_pt_BR" Guid="03682CAA-66D4-472F-86DE-C508F33AE50C">
-                 <File Id="fileREADME_TXT_pt_BR" Name="README.txt" LongName="README.txt" DiskId="1" src="$(var.SrcDir)\WINNT\doc\install\Documentation\pt_BR\README.txt"/>
-             </Component>
-          <?endif?>
-                         
-          <?if $(var.Language) = "zh_CN"?>
-             <Component Id="efl_Readme_TXT_zh_CN" Guid="6D1DD8B0-0D61-4BC4-976B-F72E087F83D4">
-                 <File Id="fileREADME_TXT_zh_CN" Name="README.txt" LongName="README.txt" DiskId="1" src="$(var.SrcDir)\WINNT\doc\install\Documentation\zh_CN\README.txt"/>
-             </Component>
-          <?endif?>
-   <?endif?>
- 
-   <?ifndef BinsOnly?>
              <Directory Id="dirDocumentation" Name="Docum" LongName="Documentation" SourceName="Docs">
! 				<!-- The following directory and everything below it is language dependent. -->
!                     <Directory Id="dirHtml_$(var.Language)" Name="Html" src="$(var.SrcDir)\WINNT\doc\install\Documentation\$(var.Language)\html\">
!                         <Component Id="cmf_index2_HTM_$(var.Language)" Guid="$(var.DocHtmlIndexGuid)">
!                             <File Id="fileindex2_HTM_$(var.Language)" Name="index.htm" LongName="index.htm" KeyPath="yes" DiskId="1">
! 								<Shortcut Id="scDoc_$(var.Language)" Directory="dirShortCut" Name="Doc$(var.Language).lnk" LongName="Documentation ($(var.Language)).lnk" Description="$(loc.StrDocLnkDesc)" Icon="ico_Help" IconIndex="0" Show="normal" WorkingDirectory="dirCommon" />
!                             </File>
                          </Component>
!                         <Component Id="efl_DocHtml_$(var.Language)" Guid="$(var.DocHtmlGuid)">
!                             <File Id="filebanner_GIF_$(var.Language)" Name="banner.gif" LongName="banner.gif" DiskId="1" />
!                             <File Id="filebooks_GIF_$(var.Language)" Name="books.gif" LongName="books.gif" DiskId="1" />
!                             <File Id="filebot_GIF_$(var.Language)" Name="bot.gif" LongName="bot.gif" DiskId="1" />
!                             <File Id="fileindex_GIF_$(var.Language)" Name="index.gif" LongName="index.gif" DiskId="1" />
!                             <File Id="filenext_GIF_$(var.Language)" Name="next.gif" LongName="next.gif" DiskId="1" />
!                             <File Id="fileprev_GIF_$(var.Language)" Name="prev.gif" LongName="prev.gif" DiskId="1" />
!                             <File Id="filetoc_GIF_$(var.Language)" Name="toc.gif" LongName="toc.gif" DiskId="1" />
!                             <File Id="filetop_GIF_$(var.Language)" Name="top.gif" LongName="top.gif" DiskId="1" />
!                             <File Id="file$(var.Language)_RTF" Name="$(var.Language).rtf" LongName="$(var.Language).rtf" KeyPath="yes" DiskId="1" src="$(var.SrcDir)\WINNT\license\lang\$(var.Language).rtf"/>
                          </Component>
!                         <Directory Id="dirindex_files_$(var.Language)" Name="index" LongName="index_files" src="$(var.SrcDir)\WINNT\doc\install\Documentation\$(var.Language)\html\index_files\">
!                             <Component Id="cmp_index_files_$(var.Language)" Guid="$(var.DocHtmlIndexFilesGuid)">
!                                 <File Id="filefilelist_XML_$(var.Language)" Name="filelist.xml" LongName="filelist.xml" DiskId="1" />
!                                 <File Id="fileimage001_JPG_$(var.Language)" Name="image001.jpg" LongName="image001.jpg" DiskId="1" />
!                                 <File Id="fileimage002_JPG_$(var.Language)" Name="image002.jpg" LongName="image002.jpg" DiskId="1" />
!                             </Component>
!                         </Directory>
                      <?if $(var.Language) = "en_US"?>
                          <Directory Id="dirCmdRef_en_US" Name="CmdRef" src="$(var.DocDir)\man-pages\html\">
                              <Component Id="cmp_Cmd_Ref_en_US" Guid="$(var.DocHtmlCmdRefGuid)">
!                                 <File Id="file_CmdRef_Index_HTM_en_US" Name="index.htm" LongName="index.html" KeyPath="yes" DiskId="1" />
                                  <File Id="file_CmdRef_Style_CSS_en_US" Name="style.css" LongName="style.css" DiskId="1" />
                              </Component>
                          <Directory Id="dirCmdRef1_en_US" Name="1" src="$(var.DocDir)\man-pages\html\1\">
--- 321,352 ----
    <?endif?>
  
    <?ifndef BinsOnly?>
              <Directory Id="dirDocumentation" Name="Docum" LongName="Documentation" SourceName="Docs">
! 		    <!-- The following directory and everything below it is language dependent. -->
!                     <?if $(var.Language) = "en_US"?>
!                         <Component Id="cmp_Sys_Admin_Guide_en_US" Guid="$(var.DocChmSysAdminGuid)">
!                         <File Id="file_admin_guide_CHM_$(var.Language)" Name="AdminGd.chm" LongName="AdminGuide.chm" KeyPath="yes" DiskId="1" src="$(var.DocDir)\xml\AdminGuide\htmlhelp.chm">
!                 	          <Shortcut Id="scDocAdmin_en_US" Directory="dirShortCutDocs" Name="AdminGd.lnk" LongName="Administrator Guide.lnk" Description="$(loc.StrDocAdminGdLnkDesc)" Icon="ico_Help" IconIndex="0" Show="normal" WorkingDirectory="dirCommon" />
!                         </File>
                          </Component>
!                         <Component Id="cmp_User_Guide_en_US" Guid="$(var.DocChmUserGuid)">
!                         <File Id="file_user_guide_CHM_$(var.Language)" Name="UserGd.chm" LongName="UserGuide.chm" KeyPath="yes" DiskId="1"  src="$(var.DocDir)\xml\UserGuide\htmlhelp.chm">
!                 	          <Shortcut Id="scDocUser_en_US" Directory="dirShortCutDocs" Name="UserGd.lnk" LongName="User Guide.lnk" Description="$(loc.StrDocUserGdLnkDesc)" Icon="ico_Help" IconIndex="0" Show="normal" WorkingDirectory="dirCommon" />
!                         </File>
                          </Component>
!                         <Component Id="cmp_Release_Notes_en_US" Guid="$(var.DocChmRelNotesGuid)">
!                         <File Id="file_relnotes_CHM_$(var.Language)" Name="RelNotes.chm" LongName="ReleaseNotes.chm" KeyPath="yes" DiskId="1"  src="$(var.DocDir)\xml\ReleaseNotesWindows\htmlhelp.chm">
!                 	          <Shortcut Id="scDocRelNotes_en_US" Directory="dirShortCutDocs" Name="RelNotes.lnk" LongName="Release Notes.lnk" Description="$(loc.StrDocRelNotesLnkDesc)" Icon="ico_Help" IconIndex="0" Show="normal" WorkingDirectory="dirCommon" />
!                         </File>
!                         </Component>
!                     <?endif?>                        
!                     <Directory Id="dirHtml_$(var.Language)" Name="Html" src="$(var.SrcDir)\WINNT\doc\install\Documentation\$(var.Language)\html\">
                      <?if $(var.Language) = "en_US"?>
                          <Directory Id="dirCmdRef_en_US" Name="CmdRef" src="$(var.DocDir)\man-pages\html\">
                              <Component Id="cmp_Cmd_Ref_en_US" Guid="$(var.DocHtmlCmdRefGuid)">
!                                 <File Id="file_CmdRef_Index_HTM_en_US" Name="index.htm" LongName="index.html" KeyPath="yes" DiskId="1">
! 			          <Shortcut Id="scDocRefMan_$(var.Language)" Directory="dirShortCutDocs" Name="RefMan.lnk" LongName="Reference Manual.lnk" Description="$(loc.StrDocRefManLnkDesc)" Icon="ico_Help" IconIndex="0" Show="normal" WorkingDirectory="dirCommon" />
!                                 </File>
                                  <File Id="file_CmdRef_Style_CSS_en_US" Name="style.css" LongName="style.css" DiskId="1" />
                              </Component>
                          <Directory Id="dirCmdRef1_en_US" Name="1" src="$(var.DocDir)\man-pages\html\1\">
***************
*** 401,406 ****
--- 355,362 ----
                              <File Id="file_CmdRef_1_afsmonitor_html" Name="afsmonit.htm" LongName="afsmonitor.html" DiskId="1" />
                              <File Id="file_CmdRef_1_aklog_html" Name="aklog.htm" LongName="aklog.html" DiskId="1" />
                              <File Id="file_CmdRef_1_cmdebug_html" Name="cmdebug.htm" LongName="cmdebug.html" DiskId="1" />
+                             <File Id="file_CmdRef_1_compile_et_html" Name="compile_.htm" LongName="compile_et.html" DiskId="1" />
+                             <File Id="file_CmdRef_1_copyauth_html" Name="copyauth.htm" LongName="copyauth.html" DiskId="1" />
                              <File Id="file_CmdRef_1_dlog_html" Name="dlog.htm" LongName="dlog.html" DiskId="1" />
                              <File Id="file_CmdRef_1_dpass_html"  Name="dpass.htm"  LongName="dpass.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_html"  Name="fs.htm"  LongName="fs.html"  DiskId="1"  />
***************
*** 409,414 ****
--- 365,371 ----
                              <File Id="file_CmdRef_1_fs_checkvolumes_html"  Name="fs_chvol.htm"  LongName="fs_checkvolumes.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_cleanacl_html"  Name="fs_clean.htm"  LongName="fs_cleanacl.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_copyacl_html"  Name="fs_copya.htm"  LongName="fs_copyacl.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_1_fs_cscpolicy_html"  Name="fs_cscpo.htm"  LongName="fs_cscpolicy.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_diskfree_html"  Name="fs_diskf.htm"  LongName="fs_diskfree.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_examine_html"  Name="fs_exami.htm"  LongName="fs_examine.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_exportafs_html"  Name="fs_expor.htm"  LongName="fs_exportafs.html"  DiskId="1"  />
***************
*** 421,426 ****
--- 378,384 ----
                              <File Id="file_CmdRef_1_fs_getcellstatus_html"  Name="fs_getce.htm"  LongName="fs_getcellstatus.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_getclientaddrs_html"  Name="fs_getcl.htm"  LongName="fs_getclientaddrs.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_getcrypt_html"  Name="fs_getcr.htm"  LongName="fs_getcrypt.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_1_fs_getfid_html"  Name="fs_getfi.htm"  LongName="fs_getfid.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_getserverprefs_html"  Name="fs_getse.htm"  LongName="fs_getserverprefs.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_help_html"  Name="fs_help.htm"  LongName="fs_help.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_listacl_html"  Name="fs_lista.htm"  LongName="fs_listacl.html"  DiskId="1"  />
***************
*** 428,443 ****
--- 386,405 ----
                              <File Id="file_CmdRef_1_fs_listcells_html"  Name="fs_listc.htm"  LongName="fs_listcells.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_listquota_html"  Name="fs_listq.htm"  LongName="fs_listquota.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_lsmount_html"  Name="fs_lsmou.htm"  LongName="fs_lsmount.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_1_fs_memdump_html"  Name="fs_memdu.htm"  LongName="fs_memdump.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_messages_html"  Name="fs_messa.htm"  LongName="fs_messages.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_minidump_html"  Name="fs_minid.htm"  LongName="fs_minidump.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_mkmount_html"  Name="fs_mkmou.htm"  LongName="fs_mkmount.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_1_fs_monitor_html"  Name="fs_monit.htm"  LongName="fs_monitor.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_newalias_html"  Name="fs_newal.htm"  LongName="fs_newalias.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_newcell_html"  Name="fs_newce.htm"  LongName="fs_newcell.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_quota_html"  Name="fs_quota.htm"  LongName="fs_quota.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_rmmount_html"  Name="fs_rmmou.htm"  LongName="fs_rmmount.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_rxstatpeer_html"  Name="fs_rxsta.htm"  LongName="fs_rxstatpeer.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_1_fs_rxstatproc_html"  Name="fs_rxstc.htm"  LongName="fs_rxstatproc.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_setacl_html"  Name="fs_setac.htm"  LongName="fs_setacl.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_setcachesize_html"  Name="fs_setca.htm"  LongName="fs_setcachesize.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_1_fs_setcbaddr_html"  Name="fs_setcb.htm"  LongName="fs_setcbaddr.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_setcell_html"  Name="fs_setce.htm"  LongName="fs_setcell.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_setclientaddrs_html"  Name="fs_setcl.htm"  LongName="fs_setclientaddrs.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_setcrypt_html"  Name="fs_setcr.htm"  LongName="fs_setcrypt.html"  DiskId="1"  />
***************
*** 446,451 ****
--- 408,414 ----
                              <File Id="file_CmdRef_1_fs_setvol_html"  Name="fs_setvo.htm"  LongName="fs_setvol.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_storebehind_html"  Name="fs_store.htm"  LongName="fs_storebehind.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_sysname_html"  Name="fs_sysna.htm"  LongName="fs_sysname.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_1_fs_trace_html"  Name="fs_trace.htm"  LongName="fs_trace.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_uuid_html"  Name="fs_uuid.htm"  LongName="fs_uuid.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_whereis_html"  Name="fs_where.htm"  LongName="fs_whereis.html"  DiskId="1"  />
                              <File Id="file_CmdRef_1_fs_whichcell_html"  Name="fs_which.htm"  LongName="fs_whichcell.html"  DiskId="1"  />
***************
*** 686,691 ****
--- 649,656 ----
                              <File Id="file_CmdRef_8_ptserver_html"  Name="ptserver.htm"  LongName="ptserver.html"  DiskId="1"  />
                              <File Id="file_CmdRef_8_pt_util_html"  Name="pt_util.htm"  LongName="pt_util.html"  DiskId="1"  />
                              <File Id="file_CmdRef_8_read_tape_html"  Name="read_tap.htm"  LongName="read_tape.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_8_restorevol_html"  Name="restorev.htm"  LongName="restorevol.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_8_rmtsysd_html"  Name="rmtsysd.htm"  LongName="rmtsysd.html"  DiskId="1"  />
                              <File Id="file_CmdRef_8_salvager_html"  Name="salvager.htm"  LongName="salvager.html"  DiskId="1"  />
                              <File Id="file_CmdRef_8_salvageserver_html"  Name="salvages.htm"  LongName="salvageserver.html"  DiskId="1"  />
                              <File Id="file_CmdRef_8_upclient_html"  Name="upclient.htm"  LongName="upclient.html"  DiskId="1"  />
***************
*** 702,707 ****
--- 667,673 ----
                              <File Id="file_CmdRef_8_voldump_html"  Name="voldump.htm"  LongName="voldump.html"  DiskId="1"  />
                              <File Id="file_CmdRef_8_volinfo_html"  Name="volinfo.htm"  LongName="volinfo.html"  DiskId="1"  />
                              <File Id="file_CmdRef_8_volserver_html"  Name="volserve.htm"  LongName="volserver.html"  DiskId="1"  />
+                             <File Id="file_CmdRef_8_vsys_html"  Name="vsys.htm"  LongName="vsys.html"  DiskId="1"  />
                              <File Id="file_CmdRef_8_xfs_size_check_html"  Name="xfs_size.htm"  LongName="xfs_size_check.html"  DiskId="1"  />
                              </Component>
                          </Directory> <!-- CmdRef_8 -->
***************
*** 709,715 ****
                      <?else?>
                          <Directory Id="dirCmdRef_$(var.Language)" Name="CmdRef" src="$(var.SrcDir)\WINNT\doc\install\Documentation\$(var.Language)\html\CmdRef\">
                              <Component Id="cmp_Cmd_Ref_$(var.Language)" Guid="$(var.DocHtmlCmdRefGuid)">
!                                 <File Id="fileauarf000_HTM_$(var.Language)" Name="auarf000.htm" LongName="auarf000.htm" KeyPath="yes" DiskId="1" />
                                  <File Id="fileauarf002_HTM_$(var.Language)" Name="auarf002.htm" LongName="auarf002.htm" DiskId="1" />
                                  <File Id="fileauarf003_HTM_$(var.Language)" Name="auarf003.htm" LongName="auarf003.htm" DiskId="1" />
                                  <File Id="fileauarf004_HTM_$(var.Language)" Name="auarf004.htm" LongName="auarf004.htm" DiskId="1" />
--- 675,683 ----
                      <?else?>
                          <Directory Id="dirCmdRef_$(var.Language)" Name="CmdRef" src="$(var.SrcDir)\WINNT\doc\install\Documentation\$(var.Language)\html\CmdRef\">
                              <Component Id="cmp_Cmd_Ref_$(var.Language)" Guid="$(var.DocHtmlCmdRefGuid)">
!                                 <File Id="fileauarf000_HTM_$(var.Language)" Name="auarf000.htm" LongName="auarf000.htm" KeyPath="yes" DiskId="1">
!        			          <Shortcut Id="scDocRefMan_$(var.Language)" Directory="dirShortCutDocs" Name="RefMan.lnk" LongName="Reference Manual.lnk" Description="$(loc.StrDocRefManLnkDesc)" Icon="ico_Help" IconIndex="0" Show="normal" WorkingDirectory="dirCommon" />
!                                 </File>
                                  <File Id="fileauarf002_HTM_$(var.Language)" Name="auarf002.htm" LongName="auarf002.htm" DiskId="1" />
                                  <File Id="fileauarf003_HTM_$(var.Language)" Name="auarf003.htm" LongName="auarf003.htm" DiskId="1" />
                                  <File Id="fileauarf004_HTM_$(var.Language)" Name="auarf004.htm" LongName="auarf004.htm" DiskId="1" />
***************
*** 1003,1009 ****
                                  <File Id="fileawqbg004_HTM_$(var.Language)" Name="awqbg004.htm" LongName="awqbg004.htm" DiskId="1" />
                              </Component>
                          </Directory> <!-- InstallGd -->
-                     <?endif?>
                          <Directory Id="dirSysAdminGd_$(var.Language)" Name="SysAd" LongName="SysAdminGd" SourceName="SysAdm" LongSource="SysAdminGd" src="$(var.SrcDir)\WINNT\doc\install\Documentation\$(var.Language)\html\SysAdminGd\">
                              <Component Id="cmp_Sys_Admin_Guide_$(var.Language)" Guid="$(var.DocHtmlSysAdminGuid)">
                                  <File Id="fileauagd000_HTM_$(var.Language)" Name="auagd.htm" LongName="auagd000.htm" KeyPath="yes" DiskId="1" />
--- 971,976 ----
***************
*** 1071,1076 ****
--- 1038,1044 ----
                                  </Component>
                              </Directory>
                          </Directory> <!-- Release Notes -->
+                     <?endif?>
                      </Directory> <!-- Html -->
              </Directory> <!-- Documentation -->
    <?endif?>
***************
*** 1098,1106 ****
                      <Component Win64="$(var.Win64)" Id="cmf_libosi_DLL" Guid="$(var.cmf_libosi_DLL_guid)">
                          <File Id="filelibosi_DLL" Name="libosi.dll" LongName="libosi.dll" KeyPath="yes" DiskId="1" />
                      </Component>
-                     <Component Win64="$(var.Win64)" Id="cmf_libafsconf_DLL" Guid="$(var.cmf_libafsconf_DLL_guid)">
-                         <File Id="filelibafsconf_DLL" Name="libafscf.dll" LongName="libafsconf.dll" KeyPath="yes" DiskId="1" />
-                     </Component>
                      <Component Win64="$(var.Win64)" Id="cmf_klog_EXE" Guid="$(var.cmf_klog_EXE_guid)">
                          <File Id="fileklog_EXE" Name="klog.exe" LongName="klog.exe" KeyPath="yes" DiskId="1" />
                      </Component>
--- 1066,1071 ----
***************
*** 1278,1284 ****
                       <Component Win64="$(var.Win64)" Id="cmp_ClientProgramDebug" Guid="$(var.cmp_ClientProgramDebug_guid)">
                          <File Id="fileafsshare_PDB" Name="afsshare.pdb" LongName="afsshare.pdb" DiskId="1" />
                          <File Id="filelibosi_PDB" Name="libosi.pdb" LongName="libosi.pdb" DiskId="1" />
-                         <File Id="filelibafsconf_PDB" Name="libafscf.pdb" LongName="libafsconf.pdb" DiskId="1" />
                          <File Id="fileklog_PDB" Name="klog.pdb" LongName="klog.pdb" DiskId="1" />
                          <File Id="filetokens_PDB" Name="tokens.pdb" LongName="tokens.pdb" DiskId="1" />
                          <File Id="fileunlog_PDB" Name="unlog.pdb" LongName="unlog.pdb" DiskId="1" />
--- 1243,1248 ----
***************
*** 1364,1369 ****
--- 1328,1339 ----
                              <Component Win64="$(var.Win64)" Id="cmf_ptserver_EXE" Guid="$(var.cmf_ptserver_EXE_guid)">
                                  <File Id="fileptserver_EXE" Name="ptser.exe" LongName="ptserver.exe" KeyPath="yes" DiskId="1" />
                              </Component>
+                              <Component Win64="$(var.Win64)" Id="cmf_ptclient_EXE" Guid="$(var.cmf_ptclient_EXE_guid)">
+                                 <File Id="fileptclient_EXE" Name="ptclient.exe" LongName="ptclient.exe" KeyPath="yes" DiskId="1" src="$(var.BinDir)\ptclient.exe" />
+                             </Component>
+                              <Component Win64="$(var.Win64)" Id="cmf_pt_util_EXE" Guid="$(var.cmf_pt_util_EXE_guid)">
+                                 <File Id="filept_util_EXE" Name="pt_util.exe" LongName="pt_util.exe" KeyPath="yes" DiskId="1" src="$(var.BinDir)\pt_util.exe" />
+                             </Component>
                              <Component Win64="$(var.Win64)" Id="cmf_salvager_EXE" Guid="$(var.cmf_salvager_EXE_guid)">
                                  <File Id="filesalvager_EXE" Name="salva.exe" LongName="salvager.exe" KeyPath="yes" DiskId="1" />
                              </Component>
***************
*** 1689,1697 ****
                              <File Id="filelanahelper_LIB" Name="LANAHE~1.lib" LongName="lanahelper.lib" DiskId="1" src="$(var.LibDir)lanahelper.lib" /> 
                              <File Id="filelibafsconf_LIB" Name="LIBAFS~1.lib" LongName="libafsconf.lib" DiskId="1" src="$(var.LibDir)libafsconf.lib" /> 
                              <File Id="filelibosi_LIB" Name="libosi.lib" LongName="libosi.lib" DiskId="1" src="$(var.LibDir)libosi.lib" /> 
-                             <File Id="filecm_config_OBJ" Name="CM_CON~1.obj" LongName="cm_config.obj" DiskId="1" src="$(var.LibDir)cm_config.obj" /> 
-                             <File Id="filecm_dns_OBJ" Name="cm_dns.obj" LongName="cm_dns.obj" DiskId="1" src="$(var.LibDir)cm_dns.obj" /> 
                          </Component>
                          <Directory Id="dirLibAfs" Name="afs">
                              <Component Win64="$(var.Win64)" Id="cmp_SDK_Lib_Afs" Guid="$(var.cmp_SDK_Lib_Afs_guid)">
                                  <File Id="fileafsacl_LIB" Name="afsacl.lib" LongName="afsacl.lib" DiskId="1" src="$(var.LibDir)afs\afsacl.lib" /> 
--- 1659,1674 ----
                              <File Id="filelanahelper_LIB" Name="LANAHE~1.lib" LongName="lanahelper.lib" DiskId="1" src="$(var.LibDir)lanahelper.lib" /> 
                              <File Id="filelibafsconf_LIB" Name="LIBAFS~1.lib" LongName="libafsconf.lib" DiskId="1" src="$(var.LibDir)libafsconf.lib" /> 
                              <File Id="filelibosi_LIB" Name="libosi.lib" LongName="libosi.lib" DiskId="1" src="$(var.LibDir)libosi.lib" /> 
                          </Component>
+                         <?ifdef CygwinArchives?>
+                         <Component Win64="$(var.Win64)" Id="cmp_SDK_Lib_Cygwin" Guid="$(var.cmp_SDK_Lib_Cygwin_guid)">
+                           <File Id="fileafsauthent_A" Name="afsauth.a" LongName="afsauthent.a" DiskId="1" src="$(var.LibDir)afsauthent.a" />
+                           <File Id="fileafspthread_A" Name="afspthrd.a" LongName="afspthread.a" DiskId="1" src="$(var.LibDir)afspthread.a" />
+                           <File Id="fileafsrpc_A" Name="afsrpc.a" LongName="afsrpc.a" DiskId="1" src="$(var.LibDir)afsrpc.a" />
+                           <File Id="filelibafsconf_A" Name="libafscf.a" LongName="libafsconf.a" DiskId="1" src="$(var.LibDir)libafsconf.a" />
+                           <File Id="filelibosi_A" Name="libosi.a" LongName="libosi.a" DiskId="1" src="$(var.ClientDir)libosi.a" /> 
+                         </Component>
+                         <?endif?>
                          <Directory Id="dirLibAfs" Name="afs">
                              <Component Win64="$(var.Win64)" Id="cmp_SDK_Lib_Afs" Guid="$(var.cmp_SDK_Lib_Afs_guid)">
                                  <File Id="fileafsacl_LIB" Name="afsacl.lib" LongName="afsacl.lib" DiskId="1" src="$(var.LibDir)afs\afsacl.lib" /> 
***************
*** 1732,1737 ****
--- 1709,1726 ----
                                  <File Id="fileTaAfsAppLib_LIB" Name="TAAFSA~2.lib" LongName="TaAfsAppLib.lib" DiskId="1" src="$(var.LibDir)afs\TaAfsAppLib.lib" /> 
                                  <File Id="filetalocale_LIB" Name="talocale.lib" LongName="talocale.lib" DiskId="1" src="$(var.LibDir)afs\talocale.lib" /> 
                              </Component>
+                             <?ifdef CygwinArchives?>
+                             <Component Win64="$(var.Win64)" Id="cmp_SDK_Lib_Afs_Cygwin" Guid="$(var.cmp_SDK_Lib_Afs_Cygwin_guid)">
+                                 <File Id="fileafsadminutil_A" Name="afsadmut.a" LongName="afsadminutil.a" DiskId="1" src="$(var.ServerDir)afsadminutil.a" /> 
+                                 <File Id="fileafsbosadmin_A" Name="afsbosad.a" LongName="afsbosadmin.a" DiskId="1" src="$(var.ServerDir)afsbosadmin.a" /> 
+                                 <File Id="fileafscfgadmin_A" Name="afscfgad.a" LongName="afscfgadmin.a" DiskId="1" src="$(var.ServerDir)afscfgadmin.a" /> 
+                                 <File Id="fileafsclientadmin_A" Name="afscliad.a" LongName="afsclientadmin.a" DiskId="1" src="$(var.ServerDir)afsclientadmin.a" /> 
+                                 <File Id="fileafskasadmin_A" Name="afskasad.a" LongName="afskasadmin.a" DiskId="1" src="$(var.ServerDir)afskasadmin.a" /> 
+                                 <File Id="fileafsprocmgmt_A" Name="afsprcmg.a" LongName="afsprocmgmt.a" DiskId="1" src="$(var.ServerDir)afsprocmgmt.a" /> 
+                                 <File Id="fileafsptsadmin_A" Name="afsptsad.a" LongName="afsptsadmin.a" DiskId="1" src="$(var.ServerDir)afsptsadmin.a" /> 
+                                 <File Id="fileafsvosadmin_A" Name="afsvosad.a" LongName="afsvosadmin.a" DiskId="1" src="$(var.ServerDir)afsvosadmin.a" /> 
+                             </Component>
+                             <?endif?>
                          </Directory>
                      </Directory>
              </Directory> <!-- SDK -->
***************
*** 1743,1749 ****
    <?ifndef BinsOnly ?>
      <!-- References -->
      <Directory Id="ProgramMenuFolder" Name=".">
!         <Directory Id="dirShortCut" Name="OpenAFS"/>
      </Directory>
      <Directory Id="StartupFolder" Name="." />
      <Directory Id="WindowsVolume" Name="." />
--- 1732,1740 ----
    <?ifndef BinsOnly ?>
      <!-- References -->
      <Directory Id="ProgramMenuFolder" Name=".">
!         <Directory Id="dirShortCut" Name="OpenAFS">
!             <Directory Id="dirShortCutDocs" Name="Docs" LongName="Documentation" />
!         </Directory>
      </Directory>
      <Directory Id="StartupFolder" Name="." />
      <Directory Id="WindowsVolume" Name="." />
***************
*** 1791,1795 ****
--- 1782,1829 ----
  				<Merge Id="MSVCRT8PFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_8_0_Microsoft_VC80_MFCLOC_x86.msm"/>
  			<?endif?>
  		<?endif?>
+ 
+     <?elseif $(env.AFSVER_CL) = "1500"?>
+ 
+ 		<?ifdef env.CommonProgramFiles6432?>
+ 		  <?define CPF="$(env.CommonProgramFiles(x86)"?>
+ 		<?else?>
+ 		  <?define CPF="$(env.CommonProgramFiles)"?>
+ 		<?endif?>
+ 
+ 		<?if $(var.Platform) = "x64" ?>
+ 			<?ifndef Debug?>
+ 				<Merge Id="MSVCRT9MEM" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_CRT_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9POL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_CRT_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9MFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_MFC_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9PFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_MFC_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9MFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_MFCLOC_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9PFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_MFCLOC_x86_x64.msm"/>
+ 			<?else?>
+ 				<Merge Id="MSVCRT9MEM" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_DebugCRT_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9POL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9MFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_DebugMFC_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9PFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_DebugMFC_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9MFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_MFCLOC_x86_x64.msm"/>
+ 				<Merge Id="MSVCRT9PFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_MFCLOC_x86_x64.msm"/>
+ 			<?endif?>
+ 		<?else?>
+ 			<?ifndef Debug?>
+ 				<Merge Id="MSVCRT9MEM" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_CRT_x86.msm"/>
+ 				<Merge Id="MSVCRT9POL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_CRT_x86.msm"/>
+ 				<Merge Id="MSVCRT9MFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_MFC_x86.msm"/>
+ 				<Merge Id="MSVCRT9PFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_MFC_x86.msm"/>
+ 				<Merge Id="MSVCRT9MFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_MFCLOC_x86.msm"/>
+ 				<Merge Id="MSVCRT9PFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_MFCLOC_x86.msm"/>
+ 			<?else?>
+ 				<Merge Id="MSVCRT9MEM" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_DebugCRT_x86.msm"/>
+ 				<Merge Id="MSVCRT9POL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86.msm"/>
+ 				<Merge Id="MSVCRT9MFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_DebugMFC_x86.msm"/>
+ 				<Merge Id="MSVCRT9PFC" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_DebugMFC_x86.msm"/>
+ 				<Merge Id="MSVCRT9MFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\Microsoft_VC90_MFCLOC_x86.msm"/>
+ 				<Merge Id="MSVCRT9PFL" DiskId="1" Language="0" src="$(var.CPF)\Merge Modules\policy_9_0_Microsoft_VC90_MFCLOC_x86.msm"/>
+ 			<?endif?>
+ 		<?endif?>
+ 
  	<?endif?>
  </Include>
Index: openafs/src/WINNT/install/wix/language_config.wxi
diff -c openafs/src/WINNT/install/wix/language_config.wxi:1.5.2.1 openafs/src/WINNT/install/wix/language_config.wxi:1.5.2.2
*** openafs/src/WINNT/install/wix/language_config.wxi:1.5.2.1	Sat Jun 28 21:22:31 2008
--- openafs/src/WINNT/install/wix/language_config.wxi	Thu May 21 14:06:21 2009
***************
*** 70,75 ****
--- 70,79 ----
      <?define DocHtmlRelnotesFilesGuid="D39E1662-F475-4D33-A6B5-CBC7B77891D0"?>
      <?define DocHtmlLogoFilesGuid="24E7F4AF-5D41-4D7B-B9DF-FA5787BAC787"?>
      <?define DocHtmlIndexFilesGuid="EEEA73B6-36CD-4471-BF5C-9317B90CA3CC"?>
+ 
+     <?define DocChmSysAdminGuid="9D78A7CB-AD7A-4464-AAF6-0046512033E8"?>
+     <?define DocChmUserGuid="B2603B9D-DD21-4B3D-B6DB-0F8E7AC58D85"?>
+     <?define DocChmRelNotesGuid="9206FE77-95FA-41D6-A014-B5903E9B1FC2"?>
  <?endif?>
  	<!-- other language specific strings are defined in the strings.wxl file -->	
  
Index: openafs/src/WINNT/install/wix/platform.wxi
diff -c openafs/src/WINNT/install/wix/platform.wxi:1.2.2.4 openafs/src/WINNT/install/wix/platform.wxi:1.2.2.6
*** openafs/src/WINNT/install/wix/platform.wxi:1.2.2.4	Thu Aug 30 22:27:38 2007
--- openafs/src/WINNT/install/wix/platform.wxi	Wed May 27 09:55:58 2009
***************
*** 79,84 ****
--- 79,86 ----
  	<?define cmp_ClientProgramDebug_guid="FC0AD966-9323-4AAA-96D1-FFEF44460E59"?>
  	<?define cmp_SDK_Lib_guid="A7CC24B1-E6A9-4254-B468-F4C47BC9ECFC"?>
  	<?define cmp_SDK_Lib_Afs_guid="C0DA2C3B-B2B8-4AD4-9B00-42FB45C5B352"?>
+ 	<?define cmp_SDK_Lib_Cygwin_guid="6F09E575-6482-4D90-A6CD-408321539679"?>
+ 	<?define cmp_SDK_Lib_Afs_Cygwin_guid="19AB6F3B-AE92-40D8-8C68-3F39A1AB68C0"?>
  	<?define cmf_vlserver_EXE_guid="88A9024C-D5B2-4AF1-8241-E0B046E25FE3"?>
  	<?define cmf_volinfo_EXE_guid="55C8984F-D58A-44FD-9566-3C033612B2DB"?>
  	<?define cmf_volserver_EXE_guid="98049267-9D3C-4BBC-B5E5-E3A0BCE0B8AF"?>
***************
*** 93,98 ****
--- 95,102 ----
  	<?define cmf_butc_EXE_guid="2E03B583-AAEE-4674-AA53-98D6596C6668"?>
  	<?define cmf_kaserver_EXE_guid="29D8D9DC-5C12-48E4-ACEF-797380EFE794"?>
  	<?define cmf_ptserver_EXE_guid="78199FF4-33AF-4A7E-9316-4E90522EA93F"?>
+ 	<?define cmf_ptclient_EXE_guid="B5C877B4-65DD-46DE-B20A-2713EB444333"?>
+ 	<?define cmf_pt_util_EXE_guid="62A501E3-79AC-4351-BF48-AA0E506D6997"?>
  	<?define cmf_salvager_EXE_guid="01C16D4F-ABCD-476D-B678-BCF87F1F1599"?>
  	<?define cmf_upclient_EXE_guid="DE392019-13E0-45FD-BA82-E4C0148AC654"?>
  	<?define cmf_upserver_EXE_guid="4201E9FE-56BC-4852-992A-18E5D75C3B39"?>
***************
*** 183,188 ****
--- 187,194 ----
  	<?define cmp_ClientProgramDebug_guid="A6A394F6-45D0-45A9-A7DD-C0997070EC14"?>
  	<?define cmp_SDK_Lib_guid="71BC1B4E-4C4C-4FF8-8DDA-C6AB2BE22142"?>
  	<?define cmp_SDK_Lib_Afs_guid="CD671A64-D491-4363-A7AD-645482B481BE"?>
+ 	<?define cmp_SDK_Lib_Cygwin_guid="EA2FC9C5-2001-41F7-9220-A5C63B2C523D"?>
+ 	<?define cmp_SDK_Lib_Afs_Cygwin_guid="F342A346-E149-47A2-9206-5B51EED7E689"?>
  	<?define cmf_vlserver_EXE_guid="F6A43B78-EE17-4483-AA81-4B6C6957977D"?>
  	<?define cmf_volinfo_EXE_guid="CED56F48-1049-403F-912B-3C186867B563"?>
  	<?define cmf_volserver_EXE_guid="36A386A0-6DA9-40A7-A12D-6A521559933D"?>
***************
*** 197,202 ****
--- 203,210 ----
  	<?define cmf_butc_EXE_guid="96DAC5A8-FD16-4FF5-8BD5-92F25880E557"?>
  	<?define cmf_kaserver_EXE_guid="73117045-0BB8-4F57-8A75-909F35C2D723"?>
  	<?define cmf_ptserver_EXE_guid="CDBDE41D-24DF-44E5-97D2-EFA71CDBEECB"?>
+ 	<?define cmf_ptclient_EXE_guid="71F7F7A4-67FC-4169-8BB6-82E5753AB69A"?>
+ 	<?define cmf_pt_util_EXE_guid="CEB2A768-5EC9-4056-88D4-2D341A95073E"?>
  	<?define cmf_salvager_EXE_guid="E3F3ACE5-B556-4FEF-9DA2-78B194AA6639"?>
  	<?define cmf_upclient_EXE_guid="321BB9BF-5FF0-4363-9927-41C60BD526E9"?>
  	<?define cmf_upserver_EXE_guid="3CBD2EF5-43BC-4CA2-B367-87E82DED1406"?>
Index: openafs/src/WINNT/install/wix/runtime.wxi
diff -c openafs/src/WINNT/install/wix/runtime.wxi:1.2.4.1 openafs/src/WINNT/install/wix/runtime.wxi:1.2.4.2
*** openafs/src/WINNT/install/wix/runtime.wxi:1.2.4.1	Thu Jun 26 22:06:21 2008
--- openafs/src/WINNT/install/wix/runtime.wxi	Thu May 21 14:08:34 2009
***************
*** 7,12 ****
--- 7,19 ----
  		<MergeRef Id="MSVCRT8PFC"/>
  		<MergeRef Id="MSVCRT8MFL"/>
  		<MergeRef Id="MSVCRT8PFL"/>
+     <?elseif $(env.AFSVER_CL) = "1500" ?>
+ 		<MergeRef Id="MSVCRT9MEM"/>
+ 		<MergeRef Id="MSVCRT9POL"/>
+ 		<MergeRef Id="MSVCRT9MFC"/>
+ 		<MergeRef Id="MSVCRT9PFC"/>
+ 		<MergeRef Id="MSVCRT9MFL"/>
+ 		<MergeRef Id="MSVCRT9PFL"/>
      <?endif?>
  <?ifndef Debug?>
      <?if $(env.AFSVER_CL) = "1310" ?>
Index: openafs/src/WINNT/install/wix/lang/en_US/strings.wxl
diff -c openafs/src/WINNT/install/wix/lang/en_US/strings.wxl:1.6.2.3 openafs/src/WINNT/install/wix/lang/en_US/strings.wxl:1.6.2.4
*** openafs/src/WINNT/install/wix/lang/en_US/strings.wxl:1.6.2.3	Thu Jun 26 22:06:22 2008
--- openafs/src/WINNT/install/wix/lang/en_US/strings.wxl	Thu May 21 14:06:21 2009
***************
*** 38,44 ****
      <String Id="StrHlpFileDesc">AFS Client Help</String>
      <String Id="StrSvrMgrDesc">Server Manager</String>
      <String Id="StrAcctMgrDesc">Account Manager</String>
!     <String Id="StrDocLnkDesc">AFS Documentation</String>
      <String Id="StrCfgWzdDesc">Server Configuration Wizard</String>
  
      <String Id="StrLaunchCond">OpenAFS for Windows is currently only packaged for Windows 2000,XP and 2003</String>
--- 38,49 ----
      <String Id="StrHlpFileDesc">AFS Client Help</String>
      <String Id="StrSvrMgrDesc">Server Manager</String>
      <String Id="StrAcctMgrDesc">Account Manager</String>
!     <String Id="StrDocLnkDesc">OpenAFS Documentation</String>
!     <String Id="StrDocRefManLnkDesc">OpenAFS Reference Manual</String>
!     <String Id="StrDocAdminGdLnkDesc">OpenAFS Administrator Guide</String>
!     <String Id="StrDocUserGdLnkDesc">OpenAFS User Guide</String>
!     <String Id="StrDocRelNotesLnkDesc">OpenAFS Release Notes</String>
! 
      <String Id="StrCfgWzdDesc">Server Configuration Wizard</String>
  
      <String Id="StrLaunchCond">OpenAFS for Windows is currently only packaged for Windows 2000,XP and 2003</String>
Index: openafs/src/WINNT/pthread/NTMakefile
diff -c openafs/src/WINNT/pthread/NTMakefile:1.10.4.2 openafs/src/WINNT/pthread/NTMakefile:1.10.4.3
*** openafs/src/WINNT/pthread/NTMakefile:1.10.4.2	Sat Aug 16 13:49:42 2008
--- openafs/src/WINNT/pthread/NTMakefile	Wed May 20 01:03:51 2009
***************
*** 32,37 ****
--- 32,38 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def pthread.def
  
  install: $(PTHR_DLLFILE) $(LIBINCLUDES)
  
Index: openafs/src/afs/afs.h
diff -c openafs/src/afs/afs.h:1.85.2.19 openafs/src/afs/afs.h:1.85.2.22
*** openafs/src/afs/afs.h:1.85.2.19	Wed Mar 18 23:58:04 2009
--- openafs/src/afs/afs.h	Mon May 11 09:40:25 2009
***************
*** 782,789 ****
--- 782,791 ----
      struct lock__bsd__ rwlock;
  #endif
  #ifdef AFS_XBSD_ENV
+ #if !defined(AFS_DFBSD_ENV)
      struct lock rwlock;
  #endif
+ #endif
  
      struct VenusFid *mvid;	/* Either parent dir (if root) or root (if mt pt) */
      char *linkData;		/* Link data if a symlink. */
***************
*** 1019,1052 ****
      afs_int32 otherCSize;
  };
  
! #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_64BIT_ENV)
  /* Using ino64_t here so that user level debugging programs compile
   * the size correctly.
   */
! #define afs_inode_t ino64_t
! #else
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_S390X_LINUX24_ENV)
! #define afs_inode_t long
! #else
! #if defined(AFS_AIX51_ENV) || defined(AFS_HPUX1123_ENV)
! #define afs_inode_t ino_t
! #else
! #define afs_inode_t afs_int32
! #endif
! #endif
! #endif
! 
  
  #ifdef KERNEL
  /* it does not compile outside kernel */
  struct buffer {
    afs_int32 fid;              /* is adc->index, the cache file number */
!   afs_inode_t inode;          /* is adc->f.inode, the inode number of the cac\
  				 he file */
- #if defined(LINUX_USE_FH)
-   struct fid fh;		/* Opaque file handle */
-   int fh_type;			/* Opaque file handle type */
- #endif
    afs_int32 page;
    afs_int32 accesstime;
    struct buffer *hashNext;
--- 1021,1062 ----
      afs_int32 otherCSize;
  };
  
! #if defined(AFS_CACHE_VNODE_PATH) || defined(UKERNEL)
! typedef afs_int32 afs_ufs_dcache_id_t;
! #elif defined(AFS_SGI61_ENV) || defined(AFS_SUN57_64BIT_ENV)
  /* Using ino64_t here so that user level debugging programs compile
   * the size correctly.
   */
! typedef ino64_t afs_ufs_dcache_id_t;
! #elif defined(LINUX_USE_FH)
! #define MAX_FH_LEN 10
! typedef union {
!      struct fid fh;
!      __u32 raw[MAX_FH_LEN];
! } afs_ufs_dcache_id_t;
! extern int cache_fh_type;
! extern int cache_fh_len;
! #elif defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_S390X_LINUX24_ENV)
! typedef long afs_ufs_dcache_id_t;
! #elif defined(AFS_AIX51_ENV) || defined(AFS_HPUX1123_ENV)
! typedef ino_t afs_ufs_dcache_id_t;
! #else
! typedef afs_int32 afs_ufs_dcache_id_t;
! #endif
! 
! typedef afs_int32 afs_mem_dcache_id_t;
! 
! typedef union {
!     afs_ufs_dcache_id_t ufs;
!     afs_mem_dcache_id_t mem;
! } afs_dcache_id_t;
  
  #ifdef KERNEL
  /* it does not compile outside kernel */
  struct buffer {
    afs_int32 fid;              /* is adc->index, the cache file number */
!   afs_dcache_id_t inode;          /* is adc->f.inode, the inode number of the cac\
  				 he file */
    afs_int32 page;
    afs_int32 accesstime;
    struct buffer *hashNext;
***************
*** 1066,1078 ****
      afs_int32 modTime;		/* last time this entry was modified */
      afs_hyper_t versionNo;	/* Associated data version number */
      afs_int32 chunk;		/* Relative chunk number */
!     afs_inode_t inode;		/* Unix inode for this chunk */
      afs_int32 chunkBytes;	/* Num bytes in this chunk */
      char states;		/* Has this chunk been modified? */
- #if defined(LINUX_USE_FH)
-     struct fid fh;		/* File handle */
-     int fh_type;		/* File handle type */
- #endif
  };
  #endif
  
--- 1076,1084 ----
      afs_int32 modTime;		/* last time this entry was modified */
      afs_hyper_t versionNo;	/* Associated data version number */
      afs_int32 chunk;		/* Relative chunk number */
!     afs_dcache_id_t inode;		/* Unix inode for this chunk */
      afs_int32 chunkBytes;	/* Num bytes in this chunk */
      char states;		/* Has this chunk been modified? */
  };
  #endif
  
Index: openafs/src/afs/afs_buffer.c
diff -c openafs/src/afs/afs_buffer.c:1.22.4.5 openafs/src/afs/afs_buffer.c:1.22.4.6
*** openafs/src/afs/afs_buffer.c:1.22.4.5	Wed Jan 21 16:15:03 2009
--- openafs/src/afs/afs_buffer.c	Mon May 11 09:28:04 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_buffer.c,v 1.22.4.5 2009/01/21 21:15:03 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_buffer.c,v 1.22.4.6 2009/05/11 13:28:04 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 131,137 ****
  	/* Fill in each buffer with an empty indication. */
  	tb = &Buffers[i];
  	tb->fid = NULLIDX;
! 	tb->inode = 0;
  	tb->accesstime = 0;
  	tb->lockers = 0;
  #if defined(AFS_USEBUFFERS)
--- 131,137 ----
  	/* Fill in each buffer with an empty indication. */
  	tb = &Buffers[i];
  	tb->fid = NULLIDX;
! 	afs_reset_inode(&tb->inode);
  	tb->accesstime = 0;
  	tb->lockers = 0;
  #if defined(AFS_USEBUFFERS)
***************
*** 227,249 ****
      tb->lockers++;
      if (page * AFS_BUFFER_PAGESIZE >= adc->f.chunkBytes) {
  	tb->fid = NULLIDX;
! 	tb->inode = 0;
  	tb->lockers--;
  	MReleaseWriteLock(&tb->lock);
  	return NULL;
      }
! #if defined(LINUX_USE_FH)
!     tfile = afs_CFileOpen(&adc->f.fh, adc->f.fh_type);
! #else
!     tfile = afs_CFileOpen(adc->f.inode);
! #endif
      code =
  	afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE, tb->data,
  		      AFS_BUFFER_PAGESIZE);
      afs_CFileClose(tfile);
      if (code < AFS_BUFFER_PAGESIZE) {
  	tb->fid = NULLIDX;
! 	tb->inode = 0;
  	tb->lockers--;
  	MReleaseWriteLock(&tb->lock);
  	return NULL;
--- 227,245 ----
      tb->lockers++;
      if (page * AFS_BUFFER_PAGESIZE >= adc->f.chunkBytes) {
  	tb->fid = NULLIDX;
! 	afs_reset_inode(&tb->inode);
  	tb->lockers--;
  	MReleaseWriteLock(&tb->lock);
  	return NULL;
      }
!     tfile = afs_CFileOpen(&adc->f.inode);
      code =
  	afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE, tb->data,
  		      AFS_BUFFER_PAGESIZE);
      afs_CFileClose(tfile);
      if (code < AFS_BUFFER_PAGESIZE) {
  	tb->fid = NULLIDX;
! 	afs_reset_inode(&tb->inode);
  	tb->lockers--;
  	MReleaseWriteLock(&tb->lock);
  	return NULL;
***************
*** 348,358 ****
  
      if (lp->dirty) {
  	/* see DFlush for rationale for not getting and locking the dcache */
! #if defined(LINUX_USE_FH)
!         tfile = afs_CFileOpen(&lp->fh, lp->fh_type);
! #else
!         tfile = afs_CFileOpen(lp->inode);
! #endif
  	afs_CFileWrite(tfile, lp->page * AFS_BUFFER_PAGESIZE, lp->data,
  		       AFS_BUFFER_PAGESIZE);
  	lp->dirty = 0;
--- 344,350 ----
  
      if (lp->dirty) {
  	/* see DFlush for rationale for not getting and locking the dcache */
!         tfile = afs_CFileOpen(&lp->inode);
  	afs_CFileWrite(tfile, lp->page * AFS_BUFFER_PAGESIZE, lp->data,
  		       AFS_BUFFER_PAGESIZE);
  	lp->dirty = 0;
***************
*** 362,373 ****
  
      /* Now fill in the header. */
      lp->fid = adc->index;
! #if defined(LINUX_USE_FH)
!     memcpy(&lp->fh, &adc->f.fh, sizeof(struct fid));
!     lp->fh_type = adc->f.fh_type;
! #else
!     lp->inode = adc->f.inode;
! #endif
      lp->page = apage;
      lp->accesstime = timecounter++;
      FixupBucket(lp);		/* move to the right hash bucket */
--- 354,360 ----
  
      /* Now fill in the header. */
      lp->fid = adc->index;
!     afs_copy_inode(&lp->inode, &adc->f.inode);
      lp->page = apage;
      lp->accesstime = timecounter++;
      FixupBucket(lp);		/* move to the right hash bucket */
***************
*** 469,475 ****
  	    if (tb->fid == adc->index) {
  		MObtainWriteLock(&tb->lock, 262);
  		tb->fid = NULLIDX;
! 		tb->inode = 0;
  		tb->dirty = 0;
  		MReleaseWriteLock(&tb->lock);
  	    }
--- 456,462 ----
  	    if (tb->fid == adc->index) {
  		MObtainWriteLock(&tb->lock, 262);
  		tb->fid = NULLIDX;
! 		afs_reset_inode(&tb->inode);
  		tb->dirty = 0;
  		MReleaseWriteLock(&tb->lock);
  	    }
***************
*** 480,490 ****
  DFlushBuffer(struct buffer *ab) {
      struct osi_file *tfile;
      
! #if defined(LINUX_USE_FH)
!     tfile = afs_CFileOpen(&ab->fh, ab->fh_type);
! #else
!     tfile = afs_CFileOpen(ab->inode);
! #endif
      afs_CFileWrite(tfile, ab->page * AFS_BUFFER_PAGESIZE,
  		   ab->data, AFS_BUFFER_PAGESIZE);
      ab->dirty = 0;	/* Clear the dirty flag */
--- 467,473 ----
  DFlushBuffer(struct buffer *ab) {
      struct osi_file *tfile;
      
!     tfile = afs_CFileOpen(&ab->inode);
      afs_CFileWrite(tfile, ab->page * AFS_BUFFER_PAGESIZE,
  		   ab->data, AFS_BUFFER_PAGESIZE);
      ab->dirty = 0;	/* Clear the dirty flag */
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.86.4.24 openafs/src/afs/afs_call.c:1.86.4.25
*** openafs/src/afs/afs_call.c:1.86.4.24	Thu Mar 19 22:31:44 2009
--- openafs/src/afs/afs_call.c	Sat May 30 13:56:03 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.86.4.24 2009/03/20 02:31:44 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_call.c,v 1.86.4.25 2009/05/30 17:56:03 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 1139,1144 ****
--- 1139,1146 ----
      } else if (parm == AFSOP_SET_RXPCK) {
  	rx_extraPackets = parm2;
  	afscall_set_rxpck_received = 1;
+     } else if (parm == AFSOP_SET_RXMAXMTU) {
+     rx_MyMaxSendSize = rx_maxReceiveSizeUser = rx_maxReceiveSize = parm2;
      } else
  	code = EINVAL;
  
Index: openafs/src/afs/afs_cell.c
diff -c openafs/src/afs/afs_cell.c:1.34.4.10 openafs/src/afs/afs_cell.c:1.34.4.11
*** openafs/src/afs/afs_cell.c:1.34.4.10	Sat Nov 29 13:20:24 2008
--- openafs/src/afs/afs_cell.c	Mon May 11 09:28:04 2009
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cell.c,v 1.34.4.10 2008/11/29 18:20:24 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cell.c,v 1.34.4.11 2009/05/11 13:28:04 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 215,228 ****
   */
  
  struct cell_name *afs_cellname_head;	/* Export for kdump */
! #if defined(LINUX_USE_FH)
! struct fid afs_cellname_fh;
! int afs_cellname_fh_type;
! static int afs_cellname_fh_set;
! #else
! static ino_t afs_cellname_inode;
  static int afs_cellname_inode_set;
- #endif
  static int afs_cellname_dirty;
  static afs_int32 afs_cellnum_next;
  
--- 215,222 ----
   */
  
  struct cell_name *afs_cellname_head;	/* Export for kdump */
! static afs_dcache_id_t afs_cellname_inode;
  static int afs_cellname_inode_set;
  static int afs_cellname_dirty;
  static afs_int32 afs_cellnum_next;
  
***************
*** 307,317 ****
   * \return 0 for success. < 0 for error.
   */
  int
! #if defined(LINUX_USE_FH)
! afs_cellname_init(struct fid *fh, int fh_type, int lookupcode)
! #else
! afs_cellname_init(ino_t inode, int lookupcode)
! #endif
  {
      struct osi_file *tfile;
      int cc, off = 0;
--- 301,307 ----
   * \return 0 for success. < 0 for error.
   */
  int
! afs_cellname_init(afs_dcache_id_t *inode, int lookupcode)
  {
      struct osi_file *tfile;
      int cc, off = 0;
***************
*** 330,353 ****
  	return lookupcode;
      }
  
- #if defined(LINUX_USE_FH)
-     tfile = osi_UFSOpen_fh(fh, fh_type);
- #else
      tfile = osi_UFSOpen(inode);
- #endif
      if (!tfile) {
  	ReleaseWriteLock(&afs_xcell);
  	return EIO;
      }
  
! #if defined(LINUX_USE_FH)
!     memcpy(&afs_cellname_fh, fh, sizeof(struct fid));
!     afs_cellname_fh_type = fh_type;
!     afs_cellname_fh_set = 1;
! #else
!     afs_cellname_inode = inode;
      afs_cellname_inode_set = 1;
- #endif
  
      while (1) {
  	afs_int32 cellnum, clen, magic;
--- 320,333 ----
  	return lookupcode;
      }
  
      tfile = osi_UFSOpen(inode);
      if (!tfile) {
  	ReleaseWriteLock(&afs_xcell);
  	return EIO;
      }
  
!     afs_copy_inode(&afs_cellname_inode, inode);
      afs_cellname_inode_set = 1;
  
      while (1) {
  	afs_int32 cellnum, clen, magic;
***************
*** 408,418 ****
      struct cell_name *cn;
      int off;
  
- #if defined(LINUX_USE_FH)
-     if (!afs_cellname_dirty || !afs_cellname_fh_set)
- #else
      if (!afs_cellname_dirty || !afs_cellname_inode_set)
- #endif
  	return 0;
      if (afs_initState != 300)
  	return 0;
--- 388,394 ----
***************
*** 420,430 ****
      ObtainWriteLock(&afs_xcell, 693);
      afs_cellname_dirty = 0;
      off = 0;
! #if defined(LINUX_USE_FH)
!     tfile = osi_UFSOpen_fh(&afs_cellname_fh, afs_cellname_fh_type);
! #else
!     tfile = osi_UFSOpen(afs_cellname_inode);
! #endif
      if (!tfile) {
  	ReleaseWriteLock(&afs_xcell);
  	return EIO;
--- 396,402 ----
      ObtainWriteLock(&afs_xcell, 693);
      afs_cellname_dirty = 0;
      off = 0;
!     tfile = osi_UFSOpen(&afs_cellname_inode);
      if (!tfile) {
  	ReleaseWriteLock(&afs_xcell);
  	return EIO;
Index: openafs/src/afs/afs_chunkops.h
diff -c openafs/src/afs/afs_chunkops.h:1.7.4.1 openafs/src/afs/afs_chunkops.h:1.7.4.3
*** openafs/src/afs/afs_chunkops.h:1.7.4.1	Sat Nov  8 11:34:42 2008
--- openafs/src/afs/afs_chunkops.h	Thu May 14 00:05:42 2009
***************
*** 52,66 ****
   */
  
  struct afs_cacheOps {
! #if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_SGI62_ENV)
!     void *(*open) (ino_t ainode);
! #else
! #if defined(LINUX_USE_FH)
!     void *(*open) (struct fid *fh, int fh_type);
! #else
!     void *(*open) (afs_int32 ainode);
! #endif
! #endif
      int (*truncate) (struct osi_file * fp, afs_int32 len);
      int (*fread) (struct osi_file * fp, int offset, void *buf, afs_int32 len);
      int (*fwrite) (struct osi_file * fp, afs_int32 offset, void *buf,
--- 52,58 ----
   */
  
  struct afs_cacheOps {
!     void *(*open) (afs_dcache_id_t *ainode);
      int (*truncate) (struct osi_file * fp, afs_int32 len);
      int (*fread) (struct osi_file * fp, int offset, void *buf, afs_int32 len);
      int (*fwrite) (struct osi_file * fp, afs_int32 offset, void *buf,
***************
*** 88,98 ****
  };
  
  /* Ideally we should have used consistent naming - like COP_OPEN, COP_TRUNCATE, etc. */
- #if defined(LINUX_USE_FH)
- #define	afs_CFileOpen(fh, fh_type)	      (void *)(*(afs_cacheType->open))(fh, fh_type)
- #else
  #define	afs_CFileOpen(inode)	      (void *)(*(afs_cacheType->open))(inode)
- #endif
  #define	afs_CFileTruncate(handle, size)	(*(afs_cacheType->truncate))((handle), size)
  #define	afs_CFileRead(file, offset, data, size) (*(afs_cacheType->fread))(file, offset, data, size)
  #define	afs_CFileWrite(file, offset, data, size) (*(afs_cacheType->fwrite))(file, offset, data, size)
--- 80,86 ----
***************
*** 106,109 ****
--- 94,114 ----
  #define	afs_CacheStoreProc(call, file, bytes, avc, wake, toxfer, xfered) \
            (*(afs_cacheType->StoreProc))(call, file, bytes, avc, wake, toxfer, xfered)
  
+ /* These memcpys should get optimised to simple assignments when afs_dcache_id_t 
+  * is simple */
+ static_inline void afs_copy_inode(afs_dcache_id_t *dst, afs_dcache_id_t *src) {
+     memcpy(dst, src, sizeof(afs_dcache_id_t));
+ }
+ 
+ static_inline void afs_reset_inode(afs_dcache_id_t *i) {
+     memset(i, 0, sizeof(afs_dcache_id_t));
+ }
+ 
+ /* We need to have something we can output as the 'inode' for fstrace calls. 
+  * This is a hack */
+ static_inline int afs_inode2trace(afs_dcache_id_t *i) {
+     return i->mem;
+ }
+ 
+ 
  #endif /* AFS_CHUNKOPS */
Index: openafs/src/afs/afs_dcache.c
diff -c openafs/src/afs/afs_dcache.c:1.64.4.26 openafs/src/afs/afs_dcache.c:1.64.4.27
*** openafs/src/afs/afs_dcache.c:1.64.4.26	Mon Mar 23 15:11:25 2009
--- openafs/src/afs/afs_dcache.c	Mon May 11 09:28:04 2009
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.64.4.26 2009/03/23 19:11:25 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.64.4.27 2009/05/11 13:28:04 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 54,65 ****
  afs_int32 afs_discardDCCount;	/*!< Count of elts in discardDCList */
  struct dcache *afs_freeDSList;	/*!< Free list for disk slots */
  struct dcache *afs_Initial_freeDSList;	/*!< Initial list for above */
! #if defined(LINUX_USE_FH)
! struct fid cacheitems_fh;
! int cacheitems_fh_type;
! #else
! ino_t cacheInode;               /*!< Inode for CacheItems file */
! #endif
  struct osi_file *afs_cacheInodep = 0;	/*!< file for CacheItems inode */
  struct afs_q afs_DLRU;		/*!< dcache LRU */
  afs_int32 afs_dhashsize = 1024;
--- 54,60 ----
  afs_int32 afs_discardDCCount;	/*!< Count of elts in discardDCList */
  struct dcache *afs_freeDSList;	/*!< Free list for disk slots */
  struct dcache *afs_Initial_freeDSList;	/*!< Initial list for above */
! afs_dcache_id_t cacheInode;               /*!< Inode for CacheItems file */
  struct osi_file *afs_cacheInodep = 0;	/*!< file for CacheItems inode */
  struct afs_q afs_DLRU;		/*!< dcache LRU */
  afs_int32 afs_dhashsize = 1024;
***************
*** 117,127 ****
  				 afs_size_t *);
  
  struct afs_cacheOps afs_UfsCacheOps = {
- #if defined(LINUX_USE_FH)
-     osi_UFSOpen_fh,
- #else
      osi_UFSOpen,
- #endif
      osi_UFSTruncate,
      afs_osi_Read,
      afs_osi_Write,
--- 112,118 ----
***************
*** 1108,1118 ****
      /*
       * Truncate the element to reclaim its space
       */
! #if defined(LINUX_USE_FH)
!     tfile = afs_CFileOpen(&tdc->f.fh, tdc->f.fh_type);
! #else
!     tfile = afs_CFileOpen(tdc->f.inode);
! #endif
      afs_CFileTruncate(tfile, 0);
      afs_CFileClose(tfile);
      afs_AdjustSize(tdc, 0);
--- 1099,1105 ----
      /*
       * Truncate the element to reclaim its space
       */
!     tfile = afs_CFileOpen(&tdc->f.inode);
      afs_CFileTruncate(tfile, 0);
      afs_CFileClose(tfile);
      afs_AdjustSize(tdc, 0);
***************
*** 1746,1756 ****
  	afs_stats_cmperf.cacheBlocksDiscarded = afs_blocksDiscarded;
  	if (lock & 2) {
  	    /* Truncate the chunk so zeroes get filled properly */
! #if defined(LINUX_USE_FH)
! 	    file = afs_CFileOpen(&tdc->f.fh, tdc->f.fh_type);
! #else
! 	    file = afs_CFileOpen(tdc->f.inode);
! #endif
  	    afs_CFileTruncate(file, 0);
  	    afs_CFileClose(file);
  	    afs_AdjustSize(tdc, 0);
--- 1733,1739 ----
  	afs_stats_cmperf.cacheBlocksDiscarded = afs_blocksDiscarded;
  	if (lock & 2) {
  	    /* Truncate the chunk so zeroes get filled properly */
! 	    file = afs_CFileOpen(&tdc->f.inode);
  	    afs_CFileTruncate(file, 0);
  	    afs_CFileClose(file);
  	    afs_AdjustSize(tdc, 0);
***************
*** 2167,2178 ****
  	if (doReallyAdjustSize || overWriteWholeChunk) {
  	    /* no data in file to read at this position */
  	    UpgradeSToWLock(&tdc->lock, 607);
! 
! #if defined(LINUX_USE_FH)
! 	    file = afs_CFileOpen(&tdc->f.fh, tdc->f.fh_type);
! #else
! 	    file = afs_CFileOpen(tdc->f.inode);
! #endif
  	    afs_CFileTruncate(file, 0);
  	    afs_CFileClose(file);
  	    afs_AdjustSize(tdc, 0);
--- 2150,2156 ----
  	if (doReallyAdjustSize || overWriteWholeChunk) {
  	    /* no data in file to read at this position */
  	    UpgradeSToWLock(&tdc->lock, 607);
! 	    file = afs_CFileOpen(&tdc->f.inode);
  	    afs_CFileTruncate(file, 0);
  	    afs_CFileClose(file);
  	    afs_AdjustSize(tdc, 0);
***************
*** 2359,2369 ****
  	 * fetch the whole file.
  	 */
  	DZap(tdc);	/* pages in cache may be old */
! #if defined(LINUX_USE_FH)
! 	file = afs_CFileOpen(&tdc->f.fh, tdc->f.fh_type);
! #else
! 	file = afs_CFileOpen(tdc->f.inode);
! #endif
  	afs_RemoveVCB(&avc->f.fid);
  	tdc->f.states |= DWriting;
  	tdc->dflags |= DFFetching;
--- 2337,2343 ----
  	 * fetch the whole file.
  	 */
  	DZap(tdc);	/* pages in cache may be old */
! 	file = afs_CFileOpen(&tdc->f.inode);
  	afs_RemoveVCB(&avc->f.fid);
  	tdc->f.states |= DWriting;
  	tdc->dflags |= DFFetching;
***************
*** 3083,3089 ****
      tdc->f.fid.Fid.Volume = 0;
      tdc->f.chunk = -1;
      hones(tdc->f.versionNo);
!     tdc->f.inode = aslot;
      tdc->dflags |= DFEntryMod;
      tdc->refCount = 1;
      tdc->index = aslot;
--- 3057,3063 ----
      tdc->f.fid.Fid.Volume = 0;
      tdc->f.chunk = -1;
      hones(tdc->f.versionNo);
!     tdc->f.inode.mem = aslot;
      tdc->dflags |= DFEntryMod;
      tdc->refCount = 1;
      tdc->index = aslot;
***************
*** 3342,3360 ****
  afs_InitCacheFile(char *afile, ino_t ainode)
  {
      register afs_int32 code;
- #if defined(AFS_LINUX22_ENV)
-     struct dentry *filevp;
- #else
-     struct vnode *filevp;
- #endif
      afs_int32 index;
      int fileIsBad;
      struct osi_file *tfile;
      struct osi_stat tstat;
      register struct dcache *tdc;
- #if defined(LINUX_USE_FH)
-     int max_len = sizeof(struct fid);
- #endif
  
      AFS_STATCNT(afs_InitCacheFile);
      index = afs_stats_cmperf.cacheNumEntries;
--- 3316,3326 ----
***************
*** 3369,3408 ****
      ObtainWriteLock(&tdc->lock, 621);
      MObtainWriteLock(&afs_xdcache, 622);
      if (afile) {
! 	code = gop_lookupname(afile, AFS_UIOSYS, 0, &filevp);
  	if (code) {
  	    ReleaseWriteLock(&afs_xdcache);
  	    ReleaseWriteLock(&tdc->lock);
  	    afs_PutDCache(tdc);
  	    return code;
  	}
! 	/*
! 	 * We have a VN_HOLD on filevp.  Get the useful info out and
! 	 * return.  We make use of the fact that the cache is in the
! 	 * UFS file system, and just record the inode number.
! 	 */
! #ifdef AFS_LINUX22_ENV
! #if defined(LINUX_USE_FH)
!         tdc->f.fh_type = osi_get_fh(filevp, &tdc->f.fh, &max_len);
  #else
!         tdc->f.inode = VTOI(filevp->d_inode)->i_number;
! 	dput(filevp);
  #endif
- #else
- 	tdc->f.inode = afs_vnodeToInumber(filevp);
- 	AFS_RELE(filevp);
- #endif /* AFS_LINUX22_ENV */
-     } else {
- 	tdc->f.inode = ainode;
      }
      fileIsBad = 0;
      if ((tdc->f.states & DWriting) || tdc->f.fid.Fid.Volume == 0)
  	fileIsBad = 1;
! #if defined(LINUX_USE_FH)
!     tfile = osi_UFSOpen_fh(&tdc->f.fh, tdc->f.fh_type);
! #else
!     tfile = osi_UFSOpen(tdc->f.inode);
! #endif
      code = afs_osi_Stat(tfile, &tstat);
      if (code)
  	osi_Panic("initcachefile stat");
--- 3335,3360 ----
      ObtainWriteLock(&tdc->lock, 621);
      MObtainWriteLock(&afs_xdcache, 622);
      if (afile) {
! 	code = afs_LookupInodeByPath(afile, &tdc->f.inode.ufs, NULL);
  	if (code) {
  	    ReleaseWriteLock(&afs_xdcache);
  	    ReleaseWriteLock(&tdc->lock);
  	    afs_PutDCache(tdc);
  	    return code;
  	}
!     } else {
! 	/* Add any other 'complex' inode types here ... */
! #if defined(UKERNEL) || !defined(LINUX_USE_FH)
! 	tdc->f.inode.ufs = ainode;
  #else
! 	osi_Panic("Can't init cache with inode numbers when complex inodes are "
! 	          "in use\n");
  #endif
      }
      fileIsBad = 0;
      if ((tdc->f.states & DWriting) || tdc->f.fid.Fid.Volume == 0)
  	fileIsBad = 1;
!     tfile = osi_UFSOpen(&tdc->f.inode);
      code = afs_osi_Stat(tfile, &tstat);
      if (code)
  	osi_Panic("initcachefile stat");
***************
*** 3832,3839 ****
      }
  
      /* Open the files. */
!     tfile_src = afs_CFileOpen(adc->f.inode);
!     tfile_dst = afs_CFileOpen(new_dc->f.inode);
  
      /* And now copy dir dcache data into this dcache,
       * 4k at a time.
--- 3784,3791 ----
      }
  
      /* Open the files. */
!     tfile_src = afs_CFileOpen(&adc->f.inode);
!     tfile_dst = afs_CFileOpen(&new_dc->f.inode);
  
      /* And now copy dir dcache data into this dcache,
       * 4k at a time.
Index: openafs/src/afs/afs_disconnected.c
diff -c openafs/src/afs/afs_disconnected.c:1.2.2.17 openafs/src/afs/afs_disconnected.c:1.2.2.18
*** openafs/src/afs/afs_disconnected.c:1.2.2.17	Mon Mar 23 15:00:02 2009
--- openafs/src/afs/afs_disconnected.c	Thu May 14 00:05:42 2009
***************
*** 7,13 ****
  #include <afsconfig.h>
  #include "afs/param.h"
   
! RCSID("$Header: /cvs/openafs/src/afs/afs_disconnected.c,v 1.2.2.17 2009/03/23 19:00:02 shadow Exp $");
   
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 7,13 ----
  #include <afsconfig.h>
  #include "afs/param.h"
   
! RCSID("$Header: /cvs/openafs/src/afs/afs_disconnected.c,v 1.2.2.18 2009/05/14 04:05:42 shadow Exp $");
   
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 699,705 ****
  	    return ENOMEM;
  	}
  	ObtainReadLock(&tdc->lock);
! 	tfile = afs_CFileOpen(tdc->f.inode);
  	code = afs_CFileRead(tfile, 0, ttargetName, tlen);
  	ttargetName[tlen-1] = '\0';
  	afs_CFileClose(tfile);
--- 699,705 ----
  	    return ENOMEM;
  	}
  	ObtainReadLock(&tdc->lock);
! 	tfile = afs_CFileOpen(&tdc->f.inode);
  	code = afs_CFileRead(tfile, 0, ttargetName, tlen);
  	ttargetName[tlen-1] = '\0';
  	afs_CFileClose(tfile);
Index: openafs/src/afs/afs_init.c
diff -c openafs/src/afs/afs_init.c:1.37.4.13 openafs/src/afs/afs_init.c:1.37.4.14
*** openafs/src/afs/afs_init.c:1.37.4.13	Thu Mar 19 22:31:44 2009
--- openafs/src/afs/afs_init.c	Mon May 11 09:28:04 2009
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_init.c,v 1.37.4.13 2009/03/20 02:31:44 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_init.c,v 1.37.4.14 2009/05/11 13:28:04 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 225,247 ****
  
  
  /*
!  * LookupInodeByPath
   *
   * Look up inode given a file name.
   * Optionally return the vnode too.
   * If the vnode is not returned, we rele it.
   */
! static int
! LookupInodeByPath(char *filename, ino_t * inode, struct vnode **fvpp)
  {
      afs_int32 code;
  
! #ifdef AFS_LINUX22_ENV
      struct dentry *dp;
      code = gop_lookupname(filename, AFS_UIOSYS, 0, &dp);
      if (code)
  	return code;
!     *inode = dp->d_inode->i_ino;
      dput(dp);
  #else
      struct vnode *filevp;
--- 225,247 ----
  
  
  /*
!  * afs_LookupInodeByPath
   *
   * Look up inode given a file name.
   * Optionally return the vnode too.
   * If the vnode is not returned, we rele it.
   */
! int
! afs_LookupInodeByPath(char *filename, afs_ufs_dcache_id_t *inode, struct vnode **fvpp)
  {
      afs_int32 code;
  
! #if defined(AFS_LINUX22_ENV)
      struct dentry *dp;
      code = gop_lookupname(filename, AFS_UIOSYS, 0, &dp);
      if (code)
  	return code;
!     osi_get_fh(dp, inode);
      dput(dp);
  #else
      struct vnode *filevp;
***************
*** 254,260 ****
      else {
  	AFS_RELE(filevp);
      }
! #endif /* AFS_LINUX22_ENV */
  
      return 0;
  }
--- 254,260 ----
      else {
  	AFS_RELE(filevp);
      }
! #endif
  
      return 0;
  }
***************
*** 262,286 ****
  int
  afs_InitCellInfo(char *afile)
  {
!     ino_t inode = 0;
!     int code;
! #if defined(LINUX_USE_FH)
!     struct fid fh;
!     int fh_type;
!     int max_len = sizeof(struct fid);
!     struct dentry *dp;
! #endif
! 
  #ifdef AFS_CACHE_VNODE_PATH
!     return afs_cellname_init(AFS_CACHE_CELLS_INODE, code);
! #elif defined(LINUX_USE_FH)
!     code = gop_lookupname(afile, AFS_UIOSYS, 0, &dp);
!     fh_type = osi_get_fh(dp, &fh, &max_len);
!     return afs_cellname_init(&fh, fh_type, code);
  #else
!     code = LookupInodeByPath(afile, &inode, NULL);
!     return afs_cellname_init(inode, code);
  #endif
  }
  
  /*
--- 262,276 ----
  int
  afs_InitCellInfo(char *afile)
  {
!     afs_dcache_id_t inode;
!     int code = 0;
!     
  #ifdef AFS_CACHE_VNODE_PATH
!     inode.ufs = AFS_CACHE_CELLS_INODE;
  #else
!     code = afs_LookupInodeByPath(afile, &inode.ufs, NULL);
  #endif
+     return afs_cellname_init(&inode, code);
  }
  
  /*
***************
*** 302,313 ****
  int
  afs_InitVolumeInfo(char *afile)
  {
!     int code;
      struct osi_file *tfile;
- #if defined(LINUX_USE_FH)
-     int max_len = sizeof(struct fid);
-     struct dentry *dp;
- #endif
  
      AFS_STATCNT(afs_InitVolumeInfo);
  #if defined(AFS_XBSD_ENV)
--- 292,299 ----
  int
  afs_InitVolumeInfo(char *afile)
  {
!     int code = 0;
      struct osi_file *tfile;
  
      AFS_STATCNT(afs_InitVolumeInfo);
  #if defined(AFS_XBSD_ENV)
***************
*** 324,345 ****
       * are things which try to get the volumeInode, and since we keep
       * it in the cache...
       */
!     code = LookupInodeByPath(afile, &volumeInode, &volumeVnode);
  #elif defined(AFS_CACHE_VNODE_PATH)
!     volumeInode = AFS_CACHE_VOLUME_INODE;
! #elif defined(LINUX_USE_FH)
!     code = gop_lookupname(afile, AFS_UIOSYS, 0, &dp);
!     volumeinfo_fh_type = osi_get_fh(dp, &volumeinfo_fh, &max_len);
  #else
!     code = LookupInodeByPath(afile, &volumeInode, NULL);
  #endif
      if (code)
  	return code;
! #if defined(LINUX_USE_FH)
!     tfile = osi_UFSOpen_fh(&volumeinfo_fh, volumeinfo_fh_type);
! #else
!     tfile = afs_CFileOpen(volumeInode);
! #endif
      afs_CFileTruncate(tfile, 0);
      afs_CFileClose(tfile);
      return 0;
--- 310,324 ----
       * are things which try to get the volumeInode, and since we keep
       * it in the cache...
       */
!     code = afs_LookupInodeByPath(afile, &volumeInode.ufs, &volumeVnode);
  #elif defined(AFS_CACHE_VNODE_PATH)
!     volumeInode.ufs = AFS_CACHE_VOLUME_INODE;
  #else
!     code = afs_LookupInodeByPath(afile, &volumeInode.ufs, NULL);
  #endif
      if (code)
  	return code;
!     tfile = afs_CFileOpen(&volumeInode);
      afs_CFileTruncate(tfile, 0);
      afs_CFileClose(tfile);
      return 0;
***************
*** 450,459 ****
  #endif
      }
  #if defined(AFS_LINUX20_ENV)
!     cacheInode = filevp->i_ino;
      afs_cacheSBp = filevp->i_sb;
  #elif defined(AFS_XBSD_ENV)
!     cacheInode = VTOI(filevp)->i_number;
      cacheDev.mp = filevp->v_mount;
      cacheDev.held_vnode = filevp;
      vref(filevp);		/* Make sure mount point stays busy. XXX */
--- 429,438 ----
  #endif
      }
  #if defined(AFS_LINUX20_ENV)
!     cacheInode.ufs = filevp->i_ino;
      afs_cacheSBp = filevp->i_sb;
  #elif defined(AFS_XBSD_ENV)
!     cacheInode.ufs = VTOI(filevp)->i_number;
      cacheDev.mp = filevp->v_mount;
      cacheDev.held_vnode = filevp;
      vref(filevp);		/* Make sure mount point stays busy. XXX */
***************
*** 468,486 ****
  #ifndef AFS_DARWIN80_ENV
      afs_cacheVfsp = filevp->v_vfsp;
  #endif
!     cacheInode = afs_vnodeToInumber(filevp);
  #else
!     cacheInode = AFS_CACHE_ITEMS_INODE;
  #endif
      cacheDev.dev = afs_vnodeToDev(filevp);
  #endif /* AFS_LINUX20_ENV */
      AFS_RELE(filevp);
  #endif /* AFS_LINUX22_ENV */
! #if defined(LINUX_USE_FH)
!     tfile = osi_UFSOpen_fh(&cacheitems_fh, cacheitems_fh_type);
! #else
!     tfile = osi_UFSOpen(cacheInode);
! #endif
      afs_osi_Stat(tfile, &tstat);
      cacheInfoModTime = tstat.mtime;
      code = afs_osi_Read(tfile, -1, &theader, sizeof(theader));
--- 447,461 ----
  #ifndef AFS_DARWIN80_ENV
      afs_cacheVfsp = filevp->v_vfsp;
  #endif
!     cacheInode.ufs = afs_vnodeToInumber(filevp);
  #else
!     cacheInode.ufs = AFS_CACHE_ITEMS_INODE;
  #endif
      cacheDev.dev = afs_vnodeToDev(filevp);
  #endif /* AFS_LINUX20_ENV */
      AFS_RELE(filevp);
  #endif /* AFS_LINUX22_ENV */
!     tfile = osi_UFSOpen(&cacheInode);
      afs_osi_Stat(tfile, &tstat);
      cacheInfoModTime = tstat.mtime;
      code = afs_osi_Read(tfile, -1, &theader, sizeof(theader));
***************
*** 705,713 ****
  	    cacheDev.held_vnode = NULL;
  	}
  #endif
! #if !defined(LINUX_USE_FH)
! 	cacheInode = volumeInode = (ino_t) 0;
! #endif
  	cacheInfoModTime = 0;
  
  	afs_fsfragsize = 1023;
--- 680,687 ----
  	    cacheDev.held_vnode = NULL;
  	}
  #endif
! 	afs_reset_inode(&cacheInode);
! 	afs_reset_inode(&volumeInode);
  	cacheInfoModTime = 0;
  
  	afs_fsfragsize = 1023;
Index: openafs/src/afs/afs_memcache.c
diff -c openafs/src/afs/afs_memcache.c:1.22.4.2 openafs/src/afs/afs_memcache.c:1.22.4.3
*** openafs/src/afs/afs_memcache.c:1.22.4.2	Mon Jan 26 13:52:38 2009
--- openafs/src/afs/afs_memcache.c	Mon May 11 09:28:04 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_memcache.c,v 1.22.4.2 2009/01/26 18:52:38 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifndef AFS_LINUX22_ENV
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_memcache.c,v 1.22.4.3 2009/05/11 13:28:04 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifndef AFS_LINUX22_ENV
***************
*** 89,109 ****
      return 0;
  }
  
- #if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_SGI62_ENV)
  void *
! afs_MemCacheOpen(ino_t blkno)
! #else
! void *
! afs_MemCacheOpen(afs_int32 blkno)
! #endif
  {
      struct memCacheEntry *mep;
  
!     if (blkno < 0 || blkno > memMaxBlkNumber) {
  	osi_Panic("afs_MemCacheOpen: invalid block #");
      }
!     mep = (memCache + blkno);
!     afs_Trace3(afs_iclSetp, CM_TRACE_MEMOPEN, ICL_TYPE_INT32, blkno,
  	       ICL_TYPE_POINTER, mep, ICL_TYPE_POINTER, mep ? mep->data : 0);
      return (void *)mep;
  }
--- 89,104 ----
      return 0;
  }
  
  void *
! afs_MemCacheOpen(afs_dcache_id_t *ainode)
  {
      struct memCacheEntry *mep;
  
!     if (ainode->mem < 0 || ainode->mem > memMaxBlkNumber) {
  	osi_Panic("afs_MemCacheOpen: invalid block #");
      }
!     mep = (memCache + ainode->mem);
!     afs_Trace3(afs_iclSetp, CM_TRACE_MEMOPEN, ICL_TYPE_INT32, ainode->mem,
  	       ICL_TYPE_POINTER, mep, ICL_TYPE_POINTER, mep ? mep->data : 0);
      return (void *)mep;
  }
***************
*** 176,185 ****
  }
  
  int
! afs_MemReadUIO(ino_t blkno, struct uio *uioP)
  {
      register struct memCacheEntry *mceP =
! 	(struct memCacheEntry *)afs_MemCacheOpen(blkno);
      int length = mceP->size - AFS_UIO_OFFSET(uioP);
      afs_int32 code;
  
--- 171,180 ----
  }
  
  int
! afs_MemReadUIO(afs_dcache_id_t *ainode, struct uio *uioP)
  {
      register struct memCacheEntry *mceP =
! 	(struct memCacheEntry *)afs_MemCacheOpen(ainode);
      int length = mceP->size - AFS_UIO_OFFSET(uioP);
      afs_int32 code;
  
***************
*** 280,289 ****
  }
  
  int
! afs_MemWriteUIO(ino_t blkno, struct uio *uioP)
  {
      register struct memCacheEntry *mceP =
! 	(struct memCacheEntry *)afs_MemCacheOpen(blkno);
      afs_int32 code;
  
      AFS_STATCNT(afs_MemWriteUIO);
--- 275,284 ----
  }
  
  int
! afs_MemWriteUIO(afs_dcache_id_t *ainode, struct uio *uioP)
  {
      register struct memCacheEntry *mceP =
! 	(struct memCacheEntry *)afs_MemCacheOpen(ainode);
      afs_int32 code;
  
      AFS_STATCNT(afs_MemWriteUIO);
Index: openafs/src/afs/afs_osi.c
diff -c openafs/src/afs/afs_osi.c:1.58.2.8 openafs/src/afs/afs_osi.c:1.58.2.9
*** openafs/src/afs/afs_osi.c:1.58.2.8	Sat Nov 29 13:20:24 2008
--- openafs/src/afs/afs_osi.c	Tue May 12 09:02:58 2009
***************
*** 1,5 ****
  /*
!  * Copyright 2000, International Business Machines Corporation and others.
   * All Rights Reserved.
   *
   * This software has been released under the terms of the IBM Public
--- 1,5 ----
  /*
!  * Copyrigh 2000, International Business Machines Corporation and others.
   * All Rights Reserved.
   *
   * This software has been released under the terms of the IBM Public
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.58.2.8 2008/11/29 18:20: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_osi.c,v 1.58.2.9 2009/05/12 13:02:58 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
Index: openafs/src/afs/afs_osi_alloc.c
diff -c openafs/src/afs/afs_osi_alloc.c:1.11.6.9 openafs/src/afs/afs_osi_alloc.c:1.11.6.10
*** openafs/src/afs/afs_osi_alloc.c:1.11.6.9	Wed Mar 18 09:41:35 2009
--- openafs/src/afs/afs_osi_alloc.c	Tue May 12 09:02:58 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi_alloc.c,v 1.11.6.9 2009/03/18 13:41:35 shadow Exp $");
  
  
  
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi_alloc.c,v 1.11.6.10 2009/05/12 13:02:58 shadow Exp $");
  
  
  
***************
*** 113,118 ****
--- 113,120 ----
      osi_linux_free(x);
  #elif defined(AFS_FBSD_ENV)
      osi_fbsd_free(x);
+ #elif defined(AFS_OBSD44_ENV)
+     osi_obsd_Free(x, asize);
  #else
      AFS_KFREE((struct osimem *)x, asize);
  #endif
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.110.2.34 openafs/src/afs/afs_pioctl.c:1.110.2.35
*** openafs/src/afs/afs_pioctl.c:1.110.2.34	Wed Mar 18 09:41:35 2009
--- openafs/src/afs/afs_pioctl.c	Mon Apr 27 19:04:29 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.110.2.34 2009/03/18 13:41:35 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.35 2009/04/27 23:04:29 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
***************
*** 113,119 ****
  DECL_PIOCTL(PRxStatProc);
  DECL_PIOCTL(PRxStatPeer);
  DECL_PIOCTL(PPrefetchFromTape);
! DECL_PIOCTL(PResidencyCmd);
  DECL_PIOCTL(PCallBackAddr);
  DECL_PIOCTL(PDiscon);
  DECL_PIOCTL(PNFSNukeCreds);
--- 113,119 ----
  DECL_PIOCTL(PRxStatProc);
  DECL_PIOCTL(PRxStatPeer);
  DECL_PIOCTL(PPrefetchFromTape);
! DECL_PIOCTL(PFsCmd);
  DECL_PIOCTL(PCallBackAddr);
  DECL_PIOCTL(PDiscon);
  DECL_PIOCTL(PNFSNukeCreds);
***************
*** 218,224 ****
  	PBogus,			/* 64 -- arla: force cache check */
  	PBogus,			/* 65 -- arla: break callback */
  	PPrefetchFromTape,	/* 66 -- MR-AFS: prefetch file from tape */
! 	PResidencyCmd,		/* 67 -- MR-AFS: generic commnd interface */
  	PBogus,			/* 68 -- arla: fetch stats */
  	PGetVnodeXStatus2,	/* 69 - get caller access and some vcache status */
  };
--- 218,224 ----
  	PBogus,			/* 64 -- arla: force cache check */
  	PBogus,			/* 65 -- arla: break callback */
  	PPrefetchFromTape,	/* 66 -- MR-AFS: prefetch file from tape */
! 	PFsCmd,			/* 67 -- RXOSD: generic commnd interface */
  	PBogus,			/* 68 -- arla: fetch stats */
  	PGetVnodeXStatus2,	/* 69 - get caller access and some vcache status */
  };
***************
*** 4423,4443 ****
      return code;
  }
  
! DECL_PIOCTL(PResidencyCmd)
  {
      register afs_int32 code;
      struct afs_conn *tc;
      struct vcache *tvc;
!     struct ResidencyCmdInputs *Inputs;
!     struct ResidencyCmdOutputs *Outputs;
      struct VenusFid tfid;
      struct AFSFid *Fid;
  
!     Inputs = (struct ResidencyCmdInputs *)ain;
!     Outputs = (struct ResidencyCmdOutputs *)aout;
      if (!avc)
  	return EINVAL;
!     if (!ain || ainSize != sizeof(struct ResidencyCmdInputs))
  	return EINVAL;
  
      Fid = &Inputs->fid;
--- 4423,4443 ----
      return code;
  }
  
! DECL_PIOCTL(PFsCmd)
  {
      register afs_int32 code;
      struct afs_conn *tc;
      struct vcache *tvc;
!     struct FsCmdInputs *Inputs;
!     struct FsCmdOutputs *Outputs;
      struct VenusFid tfid;
      struct AFSFid *Fid;
  
!     Inputs = (struct FsCmdInputs *)ain;
!     Outputs = (struct FsCmdOutputs *)aout;
      if (!avc)
  	return EINVAL;
!     if (!ain || ainSize != sizeof(struct FsCmdInputs))
  	return EINVAL;
  
      Fid = &Inputs->fid;
***************
*** 4461,4468 ****
  	    if (tc) {
  		RX_AFS_GUNLOCK();
  		code =
! 		    RXAFS_ResidencyCmd(tc->id, Fid, Inputs,
! 				       (struct ResidencyCmdOutputs *)aout);
  		RX_AFS_GLOCK();
  	    } else
  		code = -1;
--- 4461,4468 ----
  	    if (tc) {
  		RX_AFS_GUNLOCK();
  		code =
! 		    RXAFS_FsCmd(tc->id, Fid, Inputs, 
! 					(struct FsCmdOutputs *)aout);
  		RX_AFS_GLOCK();
  	    } else
  		code = -1;
***************
*** 4486,4492 ****
      afs_PutVCache(tvc);
  
      if (!code) {
! 	*aoutSize = sizeof(struct ResidencyCmdOutputs);
      }
      return code;
  }
--- 4486,4492 ----
      afs_PutVCache(tvc);
  
      if (!code) {
! 	*aoutSize = sizeof(struct FsCmdOutputs);
      }
      return code;
  }
Index: openafs/src/afs/afs_prototypes.h
diff -c openafs/src/afs/afs_prototypes.h:1.74.2.38 openafs/src/afs/afs_prototypes.h:1.74.2.40
*** openafs/src/afs/afs_prototypes.h:1.74.2.38	Fri Mar 20 11:04:18 2009
--- openafs/src/afs/afs_prototypes.h	Mon May 11 09:28:04 2009
***************
*** 130,140 ****
  
  extern void afs_CellInit(void);
  extern void shutdown_cell(void);
! #if defined(LINUX_USE_FH)
! extern int afs_cellname_init(struct fid *fh, int fh_type, int lookupcode);
! #else
! extern int afs_cellname_init(ino_t inode, int lookupcode);
! #endif
  extern int afs_cellname_write(void);
  extern afs_int32 afs_NewCell(char *acellName, afs_int32 * acellHosts,
  			     int aflags, char *linkedcname, u_short fsport,
--- 130,136 ----
  
  extern void afs_CellInit(void);
  extern void shutdown_cell(void);
! extern int afs_cellname_init(afs_dcache_id_t *inode, int lookupcode);
  extern int afs_cellname_write(void);
  extern afs_int32 afs_NewCell(char *acellName, afs_int32 * acellHosts,
  			     int aflags, char *linkedcname, u_short fsport,
***************
*** 236,247 ****
  extern afs_uint32 afs_tpct1, afs_tpct2, splitdcache;
  extern unsigned char *afs_indexFlags;
  extern struct afs_cacheOps *afs_cacheType;
! #if defined(LINUX_USE_FH)
! extern struct fid cacheitems_fh;
! extern int cacheitems_fh_type;
! #else
! extern ino_t cacheInode;
! #endif
  extern struct osi_file *afs_cacheInodep;
  extern void afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk,
  			   int aflags);
--- 232,238 ----
  extern afs_uint32 afs_tpct1, afs_tpct2, splitdcache;
  extern unsigned char *afs_indexFlags;
  extern struct afs_cacheOps *afs_cacheType;
! extern afs_dcache_id_t cacheInode;
  extern struct osi_file *afs_cacheInodep;
  extern void afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk,
  			   int aflags);
***************
*** 427,432 ****
--- 418,425 ----
  extern void shutdown_cache(void);
  extern void shutdown_vnodeops(void);
  extern void shutdown_AFS(void);
+ extern int afs_LookupInodeByPath(char *filename, afs_ufs_dcache_id_t *inode,
+ 				 struct vnode **fvpp);
  
  /* afs_lock.c */
  extern void Lock_Init(register struct afs_lock *lock);
***************
*** 474,494 ****
  /* afs_memcache.c */
  extern int afs_InitMemCache(int blkCount, int blkSize, int flags);
  extern int afs_MemCacheClose(struct osi_file *file);
! #if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_SGI62_ENV)
! extern void *afs_MemCacheOpen(ino_t blkno);
! #else
! extern void *afs_MemCacheOpen(afs_int32 blkno);
! #endif
  extern int afs_MemReadBlk(register struct osi_file *fP, int offset,
  			  void *dest, int size);
  extern int afs_MemReadvBlk(register struct memCacheEntry *mceP, int offset,
  			   struct iovec *iov, int nio, int size);
! extern int afs_MemReadUIO(ino_t blkno, struct uio *uioP);
  extern int afs_MemWriteBlk(register struct osi_file *fP, int offset,
  			   void *src, int size);
  extern int afs_MemWritevBlk(register struct memCacheEntry *mceP, int offset,
  			    struct iovec *iov, int nio, int size);
! extern int afs_MemWriteUIO(ino_t blkno, struct uio *uioP);
  extern int afs_MemCacheTruncate(register struct osi_file *fP,
  				int size);
  extern int afs_MemCacheStoreProc(register struct rx_call *acall,
--- 467,483 ----
  /* afs_memcache.c */
  extern int afs_InitMemCache(int blkCount, int blkSize, int flags);
  extern int afs_MemCacheClose(struct osi_file *file);
! extern void *afs_MemCacheOpen(afs_dcache_id_t *ainode);
  extern int afs_MemReadBlk(register struct osi_file *fP, int offset,
  			  void *dest, int size);
  extern int afs_MemReadvBlk(register struct memCacheEntry *mceP, int offset,
  			   struct iovec *iov, int nio, int size);
! extern int afs_MemReadUIO(afs_dcache_id_t *ainode, struct uio *uioP);
  extern int afs_MemWriteBlk(register struct osi_file *fP, int offset,
  			   void *src, int size);
  extern int afs_MemWritevBlk(register struct memCacheEntry *mceP, int offset,
  			    struct iovec *iov, int nio, int size);
! extern int afs_MemWriteUIO(afs_dcache_id_t *ainode, struct uio *uioP);
  extern int afs_MemCacheTruncate(register struct osi_file *fP,
  				int size);
  extern int afs_MemCacheStoreProc(register struct rx_call *acall,
***************
*** 665,679 ****
  
  /* ARCH/osi_file.c */
  extern int afs_osicred_initialized;
! #if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_SGI62_ENV)
! extern void *osi_UFSOpen(ino_t ainode);
! #else
! #if defined(LINUX_USE_FH)
! extern void *osi_UFSOpen_fh(struct fid *fh, int fh_type);
! extern int osi_get_fh(struct dentry *dp, struct fid *fh, int *max_len);
! #else
! extern void *osi_UFSOpen(afs_int32 ainode);
! #endif
  #endif
  extern int afs_osi_Stat(register struct osi_file *afile,
  			register struct osi_stat *astat);
--- 654,662 ----
  
  /* ARCH/osi_file.c */
  extern int afs_osicred_initialized;
! extern void *osi_UFSOpen(afs_dcache_id_t *ainode);
! #if defined(AFS_LINUX22_ENV)
! extern void osi_get_fh(struct dentry *dp, afs_ufs_dcache_id_t *ainode);
  #endif
  extern int afs_osi_Stat(register struct osi_file *afile,
  			register struct osi_stat *astat);
***************
*** 690,699 ****
  
  
  /* ARCH/osi_groups.c */
! #ifdef AFS_XBSD_ENV
  extern int setpag(struct proc *proc, struct ucred **cred, afs_uint32 pagvalue,
  		  afs_uint32 * newpag, int change_parent);
  #endif
  
  
  /* ARCH/osi_vm.c */
--- 673,684 ----
  
  
  /* ARCH/osi_groups.c */
! #if defined AFS_XBSD_ENV
! #if !defined(AFS_DFBSD_ENV) || !defined(UKERNEL)
  extern int setpag(struct proc *proc, struct ucred **cred, afs_uint32 pagvalue,
  		  afs_uint32 * newpag, int change_parent);
  #endif
+ #endif
  
  
  /* ARCH/osi_vm.c */
***************
*** 1273,1284 ****
  extern afs_int32 afs_volCounter;
  extern afs_rwlock_t afs_xvolume;
  extern struct volume *afs_volumes[NVOLS];
! #if defined(LINUX_USE_FH)
! extern struct fid volumeinfo_fh;
! extern int volumeinfo_fh_type;
! #else
! extern ino_t volumeInode;
! #endif
  extern struct volume *afs_FindVolume(struct VenusFid *afid,
  				     afs_int32 locktype);
  extern struct volume *afs_freeVolList;
--- 1258,1264 ----
  extern afs_int32 afs_volCounter;
  extern afs_rwlock_t afs_xvolume;
  extern struct volume *afs_volumes[NVOLS];
! extern afs_dcache_id_t volumeInode;
  extern struct volume *afs_FindVolume(struct VenusFid *afid,
  				     afs_int32 locktype);
  extern struct volume *afs_freeVolList;
Index: openafs/src/afs/afs_segments.c
diff -c openafs/src/afs/afs_segments.c:1.22.8.8 openafs/src/afs/afs_segments.c:1.22.8.10
*** openafs/src/afs/afs_segments.c:1.22.8.8	Mon Jan 26 13:52:38 2009
--- openafs/src/afs/afs_segments.c	Tue May 12 12:42:37 2009
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_segments.c,v 1.22.8.8 2009/01/26 18:52:38 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_segments.c,v 1.22.8.10 2009/05/12 16:42:37 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 195,201 ****
       * on the memcache case since that's we adjust the file's size
       * and finish flushing partial vm pages.
       */
!     if (cacheDiskType != AFS_FCACHE_TYPE_MEM)
  #endif /* !AFS_AIX32_ENV && !AFS_SGI65_ENV */
      {
  	/* If we're not diskless, reading a file may stress the VM
--- 195,201 ----
       * on the memcache case since that's we adjust the file's size
       * and finish flushing partial vm pages.
       */
!     if ((cacheDiskType != AFS_FCACHE_TYPE_MEM) || (sync & AFS_LASTSTORE))
  #endif /* !AFS_AIX32_ENV && !AFS_SGI65_ENV */
      {
  	/* If we're not diskless, reading a file may stress the VM
***************
*** 417,423 ****
  				       ICL_TYPE_POINTER, avc, ICL_TYPE_INT32,
  				       tdc->f.chunk, ICL_TYPE_INT32,
  				       tdc->index, ICL_TYPE_INT32,
! 				       tdc->f.inode);
  			    shouldwake = 0;
  			    if (nomore) {
  				if (avc->asynchrony == -1) {
--- 417,423 ----
  				       ICL_TYPE_POINTER, avc, ICL_TYPE_INT32,
  				       tdc->f.chunk, ICL_TYPE_INT32,
  				       tdc->index, ICL_TYPE_INT32,
! 				       afs_inode2trace(&tdc->f.inode));
  			    shouldwake = 0;
  			    if (nomore) {
  				if (avc->asynchrony == -1) {
***************
*** 430,440 ****
  				    shouldwake = &nomore;
  				}
  			    }
! #if defined(LINUX_USE_FH)
! 			    tfile = afs_CFileOpen(&tdc->f.fh, tdc->f.fh_type);
! #else
! 			    tfile = afs_CFileOpen(tdc->f.inode);
! #endif
  #ifndef AFS_NOSTATS
  			    xferP =
  				&(afs_stats_cmfullperf.rpc.
--- 430,436 ----
  				    shouldwake = &nomore;
  				}
  			    }
! 			    tfile = afs_CFileOpen(&tdc->f.inode);
  #ifndef AFS_NOSTATS
  			    xferP =
  				&(afs_stats_cmfullperf.rpc.
***************
*** 954,964 ****
  	if (offset + toAdd > AFS_CHUNKTOSIZE(tdc->f.chunk)) {
  	    toAdd = AFS_CHUNKTOSIZE(tdc->f.chunk) - offset;
  	}
! #if defined(LINUX_USE_FH)
!         tfile = afs_CFileOpen(&tdc->f.fh, tdc->f.fh_type);
! #else
!         tfile = afs_CFileOpen(tdc->f.inode);
! #endif
  	while(tdc->validPos < avc->f.m.Length + toAdd) {
  	     afs_size_t towrite;
  
--- 950,956 ----
  	if (offset + toAdd > AFS_CHUNKTOSIZE(tdc->f.chunk)) {
  	    toAdd = AFS_CHUNKTOSIZE(tdc->f.chunk) - offset;
  	}
!         tfile = afs_CFileOpen(&tdc->f.inode);
  	while(tdc->validPos < avc->f.m.Length + toAdd) {
  	     afs_size_t towrite;
  
***************
*** 1109,1119 ****
  	ObtainSharedLock(&tdc->lock, 672);
  	if (newSize < tdc->f.chunkBytes) {
  	    UpgradeSToWLock(&tdc->lock, 673);
! #if defined(LINUX_USE_FH)
! 	    tfile = afs_CFileOpen(&tdc->f.fh, tdc->f.fh_type);
! #else
! 	    tfile = afs_CFileOpen(tdc->f.inode);
! #endif
  	    afs_CFileTruncate(tfile, newSize);
  	    afs_CFileClose(tfile);
  	    afs_AdjustSize(tdc, newSize);
--- 1101,1107 ----
  	ObtainSharedLock(&tdc->lock, 672);
  	if (newSize < tdc->f.chunkBytes) {
  	    UpgradeSToWLock(&tdc->lock, 673);
! 	    tfile = afs_CFileOpen(&tdc->f.inode);
  	    afs_CFileTruncate(tfile, newSize);
  	    afs_CFileClose(tfile);
  	    afs_AdjustSize(tdc, newSize);
Index: openafs/src/afs/afs_volume.c
diff -c openafs/src/afs/afs_volume.c:1.31.2.10 openafs/src/afs/afs_volume.c:1.31.2.11
*** openafs/src/afs/afs_volume.c:1.31.2.10	Mon Jan 26 13:52:38 2009
--- openafs/src/afs/afs_volume.c	Mon May 11 09:28:04 2009
***************
*** 19,25 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_volume.c,v 1.31.2.10 2009/01/26 18:52:38 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 19,25 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_volume.c,v 1.31.2.11 2009/05/11 13:28:04 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 58,69 ****
  #endif /* vlserver error base define */
  
  /* Exported variables */
! #if defined(LINUX_USE_FH)
! struct fid volumeinfo_fh;     /* File handle for VolumeItems file */
! int volumeinfo_fh_type;
! #else
! ino_t volumeInode;            /* Inode for VolumeItems file */
! #endif
  afs_rwlock_t afs_xvolume;	/** allocation lock for volumes */
  struct volume *afs_freeVolList;
  struct volume *afs_volumes[NVOLS];
--- 58,64 ----
  #endif /* vlserver error base define */
  
  /* Exported variables */
! afs_dcache_id_t volumeInode;	/* Inode for VolumeItems file */
  afs_rwlock_t afs_xvolume;	/** allocation lock for volumes */
  struct volume *afs_freeVolList;
  struct volume *afs_volumes[NVOLS];
***************
*** 164,174 ****
  	     * next chain
  	     */
  	    if (afs_FVIndex != tv->vtix) {
! #if defined(LINUX_USE_FH)
! 		tfile = osi_UFSOpen_fh(&volumeinfo_fh, volumeinfo_fh_type);
! #else
! 		tfile = osi_UFSOpen(volumeInode);
! #endif
  		code =
  		    afs_osi_Read(tfile, sizeof(struct fvolume) * tv->vtix,
  				 &staticFVolume, sizeof(struct fvolume));
--- 159,165 ----
  	     * next chain
  	     */
  	    if (afs_FVIndex != tv->vtix) {
! 		tfile = osi_UFSOpen(&volumeInode);
  		code =
  		    afs_osi_Read(tfile, sizeof(struct fvolume) * tv->vtix,
  				 &staticFVolume, sizeof(struct fvolume));
***************
*** 185,195 ****
  	staticFVolume.dotdot = tv->dotdot;
  	staticFVolume.rootVnode = tv->rootVnode;
  	staticFVolume.rootUnique = tv->rootUnique;
! #if defined(LINUX_USE_FH)
! 	tfile = osi_UFSOpen_fh(&volumeinfo_fh, volumeinfo_fh_type);
! #else
! 	tfile = osi_UFSOpen(volumeInode);
! #endif
  	code =
  	    afs_osi_Write(tfile, sizeof(struct fvolume) * afs_FVIndex,
  			  &staticFVolume, sizeof(struct fvolume));
--- 176,182 ----
  	staticFVolume.dotdot = tv->dotdot;
  	staticFVolume.rootVnode = tv->rootVnode;
  	staticFVolume.rootUnique = tv->rootUnique;
! 	tfile = osi_UFSOpen(&volumeInode);
  	code =
  	    afs_osi_Write(tfile, sizeof(struct fvolume) * afs_FVIndex,
  			  &staticFVolume, sizeof(struct fvolume));
***************
*** 558,568 ****
  	for (j = fvTable[FVHash(tv->cell, volid)]; j != 0; j = tf->next) {
  	    if (afs_FVIndex != j) {
  		struct osi_file *tfile;
! #if defined(LINUX_USE_FH)
! 	        tfile = osi_UFSOpen_fh(&volumeinfo_fh, volumeinfo_fh_type);
! #else
! 	        tfile = osi_UFSOpen(volumeInode);
! #endif
  		err =
  		    afs_osi_Read(tfile, sizeof(struct fvolume) * j,
  				 &staticFVolume, sizeof(struct fvolume));
--- 545,551 ----
  	for (j = fvTable[FVHash(tv->cell, volid)]; j != 0; j = tf->next) {
  	    if (afs_FVIndex != j) {
  		struct osi_file *tfile;
! 	        tfile = osi_UFSOpen(&volumeInode);
  		err =
  		    afs_osi_Read(tfile, sizeof(struct fvolume) * j,
  				 &staticFVolume, sizeof(struct fvolume));
Index: openafs/src/afs/AIX/osi_file.c
diff -c openafs/src/afs/AIX/osi_file.c:1.9.14.3 openafs/src/afs/AIX/osi_file.c:1.9.14.4
*** openafs/src/afs/AIX/osi_file.c:1.9.14.3	Thu Dec 13 14:18:31 2007
--- openafs/src/afs/AIX/osi_file.c	Mon May 11 09:29:17 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/AIX/osi_file.c,v 1.9.14.3 2007/12/13 19:18:31 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/AIX/osi_file.c,v 1.9.14.4 2009/05/11 13:29:17 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 26,32 ****
  
  
  void *
! osi_UFSOpen(afs_int32 ainode)
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
--- 26,32 ----
  
  
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
***************
*** 48,54 ****
      setuerror(0);
      AFS_GUNLOCK();
      ip = (struct inode *)igetinode((dev_t) cacheDev.dev, afs_cacheVfsp,
! 				   (ino_t) ainode, &vp, &dummy);
      AFS_GLOCK();
      if (getuerror()) {
  	osi_FreeSmallSpace(afile);
--- 48,54 ----
      setuerror(0);
      AFS_GUNLOCK();
      ip = (struct inode *)igetinode((dev_t) cacheDev.dev, afs_cacheVfsp,
! 				   (ino_t) ainode->ufs, &vp, &dummy);
      AFS_GLOCK();
      if (getuerror()) {
  	osi_FreeSmallSpace(afile);
***************
*** 58,64 ****
      afile->size = VTOI(afile->vnode)->i_size;
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
  
--- 58,64 ----
      afile->size = VTOI(afile->vnode)->i_size;
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
      return (void *)afile;
  }
  
Index: openafs/src/afs/DARWIN/osi_file.c
diff -c openafs/src/afs/DARWIN/osi_file.c:1.12.2.4 openafs/src/afs/DARWIN/osi_file.c:1.12.2.5
*** openafs/src/afs/DARWIN/osi_file.c:1.12.2.4	Thu Dec 13 14:18:32 2007
--- openafs/src/afs/DARWIN/osi_file.c	Mon May 11 09:29:19 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_file.c,v 1.12.2.4 2007/12/13 19:18:32 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/DARWIN/osi_file.c,v 1.12.2.5 2009/05/11 13:29:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 133,139 ****
  }
  
  void *
! osi_UFSOpen(afs_int32 ainode)
  {
      struct vnode *vp;
      struct vattr va;
--- 133,139 ----
  }
  
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      struct vnode *vp;
      struct vattr va;
***************
*** 158,165 ****
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
  #ifdef AFS_CACHE_VNODE_PATH
!     if (ainode < 0) {
! 	switch (ainode) {
  	case AFS_CACHE_CELLS_INODE:
  	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
  	    break;
--- 158,165 ----
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
  #ifdef AFS_CACHE_VNODE_PATH
!     if (ainode->ufs < 0) {
! 	switch (ainode->ufs) {
  	case AFS_CACHE_CELLS_INODE:
  	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
  	    break;
***************
*** 173,191 ****
  	    osi_Panic("Invalid negative inode");
  	}
      } else {
! 	dummy = ainode / afs_numfilesperdir;
! 	snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode);
      }
  
      code = vnode_open(fname, O_RDWR, 0, 0, &vp, afs_osi_ctxtp);
  #else
  #ifndef AFS_DARWIN80_ENV
      if (afs_CacheFSType == AFS_APPL_HFS_CACHE)
! 	code = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, &ainode, &vp, &va, &dummy);	/* XXX hfs is broken */
      else if (afs_CacheFSType == AFS_APPL_UFS_CACHE)
  #endif
  	code =
! 	    igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode,
  		      &vp, &va, &dummy);
  #ifndef AFS_DARWIN80_ENV
      else
--- 173,191 ----
  	    osi_Panic("Invalid negative inode");
  	}
      } else {
! 	dummy = ainode->ufs / afs_numfilesperdir;
! 	snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode->ufs);
      }
  
      code = vnode_open(fname, O_RDWR, 0, 0, &vp, afs_osi_ctxtp);
  #else
  #ifndef AFS_DARWIN80_ENV
      if (afs_CacheFSType == AFS_APPL_HFS_CACHE)
! 	code = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, &ainode->ufs, &vp, &va, &dummy);	/* XXX hfs is broken */
      else if (afs_CacheFSType == AFS_APPL_UFS_CACHE)
  #endif
  	code =
! 	    igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode->ufs,
  		      &vp, &va, &dummy);
  #ifndef AFS_DARWIN80_ENV
      else
***************
*** 200,206 ****
      afile->vnode = vp;
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode;	/* for hint validity checking */
  #ifndef AFS_CACHE_VNODE_PATH
      afile->size = va.va_size;
  #else
--- 200,206 ----
      afile->vnode = vp;
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
  #ifndef AFS_CACHE_VNODE_PATH
      afile->size = va.va_size;
  #else
Index: openafs/src/afs/DFBSD/osi_prototypes.h
diff -c /dev/null openafs/src/afs/DFBSD/osi_prototypes.h:1.1.2.2
*** /dev/null	Sat May 30 21:40:47 2009
--- openafs/src/afs/DFBSD/osi_prototypes.h	Mon Apr 27 14:31:54 2009
***************
*** 0 ****
--- 1,22 ----
+ /*
+  * 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
+  */
+ /*
+  * osi_prototypes.h
+  *
+  * Exported support routines.
+  */
+ #ifndef _OSI_PROTO_H_
+ #define _OSI_PROTO_H_
+ 
+ /* osi_file.c */
+ extern afs_rwlock_t afs_xosi;
+ 
+ 
+ 
+ #endif /* _OSI_PROTO_H_ */
Index: openafs/src/afs/DUX/osi_file.c
diff -c openafs/src/afs/DUX/osi_file.c:1.9.14.1 openafs/src/afs/DUX/osi_file.c:1.9.14.2
*** openafs/src/afs/DUX/osi_file.c:1.9.14.1	Thu Dec 13 14:18:32 2007
--- openafs/src/afs/DUX/osi_file.c	Mon May 11 09:29:19 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DUX/Attic/osi_file.c,v 1.9.14.1 2007/12/13 19:18:32 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/DUX/Attic/osi_file.c,v 1.9.14.2 2009/05/11 13:29:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 26,32 ****
  
  
  void *
! osi_UFSOpen(afs_int32 ainode)
  {
      static struct vnode *tags_vnode = NULL;
      struct inode *ip;
--- 26,32 ----
  
  
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      static struct vnode *tags_vnode = NULL;
      struct inode *ip;
***************
*** 44,50 ****
      switch (afs_cacheVfsp->m_stat.f_type) {
      case MOUNT_UFS:
  	code =
! 	    igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode,
  		      &ip, &dummy);
  	if (code) {
  	    osi_FreeSmallSpace(afile);
--- 44,50 ----
      switch (afs_cacheVfsp->m_stat.f_type) {
      case MOUNT_UFS:
  	code =
! 	    igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode->ufs,
  		      &ip, &dummy);
  	if (code) {
  	    osi_FreeSmallSpace(afile);
***************
*** 55,61 ****
  	afile->size = VTOI(afile->vnode)->i_size;
  	afile->offset = 0;
  	afile->proc = NULL;
! 	afile->inum = ainode;	/* for hint validity checking */
  	break;
      case MOUNT_MSFS:{
  	    char path[1024];
--- 55,61 ----
  	afile->size = VTOI(afile->vnode)->i_size;
  	afile->offset = 0;
  	afile->proc = NULL;
! 	afile->inum = ainode->ufs;	/* for hint validity checking */
  	break;
      case MOUNT_MSFS:{
  	    char path[1024];
***************
*** 80,86 ****
  		    osi_Panic("failed to lookup %s (%d)", path, code);
  		tags_vnode = ndp->ni_vp;
  	    }
! 	    sprintf(path, "%d", ainode);
  	    ndp->ni_dirp = path;
  	    ndp->ni_cdir = tags_vnode;
  	    if ((code = namei(ndp)))
--- 80,86 ----
  		    osi_Panic("failed to lookup %s (%d)", path, code);
  		tags_vnode = ndp->ni_vp;
  	    }
! 	    sprintf(path, "%d", ainode->ufs);
  	    ndp->ni_dirp = path;
  	    ndp->ni_cdir = tags_vnode;
  	    if ((code = namei(ndp)))
***************
*** 96,102 ****
  	    afile->size = attr.va_size;
  	    afile->offset = 0;
  	    afile->proc = NULL;
! 	    afile->inum = ainode;	/* for hint validity checking */
  	    break;
  	}
      default:
--- 96,102 ----
  	    afile->size = attr.va_size;
  	    afile->offset = 0;
  	    afile->proc = NULL;
! 	    afile->inum = ainode->ufs;	/* for hint validity checking */
  	    break;
  	}
      default:
Index: openafs/src/afs/FBSD/osi_file.c
diff -c openafs/src/afs/FBSD/osi_file.c:1.13.14.3 openafs/src/afs/FBSD/osi_file.c:1.13.14.4
*** openafs/src/afs/FBSD/osi_file.c:1.13.14.3	Tue Aug 26 10:01:33 2008
--- openafs/src/afs/FBSD/osi_file.c	Mon May 11 09:29:19 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_file.c,v 1.13.14.3 2008/08/26 14:01:33 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/FBSD/osi_file.c,v 1.13.14.4 2009/05/11 13:29:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 26,32 ****
  
  
  void *
! osi_UFSOpen(afs_int32 ainode)
  {
      struct osi_file *afile;
      struct vnode *vp;
--- 26,32 ----
  
  
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      struct osi_file *afile;
      struct vnode *vp;
***************
*** 39,47 ****
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
  #if defined(AFS_FBSD50_ENV)
!     code = VFS_VGET(afs_cacheVfsp, (ino_t) ainode, LK_EXCLUSIVE, &vp);
  #else
!     code = VFS_VGET(afs_cacheVfsp, (ino_t) ainode, &vp);
  #endif
      AFS_GLOCK();
      if (code == 0 && vp->v_type == VNON)
--- 39,47 ----
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
  #if defined(AFS_FBSD50_ENV)
!     code = VFS_VGET(afs_cacheVfsp, (ino_t) ainode->ufs, LK_EXCLUSIVE, &vp);
  #else
!     code = VFS_VGET(afs_cacheVfsp, (ino_t) ainode->ufs, &vp);
  #endif
      AFS_GLOCK();
      if (code == 0 && vp->v_type == VNON)
***************
*** 61,67 ****
      afile->size = VTOI(vp)->i_size;
      afile->offset = 0;
      afile->proc = NULL;
!     afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
  
--- 61,67 ----
      afile->size = VTOI(vp)->i_size;
      afile->offset = 0;
      afile->proc = NULL;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
      return (void *)afile;
  }
  
Index: openafs/src/afs/HPUX/osi_file.c
diff -c openafs/src/afs/HPUX/osi_file.c:1.8.14.2 openafs/src/afs/HPUX/osi_file.c:1.8.14.3
*** openafs/src/afs/HPUX/osi_file.c:1.8.14.2	Thu Dec 13 14:18:32 2007
--- openafs/src/afs/HPUX/osi_file.c	Mon May 11 09:29:19 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/HPUX/osi_file.c,v 1.8.14.2 2007/12/13 19:18:32 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/HPUX/osi_file.c,v 1.8.14.3 2009/05/11 13:29:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 27,33 ****
  
  
  void *
! osi_UFSOpen(afs_int32 ainode)
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
--- 27,33 ----
  
  
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
***************
*** 48,54 ****
      setuerror(0);
      AFS_GUNLOCK();
      ip = (struct inode *)igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev,
! 				   (ino_t) ainode, &dummy);
      AFS_GLOCK();
      if (getuerror()) {
  	osi_FreeSmallSpace(afile);
--- 48,54 ----
      setuerror(0);
      AFS_GUNLOCK();
      ip = (struct inode *)igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev,
! 				   (ino_t) ainode->ufs, &dummy);
      AFS_GLOCK();
      if (getuerror()) {
  	osi_FreeSmallSpace(afile);
***************
*** 59,65 ****
      afile->size = VTOI(afile->vnode)->i_size;
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
  
--- 59,65 ----
      afile->size = VTOI(afile->vnode)->i_size;
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
      return (void *)afile;
  }
  
Index: openafs/src/afs/IRIX/osi_file.c
diff -c openafs/src/afs/IRIX/osi_file.c:1.11.14.2 openafs/src/afs/IRIX/osi_file.c:1.11.14.3
*** openafs/src/afs/IRIX/osi_file.c:1.11.14.2	Thu Dec 13 14:18:32 2007
--- openafs/src/afs/IRIX/osi_file.c	Mon May 11 09:29:19 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/IRIX/osi_file.c,v 1.11.14.2 2007/12/13 19:18:32 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/IRIX/osi_file.c,v 1.11.14.3 2009/05/11 13:29:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 30,41 ****
   */
  #ifdef AFS_SGI_EFS_IOPS_ENV
  vnode_t *
! afs_EFSIGetVnode(ino_t ainode)
  {
      struct inode *ip;
      int error;
  
!     if ((error = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, ainode, &ip))) {
  	osi_Panic("afs_EFSIGetVnode: igetinode failed, error=%d", error);
      }
      /* We don't care about atimes on the cache files, so disable them.  I'm not
--- 30,41 ----
   */
  #ifdef AFS_SGI_EFS_IOPS_ENV
  vnode_t *
! afs_EFSIGetVnode(afs_dcache_id_t *ainode)
  {
      struct inode *ip;
      int error;
  
!     if ((error = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, ainode->ufs, &ip))) {
  	osi_Panic("afs_EFSIGetVnode: igetinode failed, error=%d", error);
      }
      /* We don't care about atimes on the cache files, so disable them.  I'm not
***************
*** 49,62 ****
  #endif /* AFS_SGI_EFS_IOPS_ENV */
  
  vnode_t *
! afs_XFSIGetVnode(ino_t ainode)
  {
      struct xfs_inode *ip;
      int error;
      vnode_t *vp;
  
      if ((error =
! 	 xfs_igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, ainode, &ip))) {
  	osi_Panic("afs_XFSIGetVnode: xfs_igetinode failed, error=%d", error);
      }
      vp = XFS_ITOV(ip);
--- 49,62 ----
  #endif /* AFS_SGI_EFS_IOPS_ENV */
  
  vnode_t *
! afs_XFSIGetVnode(afs_dcache_id_t *ainode)
  {
      struct xfs_inode *ip;
      int error;
      vnode_t *vp;
  
      if ((error =
! 	 xfs_igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, ainode->ufs, &ip))) {
  	osi_Panic("afs_XFSIGetVnode: xfs_igetinode failed, error=%d", error);
      }
      vp = XFS_ITOV(ip);
***************
*** 65,71 ****
  
  /* Force to 64 bits, even for EFS filesystems. */
  void *
! osi_UFSOpen(ino_t ainode)
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
--- 65,71 ----
  
  /* Force to 64 bits, even for EFS filesystems. */
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
***************
*** 84,95 ****
      }
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
!     afile->vnode = AFS_SGI_IGETVNODE(ainode);
      AFS_GLOCK();
      afile->size = VnodeToSize(afile->vnode);
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
  
--- 84,95 ----
      }
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
!     afile->vnode = AFS_SGI_IGETVNODE(ainode->ufs);
      AFS_GLOCK();
      afile->size = VnodeToSize(afile->vnode);
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
      return (void *)afile;
  }
  
Index: openafs/src/afs/LINUX/osi_cred.c
diff -c openafs/src/afs/LINUX/osi_cred.c:1.12.6.2 openafs/src/afs/LINUX/osi_cred.c:1.12.6.4
*** openafs/src/afs/LINUX/osi_cred.c:1.12.6.2	Thu Jan 15 08:27:29 2009
--- openafs/src/afs/LINUX/osi_cred.c	Mon May 11 10:55:05 2009
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_cred.c,v 1.12.6.2 2009/01/15 13:27:29 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_cred.c,v 1.12.6.4 2009/05/11 14:55:05 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 104,109 ****
--- 104,115 ----
  #if defined(STRUCT_TASK_HAS_CRED)
      struct cred *new_creds;
  
+     /* If our current task doesn't have identical real and effective
+      * credentials, commit_cred won't let us change them, so we just
+      * bail here.
+      */
+     if (current->cred != current->real_cred)
+         return;
      new_creds = prepare_creds();
      new_creds->fsuid = cr->cr_uid;
      new_creds->uid = cr->cr_ruid;
Index: openafs/src/afs/LINUX/osi_file.c
diff -c openafs/src/afs/LINUX/osi_file.c:1.28.2.15 openafs/src/afs/LINUX/osi_file.c:1.28.2.17
*** openafs/src/afs/LINUX/osi_file.c:1.28.2.15	Wed Mar 18 09:41:37 2009
--- openafs/src/afs/LINUX/osi_file.c	Mon May 11 09:40:25 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_file.c,v 1.28.2.15 2009/03/18 13:41:37 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.17 2009/05/11 13:40:25 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include "h/module.h" /* early to avoid printf->printk mapping */
***************
*** 23,30 ****
  #if defined(AFS_LINUX26_ENV)
  #include "h/namei.h"
  #endif
! #if !defined(HAVE_IGET)
  #include "h/exportfs.h"
  #endif
  
  afs_lock_t afs_xosi;		/* lock is for tvattr */
--- 23,32 ----
  #if defined(AFS_LINUX26_ENV)
  #include "h/namei.h"
  #endif
! #if defined(LINUX_USE_FH)
  #include "h/exportfs.h"
+ int cache_fh_type = -1;
+ int cache_fh_len = -1;
  #endif
  
  afs_lock_t afs_xosi;		/* lock is for tvattr */
***************
*** 36,55 ****
  
  #if defined(AFS_LINUX26_ENV) 
  void *
! #if defined(LINUX_USE_FH)
! osi_UFSOpen_fh(struct fid *fh, int fh_type)
! #else
! osi_UFSOpen(afs_int32 ainode)
! #endif
  {
!     register struct osi_file *afile = NULL;
      extern int cacheDiskType;
      struct inode *tip = NULL;
      struct dentry *dp = NULL;
      struct file *filp = NULL;
! #if !defined(HAVE_IGET) || defined(LINUX_USE_FH)
!     struct fid fid;
! #endif
      AFS_STATCNT(osi_UFSOpen);
      if (cacheDiskType != AFS_FCACHE_TYPE_UFS) {
  	osi_Panic("UFSOpen called for non-UFS cache\n");
--- 38,51 ----
  
  #if defined(AFS_LINUX26_ENV) 
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
!     struct osi_file *afile = NULL;
      extern int cacheDiskType;
      struct inode *tip = NULL;
      struct dentry *dp = NULL;
      struct file *filp = NULL;
! 
      AFS_STATCNT(osi_UFSOpen);
      if (cacheDiskType != AFS_FCACHE_TYPE_UFS) {
  	osi_Panic("UFSOpen called for non-UFS cache\n");
***************
*** 67,86 ****
  		  (int)sizeof(struct osi_file));
      }
      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
! #if defined(LINUX_USE_FH)
!     dp = afs_cacheSBp->s_export_op->fh_to_dentry(afs_cacheSBp, fh, sizeof(struct fid), fh_type);
! #else
!     fid.i32.ino = ainode;
!     fid.i32.gen = 0;
!     dp = afs_cacheSBp->s_export_op->fh_to_dentry(afs_cacheSBp, &fid, sizeof(fid), FILEID_INO32_GEN);
! #endif
      if (!dp) 
             osi_Panic("Can't get dentry\n");          
      tip = dp->d_inode;
--- 63,76 ----
  		  (int)sizeof(struct osi_file));
      }
      memset(afile, 0, sizeof(struct osi_file));
! #if !defined(LINUX_USE_FH)
!     tip = iget(afs_cacheSBp, ainode->ufs);
      if (!tip)
! 	osi_Panic("Can't get inode %d\n", ainode->ufs);
  
      dp = d_alloc_anon(tip);
  #else
!     dp = afs_cacheSBp->s_export_op->fh_to_dentry(afs_cacheSBp, &ainode->ufs.fh, cache_fh_len, cache_fh_type);
      if (!dp) 
             osi_Panic("Can't get dentry\n");          
      tip = dp->d_inode;
***************
*** 96,118 ****
  #if defined(LINUX_USE_FH)
  	osi_Panic("Can't open file\n");
  #else
! 	osi_Panic("Can't open inode %d\n", ainode);
  #endif
      afile->filp = filp;
      afile->size = i_size_read(FILE_INODE(filp));
      AFS_GLOCK();
      afile->offset = 0;
      afile->proc = (int (*)())0;
- #if defined(LINUX_USE_FH)
      afile->inum = tip->i_ino;	/* for hint validity checking */
- #else
-     afile->inum = ainode;	/* for hint validity checking */
- #endif
      return (void *)afile;
  }
  #else
  void *
! osi_UFSOpen(afs_int32 ainode)
  {
      register struct osi_file *afile = NULL;
      extern int cacheDiskType;
--- 86,104 ----
  #if defined(LINUX_USE_FH)
  	osi_Panic("Can't open file\n");
  #else
! 	osi_Panic("Can't open inode %d\n", ainode->ufs);
  #endif
      afile->filp = filp;
      afile->size = i_size_read(FILE_INODE(filp));
      AFS_GLOCK();
      afile->offset = 0;
      afile->proc = (int (*)())0;
      afile->inum = tip->i_ino;	/* for hint validity checking */
      return (void *)afile;
  }
  #else
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      register struct osi_file *afile = NULL;
      extern int cacheDiskType;
***************
*** 138,146 ****
      memset(afile, 0, sizeof(struct osi_file));
      filp = &afile->file;
      filp->f_dentry = &afile->dentry;
!     tip = iget(afs_cacheSBp, (u_long) ainode);
      if (!tip)
! 	osi_Panic("Can't get inode %d\n", ainode);
      FILE_INODE(filp) = tip;
      tip->i_flags |= MS_NOATIME;	/* Disable updating access times. */
      filp->f_flags = O_RDWR;
--- 124,132 ----
      memset(afile, 0, sizeof(struct osi_file));
      filp = &afile->file;
      filp->f_dentry = &afile->dentry;
!     tip = iget(afs_cacheSBp, ainode->ufs);
      if (!tip)
! 	osi_Panic("Can't get inode %d\n", ainode->ufs);
      FILE_INODE(filp) = tip;
      tip->i_flags |= MS_NOATIME;	/* Disable updating access times. */
      filp->f_flags = O_RDWR;
***************
*** 153,182 ****
      if (filp->f_op && filp->f_op->open)
  	code = filp->f_op->open(tip, filp);
      if (code)
! 	osi_Panic("Can't open inode %d\n", ainode);
      afile->size = i_size_read(tip);
      AFS_GLOCK();
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
  #endif
  
  #if defined(LINUX_USE_FH)
! int
! osi_get_fh(struct dentry *dp, struct fid *fh, int *max_len) {
!     int fh_type;
! 
      if (dp->d_sb->s_export_op->encode_fh) {
!            fh_type = dp->d_sb->s_export_op->encode_fh(dp, (__u32 *)fh, max_len, 0);
      } else {
!            fh_type = FILEID_INO32_GEN;
!            fh->i32.ino = dp->d_inode->i_ino;
!            fh->i32.gen = dp->d_inode->i_generation;
      }
!     dput(dp);
!     return(fh_type);
  }
  #endif
  
--- 139,195 ----
      if (filp->f_op && filp->f_op->open)
  	code = filp->f_op->open(tip, filp);
      if (code)
! 	osi_Panic("Can't open inode %d\n", ainode->ufs);
      afile->size = i_size_read(tip);
      AFS_GLOCK();
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
      return (void *)afile;
  }
  #endif
  
  #if defined(LINUX_USE_FH)
! /*
!  * Given a dentry, return the file handle as encoded by the filesystem.
!  * We can't assume anything about the length (words, not bytes).
!  * The cache has to live on a single filesystem with uniform file 
!  * handles, otherwise we panic.
!  */
! void osi_get_fh(struct dentry *dp, afs_ufs_dcache_id_t *ainode) {
!     int max_len;
!     int type;
! 
!     if (cache_fh_len > 0)
! 	max_len = cache_fh_len;
!     else
! 	max_len = MAX_FH_LEN;
      if (dp->d_sb->s_export_op->encode_fh) {
!         type = dp->d_sb->s_export_op->encode_fh(dp, &ainode->raw[0], &max_len, 0);
!         if (type == 255) {
!            osi_Panic("File handle encoding failed\n");
!         }
!         if (cache_fh_type < 0)
!             cache_fh_type = type;
!         if (cache_fh_len < 0) {
!             cache_fh_len = max_len;
!         }
!         if (type != cache_fh_type || max_len != cache_fh_len) {
!            osi_Panic("Inconsistent file handles within cache\n");
!         }
      } else {
!          /* If fs doesn't provide an encode_fh method, assume the default INO32 type */
! 	if (cache_fh_type < 0)
! 	    cache_fh_type = FILEID_INO32_GEN;
! 	if (cache_fh_len < 0)
! 	    cache_fh_len = sizeof(struct fid)/4;
!         ainode->fh.i32.ino = dp->d_inode->i_ino;
!         ainode->fh.i32.gen = dp->d_inode->i_generation;
      }
! }
! #else
! void osi_get_fh(struct dentry *dp, afs_ufs_dcache_id_t *ainode) {
!     *ainode = dp->d_inode->i_ino;
  }
  #endif
  
***************
*** 409,421 ****
  osi_InitCacheInfo(char *aname)
  {
      int code;
! #if defined(LINUX_USE_FH)
!     int max_len = sizeof(struct fid);
! #else
!     extern ino_t cacheInode;
! #endif
      struct dentry *dp;
-     extern ino_t cacheInode;
      extern struct osi_dev cacheDev;
      extern afs_int32 afs_fsfragsize;
      extern struct super_block *afs_cacheSBp;
--- 422,429 ----
  osi_InitCacheInfo(char *aname)
  {
      int code;
!     extern afs_dcache_id_t cacheInode;
      struct dentry *dp;
      extern struct osi_dev cacheDev;
      extern afs_int32 afs_fsfragsize;
      extern struct super_block *afs_cacheSBp;
***************
*** 424,440 ****
      if (code)
  	return ENOENT;
  
! #if defined(LINUX_USE_FH)
!     if (dp->d_sb->s_export_op->encode_fh) {
! 	cacheitems_fh_type = dp->d_sb->s_export_op->encode_fh(dp, (__u32 *)&cacheitems_fh, &max_len, 0);
!     } else {
!         cacheitems_fh_type = FILEID_INO32_GEN;
! 	cacheitems_fh.i32.ino = dp->d_inode->i_ino;
!         cacheitems_fh.i32.gen = dp->d_inode->i_generation;
!     }
! #else
!     cacheInode = dp->d_inode->i_ino;
! #endif
      cacheDev.dev = dp->d_inode->i_sb->s_dev;
      afs_fsfragsize = dp->d_inode->i_sb->s_blocksize - 1;
      afs_cacheSBp = dp->d_inode->i_sb;
--- 432,438 ----
      if (code)
  	return ENOENT;
  
!     osi_get_fh(dp, &cacheInode.ufs);
      cacheDev.dev = dp->d_inode->i_sb->s_dev;
      afs_fsfragsize = dp->d_inode->i_sb->s_blocksize - 1;
      afs_cacheSBp = dp->d_inode->i_sb;
Index: openafs/src/afs/LINUX/osi_ioctl.c
diff -c openafs/src/afs/LINUX/osi_ioctl.c:1.1.2.2 openafs/src/afs/LINUX/osi_ioctl.c:1.1.2.3
*** openafs/src/afs/LINUX/osi_ioctl.c:1.1.2.2	Mon Jul 31 17:27:39 2006
--- openafs/src/afs/LINUX/osi_ioctl.c	Tue Apr  7 12:16:59 2009
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_ioctl.c,v 1.1.2.2 2006/07/31 21:27:39 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_ioctl.c,v 1.1.2.3 2009/04/07 16:16:59 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
***************
*** 126,132 ****
--- 126,134 ----
  
      entry = create_proc_entry(PROC_SYSCALL_NAME, 0666, openafs_procfs);
      entry->proc_fops = &afs_syscall_fops;
+ #if defined(STRUCT_PROC_DIR_ENTRY_HAS_OWNER)
      entry->owner = THIS_MODULE;
+ #endif
  
  #if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
      if (register_ioctl32_conversion(VIOC_SYSCALL32, NULL) == 0) 
Index: openafs/src/afs/LINUX/osi_vm.c
diff -c openafs/src/afs/LINUX/osi_vm.c:1.17.4.5 openafs/src/afs/LINUX/osi_vm.c:1.17.4.6
*** openafs/src/afs/LINUX/osi_vm.c:1.17.4.5	Fri Mar 27 11:45:38 2009
--- openafs/src/afs/LINUX/osi_vm.c	Tue May 12 13:56:40 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vm.c,v 1.17.4.5 2009/03/27 15:45:38 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vm.c,v 1.17.4.6 2009/05/12 17:56:40 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 102,110 ****
  {
      struct inode *ip = AFSTOV(avc);
  
!     if (!avc->f.states & CPageWrite)
! 	avc->f.states |= CPageWrite;
!     else 
  	return; /* someone already writing */
  
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,5)
--- 102,108 ----
  {
      struct inode *ip = AFSTOV(avc);
  
!     if (avc->f.states & CPageWrite)
  	return; /* someone already writing */
  
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,5)
***************
*** 120,126 ****
      AFS_GLOCK();
      ObtainWriteLock(&avc->lock, 121);
  #endif
-     avc->f.states &= ~CPageWrite;
  }
  
  /* Purge VM for a file when its callback is revoked.
--- 118,123 ----
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.50 openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.54
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.50	Tue Apr  7 08:25:52 2009
--- openafs/src/afs/LINUX/osi_vnodeops.c	Tue May 26 20:47:53 2009
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.126.2.50 2009/04/07 12:25:52 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.54 2009/05/27 00:47:53 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 504,516 ****
      struct vcache *vcp = VTOAFS(FILE_INODE(fp));
      cred_t *credp = crref();
      struct AFS_FLOCK flock;
      /* Convert to a lock format afs_lockctl understands. */
      memset((char *)&flock, 0, sizeof(flock));
      flock.l_type = flp->fl_type;
      flock.l_pid = flp->fl_pid;
      flock.l_whence = 0;
      flock.l_start = flp->fl_start;
!     flock.l_len = flp->fl_end - flp->fl_start;
  
      /* Safe because there are no large files, yet */
  #if defined(F_GETLK64) && (F_GETLK != F_GETLK64)
--- 504,522 ----
      struct vcache *vcp = VTOAFS(FILE_INODE(fp));
      cred_t *credp = crref();
      struct AFS_FLOCK flock;
+ #if defined(POSIX_TEST_LOCK_CONFLICT_ARG)
+     struct file_lock conflict;
+ #elif defined(POSIX_TEST_LOCK_RETURNS_CONFLICT)
+     struct file_lock *conflict;
+ #endif
+     
      /* Convert to a lock format afs_lockctl understands. */
      memset((char *)&flock, 0, sizeof(flock));
      flock.l_type = flp->fl_type;
      flock.l_pid = flp->fl_pid;
      flock.l_whence = 0;
      flock.l_start = flp->fl_start;
!     flock.l_len = flp->fl_end - flp->fl_start + 1;
  
      /* Safe because there are no large files, yet */
  #if defined(F_GETLK64) && (F_GETLK != F_GETLK64)
***************
*** 529,540 ****
  #ifdef AFS_LINUX24_ENV
      if ((code == 0 || flp->fl_type == F_UNLCK) && 
  	(cmd == F_SETLK || cmd == F_SETLKW)) {
! #ifdef POSIX_LOCK_FILE_WAIT_ARG
          code = posix_lock_file(fp, flp, 0);
! #else
          flp->fl_flags &=~ FL_SLEEP;
          code = posix_lock_file(fp, flp);
! #endif
         if (code && flp->fl_type != F_UNLCK) {
             struct AFS_FLOCK flock2;
             flock2 = flock;
--- 535,546 ----
  #ifdef AFS_LINUX24_ENV
      if ((code == 0 || flp->fl_type == F_UNLCK) && 
  	(cmd == F_SETLK || cmd == F_SETLKW)) {
! # ifdef POSIX_LOCK_FILE_WAIT_ARG
          code = posix_lock_file(fp, flp, 0);
! # else
          flp->fl_flags &=~ FL_SLEEP;
          code = posix_lock_file(fp, flp);
! # endif
         if (code && flp->fl_type != F_UNLCK) {
             struct AFS_FLOCK flock2;
             flock2 = flock;
***************
*** 544,555 ****
             AFS_GUNLOCK();
         }
      }
  #endif
      /* Convert flock back to Linux's file_lock */
      flp->fl_type = flock.l_type;
      flp->fl_pid = flock.l_pid;
      flp->fl_start = flock.l_start;
!     flp->fl_end = flock.l_start + flock.l_len;
  
      crfree(credp);
      return -code;
--- 550,589 ----
             AFS_GUNLOCK();
         }
      }
+     /* If lockctl says there are no conflicting locks, then also check with the
+      * kernel, as lockctl knows nothing about byte range locks
+      */
+     if (code == 0 && cmd == F_GETLK && flock.l_type == F_UNLCK) {
+ # if defined(POSIX_TEST_LOCK_CONFLICT_ARG)
+         if (posix_test_lock(fp, flp, &conflict)) {
+             locks_copy_lock(flp, &conflict);
+             flp->fl_type = F_UNLCK;
+             crfree(credp);
+             return 0;
+         }
+ # elif defined(POSIX_TEST_LOCK_RETURNS_CONFLICT)
+ 	if ((conflict = posix_test_lock(fp, flp))) {
+ 	    locks_copy_lock(flp, conflict);
+ 	    flp->fl_type = F_UNLCK;
+ 	    crfee(credp);
+ 	    return 0;
+ 	}
+ # else
+         posix_test_lock(fp, flp);
+         /* If we found a lock in the kernel's structure, return it */
+         if (flp->fl_type != F_UNLCK) {
+             crfree(credp);
+             return 0;
+         }
+     }
+ # endif
+     
  #endif
      /* Convert flock back to Linux's file_lock */
      flp->fl_type = flock.l_type;
      flp->fl_pid = flock.l_pid;
      flp->fl_start = flock.l_start;
!     flp->fl_end = flock.l_start + flock.l_len - 1;
  
      crfree(credp);
      return -code;
***************
*** 1895,1903 ****
  	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
  	       ICL_TYPE_INT32, 99999);
  
!     ObtainReadLock(&vcp->lock);
      if (vcp->f.states & CPageWrite) {
! 	ReleaseReadLock(&vcp->lock);
  	AFS_GUNLOCK();
  	maybe_unlock_kernel();
  	crfree(credp);
--- 1929,1937 ----
  	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
  	       ICL_TYPE_INT32, 99999);
  
!     ObtainWriteLock(&vcp->lock, 532);
      if (vcp->f.states & CPageWrite) {
! 	ReleaseWriteLock(&vcp->lock);
  	AFS_GUNLOCK();
  	maybe_unlock_kernel();
  	crfree(credp);
***************
*** 1913,1919 ****
  	return(0); 
  #endif
      }
!     ReleaseReadLock(&vcp->lock);
  
      setup_uio(&tuio, &iovec, buffer, base, count, UIO_WRITE, AFS_UIOSYS);
  
--- 1947,1954 ----
  	return(0); 
  #endif
      }
!     vcp->f.states |= CPageWrite;
!     ReleaseWriteLock(&vcp->lock);
  
      setup_uio(&tuio, &iovec, buffer, base, count, UIO_WRITE, AFS_UIOSYS);
  
***************
*** 1922,1937 ****
      i_size_write(ip, vcp->f.m.Length);
      ip->i_blocks = ((vcp->f.m.Length + 1023) >> 10) << 1;
  
      if (!code) {
  	struct vrequest treq;
  
- 	ObtainWriteLock(&vcp->lock, 533);
  	if (!afs_InitReq(&treq, credp))
  	    code = afs_DoPartialWrite(vcp, &treq);
- 	ReleaseWriteLock(&vcp->lock);
      }
      code = code ? -code : count - tuio.uio_resid;
  
      afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
  	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
  	       ICL_TYPE_INT32, code);
--- 1957,1974 ----
      i_size_write(ip, vcp->f.m.Length);
      ip->i_blocks = ((vcp->f.m.Length + 1023) >> 10) << 1;
  
+     ObtainWriteLock(&vcp->lock, 533);
      if (!code) {
  	struct vrequest treq;
  
  	if (!afs_InitReq(&treq, credp))
  	    code = afs_DoPartialWrite(vcp, &treq);
      }
      code = code ? -code : count - tuio.uio_resid;
  
+     vcp->f.states &= ~CPageWrite;
+     ReleaseWriteLock(&vcp->lock);
+ 
      afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
  	       ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, page_count(pp),
  	       ICL_TYPE_INT32, code);
***************
*** 1986,1992 ****
    do_it:
      status = afs_linux_writepage_sync(inode, pp, 0, offset);
      SetPageUptodate(pp);
!     UnlockPage(pp);
      if (status == offset)
  	return 0;
      else
--- 2023,2034 ----
    do_it:
      status = afs_linux_writepage_sync(inode, pp, 0, offset);
      SetPageUptodate(pp);
! #if defined(WRITEPAGE_ACTIVATE)
!     if ( status != WRITEPAGE_ACTIVATE )
! #else
!     if ( status != AOP_WRITEPAGE_ACTIVATE )
! #endif
! 	UnlockPage(pp);
      if (status == offset)
  	return 0;
      else
Index: openafs/src/afs/NBSD/osi_file.c
diff -c openafs/src/afs/NBSD/osi_file.c:1.5.14.2 openafs/src/afs/NBSD/osi_file.c:1.5.14.3
*** openafs/src/afs/NBSD/osi_file.c:1.5.14.2	Thu Dec 13 14:18:33 2007
--- openafs/src/afs/NBSD/osi_file.c	Mon May 11 09:29:20 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/NBSD/osi_file.c,v 1.5.14.2 2007/12/13 19:18:33 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/NBSD/osi_file.c,v 1.5.14.3 2009/05/11 13:29:20 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 26,32 ****
  
  
  void *
! osi_UFSOpen(afs_int32 ainode)
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
--- 26,32 ----
  
  
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
***************
*** 39,45 ****
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
      code =
! 	igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode, &ip,
  		  &dummy);
      AFS_GLOCK();
      if (code) {
--- 39,45 ----
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
      code =
! 	igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, ainode->ufs, &ip,
  		  &dummy);
      AFS_GLOCK();
      if (code) {
***************
*** 51,57 ****
      afile->size = VTOI(afile->vnode)->i_size;
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
  
--- 51,57 ----
      afile->size = VTOI(afile->vnode)->i_size;
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
      return (void *)afile;
  }
  
Index: openafs/src/afs/OBSD/osi_file.c
diff -c openafs/src/afs/OBSD/osi_file.c:1.11.2.1 openafs/src/afs/OBSD/osi_file.c:1.11.2.2
*** openafs/src/afs/OBSD/osi_file.c:1.11.2.1	Thu Nov  9 18:30:54 2006
--- openafs/src/afs/OBSD/osi_file.c	Mon May 11 09:29:20 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/OBSD/osi_file.c,v 1.11.2.1 2006/11/09 23:30:54 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afs/afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/OBSD/osi_file.c,v 1.11.2.2 2009/05/11 13:29:20 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 26,32 ****
  
  
  void *
! osi_UFSOpen(afs_int32 ainode)
  {
      struct osi_file *afile;
      struct vnode *vp;
--- 26,32 ----
  
  
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      struct osi_file *afile;
      struct vnode *vp;
***************
*** 38,44 ****
  	osi_Panic("UFSOpen called for non-UFS cache\n");
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
!     code = VFS_VGET(cacheDev.mp, (ino_t) ainode, &vp);
      AFS_GLOCK();
      if (code == 0 && vp->v_type == VNON)
  	code = ENOENT;
--- 38,44 ----
  	osi_Panic("UFSOpen called for non-UFS cache\n");
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
!     code = VFS_VGET(cacheDev.mp, ainode->ufs, &vp);
      AFS_GLOCK();
      if (code == 0 && vp->v_type == VNON)
  	code = ENOENT;
***************
*** 55,61 ****
  #endif
      afile->offset = 0;
      afile->proc = NULL;
!     afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
  
--- 55,61 ----
  #endif
      afile->offset = 0;
      afile->proc = NULL;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
      return (void *)afile;
  }
  
Index: openafs/src/afs/SOLARIS/osi_file.c
diff -c openafs/src/afs/SOLARIS/osi_file.c:1.13.14.5 openafs/src/afs/SOLARIS/osi_file.c:1.13.14.6
*** openafs/src/afs/SOLARIS/osi_file.c:1.13.14.5	Tue Mar 17 11:10:42 2009
--- openafs/src/afs/SOLARIS/osi_file.c	Mon May 11 09:29:20 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/SOLARIS/osi_file.c,v 1.13.14.5 2009/03/17 15:10:42 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/SOLARIS/osi_file.c,v 1.13.14.6 2009/05/11 13:29:20 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 144,150 ****
  }
  
  void *
! osi_VxfsOpen(afs_int32 ainode)
  {
      struct vnode *vp;
      register struct osi_file *afile = NULL;
--- 144,150 ----
  }
  
  void *
! osi_VxfsOpen(afs_dcache_id_t *ainode)
  {
      struct vnode *vp;
      register struct osi_file *afile = NULL;
***************
*** 152,158 ****
      int dummy;
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
!     code = (*vxfs_vx_vp_byino) (afs_cacheVfsp, &vp, (unsigned int)ainode);
      AFS_GLOCK();
      if (code) {
  	osi_FreeSmallSpace(afile);
--- 152,158 ----
      int dummy;
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
!     code = (*vxfs_vx_vp_byino) (afs_cacheVfsp, &vp, (unsigned int)ainode->ufs);
      AFS_GLOCK();
      if (code) {
  	osi_FreeSmallSpace(afile);
***************
*** 162,179 ****
      afile->size = VnodeToSize(afile->vnode);
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
  #endif /* AFS_HAVE_VXFS */
  
- #if defined(AFS_SUN57_64BIT_ENV)
  void *
! osi_UfsOpen(ino_t ainode)
! #else
! void *
! osi_UfsOpen(afs_int32 ainode)
! #endif
  {
  #ifdef AFS_CACHE_VNODE_PATH
      struct vnode *vp;
--- 162,174 ----
      afile->size = VnodeToSize(afile->vnode);
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
      return (void *)afile;
  }
  #endif /* AFS_HAVE_VXFS */
  
  void *
! osi_UfsOpen(afs_dcache_id_t *ainode)
  {
  #ifdef AFS_CACHE_VNODE_PATH
      struct vnode *vp;
***************
*** 197,203 ****
   * The ainode is not an inode number but a signed index used to generate file names. 
   */
  #ifdef AFS_CACHE_VNODE_PATH
! 	switch (ainode) {
  	case AFS_CACHE_CELLS_INODE:
  	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
  	    break;
--- 192,198 ----
   * The ainode is not an inode number but a signed index used to generate file names. 
   */
  #ifdef AFS_CACHE_VNODE_PATH
! 	switch (ainode->ufs) {
  	case AFS_CACHE_CELLS_INODE:
  	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
  	    break;
***************
*** 208,215 ****
  	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "VolumeItems");
  	    break;
  	default:
! 		dummy = ainode / afs_numfilesperdir;
! 		snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode);
      }
  		
  	/* Can not use vn_open or lookupname, they use user's CRED() 
--- 203,210 ----
  	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "VolumeItems");
  	    break;
  	default:
! 	    dummy = ainode->ufs / afs_numfilesperdir;
! 	    snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode->ufs);
      }
  		
  	/* Can not use vn_open or lookupname, they use user's CRED() 
***************
*** 219,231 ****
  
  	code = pn_get_buf(fname, AFS_UIOSYS, &lookpn, namebuf, sizeof(namebuf));
      if (code != 0) 
!         osi_Panic("UfsOpen: pn_get_buf failed %ld %s %ld", code, fname, ainode);
   
  	VN_HOLD(rootdir); /* released in loopuppnvp */
  	code = lookuppnvp(&lookpn, NULL, FOLLOW, NULL, &vp, 
             rootdir, rootdir, &afs_osi_cred); 
      if (code != 0)  
!         osi_Panic("UfsOpen: lookuppnvp failed %ld %s %ld", code, fname, ainode);
  	
  #ifdef AFS_SUN511_ENV
      code = VOP_OPEN(&vp, FREAD|FWRITE, &afs_osi_cred, NULL);
--- 214,226 ----
  
  	code = pn_get_buf(fname, AFS_UIOSYS, &lookpn, namebuf, sizeof(namebuf));
      if (code != 0) 
!         osi_Panic("UfsOpen: pn_get_buf failed %ld %s %ld", code, fname, ainode->ufs);
   
  	VN_HOLD(rootdir); /* released in loopuppnvp */
  	code = lookuppnvp(&lookpn, NULL, FOLLOW, NULL, &vp, 
             rootdir, rootdir, &afs_osi_cred); 
      if (code != 0)  
!         osi_Panic("UfsOpen: lookuppnvp failed %ld %s %ld", code, fname, ainode->ufs);
  	
  #ifdef AFS_SUN511_ENV
      code = VOP_OPEN(&vp, FREAD|FWRITE, &afs_osi_cred, NULL);
***************
*** 234,250 ****
  #endif
  
      if (code != 0)
!         osi_Panic("UfsOpen: VOP_OPEN failed %ld %s %ld", code, fname, ainode);
  
  #else
      code =
! 	igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode, &ip,
  		  CRED(), &dummy);
  #endif
      AFS_GLOCK();
      if (code) {
  	osi_FreeSmallSpace(afile);
! 	osi_Panic("UfsOpen: igetinode failed %ld %s %ld", code, fname, ainode);
      }
  #ifdef AFS_CACHE_VNODE_PATH
  	afile->vnode = vp;
--- 229,245 ----
  #endif
  
      if (code != 0)
!         osi_Panic("UfsOpen: VOP_OPEN failed %ld %s %ld", code, fname, ainode->ufs);
  
  #else
      code =
! 	igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, ainode->ufs, &ip,
  		  CRED(), &dummy);
  #endif
      AFS_GLOCK();
      if (code) {
  	osi_FreeSmallSpace(afile);
! 	osi_Panic("UfsOpen: igetinode failed %ld %s %ld", code, fname, ainode->ufs);
      }
  #ifdef AFS_CACHE_VNODE_PATH
  	afile->vnode = vp;
***************
*** 256,275 ****
  #endif
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
  
  /**
    * In Solaris 7 we use 64 bit inode numbers
    */
- #if defined(AFS_SUN57_64BIT_ENV)
  void *
! osi_UFSOpen(ino_t ainode)
! #else
! void *
! osi_UFSOpen(afs_int32 ainode)
! #endif
  {
      extern int cacheDiskType;
      AFS_STATCNT(osi_UFSOpen);
--- 251,265 ----
  #endif
      afile->offset = 0;
      afile->proc = (int (*)())0;
!     afile->inum = ainode->ufs;	/* for hint validity checking */
      return (void *)afile;
  }
  
  /**
    * In Solaris 7 we use 64 bit inode numbers
    */
  void *
! osi_UFSOpen(afs_dcache_id_t *ainode)
  {
      extern int cacheDiskType;
      AFS_STATCNT(osi_UFSOpen);
Index: openafs/src/afs/UKERNEL/afs_usrops.c
diff -c openafs/src/afs/UKERNEL/afs_usrops.c:1.30.6.12 openafs/src/afs/UKERNEL/afs_usrops.c:1.30.6.14
*** openafs/src/afs/UKERNEL/afs_usrops.c:1.30.6.12	Mon Jan 26 13:52:42 2009
--- openafs/src/afs/UKERNEL/afs_usrops.c	Mon May 11 09:29:20 2009
***************
*** 1,3 ****
--- 1,4 ----
+ 
  /*
   * Copyright 2000, International Business Machines Corporation and others.
   * All Rights Reserved.
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.30.6.12 2009/01/26 18:52:42 shadow Exp $");
  
  
  #ifdef	UKERNEL
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.30.6.14 2009/05/11 13:29:20 shadow Exp $");
  
  
  #ifdef	UKERNEL
***************
*** 701,707 ****
   * open a file given its i-node number
   */
  void *
! osi_UFSOpen(afs_int32 ino)
  {
      int rc;
      struct osi_file *fp;
--- 702,708 ----
   * open a file given its i-node number
   */
  void *
! osi_UFSOpen(afs_dcache_id_t *ino)
  {
      int rc;
      struct osi_file *fp;
***************
*** 709,715 ****
  
      AFS_ASSERT_GLOCK();
  
!     if (ino > n_osi_files) {
  	u.u_error = ENOENT;
  	return NULL;
      }
--- 710,716 ----
  
      AFS_ASSERT_GLOCK();
  
!     if (ino->ufs > n_osi_files) {
  	u.u_error = ENOENT;
  	return NULL;
      }
***************
*** 717,723 ****
      AFS_GUNLOCK();
      fp = (struct osi_file *)afs_osi_Alloc(sizeof(struct osi_file));
      usr_assert(fp != NULL);
!     fp->fd = open(osi_file_table[ino - 1].name, O_RDWR | O_CREAT, 0);
      if (fp->fd < 0) {
  	u.u_error = errno;
  	afs_osi_Free((char *)fp, sizeof(struct osi_file));
--- 718,724 ----
      AFS_GUNLOCK();
      fp = (struct osi_file *)afs_osi_Alloc(sizeof(struct osi_file));
      usr_assert(fp != NULL);
!     fp->fd = open(osi_file_table[ino->ufs - 1].name, O_RDWR | O_CREAT, 0);
      if (fp->fd < 0) {
  	u.u_error = errno;
  	afs_osi_Free((char *)fp, sizeof(struct osi_file));
***************
*** 733,739 ****
      }
      fp->size = st.st_size;
      fp->offset = 0;
!     fp->inum = ino;
      fp->vnode = (struct usr_vnode *)fp;
  
      AFS_GLOCK();
--- 734,740 ----
      }
      fp->size = st.st_size;
      fp->offset = 0;
!     fp->inum = ino->ufs;
      fp->vnode = (struct usr_vnode *)fp;
  
      AFS_GLOCK();
***************
*** 1314,1321 ****
--- 1315,1327 ----
      for (currp = readdir(cdirp); currp; currp = readdir(cdirp)) {
  	if (afsd_debug) {
  	    printf("%s: Current directory entry:\n", rn);
+ #if defined(AFS_USR_DFBSD_ENV)
+ 	    printf("\tinode=%d, name='%s'\n", currp->d_ino,
+ 		   currp->d_name);
+ #else
  	    printf("\tinode=%d, reclen=%d, name='%s'\n", currp->d_ino,
  		   currp->d_reclen, currp->d_name);
+ #endif
  	}
  
  	/*
***************
*** 2066,2071 ****
--- 2072,2078 ----
      iob.in_size = tlen;
      iob.out = &outbuf[0];
      iob.out_size = sizeof(outbuf);
+ 
      rc = call_syscall(AFSCALL_PIOCTL, 0, _VICEIOCTL(3), (long)&iob, 0, 0);
      if (rc != 0) {
  	errno = rc;
Index: openafs/src/afs/UKERNEL/sysincludes.h
diff -c openafs/src/afs/UKERNEL/sysincludes.h:1.15.14.4 openafs/src/afs/UKERNEL/sysincludes.h:1.15.14.5
*** openafs/src/afs/UKERNEL/sysincludes.h:1.15.14.4	Mon Dec 29 16:26:12 2008
--- openafs/src/afs/UKERNEL/sysincludes.h	Wed May 13 17:35:09 2009
***************
*** 140,145 ****
--- 140,159 ----
  #endif
  #endif /* AFS_USR_DARWIN_ENV || AFS_USR_FBSD_ENV */
  
+ #ifdef HAVE_SYS_BITYPES_H
+ #include <sys/bitypes.h>
+ #endif
+ #ifdef HAVE_SYS_STATFS_H
+ #include <sys/statfs.h>
+ #endif
+ #ifdef HAVE_SYS_STATVFS_H
+ #include <sys/statvfs.h>
+ #endif
+ 
+ #ifndef HAVE_FSBLKCNT_T
+ typedef unsigned int fsblkcnt_t;
+ #endif
+ 
  #ifdef AFS_AFSDB_ENV
  #include <arpa/nameser.h>
  #include <resolv.h>
***************
*** 1038,1044 ****
      struct timeval va_ctime;
      dev_t va_rdev;
      unsigned long va_blocksize;
!     blkcnt_t va_blocks;
      unsigned long va_vcode;
  };
  
--- 1052,1058 ----
      struct timeval va_ctime;
      dev_t va_rdev;
      unsigned long va_blocksize;
!     fsblkcnt_t va_blocks;
      unsigned long va_vcode;
  };
  
Index: openafs/src/afs/VNOPS/afs_vnop_flock.c
diff -c openafs/src/afs/VNOPS/afs_vnop_flock.c:1.29.2.9 openafs/src/afs/VNOPS/afs_vnop_flock.c:1.29.2.10
*** openafs/src/afs/VNOPS/afs_vnop_flock.c:1.29.2.9	Wed Mar 18 09:41:37 2009
--- openafs/src/afs/VNOPS/afs_vnop_flock.c	Tue May 26 20:47:53 2009
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.29.2.9 2009/03/18 13:41:37 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.29.2.10 2009/05/27 00:47:53 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 485,492 ****
--- 485,497 ----
  
      /* otherwise, it is time to nag the user */
      lastWarnTime = now;
+ #ifdef AFS_LINUX26_ENV
+     afs_warn
+ 	("afs: byte-range locks only enforced for processes on this machine.\n");
+ #else
      afs_warn
  	("afs: byte-range lock/unlock ignored; make sure no one else is running this program.\n");
+ #endif
  }
  
  
Index: openafs/src/afs/VNOPS/afs_vnop_read.c
diff -c openafs/src/afs/VNOPS/afs_vnop_read.c:1.34.2.8 openafs/src/afs/VNOPS/afs_vnop_read.c:1.34.2.9
*** openafs/src/afs/VNOPS/afs_vnop_read.c:1.34.2.8	Mon Jan 26 13:52:42 2009
--- openafs/src/afs/VNOPS/afs_vnop_read.c	Mon May 11 09:29:21 2009
***************
*** 19,25 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_read.c,v 1.34.2.8 2009/01/26 18:52:42 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 19,25 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_read.c,v 1.34.2.9 2009/05/11 13:29:21 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 351,357 ****
  	    tuio.afsio_offset = offset;
  #endif
  
! 	    code = afs_MemReadUIO(tdc->f.inode, tuiop);
  
  	    if (code) {
  		error = code;
--- 351,357 ----
  	    tuio.afsio_offset = offset;
  #endif
  
! 	    code = afs_MemReadUIO(&tdc->f.inode, tuiop);
  
  	    if (code) {
  		error = code;
***************
*** 806,816 ****
  		usedihint++;
  	    } else
  #endif /* IHINT */
! #if defined(LINUX_USE_FH)
! 		tfile = (struct osi_file *)osi_UFSOpen_fh(&tdc->f.fh, tdc->f.fh_type);
! #else
! 		tfile = (struct osi_file *)osi_UFSOpen(tdc->f.inode);
! #endif
  #ifdef AFS_DARWIN80_ENV
  	    trimlen = len;
              tuiop = afsio_darwin_partialcopy(auio, trimlen);
--- 806,812 ----
  		usedihint++;
  	    } else
  #endif /* IHINT */
! 	    tfile = (struct osi_file *)osi_UFSOpen(&tdc->f.inode);
  #ifdef AFS_DARWIN80_ENV
  	    trimlen = len;
              tuiop = afsio_darwin_partialcopy(auio, trimlen);
Index: openafs/src/afs/VNOPS/afs_vnop_symlink.c
diff -c openafs/src/afs/VNOPS/afs_vnop_symlink.c:1.24.4.12 openafs/src/afs/VNOPS/afs_vnop_symlink.c:1.24.4.13
*** openafs/src/afs/VNOPS/afs_vnop_symlink.c:1.24.4.12	Mon Jan 26 13:52:42 2009
--- openafs/src/afs/VNOPS/afs_vnop_symlink.c	Mon May 11 09:29:21 2009
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.24.4.12 2009/01/26 18:52:42 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.24.4.13 2009/05/11 13:29:21 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 59,65 ****
      ObtainWriteLock(&tdc->lock, 720);
      afs_AdjustSize(tdc, len);
      tdc->validPos = len;
!     tfile = afs_CFileOpen(tdc->f.inode);
      afs_CFileWrite(tfile, 0, aname, len);
      afs_CFileClose(tfile);
      ReleaseWriteLock(&tdc->lock);
--- 59,65 ----
      ObtainWriteLock(&tdc->lock, 720);
      afs_AdjustSize(tdc, len);
      tdc->validPos = len;
!     tfile = afs_CFileOpen(&tdc->f.inode);
      afs_CFileWrite(tfile, 0, aname, len);
      afs_CFileClose(tfile);
      ReleaseWriteLock(&tdc->lock);
***************
*** 329,335 ****
  	    alen = len;		/* mt point */
  	rbuf = (char *)osi_AllocLargeSpace(AFS_LRALLOCSIZ);
  	ObtainReadLock(&tdc->lock);
! 	addr = afs_MemCacheOpen(tdc->f.inode);
  	tlen = len;
  	code = afs_MemReadBlk(addr, 0, rbuf, tlen);
  	afs_MemCacheClose(addr);
--- 329,335 ----
  	    alen = len;		/* mt point */
  	rbuf = (char *)osi_AllocLargeSpace(AFS_LRALLOCSIZ);
  	ObtainReadLock(&tdc->lock);
! 	addr = afs_MemCacheOpen(&tdc->f.inode);
  	tlen = len;
  	code = afs_MemReadBlk(addr, 0, rbuf, tlen);
  	afs_MemCacheClose(addr);
***************
*** 386,396 ****
  	rbuf = (char *)osi_AllocLargeSpace(AFS_LRALLOCSIZ);
  	tlen = len;
  	ObtainReadLock(&tdc->lock);
! #if defined(LINUX_USE_FH)
! 	tfile = osi_UFSOpen_fh(&tdc->f.fh, tdc->f.fh_type);
! #else
! 	tfile = osi_UFSOpen(tdc->f.inode);
! #endif
  	code = afs_osi_Read(tfile, -1, rbuf, tlen);
  	osi_UFSClose(tfile);
  	ReleaseReadLock(&tdc->lock);
--- 386,392 ----
  	rbuf = (char *)osi_AllocLargeSpace(AFS_LRALLOCSIZ);
  	tlen = len;
  	ObtainReadLock(&tdc->lock);
! 	tfile = osi_UFSOpen(&tdc->f.inode);
  	code = afs_osi_Read(tfile, -1, rbuf, tlen);
  	osi_UFSClose(tfile);
  	ReleaseReadLock(&tdc->lock);
Index: openafs/src/afs/VNOPS/afs_vnop_write.c
diff -c openafs/src/afs/VNOPS/afs_vnop_write.c:1.50.2.13 openafs/src/afs/VNOPS/afs_vnop_write.c:1.50.2.14
*** openafs/src/afs/VNOPS/afs_vnop_write.c:1.50.2.13	Wed Mar 18 23:53:42 2009
--- openafs/src/afs/VNOPS/afs_vnop_write.c	Mon May 11 09:29:21 2009
***************
*** 21,27 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.50.2.13 2009/03/19 03:53:42 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 21,27 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.50.2.14 2009/05/11 13:29:21 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 231,242 ****
  #endif
  	AFS_UIO_SETOFFSET(tuiop, offset);
  
! 	code = afs_MemWriteUIO(tdc->f.inode, tuiop);
  	if (code) {
  	    void *mep;		/* XXX in prototype world is struct memCacheEntry * */
  	    error = code;
  	    ZapDCE(tdc);	/* bad data */
! 	    mep = afs_MemCacheOpen(tdc->f.inode);
  	    afs_MemCacheTruncate(mep, 0);
  	    afs_MemCacheClose(mep);
  	    afs_stats_cmperf.cacheCurrDirtyChunks--;
--- 231,242 ----
  #endif
  	AFS_UIO_SETOFFSET(tuiop, offset);
  
! 	code = afs_MemWriteUIO(&tdc->f.inode, tuiop);
  	if (code) {
  	    void *mep;		/* XXX in prototype world is struct memCacheEntry * */
  	    error = code;
  	    ZapDCE(tdc);	/* bad data */
! 	    mep = afs_MemCacheOpen(&tdc->f.inode);
  	    afs_MemCacheTruncate(mep, 0);
  	    afs_MemCacheClose(mep);
  	    afs_stats_cmperf.cacheCurrDirtyChunks--;
***************
*** 425,435 ****
  	    error = EIO;
  	    break;
  	}
! #if defined(LINUX_USE_FH)
! 	tfile = (struct osi_file *)osi_UFSOpen_fh(&tdc->f.fh, tdc->f.fh_type);
! #else
! 	tfile = (struct osi_file *)osi_UFSOpen(tdc->f.inode);
! #endif
  	len = totalLength;	/* write this amount by default */
  	offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk);
  	max = AFS_CHUNKTOSIZE(tdc->f.chunk);	/* max size of this chunk */
--- 425,431 ----
  	    error = EIO;
  	    break;
  	}
! 	tfile = (struct osi_file *)osi_UFSOpen(&tdc->f.inode);
  	len = totalLength;	/* write this amount by default */
  	offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk);
  	max = AFS_CHUNKTOSIZE(tdc->f.chunk);	/* max size of this chunk */
Index: openafs/src/afsd/afs.conf.linux
diff -c openafs/src/afsd/afs.conf.linux:1.10 openafs/src/afsd/afs.conf.linux:1.10.4.1
*** openafs/src/afsd/afs.conf.linux:1.10	Sun Oct  2 23:13:26 2005
--- openafs/src/afsd/afs.conf.linux	Sat May 30 13:56:05 2009
***************
*** 59,64 ****
--- 59,66 ----
  #      -logfile   Place where to put the logfile (default in <cache>/etc/AFSLog.
  #      -waitclose make close calls always synchronous (slows em down, tho)
  #      -files_per_subdir [n]   number of files per cache subdir. (def=2048)
+ #      -rxmaxmtu  Max mtu. Useful when using VPN when packets might fragment.
+ #                 a value of 1244 should work.
  #      -shutdown  Shutdown afs daemons
  # ---------------------------------------------------------------------------
  XXLARGE="-fakestat -stat 4000 -dcache 4000 -daemons 6 -volumes 256"
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.60.2.16 openafs/src/afsd/afsd.c:1.60.2.18
*** openafs/src/afsd/afsd.c:1.60.2.16	Thu Mar 19 22:31:44 2009
--- openafs/src/afsd/afsd.c	Sat May 30 13:56:05 2009
***************
*** 31,36 ****
--- 31,37 ----
    *	-confdir    The configuration directory .
    *	-nosettime  Don't keep checking the time to avoid drift (default).
    *     -settime    Keep checking the time to avoid drift.
+   *	-rxmaxmtu   Set the max mtu to help with VPN issues.
    *	-verbose     Be chatty.
    *	-disable-dynamic-vcaches     Disable the use of -stat value as the starting size of
    *                          the size of the vcache/stat cache pool, 
***************
*** 61,67 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.60.2.16 2009/03/20 02:31:44 shadow Exp $");
  
  #define VFS 1
  
--- 62,68 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.60.2.18 2009/05/30 17:56:05 shadow Exp $");
  
  #define VFS 1
  
***************
*** 327,332 ****
--- 328,334 ----
  int afsd_verbose = 0;		/*Are we being chatty? */
  int afsd_debug = 0;		/*Are we printing debugging info? */
  int afsd_CloseSynch = 0;	/*Are closes synchronous or not? */
+ int rxmaxmtu = 0;       /* Are we forcing a limit on the mtu? */
  
  #ifdef AFS_SGI62_ENV
  #define AFSD_INO_T ino64_t
***************
*** 983,988 ****
--- 985,992 ----
  #ifdef AFS_SGI62_ENV
  	    printf("\tinode=%" AFS_INT64_FMT ", reclen=%d, name='%s'\n", currp->d_ino,
  		   currp->d_reclen, currp->d_name);
+ #elif defined(AFS_DFBSD_ENV)
+ 	    printf("\tinode=%d, name='%s'\n", currp->d_ino, currp->d_name);
  #else
  	    printf("\tinode=%d, reclen=%d, name='%s'\n", currp->d_ino,
  		   currp->d_reclen, currp->d_name);
***************
*** 1770,1775 ****
--- 1774,1785 ----
      printf("afsd: %s dynamically allocated vcaches\n", ( afsd_dynamic_vcaches ? "enabling" : "disabling" ));
  #endif
  
+     /* set -rxmaxmtu */
+     if (as->parms[35].items) {
+         /* -rxmaxmtu */
+         rxmaxmtu = atoi(as->parms[35].items->data);
+     }
+ 
      /*
       * Pull out all the configuration info for the workstation's AFS cache and
       * the cellular community we're willing to let our users see.
***************
*** 2190,2195 ****
--- 2200,2213 ----
  	       fullpn_CellInfoFile);
      call_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile);
  
+     if (rxmaxmtu) {
+     if (afsd_verbose)
+         printf("%s: Setting rxmaxmtu in kernel = %d\n", rn, rxmaxmtu);
+     code = call_syscall(AFSOP_SET_RXMAXMTU, rxmaxmtu);
+     if (code)
+         printf("%s: Error seting rxmaxmtu\n", rn);
+     }
+ 
      if (enable_dynroot) {
  	if (afsd_verbose)
  	    printf("%s: Enabling dynroot support in kernel.\n", rn);
***************
*** 2497,2505 ****
  		"set rx_extraPackets to this value");
      cmd_AddParm(ts, "-splitcache", CMD_SINGLE, CMD_OPTIONAL,
  		"Percentage RW versus RO in cache (specify as 60/40)");
!      cmd_AddParm(ts, "-disable-dynamic-vcaches", CMD_FLAG, CMD_OPTIONAL, 
!         "disable stat/vcache cache growing as needed");
! 
      return (cmd_Dispatch(argc, argv));
  }
  
--- 2515,2524 ----
  		"set rx_extraPackets to this value");
      cmd_AddParm(ts, "-splitcache", CMD_SINGLE, CMD_OPTIONAL,
  		"Percentage RW versus RO in cache (specify as 60/40)");
!     cmd_AddParm(ts, "-disable-dynamic-vcaches", CMD_FLAG, CMD_OPTIONAL, 
! 		"disable stat/vcache cache growing as needed");
!     cmd_AddParm(ts, "-rxmaxmtu", CMD_SINGLE, CMD_OPTIONAL, "set rx max MTU to use");
!     
      return (cmd_Dispatch(argc, argv));
  }
  
Index: openafs/src/auth/NTMakefile
diff -c openafs/src/auth/NTMakefile:1.10.4.5 openafs/src/auth/NTMakefile:1.10.4.6
*** openafs/src/auth/NTMakefile:1.10.4.5	Wed Jul  2 08:49:05 2008
--- openafs/src/auth/NTMakefile	Mon May 25 17:31:24 2009
***************
*** 81,89 ****
  	$(EXELIBDIR)\afs\afsutil.lib \
  	$(EXELIBDIR)\afs\afseventlog.lib \
  	$(EXELIBDIR)\afs\afsreg.lib \
! 	$(EXELIBDIR)\cm_dns.obj \
!         $(EXELIBDIR)\cm_nls.obj
! 
  
  $(SETKEY_EXEFILE): $(SETKEY_EXEOBJS) $(EXELIBS)
  	$(EXECONLINK) dnsapi.lib shell32.lib
--- 81,87 ----
  	$(EXELIBDIR)\afs\afsutil.lib \
  	$(EXELIBDIR)\afs\afseventlog.lib \
  	$(EXELIBDIR)\afs\afsreg.lib \
! 	$(EXELIBDIR)\libafsconf.lib
  
  $(SETKEY_EXEFILE): $(SETKEY_EXEOBJS) $(EXELIBS)
  	$(EXECONLINK) dnsapi.lib shell32.lib
Index: openafs/src/auth/cellconfig.c
diff -c openafs/src/auth/cellconfig.c:1.47.2.17 openafs/src/auth/cellconfig.c:1.47.2.19
*** openafs/src/auth/cellconfig.c:1.47.2.17	Mon Mar 16 09:17:43 2009
--- openafs/src/auth/cellconfig.c	Mon May 25 18:06:38 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/cellconfig.c,v 1.47.2.17 2009/03/16 13:17:43 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/cellconfig.c,v 1.47.2.19 2009/05/25 22:06:38 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
***************
*** 20,25 ****
--- 20,26 ----
  #include "afsincludes.h"
  #include "des/des.h"
  #include "rx/rxkad.h"
+ #include <netdb.h>
  #else /* UKERNEL */
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 61,66 ****
--- 62,69 ----
  #include "keys.h"
  #ifdef AFS_NT40_ENV
  #ifdef AFS_AFSDB_ENV
+ #include <cm.h>
+ #include <cm_config.h>
  /* cm_dns.h depends on cellconfig.h */
  #include <cm_nls.h>
  #include <cm_dns.h>
***************
*** 234,240 ****
  #if     defined(AFS_OSF_ENV) 
      ts = getservbyname(aname, "");
  #else
!     ts = getservbyname(aname, NULL);
  #endif
      if (ts) {
  	/* we found it in /etc/services, so we use this value */
--- 237,243 ----
  #if     defined(AFS_OSF_ENV) 
      ts = getservbyname(aname, "");
  #else
!     ts = (struct servent *) getservbyname(aname, NULL);
  #endif
      if (ts) {
  	/* we found it in /etc/services, so we use this value */
***************
*** 525,530 ****
--- 528,596 ----
  	return GetCellUnix(adir);
      }
  }
+ 
+ /* The following procedures and structs are used on Windows only
+  * to enumerate the Cell information distributed within the 
+  * Windows registry.  (See src/WINNT/afsd/cm_config.c)
+  */
+ typedef struct _cm_enumCellRegistry {
+     afs_uint32 client;  /* non-zero if client query */
+     struct afsconf_dir *adir;
+ } cm_enumCellRegistry_t;
+ 
+ static long
+ cm_serverConfigProc(void *rockp, struct sockaddr_in *addrp, 
+                     char *hostNamep, unsigned short rank)
+ {
+     struct afsconf_cell *cellInfop = (struct afsconf_cell *)rockp;
+ 
+     if (cellInfop->numServers == MAXHOSTSPERCELL)
+         return 0;
+ 
+     cellInfop->hostAddr[cellInfop->numServers] = *addrp;
+     strncpy(cellInfop->hostName[cellInfop->numServers], hostNamep, MAXHOSTCHARS);
+     cellInfop->hostName[cellInfop->numServers][MAXHOSTCHARS-1] = '\0';
+     cellInfop->numServers++;
+ 
+     return 0;
+ }
+ 
+ static long
+ cm_enumCellRegistryProc(void *rockp, char * cellNamep)
+ {
+     long code;
+     cm_enumCellRegistry_t *enump = (cm_enumCellRegistry_t *)rockp;
+     char linkedName[256] = "";
+     int timeout = 0;
+     struct afsconf_entry *newEntry;
+ 
+ 
+     newEntry = malloc(sizeof(struct afsconf_entry));
+     if (newEntry == NULL)
+         return ENOMEM;
+     newEntry->cellInfo.numServers = 0;
+ 
+     code = cm_SearchCellRegistry(enump->client, cellNamep, NULL, linkedName, cm_serverConfigProc, &newEntry->cellInfo);
+     if (code == CM_ERROR_FORCE_DNS_LOOKUP)
+         code = cm_SearchCellByDNS(cellNamep, NULL, &timeout, cm_serverConfigProc, &newEntry->cellInfo);
+ 
+     if (code == 0) {
+         strncpy(newEntry->cellInfo.name, cellNamep, MAXCELLCHARS);
+         newEntry->cellInfo.name[MAXCELLCHARS-1];
+         if (linkedName[0])
+             newEntry->cellInfo.linkedCell = strdup(linkedName);
+         else
+             newEntry->cellInfo.linkedCell = NULL;
+         newEntry->cellInfo.timeout = timeout;
+         newEntry->cellInfo.flags = 0;
+ 
+         newEntry->next = enump->adir->entries;
+ 	enump->adir->entries = newEntry;
+     } else {
+         free(newEntry);
+     }
+     return code;
+ }       
  #endif /* AFS_NT40_ENV */
  
  
***************
*** 540,549 ****
--- 606,619 ----
      afs_int32 i;
      char tbuffer[256], tbuf1[256];
      struct stat tstat;
+ #ifdef AFS_NT40_ENV
+     cm_enumCellRegistry_t enumCellRegistry = {0, 0};
+ #endif /* AFS_NT40_ENV */
  
      /* figure out the local cell name */
  #ifdef AFS_NT40_ENV
      i = GetCellNT(adir);
+     enumCellRegistry.adir = adir;
  #else
      i = GetCellUnix(adir);
  #endif
***************
*** 564,569 ****
--- 634,642 ----
      if (IsClientConfigDirectory(adir->name)) {
  	/* NT client config dir */
  	char *p;
+ 
+         enumCellRegistry.client = 1;
+ 
  	if (!afssw_GetClientCellServDBDir(&p)) {
  	    strcompose(tbuffer, sizeof(tbuffer), p, "/",
  		       AFSDIR_CELLSERVDB_FILE_NTCLIENT, NULL);
***************
*** 599,604 ****
--- 672,690 ----
      if (!tf) {
  	return -1;
      }
+ 
+     /* The CellServDB file is now open.  
+      * The following code parses the contents of the 
+      * file and creates a list with the first cell entry
+      * in the CellServDB file at the end of the list.
+      * 
+      * No checking is performed for duplicates.
+      * The side effects of this process are that duplicate
+      * entries appended to the end of the CellServDB file
+      * take precedence and are found in a shorter period 
+      * of time.
+      */
+ 
      while (1) {
  	tp = fgets(tbuffer, sizeof(tbuffer), tf);
  	if (!tp)
***************
*** 674,679 ****
--- 760,777 ----
  	adir->entries = curEntry;
      }
  
+ #ifdef AFS_NT40_ENV
+      /* 
+       * Windows maintains a CellServDB list in the Registry
+       * that supercedes the contents of the CellServDB file.
+       * Prepending these entries to the head of the list 
+       * is sufficient to enforce the precedence.
+       */
+      cm_EnumerateCellRegistry( enumCellRegistry.client,
+                                cm_enumCellRegistryProc,
+                                &enumCellRegistry);
+ #endif /* AFS_NT40_ENV */
+ 
      /* Read in the alias list */
      strcompose(tbuffer, 256, adir->name, "/", AFSDIR_CELLALIAS_FILE, NULL);
  
***************
*** 993,1005 ****
      struct afsconf_entry DNSce;
      afs_int32 cellHostAddrs[AFSMAXCELLHOSTS];
      char cellHostNames[AFSMAXCELLHOSTS][MAXHOSTCHARS];
      int numServers;
      int rc;
      int ttl;
  
      DNSce.cellInfo.numServers = 0;
      DNSce.next = NULL;
!     rc = getAFSServer(acellName, cellHostAddrs, cellHostNames, &numServers,
  		      &ttl);
      /* ignore the ttl here since this code is only called by transitory programs
       * like klog, etc. */
--- 1091,1104 ----
      struct afsconf_entry DNSce;
      afs_int32 cellHostAddrs[AFSMAXCELLHOSTS];
      char cellHostNames[AFSMAXCELLHOSTS][MAXHOSTCHARS];
+     unsigned short ipRanks[AFSMAXCELLHOSTS];
      int numServers;
      int rc;
      int ttl;
  
      DNSce.cellInfo.numServers = 0;
      DNSce.next = NULL;
!     rc = getAFSServer(acellName, cellHostAddrs, cellHostNames, ipRanks, &numServers,
  		      &ttl);
      /* ignore the ttl here since this code is only called by transitory programs
       * like klog, etc. */
Index: openafs/src/bozo/NTMakefile
diff -c openafs/src/bozo/NTMakefile:1.10.4.4 openafs/src/bozo/NTMakefile:1.10.4.5
*** openafs/src/bozo/NTMakefile:1.10.4.4	Wed Jul  2 08:49:07 2008
--- openafs/src/bozo/NTMakefile	Mon May 25 17:31:24 2009
***************
*** 67,74 ****
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  
  $(BOSSERVER_EXEFILE): $(BOSSERVER_EXEOBJS) $(BOSSERVER_EXELIBS)
  	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
--- 67,73 ----
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  $(BOSSERVER_EXEFILE): $(BOSSERVER_EXEOBJS) $(BOSSERVER_EXELIBS)
  	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
***************
*** 104,111 ****
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
! 	$(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  
  
  $(RS_BOS_EXEFILE): $(BOS_EXEOBJS) $(BOS_EXELIBS)
--- 103,109 ----
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  
  $(RS_BOS_EXEFILE): $(BOS_EXEOBJS) $(BOS_EXELIBS)
Index: openafs/src/bucoord/NTMakefile
diff -c openafs/src/bucoord/NTMakefile:1.13.4.4 openafs/src/bucoord/NTMakefile:1.13.4.5
*** openafs/src/bucoord/NTMakefile:1.13.4.4	Wed Jul  2 08:49:09 2008
--- openafs/src/bucoord/NTMakefile	Mon May 25 17:31:24 2009
***************
*** 88,95 ****
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
!         $(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  	
  
  $(EXEFILE): $(EXEOBJS) $(EXERES) $(EXELIBS)
--- 88,94 ----
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  	
  
  $(EXEFILE): $(EXEOBJS) $(EXERES) $(EXELIBS)
Index: openafs/src/bucoord/bc.p.h
diff -c openafs/src/bucoord/bc.p.h:1.3.14.5 openafs/src/bucoord/bc.p.h:1.3.14.6
*** openafs/src/bucoord/bc.p.h:1.3.14.5	Mon Mar 16 09:32:14 2009
--- openafs/src/bucoord/bc.p.h	Mon Apr 27 15:17:27 2009
***************
*** 144,147 ****
  #define	BC_MAXSIMDUMPS	    64
  #define BC_MAXPORTS	    128	/* max number of port offsets for volrestore */
  /* debugging support */
! #define	dprintf(x)
--- 144,147 ----
  #define	BC_MAXSIMDUMPS	    64
  #define BC_MAXPORTS	    128	/* max number of port offsets for volrestore */
  /* debugging support */
! #define	afs_dprintf(x)
Index: openafs/src/bucoord/ubik_db_if.c
diff -c openafs/src/bucoord/ubik_db_if.c:1.10.14.7 openafs/src/bucoord/ubik_db_if.c:1.10.14.8
*** openafs/src/bucoord/ubik_db_if.c:1.10.14.7	Fri Mar 27 09:46:01 2009
--- openafs/src/bucoord/ubik_db_if.c	Mon Apr 27 15:17:27 2009
***************
*** 13,19 ****
  #include <afs/stds.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bucoord/ubik_db_if.c,v 1.10.14.7 2009/03/27 13:46:01 shadow Exp $");
  
  #include <sys/types.h>
  #include <fcntl.h>
--- 13,19 ----
  #include <afs/stds.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bucoord/ubik_db_if.c,v 1.10.14.8 2009/04/27 19:17:27 shadow Exp $");
  
  #include <sys/types.h>
  #include <fcntl.h>
***************
*** 574,580 ****
  
      fileSize = (afs_int32) filesize(ctPtr->textStream);
  
!     dprintf(("filesize is %d\n", fileSize));
  
      rewind(ctPtr->textStream);
  
--- 574,580 ----
  
      fileSize = (afs_int32) filesize(ctPtr->textStream);
  
!     afs_dprintf(("filesize is %d\n", fileSize));
  
      rewind(ctPtr->textStream);
  
***************
*** 1350,1356 ****
  	ERROR(errno);
  #endif
  
!     dprintf(("file is %s\n", tmpFileName));
  
    normal_exit:
      return code;
--- 1350,1356 ----
  	ERROR(errno);
  #endif
  
!     afs_dprintf(("file is %s\n", tmpFileName));
  
    normal_exit:
      return code;
Index: openafs/src/budb/NTMakefile
diff -c openafs/src/budb/NTMakefile:1.10.4.4 openafs/src/budb/NTMakefile:1.10.4.5
*** openafs/src/budb/NTMakefile:1.10.4.4	Wed Jul  2 08:49:11 2008
--- openafs/src/budb/NTMakefile	Mon May 25 17:31:25 2009
***************
*** 77,85 ****
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
! 
  
  $(EXEFILE): $(EXEOBJS)  $(EXELIBS)
  	$(EXECONLINK) dnsapi.lib iphlpapi.lib shell32.lib
--- 77,83 ----
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  $(EXEFILE): $(EXEOBJS)  $(EXELIBS)
  	$(EXECONLINK) dnsapi.lib iphlpapi.lib shell32.lib
Index: openafs/src/butc/NTMakefile
diff -c openafs/src/butc/NTMakefile:1.10.4.4 openafs/src/butc/NTMakefile:1.10.4.5
*** openafs/src/butc/NTMakefile:1.10.4.4	Wed Jul  2 08:49:11 2008
--- openafs/src/butc/NTMakefile	Mon May 25 17:31:26 2009
***************
*** 53,60 ****
  	$(DESTDIR)\lib\afs\afspioctl.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  
  $(EXERES): butc.rc AFS_component_version_number.h
  
--- 53,59 ----
  	$(DESTDIR)\lib\afs\afspioctl.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  $(EXERES): butc.rc AFS_component_version_number.h
  
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.29.2.56 openafs/src/cf/linux-test4.m4:1.29.2.59
*** openafs/src/cf/linux-test4.m4:1.29.2.56	Sat Apr  4 12:44:02 2009
--- openafs/src/cf/linux-test4.m4	Tue May 26 20:47:53 2009
***************
*** 486,492 ****
        ac_cv_linux_kernel_posix_lock_file_wait_arg=no)])
    AC_MSG_RESULT($ac_cv_linux_kernel_posix_lock_file_wait_arg)])
  
- 
  AC_DEFUN([LINUX_KERNEL_SOCK_CREATE], [
    AC_MSG_CHECKING([for 5th argument in sock_create found in some SELinux kernels])
    AC_CACHE_VAL([ac_cv_linux_kernel_sock_create_v], [
--- 486,491 ----
***************
*** 1215,1217 ****
--- 1214,1247 ----
    if test "x$ac_cv_linux_struct_proc_dir_entry_has_owner" = "xyes"; then
      AC_DEFINE([STRUCT_PROC_DIR_ENTRY_HAS_OWNER], 1, [define if struct proc_dir_entry has an owner member])
    fi])
+ 
+ AC_DEFUN([LINUX_POSIX_TEST_LOCK_RETURNS_CONFLICT], [
+   AC_MSG_CHECKING([if posix_test_lock returns a struct file_lock])
+   AC_CACHE_VAL([ac_cv_linux_posix_test_lock_returns_conflict], [
+     AC_TRY_KBUILD(
+ [#include <linux/fs.h>],
+ [struct file_lock *lock;
+  struct file * file;
+ lock = posix_test_lock(file, lock);],
+       ac_cv_linux_posix_test_lock_returns_conflict=yes,
+       ac_cv_linux_posix_test_lock_returns_conflict=no)])
+   AC_MSG_RESULT($ac_cv_linux_posix_test_lock_returns_conflict)
+   if test "x$ac_cv_linux_posix_test_lock_returns_conflict" = "xyes"; then
+     AC_DEFINE([POSIX_TEST_LOCK_RETURNS_CONFLICT], 1, [define if posix_test_lock returns the conflicting lock])
+   fi])
+ 
+ AC_DEFUN([LINUX_POSIX_TEST_LOCK_CONFLICT_ARG], [
+   AC_MSG_CHECKING([if posix_test_lock takes a conflict argument])
+   AC_CACHE_VAL([ac_cv_linux_posix_test_lock_conflict_arg], [
+     AC_TRY_KBUILD(
+ [#include <linux/fs.h>],
+ [ struct file_lock *lock;
+   struct file *file;
+   posix_test_lock(file, lock, lock);],
+       ac_cv_linux_posix_test_lock_conflict_arg=yes,
+       ac_cv_lonuc_posix_test_lock_conflict_arg=no)])
+   AC_MSG_RESULT($ac_cv_linux_posix_test_lock_conflict_arg)
+   if test "x$ac_cv_linux_posix_test_lock_conflict_arg" = "xyes"; then
+     AC_DEFINE([POSIX_TEST_LOCK_CONFLICT_ARG], 1, [define if posix_test_lock takes a conflict argument])
+   fi])
+ 
Index: openafs/src/cf/osconf.m4
diff -c openafs/src/cf/osconf.m4:1.83.2.16 openafs/src/cf/osconf.m4:1.83.2.17
*** openafs/src/cf/osconf.m4:1.83.2.16	Tue Feb 10 17:40:13 2009
--- openafs/src/cf/osconf.m4	Mon Apr 27 14:31:55 2009
***************
*** 254,259 ****
--- 254,272 ----
  		YACC="byacc"
  		;;
  
+ 	i386_dfbsd_*)
+ 		LEX="flex -l"
+ 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
+ 		MT_LIBS="-pthread"
+ 		PAM_OPTMZ=-O2
+ 		PAM_CFLAGS="-pipe -fPIC"
+ 		SHLIB_LDFLAGS="-shared -Xlinker -x"
+ 		SHLIB_LINKER="${MT_CC} -shared"
+ 		TXLIBS="-lncurses"
+ 		XCFLAGS="-pipe"
+ 		YACC="byacc"
+ 		;;
+ 
  	amd64_fbsd_*)
  		LEX="flex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
Index: openafs/src/config/Makefile.component
diff -c /dev/null openafs/src/config/Makefile.component:1.1.2.2
*** /dev/null	Sat May 30 21:40:47 2009
--- openafs/src/config/Makefile.component	Wed May 27 15:44:52 2009
***************
*** 0 ****
--- 1,2 ----
+ include Makefile.config
+ include Makefile.version
Index: openafs/src/config/Makefile.config.in
diff -c openafs/src/config/Makefile.config.in:1.12.2.6 openafs/src/config/Makefile.config.in:1.12.2.7
*** openafs/src/config/Makefile.config.in:1.12.2.6	Tue Feb 10 17:40:18 2009
--- openafs/src/config/Makefile.config.in	Wed May 27 15:44:52 2009
***************
*** 140,142 ****
--- 140,145 ----
  
  .c.o:
  	$(CCOBJ) $(CFLAGS) -c $<
+ 
+ # Default component version file, will be overridden later if necessary
+ VERSFILE=@VERSFILE@
\ No newline at end of file
Index: openafs/src/config/Makefile.in
diff -c openafs/src/config/Makefile.in:1.15.2.3 openafs/src/config/Makefile.in:1.15.2.4
*** openafs/src/config/Makefile.in:1.15.2.3	Fri Feb  9 13:43:12 2007
--- openafs/src/config/Makefile.in	Wed May 27 15:44:52 2009
***************
*** 23,29 ****
  
  Makefile.version: ${srcdir}/Makefile.version-CML Makefile.version-NOCML
  	$(RM) -f Makefile.version
! 	if	[ -r SRC/../CML/state ] ; \
  	then	$(CP) ${srcdir}/Makefile.version-CML Makefile.version ; \
  	else	$(CP) Makefile.version-NOCML Makefile.version ; \
  	fi
--- 23,29 ----
  
  Makefile.version: ${srcdir}/Makefile.version-CML Makefile.version-NOCML
  	$(RM) -f Makefile.version
! 	if	[ -r @TOP_SRCDIR@/CML/state ] ; \
  	then	$(CP) ${srcdir}/Makefile.version-CML Makefile.version ; \
  	else	$(CP) Makefile.version-NOCML Makefile.version ; \
  	fi
***************
*** 32,38 ****
  # AFS component version string file generation targets
  #
  AFS_component_version_number.c: Makefile.version
! 	$(MAKE) -f Makefile.version AFS_component_version_number.c
  
  #
  # App build/install targets
--- 32,38 ----
  # AFS component version string file generation targets
  #
  AFS_component_version_number.c: Makefile.version
! 	$(MAKE) -f Makefile.component AFS_component_version_number.c
  
  #
  # App build/install targets
Index: openafs/src/config/Makefile.version-CML
diff -c openafs/src/config/Makefile.version-CML:1.3 openafs/src/config/Makefile.version-CML:removed
*** openafs/src/config/Makefile.version-CML:1.3	Fri Sep  7 19:34:53 2001
--- openafs/src/config/Makefile.version-CML	Sat May 30 21:40:47 2009
***************
*** 1,25 ****
- # 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
- 
- VERSFILE=AFS_component_version_number
- 
- $(VERSFILE).o: $(VERSFILE).c
- 
- # mkvers checks timestamps
- 
- $(VERSFILE).c:
- 	$(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).c
- # only done for RX in NT
- #	-c $(CML_PREFIX)
- 
- $(VERSFILE).h:
- 	$(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).h -v
- 
- $(VERSFILE).txt:
- 	$(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).txt -t
- 
- noversion: install
--- 0 ----
Index: openafs/src/config/Makefile.version-CML.in
diff -c /dev/null openafs/src/config/Makefile.version-CML.in:1.1.2.2
*** /dev/null	Sat May 30 21:40:48 2009
--- openafs/src/config/Makefile.version-CML.in	Wed May 27 15:44:52 2009
***************
*** 0 ****
--- 1,29 ----
+ # 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
+ 
+ PACKAGE=@PACKAGE@
+ VERSION=@VERSION@
+ 
+ $(VERSFILE).o: $(VERSFILE).c
+ 
+ # mkvers checks timestamps
+ 
+ $(VERSFILE).c:
+ 	$(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).c
+ # only done for RX in NT
+ #	-c $(CML_PREFIX)
+ 
+ $(VERSFILE).h:
+ 	$(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).h -v
+ 
+ $(VERSFILE).txt:
+ 	$(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).txt -t
+ 
+ $(VERSFILE).xml:
+ 	$(TOP_SRCDIR)/config/mkvers -o $(VERSFILE).xml -x
+ 
+ noversion: install
Index: openafs/src/config/Makefile.version-NOCML.in
diff -c openafs/src/config/Makefile.version-NOCML.in:1.5.14.1 openafs/src/config/Makefile.version-NOCML.in:1.5.14.3
*** openafs/src/config/Makefile.version-NOCML.in:1.5.14.1	Wed Oct 11 09:18:10 2006
--- openafs/src/config/Makefile.version-NOCML.in	Wed May 27 15:44:52 2009
***************
*** 8,16 ****
  PACKAGE=@PACKAGE@
  VERSION=@VERSION@
  
! AFS_component_version_number.o: AFS_component_version_number.c
  
! AFS_component_version_number.c: @TOP_OBJDIR@/src/config/Makefile.version
! 	echo 'char cml_version_number[]="@(#) OpenAFS ${VERSION} built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c
! 	echo 'char* AFSVersion = "${PACKAGE} ${VERSION}"; ' >>AFS_component_version_number.c
  
--- 8,21 ----
  PACKAGE=@PACKAGE@
  VERSION=@VERSION@
  
! $(VERSFILE).o: $(VERSFILE).c
  
! $(VERSFILE).c: @TOP_OBJDIR@/src/config/Makefile.version
! 	echo 'char cml_version_number[]="@(#) OpenAFS ${VERSION} built ' `date +"%Y-%m-%d"` '";' >$(VERSFILE).c
! 	echo 'char* AFSVersion = "${PACKAGE} ${VERSION}"; ' >>$(VERSFILE).c
  
+ $(VERSFILE).xml:
+ 	echo '<?xml version="1.0" encoding="UTF-8"?>' >$(VERSFILE).xml
+ 	echo '<revision>' >>$(VERSFILE).xml
+ 	echo '<revnumber>${VERSION}</revnumber>' >>$(VERSFILE).xml
+ 	echo '</revision>' >>$(VERSFILE).xml
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.24.2.54 openafs/src/config/NTMakefile.amd64_w2k:1.24.2.56
*** openafs/src/config/NTMakefile.amd64_w2k:1.24.2.54	Mon Apr  6 13:17:32 2009
--- openafs/src/config/NTMakefile.amd64_w2k	Sat May 30 20:58:39 2009
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=5900
  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=6000
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
***************
*** 477,479 ****
--- 477,489 ----
  LEX = flex -l
  YACC = bison
  
+ ######### Create Cygwin .a files
+ # This macro should be invoked as a build step for a DLL target.
+ !IFNDEF NOCYGWIN
+ MAKECYGLIB=\
+ 	for %%C in (as.exe) do \
+ 	if exist %%~$$PATH:C \
+ 	dlltool --dllname $(@B).dll --output-lib $(@R).a --temp-prefix $(OUT) -S %%~$$PATH:C
+ !ELSE
+ MAKECYGLIB=echo Skipping Cygwin archive
+ !ENDIF
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.84.2.52 openafs/src/config/NTMakefile.i386_nt40:1.84.2.54
*** openafs/src/config/NTMakefile.i386_nt40:1.84.2.52	Mon Apr  6 13:17:32 2009
--- openafs/src/config/NTMakefile.i386_nt40	Sat May 30 20:58:39 2009
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=5900
  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=6000
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
***************
*** 455,457 ****
--- 455,467 ----
  LEX = flex -l
  YACC = bison
  
+ ######### Create Cygwin .a files
+ # This macro should be invoked as a build step for a DLL target.
+ !IFNDEF NOCYGWIN
+ MAKECYGLIB=\
+ 	for %%C in (as.exe) do \
+ 	if exist %%~$$PATH:C \
+ 	dlltool --dllname $(@B).dll --output-lib $(@R).a --temp-prefix $(OUT) -S %%~$$PATH:C
+ !ELSE
+ MAKECYGLIB=echo Skipping Cygwin archive
+ !ENDIF
Index: openafs/src/config/NTMakefile.i386_w2k
diff -c openafs/src/config/NTMakefile.i386_w2k:1.23.2.56 openafs/src/config/NTMakefile.i386_w2k:1.23.2.58
*** openafs/src/config/NTMakefile.i386_w2k:1.23.2.56	Mon Apr  6 13:17:32 2009
--- openafs/src/config/NTMakefile.i386_w2k	Sat May 30 20:58:39 2009
***************
*** 88,94 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=5900
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 88,94 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=6000
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
***************
*** 481,483 ****
--- 481,494 ----
  LEX = flex -l
  YACC = bison
  
+ 
+ ######### Create Cygwin .a files
+ # This macro should be invoked as a build step for a DLL target.
+ !IFNDEF NOCYGWIN
+ MAKECYGLIB=\
+ 	for %%C in (as.exe) do \
+ 	if exist %%~$$PATH:C \
+ 	dlltool --dllname $(@B).dll --output-lib $(@R).a --temp-prefix $(OUT) -S %%~$$PATH:C
+ !ELSE
+ MAKECYGLIB=echo Skipping Cygwin archive
+ !ENDIF
Index: openafs/src/config/NTMakefile.version-CML
diff -c openafs/src/config/NTMakefile.version-CML:1.2 openafs/src/config/NTMakefile.version-CML:1.2.32.1
*** openafs/src/config/NTMakefile.version-CML:1.2	Sat Nov  4 05:04:21 2000
--- openafs/src/config/NTMakefile.version-CML	Thu May 21 13:26:03 2009
***************
*** 27,29 ****
--- 27,32 ----
  
  $(VERSFILE).txt:
  	$(DESTDIR)\bin\mkvers -o $(VERSFILE).txt -t
+ 
+ $(VERSFILE).xml:
+ 	$(DESTDIR)\bin\mkvers -o $(VERSFILE).xml -x
Index: openafs/src/config/NTMakefile.version-NOCML
diff -c openafs/src/config/NTMakefile.version-NOCML:1.4.14.1 openafs/src/config/NTMakefile.version-NOCML:1.4.14.3
*** openafs/src/config/NTMakefile.version-NOCML:1.4.14.1	Wed Jul  2 19:01:50 2008
--- openafs/src/config/NTMakefile.version-NOCML	Mon May 25 15:57:53 2009
***************
*** 24,26 ****
--- 24,34 ----
  
  $(VERSFILE).txt:
  	echo OpenAFS_$(AFSPRODUCT_VERSION)>$(VERSFILE).txt
+ 
+ $(VERSFILE).xml:
+         echo <<$(VERSFILE).xml > NUL
+ <?xml version="1.0" encoding="UTF-8"?>
+ <revision>
+ <revnumber>$(AFSPRODUCT_VERSION)</revnumber>
+ </revision>
+ <<KEEP
Index: openafs/src/config/afs_args.h
diff -c openafs/src/config/afs_args.h:1.20.4.3 openafs/src/config/afs_args.h:1.20.4.4
*** openafs/src/config/afs_args.h:1.20.4.3	Thu Mar 19 22:31:44 2009
--- openafs/src/config/afs_args.h	Sat May 30 13:56:05 2009
***************
*** 46,53 ****
  #define	AFSOP_SET_THISCELL	 35	/* set the primary cell */
  #define AFSOP_BASIC_INIT	 36	/* used to be part of START_AFS */
  #define AFSOP_SET_BACKUPTREE	 37	/* enable backup tree support */
! #define AFSOP_SET_RXPCK		 38	/*set rx_extraPackets*/
  #define AFSOP_BUCKETPCT          39     /* bucket percentage */
  
  /* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
  #define	AFSCALL_PIOCTL		20
--- 46,54 ----
  #define	AFSOP_SET_THISCELL	 35	/* set the primary cell */
  #define AFSOP_BASIC_INIT	 36	/* used to be part of START_AFS */
  #define AFSOP_SET_BACKUPTREE	 37	/* enable backup tree support */
! #define AFSOP_SET_RXPCK		 38	/* set rx_extraPackets*/
  #define AFSOP_BUCKETPCT          39     /* bucket percentage */
+ #define AFSOP_SET_RXMAXMTU       40     /* set rx_MyMaxSendSize,rx_maxReceiveSizeUser,rx_maxReceiveSize */  
  
  /* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
  #define	AFSCALL_PIOCTL		20
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.77.2.9 openafs/src/config/afs_sysnames.h:1.77.2.11
*** openafs/src/config/afs_sysnames.h:1.77.2.9	Thu Jan 22 16:29:09 2009
--- openafs/src/config/afs_sysnames.h	Tue May 12 09:03:00 2009
***************
*** 249,254 ****
--- 249,255 ----
  #define SYS_NAME_ID_i386_obsd42         2611
  #define SYS_NAME_ID_i386_obsd43         2612
  #define SYS_NAME_ID_i386_obsd44         2613
+ #define SYS_NAME_ID_i386_obsd45         2614
  
  #define SYS_NAME_ID_amd64_linux2        2700
  #define SYS_NAME_ID_amd64_linux22       2701
***************
*** 279,284 ****
--- 280,288 ----
  #define SYS_NAME_ID_arm_linux24         3802
  #define SYS_NAME_ID_arm_linux26         3803
  
+ #define SYS_NAME_ID_i386_dfbsd_22        3900
+ #define SYS_NAME_ID_i386_dfbsd_23        3901
+ 
  /*
   * Placeholder to keep system-wide standard flags since this file is included by all 
   * files (i.e in afs/param.h)
Index: openafs/src/config/debug.h
diff -c openafs/src/config/debug.h:1.4 openafs/src/config/debug.h:1.4.14.1
*** openafs/src/config/debug.h:1.4	Tue Jul 15 19:14:55 2003
--- openafs/src/config/debug.h	Mon Apr 27 15:17:25 2009
***************
*** 112,132 ****
  
  #if defined(AFS_DEBUG)
  #if defined(lint)
! #define dprintf(flag, str) printf str
  #define dlprintf(flag, level, str) printf str
  #define dmprintf(flag, bit, str) printf str
  #else /* lint */
! #define dprintf(flag, str) \
        (void)((flag) ? \
  	     ( osi_dp str, osi_dp("\t%s, %d\n", __FILE__, __LINE__)):0)
! #define dlprintf(flag, level, str) dprintf(((flag) >= (level)), str)
! #define dmprintf(flag, bit, str) dprintf(((flag)&(1<<((bit)-1))), str)
  
  #endif /* lint */
  
  #else /* AFS_DEBUG */
  
! #define dprintf(flag, str)
  #define dlprintf(flag, level,str)
  #define dmprintf(flag, bit, str)
  
--- 112,132 ----
  
  #if defined(AFS_DEBUG)
  #if defined(lint)
! #define afs_dprintf(flag, str) printf str
  #define dlprintf(flag, level, str) printf str
  #define dmprintf(flag, bit, str) printf str
  #else /* lint */
! #define afs_dprintf(flag, str) \
        (void)((flag) ? \
  	     ( osi_dp str, osi_dp("\t%s, %d\n", __FILE__, __LINE__)):0)
! #define dlprintf(flag, level, str) afs_dprintf(((flag) >= (level)), str)
! #define dmprintf(flag, bit, str) afs_dprintf(((flag)&(1<<((bit)-1))), str)
  
  #endif /* lint */
  
  #else /* AFS_DEBUG */
  
! #define afs_dprintf(flag, str)
  #define dlprintf(flag, level,str)
  #define dmprintf(flag, bit, str)
  
Index: openafs/src/config/mkvers.c
diff -c openafs/src/config/mkvers.c:1.11 openafs/src/config/mkvers.c:1.11.14.1
*** openafs/src/config/mkvers.c:1.11	Sun Dec  7 17:49:24 2003
--- openafs/src/config/mkvers.c	Thu May 21 13:26:03 2009
***************
*** 58,64 ****
  enum {
      CF_DEFAULT,
      CF_VERINFO,
!     CF_TEXT
  } cfgFormat = CF_DEFAULT;
  
  char *programName;
--- 58,65 ----
  enum {
      CF_DEFAULT,
      CF_VERINFO,
!     CF_TEXT,
!     CF_XML
  } cfgFormat = CF_DEFAULT;
  
  char *programName;
***************
*** 69,75 ****
  Usage(void)
  {
      printf
! 	("Usage: %s [-d directory] [-o output file name] [-c component] [-v | -t]\n",
  	 programName);
      printf("%s creates the AFS_component_version_number.c file.\n",
  	   programName);
--- 70,76 ----
  Usage(void)
  {
      printf
! 	("Usage: %s [-d directory] [-o output file name] [-c component] [-v | -t | -x]\n",
  	 programName);
      printf("%s creates the AFS_component_version_number.c file.\n",
  	   programName);
***************
*** 81,86 ****
--- 82,88 ----
  	("-c component - if not \"afs\" prefix for cml_version_number variable.\n");
      printf("-v generate NT versioninfo style declarations.\n");
      printf("-t generate text file style information.\n");
+     printf("-x generate XML revision information.\n");
      exit(1);
  }
  
***************
*** 148,153 ****
--- 150,162 ----
  		printf("Specify only one alternative output format\n");
  		Usage();
  	    }
+ 	} else if (!strcmp("-x", argv[i])) {
+ 	    if (cfgFormat == CF_DEFAULT || cfgFormat == CF_XML) {
+ 		cfgFormat = CF_XML;
+ 	    } else {
+ 		printf("Specify only one alternative output format\n");
+ 		Usage();
+ 	    }
  	} else {
  	    printf("%s: Unknown argument.\n", argv[i]);
  	    Usage();
***************
*** 162,167 ****
--- 171,178 ----
  	    strcat(outputFileBuf, ".h");
  	} else if (cfgFormat == CF_TEXT) {
  	    strcat(outputFileBuf, ".txt");
+ 	} else if (cfgFormat == CF_XML) {
+ 	    strcat(outputFileBuf, ".xml");
  	} else {
  	    strcat(outputFileBuf, ".c");
  	}
***************
*** 172,178 ****
  
      if ((code = stat(outputFile, &sbuf)) < 0) {
  	reBuild = 1;
! 	versTime = (time_t) 0;	/* inidicates no output file. */
      } else {
  	versTime = sbuf.st_mtime;
      }
--- 183,189 ----
  
      if ((code = stat(outputFile, &sbuf)) < 0) {
  	reBuild = 1;
! 	versTime = (time_t) 0;	/* indicates no output file. */
      } else {
  	versTime = sbuf.st_mtime;
      }
***************
*** 289,294 ****
--- 300,313 ----
  	    } else if (cfgFormat == CF_TEXT) {
  		fprintf(fpVers, "Base configuration %s\n",
  			stateDeltas[i].name);
+ 	    } else if (cfgFormat == CF_TEXT) {
+                 fprintf(fpVers, 
+                         "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+                         "<revision>\n"
+                         "<revnumber>\n"
+                         "Base configuration %s\n"
+                         "</revnumber>\n",
+ 			stateDeltas[i].name);
  	    } else {
  		fprintf(fpVers, "%sBase configuration %s", cml_string,
  			stateDeltas[i].name);
***************
*** 307,312 ****
--- 326,338 ----
  	    if (cfgFormat == CF_TEXT) {
  		fprintf(fpVers, "%c%s\n", stateDeltas[i].type,
  			stateDeltas[i].name);
+ 	    } else if (cfgFormat == CF_XML) {
+ 		fprintf(fpVers, 
+                         "<revremark>\n"
+                         ";%c%s"
+                          "</revremark>\n",
+                         stateDeltas[i].type,
+ 			stateDeltas[i].name);
  	    } else {
  		fprintf(fpVers, ";%c%s", stateDeltas[i].type,
  			stateDeltas[i].name);
***************
*** 323,328 ****
--- 349,361 ----
  	    if (cfgFormat == CF_TEXT) {
  		fprintf(fpVers, "%c%s\n", stateDeltas[i].type,
  			stateDeltas[i].name);
+ 	    } else if (cfgFormat == CF_XML) {
+ 		fprintf(fpVers, 
+                         "<revremark>\n"
+                         ";%c%s"
+                          "</revremark>\n",
+                         stateDeltas[i].type,
+ 			stateDeltas[i].name);
  	    } else {
  		fprintf(fpVers, ";%c%s", stateDeltas[i].type,
  			stateDeltas[i].name);
***************
*** 345,349 ****
--- 378,384 ----
  	if (s)
  	    *s = '\0';
  	fprintf(fpVers, "%s%s\";\n", AFS_STRING, c ? c : "Unknown");
+     } else if (cfgFormat == CF_XML) {
+         fprintf(fpVers, "</revision>\n");
      }
  }
Index: openafs/src/config/param.i386_dfbsd_23.h
diff -c /dev/null openafs/src/config/param.i386_dfbsd_23.h:1.1.2.2
*** /dev/null	Sat May 30 21:40:48 2009
--- openafs/src/config/param.i386_dfbsd_23.h	Mon Apr 27 14:31:55 2009
***************
*** 0 ****
--- 1,179 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"i386_dfbsd_23"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_dfbsd_23
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_DFBSD_ENV 1
+ #define AFS_DFBSD22_ENV 1
+ #define AFS_DFBSD23_ENV 1
+ #define AFS_X86_DFBSD_ENV 1
+ #define AFS_X86_DFBSD22_ENV 1
+ #define AFS_X86_DFBSD23_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_DFBSD22_ENV	1
+ #define AFS_USR_DFBSD23_ENV	1
+ #define AFS_USR_DFBSD_ENV	1
+ #define AFS_NONFSTRANS          1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.i386_obsd44.h
diff -c /dev/null openafs/src/config/param.i386_obsd44.h:1.1.2.2
*** /dev/null	Sat May 30 21:40:48 2009
--- openafs/src/config/param.i386_obsd44.h	Tue May 12 09:03:00 2009
***************
*** 0 ****
--- 1,72 ----
+ /*
+  * Jim Rees, University of Michigan CITI
+  */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define SYS_NAME		"i386_obsd44"
+ #define SYS_NAME_ID		SYS_NAME_ID_i386_obsd44
+ 
+ #define AFS_XBSD_ENV		1	/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV	1
+ 
+ #define AFS_NAMEI_ENV		1	/* User space interface to file system */
+ #define AFS_64BIT_ENV		1
+ #define AFS_64BIT_CLIENT	1
+ #define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
+ #define AFS_OBSD_ENV		1
+ #define AFS_OBSD34_ENV		1
+ #define AFS_OBSD35_ENV		1
+ #define AFS_OBSD36_ENV		1
+ #define AFS_OBSD37_ENV		1
+ #define AFS_OBSD38_ENV		1
+ #define AFS_OBSD39_ENV		1
+ #define AFS_OBSD40_ENV		1
+ #define AFS_OBSD41_ENV		1
+ #define AFS_OBSD42_ENV		1
+ #define AFS_OBSD43_ENV		1
+ #define AFS_OBSD44_ENV		1
+ #define AFS_NONFSTRANS		1
+ #define AFS_VM_RDWR_ENV		1
+ #define AFS_VFS_ENV		1
+ #define AFS_VFSINCL_ENV		1
+ 
+ #define FTRUNC O_TRUNC
+ 
+ #define AFS_SYSCALL		208
+ #define AFS_MOUNT_AFS		"afs"
+ 
+ #define RXK_LISTENER_ENV	1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ #define AFSLITTLE_ENDIAN	1
+ 
+ #ifndef IGNORE_STDS_H
+ #include <afs/afs_sysnames.h>
+ #endif
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK	1
+ #define	AFS_SHORTGID		0	/* are group id's short? */
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.i386_obsd45.h
diff -c /dev/null openafs/src/config/param.i386_obsd45.h:1.1.2.2
*** /dev/null	Sat May 30 21:40:48 2009
--- openafs/src/config/param.i386_obsd45.h	Wed May 27 09:26:51 2009
***************
*** 0 ****
--- 1,73 ----
+ /*
+  * Jim Rees, University of Michigan CITI
+  */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define SYS_NAME		"i386_obsd45"
+ #define SYS_NAME_ID		SYS_NAME_ID_i386_obsd45
+ 
+ #define AFS_XBSD_ENV		1	/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV	1
+ 
+ #define AFS_NAMEI_ENV		1	/* User space interface to file system */
+ #define AFS_64BIT_ENV		1
+ #define AFS_64BIT_CLIENT	1
+ #define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
+ #define AFS_OBSD_ENV		1
+ #define AFS_OBSD34_ENV		1
+ #define AFS_OBSD35_ENV		1
+ #define AFS_OBSD36_ENV		1
+ #define AFS_OBSD37_ENV		1
+ #define AFS_OBSD38_ENV		1
+ #define AFS_OBSD39_ENV		1
+ #define AFS_OBSD40_ENV		1
+ #define AFS_OBSD41_ENV		1
+ #define AFS_OBSD42_ENV		1
+ #define AFS_OBSD43_ENV		1
+ #define AFS_OBSD44_ENV		1
+ #define AFS_OBSD45_ENV		1
+ #define AFS_NONFSTRANS		1
+ #define AFS_VM_RDWR_ENV		1
+ #define AFS_VFS_ENV		1
+ #define AFS_VFSINCL_ENV		1
+ 
+ #define FTRUNC O_TRUNC
+ 
+ #define AFS_SYSCALL		208
+ #define AFS_MOUNT_AFS		"afs"
+ 
+ #define RXK_LISTENER_ENV	1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ #define AFSLITTLE_ENDIAN	1
+ 
+ #ifndef IGNORE_STDS_H
+ #include <afs/afs_sysnames.h>
+ #endif
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK	1
+ #define	AFS_SHORTGID		0	/* are group id's short? */
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/stds.h
diff -c openafs/src/config/stds.h:1.23.2.14 openafs/src/config/stds.h:1.23.2.15
*** openafs/src/config/stds.h:1.23.2.14	Mon Mar 23 14:19:04 2009
--- openafs/src/config/stds.h	Fri May 15 08:30:18 2009
***************
*** 280,290 ****
   * windows use a different format string
   */
  #ifdef AFS_NT40_ENV
! #define AFS_INT64_FMT "l64d"
! #define AFS_PTR_FMT   "p"
  #else
  #define AFS_INT64_FMT "lld"
  #define AFS_PTR_FMT   "x"
  #endif
  
  /* Functions to safely cast afs_int32 and afs_uint32 so they can be used in 
--- 280,292 ----
   * windows use a different format string
   */
  #ifdef AFS_NT40_ENV
! #define AFS_INT64_FMT "I64d"
! #define AFS_PTR_FMT   "Ip"
! #define AFS_SIZET_FMT "Iu"
  #else
  #define AFS_INT64_FMT "lld"
  #define AFS_PTR_FMT   "x"
+ #define AFS_SIZET_FMT "u"
  #endif
  
  /* Functions to safely cast afs_int32 and afs_uint32 so they can be used in 
Index: openafs/src/config/venus.h
diff -c openafs/src/config/venus.h:1.12.2.8 openafs/src/config/venus.h:1.12.2.9
*** openafs/src/config/venus.h:1.12.2.8	Mon Jan 19 22:32:38 2009
--- openafs/src/config/venus.h	Mon Apr 27 19:04:45 2009
***************
*** 172,179 ****
  #define VIOC_RXSTAT_PEER	_VICEIOCTL(54)	/* Control peer RX stats */
  #define VIOC_GETRXKCRYPT        _VICEIOCTL(55)	/* Set rxkad enc flag */
  #define VIOC_SETRXKCRYPT        _VICEIOCTL(56)	/* Set rxkad enc flag */
! #define VIOC_PREFETCHTAPE       _VICEIOCTL(66)	/* MR-AFS prefetch from tape */
! #define VIOC_RESIDENCY_CMD      _VICEIOCTL(67)	/* generic MR-AFS cmds */
  #define VIOC_STATISTICS         _VICEIOCTL(68)	/* arla: fetch statistics */
  #define VIOC_GETVCXSTATUS2      _VICEIOCTL(69)  /* vcache statistics */
  
--- 172,180 ----
  #define VIOC_RXSTAT_PEER	_VICEIOCTL(54)	/* Control peer RX stats */
  #define VIOC_GETRXKCRYPT        _VICEIOCTL(55)	/* Set rxkad enc flag */
  #define VIOC_SETRXKCRYPT        _VICEIOCTL(56)	/* Set rxkad enc flag */
! #define VIOC_PREFETCHTAPE       _VICEIOCTL(66)	/* osd prefetch from tape */
! #define VIOC_FS_CMD      	_VICEIOCTL(67)	/* fs extensions for osd etc. */
! #define VIOC_RESIDENCY_CMD      VIOC_FS_CMD
  #define VIOC_STATISTICS         _VICEIOCTL(68)	/* arla: fetch statistics */
  #define VIOC_GETVCXSTATUS2      _VICEIOCTL(69)  /* vcache statistics */
  
Index: openafs/src/fsint/afsint.xg
diff -c openafs/src/fsint/afsint.xg:1.13.14.4 openafs/src/fsint/afsint.xg:1.13.14.5
*** openafs/src/fsint/afsint.xg:1.13.14.4	Mon Jan 19 22:32:38 2009
--- openafs/src/fsint/afsint.xg	Mon Apr 27 19:04:47 2009
***************
*** 393,399 ****
      afs_uint32 Residency4;
  };
  
! struct ResidencyCmdInputs {
      afs_int32  command;
      struct AFSFid fid;
      afs_int64  int64s[MAXCMDINT64S];
--- 393,399 ----
      afs_uint32 Residency4;
  };
  
! struct FsCmdInputs {
      afs_int32  command;
      struct AFSFid fid;
      afs_int64  int64s[MAXCMDINT64S];
***************
*** 401,407 ****
      char       chars[MAXCMDCHARS];
  };
  
! struct ResidencyCmdOutputs {
      afs_int32  code;
      struct AFSFetchStatus status;
      afs_int64  int64s[MAXCMDINT64S];
--- 401,407 ----
      char       chars[MAXCMDCHARS];
  };
  
! struct FsCmdOutputs {
      afs_int32  code;
      struct AFSFetchStatus status;
      afs_int64  int64s[MAXCMDINT64S];
***************
*** 660,671 ****
    AFSVolSync *Sync
  ) = 163;
  
! ResidencyCmd(
    IN AFSFid *Fid,
!   IN struct ResidencyCmdInputs *Inputs,
!   OUT struct ResidencyCmdOutputs *Outputs
  ) = 220;
  
  InlineBulkStatus(
    IN  AFSCBFids *FidsArray,
    OUT AFSBulkStats *StatArray,
--- 660,678 ----
    AFSVolSync *Sync
  ) = 163;
  
! FsCmd(
    IN AFSFid *Fid,
!   IN struct FsCmdInputs *Inputs,
!   OUT struct FsCmdOutputs *Outputs
  ) = 220;
  
+ #ifdef RPC_CLIENT
+ %int RXAFS_ResidencyCmd(struct rx_connection *z_conn, AFSFid *Fid, struct FsCmdInputs *Inputs, struct FsCmdOutputs *Outputs)
+ %{
+ %  return RXAFS_FsCmd(z_conn, Fid, Inputs, Outputs);
+ %}
+ #endif
+ 
  InlineBulkStatus(
    IN  AFSCBFids *FidsArray,
    OUT AFSBulkStats *StatArray,
Index: openafs/src/kauth/NTMakefile
diff -c openafs/src/kauth/NTMakefile:1.11.4.4 openafs/src/kauth/NTMakefile:1.11.4.5
*** openafs/src/kauth/NTMakefile:1.11.4.4	Wed Jul  2 08:49:16 2008
--- openafs/src/kauth/NTMakefile	Mon May 25 17:31:26 2009
***************
*** 39,52 ****
  	$(OUT)\kaerrors.obj \
  	$(OUT)\user_nt.obj \
  	$(OUT)\krb_tf.obj \
- 	$(OUT)\cm_config.obj \
  	$(OUT)\AFS_component_version_number.obj
  
- WINNTAFSD = ..\WINNT\afsd\
- 
- $(OUT)\cm_config.obj: $(WINNTAFSD)\cm_config.c
- 	$(C2OBJ) $**
- 
  $(KAUTH_LIBFILE): $(KAUTH_LIBOBJS) 
  	$(LIBARCH)  
  
--- 39,46 ----
***************
*** 67,73 ****
  	$(OUT)\kaerrors.obj \
  	$(OUT)\user.krb.obj \
  	$(OUT)\krb_tf.obj \
- 	$(OUT)\cm_config.obj \
  	$(OUT)\AFS_component_version_number.obj
  
  $(KAUTH_KRB_LIBFILE): $(KAUTH_KRB_LIBOBJS) 
--- 61,66 ----
***************
*** 98,105 ****
  	$(DESTDIR)\lib\afsubik.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afsrxkad.lib \
! 	$(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  	
  TOKENLIB = $(DESTDIR)\lib\afs\afspioctl.lib
  
--- 91,97 ----
  	$(DESTDIR)\lib\afsubik.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afsrxkad.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  	
  TOKENLIB = $(DESTDIR)\lib\afs\afspioctl.lib
  
Index: openafs/src/kauth/user.c
diff -c openafs/src/kauth/user.c:1.12.8.4 openafs/src/kauth/user.c:1.12.8.5
*** openafs/src/kauth/user.c:1.12.8.4	Sun Mar 15 21:47:39 2009
--- openafs/src/kauth/user.c	Tue May 12 13:19:09 2009
***************
*** 18,24 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/user.c,v 1.12.8.4 2009/03/16 01:47:39 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
--- 18,24 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/user.c,v 1.12.8.5 2009/05/12 17:19:09 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
***************
*** 157,163 ****
      int remainingTime = 0;
      struct ktc_encryptionKey key;
      afs_int32 code, dosetpag = 0;
! #if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_USR_LINUX20_ENV) && !defined(AFS_XBSD_ENV)
      sig_t old;
  #endif
  
--- 157,163 ----
      int remainingTime = 0;
      struct ktc_encryptionKey key;
      afs_int32 code, dosetpag = 0;
! #if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_USR_LINUX20_ENV) && !defined(AFS_XBSD_ENV) || defined(AFS_FBSD_ENV)
      sig_t old;
  #endif
  
Index: openafs/src/libadmin/adminutil/NTMakefile
diff -c openafs/src/libadmin/adminutil/NTMakefile:1.8.4.2 openafs/src/libadmin/adminutil/NTMakefile:1.8.4.3
*** openafs/src/libadmin/adminutil/NTMakefile:1.8.4.2	Wed Jul  2 08:49:17 2008
--- openafs/src/libadmin/adminutil/NTMakefile	Wed May 20 01:03:52 2009
***************
*** 147,152 ****
--- 147,153 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def afsadminutil.def
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
  
Index: openafs/src/libadmin/bos/NTMakefile
diff -c openafs/src/libadmin/bos/NTMakefile:1.6.4.1 openafs/src/libadmin/bos/NTMakefile:1.6.4.2
*** openafs/src/libadmin/bos/NTMakefile:1.6.4.1	Wed Jul  2 08:49:17 2008
--- openafs/src/libadmin/bos/NTMakefile	Wed May 20 01:03:52 2009
***************
*** 46,51 ****
--- 46,52 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def bosadmin.def
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
  
Index: openafs/src/libadmin/cfg/NTMakefile
diff -c openafs/src/libadmin/cfg/NTMakefile:1.6.4.3 openafs/src/libadmin/cfg/NTMakefile:1.6.4.4
*** openafs/src/libadmin/cfg/NTMakefile:1.6.4.3	Wed Jul  2 08:49:17 2008
--- openafs/src/libadmin/cfg/NTMakefile	Wed May 20 01:03:52 2009
***************
*** 63,68 ****
--- 63,69 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def afscfgadmin.def
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
  
Index: openafs/src/libadmin/client/NTMakefile
diff -c openafs/src/libadmin/client/NTMakefile:1.7.4.1 openafs/src/libadmin/client/NTMakefile:1.7.4.2
*** openafs/src/libadmin/client/NTMakefile:1.7.4.1	Wed Jul  2 08:49:18 2008
--- openafs/src/libadmin/client/NTMakefile	Wed May 20 01:03:53 2009
***************
*** 34,39 ****
--- 34,40 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def clientadmin.def
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
  
Index: openafs/src/libadmin/kas/NTMakefile
diff -c openafs/src/libadmin/kas/NTMakefile:1.6.4.2 openafs/src/libadmin/kas/NTMakefile:1.6.4.3
*** openafs/src/libadmin/kas/NTMakefile:1.6.4.2	Wed Jul  2 08:49:19 2008
--- openafs/src/libadmin/kas/NTMakefile	Wed May 20 01:03:56 2009
***************
*** 43,48 ****
--- 43,49 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def kasadmin.def
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
  
Index: openafs/src/libadmin/pts/NTMakefile
diff -c openafs/src/libadmin/pts/NTMakefile:1.6.4.2 openafs/src/libadmin/pts/NTMakefile:1.6.4.3
*** openafs/src/libadmin/pts/NTMakefile:1.6.4.2	Wed Jul  2 08:49:20 2008
--- openafs/src/libadmin/pts/NTMakefile	Wed May 20 01:03:56 2009
***************
*** 46,51 ****
--- 46,52 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def ptsadmin.def
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
  
Index: openafs/src/libadmin/vos/NTMakefile
diff -c openafs/src/libadmin/vos/NTMakefile:1.6.4.2 openafs/src/libadmin/vos/NTMakefile:1.6.4.3
*** openafs/src/libadmin/vos/NTMakefile:1.6.4.2	Wed Jul  2 08:49:21 2008
--- openafs/src/libadmin/vos/NTMakefile	Wed May 20 01:03:56 2009
***************
*** 67,72 ****
--- 67,73 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def vosadmin.def
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
  
Index: openafs/src/libafs/MakefileProto.DFBSD.in
diff -c /dev/null openafs/src/libafs/MakefileProto.DFBSD.in:1.1.2.2
*** /dev/null	Sat May 30 21:40:48 2009
--- openafs/src/libafs/MakefileProto.DFBSD.in	Mon Apr 27 14:31:55 2009
***************
*** 0 ****
--- 1,103 ----
+ # 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
+ 
+ 
+ # OS specific object files:
+ AFS_OS_OBJS = \
+ 	osi_groups.o \
+ 	osi_file.o \
+ 	osi_inode.o \
+ 	osi_misc.o \
+ 	osi_sleep.o \
+ 	osi_vm.o \
+ 	osi_vnodeops.o \
+ 	osi_module.o 
+ 
+ #AFS_OS_NFSOBJS = \
+ #	osi_vfsops_nfs.o
+ 
+ AFS_OS_NONFSOBJS = \
+ 	osi_vfsops.o
+ 
+ 
+ # System specific build commands and flags
+ KSRC = @BSD_KERNEL_PATH@
+ KBLD = @BSD_KERNEL_BUILD@
+ 
+ KDEFS=-Wall -nostdinc -I/usr/include -D_KERNEL -DKLD_MODULE \
+ 	-elf 
+ 
+ DBUG = -O2
+ DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT
+ CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
+ 
+ 
+ # Name of directory to hold object files and libraries.
+ KOBJ = MODLOAD
+ 
+ # This tells Makefile.common to use it's single directory build target.
+ COMPDIRS = single_compdir
+ INSTDIRS = single_instdir
+ DESTDIRS = single_destdir
+ 
+ #include Makefile.common
+ all:
+ 	echo "skipping"
+ 
+ setup:
+ 	echo "skipping"
+ 
+ # Below this line are targets when in the COMMON directory:
+ LIBAFS = libafsnfs.ko
+ LIBAFSNONFS = libafs.ko
+ 
+ INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
+ INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}
+ 
+ DEST_LIBAFS = ${DEST}/root.client/bin/${LIBAFS}
+ DEST_LIBAFSNONFS = ${DEST}/root.client/bin/${LIBAFSNONFS}
+ 
+ 
+ # Without this line, gmake tries to build libafs
+ .PHONY: libafs
+ 
+ # libafs:	$(LIBAFS) $(LIBAFSNONFS)
+ libafs:	$(LIBAFSNONFS)
+ # install_libafs:	$(INST_LIBAFS) $(INST_LIBAFSNONFS)
+ install_libafs:	$(INST_LIBAFSNONFS)
+ # dest_libafs:	$(DEST_LIBAFS) $(DEST_LIBAFSNONFS)
+ dest_libafs:	$(DEST_LIBAFSNONFS)
+ #libafs:
+ #	echo WARNING: No kernel module for ${SYS_NAME}
+ 
+ #install_libafs:
+ #	echo WARNING: No kernel module for ${SYS_NAME}
+ 
+ #dest_libafs:
+ #	echo WARNING: No kernel module for ${SYS_NAME}
+ 
+ 
+ $(INST_LIBAFS): $(LIBAFS)
+ 	$(INSTALL) -f $? $@
+ 
+ $(INST_LIBAFSNONFS): $(LIBAFSNONFS)
+ 	$(INSTALL) -f $? $@
+ 
+ $(DEST_LIBAFS): $(LIBAFS)
+ 	$(INSTALL) -f $? $@
+ 
+ $(DEST_LIBAFSNONFS): $(LIBAFSNONFS)
+ 	$(INSTALL) -f $? $@
+ 
+ ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
+ 	   echo "Skipping kernel module build"
+ 
+ ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
+ 	   echo "Skipping kernel module build"
Index: openafs/src/libafsauthent/NTMakefile
diff -c openafs/src/libafsauthent/NTMakefile:1.15.4.3 openafs/src/libafsauthent/NTMakefile:1.15.4.5
*** openafs/src/libafsauthent/NTMakefile:1.15.4.3	Wed Jul  2 08:49:22 2008
--- openafs/src/libafsauthent/NTMakefile	Mon May 25 17:31:26 2009
***************
*** 82,88 ****
  	$(OUT)\pioctl_nt.obj
  
  WINNTAFSDOBJS =\
- 	$(OUT)\cm_config.obj \
  	$(OUT)\afsrpc_c.obj
  
  DLLOBJS =\
--- 82,87 ----
***************
*** 95,102 ****
  	$(SYSOBJS) \
  	$(WINNTAFSDOBJS) \
  	$(AUDITBJS) \
- 	$(DESTDIR)\lib\cm_dns.obj \
-         $(DESTDIR)\lib\cm_nls.obj \
  	$(OUT)\afsauthent.res
  
  $(RXOBJS): $(RX)\$$(@B).c
--- 94,99 ----
***************
*** 142,154 ****
  	$(DESTDIR)\lib\afs\afseventlog.lib \
          $(DESTDIR)\lib\afs\afsprocmgmt.lib \
          $(DESTDIR)\lib\afslwp.lib \
!         $(DESTDIR)\lib\lanahelper.lib
  
  $(LIBFILE): $(DLLOBJS) $(DLLLIBS) $(RXOBJS)
  	$(DLLCONLINK) /DEF:afsauthent.def rpcrt4.lib dnsapi.lib mpr.lib secur32.lib shell32.lib
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
  
  # Definitions for generating versioninfo resources
  $(OUT)\afsauthent.res: AFS_component_version_number.h
--- 139,153 ----
  	$(DESTDIR)\lib\afs\afseventlog.lib \
          $(DESTDIR)\lib\afs\afsprocmgmt.lib \
          $(DESTDIR)\lib\afslwp.lib \
!         $(DESTDIR)\lib\lanahelper.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  $(LIBFILE): $(DLLOBJS) $(DLLLIBS) $(RXOBJS)
  	$(DLLCONLINK) /DEF:afsauthent.def rpcrt4.lib dnsapi.lib mpr.lib secur32.lib shell32.lib
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def afsauthent.def
  
  # Definitions for generating versioninfo resources
  $(OUT)\afsauthent.res: AFS_component_version_number.h
Index: openafs/src/libafsauthent/afsauthent.def
diff -c openafs/src/libafsauthent/afsauthent.def:1.5.2.4 openafs/src/libafsauthent/afsauthent.def:1.5.2.5
*** openafs/src/libafsauthent/afsauthent.def:1.5.2.4	Fri May  9 11:10:14 2008
--- openafs/src/libafsauthent/afsauthent.def	Wed May 20 01:03:57 2009
***************
*** 108,115 ****
          PR_UpdateEntry					@106
          PR_ListEntries					@107
          PR_ListSuperGroups				@108
! 	ka_AuthSpecificServersConn			@109
! 	ka_KeyCheckSum					@110
  	rx_Finalize					@111
  	rx_InitHost					@112
  	VOTE_GetSyncSite				@113
--- 108,115 ----
          PR_UpdateEntry					@106
          PR_ListEntries					@107
          PR_ListSuperGroups				@108
! ;	ka_AuthSpecificServersConn			@109   /* duplicate */
! ;	ka_KeyCheckSum					@110   /* duplicate */
  	rx_Finalize					@111
  	rx_InitHost					@112
  	VOTE_GetSyncSite				@113
Index: openafs/src/libafsrpc/NTMakefile
diff -c openafs/src/libafsrpc/NTMakefile:1.11.4.4 openafs/src/libafsrpc/NTMakefile:1.11.4.5
*** openafs/src/libafsrpc/NTMakefile:1.11.4.4	Sat Dec 27 14:22:47 2008
--- openafs/src/libafsrpc/NTMakefile	Wed May 20 01:03:57 2009
***************
*** 99,104 ****
--- 99,105 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def afsrpc.def
  
  # Definitions for generating versioninfo resources
  $(OUT)\afsrpc.res: AFS_component_version_number.h
Index: openafs/src/libafsrpc/afsrpc.def
diff -c openafs/src/libafsrpc/afsrpc.def:1.11.4.14 openafs/src/libafsrpc/afsrpc.def:1.11.4.15
*** openafs/src/libafsrpc/afsrpc.def:1.11.4.14	Wed Apr  1 12:38:13 2009
--- openafs/src/libafsrpc/afsrpc.def	Mon Apr 27 19:04:47 2009
***************
*** 245,250 ****
--- 245,251 ----
          rx_ReadProc32                           @250
          rx_WriteProc32                          @251
          xdr_free                                @252
+         RXAFS_FsCmd                             @253
  
  ; for performance testing
          rx_TSFPQGlobSize                        @2001 DATA
Index: openafs/src/libafsrpc/afsrpc.exp
diff -c openafs/src/libafsrpc/afsrpc.exp:1.3.4.1 openafs/src/libafsrpc/afsrpc.exp:1.3.4.2
*** openafs/src/libafsrpc/afsrpc.exp:1.3.4.1	Tue Apr 10 14:39:53 2007
--- openafs/src/libafsrpc/afsrpc.exp	Mon Apr 27 19:04:47 2009
***************
*** 165,167 ****
--- 165,168 ----
  RXAFS_FlushCPS
  RXAFS_DFSSymlink
  RXAFSCB_function_names
+ RXAFS_FsCmd
\ No newline at end of file
Index: openafs/src/libuafs/MakefileProto.DFBSD.in
diff -c /dev/null openafs/src/libuafs/MakefileProto.DFBSD.in:1.1.2.2
*** /dev/null	Sat May 30 21:40:49 2009
--- openafs/src/libuafs/MakefileProto.DFBSD.in	Mon Apr 27 14:31:56 2009
***************
*** 0 ****
--- 1,46 ----
+ # 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
+ 
+ 
+ # System specific build commands and flags
+ CC = @CC@
+ DEFINES= -D_REENTRANT -DKERNEL -DUKERNEL
+ KOPTS=
+ CFLAGS=-I. -I..  -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBG}
+ OPTF=-O
+ # WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD
+ 
+ TEST_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_DFFBSD_ENV
+ TEST_LDFLAGS=
+ TEST_LIBS=-lpthread
+ <all>
+ 
+ LIBUAFS = libuafs.a
+ LIBJUAFS = libjuafs.a
+ LIBAFSWEB = nsafs.so
+ LIBAFSWEBKRB = nsafs.krb.so
+ 
+ include Makefile.common
+ 
+ $(LIBUAFS): $(UAFSOBJ)
+ 	-$(RM) -f $(LIBUAFS)
+ 	$(AR) $(ARFLAGS) $(LIBUAFS) $(UAFSOBJ)
+ 
+ $(LIBJUAFS): $(JUAFSOBJ)
+ 	-$(RM) -f $(LIBJUAFS)
+ 	$(AR) $(ARFLAGS) $(LIBJUAFS) $(JUAFSOBJ)
+ 
+ $(LIBAFSWEB): $(AFSWEBOBJ) ${DES}/libdes.a
+ 	-$(RM) -f $(LIBAFSWEB)
+ 	ld -b $(LIBAFSWEB) $(AFSWEBOBJ) ${DES}/libdes.a $(WEBLIBS)
+ 
+ $(LIBAFSWEBKRB): $(AFSWEBOBJKRB) ${DES}/libdes.a
+ 	-$(RM) -f $(LIBAFSWEBKRB)
+ 	ld -b $(LIBAFSWEBKRB) $(AFSWEBOBJKRB) ${DES}/libdes.a $(WEBLIBS)
Index: openafs/src/lwp/waitkey.c
diff -c openafs/src/lwp/waitkey.c:1.13.14.1 openafs/src/lwp/waitkey.c:1.13.14.2
*** openafs/src/lwp/waitkey.c:1.13.14.1	Tue Oct 30 11:16:42 2007
--- openafs/src/lwp/waitkey.c	Mon Apr 27 14:31:56 2009
***************
*** 23,29 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/lwp/waitkey.c,v 1.13.14.1 2007/10/30 15:16:42 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 23,29 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/lwp/waitkey.c,v 1.13.14.2 2009/04/27 18:31:56 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 166,173 ****
--- 166,188 ----
  	return 1;
  #else
  #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+ #if defined(AFS_DFBSD_ENV)
+     struct appx_sbuf {
+       unsigned char *_base;
+       int     _size;
+     };
+     struct APPX_FILE
+     {      
+       struct __FILE_public    pub;
+       struct  appx_sbuf _bf;     /* the buffer (at least 1 byte, if !NULL) */
+     };
+     struct APPX_FILE *appx_stdin = (struct APPX_FILE *) stdin;
+     if (appx_stdin->_bf._size > 0)
+ 	return 1;
+ #else
      if (stdin->_bf._size > 0)
  	return 1;
+ #endif
  #else
      if (stdin->_cnt > 0)
  	return 1;
Index: openafs/src/packaging/RedHat/openafs-client.init
diff -c openafs/src/packaging/RedHat/openafs-client.init:1.2.2.6 openafs/src/packaging/RedHat/openafs-client.init:1.2.2.7
*** openafs/src/packaging/RedHat/openafs-client.init:1.2.2.6	Thu Jan 24 18:56:47 2008
--- openafs/src/packaging/RedHat/openafs-client.init	Tue May 12 12:58:37 2009
***************
*** 6,12 ****
  # description: OpenAFS is a distributed filesystem.
  # Should-Start: dkms
  #
! # $Revision: 1.2.2.6 $
  
  [ -f /etc/init.d/functions ] && . /etc/init.d/functions
  [ -f /etc/sysconfig/openafs ] && . /etc/sysconfig/openafs
--- 6,12 ----
  # description: OpenAFS is a distributed filesystem.
  # Should-Start: dkms
  #
! # $Revision: 1.2.2.7 $
  
  [ -f /etc/init.d/functions ] && . /etc/init.d/functions
  [ -f /etc/sysconfig/openafs ] && . /etc/sysconfig/openafs
***************
*** 37,42 ****
--- 37,43 ----
  	RETVAL=$?
  	echo
  	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/openafs-client
+ 	[ $RETVAL -eq 0 ] && [ "$AFS_POST_INIT" ] && $AFS_POST_INIT
  	return $RETVAL
  }
  
Index: openafs/src/pam/afs_auth.c
diff -c openafs/src/pam/afs_auth.c:1.13.4.1 openafs/src/pam/afs_auth.c:1.13.4.2
*** openafs/src/pam/afs_auth.c:1.13.4.1	Tue Aug 26 10:11:46 2008
--- openafs/src/pam/afs_auth.c	Mon Apr 27 14:31:56 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/afs_auth.c,v 1.13.4.1 2008/08/26 14:11:46 shadow Exp $");
  
  #include <syslog.h>
  #include <stdlib.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/afs_auth.c,v 1.13.4.2 2009/04/27 18:31:56 shadow Exp $");
  
  #include <syslog.h>
  #include <stdlib.h>
***************
*** 190,196 ****
  	RET(PAM_AUTH_ERR);
      }
  #else
! #if     defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_NBSD_ENV)
      upwd = getpwnam(user);
  #elif   defined(_POSIX_PTHREAD_SEMANTICS) && defined(AFS_SUN5_ENV)
      getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf), &upwd);
--- 190,196 ----
  	RET(PAM_AUTH_ERR);
      }
  #else
! #if     defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
      upwd = getpwnam(user);
  #elif   defined(_POSIX_PTHREAD_SEMANTICS) && defined(AFS_SUN5_ENV)
      getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf), &upwd);
Index: openafs/src/pam/afs_password.c
diff -c openafs/src/pam/afs_password.c:1.11 openafs/src/pam/afs_password.c:1.11.4.1
*** openafs/src/pam/afs_password.c:1.11	Sun May 29 23:35:52 2005
--- openafs/src/pam/afs_password.c	Mon Apr 27 14:31:56 2009
***************
*** 19,25 ****
  #include <security/pam_modules.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/afs_password.c,v 1.11 2005/05/30 03:35:52 shadow Exp $");
  
  #include <sys/param.h>
  #include <afs/kautils.h>
--- 19,25 ----
  #include <security/pam_modules.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/afs_password.c,v 1.11.4.1 2009/04/27 18:31:56 shadow Exp $");
  
  #include <sys/param.h>
  #include <afs/kautils.h>
***************
*** 134,140 ****
  	RET(PAM_AUTH_ERR);
      }
  #else
! #if     defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_NBSD_ENV)
      upwd = getpwnam(user);
  #else
      upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
--- 134,140 ----
  	RET(PAM_AUTH_ERR);
      }
  #else
! #if     defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
      upwd = getpwnam(user);
  #else
      upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
Index: openafs/src/pam/afs_setcred.c
diff -c openafs/src/pam/afs_setcred.c:1.14.4.1 openafs/src/pam/afs_setcred.c:1.14.4.2
*** openafs/src/pam/afs_setcred.c:1.14.4.1	Mon Dec 10 13:28:07 2007
--- openafs/src/pam/afs_setcred.c	Mon Apr 27 14:31:56 2009
***************
*** 20,26 ****
  #include <security/pam_modules.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/afs_setcred.c,v 1.14.4.1 2007/12/10 18:28:07 shadow Exp $");
  
  #include <sys/param.h>
  #include <afs/kautils.h>
--- 20,26 ----
  #include <security/pam_modules.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/afs_setcred.c,v 1.14.4.2 2009/04/27 18:31:56 shadow Exp $");
  
  #include <sys/param.h>
  #include <afs/kautils.h>
***************
*** 170,176 ****
  	RET(PAM_AUTH_ERR);
      }
  #else
! #if     defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_NBSD_ENV)
      upwd = getpwnam(user);
  #else
      upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
--- 170,176 ----
  	RET(PAM_AUTH_ERR);
      }
  #else
! #if     defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
      upwd = getpwnam(user);
  #else
      upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
Index: openafs/src/pam/test_pam.c
diff -c openafs/src/pam/test_pam.c:1.8 openafs/src/pam/test_pam.c:1.8.4.1
*** openafs/src/pam/test_pam.c:1.8	Sun May 29 23:35:52 2005
--- openafs/src/pam/test_pam.c	Mon Apr 27 14:31:56 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/test_pam.c,v 1.8 2005/05/30 03:35:52 shadow Exp $");
  
  #include <stdio.h>
  #include <security/pam_appl.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/test_pam.c,v 1.8.4.1 2009/04/27 18:31:56 shadow Exp $");
  
  #include <stdio.h>
  #include <security/pam_appl.h>
***************
*** 34,40 ****
  static const char *new_envstring = "GOTHEREVIATESTPAM=1";
  static const char *new_homestring = "HOME=/tmp";
  
! #if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_NBSD_ENV)
  #define getpassphrase getpass
  #endif
  
--- 34,40 ----
  static const char *new_envstring = "GOTHEREVIATESTPAM=1";
  static const char *new_homestring = "HOME=/tmp";
  
! #if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
  #define getpassphrase getpass
  #endif
  
Index: openafs/src/platform/DFBSD/Makefile.in
diff -c /dev/null openafs/src/platform/DFBSD/Makefile.in:1.1.2.2
*** /dev/null	Sat May 30 21:40:49 2009
--- openafs/src/platform/DFBSD/Makefile.in	Mon Apr 27 14:31:56 2009
***************
*** 0 ****
--- 1,14 ----
+ # 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
+ 
+ SHELL=/bin/sh
+ 
+ # We have no platform-specific stuff for this platform (yet).
+ all:
+ install:
+ dest:
+ clean:
Index: openafs/src/procmgmt/NTMakefile
diff -c openafs/src/procmgmt/NTMakefile:1.7.4.1 openafs/src/procmgmt/NTMakefile:1.7.4.2
*** openafs/src/procmgmt/NTMakefile:1.7.4.1	Wed Jul  2 08:49:23 2008
--- openafs/src/procmgmt/NTMakefile	Wed May 20 01:03:57 2009
***************
*** 38,43 ****
--- 38,44 ----
          $(_VC_MANIFEST_EMBED_DLL)
  	$(DLLPREP)
          $(CODESIGN_USERLAND)
+ 	$(MAKECYGLIB) --input-def afsprocmgmt.def
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
  
Index: openafs/src/ptserver/NTMakefile
diff -c openafs/src/ptserver/NTMakefile:1.14.4.5 openafs/src/ptserver/NTMakefile:1.14.4.8
*** openafs/src/ptserver/NTMakefile:1.14.4.5	Wed Jul  2 08:49:23 2008
--- openafs/src/ptserver/NTMakefile	Wed May 27 03:04:15 2009
***************
*** 69,76 ****
  	$(DESTDIR)\lib\afs\afsaudit.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  
  !IF (("$(SYS_NAME)"!="i386_win95" ) && ("$(SYS_NAME)"!="I386_WIN95" ))
  PTSERVER_EXELIBS =$(PTSERVER_EXELIBS) $(DESTDIR)\lib\afs\afsprocmgmt.lib
--- 69,75 ----
  	$(DESTDIR)\lib\afs\afsaudit.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  !IF (("$(SYS_NAME)"!="i386_win95" ) && ("$(SYS_NAME)"!="I386_WIN95" ))
  PTSERVER_EXELIBS =$(PTSERVER_EXELIBS) $(DESTDIR)\lib\afs\afsprocmgmt.lib
***************
*** 87,92 ****
--- 86,92 ----
  
  PTS = $(DESTDIR)\bin\pts.exe
  PTCLIENT = $(DESTDIR)\bin\ptclient.exe
+ PT_UTIL  = $(DESTDIR)\bin\pt_util.exe
  
  PTS_EXEOBJS =\
  	$(OUT)\pts.obj \
***************
*** 97,102 ****
--- 97,110 ----
          $(OUT)\display.obj \
  	$(OUT)\ptclient.res
  
+ PT_UTIL_EXEOBJS = \
+         $(OUT)\pt_util.obj \
+         $(OUT)\ptutils.obj \
+         $(OUT)\ubik.obj \
+         $(OUT)\utils.obj \
+         $(OUT)\map.obj \
+         $(OUT)\pt_util.res
+ 
  PTS_EXELIBS =\
  	$(DESTDIR)\lib\afsubik.lib \
  	$(DESTDIR)\lib\afs\afsauth.lib \
***************
*** 111,118 ****
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
! 	$(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  
  $(PTS): $(PTS_EXEOBJS) $(PTS_EXELIBS) 
  	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
--- 119,125 ----
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  $(PTS): $(PTS_EXEOBJS) $(PTS_EXELIBS) 
  	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
***************
*** 126,131 ****
--- 133,144 ----
  	$(EXEPREP) 
          $(CODESIGN_USERLAND)
  
+ $(PT_UTIL): $(PT_UTIL_EXEOBJS) $(PTS_EXELIBS)
+ 	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
+         $(_VC_MANIFEST_EMBED_EXE)
+ 	$(EXEPREP) 
+         $(CODESIGN_USERLAND)
+ 
  
  ############################################################################
  # generate versioninfo resources
***************
*** 136,141 ****
--- 149,156 ----
  
  $(OUT)\ptclient.res: AFS_component_version_number.h
  
+ $(OUT)\pt_util.res: AFS_component_version_number.h
+ 
  ############################################################################
  # rxgen on pting.xg
  
***************
*** 165,174 ****
  ############################################################################
  # install pts, ptserver and afsprot.lib
  
! install: $(INCFILES) ptint.ss.c ptint.cs.c ptint.xdr.c $(LIBFILE) $(PTSERVER) $(PTS) $(PTCLIENT) $(OUT)\readgroup.exe \
  	$(OUT)\readpwd.exe  $(OUT)\testpt.exe $(OUT)\db_verify.exe  \
  	$(DESTDIR)\root.server\usr\afs\bin\pts.exe \
  	$(DESTDIR)\root.server\usr\afs\bin\ptclient.exe \
  	$(INCFILEDIR)\afs\prserver.h $(INCFILEDIR)\afs\print.h \
  	$(INCFILEDIR)\afs\prerror.h $(INCFILEDIR)\afs\prclient.h
  
--- 180,190 ----
  ############################################################################
  # install pts, ptserver and afsprot.lib
  
! install: $(INCFILES) ptint.ss.c ptint.cs.c ptint.xdr.c $(LIBFILE) $(PTSERVER) $(PTS) $(PTCLIENT) $(PT_UTIL) $(OUT)\readgroup.exe \
  	$(OUT)\readpwd.exe  $(OUT)\testpt.exe $(OUT)\db_verify.exe  \
  	$(DESTDIR)\root.server\usr\afs\bin\pts.exe \
  	$(DESTDIR)\root.server\usr\afs\bin\ptclient.exe \
+ 	$(DESTDIR)\root.server\usr\afs\bin\pt_util.exe \
  	$(INCFILEDIR)\afs\prserver.h $(INCFILEDIR)\afs\print.h \
  	$(INCFILEDIR)\afs\prerror.h $(INCFILEDIR)\afs\prclient.h
  
***************
*** 186,191 ****
--- 202,210 ----
  $(DESTDIR)\root.server\usr\afs\bin\ptclient.exe: $(PTCLIENT)
  	$(COPY) $(PTCLIENT) $(DESTDIR)\root.server\usr\afs\bin\ptclient.exe
  
+ $(DESTDIR)\root.server\usr\afs\bin\pt_util.exe: $(PT_UTIL)
+ 	$(COPY) $(PT_UTIL) $(DESTDIR)\root.server\usr\afs\bin\pt_util.exe
+ 
  $(INCFILEDIR)\afs\prserver.h: $(INCFILEDIR)\afs\ptserver.h
  	$(COPY)	$(INCFILEDIR)\afs\ptserver.h $(INCFILEDIR)\afs\prserver.h
  
***************
*** 206,212 ****
  	$(DEL) ptint.cs.c ptint.ss.c ptint.xdr.c ptint.h
  	$(DEL) $(OUT)\readgroup.exe $(OUT)\readpwd.exe $(OUT)\db_verify.exe $(OUT)\testpt.exe 
  	$(DEL) pterror.h pterror.c
! 	$(DEL) $(PTS) $(PTCLIENT)
  
  ############################################################################
  # tests?
--- 225,231 ----
  	$(DEL) ptint.cs.c ptint.ss.c ptint.xdr.c ptint.h
  	$(DEL) $(OUT)\readgroup.exe $(OUT)\readpwd.exe $(OUT)\db_verify.exe $(OUT)\testpt.exe 
  	$(DEL) pterror.h pterror.c
! 	$(DEL) $(PTS) $(PTCLIENT) $(PT_UTIL)
  
  ############################################################################
  # tests?
Index: openafs/src/ptserver/pt_util.c
diff -c openafs/src/ptserver/pt_util.c:1.11.4.9 openafs/src/ptserver/pt_util.c:1.11.4.10
*** openafs/src/ptserver/pt_util.c:1.11.4.9	Mon Mar 16 09:08:56 2009
--- openafs/src/ptserver/pt_util.c	Wed May 27 02:59:46 2009
***************
*** 1,4 ****
! /* $Id: pt_util.c,v 1.11.4.9 2009/03/16 13:08:56 shadow Exp $ */
  
  /*
   *
--- 1,4 ----
! /* $Id: pt_util.c,v 1.11.4.10 2009/05/27 06:59:46 jaltman Exp $ */
  
  /*
   *
***************
*** 12,36 ****
   */
  
  #include <sys/types.h>
  #include <sys/time.h>
  #include <stdio.h>
  #include <ctype.h>
  #include <string.h>
  #include <errno.h>
- #include <sys/file.h>
  
  #include <afsconfig.h>
  #include <afs/param.h>
  #include <afs/com_err.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.11.4.9 2009/03/16 13:08:56 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <afs/afsutil.h>
  #include <errno.h>
  #include <lock.h>
  #include <netinet/in.h>
  #define UBIK_INTERNALS
  #include <ubik.h>
  #include <rx/xdr.h>
--- 12,44 ----
   */
  
  #include <sys/types.h>
+ #ifndef _WIN32
  #include <sys/time.h>
+ #include <sys/file.h>
+ #else
+ #include <fcntl.h>
+ #include <io.h>
+ #define L_SET SEEK_SET
+ #endif
  #include <stdio.h>
  #include <ctype.h>
  #include <string.h>
  #include <errno.h>
  
  #include <afsconfig.h>
  #include <afs/param.h>
  #include <afs/com_err.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.11.4.10 2009/05/27 06:59:46 jaltman Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <afs/afsutil.h>
  #include <errno.h>
  #include <lock.h>
+ #ifndef _WIN32
  #include <netinet/in.h>
+ #endif
  #define UBIK_INTERNALS
  #include <ubik.h>
  #include <rx/xdr.h>
Index: openafs/src/ptserver/pt_util.rc
diff -c /dev/null openafs/src/ptserver/pt_util.rc:1.1.2.2
*** /dev/null	Sat May 30 21:40:49 2009
--- openafs/src/ptserver/pt_util.rc	Wed May 27 02:59:46 2009
***************
*** 0 ****
--- 1,17 ----
+ /*
+  * 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
+  */
+ 
+ /* Define VERSIONINFO resource */
+ 
+ #define  AFS_VERINFO_FILE_DESCRIPTION "AFS Protection Database Utility"
+ #define  AFS_VERINFO_NAME "pt_util"
+ #define  AFS_VERINFO_FILENAME "pt_util.exe"
+ 
+ #include "AFS_component_version_number.h"
+ #include "..\config\NTVersioninfo.rc"
Index: openafs/src/ptserver/pts.c
diff -c openafs/src/ptserver/pts.c:1.15.2.7 openafs/src/ptserver/pts.c:1.15.2.8
*** openafs/src/ptserver/pts.c:1.15.2.7	Mon Mar 16 09:08:57 2009
--- openafs/src/ptserver/pts.c	Tue May 12 15:40:32 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pts.c,v 1.15.2.7 2009/03/16 13:08:57 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.8 2009/05/12 19:40:32 shadow Exp $");
  
  #include <stdio.h>
  #include <string.h>
***************
*** 184,189 ****
--- 184,193 ----
  	changed = 1;
  	sec = 1;
      }
+     if (as->parms[22].items) { /* -encrypt */
+ 	changed = 1;
+ 	sec = 3;
+     }
      if (as->parms[18].items || as->parms[20].items) { /* -test, -localauth */
  	changed = 1;
  	confdir = AFSDIR_SERVER_ETC_DIRPATH;
***************
*** 1031,1036 ****
--- 1035,1042 ----
  		"use local authentication");
      cmd_AddParm(ts, "-auth", CMD_FLAG, CMD_OPTIONAL,
  		"use user's authentication (default)");
+     cmd_AddParm(ts, "-encrypt", CMD_FLAG, CMD_OPTIONAL,
+ 		"encrypt commands");
  }
  
  /*
Index: openafs/src/ptserver/ptuser.c
diff -c openafs/src/ptserver/ptuser.c:1.25.2.13 openafs/src/ptserver/ptuser.c:1.25.2.14
*** openafs/src/ptserver/ptuser.c:1.25.2.13	Mon Mar 16 09:08:57 2009
--- openafs/src/ptserver/ptuser.c	Tue May 12 15:40:32 2009
***************
*** 15,21 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptuser.c,v 1.25.2.13 2009/03/16 13:08:57 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
--- 15,21 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptuser.c,v 1.25.2.14 2009/05/12 19:40:32 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
***************
*** 201,206 ****
--- 201,208 ----
  	code = ktc_GetToken(&sname, &ttoken, sizeof(ttoken), NULL);
  	if (code) {
  	    afs_com_err(whoami, code, "(getting token)");
+ 	    if (secLevel > 1)
+ 		return code;
  	    scIndex = 0;
  	} else {
  	    if (ttoken.kvno >= 0 && ttoken.kvno <= 256)
***************
*** 213,219 ****
  		scIndex = 2;
  	    }
  	    sc[2] =
! 		rxkad_NewClientSecurityObject(rxkad_clear, &ttoken.sessionKey,
  					      ttoken.kvno, ttoken.ticketLen,
  					      ttoken.ticket);
  	}
--- 215,222 ----
  		scIndex = 2;
  	    }
  	    sc[2] =
! 		rxkad_NewClientSecurityObject((secLevel > 1) ? rxkad_crypt :
! 					      rxkad_clear, &ttoken.sessionKey,
  					      ttoken.kvno, ttoken.ticketLen,
  					      ttoken.ticket);
  	}
Index: openafs/src/ptserver/ubik.c
diff -c openafs/src/ptserver/ubik.c:1.8.2.3 openafs/src/ptserver/ubik.c:1.8.2.5
*** openafs/src/ptserver/ubik.c:1.8.2.3	Mon Mar 16 10:58:04 2009
--- openafs/src/ptserver/ubik.c	Wed May 27 09:45:20 2009
***************
*** 1,13 ****
! /* $Id: ubik.c,v 1.8.2.3 2009/03/16 14:58:04 shadow Exp $ */
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ubik.c,v 1.8.2.3 2009/03/16 14:58:04 shadow Exp $");
  
  #include <sys/types.h>
  #include <netinet/in.h>
  #include <string.h>
  #include <stdarg.h>
  
--- 1,17 ----
! /* $Id: ubik.c,v 1.8.2.5 2009/05/27 13:45:20 jaltman Exp $ */
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ubik.c,v 1.8.2.5 2009/05/27 13:45:20 jaltman Exp $");
  
  #include <sys/types.h>
+ #ifdef AFS_NT40_ENV
+ #include <io.h>
+ #else
  #include <netinet/in.h>
+ #endif
  #include <string.h>
  #include <stdarg.h>
  
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.97.2.53 openafs/src/rx/rx.c:1.97.2.54
*** openafs/src/rx/rx.c:1.97.2.53	Wed Mar 18 09:41:38 2009
--- openafs/src/rx/rx.c	Tue May 12 13:12:30 2009
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.97.2.53 2009/03/18 13:41:38 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.97.2.54 2009/05/12 17:12:30 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
***************
*** 6482,6530 ****
  	    s->packetRequests);
  
      if (version >= RX_DEBUGI_VERSION_W_NEWPACKETTYPES) {
! 	fprintf(file, "alloc-failures(rcv %d/%d,send %d/%d,ack %d)\n",
  		s->receivePktAllocFailures, s->receiveCbufPktAllocFailures,
  		s->sendPktAllocFailures, s->sendCbufPktAllocFailures,
  		s->specialPktAllocFailures);
      } else {
! 	fprintf(file, "alloc-failures(rcv %d,send %d,ack %d)\n",
  		s->receivePktAllocFailures, s->sendPktAllocFailures,
  		s->specialPktAllocFailures);
      }
  
      fprintf(file,
! 	    "   greedy %d, " "bogusReads %d (last from host %x), "
! 	    "noPackets %d, " "noBuffers %d, " "selects %d, "
! 	    "sendSelects %d\n", s->socketGreedy, s->bogusPacketOnRead,
  	    s->bogusHost, s->noPacketOnRead, s->noPacketBuffersOnRead,
  	    s->selects, s->sendSelects);
  
      fprintf(file, "   packets read: ");
      for (i = 0; i < RX_N_PACKET_TYPES; i++) {
! 	fprintf(file, "%s %d ", rx_packetTypes[i], s->packetsRead[i]);
      }
      fprintf(file, "\n");
  
      fprintf(file,
! 	    "   other read counters: data %d, " "ack %d, " "dup %d "
! 	    "spurious %d " "dally %d\n", s->dataPacketsRead,
  	    s->ackPacketsRead, s->dupPacketsRead, s->spuriousPacketsRead,
  	    s->ignorePacketDally);
  
      fprintf(file, "   packets sent: ");
      for (i = 0; i < RX_N_PACKET_TYPES; i++) {
! 	fprintf(file, "%s %d ", rx_packetTypes[i], s->packetsSent[i]);
      }
      fprintf(file, "\n");
  
      fprintf(file,
! 	    "   other send counters: ack %d, " "data %d (not resends), "
! 	    "resends %d, " "pushed %d, " "acked&ignored %d\n",
  	    s->ackPacketsSent, s->dataPacketsSent, s->dataPacketsReSent,
  	    s->dataPacketsPushed, s->ignoreAckedPacket);
  
      fprintf(file,
! 	    "   \t(these should be small) sendFailed %d, " "fatalErrors %d\n",
  	    s->netSendFailures, (int)s->fatalErrors);
  
      if (s->nRttSamples) {
--- 6482,6530 ----
  	    s->packetRequests);
  
      if (version >= RX_DEBUGI_VERSION_W_NEWPACKETTYPES) {
! 	fprintf(file, "alloc-failures(rcv %u/%u,send %u/%u,ack %u)\n",
  		s->receivePktAllocFailures, s->receiveCbufPktAllocFailures,
  		s->sendPktAllocFailures, s->sendCbufPktAllocFailures,
  		s->specialPktAllocFailures);
      } else {
! 	fprintf(file, "alloc-failures(rcv %u,send %u,ack %u)\n",
  		s->receivePktAllocFailures, s->sendPktAllocFailures,
  		s->specialPktAllocFailures);
      }
  
      fprintf(file,
! 	    "   greedy %u, " "bogusReads %u (last from host %x), "
! 	    "noPackets %u, " "noBuffers %u, " "selects %u, "
! 	    "sendSelects %u\n", s->socketGreedy, s->bogusPacketOnRead,
  	    s->bogusHost, s->noPacketOnRead, s->noPacketBuffersOnRead,
  	    s->selects, s->sendSelects);
  
      fprintf(file, "   packets read: ");
      for (i = 0; i < RX_N_PACKET_TYPES; i++) {
! 	fprintf(file, "%s %u ", rx_packetTypes[i], s->packetsRead[i]);
      }
      fprintf(file, "\n");
  
      fprintf(file,
! 	    "   other read counters: data %u, " "ack %u, " "dup %u "
! 	    "spurious %u " "dally %u\n", s->dataPacketsRead,
  	    s->ackPacketsRead, s->dupPacketsRead, s->spuriousPacketsRead,
  	    s->ignorePacketDally);
  
      fprintf(file, "   packets sent: ");
      for (i = 0; i < RX_N_PACKET_TYPES; i++) {
! 	fprintf(file, "%s %u ", rx_packetTypes[i], s->packetsSent[i]);
      }
      fprintf(file, "\n");
  
      fprintf(file,
! 	    "   other send counters: ack %u, " "data %u (not resends), "
! 	    "resends %u, " "pushed %u, " "acked&ignored %u\n",
  	    s->ackPacketsSent, s->dataPacketsSent, s->dataPacketsReSent,
  	    s->dataPacketsPushed, s->ignoreAckedPacket);
  
      fprintf(file,
! 	    "   \t(these should be small) sendFailed %u, " "fatalErrors %u\n",
  	    s->netSendFailures, (int)s->fatalErrors);
  
      if (s->nRttSamples) {
Index: openafs/src/rx/rx_getaddr.c
diff -c openafs/src/rx/rx_getaddr.c:1.23.4.7 openafs/src/rx/rx_getaddr.c:1.23.4.8
*** openafs/src/rx/rx_getaddr.c:1.23.4.7	Sat Nov 29 13:55:44 2008
--- openafs/src/rx/rx_getaddr.c	Mon Apr 27 14:31:56 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_getaddr.c,v 1.23.4.7 2008/11/29 18:55:44 jaltman Exp $");
  
  #ifndef AFS_DJGPP_ENV
  #ifndef KERNEL
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_getaddr.c,v 1.23.4.8 2009/04/27 18:31:56 shadow Exp $");
  
  #ifndef AFS_DJGPP_ENV
  #ifndef KERNEL
***************
*** 46,51 ****
--- 46,56 ----
  
  #define NIFS		512
  
+ #if defined(AFS_USR_DFBSD_ENV)
+ #include <net/if.h>
+ #include <sys/sockio.h>
+ #endif
+ 
  #ifdef KERNEL
  /* only used for generating random noise */
  
***************
*** 329,335 ****
  /* this function returns the total number of interface addresses
  ** the buffer has to be passed in by the caller
  */
! #else
  static int
  rx_getAllAddr_internal(afs_uint32 buffer[], int maxSize, int loopbacks)
  {
--- 334,340 ----
  /* this function returns the total number of interface addresses
  ** the buffer has to be passed in by the caller
  */
! #else /* UKERNEL indirectly, on DARWIN or XBSD */
  static int
  rx_getAllAddr_internal(afs_uint32 buffer[], int maxSize, int loopbacks)
  {
***************
*** 338,343 ****
--- 343,349 ----
      struct ifconf ifc;
      struct ifreq ifs[NIFS], *ifr;
      struct sockaddr_in *a;
+     /* can't ever be AFS_DARWIN_ENV or AFS_XBSD_ENV, no? */
  #if    defined(AFS_AIX41_ENV) || defined (AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
      char *cp, *cplim, *cpnext;	/* used only for AIX 41 */
  #endif
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.56.2.17 openafs/src/rx/rx_kcommon.c:1.56.2.18
*** openafs/src/rx/rx_kcommon.c:1.56.2.17	Wed Jan 28 17:33:28 2009
--- openafs/src/rx/rx_kcommon.c	Sat May 30 13:56:06 2009
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.56.2.17 2009/01/28 22:33:28 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.18 2009/05/30 17:56:06 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 418,424 ****
      if (i == -1) {
  	pp->timeout.sec = 3;
  	/* pp->timeout.usec = 0; */
! 	pp->ifMTU = RX_REMOTE_PACKET_SIZE;
      } else {
  	pp->timeout.sec = 2;
  	/* pp->timeout.usec = 0; */
--- 418,424 ----
      if (i == -1) {
  	pp->timeout.sec = 3;
  	/* pp->timeout.usec = 0; */
! 	pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize);
      } else {
  	pp->timeout.sec = 2;
  	/* pp->timeout.usec = 0; */
***************
*** 434,440 ****
  		pp->ifMTU = rxmtu;
  	}
      } else {			/* couldn't find the interface, so assume the worst */
! 	pp->ifMTU = RX_REMOTE_PACKET_SIZE;
      }
  #else /* AFS_USERSPACE_IP_ADDR */
      AFS_IFNET_T ifn;
--- 434,440 ----
  		pp->ifMTU = rxmtu;
  	}
      } else {			/* couldn't find the interface, so assume the worst */
! 	pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize);
      }
  #else /* AFS_USERSPACE_IP_ADDR */
      AFS_IFNET_T ifn;
***************
*** 466,472 ****
      } else {			/* couldn't find the interface, so assume the worst */
  	pp->timeout.sec = 3;
  	/* pp->timeout.usec = 0; */
! 	pp->ifMTU = RX_REMOTE_PACKET_SIZE;
      }
  #endif /* else AFS_USERSPACE_IP_ADDR */
  #else /* AFS_SUN5_ENV */
--- 466,472 ----
      } else {			/* couldn't find the interface, so assume the worst */
  	pp->timeout.sec = 3;
  	/* pp->timeout.usec = 0; */
! 	pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize);
      }
  #endif /* else AFS_USERSPACE_IP_ADDR */
  #else /* AFS_SUN5_ENV */
***************
*** 475,481 ****
      if (mtu <= 0) {
  	pp->timeout.sec = 3;
  	/* pp->timeout.usec = 0; */
! 	pp->ifMTU = RX_REMOTE_PACKET_SIZE;
      } else {
  	pp->timeout.sec = 2;
  	/* pp->timeout.usec = 0; */
--- 475,481 ----
      if (mtu <= 0) {
  	pp->timeout.sec = 3;
  	/* pp->timeout.usec = 0; */
! 	pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize);
      } else {
  	pp->timeout.sec = 2;
  	/* pp->timeout.usec = 0; */
***************
*** 491,497 ****
  		pp->ifMTU = rxmtu;
  	}
      } else {			/* couldn't find the interface, so assume the worst */
! 	pp->ifMTU = RX_REMOTE_PACKET_SIZE;
      }
  #endif /* AFS_SUN5_ENV */
  #else /* ADAPT_MTU */
--- 491,497 ----
  		pp->ifMTU = rxmtu;
  	}
      } else {			/* couldn't find the interface, so assume the worst */
! 	pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE,rx_MyMaxSendSize);
      }
  #endif /* AFS_SUN5_ENV */
  #else /* ADAPT_MTU */
Index: openafs/src/rx/rx_packet.h
diff -c openafs/src/rx/rx_packet.h:1.14.4.6 openafs/src/rx/rx_packet.h:1.14.4.7
*** openafs/src/rx/rx_packet.h:1.14.4.6	Wed Jan 28 17:33:28 2009
--- openafs/src/rx/rx_packet.h	Mon Apr 27 14:31:56 2009
***************
*** 41,47 ****
  #define MAX(a,b)  ((a)>(b)?(a):(b))
  #endif
  #else /* AFS_NT40_ENV */
! #if !defined(AFS_DARWIN_ENV) && !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_USR_FBSD_ENV) && !defined(AFS_LINUX20_ENV)
  #include <sys/sysmacros.h>	/* MIN, MAX on Solaris */
  #endif
  #include <sys/param.h>		/* MIN, MAX elsewhere */
--- 41,47 ----
  #define MAX(a,b)  ((a)>(b)?(a):(b))
  #endif
  #else /* AFS_NT40_ENV */
! #if !defined(AFS_DARWIN_ENV) && !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_USR_FBSD_ENV) && !defined(AFS_USR_DFBSD_ENV) && !defined(AFS_LINUX20_ENV)
  #include <sys/sysmacros.h>	/* MIN, MAX on Solaris */
  #endif
  #include <sys/param.h>		/* MIN, MAX elsewhere */
Index: openafs/src/rx/OBSD/rx_knet.c
diff -c openafs/src/rx/OBSD/rx_knet.c:1.6 openafs/src/rx/OBSD/rx_knet.c:1.6.14.1
*** openafs/src/rx/OBSD/rx_knet.c:1.6	Tue Jul 15 19:16:25 2003
--- openafs/src/rx/OBSD/rx_knet.c	Tue May 12 09:03:01 2009
***************
*** 11,17 ****
  #include "../afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/OBSD/rx_knet.c,v 1.6 2003/07/15 23:16:25 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  
--- 11,17 ----
  #include "../afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/OBSD/rx_knet.c,v 1.6.14.1 2009/05/12 13:03:01 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  
***************
*** 42,48 ****
  
      if (haveGlock)
  	AFS_GUNLOCK();
!     code = soreceive(asocket, (addr ? &nam : NULL), &u, NULL, NULL, NULL);
      if (haveGlock)
  	AFS_GLOCK();
  
--- 42,52 ----
  
      if (haveGlock)
  	AFS_GUNLOCK();
!     code = soreceive(asocket, (addr ? &nam : NULL), &u, NULL, NULL, NULL
! #if defined(AFS_OBSD45_ENV)
! 		     , 0
! #endif
! 		     );
      if (haveGlock)
  	AFS_GLOCK();
  
Index: openafs/src/sgistuff/rcmd.c
diff -c openafs/src/sgistuff/rcmd.c:1.1 openafs/src/sgistuff/rcmd.c:1.1.6.1
*** openafs/src/sgistuff/rcmd.c:1.1	Tue Aug 16 13:58:27 2005
--- openafs/src/sgistuff/rcmd.c	Mon Apr 27 15:17:29 2009
***************
*** 19,25 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/sgistuff/rcmd.c,v 1.1 2005/08/16 17:58:27 shadow Exp $");
  
  #ifdef aiws /*AIX*/
  #include <sys/types.h>
--- 19,25 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/sgistuff/rcmd.c,v 1.1.6.1 2009/04/27 19:17:29 shadow Exp $");
  
  #ifdef aiws /*AIX*/
  #include <sys/types.h>
***************
*** 55,62 ****
  #endif /* defined(AFS_HPUX_ENV) */
  #ifdef	TCP_DEBUG
  #include <sys/syslog.h>
! #	define	DPRINTF(args)	dprintf args
! dprintf(args)
       char *args;
  {
      char **argv;
--- 55,62 ----
  #endif /* defined(AFS_HPUX_ENV) */
  #ifdef	TCP_DEBUG
  #include <sys/syslog.h>
! #	define	DPRINTF(args)	afs_dprintf args
! afs_dprintf(args)
       char *args;
  {
      char **argv;
Index: openafs/src/tbutc/NTMakefile
diff -c openafs/src/tbutc/NTMakefile:1.16.4.6 openafs/src/tbutc/NTMakefile:1.16.4.7
*** openafs/src/tbutc/NTMakefile:1.16.4.6	Wed Oct  8 17:15:10 2008
--- openafs/src/tbutc/NTMakefile	Mon May 25 17:31:27 2009
***************
*** 94,113 ****
  	$(DESTDIR)\lib\afspthread.lib \
  !ENDIF
  	     $(DESTDIR)\lib\afsdes.lib \
! 	     $(DESTDIR)\lib\cm_dns.obj \
!              $(DESTDIR)\lib\cm_nls.obj
  
  
- #	$(DESTDIR)\lib\afsauthent.lib \
- #	$(DESTDIR)\lib\afsrpc.lib \
- #	$(DESTDIR)\lib\afs\afscmd.lib \
- #	$(DESTDIR)\lib\afs\afsaudit.lib \
- #	$(DESTDIR)\lib/afs/afscom_err.lib \
- #	$(DESTDIR)\lib\afs\afsreg.lib \
- #	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
- #	$(DESTDIR)\lib\afs\afseventlog.lib \
- #	$(DESTDIR)\lib\pthread.lib
- 
  # rm $(OUT)\tcstatus.obj
  # nmake /nologo /f ntmakefile install
  #----------------------------------------------- BUTC
--- 94,102 ----
  	$(DESTDIR)\lib\afspthread.lib \
  !ENDIF
  	     $(DESTDIR)\lib\afsdes.lib \
! 	     $(DESTDIR)\lib\libafsconf.lib
  
  
  # rm $(OUT)\tcstatus.obj
  # nmake /nologo /f ntmakefile install
  #----------------------------------------------- BUTC
Index: openafs/src/tests/Makefile.in
diff -c openafs/src/tests/Makefile.in:1.13.2.2 openafs/src/tests/Makefile.in:1.13.2.3
*** openafs/src/tests/Makefile.in:1.13.2.2	Mon Mar 31 11:54:02 2008
--- openafs/src/tests/Makefile.in	Tue May 12 12:23:04 2009
***************
*** 360,371 ****
  uninstall:
  
  all: run-tests OpenAFS/Dirpath.pm libxfiles.a libdumpscan.a $(TEST_PROGRAMS)\
! 	afsdump_scan afsdump_dirlist afsdump_extract dumptool
  	@chmod +x run-tests
  
  clean:
  	-rm -f xf_errs.c xf_errs.h dumpscan_errs.c dumpscan_errs.h *.o \
! 	$(TARGETS) run-tests $(TEST_PROGRAMS) OpenAFS/Dirpath.pm
  
  include ../config/Makefile.version
  
--- 360,371 ----
  uninstall:
  
  all: run-tests OpenAFS/Dirpath.pm libxfiles.a libdumpscan.a $(TEST_PROGRAMS)\
! 	afsdump_scan afsdump_dirlist afsdump_extract dumptool OpenAFS/Dirpath.sh
  	@chmod +x run-tests
  
  clean:
  	-rm -f xf_errs.c xf_errs.h dumpscan_errs.c dumpscan_errs.h *.o \
! 	$(TARGETS) run-tests $(TEST_PROGRAMS) OpenAFS/Dirpath.pm OpenAFS/Dirpath.sh
  
  include ../config/Makefile.version
  
***************
*** 424,428 ****
--- 424,463 ----
  	@echo ""                                                >>$@
  	@echo "1;"                                              >>$@
  
+ OpenAFS/Dirpath.sh: Makefile
+ 	@echo "Creating OpenAFS/Dirpath.sh"					
+ 	@echo "# auto-generated by src/tests/Makefile"		  >>$@
+ 	@echo "# source or '.' in this file in shell"		   >>$@
+ 	@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 "  OSTYPE=@MKAFS_OSTYPE@"       >>$@
+ 	@if test "${sysconfdir}/openafs/server" = "/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 "export AFSCONFDIR VICEETCDIR AFSSRVBINDIR AFSSRVSBINDIR" >>$@
+ 	@echo "export AFSSRVLIBEXECDIR AFSDBDIR AFSLOGSDIR AFSLOCALDIR" >>$@
+ 	@echo "export AFSBACKUPDIR AFSBOSCONFIGDIR OSTYPE CACHEDIR AFSDDIR" >>$@
+ 	@echo "export INITDIR AFSKERNELDIR AFSWSBINDIR"	>>$@
  
  .PHONY:		all install clean realclean distclean mostlyclean install uninstall check
Index: openafs/src/tests/afs-rmcell.sh
diff -c openafs/src/tests/afs-rmcell.sh:1.1 openafs/src/tests/afs-rmcell.sh:1.1.22.1
*** openafs/src/tests/afs-rmcell.sh:1.1	Mon Jan 14 02:49:17 2002
--- openafs/src/tests/afs-rmcell.sh	Tue May 12 12:23:04 2009
***************
*** 1,5 ****
  #!/bin/sh
! /bin/rm -rf /usr/afs/db/prdb.DB0 /usr/afs/db/prdb.DBSYS1 /usr/afs/db/vldb.DB0 /usr/afs/db/vldb.DBSYS1 /usr/afs/local/BosConfig /usr/afs/etc/UserList /usr/afs/etc/ThisCell /usr/afs/etc/CellServDB 
  /bin/rm -rf /vicepa/AFSIDat 
  /bin/rm -rf /vicepb/AFSIDat
  /bin/rm -rf /vicepa/V*.vol
--- 1,21 ----
  #!/bin/sh
! 
! source OpenAFS/Dirpath.sh
! 
! # Remove database files
! /bin/rm -rf ${AFSDBDIR}/prdb.DB0 ${AFSDBDIR}/prdb.DBSYS1 \
! 	${AFSDBDIR}/vldb.DB0 ${AFSDBDIR}/vldb.DBSYS1 \
! 	${AFSDBDIR}/kaserver.DB0 ${AFSDBDIR}/kaserver.DBSYS1 
! 
! # Remove cell configuration (server-side)
! /bin/rm -rf ${AFSCONFDIR}/ThisCell ${AFSCONFDIR}/CellServDB \
! 	${AFSCONFDIR}/KeyFile ${AFSCONFDIR}/krb.conf ${AFSCONFDIR}/UserList
! 
! # Remove remaining server configuration, logs, and local
! /bin/rm -rf ${AFSBOSCONFIGDIR}/BosConfig ${AFSLOGSDIR}/logs/* \
! 	${AFSLOCALDIR}/* 
! 
! # Remove data
  /bin/rm -rf /vicepa/AFSIDat 
  /bin/rm -rf /vicepb/AFSIDat
  /bin/rm -rf /vicepa/V*.vol
Index: openafs/src/tests/OpenAFS/Dirpath.pm.in
diff -c openafs/src/tests/OpenAFS/Dirpath.pm.in:1.1 openafs/src/tests/OpenAFS/Dirpath.pm.in:removed
*** openafs/src/tests/OpenAFS/Dirpath.pm.in:1.1	Tue Jan 15 14:22:11 2002
--- openafs/src/tests/OpenAFS/Dirpath.pm.in	Sat May 30 21:40:49 2009
***************
*** 1,25 ****
- # This is -*- perl -*-
- 
- package OpenAFS::Dirpath;
- 
- use strict;
- use vars qw( @ISA @EXPORT $openafsdirpath);
- @ISA = qw(Exporter);
- require Exporter;
- @EXPORT = qw($openafsdirpath);
- 
- # Dirpath configuration
- $openafsdirpath = {
-         'afsconfdir'       => '@afsconfdir@',
-         'viceetcdir'       => '@viceetcdir@',
- 	'afssrvbindir'     => '@afssrvbindir@',
- 	'afssrvsbindir'    => '@afssrvsbindir@',
- 	'afssrvlibexecdir' => '@afssrvlibexecdir@',
- 	'afsdbdir'         => '@afsdbdir@',
- 	'afslogsdir'       => '@afslogsdir@',
- 	'afslocaldir'      => '@afslocaldir@',
- 	'afsbackupdir'     => '@afsbackupdir@',
- 	'afsbosconfigdir'  => '@afsbosconfigdir@'
- };
- 
- 1;
--- 0 ----
Index: openafs/src/ubik/ubikclient.c
diff -c openafs/src/ubik/ubikclient.c:1.10.8.4 openafs/src/ubik/ubikclient.c:1.10.8.5
*** openafs/src/ubik/ubikclient.c:1.10.8.4	Mon Mar 16 08:37:40 2009
--- openafs/src/ubik/ubikclient.c	Mon Apr 27 14:31:57 2009
***************
*** 15,21 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubikclient.c,v 1.10.8.4 2009/03/16 12:37:40 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
--- 15,21 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubikclient.c,v 1.10.8.5 2009/04/27 18:31:57 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
***************
*** 28,33 ****
--- 28,34 ----
  #define UBIK_LEGACY_CALLITER 1
  #include "ubik.h"
  #include "afs/pthread_glock.h"
+ #include <netdb.h>
  #else /* defined(UKERNEL) */
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
Index: openafs/src/update/NTMakefile
diff -c openafs/src/update/NTMakefile:1.9.4.4 openafs/src/update/NTMakefile:1.9.4.5
*** openafs/src/update/NTMakefile:1.9.4.4	Wed Jul  2 08:49:27 2008
--- openafs/src/update/NTMakefile	Mon May 25 17:31:28 2009
***************
*** 22,29 ****
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afsrxkad.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  
  ############################################################################
  # Definitions for generating files via RXGEN
--- 22,28 ----
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afsrxkad.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  ############################################################################
  # Definitions for generating files via RXGEN
Index: openafs/src/util/hostparse.c
diff -c openafs/src/util/hostparse.c:1.15.4.1 openafs/src/util/hostparse.c:1.15.4.2
*** openafs/src/util/hostparse.c:1.15.4.1	Tue Oct 30 11:16:48 2007
--- openafs/src/util/hostparse.c	Mon Apr 27 14:31:57 2009
***************
*** 15,25 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/hostparse.c,v 1.15.4.1 2007/10/30 15:16:48 shadow Exp $");
  
  #ifdef UKERNEL
  #include "afs/sysincludes.h"
  #include "afs/afsutil.h"
  #else /* UKERNEL */
  #include <stdio.h>
  #include <sys/types.h>
--- 15,26 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/hostparse.c,v 1.15.4.2 2009/04/27 18:31:57 shadow Exp $");
  
  #ifdef UKERNEL
  #include "afs/sysincludes.h"
  #include "afs/afsutil.h"
+ #include <netdb.h>
  #else /* UKERNEL */
  #include <stdio.h>
  #include <sys/types.h>
Index: openafs/src/util/vice.h
diff -c openafs/src/util/vice.h:1.7 openafs/src/util/vice.h:1.7.14.1
*** openafs/src/util/vice.h:1.7	Tue Jul 15 19:17:17 2003
--- openafs/src/util/vice.h	Mon Apr 27 14:31:57 2009
***************
*** 19,25 ****
   *	    	between user processes and Venus.
   */
  #include <afs/param.h>
! #ifdef AFS_SUN_ENV
  #include <sys/ioccom.h>
  #endif
  
--- 19,25 ----
   *	    	between user processes and Venus.
   */
  #include <afs/param.h>
! #if defined(AFS_SUN_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_USR_DFBSD_ENV)
  #include <sys/ioccom.h>
  #endif
  
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.113.2.36 openafs/src/viced/afsfileprocs.c:1.113.2.37
*** openafs/src/viced/afsfileprocs.c:1.113.2.36	Wed Mar 25 10:34:47 2009
--- openafs/src/viced/afsfileprocs.c	Mon Apr 27 19:04:48 2009
***************
*** 29,35 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.113.2.36 2009/03/25 14:34:47 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 29,35 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.113.2.37 2009/04/27 23:04:48 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 1986,1996 ****
  }
  
  afs_int32
! SRXAFS_ResidencyCmd(struct rx_call * acall, struct AFSFid * Fid,
! 		    struct ResidencyCmdInputs * Inputs,
! 		    struct ResidencyCmdOutputs * Outputs)
  {
!     return EINVAL;
  }
  
  #ifdef AFS_NT40_ENV
--- 1986,2006 ----
  }
  
  afs_int32
! SRXAFS_FsCmd(struct rx_call * acall, struct AFSFid * Fid,
! 		    struct FsCmdInputs * Inputs,
! 		    struct FsCmdOutputs * Outputs)
  {
!     afs_int32 code = 0;
!     struct AFSCallBack callback;
!     struct AFSVolSync sync;
! 
!     switch (Inputs->command) {
!     default:
!         code = EINVAL;
!     }
!     ViceLog(1,("FsCmd: cmd = %d, code=%d\n", 
! 			Inputs->command, Outputs->code));
!     return code;
  }
  
  #ifdef AFS_NT40_ENV
Index: openafs/src/viced/host.c
diff -c openafs/src/viced/host.c:1.93.2.37 openafs/src/viced/host.c:1.93.2.38
*** openafs/src/viced/host.c:1.93.2.37	Sun Mar 15 23:10:32 2009
--- openafs/src/viced/host.c	Sat May 30 13:27:17 2009
***************
*** 13,19 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.93.2.37 2009/03/16 03:10:32 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 13,19 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.93.2.38 2009/05/30 17:27:17 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 903,914 ****
  	assert(host);
  	if (!(host->hostFlags & HOSTDELETED) && host->interface
  	    && afs_uuid_equal(&host->interface->uuid, uuidp)) {
! 	    break;
  	}
- 	host = NULL;
      }
!     return host;
! 
  }				/*h_Lookup */
  
  
--- 903,912 ----
  	assert(host);
  	if (!(host->hostFlags & HOSTDELETED) && host->interface
  	    && afs_uuid_equal(&host->interface->uuid, uuidp)) {
!             return host;
  	}
      }
!     return NULL;
  }				/*h_Lookup */
  
  
***************
*** 939,945 ****
      if (h_NBLock_r(host) != 0) {
  	char hoststr[16];
  	ViceLog(0,
! 		("Warning:  h_TossStuff_r failed; Host %x (%s:%d) was locked.\n",
  		 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  	return;
      } else {
--- 937,943 ----
      if (h_NBLock_r(host) != 0) {
  	char hoststr[16];
  	ViceLog(0,
! 		("Warning:  h_TossStuff_r failed; Host %" AFS_PTR_FMT " (%s:%d) was locked.\n",
  		 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  	return;
      } else {
***************
*** 954,960 ****
  	    if (code < 0) {
  		char hoststr[16];
  		ViceLog(0,
! 			("Warning: h_TossStuff_r failed: Host %x (%s:%d) client %x was locked.\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port), client));
  		return;
--- 952,958 ----
  	    if (code < 0) {
  		char hoststr[16];
  		ViceLog(0,
! 			("Warning: h_TossStuff_r failed: Host %" AFS_PTR_FMT " (%s:%d) client %x was locked.\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port), client));
  		return;
***************
*** 963,969 ****
  	    if (client->refCount) {
  		char hoststr[16];
  		ViceLog(0,
! 			("Warning: h_TossStuff_r failed: Host %x (%s:%d) client %x refcount %d.\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port), client, client->refCount));
  		/* This is the same thing we do if the host is locked */
--- 961,967 ----
  	    if (client->refCount) {
  		char hoststr[16];
  		ViceLog(0,
! 			("Warning: h_TossStuff_r failed: Host %" AFS_PTR_FMT " (%s:%d) client %x refcount %d.\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port), client, client->refCount));
  		/* This is the same thing we do if the host is locked */
***************
*** 986,994 ****
      host->hostFlags &= ~CLIENTDELETED;
  
      if (host->hostFlags & HOSTDELETED) {
-         register struct h_AddrHashChain **ahp, *ath;
  	register struct rx_connection *rxconn;
- 	afsUUID *uuidp;
  	struct AddrPort hostAddrPort;
  	int i;
  
--- 984,990 ----
***************
*** 1007,1050 ****
  
  	/* if alternate addresses do not exist */
  	if (!(host->interface)) {
! 	    for (ahp = &hostAddrHashTable[h_HashIndex(host->host)]; (ath = *ahp);
! 		 ahp = &ath->next) {
! 		assert(ath->hostPtr);
! 		if (ath->hostPtr == host) {
! 		    *ahp = ath->next;
! 		    free(ath);
! 		    break;
! 		}
! 	    }
  	} else {
!             register struct h_UuidHashChain **uhp, *uth;
! 	    /* delete the hash entry for the UUID */
! 	    uuidp = &host->interface->uuid;
! 	    for (uhp = &hostUuidHashTable[h_UuidHashIndex(uuidp)]; (uth = *uhp);
! 		 uhp = &uth->next) {
! 		assert(uth->hostPtr);
! 		if (uth->hostPtr == host) {
! 		    *uhp = uth->next;
! 		    free(uth);
! 		    break;
! 		}
! 	    }
! 	    /* delete the hash entry for each alternate addresses */
  	    for (i = 0; i < host->interface->numberOfInterfaces; i++) {
  		hostAddrPort = host->interface->interface[i];
! 
!                 if (!hostAddrPort.valid)
!                     continue;
! 
! 		for (ahp = &hostAddrHashTable[h_HashIndex(hostAddrPort.addr)]; (ath = *ahp);
! 		     ahp = &ath->next) {
! 		    assert(ath->hostPtr);
! 		    if (ath->hostPtr == host) {
! 			*ahp = ath->next;
! 			free(ath);
! 			break;
! 		    }
! 		}
  	    }
  	    free(host->interface);
  	    host->interface = NULL;
--- 1003,1024 ----
  
  	/* if alternate addresses do not exist */
  	if (!(host->interface)) {
! 	    h_DeleteHostFromAddrHashTable_r(host->host, host->port, host);
  	} else {
!             h_DeleteHostFromUuidHashTable_r(host);
! 	    h_DeleteHostFromAddrHashTable_r(host->host, host->port, host);
! 	    /* delete the hash entry for each valid alternate addresses */
  	    for (i = 0; i < host->interface->numberOfInterfaces; i++) {
  		hostAddrPort = host->interface->interface[i];
!                 /* 
!                  * if the interface addr/port is the primary, we already
!                  * removed it.  If the addr/port is not valid, its not
!                  * in the hash table.
!                  */
!                 if (hostAddrPort.valid &&
!                     (host->host != hostAddrPort.addr ||
!                      host->port != hostAddrPort.port))
!                     h_DeleteHostFromAddrHashTable_r(hostAddrPort.addr, hostAddrPort.port, host);
  	    }
  	    free(host->interface);
  	    host->interface = NULL;
***************
*** 1150,1164 ****
  {
      int index;
      struct h_UuidHashChain *chain;
  
      /* hash into proper bucket */
      index = h_UuidHashIndex(uuid);
  
      /* don't add the same entry multiple times */
      for (chain = hostUuidHashTable[index]; chain; chain = chain->next) {
  	if (chain->hostPtr->interface && 
! 	    afs_uuid_equal(&chain->hostPtr->interface->uuid, uuid))
  	    return;
      }
  
      /* insert into beginning of list for this bucket */
--- 1124,1153 ----
  {
      int index;
      struct h_UuidHashChain *chain;
+     char uuid1[128], uuid2[128];
+     char hoststr[16];
  
      /* hash into proper bucket */
      index = h_UuidHashIndex(uuid);
  
      /* don't add the same entry multiple times */
      for (chain = hostUuidHashTable[index]; chain; chain = chain->next) {
+ 	if (!chain->hostPtr)
+ 	    continue;
+ 
  	if (chain->hostPtr->interface && 
! 	    afs_uuid_equal(&chain->hostPtr->interface->uuid, uuid)) {
! 	    if (LogLevel >= 125) {
! 		afsUUID_to_string(&chain->hostPtr->interface->uuid, uuid1, 
! 				  127);
! 		afsUUID_to_string(uuid, uuid2, 127);
! 		ViceLog(125, ("h_AddHostToUuidHashTable_r: host %" AFS_PTR_FMT " (uuid %s) exists as %s:%d (uuid %s)\n", 
! 			      host, uuid1,
! 			      afs_inet_ntoa_r(chain->hostPtr->host, hoststr), 
! 			      ntohs(chain->hostPtr->port), uuid2));
! 	    }
  	    return;
+ 	}
      }
  
      /* insert into beginning of list for this bucket */
***************
*** 1167,1179 ****
  	ViceLog(0, ("Failed malloc in h_AddHostToUuidHashTable_r\n"));
  	assert(0);
      }
-     assert(chain);
      chain->hostPtr = host;
      chain->next = hostUuidHashTable[index];
      hostUuidHashTable[index] = chain;
  }
  
- 
  /* inserts a new HashChain structure corresponding to this address */
  void
  h_AddHostToAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host *host)
--- 1156,1209 ----
  	ViceLog(0, ("Failed malloc in h_AddHostToUuidHashTable_r\n"));
  	assert(0);
      }
      chain->hostPtr = host;
      chain->next = hostUuidHashTable[index];
      hostUuidHashTable[index] = chain;
+          if (LogLevel < 125)
+ 	       return;
+      afsUUID_to_string(uuid, uuid2, 127);
+      ViceLog(125, 
+ 	     ("h_AddHostToUuidHashTable_r: host %" AFS_PTR_FMT " (%s:%d) added as uuid %s\n",
+ 	      host, afs_inet_ntoa_r(chain->hostPtr->host, hoststr), 
+ 	      ntohs(chain->hostPtr->port), uuid));
+ }
+ 
+ /* deletes a HashChain structure corresponding to this host */
+ int
+ h_DeleteHostFromUuidHashTable_r(struct host *host)
+ {
+      int index;
+      register struct h_UuidHashChain **uhp, *uth;
+      char uuid1[128];
+      char hoststr[16];
+  
+      if (!host->interface)
+        return 0;
+  
+      /* hash into proper bucket */
+      index = h_UuidHashIndex(&host->interface->uuid);
+      
+      if (LogLevel >= 125)
+ 	 afsUUID_to_string(&host->interface->uuid, uuid1, 127);
+      for (uhp = &hostUuidHashTable[index]; (uth = *uhp); uhp = &uth->next) {
+          assert(uth->hostPtr);
+ 	 if (uth->hostPtr == host) {
+ 	     ViceLog(125, 
+ 		     ("h_DeleteHostFromUuidHashTable_r: host %" AFS_PTR_FMT " (uuid %s %s:%d)\n",
+ 		      host, uuid1, afs_inet_ntoa_r(host->host, hoststr), 
+ 		      ntohs(host->port)));
+ 	     *uhp = uth->next;
+ 	     free(uth);
+ 	     return 1;
+ 	 }
+      }
+      ViceLog(125, 
+ 	     ("h_DeleteHostFromUuidHashTable_r: host %" AFS_PTR_FMT " (uuid %s %s:%d) not found\n",
+ 	      host, uuid1, afs_inet_ntoa_r(host->host, hoststr), 
+ 	      ntohs(host->port)));
+      return 0;
  }
  
  /* inserts a new HashChain structure corresponding to this address */
  void
  h_AddHostToAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host *host)
***************
*** 1181,1206 ****
      int index;
      struct h_AddrHashChain *chain;
      int found = 0;
!     char hoststr[16];
  
      /* hash into proper bucket */
      index = h_HashIndex(addr);
  
      /* don't add the same entry multiple times */
      for (chain = hostAddrHashTable[index]; chain; chain = chain->next) {
! 	if (chain->addr == addr && chain->port == port) {
!             if (chain->hostPtr == host)
!                 found = 1;
!             else if (!(host->hostFlags & HOSTDELETED))
!                 ViceLog(125, ("Addr %s:%d assigned to %x and %x.\n",
!                             afs_inet_ntoa_r(addr, hoststr), ntohs(port),
!                             host, chain));
!         }
      }
  
-     if (found)
-         return;
- 
      /* insert into beginning of list for this bucket */
      chain = (struct h_AddrHashChain *)malloc(sizeof(struct h_AddrHashChain));
      if (!chain) {
--- 1211,1240 ----
      int index;
      struct h_AddrHashChain *chain;
      int found = 0;
!     char hoststr[16], hoststr2[16];
  
      /* hash into proper bucket */
      index = h_HashIndex(addr);
  
      /* don't add the same entry multiple times */
      for (chain = hostAddrHashTable[index]; chain; chain = chain->next) {
! 	if (chain->hostPtr == host) {
! 	    if (chain->addr != addr || chain->port != port) {
! 		ViceLog(0, 
! 			("h_AddHostToAddrHashTable_r: host %" AFS_PTR_FMT " exists as %s:%d when adding %s:%d\n",
! 			 host, afs_inet_ntoa_r(chain->addr, hoststr), 
! 			 ntohs(chain->port), afs_inet_ntoa_r(addr, hoststr2), 
! 			 ntohs(port)));
! 	    } else
! 		ViceLog(125, 
! 			("h_AddHostToAddrHashTable_r: host %" AFS_PTR_FMT " (%s:%d) already hashed\n",
! 			 host, afs_inet_ntoa_r(chain->addr, hoststr), 
! 			 ntohs(chain->port)));
! 	    
! 	    return;
! 	}
      }
  
      /* insert into beginning of list for this bucket */
      chain = (struct h_AddrHashChain *)malloc(sizeof(struct h_AddrHashChain));
      if (!chain) {
***************
*** 1212,1224 ****
      chain->addr = addr;
      chain->port = port;
      hostAddrHashTable[index] = chain;
  }
  
  /*
!  * This is called with host locked and held. At this point, the
!  * hostAddrHashTable should not have entries for the alternate
!  * interfaces. This function has to insert these entries in the
!  * hostAddrHashTable.
   *
   * All addresses are in network byte order.
   */
--- 1246,1259 ----
      chain->addr = addr;
      chain->port = port;
      hostAddrHashTable[index] = chain;
+     ViceLog(125, ("h_AddHostToAddrHashTable_r: host %" AFS_PTR_FMT " added as %s:%d\n",
+ 		  host, afs_inet_ntoa_r(addr, hoststr), ntohs(port)));
  }
  
  /*
!  * This is called with host locked and held. 
!  * It is called to either validate or add an additional interface
!  * address/port on the specified host.  
   *
   * All addresses are in network byte order.
   */
***************
*** 1227,1236 ****
  {
      int i;
      int number;
-     int found;
      struct Interface *interface;
      char hoststr[16], hoststr2[16];
! 
      assert(host);
      assert(host->interface);
  
--- 1262,1270 ----
  {
      int i;
      int number;
      struct Interface *interface;
      char hoststr[16], hoststr2[16];
!                                                    
      assert(host);
      assert(host->interface);
  
***************
*** 1239,1283 ****
       * for this host.
       */
      number = host->interface->numberOfInterfaces;
!     for (i = 0, found = 0; i < number && !found; i++) {
  	if (host->interface->interface[i].addr == addr &&
               host->interface->interface[i].port == port) {
! 	    found = 1;
!             host->interface->interface[i].valid = 1;
          }
      }
  
!     ViceLog(125, ("addInterfaceAddr : host %s:%d addr %s:%d : found:%d\n", 
! 		   afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), 
! 		   afs_inet_ntoa_r(addr, hoststr2), ntohs(port), found));
      
!     if (!found) {
! 	interface = (struct Interface *)
! 	    malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * number));
! 	if (!interface) {
! 	    ViceLog(0, ("Failed malloc in addInterfaceAddr_r\n"));
! 	    assert(0);
! 	}
! 	interface->numberOfInterfaces = number + 1;
! 	interface->uuid = host->interface->uuid;
! 	for (i = 0; i < number; i++)
! 	    interface->interface[i] = host->interface->interface[i];
! 	interface->interface[number].addr = addr;
! 	interface->interface[number].port = port;
!         interface->interface[number].valid = 1;
! 	free(host->interface);
! 	host->interface = interface;
      }
! 
      return 0;
  }
  
  
  /*
!  * This is called with host locked and held. At this point, the
!  * hostAddrHashTable should not be having entries for the alternate
!  * interfaces. This function has to insert these entries in the
!  * hostAddrHashTable.
   *
   * All addresses are in network byte order.
   */
--- 1273,1326 ----
       * for this host.
       */
      number = host->interface->numberOfInterfaces;
!     for (i = 0; i < number; i++) {
  	if (host->interface->interface[i].addr == addr &&
               host->interface->interface[i].port == port) {
! 	    ViceLog(125, 
! 		    ("addInterfaceAddr : found host %" AFS_PTR_FMT " (%s:%d) adding %s:%d%s\n",
! 		     host, afs_inet_ntoa_r(host->host, hoststr), 
! 		     ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
! 		     ntohs(port), host->interface->interface[i].valid ? "" : 
! 		     ", validating"));
!      
! 	    if (host->interface->interface[i].valid == 0) {
! 		host->interface->interface[i].valid = 1;
! 		h_AddHostToAddrHashTable_r(addr, port, host);
! 	    }
! 	    return 0;
          }
      }
  
!     ViceLog(125, ("addInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) adding %s:%d\n", 
! 		  host, afs_inet_ntoa_r(host->host, hoststr), 
! 		  ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
! 		  ntohs(port)));
      
!     interface = (struct Interface *)
! 	malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * number));
!     if (!interface) {
! 	ViceLog(0, ("Failed malloc in addInterfaceAddr_r\n"));
! 	assert(0);
      }
!     interface->numberOfInterfaces = number + 1;
!     interface->uuid = host->interface->uuid;
!     for (i = 0; i < number; i++)
! 	interface->interface[i] = host->interface->interface[i];
!     
!     /* Add the new valid interface */
!     interface->interface[number].addr = addr;
!     interface->interface[number].port = port;
!     interface->interface[number].valid = 1;
!     h_AddHostToAddrHashTable_r(addr, port, host);
!     free(host->interface);
!     host->interface = interface;
!     
      return 0;
  }
  
  
  /*
!  * This is called with host locked and held.
   *
   * All addresses are in network byte order.
   */
***************
*** 1286,1301 ****
  {
      int i;
      int number;
-     int found;
      struct Interface *interface;
      char hoststr[16], hoststr2[16];
  
      assert(host);
      assert(host->interface);
  
!     ViceLog(125, ("removeInterfaceAddr : host %s:%d addr %s:%d\n", 
! 		   afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), 
! 		   afs_inet_ntoa_r(addr, hoststr2), ntohs(port)));
  
      /*
       * Make sure this address is on the list of known addresses
--- 1329,1344 ----
  {
      int i;
      int number;
      struct Interface *interface;
      char hoststr[16], hoststr2[16];
  
      assert(host);
      assert(host->interface);
  
!     ViceLog(125, ("removeInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) addr %s:%d\n", 
! 		  host, afs_inet_ntoa_r(host->host, hoststr), 
! 		  ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
! 		  ntohs(port)));
  
      /*
       * Make sure this address is on the list of known addresses
***************
*** 1303,1328 ****
       */
      interface = host->interface;
      number = host->interface->numberOfInterfaces;
!     for (i = 0, found = 0; i < number && !found; i++) {
  	if (interface->interface[i].addr == addr &&
  	    interface->interface[i].port == port) {
! 	    found = 1;
!             interface->interface[i].valid = 0;
! 	}
!     }
!     if (found) {
! 	number--;
! 	for (; i < number; i++) {
! 	    interface->interface[i] = interface->interface[i+1];
  	}
! 	interface->numberOfInterfaces = number;
!     }
  
      /*
!      * Remove the hash table entry for this address
       */
!     h_DeleteHostFromAddrHashTable_r(addr, port, host);
! 
      return 0;
  }
  
--- 1346,1407 ----
       */
      interface = host->interface;
      number = host->interface->numberOfInterfaces;
!     for (i = 0; i < number; i++) {
  	if (interface->interface[i].addr == addr &&
  	    interface->interface[i].port == port) {
! 	    if (interface->interface[i].valid)
! 		h_DeleteHostFromAddrHashTable_r(addr, port, host);
! 	    number--;
! 	    for (; i < number; i++) {
! 		interface->interface[i] = interface->interface[i+1];
! 	    }
! 	    interface->numberOfInterfaces = number;
! 	    return 0;
  	}
!     }	
!     /* not found */
!     return 0;
! }
  
+ /*
+  * This is called with host locked and held.
+  *
+  * All addresses are in network byte order.
+  */
+ int
+ invalidateInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
+ {
+     int i;
+     int number;
+     struct Interface *interface;
+     char hoststr[16], hoststr2[16];
+     
+     assert(host);
+     assert(host->interface);
+     
+     ViceLog(125, ("invalidateInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) addr %s:%d\n", 
+ 		  host, afs_inet_ntoa_r(host->host, hoststr), 
+ 		  ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
+ 		  ntohs(port)));
+     
      /*
!      * Make sure this address is on the list of known addresses
!      * for this host.
       */
!     interface = host->interface;
!     number = host->interface->numberOfInterfaces;
!     for (i = 0; i < number; i++) {
! 	if (interface->interface[i].addr == addr &&
! 	    interface->interface[i].port == port) {
!             if (interface->interface[i].valid) {
!                 h_DeleteHostFromAddrHashTable_r(addr, port, host);
! 		interface->interface[i].valid = 0;
! 	    }
! 	    return 0;
! 	}
!     }
!     
!     /* not found */
      return 0;
  }
  
***************
*** 1340,1362 ****
  {
      int i;
      char hoststr[16], hoststr2[16];
  
!     if (!host->interface) {
          if (host->host == addr && host->port == port) {
              ViceLog(25,
!                     ("Removing only address for host %x (%s:%d), deleting host.\n",
                       host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
              host->hostFlags |= HOSTDELETED;
          }
      } else {
!         removeInterfaceAddr_r(host, host->host, host->port);
!         if (host->interface->numberOfInterfaces == 0) {
!             ViceLog(25,
!                      ("Removed only address for host %x (%s:%d), no alternate interfaces, deleting host.\n",
!                        host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
!             host->hostFlags |= HOSTDELETED;
!         } else {
!             struct rx_connection *rxconn;
  
              rxconn = host->callback_rxcon;
              host->callback_rxcon = NULL;
--- 1419,1447 ----
  {
      int i;
      char hoststr[16], hoststr2[16];
+     struct rx_connection *rxconn;
  
!     if (!host->interface || host->interface->numberOfInterfaces == 1) {
          if (host->host == addr && host->port == port) {
              ViceLog(25,
!                     ("Removing only address for host %" AFS_PTR_FMT " (%s:%d), deleting host.\n",
                       host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
              host->hostFlags |= HOSTDELETED;
+             /* 
+              * Do not remove the primary addr/port from the hash table.
+              * It will be ignored due to the HOSTDELETED flag and will
+              * be removed when h_TossStuff_r() cleans up the HOSTDELETED
+              * host.  Removing it here will only result in a search for 
+              * the host/addr/port in the hash chain which will fail.
+              */
+         } else {
+             ViceLog(0,
+                     ("Removing address that does not belong to host %" AFS_PTR_FMT " (%s:%d).\n",
+                      host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
          }
      } else {
!         if (host->host == addr && host->port == port)  {
!             removeInterfaceAddr_r(host, addr, port);
  
              rxconn = host->callback_rxcon;
              host->callback_rxcon = NULL;
***************
*** 1364,1374 ****
              if (rxconn) {
                  struct client *client;
                  /*
!                 * If rx_DestroyConnection calls h_FreeConnection we will
!                 * deadlock on the host_glock_mutex. Work around the problem
!                 * by unhooking the client from the connection before
!                 * destroying the connection.
!                 */
                  client = rx_GetSpecific(rxconn, rxcon_client_key);
                  rx_SetSpecific(rxconn, rxcon_client_key, (void *)0);
                  rx_DestroyConnection(rxconn);
--- 1449,1459 ----
              if (rxconn) {
                  struct client *client;
                  /*
!                  * If rx_DestroyConnection calls h_FreeConnection we will
!                  * deadlock on the host_glock_mutex. Work around the problem
!                  * by unhooking the client from the connection before
!                  * destroying the connection.
!                  */
                  client = rx_GetSpecific(rxconn, rxcon_client_key);
                  rx_SetSpecific(rxconn, rxcon_client_key, (void *)0);
                  rx_DestroyConnection(rxconn);
***************
*** 1377,1383 ****
              for (i=0; i < host->interface->numberOfInterfaces; i++) {
                  if (host->interface->interface[i].valid) {
                      ViceLog(25,
!                              ("Removed address for host %x (%s:%d), new primary interface %s:%d.\n",
                                 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
                                 afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr2), 
                                 ntohs(host->interface->interface[i].port)));
--- 1462,1468 ----
              for (i=0; i < host->interface->numberOfInterfaces; i++) {
                  if (host->interface->interface[i].valid) {
                      ViceLog(25,
!                              ("Removed address for host %" AFS_PTR_FMT " (%s:%d), new primary interface %s:%d.\n",
                                 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
                                 afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr2), 
                                 ntohs(host->interface->interface[i].port)));
***************
*** 1390,1398 ****
  
              if (i == host->interface->numberOfInterfaces) {
                  ViceLog(25,
!                          ("Removed only address for host %x (%s:%d), no valid alternate interfaces, deleting host.\n",
                             host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
                  host->hostFlags |= HOSTDELETED;
              } else {
                  if (!sc)
                      sc = rxnull_NewClientSecurityObject();
--- 1475,1486 ----
  
              if (i == host->interface->numberOfInterfaces) {
                  ViceLog(25,
!                          ("Removed only address for host %" AFS_PTR_FMT " (%s:%d), no valid alternate interfaces, deleting host.\n",
                             host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
                  host->hostFlags |= HOSTDELETED;
+                 /* addr/port was removed from the hash table */
+                 host->host = 0;
+                 host->port = 0;
              } else {
                  if (!sc)
                      sc = rxnull_NewClientSecurityObject();
***************
*** 1401,1406 ****
--- 1489,1497 ----
                  rx_SetConnDeadTime(host->callback_rxcon, 50);
                  rx_SetConnHardDeadTime(host->callback_rxcon, AFS_HARDDEADTIME);
              }
+         } else {
+             /* not the primary addr/port, just invalidate it */
+             invalidateInterfaceAddr_r(host, addr, port);
          }
      }
  
***************
*** 1479,1485 ****
  	    if (!held)
  		h_Release_r(host);
  	    ViceLog(125,
! 		    ("Host %x (%s:%d) starting h_Lookup again\n",
  		     host, afs_inet_ntoa_r(host->host, hoststr),
  		     ntohs(host->port)));
  	    goto retry;
--- 1570,1576 ----
  	    if (!held)
  		h_Release_r(host);
  	    ViceLog(125,
! 		    ("Host %" AFS_PTR_FMT " (%s:%d) starting h_Lookup again\n",
  		     host, afs_inet_ntoa_r(host->host, hoststr),
  		     ntohs(host->port)));
  	    goto retry;
***************
*** 1544,1550 ****
  		 * that we maintain some extra callback state information */
  		if (host->interface) {
  		    ViceLog(0,
! 			    ("Host %x (%s:%d) used to support WhoAreYou, deleting.\n",
  			     host, 
  			     afs_inet_ntoa_r(host->host, hoststr),
  			     ntohs(host->port)));
--- 1635,1641 ----
  		 * that we maintain some extra callback state information */
  		if (host->interface) {
  		    ViceLog(0,
! 			    ("Host %" AFS_PTR_FMT " (%s:%d) used to support WhoAreYou, deleting.\n",
  			     host, 
  			     afs_inet_ntoa_r(host->host, hoststr),
  			     ntohs(host->port)));
***************
*** 1595,1601 ****
                      removeAddress_r(host, haddr, hport);
  		} else {
  		    ViceLog(25,
! 			    ("Uuid doesn't match host %x (%s:%d).\n",
  			     host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		    
  		    removeAddress_r(host, host->host, host->port);
--- 1686,1692 ----
                      removeAddress_r(host, haddr, hport);
  		} else {
  		    ViceLog(25,
! 			    ("Uuid doesn't match host %" AFS_PTR_FMT " (%s:%d).\n",
  			     host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		    
  		    removeAddress_r(host, host->host, host->port);
***************
*** 1633,1645 ****
                       * callback connection, and destroy the old one.
                       */
                      struct rx_connection *rxconn;
!                     ViceLog(0,("CB: ProbeUuid for host %x (%s:%d) failed %d\n",
  			       host, 
  			       afs_inet_ntoa_r(host->host, hoststr),
  			       ntohs(host->port),code2));
! 		    
!                     removeInterfaceAddr_r(host, host->host, host->port);
                      addInterfaceAddr_r(host, haddr, hport);
                      host->host = haddr;
                      host->port = hport;
                      rxconn = host->callback_rxcon;
--- 1724,1741 ----
                       * callback connection, and destroy the old one.
                       */
                      struct rx_connection *rxconn;
!                     ViceLog(0,("CB: ProbeUuid for host %" AFS_PTR_FMT " (%s:%d) failed %d\n",
  			       host, 
  			       afs_inet_ntoa_r(host->host, hoststr),
  			       ntohs(host->port),code2));
! 
!                     /* 
!                      * make sure we add and then remove.  otherwise, we
!                      * might end up with no valid interfaces after the 
!                      * remove and the host will have been marked deleted.
!                      */
                      addInterfaceAddr_r(host, haddr, hport);
+                     removeInterfaceAddr_r(host, host->host, host->port);
                      host->host = haddr;
                      host->port = hport;
                      rxconn = host->callback_rxcon;
***************
*** 1680,1686 ****
                  return 0;
  	    } else {
  		ViceLog(0,
! 			("CB: WhoAreYou failed for host %x (%s:%d), error %d\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port), code));
  		host->hostFlags |= VENUSDOWN;
--- 1776,1782 ----
                  return 0;
  	    } else {
  		ViceLog(0,
! 			("CB: WhoAreYou failed for host %" AFS_PTR_FMT " (%s:%d), error %d\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port), code));
  		host->hostFlags |= VENUSDOWN;
***************
*** 1698,1704 ****
  	if (!(host->hostFlags & ALTADDR)) {
  	    /* another thread is doing the initialisation */
  	    ViceLog(125,
! 		    ("Host %x (%s:%d) waiting for host-init to complete\n",
  		     host, afs_inet_ntoa_r(host->host, hoststr),
  		     ntohs(host->port)));
  	    h_Lock_r(host);
--- 1794,1800 ----
  	if (!(host->hostFlags & ALTADDR)) {
  	    /* another thread is doing the initialisation */
  	    ViceLog(125,
! 		    ("Host %" AFS_PTR_FMT " (%s:%d) waiting for host-init to complete\n",
  		     host, afs_inet_ntoa_r(host->host, hoststr),
  		     ntohs(host->port)));
  	    h_Lock_r(host);
***************
*** 1706,1712 ****
  	    if (!held)
  		h_Release_r(host);
  	    ViceLog(125,
! 		    ("Host %x (%s:%d) starting h_Lookup again\n",
  		     host, afs_inet_ntoa_r(host->host, hoststr),
  		     ntohs(host->port)));
  	    goto retry;
--- 1802,1808 ----
  	    if (!held)
  		h_Release_r(host);
  	    ViceLog(125,
! 		    ("Host %" AFS_PTR_FMT " (%s:%d) starting h_Lookup again\n",
  		     host, afs_inet_ntoa_r(host->host, hoststr),
  		     ntohs(host->port)));
  	    goto retry;
***************
*** 1726,1732 ****
  	    if (host->interface)
  		afsUUID_to_string(&host->interface->uuid, uuid2, 127);
  	    ViceLog(0,
! 		    ("CB: new identity for host %x (%s:%d), deleting(%x %x %s %s)\n",
  		     host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
  		     identP->valid, host->interface,
  		     identP->valid ? uuid1 : "no_uuid",
--- 1822,1828 ----
  	    if (host->interface)
  		afsUUID_to_string(&host->interface->uuid, uuid2, 127);
  	    ViceLog(0,
! 		    ("CB: new identity for host %" AFS_PTR_FMT " (%s:%d), deleting(%x %x %s %s)\n",
  		     host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
  		     identP->valid, host->interface,
  		     identP->valid ? uuid1 : "no_uuid",
***************
*** 1772,1778 ****
  		if (!pident)
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
  		ViceLog(25,
! 			("Host %x (%s:%d) does not support WhoAreYou.\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port)));
  		code = 0;
--- 1868,1874 ----
  		if (!pident)
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
  		ViceLog(25,
! 			("Host %" AFS_PTR_FMT " (%s:%d) does not support WhoAreYou.\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port)));
  		code = 0;
***************
*** 1793,1799 ****
  		if (!pident)
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
  		ViceLog(25,
! 			("WhoAreYou success on host %x (%s:%d)\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port)));
  	    }
--- 1889,1895 ----
  		if (!pident)
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
  		ViceLog(25,
! 			("WhoAreYou success on host %" AFS_PTR_FMT " (%s:%d)\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr),
  			 ntohs(host->port)));
  	    }
***************
*** 1835,1841 ****
  			     * MultiProbeAlternateAddress_r() will remove the
  			     * alternate interfaces that do not have the same
  			     * Uuid. */
! 			    ViceLog(0,("CB: ProbeUuid for host %x (%s:%d) failed %d\n",
  					 oldHost, 
                                           afs_inet_ntoa_r(oldHost->host, hoststr),
  					 ntohs(oldHost->port),code2));
--- 1931,1937 ----
  			     * MultiProbeAlternateAddress_r() will remove the
  			     * alternate interfaces that do not have the same
  			     * Uuid. */
! 			    ViceLog(0,("CB: ProbeUuid for host %" AFS_PTR_FMT " (%s:%d) failed %d\n",
  					 oldHost, 
                                           afs_inet_ntoa_r(oldHost->host, hoststr),
  					 ntohs(oldHost->port),code2));
***************
*** 1857,1895 ****
  			struct rx_connection *rxconn;
  
  			ViceLog(25,
!                                  ("CB: Host %x (%s:%d) has new addr %s:%d\n",
                                     oldHost, 
                                     afs_inet_ntoa_r(oldHost->host, hoststr2),
                                     ntohs(oldHost->port),
                                     afs_inet_ntoa_r(haddr, hoststr),
                                     ntohs(hport)));
  			if (probefail || oldHost->host == haddr) {
! 			    /* The probe failed which means that the old address is 
! 			     * either unreachable or is not the same host we were just
! 			     * contacted by.  We will also remove addresses if only
! 			     * the port has changed because that indicates the client
  			     * is behind a NAT. 
  			     */
  			    removeInterfaceAddr_r(oldHost, oldHost->host, oldHost->port);
  			} else {
! 			    int i, found;
  			    struct Interface *interface = oldHost->interface;
  			    int number = oldHost->interface->numberOfInterfaces;
! 			    for (i = 0, found = 0; i < number; i++) {
  				if (interface->interface[i].addr == haddr &&
  				    interface->interface[i].port != hport) {
! 				    found = 1;
  				    break;
  				}
  			    }
- 			    if (found) {
- 				/* We have just been contacted by a client that has been
- 				 * seen from behind a NAT and at least one other address.
- 				 */
- 				removeInterfaceAddr_r(oldHost, haddr, interface->interface[i].port);
- 			    }
  			}
! 			addInterfaceAddr_r(oldHost, haddr, hport);
  			oldHost->host = haddr;
  			oldHost->port = hport;
  			rxconn = oldHost->callback_rxcon;
--- 1953,1998 ----
  			struct rx_connection *rxconn;
  
  			ViceLog(25,
!                                  ("CB: Host %" AFS_PTR_FMT " (%s:%d) has new addr %s:%d\n",
                                     oldHost, 
                                     afs_inet_ntoa_r(oldHost->host, hoststr2),
                                     ntohs(oldHost->port),
                                     afs_inet_ntoa_r(haddr, hoststr),
                                     ntohs(hport)));
+ 			/* 
+ 			 * add then remove.  otherwise the host may get marked
+ 			 * deleted if we removed the only valid address.
+ 			 */
+ 			addInterfaceAddr_r(oldHost, haddr, hport);
  			if (probefail || oldHost->host == haddr) {
! 			    /* 
! 			     * The probe failed which means that the old 
! 			     * address is either unreachable or is not the 
! 			     * same host we were just contacted by.  We will 
! 			     * also remove addresses if only the port has 
! 			     * changed because that indicates the client
  			     * is behind a NAT. 
  			     */
  			    removeInterfaceAddr_r(oldHost, oldHost->host, oldHost->port);
  			} else {
! 			    int i;
  			    struct Interface *interface = oldHost->interface;
  			    int number = oldHost->interface->numberOfInterfaces;
! 			    for (i = 0; i < number; i++) {
  				if (interface->interface[i].addr == haddr &&
  				    interface->interface[i].port != hport) {
! 				    /* 
! 				     * We have just been contacted by a client
! 				     * that has been seen from behind a NAT 
! 				     * and at least one other address.
! 				     */
! 				    removeInterfaceAddr_r(oldHost, haddr, 
! 							  interface->interface[i].port);
  				    break;
  				}
  			    }
  			}
! 			h_AddHostToAddrHashTable_r(haddr, hport, oldHost);
  			oldHost->host = haddr;
  			oldHost->port = hport;
  			rxconn = oldHost->callback_rxcon;
***************
*** 1929,1935 ****
  		    H_LOCK;
  		    if (code == 0) {
  			ViceLog(25,
! 				("InitCallBackState3 success on host %x (%s:%d)\n",
  				 host, afs_inet_ntoa_r(host->host, hoststr),
  				 ntohs(host->port)));
  			assert(interfValid == 1);
--- 2032,2038 ----
  		    H_LOCK;
  		    if (code == 0) {
  			ViceLog(25,
! 				("InitCallBackState3 success on host %" AFS_PTR_FMT " (%s:%d)\n",
  				 host, afs_inet_ntoa_r(host->host, hoststr),
  				 ntohs(host->port)));
  			assert(interfValid == 1);
***************
*** 1939,1950 ****
  	    }
  	    if (code) {
  		ViceLog(0,
! 			("CB: RCallBackConnectBack failed for %x (%s:%d)\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		host->hostFlags |= VENUSDOWN;
  	    } else {
  		ViceLog(125,
! 			("CB: RCallBackConnectBack succeeded for %x (%s:%d)\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		host->hostFlags |= RESETDONE;
  	    }
--- 2042,2053 ----
  	    }
  	    if (code) {
  		ViceLog(0,
! 			("CB: RCallBackConnectBack failed for %" AFS_PTR_FMT " (%s:%d)\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		host->hostFlags |= VENUSDOWN;
  	    } else {
  		ViceLog(125,
! 			("CB: RCallBackConnectBack succeeded for %" AFS_PTR_FMT " (%s:%d)\n",
  			 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		host->hostFlags |= RESETDONE;
  	    }
***************
*** 2271,2277 ****
  	    if (code) {
  		char hoststr[16];
  		ViceLog(0,
! 			("pr_GetCPS failed(%d) for user %d, host %x (%s:%d)\n",
  			 code, viceid, client->host, 
                           afs_inet_ntoa_r(client->host->host,hoststr),
  			 ntohs(client->host->port)));
--- 2374,2380 ----
  	    if (code) {
  		char hoststr[16];
  		ViceLog(0,
! 			("pr_GetCPS failed(%d) for user %d, host %" AFS_PTR_FMT " (%s:%d)\n",
  			 code, viceid, client->host, 
                           afs_inet_ntoa_r(client->host->host,hoststr),
  			 ntohs(client->host->port)));
***************
*** 3075,3087 ****
      h_diskEntryToHost_r(&hdsk, host);
      h_SetupCallbackConn_r(host);
  
      if (ifp) {
  	int i;
  	for (i = ifp->numberOfInterfaces-1; i >= 0; i--) {
  	}
  	h_AddHostToUuidHashTable_r(&ifp->uuid, host);
      }
-     h_AddHostToAddrHashTable_r(host->host, host->port, host);
      h_InsertList_r(host);
  
      /* setup host id map entry */
--- 3178,3197 ----
      h_diskEntryToHost_r(&hdsk, host);
      h_SetupCallbackConn_r(host);
  
+     h_AddHostToAddrHashTable_r(host->host, host->port, host);
      if (ifp) {
  	int i;
  	for (i = ifp->numberOfInterfaces-1; i >= 0; i--) {
+             if (ifp->interface[i].valid && 
+                 !(ifp->interface[i].addr == host->host &&
+                   ifp->interface[i].port == host->port)) {
+                 h_AddHostToAddrHashTable_r(ifp->interface[i].addr, 
+                                            ifp->interface[i].port, 
+                                            host);
+             }
  	}
  	h_AddHostToUuidHashTable_r(&ifp->uuid, host);
      }
      h_InsertList_r(host);
  
      /* setup host id map entry */
***************
*** 3436,3442 ****
  		     * back state, because break delayed callbacks (called when a
  		     * message is received from the workstation) will always send a 
  		     * break all call backs to the workstation if there is no
! 		     *callback.
  		     */
  		}
  	    } else {
--- 3546,3552 ----
  		     * back state, because break delayed callbacks (called when a
  		     * message is received from the workstation) will always send a 
  		     * break all call backs to the workstation if there is no
! 		     * callback.
  		     */
  		}
  	    } else {
***************
*** 3539,3545 ****
  		     * back state, because break delayed callbacks (called when a
  		     * message is received from the workstation) will always send a 
  		     * break all call backs to the workstation if there is no
! 		     *callback.
  		     */
  		}
  	    } else {
--- 3649,3655 ----
  		     * back state, because break delayed callbacks (called when a
  		     * message is received from the workstation) will always send a 
  		     * break all call backs to the workstation if there is no
! 		     * callback.
  		     */
  		}
  	    } else {
***************
*** 3612,3620 ****
  
  /*
   * This is called with host locked and held. At this point, the
!  * hostAddrHashTable should not have any entries for the alternate
!  * interfaces. This function has to insert these entries in the
!  * hostAddrHashTable.
   *
   * The addresses in the interfaceAddr list are in host byte order.
   */
--- 3722,3729 ----
  
  /*
   * This is called with host locked and held. At this point, the
!  * hostAddrHashTable has an entry for the primary addr/port inserted
!  * by h_Alloc_r().  No other interfaces should be considered valid.
   *
   * The addresses in the interfaceAddr list are in host byte order.
   */
***************
*** 3732,3738 ****
  	 * are coming from fully connected hosts (no NAT/PATs)
  	 */
  	interface->interface[i].port = port7001;
!         interface->interface[i].valid = 1;      /* valid until a conflict is found */
      }
  
      interface->uuid = interf->uuid;
--- 3841,3848 ----
  	 * are coming from fully connected hosts (no NAT/PATs)
  	 */
  	interface->interface[i].port = port7001;
!         interface->interface[i].valid = 
!             (interf->addr_in[i] == myAddr && port7001 == myPort) ? 1 : 0;
      }
  
      interface->uuid = interf->uuid;
***************
*** 3740,3752 ****
      assert(!host->interface);
      host->interface = interface;
  
!     afsUUID_to_string(&interface->uuid, uuidstr, 127);
! 
!     ViceLog(125, ("--- uuid %s\n", uuidstr));
!     for (i = 0; i < host->interface->numberOfInterfaces; i++) {
! 	ViceLog(125, ("--- alt address %s:%d\n", 
! 		       afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr),
! 		       ntohs(host->interface->interface[i].port)));
      }
  
      return 0;
--- 3850,3864 ----
      assert(!host->interface);
      host->interface = interface;
  
!     if (LogLevel >= 125) {
! 	afsUUID_to_string(&interface->uuid, uuidstr, 127);
! 	
! 	ViceLog(125, ("--- uuid %s\n", uuidstr));
! 	for (i = 0; i < host->interface->numberOfInterfaces; i++) {
! 	    ViceLog(125, ("--- alt address %s:%d\n", 
! 			  afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr),
! 			  ntohs(host->interface->interface[i].port)));
! 	}
      }
  
      return 0;
***************
*** 3755,3777 ****
  /* deleted a HashChain structure for this address and host */
  /* returns 1 on success */
  int
! h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host *host)
  {
!     int flag = 0;
      register struct h_AddrHashChain **hp, *th;
  
!     for (hp = &hostAddrHashTable[h_HashIndex(addr)]; (th = *hp);) {
! 	assert(th->hostPtr);
! 	if (th->hostPtr == host && th->addr == addr && th->port == port) {
! 	    *hp = th->next;
! 	    free(th);
! 	    flag = 1;
! 	    break;
! 	} else {
! 	    hp = &th->next;
! 	}
      }
!     return flag;
  }
  
  
--- 3867,3898 ----
  /* deleted a HashChain structure for this address and host */
  /* returns 1 on success */
  int
! h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port, 
! 				struct host *host)
  {
!     char hoststr[16];
      register struct h_AddrHashChain **hp, *th;
  
!     if (addr == 0 && port == 0)
! 	return 1;
! 
!     for (hp = &hostAddrHashTable[h_HashIndex(addr)]; (th = *hp); 
! 	 hp = &th->next) {
!         assert(th->hostPtr);
!         if (th->hostPtr == host && th->addr == addr && th->port == port) {
! 	    ViceLog(125, ("h_DeleteHostFromAddrHashTable_r: host %" AFS_PTR_FMT " (%s:%d)\n",
! 			  host, afs_inet_ntoa_r(host->host, hoststr),
! 			  ntohs(host->port)));
!             *hp = th->next;
!             free(th);
! 	    return 1;
!         }
      }
!     ViceLog(125, 
! 	    ("h_DeleteHostFromAddrHashTable_r: host %" AFS_PTR_FMT " (%s:%d) not found\n",
! 	     host, afs_inet_ntoa_r(host->host, hoststr), 
! 	     ntohs(host->port)));
!     return 0;
  }
  
  
Index: openafs/src/vlserver/NTMakefile
diff -c openafs/src/vlserver/NTMakefile:1.10.4.10 openafs/src/vlserver/NTMakefile:1.10.4.11
*** openafs/src/vlserver/NTMakefile:1.10.4.10	Wed Jul  2 08:49:28 2008
--- openafs/src/vlserver/NTMakefile	Mon May 25 17:31:28 2009
***************
*** 88,95 ****
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  
  $(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS)
  	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
--- 88,94 ----
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  $(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS)
  	$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
Index: openafs/src/vol/ihandle.c
diff -c openafs/src/vol/ihandle.c:1.19.8.6 openafs/src/vol/ihandle.c:1.19.8.7
*** openafs/src/vol/ihandle.c:1.19.8.6	Mon Mar 16 09:11:55 2009
--- openafs/src/vol/ihandle.c	Fri May 22 12:00:35 2009
***************
*** 15,21 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/ihandle.c,v 1.19.8.6 2009/03/16 13:11:55 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 15,21 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/ihandle.c,v 1.19.8.7 2009/05/22 16:00:35 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 803,812 ****
  	return 0;
  
      IH_LOCK;
      assert(ihP->ih_refcnt > 0);
      ih_fdclose(ihP);
  
!     IH_UNLOCK;
      return 0;
  }
  
--- 803,834 ----
  	return 0;
  
      IH_LOCK;
+     ihP->ih_refcnt++;   /* must not disappear over unlock */
+     if (ihP->ih_synced) {
+ 	FdHandle_t *fdP;
+ 	IH_UNLOCK;
+ 	
+ 	fdP = IH_OPEN(ihP);
+ 	if (fdP) { 
+ 	    OS_SYNC(fdP->fd_fd);
+ 	    FDH_CLOSE(fdP);
+ 	}
+ 	
+ 	IH_LOCK;
+     }
+ 
      assert(ihP->ih_refcnt > 0);
+     ihP->ih_synced = 0;
+ 
      ih_fdclose(ihP);
  
!     if (ihP->ih_refcnt > 1) {
! 	ihP->ih_refcnt--;
! 	IH_UNLOCK;
!     } else {
! 	IH_UNLOCK;
! 	ih_release(ihP);
!     }
      return 0;
  }
  
***************
*** 885,892 ****
  		IH_UNLOCK;
  
  		fdP = IH_OPEN(ihP);
! 		if (fdP) OS_SYNC(fdP->fd_fd);
! 		FDH_CLOSE(fdP);
  
  	  	IH_LOCK;
  	    }
--- 907,916 ----
  		IH_UNLOCK;
  
  		fdP = IH_OPEN(ihP);
! 		if (fdP) { 
! 		    OS_SYNC(fdP->fd_fd);
! 		    FDH_CLOSE(fdP);
! 		}
  
  	  	IH_LOCK;
  	    }
Index: openafs/src/vol/vnode.c
diff -c openafs/src/vol/vnode.c:1.27.2.8 openafs/src/vol/vnode.c:1.27.2.9
*** openafs/src/vol/vnode.c:1.27.2.8	Mon Mar 16 09:11:55 2009
--- openafs/src/vol/vnode.c	Fri May 22 12:00:35 2009
***************
*** 20,26 ****
  #define MAXINT     (~(1<<((sizeof(int)*8)-1)))
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vnode.c,v 1.27.2.8 2009/03/16 13:11:55 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
--- 20,26 ----
  #define MAXINT     (~(1<<((sizeof(int)*8)-1)))
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vnode.c,v 1.27.2.9 2009/05/22 16:00:35 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
***************
*** 1659,1665 ****
  
      for (i = 0; i < vec_len; i++) {
  	IH_REALLYCLOSE(ih_vec[i]);
-         IH_RELEASE(ih_vec[i]);
      }
  
      free(ih_vec);
--- 1659,1664 ----
Index: openafs/src/vol/volume.c
diff -c openafs/src/vol/volume.c:1.43.2.29 openafs/src/vol/volume.c:1.43.2.30
*** openafs/src/vol/volume.c:1.43.2.29	Thu Mar 26 19:42:13 2009
--- openafs/src/vol/volume.c	Tue Apr 28 10:37:51 2009
***************
*** 22,28 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/volume.c,v 1.43.2.29 2009/03/26 23:42:13 jaltman 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.30 2009/04/28 14:37:51 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
***************
*** 2337,2346 ****
  		break;
  
  	    case FSSYNC_VolOpRunningUnknown:
! 		vp->pending_vol_op->vol_op_state = 
! 		    (VVolOpLeaveOnline_r(vp, vp->pending_vol_op) ? 
! 		     FSSYNC_VolOpRunningOnline : FSSYNC_VolOpRunningOffline);
! 		/* fall through */
  
  	    case FSSYNC_VolOpRunningOffline:
  		/* mark the volume down */
--- 2337,2349 ----
  		break;
  
  	    case FSSYNC_VolOpRunningUnknown:
! 		if (VVolOpLeaveOnline_r(vp, vp->pending_vol_op)) {
! 		    vp->pending_vol_op->vol_op_state = FSSYNC_VolOpRunningOnline;
! 		    break;
! 		} else {
! 		    vp->pending_vol_op->vol_op_state = FSSYNC_VolOpRunningOffline;
! 		    /* fall through to take volume offline */
! 		}
  
  	    case FSSYNC_VolOpRunningOffline:
  		/* mark the volume down */
Index: openafs/src/volser/NTMakefile
diff -c openafs/src/volser/NTMakefile:1.11.2.6 openafs/src/volser/NTMakefile:1.11.2.7
*** openafs/src/volser/NTMakefile:1.11.2.6	Tue Mar 24 18:36:25 2009
--- openafs/src/volser/NTMakefile	Mon May 25 17:31:29 2009
***************
*** 70,77 ****
  	$(DESTDIR)\lib\afs\afsacl.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
!         $(DESTDIR)\lib\cm_dns.obj \
!         $(DESTDIR)\lib\cm_nls.obj
  
  
  ############################################################################
--- 70,76 ----
  	$(DESTDIR)\lib\afs\afsacl.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\libafsconf.lib
  
  
  ############################################################################
Index: openafs/src/volser/vol_split.c
diff -c openafs/src/volser/vol_split.c:1.1.2.6 openafs/src/volser/vol_split.c:1.1.2.7
*** openafs/src/volser/vol_split.c:1.1.2.6	Tue Mar 24 18:36:25 2009
--- openafs/src/volser/vol_split.c	Thu May 14 16:50:53 2009
***************
*** 361,367 ****
  		FdHandle_t *infdP = 0;
  		FdHandle_t *outfdP = 0;
  		char *tbuf = malloc(2048);
! #if defined(NEARINODE_HINT)
  		Inode nearInode;
  		V_pref(vol,nearInode)
  #endif
--- 361,367 ----
  		FdHandle_t *infdP = 0;
  		FdHandle_t *outfdP = 0;
  		char *tbuf = malloc(2048);
! #if defined(NEARINODE_HINT) && !defined(AFS_NAMEI_ENV)
  		Inode nearInode;
  		V_pref(vol,nearInode)
  #endif
***************
*** 396,402 ****
  	        if (ino) {
  		    IHandle_t *h, *newh;
  		    Inode nearInode;
! #if defined(NEARINODE_HINT)
  		    V_pref(vol,nearInode)
  #endif
  	            IH_INIT(h, vol->device, V_parentId(vol), ino);
--- 396,402 ----
  	        if (ino) {
  		    IHandle_t *h, *newh;
  		    Inode nearInode;
! #if defined(NEARINODE_HINT) && !defined(AFS_NAMEI_ENV)
  		    V_pref(vol,nearInode)
  #endif
  	            IH_INIT(h, vol->device, V_parentId(vol), ino);
***************
*** 564,570 ****
      vnode.parent = vN;
  
      newvN = (offset >> (VnodeClassInfo[class].logSize - 1)) - 1 + class;
! #if defined(NEARINODE_HINT)
      V_pref(vol,nearInode)
  #endif
      newino = IH_CREATE(V_linkHandle(vol), V_device(vol),
--- 564,570 ----
      vnode.parent = vN;
  
      newvN = (offset >> (VnodeClassInfo[class].logSize - 1)) - 1 + class;
! #if defined(NEARINODE_HINT) && !defined(AFS_NAMEI_ENV)
      V_pref(vol,nearInode)
  #endif
      newino = IH_CREATE(V_linkHandle(vol), V_device(vol),
Index: openafs/src/volser/volprocs.c
diff -c openafs/src/volser/volprocs.c:1.42.2.23 openafs/src/volser/volprocs.c:1.42.2.24
*** openafs/src/volser/volprocs.c:1.42.2.23	Tue Mar 24 18:36:25 2009
--- openafs/src/volser/volprocs.c	Tue May 26 22:46:53 2009
***************
*** 13,19 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.42.2.23 2009/03/24 22:36:25 jaltman Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 13,19 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.42.2.24 2009/05/27 02:46:53 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 583,589 ****
      ttc = NewTrans(newId, tt->partition);
      if (!ttc) {			/* someone is messing with the clone already */
  	TRELE(tt);
! 	return VBUSY;
      }
      strcpy(tt->lastProcName, "Clone");
      tt->rxCallPtr = acid;
--- 583,589 ----
      ttc = NewTrans(newId, tt->partition);
      if (!ttc) {			/* someone is messing with the clone already */
  	TRELE(tt);
! 	return VOLSERVOLBUSY;
      }
      strcpy(tt->lastProcName, "Clone");
      tt->rxCallPtr = acid;
***************
*** 755,761 ****
      ttc = NewTrans(cloneId, tt->partition);
      if (!ttc) {			/* someone is messing with the clone already */
  	TRELE(tt);
! 	return VBUSY;
      }
      strcpy(tt->lastProcName, "ReClone");
      tt->rxCallPtr = acid;
--- 755,761 ----
      ttc = NewTrans(cloneId, tt->partition);
      if (!ttc) {			/* someone is messing with the clone already */
  	TRELE(tt);
! 	return VOLSERVOLBUSY;
      }
      strcpy(tt->lastProcName, "ReClone");
      tt->rxCallPtr = acid;
***************
*** 2069,2075 ****
      ttc = NewTrans(volumeId, partId);
      if (!ttc) {
  	code = -3;
! 	VOLINT_INFO_STORE(handle, status, VBUSY);
  	VOLINT_INFO_STORE(handle, volid, volumeId);
  	goto drop;
      }
--- 2069,2075 ----
      ttc = NewTrans(volumeId, partId);
      if (!ttc) {
  	code = -3;
! 	VOLINT_INFO_STORE(handle, status, VOLSERVOLBUSY);
  	VOLINT_INFO_STORE(handle, volid, volumeId);
  	goto drop;
      }
***************
*** 2868,2874 ****
  #endif
              ttc = NewTrans(volumeId, partId);
              if (!ttc) {
! 		return VBUSY;
              }
  #ifdef AFS_NAMEI_ENV
  	    ret = namei_ConvertROtoRWvolume(pname, volumeId);
--- 2868,2874 ----
  #endif
              ttc = NewTrans(volumeId, partId);
              if (!ttc) {
! 		return VOLSERVOLBUSY;
              }
  #ifdef AFS_NAMEI_ENV
  	    ret = namei_ConvertROtoRWvolume(pname, volumeId);
Index: openafs/src/volser/vos.c
diff -c openafs/src/volser/vos.c:1.55.2.23 openafs/src/volser/vos.c:1.55.2.24
*** openafs/src/volser/vos.c:1.55.2.23	Mon Mar 23 14:19:08 2009
--- openafs/src/volser/vos.c	Mon Apr 27 16:18:12 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.55.2.23 2009/03/23 18:19:08 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.24 2009/04/27 20:18:12 jaltman Exp $");
  
  #include <sys/types.h>
  #include <string.h>
***************
*** 5894,5900 ****
      cmd_AddParm(ts, "-partition", CMD_SINGLE, 0,
  		"partition name for new site");
      cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
!     cmd_AddParm(ts, "-valid", CMD_FLAG, CMD_OPTIONAL | CMD_HIDE, "publish as an up-to-date site in VLDB");
      COMMONPARMS;
  
      ts = cmd_CreateSyntax("remsite", RemoveSite, NULL,
--- 5894,5900 ----
      cmd_AddParm(ts, "-partition", CMD_SINGLE, 0,
  		"partition name for new site");
      cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
!     cmd_AddParm(ts, "-valid", CMD_FLAG, CMD_OPTIONAL, "publish as an up-to-date site in VLDB");
      COMMONPARMS;
  
      ts = cmd_CreateSyntax("remsite", RemoveSite, NULL,
***************
*** 5960,5966 ****
      cmd_AddParm(ts, "-clearVolUpCounter", CMD_FLAG, CMD_OPTIONAL, "clear volUpdateCounter");
      COMMONPARMS;
  
!     ts = cmd_CreateSyntax("offline", volOffline, NULL, (char *)CMD_HIDDEN);
      cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "server name");
      cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
      cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
--- 5960,5966 ----
      cmd_AddParm(ts, "-clearVolUpCounter", CMD_FLAG, CMD_OPTIONAL, "clear volUpdateCounter");
      COMMONPARMS;
  
!     ts = cmd_CreateSyntax("offline", volOffline, NULL, "force the volume status to offline");
      cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "server name");
      cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
      cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
***************
*** 5968,5974 ****
      cmd_AddParm(ts, "-busy", CMD_FLAG, CMD_OPTIONAL, "busy volume");
      COMMONPARMS;
  
!     ts = cmd_CreateSyntax("online", volOnline, NULL, (char *)CMD_HIDDEN);
      cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "server name");
      cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
      cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
--- 5968,5974 ----
      cmd_AddParm(ts, "-busy", CMD_FLAG, CMD_OPTIONAL, "busy volume");
      COMMONPARMS;
  
!     ts = cmd_CreateSyntax("online", volOnline, NULL, "force the volume status to online");
      cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "server name");
      cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name");
      cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
***************
*** 6026,6032 ****
  		"prefix of the volume whose VLDB entry is to be deleted");
      cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_OPTIONAL, "machine name");
      cmd_AddParm(ts, "-partition", CMD_SINGLE, CMD_OPTIONAL, "partition name");
!     cmd_AddParm(ts, "-noexecute", CMD_FLAG, CMD_OPTIONAL | CMD_HIDE,
  		"no execute");
      COMMONPARMS;
  
--- 6026,6032 ----
  		"prefix of the volume whose VLDB entry is to be deleted");
      cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_OPTIONAL, "machine name");
      cmd_AddParm(ts, "-partition", CMD_SINGLE, CMD_OPTIONAL, "partition name");
!     cmd_AddParm(ts, "-noexecute", CMD_FLAG, CMD_OPTIONAL,
  		"no execute");
      COMMONPARMS;
  
Index: openafs/src/volser/vsprocs.c
diff -c openafs/src/volser/vsprocs.c:1.38.2.21 openafs/src/volser/vsprocs.c:1.38.2.22
*** openafs/src/volser/vsprocs.c:1.38.2.21	Mon Mar 23 14:19:08 2009
--- openafs/src/volser/vsprocs.c	Tue May 26 22:46:53 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.38.2.21 2009/03/23 18:19:08 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.22 2009/05/27 02:46:53 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 448,453 ****
--- 448,496 ----
      return tc;
  }
  
+ static int 
+ AFSVolCreateVolume_retry(struct rx_connection *z_conn,
+ 		       afs_int32 partition, char *name, afs_int32 type,
+ 		       afs_int32 parent, afs_int32 *volid, afs_int32 *trans)
+ {
+     afs_int32 code;
+     int retries = 3;
+     while (retries) {
+ 	code = AFSVolCreateVolume(z_conn, partition, name, type, parent,
+ 				  volid, trans);
+         if (code != VOLSERVOLBUSY)
+             break;
+         retries--;
+ #ifdef AFS_PTHREAD_ENV
+         sleep(3-retries);
+ #else
+         IOMGR_Sleep(3-retries);
+ #endif
+     }
+     return code;
+ }
+ 
+ static int 
+ AFSVolTransCreate_retry(struct rx_connection *z_conn,
+ 			afs_int32 volume, afs_int32 partition, 
+ 			afs_int32 flags, afs_int32 * trans) 
+ {
+     afs_int32 code;
+     int retries = 3;
+     while (retries) {
+ 	code = AFSVolTransCreate(z_conn, volume, partition, flags, trans);
+         if (code != VOLSERVOLBUSY)
+             break;
+         retries--;
+ #ifdef AFS_PTHREAD_ENV
+         sleep(3-retries);
+ #else
+         IOMGR_Sleep(3-retries);
+ #endif
+     }
+     return code;
+ }
+ 
  /* if <okvol> is allright(indicated by beibg able to
   * start a transaction, delete the <delvol> */
  static afs_int32
***************
*** 455,466 ****
  		     afs_uint32 okvol, afs_uint32 delvol)
  {
      afs_int32 error, code, tid, rcode;
- 
      error = 0;
      code = 0;
  
      if (okvol == 0) {
! 	code = AFSVolTransCreate(aconn, delvol, apart, ITOffline, &tid);
  	if (!error && code)
  	    error = code;
  	code = AFSVolDeleteVolume(aconn, tid);
--- 498,508 ----
  		     afs_uint32 okvol, afs_uint32 delvol)
  {
      afs_int32 error, code, tid, rcode;
      error = 0;
      code = 0;
  
      if (okvol == 0) {
! 	code = AFSVolTransCreate_retry(aconn, delvol, apart, ITOffline, &tid);
  	if (!error && code)
  	    error = code;
  	code = AFSVolDeleteVolume(aconn, tid);
***************
*** 473,486 ****
  	    error = code;
  	return error;
      } else {
! 	code = AFSVolTransCreate(aconn, okvol, apart, ITOffline, &tid);
  	if (!code) {
  	    code = AFSVolEndTrans(aconn, tid, &rcode);
  	    if (!code)
  		code = rcode;
  	    if (!error && code)
  		error = code;
! 	    code = AFSVolTransCreate(aconn, delvol, apart, ITOffline, &tid);
  	    if (!error && code)
  		error = code;
  	    code = AFSVolDeleteVolume(aconn, tid);
--- 515,528 ----
  	    error = code;
  	return error;
      } else {
! 	code = AFSVolTransCreate_retry(aconn, okvol, apart, ITOffline, &tid);
  	if (!code) {
  	    code = AFSVolEndTrans(aconn, tid, &rcode);
  	    if (!code)
  		code = rcode;
  	    if (!error && code)
  		error = code;
! 	    code = AFSVolTransCreate_retry(aconn, delvol, apart, ITOffline, &tid);
  	    if (!error && code)
  		error = code;
  	    code = AFSVolDeleteVolume(aconn, tid);
***************
*** 644,650 ****
  		 afs_int32 aquota, afs_int32 aspare1, afs_int32 aspare2,
  		 afs_int32 aspare3, afs_int32 aspare4, afs_uint32 * anewid)
  {
- 
      register struct rx_connection *aconn;
      afs_int32 tid;
      register afs_int32 code;
--- 686,691 ----
***************
*** 664,673 ****
      /* next the next 3 available ids from the VLDB */
      vcode = ubik_VL_GetNewVolumeId(cstruct, 0, 3, anewid);
      EGOTO1(cfail, vcode, "Could not get an Id for volume %s\n", aname);
- 
      code =
! 	AFSVolCreateVolume(aconn, apart, aname, volser_RW, 0, anewid, &tid);
!     EGOTO2(cfail, vcode, "Failed to create the volume %s %u \n", aname,
  	   *anewid);
  
      code = AFSVolSetInfo(aconn, tid, &tstatus);
--- 705,713 ----
      /* next the next 3 available ids from the VLDB */
      vcode = ubik_VL_GetNewVolumeId(cstruct, 0, 3, anewid);
      EGOTO1(cfail, vcode, "Could not get an Id for volume %s\n", aname);
      code =
!       AFSVolCreateVolume_retry(aconn, apart, aname, volser_RW, 0, anewid, &tid);
!     EGOTO2(cfail, code, "Failed to create the volume %s %u \n", aname,
  	   *anewid);
  
      code = AFSVolSetInfo(aconn, tid, &tstatus);
***************
*** 732,739 ****
  	rx_DestroyConnection(aconn);
      PrintError("", error);
      return error;
- 
- 
  }
  
  /* create a volume, given a server, partition number, volume name --> sends
--- 772,777 ----
***************
*** 827,833 ****
  
      /* Whether volume is in the VLDB or not. Delete the volume on disk */
      aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
!     code = AFSVolTransCreate(aconn, avolid, apart, ITOffline, &ttid);
      if (code) {
  	if (code == VNOVOL) {
  	    notondisk = 1;
--- 865,871 ----
  
      /* Whether volume is in the VLDB or not. Delete the volume on disk */
      aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
!     code = AFSVolTransCreate_retry(aconn, avolid, apart, ITOffline, &ttid);
      if (code) {
  	if (code == VNOVOL) {
  	    notondisk = 1;
***************
*** 906,913 ****
  
  	/* Delete backup if it exists */
  	code =
! 	    AFSVolTransCreate(aconn, entry.volumeId[BACKVOL], apart,
! 			      ITOffline, &ttid);
  	if (!code) {
  	    if (verbose) {
  		fprintf(STDOUT, "Trying to delete the backup volume %u ...",
--- 944,952 ----
  
  	/* Delete backup if it exists */
  	code =
! 	    AFSVolTransCreate_retry(aconn, entry.volumeId[BACKVOL], apart,
! 				    ITOffline, &ttid);
! 
  	if (!code) {
  	    if (verbose) {
  		fprintf(STDOUT, "Trying to delete the backup volume %u ...",
***************
*** 1179,1186 ****
  	pntg = 1;
  
  	code =
! 	    AFSVolTransCreate(fromconn, afromvol, afrompart, ITOffline,
! 			      &fromtid);
  	if (!code) {		/* volume exists - delete it */
  	    VPRINT1("Setting flags on leftover source volume %u ...",
  		    afromvol);
--- 1218,1226 ----
  	pntg = 1;
  
  	code =
! 	    AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITOffline,
! 				    &fromtid);
! 
  	if (!code) {		/* volume exists - delete it */
  	    VPRINT1("Setting flags on leftover source volume %u ...",
  		    afromvol);
***************
*** 1214,1221 ****
  	/*delete the backup volume now */
  	fromtid = 0;
  	code =
! 	    AFSVolTransCreate(fromconn, backupId, afrompart, ITOffline,
! 			      &fromtid);
  	if (!code) {		/* backup volume exists - delete it */
  	    VPRINT1("Setting flags on leftover backup volume %u ...",
  		    backupId);
--- 1254,1262 ----
  	/*delete the backup volume now */
  	fromtid = 0;
  	code =
! 	    AFSVolTransCreate_retry(fromconn, backupId, afrompart, ITOffline,
! 				    &fromtid);
! 
  	if (!code) {		/* backup volume exists - delete it */
  	    VPRINT1("Setting flags on leftover backup volume %u ...",
  		    backupId);
***************
*** 1277,1283 ****
       * ***/
  
      VPRINT1("Starting transaction on source volume %u ...", afromvol);
!     code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(mfail, code, "Failed to create transaction on the volume %u\n",
  	   afromvol);
      VDONE;
--- 1318,1324 ----
       * ***/
  
      VPRINT1("Starting transaction on source volume %u ...", afromvol);
!     code = AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(mfail, code, "Failed to create transaction on the volume %u\n",
  	   afromvol);
      VDONE;
***************
*** 1328,1334 ****
  	/* All of this is to get the fromDate */
  	VPRINT1("Starting transaction on the cloned volume %u ...", newVol);
  	code =
! 	    AFSVolTransCreate(fromconn, newVol, afrompart, ITOffline,
  			      &clonetid);
  	EGOTO1(mfail, code,
  	       "Failed to start a transaction on the cloned volume%u\n",
--- 1369,1375 ----
  	/* All of this is to get the fromDate */
  	VPRINT1("Starting transaction on the cloned volume %u ...", newVol);
  	code =
! 	    AFSVolTransCreate_retry(fromconn, newVol, afrompart, ITOffline,
  			      &clonetid);
  	EGOTO1(mfail, code,
  	       "Failed to start a transaction on the cloned volume%u\n",
***************
*** 1379,1385 ****
  
      /* create a volume on the target machine */
      volid = afromvol;
!     code = AFSVolTransCreate(toconn, volid, atopart, ITOffline, &totid);
      if (!code) {
  	/* Delete the existing volume.
  	 * While we are deleting the volume in these steps, the transaction
--- 1420,1426 ----
  
      /* create a volume on the target machine */
      volid = afromvol;
!     code = AFSVolTransCreate_retry(toconn, volid, atopart, ITOffline, &totid);
      if (!code) {
  	/* Delete the existing volume.
  	 * While we are deleting the volume in these steps, the transaction
***************
*** 1464,1470 ****
       * ***/
  
      VPRINT1("Starting transaction on source volume %u ...", afromvol);
!     code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(mfail, code,
  	   "Failed to create a transaction on the source volume %u\n",
  	   afromvol);
--- 1505,1511 ----
       * ***/
  
      VPRINT1("Starting transaction on source volume %u ...", afromvol);
!     code = AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(mfail, code,
  	   "Failed to create a transaction on the source volume %u\n",
  	   afromvol);
***************
*** 1616,1622 ****
      VPRINT1("Creating transaction for backup volume %u on source ...",
  	    backupId);
      code =
! 	AFSVolTransCreate(fromconn, backupId, afrompart, ITOffline, &fromtid);
      VDONE;
      if (!code) {
  	VPRINT1("Setting flags on backup volume %u on source ...", backupId);
--- 1657,1663 ----
      VPRINT1("Creating transaction for backup volume %u on source ...",
  	    backupId);
      code =
! 	AFSVolTransCreate_retry(fromconn, backupId, afrompart, ITOffline, &fromtid);
      VDONE;
      if (!code) {
  	VPRINT1("Setting flags on backup volume %u on source ...", backupId);
***************
*** 1652,1658 ****
      if (!(flags & RV_NOCLONE)) {
  	VPRINT1("Starting transaction on the cloned volume %u ...", newVol);
  	code =
! 	    AFSVolTransCreate(fromconn, newVol, afrompart, ITOffline,
  			      &clonetid);
  	EGOTO1(mfail, code,
  	       "Failed to start a transaction on the cloned volume%u\n",
--- 1693,1699 ----
      if (!(flags & RV_NOCLONE)) {
  	VPRINT1("Starting transaction on the cloned volume %u ...", newVol);
  	code =
! 	    AFSVolTransCreate_retry(fromconn, newVol, afrompart, ITOffline,
  			      &clonetid);
  	EGOTO1(mfail, code,
  	       "Failed to start a transaction on the cloned volume%u\n",
***************
*** 1839,1845 ****
  		("Recovery: Creating transaction for destination volume %u ...",
  		 volid);
  	    code =
! 		AFSVolTransCreate(toconn, volid, atopart, ITOffline, &totid);
  
  	    if (!code) {
  		VDONE;
--- 1880,1886 ----
  		("Recovery: Creating transaction for destination volume %u ...",
  		 volid);
  	    code =
! 		AFSVolTransCreate_retry(toconn, volid, atopart, ITOffline, &totid);
  
  	    if (!code) {
  		VDONE;
***************
*** 1873,1879 ****
  	    VPRINT1("Recovery: Creating transaction on source volume %u ...",
  		    afromvol);
  	    code =
! 		AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy,
  				  &fromtid);
  	    if (!code) {
  		VDONE;
--- 1914,1920 ----
  	    VPRINT1("Recovery: Creating transaction on source volume %u ...",
  		    afromvol);
  	    code =
! 		AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy,
  				  &fromtid);
  	    if (!code) {
  		VDONE;
***************
*** 1906,1912 ****
  	    VPRINT1("Recovery: Creating transaction on backup volume %u ...",
  		    backupId);
  	    code =
! 		AFSVolTransCreate(fromconn, backupId, afrompart, ITOffline,
  				  &fromtid);
  	    if (!code) {
  		VDONE;
--- 1947,1953 ----
  	    VPRINT1("Recovery: Creating transaction on backup volume %u ...",
  		    backupId);
  	    code =
! 		AFSVolTransCreate_retry(fromconn, backupId, afrompart, ITOffline,
  				  &fromtid);
  	    if (!code) {
  		VDONE;
***************
*** 1936,1942 ****
  	    VPRINT1("Recovery: Creating transaction on source volume %u ...",
  		    afromvol);
  	    code =
! 		AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy,
  				  &fromtid);
  	    if (!code) {
  		VDONE;
--- 1977,1983 ----
  	    VPRINT1("Recovery: Creating transaction on source volume %u ...",
  		    afromvol);
  	    code =
! 		AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy,
  				  &fromtid);
  	    if (!code) {
  		VDONE;
***************
*** 1975,1981 ****
  	VPRINT1("Recovery: Creating transaction on clone volume %u ...",
  		newVol);
  	code =
! 	    AFSVolTransCreate(fromconn, newVol, afrompart, ITOffline,
  			      &clonetid);
  	if (!code) {
  	    VDONE;
--- 2016,2022 ----
  	VPRINT1("Recovery: Creating transaction on clone volume %u ...",
  		newVol);
  	code =
! 	    AFSVolTransCreate_retry(fromconn, newVol, afrompart, ITOffline,
  			      &clonetid);
  	if (!code) {
  	    VDONE;
***************
*** 2105,2111 ****
      cloneVol = 0;
      if (!(flags & RV_NOCLONE)) {
  	VPRINT1("Starting transaction on source volume %u ...", afromvol);
! 	code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy,
  				 &fromtid);
  	EGOTO1(mfail, code, "Failed to create transaction on the volume %u\n",
  	       afromvol);
--- 2146,2152 ----
      cloneVol = 0;
      if (!(flags & RV_NOCLONE)) {
  	VPRINT1("Starting transaction on source volume %u ...", afromvol);
! 	code = AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy,
  				 &fromtid);
  	EGOTO1(mfail, code, "Failed to create transaction on the volume %u\n",
  	       afromvol);
***************
*** 2165,2171 ****
      if (!(flags & RV_NOCLONE)) {
  	VPRINT1("Starting transaction on the cloned volume %u ...", cloneVol);
  	code =
! 	    AFSVolTransCreate(fromconn, cloneVol, afrompart, ITOffline,
  			  &clonetid);
  	EGOTO1(mfail, code,
  	       "Failed to start a transaction on the cloned volume%u\n",
--- 2206,2212 ----
      if (!(flags & RV_NOCLONE)) {
  	VPRINT1("Starting transaction on the cloned volume %u ...", cloneVol);
  	code =
! 	    AFSVolTransCreate_retry(fromconn, cloneVol, afrompart, ITOffline,
  			  &clonetid);
  	EGOTO1(mfail, code,
  	       "Failed to start a transaction on the cloned volume%u\n",
***************
*** 2195,2201 ****
  
      /* create a volume on the target machine */
      cloneFromDate = 0;
!     code = AFSVolTransCreate(toconn, newVol, atopart, ITOffline, &totid);
      if (!code) {
  	if ((flags & RV_CPINCR)) {
  	    VPRINT1("Getting status of pre-existing volume %u ...", newVol);
--- 2236,2242 ----
  
      /* create a volume on the target machine */
      cloneFromDate = 0;
!     code = AFSVolTransCreate_retry(toconn, newVol, atopart, ITOffline, &totid);
      if (!code) {
  	if ((flags & RV_CPINCR)) {
  	    VPRINT1("Getting status of pre-existing volume %u ...", newVol);
***************
*** 2304,2310 ****
       * ***/
  
      VPRINT1("Starting transaction on source volume %u ...", afromvol);
!     code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(mfail, code,
  	   "Failed to create a transaction on the source volume %u\n",
  	   afromvol);
--- 2345,2351 ----
       * ***/
  
      VPRINT1("Starting transaction on source volume %u ...", afromvol);
!     code = AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(mfail, code,
  	   "Failed to create a transaction on the source volume %u\n",
  	   afromvol);
***************
*** 2356,2362 ****
      if (!(flags & RV_NOCLONE)) {
  	VPRINT1("Starting transaction on the cloned volume %u ...", cloneVol);
  	code =
! 	    AFSVolTransCreate(fromconn, cloneVol, afrompart, ITOffline,
  			      &clonetid);
  	EGOTO1(mfail, code,
  	       "Failed to start a transaction on the cloned volume%u\n",
--- 2397,2403 ----
      if (!(flags & RV_NOCLONE)) {
  	VPRINT1("Starting transaction on the cloned volume %u ...", cloneVol);
  	code =
! 	    AFSVolTransCreate_retry(fromconn, cloneVol, afrompart, ITOffline,
  			      &clonetid);
  	EGOTO1(mfail, code,
  	       "Failed to start a transaction on the cloned volume%u\n",
***************
*** 2505,2511 ****
  	VPRINT1("Recovery: Creating transaction on clone volume %u ...",
  		cloneVol);
  	code =
! 	    AFSVolTransCreate(fromconn, cloneVol, afrompart, ITOffline,
  			      &clonetid);
  	if (!code) {
  	    VDONE;
--- 2546,2552 ----
  	VPRINT1("Recovery: Creating transaction on clone volume %u ...",
  		cloneVol);
  	code =
! 	    AFSVolTransCreate_retry(fromconn, cloneVol, afrompart, ITOffline,
  			      &clonetid);
  	if (!code) {
  	    VDONE;
***************
*** 2635,2641 ****
      /* Test to see if the backup volume exists by trying to create
       * a transaction on the backup volume. We've assumed the backup exists.
       */
!     code = AFSVolTransCreate(aconn, backupID, apart, ITOffline, &btid);
      if (code) {
  	if (code != VNOVOL) {
  	    fprintf(STDERR, "Could not reach the backup volume %lu\n",
--- 2676,2682 ----
      /* Test to see if the backup volume exists by trying to create
       * a transaction on the backup volume. We've assumed the backup exists.
       */
!     code = AFSVolTransCreate_retry(aconn, backupID, apart, ITOffline, &btid);
      if (code) {
  	if (code != VNOVOL) {
  	    fprintf(STDERR, "Could not reach the backup volume %lu\n",
***************
*** 2660,2666 ****
      /* Now go ahead and try to clone the RW volume.
       * First start a transaction on the RW volume 
       */
!     code = AFSVolTransCreate(aconn, avolid, apart, ITBusy, &ttid);
      if (code) {
  	fprintf(STDERR, "Could not start a transaction on the volume %lu\n",
  		(unsigned long)avolid);
--- 2701,2707 ----
      /* Now go ahead and try to clone the RW volume.
       * First start a transaction on the RW volume 
       */
!     code = AFSVolTransCreate_retry(aconn, avolid, apart, ITBusy, &ttid);
      if (code) {
  	fprintf(STDERR, "Could not start a transaction on the volume %lu\n",
  		(unsigned long)avolid);
***************
*** 2714,2720 ****
      }
  
      /* Now go back to the backup volume and bring it on line */
!     code = AFSVolTransCreate(aconn, backupID, apart, ITOffline, &btid);
      if (code) {
  	fprintf(STDERR,
  		"Failed to start a transaction on the backup volume %lu\n",
--- 2755,2761 ----
      }
  
      /* Now go back to the backup volume and bring it on line */
!     code = AFSVolTransCreate_retry(aconn, backupID, apart, ITOffline, &btid);
      if (code) {
  	fprintf(STDERR,
  		"Failed to start a transaction on the backup volume %lu\n",
***************
*** 2862,2868 ****
       * a transaction on the clone volume. We've assumed the clone exists.
       */
      /* XXX I wonder what happens if the clone has some other parent... */
!     code = AFSVolTransCreate(aconn, acloneid, apart, ITOffline, &btid);
      if (code) {
  	if (code != VNOVOL) {
  	    fprintf(STDERR, "Could not reach the clone volume %lu\n",
--- 2903,2909 ----
       * a transaction on the clone volume. We've assumed the clone exists.
       */
      /* XXX I wonder what happens if the clone has some other parent... */
!     code = AFSVolTransCreate_retry(aconn, acloneid, apart, ITOffline, &btid);
      if (code) {
  	if (code != VNOVOL) {
  	    fprintf(STDERR, "Could not reach the clone volume %lu\n",
***************
*** 2887,2893 ****
      /* Now go ahead and try to clone the RW volume.
       * First start a transaction on the RW volume 
       */
!     code = AFSVolTransCreate(aconn, avolid, apart, ITBusy, &ttid);
      if (code) {
  	fprintf(STDERR, "Could not start a transaction on the volume %lu\n",
  		(unsigned long)avolid);
--- 2928,2934 ----
      /* Now go ahead and try to clone the RW volume.
       * First start a transaction on the RW volume 
       */
!     code = AFSVolTransCreate_retry(aconn, avolid, apart, ITBusy, &ttid);
      if (code) {
  	fprintf(STDERR, "Could not start a transaction on the volume %lu\n",
  		(unsigned long)avolid);
***************
*** 2935,2941 ****
  
      /* Now go back to the backup volume and bring it on line */
      if (!(flags & RV_OFFLINE)) {
! 	code = AFSVolTransCreate(aconn, acloneid, apart, ITOffline, &btid);
  	if (code) {
  	    fprintf(STDERR,
  		    "Failed to start a transaction on the clone volume %lu\n",
--- 2976,2982 ----
  
      /* Now go back to the backup volume and bring it on line */
      if (!(flags & RV_OFFLINE)) {
! 	code = AFSVolTransCreate_retry(aconn, acloneid, apart, ITOffline, &btid);
  	if (code) {
  	    fprintf(STDERR,
  		    "Failed to start a transaction on the clone volume %lu\n",
***************
*** 3001,3007 ****
      afs_int32 acode, ccode, rcode, tid;
      ccode = rcode = tid = 0;
  
!     acode = AFSVolTransCreate(conn, vid, part, flags, &tid);
      if (!acode) {		/* It really was there */
  	acode = AFSVolDeleteVolume(conn, tid);
  	if (acode) {
--- 3042,3048 ----
      afs_int32 acode, ccode, rcode, tid;
      ccode = rcode = tid = 0;
  
!     acode = AFSVolTransCreate_retry(conn, vid, part, flags, &tid);
      if (!acode) {		/* It really was there */
  	acode = AFSVolDeleteVolume(conn, tid);
  	if (acode) {
***************
*** 3053,3059 ****
      volid = vldbEntryPtr->volumeId[ROVOL];
      if (volid)
  	code =
! 	    AFSVolTransCreate(*connPtr, volid,
  			      vldbEntryPtr->serverPartition[index], ITOffline,
  			      transPtr);
  
--- 3094,3100 ----
      volid = vldbEntryPtr->volumeId[ROVOL];
      if (volid)
  	code =
! 	    AFSVolTransCreate_retry(*connPtr, volid,
  			      vldbEntryPtr->serverPartition[index], ITOffline,
  			      transPtr);
  
***************
*** 3289,3295 ****
  	    fullrelease = 1;	/* Do a full release if RO clone does not exist */
  	else {
  	    /* Begin transaction on RW and mark it busy while we query it */
! 	    code = AFSVolTransCreate(
  			fromconn, afromvol, afrompart, ITBusy, &fromtid
  		   );
  	    ONERROR(code, afromvol,
--- 3330,3336 ----
  	    fullrelease = 1;	/* Do a full release if RO clone does not exist */
  	else {
  	    /* Begin transaction on RW and mark it busy while we query it */
! 	    code = AFSVolTransCreate_retry(
  			fromconn, afromvol, afrompart, ITBusy, &fromtid
  		   );
  	    ONERROR(code, afromvol,
***************
*** 3309,3315 ****
  		    "Failed to end transaction on RW volume %u\n");
  
  	    /* Begin transaction on clone and mark it busy while we query it */
! 	    code = AFSVolTransCreate(
  			fromconn, cloneVolId, afrompart, ITBusy, &clonetid
  		   );
  	    ONERROR(code, cloneVolId,
--- 3350,3356 ----
  		    "Failed to end transaction on RW volume %u\n");
  
  	    /* Begin transaction on clone and mark it busy while we query it */
! 	    code = AFSVolTransCreate_retry(
  			fromconn, cloneVolId, afrompart, ITBusy, &clonetid
  		   );
  	    ONERROR(code, cloneVolId,
***************
*** 3375,3381 ****
  
  	/* Begin transaction on RW and mark it busy while we clone it */
  	code =
! 	    AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy,
  			      &clonetid);
  	ONERROR(code, afromvol, "Failed to start transaction on volume %u\n");
  
--- 3416,3422 ----
  
  	/* Begin transaction on RW and mark it busy while we clone it */
  	code =
! 	    AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy,
  			      &clonetid);
  	ONERROR(code, afromvol, "Failed to start transaction on volume %u\n");
  
***************
*** 3426,3432 ****
  	    VPRINT1("Starting transaction on RO clone volume %u...",
  		    cloneVolId);
  	    code =
! 		AFSVolTransCreate(fromconn, cloneVolId, afrompart, ITOffline,
  				  &onlinetid);
  	    ONERROR(code, cloneVolId,
  		    "Failed to start transaction on volume %u\n");
--- 3467,3473 ----
  	    VPRINT1("Starting transaction on RO clone volume %u...",
  		    cloneVolId);
  	    code =
! 		AFSVolTransCreate_retry(fromconn, cloneVolId, afrompart, ITOffline,
  				  &onlinetid);
  	    ONERROR(code, cloneVolId,
  		    "Failed to start transaction on volume %u\n");
***************
*** 3511,3517 ****
      /* Create a transaction on the cloned volume */
      VPRINT1("Starting transaction on cloned volume %u...", cloneVolId);
      code =
! 	AFSVolTransCreate(fromconn, cloneVolId, afrompart, ITBusy, &fromtid);
      if (!fullrelease && code)
  	ONERROR(VOLSERNOVOL, afromvol,
  		"Old clone is inaccessible. Try vos release -f %u.\n");
--- 3552,3558 ----
      /* Create a transaction on the cloned volume */
      VPRINT1("Starting transaction on cloned volume %u...", cloneVolId);
      code =
! 	AFSVolTransCreate_retry(fromconn, cloneVolId, afrompart, ITBusy, &fromtid);
      if (!fullrelease && code)
  	ONERROR(VOLSERNOVOL, afromvol,
  		"Old clone is inaccessible. Try vos release -f %u.\n");
***************
*** 3904,3910 ****
      fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
  
      VEPRINT1("Starting transaction on volume %u...", afromvol);
!     code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(error_exit, code,
  	   "Could not start transaction on the volume %u to be dumped\n",
  	   afromvol);
--- 3945,3951 ----
      fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
  
      VEPRINT1("Starting transaction on volume %u...", afromvol);
!     code = AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(error_exit, code,
  	   "Could not start transaction on the volume %u to be dumped\n",
  	   afromvol);
***************
*** 3995,4001 ****
      fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
  
      VEPRINT1("Starting transaction on volume %u...", afromvol);
!     code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(error_exit, code,
  	   "Could not start transaction on the volume %u to be dumped\n",
  	   afromvol);
--- 4036,4042 ----
      fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
  
      VEPRINT1("Starting transaction on volume %u...", afromvol);
!     code = AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy, &fromtid);
      EGOTO1(error_exit, code,
  	   "Could not start transaction on the volume %u to be dumped\n",
  	   afromvol);
***************
*** 4032,4038 ****
  
      VEPRINT1("Starting transaction on the cloned volume %u ...", clonevol);
      code =
! 	AFSVolTransCreate(fromconn, clonevol, afrompart, ITOffline,
  			  &clonetid);
      EGOTO1(error_exit, code,
  	   "Failed to start a transaction on the cloned volume%u\n",
--- 4073,4079 ----
  
      VEPRINT1("Starting transaction on the cloned volume %u ...", clonevol);
      code =
! 	AFSVolTransCreate_retry(fromconn, clonevol, afrompart, ITOffline,
  			  &clonetid);
      EGOTO1(error_exit, code,
  	   "Failed to start a transaction on the cloned volume%u\n",
***************
*** 4219,4225 ****
  	    VPRINT1("Deleting the previous volume %u ...", pvolid);
  
  	    code =
! 		AFSVolTransCreate(toconn, pvolid, topart, ITOffline, &totid);
  	    EGOTO1(refail, code, "Failed to start transaction on %u\n",
  		   pvolid);
  
--- 4260,4266 ----
  	    VPRINT1("Deleting the previous volume %u ...", pvolid);
  
  	    code =
! 		AFSVolTransCreate_retry(toconn, pvolid, topart, ITOffline, &totid);
  	    EGOTO1(refail, code, "Failed to start transaction on %u\n",
  		   pvolid);
  
***************
*** 4253,4259 ****
  	    EGOTO1(refail, code, "Could not create new volume %u\n", pvolid);
  	} else {
  	    code =
! 		AFSVolTransCreate(toconn, pvolid, topart, ITOffline, &totid);
  	    EGOTO1(refail, code, "Failed to start transaction on %u\n",
  		   pvolid);
  
--- 4294,4300 ----
  	    EGOTO1(refail, code, "Could not create new volume %u\n", pvolid);
  	} else {
  	    code =
! 		AFSVolTransCreate_retry(toconn, pvolid, topart, ITOffline, &totid);
  	    EGOTO1(refail, code, "Failed to start transaction on %u\n",
  		   pvolid);
  
***************
*** 4476,4482 ****
  			     hostutil_GetNameByINet(entry.serverNumber[index]),
  			     apartName);
  			code =
! 			    AFSVolTransCreate(tempconn, pvolid,
  					      entry.serverPartition[index],
  					      ITOffline, &temptid);
  			if (!code) {
--- 4517,4523 ----
  			     hostutil_GetNameByINet(entry.serverNumber[index]),
  			     apartName);
  			code =
! 			    AFSVolTransCreate_retry(tempconn, pvolid,
  					      entry.serverPartition[index],
  					      ITOffline, &temptid);
  			if (!code) {
***************
*** 4952,4958 ****
  	    curPtr->volFlags &= ~CLONEZAPPED;
  	    success = 1;
  	    code =
! 		AFSVolTransCreate(aconn, curPtr->volCloneId, apart, ITOffline,
  				  &tid);
  	    if (code)
  		success = 0;
--- 4993,4999 ----
  	    curPtr->volFlags &= ~CLONEZAPPED;
  	    success = 1;
  	    code =
! 		AFSVolTransCreate_retry(aconn, curPtr->volCloneId, apart, ITOffline,
  				  &tid);
  	    if (code)
  		success = 0;
***************
*** 5018,5024 ****
  	    curPtr->volFlags |= CLONEVALID;
  	    /*make a clone of curParentId and record as curPtr->volCloneId */
  	    code =
! 		AFSVolTransCreate(aconn, curPtr->volId, apart, ITOffline,
  				  &tid);
  	    if (code)
  		VPRINT2("Clone for volume %s %u failed \n", curPtr->volName,
--- 5059,5065 ----
  	    curPtr->volFlags |= CLONEVALID;
  	    /*make a clone of curParentId and record as curPtr->volCloneId */
  	    code =
! 		AFSVolTransCreate_retry(aconn, curPtr->volId, apart, ITOffline,
  				  &tid);
  	    if (code)
  		VPRINT2("Clone for volume %s %u failed \n", curPtr->volName,
***************
*** 6673,6679 ****
  	}
  	aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT);
  	code =
! 	    AFSVolTransCreate(aconn, entry->volumeId[RWVOL],
  			      entry->serverPartition[index], ITOffline, &tid);
  	if (code) {		/*volume doesnot exist */
  	    fprintf(STDERR,
--- 6714,6720 ----
  	}
  	aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT);
  	code =
! 	    AFSVolTransCreate_retry(aconn, entry->volumeId[RWVOL],
  			      entry->serverPartition[index], ITOffline, &tid);
  	if (code) {		/*volume doesnot exist */
  	    fprintf(STDERR,
***************
*** 6723,6729 ****
  	}
  	aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT);
  	code =
! 	    AFSVolTransCreate(aconn, entry->volumeId[BACKVOL],
  			      entry->serverPartition[index], ITOffline, &tid);
  	if (code) {		/*volume doesnot exist */
  	    fprintf(STDERR,
--- 6764,6770 ----
  	}
  	aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT);
  	code =
! 	    AFSVolTransCreate_retry(aconn, entry->volumeId[BACKVOL],
  			      entry->serverPartition[index], ITOffline, &tid);
  	if (code) {		/*volume doesnot exist */
  	    fprintf(STDERR,
***************
*** 6773,6779 ****
  	    if (entry->serverFlags[i] & ITSROVOL) {
  		aconn = UV_Bind(entry->serverNumber[i], AFSCONF_VOLUMEPORT);
  		code =
! 		    AFSVolTransCreate(aconn, entry->volumeId[ROVOL],
  				      entry->serverPartition[i], ITOffline,
  				      &tid);
  		if (code) {	/*volume doesnot exist */
--- 6814,6820 ----
  	    if (entry->serverFlags[i] & ITSROVOL) {
  		aconn = UV_Bind(entry->serverNumber[i], AFSCONF_VOLUMEPORT);
  		code =
! 		    AFSVolTransCreate_retry(aconn, entry->volumeId[ROVOL],
  				      entry->serverPartition[i], ITOffline,
  				      &tid);
  		if (code) {	/*volume doesnot exist */
***************
*** 6900,6906 ****
      ttid = 0;
  
      aconn = UV_Bind(server, AFSCONF_VOLUMEPORT);
!     code = AFSVolTransCreate(aconn, volid, part, ITOffline, &ttid);
      if (code) {
  	fprintf(STDERR, "Could not start transaction on volume %lu\n",
  		(unsigned long)volid);
--- 6941,6947 ----
      ttid = 0;
  
      aconn = UV_Bind(server, AFSCONF_VOLUMEPORT);
!     code = AFSVolTransCreate_retry(aconn, volid, part, ITOffline, &ttid);
      if (code) {
  	fprintf(STDERR, "Could not start transaction on volume %lu\n",
  		(unsigned long)volid);
***************
*** 6952,6958 ****
  	ERROR_EXIT(-1);
      }
  
!     code = AFSVolTransCreate(conn, volid, partition, transflag, &tid);
      if (code) {
  	fprintf(STDERR, "SetVolumeStatus: TransCreate Failed\n");
  	ERROR_EXIT(code);
--- 6993,6999 ----
  	ERROR_EXIT(-1);
      }
  
!     code = AFSVolTransCreate_retry(conn, volid, partition, transflag, &tid);
      if (code) {
  	fprintf(STDERR, "SetVolumeStatus: TransCreate Failed\n");
  	ERROR_EXIT(code);
***************
*** 7002,7008 ****
  	ERROR_EXIT(-1);
      }
  
!     code = AFSVolTransCreate(conn, volid, partition, ITOffline, &tid);
      if (code) {
  	fprintf(STDERR, "SetVolumeInfo: TransCreate Failed\n");
  	ERROR_EXIT(code);
--- 7043,7049 ----
  	ERROR_EXIT(-1);
      }
  
!     code = AFSVolTransCreate_retry(conn, volid, partition, ITOffline, &tid);
      if (code) {
  	fprintf(STDERR, "SetVolumeInfo: TransCreate Failed\n");
  	ERROR_EXIT(code);
***************
*** 7043,7049 ****
      aconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
  
      VPRINT1("Starting transaction on volume %u...", afromvol);
!     code = AFSVolTransCreate(aconn, afromvol, afrompart, ITBusy, &tid);
      EGOTO1(error_exit, code,
  	   "Could not start transaction on the volume %u to be measured\n",
  	   afromvol);
--- 7084,7090 ----
      aconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
  
      VPRINT1("Starting transaction on volume %u...", afromvol);
!     code = AFSVolTransCreate_retry(aconn, afromvol, afrompart, ITBusy, &tid);
      EGOTO1(error_exit, code,
  	   "Could not start transaction on the volume %u to be measured\n",
  	   afromvol);
