Index: openafs/src/Makefile.djgpp
diff -c openafs/src/Makefile.djgpp:1.2 openafs/src/Makefile.djgpp:1.2.2.1
*** openafs/src/Makefile.djgpp:1.2	Wed Aug 29 19:14:00 2001
--- openafs/src/Makefile.djgpp	Sat Oct 13 00:19:06 2001
***************
*** 4,10 ****
--- 4,13 ----
  
  OBJ = $(SYS_NAME)/obj
  DEST = $(SYS_NAME)/dest
+ DESTDIR = DEST/
+ SRCDIR = ${DESTDIR}
  #LINUX_SYS = i386_linux22
+ TOP_SRCDIR = `pwd`/src
  
  all: afsd
  
Index: openafs/src/NTMake9x
diff -c openafs/src/NTMake9x:1.4 openafs/src/NTMake9x:1.4.2.2
*** openafs/src/NTMake9x:1.4	Mon Sep 10 11:39:47 2001
--- openafs/src/NTMake9x	Wed Nov 14 22:38:06 2001
***************
*** 22,27 ****
--- 22,28 ----
  NTMAKELANG = nmake /nologo /f ntmakefile en_install
  NTMAKE_HEADERS = nmake /nologo /f ntmakefile install_headers
  NTMAKE_LIBUTILS = nmake /nologo /f ntmakefile install_libutils
+ NTMAKE_OBJS = nmake /nologo /f ntmakefile install_objs
  MKDIR = mkdir
  OBJ = src
  
***************
*** 179,186 ****
  	$(NTMAKE)
  	$(CD) ..\..
  
! auth: sys
       echo ***** $@
  	$(CD) $(OBJ)\$@
  	$(NTMAKE)
  	$(CD) ..\..
--- 180,193 ----
  	$(NTMAKE)
  	$(CD) ..\..
  
! afsdobjs: sys
       echo ***** $@
+      $(CD) $(OBJ)\WINNT\afsd
+      $(NTMAKE_OBJS)
+      $(CD) ..\..\..
+ 
+ auth: afsdobjs
+      echo ***** $@
  	$(CD) $(OBJ)\$@
  	$(NTMAKE)
  	$(CD) ..\..
***************
*** 300,306 ****
  	$(CD) $(OBJ)\WINNT\install\Win9x
  	nmake /nologo /f NTMakefile  isinstall
  	$(CD) ..\..\..\..
! 	eho **** End of Install Scripts
  
  media: Win9x
  
--- 307,313 ----
  	$(CD) $(OBJ)\WINNT\install\Win9x
  	nmake /nologo /f NTMakefile  isinstall
  	$(CD) ..\..\..\..
! 	echo **** End of Install Scripts
  
  media: Win9x
  
Index: openafs/src/NTMakefile
diff -c openafs/src/NTMakefile:1.4 openafs/src/NTMakefile:1.4.2.2
*** openafs/src/NTMakefile:1.4	Mon Sep 10 11:39:47 2001
--- openafs/src/NTMakefile	Wed Nov 14 22:38:06 2001
***************
*** 21,26 ****
--- 21,27 ----
  NTMAKE = nmake /nologo /f ntmakefile install
  NTMAKELANG = nmake /nologo /f ntmakefile en_US
  NTMAKE_HEADERS = nmake /nologo /f ntmakefile install_headers
+ NTMAKE_OBJS = nmake /nologo /f ntmakefile install_objs
  MKDIR = mkdir
  OBJ = src
  
***************
*** 178,185 ****
  	$(NTMAKE)
  	$(CD) ..\..
  
! auth: sys
       echo ***** $@
  	$(CD) $(OBJ)\$@
  	$(NTMAKE)
  	$(CD) ..\..
--- 179,192 ----
  	$(NTMAKE)
  	$(CD) ..\..
  
! afsdobjs: sys
       echo ***** $@
+ 	$(CD) $(OBJ)\WINNT\afsd
+ 	$(NTMAKE_OBJS)
+ 	$(CD) ..\..\..
+ 
+ auth: afsdobjs
+      echo ***** $@
  	$(CD) $(OBJ)\$@
  	$(NTMAKE)
  	$(CD) ..\..
***************
*** 469,475 ****
  
  # InstallShield dependencies
  
! InstallShield5: install
  	echo ***** afs_setup_utils
  	$(CD) $(OBJ)\WINNT\afs_setup_utils
  	$(NTMAKE)
--- 476,482 ----
  
  # InstallShield dependencies
  
! InstallShield5:
  	echo ***** afs_setup_utils
  	$(CD) $(OBJ)\WINNT\afs_setup_utils
  	$(NTMAKE)
Index: openafs/src/WINNT/afs_setup_utils/NTMakefile
diff -c openafs/src/WINNT/afs_setup_utils/NTMakefile:1.6 openafs/src/WINNT/afs_setup_utils/NTMakefile:1.6.2.1
*** openafs/src/WINNT/afs_setup_utils/NTMakefile:1.6	Mon Sep 10 11:39:50 2001
--- openafs/src/WINNT/afs_setup_utils/NTMakefile	Wed Nov 14 22:38:47 2001
***************
*** 90,97 ****
  
  install : $(INSTALL_UTILS_DLLFILE) $(SERVER_UNINST_DLLFILE) $(CLIENT_UNINST_DLLFILE) \
            $(CC_UNINST_DLLFILE) $(LIGHT_CLIENT_UNINST_DLLFILE) $(DOCS_UNINST_DLLFILE) \
- 
- media : install
            $(AFSRM_EXEFILE) $(DIRLANG)
  		  cd _isuser
  		  nmake -fntmakefile install
--- 90,95 ----
Index: openafs/src/WINNT/afs_setup_utils/afs_setup_utils.cpp
diff -c openafs/src/WINNT/afs_setup_utils/afs_setup_utils.cpp:1.4 openafs/src/WINNT/afs_setup_utils/afs_setup_utils.cpp:1.4.2.1
*** openafs/src/WINNT/afs_setup_utils/afs_setup_utils.cpp:1.4	Thu Sep  6 22:54:54 2001
--- openafs/src/WINNT/afs_setup_utils/afs_setup_utils.cpp	Wed Nov 14 22:38:47 2001
***************
*** 908,913 ****
--- 908,917 ----
      SC_HANDLE hServer = 0, hSCM;
      BOOL bRestoreOldConfig = FALSE;
  
+     if (!AddToProviderOrder(AFSREG_CLT_SVC_NAME)) {
+         ShowError(ERROR_FILE_NOT_FOUND, GetLastError());
+ 		return -1;
+     }
      hSCM = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
      if (!hSCM) {
          ShowError(IDS_SCM_OPEN_FAILED, GetLastError());
***************
*** 976,981 ****
--- 980,989 ----
      BOOL bServer = FALSE;
      BOOL bShowingProgressDlg = FALSE;
  
+     if (!RemoveFromProviderOrder(AFSREG_CLT_SVC_NAME)) {
+         ShowError(ERROR_FILE_NOT_FOUND, GetLastError());
+ 		return -1;
+     }
      hSCM = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
      if (!hSCM) {
          ShowError(IDS_SCM_OPEN_FAILED, GetLastError());
Index: openafs/src/WINNT/afsd/Makefile.djgpp
diff -c openafs/src/WINNT/afsd/Makefile.djgpp:1.1 openafs/src/WINNT/afsd/Makefile.djgpp:1.1.6.1
*** openafs/src/WINNT/afsd/Makefile.djgpp:1.1	Mon Apr 30 02:48:00 2001
--- openafs/src/WINNT/afsd/Makefile.djgpp	Sat Oct 13 00:19:06 2001
***************
*** 9,15 ****
                 cm_dcache.c cm_dir.c cm_dnlc.c cm_ioctl.c cm_scache.c \
                 cm_server.c cm_user.c cm_utils.c cm_vnodeops.c cm_volume.c \
                 dosutils95.c largeint95.c netbios95.c smb.c smb_ioctl.c \
!                cm_diskcache95.c queue95.c afsmsg95.c smb3.c
  
  include ../../config/Makefile.djgpp.common
  
--- 9,16 ----
                 cm_dcache.c cm_dir.c cm_dnlc.c cm_ioctl.c cm_scache.c \
                 cm_server.c cm_user.c cm_utils.c cm_vnodeops.c cm_volume.c \
                 dosutils95.c largeint95.c netbios95.c smb.c smb_ioctl.c \
!                cm_diskcache95.c queue95.c afsmsg95.c smb3.c cm_dns.c \
!                cm_freelance.c
  
  include ../../config/Makefile.djgpp.common
  
***************
*** 24,30 ****
  install : $(DESTBIN)/afsd.exe #$(DESTBIN)/klog.exe
  #CFLAGS += -I../vxd_lib
  #CFLAGS += -DAFS_VXD
! CFLAGS += -DDOS_PKT_WHOLE
  
  INCFILES = \
          $(DESTINC)/netbios95.h \
--- 25,31 ----
  install : $(DESTBIN)/afsd.exe #$(DESTBIN)/klog.exe
  #CFLAGS += -I../vxd_lib
  #CFLAGS += -DAFS_VXD
! CFLAGS += -DDOS_PKT_WHOLE -DAFS_AFSDB_ENV -DAFS_FREELANCE_CLIENT
  
  INCFILES = \
          $(DESTINC)/netbios95.h \
Index: openafs/src/WINNT/afsd/NTMakefile
diff -c openafs/src/WINNT/afsd/NTMakefile:1.4 openafs/src/WINNT/afsd/NTMakefile:1.4.4.2
*** openafs/src/WINNT/afsd/NTMakefile:1.4	Sat Jun 23 13:26:07 2001
--- openafs/src/WINNT/afsd/NTMakefile	Wed Nov 21 01:45:40 2001
***************
*** 5,10 ****
--- 5,11 ----
  # License.  For details, see the LICENSE file in the top-level source
  # directory or online at http://www.openafs.org/dl/license10.html
  
+ AFSDEV_NETGUI = 1
  !INCLUDE ..\..\config\NTMakefile.$(SYS_NAME)
  !INCLUDE ..\..\config\NTMakefile.version
  
***************
*** 36,47 ****
  	$(INCFILEDIR)\smb_iocons.h \
  	$(INCFILEDIR)\smb_ioctl.h \
  	$(INCFILEDIR)\afsmsg95.h \
! 	$(INCFILEDIR)\afsrpc.h
  
  IDLFILES =\
  	afsrpc.h afsrpc_c.obj
  
! CONFOBJS=cm_config.obj
  
  AFSDOBJS=\
  	afsd_init.obj \
--- 37,51 ----
  	$(INCFILEDIR)\smb_iocons.h \
  	$(INCFILEDIR)\smb_ioctl.h \
  	$(INCFILEDIR)\afsmsg95.h \
! 	$(INCFILEDIR)\afsrpc.h \
! 	$(INCFILEDIR)\cm_dns.h \
! 	$(INCFILEDIR)\cm_dns_private.h
  
  IDLFILES =\
  	afsrpc.h afsrpc_c.obj
  
! CONFOBJS=cm_config.obj \
!          cm_dns.obj
  
  AFSDOBJS=\
  	afsd_init.obj \
***************
*** 66,72 ****
  	cm_aclent.obj \
  	cm_dnlc.obj \
  	cm_rpc.obj \
! 	afsrpc_s.obj
  
  cm_conn.obj: cm_conn.c
  	$(C2OBJ) -DAFS_PTHREAD_ENV $**
--- 70,77 ----
  	cm_aclent.obj \
  	cm_dnlc.obj \
  	cm_rpc.obj \
! 	afsrpc_s.obj \
!      cm_freelance.obj
  
  cm_conn.obj: cm_conn.c
  	$(C2OBJ) -DAFS_PTHREAD_ENV $**
***************
*** 152,157 ****
--- 157,166 ----
  
  ############################################################################
  # Install target; primary makefile target
+ 
+ install_objs: cm_dns.obj cm_config.obj
+      $(COPY) cm_dns.obj $(DESTDIR)\lib
+      $(COPY) cm_config.obj $(DESTDIR)\lib
  
  install_headers: $(IDLFILES) $(INCFILES)
  
Index: openafs/src/WINNT/afsd/afsd.h
diff -c openafs/src/WINNT/afsd/afsd.h:1.3 openafs/src/WINNT/afsd/afsd.h:1.3.4.1
*** openafs/src/WINNT/afsd/afsd.h:1.3	Mon Apr 30 02:48:00 2001
--- openafs/src/WINNT/afsd/afsd.h	Sat Oct 13 00:19:06 2001
***************
*** 35,41 ****
  
  #include "krb.h"
  #include "krb_prot.h"
! #include <crypt.h>
  #include <afs/prs_fs.h>
  
  #include <osi.h>
--- 35,41 ----
  
  #include "krb.h"
  #include "krb_prot.h"
! /*#include <crypt.h>*/
  #include <afs/prs_fs.h>
  
  #include <osi.h>
***************
*** 60,65 ****
--- 60,66 ----
  #include "cm_ioctl.h"
  #include "cm_dnlc.h"
  #include "cm_buf.h"
+ #include "cm_freelance.h"
  #ifdef DJGPP
  #include "afs/afsmsg95.h"
  #endif
***************
*** 95,99 ****
--- 96,126 ----
  extern BOOL isGateway;
  
  extern BOOL reportSessionStartups;
+ 
+ #ifdef AFS_FREELANCE_CLIENT
+ 
+ // yj: Variables used by Freelance Client
+ extern char *cm_FakeRootDir;						// the fake root.afs directory
+ 
+ extern int cm_noLocalMountPoints;					// no. of fake mountpoints
+ 
+ extern cm_localMountPoint_t* cm_localMountPoints;	// array of fake mountpoints
+ 
+ extern int cm_fakeDirSize;							// size (in bytes) of fake root.afs directory
+ 
+ extern int cm_fakeDirCallback;						// state of the fake root.afs directory. indicates
+ 													// if it needs to be refreshed
+ 
+ extern int cm_fakeGettingCallback;					// 1 if currently updating the fake root.afs directory,
+ 													// 0 otherwise
+ 
+ extern int cm_fakeDirVersion;						// the version number of the root.afs directory. used 
+ 													// invalidate all the buffers containing root.afs data
+ 													// after reinitialization
+ // ------------------------------------------
+ #endif /* AFS_FREELANCE_CLIENT */
+ 
+ extern int cm_dnsEnabled;
+ extern int cm_freelanceEnabled;
  
  #endif /* AFSD_H_ENV */
Index: openafs/src/WINNT/afsd/afsd95.c
diff -c openafs/src/WINNT/afsd/afsd95.c:1.1 openafs/src/WINNT/afsd/afsd95.c:1.1.6.1
*** openafs/src/WINNT/afsd/afsd95.c:1.1	Mon Apr 30 02:48:01 2001
--- openafs/src/WINNT/afsd/afsd95.c	Sat Oct 13 00:19:06 2001
***************
*** 95,100 ****
--- 95,102 ----
      cmd_AddParm(ts, "-tracebuf", CMD_SINGLE, CMD_OPTIONAL, "trace buffer size");
      cmd_AddParm(ts, "-startup", CMD_FLAG, CMD_OPTIONAL, "start AFS client");
      cmd_AddParm(ts, "-diskcache", CMD_SINGLE, CMD_OPTIONAL, "diskcache size");
+     cmd_AddParm(ts, "-afsdb", CMD_FLAG, CMD_OPTIONAL, "use DNS for cell server resolution");
+     cmd_AddParm(ts, "-freelance", CMD_FLAG, CMD_OPTIONAL, "virtual AFS root");
  
      return (cmd_Dispatch(argc, argv));
  }
Index: openafs/src/WINNT/afsd/afsd_init.c
diff -c openafs/src/WINNT/afsd/afsd_init.c:1.4 openafs/src/WINNT/afsd/afsd_init.c:1.4.4.1
*** openafs/src/WINNT/afsd/afsd_init.c:1.4	Sat Jun 23 13:26:07 2001
--- openafs/src/WINNT/afsd/afsd_init.c	Sat Oct 13 00:19:06 2001
***************
*** 48,53 ****
--- 48,56 ----
  DWORD cm_mountRootLen;
  int cm_logChunkSize;
  int cm_chunkSize;
+ #ifdef AFS_FREELANCE_CLIENT
+ char *cm_FakeRootDir;
+ #endif /* freelance */
  
  int smb_UseV3;
  
***************
*** 82,87 ****
--- 85,100 ----
  
  HANDLE afsi_file;
  
+ #ifdef AFS_AFSDB_ENV
+ int cm_dnsEnabled = 1;
+ #endif
+ 
+ /*#ifdef AFS_FREELANCE_CLIENT
+ extern int cm_freelanceEnabled;
+ #endif*/
+ 
+ void cm_InitFakeRootDir();
+ 
  void
  afsi_start()
  {
***************
*** 167,172 ****
--- 180,186 ----
  	HKEY parmKey;
  	DWORD dummyLen;
  	long code;
+ 	/*int freelanceEnabled;*/
  	WSADATA WSAjunk;
  
  	WSAStartup(0x0101, &WSAjunk);
***************
*** 392,397 ****
--- 406,437 ----
  		afsi_log("Default SecurityLevel is clear");
  	}
  
+ #ifdef AFS_AFSDB_ENV
+ 	dummyLen = sizeof(cm_dnsEnabled);
+ 	code = RegQueryValueEx(parmKey, "UseDNS", NULL, NULL,
+ 				(BYTE *) &cm_dnsEnabled, &dummyLen);
+ 	if (code == ERROR_SUCCESS) {
+ 		afsi_log("DNS %s be used to find AFS cell servers",
+ 			 cm_dnsEnabled ? "will" : "will not");
+ 	}
+ 	else {
+ 	  cm_dnsEnabled = 1;   /* default on */
+ 	}
+ #endif /* AFS_AFSDB_ENV */
+ 
+ #ifdef AFS_FREELANCE_CLIENT
+ 	dummyLen = sizeof(cm_freelanceEnabled);
+ 	code = RegQueryValueEx(parmKey, "FreelanceClient", NULL, NULL,
+ 				(BYTE *) &cm_freelanceEnabled, &dummyLen);
+ 	if (code == ERROR_SUCCESS) {
+ 		afsi_log("Freelance client feature %s activated",
+ 			 cm_freelanceEnabled ? "is" : "is not");
+ 	}
+ 	else {
+ 	  cm_freelanceEnabled = 0;  /* default off */
+ 	}
+ #endif /* AFS_FREELANCE_CLIENT */
+ 
  	RegCloseKey (parmKey);
  
  	/* setup early variables */
***************
*** 497,516 ****
  		return -1;
  	}
  
  	code = cm_GetRootCellName(rootCellName);
  	afsi_log("cm_GetRootCellName code %d rcn %s", code,
  		 (code ? "<none>" : rootCellName));
! 	if (code != 0) {
!         	*reasonP = "can't find root cell name in afsd.ini";
! 		return -1;
! 	}
  
! 	cm_rootCellp = cm_GetCell(rootCellName, CM_FLAG_CREATE);
! 	afsi_log("cm_GetCell addr %x", cm_rootCellp);
! 	if (cm_rootCellp == NULL) {
! 		*reasonP = "can't find root cell in afsdcell.ini";
! 		return -1;
! 	}
  
  	return 0;
  }
--- 537,571 ----
  		return -1;
  	}
  
+ #ifdef AFS_AFSDB_ENV
+ 	if (cm_InitDNS(cm_dnsEnabled) == -1)
+ 	  cm_dnsEnabled = 0;  /* init failed, so deactivate */
+ 	afsi_log("cm_InitDNS %d", cm_dnsEnabled);
+ #endif
+ 
  	code = cm_GetRootCellName(rootCellName);
  	afsi_log("cm_GetRootCellName code %d rcn %s", code,
  		 (code ? "<none>" : rootCellName));
! 	if (code != 0 && !cm_freelanceEnabled) {
! 	    *reasonP = "can't find root cell name in afsd.ini";
! 	    return -1;
!         }
!         else if (cm_freelanceEnabled)
!           cm_rootCellp = NULL;
  
!         if (code == 0 && !cm_freelanceEnabled) {
! 	  cm_rootCellp = cm_GetCell(rootCellName, CM_FLAG_CREATE);
!           afsi_log("cm_GetCell addr %x", cm_rootCellp);
! 	  if (cm_rootCellp == NULL) {
! 	    *reasonP = "can't find root cell in afsdcell.ini";
! 	    return -1;
! 	  }
! 	}
! 
! #ifdef AFS_FREELANCE_CLIENT
! 	if (cm_freelanceEnabled)
! 	  cm_InitFreelance();
! #endif
  
  	return 0;
  }
***************
*** 524,542 ****
  
  	/* this should really be in an init daemon from here on down */
  
! 	code = cm_GetVolumeByName(cm_rootCellp, cm_rootVolumeName, cm_rootUserp,		&req, CM_FLAG_CREATE, &cm_rootVolumep);
! 	afsi_log("cm_GetVolumeByName code %x root vol %x", code,
! 		 (code ? 0xffffffff : cm_rootVolumep));
! 	if (code != 0) {
! 		*reasonP = "can't find root volume in root cell";
! 		return -1;
          }
  
!         /* compute the root fid */
! 	cm_rootFid.cell = cm_rootCellp->cellID;
!         cm_rootFid.volume = cm_GetROVolumeID(cm_rootVolumep);
!         cm_rootFid.vnode = 1;
!         cm_rootFid.unique = 1;
          
          code = cm_GetSCache(&cm_rootFid, &cm_rootSCachep, cm_rootUserp, &req);
  	afsi_log("cm_GetSCache code %x scache %x", code,
--- 579,604 ----
  
  	/* this should really be in an init daemon from here on down */
  
!         if (!cm_freelanceEnabled) {
!           code = cm_GetVolumeByName(cm_rootCellp, cm_rootVolumeName, cm_rootUserp,
!                                     &req, CM_FLAG_CREATE, &cm_rootVolumep);
!           afsi_log("cm_GetVolumeByName code %x root vol %x", code,
!                    (code ? 0xffffffff : cm_rootVolumep));
!           if (code != 0) {
!             *reasonP = "can't find root volume in root cell";
!             return -1;
!           }
          }
  
! 	/* compute the root fid */
! 	if (!cm_freelanceEnabled) {
! 	  cm_rootFid.cell = cm_rootCellp->cellID;
! 	  cm_rootFid.volume = cm_GetROVolumeID(cm_rootVolumep);
! 	  cm_rootFid.vnode = 1;
! 	  cm_rootFid.unique = 1;
! 	}
! 	else
! 	  cm_FakeRootFid(&cm_rootFid);
          
          code = cm_GetSCache(&cm_rootFid, &cm_rootSCachep, cm_rootUserp, &req);
  	afsi_log("cm_GetSCache code %x scache %x", code,
***************
*** 575,577 ****
--- 637,640 ----
  
  	return 0;
  }
+ 
Index: openafs/src/WINNT/afsd/afsd_init95.c
diff -c openafs/src/WINNT/afsd/afsd_init95.c:1.2 openafs/src/WINNT/afsd/afsd_init95.c:1.2.6.1
*** openafs/src/WINNT/afsd/afsd_init95.c:1.2	Sat Jun 23 13:26:07 2001
--- openafs/src/WINNT/afsd/afsd_init95.c	Sat Oct 13 00:19:06 2001
***************
*** 47,52 ****
--- 47,60 ----
  int afs_diskCacheChunks;
  char cm_cachePath[128];
  int cm_diskCacheEnabled = 0;
+ #ifdef AFS_AFSDB_ENV
+ extern int cm_dnsEnabled;
+ #endif
+ 
+ #ifdef AFS_FREELANCE_CLIENT
+ extern int cm_freelanceEnabled;
+ char *cm_FakeRootDir;
+ #endif /* freelance */
  
  int smb_UseV3;
  
***************
*** 84,89 ****
--- 92,98 ----
  int afsd_debug;
  cm_initparams_v1 cm_initParams;
  
+ 
  /*
   * AFSD Initialization Log
   *
***************
*** 555,560 ****
--- 564,579 ----
            afsi_log("Default disk cache size %d", diskCacheSize);
          }
  
+         if (as->parms[22].items) {
+            /* -noafsdb */
+            cm_dnsEnabled = 0;
+         }
+ 
+         if (as->parms[23].items) {
+            /* -freelance */
+            cm_freelanceEnabled = 1;
+         }
+ 
          if (ParseCacheInfoFile()) {
            exit(1);
          }
***************
*** 638,643 ****
--- 657,669 ----
          rx_StartServer(0);
  	afsi_log("rx_StartServer");
  
+ #ifdef AFS_AFSDB_ENV
+ 	/* initialize dns lookup */
+ 	if (cm_InitDNS(cm_dnsEnabled) == -1)
+ 	  cm_dnsEnabled = 0;  /* init failed, so deactivate */
+ 	afsi_log("cm_InitDNS %d", cm_dnsEnabled);
+ #endif
+ 
  	/* init user daemon, and other packages */
  	cm_InitUser();
  
***************
*** 670,687 ****
  	code = cm_GetRootCellName(rootCellName);
  	afsi_log("cm_GetRootCellName code %d rcn %s", code,
  		 (code ? "<none>" : rootCellName));
! 	if (code != 0) {
          	*reasonP = "can't find root cell name in ThisCell";
  		return -1;
  	}
! 
! 	cm_rootCellp = cm_GetCell(rootCellName, CM_FLAG_CREATE);
! 	afsi_log("cm_GetCell addr %x", cm_rootCellp);
! 	if (cm_rootCellp == NULL) {
! 		*reasonP = "can't find root cell in CellServDB";
! 		return -1;
  	}
  
  	return 0;
  }
  
--- 696,722 ----
  	code = cm_GetRootCellName(rootCellName);
  	afsi_log("cm_GetRootCellName code %d rcn %s", code,
  		 (code ? "<none>" : rootCellName));
! 	if (code != 0 && !cm_freelanceEnabled) {
          	*reasonP = "can't find root cell name in ThisCell";
  		return -1;
  	}
! 	else if (cm_freelanceEnabled)
! 	  cm_rootCellp = NULL;
! 	
! 	if (code == 0 && !cm_freelanceEnabled) {
! 	  cm_rootCellp = cm_GetCell(rootCellName, CM_FLAG_CREATE);
! 	  afsi_log("cm_GetCell addr %x", cm_rootCellp);
! 	  if (cm_rootCellp == NULL) {
! 	    *reasonP = "can't find root cell in CellServDB";
! 	    return -1;
! 	  }
  	}
  
+ #ifdef AFS_FREELANCE_CLIENT
+ 	if (cm_freelanceEnabled)
+ 	  cm_InitFreelance();
+ #endif
+ 
  	return 0;
  }
  
***************
*** 694,712 ****
  
  	/* this should really be in an init daemon from here on down */
  
! 	code = cm_GetVolumeByName(cm_rootCellp, cm_rootVolumeName, cm_rootUserp,		&req, CM_FLAG_CREATE, &cm_rootVolumep);
! 	afsi_log("cm_GetVolumeByName code %x root vol %x", code,
! 		 (code ? 0xffffffff : cm_rootVolumep));
! 	if (code != 0) {
! 		*reasonP = "can't find root volume in root cell";
! 		return -1;
!         }
  
          /* compute the root fid */
! 	cm_rootFid.cell = cm_rootCellp->cellID;
!         cm_rootFid.volume = cm_GetROVolumeID(cm_rootVolumep);
!         cm_rootFid.vnode = 1;
!         cm_rootFid.unique = 1;
          
          code = cm_GetSCache(&cm_rootFid, &cm_rootSCachep, cm_rootUserp, &req);
  	afsi_log("cm_GetSCache code %x scache %x", code,
--- 729,753 ----
  
  	/* this should really be in an init daemon from here on down */
  
! 	if (!cm_freelanceEnabled) { 
! 	  code = cm_GetVolumeByName(cm_rootCellp, cm_rootVolumeName, cm_rootUserp,		&req, CM_FLAG_CREATE, &cm_rootVolumep);
! 	  afsi_log("cm_GetVolumeByName code %x root vol %x", code,
! 		   (code ? 0xffffffff : cm_rootVolumep));
! 	  if (code != 0) {
! 	    *reasonP = "can't find root volume in root cell";
! 	    return -1;
! 	  }
! 	}
  
          /* compute the root fid */
! 	if (!cm_freelanceEnabled) {
! 	  cm_rootFid.cell = cm_rootCellp->cellID;
! 	  cm_rootFid.volume = cm_GetROVolumeID(cm_rootVolumep);
! 	  cm_rootFid.vnode = 1;
! 	  cm_rootFid.unique = 1;
! 	}
! 	else
! 	  cm_FakeRootFid(&cm_rootFid);
          
          code = cm_GetSCache(&cm_rootFid, &cm_rootSCachep, cm_rootUserp, &req);
  	afsi_log("cm_GetSCache code %x scache %x", code,
***************
*** 744,746 ****
--- 785,788 ----
  
  	return 0;
  }
+ 
Index: openafs/src/WINNT/afsd/afsd_service.c
diff -c openafs/src/WINNT/afsd/afsd_service.c:1.3 openafs/src/WINNT/afsd/afsd_service.c:1.3.4.1
*** openafs/src/WINNT/afsd/afsd_service.c:1.3	Sat Jun 23 13:26:07 2001
--- openafs/src/WINNT/afsd/afsd_service.c	Wed Nov 14 22:38:47 2001
***************
*** 185,190 ****
--- 185,191 ----
  	int jmpret;
  
  	osi_InitPanic(afsd_notifier);
+ 	osi_InitTraceOption();
  
  	GlobalStatus = 0;
  
***************
*** 250,256 ****
          CheckMountDrive();
  
  	WaitForSingleObject(WaitToTerminate, INFINITE);
! 
  {   
          HANDLE h; char *ptbuf[1];
  	h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
--- 251,257 ----
          CheckMountDrive();
  
  	WaitForSingleObject(WaitToTerminate, INFINITE);
! 	
  {   
          HANDLE h; char *ptbuf[1];
  	h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
Index: openafs/src/WINNT/afsd/afslogon.c
diff -c openafs/src/WINNT/afsd/afslogon.c:1.2 openafs/src/WINNT/afsd/afslogon.c:1.2.8.1
*** openafs/src/WINNT/afsd/afslogon.c:1.2	Sat Nov  4 05:01:35 2000
--- openafs/src/WINNT/afsd/afslogon.c	Wed Nov 14 22:38:47 2001
***************
*** 19,38 ****
  #include "cm_config.h"
  #include "krb.h"
  
  
  HANDLE hDLL;
  
  WSADATA WSAjunk;
  
- char NPName[] = "System\\CurrentControlSet\\Services\\TransarcAFSDaemon\\NetworkProvider";
- 
  #define REG_CLIENT_PARMS_KEY            "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"
  #define REG_CLIENT_RETRY_INTERVAL_PARM  "LoginRetryInterval"
  #define REG_CLIENT_FAIL_SILENTLY_PARM   "FailLoginsSilently"
! #define DEFAULT_RETRY_INTERVAL          30                        // seconds
  #define DEFAULT_FAIL_SILENTLY           FALSE
! #define DEFAULT_SLEEP_INTERVAL          5                         // seconds
  
  
  /* Structure def copied from DDK (NTDEF.H) */
  typedef struct UNICODE_STRING {
--- 19,48 ----
  #include "cm_config.h"
  #include "krb.h"
  
+ #include <io.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <fcntl.h>
  
+ DWORD LogonOption,TraceOption;
+ 
  HANDLE hDLL;
  
  WSADATA WSAjunk;
  
  #define REG_CLIENT_PARMS_KEY            "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"
+ #define REG_CLIENT_PROVIDER_KEY			"SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\NetworkProvider"
  #define REG_CLIENT_RETRY_INTERVAL_PARM  "LoginRetryInterval"
  #define REG_CLIENT_FAIL_SILENTLY_PARM   "FailLoginsSilently"
! #define DEFAULT_RETRY_INTERVAL          30                        /* seconds*/
  #define DEFAULT_FAIL_SILENTLY           FALSE
! #define DEFAULT_SLEEP_INTERVAL          5                         /* seconds*/
! 
! #define ISLOGONINTEGRATED(v) ( ((v) & LOGON_OPTION_INTEGRATED)==LOGON_OPTION_INTEGRATED)
! #define ISHIGHSECURITY(v) ( ((v) & LOGON_OPTION_HIGHSECURITY)==LOGON_OPTION_HIGHSECURITY)
  
+ #define TRACE_OPTION_EVENT 1
+ #define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT)
  
  /* Structure def copied from DDK (NTDEF.H) */
  typedef struct UNICODE_STRING {
***************
*** 57,80 ****
   *
   * Returns NULL on failure.
   */
! WCHAR *GetLogonScript(void)
  {
! 	WCHAR *script;
  	DWORD code;
  	DWORD LSPtype, LSPsize;
  	HKEY NPKey;
  
  	/*
  	 * Get Network Provider key.
  	 * Assume this works or we wouldn't be here.
  	 */
! 	(void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, NPName,
  			    0, KEY_QUERY_VALUE, &NPKey);
  
  	/*
  	 * Get Logon Script pathname length
  	 */
! 	code = RegQueryValueEx(NPKey, "LogonScript", NULL,
  				&LSPtype, NULL, &LSPsize);
  
  	if (code) {
--- 67,131 ----
   *
   * Returns NULL on failure.
   */
! 
! 
! void DebugEvent0(char *a) 
! {
! 	HANDLE h; char *ptbuf[1];
! 	if (!ISLOGONTRACE(TraceOption))
! 		return;
! 	h = RegisterEventSource(NULL, a);
! 	ptbuf[0] = a;
! 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (const char **)ptbuf, NULL);
! 	DeregisterEventSource(h);
! }
! 
! #define MAXBUF_ 131
! void DebugEvent(char *a,char *b,...) 
! {
! 	HANDLE h; char *ptbuf[1],buf[MAXBUF_+1];
! 	va_list marker;
! 	if (!ISLOGONTRACE(TraceOption))
! 		return;
! 	h = RegisterEventSource(NULL, a);
! 	va_start(marker,b);
! 	_vsnprintf(buf,MAXBUF_,b,marker);
! 	ptbuf[0] = buf;
! 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (const char **)ptbuf, NULL);\
! 	DeregisterEventSource(h);
! 	va_end(marker);
! }
! 
! CHAR *GenRandomName(CHAR *pbuf)
  {
! 	int i;
! 	srand( (unsigned)time( NULL ) );
! 	for (i=0;i<MAXRANDOMNAMELEN-1;i++)
! 		pbuf[i]='a'+(rand() % 26);
! 	pbuf[MAXRANDOMNAMELEN-1]=0;
! 	return pbuf;
! }
! 
! WCHAR *GetLogonScript(CHAR *pname)
! {
! 	WCHAR *script,*buf;
  	DWORD code;
  	DWORD LSPtype, LSPsize;
  	HKEY NPKey;
+ 	WCHAR randomName[MAXRANDOMNAMELEN];
  
  	/*
  	 * Get Network Provider key.
  	 * Assume this works or we wouldn't be here.
  	 */
! 	(void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PROVIDER_KEY,
  			    0, KEY_QUERY_VALUE, &NPKey);
  
  	/*
  	 * Get Logon Script pathname length
  	 */
! 
! 	code = RegQueryValueExW(NPKey, L"LogonScript", NULL,
  				&LSPtype, NULL, &LSPsize);
  
  	if (code) {
***************
*** 87,100 ****
  		return NULL;
  	}
  
! 	script = (WCHAR *)LocalAlloc(LMEM_FIXED, LSPsize);
! 
  	/*
  	 * Explicitly call UNICODE version
  	 * Assume it will succeed since it did before
  	 */
  	(void) RegQueryValueExW(NPKey, L"LogonScript", NULL,
! 				&LSPtype, (LPBYTE)script, &LSPsize);
  
  	RegCloseKey (NPKey);
  	return script;
--- 138,166 ----
  		return NULL;
  	}
  
! 	buf=(WCHAR *)LocalAlloc(LMEM_FIXED, LSPsize);
! 	script=(WCHAR *)LocalAlloc(LMEM_FIXED,LSPsize+(MAXRANDOMNAMELEN)*sizeof(WCHAR));
  	/*
  	 * Explicitly call UNICODE version
  	 * Assume it will succeed since it did before
  	 */
  	(void) RegQueryValueExW(NPKey, L"LogonScript", NULL,
! 				&LSPtype, (LPBYTE)buf, &LSPsize);
! 	MultiByteToWideChar(CP_ACP,0,pname,strlen(pname)+1,randomName,(strlen(pname)+1)*sizeof(WCHAR));
! 	swprintf(script,buf,randomName);
! 	free(buf);
! 
! #ifdef DEBUG_VERBOSE
! 		{
!         HANDLE h; char *ptbuf[1],buf[132],tbuf[255];
! 		WideCharToMultiByte(CP_ACP,0,script,LSPsize,tbuf,255,NULL,NULL);
!         h = RegisterEventSource(NULL, "AFS AfsLogon - GetLogonScript");
!         sprintf(buf, "Script[%s,%d] Return Code[%x]",tbuf,LSPsize,code);
!         ptbuf[0] = buf;
!         ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
!         DeregisterEventSource(h);
! 		}
! #endif
  
  	RegCloseKey (NPKey);
  	return script;
***************
*** 153,161 ****
  DWORD MapAuthError(DWORD code)
  {
  	switch (code) {
! 		case INTK_BADPW: return WN_BAD_PASSWORD;
! 		case KERB_ERR_PRINCIPAL_UNKNOWN: return WN_BAD_USER;
! 		default: return WN_NO_NETWORK;
  	}
  }
  
--- 219,230 ----
  DWORD MapAuthError(DWORD code)
  {
  	switch (code) {
! 	case KTC_NOCM:
! 	case KTC_NOCMRPC:
! 		return WN_NO_NETWORK;
! /*	case INTK_BADPW: return WN_BAD_PASSWORD;*/
! /*	case KERB_ERR_PRINCIPAL_UNKNOWN: return WN_BAD_USER;*/
! 	default: return WN_SUCCESS;
  	}
  }
  
***************
*** 212,223 ****
         	if (result != ERROR_SUCCESS)
         	        *pFailSilently = DEFAULT_FAIL_SILENTLY;
  
!         // Make sure this is really a bool value in the strict sense
          *pFailSilently = !!*pFailSilently;
         	        
          RegCloseKey(hKey);
  }
  
  DWORD APIENTRY NPLogonNotify(
  	PLUID lpLogonId,
  	LPCWSTR lpAuthentInfoType,
--- 281,314 ----
         	if (result != ERROR_SUCCESS)
         	        *pFailSilently = DEFAULT_FAIL_SILENTLY;
  
!         /* Make sure this is really a bool value in the strict sense*/
          *pFailSilently = !!*pFailSilently;
         	        
          RegCloseKey(hKey);
  }
  
+ BOOL IsServiceRunning (void)
+ {
+       SERVICE_STATUS Status;
+       SC_HANDLE hManager;
+       memset (&Status, 0x00, sizeof(Status));
+       Status.dwCurrentState = SERVICE_STOPPED;
+ 
+       if ((hManager = OpenSCManager (NULL, NULL, GENERIC_READ)) != NULL)
+          {
+          SC_HANDLE hService;
+          if ((hService = OpenService (hManager, TEXT("TransarcAFSDaemon"), GENERIC_READ)) != NULL)
+             {
+             QueryServiceStatus (hService, &Status);
+             CloseServiceHandle (hService);
+             }
+ 
+          CloseServiceHandle (hManager);
+          }
+ 		 DebugEvent("AFS AfsLogon - Test Service Running","Return Code[%x] ?Running[%d]",Status.dwCurrentState,(Status.dwCurrentState == SERVICE_RUNNING));
+ 		return (Status.dwCurrentState == SERVICE_RUNNING);
+ }
+ 
  DWORD APIENTRY NPLogonNotify(
  	PLUID lpLogonId,
  	LPCWSTR lpAuthentInfoType,
***************
*** 237,247 ****
  	char *reason;
  	BOOLEAN interactive;
  	BOOLEAN flag;
  	HWND hwndOwner = (HWND)StationHandle;
!         BOOLEAN failSilently;
!         int retryInterval;
!         int sleepInterval = DEFAULT_SLEEP_INTERVAL;        // seconds        
!         BOOLEAN afsWillAutoStart;
          
  	IL = (MSV1_0_INTERACTIVE_LOGON *) lpAuthentInfo;
  
--- 328,342 ----
  	char *reason;
  	BOOLEAN interactive;
  	BOOLEAN flag;
+ 	DWORD LSPtype, LSPsize;
+ 	HKEY NPKey;
  	HWND hwndOwner = (HWND)StationHandle;
!     BOOLEAN failSilently;
!     int retryInterval;
!     int sleepInterval = DEFAULT_SLEEP_INTERVAL;        /* seconds        */
!     BOOLEAN afsWillAutoStart;
! 	CHAR RandomName[MAXRANDOMNAMELEN];
! 	*lpLogonScript=NULL;
          
  	IL = (MSV1_0_INTERACTIVE_LOGON *) lpAuthentInfo;
  
***************
*** 251,323 ****
  	/* Convert from Unicode to ANSI */
  	wcstombs(uname, IL->UserName.Buffer, 256);
  	wcstombs(password, IL->Password.Buffer, 256);
  
! 	/* Check for zero length password */
! 	if (password[0] == 0) {
  		code = GT_PW_NULL;
  		reason = "zero length password is illegal";
! 		goto checkauth;
  	}
  
! 	/* Get cell name */
! 	code = cm_GetRootCellName(cell);
! 	if (code < 0) {
! 		code = KTC_NOCELL;
! 		reason = "unknown cell";
! 		goto checkauth;
  	}
  
!         /* Get user specified login behavior (or defaults) */
!         GetLoginBehavior(&retryInterval, &failSilently);
          
!         afsWillAutoStart = AFSWillAutoStart();
          
!         /* Possibly loop until AFS is started. */
!         while (1) {
!                 code = ka_UserAuthenticateGeneral(
! 			KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON,
! 			uname, "", cell, password, 0, &pw_exp, 0,
! 			&reason);
  			
  		/* If we've failed because the client isn't running yet and the
  		 * client is set to autostart (and therefore it makes sense for
  		 * us to wait for it to start) then sleep a while and try again. 
  		 * If the error was something else, then give up. */
  		if (code != KTC_NOCM && code != KTC_NOCMRPC || !afsWillAutoStart)
! 		        break;
  		
                  /* If the retry interval has expired and we still aren't
                   * logged in, then just give up if we are not in interactive
                   * mode or the failSilently flag is set, otherwise let the
                   * user know we failed and give them a chance to try again. */
!                 if (retryInterval <= 0) {
!                         if (!interactive || failSilently)
!                                 break;
! 
  			flag = MessageBox(hwndOwner,
  				"AFS is still starting.  Retry?",
  				"AFS Logon",
  				MB_ICONQUESTION | MB_RETRYCANCEL);
  			if (flag == IDCANCEL)
! 				break;
                          
                          /* Wait just a little while and try again */
!                         retryInterval = sleepInterval = DEFAULT_SLEEP_INTERVAL;
!                 }
                                          
!                 if (retryInterval < sleepInterval)
!                         sleepInterval = retryInterval;
                          
!                 Sleep(sleepInterval * 1000);
  
!                 retryInterval -= sleepInterval;
!         }
  
  checkauth:
  	if (code) {
                  char msg[128];
!                 
!                 sprintf(msg, "Integrated login failed: %s", reason);
                  
  		if (interactive && !failSilently)
  			MessageBox(hwndOwner, msg, "AFS Logon", MB_OK);
--- 346,474 ----
  	/* Convert from Unicode to ANSI */
  	wcstombs(uname, IL->UserName.Buffer, 256);
  	wcstombs(password, IL->Password.Buffer, 256);
+ 
+ 	(void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY,
+ 		    0, KEY_QUERY_VALUE, &NPKey);
+ 	LSPsize=sizeof(TraceOption);
+ 	RegQueryValueEx(NPKey, "TraceOption", NULL,
+ 				&LSPtype, (LPBYTE)&TraceOption, &LSPsize);
+ 	 RegCloseKey (NPKey);
+ 	
+ 	/*
+ 	 * Get Logon OPTIONS
+ 	 */
+ 
+ 	(void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PROVIDER_KEY,
+ 		    0, KEY_QUERY_VALUE, &NPKey);
+ 
+ 	LSPsize=sizeof(LogonOption);
+ 	code = RegQueryValueEx(NPKey, "LogonOptions", NULL,
+ 				&LSPtype, (LPBYTE)&LogonOption, &LSPsize);
  
! 	RegCloseKey (NPKey);
! 	if ((code!=0) || (LSPtype!=REG_DWORD))
! 		LogonOption=LOGON_OPTION_INTEGRATED;	/*default to integrated logon only*/
! 	DebugEvent("AFS AfsLogon - NPLogonNotify","LogonOption[%x], Service AutoStart[%d]",LogonOption,AFSWillAutoStart());
! 	/* Check for zero length password if integrated logon*/
! 	if ( ISLOGONINTEGRATED(LogonOption) && (password[0] == 0) )  {
  		code = GT_PW_NULL;
  		reason = "zero length password is illegal";
! 		if (!ISHIGHSECURITY(LogonOption))
! 			goto checkauth;	/*skip the rest if integrated logon and not high security*/
! 		code=0;
  	}
  
! 	/* Get cell name if doing integrated logon */
! 	if (ISLOGONINTEGRATED(LogonOption))
! 	{
! 		code = cm_GetRootCellName(cell);
! 		if (code < 0) { 
! 			code = KTC_NOCELL;
! 			reason = "unknown cell";
! 			if (!ISHIGHSECURITY(LogonOption))
! 				goto checkauth;	/*skip the rest if integrated logon and not high security*/
! 			code=0;
! 		}
  	}
  
!     /* Get user specified login behavior (or defaults) */
!     GetLoginBehavior(&retryInterval, &failSilently);
          
!     afsWillAutoStart = AFSWillAutoStart();
          
! 	if ( ISHIGHSECURITY(LogonOption))
! 		*lpLogonScript = GetLogonScript(GenRandomName(RandomName));	/*only do if high security option is on*/
! 
! 
! 	/* Possibly loop until AFS is started. */
!     while ( (ISHIGHSECURITY(LogonOption) || ISLOGONINTEGRATED(LogonOption))) {
! 		code=0;
! 		
! 		/* is service started yet?*/
! 
! 		if (ISHIGHSECURITY(LogonOption) && !ISLOGONINTEGRATED(LogonOption))	/* if high security only then check for service started only*/
! 		{
! 			if (IsServiceRunning())
! 				break;
! 			code = KTC_NOCM;
! 			if (!afsWillAutoStart)
! 				break;
! 		} else if (ISLOGONINTEGRATED(LogonOption) && !ISHIGHSECURITY(LogonOption))	/* if Integrated Logon only */
! 		{			
! 			DebugEvent("AFS AfsLogon - ka_UserAuthenticateGeneral2","Code[%x],uame[%s] Cell[%s]",code,uname,cell);
! 			code = ka_UserAuthenticateGeneral2(
! 				KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON,
! 				uname, "", cell, password,uname, 0, &pw_exp, 0,
! 				&reason);
! 			DebugEvent("AFS AfsLogon - (INTEGERTED only)ka_UserAuthenticateGeneral2","Code[%x]",code);
! 		} else if (ISLOGONINTEGRATED(LogonOption) && ISHIGHSECURITY(LogonOption))	/* if Integrated Logon and High Security pass random generated name*/
! 		{
! 			code = ka_UserAuthenticateGeneral2(
! 				KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON,
! 				uname, "", cell, password,RandomName, 0, &pw_exp, 0,
! 				&reason);
! 			DebugEvent("AFS AfsLogon - (Both)ka_UserAuthenticateGeneral2","Code[%x],RandomName[%s]",code,RandomName);
! 		} else {
! 			code = KTC_NOCM;	/* we shouldn't ever get here*/
! 		}
  			
  		/* If we've failed because the client isn't running yet and the
  		 * client is set to autostart (and therefore it makes sense for
  		 * us to wait for it to start) then sleep a while and try again. 
  		 * If the error was something else, then give up. */
  		if (code != KTC_NOCM && code != KTC_NOCMRPC || !afsWillAutoStart)
! 			break;
  		
                  /* If the retry interval has expired and we still aren't
                   * logged in, then just give up if we are not in interactive
                   * mode or the failSilently flag is set, otherwise let the
                   * user know we failed and give them a chance to try again. */
!         if (retryInterval <= 0) {
!              if (!interactive || failSilently)
!                  break;
  			flag = MessageBox(hwndOwner,
  				"AFS is still starting.  Retry?",
  				"AFS Logon",
  				MB_ICONQUESTION | MB_RETRYCANCEL);
  			if (flag == IDCANCEL)
! 					break;
                          
                          /* Wait just a little while and try again */
!                  retryInterval = sleepInterval = DEFAULT_SLEEP_INTERVAL;
!         }
                                          
!         if (retryInterval < sleepInterval)
! 			sleepInterval = retryInterval;
                          
! 		Sleep(sleepInterval * 1000);
  
!         retryInterval -= sleepInterval;
!      }
  
  checkauth:
  	if (code) {
                  char msg[128];
!         sprintf(msg, "Integrated login failed: %s", reason);
                  
  		if (interactive && !failSilently)
  			MessageBox(hwndOwner, msg, "AFS Logon", MB_OK);
***************
*** 331,347 ****
                  		    1, 0, ptbuf, NULL);
                  	DeregisterEventSource(h);
                  }
! 	}
! 
! 	/* Get logon script */
! 	if (interactive)
! 		*lpLogonScript = GetLogonScript();
! 
! 	if (code) {
! 	        code = MapAuthError(code);
  		SetLastError(code);
! 	}
  
  	return code;
  }
  
--- 482,500 ----
                  		    1, 0, ptbuf, NULL);
                  	DeregisterEventSource(h);
                  }
! 	    code = MapAuthError(code);
  		SetLastError(code);
! 		if (ISHIGHSECURITY(LogonOption) && (code!=0))
! 		{
! 			if (*lpLogonScript)
! 				LocalFree(*lpLogonScript);
! 			*lpLogonScript = NULL;
! 			if (!(afsWillAutoStart || ISLOGONINTEGRATED(LogonOption)))	// its not running, so if not autostart or integrated logon then just skip
! 				return 0;
  
+ 		}
+ 	}
+ 	DebugEvent("AFS AfsLogon - Exit","Return Code[%x]",code);
  	return code;
  }
  
***************
*** 354,359 ****
--- 507,513 ----
  	LPVOID StationHandle,
  	DWORD dwChangeInfo)
  {
+ 	DebugEvent0("AFS AfsLogon - NPPasswordChangeNotify");
  	return 0;
  }
  
Index: openafs/src/WINNT/afsd/cm_callback.c
diff -c openafs/src/WINNT/afsd/cm_callback.c:1.4 openafs/src/WINNT/afsd/cm_callback.c:1.4.2.1
*** openafs/src/WINNT/afsd/cm_callback.c:1.4	Tue Aug  7 20:03:24 2001
--- openafs/src/WINNT/afsd/cm_callback.c	Sat Oct 13 00:19:06 2001
***************
*** 28,33 ****
--- 28,43 ----
  /* read/write lock for all global storage in this module */
  osi_rwlock_t cm_callbackLock;
  
+ /*
+ #ifdef AFS_FREELANCE_CLIENT
+ extern int cm_fakeDirCallback;
+ extern int cm_fakeGettingCallback;
+ #endif
+ */
+ #ifdef AFS_FREELANCE_CLIENT
+ extern osi_mutex_t cm_Freelance_Lock;
+ #endif
+ 
  /* count of # of callback breaking messages received by this CM so far.  We use
   * this count in determining whether there have been any callback breaks that
   * apply to a call that returned a new callback.  If the counter doesn't
***************
*** 568,576 ****
   */
  int cm_HaveCallback(cm_scache_t *scp)
  {
! 	if (scp->cbServerp != NULL)
!         	return 1;
! 	else return 0;
  }
  
  /* need to detect a broken callback that races with our obtaining a callback.
--- 578,627 ----
   */
  int cm_HaveCallback(cm_scache_t *scp)
  {
! #ifdef AFS_FREELANCE_CLIENT
!     // yj: we handle callbacks specially for callbacks on the root directory
!     // Since it's local, we almost always say that we have callback on it
!     // The only time we send back a 0 is if we're need to initialize or
!     // reinitialize the fake directory
! 
!     // There are 2 state variables cm_fakeGettingCallback and cm_fakeDirCallback
!     // cm_fakeGettingCallback is 1 if we're in the process of initialization and
!     // hence should return false. it's 0 otherwise
!     // cm_fakeDirCallback is 0 if we haven't loaded the fake directory, it's 1
!     // if the fake directory is loaded and this is the first time cm_HaveCallback
!     // is called since then. We return false in this case to allow cm_GetCallback
!     // to be called because cm_GetCallback has some initialization work to do.
!     // If cm_fakeDirCallback is 2, then it means that the fake directory is in
!     // good shape and we simply return true, provided no change is detected.
!   int fdc, fgc;
! 
!     if (cm_freelanceEnabled && scp->fid.cell==0x1 && scp->fid.volume==0x20000001) {	// if it's something on /afs
! 	if (!(scp->fid.vnode==0x1 && scp->fid.unique==0x1))  	// if it's not root.afs
! 	    return 1;
! 	else {
! 	    lock_ObtainMutex(&cm_Freelance_Lock);
! 	    fdc = cm_fakeDirCallback;
! 	    fgc = cm_fakeGettingCallback;
! 	    lock_ReleaseMutex(&cm_Freelance_Lock);
! 	    
! 	    if (fdc==1) {	// first call since init
! 		return 0;
! 	    } else if (fdc==2 && !fgc) { 	// we're in good shape
! 		if (cm_getLocalMountPointChange()) {	// check for changes
! 		    cm_clearLocalMountPointChange(); // clear the changefile
! 		    cm_reInitLocalMountPoints();	// start reinit
! 		    return 0;
! 		}
! 		return 1;			// no change
! 	    }
! 	    return 0;
! 	}
!     }
! #endif
! 
!     if (scp->cbServerp != NULL)
! 	return 1;
!     else return 0;
  }
  
  /* need to detect a broken callback that races with our obtaining a callback.
***************
*** 694,699 ****
--- 745,787 ----
          int mustCall;
          long sflags;
  
+ #ifdef AFS_FREELANCE_CLIENT
+ 	// yj
+ 	// The case where a callback is needed on /afs is handled
+ 	// specially. We need to fetch the status by calling
+ 	// cm_MergeStatus and mark that cm_fakeDirCallback is 2
+ 	if (cm_freelanceEnabled &&
+           scp->fid.cell==0x1 &&
+ 		scp->fid.volume==0x20000001 &&
+ 		scp->fid.unique==0x1 &&
+ 		scp->fid.vnode==0x1) {
+ 		// Start by indicating that we're in the process
+ 		// of fetching the callback
+ 
+ 	        lock_ObtainMutex(&cm_Freelance_Lock);
+ 		cm_fakeGettingCallback = 1;
+ 		lock_ReleaseMutex(&cm_Freelance_Lock);
+ 
+ 		// Fetch the status info 
+ 		cm_MergeStatus(scp, &afsStatus, &volSync, userp, 0);
+ 
+ 		// Indicate that the callback is not done
+ 		lock_ObtainMutex(&cm_Freelance_Lock);
+ 		cm_fakeDirCallback = 2;
+ 		// Indicate that we're no longer fetching the callback
+ 		cm_fakeGettingCallback = 0;
+ 		lock_ReleaseMutex(&cm_Freelance_Lock);
+ 
+ 		return 0;
+ 	}
+ 
+ 	/*if (scp->fid.cell==0x1 && scp->fid.volume==0x20000001) {
+ 		afsi_log("cm_getcallback should NEVER EVER get here... ");
+ 	}*/
+ 	// yj: end of getcallback modifications  ---------------
+ 		
+ #endif /* AFS_FREELANCE_CLIENT */
+ 	
  	mustCall = (flags & 1);
  	cm_AFSFidFromFid(&tfid, &scp->fid);
  	while (1) {
Index: openafs/src/WINNT/afsd/cm_cell.c
diff -c openafs/src/WINNT/afsd/cm_cell.c:1.3 openafs/src/WINNT/afsd/cm_cell.c:1.3.4.2
*** openafs/src/WINNT/afsd/cm_cell.c:1.3	Mon Apr 30 02:48:03 2001
--- openafs/src/WINNT/afsd/cm_cell.c	Wed Nov 14 22:30:08 2001
***************
*** 57,79 ****
  /* load up a cell structure from the cell database, afsdcell.ini */
  cm_cell_t *cm_GetCell(char *namep, long flags)
  {
  	cm_cell_t *cp;
          long code;
          static cellCounter = 1;		/* locked by cm_cellLock */
  
  	lock_ObtainWrite(&cm_cellLock);
  	for(cp = cm_allCellsp; cp; cp=cp->nextp) {
! 		if (strcmp(namep, cp->namep) == 0) break;
          }
! 	if (!cp && (flags & CM_FLAG_CREATE)) {
! 		cp = malloc(sizeof(*cp));
                  memset(cp, 0, sizeof(*cp));
!                 code = cm_SearchCellFile(namep, NULL, cm_AddCellProc, cp);
!                 if (code) {
! 			free(cp);
!                         cp = NULL;
!                         goto done;
!                 }
  
  		/* randomise among those vlservers having the same rank*/ 
  		cm_RandomizeServer(&cp->vlServersp);
--- 57,107 ----
  /* load up a cell structure from the cell database, afsdcell.ini */
  cm_cell_t *cm_GetCell(char *namep, long flags)
  {
+   return cm_GetCell_Gen(namep, NULL, flags);
+ }
+ 
+ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags)
+ {
  	cm_cell_t *cp;
          long code;
          static cellCounter = 1;		/* locked by cm_cellLock */
+ 	int ttl;
+ 	char fullname[200];
  
  	lock_ObtainWrite(&cm_cellLock);
  	for(cp = cm_allCellsp; cp; cp=cp->nextp) {
! 		if (strcmp(namep, cp->namep) == 0) {
! 		  strcpy(fullname, cp->namep);
! 		  break;
! 		}
          }
! 
! 	if ((!cp && (flags & CM_FLAG_CREATE))
! #ifdef AFS_AFSDB_ENV
! 	    /* if it's from DNS, see if it has expired */
! 	    || (cp && (cp->flags & CM_CELLFLAG_DNS) && (time(0) > cp->timeout))
! #endif
! 	  ) {
! 		if (!cp) cp = malloc(sizeof(*cp));
                  memset(cp, 0, sizeof(*cp));
!                 code = cm_SearchCellFile(namep, fullname, cm_AddCellProc, cp);
! 		if (code) {
! #ifdef AFS_AFSDB_ENV
! 		  if (cm_dnsEnabled /*&& cm_DomainValid(namep)*/)
! 		    code = cm_SearchCellByDNS(namep, fullname, &ttl, cm_AddCellProc, cp);
! #endif
! 		  if (code) {
! 		    free(cp);
! 		    cp = NULL;
! 		    goto done;
! 		  }
! #ifdef AFS_AFSDB_ENV
! 		  else {   /* got cell from DNS */
! 		    cp->flags |= CM_CELLFLAG_DNS;
! 		    cp->timeout = time(0) + ttl;
! 		  }
! #endif
! 		}
  
  		/* randomise among those vlservers having the same rank*/ 
  		cm_RandomizeServer(&cp->vlServersp);
***************
*** 82,89 ****
                  lock_InitializeMutex(&cp->mx, "cm_cell_t mutex");
  
  		/* copy in name */
!                 cp->namep = malloc(strlen(namep)+1);
!                 strcpy(cp->namep, namep);
  
  		/* thread on global list */
                  cp->nextp = cm_allCellsp;
--- 110,117 ----
                  lock_InitializeMutex(&cp->mx, "cm_cell_t mutex");
  
  		/* copy in name */
!                 cp->namep = malloc(strlen(fullname)+1);
!                 strcpy(cp->namep, fullname);
  
  		/* thread on global list */
                  cp->nextp = cm_allCellsp;
***************
*** 93,98 ****
--- 121,128 ----
          }
  
  done:
+ 	if (newnamep)
+ 	  strcpy(newnamep, fullname);
  	lock_ReleaseWrite(&cm_cellLock);
          return cp;
  }
***************
*** 100,110 ****
--- 130,159 ----
  cm_cell_t *cm_FindCellByID(long cellID)
  {
  	cm_cell_t *cp;
+ 	int ttl;
+      int code;
  
  	lock_ObtainWrite(&cm_cellLock);
  	for(cp = cm_allCellsp; cp; cp=cp->nextp) {
  		if (cellID == cp->cellID) break;
          }
+ 
+ #ifdef AFS_AFSDB_ENV
+ 	/* if it's from DNS, see if it has expired */
+ 	if (cp && cm_dnsEnabled && (cp->flags & CM_CELLFLAG_DNS) && (time(0) > cp->timeout)) {
+ 	  code = cm_SearchCellByDNS(cp->namep, NULL, &ttl, cm_AddCellProc, cp);
+ 	  if (code == 0) {   /* got cell from DNS */
+ 	    cp->flags |= CM_CELLFLAG_DNS;
+ #ifdef DEBUG
+ 	    fprintf(stderr, "cell %s: ttl=%d\n", cp->namep, ttl);
+ #endif
+ 	    cp->timeout = time(0) + ttl;
+ 	  }
+ 	  /* if we fail to find it this time, we'll just do nothing and leave the
+ 	     current entry alone */
+ 	}
+ #endif /* AFS_AFSDB_ENV */
+ 
  	lock_ReleaseWrite(&cm_cellLock);	
  	
          return cp;
Index: openafs/src/WINNT/afsd/cm_cell.h
diff -c openafs/src/WINNT/afsd/cm_cell.h:1.2 openafs/src/WINNT/afsd/cm_cell.h:1.2.8.2
*** openafs/src/WINNT/afsd/cm_cell.h:1.2	Sat Nov  4 05:01:37 2000
--- openafs/src/WINNT/afsd/cm_cell.h	Wed Nov 14 22:30:08 2001
***************
*** 20,32 ****
--- 20,36 ----
          struct cm_serverRef *vlServersp;	/* locked by cm_serverLock */
          osi_mutex_t mx;			/* mutex locking fields (flags) */
          long flags;			/* locked by mx */
+         long timeout;                   /* if dns, time at which the server addrs expire */
  } cm_cell_t;
  
  #define CM_CELLFLAG_SUID	1	/* setuid flag; not yet used */
+ #define CM_CELLFLAG_DNS         2       /* cell servers are from DNS */
  
  extern void cm_InitCell(void);
  
  extern cm_cell_t *cm_GetCell(char *namep, long flags);
+ 
+ extern cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags);
  
  extern cm_cell_t *cm_FindCellByID(long cellID);
  
Index: openafs/src/WINNT/afsd/cm_config.c
diff -c openafs/src/WINNT/afsd/cm_config.c:1.3.4.1 openafs/src/WINNT/afsd/cm_config.c:1.3.4.3
*** openafs/src/WINNT/afsd/cm_config.c:1.3.4.1	Wed Sep 19 18:36:15 2001
--- openafs/src/WINNT/afsd/cm_config.c	Wed Nov 14 22:38:47 2001
***************
*** 22,27 ****
--- 22,31 ----
  #include <string.h>
  
  #include "cm_config.h"
+ #ifdef AFS_AFSDB_ENV
+ #include "cm_dns.h"
+ #include <afs/afsint.h>
+ #endif
  
  char AFSConfigKeyName[] =
  	"SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters";
***************
*** 276,281 ****
--- 280,314 ----
          }		/* while loop processing all lines */
  }
  
+ long cm_SearchCellByDNS(char *cellNamep, char *newCellNamep, int *ttl,
+                cm_configProc_t *procp, void *rockp)
+ {
+ #ifdef AFS_AFSDB_ENV
+      int rc;
+      int cellHosts[AFSMAXCELLHOSTS];
+      int numServers;
+      int i;
+      struct sockaddr_in vlSockAddr;
+ 
+      rc = getAFSServer(cellNamep, cellHosts, &numServers, ttl);
+      if (rc == 0 && numServers > 0) {     /* found the cell */
+        for (i = 0; i < numServers; i++) {
+            memcpy(&vlSockAddr.sin_addr.s_addr, &cellHosts[i],
+                sizeof(long));
+            vlSockAddr.sin_family = AF_INET;
+            /* sin_port supplied by connection code */
+            if (procp)
+           (*procp)(rockp, &vlSockAddr, NULL);
+            if(newCellNamep)
+           strcpy(newCellNamep,cellNamep);
+        }
+        return 0;   /* found cell */
+      }
+      else
+ #endif /* AFS_AFSDB_ENV */
+        return -1;  /* not found */
+ }
+ 
  #if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
  /* look up the root cell's name in the Registry */
  long cm_GetRootCellName(char *cellNamep)
***************
*** 405,411 ****
  		return -1;
  
  	code = RegSetValueEx(parmKey, labelp, 0, REG_DWORD,
! 			     &value, sizeof(value));
  	RegCloseKey (parmKey);
  	if (code != ERROR_SUCCESS)
  		return -1;
--- 438,444 ----
  		return -1;
  
  	code = RegSetValueEx(parmKey, labelp, 0, REG_DWORD,
! 			     (LPBYTE)&value, sizeof(value));
  	RegCloseKey (parmKey);
  	if (code != ERROR_SUCCESS)
  		return -1;
***************
*** 502,508 ****
          return 0;
  }
  
! extern long cm_CloseCellFile(cm_configFile_t *filep)
  {
  	char wdir[256];
          char sdir[256];
--- 535,541 ----
          return 0;
  }
  
! long cm_CloseCellFile(cm_configFile_t *filep)
  {
  	char wdir[256];
          char sdir[256];
***************
*** 552,555 ****
--- 585,617 ----
          if (code) code = errno;
          
          return code;
+ }
+ 
+ void cm_GetConfigDir(char *dir)
+ {
+ 	char wdir[256];
+      char *afsconf_path;
+      int code;
+      int tlen;
+ 
+ #if !defined(DJGPP) && !defined(AFS_WIN95_ENV)
+ 	code = GetWindowsDirectory(wdir, sizeof(wdir));
+       if (code == 0 || code > sizeof(wdir)) wdir[0] = 0;
+         
+ 	/* add trailing backslash, if required */
+         tlen = strlen(wdir);
+         if (wdir[tlen-1] != '\\') strcat(wdir, "\\");
+ #else
+ #ifdef DJGPP
+         strcpy(wdir,cm_confDir);
+ #else
+         afsconf_path = getenv("AFSCONF");
+         if (!afsconf_path)
+           strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH);
+         else
+           strcpy(wdir, afsconf_path);
+ #endif /* !DJGPP */
+         strcat(wdir,"\\");
+ #endif /* DJGPP || WIN95 */
+         strcpy(dir, wdir);
  }
Index: openafs/src/WINNT/afsd/cm_config.h
diff -c openafs/src/WINNT/afsd/cm_config.h:1.3 openafs/src/WINNT/afsd/cm_config.h:1.3.4.1
*** openafs/src/WINNT/afsd/cm_config.h:1.3	Mon Apr 30 02:48:03 2001
--- openafs/src/WINNT/afsd/cm_config.h	Sat Oct 13 00:19:06 2001
***************
*** 36,41 ****
--- 36,44 ----
  extern long cm_SearchCellFile(char *cellNamep, char *newCellNamep,
  	cm_configProc_t *procp, void *rockp);
  
+ extern long cm_SearchCellByDNS(char *cellNamep, char *newCellNamep, int *ttl,
+                cm_configProc_t *procp, void *rockp);
+ 
  extern long cm_WriteConfigString(char *labelp, char *valuep);
  
  extern long cm_WriteConfigInt(char *labelp, long value);
Index: openafs/src/WINNT/afsd/cm_dcache.c
diff -c openafs/src/WINNT/afsd/cm_dcache.c:1.3 openafs/src/WINNT/afsd/cm_dcache.c:1.3.4.1
*** openafs/src/WINNT/afsd/cm_dcache.c:1.3	Mon Apr 30 02:48:04 2001
--- openafs/src/WINNT/afsd/cm_dcache.c	Sat Oct 13 00:19:06 2001
***************
*** 23,28 ****
--- 23,31 ----
  #include "afsd.h"
  
  osi_mutex_t cm_bufGetMutex;
+ #ifdef AFS_FREELANCE_CLIENT
+ extern osi_mutex_t cm_Freelance_Lock;
+ #endif
  
  /* functions called back from the buffer package when reading or writing data,
   * or when holding or releasing a vnode pointer.
***************
*** 1075,1085 ****
--- 1078,1100 ----
          struct rx_call *callp;
          cm_bulkIO_t biod;		/* bulk IO descriptor */
          cm_conn_t *connp;
+ 	int getroot;
+ 	long t1, t2;
  
          /* now, the buffer may or may not be filled with good data (buf_GetNew
           * drops lots of locks, and may indeed return a properly initialized
           * buffer, although more likely it will just return a new, empty, buffer.
           */
+ 
+ #ifdef AFS_FREELANCE_CLIENT
+ 
+ 	// yj: if they're trying to get the /afs directory, we need to
+ 	// handle it differently, since it's local rather than on any
+ 	// server
+ 
+ 	getroot = (scp==cm_rootSCachep) ;
+ #endif
+ 
  	cm_AFSFidFromFid(&tfid, &scp->fid);
  
  	code = cm_SetupFetchBIOD(scp, &bufp->offset, &biod, up, reqp);
***************
*** 1120,1125 ****
--- 1135,1207 ----
                  scp->dataVersion, bufp->dataVersion, scp, bufp, bufp->dcp);
  #endif /* DISKCACHE95 */
  
+ #ifdef AFS_FREELANCE_CLIENT
+ 
+ 	// yj code
+ 	// if getroot then we don't need to make any calls
+ 	// just return fake data
+ 	
+ 	 if (cm_freelanceEnabled && getroot) {
+ 		// setup the fake status			
+ 		afsStatus.InterfaceVersion = 0x1;
+ 		afsStatus.FileType = 0x2;
+ 		afsStatus.LinkCount = scp->linkCount;
+ 		afsStatus.Length = cm_fakeDirSize;
+ 		afsStatus.DataVersion = cm_fakeDirVersion;
+ 		afsStatus.Author = 0x1;
+ 		afsStatus.Owner = 0x0;
+ 		afsStatus.CallerAccess = 0x9;
+ 		afsStatus.AnonymousAccess = 0x9;
+ 		afsStatus.UnixModeBits = 0x1ff;
+ 		afsStatus.ParentVnode = 0x1;
+ 		afsStatus.ParentUnique = 0x1;
+ 		afsStatus.SegSize = 0;
+ 		afsStatus.ClientModTime = 0x3b49f6e2;
+ 		afsStatus.ServerModTime = 0x3b49f6e2;
+ 		afsStatus.Group = 0;
+ 		afsStatus.SyncCounter = 0;
+ 		afsStatus.dataVersionHigh = 0;
+ 	
+ 		// once we're done setting up the status info,
+ 		// we just fill the buffer pages with fakedata
+ 		// from cm_FakeRootDir. Extra pages are set to
+ 		// 0. 
+ 		
+ 		lock_ObtainMutex(&cm_Freelance_Lock);
+ #ifdef DEBUG
+ 		afsi_log("bufp->offset is %d", bufp->offset);
+ #endif
+ 		t1 = bufp->offset.LowPart;
+ 		qdp = biod.bufListEndp;
+ 		while (qdp) {
+ 			tbufp = osi_GetQData(qdp);
+ 			bufferp=tbufp->datap;
+ 			memset(bufferp, 0, buf_bufferSize);
+ 			t2 = cm_fakeDirSize - t1;
+ 			if (t2>buf_bufferSize) t2=buf_bufferSize;
+ #ifdef DEBUG
+ 			afsi_log("t1:%d, t2:%d", t1, t2);
+ #endif
+ 			if (t2 > 0) {
+ 				memcpy(bufferp, cm_FakeRootDir+t1, t2);
+ 			} else {
+ 				t2 = 0;
+ 			}
+ 			t1+=t2;
+ 			qdp = (osi_queueData_t *) osi_QPrev(&qdp->q);
+ 			
+ 		}
+ 		lock_ReleaseMutex(&cm_Freelance_Lock);
+ 	
+ 		// once we're done, we skip over the part of the
+ 		// code that does the ACTUAL fetching of data for
+ 		// real files
+ 
+ 		goto fetchingcompleted;
+ 	}
+ 
+ #endif /* AFS_FREELANCE_CLIENT */
+ 
  	/* now make the call */
          do {
  		code = cm_Conn(&scp->fid, up, reqp, &connp);
***************
*** 1230,1235 ****
--- 1312,1319 ----
                  osi_Log0(afsd_logp, "CALL FetchData DONE");
                  
  	} while (cm_Analyze(connp, up, reqp, &scp->fid, &volSync, NULL, code));
+ 
+   fetchingcompleted:
          code = cm_MapRPCError(code, reqp);
  
          lock_ObtainMutex(&scp->mx);
Index: openafs/src/WINNT/afsd/cm_dns.c
diff -c /dev/null openafs/src/WINNT/afsd/cm_dns.c:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:08 2001
--- openafs/src/WINNT/afsd/cm_dns.c	Sat Oct 13 00:39:53 2001
***************
*** 0 ****
--- 1,687 ----
+ /* 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
+  */
+ 
+ #ifdef AFS_AFSDB_ENV
+ 
+ #include <afs/param.h>
+ #include <afs/stds.h>
+ #ifndef DJGPP
+ #include <windows.h>
+ #include <winsock2.h>
+ #endif
+ #include "cm_dns_private.h"
+ #include "cm_dns.h"
+ #include <lwp.h>
+ #include <afs/afsint.h>
+ 
+ extern int errno;
+ static char dns_addr[30];
+ #ifdef DJGPP
+ extern char cm_confDir[];
+ #endif
+ int cm_dnsEnabled = -1;
+ 
+ void DNSlowerCase(char *str)
+ {
+   int i;
+ 
+   for (i=0; i<strlen(str); i++)
+     /*str[i] = tolower(str[i]);*/
+     if (str[i] >= 'A' && str[i] <= 'Z')
+       str[i] += 'a' - 'A';
+ }
+ 
+ int cm_InitDNS(int enabled)
+ {
+   char configpath[100];
+   int len;
+   int code;
+   char *path;
+   char *addr;
+   
+   if (!enabled) { fprintf(stderr, "DNS support disabled\n"); cm_dnsEnabled = 0; return 0; }
+ 
+   /* First try AFS_NS environment var. */
+   addr = getenv("AFS_NS");
+   if (addr && inet_addr(addr) != -1) {
+     strcpy(dns_addr, addr);
+   } else {
+     /* Now check for the AFSDNS.INI file */
+ #ifdef DJGPP
+     strcpy(configpath, cm_confDir);
+ #elif defined(AFS_WIN95_ENV)
+     path = getenv("AFSCONF");
+     if (path) strcpy(configpath, path);
+     else strcpy(configpath, "c:\\afscli");
+ #else  /* nt */
+     code = GetWindowsDirectory(configpath, sizeof(configpath));
+     if (code == 0 || code > sizeof(configpath)) return -1;
+ #endif
+     strcat(configpath, "\\afsdns.ini");
+ 
+     /* Currently we only get (and query) the first nameserver.  Getting
+        list of mult. nameservers should be easy to do. */
+     len = GetPrivateProfileString("AFS Domain Name Servers", "ns1", NULL,
+ 			    dns_addr, sizeof(dns_addr),
+ 			    configpath);
+   
+     if (len == 0 || inet_addr(dns_addr) == -1) {
+       fprintf(stderr, "No valid name server addresses found, DNS lookup is "
+                       "disabled\n");
+       cm_dnsEnabled = 0;  /* failed */
+       return -1;     /* No name servers defined */
+     }
+     else fprintf(stderr, "Found DNS server %s\n", dns_addr);
+   }
+ 
+   cm_dnsEnabled = 1;
+   return 0;
+ }
+ 
+ SOCKADDR_IN setSockAddr(char *server, int port)
+ {
+   SOCKADDR_IN sockAddr;                     
+   int         addrLen = sizeof(SOCKADDR_IN);
+ 
+ #ifndef WIN32_LEAN_AND_MEAN
+   bzero(&sockAddr,addrLen);
+ #endif /*WIN32_LEAN_AND_MEAN*/
+   sockAddr.sin_family   = AF_INET;
+   sockAddr.sin_port     = htons( port );
+   sockAddr.sin_addr.s_addr = inet_addr( server );
+   /*inet_aton(server, &sockAddr.sin_addr.s_addr);*/
+ 
+   return (sockAddr);
+ }
+ 
+ int getRRCount(PDNS_HDR ptr)
+ {
+   return(ntohs(ptr->rr_count));
+ }
+ 
+ 
+ int send_DNS_Addr_Query(char* query, 
+ 			 SOCKET commSock, SOCKADDR_IN sockAddr, char *buffer)
+ {
+   PDNS_HDR    pDNShdr;
+   PDNS_QTAIL  pDNS_qtail;
+ 
+   int     queryLen = 0;
+   int     res;
+ 
+ #ifndef WIN32_LEAN_AND_MEAN
+   bzero(buffer,BUFSIZE);
+ #endif /*WIN32_LEAN_AND_MEAN*/
+ 
+   /*********************************
+    * Build DNS Query Message       *
+    *                               *
+    * hard-coded Adrress (A) query  *
+    *********************************/
+   
+   pDNShdr = (PDNS_HDR)&( buffer[ 0 ] );
+   pDNShdr->id         = htons( 0xDADE );
+   pDNShdr->flags      = htons( DNS_FLAG_RD ); /* do recurse */
+   pDNShdr->q_count    = htons( 1 );           /* one query */
+   pDNShdr->rr_count   = 0;                    /* none in query */
+   pDNShdr->auth_count = 0;                    /* none in query */
+   pDNShdr->add_count  = 0;                    /* none in query */
+   
+   queryLen = putQName( query, &(buffer[ DNS_HDR_LEN ] ) );
+   queryLen += DNS_HDR_LEN; /* query Length is just after the query name and header */
+ #ifdef DEBUG
+   fprintf(stderr, "send_DNS_Addr: query=%s, queryLen=%d\n", query, queryLen);
+ #endif
+   
+   
+   pDNS_qtail = (PDNS_QTAIL) &(buffer[ queryLen ]);
+   pDNS_qtail->qtype = htons(255);/*htons(DNS_RRTYPE_A); */
+   pDNS_qtail->qclass = htons(DNS_RRCLASS_IN); 
+   queryLen +=  DNS_QTAIL_LEN;
+   
+   /**************************
+    * Send DNS Query Message *
+    **************************/
+   
+ 
+   res = sendto( commSock,
+ 		buffer,
+ 		queryLen,
+ 		0,
+ 		(struct sockaddr *) &sockAddr,
+ 		sizeof( SOCKADDR_IN ) );
+   
+   /*dumpSbuffer(buffer,queryLen);*/
+ 
+   if ( res < 0 )
+     {
+ #ifdef DEBUG
+       fprintf(stderr, "send_DNS_Addr_Query: error %d, errno %d\n", res, errno);
+       fprintf(stderr, "sendto() failed \n");
+ #endif
+       return ( -1 );
+     }
+   else
+     {
+     /*printf( "sendto() succeeded\n");*/
+     ;
+     } /* end if */
+   
+   return(0);
+ }
+ 
+ 
+ int send_DNS_AFSDB_Query(char* query, 
+ 			 SOCKET commSock, SOCKADDR_IN sockAddr, char *buffer)
+ {
+   /*static char buffer[BUFSIZE];*/
+ 
+   PDNS_HDR    pDNShdr;
+   PDNS_QTAIL  pDNS_qtail;
+ 
+   int     queryLen = 0;
+   int     res;
+ 
+ #ifndef WIN32_LEAN_AND_MEAN
+   bzero(buffer,BUFSIZE);
+ #endif /*WIN32_LEAN_AND_MEAN*/
+ 
+   /***************************
+    * Build DNS Query Message *
+    *                         *
+    * hard-coded AFSDB query  *
+    ***************************/
+   
+   pDNShdr = (PDNS_HDR)&( buffer[ 0 ] );
+   pDNShdr->id         = htons( 0xDEAD );
+   pDNShdr->flags      = htons( DNS_FLAG_RD ); /* do recurse */
+   pDNShdr->q_count    = htons( 1 );           /* one query */
+   pDNShdr->rr_count   = 0;                    /* none in query */
+   pDNShdr->auth_count = 0;                    /* none in query */
+   pDNShdr->add_count  = 0;                    /* none in query */
+   
+   queryLen = putQName( query, &(buffer[ DNS_HDR_LEN ] ) );
+   queryLen += DNS_HDR_LEN; /* query Length is just after the query name and header */
+   
+   
+   pDNS_qtail = (PDNS_QTAIL) &(buffer[ queryLen ]);
+   pDNS_qtail->qtype = htons(DNS_RRTYPE_AFSDB); 
+   pDNS_qtail->qclass = htons(DNS_RRCLASS_IN); 
+   queryLen +=  DNS_QTAIL_LEN;
+   
+   /**************************
+    * Send DNS Query Message *
+    **************************/
+   
+   res = sendto( commSock,
+ 		buffer,
+ 		queryLen,
+ 		0,
+ 		(struct sockaddr *) &sockAddr,
+ 		sizeof( SOCKADDR_IN ) );
+   
+   /*dumpSbuffer(buffer,queryLen);*/
+ 
+   if ( res < 0 )
+     {
+ #ifdef DEBUG
+       fprintf(stderr, "send_DNS_AFSDB_Query: error %d, errno %d\n", res, errno);
+       fprintf(stderr,  "sendto() failed \n");
+ #endif /* DEBUG */
+       return ( -1 );
+     }
+   else
+     {
+     /*printf( "sendto() succeeded\n");*/
+     ;
+     } /* end if */
+   
+   return(0);
+ }
+ 
+ 
+ PDNS_HDR get_DNS_Response(SOCKET commSock, SOCKADDR_IN sockAddr, char *buffer)
+ {
+   /*static char buffer[BUFSIZE];*/
+ 
+   int         addrLen = sizeof(SOCKADDR_IN);
+   int         res;
+   int size;
+ 
+ #ifndef WIN32_LEAN_AND_MEAN
+   bzero(buffer,BUFSIZE);
+ #endif /*WIN32_LEAN_AND_MEAN*/
+ 
+   /*****************************
+    * Receive DNS Reply Message *
+    *****************************/
+   
+   /*printf( "calling recvfrom() on connected UDP socket\n" );*/
+   
+   size = recvfrom( commSock,
+ 		  buffer,
+ 		  BUFSIZE,
+ 		  0,
+ 		  (struct sockaddr *) &sockAddr,
+ 		  &addrLen );
+   if (size < 0) { fprintf(stderr, "recvfrom error %d\n", errno); return NULL; }
+ 
+   /*dumpRbuffer(buffer,res);*/
+ 
+ #ifdef DEBUG
+   fprintf(stderr, "recvfrom returned %d bytes from %s: \n", 
+ 	  size, inet_ntoa( sockAddr.sin_addr ) );
+ #endif /* DEBUG */
+   
+   return((PDNS_HDR)&( buffer[ 0 ] ));
+ 
+ }
+ 
+ 
+ int putQName( char *pHostName, char *pQName )
+ {
+   int     i;
+   char    c;
+   int     j = 0;
+   int     k = 0;
+   
+   DNSlowerCase(pHostName);
+   /*printf( "Hostname: [%s]\n", pHostName );*/
+   
+   for ( i = 0; *( pHostName + i ); i++ )
+     {
+       c = *( pHostName + i );   /* get next character */
+       
+       
+       if ( c == '.' )
+ 	{
+ 	  /* dot encountered, fill in previous length */
+ 	  if (k!=0){ /*don't process repeated dots*/
+           /*printf( "%c", c );*/
+ 	    *( pQName + j ) = k;
+ 	    j = j+k+1;  /* set index to next counter */
+ 	    k = 0;      /* reset segment length */
+ 	  }
+ 	}
+       else
+ 	{
+         /*printf( "%c", c );*/
+ 	  *( pQName + j + k + 1 ) = c;  /* assign to QName */
+ 	  k++;                /* inc count of seg chars */
+ 	} /* end if */
+     } /* end for loop */
+   
+   *(pQName + j )                  = k;   /* count for final segment */
+ 
+   *(pQName + j + k + 1 )      = 0;   /* count for trailing NULL segment is 0 */
+   
+   /*printf( "\n" ); */
+   
+   if (c == '.')
+     return ( j + k + 1 );        /* return total length of QName */
+   else
+     return ( j + k + 2 );
+ } /* end putQName() */
+ 
+ 
+ u_char * skipRRQName(u_char *pQName)
+ {
+   u_char *ptr;
+   u_char c;
+ 
+   ptr = pQName;
+   c = *ptr;
+   while (c) {
+     if ( c >= 0xC0 ) {
+     /* skip the 'compression' pointer */
+       ptr = ptr+1;
+       c = '\0';
+     } else {
+       /* skip a normal qname segment */
+       ptr += *ptr;
+       ptr++;
+       c = *ptr;
+     };
+   };
+ 
+   /* ptr now pointing at terminating zero of query QName,
+      or the pointer for the previous occurrence 
+      (compression)
+    */
+   ptr++;
+ 
+   return (ptr);
+ } /* end skipRRQName() */
+ 
+ 
+ 
+ u_char * printRRQName( u_char *pQName, PDNS_HDR buffer )
+ {
+   u_short i, k;
+   u_char *buffPtr = (u_char *) buffer;
+   u_char *namePtr;
+   u_char *retPtr;
+   u_char c;
+ 
+ 
+   namePtr = pQName;
+   retPtr = 0;
+ 
+   for ( i = 0; i < BUFSIZE; i++ )
+     {
+       c = *namePtr;
+       if ( c >= 0xC0 ) {
+ 	c = *(namePtr + 1);
+ 	retPtr = namePtr+2;
+ 	namePtr = buffPtr+c; 
+       } else {
+ 	if ( c == 0 )
+ 	  break;
+ 	
+ 	for ( k = 1; k <= c; k++ )
+ 	  {
+ 	    fprintf(stderr, "%c", *( namePtr + k ) );
+ 	  } /* end for loop */
+ 	fprintf(stderr,".");
+ 	namePtr += k;
+       }
+     } /* end for loop */
+   fprintf(stderr,"\n");
+   namePtr++; /* skip terminating zero */
+ 
+   if (retPtr)
+     return(retPtr);
+   else
+     return(namePtr);
+ 
+ } /* end printRRQName() */
+ 
+ 
+ u_char * sPrintRRQName( u_char *pQName, PDNS_HDR buffer, char *str )
+ {
+   u_short i, k;
+   u_char *buffPtr = (u_char *) buffer;
+   u_char *namePtr;
+   u_char *retPtr;
+   u_char c;
+ 
+   char   section[64];
+ 
+   strcpy(str,"");
+   namePtr = pQName;
+   retPtr = 0;
+ 
+   for ( i = 0; i < BUFSIZE; i++ )
+     {
+       c = *namePtr;
+       if ( c >= 0xC0 ) {
+ 	c = *(namePtr + 1);
+ 	retPtr = namePtr+2;
+ 	namePtr = buffPtr+c; 
+       } else {
+ 	if ( c == 0 )
+ 	  break;
+ 	
+ 	for ( k = 1; k <= c; k++ )
+ 	  {
+ 	    sprintf(section,"%c", *( namePtr + k ) );
+ 	    strcat(str,section);
+ 	  } /* end for loop */
+ 	strcat(str,".");
+ 	namePtr += k;
+       }
+     } /* end for loop */
+   namePtr++; /* skip terminating zero */
+ 
+   if (retPtr)
+     return(retPtr);
+   else
+     return(namePtr);
+ 
+ } /* end sPrintRRQName() */
+ 
+ 
+ void printReplyBuffer_AFSDB(PDNS_HDR replyBuff)
+ {
+   u_char *ptr = (u_char *) replyBuff;
+   int    answerCount = ntohs((replyBuff)->rr_count);
+   u_char i;
+   PDNS_AFSDB_RR_HDR 
+          rrPtr;
+ 
+   ptr += DNS_HDR_LEN;
+ 
+   /* ptr now pointing at start of QName in query field */
+   ptr = skipRRQName(ptr);
+ 
+ 
+   /* skip the query type and class fields */
+   ptr+= DNS_QTAIL_LEN;
+ 
+   /* ptr should now be at the start of the answer RR sections */
+ 
+   fprintf(stderr,"---------------------------------\n");
+   for (i=0; i<answerCount ; i++){
+     ptr = skipRRQName(ptr);
+     rrPtr = (PDNS_AFSDB_RR_HDR) ptr;
+     ptr+= DNS_AFSDB_RR_HDR_LEN;
+     if ( ntohs(rrPtr->rr_afsdb_class) == 1) {
+       fprintf(stderr,"AFDB class %d ->  ",ntohs(rrPtr->rr_afsdb_class)); 
+       ptr = printRRQName(ptr,replyBuff); }
+     else
+       ptr = skipRRQName(ptr);
+   };
+   fprintf(stderr,"---------------------------------\n");
+ 
+ 
+ };
+ 
+ void processReplyBuffer_AFSDB(SOCKET commSock, PDNS_HDR replyBuff, int *cellHosts, int *numServers, int *ttl)
+   /*PAFS_SRV_LIST (srvList)*/
+ {
+   u_char *ptr = (u_char *) replyBuff;
+   int    answerCount = ntohs((replyBuff)->rr_count);
+   u_char i;
+   PDNS_AFSDB_RR_HDR 
+          rrPtr;
+   int srvCount = 0;
+   char hostName[256];
+   struct in_addr addr;
+   int rc;
+ 
+   ptr += DNS_HDR_LEN;
+ 
+   /* ptr now pointing at start of QName in query field */
+   ptr = skipRRQName(ptr);
+ 
+ 
+   /* skip the query type and class fields */
+   ptr+= DNS_QTAIL_LEN;
+ 
+   /* ptr should now be at the start of the answer RR sections */
+ 
+   answerCount = MIN(answerCount, AFSMAXCELLHOSTS);
+ #ifdef DEBUG
+   fprintf(stderr, "processRep_AFSDB: answerCount=%d\n", answerCount);
+ #endif /* DEBUG */
+ 
+   for (i=0; i<answerCount ; i++){
+     ptr = skipRRQName(ptr);
+     rrPtr = (PDNS_AFSDB_RR_HDR) ptr;
+     ptr+= DNS_AFSDB_RR_HDR_LEN;
+     if ((ntohs(rrPtr->rr_afsdb_class) == 1) && 
+ 	(srvCount < MAX_AFS_SRVS)) {
+       /*ptr = sPrintRRQName(ptr,replyBuff,srvList->host[srvList->count]);*/
+       ptr = sPrintRRQName(ptr,replyBuff,hostName);
+       /*ptr = printRRQName(ptr,replyBuff);*/
+       *ttl = ntohl(rrPtr->rr_ttl);
+ 
+ #ifdef DEBUG
+       fprintf(stderr, "resolving name %s\n", hostName);
+ #endif
+       /* resolve name from DNS query */
+       rc = DNSgetAddr(commSock, hostName, &addr);
+       if (rc < 0)
+ 	continue;  /* skip this entry */
+ #ifdef DEBUG
+       fprintf(stderr, "processRep_AFSDB: resolved name %s to addr %x\n", hostName, addr);
+ #endif /* DEBUG */
+       memcpy(&cellHosts[srvCount], &addr.s_addr, sizeof(addr.s_addr));
+       srvCount++;
+     }
+     else {
+       ptr = skipRRQName(ptr);
+     }
+   }
+ 
+   *numServers = srvCount;
+ 
+ }
+ 
+ 
+ u_char * processReplyBuffer_Addr(PDNS_HDR replyBuff)
+ {
+   u_char *ptr = (u_char *) replyBuff;
+   int    answerCount = ntohs((replyBuff)->rr_count);
+   u_char i;
+   PDNS_A_RR_HDR 
+          rrPtr;
+ 
+ #ifdef DEBUG
+   fprintf(stderr, "processReplyBuffer_Addr: answerCount=%d\n", answerCount);
+ #endif /* DEBUG */
+   if (answerCount == 0) return 0;
+   
+   ptr += DNS_HDR_LEN;
+ 
+   /* ptr now pointing at start of QName in query field */
+   ptr = skipRRQName(ptr);
+ 
+ 
+   /* skip the query type and class fields */
+   ptr+= DNS_QTAIL_LEN;
+ 
+   /* ptr should now be at the start of the answer RR sections */
+   ptr = skipRRQName(ptr);
+   rrPtr = (PDNS_A_RR_HDR) ptr;
+ 
+ #ifdef DEBUG
+   fprintf(stderr, "type:%d, class:%d, ttl:%d, rdlength:%d\n",
+ 	 ntohs(rrPtr->rr_type),ntohs(rrPtr->rr_class),
+ 	 ntohl(rrPtr->rr_ttl),ntohs(rrPtr->rr_rdlength));
+   fprintf(stderr, "Count %d\tand Answer %8x\n",answerCount,rrPtr->rr_addr);
+ #endif /* DEBUG */
+ 
+   ptr += DNS_A_RR_HDR_LEN;
+ 
+   return (ptr);
+ 
+ };
+ 
+ int getAFSServer(char *cellName, int *cellHosts, int *numServers, int *ttl)
+ {
+   /*static AFS_SRV_LIST srvList;  
+     static int ans = 0;*/
+   SOCKET commSock;
+   SOCKADDR_IN sockAddr;
+   PDNS_HDR  pDNShdr;
+   char buffer[BUFSIZE];
+   int rc;
+ 
+ #ifdef DEBUG
+   fprintf(stderr, "getAFSServer: cell %s, cm_dnsEnabled=%d\n", cellName, cm_dnsEnabled);
+ #endif
+ 
+   if (cm_dnsEnabled == -1) { /* not yet initialized, eg when called by klog */
+     cm_InitDNS(1);    /* assume enabled */
+   }
+   if (cm_dnsEnabled == 0) {  /* possibly we failed in cm_InitDNS above */
+     fprintf(stderr, "DNS initialization failed, disabled\n");
+     *numServers = 0;
+     return -1;
+   }
+   
+   sockAddr = setSockAddr(dns_addr, DNS_PORT);
+   
+   commSock = socket( AF_INET, SOCK_DGRAM, 0 );
+   if ( commSock < 0 )
+     {
+       /*afsi_log("socket() failed\n");*/
+       fprintf(stderr, "getAFSServer: socket() failed, errno=%d\n", errno);
+       *numServers = 0;
+       return (-1);
+     } 
+   
+ #ifdef DJGPP
+   /* the win95 sock.vxd will not allow sendto for unbound sockets, 
+    *   so just bind to nothing and it works */
+   
+   __djgpp_set_socket_blocking_mode(commSock, 0);
+   bind(commSock,0,sizeof( SOCKADDR_IN ) );
+ #endif /* DJGPP */
+ 
+   rc = send_DNS_AFSDB_Query(cellName,commSock,sockAddr, buffer);
+   if (rc < 0) {
+     fprintf(stderr,"getAFSServer: send_DNS_AFSDB_Query failed\n");
+     *numServers = 0;
+     return -1;
+   }
+     
+   pDNShdr = get_DNS_Response(commSock,sockAddr, buffer);
+   
+   /*printReplyBuffer_AFSDB(pDNShdr);*/
+   if (pDNShdr)
+     processReplyBuffer_AFSDB(commSock, pDNShdr, cellHosts, numServers, ttl);
+   else
+     *numServers = 0;
+   
+   close(commSock);
+   if (*numServers == 0)
+     return(-1);
+ 
+   else
+     return 0;
+ }
+ 
+ int DNSgetAddr(SOCKET commSock, char *hostName, struct in_addr *iNet)
+ {
+   /* Variables for DNS message parsing and creation */
+   PDNS_HDR  pDNShdr;
+ 
+   SOCKADDR_IN sockAddr;
+   char buffer[BUFSIZE];
+   
+   int     i;
+   u_char *addr;
+   u_long *aPtr;
+   int rc;
+ 
+   /**********************
+    * Get a DGRAM socket *
+    **********************/
+   
+   sockAddr = setSockAddr(dns_addr, DNS_PORT);
+   
+   rc = send_DNS_Addr_Query(hostName,commSock,sockAddr, buffer);
+   if (rc < 0) return rc;
+   pDNShdr = get_DNS_Response(commSock,sockAddr, buffer);
+   if (pDNShdr == NULL)
+     return -1;
+   
+   addr = processReplyBuffer_Addr(pDNShdr);
+   if (addr == 0)
+     return -1;
+ 
+   aPtr = (u_long *) addr;
+ 
+   iNet->s_addr = *aPtr;
+ 
+   return(0);
+ }
+ 
+ #endif /* AFS_AFSDB_ENV */
Index: openafs/src/WINNT/afsd/cm_dns.h
diff -c /dev/null openafs/src/WINNT/afsd/cm_dns.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:08 2001
--- openafs/src/WINNT/afsd/cm_dns.h	Sat Oct 13 00:39:53 2001
***************
*** 0 ****
--- 1,27 ----
+ /* 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
+  */
+ 
+ /* Well-known DNS port is 53 (for both TCP and UDP,
+    although UDP is typically the only one used) */
+ 
+ #define DNS_PORT    53
+ 
+ /* this function will continue to return cell server
+    names for the given cell, ending in null */
+ int getAFSServer(char *cellname, int *cellHosts, int *numServers, int *ttl);
+ 
+ /* a supplement for the DJGPP gethostbyname ... which 
+    never bothers calling a DNS server ... so this function
+    takes care of that. This should be called when you
+    failed with gethostbyname (as that WILL check for
+    dotted decimal, and local hostfile) */
+ 
+ struct hostent *DNSgetHostByName(char *hostname);
+ 
+ 
+ 
Index: openafs/src/WINNT/afsd/cm_dns_private.h
diff -c /dev/null openafs/src/WINNT/afsd/cm_dns_private.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:08 2001
--- openafs/src/WINNT/afsd/cm_dns_private.h	Sat Oct 13 00:39:53 2001
***************
*** 0 ****
--- 1,217 ----
+ /* Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  *
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #ifndef __DNS_AFS_private_h_env_
+ #define __DNS_AFS_private_h_env_
+ 
+ #ifdef DJGPP
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+ /*#else
+   #include <windows.h>*/
+ #endif
+ 
+ #ifdef KERNEL
+ #define SOCKET struct osi_socket *
+ #else
+ #define SOCKET int
+ #endif
+ 
+ #define SOCKADDR_IN struct sockaddr_in
+ 
+ #include <stdio.h>
+ #include <string.h>
+ 
+ 
+ #ifdef DJGPP
+ 
+ char *inet_ntoa(struct in_addr in)
+ {
+   static char   out[256];
+   char temp[20];
+   unsigned long sVal,pVal;
+ 
+   out[0] = '\0';
+ 
+ 
+   pVal = ntohl(in.s_addr);
+ 
+   sVal = pVal;
+   sVal >>= 24;
+   sprintf(out,"%ld",sVal);
+ 
+   sVal = pVal;
+   sVal <<= 8;
+   sVal >>= 24;
+   sprintf(out,"%s.%ld",out,sVal);
+ 
+   sVal = pVal;
+   sVal <<= 16;
+   sVal >>= 24;
+   sprintf(out,"%s.%ld",out,sVal);
+ 
+   sVal = pVal;
+   sVal <<= 24;
+   sVal >>= 24;
+   sprintf(out,"%s.%ld",out,sVal);
+ 
+   return(&out[0]);
+ }
+ 
+ unsigned long inet_addr(const char *cp)
+ {
+   
+   unsigned long val=0;
+   unsigned char sVal;
+   
+   char   cp2[256];
+ 
+   char*  ptr = cp2;
+   int    i;
+   int    len;
+ 
+   strcpy(cp2,cp);
+ 
+   for (i=0; i<=strlen(cp); i++)
+     {
+       if (cp2[i] == '.')
+ 	{
+ 	  cp2[i] = '\0';
+ 	  sVal = atoi(ptr);
+ 	  ptr = &cp2[i+1];
+ 	  val = val << 8;
+ 	  val &= 0xffffff00;
+ 	  val |= sVal;
+ 	  //printf("%x\t%lx\n",sVal,val);
+ 	};
+     };
+   sVal = atoi(ptr);
+   val = val << 8;
+   val &= 0xffffff00;
+   val |= sVal;
+   //printf("%x\t%lx\n",sVal,val);
+   
+   return htonl(val);
+ }
+ 
+ #endif /* DJGPP */
+ 
+ #define BUFSIZE                 2048
+ 
+ /*
+  * AFS Server List (a list of host names and their count)
+  */
+ #define MAX_AFS_SRVS 20
+ typedef struct afs_srvlist
+ {
+   unsigned short  count;           /* number of host names */
+   char     host[MAX_AFS_SRVS][256];/* array of hosts*/
+ } AFS_SRV_LIST, *PAFS_SRV_LIST;
+ 
+ 
+ /*
+  * DNS Message Header
+  */
+ typedef struct dns_hdr
+ {
+   unsigned short id;          /* client query ID number */
+   unsigned short flags;       /* qualify contents <see below> */
+   unsigned short q_count;     /* number of questions */
+   unsigned short rr_count;    /* number of answer RRs */
+   unsigned short auth_count;  /* number of authority RRs */
+   unsigned short add_count;   /* number of additional RRs */
+ } DNS_HDR, *PDNS_HDR;
+ 
+ #define DNS_HDR_LEN sizeof(DNS_HDR)
+ 
+ 
+ 
+ /* THESE WERE ALSO WRONG !!!! */
+ #define DNS_FLAG_RD 0x0100
+ 
+ /*
+  * DNS query class and response type for the tail of the query packet
+  */
+ typedef struct dns_qtail
+ {
+         unsigned short qtype;                /* Query type (2bytes) - for responses */
+         unsigned short qclass;               /* Query Class (2bytes) - for questions */
+ } DNS_QTAIL, *PDNS_QTAIL;
+ 
+ #define DNS_QTAIL_LEN sizeof(DNS_QTAIL)
+ 
+ /* DNS Generic Resource Record format (from RFC 1034 and 1035)
+  *
+  *  NOTE: The first field in the DNS RR Record header is always
+  *   the domain name in QNAME format (see earlier description)
+  */
+ typedef struct dns_rr_hdr
+ {
+         unsigned short rr_type;        /* RR type code (e.g. A, MX, NS, etc.) */
+         unsigned short rr_class;       /* RR class code (IN for Internet) */
+         unsigned long  rr_ttl;         /* Time-to-live for resource */
+         unsigned short rr_rdlength;    /* length of RDATA field (in octets) */
+ } DNS_RR_HDR, *PDNS_RR_HDR;
+ 
+ #define DNS_RR_HDR_LEN sizeof(DNS_RR_HDR)
+ 
+ #define DNS_RRTYPE_A     1
+ #define DNS_RRTYPE_NS    2
+ #define DNS_RRTYPE_CNAME 5
+ #define DNS_RRTYPE_SOA   6
+ #define DNS_RRTYPE_WKS   11
+ #define DNS_RRTYPE_PTR   12
+ #define DNS_RRTYPE_HINFO 13
+ #define DNS_RRTYPE_MX    15
+ #define DNS_RRTYPE_AFSDB 18
+ 
+ 
+ #define DNS_RRCLASS_IN    1    // Internet
+ #define DNS_RRCLASS_CS    2    // CSNET
+ #define DNS_RRCLASS_CH    3    // CHAOS Net
+ #define DNS_RRCLASS_HS    4    // Hesiod
+ #define DNS_RRCLASS_WILD  255  // WildCard - all classes
+ 
+ /* 
+  * DNS AFSDB Resource Data Field
+  */
+ typedef struct dns_afsdb_rr_hdr
+ {
+   unsigned short rr_type;        /* RR type code (e.g. A, MX, NS, etc.) */
+   unsigned short rr_class;       /* RR class code (IN for Internet) */
+   unsigned long  rr_ttl;         /* Time-to-live for resource */
+   unsigned short rr_rdlength;    /* length of RDATA field (in octets) */
+   unsigned short rr_afsdb_class; /* 1-AFS , 2-DCE */
+ } DNS_AFSDB_RR_HDR, *PDNS_AFSDB_RR_HDR;
+ 
+ #define DNS_AFSDB_RR_HDR_LEN sizeof(DNS_AFSDB_RR_HDR)
+ 
+ /* 
+  * DNS A Resource Data Field
+  */
+ typedef struct dns_a_rr_hdr
+ {
+   unsigned short rr_type;        /* RR type code (e.g. A, MX, NS, etc.) */
+   unsigned short rr_class;       /* RR class code (IN for Internet) */
+   unsigned long  rr_ttl;         /* Time-to-live for resource */
+   unsigned short rr_rdlength;    /* length of RDATA field (in octets) */
+   unsigned long  rr_addr;        /* Resolved host address */
+ } DNS_A_RR_HDR, *PDNS_A_RR_HDR;
+ 
+ #define DNS_A_RR_LEN      14 //sizeof(DNS_A_RR_HDR)
+ #define DNS_A_RR_HDR_LEN  10 //(DNS_A_RR_LEN - sizeof(unsigned long))
+ 
+ int  putQName( char *pszHostName, char *pQName );
+ unsigned char * printRRQName( unsigned char *pQName, PDNS_HDR buffer );
+ unsigned char * skipRRQName(unsigned char *pQName);
+ /* void printReplyBuffer_AFSDB(PDNS_HDR replyBuff); */
+ 
+ #endif //__DNS_AFS_private_h_env_
+ 
Index: openafs/src/WINNT/afsd/cm_freelance.c
diff -c /dev/null openafs/src/WINNT/afsd/cm_freelance.c:1.2.2.3
*** /dev/null	Wed Nov 21 01:54:08 2001
--- openafs/src/WINNT/afsd/cm_freelance.c	Wed Nov 14 22:31:26 2001
***************
*** 0 ****
--- 1,543 ----
+ #include <afs/param.h>
+ #include <afs/stds.h>
+ 
+ #ifndef DJGPP
+ #include <windows.h>
+ #include <winsock2.h>
+ #else
+ #include <netdb.h>
+ #endif /* !DJGPP */
+ #include <stdlib.h>
+ #include <malloc.h>
+ #include <string.h>
+ 
+ #include <rx/rx.h>
+ 
+ #include "afsd.h"
+ #ifdef AFS_FREELANCE_CLIENT
+ #include "cm_freelance.h"
+ #include "stdio.h"
+ 
+ int cm_noLocalMountPoints;
+ int cm_fakeDirSize;
+ int cm_fakeDirCallback=0;
+ int cm_fakeGettingCallback=0;
+ int cm_fakeDirVersion = 0x8;
+ cm_localMountPoint_t* cm_localMountPoints;
+ osi_mutex_t cm_Freelance_Lock;
+ int cm_localMountPointChangeFlag = 0;
+ int cm_freelanceEnabled = 0;
+ 
+ void cm_InitFakeRootDir();
+ 
+ void cm_InitFreelance() {
+   
+ 	lock_InitializeMutex(&cm_Freelance_Lock, "Freelance Lock");
+   
+ 	// yj: first we make a call to cm_initLocalMountPoints
+ 	// to read all the local mount points from an ini file
+ 	cm_InitLocalMountPoints();
+ 	
+ 	// then we make a call to InitFakeRootDir to create
+ 	// a fake root directory based on the local mount points
+ 	cm_InitFakeRootDir();
+ 
+ 	// --- end of yj code
+ }
+ 
+ /* yj: Initialization of the fake root directory */
+ /* to be called while holding freelance lock unless during init. */
+ void cm_InitFakeRootDir() {
+ 	
+ 	int i, j, t1, t2;
+ 	char* currentPos;
+ 	int noChunks;
+ 	char mask;
+ 	
+ 
+ 	// allocate space for the fake info
+ 	cm_dirHeader_t fakeDirHeader;
+ 	cm_dirEntry_t fakeEntry;
+ 	cm_pageHeader_t fakePageHeader;
+ 
+ 	// i'm going to calculate how much space is needed for
+ 	// this fake root directory. we have these rules:
+ 	// 1. there are cm_noLocalMountPoints number of entries
+ 	// 2. each page is CM_DIR_PAGESIZE in size
+ 	// 3. the first 13 chunks of the first page are used for
+ 	//    some header stuff
+ 	// 4. the first chunk of all subsequent pages are used
+ 	//    for page header stuff
+ 	// 5. a max of CM_DIR_EPP entries are allowed per page
+ 	// 6. each entry takes 1 or more chunks, depending on 
+ 	//    the size of the mount point string, as determined
+ 	//    by cm_NameEntries
+ 	// 7. each chunk is CM_DIR_CHUNKSIZE bytes
+ 
+ 	int CPP = CM_DIR_PAGESIZE / CM_DIR_CHUNKSIZE;
+ 	int curChunk = 13;	// chunks 0 - 12 are used for header stuff
+ 						// of the first page in the directory
+ 	int curPage = 0;
+ 	int curDirEntry = 0;
+ 	int curDirEntryInPage = 0;
+ 	int sizeOfCurEntry;
+ 	int dirSize;
+ 
+ 	/* Reserve 2 directory chunks for "." and ".." */
+ 	curChunk += 2;
+ 
+ 	while (curDirEntry!=cm_noLocalMountPoints) {
+ 		sizeOfCurEntry = cm_NameEntries((cm_localMountPoints+curDirEntry)->namep, 0);
+ 		if ((curChunk + sizeOfCurEntry >= CPP) ||
+ 			(curDirEntryInPage + 1 >= CM_DIR_EPP)) {
+ 			curPage++;
+ 			curDirEntryInPage = 0;
+ 			curChunk = 1;
+ 		}
+ 		curChunk += sizeOfCurEntry;
+ 		curDirEntry++;
+ 		curDirEntryInPage++;
+ 	}
+ 
+ 	dirSize = (curPage+1) *  CM_DIR_PAGESIZE;
+ 	cm_FakeRootDir = malloc(dirSize);
+ 	cm_fakeDirSize = dirSize;
+ 
+ 	
+ 
+ 	// yj: when we get here, we've figured out how much memory we need and 
+ 	// allocated the appropriate space for it. we now prceed to fill
+ 	// it up with entries.
+ 	curPage = 0;
+ 	curDirEntry = 0;
+ 	curDirEntryInPage = 0;
+ 	curChunk = 0;
+ 	
+ 	// fields in the directory entry that are unused.
+ 	fakeEntry.flag = 1;
+ 	fakeEntry.length = 0;
+ 	fakeEntry.next = 0;
+ 	fakeEntry.fid.unique = htonl(1);
+ 
+ 	// the first page is special, it uses fakeDirHeader instead of fakePageHeader
+ 	// we fill up the page with dirEntries that belong there and we make changes
+ 	// to the fakeDirHeader.header.freeBitmap along the way. Then when we're done
+ 	// filling up the dirEntries in this page, we copy the fakeDirHeader into 
+ 	// the top of the page.
+ 
+ 	// init the freeBitmap array
+ 	for (i=0; i<8; i++) 
+ 		fakeDirHeader.header.freeBitmap[i]=0;
+ 
+ 	fakeDirHeader.header.freeBitmap[0] = 0xff;
+ 	fakeDirHeader.header.freeBitmap[1] = 0x7f;
+ 	
+ 
+ 	// we start counting at 13 because the 0th to 12th chunks are used for header
+ 	curChunk = 13;
+ 
+ 	// stick the first 2 entries "." and ".." in
+ 	fakeEntry.fid.unique = htonl(1);
+ 	fakeEntry.fid.vnode = htonl(1);
+ 	strcpy(fakeEntry.name, ".");
+ 	currentPos = cm_FakeRootDir + curPage * CM_DIR_PAGESIZE + curChunk * CM_DIR_CHUNKSIZE;
+ 	memcpy(currentPos, &fakeEntry, CM_DIR_CHUNKSIZE);
+ 	curChunk++; curDirEntryInPage++;
+ 	strcpy(fakeEntry.name, "..");
+ 	currentPos = cm_FakeRootDir + curPage * CM_DIR_PAGESIZE + curChunk * CM_DIR_CHUNKSIZE;
+ 	memcpy(currentPos, &fakeEntry, CM_DIR_CHUNKSIZE);
+ 	curChunk++; curDirEntryInPage++;
+ 
+ 	// keep putting stuff into page 0 if
+ 	// 1. we're not done with all entries
+ 	// 2. we have less than CM_DIR_EPP entries in page 0
+ 	// 3. we're not out of chunks in page 0
+ 
+ 	while( (curDirEntry!=cm_noLocalMountPoints) && 
+ 		   (curDirEntryInPage < CM_DIR_EPP) &&
+ 		   (curChunk + cm_NameEntries((cm_localMountPoints+curDirEntry)->namep, 0) <= CPP)) 
+ 	{
+ 
+ 		noChunks = cm_NameEntries((cm_localMountPoints+curDirEntry)->namep, 0);
+ 		fakeEntry.fid.vnode = htonl(curDirEntry + 2);
+ 		currentPos = cm_FakeRootDir + curPage * CM_DIR_PAGESIZE + curChunk * CM_DIR_CHUNKSIZE;
+ 
+ 		memcpy(currentPos, &fakeEntry, CM_DIR_CHUNKSIZE);
+ 		strcpy(currentPos + 12, (cm_localMountPoints+curDirEntry)->namep);
+ 		curDirEntry++;
+ 		curDirEntryInPage++;
+ 		for (i=0; i<noChunks; i++) {
+ 			t1 = (curChunk + i) / 8;
+ 			t2 = curChunk + i - (t1*8);
+ 			fakeDirHeader.header.freeBitmap[t1] |= (1 << t2);
+ 		}
+ 		curChunk+=noChunks;
+ 	}
+ 
+ 	// when we get here, we're done with filling in the entries for page 0
+ 	// copy in the header info
+ 
+ 	memcpy(cm_FakeRootDir, &fakeDirHeader, 13 * CM_DIR_CHUNKSIZE);
+ 
+ 	curPage++;
+ 
+ 	// ok, page 0's done. Move on to the next page.
+ 	while (curDirEntry!=cm_noLocalMountPoints) {
+ 		// setup a new page
+ 		curChunk = 1;			// the zeroth chunk is reserved for page header
+ 		curDirEntryInPage = 0; 
+ 		for (i=0; i<8; i++) {
+ 			fakePageHeader.freeBitmap[i]=0;
+ 		}
+ 		fakePageHeader.freeCount = 0;
+ 		fakePageHeader.pgcount = 0;
+ 		fakePageHeader.tag = htons(1234);
+ 		
+ 		// while we're on the same page...
+ 		while ( (curDirEntry!=cm_noLocalMountPoints) &&
+ 				(curDirEntryInPage < CM_DIR_EPP) &&
+ 			    (curChunk + cm_NameEntries((cm_localMountPoints+curDirEntry)->namep, 0) <= CPP))
+ 		{
+ 			// add an entry to this page
+ 
+ 			noChunks = cm_NameEntries((cm_localMountPoints+curDirEntry)->namep, 0);
+ 			fakeEntry.fid.vnode=htonl(curDirEntry+2);
+ 			currentPos = cm_FakeRootDir + curPage * CM_DIR_PAGESIZE + curChunk * CM_DIR_CHUNKSIZE;
+ 			memcpy(currentPos, &fakeEntry, CM_DIR_CHUNKSIZE);
+ 			strcpy(currentPos + 12, (cm_localMountPoints+curDirEntry)->namep);
+ 			curDirEntry++;
+ 			curDirEntryInPage++;
+ 			for (i=0; i<noChunks; i++) {
+ 				t1 = (curChunk + i) / 8;
+ 				t2 = curChunk + i - (t1*8);
+ 				fakePageHeader.freeBitmap[t1] |= (1 << t2);
+ 			}
+ 			curChunk+=noChunks;
+ 		}
+ 		memcpy(cm_FakeRootDir + curPage * CM_DIR_PAGESIZE, &fakePageHeader, sizeof(fakePageHeader));
+ 
+ 		curPage++;
+ 	}
+ 	
+ 	// we know the fakeDir is setup properly, so we claim that we have callback
+ 	cm_fakeDirCallback=1;
+ 
+ 	// when we get here, we've set up everything! done!
+ 
+ 
+ }
+ 
+ int cm_FakeRootFid(cm_fid_t *fidp)
+ {
+   fidp->cell = 0x1;            /* root cell */
+ 	fidp->volume = 0x20000001;   /* root.afs ? */
+ 	fidp->vnode = 0x1;
+ 	fidp->unique = 0x1;
+ }
+   
+ int cm_getLocalMountPointChange() {
+   return cm_localMountPointChangeFlag;
+ }
+ 
+ int cm_clearLocalMountPointChange() {
+   cm_localMountPointChangeFlag = 0;
+ }
+ 
+ /* called directly from ioctl */
+ /* called while not holding freelance lock */
+ int cm_noteLocalMountPointChange() {
+   lock_ObtainMutex(&cm_Freelance_Lock);
+   cm_fakeDirVersion++;
+   cm_localMountPointChangeFlag = 1;
+   lock_ReleaseMutex(&cm_Freelance_Lock);
+   return 1;
+ }
+ 
+ int cm_reInitLocalMountPoints() {
+ 	cm_fid_t aFid;
+ 	int i, j, hash;
+ 	cm_scache_t *scp, **lscpp, *tscp;
+ 
+ 	
+ 	printf("\n\n----- reinitialization starts ----- \n");
+ 
+ 
+ 	// first we invalidate all the SCPs that were created
+ 	// for the local mount points
+ 
+ 	printf("Invalidating local mount point scp...  ");
+ 
+ 	aFid.cell = 0x1;
+ 	aFid.volume=0x20000001;
+ 	aFid.unique=0x1;
+ 	aFid.vnode=0x2;
+ 
+ 	lock_ObtainWrite(&cm_scacheLock);
+ 	lock_ObtainMutex(&cm_Freelance_Lock);  /* always scache then freelance lock */
+ 	for (i=0; i<cm_noLocalMountPoints; i++) {
+ 		hash = CM_SCACHE_HASH(&aFid);
+ 		for (scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
+ 			if (scp->fid.volume == aFid.volume &&
+ 				scp->fid.vnode == aFid.vnode &&
+ 				scp->fid.unique == aFid.unique 
+ 				) {
+ 
+ 				// mark the scp to be reused
+ 				lock_ReleaseWrite(&cm_scacheLock);
+ 				lock_ObtainMutex(&scp->mx);
+ 				cm_DiscardSCache(scp);
+ 				lock_ReleaseMutex(&scp->mx);
+ 				cm_CallbackNotifyChange(scp);
+ 				lock_ObtainWrite(&cm_scacheLock);
+ 				scp->refCount--;
+ 
+ 				// take the scp out of the hash
+ 				lscpp = &cm_hashTablep[hash];
+ 				for (tscp=*lscpp; tscp; lscpp = &tscp->nextp, tscp = *lscpp) {
+ 					if (tscp == scp) break;
+ 				}
+ 				*lscpp = scp->nextp;
+ 				scp->flags &= ~CM_SCACHEFLAG_INHASH;
+ 
+ 
+ 			}
+ 		}
+ 		aFid.vnode = aFid.vnode + 1;
+ 	}
+ 	lock_ReleaseWrite(&cm_scacheLock);
+ 	printf("\tall old scp cleared!\n");
+ 
+ 	// we must free the memory that was allocated in the prev
+ 	// cm_InitLocalMountPoints call
+ 	printf("Removing old localmountpoints...  ");
+ 	free(cm_localMountPoints);
+ 	printf("\tall old localmountpoints cleared!\n");
+ 
+ 	// now re-init the localmountpoints
+ 	printf("Creating new localmountpoints...  ");
+ 	cm_InitLocalMountPoints();
+ 	printf("\tcreated new set of localmountpoints!\n");
+ 	
+ 	
+ 	// now we have to free the memory allocated in cm_initfakerootdir
+ 	printf("Removing old fakedir...  ");
+ 	free(cm_FakeRootDir);
+ 	printf("\t\told fakedir removed!\n");
+ 
+ 	// then we re-create that dir
+ 	printf("Creating new fakedir...  ");
+ 	cm_InitFakeRootDir();
+ 	printf("\t\tcreated new fakedir!\n");	
+ 
+ 	lock_ReleaseMutex(&cm_Freelance_Lock);
+ 
+ 	printf("----- reinit complete -----\n\n");
+ }
+ 
+ 
+ // yj: open up the ini file and read all the local mount 
+ // points that are stored there. Part of the initialization
+ // process for the freelance client.
+ /* to be called while holding freelance lock unless during init. */
+ long cm_InitLocalMountPoints() {
+ 	
+ 	FILE *fp;
+ 	char line[200];
+ 	int n, i;
+ 	char* t;
+ 	cm_localMountPoint_t* aLocalMountPoint;
+ 	char hdir[120];
+ 
+ 	cm_GetConfigDir(hdir);
+ 	strcat(hdir, AFS_FREELANCE_INI);
+ 	// open the ini file for reading
+ 	fp = fopen(hdir, "r");
+ 
+ 	// if we fail to open the file, create an empty one
+ 	if (!fp) {
+ 	  fp = fopen(hdir, "w");
+ 	  fputs("0\n", fp);
+ 	  fclose(fp);
+ 	  return 0;  /* success */
+ 	}
+ 
+ 	// we successfully opened the file
+ #ifdef DEBUG
+ 	fprintf(stderr, "opened afs_freelance.ini\n");
+ #endif
+ 	
+ 	// now we read the first line to see how many entries
+ 	// there are
+ 	fgets(line, 200, fp);
+ 
+ 	// if the line is empty at any point when we're reading
+ 	// we're screwed. report error and return.
+ 	if (*line==0) {
+ 		afsi_log("error occurred while reading afs_freelance.ini");
+ 		fprintf(stderr, "error occurred while reading afs_freelance.ini");
+ 		return -1;
+ 	}
+ 
+ 	// get the number of entries there are from the first line
+ 	// that we read
+ 	cm_noLocalMountPoints = atoi(line);
+ 
+ 	// create space to store the local mount points
+ 	cm_localMountPoints = malloc(sizeof(cm_localMountPoint_t) * cm_noLocalMountPoints);
+ 	aLocalMountPoint = cm_localMountPoints;
+ 		
+ 	// now we read n lines and parse them into local mount points
+ 	// where n is the number of local mount points there are, as
+ 	// determined above.
+ 	// Each line in the ini file represents 1 local mount point and 
+ 	// is in the format xxx#yyy:zzz, where xxx is the directory
+ 	// entry name, yyy is the cell name and zzz is the volume name.
+ 	// #yyy:zzz together make up the mount point.
+ 	for (i=0; i<cm_noLocalMountPoints; i++) {
+ 		fgets(line, 200, fp);
+ 		// check that the line is not empty
+ 		if (line[0]==0) {
+ 			afsi_log("error occurred while parsing entry in %s: empty line in line %d", AFS_FREELANCE_INI, i);
+ 			fprintf(stderr, "error occurred while parsing entry in afs_freelance.ini: empty line in line %d", i);
+ 			return -1;
+ 		}
+ 		// line is not empty, so let's parse it
+ 		t = strchr(line, '#');
+ 		// make sure that there is a '#' separator in the line
+ 		if (!t) {
+ 			afsi_log("error occurred while parsing entry in %s: no # separator in line %d", AFS_FREELANCE_INI, i);
+ 			fprintf(stderr, "error occurred while parsing entry in afs_freelance.ini: no # separator in line %d", i);
+ 			return -1;
+ 		}
+ 		aLocalMountPoint->namep=malloc(t-line+1);
+ 		memcpy(aLocalMountPoint->namep, line, t-line);
+ 		*(aLocalMountPoint->namep + (t-line)) = 0;
+ 		aLocalMountPoint->mountPointStringp=malloc(strlen(line) - (t-line) + 1);
+ 		memcpy(aLocalMountPoint->mountPointStringp, t, strlen(line)-(t-line)-2);
+ 		*(aLocalMountPoint->mountPointStringp + (strlen(line)-(t-line)-2)) = 0;
+ #ifdef DEBUG
+ 		fprintf(stderr, "found mount point: name %s, string %s\n",
+ 			aLocalMountPoint->namep,
+ 			aLocalMountPoint->mountPointStringp);
+ #endif
+ 		
+ 		aLocalMountPoint++;
+ 
+ 	}
+ 	fclose(fp);
+ 	return 0;
+ }
+ 
+ 
+ int cm_getNoLocalMountPoints() {
+ 	return cm_noLocalMountPoints;
+ }
+ 
+ cm_localMountPoint_t* cm_getLocalMountPoint(int vnode) {
+ 	return 0;
+ }
+ 
+ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, cm_fid_t *fidp)
+ {
+     FILE *fp;
+     char hfile[120];
+     char line[200];
+     char fullname[200];
+     int n;
+ 
+     /* before adding, verify the cell name; if it is not a valid cell,
+        don't add the mount point */
+     /* major performance issue? */
+     if (!cm_GetCell_Gen(cellname, fullname, CM_FLAG_CREATE))
+       return -1;
+ #if 0
+     if (strcmp(cellname, fullname) != 0)   /* no partial matches allowed */
+       return -1;
+ #endif
+     
+     lock_ObtainMutex(&cm_Freelance_Lock);
+ 
+      cm_GetConfigDir(hfile);
+      strcat(hfile, AFS_FREELANCE_INI);
+      fp = fopen(hfile, "r+");
+      if (!fp)
+        return CM_ERROR_INVAL;
+      fgets(line, 200, fp);
+      n = atoi(line);
+      n++;
+      fseek(fp, 0, SEEK_SET);
+      fprintf(fp, "%d", n);
+      fseek(fp, 0, SEEK_END);
+      fprintf(fp, "%s#%s:%s\n", filename, fullname, volume);
+      fclose(fp);
+      lock_ReleaseMutex(&cm_Freelance_Lock);
+ 
+      /*cm_reInitLocalMountPoints(&vnode);*/
+      if (fidp) {
+        fidp->unique = 1;
+        fidp->vnode = cm_noLocalMountPoints + 1;   /* vnode value of last mt pt */
+      }
+      cm_noteLocalMountPointChange();
+      
+      return 0;
+ }
+ 
+ long cm_FreelanceRemoveMount(char *toremove)
+ {
+      int i, n, t1, t2;
+      char* cp;
+      char line[200];
+      char shortname[200];
+      char hfile[120], hfile2[120];
+      FILE *fp1, *fp2;
+      char cmd[200];
+      int found=0;
+ 
+     lock_ObtainMutex(&cm_Freelance_Lock);
+ 
+      cm_GetConfigDir(hfile);
+      strcat(hfile, AFS_FREELANCE_INI);
+      strcpy(hfile2, hfile);
+      strcat(hfile2, "2");
+      fp1=fopen(hfile, "r+");
+      if (!fp1)
+        return CM_ERROR_INVAL;
+      fp2=fopen(hfile2, "w+");
+      if (!fp2) {
+        fclose(fp1);
+        return CM_ERROR_INVAL;
+      }
+ 
+      fgets(line, 200, fp1);
+      n=atoi(line);
+      fprintf(fp2, "%d\n", n-1);
+ 
+      for (i=0; i<n; i++) {
+           fgets(line, 200, fp1);
+           cp=strchr(line, '#');
+           memcpy(shortname, line, cp-line);
+           shortname[cp-line]=0;
+ 
+           if (strcmp(shortname, toremove)==0) {
+ 
+           } else {
+ 	    found = 1;
+ 	    fputs(line, fp2);
+           }
+      }
+ 
+      fclose(fp1);
+      fclose(fp2);
+      if (!found)
+        return CM_ERROR_NOSUCHFILE;
+ 
+      unlink(hfile);
+      rename(hfile2, hfile);
+ 
+      lock_ReleaseMutex(&cm_Freelance_Lock);
+ 
+      cm_noteLocalMountPointChange();
+      return 0;
+ }
+ 
+ #endif /* AFS_FREELANCE_CLIENT */
Index: openafs/src/WINNT/afsd/cm_freelance.h
diff -c /dev/null openafs/src/WINNT/afsd/cm_freelance.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:08 2001
--- openafs/src/WINNT/afsd/cm_freelance.h	Sat Oct 13 00:39:53 2001
***************
*** 0 ****
--- 1,19 ----
+ #ifndef _CM_FREELANCE_H
+ #define _CM_FREELANCE_H 1
+ 
+ 
+ typedef struct cm_localMountPoint {
+ 	char* namep;
+ 	char* mountPointStringp;
+ 	struct cm_localMountPoint* next;
+ } cm_localMountPoint_t;
+ 
+ extern int cm_getNoLocalMountPoints();
+ extern long cm_InitLocalMountPoints();
+ extern int cm_getLocalMountPointChange();
+ extern int cm_reInitLocalMountPoints();
+ extern cm_localMountPoint_t* cm_getLocalMountPoint(int vnode);
+ 
+ #define AFS_FREELANCE_INI "afs_freelance.ini"
+ 
+ #endif // _CM_FREELANCE_H
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.5 openafs/src/WINNT/afsd/cm_ioctl.c:1.5.4.3
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.5	Sat Jun 23 13:26:07 2001
--- openafs/src/WINNT/afsd/cm_ioctl.c	Wed Nov 21 01:45:40 2001
***************
*** 44,49 ****
--- 44,52 ----
  #define MAX_PATH 260
  
  osi_mutex_t cm_Afsdsbmt_Lock;
+ #ifdef AFS_FREELANCE_CLIENT
+ extern osi_mutex_t cm_Freelance_Lock;
+ #endif
  
  extern afs_int32 cryptall;
  
***************
*** 1130,1135 ****
--- 1133,1139 ----
          char fullCell[256];
  	char volume[256];
  	char cell[256];
+ 	int ttl;
  
  	cm_InitReq(&req);
          
***************
*** 1155,1161 ****
  	
  	        /* Get the full name for this cell */
  	        code = cm_SearchCellFile(cell, fullCell, 0, 0);
! 		if (code)
  			return CM_ERROR_NOSUCHCELL;
  	
  	        sprintf(mpInfo, "%c%s:%s", *ioctlp->inDatap, fullCell, volume);
--- 1159,1169 ----
  	
  	        /* Get the full name for this cell */
  	        code = cm_SearchCellFile(cell, fullCell, 0, 0);
! #ifdef AFS_AFSDB_ENV
! 		if (code && cm_dnsEnabled)
!                   code = cm_SearchCellByDNS(cell, fullCell, &ttl, 0, 0);
! #endif
! 		  if (code)
  			return CM_ERROR_NOSUCHCELL;
  	
  	        sprintf(mpInfo, "%c%s:%s", *ioctlp->inDatap, fullCell, volume);
***************
*** 1164,1169 ****
--- 1172,1185 ----
  	        strcpy(mpInfo, ioctlp->inDatap);
          }
  
+ #ifdef AFS_FREELANCE_CLIENT
+ 	if (cm_freelanceEnabled && dscp == cm_rootSCachep) {
+ 	  /* we are adding the mount point to the root dir., so call
+ 	     the freelance code to do the add. */
+ 	  code = cm_FreelanceAddMount(leaf, fullCell, volume, NULL);
+ 	  return code;
+ 	}
+ #endif
  	/* create the symlink with mode 644.  The lack of X bits tells
           * us that it is a mount point.
           */
***************
*** 1340,1345 ****
--- 1356,1362 ----
  	afs_uuid_t uuid;
  	int flags;
  	char sessionKey[8];
+ 	char *smbname;
  
  	saveDataPtr = ioctlp->inDatap;
  
***************
*** 1384,1389 ****
--- 1401,1413 ----
  		uname = tp;
  		tp += strlen(tp) + 1;
  
+         if (flags & PIOCTL_LOGON) {
+ 		  /* SMB user name with which to associate tokens */
+ 		  smbname = tp;
+ 		  fprintf(stderr, "SMB name = %s\n", smbname);
+ 		  tp += strlen(tp) + 1;
+         }
+ 
  #ifndef DJGPP   /* for win95, session key is back in pioctl */
  		/* uuid */
  		memcpy(&uuid, tp, sizeof(uuid));
***************
*** 1394,1401 ****
  		cellp = cm_rootCellp;
  
  	if (flags & PIOCTL_LOGON) {
!           userp = smb_FindCMUserByName(/*ioctlp->fidp->vcp,*/ uname,
!                                                               ioctlp->fidp->vcp->rname);
  	}
  	
  	/* store the token */
--- 1418,1424 ----
  		cellp = cm_rootCellp;
  
  	if (flags & PIOCTL_LOGON) {
!           userp = smb_FindCMUserByName(smbname, ioctlp->fidp->vcp->rname);
  	}
  	
  	/* store the token */
***************
*** 1854,1862 ****
  extern int afsd_shutdown(int);
  extern int afs_shutdown;
  
! long cm_IoctlShutdown(smb_ioctl_t *ioctlp, cm_user_t *userp)
! {
    afs_shutdown = 1;   /* flag to shut down */
    return 0;
  }
  #endif /* DJGPP */
--- 1877,1897 ----
  extern int afsd_shutdown(int);
  extern int afs_shutdown;
  
! long cm_IoctlShutdown(smb_ioctl_t *ioctlp, cm_user_t *userp) {
    afs_shutdown = 1;   /* flag to shut down */
    return 0;
  }
  #endif /* DJGPP */
+ 
+ long cm_IoctlGetSMBName(smb_ioctl_t *ioctlp, cm_user_t *userp)
+ {
+   smb_user_t *uidp = ioctlp->uidp;
+ 
+   if (uidp && uidp->unp) {
+     memcpy(ioctlp->outDatap, uidp->unp->name, strlen(uidp->unp->name));
+     ioctlp->outDatap += strlen(uidp->unp->name);
+ 	}
+ 
+   return 0;
+ }
+ 
Index: openafs/src/WINNT/afsd/cm_ioctl.h
diff -c openafs/src/WINNT/afsd/cm_ioctl.h:1.4 openafs/src/WINNT/afsd/cm_ioctl.h:1.4.4.1
*** openafs/src/WINNT/afsd/cm_ioctl.h:1.4	Mon Apr 30 02:48:05 2001
--- openafs/src/WINNT/afsd/cm_ioctl.h	Sat Oct 13 00:19:06 2001
***************
*** 125,130 ****
--- 125,133 ----
  
  extern long cm_IoctlShutdown(smb_ioctl_t *ioctlp, cm_user_t *userp);
  
+ extern long cm_IoctlFreemountAddCell(smb_ioctl_t *ioctlp, cm_user_t *userp);
+ 
+ extern long cm_IoctlFreemountRemoveCell(smb_ioctl_t *ioctlp, cm_user_t *userp);
  
  #endif /* __CM_IOCTL_INTERFACES_ONLY__ */
  
Index: openafs/src/WINNT/afsd/cm_scache.c
diff -c openafs/src/WINNT/afsd/cm_scache.c:1.3 openafs/src/WINNT/afsd/cm_scache.c:1.3.4.1
*** openafs/src/WINNT/afsd/cm_scache.c:1.3	Mon Apr 30 02:48:05 2001
--- openafs/src/WINNT/afsd/cm_scache.c	Sat Oct 13 00:19:06 2001
***************
*** 43,48 ****
--- 43,52 ----
  /* Dummy scache entry for use with pioctl fids */
  cm_scache_t cm_fakeSCache;
  
+ #ifdef AFS_FREELANCE_CLIENT
+ extern osi_mutex_t cm_Freelance_Lock;
+ #endif
+ 
  /* must be called with cm_scacheLock write-locked! */
  void cm_AdjustLRU(cm_scache_t *scp)
  {
***************
*** 236,246 ****
--- 240,255 ----
          long code;
          cm_volume_t *volp;
          cm_cell_t *cellp;
+ 	char* mp;
+ 	int special; // yj: boolean variable to test if file is on root.afs
+ 	int isRoot;
          
          hash = CM_SCACHE_HASH(fidp);
          
  	osi_assert(fidp->cell != 0);
  
+ 	// yj: check if we have the scp, if so, we don't need
+ 	// to do anything else
          lock_ObtainWrite(&cm_scacheLock);
  	for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
  		if (cm_FidCmp(fidp, &scp->fid) == 0) {
***************
*** 252,269 ****
                  }
          }
          
!         /* otherwise, we need to find the volume */
!         lock_ReleaseWrite(&cm_scacheLock);	/* for perf. reasons */
!         cellp = cm_FindCellByID(fidp->cell);
!         if (!cellp) return CM_ERROR_NOSUCHCELL;
  
!         code = cm_GetVolumeByID(cellp, fidp->volume, userp, reqp, &volp);
!         if (code) return code;
          
          /* otherwise, we have the volume, now reverify that the scp doesn't
           * exist, and proceed.
           */
-         lock_ObtainWrite(&cm_scacheLock);
  	for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
  		if (cm_FidCmp(fidp, &scp->fid) == 0) {
  			scp->refCount++;
--- 261,345 ----
                  }
          }
          
! 	// yj: when we get here, it means we don't have an scp
! 	// so we need to either load it or fake it, depending
! 	// on whether the file is "special", see below.
! 
! 	// yj: if we're trying to get an scp for a file that's
! 	// on root.afs of homecell, we want to handle it specially
! 	// because we have to fill in the status stuff 'coz we
! 	// don't want trybulkstat to fill it in for us
! #ifdef AFS_FREELANCE_CLIENT
! 	special = (fidp->cell==0x1 && fidp->volume==0x20000001 && 
! 			   !(fidp->vnode==0x1 && fidp->unique==0x1));
! 	isRoot = (fidp->cell==0x1 && fidp->volume==0x20000001 && 
! 			   fidp->vnode==0x1 && fidp->unique==0x1);
! 	if (cm_freelanceEnabled && isRoot) {
!           /* freelance: if we are trying to get the root scp for the first
!              time, we will just put in a place holder entry. */
! 	  volp = NULL;
! 	}
! 	  
! 	if (cm_freelanceEnabled && special) {
! 	  /*afsi_log("cm_getscache: special"); */
! 	        lock_ObtainMutex(&cm_Freelance_Lock);
! 		mp =(cm_localMountPoints+fidp->vnode-2)->mountPointStringp;
! 		lock_ReleaseMutex(&cm_Freelance_Lock);
! 		
! 		scp = cm_GetNewSCache();
! 		
! 		scp->fid = *fidp;
! 		scp->volp = cm_rootSCachep->volp;
! 		if (scp->dotdotFidp == (cm_fid_t *) NULL)
! 			scp->dotdotFidp = (cm_fid_t *) malloc (sizeof(cm_fid_t));
! 		scp->dotdotFidp->cell=0x1;
! 		scp->dotdotFidp->volume=0x20000001;
! 		scp->dotdotFidp->unique=1;
! 		scp->dotdotFidp->vnode=1;
! 		scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO);
! 		scp->nextp=cm_hashTablep[hash];
! 		cm_hashTablep[hash]=scp;
! 		scp->flags |= CM_SCACHEFLAG_INHASH;
! 		scp->refCount = 1;
! 		scp->fileType = CM_SCACHETYPE_MOUNTPOINT;
! 
! 		lock_ObtainMutex(&cm_Freelance_Lock);
! 		scp->length.LowPart = strlen(mp)+4;
! 		scp->mountPointStringp=malloc(strlen(mp));
! 		strcpy(scp->mountPointStringp,mp);
! 		lock_ReleaseMutex(&cm_Freelance_Lock);
! 
! 		scp->owner=0x0;
! 		scp->unixModeBits=0x1ff;
! 		scp->clientModTime=0x3b49f6e2;
! 		scp->serverModTime=0x3b49f6e2;
! 		scp->parentUnique = 0x1;
! 		scp->parentVnode=0x1;
! 		scp->group=0;
! 		scp->dataVersion=0x8;
! 		*outScpp = scp;
! 		lock_ReleaseWrite(&cm_scacheLock);
! 		/*afsi_log("   getscache done");*/
! 		return 0;
  
! 	}
! 	// end of yj code
! #endif /* AFS_FREELANCE_CLIENT */
! 
!         /* otherwise, we need to find the volume */
! 	if (!cm_freelanceEnabled || !isRoot) {
! 	  lock_ReleaseWrite(&cm_scacheLock);	/* for perf. reasons */
! 	  cellp = cm_FindCellByID(fidp->cell);
! 	  if (!cellp) return CM_ERROR_NOSUCHCELL;
! 
! 	  code = cm_GetVolumeByID(cellp, fidp->volume, userp, reqp, &volp);
! 	  if (code) return code;
!           lock_ObtainWrite(&cm_scacheLock);
! 	}
          
          /* otherwise, we have the volume, now reverify that the scp doesn't
           * exist, and proceed.
           */
  	for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
  		if (cm_FidCmp(fidp, &scp->fid) == 0) {
  			scp->refCount++;
***************
*** 281,300 ****
  	scp->fid = *fidp;
  	scp->volp = volp;	/* a held reference */
  
! 	/* if this scache entry represents a volume root then we need 
! 	 * to copy the dotdotFipd from the volume structure where the 
! 	 * "master" copy is stored (defect 11489)
! 	 */
! 	if(scp->fid.vnode == 1 && scp->fid.unique == 1 && volp->dotdotFidp) {
! 	        if (scp->dotdotFidp == (cm_fid_t *) NULL)
! 		        scp->dotdotFidp = (cm_fid_t *) malloc(sizeof(cm_fid_t));
! 		*(scp->dotdotFidp) = *volp->dotdotFidp;
  	}
- 
- 	if (volp->roID == fidp->volume)
- 		scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO);
- 	else if (volp->bkID == fidp->volume)
-                	scp->flags |= CM_SCACHEFLAG_RO;
  	scp->nextp = cm_hashTablep[hash];
  	cm_hashTablep[hash] = scp;
          scp->flags |= CM_SCACHEFLAG_INHASH;
--- 357,378 ----
  	scp->fid = *fidp;
  	scp->volp = volp;	/* a held reference */
  
! 	if (!cm_freelanceEnabled || !isRoot) {
! 	  /* if this scache entry represents a volume root then we need 
! 	   * to copy the dotdotFipd from the volume structure where the 
! 	   * "master" copy is stored (defect 11489)
! 	   */
! 	  if(scp->fid.vnode == 1 && scp->fid.unique == 1 && volp->dotdotFidp) {
! 	    if (scp->dotdotFidp == (cm_fid_t *) NULL)
! 	      scp->dotdotFidp = (cm_fid_t *) malloc(sizeof(cm_fid_t));
! 	    *(scp->dotdotFidp) = *volp->dotdotFidp;
! 	  }
! 	  
! 	  if (volp->roID == fidp->volume)
! 	    scp->flags |= (CM_SCACHEFLAG_PURERO | CM_SCACHEFLAG_RO);
! 	  else if (volp->bkID == fidp->volume)
! 	    scp->flags |= CM_SCACHEFLAG_RO;
  	}
  	scp->nextp = cm_hashTablep[hash];
  	cm_hashTablep[hash] = scp;
          scp->flags |= CM_SCACHEFLAG_INHASH;
***************
*** 504,510 ****
                          	goto sleep;
                  }
  
!                 if (flags & CM_SCACHESYNC_NEEDCALLBACK) {
  			if (!cm_HaveCallback(scp)) {
  				osi_Log1(afsd_logp, "CM SyncOp getting callback on scp %x",
                                  	(long) scp);
--- 582,597 ----
                          	goto sleep;
                  }
  
! 		// yj: modified this so that callback only checked if we're
! 		// not checking something on /afs
! 		if (  (flags & CM_SCACHESYNC_NEEDCALLBACK)
! #ifdef AFS_FREELANCE_CLIENT
! 			&& (!cm_freelanceEnabled || !(!(scp->fid.vnode==0x1 &&
! 				                         scp->fid.unique==0x1) &&
! 				                         scp->fid.cell==0x1 &&
! 				                         scp->fid.volume==0x20000001))
! #endif /* AFS_FREELANCE_CLIENT */
! 		    ) {
  			if (!cm_HaveCallback(scp)) {
  				osi_Log1(afsd_logp, "CM SyncOp getting callback on scp %x",
                                  	(long) scp);
***************
*** 703,708 ****
--- 790,820 ----
  void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp,
  	cm_user_t *userp, int flags)
  {
+ 	// yj: i want to create some fake status for the /afs directory and the
+ 	// entries under that directory
+ #ifdef AFS_FREELANCE_CLIENT
+ 	if (cm_freelanceEnabled && scp == cm_rootSCachep) {
+ 		statusp->InterfaceVersion = 0x1;
+ 		statusp->FileType = 0x2;
+ 		statusp->LinkCount = scp->linkCount;
+ 		statusp->Length = cm_fakeDirSize;
+ 		statusp->DataVersion = cm_fakeDirVersion;
+ 		statusp->Author = 0x1;
+ 		statusp->Owner = 0x0;
+ 		statusp->CallerAccess = 0x9;
+ 		statusp->AnonymousAccess = 0x9;
+ 		statusp->UnixModeBits = 0x1ff;
+ 		statusp->ParentVnode = 0x1;
+ 		statusp->ParentUnique = 0x1;
+ 		statusp->SegSize = 0;
+ 		statusp->ClientModTime = 0x3b49f6e2;
+ 		statusp->ServerModTime = 0x3b49f6e2;
+ 		statusp->Group = 0;
+ 		statusp->SyncCounter = 0;
+ 		statusp->dataVersionHigh = 0;
+ 	}
+ #endif /* AFS_FREELANCE_CLIENT */
+ 
  	if (!(flags & CM_MERGEFLAG_FORCE)
                 	&& statusp->DataVersion < (unsigned long) scp->dataVersion) {
  		struct cm_cell *cellp;
Index: openafs/src/WINNT/afsd/cm_vnodeops.c
diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.3 openafs/src/WINNT/afsd/cm_vnodeops.c:1.3.4.2
*** openafs/src/WINNT/afsd/cm_vnodeops.c:1.3	Mon Apr 30 02:48:06 2001
--- openafs/src/WINNT/afsd/cm_vnodeops.c	Wed Nov 14 22:30:08 2001
***************
*** 959,964 ****
--- 959,965 ----
          cm_scache_t *mountedScp;
          cm_lookupSearch_t rock;
          char tname[256];
+ 	int getroot;
  
  	if (dscp->fid.vnode == 1 && dscp->fid.unique == 1
  	    && strcmp(namep, "..") == 0) {
***************
*** 988,999 ****
  	 * looking for.  Any other non-zero code is an error.
           */
          if (code && code != CM_ERROR_STOPNOW) return code;
!         
!         if (!rock.found)
  		if (flags & CM_FLAG_CHECKPATH)
  			return CM_ERROR_NOSUCHPATH;
  		else
  			return CM_ERROR_NOSUCHFILE;
          
  haveFid:       
  	if ( !tscp )    /* we did not find it in the dnlc */
--- 989,1015 ----
  	 * looking for.  Any other non-zero code is an error.
           */
          if (code && code != CM_ERROR_STOPNOW) return code;
! 
! 	getroot = (dscp==cm_rootSCachep) ;
!         if (!rock.found) {
! 	  if (!cm_freelanceEnabled || !getroot) {
  		if (flags & CM_FLAG_CHECKPATH)
  			return CM_ERROR_NOSUCHPATH;
  		else
  			return CM_ERROR_NOSUCHFILE;
+ 	  }
+ 	  else {  /* nonexistent dir on freelance root, so add it */
+ 	    code = cm_FreelanceAddMount(namep, namep, "root.cell.",
+ 					&rock.fid);
+ 	    if (code < 0) {   /* add mount point failed, so give up */
+ 	      if (flags & CM_FLAG_CHECKPATH)
+ 		return CM_ERROR_NOSUCHPATH;
+ 	      else
+ 		return CM_ERROR_NOSUCHFILE;
+ 	    }
+ 	    tscp = NULL;   /* to force call of cm_GetSCache */
+ 	  }
+ 	}
          
  haveFid:       
  	if ( !tscp )    /* we did not find it in the dnlc */
***************
*** 1059,1064 ****
--- 1075,1088 ----
          AFSFetchStatus newDirStatus;
          AFSVolSync volSync;
  
+ #ifdef AFS_FREELANCE_CLIENT
+ 	if (cm_freelanceEnabled && dscp == cm_rootSCachep) {
+ 	  /* deleting a mount point from the root dir. */
+ 	  code = cm_FreelanceRemoveMount(namep);
+ 	  return code;
+ 	}
+ #endif
+ 
  	/* make sure we don't screw up the dir status during the merge */
          lock_ObtainMutex(&dscp->mx);
  	sflags = CM_SCACHESYNC_STOREDATA;
***************
*** 1182,1190 ****
--- 1206,1222 ----
                  *newRootScpp = cm_rootSCachep;
                  cm_HoldSCache(cm_rootSCachep);
          } else if (*linkp == '\\' || *linkp == '/') {
+ 	  /* formerly, this was considered to be from the AFS root,
+ 	     but this seems to create problems.  instead, we will just
+ 	     reject the link */
+ #if 0
  		strcpy(tsp->data, linkp+1);
                  *newRootScpp = cm_rootSCachep;
                  cm_HoldSCache(cm_rootSCachep);
+ #else
+ 		code = CM_ERROR_NOSUCHPATH;
+ 		goto done;
+ #endif
          }
          else {
  		/* a relative link */
***************
*** 1498,1503 ****
--- 1530,1550 ----
  		}	/* got lock */
                  cm_ReleaseSCache(tscp);
          }	/* found entry */
+ 
+ #ifdef AFS_FREELANCE_CLIENT
+ 	// yj: if this is a mountpoint under root.afs then we don't want it
+ 	// to be bulkstat-ed, instead, we call getSCache directly and under
+ 	// getSCache, it is handled specially.
+ 	if 	(cm_freelanceEnabled &&
+            tfid.cell==0x1 && tfid.volume==0x20000001 &&
+ 			   !(tfid.vnode==0x1 && tfid.unique==0x1) )
+ 	{
+ #ifdef DEBUG
+ 	        afsi_log("   cm_trybulkproc going to call getscache");
+ #endif
+ 		return cm_GetSCache(&tfid, &tscp, NULL, NULL);
+ 	}
+ #endif /* AFS_FREELANCE_CLIENT */
  
  	i = bsp->counter++;
          bsp->fids[i].Volume = scp->fid.volume;
Index: openafs/src/WINNT/afsd/fs.c
diff -c openafs/src/WINNT/afsd/fs.c:1.4 openafs/src/WINNT/afsd/fs.c:1.4.2.1
*** openafs/src/WINNT/afsd/fs.c:1.4	Tue Aug  7 20:03:24 2001
--- openafs/src/WINNT/afsd/fs.c	Wed Nov 14 22:38:47 2001
***************
*** 1754,1760 ****
  	tp = (char *)(space + sizeof(afs_int32));
  	lp = (afs_int32 *)tp;
  	*lp++ = 0x12345678;
! 	size == sizeof(afs_int32) + sizeof(afs_int32);
  	blob.out_size = MAXSIZE;
  	blob.in_size = sizeof(afs_int32);
  	blob.in = space;
--- 1754,1760 ----
  	tp = (char *)(space + sizeof(afs_int32));
  	lp = (afs_int32 *)tp;
  	*lp++ = 0x12345678;
! 	size = sizeof(afs_int32) + sizeof(afs_int32);
  	blob.out_size = MAXSIZE;
  	blob.in_size = sizeof(afs_int32);
  	blob.in = space;
Index: openafs/src/WINNT/afsd/libafsconf.def
diff -c openafs/src/WINNT/afsd/libafsconf.def:1.1 openafs/src/WINNT/afsd/libafsconf.def:1.1.12.1
*** openafs/src/WINNT/afsd/libafsconf.def:1.1	Fri Nov  3 21:14:24 2000
--- openafs/src/WINNT/afsd/libafsconf.def	Sat Oct 13 00:19:06 2001
***************
*** 17,19 ****
--- 17,23 ----
  	cm_AppendNewCell		@10
  	cm_AppendNewCellLine		@11
  	cm_CloseCellFile		@12
+      cm_SearchCellByDNS       @13
+      getAFSServer             @14
+      cm_InitDNS               @15
+      cm_GetConfigDir          @16
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.4 openafs/src/WINNT/afsd/smb.c:1.4.4.1
*** openafs/src/WINNT/afsd/smb.c:1.4	Sat Jun 23 13:26:07 2001
--- openafs/src/WINNT/afsd/smb.c	Wed Nov 14 22:38:47 2001
***************
*** 778,793 ****
  	for(uidp = vcp->usersp; uidp; uidp = uidp->nextp) {
  		if (uid == uidp->userID) {
  			uidp->refCount++;
! #ifdef DEBUG_VERBOSE 
! 		{
!         HANDLE h; char *ptbuf[1],buf[132];
!         h = RegisterEventSource(NULL, "AFS Service - smb_FindUID (Find by UID)");
!         sprintf(buf, "VCP[%x] found-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp ? uidp->unp->name : ""));
!         ptbuf[0] = buf;
!         ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
!         DeregisterEventSource(h);
! 		}
! #endif
          	break;
  		}
          }
--- 778,784 ----
  	for(uidp = vcp->usersp; uidp; uidp = uidp->nextp) {
  		if (uid == uidp->userID) {
  			uidp->refCount++;
! 			osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL," VCP[%x] found-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp) ? uidp->unp->name : "");
          	break;
  		}
          }
***************
*** 800,815 ****
                  vcp->usersp = uidp;
                  lock_InitializeMutex(&uidp->mx, "uid_t mutex");
                  uidp->userID = uid;
! #ifdef DEBUG_VERBOSE 
! 		{
!         HANDLE h; char *ptbuf[1],buf[132];
!         h = RegisterEventSource(NULL, "AFS Service - smb_FindUID (Find by UID)");
!         sprintf(buf, "VCP[%x] new-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp ? uidp->unp->name : ""));
!         ptbuf[0] = buf;
!         ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
!         DeregisterEventSource(h);
! 		}
! #endif
          }
          lock_ReleaseWrite(&smb_rctLock);
          return uidp;
--- 791,797 ----
                  vcp->usersp = uidp;
                  lock_InitializeMutex(&uidp->mx, "uid_t mutex");
                  uidp->userID = uid;
! 				osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL,"VCP[%x] new-uid[%d] name[%s]",vcp,uidp->userID,(uidp->unp ? uidp->unp->name : ""));
          }
          lock_ReleaseWrite(&smb_rctLock);
          return uidp;
***************
*** 850,865 ****
              continue;
            if (stricmp(uidp->unp->name, usern) == 0) {
              uidp->refCount++;
! #ifdef DEBUG_VERBOSE 
!             {
!               HANDLE h; char *ptbuf[1],buf[132];
!               h = RegisterEventSource(NULL, "AFS Service - smb_FindUserByNameThisSession");
!               sprintf(buf, "VCP[%x] uid[%d] match-name[%s]",vcp,uidp->userID,usern);
!               ptbuf[0] = buf;
!               ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
!               DeregisterEventSource(h);
!             }
! #endif
              break;
            } else
              continue;
--- 832,838 ----
              continue;
            if (stricmp(uidp->unp->name, usern) == 0) {
              uidp->refCount++;
! 			osi_LogEvent("AFS smb_FindUserByNameThisSession",NULL,"VCP[%x] uid[%d] match-name[%s]",vcp,uidp->userID,usern);
              break;
            } else
              continue;
***************
*** 5391,5417 ****
  				code = smb_ReceiveCoreWriteRaw (vcp, inp, outp,
  								rwcp);
  			else {
! 				
! #ifdef DEBUG_VERBOSE
! 			    HANDLE h; char *ptbuf[1],buf[132];DWORD err;
! 			 	h = RegisterEventSource(NULL, "AFS Server - Dispatch");
! 		 		sprintf(buf,"%s vcp[%x] lana[%d] lsn[%d]",myCrt_Dispatch(inp->inCom),vcp,vcp->lana,vcp->lsn);
! 			 	ptbuf[0] = buf;
! 			 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
! 			 	DeregisterEventSource(h);
! #endif
  					code = (*(dp->procp)) (vcp, inp, outp);
! 
! #ifdef DEBUG_VERBOSE
! 					h = RegisterEventSource(NULL, "AFS Server - Dispatch return ");
! 					sprintf(buf,"code[%d]",code-CM_ERROR_BASE);
! 					if (code)
! 						ptbuf[0] = buf;
! 					else
! 						ptbuf[0] = "code[0]";
! 					ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
! 					DeregisterEventSource(h);
! #endif
  				}
  
  			if (oldGen != sessionGen) {
--- 5364,5374 ----
  				code = smb_ReceiveCoreWriteRaw (vcp, inp, outp,
  								rwcp);
  			else {
! 					osi_LogEvent("AFS Dispatch %s",(myCrt_Dispatch(inp->inCom)),"vcp[%x] lana[%d] lsn[%d]",vcp,vcp->lana,vcp->lsn);
! 					osi_Log4(afsd_logp,"Dispatch %s vcp[%x] lana[%d] lsn[%d]",(myCrt_Dispatch(inp->inCom)),vcp,vcp->lana,vcp->lsn);
  					code = (*(dp->procp)) (vcp, inp, outp);
! 					osi_LogEvent("AFS Dispatch return",NULL,"Code[%d]",(code==0)?0:code-CM_ERROR_BASE,"");
! 					osi_Log1(afsd_logp,"Dispatch return  code[%d]",(code==0)?0:code-CM_ERROR_BASE);
  				}
  
  			if (oldGen != sessionGen) {
***************
*** 5465,5471 ****
  				    1, ncbp->ncb_length, ptbuf, smbp);
  			DeregisterEventSource(h);
  #else /* DJGPP */
!                         osi_Log1(afsd_logp, "Invalid SMB message, length %d",
                                   ncbp->ncb_length);
  #endif /* !DJGPP */
  
--- 5422,5428 ----
  				    1, ncbp->ncb_length, ptbuf, smbp);
  			DeregisterEventSource(h);
  #else /* DJGPP */
!             osi_Log1(afsd_logp, "Invalid SMB message, length %d",
                                   ncbp->ncb_length);
  #endif /* !DJGPP */
  
Index: openafs/src/WINNT/afsd/smb.h
diff -c openafs/src/WINNT/afsd/smb.h:1.4 openafs/src/WINNT/afsd/smb.h:1.4.4.1
*** openafs/src/WINNT/afsd/smb.h:1.4	Sat Jun 23 13:26:07 2001
--- openafs/src/WINNT/afsd/smb.h	Wed Nov 21 01:45:40 2001
***************
*** 208,213 ****
--- 208,217 ----
  
          /* fid pointer */
          struct smb_fid *fidp;
+ 
+   /* uid pointer */
+   smb_user_t *uidp;
+ 
  } smb_ioctl_t;
  
  /* flags for smb_ioctl_t */
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.5 openafs/src/WINNT/afsd/smb3.c:1.5.4.1
*** openafs/src/WINNT/afsd/smb3.c:1.5	Sat Jun 23 13:26:07 2001
--- openafs/src/WINNT/afsd/smb3.c	Wed Nov 14 22:38:48 2001
***************
*** 139,162 ****
      pwd = smb_ParseString(tp, &tp);
      usern = smb_ParseString(tp, &tp);
  
-     if (strlen(usern)==0) {
-         /*return CM_ERROR_NOACCESS;*/
-         newUid = 0;   /* always assign uid 0 for blank username */
-         uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
- #ifdef DEBUG_VERBOSE
- 		{
-         HANDLE h; char *ptbuf[1],buf[132];
-         h = RegisterEventSource(NULL, "AFS Service - smb_ReceiveV3SessionSetupX");
-         sprintf(buf, "VCP[%x] lsn[%d] anonymous, uid[%d]",vcp,vcp->lsn,uidp->userID);
-         ptbuf[0] = buf;
-         ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
-         DeregisterEventSource(h);
- 		}
- #endif
-         smb_ReleaseUID(uidp);
-         goto done;
-     }
- 
      /* On Windows 2000, this function appears to be called more often than
         it is expected to be called. This resulted in multiple smb_user_t
         records existing all for the same user session which results in all
--- 139,144 ----
***************
*** 171,186 ****
          unp = uidp->unp;
          userp = unp->userp;
          newUid = (unsigned short)uidp->userID;  /* For some reason these are different types!*/
! #ifdef DEBUG_VERBOSE
!         {
! 		   HANDLE h; char *ptbuf[1],buf[132];
! 			h = RegisterEventSource(NULL, "AFS Service - smb_ReceiveV3SessionSetupX");
! 			sprintf(buf,"FindUserByName:VCP[%x],Lana[%d],lsn[%d],userid[%d],name[%s]",vcp,vcp->lana,vcp->lsn,newUid,usern);
! 			ptbuf[0] = buf;
! 			ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
! 			DeregisterEventSource(h);
!         }
! #endif
          smb_ReleaseUID(uidp);
      }
      else {
--- 153,160 ----
          unp = uidp->unp;
          userp = unp->userp;
          newUid = (unsigned short)uidp->userID;  /* For some reason these are different types!*/
! 		osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"FindUserByName:Lana[%d],lsn[%d],userid[%d],name[%s]",vcp->lana,vcp->lsn,newUid,usern);
! 		osi_Log3(afsd_logp,"smb_ReceiveV3SessionSetupX FindUserByName:Lana[%d],lsn[%d],userid[%d]",vcp->lana,vcp->lsn,newUid);
          smb_ReleaseUID(uidp);
      }
      else {
***************
*** 192,198 ****
          if (!userp)
            userp = cm_NewUser();
          lock_ObtainMutex(&vcp->mx);
!         newUid = vcp->uidCounter++;
          lock_ReleaseMutex(&vcp->mx);
  
          /* Create a new smb_user_t structure and connect them up */
--- 166,172 ----
          if (!userp)
            userp = cm_NewUser();
          lock_ObtainMutex(&vcp->mx);
!         newUid = (strlen(usern)==0)?0:vcp->uidCounter++;
          lock_ReleaseMutex(&vcp->mx);
  
          /* Create a new smb_user_t structure and connect them up */
***************
*** 203,223 ****
          uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
          lock_ObtainMutex(&uidp->mx);
          uidp->unp = unp;
! #ifdef DEBUG_VERBOSE
! 		{
! 		   HANDLE h; char *ptbuf[1],buf[132];
! 			h = RegisterEventSource(NULL, "AFS Service - smb_ReceiveV3SessionSetupX");
! 			sprintf(buf,"NewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],name[%s]",vcp,vcp->lana,vcp->lsn,newUid,usern);
! 			ptbuf[0] = buf;
! 			ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
! 			DeregisterEventSource(h);
! 		}
! #endif
          lock_ReleaseMutex(&uidp->mx);
          smb_ReleaseUID(uidp);
      }
  
-  done:
      /* Return UID to the client */
      ((smb_t *)outp)->uid = newUid;
      /* Also to the next chained message */
--- 177,188 ----
          uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
          lock_ObtainMutex(&uidp->mx);
          uidp->unp = unp;
! 		osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],TicketKTCName[%s]",vcp,vcp->lana,vcp->lsn,newUid,usern);
! 		osi_Log4(afsd_logp,"smb_ReceiveV3SessionSetupX MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d]",vcp,vcp->lana,vcp->lsn,newUid);
          lock_ReleaseMutex(&uidp->mx);
          smb_ReleaseUID(uidp);
      }
  
      /* Return UID to the client */
      ((smb_t *)outp)->uid = newUid;
      /* Also to the next chained message */
***************
*** 619,624 ****
--- 584,591 ----
                  lock_ReleaseWrite(&smb_globalLock);
                  
                  /* now dispatch it */
+ 				osi_LogEvent("AFS-Dispatch-2[%s]",myCrt_2Dispatch(asp->opcode),"vcp[%x] lana[%d] lsn[%d]",vcp,vcp->lana,vcp->lsn);
+ 				osi_Log4(afsd_logp,"AFS Server - Dispatch-2 %s vcp[%x] lana[%d] lsn[%d]",myCrt_2Dispatch(asp->opcode),vcp,vcp->lana,vcp->lsn);
                  code = (*smb_tran2DispatchTable[asp->opcode].procp)(vcp, asp, outp);
  
  		/* if an error is returned, we're supposed to send an error packet,
***************
*** 4137,4143 ****
  {
      cm_user_t *userp;
      /*int newUid;*/
-     smb_user_t *uidp;
      smb_username_t *unp;
  
      unp = smb_FindUserByName(usern, machine, SMB_FLAG_CREATE);
--- 4104,4109 ----
***************
*** 4145,4171 ****
          lock_ObtainMutex(&unp->mx);
          unp->userp = cm_NewUser();
          lock_ReleaseMutex(&unp->mx);
! #ifdef DEBUG_VERBOSE
! 		{       //jimpeter
! 		   HANDLE h; char *ptbuf[1],buf[132];
! 			h = RegisterEventSource(NULL, "AFS Service - smb_FindCMUserByName");
! 			sprintf(buf,"New User name[%s] machine[%s]",usern,machine);
! 			ptbuf[0] = buf;
! 			ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
! 			DeregisterEventSource(h);
! 		}
! #endif
!     } 
! #ifdef DEBUG_VERBOSE
! 	  else	{       //jimpeter
! 		   HANDLE h; char *ptbuf[1],buf[132];
! 			h = RegisterEventSource(NULL, "AFS Service - smb_FindCMUserByName");
! 			sprintf(buf,"Found-name[%s] machine[%s]",usern,machine);
! 			ptbuf[0] = buf;
! 			ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, ptbuf, NULL);
! 			DeregisterEventSource(h);
! 		}
! #endif
      return unp->userp;
  }
  
--- 4111,4120 ----
          lock_ObtainMutex(&unp->mx);
          unp->userp = cm_NewUser();
          lock_ReleaseMutex(&unp->mx);
! 		osi_LogEvent("AFS smb_FindCMUserByName New User",NULL,"name[%s] machine[%s]",usern,machine);
!     }  else	{
! 		osi_LogEvent("AFS smb_FindCMUserByName Found",NULL,"name[%s] machine[%s]",usern,machine);
! 	}
      return unp->userp;
  }
  
Index: openafs/src/WINNT/afsd/smb3.h
diff -c openafs/src/WINNT/afsd/smb3.h:1.3 openafs/src/WINNT/afsd/smb3.h:1.3.4.1
*** openafs/src/WINNT/afsd/smb3.h:1.3	Mon Apr 30 02:48:10 2001
--- openafs/src/WINNT/afsd/smb3.h	Wed Nov 21 01:45:40 2001
***************
*** 164,169 ****
--- 164,170 ----
  extern int smb_V3MatchMask(char *namep, char *maskp, int flags);
  
  extern void smb3_Init();
+ extern cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine);
  
  #ifdef DJGPP
  #define DELETE (0x00010000)
Index: openafs/src/WINNT/afsd/smb_ioctl.c
diff -c openafs/src/WINNT/afsd/smb_ioctl.c:1.6 openafs/src/WINNT/afsd/smb_ioctl.c:1.6.2.1
*** openafs/src/WINNT/afsd/smb_ioctl.c:1.6	Thu Sep  6 23:33:10 2001
--- openafs/src/WINNT/afsd/smb_ioctl.c	Wed Nov 14 22:38:48 2001
***************
*** 283,291 ****
  		    osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
  			     uidp->userID, userp,
  			     osi_LogSaveString(afsd_logp, uidp->unp->name));
! 		else
  		    osi_Log2(afsd_logp, "Ioctl uid %d user %x no name",
  			     uidp->userID, userp);
  		smb_ReleaseUID(uidp);
  	}
  
--- 283,296 ----
  		    osi_Log3(afsd_logp, "Ioctl uid %d user %x name %s",
  			     uidp->userID, userp,
  			     osi_LogSaveString(afsd_logp, uidp->unp->name));
! 		else {
! 			if (uidp)
  		    osi_Log2(afsd_logp, "Ioctl uid %d user %x no name",
  			     uidp->userID, userp);
+ 			else
+ 		    osi_Log1(afsd_logp, "Ioctl no uid user %x no name",
+ 			     userp);
+ 		}
  		smb_ReleaseUID(uidp);
  	}
  
Index: openafs/src/WINNT/client_config/config.cpp
diff -c openafs/src/WINNT/client_config/config.cpp:1.2 openafs/src/WINNT/client_config/config.cpp:1.2.8.1
*** openafs/src/WINNT/client_config/config.cpp:1.2	Sat Nov  4 05:02:36 2000
--- openafs/src/WINNT/client_config/config.cpp	Wed Nov 14 22:38:48 2001
***************
*** 217,223 ****
     return TRUE;
  }
  
! 
  void Config_GetAuthentFlag (BOOL *pfFlag)
  {
     *pfFlag = FALSE;
--- 217,231 ----
     return TRUE;
  }
  
! #if 0
! /* 	These two functions are not needed as of the 1.2.2a updates.
! 	The old implementation used to 'bind' afslogon.dll to the credentials manager
! 	when the Integrated Logon was selected.
! 
! 	With version 1.2.2a afslogon.dll is always 'bound' to the credentials manager; therefore,
! 	the binding operation is done during installation.  Note: the Integrated Logon is
! 	selected by an entry in the registry (LogonOptions).
! */
  void Config_GetAuthentFlag (BOOL *pfFlag)
  {
     *pfFlag = FALSE;
***************
*** 335,341 ****
        Message (MB_ICONHAND, GetErrorTitle(), IDS_FAILCONFIG_AUTHENT, TEXT("%ld"), status);
     return rc;
  }
! 
  
  void Config_GetTrayIconFlag (BOOL *pfFlag)
  {
--- 343,349 ----
        Message (MB_ICONHAND, GetErrorTitle(), IDS_FAILCONFIG_AUTHENT, TEXT("%ld"), status);
     return rc;
  }
! #endif
  
  void Config_GetTrayIconFlag (BOOL *pfFlag)
  {
***************
*** 811,817 ****
  void Config_GetLanAdapter (ULONG *pnLanAdapter)
  {
     if (!Config_ReadNum (TEXT("LANadapter"), (DWORD*)pnLanAdapter))
!       *pnLanAdapter = 0;
  }
  
  BOOL Config_SetLanAdapter (ULONG nLanAdapter, ULONG *pStatus)
--- 819,825 ----
  void Config_GetLanAdapter (ULONG *pnLanAdapter)
  {
     if (!Config_ReadNum (TEXT("LANadapter"), (DWORD*)pnLanAdapter))
!       *pnLanAdapter = -1;
  }
  
  BOOL Config_SetLanAdapter (ULONG nLanAdapter, ULONG *pStatus)
Index: openafs/src/WINNT/client_config/config.h
diff -c openafs/src/WINNT/client_config/config.h:1.2 openafs/src/WINNT/client_config/config.h:1.2.8.1
*** openafs/src/WINNT/client_config/config.h:1.2	Sat Nov  4 05:02:37 2000
--- openafs/src/WINNT/client_config/config.h	Wed Nov 14 22:38:48 2001
***************
*** 57,65 ****
  BOOL Config_ContactGateway (LPTSTR pszGateway, LPTSTR pszCell);
  void Config_FixGatewayDrives (void);
  
- void Config_GetAuthentFlag (BOOL *pfFlag);
- BOOL Config_SetAuthentFlag (BOOL fFlag, ULONG *pStatus = NULL);
- 
  void Config_GetTrayIconFlag (BOOL *pfFlag);
  BOOL Config_SetTrayIconFlag (BOOL fFlag, ULONG *pStatus = NULL);
  
--- 57,62 ----
Index: openafs/src/WINNT/client_config/dlg_misc.cpp
diff -c openafs/src/WINNT/client_config/dlg_misc.cpp:1.2 openafs/src/WINNT/client_config/dlg_misc.cpp:1.2.8.1
*** openafs/src/WINNT/client_config/dlg_misc.cpp:1.2	Sat Nov  4 05:02:37 2000
--- openafs/src/WINNT/client_config/dlg_misc.cpp	Wed Nov 14 22:38:48 2001
***************
*** 95,100 ****
--- 95,107 ----
              case IDCANCEL:
                  Misc_OnCancel(hDlg);
                  break;
+ 			case IDC_AUTOLANA:
+ 				if (IsDlgButtonChecked(hDlg,IDC_AUTOLANA))
+ 					nLanAdapter=-1;
+ 				else
+ 					nLanAdapter=0;
+ 				SP_SetPos (GetDlgItem (hDlg, IDC_LAN_ADAPTER),nLanAdapter);
+ 				EnableWindow(GetDlgItem(hDlg,IDC_LAN_ADAPTER),(nLanAdapter!=-1));
              }
           break;
  
***************
*** 129,135 ****
        fFirstTime = FALSE;
     }
  
!    CreateSpinner (GetDlgItem (hDlg, IDC_LAN_ADAPTER), 10, FALSE, nLANA_MIN, nLanAdapter, nLANA_MAX);
     CreateSpinner (GetDlgItem (hDlg, IDC_PROBE), 10, FALSE, csecPROBE_MIN, csecProbe, csecPROBE_MAX);
     CreateSpinner (GetDlgItem (hDlg, IDC_THREADS), 10, FALSE, cTHREADS_MIN, nThreads, cTHREADS_MAX);
     CreateSpinner (GetDlgItem (hDlg, IDC_DAEMONS), 10, FALSE, cDAEMONS_MIN, nDaemons, cDAEMONS_MAX);
--- 136,142 ----
        fFirstTime = FALSE;
     }
  
!    CreateSpinner (GetDlgItem (hDlg, IDC_LAN_ADAPTER), 99, FALSE, nLANA_MIN, nLanAdapter, nLANA_MAX);
     CreateSpinner (GetDlgItem (hDlg, IDC_PROBE), 10, FALSE, csecPROBE_MIN, csecProbe, csecPROBE_MAX);
     CreateSpinner (GetDlgItem (hDlg, IDC_THREADS), 10, FALSE, cTHREADS_MIN, nThreads, cTHREADS_MAX);
     CreateSpinner (GetDlgItem (hDlg, IDC_DAEMONS), 10, FALSE, cDAEMONS_MIN, nDaemons, cDAEMONS_MAX);
***************
*** 137,147 ****
     SetDlgItemText (hDlg, IDC_SYSNAME, szSysName);
     SetDlgItemText (hDlg, IDC_ROOTVOLUME, szRootVolume);
     SetDlgItemText (hDlg, IDC_MOUNTDIR, szMountDir);
  }
  
  void Misc_OnOK (HWND hDlg)
  {
!    nLanAdapter = SP_GetPos (GetDlgItem (hDlg, IDC_LAN_ADAPTER));
  
     csecProbe = SP_GetPos (GetDlgItem (hDlg, IDC_PROBE));
    
--- 144,157 ----
     SetDlgItemText (hDlg, IDC_SYSNAME, szSysName);
     SetDlgItemText (hDlg, IDC_ROOTVOLUME, szRootVolume);
     SetDlgItemText (hDlg, IDC_MOUNTDIR, szMountDir);
+    CheckDlgButton (hDlg, IDC_AUTOLANA, (nLanAdapter==-1));
+    EnableWindow(GetDlgItem(hDlg,IDC_LAN_ADAPTER),(nLanAdapter!=-1));
  }
  
  void Misc_OnOK (HWND hDlg)
  {
! 	nLanAdapter =  (IsDlgButtonChecked(hDlg,IDC_AUTOLANA))?-1
! 		:SP_GetPos (GetDlgItem (hDlg, IDC_LAN_ADAPTER));
  
     csecProbe = SP_GetPos (GetDlgItem (hDlg, IDC_PROBE));
    
***************
*** 161,167 ****
  {
     if (fFirstTime)
        return TRUE;
!    
     if (nLanAdapter != g.Configuration.nLanAdapter) {
        if (!Config_SetLanAdapter (nLanAdapter))
           return FALSE;
--- 171,177 ----
  {
     if (fFirstTime)
        return TRUE;
! 
     if (nLanAdapter != g.Configuration.nLanAdapter) {
        if (!Config_SetLanAdapter (nLanAdapter))
           return FALSE;
Index: openafs/src/WINNT/client_config/drivemap.cpp
diff -c openafs/src/WINNT/client_config/drivemap.cpp:1.5 openafs/src/WINNT/client_config/drivemap.cpp:1.5.4.2
*** openafs/src/WINNT/client_config/drivemap.cpp:1.5	Thu Mar 29 18:18:55 2001
--- openafs/src/WINNT/client_config/drivemap.cpp	Wed Nov 21 01:45:42 2001
***************
*** 10,30 ****
  extern "C" {
  #include <afs/param.h>
  #include <afs/stds.h>
  }
- 
  #include <windows.h>
  #include <stdlib.h>
  #include <stdio.h>
  #include <WINNT/TaLocale.h>
  #include "drivemap.h"
! 
  
  /*
   * REGISTRY ___________________________________________________________________
   *
   */
  
! static const TCHAR AFSConfigKeyName[] = TEXT("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters");
  
  
  /*
--- 10,33 ----
  extern "C" {
  #include <afs/param.h>
  #include <afs/stds.h>
+ #include <rx/rxkad.h>
  }
  #include <windows.h>
  #include <stdlib.h>
  #include <stdio.h>
  #include <WINNT/TaLocale.h>
  #include "drivemap.h"
! #include <time.h>
! #include <adssts.h>
! #include <osilog.h>
  
  /*
   * REGISTRY ___________________________________________________________________
   *
   */
  
! #undef AFSConfigKeyName
! const TCHAR sAFSConfigKeyName[] = TEXT("SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters");
  
  
  /*
***************
*** 452,458 ****
     TCHAR szValue[128];
     HKEY hKey;
  
!    _stprintf(szKeyName, TEXT("%s\\GlobalAutoMapper"), AFSConfigKeyName);
  
     if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
        return FALSE;
--- 455,461 ----
     TCHAR szValue[128];
     HKEY hKey;
  
!    _stprintf(szKeyName, TEXT("%s\\GlobalAutoMapper"), sAFSConfigKeyName);
  
     if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
        return FALSE;
***************
*** 745,752 ****
--- 748,758 ----
        pszSubmount = &szMapping[ lstrlen(cszLANMANDEVICE) ];
  
        if (IsWindows2000())
+ 	  {
            if (*(pszSubmount) != TEXT(';'))
               return FALSE;
+ 	  } else 
+ 		--pszSubmount;
  
        if (toupper(*(++pszSubmount)) != chDrive)
           return FALSE;
***************
*** 791,793 ****
--- 797,1097 ----
     return TRUE;
  }
  
+ /* Generate Random User name random acording to time*/
+ DWORD dwOldState=0;
+ TCHAR pUserName[MAXRANDOMNAMELEN];
+ BOOL fUserName=FALSE;
+ #define AFSLogonOptionName TEXT("System\\CurrentControlSet\\Services\\TransarcAFSDaemon\\NetworkProvider")
+ 
+ void SetBitLogonOption(BOOL set,DWORD value)
+ {
+ 
+    RWLogonOption(FALSE,((set)?value | RWLogonOption(TRUE,0):RWLogonOption(TRUE,0) & ~value) );	
+ }
+ 
+ DWORD RWLogonOption(BOOL read,DWORD value)
+ {
+ 	// if read is true then if value==0 return registry value
+ 	// if read and value!=0 then use value to test registry, return TRUE if value bits match value read
+    HKEY hk;
+    DWORD dwDisp;
+ 	DWORD LSPtype, LSPsize;
+ 	DWORD rval;
+    if (read)
+    {
+ 	   rval=0;
+ 		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSLogonOptionName,0, KEY_QUERY_VALUE, &hk)==ERROR_SUCCESS)
+ 		{
+ 			LSPsize=sizeof(rval);
+ 			RegQueryValueEx(hk, "LogonOptions", NULL,
+ 						&LSPtype, (LPBYTE)&rval, &LSPsize);
+ 			RegCloseKey (hk);
+ 		}
+ 		return (value==0)?rval:((rval & value)==value);
+ 
+    } else {	//write
+ 		if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, AFSLogonOptionName, 0, NULL, 0, KEY_SET_VALUE, NULL, &hk, &dwDisp) == ERROR_SUCCESS)
+ 		{
+ 			RegSetValueEx(hk,TEXT("LogonOptions"),NULL,REG_DWORD,(LPBYTE)&value,sizeof(value));
+ 			RegCloseKey (hk);
+ 		}
+ 		return TRUE;
+    }
+ }
+ 
+ void MapShareName(char *pszCmdLineA)
+ {
+ 	fUserName = TRUE;
+ 	TCHAR *p=pUserName;
+ 	pszCmdLineA++;
+ 	while (*pszCmdLineA && (*pszCmdLineA != ' '))
+ 	{
+ 	  *p++=*pszCmdLineA++;
+ 	}
+ }
+ 
+ void GenRandomName(TCHAR *pname,int len)
+ {
+ 	if (fUserName)
+ 	{		//user name was passed through command line, use once
+ 		fUserName=FALSE;
+ 		return;
+ 	}
+ 	srand( (unsigned)time( NULL ) );
+ 	for (int i=0;i<len;i++)
+ 		pname[i]='a'+(rand() % 26);
+ 	pname[len]=0;
+ 	return;
+ }
+ 
+ /*
+ 	Make a connection using users name
+ 	if fUserName then force a connection
+ */
+ 
+ BOOL TestAndDoMapShare(DWORD dwState)
+ {
+ 	if ((dwState!=SERVICE_RUNNING) || (dwOldState!=SERVICE_START_PENDING) 
+ 		|| (!RWLogonOption(TRUE,LOGON_OPTION_HIGHSECURITY)))
+ 	{
+ 		dwOldState=dwState;
+ 		return TRUE;
+ 	}
+ 	dwOldState=SERVICE_RUNNING;
+ 	return DoMapShare();
+ }
+ 
+ BOOL IsServiceActive()
+ {
+    SC_HANDLE hManager;
+    SERVICE_STATUS Status;
+    if ((hManager = OpenSCManager (NULL, NULL, GENERIC_READ)) != NULL)
+       {
+       SC_HANDLE hService;
+       if ((hService = OpenService (hManager, TEXT("TransarcAFSDaemon"), GENERIC_READ)) != NULL)
+          {
+          QueryServiceStatus (hService, &Status);
+          CloseServiceHandle (hService);
+          }
+ 
+       CloseServiceHandle (hManager);
+       }
+ 
+    return (Status.dwCurrentState == SERVICE_RUNNING) ? TRUE : FALSE;
+ }
+ 
+ void TestAndDoUnMapShare()
+ {
+ 	if (!RWLogonOption(TRUE,LOGON_OPTION_HIGHSECURITY))
+ 		return;
+ 	DoUnMapShare(FALSE);	
+ }
+ 
+ void DoUnMapShare(BOOL drivemap)	//disconnect drivemap 
+ {
+ 	TCHAR szMachine[ MAX_PATH],szPath[MAX_PATH];
+ 	DWORD rc=28;
+ 	HANDLE hEnum;
+ 	LPNETRESOURCE lpnrLocal,lpnr=NULL;
+ 	DWORD res;
+ 	DWORD cbBuffer=16384;
+ 	DWORD cEntries=-1;
+ 	GetComputerName(szMachine,&rc);
+ 	CHAR *pSubmount="";
+    // Initialize the data structure
+ 	if ((res=WNetOpenEnum(RESOURCE_CONNECTED,RESOURCETYPE_DISK,RESOURCEUSAGE_CONNECTABLE,lpnr,&hEnum))!=NO_ERROR)
+ 		return;
+ 	sprintf(szPath,"\\\\%s-afs\\",szMachine);
+ 	_strlwr(szPath);
+ 	lpnrLocal=(LPNETRESOURCE) GlobalAlloc(GPTR,cbBuffer);
+ 	do {
+ 		memset(lpnrLocal,0,cbBuffer);
+ 		if ((res = WNetEnumResource(hEnum,&cEntries,lpnrLocal,&cbBuffer))==NO_ERROR)
+ 		{
+ 			for (DWORD i=0;i<cEntries;i++)
+ 			{
+ 				if (strstr(_strlwr(lpnrLocal[i].lpRemoteName),szPath))
+ 				{
+ 					if ((lpnrLocal[i].lpLocalName) && (strlen(lpnrLocal[i].lpLocalName)>0))
+ 					{
+ 						if (drivemap)
+ 							WNetCancelConnection(lpnrLocal[i].lpLocalName,TRUE);
+ 					} else
+ 						WNetCancelConnection(lpnrLocal[i].lpRemoteName,TRUE);
+ 					DEBUG_EVENT1("AFS DriveUnMap","UnMap-Remote=%x",res);
+ 				}
+ 			}
+ 		}
+ 	} while (res!=ERROR_NO_MORE_ITEMS);
+ 	GlobalFree((HGLOBAL)lpnrLocal);
+ 	WNetCloseEnum(hEnum);
+ }
+ 
+ BOOL DoMapShareChange()
+ {
+ 	DRIVEMAPLIST List;
+ 	TCHAR szMachine[ MAX_PATH],szPath[MAX_PATH];
+ 	DWORD rc=28;
+ 	HANDLE hEnum;
+ 	LPNETRESOURCE lpnrLocal,lpnr=NULL;
+ 	DWORD res;
+ 	DWORD cbBuffer=16384;
+ 	DWORD cEntries=-1;
+ 	GetComputerName(szMachine,&rc);
+ 	CHAR szUser[MAXRANDOMNAMELEN];
+    // Initialize the data structure
+ 	if (!IsServiceActive())
+ 		return TRUE;
+ 	memset (&List, 0x00, sizeof(DRIVEMAPLIST));
+ 	for (size_t ii = 0; ii < 26; ++ii)
+ 		List.aDriveMap[ii].chDrive = chDRIVE_A + ii;
+ 	QueryDriveMapList_ReadSubmounts (&List);
+ 	if ((res=WNetOpenEnum(RESOURCE_CONNECTED,RESOURCETYPE_DISK,RESOURCEUSAGE_CONNECTABLE,lpnr,&hEnum))!=NO_ERROR)
+ 		return FALSE;
+ 	lpnrLocal=(LPNETRESOURCE) GlobalAlloc(GPTR,cbBuffer);
+ 	sprintf(szPath,"\\\\%s-afs\\",szMachine);
+ 	_strlwr(szPath);
+ 	do {
+ 		memset(lpnrLocal,0,cbBuffer);
+ 		if ((res = WNetEnumResource(hEnum,&cEntries,lpnrLocal,&cbBuffer))==NO_ERROR)
+ 		{
+ 			for (DWORD i=0;i<cEntries;i++)
+ 			{
+ 				if (strstr(_strlwr(lpnrLocal[i].lpRemoteName),szPath)==NULL)
+ 					continue;	//only look at real afs mappings
+ 				CHAR * pSubmount=strrchr(lpnrLocal[i].lpRemoteName,'\\')+1;
+ 				if (strcmpi(pSubmount,"all")==0) 
+ 					continue;				// do not remove 'all'
+ 				for (DWORD j=0;j<List.cSubmounts;j++)
+ 				{
+ 					if (
+ 						(List.aSubmounts[j].szSubmount[0]) &&
+ 						(strcmpi(List.aSubmounts[j].szSubmount,pSubmount)==0)
+ 						) 
+ 					{
+ 						List.aSubmounts[j].fInUse=TRUE; 
+ 						goto nextname;
+ 					}
+ 				}
+ 				// wasn't on list so lets remove
+ 				sprintf(szPath,"\\\\%s-afs\\%s",szMachine,pSubmount);
+ 				WNetCancelConnection(szPath,TRUE);
+ 				nextname:;
+ 			}
+ 		}
+ 	} while (res!=ERROR_NO_MORE_ITEMS);
+ 	GlobalFree((HGLOBAL)lpnrLocal);
+ 	WNetCloseEnum(hEnum);
+ 	sprintf(szPath,"\\\\%s-afs\\all",szMachine);
+ 	cbBuffer=MAXRANDOMNAMELEN-1;
+ 	// Lets connect all submounts that weren't connectd
+ 	CHAR * pUser=szUser;
+ 	if (WNetGetUser(szPath,(LPSTR)szUser,&cbBuffer)!=NO_ERROR)
+ 		GenRandomName(szUser,MAXRANDOMNAMELEN-1);
+ 	else {
+ 		if ((pUser=strchr(szUser,'\\'))==NULL)
+ 			return FALSE;
+ 		pUser++;
+ 	}
+ 	for (DWORD j=0;j<List.cSubmounts;j++)
+ 	{
+ 		if (List.aSubmounts[j].fInUse)
+ 			continue;
+ 		sprintf(szPath,"\\\\%s-afs\\%s",szMachine,List.aSubmounts[j].szSubmount);
+ 		NETRESOURCE nr;
+ 		memset (&nr, 0x00, sizeof(NETRESOURCE));
+ 		nr.dwType=RESOURCETYPE_DISK;
+ 		nr.lpLocalName="";
+ 		nr.lpRemoteName=szPath;
+ 		DWORD res=WNetAddConnection2(&nr,NULL,pUser,0);
+ 
+ 	}
+ 	return TRUE;
+ }
+ 
+ BOOL DoMapShare()
+ {
+ 	DRIVEMAPLIST List;
+ 	TCHAR szMachine[ MAX_PATH ];
+ 	TCHAR szPath[ MAX_PATH ];
+ 	DWORD rc=28;
+ 	BOOL bMappedAll=FALSE;
+ 	GetComputerName(szMachine,&rc);
+    // Initialize the data structure
+ 	DEBUG_EVENT0("AFS DoMapShare");
+ 	QueryDriveMapList (&List);
+ 	DoUnMapShare(TRUE);
+ 	// All connections have been removed
+ 	// Lets restore them after making the connection from the random name
+ 
+ 	GenRandomName(pUserName,MAXRANDOMNAMELEN-1);
+ 	for (DWORD i=0;i<List.cSubmounts;i++)
+ 	{
+ 		if (List.aSubmounts[i].szSubmount[0])
+ 		{
+ 			sprintf(szPath,"\\\\%s-afs\\%s",szMachine,List.aSubmounts[i].szSubmount);
+ 			NETRESOURCE nr;
+ 			memset (&nr, 0x00, sizeof(NETRESOURCE));
+ 			nr.dwType=RESOURCETYPE_DISK;
+ 			nr.lpLocalName="";
+ 			nr.lpRemoteName=szPath;
+ 			DWORD res=WNetAddConnection2(&nr,NULL,pUserName,0);
+ 			DEBUG_EVENT2("AFS DriveMap","Remote[%s]=%x",szPath,res);
+ 			if (strcmpi("all",List.aSubmounts[i].szSubmount)==0)
+ 				bMappedAll=TRUE;
+ 		}
+ 	}
+ 	if (!bMappedAll)	//make sure all is mapped also
+ 	{
+ 			sprintf(szPath,"\\\\%s-afs\\all",szMachine);
+ 			NETRESOURCE nr;
+ 			memset (&nr, 0x00, sizeof(NETRESOURCE));
+ 			nr.dwType=RESOURCETYPE_DISK;
+ 			nr.lpLocalName="";
+ 			nr.lpRemoteName=szPath;
+ 			DWORD res=WNetAddConnection2(&nr,NULL,pUserName,0);
+ 			DEBUG_EVENT2("AFS DriveMap","Remote[%s]=%x",szPath,res);
+ 			if (res==ERROR_SESSION_CREDENTIAL_CONFLICT)
+ 			{
+ 				WNetCancelConnection(szPath,TRUE);
+ 				WNetAddConnection2(&nr,NULL,pUserName,0);
+ 			}
+ 	}
+ 	for (TCHAR chDrive = chDRIVE_A; chDrive <= chDRIVE_Z; ++chDrive)
+ 	{
+ 		TCHAR szRemote[3];
+ 		if (List.aDriveMap[chDrive-chDRIVE_A].fActive)
+ 		{
+ 			sprintf(szRemote,"%c:",chDrive);
+ 			sprintf(szPath,"\\\\%s-afs\\%s",szMachine,List.aDriveMap[chDrive-chDRIVE_A].szSubmount);
+ 			NETRESOURCE nr;
+ 			memset (&nr, 0x00, sizeof(NETRESOURCE));
+ 			nr.dwType=RESOURCETYPE_DISK;
+ 			nr.lpLocalName=szRemote;
+ 			nr.lpRemoteName=szPath;
+ 			DWORD res=WNetAddConnection2(&nr,NULL,NULL,(List.aDriveMap[chDrive-chDRIVE_A].fPersistent)?CONNECT_UPDATE_PROFILE:0);
+ 			DEBUG_EVENT3("AFS DriveMap","Persistant[%d] Remote[%s]=%x",List.aDriveMap[chDrive-chDRIVE_A].fPersistent,szPath,res);
+ 		}
+ 	}
+ 	return TRUE;
+ }
Index: openafs/src/WINNT/client_config/drivemap.h
diff -c openafs/src/WINNT/client_config/drivemap.h:1.2 openafs/src/WINNT/client_config/drivemap.h:1.2.8.1
*** openafs/src/WINNT/client_config/drivemap.h:1.2	Sat Nov  4 05:02:38 2000
--- openafs/src/WINNT/client_config/drivemap.h	Wed Nov 14 22:38:48 2001
***************
*** 85,89 ****
--- 85,103 ----
  BOOL SubmountToPath (PDRIVEMAPLIST pList, LPTSTR pszPath, LPTSTR pszSubmount, BOOL fMarkInUse);
  BOOL PathToSubmount (LPTSTR pszSubmount, LPTSTR pszMapping, LPTSTR pszSubmountReq, ULONG *pStatus);
  
+ BOOL TestAndDoMapShare(DWORD);
+ BOOL DoMapShare();
+ void MapShareName(char *);
+ void DoUnMapShare(BOOL);
+ BOOL DoMapShareChange();
+ DWORD RWLogonOption(BOOL read,DWORD value);
+ #ifndef DRIVEMAP_DEF_H
+ extern void TestAndDoUnMapShare();
+ extern TCHAR pUserName[];
+ extern BOOL fUserName;
+ extern DWORD RWLogonOption(BOOL read,DWORD value);
+ extern void SetBitLogonOption(BOOL set,DWORD value);
+ extern BOOL TestAndDoMapShare(DWORD);
+ #endif
  #endif
  
Index: openafs/src/WINNT/client_config/resource.h
diff -c openafs/src/WINNT/client_config/resource.h:1.2 openafs/src/WINNT/client_config/resource.h:1.2.8.1
*** openafs/src/WINNT/client_config/resource.h:1.2	Sat Nov  4 05:02:39 2000
--- openafs/src/WINNT/client_config/resource.h	Wed Nov 14 22:38:48 2001
***************
*** 163,168 ****
--- 163,170 ----
  #define IDC_CHANGE                      1059
  #define IDC_DIAG_PARMS                  1060
  #define IDC_ROOTVOLUME					1061
+ #define IDC_AUTOLANA                    1062
+ #define IDC_STATICLANA                  1063
  #define IDC_STATIC                      -1
  
  // Next default values for new objects
***************
*** 173,179 ****
  #define _APS_3D_CONTROLS                     1
  #define _APS_NEXT_RESOURCE_VALUE        122
  #define _APS_NEXT_COMMAND_VALUE         40001
! #define _APS_NEXT_CONTROL_VALUE         1062
  #define _APS_NEXT_SYMED_VALUE           101
  #endif
  #endif
--- 175,181 ----
  #define _APS_3D_CONTROLS                     1
  #define _APS_NEXT_RESOURCE_VALUE        122
  #define _APS_NEXT_COMMAND_VALUE         40001
! #define _APS_NEXT_CONTROL_VALUE         1064
  #define _APS_NEXT_SYMED_VALUE           101
  #endif
  #endif
Index: openafs/src/WINNT/client_config/tab_drives.cpp
diff -c openafs/src/WINNT/client_config/tab_drives.cpp:1.2 openafs/src/WINNT/client_config/tab_drives.cpp:1.2.8.1
*** openafs/src/WINNT/client_config/tab_drives.cpp:1.2	Sat Nov  4 05:02:39 2000
--- openafs/src/WINNT/client_config/tab_drives.cpp	Wed Nov 14 22:38:48 2001
***************
*** 618,623 ****
--- 618,625 ----
  
     FreeDriveMapList (&g.Configuration.NetDrives);
     QueryDriveMapList (&g.Configuration.NetDrives);
+    if (g.Configuration.fLogonAuthent)
+ 	   DoMapShareChange();
  }
  
  
***************
*** 682,687 ****
--- 684,690 ----
        }
  }
  
+ // Action - On Remove submount item
  
  void Submounts_OnRemove (HWND hDlg)
  {
***************
*** 698,703 ****
--- 701,707 ----
  }
  
  
+ // Action - On Add or On Edit a submount item
  void Submounts_EditSubmount (HWND hDlg, PSUBMOUNT pSubmount)
  {
     HWND hList = GetDlgItem (hDlg, IDC_LIST);
Index: openafs/src/WINNT/client_config/tab_general.cpp
diff -c openafs/src/WINNT/client_config/tab_general.cpp:1.2 openafs/src/WINNT/client_config/tab_general.cpp:1.2.8.1
*** openafs/src/WINNT/client_config/tab_general.cpp:1.2	Sat Nov  4 05:02:39 2000
--- openafs/src/WINNT/client_config/tab_general.cpp	Wed Nov 14 22:38:48 2001
***************
*** 10,15 ****
--- 10,16 ----
  extern "C" {
  #include <afs/param.h>
  #include <afs/stds.h>
+ #include <rx/rxkad.h>
  }
  
  #include "afs_config.h"
***************
*** 17,22 ****
--- 18,25 ----
  #include "tab_hosts.h"
  #include "tab_advanced.h"
  
+ #include "drivemap.h"
+ #include <adssts.h>
  
  /*
   * VARIABLES __________________________________________________________________
***************
*** 70,76 ****
  BOOL CALLBACK Status_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
  void Status_OnRefresh (HWND hDlg);
  
- 
  /*
   * ROUTINES ___________________________________________________________________
   *
--- 73,78 ----
***************
*** 220,226 ****
     return TRUE;
  }
  
- 
  BOOL GeneralTab_OnApply (HWND hDlg, BOOL fForce, BOOL fComplainIfInvalid)
  {
     if (!fForce)
--- 222,227 ----
***************
*** 260,267 ****
     BOOL fLogonAuthent = IsDlgButtonChecked (hDlg, IDC_LOGON);
     if (fLogonAuthent != g.Configuration.fLogonAuthent)
        {
!       if (!Config_SetAuthentFlag (fLogonAuthent))
!          return FALSE;
        g.Configuration.fLogonAuthent = fLogonAuthent;
        }
  
--- 261,267 ----
     BOOL fLogonAuthent = IsDlgButtonChecked (hDlg, IDC_LOGON);
     if (fLogonAuthent != g.Configuration.fLogonAuthent)
        {
! 	   SetBitLogonOption(fLogonAuthent,LOGON_OPTION_INTEGRATED);
        g.Configuration.fLogonAuthent = fLogonAuthent;
        }
  
***************
*** 325,331 ****
           Config_GetGatewayName (g.Configuration.szGateway);
  
        Config_GetCellName (g.Configuration.szCell);
!       Config_GetAuthentFlag (&g.Configuration.fLogonAuthent);
        Config_GetTrayIconFlag (&g.Configuration.fShowTrayIcon);
  
        if (!g.fIsWinNT)
--- 325,331 ----
           Config_GetGatewayName (g.Configuration.szGateway);
  
        Config_GetCellName (g.Configuration.szCell);
!       g.Configuration.fLogonAuthent=RWLogonOption(TRUE,LOGON_OPTION_INTEGRATED);
        Config_GetTrayIconFlag (&g.Configuration.fShowTrayIcon);
  
        if (!g.fIsWinNT)
***************
*** 406,411 ****
--- 406,412 ----
  {
     DWORD CurrentState = Config_GetServiceState();
     DWORD DisplayState = GeneralTab_GetDisplayState(hDlg);
+    TestAndDoMapShare(CurrentState);		//Re map mounted drives if necessary
  
     BOOL fInEndState = ((CurrentState == SERVICE_RUNNING) || (CurrentState == SERVICE_STOPPED));
     if (fInEndState && l.hStatus)
***************
*** 684,689 ****
--- 685,691 ----
              {
              g.fNeedRestart = FALSE;
              if (StartService (hService, 0, 0))
+ 				TestAndDoMapShare(SERVICE_START_PENDING);
                 fSuccess = TRUE;
              }
           else // (!fStart)
***************
*** 691,696 ****
--- 693,700 ----
              SERVICE_STATUS Status;
              if (ControlService (hService, SERVICE_CONTROL_STOP, &Status))
                 fSuccess = TRUE;
+ 			   if (g.Configuration.fLogonAuthent)
+ 				   DoUnMapShare(FALSE);
              }
  
           CloseServiceHandle (hService);
Index: openafs/src/WINNT/client_config/lang/en_US/afs_config.rc
diff -c openafs/src/WINNT/client_config/lang/en_US/afs_config.rc:1.2 openafs/src/WINNT/client_config/lang/en_US/afs_config.rc:1.2.8.1
*** openafs/src/WINNT/client_config/lang/en_US/afs_config.rc:1.2	Sat Nov  4 05:02:41 2000
--- openafs/src/WINNT/client_config/lang/en_US/afs_config.rc	Wed Nov 14 22:38:48 2001
***************
*** 348,354 ****
  CAPTION "Miscellaneous Configuration"
  FONT 8, "MS Sans Serif"
  BEGIN
!     EDITTEXT        IDC_LAN_ADAPTER,90,20,32,13,ES_AUTOHSCROLL
      EDITTEXT        IDC_PROBE,90,40,32,13,ES_AUTOHSCROLL
      EDITTEXT        IDC_THREADS,90,60,32,13,ES_AUTOHSCROLL
      EDITTEXT        IDC_DAEMONS,90,80,32,13,ES_AUTOHSCROLL
--- 348,354 ----
  CAPTION "Miscellaneous Configuration"
  FONT 8, "MS Sans Serif"
  BEGIN
!     EDITTEXT        IDC_LAN_ADAPTER,162,22,32,13,ES_AUTOHSCROLL
      EDITTEXT        IDC_PROBE,90,40,32,13,ES_AUTOHSCROLL
      EDITTEXT        IDC_THREADS,90,60,32,13,ES_AUTOHSCROLL
      EDITTEXT        IDC_DAEMONS,90,80,32,13,ES_AUTOHSCROLL
***************
*** 367,374 ****
      LTEXT           "threads",IDC_STATIC,138,82,68,8
      LTEXT           "S&ystem Name:",IDC_STATIC,15,102,71,8
      LTEXT           "&Mount Directory:",IDC_STATIC,15,122,71,8
-     LTEXT           "&Lan Adapter Number:",IDC_STATIC,15,22,71,8
      LTEXT           "&Root Volume:",IDC_STATIC,15,141,71,8
  END
  
  IDD_DIAG_PARMS DIALOG DISCARDABLE  0, 0, 217, 135
--- 367,376 ----
      LTEXT           "threads",IDC_STATIC,138,82,68,8
      LTEXT           "S&ystem Name:",IDC_STATIC,15,102,71,8
      LTEXT           "&Mount Directory:",IDC_STATIC,15,122,71,8
      LTEXT           "&Root Volume:",IDC_STATIC,15,141,71,8
+     CONTROL         "Automatic Lana scan",IDC_AUTOLANA,"Button",
+                     BS_AUTOCHECKBOX | WS_TABSTOP,19,22,82,10
+     RTEXT           "Lana Number:",IDC_STATICLANA,106,24,53,8
  END
  
  IDD_DIAG_PARMS DIALOG DISCARDABLE  0, 0, 217, 135
Index: openafs/src/WINNT/client_creds/advtab.cpp
diff -c openafs/src/WINNT/client_creds/advtab.cpp:1.2 openafs/src/WINNT/client_creds/advtab.cpp:1.2.8.2
*** openafs/src/WINNT/client_creds/advtab.cpp:1.2	Sat Nov  4 05:02:45 2000
--- openafs/src/WINNT/client_creds/advtab.cpp	Wed Nov 21 01:45:44 2001
***************
*** 122,127 ****
--- 122,128 ----
           DWORD dwSize = sizeof(Config);
           QueryServiceConfig (hService, (QUERY_SERVICE_CONFIG*)&Config, sizeof(Config), &dwSize);
           QueryServiceStatus (hService, &Status);
+ 		 TestAndDoMapShare(Status.dwCurrentState);
  
           CloseServiceHandle (hService);
           }
***************
*** 156,161 ****
--- 157,163 ----
        GetString (szStatus, IDS_SERVICE_STARTING);
     else
        GetString (szStatus, IDS_SERVICE_UNKNOWN);
+    TestAndDoMapShare(Status.dwCurrentState);
     SetDlgItemText (hDlg, IDC_SERVICE_STATUS, szStatus);
  
     if (fFinal && GetWindowLong (hDlg, DWL_USER))
***************
*** 194,206 ****
  
              case IDC_SERVICE_START:
                 if (StartService (hService, 0, 0))
                    fSuccess = TRUE;
                 break;
  
              case IDC_SERVICE_STOP:
                 SERVICE_STATUS Status;
!                if (ControlService (hService, SERVICE_CONTROL_STOP, &Status))
!                   fSuccess = TRUE;
                 break;
              }
  
--- 196,212 ----
  
              case IDC_SERVICE_START:
                 if (StartService (hService, 0, 0))
+ 			   {
+ 				  TestAndDoMapShare(SERVICE_START_PENDING);
                    fSuccess = TRUE;
+ 			   }
                 break;
  
              case IDC_SERVICE_STOP:
                 SERVICE_STATUS Status;
! 			   TestAndDoUnMapShare();
!                ControlService (hService, SERVICE_CONTROL_STOP, &Status);
!                fSuccess = TRUE;
                 break;
              }
  
Index: openafs/src/WINNT/client_creds/afswiz.cpp
diff -c openafs/src/WINNT/client_creds/afswiz.cpp:1.2 openafs/src/WINNT/client_creds/afswiz.cpp:1.2.8.1
*** openafs/src/WINNT/client_creds/afswiz.cpp:1.2	Sat Nov  4 05:02:46 2000
--- openafs/src/WINNT/client_creds/afswiz.cpp	Wed Nov 14 22:38:49 2001
***************
*** 225,231 ****
        SC_HANDLE hService;
        if ((hService = OpenService (hManager, TEXT("TransarcAFSDaemon"), SERVICE_ALL_ACCESS)) != NULL)
           {
!          StartService (hService, 0, 0);
  
           CloseServiceHandle (hService);
           }
--- 225,232 ----
        SC_HANDLE hService;
        if ((hService = OpenService (hManager, TEXT("TransarcAFSDaemon"), SERVICE_ALL_ACCESS)) != NULL)
           {
!          if (StartService (hService, 0, 0))
! 			TestAndDoMapShare(SERVICE_START_PENDING);
  
           CloseServiceHandle (hService);
           }
***************
*** 253,258 ****
--- 254,260 ----
           {
           QueryServiceStatus (hService, &Status);
           CloseServiceHandle (hService);
+ 		 TestAndDoMapShare(Status.dwCurrentState);
           }
  
        CloseServiceHandle (hManager);
Index: openafs/src/WINNT/client_creds/main.cpp
diff -c openafs/src/WINNT/client_creds/main.cpp:1.2 openafs/src/WINNT/client_creds/main.cpp:1.2.8.1
*** openafs/src/WINNT/client_creds/main.cpp:1.2	Sat Nov  4 05:02:47 2000
--- openafs/src/WINNT/client_creds/main.cpp	Wed Nov 14 22:38:49 2001
***************
*** 14,19 ****
--- 14,20 ----
  
  #include "afscreds.h"
  #include "..\afsreg\afsreg.h" // So we can see if the server's installed
+ #include "drivemap.h"
  
  
  /*
***************
*** 111,120 ****
--- 112,129 ----
           case 'U':
              fUninstall = TRUE;
              break;
+ 		 case ':':
+ 			 MapShareName(pszCmdLineA);
+ 			 break;
+          case 'x':
+          case 'X':
+ 			 DoMapShare();
+ 			 return 0;
           }
  
        while (*pszCmdLineA && (*pszCmdLineA != ' '))
           ++pszCmdLineA;
+ 	  if (*pszCmdLineA==' ') ++pszCmdLineA;
        }
  
     if (fInstall)
Index: openafs/src/WINNT/client_osi/libosi.def
diff -c openafs/src/WINNT/client_osi/libosi.def:1.1 openafs/src/WINNT/client_osi/libosi.def:1.1.12.1
*** openafs/src/WINNT/client_osi/libosi.def:1.1	Fri Nov  3 21:16:48 2000
--- openafs/src/WINNT/client_osi/libosi.def	Wed Nov 14 22:38:50 2001
***************
*** 65,67 ****
--- 65,70 ----
  	osi_LogPrint		@58
  	osi_LogSaveString	@59
  	osi_InitPanic		@60
+ 	osi_InitTraceOption @61
+ 	osi_LogEvent0		@62
+ 	osi_LogEvent		@63
Index: openafs/src/WINNT/client_osi/osilog.c
diff -c openafs/src/WINNT/client_osi/osilog.c:1.2 openafs/src/WINNT/client_osi/osilog.c:1.2.4.1
*** openafs/src/WINNT/client_osi/osilog.c:1.2	Mon Apr 30 02:49:51 2001
--- openafs/src/WINNT/client_osi/osilog.c	Wed Nov 14 22:38:50 2001
***************
*** 330,332 ****
--- 330,384 ----
  	if (logp)
  		logp->enabled = 0;
  }
+ 
+ #define REG_CLIENT_PARMS_KEY  "SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters"
+ #define TRACE_OPTION_EVENT 1
+ #define ISLOGONTRACE(v) ( ((v) & TRACE_OPTION_EVENT)==TRACE_OPTION_EVENT)
+ 
+ DWORD osi_TraceOption=0;
+ 
+ void osi_InitTraceOption()
+ {
+ 	DWORD LSPtype, LSPsize;
+ 	HKEY NPKey;
+ 	(void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY,
+ 		    0, KEY_QUERY_VALUE, &NPKey);
+ 	LSPsize=sizeof(osi_TraceOption);
+ 	RegQueryValueEx(NPKey, "TraceOption", NULL,
+ 				&LSPtype, (LPBYTE)&osi_TraceOption, &LSPsize);
+ }
+ 
+ 
+ #define MAXBUF_ 131
+ void osi_LogEvent0(char *a,char *b) 
+ {
+ 	HANDLE h; char *ptbuf[1],buf[MAXBUF_+1];
+ 	if (!ISLOGONTRACE(osi_TraceOption))
+ 		return;
+ 	h = RegisterEventSource(NULL, a);
+ 	ptbuf[0] = b;
+ 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (const char **)ptbuf, NULL);
+ 	DeregisterEventSource(h);
+ }
+ 
+ 
+ void osi_LogEvent(char *a,char *b,char *c,...) 
+ {
+ 	HANDLE h; char *ptbuf[1],buf[MAXBUF_+1];
+ 	va_list marker;
+ 	if (!ISLOGONTRACE(osi_TraceOption))
+ 		return;
+ 	if (b)
+ 	{
+ 		wsprintf(buf,a,b);
+ 		h = RegisterEventSource(NULL, buf);
+ 	}
+ 	else
+ 		h = RegisterEventSource(NULL, a);
+ 	va_start(marker,c);
+ 	_vsnprintf(buf,MAXBUF_,c,marker);
+ 	ptbuf[0] = buf;
+ 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (const char **)ptbuf, NULL);\
+ 	DeregisterEventSource(h);
+ 	va_end(marker);
+ }
Index: openafs/src/WINNT/client_osi/osilog.h
diff -c openafs/src/WINNT/client_osi/osilog.h:1.2 openafs/src/WINNT/client_osi/osilog.h:1.2.4.1
*** openafs/src/WINNT/client_osi/osilog.h:1.2	Mon Apr 30 02:49:51 2001
--- openafs/src/WINNT/client_osi/osilog.h	Wed Nov 14 22:38:50 2001
***************
*** 6,13 ****
   *
   */
  
- /* Copyright (C) 1994 Cazamar Systems, Inc. */
- 
  #ifndef _OSI_LOG_H__
  #define _OSI_LOG_H__ 1
  
--- 6,11 ----
***************
*** 82,87 ****
--- 80,88 ----
  extern void osi_LogPrint(osi_log_t *logp, FILE_HANDLE handle);
  
  extern char *osi_LogSaveString(osi_log_t *logp, char *s);
+ extern void osi_InitTraceOption();
+ extern void osi_LogEvent0(char *a,char *b);
+ extern void osi_LogEvent(char *a,char *b,char *c,...);
  
  /* define macros */
  #define osi_Log0(l,f)		osi_LogAdd((l), (f), 0, 0, 0, 0)
***************
*** 89,93 ****
--- 90,146 ----
  #define osi_Log2(l,f,a,b)	osi_LogAdd((l), (f), (long) (a), (long) (b), 0, 0)
  #define osi_Log3(l,f,a,b,c)	osi_LogAdd((l), (f), (long) (a), (long) (b), (long) (c), 0)
  #define osi_Log4(l,f,a,b,c,d)	osi_LogAdd((l), (f), (long) (a), (long) (b), (long) (c), (long) (d))
+ 
+ #ifdef DEBUG_VERBOSE
+ #define DEBUG_EVENT1(a,b,c) {HANDLE h; char *ptbuf[1],buf[132];\
+ 	h = RegisterEventSource(NULL, a);\
+ 	sprintf(buf, b,c);\
+ 	ptbuf[0] = buf;\
+ 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0, (const char **)ptbuf, NULL);\
+ 	DeregisterEventSource(h);}
+ #define DEBUG_EVENT0(a) {HANDLE h; char *ptbuf[1];\
+ 	h = RegisterEventSource(NULL, a);\
+ 	ptbuf[0] = "";\
+ 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0,(const char **) ptbuf, NULL);\
+ 	DeregisterEventSource(h);}
+ #define DEBUG_EVENT2(a,b,c,d) {HANDLE h; char *ptbuf[1],buf[132];\
+ 	h = RegisterEventSource(NULL, a);\
+ 	sprintf(buf, b,c,d);\
+ 	ptbuf[0] = buf;\
+ 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0,(const char **) ptbuf, NULL);\
+ 	DeregisterEventSource(h);}
+ #define DEBUG_EVENT3(a,b,c,d,e) {HANDLE h; char *ptbuf[1],buf[132];\
+ 	h = RegisterEventSource(NULL, a);\
+ 	sprintf(buf, b,c,d,e);\
+ 	ptbuf[0] = buf;\
+ 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0,(const char **)ptbuf, NULL);\
+ 	DeregisterEventSource(h);}
+ #define DEBUG_EVENT4(a,b,c,d,e,f) {HANDLE h; char *ptbuf[1],buf[132];\
+ 	h = RegisterEventSource(NULL, a);\
+ 	sprintf(buf, b,c,d,e,f);\
+ 	ptbuf[0] = buf;\
+ 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0,(const char **) ptbuf, NULL);\
+ 	DeregisterEventSource(h);}
+ #define DEBUG_EVENT5(a,b,c,d,e,f,g) {HANDLE h; char *ptbuf[1],buf[132];\
+ 	h = RegisterEventSource(NULL, a);\
+ 	sprintf(buf, b,c,d,e,f,g);\
+ 	ptbuf[0] = buf;\
+ 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0,(const char **) ptbuf, NULL);\
+ 	DeregisterEventSource(h);}
+ #define DEBUG_EVENT6(a,b,c,d,e,f,g,h) {HANDLE h; char *ptbuf[1],buf[132];\
+ 	h = RegisterEventSource(NULL, a);\
+ 	sprintf(buf,b,c,d,e,f,g,h);\
+ 	ptbuf[0] = buf;\
+ 	ReportEvent(h, EVENTLOG_INFORMATION_TYPE, 0, 0, NULL, 1, 0,(const char **) ptbuf, NULL);\
+ 	DeregisterEventSource(h);}
+ #else
+ #define DEBUG_EVENT0(a)
+ #define DEBUG_EVENT1(a,b,c)
+ #define DEBUG_EVENT2(a,b,c,d)
+ #define DEBUG_EVENT3(a,b,c,d,e)
+ #define DEBUG_EVENT4(a,b,c,d,e,f)
+ #define DEBUG_EVENT5(a,b,c,d,e,f,g)
+ #define DEBUG_EVENT6(a,b,c,d,e,f,g,h)
+ #endif
  
  #endif /*  _OSI_LOG_H__ */
Index: openafs/src/WINNT/client_osi/osisleep.h
diff -c openafs/src/WINNT/client_osi/osisleep.h:1.2 openafs/src/WINNT/client_osi/osisleep.h:1.2.4.1
*** openafs/src/WINNT/client_osi/osisleep.h:1.2	Mon Apr 30 02:49:51 2001
--- openafs/src/WINNT/client_osi/osisleep.h	Sat Oct 13 00:19:06 2001
***************
*** 82,89 ****
--- 82,91 ----
  /* spin lock version of wakeup, used internally only */
  extern void osi_WakeupSpin(long value);
  
+ #ifndef DJGPP
  /* exported function to sleep on a value */
  extern void osi_Sleep (long);
+ #endif
  
  extern void osi_FreeSleepInfo(osi_sleepInfo_t *);
  
Index: openafs/src/WINNT/install/InstallShield5/Default.txt
diff -c openafs/src/WINNT/install/InstallShield5/Default.txt:1.2 openafs/src/WINNT/install/InstallShield5/Default.txt:1.2.2.1
*** openafs/src/WINNT/install/InstallShield5/Default.txt:1.2	Thu Sep  6 22:55:00 2001
--- openafs/src/WINNT/install/InstallShield5/Default.txt	Wed Nov 14 22:38:50 2001
***************
*** 195,201 ****
--- 195,203 ----
  ---Comment---=
  (Default)=S,
  Class=N,2
+ LogonOptions=N,2
  Name=S,TransarcAFSDaemon
+ LogonScript=S,<TARGETDIR>\Client\Program\afscreds.exe -:%s -x
  ProviderPath=S,<LOGON_DLL>
  AuthentProviderPath=S,<LOGON_DLL>
  
Index: openafs/src/WINNT/install/InstallShield5/NTMakefile
diff -c openafs/src/WINNT/install/InstallShield5/NTMakefile:1.6 openafs/src/WINNT/install/InstallShield5/NTMakefile:1.6.2.1
*** openafs/src/WINNT/install/InstallShield5/NTMakefile:1.6	Thu Sep  6 22:55:00 2001
--- openafs/src/WINNT/install/InstallShield5/NTMakefile	Wed Nov 14 22:38:50 2001
***************
*** 35,41 ****
  	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Comments=$(AFSBUILDCOMMENTS)"
  	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] ApplicationName=AFSforWindows"
  	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Company=Open AFS"
! 	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Title=AFS for Windows"
  	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] OutputSpec="$(DESTDIR)\WinInstall\PackageWeb\AFSforWindows.exe"
  !     ENDIF
      CreateISDirTree.bat
--- 35,41 ----
  	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Comments=$(AFSBUILDCOMMENTS)"
  	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] ApplicationName=AFSforWindows"
  	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Company=Open AFS"
! 	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] Title=Open AFS for Windows"
  	$(DESTDIR)\bin\util_cr.exe @ "$(AFSROOT)\src\WINNT\install\InstallShield5\packageweb.pfw" "[Options] OutputSpec="$(DESTDIR)\WinInstall\PackageWeb\AFSforWindows.exe"
  !     ENDIF
      CreateISDirTree.bat
***************
*** 62,69 ****
  	$(DEL) /q $(DESTDIR)\Wininstall\PackageWeb\*.*
  	$(ISWEB)\Pftwwiz.exe $(AFSROOT)\src\winnt\install\InstallShield5\PackageWeb.pfw -s -a 
  !ENDIF
! 	xcopy/s/e/y "Media\Transarc AFS\Disk Images\disk1\*.*" $(DESTDIR)\WinInstall
  	copy AFS_component_version_number.txt $(DESTDIR)\WinInstall\Version.txt
! 	$(DEL) /q "Media\Transarc AFS\Disk Images\disk1\*.*"
  
  install: prep build
--- 62,69 ----
  	$(DEL) /q $(DESTDIR)\Wininstall\PackageWeb\*.*
  	$(ISWEB)\Pftwwiz.exe $(AFSROOT)\src\winnt\install\InstallShield5\PackageWeb.pfw -s -a 
  !ENDIF
! 	xcopy /s/e/y "Media\OpenAFS\Disk Images\disk1\*.*" $(DESTDIR)\WinInstall
  	copy AFS_component_version_number.txt $(DESTDIR)\WinInstall\Version.txt
! 	$(DEL) /q "Media\OpenAFS\Disk Images\disk1\*.*"
  
  install: prep build
Index: openafs/src/WINNT/install/InstallShield5/PackageWeb.pfw
diff -c openafs/src/WINNT/install/InstallShield5/PackageWeb.pfw:1.1 openafs/src/WINNT/install/InstallShield5/PackageWeb.pfw:1.1.2.1
*** openafs/src/WINNT/install/InstallShield5/PackageWeb.pfw:1.1	Thu Sep  6 22:55:00 2001
--- openafs/src/WINNT/install/InstallShield5/PackageWeb.pfw	Wed Nov 14 22:38:50 2001
***************
*** 2,21 ****
  Version=2.0
  
  [Options]
! Title=AFS for Windows
! Company=Open AFS
! CompanyEMail=
! BasePath=.\Media\Transarc AFS\Disk Images
! ImportPath=.\Media\Transarc AFS
  UseRTF=0
  SaveFiles=0
  SubFolders=1
  ApplicationName=AFSforWindows
  Description=
! Comments=Build:09/05/01 09:41 CellServDB:CellServDB.IBM_Internal
  Notice=
! Version=1.1.1 a
! OutputSpec=W:\DEST\WinInstall\PackageWeb\AFSforWindows.exe
  GUIDs=0
  Type=2
  Compress=1
--- 2,21 ----
  Version=2.0
  
  [Options]
! Title=OpenAFS for Windows
! Company=OpenAFS
! CompanyEMail=openafs-info@openafs.org
! BasePath=.\Media\OpenAFS\Disk Images
! ImportPath=.\Media\OpenAFS
  UseRTF=0
  SaveFiles=0
  SubFolders=1
  ApplicationName=AFSforWindows
  Description=
! Comments=Build:11/07/01 10:26 CellServDB:
  Notice=
! Version=1.2.2 a
! OutputSpec=Y:\DEST\WinInstall\PackageWeb\AFSforWindows.exe
  GUIDs=0
  Type=2
  Compress=1
***************
*** 70,267 ****
  
  [File 1]
  Name=_ISDel.exe
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=589825
  Disk=0
  
  [File 2]
  Name=Setup.exe
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=589825
  Disk=0
  
  [File 3]
  Name=_inst32i.ex_
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=524289
  Disk=0
  
  [File 4]
  Name=os.dat
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 5]
  Name=lang.dat
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 6]
  Name=_Setup.dll
! Path=.\Media\Transarc AFS\Disk Images\Disk1\setupdir\0009\
  Flags=655377
  Disk=0
  
  [File 7]
  Name=_Setup.dll
! Path=.\Media\Transarc AFS\Disk Images\Disk1\setupdir\0416\
  Flags=655377
  Disk=0
  
  [File 8]
  Name=_Setup.dll
! Path=.\Media\Transarc AFS\Disk Images\Disk1\setupdir\0804\
  Flags=655377
  Disk=0
  
  [File 9]
  Name=_Setup.dll
! Path=.\Media\Transarc AFS\Disk Images\Disk1\setupdir\0404\
  Flags=655377
  Disk=0
  
  [File 10]
  Name=_Setup.dll
! Path=.\Media\Transarc AFS\Disk Images\Disk1\setupdir\0007\
  Flags=655377
  Disk=0
  
  [File 11]
  Name=_Setup.dll
! Path=.\Media\Transarc AFS\Disk Images\Disk1\setupdir\0011\
  Flags=655377
  Disk=0
  
  [File 12]
  Name=_Setup.dll
! Path=.\Media\Transarc AFS\Disk Images\Disk1\setupdir\0012\
  Flags=655377
  Disk=0
  
  [File 13]
  Name=_Setup.dll
! Path=.\Media\Transarc AFS\Disk Images\Disk1\setupdir\000a\
  Flags=655377
  Disk=0
  
  [File 14]
  Name=setup.ins
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 15]
  Name=_sys1.hdr
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 16]
  Name=_sys1.cab
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 17]
  Name=_user1.hdr
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 18]
  Name=_user1.cab
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 19]
  Name=DATA.TAG
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 20]
  Name=SETUP.INI
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 21]
  Name=setup.lid
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 22]
  Name=setup.bmp
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 23]
  Name=data1.hdr
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 24]
  Name=data1.cab
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 25]
  Name=layout.bin
! Path=.\Media\Transarc AFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 26]
  Name=en_US.rtf
! Path=.\Media\Transarc AFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 27]
  Name=ja_JP.rtf
! Path=.\Media\Transarc AFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 28]
  Name=ko_KR.rtf
! Path=.\Media\Transarc AFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 29]
  Name=zh_CN.rtf
! Path=.\Media\Transarc AFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 30]
  Name=zh_TW.rtf
! Path=.\Media\Transarc AFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 31]
  Name=pt_BR.rtf
! Path=.\Media\Transarc AFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 32]
  Name=es_ES.rtf
! Path=.\Media\Transarc AFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 33]
  Name=de_DE.rtf
! Path=.\Media\Transarc AFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
--- 70,267 ----
  
  [File 1]
  Name=_ISDel.exe
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=589825
  Disk=0
  
  [File 2]
  Name=Setup.exe
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=589825
  Disk=0
  
  [File 3]
  Name=_inst32i.ex_
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=524289
  Disk=0
  
  [File 4]
  Name=os.dat
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 5]
  Name=lang.dat
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 6]
  Name=_Setup.dll
! Path=.\Media\OpenAFS\Disk Images\Disk1\setupdir\0009\
  Flags=655377
  Disk=0
  
  [File 7]
  Name=_Setup.dll
! Path=.\Media\OpenAFS\Disk Images\Disk1\setupdir\0416\
  Flags=655377
  Disk=0
  
  [File 8]
  Name=_Setup.dll
! Path=.\Media\OpenAFS\Disk Images\Disk1\setupdir\0804\
  Flags=655377
  Disk=0
  
  [File 9]
  Name=_Setup.dll
! Path=.\Media\OpenAFS\Disk Images\Disk1\setupdir\0404\
  Flags=655377
  Disk=0
  
  [File 10]
  Name=_Setup.dll
! Path=.\Media\OpenAFS\Disk Images\Disk1\setupdir\0007\
  Flags=655377
  Disk=0
  
  [File 11]
  Name=_Setup.dll
! Path=.\Media\OpenAFS\Disk Images\Disk1\setupdir\0011\
  Flags=655377
  Disk=0
  
  [File 12]
  Name=_Setup.dll
! Path=.\Media\OpenAFS\Disk Images\Disk1\setupdir\0012\
  Flags=655377
  Disk=0
  
  [File 13]
  Name=_Setup.dll
! Path=.\Media\OpenAFS\Disk Images\Disk1\setupdir\000a\
  Flags=655377
  Disk=0
  
  [File 14]
  Name=setup.ins
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 15]
  Name=_sys1.hdr
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 16]
  Name=_sys1.cab
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 17]
  Name=_user1.hdr
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 18]
  Name=_user1.cab
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 19]
  Name=DATA.TAG
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 20]
  Name=SETUP.INI
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 21]
  Name=setup.lid
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 22]
  Name=setup.bmp
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 23]
  Name=data1.hdr
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 24]
  Name=data1.cab
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=2097153
  Disk=0
  
  [File 25]
  Name=layout.bin
! Path=.\Media\OpenAFS\Disk Images\Disk1\
  Flags=1
  Disk=0
  
  [File 26]
  Name=en_US.rtf
! Path=.\Media\OpenAFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 27]
  Name=ja_JP.rtf
! Path=.\Media\OpenAFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 28]
  Name=ko_KR.rtf
! Path=.\Media\OpenAFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 29]
  Name=zh_CN.rtf
! Path=.\Media\OpenAFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 30]
  Name=zh_TW.rtf
! Path=.\Media\OpenAFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 31]
  Name=pt_BR.rtf
! Path=.\Media\OpenAFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 32]
  Name=es_ES.rtf
! Path=.\Media\OpenAFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
  
  [File 33]
  Name=de_DE.rtf
! Path=.\Media\OpenAFS\Disk Images\Disk1\License\
  Flags=1
  Disk=0
Index: openafs/src/WINNT/install/Win9x/NTMakeFile
diff -c openafs/src/WINNT/install/Win9x/NTMakeFile:1.3 openafs/src/WINNT/install/Win9x/NTMakeFile:1.3.2.1
*** openafs/src/WINNT/install/Win9x/NTMakeFile:1.3	Sun Aug 19 10:44:46 2001
--- openafs/src/WINNT/install/Win9x/NTMakeFile	Wed Nov 14 22:38:51 2001
***************
*** 12,35 ****
  ############################################################################
  
  COMPONENTS = \
- 	INSTALL.BAT \
  	afsd.pif \
  	readme.RTF \
- 	license.txt \
- 	templet.reg \
- 	runonce.pif \
  	$(DESTDIR)\bin\util_cr.exe \
  	$(DESTDIR)\root.client\usr\vice\etc\unlog.exe \
- 	$(DESTDIR)\root.client\usr\vice\etc\afs_shl_ext_1033.dll \
- 	$(DESTDIR)\lib\afsauthent.dll \
  	$(DESTDIR)\root.client\usr\vice\etc\afsshare.exe \
  	$(DESTDIR)\root.client\usr\vice\etc\fs.exe \
  	$(DESTDIR)\root.client\usr\vice\etc\klog.exe \
  	$(DESTDIR)\bin\kpasswd.exe \
  	$(DESTDIR)\root.client\usr\vice\etc\libosi.dll \
  	$(DESTDIR)\root.client\usr\vice\etc\libafsconf.dll \
- 	$(DESTDIR)\bin\pts.exe \
- 	$(DESTDIR)\root.client\usr\vice\etc\tokens.exe \
  	$(DESTDIR)\root.client\usr\vice\etc\afs_shl_ext.dll \
  	$(DESTDIR)\lib\win95\pthread.dll \
  	$(DESTDIR)\lib\afsrpc.dll
--- 12,33 ----
  ############################################################################
  
  COMPONENTS = \
  	afsd.pif \
  	readme.RTF \
  	$(DESTDIR)\bin\util_cr.exe \
  	$(DESTDIR)\root.client\usr\vice\etc\unlog.exe \
  	$(DESTDIR)\root.client\usr\vice\etc\afsshare.exe \
  	$(DESTDIR)\root.client\usr\vice\etc\fs.exe \
  	$(DESTDIR)\root.client\usr\vice\etc\klog.exe \
  	$(DESTDIR)\bin\kpasswd.exe \
+ 	$(DESTDIR)\bin\pts.exe \
+ 	$(DESTDIR)\root.client\usr\vice\etc\tokens.exe
+ 		
+ DLLCOMPONENTS = \
+ 	$(DESTDIR)\root.client\usr\vice\etc\afs_shl_ext_1033.dll \
+ 	$(DESTDIR)\lib\afsauthent.dll \
  	$(DESTDIR)\root.client\usr\vice\etc\libosi.dll \
  	$(DESTDIR)\root.client\usr\vice\etc\libafsconf.dll \
  	$(DESTDIR)\root.client\usr\vice\etc\afs_shl_ext.dll \
  	$(DESTDIR)\lib\win95\pthread.dll \
  	$(DESTDIR)\lib\afsrpc.dll
***************
*** 38,51 ****
  	$(DESTDIR)\bin\util_cr.exe ~ $@
  	$(COPY) $@ $(DESTDIR)\WinInstall\.
  
  !IF (EXIST(ISBUILD.MAK))
  !INCLUDE ISBUILD.MAK
  !ENDIF
  
  build:
- 	copy install.bat $(OUTDIR)\.
  
! install: prep $(COMPONENTS) build
  
  install9x: install
  
--- 36,52 ----
  	$(DESTDIR)\bin\util_cr.exe ~ $@
  	$(COPY) $@ $(DESTDIR)\WinInstall\.
  
+ $(DLLCOMPONENTS)::
+ 	$(DESTDIR)\bin\util_cr.exe ~ $@
+ 	$(COPY) $@ $(DESTDIR)\WinInstall\Dll\.
+ 
  !IF (EXIST(ISBUILD.MAK))
  !INCLUDE ISBUILD.MAK
  !ENDIF
  
  build:
  
! install: prep $(COMPONENTS) $(DLLCOMPONENTS) build
  
  install9x: install
  
***************
*** 54,59 ****
--- 55,63 ----
      $(DEL) $(OUTDIR)\DiskIm~1\WebInstall\*
  
  prep :
+ 	$(COPY) "$(DESTDIR)\WinInstall\config\sock.vxd" "$(DESTDIR)\WinInstall\."
+ 	$(COPY) "$(DESTDIR)\WinInstall\config\MMAP.vxd" "$(DESTDIR)\WinInstall\."
+ 	$(COPY) "$(DESTDIR)\WinInstall\config\AFSD.EXE" "$(DESTDIR)\WinInstall\."
  	$(DESTDIR)\bin\util_cr.exe ~ "$(DESTDIR)\WinInstall\sock.vxd"
  	$(DESTDIR)\bin\util_cr.exe ~ "$(DESTDIR)\WinInstall\MMAP.vxd"
  	$(DESTDIR)\bin\util_cr.exe ~ "$(DESTDIR)\WinInstall\AFSD.EXE"
Index: openafs/src/WINNT/win9xpanel/WinAfsLoad.cpp
diff -c openafs/src/WINNT/win9xpanel/WinAfsLoad.cpp:1.2 openafs/src/WINNT/win9xpanel/WinAfsLoad.cpp:1.2.2.1
*** openafs/src/WINNT/win9xpanel/WinAfsLoad.cpp:1.2	Sun Aug 19 10:44:46 2001
--- openafs/src/WINNT/win9xpanel/WinAfsLoad.cpp	Wed Nov 14 22:38:51 2001
***************
*** 408,414 ****
  		m_wParam=wp;
  		m_sMsg=msg;	
  		SetEvent(CMyUIThread::m_hEventThreadKilled);
! 		m_uNntifyMessage=0;
  		break;
  	default:
  		break;
--- 408,414 ----
  		m_wParam=wp;
  		m_sMsg=msg;	
  		SetEvent(CMyUIThread::m_hEventThreadKilled);
! 		m_uNotifyMessage=0;
  		break;
  	default:
  		break;
Index: openafs/src/afs/afs.h
diff -c openafs/src/afs/afs.h:1.9 openafs/src/afs/afs.h:1.9.2.1
*** openafs/src/afs/afs.h:1.9	Mon Aug  6 19:41:26 2001
--- openafs/src/afs/afs.h	Sat Oct 13 00:20:23 2001
***************
*** 189,194 ****
--- 189,195 ----
  #define	CNoSUID		    2	    /* 1 if no suid progs can run from this cell */
  #define CHasVolRef	   16	    /* Volumes were referenced in this cell*/
  #define CLinkedCell	   32
+ #define CAlias		   64	    /* This cell entry is an alias */
  
  struct cell {
      struct afs_q lruq;			     /* lru q next and prev */
***************
*** 201,206 ****
--- 202,208 ----
      short states;			    /* state flags */
      short cellIndex;			    /* relative index number per cell */
      time_t timeout;			    /* data expire time, if non-zero */
+     struct cell *alias;			    /* what this cell is an alias for */
  };
  
  #define	afs_PutCell(cellp, locktype)
***************
*** 522,527 ****
--- 524,541 ----
  #define vrefCount   v.v_usecount
  #endif /* AFS_FBSD_ENV */
  
+ #ifdef AFS_LINUX24_ENV
+ #define VREFCOUNT(v)		atomic_read(&((vnode_t *) v)->v_count)
+ #define VREFCOUNT_SET(v, c)	atomic_set(&((vnode_t *) v)->v_count, c)
+ #define VREFCOUNT_DEC(v)	atomic_dec(&((vnode_t *) v)->v_count)
+ #define VREFCOUNT_INC(v)	atomic_inc(&((vnode_t *) v)->v_count)
+ #else
+ #define VREFCOUNT(v)		((v)->vrefCount)
+ #define VREFCOUNT_SET(v, c)	(v)->vrefCount = c;
+ #define VREFCOUNT_DEC(v)	(v)->vrefCount--;
+ #define VREFCOUNT_INC(v)	(v)->vrefCount++;
+ #endif
+ 
  #define	AFS_MAXDV   0x7fffffff	    /* largest dataversion number */
  #define	AFS_NOTRUNC 0x7fffffff	    /* largest dataversion number */
  
***************
*** 946,951 ****
--- 960,966 ----
  
  extern struct cell	    *afs_GetCell();
  extern struct cell	    *afs_GetCellByName();
+ extern struct cell	    *afs_GetCellByIndex();
  extern struct unixuser	    *afs_GetUser();
  extern struct volume	    *afs_GetVolume();
  extern struct volume	    *afs_GetVolumeByName();
***************
*** 978,984 ****
--- 993,1010 ----
  /* afs_osifile.c */
  extern void shutdown_osifile();
  
+ /* afs_dynroot.c */
+ extern int afs_IsDynrootFid();
+ extern void afs_GetDynrootFid();
+ extern int afs_IsDynroot();
+ extern void afs_RefreshDynroot();
+ extern void afs_GetDynroot();
+ extern void afs_PutDynroot();
+ extern int afs_DynrootNewVnode();
+ extern int afs_SetDynrootEnable();
+ extern int afs_GetDynrootEnable();
  
+ 
  /* Performance hack - we could replace VerifyVCache2 with the appropriate
   * GetVCache incantation, and could eliminate even this code from afs_UFSRead 
   * by making intentionally invalidating quick.stamp in the various callbacks
***************
*** 1036,1041 ****
--- 1062,1068 ----
   * afs_GetDownD wakes those processes once the cache is 95% full
   * (CM_CACHESIZEDRAINEDPCT).
   */
+ extern void afs_MaybeWakeupTruncateDaemon();
  extern void afs_CacheTruncateDaemon();
  extern int afs_WaitForCacheDrain;
  #define CM_MAXDISCARDEDCHUNKS	16      /* # of chunks */
***************
*** 1050,1068 ****
  	(CM_DCACHECOUNTFREEPCT*afs_cacheBlocks)/100 || \
       afs_freeDCCount - afs_discardDCCount < \
  	((100-CM_DCACHECOUNTFREEPCT)*afs_cacheFiles)/100)
- 
- #define	afs_MaybeWakeupTruncateDaemon()	\
-     do { \
- 	if (!afs_CacheTooFull && afs_CacheIsTooFull()) { \
- 	    afs_CacheTooFull = 1; \
-             if (!afs_TruncateDaemonRunning) { \
- 		afs_osi_Wakeup((char *)afs_CacheTruncateDaemon); \
- 	    } \
- 	} else if (!afs_TruncateDaemonRunning && \
- 		   afs_blocksDiscarded > CM_MAXDISCARDEDCHUNKS) { \
- 	    afs_osi_Wakeup((char *)afs_CacheTruncateDaemon); \
- 	} \
-     } while (0)
  
  /* Handy max length of a numeric string. */
  #define	CVBS	12  /* max afs_int32 is 2^32 ~ 4*10^9, +1 for NULL, +luck */
--- 1077,1082 ----
Index: openafs/src/afs/afs_analyze.c
diff -c openafs/src/afs/afs_analyze.c:1.6.4.1 openafs/src/afs/afs_analyze.c:1.6.4.2
*** openafs/src/afs/afs_analyze.c:1.6.4.1	Wed Sep 19 18:40:21 2001
--- openafs/src/afs/afs_analyze.c	Sat Oct 13 00:20:23 2001
***************
*** 13,19 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_analyze.c,v 1.6.4.1 2001/09/19 22:40:21 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 13,19 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_analyze.c,v 1.6.4.2 2001/10/13 04:20:23 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
Index: openafs/src/afs/afs_buffer.c
diff -c openafs/src/afs/afs_buffer.c:1.5 openafs/src/afs/afs_buffer.c:1.5.2.1
*** openafs/src/afs/afs_buffer.c:1.5	Tue Aug  7 20:03:28 2001
--- openafs/src/afs/afs_buffer.c	Sat Oct 13 00:20:23 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_buffer.c,v 1.5 2001/08/08 00:03:28 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #if !defined(UKERNEL)
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_buffer.c,v 1.5.2.1 2001/10/13 04:20:23 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #if !defined(UKERNEL)
***************
*** 232,248 ****
        MReleaseWriteLock(&afs_bufferLock);
        return 0;
      }
      tfile = afs_CFileOpen(fid[0]);
      sizep = (afs_int32 *)tfile;
      if (page * AFS_BUFFER_PAGESIZE >= *sizep) {
  	dirp_Zap(tb->fid);
  	afs_CFileClose(tfile);
- 	MReleaseWriteLock(&afs_bufferLock);
  	return 0;
      }
-     MObtainWriteLock(&tb->lock,260);
-     MReleaseWriteLock(&afs_bufferLock);
-     tb->lockers++;
      code = afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE,
  			 tb->data, AFS_BUFFER_PAGESIZE);
      afs_CFileClose(tfile);
--- 232,249 ----
        MReleaseWriteLock(&afs_bufferLock);
        return 0;
      }
+     MObtainWriteLock(&tb->lock,260);
+     MReleaseWriteLock(&afs_bufferLock);
+     tb->lockers++;
      tfile = afs_CFileOpen(fid[0]);
      sizep = (afs_int32 *)tfile;
      if (page * AFS_BUFFER_PAGESIZE >= *sizep) {
  	dirp_Zap(tb->fid);
+ 	tb->lockers--;
+ 	MReleaseWriteLock(&tb->lock);
  	afs_CFileClose(tfile);
  	return 0;
      }
      code = afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE,
  			 tb->data, AFS_BUFFER_PAGESIZE);
      afs_CFileClose(tfile);
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.14 openafs/src/afs/afs_call.c:1.14.2.1
*** openafs/src/afs/afs_call.c:1.14	Tue Aug  7 20:03:28 2001
--- openafs/src/afs/afs_call.c	Sat Oct 13 00:20:23 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_call.c,v 1.14 2001/08/08 00:03:28 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_call.c,v 1.14.2.1 2001/10/13 04:20:23 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 609,621 ****
  	int cellLen = (sizeArg & 0xffff0000) >> 16;
  	afs_int32 *kmsg = afs_osi_Alloc(kmsgLen);
  	char *cellname = afs_osi_Alloc(cellLen);
  	AFS_COPYIN((afs_int32 *)parm3, kmsg, kmsgLen, code);
! 	if (!code) code = afs_AfsdbHandler(cellname, cellLen, kmsg);
  	if (!code) AFS_COPYOUT(cellname, (char *)parm2, cellLen, code);
  	afs_osi_Free(kmsg, kmsgLen);
  	afs_osi_Free(cellname, cellLen);
      }
  #endif
      else
        code = EINVAL;
  
--- 609,633 ----
  	int cellLen = (sizeArg & 0xffff0000) >> 16;
  	afs_int32 *kmsg = afs_osi_Alloc(kmsgLen);
  	char *cellname = afs_osi_Alloc(cellLen);
+ 
+ 	AFS_COPYIN((afs_int32 *)parm2, cellname, cellLen, code);
  	AFS_COPYIN((afs_int32 *)parm3, kmsg, kmsgLen, code);
! 	if (!code) {
! 	    code = afs_AfsdbHandler(cellname, cellLen, kmsg);
! 	    if (*cellname == 1) *cellname = 0;
! 	    if (code == -2) {	/* Shutting down? */
! 		*cellname = 1;
! 		code = 0;
! 	    }
! 	}
  	if (!code) AFS_COPYOUT(cellname, (char *)parm2, cellLen, code);
  	afs_osi_Free(kmsg, kmsgLen);
  	afs_osi_Free(cellname, cellLen);
      }
  #endif
+     else if (parm == AFSOP_SET_DYNROOT) {
+ 	code = afs_SetDynrootEnable(parm2);
+     }
      else
        code = EINVAL;
  
***************
*** 935,940 ****
--- 947,953 ----
      long linux_ret=0;
      long *retval = &linux_ret;
      long eparm[4]; /* matches AFSCALL_ICL in fstrace.c */
+     /* eparm is also used by AFSCALL_CALL in afsd.c */
  #else
  #if defined(UKERNEL)
  Afs_syscall ()
***************
*** 995,1001 ****
      uap->parm1 = parm1;
      uap->parm2 = parm2;
      uap->parm3 = parm3;
!     if (syscall == AFSCALL_ICL) {
  	AFS_COPYIN((char*)parm4, (char*)eparm, sizeof(eparm), code);
  	uap->parm4 = eparm[0];
  	uap->parm5 = eparm[1];
--- 1008,1014 ----
      uap->parm1 = parm1;
      uap->parm2 = parm2;
      uap->parm3 = parm3;
!     if (syscall == AFSCALL_ICL || syscall == AFSCALL_CALL) {
  	AFS_COPYIN((char*)parm4, (char*)eparm, sizeof(eparm), code);
  	uap->parm4 = eparm[0];
  	uap->parm5 = eparm[1];
***************
*** 1201,1206 ****
--- 1214,1225 ----
  	afs_osi_Wakeup((char*)&afs_CacheTruncateDaemon);
  	afs_osi_Sleep(&afs_termState);
      }
+ #ifdef AFS_AFSDB_ENV
+     afs_warn("AFSDB... ");
+     afs_StopAfsdb();
+     while (afs_termState == AFSOP_STOP_AFSDB)
+ 	afs_osi_Sleep(&afs_termState);
+ #endif
  #if	defined(AFS_SUN5_ENV) || defined(RXK_LISTENER_ENV)
      afs_warn("RxEvent... ");
      /* cancel rx event deamon */
Index: openafs/src/afs/afs_callback.c
diff -c openafs/src/afs/afs_callback.c:1.6.2.1 openafs/src/afs/afs_callback.c:1.6.2.2
*** openafs/src/afs/afs_callback.c:1.6.2.1	Tue Sep 11 15:29:27 2001
--- openafs/src/afs/afs_callback.c	Sat Oct 13 00:20:23 2001
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_callback.c,v 1.6.2.1 2001/09/11 19:29:27 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
--- 16,22 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_callback.c,v 1.6.2.2 2001/10/13 04:20:23 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
***************
*** 157,163 ****
      a_result->DataVersion = hgetlo(tvc->m.DataVersion);
      a_result->callback = afs_data_pointer_to_int32(tvc->callback);		/* XXXX Now a pointer; change it XXXX */
      a_result->cbExpires = tvc->cbExpires;
!     a_result->refCount = tvc->vrefCount;
      a_result->opens = tvc->opens;
      a_result->writers = tvc->execsOrWriters;
      a_result->mvstat = tvc->mvstat;
--- 157,163 ----
      a_result->DataVersion = hgetlo(tvc->m.DataVersion);
      a_result->callback = afs_data_pointer_to_int32(tvc->callback);		/* XXXX Now a pointer; change it XXXX */
      a_result->cbExpires = tvc->cbExpires;
!     a_result->refCount = VREFCOUNT(tvc);
      a_result->opens = tvc->opens;
      a_result->writers = tvc->execsOrWriters;
      a_result->mvstat = tvc->mvstat;
Index: openafs/src/afs/afs_cell.c
diff -c openafs/src/afs/afs_cell.c:1.7 openafs/src/afs/afs_cell.c:1.7.2.1
*** openafs/src/afs/afs_cell.c:1.7	Tue Aug  7 20:03:28 2001
--- openafs/src/afs/afs_cell.c	Sat Oct 13 00:20:23 2001
***************
*** 13,19 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_cell.c,v 1.7 2001/08/08 00:03:28 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 13,19 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_cell.c,v 1.7.2.1 2001/10/13 04:20:23 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 52,72 ****
  /* Local variables. */
  struct cell *afs_rootcell = 0;
  
  static char afs_AfsdbHandlerWait;
  static char afs_AfsdbLookupWait;
  
  char afs_AfsdbHandlerPresent = 0;
  char afs_AfsdbHandlerInuse = 0;
  
  char *afs_AfsdbHandler_CellName;
  afs_int32 *afs_AfsdbHandler_CellHosts;
  int *afs_AfsdbHandler_Timeout;
  
! char afs_AfsdbHandler_ReqPending;
! char afs_AfsdbHandler_Completed;
  
  
! struct cell *afs_GetCellByName_int();
  
  int afs_strcasecmp(s1, s2)
      register char *s1, *s2;
--- 52,84 ----
  /* Local variables. */
  struct cell *afs_rootcell = 0;
  
+ /* Handler waiting for request from client */
  static char afs_AfsdbHandlerWait;
+ /* Client waiting for handler to become available or finish request */
  static char afs_AfsdbLookupWait;
  
+ /* Set to 1 when we've seen the userspace AFSDB process at least once */
  char afs_AfsdbHandlerPresent = 0;
+ /* Set to 1 when there is a client interacting with the AFSDB handler.
+  * Protects the in and out variables below.  Protected by GLOCK. */
  char afs_AfsdbHandlerInuse = 0;
+ /* Set to 1 when AFSDB has been shut down */
+ char afs_AfsdbHandlerShutdown = 0;
  
+ /* Input to handler from the client: cell name to look up */
  char *afs_AfsdbHandler_CellName;
+ /* Outputs from handler to client: cell hosts, TTL, and real cell name */
  afs_int32 *afs_AfsdbHandler_CellHosts;
  int *afs_AfsdbHandler_Timeout;
+ char **afs_AfsdbHandler_RealName;
  
! /* Client sets ReqPending to 1 whenever it queues a request for it */
! char afs_AfsdbHandler_ReqPending = 0;
! /* Handler sets Completed to 1 when it completes the client request */
! char afs_AfsdbHandler_Completed = 0;
  
  
! static struct cell *afs_GetCellByName_int();
  
  int afs_strcasecmp(s1, s2)
      register char *s1, *s2;
***************
*** 87,92 ****
--- 99,114 ----
  
  
  #ifdef AFS_AFSDB_ENV
+ void afs_StopAfsdb()
+ {
+     if (afs_AfsdbHandlerPresent) {
+ 	afs_osi_Wakeup(&afs_AfsdbHandlerWait);
+     } else {
+ 	afs_AfsdbHandlerShutdown = 1;
+ 	afs_termState = AFSOP_STOP_RXEVENT;
+     }
+ }
+ 
  int afs_AfsdbHandler(acellName, acellNameLen, kernelMsg)
      char *acellName;
      int acellNameLen;
***************
*** 94,99 ****
--- 116,122 ----
  {
      /* afs_syscall_call() has already grabbed the global lock */
  
+     if (afs_AfsdbHandlerShutdown) return -2;
      afs_AfsdbHandlerPresent = 1;
  
      if (afs_AfsdbHandler_ReqPending) {
***************
*** 103,108 ****
--- 126,134 ----
  	*afs_AfsdbHandler_Timeout = kernelMsg[1];
  	if (*afs_AfsdbHandler_Timeout) *afs_AfsdbHandler_Timeout += osi_Time();
  
+ 	*afs_AfsdbHandler_RealName = afs_osi_Alloc(strlen(acellName) + 1);
+ 	strcpy(*afs_AfsdbHandler_RealName, acellName);
+ 
  	for (i=0; i<MAXCELLHOSTS; i++) {
  	    if (i >= hostCount)
  		afs_AfsdbHandler_CellHosts[i] = 0;
***************
*** 117,125 ****
      }
  
      /* Wait for a request */
!     while (afs_AfsdbHandler_ReqPending == 0)
  	afs_osi_Sleep(&afs_AfsdbHandlerWait);
  
      /* Copy the requested cell name into the request buffer */
      strncpy(acellName, afs_AfsdbHandler_CellName, acellNameLen);
  
--- 143,163 ----
      }
  
      /* Wait for a request */
!     while (afs_AfsdbHandler_ReqPending == 0 && afs_termState != AFSOP_STOP_AFSDB)
  	afs_osi_Sleep(&afs_AfsdbHandlerWait);
  
+     /* Check if we're shutting down */
+     if (afs_termState == AFSOP_STOP_AFSDB) {
+ 	/* Inform anyone waiting for us that we're going away */
+ 	afs_AfsdbHandlerShutdown = 1;
+ 	afs_AfsdbHandlerPresent = 0;
+ 	afs_osi_Wakeup(&afs_AfsdbLookupWait);
+ 
+ 	afs_termState = AFSOP_STOP_RXEVENT;
+ 	afs_osi_Wakeup(&afs_termState);
+ 	return -2;
+     }
+ 
      /* Copy the requested cell name into the request buffer */
      strncpy(acellName, afs_AfsdbHandler_CellName, acellNameLen);
  
***************
*** 129,144 ****
  #endif
  
  
! int afs_GetCellHostsFromDns(acellName, acellHosts, timeout)
      char *acellName;
      afs_int32 *acellHosts;
      int *timeout;
  {
  #ifdef AFS_AFSDB_ENV
      char grab_glock = 0;
  
      if (!afs_AfsdbHandlerPresent) return ENOENT;
  
      if (!ISAFS_GLOCK()) {
  	grab_glock = 1;
  	AFS_GLOCK();
--- 167,186 ----
  #endif
  
  
! int afs_GetCellHostsFromDns(acellName, acellHosts, timeout, realName)
      char *acellName;
      afs_int32 *acellHosts;
      int *timeout;
+     char **realName;
  {
  #ifdef AFS_AFSDB_ENV
      char grab_glock = 0;
  
      if (!afs_AfsdbHandlerPresent) return ENOENT;
  
+     /* Initialize host list to empty in case the handler is gone */
+     *acellHosts = 0;
+ 
      if (!ISAFS_GLOCK()) {
  	grab_glock = 1;
  	AFS_GLOCK();
***************
*** 153,158 ****
--- 195,201 ----
      afs_AfsdbHandler_CellName = acellName;
      afs_AfsdbHandler_CellHosts = acellHosts;
      afs_AfsdbHandler_Timeout = timeout;
+     afs_AfsdbHandler_RealName = realName;
  
      /* Wake up the AFSDB handler */
      afs_AfsdbHandler_Completed = 0;
***************
*** 160,166 ****
      afs_osi_Wakeup(&afs_AfsdbHandlerWait);
  
      /* Wait for the handler to get back to us with the reply */
!     while (!afs_AfsdbHandler_Completed)
  	afs_osi_Sleep(&afs_AfsdbLookupWait);
  
      /* Release the AFSDB handler and wake up others waiting for it */
--- 203,209 ----
      afs_osi_Wakeup(&afs_AfsdbHandlerWait);
  
      /* Wait for the handler to get back to us with the reply */
!     while (afs_AfsdbHandlerPresent && !afs_AfsdbHandler_Completed)
  	afs_osi_Sleep(&afs_AfsdbLookupWait);
  
      /* Release the AFSDB handler and wake up others waiting for it */
***************
*** 180,199 ****
  void afs_RefreshCell(tc)
      register struct cell *tc;
  {
!     afs_int32 acellHosts[MAXCELLHOSTS];
      int timeout;
  
      /* Don't need to do anything if no timeout or it's not expired */
      if (!tc->timeout || tc->timeout > osi_Time()) return;
- 
-     if (!afs_GetCellHostsFromDns(tc->cellName, acellHosts, &timeout)) {
- 	afs_NewCell(tc->cellName, acellHosts, tc->states,
- 		    tc->lcellp ? tc->lcellp->cellName : (char *) 0,
- 		    tc->fsport, tc->vlport, timeout);
-     }
  
!     /* In case of a DNS failure, keep old cell data.. */
!     return;
  }
  
  
--- 223,250 ----
  void afs_RefreshCell(tc)
      register struct cell *tc;
  {
!     afs_int32 cellHosts[MAXCELLHOSTS];
!     char *realName = NULL;
      int timeout;
  
      /* Don't need to do anything if no timeout or it's not expired */
      if (!tc->timeout || tc->timeout > osi_Time()) return;
  
!     if (afs_GetCellHostsFromDns(tc->cellName, cellHosts, &timeout, &realName))
! 	/* In case of lookup failure, keep old data */
! 	goto done;
! 
!     /* Refresh the DB servers for the real cell; other values stay the same. */
!     afs_NewCell(realName, cellHosts, 0, (char *) 0, 0, 0, timeout, (char *) 0);
! 
!     /* If this is an alias, update the alias entry too */
!     if (afs_strcasecmp(tc->cellName, realName))
! 	afs_NewCell(tc->cellName, 0, CAlias, (char *) 0, 0, 0,
! 		    timeout, realName);
! 
! done:
!     if (realName)
! 	afs_osi_Free(realName, strlen(realName) + 1);
  }
  
  
***************
*** 201,219 ****
      register char *acellName;
      afs_int32 locktype;
  {
!     afs_int32 acellHosts[MAXCELLHOSTS];
      int timeout;
  
!     if (afs_GetCellHostsFromDns(acellName, acellHosts, &timeout))
! 	return (struct cell *) 0;
!     if (afs_NewCell(acellName, acellHosts, CNoSUID, (char *) 0, 0, 0, timeout))
! 	return (struct cell *) 0;
  
      return afs_GetCellByName_int(acellName, locktype, 0);
  }
  
  
! struct cell *afs_GetCellByName_int(acellName, locktype, trydns)
      register char *acellName;
      afs_int32 locktype;
      char trydns;
--- 252,286 ----
      register char *acellName;
      afs_int32 locktype;
  {
!     afs_int32 cellHosts[MAXCELLHOSTS];
!     char *realName = NULL;
      int timeout;
  
!     if (afs_GetCellHostsFromDns(acellName, cellHosts, &timeout, &realName))
! 	goto bad;
!     if (afs_NewCell(realName, cellHosts, CNoSUID, (char *) 0, 0, 0,
! 		    timeout, (char *) 0))
! 	goto bad;
! 
!     /* If this is an alias, create an entry for it too */
!     if (afs_strcasecmp(acellName, realName)) {
! 	if (afs_NewCell(acellName, 0, CAlias, (char *) 0, 0, 0,
! 			timeout, realName))
! 	    goto bad;
!     }
  
+     if (realName)
+ 	afs_osi_Free(realName, strlen(realName) + 1);
      return afs_GetCellByName_int(acellName, locktype, 0);
+ 
+ bad:
+     if (realName)
+ 	afs_osi_Free(realName, strlen(realName) + 1);
+     return (struct cell *) 0;
  }
  
  
! static struct cell *afs_GetCellByName_int(acellName, locktype, trydns)
      register char *acellName;
      afs_int32 locktype;
      char trydns;
***************
*** 230,235 ****
--- 297,306 ----
  	    QAdd(&CellLRU, &tc->lruq);
  	    ReleaseWriteLock(&afs_xcell);
  	    afs_RefreshCell(tc);
+ 	    if (tc->states & CAlias) {
+ 		tc = tc->alias;
+ 		afs_RefreshCell(tc);
+ 	    }
  	    return tc;
  	}
      }
***************
*** 300,319 ****
  } /*afs_GetCellByIndex*/
  
  
! afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport, timeout)
      int aflags;
      char *acellName;
      register afs_int32 *acellHosts;
      char *linkedcname;
      u_short fsport, vlport;
      int timeout;
  {
      register struct cell *tc, *tcl=0;
      register afs_int32 i, newc=0, code=0;
      register struct afs_q *cq, *tq;
  
      AFS_STATCNT(afs_NewCell);
!     if (*acellHosts == 0)
  	/* need >= one host to gen cell # */
  	return EINVAL;
  
--- 371,391 ----
  } /*afs_GetCellByIndex*/
  
  
! afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport, timeout, aliasFor)
      int aflags;
      char *acellName;
      register afs_int32 *acellHosts;
      char *linkedcname;
      u_short fsport, vlport;
      int timeout;
+     char *aliasFor;
  {
      register struct cell *tc, *tcl=0;
      register afs_int32 i, newc=0, code=0;
      register struct afs_q *cq, *tq;
  
      AFS_STATCNT(afs_NewCell);
!     if (!(aflags & CAlias) && *acellHosts == 0)
  	/* need >= one host to gen cell # */
  	return EINVAL;
  
***************
*** 323,328 ****
--- 395,407 ----
      for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
  	tc = QTOC(cq); tq = QNext(cq);
  	if (afs_strcasecmp(tc->cellName, acellName) == 0) {
+ 	    /* if the cell we've found has the correct name but no timeout,
+ 	     * and we're called with a non-zero timeout, bail out:  never
+ 	     * override static configuration entries with AFSDB ones. */
+ 	    if (timeout && !tc->timeout) {
+ 		ReleaseWriteLock(&afs_xcell);
+ 		return 0;
+ 	    }
  	    /* we don't want to keep pinging old vlservers which were down,
  	     * since they don't matter any more.  It's easier to do this than
  	     * to remove the server from its various hash tables. */
***************
*** 387,392 ****
--- 466,491 ----
      tc->timeout = timeout;
   
      memset((char *)tc->cellHosts, 0, sizeof(tc->cellHosts));
+     if (aflags & CAlias) {
+ 	struct cell *tca = NULL;
+ 
+ 	if (!aliasFor) {
+ 	    code = EINVAL;
+ 	    goto bad;
+ 	}
+ 	for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
+ 	    tca = QTOC(cq); tq = QNext(cq);
+ 	    if (!afs_strcasecmp(tca->cellName, aliasFor))
+ 		break;
+ 	}
+ 	if (!tca) {
+ 	    code = ENOENT;
+ 	    goto bad;
+ 	}
+ 	tc->alias = tca;
+ 	goto done;
+     }
+ 
      for (i=0; i<MAXCELLHOSTS; i++) {
          struct server *ts;
  	afs_uint32 temp = acellHosts[i];
***************
*** 398,403 ****
--- 497,503 ----
  	afs_PutServer(ts, WRITE_LOCK);
      }
      afs_SortServers(tc->cellHosts, MAXCELLHOSTS);	/* randomize servers */
+ done:
      ReleaseWriteLock(&afs_xcell);
      return 0;
  bad:
Index: openafs/src/afs/afs_daemons.c
diff -c openafs/src/afs/afs_daemons.c:1.7 openafs/src/afs/afs_daemons.c:1.7.2.1
*** openafs/src/afs/afs_daemons.c:1.7	Tue Aug  7 20:03:28 2001
--- openafs/src/afs/afs_daemons.c	Sat Oct 13 00:20:23 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_daemons.c,v 1.7 2001/08/08 00:03:28 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_daemons.c,v 1.7.2.1 2001/10/13 04:20:23 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 268,273 ****
--- 268,274 ----
  afs_CheckRootVolume () {
      char rootVolName[32];
      register struct volume *tvp;
+     int usingDynroot = afs_GetDynrootEnable();
  
      AFS_STATCNT(afs_CheckRootVolume);
      if (*afs_rootVolumeName == 0) {
***************
*** 276,282 ****
      else {
  	strcpy(rootVolName, afs_rootVolumeName);
      }
!     tvp = afs_GetVolumeByName(rootVolName, LOCALCELL, 1, (struct vrequest *) 0, READ_LOCK);
      if (!tvp) {
  	char buf[128];
  	int len = strlen(rootVolName);
--- 277,288 ----
      else {
  	strcpy(rootVolName, afs_rootVolumeName);
      }
!     if (usingDynroot) {
! 	afs_GetDynrootFid(&afs_rootFid);
! 	tvp = afs_GetVolume(&afs_rootFid, (struct vrequest *) 0, READ_LOCK);
!     } else {
! 	tvp = afs_GetVolumeByName(rootVolName, LOCALCELL, 1, (struct vrequest *) 0, READ_LOCK);
!     }
      if (!tvp) {
  	char buf[128];
  	int len = strlen(rootVolName);
***************
*** 288,310 ****
  	}
      }
      if (tvp) {
! 	int volid = (tvp->roVol? tvp->roVol : tvp->volume);
! 	afs_rootFid.Cell = LOCALCELL;
! 	if (afs_rootFid.Fid.Volume && afs_rootFid.Fid.Volume != volid
! 	    && afs_globalVp) {
! 	    /* If we had a root fid before and it changed location we reset
! 	     * the afs_globalVp so that it will be reevaluated.
! 	     * Just decrement the reference count. This only occurs during
! 	     * initial cell setup and can panic the machine if we set the
! 	     * count to zero and fs checkv is executed when the current
! 	     * directory is /afs.
! 	     */
! 	    AFS_FAST_RELE(afs_globalVp);
! 	    afs_globalVp = 0;
! 	}
! 	afs_rootFid.Fid.Volume = volid;
! 	afs_rootFid.Fid.Vnode = 1;
! 	afs_rootFid.Fid.Unique = 1;
  	afs_initState = 300;    /* won */
  	afs_osi_Wakeup(&afs_initState);
  	afs_PutVolume(tvp, READ_LOCK);
--- 294,318 ----
  	}
      }
      if (tvp) {
! 	if (!usingDynroot) {
! 	    int volid = (tvp->roVol? tvp->roVol : tvp->volume);
! 	    afs_rootFid.Cell = LOCALCELL;
! 	    if (afs_rootFid.Fid.Volume && afs_rootFid.Fid.Volume != volid
! 		&& afs_globalVp) {
! 		/* If we had a root fid before and it changed location we reset
! 		 * the afs_globalVp so that it will be reevaluated.
! 		 * Just decrement the reference count. This only occurs during
! 		 * initial cell setup and can panic the machine if we set the
! 		 * count to zero and fs checkv is executed when the current
! 		 * directory is /afs.
! 		 */
! 		AFS_FAST_RELE(afs_globalVp);
! 		afs_globalVp = 0;
! 	    }
! 	    afs_rootFid.Fid.Volume = volid;
! 	    afs_rootFid.Fid.Vnode = 1;
! 	    afs_rootFid.Fid.Unique = 1;
! 	}
  	afs_initState = 300;    /* won */
  	afs_osi_Wakeup(&afs_initState);
  	afs_PutVolume(tvp, READ_LOCK);
Index: openafs/src/afs/afs_dcache.c
diff -c openafs/src/afs/afs_dcache.c:1.10 openafs/src/afs/afs_dcache.c:1.10.2.1
*** openafs/src/afs/afs_dcache.c:1.10	Tue Aug  7 20:03:28 2001
--- openafs/src/afs/afs_dcache.c	Sat Oct 13 00:20:23 2001
***************
*** 13,19 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_dcache.c,v 1.10 2001/08/08 00:03:28 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
--- 13,19 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_dcache.c,v 1.10.2.1 2001/10/13 04:20:23 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
***************
*** 218,223 ****
--- 218,234 ----
      int CTD_nSleeps;
  } CTD_stats;
  
+ void afs_MaybeWakeupTruncateDaemon() {
+     if (!afs_CacheTooFull && afs_CacheIsTooFull()) {
+ 	afs_CacheTooFull = 1;
+ 	if (!afs_TruncateDaemonRunning)
+ 	    afs_osi_Wakeup((char *)afs_CacheTruncateDaemon);
+     } else if (!afs_TruncateDaemonRunning &&
+ 	       afs_blocksDiscarded > CM_MAXDISCARDEDCHUNKS) {
+ 	afs_osi_Wakeup((char *)afs_CacheTruncateDaemon);
+     }
+ }
+ 
  u_int afs_min_cache = 0;
  void afs_CacheTruncateDaemon() {
      osi_timeval_t CTD_tmpTime;
***************
*** 294,300 ****
--- 305,315 ----
  	    afs_stats_AddTo(CTD_stats.CTD_sleepTime, CTD_tmpTime);
  	}
  	if (afs_termState == AFSOP_STOP_TRUNCDAEMON) {
+ #ifdef AFS_AFSDB_ENV
+ 	    afs_termState = AFSOP_STOP_AFSDB;
+ #else
  	    afs_termState = AFSOP_STOP_RXEVENT;
+ #endif
  	    afs_osi_Wakeup(&afs_termState);
  	    break;
  	}
***************
*** 1432,1449 ****
  
  /* these fields are protected by the lock on the vcache and luck 
   * on the dcache */
! #define updateV2DC(l,v,d,src) { \
!     if (!l || 0 == NBObtainWriteLock(&((v)->lock),src)) { \
! 	if (hsame((v)->m.DataVersion, (d)->f.versionNo) && (v)->callback) { \
! 	    (v)->quick.dc = (d);                                          \
! 	    (v)->quick.stamp = (d)->stamp = MakeStamp();                  \
! 	    (v)->quick.minLoc = AFS_CHUNKTOBASE((d)->f.chunk);            \
! 	    /* Don't think I need these next two lines forever */         \
! 	    (v)->quick.len = (d)->f.chunkBytes;                           \
! 	    (v)->h1.dchint = (d);                                         \
! 	}                                                                 \
! 	if(l) ReleaseWriteLock(&((v)->lock));                             \
!     } }
  
  struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags)
      register struct vcache *avc;    /*Held*/
--- 1447,1465 ----
  
  /* these fields are protected by the lock on the vcache and luck 
   * on the dcache */
! void updateV2DC(int l, struct vcache *v, struct dcache *d, int src) {
!     if (!l || 0 == NBObtainWriteLock(&(v->lock),src)) {
! 	if (hsame(v->m.DataVersion, d->f.versionNo) && v->callback) {
! 	    v->quick.dc = d;
! 	    v->quick.stamp = d->stamp = MakeStamp();
! 	    v->quick.minLoc = AFS_CHUNKTOBASE(d->f.chunk);
! 	    /* Don't think I need these next two lines forever */
! 	    v->quick.len = d->f.chunkBytes;
! 	    v->h1.dchint = d;
! 	}
! 	if(l) ReleaseWriteLock(&((v)->lock));
!     }
! }
  
  struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags)
      register struct vcache *avc;    /*Held*/
***************
*** 1769,1775 ****
  
  	/* Watch for standard race condition */
  	if (hsame(avc->m.DataVersion, tdc->f.versionNo)) {
! 	  updateV2DC(0,avc,tdc,569);          /* set hint */
  	    if (setLocks) ReleaseWriteLock(&avc->lock);
  	    afs_stats_cmperf.dcacheHits++;
  	    goto done;
--- 1785,1791 ----
  
  	/* Watch for standard race condition */
  	if (hsame(avc->m.DataVersion, tdc->f.versionNo)) {
! 	    updateV2DC(0,avc,tdc,569);          /* set hint */
  	    if (setLocks) ReleaseWriteLock(&avc->lock);
  	    afs_stats_cmperf.dcacheHits++;
  	    goto done;
***************
*** 1864,1869 ****
--- 1880,1914 ----
          afs_stats_cmperf.dcacheMisses++; 
  	afs_Trace3(afs_iclSetp, CM_TRACE_FETCHPROC, ICL_TYPE_POINTER, avc,
  		   ICL_TYPE_INT32, Position, ICL_TYPE_INT32, size);
+ 
+ 	/*
+ 	 * Dynamic root support:  fetch data from local memory.
+ 	 */
+ 	if (afs_IsDynroot(avc)) {
+ 	    char *dynrootDir;
+ 	    int dynrootLen;
+ 
+ 	    afs_GetDynroot(&dynrootDir, &dynrootLen, &tsmall->OutStatus);
+ 
+ 	    dynrootDir += Position;
+ 	    dynrootLen -= Position;
+ 	    if (size > dynrootLen)
+ 		size = dynrootLen;
+ 	    if (size < 0) size = 0;
+ 	    code = afs_osi_Write(file, -1, dynrootDir, size);
+ 	    afs_PutDynroot();
+ 
+ 	    if (code == size)
+ 		code = 0;
+ 	    else
+ 		code = -1;
+ 
+ 	    tdc->validPos = Position + size;
+ 	    afs_CFileTruncate(file, size); /* prune it */
+ 	} else
+ 	/*
+ 	 * Not a dynamic vnode:  do the real fetch.
+ 	 */
  	do {
  	    tc = afs_Conn(&avc->fid, areq, SHARED_LOCK);
  	    if (tc) {
Index: openafs/src/afs/afs_dynroot.c
diff -c /dev/null openafs/src/afs/afs_dynroot.c:1.1.2.2
*** /dev/null	Wed Nov 21 01:54:10 2001
--- openafs/src/afs/afs_dynroot.c	Wed Nov 14 22:31:23 2001
***************
*** 0 ****
--- 1,464 ----
+ /*
+  * 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
+  */
+ 
+ /*
+  * Dynamic /afs volume support.
+  *
+  * Implements:
+  * afs_IsDynrootFid
+  * afs_GetDynrootFid
+  * afs_IsDynroot
+  * afs_RefreshDynroot
+  * afs_GetDynroot
+  * afs_PutDynroot
+  * afs_DynrootNewVnode
+  * afs_SetDynrootEnable
+  * afs_GetDynrootEnable
+  *
+  */
+ 
+ #include <afsconfig.h>
+ #include "../afs/param.h"
+ 
+ #include "../afs/stds.h"
+ #include "../afs/sysincludes.h" /* Standard vendor system headers */
+ #include "../afs/afsincludes.h"
+ #include "../afs/afs_osi.h"
+ #include "../afsint/afsint.h"
+ #include "../afs/lock.h"
+ 
+ #include "../afs/prs_fs.h"
+ #include "../afs/dir.h"
+ 
+ #define AFS_DYNROOT_CELL	1
+ #define AFS_DYNROOT_VOLUME	1
+ #define AFS_DYNROOT_VNODE	1
+ #define AFS_DYNROOT_UNIQUE	1
+ 
+ #define VNUM2CIDX(vnum)		((vnum) >> 2)
+ #define VNUM2RW(vnum)		(((vnum) >> 1) & 1)
+ #define CIDXRW2VNUM(cidx, rw)	(((cidx) << 2) | ((rw) << 1))
+ 
+ static int afs_dynrootEnable = 0;
+ 
+ static afs_rwlock_t afs_dynrootDirLock;
+ /* Start of variables protected by afs_dynrootDirLock */
+ static char *afs_dynrootDir = NULL;
+ static int afs_dynrootDirLen;
+ static int afs_dynrootDirLinkcnt;
+ static int afs_dynrootCellCount;
+ static int afs_dynrootVersion = 1;
+ static int afs_dynrootVersionHigh = 1;
+ /* End of variables protected by afs_dynrootDirLock */
+ 
+ extern afs_int32 afs_cellindex;
+ extern afs_rwlock_t afs_xvcache;
+ 
+ /*
+  * Returns non-zero iff fid corresponds to the top of the dynroot volume.
+  */
+ int
+ afs_IsDynrootFid(struct VenusFid *fid)
+ {
+     return
+ 	(afs_dynrootEnable &&
+ 	 fid->Cell       == AFS_DYNROOT_CELL   &&
+ 	 fid->Fid.Volume == AFS_DYNROOT_VOLUME &&
+ 	 fid->Fid.Vnode  == AFS_DYNROOT_VNODE  &&
+ 	 fid->Fid.Unique == AFS_DYNROOT_UNIQUE);
+ }
+ 
+ /*
+  * Obtain the magic dynroot volume Fid.
+  */
+ void
+ afs_GetDynrootFid(struct VenusFid *fid) 
+ {
+     fid->Cell       = AFS_DYNROOT_CELL;
+     fid->Fid.Volume = AFS_DYNROOT_VOLUME;
+     fid->Fid.Vnode  = AFS_DYNROOT_VNODE;
+     fid->Fid.Unique = AFS_DYNROOT_UNIQUE;
+ }
+ 
+ /*
+  * Returns non-zero iff avc is a pointer to the dynroot /afs vnode.
+  */
+ int
+ afs_IsDynroot(avc)
+     struct vcache *avc;
+ {
+     return afs_IsDynrootFid(&avc->fid);
+ }
+ 
+ /*
+  * Add directory entry by given name to a directory.  Assumes the
+  * caller has allocated the directory to be large enough to hold
+  * the necessary entry.
+  */
+ static void
+ afs_dynroot_addDirEnt(dirHeader, curPageP, curChunkP, name, vnode)
+     struct DirHeader *dirHeader;
+     int *curPageP;
+     int *curChunkP;
+     char *name;
+     int vnode;
+ {
+     char *dirBase = (char *) dirHeader;
+     struct PageHeader *pageHeader;
+     struct DirEntry *dirEntry;
+     int sizeOfEntry, i, t1, t2;
+     int curPage = *curPageP;
+     int curChunk = *curChunkP;
+     int didNewPage = 0;
+ 
+     /*
+      * Check if we need to flip pages..  If so, init the new page.
+      */
+     sizeOfEntry = afs_dir_NameBlobs(name);
+     if (curChunk + sizeOfEntry > EPP) {
+ 	curPage++;
+ 	curChunk = 1;
+ 	didNewPage = 1;
+     }
+ 
+     pageHeader = (struct PageHeader *) (dirBase + curPage * AFS_PAGESIZE);
+     if (didNewPage) {
+ 	pageHeader->pgcount = 0;
+ 	pageHeader->tag = htons(1234);
+ 	pageHeader->freecount = 0;
+ 	pageHeader->freebitmap[0] = 0x01;
+ 	for (i = 1; i < EPP/8; i++)
+ 	    pageHeader->freebitmap[i] = 0;
+ 
+ 	dirHeader->alloMap[curPage] = EPP - 1;
+     }
+ 
+     dirEntry = (struct DirEntry *) (pageHeader + curChunk);
+     dirEntry->flag        = 1;
+     dirEntry->length      = 0;
+     dirEntry->next        = 0;
+     dirEntry->fid.vnode   = htonl(vnode);
+     dirEntry->fid.vunique = htonl(1);
+     strcpy(dirEntry->name, name);
+ 
+     for (i = curChunk; i < curChunk + sizeOfEntry; i++) {
+ 	t1 = i / 8;
+ 	t2 = i % 8;
+ 	pageHeader->freebitmap[t1] |= (1 << t2);
+     }
+ 
+     /*
+      * Add the new entry to the correct hash chain.
+      */
+     i = DirHash(name);
+     dirEntry->next = dirHeader->hashTable[i];
+     dirHeader->hashTable[i] = htons(curPage * EPP + curChunk);
+ 
+     curChunk += sizeOfEntry;
+     dirHeader->alloMap[curPage] -= sizeOfEntry;
+ 
+     *curPageP = curPage;
+     *curChunkP = curChunk;
+ }
+ 
+ /*
+  * Regenerates the dynroot contents from the current list of
+  * cells.  Useful when the list of cells has changed due to
+  * an AFSDB lookup, for instance.
+  */
+ void
+ afs_RefreshDynroot()
+ {
+     int cellidx, maxcellidx, i;
+     struct cell *c;
+     int curChunk, curPage;
+     int dirSize;
+     char *newDir, *dotCell;
+     struct DirHeader *dirHeader;
+     struct PageHeader *pageHeader;
+     struct DirEntry *dirEntry;
+     int doFlush = 0;
+     int linkCount = 0;
+ 
+     /*
+      * Save afs_cellindex here, in case it changes between the
+      * two loops.
+      */
+     maxcellidx = afs_cellindex;
+ 
+     /*
+      * Compute the amount of space we need for the fake dir
+      */
+     curChunk = 13;
+     curPage = 0;
+ 
+     for (cellidx = 0; cellidx < maxcellidx; cellidx++) {
+ 	int sizeOfCurEntry;
+ 
+ 	c = afs_GetCellByIndex(cellidx, READ_LOCK);
+ 	if (!c) continue;
+ 
+ 	sizeOfCurEntry = afs_dir_NameBlobs(c->cellName);
+ 	if (curChunk + sizeOfCurEntry > EPP) {
+ 	    curPage++;
+ 	    curChunk = 1;
+ 	}
+ 	curChunk += sizeOfCurEntry;
+ 
+ 	dotCell = afs_osi_Alloc(strlen(c->cellName) + 2);
+ 	strcpy(dotCell, ".");
+ 	strcat(dotCell, c->cellName);
+ 	sizeOfCurEntry = afs_dir_NameBlobs(dotCell);
+ 	if (curChunk + sizeOfCurEntry > EPP) {
+ 	    curPage++;
+ 	    curChunk = 1;
+ 	}
+ 	curChunk += sizeOfCurEntry;
+ 
+ 	afs_PutCell(c, READ_LOCK);
+     }
+ 
+     dirSize = (curPage + 1) * AFS_PAGESIZE;
+     newDir = afs_osi_Alloc(dirSize);
+ 
+     /*
+      * Now actually construct the directory.
+      */
+     curChunk = 13;
+     curPage = 0;
+     dirHeader = (struct DirHeader *) newDir;
+ 
+     dirHeader->header.pgcount = 0;
+     dirHeader->header.tag = htons(1234);
+     dirHeader->header.freecount = 0;
+ 
+     dirHeader->header.freebitmap[0] = 0xff;
+     dirHeader->header.freebitmap[1] = 0x1f;
+     for (i = 2; i < EPP/8; i++)
+ 	dirHeader->header.freebitmap[i] = 0;
+     dirHeader->alloMap[0] = EPP - DHE - 1;
+     for (i = 1; i < MAXPAGES; i++)
+ 	dirHeader->alloMap[i] = EPP;
+     for (i = 0; i < NHASHENT; i++)
+ 	dirHeader->hashTable[i] = 0;
+ 
+     /* Install "." and ".." */
+     afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ".", 1);
+     afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, "..", 1);
+     linkCount += 2;
+ 
+     /* Reserve space for "." and ".." */
+     curChunk += 2;
+ 
+     for (cellidx = 0; cellidx < maxcellidx; cellidx++) {
+ 	c = afs_GetCellByIndex(cellidx, READ_LOCK);
+ 	afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
+ 			      c->cellName, CIDXRW2VNUM(cellidx, 0));
+ 
+ 	dotCell = afs_osi_Alloc(strlen(c->cellName) + 2);
+ 	strcpy(dotCell, ".");
+ 	strcat(dotCell, c->cellName);
+ 	afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
+ 			      dotCell, CIDXRW2VNUM(cellidx, 1));
+ 
+ 	linkCount += 2;
+ 
+ 	afs_PutCell(c, READ_LOCK);
+     }
+ 
+     ObtainWriteLock(&afs_dynrootDirLock, 549);
+     if (afs_dynrootDir) afs_osi_Free(afs_dynrootDir, afs_dynrootDirLen);
+     afs_dynrootDir = newDir;
+     afs_dynrootDirLen = dirSize;
+     afs_dynrootDirLinkcnt = linkCount;
+     if (afs_dynrootCellCount != maxcellidx) {
+ 	/*
+ 	 * New cells added -- bump data version, invalidate vcache.
+ 	 */
+ 	afs_dynrootCellCount = maxcellidx;
+ 	afs_dynrootVersion++;
+ 	afs_dynrootVersionHigh = osi_Time();
+ 	doFlush = 1;
+     }
+     ReleaseWriteLock(&afs_dynrootDirLock);
+ 
+     if (doFlush) {
+ 	afs_int32 retry;
+ 	struct vcache *tvc;
+ 	struct VenusFid tfid;
+ 
+ 	afs_GetDynrootFid(&tfid);
+ 	do {
+ 	    retry = 0;
+ 	    ObtainReadLock(&afs_xvcache);
+ 	    tvc = afs_FindVCache(&tfid, 0, 0, &retry, 0);
+ 	    ReleaseReadLock(&afs_xvcache);
+ 	} while (retry);
+ 	if (tvc) {
+ 	    tvc->states &= ~(CStatd | CUnique);
+ 	    osi_dnlc_purgedp(tvc);
+ 	    afs_PutVCache(tvc);
+ 	}
+     }
+ }
+ 
+ /*
+  * Returns a pointer to the base of the dynroot directory in memory,
+  * length thereof, and a FetchStatus.
+  */
+ void
+ afs_GetDynroot(dynrootDir, dynrootLen, status)
+     char **dynrootDir;
+     int *dynrootLen;
+     struct AFSFetchStatus *status;
+ {
+     ObtainReadLock(&afs_dynrootDirLock);
+     if (!afs_dynrootDir) {
+ 	ReleaseReadLock(&afs_dynrootDirLock);
+ 	afs_RefreshDynroot();
+ 	ObtainReadLock(&afs_dynrootDirLock);
+     }
+ 
+     if (dynrootDir) *dynrootDir = afs_dynrootDir;
+     if (dynrootLen) *dynrootLen = afs_dynrootDirLen;
+ 
+     if (status) {
+ 	memset(status, 0, sizeof(struct AFSFetchStatus));
+ 	status->FileType        = Directory;
+ 	status->LinkCount       = afs_dynrootDirLinkcnt;
+ 	status->Length          = afs_dynrootDirLen;
+ 	status->DataVersion     = afs_dynrootVersion;
+ 	status->CallerAccess    = PRSFS_LOOKUP | PRSFS_READ;
+ 	status->AnonymousAccess = PRSFS_LOOKUP | PRSFS_READ;
+ 	status->UnixModeBits    = 0755;
+ 	status->ParentVnode     = 1;
+ 	status->ParentUnique    = 1;
+ 	status->dataVersionHigh = afs_dynrootVersionHigh;
+     }
+ }
+ 
+ /*
+  * Puts back the dynroot read lock.
+  */
+ void
+ afs_PutDynroot()
+ {
+     ReleaseReadLock(&afs_dynrootDirLock);
+ }
+ 
+ /*
+  * Inform dynroot that a new vnode is being created.  Return value
+  * is non-zero if this vnode is handled by dynroot, in which case
+  * FetchStatus will be filled in.
+  */
+ int
+ afs_DynrootNewVnode(avc, status)
+     struct vcache *avc;
+     struct AFSFetchStatus *status;
+ {
+     if (!afs_dynrootEnable) return 0;
+ 
+     if (afs_IsDynroot(avc)) {
+ 	afs_GetDynroot(0, 0, status);
+ 	afs_PutDynroot();
+ 	return 1;
+     }
+ 
+     /*
+      * Check if this is an entry under /afs, e.g. /afs/cellname.
+      */
+     if (avc->fid.Cell       == AFS_DYNROOT_CELL &&
+ 	avc->fid.Fid.Volume == AFS_DYNROOT_VOLUME) {
+ 
+ 	struct cell *c;
+ 	int namelen, linklen, cellidx, rw;
+ 
+ 	cellidx = VNUM2CIDX(avc->fid.Fid.Vnode);
+ 	rw = VNUM2RW(avc->fid.Fid.Vnode);
+ 
+ 	c = afs_GetCellByIndex(cellidx, READ_LOCK);
+ 	if (!c) {
+ 	    afs_warn("dynroot vnode inconsistency, can't find cell %d\n",
+ 		     cellidx);
+ 	    return 0;
+ 	}
+ 
+ 	memset(status, 0, sizeof(struct AFSFetchStatus));
+ 
+ 	if (c->states & CAlias) {
+ 	    /*
+ 	     * linkData needs to contain the name of the cell
+ 	     * we're aliasing for.
+ 	     */
+ 	    struct cell *tca = c->alias;
+ 
+ 	    if (!tca) {
+ 		afs_warn("dynroot: alias %s missing cell alias pointer\n",
+ 			 c->cellName);
+ 		linklen = 7;
+ 		avc->linkData = afs_osi_Alloc(linklen + 1);
+ 		strcpy(avc->linkData, "unknown");
+ 	    } else {
+ 		int namelen = strlen(tca->cellName);
+ 		linklen = rw + namelen;
+ 		avc->linkData = afs_osi_Alloc(linklen + 1);
+ 		strcpy(avc->linkData, rw ? "." : "");
+ 		strcat(avc->linkData, tca->cellName);
+ 	    }
+ 
+ 	    status->UnixModeBits = 0755;
+ 	} else {
+ 	    /*
+ 	     * linkData needs to contain "#cell:root.cell" or "%cell:root.cell"
+ 	     */
+ 	    namelen = strlen(c->cellName);
+ 	    linklen = 1 + namelen + 10;
+ 	    avc->linkData = afs_osi_Alloc(linklen + 1);
+ 	    strcpy(avc->linkData, rw ? "%" : "#");
+ 	    strcat(avc->linkData, c->cellName);
+ 	    strcat(avc->linkData, ":root.cell");
+ 
+ 	    status->UnixModeBits = 0644;
+ 	}
+ 
+ 	status->FileType        = SymbolicLink;
+ 	status->LinkCount       = 1;
+ 	status->Length          = linklen;
+ 	status->DataVersion     = 1;
+ 	status->CallerAccess    = PRSFS_LOOKUP | PRSFS_READ;
+ 	status->AnonymousAccess = PRSFS_LOOKUP | PRSFS_READ;
+ 	status->ParentVnode     = 1;
+ 	status->ParentUnique    = 1;
+ 
+ 	afs_PutCell(c, READ_LOCK);
+ 	return 1;
+     }
+ 
+     return 0;
+ }
+ 
+ /*
+  * Enable or disable dynroot.  Returns 0 if successful.
+  */
+ int
+ afs_SetDynrootEnable(enable)
+     int enable;
+ {
+     afs_dynrootEnable = enable;
+     return 0;
+ }
+ 
+ /*
+  * Check if dynroot support is enabled.
+  */
+ int
+ afs_GetDynrootEnable()
+ {
+     return afs_dynrootEnable;
+ }
Index: openafs/src/afs/afs_nfsdisp.c
diff -c /dev/null openafs/src/afs/afs_nfsdisp.c:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:10 2001
--- openafs/src/afs/afs_nfsdisp.c	Sat Oct 13 00:40:48 2001
***************
*** 0 ****
--- 1,863 ----
+ /*
+  * 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
+  */
+ 
+ /*
+  * Implements:
+  */
+ #include <afsconfig.h>
+ #include "../afs/param.h"
+ 
+ RCSID("$Header: /data/cvs/openafs/src/afs/afs_nfsdisp.c,v 1.1.2.1 2001/10/13 04:40:48 shadow Exp $");
+ 
+ #include "../afs/stds.h"
+ #include "../afs/sysincludes.h" /* Standard vendor system headers */
+ #if defined(AFS_SUN55_ENV) && !defined(AFS_NONFSTRANS) 
+ #include "../rpc/types.h"
+ #include "../rpc/auth.h"
+ #include "../rpc/auth_unix.h"
+ #include "../rpc/auth_des.h"
+ #include "../rpc/auth_kerb.h"
+ #include "../sys/tiuser.h"
+ #include "../rpc/xdr.h"
+ #include "../rpc/svc.h"
+ #include "../nfs/nfs.h"
+ #include "../nfs/export.h"
+ #include "../nfs/nfs_clnt.h"
+ #include "../nfs/nfs_acl.h"
+ #include "../afs/afsincludes.h"	
+ #include "../afs/afs_stats.h"   
+ #include "../afs/exporter.h"
+ 
+ static int xlatorinit_v2_done=0;
+ static int xlatorinit_v3_done=0;
+ 
+ extern int afs_nobody;
+ extern int afs_NFSRootOnly;
+ 
+ /* It's bigger than this, but we don't care about anything else */
+ struct rfs_disp_tbl {
+ 	void  (*dis_proc)();	
+ };
+ 
+ struct afs_nfs_disp_tbl {
+     void (*afs_proc)();
+     void (*orig_proc)();
+ };
+ 
+ struct afs_nfs2_resp {
+     nfsstat status;
+ };
+ 
+ #ifndef ACL2_NPROC
+ #define ACL2_NPROC	5
+ #endif
+ 
+ struct afs_nfs_disp_tbl afs_rfs_disp_tbl[RFS_NPROC];
+ struct afs_nfs_disp_tbl afs_acl_disp_tbl[ACL2_NPROC];
+ 
+ static int 
+ is_afs_fh(fhandle_t *fhp) {
+     if ((fhp->fh_fsid.val[0] == AFS_VFSMAGIC) &&
+ 	(fhp->fh_fsid.val[1] == AFS_VFSFSID)) 
+ 	return 1;
+     return 0;
+ }
+ 
+ afs_int32 
+ nfs2_to_afs_call(int which, caddr_t *args, fhandle_t **fhpp, fhandle_t **fh2pp)
+ {
+     struct vnode *vp;
+     fhandle_t *fhp1=0;
+     fhandle_t *fhp2=0;
+     int errorcode;
+ 
+     *fh2pp = (fhandle_t *)0;
+     switch (which) {
+ 	case RFS_GETATTR:
+         case RFS_READLINK:
+         case RFS_STATFS:
+ 	    fhp1 = (fhandle_t *)args;
+ 	    break;
+ 	case RFS_SETATTR: 
+ 	{
+ 	    struct nfssaargs *sargs = (struct nfssaargs *)args; 
+ 	    fhp1 = (fhandle_t *)&sargs->saa_fh;
+ 	    break;
+ 	} 
+         case RFS_LOOKUP: 
+ 	{
+ 	    struct nfsdiropargs *sargs = (struct nfsdiropargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->da_fhandle;
+ 	    break;
+ 	} 
+ 	case RFS_READ:
+ 	{
+ 	    struct nfsreadargs *sargs = (struct nfsreadargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->ra_fhandle;
+ 	    break;
+ 	} 
+         case RFS_WRITE: 
+ 	{
+ 	    struct nfswriteargs *sargs = (struct nfswriteargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->wa_fhandle;
+ 	    break;
+ 	} 
+         case RFS_CREATE: 
+ 	{
+ 	    struct nfscreatargs *sargs = (struct nfscreatargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->ca_da.da_fhandle;
+ 	    break;
+ 	} 
+         case RFS_REMOVE: 
+ 	{
+ 	    struct nfsdiropargs *sargs = (struct nfsdiropargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->da_fhandle;
+ 	    break;
+ 	}
+         case RFS_RENAME: 
+ 	{
+ 	    struct nfsrnmargs *sargs = (struct nfsrnmargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->rna_from.da_fhandle;
+ 	    fhp2 = (fhandle_t *)&sargs->rna_to.da_fhandle;
+ 	    break;
+ 	} 
+         case RFS_LINK: 
+ 	{
+ 	    struct nfslinkargs *sargs = (struct nfslinkargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->la_from;
+ 	    fhp2 = (fhandle_t *)&sargs->la_to.da_fhandle;
+ 	    break;
+ 	} 
+         case RFS_SYMLINK: 
+ 	{
+ 	    struct nfsslargs *sargs = (struct nfsslargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->sla_from.da_fhandle;
+ 	    break;
+ 	} 
+         case RFS_MKDIR: 
+ 	{
+ 	    struct nfscreatargs *sargs = (struct nfscreatargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->ca_da.da_fhandle;
+ 	    break;
+ 	} 
+         case RFS_RMDIR: 
+ 	{
+ 	    struct nfsdiropargs *sargs = (struct nfsdiropargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->da_fhandle;
+ 	    break;
+ 	} 
+         case RFS_READDIR: 
+ 	{
+ 	    struct nfsrddirargs *sargs = (struct nfsrddirargs *)args;
+ 	    fhp1 = (fhandle_t *)&sargs->rda_fh;
+ 	    break;
+ 	} 
+ 	default:
+ 	    return NULL;
+     }
+ 
+     /* Ok if arg 1 is in AFS or if 2 args and arg 2 is in AFS */
+     if (is_afs_fh(fhp1)) {
+ 	*fhpp = fhp1;
+ 	if (fhp2) 
+ 	    *fh2pp = fhp2;
+ 	return 1;	    
+     }
+     if (is_afs_fh(fhp2)) {
+ 	*fhpp = fhp1;
+ 	*fh2pp = fhp2;
+ 	return 1;	    
+     }
+     return NULL;
+ }
+ 
+ afs_int32 
+ acl2_to_afs_call(int which, caddr_t *args, fhandle_t **fhpp)
+ {
+     fhandle_t *fhp;
+ 
+     switch(which) {
+     case ACLPROC2_NULL:
+     {
+ 	return NULL;
+     }
+     case ACLPROC2_GETACL: 
+     {
+ 	struct GETACL2args *sargs = (struct GETACL2args *) args;
+ 	fhp = &sargs->fh;
+ 	break;
+     }
+     case ACLPROC2_SETACL: 
+     {
+ 	struct SETACL2args *sargs = (struct SETACL2args *) args;
+ 	fhp = &sargs->fh;
+ 	break;
+     }
+     case ACLPROC2_GETATTR: 
+     {
+ 	struct GETATTR2args *sargs = (struct GETATTR2args *) args;
+ 	fhp = &sargs->fh;
+ 	break;
+     }
+     case ACLPROC2_ACCESS: 
+     {
+ 	struct ACCESS2args *sargs = (struct ACCESS2args *) args;
+ 	fhp = &sargs->fh;
+ 	break;
+     }
+     default:
+ 	return NULL;
+     }
+ 
+     if (is_afs_fh(fhp)) {
+ 	*fhpp = fhp;
+ 	return 1;
+     }
+ 
+     return NULL;
+ }
+ 
+ int
+ afs_nfs2_dispatcher(int type, afs_int32 which, char *argp, 
+ 		    struct exportinfo **expp, 
+ 		    struct svc_req *rp, struct AFS_UCRED *crp)
+ {
+     afs_int32 call = 0;
+     afs_int32 code = 0;
+     afs_int32 client = 0;
+     struct sockaddr *sa;
+     fhandle_t *fh = (fhandle_t *)argp;
+     fhandle_t *fh2 = (fhandle_t *)0;
+ 
+     if (!xlatorinit_v2_done)
+ 	return 2;
+ 
+     sa = (struct sockaddr *)svc_getrpccaller(rp->rq_xprt)->buf;
+     client = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
+ 
+     AFS_GLOCK();
+     code = 0;
+     switch (type) {
+     case 0:
+ 	code = nfs2_to_afs_call(which, argp, &fh, &fh2);
+ 	break;
+     case 1:
+ 	code = acl2_to_afs_call(which, argp, &fh);
+ 	break;
+     default:
+ 	break;
+     }
+ 
+     if (code) {
+ 	struct afs_exporter *out = 0;
+ 	afs_int32 dummy;
+ 	static int once = 0;
+ 	struct SmallFid Sfid;
+ 
+ 	memcpy((char *)&Sfid, fh->fh_data, SIZEOF_SMALLFID);
+ 
+ 	/* We ran */
+ 	call = 1;
+ 	if (!once && *expp) {
+ 	    afs_nobody = (*expp)->exi_export.ex_anon;
+ 	    once = 1;
+ 	}
+ 	code = afs_nfsclient_reqhandler((struct afs_exporter *)0, &crp,
+ 					client, &dummy, &out);
+ 	/* Be careful to release this */
+ 	if (!code && out)
+ 	    EXP_RELE(out);
+ 
+ 	/* We ran and failed */
+ 	if (code == EINVAL) 
+ 	    call = 2;
+     }
+ 
+     AFS_GUNLOCK();
+     return call;
+ }
+ 
+ void 
+ afs_nfs2_smallfidder(struct nfsdiropres *dr)
+ {
+     register fhandle_t *fhp = (fhandle_t *)&dr->dr_fhandle;
+     afs_int32 addr[2];
+     struct vcache *vcp;
+ 
+ #if defined(AFS_SUN57_64BIT_ENV)
+     /* See also afs_fid() */    
+     memcpy((char *)addr, fhp->fh_data, 10);
+     addr[1] = (addr[1] >> 48) & 0xffff;
+ #else 
+     memcpy((char *)addr, fhp->fh_data, 2 * sizeof(long));
+ #endif
+ 
+     AFS_GLOCK();
+     vcp = (struct vcache *)addr[0];
+ 
+     /* See also afs_osi_vget */
+     if (addr[1] == AFS_XLATOR_MAGIC)
+     {
+ 	if (dr->dr_status == NFS_OK) {
+ 	    struct SmallFid Sfid;
+ 	    struct cell *tcell;
+ 
+ 	    /* Make up and copy out a SmallFid */
+ 	    tcell = afs_GetCell(vcp->fid.Cell, READ_LOCK);
+ 	    Sfid.Volume = vcp->fid.Fid.Volume;
+ 	    Sfid.CellAndUnique = ((tcell->cellIndex << 24) |
+ 				  (vcp->fid.Fid.Unique & 0xffffff));
+ 	    afs_PutCell(tcell, READ_LOCK);
+ 	    Sfid.Vnode = (u_short)(vcp->fid.Fid.Vnode & 0xffff);
+ 	    fhp->fh_len = SIZEOF_SMALLFID;
+ 	    memcpy(dr->dr_fhandle.fh_data, (char*)&Sfid, fhp->fh_len);
+ 	}
+ 
+ 	/* If we have a ref, release it */
+ 	if (vcp->vrefCount >= 1) 
+ 	    AFS_RELE((struct vnode *) vcp);
+     } 
+     AFS_GUNLOCK();
+ }
+ 
+ void
+ afs_nfs2_noaccess(struct afs_nfs2_resp *resp)
+ {
+     r->status = NFSERR_ACCES;
+ }
+ 
+ void afs_nfs2_null(char *args, char *xp, char *exp, char *rp, char *crp)
+ {
+ }
+ 
+ void 
+ afs_nfs2_root(char *args, char *xp, char *exp, char *rp, char *crp)
+ {
+ }
+ 
+ void 
+ afs_nfs2_writecache(char *args, char *xp, char *exp, char *rp, char *crp)
+ {
+ }
+ 
+ #define NFS_V2_REQ(FUNCNAME, RFSOP, POST) \
+ void FUNCNAME(char *args, char *xp, char *exp, char *rp, char *crp) { \
+     u_int call; \
+     struct cred *svcred = curthread->t_cred; \
+     curthread->t_cred = (struct cred*)crp; \
+     call=afs_nfs2_dispatcher(0, RFSOP, (char *)args, &exp, rp, crp); \
+     if (call>1) afs_nfs2_noaccess((struct afs_nfs2_resp *)xp); \
+     else { (*afs_rfs_disp_tbl[RFSOP].orig_proc)(args, xp, exp, rp, crp); \
+     if (POST && afs_NFSRootOnly && call) afs_nfs2_smallfidder(xp); } \
+     curthread->t_cred = svcred; \
+     return; \
+ }
+ 
+ NFS_V2_REQ(afs_nfs2_getattr, RFS_GETATTR, 0) 
+ NFS_V2_REQ(afs_nfs2_setattr, RFS_SETATTR, 0)
+ NFS_V2_REQ(afs_nfs2_lookup, RFS_LOOKUP, 1)
+ NFS_V2_REQ(afs_nfs2_readlink, RFS_READLINK, 0);
+ NFS_V2_REQ(afs_nfs2_read, RFS_READ, 0);
+ NFS_V2_REQ(afs_nfs2_write, RFS_WRITE, 0);
+ NFS_V2_REQ(afs_nfs2_create, RFS_CREATE, 1);
+ NFS_V2_REQ(afs_nfs2_remove, RFS_REMOVE, 0);
+ NFS_V2_REQ(afs_nfs2_rename, RFS_RENAME, 0);
+ NFS_V2_REQ(afs_nfs2_link, RFS_LINK, 0);
+ NFS_V2_REQ(afs_nfs2_symlink, RFS_SYMLINK, 0);
+ NFS_V2_REQ(afs_nfs2_mkdir, RFS_MKDIR, 1);
+ NFS_V2_REQ(afs_nfs2_rmdir, RFS_RMDIR, 0);
+ NFS_V2_REQ(afs_nfs2_readdir, RFS_READDIR, 0);
+ NFS_V2_REQ(afs_nfs2_statfs, RFS_STATFS, 0);
+ 
+ struct afs_nfs_disp_tbl afs_rfs_disp_tbl[RFS_NPROC] = {
+     { afs_nfs2_null },
+     { afs_nfs2_getattr },
+     { afs_nfs2_setattr },
+     { afs_nfs2_root },
+     { afs_nfs2_lookup },
+     { afs_nfs2_readlink },
+     { afs_nfs2_read },
+     { afs_nfs2_writecache },	
+     { afs_nfs2_write },
+     { afs_nfs2_create },
+     { afs_nfs2_remove },	
+     { afs_nfs2_rename },
+     { afs_nfs2_link },	
+     { afs_nfs2_symlink },
+     { afs_nfs2_mkdir },
+     { afs_nfs2_rmdir },
+     { afs_nfs2_readdir },
+     { afs_nfs2_statfs }
+ };
+ 
+ #define ACL_V2_REQ(FUNCNAME, ACLOP) \
+ void FUNCNAME(char *args, char *xp, char *exp, char *rp, char *crp) { \
+     u_int call; \
+     struct cred *svcred = curthread->t_cred; \
+     curthread->t_cred = (struct cred*)crp; \
+     call=afs_nfs2_dispatcher(1, ACLOP, (char *)args, &exp, rp, crp); \
+     if (call>1) afs_nfs2_noaccess((struct afs_nfs2_resp *)xp); \
+     else (*afs_rfs_disp_tbl[ACLOP].orig_proc)(args, xp, exp, rp, crp); \
+     curthread->t_cred = svcred; \
+     return; \
+ }
+ 
+ ACL_V2_REQ(afs_acl2_getacl, ACLPROC2_GETACL)
+ ACL_V2_REQ(afs_acl2_setacl, ACLPROC2_SETACL)
+ ACL_V2_REQ(afs_acl2_getattr, ACLPROC2_GETATTR)
+ ACL_V2_REQ(afs_acl2_access, ACLPROC2_ACCESS)
+ 
+ struct afs_nfs_disp_tbl afs_acl_disp_tbl[ACL2_NPROC] = {
+     { afs_nfs2_null }, 
+     { afs_acl2_getacl }, 
+     { afs_acl2_setacl },
+     { afs_acl2_getattr }, 
+     { afs_acl2_access } 
+ };
+ 
+ /* Munge the dispatch tables to link us in first */
+ void 
+ afs_xlatorinit_v2(struct rfs_disp_tbl *_rfs_tbl, 
+ 		  struct rfs_disp_tbl *_acl_tbl)
+ {
+     int i;
+ 
+     if (xlatorinit_v2_done++) return;
+ 
+     for (i=0; i < RFS_NPROC; i++) {
+ 	afs_rfs_disp_tbl[i].orig_proc = _rfs_tbl[i].dis_proc;
+ 	_rfs_tbl[i].dis_proc = afs_rfs_disp_tbl[i].afs_proc;
+     }
+ 
+     for (i=0; i < ACL2_NPROC; i++) {
+ 	afs_acl_disp_tbl[i].orig_proc = _acl_tbl[i].dis_proc;
+ 	_acl_tbl[i].dis_proc = afs_acl_disp_tbl[i].afs_proc;
+     }
+ }
+ 
+ #ifndef RFS3_NPROC
+ #define RFS3_NPROC	22
+ #endif
+ 
+ #ifndef ACL3_NPROC
+ #define ACL3_NPROC	3
+ #endif
+ 
+ struct afs_nfs_disp_tbl afs_rfs3_disp_tbl[RFS3_NPROC];
+ struct afs_nfs_disp_tbl afs_acl3_disp_tbl[ACL3_NPROC];
+ 
+ struct afs_nfs3_resp {
+     nfsstat3 status;
+     bool_t flags; 
+ };
+ 
+ static int 
+ is_afs_fh3(nfs_fh3 *fhp) {
+     if ((fhp->fh3_fsid.val[0] == AFS_VFSMAGIC) &&
+ 	(fhp->fh3_fsid.val[1] == AFS_VFSFSID)) 
+ 	return 1;
+     return 0;
+ }
+ 
+ void
+ afs_nfs3_noaccess(struct afs_nfs3_resp *resp)
+ {
+     resp->status = NFS3ERR_ACCES;
+     resp->flags = FALSE;
+ }
+ 
+ afs_int32 
+ nfs3_to_afs_call(int which, caddr_t *args, nfs_fh3 **fhpp, nfs_fh3 **fh2pp)
+ {
+     struct vnode *vp;
+     nfs_fh3 *fhp1=0;
+     nfs_fh3 *fhp2=0;
+     int errorcode;
+ 
+     *fh2pp = (nfs_fh3 *)0;
+     switch (which) {
+         case NFSPROC3_GETATTR: 
+ 	{
+             GETATTR3args *arg = (GETATTR3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->object;
+             break;
+         } 
+         case NFSPROC3_SETATTR: 
+ 	{
+             SETATTR3args *arg = (SETATTR3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->object;
+             break;
+         } 
+         case NFSPROC3_LOOKUP: 
+ 	{
+             LOOKUP3args *arg = (LOOKUP3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->what.dir;
+             break;
+         } 
+         case NFSPROC3_ACCESS: 
+ 	{
+             ACCESS3args *arg = (ACCESS3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->object;
+             break;
+         } 
+         case NFSPROC3_READLINK: 
+ 	{
+             READLINK3args *arg = (READLINK3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->symlink;       
+             break;
+         } 
+         case NFSPROC3_READ: 
+ 	{
+             READ3args *arg = (READ3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->file;
+             break;
+         } 
+         case NFSPROC3_WRITE: 
+ 	{
+             WRITE3args *arg = (WRITE3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->file;
+             break;
+         } 
+         case NFSPROC3_CREATE: 
+ 	{
+             CREATE3args *arg = (CREATE3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->where.dir;
+             break;
+         } 
+         case NFSPROC3_MKDIR: 
+ 	{
+             MKDIR3args *arg = (MKDIR3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->where.dir;
+             break;
+         } 
+         case NFSPROC3_SYMLINK: 
+ 	{
+             SYMLINK3args *arg = (SYMLINK3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->where.dir;
+             break;
+         } 
+         case NFSPROC3_MKNOD:
+ 	{
+             MKNOD3args *arg = (MKNOD3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->where.dir;
+             break;
+         } 
+         case NFSPROC3_REMOVE: 
+ 	{
+             REMOVE3args *arg = (REMOVE3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->object.dir;
+             break;
+         } 
+         case NFSPROC3_RMDIR: 
+ 	{
+             RMDIR3args *arg = (RMDIR3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->object.dir;
+             break;
+         } 
+         case NFSPROC3_RENAME: 
+ 	{
+             RENAME3args *arg = (RENAME3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->from.dir;
+             fhp2 = (nfs_fh3 *) &arg->to.dir;
+             break;
+         } 
+         case NFSPROC3_LINK: 
+ 	{
+             LINK3args *arg = (LINK3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->file;
+             fhp2 = (nfs_fh3 *) &arg->link.dir;
+             break;
+         } 
+         case NFSPROC3_READDIR: 
+ 	{
+             READDIR3args *arg = (READDIR3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->dir;
+             break;
+         } 
+         case NFSPROC3_READDIRPLUS: 
+ 	{
+             READDIRPLUS3args *arg = (READDIRPLUS3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->dir;
+             break;
+         } 
+         case NFSPROC3_FSSTAT: 
+ 	{
+             FSSTAT3args *arg = (FSSTAT3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->fsroot;
+             break;
+         } 
+         case NFSPROC3_FSINFO: 
+ 	{
+             FSINFO3args *arg = (FSINFO3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->fsroot;
+             break;
+         } 
+         case NFSPROC3_PATHCONF: 
+ 	{
+             PATHCONF3args *arg = (PATHCONF3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->object;
+             break;
+         } 
+         case NFSPROC3_COMMIT: 
+ 	{
+             COMMIT3args *arg = (COMMIT3args *)args;
+             fhp1 = (nfs_fh3 *) &arg->file;
+             break;
+         }
+ 	default:
+ 	    return NULL;
+     }
+ 
+     /* Ok if arg 1 is in AFS or if 2 args and arg 2 is in AFS */
+     if (is_afs_fh3(fhp1)) {
+ 	*fhpp = fhp1;
+ 	if (fhp2) 
+ 	    *fh2pp = fhp2;
+ 	return 1;	    
+     }
+     if (is_afs_fh3(fhp2)) {
+ 	*fhpp = fhp1;
+ 	*fh2pp = fhp2;
+ 	return 1;	    
+     }
+     return NULL;
+ }
+ 
+ afs_int32 
+ acl2_to_afs_call(int which, caddr_t *args, nfs_fh3 **fhpp)
+ {
+     nfs_fh3 *fhp;
+ 
+     switch(which) {
+     case ACLPROC3_GETACL: 
+     {
+         struct GETACL3args *sargs = (struct GETACL3args *) args;
+         fhp = &sargs->fh;
+         break;
+     }
+     case ACLPROC3_SETACL: 
+     {
+         struct SETACL3args *sargs = (struct SETACL3args *) args;
+         fhp = &sargs->fh;
+         break;
+     }
+     default:
+ 	return NULL;
+     }
+ 
+     if (is_afs_fh3(fhp)) {
+ 	*fhpp = fhp;
+ 	return 1;
+     }
+ 
+     return NULL;
+ }
+ 
+ int
+ afs_nfs3_dispatcher(int type, afs_int32 which, char *argp, 
+ 		    struct exportinfo **expp, 
+ 		    struct svc_req *rp, struct AFS_UCRED *crp)
+ {
+     afs_int32 call = 0;
+     afs_int32 code = 0;
+     afs_int32 client = 0;
+     struct sockaddr *sa;
+     nfs_fh3 *fh = (nfs_fh3 *)argp;
+     nfs_fh3 *fh2 = (nfs_fh3 *)0;
+ 
+     if (!xlatorinit_v3_done)
+ 	return 2;
+ 
+     sa = (struct sockaddr *)svc_getrpccaller(rp->rq_xprt)->buf;
+     client = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
+ 
+     AFS_GLOCK();
+     code = 0;
+     switch (type) {
+     case 0:
+ 	code = nfs3_to_afs_call(which, argp, &fh, &fh2);
+ 	break;
+     case 1:
+ 	code = acl3_to_afs_call(which, argp, &fh);
+ 	break;
+     default:
+ 	break;
+     }
+ 
+     if (code) {
+ 	struct afs_exporter *out = 0;
+ 	afs_int32 dummy;
+ 	static int once = 0;
+ 	struct SmallFid Sfid;
+ 
+ 	memcpy((char *)&Sfid, fh->fh_data, SIZEOF_SMALLFID);
+ 
+ 	/* We ran */
+ 	call = 1;
+ 	if (!once && *expp) {
+ 	    afs_nobody = (*expp)->exi_export.ex_anon;
+ 	    once = 1;
+ 	}
+ 	code = afs_nfsclient_reqhandler((struct afs_exporter *)0, &crp,
+ 					client, &dummy, &out);
+ 	/* Be careful to release this */
+ 	if (!code && out)
+ 	    EXP_RELE(out);
+ 
+ 	/* We ran and failed */
+ 	if (code == EINVAL) 
+ 	    call = 2;
+     }
+ 
+     AFS_GUNLOCK();
+     return call;
+ }
+ 
+ void 
+ afs_nfs3_smallfidder(struct nfs_fh3 *fhp int status)
+ {
+     afs_int32 addr[2];
+     struct vcache *vcp;
+ 
+ #if defined(AFS_SUN57_64BIT_ENV)
+     /* See also afs_fid() */    
+     memcpy((char *)addr, fhp->fh3_data, 10);
+     addr[1] = (addr[1] >> 48) & 0xffff;
+ #else 
+     memcpy((char *)addr, fhp->fh3_data, 2 * sizeof(long));
+ #endif
+ 
+     AFS_GLOCK();
+     vcp = (struct vcache *)addr[0];
+ 
+     /* See also afs_osi_vget */
+     if (addr[1] == AFS_XLATOR_MAGIC)
+     {
+ 	if (status == NFS_OK) {
+ 	    struct SmallFid Sfid;
+ 	    struct cell *tcell;
+ 
+ 	    /* Make up and copy out a SmallFid */
+ 	    tcell = afs_GetCell(vcp->fid.Cell, READ_LOCK);
+ 	    Sfid.Volume = vcp->fid.Fid.Volume;
+ 	    Sfid.CellAndUnique = ((tcell->cellIndex << 24) |
+ 				  (vcp->fid.Fid.Unique & 0xffffff));
+ 	    afs_PutCell(tcell, READ_LOCK);
+ 	    Sfid.Vnode = (u_short)(vcp->fid.Fid.Vnode & 0xffff);
+ 	    fhp->fh3_len = SIZEOF_SMALLFID;
+ 	    memcpy(fhp->fh3_data, (char*)&Sfid, fhp->fh3_len);
+ 	}
+ 
+ 	/* If we have a ref, release it */
+ 	if (vcp->vrefCount >= 1) 
+ 	    AFS_RELE((struct vnode *) vcp);
+     } 
+     AFS_GUNLOCK();
+ }
+ 
+ #define NFS_V3_REQ(FUNCNAME, NFSOP, POST, RESP, RESPP) \
+ void FUNCNAME(char *args, char *xp, char *exp, char *rp, char *crp) { \
+     u_int call; \
+     struct cred *svcred = curthread->t_cred; \
+     curthread->t_cred = (struct cred*)crp; \
+     call=afs_nfs3_dispatcher(0, NFSOP, (char *)args, &exp, rp, crp); \
+     if (call>1) afs_nfs3_noaccess((struct afs_nfs3_resp *)xp); \
+     else { (*afs_rfs3_disp_tbl[NFSOP].orig_proc)(args, xp, exp, rp, crp); \
+     if (POST && afs_NFSRootOnly && call) { \
+     RESP *resp = ( RESP *)xp; \
+     afs_nfs3_smallfidder( RESPP , resp->status); } \
+     curthread->t_cred = svcred; \
+     return; \
+ }
+ 
+ NFS_V3_REQ(afs_nfs3_getattr, NFSPROC3_GETATTR, 0, x, x) 
+ NFS_V3_REQ(afs_nfs3_setattr, NFSPROC3_SETATTR, 0, x, x)
+ NFS_V3_REQ(afs_nfs3_lookup, NFSPROC3_LOOKUP, 1, LOOKUP3res, &resp->resok.object)
+ NFS_V3_REQ(afs_nfs3_access, NFSPROC3_ACCESS, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_readlink, NFSPROC3_READLINK, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_read, NFSPROC3_READ, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_write, NFSPROC3_WRITE, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_create, NFSPROC3_CREATE, 1, CREATE3res, &resp->resok.obj.handle);
+ NFS_V3_REQ(afs_nfs3_mkdir, NFSPROC3_MKDIR, 1, MKDIR3res, &resp->resok.obj.handle);
+ NFS_V3_REQ(afs_nfs3_symlink, NFSPROC3_SYMLINK, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_mknod, NFSPROC3_MKNOD, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_remove, NFSPROC3_REMOVE, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_rmdir, NFSPROC3_RMDIR, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_rename, NFSPROC3_RENAME, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_link, NFSPROC3_LINK, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_readdir, NFSPROC3_READDIR, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_readdirplus, NFSPROC3_READDIRPLUS, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_fsstat, NFSPROC3_FSSTAT, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_fsinfo, NFSPROC3_FSINFO, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_pathconf, NFSPROC3_PATHCONF, 0, x, x);
+ NFS_V3_REQ(afs_nfs3_commit, NFSPROC3_COMMIT, 0, x, x);
+ 
+ struct afs_nfs_disp_tbl afs_rfs3_disp_tbl[RFS_NPROC] = {
+     { afs_nfs2_null },
+     { afs_nfs3_getattr },
+     { afs_nfs3_setattr },
+     { afs_nfs3_lookup },
+     { afs_nfs3_access },
+     { afs_nfs3_readlink },
+     { afs_nfs3_read },
+     { afs_nfs3_write },
+     { afs_nfs3_create },
+     { afs_nfs3_mkdir },
+     { afs_nfs3_symlink },
+     { afs_nfs3_mknod },
+     { afs_nfs3_remove },        
+     { afs_nfs3_rmdir },
+     { afs_nfs3_rename },
+     { afs_nfs3_link },  
+     { afs_nfs3_readdir },
+     { afs_nfs3_readdirplus },
+     { afs_nfs3_fsstat },
+     { afs_nfs3_fsinfo },
+     { afs_nfs3_pathconf },
+     { afs_nfs3_commit }
+ };
+ 
+ #define ACL_V3_REQ(FUNCNAME, NFSOP) \
+ void FUNCNAME(char *args, char *xp, char *exp, char *rp, char *crp) { \
+     u_int call; \
+     struct cred *svcred = curthread->t_cred; \
+     curthread->t_cred = (struct cred*)crp; \
+     call=afs_nfs3_dispatcher(1, NFSOP, (char *)args, &exp, rp, crp); \
+     if (call>1) afs_nfs3_noaccess((struct afs_nfs3_resp *)xp); \
+     else (*afs_rfs3_disp_tbl[NFSOP].orig_proc)(args, xp, exp, rp, crp); \
+     curthread->t_cred = svcred; \
+     return; \
+ }
+ 
+ ACL_V3_REQ(afs_acl3_getacl, ACLPROC3_GETACL)
+ ACL_V3_REQ(afs_acl3_setacl, ACLPROC3_SETACL)
+ 
+ struct afs_nfs_disp_tbl afs_acl3_disp_tbl[ACL3_NPROC] = {
+     { afs_nfs2_null }, 
+     { afs_acl3_getacl }, 
+     { afs_acl3_setacl },
+ };
+ 
+ /* Munge the dispatch tables to link us in first */
+ void 
+ afs_xlatorinit_v3(struct rfs_disp_tbl *_rfs_tbl, 
+                   struct rfs_disp_tbl *_acl_tbl)
+ {
+     int i;
+ 
+     if (xlatorinit_v3_done++) return;
+ 
+     for (i=0; i < RFS3_NPROC; i++) {
+         afs_rfs3_disp_tbl[i].orig_proc = _rfs_tbl[i].dis_proc;
+         _rfs_tbl[i].dis_proc = afs_rfs3_disp_tbl[i].afs_proc;
+     }
+ 
+     for (i=0; i < ACL3_NPROC; i++) {
+         afs_acl3_disp_tbl[i].orig_proc = _acl_tbl[i].dis_proc;
+         _acl_tbl[i].dis_proc = afs_acl3_disp_tbl[i].afs_proc;
+     }
+ }
+ #endif /* !defined(AFS_NONFSTRANS)
Index: openafs/src/afs/afs_osi.c
diff -c openafs/src/afs/afs_osi.c:1.8 openafs/src/afs/afs_osi.c:1.8.2.1
*** openafs/src/afs/afs_osi.c:1.8	Tue Aug  7 20:03:28 2001
--- openafs/src/afs/afs_osi.c	Sat Nov 10 18:22:48 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_osi.c,v 1.8 2001/08/08 00:03:28 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_osi.c,v 1.8.2.1 2001/11/10 23:22:48 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 300,305 ****
--- 300,306 ----
      set_system_proc(u.u_procp);
  #else
  #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     /* maybe call init_process instead? */
      current_proc()->p_flag |= P_SYSTEM;
  #else
  #if !defined(AFS_SGI64_ENV) && !defined(AFS_LINUX20_ENV)
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.22 openafs/src/afs/afs_pioctl.c:1.22.2.1
*** openafs/src/afs/afs_pioctl.c:1.22	Tue Aug  7 20:03:28 2001
--- openafs/src/afs/afs_pioctl.c	Sat Oct 13 00:20:23 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_pioctl.c,v 1.22 2001/08/08 00:03:28 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_pioctl.c,v 1.22.2.1 2001/10/13 04:20:23 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 2295,2301 ****
      }
  
      linkedstate |= CNoSUID; /* setuid is disabled by default for fs newcell */
!     code = afs_NewCell(newcell, cellHosts, linkedstate, linkedcell, fsport, vlport, (int)0);
      return code;
  }
  
--- 2295,2301 ----
      }
  
      linkedstate |= CNoSUID; /* setuid is disabled by default for fs newcell */
!     code = afs_NewCell(newcell, cellHosts, linkedstate, linkedcell, fsport, vlport, (int)0, (char *) 0);
      return code;
  }
  
***************
*** 2560,2572 ****
      for(i = 0; i < VCSIZE; i++) {
  	for(tvc = afs_vhashT[i]; tvc; tvc=tvc->hnext) {
  	    if (tvc->fid.Fid.Volume == volume && tvc->fid.Cell == cell) {
! #if	defined(AFS_SGI_ENV) || defined(AFS_ALPHA_ENV)  || defined(AFS_SUN5_ENV)  || defined(AFS_HPUX_ENV)
  		VN_HOLD((struct vnode *)tvc);
  #else
  #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  		osi_vnhold(tvc, 0);
  #else
! 		tvc->vrefCount++;
  #endif
  #endif
  		ReleaseReadLock(&afs_xvcache);
--- 2560,2572 ----
      for(i = 0; i < VCSIZE; i++) {
  	for(tvc = afs_vhashT[i]; tvc; tvc=tvc->hnext) {
  	    if (tvc->fid.Fid.Volume == volume && tvc->fid.Cell == cell) {
! #if	defined(AFS_SGI_ENV) || defined(AFS_ALPHA_ENV)  || defined(AFS_SUN5_ENV)  || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV)
  		VN_HOLD((struct vnode *)tvc);
  #else
  #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  		osi_vnhold(tvc, 0);
  #else
! 		VREFCOUNT_INC(tvc);
  #endif
  #endif
  		ReleaseReadLock(&afs_xvcache);
Index: openafs/src/afs/afs_server.c
diff -c openafs/src/afs/afs_server.c:1.11 openafs/src/afs/afs_server.c:1.11.2.1
*** openafs/src/afs/afs_server.c:1.11	Thu Aug 23 13:26:43 2001
--- openafs/src/afs/afs_server.c	Sat Oct 13 00:20:24 2001
***************
*** 32,38 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_server.c,v 1.11 2001/08/23 17:26:43 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 32,38 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_server.c,v 1.11.2.1 2001/10/13 04:20:24 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 801,810 ****
      for (i=0; i<count; i++) {
         if (!aservers[i]) break;
         for (low=i,j=i+1; j<=count; j++) {
! 	  if (!aservers[j]) break;
! 	  if (aservers[j]->addr->sa_iprank < aservers[low]->addr->sa_iprank) {
! 	     low = j;
! 	  }
         }
         if (low != i) {
  	  ts = aservers[i]; 
--- 801,813 ----
      for (i=0; i<count; i++) {
         if (!aservers[i]) break;
         for (low=i,j=i+1; j<=count; j++) {
! 	   if ((!aservers[j]) || (!aservers[j]->addr)) 
! 	       break;
! 	   if ((!aservers[low]) || (!aservers[low]->addr))
! 	       break;
! 	   if (aservers[j]->addr->sa_iprank < aservers[low]->addr->sa_iprank) {
! 	       low = j;
! 	   }
         }
         if (low != i) {
  	  ts = aservers[i]; 
***************
*** 1084,1089 ****
--- 1087,1096 ----
  
      if (sa) sa->sa_iprank= 0;
      for (ill = (struct ill_s *)*addr /*ill_g_headp*/; ill; ill = ill->ill_next ) {
+ #ifdef AFS_SUN58_ENV
+ 	/* Make sure this is an IPv4 ILL */
+ 	if (ill->ill_isv6) continue;
+ #endif
  	for (ipif = ill->ill_ipif; ipif; ipif = ipif->ipif_next ) {
  	    subnet = ipif->ipif_local_addr & ipif->ipif_net_mask;
  	    subnetmask = ipif->ipif_net_mask;
Index: openafs/src/afs/afs_util.c
diff -c openafs/src/afs/afs_util.c:1.5 openafs/src/afs/afs_util.c:1.5.4.1
*** openafs/src/afs/afs_util.c:1.5	Thu Jul 12 15:58:15 2001
--- openafs/src/afs/afs_util.c	Sat Oct 13 00:20:24 2001
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_util.c,v 1.5 2001/07/12 19:58:15 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 15,21 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_util.c,v 1.5.4.1 2001/10/13 04:20:24 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 180,188 ****
  	for(i=0;i<VCSIZE;i++) {
  	    for(tvc = afs_vhashT[i]; tvc; tvc=tvc->hnext) {
  #ifdef	AFS_OSF_ENV
! 		if (tvc->vrefCount > 1)
  #else	/* AFS_OSF_ENV */
! 		if (tvc->vrefCount)
  #endif
  		    afs_warn("Stat cache entry at %x is held\n", tvc);
  		if (CheckLock(&tvc->lock))
--- 180,188 ----
  	for(i=0;i<VCSIZE;i++) {
  	    for(tvc = afs_vhashT[i]; tvc; tvc=tvc->hnext) {
  #ifdef	AFS_OSF_ENV
! 		if (VREFCOUNT(tvc) > 1)
  #else	/* AFS_OSF_ENV */
! 		if (VREFCOUNT(tvc))
  #endif
  		    afs_warn("Stat cache entry at %x is held\n", tvc);
  		if (CheckLock(&tvc->lock))
Index: openafs/src/afs/afs_vcache.c
diff -c openafs/src/afs/afs_vcache.c:1.9 openafs/src/afs/afs_vcache.c:1.9.2.1
*** openafs/src/afs/afs_vcache.c:1.9	Tue Aug  7 20:03:28 2001
--- openafs/src/afs/afs_vcache.c	Sat Oct 13 00:20:24 2001
***************
*** 38,44 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_vcache.c,v 1.9 2001/08/08 00:03:28 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
--- 38,44 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_vcache.c,v 1.9.2.1 2001/10/13 04:20:24 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
***************
*** 213,219 ****
      /* This should put it back on the vnode free list since usecount is 1 */
      afs_vcount--;
      vSetType(avc, VREG);
!     if (avc->vrefCount > 0) {
          VN_UNLOCK((struct vnode *)avc);
          AFS_RELE((struct vnode *)avc);
      } else {
--- 213,219 ----
      /* This should put it back on the vnode free list since usecount is 1 */
      afs_vcount--;
      vSetType(avc, VREG);
!     if (VREFCOUNT(avc) > 0) {
          VN_UNLOCK((struct vnode *)avc);
          AFS_RELE((struct vnode *)avc);
      } else {
***************
*** 568,573 ****
--- 568,577 ----
  	 int vmax = 2 * afs_cacheStats;
  	 int vn = VCACHE_FREE;
  
+          AFS_GUNLOCK();
+ 	 shrink_dcache_sb(afs_globalVFS);
+ 	 AFS_GLOCK();
+ 
  	 i = 0;
  	 for(tq = VLRU.prev; tq != &VLRU && vn > 0; tq = uq) {
  	    tvc = QTOV(tq);
***************
*** 582,588 ****
  	    if (tvc == afs_globalVp)
  		continue;
  
! 	    if ( tvc->vrefCount && tvc->opens == 0 ) {
  		struct inode *ip = (struct inode*)tvc;
  		if (list_empty(&ip->i_dentry)) {
  		    vn --;
--- 586,592 ----
  	    if (tvc == afs_globalVp)
  		continue;
  
! 	    if ( VREFCOUNT(tvc) && tvc->opens == 0 ) {
  		struct inode *ip = (struct inode*)tvc;
  		if (list_empty(&ip->i_dentry)) {
  		    vn --;
***************
*** 656,665 ****
  		 refpanic ("Exceeded pool of AFS vnodes(VLRU cycle?)");
  	    else if (QNext(uq) != tq)
  		 refpanic ("VLRU inconsistent");
! 	    else if (tvc->vrefCount < 1) 
  		 refpanic ("refcnt 0 on VLRU");
  
! 	    if ( tvc->vrefCount == 1   &&   tvc->opens == 0 
  		&& (tvc->states & CUnlinkedDel) == 0) {
  		code = afs_FlushVCache(tvc, &fv_slept);
  		if (code == 0) {
--- 660,669 ----
  		 refpanic ("Exceeded pool of AFS vnodes(VLRU cycle?)");
  	    else if (QNext(uq) != tq)
  		 refpanic ("VLRU inconsistent");
! 	    else if (VREFCOUNT(tvc) < 1) 
  		 refpanic ("refcnt 0 on VLRU");
  
! 	    if ( VREFCOUNT(tvc) == 1   &&   tvc->opens == 0 
  		&& (tvc->states & CUnlinkedDel) == 0) {
  		code = afs_FlushVCache(tvc, &fv_slept);
  		if (code == 0) {
***************
*** 711,717 ****
  
  #ifdef AFS_DARWIN_ENV
  	   if (tvc->opens == 0 && ((tvc->states & CUnlinkedDel) == 0) &&
!                 tvc->vrefCount == 1 && UBCINFOEXISTS(&tvc->v)) {
                 osi_VM_TryReclaim(tvc, &fv_slept);
                 if (fv_slept) {
                    uq = VLRU.prev;
--- 715,721 ----
  
  #ifdef AFS_DARWIN_ENV
  	   if (tvc->opens == 0 && ((tvc->states & CUnlinkedDel) == 0) &&
!                 VREFCOUNT(tvc) == 1 && UBCINFOEXISTS(&tvc->v)) {
                 osi_VM_TryReclaim(tvc, &fv_slept);
                 if (fv_slept) {
                    uq = VLRU.prev;
***************
*** 720,726 ****
                 }
              }
  #endif
! 	   if (tvc->vrefCount == 0 && tvc->opens == 0
  	       && (tvc->states & CUnlinkedDel) == 0) {
  		code = afs_FlushVCache(tvc, &fv_slept);
  		if (code == 0) {
--- 724,730 ----
                 }
              }
  #endif
! 	   if (VREFCOUNT(tvc) == 0 && tvc->opens == 0
  	       && (tvc->states & CUnlinkedDel) == 0) {
  		code = afs_FlushVCache(tvc, &fv_slept);
  		if (code == 0) {
***************
*** 815,821 ****
      /* Hold it for the LRU (should make count 2) */
      VN_HOLD((struct vnode *)tvc);
  #else	/* AFS_OSF_ENV */
!     tvc->vrefCount = 1;	/* us */
  #endif	/* AFS_OSF_ENV */
  #ifdef	AFS_AIX32_ENV
      LOCK_INIT(&tvc->pvmlock, "vcache pvmlock");
--- 819,825 ----
      /* Hold it for the LRU (should make count 2) */
      VN_HOLD((struct vnode *)tvc);
  #else	/* AFS_OSF_ENV */
!     VREFCOUNT_SET(tvc, 1);	/* us */
  #endif	/* AFS_OSF_ENV */
  #ifdef	AFS_AIX32_ENV
      LOCK_INIT(&tvc->pvmlock, "vcache pvmlock");
***************
*** 1081,1087 ****
  		/*
  		 * That's because if we come in via the CUnlinkedDel bit state path we'll be have 0 refcnt
  		 */
! 		osi_Assert(tvc->vrefCount > 0);
  		AFS_RWLOCK((vnode_t *)tvc, VRWLOCK_WRITE);
  #endif
  		ObtainWriteLock(&tvc->lock,52);
--- 1085,1091 ----
  		/*
  		 * That's because if we come in via the CUnlinkedDel bit state path we'll be have 0 refcnt
  		 */
! 		osi_Assert(VREFCOUNT(tvc) > 0);
  		AFS_RWLOCK((vnode_t *)tvc, VRWLOCK_WRITE);
  #endif
  		ObtainWriteLock(&tvc->lock,52);
***************
*** 1136,1142 ****
  		AFS_FAST_RELE(tvc);
  		if (didCore) {
  #ifdef	AFS_GFS_ENV
! 		    tvc->vrefCount--;
  #else
  		    AFS_RELE((struct vnode *)tvc);
  #endif
--- 1140,1146 ----
  		AFS_FAST_RELE(tvc);
  		if (didCore) {
  #ifdef	AFS_GFS_ENV
! 		    VREFCOUNT_DEC(tvc);
  #else
  		    AFS_RELE((struct vnode *)tvc);
  #endif
***************
*** 1145,1151 ****
  		}
  	    }	       
  #ifdef AFS_DARWIN_ENV
!             if (tvc->vrefCount == 1 && UBCINFOEXISTS(&tvc->v)) {
  		if (tvc->opens) panic("flushactive open, hasubc, but refcnt 1");
  		osi_VM_TryReclaim(tvc,0);
  	    }
--- 1149,1155 ----
  		}
  	    }	       
  #ifdef AFS_DARWIN_ENV
!             if (VREFCOUNT(tvc) == 1 && UBCINFOEXISTS(&tvc->v)) {
  		if (tvc->opens) panic("flushactive open, hasubc, but refcnt 1");
  		osi_VM_TryReclaim(tvc,0);
  	    }
***************
*** 1683,1690 ****
      /* stat the file */
      afs_RemoveVCB(afid);
      {
!     struct AFSFetchStatus OutStatus;
!     code = afs_FetchStatus(tvc, afid, areq, &OutStatus);
      }
  
      if (code) {
--- 1687,1701 ----
      /* stat the file */
      afs_RemoveVCB(afid);
      {
! 	struct AFSFetchStatus OutStatus;
! 
! 	if (afs_DynrootNewVnode(tvc, &OutStatus)) {
! 	    afs_ProcessFS(tvc, &OutStatus, areq);
! 	    tvc->states |= CStatd | CUnique;
! 	    code = 0;
! 	} else {
! 	    code = afs_FetchStatus(tvc, afid, areq, &OutStatus);
! 	}
      }
  
      if (code) {
***************
*** 2694,2700 ****
  		    vms_delete(tvc->segid);
  		    AFS_GLOCK();
  		    tvc->segid = tvc->vmh = NULL;
! 		    if (tvc->vrefCount) osi_Panic("flushVcache: vm race");
  		}
  		if (tvc->credp) {
  		    crfree(tvc->credp);
--- 2705,2711 ----
  		    vms_delete(tvc->segid);
  		    AFS_GLOCK();
  		    tvc->segid = tvc->vmh = NULL;
! 		    if (VREFCOUNT(tvc)) osi_Panic("flushVcache: vm race");
  		}
  		if (tvc->credp) {
  		    crfree(tvc->credp);
Index: openafs/src/afs/afs_volume.c
diff -c openafs/src/afs/afs_volume.c:1.6.2.1 openafs/src/afs/afs_volume.c:1.6.2.2
*** openafs/src/afs/afs_volume.c:1.6.2.1	Wed Sep 19 18:40:21 2001
--- openafs/src/afs/afs_volume.c	Sat Oct 13 00:20:24 2001
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_volume.c,v 1.6.2.1 2001/09/19 22:40:21 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 18,24 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_volume.c,v 1.6.2.2 2001/10/13 04:20:24 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 72,77 ****
--- 72,78 ----
  /* Forward declarations */
  static struct volume *afs_NewVolumeByName(char *aname, afs_int32 acell, int agood,
  				   struct vrequest *areq, afs_int32 locktype);
+ static struct volume *afs_NewDynrootVolume(struct VenusFid *fid);
  static inVolList();
  
  
***************
*** 402,409 ****
  
      tv = afs_FindVolume(afid, locktype);
      if (!tv) {
!        bp = afs_cv2string(&tbuf[CVBS], afid->Fid.Volume);
!        tv = afs_NewVolumeByName(bp, afid->Cell, 0, areq, locktype);
      }
      return tv;
  } /*afs_GetVolume*/
--- 403,414 ----
  
      tv = afs_FindVolume(afid, locktype);
      if (!tv) {
!        if (afs_IsDynrootFid(afid)) {
!           tv = afs_NewDynrootVolume(afid);
!        } else {
!           bp = afs_cv2string(&tbuf[CVBS], afid->Fid.Volume);
!           tv = afs_NewVolumeByName(bp, afid->Cell, 0, areq, locktype);
!        }
      }
      return tv;
  } /*afs_GetVolume*/
***************
*** 547,552 ****
--- 552,580 ----
  
    tv = afs_NewVolumeByName(aname, acell, agood, areq, locktype);
    return(tv);
+ }
+ 
+ static struct volume *afs_NewDynrootVolume(struct VenusFid *fid) {
+     struct cell *tcell;
+     struct volume *tv;
+     struct vldbentry tve;
+     char *bp, tbuf[CVBS];
+ 
+     tcell = afs_GetCell(fid->Cell, READ_LOCK);
+     if (!tcell)
+ 	return (struct volume *) 0;
+     if (!(tcell->states & CHasVolRef))
+ 	tcell->states |= CHasVolRef;
+ 
+     bp = afs_cv2string(&tbuf[CVBS], fid->Fid.Volume);
+     memset(&tve, 0, sizeof(tve));
+     strcpy(tve.name, "local-dynroot");
+     tve.volumeId[ROVOL] = fid->Fid.Volume;
+     tve.flags = VLF_ROEXISTS;
+ 
+     tv = afs_SetupVolume(0, bp, &tve, tcell, 0, 0, 0);
+     afs_PutCell(tcell, READ_LOCK);
+     return tv;
  }
  
  int lastnvcode;
Index: openafs/src/afs/lock.h
diff -c openafs/src/afs/lock.h:1.5 openafs/src/afs/lock.h:1.5.4.1
*** openafs/src/afs/lock.h:1.5	Thu Jul  5 11:20:00 2001
--- openafs/src/afs/lock.h	Sat Oct 13 00:20:24 2001
***************
*** 86,92 ****
  #define BEGINMAC do {
  #define ENDMAC   } while (0)
  
! #if defined(AFS_SUN5_ENV)
  #define MyPidxx (curproc->p_pid)
  #else
  #if defined(AFS_AIX41_ENV)
--- 86,92 ----
  #define BEGINMAC do {
  #define ENDMAC   } while (0)
  
! #if defined(AFS_SUN5_ENV) || defined(AFS_OBSD_ENV)
  #define MyPidxx (curproc->p_pid)
  #else
  #if defined(AFS_AIX41_ENV)
Index: openafs/src/afs/DARWIN/osi_module.c
diff -c openafs/src/afs/DARWIN/osi_module.c:1.6 openafs/src/afs/DARWIN/osi_module.c:1.6.2.1
*** openafs/src/afs/DARWIN/osi_module.c:1.6	Fri Sep  7 00:00:05 2001
--- openafs/src/afs/DARWIN/osi_module.c	Sat Nov 10 18:22:52 2001
***************
*** 1,7 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_module.c,v 1.6 2001/09/07 04:00:05 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
--- 1,7 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_module.c,v 1.6.2.1 2001/11/10 23:22:52 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
***************
*** 58,61 ****
     return KERN_SUCCESS;
   } 
  
! KMOD_EXPLICIT_DECL(openafs, VERSION, afs_modload, afs_modunload)
--- 58,61 ----
     return KERN_SUCCESS;
   } 
  
! KMOD_EXPLICIT_DECL(org.openafs.filesystems.afs, VERSION, afs_modload, afs_modunload)
Index: openafs/src/afs/DARWIN/osi_sleep.c
diff -c openafs/src/afs/DARWIN/osi_sleep.c:1.3 openafs/src/afs/DARWIN/osi_sleep.c:1.3.4.1
*** openafs/src/afs/DARWIN/osi_sleep.c:1.3	Thu Jul 12 15:58:19 2001
--- openafs/src/afs/DARWIN/osi_sleep.c	Sat Nov 10 18:22:52 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_sleep.c,v 1.3 2001/07/12 19:58:19 shadow Exp $");
  
  #include "../afs/sysincludes.h" /* Standard vendor system headers */
  #include "../afs/afsincludes.h" /* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_sleep.c,v 1.3.4.1 2001/11/10 23:22:52 shadow Exp $");
  
  #include "../afs/sysincludes.h" /* Standard vendor system headers */
  #include "../afs/afsincludes.h" /* Afs-based standard headers */
***************
*** 131,139 ****
      seq = evp->seq;
      while (seq == evp->seq) {
  	AFS_ASSERT_GLOCK();
- 	assert_wait((event_t)event, 0);
  	AFS_GUNLOCK();
  	thread_block(0);
  	AFS_GLOCK();
      }
      relevent(evp);
--- 131,144 ----
      seq = evp->seq;
      while (seq == evp->seq) {
  	AFS_ASSERT_GLOCK();
  	AFS_GUNLOCK();
+ #ifdef AFS_DARWIN14_ENV
+         /* this is probably safe for all versions, but testing is hard */
+         sleep(event, PVFS);
+ #else
+ 	assert_wait((event_t)event, 0);
  	thread_block(0);
+ #endif
  	AFS_GLOCK();
      }
      relevent(evp);
***************
*** 153,176 ****
      int code = 0;
      struct afs_event *evp;
      int ticks,seq;
  
      ticks = ( ams * afs_hz )/1000;
  
  
      evp = afs_getevent(event);
      seq=evp->seq;
-     assert_wait((event_t)event, aintok ? THREAD_ABORTSAFE : 0);
      AFS_GUNLOCK();
      thread_set_timer(ticks, NSEC_PER_SEC / hz);
      thread_block(0);
      AFS_GLOCK();
- #if 0 /* thread_t structure only available if MACH_KERNEL_PRIVATE */
-     if (current_thread()->wait_result != THREAD_AWAKENED)
- 	code = EINTR;
- #else
      if (seq == evp->seq)
  	code = EINTR;
- #endif
      
      relevent(evp);
      return code;
--- 158,194 ----
      int code = 0;
      struct afs_event *evp;
      int ticks,seq;
+     int prio;
  
      ticks = ( ams * afs_hz )/1000;
  
  
      evp = afs_getevent(event);
      seq=evp->seq;
      AFS_GUNLOCK();
+ #ifdef AFS_DARWIN14_ENV
+     /* this is probably safe for all versions, but testing is hard. */
+     /* using tsleep instead of assert_wait/thread_set_timer/thread_block
+        allows shutdown to work in 1.4 */
+     /* lack of PCATCH does *not* prevent signal delivery, neither does 
+        a low priority. We would need to deal with ERESTART here if we 
+        wanted to mess with p->p_sigmask, and messing with p_sigignore is
+        not the way to go.... (someone correct me if I'm wrong)
+     */
+     if (aintok)
+        prio=PCATCH|PPAUSE;
+     else
+        prio=PVFS;
+     code=tsleep(event, prio, "afs_osi_TimedSleep", ticks);
+ #else 
+     assert_wait((event_t)event, aintok ? THREAD_ABORTSAFE : THREAD_UNINT);
      thread_set_timer(ticks, NSEC_PER_SEC / hz);
      thread_block(0);
+     code=0;
+ #endif
      AFS_GLOCK();
      if (seq == evp->seq)
  	code = EINTR;
      
      relevent(evp);
      return code;
***************
*** 184,190 ****
--- 202,213 ----
      evp = afs_getevent(event);
      if (evp->refcount > 1) {
  	evp->seq++;    
+ #ifdef AFS_DARWIN14_ENV
+     /* this is probably safe for all versions, but testing is hard. */
+         wakeup(event);
+ #else
  	thread_wakeup((event_t)event);
+ #endif
      }
      relevent(evp);
  }
Index: openafs/src/afs/DARWIN/osi_vm.c
diff -c openafs/src/afs/DARWIN/osi_vm.c:1.3 openafs/src/afs/DARWIN/osi_vm.c:1.3.4.1
*** openafs/src/afs/DARWIN/osi_vm.c:1.3	Thu Jul 12 15:58:19 2001
--- openafs/src/afs/DARWIN/osi_vm.c	Sat Nov 10 18:22:52 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_vm.c,v 1.3 2001/07/12 19:58:19 shadow Exp $");
  
  #include "../afs/sysincludes.h" /* Standard vendor system headers */
  #include "../afs/afsincludes.h" /* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_vm.c,v 1.3.4.1 2001/11/10 23:22:52 shadow Exp $");
  
  #include "../afs/sysincludes.h" /* Standard vendor system headers */
  #include "../afs/afsincludes.h" /* Afs-based standard headers */
***************
*** 39,44 ****
--- 39,48 ----
      int *slept;
  {
      struct vnode *vp=(struct vnode *)avc;
+ #ifdef AFS_DARWIN14_ENV
+     if (UBCINFOEXISTS(vp))
+ 	return EBUSY;
+ #endif
      if (avc->vrefCount)
  	return EBUSY;
  
***************
*** 51,56 ****
--- 55,61 ----
  
      AFS_GUNLOCK();
      cache_purge(vp);
+ #ifndef AFS_DARWIN14_ENV
      if (UBCINFOEXISTS(vp))
  	{
                  ubc_clean(vp, 1);
***************
*** 58,63 ****
--- 63,69 ----
                  ubc_release(vp);
  	        ubc_info_free(vp);
  	}
+ #endif
  
      AFS_GLOCK();
  
***************
*** 186,196 ****
--- 192,210 ----
          AFS_RELE(vp);
          return;
      }
+ #ifdef AFS_DARWIN14_ENV
+     if (vp->v_ubcinfo->ui_refcount > 1) {
+         simple_unlock(&vp->v_interlock);
+         AFS_RELE(vp);
+         return;
+     }
+ #else
      if (vp->v_ubcinfo->ui_holdcnt) {
          simple_unlock(&vp->v_interlock);
          AFS_RELE(vp);
          return;
      }
+ #endif
      if (slept && ubc_issetflags(vp, UI_WASMAPPED)) {
         /* We can't possibly release this in time for this NewVCache to get it */
          simple_unlock(&vp->v_interlock);
***************
*** 209,229 ****
      obj=0;
      if (ubc_issetflags(vp, UI_WASMAPPED)) {
          simple_unlock(&vp->v_interlock);
          ubc_release(vp);
          if (ubc_issetflags(vp, UI_HASOBJREF))
              printf("ubc_release didn't release the reference?!\n");
      } else if (!vn_lock(vp, LK_EXCLUSIVE|LK_INTERLOCK,current_proc())) {
! #ifdef UBC_NOREACTIVATE
          obj = ubc_getobject(vp,(UBC_NOREACTIVATE|UBC_HOLDOBJECT));
  #else
          obj = ubc_getobject(vp);
  #endif
          (void)ubc_clean(vp, 1);
          vinvalbuf(vp, V_SAVE, &afs_osi_cred, p, 0, 0);
          if (vp->v_usecount == 1)
             VOP_INACTIVE(vp, p);
          else
             VOP_UNLOCK(vp, 0, p);
          if (ISSET(vp->v_flag, VTERMINATE))
              panic("afs_vnreclaim: already teminating");
          SET(vp->v_flag, VTERMINATE);
--- 223,252 ----
      obj=0;
      if (ubc_issetflags(vp, UI_WASMAPPED)) {
          simple_unlock(&vp->v_interlock);
+ #ifdef  AFS_DARWIN14_ENV
+         ubc_release_named(vp);
+ #else
          ubc_release(vp);
+ #endif
          if (ubc_issetflags(vp, UI_HASOBJREF))
              printf("ubc_release didn't release the reference?!\n");
      } else if (!vn_lock(vp, LK_EXCLUSIVE|LK_INTERLOCK,current_proc())) {
! #ifdef AFS_DARWIN14_ENV
!         obj = ubc_getobject(vp,UBC_HOLDOBJECT);
! #else
! #ifdef AFS_DARWIN13_ENV
          obj = ubc_getobject(vp,(UBC_NOREACTIVATE|UBC_HOLDOBJECT));
  #else
          obj = ubc_getobject(vp);
  #endif
+ #endif
          (void)ubc_clean(vp, 1);
          vinvalbuf(vp, V_SAVE, &afs_osi_cred, p, 0, 0);
          if (vp->v_usecount == 1)
             VOP_INACTIVE(vp, p);
          else
             VOP_UNLOCK(vp, 0, p);
+         if (obj) {
          if (ISSET(vp->v_flag, VTERMINATE))
              panic("afs_vnreclaim: already teminating");
          SET(vp->v_flag, VTERMINATE);
***************
*** 232,244 ****
                SET(vp->v_flag, VTERMWANT);
                tsleep((caddr_t)&vp->v_ubcinfo, PINOD, "afs_vnreclaim", 0);
          }
     } else {
          if (simple_lock_try(&vp->v_interlock))
              panic("afs_vnreclaim: slept, but did no work :(");
          if (UBCINFOEXISTS(vp) && vp->v_count == 1) {
             vp->v_usecount++;
             simple_unlock(&vp->v_interlock);
!            AFS_RELE(vp);
          } else 
             simple_unlock(&vp->v_interlock);
     }
--- 255,268 ----
                SET(vp->v_flag, VTERMWANT);
                tsleep((caddr_t)&vp->v_ubcinfo, PINOD, "afs_vnreclaim", 0);
          }
+         }
     } else {
          if (simple_lock_try(&vp->v_interlock))
              panic("afs_vnreclaim: slept, but did no work :(");
          if (UBCINFOEXISTS(vp) && vp->v_count == 1) {
             vp->v_usecount++;
             simple_unlock(&vp->v_interlock);
!            VN_RELE(vp);
          } else 
             simple_unlock(&vp->v_interlock);
     }
***************
*** 254,261 ****
      void *object;
      struct vcache *avc = (struct vcache *)vp;
  
      object=NULL;
! #ifdef UBC_NOREACTIVATE
      if (UBCINFOEXISTS(vp))
          object = ubc_getobject(vp, UBC_NOREACTIVATE);
  #else
--- 278,296 ----
      void *object;
      struct vcache *avc = (struct vcache *)vp;
  
+ #ifdef AFS_DARWIN14_ENV
+     offset=trunc_page(offset);
+     size=round_page(size+1);
+     while (size) {
+         ubc_page_op(vp, (vm_offset_t)offset, 
+                               UPL_POP_SET | UPL_POP_BUSY | UPL_POP_DUMP,
+                               0, 0);
+         size-=PAGE_SIZE;
+         offset+=PAGE_SIZE;
+     }
+ #else
      object=NULL;
! #ifdef AFS_DARWIN13_ENV
      if (UBCINFOEXISTS(vp))
          object = ubc_getobject(vp, UBC_NOREACTIVATE);
  #else
***************
*** 268,274 ****
      offset=trunc_page(offset);
      size=round_page(size+1);
  
! #ifdef UBC_NOREACTIVATE
      while (size) {
          memory_object_page_op(object, (vm_offset_t)offset, 
                                UPL_POP_SET | UPL_POP_BUSY | UPL_POP_DUMP,
--- 303,309 ----
      offset=trunc_page(offset);
      size=round_page(size+1);
  
! #ifdef AFS_DARWIN13_ENV
      while (size) {
          memory_object_page_op(object, (vm_offset_t)offset, 
                                UPL_POP_SET | UPL_POP_BUSY | UPL_POP_DUMP,
***************
*** 277,286 ****
--- 312,323 ----
          offset+=PAGE_SIZE;
      }
  #else 
+     /* This is all we can do, and it's not enough. sucks to be us */
      ubc_setsize(vp, offset);
      size=(offset + size > avc->m.Length) ? offset + size : avc->m.Length;
      ubc_setsize(vp, size);
  #endif
+ #endif
  
  }
  int osi_VM_Setup(struct vcache *avc) {
***************
*** 296,310 ****
               AFS_RELE(avc);
               return error;
           }
           simple_lock(&avc->v.v_interlock);
           if (!ubc_issetflags(&avc->v, UI_HASOBJREF))
! #ifdef UBC_NOREACTIVATE
              if (ubc_getobject(&avc->v, (UBC_NOREACTIVATE|UBC_HOLDOBJECT)))
                     panic("VM_Setup: null object");
  #else
              (void)_ubc_getobject(&avc->v, 1); /* return value not used */
  #endif
           simple_unlock(&avc->v.v_interlock);
           AFS_GLOCK();
           AFS_RELE(avc);
        }
--- 333,349 ----
               AFS_RELE(avc);
               return error;
           }
+ #ifndef AFS_DARWIN14_ENV
           simple_lock(&avc->v.v_interlock);
           if (!ubc_issetflags(&avc->v, UI_HASOBJREF))
! #ifdef AFS_DARWIN13_ENV
              if (ubc_getobject(&avc->v, (UBC_NOREACTIVATE|UBC_HOLDOBJECT)))
                     panic("VM_Setup: null object");
  #else
              (void)_ubc_getobject(&avc->v, 1); /* return value not used */
  #endif
           simple_unlock(&avc->v.v_interlock);
+ #endif
           AFS_GLOCK();
           AFS_RELE(avc);
        }
Index: openafs/src/afs/DARWIN/osi_vnodeops.c
diff -c openafs/src/afs/DARWIN/osi_vnodeops.c:1.4 openafs/src/afs/DARWIN/osi_vnodeops.c:1.4.2.1
*** openafs/src/afs/DARWIN/osi_vnodeops.c:1.4	Tue Aug  7 20:03:29 2001
--- openafs/src/afs/DARWIN/osi_vnodeops.c	Sat Nov 10 18:22:52 2001
***************
*** 1,7 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.4 2001/08/08 00:03:29 shadow Exp $");
  
  #include <afs/sysincludes.h>            /* Standard vendor system headers */
  #include <afs/afsincludes.h>            /* Afs-based standard headers */
--- 1,7 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.4.2.1 2001/11/10 23:22:52 shadow Exp $");
  
  #include <afs/sysincludes.h>            /* Standard vendor system headers */
  #include <afs/afsincludes.h>            /* Afs-based standard headers */
***************
*** 755,766 ****
      error =  afs_remove((struct vcache *)dvp, name, cnp->cn_cred);
      AFS_GUNLOCK();
      cache_purge(vp);
!     if (dvp == vp)
! 	vrele(vp);
!     else
! 	vput(vp);
!     vput(dvp);
!     if (UBCINFOEXISTS(vp)) {
               int wasmapped=ubc_issetflags(vp, UI_WASMAPPED);
               int hasobjref=ubc_issetflags(vp, UI_HASOBJREF);
               if (wasmapped)
--- 755,764 ----
      error =  afs_remove((struct vcache *)dvp, name, cnp->cn_cred);
      AFS_GUNLOCK();
      cache_purge(vp);
!     if (!error && UBCINFOEXISTS(vp)) {
! #ifdef AFS_DARWIN14_ENV
!              (void) ubc_uncache(vp); 
! #else
               int wasmapped=ubc_issetflags(vp, UI_WASMAPPED);
               int hasobjref=ubc_issetflags(vp, UI_HASOBJREF);
               if (wasmapped)
***************
*** 768,774 ****
--- 766,778 ----
               if (hasobjref)
                  ubc_release(vp);
               /* WARNING vp may not be valid after this */
+ #endif
      }
+     if (dvp == vp)
+ 	vrele(vp);
+     else
+ 	vput(vp);
+     vput(dvp);
  
      FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
      DROPNAME();
***************
*** 1218,1225 ****
--- 1222,1234 ----
      if (UBCISVALID(vp))
          printf("\n  UBC: %s%s",
                 UBCINFOEXISTS(vp) ? "exists, " : "does not exist",
+ #ifdef AFS_DARWIN14_ENV
                 UBCINFOEXISTS(vp) ?
+                  sprintf(buf, "refs %d", vp->v_ubcinfo->ui_refcount),buf : "");
+ #else
+                UBCINFOEXISTS(vp) ?
                   sprintf(buf, "holdcnt %d", vp->v_ubcinfo->ui_holdcnt),buf : "");
+ #endif
      printf("\n");
      return 0;
  }
Index: openafs/src/afs/LINUX/osi_module.c
diff -c openafs/src/afs/LINUX/osi_module.c:1.16 openafs/src/afs/LINUX/osi_module.c:1.16.2.1
*** openafs/src/afs/LINUX/osi_module.c:1.16	Mon Aug  6 20:11:25 2001
--- openafs/src/afs/LINUX/osi_module.c	Sat Oct 13 00:20:26 2001
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_module.c,v 1.16 2001/08/07 00:11:25 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
--- 14,20 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_module.c,v 1.16.2.1 2001/10/13 04:20:26 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
***************
*** 320,326 ****
  
  static long get_page_offset(void)
  {
! #if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV) || defined(AFS_IA64_LINUX20_ENV)
      return PAGE_OFFSET;
  #else
      struct task_struct *p;
--- 320,326 ----
  
  static long get_page_offset(void)
  {
! #if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV) || defined(AFS_IA64_LINUX20_ENV) || defined(AFS_PARISC_LINUX24_ENV)
      return PAGE_OFFSET;
  #else
      struct task_struct *p;
Index: openafs/src/afs/LINUX/osi_vfs.h
diff -c openafs/src/afs/LINUX/osi_vfs.h:1.11 openafs/src/afs/LINUX/osi_vfs.h:removed
*** openafs/src/afs/LINUX/osi_vfs.h:1.11	Thu Sep  6 21:12:33 2001
--- openafs/src/afs/LINUX/osi_vfs.h	Wed Nov 21 01:54:11 2001
***************
*** 1,228 ****
- /*
-  * 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
-  */
- 
- /*
-  * Linux interpretations of vnode and vfs structs.
-  *
-  * The Linux "inode" has been abstracted to the fs independent part to avoid
-  * wasting 100+bytes per vnode.
-  */
- 
- #ifndef OSI_VFS_H_
- #define OSI_VFS_H_
- 
- /* The vnode should match the current implementation of the fs independent
-  * part of the Linux inode.
-  */
- /* The first cut is to continue to use a separate vnode pool. */
- typedef struct vnode {
- 	struct list_head	i_hash;
- 	struct list_head	i_list;
- 	struct list_head	i_dentry;
- #if defined(AFS_LINUX24_ENV)
-         struct list_head        i_dirty_buffers;
- #endif
- #if defined(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS)
-         struct list_head        i_dirty_data_buffers;
- #endif
- 	unsigned long		i_ino;
- 	unsigned int		i_count;
- 	kdev_t			i_dev;
- 	umode_t			i_mode;
- 	nlink_t			i_nlink;
- 	uid_t			i_uid;
- 	gid_t			i_gid;
- 	kdev_t			i_rdev;
- #if defined(AFS_LINUX24_ENV) || defined(pgoff2loff) 
-         loff_t                  i_size;
- #else
- 	off_t			i_size;
- #endif
- 	time_t			i_atime;
- 	time_t			i_mtime;
- 	time_t			i_ctime;
- 	unsigned long		i_blksize;
- 	unsigned long		i_blocks;
- 	unsigned long		i_version;
- #if !defined(AFS_LINUX24_ENV)
- 	unsigned long		i_nrpages;
- #endif
- #ifdef STRUCT_INODE_HAS_I_BYTES
-         unsigned short          i_bytes;
- #endif
- 	struct semaphore	i_sem;
- #ifdef STRUCT_INODE_HAS_I_TRUNCATE_SEM
-         struct rw_semaphore     i_truncate_sem;
- #endif
- #if defined(AFS_LINUX24_ENV)
-         struct semaphore        i_zombie;
- #else
- 	struct semaphore	i_atomic_write;
- #endif
- 	struct inode_operations	*i_op;
- #if defined(AFS_LINUX24_ENV)
-         struct file_operations  *i_fop;
- #endif
- 	struct super_block	*i_sb;
- #if defined(AFS_LINUX24_ENV)
-         wait_queue_head_t       i_wait;
- #else
- 	struct wait_queue	*i_wait;
- #endif
- 	struct file_lock	*i_flock;
- #if defined(AFS_LINUX24_ENV)
-         struct address_space    *i_mapping;
-         struct address_space    i_data;
- #else
- 	struct vm_area_struct	*i_mmap;
- #if defined(STRUCT_INODE_HAS_I_MMAP_SHARED)
-         struct vm_area_struct   *i_mmap_shared;
- #endif
- 	struct page		*i_pages;
- #endif
- #if defined(STRUCT_INODE_HAS_I_MAPPING_OVERLOAD)
-         int                     i_mapping_overload;
- #endif
- 	struct dquot		*i_dquot[MAXQUOTAS];
- #if defined(AFS_LINUX24_ENV)
-         struct pipe_inode_info  *i_pipe;
-         struct block_device     *i_bdev;
- #if defined(STRUCT_INODE_HAS_I_CDEV)
-         struct char_device      *i_cdev;
- #endif
-         unsigned long           i_dnotify_mask;
-         struct dnotify_struct   *i_dnotify;
- #endif
- 
- 	unsigned long		i_state;
- 
- 	unsigned int		i_flags;
- #if !defined(AFS_LINUX24_ENV)
- 	unsigned char		i_pipe;
- #endif
- 	unsigned char		i_sock;
- 
- #if defined(AFS_LINUX24_ENV)
-         atomic_t                i_writecount;
- #else
- 	int			i_writecount;
- #endif
- 	unsigned int		i_attr_flags;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10)
- 	__u32                   i_generation;
- #endif
- #ifdef notdef
- 	union {
- 		struct pipe_inode_info		pipe_i;
- 		struct minix_inode_info		minix_i;
- 		struct ext2_inode_info		ext2_i;
- 		struct hpfs_inode_info		hpfs_i;
- 		struct ntfs_inode_info          ntfs_i;
- 		struct msdos_inode_info		msdos_i;
- 		struct umsdos_inode_info	umsdos_i;
- 		struct iso_inode_info		isofs_i;
- 		struct nfs_inode_info		nfs_i;
- 		struct sysv_inode_info		sysv_i;
- 		struct affs_inode_info		affs_i;
- 		struct ufs_inode_info		ufs_i;
- 		struct romfs_inode_info		romfs_i;
- 		struct coda_inode_info		coda_i;
- 		struct smb_inode_info		smbfs_i;
- 		struct hfs_inode_info		hfs_i;
- 		struct adfs_inode_info		adfs_i;
- 		struct qnx4_inode_info		qnx4_i;	   
- 		struct socket			socket_i;
- 		void				*generic_ip;
- 	} u;
- #endif
- } vnode_t;
- 
- /* Map vnode fields to inode fields. */
- #define i_number	i_ino
- #define v_count		i_count
- #define v_op		i_op
- #if defined(AFS_LINUX24_ENV)
- #define v_fop           i_fop
- #endif
- #define v_type		i_mode
- #define v_vfsp		i_sb
- #define vfs_vnodecovered s_covered
- 
- /* v_type bits map to mode bits: */
- #define VNON 0
- #define VREG S_IFREG
- #define VDIR S_IFDIR
- #define VBLK S_IFBLK
- #define VCHR S_IFCHR
- #define VLNK S_IFLNK
- #define VSOCK S_IFSOCK
- 
- /* vcexcl - used only by afs_create */
- enum vcexcl { EXCL, NONEXCL } ;
- 
- /* afs_open and afs_close needs to distinguish these cases */
- #define FWRITE	O_WRONLY|O_RDWR|O_APPEND
- #define FTRUNC	O_TRUNC
- 
- 
- #define IO_APPEND O_APPEND
- #define FSYNC O_SYNC
- 
- #define VTOI(V)  ((struct inode*)V)
- #define VN_HOLD(V) ((vnode_t*)V)->i_count++;
- #define VN_RELE(V) osi_iput((struct inode *)V);
- #define VFS_STATFS(V, S) ((V)->s_op->statfs)((V), (S), sizeof(*(S)))
- 
- 
- 
- /* Various mode bits */
- #define VWRITE	S_IWUSR
- #define VREAD	S_IRUSR
- #define VEXEC	S_IXUSR
- #define VSUID	S_ISUID
- #define VSGID	S_ISGID
- 
- 
- #define vfs super_block
- 
- typedef struct vattr {
-     int		va_type;	/* One of v_types above. */
-     size_t	va_size;
-     unsigned long va_blocks;
-     unsigned long va_blocksize;
-     int		va_mask;	/* AT_xxx operation to perform. */
-     umode_t	va_mode;	/* mode bits. */
-     uid_t	va_uid;
-     gid_t	va_gid;
-     int		va_fsid;	/* Not used? */
-     dev_t	va_rdev;
-     ino_t	va_nodeid;	/* Inode number */
-     nlink_t	va_nlink;	/* link count for file. */
-     struct timeval va_atime;
-     struct timeval va_mtime;
-     struct timeval va_ctime;
- } vattr_t;
- 
- #define VATTR_NULL(A) memset(A, 0, sizeof(struct vattr))
- 
- 
- /* va_masks - these should match their respective ATTR_xxx #defines in fs.h.
-  * afs_notify_change has to use the attr bits in both the Linux and AFS
-  * meanings. The glue layer code uses the ATTR_xxx style names.
-  */
- #define AT_SIZE		ATTR_SIZE
- #define AT_MODE		ATTR_MODE
- #define AT_UID		ATTR_UID
- #define AT_GID		ATTR_GID
- #define AT_MTIME	ATTR_MTIME
- 
- 
- #define vnodeops inode_operations
- 
- #endif /* OSI_VFS_H_ */
--- 0 ----
Index: openafs/src/afs/LINUX/osi_vfs.hin
diff -c /dev/null openafs/src/afs/LINUX/osi_vfs.hin:1.2.2.1
*** /dev/null	Wed Nov 21 01:54:11 2001
--- openafs/src/afs/LINUX/osi_vfs.hin	Sat Oct 13 00:28:46 2001
***************
*** 0 ****
--- 1,114 ----
+ /*
+  * 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
+  */
+ 
+ /*
+  * Linux interpretations of vnode and vfs structs.
+  *
+  * The Linux "inode" has been abstracted to the fs independent part to avoid
+  * wasting 100+bytes per vnode.
+  */
+ 
+ #ifndef OSI_VFS_H_
+ #define OSI_VFS_H_
+ 
+ /* The vnode should match the current implementation of the fs independent
+  * part of the Linux inode.
+  */
+ /* The first cut is to continue to use a separate vnode pool. */
+ /* LINUX VNODE INCLUDED BELOW -- DO NOT MODIFY */
+ 
+ typedef struct vnode vnode_t;
+ 
+ /* Map vnode fields to inode fields. */
+ #define i_number	i_ino
+ #define v_count		i_count
+ #define v_op		i_op
+ #if defined(AFS_LINUX24_ENV)
+ #define v_fop           i_fop
+ #endif
+ #define v_type		i_mode
+ #define v_vfsp		i_sb
+ #define vfs_vnodecovered s_covered
+ 
+ /* v_type bits map to mode bits: */
+ #define VNON 0
+ #define VREG S_IFREG
+ #define VDIR S_IFDIR
+ #define VBLK S_IFBLK
+ #define VCHR S_IFCHR
+ #define VLNK S_IFLNK
+ #define VSOCK S_IFSOCK
+ 
+ /* vcexcl - used only by afs_create */
+ enum vcexcl { EXCL, NONEXCL } ;
+ 
+ /* afs_open and afs_close needs to distinguish these cases */
+ #define FWRITE	O_WRONLY|O_RDWR|O_APPEND
+ #define FTRUNC	O_TRUNC
+ 
+ 
+ #define IO_APPEND O_APPEND
+ #define FSYNC O_SYNC
+ 
+ #define VTOI(V)  ((struct inode*)V)
+ #ifdef AFS_LINUX24_ENV
+ #define VN_HOLD(V) atomic_inc(&((vnode_t*)V)->i_count)
+ #else
+ #define VN_HOLD(V) ((vnode_t*)V)->i_count++;
+ #endif
+ #define VN_RELE(V) osi_iput((struct inode *)V);
+ #define VFS_STATFS(V, S) ((V)->s_op->statfs)((V), (S), sizeof(*(S)))
+ 
+ 
+ 
+ /* Various mode bits */
+ #define VWRITE	S_IWUSR
+ #define VREAD	S_IRUSR
+ #define VEXEC	S_IXUSR
+ #define VSUID	S_ISUID
+ #define VSGID	S_ISGID
+ 
+ 
+ #define vfs super_block
+ 
+ typedef struct vattr {
+     int		va_type;	/* One of v_types above. */
+     size_t	va_size;
+     unsigned long va_blocks;
+     unsigned long va_blocksize;
+     int		va_mask;	/* AT_xxx operation to perform. */
+     umode_t	va_mode;	/* mode bits. */
+     uid_t	va_uid;
+     gid_t	va_gid;
+     int		va_fsid;	/* Not used? */
+     dev_t	va_rdev;
+     ino_t	va_nodeid;	/* Inode number */
+     nlink_t	va_nlink;	/* link count for file. */
+     struct timeval va_atime;
+     struct timeval va_mtime;
+     struct timeval va_ctime;
+ } vattr_t;
+ 
+ #define VATTR_NULL(A) memset(A, 0, sizeof(struct vattr))
+ 
+ 
+ /* va_masks - these should match their respective ATTR_xxx #defines in fs.h.
+  * afs_notify_change has to use the attr bits in both the Linux and AFS
+  * meanings. The glue layer code uses the ATTR_xxx style names.
+  */
+ #define AT_SIZE		ATTR_SIZE
+ #define AT_MODE		ATTR_MODE
+ #define AT_UID		ATTR_UID
+ #define AT_GID		ATTR_GID
+ #define AT_MTIME	ATTR_MTIME
+ 
+ 
+ #define vnodeops inode_operations
+ 
+ #endif /* OSI_VFS_H_ */
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.11 openafs/src/afs/LINUX/osi_vfsops.c:1.11.2.1
*** openafs/src/afs/LINUX/osi_vfsops.c:1.11	Tue Aug 28 14:03:49 2001
--- openafs/src/afs/LINUX/osi_vfsops.c	Sat Oct 13 00:20:26 2001
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.11 2001/08/28 18:03:49 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
--- 15,21 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.11.2.1 2001/10/13 04:20:26 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
***************
*** 335,342 ****
  void 
  afs_umount_begin(struct super_block *sbp)
  {
-     afs_shuttingdown=1;
      afs_put_super(sbp);      
      afs_was_mounted=0;
  }
  
--- 335,342 ----
  void 
  afs_umount_begin(struct super_block *sbp)
  {
      afs_put_super(sbp);      
+     afs_shuttingdown=1;
      afs_was_mounted=0;
  }
  
***************
*** 347,353 ****
      delete_inode:      afs_delete_inode,
      put_super:         afs_put_super,
      statfs:            afs_statfs,
!     umount_begin:      afs_umount_begin,
  };
  #else
  struct super_operations afs_sops = {
--- 347,353 ----
      delete_inode:      afs_delete_inode,
      put_super:         afs_put_super,
      statfs:            afs_statfs,
!     umount_begin:      NULL /* afs_umount_begin */
  };
  #else
  struct super_operations afs_sops = {
***************
*** 361,367 ****
      afs_statfs,
      NULL,		/* afs_remount_fs - see doc above */
      NULL,		/* afs_clear_inode */
!     afs_umount_begin,
  };
  #endif
  
--- 361,367 ----
      afs_statfs,
      NULL,		/* afs_remount_fs - see doc above */
      NULL,		/* afs_clear_inode */
!     NULL                /* afs_umount_begin */
  };
  #endif
  
Index: openafs/src/afs/LINUX/osi_vm.c
diff -c openafs/src/afs/LINUX/osi_vm.c:1.8 openafs/src/afs/LINUX/osi_vm.c:1.8.4.1
*** openafs/src/afs/LINUX/osi_vm.c:1.8	Thu Jul 12 15:58:21 2001
--- openafs/src/afs/LINUX/osi_vm.c	Sat Oct 13 00:20:26 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_vm.c,v 1.8 2001/07/12 19:58:21 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_vm.c,v 1.8.4.1 2001/10/13 04:20:26 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 43,49 ****
  {
      struct inode *ip = (struct inode*)avc;
  
!     if (avc->vrefCount != 0)
  	return EBUSY;
  
      if (avc->opens != 0)
--- 43,49 ----
  {
      struct inode *ip = (struct inode*)avc;
  
!     if (VREFCOUNT(avc) != 0)
  	return EBUSY;
  
      if (avc->opens != 0)
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.29.2.1 openafs/src/afs/LINUX/osi_vnodeops.c:1.29.2.2
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.29.2.1	Thu Sep 20 01:10:46 2001
--- openafs/src/afs/LINUX/osi_vnodeops.c	Sat Oct 13 00:20:26 2001
***************
*** 23,29 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.29.2.1 2001/09/20 05:10:46 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
--- 23,29 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.29.2.2 2001/10/13 04:20:26 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
Index: openafs/src/afs/SOLARIS/osi_file.c
diff -c openafs/src/afs/SOLARIS/osi_file.c:1.6 openafs/src/afs/SOLARIS/osi_file.c:1.6.2.1
*** openafs/src/afs/SOLARIS/osi_file.c:1.6	Tue Aug  7 20:03:32 2001
--- openafs/src/afs/SOLARIS/osi_file.c	Sat Oct 13 00:20:26 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/SOLARIS/osi_file.c,v 1.6 2001/08/08 00:03:32 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/SOLARIS/osi_file.c,v 1.6.2.1 2001/10/13 04:20:26 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 339,346 ****
--- 339,351 ----
          osi_Panic("afs_osi_Write called with null param");
      if (offset != -1) afile->offset = offset;
      AFS_GUNLOCK();
+ #ifdef AFS_SUN59_ENV
      code = gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, afile->offset,
+ 		  AFS_UIOSYS, 0, curproc->p_fsz_ctl.rlim_cur, &afs_osi_cred, &resid);
+ #else
+     code = gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, afile->offset,
  		  AFS_UIOSYS, 0,  (u.u_rlimit[RLIMIT_FSIZE].rlim_cur), &afs_osi_cred, &resid);
+ #endif
      AFS_GLOCK();
      if (code == 0) {
  	code = asize - resid;
Index: openafs/src/afs/SOLARIS/osi_vfsops.c
diff -c openafs/src/afs/SOLARIS/osi_vfsops.c:1.8 openafs/src/afs/SOLARIS/osi_vfsops.c:1.8.4.1
*** openafs/src/afs/SOLARIS/osi_vfsops.c:1.8	Thu Jul 12 15:58:21 2001
--- openafs/src/afs/SOLARIS/osi_vfsops.c	Sat Oct 13 00:20:26 2001
***************
*** 13,19 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/SOLARIS/osi_vfsops.c,v 1.8 2001/07/12 19:58:21 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 13,19 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/SOLARIS/osi_vfsops.c,v 1.8.4.1 2001/10/13 04:20:26 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 308,314 ****
      if ( !nfs_checkauth ) afs_warn("nfs_checkauth not initialised");
  #endif
      ufs_iallocp = (int (*)()) modlookup("ufs", "ufs_ialloc");    
!     ufs_iupdatp = (int (*)()) modlookup("ufs", "ufs_iupdat");
      ufs_igetp = (int (*)()) modlookup("ufs", "ufs_iget");    
      ufs_itimes_nolockp = (void (*)()) modlookup("ufs", "ufs_itimes_nolock");
      udp_infop = (struct streamtab *) modlookup("udp", "udpinfo");    
--- 308,314 ----
      if ( !nfs_checkauth ) afs_warn("nfs_checkauth not initialised");
  #endif
      ufs_iallocp = (int (*)()) modlookup("ufs", "ufs_ialloc");    
!     ufs_iupdatp = (void (*)()) modlookup("ufs", "ufs_iupdat");
      ufs_igetp = (int (*)()) modlookup("ufs", "ufs_iget");    
      ufs_itimes_nolockp = (void (*)()) modlookup("ufs", "ufs_itimes_nolock");
      udp_infop = (struct streamtab *) modlookup("udp", "udpinfo");    
Index: openafs/src/afs/SOLARIS/osi_vnodeops.c
diff -c openafs/src/afs/SOLARIS/osi_vnodeops.c:1.7 openafs/src/afs/SOLARIS/osi_vnodeops.c:1.7.2.1
*** openafs/src/afs/SOLARIS/osi_vnodeops.c:1.7	Mon Aug  6 19:39:32 2001
--- openafs/src/afs/SOLARIS/osi_vnodeops.c	Sat Oct 13 00:20:26 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.7 2001/08/06 23:39:32 shadow Exp $");
  
  #if	defined(AFS_SUN_ENV) || defined(AFS_SUN5_ENV)
  /*
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.7.2.1 2001/10/13 04:20:26 shadow Exp $");
  
  #if	defined(AFS_SUN_ENV) || defined(AFS_SUN5_ENV)
  /*
***************
*** 1419,1425 ****
      return code;
  }
  
! int afs_frlock(vnp, cmd, ap, flag, off, credp)
      struct vnode *vnp;
      int cmd;
  #if	defined(AFS_SUN56_ENV)
--- 1419,1429 ----
      return code;
  }
  
! int afs_frlock(vnp, cmd, ap, flag, off,
! #ifdef AFS_SUN59_ENV
! 	       flkcb,
! #endif
! 	       credp)
      struct vnode *vnp;
      int cmd;
  #if	defined(AFS_SUN56_ENV)
***************
*** 1429,1434 ****
--- 1433,1441 ----
  #endif
      int flag;
      offset_t off;
+ #ifdef AFS_SUN59_ENV
+     struct flk_callback *flkcb;
+ #endif
      struct AFS_UCRED *credp;
  {
      register afs_int32 code = 0;
***************
*** 1436,1441 ****
--- 1443,1452 ----
       * Implement based on afs_lockctl
       */
      AFS_GLOCK();
+ #ifdef AFS_SUN59_ENV
+     if (flkcb)
+ 	afs_warn("Don't know how to deal with flk_callback's!\n");
+ #endif
      if ((cmd == F_GETLK) || (cmd == F_O_GETLK) || (cmd == F_SETLK) || (cmd ==  F_SETLKW)) {
  #ifdef	AFS_SUN53_ENV
  	ap->l_pid = ttoproc(curthread)->p_pid;
***************
*** 1533,1541 ****
      return EINVAL;
  }
  
! int  afs_dumpctl(vp, i)
  struct vnode *vp;
  int i;
  {
      afs_warn("afs_dumpctl: Not implemented\n");
      return EINVAL;
--- 1544,1559 ----
      return EINVAL;
  }
  
! int  afs_dumpctl(vp, i
! #ifdef AFS_SUN59_ENV
! 		 , blkp
! #endif
! 		 )
  struct vnode *vp;
  int i;
+ #ifdef AFS_SUN59_ENV
+ int *blkp;
+ #endif
  {
      afs_warn("afs_dumpctl: Not implemented\n");
      return EINVAL;
Index: openafs/src/afs/VNOPS/afs_vnop_flock.c
diff -c openafs/src/afs/VNOPS/afs_vnop_flock.c:1.10 openafs/src/afs/VNOPS/afs_vnop_flock.c:1.10.4.1
*** openafs/src/afs/VNOPS/afs_vnop_flock.c:1.10	Thu Jul 12 15:58:22 2001
--- openafs/src/afs/VNOPS/afs_vnop_flock.c	Sat Oct 13 00:20:26 2001
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.10 2001/07/12 19:58:22 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 15,21 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.10.4.1 2001/10/13 04:20:26 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 831,837 ****
      if (code) {
  	return(0);              /* failed, say it is 'unlocked' */
      } else {
! 	return((int)OutStatus.spare2);
      }
  }
  #endif
--- 831,837 ----
      if (code) {
  	return(0);              /* failed, say it is 'unlocked' */
      } else {
! 	return((int)OutStatus.lockCount);
      }
  }
  #endif
Index: openafs/src/afs/VNOPS/afs_vnop_lookup.c
diff -c openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.14 openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.14.2.2
*** openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.14	Sun Aug 26 23:35:06 2001
--- openafs/src/afs/VNOPS/afs_vnop_lookup.c	Sat Oct 13 01:24:56 2001
***************
*** 22,28 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.14 2001/08/27 03:35:06 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 22,28 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.14.2.2 2001/10/13 05:24:56 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 353,359 ****
   * CForeign bit set.
   */
  struct vcache * BStvc = (struct vcache *) 0;
! void afs_DoBulkStat(adp, dirCookie, areqp)
    struct vcache *adp;
    long dirCookie;
    struct vrequest *areqp;
--- 353,359 ----
   * CForeign bit set.
   */
  struct vcache * BStvc = (struct vcache *) 0;
! int afs_DoBulkStat(adp, dirCookie, areqp)
    struct vcache *adp;
    long dirCookie;
    struct vrequest *areqp;
***************
*** 397,402 ****
--- 397,403 ----
      struct volume *volp=0;	/* volume ptr */
      struct VenusFid dotdot;
      int	flagIndex;		/* First file with bulk fetch flag set */
+     int inlinebulk=0;           /* Did we use InlineBulk RPC or not? */
      XSTATS_DECLS
  
      /* first compute some basic parameters.  We dont want to prefetch more
***************
*** 607,614 ****
  #ifdef RX_ENABLE_LOCKS
  	    AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
! 	    code = RXAFS_BulkStatus(tcp->id, &fidParm, &statParm, &cbParm,
! 				    &volSync);
  #ifdef RX_ENABLE_LOCKS
  	    AFS_GLOCK();
  #endif /* RX_ENABLE_LOCKS */
--- 608,627 ----
  #ifdef RX_ENABLE_LOCKS
  	    AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
! #ifdef notdef
! 	    code = RXAFS_InlineBulkStatus(tcp->id, &fidParm, &statParm,
! 					  &cbParm, &volSync);
! 	    if (code == RXGEN_OPCODE) {
! #endif
! 		code = RXAFS_BulkStatus(tcp->id, &fidParm, &statParm, &cbParm,
! 					&volSync);
! 		inlinebulk=0;
! #ifdef notdef
! 	    } else {
! 		inlinebulk=1;
! 	    }
! #endif
! 
  #ifdef RX_ENABLE_LOCKS
  	    AFS_GLOCK();
  #endif /* RX_ENABLE_LOCKS */
***************
*** 680,685 ****
--- 693,700 ----
       * We also have to take into account racing token revocations.
       */
      for(i=0; i<fidIndex; i++) {
+ 	if ((&statsp[i])->errorCode) 
+ 	    continue;
  	afid.Cell = adp->fid.Cell;
  	afid.Fid.Volume = adp->fid.Fid.Volume;
  	afid.Fid.Vnode = fidsp[i].Vnode;
***************
*** 846,853 ****
--- 861,880 ----
      if ( volp )
  	afs_PutVolume(volp, READ_LOCK);
      
+     /* If we did the InlineBulk RPC pull out the return code */
+     if (inlinebulk) {
+ 	if ((&statsp[0])->errorCode) {
+ 	    afs_Analyze(tcp, (&statsp[0])->errorCode, &adp->fid, areqp, 
+ 			AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, 
+ 			(struct cell *)0);
+ 	    code = (&statsp[0])->errorCode;
+ 	}
+     } else {
+ 	code = 0;
+     }
      osi_FreeLargeSpace(statMemp);
      osi_FreeLargeSpace(cbfMemp);
+     return code;
  }
  
  /* was: (AFS_DEC_ENV) || defined(AFS_OSF30_ENV) || defined(AFS_NCR_ENV) */
***************
*** 885,890 ****
--- 912,918 ----
      char *tname = (char *)0;
      register struct vcache *tvc=0;
      register afs_int32 code;
+     register afs_int32 bulkcode = 0;
      int pass = 0, hit = 0;
      long dirCookie;
      extern afs_int32 afs_mariner;			/*Writing activity to log?*/
***************
*** 892,897 ****
--- 920,926 ----
      afs_hyper_t versionNo;
      int no_read_access = 0;
      struct sysname_info sysState;   /* used only for @sys checking */
+     int dynrootRetry = 1;
  
      AFS_STATCNT(afs_lookup);
  #ifdef	AFS_OSF_ENV
***************
*** 903,909 ****
      *avcp = (struct vcache *) 0;   /* Since some callers don't initialize it */
  
      if (code = afs_InitReq(&treq, acred)) { 
!       goto done;
      }
  
      /* come back to here if we encounter a non-existent object in a read-only
--- 932,938 ----
      *avcp = (struct vcache *) 0;   /* Since some callers don't initialize it */
  
      if (code = afs_InitReq(&treq, acred)) { 
! 	goto done;
      }
  
      /* come back to here if we encounter a non-existent object in a read-only
***************
*** 911,920 ****
  
    redo:
      *avcp = (struct vcache *) 0;   /* Since some callers don't initialize it */
  
      if (!(adp->states & CStatd)) {
! 	if (code = afs_VerifyVCache2(adp, &treq))
! 	  goto done;
      }
      else code = 0;
  
--- 940,951 ----
  
    redo:
      *avcp = (struct vcache *) 0;   /* Since some callers don't initialize it */
+     bulkcode = 0;
  
      if (!(adp->states & CStatd)) {
! 	if (code = afs_VerifyVCache2(adp, &treq)) {
! 	    goto done;
! 	}
      }
      else code = 0;
  
***************
*** 947,953 ****
  	*avcp = tvc;
  	code = (tvc ? 0 : ENOENT);
  	hit = 1;
! 	if (tvc && !tvc->vrefCount) {
  	    osi_Panic("TT1");
  	}
  	if (code) {
--- 978,984 ----
  	*avcp = tvc;
  	code = (tvc ? 0 : ENOENT);
  	hit = 1;
! 	if (tvc && !VREFCOUNT(tvc)) {
  	    osi_Panic("TT1");
  	}
  	if (code) {
***************
*** 980,992 ****
  	ObtainReadLock(&afs_xvcache);	
  	osi_vnhold(adp, 0);
  	ReleaseReadLock(&afs_xvcache);	
!       code = 0;
!       *avcp = tvc = adp;
!       hit = 1;
! 	if (adp && !adp->vrefCount) {
  	    osi_Panic("TT2");
  	}
!       goto done;
      }
  
      Check_AtSys(adp, aname, &sysState, &treq);
--- 1011,1023 ----
  	ObtainReadLock(&afs_xvcache);	
  	osi_vnhold(adp, 0);
  	ReleaseReadLock(&afs_xvcache);	
! 	code = 0;
! 	*avcp = tvc = adp;
! 	hit = 1;
! 	if (adp && !VREFCOUNT(adp)) {
  	    osi_Panic("TT2");
  	}
! 	goto done;
      }
  
      Check_AtSys(adp, aname, &sysState, &treq);
***************
*** 1090,1098 ****
      }
      tname = sysState.name;
  
-     ReleaseReadLock(&adp->lock);
      afs_PutDCache(tdc);
  
      /* new fid has same cell and volume */
      tfid.Cell = adp->fid.Cell;
      tfid.Fid.Volume = adp->fid.Fid.Volume;
--- 1121,1147 ----
      }
      tname = sysState.name;
  
      afs_PutDCache(tdc);
  
+     if (code == ENOENT && afs_IsDynroot(adp) && dynrootRetry) {
+ 	struct cell *tcell;
+ 
+ 	ReleaseReadLock(&adp->lock);
+ 	dynrootRetry = 0;
+ 	if (*tname == '.')
+ 	    tcell = afs_GetCellByName(tname + 1, READ_LOCK);
+ 	else
+ 	    tcell = afs_GetCellByName(tname, READ_LOCK);
+ 	if (tcell) {
+ 	    afs_PutCell(tcell, READ_LOCK);
+ 	    afs_RefreshDynroot();
+ 	    if (tname != aname && tname) osi_FreeLargeSpace(tname);
+ 	    goto redo;
+ 	}
+     } else {
+ 	ReleaseReadLock(&adp->lock);
+     }
+ 
      /* new fid has same cell and volume */
      tfid.Cell = adp->fid.Cell;
      tfid.Fid.Volume = adp->fid.Fid.Volume;
***************
*** 1110,1116 ****
      /* prefetch some entries, if the dir is currently open.  The variable
       * dirCookie tells us where to start prefetching from.
       */
!     if (AFSDOBULK && adp->opens > 0 && !(adp->states & CForeign)) {
          afs_int32 retry;
  	/* if the entry is not in the cache, or is in the cache,
  	 * but hasn't been statd, then do a bulk stat operation.
--- 1159,1165 ----
      /* prefetch some entries, if the dir is currently open.  The variable
       * dirCookie tells us where to start prefetching from.
       */
!     if (AFSDOBULK && adp->opens > 0 && !(adp->states & CForeign) && !afs_IsDynroot(adp)) {
          afs_int32 retry;
  	/* if the entry is not in the cache, or is in the cache,
  	 * but hasn't been statd, then do a bulk stat operation.
***************
*** 1122,1144 ****
  	   ReleaseReadLock(&afs_xvcache);	
          } while (tvc && retry);
  
! 	if (!tvc || !(tvc->states & CStatd)) {
! 	    afs_DoBulkStat(adp, dirCookie, &treq);
! 	}
  
  	/* if the vcache isn't usable, release it */
  	if (tvc && !(tvc->states & CStatd)) {
  	    afs_PutVCache(tvc);
  	    tvc = (struct vcache *) 0;
  	}
      }
!     else tvc = (struct vcache *) 0;
!     
      /* now get the status info, if we don't already have it */
      /* This is kind of weird, but we might wind up accidentally calling
       * RXAFS_Lookup because we happened upon a file which legitimately
       * has a 0 uniquifier. That is the result of allowing unique to wrap
!      * to 0. This was fixed in AFS 3.4. For CForeigh, Unique == 0 means that
       * the file has not yet been looked up.
       */
      if (!tvc) {
--- 1171,1196 ----
  	   ReleaseReadLock(&afs_xvcache);	
          } while (tvc && retry);
  
! 	if (!tvc || !(tvc->states & CStatd)) 
! 	    bulkcode = afs_DoBulkStat(adp, dirCookie, &treq);
! 	else 
! 	    bulkcode = 0;
  
  	/* if the vcache isn't usable, release it */
  	if (tvc && !(tvc->states & CStatd)) {
  	    afs_PutVCache(tvc);
  	    tvc = (struct vcache *) 0;
  	}
+     } else {
+ 	tvc = (struct vcache *) 0;
+ 	bulkcode = 0;
      }
! 
      /* now get the status info, if we don't already have it */
      /* This is kind of weird, but we might wind up accidentally calling
       * RXAFS_Lookup because we happened upon a file which legitimately
       * has a 0 uniquifier. That is the result of allowing unique to wrap
!      * to 0. This was fixed in AFS 3.4. For CForeign, Unique == 0 means that
       * the file has not yet been looked up.
       */
      if (!tvc) {
***************
*** 1147,1156 ****
  	    tvc = afs_LookupVCache(&tfid, &treq, &cached, WRITE_LOCK, 
  				   adp, tname);
         } 
!        if (!tvc) {  /* lookup failed or wasn't called */
! 	    tvc = afs_GetVCache(&tfid, &treq, &cached, (struct vcache*)0,
! 				WRITE_LOCK);
!        }
      } /* if !tvc */
      } /* sub-block just to reduce stack usage */
  
--- 1199,1208 ----
  	    tvc = afs_LookupVCache(&tfid, &treq, &cached, WRITE_LOCK, 
  				   adp, tname);
         } 
!        if (!tvc && !bulkcode) {  /* lookup failed or wasn't called */
! 	   tvc = afs_GetVCache(&tfid, &treq, &cached, (struct vcache*)0,
! 			       WRITE_LOCK);
!        } 
      } /* if !tvc */
      } /* sub-block just to reduce stack usage */
  
***************
*** 1174,1179 ****
--- 1226,1232 ----
  	    ReleaseWriteLock(&tvc->lock);
  
  	    if (code) {
+ 		afs_PutVCache(tvc, WRITE_LOCK);
  		if (tvolp) afs_PutVolume(tvolp, WRITE_LOCK);
  		goto done;
  	    }
***************
*** 1225,1231 ****
  	    }
  	}
  	*avcp = tvc;
! 	if (tvc && !tvc->vrefCount) {
  	    osi_Panic("TT3");
  	}
  	code = 0;
--- 1278,1284 ----
  	    }
  	}
  	*avcp = tvc;
! 	if (tvc && !VREFCOUNT(tvc)) {
  	    osi_Panic("TT3");
  	}
  	code = 0;
***************
*** 1293,1298 ****
--- 1346,1352 ----
  #endif
  	}
      }
+     if (bulkcode) code = bulkcode; else 
      code = afs_CheckCode(code, &treq, 19);
      if (code) {
         /* If there is an error, make sure *avcp is null.
Index: openafs/src/afs/VNOPS/afs_vnop_remove.c
diff -c openafs/src/afs/VNOPS/afs_vnop_remove.c:1.4 openafs/src/afs/VNOPS/afs_vnop_remove.c:1.4.4.1
*** openafs/src/afs/VNOPS/afs_vnop_remove.c:1.4	Thu Jul 12 15:58:22 2001
--- openafs/src/afs/VNOPS/afs_vnop_remove.c	Sat Oct 13 00:20:26 2001
***************
*** 22,28 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.4 2001/07/12 19:58:22 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 22,28 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.4.4.1 2001/10/13 04:20:26 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 317,328 ****
      osi_dnlc_remove ( adp, aname, tvc);
      if (tvc) afs_symhint_inval(tvc);
  
!     Tadp1 = adp; Tadpr = adp->vrefCount; Ttvc = tvc; Tnam = aname; Tnam1 = 0;
!     if (tvc) Ttvcr = tvc->vrefCount;
  #ifdef	AFS_AIX_ENV
!     if (tvc && (tvc->vrefCount > 2) && tvc->opens > 0 && !(tvc->states & CUnlinked)) {
  #else
!     if (tvc && (tvc->vrefCount > 1) && tvc->opens > 0 && !(tvc->states & CUnlinked)) {
  #endif
  	char *unlname = newname();
  
--- 317,328 ----
      osi_dnlc_remove ( adp, aname, tvc);
      if (tvc) afs_symhint_inval(tvc);
  
!     Tadp1 = adp; Tadpr = VREFCOUNT(adp); Ttvc = tvc; Tnam = aname; Tnam1 = 0;
!     if (tvc) Ttvcr = VREFCOUNT(tvc);
  #ifdef	AFS_AIX_ENV
!     if (tvc && (VREFCOUNT(tvc) > 2) && tvc->opens > 0 && !(tvc->states & CUnlinked)) {
  #else
!     if (tvc && (VREFCOUNT(tvc) > 1) && tvc->opens > 0 && !(tvc->states & CUnlinked)) {
  #endif
  	char *unlname = newname();
  
Index: openafs/src/afs/VNOPS/afs_vnop_strategy.c
diff -c openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.7 openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.7.2.1
*** openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.7	Tue Aug  7 20:03:32 2001
--- openafs/src/afs/VNOPS/afs_vnop_strategy.c	Sat Oct 13 00:20:26 2001
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.7 2001/08/08 00:03:32 shadow Exp $");
  
  #if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
  
--- 15,21 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.7.2.1 2001/10/13 04:20:26 shadow Exp $");
  
  #if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
  
***************
*** 132,138 ****
--- 132,142 ----
  	tuio.afsio_offset = (u_int) dbtob(abp->b_blkno);
  #ifdef	AFS_SUN5_ENV
  	tuio._uio_offset._p._u = 0;
+ #ifdef	AFS_SUN59_ENV
+ 	tuio.uio_limit = curproc->p_fsz_ctl.rlim_cur;
+ #else
  	tuio.uio_limit = u.u_rlimit[RLIMIT_FSIZE].rlim_cur;
+ #endif
  #endif
  #else
  	tuio.afsio_offset = DEV_BSIZE * abp->b_blkno;
Index: openafs/src/afs/VNOPS/afs_vnop_write.c
diff -c openafs/src/afs/VNOPS/afs_vnop_write.c:1.8.2.2 openafs/src/afs/VNOPS/afs_vnop_write.c:1.8.2.3
*** openafs/src/afs/VNOPS/afs_vnop_write.c:1.8.2.2	Thu Sep 20 01:10:47 2001
--- openafs/src/afs/VNOPS/afs_vnop_write.c	Sat Oct 13 00:20:26 2001
***************
*** 20,26 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.8.2.2 2001/09/20 05:10:47 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 20,26 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.8.2.3 2001/10/13 04:20:26 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 909,915 ****
  	ReleaseWriteLock(&avc->lock);
      }
  #ifdef	AFS_OSF_ENV
!     if ((avc->vrefCount <= 2) && (avc->states & CUnlinked)) {
  	afs_remunlink(avc, 1);	/* ignore any return code */
      }
  #endif
--- 909,915 ----
  	ReleaseWriteLock(&avc->lock);
      }
  #ifdef	AFS_OSF_ENV
!     if ((VREFCOUNT(avc) <= 2) && (avc->states & CUnlinked)) {
  	afs_remunlink(avc, 1);	/* ignore any return code */
      }
  #endif
Index: openafs/src/afsd/Makefile.in
diff -c openafs/src/afsd/Makefile.in:1.6.2.1 openafs/src/afsd/Makefile.in:1.6.2.2
*** openafs/src/afsd/Makefile.in:1.6.2.1	Wed Sep 12 01:03:53 2001
--- openafs/src/afsd/Makefile.in	Sat Oct 13 00:20:44 2001
***************
*** 103,108 ****
--- 103,110 ----
  			${INSTALL} -f afs.rc.solaris.2.7 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
  		sun4x_58 ) \
  			${INSTALL} -f afs.rc.solaris.2.8 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
+ 		sun4x_59 ) \
+ 			${INSTALL} -f afs.rc.solaris.2.9 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
                  sun4x_5? ) \
                          ${INSTALL} -f afs.rc.solaris.2_5 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
  		alpha_osf* ) \
Index: openafs/src/afsd/afs.conf.linux
diff -c openafs/src/afsd/afs.conf.linux:1.4 openafs/src/afsd/afs.conf.linux:1.4.4.1
*** openafs/src/afsd/afs.conf.linux:1.4	Mon Apr 30 11:18:39 2001
--- openafs/src/afsd/afs.conf.linux	Sat Oct 13 00:20:44 2001
***************
*** 14,31 ****
  AFS_SERVER=off
  
  # AFS client configuration options:
  LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
  MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
  SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
  OPTIONS=$MEDIUM
  
  # Set to "-verbose" for a lot of debugging information from afsd. Only
  # useful for debugging as it prints _a lot_ of information.
  VERBOSE=
- 
- # OPTIONS are the options passed to afsd.
- OPTIONS="$OPTIONS $VERBOSE"
- 
  
  # Sample server preferences function. Set server preferences using this.
  # afs_serverprefs() {
--- 14,43 ----
  AFS_SERVER=off
  
  # AFS client configuration options:
+ XXLARGE="-stat 4000 -dcache 4000 -daemons 6 -volumes 256 -files 50000"
+ XLARGE="-stat 3600 -dcache 3600 -daemons 5 -volumes 196 -files 50000"
  LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
  MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
  SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
+ 
+ # cachesize and according options are set by /afs/rc.d/init.d/afs
+ #   * if you set CACHESIZE to "AUTOMATIC", it will automatically be chosen
+ #     deduced by parition sizes (does not work if your cache is on / or /usr)
+ #   * if you set OPTIONS to "AUTOMATIC", the init script will choose a set
+ #     of options based on the cache size
+ # otherwise the values specified here will be used. So be careful!
+ # Note: if you leave these as-is, no changes are made.
+ CACHESIZE=
  OPTIONS=$MEDIUM
  
+ # you should never need to change these settings
+ AFSDIR=/afs
+ CACHEDIR=/usr/vice/cache
+ CACHEINFO=/usr/vice/etc/cacheinfo
+ 
  # Set to "-verbose" for a lot of debugging information from afsd. Only
  # useful for debugging as it prints _a lot_ of information.
  VERBOSE=
  
  # Sample server preferences function. Set server preferences using this.
  # afs_serverprefs() {
Index: openafs/src/afsd/afs.rc.linux
diff -c openafs/src/afsd/afs.rc.linux:1.2 openafs/src/afsd/afs.rc.linux:1.2.8.1
*** openafs/src/afsd/afs.rc.linux:1.2	Sat Nov  4 05:03:33 2000
--- openafs/src/afsd/afs.rc.linux	Sat Oct 13 00:20:44 2001
***************
*** 9,36 ****
  # AFS	Start and stop AFS components
  # 
  # 
! # chkconfig: 345 60 20
  # description:  AFS is a distributed file system which provides location
  #		transparency, caching and secure authentication.
  #		Additional configuration can be done in the /etc/sysconfig/afs
  #		file. Read the documentation in that file for more information.
  #
  # Note that AFS does not use a pid file in /var/run. It is turned off by
  # unmounting /afs.
  
  
  # Gather up options and post startup script name, if present
! if [ -f /etc/sysconfig/afs ]; then
! 	. /etc/sysconfig/afs
  fi
  
  # is_on returns 1 if value of arg is "on"
  is_on() {
  	if  test "$1" = "on" ; then return 0
  	else return 1
! 	fi
  }
  
  # If choose_client can't correctly determine which client to use, set
  # LIBAFS manually.
  choose_client() {
--- 9,93 ----
  # AFS	Start and stop AFS components
  # 
  # 
! # chkconfig: 35 60 20
  # description:  AFS is a distributed file system which provides location
  #		transparency, caching and secure authentication.
  #		Additional configuration can be done in the /etc/sysconfig/afs
  #		file. Read the documentation in that file for more information.
  #
+ # The following section is used at least by SuSE insserv(8)
+ ### BEGIN INIT INFO
+ # Provides: afs
+ # Required-Start: $network
+ # Required-Stop: $network
+ # Default-Start: 3 5
+ # Default-Stop: 0 1 2 6
+ # Description:  AFS is a distributed file system which provides location
+ #              transparency, caching and secure authentication.
+ #              Additional configuration can be done in the /etc/sysconfig/afs
+ #              file. Read the documentation in that file for more information.
+ ### END INIT INFO
+ #
  # Note that AFS does not use a pid file in /var/run. It is turned off by
  # unmounting /afs.
  
  
+ # check for special bootup functions
+ if [ -f /etc/rc.d/init.d/functions ] ; then
+ 	. /etc/rc.d/init.d/functions
+ 	afs_rh=1
+ else
+ 	# special (RedHat) functions not available...
+ 	# so I provide neccessary replacements (e.g. for SuSE)
+ 
+ 	function echo_failure () { echo -n " - failed." ; }
+ 
+ 	function echo_success () { echo -n " - successful." ; }
+ 
+ 	# these are hopefully all functions I use...
+ fi
+ 
+ runcmd() {
+    echo -n "$1 "
+    shift
+    if [ "$BOOTUP" = "color" ]; then
+       $* && echo_success || echo_failure
+    else
+       $*
+    fi
+    echo
+ }
+ 
+ SYSCNF=/etc/sysconfig/afs
+ 
  # Gather up options and post startup script name, if present
! if [ -f $SYSCNF ] ; then
! 	. $SYSCNF
  fi
  
+ CACHEINFO=${CACHEINFO:-/usr/vice/etc/cacheinfo}
+ CACHE=${CACHEDIR:-/usr/vice/cache}
+ AFS=${AFSDIR:-/afs}
+ 
  # is_on returns 1 if value of arg is "on"
  is_on() {
  	if  test "$1" = "on" ; then return 0
  	else return 1
!         fi
  }
  
+ on_network() {
+     ADDRS=`ifconfig -a | grep 'inet addr' | grep -v 127.0.0.1 | wc -l`
+     if [ "$ADDRS" = "" ]; then
+        echo afs: No interfaces with IP address 1>&2
+        return 1
+     elif [ $ADDRS = 0 ]; then
+        echo afs: No interfaces with IP address 1>&2
+        return 1
+     fi
+     return 0
+ }
+ 
  # If choose_client can't correctly determine which client to use, set
  # LIBAFS manually.
  choose_client() {
***************
*** 106,112 ****
  	esac
  }
  
- 
  MODLOADDIR=/usr/vice/etc/modload
  # load_client loads the AFS client module if it's not already loaded. 
  load_client() {
--- 163,168 ----
***************
*** 126,133 ****
--- 182,229 ----
  	/sbin/insmod ${PREFIX:+-P $PREFIX} -f -m $MODLOADDIR/$LIBAFS > $MODLOADDIR/libafs.map 2>&1
  }
  
+ generate_cacheinfo() {
+     if [ "$CACHESIZE" = "AUTOMATIC" ]; then
+ 	LINE=`df -k $CACHE | tail -1`
+ 	PART=`echo $LINE | awk '{ if ( ($NF != "/usr")  && ($NF != "/") ) print $NF; else print "NONE";}'`
+ 	if [ "$PART" = "NONE" ]; then
+ 	    echo "$CACHE or /usr/vice is not a separate partition"
+ 	    echo "you have to change the cachesize in $SYSCNF by hand"
+ 	    exit 1
+ 	else
+ 	    PARTSIZE=`echo $LINE | awk '{print $2}'`
+ 	    CACHESIZE=`echo $PARTSIZE | awk '{printf "%d",int(($1*.8)/1000)*1000}'`
+ 	fi
+     fi
+     if [ "x$CACHESIZE" != "x" ]; then
+ 	echo $AFS:$CACHE:$CACHESIZE >$CACHEINFO
+ 	chmod 0644 $CACHEINFO
+     else
+ 	CACHESIZE=`awk -F: '{print $3}' < $CACHEINFO`
+     fi
+ }
+ 
+ choose_afsdoptions() {
+ 	if [ -z "$OPTIONS" -o "$OPTIONS" = "AUTOMATIC" ]; then
+ 		if [ $CACHESIZE -lt 131072 ]; then
+ 			OPTIONS=$SMALL
+ 		elif [ $CACHESIZE -lt 524288 ]; then
+ 			OPTIONS=$MEDIUM
+ 		elif [ $CACHESIZE -lt 1048576 ]; then
+ 			OPTIONS=$LARGE
+ 		elif [ $CACHESIZE -lt 2097152 ]; then
+ 			OPTIONS=$XLARGE
+ 		else
+ 			OPTIONS=$XXLARGE
+ 		fi
+ 	fi
+ 	AFSD_OPTIONS="$OPTIONS $VERBOSE"
+ }
+ 
  case "$1" in 
    start)
+     if [ ! "$afs_rh" -o ! -f /var/lock/subsys/afs ]; then
+ 	on_network || exit 1
  	# Load kernel extensions
  	if  load_client  ; then :
  	else
***************
*** 139,171 ****
  	# Start bosserver, it if exists
  	if  is_on $AFS_SERVER && test -x /usr/afs/bin/bosserver  ; then
  		/usr/afs/bin/bosserver 
  	fi
  
  	# Start AFS client
  	if  is_on $AFS_CLIENT && test -x /usr/vice/etc/afsd  ; then
! 		/usr/vice/etc/afsd ${OPTIONS}
! 
! 		# Start AFS version of inetd.conf if present.
! 		if  test -f /usr/afsws/etc/inetd.conf -a -x /usr/afsws/etc/inetd.afs ; then
! 			/usr/afsws/etc/inetd.afs /usr/afsws/etc/inetd.conf
! 		fi
  		$AFS_POST_INIT
  	fi
! 
  	;;
  
    stop)
  	# Stop AFS
  	echo "Stopping AFS services..... "
  
  	if  is_on $AFS_CLIENT  ; then
! 		killall inetd.afs
  		umount /afs
  	fi
  
! 	if  is_on $AFS_SERVER && test -x /usr/afs/bin/bos ; then
  		echo "Stopping AFS bosserver"
! 		/usr/afs/bin/bos shutdown localhost -localauth -wait
  		killall -HUP bosserver
  	fi
  
--- 235,270 ----
  	# Start bosserver, it if exists
  	if  is_on $AFS_SERVER && test -x /usr/afs/bin/bosserver  ; then
  		/usr/afs/bin/bosserver 
+ 		test "$afs_rh" && touch /var/lock/subsys/afs
  	fi
  
  	# Start AFS client
  	if  is_on $AFS_CLIENT && test -x /usr/vice/etc/afsd  ; then
! 		generate_cacheinfo
! 		choose_afsdoptions
! 		/usr/vice/etc/afsd ${AFSD_OPTIONS}
! 		test "$afs_rh" && touch /var/lock/subsys/afs
  		$AFS_POST_INIT
  	fi
!     fi
  	;;
  
    stop)
+     if [ ! "$afs_rh" -o -f /var/lock/subsys/afs ]; then
  	# Stop AFS
  	echo "Stopping AFS services..... "
  
  	if  is_on $AFS_CLIENT  ; then
! 		if [ -x /usr/vice/etc/killafs ] ; then
! 			runcmd "Sending all processes using /afs the TERM signal ..." /usr/vice/etc/killafs TERM
! 			runcmd "Sending all processes using /afs the KILL signal ..." /usr/vice/etc/killafs KILL
! 		fi
  		umount /afs
  	fi
  
! 	if  is_on $AFS_SERVER && test -x /usr/bin/bos ; then
  		echo "Stopping AFS bosserver"
! 		/usr/bin/bos shutdown localhost -localauth -wait
  		killall -HUP bosserver
  	fi
  
***************
*** 175,184 ****
  		/sbin/rmmod $LIBAFS
  	fi
  
  	;;
  
    *)
! 	echo Usage: 'afs <start|stop>'
  
  esac
  
--- 274,294 ----
  		/sbin/rmmod $LIBAFS
  	fi
  
+ 	rm -f /var/lock/subsys/afs
+     fi
  	;;
  
+   restart)
+ 	# Restart AFS
+ 	$0 stop
+ 	$0 start
+ 	;;
+ 
    *)
! 	echo Usage: 'afs <start|stop|restart>'
  
  esac
  
+ exit 0
+ 
+ action fool the Red Hat initscripts
Index: openafs/src/afsd/afs.rc.solaris.2.9
diff -c /dev/null openafs/src/afsd/afs.rc.solaris.2.9:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:12 2001
--- openafs/src/afsd/afs.rc.solaris.2.9	Sat Oct 13 00:30:53 2001
***************
*** 0 ****
--- 1,188 ----
+ #!/bin/sh
+ #
+ # afs.rc: rc script for AFS on Solaris 2.x platforms
+ #
+ # Install this script as /etc/init.d/afs.rc
+ # then make links like this:
+ # ln -s ../init.d/afs.rc /etc/rc0.d/K66afs
+ # ln -s ../init.d/afs.rc /etc/rc2.d/S70afs 
+ #
+ CONFIG=/usr/vice/etc/config
+ AFSDOPT=$CONFIG/afsd.options
+ PACKAGE=$CONFIG/package.options
+ 
+ LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128 -afsdb"
+ MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70 -afsdb"
+ SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50 -afsdb"
+ 
+ if [ -f $AFSDOPT ]; then
+     OPTIONS=`cat $AFSDOPT`
+ else
+     OPTIONS=$MEDIUM
+ fi
+ 
+ # Need the commands ps, awk, kill, sleep
+ PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
+ 
+ killproc() {            # kill the named process(es)
+       awkfield2='$2'
+         pid=`ps -ef | awk "/$1/ && ! /awk/ {print $awkfield2}"`
+         [ "$pid" != "" ] && kill -KILL $pid
+ }
+ 
+ case $1 in
+ 'start')
+ 
+ #
+ # Make sure afs exists in /etc/name_to_sysnum
+ #
+ if grep -s "afs" /etc/name_to_sysnum > /dev/null; then
+     echo "Entry for afs already exists in /etc/name_to_sysnum"
+ else
+     echo "Creating entry for afs in /etc/name_to_sysnum"
+     cp /etc/name_to_sysnum /etc/name_to_sysnum.orig
+     sed '/nfs/i\
+ afs			65' /etc/name_to_sysnum > /tmp/name_to_sysnum
+     mv /tmp/name_to_sysnum /etc/name_to_sysnum
+     echo "Rebooting now for new /etc/name_to_sysnum to take effect"
+     reboot
+ fi
+ 
+ ## Check to see that /bin/isalist exists and is executable
+ if [ ! -x /bin/isalist ] ;then
+       echo "/bin/isalist not executable"
+       exit 1;
+ fi
+ 
+ ## Determine if we are running the 64 bit OS
+ ## If sparcv9 then the location of the afs and nfs extensions differ
+ 
+ case `/bin/isalist` in
+     *sparcv9* )
+               nfssrv=/kernel/misc/sparcv9/nfssrv
+               afs=/kernel/fs/sparcv9/afs ;;
+           * )
+               nfssrv=/kernel/misc/nfssrv
+               afs=/kernel/fs/afs ;;
+ esac
+ 
+ 
+ #
+ # Load kernel extensions
+ #
+ # nfssrv has to be loaded first
+ 
+ 
+ if [ -f $nfssrv ]; then
+       echo "Loading NFS server kernel extensions"
+       modload $nfssrv
+ else
+       echo "$nfssrv does not exist. Skipping AFS startup."
+       exit 1
+ fi
+ 
+ ## Load AFS kernel extensions
+ 
+ if [ -f $afs ]; then
+       echo "Loading AFS kernel extensions"
+       modload $afs
+ else
+       echo "$afs does not exist. Skipping AFS startup."
+       exit 1
+ fi
+ 
+ #
+ # Start the AFS server processes if a bosserver exists
+ #
+ 
+ if [ -x /usr/afs/bin/bosserver ]; then
+       echo "Starting AFS Server processes"
+       /usr/afs/bin/bosserver &
+       OPTIONS="$OPTIONS -nosettime"
+       sleep 30
+ fi
+ 
+ #
+ # Check that all of the client configuration files exist
+ #
+ 
+ for file in /usr/vice/etc/afsd /usr/vice/etc/cacheinfo \
+           /usr/vice/etc/ThisCell /usr/vice/etc/CellServDB
+ do
+       if [ ! -f ${file} ]; then
+               echo "${file} does not exist. Not starting AFS client."
+               exit 1
+       fi
+ done
+ 
+ #
+ # Check that the root directory for AFS (/afs) 
+ # and the cache directory (/usr/vice/cache) both exist
+ #
+ 
+ for dir in `awk -F: '{print $1, $2}' /usr/vice/etc/cacheinfo`
+ do
+       if [ ! -d ${dir} ]; then
+               echo "${dir} does not exist. Not starting AFS client."
+               exit 2
+       fi
+ done
+ 
+ echo "Starting afsd"
+ /usr/vice/etc/afsd $OPTIONS
+ 
+ #
+ # Run package to update the disk
+ #
+ if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
+       /usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1
+ case $? in
+ 0)
+       (echo "Package completed successfully") > /dev/console 2>&1
+       date > /dev/console 2>&1
+       ;;
+ 4)
+       (echo "Rebooting to restart system") > /dev/console 2>&1
+       sync
+       /etc/reboot
+       ;;
+ *)
+       (echo "Package update failed; continuing") > /dev/console 2>&1
+       ;;
+ esac
+  
+ fi
+ 
+ #
+ # Start AFS inetd services
+ # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
+ #
+ if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
+       /usr/sbin/inetd.afs /etc/inetd.conf.afs
+ fi
+ 
+ echo ;;
+ 
+ 'stop')
+ 
+ #
+ # Stop the AFS inetd and server processes
+ # Note that the afsd processes cannot be killed
+ #
+ 
+ echo "Killing inetd.afs"
+ killproc inetd.afs
+ 
+ bosrunning=`ps -ef | awk '/bosserver/ && ! /awk/'`
+ if [ "${bosrunning}" != "" ]; then
+       echo "Shutting down AFS server processes"
+       /usr/afs/bin/bos shutdown localhost -localauth -wait
+       echo "Killing AFS bosserver"
+       killproc bosserver
+ fi
+ 
+ echo ;;
+ 
+ *)    echo "Invalid option supplied to $0"
+       exit 1;;
+ esac
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.13.2.1 openafs/src/afsd/afsd.c:1.13.2.2
*** openafs/src/afsd/afsd.c:1.13.2.1	Wed Sep 19 18:25:23 2001
--- openafs/src/afsd/afsd.c	Sat Oct 13 00:20:44 2001
***************
*** 55,61 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afsd/afsd.c,v 1.13.2.1 2001/09/19 22:25:23 shadow Exp $");
  
  #define VFS 1
  
--- 55,61 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afsd/afsd.c,v 1.13.2.2 2001/10/13 04:20:44 shadow Exp $");
  
  #define VFS 1
  
***************
*** 113,118 ****
--- 113,126 ----
  #include <sys/vfs.h>
  #endif
  
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ 
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+ 
  #include <netinet/in.h>
  #include <afs/afs_args.h>
  #include <afs/cellconfig.h>
***************
*** 231,236 ****
--- 239,245 ----
  #ifdef AFS_AFSDB_ENV
  static int enable_afsdb = 0;		/* enable AFSDB support */
  #endif
+ static int enable_dynroot = 0;		/* enable dynroot support */
  #ifdef notdef
  static int inodes = 60;		        /* VERY conservative, but has to be */
  #endif
***************
*** 1058,1063 ****
--- 1067,1076 ----
      struct afsconf_cell acellInfo;
      int i;
  
+     kernelMsg[0] = 0;
+     kernelMsg[1] = 0;
+     acellName[0] = '\0';
+ 
      while (1) {
  	/* On some platforms you only get 4 args to an AFS call */
  	int sizeArg = ((sizeof acellName) << 16) | (sizeof kernelMsg);
***************
*** 1067,1072 ****
--- 1080,1088 ----
  	    continue;
  	}
  
+ 	if (*acellName == 1)	/* Shutting down */
+ 	    break;
+ 
  	code = afsconf_GetAfsdbInfo(acellName, 0, &acellInfo);
  	if (code) {
  	    kernelMsg[0] = 0;
***************
*** 1079,1086 ****
--- 1095,1106 ----
  		kernelMsg[1] = 0;
  	    for (i=0; i<acellInfo.numServers; i++)
  		kernelMsg[i+2] = acellInfo.hostAddr[i].sin_addr.s_addr;
+ 	    strncpy(acellName, acellInfo.name, sizeof(acellName));
+ 	    acellName[sizeof(acellName) - 1] = '\0';
  	}    
      }
+ 
+     exit(1);
  }
  #endif
  
***************
*** 1288,1293 ****
--- 1308,1317 ----
  	    nFilesPerDir = res;
  	}
      }
+     if (as->parms[26].items) {
+ 	/* -dynroot */
+ 	enable_dynroot = 1;
+     }
  
      /*
       * Pull out all the configuration info for the workstation's AFS cache and
***************
*** 1519,1524 ****
--- 1543,1556 ----
      }
  #endif
  
+     if (enable_dynroot) {
+ 	if (afsd_verbose)
+ 	    printf("%s: Enabling dynroot support in kernel.\n", rn);
+ 	code = call_syscall(AFSOP_SET_DYNROOT, 1);
+ 	if (code)
+ 	    printf("%s: Error enabling dynroot support.\n", rn);
+     }
+ 
      /* Initialize AFS daemon threads. */
      if (afsd_verbose)
  	printf("%s: Forking AFS daemon.\n", rn);
***************
*** 1870,1875 ****
--- 1902,1908 ----
  #endif
  		), "Enable AFSDB support");
      cmd_AddParm(ts, "-files_per_subdir", CMD_SINGLE, CMD_OPTIONAL, "log(2) of the number of cache files per cache subdirectory");
+     cmd_AddParm(ts, "-dynroot", CMD_FLAG, CMD_OPTIONAL, "Enable dynroot support");
      return (cmd_Dispatch(argc, argv));
  }
  
***************
*** 1951,1956 ****
--- 1984,1999 ----
  long param1, param2, param3, param4, param5, param6, param7;
  {
      int error;
+ #ifdef AFS_LINUX20_ENV
+     long eparm[4];
+ 
+     eparm[0] = param4;
+     eparm[1] = param5;
+     eparm[2] = param6;
+     eparm[3] = param7;
+ 
+     param4 = eparm;
+ #endif
  
      error = syscall(AFS_SYSCALL, AFSCALL_CALL, param1, param2, param3, param4, param5, param6, param7);
      if (afsd_verbose) printf("SScall(%d, %d)=%d ", AFS_SYSCALL, AFSCALL_CALL, error);
Index: openafs/src/afsd/vsys.c
diff -c openafs/src/afsd/vsys.c:1.4 openafs/src/afsd/vsys.c:1.4.4.1
*** openafs/src/afsd/vsys.c:1.4	Thu Jul 12 15:58:22 2001
--- openafs/src/afsd/vsys.c	Sat Oct 13 00:20:44 2001
***************
*** 9,16 ****
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afsd/vsys.c,v 1.4 2001/07/12 19:58:22 shadow Exp $");
  
  #include <afs/afs_args.h>
  
--- 9,29 ----
  
  #include <afsconfig.h>
  #include <afs/param.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <ctype.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
  
! RCSID("$Header: /data/cvs/openafs/src/afsd/vsys.c,v 1.4.4.1 2001/10/13 04:20:44 shadow Exp $");
  
  #include <afs/afs_args.h>
  
***************
*** 46,49 ****
--- 59,63 ----
      }
      code = syscall(AFS_SYSCALL, parms[0], parms[1], parms[2], parms[3], parms[4], parms[5]);
      printf("code %d\n", code);
+     return 0;
  }
Index: openafs/src/audit/audit.h
diff -c openafs/src/audit/audit.h:1.3 openafs/src/audit/audit.h:1.3.6.1
*** openafs/src/audit/audit.h:1.3	Mon Feb 12 11:16:44 2001
--- openafs/src/audit/audit.h	Sat Oct 13 00:20:46 2001
***************
*** 173,178 ****
--- 173,179 ----
  #define ReleaseLockEvent	"AFS_SRX_RelLock"
  #define SetVolumeStatusEvent    "AFS_SRX_SetVolS"
  #define FlushCPSEvent           "AFS_SRX_FlusCPS"
+ #define InlineBulkFetchStatusEvent     "AFS_SRX_BIFchSt"
  #define PrivilegeEvent		"AFS_Priv"
  #define PrivSetID		"AFS_PrivSet"
  /* Next 5 lines on behalf of MR-AFS */
Index: openafs/src/auth/NTMakefile
diff -c openafs/src/auth/NTMakefile:1.3.4.1 openafs/src/auth/NTMakefile:1.3.4.2
*** openafs/src/auth/NTMakefile:1.3.4.1	Wed Sep 19 18:32:46 2001
--- openafs/src/auth/NTMakefile	Sat Oct 13 00:20:47 2001
***************
*** 74,80 ****
  	$(EXELIBDIR)\afslwp.lib \
  	$(EXELIBDIR)\afs\afsutil.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(EXELIBDIR)\afs\afsreg.lib
  
  
  $(SETKEY_EXEFILE): $(SETKEY_EXEOBJS) $(EXELIBS)
--- 74,81 ----
  	$(EXELIBDIR)\afslwp.lib \
  	$(EXELIBDIR)\afs\afsutil.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(EXELIBDIR)\afs\afsreg.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  
  
  $(SETKEY_EXEFILE): $(SETKEY_EXEOBJS) $(EXELIBS)
Index: openafs/src/auth/authcon.c
diff -c openafs/src/auth/authcon.c:1.6.4.1 openafs/src/auth/authcon.c:1.6.4.2
*** openafs/src/auth/authcon.c:1.6.4.1	Wed Sep 19 18:36:18 2001
--- openafs/src/auth/authcon.c	Sat Oct 13 00:20:47 2001
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/auth/authcon.c,v 1.6.4.1 2001/09/19 22:36:18 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/auth/authcon.c,v 1.6.4.2 2001/10/13 04:20:47 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
Index: openafs/src/auth/cellconfig.c
diff -c openafs/src/auth/cellconfig.c:1.14.2.1 openafs/src/auth/cellconfig.c:1.14.2.3
*** openafs/src/auth/cellconfig.c:1.14.2.1	Wed Sep 19 18:36:18 2001
--- openafs/src/auth/cellconfig.c	Wed Nov 14 22:30:15 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/auth/cellconfig.c,v 1.14.2.1 2001/09/19 22:36:18 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/auth/cellconfig.c,v 1.14.2.3 2001/11/15 03:30:15 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
***************
*** 24,29 ****
--- 24,32 ----
  #include <sys/utime.h>
  #include <io.h>
  #include <WINNT/afssw.h>
+ #ifdef AFS_AFSDB_ENV
+ #include <cm_dns.h>
+ #endif /* AFS_AFSDB_ENV */
  #else
  #include <sys/socket.h>
  #include <netinet/in.h>
***************
*** 35,46 ****
--- 38,61 ----
  #include <resolv.h>
  #endif /* AFS_AFSDB_ENV */
  #endif /* AFS_NT40_ENV */
+ #include <afs/afsint.h>
  #include <errno.h>
  #include <ctype.h>
  #include <time.h>
  #include <stdio.h>
+ #include <stdlib.h>
  #include <sys/stat.h>
  #include <fcntl.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
  #endif /* UKERNEL */
  #include <afs/afsutil.h>
  #include "cellconfig.h"
***************
*** 53,71 ****
  static afsconf_Reopen();
  
  static struct afsconf_servPair serviceTable [] = {
!     "afs",	7000,
!     "afscb",	7001,
!     "afsprot",	7002,
!     "afsvldb",	7003,
!     "afskauth",	7004,
!     "afsvol",	7005,
!     "afserror",	7006,
!     "afsnanny",	7007,
!     "afsupdate",7008,
!     "afsrmtsys",7009,
!     "afsres",   7010,   /* residency database for MR-AFS */
!     "afsremio", 7011,   /* remote I/O interface for MR-AFS */
!     0, 0		/* insert new services before this spot */
  };
  
  /*
--- 68,86 ----
  static afsconf_Reopen();
  
  static struct afsconf_servPair serviceTable [] = {
!     { "afs",       7000, },
!     { "afscb",     7001, },
!     { "afsprot",   7002, },
!     { "afsvldb",   7003, },
!     { "afskauth",  7004, },
!     { "afsvol",    7005, },
!     { "afserror",  7006, },
!     { "afsnanny",  7007, },
!     { "afsupdate", 7008, },
!     { "afsrmtsys", 7009, },
!     { "afsres",    7010, },  /* residency database for MR-AFS */
!     { "afsremio",  7011, },  /* remote I/O interface for MR-AFS */
!     { 0, 0 }		     /* insert new services before this spot */
  };
  
  /*
***************
*** 106,112 ****
      register int tc;
  
      tp = abuffer;
!     while (tc = *tp) {
  	if (!isspace(tc)) break;
  	tp++;
      }
--- 121,127 ----
      register int tc;
  
      tp = abuffer;
!     while ((tc = *tp)) {
  	if (!isspace(tc)) break;
  	tp++;
      }
***************
*** 353,361 ****
--- 368,379 ----
  #else
      i = GetCellUnix(adir);
  #endif
+ 
+ #ifndef AFS_FREELANCE_CLIENT  /* no local cell not fatal in freelance */
      if (i) {
  	return i;
      }
+ #endif
  
      /* now parse the individual lines */
      curEntry = 0;
***************
*** 553,558 ****
--- 571,577 ----
  }
  
  #ifdef AFS_AFSDB_ENV
+ #if !defined(AFS_NT40_ENV)
  afsconf_GetAfsdbInfo(acellName, aservice, acellInfo)
      char *acellName;
      char *aservice;
***************
*** 563,568 ****
--- 582,588 ----
      size_t len;
      unsigned char answer[1024];
      unsigned char *p;
+     char realCellName[256];
      char host[256];
      int server_num = 0;
      int minttl = 0;
***************
*** 582,588 ****
      code = dn_expand(answer, answer + len, p, host, sizeof(host));
      if (code < 0)
  	return AFSCONF_NOTFOUND;
-     strncpy(acellInfo->name, host, sizeof(acellInfo->name));
  
      p += code + QFIXEDSZ;	/* Skip name */
  
--- 602,607 ----
***************
*** 606,611 ****
--- 625,639 ----
  	    short afsdb_type;
  
  	    afsdb_type = (p[0] << 8) | p[1];
+ 	    if (afsdb_type == 1) {
+ 		/*
+ 		 * We know this is an AFSDB record for our cell, of the
+ 		 * right AFSDB type.  Write down the true cell name that
+ 		 * the resolver gave us above.
+ 		 */
+ 		strcpy(realCellName, host);
+ 	    }
+ 
  	    code = dn_expand(answer, answer+len, p+2, host, sizeof(host));
  	    if (code < 0)
  		return AFSCONF_NOTFOUND;
***************
*** 630,635 ****
--- 658,664 ----
  
      if (server_num == 0)		/* No AFSDB records */
  	return AFSCONF_NOTFOUND;
+     strncpy(acellInfo->name, realCellName, sizeof(acellInfo->name));
      acellInfo->numServers = server_num;
  
      if (aservice) {
***************
*** 645,650 ****
--- 674,731 ----
  
      return 0;
  }
+ #else  /* windows */
+ int afsconf_GetAfsdbInfo(acellName, aservice, acellInfo)
+   char *aservice;
+   char *acellName;
+   struct afsconf_cell *acellInfo;
+ {
+     register afs_int32 i;
+     int tservice;
+     struct afsconf_entry DNSce;
+     char *DNStmpStrp; /* a temp string pointer */
+     struct hostent *thp;
+     afs_int32 cellHosts[AFSMAXCELLHOSTS];
+     int numServers;
+     int rc;
+     int *ttl;
+ 
+     DNSce.cellInfo.numServers=0;
+     DNSce.next = NULL;
+     rc = getAFSServer(acellName, cellHosts, &numServers, &ttl);
+     /* ignore the ttl here since this code is only called by transitory programs
+        like klog, etc. */
+     if (rc < 0)
+       return -1;
+     if (numServers == 0)
+       return -1;
+ 
+     for (i = 0; i < numServers; i++)
+     {
+         memcpy(&acellInfo->hostAddr[i].sin_addr.s_addr, &cellHosts[i], sizeof(long));
+         acellInfo->hostAddr[i].sin_family = AF_INET;
+ 
+         /* sin_port supplied by connection code */
+     }
+ 
+     acellInfo->numServers = numServers;
+     strcpy(acellInfo->name, acellName);
+     if (aservice) {
+         LOCK_GLOBAL_MUTEX
+         tservice = afsconf_FindService(aservice);
+      UNLOCK_GLOBAL_MUTEX
+         if (tservice < 0) {
+             return AFSCONF_NOTFOUND;  /* service not found */
+      }
+      for(i=0; i< acellInfo->numServers; i++) {
+             acellInfo->hostAddr[i].sin_port = tservice;
+      }
+     }
+     acellInfo->linkedCell = NULL;    /* no linked cell */
+     acellInfo->flags = 0;
+     return 0;
+ }
+ #endif /* windows */
  #endif /* AFS_AFSDB_ENV */
  
  afsconf_GetCellInfo(adir, acellName, aservice, acellInfo)
Index: openafs/src/auth/ktc.c
diff -c openafs/src/auth/ktc.c:1.7 openafs/src/auth/ktc.c:1.7.2.1
*** openafs/src/auth/ktc.c:1.7	Tue Aug  7 20:03:37 2001
--- openafs/src/auth/ktc.c	Sat Oct 13 00:20:47 2001
***************
*** 16,22 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/auth/ktc.c,v 1.7 2001/08/08 00:03:37 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 16,22 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/auth/ktc.c,v 1.7.2.1 2001/10/13 04:20:47 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
***************
*** 48,56 ****
--- 48,66 ----
  #include <errno.h>
  #include <sys/ioctl.h>
  #include <netinet/in.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <afs/vice.h>
  #ifdef	AFS_AIX_ENV
  #include <sys/lockf.h>
+ #endif
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
  #endif
  #include "auth.h"
  #include <afs/venus.h>
Index: openafs/src/auth/ktc_nt.c
diff -c openafs/src/auth/ktc_nt.c:1.5 openafs/src/auth/ktc_nt.c:1.5.4.1
*** openafs/src/auth/ktc_nt.c:1.5	Thu Jul 12 15:58:26 2001
--- openafs/src/auth/ktc_nt.c	Wed Nov 21 01:45:48 2001
***************
*** 12,18 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/auth/ktc_nt.c,v 1.5 2001/07/12 19:58:26 shadow Exp $");
  
  #include <afs/stds.h>
  #include <stdio.h>
--- 12,18 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/auth/ktc_nt.c,v 1.5.4.1 2001/11/21 06:45:48 shadow Exp $");
  
  #include <afs/stds.h>
  #include <stdio.h>
***************
*** 333,338 ****
--- 333,351 ----
  	strcpy(tp, client->name);
  	tp += temp+1;
  
+     /* we need the SMB user name to associate the tokens with in the
+     integrated logon case. */
+     if (flags & AFS_SETTOK_LOGON) {
+     if (client->smbname == NULL)
+       temp = 0;
+     else
+ 	    temp = strlen(client->smbname);
+         if (temp == 0 || temp >= MAXKTCNAMELEN)
+           return KTC_INVAL;
+ 	    strcpy(tp, client->smbname);
+           tp += temp+1;
+     }
+            
  	/* uuid */
  	status = UuidCreate((UUID *)&uuid);
  	memcpy(tp, &uuid, sizeof(uuid));
Index: openafs/src/auth/userok.c
diff -c openafs/src/auth/userok.c:1.7.4.1 openafs/src/auth/userok.c:1.7.4.2
*** openafs/src/auth/userok.c:1.7.4.1	Wed Sep 19 18:36:18 2001
--- openafs/src/auth/userok.c	Sat Oct 13 00:20:47 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/auth/userok.c,v 1.7.4.1 2001/09/19 22:36:18 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/auth/userok.c,v 1.7.4.2 2001/10/13 04:20:47 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
Index: openafs/src/auth/writeconfig.c
diff -c openafs/src/auth/writeconfig.c:1.6 openafs/src/auth/writeconfig.c:1.6.2.1
*** openafs/src/auth/writeconfig.c:1.6	Tue Aug  7 20:03:37 2001
--- openafs/src/auth/writeconfig.c	Sat Oct 13 00:20:47 2001
***************
*** 10,23 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/auth/writeconfig.c,v 1.6 2001/08/08 00:03:37 shadow Exp $");
  
  #include <afs/pthread_glock.h>
  #include <afs/afsutil.h>
  #include <sys/types.h>
- #ifdef AFS_SUN5_ENV 
- #include <fcntl.h>
- #endif
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
  #include <fcntl.h>
--- 10,20 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/auth/writeconfig.c,v 1.6.2.1 2001/10/13 04:20:47 shadow Exp $");
  
  #include <afs/pthread_glock.h>
  #include <afs/afsutil.h>
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
  #include <fcntl.h>
***************
*** 30,35 ****
--- 27,45 ----
  #endif
  #include <stdio.h>
  #include <errno.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
  #include "cellconfig.h"
  #include "keys.h"
  
Index: openafs/src/bozo/NTMakefile
diff -c openafs/src/bozo/NTMakefile:1.2.8.1 openafs/src/bozo/NTMakefile:1.2.8.2
*** openafs/src/bozo/NTMakefile:1.2.8.1	Wed Sep 19 18:32:47 2001
--- openafs/src/bozo/NTMakefile	Wed Nov 14 22:30:27 2001
***************
*** 66,72 ****
  	$(DESTDIR)\lib\afs\afsaudit.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afs\afsprocmgmt.lib
  
  $(BOSSERVER_EXEFILE): $(BOSSERVER_EXEOBJS) $(BOSSERVER_EXELIBS)
  	$(EXECONLINK)
--- 66,73 ----
  	$(DESTDIR)\lib\afs\afsaudit.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  
  $(BOSSERVER_EXEFILE): $(BOSSERVER_EXEOBJS) $(BOSSERVER_EXELIBS)
  	$(EXECONLINK)
***************
*** 100,106 ****
  	$(DESTDIR)\lib\afs\afsbos.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\afs\afspioctl.lib
  
  
  $(RS_BOS_EXEFILE): $(BOS_EXEOBJS) $(BOS_EXELIBS)
--- 101,108 ----
  	$(DESTDIR)\lib\afs\afsbos.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\afs\afspioctl.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  
  
  $(RS_BOS_EXEFILE): $(BOS_EXEOBJS) $(BOS_EXELIBS)
Index: openafs/src/bozo/bnode.c
diff -c openafs/src/bozo/bnode.c:1.7 openafs/src/bozo/bnode.c:1.7.2.1
*** openafs/src/bozo/bnode.c:1.7	Tue Aug  7 20:03:38 2001
--- openafs/src/bozo/bnode.c	Sat Oct 13 00:21:04 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/bnode.c,v 1.7 2001/08/08 00:03:38 shadow Exp $");
  
  #include <stddef.h>
  #include <stdlib.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/bnode.c,v 1.7.2.1 2001/10/13 04:21:04 shadow Exp $");
  
  #include <stddef.h>
  #include <stdlib.h>
***************
*** 34,39 ****
--- 34,44 ----
  #include <afs/fileutil.h>
  #include "bnode.h"
  
+ #ifdef AFS_AIX_ENV
+ /* All known versions of AIX lack WCOREDUMP but this works */
+ #define WCOREDUMP(x) ((x) & 0x80)
+ #endif
+ 
  #define BNODE_LWP_STACKSIZE	(16 * 1024)
  
  int bnode_waiting = 0;
***************
*** 528,533 ****
--- 533,544 ----
  			    RememberProcName(tp);
  			    tb->errorSignal = 0;
  			}
+ 			if (tp->coreName)
+ 			    bozo_Log("%s:%s exited with code %d",
+ 				tb->name, tp->coreName, tp->lastExit);
+ 			else
+ 			    bozo_Log("%s exited with code %d",
+ 				tb->name, tp->lastExit);
  		    }
  		    else {
  			/* Signal occurred, perhaps spurious due to shutdown request.
***************
*** 542,547 ****
--- 553,566 ----
  			    tb->lastErrorExit = FT_ApproxTime();
  			    RememberProcName(tp);
  			}
+ 			if (tp->coreName)
+ 			    bozo_Log("%s:%s exited on signal %d%s",
+ 				tb->name, tp->coreName, tp->lastSignal,
+ 				WCOREDUMP(status) ? " (core dumped)" : "");
+ 			else
+ 			    bozo_Log("%s exited on signal %d%s",
+ 				tb->name, tp->lastSignal,
+ 				WCOREDUMP(status) ? " (core dumped)" : "");
  			SaveCore(tb, tp);
  		    }
  		    tb->lastAnyExit = FT_ApproxTime();
Index: openafs/src/bozo/bos.c
diff -c openafs/src/bozo/bos.c:1.10.2.2 openafs/src/bozo/bos.c:1.10.2.3
*** openafs/src/bozo/bos.c:1.10.2.2	Wed Sep 19 18:40:23 2001
--- openafs/src/bozo/bos.c	Sat Oct 13 00:21:04 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/bos.c,v 1.10.2.2 2001/09/19 22:40:23 shadow Exp $");
  
  #include <afs/stds.h>
  #include <stdlib.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/bos.c,v 1.10.2.3 2001/10/13 04:21:04 shadow Exp $");
  
  #include <afs/stds.h>
  #include <stdlib.h>
***************
*** 1259,1265 ****
      parms[1] = "now";	    /* when to do it */
      code = BOZO_CreateBnode(aconn, "cron", "salvage-tmp", parms[0], parms[1],
  			    parms[2], parms[3], parms[4], notifier);
!     if (code) goto done;
      /* now wait for bnode to disappear */
      while (1) {
  	IOMGR_Sleep(5);
--- 1259,1268 ----
      parms[1] = "now";	    /* when to do it */
      code = BOZO_CreateBnode(aconn, "cron", "salvage-tmp", parms[0], parms[1],
  			    parms[2], parms[3], parms[4], notifier);
!     if (code) {
! 	printf("bos: failed to start 'salvager' (%s)\n", em(code));
! 	goto done;
!     }
      /* now wait for bnode to disappear */
      while (1) {
  	IOMGR_Sleep(5);
***************
*** 1485,1491 ****
  	/* now do the salvage operation */
  	printf("Starting salvage.\n");
  	rc = DoSalvage(tconn, (char *) 0, (char *) 0, outName, showlog,parallel,tmpDir,orphans);
- 	if (rc) printf("bos: failed to start 'salvager' (%s)\n", em(rc));
  	if (curGoal == BSTAT_NORMAL) {
  	    printf("bos: restarting fs.\n");
  	    code = BOZO_SetTStatus(tconn, "fs", BSTAT_NORMAL);
--- 1488,1493 ----
***************
*** 1526,1532 ****
  	printf("Starting salvage.\n");
  	rc = DoSalvage(tconn, as->parms[1].items->data, (char *) 0,
  		       outName, showlog,parallel,tmpDir,orphans);
- 	if (rc) printf("bos: failed to start 'salvager' (%s)\n", em(rc));
  	if (curGoal == BSTAT_NORMAL) {
  	    printf("bos: restarting fs.\n");
  	    code = BOZO_SetTStatus(tconn, "fs", BSTAT_NORMAL);
--- 1528,1533 ----
***************
*** 1578,1587 ****
  	printf("Starting salvage.\n");
  	rc = DoSalvage(tconn, as->parms[1].items->data, tname, outName,
  		       showlog,parallel,tmpDir,orphans);
! 	if (rc) {
! 	   printf("bos: failed to start 'salvager' (%s)\n", em(rc));
  	   return rc;
- 	}
      }
      return 0;
  }
--- 1579,1586 ----
  	printf("Starting salvage.\n");
  	rc = DoSalvage(tconn, as->parms[1].items->data, tname, outName,
  		       showlog,parallel,tmpDir,orphans);
! 	if (rc) 
  	   return rc;
      }
      return 0;
  }
Index: openafs/src/bozo/bosoprocs.c
diff -c openafs/src/bozo/bosoprocs.c:1.6.2.1 openafs/src/bozo/bosoprocs.c:1.6.2.2
*** openafs/src/bozo/bosoprocs.c:1.6.2.1	Wed Sep 19 18:36:19 2001
--- openafs/src/bozo/bosoprocs.c	Sat Oct 13 00:21:04 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/bosoprocs.c,v 1.6.2.1 2001/09/19 22:36:19 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/bosoprocs.c,v 1.6.2.2 2001/10/13 04:21:04 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/bozo/bosserver.c
diff -c openafs/src/bozo/bosserver.c:1.12.2.1 openafs/src/bozo/bosserver.c:1.12.2.2
*** openafs/src/bozo/bosserver.c:1.12.2.1	Wed Sep 19 18:36:19 2001
--- openafs/src/bozo/bosserver.c	Sat Oct 13 00:21:04 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/bosserver.c,v 1.12.2.1 2001/09/19 22:36:19 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/bosserver.c,v 1.12.2.2 2001/10/13 04:21:04 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/bozo/cronbnodeops.c
diff -c openafs/src/bozo/cronbnodeops.c:1.5.2.1 openafs/src/bozo/cronbnodeops.c:1.5.2.2
*** openafs/src/bozo/cronbnodeops.c:1.5.2.1	Wed Sep 19 18:36:19 2001
--- openafs/src/bozo/cronbnodeops.c	Sat Oct 13 00:21:04 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/cronbnodeops.c,v 1.5.2.1 2001/09/19 22:36:19 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/cronbnodeops.c,v 1.5.2.2 2001/10/13 04:21:04 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
Index: openafs/src/bozo/fsbnodeops.c
diff -c openafs/src/bozo/fsbnodeops.c:1.7.2.1 openafs/src/bozo/fsbnodeops.c:1.7.2.2
*** openafs/src/bozo/fsbnodeops.c:1.7.2.1	Wed Sep 19 18:36:19 2001
--- openafs/src/bozo/fsbnodeops.c	Sat Oct 13 00:21:04 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/fsbnodeops.c,v 1.7.2.1 2001/09/19 22:36:19 shadow Exp $");
  
  #include <sys/types.h>
  #include <lwp.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bozo/fsbnodeops.c,v 1.7.2.2 2001/10/13 04:21:04 shadow Exp $");
  
  #include <sys/types.h>
  #include <lwp.h>
Index: openafs/src/bucoord/NTMakefile
diff -c openafs/src/bucoord/NTMakefile:1.2.8.1 openafs/src/bucoord/NTMakefile:1.2.8.2
*** openafs/src/bucoord/NTMakefile:1.2.8.1	Wed Sep 19 18:32:48 2001
--- openafs/src/bucoord/NTMakefile	Wed Nov 14 22:30:27 2001
***************
*** 79,85 ****
          $(DESTDIR)\lib\afs\afsusd.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
! 	$(DESTDIR)\lib\afs\afsreg.lib
  	
  
  $(EXEFILE): $(EXEOBJS) $(EXELIBS)
--- 79,86 ----
          $(DESTDIR)\lib\afs\afsusd.lib \
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
! 	$(DESTDIR)\lib\afs\afsreg.lib \
!      $(DESTDIR)\lib\cm_dns.obj
  	
  
  $(EXEFILE): $(EXEOBJS) $(EXELIBS)
Index: openafs/src/bucoord/main.c
diff -c openafs/src/bucoord/main.c:1.6.2.1 openafs/src/bucoord/main.c:1.6.2.2
*** openafs/src/bucoord/main.c:1.6.2.1	Wed Sep 19 18:40:24 2001
--- openafs/src/bucoord/main.c	Sat Oct 13 00:21:06 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bucoord/main.c,v 1.6.2.1 2001/09/19 22:40:24 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/bucoord/main.c,v 1.6.2.2 2001/10/13 04:21:06 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/budb/NTMakefile
diff -c openafs/src/budb/NTMakefile:1.2.8.1 openafs/src/budb/NTMakefile:1.2.8.2
*** openafs/src/budb/NTMakefile:1.2.8.1	Wed Sep 19 18:32:49 2001
--- openafs/src/budb/NTMakefile	Wed Nov 14 22:30:28 2001
***************
*** 75,81 ****
  	$(DESTDIR)\lib\afsubik.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\afs\afsprocmgmt.lib
  
  
  $(EXEFILE): $(EXEOBJS)  $(EXELIBS)
--- 75,82 ----
  	$(DESTDIR)\lib\afsubik.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  
  
  $(EXEFILE): $(EXEOBJS)  $(EXELIBS)
Index: openafs/src/budb/server.c
diff -c openafs/src/budb/server.c:1.6.2.1 openafs/src/budb/server.c:1.6.2.2
*** openafs/src/budb/server.c:1.6.2.1	Wed Sep 19 18:40:25 2001
--- openafs/src/budb/server.c	Sat Oct 13 00:21:07 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/budb/server.c,v 1.6.2.1 2001/09/19 22:40:25 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/budb/server.c,v 1.6.2.2 2001/10/13 04:21:07 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
Index: openafs/src/butc/NTMakefile
diff -c openafs/src/butc/NTMakefile:1.2 openafs/src/butc/NTMakefile:1.2.8.1
*** openafs/src/butc/NTMakefile:1.2	Sat Nov  4 05:04:12 2000
--- openafs/src/butc/NTMakefile	Wed Nov 14 22:30:29 2001
***************
*** 49,55 ****
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afs\afsreg.lib
  
  $(EXEFILE): $(EXEOBJS) $(EXELIBS)
  	$(EXECONLINK)
--- 49,56 ----
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
  	$(DESTDIR)\lib\afs\afspioctl.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  
  $(EXEFILE): $(EXEOBJS) $(EXELIBS)
  	$(EXECONLINK)
Index: openafs/src/butc/tcmain.c
diff -c openafs/src/butc/tcmain.c:1.5.2.1 openafs/src/butc/tcmain.c:1.5.2.2
*** openafs/src/butc/tcmain.c:1.5.2.1	Wed Sep 19 18:40:26 2001
--- openafs/src/butc/tcmain.c	Sat Oct 13 00:21:08 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/butc/tcmain.c,v 1.5.2.1 2001/09/19 22:40:26 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/butc/tcmain.c,v 1.5.2.2 2001/10/13 04:21:08 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
Index: openafs/src/butm/butm_test.c
diff -c openafs/src/butm/butm_test.c:1.5.2.1 openafs/src/butm/butm_test.c:1.5.2.2
*** openafs/src/butm/butm_test.c:1.5.2.1	Wed Sep 19 18:40:27 2001
--- openafs/src/butm/butm_test.c	Sat Oct 13 00:21:09 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/butm/butm_test.c,v 1.5.2.1 2001/09/19 22:40:27 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/file.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/butm/butm_test.c,v 1.5.2.2 2001/10/13 04:21:09 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/file.h>
Index: openafs/src/butm/test_ftm.c
diff -c openafs/src/butm/test_ftm.c:1.5.2.1 openafs/src/butm/test_ftm.c:1.5.2.2
*** openafs/src/butm/test_ftm.c:1.5.2.1	Wed Sep 19 18:40:27 2001
--- openafs/src/butm/test_ftm.c	Sat Oct 13 00:21:09 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/butm/test_ftm.c,v 1.5.2.1 2001/09/19 22:40:27 shadow Exp $");
  
  #include <sys/types.h>
  #include <fcntl.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/butm/test_ftm.c,v 1.5.2.2 2001/10/13 04:21:09 shadow Exp $");
  
  #include <sys/types.h>
  #include <fcntl.h>
Index: openafs/src/cf/linux-test2.m4
diff -c openafs/src/cf/linux-test2.m4:1.2 openafs/src/cf/linux-test2.m4:1.2.4.1
*** openafs/src/cf/linux-test2.m4:1.2	Thu Jul 12 11:37:36 2001
--- openafs/src/cf/linux-test2.m4	Sat Oct 13 00:21:11 2001
***************
*** 28,30 ****
--- 28,41 ----
  AC_MSG_RESULT($ac_cv_linux_fs_struct_address_space_has_page_lock)
  CPPFLAGS="$save_CPPFLAGS"])
  
+ 
+ dnl LINUX_BUILD_VNODE_FROM_INODE (configdir, outputdir)
+ dnl		defaults: (src/config, src/afs/LINUX)
+ 
+ AC_DEFUN(LINUX_BUILD_VNODE_FROM_INODE, [
+ AC_MSG_CHECKING(whether to build osi_vfs.h)
+ configdir=ifelse([$1], ,src/config,$1)
+ outputdir=ifelse([$2], ,src/afs/LINUX,$2)
+ chmod +x $configdir/make_vnode.pl
+ $configdir/make_vnode.pl -i $LINUX_KERNEL_PATH -o $outputdir
+ ])
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.6 openafs/src/cf/linux-test4.m4:1.6.2.1
*** openafs/src/cf/linux-test4.m4:1.6	Thu Sep  6 21:12:29 2001
--- openafs/src/cf/linux-test4.m4	Sat Oct 13 00:21:11 2001
***************
*** 72,74 ****
--- 72,90 ----
  ac_cv_linux_fs_struct_inode_has_i_truncate_sem=no)])
  AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_truncate_sem)
  CPPFLAGS="$save_CPPFLAGS"])
+ 
+ AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DEVICES, [
+ AC_MSG_CHECKING(for i_devices in struct inode)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+ AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev, 
+ [
+ AC_TRY_COMPILE(
+ [#include <linux/fs.h>],
+ [struct inode _inode;
+ printf("%d\n", _inode.i_devices);], 
+ ac_cv_linux_fs_struct_inode_has_i_devices=yes,
+ ac_cv_linux_fs_struct_inode_has_i_devices=no)])
+ AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_devices)
+ CPPFLAGS="$save_CPPFLAGS"])
+ 
Index: openafs/src/cmd/cmd.c
diff -c openafs/src/cmd/cmd.c:1.6.4.1 openafs/src/cmd/cmd.c:1.6.4.2
*** openafs/src/cmd/cmd.c:1.6.4.1	Wed Sep 19 18:36:20 2001
--- openafs/src/cmd/cmd.c	Sat Oct 13 00:21:12 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/cmd/cmd.c,v 1.6.4.1 2001/09/19 22:36:20 shadow Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/cmd/cmd.c,v 1.6.4.2 2001/10/13 04:21:12 shadow Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
Index: openafs/src/cmd/test/itest.c
diff -c openafs/src/cmd/test/itest.c:1.4.4.1 openafs/src/cmd/test/itest.c:1.4.4.2
*** openafs/src/cmd/test/itest.c:1.4.4.1	Wed Sep 19 18:40:29 2001
--- openafs/src/cmd/test/itest.c	Sat Oct 13 00:21:13 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/cmd/test/itest.c,v 1.4.4.1 2001/09/19 22:40:29 shadow Exp $");
  
  #include "cmd.h"
  #include <stdio.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/cmd/test/itest.c,v 1.4.4.2 2001/10/13 04:21:13 shadow Exp $");
  
  #include "cmd.h"
  #include <stdio.h>
Index: openafs/src/comerr/compile_et.c
diff -c openafs/src/comerr/compile_et.c:1.6.4.1 openafs/src/comerr/compile_et.c:1.6.4.2
*** openafs/src/comerr/compile_et.c:1.6.4.1	Wed Sep 19 18:40:30 2001
--- openafs/src/comerr/compile_et.c	Sat Oct 13 00:21:14 2001
***************
*** 11,17 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/comerr/compile_et.c,v 1.6.4.1 2001/09/19 22:40:30 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 11,17 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/comerr/compile_et.c,v 1.6.4.2 2001/10/13 04:21:14 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 370,376 ****
      fprintf (hfile, "#define ERROR_TABLE_BASE_%s (%ldL)\n",
  	     lcname, (long int) table_number);
      fprintf (hfile, "#define init_%s_err_tbl initialize_%s_error_table\n",
! 	     lcname, lcname);
      fprintf (hfile, "#define %s_err_base ERROR_TABLE_BASE_%s\n", lcname,
  	     lcname);
      fclose(hfile);		/* bye bye include file */
--- 370,378 ----
      fprintf (hfile, "#define ERROR_TABLE_BASE_%s (%ldL)\n",
  	     lcname, (long int) table_number);
      fprintf (hfile, "#define init_%s_err_tbl initialize_%s_error_table\n",
! 	     lcname, table_name);
!     fprintf (hfile, "#define initialize_%s_error_table initialize_%s_error_table\n",
! 	     lcname, table_name);
      fprintf (hfile, "#define %s_err_base ERROR_TABLE_BASE_%s\n", lcname,
  	     lcname);
      fclose(hfile);		/* bye bye include file */
Index: openafs/src/comerr/error_table.y
diff -c openafs/src/comerr/error_table.y:1.4.4.1 openafs/src/comerr/error_table.y:1.4.4.2
*** openafs/src/comerr/error_table.y:1.4.4.1	Wed Sep 19 18:40:30 2001
--- openafs/src/comerr/error_table.y	Sat Oct 13 00:21:14 2001
***************
*** 2,8 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/comerr/error_table.y,v 1.4.4.1 2001/09/19 22:40:30 shadow Exp $");
  
  /*
   *
--- 2,8 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/comerr/error_table.y,v 1.4.4.2 2001/10/13 04:21:14 shadow Exp $");
  
  /*
   *
Index: openafs/src/comerr/error_table_nt.c
diff -c openafs/src/comerr/error_table_nt.c:1.3.4.1 openafs/src/comerr/error_table_nt.c:1.3.4.2
*** openafs/src/comerr/error_table_nt.c:1.3.4.1	Wed Sep 19 18:40:30 2001
--- openafs/src/comerr/error_table_nt.c	Sat Oct 13 00:21:14 2001
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/comerr/error_table_nt.c,v 1.3.4.1 2001/09/19 22:40:30 shadow Exp $");
  
  
  /*
--- 15,21 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/comerr/error_table_nt.c,v 1.3.4.2 2001/10/13 04:21:14 shadow Exp $");
  
  
  /*
Index: openafs/src/comerr/test/test.c
diff -c openafs/src/comerr/test/test.c:1.3.4.1 openafs/src/comerr/test/test.c:1.3.4.2
*** openafs/src/comerr/test/test.c:1.3.4.1	Wed Sep 19 18:40:31 2001
--- openafs/src/comerr/test/test.c	Sat Oct 13 00:21:15 2001
***************
*** 1,7 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/comerr/test/test.c,v 1.3.4.1 2001/09/19 22:40:31 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 1,7 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/comerr/test/test.c,v 1.3.4.2 2001/10/13 04:21:15 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
Index: openafs/src/config/.cvsignore
diff -c openafs/src/config/.cvsignore:1.1 openafs/src/config/.cvsignore:1.1.2.1
*** openafs/src/config/.cvsignore:1.1	Mon Sep 10 16:14:12 2001
--- openafs/src/config/.cvsignore	Sat Oct 13 00:21:18 2001
***************
*** 1,9 ****
  AFS_component_version_number.c
  Makefile
! Makefile.i386_linux24
  Makefile.version
  Makefile.version-NOCML
  afsconfig.h
  afsconfig.h.in
  config
  mkvers
--- 1,15 ----
  AFS_component_version_number.c
  Makefile
! Makefile.*_*[0123456789]
  Makefile.version
  Makefile.version-NOCML
  afsconfig.h
  afsconfig.h.in
  config
  mkvers
+ Makefile.hp_ux102
+ Makefile.hp_ux110
+ Makefile.i386_linux22
+ Makefile.i386_linux24
+ Makefile.sun4x_56
+ Makefile.sun4x_57
Index: openafs/src/config/Makefile.alpha_linux_24.in
diff -c /dev/null openafs/src/config/Makefile.alpha_linux_24.in:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:16 2001
--- openafs/src/config/Makefile.alpha_linux_24.in	Sat Oct 13 00:36:14 2001
***************
*** 0 ****
--- 1,45 ----
+ # Makefile for Linux 2.2.16 kernel on Alpha with glibc 2.2
+ # Keep macros within each section in sorted order for clean diff displays.
+ #
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = LINUX
+ # Base directory for linux kernel source. Actually a prefix which is complete
+ # when LINUX_VERS is appended to it.
+ LINUX_SRCDIR = /usr/src/linux-
+ # Default list of Linux kernels to build. Build will run only if all
+ # can be built. To build a different set, specify LINUX_VERS to make.
+ #LINUX_VERS = 2.2.16
+ 
+ #
+ # compilation and link editor flags
+ DBG=-g
+ OPTMZ=-O2
+ PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
+ # Put -O2 here to _ensure_ all Makefiles pick it up.
+ XCFLAGS= -O2
+ MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
+ XLDFLAGS=
+ SHARE_LDFLAGS = -shared -Xlinker -x
+ SHLIB_SUFFIX=so
+ SHLIB_CFLAGS=
+ #
+ # libraries
+ MTLIBS=-lpthread
+ TXLIBS= /usr/lib/libncurses.so
+ XLIBS=@LIB_AFSDB@
+ #
+ # programs
+ AR=ar
+ AS=as
+ CP=cp
+ INSTALL=${TOP_SRCDIR}/pinstall/pinstall
+ LD=ld   
+ MT_CC=cc
+ MV=mv
+ RANLIB=ranlib
+ RM=rm
+ #
+ # Other OS specific requirements
+ #
+ YACC = bison -y
+ LEX = flex -l
Index: openafs/src/config/Makefile.i386_djgpp
diff -c openafs/src/config/Makefile.i386_djgpp:1.5 openafs/src/config/Makefile.i386_djgpp:1.5.2.1
*** openafs/src/config/Makefile.i386_djgpp:1.5	Wed Aug 29 19:14:16 2001
--- openafs/src/config/Makefile.i386_djgpp	Sat Oct 13 00:21:18 2001
***************
*** 15,21 ****
  OPTMZ=-O2
  #PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
  # Put -O2 here to _ensure_ all Makefiles pick it up.
! XCFLAGS= ${DBG} -Dfds_bits=fd_bits
  MT_CFLAGS=${XCFLAGS}
  XLDFLAGS=
  SHARE_LDFLAGS = -shared -Xlinker -x
--- 15,21 ----
  OPTMZ=-O2
  #PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
  # Put -O2 here to _ensure_ all Makefiles pick it up.
! XCFLAGS= ${DBG} -Dfds_bits=fd_bits -DAFS_AFSDB_ENV -DAFS_FREELANCE_CLIENT
  MT_CFLAGS=${XCFLAGS}
  XLDFLAGS=
  SHARE_LDFLAGS = -shared -Xlinker -x
Index: openafs/src/config/Makefile.parisc_linux24.in
diff -c /dev/null openafs/src/config/Makefile.parisc_linux24.in:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:16 2001
--- openafs/src/config/Makefile.parisc_linux24.in	Sat Oct 13 00:36:14 2001
***************
*** 0 ****
--- 1,43 ----
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = LINUX
+ 
+ # Base directory for linux kernel source. Actually a prefix which is complete
+ # when LINUX_VERS is appended to it.
+ LINUX_SRCDIR = /usr/src/linux-
+ # Default list of Linux kernels to build. Build will run only if all
+ # can be built. To build a different set, specify LINUX_VERS to make.
+ LINUX_VERS = @LINUX_VERSION@
+ 
+ #
+ # compilation and link editor flags
+ DBG=-g
+ OPTMZ=-O2
+ PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
+ # Put -O2 here to _ensure_ all Makefiles pick it up.
+ XCFLAGS= -O2
+ MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
+ XLDFLAGS=
+ SHARE_LDFLAGS = -shared -Xlinker -x
+ SHLIB_SUFFIX=so
+ SHLIB_CFLAGS=
+ #
+ # libraries
+ MTLIBS=-lpthread
+ TXLIBS= /usr/lib/libncurses.so
+ XLIBS= @LIB_AFSDB@
+ #
+ # programs
+ AR=ar
+ AS=as
+ CP=cp
+ LD=ld
+ MT_CC=cc
+ MV=mv
+ RANLIB=ranlib
+ RM=rm
+ INSTALL=${TOP_SRCDIR}/pinstall/pinstall
+ #
+ # Other OS specific requirements
+ #
+ YACC = bison -y
+ LEX = flex -l
Index: openafs/src/config/Makefile.ppc_darwin_13.in
diff -c openafs/src/config/Makefile.ppc_darwin_13.in:1.4.2.1 openafs/src/config/Makefile.ppc_darwin_13.in:1.4.2.2
*** openafs/src/config/Makefile.ppc_darwin_13.in:1.4.2.1	Thu Sep 20 16:12:33 2001
--- openafs/src/config/Makefile.ppc_darwin_13.in	Sat Nov 10 18:22:55 2001
***************
*** 5,11 ****
  #
  #
  # compilation and link editor flags
! XCFLAGS=-no-precomp
  #MT_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV ${XCFLAGS}
  #MT_CC=cc
  KROOT=
--- 5,11 ----
  #
  #
  # compilation and link editor flags
! XCFLAGS=-no-cpp-precomp
  #MT_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV ${XCFLAGS}
  #MT_CC=cc
  KROOT=
Index: openafs/src/config/Makefile.ppc_darwin_14.in
diff -c /dev/null openafs/src/config/Makefile.ppc_darwin_14.in:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:16 2001
--- openafs/src/config/Makefile.ppc_darwin_14.in	Sat Nov 10 18:22:55 2001
***************
*** 0 ****
--- 1,43 ----
+ # Keep macros within each section in sorted order for clean diff displays.
+ #
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = DARWIN
+ #
+ #
+ # compilation and link editor flags
+ XCFLAGS=-no-cpp-precomp
+ #MT_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV ${XCFLAGS}
+ #MT_CC=cc
+ KROOT=
+ KINCLUDES=-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers
+ #SHARE_LDFLAGS =
+ LWP_OPTMZ=-O2
+ OPTMZ=-O2
+ DBG=-g
+ REGEX_OBJ=regex.o
+ 
+ 
+ #
+ # libraries
+ XLIBS=@LIB_AFSDB@
+ TXLIBS=
+ #MTLIBS=
+ #XLIBELFA=
+ #XLIBKVM=
+ #
+ SHLIB_SUFFIX=
+ SHLIB_CFLAGS=
+ #
+ # programs
+ AR=ar
+ AS=as
+ CC=cc
+ CP=cp
+ INSTALL=${TOP_SRCDIR}/pinstall/pinstall
+ LEX=lex -l
+ LD= ld
+ LORDER = lorder
+ MV=mv
+ RANLIB=ranlib
+ RM=rm
+ STRIP= strip
Index: openafs/src/config/Makefile.rs_aix42.in
diff -c openafs/src/config/Makefile.rs_aix42.in:1.4 openafs/src/config/Makefile.rs_aix42.in:1.4.2.1
*** openafs/src/config/Makefile.rs_aix42.in:1.4	Fri Sep  7 19:34:53 2001
--- openafs/src/config/Makefile.rs_aix42.in	Sat Oct 13 00:21:18 2001
***************
*** 35,41 ****
  RANLIB=ranlib
  RM=rm
  INSTALL=${TOP_SRCDIR}/pinstall/pinstall
- #
- # This is the XBSA make flag and pathname to XBSA header files (xbsa.h)
- XBSA_FLAGS=-Dxbsa
- XBSADIR=/usr/tivoli/tsm/client/api/bin/xopen
--- 35,37 ----
Index: openafs/src/config/Makefile.sun4x_56.in
diff -c openafs/src/config/Makefile.sun4x_56.in:1.4 openafs/src/config/Makefile.sun4x_56.in:1.4.2.1
*** openafs/src/config/Makefile.sun4x_56.in:1.4	Fri Sep  7 19:34:53 2001
--- openafs/src/config/Makefile.sun4x_56.in	Sat Oct 13 00:21:18 2001
***************
*** 49,55 ****
  FS_CONV_SOL26         = fs_conv_sol26
  install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26
  dest_FS_CONV_SOL26    = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26
- #
- # This is the XBSA make flag and pathname to XBSA header files (xbsa.h)
- XBSA_FLAGS=-Dxbsa
- XBSADIR=/opt/tivoli/tsm/client/api/bin/xopen
--- 49,51 ----
Index: openafs/src/config/Makefile.sun4x_57.in
diff -c openafs/src/config/Makefile.sun4x_57.in:1.4 openafs/src/config/Makefile.sun4x_57.in:1.4.2.1
*** openafs/src/config/Makefile.sun4x_57.in:1.4	Fri Sep  7 19:34:53 2001
--- openafs/src/config/Makefile.sun4x_57.in	Sat Oct 13 00:21:18 2001
***************
*** 53,59 ****
  FS_CONV_SOL26         = fs_conv_sol26
  install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26
  dest_FS_CONV_SOL26    = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26
- #
- # This is the XBSA make flag and pathname to XBSA header files (xbsa.h)
- XBSA_FLAGS=-Dxbsa
- XBSADIR=/opt/tivoli/tsm/client/api/bin/xopen
--- 53,55 ----
Index: openafs/src/config/Makefile.sun4x_58.in
diff -c openafs/src/config/Makefile.sun4x_58.in:1.4 openafs/src/config/Makefile.sun4x_58.in:1.4.2.1
*** openafs/src/config/Makefile.sun4x_58.in:1.4	Fri Sep  7 19:34:53 2001
--- openafs/src/config/Makefile.sun4x_58.in	Sat Oct 13 00:21:18 2001
***************
*** 46,52 ****
  FS_CONV_SOL26         = fs_conv_sol26
  install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26
  dest_FS_CONV_SOL26    = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26
- #
- # This is the XBSA make flag and pathname to XBSA header files (xbsa.h)
- XBSA_FLAGS=-Dxbsa
- XBSADIR=/opt/tivoli/tsm/client/api/bin/xopen
--- 46,48 ----
Index: openafs/src/config/Makefile.sun4x_59.in
diff -c /dev/null openafs/src/config/Makefile.sun4x_59.in:1.2.2.1
*** /dev/null	Wed Nov 21 01:54:16 2001
--- openafs/src/config/Makefile.sun4x_59.in	Sat Oct 13 00:27:21 2001
***************
*** 0 ****
--- 1,48 ----
+ # Keep macros within each section in sorted order for clean diff displays.
+ #
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = SOLARIS
+ #
+ # compilation and link editor flags
+ XCFLAGS=-dy -Bdynamic
+ MT_CFLAGS=-mt -DAFS_PTHREAD_ENV ${XCFLAGS}
+ PAM_CFLAGS = -KPIC
+ PAMLIBS= -lc -lpam -lsocket -lnsl -lm
+ SHARE_LDFLAGS = -G -Bsymbolic
+ LWP_OPTMZ=-g
+ OPTMZ=-O
+ DBG=-g
+ 
+ ## Compilation flags for 64 bit Solaris
+ XCFLAGS64 = ${XCFLAGS} -xarch=v9
+ 
+ #
+ # libraries
+ XLIBS=@LIB_AFSDB@ -lsocket -lnsl -lintl -ldl 
+ TXLIBS=-lcurses
+ MTLIBS=-lpthread -lsocket
+ XLIBELFA=-lelf
+ XLIBKVM=-lkvm
+ #
+ SHLIB_SUFFIX=so
+ SHLIB_CFLAGS=-KPIC
+ #
+ # programs
+ AR=/usr/ccs/bin/ar
+ AS=as
+ CC=/opt/SUNWspro/bin/cc
+ MT_CC=/opt/SUNWspro/bin/cc
+ CP=/bin/cp
+ LEX=lex
+ LD= /usr/ccs/bin/ld
+ LORDER = /usr/ccs/bin/lorder
+ MV=mv
+ RANLIB=/bin/true
+ RM=rm
+ STRIP= /usr/ccs/bin/strip
+ INSTALL=${TOP_SRCDIR}/pinstall/pinstall
+ #
+ # this is for the vol package
+ FS_CONV_SOL26         = fs_conv_sol26
+ install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26
+ dest_FS_CONV_SOL26    = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26
Index: openafs/src/config/NTMakefile
diff -c openafs/src/config/NTMakefile:1.8 openafs/src/config/NTMakefile:1.8.2.1
*** openafs/src/config/NTMakefile:1.8	Thu Sep  6 23:38:22 2001
--- openafs/src/config/NTMakefile	Wed Nov 14 22:38:52 2001
***************
*** 72,77 ****
--- 72,80 ----
  !	IF (!EXIST($(DESTDIR)\WinInstall\Config))
  		$(MKDIR) $(DESTDIR)\WinInstall\Config
  !	ENDIF
+ !	IF (!EXIST($(DESTDIR)\WinInstall\Dll))
+ 		$(MKDIR) $(DESTDIR)\WinInstall\Dll
+ !	ENDIF
  !	IF (!EXIST($(DESTDIR)\root.server))
  		$(MKDIR) $(DESTDIR)\root.server
  !	ENDIF
***************
*** 114,120 ****
  	$(COPY) $? $@
  	util_cr + $@
  
! $(DESTDIR)\bin\NTLang.bat: NTLang.bat util_cr.exe
  	$(COPY) NTLang.bat $(DESTDIR)\bin
  	util_cr + $(DESTDIR)\bin\NTLang.bat
  
--- 117,123 ----
  	$(COPY) $? $@
  	util_cr + $@
  
! $(DESTDIR)\bin\NTLang.bat: NTLang.bat util_cr.exe 
  	$(COPY) NTLang.bat $(DESTDIR)\bin
  	util_cr + $(DESTDIR)\bin\NTLang.bat
  
***************
*** 131,137 ****
  	- symlink make $(DESTDIR)\doc doc-pathname
  
  
! version: $(DESTDIR)\bin\mkvers.exe NTMakefile.version
  
  NTMakefile.version: NTMakefile.version-CML NTMakefile.version-NOCML
  	$(DEL) NTMakefile.version
--- 134,140 ----
  	- symlink make $(DESTDIR)\doc doc-pathname
  
  
! version: $(DESTDIR)\bin\mkvers.exe NTMakefile.version 
  
  NTMakefile.version: NTMakefile.version-CML NTMakefile.version-NOCML
  	$(DEL) NTMakefile.version
***************
*** 163,169 ****
  
  langsetup: $(DESTDIR)\bin\NTLang.bat
  
! install: idirs $(INCTOOLS) $(INCCOPY) version $(INCFILES) $(DESTDIR)\NTDllmap.txt langsetup 
  
  install9x: install
  
--- 166,172 ----
  
  langsetup: $(DESTDIR)\bin\NTLang.bat
  
! install: idirs $(INCTOOLS) $(INCCOPY) version $(INCFILES) $(DESTDIR)\NTDllmap.txt langsetup
  
  install9x: install
  
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.6 openafs/src/config/NTMakefile.i386_nt40:1.6.2.2
*** openafs/src/config/NTMakefile.i386_nt40:1.6	Sun Aug 19 10:44:47 2001
--- openafs/src/config/NTMakefile.i386_nt40	Wed Nov 14 22:38:52 2001
***************
*** 37,46 ****
  !ENDIF
  
  #define used in WinNT/2000 installation and program version display
! AFSPRODUCT_VERSION=1.1.1 a
  CELLNAME_DEFAULT=Your Cell Name
  CELLSERVDB_INSTALL=CellServDB.GrandCentral
  CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB
  
  !IFNDEF TARGETOS
  TARGETOS = WINNT
--- 37,47 ----
  !ENDIF
  
  #define used in WinNT/2000 installation and program version display
! AFSPRODUCT_VERSION=1.2.2 a
  CELLNAME_DEFAULT=Your Cell Name
  CELLSERVDB_INSTALL=CellServDB.GrandCentral
  CELLSERVDB_WEB=http://grand.central.org/dl/cellservdb/CellServDB
+ #NMAKE_DEFINES=-DDEBUG_VERBOSE
  
  !IFNDEF TARGETOS
  TARGETOS = WINNT
***************
*** 152,160 ****
  	-I$(DESTDIR)\include\rx \
  	-DWIN32_LEAN_AND_MEAN \
  	-DSTRICT \
! 	-D_WIN32_IE=0x0400
  
! afscdefs = $(afscdefs) $(AFSDEV_AUXCDEFINES)
  
  
  # Compiler switches (except include paths and preprocessor defines)
--- 153,163 ----
  	-I$(DESTDIR)\include\rx \
  	-DWIN32_LEAN_AND_MEAN \
  	-DSTRICT \
! 	-D_WIN32_IE=0x0400 \
!      -DAFS_AFSDB_ENV \
!      -DAFS_FREELANCE_CLIENT
  
! afscdefs = $(afscdefs) $(AFSDEV_AUXCDEFINES) $(NMAKE_DEFINES)
  
  
  # Compiler switches (except include paths and preprocessor defines)
***************
*** 306,312 ****
  CPP2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
  
  # Resource compiler macro
! RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS)
  
  # Lex/Yacc macros
  LEX = flex -l
--- 309,315 ----
  CPP2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) /c
  
  # Resource compiler macro
! RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS) /d "AFSPRODUCT_VERSION=\"$(AFSPRODUCT_VERSION)\""
  
  # Lex/Yacc macros
  LEX = flex -l
Index: openafs/src/config/NTMakefile.i386_win95
diff -c openafs/src/config/NTMakefile.i386_win95:1.3 openafs/src/config/NTMakefile.i386_win95:1.3.2.2
*** openafs/src/config/NTMakefile.i386_win95:1.3	Sun Aug 19 10:44:47 2001
--- openafs/src/config/NTMakefile.i386_win95	Wed Nov 14 22:38:52 2001
***************
*** 164,170 ****
  	-I$(DESTDIR)\include\rx \
  	-DWIN32_LEAN_AND_MEAN \
  	-DSTRICT \
! 	-D_WIN32_IE=0x0400
  
  !	IF ((EXIST($(MSSDK)\include)) && (("$(SYS_NAME)"=="i386_win95" ) || ("$(SYS_NAME)"=="I386_WIN95" )))
  afscdefs=$(afscdefs) -I$(MSSDK)\include $(afscppdefs) \
--- 164,172 ----
  	-I$(DESTDIR)\include\rx \
  	-DWIN32_LEAN_AND_MEAN \
  	-DSTRICT \
! 	-D_WIN32_IE=0x0400 \
!      -DAFS_AFSDB_ENV \
!      -DAFS_FREELANCE_CLIENT
  
  !	IF ((EXIST($(MSSDK)\include)) && (("$(SYS_NAME)"=="i386_win95" ) || ("$(SYS_NAME)"=="I386_WIN95" )))
  afscdefs=$(afscdefs) -I$(MSSDK)\include $(afscppdefs) \
***************
*** 325,331 ****
  CPP2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) $(afscppdefs) /c
  
  # Resource compiler macro
! RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS)
  
  # Lex/Yacc macros
  LEX = flex -l
--- 327,333 ----
  CPP2OBJ = $(cc) $(cflags) $(cdebug) $(cvarsdll) $(afscflags) $(afscdefs) $(afscppdefs) /c
  
  # Resource compiler macro
! RC = $(rc) $(rcvars) $(rcflags) $(AFSDEV_AUXRCFLAGS) /d "AFSPRODUCT_VERSION=\"$(AFSPRODUCT_VERSION)\""
  
  # Lex/Yacc macros
  LEX = flex -l
Index: openafs/src/config/afs_args.h
diff -c openafs/src/config/afs_args.h:1.3 openafs/src/config/afs_args.h:1.3.4.1
*** openafs/src/config/afs_args.h:1.3	Mon Apr 30 18:08:59 2001
--- openafs/src/config/afs_args.h	Sat Oct 13 00:21:18 2001
***************
*** 39,44 ****
--- 39,45 ----
  
  #define	AFSOP_ADDCELL2		 29	/* 2nd add cell protocol interface */
  #define	AFSOP_AFSDB_HANDLER	 30	/* userspace AFSDB lookup handler */
+ #define	AFSOP_SET_DYNROOT	 31	/* enable/disable dynroot support */
  
  /* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
  #define	AFSCALL_PIOCTL		20
***************
*** 105,110 ****
--- 106,112 ----
  /* #define AFSOP_STOP_RXEVENT   214     defined in osi.h	      */
  /* #define AFSOP_STOP_COMPLETE     215  defined in osi.h	      */
  /* #define AFSOP_STOP_RXK_LISTENER   217     defined in osi.h	      */
+ #define AFSOP_STOP_AFSDB	218	/* Stop AFSDB handler */
  
  /* Main afs syscall entry; this number may vary per system (i.e. defined in afs/param.h) */
  #ifndef	AFS_SYSCALL
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.14 openafs/src/config/afs_sysnames.h:1.14.2.2
*** openafs/src/config/afs_sysnames.h:1.14	Thu Sep  6 23:05:43 2001
--- openafs/src/config/afs_sysnames.h	Sat Nov 10 18:22:55 2001
***************
*** 49,54 ****
--- 49,55 ----
  #define SYS_NAME_ID_mac_mach51		 502
  #define SYS_NAME_ID_ppc_darwin_12        503
  #define SYS_NAME_ID_ppc_darwin_13        504
+ #define SYS_NAME_ID_ppc_darwin_14        505
  
  #define SYS_NAME_ID_next_mach20		 601
  #define SYS_NAME_ID_next_mach30		 602
***************
*** 80,85 ****
--- 81,87 ----
  #define SYS_NAME_ID_sunx86_55          	 937
  #define SYS_NAME_ID_sun4x_57		 938
  #define SYS_NAME_ID_sun4x_58		 939
+ #define SYS_NAME_ID_sun4x_59		 940
  
  /* Sigh. If I leave a gap here IBM will do this sequentially. If I don't
     they won't allocate sunx86 IDs at all. So leave a gap and pray. */
***************
*** 142,147 ****
--- 144,155 ----
  #define SYS_NAME_ID_ia64_linux2		2200
  #define SYS_NAME_ID_ia64_linux22	2201
  #define SYS_NAME_ID_ia64_linux24	2202
+ 
+ #define SYS_NAME_ID_m68k_linux22        2301
+ #define SYS_NAME_ID_m68k_linux24        2302
+ 
+ #define SYS_NAME_ID_parisc_linux22      2401
+ #define SYS_NAME_ID_parisc_linux24      2402
  
  /*
   * Placeholder to keep system-wide standard flags since this file is included by all 
Index: openafs/src/config/afsconfig-windows.h
diff -c openafs/src/config/afsconfig-windows.h:1.1 openafs/src/config/afsconfig-windows.h:1.1.6.1
*** openafs/src/config/afsconfig-windows.h:1.1	Sun Aug 19 10:44:47 2001
--- openafs/src/config/afsconfig-windows.h	Sat Oct 13 00:21:18 2001
***************
*** 194,200 ****
  #undef HAVE_RES_SEARCH
  //#undef HAVE_SOCKET
  
! #if ENDIANESS_IN_SYS_PARAM_H
  # ifndef KERNEL
  #  include <sys/types.h>
  #  include <sys/param.h>
--- 194,200 ----
  #undef HAVE_RES_SEARCH
  //#undef HAVE_SOCKET
  
! #ifdef ENDIANESS_IN_SYS_PARAM_H
  # ifndef KERNEL
  #  include <sys/types.h>
  #  include <sys/param.h>
***************
*** 204,210 ****
  # endif
  #endif
  
! #undef AFS_AFSDB_ENV
  #undef AFS_NAMEI_ENV
  #undef BOS_RESTRICTED_MODE
  
--- 204,211 ----
  # endif
  #endif
  
! /*#undef AFS_AFSDB_ENV*/
! #define AFS_AFSDB_ENV 1
  #undef AFS_NAMEI_ENV
  #undef BOS_RESTRICTED_MODE
  
Index: openafs/src/config/make_vnode.pl
diff -c /dev/null openafs/src/config/make_vnode.pl:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:16 2001
--- openafs/src/config/make_vnode.pl	Sat Oct 13 00:36:14 2001
***************
*** 0 ****
--- 1,113 ----
+ #!/usr/bin/perl
+ #
+ # Make VNODE structure from INODE structure
+ #
+ # Created By:	Derek Atkins <warlord@MIT.EDU>
+ #
+ 
+ $linux_header_dir="/usr/src/linux";
+ $outdir="./src/afs/LINUX";
+ 
+ $sepline="/* LINUX VNODE INCLUDED BELOW -- DO NOT MODIFY */\n";
+ 
+ # makeVfs (fs.h, vfs.hin, vfs.out)
+ sub makeVfs {
+     my ($in,$base,$out) = @_;
+     my ($seplinefound);
+ 
+     open (IN, "$in") || die "Cannot open $in for reading";
+     open (BASE, "$base" ) || die "Cannot open base file $base";
+     open (OUT, ">$out") || die "Cannot open tempfile $out";
+ 
+     while (<BASE>) {
+ 	print OUT;
+ 	if ($_ eq $sepline) {
+ 	    $seplinefound = 1;
+ 	    last;
+ 	}
+     }
+ 
+     print OUT $sepline if !$seplinefound;
+ 
+     my ($state) = 0;
+     while (<IN>) {
+ 
+ 	# Look for 'struct inode' definition
+ 	if ($state == 0) {
+ 	    next unless m/^struct\s+inode\s*\{/;
+ 	    $state++;
+ 	    s/inode/vnode/;
+ 	    # Fallthrough
+ 	}
+ 
+ 	# Look for 'union {' -- print otherwise
+ 	if ($state == 1) {
+ 	    if (m/^\s*union\s*\{/) {
+ 		$state++;
+ 		print OUT "#ifdef notdef\n";
+ 	    }
+ 	    print OUT;
+ 	    next;
+ 	}
+ 
+ 	# Look for the end of the union -- ignore otherwise
+ 	if ($state == 2) {
+ 	    print OUT;
+ 	    next unless (m/^\s+\}\s*u;/);
+ 	    $state++;
+ 	    print OUT "#endif /* notdef */\n";
+ 	    next;
+ 	}
+ 
+ 	# Look for end brace -- print until we find it
+ 	if ($state == 3) {
+ 	    print OUT;
+ 	    if (m/^\s*\};/) { $state++ }
+ 	}
+     }
+ 
+     while (<BASE>) { print OUT; }
+ 
+     close (IN);
+     close (BASE);
+     close (OUT);
+ }
+ 
+ sub usage {
+     print "usage: $0 [-i linux_header_dir] [-o output_dir] [-h]\n";
+     exit 1;
+ }
+ 
+ sub testArg {
+     my ($arg) = @_;
+     return $arg if ($arg && $arg ne "");
+     usage;
+ }
+ 
+ while ($_ = shift @ARGV) {
+     if (m/^-i/) { $linux_header_dir = testArg(shift @ARGV); next; }
+     if (m/^-o/) { $outdir = testArg(shift @ARGV); next; }
+     usage;
+ }
+ 
+ $linux_fs_h="$linux_header_dir/include/linux/fs.h";
+ $vfs_h="$outdir/osi_vfs.h";
+ $vfs_hin="$outdir/osi_vfs.hin";
+ 
+ makeVfs ($linux_fs_h, $vfs_hin, "$vfs_h.new");
+ 
+ system ("cmp", "-s", $vfs_h, "$vfs_h.new");
+ $exit_value = $? >> 8;
+ $signal_num = $? & 127;
+ $core_dump  = $? & 128;
+ 
+ if ($exit_value == 0 || $signal_num > 0) {
+     unlink "$vfs_h.new";
+     print "nothing to do... $vfs_h not changed.\n"
+ } else {
+     unlink "$vfs_h";
+     rename ("$vfs_h.new", $vfs_h);
+     print "wrote $vfs_h\n";
+ }
+ 
+ exit 0;
Index: openafs/src/config/mkvers.c
diff -c openafs/src/config/mkvers.c:1.3 openafs/src/config/mkvers.c:1.3.6.1
*** openafs/src/config/mkvers.c:1.3	Tue Mar 27 02:07:35 2001
--- openafs/src/config/mkvers.c	Sat Oct 13 00:21:18 2001
***************
*** 85,102 ****
  
  main(int argc, char **argv)
  {
-     int n = 0;
      char stampsFile[1024];
      char stateFile[1024];
      char s[1024];
-     char *p;
      int i;
      char *baseDir;
      int argDir = 0;
      char *outputFile = NULL;
      char outputFileBuf[sizeof(VERS_FILE) + 2];
      struct stat sbuf;
!     time_t versTime, stampsTime, stateTime;
      int reBuild = 0;
      int code;
      char *cml_prefix = NULL;
--- 85,100 ----
  
  main(int argc, char **argv)
  {
      char stampsFile[1024];
      char stateFile[1024];
      char s[1024];
      int i;
      char *baseDir;
      int argDir = 0;
      char *outputFile = NULL;
      char outputFileBuf[sizeof(VERS_FILE) + 2];
      struct stat sbuf;
!     time_t versTime;
      int reBuild = 0;
      int code;
      char *cml_prefix = NULL;
Index: openafs/src/config/param.alpha_dux40.h
diff -c openafs/src/config/param.alpha_dux40.h:1.4 openafs/src/config/param.alpha_dux40.h:1.4.4.1
*** openafs/src/config/param.alpha_dux40.h:1.4	Thu Jul  5 17:41:15 2001
--- openafs/src/config/param.alpha_dux40.h	Wed Nov 14 22:20:55 2001
***************
*** 102,107 ****
--- 102,111 ----
  #include <net/net_globals.h>
  
  #endif	/* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ 
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
  #endif /* _KERNEL */
  
  #endif	/* AFS_PARAM_H */
Index: openafs/src/config/param.alpha_dux50.h
diff -c openafs/src/config/param.alpha_dux50.h:1.2 openafs/src/config/param.alpha_dux50.h:1.2.4.1
*** openafs/src/config/param.alpha_dux50.h:1.2	Thu Jul  5 11:20:18 2001
--- openafs/src/config/param.alpha_dux50.h	Wed Nov 14 22:20:55 2001
***************
*** 103,108 ****
--- 103,112 ----
  #include <net/net_globals.h>
  
  #endif	/* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ 
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
  #endif /* _KERNEL */
  
  #endif	/* AFS_PARAM_H */
Index: openafs/src/config/param.alpha_linux_24.h
diff -c /dev/null openafs/src/config/param.alpha_linux_24.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:16 2001
--- openafs/src/config/param.alpha_linux_24.h	Sat Oct 13 00:36:14 2001
***************
*** 0 ****
--- 1,75 ----
+ #ifndef _PARAM_ALPHA_LINUX_24_H_
+ #define _PARAM_ALPHA_LINUX_24_H_
+ 
+ /* Linux 2.2.16 kernel on Alpha with glibc 2.2 */
+  
+ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+  * it's a judgment call. If something is obviously sparc64 specific, use that
+  * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+  * in the sysname is the current version of the client. This takes into
+  * account the perferred OS user space configuration as well as the kernel.
+  */
+ 
+ #define AFS_LINUX20_ENV        1
+ #define AFS_LINUX22_ENV        1
+ #define AFS_LINUX24_ENV     1
+ #define AFS_ALPHA_LINUX20_ENV  1
+ #define AFS_ALPHA_LINUX22_ENV  1
+ #define AFS_ALPHA_LINUX24_ENV  1
+ #define __alpha        1
+ #define AFS_LINUX_64BIT_KERNEL 1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+ #define AFS_SYSCALL 338
+ #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_NAMEI_ENV     1   /* User space interface to file system */
+ 
+ #define AFS_64BIT_ENV          1       /* Defines afs_int32 as int, not long. */
+ #define AFS_64BITPOINTER_ENV   1       /* pointers are 64 bits. */
+ 
+ #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/config.h>
+ #ifdef CONFIG_SMP
+ #undef CONFIG_SMP
+ #endif
+ /* Using "AFS_SMP" to map to however many #define's are required to get
+  * MP to compile for Linux
+  */
+ #ifdef AFS_SMP
+ #define CONFIG_SMP
+ #ifndef __SMP__
+ #define __SMP__
+ #endif
+ #define AFS_GLOBAL_SUNLOCK
+ #endif
+ #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
+ #define MODVERSIONS
+ #include <linux/modversions.h>
+ #endif
+ #endif /* __KERNEL__  && !DUMP_KERNEL*/
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS             0       /* if nonzero, garbage collect PAGs */
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME       "alpha_linux_24"
+ #define SYS_NAME_ID    SYS_NAME_ID_alpha_linux_24
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+ 
+ #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 /* _PARAM_ALPHA_LINUX_24_H_ */
Index: openafs/src/config/param.alpha_linux_24_usr.h
diff -c /dev/null openafs/src/config/param.alpha_linux_24_usr.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:17 2001
--- openafs/src/config/param.alpha_linux_24_usr.h	Sat Oct 13 00:36:14 2001
***************
*** 0 ****
--- 1,55 ----
+ #ifndef _PARAM_ALPHA_LINUX_24_USR_H_
+ #define _PARAM_ALPHA_LINUX_24_USR_H_
+ 
+ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+  * it's a judgment call. If something is obviously sparc64 specific, use that
+  * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+  * in the sysname is the current version of the client. This takes into
+  * account the perferred OS user space configuration as well as the kernel.
+  */
+ 
+ #define UKERNEL                        1       /* user space kernel */
+ #define AFS_ENV                        1
+ #define AFS_USR_LINUX20_ENV    1
+ #define AFS_USR_LINUX22_ENV    1
+ #define AFS_USR_LINUX24_ENV    1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+ #define AFS_SYSCALL 338
+ #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV       1
+ #define AFS_NAMEI_ENV     1   /* User space interface to file system */
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS             0       /* if nonzero, garbage collect PAGs */
+ 
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME       "alpha_linux_24"
+ #define SYS_NAME_ID    SYS_NAME_ID_alpha_linux_24
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+ 
+ #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
+ 
+ #endif /* _PARAM_ALPHA_LINUX_24_USR_H_ */
Index: openafs/src/config/param.i386_obsd29.h
diff -c openafs/src/config/param.i386_obsd29.h:1.1.2.1 openafs/src/config/param.i386_obsd29.h:1.1.2.2
*** openafs/src/config/param.i386_obsd29.h:1.1.2.1	Wed Sep 19 18:59:39 2001
--- openafs/src/config/param.i386_obsd29.h	Sat Oct 13 00:21:18 2001
***************
*** 81,88 ****
  #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
--- 81,88 ----
  #define vfs_fsid	mnt_stat.f_fsid
  #define va_nodeid	va_fileid
  #define vfs_vnodecovered mnt_vnodecovered
  #define vnode_t		struct vnode
+ #define setgroups	sys_setgroups
  
  #ifndef MUTEX_DEFAULT
  #define MUTEX_DEFAULT   0
Index: openafs/src/config/param.parisc_linux24.h
diff -c /dev/null openafs/src/config/param.parisc_linux24.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:17 2001
--- openafs/src/config/param.parisc_linux24.h	Sat Oct 13 00:36:14 2001
***************
*** 0 ****
--- 1,68 ----
+ #ifndef AFS_PARAM_H
+ #define AFS_PARAM_H
+ 
+ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+  * it's a judgment call. If something is obviously ppc specific, use that
+  * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+  * in the sysname is the current version of the client. This takes into
+  * account the perferred OS user space configuration as well as the kernel.
+  */
+ 
+ #define AFS_LINUX20_ENV        1
+ #define AFS_LINUX22_ENV        1
+ #define AFS_LINUX24_ENV        1
+ #define AFS_PARISC_LINUX24_ENV    1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+ #define AFS_SYSCALL 137
+ #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_NAMEI_ENV     1   /* User space interface to file system */
+ 
+ #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/config.h>
+ #ifdef CONFIG_SMP
+ #undef CONFIG_SMP
+ #endif
+ /* Using "AFS_SMP" to map to however many #define's are required to get
+  * MP to compile for Linux
+  */
+ #ifdef AFS_SMP
+ #define CONFIG_SMP
+ #ifndef __SMP__
+ #define __SMP__
+ #endif
+ #define AFS_GLOBAL_SUNLOCK
+ #endif
+ 
+ #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
+ #define MODVERSIONS
+ #include <linux/modversions.h>
+ #endif
+ #endif /* __KERNEL__  && !DUMP_KERNEL*/
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS             0       /* if nonzero, garbage collect PAGs */
+ 
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME       "parisc_linux24"
+ #define SYS_NAME_ID    SYS_NAME_ID_parisc_linux24
+ #define AFSBIG_ENDIAN    1
+ #define AFS_HAVE_FFS        1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+ 
+ #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 /* AFS_PARAM_H */
Index: openafs/src/config/param.parisc_linux24_usr.h
diff -c /dev/null openafs/src/config/param.parisc_linux24_usr.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:17 2001
--- openafs/src/config/param.parisc_linux24_usr.h	Sat Oct 13 00:36:14 2001
***************
*** 0 ****
--- 1,54 ----
+ #ifndef AFS_PARAM_H
+ #define AFS_PARAM_H
+ 
+ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+  * it's a judgment call. If something is obviously ppc specific, use that
+  * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+  * in the sysname is the current version of the client. This takes into
+  * account the perferred OS user space configuration as well as the kernel.
+  */
+ 
+ #define UKERNEL                        1       /* user space kernel */
+ #define AFS_ENV                        1
+ #define AFS_USR_LINUX20_ENV    1
+ #define AFS_USR_LINUX22_ENV    1
+ #define AFS_USR_LINUX24_ENV    1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+ #define AFS_SYSCALL 137
+ #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_NAMEI_ENV     1   /* User space interface to file system */
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS             0       /* if nonzero, garbage collect PAGs */
+ 
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME       "parisc_linux24"
+ #define SYS_NAME_ID    SYS_NAME_ID_parisc_linux24
+ #define AFSBIG_ENDIAN       1
+ #define AFS_HAVE_FFS        1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+ 
+ #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
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.ppc_darwin_14.h
diff -c /dev/null openafs/src/config/param.ppc_darwin_14.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:17 2001
--- openafs/src/config/param.ppc_darwin_14.h	Sat Nov 10 18:22:55 2001
***************
*** 0 ****
--- 1,62 ----
+ #ifndef AFS_PARAM_H
+ #define AFS_PARAM_H
+ 
+ #define AFS_ENV                 1
+ #define AFS_64BIT_ENV           1       /* Defines afs_int32 as int, not long. */
+ #define AFS_PPC_ENV 1
+ #define AFS_VFSINCL_ENV 1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_DARWIN_ENV
+ #define AFS_DARWIN13_ENV
+ #define AFS_DARWIN14_ENV
+ #define AFS_NONFSTRANS
+ #define AFS_SYSCALL             230
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS    "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_ppc_darwin_12   1
+ #define sys_ppc_darwin_13   1
+ #define sys_ppc_darwin_14   1
+ #define SYS_NAME        "ppc_darwin_14"
+ #define SYS_NAME_ID     SYS_NAME_ID_ppc_darwin_14
+ #define AFSBIG_ENDIAN   1
+ #define AFS_HAVE_FFS    1       /* Use system's ffs. */
+ 
+ #define AFS_GCPAGS                1       /* if nonzero, garbage collect PAGs */
+ #define RXK_LISTENER_ENV         1
+ 
+ #ifdef KERNEL
+ #undef MACRO_BEGIN
+ #undef MACRO_END
+ #include <kern/macro_help.h>
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define AFS_VFS34       1       /* What is VFS34??? */
+ #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)   kalloc(x)
+ #define AFS_KFREE(x,y)  kfree(x,y)
+ #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
+ 
+ #define VN_RELE(vp)     vrele(((struct vnode *)(vp)))
+ #define VN_HOLD(vp)     VREF(((struct vnode *)(vp)))
+ 
+ #endif
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.ppc_darwin_14_usr.h
diff -c /dev/null openafs/src/config/param.ppc_darwin_14_usr.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:17 2001
--- openafs/src/config/param.ppc_darwin_14_usr.h	Sat Nov 10 18:22:55 2001
***************
*** 0 ****
--- 1,50 ----
+ #ifndef AFS_PARAM_H
+ #define AFS_PARAM_H
+ 
+ #define AFS_VFSINCL_ENV 1       /* NOBODY uses this.... */
+ #define AFS_ENV                 1
+ #define AFS_64BIT_ENV           1       /* Defines afs_int32 as int, not long. */
+ #define AFS_PPC_ENV 1
+ 
+ #include <afs/afs_sysnames.h>
+ #define AFS_USERSPACE_ENV
+ #define AFS_USR_DARWIN_ENV
+ #define AFS_USR_DARWIN13_ENV
+ #define AFS_USR_DARWIN14_ENV
+ #define AFS_NONFSTRANS 
+ #define AFS_SYSCALL             230
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS    "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_ppc_darwin_12   1
+ #define sys_ppc_darwin_13   1
+ #define sys_ppc_darwin_14   1
+ #define SYS_NAME        "ppc_darwin_14"
+ #define SYS_NAME_ID     SYS_NAME_ID_ppc_darwin_14
+ #define AFSBIG_ENDIAN   1
+ #define AFS_HAVE_FFS    1       /* Use system's ffs. */
+ 
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ 
+ #define AFS_GCPAGS                0       /* if nonzero, garbage collect PAGs */
+ #define RXK_LISTENER_ENV          1
+ 
+ #define AFS_VFS34       1       /* What is VFS34??? */
+ #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        VATTR_NULL      usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.sgi_62.h
diff -c openafs/src/config/param.sgi_62.h:1.3 openafs/src/config/param.sgi_62.h:1.3.4.1
*** openafs/src/config/param.sgi_62.h:1.3	Thu Jul  5 11:20:18 2001
--- openafs/src/config/param.sgi_62.h	Sat Oct 13 00:21:18 2001
***************
*** 92,97 ****
--- 92,102 ----
  #define	DEBUG		1
  
  #define AFS_SGI_DUAL_FS_CACHE 1 /* implies supports EFS or XFS cache */
+ 
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
+ 
  #endif /* KERNEL */
  
  #ifndef CMSERVERPREF
Index: openafs/src/config/param.sgi_63.h
diff -c openafs/src/config/param.sgi_63.h:1.3 openafs/src/config/param.sgi_63.h:1.3.4.1
*** openafs/src/config/param.sgi_63.h:1.3	Thu Jul  5 11:20:18 2001
--- openafs/src/config/param.sgi_63.h	Sat Oct 13 00:21:18 2001
***************
*** 86,91 ****
--- 86,95 ----
  #define AFS_EVENT_LOCK  1 /* osi_Sleep/osi_Wakeup use spinlock. */
  #define AFS_SGI_DUAL_FS_CACHE 1 /* implies supports EFS or XFS cache */
  
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
+ 
  #endif /* KERNEL */
  
  #ifndef CMSERVERPREF
Index: openafs/src/config/param.sgi_64.h
diff -c openafs/src/config/param.sgi_64.h:1.3 openafs/src/config/param.sgi_64.h:1.3.4.1
*** openafs/src/config/param.sgi_64.h:1.3	Thu Jul  5 11:20:18 2001
--- openafs/src/config/param.sgi_64.h	Sat Oct 13 00:21:18 2001
***************
*** 102,107 ****
--- 102,111 ----
  #define AFS_EVENT_LOCK  1 /* osi_Sleep/osi_Wakeup use spinlock. */
  #define AFS_SGI_DUAL_FS_CACHE 1 /* implies supports EFS or XFS cache */
  
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
+ 
  #endif /* KERNEL */
  
  #ifndef CMSERVERPREF
Index: openafs/src/config/param.sgi_65.h
diff -c openafs/src/config/param.sgi_65.h:1.3 openafs/src/config/param.sgi_65.h:1.3.4.1
*** openafs/src/config/param.sgi_65.h:1.3	Thu Jul  5 11:20:18 2001
--- openafs/src/config/param.sgi_65.h	Sat Oct 13 00:21:18 2001
***************
*** 110,115 ****
--- 110,119 ----
  #define AFS_EVENT_LOCK  1 /* osi_Sleep/osi_Wakeup use spinlock. */
  #define AFS_SGI_DUAL_FS_CACHE 1 /* implies supports EFS or XFS cache */
  
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
+ 
  #endif /* KERNEL */
  
  #ifndef CMSERVERPREF
Index: openafs/src/config/param.sun4x_59.h
diff -c /dev/null openafs/src/config/param.sun4x_59.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:17 2001
--- openafs/src/config/param.sun4x_59.h	Sat Oct 13 00:27:21 2001
***************
*** 0 ****
--- 1,113 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define AFS_VFS_ENV	1
+ /* Used only in vfsck code; is it needed any more???? */
+ 
+ #define AFS_VFSINCL_ENV	1	/* NOBODY uses this.... */
+ #define AFS_GREEDY43_ENV	1	/* Used only in rx/rx_user.c */
+ #define AFS_ENV			1
+ #define AFS_SUN_ENV		1
+ #define AFS_SUN5_ENV		1
+ #define	AFS_SUN52_ENV		1
+ #define	AFS_SUN53_ENV		1
+ #define	AFS_SUN54_ENV		1
+ #define	AFS_SUN55_ENV		1
+ #define	AFS_SUN56_ENV		1
+ #define AFS_SUN57_ENV		1
+ #define AFS_SUN58_ENV		1
+ #define AFS_SUN59_ENV		1
+ 
+ #define AFS_64BIT_ENV		1       /* Defines afs_int32 as int, not long. */
+ 
+ #ifdef AFS_NAMEI_ENV
+ #define AFS_64BIT_IOPS_ENV     1       /* needed for NAMEI... */
+ #else /* AFS_NAMEI_ENV */
+ #define AFS_3DISPARES           1       /* Utilize the 3 available disk inode 'spares' */
+ #endif /* AFS_NAMEI_ENV */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
+ #define RXK_LISTENER_ENV   1
+ #define AFS_GCPAGS		1       /* if nonzero, garbage collect PAGs */
+ 
+ #define	AFS_SYSCALL		65
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS	 "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_sun4x_59	1
+ #define SYS_NAME	"sun4x_59"
+ #define SYS_NAME_ID	SYS_NAME_ID_sun4x_59
+ #define AFSBIG_ENDIAN	1
+ #define AFS_HAVE_FFS    1       /* Use system's ffs. */
+ #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
+ #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY 1  /* use gettimeofday to implement rx clock */
+ 
+ #define NEARINODE_HINT  1   /* hint to ufs module to scatter inodes on disk*/
+ #define nearInodeHash(volid, hval) {                                 \
+                 unsigned char*  ts = (unsigned char*)&(volid)+sizeof(volid)-1;\
+                 for ( (hval)=0; ts >= (unsigned char*)&(volid); ts--){\
+                     (hval) *= 173;                      \
+                     (hval) += *ts;                      \
+                 }                                       \
+                 }
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef KERNEL
+ /* sun definitions here */
+ #define	AFS_UIOFMODE		1	/* Only in afs/afs_vnodeops.c (afs_ustrategy) */
+ #define	AFS_SYSVLOCK		1	/* sys v locking supported */
+ /*#define	AFS_USEBUFFERS	1*/
+ #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	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	osi_GetTime(x)	uniqtime(x)
+ 
+ /**
+   * These defines are for the 64 bit Solaris 7 port
+   * AFS_SYSCALL32 is used to protect the ILP32 syscall interface
+   * AFS_64BIT_ENV is for use of 64 bit inode numbers
+   */
+ #if defined(__sparcv9)
+ #define	AFS_SUN57_64BIT_ENV	1
+ #define AFS_64BIT_INO   	1
+ #endif
+ 
+ /**
+   * Solaris 7 64 bit has two versions of uniqtime. Since we consistently
+   * use 32 bit quantities for time in afs, we now use uniqtime32
+   */
+ #if defined(AFS_SUN57_64BIT_ENV)
+ #undef osi_GetTime
+ #define osi_GetTime(x)  uniqtime32(x)
+ #endif
+ 
+ 
+ 
+ #define	AFS_KALLOC(n)	kmem_alloc(n, KM_SLEEP)
+ #define AFS_KALLOC_NOSLEEP(n)   kmem_alloc(n, KM_NOSLEEP)
+ #define	AFS_KFREE	kmem_free
+ #define	VATTR_NULL	vattr_null
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
+ #endif /* KERNEL */
+ #define	AFS_DIRENT	
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ #define	ROOTINO		UFSROOTINO
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.sun4x_59_usr.h
diff -c /dev/null openafs/src/config/param.sun4x_59_usr.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:17 2001
--- openafs/src/config/param.sun4x_59_usr.h	Sat Oct 13 00:27:21 2001
***************
*** 0 ****
--- 1,62 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define AFS_VFS_ENV	1
+ /* Used only in vfsck code; is it needed any more???? */
+ #define RXK_LISTENER_ENV	1
+ #define AFS_USERSPACE_IP_ADDR	1
+ #define AFS_GCPAGS		0       /* if nonzero, garbage collect PAGs */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_GREEDY43_ENV	1	/* Used only in rx/rx_user.c */
+ #define AFS_ENV			1
+ #define AFS_USR_SUN5_ENV	1
+ #define AFS_USR_SUN6_ENV	1
+ #define AFS_USR_SUN7_ENV	1
+ #define AFS_USR_SUN8_ENV	1
+ #define AFS_USR_SUN9_ENV	1
+ 
+ #define AFS_64BIT_ENV          1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ /*#define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
+ 
+ #define	AFS_3DISPARES		1	/* Utilize the 3 available disk inode 'spares' */
+ #define	AFS_SYSCALL		65
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS	 1
+ 
+ /* Machine / Operating system information */
+ #define sys_sun4x_59	1
+ #define SYS_NAME	"sun4x_59"
+ #define SYS_NAME_ID	SYS_NAME_ID_sun4x_59
+ #define AFSBIG_ENDIAN	1
+ #define AFS_HAVE_FFS            1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS      0       /* System doesn't support statvfs */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef KERNEL
+ #define	AFS_UIOFMODE		1	/* Only in afs/afs_vnodeops.c (afs_ustrategy) */
+ #define	AFS_SYSVLOCK		1	/* sys v locking supported */
+ /*#define	AFS_USEBUFFERS	1*/
+ #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
+ #endif /* KERNEL */
+ #define	AFS_DIRENT	
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ #define	ROOTINO		UFSROOTINO
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/dauth/dlog.c
diff -c openafs/src/dauth/dlog.c:1.6.2.1 openafs/src/dauth/dlog.c:1.6.2.2
*** openafs/src/dauth/dlog.c:1.6.2.1	Wed Sep 19 18:40:32 2001
--- openafs/src/dauth/dlog.c	Sat Oct 13 00:21:20 2001
***************
*** 71,77 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/dauth/dlog.c,v 1.6.2.1 2001/09/19 22:40:32 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 71,77 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/dauth/dlog.c,v 1.6.2.2 2001/10/13 04:21:20 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/des/andrew-conf.h
diff -c openafs/src/des/andrew-conf.h:1.10.2.1 openafs/src/des/andrew-conf.h:1.10.2.2
*** openafs/src/des/andrew-conf.h:1.10.2.1	Wed Sep 19 18:25:24 2001
--- openafs/src/des/andrew-conf.h	Sat Oct 13 00:21:21 2001
***************
*** 43,48 ****
--- 43,51 ----
  #include "conf-i386-obsd.h"
  #else
  #if defined(AFS_LINUX20_ENV) || defined(AFS_DJGPP_ENV)
+ #ifdef AFS_PARISC_LINUX20_ENV
+ #include "conf-parisc-linux.h"
+ #else
  #ifdef AFS_PPC_LINUX20_ENV
  #include "conf-ppc-linux.h"
  #else
***************
*** 67,73 ****
  #endif /* AFS_S390_LINUX20_ENV */
  #endif /* AFS_SPARC64_LINUX20_ENV */
  #endif /* AFS_SPARC_LINUX20_ENV */
! #endif
  #else
  #if defined(AFS_DARWIN_ENV) && defined(AFS_PPC_ENV)
  #include "conf-ppc-darwin.h"
--- 70,77 ----
  #endif /* AFS_S390_LINUX20_ENV */
  #endif /* AFS_SPARC64_LINUX20_ENV */
  #endif /* AFS_SPARC_LINUX20_ENV */
! #endif /* AFS_PPC_LINUX20_ENV */
! #endif /* AFS_PARISC_LINUX24_ENV */
  #else
  #if defined(AFS_DARWIN_ENV) && defined(AFS_PPC_ENV)
  #include "conf-ppc-darwin.h"
Index: openafs/src/des/conf-parisc-linux.h
diff -c /dev/null openafs/src/des/conf-parisc-linux.h:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:17 2001
--- openafs/src/des/conf-parisc-linux.h	Sat Oct 13 00:41:49 2001
***************
*** 0 ****
--- 1,4 ----
+ #define BITS32
+ #define BIG
+ #define MSBFIRST
+ #define MUSTALIGN
Index: openafs/src/des/main.c
diff -c openafs/src/des/main.c:1.1 openafs/src/des/main.c:1.1.2.1
*** openafs/src/des/main.c:1.1	Tue Aug 28 19:12:55 2001
--- openafs/src/des/main.c	Sat Oct 13 00:21:21 2001
***************
*** 13,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/des/main.c,v 1.1 2001/08/28 23:12:55 shadow Exp $");
  
  #include <mit-cpyright.h>
  #include <stdio.h>
  #include "des_internal.h"
  
  extern void gen PROTOTYPE((FILE * stream));
--- 13,32 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/des/main.c,v 1.1.2.1 2001/10/13 04:21:21 shadow Exp $");
  
  #include <mit-cpyright.h>
  #include <stdio.h>
+ #include <stdlib.h>
+ 
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
+ 
  #include "des_internal.h"
  
  extern void gen PROTOTYPE((FILE * stream));
Index: openafs/src/des/make_ip.c
diff -c openafs/src/des/make_ip.c:1.4 openafs/src/des/make_ip.c:1.4.4.1
*** openafs/src/des/make_ip.c:1.4	Thu Jul 12 15:58:34 2001
--- openafs/src/des/make_ip.c	Sat Oct 13 00:21:21 2001
***************
*** 11,20 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/des/make_ip.c,v 1.4 2001/07/12 19:58:34 shadow Exp $");
  
  #include <mit-cpyright.h>
  #include <stdio.h>
  #include "des_internal.h"
  
  #define WANT_IP_TABLE
--- 11,21 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/des/make_ip.c,v 1.4.4.1 2001/10/13 04:21:21 shadow Exp $");
  
  #include <mit-cpyright.h>
  #include <stdio.h>
+ #include <stdlib.h>
  #include "des_internal.h"
  
  #define WANT_IP_TABLE
Index: openafs/src/des/read_pssword.c
diff -c openafs/src/des/read_pssword.c:1.12.2.1 openafs/src/des/read_pssword.c:1.12.2.2
*** openafs/src/des/read_pssword.c:1.12.2.1	Wed Sep 19 18:25:24 2001
--- openafs/src/des/read_pssword.c	Sat Oct 13 00:21:21 2001
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/des/read_pssword.c,v 1.12.2.1 2001/09/19 22:25:24 shadow Exp $");
  
  #include <mit-cpyright.h>
  #include <des.h>
--- 14,20 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/des/read_pssword.c,v 1.12.2.2 2001/10/13 04:21:21 shadow Exp $");
  
  #include <mit-cpyright.h>
  #include <des.h>
Index: openafs/src/dir/buffer.c
diff -c openafs/src/dir/buffer.c:1.5.2.1 openafs/src/dir/buffer.c:1.5.2.2
*** openafs/src/dir/buffer.c:1.5.2.1	Wed Sep 19 18:36:21 2001
--- openafs/src/dir/buffer.c	Sat Oct 13 00:21:28 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/dir/buffer.c,v 1.5.2.1 2001/09/19 22:36:21 shadow Exp $");
  
  #include <stdlib.h>
  #include <lock.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/dir/buffer.c,v 1.5.2.2 2001/10/13 04:21:28 shadow Exp $");
  
  #include <stdlib.h>
  #include <lock.h>
Index: openafs/src/dir/dir.h
diff -c openafs/src/dir/dir.h:1.2 openafs/src/dir/dir.h:1.2.8.1
*** openafs/src/dir/dir.h:1.2	Sat Nov  4 05:04:27 2000
--- openafs/src/dir/dir.h	Sat Oct 13 00:21:28 2001
***************
*** 39,46 ****
      };
  
  struct DirHeader
!     {/* A directory header object.
!      */struct PageHeader header;
      char alloMap[MAXPAGES];    /* one byte per 2K page */
      unsigned short hashTable[NHASHENT];
      };
--- 39,46 ----
      };
  
  struct DirHeader
!     {/* A directory header object. */
!     struct PageHeader header;
      char alloMap[MAXPAGES];    /* one byte per 2K page */
      unsigned short hashTable[NHASHENT];
      };
Index: openafs/src/dir/salvage.c
diff -c openafs/src/dir/salvage.c:1.5.2.1 openafs/src/dir/salvage.c:1.5.2.2
*** openafs/src/dir/salvage.c:1.5.2.1	Wed Sep 19 18:36:21 2001
--- openafs/src/dir/salvage.c	Sat Oct 13 00:21:28 2001
***************
*** 12,18 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/dir/salvage.c,v 1.5.2.1 2001/09/19 22:36:21 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
--- 12,18 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/dir/salvage.c,v 1.5.2.2 2001/10/13 04:21:28 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
Index: openafs/src/finale/translate_et.c
diff -c openafs/src/finale/translate_et.c:1.5.4.1 openafs/src/finale/translate_et.c:1.5.4.2
*** openafs/src/finale/translate_et.c:1.5.4.1	Wed Sep 19 18:40:33 2001
--- openafs/src/finale/translate_et.c	Sat Oct 13 00:21:30 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/finale/translate_et.c,v 1.5.4.1 2001/09/19 22:40:33 shadow Exp $");
  
  #include <afs/com_err.h>
  #include <rx/rxkad.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/finale/translate_et.c,v 1.5.4.2 2001/10/13 04:21:30 shadow Exp $");
  
  #include <afs/com_err.h>
  #include <rx/rxkad.h>
Index: openafs/src/fsint/afsint.xg
diff -c openafs/src/fsint/afsint.xg:1.3 openafs/src/fsint/afsint.xg:1.3.6.1
*** openafs/src/fsint/afsint.xg:1.3	Sat Feb 10 16:26:26 2001
--- openafs/src/fsint/afsint.xg	Sat Oct 13 00:21:31 2001
***************
*** 101,109 ****
      afs_uint32 Group;
      afs_uint32 SyncCounter;
      afs_uint32 dataVersionHigh; /* For AFS/DFS translator, hi bits of dvn */
!     afs_uint32 spare2;
      afs_uint32 spare3;
!     afs_uint32 spare4;
  };
  
  struct AFSStoreStatus {
--- 101,109 ----
      afs_uint32 Group;
      afs_uint32 SyncCounter;
      afs_uint32 dataVersionHigh; /* For AFS/DFS translator, hi bits of dvn */
!     afs_uint32 lockCount;
      afs_uint32 spare3;
!     afs_uint32 errorCode;
  };
  
  struct AFSStoreStatus {
***************
*** 570,572 ****
--- 570,579 ----
    IN struct ResidencyCmdInputs *Inputs,
    OUT struct ResidencyCmdOutputs *Outputs
  ) = 220; 
+ 
+ InlineBulkStatus(
+   IN  AFSCBFids *FidsArray,
+   OUT AFSBulkStats *StatArray,
+   AFSCBs *CBArray,
+   AFSVolSync *Sync
+ ) = 65536;
Index: openafs/src/kauth/NTMakefile
diff -c openafs/src/kauth/NTMakefile:1.3.4.1 openafs/src/kauth/NTMakefile:1.3.4.2
*** openafs/src/kauth/NTMakefile:1.3.4.1	Wed Sep 19 18:32:52 2001
--- openafs/src/kauth/NTMakefile	Sat Oct 13 00:21:33 2001
***************
*** 94,100 ****
  	$(DESTDIR)\lib\afsrx.lib \
  	$(DESTDIR)\lib\afsubik.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afsrxkad.lib
  	
  TOKENLIB = $(DESTDIR)\lib\afs\afspioctl.lib
  
--- 94,101 ----
  	$(DESTDIR)\lib\afsrx.lib \
  	$(DESTDIR)\lib\afsubik.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afsrxkad.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  	
  TOKENLIB = $(DESTDIR)\lib\afs\afspioctl.lib
  
Index: openafs/src/kauth/admin_tools.c
diff -c openafs/src/kauth/admin_tools.c:1.8.2.1 openafs/src/kauth/admin_tools.c:1.8.2.2
*** openafs/src/kauth/admin_tools.c:1.8.2.1	Wed Sep 19 18:36:23 2001
--- openafs/src/kauth/admin_tools.c	Sat Oct 13 00:21:33 2001
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/admin_tools.c,v 1.8.2.1 2001/09/19 22:36:23 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/debug.h>
--- 15,21 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/admin_tools.c,v 1.8.2.2 2001/10/13 04:21:33 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/debug.h>
***************
*** 715,721 ****
        
      printf ("Converting %s with the DES string to key yields key='",
  	    as->parms[0].items->data);
!     ka_PrintBytes (&key, sizeof(key));
      printf ("'.\n");
  
      return 0;
--- 715,721 ----
        
      printf ("Converting %s with the DES string to key yields key='",
  	    as->parms[0].items->data);
!     ka_PrintBytes ((char *)&key, sizeof(key));
      printf ("'.\n");
  
      return 0;
Index: openafs/src/kauth/authclient.c
diff -c openafs/src/kauth/authclient.c:1.7.2.1 openafs/src/kauth/authclient.c:1.7.2.2
*** openafs/src/kauth/authclient.c:1.7.2.1	Wed Sep 19 18:36:23 2001
--- openafs/src/kauth/authclient.c	Sat Oct 13 00:21:33 2001
***************
*** 16,22 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/authclient.c,v 1.7.2.1 2001/09/19 22:36:23 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 16,22 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/authclient.c,v 1.7.2.2 2001/10/13 04:21:33 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
***************
*** 44,49 ****
--- 44,56 ----
  #else
  #include <sys/socket.h>
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <rx/rxkad.h>
  #include <afs/cellconfig.h>
Index: openafs/src/kauth/client.c
diff -c openafs/src/kauth/client.c:1.7.2.1 openafs/src/kauth/client.c:1.7.2.2
*** openafs/src/kauth/client.c:1.7.2.1	Wed Sep 19 18:40:34 2001
--- openafs/src/kauth/client.c	Sat Oct 13 00:21:33 2001
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/client.c,v 1.7.2.1 2001/09/19 22:40:34 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/client.c,v 1.7.2.2 2001/10/13 04:21:33 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
***************
*** 36,41 ****
--- 36,48 ----
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
  #include <crypt.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <afs/cellconfig.h>
  #include <afs/auth.h>
Index: openafs/src/kauth/decode_ticket.c
diff -c openafs/src/kauth/decode_ticket.c:1.4.4.1 openafs/src/kauth/decode_ticket.c:1.4.4.2
*** openafs/src/kauth/decode_ticket.c:1.4.4.1	Wed Sep 19 18:40:34 2001
--- openafs/src/kauth/decode_ticket.c	Sat Oct 13 00:21:33 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/decode_ticket.c,v 1.4.4.1 2001/09/19 22:40:34 shadow Exp $");
  
  #include <des.h>
  #include <afs/com_err.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/decode_ticket.c,v 1.4.4.2 2001/10/13 04:21:33 shadow Exp $");
  
  #include <des.h>
  #include <afs/com_err.h>
Index: openafs/src/kauth/kaauxdb.c
diff -c openafs/src/kauth/kaauxdb.c:1.5.4.1 openafs/src/kauth/kaauxdb.c:1.5.4.2
*** openafs/src/kauth/kaauxdb.c:1.5.4.1	Wed Sep 19 18:36:23 2001
--- openafs/src/kauth/kaauxdb.c	Sat Oct 13 00:21:33 2001
***************
*** 14,27 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaauxdb.c,v 1.5.4.1 2001/09/19 22:36:23 shadow Exp $");
  
- #include <fcntl.h>
  #ifdef AFS_NT40_ENV
- #include <fcntl.h>
  #include <io.h>
  #else
  #include <sys/file.h>
  #endif
  #include <rx/rxkad.h>
  #include "ubik_int.h"
--- 14,35 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaauxdb.c,v 1.5.4.2 2001/10/13 04:21:33 shadow Exp $");
  
  #ifdef AFS_NT40_ENV
  #include <io.h>
  #else
  #include <sys/file.h>
+ #endif
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <rx/rxkad.h>
  #include "ubik_int.h"
Index: openafs/src/kauth/kadatabase.c
diff -c openafs/src/kauth/kadatabase.c:1.6 openafs/src/kauth/kadatabase.c:1.6.2.1
*** openafs/src/kauth/kadatabase.c:1.6	Tue Aug  7 20:03:46 2001
--- openafs/src/kauth/kadatabase.c	Sat Oct 13 00:21:33 2001
***************
*** 10,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kadatabase.c,v 1.6 2001/08/08 00:03:46 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
  #else
  #include <netinet/in.h>
  #endif
  #include <lock.h>
  #include <ubik.h>
--- 10,29 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kadatabase.c,v 1.6.2.1 2001/10/13 04:21:33 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
  #else
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <lock.h>
  #include <ubik.h>
Index: openafs/src/kauth/kalocalcell.c
diff -c openafs/src/kauth/kalocalcell.c:1.5 openafs/src/kauth/kalocalcell.c:1.5.4.1
*** openafs/src/kauth/kalocalcell.c:1.5	Thu Jul 12 15:58:40 2001
--- openafs/src/kauth/kalocalcell.c	Sat Oct 13 00:21:33 2001
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kalocalcell.c,v 1.5 2001/07/12 19:58:40 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/pthread_glock.h"
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kalocalcell.c,v 1.5.4.1 2001/10/13 04:21:33 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/pthread_glock.h"
***************
*** 35,40 ****
--- 35,47 ----
  #include <winsock2.h>
  #else
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <afs/cellconfig.h>
  #include <rx/xdr.h>
Index: openafs/src/kauth/kalog.c
diff -c openafs/src/kauth/kalog.c:1.4 openafs/src/kauth/kalog.c:1.4.4.1
*** openafs/src/kauth/kalog.c:1.4	Thu Jul 12 15:58:40 2001
--- openafs/src/kauth/kalog.c	Sat Oct 13 00:21:33 2001
***************
*** 19,32 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kalog.c,v 1.4 2001/07/12 19:58:40 shadow Exp $");
  
  #include <stdio.h>
  #include <afs/afsutil.h>
! #ifndef AFS_NT40_ENV
  #include <strings.h>
  #endif
  #include <fcntl.h>
  #include <sys/types.h>
  #include <time.h>
  #include <signal.h>
--- 19,38 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kalog.c,v 1.4.4.1 2001/10/13 04:21:33 shadow Exp $");
  
  #include <stdio.h>
  #include <afs/afsutil.h>
! #ifdef HAVE_STRING_H
! #include <string.h>
! #else
! #ifdef HAVE_STRINGS_H
  #include <strings.h>
  #endif
+ #endif
+ #ifdef HAVE_FCNTL_H
  #include <fcntl.h>
+ #endif
  #include <sys/types.h>
  #include <time.h>
  #include <signal.h>
Index: openafs/src/kauth/kaprocs.c
diff -c openafs/src/kauth/kaprocs.c:1.8.2.1 openafs/src/kauth/kaprocs.c:1.8.2.2
*** openafs/src/kauth/kaprocs.c:1.8.2.1	Wed Sep 19 18:36:23 2001
--- openafs/src/kauth/kaprocs.c	Sat Oct 13 00:21:33 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaprocs.c,v 1.8.2.1 2001/09/19 22:36:23 shadow Exp $");
  
  #include <afs/stds.h>
  #include <errno.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaprocs.c,v 1.8.2.2 2001/10/13 04:21:33 shadow Exp $");
  
  #include <afs/stds.h>
  #include <errno.h>
Index: openafs/src/kauth/kas.c
diff -c openafs/src/kauth/kas.c:1.4.4.1 openafs/src/kauth/kas.c:1.4.4.2
*** openafs/src/kauth/kas.c:1.4.4.1	Wed Sep 19 18:40:34 2001
--- openafs/src/kauth/kas.c	Sat Oct 13 00:21:33 2001
***************
*** 11,17 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kas.c,v 1.4.4.1 2001/09/19 22:40:34 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
--- 11,17 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kas.c,v 1.4.4.2 2001/10/13 04:21:33 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
***************
*** 27,32 ****
--- 27,39 ----
  #include <pwd.h>
  #else
  #include <WINNT/afsevent.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <afs/cellconfig.h>
  #include <afs/com_err.h>
Index: openafs/src/kauth/kaserver.c
diff -c openafs/src/kauth/kaserver.c:1.9.2.1 openafs/src/kauth/kaserver.c:1.9.2.2
*** openafs/src/kauth/kaserver.c:1.9.2.1	Wed Sep 19 18:25:24 2001
--- openafs/src/kauth/kaserver.c	Sat Oct 13 00:21:33 2001
***************
*** 10,21 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaserver.c,v 1.9.2.1 2001/09/19 22:25:24 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
- #include <fcntl.h>
  #include <winsock2.h>
  #include <WINNT/afsevent.h>
  #else
--- 10,20 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaserver.c,v 1.9.2.2 2001/10/13 04:21:33 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
  #include <WINNT/afsevent.h>
  #else
***************
*** 26,31 ****
--- 25,40 ----
  #include "kalog.h"           /* for OpenLog() */
  #include <time.h>
  #include <stdio.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
  #endif
Index: openafs/src/kauth/kautils.c
diff -c openafs/src/kauth/kautils.c:1.7 openafs/src/kauth/kautils.c:1.7.2.1
*** openafs/src/kauth/kautils.c:1.7	Tue Aug  7 20:03:46 2001
--- openafs/src/kauth/kautils.c	Sat Oct 13 00:21:33 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kautils.c,v 1.7 2001/08/08 00:03:46 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kautils.c,v 1.7.2.1 2001/10/13 04:21:33 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 20,25 ****
--- 20,32 ----
  #include <sys/socket.h>
  #include <netinet/in.h>
  #include <sys/file.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <time.h>
  #include <stdio.h>
Index: openafs/src/kauth/klog.c
diff -c openafs/src/kauth/klog.c:1.5 openafs/src/kauth/klog.c:1.5.2.1
*** openafs/src/kauth/klog.c:1.5	Tue Aug  7 20:03:46 2001
--- openafs/src/kauth/klog.c	Sat Oct 13 00:21:33 2001
***************
*** 10,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/klog.c,v 1.5 2001/08/08 00:03:46 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
  #include <rx/xdr.h>
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
  #endif
  
  #include <lock.h>
--- 10,29 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/klog.c,v 1.5.2.1 2001/10/13 04:21:33 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
  #include <rx/xdr.h>
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  
  #include <lock.h>
Index: openafs/src/kauth/klogin.c
diff -c openafs/src/kauth/klogin.c:1.7.2.1 openafs/src/kauth/klogin.c:1.7.2.2
*** openafs/src/kauth/klogin.c:1.7.2.1	Wed Sep 19 18:25:24 2001
--- openafs/src/kauth/klogin.c	Sat Oct 13 00:21:33 2001
***************
*** 21,27 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/klogin.c,v 1.7.2.1 2001/09/19 22:25:24 shadow Exp $");
  
  #if !defined(AFS_SUN_ENV) && !defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
  #include <sys/param.h>
--- 21,27 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/klogin.c,v 1.7.2.2 2001/10/13 04:21:33 shadow Exp $");
  
  #if !defined(AFS_SUN_ENV) && !defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
  #include <sys/param.h>
Index: openafs/src/kauth/kpasswd.c
diff -c openafs/src/kauth/kpasswd.c:1.7 openafs/src/kauth/kpasswd.c:1.7.2.1
*** openafs/src/kauth/kpasswd.c:1.7	Tue Aug  7 20:03:46 2001
--- openafs/src/kauth/kpasswd.c	Sat Oct 13 00:21:33 2001
***************
*** 11,17 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kpasswd.c,v 1.7 2001/08/08 00:03:46 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kpasswd.c,v 1.7.2.1 2001/10/13 04:21:33 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 28,33 ****
--- 28,40 ----
  #ifndef AFS_NT40_ENV
  #include <pwd.h>
  #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <signal.h>
  #include <afs/com_err.h>
  #include <afs/auth.h>
***************
*** 240,247 ****
--- 247,256 ----
      code = ka_Init(0);
      if (code ||
  	!(lcell = ka_LocalCell())) {
+ #ifndef AFS_FREELANCE_CLIENT
  	if (!Pipe) com_err (rn, code , "Can't get local cell name!");
  	exit (1);
+ #endif
      }
  
      code = rx_Init(0);
***************
*** 346,352 ****
--- 355,369 ----
  	memset(as->parms[aNEWPASSWORD].items->data, 0, strlen(as->parms[aNEWPASSWORD].items->data));
      }
  
+ #ifdef AFS_FREELANCE_CLIENT
+     if (!foundExplicitCell && !lcell) {
+ 	if (!Pipe) com_err (rn, code, "no cell name provided");
+         exit(1);
+     }
+ #else
      if (!foundExplicitCell) strcpy (realm, lcell);
+ #endif /* freelance */
+     
      if (code = ka_CellToRealm (realm, realm, &local)) {
  	if (!Pipe) com_err (rn, code, "Can't convert cell to realm");
  	exit (1);
Index: openafs/src/kauth/kpwvalid.c
diff -c openafs/src/kauth/kpwvalid.c:1.4 openafs/src/kauth/kpwvalid.c:1.4.4.1
*** openafs/src/kauth/kpwvalid.c:1.4	Thu Jul 12 15:58:40 2001
--- openafs/src/kauth/kpwvalid.c	Sat Oct 13 00:21:33 2001
***************
*** 10,18 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kpwvalid.c,v 1.4 2001/07/12 19:58:40 shadow Exp $");
  
  #include <stdio.h>
  #ifdef AFS_NT40_ENV
  #include <WINNT/afsevent.h>
  #endif
--- 10,25 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kpwvalid.c,v 1.4.4.1 2001/10/13 04:21:33 shadow Exp $");
  
  #include <stdio.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #ifdef AFS_NT40_ENV
  #include <WINNT/afsevent.h>
  #endif
Index: openafs/src/kauth/krb_tf.c
diff -c openafs/src/kauth/krb_tf.c:1.4 openafs/src/kauth/krb_tf.c:1.4.4.1
*** openafs/src/kauth/krb_tf.c:1.4	Thu Jul 12 15:58:40 2001
--- openafs/src/kauth/krb_tf.c	Sat Oct 13 00:21:33 2001
***************
*** 47,59 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/krb_tf.c,v 1.4 2001/07/12 19:58:40 shadow Exp $");
  
! #ifdef AFS_NT40_ENV
  #include <fcntl.h>
  #include <io.h>
  #else
  #include <sys/file.h>
  #endif
  #include <sys/types.h>
  #include <rx/xdr.h>
--- 47,68 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/krb_tf.c,v 1.4.4.1 2001/10/13 04:21:33 shadow Exp $");
  
! #ifdef HAVE_FCNTL_H
  #include <fcntl.h>
+ #endif
+ #ifdef AFS_NT40_ENV
  #include <io.h>
  #else
  #include <sys/file.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <sys/types.h>
  #include <rx/xdr.h>
Index: openafs/src/kauth/krb_udp.c
diff -c openafs/src/kauth/krb_udp.c:1.14.2.1 openafs/src/kauth/krb_udp.c:1.14.2.2
*** openafs/src/kauth/krb_udp.c:1.14.2.1	Wed Sep 19 18:36:23 2001
--- openafs/src/kauth/krb_udp.c	Sat Oct 13 00:21:33 2001
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/krb_udp.c,v 1.14.2.1 2001/09/19 22:36:23 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 15,21 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/krb_udp.c,v 1.14.2.2 2001/10/13 04:21:33 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 26,31 ****
--- 26,38 ----
  #include <sys/socket.h>
  #include <netdb.h>
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <afs/afsutil.h>
  #include <time.h>
Index: openafs/src/kauth/rebuild.c
diff -c openafs/src/kauth/rebuild.c:1.7.2.1 openafs/src/kauth/rebuild.c:1.7.2.2
*** openafs/src/kauth/rebuild.c:1.7.2.1	Wed Sep 19 18:36:23 2001
--- openafs/src/kauth/rebuild.c	Sat Oct 13 00:21:33 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/rebuild.c,v 1.7.2.1 2001/09/19 22:36:23 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/rebuild.c,v 1.7.2.2 2001/10/13 04:21:33 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
***************
*** 21,26 ****
--- 21,33 ----
  #else
  #include <sys/file.h>
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <stdio.h>
  #include <errno.h>
Index: openafs/src/kauth/token.c
diff -c openafs/src/kauth/token.c:1.4.4.1 openafs/src/kauth/token.c:1.4.4.2
*** openafs/src/kauth/token.c:1.4.4.1	Wed Sep 19 18:36:23 2001
--- openafs/src/kauth/token.c	Sat Oct 13 00:21:33 2001
***************
*** 18,24 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/token.c,v 1.4.4.1 2001/09/19 22:36:23 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 18,24 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/token.c,v 1.4.4.2 2001/10/13 04:21:33 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
***************
*** 42,47 ****
--- 42,54 ----
  #else
  #include <sys/socket.h>
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  /* netinet/in.h and cellconfig.h  are needed together */
  #include <afs/cellconfig.h>
Index: openafs/src/kauth/user.c
diff -c openafs/src/kauth/user.c:1.7.2.1 openafs/src/kauth/user.c:1.7.2.2
*** openafs/src/kauth/user.c:1.7.2.1	Wed Sep 19 18:25:24 2001
--- openafs/src/kauth/user.c	Sat Oct 13 00:21:33 2001
***************
*** 17,23 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/user.c,v 1.7.2.1 2001/09/19 22:25:24 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 17,23 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/user.c,v 1.7.2.2 2001/10/13 04:21:33 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
***************
*** 43,48 ****
--- 43,55 ----
  #include <winsock2.h>
  #else
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <afs/cellconfig.h>
  #include <afs/auth.h>
Index: openafs/src/kauth/user_nt.c
diff -c openafs/src/kauth/user_nt.c:1.6 openafs/src/kauth/user_nt.c:1.6.2.2
*** openafs/src/kauth/user_nt.c:1.6	Thu Aug 23 13:46:32 2001
--- openafs/src/kauth/user_nt.c	Wed Nov 21 01:45:49 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/user_nt.c,v 1.6 2001/08/23 17:46:32 shadow Exp $");
  
  #include <afs/stds.h>
  
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/user_nt.c,v 1.6.2.2 2001/11/21 06:45:49 shadow Exp $");
  
  #include <afs/stds.h>
  
***************
*** 86,91 ****
--- 86,107 ----
  	afs_int32 spare,
  	char **reasonP)
  {
+   return ka_UserAuthenticateGeneral2(flags, name, instance, realm, password, NULL,
+ 				     lifetime, password_expiresP, spare, reasonP);
+ }
+   
+ afs_int32 ka_UserAuthenticateGeneral2(
+ 	afs_int32 flags,
+ 	char *name,
+ 	char *instance,
+ 	char *realm,
+ 	char *password,
+ 	char *smbname,
+ 	Date lifetime,
+ 	afs_int32 *password_expiresP,
+ 	afs_int32 spare,
+ 	char **reasonP)
+ {
  	int code;
  	struct ktc_encryptionKey key1, key2;
  	char *ticket = NULL;
***************
*** 96,101 ****
--- 112,118 ----
  	char fullRealm[256];
  	char upperRealm[256];
  	struct servent *sp;
+ 	int ttl;
  
  	struct ktc_principal server;
  	struct ktc_principal client;
***************
*** 106,111 ****
--- 123,133 ----
  
  	code = cm_SearchCellFile(realm, fullRealm, ka_AddHostProc, NULL);
  
+ #ifdef AFS_AFSDB_ENV
+ 	if (code) {
+ 	  code = cm_SearchCellByDNS(realm, fullRealm, &ttl, ka_AddHostProc, NULL);
+         }
+ #endif
  	if (code) {
  		*reasonP = "specified realm is unknown";
  		return (code);
***************
*** 141,146 ****
--- 163,170 ----
  	strcpy(client.name, name);
  	strcpy(client.instance, instance);
  	strcpy(client.cell, upperRealm);
+ 	if (smbname)
+ 	  strcpy(client.smbname, smbname);
  
  	token.startTime = 0;		/* XXX */
  	token.endTime = expirationTime;
***************
*** 310,333 ****
      ptr = (char *) cip->dat + 8;
  
      /* Check and extract server's name */
!     if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length)
! 	return(INTK_BADPW);
  
      (void) strncpy(s_service, ptr, sizeof(s_service)-1);
      s_service[sizeof(s_service)-1] = '\0';
      ptr += strlen(s_service) + 1;
  
      /* Check and extract server's instance */
!     if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length)
! 	return(INTK_BADPW);
  
      (void) strncpy(s_instance,ptr, sizeof(s_instance)-1);
      s_instance[sizeof(s_instance)-1] = '\0';
      ptr += strlen(s_instance) + 1;
  
      /* Check and extract server's realm */
!     if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length)
! 	return(INTK_BADPW);
  
      (void) strncpy(s_realm,ptr, sizeof(s_realm));
      s_realm[sizeof(s_realm)-1] = '\0';
--- 334,360 ----
      ptr = (char *) cip->dat + 8;
  
      /* Check and extract server's name */
!     if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length) {
! 		return(INTK_BADPW);
! 	}
  
      (void) strncpy(s_service, ptr, sizeof(s_service)-1);
      s_service[sizeof(s_service)-1] = '\0';
      ptr += strlen(s_service) + 1;
  
      /* Check and extract server's instance */
!     if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length) {
! 		return(INTK_BADPW);
! 	}
  
      (void) strncpy(s_instance,ptr, sizeof(s_instance)-1);
      s_instance[sizeof(s_instance)-1] = '\0';
      ptr += strlen(s_instance) + 1;
  
      /* Check and extract server's realm */
!     if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length) {
! 		return(INTK_BADPW);
! 	}
  
      (void) strncpy(s_realm,ptr, sizeof(s_realm));
      s_realm[sizeof(s_realm)-1] = '\0';
***************
*** 340,347 ****
      ticket_len = (unsigned char) *ptr++;
      
      if ((ticket_len < 0) ||
! 	((ticket_len + (ptr - (char *) cip->dat)) > (int) cip->length))
  	return(INTK_BADPW);
  
      /* Check returned server name, instance, and realm fields */
      /*
--- 367,375 ----
      ticket_len = (unsigned char) *ptr++;
      
      if ((ticket_len < 0) ||
! 	((ticket_len + (ptr - (char *) cip->dat)) > (int) cip->length)) {
  	return(INTK_BADPW);
+ 	}
  
      /* Check returned server name, instance, and realm fields */
      /*
Index: openafs/src/kauth/test/test_getticket.c
diff -c openafs/src/kauth/test/test_getticket.c:1.5.2.1 openafs/src/kauth/test/test_getticket.c:1.5.2.2
*** openafs/src/kauth/test/test_getticket.c:1.5.2.1	Wed Sep 19 18:40:34 2001
--- openafs/src/kauth/test/test_getticket.c	Sat Oct 13 00:21:35 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/test/test_getticket.c,v 1.5.2.1 2001/09/19 22:40:34 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/test/test_getticket.c,v 1.5.2.2 2001/10/13 04:21:35 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/kauth/test/test_interim_ktc.c
diff -c openafs/src/kauth/test/test_interim_ktc.c:1.5.2.1 openafs/src/kauth/test/test_interim_ktc.c:1.5.2.2
*** openafs/src/kauth/test/test_interim_ktc.c:1.5.2.1	Wed Sep 19 18:40:34 2001
--- openafs/src/kauth/test/test_interim_ktc.c	Sat Oct 13 00:21:35 2001
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/test/test_interim_ktc.c,v 1.5.2.1 2001/09/19 22:40:34 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/com_err.h>
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/test/test_interim_ktc.c,v 1.5.2.2 2001/10/13 04:21:35 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/com_err.h>
Index: openafs/src/kauth/test/test_rxkad_free.c
diff -c openafs/src/kauth/test/test_rxkad_free.c:1.5.2.1 openafs/src/kauth/test/test_rxkad_free.c:1.5.2.2
*** openafs/src/kauth/test/test_rxkad_free.c:1.5.2.1	Wed Sep 19 18:40:34 2001
--- openafs/src/kauth/test/test_rxkad_free.c	Sat Oct 13 00:21:35 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/test/test_rxkad_free.c,v 1.5.2.1 2001/09/19 22:40:34 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/test/test_rxkad_free.c,v 1.5.2.2 2001/10/13 04:21:35 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/libacl/aclprocs.c
diff -c openafs/src/libacl/aclprocs.c:1.9.2.1 openafs/src/libacl/aclprocs.c:1.9.2.2
*** openafs/src/libacl/aclprocs.c:1.9.2.1	Wed Sep 19 18:36:24 2001
--- openafs/src/libacl/aclprocs.c	Sat Oct 13 00:21:36 2001
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/libacl/aclprocs.c,v 1.9.2.1 2001/09/19 22:36:24 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 16,22 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/libacl/aclprocs.c,v 1.9.2.2 2001/10/13 04:21:36 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
Index: openafs/src/libadmin/adminutil/afs_utilAdmin.c
diff -c openafs/src/libadmin/adminutil/afs_utilAdmin.c:1.5.4.1 openafs/src/libadmin/adminutil/afs_utilAdmin.c:1.5.4.2
*** openafs/src/libadmin/adminutil/afs_utilAdmin.c:1.5.4.1	Wed Sep 19 18:40:35 2001
--- openafs/src/libadmin/adminutil/afs_utilAdmin.c	Sat Oct 13 00:21:37 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/libadmin/adminutil/afs_utilAdmin.c,v 1.5.4.1 2001/09/19 22:40:35 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/afs_Admin.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/libadmin/adminutil/afs_utilAdmin.c,v 1.5.4.2 2001/10/13 04:21:37 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/afs_Admin.h>
Index: openafs/src/libafs/.cvsignore
diff -c openafs/src/libafs/.cvsignore:1.1 openafs/src/libafs/.cvsignore:1.1.2.1
*** openafs/src/libafs/.cvsignore:1.1	Mon Sep 10 16:14:25 2001
--- openafs/src/libafs/.cvsignore	Sat Oct 13 00:21:38 2001
***************
*** 1,7 ****
! MODLOAD-2.4.7-ac3-MP
! MODLOAD-2.4.7-ac3-SP
  Makefile
  MakefileProto.LINUX
  afs
  afsint
  config
--- 1,16 ----
! MODLOAD-*
! MODLOAD32
! MODLOAD64
  Makefile
+ MakefileProto.AIX
+ MakefileProto.DARWIN
+ MakefileProto.DUX
+ MakefileProto.FBSD
+ MakefileProto.HPUX
+ MakefileProto.IRIX
  MakefileProto.LINUX
+ MakefileProto.OBSD
+ MakefileProto.SOLARIS
  afs
  afsint
  config
Index: openafs/src/libafs/Makefile.common
diff -c openafs/src/libafs/Makefile.common:1.14 openafs/src/libafs/Makefile.common:1.14.2.1
*** openafs/src/libafs/Makefile.common:1.14	Mon Sep 10 16:21:10 2001
--- openafs/src/libafs/Makefile.common	Sat Oct 13 00:21:38 2001
***************
*** 55,60 ****
--- 55,61 ----
  	afs_daemons.o	\
  	afs_dcache.o \
  	afs_dir.o		\
+ 	afs_dynroot.o		\
  	afs_init.o \
  	afs_lock.o	\
  	afs_mariner.o \
***************
*** 151,156 ****
--- 152,159 ----
  afs_conn.o: $(AFS)/afs_conn.c
  	$(CRULE2);
  afs_dcache.o: $(AFS)/afs_dcache.c
+ 	$(CRULE2);
+ afs_dynroot.o: 	$(AFS)/afs_dynroot.c
  	$(CRULE2);
  afs_init.o: $(AFS)/afs_init.c
  	$(CRULE2);
Index: openafs/src/libafs/MakefileProto.DARWIN.in
diff -c openafs/src/libafs/MakefileProto.DARWIN.in:1.8.2.2 openafs/src/libafs/MakefileProto.DARWIN.in:1.8.2.3
*** openafs/src/libafs/MakefileProto.DARWIN.in:1.8.2.2	Thu Sep 20 16:12:35 2001
--- openafs/src/libafs/MakefileProto.DARWIN.in	Sat Oct 13 00:21:38 2001
***************
*** 1,5 ****
  #/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */
! # $Header: /data/cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.8.2.2 2001/09/20 20:12:35 shadow Exp $
  # 
  # MakefileProto for Digital Unix systems
  #
--- 1,5 ----
  #/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */
! # $Header: /data/cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.8.2.3 2001/10/13 04:21:38 shadow Exp $
  # 
  # MakefileProto for Digital Unix systems
  #
Index: openafs/src/libafs/MakefileProto.FBSD.in
diff -c openafs/src/libafs/MakefileProto.FBSD.in:1.7 openafs/src/libafs/MakefileProto.FBSD.in:1.7.2.1
*** openafs/src/libafs/MakefileProto.FBSD.in:1.7	Fri Sep  7 19:35:19 2001
--- openafs/src/libafs/MakefileProto.FBSD.in	Sat Oct 13 00:21:38 2001
***************
*** 87,93 ****
  LIBAFS = libafs.o
  LIBAFSNONFS = libafs.nonfs.o
  
! INST_LIBAFS ${DESTDIR}${afskerneldir}/${LIBAFS}
  INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}
  
  DEST_LIBAFS = ${DEST}/root.client/bin/${LIBAFS}
--- 87,93 ----
  LIBAFS = libafs.o
  LIBAFSNONFS = libafs.nonfs.o
  
! INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
  INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}
  
  DEST_LIBAFS = ${DEST}/root.client/bin/${LIBAFS}
Index: openafs/src/libafs/MakefileProto.LINUX.in
diff -c openafs/src/libafs/MakefileProto.LINUX.in:1.11.2.1 openafs/src/libafs/MakefileProto.LINUX.in:1.11.2.2
*** openafs/src/libafs/MakefileProto.LINUX.in:1.11.2.1	Wed Sep 12 11:56:30 2001
--- openafs/src/libafs/MakefileProto.LINUX.in	Sat Oct 13 00:21:38 2001
***************
*** 81,86 ****
--- 81,91 ----
  	-fno-strict-aliasing -fsigned-char -msoft-float -pipe \
  	-fno-builtin -ffixed-r2
  DEFINES = -D__KERNEL__  -D__powerpc__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
+ <parisc_linux24>
+ CCFLAGS =   -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -fno-strength-reduce \
+         -fno-strict-aliasing -fsigned-char -mno-space-regs -mfast-indirect-calls \
+         -mdisable-fpregs -ffunction-sections -march=1.1 -mschedule=7100
+ DEFINES = -D__KERNEL__  -D__linux__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
  <ia64_linux24>
  CCFLAGS =   -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe \
  	-ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step
Index: openafs/src/libafs/MakefileProto.SOLARIS.in
diff -c openafs/src/libafs/MakefileProto.SOLARIS.in:1.10 openafs/src/libafs/MakefileProto.SOLARIS.in:1.10.2.1
*** openafs/src/libafs/MakefileProto.SOLARIS.in:1.10	Tue Sep 11 00:46:37 2001
--- openafs/src/libafs/MakefileProto.SOLARIS.in	Sat Oct 13 00:21:38 2001
***************
*** 52,58 ****
  KDEFS= -Dsun4c -DSUN4C_60 -DNFSCLIENT -DSYSACCT -DOLDSCSI -DVDDRV -D_KERNEL \
  	-DSYSV -dn ${ARCH_DEFS}
  
! <sun4x_57 sun4x_58>
  KDEFS_32 = 
  KDEFS_64 = -xarch=v9
  
--- 52,58 ----
  KDEFS= -Dsun4c -DSUN4C_60 -DNFSCLIENT -DSYSACCT -DOLDSCSI -DVDDRV -D_KERNEL \
  	-DSYSV -dn ${ARCH_DEFS}
  
! <sun4x_57 sun4x_58 sun4x_59>
  KDEFS_32 = 
  KDEFS_64 = -xarch=v9
  
***************
*** 60,78 ****
  CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
  
  # Name of directory to hold object files and libraries.
! <all -sun4x_57 -sun4x_58>
  KOBJ = MODLOAD
! <sun4x_57 sun4x_58>
  KOBJ = MODLOAD32 MODLOAD64
  
  
  # This tells Makefile.common to use it's single directory build target.
! <all -sun4x_57 -sun4x_58>
  COMPDIRS = single_compdir
  INSTDIRS = single_instdir
  DESTDIRS = single_destdir
  
! <sun4x_57 sun4x_58>
  COMPDIRS = solaris_compdirs
  INSTDIRS = solaris_instdirs
  DESTDIRS = solaris_destdirs
--- 60,78 ----
  CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
  
  # Name of directory to hold object files and libraries.
! <all -sun4x_57 -sun4x_58 -sun4x_59>
  KOBJ = MODLOAD
! <sun4x_57 sun4x_58 sun4x_59>
  KOBJ = MODLOAD32 MODLOAD64
  
  
  # This tells Makefile.common to use it's single directory build target.
! <all -sun4x_57 -sun4x_58 -sun4x_59>
  COMPDIRS = single_compdir
  INSTDIRS = single_instdir
  DESTDIRS = single_destdir
  
! <sun4x_57 sun4x_58 sun4x_59>
  COMPDIRS = solaris_compdirs
  INSTDIRS = solaris_instdirs
  DESTDIRS = solaris_destdirs
***************
*** 104,110 ****
  ## This is the target for a Solaris 7. Here we build both the 32 bit and
  ## the 64 bit libafs in MODLOAD32 and MODLOAD64 directories respectively
  
! <sun4x_57 sun4x_58>
  ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
  	for t in ${KOBJ} ; do \
  		echo Building directory: $$t ; \
--- 104,110 ----
  ## This is the target for a Solaris 7. Here we build both the 32 bit and
  ## the 64 bit libafs in MODLOAD32 and MODLOAD64 directories respectively
  
! <sun4x_57 sun4x_58 sun4x_59>
  ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
  	for t in ${KOBJ} ; do \
  		echo Building directory: $$t ; \
***************
*** 133,139 ****
  LIBAFS = libafs.o
  LIBAFSNONFS = libafs.nonfs.o
  
! <all -sun4x_57 -sun4x_58>
  INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
  INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}
  
--- 133,139 ----
  LIBAFS = libafs.o
  LIBAFSNONFS = libafs.nonfs.o
  
! <all -sun4x_57 -sun4x_58 -sun4x_59>
  INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
  INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}
  
***************
*** 169,175 ****
  	$(RM) -f $@
  	$(LD) -r -o $@  $(AFSAOBJS) ${AFSNONFSOBJS}
  
! <sun4x_57 sun4x_58>
  
  libafs: ${LIBAFSNONFS}
  
--- 169,175 ----
  	$(RM) -f $@
  	$(LD) -r -o $@  $(AFSAOBJS) ${AFSNONFSOBJS}
  
! <sun4x_57 sun4x_58 sun4x_59>
  
  libafs: ${LIBAFSNONFS}
  
Index: openafs/src/libafs/afs.ppc_darwin_14.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_14.plist.in:1.1.2.1 openafs/src/libafs/afs.ppc_darwin_14.plist.in:1.1.2.2
*** openafs/src/libafs/afs.ppc_darwin_14.plist.in:1.1.2.1	Wed Sep 12 01:03:53 2001
--- openafs/src/libafs/afs.ppc_darwin_14.plist.in	Sat Nov 10 18:22:57 2001
***************
*** 25,31 ****
  		<key>com.apple.kernel.bsd</key>
  		<string>1.1</string>
  		<key>com.apple.kernel.mach</key>
! 		<string>1.0.0b1</string>
  	</dict>
  </dict>
  </plist>
--- 25,31 ----
  		<key>com.apple.kernel.bsd</key>
  		<string>1.1</string>
  		<key>com.apple.kernel.mach</key>
! 		<string>1.1</string>
  	</dict>
  </dict>
  </plist>
Index: openafs/src/libafsauthent/NTMakefile
diff -c openafs/src/libafsauthent/NTMakefile:1.3 openafs/src/libafsauthent/NTMakefile:1.3.4.1
*** openafs/src/libafsauthent/NTMakefile:1.3	Mon Apr 30 03:00:04 2001
--- openafs/src/libafsauthent/NTMakefile	Sat Oct 13 00:21:39 2001
***************
*** 90,95 ****
--- 90,96 ----
  	$(SYSOBJS) \
  	$(WINNTAFSDOBJS) \
  	$(AUDITOBJS) \
+ 	$(DESTDIR)\lib\cm_dns.obj \
  	afsauthent.res
  
  audit.obj: $(AUDIT)\audit.c
***************
*** 231,234 ****
  install9x: install
  
  clean ::
! 	$(DEL) $(LIBFILE)
\ No newline at end of file
--- 232,235 ----
  install9x: install
  
  clean ::
! 	$(DEL) $(LIBFILE)
Index: openafs/src/libafsauthent/afsauthent.def
diff -c openafs/src/libafsauthent/afsauthent.def:1.1 openafs/src/libafsauthent/afsauthent.def:1.1.12.1
*** openafs/src/libafsauthent/afsauthent.def:1.1	Fri Nov  3 21:28:06 2000
--- openafs/src/libafsauthent/afsauthent.def	Wed Nov 21 01:45:51 2001
***************
*** 77,82 ****
--- 77,83 ----
  	ktc_OldPioctl					@76
  	pioctl						@77
  	rx_Init						@78
+ 	ka_UserAuthenticateGeneral2			@79
  
  
  
Index: openafs/src/libuafs/Makefile.common
diff -c openafs/src/libuafs/Makefile.common:1.13 openafs/src/libuafs/Makefile.common:1.13.2.1
*** openafs/src/libuafs/Makefile.common:1.13	Fri Sep  7 20:25:10 2001
--- openafs/src/libuafs/Makefile.common	Sat Oct 13 00:21:40 2001
***************
*** 63,68 ****
--- 63,69 ----
  	$(UOBJ)/afs_daemons.o	\
  	$(UOBJ)/afs_dcache.o \
  	$(UOBJ)/afs_dir.o		\
+ 	$(UOBJ)/afs_dynroot.o \
  	$(UOBJ)/afs_init.o \
  	$(UOBJ)/afs_lock.o	\
  	$(UOBJ)/afs_mariner.o \
***************
*** 179,184 ****
--- 180,186 ----
  	$(WEBOBJ)/afs_daemons.o \
  	$(WEBOBJ)/afs_dcache.o \
  	$(WEBOBJ)/afs_dir.o \
+ 	$(WEBOBJ)/afs_dynroot.o \
  	$(WEBOBJ)/afs_init.o \
  	$(WEBOBJ)/afs_lock.o \
  	$(WEBOBJ)/afs_mariner.o \
***************
*** 297,302 ****
--- 299,305 ----
  	$(WEBOBJ)/afs_daemons.o \
  	$(WEBOBJ)/afs_dcache.o \
  	$(WEBOBJ)/afs_dir.o \
+ 	$(WEBOBJ)/afs_dynroot.o \
  	$(WEBOBJ)/afs_init.o \
  	$(WEBOBJ)/afs_lock.o \
  	$(WEBOBJ)/afs_mariner.o \
***************
*** 417,422 ****
--- 420,427 ----
  	$(CRULE1);
  $(UOBJ)/afs_dcache.o: $(AFS)/afs_dcache.c
  	$(CRULE1);
+ $(UOBJ)/afs_dynroot.o: $(AFS)/afs_dynroot.c
+ 	$(CRULE1);
  $(UOBJ)/afs_init.o: $(AFS)/afs_init.c
  	$(CRULE1);
  $(UOBJ)/afs_mariner.o: $(AFS)/afs_mariner.c
***************
*** 659,664 ****
--- 664,671 ----
  $(WEBOBJ)/afs_conn.o: $(AFS)/afs_conn.c
  	$(CRULE2);
  $(WEBOBJ)/afs_dcache.o: $(AFS)/afs_dcache.c
+ 	$(CRULE2);
+ $(WEBOBJ)/afs_dynroot.o: $(AFS)/afs_dynroot.c
  	$(CRULE2);
  $(WEBOBJ)/afs_init.o: $(AFS)/afs_init.c
  	$(CRULE2);
Index: openafs/src/login/Makefile.in
diff -c openafs/src/login/Makefile.in:1.5 openafs/src/login/Makefile.in:1.5.2.1
*** openafs/src/login/Makefile.in:1.5	Mon Sep 10 16:21:11 2001
--- openafs/src/login/Makefile.in	Sat Oct 13 00:21:41 2001
***************
*** 44,50 ****
  	   ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \
  	   ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/librx.a \
  	   ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libcmd.a \
! 	   ${TOP_LIBDIR}/afs/libcom_err.a ${TOP_LIBDIR}/afs/util.a
  
  KAFSLIBS = ${TOP_LIBDIR}/libkauth.krb.a ${TOP_LIBDIR}/libprot.a \
  	   ${TOP_LIBDIR}/libubik.a ${TOP_LIBDIR}/libauth.krb.a \
--- 44,50 ----
  	   ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \
  	   ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/librx.a \
  	   ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libcmd.a \
! 	   ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a
  
  KAFSLIBS = ${TOP_LIBDIR}/libkauth.krb.a ${TOP_LIBDIR}/libprot.a \
  	   ${TOP_LIBDIR}/libubik.a ${TOP_LIBDIR}/libauth.krb.a \
Index: openafs/src/lwp/preempt.c
diff -c openafs/src/lwp/preempt.c:1.10.2.1 openafs/src/lwp/preempt.c:1.10.2.2
*** openafs/src/lwp/preempt.c:1.10.2.1	Wed Sep 19 18:25:25 2001
--- openafs/src/lwp/preempt.c	Sat Oct 13 00:21:42 2001
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/preempt.c,v 1.10.2.1 2001/09/19 22:25:25 shadow Exp $");
  
  
  #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_DJGPP_ENV)
--- 16,22 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/preempt.c,v 1.10.2.2 2001/10/13 04:21:42 shadow Exp $");
  
  
  #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_DJGPP_ENV)
Index: openafs/src/lwp/waitkey.c
diff -c openafs/src/lwp/waitkey.c:1.8.2.1 openafs/src/lwp/waitkey.c:1.8.2.2
*** openafs/src/lwp/waitkey.c:1.8.2.1	Wed Sep 19 18:25:25 2001
--- openafs/src/lwp/waitkey.c	Sat Oct 13 00:21:42 2001
***************
*** 22,28 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/waitkey.c,v 1.8.2.1 2001/09/19 22:25:25 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 22,28 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/waitkey.c,v 1.8.2.2 2001/10/13 04:21:42 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
Index: openafs/src/ntp/.cvsignore
diff -c openafs/src/ntp/.cvsignore:1.1 openafs/src/ntp/.cvsignore:1.1.2.1
*** openafs/src/ntp/.cvsignore:1.1	Mon Sep 10 16:14:30 2001
--- openafs/src/ntp/.cvsignore	Sat Oct 13 00:21:43 2001
***************
*** 1 ****
--- 1,2 ----
+ AFS_component_version_number.c
  Makefile
Index: openafs/src/pam/afs_util.c
diff -c openafs/src/pam/afs_util.c:1.5 openafs/src/pam/afs_util.c:1.5.2.1
*** openafs/src/pam/afs_util.c:1.5	Fri Sep  7 00:36:44 2001
--- openafs/src/pam/afs_util.c	Sat Oct 13 00:21:44 2001
***************
*** 17,23 ****
  #include <afs/param.h>
  #include <sys/wait.h>
  
! RCSID("$Header: /data/cvs/openafs/src/pam/afs_util.c,v 1.5 2001/09/07 04:36:44 shadow Exp $");
  
  #include "afs_util.h"
  
--- 17,23 ----
  #include <afs/param.h>
  #include <sys/wait.h>
  
! RCSID("$Header: /data/cvs/openafs/src/pam/afs_util.c,v 1.5.2.1 2001/10/13 04:21:44 shadow Exp $");
  
  #include "afs_util.h"
  
***************
*** 61,71 ****
  {
  	assert(0);
  }
! #endif  /* AFS_HPUX110_ENV */
  sigsetmask(int mask)
  {
  	assert(0);
  }
  
  /* converts string to integer */
  
--- 61,72 ----
  {
  	assert(0);
  }
! 
  sigsetmask(int mask)
  {
  	assert(0);
  }
+ #endif  /* AFS_HPUX110_ENV */
  
  /* converts string to integer */
  
Index: openafs/src/pinstall/install.c
diff -c openafs/src/pinstall/install.c:1.9.2.1 openafs/src/pinstall/install.c:1.9.2.2
*** openafs/src/pinstall/install.c:1.9.2.1	Wed Sep 19 18:25:26 2001
--- openafs/src/pinstall/install.c	Sat Oct 13 00:21:46 2001
***************
*** 49,55 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/pinstall/install.c,v 1.9.2.1 2001/09/19 22:25:26 shadow Exp $");
  
  #include <stdio.h>
  #include <pwd.h>
--- 49,55 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/pinstall/install.c,v 1.9.2.2 2001/10/13 04:21:46 shadow Exp $");
  
  #include <stdio.h>
  #include <pwd.h>
***************
*** 81,86 ****
--- 81,87 ----
  #include <unistd.h>
  #include <string.h>
  #include <sys/wait.h>
+ #include <stdlib.h>
  
  struct stat istat, ostat;
  
Index: openafs/src/ptserver/.cvsignore
diff -c openafs/src/ptserver/.cvsignore:1.1 openafs/src/ptserver/.cvsignore:1.1.2.1
*** openafs/src/ptserver/.cvsignore:1.1	Mon Sep 10 16:14:34 2001
--- openafs/src/ptserver/.cvsignore	Sat Oct 13 00:21:47 2001
***************
*** 16,18 ****
--- 16,19 ----
  readgroup
  readpwd
  testpt
+ ptclient
Index: openafs/src/ptserver/NTMakefile
diff -c openafs/src/ptserver/NTMakefile:1.3.4.1 openafs/src/ptserver/NTMakefile:1.3.4.2
*** openafs/src/ptserver/NTMakefile:1.3.4.1	Wed Sep 19 18:40:37 2001
--- openafs/src/ptserver/NTMakefile	Sat Oct 13 00:21:47 2001
***************
*** 65,71 ****
  	$(DESTDIR)\lib\afs\afsutil.lib \
  	$(DESTDIR)\lib\afs\afsaudit.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afs\afsreg.lib
  
  !IF (("$(SYS_NAME)"!="i386_win95" ) && ("$(SYS_NAME)"!="I386_WIN95" ))
  PTSERVER_EXELIBS =$(PTSERVER_EXELIBS) $(DESTDIR)\lib\afs\afsprocmgmt.lib
--- 65,72 ----
  	$(DESTDIR)\lib\afs\afsutil.lib \
  	$(DESTDIR)\lib\afs\afsaudit.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  
  !IF (("$(SYS_NAME)"!="i386_win95" ) && ("$(SYS_NAME)"!="I386_WIN95" ))
  PTSERVER_EXELIBS =$(PTSERVER_EXELIBS) $(DESTDIR)\lib\afs\afsprocmgmt.lib
***************
*** 100,106 ****
  	$(DESTDIR)\lib\afs\afscmd.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afs\afspioctl.lib
  
  $(PTS): $(PTS_EXEOBJS) $(PTS_EXELIBS) 
  	$(EXECONLINK)
--- 101,108 ----
  	$(DESTDIR)\lib\afs\afscmd.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
! 	$(DESTDIR)\lib\afs\afspioctl.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  
  $(PTS): $(PTS_EXEOBJS) $(PTS_EXELIBS) 
  	$(EXECONLINK)
Index: openafs/src/ptserver/db_verify.c
diff -c openafs/src/ptserver/db_verify.c:1.6.2.2 openafs/src/ptserver/db_verify.c:1.6.2.3
*** openafs/src/ptserver/db_verify.c:1.6.2.2	Wed Sep 19 18:40:37 2001
--- openafs/src/ptserver/db_verify.c	Sat Oct 13 00:21:47 2001
***************
*** 12,18 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/db_verify.c,v 1.6.2.2 2001/09/19 22:40:37 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 12,18 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/db_verify.c,v 1.6.2.3 2001/10/13 04:21:47 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 26,31 ****
--- 26,38 ----
  #include <sys/file.h>
  #endif
  #include <stdio.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <errno.h>
  #include <fcntl.h>
  #include <afs/cellconfig.h>
Index: openafs/src/ptserver/display.c
diff -c openafs/src/ptserver/display.c:1.4.4.1 openafs/src/ptserver/display.c:1.4.4.2
*** openafs/src/ptserver/display.c:1.4.4.1	Wed Sep 19 18:36:25 2001
--- openafs/src/ptserver/display.c	Sat Oct 13 00:21:47 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/display.c,v 1.4.4.1 2001/09/19 22:36:25 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/display.c,v 1.4.4.2 2001/10/13 04:21:47 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/ptserver/pt_util.c
diff -c openafs/src/ptserver/pt_util.c:1.3.4.1 openafs/src/ptserver/pt_util.c:1.3.4.2
*** openafs/src/ptserver/pt_util.c:1.3.4.1	Wed Sep 19 18:40:38 2001
--- openafs/src/ptserver/pt_util.c	Sat Oct 13 00:21:47 2001
***************
*** 1,4 ****
! /* $Id: pt_util.c,v 1.3.4.1 2001/09/19 22:40:38 shadow Exp $ */
  
  /*
   *
--- 1,4 ----
! /* $Id: pt_util.c,v 1.3.4.2 2001/10/13 04:21:47 shadow Exp $ */
  
  /*
   *
***************
*** 21,27 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/pt_util.c,v 1.3.4.1 2001/09/19 22:40:38 shadow Exp $");
  
  #include <lock.h>
  #include <netinet/in.h>
--- 21,27 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/pt_util.c,v 1.3.4.2 2001/10/13 04:21:47 shadow Exp $");
  
  #include <lock.h>
  #include <netinet/in.h>
Index: openafs/src/ptserver/ptclient.c
diff -c openafs/src/ptserver/ptclient.c:1.5.2.1 openafs/src/ptserver/ptclient.c:1.5.2.3
*** openafs/src/ptserver/ptclient.c:1.5.2.1	Wed Sep 19 18:40:38 2001
--- openafs/src/ptserver/ptclient.c	Wed Nov 14 22:30:29 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptclient.c,v 1.5.2.1 2001/09/19 22:40:38 shadow Exp $");
  
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptclient.c,v 1.5.2.3 2001/11/15 03:30:29 shadow Exp $");
  
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
***************
*** 21,26 ****
--- 21,27 ----
  #include <WINNT/afsevent.h>
  #else
  #include <netinet/in.h>
+ #include <netdb.h>
  #endif
  #include <stdio.h>
  #include <rx/xdr.h>
***************
*** 163,168 ****
--- 164,171 ----
      prlist alist;
      idlist lid;
      namelist lnames;
+     struct hostent *hostinfo;
+     struct in_addr *hostaddr;
      afs_int32 *ptr;
      char *foo;
      afs_int32 over;
***************
*** 404,409 ****
--- 407,437 ----
  		alist.prlist_val = 0;
  	    }
  	}
+ 	else if (!strcmp(op,"lh")) {
+ 	    alist.prlist_len = 0;
+ 	    alist.prlist_val = 0;
+ 	    /* scanf("%d",&id); */
+ 	    if (GetString(name, sizeof(name))) code = PRBADARG;
+ 	    else if (!(hostinfo = gethostbyname(name))) code = PRBADARG;
+ 	    else {
+ 		hostaddr = hostinfo->h_addr_list[0];
+ 		id = ntohl(hostaddr->s_addr);
+ 		code = ubik_Call(PR_GetHostCPS,pruclient,0,id, &alist, &over);
+ 	    }
+ 	    if (CodeOk(code)) printf("%s\n",pr_ErrorMsg(code));
+ 	    if (code == PRSUCCESS) {
+ 		ptr = alist.prlist_val;
+ 		if (over) {
+ 		    printf("Number of groups greater than PR_MAXGROUPS!\n");
+ 		    printf("Excess of %d.\n",over);
+ 		}
+ 		for (i=0;i<alist.prlist_len;i++,ptr++)
+ 		    printf("%d\n",*ptr);
+ 		free(alist.prlist_val);
+ 		alist.prlist_len = 0;
+ 		alist.prlist_val = 0;
+ 	    }
+ 	}
  	else if (!strcmp(op,"nu")) {
  	    /* scanf("%s",name); */
  	    if (GetString (name, sizeof(name))) code = PRBADARG;
***************
*** 527,532 ****
--- 555,561 ----
      printf("dg gid - delete the entry for group gid.\n");
      printf("rm id gid - remove user id from group gid.\n");
      printf("l id - get the CPS for id.\n");
+     printf("lh host - get the host CPS for host.\n");
      printf("nu name - create new user with name - returns an id.\n");
      printf("ng name - create new group with name - returns an id.\n");
      printf("lm  - list max user id and max (really min) group id.\n");
Index: openafs/src/ptserver/ptprocs.c
diff -c openafs/src/ptserver/ptprocs.c:1.7.2.1 openafs/src/ptserver/ptprocs.c:1.7.2.2
*** openafs/src/ptserver/ptprocs.c:1.7.2.1	Wed Sep 19 18:36:25 2001
--- openafs/src/ptserver/ptprocs.c	Sat Oct 13 00:21:47 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptprocs.c,v 1.7.2.1 2001/09/19 22:36:25 shadow Exp $");
  
  #include <afs/stds.h>
  #include <ctype.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptprocs.c,v 1.7.2.2 2001/10/13 04:21:47 shadow Exp $");
  
  #include <afs/stds.h>
  #include <ctype.h>
***************
*** 25,33 ****
  #ifdef AFS_NT40_ENV 
  #include <winsock2.h>
  #else
- #include <strings.h>
  #include <netinet/in.h>
  #endif
  #include "ptserver.h"
  #include "pterror.h"
  #include "afs/audit.h"
--- 25,39 ----
  #ifdef AFS_NT40_ENV 
  #include <winsock2.h>
  #else
  #include <netinet/in.h>
  #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include "ptserver.h"
  #include "pterror.h"
  #include "afs/audit.h"
***************
*** 107,115 ****
  	goto done;			/* no longer supported */
      }
      else if (code == 2) {		/* kad class */
! 	if (code = rxkad_GetServerInfo
  	    (acall->conn, (afs_int32 *) 0, 0/*was &exp*/,
! 	     name, inst, tcell, (afs_int32 *) 0))
  	    goto done;
  #if 0
  	/* This test is unnecessary, since rxkad_GetServerInfo already check.
--- 113,121 ----
  	goto done;			/* no longer supported */
      }
      else if (code == 2) {		/* kad class */
! 	if ((code = rxkad_GetServerInfo
  	    (acall->conn, (afs_int32 *) 0, 0/*was &exp*/,
! 	     name, inst, tcell, (afs_int32 *) 0)))
  	    goto done;
  #if 0
  	/* This test is unnecessary, since rxkad_GetServerInfo already check.
***************
*** 1153,1162 ****
          ABORT_WITH(tt,PRPERM);
  
      aentry->flags = tentry.flags >> PRIVATE_SHIFT;
!     if (aentry->flags == 0)
  	if (tentry.flags & PRGRP)
  	    aentry->flags = PRP_GROUP_DEFAULT >> PRIVATE_SHIFT;
  	else aentry->flags = PRP_USER_DEFAULT >> PRIVATE_SHIFT;
      aentry->owner = tentry.owner;
      aentry->id = tentry.id;
      strncpy(aentry->name,tentry.name,PR_MAXNAMELEN);
--- 1159,1169 ----
          ABORT_WITH(tt,PRPERM);
  
      aentry->flags = tentry.flags >> PRIVATE_SHIFT;
!     if (aentry->flags == 0) {
  	if (tentry.flags & PRGRP)
  	    aentry->flags = PRP_GROUP_DEFAULT >> PRIVATE_SHIFT;
  	else aentry->flags = PRP_USER_DEFAULT >> PRIVATE_SHIFT;
+     }
      aentry->owner = tentry.owner;
      aentry->id = tentry.id;
      strncpy(aentry->name,tentry.name,PR_MAXNAMELEN);
***************
*** 1635,1641 ****
  register char *s;
  {
      register int tc;
!     while (tc = *s) {
  	if (isupper(tc)) *s = tolower(tc);
  	s++;
      }
--- 1642,1648 ----
  register char *s;
  {
      register int tc;
!     while ((tc = *s)) {
  	if (isupper(tc)) *s = tolower(tc);
  	s++;
      }
***************
*** 1656,1662 ****
      int size = 0, i, code;
      int added = 0;
   
!     while (host = (host & wild)) {
  	wild = htonl ( ntohl(wild) << 8) ;
  	iaddr.s_addr = host;
  	code = NameToID(tt, inet_ntoa(iaddr),&hostid);
--- 1663,1669 ----
      int size = 0, i, code;
      int added = 0;
   
!     while ((host = (host & wild))) {
  	wild = htonl ( ntohl(wild) << 8) ;
  	iaddr.s_addr = host;
  	code = NameToID(tt, inet_ntoa(iaddr),&hostid);
***************
*** 1678,1684 ****
  	added +=  wlist.prlist_len;
  	for (i=0; i< wlist.prlist_len; i++) {
  	    if (!inCPS(*alist,wlist.prlist_val[i]))
! 		if (code = AddToPRList (alist, &size, wlist.prlist_val[i] )) {
  		    free(wlist.prlist_val);
  		    return(code);
  		}
--- 1685,1691 ----
  	added +=  wlist.prlist_len;
  	for (i=0; i< wlist.prlist_len; i++) {
  	    if (!inCPS(*alist,wlist.prlist_val[i]))
! 		if ((code = AddToPRList (alist, &size, wlist.prlist_val[i] ))) {
  		    free(wlist.prlist_val);
  		    return(code);
  		}
***************
*** 1720,1736 ****
  	int clen;
  	extern char *pr_realmName;
  
! 	if (code = rxkad_GetServerInfo
  	    (acall->conn, (afs_int32 *) 0, 0/*was &exp*/,
! 	     name, inst, tcell, (afs_int32 *) 0))
  	    goto done;
  	strncpy (vname, name, sizeof(vname));
! 	if (ilen = strlen (inst)) {
  	    if (strlen(vname) + 1 + ilen >= sizeof(vname)) goto done;
  	    strcat (vname, ".");
  	    strcat (vname, inst);
  	}
! 	if (clen = strlen (tcell)){
  
  #if	defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
  	    static char local_realm[AFS_REALM_SZ] = "";
--- 1727,1743 ----
  	int clen;
  	extern char *pr_realmName;
  
! 	if ((code = rxkad_GetServerInfo
  	    (acall->conn, (afs_int32 *) 0, 0/*was &exp*/,
! 	     name, inst, tcell, (afs_int32 *) 0)))
  	    goto done;
  	strncpy (vname, name, sizeof(vname));
! 	if ((ilen = strlen(inst))) {
  	    if (strlen(vname) + 1 + ilen >= sizeof(vname)) goto done;
  	    strcat (vname, ".");
  	    strcat (vname, inst);
  	}
! 	if ( (clen = strlen(tcell))) {
  
  #if	defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
  	    static char local_realm[AFS_REALM_SZ] = "";
Index: openafs/src/ptserver/pts.c
diff -c openafs/src/ptserver/pts.c:1.6 openafs/src/ptserver/pts.c:1.6.4.1
*** openafs/src/ptserver/pts.c:1.6	Thu Jul 12 15:58:54 2001
--- openafs/src/ptserver/pts.c	Sat Oct 13 00:21:47 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/pts.c,v 1.6 2001/07/12 19:58:54 shadow Exp $");
  
  #include <stdio.h>
  #include <string.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/pts.c,v 1.6.4.1 2001/10/13 04:21:47 shadow Exp $");
  
  #include <stdio.h>
  #include <string.h>
***************
*** 833,839 ****
--- 833,846 ----
  {
      register afs_int32 code;
      register struct cmd_syndesc *ts;
+ #ifdef WIN32
+     WSADATA WSAjunk;
+ #endif
  
+ #ifdef WIN32
+     WSAStartup(0x0101, &WSAjunk);
+ #endif
+     
  #ifdef	AFS_AIX32_ENV
      /*
       * The following signal action for AIX is necessary so that in case of a 
Index: openafs/src/ptserver/ptserver.c
diff -c openafs/src/ptserver/ptserver.c:1.9.2.1 openafs/src/ptserver/ptserver.c:1.9.2.2
*** openafs/src/ptserver/ptserver.c:1.9.2.1	Wed Sep 19 18:36:25 2001
--- openafs/src/ptserver/ptserver.c	Sat Oct 13 00:21:47 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptserver.c,v 1.9.2.1 2001/09/19 22:36:25 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptserver.c,v 1.9.2.2 2001/10/13 04:21:47 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
***************
*** 24,29 ****
--- 24,36 ----
  #else
  #include <netdb.h>
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
Index: openafs/src/ptserver/ptuser.c
diff -c openafs/src/ptserver/ptuser.c:1.6.2.1 openafs/src/ptserver/ptuser.c:1.6.2.2
*** openafs/src/ptserver/ptuser.c:1.6.2.1	Wed Sep 19 18:40:38 2001
--- openafs/src/ptserver/ptuser.c	Sat Oct 13 00:21:47 2001
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptuser.c,v 1.6.2.1 2001/09/19 22:40:38 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptuser.c,v 1.6.2.2 2001/10/13 04:21:47 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
***************
*** 39,44 ****
--- 39,51 ----
  #include <netinet/in.h>
  #endif
  #include <stdio.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <rx/rx.h>
  #include <rx/xdr.h>
  #include <rx/rxkad.h>
Index: openafs/src/ptserver/ptutils.c
diff -c openafs/src/ptserver/ptutils.c:1.9 openafs/src/ptserver/ptutils.c:1.9.2.1
*** openafs/src/ptserver/ptutils.c:1.9	Tue Aug  7 20:03:54 2001
--- openafs/src/ptserver/ptutils.c	Sat Oct 13 00:21:47 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptutils.c,v 1.9 2001/08/08 00:03:54 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/ptutils.c,v 1.9.2.1 2001/10/13 04:21:47 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 19,26 ****
--- 19,32 ----
  #include <winsock2.h>
  #else
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
  #include <strings.h>
  #endif
+ #endif
  #include <lock.h>
  #include <ubik.h>
  #include <rx/xdr.h>
***************
*** 104,110 ****
  	if (ntohl(tentry.flags) & PRGRP) {
  	    if ((tentry.count == 0) && !admin) return PRGROUPEMPTY;
  	    /* terminate prefix at colon if there is one */
! 	    if (prefix = strchr(tentry.name, ':')) *prefix = 0;
  	}
  	prefix = tentry.name;
      }
--- 110,116 ----
  	if (ntohl(tentry.flags) & PRGRP) {
  	    if ((tentry.count == 0) && !admin) return PRGROUPEMPTY;
  	    /* terminate prefix at colon if there is one */
! 	    if ((prefix = strchr(tentry.name, ':'))) *prefix = 0;
  	}
  	prefix = tentry.name;
      }
***************
*** 126,132 ****
      }
    done:
      /* check for legal name with either group rules or user rules */
!     if (suffix = strchr(cname, ':')) {
  	/* check for confusing characters */
  	if (strchr(cname, '\n') ||	/* restrict so recreate can work */
  	    strchr(suffix+1, ':'))	/* avoid multiple colons */
--- 132,138 ----
      }
    done:
      /* check for legal name with either group rules or user rules */
!     if ((suffix = strchr(cname, ':'))) {
  	/* check for confusing characters */
  	if (strchr(cname, '\n') ||	/* restrict so recreate can work */
  	    strchr(suffix+1, ':'))	/* avoid multiple colons */
***************
*** 156,166 ****
      } else {
  	flags = oid = aid = 0;
      }
!     if (!(flags & PRACCESS))		/* provide default access */
  	if (flags & PRGRP)
  	    flags |= PRP_GROUP_DEFAULT;
  	else
  	    flags |= PRP_USER_DEFAULT;
  
      if (flags & any) return 1;
      if (oid) {
--- 162,173 ----
      } else {
  	flags = oid = aid = 0;
      }
!     if (!(flags & PRACCESS)) {		/* provide default access */
  	if (flags & PRGRP)
  	    flags |= PRP_GROUP_DEFAULT;
  	else
  	    flags |= PRP_USER_DEFAULT;
+     }
  
      if (flags & any) return 1;
      if (oid) {
***************
*** 622,628 ****
      afs_int32 nptr;
      afs_int32 last;				/* addr of last cont. block */
      afs_int32 first = 0;
!     afs_int32 cloc;
      afs_int32 slot = -1;
  
      if (entry->id == aid) return PRINCONSISTENT;
--- 629,635 ----
      afs_int32 nptr;
      afs_int32 last;				/* addr of last cont. block */
      afs_int32 first = 0;
!     afs_int32 cloc = 0;
      afs_int32 slot = -1;
  
      if (entry->id == aid) return PRINCONSISTENT;
***************
*** 796,802 ****
    prlist *alist;
    afs_int32 add;
  {
!     afs_int32 code;
      afs_int32 i;
      struct contentry centry;
      afs_int32 nptr;
--- 803,809 ----
    prlist *alist;
    afs_int32 add;
  {
!     afs_int32 code = 0;
      afs_int32 i;
      struct contentry centry;
      afs_int32 nptr;
Index: openafs/src/ptserver/readgroup.c
diff -c openafs/src/ptserver/readgroup.c:1.5.2.1 openafs/src/ptserver/readgroup.c:1.5.2.2
*** openafs/src/ptserver/readgroup.c:1.5.2.1	Wed Sep 19 18:36:25 2001
--- openafs/src/ptserver/readgroup.c	Sat Oct 13 00:21:47 2001
***************
*** 10,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/readgroup.c,v 1.5.2.1 2001/09/19 22:36:25 shadow Exp $");
  
  #include <stdio.h>
! #ifndef AFS_NT40_ENV
! #include <strings.h>
! #else
  #include <WINNT/afsevent.h>
  #endif
  #include <ctype.h>
  #include <rx/rx.h>
  #include <rx/xdr.h>
  #include <afs/cellconfig.h>
--- 10,29 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/readgroup.c,v 1.5.2.2 2001/10/13 04:21:47 shadow Exp $");
  
  #include <stdio.h>
! #ifdef AFS_NT40_ENV
  #include <WINNT/afsevent.h>
  #endif
  #include <ctype.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <rx/rx.h>
  #include <rx/xdr.h>
  #include <afs/cellconfig.h>
Index: openafs/src/ptserver/readpwd.c
diff -c openafs/src/ptserver/readpwd.c:1.5 openafs/src/ptserver/readpwd.c:1.5.2.1
*** openafs/src/ptserver/readpwd.c:1.5	Tue Aug  7 20:03:54 2001
--- openafs/src/ptserver/readpwd.c	Sat Oct 13 00:21:48 2001
***************
*** 10,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/readpwd.c,v 1.5 2001/08/08 00:03:54 shadow Exp $");
  
  #include <stdio.h>
! #ifndef AFS_NT40_ENV
! #include <strings.h>
! #else
  #include <WINNT/afsevent.h>
  #endif
  #include <rx/rx.h>
  #include <rx/xdr.h>
--- 10,27 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/readpwd.c,v 1.5.2.1 2001/10/13 04:21:48 shadow Exp $");
  
  #include <stdio.h>
! #ifdef AFS_NT40_ENV
  #include <WINNT/afsevent.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <rx/rx.h>
  #include <rx/xdr.h>
Index: openafs/src/ptserver/testpt.c
diff -c openafs/src/ptserver/testpt.c:1.6.2.1 openafs/src/ptserver/testpt.c:1.6.2.2
*** openafs/src/ptserver/testpt.c:1.6.2.1	Wed Sep 19 18:40:38 2001
--- openafs/src/ptserver/testpt.c	Sat Oct 13 00:21:48 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/testpt.c,v 1.6.2.1 2001/09/19 22:40:38 shadow Exp $");
  
  #include <ctype.h>
  #include <errno.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/testpt.c,v 1.6.2.2 2001/10/13 04:21:48 shadow Exp $");
  
  #include <ctype.h>
  #include <errno.h>
***************
*** 22,27 ****
--- 22,43 ----
  #include <sys/socket.h>
  #include <netdb.h>
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+ #ifdef HAVE_SYS_STAT_H
+ #include <sys/stat.h>
+ #endif
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
  #endif
  #include <rx/rx.h>
  #include <rx/xdr.h>
Index: openafs/src/ptserver/utils.c
diff -c openafs/src/ptserver/utils.c:1.7.2.1 openafs/src/ptserver/utils.c:1.7.2.2
*** openafs/src/ptserver/utils.c:1.7.2.1	Wed Sep 19 18:36:25 2001
--- openafs/src/ptserver/utils.c	Sat Oct 13 00:21:48 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/utils.c,v 1.7.2.1 2001/09/19 22:36:25 shadow Exp $");
  
  #include <sys/types.h>
  #include <lock.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/utils.c,v 1.7.2.2 2001/10/13 04:21:48 shadow Exp $");
  
  #include <sys/types.h>
  #include <lock.h>
***************
*** 21,26 ****
--- 21,33 ----
  #else
  #include <netinet/in.h>
  #include <netdb.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include "ptserver.h"
  #include "pterror.h"
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.22 openafs/src/rx/rx.c:1.22.2.1
*** openafs/src/rx/rx.c:1.22	Fri Sep  7 16:47:57 2001
--- openafs/src/rx/rx.c	Sat Oct 13 00:21:49 2001
***************
*** 16,22 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx.c,v 1.22 2001/09/07 20:47:57 shadow Exp $");
  
  #ifdef KERNEL
  #include "../afs/sysincludes.h"
--- 16,22 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx.c,v 1.22.2.1 2001/10/13 04:21:49 shadow Exp $");
  
  #ifdef KERNEL
  #include "../afs/sysincludes.h"
***************
*** 3460,3466 ****
  
      /* if the ack packet has a receivelen field hanging off it,
       * update our state */
!     if ( np->length >= rx_AckDataSize(ap->nAcks) +sizeof(afs_int32)) {
        afs_uint32 tSize;
  
        /* If the ack packet has a "recommended" size that is less than 
--- 3460,3466 ----
  
      /* if the ack packet has a receivelen field hanging off it,
       * update our state */
!     if ( np->length >= rx_AckDataSize(ap->nAcks) + 2*sizeof(afs_int32)) {
        afs_uint32 tSize;
  
        /* If the ack packet has a "recommended" size that is less than 
Index: openafs/src/rx/rx.h
diff -c openafs/src/rx/rx.h:1.7 openafs/src/rx/rx.h:1.7.2.1
*** openafs/src/rx/rx.h:1.7	Mon Aug  6 20:05:03 2001
--- openafs/src/rx/rx.h	Sat Oct 13 00:21:49 2001
***************
*** 224,229 ****
--- 224,232 ----
  #define rx_SetConnAbortThreshold(A) (rxi_connAbortThreshhold = (A))
  #define rx_SetConnAbortDelay(A) (rxi_connAbortDelay = (A))
  
+ #define rx_GetCallAbortCode(call) ((call)->abortCode)
+ #define rx_SetCallAbortCode(call, code) ((call)->abortCode = (code))
+ 
  #define cpspace(call) ((call)->curlen)
  #define cppos(call) ((call)->curpos)
  
***************
*** 291,297 ****
      int refCount;
  };
  
! #define RXS_OP(obj,op,args) ((obj->ops->op_ ## op) ? (*(obj)->ops->op_ ## op)args : 0)
  
  #define RXS_Close(obj) RXS_OP(obj,Close,(obj))
  #define RXS_NewConnection(obj,conn) RXS_OP(obj,NewConnection,(obj,conn))
--- 294,300 ----
      int refCount;
  };
  
! #define RXS_OP(obj,op,args) ((obj && (obj->ops->op_ ## op)) ? (*(obj)->ops->op_ ## op)args : 0)
  
  #define RXS_Close(obj) RXS_OP(obj,Close,(obj))
  #define RXS_NewConnection(obj,conn) RXS_OP(obj,NewConnection,(obj,conn))
Index: openafs/src/rx/rx_clock.c
diff -c openafs/src/rx/rx_clock.c:1.5 openafs/src/rx/rx_clock.c:1.5.4.1
*** openafs/src/rx/rx_clock.c:1.5	Thu Jul  5 11:20:44 2001
--- openafs/src/rx/rx_clock.c	Sat Oct 13 00:21:49 2001
***************
*** 17,23 ****
  #endif
  #include <afsconfig.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_clock.c,v 1.5 2001/07/05 15:20:44 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 17,23 ----
  #endif
  #include <afsconfig.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_clock.c,v 1.5.4.1 2001/10/13 04:21:49 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 33,38 ****
--- 33,39 ----
  #include <sys/time.h>
  #include <stdio.h>
  #include <errno.h>
+ #include <stdlib.h>
  #include "rx_clock.h"
  #endif
  
Index: openafs/src/rx/rx_getaddr.c
diff -c openafs/src/rx/rx_getaddr.c:1.9.4.1 openafs/src/rx/rx_getaddr.c:1.9.4.2
*** openafs/src/rx/rx_getaddr.c:1.9.4.1	Wed Sep 19 18:25:28 2001
--- openafs/src/rx/rx_getaddr.c	Sat Oct 13 00:21:49 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_getaddr.c,v 1.9.4.1 2001/09/19 22:25:28 shadow Exp $");
  
  #ifndef AFS_DJGPP_ENV
  #ifndef KERNEL
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_getaddr.c,v 1.9.4.2 2001/10/13 04:21:49 shadow Exp $");
  
  #ifndef AFS_DJGPP_ENV
  #ifndef KERNEL
***************
*** 303,311 ****
                      ifr.ifr_addr.sa_family=AF_INET;
                      strncpy(ifr.ifr_name, sdl->sdl_data, sdl->sdl_nlen);
                      if (ioctl(s, SIOCGIFMTU, (caddr_t)&ifr) < 0)
!                          mtuBuffer[count]=1500;
                      else
!                          mtuBuffer[count]=ifr.ifr_mtu;
                      count++;
                 }
                 addrcount--;
--- 303,311 ----
                      ifr.ifr_addr.sa_family=AF_INET;
                      strncpy(ifr.ifr_name, sdl->sdl_data, sdl->sdl_nlen);
                      if (ioctl(s, SIOCGIFMTU, (caddr_t)&ifr) < 0)
!                          mtuBuffer[count]=htonl(1500);
                      else
!                          mtuBuffer[count]=htonl(ifr.ifr_mtu);
                      count++;
                 }
                 addrcount--;
***************
*** 464,477 ****
  	 if ( ioctl(s, SIOCGIFMTU, (caddr_t)ifr) < 0) {
  	    perror("SIOCGIFMTU");
  	 } else {
! 	    mtuBuffer[count] = ifr->ifr_metric;
  	 }
  #endif /* SIOCGIFMTU */
  #ifdef SIOCRIPMTU
  	 if ( ioctl(s, SIOCRIPMTU, (caddr_t)ifr) < 0) {
  	    perror("SIOCRIPMTU");
  	 } else {
! 	    mtuBuffer[count] = ifr->ifr_metric;
  	 }
  #endif /* SIOCRIPMTU */
  
--- 464,477 ----
  	 if ( ioctl(s, SIOCGIFMTU, (caddr_t)ifr) < 0) {
  	    perror("SIOCGIFMTU");
  	 } else {
! 	    mtuBuffer[count] = htonl(ifr->ifr_metric);
  	 }
  #endif /* SIOCGIFMTU */
  #ifdef SIOCRIPMTU
  	 if ( ioctl(s, SIOCRIPMTU, (caddr_t)ifr) < 0) {
  	    perror("SIOCRIPMTU");
  	 } else {
! 	    mtuBuffer[count] = htonl(ifr->ifr_metric);
  	 }
  #endif /* SIOCRIPMTU */
  
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.9.2.1 openafs/src/rx/rx_kcommon.c:1.9.2.2
*** openafs/src/rx/rx_kcommon.c:1.9.2.1	Wed Sep 19 18:25:28 2001
--- openafs/src/rx/rx_kcommon.c	Sat Oct 13 00:21:49 2001
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_kcommon.c,v 1.9.2.1 2001/09/19 22:25:28 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  
--- 14,20 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_kcommon.c,v 1.9.2.2 2001/10/13 04:21:49 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  
***************
*** 343,348 ****
--- 343,349 ----
      u_short rxmtu;
      afs_int32 i, mtu;
  
+ #ifndef AFS_SUN5_ENV
  #ifdef AFS_USERSPACE_IP_ADDR	
      i = rxi_Findcbi(pp->host);
      if (i == -1) {
***************
*** 402,407 ****
--- 403,432 ----
        pp->ifMTU = RX_REMOTE_PACKET_SIZE;
      }
  #endif/* else AFS_USERSPACE_IP_ADDR */
+ #else /* AFS_SUN5_ENV */
+     mtu = rxi_FindIfMTU(pp->host);
+ 
+     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; */
+ 	pp->ifMTU = MIN(RX_MAX_PACKET_SIZE, rx_MyMaxSendSize);
+     }
+ 
+     if (mtu > 0) {
+ 	/* Diminish the packet size to one based on the MTU given by
+ 	 * the interface. */
+ 	if (mtu > (RX_IPUDP_SIZE + RX_HEADER_SIZE)) {
+ 	    rxmtu = mtu - RX_IPUDP_SIZE;
+ 	    if (rxmtu < pp->ifMTU) 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 */
      pp->rateFlag = 2;   /* start timing after two full packets */
      pp->timeout.sec = 2;
Index: openafs/src/rx/rx_kcommon.h
diff -c openafs/src/rx/rx_kcommon.h:1.4.4.1 openafs/src/rx/rx_kcommon.h:1.4.4.2
*** openafs/src/rx/rx_kcommon.h:1.4.4.1	Wed Sep 19 18:25:28 2001
--- openafs/src/rx/rx_kcommon.h	Sat Oct 13 00:21:49 2001
***************
*** 111,116 ****
--- 111,117 ----
  
  extern struct osi_socket *rxk_NewSocket(short aport);
  extern struct ifnet *rxi_FindIfnet();
+ extern int rxi_FindIfMTU();
  
  extern int rxk_initDone;
  
Index: openafs/src/rx/rx_misc.h
diff -c openafs/src/rx/rx_misc.h:1.2 openafs/src/rx/rx_misc.h:1.2.8.1
*** openafs/src/rx/rx_misc.h:1.2	Sat Nov  4 05:05:32 2000
--- openafs/src/rx/rx_misc.h	Sat Oct 13 00:21:49 2001
***************
*** 14,27 ****
  #ifndef _RX_MISC_H_
  #define _RX_MISC_H_
  
- #ifndef	AFS_SUN5_ENV
  #define MISCMTU
  #define ADAPT_MTU
- #endif
  
! #if defined(AFS_SUN5_ENV) && !defined(KERNEL)
! #define MISCMTU
! #define ADAPT_MTU
  #include <sys/sockio.h>
  #include <sys/fcntl.h>
  #endif
--- 14,23 ----
  #ifndef _RX_MISC_H_
  #define _RX_MISC_H_
  
  #define MISCMTU
  #define ADAPT_MTU
  
! #if defined(AFS_SUN5_ENV)
  #include <sys/sockio.h>
  #include <sys/fcntl.h>
  #endif
Index: openafs/src/rx/rx_packet.c
diff -c openafs/src/rx/rx_packet.c:1.14 openafs/src/rx/rx_packet.c:1.14.2.1
*** openafs/src/rx/rx_packet.c:1.14	Fri Sep  7 16:47:57 2001
--- openafs/src/rx/rx_packet.c	Sat Oct 13 00:21:49 2001
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_packet.c,v 1.14 2001/09/07 20:47:57 shadow Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_packet.c,v 1.14.2.1 2001/10/13 04:21:49 shadow Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
***************
*** 272,278 ****
    queue_Remove(c);
    if (!(c->flags & RX_PKTFLAG_FREE))
      osi_Panic("rxi_AllocPacket: packet not free\n");
!   c->flags &= ~RX_PKTFLAG_FREE;
    c->header.flags = 0;
    
  #ifdef KERNEL
--- 272,278 ----
    queue_Remove(c);
    if (!(c->flags & RX_PKTFLAG_FREE))
      osi_Panic("rxi_AllocPacket: packet not free\n");
!   c->flags = 0;		/* clear RX_PKTFLAG_FREE, initialize the rest */
    c->header.flags = 0;
    
  #ifdef KERNEL
***************
*** 631,637 ****
    dpf(("Alloc %x, class %d\n", p, class));
    
    queue_Remove(p);
!   p->flags &= ~RX_PKTFLAG_FREE;
    p->header.flags = 0;
    
    /* have to do this here because rx_FlushWrite fiddles with the iovs in
--- 631,637 ----
    dpf(("Alloc %x, class %d\n", p, class));
    
    queue_Remove(p);
!   p->flags = 0;		/* clear RX_PKTFLAG_FREE, initialize the rest */
    p->header.flags = 0;
    
    /* have to do this here because rx_FlushWrite fiddles with the iovs in
***************
*** 788,795 ****
      * our problems caused by the lack of a length field in the rx header.
      * Use the extra buffer that follows the localdata in each packet
      * structure. */
!     savelen = p->wirevec[p->niovecs].iov_len;
!     p->wirevec[p->niovecs].iov_len += RX_EXTRABUFFERSIZE;
  
      memset((char *)&msg, 0, sizeof(msg));
      msg.msg_name = (char *) &from;
--- 788,795 ----
      * our problems caused by the lack of a length field in the rx header.
      * Use the extra buffer that follows the localdata in each packet
      * structure. */
!     savelen = p->wirevec[p->niovecs-1].iov_len;
!     p->wirevec[p->niovecs-1].iov_len += RX_EXTRABUFFERSIZE;
  
      memset((char *)&msg, 0, sizeof(msg));
      msg.msg_name = (char *) &from;
***************
*** 799,805 ****
      nbytes = rxi_Recvmsg(socket, &msg, 0);
  
     /* restore the vec to its correct state */
!     p->wirevec[p->niovecs].iov_len = savelen;
  
      p->length = (nbytes - RX_HEADER_SIZE);
      if ((nbytes > tlen) || (p->length  & 0x8000)) {  /* Bogus packet */
--- 799,805 ----
      nbytes = rxi_Recvmsg(socket, &msg, 0);
  
     /* restore the vec to its correct state */
!     p->wirevec[p->niovecs-1].iov_len = savelen;
  
      p->length = (nbytes - RX_HEADER_SIZE);
      if ((nbytes > tlen) || (p->length  & 0x8000)) {  /* Bogus packet */
***************
*** 1854,1871 ****
      register afs_uint32 *buf = (afs_uint32*)(p->wirevec[0].iov_base);      /* MTUXXX */
      afs_uint32 temp;
  
!     p->header.epoch = ntohl(*buf++);
!     p->header.cid = ntohl(*buf++);
!     p->header.callNumber = ntohl(*buf++);
!     p->header.seq = ntohl(*buf++);
!     p->header.serial = ntohl(*buf++);
!     temp = ntohl(*buf++);
      /* C will truncate byte fields to bytes for me */
      p->header.type = temp>>24;
      p->header.flags = temp>>16;
      p->header.userStatus = temp>>8;
      p->header.securityIndex = temp>>0;
!     temp = ntohl(*buf++);
      p->header.serviceId = (temp&0xffff);
      p->header.spare = temp>>16;
      /* Note: top 16 bits of this last word are the security checksum */
--- 1854,1882 ----
      register afs_uint32 *buf = (afs_uint32*)(p->wirevec[0].iov_base);      /* MTUXXX */
      afs_uint32 temp;
  
!     p->header.epoch = ntohl(*buf);
!     buf++;
!     p->header.cid = ntohl(*buf);
!     buf++;
!     p->header.callNumber = ntohl(*buf);
!     buf++;
!     p->header.seq = ntohl(*buf);
!     buf++;
!     p->header.serial = ntohl(*buf);
!     buf++;
! 
!     temp = ntohl(*buf);
!     buf++;
! 
      /* C will truncate byte fields to bytes for me */
      p->header.type = temp>>24;
      p->header.flags = temp>>16;
      p->header.userStatus = temp>>8;
      p->header.securityIndex = temp>>0;
! 
!     temp = ntohl(*buf);
!     buf++;
! 
      p->header.serviceId = (temp&0xffff);
      p->header.spare = temp>>16;
      /* Note: top 16 bits of this last word are the security checksum */
Index: openafs/src/rx/rx_pthread.c
diff -c openafs/src/rx/rx_pthread.c:1.6.4.1 openafs/src/rx/rx_pthread.c:1.6.4.2
*** openafs/src/rx/rx_pthread.c:1.6.4.1	Wed Sep 19 18:36:26 2001
--- openafs/src/rx/rx_pthread.c	Sat Oct 13 00:21:49 2001
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_pthread.c,v 1.6.4.1 2001/09/19 22:36:26 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_pthread.c,v 1.6.4.2 2001/10/13 04:21:49 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
Index: openafs/src/rx/rx_rdwr.c
diff -c openafs/src/rx/rx_rdwr.c:1.12.2.1 openafs/src/rx/rx_rdwr.c:1.12.2.2
*** openafs/src/rx/rx_rdwr.c:1.12.2.1	Wed Sep 19 18:25:28 2001
--- openafs/src/rx/rx_rdwr.c	Sat Oct 13 00:21:49 2001
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_rdwr.c,v 1.12.2.1 2001/09/19 22:25:28 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_rdwr.c,v 1.12.2.2 2001/10/13 04:21:49 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
Index: openafs/src/rx/rx_trace.c
diff -c openafs/src/rx/rx_trace.c:1.9 openafs/src/rx/rx_trace.c:1.9.2.1
*** openafs/src/rx/rx_trace.c:1.9	Tue Aug  7 20:03:57 2001
--- openafs/src/rx/rx_trace.c	Sat Oct 13 00:21:49 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_trace.c,v 1.9 2001/08/08 00:03:57 shadow Exp $");
  
  #ifdef RXDEBUG
  #ifdef HAVE_STRING_H
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_trace.c,v 1.9.2.1 2001/10/13 04:21:49 shadow Exp $");
  
  #ifdef RXDEBUG
  #ifdef HAVE_STRING_H
***************
*** 36,42 ****
  #else
  char rxi_tracename[80]="\0Change This pathname (and preceding NUL) to initiate tracing";
  #endif
! int rxi_logfd = 0;
  char rxi_tracebuf[4096];
  afs_uint32 rxi_tracepos = 0;
  
--- 36,42 ----
  #else
  char rxi_tracename[80]="\0Change This pathname (and preceding NUL) to initiate tracing";
  #endif
! int rxi_logfd = -1;
  char rxi_tracebuf[4096];
  afs_uint32 rxi_tracepos = 0;
  
***************
*** 52,58 ****
  
  void rxi_flushtrace()
  {
!     if (rxi_logfd)
  	write(rxi_logfd, rxi_tracebuf, rxi_tracepos);
      rxi_tracepos = 0;
  }
--- 52,58 ----
  
  void rxi_flushtrace()
  {
!     if (rxi_logfd >= 0)
  	write(rxi_logfd, rxi_tracebuf, rxi_tracepos);
      rxi_tracepos = 0;
  }
***************
*** 67,75 ****
    if (!rxi_tracename[0])
      return;
  
!   if (!rxi_logfd) {
      rxi_logfd = open(rxi_tracename, O_WRONLY | O_CREAT | O_TRUNC, 0777);
!     if (!rxi_logfd)
        rxi_tracename[0] = '\0';
    }
    clock_GetTime(&now);
--- 67,75 ----
    if (!rxi_tracename[0])
      return;
  
!   if (rxi_logfd < 0) {
      rxi_logfd = open(rxi_tracename, O_WRONLY | O_CREAT | O_TRUNC, 0777);
!     if (rxi_logfd < 0)
        rxi_tracename[0] = '\0';
    }
    clock_GetTime(&now);
***************
*** 153,159 ****
    }
  
    rxi_logfd = open(rxi_tracename, O_RDONLY);
!   if (!rxi_logfd) {
      perror("");
      exit(errno);
    }
--- 153,159 ----
    }
  
    rxi_logfd = open(rxi_tracename, O_RDONLY);
!   if (rxi_logfd < 0) {
      perror("");
      exit(errno);
    }
Index: openafs/src/rx/IRIX/rx_knet.c
diff -c openafs/src/rx/IRIX/rx_knet.c:1.6 openafs/src/rx/IRIX/rx_knet.c:1.6.2.1
*** openafs/src/rx/IRIX/rx_knet.c:1.6	Wed Aug  8 02:29:03 2001
--- openafs/src/rx/IRIX/rx_knet.c	Sat Oct 13 00:21:50 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/IRIX/rx_knet.c,v 1.6 2001/08/08 06:29:03 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  #include "../h/tcp-param.h"
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/IRIX/rx_knet.c,v 1.6.2.1 2001/10/13 04:21:50 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  #include "../h/tcp-param.h"
***************
*** 324,330 ****
  {
    afs_uint32 ppaddr;
    int match_value = 0;
-   struct hashbucket *slop;
  
    if (numMyNetAddrs == 0)
      (void) rxi_GetIFInfo();
--- 324,329 ----
***************
*** 332,346 ****
    ppaddr = ntohl(addr);
    *pifad = (struct in_ifaddr*)&hashinfo_inaddr;
  
!   slop = hash_enum(&hashinfo_inaddr, rxi_MatchIfnet, HTF_INET,
  		   (caddr_t)&ppaddr, (caddr_t)&match_value, (caddr_t)pifad);
! 
!   if (slop)
!       return ((struct in_ifaddr*)slop)->ia_ifp;
    else
        return NULL;
- 
-       
  }
  
  static int rxi_EnumGetIfInfo(struct hashbucket *h, caddr_t key, caddr_t arg1,
--- 331,343 ----
    ppaddr = ntohl(addr);
    *pifad = (struct in_ifaddr*)&hashinfo_inaddr;
  
!   (void) hash_enum(&hashinfo_inaddr, rxi_MatchIfnet, HTF_INET,
  		   (caddr_t)&ppaddr, (caddr_t)&match_value, (caddr_t)pifad);
!    
!   if (match_value)
!       return (*pifad)->ia_ifp;
    else
        return NULL;
  }
  
  static int rxi_EnumGetIfInfo(struct hashbucket *h, caddr_t key, caddr_t arg1,
Index: openafs/src/rx/SOLARIS/rx_knet.c
diff -c openafs/src/rx/SOLARIS/rx_knet.c:1.6 openafs/src/rx/SOLARIS/rx_knet.c:1.6.2.1
*** openafs/src/rx/SOLARIS/rx_knet.c:1.6	Tue Aug  7 20:04:00 2001
--- openafs/src/rx/SOLARIS/rx_knet.c	Sat Oct 13 00:21:51 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.6 2001/08/08 00:04:00 shadow Exp $");
  
  #ifdef AFS_SUN5_ENV
  #include "../rx/rx_kcommon.h"
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.6.2.1 2001/10/13 04:21:51 shadow Exp $");
  
  #ifdef AFS_SUN5_ENV
  #include "../rx/rx_kcommon.h"
***************
*** 27,34 ****
--- 27,39 ----
  #include "../sys/fcntl.h"
  #ifdef AFS_SUN58_ENV
  #include "../netinet/ip6.h"
+ #define ipif_local_addr ipif_lcl_addr
+ #ifndef V4_PART_OF_V6
+ #define V4_PART_OF_V6(v6)       v6.s6_addr32[3]
  #endif
+ #endif
  #include "../inet/ip.h"
+ #include "../inet/ip_if.h"
  #include "../netinet/udp.h"
  
  /*
***************
*** 46,55 ****
      (struct sonode *, struct nmsghdr *, struct uio *) = NULL;
  int (*sockfs_sosetsockopt)
      (struct sonode *, int, int, void *, int) = NULL;
  
! int rxi_GetIFInfo()
  {
!     return 0;
  }
  
  /* rxi_NewSocket, rxi_FreeSocket and osi_NetSend are from the now defunct
--- 51,188 ----
      (struct sonode *, struct nmsghdr *, struct uio *) = NULL;
  int (*sockfs_sosetsockopt)
      (struct sonode *, int, int, void *, int) = NULL;
+ 
+ static afs_uint32 myNetAddrs[ADDRSPERSITE];
+ static int myNetMTUs[ADDRSPERSITE];
+ static int numMyNetAddrs = 0;
  
! int
! rxi_GetIFInfo()
  {
!     int i = 0;
!     int different = 0;
! 
!     ill_t *ill;
!     ipif_t *ipif;
!     int rxmtu, maxmtu;
! 
!     int mtus[ADDRSPERSITE];
!     afs_uint32 addrs[ADDRSPERSITE];
!     afs_uint32 ifinaddr;
! 
!     memset(mtus, 0, sizeof(mtus));
!     memset(addrs, 0, sizeof(addrs));
! 
!     for (ill = ill_g_head; ill; ill = ill->ill_next) {
! #ifdef AFS_SUN58_ENV
! 	/* Make sure this is an IPv4 ILL */
! 	if (ill->ill_isv6) continue;
! #endif
! 
! 	/* Iterate over all the addresses on this ILL */
! 	for (ipif = ill->ill_ipif; ipif; ipif = ipif->ipif_next) {
! 	    if (i >= ADDRSPERSITE) break;
! 
! 	    /* Ignore addresses which are down.. */
! 	    if (!(ipif->ipif_flags & IFF_UP)) continue;
! 
! 	    /* Compute the Rx interface MTU */
! 	    rxmtu = (ipif->ipif_mtu - RX_IPUDP_SIZE);
! 
! 	    ifinaddr = ntohl(ipif->ipif_local_addr);
! 	    if (myNetAddrs[i] != ifinaddr)
! 		different++;
! 
! 	    /* Copy interface MTU and address; adjust maxmtu */
! 	    mtus[i] = rxmtu;
! 	    rxmtu = rxi_AdjustIfMTU(rxmtu);
! 	    maxmtu = rxmtu * rxi_nRecvFrags + ((rxi_nRecvFrags-1) *
! 					       UDP_HDR_SIZE);
! 	    maxmtu = rxi_AdjustMaxMTU(rxmtu, maxmtu);
! 	    addrs[i] = ifinaddr;
! 	    i++;
! 
! 	    if (ifinaddr != 0x7f000001 && maxmtu > rx_maxReceiveSize) {
! 		rx_maxReceiveSize = MIN( RX_MAX_PACKET_SIZE, maxmtu);
! 		rx_maxReceiveSize = MIN( rx_maxReceiveSize,
! 					 rx_maxReceiveSizeUser);
! 	    }
! 	}
!     }
! 
!     rx_maxJumboRecvSize = RX_HEADER_SIZE +
! 			  rxi_nDgramPackets * RX_JUMBOBUFFERSIZE +
! 			  (rxi_nDgramPackets-1) * RX_JUMBOHEADERSIZE;
!     rx_maxJumboRecvSize = MAX(rx_maxJumboRecvSize, rx_maxReceiveSize);
! 
!     if (different) {
! 	int j;
! 
! 	for (j = 0; j < i; j++) {
! 	    myNetMTUs[j] = mtus[j];
! 	    myNetAddrs[j] = addrs[j];
! 	}
!     }
! 
!     return different;
! }
! 
! int
! rxi_FindIfMTU(addr)
!     afs_uint32 addr;
! {
!     ill_t *ill;
!     ipif_t *ipif;
!     afs_uint32 myAddr, netMask;
!     int match_value = 0;
!     int mtu = -1;
! 
!     if (numMyNetAddrs == 0)
! 	rxi_GetIFInfo();
!     myAddr = ntohl(addr);
! 
!     if      (IN_CLASSA(myAddr)) netMask = IN_CLASSA_NET;
!     else if (IN_CLASSB(myAddr)) netMask = IN_CLASSB_NET;
!     else if (IN_CLASSC(myAddr)) netMask = IN_CLASSC_NET;
!     else                       netMask = 0;
! 
!     for (ill = ill_g_head; ill; ill = ill->ill_next) {
! #ifdef AFS_SUN58_ENV
! 	/* Make sure this is an IPv4 ILL */
! 	if (ill->ill_isv6) continue;
! #endif
! 
! 	/* Iterate over all the addresses on this ILL */
! 	for (ipif = ill->ill_ipif; ipif; ipif = ipif->ipif_next) {
! 	    afs_uint32 thisAddr, subnetMask;
! 	    int thisMtu;
! 
! 	    thisAddr   = ipif->ipif_local_addr;
! 	    subnetMask = ipif->ipif_net_mask;
! 	    thisMtu    = ipif->ipif_mtu;
! 
! 	    if ((myAddr & netMask) == (thisAddr & netMask)) {
! 		if ((myAddr & subnetMask) == (thisAddr & subnetMask)) {
! 		    if (myAddr == thisAddr) {
! 			match_value = 4;
! 			mtu = thisMtu;
! 		    }
! 
! 		    if (match_value < 3) {
! 			match_value = 3;
! 			mtu = thisMtu;
! 		    }
! 		}
! 
! 		if (match_value < 2) {
! 		    match_value = 2;
! 		    mtu = thisMtu;
! 		}
! 	    }
! 	}
!     }
! 
!     return mtu;
  }
  
  /* rxi_NewSocket, rxi_FreeSocket and osi_NetSend are from the now defunct
Index: openafs/src/rx/test/generator.c
diff -c openafs/src/rx/test/generator.c:1.5.4.1 openafs/src/rx/test/generator.c:1.5.4.2
*** openafs/src/rx/test/generator.c:1.5.4.1	Wed Sep 19 18:40:38 2001
--- openafs/src/rx/test/generator.c	Sat Oct 13 00:21:52 2001
***************
*** 52,58 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/test/generator.c,v 1.5.4.1 2001/09/19 22:40:38 shadow Exp $");
  
  #include <stdio.h>
  #include <string.h>
--- 52,58 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/test/generator.c,v 1.5.4.2 2001/10/13 04:21:52 shadow Exp $");
  
  #include <stdio.h>
  #include <string.h>
Index: openafs/src/rxdebug/rxdebug.c
diff -c openafs/src/rxdebug/rxdebug.c:1.1 openafs/src/rxdebug/rxdebug.c:1.1.2.1
*** openafs/src/rxdebug/rxdebug.c:1.1	Fri Sep  7 19:35:49 2001
--- openafs/src/rxdebug/rxdebug.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxdebug/rxdebug.c,v 1.1 2001/09/07 23:35:49 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxdebug/rxdebug.c,v 1.1.2.1 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
***************
*** 111,116 ****
--- 111,117 ----
      struct rx_debugConn tconn;
      short noConns;
      short showPeers;
+     short showLong;
      int version_flag;
      char version[64];
      afs_int32 length=64;
***************
*** 130,135 ****
--- 131,137 ----
      version_flag=(as->parms[10].items ? 1 : 0);
      noConns = (as->parms[11].items ? 1 : 0);
      showPeers = (as->parms[12].items ? 1 : 0);
+     showLong = (as->parms[13].items ? 1 : 0);
  
      if (as->parms[0].items)
  	hostName = as->parms[0].items->data;
***************
*** 500,505 ****
--- 502,516 ----
  		   tpeer.rtt >> 3, tpeer.rtt_dev >> 2);
  	    printf("\ttimeout %d.%03d sec\n",
  		   tpeer.timeout.sec, tpeer.timeout.usec / 1000);
+ 	    if (!showLong) continue;
+ 
+ 	    printf("\tin/out packet skew: %d/%d\n",
+ 		   tpeer.inPacketSkew, tpeer.outPacketSkew);
+ 	    printf("\tcongestion window %d, MTU %d\n",
+ 		   tpeer.cwind, tpeer.MTU);
+ 	    printf("\tcurrent/if/max jumbogram size: %d/%d/%d\n",
+ 		   tpeer.nDgramPackets, tpeer.ifDgramPackets,
+ 		   tpeer.maxDgramPackets);
  	}
      }
      exit(0);
***************
*** 542,547 ****
--- 553,559 ----
      cmd_AddParm(ts,"-version",CMD_FLAG,CMD_OPTIONAL,"show AFS version id");
      cmd_AddParm(ts,"-noconns",CMD_FLAG,CMD_OPTIONAL,"show no connections");
      cmd_AddParm(ts,"-peers",CMD_FLAG,CMD_OPTIONAL,"show peers");
+     cmd_AddParm(ts,"-long",CMD_FLAG,CMD_OPTIONAL,"detailed output");
  
      cmd_Dispatch(argc, argv);
      exit(0);
Index: openafs/src/rxgen/rpc_main.c
diff -c openafs/src/rxgen/rpc_main.c:1.12.2.2 openafs/src/rxgen/rpc_main.c:1.12.2.3
*** openafs/src/rxgen/rpc_main.c:1.12.2.2	Wed Sep 19 18:36:28 2001
--- openafs/src/rxgen/rpc_main.c	Sat Oct 13 00:21:56 2001
***************
*** 36,42 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxgen/rpc_main.c,v 1.12.2.2 2001/09/19 22:36:28 shadow Exp $");
  
  #include <limits.h>
  #include <stdio.h>
--- 36,42 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxgen/rpc_main.c,v 1.12.2.3 2001/10/13 04:21:56 shadow Exp $");
  
  #include <limits.h>
  #include <stdio.h>
Index: openafs/src/rxgen/rpc_parse.c
diff -c openafs/src/rxgen/rpc_parse.c:1.10.2.1 openafs/src/rxgen/rpc_parse.c:1.10.2.2
*** openafs/src/rxgen/rpc_parse.c:1.10.2.1	Wed Sep 19 18:36:28 2001
--- openafs/src/rxgen/rpc_parse.c	Sat Oct 13 00:21:56 2001
***************
*** 35,41 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxgen/rpc_parse.c,v 1.10.2.1 2001/09/19 22:36:28 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
--- 35,41 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxgen/rpc_parse.c,v 1.10.2.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
Index: openafs/src/rxkad/rxkad.p.h
diff -c openafs/src/rxkad/rxkad.p.h:1.2 openafs/src/rxkad/rxkad.p.h:1.2.8.1
*** openafs/src/rxkad/rxkad.p.h:1.2	Sat Nov  4 05:05:43 2000
--- openafs/src/rxkad/rxkad.p.h	Wed Nov 14 22:38:52 2001
***************
*** 21,26 ****
--- 21,32 ----
  #define MAXKTCREALMLEN	      64	/* should be 256 */
  #define KTC_TIME_UNCERTAINTY (15*60)	/* max skew bet. machines' clocks */
  
+ #define MAXRANDOMNAMELEN 16		/* length of random generated 
+ 					   usernames used by afslog for high 
+ 					   security must be < MAXKTCNAMELEN */
+ #define LOGON_OPTION_INTEGRATED 1
+ #define LOGON_OPTION_HIGHSECURITY 2
+ 
  /*
   * Define ticket types. For Kerberos V4 tickets, this is overloaded as
   * the server key version number, so class numbers 0 through 255 are reserved
***************
*** 46,51 ****
--- 52,60 ----
      char name[MAXKTCNAMELEN];
      char instance[MAXKTCNAMELEN];
      char cell[MAXKTCREALMLEN];
+ #ifdef AFS_NT40_ENV
+     char smbname[MAXRANDOMNAMELEN];
+ #endif
  };
  
  #ifndef NEVERDATE
Index: openafs/src/rxkad/rxkad_client.c
diff -c openafs/src/rxkad/rxkad_client.c:1.7 openafs/src/rxkad/rxkad_client.c:1.7.2.1
*** openafs/src/rxkad/rxkad_client.c:1.7	Tue Aug  7 20:04:05 2001
--- openafs/src/rxkad/rxkad_client.c	Sat Oct 13 00:21:56 2001
***************
*** 18,24 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_client.c,v 1.7 2001/08/08 00:04:05 shadow Exp $");
  
  #ifdef KERNEL
  #include "../afs/stds.h"
--- 18,24 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_client.c,v 1.7.2.1 2001/10/13 04:21:56 shadow Exp $");
  
  #ifdef KERNEL
  #include "../afs/stds.h"
***************
*** 41,46 ****
--- 41,53 ----
  #include <afs/stds.h>
  #include <sys/types.h>
  #include <time.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
  #else
***************
*** 119,125 ****
  	clock_GetTime(&tgen.time);	/* changes time1 and time2 */
  	tgen.time.sec = htonl(tgen.time.sec);
  	tgen.time.usec = htonl(tgen.time.usec);
! 	tgen.counter = htonl(counter++);
  #ifdef KERNEL
  	tgen.random1 = afs_random() & 0x7fffffff;	/* was "80000" */
  	tgen.random2 = afs_random() & 0x7fffffff;	/* was "htonl(100)" */
--- 126,133 ----
  	clock_GetTime(&tgen.time);	/* changes time1 and time2 */
  	tgen.time.sec = htonl(tgen.time.sec);
  	tgen.time.usec = htonl(tgen.time.usec);
! 	tgen.counter = htonl(counter);
! 	counter++;
  #ifdef KERNEL
  	tgen.random1 = afs_random() & 0x7fffffff;	/* was "80000" */
  	tgen.random2 = afs_random() & 0x7fffffff;	/* was "htonl(100)" */
Index: openafs/src/rxkad/rxkad_common.c
diff -c openafs/src/rxkad/rxkad_common.c:1.8 openafs/src/rxkad/rxkad_common.c:1.8.2.1
*** openafs/src/rxkad/rxkad_common.c:1.8	Thu Aug 23 13:26:46 2001
--- openafs/src/rxkad/rxkad_common.c	Sat Oct 13 00:21:56 2001
***************
*** 16,22 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_common.c,v 1.8 2001/08/23 17:26:46 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 16,22 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_common.c,v 1.8.2.1 2001/10/13 04:21:56 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 51,56 ****
--- 51,63 ----
  #endif
  #include <rx/rx.h>
  #include <rx/xdr.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  
  #endif /* KERNEL */
  
Index: openafs/src/rxkad/rxkad_server.c
diff -c openafs/src/rxkad/rxkad_server.c:1.7.2.1 openafs/src/rxkad/rxkad_server.c:1.7.2.2
*** openafs/src/rxkad/rxkad_server.c:1.7.2.1	Wed Sep 19 18:36:29 2001
--- openafs/src/rxkad/rxkad_server.c	Sat Oct 13 00:21:56 2001
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_server.c,v 1.7.2.1 2001/09/19 22:36:29 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 14,20 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_server.c,v 1.7.2.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 23,28 ****
--- 23,35 ----
  #include <winsock2.h>
  #else
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <rx/rx.h>
  #include <rx/xdr.h>
Index: openafs/src/rxkad/ticket.c
diff -c openafs/src/rxkad/ticket.c:1.6 openafs/src/rxkad/ticket.c:1.6.2.1
*** openafs/src/rxkad/ticket.c:1.6	Tue Aug  7 20:04:05 2001
--- openafs/src/rxkad/ticket.c	Sat Oct 13 00:21:56 2001
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/ticket.c,v 1.6 2001/08/08 00:04:05 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/ticket.c,v 1.6.2.1 2001/10/13 04:21:56 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
***************
*** 32,37 ****
--- 32,44 ----
  #include <winsock2.h>
  #else
  #include <netinet/in.h>
+ #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
  #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
Index: openafs/src/rxkad/test/stress.c
diff -c openafs/src/rxkad/test/stress.c:1.5.2.1 openafs/src/rxkad/test/stress.c:1.5.2.2
*** openafs/src/rxkad/test/stress.c:1.5.2.1	Wed Sep 19 18:40:40 2001
--- openafs/src/rxkad/test/stress.c	Sat Oct 13 00:21:56 2001
***************
*** 12,18 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/test/stress.c,v 1.5.2.1 2001/09/19 22:40:40 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 12,18 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/test/stress.c,v 1.5.2.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/sys/pioctl_nt.c
diff -c openafs/src/sys/pioctl_nt.c:1.6.4.1 openafs/src/sys/pioctl_nt.c:1.6.4.2
*** openafs/src/sys/pioctl_nt.c:1.6.4.1	Wed Sep 19 18:36:30 2001
--- openafs/src/sys/pioctl_nt.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/pioctl_nt.c,v 1.6.4.1 2001/09/19 22:36:30 shadow Exp $");
  
  #include <afs/stds.h>
  #include <windows.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/pioctl_nt.c,v 1.6.4.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <afs/stds.h>
  #include <windows.h>
Index: openafs/src/sys/rmtsysnet.c
diff -c openafs/src/sys/rmtsysnet.c:1.4 openafs/src/sys/rmtsysnet.c:1.4.4.1
*** openafs/src/sys/rmtsysnet.c:1.4	Thu Jul 12 15:59:17 2001
--- openafs/src/sys/rmtsysnet.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/rmtsysnet.c,v 1.4 2001/07/12 19:59:17 shadow Exp $");
  
  #include <errno.h>
  #include <sys/param.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/rmtsysnet.c,v 1.4.4.1 2001/10/13 04:21:56 shadow Exp $");
  
  #include <errno.h>
  #include <sys/param.h>
***************
*** 25,30 ****
--- 25,37 ----
  #endif
  #include <sys/stat.h>
  #include <stdio.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <afs/afsint.h>
  #include <afs/venus.h>
  #include <rx/xdr.h>
Index: openafs/src/tbutc/Makefile.in
diff -c openafs/src/tbutc/Makefile.in:1.5 openafs/src/tbutc/Makefile.in:1.5.2.1
*** openafs/src/tbutc/Makefile.in:1.5	Mon Sep 10 16:21:12 2001
--- openafs/src/tbutc/Makefile.in	Sat Oct 13 00:21:56 2001
***************
*** 5,12 ****
  # License.  For details, see the LICENSE file in the top-level source
  # directory or online at http://www.openafs.org/dl/license10.html
  
- # */
- 
  DEST=@DEST@
  TOP_INCDIR=@TOP_INCDIR@
  TOP_LIBDIR=@TOP_LIBDIR@
--- 5,10 ----
***************
*** 29,78 ****
  SHELL    =/bin/sh
  
  include ../config/Makefile.${SYS_NAME}
  
! CC      =${MT_CC}
! CFLAGS  = ${DBG} -w -I${TOP_SRCDIR}/config ${MT_CFLAGS}
  
  LDFLAGS = ${DBG} ${XLDFLAGS}
  
- VICED   =../viced
- VLSERVER=../vlserver
  LWP     =../lwp
- LIBACL  =../libacl
- UTIL    =../util
- DIR     =../dir
- VOL     =../vol
- FSINT   =../fsint
  BUTM    =../butm
  BUTC    =../butc
  BUCOORD = ../bucoord
  VOLSER  = ../volser
  
- # ----------------------------------------------------------------
- # The default is to build butc without using the TSM API libraries. 
- # To build with TSM support, set XBSA_NOBUILD="". Be sure you have
- #  the TSM API version 3.7.1 installed.
- # ----------------------------------------------------------------
- XBSA_NOBUILD="true"
- 
  BUCOORDOBJS=ubik_db_if.o ${BUCOORD}/volstub.o ${BUCOORD}/dlq.o \
  	    ${BUCOORD}/status.o ${BUCOORD}/bucoord_errs.o
  
  VOLSERLIBOBJ=${VOLSER}/volint.cs.o  vsprocs.o              ${VOLSER}/vsutils.o \
              ${VOLSER}/lockprocs.o  ${VOLSER}/volint.xdr.o ${VOLSER}/volerr.o \
              ${VOLSER}/volint.ss.o  AFS_component_version_number.o 
! VOLSERLIBS=libvolser.a
  
! LWPOBJS    =lock.o
  
- BUTMOBJS   =file_tm.o
- BUTMLIBS   =libbutm.a
- BUTMINCLS=${TOP_INCDIR}/afs/com_err.h ${TOP_INCDIR}/afs/butm.h
- BUTMINCLUDE=-I${TOP_INCDIR}
- 
  BUTCOBJS   =dbentries.o tcprocs.o lwps.o tcmain.o list.o recoverDb.o \
  	    tcudbprocs.o dump.o tcstatus.o butc_xbsa.o \
              ${LWPOBJS} ${BUCOORDOBJS}
  BUTCINCLS=${TOP_INCDIR}/afs/partition.h \
  	    ${TOP_INCDIR}/afs/volume.h \
  	    ${TOP_INCDIR}/afs/vlserver.h \
--- 27,63 ----
  SHELL    =/bin/sh
  
  include ../config/Makefile.${SYS_NAME}
+ 
+ BUTMOBJS    =file_tm.o
+ BUTMLIBS    =libbutm.a
+ BUTMINCLS   =${TOP_INCDIR}/afs/com_err.h ${TOP_INCDIR}/afs/butm.h
+ BUTMINCLUDE =-I${TOP_INCDIR}
  
! CC      = ${MT_CC}
! CFLAGS  = ${DBG} -w -I${TOP_SRCDIR}/config ${MT_CFLAGS} @XBSA_CFLAGS@ ${BUTMINCLUDE}
  
  LDFLAGS = ${DBG} ${XLDFLAGS}
  
  LWP     =../lwp
  BUTM    =../butm
  BUTC    =../butc
  BUCOORD = ../bucoord
  VOLSER  = ../volser
  
  BUCOORDOBJS=ubik_db_if.o ${BUCOORD}/volstub.o ${BUCOORD}/dlq.o \
  	    ${BUCOORD}/status.o ${BUCOORD}/bucoord_errs.o
  
  VOLSERLIBOBJ=${VOLSER}/volint.cs.o  vsprocs.o              ${VOLSER}/vsutils.o \
              ${VOLSER}/lockprocs.o  ${VOLSER}/volint.xdr.o ${VOLSER}/volerr.o \
              ${VOLSER}/volint.ss.o  AFS_component_version_number.o 
! VOLSERLIBS  =libvolser.a
  
! LWPOBJS     =lock.o
  
  BUTCOBJS   =dbentries.o tcprocs.o lwps.o tcmain.o list.o recoverDb.o \
  	    tcudbprocs.o dump.o tcstatus.o butc_xbsa.o \
              ${LWPOBJS} ${BUCOORDOBJS}
+ 
  BUTCINCLS=${TOP_INCDIR}/afs/partition.h \
  	    ${TOP_INCDIR}/afs/volume.h \
  	    ${TOP_INCDIR}/afs/vlserver.h \
***************
*** 86,91 ****
--- 71,77 ----
  	    ${TOP_INCDIR}/afs/tcdata.h \
  	    ${TOP_INCDIR}/afs/bubasics.h \
  	    ${TOP_INCDIR}/afs/butm.h
+ 
  BUTCINCLUDE=-I. -I${TOP_INCDIR}
  BUTCLIBS=${TOP_LIBDIR}/libbudb.a \
  	    ${TOP_LIBDIR}/libbubasics.a \
***************
*** 100,319 ****
  	    ${TOP_LIBDIR}/libprocmgmt.a \
  	    ${TOP_LIBDIR}/librx.a
  
! include ../config/Makefile.version
  
! #----------------------------------------------- BUTC
  
! butc: pre ${BUTCOBJS} ${BUTCLIBS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCOBJS} ${BUTCLIBS} $$hdrdir ${MTLIBS} ${XLIBS} -o butc
  
  dbentries.o: ${BUTC}/dbentries.c ${BUTCINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/dbentries.c
  
  tcprocs.o: ${BUTC}/tcprocs.c ${BUTCINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/tcprocs.c
  
  lwps.o: ${BUTC}/lwps.c ${BUTCINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/lwps.c
  
  tcmain.o: ${BUTC}/tcmain.c ${BUTCINCLS} AFS_component_version_number.c
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/tcmain.c
  
  list.o: ${BUTC}/list.c ${BUTCINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/list.c
  
  recoverDb.o: ${BUTC}/recoverDb.c ${BUTCINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/recoverDb.c
  
  tcudbprocs.o: ${BUTC}/tcudbprocs.c ${BUTCINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/tcudbprocs.c
  
  dump.o: ${BUTC}/dump.c ${BUTCINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/dump.c
  
  tcstatus.o: ${BUTC}/tcstatus.c ${BUTCINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/tcstatus.c
  
  butc_xbsa.o: ${BUTC}/butc_xbsa.c ${BUTC}/butc_xbsa.h ${BUTCINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUTC}/butc_xbsa.c
  
- #----------------------------------------------- BUCOORD
- 
  ubik_db_if.o: ${BUCOORD}/ubik_db_if.c
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${BUCOORD}/ubik_db_if.c
! 
! #----------------------------------------------- VOLSER
! # Build the libvolser.a library here. The file compiled
! # for is is vsprocs.c. The rest are from the VOLSER dir.
! 
! libvolser.a: vsprocs.o ${VOLSERLIBOBJ}
! 	-$(RM) -f $@
! 	$(AR) crv $@ vsprocs.o ${VOLSERLIBOBJ}
! 	$(RANLIB) $@
  
  vsprocs.o: ${VOLSER}/vsprocs.c
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${VOLSER}/vsprocs.c
! 
! #----------------------------------------------- LWP
  
  lock.o: ${LWP}/lock.c
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTCINCLUDE} $$hdrdir -c ${LWP}/lock.c
  
- #----------------------------------------------- BUTC
- 
  file_tm.o: ${BUTM}/file_tm.c ${BUTMINCLS}
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir=-I"${XBSADIR}" ; \
! 	else                               hdrdir=-I"${XBSA_HDRDIR}" ; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then hdrdir="" ; fi; \
! 	${CC} ${CFLAGS} $$xbsaflags ${BUTMINCLUDE} $$hdrdir -c ${BUTM}/file_tm.c
! 
! libbutm.a: ${BUTMOBJS} AFS_component_version_number.o
! 	-$(RM) -f libbutm.a
! 	$(AR) crv libbutm.a $(BUTMOBJS) AFS_component_version_number.o
! 	${RANLIB} libbutm.a
! 
! #-----------------------------------------------
! clean:
! 	$(RM) -f *.o *.a core AFS_component_version_number.c butc
! 
! pre:
! 	if [ "${XBSA_NOBUILD}" = "" ]; then xbsaflags="${XBSA_FLAGS}" ; \
! 	else                                xbsaflags=""; \
! 	fi; \
! 	if [ "$$xbsaflags" = "" ]; then \
! 		echo 'Will not build with XBSA'; \
! 	else \
! 		if [ "${XBSA_HDRDIR}" = "" ]; then hdrdir="${XBSADIR}" ; \
! 		else                               hdrdir="${XBSA_HDRDIR}" ; \
! 		fi; \
! 		if test "$$hdrdir" != "" -a ! -f "$$hdrdir/xbsa.h"; then \
! 			echo '*** This build of butc cannot support XBSA because'; \
! 			echo '*** the required header file "'$$hdrdir'/xbsa.h"'; \
! 			echo '*** does not exist. If you know the pathname to the'; \
! 			echo '*** header file, then use XBSA_HDRDIR="<path>" as a make'; \
! 			echo '*** argument.'; \
! 			echo '*** If you do not want to build an XBSA version of butc,'; \
! 			echo '*** then use XBSA_NOBUILD="true" as a make argument.'; \
! 			exit 2; \
! 		else \
! 			echo 'Will use XBSA header files from "'$$hdrdir'" (XBSA_HDRDIR)'; \
! 		fi; \
! 	fi
  
! all: butc
! 
! install install.noversion:  ${DESTDIR}${sbindir}/butc
  
- noversion: install
- system: install
  ${DEST}/etc/butc: butc
  	${INSTALL} $? $@
  
  ${DESTDIR}${sbindir}/butc: butc
  	${INSTALL} $? $@
  
  
! dest:  ${DEST}/etc/butc
  
--- 86,169 ----
  	    ${TOP_LIBDIR}/libprocmgmt.a \
  	    ${TOP_LIBDIR}/librx.a
  
! #
! # Build targets
! #
! 
! all: butc
! 
! butc: ${BUTCOBJS} ${BUTCLIBS}
! 	${CC} ${CFLAGS} ${BUTCOBJS} ${BUTCLIBS} ${MTLIBS} ${XLIBS} -o butc
  
! libvolser.a: vsprocs.o ${VOLSERLIBOBJ}
! 	-$(RM) -f $@
! 	$(AR) crv $@ vsprocs.o ${VOLSERLIBOBJ}
! 	$(RANLIB) $@
  
! libbutm.a: ${BUTMOBJS} AFS_component_version_number.o
! 	-$(RM) -f libbutm.a
! 	$(AR) crv libbutm.a $(BUTMOBJS) AFS_component_version_number.o
! 	${RANLIB} libbutm.a
  
  dbentries.o: ${BUTC}/dbentries.c ${BUTCINCLS}
! 	${CC} ${CFLAGS} -c ${BUTC}/dbentries.c
  
  tcprocs.o: ${BUTC}/tcprocs.c ${BUTCINCLS}
! 	${CC} ${CFLAGS} -c ${BUTC}/tcprocs.c
  
  lwps.o: ${BUTC}/lwps.c ${BUTCINCLS}
! 	${CC} ${CFLAGS} -c ${BUTC}/lwps.c
  
  tcmain.o: ${BUTC}/tcmain.c ${BUTCINCLS} AFS_component_version_number.c
! 	${CC} ${CFLAGS} -c ${BUTC}/tcmain.c
  
  list.o: ${BUTC}/list.c ${BUTCINCLS}
! 	${CC} ${CFLAGS} -c ${BUTC}/list.c
  
  recoverDb.o: ${BUTC}/recoverDb.c ${BUTCINCLS}
! 	${CC} ${CFLAGS} -c ${BUTC}/recoverDb.c
  
  tcudbprocs.o: ${BUTC}/tcudbprocs.c ${BUTCINCLS}
! 	${CC} ${CFLAGS} -c ${BUTC}/tcudbprocs.c
  
  dump.o: ${BUTC}/dump.c ${BUTCINCLS}
! 	${CC} ${CFLAGS} -c ${BUTC}/dump.c
  
  tcstatus.o: ${BUTC}/tcstatus.c ${BUTCINCLS}
! 	${CC} ${CFLAGS} -c ${BUTC}/tcstatus.c
  
  butc_xbsa.o: ${BUTC}/butc_xbsa.c ${BUTC}/butc_xbsa.h ${BUTCINCLS}
! 	${CC} ${CFLAGS} -c ${BUTC}/butc_xbsa.c
  
  ubik_db_if.o: ${BUCOORD}/ubik_db_if.c
! 	${CC} ${CFLAGS} -c ${BUCOORD}/ubik_db_if.c
  
  vsprocs.o: ${VOLSER}/vsprocs.c
! 	${CC} ${CFLAGS} -c ${VOLSER}/vsprocs.c
  
  lock.o: ${LWP}/lock.c
! 	${CC} ${CFLAGS} -c ${LWP}/lock.c
  
  file_tm.o: ${BUTM}/file_tm.c ${BUTMINCLS}
! 	${CC} ${CFLAGS} -c ${BUTM}/file_tm.c
  
! #
! # Install targets
! #
! install: ${DESTDIR}${sbindir}/butc
! dest: ${DEST}/etc/butc
  
  ${DEST}/etc/butc: butc
  	${INSTALL} $? $@
  
  ${DESTDIR}${sbindir}/butc: butc
  	${INSTALL} $? $@
  
+ #
+ # Misc targets
+ #
+ include ../config/Makefile.version
  
! clean:
! 	$(RM) -f *.o *.a core AFS_component_version_number.c butc
  
Index: openafs/src/tbutc/NTMakefile
diff -c openafs/src/tbutc/NTMakefile:1.6.2.1 openafs/src/tbutc/NTMakefile:1.6.2.2
*** openafs/src/tbutc/NTMakefile:1.6.2.1	Wed Sep 19 18:32:54 2001
--- openafs/src/tbutc/NTMakefile	Wed Nov 14 22:30:30 2001
***************
*** 73,79 ****
  !ELSE
  	$(DESTDIR)\lib\pthread.lib \
  !ENDIF
! 	     $(DESTDIR)\lib\afsdes.lib
  
  
  #	$(DESTDIR)\lib\afsauthent.lib \
--- 73,80 ----
  !ELSE
  	$(DESTDIR)\lib\pthread.lib \
  !ENDIF
! 	     $(DESTDIR)\lib\afsdes.lib \
! 	     $(DESTDIR)\lib\cm_dns.obj
  
  
  #	$(DESTDIR)\lib\afsauthent.lib \
Index: openafs/src/ubik/beacon.c
diff -c openafs/src/ubik/beacon.c:1.9.2.1 openafs/src/ubik/beacon.c:1.9.2.2
*** openafs/src/ubik/beacon.c:1.9.2.1	Wed Sep 19 18:36:30 2001
--- openafs/src/ubik/beacon.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/beacon.c,v 1.9.2.1 2001/09/19 22:36:30 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/beacon.c,v 1.9.2.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 25,30 ****
--- 25,37 ----
  #endif
  #include <errno.h>
  #include <lock.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
  #include <rx/rx_multi.h>
***************
*** 50,55 ****
--- 57,63 ----
  char *ubik_CRXSecurityRock;
  afs_int32 ubikSecIndex;
  struct rx_securityClass     *ubikSecClass;
+ static verifyInterfaceAddress();
  
  
  /* Module responsible for both deciding if we're currently the sync site,
***************
*** 170,176 ****
      struct ubik_server *magicServer;
  
      /* verify that the addresses passed in are correct */
!     if (code = verifyInterfaceAddress(&ame, info, aservers))
  	return code;
  
      /* get the security index to use, if we can */
--- 178,184 ----
      struct ubik_server *magicServer;
  
      /* verify that the addresses passed in are correct */
!     if ((code = verifyInterfaceAddress(&ame, info, aservers)))
  	return code;
  
      /* get the security index to use, if we can */
***************
*** 229,235 ****
  	}
      } else {
          i = 0;
!         while (servAddr = *aservers++) {
  	    if (i >= MAXSERVERS) return UNHOSTS;	    /* too many hosts */
  	    ts = (struct ubik_server *) malloc(sizeof(struct ubik_server));
  	    memset(ts, 0, sizeof(struct ubik_server));
--- 237,243 ----
  	}
      } else {
          i = 0;
!         while ((servAddr = *aservers++)) {
  	    if (i >= MAXSERVERS) return UNHOSTS;	    /* too many hosts */
  	    ts = (struct ubik_server *) malloc(sizeof(struct ubik_server));
  	    memset(ts, 0, sizeof(struct ubik_server));
Index: openafs/src/ubik/disk.c
diff -c openafs/src/ubik/disk.c:1.5.2.1 openafs/src/ubik/disk.c:1.5.2.2
*** openafs/src/ubik/disk.c:1.5.2.1	Wed Sep 19 18:36:31 2001
--- openafs/src/ubik/disk.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/disk.c,v 1.5.2.1 2001/09/19 22:36:31 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/disk.c,v 1.5.2.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 20,25 ****
--- 20,32 ----
  #include <netinet/in.h>
  #endif
  #include <errno.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <lock.h>
  #include <rx/xdr.h>
  
Index: openafs/src/ubik/lock.c
diff -c openafs/src/ubik/lock.c:1.5.4.1 openafs/src/ubik/lock.c:1.5.4.2
*** openafs/src/ubik/lock.c:1.5.4.1	Wed Sep 19 18:36:31 2001
--- openafs/src/ubik/lock.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/lock.c,v 1.5.4.1 2001/09/19 22:36:31 shadow Exp $");
  
  #include <sys/types.h>
  #ifndef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/lock.c,v 1.5.4.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifndef AFS_NT40_ENV
Index: openafs/src/ubik/phys.c
diff -c openafs/src/ubik/phys.c:1.4 openafs/src/ubik/phys.c:1.4.4.1
*** openafs/src/ubik/phys.c:1.4	Thu Jul 12 15:59:18 2001
--- openafs/src/ubik/phys.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/phys.c,v 1.4 2001/07/12 19:59:18 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/phys.c,v 1.4.4.1 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 25,30 ****
--- 25,37 ----
  #include <lwp.h>
  #include <lock.h>
  #include <errno.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  
  #define	UBIK_INTERNALS 1
  #include "ubik.h"
Index: openafs/src/ubik/recovery.c
diff -c openafs/src/ubik/recovery.c:1.7 openafs/src/ubik/recovery.c:1.7.2.1
*** openafs/src/ubik/recovery.c:1.7	Tue Aug  7 20:04:12 2001
--- openafs/src/ubik/recovery.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/recovery.c,v 1.7 2001/08/08 00:04:12 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/recovery.c,v 1.7.2.1 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 23,28 ****
--- 23,35 ----
  #endif
  #include <assert.h>
  #include <lock.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
  #include <errno.h>
***************
*** 365,371 ****
   */
  urecovery_Interact() {
      afs_int32 code, tcode;
!     struct ubik_server *bestServer;
      struct ubik_server *ts;
      int dbok, doingRPC, now;
      afs_int32 lastProbeTime, lastDBVCheck;
--- 372,378 ----
   */
  urecovery_Interact() {
      afs_int32 code, tcode;
!     struct ubik_server *bestServer = NULL;
      struct ubik_server *ts;
      int dbok, doingRPC, now;
      afs_int32 lastProbeTime, lastDBVCheck;
Index: openafs/src/ubik/remote.c
diff -c openafs/src/ubik/remote.c:1.6.2.1 openafs/src/ubik/remote.c:1.6.2.2
*** openafs/src/ubik/remote.c:1.6.2.1	Wed Sep 19 18:36:31 2001
--- openafs/src/ubik/remote.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/remote.c,v 1.6.2.1 2001/09/19 22:36:31 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/remote.c,v 1.6.2.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 19,24 ****
--- 19,31 ----
  #include <sys/file.h>
  #include <netinet/in.h>
  #endif
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <lock.h>
  #include <rx/xdr.h>
  #include <rx/rx.h>
***************
*** 58,64 ****
  {
      register afs_int32 code;
  
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
      DBHOLD(ubik_dbase);
--- 65,71 ----
  {
      register afs_int32 code;
  
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
      DBHOLD(ubik_dbase);
***************
*** 87,93 ****
      register afs_int32 code;
      register struct ubik_dbase *dbase;
      
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
  
--- 94,100 ----
      register afs_int32 code;
      register struct ubik_dbase *dbase;
      
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
  
***************
*** 125,131 ****
      register struct ubik_dbase *dbase;
      register afs_int32 code;
  
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
  
--- 132,138 ----
      register struct ubik_dbase *dbase;
      register afs_int32 code;
  
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
  
***************
*** 161,167 ****
      register afs_int32 code;
      register struct ubik_dbase *dbase;
      
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
  
--- 168,174 ----
      register afs_int32 code;
      register struct ubik_dbase *dbase;
      
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
  
***************
*** 200,206 ****
      register struct ubik_dbase *dbase;
      struct ubik_trans *ubik_thisTrans;
  
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
      if (!ubik_currentTrans) {
--- 207,213 ----
      register struct ubik_dbase *dbase;
      struct ubik_trans *ubik_thisTrans;
  
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
      if (!ubik_currentTrans) {
***************
*** 249,255 ****
      struct ubik_iovec *iovec;
      char              *iobuf;
  
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
      if (!ubik_currentTrans) {
--- 256,262 ----
      struct ubik_iovec *iovec;
      char              *iobuf;
  
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
      if (!ubik_currentTrans) {
***************
*** 296,302 ****
      register afs_int32 code;
      register struct ubik_dbase *dbase;
  
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
      if (!ubik_currentTrans) {
--- 303,309 ----
      register afs_int32 code;
      register struct ubik_dbase *dbase;
  
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
      if (!ubik_currentTrans) {
***************
*** 328,334 ****
      register afs_int32 code;
      register struct ubik_dbase *dbase;
  
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
      if (!ubik_currentTrans) { 
--- 335,341 ----
      register afs_int32 code;
      register struct ubik_dbase *dbase;
  
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
      if (!ubik_currentTrans) { 
***************
*** 357,363 ****
  {
      register afs_int32 code;
  
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
  
--- 364,370 ----
  {
      register afs_int32 code;
  
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
  
***************
*** 401,407 ****
      afs_int32 tlen;
      afs_int32 length;
      
!     if (code = ubik_CheckAuth(rxcall)) {
        return code;
      }
  /* temporarily disabled because it causes problems for migration tool.  Hey, it's just
--- 408,414 ----
      afs_int32 tlen;
      afs_int32 length;
      
!     if ((code = ubik_CheckAuth(rxcall))) {
        return code;
      }
  /* temporarily disabled because it causes problems for migration tool.  Hey, it's just
***************
*** 463,469 ****
  
      /* send the file back to the requester */
      
!     if (code = ubik_CheckAuth(rxcall)) {
        goto failed;
      }
  
--- 470,476 ----
  
      /* send the file back to the requester */
      
!     if ((code = ubik_CheckAuth(rxcall))) {
        goto failed;
      }
  
***************
*** 640,646 ****
    afs_int32               code=0;
    struct ubik_dbase   *dbase;
  
!   if (code = ubik_CheckAuth(rxcall)) {
       return(code);
    }
  
--- 647,653 ----
    afs_int32               code=0;
    struct ubik_dbase   *dbase;
  
!   if ((code = ubik_CheckAuth(rxcall))) {
       return(code);
    }
  
Index: openafs/src/ubik/ubik.c
diff -c openafs/src/ubik/ubik.c:1.7.2.1 openafs/src/ubik/ubik.c:1.7.2.2
*** openafs/src/ubik/ubik.c:1.7.2.1	Wed Sep 19 18:40:42 2001
--- openafs/src/ubik/ubik.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/ubik.c,v 1.7.2.1 2001/09/19 22:40:42 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/ubik.c,v 1.7.2.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 22,27 ****
--- 22,34 ----
  #endif
  #include <time.h>
  #include <lock.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
  #include <afs/cellconfig.h>
Index: openafs/src/ubik/ubikclient.c
diff -c openafs/src/ubik/ubikclient.c:1.5.4.1 openafs/src/ubik/ubikclient.c:1.5.4.2
*** openafs/src/ubik/ubikclient.c:1.5.4.1	Wed Sep 19 18:40:42 2001
--- openafs/src/ubik/ubikclient.c	Sat Oct 13 00:21:56 2001
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/ubikclient.c,v 1.5.4.1 2001/09/19 22:40:42 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/ubikclient.c,v 1.5.4.2 2001/10/13 04:21:56 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
Index: openafs/src/ubik/ubikcmd.c
diff -c openafs/src/ubik/ubikcmd.c:1.5 openafs/src/ubik/ubikcmd.c:1.5.2.1
*** openafs/src/ubik/ubikcmd.c:1.5	Tue Aug  7 20:04:12 2001
--- openafs/src/ubik/ubikcmd.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/ubikcmd.c,v 1.5 2001/08/08 00:04:12 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/ubikcmd.c,v 1.5.2.1 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 23,28 ****
--- 23,35 ----
  #endif
  #include <time.h>
  #include <lock.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
  
Index: openafs/src/ubik/utst_client.c
diff -c openafs/src/ubik/utst_client.c:1.4 openafs/src/ubik/utst_client.c:1.4.4.1
*** openafs/src/ubik/utst_client.c:1.4	Thu Jul 12 15:59:18 2001
--- openafs/src/ubik/utst_client.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/utst_client.c,v 1.4 2001/07/12 19:59:18 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/utst_client.c,v 1.4.4.1 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 23,28 ****
--- 23,35 ----
  #endif
  #include <time.h>
  #include <stdio.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
  #include <lock.h>
Index: openafs/src/ubik/utst_server.c
diff -c openafs/src/ubik/utst_server.c:1.4 openafs/src/ubik/utst_server.c:1.4.4.1
*** openafs/src/ubik/utst_server.c:1.4	Thu Jul 12 15:59:18 2001
--- openafs/src/ubik/utst_server.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/utst_server.c,v 1.4 2001/07/12 19:59:18 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/utst_server.c,v 1.4.4.1 2001/10/13 04:21:56 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 24,29 ****
--- 24,36 ----
  #endif
  #include <time.h>
  #include <stdio.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
  #include <lock.h>
Index: openafs/src/ubik/vote.c
diff -c openafs/src/ubik/vote.c:1.7.2.2 openafs/src/ubik/vote.c:1.7.2.3
*** openafs/src/ubik/vote.c:1.7.2.2	Wed Sep 19 23:58:52 2001
--- openafs/src/ubik/vote.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/vote.c,v 1.7.2.2 2001/09/20 03:58:52 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/vote.c,v 1.7.2.3 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 21,26 ****
--- 21,33 ----
  #endif
  #include <afs/afsutil.h>
  #include <lock.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
  #include <afs/afsutil.h>
Index: openafs/src/update/NTMakefile
diff -c openafs/src/update/NTMakefile:1.2.8.1 openafs/src/update/NTMakefile:1.2.8.2
*** openafs/src/update/NTMakefile:1.2.8.1	Wed Sep 19 18:32:56 2001
--- openafs/src/update/NTMakefile	Wed Nov 14 22:30:30 2001
***************
*** 21,27 ****
  	$(DESTDIR)\lib\afsubik.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afsrxkad.lib \
! 	$(DESTDIR)\lib\afs\afsprocmgmt.lib
  
  ############################################################################
  # Definitions for generating files via RXGEN
--- 21,28 ----
  	$(DESTDIR)\lib\afsubik.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afsrxkad.lib \
! 	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  
  ############################################################################
  # Definitions for generating files via RXGEN
Index: openafs/src/update/client.c
diff -c openafs/src/update/client.c:1.8 openafs/src/update/client.c:1.8.2.1
*** openafs/src/update/client.c:1.8	Tue Aug  7 20:04:13 2001
--- openafs/src/update/client.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/update/client.c,v 1.8 2001/08/08 00:04:13 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/update/client.c,v 1.8.2.1 2001/10/13 04:21:56 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
***************
*** 314,321 ****
  						  mode, atime, time);
  		    if (errcode == 1) /* this file failed, but keep trying */
  		      goto fail_dirbuf;  
! 		    if (errcode == -1) /* time to quit */
  		      return -1;
  		}
  
  	    }
--- 314,324 ----
  						  mode, atime, time);
  		    if (errcode == 1) /* this file failed, but keep trying */
  		      goto fail_dirbuf;  
! 		    if (errcode == -1) /* time to quit */ {
! 		      fclose(stream);
! 		      unlink(dirbuf);
  		      return -1;
+ 		    }
  		}
  
  	    }
Index: openafs/src/usd/usd_file.c
diff -c openafs/src/usd/usd_file.c:1.7.2.1 openafs/src/usd/usd_file.c:1.7.2.2
*** openafs/src/usd/usd_file.c:1.7.2.1	Wed Sep 19 18:25:32 2001
--- openafs/src/usd/usd_file.c	Sat Oct 13 00:21:56 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/usd/usd_file.c,v 1.7.2.1 2001/09/19 22:25:32 shadow Exp $");
  
  #include <errno.h>
  #include <fcntl.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/usd/usd_file.c,v 1.7.2.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <errno.h>
  #include <fcntl.h>
Index: openafs/src/uss/uss.c
diff -c openafs/src/uss/uss.c:1.4.4.1 openafs/src/uss/uss.c:1.4.4.2
*** openafs/src/uss/uss.c:1.4.4.1	Wed Sep 19 18:40:43 2001
--- openafs/src/uss/uss.c	Sat Oct 13 00:22:07 2001
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss.c,v 1.4.4.1 2001/09/19 22:40:43 shadow Exp $");
  
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss.c,v 1.4.4.2 2001/10/13 04:22:07 shadow Exp $");
  
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
Index: openafs/src/util/Makefile.in
diff -c openafs/src/util/Makefile.in:1.6 openafs/src/util/Makefile.in:1.6.2.1
*** openafs/src/util/Makefile.in:1.6	Fri Sep  7 19:36:06 2001
--- openafs/src/util/Makefile.in	Sat Oct 13 00:22:10 2001
***************
*** 14,19 ****
--- 14,21 ----
  libdir=@libdir@
  includedir=@includedir@
  mandir=@mandir@
+ sysconfdir=@sysconfdir@
+ localstatedir=@localstatedir@
  COMPILE_ET=${TOP_SRCDIR}/comerr/compile_et
  RXGEN=${TOP_SRCDIR}/rxgen/rxgen
  TOP_SRCDIR=@TOP_SRCDIR@
***************
*** 438,445 ****
  	cd test; $(MAKE)
  
  include ../config/Makefile.version
- ${DESTDIR}${bindir}/sys: sys
- 	${INSTALL} $? $@
  
  dest: \
  	${DEST}/include/afs/dirpath.h \
--- 440,445 ----
Index: openafs/src/util/assert.c
diff -c openafs/src/util/assert.c:1.4 openafs/src/util/assert.c:1.4.4.1
*** openafs/src/util/assert.c:1.4	Thu Jul 12 15:59:23 2001
--- openafs/src/util/assert.c	Sat Oct 13 00:22:10 2001
***************
*** 10,17 ****
  /* ReallyAbort:  called from assert. May/85 */
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/assert.c,v 1.4 2001/07/12 19:59:23 shadow Exp $");
  
  #include <stdio.h>
  
--- 10,21 ----
  /* ReallyAbort:  called from assert. May/85 */
  #include <afsconfig.h>
  #include <afs/param.h>
+ #include <stdlib.h>
+ #ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
+ #endif
  
! RCSID("$Header: /data/cvs/openafs/src/util/assert.c,v 1.4.4.1 2001/10/13 04:22:10 shadow Exp $");
  
  #include <stdio.h>
  
***************
*** 25,31 ****
  
  void AssertionFailed(char *file, int line)
  {
!     fprintf(stderr, "Assertion failed! file %s, line %d.\n", file, line);
      fflush(stderr);
  #ifdef AFS_NT40_ENV
      afs_NTAbort();
--- 29,42 ----
  
  void AssertionFailed(char *file, int line)
  {
!     char tdate[26];
!     time_t when;
! 
!     time(&when);
!     strcpy(tdate, ctime(&when));
!     tdate[24] = '0';
!     fprintf(stderr, "%s: Assertion failed! file %s, line %d.\n",
! 	tdate, file, line);
      fflush(stderr);
  #ifdef AFS_NT40_ENV
      afs_NTAbort();
Index: openafs/src/util/casestrcpy.c
diff -c openafs/src/util/casestrcpy.c:1.4 openafs/src/util/casestrcpy.c:1.4.4.1
*** openafs/src/util/casestrcpy.c:1.4	Thu Jul 12 15:59:23 2001
--- openafs/src/util/casestrcpy.c	Sat Oct 13 00:22:10 2001
***************
*** 10,17 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/casestrcpy.c,v 1.4 2001/07/12 19:59:23 shadow Exp $");
  
  #include <ctype.h>
  #include <stddef.h>
  #include <stdarg.h>
--- 10,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/casestrcpy.c,v 1.4.4.1 2001/10/13 04:22:10 shadow Exp $");
  
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <ctype.h>
  #include <stddef.h>
  #include <stdarg.h>
Index: openafs/src/util/dirpath.c
diff -c openafs/src/util/dirpath.c:1.10.2.1 openafs/src/util/dirpath.c:1.10.2.2
*** openafs/src/util/dirpath.c:1.10.2.1	Thu Sep 20 16:12:36 2001
--- openafs/src/util/dirpath.c	Sat Oct 13 00:22:10 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/dirpath.c,v 1.10.2.1 2001/09/20 20:12:36 shadow Exp $");
  
  #include <stddef.h>
  #include <stdlib.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/dirpath.c,v 1.10.2.2 2001/10/13 04:22:10 shadow Exp $");
  
  #include <stddef.h>
  #include <stdlib.h>
Index: openafs/src/util/fileutil.c
diff -c openafs/src/util/fileutil.c:1.5 openafs/src/util/fileutil.c:1.5.4.1
*** openafs/src/util/fileutil.c:1.5	Thu Jul 12 15:59:23 2001
--- openafs/src/util/fileutil.c	Sat Oct 13 00:22:10 2001
***************
*** 12,18 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/fileutil.c,v 1.5 2001/07/12 19:59:23 shadow Exp $");
  
  #include <afs/stds.h>
  #include <stddef.h>
--- 12,18 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/fileutil.c,v 1.5.4.1 2001/10/13 04:22:10 shadow Exp $");
  
  #include <afs/stds.h>
  #include <stddef.h>
***************
*** 24,36 ****
  #include <windows.h>
  #include <io.h>
  #include "errmap_nt.h"
! #else
  #include <unistd.h>
  #endif
  #include <string.h>
  #include <sys/types.h>
  #include <dirent.h>
  #include <sys/stat.h>
  #include "fileutil.h"
  
  
--- 24,47 ----
  #include <windows.h>
  #include <io.h>
  #include "errmap_nt.h"
! #endif
! 
! #ifdef HAVE_UNISTD_H
  #include <unistd.h>
  #endif
+ #ifdef HAVE_STRING_H
  #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <sys/types.h>
  #include <dirent.h>
  #include <sys/stat.h>
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
  #include "fileutil.h"
  
  
Index: openafs/src/util/kreltime.c
diff -c openafs/src/util/kreltime.c:1.5 openafs/src/util/kreltime.c:1.5.2.1
*** openafs/src/util/kreltime.c:1.5	Tue Aug  7 20:04:17 2001
--- openafs/src/util/kreltime.c	Sat Oct 13 00:22:10 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/kreltime.c,v 1.5 2001/08/08 00:04:17 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/kreltime.c,v 1.5.2.1 2001/10/13 04:22:10 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 18,28 ****
  #include "ktime.h"
  #include <time.h>
  #include <ctype.h>
! #if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
  #include <string.h>
  #else
  #include <strings.h>
  #endif
  #include "afsutil.h"
  
  
--- 18,30 ----
  #include "ktime.h"
  #include <time.h>
  #include <ctype.h>
! #ifdef HAVE_STRING_H
  #include <string.h>
  #else
+ #ifdef HAVE_STRINGS_H
  #include <strings.h>
  #endif
+ #endif
  #include "afsutil.h"
  
  
***************
*** 39,48 ****
      char ps_keychar;
      afs_int32 ps_maxValue;
  } parseseq[] = {
!     KTIMEDATE_YEAR, 'y', MAX_YEAR_VALUE,	/* no max. value */
!     KTIMEDATE_MONTH, 'm', MAX_MONTH_VALUE,	/* months max. 12 */
!     KTIMEDATE_DAY, 'd',	MAX_DAY_VALUE,		/* days max. 31 */
!     0, 0, 0,
  };
  
  /* Encodings to and from relative dates. The caller is responsible for
--- 41,50 ----
      char ps_keychar;
      afs_int32 ps_maxValue;
  } parseseq[] = {
!     { KTIMEDATE_YEAR, 'y', MAX_YEAR_VALUE, },		/* no max. value */
!     { KTIMEDATE_MONTH, 'm', MAX_MONTH_VALUE, },		/* months max. 12 */
!     { KTIMEDATE_DAY, 'd',	MAX_DAY_VALUE, },	/* days max. 31 */
!     { 0, 0, 0, }
  };
  
  /* Encodings to and from relative dates. The caller is responsible for
Index: openafs/src/util/ktime.c
diff -c openafs/src/util/ktime.c:1.5 openafs/src/util/ktime.c:1.5.2.1
*** openafs/src/util/ktime.c:1.5	Tue Aug  7 20:04:17 2001
--- openafs/src/util/ktime.c	Sat Oct 13 00:22:10 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/ktime.c,v 1.5 2001/08/08 00:04:17 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/ktime.c,v 1.5.2.1 2001/10/13 04:22:10 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 19,29 ****
  #ifdef AFS_NT40_ENV
  #include <malloc.h>
  #endif
! #if defined(AFS_SUN5_ENV) || defined(AFS_NT40_ENV)
  #include <string.h>
  #else
  #include <strings.h>
  #endif
  #include "afsutil.h"
  
  #include "ktime.h"
--- 19,32 ----
  #ifdef AFS_NT40_ENV
  #include <malloc.h>
  #endif
! #ifdef HAVE_STRING_H
  #include <string.h>
  #else
+ #ifdef HAVE_STRINGS_H
  #include <strings.h>
  #endif
+ #endif
+ #include <stdlib.h>
  #include "afsutil.h"
  
  #include "ktime.h"
***************
*** 50,55 ****
--- 53,59 ----
  };
  
  /* free token list returned by parseLine */
+ #ifdef undef
  static LocalFreeTokens(alist)
      register struct token *alist; {
      register struct token *nlist;
***************
*** 60,65 ****
--- 64,70 ----
      }
      return 0;
  }
+ #endif
  
  static space(x)
  int x; {
***************
*** 71,77 ****
      char *aline;
      struct token **alist; {
      char tbuffer[256];
!     register char *tptr;
      int inToken;
      struct token *first, *last;
      register struct token *ttok;
--- 76,82 ----
      char *aline;
      struct token **alist; {
      char tbuffer[256];
!     register char *tptr = NULL;
      int inToken;
      struct token *first, *last;
      register struct token *ttok;
***************
*** 121,146 ****
      char *key;
      afs_int32 value;
  } ptkeys [] = {
!     "sun", 0x10000,
!     "mon", 0x10001,
!     "tue", 0x10002,
!     "wed", 0x10003,
!     "thu", 0x10004,
!     "fri", 0x10005,
!     "sat", 0x10006,
!     "sunday", 0x10000,
!     "monday", 0x10001,
!     "tuesday", 0x10002,
!     "wednesday", 0x10003,
!     "thursday", 0x10004,
!     "thur", 0x10004,
!     "friday", 0x10005,
!     "saturday", 0x10006,
!     "am", 0x20000,
!     "pm", 0x20001,
!     "a.m.", 0x20000,
!     "p.m.", 0x20001,
!     0, 0,
  };
  
  /* ktime_DateOf
--- 126,151 ----
      char *key;
      afs_int32 value;
  } ptkeys [] = {
!     { "sun", 0x10000, },
!     { "mon", 0x10001, },
!     { "tue", 0x10002, },
!     { "wed", 0x10003, },
!     { "thu", 0x10004, },
!     { "fri", 0x10005, },
!     { "sat", 0x10006, },
!     { "sunday", 0x10000, },
!     { "monday", 0x10001, },
!     { "tuesday", 0x10002, },
!     { "wednesday", 0x10003, },
!     { "thursday", 0x10004, },
!     { "thur", 0x10004, },
!     { "friday", 0x10005, },
!     { "saturday", 0x10006, },
!     { "am", 0x20000, },
!     { "pm", 0x20001, },
!     { "a.m.", 0x20000, },
!     { "p.m.", 0x20001, },
!     { 0, 0, }
  };
  
  /* ktime_DateOf
***************
*** 395,400 ****
--- 400,406 ----
  
  
  /* compare date in both formats, and return as in strcmp */
+ #ifdef undef
  static KTimeCmp(aktime, atm)
  register struct ktime *aktime;
  register struct tm *atm; {
***************
*** 418,423 ****
--- 424,430 ----
      }
      return 0;
  }
+ #endif
  
  /* compare date in both formats, and return as in strcmp */
  static KDateCmp(akdate, atm)
Index: openafs/src/util/uuid.c
diff -c openafs/src/util/uuid.c:1.7 openafs/src/util/uuid.c:1.7.2.1
*** openafs/src/util/uuid.c:1.7	Tue Aug  7 20:04:17 2001
--- openafs/src/util/uuid.c	Sat Oct 13 00:22:10 2001
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/util/uuid.c,v 1.7 2001/08/08 00:04:17 shadow Exp $");
  
  #ifdef KERNEL
  #include "../afs/sysincludes.h"
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/util/uuid.c,v 1.7.2.1 2001/10/13 04:22:10 shadow Exp $");
  
  #ifdef KERNEL
  #include "../afs/sysincludes.h"
***************
*** 37,42 ****
--- 37,53 ----
  #include <sys/time.h>
  #endif /* ITIMER_REAL */
  #include <net/if.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ #include <stdlib.h>
  #endif
  #include <sys/stat.h>
  #include <fcntl.h>
Index: openafs/src/venus/.cvsignore
diff -c openafs/src/venus/.cvsignore:1.1 openafs/src/venus/.cvsignore:1.1.2.1
*** openafs/src/venus/.cvsignore:1.1	Mon Sep 10 16:14:47 2001
--- openafs/src/venus/.cvsignore	Sat Oct 13 00:22:10 2001
***************
*** 3,7 ****
  cmdebug
  fs
  fstrace
! kdump-2.4.7-ac3
  up
--- 3,9 ----
  cmdebug
  fs
  fstrace
! kdump-*
  up
+ kdump
+ kdump64
Index: openafs/src/venus/Makefile.in
diff -c openafs/src/venus/Makefile.in:1.6 openafs/src/venus/Makefile.in:1.6.2.1
*** openafs/src/venus/Makefile.in:1.6	Fri Sep  7 19:36:07 2001
--- openafs/src/venus/Makefile.in	Sat Oct 13 00:22:10 2001
***************
*** 69,75 ****
  
  LIBS = ${FSLIBS} 
  
! all: fs up fstrace cmdebug kdump kdump64
  
  #
  # Build targets
--- 69,75 ----
  
  LIBS = ${FSLIBS} 
  
! all: fs up fstrace cmdebug livesys kdump kdump64
  
  #
  # Build targets
***************
*** 82,87 ****
--- 82,90 ----
  ${DEST}/bin/fs ${DEST}/root.server/usr/afs/bin/fs: fs
  	${INSTALL} -s $? $@
  
+ ${DEST}/bin/livesys: livesys
+ 	${INSTALL} -s $? $@
+ 
  ${DEST}/bin/up: up
  	${INSTALL} -s $? $@
  
***************
*** 106,111 ****
--- 109,115 ----
  		${INSTALLex} -f kdump.sh.solaris7 $@; \
  		${INSTALL} -s -f $? ${DEST}/etc/kdump32;; \
  	*linux* ) \
+ 		${INSTALLex} -f kdump.sh.linux $@; \
  		${INSTALL} -s kdump-${LINUX_VERSION} ${DEST}/etc/kdump-${LINUX_VERSION} ;; \
  	hp_ux11* ) \
  		${INSTALLex} -f kdump.sh.hp_ux11 $@; \
***************
*** 134,139 ****
--- 138,148 ----
  fs: fs.o $(LIBS)
  	${CC} ${CFLAGS} -g -o fs fs.o ${TOP_LIBDIR}/libprot.a $(LIBS) ${XLIBS}
  
+ livesys.o: livesys.c ${INCLS} AFS_component_version_number.c
+ 
+ livesys: livesys.c $(LIBS)
+ 	${CC} -g -o livesys $(CFLAGS) livesys.c $(LIBS) ${XLIBS}
+ 
  twiddle: twiddle.c $(LIBS)
  	${CC} -g -o twiddle $(CFLAGS) twiddle.c $(LIBS) ${XLIBS}
  
***************
*** 262,267 ****
--- 271,277 ----
  #
  install: \
  	${DESTDIR}${bindir}/fs \
+ 	${DESTDIR}${bindir}/livesys \
  	${DESTDIR}${afssrvbindir}/fs \
  	${DESTDIR}${bindir}/up \
  	${DESTDIR}${sbindir}/fstrace \
***************
*** 284,289 ****
--- 294,302 ----
  ${DESTDIR}${bindir}/fs: fs
  	${INSTALL} -s $? $@
  
+ ${DESTDIR}${bindir}/livesys: livesys
+ 	${INSTALL} -s $? $@
+ 
  ${DESTDIR}${afssrvbindir}/fs: fs
  	${INSTALL} -s $? $@
  
***************
*** 330,335 ****
--- 343,349 ----
  
  dest: \
  	${DEST}/bin/fs \
+ 	${DEST}/bin/livesys \
  	${DEST}/root.server/usr/afs/bin/fs \
  	${DEST}/bin/up \
  	${DEST}/etc/fstrace \
Index: openafs/src/venus/kdump.sh.linux
diff -c /dev/null openafs/src/venus/kdump.sh.linux:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:26 2001
--- openafs/src/venus/kdump.sh.linux	Sat Oct 13 00:38:03 2001
***************
*** 0 ****
--- 1,13 ----
+ #!/bin/sh
+ # 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
+ 
+ ## Wrapper script for kdump on Linux.
+ 
+ REL=`uname -r`
+ DASH='-'
+ exec $0${DASH}${REL} ${1+"$@"}
Index: openafs/src/venus/livesys.c
diff -c /dev/null openafs/src/venus/livesys.c:1.1.2.1
*** /dev/null	Wed Nov 21 01:54:26 2001
--- openafs/src/venus/livesys.c	Sat Oct 13 00:38:03 2001
***************
*** 0 ****
--- 1,78 ----
+ /*
+  * 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
+  */
+ 
+ #include <afsconfig.h>
+ #include <afs/param.h>
+ 
+ RCSID("$Header: /data/cvs/openafs/src/venus/livesys.c,v 1.1.2.1 2001/10/13 04:38:03 shadow Exp $");
+ 
+ #include <afs/afs_args.h>
+ #include <rx/xdr.h>
+ #include <sys/ioctl.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
+ #include <errno.h>
+ #include <stdio.h>
+ #include <netinet/in.h>
+ #include <sys/stat.h>
+ #include <afs/stds.h>
+ #include <afs/vice.h>
+ #include <afs/venus.h>
+ #ifdef	AFS_AIX32_ENV
+ #include <signal.h>
+ #endif
+ #include <strings.h>
+ 
+ #define	MAXSIZE	2048
+ static char space[MAXSIZE];
+ 
+ int main(argc, argv)
+     int argc;
+     char **argv;
+ {
+     afs_int32 code;
+     struct ViceIoctl blob;
+     char *input = space;
+     afs_int32 setp = 0;
+ 
+ #ifdef	AFS_AIX32_ENV
+     /*
+      * The following signal action for AIX is necessary so that in case of a
+      * crash (i.e. core is generated) we can include the user's data section
+      * in the core dump. Unfortunately, by default, only a partial core is
+      * generated which, in many cases, isn't too useful.
+      */
+     struct sigaction nsa;
+ 
+     sigemptyset(&nsa.sa_mask);
+     nsa.sa_handler = SIG_DFL;
+     nsa.sa_flags = SA_FULLDUMP;
+     sigaction(SIGSEGV, &nsa, NULL);
+ #endif
+ 
+     blob.in = space;
+     blob.out = space;
+     blob.out_size = MAXSIZE;
+     blob.in_size = sizeof(afs_int32);
+     memcpy(space, &setp, sizeof(afs_int32));
+     code = pioctl(0, VIOC_AFS_SYSNAME, &blob, 1);
+     if (code) {
+ 	fprintf(stderr, "livesys: %s\n", error_message(code));
+ 	return 1;
+     }
+     input = space;
+     memcpy(&setp, input, sizeof(afs_int32));
+     input += sizeof(afs_int32);
+     if (!setp) {
+ 	fprintf(stderr, "No sysname name value was found\n");
+ 	return 1;
+     }
+     printf("%s\n", input);
+     return 0;
+ }
Index: openafs/src/vfsck/.cvsignore
diff -c openafs/src/vfsck/.cvsignore:1.1 openafs/src/vfsck/.cvsignore:1.1.2.1
*** openafs/src/vfsck/.cvsignore:1.1	Mon Sep 10 16:14:47 2001
--- openafs/src/vfsck/.cvsignore	Sat Oct 13 00:22:10 2001
***************
*** 1 ****
--- 1,3 ----
+ AFS_component_version_number.c
  Makefile
+ vfsck
Index: openafs/src/vfsck/setup.c
diff -c openafs/src/vfsck/setup.c:1.4.2.2 openafs/src/vfsck/setup.c:1.4.2.3
*** openafs/src/vfsck/setup.c:1.4.2.2	Fri Sep 21 19:49:39 2001
--- openafs/src/vfsck/setup.c	Sat Oct 13 00:22:10 2001
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vfsck/setup.c,v 1.4.2.2 2001/09/21 23:49:39 shadow Exp $");
  
  #include <stdio.h>
  #define VICE
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vfsck/setup.c,v 1.4.2.3 2001/10/13 04:22:10 shadow Exp $");
  
  #include <stdio.h>
  #define VICE
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.10.2.1 openafs/src/viced/afsfileprocs.c:1.10.2.2
*** openafs/src/viced/afsfileprocs.c:1.10.2.1	Wed Sep 19 18:25:33 2001
--- openafs/src/viced/afsfileprocs.c	Sat Oct 13 00:22:10 2001
***************
*** 28,34 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/afsfileprocs.c,v 1.10.2.1 2001/09/19 22:25:33 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 28,34 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/afsfileprocs.c,v 1.10.2.2 2001/10/13 04:22:10 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 523,529 ****
  
      /* Check whether the caller has permission access to fetch the data */
      if (errorCode = Check_PermissionRights(targetptr, client, rights,
! 					   CHK_FETCHDATA, 0))
  	goto Bad_FetchData;
  
      /*
--- 523,529 ----
  
      /* Check whether the caller has permission access to fetch the data */
      if (errorCode = Check_PermissionRights(targetptr, client, rights,
! 					   CHK_FETCHDATA, 0)) 
  	goto Bad_FetchData;
  
      /*
***************
*** 783,790 ****
   * This routine is called exclusively by SRXAFS_FetchStatus(), and should be
   * merged into it when possible.
   */
! SAFSS_FetchStatus (tcon, Fid, OutStatus, CallBack, Sync)
!     struct rx_connection *tcon;		/* Rx connection handle */
      struct AFSFid *Fid;			/* Fid of target file */
      struct AFSFetchStatus *OutStatus;	/* Returned status for the fid */
      struct AFSCallBack *CallBack;	/* if r/w, callback promise for Fid */
--- 783,790 ----
   * This routine is called exclusively by SRXAFS_FetchStatus(), and should be
   * merged into it when possible.
   */
! SAFSS_FetchStatus (tcall, Fid, OutStatus, CallBack, Sync)
!     struct rx_call *tcall;
      struct AFSFid *Fid;			/* Fid of target file */
      struct AFSFetchStatus *OutStatus;	/* Returned status for the fid */
      struct AFSCallBack *CallBack;	/* if r/w, callback promise for Fid */
***************
*** 799,804 ****
--- 799,805 ----
      afs_int32 rights, anyrights;		/* rights for this and any user */
      struct client *t_client;            /* tmp ptr to client data */
      struct in_addr logHostAddr;		/* host ip holder for inet_ntoa */
+     struct rx_connection *tcon = rx_ConnectionOf(tcall);
  
      /* Get ptr to client data for user Id for logging */
      t_client = (struct client *)  rx_GetSpecific(tcon, rxcon_client_key);
***************
*** 824,831 ****
      /* Are we allowed to fetch Fid's status? */
      if (targetptr->disk.type != vDirectory) {
        if (errorCode = Check_PermissionRights(targetptr, client, rights,
! 					     CHK_FETCHSTATUS, 0))
! 	goto Bad_FetchStatus;
      }
  
      /* set OutStatus From the Fid  */
--- 825,835 ----
      /* Are we allowed to fetch Fid's status? */
      if (targetptr->disk.type != vDirectory) {
        if (errorCode = Check_PermissionRights(targetptr, client, rights,
! 					     CHK_FETCHSTATUS, 0)) {
! 	  if (rx_GetCallAbortCode(tcall) == errorCode) 
! 	      rx_SetCallAbortCode(tcall, 0);
! 	  goto Bad_FetchStatus;
!       }
      }
  
      /* set OutStatus From the Fid  */
***************
*** 924,932 ****
  
  	/* Are we allowed to fetch Fid's status? */
  	if (targetptr->disk.type != vDirectory) {
! 	  if (errorCode = Check_PermissionRights(targetptr, client, rights,
! 					       CHK_FETCHSTATUS, 0))
! 	     	goto Bad_BulkStatus;
  	}
  
  	/* set OutStatus From the Fid  */
--- 928,939 ----
  
  	/* Are we allowed to fetch Fid's status? */
  	if (targetptr->disk.type != vDirectory) {
! 	    if (errorCode = Check_PermissionRights(targetptr, client, rights,
! 						   CHK_FETCHSTATUS, 0)) {
! 		if (rx_GetCallAbortCode(tcall) == errorCode) 
! 		    rx_SetCallAbortCode(tcall, 0);
! 		goto Bad_BulkStatus;
! 	    }
  	}
  
  	/* set OutStatus From the Fid  */
***************
*** 984,989 ****
--- 991,1145 ----
  } /*SRXAFS_BulkStatus*/
  
  
+ SRXAFS_InlineBulkStatus(tcon, Fids, OutStats, CallBacks, Sync)
+     struct rx_connection *tcon;
+     struct AFSCBFids *Fids;
+     struct AFSBulkStats *OutStats;
+     struct AFSCBs *CallBacks;
+     struct AFSVolSync *Sync;
+ {
+     register int i;
+     afs_int32 nfiles;
+     Vnode * targetptr =	0;		/* pointer to vnode to fetch */
+     Vnode * parentwhentargetnotdir = 0;	/* parent vnode if targetptr is a file */
+     int	    errorCode =	0;		/* return code to caller */
+     Volume * volptr = 0;		/* pointer to the volume */
+     struct client *client;		/* pointer to the client data */
+     afs_int32 rights, anyrights;		/* rights for this and any user */
+     register struct AFSFid *tfid;	/* file id we're dealing with now */
+     struct rx_call *tcall = (struct rx_call *) tcon; 
+     AFSFetchStatus *tstatus;
+ #if FS_STATS_DETAILED
+     struct fs_stats_opTimingData *opP;      /* Ptr to this op's timing struct */
+     struct timeval opStartTime,
+                    opStopTime;		    /* Start/stop times for RPC op*/
+     struct timeval elapsedTime;		    /* Transfer time */
+ 
+     /*
+      * Set our stats pointer, remember when the RPC operation started, and
+      * tally the operation.
+      */
+     opP = &(afs_FullPerfStats.det.rpcOpTimes[FS_STATS_RPCIDX_BULKSTATUS]);
+     FS_LOCK
+     (opP->numOps)++;
+     FS_UNLOCK
+     TM_GetTimeOfDay(&opStartTime, 0);
+ #endif /* FS_STATS_DETAILED */
+ 
+     ViceLog(1, ("SAFS_InlineBulkStatus\n"));
+     FS_LOCK
+     AFSCallStats.TotalCalls++;
+     FS_UNLOCK
+ 
+     nfiles = Fids->AFSCBFids_len;	/* # of files in here */
+     if (nfiles <= 0) {                  /* Sanity check */
+ 	errorCode = EINVAL;
+ 	goto Audit_and_Return;
+     }
+ 
+     /* allocate space for return output parameters */
+     OutStats->AFSBulkStats_val = (struct AFSFetchStatus *)
+ 	malloc(nfiles * sizeof(struct AFSFetchStatus));
+     OutStats->AFSBulkStats_len = nfiles;
+     CallBacks->AFSCBs_val = (struct AFSCallBack *)
+ 	malloc(nfiles * sizeof(struct AFSCallBack));
+     CallBacks->AFSCBs_len = nfiles;
+ 
+     if (errorCode = CallPreamble((struct rx_call **) &tcon, ACTIVECALL)) {
+ 	goto Bad_InlineBulkStatus;
+     }
+ 
+     tfid = Fids->AFSCBFids_val;
+     for (i=0; i<nfiles; i++, tfid++) {
+ 	/*
+ 	 * Get volume/vnode for the fetched file; caller's rights to it
+ 	 * are also returned
+ 	 */
+ 	if (errorCode =
+ 	    GetVolumePackage(tcon, tfid, &volptr, &targetptr,
+ 			     DONTCHECK, &parentwhentargetnotdir, &client,
+ 			     READ_LOCK, &rights, &anyrights)) {
+ 	    tstatus = &OutStats->AFSBulkStats_val[i];
+ 	    tstatus->errorCode = errorCode;
+ 	    parentwhentargetnotdir = (Vnode *) 0;
+ 	    targetptr = (Vnode *) 0;
+ 	    volptr = (Volume *) 0;
+ 	    continue;
+ 	}
+ 
+ 	/* set volume synchronization information, but only once per call */
+ 	if (i == nfiles)
+ 	    SetVolumeSync(Sync, volptr);
+ 
+ 	/* Are we allowed to fetch Fid's status? */
+ 	if (targetptr->disk.type != vDirectory) {
+ 	    if (errorCode = Check_PermissionRights(targetptr, client, rights,
+ 						   CHK_FETCHSTATUS, 0)) {
+ 		tstatus = &OutStats->AFSBulkStats_val[i];
+ 		tstatus->errorCode = errorCode;
+ 		PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0, volptr);
+ 		parentwhentargetnotdir = (Vnode *) 0;
+ 		targetptr = (Vnode *) 0;
+ 		volptr = (Volume *) 0;
+ 		continue;
+ 	    }
+ 	}
+ 
+ 	/* set OutStatus From the Fid  */
+ 	GetStatus(targetptr, &OutStats->AFSBulkStats_val[i],
+ 		  rights, anyrights, parentwhentargetnotdir);
+ 
+ 	/* If a r/w volume, also set the CallBack state */
+ 	if (VolumeWriteable(volptr))
+ 	    SetCallBackStruct(AddBulkCallBack(client->host, tfid),
+ 			      &CallBacks->AFSCBs_val[i]);
+ 	else {
+ 	  struct AFSFid myFid;		
+ 	  memset(&myFid, 0, sizeof(struct AFSFid));
+ 	  myFid.Volume = tfid->Volume;
+ 	  SetCallBackStruct(AddVolCallBack(client->host, &myFid),
+ 			      &CallBacks->AFSCBs_val[i]);
+ 	}
+ 
+ 	/* put back the file ID and volume */
+ 	PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0, volptr);
+ 	parentwhentargetnotdir = (Vnode *) 0;
+ 	targetptr = (Vnode *) 0;
+ 	volptr = (Volume *) 0;
+     }
+ 
+ Bad_InlineBulkStatus: 
+     /* Update and store volume/vnode and parent vnodes back */
+     PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *)0, volptr);
+     CallPostamble(tcon);
+ 
+ #if FS_STATS_DETAILED
+     TM_GetTimeOfDay(&opStopTime, 0);
+     if (errorCode == 0) {
+ 	FS_LOCK
+         (opP->numSuccesses)++;
+         fs_stats_GetDiff(elapsedTime, opStartTime, opStopTime);
+         fs_stats_AddTo((opP->sumTime), elapsedTime);
+         fs_stats_SquareAddTo((opP->sqrTime), elapsedTime);
+         if (fs_stats_TimeLessThan(elapsedTime, (opP->minTime))) {
+ 	    fs_stats_TimeAssign((opP->minTime), elapsedTime);
+         }
+         if (fs_stats_TimeGreaterThan(elapsedTime, (opP->maxTime))) {
+ 	    fs_stats_TimeAssign((opP->maxTime), elapsedTime);
+         }
+ 	FS_UNLOCK
+     }	
+ 
+ #endif /* FS_STATS_DETAILED */
+ 
+ Audit_and_Return:
+     ViceLog(2, ("SAFS_InlineBulkStatus	returns	%d\n", errorCode)); 
+     osi_auditU (tcall, InlineBulkFetchStatusEvent, errorCode, AUD_FIDS, Fids, AUD_END);
+     return 0;
+ 
+ } /*SRXAFS_InlineBulkStatus*/
+ 
+ 
  SRXAFS_FetchStatus (tcon, Fid, OutStatus, CallBack, Sync)
      struct AFSVolSync *Sync;
      struct rx_connection *tcon;		/* Rx connection handle */
***************
*** 1014,1020 ****
      if (code = CallPreamble((struct rx_call **) &tcon, ACTIVECALL))
  	goto Bad_FetchStatus;
  
!     code = SAFSS_FetchStatus (tcon, Fid, OutStatus, CallBack, Sync);
  
  Bad_FetchStatus:    
      CallPostamble(tcon);
--- 1170,1176 ----
      if (code = CallPreamble((struct rx_call **) &tcon, ACTIVECALL))
  	goto Bad_FetchStatus;
  
!     code = SAFSS_FetchStatus (tcall, Fid, OutStatus, CallBack, Sync);
  
  Bad_FetchStatus:    
      CallPostamble(tcon);
***************
*** 2380,2394 ****
      }
  
      /*
!      * If we're creating a mount point (owner mode bits sans x bit), we must
!      * have administer access to the directory, too.  Always allow sysadmins
       * to do this.
       */
!     if ((InStatus->Mask & AFS_SETMODE) && !(InStatus->UnixModeBits & 0100)) {
  	/*
! 	 * We have a symlink, 'cause we're trying to set the Unix mode bits
! 	 * to something without the owner x bits (default mode bits if
! 	 * AFS_SETMODE is false is 0777)
  	 */
  	if (VanillaUser(client) && !(rights & PRSFS_ADMINISTER)) {
  	    errorCode = EACCES;
--- 2536,2550 ----
      }
  
      /*
!      * If we're creating a mount point (any x bits clear), we must have
!      * administer access to the directory, too.  Always allow sysadmins
       * to do this.
       */
!     if ((InStatus->Mask & AFS_SETMODE) && !(InStatus->UnixModeBits & 0111)) {
  	/*
! 	 * We have a mountpoint, 'cause we're trying to set the Unix mode
! 	 * bits to something with some x bits missing (default mode bits
! 	 * if AFS_SETMODE is false is 0777)
  	 */
  	if (VanillaUser(client) && !(rights & PRSFS_ADMINISTER)) {
  	    errorCode = EACCES;
***************
*** 6213,6220 ****
  {
      /* initialize return status from a vnode  */
      status->InterfaceVersion = 1;
!     status->SyncCounter = status->dataVersionHigh = status->spare2 =
!     status->spare3 = status->spare4 = 0;
      if (targetptr->disk.type == vFile)
  	status->FileType = File;
      else if (targetptr->disk.type == vDirectory)
--- 6369,6376 ----
  {
      /* initialize return status from a vnode  */
      status->InterfaceVersion = 1;
!     status->SyncCounter = status->dataVersionHigh = status->lockCount =
!     status->spare3 = status->errorCode = 0;
      if (targetptr->disk.type == vFile)
  	status->FileType = File;
      else if (targetptr->disk.type == vDirectory)
***************
*** 6237,6243 ****
      status->SegSize = 0;
      status->ServerModTime = targetptr->disk.serverModifyTime;			
      status->Group = targetptr->disk.group;
!     status->spare2 = targetptr->disk.lock.lockCount;
  
  } /*GetStatus*/
  
--- 6393,6400 ----
      status->SegSize = 0;
      status->ServerModTime = targetptr->disk.serverModifyTime;			
      status->Group = targetptr->disk.group;
!     status->lockCount = targetptr->disk.lock.lockCount;
!     status->errorCode = 0;
  
  } /*GetStatus*/
  
Index: openafs/src/viced/callback.c
diff -c openafs/src/viced/callback.c:1.6 openafs/src/viced/callback.c:1.6.2.1
*** openafs/src/viced/callback.c:1.6	Tue Aug  7 20:04:21 2001
--- openafs/src/viced/callback.c	Sat Oct 13 00:22:10 2001
***************
*** 82,88 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/callback.c,v 1.6 2001/08/08 00:04:21 shadow Exp $");
  
  #include <stdio.h> 
  #include <stdlib.h>      /* for malloc() */
--- 82,88 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/callback.c,v 1.6.2.1 2001/10/13 04:22:10 shadow Exp $");
  
  #include <stdio.h> 
  #include <stdlib.h>      /* for malloc() */
***************
*** 358,364 ****
  
  	cb->tprev = thp->tprev;
  	cb->tnext = *thead;
! 	thp->tprev = (itocb(thp->tprev)->tnext = cbtoi(cb));
      }
      cb->thead = ttoi(thead);
  
--- 358,369 ----
  
  	cb->tprev = thp->tprev;
  	cb->tnext = *thead;
! 	if (thp) {
! 	  if (thp->tprev) 
! 	    thp->tprev = (itocb(thp->tprev)->tnext = cbtoi(cb));
! 	  else 
! 	    thp->tprev = cbtoi(cb);
! 	}
      }
      cb->thead = ttoi(thead);
  
***************
*** 374,381 ****
  
      if (*thead == cbtoi(cb))
  	*thead = (*thead == cb->tnext? 0: cb->tnext);
!     itocb(cb->tprev)->tnext = cb->tnext;
!     itocb(cb->tnext)->tprev = cb->tprev;
  
  } /*TDel*/
  
--- 379,388 ----
  
      if (*thead == cbtoi(cb))
  	*thead = (*thead == cb->tnext? 0: cb->tnext);
!     if (itocb(cb->tprev)) 
!       itocb(cb->tprev)->tnext = cb->tnext;
!     if (itocb(cb->tnext)) 
!       itocb(cb->tnext)->tprev = cb->tprev;
  
  } /*TDel*/
  
Index: openafs/src/viced/host.c
diff -c openafs/src/viced/host.c:1.7 openafs/src/viced/host.c:1.7.2.1
*** openafs/src/viced/host.c:1.7	Tue Aug  7 20:04:21 2001
--- openafs/src/viced/host.c	Sat Oct 13 00:22:10 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/host.c,v 1.7 2001/08/08 00:04:21 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/host.c,v 1.7.2.1 2001/10/13 04:22:10 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 114,121 ****
      register int i;
  
      block = (struct CEBlock *)malloc(sizeof(struct CEBlock));
!     if (!block)
  	ShutDownAndCore(PANIC);
  
      for(i = 0; i < (CESPERBLOCK -1); i++) {
  	Lock_Init(&block->entry[i].lock);
--- 114,123 ----
      register int i;
  
      block = (struct CEBlock *)malloc(sizeof(struct CEBlock));
!     if (!block) {
! 	ViceLog(0, ("Failed malloc in GetCEBlock\n"));
  	ShutDownAndCore(PANIC);
+     }
  
      for(i = 0; i < (CESPERBLOCK -1); i++) {
  	Lock_Init(&block->entry[i].lock);
***************
*** 137,144 ****
  
      if (CEFree == 0)
  	GetCEBlock();
!     if (CEFree == 0)
  	ShutDownAndCore(PANIC);
  
      entry = CEFree;
      CEFree = entry->next;
--- 139,148 ----
  
      if (CEFree == 0)
  	GetCEBlock();
!     if (CEFree == 0) {
! 	ViceLog(0, ("CEFree NULL in GetCE\n"));
  	ShutDownAndCore(PANIC);
+     }
  
      entry = CEFree;
      CEFree = entry->next;
***************
*** 193,200 ****
      static int index = 0;
  
      block = (struct HTBlock *)malloc(sizeof(struct HTBlock));
!     if (!block)
  	ShutDownAndCore(PANIC);
  
  #ifdef AFS_PTHREAD_ENV
      for(i=0; i < (h_HTSPERBLOCK); i++)
--- 197,206 ----
      static int index = 0;
  
      block = (struct HTBlock *)malloc(sizeof(struct HTBlock));
!     if (!block) {
! 	ViceLog(0, ("Failed malloc in GetHTBlock\n"));
  	ShutDownAndCore(PANIC);
+     }
  
  #ifdef AFS_PTHREAD_ENV
      for(i=0; i < (h_HTSPERBLOCK); i++)
***************
*** 264,277 ****
      register struct host *host;
  {	
      
!     if (!((host)->holds[h_holdSlot()] &= ~h_holdbit()) ) {
  	if (! h_OtherHolds_r(host) ) {
  	    if ( (host->hostFlags & HOSTDELETED) || 
  		(host->hostFlags & CLIENTDELETED) ) {
  		h_TossStuff_r(host);
  	    }		
! 	}
!     }
      return 0;
  }
  
--- 270,289 ----
      register struct host *host;
  {	
      
!     if (!((host)->holds[h_holdSlot()] & ~h_holdbit()) ) {
  	if (! h_OtherHolds_r(host) ) {
+ 	    /* must avoid masking this until after h_OtherHolds_r runs
+ 	       but it should be run before h_TossStuff_r */
+ 	    (host)->holds[h_holdSlot()] &= ~h_holdbit();
  	    if ( (host->hostFlags & HOSTDELETED) || 
  		(host->hostFlags & CLIENTDELETED) ) {
  		h_TossStuff_r(host);
  	    }		
! 	} else 
! 	    (host)->holds[h_holdSlot()] &= ~h_holdbit();
!     } else 
!       (host)->holds[h_holdSlot()] &= ~h_holdbit();
! 
      return 0;
  }
  
***************
*** 1590,1597 ****
      char tmpStr[256];
  
      H_LOCK
!     sprintf(tmpStr, "ip:%x holds:%d port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
! 	    host->host, host->holds, host->port, host->index, host->cblist,
  	    CheckLock(&host->lock), host->LastCall, host->ActiveCall, 
  	    (host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED, 
  	    host->Console, host->hostFlags & CLIENTDELETED, 
--- 1602,1609 ----
      char tmpStr[256];
  
      H_LOCK
!     sprintf(tmpStr, "ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
! 	    host->host, host->port, host->index, host->cblist,
  	    CheckLock(&host->lock), host->LastCall, host->ActiveCall, 
  	    (host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED, 
  	    host->Console, host->hostFlags & CLIENTDELETED, 
***************
*** 1609,1616 ****
  	    sprintf(tmpStr, " %x", host->interface->addr[i]);
  	    STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
  	}
!     sprintf(tmpStr, "]\n");
      STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
      H_UNLOCK
      return held;
  
--- 1621,1636 ----
  	    sprintf(tmpStr, " %x", host->interface->addr[i]);
  	    STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
  	}
!     sprintf(tmpStr, "] holds: ");
!     STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
! 
!     for (i = 0 ; i < h_maxSlots ; i++) {
!       sprintf(tmpStr, "%04x", host->holds[i]);
!       STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
!     }
!     sprintf(tmpStr, " slot/bit: %d/%d\n", h_holdSlot(), h_holdbit());
      STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
+ 
      H_UNLOCK
      return held;
  
Index: openafs/src/viced/viced.c
diff -c openafs/src/viced/viced.c:1.11 openafs/src/viced/viced.c:1.11.2.1
*** openafs/src/viced/viced.c:1.11	Tue Aug  7 20:04:21 2001
--- openafs/src/viced/viced.c	Sat Oct 13 00:22:10 2001
***************
*** 19,25 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/viced.c,v 1.11 2001/08/08 00:04:21 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 19,25 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/viced.c,v 1.11.2.1 2001/10/13 04:22:10 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 349,354 ****
--- 349,359 ----
      }
  #endif
      confDir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
+     if (!confDir) {
+ 	fprintf(stderr, "Unable to open config directory %s\n",
+ 		AFSDIR_SERVER_ETC_DIRPATH);
+ 	exit(-1);
+     }
  
      NewParms(1);
  
Index: openafs/src/vlserver/NTMakefile
diff -c openafs/src/vlserver/NTMakefile:1.3 openafs/src/vlserver/NTMakefile:1.3.4.1
*** openafs/src/vlserver/NTMakefile:1.3	Mon Apr 30 03:05:47 2001
--- openafs/src/vlserver/NTMakefile	Wed Nov 14 22:30:31 2001
***************
*** 85,91 ****
  	$(DESTDIR)\lib\afs\afsaudit.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\afs\afsprocmgmt.lib
  
  	
  $(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS)
--- 85,92 ----
  	$(DESTDIR)\lib\afs\afsaudit.lib \
  	$(DESTDIR)\lib\afs\afseventlog.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\afs\afsprocmgmt.lib \
! 	$(DESTDIR)\lib\cm_dns.obj
  
  	
  $(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS)
Index: openafs/src/vlserver/vlclient.c
diff -c openafs/src/vlserver/vlclient.c:1.7.2.1 openafs/src/vlserver/vlclient.c:1.7.2.2
*** openafs/src/vlserver/vlclient.c:1.7.2.1	Wed Sep 19 18:36:31 2001
--- openafs/src/vlserver/vlclient.c	Sat Oct 13 00:22:10 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/vlclient.c,v 1.7.2.1 2001/09/19 22:36:31 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/vlclient.c,v 1.7.2.2 2001/10/13 04:22:10 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/vlserver/vldb_check.c
diff -c openafs/src/vlserver/vldb_check.c:1.5.2.1 openafs/src/vlserver/vldb_check.c:1.5.2.2
*** openafs/src/vlserver/vldb_check.c:1.5.2.1	Wed Sep 19 18:36:31 2001
--- openafs/src/vlserver/vldb_check.c	Sat Oct 13 00:22:10 2001
***************
*** 24,30 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/vldb_check.c,v 1.5.2.1 2001/09/19 22:36:31 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
--- 24,30 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/vldb_check.c,v 1.5.2.2 2001/10/13 04:22:10 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
Index: openafs/src/vlserver/vldbint.xg
diff -c openafs/src/vlserver/vldbint.xg:1.2 openafs/src/vlserver/vldbint.xg:1.2.8.1
*** openafs/src/vlserver/vldbint.xg:1.2	Sat Nov  4 05:06:19 2000
--- openafs/src/vlserver/vldbint.xg	Sat Oct 13 00:22:10 2001
***************
*** 175,180 ****
--- 175,188 ----
      afs_int32 reserved[5];				/* for future usage */
  };
  
+ /* Volser information/status */
+ const VLOP_MOVE        = 0x10;
+ const VLOP_RELEASE     = 0x20;
+ const VLOP_BACKUP      = 0x40;
+ const VLOP_DELETE      = 0x80;
+ const VLOP_DUMP        = 0x100;
+ 
+ %#define VLOP_ALLOPERS ( VLOP_MOVE | VLOP_RELEASE | VLOP_BACKUP | VLOP_DELETE | VLOP_DUMP)
  
  /* defines for convenience of vl users */
  %#define	VLF_RWEXISTS	    0x1000  /* flags for whole vldb entry */
Index: openafs/src/vlserver/vlprocs.c
diff -c openafs/src/vlserver/vlprocs.c:1.5.2.1 openafs/src/vlserver/vlprocs.c:1.5.2.2
*** openafs/src/vlserver/vlprocs.c:1.5.2.1	Wed Sep 19 18:36:31 2001
--- openafs/src/vlserver/vlprocs.c	Sat Oct 13 00:22:10 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/vlprocs.c,v 1.5.2.1 2001/09/19 22:36:31 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/vlprocs.c,v 1.5.2.2 2001/10/13 04:22:10 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
Index: openafs/src/vlserver/vlserver.p.h
diff -c openafs/src/vlserver/vlserver.p.h:1.2 openafs/src/vlserver/vlserver.p.h:1.2.8.1
*** openafs/src/vlserver/vlserver.p.h:1.2	Sat Nov  4 05:06:20 2000
--- openafs/src/vlserver/vlserver.p.h	Sat Oct 13 00:22:10 2001
***************
*** 49,62 ****
  #define	VLLOCKED	4		/* Advisory lock on entry */
  #define	VLCONTBLOCK	8		/* Special continuation block entry */
  
- /* Vlentry's flags also used to stamp type of ongoing operation */
- #define	VLOP_MOVE	0x10
- #define	VLOP_RELEASE	0x20
- #define	VLOP_BACKUP	0x40
- #define	VLOP_DELETE	0x80
- #define	VLOP_DUMP	0x100
- #define	VLOP_ALLOPERS	(VLOP_MOVE | VLOP_RELEASE | VLOP_BACKUP | VLOP_DELETE | VLOP_DUMP)
- 
  /* Valid RelaseLock types */
  #define	LOCKREL_TIMESTAMP   1
  #define	LOCKREL_OPCODE	    2
--- 49,54 ----
Index: openafs/src/vlserver/vlutils.c
diff -c openafs/src/vlserver/vlutils.c:1.5.2.1 openafs/src/vlserver/vlutils.c:1.5.2.2
*** openafs/src/vlserver/vlutils.c:1.5.2.1	Wed Sep 19 18:36:32 2001
--- openafs/src/vlserver/vlutils.c	Sat Oct 13 00:22:10 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/vlutils.c,v 1.5.2.1 2001/09/19 22:36:32 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/vlutils.c,v 1.5.2.2 2001/10/13 04:22:10 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
Index: openafs/src/vol/.cvsignore
diff -c openafs/src/vol/.cvsignore:1.1 openafs/src/vol/.cvsignore:1.1.2.1
*** openafs/src/vol/.cvsignore:1.1	Mon Sep 10 16:14:49 2001
--- openafs/src/vol/.cvsignore	Sat Oct 13 00:22:11 2001
***************
*** 2,4 ****
--- 2,6 ----
  Makefile
  salvager
  volinfo
+ gi
+ fs_conv_sol26
Index: openafs/src/vol/Makefile.in
diff -c openafs/src/vol/Makefile.in:1.5 openafs/src/vol/Makefile.in:1.5.2.1
*** openafs/src/vol/Makefile.in:1.5	Fri Sep  7 23:05:04 2001
--- openafs/src/vol/Makefile.in	Sat Oct 13 00:22:11 2001
***************
*** 97,109 ****
  ${DEST}/lib/afs/libvlib.a: vlib.a
  	${INSTALL} $? $@
  
! ${DESTDIR}/${afssrvsbindir}/fs_conv_dux40D:  fs_conv_dux40D
  	${INSTALL} -s $? $@
  
! ${DESTDIR}/${afssrvsbindir}/xfs_size_check:  xfs_size_check
  	${INSTALL} -s $? $@
  
! ${DESTDIR}/${afssrvsbindir}/fs_conv_sol26:  fs_conv_sol26
  	${INSTALL} -s $? $@
  
  $(DEST)/root.server/usr/afs/bin/fs_conv_dux40D:  fs_conv_dux40D
--- 97,109 ----
  ${DEST}/lib/afs/libvlib.a: vlib.a
  	${INSTALL} $? $@
  
! ${DESTDIR}${afssrvsbindir}/fs_conv_dux40D:  fs_conv_dux40D
  	${INSTALL} -s $? $@
  
! ${DESTDIR}${afssrvsbindir}/xfs_size_check:  xfs_size_check
  	${INSTALL} -s $? $@
  
! ${DESTDIR}${afssrvsbindir}/fs_conv_sol26:  fs_conv_sol26
  	${INSTALL} -s $? $@
  
  $(DEST)/root.server/usr/afs/bin/fs_conv_dux40D:  fs_conv_dux40D
Index: openafs/src/vol/clone.c
diff -c openafs/src/vol/clone.c:1.5.2.1 openafs/src/vol/clone.c:1.5.2.2
*** openafs/src/vol/clone.c:1.5.2.1	Wed Sep 19 18:36:34 2001
--- openafs/src/vol/clone.c	Sat Oct 13 00:22:11 2001
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/clone.c,v 1.5.2.1 2001/09/19 22:36:34 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/clone.c,v 1.5.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
Index: openafs/src/vol/devname.c
diff -c openafs/src/vol/devname.c:1.7.2.1 openafs/src/vol/devname.c:1.7.2.2
*** openafs/src/vol/devname.c:1.7.2.1	Wed Sep 19 18:25:34 2001
--- openafs/src/vol/devname.c	Sat Oct 13 00:22:11 2001
***************
*** 10,16 ****
  #include <sys/param.h>
  #include <afsconfig.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/devname.c,v 1.7.2.1 2001/09/19 22:25:34 shadow Exp $");
  
  #include <afs/param.h>
  #include <rx/xdr.h>
--- 10,16 ----
  #include <sys/param.h>
  #include <afsconfig.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/devname.c,v 1.7.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <afs/param.h>
  #include <rx/xdr.h>
Index: openafs/src/vol/ihandle.c
diff -c openafs/src/vol/ihandle.c:1.4 openafs/src/vol/ihandle.c:1.4.4.1
*** openafs/src/vol/ihandle.c:1.4	Thu Jul 12 15:59:33 2001
--- openafs/src/vol/ihandle.c	Sat Oct 13 00:22:11 2001
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/ihandle.c,v 1.4 2001/07/12 19:59:33 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 14,20 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/ihandle.c,v 1.4.4.1 2001/10/13 04:22:11 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 448,454 ****
  }
  
  /* Open a file for buffered I/O */
! StreamHandle_t *stream_open(char *filename, char *mode)
  {
      FD_t fd;
  
--- 448,454 ----
  }
  
  /* Open a file for buffered I/O */
! StreamHandle_t *stream_open(const char *filename, const char *mode)
  {
      FD_t fd;
  
Index: openafs/src/vol/ihandle.h
diff -c openafs/src/vol/ihandle.h:1.2 openafs/src/vol/ihandle.h:1.2.8.1
*** openafs/src/vol/ihandle.h:1.2	Sat Nov  4 05:06:22 2000
--- openafs/src/vol/ihandle.h	Sat Oct 13 00:22:11 2001
***************
*** 258,264 ****
  extern int fd_close(FdHandle_t *fdP);
  extern int fd_reallyclose(FdHandle_t *fdP);
  extern StreamHandle_t *stream_fdopen(FD_t fd);
! extern StreamHandle_t *stream_open(char *file, char *mode);
  extern int stream_read(void *ptr, int size, int nitems,
  		       StreamHandle_t *streamP);
  extern int stream_write(void *ptr, int size, int nitems,
--- 258,264 ----
  extern int fd_close(FdHandle_t *fdP);
  extern int fd_reallyclose(FdHandle_t *fdP);
  extern StreamHandle_t *stream_fdopen(FD_t fd);
! extern StreamHandle_t *stream_open(const char *file, const char *mode);
  extern int stream_read(void *ptr, int size, int nitems,
  		       StreamHandle_t *streamP);
  extern int stream_write(void *ptr, int size, int nitems,
Index: openafs/src/vol/listinodes.c
diff -c openafs/src/vol/listinodes.c:1.8.4.1 openafs/src/vol/listinodes.c:1.8.4.2
*** openafs/src/vol/listinodes.c:1.8.4.1	Wed Sep 19 18:25:34 2001
--- openafs/src/vol/listinodes.c	Sat Oct 13 00:22:11 2001
***************
*** 20,26 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/listinodes.c,v 1.8.4.1 2001/09/19 22:25:34 shadow Exp $");
  
  #ifndef AFS_NAMEI_ENV
  #ifdef AFS_LINUX20_ENV
--- 20,26 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/listinodes.c,v 1.8.4.2 2001/10/13 04:22:11 shadow Exp $");
  
  #ifndef AFS_NAMEI_ENV
  #ifdef AFS_LINUX20_ENV
Index: openafs/src/vol/namei_ops.c
diff -c openafs/src/vol/namei_ops.c:1.9 openafs/src/vol/namei_ops.c:1.9.4.1
*** openafs/src/vol/namei_ops.c:1.9	Thu Jul 12 15:59:33 2001
--- openafs/src/vol/namei_ops.c	Sat Oct 13 00:22:11 2001
***************
*** 12,18 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/namei_ops.c,v 1.9 2001/07/12 19:59:33 shadow Exp $");
  
  #ifdef AFS_NAMEI_ENV
  #include <stdio.h>
--- 12,18 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/namei_ops.c,v 1.9.4.1 2001/10/13 04:22:11 shadow Exp $");
  
  #ifdef AFS_NAMEI_ENV
  #include <stdio.h>
***************
*** 203,208 ****
--- 203,212 ----
  {
     char filename[32];
     int fd;
+ 
+    /* Create the inode directory if we're starting for the first time */
+    sprintf(filename, "%s/%s", partition, INODEDIR);
+    mkdir(filename, 0700);
  
     sprintf(filename, "%s/%s/README", partition, INODEDIR);
     fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0444);
Index: openafs/src/vol/partition.c
diff -c openafs/src/vol/partition.c:1.11.4.2 openafs/src/vol/partition.c:1.11.4.3
*** openafs/src/vol/partition.c:1.11.4.2	Wed Sep 19 18:36:34 2001
--- openafs/src/vol/partition.c	Sat Oct 13 00:22:11 2001
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/partition.c,v 1.11.4.2 2001/09/19 22:36:34 shadow Exp $");
  
  #include <ctype.h>
  #ifdef AFS_NT40_ENV
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/partition.c,v 1.11.4.3 2001/10/13 04:22:11 shadow Exp $");
  
  #include <ctype.h>
  #ifdef AFS_NT40_ENV
***************
*** 196,206 ****
      dp->next = 0;
      strcpy(dp->name, path);
  #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
! #ifdef AFS_SUN5_ENV
!     strcpy(dp->devName, devname);
! #else /* AFS_SUN5_ENV */
      strcpy(dp->devName, path);
! #endif
      dp->device = volutil_GetPartitionID(path);
  #else
      strcpy(dp->devName, devname);
--- 196,208 ----
      dp->next = 0;
      strcpy(dp->name, path);
  #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
!     /* Create a lockfile for the partition, of the form /vicepa/Lock/vicepa */
      strcpy(dp->devName, path);
!     strcat(dp->devName, "/");
!     strcat(dp->devName, "Lock");
!     mkdir(dp->devName, 0700);
!     strcat(dp->devName, path);
!     close(open(dp->devName, O_RDWR | O_CREAT, 0600));
      dp->device = volutil_GetPartitionID(path);
  #else
      strcpy(dp->devName, devname);
***************
*** 312,317 ****
--- 314,372 ----
  
      return 0;
  }
+ 
+ /* VIsAlwaysAttach() checks whether a /vicepX directory should always be
+  * attached (return value 1), or only attached when it is a separately
+  * mounted partition (return value 0).  For non-NAMEI environments, it
+  * always returns 0.
+  */
+ static int VIsAlwaysAttach(part)
+     char *part;
+ {
+ #ifdef AFS_NAMEI_ENV
+     struct stat st;
+     char checkfile[256];
+     int ret;
+ 
+     if (strncmp(part, VICE_PARTITION_PREFIX, VICE_PREFIX_SIZE))
+ 	return 0;
+ 
+     strncpy(checkfile, part, 100);
+     strcat(checkfile, "/");
+     strcat(checkfile, VICE_ALWAYSATTACH_FILE);
+ 
+     ret = stat(checkfile, &st);
+     return (ret < 0) ? 0 : 1;
+ #else  /* AFS_NAMEI_ENV */
+     return 0;
+ #endif /* AFS_NAMEI_ENV */
+ }
+ 
+ /* VAttachPartitions2() looks for and attaches /vicepX partitions
+  * where a special file (VICE_ALWAYSATTACH_FILE) exists.  This is
+  * used to attach /vicepX directories which aren't on dedicated
+  * partitions, in the NAMEI fileserver.
+  */
+ void VAttachPartitions2() {
+ #ifdef AFS_NAMEI_ENV
+     DIR *dirp;
+     struct dirent *de;
+     char pname[32];
+ 
+     dirp = opendir("/");
+     while (de = readdir(dirp)) {
+ 	strcpy(pname, "/");
+ 	strncat(pname, de->d_name, 20);
+ 	pname[sizeof(pname)-1] = '\0';
+ 
+ 	/* Only keep track of "/vicepx" partitions since automounter
+ 	   may hose us */
+ 	if (VIsAlwaysAttach(pname))
+ 	    VCheckPartition(pname, "");
+     }
+     closedir(dirp);
+ #endif /* AFS_NAMEI_ENV */
+ }
  #endif /* AFS_NT40_ENV */
  
  #ifdef AFS_SUN5_ENV
***************
*** 332,343 ****
  	    (strncmp(mnt.mnt_mntopts, "ro,ignore",9) ==0)) 
  	    continue; 
  
  	if (VCheckPartition(mnt.mnt_mountp, mnt.mnt_special) < 0 )
  	    errors ++;
      }
  
!    (void) fclose(mntfile);
  
      return errors ;
  }
  
--- 387,405 ----
  	    (strncmp(mnt.mnt_mntopts, "ro,ignore",9) ==0)) 
  	    continue; 
  
+ 	/* If we're going to always attach this partition, do it later. */
+ 	if (VIsAlwaysAttach(mnt.mnt_mountp))
+ 	    continue;
+ 
  	if (VCheckPartition(mnt.mnt_mountp, mnt.mnt_special) < 0 )
  	    errors ++;
      }
  
!     (void) fclose(mntfile);
  
+     /* Process the always-attach partitions, if any. */
+     VAttachPartitions2();
+ 
      return errors ;
  }
  
***************
*** 356,367 ****
--- 418,436 ----
      while (mntent = getmntent(mfd)) {
  	if (!hasmntopt(mntent, MNTOPT_RW)) continue;
  	
+ 	/* If we're going to always attach this partition, do it later. */
+ 	if (VIsAlwaysAttach(mntent->mnt_dir))
+ 	    continue;
+ 
  	if (VCheckPartition(mntent->mnt_dir, mntent->mnt_fsname) < 0 )
  	    errors ++;
      }
  
      endmntent(mfd);
  
+     /* Process the always-attach partitions, if any. */
+     VAttachPartitions2();
+ 
      return errors ;
  }
  #endif
***************
*** 449,459 ****
  	}
  #endif
  
  	if (VCheckPartition(part, vmt2dataptr(vmountp, VMT_OBJECT)) < 0 )
  	    errors ++;
      }
-     return errors ;
  
  }
  #endif
  #if defined(AFS_DUX40_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
--- 518,535 ----
  	}
  #endif
  
+ 	/* If we're going to always attach this partition, do it later. */
+ 	if (VIsAlwaysAttach(part))
+ 	    continue;
+ 
  	if (VCheckPartition(part, vmt2dataptr(vmountp, VMT_OBJECT)) < 0 )
  	    errors ++;
      }
  
+     /* Process the always-attach partitions, if any. */
+     VAttachPartitions2();
+ 
+     return errors ;
  }
  #endif
  #if defined(AFS_DUX40_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
***************
*** 470,480 ****
--- 546,563 ----
      while (fsent = getfsent()) {
  	if (strcmp(fsent->fs_type, "rw") != 0) continue;
  
+ 	/* If we're going to always attach this partition, do it later. */
+ 	if (VIsAlwaysAttach(fsent->fs_file))
+ 	    continue;
+ 
  	if (VCheckPartition(fsent->fs_file, fsent->fs_spec) < 0 )
  	    errors ++;
      }
      endfsent();
      
+     /* Process the always-attach partitions, if any. */
+     VAttachPartitions2();
+ 
      return errors ;
  }
  #endif
***************
*** 644,654 ****
--- 727,744 ----
  	}
      }
      while (mntent = getmntent(mfd)) {
+ 	/* If we're going to always attach this partition, do it later. */
+ 	if (VIsAlwaysAttach(mntent->mnt_dir))
+ 	    continue;
+ 
  	if (VCheckPartition(mntent->mnt_dir, mntent->mnt_fsname) < 0 )
  	    errors ++;
      }
      endmntent(mfd);
  
+     /* Process the always-attach partitions, if any. */
+     VAttachPartitions2();
+ 
      return errors ;
  }
  #endif /* AFS_LINUX22_ENV */
***************
*** 1001,1007 ****
  	assert (lockf(dp->lock_fd, F_LOCK, 0) != -1); 
  #else
  	assert (flock(dp->lock_fd, LOCK_EX) == 0);
! #endif	/* defined(AFS_AIX_ENV) */
  #endif
  }
  
--- 1091,1097 ----
  	assert (lockf(dp->lock_fd, F_LOCK, 0) != -1); 
  #else
  	assert (flock(dp->lock_fd, LOCK_EX) == 0);
! #endif	/* defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) */
  #endif
  }
  
Index: openafs/src/vol/partition.h
diff -c openafs/src/vol/partition.h:1.3 openafs/src/vol/partition.h:1.3.4.1
*** openafs/src/vol/partition.h:1.3	Thu Jul  5 11:21:20 2001
--- openafs/src/vol/partition.h	Sat Oct 13 00:22:11 2001
***************
*** 31,36 ****
--- 31,45 ----
  #define VICE_PARTITION_PREFIX	"/vicep"
  #define VICE_PREFIX_SIZE	(sizeof(VICE_PARTITION_PREFIX)-1)
  
+ /* If a file by this name exists in a /vicepX directory, it means that
+  * this directory should be used as an AFS partition even if it's not
+  * on a separate partition (for instance if it's part of a large /).
+  * This feature only works with the NAMEI fileserver.
+  */
+ #ifdef AFS_NAMEI_ENV
+ #define VICE_ALWAYSATTACH_FILE	"AlwaysAttach"
+ #endif
+ 
  /* For NT, the roles of "name" and "devName" are reversed. That is, "name"
   * refers to the drive letter name and "devName" refers to the /vicep style
   * or name. The reason for this is that a lot of places assume that "name"
Index: openafs/src/vol/vnode.c
diff -c openafs/src/vol/vnode.c:1.5.2.1 openafs/src/vol/vnode.c:1.5.2.2
*** openafs/src/vol/vnode.c:1.5.2.1	Wed Sep 19 18:36:34 2001
--- openafs/src/vol/vnode.c	Sat Oct 13 00:22:11 2001
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vnode.c,v 1.5.2.1 2001/09/19 22:36:34 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
--- 16,22 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vnode.c,v 1.5.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
Index: openafs/src/vol/vol-salvage.c
diff -c openafs/src/vol/vol-salvage.c:1.10.2.2 openafs/src/vol/vol-salvage.c:1.10.2.3
*** openafs/src/vol/vol-salvage.c:1.10.2.2	Wed Sep 19 18:36:34 2001
--- openafs/src/vol/vol-salvage.c	Sat Oct 13 00:22:11 2001
***************
*** 91,97 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vol-salvage.c,v 1.10.2.2 2001/09/19 22:36:34 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
--- 91,97 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vol-salvage.c,v 1.10.2.3 2001/10/13 04:22:11 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
Index: openafs/src/vol/volume.c
diff -c openafs/src/vol/volume.c:1.12.2.1 openafs/src/vol/volume.c:1.12.2.2
*** openafs/src/vol/volume.c:1.12.2.1	Wed Sep 19 18:25:35 2001
--- openafs/src/vol/volume.c	Sat Oct 13 00:22:11 2001
***************
*** 19,25 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/volume.c,v 1.12.2.1 2001/09/19 22:25:35 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
--- 19,25 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/volume.c,v 1.12.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
Index: openafs/src/vol/vutil.c
diff -c openafs/src/vol/vutil.c:1.6.2.1 openafs/src/vol/vutil.c:1.6.2.2
*** openafs/src/vol/vutil.c:1.6.2.1	Wed Sep 19 18:36:34 2001
--- openafs/src/vol/vutil.c	Sat Oct 13 00:22:11 2001
***************
*** 17,23 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vutil.c,v 1.6.2.1 2001/09/19 22:36:34 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 17,23 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vutil.c,v 1.6.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
Index: openafs/src/volser/NTMakefile
diff -c openafs/src/volser/NTMakefile:1.2.8.1 openafs/src/volser/NTMakefile:1.2.8.2
*** openafs/src/volser/NTMakefile:1.2.8.1	Wed Sep 19 18:32:57 2001
--- openafs/src/volser/NTMakefile	Wed Nov 14 22:30:31 2001
***************
*** 64,70 ****
  	$(DESTDIR)\lib\afslwp.lib \
  	$(DESTDIR)\lib\afs\afsacl.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\afs\afseventlog.lib
  
  
  ############################################################################
--- 64,71 ----
  	$(DESTDIR)\lib\afslwp.lib \
  	$(DESTDIR)\lib\afs\afsacl.lib \
  	$(DESTDIR)\lib\afs\afsreg.lib \
! 	$(DESTDIR)\lib\afs\afseventlog.lib \
!      $(DESTDIR)\lib\cm_dns.obj
  
  
  ############################################################################
Index: openafs/src/volser/common.c
diff -c openafs/src/volser/common.c:1.4.4.2 openafs/src/volser/common.c:1.4.4.3
*** openafs/src/volser/common.c:1.4.4.2	Wed Sep 19 18:40:45 2001
--- openafs/src/volser/common.c	Sat Oct 13 00:22:11 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/common.c,v 1.4.4.2 2001/09/19 22:40:45 shadow Exp $");
  
  #include <stdio.h>
  #include <afs/afsutil.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/common.c,v 1.4.4.3 2001/10/13 04:22:11 shadow Exp $");
  
  #include <stdio.h>
  #include <afs/afsutil.h>
Index: openafs/src/volser/dumpstuff.c
diff -c openafs/src/volser/dumpstuff.c:1.6.2.1 openafs/src/volser/dumpstuff.c:1.6.2.2
*** openafs/src/volser/dumpstuff.c:1.6.2.1	Wed Sep 19 18:36:35 2001
--- openafs/src/volser/dumpstuff.c	Sat Oct 13 00:22:11 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/dumpstuff.c,v 1.6.2.1 2001/09/19 22:36:35 shadow Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/dumpstuff.c,v 1.6.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
Index: openafs/src/volser/lockprocs.c
diff -c openafs/src/volser/lockprocs.c:1.4.4.1 openafs/src/volser/lockprocs.c:1.4.4.2
*** openafs/src/volser/lockprocs.c:1.4.4.1	Wed Sep 19 18:36:35 2001
--- openafs/src/volser/lockprocs.c	Sat Oct 13 00:22:11 2001
***************
*** 17,23 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/lockprocs.c,v 1.4.4.1 2001/09/19 22:36:35 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 17,23 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/lockprocs.c,v 1.4.4.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
Index: openafs/src/volser/volprocs.c
diff -c openafs/src/volser/volprocs.c:1.6.2.1 openafs/src/volser/volprocs.c:1.6.2.2
*** openafs/src/volser/volprocs.c:1.6.2.1	Wed Sep 19 18:36:35 2001
--- openafs/src/volser/volprocs.c	Sat Oct 13 00:22:11 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/volprocs.c,v 1.6.2.1 2001/09/19 22:36:35 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/volprocs.c,v 1.6.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 626,631 ****
--- 626,635 ----
      ClearVolumeStats(&V_disk(newvp));
      V_destroyMe(newvp) = DESTROY_ME;
      V_inService(newvp) = 0;
+     if (newType == backupVolume) {
+ 	V_backupDate(originalvp) = V_copyDate(newvp);
+ 	V_backupDate(newvp) = V_copyDate(newvp);
+     }
      V_inUse(newvp) = 0;
      VUpdateVolume(&error, newvp);
      if (error) {
***************
*** 779,784 ****
--- 783,792 ----
      ClearVolumeStats(&V_disk(clonevp));
      V_destroyMe(clonevp) = 0;
      V_inService(clonevp) = 0;
+     if (newType == backupVolume) {
+ 	V_backupDate(originalvp) = V_copyDate(clonevp);
+ 	V_backupDate(clonevp) = V_copyDate(clonevp);
+     }
      V_inUse(clonevp) = 0;
      VUpdateVolume(&error, clonevp);
      if (error) {
***************
*** 1585,1597 ****
  struct pIDs *partIds;
  {   
      char namehead[9];
-     struct stat rbuf, pbuf;
      int code;
      char i;
  
      strcpy(namehead, "/vicep");	/*7 including null terminator*/
  
- #ifdef AFS_NT40_ENV
      /* Just return attached partitions. */
      namehead[7] = '\0';
      for (i=0; i<26; i++) {
--- 1593,1603 ----
***************
*** 1599,1621 ****
  	if (VGetPartition(namehead, 0))
  	    partIds->partIds[i] = VGetPartition(namehead, 0) ? i : -1;
      }
! #else
!     
!     (void) stat("/",&rbuf);	/*interested in buf->st_dev*/
!    
!     for(i = 0 ; i < 26 ; i++){
! 	
! 	namehead[6] = i + 'a';
! 	namehead[7] = '\0';
! 	code = stat(namehead,&pbuf);
! 	if(!code){
! 	    if(rbuf.st_dev != pbuf.st_dev) /*the partition is mounted */
! 		partIds->partIds[i] = i ;
! 	    else  partIds->partIds[i ] = -1;
! 	}
! 	else partIds->partIds[i ] = -1;
!     }
! #endif   
      return 0;
  }
  
--- 1605,1611 ----
  	if (VGetPartition(namehead, 0))
  	    partIds->partIds[i] = VGetPartition(namehead, 0) ? i : -1;
      }
! 
      return 0;
  }
  
***************
*** 1639,1648 ****
      struct stat rbuf, pbuf;
      char namehead[9];
      struct partList partList;
!     int code, i, j=0, k;
  
      strcpy(namehead, "/vicep");	/*7 including null terminator*/
! #ifdef AFS_NT40_ENV
      for(i = 0 ; i < VOLMAXPARTS; i++){
  	if (i < 26) {
  	    namehead[6] = i + 'a';
--- 1629,1640 ----
      struct stat rbuf, pbuf;
      char namehead[9];
      struct partList partList;
!     struct DiskPartition *dp;
!     int i, j=0, k;
  
      strcpy(namehead, "/vicep");	/*7 including null terminator*/
! 
!     /* Only report attached partitions */
      for(i = 0 ; i < VOLMAXPARTS; i++){
  	if (i < 26) {
  	    namehead[6] = i + 'a';
***************
*** 1653,1687 ****
  	    namehead[7] = 'a' + (k%26);
  	    namehead[8] = '\0';
  	}
! 	code = VGetPartition(namehead, 0);
! 	if (code)
  	    partList.partId[j++] = i;
      }
      pEntries->partEntries_val = (afs_int32 *) malloc(j * sizeof(int));
      memcpy((char *)pEntries->partEntries_val, (char *)&partList, j * sizeof(int));
      pEntries->partEntries_len = j;
- #else
-     code = stat("/",&rbuf);	/*interested in buf->st_dev*/
-     for(i = 0 ; i < VOLMAXPARTS; i++){
- 	if (i < 26) {
- 	    namehead[6] = i + 'a';
- 	    namehead[7] = '\0';
- 	} else {
- 	    k = i - 26;
- 	    namehead[6] = 'a' + (k/26);
- 	    namehead[7] = 'a' + (k%26);
- 	    namehead[8] = '\0';
- 	}
- 	code = stat(namehead,&pbuf);
- 	if(!code){
- 	    if(rbuf.st_dev != pbuf.st_dev) /*the partition is mounted */
- 		partList.partId[j++] = i;
- 	}
-     } 
-     pEntries->partEntries_val = (afs_int32 *) malloc(j * sizeof(int));
-     memcpy((char *)pEntries->partEntries_val, (char *)&partList, j * sizeof(int));
-     pEntries->partEntries_len = j;
- #endif
      return 0;
  
  }
--- 1645,1657 ----
  	    namehead[7] = 'a' + (k%26);
  	    namehead[8] = '\0';
  	}
! 	dp = VGetPartition(namehead, 0);
! 	if (dp)
  	    partList.partId[j++] = i;
      }
      pEntries->partEntries_val = (afs_int32 *) malloc(j * sizeof(int));
      memcpy((char *)pEntries->partEntries_val, (char *)&partList, j * sizeof(int));
      pEntries->partEntries_len = j;
      return 0;
  
  }
Index: openafs/src/volser/volser.p.h
diff -c openafs/src/volser/volser.p.h:1.2 openafs/src/volser/volser.p.h:1.2.8.1
*** openafs/src/volser/volser.p.h:1.2	Sat Nov  4 05:06:34 2000
--- openafs/src/volser/volser.p.h	Sat Oct 13 00:22:11 2001
***************
*** 152,157 ****
--- 152,158 ----
  /* Values for the UV_RestoreVolume flags parameter */
  #define RV_FULLRST 0x1
  #define RV_OFFLINE 0x2
+ #define RV_RDONLY  0x10000
  
  #endif /* _VOLSER_ */
  
Index: openafs/src/volser/vos.c
diff -c openafs/src/volser/vos.c:1.8.2.1 openafs/src/volser/vos.c:1.8.2.2
*** openafs/src/volser/vos.c:1.8.2.1	Wed Sep 19 18:36:35 2001
--- openafs/src/volser/vos.c	Sat Oct 13 00:22:11 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/vos.c,v 1.8.2.1 2001/09/19 22:36:35 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/vos.c,v 1.8.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 67,72 ****
--- 67,73 ----
  cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, "don't authenticate");\
  cmd_AddParm(ts, "-localauth",CMD_FLAG,CMD_OPTIONAL,"use server tickets");\
  cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");\
+ cmd_AddParm(ts, "-crypt", CMD_FLAG, CMD_OPTIONAL, "encrypt commands");\
  
  #define ERROR_EXIT(code) {error=(code); goto error_exit;}
  
***************
*** 79,84 ****
--- 80,87 ----
  extern struct rx_connection *UV_Bind();
  extern  struct rx_securityClass *rxnull_NewClientSecurityObject();
  extern int UV_SetSecurity();
+ extern int UV_SetVolumeInfo();
+ extern int vsu_SetCrypt();
  extern VL_SetLock();
  extern VL_ReleaseLock();
  extern VL_DeleteEntry();
***************
*** 1275,1280 ****
--- 1278,1363 ----
  }
  
  /*------------------------------------------------------------------------
+  * PRIVATE SetFields
+  *
+  * Description:
+  *	Routine used to change the status of a single volume.
+  *
+  * Arguments:
+  *	as : Ptr to parsed command line arguments.
+  *
+  * Returns:
+  *	0 for a successful operation,
+  *	Otherwise, one of the ubik or VolServer error values.
+  *
+  * Environment:
+  *	Nothing interesting.
+  *
+  * Side Effects:
+  *	As advertised.
+  *------------------------------------------------------------------------
+  */
+ static SetFields(as)
+ register struct cmd_syndesc *as;
+ {
+     struct nvldbentry entry;
+     afs_int32 vcode = 0;
+     volintInfo info;
+     afs_int32 volid;
+     afs_int32 code, err;
+     afs_int32 aserver, apart;
+     int previdx = -1;
+ 
+     volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);    /* -id */
+     if (volid == 0) {
+ 	if (err) PrintError("", err);
+ 	else fprintf(STDERR, "Unknown volume ID or name '%s'\n", as->parms[0].items->data);
+ 	return -1;
+     }
+ 
+     code = VLDB_GetEntryByID (volid, RWVOL, &entry);
+     if (code) {
+ 	fprintf(STDERR, "Could not fetch the entry for volume number %u from VLDB \n",volid);
+ 	return (code);
+     }
+     MapHostToNetwork(&entry);
+ 
+     GetServerAndPart(&entry, RWVOL, &aserver, &apart, &previdx);
+     if (previdx == -1) {
+ 	fprintf(STDERR,"Volume %s does not exist in VLDB\n\n", as->parms[0].items->data);
+ 	return (ENOENT);
+     }
+ 
+     memset(&info, 0, sizeof(info));
+     info.volid    = volid;
+     info.type     = RWVOL;
+     info.dayUse   = -1;
+     info.maxquota = -1;
+     info.flags    = -1;
+     info.spare0   = -1;
+     info.spare1   = -1;
+     info.spare2   = -1;
+     info.spare3   = -1;
+ 
+     if (as->parms[1].items) {
+ 	/* -max <quota> */
+ 	code = util_GetInt32(as->parms[1].items->data, &info.maxquota);
+ 	if (code) {
+ 	    fprintf(STDERR,"invalid quota value\n");
+ 	    return code;
+ 	}
+     }
+     if (as->parms[2].items) {
+ 	/* -clearuse */
+ 	info.dayUse = 0;
+     }
+     code = UV_SetVolumeInfo(aserver, apart, volid, &info);
+     if (code)
+ 	fprintf(STDERR,"Could not update volume info fields for volume number %u\n",volid);
+     return (code);
+ }
+ 
+ /*------------------------------------------------------------------------
   * PRIVATE volOnline
   *
   * Description:
***************
*** 1882,1888 ****
  {    
          afs_int32 avolid, aserver, apart, code,vcode, err;
  	afs_int32 aoverwrite = ASK;
! 	int restoreflags;
  	char prompt;
  	char afilename[NameLen], avolname[VOLSER_MAXVOLNAME +1],apartName[10];
  	char volname[VOLSER_MAXVOLNAME +1];
--- 1965,1971 ----
  {    
          afs_int32 avolid, aserver, apart, code,vcode, err;
  	afs_int32 aoverwrite = ASK;
! 	int restoreflags, readonly = 0, offline = 0, voltype = RWVOL;
  	char prompt;
  	char afilename[NameLen], avolname[VOLSER_MAXVOLNAME +1],apartName[10];
  	char volname[VOLSER_MAXVOLNAME +1];
***************
*** 1922,1927 ****
--- 2005,2015 ----
  		exit(1);
  	    }
  	}
+ 	if (as->parms[6].items) offline = 1;
+ 	if (as->parms[7].items) {
+ 	    readonly = 1;
+ 	    voltype = ROVOL;
+ 	}
  
  	aserver = GetServer(as->parms[0].items->data);
  	if (aserver == 0) {
***************
*** 1968,1984 ****
  	        fprintf(STDERR,"Volume does not exist; Will perform a full restore\n");
  	}
  
! 	else if (Lp_GetRwIndex(&entry) == -1) {	   /* RW volume does not exist - do a full */
! 	   restoreflags = RV_FULLRST;
! 	   if ( (aoverwrite == INC) || (aoverwrite == ABORT) )
! 	      fprintf(STDERR,"RW Volume does not exist; Will perform a full restore\n");
  
! 	   if (avolid == 0) {
! 	      avolid = entry.volumeId[RWVOL];
! 	   }
! 	   else if (entry.volumeId[RWVOL] != 0  && entry.volumeId[RWVOL] != avolid) {
! 	      avolid = entry.volumeId[RWVOL];
! 	   }
  	}
  
  	else {                    /* volume exists - do we do a full incremental or abort */
--- 2056,2074 ----
  	        fprintf(STDERR,"Volume does not exist; Will perform a full restore\n");
  	}
  
! 	else if ((!readonly && Lp_GetRwIndex(&entry) == -1)	   /* RW volume does not exist - do a full */
! 	     ||  (readonly && !Lp_ROMatch(0, 0, &entry))) {	   /* RO volume does not exist - do a full */
! 	    restoreflags = RV_FULLRST;
! 	    if ( (aoverwrite == INC) || (aoverwrite == ABORT) )
! 		fprintf(STDERR,"%s Volume does not exist; Will perform a full restore\n",
! 			readonly ? "RO" : "RW");
  
! 	    if (avolid == 0) {
! 		avolid = entry.volumeId[voltype];
! 	    }
! 	    else if (entry.volumeId[voltype] != 0  && entry.volumeId[voltype] != avolid) {
! 		avolid = entry.volumeId[voltype];
! 	    }
  	}
  
  	else {                    /* volume exists - do we do a full incremental or abort */
***************
*** 1987,1996 ****
  	    char   c, dc;
  
  	    if(avolid == 0) {
! 		avolid = entry.volumeId[RWVOL];
  	    }
! 	    else if(entry.volumeId[RWVOL] != 0  && entry.volumeId[RWVOL] != avolid) {
! 		avolid = entry.volumeId[RWVOL];
  	    }
  	    
  	    /* A file name was specified  - check if volume is on another partition */
--- 2077,2086 ----
  	    char   c, dc;
  
  	    if(avolid == 0) {
! 		avolid = entry.volumeId[voltype];
  	    }
! 	    else if(entry.volumeId[voltype] != 0  && entry.volumeId[voltype] != avolid) {
! 		avolid = entry.volumeId[voltype];
  	    }
  	    
  	    /* A file name was specified  - check if volume is on another partition */
***************
*** 2014,2027 ****
  		/* Ask what to do */
  	        if (vol_elsewhere) {
  		    fprintf(STDERR,"The volume %s %u already exists on a different server/part\n",
! 			    volname, entry.volumeId[RWVOL]);
  		    fprintf(STDERR, 
  			    "Do you want to do a full restore or abort? [fa](a): ");
  		}
  		else
  		{
  		    fprintf(STDERR,"The volume %s %u already exists in the VLDB\n",
! 			    volname, entry.volumeId[RWVOL]);
  		    fprintf(STDERR, 
  			    "Do you want to do a full/incremental restore or abort? [fia](a): ");
  		}
--- 2104,2117 ----
  		/* Ask what to do */
  	        if (vol_elsewhere) {
  		    fprintf(STDERR,"The volume %s %u already exists on a different server/part\n",
! 			    volname, entry.volumeId[voltype]);
  		    fprintf(STDERR, 
  			    "Do you want to do a full restore or abort? [fa](a): ");
  		}
  		else
  		{
  		    fprintf(STDERR,"The volume %s %u already exists in the VLDB\n",
! 			    volname, entry.volumeId[voltype]);
  		    fprintf(STDERR, 
  			    "Do you want to do a full/incremental restore or abort? [fia](a): ");
  		}
***************
*** 2044,2055 ****
  	        restoreflags = 0;
  	        if (vol_elsewhere) {
  		    fprintf(STDERR,
! 			    "RW volume %u already exists on a different server/part; not allowed\n",
! 			    avolid);
  		    exit(1);
  		}
  	    }
  	}
  	code = UV_RestoreVolume(aserver, apart, avolid, avolname,
  				restoreflags, WriteData, afilename);
  	if (code) {
--- 2134,2147 ----
  	        restoreflags = 0;
  	        if (vol_elsewhere) {
  		    fprintf(STDERR,
! 			    "%s volume %u already exists on a different server/part; not allowed\n",
! 			    readonly ? "RO" : "RW", avolid);
  		    exit(1);
  		}
  	    }
  	}
+ 	if (offline)  restoreflags |= RV_OFFLINE;
+ 	if (readonly) restoreflags |= RV_RDONLY;
  	code = UV_RestoreVolume(aserver, apart, avolid, avolname,
  				restoreflags, WriteData, afilename);
  	if (code) {
***************
*** 2167,2173 ****
--- 2259,2301 ----
  	fprintf(STDOUT,"Removed replication site %s %s for volume %s\n",as->parms[0].items->data,apartName,as->parms[2].items->data);
      return 0;
  }
+ static ChangeLocation(as)
+ register struct cmd_syndesc *as;
+ {
+    afs_int32 avolid, aserver, apart,code, err;
+    char apartName[10];
  
+ 	avolid = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
+ 	if (avolid == 0) {
+ 	    if (err) PrintError("", err);
+ 	    else fprintf(STDERR, "vos: can't find volume '%s'\n", as->parms[2].items->data);
+ 	    exit(1);
+ 	}
+ 	aserver = GetServer(as->parms[0].items->data);
+ 	if (aserver == 0) {
+ 	    fprintf(STDERR,"vos: server '%s' not found in host table\n", as->parms[0].items->data);
+ 	    exit(1);
+ 	}
+ 	apart = volutil_GetPartitionID(as->parms[1].items->data);
+ 	if (apart < 0) {
+ 	    fprintf(STDERR,"vos: could not interpret partition name '%s'\n",as->parms[1].items->data );
+ 	    exit(1);
+ 	}
+ 	if (!IsPartValid(apart,aserver,&code)){/*check for validity of the partition */
+ 	    if(code) PrintError("",code);
+ 	    else fprintf(STDERR,"vos : partition %s does not exist on the server\n",as->parms[1].items->data);
+ 	    exit(1);
+ 	}
+ 	code = UV_ChangeLocation(aserver, apart, avolid);
+ 	if (code) {
+ 	    PrintDiagnostics("addsite", code);
+ 	    exit(1);
+ 	}
+ 	MapPartIdIntoName(apart,apartName);
+ 	fprintf(STDOUT,"Changed location to %s %s for volume %s\n",as->parms[0].items->data, apartName,as->parms[2].items->data);
+    return 0;
+ }
+ 
  static ListPartitions(as)
  register struct cmd_syndesc *as;
  {
***************
*** 3799,3804 ****
--- 3927,3934 ----
  	tcell = as->parms[12].items->data;
      if(as->parms[14].items)	/* -serverauth specified */
  	sauth = 1;
+     if(as->parms[16].items)	/* -crypt specified */
+ 	vsu_SetCrypt(1);
      if (code = vsu_ClientInit((as->parms[13].items != 0), confdir, tcell, sauth,
  			      &cstruct, UV_SetSecurity)) {
  	fprintf(STDERR,"could not initialize VLDB library (code=%u) \n",code);
***************
*** 3896,3907 ****
--- 4026,4047 ----
      cmd_AddParm(ts, "-file", CMD_SINGLE,CMD_OPTIONAL, "dump file");
      cmd_AddParm(ts, "-id", CMD_SINGLE,CMD_OPTIONAL,  "volume ID");
      cmd_AddParm(ts, "-overwrite", CMD_SINGLE,CMD_OPTIONAL,  "abort | full | incremental");
+     cmd_AddParm(ts, "-offline", CMD_FLAG, CMD_OPTIONAL,
+ 		"leave restored volume offline");
+     cmd_AddParm(ts, "-readonly", CMD_FLAG, CMD_OPTIONAL,
+ 		"make restored volume read-only");
      COMMONPARMS;
  
      ts = cmd_CreateSyntax("unlock", LockReleaseCmd, 0, "release lock on VLDB entry for a volume");
      cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
      COMMONPARMS;
  
+     ts = cmd_CreateSyntax("changeloc", ChangeLocation, 0, "change an RW volume's location in the VLDB");
+     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name for new location");
+     cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name for new location");
+     cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "volume name or ID");
+     COMMONPARMS;
+ 
      ts = cmd_CreateSyntax("addsite", AddSite, 0, "add a replication site");
      cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name for new site");
      cmd_AddParm(ts, "-partition", CMD_SINGLE, 0, "partition name for new site");
***************
*** 3954,3959 ****
--- 4094,4105 ----
  #endif /* FULL_LISTVOL_SWITCH */
      COMMONPARMS;
      cmd_CreateAlias (ts, "volinfo");
+ 
+     ts = cmd_CreateSyntax("setfields", SetFields, 0, "change volume info fields");
+     cmd_AddParm(ts, "-id",        CMD_SINGLE, 0, "volume name or ID");
+     cmd_AddParm(ts, "-maxquota", CMD_SINGLE, CMD_OPTIONAL, "quota (KB)");
+     cmd_AddParm(ts, "-clearuse",  CMD_FLAG,   CMD_OPTIONAL, "clear dayUse");
+     COMMONPARMS;
  
      ts = cmd_CreateSyntax("offline", volOffline, 0, (char *) CMD_HIDDEN);
      cmd_AddParm(ts, "-server",    CMD_SINGLE, 0, "server name");
Index: openafs/src/volser/vsprocs.c
diff -c openafs/src/volser/vsprocs.c:1.6.2.2 openafs/src/volser/vsprocs.c:1.6.2.3
*** openafs/src/volser/vsprocs.c:1.6.2.2	Wed Sep 19 18:40:45 2001
--- openafs/src/volser/vsprocs.c	Sat Oct 13 00:22:11 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/vsprocs.c,v 1.6.2.2 2001/09/19 22:40:45 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/vsprocs.c,v 1.6.2.3 2001/10/13 04:22:11 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 2561,2567 ****
      int islocked;
      struct restoreCookie cookie;
      int reuseID;
!     afs_int32 newDate, volflag;
      int index, same, errcode;
      char apartName[10];
  
--- 2561,2567 ----
      int islocked;
      struct restoreCookie cookie;
      int reuseID;
!     afs_int32 newDate, volflag, voltype, volsertype;
      int index, same, errcode;
      char apartName[10];
  
***************
*** 2577,2582 ****
--- 2577,2590 ----
      totid = 0;
      temptid = 0;
  
+     if (flags & RV_RDONLY) {
+ 	voltype    = ROVOL;
+ 	volsertype = volser_RO;
+     } else {
+ 	voltype    = RWVOL;
+ 	volsertype = volser_RW;
+     }
+ 
      pvolid = tovolid;
      toconn = UV_Bind(toserver, AFSCONF_VOLUMEPORT);
      if(pvolid == 0) {/*alot a new id if needed */
***************
*** 2589,2596 ****
  		goto refail;
  	    }
  	    reuseID = 0;
!         }
! 	else{
  	    pvolid = entry.volumeId[RWVOL];
        	}
      }/* at this point we have a volume id to use/reuse for the volume to be restored */
--- 2597,2615 ----
  		goto refail;
  	    }
  	    reuseID = 0;
!         } else if (flags & RV_RDONLY) {
! 	    if (entry.flags & RW_EXISTS) {
! 		fprintf(STDERR,"Entry for ReadWrite volume %s already exists!\n",entry.name);
! 		error = VOLSERBADOP;
! 		goto refail;
! 	    }
! 	    if (!entry.volumeId[ROVOL]) {
! 		fprintf(STDERR,"Existing entry for volume %s has no ReadOnly ID\n",tovolname);
! 		error = VOLSERBADOP;
! 		goto refail;
! 	    }
! 	    pvolid = entry.volumeId[ROVOL];
! 	} else {
  	    pvolid = entry.volumeId[RWVOL];
        	}
      }/* at this point we have a volume id to use/reuse for the volume to be restored */
***************
*** 2604,2612 ****
      fprintf(STDOUT,"Restoring volume %s Id %u on server %s partition %s ..", tovolname,
  	    pvolid, hostutil_GetNameByINet(toserver), partName);
      fflush(STDOUT);
!     /*what should the volume be restored as ? rw or ro or bk ?
!       right now the default is rw always */
!     code = AFSVolCreateVolume(toconn, topart, tovolname, volser_RW, 0,&pvolid, &totid);
      if (code){
  	if (flags & RV_FULLRST) { /* full restore: delete then create anew */
  	    if(verbose) {
--- 2623,2629 ----
      fprintf(STDOUT,"Restoring volume %s Id %u on server %s partition %s ..", tovolname,
  	    pvolid, hostutil_GetNameByINet(toserver), partName);
      fflush(STDOUT);
!     code = AFSVolCreateVolume(toconn, topart, tovolname, volsertype, 0,&pvolid, &totid);
      if (code){
  	if (flags & RV_FULLRST) { /* full restore: delete then create anew */
  	    if(verbose) {
***************
*** 2640,2646 ****
  		goto refail;
  	    }
  	    if (verbose) fprintf(STDOUT," done\n");
! 	    code = AFSVolCreateVolume(toconn, topart, tovolname, volser_RW, 0,&pvolid, &totid);
  	    if (code){
  		fprintf(STDERR,"Could not create new volume %u\n",pvolid);
  		error = code;
--- 2657,2663 ----
  		goto refail;
  	    }
  	    if (verbose) fprintf(STDOUT," done\n");
! 	    code = AFSVolCreateVolume(toconn, topart, tovolname, volsertype, 0,&pvolid, &totid);
  	    if (code){
  		fprintf(STDERR,"Could not create new volume %u\n",pvolid);
  		error = code;
***************
*** 2657,2663 ****
  	}
      }
      cookie.parent = pvolid;
!     cookie.type = RWVOL;
      cookie.clone = 0;
      strncpy(cookie.name,tovolname,VOLSER_OLDMAXVOLNAME);
  
--- 2674,2680 ----
  	}
      }
      cookie.parent = pvolid;
!     cookie.type = voltype;
      cookie.clone = 0;
      strncpy(cookie.name,tovolname,VOLSER_OLDMAXVOLNAME);
  
***************
*** 2683,2693 ****
      }
      code = AFSVolGetStatus(toconn,totid, &tstatus);
      if(code) {
! 	fprintf(STDERR,"Could not get status information about the volume %u\n",tovolid);
  	error = code;
  	goto refail;
      }
!     code = AFSVolSetIdsTypes(toconn,totid, tovolname, RWVOL, pvolid,0,0);
      if(code) {
  	fprintf(STDERR,"Could not set the right type and ID on %u\n",pvolid); 
  	error = code;
--- 2700,2710 ----
      }
      code = AFSVolGetStatus(toconn,totid, &tstatus);
      if(code) {
! 	fprintf(STDERR,"Could not get status information about the volume %u\n",pvolid);
  	error = code;
  	goto refail;
      }
!     code = AFSVolSetIdsTypes(toconn,totid, tovolname, voltype, pvolid,0,0);
      if(code) {
  	fprintf(STDERR,"Could not set the right type and ID on %u\n",pvolid); 
  	error = code;
***************
*** 2726,2732 ****
          /* Volume was restored on the file server, update the 
  	 * VLDB to reflect the change.
  	 */
! 	vcode = VLDB_GetEntryByID(pvolid,RWVOL, &entry);
  	if(vcode && vcode != VL_NOENT && vcode != VL_ENTDELETED) {
  	    fprintf(STDERR,"Could not fetch the entry for volume number %u from VLDB \n",pvolid);
  	    error = vcode;
--- 2743,2749 ----
          /* Volume was restored on the file server, update the 
  	 * VLDB to reflect the change.
  	 */
! 	vcode = VLDB_GetEntryByID(pvolid,voltype, &entry);
  	if(vcode && vcode != VL_NOENT && vcode != VL_ENTDELETED) {
  	    fprintf(STDERR,"Could not fetch the entry for volume number %u from VLDB \n",pvolid);
  	    error = vcode;
***************
*** 2740,2748 ****
  	    entry.nServers = 1;
  	    entry.serverNumber[0] = toserver;/*should be indirect */
  	    entry.serverPartition[0] = topart;
! 	    entry.serverFlags[0] = ITSRWVOL;
! 	    entry.flags = RW_EXISTS;
! 	    if(tstatus.cloneID != 0){
  		entry.volumeId[ROVOL] = tstatus.cloneID;/*this should come from status info on the volume if non zero */
  	    }
  	    else
--- 2757,2767 ----
  	    entry.nServers = 1;
  	    entry.serverNumber[0] = toserver;/*should be indirect */
  	    entry.serverPartition[0] = topart;
! 	    entry.serverFlags[0] = (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL;
! 	    entry.flags = (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS;
! 	    if (flags & RV_RDONLY)
! 		entry.volumeId[ROVOL] = pvolid;
! 	    else if(tstatus.cloneID != 0){
  		entry.volumeId[ROVOL] = tstatus.cloneID;/*this should come from status info on the volume if non zero */
  	    }
  	    else
***************
*** 2772,2778 ****
  		EnumerateEntry(&entry);
  		fprintf(STDOUT,"------- New entry -------\n");
  	    }
! 	    vcode = ubik_Call(VL_SetLock,cstruct, 0, pvolid, RWVOL, VLOP_RESTORE);
  	    if(vcode) {
  		fprintf(STDERR,"Could not lock the entry for volume number %u \n",pvolid);
  		error = vcode;
--- 2791,2797 ----
  		EnumerateEntry(&entry);
  		fprintf(STDOUT,"------- New entry -------\n");
  	    }
! 	    vcode = ubik_Call(VL_SetLock,cstruct, 0, pvolid, voltype, VLOP_RESTORE);
  	    if(vcode) {
  		fprintf(STDERR,"Could not lock the entry for volume number %u \n",pvolid);
  		error = vcode;
***************
*** 2782,2793 ****
  	    strcpy(entry.name, tovolname);
  
  	    /* Update the vlentry with the new information */
! 	    index = Lp_GetRwIndex(&entry);
  	    if (index == -1) {
! 	       /* Add the rw site for the volume being restored */
  	       entry.serverNumber[entry.nServers]    = toserver;
  	       entry.serverPartition[entry.nServers] = topart;
! 	       entry.serverFlags[entry.nServers]     = ITSRWVOL;
  	       entry.nServers++;
  	    } else {
  	       /* This volume should be deleted on the old site
--- 2801,2816 ----
  	    strcpy(entry.name, tovolname);
  
  	    /* Update the vlentry with the new information */
! 	    if (flags & RV_RDONLY)
! 		index = Lp_ROMatch(toserver, topart, &entry) - 1;
! 	    else
! 		index = Lp_GetRwIndex(&entry);
  	    if (index == -1) {
! 	       /* Add the new site for the volume being restored */
  	       entry.serverNumber[entry.nServers]    = toserver;
  	       entry.serverPartition[entry.nServers] = topart;
! 	       entry.serverFlags[entry.nServers]     =
! 			(flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL;
  	       entry.nServers++;
  	    } else {
  	       /* This volume should be deleted on the old site
***************
*** 2837,2845 ****
  	       entry.serverPartition[index] = topart;
  	    }
  
! 	    entry.flags |= RW_EXISTS;
  	    MapNetworkToHost(&entry,&storeEntry);
! 	    vcode = VLDB_ReplaceEntry(pvolid,RWVOL, &storeEntry,LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP );
  	    if(vcode) {
  		fprintf(STDERR,"Could not update the entry for volume number %u  \n",pvolid);
  		error = vcode;
--- 2860,2868 ----
  	       entry.serverPartition[index] = topart;
  	    }
  
! 	    entry.flags |= (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS;
  	    MapNetworkToHost(&entry,&storeEntry);
! 	    vcode = VLDB_ReplaceEntry(pvolid,voltype, &storeEntry,LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP );
  	    if(vcode) {
  		fprintf(STDERR,"Could not update the entry for volume number %u  \n",pvolid);
  		error = vcode;
***************
*** 2857,2863 ****
  	  if (!error) error = code;
        }
        if(islocked) {
! 	  vcode = ubik_Call(VL_ReleaseLock,cstruct, 0, pvolid, RWVOL, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
  	  if(vcode) {
  	      fprintf(STDERR,"Could not release lock on the VLDB entry for the volume %u\n",pvolid);
  	      if(!error) error = vcode;
--- 2880,2886 ----
  	  if (!error) error = code;
        }
        if(islocked) {
! 	  vcode = ubik_Call(VL_ReleaseLock,cstruct, 0, pvolid, voltype, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
  	  if(vcode) {
  	      fprintf(STDERR,"Could not release lock on the VLDB entry for the volume %u\n",pvolid);
  	      if(!error) error = vcode;
***************
*** 3062,3067 ****
--- 3085,3139 ----
      return 0;
  }
  
+ /*sets <server> <part> as read/write site for <volid> in the vldb */
+ UV_ChangeLocation(server, part, volid)
+ afs_int32 server, part, volid;
+ {
+     afs_int32 vcode;
+     struct nvldbentry entry,storeEntry;
+     int index;
+ 
+     vcode = ubik_Call(VL_SetLock,cstruct, 0,volid,RWVOL, VLOP_ADDSITE);
+     if(vcode) {
+ 	fprintf(STDERR," Could not lock the VLDB entry for volume %u \n", volid);
+ 	PrintError("",vcode);
+ 	return(vcode);
+     }
+     vcode = VLDB_GetEntryByID(volid,RWVOL, &entry);
+     if(vcode) {
+ 	fprintf(STDERR,"Could not fetch the entry for volume number %u from VLDB \n",volid);
+ 	PrintError("",vcode);
+ 	return (vcode);
+     }
+     MapHostToNetwork(&entry);
+     index = Lp_GetRwIndex(&entry);
+     if (index < 0) {
+ 	/* no RW site exists  */
+ 	fprintf(STDERR,"No existing RW site for volume %u", volid);
+ 	vcode = ubik_Call(VL_ReleaseLock,cstruct, 0, volid, RWVOL, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
+ 	if(vcode) {
+ 	    fprintf(STDERR,"Could not release lock on entry for volume %u \n",volid);
+ 	    PrintError("",vcode);
+ 	    return(vcode);
+ 	}
+ 	return VOLSERBADOP;
+     }
+     else { /* change the RW site */
+ 	entry.serverNumber[index] = server;
+ 	entry.serverPartition[index] = part;
+ 	MapNetworkToHost(&entry,&storeEntry);
+ 	vcode = VLDB_ReplaceEntry(volid,RWVOL,&storeEntry,LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
+ 	if(vcode){ 
+ 	    fprintf(STDERR,"Could not update entry for volume %u \n",volid);
+ 	    PrintError("",vcode);
+ 	    ubik_Call(VL_ReleaseLock,cstruct, 0, volid, RWVOL, LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
+ 	    return(vcode);
+ 	}
+ 	if(verbose) fprintf(STDOUT," done\n");
+     }
+     return 0;
+ }
+ 
  /*list all the partitions on <aserver> */
  UV_ListPartitions(aserver, ptrPartList, cntp)
      afs_int32 aserver;
***************
*** 4911,4919 ****
   error_exit:
    if (tid) {
       rcode = 0;
!      code = AFSVolEndTrans(conn, tid, &code);
       if (code || rcode) {
          fprintf(STDERR, "SetVolumeStatus: EndTrans Failed\n");
  	if (!error) error = (code ? code : rcode);
       }
    }
--- 4983,5031 ----
   error_exit:
    if (tid) {
       rcode = 0;
!      code = AFSVolEndTrans(conn, tid, &rcode);
       if (code || rcode) {
          fprintf(STDERR, "SetVolumeStatus: EndTrans Failed\n");
+ 	if (!error) error = (code ? code : rcode);
+      }
+   }
+ 
+   if (conn) rx_DestroyConnection(conn);
+   return(error);
+ }
+ 
+ UV_SetVolumeInfo(server, partition, volid, infop)
+   afs_int32 server, partition, volid;
+   volintInfo *infop;
+ {
+   struct rx_connection *conn = 0;
+   afs_int32 tid=0;
+   afs_int32 code, error=0, rcode;
+ 
+   conn = UV_Bind(server, AFSCONF_VOLUMEPORT);
+   if (!conn) {
+      fprintf(STDERR, "SetVolumeInfo: Bind Failed");
+      ERROR_EXIT(-1);
+   }
+ 
+   code = AFSVolTransCreate(conn, volid, partition, ITOffline, &tid);
+   if (code) {
+      fprintf(STDERR, "SetVolumeInfo: TransCreate Failed\n");
+      ERROR_EXIT(code);
+   }
+   
+   code = AFSVolSetInfo(conn, tid, infop);
+   if (code) {
+      fprintf(STDERR, "SetVolumeInfo: SetInfo Failed\n");
+      ERROR_EXIT(code);
+   }
+   
+  error_exit:
+   if (tid) {
+      rcode = 0;
+      code = AFSVolEndTrans(conn, tid, &rcode);
+      if (code || rcode) {
+         fprintf(STDERR, "SetVolumeInfo: EndTrans Failed\n");
  	if (!error) error = (code ? code : rcode);
       }
    }
Index: openafs/src/volser/vsutils.c
diff -c openafs/src/volser/vsutils.c:1.7.2.1 openafs/src/volser/vsutils.c:1.7.2.2
*** openafs/src/volser/vsutils.c:1.7.2.1	Wed Sep 19 18:36:36 2001
--- openafs/src/volser/vsutils.c	Sat Oct 13 00:22:11 2001
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/vsutils.c,v 1.7.2.1 2001/09/19 22:36:36 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/vsutils.c,v 1.7.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef AFS_NT40_ENV
***************
*** 45,50 ****
--- 45,51 ----
  #include "lockdata.h"
  
  struct ubik_client *cstruct;
+ static rxkad_level vsu_rxkad_level = rxkad_clear;
  extern int VL_CreateEntry(), VL_CreateEntryN();
  extern int VL_GetEntryByID(), VL_GetEntryByIDN();
  extern int VL_GetEntryByNameO(), VL_GetEntryByNameN();
***************
*** 366,371 ****
--- 367,389 ----
  
  
  /*
+   Set encryption.  If 'cryptflag' is nonzero, encrpytion is turned on
+   for authenticated connections; if zero, encryption is turned off.
+   Calling this function always results in a level of at least rxkad_auth;
+   to get a rxkad_clear connection, simply don't call this.
+ */
+ void vsu_SetCrypt(cryptflag)
+     int cryptflag;
+ {
+   if (cryptflag) {
+     vsu_rxkad_level = rxkad_crypt;
+   } else {
+     vsu_rxkad_level = rxkad_auth;
+   }
+ }
+ 
+ 
+ /*
    Get the appropriate type of ubik client structure out from the system.
  */
  afs_int32 vsu_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp, secproc)
***************
*** 463,469 ****
              break;
            case 2:
              sc = (struct rx_securityClass *)rxkad_NewClientSecurityObject(
!                  rxkad_clear, &ttoken.sessionKey, ttoken.kvno,
                   ttoken.ticketLen, ttoken.ticket);
              break;
            default:
--- 481,487 ----
              break;
            case 2:
              sc = (struct rx_securityClass *)rxkad_NewClientSecurityObject(
!                  vsu_rxkad_level, &ttoken.sessionKey, ttoken.kvno,
                   ttoken.ticketLen, ttoken.ticket);
              break;
            default:
