Index: openafs/src/Makefile
diff -c openafs/src/Makefile:1.4.2.2 openafs/src/Makefile:1.4.2.5
*** openafs/src/Makefile:1.4.2.2	Fri Jan 19 04:29:22 2001
--- openafs/src/Makefile	Tue Mar  6 17:26:48 2001
***************
*** 32,38 ****
  
  all:
  	set ${SYS_NAME}/dest; $(MKDIR_IF_NEEDED)
! 	$(MAKE) install "COMPILE_PART1=cd obj; cd" "COMPILE_PART2=; $(MAKE) install SYS_NAME=${SYS_NAME} DESTDIR=`pwd`/${SYS_NAME}/dest/ SRCDIR=`pwd`/${SYS_NAME}/dest/" SYS_NAME=${SYS_NAME} "WASHTOOL=echo No washtool: "
  
  basics:
  	-if test -f "${WASHTOOL}"; \
--- 32,38 ----
  
  all:
  	set ${SYS_NAME}/dest; $(MKDIR_IF_NEEDED)
! 	$(MAKE) install "COMPILE_PART1=cd obj; cd" "COMPILE_PART2=; $(MAKE) install SYS_NAME=${SYS_NAME} DESTDIR=`pwd`/${SYS_NAME}/dest/ SRCDIR=`pwd`/${SYS_NAME}/dest/" "COMPILE_PART3=; $(MAKE) test SYS_NAME=${SYS_NAME} DESTDIR=`pwd`/${SYS_NAME}/dest/ SRCDIR=`pwd`/${SYS_NAME}/dest/" SYS_NAME=${SYS_NAME} "WASHTOOL=echo No washtool: "
  
  basics:
  	-if test -f "${WASHTOOL}"; \
***************
*** 95,101 ****
  	${COMPILE_PART1} rx ${COMPILE_PART2}
  
  rxtests: rxobj
! 	${COMPILE_PART1} rx ${COMPILE_PART2}
  
  fsint: project kfsint
  
--- 95,101 ----
  	${COMPILE_PART1} rx ${COMPILE_PART2}
  
  rxtests: rxobj
! 	${COMPILE_PART1} rx ${COMPILE_PART3}
  
  fsint: project kfsint
  
***************
*** 138,145 ****
  ubik: project auth 
  	${COMPILE_PART1} ubik ${COMPILE_PART2}
  
  ubiktests: ubik sys
! 	cd obj/ubik; $(MAKE) test SYS_NAME=${SYS_NAME} 
  
  ptserver: project ubik cmd comerr auth audit
  	${COMPILE_PART1} ptserver ${COMPILE_PART2}
--- 138,146 ----
  ubik: project auth 
  	${COMPILE_PART1} ubik ${COMPILE_PART2}
  
+ #	cd obj/ubik; $(MAKE) test SYS_NAME=${SYS_NAME} 
  ubiktests: ubik sys
! 	${COMPILE_PART1} ubik ${COMPILE_PART3}
  
  ptserver: project ubik cmd comerr auth audit
  	${COMPILE_PART1} ptserver ${COMPILE_PART2}
***************
*** 444,450 ****
  # Warning: The next few lines are _extremely_ sensitive to spaces and tabs.
  	${WASHTOOL} object libafs
  	case ${SYS_NAME} in \
! 	alpha_dux4* ) \
  		MKAFS_OSTYPE=DUX;; \
  	hp_ux* ) \
  		MKAFS_OSTYPE=HPUX;; \
--- 445,451 ----
  # Warning: The next few lines are _extremely_ sensitive to spaces and tabs.
  	${WASHTOOL} object libafs
  	case ${SYS_NAME} in \
! 	alpha_dux* ) \
  		MKAFS_OSTYPE=DUX;; \
  	hp_ux* ) \
  		MKAFS_OSTYPE=HPUX;; \
***************
*** 475,481 ****
  		MKAFS_OSTYPE=AIX;; \
  	sun4x_5* ) \
  		MKAFS_OSTYPE=SOLARIS;; \
! 	alpha_dux4* ) \
  		MKAFS_OSTYPE=DUX;; \
  	sgi_6* ) \
  		MKAFS_OSTYPE=IRIX;; \
--- 476,482 ----
  		MKAFS_OSTYPE=AIX;; \
  	sun4x_5* ) \
  		MKAFS_OSTYPE=SOLARIS;; \
! 	alpha_dux* ) \
  		MKAFS_OSTYPE=DUX;; \
  	sgi_6* ) \
  		MKAFS_OSTYPE=IRIX;; \
***************
*** 522,533 ****
  	- /bin/rm -rf @sys/dest/* ;
  	- /bin/mkdir @sys/obj ;
  	echo "Create the obj directories"
  	cd src; \
  	for file in `find [!NW]* -type d -print` ; do \
! 		/bin/mkdir ../obj/$${file} ; \
  	done;
  	echo "Create the obj file links"
  	cd src; \
  	for file in `find [!NW]* -type f -print` ; do \
! 		/bin/ln -s `pwd`/$${file} ../obj/$${file} ; \
  	done;
--- 523,536 ----
  	- /bin/rm -rf @sys/dest/* ;
  	- /bin/mkdir @sys/obj ;
  	echo "Create the obj directories"
+ 	here=`pwd` ; \
  	cd src; \
  	for file in `find [!NW]* -type d -print` ; do \
! 		/bin/mkdir $${here}/obj/$${file} ; \
  	done;
  	echo "Create the obj file links"
+ 	here=`pwd` ; \
  	cd src; \
  	for file in `find [!NW]* -type f -print` ; do \
! 		/bin/ln -s `pwd`/$${file} $${here}/obj/$${file} ; \
  	done;
Index: openafs/src/README
diff -c openafs/src/README:1.4 openafs/src/README:1.4.2.3
*** openafs/src/README:1.4	Sat Dec  2 13:06:26 2000
--- openafs/src/README	Tue Mar  6 17:16:18 2001
***************
*** 10,28 ****
  
  A. Creating the proper directory structure.
  
!    Uncompress the source into a directory of your choice.
!    Preferrably, afs space. In the directory that you uncompressed the
!    source in, you will only have an src directory.
! 	
     1. Make a directory for each system type that you plan on
        building. Current tested system types include the following
       (this step is skipped for the i386_nt40 system type):
  
        alpha_dux40/
        i386_linux22/
        rs_aix42/
        sun4x_56/
        sun4x_57/
  
        Example:
        % mkdir i386_linux22
--- 10,32 ----
  
  A. Creating the proper directory structure.
  
!    Uncompress the source into a directory of your choice. A directory
!    in afs space is also valid. In the directory that you uncompressed the
!    source in, you will only have an src/ directory.
! 
     1. Make a directory for each system type that you plan on
        building. Current tested system types include the following
       (this step is skipped for the i386_nt40 system type):
  
        alpha_dux40/
+       alpha_dux50/ (only tested on 5.0A)
        i386_linux22/
+       i386_linux24/ (only tested with 2.4.0 kernel)
        rs_aix42/
+       sgi_65/ (file server not tested)
        sun4x_56/
        sun4x_57/
+       sun4x_58/
  
        Example:
        % mkdir i386_linux22
***************
*** 32,38 ****
        Builds for the following platforms will not fully compile:
  
        hp_ux110/
-       sgi_65/
  
     2. Within each of those directories, create a dest/ and obj/ directory.
  
--- 36,41 ----
***************
*** 41,71 ****
        % mkdir i386_linux22/obj
  
     3. Create symbolic links to the system type you are about to build
  
!       Example:
!       % ln -s @sys/dest dest
!       % ln -s @sys/obj  obj
!       % ls -CF
!       Makefile@     dest@     i386_linux22/     obj@     src/
! 
!    4. If this source is NOT in AFS space, You must make a link from
!       @sys to your current system type. 
  
!       Example:
!       % ln -s i386_linux22 @sys
  
!       Within AFS space, the AFS Cache Manager automatically
!       substitutes the local machine's AFS system name (CPU/operating
!       system type [ie: alpha_dux40, i386_linux22, ...]) for the @sys
!       variable.
  
     5. Create the top level Makefile:
-       a. For LINUX and UNIX versions
  
           Example:
           % ln -s src/Makefile Makefile
           % ls -CF
!          Makefile@     i386_linux22/     src/
  
  B  Building
  
--- 44,78 ----
        % mkdir i386_linux22/obj
  
     3. Create symbolic links to the system type you are about to build
+       a. If the source is in AFS space
  
!          Example:
!          % ln -s @sys/dest dest
!          % ln -s @sys/obj  obj
!          % ls -CF
!          dest@     i386_linux22/     obj@     src/
  
!          Within AFS space, the AFS Cache Manager automatically
!          substitutes the local machine's AFS system name (CPU/operating
!          system type [ie: alpha_dux40, i386_linux22, ...]) for the @sys
!          variable.
  
!       b. If this source is NOT in AFS space, You must make a link from
!          @sys to your current system type. 
  
+          Example:
+          % ln -s i386_linux22 @sys
+          % ln -s @sys/dest dest
+          % ln -s @sys/obj  obj
+          % ls -CF
+          dest@     i386_linux22/     obj@     src/     sys@
+  
     5. Create the top level Makefile:
  
           Example:
           % ln -s src/Makefile Makefile
           % ls -CF
!          Makefile@     dest@     i386_linux22/     obj@     src/
  
  B  Building
  
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.2 openafs/src/WINNT/afsd/smb3.c:1.2.2.1
*** openafs/src/WINNT/afsd/smb3.c:1.2	Sat Nov  4 05:01:44 2000
--- openafs/src/WINNT/afsd/smb3.c	Tue Mar  6 16:21:09 2001
***************
*** 2367,2373 ****
           * we're supposed to close the search if we're done, and we're done,
           * or if something went wrong, close the search.
           */
!         if ((searchFlags & 1) || ((searchFlags & 2) && eos)
          	|| code != 0) smb_DeleteDirSearch(dsp);
  	if (code)
          	smb_SendTran2Error(vcp, p, opx, code);
--- 2367,2374 ----
           * we're supposed to close the search if we're done, and we're done,
           * or if something went wrong, close the search.
           */
!         /* ((searchFlags & 1) || ((searchFlags & 2) && eos) */
! 	if ((searchFlags & 1) || (returnedNames == 0)
          	|| code != 0) smb_DeleteDirSearch(dsp);
  	if (code)
          	smb_SendTran2Error(vcp, p, opx, code);
Index: openafs/src/WINNT/afssvrmgr/svc_create.cpp
diff -c openafs/src/WINNT/afssvrmgr/svc_create.cpp:1.2 openafs/src/WINNT/afssvrmgr/svc_create.cpp:1.2.2.1
*** openafs/src/WINNT/afssvrmgr/svc_create.cpp:1.2	Sat Nov  4 05:02:10 2000
--- openafs/src/WINNT/afssvrmgr/svc_create.cpp	Tue Mar  6 16:44:15 2001
***************
*** 139,145 ****
  
  void Services_Create_OnType (HWND hDlg)
  {
!    SERVICETYPE type;
     if (IsDlgButtonChecked (hDlg, IDC_SVC_TYPE_FS))
        type = SERVICETYPE_FS;
     else if (IsDlgButtonChecked (hDlg, IDC_SVC_TYPE_CRON))
--- 139,145 ----
  
  void Services_Create_OnType (HWND hDlg)
  {
!    AFSSERVICETYPE type;
     if (IsDlgButtonChecked (hDlg, IDC_SVC_TYPE_FS))
        type = SERVICETYPE_FS;
     else if (IsDlgButtonChecked (hDlg, IDC_SVC_TYPE_CRON))
Index: openafs/src/WINNT/client_config/drivemap.cpp
diff -c openafs/src/WINNT/client_config/drivemap.cpp:1.3 openafs/src/WINNT/client_config/drivemap.cpp:1.3.2.1
*** openafs/src/WINNT/client_config/drivemap.cpp:1.3	Tue Nov  7 10:44:17 2000
--- openafs/src/WINNT/client_config/drivemap.cpp	Tue Mar  6 16:02:08 2001
***************
*** 684,692 ****
        lstrcpy (pszTarget, (fWantAFS) ? TEXT("/afs") : TEXT(""));
     else if ((*pszSource != TEXT('/')) && (*pszSource != TEXT('\\')))
        wsprintf (pszTarget, TEXT("/afs/%s"), pszSource);
!    else if (fWantAFS && lstrncmpi (&pszSource[1], TEXT("afs"), 3))
        wsprintf (pszTarget, TEXT("/afs%s"), pszSource);
!    else if (!fWantAFS && !lstrncmpi (&pszSource[1], TEXT("afs"), 3))
        lstrcpy (pszTarget, &pszSource[4]);
     else
        lstrcpy (pszTarget, pszSource);
--- 684,697 ----
        lstrcpy (pszTarget, (fWantAFS) ? TEXT("/afs") : TEXT(""));
     else if ((*pszSource != TEXT('/')) && (*pszSource != TEXT('\\')))
        wsprintf (pszTarget, TEXT("/afs/%s"), pszSource);
!    // We don't want to strip afs off the start if it is part of something for example afscell.company.com
!    else if (fWantAFS && (lstrncmpi (&pszSource[1], TEXT("afs"), 3)) || !((pszSource[4] == TEXT('/')) ||
!                                                                          (pszSource[4] == TEXT('\\')) ||
!                                                                          (lstrlen(pszSource) == 4)))
        wsprintf (pszTarget, TEXT("/afs%s"), pszSource);
!    else if (!fWantAFS && (!lstrncmpi (&pszSource[1], TEXT("afs"), 3) || ((pszSource[4] == TEXT('/')) ||
!                                                                         (pszSource[4] == TEXT('\\')) ||
!                                                                         (lstrlen(pszSource) == 4))))
        lstrcpy (pszTarget, &pszSource[4]);
     else
        lstrcpy (pszTarget, pszSource);
Index: openafs/src/afs/afs_osi.c
diff -c openafs/src/afs/afs_osi.c:1.2 openafs/src/afs/afs_osi.c:1.2.2.1
*** openafs/src/afs/afs_osi.c:1.2	Sat Nov  4 05:03:12 2000
--- openafs/src/afs/afs_osi.c	Tue Mar  6 16:24:01 2001
***************
*** 713,718 ****
--- 713,725 ----
  void afs_osi_TraverseProcTable()
  {
      struct pid_entry *pe;
+ #ifdef AFS_DUX50_ENV
+ extern struct pid_entry *pidtab;
+ extern int npid; 
+ #define pidNPID (pidtab + npid)
+ #define PID_LOCK()
+ #define PID_UNLOCK()
+ #endif
      PID_LOCK();
      for (pe = pidtab; pe < pidNPID; ++pe) {
         if (pe->pe_proc != PROC_NULL)
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.4.2.5 openafs/src/afs/afs_pioctl.c:1.4.2.6
*** openafs/src/afs/afs_pioctl.c:1.4.2.5	Fri Jan 19 04:52:21 2001
--- openafs/src/afs/afs_pioctl.c	Tue Mar  6 16:38:25 2001
***************
*** 61,66 ****
--- 61,67 ----
  static int PGetCPrefs(), PSetCPrefs(); /* client network addresses */
  static int PGetInitParams(), PFlushMount(), PRxStatProc(), PRxStatPeer();
  static int PGetRxkcrypt(), PSetRxkcrypt();
+ static int PPrefetchFromTape(), PResidencyCmd();
  int PExportAfs();
  
  static int HandleClientContext(struct afs_ioctl *ablob, int *com, struct AFS_UCRED **acred, struct AFS_UCRED *credp);
***************
*** 134,139 ****
--- 135,142 ----
    PNoop,			/* 63 -- arla: print xfs status */
    PNoop,			/* 64 -- arla: force cache check */
    PNoop,			/* 65 -- arla: break callback */
+   PPrefetchFromTape,            /* 66 -- MR-AFS: prefetch file from tape */
+   PResidencyCmd,                /* 67 -- MR-AFS: generic commnd interface */
  };
  
  #define PSetClientContext 99	/*  Special pioctl to setup caller's creds  */
***************
*** 3555,3557 ****
--- 3558,3720 ----
      return code;
  }
  
+ static PPrefetchFromTape(avc, afun, areq, ain, aout, ainSize, aoutSize)
+   struct vcache *avc;
+   int afun;
+   struct vrequest *areq;
+   char *ain, *aout;
+   afs_int32 ainSize;
+   afs_int32 *aoutSize;  /* set this */
+ {
+     register afs_int32 code, code1;
+     afs_int32 bytes;
+     struct conn *tc;
+     struct rx_call *tcall;
+     struct AFSVolSync tsync;
+     struct AFSFetchStatus OutStatus;
+     struct AFSCallBack CallBack;
+     struct VenusFid tfid;
+     struct AFSFid *Fid;
+     struct vcache *tvc;
+     XSTATS_DECLS;
+ 
+     AFS_STATCNT(PSetAcl);
+     if (!avc)
+       return EINVAL;
+ 
+     if (ain && (ainSize == 3 * sizeof(afs_int32)))
+         Fid = (struct AFSFid *) ain;
+     else
+         Fid = &avc->fid.Fid;
+     tfid.Cell = avc->fid.Cell;
+     tfid.Fid.Volume = Fid->Volume;
+     tfid.Fid.Vnode = Fid->Vnode;
+     tfid.Fid.Unique = Fid->Unique;
+ 
+     tvc = afs_GetVCache(&tfid, areq, (afs_int32 *)0, (struct vcache *)0,
+                                 WRITE_LOCK);
+     if (!tvc) {
+         afs_Trace3(afs_iclSetp, CM_TRACE_PREFETCHCMD,
+                 ICL_TYPE_POINTER, tvc,
+                 ICL_TYPE_FID, &tfid,
+                 ICL_TYPE_FID, &avc->fid);
+         return ENOENT;
+     }
+     afs_Trace3(afs_iclSetp, CM_TRACE_PREFETCHCMD,
+                 ICL_TYPE_POINTER, tvc,
+                 ICL_TYPE_FID, &tfid,
+                 ICL_TYPE_FID, &tvc->fid);
+ 
+     do {
+         tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK);
+         if (tc) {
+ 
+ #ifdef RX_ENABLE_LOCKS
+             AFS_GUNLOCK();
+ #endif /* RX_ENABLE_LOCKS */
+             tcall = rx_NewCall(tc->id);
+             code = StartRXAFS_FetchData(tcall,
+                                 (struct AFSFid *) &tvc->fid.Fid, 0, 0);
+             if (!code) {
+                 bytes = rx_Read(tcall, (char *) aout, sizeof(afs_int32));
+                 code = EndRXAFS_FetchData(tcall, &OutStatus, &CallBack, &tsync);
+             }
+             code1 = rx_EndCall(tcall, code);
+ #ifdef RX_ENABLE_LOCKS
+             AFS_GLOCK();
+ #endif /* RX_ENABLE_LOCKS */
+         } else
+             code = -1;
+     } while
+         (afs_Analyze(tc, code, &tvc->fid, areq, 
+ 		AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK, 
+ 		(struct cell *)0));
+     /* This call is done only to have the callback things handled correctly */
+     afs_FetchStatus(tvc, &tfid, areq, &OutStatus);
+     afs_PutVCache(tvc, WRITE_LOCK);
+ 
+     if (!code) {
+         *aoutSize = sizeof(afs_int32);
+     }
+     return code;
+ }
+ 
+ static PResidencyCmd(avc, afun, areq, ain, aout, ainSize, aoutSize)
+ struct vcache *avc;
+ int afun;
+ struct vrequest *areq;
+ char *ain, *aout;
+ afs_int32 ainSize;
+ afs_int32 *aoutSize;        /* set this */
+ {
+     register afs_int32 code;
+     struct conn *tc;
+     struct vcache *tvc;
+     struct ResidencyCmdInputs *Inputs;
+     struct ResidencyCmdOutputs *Outputs;
+     struct VenusFid tfid;
+     struct AFSFid *Fid;
+ 
+     Inputs = (struct ResidencyCmdInputs *) ain;
+     Outputs = (struct ResidencyCmdOutputs *) aout;
+     if (!avc) return EINVAL;
+     if (!ain || ainSize != sizeof(struct ResidencyCmdInputs)) return EINVAL;
+ 
+     Fid = &Inputs->fid;
+     if (!Fid->Volume)
+         Fid = &avc->fid.Fid;
+ 
+     tfid.Cell = avc->fid.Cell;
+     tfid.Fid.Volume = Fid->Volume;
+     tfid.Fid.Vnode = Fid->Vnode;
+     tfid.Fid.Unique = Fid->Unique;
+ 
+     tvc = afs_GetVCache(&tfid, areq, (afs_int32 *)0, (struct vcache *)0,
+                                 WRITE_LOCK);
+     afs_Trace3(afs_iclSetp, CM_TRACE_RESIDCMD,
+                 ICL_TYPE_POINTER, tvc,
+                 ICL_TYPE_INT32, Inputs->command,
+                 ICL_TYPE_FID, &tfid);
+     if (!tvc)
+         return ENOENT;
+ 
+     if (Inputs->command) {
+         do {
+             tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK);
+             if (tc) {
+ #ifdef RX_ENABLE_LOCKS
+                 AFS_GUNLOCK();
+ #endif /* RX_ENABLE_LOCKS */
+                 code = RXAFS_ResidencyCmd(tc->id, Fid,
+                                  Inputs,
+                                  (struct ResidencyCmdOutputs *) aout);
+ #ifdef RX_ENABLE_LOCKS
+                 AFS_GLOCK();
+ #endif /* RX_ENABLE_LOCKS */
+             } else
+                 code = -1;
+         } while
+           (afs_Analyze(tc, code, &tvc->fid, areq, 
+ 		AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK,
+                 (struct cell *)0));
+        /* This call is done to have the callback things handled correctly */
+        afs_FetchStatus(tvc, &tfid, areq, &Outputs->status);
+     } else { /* just a status request, return also link data */
+         code = 0;
+         Outputs->code = afs_FetchStatus(tvc, &tfid, areq, &Outputs->status);
+         Outputs->chars[0] = 0;
+         if (vType(tvc) == VLNK) {
+             ObtainWriteLock(&tvc->lock,555);
+             if (afs_HandleLink(tvc, areq) == 0)
+                 strncpy((char *) &Outputs->chars, tvc->linkData, MAXCMDCHARS);
+             ReleaseWriteLock(&tvc->lock);
+         }
+     }
+ 
+     afs_PutVCache(tvc, WRITE_LOCK);
+ 
+     if (!code) {
+         *aoutSize = sizeof(struct ResidencyCmdOutputs);
+     }
+     return code;
+ }                                  
Index: openafs/src/afs/afs_stats.h
diff -c openafs/src/afs/afs_stats.h:1.2 openafs/src/afs/afs_stats.h:1.2.2.1
*** openafs/src/afs/afs_stats.h:1.2	Sat Nov  4 05:03:14 2000
--- openafs/src/afs/afs_stats.h	Tue Mar  6 16:38:26 2001
***************
*** 838,843 ****
--- 838,844 ----
  #define AFS_STATS_FS_RPCIDX_XSTATSVERSION	26
  #define AFS_STATS_FS_RPCIDX_GETXSTATS		27
  #define AFS_STATS_FS_RPCIDX_XLOOKUP             28
+ #define AFS_STATS_FS_RPCIDX_RESIDENCYRPCS       29
  
  #define AFS_STATS_NUM_FS_RPC_OPS		29
  
Index: openafs/src/afs/afs_trace.et
diff -c openafs/src/afs/afs_trace.et:1.2 openafs/src/afs/afs_trace.et:1.2.2.1
*** openafs/src/afs/afs_trace.et:1.2	Sat Nov  4 05:03:14 2000
--- openafs/src/afs/afs_trace.et	Tue Mar  6 16:38:27 2001
***************
*** 127,131 ****
--- 127,133 ----
  	ec	CM_TRACE_READPAGE, "Ireadpage ip 0x%lx pp 0x%x count 0x%x code %x"
  	ec	CM_TRACE_UPDATEPAGE, "Iupdatepage ip 0x%lx pp 0x%x count 0x%x code %d"
  	ec	CM_TRACE_VM_CLOSE, "VMclose ip 0x%lx mapcnt %d opens %d XoW %d"
+ 	ec      CM_TRACE_PREFETCHCMD, "PrefetchCmd tvc 0x%x tfid (%d:%d.%d.%d) fid (%d:%d.%d.%d)"
+ 	ec      CM_TRACE_RESIDCMD, "ResidencyCmd tvc 0x%x command %d fid (%d:%d.%d.%d)"
  end
  
Index: openafs/src/afs/sysincludes.h
diff -c openafs/src/afs/sysincludes.h:1.3 openafs/src/afs/sysincludes.h:1.3.2.1
*** openafs/src/afs/sysincludes.h:1.3	Sat Dec  2 12:41:44 2000
--- openafs/src/afs/sysincludes.h	Tue Mar  6 16:11:16 2001
***************
*** 79,85 ****
--- 79,88 ----
  #ifdef AFS_SGI64_ENV
  #include <ksys/behavior.h>
  #endif /* AFS_SGI64_ENV */
+ #include "../fs/efs_inode.h"
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  #include "../sgiefs/efs.h"
+ #endif
  #include "../sys/kmem.h"
  #include "../sys/cred.h"
  #include "../sys/resource.h"
Index: openafs/src/afs/DUX/osi_inode.c
diff -c openafs/src/afs/DUX/osi_inode.c:1.2 openafs/src/afs/DUX/osi_inode.c:1.2.2.2
*** openafs/src/afs/DUX/osi_inode.c:1.2	Sat Nov  4 05:03:19 2000
--- openafs/src/afs/DUX/osi_inode.c	Tue Mar  6 16:41:24 2001
***************
*** 56,61 ****
--- 56,64 ----
  		}
  		MOUNTLIST_LOCK();
  	    }
+ #ifdef AFS_DUX50_ENV
+ #define m_next m_nxt
+ #endif
  	    mp = mp->m_next;
  	} while (mp != rootfs);
  	MOUNTLIST_UNLOCK();
***************
*** 212,217 ****
--- 215,223 ----
      int fd;
      extern struct fileops vnops;
      register int code;
+ #ifdef AFS_DUX50_ENV
+     struct ufile_entry *fe;
+ #endif
      
      AFS_STATCNT(afs_syscall_iopen);
      
***************
*** 222,231 ****
--- 228,244 ----
      if (code) {
  	return(code);
      }
+ #ifdef AFS_DUX50_ENV
+     if ((code = falloc(&fp, &fd, &fe)) != 0) {
+         iput(ip);
+         return(code);
+     }
+ #else
      if ((code = falloc(&fp, &fd)) != 0) {
  	iput(ip);
  	return(code);
      }
+ #endif
      IN_UNLOCK(ip);
      
      FP_LOCK(fp);
***************
*** 235,241 ****
--- 248,258 ----
      fp->f_data = (caddr_t)ITOV(ip);
      
      FP_UNLOCK(fp);
+ #ifdef AFS_DUX50_ENV
+     u_set_fe(fd, fe, fp, &u.u_file_state);
+ #else
      U_FD_SET(fd, fp, &u.u_file_state);
+ #endif
      *retval = fd;
      return(0);
  }
Index: openafs/src/afs/DUX/osi_vfsops.c
diff -c openafs/src/afs/DUX/osi_vfsops.c:1.2 openafs/src/afs/DUX/osi_vfsops.c:1.2.2.2
*** openafs/src/afs/DUX/osi_vfsops.c:1.2	Sat Nov  4 05:03:19 2000
--- openafs/src/afs/DUX/osi_vfsops.c	Tue Mar  6 17:20:16 2001
***************
*** 200,205 ****
--- 200,213 ----
  }
  
  
+ #ifdef AFS_DUX50_ENV
+ int mp_afs_smoothsync(struct mount *mp, u_int age, u_int smsync_flag)
+ {
+     AFS_STATCNT(afs_sync);
+     return 0;
+ }
+ #endif
+ 
  int mp_afs_fhtovp(struct mount *afsp, struct fid *fidp, struct vnode **avcp)
  {
      struct vrequest treq;
***************
*** 350,356 ****
      mp_afs_vptofh,
      mp_Afs_init,
      mp_afs_mountroot,
!     mp_afs_swapvp
  };
  
  
--- 358,367 ----
      mp_afs_vptofh,
      mp_Afs_init,
      mp_afs_mountroot,
!     mp_afs_swapvp,
! #ifdef AFS_DUX50_ENV
!     mp_afs_smoothsync
! #endif
  };
  
  
***************
*** 469,476 ****
--- 480,491 ----
      
      AFS_GLOCK();
      sysent[AFS_SYSCALL].sy_call = afs3_syscall;
+ #ifdef SY_NARG
+     sysent[AFS_SYSCALL].sy_info = 6;
+ #else
      sysent[AFS_SYSCALL].sy_parallel = 0;
      sysent[AFS_SYSCALL].sy_narg = 6;
+ #endif
      sysent[SYS_setgroups].sy_call = Afs_xsetgroups;
      afs_xioctl_func = afsxioctl;    
      afs_xsetgroups_func = afsxsetgroups;
Index: openafs/src/afs/DUX/osi_vnodeops.c
diff -c openafs/src/afs/DUX/osi_vnodeops.c:1.2 openafs/src/afs/DUX/osi_vnodeops.c:1.2.2.1
*** openafs/src/afs/DUX/osi_vnodeops.c:1.2	Sat Nov  4 05:03:20 2000
--- openafs/src/afs/DUX/osi_vnodeops.c	Tue Mar  6 16:24:06 2001
***************
*** 40,45 ****
--- 40,46 ----
  int mp_afs_page_read(), mp_afs_page_write(), mp_afs_swap(), mp_afs_bread();
  int mp_afs_brelse(), mp_afs_lockctl(), mp_afs_syncdata(), mp_afs_close();
  int mp_afs_closex();
+ int mp_afs_ioctl();
  
  /* AFS vnodeops */
  struct vnodeops Afs_vnodeops = {
***************
*** 53,59 ****
  	mp_afs_setattr,
  	mp_afs_ubcrdwr,
  	mp_afs_ubcrdwr,
! 	afs_badop,	/* vn_ioctl */
  	seltrue,	/* vn_select */
  	mp_afs_mmap,
  	mp_afs_fsync,
--- 54,60 ----
  	mp_afs_setattr,
  	mp_afs_ubcrdwr,
  	mp_afs_ubcrdwr,
! 	mp_afs_ioctl,	/* vn_ioctl */
  	seltrue,	/* vn_select */
  	mp_afs_mmap,
  	mp_afs_fsync,
***************
*** 510,517 ****
--- 511,523 ----
  	flags = 0;
  	ReleaseWriteLock(&avc->lock);
  	AFS_GUNLOCK();
+ #ifdef AFS_DUX50_ENV
  	code = ubc_lookup(((struct vnode *)avc)->v_object, pageBase,
+ 			  PAGE_SIZE, PAGE_SIZE, &page, &flags, NULL);
+ #else
+ 	code = ubc_lookup(((struct vnode *)avc)->v_object, pageBase,
  			  PAGE_SIZE, PAGE_SIZE, &page, &flags);
+ #endif
  	AFS_GLOCK();
  	ObtainWriteLock(&avc->lock,163);
  
***************
*** 561,569 ****
  	}
  	AFS_GUNLOCK();
  	ubc_page_wait(page);
! 	data = (char *)page->pg_addr; /* DUX 4.0D */
! 	if (data == 0)
!             data = (char *)PHYS_TO_KSEG(page->pg_phys_addr);  /* DUX 4.0E */
  	AFS_GLOCK();
  	ReleaseWriteLock(&avc->lock);	/* uiomove may page fault */
  	AFS_GUNLOCK();
--- 567,573 ----
  	}
  	AFS_GUNLOCK();
  	ubc_page_wait(page);
!         data = ubc_load(page, pageOffset, page_size);
  	AFS_GLOCK();
  	ReleaseWriteLock(&avc->lock);	/* uiomove may page fault */
  	AFS_GUNLOCK();
***************
*** 666,671 ****
--- 670,681 ----
      return code;
  }
  
+ int
+ mp_afs_ioctl(struct vnode *vp, int com, caddr_t data, int fflag,
+ 	     struct ucred *cred, int *retval)
+ {
+   return ENOSYS;
+ }
  
  /*
   * Now for some bad news.  Since we artificially hold on to vnodes by doing
***************
*** 724,738 ****
  }
  
  
! int mp_afs_getpage(vop, offset, len, protp, pl, plsz, mape, addr, rw, cred)
      vm_ubc_object_t vop;
      vm_offset_t offset;
      vm_size_t len;
      vm_prot_t *protp;
      vm_page_t *pl;
      int plsz;
      vm_map_entry_t mape;
      vm_offset_t addr;
      int rw;
      struct ucred *cred;
  {
--- 734,758 ----
  }
  
  
! int mp_afs_getpage(vop, offset, len, protp, pl, plsz, 
! #ifdef AFS_DUX50_ENV
! 		   policy,
! #else
! 		   mape, addr, 
! #endif
! 		   rw, cred)
      vm_ubc_object_t vop;
      vm_offset_t offset;
      vm_size_t len;
      vm_prot_t *protp;
      vm_page_t *pl;
      int plsz;
+ #ifdef AFS_DUX50_ENV
+     struct vm_policy *policy;
+ #else
      vm_map_entry_t mape;
      vm_offset_t addr;
+ #endif
      int rw;
      struct ucred *cred;
  {
***************
*** 774,781 ****
--- 794,806 ----
  	flags = 0;
  	ReleaseWriteLock(&avc->lock);
  	AFS_GUNLOCK();
+ #ifdef AFS_DUX50_ENV
  	code = ubc_lookup(((struct vnode *)avc)->v_object, off,
+ 			PAGE_SIZE, PAGE_SIZE, pagep, &flags, NULL);
+ #else
+ 	code = ubc_lookup(((struct vnode *)avc)->v_object, off,
  			PAGE_SIZE, PAGE_SIZE, pagep, &flags);
+ #endif
  	AFS_GLOCK();
  	ObtainWriteLock(&avc->lock,168);
  	if (code) {
***************
*** 815,821 ****
--- 840,850 ----
  	}
  	if ((rw & B_READ) == 0) {
  	    AFS_GUNLOCK();
+ #ifdef AFS_DUX50_ENV
+ 	    ubc_page_dirty(pl[i], 0);
+ #else
  	    ubc_page_dirty(pl[i]);
+ #endif
  	    AFS_GLOCK();
  	} else {
  	    if (protp && (flags & B_DIRTY) == 0) {
***************
*** 1045,1050 ****
--- 1074,1094 ----
          return TRUE;
  }
  
+ #ifdef AFS_DUX50_ENV
+ int
+ mp_afs_objtovp(vm_ubc_object_t vop, struct vnode **vp)
+ {
+   *vp = vop->vu_vp;
+   return 0;
+ }
+ 
+ int
+ mp_afs_setpgstamp(vm_page_t pp, unsigned int tick)
+ {
+   pp->pg_stamp = tick;
+   return 0;
+ }
+ #endif
  
  
  struct vfs_ubcops afs_ubcops = {
***************
*** 1053,1058 ****
--- 1097,1106 ----
          mp_afs_getpage,            /* get page */
          mp_afs_putpage,            /* put page */
          mp_afs_write_check,        /* check writablity */
+ #ifdef AFS_DUX50_ENV
+         mp_afs_objtovp,            /* get vnode pointer */
+         mp_afs_setpgstamp          /* set page stamp */
+ #endif
  };
  
  
Index: openafs/src/afs/IRIX/osi_file.c
diff -c openafs/src/afs/IRIX/osi_file.c:1.2 openafs/src/afs/IRIX/osi_file.c:1.2.2.1
*** openafs/src/afs/IRIX/osi_file.c:1.2	Sat Nov  4 05:03:22 2000
--- openafs/src/afs/IRIX/osi_file.c	Tue Mar  6 16:11:18 2001
***************
*** 23,28 ****
--- 23,29 ----
   * now vectors to the correct EFS or XFS function. If new functionality is
   * added which accesses the inode, that will also need EFS/XFS variants.
   */
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  vnode_t *afs_EFSIGetVnode(ino_t ainode)
  {
      struct inode *ip;
***************
*** 39,44 ****
--- 40,46 ----
      iunlock(ip);
      return (EFS_ITOV(ip));
  }    
+ #endif /* AFS_SGI_EFS_IOPS_ENV */
  
  vnode_t *afs_XFSIGetVnode(ino_t ainode)
  {
***************
*** 142,147 ****
--- 144,150 ----
      return code;
  }
  
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  void osi_DisableAtimes(avp)
  struct vnode *avp;
  {
***************
*** 152,157 ****
--- 155,161 ----
     }
  
  }
+ #endif /* AFS_SGI_EFS_IOPS_ENV */
  
  
  /* Generic read interface */
***************
*** 185,191 ****
--- 189,197 ----
      if (code == 0) {
  	code = asize - resid;
  	afile->offset += code;
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  	osi_DisableAtimes(afile->vnode);
+ #endif /* AFS_SGI_EFS_IOPS_ENV */
      }
      else {
  	afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
Index: openafs/src/afs/IRIX/osi_inode.c
diff -c openafs/src/afs/IRIX/osi_inode.c:1.2 openafs/src/afs/IRIX/osi_inode.c:1.2.2.3
*** openafs/src/afs/IRIX/osi_inode.c:1.2	Sat Nov  4 05:03:22 2000
--- openafs/src/afs/IRIX/osi_inode.c	Tue Mar  6 16:20:00 2001
***************
*** 166,172 ****
  	return ENOSYS;
  #endif
  
!     if (error = iget(vfstom(vfsp), (unsigned int)(inode&0xffffffff), &ip)) {
  	return error;
      }
      *ipp = ip;
--- 166,173 ----
  	return ENOSYS;
  #endif
  
!     if (error = iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)), 
! 		     (unsigned int)(inode&0xffffffff), &ip)) {
  	return error;
      }
      *ipp = ip;
***************
*** 216,223 ****
      }
  #endif
  
!     if (error = xfs_iget(vfstom(vfsp), (void*)0,
! 			 (xfs_ino_t)inode,XFS_ILOCK_SHARED, &ip, (daddr_t)0)) {
  	SET_XFS_ERROR(3, vfsp->vfs_dev, inode);
  	return error;
      }
--- 217,226 ----
      }
  #endif
  
!     if (error = xfs_iget((((struct mount *)
! 			   ((vfsp)->vfs_bh.bh_first)->bd_pdata)),
! 			 (void*)0, (xfs_ino_t)inode, 
! 			 XFS_ILOCK_SHARED, &ip, (daddr_t)0)) {
  	SET_XFS_ERROR(3, vfsp->vfs_dev, inode);
  	return error;
      }
***************
*** 280,290 ****
--- 283,298 ----
  int
  icreate(struct icreateargs *uap, rval_t *rvp)
  {
+ #ifdef AFS_SGI_EFS_IOPS_ENV
      AFS_STATCNT(icreate);
      return(afs_syscall_icreate(uap->dev, uap->near_inode, uap->param1,
  			       uap->param2, uap->param3, uap->param4, rvp));
+ #else
+     return ENOSYS;
+ #endif
  }
  
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  int
  afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp)
  afs_uint32 dev, near_inode, param1, param2, param3, param4;
***************
*** 327,332 ****
--- 335,349 ----
  	iput(newip);
  	return 0;
  }
+ #else /* !AFS_SGI_EFS_IOPS_ENV */
+ int
+ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp)
+ afs_uint32 dev, near_inode, param1, param2, param3, param4;
+ rval_t *rvp;
+ {
+     return ENOSYS;
+ }
+ #endif /* AFS_SGI_EFS_IOPS_ENV */
  
  #ifdef AFS_SGI_XFS_IOPS_ENV
  /* inode creation routines for icreatename64 entry point. Use for EFS/XFS
***************
*** 620,625 ****
--- 637,643 ----
  	if (!vfsp)
  	    return ENXIO;
  
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  	if (vfsp->vfs_fstype == efs_fstype) {
  	    struct inode *ip;
  	    if (error = igetinode(vfsp, (dev_t)dev, inode, &ip))
***************
*** 630,650 ****
  		return error;
  	    }
  	    iunlock(ip);
- 	}
- 	else if (vfsp->vfs_fstype == xfs_fstype) {
- 	    struct xfs_inode *xip;
- 	    if (error = xfs_igetinode(vfsp, (dev_t)dev, inode, &xip))
- 		return error;
- 	    vp = XFS_ITOV(xip);
- 	    if (error = vfile_alloc((usrmod+1) & (FMASK), &fp, &fd)) {
- 		VN_RELE(vp);
- 		return error;
- 	    }
- 	}
- 	else {
- 	    osi_Panic("afs_syscall_iopen: bad fstype = %d\n",
- 		      vfsp->vfs_fstype);
  	}
          vfile_ready(fp, vp);
  	rvp->r_val1 = fd;
  	return 0;
--- 648,670 ----
  		return error;
  	    }
  	    iunlock(ip);
  	}
+ 	else 
+ #endif /* AFS_SGI_EFS_IOPS_ENV */
+ 	  if (vfsp->vfs_fstype == xfs_fstype) {
+ 	      struct xfs_inode *xip;
+ 	      if (error = xfs_igetinode(vfsp, (dev_t)dev, inode, &xip))
+ 		  return error;
+ 	      vp = XFS_ITOV(xip);
+ 	      if (error = vfile_alloc((usrmod+1) & (FMASK), &fp, &fd)) {
+ 		  VN_RELE(vp);
+ 		  return error;
+ 	      }
+ 	  }
+ 	  else {
+ 	      osi_Panic("afs_syscall_iopen: bad fstype = %d\n",
+ 			vfsp->vfs_fstype);
+ 	  }
          vfile_ready(fp, vp);
  	rvp->r_val1 = fd;
  	return 0;
***************
*** 765,770 ****
--- 785,791 ----
   * Only VICEMAGIC type inodes.
   */
  #ifdef AFS_SGI_XFS_IOPS_ENV
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  /* efs_iincdec
   *
   * XFS/EFS iinc/idec code for EFS. Uses 32 bit inode numbers. 
***************
*** 796,801 ****
--- 817,823 ----
      iput(ip);
      return error;
  }
+ #endif /* AFS_SGI_EFS_IOPS_ENV */
  
  /* xfs_iincdec
   *
***************
*** 814,821 ****
      int nlink;
      int vol;
      
!     code = xfs_iget(vfstom(vfsp), (void*)0, (xfs_ino_t)inode, XFS_ILOCK_SHARED,
! 		    &ip, (daddr_t)0);
      if (code)
  	return code;
  
--- 836,844 ----
      int nlink;
      int vol;
      
!     code = xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)),
! 		    (void*)0, (xfs_ino_t)inode, XFS_ILOCK_SHARED, &ip, 
! 		    (daddr_t)0);
      if (code)
  	return code;
  
***************
*** 963,971 ****
--- 986,996 ----
  	inode |= inode_lo;
  	return xfs_iincdec64(vfsp, inode, inode_p1, amount);
      }
+ #ifdef AFS_SGI_EFS_IOPS_ENV
      else if (vfsp->vfs_fstype == efs_fstype) {
  	return efs_iincdec(vfsp, inode_lo, inode_p1, amount);
      }
+ #endif /* AFS_SGI_EFS_IOPS_ENV */
      return ENXIO;
  }
  
***************
*** 1143,1149 ****
      inode = inode_hi;
      inode <<= 32;
      inode |= inode_lo;
!     code = xfs_iget(vfstom(vfsp), (void*)0, (xfs_ino_t)inode,
  		    XFS_ILOCK_SHARED, &ip, (daddr_t)0);
      if (code)
  	return code;
--- 1168,1175 ----
      inode = inode_hi;
      inode <<= 32;
      inode |= inode_lo;
!     code = xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)), 
! 		    (void*)0, (xfs_ino_t)inode,
  		    XFS_ILOCK_SHARED, &ip, (daddr_t)0);
      if (code)
  	return code;
Index: openafs/src/afs/IRIX/osi_vnodeops.c
diff -c openafs/src/afs/IRIX/osi_vnodeops.c:1.2 openafs/src/afs/IRIX/osi_vnodeops.c:1.2.2.1
*** openafs/src/afs/IRIX/osi_vnodeops.c:1.2	Sat Nov  4 05:03:23 2000
--- openafs/src/afs/IRIX/osi_vnodeops.c	Tue Mar  6 16:13:59 2001
***************
*** 10,16 ****
  /*
   * SGI specific vnodeops + other misc interface glue
   */
! #ident "$Revision: 1.2 $"
  
  #include "../afs/param.h"	/* Should be always first */
  #ifdef	AFS_SGI62_ENV
--- 10,16 ----
  /*
   * SGI specific vnodeops + other misc interface glue
   */
! #ident "$Revision: 1.2.2.1 $"
  
  #include "../afs/param.h"	/* Should be always first */
  #ifdef	AFS_SGI62_ENV
***************
*** 1829,1834 ****
--- 1829,1835 ----
      inited = 1;
  
  
+ #ifdef AFS_SGI_EFS_IOPS_ENV
      swp = vfs_getvfssw("efs");
      if (swp) {
          afs_efs_vnodeopsp = swp->vsw_vnodeops;
***************
*** 1838,1843 ****
--- 1839,1845 ----
  	    found = 1;
  	}
      }
+ #endif /* AFS_SGI_EFS_IOPS_ENV */
  
      swp = vfs_getvfssw("xfs");
      if (swp) {
Index: openafs/src/afs/LINUX/osi_file.c
diff -c openafs/src/afs/LINUX/osi_file.c:1.4.2.1 openafs/src/afs/LINUX/osi_file.c:1.4.2.2
*** openafs/src/afs/LINUX/osi_file.c:1.4.2.1	Fri Jan 19 04:29:39 2001
--- openafs/src/afs/LINUX/osi_file.c	Tue Mar  6 16:08:27 2001
***************
*** 104,136 ****
        return 0;
    }
  
- #if defined(AFS_LINUX24_ENV)
- int osi_notify_change(struct dentry * dentry, struct iattr * attr)
- {
-     struct inode *inode = dentry->d_inode;
-     int error;
-     time_t now = CURRENT_TIME;
-     unsigned int ia_valid = attr->ia_valid;
- 
-     attr->ia_ctime = now;
-     if (!(ia_valid & ATTR_ATIME_SET))
- 	attr->ia_atime = now;
-     if (!(ia_valid & ATTR_MTIME_SET))
- 	attr->ia_mtime = now;
- 
-     lock_kernel();
-     if (inode && inode->i_op && inode->i_op->setattr)
- 	error = inode->i_op->setattr(dentry, attr);
-     else {
- 	error = inode_change_ok(inode, attr);
- 	if (!error)
- 	    inode_setattr(inode, attr);
-     }
-     unlock_kernel();
-     return error;
- }
- #endif
- 
  osi_UFSTruncate(afile, asize)
      register struct osi_file *afile;
      afs_int32 asize; {
--- 104,109 ----
***************
*** 150,162 ****
      MObtainWriteLock(&afs_xosi,321);    
      AFS_GUNLOCK();
      down(&inode->i_sem);
- #if defined(AFS_LINUX24_ENV)
-     newattrs.ia_size = asize;
-     newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
-     code = osi_notify_change(&afile->dentry, &newattrs);
- #else
      inode->i_size = newattrs.ia_size = asize;
      newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
      if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) {
  	code = inode->i_sb->s_op->notify_change(&afile->dentry, &newattrs);
      }
--- 123,140 ----
      MObtainWriteLock(&afs_xosi,321);    
      AFS_GUNLOCK();
      down(&inode->i_sem);
      inode->i_size = newattrs.ia_size = asize;
      newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
+ #if defined(AFS_LINUX24_ENV)
+     newattrs.ia_ctime = CURRENT_TIME;
+ 
+     /* avoid notify_change() since it wants to update dentry->d_parent */
+     lock_kernel();
+     code = inode_change_ok(inode, &newattrs);
+     if (!code)
+ 	inode_setattr(inode, &newattrs);
+     unlock_kernel();
+ #else
      if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) {
  	code = inode->i_sb->s_op->notify_change(&afile->dentry, &newattrs);
      }
Index: openafs/src/afs/LINUX/osi_misc.c
diff -c openafs/src/afs/LINUX/osi_misc.c:1.3.2.1 openafs/src/afs/LINUX/osi_misc.c:1.3.2.2
*** openafs/src/afs/LINUX/osi_misc.c:1.3.2.1	Fri Jan 19 04:29:39 2001
--- openafs/src/afs/LINUX/osi_misc.c	Tue Mar  6 16:08:27 2001
***************
*** 15,20 ****
--- 15,23 ----
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
  #include "../afs/afs_stats.h"
+ #if defined(AFS_LINUX24_ENV)
+ #include "../h/smp_lock.h"
+ #endif
  
  char *crash_addr = 0; /* Induce an oops by writing here. */
  
***************
*** 313,328 ****
      }
  }
  
  /* iput an inode. Since we still have a separate inode pool, we don't want
   * to call iput on AFS inodes, since they would then end up on Linux's
   * inode_unsed list.
   */
  void osi_iput(struct inode *ip)
  {
-     extern void afs_delete_inode(struct inode *ip);
      extern struct vfs *afs_globalVFS;
  
!     
  #if defined(AFS_LINUX24_ENV)
      if (atomic_read(&ip->i_count) == 0 || atomic_read(&ip->i_count) & 0xffff0000) {
  #else
--- 316,352 ----
      }
  }
  
+ void osi_clear_inode(struct inode *ip)
+ {
+     cred_t *credp = crref();
+     struct vcache *vc = (struct vcache*)ip;
+ 
+ #if defined(AFS_LINUX24_ENV)
+     if (atomic_read(&ip->i_count) > 1)
+ #else
+     if (ip->i_count > 1)
+ #endif
+         printf("afs_put_inode: ino %d (0x%x) has count %d\n", ip->i_ino, ip);
+ 
+     afs_InactiveVCache(vc, credp);
+ #if defined(AFS_LINUX24_ENV)
+     atomic_set(&ip->i_count, 0);
+ #else
+     ip->i_count = 0;
+ #endif
+     ip->i_nlink = 0; /* iput checks this after calling this routine. */
+     crfree(credp);
+ }
+ 
  /* iput an inode. Since we still have a separate inode pool, we don't want
   * to call iput on AFS inodes, since they would then end up on Linux's
   * inode_unsed list.
   */
  void osi_iput(struct inode *ip)
  {
      extern struct vfs *afs_globalVFS;
  
!     AFS_GLOCK();
  #if defined(AFS_LINUX24_ENV)
      if (atomic_read(&ip->i_count) == 0 || atomic_read(&ip->i_count) & 0xffff0000) {
  #else
***************
*** 343,351 ****
  	ip->i_count --;
  	if (!ip->i_count)
  #endif
! 	    afs_delete_inode(ip);
      }
      else { 
  	iput(ip);
      }
  }
--- 367,377 ----
  	ip->i_count --;
  	if (!ip->i_count)
  #endif
! 	    osi_clear_inode(ip);
!         AFS_GUNLOCK();
      }
      else { 
+         AFS_GUNLOCK();
  	iput(ip);
      }
  }
Index: openafs/src/afs/LINUX/osi_vfs.h
diff -c openafs/src/afs/LINUX/osi_vfs.h:1.3.2.1 openafs/src/afs/LINUX/osi_vfs.h:1.3.2.3
*** openafs/src/afs/LINUX/osi_vfs.h:1.3.2.1	Fri Jan 19 04:39:16 2001
--- openafs/src/afs/LINUX/osi_vfs.h	Tue Mar  6 16:13:11 2001
***************
*** 36,42 ****
  	uid_t			i_uid;
  	gid_t			i_gid;
  	kdev_t			i_rdev;
! #if defined(AFS_LINUX24_ENV)
          loff_t                  i_size;
  #else
  	off_t			i_size;
--- 36,42 ----
  	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;
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.3.2.1 openafs/src/afs/LINUX/osi_vfsops.c:1.3.2.2
*** openafs/src/afs/LINUX/osi_vfsops.c:1.3.2.1	Fri Jan 19 04:39:16 2001
--- openafs/src/afs/LINUX/osi_vfsops.c	Tue Mar  6 16:08:27 2001
***************
*** 231,266 ****
   * If we use the common inode pool, we'll need to set i_nlink to 0 here.
   * That will trigger the call to delete routine.
   */
  void afs_delete_inode(struct inode *ip)
  {
-     cred_t *credp = crref();
      struct vcache *vc = (struct vcache*)ip;
  
      AFS_GLOCK();
- #if defined(AFS_LINUX24_ENV)
-     lock_kernel();
-     if (atomic_read(&ip->i_count) > 1)
- #else
-     if (ip->i_count > 1)
- #endif
- 	printf("afs_put_inode: ino %d (0x%x) has count %d\n", ip->i_ino, ip);
- 
      ObtainWriteLock(&vc->lock, 504);
!     afs_InactiveVCache(vc, credp);
! #if defined(AFS_LINUX24_ENV)
!     atomic_set(&ip->i_count, 0);
! #else
!     ip->i_count = 0;
! #endif
!     ip->i_nlink = 0; /* iput checks this after calling this routine. */
      ReleaseWriteLock(&vc->lock);
- 
- #ifdef AFS_LINUX24_ENV
-     unlock_kernel();
- #endif
      AFS_GUNLOCK();
-     crfree(credp);
  }
  
  /* afs_put_super
   * Called from unmount to release super_block. */
--- 231,248 ----
   * If we use the common inode pool, we'll need to set i_nlink to 0 here.
   * That will trigger the call to delete routine.
   */
+ 
  void afs_delete_inode(struct inode *ip)
  {
      struct vcache *vc = (struct vcache*)ip;
  
      AFS_GLOCK();
      ObtainWriteLock(&vc->lock, 504);
!     osi_clear_inode(ip);
      ReleaseWriteLock(&vc->lock);
      AFS_GUNLOCK();
  }
+ 
  
  /* afs_put_super
   * Called from unmount to release super_block. */
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.6.2.2 openafs/src/afs/LINUX/osi_vnodeops.c:1.6.2.4
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.6.2.2	Fri Jan 19 04:39:17 2001
--- openafs/src/afs/LINUX/osi_vnodeops.c	Tue Mar  6 16:08:27 2001
***************
*** 30,35 ****
--- 30,41 ----
  #include "../h/smp_lock.h"
  #endif
  
+ #ifdef pgoff2loff
+ #define pageoff(pp) pgoff2loff((pp)->index)
+ #else
+ #define pageoff(pp) pp->offset
+ #endif
+ 
  extern struct vcache *afs_globalVp;
  
  extern struct dentry_operations *afs_dops;
***************
*** 709,735 ****
  /* afs_dentry_iput */
  static void afs_dentry_iput(struct dentry *dp, struct inode *ip)
  {
! #if defined(AFS_LINUX24_ENV)
!     if (atomic_read(&ip->i_count) == 0 || atomic_read(&ip->i_count) & 0xffff0000) {
! #else
!     if (ip->i_count == 0 || ip->i_count & 0xffff0000) {
! #endif
! 	osi_Panic("Bad refCount %d on inode 0x%x\n",
! #if defined(AFS_LINUX24_ENV)
! 		  atomic_read(&ip->i_count), ip);
! #else
! 		  ip->i_count, ip);
! #endif
!     }
! #if defined(AFS_LINUX24_ENV)
!     atomic_dec(&ip->i_count);
!     if (!atomic_read(&ip->i_count)) {
! #else
!     ip->i_count --;
!     if (!ip->i_count) {
! #endif
! 	afs_delete_inode(ip);
!     }
  }
  
  #if defined(AFS_LINUX24_ENV)
--- 715,721 ----
  /* afs_dentry_iput */
  static void afs_dentry_iput(struct dentry *dp, struct inode *ip)
  {
!     osi_iput(ip);
  }
  
  #if defined(AFS_LINUX24_ENV)
***************
*** 1137,1150 ****
      setup_uio(&tuio, &iovec, (char*)address, pp->index << PAGE_CACHE_SHIFT,
  	      PAGESIZE, UIO_READ, AFS_UIOSYS);
  #else
!     setup_uio(&tuio, &iovec, (char*)address, pp->offset, PAGESIZE,
  	      UIO_READ, AFS_UIOSYS);
  #endif
! #ifdef AFS_LINUX24_ENV
      lock_kernel();
  #endif
      code = afs_rdwr((struct vcache*)ip, &tuio, UIO_READ, 0, credp);
! #ifdef AFS_LINUX24_ENV
      unlock_kernel();
  #endif
  
--- 1123,1136 ----
      setup_uio(&tuio, &iovec, (char*)address, pp->index << PAGE_CACHE_SHIFT,
  	      PAGESIZE, UIO_READ, AFS_UIOSYS);
  #else
!     setup_uio(&tuio, &iovec, (char*)address, pageoff(pp), PAGESIZE,
  	      UIO_READ, AFS_UIOSYS);
  #endif
! #if defined(AFS_LINUX24_ENV)
      lock_kernel();
  #endif
      code = afs_rdwr((struct vcache*)ip, &tuio, UIO_READ, 0, credp);
! #if defined(AFS_LINUX24_ENV)
      unlock_kernel();
  #endif
  
***************
*** 1153,1158 ****
--- 1139,1147 ----
  	    memset((void*)(address+(PAGESIZE-tuio.uio_resid)), 0,
  		   tuio.uio_resid);
  #if defined(AFS_LINUX24_ENV)
+ #ifndef __powerpc__
+         flush_dcache_page(pp);
+ #endif
          SetPageUptodate(pp);
  #else
  	set_bit(PG_uptodate, &pp->flags);
***************
*** 1163,1170 ****
      UnlockPage(pp);
  #else
      clear_bit(PG_locked, &pp->flags);
- #endif
      wake_up(&pp->wait);
      free_page(address);
  
      crfree(credp);
--- 1152,1159 ----
      UnlockPage(pp);
  #else
      clear_bit(PG_locked, &pp->flags);
      wake_up(&pp->wait);
+ #endif
      free_page(address);
  
      crfree(credp);
***************
*** 1198,1204 ****
--- 1187,1195 ----
      if (pp->index >= end_index+1 || !offset)
  	return -EIO;
  do_it:
+     AFS_GLOCK();
      status = afs_linux_writepage_sync(inode, pp, 0, offset);
+     AFS_GUNLOCK();
      SetPageUptodate(pp);
      UnlockPage(pp);
      /* kunmap(pp); */
***************
*** 1262,1269 ****
      int f_flags = 0;
  
      credp = crref();
-     AFS_GLOCK();
-     lock_kernel();
      afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
                ICL_TYPE_POINTER, pp,
                ICL_TYPE_INT32, atomic_read(&pp->count),
--- 1253,1258 ----
***************
*** 1282,1289 ****
                ICL_TYPE_INT32, atomic_read(&pp->count),
                ICL_TYPE_INT32, code);
  
-     unlock_kernel();
-     AFS_GUNLOCK();
      crfree(credp);
  
      return code;
--- 1271,1276 ----
***************
*** 1322,1328 ****
  	       ICL_TYPE_POINTER, pp,
  	       ICL_TYPE_INT32, atomic_read(&pp->count),
  	       ICL_TYPE_INT32, 99999);
!     setup_uio(&tuio, &iovec, page_addr + offset, pp->offset + offset, count,
  	      UIO_WRITE, AFS_UIOSYS);
  
      code = afs_write(vcp, &tuio, fp->f_flags, credp, 0);
--- 1309,1315 ----
  	       ICL_TYPE_POINTER, pp,
  	       ICL_TYPE_INT32, atomic_read(&pp->count),
  	       ICL_TYPE_INT32, 99999);
!     setup_uio(&tuio, &iovec, page_addr + offset, pageoff(pp) + offset, count,
  	      UIO_WRITE, AFS_UIOSYS);
  
      code = afs_write(vcp, &tuio, fp->f_flags, credp, 0);
***************
*** 1348,1356 ****
  {
      long status;
  
!     /* lock_kernel(); */
      status = afs_linux_updatepage(file, page, offset, to-offset);
!     /* unlock_kernel(); */
      kunmap(page);
  
      return status;
--- 1335,1345 ----
  {
      long status;
  
!     AFS_GLOCK();
!     lock_kernel();
      status = afs_linux_updatepage(file, page, offset, to-offset);
!     unlock_kernel();
!     AFS_GUNLOCK();
      kunmap(page);
  
      return status;
Index: openafs/src/afs/SOLARIS/osi_vnodeops.c
diff -c openafs/src/afs/SOLARIS/osi_vnodeops.c:1.2.2.1 openafs/src/afs/SOLARIS/osi_vnodeops.c:1.2.2.2
*** openafs/src/afs/SOLARIS/osi_vnodeops.c:1.2.2.1	Fri Jan 19 04:51:43 2001
--- openafs/src/afs/SOLARIS/osi_vnodeops.c	Tue Mar  6 17:23:00 2001
***************
*** 560,569 ****
      /*
       * Putpage (ASYNC) is called every sec to flush out dirty vm pages 
       */
-     if (flags == B_ASYNC) {
- 	/* XXX For testing only XXX */
- 	return (EINVAL);
-     }
      AFS_GLOCK();
      afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUT, ICL_TYPE_POINTER, (afs_int32) vp,
  	       ICL_TYPE_LONG, (afs_int32) off, ICL_TYPE_LONG, (afs_int32) len,
--- 560,565 ----
Index: openafs/src/afs/VNOPS/afs_vnop_lookup.c
diff -c openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.3.2.1 openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.3.2.2
*** openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.3.2.1	Fri Jan 19 04:29:42 2001
--- openafs/src/afs/VNOPS/afs_vnop_lookup.c	Tue Mar  6 17:18:24 2001
***************
*** 127,133 ****
         volnamep = &avc->linkData[1];
         tcell = afs_GetCell(avc->fid.Cell, READ_LOCK);
      }
!     if (!tcell) return ENODEV;
  
      mtptCell = tcell->cell;               /* The cell for the mountpoint */
      if (tcell->lcellp) {
--- 127,133 ----
         volnamep = &avc->linkData[1];
         tcell = afs_GetCell(avc->fid.Cell, READ_LOCK);
      }
!     if (!tcell) return ENOENT;
  
      mtptCell = tcell->cell;               /* The cell for the mountpoint */
      if (tcell->lcellp) {
***************
*** 182,188 ****
         }
      }
    
!     if (!tvp) return ENOENT;       /* Couldn't find the volume */
  
      /* Don't cross mountpoint from a BK to a BK volume */
      if ((avc->states & CBackup) && (tvp->states & VBackup)) {
--- 182,188 ----
         }
      }
    
!     if (!tvp) return ENODEV;       /* Couldn't find the volume */
  
      /* Don't cross mountpoint from a BK to a BK volume */
      if ((avc->states & CBackup) && (tvp->states & VBackup)) {
***************
*** 198,204 ****
         tfid.Cell       = tvp->cell;
         afs_PutVolume(tvp, WRITE_LOCK);               /* release old volume */
         tvp = afs_GetVolume(&tfid, areq, WRITE_LOCK); /* get the new one */
!        if (!tvp) return ENOENT;                      /* oops, can't do it */
      }
  
      if (avc->mvid == 0)
--- 198,204 ----
         tfid.Cell       = tvp->cell;
         afs_PutVolume(tvp, WRITE_LOCK);               /* release old volume */
         tvp = afs_GetVolume(&tfid, areq, WRITE_LOCK); /* get the new one */
!        if (!tvp) return ENODEV;                      /* oops, can't do it */
      }
  
      if (avc->mvid == 0)
***************
*** 1162,1167 ****
--- 1162,1173 ----
  	    ObtainWriteLock(&tvc->lock,133);
  	    code = EvalMountPoint(tvc, adp, &tvolp, &treq);
  	    ReleaseWriteLock(&tvc->lock);
+ 
+ 	    if (code) {
+ 		if (tvolp) afs_PutVolume(tvolp, WRITE_LOCK);
+ 		goto done;
+ 	    }
+ 
  	    /* next, we want to continue using the target of the mt point */
  	    if (tvc->mvid && (tvc->states & CMValid)) {
  	      struct vcache *uvc;
Index: openafs/src/afs/VNOPS/afs_vnop_readdir.c
diff -c openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.2.2.2 openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.2.2.3
*** openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.2.2.2	Fri Jan 19 04:29:43 2001
--- openafs/src/afs/VNOPS/afs_vnop_readdir.c	Tue Mar  6 16:12:26 2001
***************
*** 641,651 ****
  		}
  #else /* AFS_HPUX_ENV */
  		code = afs_readdir_move(ode, avc, auio, o_slen,
- #if defined(AFS_SUN5_ENV)
- 		                        len, origOffset);
- #else
  					auio->afsio_resid, origOffset);
- #endif
  #endif /* AFS_HPUX_ENV */
  		/* this next line used to be AFSVFS40 or AIX 3.1, but is
  		 * really generic */
--- 641,647 ----
Index: openafs/src/afs/VNOPS/afs_vnop_write.c
diff -c openafs/src/afs/VNOPS/afs_vnop_write.c:1.2 openafs/src/afs/VNOPS/afs_vnop_write.c:1.2.2.1
*** openafs/src/afs/VNOPS/afs_vnop_write.c:1.2	Sat Nov  4 05:03:32 2000
--- openafs/src/afs/VNOPS/afs_vnop_write.c	Tue Mar  6 16:24:09 2001
***************
*** 639,645 ****
  
  
  #if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) && !defined (AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
! #ifdef AFS_DUX40_ENV
  #define      vno_close       vn_close
  #endif
  /* We don't need this for AIX since: 
--- 639,647 ----
  
  
  #if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) && !defined (AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
! #ifdef AFS_DUX50_ENV
! #define vno_close(X) vn_close((X), 0, NOCRED)
! #elif defined(AFS_DUX40_ENV)
  #define      vno_close       vn_close
  #endif
  /* We don't need this for AIX since: 
Index: openafs/src/afsd/afs.rc.solaris.2.7
diff -c openafs/src/afsd/afs.rc.solaris.2.7:1.2 openafs/src/afsd/afs.rc.solaris.2.7:1.2.2.1
*** openafs/src/afsd/afs.rc.solaris.2.7:1.2	Sat Nov  4 05:03:33 2000
--- openafs/src/afsd/afs.rc.solaris.2.7	Tue Mar  6 16:09:23 2001
***************
*** 1,11 ****
- \." 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
- \."
  #!/bin/sh
  #
  # afs.rc: rc script for AFS on Solaris 2.x platforms
  #
--- 1,11 ----
  #!/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
  #
  # afs.rc: rc script for AFS on Solaris 2.x platforms
  #
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.3 openafs/src/afsd/afsd.c:1.3.2.1
*** openafs/src/afsd/afsd.c:1.3	Sun Nov  5 23:24:09 2000
--- openafs/src/afsd/afsd.c	Tue Mar  6 17:30:07 2001
***************
*** 1026,1033 ****
--- 1026,1035 ----
      sprintf(fullpn_VFile,       "%s/V",  cacheBaseDir);
      vFileNumber = fullpn_VFile + strlen(fullpn_VFile);
  
+ #if 0
      fputs(AFS_GOVERNMENT_MESSAGE, stdout); 
      fflush(stdout);
+ #endif
  
      /*
       * Set up all the kernel processes needed for AFS.
Index: openafs/src/audit/audit.h
diff -c openafs/src/audit/audit.h:1.2 openafs/src/audit/audit.h:1.2.2.1
*** openafs/src/audit/audit.h:1.2	Sat Nov  4 05:03:54 2000
--- openafs/src/audit/audit.h	Tue Mar  6 16:44:57 2001
***************
*** 16,21 ****
--- 16,25 ----
  #define AUD_DATE 6         /* date (unsigned long)           */
  #define AUD_FID  7         /* File ID                        */
  #define AUD_FIDS 8         /* array of Fids                  */
+ /* next 3 lines on behalf of MR-AFS */
+ #define AUD_RESID 20       /* resid         in variable list */
+ #define AUD_RSSIZERANGE 21 /* rssizerange   in variable list */
+ #define AUD_LOOKUPINFO 22  /* LookupInfo    in variable list */ 
  
  /*
   * Note: the master definitions of these error codes come from *.et
***************
*** 62,67 ****
--- 66,74 ----
  #define VS_MonitorEvent    "AFS_VS_Monitor"
  #define VS_SetIdTyEvent    "AFS_VS_SetIdTy"
  #define VS_SetDateEvent    "AFS_VS_SetDate"
+ /* Next 2 lines on behalf of MR-AFS */
+ #define VS_SelectiveDumpEvent "AFS_VS_DmpSelct"
+ #define VS_ListVolumeResidencyInfoEvent "AFS_VS_LstVInfo"
  
  #define PTS_StartEvent     "AFS_PTS_Start"
  #define PTS_FinishEvent    "AFS_PTS_Finish"
***************
*** 168,173 ****
--- 175,186 ----
  #define FlushCPSEvent           "AFS_SRX_FlusCPS"
  #define PrivilegeEvent		"AFS_Priv"
  #define PrivSetID		"AFS_PrivSet"
+ /* Next 5 lines on behalf of MR-AFS */
+ #define GetResidenciesEvent     "AFS_SRX_GetR"
+ #define ChangeResidenciesEvent  "AFS_SRX_ChgR"
+ #define ImportResidenciesEvent  "AFS_SRX_Import"
+ #define GetExtendedVolumeAttributesEvent "AFS_SRX_GetVA"
+ #define SetExtendedVolumeAttributesEvent "AFS_SRX_SetVA"
  
  #define NoAuthEvent             "AFS_RunNoAuth"
  #define NoAuthDisableEvent      "AFS_NoAuthDsbl"
***************
*** 213,218 ****
--- 226,282 ----
  #define VLSetLockEvent		"AFS_VL_SetLck"
  #define VLReleaseLockEvent	"AFS_VL_RelLck"
  #define VLChangeAddrEvent	"AFS_VL_ChgAdd"
+ 
+ /* Next 2 block of lines on behalf of MR-AFS */
+ #define RSStartEvent            "AFS_RS_StartEnt"
+ #define RSFinishEvent           "AFS_RS_FnshEnt"
+ #define RSExitEvent             "AFS_RS_ExitEnt"
+ #define RSChangeAddr            "AFS_RS_ChgAddr"
+ #define RSChangeName            "AFS_RS_ChgName"
+ #define RSNewEntry              "AFS_RS_NewEntry"
+ #define RSAddResidencyToServer  "AFS_RS_AddRToS"
+ #define RSRemoveResidencyFromServer "AFS_RS_RemRFS"
+ #define RSNameToResId           "AFS_RS_NameToId"
+ #define RSResIdToName           "AFS_RS_IdToName"
+ #define RSDelete                "AFS_RS_Delete"
+ #define RSListMax               "AFS_RS_ListMax"
+ #define RSSetMax                "AFS_RS_SetMax"
+ #define RSListEntry             "AFS_RS_ListEnt"
+ #define RSSetFieldsEntry        "AFS_RS_SetEnt"
+ #define RSListElements          "AFS_RS_ListElm"
+ #define RSIsAHolderOf           "AFS_RS_IsAHold"
+ #define RSChooseResidency       "AFS_RS_ChooseR"
+ #define RSSwapAllocatedSpace    "AFS_RS_SwapSpc"
+ #define RSQuickCheck            "AFS_RS_QuickChk"
+ #define RSResidencyWipeableInfo "AFS_RS_WipeInfo"
+ #define RSGetResidencySummary   "AFS_RS_GetRSum"
+ #define RSGetWiperFreeSpaceFraction "AFS_RS_GetFSpc"
+ #define RSRegisterAddrs         "AFS_RS_Regist"
+ #define RSGetAddrsU             "AFS_RS_GetAddrU"
+ #define RSSetWeights            "AFS_RS_SetWght"
+ #define RSGetWeights            "AFS_RS_GetWght"
+ #define RSSetThresholds         "AFS_RS_SetThrsh"
+ #define RSGetThresholds         "AFS_RS_GetThrsh"
+ #define RSListResidencies       "AFS_RS_ListRes"
+ #define RSListServers           "AFS_RS_ListServ"
+ #define RSGetRandom             "AFS_RS_GetRandm"
+ 
+ #define REMIOExitEvent          "AFS_RE_ExitEnt"
+ #define SREMIOGetConnection     "AFS_RE_GetConn"
+ #define SREMIORemoteIncDec      "AFS_RE_IncDec"
+ #define SREMIOBulkIncDec        "AFS_RE_BlkIDec"
+ #define SREMIORemoteStat        "AFS_RE_Stat"
+ #define SREMIORemoteCloseIfOpen "AFS_RE_Close"
+ #define SREMIORemoteOpen        "AFS_RE_Open"
+ #define SREMIORemoteSeek        "AFS_RE_Seek"
+ #define SREMIORemoteRead        "AFS_RE_Read"
+ #define SREMIORemoteWrite       "AFS_RE_Write"
+ #define SREMIORemoteListFiles   "AFS_RE_LstFiles"
+ #define SREMIORemoteTruncate    "AFS_RE_Truncate"
+ #define SREMIORemoteFsyncFile   "AFS_RE_Fsync"
+ #define SREMIORemoteImportFile  "AFS_RE_Import"
+ #define SREMIORemoteGetHSMdata  "AFS_RE_HSMdata"
+ #define SREMIOPrefetch          "AFS_RE_Prefetch"
  
  
  /* prototypes for audit functions */
Index: openafs/src/auth/cellconfig.c
diff -c openafs/src/auth/cellconfig.c:1.2.2.1 openafs/src/auth/cellconfig.c:1.2.2.3
*** openafs/src/auth/cellconfig.c:1.2.2.1	Wed Dec 13 16:49:19 2000
--- openafs/src/auth/cellconfig.c	Tue Mar  6 16:49:50 2001
***************
*** 55,60 ****
--- 55,62 ----
      "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 */
  };
  
***************
*** 216,222 ****
      tdir->name = (char *) malloc(strlen(adir)+1);
      strcpy(tdir->name, adir);
  
!     code = afsconf_OpenInternal(tdir);
      if (code) {
  	char *afsconf_path, *getenv(), afs_confdir[128];
  
--- 218,224 ----
      tdir->name = (char *) malloc(strlen(adir)+1);
      strcpy(tdir->name, adir);
  
!     code = afsconf_OpenInternal(tdir, 0, 0);
      if (code) {
  	char *afsconf_path, *getenv(), afs_confdir[128];
  
***************
*** 270,276 ****
  	}
  	tdir->name = (char *) malloc(strlen(afsconf_path)+1);
  	strcpy(tdir->name, afsconf_path);
! 	code = afsconf_OpenInternal(tdir);
  	if (code) {
  	    free(tdir->name);
  	    free(tdir);
--- 272,278 ----
  	}
  	tdir->name = (char *) malloc(strlen(afsconf_path)+1);
  	strcpy(tdir->name, afsconf_path);
! 	code = afsconf_OpenInternal(tdir, 0, 0);
  	if (code) {
  	    free(tdir->name);
  	    free(tdir);
***************
*** 320,327 ****
  #endif /* AFS_NT40_ENV */
  
  
! static int afsconf_OpenInternal(adir)
! register struct afsconf_dir *adir; {
      FILE *tf;
      register char *tp, *bp;
      register struct afsconf_entry *curEntry;
--- 322,332 ----
  #endif /* AFS_NT40_ENV */
  
  
! static int afsconf_OpenInternal(adir, cell, clones)
! register struct afsconf_dir *adir; 
! char *cell;
! char clones[];
! {
      FILE *tf;
      register char *tp, *bp;
      register struct afsconf_entry *curEntry;
***************
*** 407,413 ****
  		return -1;
  	    }
  	    i = curEntry->cellInfo.numServers;
! 	    code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i]);
  	    if (code) {
  		if (code == AFSCONF_SYNTAX) {
  		    for (bp=tbuffer; *bp != '\n'; bp++) {	/* Take out the <cr> from the buffer */
--- 412,421 ----
  		return -1;
  	    }
  	    i = curEntry->cellInfo.numServers;
!            if (cell && !strcmp(cell, curEntry->cellInfo.name)) 
!                 code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i], &clones[i]);
!            else
!                 code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i], 0);
  	    if (code) {
  		if (code == AFSCONF_SYNTAX) {
  		    for (bp=tbuffer; *bp != '\n'; bp++) {	/* Take out the <cr> from the buffer */
***************
*** 440,456 ****
  }
  
  /* parse a line of the form
!  *"128.2.1.3	#hostname"
   * into the appropriate pieces.  
   */
! static ParseHostLine(aline, addr, aname)
! register struct sockaddr_in *addr;
! char *aline, *aname; {
      int c1, c2, c3, c4;
      register afs_int32 code;
      register char *tp;
  
!     code = sscanf(aline, "%d.%d.%d.%d #%s", &c1, &c2, &c3, &c4, aname);
      if (code != 5) return AFSCONF_SYNTAX;
      addr->sin_family = AF_INET;
      addr->sin_port = 0;
--- 448,473 ----
  }
  
  /* parse a line of the form
!  *"128.2.1.3   #hostname" or
!  *"[128.2.1.3]  #hostname" for clones
   * into the appropriate pieces.  
   */
! static ParseHostLine(aline, addr, aname, aclone)
!     char *aclone;
!     register struct sockaddr_in *addr;
!     char *aline, *aname; 
! {
      int c1, c2, c3, c4;
      register afs_int32 code;
      register char *tp;
  
!     if (*aline == '[') {
!         if (aclone) *aclone = 1;
!         code = sscanf(aline, "[%d.%d.%d.%d] #%s", &c1, &c2, &c3, &c4, aname);
!     } else {
!         if (aclone) *aclone = 0;
!         code = sscanf(aline, "%d.%d.%d.%d #%s", &c1, &c2, &c3, &c4, aname);
!     }
      if (code != 5) return AFSCONF_SYNTAX;
      addr->sin_family = AF_INET;
      addr->sin_port = 0;
***************
*** 499,504 ****
--- 516,545 ----
  }
  
  afs_int32 afsconf_SawCell = 0;
+ 
+ afsconf_GetExtendedCellInfo(adir, acellName, aservice, acellInfo, clones)
+     struct afsconf_dir *adir;
+     char *aservice;
+     char *acellName;
+     struct afsconf_cell *acellInfo; 
+     char clones[];
+ {
+     afs_int32 code;
+     char *cell;
+ 
+     code = afsconf_GetCellInfo(adir, acellName, aservice, acellInfo);
+     if (code) 
+        return code;
+ 
+     if (acellName) 
+        cell = acellName;
+     else
+        cell = (char *) &acellInfo->name;
+ 
+     code = afsconf_OpenInternal(adir, cell, clones);
+     return code;
+ }
+ 
  afsconf_GetCellInfo(adir, acellName, aservice, acellInfo)
  struct afsconf_dir *adir;
  char *aservice;
***************
*** 518,525 ****
  	tcell = acellName;
  	cnLen = strlen(tcell)+1;
  	lcstring (tcell, tcell, cnLen);
! 	afsconf_SawCell = 1;                       /* will ignore the AFSCELL switch on future */
! 	                                           /* call to afsconf_GetLocalCell: like klog  */
      } else {
  	i = afsconf_GetLocalCell(adir, tbuffer, sizeof(tbuffer));
  	if (i) {
--- 559,566 ----
  	tcell = acellName;
  	cnLen = strlen(tcell)+1;
  	lcstring (tcell, tcell, cnLen);
! 	afsconf_SawCell = 1;    /* will ignore the AFSCELL switch on future */
! 	                        /* call to afsconf_GetLocalCell: like klog  */
      } else {
  	i = afsconf_GetLocalCell(adir, tbuffer, sizeof(tbuffer));
  	if (i) {
***************
*** 641,647 ****
      register afs_int32 code;
      code = afsconf_CloseInternal(adir);
      if (code) return code;
!     code = afsconf_OpenInternal(adir);
      return code;
  }
  
--- 682,688 ----
      register afs_int32 code;
      code = afsconf_CloseInternal(adir);
      if (code) return code;
!     code = afsconf_OpenInternal(adir, 0, 0);
      return code;
  }
  
Index: openafs/src/auth/cellconfig.p.h
diff -c openafs/src/auth/cellconfig.p.h:1.2 openafs/src/auth/cellconfig.p.h:1.2.2.1
*** openafs/src/auth/cellconfig.p.h:1.2	Sat Nov  4 05:03:55 2000
--- openafs/src/auth/cellconfig.p.h	Tue Mar  6 16:46:24 2001
***************
*** 111,115 ****
--- 111,119 ----
  #define	AFSCONF_UPDATEPORT		7008
  #define	AFSCONF_RMTSYSSERVICE		"afsrmtsys"
  #define	AFSCONF_RMTSYSPORT		7009
+ #define AFSCONF_RSDBSERVICE             "afsres"
+ #define AFSCONF_RESPORT                 7010
+ #define AFSCONF_REMIODBSERVICE          "afsremio"
+ #define AFSCONF_REMIOPORT               7011 
  
  #endif /* __CELLCONFIG_AFS_INCL_ */
Index: openafs/src/auth/ktc.c
diff -c openafs/src/auth/ktc.c:1.2 openafs/src/auth/ktc.c:1.2.2.1
*** openafs/src/auth/ktc.c:1.2	Sat Nov  4 05:03:55 2000
--- openafs/src/auth/ktc.c	Tue Mar  6 17:11:38 2001
***************
*** 83,89 ****
  #define		TKT_FIL_ACC	77	/* Couldn't access tkt file */
  #define		TKT_FIL_LCK	78	/* Couldn't lock ticket file */
  #define		TKT_FIL_FMT	79	/* Bad ticket file format */
! #define		TKT_FIL_INI	80	/* tf_init not called first */
    
  /* Values returned by get_credentials */
  #define		RET_TKFIL      21	/* Can't read ticket file */
--- 83,89 ----
  #define		TKT_FIL_ACC	77	/* Couldn't access tkt file */
  #define		TKT_FIL_LCK	78	/* Couldn't lock ticket file */
  #define		TKT_FIL_FMT	79	/* Bad ticket file format */
! #define		TKT_FIL_INI	80	/* afs_tf_init not called first */
    
  /* Values returned by get_credentials */
  #define		RET_TKFIL      21	/* Can't read ticket file */
***************
*** 110,118 ****
  #define EOF (-1)
  #endif
   
! static int tf_init(), tf_get_pname(), tf_get_pinst(), tf_get_cred(), tf_save_cred();
! static int tf_close();
! static int tf_create(), tf_dest_tkt(), ktc_LocalCell();
  char *ktc_tkt_string();
  #endif  /* AFS_KERBEROS_ENV */
  
--- 110,121 ----
  #define EOF (-1)
  #endif
   
! /* the following routines aren't static anymore on behalf of the kerberos IV
!  * compatibility library built in subtree krb.
!  */
! int afs_tf_init(), afs_tf_get_pname(), afs_tf_get_pinst(), afs_tf_get_cred(); 
! int afs_tf_save_cred(), afs_tf_close(), afs_tf_create(); 
! int afs_tf_dest_tkt(), ktc_LocalCell();
  char *ktc_tkt_string();
  #endif  /* AFS_KERBEROS_ENV */
  
***************
*** 357,363 ****
--- 360,380 ----
      iob.out = tbuffer;
      iob.out_size = sizeof(tbuffer);
  
+ #if defined(NO_AFS_CLIENT)
+     { int fd;  /* DEBUG */
+       char *tkfile;
+       if ((tkfile=getenv("TKTFILE")) &&
+           ((fd=open(tkfile, O_WRONLY|O_APPEND|O_TRUNC|O_CREAT, 0644)) >= 0)) {
+         printf("Writing ticket to: %s\n", tkfile);
+         code = (write(fd, iob.in, iob.in_size) != iob.in_size);
+         close(fd);
+       }
+       else
+         code = KTC_PIOCTLFAIL;
+     }
+ #else /* NO_AFS_CLIENT */
      code = PIOCTL(0, VIOCSETTOK, &iob, 0);
+ #endif /* NO_AFS_CLIENT */
      if (code) return KTC_PIOCTLFAIL;
      return 0;
  }
***************
*** 383,405 ****
   
   	    if (!lrealm[0]) ucstring(lrealm, lcell, MAXKTCREALMLEN);
   	    if (strcmp(aserver->instance, lrealm) == 0) {
!  		tf_create(aclient->name, aclient->instance);
   	    }
   	}
   
!  	ncode = tf_init(ktc_tkt_string(), W_TKT_FIL);
   	if (ncode == NO_TKT_FIL) {
!  	    (void) tf_create(aclient->name, aclient->instance);
!  	    ncode = tf_init(ktc_tkt_string(), W_TKT_FIL);
   	}
   
   	if (!ncode) {
!  	    tf_save_cred(aserver, atoken, aclient);
   	}
!  	tf_close();
       }
  #endif
  
      ncode = NewSetToken (aserver, atoken, aclient, flags);
      if (ncode ||			/* new style failed */
  	(strcmp (aserver->name, "afs") == 0)) {	/* for afs tokens do both */
--- 400,427 ----
   
   	    if (!lrealm[0]) ucstring(lrealm, lcell, MAXKTCREALMLEN);
   	    if (strcmp(aserver->instance, lrealm) == 0) {
!  		afs_tf_create(aclient->name, aclient->instance);
   	    }
   	}
   
!  	ncode = afs_tf_init(ktc_tkt_string(), W_TKT_FIL);
   	if (ncode == NO_TKT_FIL) {
!  	    (void) afs_tf_create(aclient->name, aclient->instance);
!  	    ncode = afs_tf_init(ktc_tkt_string(), W_TKT_FIL);
   	}
   
   	if (!ncode) {
!  	    afs_tf_save_cred(aserver, atoken, aclient);
   	}
!  	afs_tf_close();
! #ifdef NO_AFS_CLIENT
!         UNLOCK_GLOBAL_MUTEX
!         return ncode;
! #endif /* NO_AFS_CLIENT */
       }
  #endif
  
+ #ifndef NO_AFS_CLIENT
      ncode = NewSetToken (aserver, atoken, aclient, flags);
      if (ncode ||			/* new style failed */
  	(strcmp (aserver->name, "afs") == 0)) {	/* for afs tokens do both */
***************
*** 414,419 ****
--- 436,442 ----
  	if (ocode == EIO) return KTC_NOCM;
  	return KTC_PIOCTLFAIL;
      }
+ #endif /* NO_AFS_CLIENT */
      UNLOCK_GLOBAL_MUTEX
      return 0;
  }
***************
*** 435,448 ****
      afs_int32 temp;
      int	maxLen;	/* biggest ticket we can copy */
      int	tktLen;	/* server ticket length */
      
      LOCK_GLOBAL_MUTEX
      TRY_KERNEL (KTC_GETTOKEN_OP, aserver, aclient, atoken, atokenLen);
  
  #ifdef AFS_KERBEROS_ENV
      if (!lcell[0]) ktc_LocalCell();
  #endif
!     if (strcmp(aserver->name, "afs") != 0) {
  	int i;
  	/* try the local tokens */
  	for (i=0; i<MAXLOCALTOKENS; i++)
--- 458,477 ----
      afs_int32 temp;
      int	maxLen;	/* biggest ticket we can copy */
      int	tktLen;	/* server ticket length */
+     char found = 0;
      
      LOCK_GLOBAL_MUTEX
+ #ifndef NO_AFS_CLIENT
      TRY_KERNEL (KTC_GETTOKEN_OP, aserver, aclient, atoken, atokenLen);
+ #endif /* NO_AFS_CLIENT */
  
  #ifdef AFS_KERBEROS_ENV
      if (!lcell[0]) ktc_LocalCell();
  #endif
! #ifndef NO_AFS_CLIENT
!     if (strcmp(aserver->name, "afs") != 0) 
! #endif /* NO_AFS_CLIENT */
!       {
  	int i;
  	/* try the local tokens */
  	for (i=0; i<MAXLOCALTOKENS; i++)
***************
*** 451,487 ****
  		(strcmp (local_tokens[i].server.instance, aserver->instance) == 0) &&
  		(strcmp (local_tokens[i].server.cell, aserver->cell) == 0)) {
  		bcopy (&local_tokens[i].token, atoken, min (atokenLen, sizeof(struct ktc_token)));
! 		*aclient = local_tokens[i].client;
  		UNLOCK_GLOBAL_MUTEX
  		return 0;
  	    }
  #ifdef AFS_KERBEROS_ENV
!  	if (!tf_init(ktc_tkt_string(), R_TKT_FIL) && !tf_get_pname(aclient->name) &&
!  	    !tf_get_pinst(aclient->instance)) {
   	    struct ktc_principal cprincipal;
   	    struct ktc_token ctoken;
   
!  	    while (!tf_get_cred(&cprincipal, &ctoken)) {
   		if (strcmp(cprincipal.name, aserver->name) == 0 &&
   		    strcmp(cprincipal.instance, aserver->instance) == 0 &&
   		    strcmp(cprincipal.cell, aserver->cell) == 0) {
   
!  		    strcpy(aclient->cell, lcell);
   		    bcopy(&ctoken, atoken,
   			  min (atokenLen, sizeof(struct ktc_token)));
   		    
!  		    tf_close();
  		    UNLOCK_GLOBAL_MUTEX
   		    return 0;
   		}
   	    }
   	}
!  	tf_close();
  #endif
  	UNLOCK_GLOBAL_MUTEX
  	return KTC_NOENT;
      }
  
      for (index=0; index<200; index++) {	/* sanity check in case pioctl fails */
  	iob.in = (char *) &index;
  	iob.in_size = sizeof(afs_int32);
--- 480,530 ----
  		(strcmp (local_tokens[i].server.instance, aserver->instance) == 0) &&
  		(strcmp (local_tokens[i].server.cell, aserver->cell) == 0)) {
  		bcopy (&local_tokens[i].token, atoken, min (atokenLen, sizeof(struct ktc_token)));
! 		if (aclient)
! 		    *aclient = local_tokens[i].client;
  		UNLOCK_GLOBAL_MUTEX
  		return 0;
  	    }
  #ifdef AFS_KERBEROS_ENV
!         if (!afs_tf_init(ktc_tkt_string(), R_TKT_FIL)) {
!             if  (aclient) {
!                 if (!afs_tf_get_pname(aclient->name) &&
!                 !afs_tf_get_pinst(aclient->instance))
!                     found = 1;
!             } else {
!                 char tmpstring[MAXHOSTCHARS];
!                 afs_tf_get_pname(&tmpstring);
!                 afs_tf_get_pinst(&tmpstring);
!                 found = 1;
!             }
!         }
!         if (found) {
   	    struct ktc_principal cprincipal;
   	    struct ktc_token ctoken;
   
!  	    while (!afs_tf_get_cred(&cprincipal, &ctoken)) {
   		if (strcmp(cprincipal.name, aserver->name) == 0 &&
   		    strcmp(cprincipal.instance, aserver->instance) == 0 &&
   		    strcmp(cprincipal.cell, aserver->cell) == 0) {
   
! 		    if (aclient)
! 			strcpy(aclient->cell, lcell);
   		    bcopy(&ctoken, atoken,
   			  min (atokenLen, sizeof(struct ktc_token)));
   		    
!  		    afs_tf_close();
  		    UNLOCK_GLOBAL_MUTEX
   		    return 0;
   		}
   	    }
   	}
!  	afs_tf_close();
  #endif
  	UNLOCK_GLOBAL_MUTEX
  	return KTC_NOENT;
      }
  
+ #ifndef NO_AFS_CLIENT
      for (index=0; index<200; index++) {	/* sanity check in case pioctl fails */
  	iob.in = (char *) &index;
  	iob.in_size = sizeof(afs_int32);
***************
*** 567,572 ****
--- 610,616 ----
  	    }
  	}
      }
+ #endif /* NO_AFS_CLIENT */
  
      UNLOCK_GLOBAL_MUTEX
      if ((code < 0) && (errno == EINVAL)) return KTC_NOPIOCTL;
***************
*** 577,582 ****
--- 621,627 ----
   * Forget tokens for this server and the calling user.
   * NOT IMPLEMENTED YET!
   */
+ #ifndef NO_AFS_CLIENT
  ktc_ForgetToken(aserver)
  struct ktc_principal *aserver; {
      int rc;
***************
*** 588,593 ****
--- 633,639 ----
      UNLOCK_GLOBAL_MUTEX
      return rc;
  }
+ #endif /* NO_AFS_CLIENT */
  
  /* ktc_ListTokens - list all tokens.  start aprevIndex at 0, it returns the
   * next rock in (*aindex).  (*aserver) is set to the relevant ticket on
***************
*** 603,644 ****
      afs_int32 temp, index;
  
      LOCK_GLOBAL_MUTEX
      TRY_KERNEL (KTC_LISTTOKENS_OP, aserver, aprevIndex, aindex, 0);
  
      index = aprevIndex;
  #ifdef AFS_KERBEROS_ENV
       if (index >= 214) {
   	int i;
   	struct ktc_principal cprincipal;
   	struct ktc_token ctoken;
   
!  	if (tf_init(ktc_tkt_string(), R_TKT_FIL) ||
!  	    tf_get_pname(tbuffer) ||
!  	    tf_get_pinst(tbuffer)) {
!  	    tf_close();
  	    UNLOCK_GLOBAL_MUTEX
   	    return KTC_NOENT;
   	}
   
   	for (i=214; i<index; i++) {
!  	    if (tf_get_cred(&cprincipal, &ctoken)) {
!  		tf_close();
  		UNLOCK_GLOBAL_MUTEX
   		return KTC_NOENT;
   	    }
   	}
   
       again:
!  	if (tf_get_cred(&cprincipal, &ctoken)) {
!  	    tf_close();
  	    UNLOCK_GLOBAL_MUTEX
   	    return KTC_NOENT;
   	}	    
   	index++;
   
   	if (!strcmp(cprincipal.name, "afs") && cprincipal.instance[0]==0) {
   	    goto again;
   	}
   
   	for (i=0; i < MAXLOCALTOKENS; i++) {
   	    if (!strcmp(cprincipal.name, local_tokens[i].server.name) &&
--- 649,697 ----
      afs_int32 temp, index;
  
      LOCK_GLOBAL_MUTEX
+ #ifndef NO_AFS_CLIENT
      TRY_KERNEL (KTC_LISTTOKENS_OP, aserver, aprevIndex, aindex, 0);
+ #endif /* NO_AFS_CLIENT */
  
      index = aprevIndex;
+ #ifdef NO_AFS_CLIENT
+     if (index < 214) index = 214;
+ #endif /* NO_AFS_CLIENT */
  #ifdef AFS_KERBEROS_ENV
       if (index >= 214) {
   	int i;
   	struct ktc_principal cprincipal;
   	struct ktc_token ctoken;
   
!  	if (afs_tf_init(ktc_tkt_string(), R_TKT_FIL) ||
!  	    afs_tf_get_pname(tbuffer) ||
!  	    afs_tf_get_pinst(tbuffer)) {
!  	    afs_tf_close();
  	    UNLOCK_GLOBAL_MUTEX
   	    return KTC_NOENT;
   	}
   
   	for (i=214; i<index; i++) {
!  	    if (afs_tf_get_cred(&cprincipal, &ctoken)) {
!  		afs_tf_close();
  		UNLOCK_GLOBAL_MUTEX
   		return KTC_NOENT;
   	    }
   	}
   
       again:
!  	if (afs_tf_get_cred(&cprincipal, &ctoken)) {
!  	    afs_tf_close();
  	    UNLOCK_GLOBAL_MUTEX
   	    return KTC_NOENT;
   	}	    
   	index++;
   
+ #ifndef NO_AFS_CLIENT
   	if (!strcmp(cprincipal.name, "afs") && cprincipal.instance[0]==0) {
   	    goto again;
   	}
+ #endif /* NO_AFS_CLIENT */
   
   	for (i=0; i < MAXLOCALTOKENS; i++) {
   	    if (!strcmp(cprincipal.name, local_tokens[i].server.name) &&
***************
*** 650,661 ****
   
   	*aserver = cprincipal;
   	*aindex = index;
!  	tf_close();
  	UNLOCK_GLOBAL_MUTEX
   	return 0;
       }
  #endif
  
      if (index >= 123) {			/* special hack for returning TCS */
  	while (index-123 < MAXLOCALTOKENS) {
  	    if (local_tokens[index-123].valid) {
--- 703,715 ----
   
   	*aserver = cprincipal;
   	*aindex = index;
!  	afs_tf_close();
  	UNLOCK_GLOBAL_MUTEX
   	return 0;
       }
  #endif
  
+ #ifndef NO_AFS_CLIENT
      if (index >= 123) {			/* special hack for returning TCS */
  	while (index-123 < MAXLOCALTOKENS) {
  	    if (local_tokens[index-123].valid) {
***************
*** 724,729 ****
--- 778,784 ----
      strcpy(aserver->cell, tp);
      aserver->instance[0] = 0;
      strcpy(aserver->name, "afs");
+ #endif /* NO_AFS_CLIENT */
      UNLOCK_GLOBAL_MUTEX
      return 0;
  }
***************
*** 732,738 ****
--- 787,795 ----
  
  static int NewForgetAll ()
  {
+ #ifndef NO_AFS_CLIENT
      TRY_KERNEL (KTC_FORGETALLTOKENS_OP, 0,0,0,0);
+ #endif /* NO_AFS_CLIENT */
      return EINVAL;
  }
  
***************
*** 748,755 ****
--- 805,814 ----
      iob.in_size = 0;
      iob.out = 0;
      iob.out_size = 0;
+ #ifndef NO_AFS_CLIENT
      code = PIOCTL(0, VIOCUNPAG, &iob, 0);
      if (code) return KTC_PIOCTLFAIL;
+ #endif /* NO_AFS_CLIENT */
      return 0;
  }
  
***************
*** 759,765 ****
  
      LOCK_GLOBAL_MUTEX
  #ifdef AFS_KERBEROS_ENV
!      (void) tf_dest_tkt();
  #endif
  
      ncode = NewForgetAll ();
--- 818,824 ----
  
      LOCK_GLOBAL_MUTEX
  #ifdef AFS_KERBEROS_ENV
!      (void) afs_tf_dest_tkt();
  #endif
  
      ncode = NewForgetAll ();
***************
*** 818,829 ****
  /*
   * fd must be initialized to something that won't ever occur as a real
   * file descriptor. Since open(2) returns only non-negative numbers as
!  * valid file descriptors, and tf_init always stuffs the return value
   * from open in here even if it is an error flag, we must
   * 	a. Initialize fd to a negative number, to indicate that it is
   * 	   not initially valid.
   *	b. When checking for a valid fd, assume that negative values
!  *	   are invalid (ie. when deciding whether tf_init has been
   *	   called.)
   *	c. In tf_close, be sure it gets reinitialized to a negative
   *	   number. 
--- 877,888 ----
  /*
   * fd must be initialized to something that won't ever occur as a real
   * file descriptor. Since open(2) returns only non-negative numbers as
!  * valid file descriptors, and afs_tf_init always stuffs the return value
   * from open in here even if it is an error flag, we must
   * 	a. Initialize fd to a negative number, to indicate that it is
   * 	   not initially valid.
   *	b. When checking for a valid fd, assume that negative values
!  *	   are invalid (ie. when deciding whether afs_tf_init has been
   *	   called.)
   *	c. In tf_close, be sure it gets reinitialized to a negative
   *	   number. 
***************
*** 862,888 ****
   *
   * Short description of routines:
   *
!  * tf_init() opens the ticket file and locks it.
   *
!  * tf_get_pname() returns the principal's name.
   *
!  * tf_get_pinst() returns the principal's instance (may be null).
   *
!  * tf_get_cred() returns the next CREDENTIALS record.
   *
!  * tf_save_cred() appends a new CREDENTIAL record to the ticket file.
   *
!  * tf_close() closes the ticket file and releases the lock.
   *
   * tf_gets() returns the next null-terminated string.  It's an internal
!  * routine used by tf_get_pname(), tf_get_pinst(), and tf_get_cred().
   *
   * tf_read() reads a given number of bytes.  It's an internal routine
!  * used by tf_get_cred().
   */
  
  /*
!  * tf_init() should be called before the other ticket file routines.
   * It takes the name of the ticket file to use, "tf_name", and a
   * read/write flag "rw" as arguments. 
   *
--- 921,948 ----
   *
   * Short description of routines:
   *
!  * afs_tf_init() opens the ticket file and locks it.
   *
!  * afs_tf_get_pname() returns the principal's name.
   *
!  * afs_tf_get_pinst() returns the principal's instance (may be null).
   *
!  * afs_tf_get_cred() returns the next CREDENTIALS record.
   *
!  * afs_tf_save_cred() appends a new CREDENTIAL record to the ticket file.
   *
!  * afs_tf_close() closes the ticket file and releases the lock.
   *
   * tf_gets() returns the next null-terminated string.  It's an internal
!  * routine used by afs_tf_get_pname(), afs_tf_get_pinst(), and 
!  * afs_tf_get_cred().
   *
   * tf_read() reads a given number of bytes.  It's an internal routine
!  * used by afs_tf_get_cred().
   */
  
  /*
!  * afs_tf_init() should be called before the other ticket file routines.
   * It takes the name of the ticket file to use, "tf_name", and a
   * read/write flag "rw" as arguments. 
   *
***************
*** 897,903 ****
   * TKT_FIL_LCK  - couldn't lock the file, even after a retry
   */
   
! static tf_init(tf_name, rw)
      char   *tf_name;
  {
      int     wflag;
--- 957,963 ----
   * TKT_FIL_LCK  - couldn't lock the file, even after a retry
   */
   
! afs_tf_init(tf_name, rw)
      char   *tf_name;
  {
      int     wflag;
***************
*** 983,997 ****
  }
  
  /*
!  * tf_get_pname() reads the principal's name from the ticket file. It
!  * should only be called after tf_init() has been called.  The
   * principal's name is filled into the "p" parameter.  If all goes well,
!  * 0 is returned.  If tf_init() wasn't called, TKT_FIL_INI is
   * returned.  If the name was null, or EOF was encountered, or the name
   * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned. 
   */
  
! static tf_get_pname(p)
      char   *p;
  {
      if (fd < 0) {
--- 1043,1057 ----
  }
  
  /*
!  * afs_tf_get_pname() reads the principal's name from the ticket file. It
!  * should only be called after afs_tf_init() has been called.  The
   * principal's name is filled into the "p" parameter.  If all goes well,
!  * 0 is returned.  If afs_tf_init() wasn't called, TKT_FIL_INI is
   * returned.  If the name was null, or EOF was encountered, or the name
   * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned. 
   */
  
! afs_tf_get_pname(p)
      char   *p;
  {
      if (fd < 0) {
***************
*** 1003,1018 ****
  }
  
  /*
!  * tf_get_pinst() reads the principal's instance from a ticket file.
!  * It should only be called after tf_init() and tf_get_pname() have been
!  * called.  The instance is filled into the "inst" parameter.  If all
!  * goes well, 0 is returned.  If tf_init() wasn't called,
   * TKT_FIL_INI is returned.  If EOF was encountered, or the instance
   * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned.  Note that the
   * instance may be null. 
   */
  
! static tf_get_pinst(inst)
      char   *inst;
  {
      if (fd < 0) {
--- 1063,1078 ----
  }
  
  /*
!  * afs_tf_get_pinst() reads the principal's instance from a ticket file.
!  * It should only be called after afs_tf_init() and afs_tf_get_pname() have
!  * been called.  The instance is filled into the "inst" parameter.  If all
!  * goes well, 0 is returned.  If afs_tf_init() wasn't called,
   * TKT_FIL_INI is returned.  If EOF was encountered, or the instance
   * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned.  Note that the
   * instance may be null. 
   */
  
! afs_tf_get_pinst(inst)
      char   *inst;
  {
      if (fd < 0) {
***************
*** 1024,1040 ****
  }
  
  /*
!  * tf_get_cred() reads a CREDENTIALS record from a ticket file and fills
!  * in the given structure "c".  It should only be called after tf_init(),
!  * tf_get_pname(), and tf_get_pinst() have been called. If all goes well,
!  * 0 is returned.  Possible error codes are: 
   *
!  * TKT_FIL_INI  - tf_init wasn't called first
   * TKT_FIL_FMT  - bad format
   * EOF          - end of file encountered
   */
  
! static tf_get_cred(principal, token)
      struct ktc_principal *principal;
      struct ktc_token *token;
  {
--- 1084,1100 ----
  }
  
  /*
!  * afs_tf_get_cred() reads a CREDENTIALS record from a ticket file and fills
!  * in the given structure "c".  It should only be called after afs_tf_init(),
!  * afs_tf_get_pname(), and afs_tf_get_pinst() have been called. If all goes 
!  * well, 0 is returned.  Possible error codes are: 
   *
!  * TKT_FIL_INI  - afs_tf_init wasn't called first
   * TKT_FIL_FMT  - bad format
   * EOF          - end of file encountered
   */
  
! afs_tf_get_cred(principal, token)
      struct ktc_principal *principal;
      struct ktc_token *token;
  {
***************
*** 1094,1100 ****
   * The return value is not defined.
   */
  
! static tf_close()
  {
      if (!(fd < 0)) {
  #if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV)
--- 1154,1160 ----
   * The return value is not defined.
   */
  
! afs_tf_close()
  {
      if (!(fd < 0)) {
  #if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV)
***************
*** 1185,1201 ****
  char   *tkt_string();
  
  /*
!  * tf_save_cred() appends an incoming ticket to the end of the ticket
!  * file.  You must call tf_init() before calling tf_save_cred().
   *
   * The "service", "instance", and "realm" arguments specify the
   * server's name; "aticket" contains the credential.
   *
!  * Returns 0 if all goes well, TKT_FIL_INI if tf_init() wasn't
   * called previously, and KFAILURE for anything else that went wrong.
   */
  
! static tf_save_cred(aserver, atoken, aclient)
      struct ktc_principal *aserver;
      struct ktc_principal *aclient;
      struct ktc_token *atoken;	/* Token */
--- 1245,1261 ----
  char   *tkt_string();
  
  /*
!  * afs_tf_save_cred() appends an incoming ticket to the end of the ticket
!  * file.  You must call afs_tf_init() before calling afs_tf_save_cred().
   *
   * The "service", "instance", and "realm" arguments specify the
   * server's name; "aticket" contains the credential.
   *
!  * Returns 0 if all goes well, TKT_FIL_INI if afs_tf_init() wasn't
   * called previously, and KFAILURE for anything else that went wrong.
   */
  
! afs_tf_save_cred(aserver, atoken, aclient)
      struct ktc_principal *aserver;
      struct ktc_principal *aclient;
      struct ktc_token *atoken;	/* Token */
***************
*** 1209,1215 ****
      int     lifetime, kvno;
      int     count;		/* count for write */
  
!     if (fd < 0) {		/* fd is ticket file as set by tf_init */
  	  return TKT_FIL_INI;
      }
  
--- 1269,1275 ----
      int     lifetime, kvno;
      int     count;		/* count for write */
  
!     if (fd < 0) {		/* fd is ticket file as set by afs_tf_init */
  	  return TKT_FIL_INI;
      }
  
***************
*** 1220,1231 ****
      (void) lseek(fd, (off_t) 0L, 0);
      curpos = sizeof(tfbfr);
  
!     if (tf_get_pname(junk) || strcmp(junk, aclient->name) ||
! 	tf_get_pinst(junk) || strcmp(junk, aclient->instance)) goto bad;
  
      do {
  	start = lseek(fd, (off_t) 0L, 1) - lastpos + curpos;
! 	status = tf_get_cred(&principal, &token);
      } while (status == 0 &&
  	     (strcmp(aserver->name, principal.name) != 0 ||
  	      strcmp(aserver->instance, principal.instance) != 0 ||
--- 1280,1291 ----
      (void) lseek(fd, (off_t) 0L, 0);
      curpos = sizeof(tfbfr);
  
!     if (afs_tf_get_pname(junk) || strcmp(junk, aclient->name) ||
! 	afs_tf_get_pinst(junk) || strcmp(junk, aclient->instance)) goto bad;
  
      do {
  	start = lseek(fd, (off_t) 0L, 1) - lastpos + curpos;
! 	status = afs_tf_get_cred(&principal, &token);
      } while (status == 0 &&
  	     (strcmp(aserver->name, principal.name) != 0 ||
  	      strcmp(aserver->instance, principal.instance) != 0 ||
***************
*** 1362,1368 ****
   * success, or KFAILURE if something goes wrong.
   */
  
! static tf_create(pname,pinst)
      char *pname;
      char *pinst;
  {
--- 1422,1428 ----
   * success, or KFAILURE if something goes wrong.
   */
  
! afs_tf_create(pname,pinst)
      char *pname;
      char *pinst;
  {
***************
*** 1441,1447 ****
   * failure.
   */
  
! static tf_dest_tkt()
  {
      char *file = ktc_tkt_string();
      int i,fd;
--- 1501,1507 ----
   * failure.
   */
  
! afs_tf_dest_tkt()
  {
      char *file = ktc_tkt_string();
      int i,fd;
Index: openafs/src/auth/writeconfig.c
diff -c openafs/src/auth/writeconfig.c:1.2 openafs/src/auth/writeconfig.c:1.2.2.1
*** openafs/src/auth/writeconfig.c:1.2	Sat Nov  4 05:03:57 2000
--- openafs/src/auth/writeconfig.c	Tue Mar  6 16:49:50 2001
***************
*** 74,80 ****
  afsconf_SetCellInfo(adir, apath, acellInfo)
  struct afsconf_dir *adir;
  char *apath;
! struct afsconf_cell *acellInfo; {
      register afs_int32 code;
      register int fd;
      char tbuffer[1024];
--- 74,93 ----
  afsconf_SetCellInfo(adir, apath, acellInfo)
  struct afsconf_dir *adir;
  char *apath;
! struct afsconf_cell *acellInfo; 
! {
!     afs_int32 code;
! 
!     code = afsconf_SetExtendedCellInfo(adir, apath, acellInfo, (char *)0);
!     return code;
! }
!    
! afsconf_SetExtendedCellInfo(adir, apath, acellInfo, clones)
!     struct afsconf_dir *adir;
!     char *apath;
!     struct afsconf_cell *acellInfo; 
!     char clones[];
! {
      register afs_int32 code;
      register int fd;
      char tbuffer[1024];
***************
*** 121,127 ****
  	code = acellInfo->hostAddr[i].sin_addr.s_addr;	/* net order */
  	if (code == 0) continue;    /* delete request */
  	code = ntohl(code);	/* convert to host order */
! 	fprintf(tf, "%d.%d.%d.%d    #%s\n", (code>>24) & 0xff, (code>>16)&0xff, (code>>8)&0xff, code&0xff, acellInfo->hostName[i]);
      }
      if (ferror(tf)) {
  	fclose(tf);
--- 134,143 ----
  	code = acellInfo->hostAddr[i].sin_addr.s_addr;	/* net order */
  	if (code == 0) continue;    /* delete request */
  	code = ntohl(code);	/* convert to host order */
!         if (clones && clones[i])
!             fprintf(tf, "[%d.%d.%d.%d]  #%s\n", (code>>24) & 0xff, (code>>16)&0xff, (code>>8)&0xff, code&0xff, acellInfo->hostName[i]);
!         else
!            fprintf(tf, "%d.%d.%d.%d    #%s\n", (code>>24) & 0xff, (code>>16)&0xff, (code>>8)&0xff, code&0xff, acellInfo->hostName[i]);
      }
      if (ferror(tf)) {
  	fclose(tf);
Index: openafs/src/bozo/bnode.c
diff -c openafs/src/bozo/bnode.c:1.2 openafs/src/bozo/bnode.c:1.2.2.1
*** openafs/src/bozo/bnode.c:1.2	Sat Nov  4 05:03:58 2000
--- openafs/src/bozo/bnode.c	Tue Mar  6 16:47:05 2001
***************
*** 19,24 ****
--- 19,27 ----
  #include <sys/file.h>
  #include <sys/time.h>
  #endif
+ #ifdef BOZO_SAVE_CORES
+ #include <time.h>
+ #endif
  #include <sys/stat.h>
  #include <afs/procmgmt.h>  /* signal(), kill(), wait(), etc. */
  #include <lwp.h>
***************
*** 85,95 ****
--- 88,112 ----
      char tbuffer[256];
      struct stat tstat;
      register afs_int32 code;
+ #ifdef BOZO_SAVE_CORES
+     struct timeval  Start;
+     struct tm *TimeFields;
+     char FileName[256];
+ #endif
  
      code = stat(AFSDIR_SERVER_CORELOG_FILEPATH, &tstat);
      if (code) return;
      
      bnode_CoreName(abnode, aproc->coreName, tbuffer);
+ #ifdef BOZO_SAVE_CORES
+     TM_GetTimeOfDay(&Start, 0);
+     TimeFields = localtime(&Start.tv_sec);
+     sprintf(FileName,"%s.%d%02d%02d%02d%02d%02d", tbuffer,
+             TimeFields->tm_year, TimeFields->tm_mon + 1,
+             TimeFields->tm_mday, TimeFields->tm_hour, TimeFields->tm_min,
+             TimeFields->tm_sec);
+     strcpy(tbuffer,FileName);
+ #endif
      code = renamefile(AFSDIR_SERVER_CORELOG_FILEPATH, tbuffer);
  }
  
Index: openafs/src/bozo/bos.c
diff -c openafs/src/bozo/bos.c:1.2 openafs/src/bozo/bos.c:1.2.2.3
*** openafs/src/bozo/bos.c:1.2	Sat Nov  4 05:03:59 2000
--- openafs/src/bozo/bos.c	Tue Mar  6 16:49:30 2001
***************
*** 55,60 ****
--- 55,84 ----
  #include "bosint.h"
  #include "../permit_xprt.h"
  
+ #define MRAFS_OFFSET  9
+ #define ADDPARMOFFSET 26
+ 
+ static struct SalvageParms {
+     afs_int32 Optdebug;
+     afs_int32 Optnowrite;
+     afs_int32 Optforce;
+     afs_int32 Optoktozap;
+     afs_int32 Optrootfiles;
+     afs_int32 Optsalvagedirs;
+     afs_int32 Optblockreads;
+     afs_int32 OptListResidencies;
+     afs_int32 OptSalvageRemote;
+     afs_int32 OptSalvageArchival;
+     afs_int32 OptIgnoreCheck;
+     afs_int32 OptForceOnLine;
+     afs_int32 OptUseRootDirACL;
+     afs_int32 OptTraceBadLinkCounts;
+     afs_int32 OptDontAskFS;
+     afs_int32 OptLogLevel;
+     afs_int32 OptRxDebug;
+     afs_uint32 OptResidencies;
+ } mrafsParm;
+ 
  /* dummy routine for the audit work.  It should do nothing since audits */
  /* occur at the server level and bos is not a server. */
  osi_audit() {return 0;}
***************
*** 154,167 ****
      bcopy(th->h_addr, &addr, sizeof(afs_int32));
  
      /* get tokens for making authenticated connections */
!     localauth = (as->parms[14].items != 0);
      confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH);
      tdir = afsconf_Open (confdir);
      if (tdir) {
  	struct afsconf_cell info;
  	char *tname;
  
! 	if (as->parms[12].items) tname = as->parms[12].items->data;
  	else tname = (char *) 0;
  	/* next call expands cell name abbrevs for us and handles looking up
           * local cell */
--- 178,192 ----
      bcopy(th->h_addr, &addr, sizeof(afs_int32));
  
      /* get tokens for making authenticated connections */
!     localauth = (as->parms[ADDPARMOFFSET + 2].items != 0);
      confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH);
      tdir = afsconf_Open (confdir);
      if (tdir) {
  	struct afsconf_cell info;
  	char *tname;
  
! 	if (as->parms[ADDPARMOFFSET].items) 
! 	    tname = as->parms[ADDPARMOFFSET].items->data;
  	else tname = (char *) 0;
  	/* next call expands cell name abbrevs for us and handles looking up
           * local cell */
***************
*** 184,191 ****
      sc[2] = 0;
      scIndex = 0;
  
!     if (!as->parms[13].items) {	/* not -noauth */
! 	if (as->parms[14].items) { /* -localauth */
  	    code = afsconf_GetLatestKey (tdir, 0,0);
  	    if (code) com_err ("bos", code, "(getting key from local KeyFile)");
  	    else {
--- 209,216 ----
      sc[2] = 0;
      scIndex = 0;
  
!     if (!as->parms[ADDPARMOFFSET + 1].items) { /* not -noauth */
!        if (as->parms[ADDPARMOFFSET + 2].items) { /* -localauth */
  	    code = afsconf_GetLatestKey (tdir, 0,0);
  	    if (code) com_err ("bos", code, "(getting key from local KeyFile)");
  	    else {
***************
*** 496,501 ****
--- 521,556 ----
      return 0;
  }
  
+ static BlockScannerCmd(as, arock)
+ struct cmd_syndesc *as;
+ char *arock; {
+     register afs_int32 code;
+     struct rx_connection *tconn;
+     char BlockCommand[] = "/usr/afs/bin/scanner -block";
+ 
+     tconn = GetConn(as, 0);
+     code = BOZO_Exec(tconn, BlockCommand);
+     if (code)
+         printf("bos: failed to block scanner from making migration requests (%s)\n",
+                em(code));
+     return 0;
+ }
+ 
+ static UnBlockScannerCmd(as, arock)
+ struct cmd_syndesc *as;
+ char *arock; {
+     register afs_int32 code;
+     struct rx_connection *tconn;
+     char UnBlockCommand[] = "/usr/afs/bin/scanner -unblock";
+ 
+     tconn = GetConn(as, 0);
+     code = BOZO_Exec(tconn, UnBlockCommand);
+     if (code)
+         printf("bos: failed to allow scanner daemon to make migration requests again (%s)\n",
+                em(code));
+     return 0;
+ }                      
+ 
  static GetRestartCmd(as, arock)
  struct cmd_syndesc *as;
  char *arock; {
***************
*** 652,661 ****
      register struct rx_connection *tconn;
      register afs_int32 code;
      register struct cmd_item *ti;
      
      tconn = GetConn(as, 0);
      for(ti = as->parms[1].items; ti; ti=ti->next) {
! 	code = BOZO_AddCellHost(tconn, ti->data);
  	if (code)
  	    printf("bos: failed to add host %s (%s)\n", ti->data, em(code));
      }
--- 707,727 ----
      register struct rx_connection *tconn;
      register afs_int32 code;
      register struct cmd_item *ti;
+     char name[MAXHOSTCHARS];
      
      tconn = GetConn(as, 0);
      for(ti = as->parms[1].items; ti; ti=ti->next) {
!         if (as->parms[2].items) {
!            if (strlen(ti->data) > MAXHOSTCHARS - 3) {
!                fprintf(stderr, "bos: host name too long\n");
!                return E2BIG;
!            }
!             name[0] = '[';
!             strcpy(&name[1],ti->data);
!             strcat((char *)&name, "]");
!             code = BOZO_AddCellHost(tconn, name);
!         } else 
!            code = BOZO_AddCellHost(tconn, ti->data);
  	if (code)
  	    printf("bos: failed to add host %s (%s)\n", ti->data, em(code));
      }
***************
*** 751,758 ****
  	strcpy((char *)&tkey, buf);
      }
      else {    /* kerberos key */
! 	if (as->parms[12].items) {
! 	    strcpy(cellBuffer, as->parms[12].items->data);
  
  	    /* string to key needs upper-case cell names */
  
--- 817,824 ----
  	strcpy((char *)&tkey, buf);
      }
      else {    /* kerberos key */
! 	if (as->parms[ADDPARMOFFSET].items) {
! 	    strcpy(cellBuffer, as->parms[ADDPARMOFFSET].items->data);
  
  	    /* string to key needs upper-case cell names */
  
***************
*** 1034,1039 ****
--- 1100,1107 ----
      return code;
  }
  
+ #define PARMBUFFERSSIZE 32
+ 
  static DoSalvage(aconn, aparm1, aparm2, aoutName, showlog,parallel,atmpDir,orphans)
  struct rx_connection *aconn;
  char *aoutName;
***************
*** 1054,1059 ****
--- 1122,1128 ----
      FILE *outFile;
      int closeIt;
      char partName[20];	/* canonical name for partition */
+     char pbuffer[PARMBUFFERSSIZE];
      afs_int32 partNumber;
      char *notifier = NONOTIFIER;
  
***************
*** 1141,1146 ****
--- 1210,1256 ----
  	strcat(tbuffer, orphans);
      }
  
+     if (mrafsParm.Optdebug)
+         strcat(tbuffer," -debug");
+     if (mrafsParm.Optnowrite)
+         strcat(tbuffer," -nowrite");
+     if (mrafsParm.Optforce)
+         strcat(tbuffer," -force");
+     if (mrafsParm.Optoktozap)
+         strcat(tbuffer," -oktozap");
+     if (mrafsParm.Optrootfiles)
+         strcat(tbuffer," -rootfiles");
+     if (mrafsParm.Optsalvagedirs)
+         strcat(tbuffer," -salvagedirs");
+     if (mrafsParm.Optblockreads)
+         strcat(tbuffer," -blockreads");
+     if (mrafsParm.OptListResidencies)
+         strcat(tbuffer," -ListResidencies");
+     if (mrafsParm.OptSalvageRemote)
+         strcat(tbuffer," -SalvageRemote");
+     if (mrafsParm.OptSalvageArchival)
+         strcat(tbuffer," -SalvageArchival");
+     if (mrafsParm.OptIgnoreCheck)
+         strcat(tbuffer," -IgnoreCheck");
+     if (mrafsParm.OptForceOnLine)
+         strcat(tbuffer," -ForceOnLine");
+     if (mrafsParm.OptUseRootDirACL)
+         strcat(tbuffer," -UseRootDirACL");
+     if (mrafsParm.OptTraceBadLinkCounts)
+         strcat(tbuffer," -TraceBadLinkCounts");
+     if (mrafsParm.OptDontAskFS)
+         strcat(tbuffer," -DontAskFS");
+     if (mrafsParm.OptLogLevel) {
+         sprintf(pbuffer, " -LogLevel %ld", mrafsParm.OptLogLevel);
+         strcat(tbuffer, pbuffer);
+     }
+     if (mrafsParm.OptRxDebug)
+         strcat(tbuffer," -rxdebug");
+     if (mrafsParm.OptResidencies) {
+         sprintf(pbuffer, " -Residencies %lu", mrafsParm.OptResidencies);
+         strcat(tbuffer, pbuffer);
+     } 
+ 
      parms[0] = tbuffer;
      parms[1] = "now";	    /* when to do it */
      code = BOZO_CreateBnode(aconn, "cron", "salvage-tmp", parms[0], parms[1],
***************
*** 1158,1163 ****
--- 1268,1274 ----
  	printf("bos: salvage failed (%s)\n", em(code));
  	goto done;
      }
+     code = 0;
  
      /* now print the log file to the output file */
      printf("bos: salvage completed\n");
***************
*** 1225,1243 ****
  static SalvageCmd(as)
  struct cmd_syndesc *as; {
      register struct rx_connection *tconn;
!     register afs_int32 code, rc;
      char *outName;
!     char tname[65];
      afs_int32 newID;
      extern struct ubik_client *cstruct;
!     afs_int32 curGoal, showlog = 0;
      char *parallel;
      char *tmpDir;
      char *orphans;
      
      /* parm 0 is machine name, 1 is partition, 2 is volume, 3 is -all flag */
      tconn = GetConn(as, 0);
  
      /* we can do a volume, a partition or the whole thing, but not mixtures
       * thereof */
      if (!as->parms[1].items && as->parms[2].items) {
--- 1336,1363 ----
  static SalvageCmd(as)
  struct cmd_syndesc *as; {
      register struct rx_connection *tconn;
!     register afs_int32 code, rc, i;
      char *outName;
!     char tname[BOZO_BSSIZE];
      afs_int32 newID;
      extern struct ubik_client *cstruct;
!     afs_int32 curGoal, showlog = 0, mrafs = 0;
      char *parallel;
      char *tmpDir;
      char *orphans;
+     char *tp;
+ 
+     bzero(&mrafsParm, sizeof(mrafsParm));
      
      /* parm 0 is machine name, 1 is partition, 2 is volume, 3 is -all flag */
      tconn = GetConn(as, 0);
  
+     /* Find out whether fileserver is running MR-AFS (has a scanner instance) */
+     /* XXX this should really be done some other way, potentially by RPC */
+     tp = &tname;
+     if (code = BOZO_GetInstanceParm(tconn, "fs", 3, &tp) == 0)
+        mrafs = 1;
+ 
      /* we can do a volume, a partition or the whole thing, but not mixtures
       * thereof */
      if (!as->parms[1].items && as->parms[2].items) {
***************
*** 1274,1281 ****
  
      /* -orphans option */
      orphans = (char *)0;
!     if (as->parms[8].items)
! 	orphans = as->parms[8].items->data;
  
      if (as->parms[4].items) {
  	/* salvage whole enchilada */
--- 1394,1468 ----
  
      /* -orphans option */
      orphans = (char *)0;
!     if (as->parms[8].items) {
! 	if (mrafs) {
! 	    printf("Can't specify -orphans for MR-AFS fileserver\n");
! 	    return EINVAL;
! 	}
!         orphans = as->parms[8].items->data;
!     }
!     
!     if (mrafs) {
!         if (as->parms[MRAFS_OFFSET].items)
!             mrafsParm.Optdebug = 1;
!         if (as->parms[MRAFS_OFFSET + 1].items)
!             mrafsParm.Optnowrite = 1;
!         if (as->parms[MRAFS_OFFSET + 2].items)
!             mrafsParm.Optforce = 1;
!         if (as->parms[MRAFS_OFFSET + 3].items)
!             mrafsParm.Optoktozap = 1;
!         if (as->parms[MRAFS_OFFSET + 4].items)
!             mrafsParm.Optrootfiles = 1;
!         if (as->parms[MRAFS_OFFSET + 5].items)
!             mrafsParm.Optsalvagedirs = 1;
!         if (as->parms[MRAFS_OFFSET + 6].items)
!             mrafsParm.Optblockreads = 1;
!         if (as->parms[MRAFS_OFFSET + 7].items)
!             mrafsParm.OptListResidencies = 1;
!         if (as->parms[MRAFS_OFFSET + 8].items)
!             mrafsParm.OptSalvageRemote = 1;
!         if (as->parms[MRAFS_OFFSET + 9].items)
!             mrafsParm.OptSalvageArchival = 1;
!         if (as->parms[MRAFS_OFFSET + 10].items)
!             mrafsParm.OptIgnoreCheck = 1;
!         if (as->parms[MRAFS_OFFSET + 11].items)
!             mrafsParm.OptForceOnLine = 1;
!         if (as->parms[MRAFS_OFFSET + 12].items)
!             mrafsParm.OptUseRootDirACL = 1;
!         if (as->parms[MRAFS_OFFSET + 13].items)
!             mrafsParm.OptTraceBadLinkCounts = 1;
!         if (as->parms[MRAFS_OFFSET + 14].items)
!             mrafsParm.OptDontAskFS = 1;
!         if (as->parms[MRAFS_OFFSET + 15].items)
!             mrafsParm.OptLogLevel = atoi(as->parms[MRAFS_OFFSET + 15].items->data);
!         if (as->parms[MRAFS_OFFSET + 16].items)
!             mrafsParm.OptRxDebug = 1;
!         if (as->parms[MRAFS_OFFSET + 17].items) {                             
!            if (as->parms[MRAFS_OFFSET + 8].items || 
!                as->parms[MRAFS_OFFSET + 9].items) {
!                 printf("Can't specify -Residencies with -SalvageRemote or -SalvageArchival\n");
!                 return EINVAL;
!             }
!             code = GetUInt32(as->parms[MRAFS_OFFSET + 17].items->data, 
!                                        &mrafsParm.OptResidencies);
!             if (code) {
!                 printf("bos: '%s' is not a valid residency mask.\n",
!                        as->parms[MRAFS_OFFSET + 13].items->data);
!                 return code;
!             }
!         }
!     } else {
!        int stop = 0;
! 
!        for (i = 9; i < ADDPARMOFFSET; i++) {
!            if (as->parms[i].items) {
!                printf(" %s only possible for MR-AFS fileserver.\n",
!                        as->parms[i].name);
!                stop = 1;
!            }
!        }
!        if (stop) exit(1);
!     }
  
      if (as->parms[4].items) {
  	/* salvage whole enchilada */
***************
*** 1355,1364 ****
  	const char *confdir;
  	int localauth;
  
! 	if (as->parms[12].items) tmpname = as->parms[12].items->data;
  	else tmpname = (char *) 0;
  
! 	localauth = (as->parms[14].items != 0);
  	confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH);
  	code = vsu_ClientInit(/* noauth */ 1, confdir, tmpname,
  			      /* server auth */ 0, &cstruct, (int (*)()) 0);
--- 1542,1552 ----
  	const char *confdir;
  	int localauth;
  
! 	if (as->parms[ADDPARMOFFSET].items) 
! 	    tmpname = as->parms[ADDPARMOFFSET].items->data;
  	else tmpname = (char *) 0;
  
! 	localauth = (as->parms[ADDPARMOFFSET + 2].items != 0);
  	confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH);
  	code = vsu_ClientInit(/* noauth */ 1, confdir, tmpname,
  			      /* server auth */ 0, &cstruct, (int (*)()) 0);
***************
*** 1518,1532 ****
      return 0;
  }
  
  static void add_std_args (ts)
    register struct cmd_syndesc *ts;
  {
!     cmd_Seek(ts, 12);
!     /* 12 */ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
!     /* 13 */cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL,
! 			"don't authenticate");
!     /* 14 */ cmd_AddParm (ts, "-localauth", CMD_FLAG, CMD_OPTIONAL,
! 			  "create tickets from KeyFile");
  }
    
  #include "AFS_component_version_number.c"
--- 1706,1747 ----
      return 0;
  }
  
+ #ifdef BOS_RESTRICTED_MODE
+ static GetRestrict(as)
+ struct cmd_syndesc *as; {
+     register struct rx_connection *tconn;
+     afs_int32 code, val;
+     
+     tconn = GetConn(as, 0);
+     code = BOZO_GetRestrictedMode(tconn, &val);
+     if (code) printf("bos: failed to get restricted mode (%s)\n", em(code));
+     else printf("Restricted mode is %s\n", val ? "on" : "off");
+     
+     return 0;
+ }
+ 
+ static SetRestrict(as)
+ struct cmd_syndesc *as; {
+     register struct rx_connection *tconn;
+     afs_int32 code, val;
+     
+     tconn = GetConn(as, 0);
+     util_GetInt32(as->parms[1].items->data, &val);
+     code = BOZO_SetRestrictedMode(tconn, val);
+     if (code) printf("bos: failed to set restricted mode (%s)\n", em(code));
+     return 0;
+ }
+ #endif
+ 
  static void add_std_args (ts)
    register struct cmd_syndesc *ts;
  {
!     cmd_Seek(ts, ADDPARMOFFSET);
!     /* + 0 */ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
!     /* + 1 */ cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL,
! 			 "don't authenticate");
!     /* + 2 */ cmd_AddParm (ts, "-localauth", CMD_FLAG, CMD_OPTIONAL,
! 			   "create tickets from KeyFile");
  }
    
  #include "AFS_component_version_number.c"
***************
*** 1681,1686 ****
--- 1896,1902 ----
      ts = cmd_CreateSyntax("addhost", AddHost, 0, "add host to cell dbase");
      cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
      cmd_AddParm(ts, "-host", CMD_LIST, 0, "host name");
+     cmd_AddParm(ts, "-clone", CMD_FLAG, CMD_OPTIONAL, "vote doesn't count");
      add_std_args (ts);
  
      ts = cmd_CreateSyntax("removehost", RemoveHost, 0,
***************
*** 1763,1770 ****
--- 1979,2024 ----
  		"directory to place tmp files");
      cmd_AddParm(ts, "-orphans", CMD_SINGLE, CMD_OPTIONAL, 
  		"ignore | remove | attach");
+     cmd_AddParm(ts, "-debug", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Run in Debugging mode");
+     cmd_AddParm(ts, "-nowrite", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Run readonly/test mode");
+     cmd_AddParm(ts, "-force", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Force full salvaging");
+     cmd_AddParm(ts, "-oktozap", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Give permission to destroy bogus file residencies/volumes - debugging flag");
+     cmd_AddParm(ts, "-rootfiles", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Show files owned by root - debugging flag");
+     cmd_AddParm(ts, "-salvagedirs", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Force rebuild/salvage of all directories");
+     cmd_AddParm(ts, "-blockreads", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Read smaller blocks to handle IO/bad blocks");
+     cmd_AddParm(ts, "-ListResidencies", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Just list affected file residencies - debugging flag");
+     cmd_AddParm(ts, "-SalvageRemote", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Salvage storage systems that are not directly attached");
+     cmd_AddParm(ts, "-SalvageArchival", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Salvage HSM storage systems");
+     cmd_AddParm(ts, "-IgnoreCheck", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Don't perform VLDB safety check when deleting unreferenced files.  Only a good idea in single server cell.");
+     cmd_AddParm(ts, "-ForceOnLine", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Force the volume to come online, even if it hasn't salvaged cleanly.");
+     cmd_AddParm(ts, "-UseRootDirACL", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Use the root directory ACL for lost+found directory if it is created.");
+     cmd_AddParm(ts, "-TraceBadLinkCounts", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Print out lines about volume reference count changes.");
+     cmd_AddParm(ts, "-DontAskFS", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Don't ask fileserver to take volume offline.  THIS IS VERY DANGEROUS.");
+     cmd_AddParm(ts, "-LogLevel", CMD_SINGLE, CMD_OPTIONAL, "(MR-AFS) log level");
+     cmd_AddParm(ts, "-rxdebug", CMD_FLAG, CMD_OPTIONAL, "(MR-AFS) Write out rx debug information.");
+     cmd_AddParm(ts, "-Residencies", CMD_SINGLE, CMD_OPTIONAL, "(MR-AFS) Numeric mask of residencies to be included in the salvage.  Do not use with -SalvageRemote or -SalvageArchival");
      add_std_args (ts);
  
+     ts = cmd_CreateSyntax("blockscanner", BlockScannerCmd, 0,
+                           "block scanner daemon from making migration requests");
+     cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
+     add_std_args (ts);
+ 
+     ts = cmd_CreateSyntax("unblockscanner", UnBlockScannerCmd, 0,
+                           "allow scanner daemon to make migration requests again");
+     cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
+     add_std_args (ts); 
+ 
+ #ifdef BOS_RESTRICTED_MODE
+     ts = cmd_CreateSyntax("getrestricted", GetRestrict, 0, "get restrict mode");
+     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
+     add_std_args (ts);
+ 
+     ts = cmd_CreateSyntax("setrestricted", SetRestrict, 0, "set restrict mode");
+     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
+     cmd_AddParm(ts, "-mode", CMD_SINGLE, 0, "mode to set");
+     add_std_args (ts);
+ #endif
  #endif
  
      code = cmd_Dispatch(argc, argv);
Index: openafs/src/bozo/bosint.xg
diff -c openafs/src/bozo/bosint.xg:1.2 openafs/src/bozo/bosint.xg:1.2.2.1
*** openafs/src/bozo/bosint.xg:1.2	Sat Nov  4 05:03:59 2000
--- openafs/src/bozo/bosint.xg	Tue Mar  6 16:03:47 2001
***************
*** 222,224 ****
--- 222,233 ----
    OUT string spare2<BOZO_BSSIZE>,
    OUT string spare3<BOZO_BSSIZE>
  ) = 114;
+ 
+ GetRestrictedMode(
+   OUT afs_int32 *restmode
+ ) = 115;
+ 
+ SetRestrictedMode(
+   IN afs_int32 restmode
+ ) = 116;
+ /* RPC #117 will be Salvage, if I get around to it */
Index: openafs/src/bozo/bosoprocs.c
diff -c openafs/src/bozo/bosoprocs.c:1.2 openafs/src/bozo/bosoprocs.c:1.2.2.1
*** openafs/src/bozo/bosoprocs.c:1.2	Sat Nov  4 05:03:59 2000
--- openafs/src/bozo/bosoprocs.c	Tue Mar  6 16:03:47 2001
***************
*** 43,48 ****
--- 43,51 ----
  extern struct rx_securityClass *bozo_rxsc[2];
  extern int bozo_newKTs;
  extern int DoLogging;
+ #ifdef BOS_RESTRICTED_MODE
+ extern int bozo_isrestricted;
+ #endif
  
  BOZO_GetRestartTime(acall, atype, aktime)
  struct rx_call *acall;
***************
*** 119,124 ****
--- 122,133 ----
        code = BZACCESS;
        goto fail;
      }
+ #ifdef BOS_RESTRICTED_MODE
+     if (bozo_isrestricted) {
+       code = BZACCESS;
+       goto fail;
+     }
+ #endif
      if (DoLogging) bozo_Log("%s is executing the shell command '%s'\n", caller, acmd);
  
      /* should copy output to acall, but don't yet cause its hard */
***************
*** 180,185 ****
--- 189,201 ----
  	osi_auditU (acall, BOS_UnInstallEvent, code, AUD_STR, aname, AUD_END);
  	return code;
      }
+ #ifdef BOS_RESTRICTED_MODE
+     if (bozo_isrestricted) {
+ 	code = BZACCESS;
+ 	osi_auditU (acall, BOS_UnInstallEvent, code, AUD_STR, aname, AUD_END);
+ 	return code;
+     }
+ #endif
  
      /* construct local path from canonical (wire-format) path */
      if (ConstructLocalBinPath(aname, &filepath)) {
***************
*** 267,272 ****
--- 283,291 ----
      char caller[MAXKTCNAMELEN];
  
      if (!afsconf_SuperUser(bozo_confdir, acall, caller)) return BZACCESS;
+ #ifdef BOS_RESTRICTED_MODE
+     if (bozo_isrestricted) return BZACCESS;
+ #endif
  
      /* construct local path from canonical (wire-format) path */
      if (ConstructLocalBinPath(aname, &fpp)) {
***************
*** 715,720 ****
--- 734,750 ----
        code = BZACCESS;
        goto fail;
      }
+ #ifdef BOS_RESTRICTED_MODE
+     if (bozo_isrestricted) {
+          if (strcmp(atype, "cron") || strcmp(ainstance, "salvage-tmp") ||
+              strcmp(ap2, "now") ||
+              strncmp(ap1, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH, 
+                      strlen(AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH))) {
+               code = BZACCESS;
+               goto fail;
+          }
+     }
+ #endif
  
      code = bnode_Create(atype, ainstance, &tb, ap1, ap2, ap3, ap4, ap5, notifier,BSTAT_NORMAL);
      if (!code)
***************
*** 754,759 ****
--- 784,795 ----
        code = BZACCESS;
        goto fail;
      }
+ #ifdef BOS_RESTRICTED_MODE
+     if (bozo_isrestricted) {
+       code = BZACCESS;
+       goto fail;
+     }
+ #endif
      if (DoLogging) bozo_Log("%s is executing DeleteBnode '%s'\n", caller, ainstance);
  
      code = bnode_DeleteName(ainstance);
***************
*** 1061,1066 ****
--- 1097,1108 ----
        code = BZACCESS;
        goto fail; 
      }
+ #ifdef BOS_RESTRICTED_MODE
+     if (bozo_isrestricted) {
+          code = BZACCESS;
+          goto fail; 
+     }
+ #endif
      if (DoLogging) bozo_Log("%s is executing Prune (flags=%d)\n", caller, aflags);
  
      /* first scan AFS binary directory */
***************
*** 1299,1304 ****
--- 1341,1353 ----
        code = BZACCESS; 
        goto fail; 
      }
+ #ifdef BOS_RESTRICTED_MODE
+     if (bozo_isrestricted && strchr(aname, '/') && 
+         strcmp(aname, AFSDIR_CANONICAL_SERVER_SLVGLOG_FILEPATH)) { 
+       code = BZACCESS; 
+       goto fail; 
+     }
+ #endif
  
      /* construct local path from canonical (wire-format) path */
      if (ConstructLocalLogPath(aname, &logpath)) {
***************
*** 1369,1374 ****
--- 1418,1468 ----
      return BZNOENT;
  }
  
+ #ifdef BOS_RESTRICTED_MODE
+ BOZO_GetRestrictedMode(acall, arestmode) 
+ struct rx_call *acall;
+ afs_int32 *arestmode; 
+ {
+      *arestmode=bozo_isrestricted;
+      return 0;
+ }
+ 
+ BOZO_SetRestrictedMode(acall, arestmode) 
+ struct rx_call *acall;
+ afs_int32 arestmode; 
+ {
+      afs_int32 code;
+      char caller[MAXKTCNAMELEN];
+      
+      if (!afsconf_SuperUser(bozo_confdir, acall, caller)) { 
+           return BZACCESS; 
+      }     
+      if (bozo_isrestricted) {
+           return BZACCESS; 
+      }     
+      if (arestmode !=0 && arestmode !=1) {
+           return BZDOM;
+      }
+      bozo_isrestricted=arestmode;
+      code = WriteBozoFile(0);
+  fail:
+      return code;
+ }
+ #else
+ BOZO_GetRestrictedMode(acall, arestmode) 
+ struct rx_call *acall;
+ afs_int32 *arestmode; 
+ {
+      return RXGEN_OPCODE;
+ }
+ 
+ BOZO_SetRestrictedMode(acall, arestmode) 
+ struct rx_call *acall;
+ afs_int32 arestmode; 
+ {
+      return RXGEN_OPCODE;
+ }
+ #endif
  
  void bozo_ShutdownAndExit(int asignal)
  {
Index: openafs/src/bozo/bosserver.c
diff -c openafs/src/bozo/bosserver.c:1.2 openafs/src/bozo/bosserver.c:1.2.2.4
*** openafs/src/bozo/bosserver.c:1.2	Sat Nov  4 05:03:59 2000
--- openafs/src/bozo/bosserver.c	Tue Mar  6 17:27:19 2001
***************
*** 60,66 ****
--- 60,77 ----
  
  struct ktime bozo_nextRestartKT, bozo_nextDayKT;
  int bozo_newKTs;
+ #ifdef BOS_RESTRICTED_MODE
+ int bozo_isrestricted=0;
+ int bozo_restdisable=0;
  
+ void bozo_insecureme(int sig) 
+ {
+      signal(SIGFPE, bozo_insecureme);
+      bozo_isrestricted=0;
+      bozo_restdisable=1;
+ }
+ #endif
+ 
  struct bztemp {
      FILE *file;
  };
***************
*** 209,214 ****
--- 220,228 ----
      afs_int32 i, goal;
      struct bnode *tb;
      char *parms[MAXPARMS];
+ #ifdef BOS_RESTRICTED_MODE
+     int rmode;
+ #endif
  
      /* rename BozoInit to BosServer for the user */
      if (!aname) {
***************
*** 219,224 ****
--- 233,246 ----
  	    if (code < 0)
  		perror("bosconfig rename");
  	}
+ #ifdef BOS_NEW_CONFIG
+ 	if (access(AFSDIR_SERVER_BOZCONFNEW_FILEPATH, 0) == 0) {
+ 	     code = renamefile(AFSDIR_SERVER_BOZCONFNEW_FILEPATH,
+ 			       AFSDIR_SERVER_BOZCONF_FILEPATH);
+ 	     if (code < 0)
+ 		  perror("bosconfig rename");
+ 	}
+ #endif	      
      }
  
      /* setup default times we want to do restarts */
***************
*** 280,285 ****
--- 302,324 ----
  	    continue;
  	}
  
+ #ifdef BOS_RESTRICTED_MODE
+ 	if (strncmp(tbuffer, "restrictmode", 12) == 0) {
+ 	    code = sscanf(tbuffer, "restrictmode %d",
+ 			  &rmode);
+ 	    if (code != 1) {
+ 		code = -1;
+ 		goto fail;
+ 	    }
+ 	    if (rmode !=0 && rmode != 1) {
+ 		 code = -1;
+ 		 goto fail;
+ 	    } 
+ 	    bozo_isrestricted=rmode;
+             continue;
+ 	}
+ #endif
+ 	
  	if (strncmp("bnode", tbuffer, 5) != 0) {
  	    code = -1;
  	    goto fail;
***************
*** 351,356 ****
--- 390,398 ----
      tfile = fopen(tbuffer, "w");
      if (!tfile) return -1;
      btemp.file = tfile;
+ #ifdef BOS_RESTRICTED_MODE
+     fprintf(tfile, "restrictmode %d\n", bozo_isrestricted);
+ #endif
      fprintf(tfile, "restarttime %d %d %d %d %d\n", bozo_nextRestartKT.mask,
  	    bozo_nextRestartKT.day, bozo_nextRestartKT.hour, bozo_nextRestartKT.min,
  	    bozo_nextRestartKT.sec);
***************
*** 406,411 ****
--- 448,459 ----
  	IOMGR_Sleep(60);
  	now = FT_ApproxTime();
  
+ #ifdef BOS_RESTRICTED_MODE
+ 	if (bozo_restdisable) {
+ 	     bozo_Log("Restricted mode disabled by signal\n");
+ 	     bozo_restdisable=0;
+ 	}
+ #endif
  	if (bozo_newKTs) {	/* need to recompute restart times */
  	    bozo_newKTs = 0;	/* done for a while */
  	    nextRestart = ktime_next(&bozo_nextRestartKT, BOZO_MINSKIP);
***************
*** 619,624 ****
--- 667,675 ----
      sigaction(SIGSEGV, &nsa, NULL);
      sigaction(SIGABRT, &nsa, NULL);
  #endif
+ #ifdef BOS_RESTRICTED_MODE
+     signal(SIGFPE, bozo_insecureme);
+ #endif
  
  #ifdef AFS_NT40_ENV
      /* Initialize winsock */
***************
*** 669,674 ****
--- 720,730 ----
  	else if (strcmp(argv[code], "-enable_process_stats")==0) {
  	    rx_enableProcessRPCStats();
  	}
+ #ifdef BOS_RESTRICTED_MODE
+ 	else if (strcmp(argv[code], "-restricted")==0) {
+ 	    bozo_isrestricted=1;
+ 	}
+ #endif
  	else {
  
  	    /* hack to support help flag */
***************
*** 705,712 ****
--- 761,770 ----
      /* chdir to AFS log directory */
      chdir(AFSDIR_SERVER_LOGS_DIRPATH);
  
+ #if 0
      fputs(AFS_GOVERNMENT_MESSAGE, stdout);
      fflush(stdout);
+ #endif
  
      /* go into the background and remove our controlling tty */
  
***************
*** 740,747 ****
  	}
  	else break;
      }
!     if (i>=10)
  	exit(code);
  
      code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
  			     /* parm */0, "bozo-the-clown", &bozo_pid);
--- 798,807 ----
  	}
  	else break;
      }
!     if (i>=10) {
! 	bozo_Log("Bos giving up, can't initialize rx\n");
  	exit(code);
+     }
  
      code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1,
  			     /* parm */0, "bozo-the-clown", &bozo_pid);
Index: openafs/src/bozo/fsbnodeops.c
diff -c openafs/src/bozo/fsbnodeops.c:1.2 openafs/src/bozo/fsbnodeops.c:1.2.2.2
*** openafs/src/bozo/fsbnodeops.c:1.2	Sat Nov  4 05:04:00 2000
--- openafs/src/bozo/fsbnodeops.c	Tue Mar  6 17:17:04 2001
***************
*** 30,35 ****
--- 30,36 ----
  static int fs_procexit(), fs_getstring(), fs_getparm(), fs_restartp();
  static int fs_hascore();
  struct bnode *fs_create();
+ struct bnode *fsmr_create();
  
  static SetNeedsClock();
  static NudgeProcs();
***************
*** 80,99 ****
      char *filecmd;		    /* command to start primary file server */
      char *volcmd;		    /* command to start secondary vol server */
      char *salcmd;		    /* command to start salvager */
      struct bnode_proc *fileProc;    /* process for file server */
      struct bnode_proc *volProc;	    /* process for vol server */
      struct bnode_proc *salProc;	    /* process for salvager */
!     afs_int32 lastFileStart;		    /* last start for file */
!     afs_int32 lastVolStart;		    /* last start for vol */
      char fileRunning;		    /* file process is running */
      char volRunning;		    /* volser is running */
      char salRunning;		    /* salvager is running */
      char fileSDW;		    /* file shutdown wait */
      char volSDW;		    /* vol shutdown wait */
      char salSDW;		    /* waiting for the salvager to shutdown */
      char fileKillSent;		    /* kill signal has been sent */
      char volKillSent;
      char salKillSent;
      char needsSalvage;		    /* salvage before running */
      char needsClock;		    /* do we need clock ticks */
  };
--- 81,106 ----
      char *filecmd;		    /* command to start primary file server */
      char *volcmd;		    /* command to start secondary vol server */
      char *salcmd;		    /* command to start salvager */
+     char *scancmd;                  /* command to start scanner (MR-AFS) */
      struct bnode_proc *fileProc;    /* process for file server */
      struct bnode_proc *volProc;	    /* process for vol server */
      struct bnode_proc *salProc;	    /* process for salvager */
!     struct bnode_proc *scanProc;    /* process for scanner (MR-AFS) */
!     afs_int32 lastFileStart;        /* last start for file */
!     afs_int32 lastVolStart;         /* last start for vol */
!     afs_int32 lastScanStart;        /* last start for scanner (MR-AFS) */
      char fileRunning;		    /* file process is running */
      char volRunning;		    /* volser is running */
      char salRunning;		    /* salvager is running */
+     char scanRunning;               /* scanner is running (MR_AFS) */
      char fileSDW;		    /* file shutdown wait */
      char volSDW;		    /* vol shutdown wait */
      char salSDW;		    /* waiting for the salvager to shutdown */
+     char scanSDW;                   /* scanner shutdown wait (MR_AFS) */
      char fileKillSent;		    /* kill signal has been sent */
      char volKillSent;
      char salKillSent;
+     char scanKillSent;              /* kill signal has been sent (MR_AFS) */
      char needsSalvage;		    /* salvage before running */
      char needsClock;		    /* do we need clock ticks */
  };
***************
*** 120,125 ****
--- 127,136 ----
      bnode_CoreName(abnode, "salv", tbuffer);
      if (access(tbuffer, 0) == 0) return 1;
  
+     /* see if scanner left a core file (MR-AFS) */
+     bnode_CoreName(abnode, "scan", tbuffer);
+     if (access(tbuffer, 0) == 0) return 1;
+ 
      /* no one left a core file */
      return 0;
  }
***************
*** 155,160 ****
--- 166,187 ----
      if (tstat.st_ctime > abnode->lastVolStart) code = 1;
      else code = 0;
      bnode_FreeTokens(tt);
+     if (code) return code;
+ 
+     if (abnode->scancmd) {                     /* Only in MR-AFS */
+         /* now do same for scancmd (MR-AFS) */
+         code = bnode_ParseLine(abnode->scancmd, &tt);
+         if (code) return 0;
+         if (!tt) return 0;
+         code = stat(tt->key, &tstat);
+         if (code) {
+             bnode_FreeTokens(tt);
+             return 0;
+ 	}
+         if (tstat.st_ctime > abnode->lastScanStart) code = 1;
+         else code = 0;
+         bnode_FreeTokens(tt); 
+     }
  
      return code;
  }
***************
*** 210,215 ****
--- 237,243 ----
      free(abnode->filecmd);
      free(abnode->volcmd);
      free(abnode->salcmd);
+     if (abnode->scancmd) free(abnode->scancmd);
      free(abnode);
      return 0;
  }
***************
*** 229,243 ****
  #endif /* AFS_NT40_ENV */
  
  
! struct bnode *fs_create(ainstance, afilecmd, avolcmd, asalcmd)
  char *ainstance;
  char *afilecmd;
  char *avolcmd;
! char *asalcmd; {
      struct stat tstat;
      register struct fsbnode *te;
      char cmdname[AFSDIR_PATH_MAX];
!     char *fileCmdpath, *volCmdpath, *salCmdpath;
      int bailout = 0;
  
      fileCmdpath = volCmdpath = salCmdpath = NULL;
--- 257,272 ----
  #endif /* AFS_NT40_ENV */
  
  
! struct bnode *fs_create(ainstance, afilecmd, avolcmd, asalcmd, ascancmd)
  char *ainstance;
  char *afilecmd;
  char *avolcmd;
! char *asalcmd; 
! char *ascancmd; {
      struct stat tstat;
      register struct fsbnode *te;
      char cmdname[AFSDIR_PATH_MAX];
!     char *fileCmdpath, *volCmdpath, *salCmdpath, *scanCmdpath;
      int bailout = 0;
  
      fileCmdpath = volCmdpath = salCmdpath = NULL;
***************
*** 256,261 ****
--- 285,297 ----
  	bailout = 1;
      }
  
+     if (ascancmd && strlen(ascancmd)) {
+        if (ConstructLocalBinPath(ascancmd, &scanCmdpath)) {
+             bozo_Log("BNODE: command path invalid '%s'\n", ascancmd);
+             bailout = 1;
+        }
+     }
+ 
      if (!bailout) {
  	sscanf(fileCmdpath, "%s", cmdname);
  #ifdef AFS_NT40_ENV
***************
*** 283,288 ****
--- 319,335 ----
  	    bozo_Log("BNODE: salvager binary '%s' not found\n", cmdname);
  	    bailout = 1;
  	}
+ 
+         if (ascancmd && strlen(ascancmd)) {
+ 	    sscanf(scanCmdpath, "%s", cmdname);
+ #ifdef AFS_NT40_ENV
+ 	    AppendExecutableExtension(cmdname);
+ #endif
+ 	    if (stat(cmdname, &tstat)) {
+ 		bozo_Log("BNODE: scanner binary '%s' not found\n", cmdname);
+ 		bailout = 1;
+ 	    }
+ 	}
      }
  
      if (bailout) {
***************
*** 295,300 ****
--- 342,351 ----
      te->filecmd = fileCmdpath;
      te->volcmd = volCmdpath;
      te->salcmd = salCmdpath;
+     if (ascancmd && strlen(ascancmd))
+        te->scancmd = scanCmdpath;
+     else 
+        te->scancmd = (char *)0;
      bnode_InitBnode(te, &fsbnode_ops, ainstance);
      bnode_SetTimeout(te, POLLTIME);	/* ask for timeout activations every 10 seconds */
      RestoreSalFlag(te);		/* restore needsSalvage flag based on file's existence */
***************
*** 333,338 ****
--- 384,397 ----
  		     FSSDTIME);
  	}
      }
+     if (abnode->scanSDW) {
+         if (!abnode->scanKillSent && now - abnode->timeSDStarted > SDTIME) {
+             bnode_StopProc(abnode->scanProc, SIGKILL);
+             abnode->scanKillSent = 1;
+             bozo_Log("bos shutdown: scanner failed to shutdown within %d seconds\n",
+                      SDTIME);
+         }
+     }
      SetNeedsClock(abnode);
  }
  
***************
*** 340,350 ****
  struct fsbnode *abnode;
  afs_int32 *astatus; {
      register afs_int32 temp;
!     if (abnode->volSDW || abnode->fileSDW || abnode->salSDW) temp = BSTAT_SHUTTINGDOWN;
      else if (abnode->salRunning) temp = BSTAT_NORMAL;
!     else if (abnode->volRunning && abnode->fileRunning) temp = BSTAT_NORMAL;
!     else if (!abnode->salRunning && !abnode->volRunning && !abnode->fileRunning)
! 	temp = BSTAT_SHUTDOWN;
      else temp = BSTAT_STARTINGUP;
      *astatus = temp;
      return 0;
--- 399,411 ----
  struct fsbnode *abnode;
  afs_int32 *astatus; {
      register afs_int32 temp;
!     if (abnode->volSDW || abnode->fileSDW || abnode->salSDW || abnode->scanSDW)
! 	temp = BSTAT_SHUTTINGDOWN;
      else if (abnode->salRunning) temp = BSTAT_NORMAL;
!     else if (abnode->volRunning && abnode->fileRunning && (!abnode->scancmd || 
!        abnode->scanRunning)) temp = BSTAT_NORMAL;
!     else if (!abnode->salRunning && !abnode->volRunning && !abnode->fileRunning
!         && !abnode->scanRunning) temp = BSTAT_SHUTDOWN;
      else temp = BSTAT_STARTINGUP;
      *astatus = temp;
      return 0;
***************
*** 390,395 ****
--- 451,462 ----
  	abnode->salSDW = 0;
  	abnode->salKillSent = 0;
      }
+     else if (aproc == abnode->scanProc) {
+         abnode->scanProc = 0;
+         abnode->scanRunning = 0;
+         abnode->scanSDW = 0;
+         abnode->scanKillSent = 0;
+     }
  
      /* now restart anyone who needs to restart */
      return NudgeProcs(abnode);
***************
*** 397,406 ****
  
  /* make sure we're periodically checking the state if we need to */
  static SetNeedsClock(ab)
! register struct fsbnode *ab; {
!     if (ab->b.goal == 1 && ab->fileRunning && ab->volRunning)
  	ab->needsClock = 0; /* running normally */
!     else if (ab->b.goal == 0 && !ab->fileRunning && !ab->volRunning && !ab->salRunning)
  	ab->needsClock = 0; /* halted normally */
      else ab->needsClock	= 1;	/* other */
      if (ab->needsClock && !bnode_PendingTimeout(ab))
--- 464,476 ----
  
  /* make sure we're periodically checking the state if we need to */
  static SetNeedsClock(ab)
!     register struct fsbnode *ab; 
! {
!     if (ab->b.goal == 1 && ab->fileRunning && ab->volRunning
!        && (!ab->scancmd || ab->scanRunning))
  	ab->needsClock = 0; /* running normally */
!     else if (ab->b.goal == 0 && !ab->fileRunning && !ab->volRunning 
! 	     && !ab->salRunning && !ab->scanRunning)
  	ab->needsClock = 0; /* halted normally */
      else ab->needsClock	= 1;	/* other */
      if (ab->needsClock && !bnode_PendingTimeout(ab))
***************
*** 437,442 ****
--- 507,522 ----
  		    abnode->volRunning = 1;
  		}
  	    }
+ 	    if (abnode->scancmd) {
+ 		if (!abnode->scanRunning) {
+ 		    abnode->lastScanStart = FT_ApproxTime();
+ 		    code = bnode_NewProc(abnode, abnode->scancmd, "scanner", &tp);
+ 		    if (code == 0) {
+ 			abnode->scanProc = tp;
+ 			abnode->scanRunning = 1;
+ 		    }
+ 		}
+ 	    }    
  	}
  	else {	/* file is not running */
  	    /* see how to start */
***************
*** 459,464 ****
--- 539,553 ----
  			abnode->volRunning = 1;
  		    }
  		}
+ 		if (abnode->scancmd && !abnode->scanRunning) {
+                     abnode->lastScanStart = FT_ApproxTime();
+                     code = bnode_NewProc(abnode, abnode->scancmd, "scanner",
+                                          &tp);
+                     if (code == 0) {
+                         abnode->scanProc = tp;
+                         abnode->scanRunning = 1;
+                     }
+                 }
  	    }
  	    else {  /* needs to be salvaged */
  		/* make sure file server and volser are gone */
***************
*** 472,478 ****
  		    if (!abnode->fileSDW) abnode->timeSDStarted = now;
  		    abnode->fileSDW = 1;
  		}
! 		if (abnode->volRunning || abnode->fileRunning) return 0;
  		/* otherwise, it is safe to start salvager */
  		if (!abnode->salRunning) {
  		    code = bnode_NewProc(abnode, abnode->salcmd, "salv", &tp);
--- 561,573 ----
  		    if (!abnode->fileSDW) abnode->timeSDStarted = now;
  		    abnode->fileSDW = 1;
  		}
!                 if (abnode->scanRunning) {
!                     bnode_StopProc(abnode->scanProc, SIGTERM);
!                     if (!abnode->scanSDW) abnode->timeSDStarted = now;
!                     abnode->scanSDW = 1;
!                 }
! 		if (abnode->volRunning || abnode->fileRunning 
! 		    || abnode->scanRunning) return 0;
  		/* otherwise, it is safe to start salvager */
  		if (!abnode->salRunning) {
  		    code = bnode_NewProc(abnode, abnode->salcmd, "salv", &tp);
***************
*** 501,506 ****
--- 596,606 ----
  	    abnode->volSDW = 1;
  	    abnode->timeSDStarted = now;
  	}
+         if (abnode->scanRunning && !abnode->scanSDW) {
+             bnode_StopProc(abnode->scanProc, SIGTERM);
+             abnode->scanSDW = 1;
+             abnode->timeSDStarted = now;
+         }
      }
      SetNeedsClock(abnode);
      return 0;
***************
*** 514,520 ****
      if (abnode->b.goal == 1) {
  	if (abnode->fileRunning) {
  	    if (abnode->fileSDW) strcpy(abuffer, "file server shutting down");
! 	    else if (!abnode->volRunning) strcpy(abuffer, "file server up; volser down");
  	    else strcpy(abuffer, "file server running");
  	}
  	else if (abnode->salRunning) {
--- 614,631 ----
      if (abnode->b.goal == 1) {
  	if (abnode->fileRunning) {
  	    if (abnode->fileSDW) strcpy(abuffer, "file server shutting down");
! 	    else if (abnode->scancmd) {
!                 if (!abnode->volRunning && !abnode->scanRunning)
!                     strcpy(abuffer, "file server up; volser and scanner down");
! 		else if (abnode->volRunning && !abnode->scanRunning)
!                     strcpy(abuffer, "file server up; volser up; scanner down");
! 		else if (!abnode->volRunning && abnode->scanRunning)
!                     strcpy(abuffer, "file server up; volser down; scanner up");
! 
! 		else strcpy(abuffer, "file server running");
! 	    } 
! 	    else if (!abnode->volRunning) 
! 		strcpy(abuffer, "file server up; volser down");
  	    else strcpy(abuffer, "file server running");
  	}
  	else if (abnode->salRunning) {
***************
*** 524,530 ****
      }
      else {
  	/* shutting down */
! 	if (abnode->fileRunning || abnode->volRunning) {
  	    strcpy(abuffer, "file server shutting down");
  	}
  	else if (abnode->salRunning)
--- 635,641 ----
      }
      else {
  	/* shutting down */
! 	if (abnode->fileRunning || abnode->volRunning || abnode->scanRunning) {
  	    strcpy(abuffer, "file server shutting down");
  	}
  	else if (abnode->salRunning)
***************
*** 545,550 ****
--- 656,663 ----
  	strcpy(abuffer, abnode->volcmd);
      else if (aindex == 2)
  	strcpy(abuffer, abnode->salcmd);
+     else if (aindex == 3 && abnode->scancmd)
+ 	strcpy(abuffer, abnode->scancmd);
      else
  	return BZDOM;
      return 0;
Index: openafs/src/bucoord/vol_sets.c
diff -c openafs/src/bucoord/vol_sets.c:1.2 openafs/src/bucoord/vol_sets.c:1.2.2.1
*** openafs/src/bucoord/vol_sets.c:1.2	Sat Nov  4 05:04:08 2000
--- openafs/src/bucoord/vol_sets.c	Tue Mar  6 17:17:44 2001
***************
*** 66,71 ****
--- 66,77 ----
      partitionName = as->parms[2].items->data;
      volRegExp     = as->parms[3].items->data;
  
+     code = bc_UpdateVolumeSet();
+     if (code) {
+ 	com_err(whoami, code, "; Can't retrieve volume sets");
+ 	return(code);
+     }
+ 
      ctPtr = &bc_globalConfig->configText[TB_VOLUMESET];
  
      tset = bc_FindVolumeSet(bc_globalConfig, volSetName);
Index: openafs/src/cmd/cmd.c
diff -c openafs/src/cmd/cmd.c:1.2 openafs/src/cmd/cmd.c:1.2.2.1
*** openafs/src/cmd/cmd.c:1.2	Sat Nov  4 05:04:17 2000
--- openafs/src/cmd/cmd.c	Tue Mar  6 16:51:14 2001
***************
*** 398,403 ****
--- 398,410 ----
      return 0;	/* all done */
  }
  
+ int cmd_IsAdministratorCommand(as)
+ register struct cmd_syndesc *as;
+ {
+     as->flags |= CMD_ADMIN;
+     return 0;
+ } 
+ 
  int cmd_Seek(as, apos)
  register struct cmd_syndesc *as;
  int apos; {
***************
*** 594,599 ****
--- 601,607 ----
  	    ts = cmd_CreateSyntax("help", HelpProc, (char*)0,
  				  "get help on commands");
  	    cmd_AddParm(ts, "-topic", CMD_LIST, CMD_OPTIONAL, "help string");
+ 	    cmd_AddParm(ts, "-admin", CMD_FLAG, CMD_OPTIONAL, (char *)0);
  
  	    ts = cmd_CreateSyntax("apropos", AproposProc, (char*)0,
  				  "search by help text");
Index: openafs/src/cmd/cmd.p.h
diff -c openafs/src/cmd/cmd.p.h:1.2 openafs/src/cmd/cmd.p.h:1.2.2.1
*** openafs/src/cmd/cmd.p.h:1.2	Sat Nov  4 05:04:17 2000
--- openafs/src/cmd/cmd.p.h	Tue Mar  6 16:51:15 2001
***************
*** 18,23 ****
--- 18,24 ----
  
  /* syndesc flags */
  #define	CMD_ALIAS	1	/* this is an alias */
+ #define CMD_ADMIN       2       /* admin. command, show only with -admin */
  #define CMD_HIDDEN      4       /* A hidden command - similar to CMD_HIDE */
  
  #define CMD_HELPPARM	(CMD_MAXPARMS-1)/* last one is used by -help switch */
Index: openafs/src/comerr/et_lex.lex.l
diff -c openafs/src/comerr/et_lex.lex.l:1.1 openafs/src/comerr/et_lex.lex.l:1.1.6.1
*** openafs/src/comerr/et_lex.lex.l:1.1	Fri Nov  3 21:25:18 2000
--- openafs/src/comerr/et_lex.lex.l	Tue Mar  6 17:30:37 2001
***************
*** 8,14 ****
  ec		return ERROR_CODE_ENTRY;
  end		return END;
  
! [\t\n ]		;
  
  \"{PC}*\"	{ register char *p; yylval.dynstr = ds((char *)yytext+1);
  		  if (p=strrchr(yylval.dynstr, '"')) *p='\0';
--- 8,14 ----
  ec		return ERROR_CODE_ENTRY;
  end		return END;
  
! [\t\n\r ]		;
  
  \"{PC}*\"	{ register char *p; yylval.dynstr = ds((char *)yytext+1);
  		  if (p=strrchr(yylval.dynstr, '"')) *p='\0';
Index: openafs/src/config/Makefile.alpha_dux50
diff -c /dev/null openafs/src/config/Makefile.alpha_dux50:1.1.2.1
*** /dev/null	Wed Mar  7 15:26:14 2001
--- openafs/src/config/Makefile.alpha_dux50	Tue Mar  6 16:23:57 2001
***************
*** 0 ****
--- 1,29 ----
+ # Copyright 2000, International Business Machines Corporation and others.
+ # All Rights Reserved.
+ # 
+ # This software has been released under the terms of the IBM Public
+ # License.  For details, see the LICENSE file in the top-level source
+ # directory or online at http://www.openafs.org/dl/license10.html
+ 
+ AFS_OSTYPE = DUX
+ 
+ MT_CC=cc
+ XCFLAGS= -D_NO_PROTO -DOSF
+ MT_CFLAGS=-D_REENTRANT=1 -pthread -DAFS_PTHREAD_ENV ${XCFLAGS}
+ SHLIB_SUFFIX=so
+ SHLIB_CFLAGS=
+ XLIBS=
+ MTLIBS=-pthread -lpthread -lmach -lexc -lc
+ NON_SHARED=-non_shared
+ TXLIBS= -lcurses
+ LWP_OPTMZ=-O2
+ OPTMZ=-O2
+ DBG=-g3
+ CP=cp
+ CSTATIC=-non_shared
+ RANLIB=/bin/true
+ WASHTOOL=${SRCDIR}bin/washtool
+ INSTALL=${SRCDIR}bin/install
+ 
+ #this is for the vol package
+ FS_CONV_OSF40D= $(DESTDIR)root.server/usr/afs/bin/fs_conv_dux40D
Index: openafs/src/config/Makefile.s390_linux22
diff -c openafs/src/config/Makefile.s390_linux22:1.1.2.1 openafs/src/config/Makefile.s390_linux22:1.1.2.2
*** openafs/src/config/Makefile.s390_linux22:1.1.2.1	Fri Jan 19 04:33:38 2001
--- openafs/src/config/Makefile.s390_linux22	Tue Mar  6 17:23:53 2001
***************
*** 15,24 ****
  #
  # 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
--- 15,25 ----
  #
  # compilation and link editor flags
  DBG=-g
! OPTMZ=-O
! #PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
! PAM_CFLAGS= -O -Dlinux -DLINUX_PAM -fPIC
  # Put -O2 here to _ensure_ all Makefiles pick it up.
! XCFLAGS= -O -g
  MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
  XLDFLAGS=
  SHARE_LDFLAGS = -shared -Xlinker -x
Index: openafs/src/config/Makefile.version-NOCML
diff -c openafs/src/config/Makefile.version-NOCML:1.2.2.2 openafs/src/config/Makefile.version-NOCML:1.2.2.4
*** openafs/src/config/Makefile.version-NOCML:1.2.2.2	Fri Jan 19 17:26:44 2001
--- openafs/src/config/Makefile.version-NOCML	Wed Mar  7 12:58:09 2001
***************
*** 8,15 ****
  AFS_component_version_number.o: AFS_component_version_number.c
  
  AFS_component_version_number.c: 
! 	echo 'char cml_version_number[]="@(#) OpenAFS stable 1.0.2 built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c;
! 	echo 'char* AFSVersion = "openafs devel"; ' >>AFS_component_version_number.c;
  
  noversion: install
  
--- 8,15 ----
  AFS_component_version_number.o: AFS_component_version_number.c
  
  AFS_component_version_number.c: 
! 	echo 'char cml_version_number[]="@(#) OpenAFS stable 1.0.3 built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c;
! 	echo 'char* AFSVersion = "openafs stable 1.0.3"; ' >>AFS_component_version_number.c;
  
  noversion: install
  
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.4.2.2 openafs/src/config/afs_sysnames.h:1.4.2.3
*** openafs/src/config/afs_sysnames.h:1.4.2.2	Fri Jan 19 04:33:38 2001
--- openafs/src/config/afs_sysnames.h	Tue Mar  6 16:23:57 2001
***************
*** 100,105 ****
--- 100,106 ----
  #define SYS_NAME_ID_alpha_osf32		1203
  #define SYS_NAME_ID_alpha_osf32c	1204
  #define SYS_NAME_ID_alpha_dux40		1205
+ #define SYS_NAME_ID_alpha_dux50		1206
  
  #define SYS_NAME_ID_ncrx86_20		1300
  #define SYS_NAME_ID_ncrx86_30		1301
Index: openafs/src/config/param.alpha_dux50.h
diff -c /dev/null openafs/src/config/param.alpha_dux50.h:1.1.2.1
*** /dev/null	Wed Mar  7 15:26:15 2001
--- openafs/src/config/param.alpha_dux50.h	Tue Mar  6 16:23:57 2001
***************
*** 0 ****
--- 1,108 ----
+ /*
+  * 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	_PARAM_OSF1_H_
+ #define	_PARAM_OSF1_H_
+ 
+ #define	AFS_OSF_ENV	1
+ #define	AFS_OSF20_ENV	1
+ #define	AFS_OSF30_ENV	1
+ #define	AFS_OSF32_ENV	1
+ #define	AFS_OSF32C_ENV	1
+ #define	AFS_DUX40_ENV	1
+ #define	AFS_DUX50_ENV	1
+ #define	__alpha		1
+ #define	AFS_ALPHA_ENV	1
+ #define	AFS_DECOSF_ENV	1
+ #define	AFS_64BIT_ENV	1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VM_RDWR_ENV	1
+ #define AFS_VFS_ENV	1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ #define AFS_MINPHYS_ENV	1
+ #define CMUSTD_ENV	1
+ 
+ #define AFS_SYSCALL	232
+ #define AFS_MOUNT_AFS	13
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ #define SYS_NAME	"alpha_dux50"
+ #define SYS_NAME_ID	SYS_NAME_ID_alpha_dux50
+ 
+ #define AFS_HAVE_FFS            1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ 
+ #define AFS_GCPAGS		1       /* if nonzero, garbage collect PAGs */
+ #define AFS_3DISPARES   1       /* Utilize the 3 available disk inode spares */
+ #define AFS_USE_GETTIMEOFDAY 1  /* use gettimeofday to implement rx clock */
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ #include <machine/endian.h>
+ #if	BYTE_ORDER == BIG_ENDIAN
+ #define	AFSBIG_ENDIAN		1
+ #else
+ #if	BYTE_ORDER == LITTLE_ENDIAN
+ #define	AFSLITTLE_ENDIAN	1
+ #else
+ #error	machine/endian.h must define BYTE_ORDER!
+ #endif
+ #endif
+ #endif	/* ! ASSEMBLER && ! __LANGUAGE_ASSEMBLY__ */
+ 
+ #define NEARINODE_HINT  1 /* hint to ufs module to scatter inodes on disk*/
+ #define nearInodeHash(volid, hval) {                          \
+                 unsigned char*  ts = (unsigned char*)&(volid);\
+                 for ((hval)=0; ts<(unsigned char*)&(volid)+sizeof(volid);ts++){\
+                     (hval) *= 173;                      \
+                     (hval) += *ts;                      \
+                 }                                       \
+                 }
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	1	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define	AFS_KALLOC(x)	kalloc(x)
+ #define	AFS_KFREE(x,y)	kfree(x,y)
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	m_stat.f_bsize
+ #define vfs_fsid	m_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered m_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)))
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl {NONEXCL, EXCL};
+ 
+ #include <net/net_globals.h>
+ 
+ #endif	/* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #endif	/* _PARAM_OSF1_H_ */
Index: openafs/src/config/param.alpha_dux50_usr.h
diff -c /dev/null openafs/src/config/param.alpha_dux50_usr.h:1.1.2.1
*** /dev/null	Wed Mar  7 15:26:15 2001
--- openafs/src/config/param.alpha_dux50_usr.h	Tue Mar  6 16:23:57 2001
***************
*** 0 ****
--- 1,67 ----
+ /*
+  * 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	_PARAM_ALPHA_DUX50_USR_H_
+ #define	_PARAM_ALPHA_DUX50_USR_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_64BIT_ENV		1
+ #define AFS_ENV			1
+ #define AFS_USR_OSF_ENV		1
+ #define AFS_USR_DUX40_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		232
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS	 1
+ 
+ /* Machine / Operating system information */
+ #define sys_alpha_dux40	1
+ #define SYS_NAME	"alpha_dux50"
+ #define SYS_NAME_ID	SYS_NAME_ID_alpha_dux50
+ #define AFS_HAVE_FFS            1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS	0	/* System doesn't support statvfs */
+ #define AFSLITTLE_ENDIAN        1
+ 
+ /* 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 /* _PARAM_ALPHA_DUX50_USR_H_ */
Index: openafs/src/config/param.i386_linux22.h
diff -c openafs/src/config/param.i386_linux22.h:1.2 openafs/src/config/param.i386_linux22.h:1.2.2.2
*** openafs/src/config/param.i386_linux22.h:1.2	Sat Nov  4 05:04:23 2000
--- openafs/src/config/param.i386_linux22.h	Tue Mar  6 17:19:19 2001
***************
*** 25,30 ****
--- 25,31 ----
  
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
+ #define AFS_64BIT_ENV
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  #include <afs/afs_sysnames.h>
***************
*** 57,62 ****
--- 58,68 ----
  #endif
  #define __SMP__
  #define AFS_GLOBAL_SUNLOCK
+ #endif
+ 
+ #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
+ #define MODVERSIONS
+ #include <linux/modversions.h>
  #endif
  
  #endif /* __KERNEL__  && !DUMP_KERNEL*/
Index: openafs/src/config/param.i386_linux24.h
diff -c openafs/src/config/param.i386_linux24.h:1.1 openafs/src/config/param.i386_linux24.h:1.1.2.1
*** openafs/src/config/param.i386_linux24.h:1.1	Mon Nov  6 13:55:50 2000
--- openafs/src/config/param.i386_linux24.h	Tue Mar  6 17:19:19 2001
***************
*** 52,57 ****
--- 52,62 ----
  #define AFS_GLOBAL_SUNLOCK
  #endif
  
+ #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
+ #define MODVERSIONS
+ #include <linux/modversions.h>
+ #endif
+ 
  #endif /* __KERNEL__  && !DUMP_KERNEL*/
  
  #ifdef KERNEL
Index: openafs/src/config/param.rs_aix42.h
diff -c openafs/src/config/param.rs_aix42.h:1.2 openafs/src/config/param.rs_aix42.h:1.2.2.1
*** openafs/src/config/param.rs_aix42.h:1.2	Sat Nov  4 05:04:23 2000
--- openafs/src/config/param.rs_aix42.h	Tue Mar  6 16:52:07 2001
***************
*** 23,28 ****
--- 23,29 ----
  
  /* File system entry (used if vmount.h doesn't define MNT_AFS */
  #define AFS_MOUNT_AFS	4
+ #define AFS_SYSCALL    31
  
  /* Machine / Operating system information */
  #define SYS_NAME	"rs_aix42"
Index: openafs/src/config/param.sun4x_58.h
diff -c openafs/src/config/param.sun4x_58.h:1.2 openafs/src/config/param.sun4x_58.h:1.2.2.1
*** openafs/src/config/param.sun4x_58.h:1.2	Tue Nov 14 19:39:00 2000
--- openafs/src/config/param.sun4x_58.h	Tue Mar  6 17:22:56 2001
***************
*** 19,31 ****
  
  #define AFS_64BIT_ENV		1       /* Defines afs_int32 as int, not long. */
  
  #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_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 */
--- 19,36 ----
  
  #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 */
Index: openafs/src/config/stds.h
diff -c openafs/src/config/stds.h:1.2 openafs/src/config/stds.h:1.2.2.3
*** openafs/src/config/stds.h:1.2	Sat Nov  4 05:04:25 2000
--- openafs/src/config/stds.h	Tue Mar  6 16:52:42 2001
***************
*** 55,64 ****
--- 55,103 ----
  #ifdef  AFS_64BIT_ENV
  typedef int              afs_int32;
  typedef unsigned int     afs_uint32;
+ typedef long long 	 afs_int64;
+ typedef  unsigned long long afs_uint64;
+ #define ZeroInt64(a)       (a) = 0
+ #define AssignInt64(a, b)   *(a) = (b)
+ #define AddInt64(a,b,c) *(c) = (a) + (b)
+ #define SubtractInt64(a,b,c) *(c) = (a) - (b)
+ #define CompareInt64(a,b) (a) - (b)
+ #define NonZeroInt64(a)                (a)
+ #define Int64ToInt32(a)    (a) & 0xFFFFFFFFL
+ #define FillInt64(t,h,l) (t) = (h); (t) <<= 32; (t) |= (l);
+ #define SplitInt64(t,h,l) (h) = (t) >> 32; (l) = (t) & 0xFFFFFFFF;
  #else   /* AFS_64BIT_ENV */
  typedef long             afs_int32;
  typedef unsigned long    afs_uint32;
+ 
+ struct Int64 {
+     afs_int32 high;
+     afs_uint32 low;
+ };
+ typedef struct Int64 afs_int64;
+ 
+ struct u_Int64 {
+     afs_uint32 high;
+     afs_uint32 low;
+ };
+ typedef struct u_Int64 afs_uint64;
+ #define ZeroInt64(a) (a).high = (a).low = 0
+ #define AssignInt64(a, b) (b)->high = (a).high; (b)->low = (a).low
+ #define NonZeroInt64(a)   (a).low || (a).high
+ #define Int64ToInt32(a)    (a).low
+ #define FillInt64(t,h,l) (t).high = (h); (t).low = (l);
+ #define SplitInt64(t,h,l) (h) = (t).high; (l) = (t).low;
  #endif  /* AFS_64BIT_ENV */
+ 
+ /* AFS_64BIT_CLIENT should presently be set only for AFS_64BIT_ENV systems */
+ 
+ #ifdef AFS_64BIT_CLIENT
+ typedef afs_int64 afs_size_t;
+ typedef afs_uint64 afs_offs_t;
+ #else /* AFS_64BIT_CLIENT */
+ typedef afs_int32 afs_size_t;
+ typedef afs_uint32 afs_offs_t;
+ #endif /* AFS_64BIT_CLIENT */
  
  /* you still have to include <netinet/in.h> to make these work */
  
Index: openafs/src/config/venus.h
diff -c openafs/src/config/venus.h:1.2.2.1 openafs/src/config/venus.h:1.2.2.2
*** openafs/src/config/venus.h:1.2.2.1	Fri Jan 19 04:55:45 2001
--- openafs/src/config/venus.h	Tue Mar  6 16:38:34 2001
***************
*** 176,180 ****
  #define VIOC_RXSTAT_PEER	_VICEIOCTL(54)	/* Control peer RX stats */
  #define VIOC_GETRXKCRYPT        _VICEIOCTL(55)  /* Set rxkad enc flag */
  #define VIOC_SETRXKCRYPT        _VICEIOCTL(56)  /* Set rxkad enc flag */
! 
  #endif /* AFS_VENUS_H */
--- 176,181 ----
  #define VIOC_RXSTAT_PEER	_VICEIOCTL(54)	/* Control peer RX stats */
  #define VIOC_GETRXKCRYPT        _VICEIOCTL(55)  /* Set rxkad enc flag */
  #define VIOC_SETRXKCRYPT        _VICEIOCTL(56)  /* Set rxkad enc flag */
! #define VIOC_PREFETCHTAPE       _VICEIOCTL(66)  /* MR-AFS prefetch from tape */
! #define VIOC_RESIDENCY_CMD      _VICEIOCTL(67)  /* generic MR-AFS cmds */
  #endif /* AFS_VENUS_H */
Index: openafs/src/export/Makefile
diff -c openafs/src/export/Makefile:1.2 openafs/src/export/Makefile:1.2.2.1
*** openafs/src/export/Makefile:1.2	Sat Nov  4 05:04:28 2000
--- openafs/src/export/Makefile	Tue Mar  6 17:28:37 2001
***************
*** 53,66 ****
  	${LD} -o export.ext.nonfs -eexport ${IMPORTS} export.nonfs.o symtab.o ${EXPORTS} -lcsys
  
  export.nonfs.o:
! 	cc -DAFS_NONFSTRANS -c export.c
  	-mv export.o export.nonfs.o
  
  cfgexport: cfgexport.o
! 	cc -O -o cfgexport cfgexport.o
  
  cfgafs: cfgafs.o
! 	cc -O -o cfgafs cfgafs.o
  
  cfgexport.o: cfgexport.c AFS_component_version_number.c
  cfgafs.o: cfgafs.c AFS_component_version_number.c
--- 53,66 ----
  	${LD} -o export.ext.nonfs -eexport ${IMPORTS} export.nonfs.o symtab.o ${EXPORTS} -lcsys
  
  export.nonfs.o:
! 	${CC} -DAFS_NONFSTRANS -c export.c
  	-mv export.o export.nonfs.o
  
  cfgexport: cfgexport.o
! 	${CC} -O -o cfgexport cfgexport.o
  
  cfgafs: cfgafs.o
! 	${CC} -O -o cfgafs cfgafs.o
  
  cfgexport.o: cfgexport.c AFS_component_version_number.c
  cfgafs.o: cfgafs.c AFS_component_version_number.c
Index: openafs/src/fsint/afsint.xg
diff -c openafs/src/fsint/afsint.xg:1.2 openafs/src/fsint/afsint.xg:1.2.2.1
*** openafs/src/fsint/afsint.xg:1.2	Sat Nov  4 05:04:30 2000
--- openafs/src/fsint/afsint.xg	Tue Mar  6 16:38:38 2001
***************
*** 298,303 ****
--- 298,323 ----
  typedef afs_int32 ViceIds<FLUSHMAX>;
  typedef	afs_int32 IPAddrs<FLUSHMAX>;
  
+ %#define MAXCMDINT64S                           3
+ %#define MAXCMDINT32S                           200
+ %#define MAXCMDCHARS                            256
+ 
+ struct ResidencyCmdInputs {
+     afs_int32  command;
+     struct AFSFid fid;
+     afs_int64  int64s[MAXCMDINT64S];
+     afs_uint32 int32s[MAXCMDINT32S];
+     char       chars[MAXCMDCHARS];
+ };
+ 
+ struct ResidencyCmdOutputs {
+     afs_int32  code;
+     struct AFSFetchStatus status;
+     afs_int64  int64s[MAXCMDINT64S];
+     afs_uint32 int32s[MAXCMDINT32S];
+     char       chars[MAXCMDCHARS];
+ }; 
+ 
  package RXAFS_
  prefix S
  statindex 7
***************
*** 544,546 ****
--- 564,572 ----
    AFSCallBack *CallBack,
    AFSVolSync *Sync
  ) = 163;
+ 
+ ResidencyCmd(
+   IN AFSFid *Fid,
+   IN struct ResidencyCmdInputs *Inputs,
+   OUT struct ResidencyCmdOutputs *Outputs
+ ) = 220; 
Index: openafs/src/ftpd43+/getusershell.c
diff -c openafs/src/ftpd43+/getusershell.c:1.1.6.1 openafs/src/ftpd43+/getusershell.c:1.1.6.2
*** openafs/src/ftpd43+/getusershell.c:1.1.6.1	Wed Dec 13 16:49:23 2000
--- openafs/src/ftpd43+/getusershell.c	Tue Mar  6 16:53:10 2001
***************
*** 19,24 ****
--- 19,25 ----
  static char sccsid[] = "@(#)getusershell.c	5.5 (Berkeley) 7/21/88";
  #endif /* LIBC_SCCS and not lint */
  
+ #include <afs/param.h>
  #include <sys/param.h>
  #include <sys/file.h>
  #include <sys/stat.h>
***************
*** 53,58 ****
--- 54,62 ----
  	return (ret);
  }
  
+ #ifdef AFS_AIX42_ENV
+ void
+ #endif
  endusershell()
  {
  	
***************
*** 113,118 ****
--- 117,125 ----
  	return (shells);
  }
  
+ #ifdef AFS_AIX42_ENV
+ void
+ #endif
  setusershell()
  {
  
Index: openafs/src/kauth/kaserver.c
diff -c openafs/src/kauth/kaserver.c:1.2 openafs/src/kauth/kaserver.c:1.2.2.1
*** openafs/src/kauth/kaserver.c:1.2	Sat Nov  4 05:04:39 2000
--- openafs/src/kauth/kaserver.c	Tue Mar  6 16:49:42 2001
***************
*** 156,161 ****
--- 156,163 ----
      int	  servers;
      int	  initFlags;
      int   level;			/* security level for Ubik */
+     afs_int32 i;
+     char  clones[MAXHOSTSPERCELL];
  
      struct rx_service *tservice;
      struct rx_securityClass *sca[1];
***************
*** 282,296 ****
      OpenLog(AFSDIR_SERVER_KALOG_FILEPATH); 
      SetupLogSignals();
  #endif
      if (servers) {
  	if (code = ubik_ParseServerList(argc, argv, &myHost, serverList)) {
  	    com_err(whoami, code, "Couldn't parse server list");
  	    exit(1);
  	}
      }
      else {
- 	code = afsconf_GetCellInfo (KA_conf, cell, AFSCONF_KAUTHSERVICE,
- 				    &cellinfo);
  	code = convert_cell_to_ubik (&cellinfo, &myHost, serverList);
  	if (code) goto abort;
  	ViceLog (0, ("Using server list from %s cell database.\n", cell));
--- 284,304 ----
      OpenLog(AFSDIR_SERVER_KALOG_FILEPATH); 
      SetupLogSignals();
  #endif
+     code = afsconf_GetExtendedCellInfo (KA_conf, cell, AFSCONF_KAUTHSERVICE,
+                                     &cellinfo, &clones);
      if (servers) {
  	if (code = ubik_ParseServerList(argc, argv, &myHost, serverList)) {
  	    com_err(whoami, code, "Couldn't parse server list");
  	    exit(1);
  	}
+         cellinfo.hostAddr[0].sin_addr.s_addr = myHost;
+         for (i=1; i<MAXSERVERS; i++) {
+             if (!serverList[i]) break;
+             cellinfo.hostAddr[i].sin_addr.s_addr = serverList[i];
+         }
+         cellinfo.numServers = i;
      }
      else {
  	code = convert_cell_to_ubik (&cellinfo, &myHost, serverList);
  	if (code) goto abort;
  	ViceLog (0, ("Using server list from %s cell database.\n", cell));
***************
*** 313,320 ****
      ubik_CheckRXSecurityRock = (char *)KA_conf;
  
      ubik_nBuffers = 80;
!     code = ubik_ServerInit (myHost, htons(AFSCONF_KAUTHPORT), serverList,
! 			    dbpath, &KA_dbase);
      if (code) {
  	com_err(whoami, code, "Ubik init failed");
  	exit(2);
--- 321,333 ----
      ubik_CheckRXSecurityRock = (char *)KA_conf;
  
      ubik_nBuffers = 80;
!     if (servers)
!         code = ubik_ServerInit (myHost, htons(AFSCONF_KAUTHPORT), serverList,
!                             dbpath, &KA_dbase);
!     else
!         code = ubik_ServerInitByInfo (myHost, htons(AFSCONF_KAUTHPORT), 
!                            &cellinfo, &clones, dbpath, &KA_dbase);
! 
      if (code) {
  	com_err(whoami, code, "Ubik init failed");
  	exit(2);
Index: openafs/src/kauth/krb_udp.c
diff -c openafs/src/kauth/krb_udp.c:1.2.2.2 openafs/src/kauth/krb_udp.c:1.2.2.4
*** openafs/src/kauth/krb_udp.c:1.2.2.2	Fri Jan 19 04:54:56 2001
--- openafs/src/kauth/krb_udp.c	Tue Mar  6 17:25:31 2001
***************
*** 559,566 ****
      char  buf[256];
  
      if (reason == 0) reason = "";
!     else if (strlen(reason) + 20 > sizeof(buf)) reason = "reason too long";
!     sprintf (buf, "code = %d: %s", code, reason);
  
      if (krb_udp_debug) {
  	printf ("Sending error packet to '%s'.'%s'@'%s' containing %s\n",
--- 559,565 ----
      char  buf[256];
  
      if (reason == 0) reason = "";
!     snprintf (buf, 255, "code = %d: %s", code, reason);
  
      if (krb_udp_debug) {
  	printf ("Sending error packet to '%s'.'%s'@'%s' containing %s\n",
Index: openafs/src/kauth/user.c
diff -c openafs/src/kauth/user.c:1.2 openafs/src/kauth/user.c:1.2.2.1
*** openafs/src/kauth/user.c:1.2	Sat Nov  4 05:04:42 2000
--- openafs/src/kauth/user.c	Tue Mar  6 16:53:43 2001
***************
*** 51,57 ****
  #endif /* defined(UKERNEL) */
  
  
! static afs_int32 GetTickets (
    char *name,
    char *instance,
    char *realm,
--- 51,57 ----
  #endif /* defined(UKERNEL) */
  
  
! afs_int32 GetTickets (
    char *name,
    char *instance,
    char *realm,
Index: openafs/src/libafs/Makefile.common
diff -c openafs/src/libafs/Makefile.common:1.2 openafs/src/libafs/Makefile.common:1.2.2.1
*** openafs/src/libafs/Makefile.common:1.2	Sat Nov  4 05:05:03 2000
--- openafs/src/libafs/Makefile.common	Tue Mar  6 16:54:46 2001
***************
*** 125,130 ****
--- 125,131 ----
  	rxkad_client.o	\
  	rxkad_common.o	\
  	xdr_afsuuid.o	\
+ 	xdr_int64.o	\
  	afs_uuid.o $(AFS_OS_OBJS)
  
  # These next two allow nfs and nonfs builds to occur in the same directory.
***************
*** 229,234 ****
--- 230,237 ----
  afs_uuid.o: $(AFS)/afs_uuid.c
  	$(CRULE2);
  xdr_afsuuid.o: $(RX)/xdr_afsuuid.c
+ 	$(CRULE2);
+ xdr_int64.o: $(RX)/xdr_int64.c
  	$(CRULE2);
  
  # these files are not to be optimized - subject to change.
Index: openafs/src/libafs/MakefileProto.AIX
diff -c openafs/src/libafs/MakefileProto.AIX:1.2 openafs/src/libafs/MakefileProto.AIX:1.2.2.2
*** openafs/src/libafs/MakefileProto.AIX:1.2	Sat Nov  4 05:05:04 2000
--- openafs/src/libafs/MakefileProto.AIX	Tue Mar  6 17:14:10 2001
***************
*** 129,134 ****
--- 129,136 ----
  # Common objects
  xdr.o: $(RX)/xdr.c
  	$(CRULE1);
+ xdr_int64.o: $(RX)/xdr_int64.c
+ 	$(CRULE1);
  
  xdr_array.o: $(RX)/xdr_array.c
  	$(CRULE1);
Index: openafs/src/libafs/MakefileProto.DUX
diff -c openafs/src/libafs/MakefileProto.DUX:1.2 openafs/src/libafs/MakefileProto.DUX:1.2.2.1
*** openafs/src/libafs/MakefileProto.DUX:1.2	Sat Nov  4 05:05:04 2000
--- openafs/src/libafs/MakefileProto.DUX	Tue Mar  6 16:24:14 2001
***************
*** 77,82 ****
--- 77,84 ----
  
  
  # libafs:	$(DEST_LIBAFS) $(DEST_LIBAFSNONFS)
+ 
+ .PHONY: libafs
  libafs:	$(DEST_LIBAFSNONFS)
  
  
Index: openafs/src/libafs/MakefileProto.IRIX
diff -c openafs/src/libafs/MakefileProto.IRIX:1.2 openafs/src/libafs/MakefileProto.IRIX:1.2.2.1
*** openafs/src/libafs/MakefileProto.IRIX:1.2	Sat Nov  4 05:05:04 2000
--- openafs/src/libafs/MakefileProto.IRIX	Tue Mar  6 16:11:13 2001
***************
*** 218,224 ****
  	-ln -s /usr/include/sys h
  	-ln -s /usr/include/net /usr/include/netinet .
  	-ln -s /usr/include/rpc /usr/include/sys .
! 	-ln -s ../../obj/sgiefs sgiefs
  	-mkdir ${DESTDIR}root.client/bin
  	-mkdir ${DESTDIR}root.client/usr/vice/etc/sgiload
  <all -sgi_65>
--- 218,224 ----
  	-ln -s /usr/include/sys h
  	-ln -s /usr/include/net /usr/include/netinet .
  	-ln -s /usr/include/rpc /usr/include/sys .
! 	-ln -s /usr/include/sys/fs .
  	-mkdir ${DESTDIR}root.client/bin
  	-mkdir ${DESTDIR}root.client/usr/vice/etc/sgiload
  <all -sgi_65>
***************
*** 342,355 ****
  		export CPU_KDEFS ;\
  		export LDFLAGS ;\
  		cd $$dir ; \
! 		$(MAKE) IPNO=$$p DESTDIR=../${DESTDIR} $$t.libafs || exit $$?; \
  		cd ../ ; \
  	  done; \
  	done
  <all>
  
  
- LIBAFSA = libafs.a
  LIBAFSNONFSA = libafs.nonfs.a
  COPYFILES = copyfiles
  LINKFILES = linkfiles
--- 342,354 ----
  		export CPU_KDEFS ;\
  		export LDFLAGS ;\
  		cd $$dir ; \
! 		$(MAKE) IPNO=$$p DESTDIR=${DESTDIR} $$t.libafs || exit $$?; \
  		cd ../ ; \
  	  done; \
  	done
  <all>
  
  
  LIBAFSNONFSA = libafs.nonfs.a
  COPYFILES = copyfiles
  LINKFILES = linkfiles
***************
*** 358,403 ****
  MODLOADCLIENTDIR = ${DESTDIR}root.client/usr/vice/etc/sgiload
  
  # Make the NFS and no-NFS clients for this directory.
! # STATIC.libafs: ${LIBAFSA} ${LIBAFSNONFSA} ${COPYFILES} ${LINKFILES}
  STATIC.libafs: ${LIBAFSNONFSA} ${COPYFILES} ${LINKFILES}
  <all -sgi_65>
- 	${CP} ${LIBAFSA} \
- 		${STATICCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.a
  	${CP} ${LIBAFSNONFSA} \
  		${STATICCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.nonfs.a
  <sgi_65>
- 	${CP} ${LIBAFSA} \
- 		${STATICCLIENTDIR}/libafs.${IPNO}.a
  	${CP} ${LIBAFSNONFSA} \
  		${STATICCLIENTDIR}/libafs.${IPNO}.nonfs.a
  <all>
  
- ${LIBAFSA}: $(AFSAOBJS) $(AFSNFSOBJS)
- 	$(AR) cru  $@ $?
- 
  ${LIBAFSNONFSA}: $(AFSAOBJS) $(AFSNONFSOBJS)
  	$(AR) cru  $@ $?
  
- LIBAFSO = libafs.o
  LIBAFSNONFSO = libaf.nonfs.o
  
! # MODLOAD.libafs: ${LIBAFSO} ${LIBAFSNONFSO} ${COPYFILES} ${LINKFILES}
  MODLOAD.libafs: ${LIBAFSNONFSO} ${COPYFILES} ${LINKFILES}
  <all -sgi_65>
- 	${CP} ${LIBAFSO} \
- 		${MODLOADCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.o
  	${CP} ${LIBAFSNONFSO} \
  		${MODLOADCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.nonfs.o
  <sgi_65>
- 	${CP} ${LIBAFSO} \
- 		${MODLOADCLIENTDIR}/libafs.${IPNO}.o
  	${CP} ${LIBAFSNONFSO} \
  		${MODLOADCLIENTDIR}/libafs.${IPNO}.nonfs.o
  <all>
- 
- ${LIBAFSO}: $(AFSAOBJS) $(AFSNFSOBJS)
- 	$(LD) ${LDFLAGS} -elf -r -d -G 0 -o ${LIBAFSO} $(AFSAOBJS) $(AFSNFSOBJS)
- 	
  
  ${LIBAFSNONFSO}: $(AFSAOBJS) $(AFSNONFSOBJS)
  	$(LD) ${LDFLAGS} -elf -r -d -G 0 -o ${LIBAFSNONFSO} \
--- 357,386 ----
  MODLOADCLIENTDIR = ${DESTDIR}root.client/usr/vice/etc/sgiload
  
  # Make the NFS and no-NFS clients for this directory.
! # STATIC.libafs: ${LIBAFSNONFSA} ${COPYFILES} ${LINKFILES}
  STATIC.libafs: ${LIBAFSNONFSA} ${COPYFILES} ${LINKFILES}
  <all -sgi_65>
  	${CP} ${LIBAFSNONFSA} \
  		${STATICCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.nonfs.a
  <sgi_65>
  	${CP} ${LIBAFSNONFSA} \
  		${STATICCLIENTDIR}/libafs.${IPNO}.nonfs.a
  <all>
  
  ${LIBAFSNONFSA}: $(AFSAOBJS) $(AFSNONFSOBJS)
  	$(AR) cru  $@ $?
  
  LIBAFSNONFSO = libaf.nonfs.o
  
! # MODLOAD.libafs: ${LIBAFSNONFSO} ${COPYFILES} ${LINKFILES}
  MODLOAD.libafs: ${LIBAFSNONFSO} ${COPYFILES} ${LINKFILES}
  <all -sgi_65>
  	${CP} ${LIBAFSNONFSO} \
  		${MODLOADCLIENTDIR}/libafs.${MPSP}.${CPUARCH}.nonfs.o
  <sgi_65>
  	${CP} ${LIBAFSNONFSO} \
  		${MODLOADCLIENTDIR}/libafs.${IPNO}.nonfs.o
  <all>
  
  ${LIBAFSNONFSO}: $(AFSAOBJS) $(AFSNONFSOBJS)
  	$(LD) ${LDFLAGS} -elf -r -d -G 0 -o ${LIBAFSNONFSO} \
Index: openafs/src/libafs/MakefileProto.LINUX
diff -c openafs/src/libafs/MakefileProto.LINUX:1.3.2.3 openafs/src/libafs/MakefileProto.LINUX:1.3.2.6
*** openafs/src/libafs/MakefileProto.LINUX:1.3.2.3	Fri Jan 19 04:53:12 2001
--- openafs/src/libafs/MakefileProto.LINUX	Tue Mar  6 17:23:56 2001
***************
*** 43,50 ****
  DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
  <s390_linux22 s390_linux24>
  CCFLAGS =   -O2 -fomit-frame-pointer -fno-strength-reduce \
! 	-fno-strict-aliasing -fsigned-char -pipe \
! 	-fno-builtin
  DEFINES = -D__KERNEL__  -D__s390__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
  <sparc_linux22 sparc_linux24>
  LD = ld -m elf32_sparc
--- 43,49 ----
  DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
  <s390_linux22 s390_linux24>
  CCFLAGS =   -O2 -fomit-frame-pointer -fno-strength-reduce \
! 	-fno-strict-aliasing -fsigned-char 
  DEFINES = -D__KERNEL__  -D__s390__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
  <sparc_linux22 sparc_linux24>
  LD = ld -m elf32_sparc
***************
*** 189,194 ****
--- 188,195 ----
  osi_vnodeops.o: $(AFS)/osi_vnodeops.c
  	$(CRULE1);
  xdr.o: $(RX)/xdr.c
+ 	$(CRULE1);
+ xdr_int64.o: $(RX)/xdr_int64.c
  	$(CRULE1);
  xdr_array.o: $(RX)/xdr_array.c
  	$(CRULE1);
Index: openafs/src/libafs/sgi_master
diff -c /dev/null openafs/src/libafs/sgi_master:1.1.2.1
*** /dev/null	Wed Mar  7 15:26:23 2001
--- openafs/src/libafs/sgi_master	Tue Mar  6 16:16:16 2001
***************
*** 0 ****
--- 1,8 ----
+ * Format defined by:
+ * master(4)
+ *
+ * bc dkip 4 - io
+ *FLAG 	PREFIX 	SOFT 	#DEV 	DEPENDENCIESi
+ jnsw	Afs_	-	-	specfs,bsd
+ 
+ $$$
\ No newline at end of file
Index: openafs/src/libafsrpc/Makefile
diff -c openafs/src/libafsrpc/Makefile:1.2.2.1 openafs/src/libafsrpc/Makefile:1.2.2.2
*** openafs/src/libafsrpc/Makefile:1.2.2.1	Fri Jan 19 04:12:17 2001
--- openafs/src/libafsrpc/Makefile	Tue Mar  6 16:38:45 2001
***************
*** 41,46 ****
--- 41,47 ----
  XDROBJS =\
  	xdr_arrayn.o \
  	xdr_rx.o \
+ 	xdr_int64.o \
  	xdr_afsuuid.o \
  	AFS_component_version_number.o
  
***************
*** 192,197 ****
--- 193,201 ----
  xdr.o: ${RX}/xdr.c
  	${CCRULE};
  
+ xdr_int64.o: ${RX}/xdr_int64.c
+ 	${CCRULE};
+ 
  xdr_array.o: ${RX}/xdr_array.c
  	${CCRULE};
  
***************
*** 238,244 ****
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.2.2.1 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
--- 242,248 ----
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.2.2.2 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
Index: openafs/src/libafsrpc/NTMakefile
diff -c openafs/src/libafsrpc/NTMakefile:1.2 openafs/src/libafsrpc/NTMakefile:1.2.2.1
*** openafs/src/libafsrpc/NTMakefile:1.2	Sat Nov  4 05:05:05 2000
--- openafs/src/libafsrpc/NTMakefile	Tue Mar  6 16:55:49 2001
***************
*** 27,33 ****
  
  XDROBJS = xdr.obj xdr_array.obj xdr_arrayn.obj xdr_float.obj xdr_mem.obj \
  	xdr_rec.obj  xdr_refernce.obj xdr_rx.obj xdr_update.obj \
! 	xdr_afsuuid.obj
  
  RXOBJS = rx_event.obj rx_user.obj rx_pthread.obj rx.obj \
  	rx_null.obj rx_globals.obj rx_getaddr.obj rx_misc.obj rx_packet.obj \
--- 27,33 ----
  
  XDROBJS = xdr.obj xdr_array.obj xdr_arrayn.obj xdr_float.obj xdr_mem.obj \
  	xdr_rec.obj  xdr_refernce.obj xdr_rx.obj xdr_update.obj \
! 	xdr_afsuuid.obj xdr_int64.obj
  
  RXOBJS = rx_event.obj rx_user.obj rx_pthread.obj rx.obj \
  	rx_null.obj rx_globals.obj rx_getaddr.obj rx_misc.obj rx_packet.obj \
***************
*** 87,92 ****
--- 87,95 ----
  
  xdr_afsuuid.obj: $(RX)\xdr_afsuuid.c
  	$(C2OBJ) $(RX)\xdr_afsuuid.c
+ 
+ xdr_int64.obj: $(RX)\xdr_int64.c
+ 	$(C2OBJ) $(RX)\xdr_int64.c
  
  rx_event.obj: $(RX)\rx_event.c
  	$(C2OBJ) $(RX)\rx_event.c
Index: openafs/src/libafsrpc/afsrpc.exp
diff -c openafs/src/libafsrpc/afsrpc.exp:1.1 openafs/src/libafsrpc/afsrpc.exp:1.1.6.1
*** openafs/src/libafsrpc/afsrpc.exp:1.1	Fri Nov  3 21:28:08 2000
--- openafs/src/libafsrpc/afsrpc.exp	Tue Mar  6 16:55:49 2001
***************
*** 77,82 ****
--- 77,83 ----
  xdrrec_skiprecord
  xdrrx_create
  xdr_afsuuid
+ xdr_int64
  hton_syserr_conv
  rxkad_stats
  _et_list
Index: openafs/src/libuafs/Makefile.common
diff -c openafs/src/libuafs/Makefile.common:1.2 openafs/src/libuafs/Makefile.common:1.2.2.1
*** openafs/src/libuafs/Makefile.common:1.2	Sat Nov  4 05:05:06 2000
--- openafs/src/libuafs/Makefile.common	Tue Mar  6 16:38:48 2001
***************
*** 155,161 ****
  	$(UOBJ)/hostparse.o \
  	$(UOBJ)/Krxstat.ss.o \
  	$(UOBJ)/Krxstat.xdr.o \
! 	$(UOBJ)/rxstat.o
  
  AFSWEBOBJ = \
  	$(WEBOBJ)/afs_atomlist.o \
--- 155,162 ----
  	$(UOBJ)/hostparse.o \
  	$(UOBJ)/Krxstat.ss.o \
  	$(UOBJ)/Krxstat.xdr.o \
! 	$(UOBJ)/rxstat.o \
! 	$(UOBJ)/xdr_int64.o
  
  AFSWEBOBJ = \
  	$(WEBOBJ)/afs_atomlist.o \
***************
*** 520,525 ****
--- 521,528 ----
  $(UOBJ)/rx_conncache.o: $(RX)/rx_conncache.c
  	$(CRULE1);
  $(UOBJ)/xdr_rx.o: $(RX)/xdr_rx.c
+ 	$(CRULE1);
+ $(UOBJ)/xdr_int64.o: $(RX)/xdr_int64.c
  	$(CRULE1);
  $(UOBJ)/afs_usrops.o: $(AFS)/afs_usrops.c
  	$(CRULE1);
Index: openafs/src/libuafs/MakefileProto.AIX
diff -c openafs/src/libuafs/MakefileProto.AIX:1.2 openafs/src/libuafs/MakefileProto.AIX:1.2.2.1
*** openafs/src/libuafs/MakefileProto.AIX:1.2	Sat Nov  4 05:05:06 2000
--- openafs/src/libuafs/MakefileProto.AIX	Tue Mar  6 17:29:17 2001
***************
*** 18,24 ****
  AR = /usr/bin/ar
  ARFLAGS = -r
  RANLIB = /bin/ranlib
! CC = /usr/bin/xlc_r
  DEF_LIBPATH=/usr/lib/threads:/usr/lib:/lib
  EXPFILE=../nsafslib.exp 
  LD_FLAGS=-bM:SRE -bE:$(EXPFILE) -berok -bnoentry -blibpath:$(DEF_LIBPATH)
--- 18,24 ----
  AR = /usr/bin/ar
  ARFLAGS = -r
  RANLIB = /bin/ranlib
! CC = xlc_r
  DEF_LIBPATH=/usr/lib/threads:/usr/lib:/lib
  EXPFILE=../nsafslib.exp 
  LD_FLAGS=-bM:SRE -bE:$(EXPFILE) -berok -bnoentry -blibpath:$(DEF_LIBPATH)
Index: openafs/src/lwp/Makefile
diff -c openafs/src/lwp/Makefile:1.3 openafs/src/lwp/Makefile:1.3.2.2
*** openafs/src/lwp/Makefile:1.3	Sun Nov  5 15:03:34 2000
--- openafs/src/lwp/Makefile	Tue Mar  6 17:23:44 2001
***************
*** 21,28 ****
  include ../config/Makefile.version
  
  LIBOBJS=lwp.o process.o lock.o iomgr.o timer.o fasttime.o preempt.o \
! 	waitkey.o AFS_component_version_number.o
! LIBTOBJS=tlwp.o process.o lock.o tiomgr.o timer.o fasttime.o preempt.o AFS_component_version_number.o pthread.o
  
  noversion: install
  
--- 21,28 ----
  include ../config/Makefile.version
  
  LIBOBJS=lwp.o process.o lock.o iomgr.o timer.o fasttime.o preempt.o \
! 	waitkey.o threadname.o AFS_component_version_number.o
! LIBTOBJS=tlwp.o process.o lock.o tiomgr.o timer.o fasttime.o preempt.o AFS_component_version_number.o pthread.o threadname.o
  
  noversion: install
  
***************
*** 66,71 ****
--- 66,75 ----
  					$(CC) -c -I${SRCDIR}include -KPIC -G0  process.s;; \
  				sgi_61 | sgi_62 | sgi_63 ) \
  					$(CC) -c ${XCFLAGS} -I${SRCDIR}include -KPIC -G0  process.s;; \
+ 				s390*) \
+ 					/lib/cpp -P -I${SRCDIR}include process.s >process.ss; \
+ 					${AS} -ahlns process.ss -o process.o >process.lst; \
+ 					rm process.ss ;; \
  				hp* | *_linux* | sgi_64 | sgi_65) \
  					${CC} ${CFLAGS} -c process.c;; \
  				ncrx86_*) \
***************
*** 97,102 ****
--- 101,107 ----
  lock.o		: lock.c lock.h lwp.h
  timer.o		: timer.c
  fasttime.o	: fasttime.c
+ threadname.o    : threadname.c
  
  exc_handling.o	: exc_handling.c
  
Index: openafs/src/lwp/NTMakefile
diff -c openafs/src/lwp/NTMakefile:1.2 openafs/src/lwp/NTMakefile:1.2.2.1
*** openafs/src/lwp/NTMakefile:1.2	Sat Nov  4 05:05:08 2000
--- openafs/src/lwp/NTMakefile	Tue Mar  6 16:57:16 2001
***************
*** 16,21 ****
--- 16,22 ----
  	  timer.obj\
  	  fasttime.obj \
  	  waitkey.obj \
+ 	  threadname.obj \
  	  AFS_component_version_number.obj
  
  LIBFILE = $(DESTDIR)\lib\afslwp.lib
Index: openafs/src/lwp/lock.h
diff -c openafs/src/lwp/lock.h:1.2 openafs/src/lwp/lock.h:1.2.2.1
*** openafs/src/lwp/lock.h:1.2	Sat Nov  4 05:05:10 2000
--- openafs/src/lwp/lock.h	Tue Mar  6 16:57:16 2001
***************
*** 87,92 ****
--- 87,104 ----
  	    LOCK_UNLOCK(lock) \
  	ENDMAC
      
+ #define ObtainReadLockNoBlock(lock, code)\
+         BEGINMAC \
+             LOCK_LOCK(lock) \
+             if (!((lock)->excl_locked & WRITE_LOCK) && !(lock)->wait_states) {\
+                 (lock) -> readers_reading++;\
+                 code = 0;\
+             }\
+             else\
+                 code = -1; \
+             LOCK_UNLOCK(lock) \
+         ENDMAC
+ 
  #define ObtainWriteLock(lock)\
  	BEGINMAC \
  	    LOCK_LOCK(lock) \
***************
*** 97,102 ****
--- 109,126 ----
  	    LOCK_UNLOCK(lock) \
  	ENDMAC
      
+ #define ObtainWriteLockNoBlock(lock, code)\
+         BEGINMAC \
+             LOCK_LOCK(lock) \
+             if (!(lock)->excl_locked && !(lock)->readers_reading) {\
+                 (lock) -> excl_locked = WRITE_LOCK;\
+                 code = 0;\
+             }\
+             else\
+                 code = -1; \
+             LOCK_UNLOCK(lock) \
+         ENDMAC
+ 
  #define ObtainSharedLock(lock)\
  	BEGINMAC \
  	    LOCK_LOCK(lock) \
***************
*** 106,111 ****
--- 130,147 ----
  	        Afs_Lock_Obtain(lock, SHARED_LOCK); \
  	    LOCK_UNLOCK(lock) \
  	ENDMAC
+ 
+ #define ObtainSharedLockNoBlock(lock, code)\
+         BEGINMAC \
+             LOCK_LOCK(lock) \
+             if (!(lock)->excl_locked && !(lock)->wait_states) {\
+                 (lock) -> excl_locked = SHARED_LOCK;\
+                 code = 0;\
+             }\
+             else\
+                 code = -1; \
+             LOCK_UNLOCK(lock) \
+         ENDMAC
  
  #define BoostSharedLock(lock)\
  	BEGINMAC \
Index: openafs/src/lwp/lwp.c
diff -c openafs/src/lwp/lwp.c:1.2.2.2 openafs/src/lwp/lwp.c:1.2.2.4
*** openafs/src/lwp/lwp.c:1.2.2.2	Fri Jan 19 04:29:57 2001
--- openafs/src/lwp/lwp.c	Tue Mar  6 17:23:44 2001
***************
*** 38,43 ****
--- 38,45 ----
  #ifdef	AFS_OSF_ENV
  extern void *malloc(int size);
  extern void *realloc(void *ptr, int size);
+ #endif
+ #if defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV)
  extern int PRE_Block;	/* from preempt.c */
  #else
  extern char PRE_Block;	/* from preempt.c */
***************
*** 56,62 ****
--- 58,72 ----
  
  #ifdef __hp9000s800
  #define MINFRAME 128
+ #define STACK_ALIGN 8
+ #else
+ #ifdef __s390__
+ #define MINFRAME    96
+ #define STACK_ALIGN 8
+ #else
+ #define STACK_ALIGN 4
  #endif
+ #endif
  
  /* Debugging macro */
  #ifdef DEBUG
***************
*** 269,279 ****
  	if (stacksize < MINSTACK)
  	    stacksize = 1000;
  	else
! #ifdef __hp9000s800
! 	    stacksize = 8 * ((stacksize+7) / 8);
! #else
! 	    stacksize = 4 * ((stacksize+3) / 4);
! #endif
  #ifdef	AFS_AIX32_ENV
  	if (!stackptr) {
  	    /*
--- 279,285 ----
  	if (stacksize < MINSTACK)
  	    stacksize = 1000;
  	else
! 	    stacksize = STACK_ALIGN * ((stacksize+STACK_ALIGN-1) / STACK_ALIGN);
  #ifdef	AFS_AIX32_ENV
  	if (!stackptr) {
  	    /*
***************
*** 347,357 ****
  		    stackptr+stacksize-0x40); /* lomgjmp does something
  						 with %fp + 0x38 */
  #else
  	savecontext(Create_Process_Part2, &temp2->context,
  		    stackptr+stacksize-sizeof(void *));
  #endif
- #endif
- #endif
  	/* End of gross hack */
  
  	Set_LWP_RC();
--- 353,368 ----
  		    stackptr+stacksize-0x40); /* lomgjmp does something
  						 with %fp + 0x38 */
  #else
+ #if defined(AFS_S390_LINUX20_ENV)
+ 	savecontext(Create_Process_Part2, &temp2->context,
+ 		    stackptr+stacksize-MINFRAME);
+ #else /* !AFS_S390_LINUX20_ENV */
  	savecontext(Create_Process_Part2, &temp2->context,
  		    stackptr+stacksize-sizeof(void *));
+ #endif /* AFS_S390_LINUX20_ENV */
+ #endif /* AFS_SPARC64_LINUX20_ENV || AFS_SPARC_LINUX20_ENV */
+ #endif /* AFS_SGI62_ENV */
  #endif
  	/* End of gross hack */
  
  	Set_LWP_RC();
***************
*** 397,407 ****
  	if (stacksize < MINSTACK)
  	    stacksize = 1000;
  	else
! #ifdef __hp9000s800
! 	    stacksize = 8 * ((stacksize+7) / 8);
! #else
! 	    stacksize = 4 * ((stacksize+3) / 4);
! #endif
  	if ((stackptr = (char *) malloc(stacksize)) == NULL) {
  	    Set_LWP_RC();
  	    return LWP_ENOMEM;
--- 408,414 ----
  	if (stacksize < MINSTACK)
  	    stacksize = 1000;
  	else
! 	    stacksize = STACK_ALIGN * ((stacksize+STACK_ALIGN-1) / STACK_ALIGN);
  	if ((stackptr = (char *) malloc(stacksize)) == NULL) {
  	    Set_LWP_RC();
  	    return LWP_ENOMEM;
***************
*** 422,429 ****
--- 429,440 ----
  #ifdef __hp9000s800
  	savecontext(Create_Process_Part2, &temp2->context, stackptr+MINFRAME);
  #else
+ #if defined(AFS_S390_LINUX20_ENV)
+ 	savecontext(Create_Process_Part2, &temp2->context, stackptr+stacksize-MINFRAME);
+ #else
  	savecontext(Create_Process_Part2, &temp2->context, stackptr+stacksize-sizeof(void *));
  #endif
+ #endif
  	/* End of gross hack */
  
  	Set_LWP_RC();
***************
*** 445,450 ****
--- 456,470 ----
  	return LWP_EINIT;
  }
  
+ PROCESS LWP_ThreadId()
+ {
+     Debug(0, ("Entered ThreadId"))
+     if (lwp_init)
+         return lwp_cpptr;
+     else
+         return (PROCESS) 0;
+ }
+ 
  #define LWPANCHOR (*lwp_init)
  
  int LWP_DestroyProcess(pid)		/* destroy a lightweight process */
***************
*** 473,480 ****
--- 493,505 ----
  	    savecontext(Dispatcher, &(temp -> context),
  			&(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-0x40]));
  #else
+ #if defined(AFS_S390_LINUX20_ENV)
  	    savecontext(Dispatcher, &(temp -> context),
+ 			&(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-MINFRAME]));
+ #else
+ 	    savecontext(Dispatcher, &(temp -> context),
  			&(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-sizeof(void *)]));
+ #endif
  #endif
  #endif
  #endif
Index: openafs/src/lwp/lwp_nt.c
diff -c openafs/src/lwp/lwp_nt.c:1.2 openafs/src/lwp/lwp_nt.c:1.2.2.1
*** openafs/src/lwp/lwp_nt.c:1.2	Sat Nov  4 05:05:11 2000
--- openafs/src/lwp/lwp_nt.c	Tue Mar  6 16:57:17 2001
***************
*** 275,280 ****
--- 275,289 ----
  	return LWP_EINIT;
  }
  
+ PROCESS LWP_ThreadId()
+ {
+     Debug(0, ("Entered ThreadId"))
+     if (lwp_init)
+         return lwp_cpptr;
+     else
+         return (PROCESS) 0;
+ }
+ 
  int LWP_DispatchProcess(void)		/* explicit voluntary preemption */
  {
      Debug(2, ("Entered Dispatch_Process"))
Index: openafs/src/lwp/preempt.c
diff -c openafs/src/lwp/preempt.c:1.2.2.1 openafs/src/lwp/preempt.c:1.2.2.2
*** openafs/src/lwp/preempt.c:1.2.2.1	Fri Jan 19 04:29:58 2001
--- openafs/src/lwp/preempt.c	Tue Mar  6 17:23:45 2001
***************
*** 26,32 ****
  #include "lwp.h"
  #include "preempt.h"
  
! #ifdef	AFS_OSF_ENV
  int PRE_Block = 0;		/* used in lwp.c and process.s */
  #else
  char PRE_Block = 0;		/* used in lwp.c and process.s */
--- 26,32 ----
  #include "lwp.h"
  #include "preempt.h"
  
! #if defined(AFS_OSF_ENV) || defined(AFS_S390_LINUX20_ENV)
  int PRE_Block = 0;		/* used in lwp.c and process.s */
  #else
  char PRE_Block = 0;		/* used in lwp.c and process.s */
Index: openafs/src/lwp/process.c
diff -c openafs/src/lwp/process.c:1.3.2.1 openafs/src/lwp/process.c:1.3.2.2
*** openafs/src/lwp/process.c:1.3.2.1	Fri Jan 19 04:29:58 2001
--- openafs/src/lwp/process.c	Tue Mar  6 17:23:45 2001
***************
*** 13,19 ****
  #include <assert.h>
  #include "lwp.h"
  
! #ifdef  AFS_OSF_ENV
  extern int PRE_Block;              /* used in lwp.c and process.s */
  #else
  extern char PRE_Block;             /* used in lwp.c and process.s */
--- 13,19 ----
  #include <assert.h>
  #include "lwp.h"
  
! #if defined(AFS_OSF_ENV) || defined(AFS_S390_LINUX20_ENV)
  extern int PRE_Block;              /* used in lwp.c and process.s */
  #else
  extern char PRE_Block;             /* used in lwp.c and process.s */
***************
*** 35,40 ****
--- 35,43 ----
  #define LWP_SP 0
  #elif   defined(AFS_I386_LINUX20_ENV)
  #define LWP_SP 4
+ #elif   defined(AFS_S390_LINUX20_ENV)
+ #define LWP_SP 9
+ #define LWP_FP 5
  #elif   defined(AFS_SPARC_LINUX20_ENV)
  #define LWP_SP 0
  #define LWP_FP 1
***************
*** 105,111 ****
  				{
  				case 0: jmpBuffer = (jmp_buf_type *)jmp_tmp;
  					jmpBuffer[LWP_SP] = (jmp_buf_type)sp; 
! #if defined(AFS_SPARC_LINUX20_ENV) || (defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV))
  					jmpBuffer[LWP_FP] = (jmp_buf_type)sp; 
  #endif
  				   	longjmp(jmp_tmp,1);
--- 108,114 ----
  				{
  				case 0: jmpBuffer = (jmp_buf_type *)jmp_tmp;
  					jmpBuffer[LWP_SP] = (jmp_buf_type)sp; 
! #if defined(AFS_S390_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || (defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV))
  					jmpBuffer[LWP_FP] = (jmp_buf_type)sp; 
  #endif
  				   	longjmp(jmp_tmp,1);
Index: openafs/src/lwp/process.s
diff -c openafs/src/lwp/process.s:1.2 openafs/src/lwp/process.s:1.2.2.1
*** openafs/src/lwp/process.s:1.2	Sat Nov  4 05:05:12 2000
--- openafs/src/lwp/process.s	Tue Mar  6 17:23:45 2001
***************
*** 165,171 ****
--- 165,257 ----
  	.extern	PRE_Block[ua]
  
  #endif	/* RIOS	*/
+ #if defined(AFS_S390_LINUX20_ENV)
+       /* Linux for S/390 (31 bit)
+        *
+        * Written by Neale Ferguson <Neale.Ferguson@SoftwareAG-usa.com>
+        *
+        *  additional munging by Adam Thornton <adam@sinenomine.net>
+        */
+               .file   "process.s"
  
+               .globl savecontext
+               .type  savecontext,%function
+       /*
+        * savecontext(f, area1, newsp)
+        *      int (*f)();    struct savearea *area1; char *newsp;
+        * f     - r2
+        * area1 - r3
+        * newsp - r4
+        */
+ 
+        /*
+         * struct savearea {
+         *      char    *topstack;
+         * }
+         */
+ 
+ P_PRE:	                  .long   PRE_Block
+ P_ABORT:	              .long   abort
+ 
+ savecontext:
+               stm     %r6,%r15,24(%r15)       /* Save our registers */
+               lr      %r1,%r15
+               ahi     %r15,-96                /* Move out of harm's way */
+               st      %r1,0(%r15)
+               bras    %r5,.L0                 /* Get A(A(PRE_Block)) */
+               .long   PRE_Block
+       .L0:
+               l       %r5,0(%r5)              /* Get A(PRE_Block) */
+               mvi     0(%r5),1                /* Set it */
+               lr      %r6,%r3                 /* Get base of savearea */
+               st      %r15,0(%r3)             /* Save stack pointer */
+               ltr     %r4,%r4                 /* If new sp is 0 */
+               jz      .L1                     /* ... don't change sp */
+               lr      %r15,%r4                /* Set new stack pointer */
+       .L1:
+               br      %r2                     /* Call the routine */
+               /* Can't get here....*/
+ 
+               bras    %r5,.L2
+               .long   abort
+       .L2:
+               l      %r5,0(%r5)
+               balr    %r14,%r5
+ 
+       .savecontext_end:
+               .size   savecontext,.savecontext_end-savecontext
+ 
+       /*
+        * returnto(area2)
+        *      struct savearea *area2;
+        *
+        * area2 - r2
+        */
+         .globl  returnto
+         .type   returnto,%function
+ returnto:
+         l       %r15,0(%r2)             /* New frame, to get correct pointer*/
+         bras    %r5,.L3                         /* Get A(A(PRE_Block))
+       */
+                  .long          PRE_Block
+       .L3:
+               l       %r5,0(%r5)              /* Get A(PRE_Block) */
+               xc      0(4,%r5),0(%r5)         /* Clear it */
+               l       %r15,0(%r15)
+               lm      %r6,%r15,24(%r15)       /* Restore registers */
+               br      %r14                    /* Return */
+ 
+ 	      /* Can't happen */
+               la      %r2,1234
+               bras    %r5,.L4
+                 .long          abort
+       .L4:
+               l       %r5,0(%r5)
+               basr    %r14,%r5
+       .returnto_end:
+               .size   returnto,.returnto_end-returnto
+ #endif /* AFS_S390_LINUX20_ENV */
+ 	
  #ifdef mc68000
  /*
  #
Index: openafs/src/lwp/threadname.c
diff -c /dev/null openafs/src/lwp/threadname.c:1.1.2.1
*** /dev/null	Wed Mar  7 15:26:25 2001
--- openafs/src/lwp/threadname.c	Tue Mar  6 16:57:17 2001
***************
*** 0 ****
--- 1,110 ----
+ /*
+  * 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
+  */ 
+ /* ********************************************************************** */
+ /*                                                                        */
+ /*  trheadname.c                                                          */
+ /*                                                                        */
+ /*  Author: Hartmut Reuter                                                */
+ /*  reuter@rzg.mpg.de                                                     */
+ /*  Date: 01/12/00                                                        */
+ /*                                                                        */
+ /*  Function    - These routiens implement thread names for the           */
+ /*                logging from the servers                                */
+ /*                                                                        */
+ /* ********************************************************************** */
+ 
+ #include <afs/param.h>
+ #if defined(AFS_PTHREAD_ENV)
+ #include <pthread.h>
+ #else /* defined(AFS_PTHREAD_ENV) */
+ #include "lwp.h"
+ #endif /* defined(AFS_PTHREAD_ENV) */
+ 
+ #define MAX_THREADS 128
+ #define MAXTHREADNAMELENGTH 64
+ int nThreads = 0;
+ #if defined(AFS_PTHREAD_ENV)
+ pthread_t ThreadId[MAX_THREADS];
+ #else /* defined(AFS_PTHREAD_ENV) */
+ PROCESS   ThreadId[MAX_THREADS];
+ #endif /* defined(AFS_PTHREAD_ENV) */
+ char      ThreadName[MAX_THREADS][MAXTHREADNAMELENGTH];
+ 
+ char * threadname ()
+ {
+     int i;
+     static char MainThread[] = "main";
+     char *ptr;
+     char *p;
+ #ifdef AFS_PTHREAD_ENV
+     pthread_t me;
+ #else /* AFS_PTHREAD_ENV */
+     PROCESS me;
+ #endif /* AFS_PTHREAD_ENV */
+ 
+ #ifdef AFS_PTHREAD_ENV
+     me =  pthread_self();
+ #else /* AFS_PTHREAD_ENV */
+     me =  (PROCESS) LWP_ThreadId();
+ #endif /* AFS_PTHREAD_ENV */
+     ptr = (char *) &MainThread; 
+     for (i = 0; i < nThreads; i++) {
+        if (ThreadId[i] == me) {
+            ptr = (char *)&ThreadName[i];
+            break;
+        }
+  }
+     p = ptr;
+     return p;
+ }
+ 
+ int registerthread(id, name)
+ #ifdef AFS_PTHREAD_ENV
+     pthread_t id;
+ #else /* AFS_PTHREAD_ENV */
+     PROCESS id;
+ #endif /* AFS_PTHREAD_ENV */
+     char *name;
+ {
+     int i;
+ 
+     for (i = 0; i < nThreads; i++) {
+        if (ThreadId[i] == id) {
+            strncpy(&ThreadName[i][0], name, MAXTHREADNAMELENGTH);
+            return;
+        }
+     }
+     if (nThreads == MAX_THREADS) return;
+     ThreadId[nThreads] = id;
+     strncpy(&ThreadName[nThreads][0], name, MAXTHREADNAMELENGTH);
+     ThreadName[nThreads][MAXTHREADNAMELENGTH -1] =0;
+     nThreads++;
+ }
+ 
+ int swapthreadname(id, new, old)
+ #ifdef AFS_PTHREAD_ENV
+     pthread_t id;
+ #else /* AFS_PTHREAD_ENV */
+     PROCESS id;
+ #endif /* AFS_PTHREAD_ENV */
+     char *new;
+     char *old;
+ {
+     int i;
+ 
+     for (i = 0; i < nThreads; i++) {
+         if (ThreadId[i] == id) {
+            if (old)
+                 strncpy(old, &ThreadName[i][0], MAXTHREADNAMELENGTH);
+             strncpy(&ThreadName[i][0], new, MAXTHREADNAMELENGTH);
+             return 0;
+ 	}
+     }
+     return 1;
+ }
Index: openafs/src/ntp/ntp_proto.c
diff -c openafs/src/ntp/ntp_proto.c:1.2 openafs/src/ntp/ntp_proto.c:1.2.2.1
*** openafs/src/ntp/ntp_proto.c:1.2	Sat Nov  4 05:05:15 2000
--- openafs/src/ntp/ntp_proto.c	Tue Mar  6 17:21:10 2001
***************
*** 184,190 ****
  extern char *malloc(), *ntoa();
  extern double drift_comp, compliance;	/* logical clock variables */
  extern double s_fixed_to_double(), ul_fixed_to_double();
! extern void make_new_peer(), double_to_s_fixed(), tstamp(), demobilize();
  	
  
  #ifdef	REFCLOCK
--- 184,193 ----
  extern char *malloc(), *ntoa();
  extern double drift_comp, compliance;	/* logical clock variables */
  extern double s_fixed_to_double(), ul_fixed_to_double();
! extern void make_new_peer(), double_to_s_fixed(), demobilize();
! #ifndef AFS_SUN58_ENV
! extern void tstamp();
! #endif
  	
  
  #ifdef	REFCLOCK
Index: openafs/src/ntp/ntpsubs.c
diff -c openafs/src/ntp/ntpsubs.c:1.2 openafs/src/ntp/ntpsubs.c:1.2.2.1
*** openafs/src/ntp/ntpsubs.c:1.2	Sat Nov  4 05:05:17 2000
--- openafs/src/ntp/ntpsubs.c	Tue Mar  6 17:21:10 2001
***************
*** 233,239 ****
  	results in the value 2^31.  Neither 4.2bsd nor VMS have this
  	problem.  Reported it to Bob O'Brien of SMI
  */
! #ifdef	SUN_FLT_BUG
  tstamp(stampp, tvp)
  	struct l_fixedpt *stampp;
  	struct timeval *tvp;
--- 233,240 ----
  	results in the value 2^31.  Neither 4.2bsd nor VMS have this
  	problem.  Reported it to Bob O'Brien of SMI
  */
! #ifndef AFS_SUN58_ENV
! #ifdef SUN_FLT_BUG 
  tstamp(stampp, tvp)
  	struct l_fixedpt *stampp;
  	struct timeval *tvp;
***************
*** 255,260 ****
--- 256,262 ----
  	stampp->fraction = ntohl((afs_uint32) ((float) tvp->tv_usec * 4294.967295));
  }
  #endif
+ #endif /* AFS_SUN58_ENV */
  
  /*
   * ntoa is similar to inet_ntoa, but cycles through a set of 8 buffers
Index: openafs/src/pam/afs_auth.c
diff -c openafs/src/pam/afs_auth.c:1.2 openafs/src/pam/afs_auth.c:1.2.2.1
*** openafs/src/pam/afs_auth.c:1.2	Sat Nov  4 05:05:18 2000
--- openafs/src/pam/afs_auth.c	Tue Mar  6 16:32:42 2001
***************
*** 42,47 ****
--- 42,49 ----
      int use_first_pass = 0;
      int try_first_pass = 0;
      int ignore_root = 0;
+     int trust_root = 0;
+     int catch_su = 0;
      int set_expires = 0;  /* This option is only used in pam_set_cred() */
      int got_authtok = 0;	/* got PAM_AUTHTOK upon entry */
      int nouser = 0;
***************
*** 80,85 ****
--- 82,91 ----
  	    try_first_pass = 1;
  	} else if (strcasecmp(argv[i], "ignore_root"   ) == 0) {
  	    ignore_root = 1;
+ 	} else if (strcasecmp(argv[i], "trust_root"   ) == 0) {
+ 	    trust_root = 1;
+ 	} else if (strcasecmp(argv[i], "catch_su"   ) == 0) {
+ 	    catch_su = 1;
  	} else if (strcasecmp(argv[i], "setenv_password_expires") == 0) {
              set_expires = 1;
  	} else {
***************
*** 107,112 ****
--- 113,123 ----
  	RET(PAM_USER_UNKNOWN);
      }
  
+     if ((!strncmp ("root", user, 4)) && trust_root) {
+ 	pam_afs_syslog(LOG_INFO, PAMAFS_TRUSTROOT, user);
+ 	RET(PAM_SUCCESS);
+     }
+ 
      pam_afs_syslog(LOG_DEBUG, PAMAFS_USERNAMEDEBUG, user);
  
      /*
***************
*** 132,140 ****
  #else
      upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
  #endif
!     if (ignore_root && upwd != NULL && upwd->pw_uid == 0) {
! 	pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
! 	RET(PAM_AUTH_ERR);
      }
  #endif
      errcode = pam_get_item(pamh, PAM_AUTHTOK, (void **) &password);
--- 143,156 ----
  #else
      upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
  #endif
!     if (upwd != NULL && upwd->pw_uid == 0) {
! 	if (ignore_root) { 
! 		pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
! 		RET(PAM_AUTH_ERR);
! 	} else if (trust_root && !catch_su) {
! 		pam_afs_syslog(LOG_INFO, PAMAFS_TRUSTROOT, user);
! 		RET(PAM_SUCCESS);
! 	}
      }
  #endif
      errcode = pam_get_item(pamh, PAM_AUTHTOK, (void **) &password);
Index: openafs/src/pam/afs_message.c
diff -c openafs/src/pam/afs_message.c:1.2 openafs/src/pam/afs_message.c:1.2.2.2
*** openafs/src/pam/afs_message.c:1.2	Sat Nov  4 05:05:18 2000
--- openafs/src/pam/afs_message.c	Tue Mar  6 17:24:58 2001
***************
*** 36,42 ****
      "AFS not available",			/* 10: AFS_UNAVAIL	*/
      "AFS error code 0x%x",			/* 11: AFS_ERROR	*/
      "AFS Authentication succeeded.\n",		/* 12: LOGIN_OK		*/
!     "AFS Authentication failed for user %s. %s\n",
  						/* 13: LOGIN_FAILED	*/
      "AFS PAM error, code=%d",			/* 14: PAMERROR		*/
      "AFS uid exceeds OS bounds.\n",		/* 15: UID_OVERFLOW	*/
--- 36,42 ----
      "AFS not available",			/* 10: AFS_UNAVAIL	*/
      "AFS error code 0x%x",			/* 11: AFS_ERROR	*/
      "AFS Authentication succeeded.\n",		/* 12: LOGIN_OK		*/
!     "AFS Authentication failed for user %s %s\n",
  						/* 13: LOGIN_FAILED	*/
      "AFS PAM error, code=%d",			/* 14: PAMERROR		*/
      "AFS uid exceeds OS bounds.\n",		/* 15: UID_OVERFLOW	*/
***************
*** 64,69 ****
--- 64,80 ----
      "AFS ReInitializing creds for user %s\n",	/* 31: REINITCRED	*/
      "AFS Failed to set PASSWORD_EXPIRES for user %s\n",
  						/* 32: PASSEXPFAIL      */
+     "",
+ 						/* 33: */
+     "",
+ 						/* 34: */
+     "AFS blindly trusting user %s\n",		/* 35: TRUSTROOT	*/
+     "New AFS Password: ",                       /* 36: NEW_PWD_PROMPT   */
+     "New AFS Password (again): ",               /* 37: VERIFY_PWD_PROMPT */
+     "Failed to change AFS password",            /* 38: KRBPASS_FAIL     */
+     "Missing PAM flag: %s",                     /* 39: FLAGS            */
+     "ka error, code=%d",                        /* 40: KAERROR          */
+     "Passwords are not equal"                   /* 41: NE_PASSWORD      */
  };
  
  static int num_fallbacks = sizeof(fallback_messages)/sizeof(char *);
Index: openafs/src/pam/afs_message.h
diff -c openafs/src/pam/afs_message.h:1.2 openafs/src/pam/afs_message.h:1.2.2.2
*** openafs/src/pam/afs_message.h:1.2	Sat Nov  4 05:05:18 2000
--- openafs/src/pam/afs_message.h	Tue Mar  6 17:24:59 2001
***************
*** 45,51 ****
  #define PAMAFS_PASSEXPFAIL	32 /* "Failed to set PASSWORD_EXPIRES"  */
  #define PAMAFS_CHOWNKRB		33 /* "Failed to chown krb ticketfile"  */
  #define PAMAFS_KRBFAIL		34 /* "Failed to set KRBTKTFILE"        */
! 
  
  char *pam_afs_message(int msgnum, int *freeit);
  void pam_afs_syslog(int priority, int msgid, ...);
--- 45,57 ----
  #define PAMAFS_PASSEXPFAIL	32 /* "Failed to set PASSWORD_EXPIRES"  */
  #define PAMAFS_CHOWNKRB		33 /* "Failed to chown krb ticketfile"  */
  #define PAMAFS_KRBFAIL		34 /* "Failed to set KRBTKTFILE"        */
! #define PAMAFS_TRUSTROOT	35 /* "Ignoring superuser %s"		*/
! #define PAMAFS_NEW_PWD_PROMPT   36 /* "New AFS Password:"               */
! #define PAMAFS_VERIFY_PWD_PROMPT  37 /* "New AFS Password (again):"     */
! #define PAMAFS_KAPASS_FAIL      38 /* "Failed to change AFS password"   */
! #define PAMAFS_FLAGS            39 /* "Missing PAM flag:"               */
! #define PAMAFS_KAERROR          40 /* "ka error, code=%d"               */
! #define PAMAFS_NE_PASSWORD      41 /* "Passwords are not equal"         */  
  
  char *pam_afs_message(int msgnum, int *freeit);
  void pam_afs_syslog(int priority, int msgid, ...);
Index: openafs/src/pam/afs_password.c
diff -c openafs/src/pam/afs_password.c:1.2 openafs/src/pam/afs_password.c:1.2.2.1
*** openafs/src/pam/afs_password.c:1.2	Sat Nov  4 05:05:19 2000
--- openafs/src/pam/afs_password.c	Tue Mar  6 17:24:59 2001
***************
*** 9,15 ****
--- 9,31 ----
  
  #include <security/pam_appl.h>
  #include <security/pam_modules.h>
+ #include <syslog.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <pwd.h>
+ #include <unistd.h>
+ #include <afs/param.h>
+ #include <sys/param.h>
+ #include <afs/kautils.h>
+ #include "afs_message.h"
+ #include "afs_util.h"
+ #include "afs_pam_msg.h"
+ #include <signal.h>
+ #include <sys/wait.h>
+ #include <errno.h>
  
+ #define RET(x) { retcode = (x); goto out; }
+ 
  extern int
  pam_sm_chauthtok(
  	pam_handle_t	*pamh,
***************
*** 17,21 ****
  	int		argc,
  	const char	**argv)
  {
!     return PAM_PERM_DENIED;
  }
--- 33,299 ----
  	int		argc,
  	const char	**argv)
  {
!     int retcode = PAM_SUCCESS;
!     int errcode = PAM_SUCCESS;
!     int code;
!     int origmask;
!     int logmask = LOG_UPTO(LOG_INFO);
!     int nowarn = 0;
!     int use_first_pass = 0;
!     int try_first_pass = 0;
!     int ignore_root = 0;
!     int got_authtok = 0;	/* got PAM_AUTHTOK upon entry */
!     int torch_password = 1;
!     int i;
!     char my_password_buf[256];
!     char instance[256];
!     char realm[256];
!     char cell[256];
!     char *localcell;
!     char *user = NULL, *password = NULL;
!     char *new_password = NULL, *verify_password = NULL;
!     char upwd_buf[2048];	/* size is a guess. */
!     char*	reason = NULL;
!     struct ktc_encryptionKey oldkey, newkey;
!     struct ktc_token token;
!     struct ubik_client *conn = 0;
!     struct pam_conv *pam_convp = NULL;
!     struct passwd unix_pwd, *upwd = NULL;
! 
! #ifndef AFS_SUN56_ENV
!     openlog(pam_afs_ident, LOG_CONS, LOG_AUTH);
! #endif
!     origmask = setlogmask(logmask);
! 
!     /*
!      * Parse the user options.  Log an error for any unknown options.
!      *
!      * Todo options: PAM_SILENT
!      */
!     for (i = 0; i < argc; i++) {
! 	if (	   strcasecmp(argv[i], "debug"	       ) == 0) {
! 	    logmask |= LOG_MASK(LOG_DEBUG);
! 	    (void) setlogmask(logmask);
! 	} else if (strcasecmp(argv[i], "nowarn"	       ) == 0) {
! 	    nowarn = 1;
! 	} else if (strcasecmp(argv[i], "use_first_pass") == 0) {
! 	    use_first_pass = 1;
! 	} else if (strcasecmp(argv[i], "try_first_pass") == 0) {
! 	    try_first_pass = 1;
! 	} else if (strcasecmp(argv[i], "ignore_root"   ) == 0) {
! 	    ignore_root = 1;
! 	} else {
! 	    pam_afs_syslog(LOG_ERR, PAMAFS_UNKNOWNOPT, argv[i]);
! 	}
!     }
! 
!     if (use_first_pass) try_first_pass = 0;
! 
!     pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass, try_first_pass);
!     pam_afs_syslog(LOG_DEBUG, PAMAFS_PAMERROR, flags);
! 
!     /* Try to get the user-interaction info, if available. */
!     errcode = pam_get_item(pamh, PAM_CONV, (const void **) &pam_convp);
!     if (errcode != PAM_SUCCESS) {
! 	pam_afs_syslog(LOG_WARNING, PAMAFS_NO_USER_INT);
! 	pam_convp = NULL;
!     }
! 
!     /* Who are we trying to authenticate here? */
!     if ((errcode = pam_get_user(pamh, (const char **)&user, "AFS username: ")) != PAM_SUCCESS) {
! 	pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode);
! 	RET(PAM_USER_UNKNOWN);
!     }
! 
!     pam_afs_syslog(LOG_DEBUG, PAMAFS_USERNAMEDEBUG, user);
! 
!     /*
!      * If the user has a "local" (or via nss, possibly nss_dce) pwent,
!      * and its uid==0, and "ignore_root" was given in pam.conf,
!      * ignore the user.
!      */
! #if	defined(AFS_HPUX_ENV)
! #if     defined(AFS_HPUX110_ENV)
!     i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf), &upwd);
! #else   /* AFS_HPUX110_ENV */
!     i = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
!     if ( i == 0 )			/* getpwnam_r success */
! 	upwd = &unix_pwd; 
! #endif  /* else AFS_HPUX110_ENV */
!     if (ignore_root && i == 0  && upwd->pw_uid == 0) {
! 	pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
! 	RET(PAM_AUTH_ERR);
!     }
! #else
! #ifdef AFS_LINUX20_ENV
!     upwd = getpwnam(user);
! #else
!     upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
! #endif
!     if (ignore_root && upwd != NULL && upwd->pw_uid == 0) {
! 	pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
! 	RET(PAM_AUTH_ERR);
!     }
! #endif
! 
!     errcode = pam_get_item(pamh, PAM_AUTHTOK, (const void **) &password);
!     if (errcode != PAM_SUCCESS || password == NULL) {
! 	if (use_first_pass) {
! 	    pam_afs_syslog(LOG_ERR, PAMAFS_PASSWD_REQ, user);
! 	    RET(PAM_AUTH_ERR);
! 	}
! 	password = NULL;	/* In case it isn't already NULL */
! 	pam_afs_syslog(LOG_DEBUG, PAMAFS_NOFIRSTPASS, user);
!     } else if (password[0] == '\0') {
! 	/* Actually we *did* get one but it was empty. */
! 	torch_password = 0;
! 	pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user);
! 	RET(PAM_NEW_AUTHTOK_REQD);
!     } else {
! 	pam_afs_syslog(LOG_DEBUG, PAMAFS_GOTPASS, user);
! 	torch_password = 0;
! 	got_authtok = 1;
!     }
!     if (!(use_first_pass || try_first_pass)) {
! 	password = NULL;
!     }
! 
!     if (password == NULL) {
! 	torch_password = 1;
! 	if (use_first_pass)
! 	    RET(PAM_AUTH_ERR);	/* shouldn't happen */
! 	if (try_first_pass)
! 	    try_first_pass = 0;	
! 	if (pam_convp == NULL || pam_convp->conv == NULL) {
! 	    pam_afs_syslog(LOG_ERR, PAMAFS_CANNOT_PROMPT);
! 	    RET(PAM_AUTH_ERR);
! 	}
! 
! 	errcode = pam_afs_prompt(pam_convp, &password, 0, PAMAFS_PWD_PROMPT);
! 	if (errcode != PAM_SUCCESS || password == NULL) {
! 	    pam_afs_syslog(LOG_ERR, PAMAFS_GETPASS_FAILED);
! 	    RET(PAM_AUTH_ERR);
! 	}
! 	if (password[0] == '\0') {
! 	    pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user);
! 	    RET(PAM_NEW_AUTHTOK_REQD);
! 	}
! 
! 	/*
!          * We aren't going to free the password later (we will wipe it,
!          * though), because the storage for it if we get it from other
!          * paths may belong to someone else.  Since we do need to free
!          * this storage, copy it to a buffer that won't need to be freed
!          * later, and free this storage now.
!          */
!         strncpy(my_password_buf, password, sizeof(my_password_buf));
!         my_password_buf[sizeof(my_password_buf)-1] = '\0';
!         memset(password, 0, strlen(password));
!         free(password);
!         password = my_password_buf;
!     }
! 
!     if ( (code = ka_VerifyUserPassword(KA_USERAUTH_VERSION + KA_USERAUTH_DOSETPAG,
! 				    user, /* kerberos name */
! 				    (char *)0, /* instance */
! 				    (char *)0, /* realm */
! 				    password, /* password */
! 				    0, /* spare 2 */
! 				    &reason /* error string */ )) !=0 ) {
! 	pam_afs_syslog(LOG_ERR, PAMAFS_LOGIN_FAILED, user, reason);
!         RET(PAM_AUTH_ERR);
!     }
!     torch_password = 0;
!     pam_set_item(pamh, PAM_AUTHTOK, password);
!     pam_set_item(pamh, PAM_OLDAUTHTOK, password);
!     if (flags & PAM_PRELIM_CHECK) {
!        /* only auth check was requested, so return success here */
!        return(PAM_SUCCESS);
!     }
!     if (!(flags & PAM_UPDATE_AUTHTOK)) {
!        /* these lines are never executed ... */
!        /* UPDATE_AUTHTOK flag is required, return with error */
!        pam_afs_syslog(LOG_ERR, PAMAFS_FLAGS, "PAM_UPDATE_AUTHTOK");
!        RET(PAM_AUTH_ERR);
!     }
! 
!     /* get the new passwd and verify it */
!     errcode = pam_afs_prompt(pam_convp, &new_password, 0, PAMAFS_NEW_PWD_PROMPT);
!     if (errcode != PAM_SUCCESS || new_password == NULL) {
!         pam_afs_syslog(LOG_ERR, PAMAFS_GETPASS_FAILED);
!         RET(PAM_AUTH_ERR);
!     }
!     if (new_password[0] == '\0') {
!         pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user);
!         RET(PAM_AUTH_ERR);
!     }
!     errcode = pam_afs_prompt(pam_convp, &verify_password, 0, PAMAFS_VERIFY_PWD_PROMPT);
!     if (errcode != PAM_SUCCESS || verify_password == NULL) {
!         pam_afs_syslog(LOG_ERR, PAMAFS_GETPASS_FAILED);
! 	memset(new_password, 0, strlen(new_password));
!         RET(PAM_AUTH_ERR);
!     }
!     if (verify_password[0] == '\0') {
!         pam_afs_syslog(LOG_INFO, PAMAFS_NILPASSWORD, user);
! 	memset(new_password, 0, strlen(new_password));
!         RET(PAM_AUTH_ERR);
!     }
!     if (strcmp(new_password, verify_password) != 0) {
!         pam_afs_syslog(LOG_INFO, PAMAFS_NE_PASSWORD);
! 	memset(new_password, 0, strlen(new_password));
! 	memset(verify_password, 0, strlen(verify_password));
!         RET(PAM_AUTH_ERR);
!     }
!     memset(verify_password, 0, strlen(verify_password));
!     /* checking password length and quality is up to other PAM modules */ 
! 
!     /* set the new password */
!     if ((code = ka_Init(0)) != 0) {
!         pam_afs_syslog(LOG_ERR, PAMAFS_KAERROR, code);
!         RET(PAM_AUTH_ERR);
!     }
!     if ((code = rx_Init(0)) != 0) {
!         pam_afs_syslog(LOG_ERR, PAMAFS_KAERROR, code);
!         RET(PAM_AUTH_ERR);
!     }
!     strcpy(instance,"");
!     if ((localcell = ka_LocalCell()) == NULL) {
!         pam_afs_syslog(LOG_ERR, PAMAFS_NOCELLNAME);
!         RET(PAM_AUTH_ERR);
!     }
!     strcpy(realm,localcell);
!     strcpy(cell,realm);
!     /* oldkey is not used in ka_ChangePassword (only for ka_auth) */
!     ka_StringToKey(password, realm, &oldkey);
!     ka_StringToKey(new_password, realm, &newkey);
!     if ((code = ka_GetAdminToken(user, instance, realm, &oldkey, 20, &token, 0)) != 0) {
!         pam_afs_syslog(LOG_ERR, PAMAFS_KAERROR, code);
!         RET(PAM_AUTH_ERR);
!     }
!     if ((code = ka_AuthServerConn(realm, KA_MAINTENANCE_SERVICE, &token, &conn)) != 0) { 
!         pam_afs_syslog(LOG_ERR, PAMAFS_KAERROR, code);
!         RET(PAM_AUTH_ERR);
!     }
!     if ((code = ka_ChangePassword(user,     /* kerberos name */
! 	   	                  instance, /* instance */
! 			          conn,     /* conn */
! 			          0,        /* old password unused */
! 			          &newkey   /* new password */ )) != 0) {
! 	pam_afs_syslog(LOG_ERR, PAMAFS_KAPASS_FAIL);
!         memset(new_password, 0, strlen(new_password));
!         RET(PAM_AUTH_ERR);
!     } else {
!         pam_set_item(pamh, PAM_AUTHTOK, new_password);
!         RET(PAM_SUCCESS);
!     }
! 	
!  out:
!     if (password && torch_password) {
!         memset(password, 0, strlen(password));
!     }
!     (void) setlogmask(origmask);
! #ifndef AFS_SUN56_ENV
!     closelog();
! #endif
!     return retcode;
  }
Index: openafs/src/pam/afs_setcred.c
diff -c openafs/src/pam/afs_setcred.c:1.2 openafs/src/pam/afs_setcred.c:1.2.2.1
*** openafs/src/pam/afs_setcred.c:1.2	Sat Nov  4 05:05:19 2000
--- openafs/src/pam/afs_setcred.c	Tue Mar  6 16:32:43 2001
***************
*** 44,49 ****
--- 44,50 ----
      int try_first_pass = 0;
      int got_authtok = 0;
      int ignore_root = 0;
+     int trust_root = 0;
      int set_expires = 0; /* the default is to not to set the env variable */
      int i;
      struct pam_conv *pam_convp = NULL;
***************
*** 79,84 ****
--- 80,89 ----
  	    try_first_pass = 1;
          } else if (strcasecmp(argv[i], "ignore_root"   ) == 0) {
              ignore_root = 1;
+         } else if (strcasecmp(argv[i], "trust_root"   ) == 0) {
+             trust_root = 1;
+         } else if (strcasecmp(argv[i], "catch_su"   ) == 0) {
+             use_first_pass = 0;
  	} else if (strcasecmp(argv[i], "setenv_password_expires")==0) {
  	    set_expires = 1;
  	} else {
***************
*** 124,132 ****
  #else
      upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
  #endif
!     if (ignore_root && upwd != NULL && upwd->pw_uid == 0) {
!         pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
!         RET(PAM_AUTH_ERR);
      }
  #endif
  
--- 129,142 ----
  #else
      upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
  #endif
!     if (upwd != NULL && upwd->pw_uid == 0) {
! 	if (ignore_root) { 
! 		pam_afs_syslog(LOG_INFO, PAMAFS_IGNORINGROOT, user);
! 		RET(PAM_AUTH_ERR);
! 	} else if (trust_root) {
! 		pam_afs_syslog(LOG_INFO, PAMAFS_TRUSTROOT, user);
! 		RET(PAM_SUCCESS);
! 	}
      }
  #endif
  
Index: openafs/src/ptserver/ptserver.c
diff -c openafs/src/ptserver/ptserver.c:1.2 openafs/src/ptserver/ptserver.c:1.2.2.1
*** openafs/src/ptserver/ptserver.c:1.2	Sat Nov  4 05:05:25 2000
--- openafs/src/ptserver/ptserver.c	Tue Mar  6 16:49:45 2001
***************
*** 64,70 ****
    char **argv;
  {
      register afs_int32 code;
-     afs_int32 serverList[MAXSERVERS];
      afs_int32 myHost;
      register struct hostent *th;
      char hostname[64];
--- 64,69 ----
***************
*** 81,86 ****
--- 80,86 ----
      int kerberosKeys;			/* set if found some keys */
      afs_int32 i,j;
      int lwps = 3;
+     char clones[MAXHOSTSPERCELL];
  
      const char *pr_dbaseName;
      char *whoami = "ptserver";
***************
*** 189,195 ****
      bcopy(th->h_addr,&myHost,sizeof(afs_int32));
          
      /* get list of servers */
!     code = afsconf_GetCellInfo(prdir,(char *)0,"afsprot",&info);
      if (code) {
  	com_err (whoami, code, "Couldn't get server list");
  	PT_EXIT(2);
--- 189,196 ----
      bcopy(th->h_addr,&myHost,sizeof(afs_int32));
          
      /* get list of servers */
!     code = afsconf_GetExtendedCellInfo(prdir,(char *)0,"afsprot",
!                        &info, &clones);
      if (code) {
  	com_err (whoami, code, "Couldn't get server list");
  	PT_EXIT(2);
***************
*** 197,207 ****
      pr_realmName = info.name;
      pr_realmNameLen = strlen (pr_realmName);
  
-     for (i=0,j=0;i<info.numServers;i++)
- 	if (info.hostAddr[i].sin_addr.s_addr != myHost) /* ubik already tacks myHost onto list */
- 	    serverList[j++] = info.hostAddr[i].sin_addr.s_addr;
-     serverList[j] = 0;
- 
  #if 0
      /* get keys */
      code = afsconf_GetKey(prdir,999,&tkey);
--- 198,203 ----
***************
*** 234,241 ****
       * and the header are in separate Ubik buffers then 120 buffers may be
       * required. */
      ubik_nBuffers = 120 + /*fudge*/40;
!     code = ubik_ServerInit(myHost, htons(AFSCONF_PROTPORT), serverList,
! 			   pr_dbaseName, &dbase);
      if (code) {
  	com_err (whoami, code, "Ubik init failed");
  	PT_EXIT(2);
--- 230,237 ----
       * and the header are in separate Ubik buffers then 120 buffers may be
       * required. */
      ubik_nBuffers = 120 + /*fudge*/40;
!     code = ubik_ServerInitByInfo(myHost, htons(AFSCONF_PROTPORT), &info,
!                            &clones, pr_dbaseName, &dbase);
      if (code) {
  	com_err (whoami, code, "Ubik init failed");
  	PT_EXIT(2);
Index: openafs/src/rx/Makefile
diff -c openafs/src/rx/Makefile:1.4 openafs/src/rx/Makefile:1.4.2.2
*** openafs/src/rx/Makefile:1.4	Sun Nov  5 22:36:43 2000
--- openafs/src/rx/Makefile	Tue Mar  6 16:38:51 2001
***************
*** 24,30 ****
  XDROBJS = xdr_arrayn.o xdr_rx.o xdr_afsuuid.o
  
  RXOBJS = rx_clock.o rx_event.o rx_user.o rx_lwp.o rx.o rx_null.o rx_globals.o \
! 	rx_getaddr.o rx_misc.o rx_packet.o rx_rdwr.o  rx_trace.o rx_conncache.o
  
  MULTIOBJS = rx_multi.o
  
--- 24,31 ----
  XDROBJS = xdr_arrayn.o xdr_rx.o xdr_afsuuid.o
  
  RXOBJS = rx_clock.o rx_event.o rx_user.o rx_lwp.o rx.o rx_null.o rx_globals.o \
! 	rx_getaddr.o rx_misc.o rx_packet.o rx_rdwr.o  rx_trace.o rx_conncache.o \
! 	xdr_int64.o
  
  MULTIOBJS = rx_multi.o
  
***************
*** 43,49 ****
  	rx_null.c rx_null.h rx_queue.h rx_getaddr.c rx_packet.c rx_packet.h \
  	rx_multi.h rx_kcommon.h rx_kcommon.c \
  	xdr.c xdr.h xdr_array.c xdr_arrayn.c xdr_rx.c rx_misc.c rx_rdwr.c \
! 	xdr_afsuuid.c rx_trace.h
  UKSRCS = $(KSRCS) rx_conncache.c
  
  include ../config/Makefile.version
--- 44,50 ----
  	rx_null.c rx_null.h rx_queue.h rx_getaddr.c rx_packet.c rx_packet.h \
  	rx_multi.h rx_kcommon.h rx_kcommon.c \
  	xdr.c xdr.h xdr_array.c xdr_arrayn.c xdr_rx.c rx_misc.c rx_rdwr.c \
! 	xdr_afsuuid.c rx_trace.h xdr_int64.c
  UKSRCS = $(KSRCS) rx_conncache.c
  
  include ../config/Makefile.version
***************
*** 119,126 ****
  kinstall: includes
  	set $(KERNELDIR)rx; $(MKDIR_IF_NEEDED)
  	$(INSTALL) $(KSRCS) $(KERNELDIR)rx
! 	@case ${SYS_NAME} in \
! 	alpha_dux4* ) \
  		$(INSTALL) DUX/*.[ch] $(KERNELDIR)rx;; \
  	hp_ux* ) \
  		$(INSTALL) HPUX/*.[ch] $(KERNELDIR)rx;; \
--- 120,127 ----
  kinstall: includes
  	set $(KERNELDIR)rx; $(MKDIR_IF_NEEDED)
  	$(INSTALL) $(KSRCS) $(KERNELDIR)rx
! 	case ${SYS_NAME} in \
! 	alpha_dux* ) \
  		$(INSTALL) DUX/*.[ch] $(KERNELDIR)rx;; \
  	hp_ux* ) \
  		$(INSTALL) HPUX/*.[ch] $(KERNELDIR)rx;; \
***************
*** 139,145 ****
  ukinstall webinstall: includes
  	set $(UKERNELDIR)rx; $(MKDIR_IF_NEEDED)
  	$(INSTALL) $(UKSRCS) $(UKERNELDIR)rx
! 	$(INSTALL) UKERNEL/*.[ch] $(UKERNELDIR)rx
  
  clean:
  	rm -f *.o *.a core *_component_version_number.c
--- 140,146 ----
  ukinstall webinstall: includes
  	set $(UKERNELDIR)rx; $(MKDIR_IF_NEEDED)
  	$(INSTALL) $(UKSRCS) $(UKERNELDIR)rx
! 	-$(INSTALL) UKERNEL/*.[ch] $(UKERNELDIR)rx
  
  clean:
  	rm -f *.o *.a core *_component_version_number.c
Index: openafs/src/rx/NTMakefile
diff -c openafs/src/rx/NTMakefile:1.2 openafs/src/rx/NTMakefile:1.2.2.1
*** openafs/src/rx/NTMakefile:1.2	Sat Nov  4 05:05:28 2000
--- openafs/src/rx/NTMakefile	Tue Mar  6 16:58:12 2001
***************
*** 20,26 ****
  
  # Object files by category.
  XDROBJS = xdr.obj xdr_array.obj xdr_arrayn.obj xdr_float.obj xdr_mem.obj \
! 	xdr_rec.obj  xdr_refernce.obj xdr_rx.obj xdr_update.obj xdr_afsuuid.obj
  
  RXOBJS = rx_clock_nt.obj rx_event.obj rx_user.obj rx_lwp.obj rx.obj \
  	rx_null.obj rx_globals.obj rx_getaddr.obj rx_misc.obj rx_packet.obj \
--- 20,27 ----
  
  # Object files by category.
  XDROBJS = xdr.obj xdr_array.obj xdr_arrayn.obj xdr_float.obj xdr_mem.obj \
! 	xdr_rec.obj  xdr_refernce.obj xdr_rx.obj xdr_update.obj \
! 	xdr_afsuuid.obj xdr_int64.obj
  
  RXOBJS = rx_clock_nt.obj rx_event.obj rx_user.obj rx_lwp.obj rx.obj \
  	rx_null.obj rx_globals.obj rx_getaddr.obj rx_misc.obj rx_packet.obj \
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.2.2.2 openafs/src/rx/rx.c:1.2.2.4
*** openafs/src/rx/rx.c:1.2.2.2	Fri Jan 19 04:37:54 2001
--- openafs/src/rx/rx.c	Tue Mar  6 16:58:46 2001
***************
*** 91,96 ****
--- 91,100 ----
  # include <afs/rxgen_consts.h>
  #endif /* KERNEL */
  
+ #ifdef RXDEBUG
+ extern afs_uint32 LWP_ThreadId();
+ #endif /* RXDEBUG */
+ 
  #ifdef	AFS_GLOBAL_RXLOCK_KERNEL
  struct rx_tq_debug {
      afs_int32 rxi_start_aborted; /* rxi_start awoke after rxi_Send in error. */
***************
*** 455,461 ****
  #else
  	struct sockaddr_in addr;
  	int addrlen = sizeof(addr);
! 	if (getsockname(rx_socket, (struct sockaddr *) &addr, &addrlen)) {
  	    rx_Finalize();
  	    return -1;
  	}
--- 459,465 ----
  #else
  	struct sockaddr_in addr;
  	int addrlen = sizeof(addr);
! 	if (getsockname((int)rx_socket, (struct sockaddr *) &addr, &addrlen)) {
  	    rx_Finalize();
  	    return -1;
  	}
***************
*** 6256,6267 ****
--- 6260,6302 ----
  {
      struct rx_serverQueueEntry *np;
      register int i, j;
+     register struct rx_call *call;
+     register struct rx_serverQueueEntry *sq;
  
      LOCK_RX_INIT
      if (rxinit_status == 1) {
  	UNLOCK_RX_INIT
  	return; /* Already shutdown. */
      }
+ 
+ #ifndef KERNEL
+     rx_port = 0;
+ #ifndef AFS_PTHREAD_ENV
+     FD_ZERO(&rx_selectMask);
+ #endif /* AFS_PTHREAD_ENV */
+     rxi_dataQuota = RX_MAX_QUOTA;
+ #ifndef AFS_PTHREAD_ENV
+     rxi_StopListener();
+ #endif /* AFS_PTHREAD_ENV */
+     shutdown_rxevent();
+     rx_SetEpoch(0);
+ #ifndef AFS_PTHREAD_ENV
+ #ifndef AFS_USE_GETTIMEOFDAY
+     clock_UnInit();
+ #endif /* AFS_USE_GETTIMEOFDAY */
+ #endif /* AFS_PTHREAD_ENV */
+ 
+     while (!queue_IsEmpty(&rx_freeCallQueue)) {
+         call = queue_First(&rx_freeCallQueue, rx_call);
+         queue_Remove(call);
+         rxi_Free(call, sizeof(struct rx_call));
+     }
+ 
+     while (!queue_IsEmpty(&rx_idleServerQueue)) {
+         sq = queue_First(&rx_idleServerQueue, rx_serverQueueEntry);
+         queue_Remove(sq);                                                    
+     }
+ #endif /* KERNEL */
  
      {	
  	struct rx_peer **peer_ptr, **peer_end;
Index: openafs/src/rx/rx_clock.c
diff -c openafs/src/rx/rx_clock.c:1.2 openafs/src/rx/rx_clock.c:1.2.2.1
*** openafs/src/rx/rx_clock.c:1.2	Sat Nov  4 05:05:30 2000
--- openafs/src/rx/rx_clock.c	Tue Mar  6 16:58:50 2001
***************
*** 46,58 ****
  int clock_haveCurrentTime;
  
  int clock_nUpdates;		/* The actual number of clock updates */
  
  /* Initialize the clock */
  void clock_Init(void) {
-     static initialized = 0;
      struct itimerval itimer, otimer;
  
!     if (!initialized) {
  	itimer.it_value.tv_sec = STARTVALUE;
  	itimer.it_value.tv_usec = 0;
  	itimer.it_interval.tv_sec = 0;
--- 46,58 ----
  int clock_haveCurrentTime;
  
  int clock_nUpdates;		/* The actual number of clock updates */
+ static int clockInitialized = 0;
  
  /* Initialize the clock */
  void clock_Init(void) {
      struct itimerval itimer, otimer;
  
!     if (!clockInitialized) {
  	itimer.it_value.tv_sec = STARTVALUE;
  	itimer.it_value.tv_usec = 0;
  	itimer.it_interval.tv_sec = 0;
***************
*** 64,74 ****
  	    fflush (stderr);
  	    exit(1);
  	}
! 	initialized = 1;
      }
  
      clock_UpdateTime();
  }
  
  /* Compute the current time.  The timer gets the current total elapsed time since startup, expressed in seconds and microseconds.  This call is almost 200 usec on an APC RT */
  void clock_UpdateTime()
--- 64,82 ----
  	    fflush (stderr);
  	    exit(1);
  	}
! 	clockInitialized = 1;
      }
  
      clock_UpdateTime();
  }
+ 
+ #ifndef KERNEL
+ /* Make clock uninitialized. */
+ clock_UnInit()
+ {
+     clockInitialized = 0;
+ } 
+ #endif 
  
  /* Compute the current time.  The timer gets the current total elapsed time since startup, expressed in seconds and microseconds.  This call is almost 200 usec on an APC RT */
  void clock_UpdateTime()
Index: openafs/src/rx/rx_clock_nt.c
diff -c openafs/src/rx/rx_clock_nt.c:1.2 openafs/src/rx/rx_clock_nt.c:1.2.2.1
*** openafs/src/rx/rx_clock_nt.c:1.2	Sat Nov  4 05:05:30 2000
--- openafs/src/rx/rx_clock_nt.c	Tue Mar  6 16:58:51 2001
***************
*** 27,32 ****
--- 27,33 ----
  int clock_haveCurrentTime;
  
  int clock_nUpdates;		/* The actual number of clock updates */
+ static int clockInitialized = 0;
  
  /* Timing tests show that we can compute times at about 4uS per call. */
  LARGE_INTEGER rxi_clock0;
***************
*** 38,47 ****
--- 39,57 ----
  	exit(1);
      }
  
+     clockInitialized = 1;
      (void) QueryPerformanceCounter(&rxi_clock0);
  
      clock_UpdateTime();
  }
+ 
+ #ifndef KERNEL
+ /* Make clock uninitialized. */
+ clock_UnInit()
+ {
+     clockInitialized = 0;
+ }
+ #endif
  
  void clock_UpdateTime(void)
  {
Index: openafs/src/rx/rx_kernel.h
diff -c openafs/src/rx/rx_kernel.h:1.2 openafs/src/rx/rx_kernel.h:1.2.2.1
*** openafs/src/rx/rx_kernel.h:1.2	Sat Nov  4 05:05:32 2000
--- openafs/src/rx/rx_kernel.h	Tue Mar  6 17:00:05 2001
***************
*** 22,28 ****
  #define rxi_ReScheduleEvents    0 /* Not needed by kernel */
  
  /* This is a no-op, because the kernel server procs are pre-allocated */
! #define rxi_StartServerProcs(x)
  
  /* Socket stuff */
  typedef struct socket *osi_socket;
--- 22,28 ----
  #define rxi_ReScheduleEvents    0 /* Not needed by kernel */
  
  /* This is a no-op, because the kernel server procs are pre-allocated */
! #define rxi_StartServerProcs(x) 0
  
  /* Socket stuff */
  typedef struct socket *osi_socket;
Index: openafs/src/rx/rx_lwp.c
diff -c openafs/src/rx/rx_lwp.c:1.2.2.1 openafs/src/rx/rx_lwp.c:1.2.2.2
*** openafs/src/rx/rx_lwp.c:1.2.2.1	Wed Dec 13 16:50:10 2000
--- openafs/src/rx/rx_lwp.c	Tue Mar  6 17:00:46 2001
***************
*** 34,39 ****
--- 34,40 ----
  # include "rx_globals.h"
  # include <lwp.h>
  
+ #define MAXTHREADNAMELENGTH 64
  
  int debugSelectFailure;	/* # of times select failed */
  /*
***************
*** 64,69 ****
--- 65,80 ----
      IOMGR_Sleep(sec);
  }
  
+ static int quitListening = 0;
+ 
+ /* This routine will kill the listener thread, if it exists. */
+ void
+ rxi_StopListener()
+ {
+     quitListening = 1;
+     rxi_ReScheduleEvents();
+ }
+ 
  /* This routine will get called by the event package whenever a new,
     earlier than others, event is posted.  If the Listener process
     is blocked in selects, this will unblock it.  It also can be called
***************
*** 128,137 ****
--- 139,157 ----
      int lastPollWorked, doingPoll;	/* true iff last poll was useful */
      struct timeval tv, *tvp;
      int i, code;
+     PROCESS pid;
+     char name[MAXTHREADNAMELENGTH] = "srv_0";
  
      clock_NewTime();
      lastPollWorked = 0;
      nextPollTime = 0;
+     code = LWP_CurrentProcess(&pid);
+     if (code) {
+         fprintf(stderr, "rxi_Listener: Can't get my pid.\n");
+         exit(1);
+     }
+     rx_listenerPid = pid;
+     swapthreadname(pid, "listener", &name);
  
      for (;;) {
  	/* Grab a new packet only if necessary (otherwise re-use the old one) */
***************
*** 174,179 ****
--- 194,204 ----
  	    code = IOMGR_Select(rx_maxSocketNumber+1, rfds, 0, 0, tvp);
  	}
  	lastPollWorked = 0;	/* default is that it didn't find anything */
+ 
+ 	if (quitListening) {
+ 	    quitListening = 0;
+ 	    LWP_DestroyProcess(pid);
+ 	}
  
  	switch(code) {
  	    case 0: 
Index: openafs/src/rx/rx_rdwr.c
diff -c openafs/src/rx/rx_rdwr.c:1.2 openafs/src/rx/rx_rdwr.c:1.2.2.1
*** openafs/src/rx/rx_rdwr.c:1.2	Sat Nov  4 05:05:34 2000
--- openafs/src/rx/rx_rdwr.c	Tue Mar  6 17:01:32 2001
***************
*** 1059,1064 ****
--- 1059,1096 ----
      return bytes;
  }
  
+ int rx_WritevInit(call)
+     struct rx_call *call;
+ {
+     int bytes;
+     SPLVAR;
+ 
+     /*
+      * Free any packets from the last call to ReadvProc/WritevProc.
+      * We do not need the lock because the receiver threads only
+      * touch the iovq when the RX_CALL_IOVEC_WAIT flag is set, and the
+      * RX_CALL_IOVEC_WAIT is always cleared before returning from
+      * ReadvProc/WritevProc.
+      */
+     if (!queue_IsEmpty(&call->iovq)) {
+         register struct rx_packet *rp;
+         register struct rx_packet *nxp;
+         for (queue_Scan(&call->iovq, rp, nxp, rx_packet)) {
+             queue_Remove(rp);
+             rxi_FreePacket(rp);
+         }
+     }
+ 
+     NETPRI;
+     AFS_RXGLOCK();
+     MUTEX_ENTER(&call->lock);
+     bytes = rxi_WriteProc(call, &bytes, 0);
+     MUTEX_EXIT(&call->lock);
+     AFS_RXGUNLOCK();
+     USERPRI;
+     return bytes;
+ }
+ 
  /* rxi_WritevProc -- internal version.
   *
   * Send buffers allocated in rxi_WritevAlloc.
Index: openafs/src/rx/xdr.h
diff -c openafs/src/rx/xdr.h:1.1 openafs/src/rx/xdr.h:1.1.6.1
*** openafs/src/rx/xdr.h:1.1	Fri Nov  3 21:29:03 2000
--- openafs/src/rx/xdr.h	Tue Mar  6 16:38:51 2001
***************
*** 304,309 ****
--- 304,311 ----
  extern bool_t	xdr_reference();
  extern bool_t	xdr_wrapstring();
  extern bool_t	xdr_vector();
+ extern bool_t   xdr_int64();
+ extern bool_t   xdr_uint64();
  
  /*
   * These are the public routines for the various implementations of
Index: openafs/src/rx/xdr_int64.c
diff -c /dev/null openafs/src/rx/xdr_int64.c:1.1.2.1
*** /dev/null	Wed Mar  7 15:26:30 2001
--- openafs/src/rx/xdr_int64.c	Tue Mar  6 16:38:52 2001
***************
*** 0 ****
--- 1,131 ----
+ 
+ /*
+  *  XDR routine for int64 (long long or struct)
+  */
+ 
+ #if defined(KERNEL) && !defined(UKERNEL)
+ #include "afs/param.h"
+ #ifdef AFS_LINUX20_ENV
+ #include "../h/string.h"
+ #define bzero(A,C) memset((A), 0, (C))
+ #else
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #endif
+ #else
+ #include <stdio.h>
+ #endif
+ #include "xdr.h"
+ #if defined(KERNEL) && !defined(UKERNEL)
+ #ifdef        AFS_DEC_ENV
+ #include <afs/longc_procs.h>
+ #endif
+ #endif
+ 
+ #ifndef lint
+ static char sccsid[] = "@(#)xdr_array.c 1.1 86/02/03 Copyr 1984 Sun Micro";
+ #endif
+ 
+ #ifdef AFS_64BIT_ENV
+ /*
+  * XDR afs_int64 integers
+  */
+ bool_t
+ xdr_int64(xdrs, ulp)
+         register XDR *xdrs;
+         afs_int64 *ulp;
+ {
+         static afs_int32 high;
+         static afs_uint32 low;
+ 
+         if (xdrs->x_op == XDR_DECODE) {
+                 if (!XDR_GETINT32(xdrs, (afs_int32 *) &high)) return (FALSE);
+                 if (!XDR_GETINT32(xdrs, (afs_int32 *) &low)) return (FALSE);
+                 *ulp = high;
+                 *ulp <<= 32;
+                 *ulp += low;
+                 return (TRUE);
+         }
+         if (xdrs->x_op == XDR_ENCODE) {
+                 high = (*ulp >> 32);
+                 low = *ulp & 0xFFFFFFFFL;
+                 if (!XDR_PUTINT32(xdrs, (afs_int32 *) &high)) return (FALSE);
+                 return (XDR_PUTINT32(xdrs, (afs_int32 *) &low));
+         }
+         if (xdrs->x_op == XDR_FREE)
+                 return (TRUE);
+         return (FALSE);
+ }
+ 
+ /*
+  * XDR afs_int64 integers
+  */
+ bool_t
+ xdr_uint64(xdrs, ulp)
+         register XDR *xdrs;
+         afs_uint64 *ulp;
+ {
+         static afs_uint32 high;
+         static afs_uint32 low;
+ 
+         if (xdrs->x_op == XDR_DECODE) {
+                 if (!XDR_GETINT32(xdrs, (afs_uint32 *) &high)) return (FALSE);
+                 if (!XDR_GETINT32(xdrs, (afs_uint32 *) &low)) return (FALSE);
+                 *ulp = high;
+                 *ulp <<= 32;
+                 *ulp += low;
+                 return (TRUE);
+         }
+         if (xdrs->x_op == XDR_ENCODE) {
+                 high = (*ulp >> 32);
+                 low = *ulp & 0xFFFFFFFFL;
+                 if (!XDR_PUTINT32(xdrs, (afs_uint32 *) &high)) return (FALSE);
+                 return (XDR_PUTINT32(xdrs, (afs_uint32 *) &low));
+         }
+         if (xdrs->x_op == XDR_FREE)
+                 return (TRUE);
+         return (FALSE);
+ }
+ #else /* AFS_64BIT_ENV */
+ /*
+  * XDR afs_int64 integers
+  */
+ bool_t
+ xdr_int64(xdrs, ulp)
+         register XDR *xdrs;
+         afs_int64 *ulp;
+ {
+         if (xdrs->x_op == XDR_DECODE) {
+                 if (!XDR_GETINT32(xdrs, (afs_int32 *) &ulp->high)) return (FALSE);
+                 return (XDR_GETINT32(xdrs, (afs_int32 *) &ulp->low));
+         }
+         if (xdrs->x_op == XDR_ENCODE) {
+                 if (!XDR_PUTINT32(xdrs, (afs_int32 *) &ulp->high)) return (FALSE);
+                 return (XDR_PUTINT32(xdrs, (afs_int32 *) &ulp->low));
+         }
+         if (xdrs->x_op == XDR_FREE)
+                 return (TRUE);
+         return (FALSE);
+ }
+ 
+ /*
+  * XDR afs_uint64 integers
+  */
+ bool_t
+ xdr_uint64(xdrs, ulp)
+         register XDR *xdrs;
+         afs_uint64 *ulp;
+ {
+         if (xdrs->x_op == XDR_DECODE) {
+                 if (!XDR_GETINT32(xdrs, (afs_uint32 *) &ulp->high)) return (FALSE);
+                 return (XDR_GETINT32(xdrs, (afs_uint32 *) &ulp->low));
+         }
+         if (xdrs->x_op == XDR_ENCODE) {
+                 if (!XDR_PUTINT32(xdrs, (afs_uint32 *) &ulp->high)) return (FALSE);
+                 return (XDR_PUTINT32(xdrs, (afs_uint32 *) &ulp->low));
+         }
+         if (xdrs->x_op == XDR_FREE)
+                 return (TRUE);
+         return (FALSE);
+ }
+ #endif /* AFS_64BIT_ENV */
Index: openafs/src/rxgen/rpc_main.c
diff -c openafs/src/rxgen/rpc_main.c:1.1 openafs/src/rxgen/rpc_main.c:1.1.6.1
*** openafs/src/rxgen/rpc_main.c:1.1	Fri Nov  3 21:29:21 2000
--- openafs/src/rxgen/rpc_main.c	Tue Mar  6 16:38:55 2001
***************
*** 251,256 ****
--- 251,262 ----
  	f_print(fout, "#ifndef xdr_afs_uint32\n");
  	f_print(fout, "#define xdr_afs_uint32 xdr_u_int\n");
  	f_print(fout, "#endif\n");
+         f_print(fout, "#ifndef xdr_afs_int64\n");
+         f_print(fout, "#define xdr_afs_int64 xdr_int64\n");
+         f_print(fout, "#endif\n");
+         f_print(fout, "#ifndef xdr_afs_uint64\n");
+         f_print(fout, "#define xdr_afs_uint64 xdr_uint64\n");
+         f_print(fout, "#endif\n");
  #else
  #error Need to do some work here...
  #endif
***************
*** 560,565 ****
--- 566,573 ----
  	f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
  	f_print(fout, "#include \"../rx/xdr.h\"\n");
  	f_print(fout, "#else /* AFS_LINUX22_ENV */\n");
+ 	f_print(fout, "extern bool_t xdr_int64();\n");
+ 	f_print(fout, "extern bool_t xdr_uint64();\n");
  	f_print(fout, "#include \"../rpc/xdr.h\"\n");
  	f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
  	f_print(fout, "#endif /* XDR_GETLONG */\n");
Index: openafs/src/sys/afssyscalls.h
diff -c openafs/src/sys/afssyscalls.h:1.2 openafs/src/sys/afssyscalls.h:1.2.2.1
*** openafs/src/sys/afssyscalls.h:1.2	Sat Nov  4 05:05:48 2000
--- openafs/src/sys/afssyscalls.h	Tue Mar  6 17:22:42 2001
***************
*** 22,28 ****
--- 22,36 ----
  #else
  #ifdef AFS_NAMEI_ENV
  #include <sys/types.h>
+ #ifdef AFS_NEC_SX92_ENV
+ typedef unsigned long Inode;
+ #else /* AFS_NEC_SX92_ENV */
+ #ifdef AFS_64BIT_ENV
+ typedef afs_uint64 Inode;
+ #else
  typedef u_int64_t Inode;
+ #endif
+ #endif /* AFS_NEC_SX92_ENV */
  #else
  error Need 64 bit Inode defined.
  #endif /* AFS_NAMEI_ENV */
Index: openafs/src/tviced/Makefile
diff -c openafs/src/tviced/Makefile:1.2 openafs/src/tviced/Makefile:1.2.2.2
*** openafs/src/tviced/Makefile:1.2	Sat Nov  4 05:05:51 2000
--- openafs/src/tviced/Makefile	Tue Mar  6 17:02:52 2001
***************
*** 28,34 ****
  
  VLSERVEROBJS=vldbint.cs.o vldbint.xdr.o
  
! LWPOBJS=lock.o fasttime.o
  
  LIBACLOBJS=aclprocs.o netprocs.o
  
--- 28,34 ----
  
  VLSERVEROBJS=vldbint.cs.o vldbint.xdr.o
  
! LWPOBJS=lock.o fasttime.o threadname.o
  
  LIBACLOBJS=aclprocs.o netprocs.o
  
***************
*** 101,106 ****
--- 101,109 ----
  fasttime.o: ${LWP}/fasttime.c
  	${CRULE1};
  
+ threadname.o: ${LWP}/threadname.c
+ 	${CRULE1};
+ 
  aclprocs.o: ${LIBACL}/aclprocs.c
  	${CRULE1}
  
***************
*** 184,192 ****
  	*linux*) \
  	    ${CC} ${LDFLAGS} -o fileserver ${objects} ${LIBS} \
  	    ${MTLIBS} ${XLIBS} ;; \
- 	sgi_6*) \
- 	    ${CC} ${LDFLAGS} -o fileserver ${objects} ${LIBS} \
- 	    ${MTLIBS} ${XLIBS} ../sgiefs/libefs.a ;; \
  	*) \
  	    ${CC} ${LDFLAGS} -o fileserver ${objects} ${LIBS} \
  	    ${MTLIBS} ${XLIBS} ;; \
--- 187,192 ----
Index: openafs/src/tviced/NTMakefile
diff -c openafs/src/tviced/NTMakefile:1.2 openafs/src/tviced/NTMakefile:1.2.2.1
*** openafs/src/tviced/NTMakefile:1.2	Sat Nov  4 05:05:52 2000
--- openafs/src/tviced/NTMakefile	Tue Mar  6 17:03:14 2001
***************
*** 32,38 ****
  
  VLSERVEROBJS = vldbint.cs.obj vldbint.xdr.obj
  
! LWPOBJS = lock.obj fasttime.obj
  
  LIBACLOBJS = aclprocs.obj netprocs.obj
  
--- 32,38 ----
  
  VLSERVEROBJS = vldbint.cs.obj vldbint.xdr.obj
  
! LWPOBJS = lock.obj fasttime.obj threadname.obj
  
  LIBACLOBJS = aclprocs.obj netprocs.obj
  
***************
*** 92,97 ****
--- 92,100 ----
  	$(C2OBJ) $**
  
  fasttime.obj: $(LWP)/fasttime.c
+ 	$(C2OBJ) $**
+ 
+ threadname.obj: $(LWP)/threadname.c
  	$(C2OBJ) $**
  
  ############################################################################
Index: openafs/src/ubik/beacon.c
diff -c openafs/src/ubik/beacon.c:1.2 openafs/src/ubik/beacon.c:1.2.2.1
*** openafs/src/ubik/beacon.c:1.2	Sat Nov  4 05:05:52 2000
--- openafs/src/ubik/beacon.c	Tue Mar  6 16:49:53 2001
***************
*** 24,29 ****
--- 24,30 ----
  #include <rx/xdr.h>
  #include <rx/rx.h>
  #include <rx/rx_multi.h>
+ #include <afs/cellconfig.h>
  #ifndef AFS_NT40_ENV
  #include <afs/afsutil.h>
  #include <afs/netutils.h>
***************
*** 38,43 ****
--- 39,46 ----
  int ubik_amSyncSite = 0;	    /* flag telling if I'm sync site */
  static nServers;		    /* total number of servers */
  static char amIMagic=0;		    /* is this host the magic host */
+ char amIClone=0;                    /* is this a clone which doesn't vote */
+ static char ubik_singleServer = 0;
  extern struct rx_securityClass *rxnull_NewClientSecurityObject();
  int (*ubik_CRXSecurityProc)();
  char *ubik_CRXSecurityRock;
***************
*** 91,101 ****
      register afs_int32 rcode;
      
      /* special case for fast startup */
!     if (nServers == 1) {
  	return 1;	/* one guy is always the sync site */
      }
  
!     if (ubik_amSyncSite == 0) rcode = 0;  /* if I don't think I'm the sync site, say so */
      else {
  	now = FT_ApproxTime();
  	if (syncSiteUntil <= now) {	    /* if my votes have expired, say so */
--- 94,104 ----
      register afs_int32 rcode;
      
      /* special case for fast startup */
!     if (nServers == 1 && !amIClone) {
  	return 1;	/* one guy is always the sync site */
      }
  
!     if (ubik_amSyncSite == 0 || amIClone) rcode = 0;  /* if I don't think I'm the sync site, say so */
      else {
  	now = FT_ApproxTime();
  	if (syncSiteUntil <= now) {	    /* if my votes have expired, say so */
***************
*** 127,143 ****
   * is sync site.  Without the magic host hack, if anyone crashed in a 2
   * site system, we'd be out of business.
   */
  ubeacon_InitServerList(ame, aservers)
      afs_int32 ame;
!     register afs_int32 aservers[]; {
      register struct ubik_server *ts;
      register afs_int32 servAddr;
      register afs_int32 i, code;
      afs_int32 magicHost;
      struct ubik_server *magicServer;
  
      /* verify that the addresses passed in are correct */
!     if ( code = verifyInterfaceAddress(&ame, aservers ))
  	return code;
  
      /* get the security index to use, if we can */
--- 130,172 ----
   * is sync site.  Without the magic host hack, if anyone crashed in a 2
   * site system, we'd be out of business.
   */
+ ubeacon_InitServerListByInfo(ame, info, clones)
+     afs_int32 ame;
+     struct afsconf_cell *info;
+     char clones[];
+ {
+     afs_int32 code;
+ 
+     code = ubeacon_InitServerListCommon(ame, info, clones, 0);
+     return code;
+ }
+ 
  ubeacon_InitServerList(ame, aservers)
+     afs_int32 ame;
+     register afs_int32 aservers[];
+ {
+     afs_int32 code;
+ 
+     code = ubeacon_InitServerListCommon(ame, (struct afsconf_cell *)0, 0,
+ 							aservers);
+     return code;
+ }
+ 
+ ubeacon_InitServerListCommon(ame, info, clones, aservers)
      afs_int32 ame;
!     struct afsconf_cell *info;
!     char clones[];
!     register afs_int32 aservers[];
! {
      register struct ubik_server *ts;
+     afs_int32 me = -1;
      register afs_int32 servAddr;
      register afs_int32 i, code;
      afs_int32 magicHost;
      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 */
***************
*** 150,177 ****
  	ubikSecIndex = 0;
  	ubikSecClass = rxnull_NewClientSecurityObject();
      }
-     i = 0;
      magicHost =	ntohl(ame);	/* do comparisons in host order */
      magicServer = (struct ubik_server *) 0;
!     while (servAddr = *aservers++) {
! 	if (i >= MAXSERVERS) return UNHOSTS;	    /* too many hosts */
! 	ts = (struct ubik_server *) malloc(sizeof(struct ubik_server));
! 	bzero(ts, sizeof(struct ubik_server));
! 	ts->next = ubik_servers;
! 	ubik_servers = ts;
! 	ts->addr[0] = servAddr;	/* primary address in  net byte order */
! 	ts->vote_rxcid = rx_NewConnection(servAddr, ubik_callPortal, VOTE_SERVICE_ID, ubikSecClass, ubikSecIndex);	/* for vote reqs */
! 	ts->disk_rxcid = rx_NewConnection(servAddr, ubik_callPortal, DISK_SERVICE_ID, ubikSecClass, ubikSecIndex);	/* for disk reqs */
! 	ts->up = 1;
! 	if (ntohl((afs_uint32) servAddr) < (afs_uint32) magicHost) {
! 	    magicHost = ntohl(servAddr);
! 	    magicServer = ts;
  	}
- 	i++;
      }
      if (magicServer) magicServer->magic	= 1;	/* remember for when counting votes */
!     else amIMagic = 1;
!     nServers = i+1;	/* count this server as well as the remotes */
      ubik_quorum	= (nServers>>1)+1;	/* compute the majority figure */
  					/* send addrs to all other servers */
      code = updateUbikNetworkAddress(ubik_host);
--- 179,257 ----
  	ubikSecIndex = 0;
  	ubikSecClass = rxnull_NewClientSecurityObject();
      }
      magicHost =	ntohl(ame);	/* do comparisons in host order */
      magicServer = (struct ubik_server *) 0;
! 
!     if (info) {
!         for (i = 0; i < info->numServers; i++) {
!             if (ntohl((afs_uint32) info->hostAddr[i].sin_addr.s_addr) ==
!                                                 ntohl((afs_uint32) ame)) {
!                 me = i;
!                 if (clones[i]) {
!                     amIClone = 1;
!                     magicHost = 0;
!                 }
!             }
!         }
!         nServers = 0;
!         for (i = 0; i < info->numServers; i++) {
!             if (i == me) continue;
! 	    ts = (struct ubik_server *) malloc(sizeof(struct ubik_server));
! 	    bzero(ts, sizeof(struct ubik_server));
! 	    ts->next = ubik_servers;
! 	    ubik_servers = ts;
!             ts->addr[0] = info->hostAddr[i].sin_addr.s_addr;
!             if (clones[i]) {
!                 ts->isClone = 1;
!             } else {
!                 if (!magicHost || 
! 		ntohl((afs_uint32) ts->addr[0]) < (afs_uint32) magicHost) {
!                     magicHost = ntohl(ts->addr[0]);
!                     magicServer = ts;
!                 }
!                 ++nServers;
!             }
! 	    ts->vote_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
! 		VOTE_SERVICE_ID, 
! 		ubikSecClass, ubikSecIndex);		/* for vote reqs */
! 	    ts->disk_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
! 		DISK_SERVICE_ID, ubikSecClass, 
! 		ubikSecIndex);				/* for disk reqs */
! 	    ts->up = 1;
! 	}
!     } else {
!         i = 0;
!         while (servAddr = *aservers++) {
! 	    if (i >= MAXSERVERS) return UNHOSTS;	    /* too many hosts */
! 	    ts = (struct ubik_server *) malloc(sizeof(struct ubik_server));
! 	    bzero(ts, sizeof(struct ubik_server));
! 	    ts->next = ubik_servers;
! 	    ubik_servers = ts;
! 	    ts->addr[0] = servAddr;	/* primary address in  net byte order */
! 	    ts->vote_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
! 		VOTE_SERVICE_ID, 
! 		ubikSecClass, ubikSecIndex);		/* for vote reqs */
! 	    ts->disk_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
! 		DISK_SERVICE_ID, ubikSecClass, 
! 		ubikSecIndex);				/* for disk reqs */
! 	    ts->isClone = 0;			/* don't know about clones */
! 	    ts->up = 1;
! 	    if (ntohl((afs_uint32) servAddr) < (afs_uint32) magicHost) {
! 	        magicHost = ntohl(servAddr);
! 	        magicServer = ts;
! 	    }
! 	    i++;
  	}
      }
      if (magicServer) magicServer->magic	= 1;	/* remember for when counting votes */
! 
!     if (!amIClone && !magicServer) amIMagic = 1;
!     if (info) {
!         if (!amIClone) 
!             ++nServers;     	/* count this server as well as the remotes */
!     } else
!         nServers = i+1;		/* count this server as well as the remotes */
! 
      ubik_quorum	= (nServers>>1)+1;	/* compute the majority figure */
  					/* send addrs to all other servers */
      code = updateUbikNetworkAddress(ubik_host);
***************
*** 182,188 ****
      r_retryInterval = 2;	
      r_nRetries = (RPCTIMEOUT/r_retryInterval);
  */
!     if (nServers == 1) {    /* special case 1 server */
          if (!ubik_amSyncSite) ubik_dprint("Ubik: I am the sync site - 1 server\n");
  	ubik_amSyncSite = 1;
  	syncSiteUntil =	0x7fffffff; /* quite a while */
--- 262,280 ----
      r_retryInterval = 2;	
      r_nRetries = (RPCTIMEOUT/r_retryInterval);
  */
!     if (info) {
! 	if (!ubik_servers)              /* special case 1 server */
! 	    ubik_singleServer = 1;
! 	if (nServers == 1 && !amIClone) {
! 	    ubik_amSyncSite = 1;	/* let's start as sync site */
! 	    syncSiteUntil = 0x7fffffff; /* and be it quite a while */
! 	}
!     } else {
!        if (nServers == 1)     		/* special case 1 server */
! 	    ubik_singleServer = 1;
!     }
! 
!     if (ubik_singleServer) {	
          if (!ubik_amSyncSite) ubik_dprint("Ubik: I am the sync site - 1 server\n");
  	ubik_amSyncSite = 1;
  	syncSiteUntil =	0x7fffffff; /* quite a while */
***************
*** 222,228 ****
  
  	lastWakeupTime = FT_ApproxTime();   /* started a new collection phase */
  
! 	if (nServers ==	1) continue;	/* special-case 1 server for speedy startup */
  
  	if (!uvote_ShouldIRun()) continue;  /* if voter has heard from a better candidate than us, don't bother running */
  
--- 314,320 ----
  
  	lastWakeupTime = FT_ApproxTime();   /* started a new collection phase */
  
!         if (ubik_singleServer) continue;    /* special-case 1 server for speedy startup */
  
  	if (!uvote_ShouldIRun()) continue;  /* if voter has heard from a better candidate than us, don't bother running */
  
***************
*** 233,239 ****
  	    prepare to send them an r multi-call containing the beacon message */
  	i = 0;	    /* collect connections */
  	for(ts = ubik_servers; ts; ts=ts->next) {
! 	    if (ts->up && ts->addr[0] != ubik_host[0]) {
  		servers[i] = ts;
  		connections[i++] = ts->vote_rxcid;
  	    }
--- 325,331 ----
  	    prepare to send them an r multi-call containing the beacon message */
  	i = 0;	    /* collect connections */
  	for(ts = ubik_servers; ts; ts=ts->next) {
!             if (ts->up && ts->addr[0] != ubik_host[0]) {
  		servers[i] = ts;
  		connections[i++] = ts->vote_rxcid;
  	    }
***************
*** 279,285 ****
  		    ts->lastVoteTime = code;
  		    if (code < oldestYesVote) oldestYesVote = code;
  		    ts->lastVote = 1;
! 		    yesVotes += 2;
  		    if (ts->magic) yesVotes++;  /* the extra epsilon */
  		    ts->up = 1; /* server is up (not really necessary: recovery does this for real) */
  		    ts->beaconSinceDown = 1;
--- 371,378 ----
  		    ts->lastVoteTime = code;
  		    if (code < oldestYesVote) oldestYesVote = code;
  		    ts->lastVote = 1;
!                     if (!ts->isClone)
! 		        yesVotes += 2;
  		    if (ts->magic) yesVotes++;  /* the extra epsilon */
  		    ts->up = 1; /* server is up (not really necessary: recovery does this for real) */
  		    ts->beaconSinceDown = 1;
***************
*** 340,355 ****
  *
  * Return Values : 0 on success, non-zero on failure
  */
! verifyInterfaceAddress(ame, aservers)
! afs_uint32 *ame;		/* one of my interface addr in net byte order */
! afs_uint32 aservers[]; 	/* list of all possible server addresses */
  {
!     afs_uint32	myAddr[UBIK_MAX_INTERFACE_ADDR], *servList;
      int 	count, index, found, i, j, totalServers, start, end;
  
!     /* count the number of servers */
!     for ( totalServers=0, servList = aservers; *servList; servList++)
! 	totalServers++;
  
  #ifdef AFS_NT40_ENV 
      /* for now use getaddr(). use getAllAddr when implemented */
--- 433,452 ----
  *
  * Return Values : 0 on success, non-zero on failure
  */
! static verifyInterfaceAddress(ame, info, aservers)
!     struct afsconf_cell *info;
!     afs_uint32 aservers[]; 	/* list of all possible server addresses */
!     afs_uint32 *ame;		/* one of my interface addr in net byte order */
  {
!     afs_uint32	myAddr[UBIK_MAX_INTERFACE_ADDR], *servList, tmpAddr;
      int 	count, index, found, i, j, totalServers, start, end;
  
!     if (info)
!         totalServers = info->numServers;
!     else { 				/* count the number of servers */
!         for ( totalServers=0, servList = aservers; *servList; servList++)
! 	    totalServers++;
!     }
  
  #ifdef AFS_NT40_ENV 
      /* for now use getaddr(). use getAllAddr when implemented */
***************
*** 407,440 ****
      */
      for ( j=0, found = 0; j < count; j++)
      {
! 	for ( i=0; i < totalServers; i++)
! 	    if ( myAddr[j] == aservers[i] ) 	
! 	    {
! 		*ame = aservers[i];
! 		aservers[i]  = 0 ; 
  		found = 1;
  	    }
      }
      if ( found )
  	ubik_print("Using %s as my primary address\n", afs_inet_ntoa(*ame) );
  
!     /* get rid of servers which were purged because all 
!     ** those interface addresses are myself 
!     */
!     for ( start=0, end=totalServers-1; (start<end) ; start++, end--)
!     {
! 	/* find the first zero entry from the beginning */
! 	for ( ; (start < end) && ( aservers[start] ); start++);
! 
! 	/* find the last non-zero entry from the end */
! 	for ( ; (end >= 0) && ( !aservers[end] ); end-- );
! 
! 	/* if there is nothing more to purge, exit from loop */
! 	if ( start >= end ) break;
  
! 	/* move the entry */
! 	aservers[start] = aservers[end];
! 	aservers[end]   = 0;		/* this entry was moved */
      }
  	
      /* update all my addresses in ubik_host in such a way 
--- 504,544 ----
      */
      for ( j=0, found = 0; j < count; j++)
      {
! 	for ( i=0; i < totalServers; i++) {
!             if (info)
! 		tmpAddr = ntohl((afs_uint32) info->hostAddr[i].sin_addr.s_addr);
! 	    else 
! 		tmpAddr = aservers[i];
!             if ( myAddr[j] == tmpAddr) {
!                 *ame = tmpAddr;
! 		if (!info)
! 		    aservers[i]  = 0 ; 
  		found = 1;
  	    }
+ 	}
      }
      if ( found )
  	ubik_print("Using %s as my primary address\n", afs_inet_ntoa(*ame) );
  
!     if (!info) {
!         /* get rid of servers which were purged because all 
!         ** those interface addresses are myself 
!         */
!         for ( start=0, end=totalServers-1; (start<end) ; start++, end--)
!         {
! 	    /* find the first zero entry from the beginning */
! 	    for ( ; (start < end) && ( aservers[start] ); start++);
!     
! 	    /* find the last non-zero entry from the end */
! 	    for ( ; (end >= 0) && ( !aservers[end] ); end-- );
!     
! 	    /* if there is nothing more to purge, exit from loop */
! 	    if ( start >= end ) break;
  
! 	    /* move the entry */
! 	    aservers[start] = aservers[end];
! 	    aservers[end]   = 0;		/* this entry was moved */
!         }
      }
  	
      /* update all my addresses in ubik_host in such a way 
Index: openafs/src/ubik/recovery.c
diff -c openafs/src/ubik/recovery.c:1.2 openafs/src/ubik/recovery.c:1.2.2.1
*** openafs/src/ubik/recovery.c:1.2	Sat Nov  4 05:05:53 2000
--- openafs/src/ubik/recovery.c	Tue Mar  6 16:49:53 2001
***************
*** 425,430 ****
--- 425,431 ----
  	    bestDBVersion.counter = 0;
  	    for(ts=ubik_servers; ts; ts=ts->next) {
  	        if (!ts->up) continue;  /* don't bother with these guys */
+                 if (ts->isClone) continue;
  		code = DISK_GetVersion(ts->disk_rxcid, &ts->version);
  		if (code == 0) {
  		    /* perhaps this is the best version */
Index: openafs/src/ubik/ubik.c
diff -c openafs/src/ubik/ubik.c:1.2 openafs/src/ubik/ubik.c:1.2.2.1
*** openafs/src/ubik/ubik.c:1.2	Sat Nov  4 05:05:53 2000
--- openafs/src/ubik/ubik.c	Tue Mar  6 16:49:54 2001
***************
*** 20,25 ****
--- 20,26 ----
  #include <lock.h>
  #include <rx/xdr.h>
  #include <rx/rx.h>
+ #include <afs/cellconfig.h>
  
  #define UBIK_INTERNALS
  #include "ubik.h"
***************
*** 145,151 ****
  	    ts->beaconSinceDown = 0;
  	    urecovery_LostServer(); /* tell recovery to try to resend dbase later */
  	} else {            /* success */
! 	    okcalls++;	    /* count up how many worked */
  	    if (aflags & CStampVersion) {
  		ts->version = atrans->dbase->version;
  	    }
--- 146,153 ----
  	    ts->beaconSinceDown = 0;
  	    urecovery_LostServer(); /* tell recovery to try to resend dbase later */
  	} else {            /* success */
!             if (!ts->isClone)
! 	        okcalls++;	    /* count up how many worked */
  	    if (aflags & CStampVersion) {
  		ts->version = atrans->dbase->version;
  	    }
***************
*** 161,172 ****
      Note that the host named by myHost should not also be listed in serverList.
  */
  
  int ubik_ServerInit(myHost, myPort, serverList, pathName, dbase)
      afs_int32 myHost;
      short myPort;
      afs_int32 serverList[];    /* in */
      char *pathName;	/* in */
!     struct ubik_dbase **dbase; /* out */ {
      register struct ubik_dbase *tdb;
      register afs_int32 code;
      PROCESS junk;
--- 163,205 ----
      Note that the host named by myHost should not also be listed in serverList.
  */
  
+ int ubik_ServerInitByInfo(myHost, myPort, info, clones, pathName, dbase)
+     struct afsconf_cell *info;  /* in */
+     char clones[];
+     afs_int32 myHost;
+     short myPort;
+     char *pathName;	/* in */
+     struct ubik_dbase **dbase; /* out */ 
+ {
+      afs_int32 code;
+     
+      code = ubik_ServerInitCommon(myHost, myPort, info, clones, 0, pathName, dbase);
+      return code;
+ }
+ 
  int ubik_ServerInit(myHost, myPort, serverList, pathName, dbase)
+     afs_int32 serverList[];    /* in */
+     afs_int32 myHost;
+     short myPort;
+     char *pathName;	/* in */
+     struct ubik_dbase **dbase; /* out */ 
+ {
+      afs_int32 code;
+     
+      code = ubik_ServerInitCommon(myHost, myPort, (struct afsconf_cell *)0, 0,
+ 			serverList, pathName, dbase);
+      return code;
+ }
+ 
+ int ubik_ServerInitCommon(myHost, myPort, info, clones, serverList, pathName, dbase)
      afs_int32 myHost;
      short myPort;
+     struct afsconf_cell *info;  /* in */
+     char clones[];
      afs_int32 serverList[];    /* in */
      char *pathName;	/* in */
!     struct ubik_dbase **dbase; /* out */ 
! {
      register struct ubik_dbase *tdb;
      register afs_int32 code;
      PROCESS junk;
***************
*** 245,251 ****
      if (code) return code;
      code = urecovery_Initialize(tdb);
      if (code) return code;
!     code = ubeacon_InitServerList(myHost, serverList);
      if (code) return code;
  
      /* now start up async processes */
--- 278,287 ----
      if (code) return code;
      code = urecovery_Initialize(tdb);
      if (code) return code;
!     if (info)
!         code = ubeacon_InitServerListByInfo(myHost, info, clones);
!     else 
!         code = ubeacon_InitServerList(myHost, serverList);
      if (code) return code;
  
      /* now start up async processes */
Index: openafs/src/ubik/ubik.p.h
diff -c openafs/src/ubik/ubik.p.h:1.2 openafs/src/ubik/ubik.p.h:1.2.2.1
*** openafs/src/ubik/ubik.p.h:1.2	Sat Nov  4 05:05:53 2000
--- openafs/src/ubik/ubik.p.h	Tue Mar  6 16:49:54 2001
***************
*** 248,253 ****
--- 248,254 ----
      char beaconSinceDown;		/* did beacon get through since last crash? */
      char currentDB;			/* is dbase up-to-date */
      char magic;				/* the one whose vote counts twice */
+     char isClone;                       /* is only a clone, doesn't vote */
  };
  
  /* hold and release functions on a database */
***************
*** 258,263 ****
--- 259,265 ----
  
  /* list of all servers in the system */
  extern struct ubik_server *ubik_servers;
+ extern char amIClone;
  
  /* network port info */
  extern short ubik_callPortal;
Index: openafs/src/ubik/ubik_int.xg
diff -c openafs/src/ubik/ubik_int.xg:1.2 openafs/src/ubik/ubik_int.xg:1.2.2.1
*** openafs/src/ubik/ubik_int.xg:1.2	Sat Nov  4 05:05:53 2000
--- openafs/src/ubik/ubik_int.xg	Tue Mar  6 16:49:54 2001
***************
*** 167,172 ****
--- 167,174 ----
  #define	VOTE_GETSYNCSITE	10003
  #define VOTE_DEBUG		10004
  #define VOTE_SDEBUG		10005
+ #define VOTE_XDEBUG             10006
+ #define VOTE_XSDEBUG            10007
  
  /* Vote package interface calls */
  Beacon		(IN afs_int32 state,
***************
*** 185,190 ****
--- 187,199 ----
  
  SDebug		(IN afs_int32 which, 
  		OUT ubik_sdebug *db) = VOTE_SDEBUG;
+ 
+ XDebug          (OUT ubik_debug *db,
+                  OUT afs_int32 *isClone) = VOTE_XDEBUG;
+ 
+ XSDebug         (IN afs_int32 which,
+                  OUT ubik_sdebug *db,
+                  OUT afs_int32 *isClone) = VOTE_XSDEBUG;
  
  /* This package handles calls used to pass writes, begins and ends to other servers */
  package DISK_
Index: openafs/src/ubik/udebug.c
diff -c openafs/src/ubik/udebug.c:1.2 openafs/src/ubik/udebug.c:1.2.2.1
*** openafs/src/ubik/udebug.c:1.2	Sat Nov  4 05:05:54 2000
--- openafs/src/ubik/udebug.c	Tue Mar  6 16:49:54 2001
***************
*** 86,91 ****
--- 86,92 ----
      struct ubik_debug udebug;
      struct ubik_sdebug usdebug;
      int		oldServer =0;	/* are we talking to a pre 3.5 server? */
+     afs_int32 isClone = 0;
  
      int32p = (as->parms[2].items ? 1 : 0);
  
***************
*** 128,134 ****
      tconn = rx_NewConnection(hostAddr, port, VOTE_SERVICE_ID, sc, 0);
      
      /* now do the main call */
!     code = VOTE_Debug(tconn, &udebug);
      if ( code == RXGEN_OPCODE )	
      {
  	oldServer = 1;			/* talking to a pre 3.5 server */
--- 129,136 ----
      tconn = rx_NewConnection(hostAddr, port, VOTE_SERVICE_ID, sc, 0);
      
      /* now do the main call */
!     code = VOTE_XDebug(tconn, &udebug, &isClone);
!     if (code) code = VOTE_Debug(tconn, &udebug);
      if ( code == RXGEN_OPCODE )	
      {
  	oldServer = 1;			/* talking to a pre 3.5 server */
***************
*** 205,211 ****
  		   udebug.epochTime, udebug.tidCounter);
  	}
      } else {
! 	printf("I am not sync site\n");
  	inhostAddr.s_addr = htonl(udebug.lowestHost);
  	diff = udebug.now - udebug.lowestTime;
  	printf("Lowest host %s was set %d secs ago\n", inet_ntoa(inhostAddr), diff);
--- 207,216 ----
  		   udebug.epochTime, udebug.tidCounter);
  	}
      } else {
!         if (isClone) 
! 	    printf("I am a clone and never can become sync site\n");
!         else
! 	    printf("I am not sync site\n");
  	inhostAddr.s_addr = htonl(udebug.lowestHost);
  	diff = udebug.now - udebug.lowestTime;
  	printf("Lowest host %s was set %d secs ago\n", inet_ntoa(inhostAddr), diff);
***************
*** 239,251 ****
      if (int32p || udebug.amSyncSite) {
  	/* now do the subcalls */
  	for(i=0;;i++) {
! 	    if ( oldServer )
! 	    {				/* pre 3.5 server */
! 		memset(&usdebug, 0, sizeof(usdebug)); 
! 		code = VOTE_SDebugOld(tconn, i, &usdebug);
  	    }
- 	    else
- 		code = VOTE_SDebug(tconn, i, &usdebug);
  	    if (code > 0) break;	/* done */
  	    if (code < 0) {
  		printf("error code %d from VOTE_SDebug\n", code);
--- 244,259 ----
      if (int32p || udebug.amSyncSite) {
  	/* now do the subcalls */
  	for(i=0;;i++) {
!             isClone = 0;
!             code = VOTE_XSDebug(tconn, i, &usdebug, &isClone);
!             if (code < 0) {
! 	        if ( oldServer ) {			/* pre 3.5 server */
! 		    memset(&usdebug, 0, sizeof(usdebug)); 
! 		    code = VOTE_SDebugOld(tconn, i, &usdebug);
! 	        }
! 	        else
! 		    code = VOTE_SDebug(tconn, i, &usdebug);
  	    }
  	    if (code > 0) break;	/* done */
  	    if (code < 0) {
  		printf("error code %d from VOTE_SDebug\n", code);
***************
*** 253,264 ****
  	    }
  	    inhostAddr.s_addr = htonl(usdebug.addr);
  	    /* otherwise print the structure */
! 	    printf("\nServer( %s", afs_inet_ntoa(htonl(usdebug.addr))); 
  	    for ( j=0;((usdebug.altAddr[j]) && 
  				(j<UBIK_MAX_INTERFACE_ADDR-1)); j++)
  		printf(" %s", afs_inet_ntoa(htonl(usdebug.altAddr[j])));
! 	    printf(" ): (db %d.%d)\n",
  		   usdebug.remoteVersion.epoch, usdebug.remoteVersion.counter);
  
  	    if (usdebug.lastVoteTime == 0) {
  	       printf("    last vote never rcvd \n");
--- 261,275 ----
  	    }
  	    inhostAddr.s_addr = htonl(usdebug.addr);
  	    /* otherwise print the structure */
! 	    printf("\nServer (%s", afs_inet_ntoa(htonl(usdebug.addr))); 
  	    for ( j=0;((usdebug.altAddr[j]) && 
  				(j<UBIK_MAX_INTERFACE_ADDR-1)); j++)
  		printf(" %s", afs_inet_ntoa(htonl(usdebug.altAddr[j])));
! 	    printf("): (db %d.%d)",
  		   usdebug.remoteVersion.epoch, usdebug.remoteVersion.counter);
+             if (isClone)
+                 printf("    is only a clone!");
+ 	    printf("\n");
  
  	    if (usdebug.lastVoteTime == 0) {
  	       printf("    last vote never rcvd \n");
Index: openafs/src/ubik/vote.c
diff -c openafs/src/ubik/vote.c:1.2 openafs/src/ubik/vote.c:1.2.2.1
*** openafs/src/ubik/vote.c:1.2	Sat Nov  4 05:05:55 2000
--- openafs/src/ubik/vote.c	Tue Mar  6 16:49:55 2001
***************
*** 172,177 ****
--- 172,179 ----
      afs_int32 vote;
      struct rx_connection *aconn;
      struct rx_peer *rxp;
+     struct ubik_server *ts;
+     int isClone = 0;
  
      now = FT_ApproxTime();			/* close to current time */
      if (rxcall)	{				/* caller's host */
***************
*** 188,195 ****
  					afs_inet_ntoa(rx_HostOf(rxp)));
                  return 0; /* I don't know about you: vote no */
          }
!     } else
  	otherHost = ubik_host[0];			/* this host */
  
      ubik_dprint("Received beacon type %d from host %s\n", astate, 
  				afs_inet_ntoa(otherHost));
--- 190,204 ----
  					afs_inet_ntoa(rx_HostOf(rxp)));
                  return 0; /* I don't know about you: vote no */
          }
!         for (ts = ubik_servers; ts; ts = ts->next) {
!             if (ts->addr[0] == otherHost) break;
!         }
!         if (!ts) ubik_dprint("Unknown host %x has sent a beacon\n", otherHost);
!         if (ts && ts->isClone) isClone = 1;
!     } else {
  	otherHost = ubik_host[0];			/* this host */
+         isClone = amIClone;
+     }
  
      ubik_dprint("Received beacon type %d from host %s\n", astate, 
  				afs_inet_ntoa(otherHost));
***************
*** 211,218 ****
         seconds, we ignore its presence in lowestHost: it may have crashed.
         Note that we don't ever let anyone appear in our lowestHost if we're
         lower than them, 'cause we know we're up. */
!     if (ntohl((afs_uint32) otherHost) <= ntohl((afs_uint32) lowestHost)
! 	|| lowestTime + BIGTIME < now) {
  	lowestTime = now;
  	lowestHost = otherHost;
      }
--- 220,230 ----
         seconds, we ignore its presence in lowestHost: it may have crashed.
         Note that we don't ever let anyone appear in our lowestHost if we're
         lower than them, 'cause we know we're up. */
!     /* But do not consider clones for lowesHost since they never may become
!        sync site */
!     if (!isClone &&
!         (ntohl((afs_uint32) otherHost) <= ntohl((afs_uint32) lowestHost)
!         || lowestTime + BIGTIME < now)) {
  	lowestTime = now;
  	lowestHost = otherHost;
      }
***************
*** 223,230 ****
         lowest.  Need to prove: if one guy in the system is lowest and knows
         he's lowest, these loops don't occur.  because if someone knows he's
         lowest, he will send out beacons telling others to vote for him. */
!     if (ntohl((afs_uint32) ubik_host[0]) <= ntohl((afs_uint32) lowestHost)
! 	|| lowestTime + BIGTIME < now) {
  	lowestTime = now;
  	lowestHost = ubik_host[0];
      }
--- 235,243 ----
         lowest.  Need to prove: if one guy in the system is lowest and knows
         he's lowest, these loops don't occur.  because if someone knows he's
         lowest, he will send out beacons telling others to vote for him. */
!     if (!amIClone &&
!         (ntohl((afs_uint32) ubik_host) <= ntohl((afs_uint32) lowestHost)
!         || lowestTime + BIGTIME < now)) {
  	lowestTime = now;
  	lowestHost = ubik_host[0];
      }
***************
*** 261,268 ****
--- 274,292 ----
  	/* someone else *is* a sync site, just say no */
  	if (syncHost && syncHost != otherHost)
  	    return 0;
+     } else  /* fast startup if this is the only non-clone */
+     if (lastYesHost == 0xffffffff && otherHost == ubik_host[0]) {
+ 	int i = 0;
+         for (ts = ubik_servers; ts; ts = ts->next) {
+             if (ts->addr[0] == otherHost) continue;
+ 	    if (!ts->isClone) i++;
+ 	}
+ 	if (!i) lastYesHost = otherHost;
      }
+ 	
  
+     if (isClone) return 0; /* clone never can become sync site */
+ 
      /* Don't promise sync site support to more than one host every BIGTIME
         seconds.  This is the heart of our invariants in this system. */
      if (ubik_lastYesTime + BIGTIME < now || otherHost == lastYesHost) {
***************
*** 292,299 ****
     debugging hooks. */
  SVOTE_SDebug(rxcall, awhich, aparm)
      struct rx_call *rxcall;
      afs_int32 awhich;
!     register struct ubik_sdebug *aparm; {
      register struct ubik_server *ts;
      register int i;
      for(ts=ubik_servers; ts; ts=ts->next) {
--- 316,335 ----
     debugging hooks. */
  SVOTE_SDebug(rxcall, awhich, aparm)
      struct rx_call *rxcall;
+     afs_int32 awhich;
+     register struct ubik_sdebug *aparm;
+ {
+     afs_int32 code, isClone;
+     code = SVOTE_XSDebug(rxcall, awhich, aparm, &isClone);
+     return code;
+ }
+ 
+ SVOTE_XSDebug(rxcall, awhich, aparm, isclone)
+     afs_int32 *isclone;
+     struct rx_call *rxcall;
      afs_int32 awhich;
!     register struct ubik_sdebug *aparm; 
! {
      register struct ubik_server *ts;
      register int i;
      for(ts=ubik_servers; ts; ts=ts->next) {
***************
*** 309,320 ****
--- 345,368 ----
  	    aparm->up = ts->up;
  	    aparm->beaconSinceDown = ts->beaconSinceDown;
  	    aparm->currentDB = ts->currentDB;
+             *isclone = ts->isClone;
  	    return 0;
  	}
      }
      return 2;
  }
  
+ SVOTE_XDebug(rxcall, aparm, isclone)
+     struct rx_call *rxcall;
+     register struct ubik_debug *aparm;
+     afs_int32 *isclone;
+ {
+     afs_int32 code;
+ 
+     code = SVOTE_Debug(rxcall, aparm);
+     *isclone = amIClone;
+     return code;
+ }
  
  /* handle basic network debug command.  This is the global state dumper */
  SVOTE_Debug(rxcall, aparm)
Index: openafs/src/util/Makefile
diff -c openafs/src/util/Makefile:1.2 openafs/src/util/Makefile:1.2.2.1
*** openafs/src/util/Makefile:1.2	Sat Nov  4 05:06:02 2000
--- openafs/src/util/Makefile	Tue Mar  6 17:14:41 2001
***************
*** 16,22 ****
  objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \
  	 hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
  	 dirpath.o fileutil.o netutils.o flipbase64.o \
! 	 afs_atomlist.o afs_lhash.o
  
  headers = assert.h potpourri.h itc.h errors.h afsutil.h pthread_glock.h \
  	  dirpath.h afs_atomlist.h afs_lhash.h
--- 16,22 ----
  objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \
  	 hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
  	 dirpath.o fileutil.o netutils.o flipbase64.o \
! 	 afs_atomlist.o afs_lhash.o snprintf.o
  
  headers = assert.h potpourri.h itc.h errors.h afsutil.h pthread_glock.h \
  	  dirpath.h afs_atomlist.h afs_lhash.h
***************
*** 75,80 ****
--- 75,83 ----
  
  volparse.o: volparse.c
  	${CC} ${CFLAGS} -c volparse.c
+ 
+ snprintf.o: snprintf.c
+ 	${CC} ${CFLAGS} -c snprintf.c
  
  base64.o: base64.c
  	${CC} ${CFLAGS} -c base64.c
Index: openafs/src/util/dirpath.c
diff -c openafs/src/util/dirpath.c:1.2 openafs/src/util/dirpath.c:1.2.2.2
*** openafs/src/util/dirpath.c:1.2	Sat Nov  4 05:06:03 2000
--- openafs/src/util/dirpath.c	Tue Mar  6 17:07:06 2001
***************
*** 188,193 ****
--- 188,199 ----
    pathp = dirPathArray[AFSDIR_SERVER_BACKUP_DIRPATH_ID];
    AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_BACKUP_DIR);
  
+   pathp = dirPathArray[AFSDIR_SERVER_MIGRATE_DIRPATH_ID];
+   AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_MIGR_DIR);
+ 
+   pathp = dirPathArray[AFSDIR_SERVER_BIN_FILE_DIRPATH_ID];
+   AFSDIR_SERVER_DIRPATH(pathp, AFSDIR_BIN_FILE_DIR);
+ 
    /* client dir path */
  
  #ifdef AFS_NT40_ENV
***************
*** 266,271 ****
--- 272,280 ----
    pathp = dirPathArray[AFSDIR_SERVER_BOZCONF_FILEPATH_ID];
    AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_BOZCONF_FILE);
  
+   pathp = dirPathArray[AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID];
+   AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_BOZCONFNEW_FILE);
+ 
    pathp = dirPathArray[AFSDIR_SERVER_BOZLOG_FILEPATH_ID];
    AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOGS_DIR, AFSDIR_BOZLOG_FILE);
  
***************
*** 308,313 ****
--- 317,331 ----
    pathp = dirPathArray[AFSDIR_SERVER_NETRESTRICT_FILEPATH_ID];
    AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_LOCAL_DIR, AFSDIR_NETRESTRICT_FILE);
  
+   pathp = dirPathArray[AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH_ID];
+   AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_MIGR_DIR, AFSDIR_WEIGHTINGCONST_FILE);
+ 
+   pathp = dirPathArray[AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH_ID];
+   AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_MIGR_DIR, AFSDIR_THRESHOLDCONST_FILE);
+ 
+   pathp = dirPathArray[AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID];
+   AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_MIGR_DIR, AFSDIR_MIGRATE_LOGNAME);
+  
  
    /* client file paths */
  
Index: openafs/src/util/dirpath.h
diff -c openafs/src/util/dirpath.h:1.2 openafs/src/util/dirpath.h:1.2.2.2
*** openafs/src/util/dirpath.h:1.2	Sat Nov  4 05:06:04 2000
--- openafs/src/util/dirpath.h	Tue Mar  6 17:07:07 2001
***************
*** 101,106 ****
--- 101,108 ----
  #define AFSDIR_LOGS_DIR  "logs"
  #define AFSDIR_LOCAL_DIR "local"
  #define AFSDIR_BACKUP_DIR "backup"
+ #define AFSDIR_MIGR_DIR  "local/migrate"
+ #define AFSDIR_BIN_FILE_DIR  "local/migrate/bin_files"
  
  /* file names */ 
  #define AFSDIR_THISCELL_FILE    "ThisCell"
***************
*** 124,129 ****
--- 126,132 ----
  #define AFSDIR_SALVAGER_FILE    "salvager"
  #define AFSDIR_SLVGLOCK_FILE    "salvage.lock"
  #define AFSDIR_BOZCONF_FILE     "BosConfig"
+ #define AFSDIR_BOZCONFNEW_FILE  "BosConfig.new"
  #define AFSDIR_BOZINIT_FILE     "BozoInit"
  #define AFSDIR_BOZLOG_FILE      "BosLog"
  #define AFSDIR_BOSVR_FILE       "bosserver"
***************
*** 137,148 ****
--- 140,155 ----
  #define AFSDIR_OLDSYSID_FILE    "sysid.old"
  #define AFSDIR_SYSID_FILE       "sysid"
  #define AFSDIR_FILELOG_FILE     "FileLog"
+ #define AFSDIR_MIGRATE_LOGNAME  "wtlog."
  
  #define AFSDIR_CELLSERVDB_FILE_NTCLIENT  "afsdcell.ini"
  
  #define AFSDIR_NETINFO_FILE     "NetInfo"
  #define AFSDIR_NETRESTRICT_FILE "NetRestrict"
  
+ #define AFSDIR_LOCALRESIDENCY_FILE "LocalResidency"
+ #define AFSDIR_WEIGHTINGCONST_FILE "Weight.LocalConstants"
+ #define AFSDIR_THRESHOLDCONST_FILE "Thershold.LocalConstants"
  
  /* -------------- Canonical (wire-format) path macros -------------- */
  
***************
*** 163,168 ****
--- 170,179 ----
  #define AFSDIR_CANONICAL_SERVER_LOGS_DIRPATH \
  AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_LOGS_DIR
  
+ #define AFSDIR_CANONICAL_SERVER_LOCAL_DIRPATH \
+ AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_LOCAL_DIR
+ 
+ 
  #define AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH \
  AFSDIR_CANONICAL_SERVER_BIN_DIRPATH "/" AFSDIR_SALVAGER_FILE
  
***************
*** 209,214 ****
--- 220,226 ----
        AFSDIR_SERVER_SLVGLOG_FILEPATH_ID,
        AFSDIR_SERVER_SALVAGER_FILEPATH_ID,
        AFSDIR_SERVER_BOZCONF_FILEPATH_ID,
+       AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID,
        AFSDIR_SERVER_BOZINIT_FILEPATH_ID,
        AFSDIR_SERVER_BOZLOG_FILEPATH_ID,
        AFSDIR_SERVER_BOSVR_FILEPATH_ID,
***************
*** 228,233 ****
--- 240,250 ----
        AFSDIR_CLIENT_NETRESTRICT_FILEPATH_ID,
        AFSDIR_SERVER_NETINFO_FILEPATH_ID,
        AFSDIR_SERVER_NETRESTRICT_FILEPATH_ID,
+       AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH_ID,
+       AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH_ID,
+       AFSDIR_SERVER_MIGRATE_DIRPATH_ID,
+       AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID,
+       AFSDIR_SERVER_BIN_FILE_DIRPATH_ID,
        AFSDIR_PATHSTRING_MAX } afsdir_id_t;
  
  /* getDirPath() returns a pointer to a string from an internal array of path strings 
***************
*** 246,255 ****
--- 263,276 ----
  #define AFSDIR_SERVER_LOGS_DIRPATH getDirPath(AFSDIR_SERVER_LOGS_DIRPATH_ID)
  #define AFSDIR_SERVER_LOCAL_DIRPATH getDirPath(AFSDIR_SERVER_LOCAL_DIRPATH_ID)
  #define AFSDIR_SERVER_BACKUP_DIRPATH getDirPath(AFSDIR_SERVER_BACKUP_DIRPATH_ID)
+ #define AFSDIR_SERVER_LOCAL_DIRPATH getDirPath(AFSDIR_SERVER_LOCAL_DIRPATH_ID)
+ #define AFSDIR_SERVER_MIGRATE_DIRPATH getDirPath(AFSDIR_SERVER_MIGRATE_DIRPATH_ID)
+ #define AFSDIR_SERVER_MIGRATE_DIRPATH getDirPath(AFSDIR_SERVER_MIGRATE_DIRPATH_ID)
  
  /* client subdir paths */
  #define AFSDIR_CLIENT_VICE_DIRPATH getDirPath(AFSDIR_CLIENT_VICE_DIRPATH_ID)
  #define AFSDIR_CLIENT_ETC_DIRPATH getDirPath(AFSDIR_CLIENT_ETC_DIRPATH_ID)
+ #define AFSDIR_SERVER_BIN_FILE_DIRPATH getDirPath(AFSDIR_SERVER_BIN_FILE_DIRPATH_ID)
  
  /* server file paths */
  #define AFSDIR_SERVER_THISCELL_FILEPATH getDirPath(AFSDIR_SERVER_THISCELL_FILEPATH_ID)
***************
*** 272,277 ****
--- 293,299 ----
  #define AFSDIR_SERVER_SLVGLOG_FILEPATH getDirPath(AFSDIR_SERVER_SLVGLOG_FILEPATH_ID)
  #define AFSDIR_SERVER_SALVAGER_FILEPATH getDirPath(AFSDIR_SERVER_SALVAGER_FILEPATH_ID)
  #define AFSDIR_SERVER_BOZCONF_FILEPATH getDirPath(AFSDIR_SERVER_BOZCONF_FILEPATH_ID)
+ #define AFSDIR_SERVER_BOZCONFNEW_FILEPATH getDirPath(AFSDIR_SERVER_BOZCONFNEW_FILEPATH_ID)
  #define AFSDIR_SERVER_BOZINIT_FILEPATH getDirPath(AFSDIR_SERVER_BOZINIT_FILEPATH_ID)
  #define AFSDIR_SERVER_BOZLOG_FILEPATH getDirPath(AFSDIR_SERVER_BOZLOG_FILEPATH_ID)
  #define AFSDIR_SERVER_BOSVR_FILEPATH getDirPath(AFSDIR_SERVER_BOSVR_FILEPATH_ID)
***************
*** 287,292 ****
--- 309,317 ----
  #define AFSDIR_SERVER_AUDIT_FILEPATH getDirPath(AFSDIR_SERVER_AUDIT_FILEPATH_ID)
  #define AFSDIR_SERVER_NETINFO_FILEPATH getDirPath(AFSDIR_SERVER_NETINFO_FILEPATH_ID)
  #define AFSDIR_SERVER_NETRESTRICT_FILEPATH getDirPath(AFSDIR_SERVER_NETRESTRICT_FILEPATH_ID)
+ #define AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH_ID)
+ #define AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH_ID)
+ #define AFSDIR_SERVER_MIGRATELOG_FILEPATH getDirPath(AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID)
  
  /* client file paths */
  #define AFSDIR_CLIENT_THISCELL_FILEPATH getDirPath(AFSDIR_CLIENT_THISCELL_FILEPATH_ID)
Index: openafs/src/util/errors.h
diff -c openafs/src/util/errors.h:1.2 openafs/src/util/errors.h:1.2.2.1
*** openafs/src/util/errors.h:1.2	Sat Nov  4 05:06:04 2000
--- openafs/src/util/errors.h	Tue Mar  6 17:07:44 2001
***************
*** 48,55 ****
  				   propagated to the application level */
  #define VMOVED		111	/* Volume has moved to another server; do a VGetVolumeInfo
  				   to THIS server to find out where */
! #define VIO		112	/* Vnode temporarily unaccessible, but not known to
  				   to be permanently bad. */
  #define VRESTARTING	-100    /* server is restarting, otherwise similar to 
  				   VBUSY above.  This is negative so that old
  				   cache managers treat it as "server is down"*/
--- 48,59 ----
  				   propagated to the application level */
  #define VMOVED		111	/* Volume has moved to another server; do a VGetVolumeInfo
  				   to THIS server to find out where */
! #define VIO		112	/* Vnode temporarily unaccessible, but not known 
  				   to be permanently bad. */
+ #define VRESTRICTED     120     /* Volume is restricted from using one or more
+                                    of the given residencies; do a
+                                    vos examine to find out the current
+                                    restrictions. */
  #define VRESTARTING	-100    /* server is restarting, otherwise similar to 
  				   VBUSY above.  This is negative so that old
  				   cache managers treat it as "server is down"*/
Index: openafs/src/util/serverLog.c
diff -c openafs/src/util/serverLog.c:1.2 openafs/src/util/serverLog.c:1.2.2.1
*** openafs/src/util/serverLog.c:1.2	Sat Nov  4 05:06:07 2000
--- openafs/src/util/serverLog.c	Tue Mar  6 17:08:52 2001
***************
*** 60,69 ****
--- 60,84 ----
  #define F_OK 0
  #endif
  
+ char *threadname();
+ 
  static int serverLogFD = -1;
  
  #include <stdarg.h>
  int LogLevel;
+ int mrafsStyleLogs = 0;
+ int printLocks = 0;
+ static char ourName[MAXPATHLEN];
+ 
+ void WriteLogBuffer(buf,len)
+     char *buf;
+     afs_uint32 len;
+ {
+     LOCK_SERVERLOG();
+     if (serverLogFD > 0)
+         write(serverLogFD, buf, len);
+     UNLOCK_SERVERLOG();
+ }
  
  /* VARARGS1 */
  void FSLog (const char *format, ...)
***************
*** 75,86 ****
--- 90,109 ----
      char tbuffer[1024];
      char *info;
      int len;
+     int i;
+     char *name;
  
      currenttime = time(0);
      timeStamp = afs_ctime(&currenttime, tbuffer, sizeof(tbuffer));
      timeStamp[24] = ' ';  /* ts[24] is the newline, 25 is the null */
      info = &timeStamp[25];
  
+     if (mrafsStyleLogs) {
+        name = threadname();
+        sprintf(info, "[%s] ", name);
+        info += strlen(info);
+     }
+ 
      va_start(args, format);
      (void) vsprintf(info, format, args);
      va_end(args);
***************
*** 118,123 ****
--- 141,147 ----
      else {
          LogLevel = 1;
      }
+     printLocks = 2;
  #if defined(AFS_PTHREAD_ENV)
      DebugOn(LogLevel);
  #else /* AFS_PTHREAD_ENV */
***************
*** 132,137 ****
--- 156,162 ----
  {
      LogLevel = 0;
  
+     if (printLocks >0) --printLocks;
  #if defined(AFS_PTHREAD_ENV)
      DebugOn(LogLevel);
  #else /* AFS_PTHREAD_ENV */
***************
*** 140,145 ****
--- 165,172 ----
  
      signal(signo, ResetDebug_Signal);   /* on some platforms, this signal */
  					/* handler needs to be set again */
+     if (mrafsStyleLogs)
+ 	OpenLog((char *)&ourName);
  } /*ResetDebug_Signal*/
  
  
***************
*** 158,170 ****
       */
      int tempfd;
      char oldName[MAXPATHLEN];
  
!     strcpy(oldName, fileName);
!     strcat(oldName, ".old");
  
-     /* don't check error */
-     renamefile(fileName, oldName);
-     tempfd = open(fileName, O_WRONLY|O_TRUNC|O_CREAT, 0666);
      if(tempfd < 0)
      {
  	printf("Unable to open log file %s\n", fileName);
--- 185,216 ----
       */
      int tempfd;
      char oldName[MAXPATHLEN];
+     struct timeval Start;
+     struct tm *TimeFields;
+     char FileName[MAXPATHLEN]; 
+ 
+     if (mrafsStyleLogs) {
+         TM_GetTimeOfDay(&Start, 0);
+         TimeFields = localtime(&Start.tv_sec);
+         if (fileName) {
+             if (strncmp(fileName, (char *)&ourName, strlen(fileName)))
+             strcpy((char *)&ourName, (char *) fileName);
+ 	}
+         sprintf(FileName, "%s.%d%02d%02d%02d%02d%02d", ourName,
+ 		TimeFields->tm_year + 1900, TimeFields->tm_mon + 1, 
+ 		TimeFields->tm_mday, TimeFields->tm_hour, 
+ 		TimeFields->tm_min, TimeFields->tm_sec);
+         rename (fileName, FileName); /* don't check error code */
+         tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT, 0666); 
+     } else {
+         strcpy(oldName, fileName);
+         strcat(oldName, ".old");
  
!         /* don't check error */
!         renamefile(fileName, oldName);
!         tempfd = open(fileName, O_WRONLY|O_TRUNC|O_CREAT, 0666);
!     }
  
      if(tempfd < 0)
      {
  	printf("Unable to open log file %s\n", fileName);
Index: openafs/src/util/snprintf.c
diff -c /dev/null openafs/src/util/snprintf.c:1.5.2.5
*** /dev/null	Wed Mar  7 15:26:36 2001
--- openafs/src/util/snprintf.c	Tue Mar  6 17:27:44 2001
***************
*** 0 ****
--- 1,390 ----
+ /* snprintf.c - Formatted, length-limited print to a string */
+ 
+ #include <afs/param.h>
+ #if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV)
+ 
+ #include <sys/types.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #if defined(AFS_AIX32_ENV)
+ #include <sys/socket.h>
+ #endif
+ 
+ #define MAXPREC 100
+ 
+ /* Generate an ASCII representation of an integer <val>, as follows:
+  * <base> indicates the base to be used (2-36)
+  * <uc> is nonzero if letter digits should be uppercase
+  * <prec> is the minimum number of digits
+  * The resulting number is stored in <buf>, which must be long enough
+  * to receive it.  The minimum length is <prec> or ceil(log{base}(val)),
+  * whichever is larger, plus room for a trailing NUL.
+  */
+ static void mkint(char *buf, unsigned long val, int base, int uc, int prec)
+ {
+   int len = 0, dig, i;
+ 
+   while (val) {
+     dig = val % base;
+     val = (val - dig) / base;
+     if (dig < 10)  dig = dig + '0';
+     else if (uc) dig = dig + 'A' - 10;
+     else         dig = dig + 'a' - 10;
+     buf[len++] = dig;
+   }
+   while (len < prec) buf[len++] = '0';
+   for (i = 0; i < (len + 1) / 2; i++) {
+     dig = buf[i];
+     buf[i] = buf[len - i - 1];
+     buf[len - i - 1] = dig;
+   }
+   buf[len] = 0;
+ }
+ 
+ 
+ /* This function is a mostly-complete implementation of snprintf,
+  * with the following features:
+  *
+  *   - Actually obeys the length limit, which (unfortunately) many
+  *     implementations of snprintf do not.
+  *  
+  *   - Supports all the standard format specifiers for integers
+  *     (d, i, o, u, x, X), floating-point values (f, e, E, g, G),
+  *     and strings and characters (c, s, %), plus a few unusual
+  *     but useful ones described below.
+  *  
+  *   - Supports all the standard flags (-, 0, +, space, #).  These
+  *     flags are ignored if used when they are not appropriate.
+  *  
+  *   - Supports the standard size modifiers for short (h), long (h),
+  *     and double (L) arguments.  These modifiers are ignored if used
+  *     when they are not appropriate.
+  *  
+  *   - Supports minimum field width and precision, where appropriate,
+  *     including the use of '*' to specify a value given as an argument
+  *     instead of in the format string.  There is a maximum precision
+  *     of 100 digits.
+  *  
+  *   - At present, the 'p' specifier for printing pointers is not
+  *     implemented, because it is inherently non-portable and thus
+  *     can be implemented correctly only by the compiler's run-time
+  *     library.
+  *
+  *   - Floating-point specifier (%e, %f, %g) are implemented by
+  *     calling the standard sprintf, and thus may be unsafe.
+  *  
+  *   - The '%...$' notation is used primarily when the format string
+  *     is specified by the user, who knows but cannot change the order
+  *     of the arguments.  Such usage is inherently dangerous and
+  *     insecure; thus, it is not supported.
+  *  
+  * The custom format specifier '%I' is supported.  This specifier
+  * takes as its argument an unsigned long integer containing an
+  * IPv4 address in network byte order.  The address is rendered
+  * either as a hostname or as a dotted quad, as follows:
+  *  
+  *   - If precision is nonzero or unspecified, a hostname lookup
+  *     is attempted; if it is successful, the hostname is printed.
+  *     If the hostname lookup fails, the address is printed in
+  *     dotted-quad notation.
+  *  
+  *   - If precision is explicitly specified as 0, then the hostname
+  *     lookup is skipped, and dotted-quad notation is always used.
+  *  
+  *   - If a hostname is to be printed:
+  *     + The precision controls the maximum number of characters
+  *       printed, as with %s.
+  *     + If the '#' flag is specified, any letters in the hostname
+  *       will be forced to lower case before printing.
+  *     + If the '+' flag is specified, any letters in the hostname
+  *       will be forced to upper case before printing.  If both
+  *       '#' and '+' are given, the '+' flag will be ignored.
+  *     + The '0' and ' ' flags have no effect.
+  *  
+  *   - If a dotted quad is to be printed:
+  *     + The precision has no effect; dotted quads are always
+  *       7 to 12 characters in length, depending on the value
+  *       to be printed and the format flags used.
+  *     + If the '0' flag is given, each field (byte) of the address
+  *       will be padded with '0' on the left to three digits.
+  *     + If the ' ' flag is given, each field (byte) of the address
+  *       will be padded with spaces on the left to three digits.  If
+  *       both '0' and ' ' are given, the ' ' flag will be ignored.
+  *     + The '#' and '+' flags have no effect.
+  */
+ static void vsnprintf(char *p, unsigned int avail, char *fmt, va_list ap)
+ {
+   unsigned int width, precision, haveprec, len;
+   int ljust, plsign, spsign, altform, zfill;
+   int hflag, lflag, count, *countp, j;
+   char *x, *y, xbuf[MAXPREC + 21], fbuf[20];
+   struct hostent *he;
+   struct in_addr ia;
+   unsigned long UVAL;
+   long SVAL, *lcountp;
+   double FVAL;
+   short *hcountp;
+ 
+   count = 0;
+   avail--;
+   while (*fmt && avail) {
+     if (*fmt != '%') {
+       *p++ = *fmt++;
+       avail--;
+       count++;
+       continue;
+     }
+ 
+     /** Found a format specifier **/
+     ljust = plsign = spsign = altform = zfill = 0;
+     width = precision = haveprec = 0;
+     hflag = lflag = 0;
+     fmt++;
+ 
+     /* parse format flags */
+     while (*fmt) {
+       switch (*fmt) {
+         case '-': ljust   = 1; fmt++; continue;      /* left justify */
+         case '+': plsign  = 1; fmt++; continue;      /* use + or - */
+         case ' ': spsign  = 1; fmt++; continue;      /* use space or - */
+         case '#': altform = 1; fmt++; continue;      /* alternate form */
+         case '0': zfill   = 1; fmt++; continue;      /* pad with 0 */
+         default: break;
+       }
+       break;
+     }
+ 
+     /* parse minimum width */
+     if (*fmt == '*') {
+       width = va_arg(ap, int);
+       fmt++;
+     } else while (isdigit(*fmt)) {
+       width = (width * 10) + (*fmt - '0');
+       fmt++;
+     }
+ 
+     /* parse precision */
+     if (*fmt == '.') {
+       fmt++;
+       haveprec = 1;
+       if (*fmt == '*') {
+         precision = va_arg(ap, int);
+         fmt++;
+       } else while (isdigit(*fmt)) {
+         precision = (precision * 10) + (*fmt - '0');
+         fmt++;
+       }
+     }
+ 
+     /* parse size flags */
+     while (*fmt) {
+       switch (*fmt) {
+         case 'h': hflag   = 1; fmt++; continue;      /* short argument */
+         case 'l': lflag   = 1; fmt++; continue;      /* long argument */
+         default: break;
+       }
+       break;
+     }
+ 
+     /* parse format specifier */
+     if (!*fmt) break;
+     switch (*fmt++) {
+       case 'e':
+       case 'E':
+       case 'f':
+       case 'g':
+       case 'G':
+         FVAL = va_arg(ap, double);
+         sprintf(fbuf, "%%%s%s.*L%c", plsign ? "+" : (spsign ? " " : ""),
+                 altform ? "#" : "", fmt[-1]);
+         if (!haveprec) precision = 6;
+         if (precision > MAXPREC) precision = MAXPREC;
+         sprintf(xbuf, fbuf, precision, FVAL);
+         x = xbuf;
+         len = strlen(x);
+         break;
+ 
+       case 'i': 
+       case 'd': /* signed decimal integer */
+         if      (lflag) SVAL = va_arg(ap, long);
+         else if (hflag) SVAL = va_arg(ap, short);
+         else            SVAL = va_arg(ap, int);
+         UVAL = (SVAL < 0) ? -SVAL : SVAL;
+ 
+         if (SVAL < 0)    xbuf[0] = '-';
+         else if (plsign) xbuf[0] = '+';
+         else if (spsign) xbuf[0] = ' ';
+         else             xbuf[0] = 0;
+ 
+         if (!haveprec) {
+           if (zfill && !ljust) precision = width - !!xbuf[0];
+           else precision = 1;
+           if (precision < 1 + !!xbuf[0]) precision = 1 + !!xbuf[0];
+         }
+         if (precision > MAXPREC) precision = MAXPREC;
+ 
+         mkint(xbuf + 1, UVAL, 10, 0, precision);
+         x = xbuf + !xbuf[0];
+         len = strlen(x);
+         break;
+ 
+ 
+       case 'o': /* unsigned octal integer */
+         if      (lflag) UVAL = va_arg(ap, unsigned long);
+         else if (hflag) UVAL = va_arg(ap, unsigned short);
+         else            UVAL = va_arg(ap, unsigned int);
+ 
+         xbuf[0] = '0';
+ 
+         if (!haveprec) {
+           if (zfill && !ljust) precision = width;
+           else precision = 1;
+         }
+         if (precision > MAXPREC) precision = MAXPREC;
+ 
+         mkint(xbuf + 1, UVAL, 8, 0, precision);
+         x = xbuf + (xbuf[1] == '0' || !altform);
+         len = strlen(x);
+         break;
+ 
+       case 'u': /* unsigned decimal integer */
+         if      (lflag) UVAL = va_arg(ap, unsigned long);
+         else if (hflag) UVAL = va_arg(ap, unsigned short);
+         else            UVAL = va_arg(ap, unsigned int);
+ 
+         if (!haveprec) {
+           if (zfill && !ljust) precision = width;
+           else precision = 1;
+         }
+         if (precision > MAXPREC) precision = MAXPREC;
+ 
+         mkint(xbuf, UVAL, 10, 0, precision);
+         x = xbuf;
+         len = strlen(x);
+         break;
+ 
+       case 'x': 
+       case 'X': /* unsigned hexadecimal integer */
+         if      (lflag) UVAL = va_arg(ap, unsigned long);
+         else if (hflag) UVAL = va_arg(ap, unsigned short);
+         else            UVAL = va_arg(ap, unsigned int);
+ 
+         xbuf[0] = '0';
+         xbuf[1] = 'x';
+ 
+         if (!haveprec) {
+           if (zfill && !ljust) precision = width;
+           else precision = 1;
+         }
+         if (precision > MAXPREC) precision = MAXPREC;
+ 
+         mkint(xbuf + 2, UVAL, 16, 0, precision);
+         x = xbuf + ((altform && UVAL) ? 0 : 2);
+         len = strlen(x);
+         break;
+ 
+       case '%': /* literal % */
+         xbuf[0] = '%';
+         xbuf[1] = 0;
+         x = xbuf;
+         len = 1;
+         break;
+ 
+       case 'c': /* character */
+         xbuf[0] = va_arg(ap, int);
+         xbuf[1] = 0;
+         x = xbuf;
+         len = 1;
+         break;
+ 
+       case 's': /* string */
+         x = va_arg(ap, char *);
+         if (!x) x = "<null>";
+         len = strlen(x);
+         if (haveprec && precision < len) len = precision;
+         break;
+ 
+       case 'I': /* IP address:
+          * value is provided as a network-order unsigned long integer
+          * precision specifies max hostname length, as for %s
+          * if precision is explicitly 0, no hostname lookup is done
+          * if 0fill specified, IPaddr fields are 0-filled to 3 digits
+          * if spsign specified, IPaddr fields are space-filled to 3 digits
+          */
+         UVAL = va_arg(ap, unsigned long);
+         ia.s_addr = UVAL;
+         if (haveprec && !precision) he = 0;
+         else he = gethostbyaddr((char *)&ia, 4, AF_INET);
+         if (he) {
+           x = he->h_name;
+           len = strlen(x);
+           if (haveprec && precision < len) len = precision;
+           if (altform)
+             for (y = x; *y; y++) if (isupper(*y)) *y = tolower(*y);
+           else if (plsign)
+             for (y = x; *y; y++) if (islower(*y)) *y = toupper(*y);
+         } else {
+           UVAL = ntohl(UVAL);
+           if      (zfill)  x = "%03u.%03u.%03u.%03u";
+           else if (spsign) x = "%3u.%3u.%3u.%3u";
+           else             x = "%u.%u.%u.%u";
+           sprintf(xbuf, x,
+                   (UVAL & 0xff000000) >> 24, (UVAL & 0x00ff0000) >> 16,
+                   (UVAL & 0x0000ff00) >> 8,  (UVAL & 0x000000ff));
+           x = xbuf;
+           len = strlen(xbuf);
+         }
+         break;
+ 
+       case 'n': /* report count so far */
+         if (lflag) {
+           lcountp = va_arg(ap, long *);
+           *lcountp = count;
+         } else if (hflag) {
+           hcountp = va_arg(ap, short *);
+           *hcountp = count;
+         } else {
+           countp = va_arg(ap, int *);
+           *countp = count;
+         }
+         continue;
+ 
+       default: /* unknown specifier */
+         continue;
+     }
+ 
+     /* render the results */
+     if (len > avail)   len = avail;
+     if (!width)        width = len;
+     if (width > avail) width = avail;
+     j = width - len;
+     if (j > 0) {
+       avail -= j;
+       count += j;
+     }
+ 
+     if (!ljust) while (j-- > 0) *p++ = ' ';
+ 
+     strncpy(p, x, len);
+     avail -= len;
+     count += len;
+     p += len;
+ 
+     if (ljust) while (j-- > 0) *p++ = ' ';
+   }
+   *p = 0;
+ }
+ 
+ 
+ void snprintf(char *p, unsigned int avail, char *fmt, ...)
+ {
+   va_list ap;
+ 
+   va_start(ap, fmt);
+   vsnprintf(p, avail, fmt, ap);
+   va_end(ap);
+ }
+ #endif /* AFS_OSF20_ENV || AFS_AIX32_ENV */
Index: openafs/src/util/volparse.c
diff -c openafs/src/util/volparse.c:1.2 openafs/src/util/volparse.c:1.2.2.1
*** openafs/src/util/volparse.c:1.2	Sat Nov  4 05:06:08 2000
--- openafs/src/util/volparse.c	Tue Mar  6 16:48:00 2001
***************
*** 179,181 ****
--- 179,221 ----
      else *aval = total;
      return 0;
  }
+ 
+ afs_uint32
+ GetUInt32 (as, aval)
+ register char *as;
+ afs_uint32 *aval;
+ {
+     register afs_uint32 total;
+     register int tc;
+     int base;
+ 
+     total = 0;  /* initialize things */
+ 
+     /* skip over leading spaces */
+     while (tc = *as) {
+         if (tc != ' ' && tc != '\t') break;
+     }
+ 
+     /* compute the base */
+     if (*as == '0') {
+         as++;
+         if (*as == 'x' || *as == 'X') {
+             base = 16;
+             as++;
+ 	}
+         else base = 8;
+     }
+     else base = 10;
+ 
+     /* compute the # itself */
+     while(tc = *as) {
+         if (!ismeta(tc, base)) return -1;
+         total *= base;
+         total += getmeta(tc);
+         as++;
+     }
+     
+     *aval = total;
+     return 0;
+ }
+ 
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.2 openafs/src/viced/afsfileprocs.c:1.2.2.1
*** openafs/src/viced/afsfileprocs.c:1.2	Sat Nov  4 05:06:14 2000
--- openafs/src/viced/afsfileprocs.c	Tue Mar  6 16:38:58 2001
***************
*** 6896,6898 ****
--- 6896,6906 ----
      return EINVAL;
  }
  
+ SRXAFS_ResidencyCmd (tcon, Fid, Inputs, Outputs)
+     struct rx_connection *tcon;
+     struct AFSFid *Fid;
+     struct ResidencyCmdInputs *Inputs;
+     struct ResidencyCmdOutputs *Outputs;
+ {
+     return EINVAL;
+ }
Index: openafs/src/vlserver/vlserver.c
diff -c openafs/src/vlserver/vlserver.c:1.2.2.1 openafs/src/vlserver/vlserver.c:1.2.2.2
*** openafs/src/vlserver/vlserver.c:1.2.2.1	Wed Dec 13 16:50:57 2000
--- openafs/src/vlserver/vlserver.c	Tue Mar  6 16:49:47 2001
***************
*** 106,112 ****
  char	**argv;
  {
      register afs_int32   code;
-     afs_int32	    serverList[MAXSERVERS];
      afs_int32		    myHost;
      struct rx_service	    *tservice;
      struct rx_securityClass *sc[3];
--- 106,111 ----
***************
*** 121,127 ****
      int noAuth = 0, index, i;
      extern int rx_extraPackets;
      char commandLine[150];
! 
  #ifdef	AFS_AIX32_ENV
      /*
       * The following signal action for AIX is necessary so that in case of a 
--- 120,127 ----
      int noAuth = 0, index, i;
      extern int rx_extraPackets;
      char commandLine[150];
!     char clones[MAXHOSTSPERCELL];
!  
  #ifdef	AFS_AIX32_ENV
      /*
       * The following signal action for AIX is necessary so that in case of a 
***************
*** 214,228 ****
      signal(SIGXCPU, CheckSignal_Signal);
  #endif
      /* get list of servers */
!     code = afsconf_GetCellInfo(tdir,(char *)0, AFSCONF_VLDBSERVICE,&info);
      if (code) {
  	printf("vlserver: Couldn't get cell server list for 'afsvldb'.\n");
  	exit(2);
      }
-     for (index=0,i = 0;index<info.numServers;index++)
- 	if (info.hostAddr[index].sin_addr.s_addr != myHost) /* ubik already tacks myHost onto list */
- 	    serverList[i++] = info.hostAddr[index].sin_addr.s_addr;
-      serverList[i] = 0;
  
      vldb_confdir = tdir;		/* Preserve our configuration dir */
      /* rxvab no longer supported */
--- 214,225 ----
      signal(SIGXCPU, CheckSignal_Signal);
  #endif
      /* get list of servers */
!     code = afsconf_GetExtendedCellInfo(tdir,(char *)0, AFSCONF_VLDBSERVICE,
!                                        &info, &clones);
      if (code) {
  	printf("vlserver: Couldn't get cell server list for 'afsvldb'.\n");
  	exit(2);
      }
  
      vldb_confdir = tdir;		/* Preserve our configuration dir */
      /* rxvab no longer supported */
***************
*** 237,243 ****
      ubik_SRXSecurityRock = (char *) tdir;
      ubik_CheckRXSecurityProc = afsconf_CheckAuth;
      ubik_CheckRXSecurityRock = (char *) tdir;
!     code = ubik_ServerInit(myHost, htons(AFSCONF_VLDBPORT), serverList, vl_dbaseName, &VL_dbase);
      if (code) {
  	printf("vlserver: Ubik init failed with code %d\n",code);
  	exit(2);
--- 234,241 ----
      ubik_SRXSecurityRock = (char *) tdir;
      ubik_CheckRXSecurityProc = afsconf_CheckAuth;
      ubik_CheckRXSecurityRock = (char *) tdir;
!     code = ubik_ServerInitByInfo(myHost, htons(AFSCONF_VLDBPORT), &info,
! 				 &clones, vl_dbaseName, &VL_dbase);
      if (code) {
  	printf("vlserver: Ubik init failed with code %d\n",code);
  	exit(2);
Index: openafs/src/vol/Makefile
diff -c openafs/src/vol/Makefile:1.2 openafs/src/vol/Makefile:1.2.2.1
*** openafs/src/vol/Makefile:1.2	Sat Nov  4 05:06:21 2000
--- openafs/src/vol/Makefile	Tue Mar  6 16:10:51 2001
***************
*** 81,89 ****
                  *linux* ) \
                          ${CC} ${LDFLAGS} -o salvager vol-salvage.o physio.o \
  				${LIBS}  ;; \
-                 sgi_* ) \
-                         ${CC} ${LDFLAGS} -o salvager vol-salvage.o physio.o \
- 				${LIBS} ../sgiefs/libefs.a ;; \
                  *) \
                          ${CC} ${LDFLAGS} -o salvager vol-salvage.o physio.o \
  				${LIBS};; \
--- 81,86 ----
Index: openafs/src/vol/devname.c
diff -c openafs/src/vol/devname.c:1.2 openafs/src/vol/devname.c:1.2.2.1
*** openafs/src/vol/devname.c:1.2	Sat Nov  4 05:06:21 2000
--- openafs/src/vol/devname.c	Tue Mar  6 16:10:52 2001
***************
*** 54,61 ****
  #if defined(AFS_SGI_ENV)
  #include <fcntl.h>
  #include <mntent.h>
! #include "../sgiefs/efs.h"
  #define ROOTINO EFS_ROOTINO
  #else
  #ifdef AFS_LINUX22_ENV
  #include <mntent.h>
--- 54,63 ----
  #if defined(AFS_SGI_ENV)
  #include <fcntl.h>
  #include <mntent.h>
! #ifdef AFS_SGI_EFS_IOPS_ENV
  #define ROOTINO EFS_ROOTINO
+ #include "../sgiefs/efs.h"
+ #endif
  #else
  #ifdef AFS_LINUX22_ENV
  #include <mntent.h>
Index: openafs/src/vol/listinodes.c
diff -c openafs/src/vol/listinodes.c:1.2 openafs/src/vol/listinodes.c:1.2.2.1
*** openafs/src/vol/listinodes.c:1.2	Sat Nov  4 05:06:23 2000
--- openafs/src/vol/listinodes.c	Tue Mar  6 16:10:52 2001
***************
*** 417,422 ****
--- 417,423 ----
  /* libefs.h includes <assert.h>, which we don't want */
  #define	__ASSERT_H__
  
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  #include "../sgiefs/libefs.h"
  extern int Log();
  
***************
*** 606,611 ****
--- 607,613 ----
  
  	return err;
  }
+ #endif /* AFS_SGI_EFS_IOPS_ENV */
  
  #ifdef AFS_SGI_XFS_IOPS_ENV
  #include <dirent.h>
***************
*** 1022,1028 ****
--- 1024,1032 ----
  	int ninodes = 0, err = 0;
  	struct efs_dinode *dinodeBuf = NULL;
  	int last_cgno;
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  	EFS_MOUNT *mp;
+ #endif
  	ino_t	imax, inum;	/* total number of I-nodes in file system */
  
  	*forcep = 0;
***************
*** 1044,1058 ****
  	}
  	else
  #endif
! 	{
! 	    if (root_inode.st_ino != EFS_ROOTINO) {
! 		Log("%s is not root of a filesystem\n", mountedOn);
! 		return -1;
! 	    }
  	    return efs_ListViceInodes(devname, mountedOn, resultFile,
! 				     judgeInode, judgeParam,
  				     forcep, forceR, wpath);
  	}
  }
  
  #else /* AFS_SGI_ENV */
--- 1048,1065 ----
  	}
  	else
  #endif
! #ifdef AFS_SGI_EFS_IOPS_ENV
! 	  if (root_inode.st_ino == EFS_ROOTINO) {
  	    return efs_ListViceInodes(devname, mountedOn, resultFile,
! 				      judgeInode, judgeParam,
  				     forcep, forceR, wpath);
  	}
+ 	else
+ #endif
+ 	  {
+ 	      Log("%s is not root of a filesystem\n", mountedOn);
+ 	      return -1;
+ 	  }
  }
  
  #else /* AFS_SGI_ENV */
Index: openafs/src/vol/partition.c
diff -c openafs/src/vol/partition.c:1.2.2.1 openafs/src/vol/partition.c:1.2.2.2
*** openafs/src/vol/partition.c:1.2.2.1	Fri Jan 19 04:53:31 2001
--- openafs/src/vol/partition.c	Tue Mar  6 17:22:52 2001
***************
*** 179,185 ****
--- 179,189 ----
      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);
Index: openafs/src/vol/volume.c
diff -c openafs/src/vol/volume.c:1.2.2.2 openafs/src/vol/volume.c:1.2.2.3
*** openafs/src/vol/volume.c:1.2.2.2	Fri Jan 19 04:06:02 2001
--- openafs/src/vol/volume.c	Tue Mar  6 16:10:53 2001
***************
*** 72,84 ****
  #if defined(AFS_SGI_ENV)
  #include <fcntl.h>
  #include <mntent.h>
! #ifndef AFS_SGI_XFS_IOPS_ENV
  #define ROOTINO EFS_ROOTINO
- #endif
- /*
  #include <sys/fs/efs.h>
! */
! #include "../sgiefs/efs.h" /* until 5.1 release */
  
  #else
  #ifndef AFS_LINUX20_ENV
--- 72,83 ----
  #if defined(AFS_SGI_ENV)
  #include <fcntl.h>
  #include <mntent.h>
! #ifdef AFS_SGI_EFS_IOPS_ENV
  #define ROOTINO EFS_ROOTINO
  #include <sys/fs/efs.h>
! #include "../sgiefs/efs.h" /* until 5.1 release */ 
! #endif
! 
  
  #else
  #ifndef AFS_LINUX20_ENV
Index: openafs/src/vol/xfs_size_check.c
diff -c openafs/src/vol/xfs_size_check.c:1.2 openafs/src/vol/xfs_size_check.c:1.2.2.1
*** openafs/src/vol/xfs_size_check.c:1.2	Sat Nov  4 05:06:29 2000
--- openafs/src/vol/xfs_size_check.c	Tue Mar  6 16:10:54 2001
***************
*** 19,25 ****
--- 19,27 ----
  #include <fcntl.h>
  #include <mntent.h>
  #include "partition.h"
+ #ifdef AFS_SGI_EFS_IOPS_ENV
  #include "../sgiefs/efs.h"
+ #endif
  #include <afs/xfsattrs.h>
  
  char *prog = "xfs_size_check";
Index: openafs/src/volser/Makefile
diff -c openafs/src/volser/Makefile:1.2 openafs/src/volser/Makefile:1.2.2.1
*** openafs/src/volser/Makefile:1.2	Sat Nov  4 05:06:31 2000
--- openafs/src/volser/Makefile	Tue Mar  6 16:11:02 2001
***************
*** 107,116 ****
                  *linux*) \
                          ${CC} ${DBUG} -o volserver $(SOBJS) $(HACKS) \
  				${LDFLAGS} $(LIBS) ${XLIBS} ;; \
-                 sgi_*) \
-                         ${CC} ${DBUG} -o volserver $(SOBJS) $(HACKS) \
- 				${LDFLAGS} $(LIBS) ${XLIBS} \
- 				../sgiefs/libefs.a ;; \
                  *) \
                          ${CC} ${DBUG} -g -o volserver $(SOBJS) $(HACKS) \
  				${LDFLAGS} $(LIBS) ${XLIBS} ;; \
--- 107,112 ----
