Index: openafs/src/WINNT/afsd/afsd.c
diff -c openafs/src/WINNT/afsd/afsd.c:1.2 openafs/src/WINNT/afsd/afsd.c:1.2.8.1
*** openafs/src/WINNT/afsd/afsd.c:1.2	Sat Nov  4 05:01:34 2000
--- openafs/src/WINNT/afsd/afsd.c	Fri Mar 14 15:29:34 2003
***************
*** 148,154 ****
  	main_rect.right  = GetDeviceCaps(hDC, HORZRES);
  	main_rect.top    = GetDeviceCaps(hDC, LOGPIXELSY) / 4;   /* 1/4 inch */
  	ReleaseDC(hWnd, hDC);
! 	main_rect.bottom = rect.top + nLineHeight;
  
  	osi_InitPanic(afsd_notifier);
  
--- 148,154 ----
  	main_rect.right  = GetDeviceCaps(hDC, HORZRES);
  	main_rect.top    = GetDeviceCaps(hDC, LOGPIXELSY) / 4;   /* 1/4 inch */
  	ReleaseDC(hWnd, hDC);
! 	main_rect.bottom = main_rect.top + nLineHeight;
  
  	osi_InitPanic(afsd_notifier);
  
Index: openafs/src/WINNT/afsd/cm_callback.c
diff -c openafs/src/WINNT/afsd/cm_callback.c:1.4.2.3 openafs/src/WINNT/afsd/cm_callback.c:1.4.2.5
*** openafs/src/WINNT/afsd/cm_callback.c:1.4.2.3	Wed Jul 10 15:38:54 2002
--- openafs/src/WINNT/afsd/cm_callback.c	Fri Mar 14 14:39:34 2003
***************
*** 112,117 ****
--- 112,118 ----
  			smb_NotifyChange(0,
  			 FILE_NOTIFY_GENERIC_FILE_FILTER,
  			 dscp, NULL, NULL, TRUE);
+ 		if (dscp) cm_ReleaseSCache(dscp);
  	}
  }
  
***************
*** 855,858 ****
--- 856,867 ----
                  }
          }
          lock_ReleaseWrite(&cm_scacheLock);
+ }
+ 
+ /* debug interface: not implemented */
+ int SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
+ 			  char **a_name, serverList *a_hosts)
+ {
+     /* XXXX */
+     return RXGEN_OPCODE;
  }
Index: openafs/src/WINNT/afsd/cm_conn.c
diff -c openafs/src/WINNT/afsd/cm_conn.c:1.4.4.1 openafs/src/WINNT/afsd/cm_conn.c:1.4.4.2
*** openafs/src/WINNT/afsd/cm_conn.c:1.4.4.1	Wed Dec  4 09:20:47 2002
--- openafs/src/WINNT/afsd/cm_conn.c	Fri Mar 14 14:49:00 2003
***************
*** 18,24 ****
  #include <osi.h>
  #include <rx/rx.h>
  #ifndef DJGPP
! #include <rxkad.h>
  #else
  #include <rx/rxkad.h>
  #endif
--- 18,24 ----
  #include <osi.h>
  #include <rx/rx.h>
  #ifndef DJGPP
! #include <rx/rxkad.h>
  #else
  #include <rx/rxkad.h>
  #endif
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.5.4.3 openafs/src/WINNT/afsd/cm_ioctl.c:1.5.4.6
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.5.4.3	Wed Nov 21 01:45:40 2001
--- openafs/src/WINNT/afsd/cm_ioctl.c	Fri Mar 14 15:00:44 2003
***************
*** 30,36 ****
  #include "smb.h"
  
  #ifndef DJGPP
! #include <rxkad.h>
  #include "afsrpc.h"
  #else
  #include <rx/rxkad.h>
--- 30,36 ----
  #include "smb.h"
  
  #ifndef DJGPP
! #include <rx/rxkad.h>
  #include "afsrpc.h"
  #else
  #include <rx/rxkad.h>
***************
*** 1735,1741 ****
  			 * leading "/afs" when writing out the submount.
  			 */
  			WritePrivateProfileString("AFS Submounts",
! 					submountreqp, &afspath[strlen("/afs")],
  					"afsdsbmt.ini");
  
  			strcpy(ioctlp->outDatap, submountreqp);
--- 1735,1743 ----
  			 * leading "/afs" when writing out the submount.
  			 */
  			WritePrivateProfileString("AFS Submounts",
! 					submountreqp, 
! 					(strlen(&afspath[strlen("/afs")])) ?
! 						  &afspath[strlen("/afs")]:"/",
  					"afsdsbmt.ini");
  
  			strcpy(ioctlp->outDatap, submountreqp);
***************
*** 1848,1855 ****
  	sprintf(ioctlp->outDatap, "auto%ld", nextAutoSubmount);
  
  	WritePrivateProfileString("AFS Submounts", ioctlp->outDatap,
! 					&afspath[lstrlen("/afs")],
! 					"afsdsbmt.ini");
  
  	ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
  	lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
--- 1850,1858 ----
  	sprintf(ioctlp->outDatap, "auto%ld", nextAutoSubmount);
  
  	WritePrivateProfileString("AFS Submounts", ioctlp->outDatap,
! 				  (strlen(&afspath[lstrlen("/afs")])) ? 
! 				  &afspath[lstrlen("/afs")]:"/",
! 				  "afsdsbmt.ini");
  
  	ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
  	lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
Index: openafs/src/WINNT/afsd/cm_rpc.c
diff -c openafs/src/WINNT/afsd/cm_rpc.c:1.3 openafs/src/WINNT/afsd/cm_rpc.c:1.3.4.2
*** openafs/src/WINNT/afsd/cm_rpc.c:1.3	Mon Apr 30 02:48:05 2001
--- openafs/src/WINNT/afsd/cm_rpc.c	Fri Mar 14 14:49:00 2003
***************
*** 26,32 ****
  
  #include "smb.h"
  
! #include <rxkad.h>
  
  /*
   * The motivation for this whole module is that in transmitting tokens
--- 26,32 ----
  
  #include "smb.h"
  
! #include <rx/rxkad.h>
  
  /*
   * The motivation for this whole module is that in transmitting tokens
***************
*** 81,95 ****
  	te = tokenEvents;
  	ltep = &tokenEvents;
  	while (te) {
! 		if (UuidEqual((UUID *)&uuid, (UUID *)&te->uuid, &status))
  			*ltep = te->next;
  			lock_ReleaseMutex(&tokenEventLock);
  			memcpy(sessionKey, te->sessionKey,
  				sizeof(te->sessionKey));
  			free(te);
  			return TRUE;
! 		ltep = &te->next;
! 		te = te->next;
  	}
  	lock_ReleaseMutex(&tokenEventLock);
  	return FALSE;
--- 81,96 ----
  	te = tokenEvents;
  	ltep = &tokenEvents;
  	while (te) {
! 	    if (UuidEqual((UUID *)&uuid, (UUID *)&te->uuid, &status)) {
  			*ltep = te->next;
  			lock_ReleaseMutex(&tokenEventLock);
  			memcpy(sessionKey, te->sessionKey,
  				sizeof(te->sessionKey));
  			free(te);
  			return TRUE;
! 	    }
! 	    ltep = &te->next;
! 	    te = te->next;
  	}
  	lock_ReleaseMutex(&tokenEventLock);
  	return FALSE;
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.5.4.3 openafs/src/WINNT/afsd/smb3.c:1.5.4.5
*** openafs/src/WINNT/afsd/smb3.c:1.5.4.3	Wed Dec  4 09:20:47 2002
--- openafs/src/WINNT/afsd/smb3.c	Fri Mar 14 14:45:58 2003
***************
*** 2363,2370 ****
           * 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);
  	else {
--- 2363,2371 ----
           * or if something went wrong, close the search.
           */
          /* ((searchFlags & 1) || ((searchFlags & 2) && eos) */
! 	if ((searchFlags & 1) || (returnedNames == 0) || ((searchFlags & 2) &&
! 							  eos) || code != 0)
! 	    smb_DeleteDirSearch(dsp);
  	if (code)
          	smb_SendTran2Error(vcp, p, opx, code);
  	else {
***************
*** 3136,3142 ****
  	    || (fidflags & (SMB_FID_OPENDELETE | SMB_FID_OPENWRITE))) {
  		/* look up parent directory */
  		code = cm_NameI(baseDirp, spacep->data,
! 				CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD,
  				userp, tidPathp, &req, &dscp);
  
  		if (baseFid != 0) smb_ReleaseFID(baseFidp);
--- 3137,3143 ----
  	    || (fidflags & (SMB_FID_OPENDELETE | SMB_FID_OPENWRITE))) {
  		/* look up parent directory */
  		code = cm_NameI(baseDirp, spacep->data,
! 				CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_CHECKPATH,
  				userp, tidPathp, &req, &dscp);
  
  		if (baseFid != 0) smb_ReleaseFID(baseFidp);
Index: openafs/src/WINNT/client_creds/shortcut.cpp
diff -c openafs/src/WINNT/client_creds/shortcut.cpp:1.2.8.1 openafs/src/WINNT/client_creds/shortcut.cpp:1.2.8.2
*** openafs/src/WINNT/client_creds/shortcut.cpp:1.2.8.1	Wed Dec  4 09:20:48 2002
--- openafs/src/WINNT/client_creds/shortcut.cpp	Fri Mar 14 15:30:09 2003
***************
*** 13,19 ****
  }
  
  #include <objbase.h>
- #include <initguid.h>
  #include <windows.h>
  #include <windowsx.h>
  #undef INITGUID
--- 13,18 ----
Index: openafs/src/WINNT/client_exp/shell_ext.cpp
diff -c openafs/src/WINNT/client_exp/shell_ext.cpp:1.2.8.2 openafs/src/WINNT/client_exp/shell_ext.cpp:1.2.8.3
*** openafs/src/WINNT/client_exp/shell_ext.cpp:1.2.8.2	Tue Dec 10 17:55:57 2002
--- openafs/src/WINNT/client_exp/shell_ext.cpp	Sat Dec 14 23:34:45 2002
***************
*** 14,19 ****
--- 14,20 ----
  
  #include <afxpriv.h>
  #include "stdafx.h"
+ #include <atlconv.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include "afs_shl_ext.h"
Index: openafs/src/afs/afs.h
diff -c openafs/src/afs/afs.h:1.9.2.10 openafs/src/afs/afs.h:1.9.2.12
*** openafs/src/afs/afs.h:1.9.2.10	Tue Sep 10 18:33:26 2002
--- openafs/src/afs/afs.h	Thu Mar  6 10:25:35 2003
***************
*** 181,209 ****
      struct AFSFid fid;
  };
  
! 
! #define	LOCALCELL	    1	/* local cell's number is always 1 */
  
  /* cell flags */
! #define	CPrimary	    1	    /* on if this is the primary cell */
! #define	CNoSUID		    2	    /* 1 if no suid progs can run from this cell */
! #define CHasVolRef	   16	    /* Volumes were referenced in this cell*/
! #define CLinkedCell	   32
! #define CAlias		   64	    /* This cell entry is an alias */
  
  struct cell {
!     struct afs_q lruq;			     /* lru q next and prev */
!     afs_int32 cell;				    /* unique id assigned by venus */
      char *cellName;			    /* char string name of cell */
!     struct server *cellHosts[MAXCELLHOSTS]; /* volume *location* hosts for this cell */
      struct cell *lcellp;		    /* Associated linked cell */
      u_short fsport;			    /* file server port */
      u_short vlport;			    /* volume server port */
      short states;			    /* state flags */
-     short cellIndex;			    /* relative index number per cell */
-     short realcellIndex;		    /* as above but ignoring aliases */
      time_t timeout;			    /* data expire time, if non-zero */
!     char *realName;			    /* who this cell is an alias for */
  };
  
  #define	afs_PutCell(cellp, locktype)
--- 181,223 ----
      struct AFSFid fid;
  };
  
! /* cellinfo file magic number */
! #define AFS_CELLINFO_MAGIC	0xf32817cd
  
  /* cell flags */
! #define	CNoSUID			0x02	/* disable suid bit for this cell */
! #define CLinkedCell4		0x04	/* reserved for ADDCELL2 pioctl */
! #define CNoAFSDB		0x08	/* never bother trying AFSDB */
! #define CHasVolRef		0x10	/* volumes were referenced */
! #define CLinkedCell		0x20	/* has a linked cell in lcellp */
  
  struct cell {
!     struct afs_q lruq;			    /* lru q next and prev */
      char *cellName;			    /* char string name of cell */
!     afs_int32 cellIndex;		    /* sequence number */
!     afs_int32 cellNum;			    /* semi-permanent cell number */
!     struct server *cellHosts[MAXCELLHOSTS]; /* volume *location* hosts */
      struct cell *lcellp;		    /* Associated linked cell */
      u_short fsport;			    /* file server port */
      u_short vlport;			    /* volume server port */
      short states;			    /* state flags */
      time_t timeout;			    /* data expire time, if non-zero */
!     struct cell_name *cnamep;		    /* pointer to our cell_name */
!     afs_rwlock_t lock;			    /* protects cell data */
! };
! 
! struct cell_name {
!     struct cell_name *next;
!     afs_int32 cellnum;
!     char *cellname;
!     char used;
! };
! 
! struct cell_alias {
!     struct cell_alias *next;
!     afs_int32 index;
!     char *alias;
!     char *cell;
  };
  
  #define	afs_PutCell(cellp, locktype)
***************
*** 992,998 ****
  extern struct conn	    *afs_Conn();
  extern struct conn	    *afs_ConnByHost();
  extern struct conn	    *afs_ConnByMHosts();
- extern afs_int32		    afs_NewCell();
  extern struct dcache	    *afs_GetDCache();
  extern struct dcache	    *afs_FindDCache();
  extern struct dcache	    *afs_NewDCache();
--- 1006,1011 ----
Index: openafs/src/afs/afs_analyze.c
diff -c openafs/src/afs/afs_analyze.c:1.6.4.3 openafs/src/afs/afs_analyze.c:1.6.4.4
*** openafs/src/afs/afs_analyze.c:1.6.4.3	Wed Aug 21 16:53:21 2002
--- openafs/src/afs/afs_analyze.c	Thu Mar  6 09:53:24 2003
***************
*** 13,19 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_analyze.c,v 1.6.4.3 2002/08/21 20:53:21 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 13,19 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_analyze.c,v 1.6.4.4 2003/03/06 14:53:24 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 179,185 ****
      do {
          VSleep(2);	/* Better safe than sorry. */
  	tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport,
! 				 tcell->cell, &treq, SHARED_LOCK);
  	if (tconn) {
  	    if (tconn->srvr->server->flags & SNO_LHOSTS) {
  		type = 0;
--- 179,185 ----
      do {
          VSleep(2);	/* Better safe than sorry. */
  	tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport,
! 				 tcell->cellNum, &treq, SHARED_LOCK);
  	if (tconn) {
  	    if (tconn->srvr->server->flags & SNO_LHOSTS) {
  		type = 0;
***************
*** 392,399 ****
  	    if (aerrP)
  		(aerrP->err_Network)++;
  	    if (hm_retry_int && !(areq->flags & O_NONBLOCK) &&  /* "hard" mount */
! 		((afid && afid->Cell == LOCALCELL) || 
! 		 (cellp && cellp->cell == LOCALCELL))) { 
  		if (!afid) {
  		    afs_warnuser("afs: hard-mount waiting for a vlserver to return to service\n");
  		    VSleep(hm_retry_int);
--- 392,399 ----
  	    if (aerrP)
  		(aerrP->err_Network)++;
  	    if (hm_retry_int && !(areq->flags & O_NONBLOCK) &&  /* "hard" mount */
! 		((afid && afs_IsPrimaryCellNum(afid->Cell)) || 
! 		 (cellp && afs_IsPrimaryCell(cellp)))) { 
  		if (!afid) {
  		    afs_warnuser("afs: hard-mount waiting for a vlserver to return to service\n");
  		    VSleep(hm_retry_int);
***************
*** 492,498 ****
  	if (aerrP)
  	    (aerrP->err_Protection)++;
  
! 	tu = afs_FindUser(areq->uid, tsp->cell->cell, READ_LOCK);
  	if (tu) {
  	    if ((acode == VICETOKENDEAD) || (acode == RXKADEXPIRED))
  		afs_warnuser("afs: Tokens for user of AFS id %d for cell %s have expired\n", 
--- 492,498 ----
  	if (aerrP)
  	    (aerrP->err_Protection)++;
  
! 	tu = afs_FindUser(areq->uid, tsp->cell->cellNum, READ_LOCK);
  	if (tu) {
  	    if ((acode == VICETOKENDEAD) || (acode == RXKADEXPIRED))
  		afs_warnuser("afs: Tokens for user of AFS id %d for cell %s have expired\n", 
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.14.2.14 openafs/src/afs/afs_call.c:1.14.2.18
*** openafs/src/afs/afs_call.c:1.14.2.14	Wed Sep 11 12:17:31 2002
--- openafs/src/afs/afs_call.c	Sun Mar 23 14:47:53 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_call.c,v 1.14.2.14 2002/09/11 16:17:31 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_call.c,v 1.14.2.18 2003/03/23 19:47:53 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 83,88 ****
--- 83,89 ----
  static int afs_Go_Done = 0;
  extern struct interfaceAddr afs_cb_interface;
  static int afs_RX_Running = 0;
+ static int afs_InitSetup_done = 0;
  
  static int
  Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval);
***************
*** 99,104 ****
--- 100,108 ----
      extern void afs_InitStats();
      int code;
  
+     if (afs_InitSetup_done)
+ 	return;
+ 
  #ifndef AFS_NOSTATS
      /*
       * Set up all the AFS statistics variables.  This should be done
***************
*** 121,126 ****
--- 125,133 ----
      /* resource init creates the services */
      afs_ResourceInit(preallocs);
  
+     afs_InitSetup_done = 1;
+     afs_osi_Wakeup(&afs_InitSetup_done);
+ 
      return code;
  }
  #if defined(AFS_LINUX24_ENV) && defined(COMPLETION_H_EXISTS)
***************
*** 138,143 ****
--- 145,151 ----
       daemonize(); /* doesn't do much, since we were forked from keventd, but
                       does call mm_release, which wakes up our parent (since it
                       used CLONE_VFORK) */
+      reparent_to_init();
       afs_osi_MaskSignals();
       switch (parm) {
       case AFSOP_START_RXCALLBACK:
***************
*** 294,299 ****
--- 302,312 ----
  long parm, parm2, parm3, parm4, parm5, parm6;
  {
      afs_int32 code = 0;
+ #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     size_t bufferSize;	
+ #else /* AFS_SGI61_ENV */
+     u_int bufferSize;	
+ #endif /* AFS_SGI61_ENV */
  
      AFS_STATCNT(afs_syscall_call);
  #ifdef	AFS_SUN5_ENV
***************
*** 377,397 ****
  #endif
      else if (parm == AFSOP_START_AFS) {
  	/* afs daemon */
- 	afs_int32 temp;
- 
  	if (AFS_Running) goto out;
  	AFS_Running = 1;
  	while (afs_initState < AFSOP_START_AFS) 
  	    afs_osi_Sleep(&afs_initState);
  
- #if defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
- 	temp = AFS_MINBUFFERS;  /* Should fix this soon */
- #else
- 	temp = ((afs_bufferpages * NBPG)>>11);	/* number of 2k buffers we could get from all of the buffer space */
- 	temp = temp>>2;	/* don't take more than 25% (our magic parameter) */
- 	if (temp < AFS_MINBUFFERS) temp = AFS_MINBUFFERS;   /* although we really should have this many */
- #endif
- 	DInit(temp);
  	afs_initState = AFSOP_START_BKG;
  	afs_osi_Wakeup(&afs_initState);
  	afs_osi_Invisible();
--- 390,400 ----
***************
*** 452,464 ****
      }
  #endif	
  #endif
      else if (parm == AFSOP_ADDCELL) {
  	/* add a cell.  Parameter 2 is 8 hosts (in net order),  parm 3 is the null-terminated
  	 name.  Parameter 4 is the length of the name, including the null.  Parm 5 is the
  	 home cell flag (0x1 bit) and the nosuid flag (0x2 bit) */
  	struct afsop_cell tcell;
  
- 	while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState);
  	AFS_COPYIN((char *)parm2, (char *)tcell.hosts, sizeof(tcell.hosts), code);
  	if (!code) {
  	    if (parm4 > sizeof(tcell.cellName)) 
--- 455,485 ----
      }
  #endif	
  #endif
+     else if (parm == AFSOP_BASIC_INIT) {
+ 	afs_int32 temp;
+ 
+ 	while (!afs_InitSetup_done)
+ 	    afs_osi_Sleep(&afs_InitSetup_done);
+ 
+ #if defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ 	temp = AFS_MINBUFFERS;  /* Should fix this soon */
+ #else
+ 	/* number of 2k buffers we could get from all of the buffer space */
+ 	temp = ((afs_bufferpages * NBPG)>>11);
+ 	temp = temp>>2;	/* don't take more than 25% (our magic parameter) */
+ 	if (temp < AFS_MINBUFFERS)
+ 	    temp = AFS_MINBUFFERS; /* though we really should have this many */
+ #endif
+ 	DInit(temp);
+ 	afs_rootFid.Fid.Volume = 0;
+ 	code = 0;
+     }
      else if (parm == AFSOP_ADDCELL) {
  	/* add a cell.  Parameter 2 is 8 hosts (in net order),  parm 3 is the null-terminated
  	 name.  Parameter 4 is the length of the name, including the null.  Parm 5 is the
  	 home cell flag (0x1 bit) and the nosuid flag (0x2 bit) */
  	struct afsop_cell tcell;
  
  	AFS_COPYIN((char *)parm2, (char *)tcell.hosts, sizeof(tcell.hosts), code);
  	if (!code) {
  	    if (parm4 > sizeof(tcell.cellName)) 
***************
*** 467,488 ****
  		AFS_COPYIN((char *)parm3, tcell.cellName, parm4, code);
  		if (!code) 
  		    afs_NewCell(tcell.cellName, tcell.hosts, parm5,
! 				(char *)0, (u_short)0, (u_short)0, (int)0);
  	    }
  	}
      } else if (parm == AFSOP_ADDCELL2) {
  	struct afsop_cell tcell;
  	char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ), *lcnamep = 0;
  	char *tbuffer1 = osi_AllocSmallSpace(AFS_SMALLOCSIZ), *cnamep = 0;
- #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
- 	size_t bufferSize;	
- #else /* AFS_SGI61_ENV */
- 	u_int bufferSize;	
- #endif /* AFS_SGI61_ENV */
  	int cflags = parm4;
  
! 	/* wait for basic init */
  	while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState);
  
  	AFS_COPYIN((char *)parm2, (char *)tcell.hosts, sizeof(tcell.hosts), code);
  	if (!code) {
--- 488,506 ----
  		AFS_COPYIN((char *)parm3, tcell.cellName, parm4, code);
  		if (!code) 
  		    afs_NewCell(tcell.cellName, tcell.hosts, parm5,
! 			        NULL, 0, 0, 0);
  	    }
  	}
      } else if (parm == AFSOP_ADDCELL2) {
  	struct afsop_cell tcell;
  	char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ), *lcnamep = 0;
  	char *tbuffer1 = osi_AllocSmallSpace(AFS_SMALLOCSIZ), *cnamep = 0;
  	int cflags = parm4;
  
! #if 0
! 	/* wait for basic init - XXX can't find any reason we need this? */
  	while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState);
+ #endif
  
  	AFS_COPYIN((char *)parm2, (char *)tcell.hosts, sizeof(tcell.hosts), code);
  	if (!code) {
***************
*** 497,503 ****
  		}
  		if (!code)
  		    afs_NewCell(tbuffer1, tcell.hosts, cflags, 
! 				lcnamep, (u_short)0, (u_short)0, (int)0);
  	    }
  	}
  	osi_FreeSmallSpace(tbuffer);
--- 515,521 ----
  		}
  		if (!code)
  		    afs_NewCell(tbuffer1, tcell.hosts, cflags, 
! 				lcnamep, 0, 0, 0);
  	    }
  	}
  	osi_FreeSmallSpace(tbuffer);
***************
*** 509,542 ****
  	 * parm2 is the alias name
  	 * parm3 is the real cell name
  	 */
- #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
- 	size_t bufferSize;
- #else /* AFS_SGI61_ENV */
- 	u_int bufferSize;	
- #endif /* AFS_SGI61_ENV */
  	char *aliasName = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
  	char *cellName = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
  
  	AFS_COPYINSTR((char *)parm2, aliasName, AFS_SMALLOCSIZ, &bufferSize, code);
  	if (!code) AFS_COPYINSTR((char *)parm3, cellName, AFS_SMALLOCSIZ, &bufferSize, code);
! 	if (!code) afs_NewCell(aliasName,	/* new entry name */
! 			       0,		/* host list */
! 			       CAlias,		/* flags */
! 			       (char *) 0,	/* linked cell */
! 			       0, 0,		/* fs & vl ports */
! 			       0,		/* timeout */
! 			       cellName);	/* real cell name */
  
  	osi_FreeSmallSpace(aliasName);
  	osi_FreeSmallSpace(cellName);
      }
      else if (parm == AFSOP_CACHEINIT) {
  	struct afs_cacheParams cparms;
  
  	if (afs_CacheInit_Done) goto out;
  
- 	/* wait for basic init */
- 	while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState);
  	AFS_COPYIN((char *)parm2, (caddr_t) &cparms, sizeof(cparms), code);
  	if (code) {
  #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined (AFS_SGI64_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
--- 527,559 ----
  	 * parm2 is the alias name
  	 * parm3 is the real cell name
  	 */
  	char *aliasName = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
  	char *cellName = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
  
  	AFS_COPYINSTR((char *)parm2, aliasName, AFS_SMALLOCSIZ, &bufferSize, code);
  	if (!code) AFS_COPYINSTR((char *)parm3, cellName, AFS_SMALLOCSIZ, &bufferSize, code);
! 	if (!code) afs_NewCellAlias(aliasName, cellName);
  
  	osi_FreeSmallSpace(aliasName);
  	osi_FreeSmallSpace(cellName);
      }
+     else if (parm == AFSOP_SET_THISCELL) {
+ 	/*
+ 	 * Call arguments:
+ 	 * parm2 is the primary cell name
+ 	 */
+ 	char *cell = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
+ 
+ 	AFS_COPYINSTR((char *) parm2, cell, AFS_SMALLOCSIZ, &bufferSize, code);
+ 	if (!code)
+ 	    afs_SetPrimaryCell(cell);
+ 	osi_FreeSmallSpace(cell);
+     }
      else if (parm == AFSOP_CACHEINIT) {
  	struct afs_cacheParams cparms;
  
  	if (afs_CacheInit_Done) goto out;
  
  	AFS_COPYIN((char *)parm2, (caddr_t) &cparms, sizeof(cparms), code);
  	if (code) {
  #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined (AFS_SGI64_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
***************
*** 585,596 ****
  	code = afs_InitCacheFile((char *) 0, ainode);
      }
      else if (parm == AFSOP_ROOTVOLUME) {
- #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
- 	size_t bufferSize;
- #else /* AFS_SGI61_ENV */
- 	u_int bufferSize;
- #endif /* AFS_SGI61_ENV */
- 
  	/* wait for basic init */
  	while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState);
  
--- 602,607 ----
***************
*** 600,628 ****
  	}
  	else code = 0;
      }
!     else if (parm == AFSOP_CACHEFILE || parm == AFSOP_CACHEINFO ||
! 	      parm == AFSOP_VOLUMEINFO || parm == AFSOP_AFSLOG) {
  	char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
- #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
- 	size_t bufferSize;
- #else /* AFS_SGI61_ENV */
- 	u_int bufferSize;
- #endif /* AFS_SGI61_ENV */
  
- 	/* wait for basic init */
- 	while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState);
  	code = 0;
! 	AFS_COPYINSTR((char *)parm2, tbuffer, AFS_SMALLOCSIZ, &bufferSize, code);
  	if (code) {
  	    osi_FreeSmallSpace(tbuffer);
  	    goto out;
  	}
  	if (!code) {
! 	    tbuffer[AFS_SMALLOCSIZ-1] = 0;	/* null-terminate the name */
! 	    /* we now have the cache dir copied in.  Call the cache init routines */
! 	    if (parm == AFSOP_CACHEFILE) code = afs_InitCacheFile(tbuffer, 0);
! 	    else if (parm == AFSOP_CACHEINFO) code = afs_InitCacheInfo(tbuffer);
! 	    else if (parm == AFSOP_VOLUMEINFO) code = afs_InitVolumeInfo(tbuffer);
  	}
  	osi_FreeSmallSpace(tbuffer);
      }
--- 611,641 ----
  	}
  	else code = 0;
      }
!     else if (parm == AFSOP_CACHEFILE ||
! 	     parm == AFSOP_CACHEINFO ||
! 	     parm == AFSOP_VOLUMEINFO ||
! 	     parm == AFSOP_AFSLOG ||
! 	     parm == AFSOP_CELLINFO) {
  	char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
  
  	code = 0;
! 	AFS_COPYINSTR((char *) parm2, tbuffer, AFS_SMALLOCSIZ,
! 		      &bufferSize, code);
  	if (code) {
  	    osi_FreeSmallSpace(tbuffer);
  	    goto out;
  	}
  	if (!code) {
! 	    tbuffer[AFS_SMALLOCSIZ-1] = '\0';	/* null-terminate the name */
! 	    /* We have the cache dir copied in.  Call the cache init routine */
! 	    if (parm == AFSOP_CACHEFILE)
! 		code = afs_InitCacheFile(tbuffer, 0);
! 	    else if (parm == AFSOP_CACHEINFO)
! 		code = afs_InitCacheInfo(tbuffer);
! 	    else if (parm == AFSOP_VOLUMEINFO)
! 		code = afs_InitVolumeInfo(tbuffer);
! 	    else if (parm == AFSOP_CELLINFO)
! 		code = afs_InitCellInfo(tbuffer);
  	}
  	osi_FreeSmallSpace(tbuffer);
      }
***************
*** 827,833 ****
  	AFS_COPYIN((afs_int32 *)parm2, cellname, cellLen, code);
  	AFS_COPYIN((afs_int32 *)parm3, kmsg, kmsgLen, code);
  	if (!code) {
! 	    code = afs_AfsdbHandler(cellname, cellLen, kmsg);
  	    if (*cellname == 1) *cellname = 0;
  	    if (code == -2) {	/* Shutting down? */
  		*cellname = 1;
--- 840,846 ----
  	AFS_COPYIN((afs_int32 *)parm2, cellname, cellLen, code);
  	AFS_COPYIN((afs_int32 *)parm3, kmsg, kmsgLen, code);
  	if (!code) {
! 	    code = afs_AFSDBHandler(cellname, cellLen, kmsg);
  	    if (*cellname == 1) *cellname = 0;
  	    if (code == -2) {	/* Shutting down? */
  		*cellname = 1;
***************
*** 1451,1457 ****
      }
  #ifdef AFS_AFSDB_ENV
      afs_warn("AFSDB... ");
!     afs_StopAfsdb();
      while (afs_termState == AFSOP_STOP_AFSDB)
  	afs_osi_Sleep(&afs_termState);
  #endif
--- 1464,1470 ----
      }
  #ifdef AFS_AFSDB_ENV
      afs_warn("AFSDB... ");
!     afs_StopAFSDB();
      while (afs_termState == AFSOP_STOP_AFSDB)
  	afs_osi_Sleep(&afs_termState);
  #endif
Index: openafs/src/afs/afs_callback.c
diff -c openafs/src/afs/afs_callback.c:1.6.2.8 openafs/src/afs/afs_callback.c:1.6.2.10
*** openafs/src/afs/afs_callback.c:1.6.2.8	Sat Jun  8 07:00:28 2002
--- openafs/src/afs/afs_callback.c	Thu Mar  6 10:39:43 2003
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_callback.c,v 1.6.2.8 2002/06/08 11:00:28 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
--- 16,22 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_callback.c,v 1.6.2.10 2003/03/06 15:39:43 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
***************
*** 1137,1143 ****
  #endif /* RX_ENABLE_LOCKS */
      AFS_STATCNT(SRXAFSCB_GetCellServDB);
  
!     tcell = afs_GetCellByIndex(a_index, READ_LOCK, 0);
  
      if (!tcell) {
        i = 0;
--- 1137,1143 ----
  #endif /* RX_ENABLE_LOCKS */
      AFS_STATCNT(SRXAFSCB_GetCellServDB);
  
!     tcell = afs_GetCellByIndex(a_index, READ_LOCK);
  
      if (!tcell) {
        i = 0;
***************
*** 1203,1209 ****
  {
      int plen;
      struct cell *tcell;
-     struct afs_q *cq, *tq;
      char *t_name, *p_name = NULL;
  
  #ifdef RX_ENABLE_LOCKS
--- 1203,1208 ----
***************
*** 1214,1240 ****
      /* Search the list for the primary cell. Cell number 1 is only
       * the primary cell is when no other cell is explicitly marked as
       * the primary cell.  */
!     ObtainReadLock(&afs_xcell);
! 
!     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
!         tq = QNext(cq);
! 	tcell = QTOC(cq);
! 	if (tcell->states & CPrimary) {
! 	    p_name = tcell->cellName;
! 	    break;
! 	}
!         if (tcell->cell == 1) {
! 	    p_name = tcell->cellName;
! 	}
!     }
! 
      if (p_name)
  	plen = strlen(p_name);
      else
  	plen = 0;
      t_name = (char *)afs_osi_Alloc(plen+1);
      if (t_name == NULL) {
!         ReleaseReadLock(&afs_xcell);
  #ifdef RX_ENABLE_LOCKS
  	AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
--- 1213,1228 ----
      /* Search the list for the primary cell. Cell number 1 is only
       * the primary cell is when no other cell is explicitly marked as
       * the primary cell.  */
!     tcell = afs_GetPrimaryCell(READ_LOCK);
!     if (tcell)
! 	p_name = tcell->cellName;
      if (p_name)
  	plen = strlen(p_name);
      else
  	plen = 0;
      t_name = (char *)afs_osi_Alloc(plen+1);
      if (t_name == NULL) {
! 	if (tcell) afs_PutCell(tcell, READ_LOCK);
  #ifdef RX_ENABLE_LOCKS
  	AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
***************
*** 1245,1257 ****
      if (p_name)
  	memcpy(t_name, p_name, plen);
  
-     ReleaseReadLock(&afs_xcell);
- 
  #ifdef RX_ENABLE_LOCKS
      AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
  
      *a_name = t_name;
      return 0;
  }
  
--- 1233,1244 ----
      if (p_name)
  	memcpy(t_name, p_name, plen);
  
  #ifdef RX_ENABLE_LOCKS
      AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
  
      *a_name = t_name;
+     if (tcell) afs_PutCell(tcell, READ_LOCK);
      return 0;
  }
  
***************
*** 1369,1371 ****
--- 1356,1424 ----
  
      return 0;
  }
+ 
+ /*------------------------------------------------------------------------
+  * EXPORTED SRXAFSCB_GetCellByNum
+  *
+  * Description:
+  *	Routine to get information about a cell specified by its
+  *	cell number (returned by GetCE/GetCE64).
+  *
+  * Arguments:
+  *	a_call    : Ptr to Rx call on which this request came in.
+  *	a_cellnum : Input cell number
+  *	a_name    : Output cell name (one zero byte when no such cell).
+  *	a_hosts   : Output cell database servers in host byte order.
+  *
+  * Returns:
+  *	0 on success
+  *
+  * Environment:
+  *	Nothing interesting.
+  *
+  * Side Effects:
+  *	As advertised.
+  *------------------------------------------------------------------------*/
+ 
+ int SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
+     char **a_name, serverList *a_hosts)
+ {
+     afs_int32 i, sn;
+     struct cell *tcell;
+ 
+ #ifdef RX_ENABLE_LOCKS
+     AFS_GLOCK();
+ #endif /* RX_ENABLE_LOCKS */
+     AFS_STATCNT(SRXAFSCB_GetCellByNum);
+ 
+     a_hosts->serverList_val = 0;
+     a_hosts->serverList_len = 0;
+ 
+     tcell = afs_GetCellStale(a_cellnum, READ_LOCK);
+     if (!tcell) {
+ 	*a_name = afs_strdup("");
+ #ifdef RX_ENABLE_LOCKS
+ 	AFS_GUNLOCK();
+ #endif /* RX_ENABLE_LOCKS */
+ 	return 0;
+     }
+ 
+     ObtainReadLock(&tcell->lock);
+     *a_name = afs_strdup(tcell->cellName);
+ 
+     for (sn = 0; sn < AFSMAXCELLHOSTS && tcell->cellHosts[sn]; sn++) 
+ 	;
+     a_hosts->serverList_len = sn;
+     a_hosts->serverList_val = (afs_int32 *) afs_osi_Alloc(sn*sizeof(afs_int32));
+ 
+     for (i = 0; i < sn; i++)
+ 	a_hosts->serverList_val[i] = ntohl(tcell->cellHosts[i]->addr->sa_ip);
+     ReleaseReadLock(&tcell->lock);
+     afs_PutCell(tcell, READ_LOCK);
+ 
+ #ifdef RX_ENABLE_LOCKS
+     AFS_GUNLOCK();
+ #endif /* RX_ENABLE_LOCKS */
+     return 0;
+ }
+  
Index: openafs/src/afs/afs_cell.c
diff -c openafs/src/afs/afs_cell.c:1.7.2.8 openafs/src/afs/afs_cell.c:1.7.2.9
*** openafs/src/afs/afs_cell.c:1.7.2.8	Wed Aug 21 16:53:21 2002
--- openafs/src/afs/afs_cell.c	Thu Mar  6 09:53:25 2003
***************
*** 11,533 ****
   * Implements:
   */
  #include <afsconfig.h>
! #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_cell.c,v 1.7.2.8 2002/08/21 20:53:21 shadow Exp $");
  
! #include "../afs/stds.h"
! #include "../afs/sysincludes.h"	/* Standard vendor system headers */
! 
! #if !defined(UKERNEL)
! #include <net/if.h>
! #include <netinet/in.h>
! 
! #ifdef AFS_SGI62_ENV
! #include "../h/hashing.h"
! #endif
! #if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN60_ENV)
! #include <netinet/in_var.h>
! #endif /* ! ASF_HPUX110_ENV */
! #endif /* !defined(UKERNEL) */
! 
! #include "../afs/afsincludes.h"	/* Afs-based standard headers */
! #include "../afs/afs_stats.h"   /* afs statistics */
! 
! #if	defined(AFS_SUN56_ENV)
! #include <inet/led.h>
! #include <inet/common.h>
! #if     defined(AFS_SUN58_ENV)
! #include <netinet/ip6.h>
! #endif
! #include <inet/ip.h>
! #endif
! 
! /* Exported variables */
! afs_rwlock_t afs_xcell;			/* allocation lock for cells */
! struct afs_q CellLRU;
! afs_int32 afs_cellindex=0;
! afs_int32 afs_realcellindex=0;
! afs_uint32 afs_nextCellNum = 0x100;
  
  /* Local variables. */
! struct cell *afs_rootcell = 0;
! 
! /* Handler waiting for request from client */
! static char afs_AfsdbHandlerWait;
! /* Client waiting for handler to become available or finish request */
! static char afs_AfsdbLookupWait;
! 
! /* Set to 1 when we've seen the userspace AFSDB process at least once */
! char afs_AfsdbHandlerPresent = 0;
! /* Set to 1 when there is a client interacting with the AFSDB handler.
!  * Protects the in and out variables below.  Protected by GLOCK. */
! char afs_AfsdbHandlerInuse = 0;
! /* Set to 1 when AFSDB has been shut down */
! char afs_AfsdbHandlerShutdown = 0;
! 
! /* Input to handler from the client: cell name to look up */
! char *afs_AfsdbHandler_CellName;
! /* Outputs from handler to client: cell hosts, TTL, and real cell name */
! afs_int32 *afs_AfsdbHandler_CellHosts;
! int *afs_AfsdbHandler_Timeout;
! char **afs_AfsdbHandler_RealName;
! 
! /* Client sets ReqPending to 1 whenever it queues a request for it */
! char afs_AfsdbHandler_ReqPending = 0;
! /* Handler sets Completed to 1 when it completes the client request */
! char afs_AfsdbHandler_Completed = 0;
! 
! 
! struct cell *afs_GetCellByName2();
! 
! int afs_strcasecmp(s1, s2)
!     register char *s1, *s2;
! {
!     while (*s1 && *s2) {
! 	register char c1, c2;
! 
! 	c1 = *s1++;
! 	c2 = *s2++;
! 	if (c1 >= 'A' && c1 <= 'Z') c1 += 0x20;
! 	if (c2 >= 'A' && c2 <= 'Z') c2 += 0x20;
! 	if (c1 != c2)
! 	    return c1-c2;
!     }
! 
!     return *s1 - *s2;
! }
  
  
  #ifdef AFS_AFSDB_ENV
! void afs_StopAfsdb()
  {
!     if (afs_AfsdbHandlerPresent) {
! 	afs_osi_Wakeup(&afs_AfsdbHandlerWait);
      } else {
! 	afs_AfsdbHandlerShutdown = 1;
  	afs_termState = AFSOP_STOP_RXEVENT;
      }
  }
  
! int afs_AfsdbHandler(acellName, acellNameLen, kernelMsg)
!     char *acellName;
!     int acellNameLen;
!     afs_int32 *kernelMsg;
  {
!     /* afs_syscall_call() has already grabbed the global lock */
! 
!     if (afs_AfsdbHandlerShutdown) return -2;
!     afs_AfsdbHandlerPresent = 1;
  
!     if (afs_AfsdbHandler_ReqPending) {
  	int i, hostCount;
  
  	hostCount = kernelMsg[0];
! 	*afs_AfsdbHandler_Timeout = kernelMsg[1];
! 	if (*afs_AfsdbHandler_Timeout) *afs_AfsdbHandler_Timeout += osi_Time();
! 
! 	*afs_AfsdbHandler_RealName = afs_osi_Alloc(strlen(acellName) + 1);
! 	strcpy(*afs_AfsdbHandler_RealName, acellName);
  
  	for (i=0; i<MAXCELLHOSTS; i++) {
  	    if (i >= hostCount)
! 		afs_AfsdbHandler_CellHosts[i] = 0;
  	    else
! 		afs_AfsdbHandler_CellHosts[i] = kernelMsg[2+i];
  	}
  
  	/* Request completed, wake up the relevant thread */
! 	afs_AfsdbHandler_ReqPending = 0;
! 	afs_AfsdbHandler_Completed = 1;
! 	afs_osi_Wakeup(&afs_AfsdbLookupWait);
      }
  
      /* Wait for a request */
!     while (afs_AfsdbHandler_ReqPending == 0 && afs_termState != AFSOP_STOP_AFSDB)
! 	afs_osi_Sleep(&afs_AfsdbHandlerWait);
  
      /* Check if we're shutting down */
      if (afs_termState == AFSOP_STOP_AFSDB) {
  	/* Inform anyone waiting for us that we're going away */
! 	afs_AfsdbHandlerShutdown = 1;
! 	afs_AfsdbHandlerPresent = 0;
! 	afs_osi_Wakeup(&afs_AfsdbLookupWait);
  
  	afs_termState = AFSOP_STOP_RXEVENT;
  	afs_osi_Wakeup(&afs_termState);
  	return -2;
      }
  
-     /* Copy the requested cell name into the request buffer */
-     strncpy(acellName, afs_AfsdbHandler_CellName, acellNameLen);
- 
      /* Return the lookup request to userspace */    
      return 0;
  }
- #endif
- 
  
! int afs_GetCellHostsFromDns(acellName, acellHosts, timeout, realName)
!     char *acellName;
!     afs_int32 *acellHosts;
!     int *timeout;
!     char **realName;
  {
! #ifdef AFS_AFSDB_ENV
!     char grab_glock = 0;
  
!     if (!afs_AfsdbHandlerPresent) return ENOENT;
  
-     /* Initialize host list to empty in case the handler is gone */
      *acellHosts = 0;
  
!     if (!ISAFS_GLOCK()) {
! 	grab_glock = 1;
! 	AFS_GLOCK();
!     }
! 
!     /* Wait until the AFSDB handler is available, and grab it */
!     while (afs_AfsdbHandlerInuse)
! 	afs_osi_Sleep(&afs_AfsdbLookupWait);
!     afs_AfsdbHandlerInuse = 1;
! 
!     /* Set up parameters for the handler */
!     afs_AfsdbHandler_CellName = acellName;
!     afs_AfsdbHandler_CellHosts = acellHosts;
!     afs_AfsdbHandler_Timeout = timeout;
!     afs_AfsdbHandler_RealName = realName;
! 
!     /* Wake up the AFSDB handler */
!     afs_AfsdbHandler_Completed = 0;
!     afs_AfsdbHandler_ReqPending = 1;
!     afs_osi_Wakeup(&afs_AfsdbHandlerWait);
! 
!     /* Wait for the handler to get back to us with the reply */
!     while (afs_AfsdbHandlerPresent && !afs_AfsdbHandler_Completed)
! 	afs_osi_Sleep(&afs_AfsdbLookupWait);
! 
!     /* Release the AFSDB handler and wake up others waiting for it */
!     afs_AfsdbHandlerInuse = 0;
!     afs_osi_Wakeup(&afs_AfsdbLookupWait);
! 
!     if (grab_glock) AFS_GUNLOCK();
! 
!     if (*acellHosts) return 0;
!     return ENOENT;
! #else
!     return ENOENT;
  #endif
  }
  
  
! void afs_RefreshCell(ac)
!     register struct cell *ac;
  {
!     afs_int32 cellHosts[MAXCELLHOSTS];
!     char *realName = NULL;
!     struct cell *tc;
!     int timeout;
  
!     /* Don't need to do anything if no timeout or it's not expired */
!     if (!ac->timeout || ac->timeout > osi_Time()) return;
  
!     if (afs_GetCellHostsFromDns(ac->cellName, cellHosts, &timeout, &realName))
! 	/* In case of lookup failure, keep old data */
! 	goto done;
! 
!     /* Refresh the DB servers for the real cell; other values stay the same. */
!     afs_NewCell(realName, cellHosts, 0, (char *) 0, 0, 0, timeout, (char *) 0);
! 
!     /* If this is an alias, update the alias entry too */
!     if (afs_strcasecmp(ac->cellName, realName)) {
! 	/*
! 	 * Look up the entry we just updated, to compensate for
! 	 * uppercase-vs-lowercase lossage with DNS.
! 	 */
! 	tc = afs_GetCellByName2(realName, READ_LOCK, 0 /* no AFSDB */);
! 
! 	if (tc) {
! 	    afs_NewCell(ac->cellName, 0, CAlias, (char *) 0, 0, 0,
! 			timeout, tc->cellName);
! 	    afs_PutCell(tc, READ_LOCK);
! 	}
!     }
  
! done:
!     if (realName)
! 	afs_osi_Free(realName, strlen(realName) + 1);
  }
  
  
! struct cell *afs_GetCellByName_Dns(acellName, locktype)
!     register char *acellName;
!     afs_int32 locktype;
  {
!     afs_int32 cellHosts[MAXCELLHOSTS];
!     char *realName = NULL;
!     struct cell *tc;
!     int timeout;
  
!     if (afs_GetCellHostsFromDns(acellName, cellHosts, &timeout, &realName))
! 	goto bad;
!     if (afs_NewCell(realName, cellHosts, CNoSUID, (char *) 0, 0, 0,
! 		    timeout, (char *) 0))
! 	goto bad;
  
!     /* If this is an alias, create an entry for it too */
!     if (afs_strcasecmp(acellName, realName)) {
! 	/*
! 	 * Look up the entry we just updated, to compensate for
! 	 * uppercase-vs-lowercase lossage with DNS.
! 	 */
! 	tc = afs_GetCellByName2(realName, READ_LOCK, 0 /* no AFSDB */);
! 	if (!tc)
! 	    goto bad;
  
! 	if (afs_NewCell(acellName, 0, CAlias, (char *) 0, 0, 0,
! 			timeout, tc->cellName)) {
! 	    afs_PutCell(tc, READ_LOCK);
! 	    goto bad;
! 	}
  
! 	afs_PutCell(tc, READ_LOCK);
      }
  
!     if (realName)
! 	afs_osi_Free(realName, strlen(realName) + 1);
!     return afs_GetCellByName2(acellName, locktype, 0);
  
! bad:
!     if (realName)
! 	afs_osi_Free(realName, strlen(realName) + 1);
!     return (struct cell *) 0;
! }
  
  
! struct cell *afs_GetCellByName2(acellName, locktype, trydns)
!     register char *acellName;
!     afs_int32 locktype;
!     char trydns;
! {
!     register struct cell *tc;
!     register struct afs_q *cq, *tq;
!     int didAlias = 0;
  
!     AFS_STATCNT(afs_GetCellByName);
! retry:
!     ObtainWriteLock(&afs_xcell,100);
!     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
! 	tc = QTOC(cq); tq = QNext(cq);
! 	if (!afs_strcasecmp(tc->cellName, acellName)) {
! 	    QRemove(&tc->lruq);
! 	    QAdd(&CellLRU, &tc->lruq);
! 	    ReleaseWriteLock(&afs_xcell);
! 	    afs_RefreshCell(tc);
! 	    if ((tc->states & CAlias) && (didAlias == 0)) {
! 		acellName = tc->realName;
! 		if (!acellName) return (struct cell *) 0;
! 		didAlias = 1;
! 		goto retry;
! 	    }
! 	    return tc;
  	}
      }
      ReleaseWriteLock(&afs_xcell);
!     return trydns ? afs_GetCellByName_Dns(acellName, locktype)
! 		  : (struct cell *) 0;
  
! } /*afs_GetCellByName2*/
  
  
! struct cell *afs_GetCellByName(acellName, locktype)
!     register char *acellName;
!     afs_int32 locktype;
  {
!     return afs_GetCellByName2(acellName, locktype, 1);
  
! } /*afs_GetCellByName*/
  
! static struct cell *afs_GetCellInternal(acell, locktype, holdxcell)
!     register afs_int32 acell;
!     afs_int32 locktype;
!     int holdxcell;
  {
!     register struct cell *tc;
!     register struct afs_q *cq, *tq;
  
-     AFS_STATCNT(afs_GetCell);
-     if (acell == 1 && afs_rootcell) return afs_rootcell;
-     if (holdxcell)
- 	ObtainWriteLock(&afs_xcell,101);
      for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
  	tc = QTOC(cq); tq = QNext(cq);
! 	if (tc->cell == acell) {
! 	    QRemove(&tc->lruq);
! 	    QAdd(&CellLRU, &tc->lruq);
! 	    if (holdxcell)
! 		ReleaseWriteLock(&afs_xcell);
! 	    afs_RefreshCell(tc);
! 	    return tc;
! 	}
      }
-     if (holdxcell)
- 	ReleaseWriteLock(&afs_xcell);
-     return (struct cell *) 0;
  
! } /*afs_GetCell*/
  
! struct cell *afs_GetCell(acell, locktype)
!     register afs_int32 acell;
!     afs_int32 locktype;
  {
!     return afs_GetCellInternal(acell, locktype, 1);
  }
  
! /* This is only to be called if the caller is already holding afs_xcell */
! struct cell *afs_GetCellNoLock(acell, locktype)
!     register afs_int32 acell;
!     afs_int32 locktype;
  {
!     return afs_GetCellInternal(acell, locktype, 0);
  }
  
! struct cell *afs_GetCellByIndex(cellindex, locktype, refresh)
!     register afs_int32 cellindex;
!     afs_int32 locktype;
!     afs_int32 refresh;
  {
!     register struct cell *tc;
!     register struct afs_q *cq, *tq;
  
!     AFS_STATCNT(afs_GetCellByIndex);
!     ObtainWriteLock(&afs_xcell,102);
!     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
! 	tc = QTOC(cq); tq = QNext(cq);
! 	if (tc->cellIndex == cellindex) {
! 	    QRemove(&tc->lruq);
! 	    QAdd(&CellLRU, &tc->lruq);
! 	    ReleaseWriteLock(&afs_xcell);
! 	    if (refresh) afs_RefreshCell(tc);
! 	    return tc;
! 	}
      }
-     ReleaseWriteLock(&afs_xcell);
-     return (struct cell *) 0;
  
! } /*afs_GetCellByIndex*/
  
  
! struct cell *afs_GetRealCellByIndex(cellindex, locktype, refresh)
!     register afs_int32 cellindex;
!     afs_int32 locktype;
!     afs_int32 refresh;
  {
!     register struct cell *tc;
!     register struct afs_q *cq, *tq;
  
!     AFS_STATCNT(afs_GetCellByIndex);
!     ObtainWriteLock(&afs_xcell,102);
!     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
! 	tc = QTOC(cq); tq = QNext(cq);
! 	if (tc->realcellIndex == cellindex) {
! 	    QRemove(&tc->lruq);
! 	    QAdd(&CellLRU, &tc->lruq);
! 	    ReleaseWriteLock(&afs_xcell);
! 	    if (refresh) afs_RefreshCell(tc);
! 	    return tc;
! 	}
      }
!     ReleaseWriteLock(&afs_xcell);
!     return (struct cell *) 0;
! } /*afs_GetRealCellByIndex*/
  
  
! afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport, timeout, aliasFor)
!     int aflags;
!     char *acellName;
!     register afs_int32 *acellHosts;
!     char *linkedcname;
!     u_short fsport, vlport;
!     int timeout;
!     char *aliasFor;
! {
!     register struct cell *tc, *tcl=0;
!     register afs_int32 i, newc=0, code=0;
!     register struct afs_q *cq, *tq;
  
!     AFS_STATCNT(afs_NewCell);
!     if (!(aflags & CAlias) && *acellHosts == 0)
! 	/* need >= one host to gen cell # */
! 	return EINVAL;
  
!     ObtainWriteLock(&afs_xcell,103);
  
!     /* Find the cell and mark its servers as not down but gone */
!     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
! 	tc = QTOC(cq); tq = QNext(cq);
! 	if (afs_strcasecmp(tc->cellName, acellName) == 0) {
! 	    /* if the cell we've found has the correct name but no timeout,
! 	     * and we're called with a non-zero timeout, bail out:  never
! 	     * override static configuration entries with AFSDB ones. */
! 	    if (timeout && !tc->timeout) {
! 		ReleaseWriteLock(&afs_xcell);
! 		return 0;
! 	    }
! 	    /* we don't want to keep pinging old vlservers which were down,
! 	     * since they don't matter any more.  It's easier to do this than
! 	     * to remove the server from its various hash tables. */
! 	    for (i=0; i<MAXCELLHOSTS; i++) {
! 	        if (!tc->cellHosts[i]) break;
! 		tc->cellHosts[i]->flags &= ~SRVR_ISDOWN;
! 		tc->cellHosts[i]->flags |= SRVR_ISGONE;
! 	    }
! 	    break;
! 	}
      }
  
!     if (cq != &CellLRU) {
  	aflags &= ~CNoSUID;
!     }
!     else {
  	tc = (struct cell *) afs_osi_Alloc(sizeof(struct cell));
! 	memset((char *)tc, 0, sizeof(*tc));
! 	QAdd(&CellLRU, &tc->lruq);		       	/* put in lruq */
! 	tc->cellName = (char *) afs_osi_Alloc(strlen(acellName)+1);
! 	strcpy(tc->cellName, acellName);
! 	tc->cellIndex = afs_cellindex++;
! 	if (aflags & CPrimary) {
! 	    extern int afs_rootCellIndex;
! 	    tc->cell = 1;	/* primary cell is always 1 */
! 	    afs_rootcell = tc;
! 	    afs_rootCellIndex = tc->cellIndex;
! 	} else {
! 	    tc->cell = afs_nextCellNum++;
! 	}
! 	tc->states = 0;
! 	tc->lcellp = (struct cell *)0;
! 	tc->fsport = (fsport ? fsport : AFS_FSPORT);
! 	tc->vlport = (vlport ? vlport : AFS_VLPORT);
! 	afs_stats_cmperf.numCellsVisible++;
! 	newc++;
! 	if (!(aflags & CAlias)) {
! 	    tc->realcellIndex = afs_realcellindex++;
! 	} else {
! 	    tc->realcellIndex = -1;
! 	}
      }
  
      if (aflags & CLinkedCell) {
  	if (!linkedcname) {
  	    code = EINVAL;
  	    goto bad;
  	}
! 	for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
! 	    tcl = QTOC(cq); tq = QNext(cq);
! 	    if (!afs_strcasecmp(tcl->cellName, linkedcname)) {
! 		break;
! 	    }
! 	    tcl = 0;
! 	}
  	if (!tcl) {
  	    code = ENOENT;
  	    goto bad;
--- 11,684 ----
   * Implements:
   */
  #include <afsconfig.h>
! #include "afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_cell.c,v 1.7.2.9 2003/03/06 14:53:25 shadow Exp $");
  
! #include "afs/stds.h"
! #include "afs/sysincludes.h"	/* Standard vendor system headers */
! #include "afsincludes.h"	/* Afs-based standard headers */
! #include "afs/afs_stats.h"   /* afs statistics */
! #include "afs/afs_osi.h"
  
  /* Local variables. */
! afs_rwlock_t afs_xcell;		/* Export for cmdebug peeking at locks */
  
+ /*
+  * AFSDB implementation:
+  *
+  * afs_StopAFSDB: terminate the AFSDB handler, used on shutdown
+  * afs_AFSDBHandler: entry point for user-space AFSDB request handler
+  * afs_GetCellHostsAFSDB: query the AFSDB handler and wait for response
+  * afs_LookupAFSDB: look up AFSDB for given cell name and create locally
+  */
  
  #ifdef AFS_AFSDB_ENV
! static afs_rwlock_t afsdb_client_lock;	/* Serializes client requests */
! static char afsdb_handler_running;	/* Protected by GLOCK */
! static char afsdb_handler_shutdown;	/* Protected by GLOCK */
! 
! static struct {
!     afs_rwlock_t lock;
!     char pending;
!     char complete;
!     char *cellname;
!     afs_int32 *cellhosts;
!     int *timeout;
!     char **realname;
! } afsdb_req;
! 
! void afs_StopAFSDB()
  {
!     if (afsdb_handler_running) {
! 	afs_osi_Wakeup(&afsdb_req);
      } else {
! 	afsdb_handler_shutdown = 1;
  	afs_termState = AFSOP_STOP_RXEVENT;
      }
  }
  
! int afs_AFSDBHandler(char *acellName, int acellNameLen, afs_int32 *kernelMsg)
  {
!     if (afsdb_handler_shutdown) return -2;
!     afsdb_handler_running = 1;
  
!     ObtainSharedLock(&afsdb_req.lock, 683);
!     if (afsdb_req.pending) {
  	int i, hostCount;
  
+ 	UpgradeSToWLock(&afsdb_req.lock, 684);
  	hostCount = kernelMsg[0];
! 	*afsdb_req.timeout = kernelMsg[1];
! 	if (*afsdb_req.timeout) *afsdb_req.timeout += osi_Time();
! 	*afsdb_req.realname = afs_strdup(acellName);
  
  	for (i=0; i<MAXCELLHOSTS; i++) {
  	    if (i >= hostCount)
! 		afsdb_req.cellhosts[i] = 0;
  	    else
! 		afsdb_req.cellhosts[i] = kernelMsg[2+i];
  	}
  
  	/* Request completed, wake up the relevant thread */
! 	afsdb_req.pending = 0;
! 	afsdb_req.complete = 1;
! 	afs_osi_Wakeup(&afsdb_req);
! 	ConvertWToSLock(&afsdb_req.lock);
      }
+     ConvertSToRLock(&afsdb_req.lock);
  
      /* Wait for a request */
!     while (afsdb_req.pending == 0 && afs_termState != AFSOP_STOP_AFSDB) {
! 	ReleaseReadLock(&afsdb_req.lock);
! 	afs_osi_Sleep(&afsdb_req);
! 	ObtainReadLock(&afsdb_req.lock);
!     }
  
      /* Check if we're shutting down */
      if (afs_termState == AFSOP_STOP_AFSDB) {
+ 	ReleaseReadLock(&afsdb_req.lock);
+ 
  	/* Inform anyone waiting for us that we're going away */
! 	afsdb_handler_shutdown = 1;
! 	afsdb_handler_running = 0;
! 	afs_osi_Wakeup(&afsdb_req);
  
  	afs_termState = AFSOP_STOP_RXEVENT;
  	afs_osi_Wakeup(&afs_termState);
  	return -2;
      }
  
      /* Return the lookup request to userspace */    
+     strncpy(acellName, afsdb_req.cellname, acellNameLen);
+     ReleaseReadLock(&afsdb_req.lock);
      return 0;
  }
  
! static int afs_GetCellHostsAFSDB(char *acellName, afs_int32 *acellHosts,
! 	int *timeout, char **realName)
  {
!     AFS_ASSERT_GLOCK();
!     if (!afsdb_handler_running) return ENOENT;
  
!     ObtainWriteLock(&afsdb_client_lock, 685);
!     ObtainWriteLock(&afsdb_req.lock, 686);
  
      *acellHosts = 0;
+     afsdb_req.cellname = acellName;
+     afsdb_req.cellhosts = acellHosts;
+     afsdb_req.timeout = timeout;
+     afsdb_req.realname = realName;
+ 
+     afsdb_req.complete = 0;
+     afsdb_req.pending = 1;
+     afs_osi_Wakeup(&afsdb_req);
+     ConvertWToRLock(&afsdb_req.lock);
+ 
+     while (afsdb_handler_running && !afsdb_req.complete) {
+ 	ReleaseReadLock(&afsdb_req.lock);
+ 	afs_osi_Sleep(&afsdb_req);
+ 	ObtainReadLock(&afsdb_req.lock);
+     };
+     ReleaseReadLock(&afsdb_req.lock);
+     ReleaseWriteLock(&afsdb_client_lock);
+ 
+     if (*acellHosts)
+ 	return 0;
+     else
+ 	return ENOENT;
+ }
+ #endif
+ 
+ void afs_LookupAFSDB(char *acellName)
+ {
+ #ifdef AFS_AFSDB_ENV
+     afs_int32 cellHosts[MAXCELLHOSTS];
+     char *realName = NULL;
+     int code, timeout;
+     
+     code = afs_GetCellHostsAFSDB(acellName, cellHosts, &timeout, &realName);
+     if (code) goto done;
+     code = afs_NewCell(realName, cellHosts, CNoSUID, NULL, 0, 0, timeout);
+     if (code) goto done;
+ 
+     /* If we found an alias, create it */
+     if (afs_strcasecmp(acellName, realName))
+ 	afs_NewCellAlias(acellName, realName);
  
! done:
!     if (realName)
! 	afs_osi_FreeStr(realName);
  #endif
  }
  
+ /*
+  * Cell name-to-ID mapping
+  *
+  * afs_cellname_new: create a new cell name, optional cell number
+  * afs_cellname_lookup_id: look up a cell name
+  * afs_cellname_lookup_name: look up a cell number
+  * afs_cellname_ref: note that this cell name was referenced somewhere
+  * afs_cellname_init: load the list of cells from given inode
+  * afs_cellname_write: write in-kernel list of cells to disk
+  */
+ 
+ struct cell_name *afs_cellname_head;	/* Export for kdump */
+ static ino_t afs_cellname_inode;
+ static int afs_cellname_inode_set;
+ static int afs_cellname_dirty;
+ static afs_int32 afs_cellnum_next;
+ 
+ static struct cell_name *afs_cellname_new(char *name, afs_int32 cellnum)
+ {
+     struct cell_name *cn;
+ 
+     if (cellnum == 0)
+ 	cellnum = afs_cellnum_next;
+ 
+     cn = (struct cell_name *) afs_osi_Alloc(sizeof(*cn));
+     cn->next = afs_cellname_head;
+     cn->cellnum = cellnum;
+     cn->cellname = afs_strdup(name);
+     cn->used = 0;
+     afs_cellname_head = cn;
+ 
+     if (cellnum >= afs_cellnum_next)
+ 	afs_cellnum_next = cellnum + 1;
+ 
+     return cn;
+ }
  
! static struct cell_name *afs_cellname_lookup_id(afs_int32 cellnum)
  {
!     struct cell_name *cn;
  
!     for (cn = afs_cellname_head; cn; cn = cn->next)
! 	if (cn->cellnum == cellnum)
! 	    return cn;
  
!     return NULL;
! }
  
! static struct cell_name *afs_cellname_lookup_name(char *name)
! {
!     struct cell_name *cn;
! 
!     for (cn = afs_cellname_head; cn; cn = cn->next)
! 	if (strcmp(cn->cellname, name) == 0)
! 	    return cn;
! 
!     return NULL;
  }
  
+ static void afs_cellname_ref(struct cell_name *cn)
+ {
+     if (!cn->used) {
+ 	cn->used = 1;
+ 	afs_cellname_dirty = 1;
+     }
+ }
  
! int afs_cellname_init(ino_t inode, int lookupcode)
  {
!     struct osi_file *tfile;
!     int cc, off = 0;
  
!     ObtainWriteLock(&afs_xcell, 692);
  
!     afs_cellnum_next = 1;
!     afs_cellname_dirty = 0;
  
!     if (cacheDiskType == AFS_FCACHE_TYPE_MEM) {
! 	ReleaseWriteLock(&afs_xcell);
! 	return 0;
!     }
!     if (lookupcode) {
! 	ReleaseWriteLock(&afs_xcell);
! 	return lookupcode;
!     }
  
!     tfile = osi_UFSOpen(inode);
!     if (!tfile) {
! 	ReleaseWriteLock(&afs_xcell);
! 	return EIO;
      }
  
!     afs_cellname_inode = inode;
!     afs_cellname_inode_set = 1;
  
!     while (1) {
! 	afs_int32 cellnum, clen, magic;
! 	struct cell_name *cn;
! 	char *cellname;
  
+ 	cc = afs_osi_Read(tfile, off, &magic, sizeof(magic));
+ 	if (cc != sizeof(magic))
+ 	    break;
+ 	if (magic != AFS_CELLINFO_MAGIC)
+ 	    break;
+ 	off += cc;
  
! 	cc = afs_osi_Read(tfile, off, &cellnum, sizeof(cellnum));
! 	if (cc != sizeof(cellnum))
! 	    break;
! 	off += cc;
  
! 	cc = afs_osi_Read(tfile, off, &clen, sizeof(clen));
! 	if (cc != sizeof(clen))
! 	    break;
! 	off += cc;
! 
! 	cellname = afs_osi_Alloc(clen + 1);
! 	if (!cellname)
! 	    break;
! 
! 	cc = afs_osi_Read(tfile, off, cellname, clen);
! 	if (cc != clen) {
! 	    afs_osi_Free(cellname, clen + 1);
! 	    break;
! 	}
! 	off += cc;
! 	cellname[clen] = '\0';
! 
! 	if (afs_cellname_lookup_name(cellname) ||
! 	    afs_cellname_lookup_id(cellnum)) {
! 	    afs_osi_Free(cellname, clen + 1);
! 	    break;
  	}
+ 
+ 	cn = afs_cellname_new(cellname, cellnum);
+ 	afs_osi_Free(cellname, clen + 1);
+     }
+ 
+     osi_UFSClose(tfile);
+     ReleaseWriteLock(&afs_xcell);
+     return 0;
+ }
+ 
+ int afs_cellname_write()
+ {
+     struct osi_file *tfile;
+     struct cell_name *cn;
+     int off;
+ 
+     if (!afs_cellname_dirty || !afs_cellname_inode_set)
+ 	return 0;
+     if (afs_initState != 300)
+ 	return 0;
+ 
+     ObtainWriteLock(&afs_xcell, 693);
+     afs_cellname_dirty = 0;
+     off = 0;
+     tfile = osi_UFSOpen(afs_cellname_inode);
+     if (!tfile) {
+ 	ReleaseWriteLock(&afs_xcell);
+ 	return EIO;
+     }
+ 
+     for (cn = afs_cellname_head; cn; cn = cn->next) {
+ 	afs_int32 magic, cellnum, clen;
+ 	int cc;
+ 
+ 	if (!cn->used)
+ 	    continue;
+ 
+ 	magic = AFS_CELLINFO_MAGIC;
+ 	cc = afs_osi_Write(tfile, off, &magic, sizeof(magic));
+ 	if (cc != sizeof(magic))
+ 	    break;
+ 	off += cc;
+ 
+ 	cellnum = cn->cellnum;
+ 	cc = afs_osi_Write(tfile, off, &cellnum, sizeof(cellnum));
+ 	if (cc != sizeof(cellnum))
+ 	    break;
+ 	off += cc;
+ 
+ 	clen = strlen(cn->cellname);
+ 	cc = afs_osi_Write(tfile, off, &clen, sizeof(clen));
+ 	if (cc != sizeof(clen))
+ 	    break;
+ 	off += cc;
+ 
+ 	cc = afs_osi_Write(tfile, off, cn->cellname, clen);
+ 	if (cc != clen)
+ 	    break;
+ 	off += clen;
      }
+ 
+     osi_UFSClose(tfile);
      ReleaseWriteLock(&afs_xcell);
!     return 0;
! }
! 
! /*
!  * Cell alias implementation
!  *
!  * afs_FindCellAlias: look up cell alias by alias name
!  * afs_GetCellAlias: get cell alias by index (starting at 0)
!  * afs_PutCellAlias: put back a cell alias returned by Find or Get
!  * afs_NewCellAlias: create new cell alias entry
!  */
! 
! struct cell_alias *afs_cellalias_head;	/* Export for kdump */
! static afs_int32 afs_cellalias_index;
! static int afs_CellOrAliasExists_nl(char *aname);  /* Forward declaration */
! 
! static struct cell_alias *afs_FindCellAlias(char *alias)
! {
!     struct cell_alias *tc;
  
!     for (tc = afs_cellalias_head; tc != NULL; tc = tc->next)
! 	if (!strcmp(alias, tc->alias))
! 	    break;
!     return tc;
! }
! 
! struct cell_alias *afs_GetCellAlias(int index)
! {
!     struct cell_alias *tc;
! 
!     ObtainReadLock(&afs_xcell);
!     for (tc = afs_cellalias_head; tc != NULL; tc = tc->next)
! 	if (tc->index == index)
! 	    break;
!     ReleaseReadLock(&afs_xcell);
! 
!     return tc;
! }
  
+ void afs_PutCellAlias(struct cell_alias *a)
+ {
+     return;
+ }
  
! afs_int32 afs_NewCellAlias(char *alias, char *cell)
  {
!     struct cell_alias *tc;
! 
!     ObtainSharedLock(&afs_xcell, 681);
!     if (afs_CellOrAliasExists_nl(alias)) {
! 	ReleaseSharedLock(&afs_xcell);
! 	return EEXIST;
!     }
! 
!     UpgradeSToWLock(&afs_xcell, 682);
!     tc = (struct cell_alias *) afs_osi_Alloc(sizeof(struct cell_alias));
!     tc->alias = afs_strdup(alias);
!     tc->cell = afs_strdup(cell);
!     tc->next = afs_cellalias_head;
!     tc->index = afs_cellalias_index++;
!     afs_cellalias_head = tc;
!     ReleaseWriteLock(&afs_xcell);
! 
!     afs_DynrootInvalidate();
!     return 0;
! }
! 
! /*
!  * Actual cell list implementation
!  *
!  * afs_UpdateCellLRU: bump given cell up to the front of the LRU queue
!  * afs_RefreshCell: look up cell information in AFSDB if timeout expired
!  *
!  * afs_TraverseCells: execute a callback for each existing cell
!  * afs_TraverseCells_nl: same as above except without locking afs_xcell
!  * afs_choose_cell_by_{name,num,index}: useful traversal callbacks
!  *
!  * afs_FindCellByName: return a cell with a given name, if it exists
!  * afs_FindCellByName_nl: same as above, without locking afs_xcell
!  * afs_GetCellByName: same as FindCellByName but tries AFSDB if not found
!  * afs_GetCell: return a cell with a given cell number
!  * afs_GetCellStale: same as GetCell, but does not try to refresh the data
!  * afs_GetCellByIndex: return a cell with a given index number (starting at 0)
!  *
!  * afs_GetPrimaryCell: return the primary cell, if any
!  * afs_IsPrimaryCell: returns true iff the given cell is the primary cell
!  * afs_IsPrimaryCellNum: returns afs_IsPrimaryCell(afs_GetCell(cellnum))
!  * afs_SetPrimaryCell: set the primary cell name to the given cell name
!  *
!  * afs_NewCell: create or update a cell entry
!  */
! 
! struct afs_q CellLRU;		/* Export for kdump */
! static char *afs_thiscell;
! static afs_int32 afs_cellindex;
! 
! static void afs_UpdateCellLRU(struct cell *c)
! {
!     ObtainWriteLock(&afs_xcell, 100);
!     QRemove(&c->lruq);
!     QAdd(&CellLRU, &c->lruq);
!     ReleaseWriteLock(&afs_xcell);
! }
  
! static void afs_RefreshCell(struct cell *ac)
! {
!     if (ac->states & CNoAFSDB)
! 	return;
!     if (!ac->cellHosts[0] || (ac->timeout && ac->timeout <= osi_Time()))
! 	afs_LookupAFSDB(ac->cellName);
! }
  
! static void *afs_TraverseCells_nl(void *(*cb)(struct cell *, void *), void *arg)
  {
!     struct afs_q *cq, *tq;
!     struct cell *tc;
!     void *ret = NULL;
  
      for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
  	tc = QTOC(cq); tq = QNext(cq);
! 	ret = cb(tc, arg);
! 	if (ret) break;
      }
  
!     return ret;
! }
! 
! void *afs_TraverseCells(void *(*cb)(struct cell *, void *), void *arg)
! {
!     void *ret;
! 
!     ObtainReadLock(&afs_xcell);
!     ret = afs_TraverseCells_nl(cb, arg);
!     ReleaseReadLock(&afs_xcell);
! 
!     return ret;
! }
  
! static void *afs_choose_cell_by_name(struct cell *cell, void *arg)
  {
!     return strcmp(cell->cellName, (char *) arg) ? NULL : cell;
  }
  
! static void *afs_choose_cell_by_num(struct cell *cell, void *arg)
  {
!     return (cell->cellNum == *((afs_int32 *) arg)) ? cell : NULL;
  }
  
! static void *afs_choose_cell_by_index(struct cell *cell, void *arg)
  {
!     return (cell->cellIndex == *((afs_int32 *) arg)) ? cell : NULL;
! }
  
! static struct cell *afs_FindCellByName_nl(char *acellName, afs_int32 locktype)
! {
!     return afs_TraverseCells_nl(&afs_choose_cell_by_name, acellName);
! }
! 
! static struct cell *afs_FindCellByName(char *acellName, afs_int32 locktype)
! {
!     return afs_TraverseCells(&afs_choose_cell_by_name, acellName);
! }
! 
! struct cell *afs_GetCellByName(char *acellName, afs_int32 locktype)
! {
!     struct cell *tc;
! 
!     tc = afs_FindCellByName(acellName, locktype);
!     if (!tc) {
! 	afs_LookupAFSDB(acellName);
! 	tc = afs_FindCellByName(acellName, locktype);
!     }
!     if (tc) {
! 	afs_cellname_ref(tc->cnamep);
! 	afs_UpdateCellLRU(tc);
! 	afs_RefreshCell(tc);
      }
  
!     return tc;
! }
! 
! struct cell *afs_GetCell(afs_int32 cellnum, afs_int32 locktype)
! {
!     struct cell *tc;
!     struct cell_name *cn;
  
+     tc = afs_GetCellStale(cellnum, locktype);
+     if (tc) {
+ 	afs_RefreshCell(tc);
+     } else {
+ 	ObtainReadLock(&afs_xcell);
+ 	cn = afs_cellname_lookup_id(cellnum);
+ 	ReleaseReadLock(&afs_xcell);
+ 	if (cn)
+ 	    tc = afs_GetCellByName(cn->cellname, locktype);
+     }
+     return tc;
+ }
  
! struct cell *afs_GetCellStale(afs_int32 cellnum, afs_int32 locktype)
  {
!     struct cell *tc;
  
!     tc = afs_TraverseCells(&afs_choose_cell_by_num, &cellnum);
!     if (tc) {
! 	afs_cellname_ref(tc->cnamep);
! 	afs_UpdateCellLRU(tc);
      }
!     return tc;
! }
  
+ struct cell *afs_GetCellByIndex(afs_int32 index, afs_int32 locktype)
+ {
+     struct cell *tc;
  
!     tc = afs_TraverseCells(&afs_choose_cell_by_index, &index);
!     if (tc)
! 	afs_UpdateCellLRU(tc);
!     return tc;
! }
  
! struct cell *afs_GetPrimaryCell(afs_int32 locktype)
! {
!     return afs_GetCellByName(afs_thiscell, locktype);
! }
  
! int afs_IsPrimaryCell(struct cell *cell)
! {
!     return strcmp(cell->cellName, afs_thiscell) ? 0 : 1;
! }
  
! int afs_IsPrimaryCellNum(afs_int32 cellnum)
! {
!     struct cell *tc;
!     int primary = 0;
! 
!     tc = afs_GetCellStale(cellnum, READ_LOCK);
!     if (tc) {
! 	primary = afs_IsPrimaryCell(tc);
! 	afs_PutCell(tc, READ_LOCK);
      }
  
!     return primary;
! }
! 
! afs_int32 afs_SetPrimaryCell(char *acellName)
! {
!     ObtainWriteLock(&afs_xcell, 691);
!     if (afs_thiscell)
! 	afs_osi_FreeStr(afs_thiscell);
!     afs_thiscell = afs_strdup(acellName);
!     ReleaseWriteLock(&afs_xcell);
!     return 0;
! }
! 
! afs_int32 afs_NewCell(char *acellName, afs_int32 *acellHosts, int aflags,
! 	char *linkedcname, u_short fsport, u_short vlport, int timeout)
! {
!     struct cell *tc, *tcl=0;
!     afs_int32 i, newc=0, code=0;
! 
!     AFS_STATCNT(afs_NewCell);
! 
!     ObtainWriteLock(&afs_xcell, 103);
! 
!     tc = afs_FindCellByName_nl(acellName, READ_LOCK);
!     if (tc) {
  	aflags &= ~CNoSUID;
!     } else {
  	tc = (struct cell *) afs_osi_Alloc(sizeof(struct cell));
! 	memset((char *) tc, 0, sizeof(*tc));
! 	tc->cellName = afs_strdup(acellName);
! 	tc->fsport = AFS_FSPORT;
! 	tc->vlport = AFS_VLPORT;
! 	RWLOCK_INIT(&tc->lock, "cell lock");
! 	newc = 1;
! 	if (afs_thiscell && !strcmp(acellName, afs_thiscell))
! 	    aflags &= ~CNoSUID;
!     }
!     ObtainWriteLock(&tc->lock, 688);
! 
!     /* If the cell we've found has the correct name but no timeout,
!      * and we're called with a non-zero timeout, bail out:  never
!      * override static configuration entries with AFSDB ones.
!      * One exception: if the original cell entry had no servers,
!      * it must get servers from AFSDB.
!      */
!     if (timeout && !tc->timeout && tc->cellHosts[0]) {
! 	code = EINVAL;
! 	goto bad;
!     }
! 
!     /* we don't want to keep pinging old vlservers which were down,
!      * since they don't matter any more.  It's easier to do this than
!      * to remove the server from its various hash tables. */
!     for (i=0; i<MAXCELLHOSTS; i++) {
! 	if (!tc->cellHosts[i]) break;
! 	tc->cellHosts[i]->flags &= ~SRVR_ISDOWN;
! 	tc->cellHosts[i]->flags |= SRVR_ISGONE;
      }
  
+     if (fsport) tc->fsport = fsport;
+     if (vlport) tc->vlport = vlport;
+ 
      if (aflags & CLinkedCell) {
  	if (!linkedcname) {
  	    code = EINVAL;
  	    goto bad;
  	}
! 	tcl = afs_FindCellByName_nl(linkedcname, READ_LOCK);
  	if (!tcl) {
  	    code = ENOENT;
  	    goto bad;
***************
*** 542,612 ****
      tc->states |= aflags;
      tc->timeout = timeout;
  
-     /* Allow converting an alias into a real cell */
-     if ((!(aflags & CAlias)) && (tc->states & CAlias)) {
- 	tc->states &= ~CAlias;
- 	tc->realcellIndex = afs_realcellindex++;
-     }
-  
      memset((char *)tc->cellHosts, 0, sizeof(tc->cellHosts));
-     if (aflags & CAlias) {
- 	if (!aliasFor) {
- 	    code = EINVAL;
- 	    goto bad;
- 	}
- 	if (tc->realName) afs_osi_Free(tc->realName, strlen(tc->realName)+1);
- 	tc->realName = (char *) afs_osi_Alloc(strlen(aliasFor)+1);
- 	strcpy(tc->realName, aliasFor);
- 	goto done;
-     }
- 
      for (i=0; i<MAXCELLHOSTS; i++) {
!         struct server *ts;
  	afs_uint32 temp = acellHosts[i];
  	if (!temp) break;
! 	ts = afs_GetServer(&temp, 1, 0, tc->vlport, WRITE_LOCK, (afsUUID *)0, 0);
!         ts->cell = tc;
  	ts->flags &= ~SRVR_ISGONE;
  	tc->cellHosts[i] = ts;
  	afs_PutServer(ts, WRITE_LOCK);
      }
      afs_SortServers(tc->cellHosts, MAXCELLHOSTS);	/* randomize servers */
! done:
      ReleaseWriteLock(&afs_xcell);
      return 0;
  bad:
      if (newc) {
! 	QRemove(&tc->lruq);
! 	afs_osi_Free(tc->cellName, strlen(tc->cellName)+1);
! 	afs_osi_Free((char *)tc, sizeof(struct cell));
      }
      ReleaseWriteLock(&afs_xcell);
      return code;
  
! } /*afs_NewCell*/
  
! afs_RemoveCellEntry(struct server *srvp)
  {
!   struct cell *tc;
!   afs_int32 j, k;
  
!   tc = srvp->cell;
!   if (!tc) return;
! 
!   /* Remove the server structure from the cell list - if there */
!   ObtainWriteLock(&afs_xcell,200);
!   for (j=k=0; j<MAXCELLHOSTS; j++) {
!      if (!tc->cellHosts[j]) break;
!      if (tc->cellHosts[j] != srvp) {
!         tc->cellHosts[k++] = tc->cellHosts[j];
!      }
!   }
!   if (k == 0) {
!      /* What do we do if we remove the last one? */
!   }
!   for (; k<MAXCELLHOSTS; k++) {
!      tc->cellHosts[k] = 0;
!   }
!   ReleaseWriteLock(&afs_xcell);
  }
  
--- 693,846 ----
      tc->states |= aflags;
      tc->timeout = timeout;
  
      memset((char *)tc->cellHosts, 0, sizeof(tc->cellHosts));
      for (i=0; i<MAXCELLHOSTS; i++) {
! 	struct server *ts;
  	afs_uint32 temp = acellHosts[i];
  	if (!temp) break;
! 	ts = afs_GetServer(&temp, 1, 0, tc->vlport, WRITE_LOCK, NULL, 0);
! 	ts->cell = tc;
  	ts->flags &= ~SRVR_ISGONE;
  	tc->cellHosts[i] = ts;
  	afs_PutServer(ts, WRITE_LOCK);
      }
      afs_SortServers(tc->cellHosts, MAXCELLHOSTS);	/* randomize servers */
! 
!     if (newc) {
! 	struct cell_name *cn;
! 
! 	cn = afs_cellname_lookup_name(acellName);
! 	if (!cn)
! 	    cn = afs_cellname_new(acellName, 0);
! 
! 	tc->cnamep = cn;
! 	tc->cellNum = cn->cellnum;
! 	tc->cellIndex = afs_cellindex++;
! 	afs_stats_cmperf.numCellsVisible++;
! 	QAdd(&CellLRU, &tc->lruq);
!     }
! 
!     ReleaseWriteLock(&tc->lock);
      ReleaseWriteLock(&afs_xcell);
+     afs_PutCell(tc, 0);
+     afs_DynrootInvalidate();
      return 0;
+ 
  bad:
      if (newc) {
! 	afs_osi_FreeStr(tc->cellName);
! 	afs_osi_Free(tc, sizeof(struct cell));
      }
+     ReleaseWriteLock(&tc->lock);
      ReleaseWriteLock(&afs_xcell);
      return code;
+ }
+ 
+ /*
+  * Miscellaneous stuff
+  *
+  * afs_CellInit: perform whatever initialization is necessary
+  * shutdown_cell: called on shutdown, should deallocate memory, etc
+  * afs_RemoveCellEntry: remove a server from a cell's server list
+  * afs_CellOrAliasExists: check if the given name exists as a cell or alias
+  * afs_CellOrAliasExists_nl: same as above without locking afs_xcell
+  * afs_CellNumValid: check if a cell number is valid (also set the used flag)
+  */
+ 
+ void afs_CellInit()
+ {
+     RWLOCK_INIT(&afs_xcell, "afs_xcell");
+ #ifdef AFS_AFSDB_ENV
+     RWLOCK_INIT(&afsdb_req.lock, "afsdb_req.lock");
+ #endif
+     QInit(&CellLRU);
+ 
+     afs_cellindex = 0;
+     afs_cellalias_index = 0;
+ }
+ 
+ void shutdown_cell()
+ {
+     struct afs_q *cq, *tq;
+     struct cell *tc;
+ 
+     RWLOCK_INIT(&afs_xcell, "afs_xcell");
+ 
+     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
+ 	tc = QTOC(cq); tq = QNext(cq);
+ 	if (tc->cellName) afs_osi_FreeStr(tc->cellName);
+ 	afs_osi_Free(tc, sizeof(struct cell));
+     }
+     QInit(&CellLRU);
+ }
+ 
+ void afs_RemoveCellEntry(struct server *srvp)
+ {
+     struct cell *tc;
+     afs_int32 j, k;
+ 
+     tc = srvp->cell;
+     if (!tc) return;
+ 
+     /* Remove the server structure from the cell list - if there */
+     ObtainWriteLock(&tc->lock, 200);
+     for (j=k=0; j<MAXCELLHOSTS; j++) {
+ 	if (!tc->cellHosts[j]) break;
+ 	if (tc->cellHosts[j] != srvp) {
+ 	    tc->cellHosts[k++] = tc->cellHosts[j];
+ 	}
+     }
+     if (k == 0) {
+ 	/* What do we do if we remove the last one? */
+     }
+     for (; k<MAXCELLHOSTS; k++) {
+ 	tc->cellHosts[k] = 0;
+     }
+     ReleaseWriteLock(&tc->lock);
+ }
+ 
+ static int afs_CellOrAliasExists_nl(char *aname)
+ {
+     struct cell *c;
+     struct cell_alias *ca;
+ 
+     c = afs_FindCellByName_nl(aname, READ_LOCK);
+     if (c) {
+ 	afs_PutCell(c, READ_LOCK);
+ 	return 1;
+     }
+ 
+     ca = afs_FindCellAlias(aname);
+     if (ca) {
+ 	afs_PutCellAlias(ca);
+ 	return 1;
+     }
  
!     return 0;
! }
  
! int afs_CellOrAliasExists(char *aname)
  {
!     int ret;
  
!     ObtainReadLock(&afs_xcell);
!     ret = afs_CellOrAliasExists_nl(aname);
!     ReleaseReadLock(&afs_xcell);
! 
!     return ret;
  }
  
+ int afs_CellNumValid(afs_int32 cellnum)
+ {
+     struct cell_name *cn;
+ 
+     ObtainReadLock(&afs_xcell);
+     cn = afs_cellname_lookup_id(cellnum);
+     ReleaseReadLock(&afs_xcell);
+     if (cn) {
+ 	cn->used = 1;
+ 	return 1;
+     } else {
+ 	return 0;
+     }
+ }
Index: openafs/src/afs/afs_daemons.c
diff -c openafs/src/afs/afs_daemons.c:1.7.2.2 openafs/src/afs/afs_daemons.c:1.7.2.3
*** openafs/src/afs/afs_daemons.c:1.7.2.2	Tue Apr 23 21:41:16 2002
--- openafs/src/afs/afs_daemons.c	Thu Mar  6 09:53:25 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_daemons.c,v 1.7.2.2 2002/04/24 01:41:16 zacheiss Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_daemons.c,v 1.7.2.3 2003/03/06 14:53:25 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 265,321 ****
      }
  }
  
! afs_CheckRootVolume () {
      char rootVolName[32];
!     register struct volume *tvp;
      int usingDynroot = afs_GetDynrootEnable();
  
      AFS_STATCNT(afs_CheckRootVolume);
      if (*afs_rootVolumeName == 0) {
  	strcpy(rootVolName, "root.afs");
!     }
!     else {
  	strcpy(rootVolName, afs_rootVolumeName);
      }
      if (usingDynroot) {
! 	afs_GetDynrootFid(&afs_rootFid);
! 	tvp = afs_GetVolume(&afs_rootFid, (struct vrequest *) 0, READ_LOCK);
      } else {
! 	tvp = afs_GetVolumeByName(rootVolName, LOCALCELL, 1, (struct vrequest *) 0, READ_LOCK);
      }
!     if (!tvp) {
! 	char buf[128];
! 	int len = strlen(rootVolName);
! 
! 	if ((len < 9) || strcmp(&rootVolName[len - 9], ".readonly")) {
! 	    strcpy(buf, rootVolName);
! 	    afs_strcat(buf, ".readonly");
! 	    tvp = afs_GetVolumeByName(buf, LOCALCELL, 1, (struct vrequest *) 0, READ_LOCK);
! 	}
      }
      if (tvp) {
! 	if (!usingDynroot) {
! 	    int volid = (tvp->roVol? tvp->roVol : tvp->volume);
! 	    afs_rootFid.Cell = LOCALCELL;
! 	    if (afs_rootFid.Fid.Volume && afs_rootFid.Fid.Volume != volid
! 		&& afs_globalVp) {
! 		/* If we had a root fid before and it changed location we reset
! 		 * the afs_globalVp so that it will be reevaluated.
! 		 * Just decrement the reference count. This only occurs during
! 		 * initial cell setup and can panic the machine if we set the
! 		 * count to zero and fs checkv is executed when the current
! 		 * directory is /afs.
! 		 */
! 		AFS_FAST_RELE(afs_globalVp);
! 		afs_globalVp = 0;
! 	    }
! 	    afs_rootFid.Fid.Volume = volid;
! 	    afs_rootFid.Fid.Vnode = 1;
! 	    afs_rootFid.Fid.Unique = 1;
! 	}
! 	afs_initState = 300;    /* won */
! 	afs_osi_Wakeup(&afs_initState);
! 	afs_PutVolume(tvp, READ_LOCK);
      }
  #ifdef AFS_DEC_ENV
  /* This is to make sure that we update the root gnode */
--- 265,331 ----
      }
  }
  
! int afs_CheckRootVolume (void) {
      char rootVolName[32];
!     struct volume *tvp;
      int usingDynroot = afs_GetDynrootEnable();
+     int localcell;
  
      AFS_STATCNT(afs_CheckRootVolume);
      if (*afs_rootVolumeName == 0) {
  	strcpy(rootVolName, "root.afs");
!     } else {
  	strcpy(rootVolName, afs_rootVolumeName);
      }
+ 
+     if (!usingDynroot) {
+         struct cell *lc = afs_GetPrimaryCell(READ_LOCK);
+ 
+         if (!lc)
+             return ENOENT;
+         localcell = lc->cellNum;
+         afs_PutCell(lc, READ_LOCK);
+     }
+ 
      if (usingDynroot) {
!         afs_GetDynrootFid(&afs_rootFid);
!         tvp = afs_GetVolume(&afs_rootFid, NULL, READ_LOCK);
      } else {
!         tvp = afs_GetVolumeByName(rootVolName, localcell, 1, NULL, READ_LOCK);
      }
!     if (!tvp && !usingDynroot) {
!         char buf[128];
!         int len = strlen(rootVolName);
! 
!         if ((len < 9) || strcmp(&rootVolName[len - 9], ".readonly")) {
!             strcpy(buf, rootVolName);
!             afs_strcat(buf, ".readonly");
!             tvp = afs_GetVolumeByName(buf, localcell, 1, NULL, READ_LOCK);
!         }
      }
      if (tvp) {
!         if (!usingDynroot) {
!             int volid = (tvp->roVol? tvp->roVol : tvp->volume);
!             afs_rootFid.Cell = localcell;
!             if (afs_rootFid.Fid.Volume && afs_rootFid.Fid.Volume != volid
!                 && afs_globalVp) {
! 	      /* If we had a root fid before and it changed location we reset
! 	       * the afs_globalVp so that it will be reevaluated.
! 	       * Just decrement the reference count. This only occurs during
! 	       * initial cell setup and can panic the machine if we set the
! 	       * count to zero and fs checkv is executed when the current
! 	       * directory is /afs.
! 	       */
!                 AFS_FAST_RELE(afs_globalVp);
!                 afs_globalVp = 0;
!             }
!             afs_rootFid.Fid.Volume = volid;
!             afs_rootFid.Fid.Vnode = 1;
!             afs_rootFid.Fid.Unique = 1;
!         }
!         afs_initState = 300;    /* won */
!         afs_osi_Wakeup(&afs_initState);
!         afs_PutVolume(tvp, READ_LOCK);
      }
  #ifdef AFS_DEC_ENV
  /* This is to make sure that we update the root gnode */
Index: openafs/src/afs/afs_dcache.c
diff -c openafs/src/afs/afs_dcache.c:1.10.2.2 openafs/src/afs/afs_dcache.c:1.10.2.3
*** openafs/src/afs/afs_dcache.c:1.10.2.2	Thu May  9 18:07:12 2002
--- openafs/src/afs/afs_dcache.c	Thu Mar  6 09:53:25 2003
***************
*** 13,19 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_dcache.c,v 1.10.2.2 2002/05/09 22:07:12 zacheiss Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
--- 13,19 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_dcache.c,v 1.10.2.3 2003/03/06 14:53:25 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
***************
*** 2128,2134 ****
      /*
       * See if this was a reference to a file in the local cell.
       */
!     if (avc->fid.Cell == LOCALCELL)
  	afs_stats_cmperf.dlocalAccesses++;
      else
  	afs_stats_cmperf.dremoteAccesses++;
--- 2128,2134 ----
      /*
       * See if this was a reference to a file in the local cell.
       */
!     if (afs_IsPrimaryCellNum(avc->fid.Cell))
  	afs_stats_cmperf.dlocalAccesses++;
      else
  	afs_stats_cmperf.dremoteAccesses++;
***************
*** 2297,2302 ****
--- 2297,2303 ----
  
      register afs_int32 code;
      register struct dcache *tdc;
+     int entryok;
  
      AFS_STATCNT(afs_UFSGetDSlot);
      if (CheckLock(&afs_xdcache) != -1) osi_Panic("getdslot nolock");
***************
*** 2345,2353 ****
      /*
        * Seek to the aslot'th entry and read it in.
        */
!     code = afs_osi_Read(afs_cacheInodep, sizeof(struct fcache) * aslot + sizeof(struct afs_fheader),
! 		    (char *)(&tdc->f), sizeof(struct fcache));
!     if (code != sizeof(struct fcache)) {
  	tdc->f.fid.Cell = 0;
  	tdc->f.fid.Fid.Volume = 0;
  	tdc->f.chunk = -1;
--- 2346,2361 ----
      /*
        * Seek to the aslot'th entry and read it in.
        */
!     code = afs_osi_Read(afs_cacheInodep, sizeof(struct fcache) * aslot +
! 					 sizeof(struct afs_fheader),
! 			(char *)(&tdc->f), sizeof(struct fcache));
!     entryok = 1;
!     if (code != sizeof(struct fcache))
! 	entryok = 0;
!     if (!afs_CellNumValid(tdc->f.fid.Cell))
! 	entryok = 0;
! 
!     if (!entryok) {
  	tdc->f.fid.Cell = 0;
  	tdc->f.fid.Fid.Volume = 0;
  	tdc->f.chunk = -1;
***************
*** 2406,2413 ****
      /*
       * Seek to the right dcache slot and write the in-memory image out to disk.
       */
!     code = afs_osi_Write(afs_cacheInodep, sizeof(struct fcache) * adc->index + sizeof(struct afs_fheader), 
! 		     (char *)(&adc->f), sizeof(struct fcache));
      if (code != sizeof(struct fcache)) return EIO;
      return 0;
  
--- 2414,2423 ----
      /*
       * Seek to the right dcache slot and write the in-memory image out to disk.
       */
!     afs_cellname_write();
!     code = afs_osi_Write(afs_cacheInodep, sizeof(struct fcache) * adc->index +
! 					  sizeof(struct afs_fheader), 
! 			 (char *)(&adc->f), sizeof(struct fcache));
      if (code != sizeof(struct fcache)) return EIO;
      return 0;
  
Index: openafs/src/afs/afs_dynroot.c
diff -c openafs/src/afs/afs_dynroot.c:1.1.2.6 openafs/src/afs/afs_dynroot.c:1.1.2.8
*** openafs/src/afs/afs_dynroot.c:1.1.2.6	Tue Nov 19 22:24:47 2002
--- openafs/src/afs/afs_dynroot.c	Thu Mar  6 10:25:35 2003
***************
*** 14,20 ****
   * afs_IsDynrootFid
   * afs_GetDynrootFid
   * afs_IsDynroot
!  * afs_RefreshDynroot
   * afs_GetDynroot
   * afs_PutDynroot
   * afs_DynrootNewVnode
--- 14,20 ----
   * afs_IsDynrootFid
   * afs_GetDynrootFid
   * afs_IsDynroot
!  * afs_DynrootInvalidate
   * afs_GetDynroot
   * afs_PutDynroot
   * afs_DynrootNewVnode
***************
*** 38,44 ****
  #include "../afs/prs_fs.h"
  #include "../afs/dir.h"
  
! #define AFS_DYNROOT_CELL	1
  #define AFS_DYNROOT_VOLUME	1
  #define AFS_DYNROOT_VNODE	1
  #define AFS_DYNROOT_UNIQUE	1
--- 38,44 ----
  #include "../afs/prs_fs.h"
  #include "../afs/dir.h"
  
! #define AFS_DYNROOT_CELLNAME	"dynroot"
  #define AFS_DYNROOT_VOLUME	1
  #define AFS_DYNROOT_VNODE	1
  #define AFS_DYNROOT_UNIQUE	1
***************
*** 48,54 ****
   * and a type-specific identifier in the lower 24 bits.
   */
  #define VN_TYPE_CELL		0x01	/* Corresponds to a struct cell */
! #define VN_TYPE_SYMLINK		0x02	/* User-created symlink in /afs */
  
  #define VNUM_TO_VNTYPE(vnum)	((vnum) >> 24)
  #define VNUM_TO_VNID(vnum)	((vnum) & 0x00ffffff)
--- 48,55 ----
   * and a type-specific identifier in the lower 24 bits.
   */
  #define VN_TYPE_CELL		0x01	/* Corresponds to a struct cell */
! #define VN_TYPE_ALIAS		0x02	/* Corresponds to a struct cell_alias */
! #define VN_TYPE_SYMLINK		0x03	/* User-created symlink in /afs */
  
  #define VNUM_TO_VNTYPE(vnum)	((vnum) >> 24)
  #define VNUM_TO_VNID(vnum)	((vnum) & 0x00ffffff)
***************
*** 59,73 ****
  #define VNUM_FROM_CIDX_RW(cidx, rw) \
  				VNUM_FROM_TYPEID(VN_TYPE_CELL, \
  						 ((cidx) << 2 | (rw) << 1))
  
  static int afs_dynrootEnable = 0;
  
  static afs_rwlock_t afs_dynrootDirLock;
  /* Start of variables protected by afs_dynrootDirLock */
  static char *afs_dynrootDir = NULL;
  static int afs_dynrootDirLen;
  static int afs_dynrootDirLinkcnt;
! static int afs_dynrootCellCount;
  static int afs_dynrootVersion = 1;
  static int afs_dynrootVersionHigh = 1;
  /* End of variables protected by afs_dynrootDirLock */
--- 60,78 ----
  #define VNUM_FROM_CIDX_RW(cidx, rw) \
  				VNUM_FROM_TYPEID(VN_TYPE_CELL, \
  						 ((cidx) << 2 | (rw) << 1))
+ #define VNUM_FROM_CAIDX_RW(caidx, rw) \
+ 				VNUM_FROM_TYPEID(VN_TYPE_ALIAS, \
+ 						 ((caidx) << 2 | (rw) << 1))
  
  static int afs_dynrootEnable = 0;
+ static int afs_dynrootCell = 0;
  
  static afs_rwlock_t afs_dynrootDirLock;
  /* Start of variables protected by afs_dynrootDirLock */
  static char *afs_dynrootDir = NULL;
  static int afs_dynrootDirLen;
  static int afs_dynrootDirLinkcnt;
! static int afs_dynrootDirVersion;
  static int afs_dynrootVersion = 1;
  static int afs_dynrootVersionHigh = 1;
  /* End of variables protected by afs_dynrootDirLock */
***************
*** 90,95 ****
--- 95,124 ----
  extern afs_rwlock_t afs_xvcache;
  
  /*
+  * Set up a cell for dynroot if it's not there yet.
+  */
+ static int afs_dynrootCellInit()
+ {
+     if (afs_dynrootEnable && !afs_dynrootCell) {
+ 	afs_int32 cellHosts[MAXCELLHOSTS];
+ 	struct cell *tc;
+ 	int code;
+  
+ 	memset(cellHosts, 0, sizeof(cellHosts));
+ 	code = afs_NewCell(AFS_DYNROOT_CELLNAME, cellHosts, CNoSUID | CNoAFSDB,
+ 			   NULL, 0, 0, 0);
+ 	if (code)
+ 	    return code;
+ 	tc = afs_GetCellByName(AFS_DYNROOT_CELLNAME, READ_LOCK);
+ 	if (!tc)
+ 	    return ENODEV;
+ 	afs_dynrootCell = tc->cellNum;
+ 	afs_PutCell(tc, READ_LOCK);
+     }
+     return 0;
+ }
+ 
+ /*
   * Returns non-zero iff fid corresponds to the top of the dynroot volume.
   */
  int
***************
*** 97,103 ****
  {
      return
  	(afs_dynrootEnable &&
! 	 fid->Cell       == AFS_DYNROOT_CELL   &&
  	 fid->Fid.Volume == AFS_DYNROOT_VOLUME &&
  	 fid->Fid.Vnode  == AFS_DYNROOT_VNODE  &&
  	 fid->Fid.Unique == AFS_DYNROOT_UNIQUE);
--- 126,132 ----
  {
      return
  	(afs_dynrootEnable &&
! 	 fid->Cell       == afs_dynrootCell   &&
  	 fid->Fid.Volume == AFS_DYNROOT_VOLUME &&
  	 fid->Fid.Vnode  == AFS_DYNROOT_VNODE  &&
  	 fid->Fid.Unique == AFS_DYNROOT_UNIQUE);
***************
*** 109,115 ****
  void
  afs_GetDynrootFid(struct VenusFid *fid) 
  {
!     fid->Cell       = AFS_DYNROOT_CELL;
      fid->Fid.Volume = AFS_DYNROOT_VOLUME;
      fid->Fid.Vnode  = AFS_DYNROOT_VNODE;
      fid->Fid.Unique = AFS_DYNROOT_UNIQUE;
--- 138,144 ----
  void
  afs_GetDynrootFid(struct VenusFid *fid) 
  {
!     fid->Cell       = afs_dynrootCell;
      fid->Fid.Volume = AFS_DYNROOT_VOLUME;
      fid->Fid.Vnode  = AFS_DYNROOT_VNODE;
      fid->Fid.Unique = AFS_DYNROOT_UNIQUE;
***************
*** 214,244 ****
  }
  
  /*
   * Regenerates the dynroot contents from the current list of
   * cells.  Useful when the list of cells has changed due to
   * an AFSDB lookup, for instance.
   */
! void
! afs_RefreshDynroot()
  {
      int cellidx, maxcellidx, i;
      struct cell *c;
      int curChunk, curPage;
      int dirSize, sizeOfCurEntry, dotLen;
      char *newDir, *dotCell;
      struct DirHeader *dirHeader;
-     struct PageHeader *pageHeader;
      struct DirEntry *dirEntry;
-     int doFlush = 0;
      int linkCount = 0;
      struct afs_dynSymlink *ts;
!     int newCellCount;
  
!     /*
!      * Save afs_cellindex here, in case it changes between the
!      * two loops.
!      */
!     maxcellidx = afs_cellindex;
  
      /*
       * Compute the amount of space we need for the fake dir
--- 243,302 ----
  }
  
  /*
+  * Invalidate the /afs vnode for dynroot; called when the underlying
+  * directory has changed and needs to be re-read.
+  */
+ void afs_DynrootInvalidate(void)
+ {
+     afs_int32 retry;
+     struct vcache *tvc;
+     struct VenusFid tfid;
+  
+     if (!afs_dynrootEnable)
+ 	return;
+  
+     ObtainWriteLock(&afs_dynrootDirLock, 687);
+     afs_dynrootVersion++;
+     afs_dynrootVersionHigh = osi_Time();
+     ReleaseWriteLock(&afs_dynrootDirLock);
+  
+     afs_GetDynrootFid(&tfid);
+     do {
+ 	retry = 0;
+ 	ObtainReadLock(&afs_xvcache);
+ 	tvc = afs_FindVCache(&tfid, 0, 0, &retry, 0);
+ 	ReleaseReadLock(&afs_xvcache);
+     } while (retry);
+     if (tvc) {
+ 	tvc->states &= ~(CStatd | CUnique);
+ 	osi_dnlc_purgedp(tvc);
+ 	afs_PutVCache(tvc);
+     }
+ }
+ 
+ /*
   * Regenerates the dynroot contents from the current list of
   * cells.  Useful when the list of cells has changed due to
   * an AFSDB lookup, for instance.
   */
! static void afs_RebuildDynroot(void)
  {
      int cellidx, maxcellidx, i;
+     int aliasidx, maxaliasidx;
      struct cell *c;
+     struct cell_alias *ca;
      int curChunk, curPage;
      int dirSize, sizeOfCurEntry, dotLen;
      char *newDir, *dotCell;
      struct DirHeader *dirHeader;
      struct DirEntry *dirEntry;
      int linkCount = 0;
      struct afs_dynSymlink *ts;
!     int newVersion;
  
!     ObtainReadLock(&afs_dynrootDirLock);
!     newVersion = afs_dynrootVersion;
!     ReleaseReadLock(&afs_dynrootDirLock);
  
      /*
       * Compute the amount of space we need for the fake dir
***************
*** 249,257 ****
      /* Reserve space for "." and ".." */
      curChunk += 2;
  
!     for (cellidx = 0; cellidx < maxcellidx; cellidx++) {
! 	c = afs_GetCellByIndex(cellidx, READ_LOCK, 0 /* don't refresh */);
! 	if (!c) continue;
  
  	sizeOfCurEntry = afs_dir_NameBlobs(c->cellName);
  	if (curChunk + sizeOfCurEntry > EPP) {
--- 307,316 ----
      /* Reserve space for "." and ".." */
      curChunk += 2;
  
!     for (cellidx = 0; ; cellidx++) {
! 	c = afs_GetCellByIndex(cellidx, READ_LOCK);
! 	if (!c) break;
! 	if (c->cellNum == afs_dynrootCell) continue;
  
  	sizeOfCurEntry = afs_dir_NameBlobs(c->cellName);
  	if (curChunk + sizeOfCurEntry > EPP) {
***************
*** 274,279 ****
--- 333,364 ----
  	afs_osi_Free(dotCell, dotLen);
  	afs_PutCell(c, READ_LOCK);
      }
+     maxcellidx = cellidx;
+ 
+     for (aliasidx = 0; ; aliasidx++) {
+ 	ca = afs_GetCellAlias(aliasidx);
+ 	if (!ca) break;
+ 
+ 	sizeOfCurEntry = afs_dir_NameBlobs(ca->alias);
+ 	if (curChunk + sizeOfCurEntry > EPP) {
+ 	    curPage++;
+ 	    curChunk = 1;
+ 	}
+ 	curChunk += sizeOfCurEntry;
+ 
+ 	dotCell = afs_osi_Alloc(strlen(ca->alias) + 2);
+ 	strcpy(dotCell, ".");
+ 	strcat(dotCell, ca->alias);
+ 	sizeOfCurEntry = afs_dir_NameBlobs(dotCell);
+ 	if (curChunk + sizeOfCurEntry > EPP) {
+ 	    curPage++;
+ 	    curChunk = 1;
+ 	}
+ 	curChunk += sizeOfCurEntry;
+ 
+ 	afs_PutCellAlias(ca);
+     }
+     maxaliasidx = aliasidx;
  
      ObtainReadLock(&afs_dynSymlinkLock);
      ts = afs_dynSymlinkBase;
***************
*** 317,324 ****
      linkCount += 2;
  
      for (cellidx = 0; cellidx < maxcellidx; cellidx++) {
! 	c = afs_GetCellByIndex(cellidx, READ_LOCK, 0 /* don't refresh */);
  	if (!c) continue;
  
  	dotLen = strlen(c->cellName) + 2;
  	dotCell = afs_osi_Alloc(dotLen);
--- 402,410 ----
      linkCount += 2;
  
      for (cellidx = 0; cellidx < maxcellidx; cellidx++) {
! 	c = afs_GetCellByIndex(cellidx, READ_LOCK);
  	if (!c) continue;
+ 	if (c->cellNum == afs_dynrootCell) continue;
  
  	dotLen = strlen(c->cellName) + 2;
  	dotCell = afs_osi_Alloc(dotLen);
***************
*** 329,340 ****
  	afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
  			      dotCell, VNUM_FROM_CIDX_RW(cellidx, 1));
  
! 	if (!(c->states & CAlias)) linkCount += 2;
  
  	afs_osi_Free(dotCell, dotLen);
  	afs_PutCell(c, READ_LOCK);
      }
  
      ts = afs_dynSymlinkBase;
      while (ts) {
  	int vnum = VNUM_FROM_TYPEID(VN_TYPE_SYMLINK, ts->index);
--- 415,440 ----
  	afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
  			      dotCell, VNUM_FROM_CIDX_RW(cellidx, 1));
  
! 	linkCount += 2;
  
  	afs_osi_Free(dotCell, dotLen);
  	afs_PutCell(c, READ_LOCK);
      }
  
+     for (aliasidx = 0; aliasidx < maxaliasidx; aliasidx++) {
+ 	ca = afs_GetCellAlias(aliasidx);
+ 	if (!ca) continue;
+ 	
+ 	dotCell = afs_osi_Alloc(strlen(ca->alias) + 2);
+ 	strcpy(dotCell, ".");
+ 	strcat(dotCell, ca->alias);
+ 	afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
+ 			      ca->alias, VNUM_FROM_CAIDX_RW(aliasidx, 0));
+ 	afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
+ 			      dotCell, VNUM_FROM_CAIDX_RW(aliasidx, 1));
+ 	afs_PutCellAlias(ca);
+     }
+     
      ts = afs_dynSymlinkBase;
      while (ts) {
  	int vnum = VNUM_FROM_TYPEID(VN_TYPE_SYMLINK, ts->index);
***************
*** 343,349 ****
  	ts = ts->next;
      }
  
-     newCellCount = maxcellidx + afs_dynSymlinkIndex;
      ReleaseReadLock(&afs_dynSymlinkLock);
  
      ObtainWriteLock(&afs_dynrootDirLock, 549);
--- 443,448 ----
***************
*** 351,401 ****
      afs_dynrootDir = newDir;
      afs_dynrootDirLen = dirSize;
      afs_dynrootDirLinkcnt = linkCount;
!     if (afs_dynrootCellCount != newCellCount) {
! 	/*
! 	 * New cells/symlinks added -- bump data version, invalidate vcache.
! 	 */
! 	afs_dynrootCellCount = newCellCount;
! 	afs_dynrootVersion++;
! 	afs_dynrootVersionHigh = osi_Time();
! 	doFlush = 1;
!     }
      ReleaseWriteLock(&afs_dynrootDirLock);
- 
-     if (doFlush) {
- 	afs_int32 retry;
- 	struct vcache *tvc;
- 	struct VenusFid tfid;
- 
- 	afs_GetDynrootFid(&tfid);
- 	do {
- 	    retry = 0;
- 	    ObtainReadLock(&afs_xvcache);
- 	    tvc = afs_FindVCache(&tfid, 0, 0, &retry, 0);
- 	    ReleaseReadLock(&afs_xvcache);
- 	} while (retry);
- 	if (tvc) {
- 	    tvc->states &= ~(CStatd | CUnique);
- 	    osi_dnlc_purgedp(tvc);
- 	    afs_PutVCache(tvc);
- 	}
-     }
  }
  
  /*
   * Returns a pointer to the base of the dynroot directory in memory,
   * length thereof, and a FetchStatus.
   */
! void
! afs_GetDynroot(dynrootDir, dynrootLen, status)
!     char **dynrootDir;
!     int *dynrootLen;
!     struct AFSFetchStatus *status;
  {
      ObtainReadLock(&afs_dynrootDirLock);
!     if (!afs_dynrootDir) {
  	ReleaseReadLock(&afs_dynrootDirLock);
! 	afs_RefreshDynroot();
  	ObtainReadLock(&afs_dynrootDirLock);
      }
  
--- 450,470 ----
      afs_dynrootDir = newDir;
      afs_dynrootDirLen = dirSize;
      afs_dynrootDirLinkcnt = linkCount;
!     afs_dynrootVersion = newVersion;
      ReleaseWriteLock(&afs_dynrootDirLock);
  }
  
  /*
   * Returns a pointer to the base of the dynroot directory in memory,
   * length thereof, and a FetchStatus.
   */
! void afs_GetDynroot(char **dynrootDir, int *dynrootLen, 
! 		    struct AFSFetchStatus *status)
  {
      ObtainReadLock(&afs_dynrootDirLock);
!     if (!afs_dynrootDir || afs_dynrootDirVersion != afs_dynrootVersion) {
  	ReleaseReadLock(&afs_dynrootDirLock);
! 	afs_RebuildDynroot();
  	ObtainReadLock(&afs_dynrootDirLock);
      }
  
***************
*** 447,456 ****
      /*
       * Check if this is an entry under /afs, e.g. /afs/cellname.
       */
!     if (avc->fid.Cell       == AFS_DYNROOT_CELL &&
  	avc->fid.Fid.Volume == AFS_DYNROOT_VOLUME) {
  
  	struct cell *c;
  	int namelen, linklen, cellidx, rw;
  
  	memset(status, 0, sizeof(struct AFSFetchStatus));
--- 516,526 ----
      /*
       * Check if this is an entry under /afs, e.g. /afs/cellname.
       */
!     if (avc->fid.Cell       == afs_dynrootCell &&
  	avc->fid.Fid.Volume == AFS_DYNROOT_VOLUME) {
  
  	struct cell *c;
+ 	struct cell_alias *ca;
  	int namelen, linklen, cellidx, rw;
  
  	memset(status, 0, sizeof(struct AFSFetchStatus));
***************
*** 487,493 ****
  	    return ts ? 1 : 0;
  	}
  
! 	if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) != VN_TYPE_CELL) {
  	    afs_warn("dynroot vnode inconsistency, unknown VNTYPE %d\n",
  		     VNUM_TO_VNTYPE(avc->fid.Fid.Vnode));
  	    return 0;
--- 557,564 ----
  	    return ts ? 1 : 0;
  	}
  
! 	if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) != VN_TYPE_CELL &&
! 	    VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) != VN_TYPE_ALIAS) {
  	    afs_warn("dynroot vnode inconsistency, unknown VNTYPE %d\n",
  		     VNUM_TO_VNTYPE(avc->fid.Fid.Vnode));
  	    return 0;
***************
*** 496,521 ****
  	cellidx = VNUM_TO_CIDX(avc->fid.Fid.Vnode);
  	rw = VNUM_TO_RW(avc->fid.Fid.Vnode);
  
! 	c = afs_GetCellByIndex(cellidx, READ_LOCK, 1 /* refresh */);
! 	if (!c) {
! 	    afs_warn("dynroot vnode inconsistency, can't find cell %d\n",
! 		     cellidx);
! 	    return 0;
! 	}
  
- 	if (c->states & CAlias) {
  	    /*
  	     * linkData needs to contain the name of the cell
  	     * we're aliasing for.
  	     */
! 	    char *realName = c->realName;
! 
  	    if (!realName) {
  		afs_warn("dynroot: alias %s missing real cell name\n",
! 			 c->cellName);
  		linklen = 7;
- 		avc->linkData = afs_osi_Alloc(linklen + 1);
- 		strcpy(avc->linkData, "unknown");
  	    } else {
  		int namelen = strlen(realName);
  		linklen = rw + namelen;
--- 567,592 ----
  	cellidx = VNUM_TO_CIDX(avc->fid.Fid.Vnode);
  	rw = VNUM_TO_RW(avc->fid.Fid.Vnode);
  
! 	if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) == VN_TYPE_ALIAS) {
! 	    char *realName;
! 
! 	    ca = afs_GetCellAlias(cellidx);
! 	    if (!ca) {
! 		afs_warn("dynroot vnode inconsistency, can't find alias %d\n",
! 			 cellidx);
! 		return 0;
! 	    }
  
  	    /*
  	     * linkData needs to contain the name of the cell
  	     * we're aliasing for.
  	     */
! 	    realName = ca->cell;
  	    if (!realName) {
  		afs_warn("dynroot: alias %s missing real cell name\n",
! 			 ca->alias);
! 		avc->linkData = afs_strdup("unknown");
  		linklen = 7;
  	    } else {
  		int namelen = strlen(realName);
  		linklen = rw + namelen;
***************
*** 525,531 ****
--- 596,610 ----
  	    }
  
  	    status->UnixModeBits = 0755;
+ 	    afs_PutCellAlias(ca);
  	} else {
+ 	    c = afs_GetCellByIndex(cellidx, READ_LOCK);
+ 	    if (!c) {
+ 		afs_warn("dynroot vnode inconsistency, can't find cell %d\n",
+ 			 cellidx);
+ 		return 0;
+ 	    }
+ 
  	    /*
  	     * linkData needs to contain "#cell:root.cell" or "%cell:root.cell"
  	     */
***************
*** 537,546 ****
  	    strcat(avc->linkData, ":root.cell");
  
  	    status->UnixModeBits = 0644;
  	}
  
  	status->Length = linklen;
- 	afs_PutCell(c, READ_LOCK);
  	return 1;
      }
  
--- 616,625 ----
  	    strcat(avc->linkData, ":root.cell");
  
  	    status->UnixModeBits = 0644;
+ 	    afs_PutCell(c, READ_LOCK);
  	}
  
  	status->Length = linklen;
  	return 1;
      }
  
***************
*** 555,561 ****
      int enable;
  {
      afs_dynrootEnable = enable;
!     return 0;
  }
  
  /*
--- 634,640 ----
      int enable;
  {
      afs_dynrootEnable = enable;
!     return afs_dynrootCellInit();
  }
  
  /*
***************
*** 571,584 ****
   * Remove a temporary symlink entry from /afs.
   */
  int
! afs_DynrootVOPRemove(avc, acred, aname)
!     struct vcache *avc;
!     struct AFS_UCRED *acred;
!     char *aname;
  {
      struct afs_dynSymlink **tpps;
      struct afs_dynSymlink *tps;
-     struct cell *c;
      int found = 0;
  
      if (acred->cr_uid)
--- 650,660 ----
   * Remove a temporary symlink entry from /afs.
   */
  int
! afs_DynrootVOPRemove(struct vcache *avc, struct AFS_UCRED *acred,
! 		     char *aname)
  {
      struct afs_dynSymlink **tpps;
      struct afs_dynSymlink *tps;
      int found = 0;
  
      if (acred->cr_uid)
***************
*** 601,618 ****
      }
      ReleaseWriteLock(&afs_dynSymlinkLock);
      if (found) {
! 	afs_RefreshDynroot();
  	return 0;
      }
  
!     /* Check if this is an actual cell? */
!     c = afs_GetCellByName2(aname, READ_LOCK, 0 /* no AFSDB */);
!     if (c) {
! 	afs_PutCell(c, READ_LOCK);
  	return EROFS;
!     } else {
  	return ENOENT;
-     }
  }
  
  /*
--- 677,690 ----
      }
      ReleaseWriteLock(&afs_dynSymlinkLock);
      if (found) {
! 	afs_DynrootInvalidate();
  	return 0;
      }
  
!     if (afs_CellOrAliasExists(aname))
  	return EROFS;
!     else 
  	return ENOENT;
  }
  
  /*
***************
*** 626,642 ****
      char *atargetName;
  {
      struct afs_dynSymlink *tps;
-     struct cell *c;
  
      if (acred->cr_uid)
  	return EPERM;
  
!     /* Check if it's already a cell */
!     c = afs_GetCellByName2(aname, READ_LOCK, 0 /* no AFSDB */);
!     if (c) {
! 	afs_PutCell(c, READ_LOCK);
! 	return EEXIST;
!     }
  
      /* Check if it's already a symlink */
      ObtainWriteLock(&afs_dynSymlinkLock, 91);
--- 698,709 ----
      char *atargetName;
  {
      struct afs_dynSymlink *tps;
  
      if (acred->cr_uid)
  	return EPERM;
  
!     if (afs_CellOrAliasExists(aname))
!         return EEXIST;
  
      /* Check if it's already a symlink */
      ObtainWriteLock(&afs_dynSymlinkLock, 91);
***************
*** 660,665 ****
      afs_dynSymlinkBase = tps;
      ReleaseWriteLock(&afs_dynSymlinkLock);
  
!     afs_RefreshDynroot();
      return 0;
  }
--- 727,732 ----
      afs_dynSymlinkBase = tps;
      ReleaseWriteLock(&afs_dynSymlinkLock);
  
!     afs_DynrootInvalidate();
      return 0;
  }
Index: openafs/src/afs/afs_init.c
diff -c openafs/src/afs/afs_init.c:1.11.2.4 openafs/src/afs/afs_init.c:1.11.2.5
*** openafs/src/afs/afs_init.c:1.11.2.4	Fri Nov 15 08:28:32 2002
--- openafs/src/afs/afs_init.c	Thu Mar  6 09:53:25 2003
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_init.c,v 1.11.2.4 2002/11/15 13:28:32 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 16,22 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_init.c,v 1.11.2.5 2003/03/06 14:53:25 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 312,347 ****
   *	WARNING: Data will be written to this file over time by AFS.
   */
  
! afs_InitVolumeInfo(afile)
!     register char *afile;
! 
! { /*afs_InitVolumeInfo*/
! 
      afs_int32 code;
!     struct osi_file *tfile;
!     struct vnode *filevp;
!     struct fcache fce;
! 
!     AFS_STATCNT(afs_InitVolumeInfo);
  #ifdef AFS_LINUX22_ENV
!     {
! 	struct dentry *dp;
! 	code = gop_lookupname(afile, AFS_UIOSYS, 0, (struct vnode **) 0, &dp);
! 	if (code) return ENOENT;
! 	fce.inode = volumeInode = dp->d_inode->i_ino;
! 	dput(dp);
!     }
  #else
!     code = gop_lookupname(afile, AFS_UIOSYS, 0, (struct vnode **) 0, &filevp);
!     if (code) return ENOENT;
!     fce.inode = volumeInode = afs_vnodeToInumber(filevp);
  #ifdef AFS_DEC_ENV
      grele(filevp);
  #else
      AFS_RELE((struct vnode *)filevp);
  #endif
  #endif /* AFS_LINUX22_ENV */
!     tfile = afs_CFileOpen(fce.inode);
      afs_CFileTruncate(tfile, 0);
      afs_CFileClose(tfile);
      return 0;
--- 312,361 ----
   *	WARNING: Data will be written to this file over time by AFS.
   */
  
! static int LookupInodeByPath(char *filename, ino_t *inode)
! {
      afs_int32 code;
!   
  #ifdef AFS_LINUX22_ENV
!     struct dentry *dp;
!     code = gop_lookupname(filename, AFS_UIOSYS, 0, NULL, &dp);
!     if (code) return code;
!     *inode = dp->d_inode->i_ino;
!     dput(dp);
  #else
!     struct vnode *filevp;
!     code = gop_lookupname(filename, AFS_UIOSYS, 0, NULL, &filevp);
!     if (code) return code;
!     *inode = afs_vnodeToInumber(filevp);
  #ifdef AFS_DEC_ENV
      grele(filevp);
  #else
      AFS_RELE((struct vnode *)filevp);
  #endif
  #endif /* AFS_LINUX22_ENV */
!  
!     return 0;
!  }
!  
! int afs_InitCellInfo(char *afile)
! {
!     ino_t inode;
!     int code;
!     
!     code = LookupInodeByPath(afile, &inode);
!     return afs_cellname_init(inode, code);
! }
!  
! int afs_InitVolumeInfo(char *afile)
! {
!     int code;
!     struct osi_file *tfile;
!     struct vnode *filevp;
!     
!     AFS_STATCNT(afs_InitVolumeInfo);
!     code = LookupInodeByPath(afile, &volumeInode);
!     if (code) return code;
!     tfile = afs_CFileOpen(volumeInode);
      afs_CFileTruncate(tfile, 0);
      afs_CFileClose(tfile);
      return 0;
***************
*** 521,527 ****
      AFS_STATCNT(afs_ResourceInit);
      RWLOCK_INIT(&afs_xuser, "afs_xuser");
      RWLOCK_INIT(&afs_xvolume, "afs_xvolume");
-     RWLOCK_INIT(&afs_xcell, "afs_xcell");
      RWLOCK_INIT(&afs_xserver, "afs_xserver");
      RWLOCK_INIT(&afs_xsrvAddr, "afs_xsrvAddr");
      RWLOCK_INIT(&afs_icl_lock, "afs_icl_lock");
--- 535,540 ----
***************
*** 533,538 ****
--- 546,552 ----
      LOCK_INIT(&osi_flplock, "osi_flplock");
      RWLOCK_INIT(&afs_xconn, "afs_xconn");
  
+     afs_CellInit();
      afs_InitCBQueue(1);  /* initialize callback queues */
  
      if (afs_resourceinit_flag == 0) {
***************
*** 544,550 ****
  	afs_sysname = afs_sysnamelist[0];
  	strcpy(afs_sysname, SYS_NAME);
  	afs_sysnamecount = 1;
- 	QInit(&CellLRU);	
  #if	defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)
      {  extern afs_int32 afs_preallocs;
  
--- 558,563 ----
***************
*** 751,769 ****
      if (afs_cold_shutdown) {
        afs_resourceinit_flag = 0; 
        /* 
-        * Free Cells table allocations 
-        */
-       { 
- 	struct cell *tc;
- 	register struct afs_q *cq, *tq;
- 	for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
- 	    tc = QTOC(cq); tq = QNext(cq);
- 	    if (tc->cellName)
- 		afs_osi_Free(tc->cellName, strlen(tc->cellName)+1);
- 	    afs_osi_Free(tc, sizeof(struct cell));
- 	}
-       }
-       /* 
         * Free Volumes table allocations 
         */
        { 
--- 764,769 ----
***************
*** 859,877 ****
        afs_sysname = 0;
        afs_sysnamecount = 0;
        afs_marinerHost = 0;
-       QInit(&CellLRU);      
        afs_setTimeHost = (struct server *)0;
        afs_volCounter = 1;
        afs_waitForever = afs_waitForeverCount = 0;
-       afs_cellindex = 0;
-       afs_nextCellNum = 0x100;
        afs_FVIndex = -1;
        afs_server = (struct rx_service *)0;
        RWLOCK_INIT(&afs_xconn, "afs_xconn");
        memset((char *)&afs_rootFid, 0, sizeof(struct VenusFid));
        RWLOCK_INIT(&afs_xuser, "afs_xuser");
        RWLOCK_INIT(&afs_xvolume, "afs_xvolume"), RWLOCK_INIT(&afs_xcell, "afs_xcell");
!       RWLOCK_INIT(&afs_xserver, "afs_xserver"), LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock");
      }
      
  } /*shutdown_AFS*/
--- 859,874 ----
        afs_sysname = 0;
        afs_sysnamecount = 0;
        afs_marinerHost = 0;
        afs_setTimeHost = (struct server *)0;
        afs_volCounter = 1;
        afs_waitForever = afs_waitForeverCount = 0;
        afs_FVIndex = -1;
        afs_server = (struct rx_service *)0;
        RWLOCK_INIT(&afs_xconn, "afs_xconn");
        memset((char *)&afs_rootFid, 0, sizeof(struct VenusFid));
        RWLOCK_INIT(&afs_xuser, "afs_xuser");
        RWLOCK_INIT(&afs_xvolume, "afs_xvolume"), RWLOCK_INIT(&afs_xcell, "afs_xcell");
!       shutdown_cell();
      }
      
  } /*shutdown_AFS*/
Index: openafs/src/afs/afs_nfsdisp.c
diff -c openafs/src/afs/afs_nfsdisp.c:1.1.2.8 openafs/src/afs/afs_nfsdisp.c:1.1.2.9
*** openafs/src/afs/afs_nfsdisp.c:1.1.2.8	Tue Dec 10 18:17:43 2002
--- openafs/src/afs/afs_nfsdisp.c	Fri Jan 10 04:35:07 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_nfsdisp.c,v 1.1.2.8 2002/12/10 23:17:43 shadow Exp $");
  
  /* Ugly Ugly Ugly  but precludes conflicting XDR macros; We want kernel xdr */
  #define __XDR_INCLUDE__
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_nfsdisp.c,v 1.1.2.9 2003/01/10 09:35:07 shadow Exp $");
  
  /* Ugly Ugly Ugly  but precludes conflicting XDR macros; We want kernel xdr */
  #define __XDR_INCLUDE__
***************
*** 677,683 ****
      case NFSPROC3_LOOKUP:
      {
  	LOOKUP3args *arg = (LOOKUP3args *)args;
! #ifdef AFS_SUN57_ENV
  	fhp1 = (nfs_fh3 *) &arg->what.dirp;
  #else
  	fhp1 = (nfs_fh3 *) &arg->what.dir;
--- 677,683 ----
      case NFSPROC3_LOOKUP:
      {
  	LOOKUP3args *arg = (LOOKUP3args *)args;
! #ifdef AFS_SUN58_ENV
  	fhp1 = (nfs_fh3 *) &arg->what.dirp;
  #else
  	fhp1 = (nfs_fh3 *) &arg->what.dir;
Index: openafs/src/afs/afs_osi.c
diff -c openafs/src/afs/afs_osi.c:1.8.2.11 openafs/src/afs/afs_osi.c:1.8.2.14
*** openafs/src/afs/afs_osi.c:1.8.2.11	Tue Sep 10 18:33:27 2002
--- openafs/src/afs/afs_osi.c	Sun Mar 23 01:46:32 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_osi.c,v 1.8.2.11 2002/09/10 22:33:27 zacheiss Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_osi.c,v 1.8.2.14 2003/03/23 06:46:32 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 289,297 ****
      
  /* unmask signals in rxk listener */
  void afs_osi_UnmaskRxkSignals(){
- #ifdef AFS_LINUX22_ENV
-     osi_linux_unmask();
- #endif
  }
      
  /* register rxk listener proc info */
--- 289,294 ----
***************
*** 494,499 ****
--- 491,500 ----
  #endif
  }
  
+ void afs_osi_FreeStr(char *x)
+ {
+     afs_osi_Free(x, strlen(x) + 1);
+ }
  
  /* ? is it moderately likely that there are dirty VM pages associated with 
   * this vnode?
***************
*** 807,817 ****
--- 808,826 ----
  #ifdef EXPORTED_TASKLIST_LOCK
      read_lock(&tasklist_lock);
  #endif
+ #ifdef DEFINED_FOR_EACH_PROCESS
+     for_each_process(p) if (p->pid) {
+         if (p->state & TASK_ZOMBIE)
+             continue;
+ 	afs_GCPAGs_perproc_func(p);
+     }
+ #else
      for_each_task(p) if (p->pid) {
          if (p->state & TASK_ZOMBIE)
              continue;
  	afs_GCPAGs_perproc_func(p);
      }
+ #endif
  #ifdef EXPORTED_TASKLIST_LOCK
      read_unlock(&tasklist_lock);
  #endif
Index: openafs/src/afs/afs_osi_pag.c
diff -c openafs/src/afs/afs_osi_pag.c:1.8 openafs/src/afs/afs_osi_pag.c:1.8.4.1
*** openafs/src/afs/afs_osi_pag.c:1.8	Thu Jul 12 15:58:15 2001
--- openafs/src/afs/afs_osi_pag.c	Fri Jan 17 00:43:05 2003
***************
*** 22,28 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_osi_pag.c,v 1.8 2001/07/12 19:58:15 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 22,28 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_osi_pag.c,v 1.8.4.1 2003/01/17 05:43:05 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 441,447 ****
  	return NOPAG;
      }
  #else
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DUX40_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV)
      if (cred->cr_ngroups < 2) return NOPAG;
  #endif
  #endif
--- 441,447 ----
  	return NOPAG;
      }
  #else
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DUX40_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV)
      if (cred->cr_ngroups < 2) return NOPAG;
  #endif
  #endif
Index: openafs/src/afs/afs_osi_vget.c
diff -c openafs/src/afs/afs_osi_vget.c:1.5.2.1 openafs/src/afs/afs_osi_vget.c:1.5.2.2
*** openafs/src/afs/afs_osi_vget.c:1.5.2.1	Sun Jan 20 03:20:54 2002
--- openafs/src/afs/afs_osi_vget.c	Thu Mar  6 09:53:25 2003
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_osi_vget.c,v 1.5.2.1 2002/01/20 08:20:54 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 14,20 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_osi_vget.c,v 1.5.2.2 2003/03/06 14:53:25 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 22,29 ****
  
  
  
- extern int afs_NFSRootOnly;
- int afs_rootCellIndex = 0;
  #if !defined(AFS_LINUX20_ENV)
  /* This is the common part of the vget VFS call. */
  int afs_osi_vget(struct vcache **avcpp, struct fid *afidp,
--- 22,27 ----
***************
*** 31,37 ****
  {
      struct VenusFid vfid;
      struct SmallFid Sfid;
-     extern struct cell *afs_GetCellByIndex();
      register struct cell *tcell;
      struct vrequest treq;
      register afs_int32 code = 0, cellindex;
--- 29,34 ----
***************
*** 41,71 ****
  #ifdef AFS_OSF_ENV
      Sfid.Vnode = afidp->fid_reserved;
  #endif
-     if (afs_NFSRootOnly &&
- 	Sfid.Volume == afs_rootFid.Fid.Volume &&
- 	Sfid.Vnode == afs_rootFid.Fid.Vnode &&
- 	(Sfid.CellAndUnique & 0xffffff) ==
- 	(afs_rootFid.Fid.Unique & 0xffffff) &&
- 	((Sfid.CellAndUnique >> 24) & 0xff) == afs_rootCellIndex) {
- 	vfid = afs_rootFid;
-     }
-     else {
- 	/* Need to extract fid from SmallFid. Will need a wild card option for
- 	 * finding the right vcache entry.
- 	 */
- 	struct cell *tcell;
- 	cellindex = (Sfid.CellAndUnique >> 24) & 0xff;
- 	tcell = afs_GetCellByIndex(cellindex, READ_LOCK, 0 /* don't refresh */);
- 	if (!tcell) {
- 	    return ENOENT;
-         }
- 	vfid.Cell = tcell->cell;
- 	afs_PutCell(tcell, WRITE_LOCK);
- 	vfid.Fid.Volume = Sfid.Volume;
- 	vfid.Fid.Vnode = Sfid.Vnode;
- 	vfid.Fid.Unique = Sfid.CellAndUnique & 0xffffff;
-     }
  
  
      /* First attempt to find in cache using wildcard. If that fails,
       * try the usual route to try to get the vcache from the server.
--- 38,56 ----
  #ifdef AFS_OSF_ENV
      Sfid.Vnode = afidp->fid_reserved;
  #endif
  
+     /* Need to extract fid from SmallFid. Will need a wild card option for
+      * finding the right vcache entry.
+      */
+     cellindex = (Sfid.CellAndUnique >> 24) & 0xff;
+     tcell = afs_GetCellByIndex(cellindex, READ_LOCK);
+     if (!tcell)
+ 	return ENOENT;
+     vfid.Cell = tcell->cellNum;
+     afs_PutCell(tcell, WRITE_LOCK);
+     vfid.Fid.Volume = Sfid.Volume;
+     vfid.Fid.Vnode = Sfid.Vnode;
+     vfid.Fid.Unique = Sfid.CellAndUnique & 0xffffff;
  
      /* First attempt to find in cache using wildcard. If that fails,
       * try the usual route to try to get the vcache from the server.
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.22.2.13 openafs/src/afs/afs_pioctl.c:1.22.2.14
*** openafs/src/afs/afs_pioctl.c:1.22.2.13	Thu Sep 12 22:53:19 2002
--- openafs/src/afs/afs_pioctl.c	Thu Mar  6 09:53:25 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_pioctl.c,v 1.22.2.13 2002/09/13 02:53:19 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_pioctl.c,v 1.22.2.14 2003/03/06 14:53:25 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 1327,1365 ****
      return 0;
    }
    
!   static PGetWSCell(avc, afun, areq, ain, aout, ainSize, aoutSize)
!     struct vcache *avc;
!   int afun;
!   struct vrequest *areq;
!   register char *ain;
!   char *aout;
!   afs_int32 ainSize;
!   afs_int32 *aoutSize;	/* set this */ {
!     register struct cell *tcell=0, *cellOne=0;
!     register struct afs_q *cq, *tq;
      
      AFS_STATCNT(PGetWSCell);
      if ( !afs_resourceinit_flag ) 	/* afs deamons havn't started yet */
  	return EIO;          /* Inappropriate ioctl for device */
  
!     ObtainReadLock(&afs_xcell);
!     cellOne = (struct cell *) 0;
! 
!     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
! 	tcell = QTOC(cq); tq = QNext(cq);
! 	if (tcell->states & CPrimary) break;
! 	if (tcell->cell == 1) cellOne = tcell;
! 	tcell = 0;
!     }
!     ReleaseReadLock(&afs_xcell);
!     if (!tcell)	{	    /* no primary cell, use cell #1 */
!       if (!cellOne) return ESRCH;
!       tcell = cellOne;
!     }
      strcpy(aout, tcell->cellName);
      *aoutSize = strlen(aout) + 1;
      return 0;
!   }
    
    static PGetUserCell(avc, afun, areq, ain, aout, ainSize, aoutSize)
      struct vcache *avc;
--- 1327,1355 ----
      return 0;
    }
    
! static PGetWSCell(avc, afun, areq, ain, aout, ainSize, aoutSize)
!      struct vcache *avc;
!      int afun;
!      struct vrequest *areq;
!      register char *ain;
!      char *aout;
!      afs_int32 ainSize;
!      afs_int32 *aoutSize;	/* set this */ 
! {
!     struct cell *tcell = NULL;
      
      AFS_STATCNT(PGetWSCell);
      if ( !afs_resourceinit_flag ) 	/* afs deamons havn't started yet */
  	return EIO;          /* Inappropriate ioctl for device */
  
!     tcell = afs_GetPrimaryCell(READ_LOCK);
!     if (!tcell)               /* no primary cell? */
! 	return ESRCH;
      strcpy(aout, tcell->cellName);
      *aoutSize = strlen(aout) + 1;
+     afs_PutCell(tcell, READ_LOCK);
      return 0;
! }
    
    static PGetUserCell(avc, afun, areq, ain, aout, ainSize, aoutSize)
      struct vcache *avc;
***************
*** 1454,1473 ****
  	  set_parent_pag = 1;
        }
        tcell = afs_GetCellByName(ain, READ_LOCK);
!       if (tcell) {
! 	i = tcell->cell;
!       }
!       else {
! 	goto nocell;
!       }
      }
      else {
!       /* default to cell 1, primary id */
        flag = 1;		/* primary id */
!       i = 1;		/* cell number */
!       tcell = afs_GetCell(1, READ_LOCK);
        if (!tcell) goto nocell;
      }
      afs_PutCell(tcell, READ_LOCK);
      if (set_parent_pag) {
  	int pag;
--- 1444,1458 ----
  	  set_parent_pag = 1;
        }
        tcell = afs_GetCellByName(ain, READ_LOCK);
!       if (!tcell) goto nocell;
      }
      else {
!       /* default to primary cell, primary id */
        flag = 1;		/* primary id */
!       tcell = afs_GetPrimaryCell(READ_LOCK);
        if (!tcell) goto nocell;
      }
+     i = tcell->cellNum;
      afs_PutCell(tcell, READ_LOCK);
      if (set_parent_pag) {
  	int pag;
***************
*** 1818,1824 ****
  	    }
  	}
  	else {
! 	    if (tu->uid == areq->uid && tu->cell == 1) break;
  	}
      }
      if (tu) {
--- 1803,1809 ----
  	    }
  	}
  	else {
! 	    if (tu->uid == areq->uid && afs_IsPrimaryCellNum(tu->cell)) break;
  	}
      }
      if (tu) {
***************
*** 2003,2009 ****
      else cellp = (struct cell *) 0;
      if (!cellp && (temp & 2)) {
  	/* use local cell */
! 	cellp = afs_GetCell(1, READ_LOCK);
      }
      if (!(temp & 1)) {	/* if not fast, call server checker routine */
  	afs_CheckServers(1, cellp);	/* check down servers */
--- 1988,1994 ----
      else cellp = (struct cell *) 0;
      if (!cellp && (temp & 2)) {
  	/* use local cell */
! 	cellp = afs_GetPrimaryCell(READ_LOCK);
      }
      if (!(temp & 1)) {	/* if not fast, call server checker routine */
  	afs_CheckServers(1, cellp);	/* check down servers */
***************
*** 2342,2348 ****
      }
  
      linkedstate |= CNoSUID; /* setuid is disabled by default for fs newcell */
!     code = afs_NewCell(newcell, cellHosts, linkedstate, linkedcell, fsport, vlport, (int)0, (char *) 0);
      return code;
  }
  
--- 2327,2333 ----
      }
  
      linkedstate |= CNoSUID; /* setuid is disabled by default for fs newcell */
!     code = afs_NewCell(newcell, cellHosts, linkedstate, linkedcell, fsport, vlport, (int)0);
      return code;
  }
  
***************
*** 2357,2367 ****
      afs_int32 *aoutSize;	/* set this */
  {
      /* create a new cell alias */
-     register struct cell *tcell;
      char *tp = ain;
      register afs_int32 code;
      char *realName, *aliasName;
-     register struct afs_q *cq, *tq;
      
      if ( !afs_resourceinit_flag ) 	/* afs deamons havn't started yet */
  	return EIO;          /* Inappropriate ioctl for device */
--- 2342,2350 ----
***************
*** 2373,2394 ****
      tp += strlen(aliasName) + 1;
      realName = tp;
  
!     /*
!      * Prevent user from shooting themselves in the foot -- don't allow
!      * creation of aliases when a real cell already exists with that name.
!      */
!     ObtainReadLock(&afs_xcell);
!     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
! 	tcell = QTOC(cq); tq = QNext(cq);
! 	if ((afs_strcasecmp(tcell->cellName, aliasName) == 0) &&
! 	    !(tcell->states & CAlias)) {
! 	    ReleaseReadLock(&afs_xcell);
! 	    return EEXIST;
! 	}
!     }
!     ReleaseReadLock(&afs_xcell);
! 
!     code = afs_NewCell(aliasName, 0, CAlias, 0, 0, 0, 0, realName);
      *aoutSize = 0;
      return code;
  }
--- 2356,2362 ----
      tp += strlen(aliasName) + 1;
      realName = tp;
  
!     code = afs_NewCellAlias(aliasName, realName);
      *aoutSize = 0;
      return code;
  }
***************
*** 2404,2410 ****
      register struct cell *tcell=0;
      register afs_int32 i;
      register char *cp, *tp = ain;
-     register struct afs_q *cq, *tq;
  
      AFS_STATCNT(PListCells);
      if ( !afs_resourceinit_flag ) 	/* afs deamons havn't started yet */
--- 2372,2377 ----
***************
*** 2412,2418 ****
  
      memcpy((char *)&whichCell, tp, sizeof(afs_int32));
      tp += sizeof(afs_int32);
!     tcell = afs_GetRealCellByIndex(whichCell, READ_LOCK, 0);
      if (tcell) {
  	cp = aout;
  	memset(cp, 0, MAXCELLHOSTS * sizeof(afs_int32));
--- 2379,2385 ----
  
      memcpy((char *)&whichCell, tp, sizeof(afs_int32));
      tp += sizeof(afs_int32);
!     tcell = afs_GetCellByIndex(whichCell, READ_LOCK);
      if (tcell) {
  	cp = aout;
  	memset(cp, 0, MAXCELLHOSTS * sizeof(afs_int32));
***************
*** 2425,2430 ****
--- 2392,2398 ----
  	strcpy(cp, tcell->cellName);
  	cp += strlen(tcell->cellName)+1;
  	*aoutSize = cp - aout;
+ 	afs_PutCell(tcell, READ_LOCK);
      }
      if (tcell) return 0;
      else return EDOM;
***************
*** 2439,2447 ****
      afs_int32 *aoutSize;	/* set this */
  {
      afs_int32 whichAlias;
!     register struct cell *tcell=0;
      register char *cp, *tp = ain;
-     register struct afs_q *cq, *tq;
  
      if ( !afs_resourceinit_flag ) 	/* afs deamons havn't started yet */
  	return EIO;          /* Inappropriate ioctl for device */
--- 2407,2414 ----
      afs_int32 *aoutSize;	/* set this */
  {
      afs_int32 whichAlias;
!     register struct cell_alias *tcalias=0;
      register char *cp, *tp = ain;
  
      if ( !afs_resourceinit_flag ) 	/* afs deamons havn't started yet */
  	return EIO;          /* Inappropriate ioctl for device */
***************
*** 2451,2477 ****
      memcpy((char *)&whichAlias, tp, sizeof(afs_int32));
      tp += sizeof(afs_int32);
  
!     ObtainReadLock(&afs_xcell);
!     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
! 	tcell = QTOC(cq); tq = QNext(cq);
! 	if (!(tcell->states & CAlias)) {
! 	    tcell = 0;
! 	    continue;
! 	}
! 	if (whichAlias == 0) break;
! 	tcell = 0;
! 	whichAlias--;
!     }
!     if (tcell) {	
  	cp = aout;
! 	strcpy(cp, tcell->cellName);
! 	cp += strlen(tcell->cellName)+1;
! 	strcpy(cp, tcell->realName);
! 	cp += strlen(tcell->realName)+1;
  	*aoutSize = cp - aout;
      }
!     ReleaseReadLock(&afs_xcell);
!     if (tcell) return 0;
      else return EDOM;
  }
  
--- 2418,2434 ----
      memcpy((char *)&whichAlias, tp, sizeof(afs_int32));
      tp += sizeof(afs_int32);
  
!     tcalias = afs_GetCellAlias(whichAlias);
!     if (tcalias) {	
  	cp = aout;
! 	strcpy(cp, tcalias->alias);
! 	cp += strlen(tcalias->alias)+1;
! 	strcpy(cp, tcalias->cell);
! 	cp += strlen(tcalias->cell)+1;
  	*aoutSize = cp - aout;
+ 	afs_PutCellAlias(tcalias);
      }
!     if (tcalias) return 0;
      else return EDOM;
  }
  
***************
*** 2956,2965 ****
   * fine.  Should consider special-casing the local cell for large n.
   * Likewise for PSetSPrefs.
   */
! static void ReSortCells(s,l, vlonly)  
!   int s;     /* number of ids in array l[] -- NOT index of last id */
!   afs_int32 l[];  /* array of cell ids which have volumes that need to be sorted */
!   int vlonly; /* sort vl servers or file servers?*/
  {
    extern struct volume *afs_volumes[NVOLS];   /* volume hash table */
  
--- 2913,2934 ----
   * fine.  Should consider special-casing the local cell for large n.
   * Likewise for PSetSPrefs.
   */
! static void *ReSortCells_cb(struct cell *cell, void *arg)
! {
!     afs_int32 *p = (afs_int32 *) arg;
!     afs_int32 *l = p + 1;
!     int i, s = p[0];
!  
!     for (i=0; i<s; i++) {
! 	if (l[i] == cell->cellNum) {
! 	    ObtainWriteLock(&cell->lock, 690);
! 	    afs_SortServers(cell->cellHosts, MAXCELLHOSTS);
! 	    ReleaseWriteLock(&cell->lock);
! 	}
!     }
! }
! 
! static void ReSortCells(int s, afs_int32 *l, int vlonly)  
  {
    extern struct volume *afs_volumes[NVOLS];   /* volume hash table */
  
***************
*** 2968,2982 ****
    register int  k;
  
    if (vlonly) {
!       struct cell *tcell;
!       ObtainWriteLock(&afs_xcell,300);
!       for(k=0;k<s;k++) {
! 	  tcell = afs_GetCellNoLock(l[k], WRITE_LOCK);
! 	  if (!tcell) continue;
! 	  afs_SortServers(tcell->cellHosts, MAXCELLHOSTS);
! 	  afs_PutCell(tcell, WRITE_LOCK);
!       }
!       ReleaseWriteLock(&afs_xcell);
        return;
    }
  
--- 2937,2948 ----
    register int  k;
  
    if (vlonly) {
!       afs_int32 *p;
!       p = (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * (s+1));
!       p[0] = s;
!       memcpy(p+1, l, s * sizeof(afs_int32));
!       afs_TraverseCells(&ReSortCells_cb, p);
!       afs_osi_Free(p, sizeof(afs_int32) * (s+1));
        return;
    }
  
***************
*** 3038,3047 ****
  	 
  	 if (srvr->cell) {
  	   /* if we don't know yet what cell it's in, this is moot */
! 	   for (j=touchedSize-1; j>=0 && touched[j] != srvr->cell->cell; j--)
  		 /* is it in our list of touched cells ?  */ ;
  	   if (j < 0) {                   /* no, it's not */
! 	     touched[touchedSize++] = srvr->cell->cell;
  	     if (touchedSize >= 32) {                /* watch for ovrflow */
  	       ReleaseReadLock(&afs_xserver);
  	       ReSortCells(touchedSize, touched, vlonly);
--- 3004,3013 ----
  	 
  	 if (srvr->cell) {
  	   /* if we don't know yet what cell it's in, this is moot */
! 	   for (j=touchedSize-1; j>=0 && touched[j] != srvr->cell->cellNum; j--)
  		 /* is it in our list of touched cells ?  */ ;
  	   if (j < 0) {                   /* no, it's not */
! 	     touched[touchedSize++] = srvr->cell->cellNum;
  	     if (touchedSize >= 32) {                /* watch for ovrflow */
  	       ReleaseReadLock(&afs_xserver);
  	       ReSortCells(touchedSize, touched, vlonly);
Index: openafs/src/afs/afs_prototypes.h
diff -c openafs/src/afs/afs_prototypes.h:1.4.4.2 openafs/src/afs/afs_prototypes.h:1.4.4.5
*** openafs/src/afs/afs_prototypes.h:1.4.4.2	Thu Nov 14 16:03:57 2002
--- openafs/src/afs/afs_prototypes.h	Mon Mar 10 18:29:53 2003
***************
*** 18,26 ****
  			struct cell *cellp);
  
  /* afs_cell.c */
! extern struct cell *afs_GetRealCellByIndex(register afs_int32 cellindex,
! 					   afs_int32 locktype,
! 					   afs_int32 refresh);
  
  /* afs_conn.c */
  extern struct conn *afs_ConnBySA(struct srvAddr *sap, unsigned short aport,
--- 18,49 ----
  			struct cell *cellp);
  
  /* afs_cell.c */
! extern afs_rwlock_t afs_xcell;
! extern void afs_CellInit(void);
! extern void shutdown_cell(void);
! extern int afs_cellname_init(ino_t inode, int lookupcode);
! extern int afs_cellname_write();
! extern afs_int32 afs_NewCell(char *acellName, afs_int32 *acellHosts,
! 			     int aflags, char *linkedcname, u_short fsport, 
! 			     u_short vlport, int timeout);
! extern afs_int32 afs_SetPrimaryCell(char *acellName);
! extern struct cell *afs_GetCell(afs_int32 acell, afs_int32 locktype);
! extern struct cell *afs_GetCellStale(afs_int32 acell, afs_int32 locktype);
! extern struct cell *afs_GetCellByIndex(afs_int32 cellidx, afs_int32 locktype);
! extern struct cell *afs_GetCellByName(char *acellName, afs_int32 locktype);
! extern struct cell *afs_GetPrimaryCell(afs_int32 locktype);
! extern int afs_IsPrimaryCellNum(afs_int32 cellnum);
! extern int afs_IsPrimaryCell(struct cell *cell);
! extern void *afs_TraverseCells(void *(*cb)(struct cell *, void *), void *arg);
! extern int afs_CellOrAliasExists(char *aname);
! extern int afs_CellNumValid(afs_int32 cellnum);
! extern afs_int32 afs_NewCellAlias(char *alias, char *cell);
! extern struct cell_alias *afs_GetCellAlias(int index);
! extern int afs_AFSDBHandler(char *acellName, int acellNameLen,
! 			    afs_int32 *kernelMsg);
! extern void afs_LookupAFSDB(char *acellName);
! extern void afs_StopAFSDB(void);
! extern void afs_RemoveCellEntry(struct server *srvp);
  
  /* afs_conn.c */
  extern struct conn *afs_ConnBySA(struct srvAddr *sap, unsigned short aport,
***************
*** 28,33 ****
--- 51,57 ----
  			  int force_if_down, afs_int32 create, afs_int32 locktype);
  
  /* afs_dcache.c */
+ extern int cacheDiskType;
  extern void afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk,
  			   int aflags);
  
***************
*** 84,90 ****
--- 108,116 ----
  
  /* afs_util.c */
  extern char *afs_cv2string(char *ttp, afs_uint32 aval);
+ extern int afs_strcasecmp(char *s1, char *s2);
  extern char *afs_strchr(char *s, int c);
+ extern char *afs_strdup(char *s);
  extern void print_internet_address(char *preamble, struct srvAddr *sa,
  			    char *postamble, int flag);
  extern afs_int32 afs_data_pointer_to_int32(const void *p);
Index: openafs/src/afs/afs_server.c
diff -c openafs/src/afs/afs_server.c:1.11.2.5 openafs/src/afs/afs_server.c:1.11.2.6
*** openafs/src/afs/afs_server.c:1.11.2.5	Wed Aug 21 16:53:21 2002
--- openafs/src/afs/afs_server.c	Thu Mar  6 09:53:25 2003
***************
*** 32,38 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_server.c,v 1.11.2.5 2002/08/21 20:53:21 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 32,38 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_server.c,v 1.11.2.6 2003/03/06 14:53:25 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 90,95 ****
--- 90,115 ----
  
  
  
+ static struct afs_stats_SrvUpDownInfo *
+ GetUpDownStats(struct server *srv)
+ {
+     struct afs_stats_SrvUpDownInfo *upDownP;
+     u_short fsport = AFS_FSPORT;
+ 
+     if (srv->cell)
+ 	fsport = srv->cell->fsport;
+ 
+     if (srv->addr->sa_portal == fsport)
+ 	upDownP = afs_stats_cmperf.fs_UpDown;
+     else
+ 	upDownP = afs_stats_cmperf.vl_UpDown;
+ 
+     if (srv->cell && afs_IsPrimaryCell(srv->cell))
+ 	return &upDownP[AFS_STATS_UPDOWN_IDX_SAME_CELL];
+     else
+ 	return &upDownP[AFS_STATS_UPDOWN_IDX_DIFF_CELL];
+ }
+ 
  
  /*------------------------------------------------------------------------
   * afs_MarkServerUpOrDown
***************
*** 165,180 ****
      currTimeP = &currTime;
      osi_GetuTime(currTimeP);
  
!     if (sa->sa_portal == AFS_FSPORT) {
! 	upDownP = (a_serverP->cell->cell == 1) ?
! 	    &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
! 	    &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
!     } /*File Server record*/
!     else {
! 	upDownP = (a_serverP->cell->cell == 1) ?
! 	    &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
! 	    &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
!     } /*VL Server record*/
  
      if (a_isDown) {
  	/*
--- 185,191 ----
      currTimeP = &currTime;
      osi_GetuTime(currTimeP);
  
!     upDownP = GetUpDownStats(a_serverP);
  
      if (a_isDown) {
  	/*
***************
*** 295,301 ****
  	return;	/* can't do much */
  
      tc = afs_ConnByHost(aserver, aserver->cell->vlport, 
! 			aserver->cell->cell, areq, 1, SHARED_LOCK);
      if (!tc)
  	return;
      rx_SetConnDeadTime(tc->id, 3);
--- 306,312 ----
  	return;	/* can't do much */
  
      tc = afs_ConnByHost(aserver, aserver->cell->vlport, 
! 			aserver->cell->cellNum, areq, 1, SHARED_LOCK);
      if (!tc)
  	return;
      rx_SetConnDeadTime(tc->id, 3);
***************
*** 429,445 ****
  		 * in the appropriate places.
  		 */
  		srvRecordAge = currTime.tv_sec - currSrvP->activationTime;
! 		if (currSrvP->addr->sa_portal == AFS_FSPORT) {
! 		    upDownP = (currSrvP->cell->cell == 1) ?
! 			&(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]):
! 			&(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
! 		} /*File Server record*/
! 		else {
! 		    upDownP = (currSrvP->cell->cell == 1) ?
! 			&(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]):
! 			&(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
! 		} /*VL Server record*/
! 
  		upDownP->sumOfRecordAges += srvRecordAge;
  		if ((upDownP->ageOfYoungestRecord == 0) ||
  		    (srvRecordAge < upDownP->ageOfYoungestRecord))
--- 440,446 ----
  		 * in the appropriate places.
  		 */
  		srvRecordAge = currTime.tv_sec - currSrvP->activationTime;
! 		upDownP = GetUpDownStats(currSrvP);
  		upDownP->sumOfRecordAges += srvRecordAge;
  		if ((upDownP->ageOfYoungestRecord == 0) ||
  		    (srvRecordAge < upDownP->ageOfYoungestRecord))
***************
*** 568,575 ****
  	    continue;  /* have just been added by setsprefs */ 
  
  	/* get a connection, even if host is down; bumps conn ref count */
! 	tu = afs_GetUser(treq.uid, ts->cell->cell, SHARED_LOCK);
! 	tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cell, tu,
  			  1/*force*/, 1/*create*/, SHARED_LOCK);
  	afs_PutUser(tu, SHARED_LOCK);
  	if (!tc) continue;
--- 569,576 ----
  	    continue;  /* have just been added by setsprefs */ 
  
  	/* get a connection, even if host is down; bumps conn ref count */
! 	tu = afs_GetUser(treq.uid, ts->cell->cellNum, SHARED_LOCK);
! 	tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cellNum, tu,
  			  1/*force*/, 1/*create*/, SHARED_LOCK);
  	afs_PutUser(tu, SHARED_LOCK);
  	if (!tc) continue;
***************
*** 602,613 ****
  	     */
  	    if (code == 0 && start == end && afs_setTime != 0 &&
  		(tc->srvr->server == afs_setTimeHost ||
! 		/*
! 		 * Sync only to a server in the local cell: cell(id)==1
! 		 * or CPrimary.
! 		 */
  		(afs_setTimeHost == (struct server *)0 &&
! 		 (ts->cell->cell == 1 || (ts->cell->states&CPrimary))))) {
  
  		char msgbuf[90];  /* strlen("afs: setting clock...") + slop */
  		/* set the time */
--- 603,611 ----
  	     */
  	    if (code == 0 && start == end && afs_setTime != 0 &&
  		(tc->srvr->server == afs_setTimeHost ||
! 		/* Sync only to a server in the local cell */
  		(afs_setTimeHost == (struct server *)0 &&
! 		 afs_IsPrimaryCell(ts->cell)))) {
  
  		char msgbuf[90];  /* strlen("afs: setting clock...") + slop */
  		/* set the time */
***************
*** 1605,1620 ****
         /* With the introduction of this new record, we need to adjust the
  	* proper individual & global server up/down info.
  	*/
!        if (aport == fsport) {   /* File Server record */
! 	  upDownP = (acell == 1) ?
! 	    &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
! 	    &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
!        } else {                   /* VL Server record */
! 	  upDownP = (acell == 1) ?
! 	    &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
! 	    &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
!        } 
!        (upDownP->numTtlRecords)    += srvcount;
         afs_stats_cmperf.srvRecords += srvcount;
         if (afs_stats_cmperf.srvRecords > afs_stats_cmperf.srvRecordsHWM)
  	  afs_stats_cmperf.srvRecordsHWM = afs_stats_cmperf.srvRecords;
--- 1603,1610 ----
         /* With the introduction of this new record, we need to adjust the
  	* proper individual & global server up/down info.
  	*/
!        upDownP = GetUpDownStats(newts);
!        upDownP->numTtlRecords      += srvcount;
         afs_stats_cmperf.srvRecords += srvcount;
         if (afs_stats_cmperf.srvRecords > afs_stats_cmperf.srvRecordsHWM)
  	  afs_stats_cmperf.srvRecordsHWM = afs_stats_cmperf.srvRecords;
***************
*** 1642,1662 ****
        currTimeP = &currTime;
        osi_GetuTime(currTimeP);
        aserver->activationTime = currTime.tv_sec;
!       if (sap->sa_portal == AFS_FSPORT) {
! 	 upDownP = (aserver->cell->cell == 1) ?
! 	      &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
! 		   &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
!       } /*File Server record*/
!       else {
! 	 upDownP = (aserver->cell->cell == 1) ?
! 	      &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
! 		   &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
!       } /*VL Server record*/
!       if (aserver->flags & SRVR_ISDOWN)
! 	   (upDownP->numDownRecords)++;
!       else {
! 	 (upDownP->numUpRecords)++;
! 	 (upDownP->numRecordsNeverDown)++;
        }
     }
  }
--- 1632,1643 ----
        currTimeP = &currTime;
        osi_GetuTime(currTimeP);
        aserver->activationTime = currTime.tv_sec;
!       upDownP = GetUpDownStats(aserver);
!       if (aserver->flags & SRVR_ISDOWN) {
! 	 upDownP->numDownRecords++;
!       } else {
! 	 upDownP->numUpRecords++;
! 	 upDownP->numRecordsNeverDown++;
        }
     }
  }
Index: openafs/src/afs/afs_stats.h
diff -c openafs/src/afs/afs_stats.h:1.3.6.1 openafs/src/afs/afs_stats.h:1.3.6.2
*** openafs/src/afs/afs_stats.h:1.3.6.1	Wed Jul 31 18:19:50 2002
--- openafs/src/afs/afs_stats.h	Thu Mar  6 09:53:25 2003
***************
*** 637,642 ****
--- 637,644 ----
      afs_int32 C_SRXAFSCB_GetLocalCell;	/* afs_callback.c*/
      afs_int32 C_afs_MarshallCacheConfig;	/* afs_callback.c*/
      afs_int32 C_SRXAFSCB_GetCacheConfig;	/* afs_callback.c*/
+     afs_int32 C_SRXAFSCB_GetCE64;     /* afs_callback.c*/
+     afs_int32 C_SRXAFSCB_GetCellByNum;        /* afs_callback.c*/
  };
  
  struct afs_CMMeanStats {
Index: openafs/src/afs/afs_util.c
diff -c openafs/src/afs/afs_util.c:1.5.4.3 openafs/src/afs/afs_util.c:1.5.4.4
*** openafs/src/afs/afs_util.c:1.5.4.3	Thu Nov 14 16:03:57 2002
--- openafs/src/afs/afs_util.c	Thu Mar  6 10:39:43 2003
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_util.c,v 1.5.4.3 2002/11/14 21:03:57 zacheiss Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 15,21 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_util.c,v 1.5.4.4 2003/03/06 15:39:43 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 79,84 ****
--- 79,113 ----
        if (*p == c)
  	return p;
      return NULL;
+ }
+ 
+ int afs_strcasecmp(char *s1, char *s2)
+ {
+     while (*s1 && *s2) {
+ 	char c1, c2;
+ 
+ 	c1 = *s1++;
+ 	c2 = *s2++;
+ 	if (c1 >= 'A' && c1 <= 'Z') c1 += 0x20;
+ 	if (c2 >= 'A' && c2 <= 'Z') c2 += 0x20;
+ 	if (c1 != c2)
+ 	    return c1-c2;
+     }
+ 
+     return *s1 - *s2;
+ }
+ 
+ char *afs_strdup(char *s)
+ {
+     char *n;
+     int cc;
+ 
+     cc = strlen(s) + 1;
+     n = (char *) afs_osi_Alloc(cc);
+     if (n)
+ 	memcpy(n, s, cc);
+ 
+     return n;
  }
  
  void print_internet_address(char *preamble, struct srvAddr *sa,
Index: openafs/src/afs/afs_vcache.c
diff -c openafs/src/afs/afs_vcache.c:1.9.2.18 openafs/src/afs/afs_vcache.c:1.9.2.19
*** openafs/src/afs/afs_vcache.c:1.9.2.18	Tue Nov 19 22:18:47 2002
--- openafs/src/afs/afs_vcache.c	Thu Mar  6 09:53:25 2003
***************
*** 38,44 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_vcache.c,v 1.9.2.18 2002/11/20 03:18:47 zacheiss Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
--- 38,44 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_vcache.c,v 1.9.2.19 2003/03/06 14:53:25 shadow Exp $");
  
  #include "../afs/sysincludes.h" /*Standard vendor system headers*/
  #include "../afs/afsincludes.h" /*AFS-based standard headers*/
***************
*** 374,380 ****
  		    callBacks[0].CallBackType = CB_EXCLUSIVE;
  		    for (safety3 = 0; safety3 < MAXHOSTS*2; safety3++) {
  			tc = afs_ConnByHost(tsp, tsp->cell->fsport,
! 					    tsp->cell->cell, &treq, 0,
  					    SHARED_LOCK);
  			if (tc) {
  			  XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS);
--- 374,380 ----
  		    callBacks[0].CallBackType = CB_EXCLUSIVE;
  		    for (safety3 = 0; safety3 < MAXHOSTS*2; safety3++) {
  			tc = afs_ConnByHost(tsp, tsp->cell->fsport,
! 					    tsp->cell->cellNum, &treq, 0,
  					    SHARED_LOCK);
  			if (tc) {
  			  XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS);
***************
*** 632,640 ****
   *	entries locked.
   */
  
! afs_RemoveVCB(afid)
!     register struct VenusFid *afid;
! 
  { /*afs_RemoveVCB*/
  
      register int i, j;
--- 632,638 ----
   *	entries locked.
   */
  
! afs_RemoveVCB(struct VenusFid *afid)
  { /*afs_RemoveVCB*/
  
      register int i, j;
***************
*** 648,654 ****
      for(i=0;i<NSERVERS;i++) {
  	for(tsp=afs_servers[i]; tsp; tsp=tsp->next) {
  	    /* if cell is known, and is wrong, then skip this server */
! 	    if (tsp->cell && tsp->cell->cell != afid->Cell) continue;
  
  	    /*
  	     * Otherwise, iterate through file IDs we're sending to the
--- 646,652 ----
      for(i=0;i<NSERVERS;i++) {
  	for(tsp=afs_servers[i]; tsp; tsp=tsp->next) {
  	    /* if cell is known, and is wrong, then skip this server */
! 	    if (tsp->cell && tsp->cell->cellNum != afid->Cell) continue;
  
  	    /*
  	     * Otherwise, iterate through file IDs we're sending to the
***************
*** 2530,2536 ****
      if (flag & DO_STATS) {
        if (tvc) 	afs_stats_cmperf.vcacheHits++;
        else	afs_stats_cmperf.vcacheMisses++;
!       if (afid->Cell == LOCALCELL)
          afs_stats_cmperf.vlocalAccesses++;
        else
          afs_stats_cmperf.vremoteAccesses++;
--- 2528,2534 ----
      if (flag & DO_STATS) {
        if (tvc) 	afs_stats_cmperf.vcacheHits++;
        else	afs_stats_cmperf.vcacheMisses++;
!       if (afs_IsPrimaryCellNum(afid->Cell))
          afs_stats_cmperf.vlocalAccesses++;
        else
          afs_stats_cmperf.vremoteAccesses++;
***************
*** 2672,2678 ****
  
      if (tvc) 	afs_stats_cmperf.vcacheHits++;
      else	afs_stats_cmperf.vcacheMisses++;
!     if (afid->Cell == LOCALCELL)
          afs_stats_cmperf.vlocalAccesses++;
      else
          afs_stats_cmperf.vremoteAccesses++;
--- 2670,2676 ----
  
      if (tvc) 	afs_stats_cmperf.vcacheHits++;
      else	afs_stats_cmperf.vcacheMisses++;
!     if (afs_IsPrimaryCellNum(afid->Cell))
          afs_stats_cmperf.vlocalAccesses++;
      else
          afs_stats_cmperf.vremoteAccesses++;
Index: openafs/src/afs/afs_volume.c
diff -c openafs/src/afs/afs_volume.c:1.6.2.5 openafs/src/afs/afs_volume.c:1.6.2.6
*** openafs/src/afs/afs_volume.c:1.6.2.5	Wed Aug 21 16:53:22 2002
--- openafs/src/afs/afs_volume.c	Thu Mar  6 09:53:25 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_volume.c,v 1.6.2.5 2002/08/21 20:53:22 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
--- 18,24 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/afs_volume.c,v 1.6.2.6 2003/03/06 14:53:25 shadow Exp $");
  
  #include "../afs/stds.h"
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 112,118 ****
  
  {
      register struct volume *tv, **lv;
!     register char *tfile;
      register afs_int32 i, code;
      afs_int32 bestTime;
      struct volume *bestVp, **bestLp;
--- 112,118 ----
  
  {
      register struct volume *tv, **lv;
!     struct osi_file *tfile;
      register afs_int32 i, code;
      afs_int32 bestTime;
      struct volume *bestVp, **bestLp;
***************
*** 461,467 ****
      ObtainWriteLock(&afs_xvolume,108);
      i = VHash(volid);
      for (tv = afs_volumes[i]; tv; tv=tv->next) {
! 	if (tv->volume == volid && tv->cell == tcell->cell) {
  	    break;
  	}
      }
--- 461,467 ----
      ObtainWriteLock(&afs_xvolume,108);
      i = VHash(volid);
      for (tv = afs_volumes[i]; tv; tv=tv->next) {
! 	if (tv->volume == volid && tv->cell == tcell->cellNum) {
  	    break;
  	}
      }
***************
*** 470,483 ****
  
  	tv = afs_GetVolSlot();
  	memset((char *)tv, 0, sizeof(struct volume));
! 	tv->cell = tcell->cell;
  	RWLOCK_INIT(&tv->lock, "volume lock");
  	tv->next = afs_volumes[i];	/* thread into list */
  	afs_volumes[i] = tv;
  	tv->volume = volid;
  	for (j=fvTable[FVHash(tv->cell,volid)]; j!=0; j=tf->next) {
  	    if (afs_FVIndex != j) {
! 		char *tfile;
  		tfile = osi_UFSOpen(volumeInode);
  		err = afs_osi_Read(tfile, sizeof(struct fvolume) * j, &staticFVolume, sizeof(struct fvolume));
  		if (err != sizeof(struct fvolume))
--- 470,483 ----
  
  	tv = afs_GetVolSlot();
  	memset((char *)tv, 0, sizeof(struct volume));
! 	tv->cell = tcell->cellNum;
  	RWLOCK_INIT(&tv->lock, "volume lock");
  	tv->next = afs_volumes[i];	/* thread into list */
  	afs_volumes[i] = tv;
  	tv->volume = volid;
  	for (j=fvTable[FVHash(tv->cell,volid)]; j!=0; j=tf->next) {
  	    if (afs_FVIndex != j) {
! 		struct osi_file *tfile;
  		tfile = osi_UFSOpen(volumeInode);
  		err = afs_osi_Read(tfile, sizeof(struct fvolume) * j, &staticFVolume, sizeof(struct fvolume));
  		if (err != sizeof(struct fvolume))
***************
*** 506,517 ****
      ReleaseWriteLock(&afs_xvolume);
      ObtainWriteLock(&tv->lock,111);
      if (type == 2) {
! 	InstallUVolumeEntry(tv, uve, tcell->cell, tcell, areq);
      }
      else if (type == 1)
! 	InstallNVolumeEntry(tv, nve, tcell->cell);
      else
! 	InstallVolumeEntry(tv, ove, tcell->cell);
      if (agood) {
  	if (!tv->name) {
  	    tv->name = afs_osi_Alloc(strlen(aname) + 1);
--- 506,517 ----
      ReleaseWriteLock(&afs_xvolume);
      ObtainWriteLock(&tv->lock,111);
      if (type == 2) {
! 	InstallUVolumeEntry(tv, uve, tcell->cellNum, tcell, areq);
      }
      else if (type == 1)
! 	InstallNVolumeEntry(tv, nve, tcell->cellNum);
      else
! 	InstallVolumeEntry(tv, ove, tcell->cellNum);
      if (agood) {
  	if (!tv->name) {
  	    tv->name = afs_osi_Alloc(strlen(aname) + 1);
***************
*** 573,579 ****
      tve.volumeId[ROVOL] = fid->Fid.Volume;
      tve.flags = VLF_ROEXISTS;
  
!     tv = afs_SetupVolume(0, bp, &tve, tcell, 0, 0, 0);
      afs_PutCell(tcell, READ_LOCK);
      return tv;
  }
--- 573,579 ----
      tve.volumeId[ROVOL] = fid->Fid.Volume;
      tve.flags = VLF_ROEXISTS;
  
!     tv = afs_SetupVolume(0, bp, (char *) &tve, tcell, 0, 0, 0);
      afs_PutCell(tcell, READ_LOCK);
      return tv;
  }
***************
*** 614,620 ****
      afs_InitReq(&treq, &afs_osi_cred);	/* *must* be unauth for vldb */
      do {
  	tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport,
! 				 tcell->cell, &treq, SHARED_LOCK);
  	if (tconn) {
  	    if (tconn->srvr->server->flags & SNO_LHOSTS) {
  		type = 0;
--- 614,620 ----
      afs_InitReq(&treq, &afs_osi_cred);	/* *must* be unauth for vldb */
      do {
  	tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport,
! 				 tcell->cellNum, &treq, SHARED_LOCK);
  	if (tconn) {
  	    if (tconn->srvr->server->flags & SNO_LHOSTS) {
  		type = 0;
***************
*** 947,953 ****
  		memset((char *)&addrs, 0, sizeof(addrs));
  		do {
  		    tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport,
! 					     tcell->cell, areq, SHARED_LOCK);
  		    if (tconn) {
  #ifdef RX_ENABLE_LOCKS
  			AFS_GUNLOCK();
--- 947,953 ----
  		memset((char *)&addrs, 0, sizeof(addrs));
  		do {
  		    tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport,
! 					     tcell->cellNum, areq, SHARED_LOCK);
  		    if (tconn) {
  #ifdef RX_ENABLE_LOCKS
  			AFS_GUNLOCK();
Index: openafs/src/afs/DARWIN/osi_vnodeops.c
diff -c openafs/src/afs/DARWIN/osi_vnodeops.c:1.4.2.4 openafs/src/afs/DARWIN/osi_vnodeops.c:1.4.2.6
*** openafs/src/afs/DARWIN/osi_vnodeops.c:1.4.2.4	Wed Aug 21 16:53:22 2002
--- openafs/src/afs/DARWIN/osi_vnodeops.c	Sat Jan 25 19:02:28 2003
***************
*** 1,7 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.4.2.4 2002/08/21 20:53:22 shadow Exp $");
  
  #include <afs/sysincludes.h>            /* Standard vendor system headers */
  #include <afs/afsincludes.h>            /* Afs-based standard headers */
--- 1,7 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.4.2.6 2003/01/26 00:02:28 shadow Exp $");
  
  #include <afs/sysincludes.h>            /* Standard vendor system headers */
  #include <afs/afsincludes.h>            /* Afs-based standard headers */
***************
*** 283,289 ****
  	panic("AFS open changed vnode!");
  #endif
      afs_BozonLock(&vc->pvnLock, vc);
!     osi_FlushPages(vc);
      afs_BozonUnlock(&vc->pvnLock, vc);
      AFS_GUNLOCK();
      return error;
--- 283,289 ----
  	panic("AFS open changed vnode!");
  #endif
      afs_BozonLock(&vc->pvnLock, vc);
!     osi_FlushPages(vc, ap->a_cred);
      afs_BozonUnlock(&vc->pvnLock, vc);
      AFS_GUNLOCK();
      return error;
***************
*** 306,312 ****
      else
          code=afs_close(avc, ap->a_fflag, &afs_osi_cred, ap->a_p);
      afs_BozonLock(&avc->pvnLock, avc);
!     osi_FlushPages(avc);        /* hold bozon lock, but not basic vnode lock */
      afs_BozonUnlock(&avc->pvnLock, avc);
      AFS_GUNLOCK();
  #ifdef AFS_DARWIN14_ENV
--- 306,312 ----
      else
          code=afs_close(avc, ap->a_fflag, &afs_osi_cred, ap->a_p);
      afs_BozonLock(&avc->pvnLock, avc);
!     osi_FlushPages(avc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
      afs_BozonUnlock(&avc->pvnLock, avc);
      AFS_GUNLOCK();
  #ifdef AFS_DARWIN14_ENV
***************
*** 381,387 ****
      struct vcache *avc=VTOAFS(ap->a_vp);
      AFS_GLOCK();
      afs_BozonLock(&avc->pvnLock, avc);
!     osi_FlushPages(avc);        /* hold bozon lock, but not basic vnode lock */
      code=afs_read(avc, ap->a_uio, ap->a_cred, 0, 0, 0);
      afs_BozonUnlock(&avc->pvnLock, avc);
      AFS_GUNLOCK();
--- 381,387 ----
      struct vcache *avc=VTOAFS(ap->a_vp);
      AFS_GLOCK();
      afs_BozonLock(&avc->pvnLock, avc);
!     osi_FlushPages(avc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
      code=afs_read(avc, ap->a_uio, ap->a_cred, 0, 0, 0);
      afs_BozonUnlock(&avc->pvnLock, avc);
      AFS_GUNLOCK();
***************
*** 458,464 ****
      aiov.iov_base = (caddr_t)ioaddr;
      AFS_GLOCK();
      afs_BozonLock(&tvc->pvnLock, tvc);
!     osi_FlushPages(tvc);        /* hold bozon lock, but not basic vnode lock */
      code=afs_read(tvc, uio, cred, 0, 0, 0);
      if (code == 0) {
        ObtainWriteLock(&tvc->lock, 2);
--- 458,464 ----
      aiov.iov_base = (caddr_t)ioaddr;
      AFS_GLOCK();
      afs_BozonLock(&tvc->pvnLock, tvc);
!     osi_FlushPages(tvc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
      code=afs_read(tvc, uio, cred, 0, 0, 0);
      if (code == 0) {
        ObtainWriteLock(&tvc->lock, 2);
***************
*** 467,472 ****
--- 467,477 ----
      }
      afs_BozonUnlock(&tvc->pvnLock, tvc);
      AFS_GUNLOCK();
+ 
+     /* Zero out rest of last page if there wasn't enough data in the file */
+     if (code == 0 && auio.uio_resid > 0)
+ 	memset(aiov.iov_base, 0, auio.uio_resid);
+ 
      kernel_upl_unmap(kernel_map, pl);
      if (!nocommit) {
        if (code)
***************
*** 494,500 ****
      void *object;
      AFS_GLOCK();
      afs_BozonLock(&avc->pvnLock, avc);
!     osi_FlushPages(avc);        /* hold bozon lock, but not basic vnode lock */
      if (UBCINFOEXISTS(ap->a_vp))
         ubc_clean(ap->a_vp, 1);
      if (UBCINFOEXISTS(ap->a_vp))
--- 499,505 ----
      void *object;
      AFS_GLOCK();
      afs_BozonLock(&avc->pvnLock, avc);
!     osi_FlushPages(avc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
      if (UBCINFOEXISTS(ap->a_vp))
         ubc_clean(ap->a_vp, 1);
      if (UBCINFOEXISTS(ap->a_vp))
***************
*** 622,628 ****
  
      AFS_GLOCK();
      afs_BozonLock(&tvc->pvnLock, tvc);
!     osi_FlushPages(tvc);        /* hold bozon lock, but not basic vnode lock */
      ObtainWriteLock(&tvc->lock, 1);
      afs_FakeOpen(tvc);
      ReleaseWriteLock(&tvc->lock);
--- 627,633 ----
  
      AFS_GLOCK();
      afs_BozonLock(&tvc->pvnLock, tvc);
!     osi_FlushPages(tvc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
      ObtainWriteLock(&tvc->lock, 1);
      afs_FakeOpen(tvc);
      ReleaseWriteLock(&tvc->lock);
Index: openafs/src/afs/IRIX/osi_vfsops.c
diff -c openafs/src/afs/IRIX/osi_vfsops.c:1.4.4.3 openafs/src/afs/IRIX/osi_vfsops.c:1.4.4.4
*** openafs/src/afs/IRIX/osi_vfsops.c:1.4.4.3	Tue Apr 23 21:41:32 2002
--- openafs/src/afs/IRIX/osi_vfsops.c	Thu Mar  6 09:53:29 2003
***************
*** 13,19 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/IRIX/osi_vfsops.c,v 1.4.4.3 2002/04/24 01:41:32 zacheiss Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 13,19 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/IRIX/osi_vfsops.c,v 1.4.4.4 2003/03/06 14:53:29 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 518,524 ****
  {
      struct VenusFid vfid;
      struct vrequest treq;
-     extern struct cell *afs_GetCellByIndex();
      register struct cell *tcell;
      register afs_int32 code = 0;
      afs_int32 ret;
--- 518,523 ----
***************
*** 537,549 ****
      afid2 = (afs_fid2_t*)fidp;
      if (afid2->af_len == sizeof(afs_fid2_t) - sizeof(afid2->af_len)) {
  	/* It's a checkpoint restart fid. */
! 	tcell = afs_GetCellByIndex(afid2->af_cell, READ_LOCK, 0 /* !refresh */);
  	if (!tcell) {
  	    code = ENOENT;
  	    goto out;
!         }
! 	vfid.Cell = tcell->cell;
! 	afs_PutCell(tcell, WRITE_LOCK);
  	vfid.Fid.Volume = afid2->af_volid;
  	vfid.Fid.Vnode = afid2->af_vno;
  	vfid.Fid.Unique = afid2->af_uniq;
--- 536,548 ----
      afid2 = (afs_fid2_t*)fidp;
      if (afid2->af_len == sizeof(afs_fid2_t) - sizeof(afid2->af_len)) {
  	/* It's a checkpoint restart fid. */
! 	tcell = afs_GetCellByIndex(afid2->af_cell, READ_LOCK);
  	if (!tcell) {
  	    code = ENOENT;
  	    goto out;
! 	}
! 	vfid.Cell = tcell->cellNum;
! 	afs_PutCell(tcell, READ_LOCK);
  	vfid.Fid.Volume = afid2->af_volid;
  	vfid.Fid.Vnode = afid2->af_vno;
  	vfid.Fid.Unique = afid2->af_uniq;
Index: openafs/src/afs/LINUX/osi_groups.c
diff -c openafs/src/afs/LINUX/osi_groups.c:1.10.2.2 openafs/src/afs/LINUX/osi_groups.c:1.10.2.3
*** openafs/src/afs/LINUX/osi_groups.c:1.10.2.2	Thu Nov 14 14:47:12 2002
--- openafs/src/afs/LINUX/osi_groups.c	Sat Jan 11 02:53:29 2003
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.10.2.2 2002/11/14 19:47:12 zacheiss Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
--- 16,22 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.10.2.3 2003/01/11 07:53:29 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
***************
*** 33,46 ****
   */
  int set_pag_in_parent(int pag, int g0, int g1)
  {
      gid_t *gp = current->p_pptr->groups;
      int ngroups;
      int i;
  
      
      ngroups = current->p_pptr->ngroups;
!     gp = current->p_pptr->groups;
! 
  
      if ((ngroups < 2) || (afs_get_pag_from_groups(gp[0], gp[1]) == NOPAG)) {
  	/* We will have to shift grouplist to make room for pag */
--- 33,52 ----
   */
  int set_pag_in_parent(int pag, int g0, int g1)
  {
+ #ifdef STRUCT_TASK_STRUCT_HAS_PARENT
+     gid_t *gp = current->parent->groups;
+ #else
      gid_t *gp = current->p_pptr->groups;
+ #endif
      int ngroups;
      int i;
  
      
+ #ifdef STRUCT_TASK_STRUCT_HAS_PARENT
+     ngroups = current->parent->ngroups;
+ #else
      ngroups = current->p_pptr->ngroups;
! #endif
  
      if ((ngroups < 2) || (afs_get_pag_from_groups(gp[0], gp[1]) == NOPAG)) {
  	/* We will have to shift grouplist to make room for pag */
***************
*** 57,63 ****
--- 63,73 ----
      if (ngroups < NGROUPS)
  	gp[ngroups] = NOGROUP;
  
+ #ifdef STRUCT_TASK_STRUCT_HAS_PARENT
+     current->parent->ngroups = ngroups;
+ #else
      current->p_pptr->ngroups = ngroups;
+ #endif
      return 0;
  }
  
Index: openafs/src/afs/LINUX/osi_machdep.h
diff -c openafs/src/afs/LINUX/osi_machdep.h:1.5.2.2 openafs/src/afs/LINUX/osi_machdep.h:1.5.2.6
*** openafs/src/afs/LINUX/osi_machdep.h:1.5.2.2	Wed Jul 10 16:42:33 2002
--- openafs/src/afs/LINUX/osi_machdep.h	Sun Mar 23 01:46:34 2003
***************
*** 24,34 ****
  #undef getuerror
  
  #define getpid() current->pid
  #define getppid() current->p_opptr->pid
  
  
  #define afs_hz HZ
- #include "../h/sched.h"
  #define osi_Time() (xtime.tv_sec)
  #if  (CPU == sparc64)
  #define osi_GetTime(V) do { (*(V)).tv_sec = xtime.tv_sec; (*(V)).tv_usec = xtime.tv_usec; } while (0)
--- 24,53 ----
  #undef getuerror
  
  #define getpid() current->pid
+ #ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
+ #define getppid() current->real_parent->pid
+ #else
  #define getppid() current->p_opptr->pid
+ #endif
  
+ #ifdef RECALC_SIGPENDING_TAKES_VOID
+ #define RECALC_SIGPENDING(X) recalc_sigpending()
+ #else
+ #define RECALC_SIGPENDING(X) recalc_sigpending(X)
+ #endif
+ 
+ #if defined (STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK)
+ #define SIG_LOCK(X) spin_lock_irq(&X->sigmask_lock)
+ #define SIG_UNLOCK(X) spin_unlock_irq(&X->sigmask_lock)
+ #elif defined (STRUCT_TASK_STRUCT_HAS_SIGHAND)
+ #define SIG_LOCK(X) spin_lock_irq(&X->sighand->siglock)
+ #define SIG_UNLOCK(X) spin_unlock_irq(&X->sighand->siglock)
+ #else
+ #define SIG_LOCK(X) spin_lock_irq(&X->sig->siglock)
+ #define SIG_UNLOCK(X) spin_unlock_irq(&X->sig->siglock)
+ #endif
  
  #define afs_hz HZ
  #define osi_Time() (xtime.tv_sec)
  #if  (CPU == sparc64)
  #define osi_GetTime(V) do { (*(V)).tv_sec = xtime.tv_sec; (*(V)).tv_usec = xtime.tv_usec; } while (0)
***************
*** 146,151 ****
--- 165,171 ----
  #define afs_linux_page_address(page) (afs_linux_page_offset + PAGE_SIZE * (page - mem_map))
  
  #if defined(__KERNEL__) && defined(CONFIG_SMP)
+ #include "../h/sched.h"
  #include "linux/wait.h"
  
  extern struct semaphore afs_global_lock;
Index: openafs/src/afs/LINUX/osi_misc.c
diff -c openafs/src/afs/LINUX/osi_misc.c:1.12.2.8 openafs/src/afs/LINUX/osi_misc.c:1.12.2.10
*** openafs/src/afs/LINUX/osi_misc.c:1.12.2.8	Thu Sep 19 18:33:43 2002
--- openafs/src/afs/LINUX/osi_misc.c	Sun Mar 23 01:46:34 2003
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_misc.c,v 1.12.2.8 2002/09/19 22:33:43 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
--- 14,20 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_misc.c,v 1.12.2.10 2003/03/23 06:46:34 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
***************
*** 444,461 ****
  struct task_struct *rxk_ListenerTask;
  
  void osi_linux_mask() {
!     spin_lock_irq(&current->sigmask_lock);
      sigfillset(&current->blocked);
!     recalc_sigpending(current);
!     spin_unlock_irq(&current->sigmask_lock);
! }
! 
! void osi_linux_unmask() {
!     spin_lock_irq(&rxk_ListenerTask->sigmask_lock);
!     sigemptyset(&rxk_ListenerTask->blocked);
!     flush_signals(rxk_ListenerTask);
!     recalc_sigpending(rxk_ListenerTask);
!     spin_unlock_irq(&rxk_ListenerTask->sigmask_lock);
  }
  
  void osi_linux_rxkreg() {
--- 444,453 ----
  struct task_struct *rxk_ListenerTask;
  
  void osi_linux_mask() {
!     SIG_LOCK(current);
      sigfillset(&current->blocked);
!     RECALC_SIGPENDING(current);
!     SIG_UNLOCK(current);
  }
  
  void osi_linux_rxkreg() {
Index: openafs/src/afs/LINUX/osi_module.c
diff -c openafs/src/afs/LINUX/osi_module.c:1.16.2.8 openafs/src/afs/LINUX/osi_module.c:1.16.2.12
*** openafs/src/afs/LINUX/osi_module.c:1.16.2.8	Mon Dec  9 23:32:40 2002
--- openafs/src/afs/LINUX/osi_module.c	Sun Mar 23 01:46:34 2003
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_module.c,v 1.16.2.8 2002/12/10 04:32:40 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
--- 14,20 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_module.c,v 1.16.2.12 2003/03/23 06:46:34 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
***************
*** 25,33 ****
  #include <linux/slab.h>
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
  #include <linux/init.h>
  #endif
  #ifndef EXPORTED_SYS_CALL_TABLE
- #include <linux/sched.h>
  #include <linux/syscall.h>
  #endif
  
--- 25,33 ----
  #include <linux/slab.h>
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
  #include <linux/init.h>
+ #include <linux/sched.h>
  #endif
  #ifndef EXPORTED_SYS_CALL_TABLE
  #include <linux/syscall.h>
  #endif
  
***************
*** 41,47 ****
  #if !defined(AFS_ALPHA_LINUX20_ENV)
  asmlinkage int (*sys_socketcallp)(int call, long *args);
  #endif /* no socketcall on alpha */
- asmlinkage int (*sys_killp)(int pid, int signal);
  asmlinkage long (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist);
  
  #ifdef EXPORTED_SYS_CALL_TABLE
--- 41,46 ----
***************
*** 93,106 ****
  asmlinkage int afs_syscall32(long syscall, long parm1, long parm2, long parm3,
  			     long parm4, long parm5)
  {
! __asm__ __volatile__ ("
! 	srl %o4, 0, %o4
! 	mov %o7, %i7
! 	call afs_syscall
! 	srl %o5, 0, %o5
! 	ret
! 	nop
! ");
  }
  #endif
  
--- 92,103 ----
  asmlinkage int afs_syscall32(long syscall, long parm1, long parm2, long parm3,
  			     long parm4, long parm5)
  {
! __asm__ __volatile__ ("srl %o4, 0, %o4\n\t"
! 		      "mov %o7, %i7\n\t"
! 		      "call afs_syscall\n\t"
! 		      "srl %o5, 0, %o5\n\t"
! 		      "ret\n\t"
! 		      "nop");
  }
  #endif
  
***************
*** 109,177 ****
  asmlinkage long
  afs_syscall_stub(int r0, int r1, long r2, long r3, long r4, long gp)
  {
! __asm__ __volatile__ ("
!         alloc r42 = ar.pfs, 8, 3, 6, 0
!         mov r41 = b0    		/* save rp */
!         mov out0 = in0
!         mov out1 = in1
!         mov out2 = in2
!         mov out3 = in3
!         mov out4 = in4
!         mov out5 = gp			/* save gp */
!         ;;
! .L1:    mov r3 = ip
!         ;;
!         addl r15=.fptr_afs_syscall-.L1,r3
!         ;;
!         ld8 r15=[r15]
!         ;;
!         ld8 r16=[r15],8
!         ;;
!         ld8 gp=[r15]
!         mov b6=r16
!         br.call.sptk.many b0 = b6
!         ;;
!         mov ar.pfs = r42
!         mov b0 = r41
!         mov gp = r48			/* restore gp */
!         br.ret.sptk.many b0
! .fptr_afs_syscall:
!         data8 @fptr(afs_syscall)
! ");
  }
  
  asmlinkage long
  afs_xsetgroups_stub(int r0, int r1, long r2, long r3, long r4, long gp)
  {
! __asm__ __volatile__ ("
!         alloc r42 = ar.pfs, 8, 3, 6, 0
!         mov r41 = b0    		/* save rp */
!         mov out0 = in0
!         mov out1 = in1
!         mov out2 = in2
!         mov out3 = in3
!         mov out4 = in4
!         mov out5 = gp			/* save gp */
!         ;;
! .L2:    mov r3 = ip
!         ;;
!         addl r15=.fptr_afs_xsetgroups - .L2,r3
!         ;;
!         ld8 r15=[r15]
!         ;;
!         ld8 r16=[r15],8
!         ;;
!         ld8 gp=[r15]
!         mov b6=r16
!         br.call.sptk.many b0 = b6
!         ;;
!         mov ar.pfs = r42
!         mov b0 = r41
!         mov gp = r48			/* restore gp */
!         br.ret.sptk.many b0
! .fptr_afs_xsetgroups:
!         data8 @fptr(afs_xsetgroups)
! ");
  }
  
  struct fptr
--- 106,170 ----
  asmlinkage long
  afs_syscall_stub(int r0, int r1, long r2, long r3, long r4, long gp)
  {
! __asm__ __volatile__ ("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t"
! 		      "mov r41 = b0\n\t"    		/* save rp */
! 		      "mov out0 = in0\n\t"
! 		      "mov out1 = in1\n\t"
! 		      "mov out2 = in2\n\t"
! 		      "mov out3 = in3\n\t"
! 		      "mov out4 = in4\n\t"
! 		      "mov out5 = gp\n\t"			/* save gp */
! 		      ";;\n"
! 		      ".L1:    mov r3 = ip\n\t"
! 		      ";;\n\t"
! 		      "addl r15=.fptr_afs_syscall-.L1,r3\n\t"
! 		      ";;\n\t"
! 		      "ld8 r15=[r15]\n\t"
! 		      ";;\n\t"
! 		      "ld8 r16=[r15],8\n\t"
! 		      ";;\n\t"
! 		      "ld8 gp=[r15]\n\t"
! 		      "mov b6=r16\n\t"
! 		      "br.call.sptk.many b0 = b6\n\t"
! 		      ";;\n\t"
! 		      "mov ar.pfs = r42\n\t"
! 		      "mov b0 = r41\n\t"
! 		      "mov gp = r48\n\t"		/* restore gp */
! 		      "br.ret.sptk.many b0\n"
! 		      ".fptr_afs_syscall:\n\t"
! 		      "data8 @fptr(afs_syscall)");
  }
  
  asmlinkage long
  afs_xsetgroups_stub(int r0, int r1, long r2, long r3, long r4, long gp)
  {
! __asm__ __volatile__ ("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t"
! 		      "mov r41 = b0\n\t"    		/* save rp */
! 		      "mov out0 = in0\n\t"
! 		      "mov out1 = in1\n\t"
! 		      "mov out2 = in2\n\t"
! 		      "mov out3 = in3\n\t"
! 		      "mov out4 = in4\n\t"
! 		      "mov out5 = gp\n\t"			/* save gp */
! 		      ";;\n"
! 		      ".L2:    mov r3 = ip\n\t"
! 		      ";;\n\t"
! 		      "addl r15=.fptr_afs_xsetgroups - .L2,r3\n\t"
! 		      ";;\n\t"
! 		      "ld8 r15=[r15]\n\t"
! 		      ";;\n\t"
! 		      "ld8 r16=[r15],8\n\t"
! 		      ";;\n\t"
! 		      "ld8 gp=[r15]\n\t"
! 		      "mov b6=r16\n\t"
! 		      "br.call.sptk.many b0 = b6\n\t"
! 		      ";;\n\t"
! 		      "mov ar.pfs = r42\n\t"
! 		      "mov b0 = r41\n\t"
! 		      "mov gp = r48\n\t"		/* restore gp */
! 		      "br.ret.sptk.many b0\n"
! 		      ".fptr_afs_xsetgroups:\n\t"
! 		      "data8 @fptr(afs_xsetgroups)");
  }
  
  struct fptr
***************
*** 202,208 ****
  {
  #if defined(AFS_IA64_LINUX20_ENV)
      unsigned long kernel_gp;
!     static struct fptr sys_kill, sys_settimeofday, sys_setgroups;
  #endif
      extern int afs_syscall();
      extern long afs_xsetgroups();
--- 195,201 ----
  {
  #if defined(AFS_IA64_LINUX20_ENV)
      unsigned long kernel_gp;
!     static struct fptr sys_settimeofday, sys_setgroups;
  #endif
      extern int afs_syscall();
      extern long afs_xsetgroups();
***************
*** 290,301 ****
--- 283,302 ----
  	    break;
  	}
  #else
+ #if defined(EXPORTED_SYS_CHDIR) && defined(EXPORTED_SYS_CLOSE)
+         if (ptr[0] == (unsigned long)&sys_close &&
+ 	    ptr[__NR_chdir - __NR_close] == (unsigned long)&sys_chdir) {
+ 	    sys_call_table=ptr - __NR_close;
+ 	    break;
+ 	}
+ #else
          if (ptr[0] == (unsigned long)&sys_exit &&
  	    ptr[__NR_open - __NR_exit] == (unsigned long)&sys_open) {
  	    sys_call_table=ptr - __NR_exit;
  	    break;
  	}
  #endif
+ #endif
      }
  #ifdef EXPORTED_KALLSYMS_ADDRESS
      ret=kallsyms_address_to_symbol((unsigned long)sys_call_table, &mod_name,
***************
*** 309,314 ****
--- 310,316 ----
           printf("Failed to find address of sys_call_table\n");
  	 return -EIO;
      }
+     printf("Found sys_call_table at %x\n", sys_call_table);
  # ifdef AFS_SPARC64_LINUX20_ENV
  error cant support this yet.
  #endif
***************
*** 319,339 ****
      kernel_gp = ((struct fptr *)printk)->gp;
  
      sys_settimeofdayp = (void *) &sys_settimeofday;
-     sys_killp = (void *) &sys_kill;
  
      ((struct fptr *)sys_settimeofdayp)->ip =
  		SYSCALL2POINTER sys_call_table[__NR_settimeofday - 1024];
      ((struct fptr *)sys_settimeofdayp)->gp = kernel_gp;
      
-     ((struct fptr *)sys_killp)->ip =
- 		SYSCALL2POINTER sys_call_table[__NR_kill - 1024];
-     ((struct fptr *)sys_killp)->gp = kernel_gp;
  #else /* !AFS_IA64_LINUX20_ENV */
      sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday];
  #ifdef __NR_socketcall
      sys_socketcallp = SYSCALL2POINTER sys_call_table[__NR_socketcall];
  #endif /* no socketcall on alpha */
-     sys_killp = SYSCALL2POINTER sys_call_table[__NR_kill];
  #endif /* AFS_IA64_LINUX20_ENV */
  
      /* setup AFS entry point. */
--- 321,336 ----
***************
*** 440,452 ****
  #if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV) || defined(AFS_IA64_LINUX20_ENV) || defined(AFS_PARISC_LINUX24_ENV)
      return PAGE_OFFSET;
  #else
!     struct task_struct *p;
  
      /* search backward thru the circular list */
!     for(p = current; p; p = p->prev_task)
! 	if (p->pid == 1)
! 	    return p->addr_limit.seg;
! 
!     return 0;
  #endif
  }
--- 437,465 ----
  #if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV) || defined(AFS_IA64_LINUX20_ENV) || defined(AFS_PARISC_LINUX24_ENV)
      return PAGE_OFFSET;
  #else
!     struct task_struct *p, *q;
  
      /* search backward thru the circular list */
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
!     read_lock(&tasklist_lock);
! #endif
!     /* search backward thru the circular list */
! #ifdef DEFINED_PREV_TASK
!     for(q = current; p = q; q = prev_task(p)) {
! #else
!     for(p = current; p; p = p->prev_task) {
! #endif
! 	    if (p->pid == 1) {
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
! 		    read_unlock(&tasklist_lock);
! #endif
! 		    return p->addr_limit.seg;
! 	    }
!     }
!   
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
!     read_unlock(&tasklist_lock);
! #endif
!   return 0;
  #endif
  }
Index: openafs/src/afs/LINUX/osi_sleep.c
diff -c openafs/src/afs/LINUX/osi_sleep.c:1.6.4.7 openafs/src/afs/LINUX/osi_sleep.c:1.6.4.8
*** openafs/src/afs/LINUX/osi_sleep.c:1.6.4.7	Wed Jul 31 18:31:15 2002
--- openafs/src/afs/LINUX/osi_sleep.c	Sat Jan 11 02:53:29 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_sleep.c,v 1.6.4.7 2002/07/31 22:31:15 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_sleep.c,v 1.6.4.8 2003/01/11 07:53:29 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 192,209 ****
  	set_current_state(TASK_INTERRUPTIBLE);
  	AFS_ASSERT_GLOCK();
  	AFS_GUNLOCK();
! 	spin_lock_irq(&current->sigmask_lock);
  	saved_set = current->blocked;
  	sigfillset(&current->blocked);
! 	recalc_sigpending(current);
! 	spin_unlock_irq(&current->sigmask_lock);
  
  	schedule();
  
! 	spin_lock_irq(&current->sigmask_lock);
  	current->blocked = saved_set;
! 	recalc_sigpending(current);
! 	spin_unlock_irq(&current->sigmask_lock);
  	AFS_GLOCK();
      }
      remove_wait_queue(&evp->cond, &wait);
--- 192,210 ----
  	set_current_state(TASK_INTERRUPTIBLE);
  	AFS_ASSERT_GLOCK();
  	AFS_GUNLOCK();
! 
! 	SIG_LOCK(current);
  	saved_set = current->blocked;
  	sigfillset(&current->blocked);
! 	RECALC_SIGPENDING(current);
! 	SIG_UNLOCK(current);
  
  	schedule();
  
! 	SIG_LOCK(current);
  	current->blocked = saved_set;
! 	RECALC_SIGPENDING(current);
! 	SIG_UNLOCK(current);
  	AFS_GLOCK();
      }
      remove_wait_queue(&evp->cond, &wait);
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.29.2.21 openafs/src/afs/LINUX/osi_vnodeops.c:1.29.2.22
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.29.2.21	Mon Dec  9 23:32:40 2002
--- openafs/src/afs/LINUX/osi_vnodeops.c	Thu Jan 16 20:30:37 2003
***************
*** 23,29 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.29.2.21 2002/12/10 04:32:40 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
--- 23,29 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.29.2.22 2003/01/17 01:30:37 shadow Exp $");
  
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
***************
*** 542,552 ****
  
      /* Safe because there are no large files, yet */
  #if defined(F_GETLK64) && (F_GETLK != F_GETLK64)
!     if (cmd = F_GETLK64)
  	cmd = F_GETLK;
!     else if (cmd = F_SETLK64)
  	cmd = F_SETLK;
!     else if (cmd = F_SETLKW64)
  	cmd = F_SETLKW;
  #endif /* F_GETLK64 && F_GETLK != F_GETLK64 */
  
--- 542,552 ----
  
      /* Safe because there are no large files, yet */
  #if defined(F_GETLK64) && (F_GETLK != F_GETLK64)
!     if (cmd == F_GETLK64)
  	cmd = F_GETLK;
!     else if (cmd == F_SETLK64)
  	cmd = F_SETLK;
!     else if (cmd == F_SETLKW64)
  	cmd = F_SETLKW;
  #endif /* F_GETLK64 && F_GETLK != F_GETLK64 */
  
Index: openafs/src/afs/UKERNEL/afs_usrops.c
diff -c openafs/src/afs/UKERNEL/afs_usrops.c:1.9.2.2 openafs/src/afs/UKERNEL/afs_usrops.c:1.9.2.3
*** openafs/src/afs/UKERNEL/afs_usrops.c:1.9.2.2	Tue Dec 10 14:11:39 2002
--- openafs/src/afs/UKERNEL/afs_usrops.c	Thu Mar  6 10:39:46 2003
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.9.2.2 2002/12/10 19:11:39 shadow Exp $");
  
  
  #ifdef	UKERNEL
--- 14,20 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.9.2.3 2003/03/06 15:39:46 shadow Exp $");
  
  
  #ifdef	UKERNEL
***************
*** 928,933 ****
--- 928,938 ----
  }
  
  void afs_osi_Free(void *ptr, size_t size)
+ {
+     free(ptr);
+ }
+ 
+ void afs_osi_FreeStr(char *ptr)
  {
      free(ptr);
  }
Index: openafs/src/afs/VNOPS/afs_vnop_lookup.c
diff -c openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.14.2.11 openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.14.2.12
*** openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.14.2.11	Tue Dec 10 14:11:40 2002
--- openafs/src/afs/VNOPS/afs_vnop_lookup.c	Thu Mar  6 09:53:31 2003
***************
*** 22,28 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.14.2.11 2002/12/10 19:11:40 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
--- 22,28 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.14.2.12 2003/03/06 14:53:31 shadow Exp $");
  
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 137,146 ****
      }
      if (!tcell) return ENODEV;
  
!     mtptCell = tcell->cell;               /* The cell for the mountpoint */
      if (tcell->lcellp) {
!        hac = 1;                           /* has associated cell */
!        assocCell = tcell->lcellp->cell;   /* The associated cell */
      }
      afs_PutCell(tcell, READ_LOCK);	    
  
--- 137,146 ----
      }
      if (!tcell) return ENODEV;
  
!     mtptCell = tcell->cellNum;		    /* The cell for the mountpoint */
      if (tcell->lcellp) {
!        hac = 1;                             /* has associated cell */
!        assocCell = tcell->lcellp->cellNum;  /* The associated cell */
      }
      afs_PutCell(tcell, READ_LOCK);	    
  
***************
*** 255,260 ****
--- 255,263 ----
  afs_InitFakeStat(state)
      struct afs_fakestat_state *state;
  {
+     if (!afs_fakestat_enable)
+ 	return;
+ 
      state->valid = 1;
      state->did_eval = 0;
      state->need_release = 0;
***************
*** 275,285 ****
      struct volume *tvolp = NULL;
      int code = 0;
  
      osi_Assert(state->valid == 1);
      osi_Assert(state->did_eval == 0);
      state->did_eval = 1;
!     if (!afs_fakestat_enable)
! 	return 0;
      tvc = *avcp;
      if (tvc->mvstat != 1)
  	return 0;
--- 278,290 ----
      struct volume *tvolp = NULL;
      int code = 0;
  
+     if (!afs_fakestat_enable)
+ 	return 0;
+ 
      osi_Assert(state->valid == 1);
      osi_Assert(state->did_eval == 0);
      state->did_eval = 1;
! 
      tvc = *avcp;
      if (tvc->mvstat != 1)
  	return 0;
***************
*** 396,401 ****
--- 401,409 ----
  afs_PutFakeStat(state)
      struct afs_fakestat_state *state;
  {
+     if (!afs_fakestat_enable)
+ 	return;
+ 
      osi_Assert(state->valid == 1);
      if (state->need_release)
  	afs_PutVCache(state->root_vp, 0);
***************
*** 1313,1332 ****
      afs_PutDCache(tdc);
  
      if (code == ENOENT && afs_IsDynroot(adp) && dynrootRetry) {
- 	struct cell *tcell;
- 
  	ReleaseReadLock(&adp->lock);
  	dynrootRetry = 0;
! 	if (*tname == '.')
! 	    tcell = afs_GetCellByName(tname + 1, READ_LOCK);
  	else
! 	    tcell = afs_GetCellByName(tname, READ_LOCK);
! 	if (tcell) {
! 	    afs_PutCell(tcell, READ_LOCK);
! 	    afs_RefreshDynroot();
! 	    if (tname != aname && tname) osi_FreeLargeSpace(tname);
! 	    goto redo;
! 	}
      } else {
  	ReleaseReadLock(&adp->lock);
      }
--- 1321,1334 ----
      afs_PutDCache(tdc);
  
      if (code == ENOENT && afs_IsDynroot(adp) && dynrootRetry) {
  	ReleaseReadLock(&adp->lock);
  	dynrootRetry = 0;
! 	if (tname[0] == '.')
! 	    afs_LookupAFSDB(tname + 1);
  	else
! 	    afs_LookupAFSDB(tname);
! 	if (tname && tname != aname) osi_FreeLargeSpace(tname);
! 	goto redo;
      } else {
  	ReleaseReadLock(&adp->lock);
      }
Index: openafs/src/afsd/Makefile.in
diff -c openafs/src/afsd/Makefile.in:1.6.2.2 openafs/src/afsd/Makefile.in:1.6.2.3
*** openafs/src/afsd/Makefile.in:1.6.2.2	Sat Oct 13 00:20:44 2001
--- openafs/src/afsd/Makefile.in	Mon Jan 13 18:47:18 2003
***************
*** 99,111 ****
  			esac;; \
  		sun4_52 | sun4_53 | sun4c_52 | sun4c_53 | sun4m_52 | sun4m_53 | sun4m_54 | sun4_54 | sun4c_54 | sunx86_54) \
  			${INSTALL} -f afs.rc.solaris ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
! 		sun4x_57 ) \
  			${INSTALL} -f afs.rc.solaris.2.7 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
! 		sun4x_58 ) \
  			${INSTALL} -f afs.rc.solaris.2.8 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
! 		sun4x_59 ) \
  			${INSTALL} -f afs.rc.solaris.2.9 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
!                 sun4x_5? ) \
                          ${INSTALL} -f afs.rc.solaris.2_5 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
  		alpha_osf* ) \
  			${INSTALL} -f afs.rc.alpha ${DEST}/root.client/usr/vice/etc/dkload/afs.rc ;;\
--- 99,111 ----
  			esac;; \
  		sun4_52 | sun4_53 | sun4c_52 | sun4c_53 | sun4m_52 | sun4m_53 | sun4m_54 | sun4_54 | sun4c_54 | sunx86_54) \
  			${INSTALL} -f afs.rc.solaris ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
! 		sun*_57 ) \
  			${INSTALL} -f afs.rc.solaris.2.7 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
! 		sun*_58 ) \
  			${INSTALL} -f afs.rc.solaris.2.8 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
! 		sun*_59 ) \
  			${INSTALL} -f afs.rc.solaris.2.9 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
!                 sun*_5? ) \
                          ${INSTALL} -f afs.rc.solaris.2_5 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
  		alpha_osf* ) \
  			${INSTALL} -f afs.rc.alpha ${DEST}/root.client/usr/vice/etc/dkload/afs.rc ;;\
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.13.2.11 openafs/src/afsd/afsd.c:1.13.2.13
*** openafs/src/afsd/afsd.c:1.13.2.11	Thu Nov 14 16:04:27 2002
--- openafs/src/afsd/afsd.c	Sun Mar 23 14:47:55 2003
***************
*** 55,61 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afsd/afsd.c,v 1.13.2.11 2002/11/14 21:04:27 zacheiss Exp $");
  
  #define VFS 1
  
--- 55,61 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afsd/afsd.c,v 1.13.2.13 2003/03/23 19:47:55 shadow Exp $");
  
  #define VFS 1
  
***************
*** 170,175 ****
--- 170,176 ----
  #define	AFSLOGFILE	"AFSLog"
  #define	DCACHEFILE	"CacheItems"
  #define	VOLINFOFILE	"VolumeItems"
+ #define CELLINFOFILE	"CellItems"
  
  #define MAXIPADDRS 1024
  
***************
*** 211,216 ****
--- 212,218 ----
  char confDir[1024];			/*Where the workstation AFS configuration lives*/
  char fullpn_DCacheFile[1024];		/*Full pathname of DCACHEFILE*/
  char fullpn_VolInfoFile[1024];		/*Full pathname of VOLINFOFILE*/
+ char fullpn_CellInfoFile[1024];		/*Full pathanem of CELLINFOFILE*/
  char fullpn_AFSLogFile[1024];		/*Full pathname of AFSLOGFILE*/
  char fullpn_CacheInfo[1024];		/*Full pathname of CACHEINFO*/
  char fullpn_VFile[1024];		/*Full pathname of data cache files*/
***************
*** 224,230 ****
  char rootVolume[64] = "root.afs";	/*AFS root volume name*/
  afs_int32 cacheSetTime = 1;			/*Keep checking time to avoid drift?*/
  afs_int32 isHomeCell;			/*Is current cell info for the home cell?*/
- afs_int32 lookingForHomeCell;		/*Are we still looking for the home cell?*/
  int createAndTrunc = O_CREAT | O_TRUNC; /*Create & truncate on open*/
  int ownerRWmode	= 0600;			/*Read/write OK by owner*/
  static int filesSet = 0;		/*True if number of files explicitly set*/
--- 226,231 ----
***************
*** 270,279 ****
  					 */
  AFSD_INO_T *inode_for_V;		/* Array of inodes for desired
  					 * cache files */
! int missing_DCacheFile	= 1;		/*Is the DCACHEFILE missing?*/
! int missing_VolInfoFile	= 1;		/*Is the VOLINFOFILE missing?*/
! int afsd_rmtsys = 0;				/* Default: don't support rmtsys */
! struct afs_cacheParams cparams;          /* params passed to cache manager */
  
  static int HandleMTab();
  
--- 271,281 ----
  					 */
  AFSD_INO_T *inode_for_V;		/* Array of inodes for desired
  					 * cache files */
! int missing_DCacheFile	 = 1;		/*Is the DCACHEFILE missing?*/
! int missing_VolInfoFile  = 1;		/*Is the VOLINFOFILE missing?*/
! int missing_CellInfoFile = 1;		/*Is the CELLINFOFILE missing?*/
! int afsd_rmtsys = 0;			/* Default: don't support rmtsys */
! struct afs_cacheParams cparams;         /* params passed to cache manager */
  
  static int HandleMTab();
  
***************
*** 626,631 ****
--- 628,643 ----
      return(0);
  }
  
+ static void CreateFileIfMissing(char *fullpn, int missing)
+ {
+     if (missing) {
+ 	if (afsd_verbose)
+ 	    printf("CreateFileIfMissing: Creating '%s'\n", fullpn);
+ 	if (CreateCacheFile(fullpn, NULL))
+ 	    printf("CreateFileIfMissing: Can't create '%s'\n", fullpn);
+     }
+ }
+ 
  /*-----------------------------------------------------------------------------
    * SweepAFSCache
    *
***************
*** 802,807 ****
--- 814,825 ----
  	     */
  	    missing_VolInfoFile = 0;
  	}
+ 	else if (dirNum < 0 && strcmp(currp->d_name, CELLINFOFILE) == 0) {
+ 	    /*
+ 	     * Found the file holding the cell info.
+ 	     */
+ 	    missing_CellInfoFile = 0;
+ 	}
  	else  if ((strcmp(currp->d_name,          ".") == 0) ||
  	          (strcmp(currp->d_name,         "..") == 0) ||
  #ifdef AFS_DECOSF_ENV
***************
*** 842,866 ****
  
      if (dirNum < 0) {
  
!         /*
  	 * Create all the cache files that are missing.
  	 */
!         if (missing_DCacheFile) {
! 	    if (afsd_verbose)
! 	        printf("%s: Creating '%s'\n",
! 		       rn, fullpn_DCacheFile);
! 	    if (CreateCacheFile(fullpn_DCacheFile, NULL))
! 	        printf("%s: Can't create '%s'\n",
! 		       rn, fullpn_DCacheFile);
! 	}
! 	if (missing_VolInfoFile) {
! 	    if (afsd_verbose)
! 	        printf("%s: Creating '%s'\n",
! 		       rn, fullpn_VolInfoFile);
! 	    if (CreateCacheFile(fullpn_VolInfoFile, NULL))
! 	        printf("%s: Can't create '%s'\n",
! 		       rn, fullpn_VolInfoFile);
! 	}
  
  	/* ADJUST CACHE FILES */
  
--- 860,871 ----
  
      if (dirNum < 0) {
  
! 	/*
  	 * Create all the cache files that are missing.
  	 */
! 	CreateFileIfMissing(fullpn_DCacheFile, missing_DCacheFile);
! 	CreateFileIfMissing(fullpn_VolInfoFile, missing_VolInfoFile);
! 	CreateFileIfMissing(fullpn_CellInfoFile, missing_CellInfoFile);
  
  	/* ADJUST CACHE FILES */
  
***************
*** 1035,1053 ****
  char *arock;
  struct afsconf_dir *adir; {
      register int isHomeCell;
!     register int i;
!     afs_int32 cellFlags;
      afs_int32 hosts[MAXHOSTSPERCELL];
      
      /* figure out if this is the home cell */
      isHomeCell = (strcmp(aci->name, LclCellName) == 0);
!     if (isHomeCell) {
! 	lookingForHomeCell = 0;
! 	cellFlags = 1;	    /* home cell, suid is ok */
!     }
!     else {
  	cellFlags = 2;	    /* not home, suid is forbidden */
-     }
      
      /* build address list */
      for(i=0;i<MAXHOSTSPERCELL;i++)
--- 1040,1053 ----
  char *arock;
  struct afsconf_dir *adir; {
      register int isHomeCell;
!     register int i, code;
!     afs_int32 cellFlags = 0;
      afs_int32 hosts[MAXHOSTSPERCELL];
      
      /* figure out if this is the home cell */
      isHomeCell = (strcmp(aci->name, LclCellName) == 0);
!     if (!isHomeCell)
  	cellFlags = 2;	    /* not home, suid is forbidden */
      
      /* build address list */
      for(i=0;i<MAXHOSTSPERCELL;i++)
***************
*** 1057,1067 ****
  					    for upwards compatibility */
  
      /* configure one cell */
!     call_syscall(AFSOP_ADDCELL2,
  	     hosts,			/* server addresses */
  	     aci->name,			/* cell name */
  	     cellFlags,			/* is this the home cell? */
  	     aci->linkedCell);		/* Linked cell, if any */
      return 0;
  }
  
--- 1057,1069 ----
  					    for upwards compatibility */
  
      /* configure one cell */
!     code = call_syscall(AFSOP_ADDCELL2,
  	     hosts,			/* server addresses */
  	     aci->name,			/* cell name */
  	     cellFlags,			/* is this the home cell? */
  	     aci->linkedCell);		/* Linked cell, if any */
+     if (code)
+ 	printf("Adding cell '%s': error %d\n", aci->name, code);
      return 0;
  }
  
***************
*** 1472,1479 ****
      /*
       * Set up all the pathnames we'll need for later.
       */
!     sprintf(fullpn_DCacheFile,  "%s/%s", cacheBaseDir, DCACHEFILE);
!     sprintf(fullpn_VolInfoFile, "%s/%s", cacheBaseDir, VOLINFOFILE);
      sprintf(fullpn_VFile,       "%s/",  cacheBaseDir);
      vFilePtr = fullpn_VFile + strlen(fullpn_VFile);
  
--- 1474,1482 ----
      /*
       * Set up all the pathnames we'll need for later.
       */
!     sprintf(fullpn_DCacheFile,   "%s/%s", cacheBaseDir, DCACHEFILE);
!     sprintf(fullpn_VolInfoFile,  "%s/%s", cacheBaseDir, VOLINFOFILE);
!     sprintf(fullpn_CellInfoFile, "%s/%s", cacheBaseDir, CELLINFOFILE);
      sprintf(fullpn_VFile,       "%s/",  cacheBaseDir);
      vFilePtr = fullpn_VFile + strlen(fullpn_VFile);
  
***************
*** 1572,1577 ****
--- 1575,1657 ----
      }
  #endif
  
+     code = call_syscall(AFSOP_BASIC_INIT, 1);
+     if (code)
+ 	printf("%s: Error %d in basic initialization.\n", rn, code);
+ 
+     /*
+      * Tell the kernel some basic information about the workstation's cache.
+      */
+     if (afsd_verbose)
+ 	printf("%s: Calling AFSOP_CACHEINIT: %d stat cache entries, %d optimum cache files, %d blocks in the cache, flags = 0x%x, dcache entries %d\n",
+ 	       rn, cacheStatEntries, cacheFiles, cacheBlocks, cacheFlags,
+ 	       dCacheSize);
+     memset(&cparams, '\0', sizeof(cparams));
+     cparams.cacheScaches = cacheStatEntries;
+     cparams.cacheFiles = cacheFiles;
+     cparams.cacheBlocks = cacheBlocks;
+     cparams.cacheDcaches = dCacheSize;
+     cparams.cacheVolumes = vCacheSize;
+     cparams.chunkSize = chunkSize;
+     cparams.setTimeFlag = cacheSetTime;
+     cparams.memCacheFlag = cacheFlags;
+ #ifdef notdef
+     cparams.inodes       = inodes;
+ #endif
+     call_syscall(AFSOP_CACHEINIT, &cparams);
+     if (afsd_CloseSynch) 
+ 	call_syscall(AFSOP_CLOSEWAIT);
+ 
+     /*
+      * Sweep the workstation AFS cache directory, remembering the inodes of
+      * valid files and deleting extraneous files.  Keep sweeping until we
+      * have the right number of data cache files or we've swept too many
+      * times.
+      *
+      * This also creates files in the cache directory like VolumeItems and
+      * CellItems, and thus must be ran before those are sent to the kernel.
+      */
+     if (afsd_verbose)
+ 	printf("%s: Sweeping workstation's AFS cache directory.\n",
+ 	       rn);
+     cacheIteration = 0;
+     /* Memory-cache based system doesn't need any of this */
+     if(!(cacheFlags & AFSCALL_INIT_MEMCACHE)) {
+ 	do {
+ 	    cacheIteration++;
+ 	    if (SweepAFSCache(&vFilesFound)) {
+ 		printf("%s: Error on sweep %d of workstation AFS cache \
+                        directory.\n", rn, cacheIteration);
+ 		exit(1);
+ 	    }
+ 	    if (afsd_verbose)
+ 		printf("%s: %d out of %d data cache files found in sweep %d.\n",
+ 		       rn, vFilesFound, cacheFiles, cacheIteration);
+ 	} while ((vFilesFound < cacheFiles) &&
+ 		 (cacheIteration < MAX_CACHE_LOOPS));
+     } else if(afsd_verbose)
+ 	printf("%s: Using memory cache, not swept\n", rn);
+ 
+     /*
+      * Pass the kernel the name of the workstation cache file holding the 
+      * dcache entries.
+      */
+     if (afsd_debug)
+ 	printf("%s: Calling AFSOP_CACHEINFO: dcache file is '%s'\n",
+ 	       rn, fullpn_DCacheFile);
+     /* once again, meaningless for a memory-based cache. */
+     if(!(cacheFlags & AFSCALL_INIT_MEMCACHE))
+ 	call_syscall(AFSOP_CACHEINFO, fullpn_DCacheFile);
+ 
+     /*
+      * Pass the kernel the name of the workstation cache file holding the
+      * cell information.
+      */
+     if (afsd_debug)
+ 	printf("%s: Calling AFSOP_CELLINFO: cell info file is '%s'\n",
+ 	       rn, fullpn_CellInfoFile);
+     call_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile);
+ 
      if (enable_dynroot) {
  	if (afsd_verbose)
  	    printf("%s: Enabling dynroot support in kernel.\n", rn);
***************
*** 1588,1593 ****
--- 1668,1684 ----
  	    printf("%s: Error enabling fakestat support.\n", rn);
      }
  
+     /*
+      * Tell the kernel about each cell in the configuration.
+      */
+     afsconf_CellApply(cdir, ConfigCell, NULL);
+     afsconf_CellAliasApply(cdir, ConfigCellAlias, NULL);
+ 
+     /*
+      * Set the primary cell name.
+      */
+     call_syscall(AFSOP_SET_THISCELL, LclCellName);
+ 
      /* Initialize AFS daemon threads. */
      if (afsd_verbose)
  	printf("%s: Forking AFS daemon.\n", rn);
***************
*** 1644,1666 ****
  #endif
  
      /*
-      * Tell the kernel about each cell in the configuration.
-      */
-     lookingForHomeCell = 1;
- 
-     afsconf_CellApply(cdir, ConfigCell, (char *) 0);
-     afsconf_CellAliasApply(cdir, ConfigCellAlias, (char *) 0);
- 
-     /*
-      * If we're still looking for the home cell after the whole cell configuration database
-      * has been parsed, there's something wrong.
-      */
-     if (lookingForHomeCell) {
- 	printf("%s: Can't find information for home cell '%s' in cell database!\n",
- 	       rn, LclCellName);
-     }
- 
-     /*
       * If the root volume has been explicitly set, tell the kernel.
       */
      if (rootVolSet) {
--- 1735,1740 ----
***************
*** 1669,1735 ****
  	      rn, rootVolume);
  	call_syscall(AFSOP_ROOTVOLUME, rootVolume);
      }
- 
-     /*
-      * Tell the kernel some basic information about the workstation's cache.
-      */
-     if (afsd_verbose)
- 	printf("%s: Calling AFSOP_CACHEINIT: %d stat cache entries, %d optimum cache files, %d blocks in the cache, flags = 0x%x, dcache entries %d\n",
- 	       rn, cacheStatEntries, cacheFiles, cacheBlocks, cacheFlags,
- 	       dCacheSize);
-     memset(&cparams, '\0', sizeof(cparams));
-     cparams.cacheScaches = cacheStatEntries;
-     cparams.cacheFiles = cacheFiles;
-     cparams.cacheBlocks = cacheBlocks;
-     cparams.cacheDcaches = dCacheSize;
-     cparams.cacheVolumes = vCacheSize;
-     cparams.chunkSize = chunkSize;
-     cparams.setTimeFlag = cacheSetTime;
-     cparams.memCacheFlag = cacheFlags;
- #ifdef notdef
-     cparams.inodes       = inodes;
- #endif
-     call_syscall(AFSOP_CACHEINIT, &cparams);
-     if (afsd_CloseSynch) 
-       call_syscall(AFSOP_CLOSEWAIT);
- 
-     /*
-      * Sweep the workstation AFS cache directory, remembering the inodes of
-      * valid files and deleting extraneous files.  Keep sweeping until we
-      * have the right number of data cache files or we've swept too many
-      * times.
-      */
-     if (afsd_verbose)
- 	printf("%s: Sweeping workstation's AFS cache directory.\n",
- 	       rn);
-     cacheIteration = 0;
-     /* Memory-cache based system doesn't need any of this */
-     if(!(cacheFlags & AFSCALL_INIT_MEMCACHE)) {
- 	do {
- 	    cacheIteration++;
- 	    if (SweepAFSCache(&vFilesFound)) {
- 		printf("%s: Error on sweep %d of workstation AFS cache \
-                        directory.\n", rn, cacheIteration);
- 		exit(1);
- 	    }
- 	    if (afsd_verbose)
- 		printf("%s: %d out of %d data cache files found in sweep %d.\n",
- 		       rn, vFilesFound, cacheFiles, cacheIteration);
- 	} while ((vFilesFound < cacheFiles) &&
- 		 (cacheIteration < MAX_CACHE_LOOPS));
-     } else if(afsd_verbose)
- 	printf("%s: Using memory cache, not swept\n", rn);
- 
-     /*
-      * Pass the kernel the name of the workstation cache file holding the 
-      * dcache entries.
-      */
-     if (afsd_debug)
- 	printf("%s: Calling AFSOP_CACHEINFO: dcache file is '%s'\n",
- 	       rn, fullpn_DCacheFile);
-     /* once again, meaningless for a memory-based cache. */
-     if(!(cacheFlags & AFSCALL_INIT_MEMCACHE))
- 	call_syscall(AFSOP_CACHEINFO, fullpn_DCacheFile);
  
      /*
       * Pass the kernel the name of the workstation cache file holding the
--- 1743,1748 ----
Index: openafs/src/afsmonitor/afsmonitor.c
diff -c openafs/src/afsmonitor/afsmonitor.c:1.9.2.1 openafs/src/afsmonitor/afsmonitor.c:1.9.2.2
*** openafs/src/afsmonitor/afsmonitor.c:1.9.2.1	Tue Sep 10 18:33:36 2002
--- openafs/src/afsmonitor/afsmonitor.c	Sat Jan 11 02:42:31 2003
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afsmonitor/afsmonitor.c,v 1.9.2.1 2002/09/10 22:33:36 zacheiss Exp $");
  
  #include <stdio.h>
  #include <math.h>
--- 16,22 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/afsmonitor/afsmonitor.c,v 1.9.2.2 2003/01/11 07:42:31 shadow Exp $");
  
  #include <stdio.h>
  #include <math.h>
***************
*** 209,215 ****
  /* EXTERN DEFINITIONS */
  
  extern struct hostent *hostutil_GetHostByName(); 
! extern int errno;
  
  
  /* routines from afsmon-output.c */
--- 209,215 ----
  /* EXTERN DEFINITIONS */
  
  extern struct hostent *hostutil_GetHostByName(); 
! 
  
  
  /* routines from afsmon-output.c */
Index: openafs/src/butc/Makefile.in
diff -c openafs/src/butc/Makefile.in:1.4 openafs/src/butc/Makefile.in:1.4.2.2
*** openafs/src/butc/Makefile.in:1.4	Fri Sep  7 19:34:50 2001
--- openafs/src/butc/Makefile.in	Mon Feb  3 18:36:47 2003
***************
*** 28,34 ****
  
  include ../config/Makefile.${SYS_NAME}
  
! CFLAGS=-g -w ${INCDIRS} ${XCFLAGS}
  
  INCDIRS=-I${TOP_SRCDIR}/config -I${TOP_INCDIR}/afs \
  	-I${TOP_INCDIR}/rx -I${TOP_INCDIR}
--- 28,34 ----
  
  include ../config/Makefile.${SYS_NAME}
  
! CFLAGS=-g -w ${INCDIRS} ${XCFLAGS} @XBSA_CFLAGS@
  
  INCDIRS=-I${TOP_SRCDIR}/config -I${TOP_INCDIR}/afs \
  	-I${TOP_INCDIR}/rx -I${TOP_INCDIR}
***************
*** 107,113 ****
  
  install:  
  	@case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun4x_*|rs_aix4*|*linux*|hp_ux*) \
  		echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \
  	*) \
  		echo ${INSTALL} butc ${DESTDIR}${sbindir}/butc ; \
--- 107,113 ----
  
  install:  
  	@case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun*|rs_aix4*|*linux*|hp_ux*) \
  		echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \
  	*) \
  		echo ${INSTALL} butc ${DESTDIR}${sbindir}/butc ; \
***************
*** 118,124 ****
  include ../config/Makefile.version
  dest:  
  	@case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun4x_*|rs_aix4*|*linux*|hp_ux*) \
  		echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \
  	*) \
  		echo ${INSTALL} butc ${DEST}/etc/butc ; \
--- 118,124 ----
  include ../config/Makefile.version
  dest:  
  	@case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun*|rs_aix4*|*linux*|hp_ux*) \
  		echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \
  	*) \
  		echo ${INSTALL} butc ${DEST}/etc/butc ; \
Index: openafs/src/butm/butm_test.c
diff -c openafs/src/butm/butm_test.c:1.5.2.2 openafs/src/butm/butm_test.c:1.5.2.3
*** openafs/src/butm/butm_test.c:1.5.2.2	Sat Oct 13 00:21:09 2001
--- openafs/src/butm/butm_test.c	Sat Jan 11 02:42:33 2003
***************
*** 10,17 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/butm/butm_test.c,v 1.5.2.2 2001/10/13 04:21:09 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/file.h>
  #include <sys/stat.h>
--- 10,18 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/butm/butm_test.c,v 1.5.2.3 2003/01/11 07:42:33 shadow Exp $");
  
+ #include <errno.h>
  #include <sys/types.h>
  #include <sys/file.h>
  #include <sys/stat.h>
***************
*** 23,29 ****
  #include <afs/butm.h>
  #include "AFS_component_version_number.c"
  
! extern int errno;
  
  static char *whoami = "TEST FAIL";
  
--- 24,30 ----
  #include <afs/butm.h>
  #include "AFS_component_version_number.c"
  
! 
  
  static char *whoami = "TEST FAIL";
  
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.6.2.6 openafs/src/cf/linux-test4.m4:1.6.2.9
*** openafs/src/cf/linux-test4.m4:1.6.2.6	Tue Nov 26 18:54:44 2002
--- openafs/src/cf/linux-test4.m4	Fri Mar 21 09:01:10 2003
***************
*** 1,35 ****
! AC_DEFUN(LINUX_EXPORTS_TASKLIST_LOCK, [
! AC_MSG_CHECKING(for exported tasklist_lock)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_exports_tasklist_lock,
  [
  AC_TRY_COMPILE(
! [#include <linux/modversions.h>],
! [#ifndef __ver_tasklist_lock
! #error tasklist_lock not exported
  #endif],
! ac_cv_linux_exports_tasklist_lock=yes,
! ac_cv_linux_exports_tasklist_lock=no)])
! AC_MSG_RESULT($ac_cv_linux_exports_tasklist_lock)
  CPPFLAGS="$save_CPPFLAGS"])
  
! AC_DEFUN(LINUX_EXPORTS_SYS_CALL_TABLE, [
! AC_MSG_CHECKING(for exported sys_call_table)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_exports_sys_call_table,
  [
  AC_TRY_COMPILE(
! [#include <linux/modversions.h>],
! [#ifndef __ver_sys_call_table
! #error sys_call_table not exported
  #endif],
! ac_cv_linux_exports_sys_call_table=yes,
! ac_cv_linux_exports_sys_call_table=no)])
! AC_MSG_RESULT($ac_cv_linux_exports_sys_call_table)
  CPPFLAGS="$save_CPPFLAGS"])
  
  AC_DEFUN(LINUX_EXPORTS_INIT_MM, [
  AC_MSG_CHECKING(for exported init_mm)
  save_CPPFLAGS="$CPPFLAGS"
--- 1,57 ----
! AC_DEFUN(LINUX_COMPLETION_H_EXISTS, [
! AC_MSG_CHECKING(for linux/completion.h existance)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_completion_h_exists,
  [
  AC_TRY_COMPILE(
! [#include <linux/completion.h>
! #include <linux/version.h>],
! [struct completion _c;
! #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,8)
! lose
! #endif
! ],
! ac_cv_linux_completion_h_exists=yes,
! ac_cv_linux_completion_h_exists=no)])
! AC_MSG_RESULT($ac_cv_linux_completion_h_exists)
! CPPFLAGS="$save_CPPFLAGS"])
! 
! 
! AC_DEFUN(LINUX_DEFINES_FOR_EACH_PROCESS, [
! AC_MSG_CHECKING(for defined for_each_process)
! save_CPPFLAGS="$CPPFLAGS"
! CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_defines_for_each_process,
! [
! AC_TRY_COMPILE(
! [#include <linux/sched.h>],
! [#ifndef for_each_process(p)
! #error for_each_process not defined
  #endif],
! ac_cv_linux_defines_for_each_process=yes,
! ac_cv_linux_defines_for_each_process=no)])
! AC_MSG_RESULT($ac_cv_linux_defines_for_each_process)
  CPPFLAGS="$save_CPPFLAGS"])
  
! 
! AC_DEFUN(LINUX_DEFINES_PREV_TASK, [
! AC_MSG_CHECKING(for defined prev_task)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_defines_prev_task,
  [
  AC_TRY_COMPILE(
! [#include <linux/sched.h>],
! [#ifndef prev_task(p)
! #error prev_task not defined
  #endif],
! ac_cv_linux_defines_prev_task=yes,
! ac_cv_linux_defines_prev_task=no)])
! AC_MSG_RESULT($ac_cv_linux_defines_prev_task)
  CPPFLAGS="$save_CPPFLAGS"])
  
+ 
  AC_DEFUN(LINUX_EXPORTS_INIT_MM, [
  AC_MSG_CHECKING(for exported init_mm)
  save_CPPFLAGS="$CPPFLAGS"
***************
*** 46,51 ****
--- 68,91 ----
  AC_MSG_RESULT($ac_cv_linux_exports_init_mm)
  CPPFLAGS="$save_CPPFLAGS"])
  
+ 
+ AC_DEFUN(LINUX_EXPORTS_KALLSYMS_ADDRESS, [
+ AC_MSG_CHECKING(for exported kallsyms_address_to_symbol)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+ AC_CACHE_VAL(ac_cv_linux_exports_kallsyms_address,
+ [
+ AC_TRY_COMPILE(
+ [#include <linux/modversions.h>],
+ [#ifndef __ver_kallsyms_address_to_symbol
+ #error kallsyms_address_to_symbol not exported
+ #endif],
+ ac_cv_linux_exports_kallsyms_address=yes,
+ ac_cv_linux_exports_kallsyms_address=no)])
+ AC_MSG_RESULT($ac_cv_linux_exports_kallsyms_address)
+ CPPFLAGS="$save_CPPFLAGS"])
+ 
+ 
  AC_DEFUN(LINUX_EXPORTS_KALLSYMS_SYMBOL, [
  AC_MSG_CHECKING(for exported kallsyms_symbol_to_address)
  save_CPPFLAGS="$CPPFLAGS"
***************
*** 62,117 ****
  AC_MSG_RESULT($ac_cv_linux_exports_kallsyms_symbol)
  CPPFLAGS="$save_CPPFLAGS"])
  
! AC_DEFUN(LINUX_EXPORTS_KALLSYMS_ADDRESS, [
! AC_MSG_CHECKING(for exported kallsyms_address_to_symbol)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_exports_kallsyms_address,
  [
  AC_TRY_COMPILE(
  [#include <linux/modversions.h>],
! [#ifndef __ver_kallsyms_address_to_symbol
! #error kallsyms_address_to_symbol not exported
  #endif],
! ac_cv_linux_exports_kallsyms_address=yes,
! ac_cv_linux_exports_kallsyms_address=no)])
! AC_MSG_RESULT($ac_cv_linux_exports_kallsyms_address)
  CPPFLAGS="$save_CPPFLAGS"])
  
! AC_DEFUN(LINUX_COMPLETION_H_EXISTS, [
! AC_MSG_CHECKING(for linux/completion.h existance)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_completion_h_exists,
  [
  AC_TRY_COMPILE(
! [#include <linux/completion.h>
! #include <linux/version.h>],
! [struct completion _c;
! #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,8)
! lose
! #endif
! ],
! ac_cv_linux_completion_h_exists=yes,
! ac_cv_linux_completion_h_exists=no)])
! AC_MSG_RESULT($ac_cv_linux_completion_h_exists)
  CPPFLAGS="$save_CPPFLAGS"])
  
! AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_MMAP_SHARED, [
! AC_MSG_CHECKING(for i_mmap_shared in struct inode)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_mmap_shared,
  [
  AC_TRY_COMPILE(
  [#include <linux/fs.h>],
  [struct inode _inode;
! printf("%d\n", _inode.i_mmap_shared);],
! ac_cv_linux_fs_struct_inode_has_i_mmap_shared=yes,
! ac_cv_linux_fs_struct_inode_has_i_mmap_shared=no)])
! AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mmap_shared)
  CPPFLAGS="$save_CPPFLAGS"])
  
  AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, [
  AC_MSG_CHECKING(for i_dirty_data_buffers in struct inode)
  save_CPPFLAGS="$CPPFLAGS"
--- 102,208 ----
  AC_MSG_RESULT($ac_cv_linux_exports_kallsyms_symbol)
  CPPFLAGS="$save_CPPFLAGS"])
  
! 
! AC_DEFUN(LINUX_EXPORTS_SYS_CALL_TABLE, [
! AC_MSG_CHECKING(for exported sys_call_table)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_exports_sys_call_table,
  [
  AC_TRY_COMPILE(
  [#include <linux/modversions.h>],
! [#ifndef __ver_sys_call_table
! #error sys_call_table not exported
  #endif],
! ac_cv_linux_exports_sys_call_table=yes,
! ac_cv_linux_exports_sys_call_table=no)])
! AC_MSG_RESULT($ac_cv_linux_exports_sys_call_table)
  CPPFLAGS="$save_CPPFLAGS"])
  
! 
! AC_DEFUN(LINUX_EXPORTS_SYS_CHDIR, [
! AC_MSG_CHECKING(for exported sys_chdir)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_exports_sys_chdir,
  [
  AC_TRY_COMPILE(
! [#include <linux/modversions.h>],
! [#ifndef __ver_sys_chdir
! #error sys_chdir not exported
! #endif],
! ac_cv_linux_exports_sys_chdir=yes,
! ac_cv_linux_exports_sys_chdir=no)])
! AC_MSG_RESULT($ac_cv_linux_exports_sys_chdir)
  CPPFLAGS="$save_CPPFLAGS"])
  
! 
! AC_DEFUN(LINUX_EXPORTS_SYS_CLOSE, [
! AC_MSG_CHECKING(for exported sys_close)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_exports_sys_close,
! [
! AC_TRY_COMPILE(
! [#include <linux/modversions.h>],
! [#ifndef __ver_sys_close
! #error sys_close not exported
! #endif],
! ac_cv_linux_exports_sys_close=yes,
! ac_cv_linux_exports_sys_close=no)])
! AC_MSG_RESULT($ac_cv_linux_exports_sys_close)
! CPPFLAGS="$save_CPPFLAGS"])
! 
! 
! AC_DEFUN(LINUX_EXPORTS_TASKLIST_LOCK, [
! AC_MSG_CHECKING(for exported tasklist_lock)
! save_CPPFLAGS="$CPPFLAGS"
! CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_exports_tasklist_lock,
! [
! AC_TRY_COMPILE(
! [#include <linux/modversions.h>],
! [#ifndef __ver_tasklist_lock
! #error tasklist_lock not exported
! #endif],
! ac_cv_linux_exports_tasklist_lock=yes,
! ac_cv_linux_exports_tasklist_lock=no)])
! AC_MSG_RESULT($ac_cv_linux_exports_tasklist_lock)
! CPPFLAGS="$save_CPPFLAGS"])
! 
! 
! AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_CDEV, [
! AC_MSG_CHECKING(for i_cdev in struct inode)
! save_CPPFLAGS="$CPPFLAGS"
! CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev, 
  [
  AC_TRY_COMPILE(
  [#include <linux/fs.h>],
  [struct inode _inode;
! printf("%d\n", _inode.i_cdev);], 
! ac_cv_linux_fs_struct_inode_has_i_cdev=yes,
! ac_cv_linux_fs_struct_inode_has_i_cdev=no)])
! AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_cdev)
! CPPFLAGS="$save_CPPFLAGS"])
! 
! 
! AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DEVICES, [
! AC_MSG_CHECKING(for i_devices in struct inode)
! save_CPPFLAGS="$CPPFLAGS"
! CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev, 
! [
! AC_TRY_COMPILE(
! [#include <linux/fs.h>],
! [struct inode _inode;
! printf("%d\n", _inode.i_devices);], 
! ac_cv_linux_fs_struct_inode_has_i_devices=yes,
! ac_cv_linux_fs_struct_inode_has_i_devices=no)])
! AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_devices)
  CPPFLAGS="$save_CPPFLAGS"])
  
+ 
  AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, [
  AC_MSG_CHECKING(for i_dirty_data_buffers in struct inode)
  save_CPPFLAGS="$CPPFLAGS"
***************
*** 127,132 ****
--- 218,224 ----
  AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers)
  CPPFLAGS="$save_CPPFLAGS"])
  
+ 
  AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_MAPPING_OVERLOAD, [
  AC_MSG_CHECKING(for i_mapping_overload in struct inode)
  save_CPPFLAGS="$CPPFLAGS"
***************
*** 142,174 ****
  AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mapping_overload)
  CPPFLAGS="$save_CPPFLAGS"])
  
! AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_CDEV, [
! AC_MSG_CHECKING(for i_cdev in struct inode)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev, 
  [
  AC_TRY_COMPILE(
  [#include <linux/fs.h>],
  [struct inode _inode;
! printf("%d\n", _inode.i_cdev);], 
! ac_cv_linux_fs_struct_inode_has_i_cdev=yes,
! ac_cv_linux_fs_struct_inode_has_i_cdev=no)])
! AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_cdev)
  CPPFLAGS="$save_CPPFLAGS"])
  
! AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DEVICES, [
! AC_MSG_CHECKING(for i_devices in struct inode)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev, 
  [
  AC_TRY_COMPILE(
! [#include <linux/fs.h>],
! [struct inode _inode;
! printf("%d\n", _inode.i_devices);], 
! ac_cv_linux_fs_struct_inode_has_i_devices=yes,
! ac_cv_linux_fs_struct_inode_has_i_devices=no)])
! AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_devices)
  CPPFLAGS="$save_CPPFLAGS"])
  
--- 234,344 ----
  AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mapping_overload)
  CPPFLAGS="$save_CPPFLAGS"])
  
! 
! AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_MMAP_SHARED, [
! AC_MSG_CHECKING(for i_mmap_shared in struct inode)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_mmap_shared,
  [
  AC_TRY_COMPILE(
  [#include <linux/fs.h>],
  [struct inode _inode;
! printf("%d\n", _inode.i_mmap_shared);],
! ac_cv_linux_fs_struct_inode_has_i_mmap_shared=yes,
! ac_cv_linux_fs_struct_inode_has_i_mmap_shared=no)])
! AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mmap_shared)
  CPPFLAGS="$save_CPPFLAGS"])
  
! 
! AC_DEFUN(LINUX_RECALC_SIGPENDING_ARG_TYPE,[
! AC_MSG_CHECKING(for recalc_sigpending arg type)
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_func_recalc_sigpending_takes_void,
  [
  AC_TRY_COMPILE(
! [#include <linux/sched.h>],
! [recalc_sigpending();],
! ac_cv_linux_func_recalc_sigpending_takes_void=yes,
! ac_cv_linux_func_recalc_sigpending_takes_void=no)])
! AC_MSG_RESULT($ac_cv_linux_func_recalc_sigpending_takes_void)
! CPPFLAGS="$save_CPPFLAGS"])
! 
! 
! AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_PARENT, [
! AC_MSG_CHECKING(for parent in struct task_struct)
! save_CPPFLAGS="$CPPFLAGS"
! CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
! AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_parent,
! [
! AC_TRY_COMPILE(
! [#include <linux/sched.h>],
! [struct task_struct _tsk;
! printf("%d\n", _tsk.parent);],
! ac_cv_linux_sched_struct_task_struct_has_parent=yes,
! ac_cv_linux_sched_struct_task_struct_has_parent=no)])
! AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_parent)
  CPPFLAGS="$save_CPPFLAGS"])
  
+ 
+ AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_REAL_PARENT, [
+ AC_MSG_CHECKING(for real_parent in struct task_struct)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+ AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_real_parent,
+ [
+ AC_TRY_COMPILE(
+ [#include <linux/sched.h>],
+ [struct task_struct _tsk;
+ printf("%d\n", _tsk.real_parent);],
+ ac_cv_linux_sched_struct_task_struct_has_real_parent=yes,
+ ac_cv_linux_sched_struct_task_struct_has_real_parent=no)])
+ AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_real_parent)
+ CPPFLAGS="$save_CPPFLAGS"])
+ 
+ 
+ AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIG, [
+ AC_MSG_CHECKING(for sig in struct task_struct)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+ AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_sig,
+ [
+ AC_TRY_COMPILE(
+ [#include <linux/sched.h>],
+ [struct task_struct _tsk;
+ printf("%d\n", _tsk.sig);],
+ ac_cv_linux_sched_struct_task_struct_has_sig=yes,
+ ac_cv_linux_sched_struct_task_struct_has_sig=no)])
+ AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_sig)
+ CPPFLAGS="$save_CPPFLAGS"])
+ 
+ AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK, [
+ AC_MSG_CHECKING(for sigmask_lock in struct task_struct)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+ AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_sigmask_lock,
+ [
+ AC_TRY_COMPILE(
+ [#include <linux/sched.h>],
+ [struct task_struct _tsk;
+ printf("%d\n", _tsk.sigmask_lock);],
+ ac_cv_linux_sched_struct_task_struct_has_sigmask_lock=yes,
+ ac_cv_linux_sched_struct_task_struct_has_sigmask_lock=no)])
+ AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_sigmask_lock)
+ CPPFLAGS="$save_CPPFLAGS"])
+ 
+ AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGHAND, [
+ AC_MSG_CHECKING(for sighand in struct task_struct)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+ AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_sighand,
+ [
+ AC_TRY_COMPILE(
+ [#include <linux/sched.h>],
+ [struct task_struct _tsk;
+ printf("%d\n", _tsk.sighand);],
+ ac_cv_linux_sched_struct_task_struct_has_sighand=yes,
+ ac_cv_linux_sched_struct_task_struct_has_sighand=no)])
+ AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_sighand)
+ CPPFLAGS="$save_CPPFLAGS"])
Index: openafs/src/cf/solaris-fs-rolled.m4
diff -c /dev/null openafs/src/cf/solaris-fs-rolled.m4:1.1.2.1
*** /dev/null	Fri Apr 11 14:43:51 2003
--- openafs/src/cf/solaris-fs-rolled.m4	Fri Mar 28 16:27:19 2003
***************
*** 0 ****
--- 1,16 ----
+ AC_DEFUN(SOLARIS_FS_HAS_FS_ROLLED, [
+ AC_MSG_CHECKING(for fs_rolled in struct proc)
+ AC_CACHE_VAL(ac_cv_solaris_fs_has_fs_rolled,
+ [
+ AC_TRY_COMPILE(
+ [#include <sys/fs/ufs_fs.h>],
+ [struct fs _fs;
+ (void) _fs.fs_rolled;], 
+ ac_cv_solaris_fs_has_fs_rolled=yes,
+ ac_cv_solaris_fs_has_fs_rolled=no)])
+ AC_MSG_RESULT($ac_cv_solaris_fs_has_fs_rolled)
+ if test "$ac_cv_solaris_fs_has_fs_rolled" = "yes"; then
+   AC_DEFINE(STRUCT_FS_HAS_FS_ROLLED, 1, [define if struct fs has fs_rolled])
+ fi
+ ])
+ 
Index: openafs/src/cmd/cmd.c
diff -c openafs/src/cmd/cmd.c:1.6.4.2 openafs/src/cmd/cmd.c:1.6.4.3
*** openafs/src/cmd/cmd.c:1.6.4.2	Sat Oct 13 00:21:12 2001
--- openafs/src/cmd/cmd.c	Mon Feb  3 18:16:20 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/cmd/cmd.c,v 1.6.4.2 2001/10/13 04:21:12 shadow Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/cmd/cmd.c,v 1.6.4.3 2003/02/03 23:16:20 shadow Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
***************
*** 784,789 ****
--- 784,792 ----
         otherwise it is a real nuisance */
      if (ts->parms[CMD_HELPPARM].items) {
  	PrintSyntax(ts);
+ 	/* Display full help syntax if we don't have subcommands */
+ 	if (noOpcodes)
+ 	    PrintFlagHelp(ts);
  	ResetSyntax(ts);
  	return 0;
      }
Index: openafs/src/config/Makefile.alpha_dux51.in
diff -c /dev/null openafs/src/config/Makefile.alpha_dux51.in:1.1.2.1
*** /dev/null	Fri Apr 11 14:43:51 2003
--- openafs/src/config/Makefile.alpha_dux51.in	Wed Apr  9 12:33:30 2003
***************
*** 0 ****
--- 1,32 ----
+ # 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=
+ SHLIB_LINKER=${CC} -all -shared -expect_unresolved "*"
+ XLIBS=@LIB_AFSDB@
+ MTLIBS=-pthread -lpthread -lmach -lexc -lc
+ NON_SHARED=-non_shared
+ TXLIBS= -lcurses
+ LWP_OPTMZ=-O2
+ OPTMZ=-O2
+ DBG=-g3
+ CP=cp
+ RM=rm
+ CSTATIC=-non_shared
+ RANLIB=/bin/true
+ INSTALL=${TOP_SRCDIR}/pinstall/pinstall
+ 
+ #this is for the vol package
+ FS_CONV_OSF40D         = fs_conv_dux40D
+ install_FS_CONV_OSF40D = $(DESTDIR)${afssrvsbindir}/fs_conv_dux40D
+ dest_FS_CONV_OSF40D    = $(DEST)/root.server/usr/afs/bin/fs_conv_dux40D
Index: openafs/src/config/Makefile.sunx86_58.in
diff -c /dev/null openafs/src/config/Makefile.sunx86_58.in:1.2.2.1
*** /dev/null	Fri Apr 11 14:43:52 2003
--- openafs/src/config/Makefile.sunx86_58.in	Mon Jan 13 17:57:49 2003
***************
*** 0 ****
--- 1,50 ----
+ # Keep macros within each section in sorted order for clean diff displays.
+ #
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = SOLARIS
+ #
+ # compilation and link editor flags
+ XCFLAGS=-dy -Bdynamic
+ MT_CFLAGS=-mt -DAFS_PTHREAD_ENV ${XCFLAGS}
+ PAM_CFLAGS = -KPIC
+ PAMLIBS= -lc -lpam -lsocket -lnsl -lm
+ SHLIB_LDFLAGS = -G -Bsymbolic
+ LWP_OPTMZ=-g
+ OPTMZ=-O
+ DBG=-g
+ 
+ ## Compilation flags for 64 bit Solaris
+ XCFLAGS64 = ${XCFLAGS} -xarch=v9
+ 
+ SHLIB_SUFFIX=so
+ SHLIB_LINKER=${CC} -G -dy -Wl,-Mmapfile -Bsymbolic -z text
+ #
+ # libraries
+ XLIBS=@LIB_AFSDB@ -lsocket -lnsl -lintl -ldl 
+ TXLIBS=-lcurses
+ MTLIBS=-lpthread -lsocket
+ XLIBELFA=-lelf
+ XLIBKVM=-lkvm
+ #
+ SHLIB_SUFFIX=so
+ SHLIB_CFLAGS=-KPIC
+ #
+ # programs
+ AR=/usr/ccs/bin/ar
+ AS=as
+ CC=/opt/SUNWspro/bin/cc
+ MT_CC=/opt/SUNWspro/bin/cc
+ CP=/bin/cp
+ LEX=lex
+ LD= /usr/ccs/bin/ld
+ LORDER = /usr/ccs/bin/lorder
+ MV=mv
+ RANLIB=/bin/true
+ RM=rm
+ STRIP= /usr/ccs/bin/strip
+ INSTALL=${TOP_SRCDIR}/pinstall/pinstall
+ #
+ # this is for the vol package
+ FS_CONV_SOL26         = fs_conv_sol26
+ install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26
+ dest_FS_CONV_SOL26    = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26
Index: openafs/src/config/Makefile.sunx86_59.in
diff -c /dev/null openafs/src/config/Makefile.sunx86_59.in:1.1.2.1
*** /dev/null	Fri Apr 11 14:43:52 2003
--- openafs/src/config/Makefile.sunx86_59.in	Tue Mar 18 18:18:18 2003
***************
*** 0 ****
--- 1,49 ----
+ # Keep macros within each section in sorted order for clean diff displays.
+ #
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = SOLARIS
+ #
+ # compilation and link editor flags
+ XCFLAGS=-dy -Bdynamic
+ MT_CFLAGS=-mt -DAFS_PTHREAD_ENV ${XCFLAGS}
+ PAM_CFLAGS = -KPIC
+ PAMLIBS= -lc -lpam -lsocket -lnsl -lm
+ LWP_OPTMZ=-g
+ OPTMZ=-O
+ DBG=-g
+ 
+ ## Compilation flags for 64 bit Solaris
+ XCFLAGS64 = ${XCFLAGS} -xarch=v9
+ 
+ #
+ # libraries
+ XLIBS=@LIB_AFSDB@ -lsocket -lnsl -lintl -ldl 
+ TXLIBS=-lcurses
+ MTLIBS=-lpthread -lsocket
+ XLIBELFA=-lelf
+ XLIBKVM=-lkvm
+ #
+ SHLIB_LINKER=${CC} -G -dy -Wl,-Mmapfile -Bsymbolic -z text
+ SHLIB_SUFFIX=so
+ SHLIB_CFLAGS=-KPIC
+ SHLIB_LDFLAGS = -G -Bsymbolic
+ #
+ # programs
+ AR=/usr/ccs/bin/ar
+ AS=as
+ CC=/opt/SUNWspro/bin/cc
+ MT_CC=/opt/SUNWspro/bin/cc
+ CP=/bin/cp
+ LEX=lex
+ LD= /usr/ccs/bin/ld
+ LORDER = /usr/ccs/bin/lorder
+ MV=mv
+ RANLIB=/bin/true
+ RM=rm
+ STRIP= /usr/ccs/bin/strip
+ INSTALL=${TOP_SRCDIR}/pinstall/pinstall
+ #
+ # this is for the vol package
+ FS_CONV_SOL26         = fs_conv_sol26
+ install_FS_CONV_SOL26 = $(DESTDIR)${afssrvsbindir}/fs_conv_sol26
+ dest_FS_CONV_SOL26    = $(DEST)/root.server/usr/afs/bin/fs_conv_sol26
Index: openafs/src/config/afs_args.h
diff -c openafs/src/config/afs_args.h:1.3.4.3 openafs/src/config/afs_args.h:1.3.4.4
*** openafs/src/config/afs_args.h:1.3.4.3	Mon Jul 22 19:14:59 2002
--- openafs/src/config/afs_args.h	Thu Mar  6 09:53:36 2003
***************
*** 42,47 ****
--- 42,50 ----
  #define	AFSOP_SET_DYNROOT	 31	/* enable/disable dynroot support */
  #define	AFSOP_ADDCELLALIAS	 32	/* create alias for existing cell */
  #define	AFSOP_SET_FAKESTAT	 33	/* enable/disable fakestat support */
+ #define	AFSOP_CELLINFO		 34	/* set the cellinfo file name */
+ #define	AFSOP_SET_THISCELL	 35	/* set the primary cell */
+ #define AFSOP_BASIC_INIT	 36	/* used to be part of START_AFS */
  
  /* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
  #define	AFSCALL_PIOCTL		20
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.14.2.5 openafs/src/config/afs_sysnames.h:1.14.2.7
*** openafs/src/config/afs_sysnames.h:1.14.2.5	Tue Sep 10 18:33:45 2002
--- openafs/src/config/afs_sysnames.h	Wed Apr  9 12:33:30 2003
***************
*** 88,93 ****
--- 88,94 ----
     they won't allocate sunx86 IDs at all. So leave a gap and pray. */
  #define SYS_NAME_ID_sunx86_57            950
  #define SYS_NAME_ID_sunx86_58            951
+ #define SYS_NAME_ID_sunx86_59            952
  
  #define SYS_NAME_ID_vax_ul4		1003
  #define SYS_NAME_ID_vax_ul40		1004
***************
*** 110,115 ****
--- 111,117 ----
  #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_alpha_dux51		1206
  
  #define SYS_NAME_ID_ncrx86_20		1300
  #define SYS_NAME_ID_ncrx86_30		1301
Index: openafs/src/config/param.alpha_dux51.h
diff -c /dev/null openafs/src/config/param.alpha_dux51.h:1.2.2.1
*** /dev/null	Fri Apr 11 14:43:52 2003
--- openafs/src/config/param.alpha_dux51.h	Wed Apr  9 12:33:30 2003
***************
*** 0 ****
--- 1,119 ----
+ /*
+  * 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	AFS_PARAM_H
+ #define	AFS_PARAM_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	AFS_DUX51_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_dux51"
+ #define SYS_NAME_ID	SYS_NAME_ID_alpha_dux51
+ 
+ #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 */
+ 
+ #ifdef AFS_NAMEI_ENV
+ #define AFS_64BIT_IOPS_ENV     1       /* needed for NAMEI... */
+ #else
+ #define AFS_3DISPARES   1       /* Utilize the 3 available disk inode spares */
+ #endif
+ 
+ #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__ */
+ 
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
+ #endif /* _KERNEL */
+ 
+ #endif	/* AFS_PARAM_H */
Index: openafs/src/config/param.alpha_dux51_usr.h
diff -c /dev/null openafs/src/config/param.alpha_dux51_usr.h:1.2.2.1
*** /dev/null	Fri Apr 11 14:43:52 2003
--- openafs/src/config/param.alpha_dux51_usr.h	Wed Apr  9 12:33:30 2003
***************
*** 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	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define AFS_VFS_ENV	1
+ /* Used only in vfsck code; is it needed any more???? */
+ #define RXK_LISTENER_ENV	1
+ #define AFS_USERSPACE_IP_ADDR	1
+ #define AFS_GCPAGS		0       /* if nonzero, garbage collect PAGs */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_GREEDY43_ENV	1	/* Used only in rx/rx_user.c */
+ #define AFS_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_dux51"
+ #define SYS_NAME_ID	SYS_NAME_ID_alpha_dux51
+ #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 /* AFS_PARAM_H */
Index: openafs/src/config/param.i386_linux22.h
diff -c openafs/src/config/param.i386_linux22.h:1.10.2.2 openafs/src/config/param.i386_linux22.h:1.10.2.3
*** openafs/src/config/param.i386_linux22.h:1.10.2.2	Wed Jul 10 16:42:34 2002
--- openafs/src/config/param.i386_linux22.h	Mon Feb  3 15:56:10 2003
***************
*** 39,45 ****
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef CONFIG_X86_LOCAL_APIC
! #define CONFIG_X86_LOCAL_APIC
  #endif
  #ifndef __SMP__
  #define __SMP__
--- 39,45 ----
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef CONFIG_X86_LOCAL_APIC
! #define CONFIG_X86_LOCAL_APIC 1
  #endif
  #ifndef __SMP__
  #define __SMP__
Index: openafs/src/config/param.i386_linux24.h
diff -c openafs/src/config/param.i386_linux24.h:1.8.4.2 openafs/src/config/param.i386_linux24.h:1.8.4.4
*** openafs/src/config/param.i386_linux24.h:1.8.4.2	Wed Jul 10 16:42:34 2002
--- openafs/src/config/param.i386_linux24.h	Mon Feb  3 18:06:01 2003
***************
*** 22,27 ****
--- 22,29 ----
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/threads.h>
+ 
  #include <linux/config.h>
  #ifdef CONFIG_SMP
  #undef CONFIG_SMP
***************
*** 32,38 ****
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef CONFIG_X86_LOCAL_APIC
! #define CONFIG_X86_LOCAL_APIC
  #endif
  #ifndef __SMP__
  #define __SMP__
--- 34,40 ----
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef CONFIG_X86_LOCAL_APIC
! #define CONFIG_X86_LOCAL_APIC 1
  #endif
  #ifndef __SMP__
  #define __SMP__
Index: openafs/src/config/param.ia64_linux24.h
diff -c openafs/src/config/param.ia64_linux24.h:1.1.2.3 openafs/src/config/param.ia64_linux24.h:1.1.2.4
*** openafs/src/config/param.ia64_linux24.h:1.1.2.3	Mon Aug 26 00:34:08 2002
--- openafs/src/config/param.ia64_linux24.h	Mon Feb  3 18:06:01 2003
***************
*** 30,35 ****
--- 30,37 ----
  #define AFS_64BITPOINTER_ENV	1     /* pointers are 64 bits. */
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/threads.h>
+ 
  #include <linux/config.h>
  #ifdef CONFIG_SMP
  #undef CONFIG_SMP
Index: openafs/src/config/param.parisc_linux24.h
diff -c openafs/src/config/param.parisc_linux24.h:1.1.2.3 openafs/src/config/param.parisc_linux24.h:1.1.2.4
*** openafs/src/config/param.parisc_linux24.h:1.1.2.3	Wed Jul 10 16:42:34 2002
--- openafs/src/config/param.parisc_linux24.h	Mon Feb  3 18:06:01 2003
***************
*** 20,25 ****
--- 20,27 ----
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/threads.h>
+ 
  #include <linux/config.h>
  #ifdef CONFIG_SMP
  #undef CONFIG_SMP
Index: openafs/src/config/param.ppc_linux24.h
diff -c openafs/src/config/param.ppc_linux24.h:1.4.4.2 openafs/src/config/param.ppc_linux24.h:1.4.4.3
*** openafs/src/config/param.ppc_linux24.h:1.4.4.2	Wed Jul 10 16:42:34 2002
--- openafs/src/config/param.ppc_linux24.h	Mon Feb  3 18:06:01 2003
***************
*** 22,27 ****
--- 22,29 ----
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/threads.h>
+ 
  #include <linux/config.h>
  #ifdef CONFIG_SMP
  #undef CONFIG_SMP
Index: openafs/src/config/param.s390_linux22.h
diff -c openafs/src/config/param.s390_linux22.h:1.4.4.2 openafs/src/config/param.s390_linux22.h:1.4.4.3
*** openafs/src/config/param.s390_linux22.h:1.4.4.2	Wed Jul 10 16:42:34 2002
--- openafs/src/config/param.s390_linux22.h	Mon Feb  3 15:56:10 2003
***************
*** 33,39 ****
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef CONFIG_S390_LOCAL_APIC
! #define CONFIG_S390_LOCAL_APIC
  #endif
  #ifndef __SMP__
  #define __SMP__
--- 33,39 ----
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef CONFIG_S390_LOCAL_APIC
! #define CONFIG_S390_LOCAL_APIC 1
  #endif
  #ifndef __SMP__
  #define __SMP__
Index: openafs/src/config/param.s390_linux24.h
diff -c openafs/src/config/param.s390_linux24.h:1.4.4.2 openafs/src/config/param.s390_linux24.h:1.4.4.4
*** openafs/src/config/param.s390_linux24.h:1.4.4.2	Wed Jul 10 16:42:34 2002
--- openafs/src/config/param.s390_linux24.h	Mon Feb  3 18:06:01 2003
***************
*** 25,30 ****
--- 25,32 ----
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/threads.h>
+ 
  #include <linux/config.h>
  #ifdef CONFIG_SMP
  #undef CONFIG_SMP
***************
*** 35,41 ****
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef CONFIG_S390_LOCAL_APIC
! #define CONFIG_S390_LOCAL_APIC
  #endif
  #ifndef __SMP__
  #define __SMP__
--- 37,43 ----
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef CONFIG_S390_LOCAL_APIC
! #define CONFIG_S390_LOCAL_APIC 1
  #endif
  #ifndef __SMP__
  #define __SMP__
Index: openafs/src/config/param.sparc64_linux24.h
diff -c openafs/src/config/param.sparc64_linux24.h:1.1.4.1 openafs/src/config/param.sparc64_linux24.h:1.1.4.2
*** openafs/src/config/param.sparc64_linux24.h:1.1.4.1	Wed Jul 10 16:03:29 2002
--- openafs/src/config/param.sparc64_linux24.h	Mon Feb  3 18:06:01 2003
***************
*** 30,35 ****
--- 30,37 ----
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/threads.h>
+ 
  #include <linux/config.h>
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
Index: openafs/src/config/param.sparc_linux24.h
diff -c openafs/src/config/param.sparc_linux24.h:1.1.2.3 openafs/src/config/param.sparc_linux24.h:1.1.2.4
*** openafs/src/config/param.sparc_linux24.h:1.1.2.3	Wed Jul 10 16:42:34 2002
--- openafs/src/config/param.sparc_linux24.h	Mon Feb  3 18:06:01 2003
***************
*** 25,30 ****
--- 25,32 ----
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/threads.h>
+ 
  #include <linux/config.h>
  #ifdef CONFIG_SMP
  #undef CONFIG_SMP
Index: openafs/src/config/param.sunx86_57_usr.h
diff -c openafs/src/config/param.sunx86_57_usr.h:1.1.4.1 openafs/src/config/param.sunx86_57_usr.h:1.1.4.2
*** openafs/src/config/param.sunx86_57_usr.h:1.1.4.1	Wed Jul 10 15:57:43 2002
--- openafs/src/config/param.sunx86_57_usr.h	Tue Mar 18 18:03:52 2003
***************
*** 21,26 ****
--- 21,27 ----
  #define AFS_ENV			1
  #define AFS_USR_SUN5_ENV	1
  #define AFS_USR_SUN6_ENV	1
+ #define AFS_USR_SUN7_ENV	1
  
  #include <afs/afs_sysnames.h>
  
***************
*** 33,41 ****
  #define AFS_MOUNT_AFS	 1
  
  /* Machine / Operating system information */
! #define sys_sun4x_55	1
! #define SYS_NAME	"sun4x_55"
! #define SYS_NAME_ID	SYS_NAME_ID_sun4x_55
  #define AFSLITTLE_ENDIAN	1
  #define AFS_HAVE_FFS            1       /* Use system's ffs. */
  #define AFS_HAVE_STATVFS      0       /* System doesn't support statvfs */
--- 34,42 ----
  #define AFS_MOUNT_AFS	 1
  
  /* Machine / Operating system information */
! #define sys_sunx86_57	1
! #define SYS_NAME	"sunx86_57"
! #define SYS_NAME_ID	SYS_NAME_ID_sunx86_57
  #define AFSLITTLE_ENDIAN	1
  #define AFS_HAVE_FFS            1       /* Use system's ffs. */
  #define AFS_HAVE_STATVFS      0       /* System doesn't support statvfs */
Index: openafs/src/config/param.sunx86_58_usr.h
diff -c openafs/src/config/param.sunx86_58_usr.h:1.2.2.1 openafs/src/config/param.sunx86_58_usr.h:1.2.2.2
*** openafs/src/config/param.sunx86_58_usr.h:1.2.2.1	Wed Jul 10 15:57:43 2002
--- openafs/src/config/param.sunx86_58_usr.h	Tue Mar 18 18:03:52 2003
***************
*** 21,26 ****
--- 21,28 ----
  #define AFS_ENV			1
  #define AFS_USR_SUN5_ENV	1
  #define AFS_USR_SUN6_ENV	1
+ #define AFS_USR_SUN7_ENV	1
+ #define AFS_USR_SUN8_ENV	1
  
  #include <afs/afs_sysnames.h>
  
***************
*** 33,41 ****
  #define AFS_MOUNT_AFS	 1
  
  /* Machine / Operating system information */
! #define sys_sun4x_55	1
! #define SYS_NAME	"sun4x_55"
! #define SYS_NAME_ID	SYS_NAME_ID_sun4x_55
  #define AFSLITTLE_ENDIAN	1
  #define AFS_HAVE_FFS            1       /* Use system's ffs. */
  #define AFS_HAVE_STATVFS      0       /* System doesn't support statvfs */
--- 35,43 ----
  #define AFS_MOUNT_AFS	 1
  
  /* Machine / Operating system information */
! #define sys_sunx86_58	1
! #define SYS_NAME	"sunx86_58"
! #define SYS_NAME_ID	SYS_NAME_ID_sunx86_58
  #define AFSLITTLE_ENDIAN	1
  #define AFS_HAVE_FFS            1       /* Use system's ffs. */
  #define AFS_HAVE_STATVFS      0       /* System doesn't support statvfs */
Index: openafs/src/config/param.sunx86_59.h
diff -c /dev/null openafs/src/config/param.sunx86_59.h:1.1.2.1
*** /dev/null	Fri Apr 11 14:43:53 2003
--- openafs/src/config/param.sunx86_59.h	Tue Mar 18 18:18:18 2003
***************
*** 0 ****
--- 1,123 ----
+ /*
+  * 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	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define AFS_VFS_ENV	1
+ /* Used only in vfsck code; is it needed any more???? */
+ 
+ #define AFS_VFSINCL_ENV	1	/* NOBODY uses this.... */
+ #define AFS_GREEDY43_ENV	1	/* Used only in rx/rx_user.c */
+ #define AFS_ENV			1
+ #define AFS_SUN_ENV		1
+ #define AFS_SUN5_ENV		1
+ #define	AFS_SUN52_ENV		1
+ #define	AFS_SUN53_ENV		1
+ #define	AFS_SUN54_ENV		1
+ #define	AFS_SUN55_ENV		1
+ #define	AFS_SUN56_ENV		1
+ #define AFS_SUN57_ENV		1
+ #define AFS_SUN58_ENV		1
+ #define AFS_SUN59_ENV		1
+ #define AFS_X86_ENV		1
+ 
+ #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 */
+ 
+ #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 */
+ 
+ #define	AFS_SYSCALL		65
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS	 "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_sunx86_59	1
+ #define SYS_NAME	"sunx86_59"
+ #define SYS_NAME_ID	SYS_NAME_ID_sunx86_59
+ #define AFSLITTLE_ENDIAN	1
+ #define AFS_HAVE_FFS    1       /* Use system's ffs. */
+ #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
+ #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY 1  /* use gettimeofday to implement rx clock */
+ 
+ #define NEARINODE_HINT  1   /* hint to ufs module to scatter inodes on disk*/
+ #define nearInodeHash(volid, hval) {                                 \
+                 unsigned char*  ts = (unsigned char*)&(volid)+sizeof(volid)-1;\
+                 for ( (hval)=0; ts >= (unsigned char*)&(volid); ts--){\
+                     (hval) *= 173;                      \
+                     (hval) += *ts;                      \
+                 }                                       \
+                 }
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef KERNEL
+ /* sun definitions here */
+ #define	AFS_UIOFMODE		1	/* Only in afs/afs_vnodeops.c (afs_ustrategy) */
+ #define	AFS_SYSVLOCK		1	/* sys v locking supported */
+ /*#define	AFS_USEBUFFERS	1*/
+ #define	afsio_iov		uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg		uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	osi_GetTime(x)	uniqtime(x)
+ 
+ /**
+   * These defines are for the 64 bit Solaris 7 port
+   * AFS_SYSCALL32 is used to protect the ILP32 syscall interface
+   * AFS_64BIT_ENV is for use of 64 bit inode numbers
+   */
+ #if defined(__sparcv9)
+ #define	AFS_SUN57_64BIT_ENV	1
+ #define AFS_64BIT_INO   	1
+ #endif
+ 
+ /**
+   * Solaris 7 64 bit has two versions of uniqtime. Since we consistently
+   * use 32 bit quantities for time in afs, we now use uniqtime32
+   */
+ #if defined(AFS_SUN57_64BIT_ENV)
+ #undef osi_GetTime
+ #define osi_GetTime(x)  uniqtime32(x)
+ #endif
+ 
+ 
+ 
+ #define	AFS_KALLOC(n)	kmem_alloc(n, KM_SLEEP)
+ #define AFS_KALLOC_NOSLEEP(n)   kmem_alloc(n, KM_NOSLEEP)
+ #define	AFS_KFREE	kmem_free
+ #define	VATTR_NULL	vattr_null
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
+ #endif /* KERNEL */
+ #define	AFS_DIRENT	
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ #define	ROOTINO		UFSROOTINO
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.sunx86_59_usr.h
diff -c /dev/null openafs/src/config/param.sunx86_59_usr.h:1.1.2.1
*** /dev/null	Fri Apr 11 14:43:53 2003
--- openafs/src/config/param.sunx86_59_usr.h	Tue Mar 18 18:18:18 2003
***************
*** 0 ****
--- 1,69 ----
+ /*
+  * 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	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define AFS_VFS_ENV	1
+ /* Used only in vfsck code; is it needed any more???? */
+ #define RXK_LISTENER_ENV	1
+ #define AFS_USERSPACE_IP_ADDR	1
+ #define AFS_GCPAGS		0       /* if nonzero, garbage collect PAGs */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_GREEDY43_ENV	1	/* Used only in rx/rx_user.c */
+ #define AFS_ENV			1
+ #define AFS_USR_SUN5_ENV	1
+ #define AFS_USR_SUN6_ENV	1
+ #define AFS_USR_SUN7_ENV	1
+ #define AFS_USR_SUN8_ENV	1
+ #define AFS_USR_SUN9_ENV	1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ /*#define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
+ 
+ #define	AFS_3DISPARES		1	/* Utilize the 3 available disk inode 'spares' */
+ #define	AFS_SYSCALL		65
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS	 1
+ 
+ /* Machine / Operating system information */
+ #define sys_sunx86_59	1
+ #define SYS_NAME	"sunx86_59"
+ #define SYS_NAME_ID	SYS_NAME_ID_sunx86_59
+ #define AFSLITTLE_ENDIAN	1
+ #define AFS_HAVE_FFS            1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS      0       /* System doesn't support statvfs */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef KERNEL
+ #define	AFS_UIOFMODE		1	/* Only in afs/afs_vnodeops.c (afs_ustrategy) */
+ #define	AFS_SYSVLOCK		1	/* sys v locking supported */
+ /*#define	AFS_USEBUFFERS	1*/
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ #endif /* KERNEL */
+ #define	AFS_DIRENT	
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ #define	ROOTINO		UFSROOTINO
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/export/cfgafs.c
diff -c openafs/src/export/cfgafs.c:1.4 openafs/src/export/cfgafs.c:1.4.4.1
*** openafs/src/export/cfgafs.c:1.4	Thu Jul 12 15:58:35 2001
--- openafs/src/export/cfgafs.c	Sat Jan 11 02:42:33 2003
***************
*** 13,20 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/export/cfgafs.c,v 1.4 2001/07/12 19:58:35 shadow Exp $");
  
  #include <stdio.h>
  #include <fcntl.h>
  #include <sys/types.h>
--- 13,21 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/export/cfgafs.c,v 1.4.4.1 2003/01/11 07:42:33 shadow Exp $");
  
+ #include <errno.h>
  #include <stdio.h>
  #include <fcntl.h>
  #include <sys/types.h>
***************
*** 26,32 ****
  #include <signal.h>
  
  extern char    *malloc(), *optarg;
! extern int	errno;
  extern int	sysconfig(int cmd, void *arg, int len);
  
  #include "AFS_component_version_number.c"
--- 27,33 ----
  #include <signal.h>
  
  extern char    *malloc(), *optarg;
! 
  extern int	sysconfig(int cmd, void *arg, int len);
  
  #include "AFS_component_version_number.c"
Index: openafs/src/export/cfgexport.c
diff -c openafs/src/export/cfgexport.c:1.5 openafs/src/export/cfgexport.c:1.5.2.1
*** openafs/src/export/cfgexport.c:1.5	Tue Aug  7 20:03:44 2001
--- openafs/src/export/cfgexport.c	Sat Jan 11 02:42:33 2003
***************
*** 13,20 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/export/cfgexport.c,v 1.5 2001/08/08 00:03:44 shadow Exp $");
  
  #include <stdio.h>
  #include <fcntl.h>
  #include <sys/types.h>
--- 13,21 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/export/cfgexport.c,v 1.5.2.1 2003/01/11 07:42:33 shadow Exp $");
  
+ #include <errno.h>
  #include <stdio.h>
  #include <fcntl.h>
  #include <sys/types.h>
***************
*** 29,35 ****
  #include "sym.h"
  
  extern char    *malloc(), *optarg;
- extern int	errno;
  extern int	sysconfig(int cmd, void *arg, int len);
  
  int debug;
--- 30,35 ----
Index: openafs/src/fsint/afscbint.xg
diff -c openafs/src/fsint/afscbint.xg:1.2 openafs/src/fsint/afscbint.xg:1.2.8.1
*** openafs/src/fsint/afscbint.xg:1.2	Sat Nov  4 05:04:30 2000
--- openafs/src/fsint/afscbint.xg	Thu Mar  6 09:53:38 2003
***************
*** 96,98 ****
--- 96,104 ----
    OUT cacheConfig *config
  ) = 218;
  
+ proc GetCellByNum(
+   IN  afs_int32 cellNumber,
+   OUT string cellName<AFSNAMEMAX>,
+   OUT serverList *cellHosts
+ ) = 65537;
+ 
Index: openafs/src/fsprobe/fsprobe_callback.c
diff -c openafs/src/fsprobe/fsprobe_callback.c:1.4.4.1 openafs/src/fsprobe/fsprobe_callback.c:1.4.4.2
*** openafs/src/fsprobe/fsprobe_callback.c:1.4.4.1	Sat Apr 20 23:52:13 2002
--- openafs/src/fsprobe/fsprobe_callback.c	Thu Mar  6 09:53:40 2003
***************
*** 24,30 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/fsprobe/fsprobe_callback.c,v 1.4.4.1 2002/04/21 03:52:13 zacheiss Exp $");
  
  #include <errno.h>
  #include <stdio.h>			/*Standard I/O stuff*/
--- 24,30 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/fsprobe/fsprobe_callback.c,v 1.4.4.2 2003/03/06 14:53:40 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>			/*Standard I/O stuff*/
***************
*** 640,645 ****
--- 640,654 ----
  int SRXAFSCB_GetCellServDB(
      struct rx_call *a_call,
      afs_int32 a_index,
+     char **a_name,
+     serverList *a_hosts)
+ {
+     return RXGEN_OPCODE;
+ }
+ 
+ afs_int32 SRXAFSCB_GetCellByNum(
+     struct rx_call *a_call,
+     afs_int32 a_cellnum,
      char **a_name,
      serverList *a_hosts)
  {
Index: openafs/src/gtx/curseswindows.c
diff -c openafs/src/gtx/curseswindows.c:1.5.4.1 openafs/src/gtx/curseswindows.c:1.5.4.2
*** openafs/src/gtx/curseswindows.c:1.5.4.1	Wed Aug 21 16:53:25 2002
--- openafs/src/gtx/curseswindows.c	Sat Jan 11 02:42:34 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/gtx/curseswindows.c,v 1.5.4.1 2002/08/21 20:53:25 shadow Exp $");
  
  
  #if defined(AFS_HPUX110_ENV) && !defined(__HP_CURSES)
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/gtx/curseswindows.c,v 1.5.4.2 2003/01/11 07:42:34 shadow Exp $");
  
  
  #if defined(AFS_HPUX110_ENV) && !defined(__HP_CURSES)
***************
*** 41,47 ****
  #include "gtxobjects.h"
  #include "gtxframe.h"
  
! extern int errno;               /* everybody else puts it in errno.h */
  
  int curses_debug;			    /*Is debugging turned on?*/
  static char mn[] = "gator_curseswindows";   /*Module name*/
--- 41,47 ----
  #include "gtxobjects.h"
  #include "gtxframe.h"
  
! 
  
  int curses_debug;			    /*Is debugging turned on?*/
  static char mn[] = "gator_curseswindows";   /*Module name*/
Index: openafs/src/gtx/dumbwindows.c
diff -c openafs/src/gtx/dumbwindows.c:1.4 openafs/src/gtx/dumbwindows.c:1.4.4.1
*** openafs/src/gtx/dumbwindows.c:1.4	Thu Jul 12 15:58:39 2001
--- openafs/src/gtx/dumbwindows.c	Sat Jan 11 02:42:34 2003
***************
*** 16,29 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/gtx/dumbwindows.c,v 1.4 2001/07/12 19:58:39 shadow Exp $");
  
  #include "gtxdumbwin.h"			/*Interface definition*/
  #include <stdio.h>			/*Standard I/O package*/
  
- #if	!defined(NeXT)
- extern int errno;			/*System error number*/
- #endif /* NeXT */
  int dumb_debug;				/*Is debugging turned on?*/
  static char mn[] = "gator_dumbwindows";	/*Module name*/
  
--- 16,27 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/gtx/dumbwindows.c,v 1.4.4.1 2003/01/11 07:42:34 shadow Exp $");
  
  #include "gtxdumbwin.h"			/*Interface definition*/
  #include <stdio.h>			/*Standard I/O package*/
+ #include <errno.h>
  
  int dumb_debug;				/*Is debugging turned on?*/
  static char mn[] = "gator_dumbwindows";	/*Module name*/
  
Index: openafs/src/gtx/object_test.c
diff -c openafs/src/gtx/object_test.c:1.4 openafs/src/gtx/object_test.c:1.4.4.1
*** openafs/src/gtx/object_test.c:1.4	Thu Jul 12 15:58:39 2001
--- openafs/src/gtx/object_test.c	Sat Jan 11 02:42:34 2003
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/gtx/object_test.c,v 1.4 2001/07/12 19:58:39 shadow Exp $");
  
  #include "gtxscreenobj.h"     /*Gator screen object interface*/
  #include "gtxtextobj.h"       /*Gator text object interface*/
--- 14,20 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/gtx/object_test.c,v 1.4.4.1 2003/01/11 07:42:34 shadow Exp $");
  
  #include "gtxscreenobj.h"     /*Gator screen object interface*/
  #include "gtxtextobj.h"       /*Gator text object interface*/
***************
*** 23,32 ****
  #include "gtxcurseswin.h"    /*Gator curses window package*/
  #include "gtxdumbwin.h"      /*Gator dumb terminal window package*/
  #include "gtxX11win.h"       /*Gator X11 window package*/
  #include <stdio.h>                  /*Standard I/O stuff*/
  #include <cmd.h>		    /*Command interpretation library*/
  
- extern int errno;
  
  /*
   * Command line parameter indicies.
--- 23,32 ----
  #include "gtxcurseswin.h"    /*Gator curses window package*/
  #include "gtxdumbwin.h"      /*Gator dumb terminal window package*/
  #include "gtxX11win.h"       /*Gator X11 window package*/
+ #include <errno.h>
  #include <stdio.h>                  /*Standard I/O stuff*/
  #include <cmd.h>		    /*Command interpretation library*/
  
  
  /*
   * Command line parameter indicies.
Index: openafs/src/gtx/screen_test.c
diff -c openafs/src/gtx/screen_test.c:1.4 openafs/src/gtx/screen_test.c:1.4.4.1
*** openafs/src/gtx/screen_test.c:1.4	Thu Jul 12 15:58:39 2001
--- openafs/src/gtx/screen_test.c	Sat Jan 11 02:42:34 2003
***************
*** 14,28 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/gtx/screen_test.c,v 1.4 2001/07/12 19:58:39 shadow Exp $");
  
  #include "gtxwindows.h"	    /*Generalized window interface*/
  #include "gtxcurseswin.h"    /*Curses window interface*/
  #include "gtxdumbwin.h"	    /*Dumb terminal window interface*/
  #include "gtxX11win.h"	    /*X11 window interface*/
  #include <cmd.h>		    /*Command interpretation library*/
  
- extern int errno;
  
  /*
   * Command line parameter indicies.
--- 14,28 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/gtx/screen_test.c,v 1.4.4.1 2003/01/11 07:42:34 shadow Exp $");
  
  #include "gtxwindows.h"	    /*Generalized window interface*/
  #include "gtxcurseswin.h"    /*Curses window interface*/
  #include "gtxdumbwin.h"	    /*Dumb terminal window interface*/
  #include "gtxX11win.h"	    /*X11 window interface*/
  #include <cmd.h>		    /*Command interpretation library*/
+ #include <errno.h>
  
  
  /*
   * Command line parameter indicies.
Index: openafs/src/inetd/Makefile.in
diff -c openafs/src/inetd/Makefile.in:1.5 openafs/src/inetd/Makefile.in:1.5.2.1
*** openafs/src/inetd/Makefile.in:1.5	Fri Sep  7 20:08:27 2001
--- openafs/src/inetd/Makefile.in	Tue Mar 18 18:03:54 2003
***************
*** 63,69 ****
  dest: ${DEST}/etc/inetd
  	set -x; \
  	case "${SYS_NAME}" in \
! 	sun4* ) \
  		${INSTALL} -m 644 -f inetd.conf.solaris ${DEST}/etc/inetd.conf ;; \
  	sgi_* ) \
  		${INSTALL} -m 644 -f inetd.conf.sgi ${DEST}/etc/inetd.conf ;; \
--- 63,69 ----
  dest: ${DEST}/etc/inetd
  	set -x; \
  	case "${SYS_NAME}" in \
! 	sun* ) \
  		${INSTALL} -m 644 -f inetd.conf.solaris ${DEST}/etc/inetd.conf ;; \
  	sgi_* ) \
  		${INSTALL} -m 644 -f inetd.conf.sgi ${DEST}/etc/inetd.conf ;; \
Index: openafs/src/kauth/kaprocs.c
diff -c openafs/src/kauth/kaprocs.c:1.8.2.3 openafs/src/kauth/kaprocs.c:1.8.2.4
*** openafs/src/kauth/kaprocs.c:1.8.2.3	Sun Apr 21 00:01:48 2002
--- openafs/src/kauth/kaprocs.c	Mon Mar 17 22:56:57 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaprocs.c,v 1.8.2.3 2002/04/21 04:01:48 zacheiss Exp $");
  
  #include <afs/stds.h>
  #include <errno.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaprocs.c,v 1.8.2.4 2003/03/18 03:56:57 shadow Exp $");
  
  #include <afs/stds.h>
  #include <errno.h>
***************
*** 1706,1711 ****
--- 1706,1716 ----
      celllen = strlen (cell);
      if (import && (celllen == 0)) {code = KABADTICKET; goto abort;}
      if (export && (celllen == 0)) strcpy (cell, lrealm);
+ 
+     if (!krb4_cross && celllen && strcmp(lrealm, cell) != 0) {
+       code = KABADUSER;
+       goto abort;
+     }
  
      des_ecb_encrypt (atimes->SeqBody, &times, schedule, DECRYPT);
      times.start = ntohl(times.start);
Index: openafs/src/kauth/kaserver.c
diff -c openafs/src/kauth/kaserver.c:1.9.2.3 openafs/src/kauth/kaserver.c:1.9.2.4
*** openafs/src/kauth/kaserver.c:1.9.2.3	Sun Apr 21 00:14:55 2002
--- openafs/src/kauth/kaserver.c	Mon Mar 17 22:56:57 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaserver.c,v 1.9.2.3 2002/04/21 04:14:55 zacheiss Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/kaserver.c,v 1.9.2.4 2003/03/18 03:56:57 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 56,61 ****
--- 56,63 ----
  struct ubik_dbase *KA_dbase;
  afs_int32 myHost = 0;
  afs_int32 verbose_track = 1;
+ afs_int32 krb4_cross = 0;
+ 
  struct afsconf_dir *KA_conf;		/* for getting cell info */
  
  extern afs_int32 ubik_lastYesTime;
***************
*** 194,199 ****
--- 196,202 ----
        usage:
          printf("Usage: kaserver [-noAuth] [-fastKeys] [-database <dbpath>] "
  	       "[-localfiles <lclpath>] [-minhours <n>] [-servers <serverlist>] "
+ 	       "[-crossrealm]"
  	       /*" [-enable_peer_stats] [-enable_process_stats] " */
  	       "[-help]\n");
  	exit(1);
***************
*** 251,256 ****
--- 254,260 ----
  	else if (IsArg("-clear")) level = rxkad_clear;
  	else if (IsArg("-sorry")) level = rxkad_clear;
  	else if (IsArg("-debug")) verbose_track = 0;
+ 	else if (IsArg("-crossrealm")) krb4_cross = 1;
  	else if (IsArg("-minhours")) {
               MinHours = atoi(argv[++a]);
          }
Index: openafs/src/kauth/kaserver.h
diff -c openafs/src/kauth/kaserver.h:1.2 openafs/src/kauth/kaserver.h:1.2.8.2
*** openafs/src/kauth/kaserver.h:1.2	Sat Nov  4 05:04:39 2000
--- openafs/src/kauth/kaserver.h	Wed Mar 19 07:52:36 2003
***************
*** 179,184 ****
--- 179,185 ----
    u_int   locktime
  );
  
+ extern afs_int32 krb4_cross;
  
  #define LOCKPW
  
Index: openafs/src/kauth/krb_udp.c
diff -c openafs/src/kauth/krb_udp.c:1.14.2.5 openafs/src/kauth/krb_udp.c:1.14.2.6
*** openafs/src/kauth/krb_udp.c:1.14.2.5	Tue Sep 10 18:33:49 2002
--- openafs/src/kauth/krb_udp.c	Mon Mar 17 22:56:58 2003
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/krb_udp.c,v 1.14.2.5 2002/09/10 22:33:49 zacheiss Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 15,21 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/kauth/krb_udp.c,v 1.14.2.6 2003/03/18 03:56:58 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 461,466 ****
--- 461,471 ----
  	strncpy (cell, lrealm, MAXKTCREALMLEN-1);
  	cell[MAXKTCREALMLEN-1] = 0;
      };
+ 
+     if (!krb4_cross && strcmp(lrealm, cell) != 0) {
+ 	code = KERB_ERR_PRINCIPAL_UNKNOWN;
+ 	goto abort;
+     }
  
      if (krb_udp_debug) {
  	printf ("UGetTicket: got ticket from '%s'.'%s'@'%s'\n",
Index: openafs/src/libacl/aclprocs.c
diff -c openafs/src/libacl/aclprocs.c:1.9.2.2 openafs/src/libacl/aclprocs.c:1.9.2.3
*** openafs/src/libacl/aclprocs.c:1.9.2.2	Sat Oct 13 00:21:36 2001
--- openafs/src/libacl/aclprocs.c	Fri Mar 14 14:49:02 2003
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/libacl/aclprocs.c,v 1.9.2.2 2001/10/13 04:21:36 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 16,22 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/libacl/aclprocs.c,v 1.9.2.3 2003/03/14 19:49:02 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 29,35 ****
  #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
! #include <ptclient.h>
  #include "acl.h"
  
  #ifdef AFS_PTHREAD_ENV
--- 29,35 ----
  #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
! #include <afs/ptclient.h>
  #include "acl.h"
  
  #ifdef AFS_PTHREAD_ENV
Index: openafs/src/libacl/netprocs.c
diff -c openafs/src/libacl/netprocs.c:1.4 openafs/src/libacl/netprocs.c:1.4.4.1
*** openafs/src/libacl/netprocs.c:1.4	Thu Jul 12 15:58:41 2001
--- openafs/src/libacl/netprocs.c	Fri Mar 14 14:49:02 2003
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/libacl/netprocs.c,v 1.4 2001/07/12 19:58:41 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 16,22 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/libacl/netprocs.c,v 1.4.4.1 2003/03/14 19:49:02 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 26,32 ****
  #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
! #include <ptclient.h>
  #include "acl.h"
  
  int acl_HtonACL(acl)
--- 26,32 ----
  #endif
  #include <rx/xdr.h>
  #include <rx/rx.h>
! #include <afs/ptclient.h>
  #include "acl.h"
  
  int acl_HtonACL(acl)
Index: openafs/src/libafs/MakefileProto.SOLARIS.in
diff -c openafs/src/libafs/MakefileProto.SOLARIS.in:1.10.2.3 openafs/src/libafs/MakefileProto.SOLARIS.in:1.10.2.5
*** openafs/src/libafs/MakefileProto.SOLARIS.in:1.10.2.3	Thu Nov 14 16:34:02 2002
--- openafs/src/libafs/MakefileProto.SOLARIS.in	Fri Jan 17 01:12:29 2003
***************
*** 51,77 ****
  KDEFS= -Dsun4c -DSUN4C_60 -DNFSCLIENT -DSYSACCT -DOLDSCSI -DVDDRV -D_KERNEL \
  	-DSYSV -dn ${ARCH_DEFS}
  
! <sun4x_57 sun4x_58 sun4x_59>
  KDEFS_32 = 
  KDEFS_64 = -xarch=v9
  
  <all>
  CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
  
  # Name of directory to hold object files and libraries.
! <all -sun4x_57 -sun4x_58 -sun4x_59>
  KOBJ = MODLOAD
  <sun4x_57 sun4x_58 sun4x_59>
  KOBJ = MODLOAD32 MODLOAD64
  
  
  # This tells Makefile.common to use it's single directory build target.
! <all -sun4x_57 -sun4x_58 -sun4x_59>
  COMPDIRS = single_compdir
  INSTDIRS = single_instdir
  DESTDIRS = single_destdir
  
! <sun4x_57 sun4x_58 sun4x_59>
  COMPDIRS = solaris_compdirs
  INSTDIRS = solaris_instdirs
  DESTDIRS = solaris_destdirs
--- 51,80 ----
  KDEFS= -Dsun4c -DSUN4C_60 -DNFSCLIENT -DSYSACCT -DOLDSCSI -DVDDRV -D_KERNEL \
  	-DSYSV -dn ${ARCH_DEFS}
  
! <sun4x_57 sun4x_58 sun4x_59 sunx86_57 sunx86_58 sunx86_59>
  KDEFS_32 = 
+ <sun4x_57 sun4x_58 sun4x_59>
  KDEFS_64 = -xarch=v9
  
  <all>
  CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
  
  # Name of directory to hold object files and libraries.
! <all -sun4x_57 -sun4x_58 -sun4x_59 -sunx86_57 -sunx86_58 -sunx86_59>
  KOBJ = MODLOAD
  <sun4x_57 sun4x_58 sun4x_59>
  KOBJ = MODLOAD32 MODLOAD64
+ <sunx86_57 sunx86_58 sunx86_59>
+ KOBJ = MODLOAD32
  
  
  # This tells Makefile.common to use it's single directory build target.
! <all -sun4x_57 -sun4x_58 -sun4x_59 -sunx86_57 -sunx86_58 -sunx86_59>
  COMPDIRS = single_compdir
  INSTDIRS = single_instdir
  DESTDIRS = single_destdir
  
! <sun4x_57 sun4x_58 sun4x_59 sunx86_57 sunx86_58 sunx86_59>
  COMPDIRS = solaris_compdirs
  INSTDIRS = solaris_instdirs
  DESTDIRS = solaris_destdirs
***************
*** 103,109 ****
  ## This is the target for a Solaris 7. Here we build both the 32 bit and
  ## the 64 bit libafs in MODLOAD32 and MODLOAD64 directories respectively
  
! <sun4x_57 sun4x_58 sun4x_59>
  ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
  	for t in ${KOBJ} ; do \
  		echo Building directory: $$t ; \
--- 106,112 ----
  ## This is the target for a Solaris 7. Here we build both the 32 bit and
  ## the 64 bit libafs in MODLOAD32 and MODLOAD64 directories respectively
  
! <sun4x_57 sun4x_58 sun4x_59 sunx86_57 sunx86_58 sunx86_59>
  ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
  	for t in ${KOBJ} ; do \
  		echo Building directory: $$t ; \
***************
*** 132,144 ****
  LIBAFS = libafs.o
  LIBAFSNONFS = libafs.nonfs.o
  
! <all -sun4x_57 -sun4x_58 -sun4x_59>
  INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
  INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}
  
  DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS}
  DEST_LIBAFSNONFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFSNONFS}
  
  # Without this line, gmake tries to build libafs.o
  .PHONY: libafs
  
--- 135,160 ----
  LIBAFS = libafs.o
  LIBAFSNONFS = libafs.nonfs.o
  
! <all -sun4x_57 -sun4x_58 -sun4x_59 -sunx86_57 -sunx86_58 -sunx86_59>
  INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
  INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}
  
  DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS}
  DEST_LIBAFSNONFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFSNONFS}
  
+ <sun4x_57 sun4x_58 sun4x_59 sunx86_57 sunx86_58 sunx86_59>
+ 
+ libafs: ${LIBAFSNONFS} ${LIBAFS}
+ 
+ install_libafs: ${LIBAFSNONFS} ${LIBAFS}
+ 	${INSTALL} -f ${LIBAFSNONFS} ${DESTDIR}${afskerneldir}/libafs${BITS}.nonfs.o
+ 	${INSTALL} -f ${LIBAFS} ${DESTDIR}${afskerneldir}/libafs${BITS}.o
+ 
+ dest_libafs: ${LIBAFSNONFS} ${LIBAFS}
+ 	${INSTALL} -f ${LIBAFSNONFS} ${DEST}/root.client/usr/vice/etc/modload/libafs${BITS}.nonfs.o
+ 	${INSTALL} -f ${LIBAFS} ${DEST}/root.client/usr/vice/etc/modload/libafs${BITS}.o
+ 
+ <all>
  # Without this line, gmake tries to build libafs.o
  .PHONY: libafs
  
***************
*** 159,165 ****
  $(DEST_LIBAFSNONFS): $(LIBAFSNONFS)
  	${INSTALL} -f $? $@
  
- <all>
  ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
  	$(RM) -f $@
  	$(LD) -r -o $@ $(AFSAOBJS) ${AFSNFSOBJS}
--- 175,180 ----
***************
*** 167,184 ****
  ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
  	$(RM) -f $@
  	$(LD) -r -o $@  $(AFSAOBJS) ${AFSNONFSOBJS}
- 
- <sun4x_57 sun4x_58 sun4x_59>
- 
- libafs: ${LIBAFSNONFS} ${LIBAFS}
- 
- install_libafs: ${LIBAFSNONFS} ${LIBAFS}
- 	${INSTALL} -f ${LIBAFSNONFS} ${DESTDIR}${afskerneldir}/libafs${BITS}.nonfs.o
- 	${INSTALL} -f ${LIBAFS} ${DESTDIR}${afskerneldir}/libafs${BITS}.o
- 
- dest_libafs: ${LIBAFSNONFS} ${LIBAFS}
- 	${INSTALL} -f ${LIBAFSNONFS} ${DEST}/root.client/usr/vice/etc/modload/libafs${BITS}.nonfs.o
- 	${INSTALL} -f ${LIBAFS} ${DEST}/root.client/usr/vice/etc/modload/libafs${BITS}.o
  
  <all>
  
--- 182,187 ----
Index: openafs/src/libafsrpc/afsrpc.def
diff -c openafs/src/libafsrpc/afsrpc.def:1.2 openafs/src/libafsrpc/afsrpc.def:1.2.4.1
*** openafs/src/libafsrpc/afsrpc.def:1.2	Thu Mar 29 23:10:59 2001
--- openafs/src/libafsrpc/afsrpc.def	Fri Mar 14 15:30:37 2003
***************
*** 198,200 ****
--- 198,201 ----
  	rx_enable_hot_thread			@203 DATA
  	xdr_int64				@204
  	xdr_uint64				@205
+ 	osi_AssertFailU				@206
Index: openafs/src/lwp/Makefile.in
diff -c openafs/src/lwp/Makefile.in:1.4.2.1 openafs/src/lwp/Makefile.in:1.4.2.2
*** openafs/src/lwp/Makefile.in:1.4.2.1	Wed Sep 19 18:25:25 2001
--- openafs/src/lwp/Makefile.in	Tue Mar 18 18:03:50 2003
***************
*** 55,61 ****
  	@case "$(SYS_NAME)" in \
  	pmax_he1) \
  		$(CC) -c -I${TOP_INCDIR} process.s;; \
! 	sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53  | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5? | sunx86_54) \
  		/usr/ccs/lib/cpp -P -I${TOP_INCDIR} process.s process.ss; \
  		${AS} process.ss -o process.o; \
  			$(RM) process.ss ;; \
--- 55,61 ----
  	@case "$(SYS_NAME)" in \
  	pmax_he1) \
  		$(CC) -c -I${TOP_INCDIR} process.s;; \
! 	sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53  | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5? | sunx86_5? | ncrx86_*) \
  		/usr/ccs/lib/cpp -P -I${TOP_INCDIR} process.s process.ss; \
  		${AS} process.ss -o process.o; \
  			$(RM) process.ss ;; \
***************
*** 75,84 ****
  		$(RM) process.ss ;; \
  	hp* | *_linux* | sgi_64 | sgi_65 ) \
  		${CC} ${CFLAGS} -c process.c;; \
- 	ncrx86_*) \
- 		/usr/ccs/lib/cpp -P -I${TOP_INCDIR} process.s process.ss; \
- 		${AS} -o process.o process.ss; \
- 		$(RM) process.ss ;; \
  	alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \
  		${AS} -v  -P -DOSF -I${TOP_INCDIR} -DASSEMBLER process.s; \
  		${AS} -v process.i -o process.o;; \
--- 75,80 ----
Index: openafs/src/lwp/test/selclient.c
diff -c openafs/src/lwp/test/selclient.c:1.4 openafs/src/lwp/test/selclient.c:1.4.4.1
*** openafs/src/lwp/test/selclient.c:1.4	Thu Jul 12 15:58:49 2001
--- openafs/src/lwp/test/selclient.c	Mon Feb  3 18:33:33 2003
***************
*** 41,47 ****
  #include <sys/select.h>
  #include <sys/types.h>
  #include <sys/socket.h>
! #include <bstring.h>
  #include <sys/time.h>
  #include <netinet/in.h>
  #include <netdb.h>
--- 41,47 ----
  #include <sys/select.h>
  #include <sys/types.h>
  #include <sys/socket.h>
! #include <string.h>
  #include <sys/time.h>
  #include <netinet/in.h>
  #include <netdb.h>
***************
*** 53,59 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/test/selclient.c,v 1.4 2001/07/12 19:58:49 shadow Exp $");
  
  
  #include "../lwp.h"
--- 53,59 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/test/selclient.c,v 1.4.4.1 2003/02/03 23:33:33 shadow Exp $");
  
  
  #include "../lwp.h"
***************
*** 181,186 ****
--- 181,191 ----
      }
      if (port == -1) {
  	printf("%s: Missing port.\n", program);
+ 	Usage();
+     }
+ 
+     if (writeSize == 0 && doEnd ==0 && putOOB == 0) {
+ 	printf("%s: Missing action.\n", program);
  	Usage();
      }
  
Index: openafs/src/lwp/test/selserver.c
diff -c openafs/src/lwp/test/selserver.c:1.4 openafs/src/lwp/test/selserver.c:1.4.4.1
*** openafs/src/lwp/test/selserver.c:1.4	Thu Jul 12 15:58:49 2001
--- openafs/src/lwp/test/selserver.c	Mon Feb  3 18:33:33 2003
***************
*** 42,48 ****
  #include <sys/select.h>
  #include <sys/types.h>
  #include <sys/socket.h>
! #include <bstring.h>
  #include <sys/time.h>
  #include <netinet/in.h>
  #include <netdb.h>
--- 42,48 ----
  #include <sys/select.h>
  #include <sys/types.h>
  #include <sys/socket.h>
! #include <string.h>
  #include <sys/time.h>
  #include <netinet/in.h>
  #include <netdb.h>
***************
*** 54,60 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/test/selserver.c,v 1.4 2001/07/12 19:58:49 shadow Exp $");
  
  
  #include "../lwp.h"
--- 54,60 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/test/selserver.c,v 1.4.4.1 2003/02/03 23:33:33 shadow Exp $");
  
  
  #include "../lwp.h"
Index: openafs/src/lwp/test/selsubs.c
diff -c openafs/src/lwp/test/selsubs.c:1.5 openafs/src/lwp/test/selsubs.c:1.5.2.1
*** openafs/src/lwp/test/selsubs.c:1.5	Tue Aug  7 20:03:52 2001
--- openafs/src/lwp/test/selsubs.c	Mon Feb  3 18:33:33 2003
***************
*** 16,22 ****
  #include <sys/select.h>
  #include <sys/types.h>
  #include <sys/socket.h>
! #include <bstring.h>
  #include <sys/time.h>
  #include <netinet/in.h>
  #include <netdb.h>
--- 16,22 ----
  #include <sys/select.h>
  #include <sys/types.h>
  #include <sys/socket.h>
! #include <string.h>
  #include <sys/time.h>
  #include <netinet/in.h>
  #include <netdb.h>
***************
*** 28,34 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/test/selsubs.c,v 1.5 2001/08/08 00:03:52 shadow Exp $");
  
  
  #include "../lwp.h"
--- 28,34 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/lwp/test/selsubs.c,v 1.5.2.1 2003/02/03 23:33:33 shadow Exp $");
  
  
  #include "../lwp.h"
***************
*** 141,152 ****
  {
      va_list args;
      struct timeval now;
      struct tm *ltime;
      int code;
      PROCESS pid;
      extern char *program;
      
!     code = gettimeofday(&now);
      assert (code == 0);
  
      ltime = localtime((time_t*)&now.tv_sec);
--- 141,153 ----
  {
      va_list args;
      struct timeval now;
+     struct timezone tz;
      struct tm *ltime;
      int code;
      PROCESS pid;
      extern char *program;
      
!     code = gettimeofday(&now,&tz);
      assert (code == 0);
  
      ltime = localtime((time_t*)&now.tv_sec);
Index: openafs/src/package/fileops.c
diff -c openafs/src/package/fileops.c:1.1 openafs/src/package/fileops.c:1.1.12.1
*** openafs/src/package/fileops.c:1.1	Fri Nov  3 21:28:30 2000
--- openafs/src/package/fileops.c	Sat Jan 11 02:42:34 2003
***************
*** 27,32 ****
--- 27,39 ----
  #include <sys/stat.h>
  #include <sys/file.h>
  #include <dirent.h>
+ #ifdef HAVE_STRING_H
+ #include <string.h>
+ #else
+ #ifdef HAVE_STRINGS_H
+ #include <strings.h>
+ #endif
+ #endif
  #include <errno.h>
  #ifdef	AFS_SUN5_ENV
  #include <sys/fcntl.h>
***************
*** 34,41 ****
  #include "globals.h"
  #include "package.h"
  
- extern char *strcpy();
- extern int errno;
  
  int mv(from,to)
  register char *from;
--- 41,46 ----
Index: openafs/src/package/messages.c
diff -c openafs/src/package/messages.c:1.1 openafs/src/package/messages.c:1.1.12.1
*** openafs/src/package/messages.c:1.1	Fri Nov  3 21:28:31 2000
--- openafs/src/package/messages.c	Sat Jan 11 02:42:34 2003
***************
*** 29,34 ****
--- 29,36 ----
  #endif
  #include <varargs.h>
  #include "package.h"
+ #include <errno.h>
+ 
  
  static char *putnum(dp, n, b)
      register char *dp;
***************
*** 98,104 ****
  	  }
  	case 'm':
  	  {
- 	    extern int errno;
  	    extern int sys_nerr;
  	    extern char *sys_errlist[];
  
--- 100,105 ----
Index: openafs/src/pam/Makefile.in
diff -c openafs/src/pam/Makefile.in:1.5.2.3 openafs/src/pam/Makefile.in:1.5.2.4
*** openafs/src/pam/Makefile.in:1.5.2.3	Tue Sep 10 01:03:42 2002
--- openafs/src/pam/Makefile.in	Wed Jan 22 12:12:13 2003
***************
*** 43,50 ****
   SHOBJS = afs_account.o afs_session.o afs_password.o \
  	  afs_pam_msg.o afs_message.o AFS_component_version_number.o
     OBJS = $(SHOBJS) test_pam.o
! INCLUDES=-I${TOP_SRCDIR}/config -I${TOP_INCDIR} \
! 	-I/usr/include -I/usr/include/sys
  CFLAGS =  ${DEBUG} ${INCLUDES} ${PAM_CFLAGS}
  
  all: test_pam ${TOP_LIBDIR}/pam_afs.so.1 ${TOP_LIBDIR}/pam_afs.krb.so.1
--- 43,49 ----
   SHOBJS = afs_account.o afs_session.o afs_password.o \
  	  afs_pam_msg.o afs_message.o AFS_component_version_number.o
     OBJS = $(SHOBJS) test_pam.o
! INCLUDES=-I${TOP_SRCDIR}/config -I${TOP_INCDIR}
  CFLAGS =  ${DEBUG} ${INCLUDES} ${PAM_CFLAGS}
  
  all: test_pam ${TOP_LIBDIR}/pam_afs.so.1 ${TOP_LIBDIR}/pam_afs.krb.so.1
Index: openafs/src/pinstall/install.c
diff -c openafs/src/pinstall/install.c:1.9.2.4 openafs/src/pinstall/install.c:1.9.2.5
*** openafs/src/pinstall/install.c:1.9.2.4	Wed Aug 21 16:53:27 2002
--- openafs/src/pinstall/install.c	Sat Jan 11 02:42:35 2003
***************
*** 49,55 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/pinstall/install.c,v 1.9.2.4 2002/08/21 20:53:27 shadow Exp $");
  
  #include <stdio.h>
  #include <pwd.h>
--- 49,55 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/pinstall/install.c,v 1.9.2.5 2003/01/11 07:42:35 shadow Exp $");
  
  #include <stdio.h>
  #include <pwd.h>
***************
*** 85,91 ****
  
  struct stat istat, ostat;
  
- extern int errno;
  #if !defined(AFS_DARWIN60_ENV)
  extern int sys_nerr;
  #endif
--- 85,90 ----
Index: openafs/src/ptserver/db_verify.c
diff -c openafs/src/ptserver/db_verify.c:1.6.2.3 openafs/src/ptserver/db_verify.c:1.6.2.4
*** openafs/src/ptserver/db_verify.c:1.6.2.3	Sat Oct 13 00:21:47 2001
--- openafs/src/ptserver/db_verify.c	Sat Jan 11 02:42:35 2003
***************
*** 7,18 ****
   * directory or online at http://www.openafs.org/dl/license10.html
   */
  
- extern int errno;
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/db_verify.c,v 1.6.2.3 2001/10/13 04:21:47 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 7,17 ----
   * directory or online at http://www.openafs.org/dl/license10.html
   */
  
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/db_verify.c,v 1.6.2.4 2003/01/11 07:42:35 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
Index: openafs/src/ptserver/pt_util.c
diff -c openafs/src/ptserver/pt_util.c:1.3.4.2 openafs/src/ptserver/pt_util.c:1.3.4.4
*** openafs/src/ptserver/pt_util.c:1.3.4.2	Sat Oct 13 00:21:47 2001
--- openafs/src/ptserver/pt_util.c	Sat Jan 11 02:53:30 2003
***************
*** 1,4 ****
! /* $Id: pt_util.c,v 1.3.4.2 2001/10/13 04:21:47 shadow Exp $ */
  
  /*
   *
--- 1,4 ----
! /* $Id: pt_util.c,v 1.3.4.4 2003/01/11 07:53:30 shadow Exp $ */
  
  /*
   *
***************
*** 16,28 ****
  #include <stdio.h>
  #include <ctype.h>
  #include <string.h>
  #include <sys/file.h>
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/pt_util.c,v 1.3.4.2 2001/10/13 04:21:47 shadow Exp $");
  
  #include <lock.h>
  #include <netinet/in.h>
  #define UBIK_INTERNALS
--- 16,30 ----
  #include <stdio.h>
  #include <ctype.h>
  #include <string.h>
+ #include <errno.h>
  #include <sys/file.h>
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ptserver/pt_util.c,v 1.3.4.4 2003/01/11 07:53:30 shadow Exp $");
  
+ #include <errno.h>
  #include <lock.h>
  #include <netinet/in.h>
  #define UBIK_INTERNALS
***************
*** 39,45 ****
  
  extern char *optarg;
  extern int optind;
- extern int errno;
  
  int display_entry();
  void add_group();
--- 41,46 ----
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.22.2.16 openafs/src/rx/rx.c:1.22.2.22
*** openafs/src/rx/rx.c:1.22.2.16	Thu Nov 14 17:19:50 2002
--- openafs/src/rx/rx.c	Fri Mar 14 14:49:04 2003
***************
*** 16,22 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx.c,v 1.22.2.16 2002/11/14 22:19:50 zacheiss Exp $");
  
  #ifdef KERNEL
  #include "../afs/sysincludes.h"
--- 16,22 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx.c,v 1.22.2.22 2003/03/14 19:49:04 shadow Exp $");
  
  #ifdef KERNEL
  #include "../afs/sysincludes.h"
***************
*** 79,85 ****
  #ifdef AFS_NT40_ENV
  # include <stdlib.h>
  # include <fcntl.h>
! # include <afsutil.h>
  #else
  # include <sys/socket.h>
  # include <sys/file.h>
--- 79,85 ----
  #ifdef AFS_NT40_ENV
  # include <stdlib.h>
  # include <fcntl.h>
! # include <afs/afsutil.h>
  #else
  # include <sys/socket.h>
  # include <sys/file.h>
***************
*** 143,148 ****
--- 143,149 ----
   * to ease NT porting
   */
  
+ extern pthread_mutex_t rx_stats_mutex;
  extern pthread_mutex_t rxkad_stats_mutex;
  extern pthread_mutex_t des_init_mutex;
  extern pthread_mutex_t des_random_mutex;
***************
*** 167,172 ****
--- 168,175 ----
  static void rxi_InitPthread(void) {
      assert(pthread_mutex_init(&rx_clock_mutex,
  			      (const pthread_mutexattr_t*)0)==0);
+     assert(pthread_mutex_init(&rx_stats_mutex,
+ 			      (const pthread_mutexattr_t*)0)==0);
      assert(pthread_mutex_init(&rxi_connCacheMutex,
  			      (const pthread_mutexattr_t*)0)==0);
      assert(pthread_mutex_init(&rx_init_mutex,
***************
*** 251,257 ****
   */
  
  #ifdef RX_ENABLE_LOCKS
- static int rxi_ServerThreadSelectingCall;
  static afs_kmutex_t rx_rpc_stats;
  void rxi_StartUnlocked();
  #endif
--- 254,259 ----
***************
*** 425,431 ****
  #ifndef KERNEL
      MUTEX_INIT(&rxi_keyCreate_lock, "rxi_keyCreate_lock", MUTEX_DEFAULT, 0);
  #endif /* !KERNEL */
-     CV_INIT(&rx_serverPool_cv, "rx_serverPool_cv",CV_DEFAULT, 0);
  #if defined(KERNEL) && defined(AFS_HPUX110_ENV)
      if ( !uniprocessor )
        rx_sleepLock = alloc_spinlock(LAST_HELD_ORDER-10, "rx_sleepLock");
--- 427,432 ----
***************
*** 1421,1427 ****
  osi_socket *socketp;
  {
      struct rx_serverQueueEntry *sq;
!     register struct rx_call *call = (struct rx_call *) 0, *choice2;
      struct rx_service *service = NULL;
      SPLVAR;
  
--- 1422,1428 ----
  osi_socket *socketp;
  {
      struct rx_serverQueueEntry *sq;
!     register struct rx_call *call = (struct rx_call *) 0;
      struct rx_service *service = NULL;
      SPLVAR;
  
***************
*** 1443,1450 ****
      }
      while (1) {
  	if (queue_IsNotEmpty(&rx_incomingCallQueue)) {
! 	    register struct rx_call *tcall, *ncall;
! 	    choice2 = (struct rx_call *) 0;
  	    /* Scan for eligible incoming calls.  A call is not eligible
  	     * if the maximum number of calls for its service type are
  	     * already executing */
--- 1444,1451 ----
      }
      while (1) {
  	if (queue_IsNotEmpty(&rx_incomingCallQueue)) {
! 	    register struct rx_call *tcall, *ncall, *choice2 = NULL;
! 
  	    /* Scan for eligible incoming calls.  A call is not eligible
  	     * if the maximum number of calls for its service type are
  	     * already executing */
***************
*** 1453,1518 ****
  	     * have all their input data available immediately.  This helps 
  	     * keep threads from blocking, waiting for data from the client. */
  	    for (queue_Scan(&rx_incomingCallQueue, tcall, ncall, rx_call)) {
! 	      service = tcall->conn->service;
! 	      if (!QuotaOK(service)) {
! 		continue;
! 	      }
! 	      if (!tno || !tcall->queue_item_header.next  ) {
! 		/* If we're thread 0, then  we'll just use 
! 		 * this call. If we haven't been able to find an optimal 
! 		 * choice, and we're at the end of the list, then use a 
! 		 * 2d choice if one has been identified.  Otherwise... */
! 		call = (choice2 ? choice2 : tcall);
! 		service = call->conn->service;
! 	      } else if (!queue_IsEmpty(&tcall->rq)) {
! 		struct rx_packet *rp;
! 		rp = queue_First(&tcall->rq, rx_packet);
! 		if (rp->header.seq == 1) {
! 		  if (!meltdown_1pkt || 	    
! 		      (rp->header.flags & RX_LAST_PACKET)) {
! 		    call = tcall;
! 		  } else if (rxi_2dchoice && !choice2 &&
! 			     !(tcall->flags & RX_CALL_CLEARED) &&
! 			     (tcall->rprev > rxi_HardAckRate)) {
! 		    choice2 = tcall;
! 		  } else rxi_md2cnt++;
  		}
- 	      }
- 	      if (call)  {
- 		break;
- 	      } else {
- 		  ReturnToServerPool(service);
- 	      }
  	    }
! 	  }
  
  	if (call) {
  	    queue_Remove(call);
- 	    rxi_ServerThreadSelectingCall = 1;
  	    MUTEX_EXIT(&rx_serverPool_lock);
  	    MUTEX_ENTER(&call->lock);
- 	    MUTEX_ENTER(&rx_serverPool_lock);
  
! 	    if (queue_IsEmpty(&call->rq) ||
! 		queue_First(&call->rq, rx_packet)->header.seq != 1)
! 	      rxi_SendAck(call, 0, 0, 0, 0, RX_ACK_DELAY, 0);
! 
! 	    CLEAR_CALL_QUEUE_LOCK(call);
! 	    if (call->error) {
  		MUTEX_EXIT(&call->lock);
  		ReturnToServerPool(service);
! 		rxi_ServerThreadSelectingCall = 0;
! 		CV_SIGNAL(&rx_serverPool_cv);
! 		call = (struct rx_call*)0;
  		continue;
  	    }
! 	    call->flags &= (~RX_CALL_WAIT_PROC);
  	    MUTEX_ENTER(&rx_stats_mutex);
  	    rx_nWaiting--;
  	    MUTEX_EXIT(&rx_stats_mutex);
- 	    rxi_ServerThreadSelectingCall = 0;
- 	    CV_SIGNAL(&rx_serverPool_cv);
- 	    MUTEX_EXIT(&rx_serverPool_lock);
  	    break;
  	}
  	else {
--- 1454,1514 ----
  	     * have all their input data available immediately.  This helps 
  	     * keep threads from blocking, waiting for data from the client. */
  	    for (queue_Scan(&rx_incomingCallQueue, tcall, ncall, rx_call)) {
! 		service = tcall->conn->service;
! 		if (!QuotaOK(service)) {
! 		    continue;
! 		}
! 		if (tno==rxi_fcfs_thread_num || !tcall->queue_item_header.next  ) {
! 		    /* If we're the fcfs thread , then  we'll just use 
! 		     * this call. If we haven't been able to find an optimal 
! 		     * choice, and we're at the end of the list, then use a 
! 		     * 2d choice if one has been identified.  Otherwise... */
! 		    call = (choice2 ? choice2 : tcall);
! 		    service = call->conn->service;
! 		} else if (!queue_IsEmpty(&tcall->rq)) {
! 		    struct rx_packet *rp;
! 		    rp = queue_First(&tcall->rq, rx_packet);
! 		    if (rp->header.seq == 1) {
! 			if (!meltdown_1pkt ||
! 			    (rp->header.flags & RX_LAST_PACKET)) {
! 			    call = tcall;
! 			} else if (rxi_2dchoice && !choice2 &&
! 				   !(tcall->flags & RX_CALL_CLEARED) &&
! 				   (tcall->rprev > rxi_HardAckRate)) {
! 			    choice2 = tcall;
! 			} else rxi_md2cnt++;
! 		    }
! 		}
! 		if (call) {
! 		    break;
! 		} else {
! 		    ReturnToServerPool(service);
  		}
  	    }
! 	}
  
  	if (call) {
  	    queue_Remove(call);
  	    MUTEX_EXIT(&rx_serverPool_lock);
  	    MUTEX_ENTER(&call->lock);
  
! 	    if (call->state != RX_STATE_PRECALL || call->error) {
  		MUTEX_EXIT(&call->lock);
+ 		MUTEX_ENTER(&rx_serverPool_lock);
  		ReturnToServerPool(service);
! 		call = NULL;
  		continue;
  	    }
! 
! 	    if (queue_IsEmpty(&call->rq) ||
! 		queue_First(&call->rq, rx_packet)->header.seq != 1)
! 		rxi_SendAck(call, 0, 0, 0, 0, RX_ACK_DELAY, 0);
! 
! 	    CLEAR_CALL_QUEUE_LOCK(call);
! 	    call->flags &= ~RX_CALL_WAIT_PROC;
  	    MUTEX_ENTER(&rx_stats_mutex);
  	    rx_nWaiting--;
  	    MUTEX_EXIT(&rx_stats_mutex);
  	    break;
  	}
  	else {
***************
*** 1615,1622 ****
  	for (queue_Scan(&rx_incomingCallQueue, tcall, ncall, rx_call)) {
  	  service = tcall->conn->service;
  	  if (QuotaOK(service)) {
! 	     if (!tno || !tcall->queue_item_header.next  ) {
! 		 /* If we're thread 0, then  we'll just use 
  		  * this call. If we haven't been able to find an optimal 
  		  * choice, and we're at the end of the list, then use a 
  		  * 2d choice if one has been identified.  Otherwise... */
--- 1611,1618 ----
  	for (queue_Scan(&rx_incomingCallQueue, tcall, ncall, rx_call)) {
  	  service = tcall->conn->service;
  	  if (QuotaOK(service)) {
! 	     if (tno==rxi_fcfs_thread_num || !tcall->queue_item_header.next  ) {
! 		 /* If we're the fcfs thread, then  we'll just use 
  		  * this call. If we haven't been able to find an optimal 
  		  * choice, and we're at the end of the list, then use a 
  		  * 2d choice if one has been identified.  Otherwise... */
***************
*** 3926,3948 ****
  {
      register struct rx_serverQueueEntry *sq;
      register struct rx_service *service = call->conn->service;
- #ifdef RX_ENABLE_LOCKS
      register int haveQuota = 0;
! #endif /* RX_ENABLE_LOCKS */
      /* May already be attached */
      if (call->state == RX_STATE_ACTIVE) return;
  
      MUTEX_ENTER(&rx_serverPool_lock);
- #ifdef RX_ENABLE_LOCKS
-     while(rxi_ServerThreadSelectingCall) {
- 	MUTEX_EXIT(&call->lock);
- 	CV_WAIT(&rx_serverPool_cv, &rx_serverPool_lock);
- 	MUTEX_EXIT(&rx_serverPool_lock);
- 	MUTEX_ENTER(&call->lock);
- 	MUTEX_ENTER(&rx_serverPool_lock);
- 	/* Call may have been attached */
- 	if (call->state == RX_STATE_ACTIVE) return;
-     }
  
      haveQuota = QuotaOK(service);
      if ((!haveQuota) || queue_IsEmpty(&rx_idleServerQueue)) {
--- 3922,3933 ----
  {
      register struct rx_serverQueueEntry *sq;
      register struct rx_service *service = call->conn->service;
      register int haveQuota = 0;
! 
      /* May already be attached */
      if (call->state == RX_STATE_ACTIVE) return;
  
      MUTEX_ENTER(&rx_serverPool_lock);
  
      haveQuota = QuotaOK(service);
      if ((!haveQuota) || queue_IsEmpty(&rx_idleServerQueue)) {
***************
*** 3950,3957 ****
--- 3935,3945 ----
           * put the call on the incoming call queue (unless it's
           * already on the queue).
           */
+ #ifdef RX_ENABLE_LOCKS
  	if (haveQuota)
  	    ReturnToServerPool(service);
+ #endif /* RX_ENABLE_LOCKS */
+ 
  	if (!(call->flags & RX_CALL_WAIT_PROC)) {
  	    call->flags |= RX_CALL_WAIT_PROC;
  	    MUTEX_ENTER(&rx_stats_mutex);
***************
*** 3962,3981 ****
  	    queue_Append(&rx_incomingCallQueue, call);
  	}
      }
- #else /* RX_ENABLE_LOCKS */
-     if (!QuotaOK(service) || queue_IsEmpty(&rx_idleServerQueue)) {
- 	/* If there are no processes available to service this call,
-          * put the call on the incoming call queue (unless it's
-          * already on the queue).
-          */
- 	if (!(call->flags & RX_CALL_WAIT_PROC)) {
- 	    call->flags |= RX_CALL_WAIT_PROC;
- 	    rx_nWaiting++;
- 	    rxi_calltrace(RX_CALL_ARRIVAL, call);
- 	    queue_Append(&rx_incomingCallQueue, call);
- 	}
-     }
- #endif /* RX_ENABLE_LOCKS */
      else {
  	sq = queue_First(&rx_idleServerQueue, rx_serverQueueEntry);
  
--- 3950,3955 ----
***************
*** 4741,4749 ****
      CALL_HOLD(call, RX_CALL_REFCOUNT_SEND);
      MUTEX_EXIT(&call->lock);
      if (len > 1) {
! 	rxi_SendPacketList(conn, list, len, istack);
      } else {
! 	rxi_SendPacket(conn, list[0], istack);
      }
      MUTEX_ENTER(&call->lock);
      CALL_RELE(call, RX_CALL_REFCOUNT_SEND);
--- 4715,4723 ----
      CALL_HOLD(call, RX_CALL_REFCOUNT_SEND);
      MUTEX_EXIT(&call->lock);
      if (len > 1) {
! 	rxi_SendPacketList(call, conn, list, len, istack);
      } else {
! 	rxi_SendPacket(call, conn, list[0], istack);
      }
      MUTEX_ENTER(&call->lock);
      CALL_RELE(call, RX_CALL_REFCOUNT_SEND);
***************
*** 5200,5206 ****
      /* Actually send the packet, filling in more connection-specific fields */
      CALL_HOLD(call, RX_CALL_REFCOUNT_SEND);
      MUTEX_EXIT(&call->lock);
!     rxi_SendPacket(conn, p, istack);
      MUTEX_ENTER(&call->lock);
      CALL_RELE(call, RX_CALL_REFCOUNT_SEND);
  
--- 5174,5180 ----
      /* Actually send the packet, filling in more connection-specific fields */
      CALL_HOLD(call, RX_CALL_REFCOUNT_SEND);
      MUTEX_EXIT(&call->lock);
!     rxi_SendPacket(call, conn, p, istack);
      MUTEX_ENTER(&call->lock);
      CALL_RELE(call, RX_CALL_REFCOUNT_SEND);
  
Index: openafs/src/rx/rx_globals.h
diff -c openafs/src/rx/rx_globals.h:1.3 openafs/src/rx/rx_globals.h:1.3.6.3
*** openafs/src/rx/rx_globals.h:1.3	Wed Dec 13 16:41:38 2000
--- openafs/src/rx/rx_globals.h	Mon Mar  3 10:58:30 2003
***************
*** 32,38 ****
  #ifdef RX_ENABLE_LOCKS
  /* Protects nRequestsRunning as well as pool allocation variables. */
  EXT afs_kmutex_t rx_serverPool_lock;
- EXT afs_kcondvar_t rx_serverPool_cv;
  #endif /* RX_ENABLE_LOCKS */
  
  /* Incoming calls wait on this queue when there are no available server processes */
--- 32,37 ----
***************
*** 374,380 ****
--- 373,385 ----
   */
  
  #if defined(AFS_PTHREAD_ENV)
+ EXT int rxi_fcfs_thread_num INIT(0);
  EXT pthread_key_t rx_thread_id_key;
+ /* keep track of pthread numbers - protected by rx_stats_mutex, 
+    except in rx_Init() before mutex exists! */
+ EXT int rxi_pthread_hinum INIT(0);
+ #else
+ #define rxi_fcfs_thread_num (0)
  #endif
  
  #if defined(RX_ENABLE_LOCKS)
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.9.2.10 openafs/src/rx/rx_kcommon.c:1.9.2.11
*** openafs/src/rx/rx_kcommon.c:1.9.2.10	Thu Nov 14 15:08:23 2002
--- openafs/src/rx/rx_kcommon.c	Sat Jan 11 02:48:58 2003
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_kcommon.c,v 1.9.2.10 2002/11/14 20:08:23 zacheiss Exp $");
  
  #include "../rx/rx_kcommon.h"
  
--- 14,20 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_kcommon.c,v 1.9.2.11 2003/01/11 07:48:58 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  
***************
*** 1024,1037 ****
  
  #ifdef AFS_SUN5_ENV
  /*
!  * Run the listener as a kernel process.
   */
  void rxk_Listener(void)
  {
      extern id_t syscid;
      void rxk_ListenerProc(void);
!     if (newproc(rxk_ListenerProc, syscid, 59))
! 	osi_Panic("rxk_Listener: failed to fork listener process!\n");
  }
  
  void rxk_ListenerProc(void)
--- 1024,1038 ----
  
  #ifdef AFS_SUN5_ENV
  /*
!  * Run the listener as a kernel thread.
   */
  void rxk_Listener(void)
  {
      extern id_t syscid;
      void rxk_ListenerProc(void);
!     if (thread_create(NULL, DEFAULTSTKSZ, rxk_ListenerProc,
! 	0, 0, &p0, TS_RUN, minclsyspri) == NULL)
! 	osi_Panic("rxk_Listener: failed to start listener thread!\n");
  }
  
  void rxk_ListenerProc(void)
***************
*** 1047,1053 ****
      rxk_ListenerPid = current->pid;
  #endif
  #ifdef AFS_SUN5_ENV
!     rxk_ListenerPid = ttoproc(curthread)->p_pidp->pid_id;
  #endif /* AFS_SUN5_ENV */
  #ifdef AFS_FBSD_ENV
      rxk_ListenerPid = curproc->p_pid;
--- 1048,1054 ----
      rxk_ListenerPid = current->pid;
  #endif
  #ifdef AFS_SUN5_ENV
!     rxk_ListenerPid = 1;      /* No PID, just a flag that we're alive */
  #endif /* AFS_SUN5_ENV */
  #ifdef AFS_FBSD_ENV
      rxk_ListenerPid = curproc->p_pid;
***************
*** 1091,1101 ****
  #endif
  #ifdef AFS_SUN5_ENV
      AFS_GUNLOCK();
- #ifdef HAVE_P_COREFILE
-     if (!curproc->p_corefile)  /* newproc doesn't set it, but exit frees it */
- 	curproc->p_corefile = refstr_alloc("core");
- #endif
-     exit(CLD_EXITED, 0);
  #endif /* AFS_SUN5_ENV */
  }
  
--- 1092,1097 ----
Index: openafs/src/rx/rx_kcommon.h
diff -c openafs/src/rx/rx_kcommon.h:1.4.4.6 openafs/src/rx/rx_kcommon.h:1.4.4.7
*** openafs/src/rx/rx_kcommon.h:1.4.4.6	Thu Nov 14 17:27:16 2002
--- openafs/src/rx/rx_kcommon.h	Sat Jan 11 02:48:58 2003
***************
*** 30,35 ****
--- 30,36 ----
  #include "../h/vfs.h"		/* stops SUN56 socketvar.h warnings */
  #include "../h/stropts.h"	/* stops SUN56 socketvar.h warnings */
  #include "../h/stream.h"	/* stops SUN56 socketvar.h errors */
+ #include "../h/disp.h"
  #endif
  #include "../h/socket.h"
  #ifndef AFS_LINUX22_ENV
Index: openafs/src/rx/rx_packet.c
diff -c openafs/src/rx/rx_packet.c:1.14.2.4 openafs/src/rx/rx_packet.c:1.14.2.5
*** openafs/src/rx/rx_packet.c:1.14.2.4	Tue Sep 10 18:33:55 2002
--- openafs/src/rx/rx_packet.c	Fri Jan 17 00:42:34 2003
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_packet.c,v 1.14.2.4 2002/09/10 22:33:55 zacheiss Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_packet.c,v 1.14.2.5 2003/01/17 05:42:34 shadow Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
***************
*** 1471,1484 ****
  }
  
  /* Send the packet to appropriate destination for the specified
!  * connection.  The header is first encoded and placed in the packet.
   */
! void rxi_SendPacket(struct rx_connection * conn, struct rx_packet *p,
! 		    int istack)
  {
  #if defined(KERNEL)
      int waslocked;
  #endif
      struct sockaddr_in addr;
      register struct rx_peer *peer = conn->peer;
      osi_socket socket;
--- 1471,1485 ----
  }
  
  /* Send the packet to appropriate destination for the specified
!  * call.  The header is first encoded and placed in the packet.
   */
! void rxi_SendPacket(struct rx_call * call, struct rx_connection * conn,
! 		    struct rx_packet *p, int istack)
  {
  #if defined(KERNEL)
      int waslocked;
  #endif
+     int code;
      struct sockaddr_in addr;
      register struct rx_peer *peer = conn->peer;
      osi_socket socket;
***************
*** 1550,1563 ****
  	waslocked = ISAFS_GLOCK();
  	if (waslocked) AFS_GUNLOCK();
  #endif
! 	if (osi_NetSend(socket, &addr, p->wirevec, p->niovecs, 
! 			p->length+RX_HEADER_SIZE, istack)){
  	  /* send failed, so let's hurry up the resend, eh? */
  	  MUTEX_ENTER(&rx_stats_mutex);
  	  rx_stats.netSendFailures++;	   
  	  MUTEX_EXIT(&rx_stats_mutex);
  	  p->retryTime = p->timeSent;  /* resend it very soon */
  	  clock_Addmsec(&(p->retryTime), 10 + (((afs_uint32) p->backoff) << 8));
  	}
  #ifdef KERNEL
  	if (waslocked) AFS_GLOCK();
--- 1551,1574 ----
  	waslocked = ISAFS_GLOCK();
  	if (waslocked) AFS_GUNLOCK();
  #endif
! 	if ((code = osi_NetSend(socket, &addr, p->wirevec, p->niovecs, 
! 				p->length+RX_HEADER_SIZE, istack)) != 0) {
  	  /* send failed, so let's hurry up the resend, eh? */
  	  MUTEX_ENTER(&rx_stats_mutex);
  	  rx_stats.netSendFailures++;	   
  	  MUTEX_EXIT(&rx_stats_mutex);
  	  p->retryTime = p->timeSent;  /* resend it very soon */
  	  clock_Addmsec(&(p->retryTime), 10 + (((afs_uint32) p->backoff) << 8));
+ 
+ #if defined(KERNEL) && defined(AFS_LINUX20_ENV)
+ 	  /* Linux is nice -- it can tell us right away that we cannot
+ 	   * reach this recipient by returning an ENETUNREACH error
+ 	   * code.  So, when this happens let's "down" the host NOW so
+ 	   * we don't sit around waiting for this host to timeout later.
+ 	   */
+ 	  if (call && code == -ENETUNREACH)
+ 	    call->lastReceiveTime = 0;
+ #endif
  	}
  #ifdef KERNEL
  	if (waslocked) AFS_GLOCK();
***************
*** 1582,1591 ****
  /* Send a list of packets to appropriate destination for the specified
   * connection.  The headers are first encoded and placed in the packets.
   */
! void rxi_SendPacketList(struct rx_connection * conn,
! 			struct rx_packet **list,
! 			int len,
! 			int istack)
  {
  #if     defined(AFS_SUN5_ENV) && defined(KERNEL)
      int waslocked;
--- 1593,1600 ----
  /* Send a list of packets to appropriate destination for the specified
   * connection.  The headers are first encoded and placed in the packets.
   */
! void rxi_SendPacketList(struct rx_call * call, struct rx_connection * conn,
! 			struct rx_packet **list, int len, int istack)
  {
  #if     defined(AFS_SUN5_ENV) && defined(KERNEL)
      int waslocked;
***************
*** 1595,1601 ****
      osi_socket socket;
      struct rx_packet *p = NULL;
      struct iovec wirevec[RX_MAXIOVECS];
!     int i, length;
      afs_uint32 serial;
      afs_uint32 temp;
      struct rx_jumboHeader *jp;
--- 1604,1610 ----
      osi_socket socket;
      struct rx_packet *p = NULL;
      struct iovec wirevec[RX_MAXIOVECS];
!     int i, length, code;
      afs_uint32 serial;
      afs_uint32 temp;
      struct rx_jumboHeader *jp;
***************
*** 1715,1721 ****
  	waslocked = ISAFS_GLOCK();
  	if (!istack && waslocked) AFS_GUNLOCK();
  #endif
! 	if (osi_NetSend(socket, &addr, &wirevec[0], len+1, length, istack)){
  	  /* send failed, so let's hurry up the resend, eh? */
  	  MUTEX_ENTER(&rx_stats_mutex);
  	  rx_stats.netSendFailures++;	   
--- 1724,1730 ----
  	waslocked = ISAFS_GLOCK();
  	if (!istack && waslocked) AFS_GUNLOCK();
  #endif
! 	if ((code = osi_NetSend(socket, &addr, &wirevec[0], len+1, length, istack)) != 0){
  	  /* send failed, so let's hurry up the resend, eh? */
  	  MUTEX_ENTER(&rx_stats_mutex);
  	  rx_stats.netSendFailures++;	   
***************
*** 1725,1730 ****
--- 1734,1748 ----
  	    p->retryTime = p->timeSent;  /* resend it very soon */
  	    clock_Addmsec(&(p->retryTime), 10 + (((afs_uint32) p->backoff) << 8));
  	  }
+ #if defined(KERNEL) && defined(AFS_LINUX20_ENV)
+ 	  /* Linux is nice -- it can tell us right away that we cannot
+ 	   * reach this recipient by returning an ENETUNREACH error
+ 	   * code.  So, when this happens let's "down" the host NOW so
+ 	   * we don't sit around waiting for this host to timeout later.
+ 	   */
+ 	  if (call && code == -ENETUNREACH)
+ 	    call->lastReceiveTime = 0;
+ #endif
  	}
  #if	defined(AFS_SUN5_ENV) && defined(KERNEL)
  	if (!istack && waslocked) AFS_GLOCK();
***************
*** 1816,1822 ****
      }
  
      if (call) rxi_Send(call, p, istack);
!     else rxi_SendPacket(conn, p, istack);
      if (saven) {  /* means we truncated the packet above.  We probably don't  */
        /* really need to do this, but it seems safer this way, given that  */
        /* sneaky optionalPacket... */
--- 1834,1840 ----
      }
  
      if (call) rxi_Send(call, p, istack);
!     else rxi_SendPacket((struct rx_call *)0, conn, p, istack);
      if (saven) {  /* means we truncated the packet above.  We probably don't  */
        /* really need to do this, but it seems safer this way, given that  */
        /* sneaky optionalPacket... */
Index: openafs/src/rx/rx_pthread.c
diff -c openafs/src/rx/rx_pthread.c:1.6.4.3 openafs/src/rx/rx_pthread.c:1.6.4.8
*** openafs/src/rx/rx_pthread.c:1.6.4.3	Wed Jul 31 18:36:11 2002
--- openafs/src/rx/rx_pthread.c	Fri Mar 14 14:49:04 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_pthread.c,v 1.6.4.3 2002/07/31 22:36:11 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_pthread.c,v 1.6.4.8 2003/03/14 19:49:04 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
***************
*** 33,40 ****
  # include <sys/time.h>
  #endif
  #include <sys/stat.h>
! #include <rx.h>
! #include <rx_globals.h>
  #include <assert.h>
  #include <rx/rx_pthread.h>
  
--- 33,40 ----
  # include <sys/time.h>
  #endif
  #include <sys/stat.h>
! #include <rx/rx.h>
! #include <rx/rx_globals.h>
  #include <assert.h>
  #include <rx/rx_pthread.h>
  
***************
*** 53,59 ****
   */
  static int rx_pthread_event_rescheduled = 0;
  
! static void rx_ListenerProc(void *);
  
  /*
   * We supply an event handling thread for Rx's event processing.
--- 53,59 ----
   */
  static int rx_pthread_event_rescheduled = 0;
  
! static void *rx_ListenerProc(void *);
  
  /*
   * We supply an event handling thread for Rx's event processing.
***************
*** 204,210 ****
  int *tnop;
  struct rx_call **newcallp;
  {
!     u_long host;
      u_short port;
      register struct rx_packet *p = (struct rx_packet *)0;
  
--- 204,210 ----
  int *tnop;
  struct rx_call **newcallp;
  {
!     unsigned int host;
      u_short port;
      register struct rx_packet *p = (struct rx_packet *)0;
  
***************
*** 245,251 ****
  /* This is the listener process request loop. The listener process loop
   * becomes a server thread when rxi_ListenerProc returns, and stays
   * server thread until rxi_ServerProc returns. */
! static void rx_ListenerProc(void *argp)
  {
      int threadID;
      int sock = (int) argp;
--- 245,251 ----
  /* This is the listener process request loop. The listener process loop
   * becomes a server thread when rxi_ListenerProc returns, and stays
   * server thread until rxi_ServerProc returns. */
! static void *rx_ListenerProc(void *argp)
  {
      int threadID;
      int sock = (int) argp;
***************
*** 279,285 ****
      rxi_dataQuota += rx_initSendWindow;	/* Reserve some pkts for hard times */
      /* threadID is used for making decisions in GetCall.  Get it by bumping
       * number of threads handling incoming calls */
!     threadID = rxi_availProcs++;
      MUTEX_EXIT(&rx_stats_mutex);
  
      while(1) {
--- 279,299 ----
      rxi_dataQuota += rx_initSendWindow;	/* Reserve some pkts for hard times */
      /* threadID is used for making decisions in GetCall.  Get it by bumping
       * number of threads handling incoming calls */
! 	/* Unique thread ID: used for scheduling purposes *and* as index into
! 		the host hold table (fileserver). 
! 		The previously used rxi_availProcs is unsuitable as it
! 		will already go up and down as packets arrive while the server
! 		threads are still initialising! The recently introduced
! 		rxi_pthread_hinum does not necessarily lead to a server
! 		thread with id 0, which is not allowed to hop through the
! 		incoming call queue.
! 		So either introduce yet another counter or flag the FCFS
! 		thread... chose the latter.
! 	*/
! 	threadID = ++rxi_pthread_hinum;
! 	if (rxi_fcfs_thread_num==0 && rxi_fcfs_thread_num!=threadID)
! 		rxi_fcfs_thread_num=threadID;
! 	++rxi_availProcs;
      MUTEX_EXIT(&rx_stats_mutex);
  
      while(1) {
***************
*** 330,335 ****
--- 344,352 ----
  	printf("Unable to create Rx event handling thread\n");
  	exit(1);
      }
+     MUTEX_ENTER(&rx_stats_mutex);
+     ++rxi_pthread_hinum;
+     MUTEX_EXIT(&rx_stats_mutex);
      AFS_SIGSET_RESTORE();
  
      assert(pthread_mutex_lock(&listener_mutex)==0);
***************
*** 371,376 ****
--- 388,396 ----
  	printf("Unable to create socket listener thread\n");
  	exit(1);
      }
+     MUTEX_ENTER(&rx_stats_mutex);
+     ++rxi_pthread_hinum;
+     MUTEX_EXIT(&rx_stats_mutex);
      AFS_SIGSET_RESTORE();
      return 0;
  }
Index: openafs/src/rx/rx_rdwr.c
diff -c openafs/src/rx/rx_rdwr.c:1.12.2.2 openafs/src/rx/rx_rdwr.c:1.12.2.4
*** openafs/src/rx/rx_rdwr.c:1.12.2.2	Sat Oct 13 00:21:49 2001
--- openafs/src/rx/rx_rdwr.c	Tue Jan 14 02:48:05 2003
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_rdwr.c,v 1.12.2.2 2001/10/13 04:21:49 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rx/rx_rdwr.c,v 1.12.2.4 2003/01/14 07:48:05 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
Index: openafs/src/rx/xdr_mem.c
diff -c openafs/src/rx/xdr_mem.c:1.4 openafs/src/rx/xdr_mem.c:1.4.2.1
*** openafs/src/rx/xdr_mem.c:1.4	Tue Aug  7 20:03:57 2001
--- openafs/src/rx/xdr_mem.c	Fri Mar 21 13:36:42 2003
***************
*** 29,35 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/xdr_mem.c,v 1.4 2001/08/08 00:03:57 shadow Exp $");
  
  #ifndef	NeXT
  
--- 29,35 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rx/xdr_mem.c,v 1.4.2.1 2003/03/21 18:36:42 shadow Exp $");
  
  #ifndef	NeXT
  
***************
*** 84,90 ****
  	xdrs->x_op = op;
  	xdrs->x_ops = &xdrmem_ops;
  	xdrs->x_private = xdrs->x_base = addr;
! 	xdrs->x_handy = size;
  }
  
  static void
--- 84,90 ----
  	xdrs->x_op = op;
  	xdrs->x_ops = &xdrmem_ops;
  	xdrs->x_private = xdrs->x_base = addr;
! 	xdrs->x_handy = (size > INT_MAX) ? INT_MAX : size; /* XXX */
  }
  
  static void
***************
*** 98,109 ****
  	register XDR *xdrs;
  	afs_int32 *lp;
  {
! 
! 	if ((xdrs->x_handy -= sizeof(afs_int32)) < 0)
! 		return (FALSE);
! 	*lp = ntohl(*((afs_int32 *)(xdrs->x_private)));
! 	xdrs->x_private += sizeof(afs_int32);
! 	return (TRUE);
  }
  
  static bool_t
--- 98,111 ----
  	register XDR *xdrs;
  	afs_int32 *lp;
  {
!     if (xdrs->x_handy -= sizeof(afs_int32))
! 	return (FALSE);
!     else
! 	xdrs->x_handy -= sizeof(afs_int32);
! 
!     *lp = ntohl(*((afs_int32 *)(xdrs->x_private)));
!     xdrs->x_private += sizeof(afs_int32);
!     return (TRUE);
  }
  
  static bool_t
***************
*** 111,122 ****
  	register XDR *xdrs;
  	afs_int32 *lp;
  {
! 
! 	if ((xdrs->x_handy -= sizeof(afs_int32)) < 0)
! 		return (FALSE);
! 	*(afs_int32 *)xdrs->x_private = htonl(*lp);
! 	xdrs->x_private += sizeof(afs_int32);
! 	return (TRUE);
  }
  
  static bool_t
--- 113,126 ----
  	register XDR *xdrs;
  	afs_int32 *lp;
  {
!     if (xdrs->x_handy -= sizeof(afs_int32))
! 	eturn (FALSE);
!     else
! 	xdrs->x_handy -= sizeof(afs_int32);
!     
!     *(afs_int32 *)xdrs->x_private = htonl(*lp);
!     xdrs->x_private += sizeof(afs_int32);
!     return (TRUE);
  }
  
  static bool_t
***************
*** 125,136 ****
  	caddr_t addr;
  	register u_int len;
  {
! 
! 	if ((xdrs->x_handy -= len) < 0)
! 		return (FALSE);
! 	memcpy(addr, xdrs->x_private, len);
! 	xdrs->x_private += len;
! 	return (TRUE);
  }
  
  static bool_t
--- 129,142 ----
  	caddr_t addr;
  	register u_int len;
  {
!     if (xdrs->x_handy < len)
! 	return (FALSE);
!     else
! 	xdrs->x_handy -= len;
! 
!     memcpy(addr, xdrs->x_private, len);
!     xdrs->x_private += len;
!     return (TRUE);
  }
  
  static bool_t
***************
*** 139,150 ****
  	caddr_t addr;
  	register u_int len;
  {
! 
! 	if ((xdrs->x_handy -= len) < 0)
! 		return (FALSE);
! 	memcpy(xdrs->x_private, addr, len);
! 	xdrs->x_private += len;
! 	return (TRUE);
  }
  
  static u_int
--- 145,158 ----
  	caddr_t addr;
  	register u_int len;
  {
!     if (xdrs->x_handy < len)
! 	return (FALSE);
!     else
! 	xdrs->x_handy -= len;
! 
!     memcpy(xdrs->x_private, addr, len);
!     xdrs->x_private += len;
!     return (TRUE);
  }
  
  static u_int
***************
*** 177,183 ****
  {
  	afs_int32 *buf = 0;
  
! 	if (xdrs->x_handy >= len) {
  		xdrs->x_handy -= len;
  		buf = (afs_int32 *) xdrs->x_private;
  		xdrs->x_private += len;
--- 185,191 ----
  {
  	afs_int32 *buf = 0;
  
! 	if (len >= 0 && xdrs->x_handy >= len) {
  		xdrs->x_handy -= len;
  		buf = (afs_int32 *) xdrs->x_private;
  		xdrs->x_private += len;
Index: openafs/src/rx/DARWIN/rx_knet.c
diff -c openafs/src/rx/DARWIN/rx_knet.c:1.5 openafs/src/rx/DARWIN/rx_knet.c:1.5.2.1
*** openafs/src/rx/DARWIN/rx_knet.c:1.5	Wed Aug  8 02:28:59 2001
--- openafs/src/rx/DARWIN/rx_knet.c	Fri Jan 31 16:20:25 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/DARWIN/rx_knet.c,v 1.5 2001/08/08 06:28:59 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/DARWIN/rx_knet.c,v 1.5.2.1 2003/01/31 21:20:25 shadow Exp $");
  
  #include "../rx/rx_kcommon.h"
  
***************
*** 24,30 ****
      struct uio u;
      int i;
      struct iovec iov[RX_MAXIOVECS];
!     struct sockaddr *sa;
      int code;
  
      int haveGlock = ISAFS_GLOCK();
--- 24,30 ----
      struct uio u;
      int i;
      struct iovec iov[RX_MAXIOVECS];
!     struct sockaddr *sa = NULL;
      int code;
  
      int haveGlock = ISAFS_GLOCK();
***************
*** 60,72 ****
      if (haveGlock) {
          AFS_GLOCK();
      }
!     *alength=*alength-u.uio_resid;
      if (sa) {
         if (sa->sa_family == AF_INET) {
            if (addr) *addr=*(struct sockaddr_in *)sa;
         } else {
            printf("Unknown socket family %d in NetReceive\n");
         }
      }
      return code;
  }
--- 60,75 ----
      if (haveGlock) {
          AFS_GLOCK();
      }
!     if (code)
! 	return code;
!     *alength -= u.uio_resid;
      if (sa) {
         if (sa->sa_family == AF_INET) {
            if (addr) *addr=*(struct sockaddr_in *)sa;
         } else {
            printf("Unknown socket family %d in NetReceive\n");
         }
+        FREE(sa, M_SONAME);
      }
      return code;
  }
Index: openafs/src/rx/FBSD/rx_knet.c
diff -c openafs/src/rx/FBSD/rx_knet.c:1.5.2.1 openafs/src/rx/FBSD/rx_knet.c:1.5.2.2
*** openafs/src/rx/FBSD/rx_knet.c:1.5.2.1	Tue Sep 10 18:33:57 2002
--- openafs/src/rx/FBSD/rx_knet.c	Fri Jan 31 16:20:27 2003
***************
*** 23,31 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/FBSD/rx_knet.c,v 1.5.2.1 2002/09/10 22:33:57 zacheiss Exp $");
  
  #ifdef AFS_FBSD40_ENV
  #include "../rx/rx_kcommon.h"
  
  
--- 23,32 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/FBSD/rx_knet.c,v 1.5.2.2 2003/01/31 21:20:27 shadow Exp $");
  
  #ifdef AFS_FBSD40_ENV
+ #include <sys/malloc.h>
  #include "../rx/rx_kcommon.h"
  
  
***************
*** 37,43 ****
      struct uio u;
      int i;
      struct iovec iov[RX_MAXIOVECS];
!     struct sockaddr *sa;
      int code;
  
      int haveGlock = ISAFS_GLOCK();
--- 38,44 ----
      struct uio u;
      int i;
      struct iovec iov[RX_MAXIOVECS];
!     struct sockaddr *sa = NULL;
      int code;
  
      int haveGlock = ISAFS_GLOCK();
***************
*** 75,87 ****
      if (haveGlock) {
          AFS_GLOCK();
      }
!     *alength=*alength-u.uio_resid;
      if (sa) {
         if (sa->sa_family == AF_INET) {
            if (addr) *addr=*(struct sockaddr_in *)sa;
         } else {
            printf("Unknown socket family %d in NetReceive\n", sa->sa_family);
         }
      }
      return code;
  }
--- 76,91 ----
      if (haveGlock) {
          AFS_GLOCK();
      }
!     if (code)
! 	return code;
!     *alength -= u.uio_resid;
      if (sa) {
         if (sa->sa_family == AF_INET) {
            if (addr) *addr=*(struct sockaddr_in *)sa;
         } else {
            printf("Unknown socket family %d in NetReceive\n", sa->sa_family);
         }
+        FREE(sa, M_SONAME);
      }
      return code;
  }
***************
*** 141,147 ****
  #if KNET_DEBUG
      printf("+");
  #endif
!     code = sosend(asocket, addr, &u, NULL, NULL, 0, curproc);
  #if KNET_DEBUG
      if (code) {
          if (code == EINVAL)
--- 145,152 ----
  #if KNET_DEBUG
      printf("+");
  #endif
!     code = sosend(asocket, (struct sockaddr *)addr, &u, NULL, NULL, 0, 
! 		  curproc);
  #if KNET_DEBUG
      if (code) {
          if (code == EINVAL)
Index: openafs/src/rx/LINUX/rx_kmutex.h
diff -c openafs/src/rx/LINUX/rx_kmutex.h:1.4.4.6 openafs/src/rx/LINUX/rx_kmutex.h:1.4.4.7
*** openafs/src/rx/LINUX/rx_kmutex.h:1.4.4.6	Wed Aug 21 15:58:02 2002
--- openafs/src/rx/LINUX/rx_kmutex.h	Sat Jan 11 02:53:31 2003
***************
*** 17,22 ****
--- 17,23 ----
  #define RX_KMUTEX_H_
  
  #include "../rx/rx_kernel.h"	/* for osi_Panic() */
+ #include "linux/sched.h"
  
  /* AFS_GLOBAL_RXLOCK_KERNEL is defined so that the busy tq code paths are
   * used. The thread can sleep when sending packets.
***************
*** 32,38 ****
  struct coda_inode_info {};
  #endif
  #include "linux/wait.h"
- #include "linux/sched.h"
  
  typedef struct afs_kmutex {
      struct semaphore sem;
--- 33,38 ----
***************
*** 125,143 ****
      if (isAFSGlocked) AFS_GUNLOCK();
      MUTEX_EXIT(l);
  
!     spin_lock_irq(&current->sigmask_lock);
      saved_set = current->blocked;
      sigfillset(&current->blocked);
!     recalc_sigpending(current);
!     spin_unlock_irq(&current->sigmask_lock);
  
      schedule();
      remove_wait_queue(cv, &wait);
  
!     spin_lock_irq(&current->sigmask_lock);
      current->blocked = saved_set;
!     recalc_sigpending(current);
!     spin_unlock_irq(&current->sigmask_lock);
  
      if (isAFSGlocked) AFS_GLOCK();
      MUTEX_ENTER(l);
--- 125,143 ----
      if (isAFSGlocked) AFS_GUNLOCK();
      MUTEX_EXIT(l);
  
!     SIG_LOCK(current);
      saved_set = current->blocked;
      sigfillset(&current->blocked);
!     RECALC_SIGPENDING(current);
!     SIG_UNLOCK(current);
  
      schedule();
      remove_wait_queue(cv, &wait);
  
!     SIG_LOCK(current);
      current->blocked = saved_set;
!     RECALC_SIGPENDING(current);
!     SIG_UNLOCK(current);
  
      if (isAFSGlocked) AFS_GLOCK();
      MUTEX_ENTER(l);
***************
*** 162,180 ****
      if (isAFSGlocked) AFS_GUNLOCK();
      MUTEX_EXIT(l);
      
!     spin_lock_irq(&current->sigmask_lock);
      saved_set = current->blocked;
      sigfillset(&current->blocked);
!     recalc_sigpending(current);
!     spin_unlock_irq(&current->sigmask_lock);
  
      t = schedule_timeout(t);
      remove_wait_queue(cv, &wait);
      
!     spin_lock_irq(&current->sigmask_lock);
      current->blocked = saved_set;
!     recalc_sigpending(current);
!     spin_unlock_irq(&current->sigmask_lock);
  
      if (isAFSGlocked) AFS_GLOCK();
      MUTEX_ENTER(l);
--- 162,180 ----
      if (isAFSGlocked) AFS_GUNLOCK();
      MUTEX_EXIT(l);
      
!     SIG_LOCK(current);
      saved_set = current->blocked;
      sigfillset(&current->blocked);
!     RECALC_SIGPENDING(current);
!     SIG_UNLOCK(current);
  
      t = schedule_timeout(t);
      remove_wait_queue(cv, &wait);
      
!     SIG_LOCK(current);
      current->blocked = saved_set;
!     RECALC_SIGPENDING(current);
!     SIG_UNLOCK(current);
  
      if (isAFSGlocked) AFS_GLOCK();
      MUTEX_ENTER(l);
Index: openafs/src/rx/LINUX/rx_knet.c
diff -c openafs/src/rx/LINUX/rx_knet.c:1.6.4.4 openafs/src/rx/LINUX/rx_knet.c:1.6.4.7
*** openafs/src/rx/LINUX/rx_knet.c:1.6.4.4	Wed May 15 16:07:31 2002
--- openafs/src/rx/LINUX/rx_knet.c	Wed Mar 26 04:11:29 2003
***************
*** 15,22 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.6.4.4 2002/05/15 20:07:31 zacheiss Exp $");
  
  #ifdef AFS_LINUX22_ENV
  #include "../rx/rx_kcommon.h"
  #if defined(AFS_LINUX24_ENV)
--- 15,23 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.6.4.7 2003/03/26 09:11:29 shadow Exp $");
  
+ #include <linux/version.h>
  #ifdef AFS_LINUX22_ENV
  #include "../rx/rx_kcommon.h"
  #if defined(AFS_LINUX24_ENV)
***************
*** 175,185 ****
  
  void osi_StopListener(void)
  {
!     extern int (*sys_killp)();
      extern int rxk_ListenerPid;
  
      while (rxk_ListenerPid) {
! 	(void) (*sys_killp)(rxk_ListenerPid, SIGKILL);
  	afs_osi_Sleep(&rxk_ListenerPid); 
      }
      sock_release(rx_socket);
--- 176,193 ----
  
  void osi_StopListener(void)
  {
!     struct task_struct *listener;
      extern int rxk_ListenerPid;
  
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+     read_lock(&tasklist_lock);
+ #endif
+     listener =  find_task_by_pid(rxk_ListenerPid);
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+                     read_unlock(&tasklist_lock);
+ #endif
      while (rxk_ListenerPid) {
! 	force_sig(SIGKILL, listener);
  	afs_osi_Sleep(&rxk_ListenerPid); 
      }
      sock_release(rx_socket);
Index: openafs/src/rx/SOLARIS/rx_knet.c
diff -c openafs/src/rx/SOLARIS/rx_knet.c:1.6.2.4 openafs/src/rx/SOLARIS/rx_knet.c:1.6.2.5
*** openafs/src/rx/SOLARIS/rx_knet.c:1.6.2.4	Thu Apr 18 23:56:57 2002
--- openafs/src/rx/SOLARIS/rx_knet.c	Sat Jan 11 02:49:00 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.6.2.4 2002/04/19 03:56:57 zacheiss Exp $");
  
  #ifdef AFS_SUN5_ENV
  #include "../rx/rx_kcommon.h"
--- 10,16 ----
  #include <afsconfig.h>
  #include "../afs/param.h"
  
! RCSID("$Header: /data/cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.6.2.5 2003/01/11 07:49:00 shadow Exp $");
  
  #ifdef AFS_SUN5_ENV
  #include "../rx/rx_kcommon.h"
***************
*** 292,302 ****
  {
      extern int rxk_ListenerPid;
      struct sonode *so = (struct sonode *)asocket;
!     vnode_t *vp = SOTOV(so);
  
      AFS_STATCNT(osi_FreeSocket);
      while (rxk_ListenerPid) {
! 	kill(rxk_ListenerPid, SIGUSR1);
  	afs_osi_Sleep(&rxk_ListenerPid);
      }
  
--- 292,312 ----
  {
      extern int rxk_ListenerPid;
      struct sonode *so = (struct sonode *)asocket;
!     struct sockaddr_in taddr;
!     struct iovec dvec;
!     char c;
  
      AFS_STATCNT(osi_FreeSocket);
+ 
+     taddr.sin_family = AF_INET;
+     taddr.sin_port = htons(rx_port);
+     taddr.sin_addr.s_addr = htonl(0x7f000001);
+ 
+     dvec.iov_base = &c;
+     dvec.iov_len = 1;
+ 
      while (rxk_ListenerPid) {
! 	osi_NetSend(rx_socket, &taddr, &dvec, 1, 1, 0);
  	afs_osi_Sleep(&rxk_ListenerPid);
      }
  
Index: openafs/src/rxkad/rxkad_server.c
diff -c openafs/src/rxkad/rxkad_server.c:1.7.2.3 openafs/src/rxkad/rxkad_server.c:1.7.2.4
*** openafs/src/rxkad/rxkad_server.c:1.7.2.3	Thu Nov 14 17:44:38 2002
--- openafs/src/rxkad/rxkad_server.c	Thu Apr 10 14:55:40 2003
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_server.c,v 1.7.2.3 2002/11/14 22:44:38 zacheiss Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 14,20 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/rxkad_server.c,v 1.7.2.4 2003/04/10 18:55:40 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 314,320 ****
  				  kvno,
  				  client.name, client.instance, client.cell,
  				  &sessionkey, &host, &start, &end);
! 	if (code) return RXKADBADTICKET;
      }
  
      /*
--- 314,320 ----
  				  kvno,
  				  client.name, client.instance, client.cell,
  				  &sessionkey, &host, &start, &end);
! 	if (code) return code;
      }
  
      /*
Index: openafs/src/rxkad/ticket.c
diff -c openafs/src/rxkad/ticket.c:1.6.2.1 openafs/src/rxkad/ticket.c:1.6.2.2
*** openafs/src/rxkad/ticket.c:1.6.2.1	Sat Oct 13 00:21:56 2001
--- openafs/src/rxkad/ticket.c	Sat Jan 11 02:35:53 2003
***************
*** 14,20 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/ticket.c,v 1.6.2.1 2001/10/13 04:21:56 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 14,20 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/ticket.c,v 1.6.2.2 2003/01/11 07:35:53 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
***************
*** 65,70 ****
--- 65,86 ----
     interpreting the ticket and the values of the output parameters are
     undefined. */
  
+ /* This union is used to insure we allocate enough space for a key
+  * schedule even if we are linked against a library that uses OpenSSL's
+  * larger representation.  This is necessary so we don't lose if an
+  * application uses both rxkad and openssl.
+  */
+ union Key_schedule_safe {
+   Key_schedule schedule;
+   struct {
+     union {
+       char cblock[8];
+       long deslong[2];
+     } ks;
+     int weak_key;
+   } openssl_schedule[16];
+ };
+ 
  int tkt_DecodeTicket (asecret, ticketLen, key,
  		      name, inst, cell, sessionKey, host, start, end)
    char		*asecret;
***************
*** 79,85 ****
    afs_int32		*end;
  {   char	   clear_ticket[MAXKTCTICKETLEN];
      char	  *ticket;
!     Key_schedule   schedule;
      /* unsigned char  flags; */
      int		   code;
  
--- 95,101 ----
    afs_int32		*end;
  {   char	   clear_ticket[MAXKTCTICKETLEN];
      char	  *ticket;
!     union Key_schedule_safe   schedule;
      /* unsigned char  flags; */
      int		   code;
  
***************
*** 88,97 ****
  	((ticketLen) % 8 != 0))		/* enc. part must be (0 mod 8) bytes */
  	return RXKADBADTICKET;
  
!     if (key_sched (key, schedule)) return RXKADBADKEY;
  
      ticket = clear_ticket;
!     pcbc_encrypt (asecret, ticket, ticketLen, schedule, key, DECRYPT);
  
      /* flags = *ticket; */		/* get the first byte: the flags */
  #if 0
--- 104,113 ----
  	((ticketLen) % 8 != 0))		/* enc. part must be (0 mod 8) bytes */
  	return RXKADBADTICKET;
  
!     if (key_sched (key, schedule.schedule)) return RXKADBADKEY;
  
      ticket = clear_ticket;
!     pcbc_encrypt (asecret, ticket, ticketLen, schedule.schedule, key, DECRYPT);
  
      /* flags = *ticket; */		/* get the first byte: the flags */
  #if 0
***************
*** 141,147 ****
    char		*sname;			/* server */
    char		*sinst;
  {   int		 code;
!     Key_schedule schedule;
  
      *ticketLen = 0;			/* in case we return early */
      code = assemble_athena_ticket (ticket, ticketLen, name, inst, cell,
--- 157,163 ----
    char		*sname;			/* server */
    char		*sinst;
  {   int		 code;
!     union Key_schedule_safe schedule;
  
      *ticketLen = 0;			/* in case we return early */
      code = assemble_athena_ticket (ticket, ticketLen, name, inst, cell,
***************
*** 150,160 ****
      if (code) return -1;
  
      /* encrypt ticket */
!     if (code = key_sched (key, schedule)) {
  	printf ("In tkt_MakeTicket: key_sched returned %d\n", code);
  	return RXKADBADKEY;
      }
!     pcbc_encrypt (ticket, ticket, *ticketLen, schedule, key, ENCRYPT);
      return 0;
  }
  
--- 166,176 ----
      if (code) return -1;
  
      /* encrypt ticket */
!     if (code = key_sched (key, schedule.schedule)) {
  	printf ("In tkt_MakeTicket: key_sched returned %d\n", code);
  	return RXKADBADKEY;
      }
!     pcbc_encrypt (ticket, ticket, *ticketLen, schedule.schedule, key, ENCRYPT);
      return 0;
  }
  
Index: openafs/src/rxkad/ticket5.c
diff -c openafs/src/rxkad/ticket5.c:1.2.2.2 openafs/src/rxkad/ticket5.c:1.2.2.4
*** openafs/src/rxkad/ticket5.c:1.2.2.2	Fri Nov 15 00:04:56 2002
--- openafs/src/rxkad/ticket5.c	Tue Mar 25 16:11:08 2003
***************
*** 30,35 ****
--- 30,58 ----
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   */
+ /*
+  * Copyright 1992, 2002 by the Massachusetts Institute of Technology.
+  * All Rights Reserved.
+  *
+  * Export of this software from the United States of America may
+  *   require a specific license from the United States Government.
+  *   It is the responsibility of any person or organization contemplating
+  *   export to obtain such a license before exporting.
+  * 
+  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+  * distribute this software and its documentation for any purpose and
+  * without fee is hereby granted, provided that the above copyright
+  * notice appear in all copies and that both that copyright notice and
+  * this permission notice appear in supporting documentation, and that
+  * the name of M.I.T. not be used in advertising or publicity pertaining
+  * to distribution of the software without specific, written prior
+  * permission.  Furthermore if you modify this software you must label
+  * your software as modified software and not distribute it in such a
+  * fashion that it might be confused with the original M.I.T. software.
+  * M.I.T. makes no representations about the suitability of
+  * this software for any purpose.  It is provided "as is" without express
+  * or implied warranty.
+  */
  
  #include <afsconfig.h>
  #if defined(UKERNEL)
***************
*** 38,44 ****
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/ticket5.c,v 1.2.2.2 2002/11/15 05:04:56 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
--- 61,67 ----
  #include <afs/param.h>
  #endif
  
! RCSID("$Header: /data/cvs/openafs/src/rxkad/ticket5.c,v 1.2.2.4 2003/03/25 21:11:08 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "../afs/sysincludes.h"
***************
*** 78,83 ****
--- 101,191 ----
  #include "v5der.c"
  #include "v5gen.c"
  
+ /*
+  * Principal conversion Taken from src/lib/krb5/krb/conv_princ from MIT Kerberos.  If you
+  * find a need to change the services here, please consider opening a
+  * bug with MIT by sending mail to krb5-bugs@mit.edu.
+  */
+ 
+ struct krb_convert {
+     char		*v4_str;
+     char		*v5_str;
+   unsigned int	flags;
+   unsigned int	len;
+ };
+ 
+ #define DO_REALM_CONVERSION 0x00000001
+ 
+ /*
+  * Kadmin doesn't do realm conversion because it's currently
+  * kadmin/REALM.NAME.  Zephyr doesn't because it's just zephyr/zephyr.
+  *
+  * "Realm conversion" is a bit of a misnomer; really, the v5 name is
+  * using a FQDN or something that looks like it, where the v4 name is
+  * just using the first label.  Sometimes that second principal name
+  * component is a hostname, sometimes the realm name, sometimes it's
+  * neither.
+  *
+  * This list should probably be more configurable, and more than
+  * likely on a per-realm basis, so locally-defined services can be
+  * added, or not.
+  */
+ static const struct krb_convert sconv_list[] = {
+     /* Realm conversion, Change service name */
+ #define RC(V5NAME,V4NAME) { V5NAME, V4NAME, DO_REALM_CONVERSION, sizeof(V5NAME)-1 }
+     /* Realm conversion */
+ #define R(NAME)		{ NAME, NAME, DO_REALM_CONVERSION, sizeof(NAME)-1 }
+     /* No Realm conversion */
+ #define NR(NAME)	{ NAME, NAME, 0, sizeof(NAME)-1 }
+ 
+     NR("kadmin"),
+     RC("rcmd", "host"),
+     R("discuss"),
+     R("rvdsrv"),
+     R("sample"),
+     R("olc"),
+     R("pop"),
+     R("sis"),
+     R("rfs"),
+     R("imap"),
+     R("ftp"),
+     R("ecat"),
+     R("daemon"),
+     R("gnats"),
+     R("moira"),
+     R("prms"),
+     R("mandarin"),
+     R("register"),
+     R("changepw"),
+     R("sms"),
+     R("afpserver"),
+     R("gdss"),
+     R("news"),
+     R("abs"),
+     R("nfs"),
+     R("tftp"),
+     NR("zephyr"),
+     R("http"),
+     R("khttp"),
+     R("pgpsigner"),
+     R("irc"),
+     R("mandarin-agent"),
+     R("write"),
+     R("palladium"),
+     R("imap"),
+     R("smtp"),
+     R("lmtp"),
+     R("ldap"),
+     R("acap"),
+     R("argus"),
+     R("mupdate"),
+     R("argus"),
+     {0, 0, 0, 0},
+ #undef R
+ #undef RC
+ #undef NR
+ };
+ 
  static int
  krb5_des_decrypt(struct ktc_encryptionKey *, 
  		 int, void *, size_t, void *, size_t *);
***************
*** 104,109 ****
--- 212,219 ----
      int code;
      size_t siz, plainsiz;
      int v5_serv_kvno;
+     char *v5_comp0, *v5_comp1, *c;
+     const struct krb_convert *p;
  
      memset(&t5, 0, sizeof(t5));
      memset(&decr_part, 0, sizeof(decr_part));
***************
*** 126,135 ****
  	    goto cleanup;
      }
  
!     /* Find the real service key version number */
!     if (t5.enc_part.kvno == NULL)
! 	goto bad_ticket;
!     v5_serv_kvno = *t5.enc_part.kvno;
      
  
      code = (*get_key)(get_key_rock, v5_serv_kvno, &serv_key);
--- 236,248 ----
  	    goto cleanup;
      }
  
!     /* If kvno is null, it's probably not included because it was kvno==0 
!        in the ticket */
!     if (t5.enc_part.kvno == NULL ) { 
!        v5_serv_kvno = 0;
!     } else { 
!        v5_serv_kvno = *t5.enc_part.kvno;
!     }
      
  
      code = (*get_key)(get_key_rock, v5_serv_kvno, &serv_key);
***************
*** 172,180 ****
      inst[0] = '\0';
      switch (decr_part.cname.name_string.len) {
      case 2:
! 	strncpy(inst, decr_part.cname.name_string.val[1], MAXKTCNAMELEN);
! 	inst[MAXKTCNAMELEN - 1] = '\0';
!     case 1:
  	strncpy(name, decr_part.cname.name_string.val[0], MAXKTCNAMELEN);
  	name[MAXKTCNAMELEN - 1] = '\0';
  	break;
--- 285,321 ----
      inst[0] = '\0';
      switch (decr_part.cname.name_string.len) {
      case 2:
!       v5_comp0 = decr_part.cname.name_string.val[0];
!       v5_comp1 = decr_part.cname.name_string.val[1];
!       p = sconv_list;
!       while (p->v4_str) {
! 	if (strncmp(p->v5_str, v5_comp0, p->len) == 0) {
! 	  /*
! 	   * It is, so set the new name now, and chop off
! 	   * instance's domain name if requested.
! 	   */
! 	  strncpy(name,p->v4_str, MAXKTCNAMELEN);
! 	  name[MAXKTCNAMELEN - 1] = '\0';
! 	  if (p->flags & DO_REALM_CONVERSION) {
! 	    c = strchr(v5_comp1, '.');
! 	    if (!c || (c - v5_comp1) >= MAXKTCNAMELEN - 1)
! 	      goto bad_ticket;
! 	    strncpy(inst, v5_comp1, c - v5_comp1);
! 	    inst[c - v5_comp1] = '\0';
! 	  }
! 	  break;
! 	}
! 	p++;
!       }
! 
! 	if (!p->v4_str) {
! 	  strncpy(inst, decr_part.cname.name_string.val[1], MAXKTCNAMELEN);
! 	  inst[MAXKTCNAMELEN - 1] = '\0';
! 	strncpy(name, decr_part.cname.name_string.val[0], MAXKTCNAMELEN);
! 	name[MAXKTCNAMELEN - 1] = '\0';
! 	}
! 	break;
! 	      case 1:
  	strncpy(name, decr_part.cname.name_string.val[0], MAXKTCNAMELEN);
  	name[MAXKTCNAMELEN - 1] = '\0';
  	break;
Index: openafs/src/rxkad/v5der.c
diff -c openafs/src/rxkad/v5der.c:1.2.2.1 openafs/src/rxkad/v5der.c:1.2.2.2
*** openafs/src/rxkad/v5der.c:1.2.2.1	Thu Nov 14 17:44:38 2002
--- openafs/src/rxkad/v5der.c	Fri Mar 14 15:30:59 2003
***************
*** 1,3 ****
--- 1,4 ----
+ #include <stddef.h>
  #include "asn1_err.h"
  #include <errno.h>
  /*
Index: openafs/src/scout/scout.c
diff -c openafs/src/scout/scout.c:1.5 openafs/src/scout/scout.c:1.5.2.1
*** openafs/src/scout/scout.c:1.5	Tue Aug  7 20:04:09 2001
--- openafs/src/scout/scout.c	Sat Jan 11 02:42:36 2003
***************
*** 14,20 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/scout/scout.c,v 1.5 2001/08/08 00:04:09 shadow Exp $");
  
  #undef	IN
  #ifdef	AFS_AIX32_ENV
--- 14,20 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/scout/scout.c,v 1.5.2.1 2003/01/11 07:42:36 shadow Exp $");
  
  #undef	IN
  #ifdef	AFS_AIX32_ENV
***************
*** 32,39 ****
  #include <stdio.h>		/*Standard I/O stuff*/
  #include <cmd.h>		/*Command interpretation library*/
  #include <fsprobe.h>		/*Interface for fsprobe module*/
  
- extern int errno;
  extern struct hostent *hostutil_GetHostByName();
  extern int gtx_InputServer();
  extern int gethostname();
--- 32,40 ----
  #include <stdio.h>		/*Standard I/O stuff*/
  #include <cmd.h>		/*Command interpretation library*/
  #include <fsprobe.h>		/*Interface for fsprobe module*/
+ #include <errno.h>
+ 
  
  extern struct hostent *hostutil_GetHostByName();
  extern int gtx_InputServer();
  extern int gethostname();
Index: openafs/src/shlibafsrpc/Makefile.in
diff -c openafs/src/shlibafsrpc/Makefile.in:1.7.2.8 openafs/src/shlibafsrpc/Makefile.in:1.7.2.9
*** openafs/src/shlibafsrpc/Makefile.in:1.7.2.8	Sun Nov 17 23:35:54 2002
--- openafs/src/shlibafsrpc/Makefile.in	Mon Jan 13 18:47:22 2003
***************
*** 276,282 ****
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.7.2.8 $
  #
  # 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.
--- 276,282 ----
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.7.2.9 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
***************
*** 351,357 ****
  
  syscall.o: ${SYS}/syscall.s
  	case "$(SYS_NAME)" in \
! 	     sun4x_5* | sunx86_5*) \
  		/usr/ccs/lib/cpp  ${SFLAGS} ${SYS}/syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
  		$(RM) syscall.ss;;				\
--- 351,357 ----
  
  syscall.o: ${SYS}/syscall.s
  	case "$(SYS_NAME)" in \
! 	     sun*_5* ) \
  		/usr/ccs/lib/cpp  ${SFLAGS} ${SYS}/syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
  		$(RM) syscall.ss;;				\
Index: openafs/src/shlibafsrpc/mapfile
diff -c openafs/src/shlibafsrpc/mapfile:1.2.2.1 openafs/src/shlibafsrpc/mapfile:1.2.2.2
*** openafs/src/shlibafsrpc/mapfile:1.2.2.1	Tue Sep 10 01:03:47 2002
--- openafs/src/shlibafsrpc/mapfile	Wed Mar 26 12:23:39 2003
***************
*** 14,19 ****
--- 14,22 ----
  	des_key_sched;
  	des_random_key;
  	des_string_to_key;
+ 	des_cbc_cksum;
+ 	des_ecb_encrypt;
+ 	des_pcbc_encrypt;
  	ktohl;
  	life_to_time;
  	rx_DestroyConnection;
Index: openafs/src/sys/Makefile.in
diff -c openafs/src/sys/Makefile.in:1.5.2.1 openafs/src/sys/Makefile.in:1.5.2.2
*** openafs/src/sys/Makefile.in:1.5.2.1	Wed Sep 19 18:25:30 2001
--- openafs/src/sys/Makefile.in	Mon Jan 13 18:47:23 2003
***************
*** 98,104 ****
  
  syscall.o: syscall.s
  	case "$(SYS_NAME)" in \
! 	 sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53  | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5? | sunx86_54) \
  		/usr/ccs/lib/cpp  ${SFLAGS} syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
  		$(RM) syscall.ss;;				\
--- 98,104 ----
  
  syscall.o: syscall.s
  	case "$(SYS_NAME)" in \
! 	 sun*_5? ) \
  		/usr/ccs/lib/cpp  ${SFLAGS} syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
  		$(RM) syscall.ss;;				\
Index: openafs/src/sys/afssyscalls.c
diff -c openafs/src/sys/afssyscalls.c:1.4 openafs/src/sys/afssyscalls.c:1.4.4.1
*** openafs/src/sys/afssyscalls.c:1.4	Thu Jul 12 15:59:17 2001
--- openafs/src/sys/afssyscalls.c	Sat Jan 11 02:42:37 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/afssyscalls.c,v 1.4 2001/07/12 19:59:17 shadow Exp $");
  
  #include <signal.h>
  #include <sys/errno.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/afssyscalls.c,v 1.4.4.1 2003/01/11 07:42:37 shadow Exp $");
  
  #include <signal.h>
  #include <sys/errno.h>
***************
*** 27,32 ****
--- 27,33 ----
  #ifdef AFS_SGI_XFS_IOPS_ENV
  #include "xfsattrs.h"
  #endif
+ #include <errno.h>
  #include "afssyscalls.h"
  
  #ifdef AFS_DEBUG_IOPS
***************
*** 238,245 ****
  icreate(dev, near_inode, param1, param2, param3, param4)
  int dev, near_inode, param1, param2, param3, param4;
  {
!     extern int errno;
!     int errcode;
      struct iparam iparams;
  
      iparams.param1 = param1;
--- 239,245 ----
  icreate(dev, near_inode, param1, param2, param3, param4)
  int dev, near_inode, param1, param2, param3, param4;
  {
!   int errcode;
      struct iparam iparams;
  
      iparams.param1 = param1;
***************
*** 255,261 ****
  iopen(dev, inode, usrmod)
  int dev, inode, usrmod;
  {
-     extern int errno;
      int errcode;
  
      errcode = syscall(AFS_SYSCALL, AFSCALL_IOPEN, dev, inode, usrmod);
--- 255,260 ----
***************
*** 266,272 ****
  iinc(dev, inode, inode_p1)
  int dev, inode, inode_p1;
  {
-     extern int errno;
      int errcode;
  
      errcode = syscall(AFS_SYSCALL, AFSCALL_IINC, dev, inode, inode_p1);
--- 265,270 ----
***************
*** 277,283 ****
  idec(dev, inode, inode_p1)
  int dev, inode, inode_p1;
  {
-     extern int errno;
      int errcode;
  
      errcode = syscall(AFS_SYSCALL, AFSCALL_IDEC, dev, inode, inode_p1);
--- 275,280 ----
***************
*** 292,298 ****
  char *cbuf;
  unsigned int count;
  {
-     extern int errno;
      int errcode;
      struct iparam iparams;
  
--- 289,294 ----
***************
*** 311,317 ****
  char *cbuf;
  unsigned int count;
  {
-     extern int errno;
      int errcode;
      struct iparam iparams;
  
--- 307,312 ----
***************
*** 329,335 ****
  
  lsetpag()
  {
-     extern int errno;
      int errcode;
  
      errcode = syscall(AFS_SYSCALL, AFSCALL_SETPAG);
--- 324,329 ----
***************
*** 340,346 ****
  char *path, *cmarg;
  int cmd, follow;
  {
-     extern int errno;
      int errcode;
  
      errcode = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, cmd, cmarg, follow);
--- 334,339 ----
Index: openafs/src/sys/rmtsysd.c
diff -c openafs/src/sys/rmtsysd.c:1.4 openafs/src/sys/rmtsysd.c:1.4.4.1
*** openafs/src/sys/rmtsysd.c:1.4	Thu Jul 12 15:59:17 2001
--- openafs/src/sys/rmtsysd.c	Sat Jan 11 02:42:37 2003
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/rmtsysd.c,v 1.4 2001/07/12 19:59:17 shadow Exp $");
  
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
--- 16,22 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/rmtsysd.c,v 1.4.4.1 2003/01/11 07:42:37 shadow Exp $");
  
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
***************
*** 28,38 ****
  #include <netinet/in.h>
  #include <sys/stat.h>
  #include <sys/file.h>
  #include <stdio.h>
  #include <rx/xdr.h>
  #include "rmtsys.h"
  
! extern int errno;   /* We ship this over the net if needed */
  extern RMTSYS_ExecuteRequest();
  
  #define N_SECURITY_OBJECTS 1	/* No real security yet */
--- 28,39 ----
  #include <netinet/in.h>
  #include <sys/stat.h>
  #include <sys/file.h>
+ #include <errno.h>
  #include <stdio.h>
  #include <rx/xdr.h>
  #include "rmtsys.h"
  
! 
  extern RMTSYS_ExecuteRequest();
  
  #define N_SECURITY_OBJECTS 1	/* No real security yet */
Index: openafs/src/sys/rmtsyss.c
diff -c openafs/src/sys/rmtsyss.c:1.6 openafs/src/sys/rmtsyss.c:1.6.2.2
*** openafs/src/sys/rmtsyss.c:1.6	Tue Aug  7 20:04:10 2001
--- openafs/src/sys/rmtsyss.c	Sat Jan 11 02:53:31 2003
***************
*** 15,21 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/rmtsyss.c,v 1.6 2001/08/08 00:04:10 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/ioctl.h>
--- 15,21 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/sys/rmtsyss.c,v 1.6.2.2 2003/01/11 07:53:31 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/ioctl.h>
***************
*** 25,31 ****
--- 25,33 ----
  #include <sys/stat.h>
  #include <sys/file.h>
  #include <stdio.h>
+ #include <errno.h>
  #include <rx/xdr.h>
+ #include <errno.h>
  #include <signal.h>
  #ifdef HAVE_STRING_H
  #include <string.h>
***************
*** 33,39 ****
  /*#include <afs/cellconfig.h>*/
  #include "rmtsys.h"
  
- extern int errno;   /* We ship this over the net if needed */
  extern RMTSYS_ExecuteRequest();
  
  #define	NFS_EXPORTER	    1	/* To probably handle more later */
--- 35,40 ----
Index: openafs/src/tviced/Makefile.in
diff -c openafs/src/tviced/Makefile.in:1.4 openafs/src/tviced/Makefile.in:1.4.2.1
*** openafs/src/tviced/Makefile.in:1.4	Fri Sep  7 19:36:00 2001
--- openafs/src/tviced/Makefile.in	Fri Jan 31 16:09:09 2003
***************
*** 50,56 ****
  
  LIBACLOBJS=aclprocs.o netprocs.o
  
! UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o volparse.o flipbase64.o
  
  DIROBJS=buffer.o dir.o salvage.o
  
--- 50,56 ----
  
  LIBACLOBJS=aclprocs.o netprocs.o
  
! UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o volparse.o flipbase64.o softsig.o
  
  DIROBJS=buffer.o dir.o salvage.o
  
***************
*** 105,110 ****
--- 105,113 ----
  	${COMPILE}
  
  dirpath.o: ${UTIL}/dirpath.c
+ 	${COMPILE}
+ 
+ softsig.o: ${UTIL}/softsig.c
  	${COMPILE}
  
  lock.o: ${LWP}/lock.c
Index: openafs/src/ubik/beacon.c
diff -c openafs/src/ubik/beacon.c:1.9.2.2 openafs/src/ubik/beacon.c:1.9.2.3
*** openafs/src/ubik/beacon.c:1.9.2.2	Sat Oct 13 00:21:56 2001
--- openafs/src/ubik/beacon.c	Sun Mar 30 02:44:38 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/beacon.c,v 1.9.2.2 2001/10/13 04:21:56 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/ubik/beacon.c,v 1.9.2.3 2003/03/30 07:44:38 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 455,461 ****
      afs_uint32 aservers[]; 	/* list of all possible server addresses */
  {
      afs_uint32	myAddr[UBIK_MAX_INTERFACE_ADDR], *servList, tmpAddr;
!     int 	count, found, i, j, totalServers, start, end;
  
      if (info)
          totalServers = info->numServers;
--- 455,462 ----
      afs_uint32 aservers[]; 	/* list of all possible server addresses */
  {
      afs_uint32	myAddr[UBIK_MAX_INTERFACE_ADDR], *servList, tmpAddr;
!     afs_uint32  myAddr2[UBIK_MAX_INTERFACE_ADDR];
!     int 	count, found, i, j, totalServers, start, end, usednetfiles = 0;
  
      if (info)
          totalServers = info->numServers;
***************
*** 484,489 ****
--- 485,491 ----
  	ubik_print("Aborting..\n");
  	return UBADHOST;
        }
+       usednetfiles++;
      }
      else {
        /* get all my interface addresses in net byte order */
***************
*** 511,517 ****
      {
  	ubik_print("ubik: primary address %s does not exist\n",
  			afs_inet_ntoa(*ame));
! 	return UBADHOST;
      }
  
      /* if any of my addresses are there in serverList, then
--- 513,544 ----
      {
  	ubik_print("ubik: primary address %s does not exist\n",
  			afs_inet_ntoa(*ame));
! 	/* if we had the result of rx_getAllAddr already, avoid subverting
! 	   the "is gethostbyname(gethostname()) us" check. If we're
! 	   using NetInfo/NetRestrict, we assume they have enough clue
! 	   to avoid that big hole in their foot from the loaded gun. */
! 	if (usednetfiles) {
! 	    /* take the address we did get, then see if ame was masked */
! 	    *ame=myAddr[0];
! 	    count = rx_getAllAddr(myAddr2, UBIK_MAX_INTERFACE_ADDR); 
! 	    if ( count <= 0 )           /* no address found */
! 	    {
! 		ubik_print("ubik: No network addresses found, aborting..");
! 		return UBADHOST;
! 	    }
! 	    
! 	    /* verify that the My-address passed in by ubik is correct */
! 	    for ( j=0, found = 0; j < count; j++)
! 	    {
! 		if ( *ame == myAddr2[j] ) /* both in net byte order */
! 		{
! 		    found = 1;
! 		    break;
! 		}
! 	    }
! 	}
! 	if ( !found )
! 	    return UBADHOST;
      }
  
      /* if any of my addresses are there in serverList, then
Index: openafs/src/uss/uss_fs.c
diff -c openafs/src/uss/uss_fs.c:1.5 openafs/src/uss/uss_fs.c:1.5.2.1
*** openafs/src/uss/uss_fs.c:1.5	Tue Aug  7 20:04:15 2001
--- openafs/src/uss/uss_fs.c	Sat Jan 11 02:42:38 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_fs.c,v 1.5 2001/08/08 00:04:15 shadow Exp $");
  
  #include "uss_fs.h"		/*Interface to this module*/
  #include <sys/types.h>
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_fs.c,v 1.5.2.1 2003/01/11 07:42:38 shadow Exp $");
  
  #include "uss_fs.h"		/*Interface to this module*/
  #include <sys/types.h>
***************
*** 28,37 ****
  #ifdef	AFS_SUN5_ENV
  #include <sys/ioccom.h>
  #endif
  #include <netinet/in.h>
  #include <afs/venus.h>
  #include "uss_common.h"
! extern int errno;
  
  
  /*
--- 28,38 ----
  #ifdef	AFS_SUN5_ENV
  #include <sys/ioccom.h>
  #endif
+ #include <errno.h>
  #include <netinet/in.h>
  #include <afs/venus.h>
  #include "uss_common.h"
! 
  
  
  /*
Index: openafs/src/uss/uss_kauth.c
diff -c openafs/src/uss/uss_kauth.c:1.5 openafs/src/uss/uss_kauth.c:1.5.2.1
*** openafs/src/uss/uss_kauth.c:1.5	Tue Aug  7 20:04:15 2001
--- openafs/src/uss/uss_kauth.c	Sat Jan 11 02:42:38 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_kauth.c,v 1.5 2001/08/08 00:04:15 shadow Exp $");
  
  #include "uss_kauth.h"		/*Module interface*/
  #include "uss_common.h"		/*Common defs & operations*/
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_kauth.c,v 1.5.2.1 2003/01/11 07:42:38 shadow Exp $");
  
  #include "uss_kauth.h"		/*Module interface*/
  #include "uss_common.h"		/*Common defs & operations*/
***************
*** 28,34 ****
  #include <afs/kautils.h>	/*MAXKTCREALMLEN*/
  #include <afs/kaport.h>         /* pack_long */
  
- extern int errno;
  extern afs_int32 KAM_CreateUser();
  
  #define uss_kauth_MAX_SIZE	2048
--- 28,33 ----
Index: openafs/src/uss/uss_procs.c
diff -c openafs/src/uss/uss_procs.c:1.5 openafs/src/uss/uss_procs.c:1.5.2.1
*** openafs/src/uss/uss_procs.c:1.5	Tue Aug  7 20:04:15 2001
--- openafs/src/uss/uss_procs.c	Sat Jan 11 02:42:38 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_procs.c,v 1.5 2001/08/08 00:04:15 shadow Exp $");
  
  #include "uss_procs.h"		/*Module interface*/
  #include "uss_common.h"		/*Common defs & operations*/
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_procs.c,v 1.5.2.1 2003/01/11 07:42:38 shadow Exp $");
  
  #include "uss_procs.h"		/*Module interface*/
  #include "uss_common.h"		/*Common defs & operations*/
***************
*** 33,39 ****
  #endif
  #include <afs/kautils.h>	/*MAXKTCREALMLEN*/
  
- extern int errno;
  
  #undef USS_PROCS_DB
  #undef USS_PROCS_DB_INSTANCE
--- 33,38 ----
Index: openafs/src/uss/uss_ptserver.c
diff -c openafs/src/uss/uss_ptserver.c:1.5 openafs/src/uss/uss_ptserver.c:1.5.2.1
*** openafs/src/uss/uss_ptserver.c:1.5	Tue Aug  7 20:04:15 2001
--- openafs/src/uss/uss_ptserver.c	Sat Jan 11 02:42:38 2003
***************
*** 18,31 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_ptserver.c,v 1.5 2001/08/08 00:04:15 shadow Exp $");
  
  #include "uss_ptserver.h"	/*Module interface*/
  #include <afs/ptclient.h>	/*Protection Server client interface*/
  #include <afs/pterror.h>	/*Protection Server error codes*/
  #include <afs/com_err.h>	/*Error code xlation*/
  
- extern int errno;
  
  #undef USS_PTSERVER_DB
  
--- 18,30 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_ptserver.c,v 1.5.2.1 2003/01/11 07:42:38 shadow Exp $");
  
  #include "uss_ptserver.h"	/*Module interface*/
  #include <afs/ptclient.h>	/*Protection Server client interface*/
  #include <afs/pterror.h>	/*Protection Server error codes*/
  #include <afs/com_err.h>	/*Error code xlation*/
  
  
  #undef USS_PTSERVER_DB
  
Index: openafs/src/uss/uss_vol.c
diff -c openafs/src/uss/uss_vol.c:1.5.2.1 openafs/src/uss/uss_vol.c:1.5.2.2
*** openafs/src/uss/uss_vol.c:1.5.2.1	Mon Sep  9 13:01:12 2002
--- openafs/src/uss/uss_vol.c	Sat Jan 11 02:42:38 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_vol.c,v 1.5.2.1 2002/09/09 17:01:12 shadow Exp $");
  
  #include "uss_vol.h"		/*Interface to this module*/
  #include "uss_common.h"		/*Common definitions*/
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/uss/uss_vol.c,v 1.5.2.2 2003/01/11 07:42:38 shadow Exp $");
  
  #include "uss_vol.h"		/*Interface to this module*/
  #include "uss_common.h"		/*Common definitions*/
***************
*** 27,33 ****
  #include <sys/stat.h>
  #include <pwd.h>
  #include <netdb.h>
! #include <sys/errno.h>
  #include <afs/vlserver.h>
  #include <afs/auth.h>
  #include <afs/cellconfig.h>
--- 27,33 ----
  #include <sys/stat.h>
  #include <pwd.h>
  #include <netdb.h>
! #include <errno.h>
  #include <afs/vlserver.h>
  #include <afs/auth.h>
  #include <afs/cellconfig.h>
***************
*** 38,44 ****
  #include <afs/keys.h>
  #include <ubik.h>
  
- extern int errno;
  extern struct rx_connection *UV_Bind();
  extern  struct rx_securityClass *rxnull_NewClientSecurityObject();
  extern int line;
--- 38,43 ----
Index: openafs/src/util/Makefile.in
diff -c openafs/src/util/Makefile.in:1.6.2.1 openafs/src/util/Makefile.in:1.6.2.2
*** openafs/src/util/Makefile.in:1.6.2.1	Sat Oct 13 00:22:10 2001
--- openafs/src/util/Makefile.in	Fri Jan 31 16:08:58 2003
***************
*** 60,65 ****
--- 60,66 ----
  	${TOP_INCDIR}/afs/pthread_glock.h \
  	${TOP_INCDIR}/afs/afs_atomlist.h \
  	${TOP_INCDIR}/afs/afs_lhash.h \
+ 	${TOP_INCDIR}/afs/softsig.h \
  	${TOP_INCDIR}/potpourri.h \
  	${TOP_LIBDIR}/util.a \
  	${TOP_LIBDIR}/libafsutil.a \
***************
*** 157,162 ****
--- 158,164 ----
  	${DESTDIR}${includedir}/afs/pthread_glock.h \
  	${DESTDIR}${includedir}/afs/afs_atomlist.h \
  	${DESTDIR}${includedir}/afs/afs_lhash.h \
+ 	${DESTDIR}${includedir}/afs/softsig.h \
  	${DESTDIR}${includedir}/potpourri.h \
  	${DESTDIR}${libdir}/afs/util.a \
  	${DESTDIR}${libdir}/afs/libafsutil.a \
***************
*** 204,209 ****
--- 206,214 ----
  ${TOP_INCDIR}/afs/afs_lhash.h: afs_lhash.h
  	${INSTALL} $? $@
  
+ ${TOP_INCDIR}/afs/softsig.h: softsig.h
+ 	${INSTALL} $? $@
+ 
  ${TOP_INCDIR}/potpourri.h: potpourri.h
  	${INSTALL} $? $@
  
***************
*** 257,262 ****
--- 262,270 ----
  ${DESTDIR}${includedir}/afs/afs_lhash.h: afs_lhash.h
  	${INSTALL} $? $@
  
+ ${DESTDIR}${includedir}/afs/softsig.h: softsig.h
+ 	${INSTALL} $? $@
+ 
  ${DESTDIR}${includedir}/potpourri.h: potpourri.h
  	${INSTALL} $? $@
  
***************
*** 314,319 ****
--- 322,330 ----
  ${DEST}/include/afs/afs_lhash.h: afs_lhash.h
  	${INSTALL} $? $@
  
+ ${DEST}/include/afs/softsig.h: softsig.h
+ 	${INSTALL} $? $@
+ 
  ${DEST}/include/potpourri.h: potpourri.h
  	${INSTALL} $? $@
  
***************
*** 456,461 ****
--- 467,473 ----
  	${DEST}/include/afs/pthread_glock.h \
  	${DEST}/include/afs/afs_atomlist.h \
  	${DEST}/include/afs/afs_lhash.h \
+ 	${DEST}/include/afs/softsig.h \
  	${DEST}/include/potpourri.h \
  	${DEST}/lib/afs/util.a \
  	${DEST}/lib/afs/libafsutil.a \
Index: openafs/src/util/assert.h
diff -c openafs/src/util/assert.h:1.3 openafs/src/util/assert.h:1.3.4.1
*** openafs/src/util/assert.h:1.3	Thu Jul  5 11:21:05 2001
--- openafs/src/util/assert.h	Fri Jan 31 16:11:21 2003
***************
*** 12,15 ****
  
  void AssertionFailed(char *file, int line);
  
! # define assert(ex) {if (!(ex)) AssertionFailed(__FILE__, __LINE__);}
--- 12,15 ----
  
  void AssertionFailed(char *file, int line);
  
! #define assert(ex) do{if (!(ex)) AssertionFailed(__FILE__, __LINE__);}while(0)
Index: openafs/src/util/pthread_nosigs.h
diff -c openafs/src/util/pthread_nosigs.h:1.2 openafs/src/util/pthread_nosigs.h:1.2.8.1
*** openafs/src/util/pthread_nosigs.h:1.2	Sat Nov  4 05:06:06 2000
--- openafs/src/util/pthread_nosigs.h	Fri Apr 11 13:50:48 2003
***************
*** 27,35 ****
--- 27,71 ----
  #else
  #define AFS_SET_SIGMASK pthread_sigmask
  #endif
+ #ifdef SIGSEGV 
+ #define _SETSEGV sigdelset(&i_tset, SIGSEGV); 
+ #else
+ #define _SETSEGV ;
+ #endif 
+ #ifdef SIGBUS 
+ #define _SETBUS sigdelset(&i_tset, SIGBUS); 
+ #else 
+ #define _SETBUS ;
+ #endif 
+ #ifdef SIGILL 
+ #define _SETILL sigdelset(&i_tset, SIGILL); 
+ #else
+ #define _SETILL ;
+ #endif 
+ #ifdef SIGTRAP 
+ #define _SETTRAP sigdelset(&i_tset, SIGTRAP); 
+ #else
+ #define _SETTRAP ;
+ #endif 
+ #ifdef SIGABRT 
+ #define _SETABRT sigdelset(&i_tset, SIGABRT); 
+ #else
+ #define _SETABRT ;
+ #endif 
+ #ifdef SIGFPE 
+ #define _SETFPE sigdelset(&i_tset, SIGFPE); 
+ #else
+ #define _SETFPE ;
+ #endif 
  #define AFS_SIGSET_CLEAR() \
  do { \
  	 sigfillset(&i_tset); \
+          _SETSEGV \
+          _SETBUS \
+          _SETILL \
+          _SETTRAP \
+          _SETABRT \
+          _SETFPE \
  	 assert(AFS_SET_SIGMASK(SIG_BLOCK, &i_tset, &i_oset) == 0); \
  } while (0)
  
Index: openafs/src/util/secutil_nt.c
diff -c openafs/src/util/secutil_nt.c:1.3 openafs/src/util/secutil_nt.c:1.3.4.1
*** openafs/src/util/secutil_nt.c:1.3	Thu Jul  5 11:21:06 2001
--- openafs/src/util/secutil_nt.c	Fri Mar 14 14:49:03 2003
***************
*** 9,20 ****
  
  /* Security related utilities for the Windows platform */
  
! #include <param.h>
  #include <afsconfig.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/secutil_nt.c,v 1.3 2001/07/05 15:21:06 shadow Exp $");
  
! #include <stds.h>
  
  #include <stddef.h>
  #include <stdlib.h>
--- 9,20 ----
  
  /* Security related utilities for the Windows platform */
  
! #include <afs/param.h>
  #include <afsconfig.h>
  
! RCSID("$Header: /data/cvs/openafs/src/util/secutil_nt.c,v 1.3.4.1 2003/03/14 19:49:03 shadow Exp $");
  
! #include <afs/stds.h>
  
  #include <stddef.h>
  #include <stdlib.h>
Index: openafs/src/util/softsig.c
diff -c /dev/null openafs/src/util/softsig.c:1.1.2.1
*** /dev/null	Fri Apr 11 14:44:22 2003
--- openafs/src/util/softsig.c	Fri Jan 31 16:08:58 2003
***************
*** 0 ****
--- 1,95 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  *
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #define _POSIX_PTHREAD_SEMANTICS
+ #include <assert.h>
+ #include <stdio.h>
+ #include <signal.h>
+ #include <pthread.h>
+ #include <unistd.h>
+ 
+ static pthread_t softsig_tid;
+ static struct {
+   void (*handler) (int);
+   int pending;
+ } softsig_sigs[NSIG];
+ 
+ static void *
+ softsig_thread (void *arg)
+ {
+   sigset_t ss;
+ 
+   sigemptyset (&ss);
+   sigaddset (&ss, SIGUSR1);
+ 
+   while (1) {
+     void (*h) (int) = NULL;
+     int i, sigw;
+ 
+     for (i = 0; i < NSIG; i++)
+       if (softsig_sigs[i].pending) {
+ 	softsig_sigs[i].pending = 0;
+ 	h = softsig_sigs[i].handler;
+ 	break;
+       }
+ 
+     if (i == NSIG)
+       assert (0 == sigwait (&ss, &sigw));
+     else if (h)
+       h (i);
+   }
+ }
+ 
+ void
+ softsig_init ()
+ {
+   sigset_t ss, os;
+ 
+   sigemptyset (&ss);
+   sigaddset (&ss, SIGUSR1);
+ 
+   /* Set mask right away, so we don't accidentally SIGUSR1 the
+    * softsig thread and cause an exit (default action).
+    */
+   assert (0 == pthread_sigmask (SIG_BLOCK, &ss, &os));
+   assert (0 == pthread_create (&softsig_tid, NULL, &softsig_thread, NULL));
+   assert (0 == pthread_sigmask (SIG_SETMASK, &os, NULL));
+ }
+ 
+ static void
+ softsig_handler (int signo)
+ {
+   softsig_sigs[signo].pending = 1;
+   pthread_kill (softsig_tid, SIGUSR1);
+ }
+ 
+ void
+ softsig_signal (int signo, void (*handler) (int))
+ {
+   softsig_sigs[signo].handler = handler;
+   signal (signo, softsig_handler);
+ }
+ 
+ #if defined(TEST)
+ static void
+ print_foo (int signo)
+ {
+   printf ("foo, signo = %d, tid = %d\n", signo, pthread_self ());
+ }
+ 
+ int
+ main ()
+ {
+   softsig_init ();
+   softsig_signal (SIGINT, print_foo);
+   printf ("main is tid %d\n", pthread_self ());
+   while (1)
+     sleep (60);
+ }
+ #endif
Index: openafs/src/util/softsig.h
diff -c /dev/null openafs/src/util/softsig.h:1.1.2.1
*** /dev/null	Fri Apr 11 14:44:22 2003
--- openafs/src/util/softsig.h	Fri Jan 31 16:08:58 2003
***************
*** 0 ****
--- 1,16 ----
+ /*
+  * 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 _SOFTSIG_H
+ #define _SOFTSIG_H
+ 
+ void softsig_init ();
+ void softsig_signal (int signo, void (*handler) (int));
+ 
+ #endif
Index: openafs/src/venus/cmdebug.c
diff -c openafs/src/venus/cmdebug.c:1.5 openafs/src/venus/cmdebug.c:1.5.2.1
*** openafs/src/venus/cmdebug.c:1.5	Tue Aug  7 20:04:18 2001
--- openafs/src/venus/cmdebug.c	Thu Mar  6 09:53:50 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/cmdebug.c,v 1.5 2001/08/08 00:04:18 shadow Exp $");
  
  
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/cmdebug.c,v 1.5.2.1 2003/03/06 14:53:50 shadow Exp $");
  
  
  #include <sys/types.h>
***************
*** 89,100 ****
      return 0;
  }
  
! static PrintCacheEntries(aconn, aint32)
! int aint32;
! register struct rx_connection *aconn; {
      register int i;
      register afs_int32 code;
      struct AFSDBCacheEntry centry;
  
      for(i=0;i<10000;i++) {
  	code = RXAFSCB_GetCE(aconn, i, &centry);
--- 89,143 ----
      return 0;
  }
  
! struct cell_cache {
!     afs_int32 cellnum;
!     char *cellname;
!     struct cell_cache *next;
! };
! 
! static char *GetCellName(struct rx_connection *aconn, afs_int32 cellnum)
! {
!     static int no_getcellbynum;
!     static struct cell_cache *cache;
!     struct cell_cache *tcp;
!     int code;
!     char *cellname;
!     serverList sl;
! 
!     if (no_getcellbynum)
! 	return NULL;
! 
!     for (tcp = cache; tcp; tcp = tcp->next)
! 	if (tcp->cellnum == cellnum)
! 	    return tcp->cellname;
! 
!     cellname = NULL;
!     sl.serverList_len = 0;
!     sl.serverList_val = NULL;
!     code = RXAFSCB_GetCellByNum(aconn, cellnum, &cellname, &sl);
!     if (code) {
! 	if (code == RXGEN_OPCODE)
! 	    no_getcellbynum = 1;
! 	return NULL;
!     }
! 
!     if (sl.serverList_val)
! 	free (sl.serverList_val);
!     tcp = malloc(sizeof(struct cell_cache));
!     tcp->next = cache;
!     tcp->cellnum = cellnum;
!     tcp->cellname = cellname;
!     cache = tcp;
! 
!     return cellname;
! }
! 
! static PrintCacheEntries(struct rx_connection *aconn, int aint32)
! {
      register int i;
      register afs_int32 code;
      struct AFSDBCacheEntry centry;
+     char *cellname;
  
      for(i=0;i<10000;i++) {
  	code = RXAFSCB_GetCE(aconn, i, &centry);
***************
*** 115,122 ****
  	if (!aint32 && !IsLocked(&centry.lock)) continue;
  
  	/* otherwise print this entry */
! 	printf("** Cache entry @ 0x%08x for %d.%d.%d.%d\n", centry.addr, centry.cell,
! 	       centry.netFid.Volume, centry.netFid.Vnode, centry.netFid.Unique);
  	if (IsLocked(&centry.lock)) {
  	    printf("    locks: ");
  	    PrintLock(&centry.lock);
--- 158,173 ----
  	if (!aint32 && !IsLocked(&centry.lock)) continue;
  
  	/* otherwise print this entry */
! 	printf("** Cache entry @ 0x%08x for %d.%d.%d.%d", centry.addr,
! 	       centry.cell, centry.netFid.Volume, centry.netFid.Vnode,
! 	       centry.netFid.Unique);
! 
! 	cellname = GetCellName(aconn, centry.cell);
! 	if (cellname)
! 	    printf(" [%s]\n", cellname);
! 	else
! 	    printf("\n");
! 
  	if (IsLocked(&centry.lock)) {
  	    printf("    locks: ");
  	    PrintLock(&centry.lock);
Index: openafs/src/venus/fs.c
diff -c openafs/src/venus/fs.c:1.12.2.2 openafs/src/venus/fs.c:1.12.2.3
*** openafs/src/venus/fs.c:1.12.2.2	Tue Aug 27 23:53:33 2002
--- openafs/src/venus/fs.c	Sat Jan 11 02:42:38 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/fs.c,v 1.12.2.2 2002/08/28 03:53:33 zacheiss Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/fs.c,v 1.12.2.3 2003/01/11 07:42:38 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
***************
*** 66,72 ****
  extern struct hostent *hostutil_GetHostByName();
  extern afs_int32 VL_GetEntryByNameO();
  
! extern int errno;
  extern struct cmd_syndesc *cmd_CreateSyntax();
  static char pn[] = "fs";
  static int rxInitDone = 0;
--- 66,72 ----
  extern struct hostent *hostutil_GetHostByName();
  extern afs_int32 VL_GetEntryByNameO();
  
! 
  extern struct cmd_syndesc *cmd_CreateSyntax();
  static char pn[] = "fs";
  static int rxInitDone = 0;
Index: openafs/src/venus/fstrace.c
diff -c openafs/src/venus/fstrace.c:1.7.2.1 openafs/src/venus/fstrace.c:1.7.2.2
*** openafs/src/venus/fstrace.c:1.7.2.1	Sun Apr 21 17:05:46 2002
--- openafs/src/venus/fstrace.c	Sat Jan 11 02:42:38 2003
***************
*** 13,19 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/fstrace.c,v 1.7.2.1 2002/04/21 21:05:46 zacheiss Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 13,19 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/fstrace.c,v 1.7.2.2 2003/01/11 07:42:38 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 2104,2114 ****
      }
  #if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV)
      /* on sparc this function returns none value, so do it myself */
!     __asm__ __volatile__ ("
! 	mov	%o0, %i0
! 	ret
! 	restore
! ");
  #endif
  #else
  #if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV)
--- 2104,2113 ----
      }
  #if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV)
      /* on sparc this function returns none value, so do it myself */
!     __asm__ __volatile__ (
! 			  "mov	%o0, %i0\n\t"
! 			  "ret\n\t"
! 			  "restore");
  #endif
  #else
  #if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV)
Index: openafs/src/venus/kdump.c
diff -c openafs/src/venus/kdump.c:1.14.2.5 openafs/src/venus/kdump.c:1.14.2.7
*** openafs/src/venus/kdump.c:1.14.2.5	Wed Jul 31 18:19:52 2002
--- openafs/src/venus/kdump.c	Thu Mar  6 09:53:50 2003
***************
*** 10,18 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/kdump.c,v 1.14.2.5 2002/07/31 22:19:52 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>	/* for malloc() */
  
  #ifdef AFS_LINUX24_ENV
--- 10,19 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/kdump.c,v 1.14.2.7 2003/03/06 14:53:50 shadow Exp $");
  
  #include <stdio.h>
+ #include <errno.h>
  #include <stdlib.h>	/* for malloc() */
  
  #ifdef AFS_LINUX24_ENV
***************
*** 518,524 ****
  #ifndef AFS_KDUMP_LIB
  extern struct cmd_syndesc *cmd_CreateSyntax();
  #endif
- extern int errno;
  int opencore();
  
  /* Note: this should agree with the definition in afs_buffer.c */
--- 519,524 ----
***************
*** 1053,1058 ****
--- 1053,1060 ----
  
      if (Dcells || Dall) {
  	print_cells(1);	/* Handle the afs_cells structures */
+ 	print_cellaliases(1);
+ 	print_cellnames(1);
      }
  
      if (Dusers || Dall) {
***************
*** 1170,1175 ****
--- 1172,1178 ----
  #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  int Sum_cellnames=0, Sum_userstp=0, Sum_volnames=0, Sum_exps=0, Sum_nfssysnames=0;
  int Sum_vcachemvids=0, Sum_vcachelinkData=0, Sum_vcacheacc=0, Sum_vcachelocks=0;
+ int Sum_cellaliases=0, Sum_cellname_names=0;
  
  int print_cells(pnt)
  int pnt;
***************
*** 1193,1198 ****
--- 1196,1259 ----
  	j++;
      }
      if (pnt) printf("... found %d 'afs_cells' entries\n", j);
+ 
+     return j;
+ }
+ 
+ int print_cellaliases(int pnt)
+ {
+     off_t symoff;
+     struct cell_alias *ca, cae;
+     long j = 0;
+ 
+     if (pnt) printf("\n\nPrinting cell_alias list...\n");
+     findsym( "afs_cellalias_head", &symoff);
+     kread(kmem, symoff, (char *) &ca, sizeof ca);
+     while (ca) {
+ 	char alias[100], cell[100];
+ 
+ 	kread(kmem, (off_t) ca, (char *) &cae, sizeof cae);
+ 	kread(kmem, (off_t) cae.alias, alias, (KDUMP_SIZE_T)40);
+ 	alias[40] = '\0';
+ 	Sum_cellaliases += strlen(alias) + 1;
+ 	kread(kmem, (off_t) cae.cell, cell, (KDUMP_SIZE_T)40);
+ 	cell[40] = '\0';
+ 	Sum_cellaliases += strlen(cell) + 1;
+ 	if (pnt)
+ 	    printf("%x: alias=%s cell=%s index=%d\n",
+ 		   ca, alias, cell, cae.index);
+ 	ca = cae.next;
+ 	j++;
+     }
+     if (pnt) printf("... found %d 'cell_alias' entries\n", j);
+ 
+     return j;
+ }
+ 
+ int print_cellnames(int pnt)
+ {
+     off_t symoff;
+     struct cell_name *cn, cne;
+     long j = 0;
+ 
+     if (pnt) printf("\n\nPrinting cell_name list...\n");
+     findsym( "afs_cellname_head", &symoff);
+     kread(kmem, symoff, (char *) &cn, sizeof cn);
+     while (cn) {
+ 	char cellname[100];
+ 
+ 	kread(kmem, (off_t) cn, (char *) &cne, sizeof cne);
+ 	kread(kmem, (off_t) cne.cellname, cellname, (KDUMP_SIZE_T)40);
+ 	cellname[40] = '\0';
+ 	Sum_cellname_names += strlen(cellname) + 1;
+ 	if (pnt)
+ 	    printf("%x: cellnum=%d cellname=%s used=%d\n",
+ 		   cn, cne.cellnum, cellname, cne.used);
+ 	cn = cne.next;
+ 	j++;
+     }
+     if (pnt) printf("... found %d 'cell_name' entries\n", j);
+ 
      return j;
  }
  
***************
*** 1761,1766 ****
--- 1822,1839 ----
      T += j;
      printf("%20s:\t%8d bytes\t[%d cells/%d bytes each + %d bytes for cell names]\n", "Cell package", j, i, sizeof(struct cell), Sum_cellnames);
  
+     Sum_cellaliases=0;
+     i = print_cellaliases(0);
+     j = (i * sizeof(struct cell_alias)) + Sum_cellaliases;
+     T += j;
+     printf("%20s:\t%8d bytes\t[%d cell_aliases/%d bytes each + %d bytes for cell names]\n", "Cell package", j, i, sizeof(struct cell_alias), Sum_cellaliases);
+ 
+     Sum_cellname_names=0;
+     i = print_cellnames(0);
+     j = (i * sizeof(struct cell_name)) + Sum_cellname_names;
+     T += j;
+     printf("%20s:\t%8d bytes\t[%d cell_names/%d bytes each + %d bytes for cell name strings]\n", "Cell package", j, i, sizeof(struct cell_name), Sum_cellname_names);
+ 
      Sum_userstp=0;
      i = print_users(0);
      j = (i * sizeof(struct unixuser)) + Sum_userstp;
***************
*** 2268,2276 ****
      cellName[40] = 0;
      Sum_cellnames += strlen(cellName)+1;
      if (pnt) {
! 	printf("%lx: cell=%s, cellname=%s, states=%x, cindex=%d fsport=%d vlport=%d\n", ptr,
! 	       PrintIPAddr(clep->cell), cellName, clep->states, clep->cellIndex,
! 	       clep->fsport, clep->vlport);
  #ifdef	AFS33
  	if (clep->lcellp)
  	    printf("\tlinked cellp %lx\n", clep->lcellp);
--- 2341,2350 ----
      cellName[40] = 0;
      Sum_cellnames += strlen(cellName)+1;
      if (pnt) {
! 	printf("%lx: cellname=%s, states=%x, cnum=%d, cindex=%d fsport=%d vlport=%d timeout=%d cnamep=%x\n", ptr,
! 	       cellName, clep->states, clep->cellNum, clep->cellIndex,
! 	       clep->fsport, clep->vlport, clep->timeout, clep->cnamep);
! 
  #ifdef	AFS33
  	if (clep->lcellp)
  	    printf("\tlinked cellp %lx\n", clep->lcellp);
Index: openafs/src/venus/twiddle.c
diff -c openafs/src/venus/twiddle.c:1.4 openafs/src/venus/twiddle.c:1.4.4.1
*** openafs/src/venus/twiddle.c:1.4	Thu Jul 12 15:59:27 2001
--- openafs/src/venus/twiddle.c	Sat Jan 11 02:42:39 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/twiddle.c,v 1.4 2001/07/12 19:59:27 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/twiddle.c,v 1.4.4.1 2003/01/11 07:42:39 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
***************
*** 30,36 ****
  #undef VICE
  #include "afs/prs_fs.h"
  #include <afs/afsint.h>
! #include <afs/auth.h>
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include <strings.h>
--- 30,37 ----
  #undef VICE
  #include "afs/prs_fs.h"
  #include <afs/afsint.h>
! #include <afs/auth.h>>
! #include <errno.h
  #include <afs/cellconfig.h>
  #include <afs/cmd.h>
  #include <strings.h>
***************
*** 44,50 ****
  static char tspace[1024];
  static struct ubik_client *uclient;
  
! extern int errno;
  extern struct cmd_syndesc *cmd_CreateSyntax();
  static char pn[] = "fs";
  static int rxInitDone = 0;
--- 45,51 ----
  static char tspace[1024];
  static struct ubik_client *uclient;
  
! 
  extern struct cmd_syndesc *cmd_CreateSyntax();
  static char pn[] = "fs";
  static int rxInitDone = 0;
Index: openafs/src/venus/test/owntest.c
diff -c openafs/src/venus/test/owntest.c:1.4 openafs/src/venus/test/owntest.c:1.4.4.2
*** openafs/src/venus/test/owntest.c:1.4	Thu Jul 12 15:59:28 2001
--- openafs/src/venus/test/owntest.c	Wed Apr  9 12:33:32 2003
***************
*** 10,21 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/test/owntest.c,v 1.4 2001/07/12 19:59:28 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/file.h>
  #include <sys/stat.h>
  #include <sys/time.h>
  
  extern int errno;
  
--- 10,22 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/venus/test/owntest.c,v 1.4.4.2 2003/04/09 16:33:32 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/file.h>
  #include <sys/stat.h>
  #include <sys/time.h>
+ #include <errno.h>
  
  extern int errno;
  
***************
*** 35,45 ****
      pn = argv[1];
      printf("Starting tests on %s.\n", pn);
      code = chmod(pn, 0444);
!     if (code<0)
! 	return perror("chmod to RO");
      code = chmod(pn, 0666);
!     if (code<0)
! 	return perror("chmod back to RW");
      gettimeofday(&tv[0], (char *) 0);
      gettimeofday(&tv[1], (char *) 0);
      tv[0].tv_sec -= 10000;
--- 36,50 ----
      pn = argv[1];
      printf("Starting tests on %s.\n", pn);
      code = chmod(pn, 0444);
!     if (code<0) {
!         perror("chmod to RO");
! 	return 1;
!     }
      code = chmod(pn, 0666);
!     if (code<0) {
!         perror("chmod back to RW");
!         return 1;
!     }
      gettimeofday(&tv[0], (char *) 0);
      gettimeofday(&tv[1], (char *) 0);
      tv[0].tv_sec -= 10000;
***************
*** 47,57 ****
      tv[1].tv_sec -= 20000;
      tv[1].tv_usec = 0;
      code = utimes(pn, tv);
!     if (code<0)
! 	return perror("utimes");
      code = stat(pn, &tstat);
!     if (code<0)
! 	return perror("stat");
      if (tstat.st_mtime != tv[1].tv_sec) {
  	printf("modtime didn't stick\n");
  	exit(1);
--- 52,66 ----
      tv[1].tv_sec -= 20000;
      tv[1].tv_usec = 0;
      code = utimes(pn, tv);
!     if (code<0) {
!         perror("utimes");
!         return 1;
!     }
      code = stat(pn, &tstat);
!     if (code<0) {
!         perror("stat");
! 	return 1;
!     }
      if (tstat.st_mtime != tv[1].tv_sec) {
  	printf("modtime didn't stick\n");
  	exit(1);
Index: openafs/src/vfsck/setup.c
diff -c openafs/src/vfsck/setup.c:1.4.2.3 openafs/src/vfsck/setup.c:1.4.2.4
*** openafs/src/vfsck/setup.c:1.4.2.3	Sat Oct 13 00:22:10 2001
--- openafs/src/vfsck/setup.c	Fri Mar 28 16:27:18 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vfsck/setup.c,v 1.4.2.3 2001/10/13 04:22:10 shadow Exp $");
  
  #include <stdio.h>
  #define VICE
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vfsck/setup.c,v 1.4.2.4 2003/03/28 21:27:18 shadow Exp $");
  
  #include <stdio.h>
  #define VICE
***************
*** 673,679 ****
--- 673,683 ----
  		return (1);
  	}
  	altsblock.fs_link = sblock.fs_link;
+ #ifdef STRUCT_FS_HAS_FS_ROLLED
+ 	altsblock.fs_rolled = sblock.fs_rolled;
+ #else
  	altsblock.fs_rlink = sblock.fs_rlink;
+ #endif
  	altsblock.fs_time = sblock.fs_time;
  	altsblock.fs_cstotal = sblock.fs_cstotal;
  	altsblock.fs_cgrotor = sblock.fs_cgrotor;
Index: openafs/src/viced/Makefile.in
diff -c openafs/src/viced/Makefile.in:1.4 openafs/src/viced/Makefile.in:1.4.2.1
*** openafs/src/viced/Makefile.in:1.4	Fri Sep  7 19:36:08 2001
--- openafs/src/viced/Makefile.in	Mon Jan 13 18:47:24 2003
***************
*** 107,113 ****
  
  ${DEST}/root.server/usr/afs/bin/fileserver: fileserver
  	@case ${SYS_NAME} in \
! 	alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*) \
  	echo "Don't install fileserver for ${SYS_NAME}" ;; \
  	*) \
  	echo ${INSTALL} -ns $? $@ ; \
--- 107,113 ----
  
  ${DEST}/root.server/usr/afs/bin/fileserver: fileserver
  	@case ${SYS_NAME} in \
! 	alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun*) \
  	echo "Don't install fileserver for ${SYS_NAME}" ;; \
  	*) \
  	echo ${INSTALL} -ns $? $@ ; \
***************
*** 125,131 ****
  include ../config/Makefile.version
  ${DESTDIR}${afssrvlibexecdir}/fileserver: fileserver
  	@case ${SYS_NAME} in \
! 	alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*) \
  	echo "Don't install fileserver for ${SYS_NAME}" ;; \
  	*) \
  	echo ${INSTALL} -ns $? $@ ; \
--- 125,131 ----
  include ../config/Makefile.version
  ${DESTDIR}${afssrvlibexecdir}/fileserver: fileserver
  	@case ${SYS_NAME} in \
! 	alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun*) \
  	echo "Don't install fileserver for ${SYS_NAME}" ;; \
  	*) \
  	echo ${INSTALL} -ns $? $@ ; \
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.10.2.8 openafs/src/viced/afsfileprocs.c:1.10.2.11
*** openafs/src/viced/afsfileprocs.c:1.10.2.8	Thu Nov 14 16:37:26 2002
--- openafs/src/viced/afsfileprocs.c	Fri Mar 28 04:17:18 2003
***************
*** 28,34 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/afsfileprocs.c,v 1.10.2.8 2002/11/14 21:37:26 zacheiss Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 28,34 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/afsfileprocs.c,v 1.10.2.11 2003/03/28 09:17:18 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 266,278 ****
  static CallPreamble(acall, activecall)
      register struct rx_call **acall;
      int activecall;
- 
  {
      struct host *thost;
      struct rx_connection *tconn;
      struct client *tclient;
      int retry_flag=1;
      int code = 0;
      tconn = rx_ConnectionOf(*acall);
      *acall = (struct rx_call *)tconn;	    /* change it! */
  
--- 266,279 ----
  static CallPreamble(acall, activecall)
      register struct rx_call **acall;
      int activecall;
  {
      struct host *thost;
      struct rx_connection *tconn;
      struct client *tclient;
      int retry_flag=1;
      int code = 0;
+     char hoststr[16];
+ 
      tconn = rx_ConnectionOf(*acall);
      *acall = (struct rx_call *)tconn;	    /* change it! */
  
***************
*** 320,330 ****
  	ViceLog(0,("BreakDelayedCallbacks FAILED for host %08x which IS UP.  Possible network or routing failure.\n",thost->host));
  	if ( MultiProbeAlternateAddress_r (thost) ) {
  	    ViceLog(0, ("MultiProbe failed to find new address for host %x.%d\n",
! 			thost->host, thost->port));
! 	    code = -1;
  	} else {
! 	    ViceLog(0, ("MultiProbe found new address for host %x.%d\n",
! 			thost->host, thost->port));
  	    if (BreakDelayedCallBacks_r(thost)) {
  		ViceLog(0,("BreakDelayedCallbacks FAILED AGAIN for host %08x which IS UP.  Possible network or routing failure.\n",thost->host));
  		code = -1;
--- 321,333 ----
  	ViceLog(0,("BreakDelayedCallbacks FAILED for host %08x which IS UP.  Possible network or routing failure.\n",thost->host));
  	if ( MultiProbeAlternateAddress_r (thost) ) {
  	    ViceLog(0, ("MultiProbe failed to find new address for host %x.%d\n",
! 			afs_inet_ntoa_r(thost->host, hoststr), 
! 			ntohs(thost->port)));
!             code = -1;
  	} else {
!             ViceLog(0, ("MultiProbe found new address for host %s:%d\n",
!                        afs_inet_ntoa_r(thost->host, hoststr), 
!                        ntohs(thost->port)));
  	    if (BreakDelayedCallBacks_r(thost)) {
  		ViceLog(0,("BreakDelayedCallbacks FAILED AGAIN for host %08x which IS UP.  Possible network or routing failure.\n",thost->host));
  		code = -1;
***************
*** 6143,6155 ****
  	    /* I'm not really worried about when we restarted, I'm   */
  	    /* just worried about when the first VBUSY was returned. */
  	    TM_GetTimeOfDay(&restartedat, 0);
! 	    return(VBUSY);
  	  }
  	  else {
  	    struct timeval now;
  	    TM_GetTimeOfDay(&now, 0);
  	    if ((now.tv_sec - restartedat.tv_sec) < (11*60)) {
! 	      return(VBUSY);
  	    }
  	    else {
  	      return (VRESTARTING);
--- 6146,6158 ----
  	    /* I'm not really worried about when we restarted, I'm   */
  	    /* just worried about when the first VBUSY was returned. */
  	    TM_GetTimeOfDay(&restartedat, 0);
! 	    return(busyonrst?VBUSY:VRESTARTING);
  	  }
  	  else {
  	    struct timeval now;
  	    TM_GetTimeOfDay(&now, 0);
  	    if ((now.tv_sec - restartedat.tv_sec) < (11*60)) {
! 	      return(busyonrst?VBUSY:VRESTARTING);
  	    }
  	    else {
  	      return (VRESTARTING);
Index: openafs/src/viced/callback.c
diff -c openafs/src/viced/callback.c:1.6.2.5 openafs/src/viced/callback.c:1.6.2.8
*** openafs/src/viced/callback.c:1.6.2.5	Thu Nov 14 23:07:58 2002
--- openafs/src/viced/callback.c	Mon Mar 10 21:22:03 2003
***************
*** 82,88 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/callback.c,v 1.6.2.5 2002/11/15 04:07:58 zacheiss Exp $");
  
  #include <stdio.h> 
  #include <stdlib.h>      /* for malloc() */
--- 82,88 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/callback.c,v 1.6.2.8 2003/03/11 02:22:03 shadow Exp $");
  
  #include <stdio.h> 
  #include <stdlib.h>      /* for malloc() */
***************
*** 819,825 ****
  	  	ViceLog(7, 
  		  ("BCB: Failed on file %u.%d.%d, host %x.%d is down\n",
  		   afidp->AFSCBFids_val->Volume, afidp->AFSCBFids_val->Vnode,
! 		   afidp->AFSCBFids_val->Unique, hp->host, hp->port));
  		}
  
  		H_LOCK
--- 819,825 ----
  	  	ViceLog(7, 
  		  ("BCB: Failed on file %u.%d.%d, host %x.%d is down\n",
  		   afidp->AFSCBFids_val->Volume, afidp->AFSCBFids_val->Vnode,
! 		   afidp->AFSCBFids_val->Unique, hp->host, ntohs(hp->port)));
  		}
  
  		H_LOCK
***************
*** 872,878 ****
      int hostindex;
  
      ViceLog(7,("BCB: BreakCallBack(all but %x.%d, (%u,%d,%d))\n",
! 	       xhost->host, xhost->port, fid->Volume, fid->Vnode, 
  	       fid->Unique));
  
      H_LOCK
--- 872,878 ----
      int hostindex;
  
      ViceLog(7,("BCB: BreakCallBack(all but %x.%d, (%u,%d,%d))\n",
! 	       xhost->host, ntohs(xhost->port), fid->Volume, fid->Vnode, 
  	       fid->Unique));
  
      H_LOCK
***************
*** 903,909 ****
  	  }
  	  else if (thishost->hostFlags & VENUSDOWN) {
  	    ViceLog(7,("BCB: %x.%d is down; delaying break call back\n",
! 		       thishost->host, thishost->port));
  	    cb->status = CB_DELAYED;
  	  }
  	  else {
--- 903,909 ----
  	  }
  	  else if (thishost->hostFlags & VENUSDOWN) {
  	    ViceLog(7,("BCB: %x.%d is down; delaying break call back\n",
! 		       thishost->host, ntohs(thishost->port)));
  	    cb->status = CB_DELAYED;
  	  }
  	  else {
***************
*** 964,970 ****
      pcb = FindCBPtr(fe, host);
      if (!*pcb) {
  	ViceLog(8,("DCB: No call back for host %x.%d, (%u, %d, %d)\n",
! 	    host->host, host->port, fid->Volume, fid->Vnode, fid->Unique));
  	h_Unlock_r(host);
  	H_UNLOCK
  	return;
--- 964,970 ----
      pcb = FindCBPtr(fe, host);
      if (!*pcb) {
  	ViceLog(8,("DCB: No call back for host %x.%d, (%u, %d, %d)\n",
! 	    host->host, ntohs(host->port), fid->Volume, fid->Vnode, fid->Unique));
  	h_Unlock_r(host);
  	H_UNLOCK
  	return;
***************
*** 1094,1100 ****
  	    if (ShowProblems) {
  		ViceLog(0,
  	   ("CB: Call back connect back failed (in break delayed) for %x.%d\n",
! 			host->host, host->port));
  	      }
  	    host->hostFlags |= VENUSDOWN;
  	}
--- 1094,1100 ----
  	    if (ShowProblems) {
  		ViceLog(0,
  	   ("CB: Call back connect back failed (in break delayed) for %x.%d\n",
! 			host->host, ntohs(host->port)));
  	      }
  	    host->hostFlags |= VENUSDOWN;
  	}
***************
*** 1139,1151 ****
  	    if (ShowProblems) {
  		ViceLog(0,
  	     ("CB: XCallBackBulk failed, host=%x.%d; callback list follows:\n",
! 		    host->host, host->port));
  	    }
  	    for (i = 0; i<nfids; i++) {
  		if (ShowProblems) {
  		    ViceLog(0,
  		    ("CB: Host %x.%d, file %u.%u.%u (part of bulk callback)\n",
! 		               host->host, host->port, 
  		               fids[i].Volume, fids[i].Vnode, fids[i].Unique));
  		}
  		/* used to do this:
--- 1139,1151 ----
  	    if (ShowProblems) {
  		ViceLog(0,
  	     ("CB: XCallBackBulk failed, host=%x.%d; callback list follows:\n",
! 		    host->host, ntohs(host->port)));
  	    }
  	    for (i = 0; i<nfids; i++) {
  		if (ShowProblems) {
  		    ViceLog(0,
  		    ("CB: Host %x.%d, file %u.%u.%u (part of bulk callback)\n",
! 		               host->host, ntohs(host->port), 
  		               fids[i].Volume, fids[i].Vnode, fids[i].Unique));
  		}
  		/* used to do this:
***************
*** 1196,1205 ****
  	    return 0;      /* Release hold */
  	}
  	ViceLog(8,("BVCB: volume call back for host %x.%d failed\n",
! 		 host->host,host->port));
  	if (ShowProblems) {
  	    ViceLog(0, ("CB: volume callback for host %x.%d failed\n",
! 		    host->host, host->port));
  	}
  	DeleteAllCallBacks_r(host); /* Delete all callback state rather than
  				     attempting to selectively remember to
--- 1196,1205 ----
  	    return 0;      /* Release hold */
  	}
  	ViceLog(8,("BVCB: volume call back for host %x.%d failed\n",
! 		 host->host,ntohs(host->port)));
  	if (ShowProblems) {
  	    ViceLog(0, ("CB: volume callback for host %x.%d failed\n",
! 		    host->host, ntohs(host->port)));
  	}
  	DeleteAllCallBacks_r(host); /* Delete all callback state rather than
  				     attempting to selectively remember to
***************
*** 1689,1695 ****
      }
      if (err || argc != 1) {
  	fprintf(stderr,
! 		"Usage: cbd [-host cbid] [-fid volume vnode] [-stats] callbackdumpfile\n");
  	fprintf(stderr, "[cbid is shown for each host in the hosts.dump file]\n");
  	exit(1);
      }
--- 1689,1695 ----
      }
      if (err || argc != 1) {
  	fprintf(stderr,
! 		"Usage: cbd [-host cbid] [-fid volume vnode] [-stats] [-all] callbackdumpfile\n");
  	fprintf(stderr, "[cbid is shown for each host in the hosts.dump file]\n");
  	exit(1);
      }
***************
*** 1812,1818 ****
--- 1812,1820 ----
  
  	i = host->interface->numberOfInterfaces;
  	addr = malloc(i * sizeof(afs_int32));
+ 	if (!addr) return 1;
  	conns = malloc(i * sizeof(struct rx_connection *));
+ 	if (!conns) { free(addr); return 1; }
  
  	/* initialize alternate rx connections */
  	for ( i=0,j=0; i < host->interface->numberOfInterfaces; i++)
***************
*** 1897,1903 ****
--- 1899,1907 ----
  
  	i = host->interface->numberOfInterfaces;
  	addr = malloc(i * sizeof(afs_int32));
+ 	if (!addr) return 1;
  	conns = malloc(i * sizeof(struct rx_connection *));
+ 	if (!conns) { free(addr); return 1; }
  
  	/* initialize alternate rx connections */
  	for ( i=0,j=0; i < host->interface->numberOfInterfaces; i++)
Index: openafs/src/viced/host.c
diff -c openafs/src/viced/host.c:1.7.2.8 openafs/src/viced/host.c:1.7.2.18
*** openafs/src/viced/host.c:1.7.2.8	Thu Nov 14 16:56:57 2002
--- openafs/src/viced/host.c	Mon Apr  7 16:16:20 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/host.c,v 1.7.2.8 2002/11/14 21:56:57 zacheiss Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/host.c,v 1.7.2.18 2003/04/07 20:16:20 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 534,548 ****
      register afs_uint32  hostaddr, hport;  /* net byte order */
  {
      register struct host *host;
!     int held;
      
      H_LOCK
      host = h_Lookup_r(hostaddr, hport, &held);
      if (host) {
!       host->hcpsfailed = 1;
      }
-     if (!held)
-       h_Release_r(host);
      H_UNLOCK
  
  return;
--- 534,548 ----
      register afs_uint32  hostaddr, hport;  /* net byte order */
  {
      register struct host *host;
!     int held = 0;
      
      H_LOCK
      host = h_Lookup_r(hostaddr, hport, &held);
      if (host) {
! 	host->hcpsfailed = 1;
! 	if (!held)
! 	    h_Release_r(host);
      }
      H_UNLOCK
  
  return;
***************
*** 600,606 ****
  	if (serverentry)
  	    consolePort = serverentry->s_port;
  	else
! 	    consolePort = DEF_ROPCONS;	/* Use a default */
      }
      if (host->port == consolePort) host->Console = 1;
      /* Make a callback channel even for the console, on the off chance that it
--- 600,606 ----
  	if (serverentry)
  	    consolePort = serverentry->s_port;
  	else
! 	    consolePort = htons(DEF_ROPCONS);	/* Use a default */
      }
      if (host->port == consolePort) host->Console = 1;
      /* Make a callback channel even for the console, on the off chance that it
***************
*** 622,627 ****
--- 622,629 ----
      /*host->hcpsfailed = 0; 	/* save cycles */
      /* h_gethostcps(host);      do this under host lock */
      host->FirstClient = 0;      
+     h_Hold_r(host);
+     h_Lock_r(host);
      h_InsertList_r(host);	/* update global host List */
  #if FS_STATS_DETAILED
      /*
***************
*** 966,973 ****
      hport = rxr_PortOf(tcon);
  retry:
      code = 0;
-     identP = (struct Identity *)rx_GetSpecific(tcon, rxcon_ident_key);
      host = h_Lookup_r(haddr, hport, &held);
      if (host && !identP && !(host->Console&1)) {
  	/* This is a new connection, and we already have a host
  	 * structure for this address. Verify that the identity
--- 968,975 ----
      hport = rxr_PortOf(tcon);
  retry:
      code = 0;
      host = h_Lookup_r(haddr, hport, &held);
+     identP = (struct Identity *)rx_GetSpecific(tcon, rxcon_ident_key);
      if (host && !identP && !(host->Console&1)) {
  	/* This is a new connection, and we already have a host
  	 * structure for this address. Verify that the identity
***************
*** 980,986 ****
  		h_Unlock_r(host);
  		if ( !held) h_Release_r(host);
  		ViceLog(125, ("Host %s:%d starting h_Lookup again\n",
! 			     afs_inet_ntoa_r(host->host, hoststr), host->port));
  		goto retry;
  	}
  	host->hostFlags &= ~ALTADDR;
--- 982,988 ----
  		h_Unlock_r(host);
  		if ( !held) h_Release_r(host);
  		ViceLog(125, ("Host %s:%d starting h_Lookup again\n",
! 			     afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		goto retry;
  	}
  	host->hostFlags &= ~ALTADDR;
***************
*** 998,1004 ****
  		if (host->interface) {
  		    ViceLog(0,
  			    ("Host %s:%d used to support WhoAreYou, deleting.\n",
! 			    afs_inet_ntoa_r(host->host, hoststr), host->port));
  		    host->hostFlags |= HOSTDELETED;
  		    h_Unlock_r(host);
  		    if (!held) h_Release_r(host);
--- 1000,1006 ----
  		if (host->interface) {
  		    ViceLog(0,
  			    ("Host %s:%d used to support WhoAreYou, deleting.\n",
! 			    afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		    host->hostFlags |= HOSTDELETED;
  		    h_Unlock_r(host);
  		    if (!held) h_Release_r(host);
***************
*** 1038,1049 ****
  	{
          	/* another thread is doing the initialisation */
  		ViceLog(125, ("Host %s:%d waiting for host-init to complete\n",
! 			     afs_inet_ntoa_r(host->host, hoststr), host->port));
  		h_Lock_r(host);
  		h_Unlock_r(host);
  		if ( !held) h_Release_r(host);
  		ViceLog(125, ("Host %s:%d starting h_Lookup again\n",
! 			     afs_inet_ntoa_r(host->host, hoststr), host->port));
  		goto retry;
  	}
  	/* We need to check whether the identity in the host structure
--- 1040,1051 ----
  	{
          	/* another thread is doing the initialisation */
  		ViceLog(125, ("Host %s:%d waiting for host-init to complete\n",
! 			     afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		h_Lock_r(host);
  		h_Unlock_r(host);
  		if ( !held) h_Release_r(host);
  		ViceLog(125, ("Host %s:%d starting h_Lookup again\n",
! 			     afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  		goto retry;
  	}
  	/* We need to check whether the identity in the host structure
***************
*** 1053,1094 ****
  	  && ( ( !identP->valid && host->interface )
  	    || ( identP->valid && !host->interface )
  	    || ( identP->valid
! 	      && !afs_uuid_equal(&identP->uuid, &host->interface->uuid) ) ) ) {
! 		/* The host in the cache is not the host for this connection */
! 		host->hostFlags |= HOSTDELETED;
! 		h_Unlock_r(host);
! 		if (!held) h_Release_r(host);
! 		ViceLog(0, ("CB: new identity for host %s:%d, deleting\n",
! 			   afs_inet_ntoa_r(host->host, hoststr), host->port));
! 		goto retry;
  	}
      } else {
          host = h_Alloc_r(tcon);
-         h_Hold_r(host);
-         h_Lock_r(host);
  	h_gethostcps_r(host,FT_ApproxTime());
          if (!(host->Console&1)) {
! 	    if (!identP || !interfValid) {
! 		H_UNLOCK
! 		code = RXAFSCB_WhoAreYou(host->callback_rxcon, &interf);
! 		H_LOCK
! 		if ( code == RXGEN_OPCODE ) {
! 		  identP = (struct Identity *)malloc(sizeof(struct Identity));
! 		    identP->valid = 0;
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
! 		    ViceLog(25,
! 			    ("Host %s:%d does not support WhoAreYou.\n",
! 			    afs_inet_ntoa_r(host->host, hoststr), host->port));
! 		    code = 0;
! 		} else if (code == 0) {
! 		    interfValid = 1;
  		    identP = (struct Identity *)malloc(sizeof(struct Identity));
! 		    identP->valid = 1;
! 		    identP->uuid = interf.uuid;
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
! 		    ViceLog(25, ("WhoAreYou success on %s:%d\n",
! 				afs_inet_ntoa_r(host->host, hoststr), host->port));
! 		}
  	    }
  	    if (code == 0 && !identP->valid) {
  	 	H_UNLOCK
--- 1055,1113 ----
  	  && ( ( !identP->valid && host->interface )
  	    || ( identP->valid && !host->interface )
  	    || ( identP->valid
! 	      && !afs_uuid_equal(&identP->uuid, &host->interface->uuid) ) ) ) 
! 	{
! 	    char uuid1[128], uuid2[128];
! 	    if (identP->valid)
! 		afsUUID_to_string(identP->uuid, uuid1, 127);
! 	    if (host->interface)
! 		afsUUID_to_string(host->interface->uuid, uuid2, 127);
! 	    ViceLog(0, 
! 		    ("CB: new identity for host %s:%d, deleting(%x %x %s %s)\n", 
! 		     afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), 
! 		     identP->valid, host->interface, identP->valid ? uuid1 : 
! 		     "", host->interface ? uuid2 : ""));
! 
! 	    /* The host in the cache is not the host for this connection */
! 	    host->hostFlags |= HOSTDELETED;
! 	    h_Unlock_r(host);
! 	    if (!held) h_Release_r(host);
! 	    goto retry;
  	}
      } else {
          host = h_Alloc_r(tcon);
  	h_gethostcps_r(host,FT_ApproxTime());
          if (!(host->Console&1)) {
! 	    int pident = 0;
! 	    H_UNLOCK
! 	    code = RXAFSCB_WhoAreYou(host->callback_rxcon, &interf);
! 	    H_LOCK
! 	    if ( code == RXGEN_OPCODE ) {
! 		if (!identP)
! 		    identP = (struct Identity *)malloc(sizeof(struct Identity));
! 		else
! 		    pident = 1;
! 		identP->valid = 0;
! 		if (!pident)
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
! 		ViceLog(25,
! 			("Host %s:%d does not support WhoAreYou.\n",
! 			 afs_inet_ntoa_r(host->host, hoststr), 
! 			 ntohs(host->port)));
! 		code = 0;
! 	    } else if (code == 0) {
! 		if (!identP)
  		    identP = (struct Identity *)malloc(sizeof(struct Identity));
! 		else
! 		    pident = 1;
! 		identP->valid = 1;
! 		interfValid = 1;
! 		identP->uuid = interf.uuid;
! 		if (!pident)
  		    rx_SetSpecific(tcon, rxcon_ident_key, identP);
! 		ViceLog(25, ("WhoAreYou success on %s:%d\n",
! 			     afs_inet_ntoa_r(host->host, hoststr), 
! 			     ntohs(host->port)));
  	    }
  	    if (code == 0 && !identP->valid) {
  	 	H_UNLOCK
***************
*** 1104,1111 ****
  			h_Hold_r(oldHost);
  		    h_Lock_r(oldHost);
  		    ViceLog(25, ("CB: new addr %s:%d for old host %s:%d\n",
! 				afs_inet_ntoa_r(host->host, hoststr), host->port,
! 				afs_inet_ntoa_r(oldHost->host, hoststr2), oldHost->port));
  		    host->hostFlags |= HOSTDELETED;
  		    h_Unlock_r(host);
  		    h_Release_r(host);
--- 1123,1130 ----
  			h_Hold_r(oldHost);
  		    h_Lock_r(oldHost);
  		    ViceLog(25, ("CB: new addr %s:%d for old host %s:%d\n",
! 				afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
! 				afs_inet_ntoa_r(oldHost->host, hoststr2), ntohs(oldHost->port)));
  		    host->hostFlags |= HOSTDELETED;
  		    h_Unlock_r(host);
  		    h_Release_r(host);
***************
*** 1120,1126 ****
  		    H_LOCK
  		    if (code == 0) {
  			ViceLog(25, ("InitCallBackState3 success on %s:%d\n",
! 				    afs_inet_ntoa_r(host->host, hoststr), host->port));
  			assert(interfValid == 1);
  			initInterfaceAddr_r(host, &interf);
  		    }
--- 1139,1145 ----
  		    H_LOCK
  		    if (code == 0) {
  			ViceLog(25, ("InitCallBackState3 success on %s:%d\n",
! 				    afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
  			assert(interfValid == 1);
  			initInterfaceAddr_r(host, &interf);
  		    }
***************
*** 1413,1419 ****
  	    ViceLog(0, ("pr_GetCPS failed(%d) for user %d, host %s:%d\n",
  		       code, viceid,
  		       afs_inet_ntoa_r(client->host->host, hoststr),
! 		       client->host->port));
  
  	    /* Although ubik_Call (called by pr_GetCPS) traverses thru
  	     * all protection servers and reevaluates things if no
--- 1432,1438 ----
  	    ViceLog(0, ("pr_GetCPS failed(%d) for user %d, host %s:%d\n",
  		       code, viceid,
  		       afs_inet_ntoa_r(client->host->host, hoststr),
! 		       ntohs(client->host->port)));
  
  	    /* Although ubik_Call (called by pr_GetCPS) traverses thru
  	     * all protection servers and reevaluates things if no
***************
*** 1482,1496 ****
      H_LOCK
  
      *cp = client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
!     /* XXXX debug */
!     assert(client && client->tcon && rxr_CidOf(client->tcon) == client->sid);
      if (client &&
  	client->LastCall > client->expTime && client->expTime) {
  	char hoststr[16];
  	ViceLog(1, ("Token for %s at %s:%d expired %d\n",
  		h_UserName(client),
  		afs_inet_ntoa_r(client->host->host, hoststr),
! 		client->host->port, client->expTime));
  	H_UNLOCK
  	return VICETOKENDEAD;
      }
--- 1501,1535 ----
      H_LOCK
  
      *cp = client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
!     if (client == NULL || client->tcon == NULL) {
! 	ViceLog(0, ("GetClient: no client in conn %x (host %x), VBUSYING\n", 
! 		    tcon, rx_HostOf(rx_PeerOf(tcon))));
! 	H_UNLOCK
! 	return VBUSY;
!     }
!     if (rxr_CidOf(client->tcon) != client->sid) {
! 	ViceLog(0, ("GetClient: tcon %x tcon sid %d client sid %d\n",
! 		    client->tcon, rxr_CidOf(client->tcon),
! 		    client->sid));
! 	H_UNLOCK
! 	return VBUSY;
!     }
!     if (!(client && client->tcon && rxr_CidOf(client->tcon) == client->sid)) {
! 	if (!client)
! 	    ViceLog(0, ("GetClient: no client in conn %x\n", tcon));
! 	else
! 	    ViceLog(0, ("GetClient: tcon %x tcon sid %d client sid %d\n", 
! 			client->tcon, client->tcon ? rxr_CidOf(client->tcon)
! 			: -1, client->sid));
! 	assert(0);
!     }
      if (client &&
  	client->LastCall > client->expTime && client->expTime) {
  	char hoststr[16];
  	ViceLog(1, ("Token for %s at %s:%d expired %d\n",
  		h_UserName(client),
  		afs_inet_ntoa_r(client->host->host, hoststr),
! 		ntohs(client->host->port), client->expTime));
  	H_UNLOCK
  	return VICETOKENDEAD;
      }
***************
*** 1555,1561 ****
  	return held;
      }
      sprintf(tmpStr,"Host %s:%d down = %d, LastCall %s",
! 	    afs_inet_ntoa_r(host->host, hoststr), host->port,
  	    (host->hostFlags & VENUSDOWN),
  	    afs_ctime((time_t *)&host->LastCall, tbuffer, sizeof(tbuffer)));
      STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
--- 1594,1600 ----
  	return held;
      }
      sprintf(tmpStr,"Host %s:%d down = %d, LastCall %s",
! 	    afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
  	    (host->hostFlags & VENUSDOWN),
  	    afs_ctime((time_t *)&host->LastCall, tbuffer, sizeof(tbuffer)));
      STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
***************
*** 1634,1640 ****
  
      H_LOCK
      sprintf(tmpStr, "ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
! 	    host->host, host->port, host->index, host->cblist,
  	    CheckLock(&host->lock), host->LastCall, host->ActiveCall, 
  	    (host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED, 
  	    host->Console, host->hostFlags & CLIENTDELETED, 
--- 1673,1679 ----
  
      H_LOCK
      sprintf(tmpStr, "ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
! 	    host->host, ntohs(host->port), host->index, host->cblist,
  	    CheckLock(&host->lock), host->LastCall, host->ActiveCall, 
  	    (host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED, 
  	    host->Console, host->hostFlags & CLIENTDELETED, 
***************
*** 2057,2063 ****
  {
  	int i, j;
  	int number, count;
! 	afs_int32		myPort, myHost;
  	int found;
  	struct Interface *interface;
  
--- 2096,2102 ----
  {
  	int i, j;
  	int number, count;
! 	afs_int32		myHost;
  	int found;
  	struct Interface *interface;
  
***************
*** 2068,2074 ****
  		host->host, interf->numberOfInterfaces));
  
  	number = interf->numberOfInterfaces;
- 	myPort = host->port;
  	myHost = host->host; /* current interface address */
  
  	/* validation checks */
--- 2107,2112 ----
Index: openafs/src/viced/viced.c
diff -c openafs/src/viced/viced.c:1.11.2.3 openafs/src/viced/viced.c:1.11.2.8
*** openafs/src/viced/viced.c:1.11.2.3	Wed Aug 21 21:48:21 2002
--- openafs/src/viced/viced.c	Fri Mar 28 04:17:20 2003
***************
*** 19,25 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/viced.c,v 1.11.2.3 2002/08/22 01:48:21 zacheiss Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 19,25 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/viced/viced.c,v 1.11.2.8 2003/03/28 09:17:20 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 76,81 ****
--- 76,86 ----
  #endif
  #include "viced.h"
  #include "host.h"
+ #ifndef AFS_NT40_ENV
+ #ifdef AFS_PTHREAD_ENV
+ #include "softsig.h"
+ #endif
+ #endif
  #if defined(AFS_SGI_ENV)
  #include "sys/schedctl.h"
  #include "sys/lock.h"
***************
*** 128,133 ****
--- 133,139 ----
  extern	int     LogLevel;
  extern	int	Statistics;
  
+ int     busyonrst = 1;
  int     timeout = 30;
  int 	SawSpare;
  int 	SawPctSpare;
***************
*** 219,240 ****
  
  static void ResetCheckSignal(void)
  {
! #ifdef	AFS_HPUX_ENV
!     signal(SIGPOLL, CheckSignal_Signal);
! #else
! #ifdef AFS_NT40_ENV
!     signal(SIGUSR2, CheckSignal_Signal);
  #else
!     signal(SIGXCPU, CheckSignal_Signal);
  #endif
  #endif
  }
  
  static void ResetCheckDescriptors(void)
  {
  #ifndef AFS_NT40_ENV
      signal(SIGTERM, CheckDescriptors_Signal);
  #endif
  }
  
  
--- 225,256 ----
  
  static void ResetCheckSignal(void)
  {
!     int signo;
! 
! #if defined(AFS_HPUX_ENV)
!     signo = SIGPOLL;
! #elif defined(AFS_NT40_ENV)
!     signo = SIGUSR2;
  #else
!     signo = SIGXCPU;
  #endif
+ 
+ #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
+     softsig_signal(signo, CheckSignal_Signal);
+ #else
+     signal(signo, CheckSignal_Signal);
  #endif
  }
  
  static void ResetCheckDescriptors(void)
  {
  #ifndef AFS_NT40_ENV
+ #if defined(AFS_PTHREAD_ENV)
+     softsig_signal(SIGTERM, CheckDescriptors_Signal);
+ #else
      signal(SIGTERM, CheckDescriptors_Signal);
  #endif
+ #endif
  }
  
  
***************
*** 299,305 ****
  #ifdef AFS_PTHREAD_ENV
      pthread_t parentPid, serverPid;
      pthread_attr_t tattr;
-     AFS_SIGSET_DECL;
  #else /* AFS_PTHREAD_ENV */
      PROCESS parentPid, serverPid;
  #endif /* AFS_PTHREAD_ENV */
--- 315,320 ----
***************
*** 372,377 ****
--- 387,397 ----
      ViceLog(0, ("File server starting\n"));
  #endif
  
+ #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
+     /* initialize the pthread soft signal handler thread */
+     softsig_init();
+ #endif
+ 
      /* install signal handlers for controlling the fileserver process */
      ResetCheckSignal();  /* set CheckSignal_Signal() sig handler */
      ResetCheckDescriptors();  /* set CheckDescriptors_Signal() sig handler */
***************
*** 571,581 ****
  #ifdef AFS_PTHREAD_ENV
      assert(pthread_attr_init(&tattr) == 0);
      assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
!     /* Block signals in the threads */
!     AFS_SIGSET_CLEAR();
      assert(pthread_create(&serverPid, &tattr, (void *)FiveMinuteCheckLWP, &fiveminutes) == 0);
      assert(pthread_create(&serverPid, &tattr, (void *)HostCheckLWP, &fiveminutes) == 0);
-     AFS_SIGSET_RESTORE();
  #else /* AFS_PTHREAD_ENV */
      assert(LWP_CreateProcess(FiveMinuteCheckLWP, stack*1024, LWP_MAX_PRIORITY - 2,
  	    &fiveminutes, "FiveMinuteChecks", &serverPid) == LWP_SUCCESS);
--- 591,599 ----
  #ifdef AFS_PTHREAD_ENV
      assert(pthread_attr_init(&tattr) == 0);
      assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
! 
      assert(pthread_create(&serverPid, &tattr, (void *)FiveMinuteCheckLWP, &fiveminutes) == 0);
      assert(pthread_create(&serverPid, &tattr, (void *)HostCheckLWP, &fiveminutes) == 0);
  #else /* AFS_PTHREAD_ENV */
      assert(LWP_CreateProcess(FiveMinuteCheckLWP, stack*1024, LWP_MAX_PRIORITY - 2,
  	    &fiveminutes, "FiveMinuteChecks", &serverPid) == LWP_SUCCESS);
***************
*** 617,624 ****
  		   FS_HostName, hoststr, FS_HostAddr_NBO, FS_HostAddr_HBO));
      }
  
!     /* Install handler to catch the shutdown signal */
!     signal(SIGQUIT, ShutDown_Signal); /* bosserver assumes SIGQUIT shutdown */
  
      ViceLog(0,("File Server started %s",
  	       afs_ctime(&tp.tv_sec, tbuffer, sizeof(tbuffer))));
--- 635,648 ----
  		   FS_HostName, hoststr, FS_HostAddr_NBO, FS_HostAddr_HBO));
      }
  
!     /* Install handler to catch the shutdown signal;
!      * bosserver assumes SIGQUIT shutdown
!      */
! #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
!     softsig_signal(SIGQUIT, ShutDown_Signal);
! #else
!     signal(SIGQUIT, ShutDown_Signal);
! #endif
  
      ViceLog(0,("File Server started %s",
  	       afs_ctime(&tp.tv_sec, tbuffer, sizeof(tbuffer))));
***************
*** 635,640 ****
--- 659,676 ----
  }
  
  
+ static void setThreadId(char *s)
+ {
+ #ifdef AFS_PTHREAD_ENV
+     /* set our 'thread-id' so that the host hold table works */
+     MUTEX_ENTER(&rx_stats_mutex);   /* protects rxi_pthread_hinum */ 
+     ++rxi_pthread_hinum;
+     pthread_setspecific(rx_thread_id_key, (void *)rxi_pthread_hinum);
+     MUTEX_EXIT(&rx_stats_mutex);
+     ViceLog(0,("Set thread id %d for '%s'\n", pthread_getspecific(rx_thread_id_key), s));
+ #endif
+ }
+ 
  /* This LWP does things roughly every 5 minutes */
  static FiveMinuteCheckLWP()
  
***************
*** 643,648 ****
--- 679,685 ----
      char tbuffer[32];
  
      ViceLog(1, ("Starting five minute check process\n"));
+     setThreadId("FiveMinuteCheckLWP");
      while (1) {
  #ifdef AFS_PTHREAD_ENV
  	sleep(fiveminutes);
***************
*** 681,686 ****
--- 718,724 ----
  
  {
      ViceLog(1, ("Starting Host check process\n"));
+     setThreadId("HostCheckLWP");
      while(1) {
  #ifdef AFS_PTHREAD_ENV
  	sleep(fiveminutes);
***************
*** 923,928 ****
--- 961,967 ----
      strcat(buffer, "[-implicit <admin mode bits: rlidwka>] ");
      strcat(buffer, "[-hr <number of hours between refreshing the host cps>] ");
      strcat(buffer, "[-busyat <redirect clients when queue > n>] ");
+     strcat(buffer, "[-nobusy <no VBUSY before a volume is attached>] ");
      strcat(buffer, "[-rxpck <number of rx extra packets>] ");
      strcat(buffer, "[-rxdbg (enable rx debugging)] ");
      strcat(buffer, "[-rxdbge (enable rxevent debugging)] ");
***************
*** 1152,1158 ****
  			   busy_threshold);
  		    Sawbusy = 0;
  		}
! 	    }
  #ifdef	AFS_AIX32_ENV
  	else
  	    if (!strcmp(argv[i], "-m")) {
--- 1191,1200 ----
  			   busy_threshold);
  		    Sawbusy = 0;
  		}
! 	      }
! 	    else
! 	      if (!strcmp(argv[i], "-nobusy")) 
! 		busyonrst=0;
  #ifdef	AFS_AIX32_ENV
  	else
  	    if (!strcmp(argv[i], "-m")) {
Index: openafs/src/viced/viced.h
diff -c openafs/src/viced/viced.h:1.2 openafs/src/viced/viced.h:1.2.8.1
*** openafs/src/viced/viced.h:1.2	Sat Nov  4 05:06:18 2000
--- openafs/src/viced/viced.h	Fri Mar 28 04:17:20 2003
***************
*** 189,194 ****
--- 189,196 ----
  	struct AFSDisk	Disks[AFS_MSTATDISKS];
  };
  
+ extern int busyonrst;
+ 
  #define RESTART_ORDINARY 1
  #define RESTART_FAST 2
  #define RESTART_SAFE 3
Index: openafs/src/vlserver/cnvldb.c
diff -c openafs/src/vlserver/cnvldb.c:1.5 openafs/src/vlserver/cnvldb.c:1.5.2.1
*** openafs/src/vlserver/cnvldb.c:1.5	Tue Aug  7 20:04:22 2001
--- openafs/src/vlserver/cnvldb.c	Sat Jan 11 02:42:39 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/cnvldb.c,v 1.5 2001/08/08 00:04:22 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/cnvldb.c,v 1.5.2.1 2003/01/11 07:42:39 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 30,36 ****
  #define MAXSIZE 2048 /* most I'll get back from PIOCTL */
  #define	BADSERVERID	255	/* XXX */
  
! extern int errno;
  extern struct cmd_syndesc *cmd_CreateSyntax();
  static char pn[] = "cnvldb";
  static char tempname[] = "XXnewvldb";
--- 30,36 ----
  #define MAXSIZE 2048 /* most I'll get back from PIOCTL */
  #define	BADSERVERID	255	/* XXX */
  
! 
  extern struct cmd_syndesc *cmd_CreateSyntax();
  static char pn[] = "cnvldb";
  static char tempname[] = "XXnewvldb";
Index: openafs/src/vlserver/sascnvldb.c
diff -c openafs/src/vlserver/sascnvldb.c:1.5 openafs/src/vlserver/sascnvldb.c:1.5.2.1
*** openafs/src/vlserver/sascnvldb.c:1.5	Tue Aug  7 20:04:22 2001
--- openafs/src/vlserver/sascnvldb.c	Sat Jan 11 02:42:39 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/sascnvldb.c,v 1.5 2001/08/08 00:04:22 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vlserver/sascnvldb.c,v 1.5.2.1 2003/01/11 07:42:39 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 35,41 ****
  
  #define MAXSIZE 2048 /* most I'll get back from PIOCTL */
  
! extern int errno;
  extern struct cmd_syndesc *cmd_CreateSyntax();
  static char pn[] = "cnvldb";
  static char tempname[] = "XXnewvldb";
--- 35,41 ----
  
  #define MAXSIZE 2048 /* most I'll get back from PIOCTL */
  
! 
  extern struct cmd_syndesc *cmd_CreateSyntax();
  static char pn[] = "cnvldb";
  static char tempname[] = "XXnewvldb";
Index: openafs/src/vol/clone.c
diff -c openafs/src/vol/clone.c:1.5.2.2 openafs/src/vol/clone.c:1.5.2.3
*** openafs/src/vol/clone.c:1.5.2.2	Sat Oct 13 00:22:11 2001
--- openafs/src/vol/clone.c	Fri Jan 17 01:47:35 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/clone.c,v 1.5.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/clone.c,v 1.5.2.3 2003/01/17 06:47:35 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 230,237 ****
  	 if (clinode && (clinode == rwinode)) {
  	    clinode = 0; /* already cloned - don't delete later */
  	 } else if (rwinode) {
! 	    assert(IH_INC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) != -1);
! 	    inodeinced = 1;
  	 }
  
  	 /* If a directory, mark vnode in old volume as cloned */
--- 230,242 ----
  	 if (clinode && (clinode == rwinode)) {
  	    clinode = 0; /* already cloned - don't delete later */
  	 } else if (rwinode) {
! 	     if (IH_INC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) {
! 		 Log("IH_INC failed: %x, %s, %d errno %d\n", 
! 		     V_linkHandle(rwvp), PrintInode(NULL, rwinode), 
! 		     V_parentId(rwvp), errno);
! 		 assert(0);
! 	     }
! 	     inodeinced = 1;
  	 }
  
  	 /* If a directory, mark vnode in old volume as cloned */
***************
*** 273,279 ****
         clonefailed:
  	 /* Couldn't clone, go back and decrement the inode's link count */
  	 if (inodeinced) {
! 	    assert(IH_DEC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) != -1);
  	 }
  	 /* And if the directory was marked clone, unmark it */
  	 if (dircloned) {
--- 278,289 ----
         clonefailed:
  	 /* Couldn't clone, go back and decrement the inode's link count */
  	 if (inodeinced) {
! 	     if (IH_DEC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) {
! 		 Log("IH_DEC failed: %x, %s, %d errno %d\n", 
! 		     V_linkHandle(rwvp), PrintInode(NULL, rwinode), 
! 		     V_parentId(rwvp), errno);
! 		 assert(0);
! 	     }
  	 }
  	 /* And if the directory was marked clone, unmark it */
  	 if (dircloned) {
Index: openafs/src/vol/fs_conv_411.c
diff -c openafs/src/vol/fs_conv_411.c:1.5 openafs/src/vol/fs_conv_411.c:1.5.2.1
*** openafs/src/vol/fs_conv_411.c:1.5	Tue Aug  7 20:04:23 2001
--- openafs/src/vol/fs_conv_411.c	Sat Jan 11 02:42:39 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/fs_conv_411.c,v 1.5 2001/08/08 00:04:23 shadow Exp $");
  
  #if	defined(AFS_DUX40_ENV) || (defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)) || defined(AFS_SUN54_ENV)
  #if defined AFS_DUX40_ENV
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/fs_conv_411.c,v 1.5.2.1 2003/01/11 07:42:39 shadow Exp $");
  
  #if	defined(AFS_DUX40_ENV) || (defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)) || defined(AFS_SUN54_ENV)
  #if defined AFS_DUX40_ENV
***************
*** 84,90 ****
  int icount=0, iarraysize=0, *iarray;
  
  char *rawname(),  *unrawname(), *vol_DevName(), *blockcheck();
- extern int errno;
  #define ROOTINODE	2	
  int force = 0,  verbose = 0,  unconv = 0;
  
--- 84,89 ----
Index: openafs/src/vol/fssync.c
diff -c openafs/src/vol/fssync.c:1.5.2.4 openafs/src/vol/fssync.c:1.5.2.5
*** openafs/src/vol/fssync.c:1.5.2.4	Fri Nov 15 08:17:21 2002
--- openafs/src/vol/fssync.c	Mon Feb  3 15:46:20 2003
***************
*** 38,44 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/fssync.c,v 1.5.2.4 2002/11/15 13:17:21 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 38,44 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/fssync.c,v 1.5.2.5 2003/02/03 20:46:20 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 252,261 ****
--- 252,274 ----
      extern VInit;
      int code;
      int numTries;
+ #ifdef AFS_PTHREAD_ENV
+     int tid;
+ #endif
  
  #ifndef AFS_NT40_ENV
      signal(SIGPIPE, SIG_IGN);
  #endif
+ 
+ #ifdef AFS_PTHREAD_ENV
+     /* set our 'thread-id' so that the host hold table works */ 
+     MUTEX_ENTER(&rx_stats_mutex);   /* protects rxi_pthread_hinum */
+     tid=++rxi_pthread_hinum;
+     MUTEX_EXIT(&rx_stats_mutex);
+     pthread_setspecific(rx_thread_id_key, (void *)tid);
+     Log("Set thread id %d for FSYNC_sync\n", tid);
+ #endif /* AFS_PTHREAD_ENV */
+ 
      while (!VInit) {
        /* Let somebody else run until level > 0.  That doesn't mean that 
         * all volumes have been attached. */
Index: openafs/src/vol/nuke.c
diff -c openafs/src/vol/nuke.c:1.5 openafs/src/vol/nuke.c:1.5.2.1
*** openafs/src/vol/nuke.c:1.5	Tue Aug  7 20:04:23 2001
--- openafs/src/vol/nuke.c	Fri Feb 28 20:22:49 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/nuke.c,v 1.5 2001/08/08 00:04:23 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/nuke.c,v 1.5.2.1 2003/03/01 01:22:49 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
***************
*** 204,214 ****
  	 * volume's ID in its inode, and has to be removed explicitly.
  	 */
  	/* reuse devName buffer now */
! #ifdef AFS_NAMEI_ENV
  	sprintf(devName, "%c:\\%s", *lastDevComp , VolumeExternalName(avolid));
  #else
  	sprintf(devName, "%s/%s", aname, VolumeExternalName(avolid));
! #endif /* AFS_NAMEI_ENV */
  	code = unlink(devName);
  	if (code) code = errno;
      }
--- 204,214 ----
  	 * volume's ID in its inode, and has to be removed explicitly.
  	 */
  	/* reuse devName buffer now */
! #ifdef AFS_NT40_ENV
  	sprintf(devName, "%c:\\%s", *lastDevComp , VolumeExternalName(avolid));
  #else
  	sprintf(devName, "%s/%s", aname, VolumeExternalName(avolid));
! #endif /* AFS_NT40_ENV */
  	code = unlink(devName);
  	if (code) code = errno;
      }
Index: openafs/src/vol/partition.c
diff -c openafs/src/vol/partition.c:1.11.4.7 openafs/src/vol/partition.c:1.11.4.8
*** openafs/src/vol/partition.c:1.11.4.7	Wed Sep 11 04:18:12 2002
--- openafs/src/vol/partition.c	Sat Jan 11 02:42:39 2003
***************
*** 18,24 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/partition.c,v 1.11.4.7 2002/09/11 08:18:12 shadow Exp $");
  
  #include <ctype.h>
  #ifdef AFS_NT40_ENV
--- 18,24 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/partition.c,v 1.11.4.8 2003/01/11 07:42:39 shadow Exp $");
  
  #include <ctype.h>
  #ifdef AFS_NT40_ENV
***************
*** 59,65 ****
  #endif
  #endif /* AFS_VFSINCL_ENV */
  #endif	/* AFS_OSF_ENV */
! #include <sys/errno.h>
  #include <sys/stat.h>
  #include <stdio.h>
  #include <sys/file.h>
--- 59,65 ----
  #endif
  #endif /* AFS_VFSINCL_ENV */
  #endif	/* AFS_OSF_ENV */
! #include <errno.h>
  #include <sys/stat.h>
  #include <stdio.h>
  #include <sys/file.h>
***************
*** 811,817 ****
  #else
  void VSetPartitionDiskUsage_r(register struct DiskPartition *dp)
  {
-     extern int errno;
      int fd, totalblks, free, used, availblks, bsize, code;
      int reserved;
  #if AFS_HAVE_STATVFS
--- 811,816 ----
Index: openafs/src/vol/vnode.c
diff -c openafs/src/vol/vnode.c:1.5.2.2 openafs/src/vol/vnode.c:1.5.2.4
*** openafs/src/vol/vnode.c:1.5.2.2	Sat Oct 13 00:22:11 2001
--- openafs/src/vol/vnode.c	Thu Mar  6 09:53:50 2003
***************
*** 16,22 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vnode.c,v 1.5.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
--- 16,22 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vnode.c,v 1.5.2.4 2003/03/06 14:53:50 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
***************
*** 55,61 ****
  #include <unistd.h>
  #endif /* AFS_NT40_ENV */
  #include <sys/stat.h>
! 
  
  struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES];
  
--- 55,61 ----
  #include <unistd.h>
  #endif /* AFS_NT40_ENV */
  #include <sys/stat.h>
! #include <stdarg.h>
  
  struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES];
  
***************
*** 634,640 ****
      /* Check that the vnode hasn't been removed while we were obtaining
         the lock */
      VNLog(102, 2, vnodeNumber, (afs_int32) vnp);
!     if (vnp->disk.type == vNull) {
  	if (vnp->nUsers-- == 1)
  	    StickOnLruChain_r(vnp,vcp);
  	if (locktype == READ_LOCK)
--- 634,640 ----
      /* Check that the vnode hasn't been removed while we were obtaining
         the lock */
      VNLog(102, 2, vnodeNumber, (afs_int32) vnp);
!     if ((vnp->disk.type == vNull) || (vnp->cacheCheck == 0)){
  	if (vnp->nUsers-- == 1)
  	    StickOnLruChain_r(vnp,vcp);
  	if (locktype == READ_LOCK)
Index: openafs/src/vol/vol-salvage.c
diff -c openafs/src/vol/vol-salvage.c:1.10.2.7 openafs/src/vol/vol-salvage.c:1.10.2.10
*** openafs/src/vol/vol-salvage.c:1.10.2.7	Wed Sep 11 04:18:12 2002
--- openafs/src/vol/vol-salvage.c	Mon Apr  7 13:54:45 2003
***************
*** 91,97 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vol-salvage.c,v 1.10.2.7 2002/09/11 08:18:12 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
--- 91,97 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/vol-salvage.c,v 1.10.2.10 2003/04/07 17:54:45 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
***************
*** 1114,1120 ****
  void SalvageFileSys1(struct DiskPartition *partP, VolumeId singleVolumeNumber)
  {
      char *name, *tdir;
!     char inodeListPath[50];
      static char tmpDevName[100];
      static char wpath[100];
      struct VolumeSummary *vsp, *esp;
--- 1114,1120 ----
  void SalvageFileSys1(struct DiskPartition *partP, VolumeId singleVolumeNumber)
  {
      char *name, *tdir;
!     char inodeListPath[256];
      static char tmpDevName[100];
      static char wpath[100];
      struct VolumeSummary *vsp, *esp;
***************
*** 1180,1188 ****
      tdir = (tmpdir ? tmpdir : fileSysPath);
  #ifdef AFS_NT40_ENV
      (void) _putenv("TMP="); /* If "TMP" is set, then that overrides tdir. */
!     (void) strcpy(inodeListPath, _tempnam(tdir, "salvage.inodes."));
  #else
!     sprintf(inodeListPath, "%s/salvage.inodes.%s.%d", tdir, name, getpid());
  #endif
      if (GetInodeSummary(inodeListPath, singleVolumeNumber) < 0) {
  	unlink(inodeListPath);
--- 1180,1188 ----
      tdir = (tmpdir ? tmpdir : fileSysPath);
  #ifdef AFS_NT40_ENV
      (void) _putenv("TMP="); /* If "TMP" is set, then that overrides tdir. */
!     (void) strncpy(inodeListPath, _tempnam(tdir, "salvage.inodes."), 255);
  #else
!     snprintf(inodeListPath, 255, "%s/salvage.inodes.%s.%d", tdir, name, getpid());
  #endif
      if (GetInodeSummary(inodeListPath, singleVolumeNumber) < 0) {
  	unlink(inodeListPath);
***************
*** 1797,1804 ****
      allInodes = inodes - isp->index; /* this would the base of all the inodes
  					for the partition, if all the inodes
  					had been read into memory */
!     assert(lseek(inodeFd,isp->index*sizeof(struct ViceInodeInfo),SEEK_SET) != -1)
!     assert(read(inodeFd,inodes,size) == size)
  
      /* Don't try to salvage a read write volume if there isn't one on this
         partition */
--- 1797,1804 ----
      allInodes = inodes - isp->index; /* this would the base of all the inodes
  					for the partition, if all the inodes
  					had been read into memory */
!     assert(lseek(inodeFd,isp->index*sizeof(struct ViceInodeInfo),SEEK_SET) != -1);
!     assert(read(inodeFd,inodes,size) == size);
  
      /* Don't try to salvage a read write volume if there isn't one on this
         partition */
***************
*** 2074,2080 ****
  	    isp->volumeId, (Testing?"it would have been ":""),
  			   fileSysPathName, name);
  	headerFd = open(name, O_RDWR|O_CREAT|O_TRUNC, 0644);
! 	assert(headerFd != -1)
  	isp->volSummary = (struct VolumeSummary *)
  	    malloc(sizeof(struct VolumeSummary));
  	isp->volSummary->fileName = ToString(name);
--- 2074,2080 ----
  	    isp->volumeId, (Testing?"it would have been ":""),
  			   fileSysPathName, name);
  	headerFd = open(name, O_RDWR|O_CREAT|O_TRUNC, 0644);
! 	assert(headerFd != -1);
  	isp->volSummary = (struct VolumeSummary *)
  	    malloc(sizeof(struct VolumeSummary));
  	isp->volSummary->fileName = ToString(name);
***************
*** 2100,2106 ****
  		return -1;
  
  	    headerFd = open(name, O_RDWR|O_TRUNC, 0644);
! 	    assert(headerFd != -1)
  	  }
      }
      if (headerFd) {
--- 2100,2106 ----
  		return -1;
  
  	    headerFd = open(name, O_RDWR|O_TRUNC, 0644);
! 	    assert(headerFd != -1);
  	  }
      }
      if (headerFd) {
***************
*** 2307,2320 ****
      fdP = IH_OPEN(handle);
      assert(fdP != NULL);
      file = FDH_FDOPEN(fdP, "r+");
!     assert(file != NULL)
      vcp = &VnodeClassInfo[class];
      size = OS_SIZE(fdP->fd_fd);
      assert(size != -1);
      nVnodes = (size / vcp->diskSize) - 1;
      if (nVnodes > 0) {
! 	assert((nVnodes+1) * vcp->diskSize == size)
! 	assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0)
      }
      else {
  	nVnodes = 0;
--- 2307,2320 ----
      fdP = IH_OPEN(handle);
      assert(fdP != NULL);
      file = FDH_FDOPEN(fdP, "r+");
!     assert(file != NULL);
      vcp = &VnodeClassInfo[class];
      size = OS_SIZE(fdP->fd_fd);
      assert(size != -1);
      nVnodes = (size / vcp->diskSize) - 1;
      if (nVnodes > 0) {
! 	assert((nVnodes+1) * vcp->diskSize == size);
! 	assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0);
      }
      else {
  	nVnodes = 0;
***************
*** 2699,2710 ****
  	}
  	if (!Testing) {
  	    CopyOnWrite(dir);
! 	    assert(Delete(&dir->dirHandle, name) == 0)
          }
  	return;
      }
   
  #ifdef AFS_AIX_ENV
      /* On AIX machines, don't allow entries to point to inode 0. That is a special 
       * mount inode for the partition. If this inode were deleted, it would crash
       * the machine.
--- 2699,2711 ----
  	}
  	if (!Testing) {
  	    CopyOnWrite(dir);
! 	    assert(Delete(&dir->dirHandle, name) == 0);
          }
  	return;
      }
   
  #ifdef AFS_AIX_ENV
+ #ifndef AFS_NAMEI_ENV
      /* On AIX machines, don't allow entries to point to inode 0. That is a special 
       * mount inode for the partition. If this inode were deleted, it would crash
       * the machine.
***************
*** 2721,2726 ****
--- 2722,2728 ----
         return;
      }
  #endif
+ #endif
  
      if (!(vnodeNumber & 1) && !Showmode &&
  	!(vnodeEssence->count || vnodeEssence->unique || vnodeEssence->modeBits)) {
***************
*** 2765,2773 ****
  	    fid.Vnode = vnodeNumber;
  	    fid.Unique = vnodeEssence->unique;
  	    CopyOnWrite(dir);
! 	    assert(Delete(&dir->dirHandle, name) == 0)
  	    if (!todelete)
! 	       assert(Create(&dir->dirHandle, name, &fid) == 0)
  	}
  	if (todelete) return; /* no need to continue */
      }
--- 2767,2775 ----
  	    fid.Vnode = vnodeNumber;
  	    fid.Unique = vnodeEssence->unique;
  	    CopyOnWrite(dir);
! 	    assert(Delete(&dir->dirHandle, name) == 0);
  	    if (!todelete)
! 	       assert(Create(&dir->dirHandle, name, &fid) == 0);
  	}
  	if (todelete) return; /* no need to continue */
      }
***************
*** 2779,2788 ****
  	        dir->vnodeNumber, dir->unique, vnodeNumber, unique);
  	    if (!Testing) {
  		CopyOnWrite(dir);
! 		assert(Delete(&dir->dirHandle, ".") == 0)
  		fid.Vnode = dir->vnodeNumber;
  		fid.Unique = dir->unique;
! 		assert(Create(&dir->dirHandle, ".", &fid) == 0)
  	    }
  
  	    vnodeNumber = fid.Vnode;         /* Get the new Essence */
--- 2781,2790 ----
  	        dir->vnodeNumber, dir->unique, vnodeNumber, unique);
  	    if (!Testing) {
  		CopyOnWrite(dir);
! 		assert(Delete(&dir->dirHandle, ".") == 0);
  		fid.Vnode = dir->vnodeNumber;
  		fid.Unique = dir->unique;
! 		assert(Create(&dir->dirHandle, ".", &fid) == 0);
  	    }
  
  	    vnodeNumber = fid.Vnode;         /* Get the new Essence */
***************
*** 2825,2831 ****
  	}
          if (!Testing) {
  	    CopyOnWrite(dir);
! 	    assert(Delete(&dir->dirHandle, name) == 0)
  	}
  	vnodeEssence->claimed  = 0;   /* Not claimed: Orphaned */
  	vnodeEssence->todelete = 1;   /* Will later delete vnode and decr inode */
--- 2827,2833 ----
  	}
          if (!Testing) {
  	    CopyOnWrite(dir);
! 	    assert(Delete(&dir->dirHandle, name) == 0);
  	}
  	vnodeEssence->claimed  = 0;   /* Not claimed: Orphaned */
  	vnodeEssence->todelete = 1;   /* Will later delete vnode and decr inode */
***************
*** 2931,2950 ****
  
      IH_INIT(vip->handle, fileSysDevice, rwVId, ino);
      fdP = IH_OPEN(vip->handle);
!     assert(fdP != NULL)
      file = FDH_FDOPEN(fdP, "r+");
      assert(file != NULL);
      size = OS_SIZE(fdP->fd_fd);
      assert(size != -1);
      vip->nVnodes = (size / vcp->diskSize) - 1;
      if (vip->nVnodes > 0) {
! 	assert((vip->nVnodes+1)*vcp->diskSize == size)
! 	assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0)
  	assert((vip->vnodes = (struct VnodeEssence *)
! 	  calloc(vip->nVnodes, sizeof(struct VnodeEssence))) != NULL)
  	if (class == vLarge) {
  	    assert((vip->inodes = (Inode *)
! 	      calloc(vip->nVnodes, sizeof (Inode))) != NULL)
  	}
  	else {
  	    vip->inodes = NULL;
--- 2933,2952 ----
  
      IH_INIT(vip->handle, fileSysDevice, rwVId, ino);
      fdP = IH_OPEN(vip->handle);
!     assert(fdP != NULL);
      file = FDH_FDOPEN(fdP, "r+");
      assert(file != NULL);
      size = OS_SIZE(fdP->fd_fd);
      assert(size != -1);
      vip->nVnodes = (size / vcp->diskSize) - 1;
      if (vip->nVnodes > 0) {
! 	assert((vip->nVnodes+1)*vcp->diskSize == size);
! 	assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0);
  	assert((vip->vnodes = (struct VnodeEssence *)
! 	  calloc(vip->nVnodes, sizeof(struct VnodeEssence))) != NULL);
  	if (class == vLarge) {
  	    assert((vip->inodes = (Inode *)
! 	      calloc(vip->nVnodes, sizeof (Inode))) != NULL);
  	}
  	else {
  	    vip->inodes = NULL;
***************
*** 2976,2982 ****
  	    vep->owner = vnode->owner;
  	    vep->group = vnode->group;
  	    if (vnode->type == vDirectory) {
! 		assert(class == vLarge)
  		vip->inodes[vnodeIndex] = VNDISK_GET_INO(vnode); 
  	    }
  	}
--- 2978,2984 ----
  	    vep->owner = vnode->owner;
  	    vep->group = vnode->group;
  	    if (vnode->type == vDirectory) {
! 		assert(class == vLarge);
  		vip->inodes[vnodeIndex] = VNDISK_GET_INO(vnode); 
  	    }
  	}
***************
*** 3380,3386 ****
      
      nBytes = IH_IREAD(h, 0, (char*)&volHeader, sizeof(volHeader));
      assert(nBytes == sizeof(volHeader));
!     assert(volHeader.stamp.magic == VOLUMEINFOMAGIC)
      volHeader.inUse = 0;
      volHeader.needsSalvaged = 0;
      volHeader.inService = 1;
--- 3382,3388 ----
      
      nBytes = IH_IREAD(h, 0, (char*)&volHeader, sizeof(volHeader));
      assert(nBytes == sizeof(volHeader));
!     assert(volHeader.stamp.magic == VOLUMEINFOMAGIC);
      volHeader.inUse = 0;
      volHeader.needsSalvaged = 0;
      volHeader.inService = 1;
***************
*** 3514,3520 ****
      assert(0); /* Fork is never executed in the NT code path */
  #else
      f = fork();
!     assert(f >= 0)
  #endif
      return f;
  }
--- 3516,3522 ----
      assert(0); /* Fork is never executed in the NT code path */
  #else
      f = fork();
!     assert(f >= 0);
  #endif
      return f;
  }
***************
*** 3538,3544 ****
      int status;
      int pid;
      pid = wait(&status);
!     assert(pid != -1)
      if (WCOREDUMP(status))
  	Log("\"%s\" core dumped!\n", prog);
      if (WIFSIGNALED(status) != 0 || WEXITSTATUS(status) != 0)
--- 3540,3546 ----
      int status;
      int pid;
      pid = wait(&status);
!     assert(pid != -1);
      if (WCOREDUMP(status))
  	Log("\"%s\" core dumped!\n", prog);
      if (WIFSIGNALED(status) != 0 || WEXITSTATUS(status) != 0)
***************
*** 3655,3661 ****
  {
      register char *p;
      p = (char *) malloc(strlen(s)+1);
!     assert(p != NULL)
      strcpy(p,s);
      return p;
  
--- 3657,3663 ----
  {
      register char *p;
      p = (char *) malloc(strlen(s)+1);
!     assert(p != NULL);
      strcpy(p,s);
      return p;
  
Index: openafs/src/vol/volume.c
diff -c openafs/src/vol/volume.c:1.12.2.4 openafs/src/vol/volume.c:1.12.2.5
*** openafs/src/vol/volume.c:1.12.2.4	Thu Nov 14 15:41:44 2002
--- openafs/src/vol/volume.c	Sat Jan 11 02:44:19 2003
***************
*** 19,25 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/volume.c,v 1.12.2.4 2002/11/14 20:41:44 zacheiss Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
--- 19,25 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/vol/volume.c,v 1.12.2.5 2003/01/11 07:44:19 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
***************
*** 699,704 ****
--- 699,707 ----
      IH_INIT(vp->linkHandle, partp->device, header->parent,
  		   header->linkTable);
      vp->cacheCheck = ++VolumeCacheCheck;
+     /* just in case this ever rolls over */
+     if (!vp->cacheCheck) 
+ 	vp->cacheCheck = ++VolumeCacheCheck;
      vp->shuttingDown = 0;
      vp->goingOffline = 0;
      vp->nUsers = 1;
Index: openafs/src/volser/dumpstuff.c
diff -c openafs/src/volser/dumpstuff.c:1.6.2.2 openafs/src/volser/dumpstuff.c:1.6.2.5
*** openafs/src/volser/dumpstuff.c:1.6.2.2	Sat Oct 13 00:22:11 2001
--- openafs/src/volser/dumpstuff.c	Fri Apr  4 03:29:47 2003
***************
*** 10,16 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/dumpstuff.c,v 1.6.2.2 2001/10/13 04:22:11 shadow Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
--- 10,16 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/volser/dumpstuff.c,v 1.6.2.5 2003/04/04 08:29:47 shadow Exp $");
  
  #include <sys/types.h>
  #include <ctype.h>
***************
*** 75,81 ****
  static int DumpVnodeIndex(register struct iod *iodp, Volume *vp,
  			  VnodeClass class, afs_int32 fromtime, int forcedump);
  static int DumpVnode(register struct iod *iodp, struct VnodeDiskObject *v,
! 		     int vnodeNumber, int dumpEverything);
  static int ReadDumpHeader(register struct iod *iodp, struct DumpHeader *hp);
  static int ReadVnodes(register struct iod *iodp, Volume *vp,
  		      int incremental, afs_int32 *Lbuf, afs_int32 s1,
--- 75,81 ----
  static int DumpVnodeIndex(register struct iod *iodp, Volume *vp,
  			  VnodeClass class, afs_int32 fromtime, int forcedump);
  static int DumpVnode(register struct iod *iodp, struct VnodeDiskObject *v,
! 		     int volid, int vnodeNumber, int dumpEverything);
  static int ReadDumpHeader(register struct iod *iodp, struct DumpHeader *hp);
  static int ReadVnodes(register struct iod *iodp, Volume *vp,
  		      int incremental, afs_int32 *Lbuf, afs_int32 s1,
***************
*** 649,656 ****
      assert(size != -1);
      nVnodes = (size / vcp->diskSize) - 1;
      if (nVnodes > 0) {
! 	assert((nVnodes+1)*vcp->diskSize == size)
! 	assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0)
      }
      else nVnodes = 0;
      for (vnodeIndex = 0; nVnodes && STREAM_READ(vnode, vcp->diskSize, 1, file) == 1 && !code;
--- 649,656 ----
      assert(size != -1);
      nVnodes = (size / vcp->diskSize) - 1;
      if (nVnodes > 0) {
! 	assert((nVnodes+1)*vcp->diskSize == size);
! 	assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0);
      }
      else nVnodes = 0;
      for (vnodeIndex = 0; nVnodes && STREAM_READ(vnode, vcp->diskSize, 1, file) == 1 && !code;
***************
*** 659,665 ****
  	/* Note:  the >= test is very important since some old volumes may not have
    	   a serverModifyTime.  For an epoch dump, this results in 0>=0 test, which
  	   does dump the file! */
! 	if (!code) code = DumpVnode(iodp, vnode, bitNumberToVnodeNumber(vnodeIndex, class), flag);
  	if (!flag) IOMGR_Poll(); /* if we dont' xfr data, but scan instead, could lose conn */
      }
      STREAM_CLOSE(file);
--- 659,665 ----
  	/* Note:  the >= test is very important since some old volumes may not have
    	   a serverModifyTime.  For an epoch dump, this results in 0>=0 test, which
  	   does dump the file! */
! 	if (!code) code = DumpVnode(iodp, vnode, V_id(vp), bitNumberToVnodeNumber(vnodeIndex, class), flag);
  	if (!flag) IOMGR_Poll(); /* if we dont' xfr data, but scan instead, could lose conn */
      }
      STREAM_CLOSE(file);
***************
*** 686,692 ****
  }
  
  static int DumpVnode(register struct iod *iodp, struct VnodeDiskObject *v,
! 		     int vnodeNumber, int dumpEverything)
  {
      int code = 0;
      IHandle_t *ihP;
--- 686,692 ----
  }
  
  static int DumpVnode(register struct iod *iodp, struct VnodeDiskObject *v,
! 		     int volid, int vnodeNumber, int dumpEverything)
  {
      int code = 0;
      IHandle_t *ihP;
***************
*** 715,722 ****
  	IH_INIT(ihP, iodp->device, iodp->parentId, VNDISK_GET_INO(v));
  	fdP = IH_OPEN(ihP);
  	if (fdP == NULL) {
! 	    Log("1 Volser: DumpVnode: dump: Unable to open inode %d for vnode %d; not dumped, error %d\n",
! 		VNDISK_GET_INO(v), vnodeNumber, errno);
  	    IH_RELEASE(ihP);
  	    return VOLSERREAD_DUMPERROR;
  	}
--- 715,722 ----
  	IH_INIT(ihP, iodp->device, iodp->parentId, VNDISK_GET_INO(v));
  	fdP = IH_OPEN(ihP);
  	if (fdP == NULL) {
! 	    Log("1 Volser: DumpVnode: dump: Unable to open inode %d for vnode %d (volume %d); not dumped, error %d\n",
! 		VNDISK_GET_INO(v), vnodeNumber, volid, errno);
  	    IH_RELEASE(ihP);
  	    return VOLSERREAD_DUMPERROR;
  	}
***************
*** 780,786 ****
  	OS_SYNC(afile->str_fd);
      } else {
  	size = OS_SIZE(fdP->fd_fd);
! 	assert(size != -1)
  	nVnodes = (size <= vcp->diskSize ? 0 :
  		   size-vcp->diskSize) >> vcp->logSize;
  	if (nVnodes > 0) {
--- 780,786 ----
  	OS_SYNC(afile->str_fd);
      } else {
  	size = OS_SIZE(fdP->fd_fd);
! 	assert(size != -1);
  	nVnodes = (size <= vcp->diskSize ? 0 :
  		   size-vcp->diskSize) >> vcp->logSize;
  	if (nVnodes > 0) {
Index: openafs/src/xstat/xstat_fs_callback.c
diff -c openafs/src/xstat/xstat_fs_callback.c:1.4.4.1 openafs/src/xstat/xstat_fs_callback.c:1.4.4.2
*** openafs/src/xstat/xstat_fs_callback.c:1.4.4.1	Sat Apr 20 23:52:18 2002
--- openafs/src/xstat/xstat_fs_callback.c	Thu Mar  6 09:53:51 2003
***************
*** 25,31 ****
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/xstat/xstat_fs_callback.c,v 1.4.4.1 2002/04/21 03:52:18 zacheiss Exp $");
  
  #include <errno.h>
  #include <stdio.h>			/*Standard I/O stuff*/
--- 25,31 ----
  #include <afsconfig.h>
  #include <afs/param.h>
  
! RCSID("$Header: /data/cvs/openafs/src/xstat/xstat_fs_callback.c,v 1.4.4.2 2003/03/06 14:53:51 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>			/*Standard I/O stuff*/
***************
*** 645,650 ****
--- 645,660 ----
  int SRXAFSCB_GetCellServDB(
      struct rx_call *a_call,
      afs_int32 a_index,
+     char **a_name,
+     serverList *a_hosts)
+ {
+     return RXGEN_OPCODE;
+ }
+ 
+ 
+ afs_int32 SRXAFSCB_GetCellByNum(
+     struct rx_call *a_call,
+     afs_int32 a_cellnum,
      char **a_name,
      serverList *a_hosts)
  {
