Index: openafs/src/BUILDNOTES
diff -c openafs/src/BUILDNOTES:1.1 openafs/src/BUILDNOTES:1.1.2.2
*** openafs/src/BUILDNOTES:1.1	Sat Dec  2 13:17:50 2000
--- openafs/src/BUILDNOTES	Mon Apr 23 02:54:54 2001
***************
*** 13,19 ****
  	source tree with a switch in include/linux/version.h.
  
  HPUX 11.0 (hp_ux110):
! 	Does not currently build. However, you will need to make sure 
! 	the KernDevKit package from the CoreOS media is installed if
! 	you wish to work on it.
  
--- 13,27 ----
  	source tree with a switch in include/linux/version.h.
  
  HPUX 11.0 (hp_ux110):
! 	Does not currently build libafs, which means no afs client support,
! 	however, the client tools, and all of the server code does get built.
! 	
! 	For future kernel development, the KernDevKit package from the CoreOS
! 	media is required.
  
+ HPUX 10.2 (hp_ux102):
+ 	Does not currently build libafs, which means no afs client support,
+ 	however, the client tools, and all of the server code does get built.
+ 	
+ 	Requires that the DCE-CoreTools and possible the KernDevKit package
+ 	from CoreOS media be installed.
Index: openafs/src/Makefile
diff -c openafs/src/Makefile:1.4.2.5 openafs/src/Makefile:1.4.2.14
*** openafs/src/Makefile:1.4.2.5	Tue Mar  6 17:26:48 2001
--- openafs/src/Makefile	Mon Apr 23 03:35:14 2001
***************
*** 20,25 ****
--- 20,29 ----
  
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
+ # Enable build+install of obsolete and insecure packages
+ # Set to anything other than YES, or comment out to disable the build
+ WITH_DEPRECATED=YES
+ 
  # To compile AFS from scratch in the src tree run "make SYS_NAME=<type>".
  #   This recursively calls "make install ..." and does not depend on the
  #   existence of any non-standard programs.
***************
*** 69,75 ****
  cmd: basics comerr
  	${COMPILE_PART1} cmd ${COMPILE_PART2}
  	@case ${SYS_NAME} in \
! 	sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* | sparc64_linux* ) \
  		${COMPILE_PART1} cmd ${COMPILE_PART2} install64 ;; \
  	esac
  
--- 73,79 ----
  cmd: basics comerr
  	${COMPILE_PART1} cmd ${COMPILE_PART2}
  	@case ${SYS_NAME} in \
! 	sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* | sparc64_linux* | alpha_linux* ) \
  		${COMPILE_PART1} cmd ${COMPILE_PART2} install64 ;; \
  	esac
  
***************
*** 181,187 ****
  
  tviced: project viced vlserver libafsrpc libafsauthent
  	case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux*) \
  		${COMPILE_PART1} tviced  ${COMPILE_PART2} ;; \
  	*) \
  		echo Not building MT viced for ${SYS_NAME} ;; \
--- 185,191 ----
  
  tviced: project viced vlserver libafsrpc libafsauthent
  	case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
  		${COMPILE_PART1} tviced  ${COMPILE_PART2} ;; \
  	*) \
  		echo Not building MT viced for ${SYS_NAME} ;; \
***************
*** 202,208 ****
  
  gtx: project null auth # kauth rxkad ?
  	case ${SYS_NAME} in \
! 	  rs_aix* | sun4x_5? | sgi_6? | *linux*) \
  		rm -f ${DESTDIR}lib/afs/libtermlib.a; \
  		ln -s libnull.a ${DESTDIR}lib/afs/libtermlib.a; \
  		${COMPILE_PART1} gtx ${COMPILE_PART2};; \
--- 206,212 ----
  
  gtx: project null auth # kauth rxkad ?
  	case ${SYS_NAME} in \
! 	  rs_aix* | sun4x_5? | sgi_6? | *linux* | ppc_darwin* | *fbsd*) \
  		rm -f ${DESTDIR}lib/afs/libtermlib.a; \
  		ln -s libnull.a ${DESTDIR}lib/afs/libtermlib.a; \
  		${COMPILE_PART1} gtx ${COMPILE_PART2};; \
***************
*** 218,245 ****
  scout: project gtx fsprobe
  	${COMPILE_PART1} scout ${COMPILE_PART2}
  
- mpp: project
- 	${COMPILE_PART1} mpp ${COMPILE_PART2}
- 
- package: project mpp
- 	${COMPILE_PART1} package ${COMPILE_PART2}
- 
- package.files: package
- 	${DESTDIR}/bin/makepkgfiles afs.dev
- 
  uss: des kauth project rx vlserver vol
  	${COMPILE_PART1} uss ${COMPILE_PART2}
  
- ntp: project volser
- 	case ${SYS_NAME} in \
- 	  sun4x_58 ) echo skipping ntp for ${SYS_NAME} ;; \
- 	  *linux* ) echo skipping ntp for ${SYS_NAME} ;; \
- 	  * ) ${COMPILE_PART1} ntp ${COMPILE_PART2} ;; \
- 	esac
- 
- #convert: project ntp
- #	${COMPILE_PART1} convert ${COMPILE_PART2}
- 
  bozo: project ntp audit
  	${COMPILE_PART1} bozo ${COMPILE_PART2}
  
--- 222,230 ----
***************
*** 252,262 ****
  vfsck:	minproject vol
  	set -x; \
  	case ${SYS_NAME} in \
! 	sgi_* | *linux*) \
! 		echo skip vfsck for ${SYS_NAME} ;; \
! 	rs_aix42)	\
! 		echo skip vfsck for ${SYS_NAME} ;; \
! 	sun4x_58 )  \
  		echo skip vfsck for ${SYS_NAME} ;; \
  	 * ) \
  		${COMPILE_PART1} vfsck ${COMPILE_PART2} ;; \
--- 237,243 ----
  vfsck:	minproject vol
  	set -x; \
  	case ${SYS_NAME} in \
! 	sgi_* | *linux* | rs_aix42 | ppc_darwin* | hp_ux* | *fbsd* ) \
  		echo skip vfsck for ${SYS_NAME} ;; \
  	 * ) \
  		${COMPILE_PART1} vfsck ${COMPILE_PART2} ;; \
***************
*** 274,319 ****
  		${COMPILE_PART1} sia ${COMPILE_PART2} ;; \
  	sun4x_55 ) \
  		 ${COMPILE_PART1} login ${COMPILE_PART2} ;; \
! 	sun4x_* | hp_ux11* | *linux* ) \
  		${COMPILE_PART1} pam ${COMPILE_PART2} ;; \
  	* ) \
  		${COMPILE_PART1} login ${COMPILE_PART2} ;; \
  	esac
  
- ftpd43+: project kauth rxkad
- 	case ${SYS_NAME} in \
- 	rs_aix* | sun4x_55 | *linux*) \
- 		${COMPILE_PART1} ftpd43+ ${COMPILE_PART2} ;; \
- 	* )	echo skip ftpd43+ for ${SYS_NAME} ;; \
- 	esac
- 
- inetd: project kauth rxkad
- 	${COMPILE_PART1} inetd ${COMPILE_PART2} 
- 
- rsh: project inetd
- 	${COMPILE_PART1} rsh ${COMPILE_PART2} 
- 
- rlogind: project rsh ftpd43+ login
- 	case ${SYS_NAME} in \
- 	rs_aix*) \
- 		${COMPILE_PART1} rlogind ${COMPILE_PART2} ;; \
- 	* )	echo skipping rlogind for ${SYS_NAME} ;; \
- 	esac
- 
- sgistuff: project rlogind
- 	case ${SYS_NAME} in \
- 	sgi_* )	${COMPILE_PART1} sgistuff ${COMPILE_PART2} ;; \
- 	* )	echo skipping sgistuff for ${SYS_NAME} ;; \
- 	esac
- 
- rcp: project rsh inetd
- 	case ${SYS_NAME} in \
- 	sgi_* )	echo skip rcp for ${SYS_NAME} ;; \
- 	*)	${COMPILE_PART1} rcp ${COMPILE_PART2} ;; \
- 	esac
- 
- allrcmds: project rcp rlogind
- 
  KERNELDIR= \
    afs \
    dir \
--- 255,268 ----
  		${COMPILE_PART1} sia ${COMPILE_PART2} ;; \
  	sun4x_55 ) \
  		 ${COMPILE_PART1} login ${COMPILE_PART2} ;; \
! 	sun4x_* | hp_ux11* | *linux* | *fbsd* ) \
  		${COMPILE_PART1} pam ${COMPILE_PART2} ;; \
+ 	ppc_darwin* ) \
+ 		echo Skipping login for ${SYS_NAME} ;; \
  	* ) \
  		${COMPILE_PART1} login ${COMPILE_PART2} ;; \
  	esac
  
  KERNELDIR= \
    afs \
    dir \
***************
*** 347,353 ****
  	${COMPILE_PART1} libafs ${COMPILE_PART2}
  
  libuafs: minproject libuafs_setup ${UKERNELDIR}
! 	${COMPILE_PART1} libuafs ${COMPILE_PART2}
  
  afsweb: minproject kauth dauth 
  	${COMPILE_PART1} afsweb ${COMPILE_PART2}
--- 296,308 ----
  	${COMPILE_PART1} libafs ${COMPILE_PART2}
  
  libuafs: minproject libuafs_setup ${UKERNELDIR}
! 	set -x; \
! 	case ${SYS_NAME} in \
! 	hp_ux102* ) \
! 		echo Skipping libuafs for ${SYS_NAME} ;; \
! 	* ) \
! 		${COMPILE_PART1} libuafs ${COMPILE_PART2} ;; \
! 	esac
  
  afsweb: minproject kauth dauth 
  	${COMPILE_PART1} afsweb ${COMPILE_PART2}
***************
*** 375,381 ****
  
  tbutc: project bubasics butm budb bucoord cmd butc
  	case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun4x_*|rs_aix4*|*linux*|hp_ux*) \
  		${COMPILE_PART1} tbutc ${COMPILE_PART2} ;; \
  	*) \
  		echo Not building MT butc for ${SYS_NAME} ;; \
--- 330,336 ----
  
  tbutc: project bubasics butm budb bucoord cmd butc
  	case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun4x_*|rs_aix4*|*linux*|hp_ux110) \
  		${COMPILE_PART1} tbutc ${COMPILE_PART2} ;; \
  	*) \
  		echo Not building MT butc for ${SYS_NAME} ;; \
***************
*** 393,398 ****
--- 348,356 ----
  afsmonitor: project gtx xstat
  	${COMPILE_PART1} afsmonitor ${COMPILE_PART2}
  
+ #
+ # Washtool internal targets
+ #
  ircs: project
  	case ${SYS_NAME} in \
  	sgi_* ) \
***************
*** 413,424 ****
  
  # pthread based user space RX library
  libafsrpc: rx rxkad des
! 	${COMPILE_PART1} libafsrpc  ${COMPILE_PART2}
  
  libafsauthent: ubik auth kauth libafsrpc
! 	${COMPILE_PART1} libafsauthent  ${COMPILE_PART2}
  
! libadmin: libafsauthent bozo
  	${COMPILE_PART1} libadmin ${COMPILE_PART2}
  	${COMPILE_PART1} libadmin/adminutil ${COMPILE_PART2}
  	${COMPILE_PART1} libadmin/vos ${COMPILE_PART2}
--- 371,392 ----
  
  # pthread based user space RX library
  libafsrpc: rx rxkad des
! 	case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
! 	${COMPILE_PART1} libafsrpc  ${COMPILE_PART2} ;; \
! 	*) \
! 		echo Not building MT libafsrpc for ${SYS_NAME} ;; \
! 	esac
  
  libafsauthent: ubik auth kauth libafsrpc
! 	case ${SYS_NAME} in \
! 	alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
! 	${COMPILE_PART1} libafsauthent  ${COMPILE_PART2} ;; \
! 	*) \
! 		echo Not building MT libafsrpc for ${SYS_NAME} ;; \
! 	esac
  
! libadmin_real: 
  	${COMPILE_PART1} libadmin ${COMPILE_PART2}
  	${COMPILE_PART1} libadmin/adminutil ${COMPILE_PART2}
  	${COMPILE_PART1} libadmin/vos ${COMPILE_PART2}
***************
*** 430,435 ****
--- 398,416 ----
  	${COMPILE_PART1} libadmin/test ${COMPILE_PART2}
  	${COMPILE_PART1} libadmin/samples ${COMPILE_PART2}
  
+ libadmin: libafsauthent bozo
+ 	case ${SYS_NAME} in \
+ 	alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
+ 			$(MAKE) libadmin_real SYS_NAME=$(SYS_NAME) \
+ 			WASHTOOL="$(WASHTOOL)" \
+ 			COMPILE_PART1="$(COMPILE_PART1)" \
+ 			COMPILE_PART2="$(COMPILE_PART2)" \
+ 			SRCDIR=$(SRCDIR) DESTDIR=$(DESTDIR) \
+ 			DBG_DEFS=$(DBG_DEFS) ;; \
+ 	*) \
+ 		echo Not building MT libadmin for ${SYS_NAME} ;; \
+ 	esac
+ 
  finale: project cmd comerr afsd allrcmds butc tbutc libafs libuafs audit kauth log package \
  	ptserver scout bu_utils ubik uss bozo vfsck volser \
  	venus update xstat afsmonitor dauth tests libafsrpc \
***************
*** 451,462 ****
--- 432,447 ----
  		MKAFS_OSTYPE=HPUX;; \
  	*linux*) \
  		MKAFS_OSTYPE=LINUX;; \
+ 	*fbsd*) \
+ 		MKAFS_OSTYPE=FBSD;; \
  	rs_aix* ) \
  		MKAFS_OSTYPE=AIX;; \
  	sgi_* ) \
  		MKAFS_OSTYPE=IRIX;; \
  	sun4x_5* ) \
  		MKAFS_OSTYPE=SOLARIS;; \
+ 	ppc_darwin* ) \
+ 		MKAFS_OSTYPE=DARWIN;; \
  	* ) \
  		echo WARNING: No MakefileProto for sys ${SYS_NAME} ; \
  	esac; \
***************
*** 472,477 ****
--- 457,464 ----
  		MKAFS_OSTYPE=HPUX;; \
  	*linux*) \
  		MKAFS_OSTYPE=LINUX;; \
+ 	*fbsd*) \
+ 		MKAFS_OSTYPE=FBSD;; \
  	rs_aix* ) \
  		MKAFS_OSTYPE=AIX;; \
  	sun4x_5* ) \
***************
*** 480,485 ****
--- 467,474 ----
  		MKAFS_OSTYPE=DUX;; \
  	sgi_6* ) \
  		MKAFS_OSTYPE=IRIX;; \
+ 	ppc_darwin* ) \
+ 		MKAFS_OSTYPE=DARWIN;; \
  	* ) \
  		echo WARNING: No MakefileProto for sys ${SYS_NAME} ; \
  	esac; \
***************
*** 487,494 ****
  
  # "COMPILE_PART1=${COMPILE_PART1}" "COMPILE_PART2=${COMPILE_PART2}" SYS_NAME=${SYS_NAME} ;; 
  
  install:
! 	$(MAKE) finale "SYS_NAME=${SYS_NAME}" "WASHTOOL=${WASHTOOL}" \
  		"COMPILE_PART1=${COMPILE_PART1}" \
  		"COMPILE_PART2=${COMPILE_PART2}" \
  		 DESTDIR=`pwd`/${SYS_NAME}/dest/ \
--- 476,484 ----
  
  # "COMPILE_PART1=${COMPILE_PART1}" "COMPILE_PART2=${COMPILE_PART2}" SYS_NAME=${SYS_NAME} ;; 
  
+ TARGET=finale
  install:
! 	$(MAKE) $(TARGET) "SYS_NAME=${SYS_NAME}" "WASHTOOL=${WASHTOOL}" \
  		"COMPILE_PART1=${COMPILE_PART1}" \
  		"COMPILE_PART2=${COMPILE_PART2}" \
  		 DESTDIR=`pwd`/${SYS_NAME}/dest/ \
***************
*** 534,536 ****
--- 524,611 ----
  	for file in `find [!NW]* -type f -print` ; do \
  		/bin/ln -s `pwd`/$${file} $${here}/obj/$${file} ; \
  	done;
+ 
+ #
+ # Below targets are all deprecated, insecure, or obsolte, 
+ # see README.OBSOLETE and README.INSECURE for more info
+ #
+ 
+ mpp: project
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	${COMPILE_PART1} mpp ${COMPILE_PART2} ;; \
+ 	*)	echo skipping deprecated target: mpp ;; \
+ 	esac
+ 
+ package: project mpp
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	${COMPILE_PART1} package ${COMPILE_PART2} ;; \
+ 	*)	echo skipping deprecated target: package ;; \
+ 	esac
+ 
+ package.files: package
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	${DESTDIR}/bin/makepkgfiles afs.dev ;; \
+ 	*)	echo skipping deprecated target: package.files ;; \
+ 	esac
+ 
+ ntp: project volser
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	case ${SYS_NAME} in \
+ 		sun4x_58 | *linux* | *fbsd* | ppc_darwin* ) echo skipping ntp for ${SYS_NAME} ;; \
+ 		* ) ${COMPILE_PART1} ntp ${COMPILE_PART2} ;; \
+ 		esac ;; \
+ 	*)	echo skipping deprecated target: ntp ;; \
+ 	esac
+ 
+ sgistuff: project rlogind
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	case ${SYS_NAME} in \
+ 		sgi_* )	${COMPILE_PART1} sgistuff ${COMPILE_PART2} ;; \
+ 		* ) echo skipping sgistuff for ${SYS_NAME} ;; \
+ 		esac ;; \
+ 	*)	echo skipping deprecated target: sgistuff ;; \
+ 	esac
+ 
+ ftpd43+: project kauth rxkad
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	case ${SYS_NAME} in \
+ 		rs_aix* | sun4x_55 | *linux*) \
+ 			${COMPILE_PART1} ftpd43+ ${COMPILE_PART2} ;; \
+ 		*) echo skip ftpd43+ for ${SYS_NAME} ;; \
+ 		esac ;; \
+ 	*)	echo skipping deprecated target: ftpd43+ ;; \
+ 	esac
+ 
+ inetd: project kauth rxkad
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	${COMPILE_PART1} inetd ${COMPILE_PART2} ;; \
+ 	*)	echo skipping deprecated target: inetd ;; \
+ 	esac
+ 
+ rsh: project inetd
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	${COMPILE_PART1} rsh ${COMPILE_PART2} ;; \
+ 	*)	echo skipping deprecated target: rsh ;; \
+ 	esac
+ 
+ rlogind: project rsh ftpd43+ login
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	case ${SYS_NAME} in \
+ 		rs_aix*) ${COMPILE_PART1} rlogind ${COMPILE_PART2} ;; \
+ 		*) echo skipping rlogind for ${SYS_NAME} ;; \
+ 		esac ;; \
+ 	*)	echo skipping deprecated target: rlogind ;; \
+ 	esac
+ 
+ rcp: project rsh inetd
+ 	@case ${WITH_DEPRECATED} in \
+ 	YES) 	case ${SYS_NAME} in \
+ 		sgi_* )	echo skip rcp for ${SYS_NAME} ;; \
+ 		*)	${COMPILE_PART1} rcp ${COMPILE_PART2} ;; \
+ 		esac ;; \
+ 	*)	echo skipping deprecated target: rcp ;; \
+ 	esac
+ 
+ allrcmds: project rcp rlogind
+ 
+ 
Index: openafs/src/README
diff -c openafs/src/README:1.4.2.3 openafs/src/README:1.4.2.7
*** openafs/src/README:1.4.2.3	Tue Mar  6 17:16:18 2001
--- openafs/src/README	Mon Apr 23 02:54:54 2001
***************
*** 27,41 ****
        sun4x_56/
        sun4x_57/
        sun4x_58/
  
        Example:
        % mkdir i386_linux22
        % ls -CF
        i386_linux22/     src/
- 
-       Builds for the following platforms will not fully compile:
- 
-       hp_ux110/
  
     2. Within each of those directories, create a dest/ and obj/ directory.
  
--- 27,42 ----
        sun4x_56/
        sun4x_57/
        sun4x_58/
+       ppc_darwin_13/
+       alpha_linux_2216_22/ (DES does not work, will require one more change to
+ 				compile)
+       hp_ux110/ (No client support, but db servers and utilities work)
+       hp_ux102/ (No client support, but db servers and utilities work)
  
        Example:
        % mkdir i386_linux22
        % ls -CF
        i386_linux22/     src/
  
     2. Within each of those directories, create a dest/ and obj/ directory.
  
Index: openafs/src/WINNT/afsd/afsd_init.c
diff -c openafs/src/WINNT/afsd/afsd_init.c:1.2 openafs/src/WINNT/afsd/afsd_init.c:1.2.2.1
*** openafs/src/WINNT/afsd/afsd_init.c:1.2	Sat Nov  4 05:01:35 2000
--- openafs/src/WINNT/afsd/afsd_init.c	Mon Apr 23 02:51:45 2001
***************
*** 31,36 ****
--- 31,38 ----
  extern int RXAFSCB_ExecuteRequest();
  extern int RXSTATS_ExecuteRequest();
  
+ extern afs_int32 cryptall;
+ 
  char AFSConfigKeyName[] =
  	"SYSTEM\\CurrentControlSet\\Services\\TransarcAFSDaemon\\Parameters";
  
***************
*** 378,383 ****
--- 380,395 ----
  	else {
  		strcat(cm_sysName, "i386_nt40");
  		afsi_log("Default sys name %s", cm_sysName);
+ 	}
+ 
+ 	dummyLen = sizeof(cryptall);
+ 	code = RegQueryValueEx(parmKey, "SecurityLevel", NULL, NULL,
+ 				(BYTE *) &cryptall, &dummyLen);
+ 	if (code == ERROR_SUCCESS)
+ 		afsi_log("SecurityLevel is %s", cryptall?"crypt":"clear");
+ 	else {
+ 		cryptall = rxkad_clear;
+ 		afsi_log("Default SecurityLevel is clear");
  	}
  
  	RegCloseKey (parmKey);
Index: openafs/src/WINNT/afsd/cm_conn.c
diff -c openafs/src/WINNT/afsd/cm_conn.c:1.2 openafs/src/WINNT/afsd/cm_conn.c:1.2.2.1
*** openafs/src/WINNT/afsd/cm_conn.c:1.2	Sat Nov  4 05:01:37 2000
--- openafs/src/WINNT/afsd/cm_conn.c	Mon Apr 23 02:51:46 2001
***************
*** 23,28 ****
--- 23,30 ----
  
  long RDRtimeout = CM_CONN_DEFAULTRDRTIMEOUT;
  
+ afs_int32 cryptall = 0;
+ 
  void cm_PutConn(cm_conn_t *connp)
  {
  	lock_ObtainWrite(&cm_connLock);
***************
*** 329,334 ****
--- 331,337 ----
          int serviceID;
          int secIndex;
          struct rx_securityClass *secObjp;
+ 	afs_int32 level;
  
  	if (serverp->type == CM_SERVER_VLDB) {
  		port = htons(7003);
***************
*** 341,347 ****
          }
  	if (ucellp->flags & CM_UCELLFLAG_RXKAD) {
  		secIndex = 2;
!                 secObjp = rxkad_NewClientSecurityObject(rxkad_clear,
  			&ucellp->sessionKey, ucellp->kvno,
  			ucellp->ticketLen, ucellp->ticketp);
          }
--- 344,356 ----
          }
  	if (ucellp->flags & CM_UCELLFLAG_RXKAD) {
  		secIndex = 2;
! 		if (cryptall) {
! 			level = rxkad_crypt;
! 			tcp->cryptlevel = rxkad_crypt;
! 		} else {
! 			level = rxkad_clear;
! 		}
!                 secObjp = rxkad_NewClientSecurityObject(level,
  			&ucellp->sessionKey, ucellp->kvno,
  			ucellp->ticketLen, ucellp->ticketp);
          }
***************
*** 382,392 ****
                  cm_HoldUser(userp);
                  lock_InitializeMutex(&tcp->mx, "cm_conn_t mutex");
                  tcp->serverp = serverp;
  		cm_NewRXConnection(tcp, ucellp, serverp);
  		tcp->refCount = 1;
          }
  	else {
! 		if (tcp->ucgen < ucellp->gen) {
  			rx_DestroyConnection(tcp->callp);
  			cm_NewRXConnection(tcp, ucellp, serverp);
  		}
--- 391,403 ----
                  cm_HoldUser(userp);
                  lock_InitializeMutex(&tcp->mx, "cm_conn_t mutex");
                  tcp->serverp = serverp;
+ 		tcp->cryptlevel = rxkad_clear;
  		cm_NewRXConnection(tcp, ucellp, serverp);
  		tcp->refCount = 1;
          }
  	else {
! 		if ((tcp->ucgen < ucellp->gen) || (tcp->cryptlevel != cryptall))
! 		{
  			rx_DestroyConnection(tcp->callp);
  			cm_NewRXConnection(tcp, ucellp, serverp);
  		}
Index: openafs/src/WINNT/afsd/cm_conn.h
diff -c openafs/src/WINNT/afsd/cm_conn.h:1.2 openafs/src/WINNT/afsd/cm_conn.h:1.2.2.1
*** openafs/src/WINNT/afsd/cm_conn.h:1.2	Sat Nov  4 05:01:38 2000
--- openafs/src/WINNT/afsd/cm_conn.h	Mon Apr 23 02:51:46 2001
***************
*** 23,28 ****
--- 23,29 ----
          int refCount;			/* locked by cm_connLock */
  	int ucgen;			/* ucellp's generation number */
          long flags;			/* locked by mx */
+ 	int cryptlevel;			/* encrytion status */
  } cm_conn_t;
  
  /* structure used for tracking RPC progress */
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.2 openafs/src/WINNT/afsd/cm_ioctl.c:1.2.2.1
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.2	Sat Nov  4 05:01:38 2000
--- openafs/src/WINNT/afsd/cm_ioctl.c	Mon Apr 23 02:51:46 2001
***************
*** 35,40 ****
--- 35,42 ----
  
  osi_mutex_t cm_Afsdsbmt_Lock;
  
+ extern afs_int32 cryptall;
+ 
  void cm_InitIoctl(void)
  {
  	lock_InitializeMutex(&cm_Afsdsbmt_Lock, "AFSDSBMT.INI Access Lock");
***************
*** 1788,1790 ****
--- 1790,1808 ----
  	return 0;
  }
  
+ long cm_IoctlGetRxkcrypt(smb_ioctl_t *ioctlp, cm_user_t *userp)
+ {
+ 	memcpy(ioctlp->outDatap, &cryptall, sizeof(cryptall));
+         ioctlp->outDatap += sizeof(cryptall);
+ 
+ 	return 0;
+ }
+ 
+ long cm_IoctlSetRxkcrypt(smb_ioctl_t *ioctlp, cm_user_t *userp)
+ {
+ 	cm_SkipIoctlPath(ioctlp);
+ 
+ 	memcpy(&cryptall, ioctlp->inDatap, sizeof(cryptall));
+ 
+ 	return 0;
+ }
Index: openafs/src/WINNT/afsd/cm_ioctl.h
diff -c openafs/src/WINNT/afsd/cm_ioctl.h:1.2 openafs/src/WINNT/afsd/cm_ioctl.h:1.2.2.1
*** openafs/src/WINNT/afsd/cm_ioctl.h:1.2	Sat Nov  4 05:01:39 2000
--- openafs/src/WINNT/afsd/cm_ioctl.h	Mon Apr 23 02:51:46 2001
***************
*** 119,124 ****
--- 119,128 ----
  
  extern long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp);
  
+ extern long cm_IoctlGetRxkcrypt(smb_ioctl_t *ioctlp, cm_user_t *userp);
+ 
+ extern long cm_IoctlSetRxkcrypt(smb_ioctl_t *ioctlp, cm_user_t *userp);
+ 
  #endif /* __CM_IOCTL_INTERFACES_ONLY__ */
  
  #endif /*  __CM_IOCTL_H_ENV__ */
Index: openafs/src/WINNT/afsd/fs.c
diff -c openafs/src/WINNT/afsd/fs.c:1.2 openafs/src/WINNT/afsd/fs.c:1.2.2.1
*** openafs/src/WINNT/afsd/fs.c:1.2	Sat Nov  4 05:01:41 2000
--- openafs/src/WINNT/afsd/fs.c	Mon Apr 23 02:51:47 2001
***************
*** 2621,2626 ****
--- 2621,2679 ----
      return 0;
  }
  
+ static afs_int32 SetCryptCmd(as)
+     struct cmd_syndesc *as;
+ {
+     afs_int32 code = 0, flag;
+     struct ViceIoctl blob;
+     char *tp;
+  
+     tp = as->parms[0].items->data;
+     if (strcmp(tp, "on") == 0)
+       flag = 1;
+     else if (strcmp(tp, "off") == 0)
+       flag = 0;
+     else {
+       fprintf (stderr, "%s: %s must be \"on\" or \"off\".\n", pn, tp);
+       return EINVAL;
+     }
+ 
+     blob.in = (char *) &flag;
+     blob.in_size = sizeof(flag);
+     blob.out_size = 0;
+     code = pioctl(0, VIOC_SETRXKCRYPT, &blob, 1);
+     if (code)
+       Die(code, (char *) 0);
+     return 0;
+ }
+ 
+ static afs_int32 GetCryptCmd(as)
+     struct cmd_syndesc *as;
+ {
+     afs_int32 code = 0, flag;
+     struct ViceIoctl blob;
+     char *tp;
+  
+     blob.in = (char *) 0;
+     blob.in_size = 0;
+     blob.out_size = sizeof(flag);
+     blob.out = space;
+ 
+     code = pioctl(0, VIOC_GETRXKCRYPT, &blob, 1);
+ 
+     if (code) Die(code, (char *) 0);
+     else {
+       tp = space;
+       bcopy(tp, &flag, sizeof(afs_int32));
+       printf("Security level is currently ");
+       if (flag == 1)
+         printf("crypt (data security).\n");
+       else
+         printf("clear.\n");
+     }
+     return 0;
+ }
+ 
  main(argc, argv)
  int argc;
  char **argv; {
***************
*** 2838,2844 ****
      cmd_AddParm(ts, "-files", CMD_LIST, CMD_OPTIONAL, "specific pathnames");
      cmd_AddParm(ts, "-allfiles", CMD_SINGLE, CMD_OPTIONAL, "new default (KB)");
      cmd_CreateAlias(ts, "sb");
!     
      ts = cmd_CreateSyntax("trace", TraceCmd, 0, "enable or disable CM tracing");
      cmd_AddParm(ts, "-on", CMD_FLAG, CMD_OPTIONAL, "enable tracing");
      cmd_AddParm(ts, "-off", CMD_FLAG, CMD_OPTIONAL, "disable tracing");
--- 2891,2902 ----
      cmd_AddParm(ts, "-files", CMD_LIST, CMD_OPTIONAL, "specific pathnames");
      cmd_AddParm(ts, "-allfiles", CMD_SINGLE, CMD_OPTIONAL, "new default (KB)");
      cmd_CreateAlias(ts, "sb");
! 
!     ts = cmd_CreateSyntax("setcrypt", SetCryptCmd, 0, "set cache manager encryption flag");
!     cmd_AddParm(ts, "-crypt", CMD_SINGLE, 0, "on or off");
! 
!     ts = cmd_CreateSyntax("getcrypt", GetCryptCmd, 0, "get cache manager encryption flag");
! 
      ts = cmd_CreateSyntax("trace", TraceCmd, 0, "enable or disable CM tracing");
      cmd_AddParm(ts, "-on", CMD_FLAG, CMD_OPTIONAL, "enable tracing");
      cmd_AddParm(ts, "-off", CMD_FLAG, CMD_OPTIONAL, "disable tracing");
Index: openafs/src/WINNT/afsd/smb_iocons.h
diff -c openafs/src/WINNT/afsd/smb_iocons.h:1.2 openafs/src/WINNT/afsd/smb_iocons.h:1.2.2.1
*** openafs/src/WINNT/afsd/smb_iocons.h:1.2	Sat Nov  4 05:01:45 2000
--- openafs/src/WINNT/afsd/smb_iocons.h	Mon Apr 23 02:51:47 2001
***************
*** 88,91 ****
--- 88,94 ----
  #define VIOC_DELSYMLINK			0x25
  #define VIOC_MAKESUBMOUNT		0x26
  
+ #define VIOC_GETRXKCRYPT		0x27
+ #define VIOC_SETRXKCRYPT		0x28
+ 
  #endif /*  __SMB_IOCONS_H_ENV_ */
Index: openafs/src/WINNT/afsd/smb_ioctl.c
diff -c openafs/src/WINNT/afsd/smb_ioctl.c:1.2 openafs/src/WINNT/afsd/smb_ioctl.c:1.2.2.1
*** openafs/src/WINNT/afsd/smb_ioctl.c:1.2	Sat Nov  4 05:01:45 2000
--- openafs/src/WINNT/afsd/smb_ioctl.c	Mon Apr 23 02:51:47 2001
***************
*** 62,67 ****
--- 62,69 ----
  	smb_ioctlProcsp[VIOC_LISTSYMLINK] = cm_IoctlListlink;
  	smb_ioctlProcsp[VIOC_DELSYMLINK] = cm_IoctlDeletelink;
  	smb_ioctlProcsp[VIOC_MAKESUBMOUNT] = cm_IoctlMakeSubmount;
+ 	smb_ioctlProcsp[VIOC_GETRXKCRYPT] = cm_IoctlGetRxkcrypt;
+ 	smb_ioctlProcsp[VIOC_SETRXKCRYPT] = cm_IoctlSetRxkcrypt;
  }
  
  /* called to make a fid structure into an IOCTL fid structure */
Index: openafs/src/WINNT/client_config/dlg_automap.cpp
diff -c openafs/src/WINNT/client_config/dlg_automap.cpp:1.2 openafs/src/WINNT/client_config/dlg_automap.cpp:1.2.2.1
*** openafs/src/WINNT/client_config/dlg_automap.cpp:1.2	Sat Nov  4 05:02:37 2000
--- openafs/src/WINNT/client_config/dlg_automap.cpp	Mon Apr 23 02:50:40 2001
***************
*** 212,224 ****
     TCHAR szValueName[128];
     HKEY hKey;
     LONG result;
  
     if (!pDrive)
        return FALSE;
  
     _stprintf(szKeyName, TEXT("%s\\GlobalAutoMapper"), AFSConfigKeyName);
  
!    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_SET_VALUE, &hKey) != ERROR_SUCCESS)
        return FALSE;
  
     _stprintf(szValueName, TEXT("%c:"), pDrive->chDrive);
--- 212,225 ----
     TCHAR szValueName[128];
     HKEY hKey;
     LONG result;
+    DWORD dwDispo;
  
     if (!pDrive)
        return FALSE;
  
     _stprintf(szKeyName, TEXT("%s\\GlobalAutoMapper"), AFSConfigKeyName);
  
!    if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDispo) != ERROR_SUCCESS)
        return FALSE;
  
     _stprintf(szValueName, TEXT("%c:"), pDrive->chDrive);
Index: openafs/src/WINNT/client_config/drivemap.cpp
diff -c openafs/src/WINNT/client_config/drivemap.cpp:1.3.2.1 openafs/src/WINNT/client_config/drivemap.cpp:1.3.2.2
*** openafs/src/WINNT/client_config/drivemap.cpp:1.3.2.1	Tue Mar  6 16:02:08 2001
--- openafs/src/WINNT/client_config/drivemap.cpp	Mon Apr 23 02:38:13 2001
***************
*** 689,695 ****
                                                                           (pszSource[4] == TEXT('\\')) ||
                                                                           (lstrlen(pszSource) == 4)))
        wsprintf (pszTarget, TEXT("/afs%s"), pszSource);
!    else if (!fWantAFS && (!lstrncmpi (&pszSource[1], TEXT("afs"), 3) || ((pszSource[4] == TEXT('/')) ||
                                                                          (pszSource[4] == TEXT('\\')) ||
                                                                          (lstrlen(pszSource) == 4))))
        lstrcpy (pszTarget, &pszSource[4]);
--- 689,695 ----
                                                                           (pszSource[4] == TEXT('\\')) ||
                                                                           (lstrlen(pszSource) == 4)))
        wsprintf (pszTarget, TEXT("/afs%s"), pszSource);
!    else if (!fWantAFS && (!lstrncmpi (&pszSource[1], TEXT("afs"), 3) && ((pszSource[4] == TEXT('/')) ||
                                                                          (pszSource[4] == TEXT('\\')) ||
                                                                          (lstrlen(pszSource) == 4))))
        lstrcpy (pszTarget, &pszSource[4]);
Index: openafs/src/WINNT/install/InstallShield5/GenFileGroups.bat
diff -c openafs/src/WINNT/install/InstallShield5/GenFileGroups.bat:1.2 openafs/src/WINNT/install/InstallShield5/GenFileGroups.bat:1.2.2.1
*** openafs/src/WINNT/install/InstallShield5/GenFileGroups.bat:1.2	Sat Nov  4 05:03:03 2000
--- openafs/src/WINNT/install/InstallShield5/GenFileGroups.bat	Mon Apr 23 02:25:36 2001
***************
*** 1262,1268 ****
  echo file1=%IS5_INCL%\afs\debug.h >> Client_Afs_Header_Files.fgl
  echo file2=%IS5_INCL%\afs\param.h >> Client_Afs_Header_Files.fgl
  echo file3=%IS5_INCL%\afs\afs_sysnames.h >> Client_Afs_Header_Files.fgl
! echo file4=%IS5_INCL%\afs\permit_xprt.h >> Client_Afs_Header_Files.fgl
  echo file5=%IS5_INCL%\afs\stds.h >> Client_Afs_Header_Files.fgl
  echo file6=%IS5_INCL%\afs\icl.h >> Client_Afs_Header_Files.fgl
  echo file7=%IS5_INCL%\afs\procmgmt.h >> Client_Afs_Header_Files.fgl
--- 1262,1268 ----
  echo file1=%IS5_INCL%\afs\debug.h >> Client_Afs_Header_Files.fgl
  echo file2=%IS5_INCL%\afs\param.h >> Client_Afs_Header_Files.fgl
  echo file3=%IS5_INCL%\afs\afs_sysnames.h >> Client_Afs_Header_Files.fgl
! echo file4=%IS5_INCL%\afs\bnode.h >> Client_Afs_Header_Files.fgl
  echo file5=%IS5_INCL%\afs\stds.h >> Client_Afs_Header_Files.fgl
  echo file6=%IS5_INCL%\afs\icl.h >> Client_Afs_Header_Files.fgl
  echo file7=%IS5_INCL%\afs\procmgmt.h >> Client_Afs_Header_Files.fgl
***************
*** 1349,1355 ****
  echo file88=%IS5_INCL%\afs\volint.h >> Client_Afs_Header_Files.fgl
  echo file89=%IS5_INCL%\afs\fs_stats.h >> Client_Afs_Header_Files.fgl
  echo file90=%IS5_INCL%\afs\bosint.h >> Client_Afs_Header_Files.fgl
- echo file91=%IS5_INCL%\afs\bnode.h >> Client_Afs_Header_Files.fgl
  echo. >> Client_Afs_Header_Files.fgl
  echo [General] >> Client_Afs_Header_Files.fgl
  echo Type=FILELIST >> Client_Afs_Header_Files.fgl
--- 1349,1354 ----
Index: openafs/src/afs/Makefile
diff -c openafs/src/afs/Makefile:1.3 openafs/src/afs/Makefile:1.3.2.2
*** openafs/src/afs/Makefile:1.3	Sun Nov  5 15:00:07 2000
--- openafs/src/afs/Makefile	Mon Apr 23 03:28:34 2001
***************
*** 6,12 ****
  # directory or online at http://www.openafs.org/dl/license10.html
  
  SHELL=/bin/sh
- INSTALL = ${SRCDIR}bin/install
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
  
--- 6,11 ----
***************
*** 34,45 ****
  			gencat -m afszcm.cat afs_trace.msf ;; \
  		*_linux* ) \
  			gencat --new afszcm.cat afs_trace.msf ;; \
  		* ) \
  			gencat afszcm.cat afs_trace.msf ;; \
  	esac
- 	
- 	
  
  ukinstall webinstall: AFS_component_version_number.c
  	set ${UKERNELDIR}afs; $(MKDIR_IF_NEEDED)
  	-chmod 666 ${UKERNELDIR}afs/*
--- 33,46 ----
  			gencat -m afszcm.cat afs_trace.msf ;; \
  		*_linux* ) \
  			gencat --new afszcm.cat afs_trace.msf ;; \
+ 		ppc_darwin* | i386_fbsd*) \
+ 			echo No gencat for ${SYS_NAME} ;; \
  		* ) \
  			gencat afszcm.cat afs_trace.msf ;; \
  	esac
  
+ 
+ 
  ukinstall webinstall: AFS_component_version_number.c
  	set ${UKERNELDIR}afs; $(MKDIR_IF_NEEDED)
  	-chmod 666 ${UKERNELDIR}afs/*
***************
*** 58,64 ****
  			${INSTALL} longc_procs.h ${DESTDIR}include/afs ;; \
  	esac
  	case ${SYS_NAME} in \
! 		next_mach30 | vax_ul43) \
  			echo skipping afszcm.cat install for ${SYS_NAME} ;; \
  		* ) \
  			${INSTALL} afszcm.cat ${DESTDIR}root.client/usr/vice/etc/C ;; \
--- 59,65 ----
  			${INSTALL} longc_procs.h ${DESTDIR}include/afs ;; \
  	esac
  	case ${SYS_NAME} in \
! 		next_mach30 | vax_ul43 | ppc_darwin* | i386_fbsd* ) \
  			echo skipping afszcm.cat install for ${SYS_NAME} ;; \
  		* ) \
  			${INSTALL} afszcm.cat ${DESTDIR}root.client/usr/vice/etc/C ;; \
Index: openafs/src/afs/afs.h
diff -c openafs/src/afs/afs.h:1.2.2.1 openafs/src/afs/afs.h:1.2.2.4
*** openafs/src/afs/afs.h:1.2.2.1	Fri Jan 19 04:29:34 2001
--- openafs/src/afs/afs.h	Mon Apr 23 03:28:34 2001
***************
*** 509,515 ****
--- 509,519 ----
  #define VPageCleaning 0x2	/* Solaris - Cache Trunc Daemon sez keep out */
  
  #define	CPSIZE	    2
+ #if !defined(AFS_FBSD_ENV)
  #define	vrefCount   v.v_count
+ #else
+ #define vrefCount   v.v_usecount
+ #endif /* AFS_FBSD_ENV */
  
  #define	AFS_MAXDV   0x7fffffff	    /* largest dataversion number */
  #define	AFS_NOTRUNC 0x7fffffff	    /* largest dataversion number */
***************
*** 557,563 ****
       * Do not try to get the vcache lock when the vlock is held */
      afs_rwlock_t vlock;
  #endif /* defined(AFS_SUN5_ENV) */
! #if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV)
  #if	defined(AFS_SUN5_ENV)
      krwlock_t rwlock;
      struct cred *credp;
--- 561,567 ----
       * Do not try to get the vcache lock when the vlock is held */
      afs_rwlock_t vlock;
  #endif /* defined(AFS_SUN5_ENV) */
! #if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_DARWIN_ENV)
  #if	defined(AFS_SUN5_ENV)
      krwlock_t rwlock;
      struct cred *credp;
***************
*** 573,578 ****
--- 577,585 ----
  #ifdef AFS_AIX_ENV
      int ownslock;	/* pid of owner of excl lock, else 0 - defect 3083 */
  #endif
+ #ifdef AFS_DARWIN_ENV
+     struct lock__bsd__      rwlock;
+ #endif
      afs_int32 parentVnode;			/* Parent dir, if a file. */
      afs_int32 parentUnique;
      struct VenusFid *mvid;		/* Either parent dir (if root) or root (if mt pt) */
***************
*** 974,982 ****
--- 981,995 ----
    (((avc)->states & CStatd) ? (vcache2inode(avc), 0) : \
     afs_VerifyVCache2((avc),areq))
  #else
+ #ifdef AFS_DARWIN_ENV
+ #define afs_VerifyVCache(avc, areq)  \
+   (((avc)->states & CStatd) ? (osi_VM_Setup(avc), 0) : \
+    afs_VerifyVCache2((avc),areq))
+ #else
  #define afs_VerifyVCache(avc, areq)  \
    (((avc)->states & CStatd) ? 0 : afs_VerifyVCache2((avc),areq))
  #endif
+ #endif
  
  #define DO_STATS 1  /* bits used by FindVCache */
  #define DO_VLRU 2
***************
*** 1060,1065 ****
--- 1073,1104 ----
  #if	defined(AFS_AIX41_ENV)
  #define VN_LOCK(vp)             simple_lock(&(vp)->v_lock)
  #define VN_UNLOCK(vp)           simple_unlock(&(vp)->v_lock)
+ #endif
+ 
+ /* get a file's serial number from a vnode */
+ #ifndef afs_vnodeToInumber
+ #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
+ #define afs_vnodeToInumber(V) VnodeToIno(V)
+ #else
+ #ifdef AFS_DECOSF_ENV
+ #define afs_vnodeToInumber(V) osi_vnodeToInumber(V)
+ #else
+ #define afs_vnodeToInumber(V) (VTOI(V)->i_number)
+ #endif /* AFS_DECOSF_ENV */
+ #endif /* AFS_SGI62_ENV */
+ #endif
+ 
+ /* get a file's device number from a vnode */
+ #ifndef afs_vnodeToDev
+ #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
+ #define afs_vnodeToDev(V) VnodeToDev(V)
+ #else
+ #ifdef AFS_DECOSF_ENV
+ #define afs_vnodeToDev(V) osi_vnodeToDev(V)
+ #else
+ #define afs_vnodeToDev(V) (VTOI(V)->i_dev)
+ #endif /* AFS_DECOSF_ENV */
+ #endif /* AFS_SGI62_ENV */
  #endif
  
  #endif	/* _AFS_H_ */
Index: openafs/src/afs/afs_analyze.c
diff -c openafs/src/afs/afs_analyze.c:1.3 openafs/src/afs/afs_analyze.c:1.3.2.1
*** openafs/src/afs/afs_analyze.c:1.3	Sun Nov  5 23:17:05 2000
--- openafs/src/afs/afs_analyze.c	Mon Apr 23 03:28:34 2001
***************
*** 15,21 ****
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  
  #ifndef UKERNEL
! #ifndef AFS_LINUX20_ENV
  #include <net/if.h>
  #include <netinet/in.h>
  #endif
--- 15,21 ----
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  
  #ifndef UKERNEL
! #if !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
  #include <net/if.h>
  #include <netinet/in.h>
  #endif
***************
*** 23,29 ****
  #ifdef AFS_SGI62_ENV
  #include "../h/hashing.h"
  #endif
! #if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV)
  #include <netinet/in_var.h>
  #endif
  #endif /* !UKERNEL */
--- 23,29 ----
  #ifdef AFS_SGI62_ENV
  #include "../h/hashing.h"
  #endif
! #if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
  #include <netinet/in_var.h>
  #endif
  #endif /* !UKERNEL */
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.2.2.2 openafs/src/afs/afs_call.c:1.2.2.5
*** openafs/src/afs/afs_call.c:1.2.2.2	Fri Jan 19 04:29:34 2001
--- openafs/src/afs/afs_call.c	Mon Apr 23 03:28:35 2001
***************
*** 42,48 ****
  struct afs_icl_set *afs_iclSetp = (struct afs_icl_set*)0;
  struct afs_icl_set *afs_iclLongTermSetp = (struct afs_icl_set*)0;
  
! #if	defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX22_ENV)
  kmutex_t afs_global_lock;
  kmutex_t afs_rxglobal_lock;
  
--- 42,49 ----
  struct afs_icl_set *afs_iclSetp = (struct afs_icl_set*)0;
  struct afs_icl_set *afs_iclLongTermSetp = (struct afs_icl_set*)0;
  
! #if	defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
! 
  kmutex_t afs_global_lock;
  kmutex_t afs_rxglobal_lock;
  
***************
*** 53,58 ****
--- 54,63 ----
  
  #if defined(AFS_OSF_ENV)
  simple_lock_data_t afs_global_lock;
+ #elif defined(AFS_DARWIN_ENV)
+ struct lock__bsd__ afs_global_lock;
+ #endif
+ #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  thread_t afs_global_owner;
  #endif /* AFS_OSF_ENV */
  
***************
*** 127,133 ****
      if (!afs_suser() && (parm != AFSOP_GETMTU)
  	&& (parm != AFSOP_GETMASK)) {
        /* only root can run this code */
! #if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV)
  	setuerror(EACCES);
  	return(EACCES);
  #else
--- 132,138 ----
      if (!afs_suser() && (parm != AFSOP_GETMTU)
  	&& (parm != AFSOP_GETMASK)) {
        /* only root can run this code */
! #if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
  	setuerror(EACCES);
  	return(EACCES);
  #else
***************
*** 197,203 ****
  	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)
  	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 */
--- 202,208 ----
  	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)
  	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 */
***************
*** 286,292 ****
  	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)
  	size_t bufferSize;	
  #else /* AFS_SGI61_ENV */
  	u_int bufferSize;	
--- 291,297 ----
  	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)
  	size_t bufferSize;	
  #else /* AFS_SGI61_ENV */
  	u_int bufferSize;	
***************
*** 324,330 ****
  	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)
  	    goto out;
  #else
  	    setuerror(code);
--- 329,335 ----
  	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)
  	    goto out;
  #else
  	    setuerror(code);
***************
*** 370,376 ****
  	code = afs_InitCacheFile((char *) 0, ainode);
      }
      else if (parm == AFSOP_ROOTVOLUME) {
! #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV)
  	size_t bufferSize;
  #else /* AFS_SGI61_ENV */
  	u_int bufferSize;
--- 375,381 ----
  	code = afs_InitCacheFile((char *) 0, ainode);
      }
      else if (parm == AFSOP_ROOTVOLUME) {
! #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV)
  	size_t bufferSize;
  #else /* AFS_SGI61_ENV */
  	u_int bufferSize;
***************
*** 388,394 ****
      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)
  	size_t bufferSize;
  #else /* AFS_SGI61_ENV */
  	u_int bufferSize;
--- 393,399 ----
      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)
  	size_t bufferSize;
  #else /* AFS_SGI61_ENV */
  	u_int bufferSize;
***************
*** 496,502 ****
  #endif /* AFS_SGI62_ENV && !AFS_SGI65_ENV */
  #endif /* AFS_SGI53_ENV */
      else if (parm == AFSOP_SHUTDOWN) {
! #if	defined(AFS_OSF_ENV)
  	extern struct mount *afs_globalVFS;
  #else	/* AFS_OSF_ENV */
  	extern struct vfs *afs_globalVFS;
--- 501,507 ----
  #endif /* AFS_SGI62_ENV && !AFS_SGI65_ENV */
  #endif /* AFS_SGI53_ENV */
      else if (parm == AFSOP_SHUTDOWN) {
! #if	defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
  	extern struct mount *afs_globalVFS;
  #else	/* AFS_OSF_ENV */
  	extern struct vfs *afs_globalVFS;
***************
*** 519,525 ****
        afs_vfs_mount(parm2, parm3, parm4, parm5);
  #endif /* AFS_HPUX100_ENV */
  #else /* defined(AFS_HPUX_ENV) */
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV)
        code = EINVAL;
  #else
        setuerror(EINVAL);
--- 524,530 ----
        afs_vfs_mount(parm2, parm3, parm4, parm5);
  #endif /* AFS_HPUX100_ENV */
  #else /* defined(AFS_HPUX_ENV) */
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
        code = EINVAL;
  #else
        setuerror(EINVAL);
***************
*** 816,829 ****
  	}
  #endif /* AFS_SUN57_64BIT_ENV */
  
! #if defined(AFS_LINUX_64BIT_KERNEL)
  	struct iparam32 dst32;
  
  #ifdef AFS_SPARC64_LINUX20_ENV
! 	if (current->tss.flags & SPARC_FLAG_32BIT) {
  #else
  #error Not done for this linux version
! #endif
  		AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code);
  		if (!code)
  			iparam32_to_iparam(&dst32, dst);
--- 821,835 ----
  	}
  #endif /* AFS_SUN57_64BIT_ENV */
  
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV)
  	struct iparam32 dst32;
  
  #ifdef AFS_SPARC64_LINUX20_ENV
! 	if (current->tss.flags & SPARC_FLAG_32BIT) 
  #else
  #error Not done for this linux version
! #endif /* AFS_SPARC64_LINUX20_ENV */
! 	{
  		AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code);
  		if (!code)
  			iparam32_to_iparam(&dst32, dst);
***************
*** 872,878 ****
  {
      int *retval = &rvp->r_val1;
  #else /* AFS_SUN5_ENV */
! #if	defined(AFS_OSF_ENV)
  afs3_syscall(p, args, retval)
  	struct proc *p;
  	void *args;
--- 878,884 ----
  {
      int *retval = &rvp->r_val1;
  #else /* AFS_SUN5_ENV */
! #if	defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
  afs3_syscall(p, args, retval)
  	struct proc *p;
  	void *args;
***************
*** 1010,1016 ****
  	mutex_exit(&procp->p_crlock);
  #else
  	AFS_GLOCK();
! #if	defined(AFS_OSF_ENV)
  	code = afs_setpag(p, args, retval);
  #else	/* AFS_OSF_ENV */
  	code = afs_setpag();
--- 1016,1022 ----
  	mutex_exit(&procp->p_crlock);
  #else
  	AFS_GLOCK();
! #if	defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
  	code = afs_setpag(p, args, retval);
  #else	/* AFS_OSF_ENV */
  	code = afs_setpag();
***************
*** 1022,1036 ****
  #ifdef	AFS_SUN5_ENV
          code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4, rvp, CRED());
  #else
  	code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4);
  #endif
  	AFS_GUNLOCK();
      } else if (uap->syscall == AFSCALL_ICREATE) {
  	struct iparam iparams;
  
  	code = copyin_iparam((char *)uap->parm3, &iparams);
  	if (code) {
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV)
  	    setuerror(code);
  #endif
  	} else
--- 1028,1046 ----
  #ifdef	AFS_SUN5_ENV
          code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4, rvp, CRED());
  #else
+ #ifdef AFS_DARWIN_ENV
+         code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4, p->p_cred->pc_ucred);
+ #else
  	code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4);
  #endif
+ #endif
  	AFS_GUNLOCK();
      } else if (uap->syscall == AFSCALL_ICREATE) {
  	struct iparam iparams;
  
  	code = copyin_iparam((char *)uap->parm3, &iparams);
  	if (code) {
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
  	    setuerror(code);
  #endif
  	} else
***************
*** 1039,1045 ****
  				   iparams.param3, iparams.param4, rvp, CRED());
  #else
  	code =  afs_syscall_icreate(uap->parm1, uap->parm2, iparams.param1, iparams.param2,
! #ifdef	AFS_OSF_ENV
  				   iparams.param3, iparams.param4, retval);
  #else
  				   iparams.param3, iparams.param4);
--- 1049,1055 ----
  				   iparams.param3, iparams.param4, rvp, CRED());
  #else
  	code =  afs_syscall_icreate(uap->parm1, uap->parm2, iparams.param1, iparams.param2,
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
  				   iparams.param3, iparams.param4, retval);
  #else
  				   iparams.param3, iparams.param4);
***************
*** 1049,1055 ****
  #ifdef	AFS_SUN5_ENV
  	code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3, rvp, CRED());
  #else
! #ifdef	AFS_OSF_ENV
  	code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3, retval);
  #else
  	code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3);
--- 1059,1065 ----
  #ifdef	AFS_SUN5_ENV
  	code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3, rvp, CRED());
  #else
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
  	code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3, retval);
  #else
  	code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3);
***************
*** 1078,1090 ****
  	}
  #else
          if (code) {
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV)
  	    setuerror(code);
  #endif
          }
  #endif /* !AFS_LINUX20_ENV */
      } else {
! #if defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV)
  	code = EINVAL;
  #else
          setuerror(EINVAL);
--- 1088,1100 ----
  	}
  #else
          if (code) {
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV)
  	    setuerror(code);
  #endif
          }
  #endif /* !AFS_LINUX20_ENV */
      } else {
! #if defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
  	code = EINVAL;
  #else
          setuerror(EINVAL);
***************
*** 1276,1282 ****
      register afs_int32 code;
      struct afs_icl_log *logp;
      struct afs_icl_set *setp;
! #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV)
      size_t temp;
  #else /* AFS_SGI61_ENV */
      afs_uint32 temp;
--- 1286,1292 ----
      register afs_int32 code;
      struct afs_icl_log *logp;
      struct afs_icl_set *setp;
! #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV)
      size_t temp;
  #else /* AFS_SGI61_ENV */
      afs_uint32 temp;
***************
*** 1292,1298 ****
      }
  #else
      if (!afs_suser()) {	/* only root can run this code */
! #if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV)
  	setuerror(EACCES);
  	return EACCES;
  #else
--- 1302,1308 ----
      }
  #else
      if (!afs_suser()) {	/* only root can run this code */
! #if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
  	setuerror(EACCES);
  	return EACCES;
  #else
Index: openafs/src/afs/afs_dcache.c
diff -c openafs/src/afs/afs_dcache.c:1.2 openafs/src/afs/afs_dcache.c:1.2.2.3
*** openafs/src/afs/afs_dcache.c:1.2	Sat Nov  4 05:03:10 2000
--- openafs/src/afs/afs_dcache.c	Mon Apr 23 03:28:35 2001
***************
*** 1237,1243 ****
  	tlen = (alen > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : alen);
  	got = afs_osi_Read(afile, -1, tbuffer, tlen);
  	if ((got < 0) 
! #if	!defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_SGI64_ENV) && !defined(AFS_LINUX20_ENV)
  	    || (got != tlen && getuerror())
  #endif
  	    ) {
--- 1237,1243 ----
  	tlen = (alen > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : alen);
  	got = afs_osi_Read(afile, -1, tbuffer, tlen);
  	if ((got < 0) 
! #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)
  	    || (got != tlen && getuerror())
  #endif
  	    ) {
***************
*** 1718,1723 ****
--- 1718,1724 ----
  	updateV2DC(setLocks,avc,tdc,567);
  	return tdc;	/* check if we're done */
      }
+     osi_Assert(setLocks || WriteLocked(&avc->lock));
  
      if (setLocks) ObtainReadLock(&avc->lock);
      if (!hsame(avc->m.DataVersion, tdc->f.versionNo)) {
***************
*** 2299,2305 ****
  	tdc->f.chunk = -1;
  	hones(tdc->f.versionNo);
  	tdc->flags |= DFEntryMod;
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_SGI64_ENV) && !defined(AFS_LINUX20_ENV)
  	last_error = getuerror();
  #endif
  	lasterrtime = osi_Time();
--- 2300,2306 ----
  	tdc->f.chunk = -1;
  	hones(tdc->f.versionNo);
  	tdc->flags |= DFEntryMod;
! #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)
  	last_error = getuerror();
  #endif
  	lasterrtime = osi_Time();
***************
*** 2473,2483 ****
  	tdc->f.inode = VTOI(filevp->d_inode)->i_number;
  	dput(filevp);
  #else
! #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS)
! 	tdc->f.inode = VnodeToIno(filevp);
! #else
! 	tdc->f.inode = VTOI(filevp)->i_number;
! #endif
  #ifdef AFS_DEC_ENV
  	grele(filevp);
  #else
--- 2474,2480 ----
  	tdc->f.inode = VTOI(filevp->d_inode)->i_number;
  	dput(filevp);
  #else
! 	tdc->f.inode = afs_vnodeToInumber(filevp);
  #ifdef AFS_DEC_ENV
  	grele(filevp);
  #else
Index: openafs/src/afs/afs_init.c
diff -c openafs/src/afs/afs_init.c:1.2 openafs/src/afs/afs_init.c:1.2.2.4
*** openafs/src/afs/afs_init.c:1.2	Sat Nov  4 05:03:11 2000
--- openafs/src/afs/afs_init.c	Mon Apr 23 03:28:36 2001
***************
*** 97,103 ****
  /* Exported variables */
  struct osi_dev cacheDev;           /*Cache device*/
  afs_int32 cacheInfoModTime;			/*Last time cache info modified*/
! #if	defined(AFS_OSF_ENV) || defined(AFS_DEC_ENV)
  struct mount *afs_cacheVfsp=0;
  #elif defined(AFS_LINUX20_ENV)
  struct super_block *afs_cacheSBp = 0;
--- 97,103 ----
  /* Exported variables */
  struct osi_dev cacheDev;           /*Cache device*/
  afs_int32 cacheInfoModTime;			/*Last time cache info modified*/
! #if defined(AFS_OSF_ENV) || defined(AFS_DEC_ENV) || defined(AFS_DARWIN_ENV)
  struct mount *afs_cacheVfsp=0;
  #elif defined(AFS_LINUX20_ENV)
  struct super_block *afs_cacheSBp = 0;
***************
*** 325,335 ****
  #else
      code = gop_lookupname(afile, AFS_UIOSYS, 0, (struct vnode **) 0, &filevp);
      if (code) return ENOENT;
! #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS)
!     fce.inode = volumeInode = VnodeToIno(filevp);
! #else
!     fce.inode = volumeInode = VTOI(filevp)->i_number;
! #endif
  #ifdef AFS_DEC_ENV
      grele(filevp);
  #else
--- 325,331 ----
  #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
***************
*** 436,442 ****
--- 432,442 ----
  	      TO_KERNEL_SPACE();
  	  }
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+         if (!VFS_STATFS(filevp->v_mount, &st, current_proc()))
+ #else 
  	if (!VFS_STATFS(filevp->v_vfsp, &st))  
+ #endif /* AFS_DARWIN_ENV || AFS_FBSD_ENV */
  #endif /* AFS_LINUX20_ENV */
  #endif /* AIX41 */
  #endif /* OSF */
***************
*** 449,465 ****
  #endif
      }
  #ifdef AFS_LINUX20_ENV
!       cacheInode = filevp->i_ino;
!       afs_cacheSBp = filevp->i_sb;
  #else
! #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS)
      afs_InitDualFSCacheOps(filevp);
-     cacheInode = VnodeToIno(filevp);
-     cacheDev.dev = VnodeToDev(filevp);
- #else
-     cacheInode = VTOI(filevp)->i_number;
-     cacheDev.dev = VTOI(filevp)->i_dev;
  #endif
      afs_cacheVfsp = filevp->v_vfsp;
  #endif /* AFS_LINUX20_ENV */
      AFS_RELE((struct vnode *)filevp);
--- 449,462 ----
  #endif
      }
  #ifdef AFS_LINUX20_ENV
!     cacheInode = filevp->i_ino;
!     afs_cacheSBp = filevp->i_sb;
  #else
! #if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
      afs_InitDualFSCacheOps(filevp);
  #endif
+     cacheInode = afs_vnodeToInumber(filevp);
+     cacheDev.dev = afs_vnodeToDev(filevp);
      afs_cacheVfsp = filevp->v_vfsp;
  #endif /* AFS_LINUX20_ENV */
      AFS_RELE((struct vnode *)filevp);
Index: openafs/src/afs/afs_osi.c
diff -c openafs/src/afs/afs_osi.c:1.2.2.1 openafs/src/afs/afs_osi.c:1.2.2.3
*** openafs/src/afs/afs_osi.c:1.2.2.1	Tue Mar  6 16:24:01 2001
--- openafs/src/afs/afs_osi.c	Mon Apr 23 03:28:37 2001
***************
*** 50,55 ****
--- 50,58 ----
  #elif defined(AFS_OSF_ENV)
      usimple_lock_init(&afs_global_lock);
      afs_global_owner = (thread_t)0;
+ #elif defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     lockinit(&afs_global_lock, PLOCK, "afs global lock", 0, 0);
+     afs_global_owner = (thread_t)0;
  #elif defined(AFS_AIX41_ENV)
      lock_alloc((void*)&afs_global_lock, LOCK_ALLOC_PIN, 1, 1);
      simple_lock_init((void *)&afs_global_lock);
***************
*** 77,83 ****
  osi_Active(avc)
  register struct vcache *avc; {
      AFS_STATCNT(osi_Active);
! #if defined(AFS_SUN_ENV) || defined(AFS_AIX_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SUN5_ENV) || (AFS_LINUX20_ENV)
      if ((avc->opens > 0) || (avc->states & CMAPPED))	return 1;   /* XXX: Warning, verify this XXX  */
  #else
  #if	defined(AFS_MACH_ENV)
--- 80,86 ----
  osi_Active(avc)
  register struct vcache *avc; {
      AFS_STATCNT(osi_Active);
! #if defined(AFS_SUN_ENV) || defined(AFS_AIX_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SUN5_ENV) || (AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
      if ((avc->opens > 0) || (avc->states & CMAPPED))	return 1;   /* XXX: Warning, verify this XXX  */
  #else
  #if	defined(AFS_MACH_ENV)
***************
*** 292,297 ****
--- 295,303 ----
  #if	defined(AFS_HPUX101_ENV)
      set_system_proc(u.u_procp);
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     current_proc()->p_flag |= P_SYSTEM;
+ #else
  #if !defined(AFS_SGI64_ENV) && !defined(AFS_LINUX20_ENV)
      u.u_procp->p_flag |= SSYS;
  #endif /* AFS_SGI64_ENV */
***************
*** 299,304 ****
--- 305,311 ----
  #endif
  #endif
  #endif
+ #endif
      AFS_STATCNT(osi_Invisible);
  }
  
***************
*** 344,349 ****
--- 351,361 ----
      stime(&sta);
      AFS_GLOCK();
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     AFS_GUNLOCK();
+     setthetime(atv);
+     AFS_GLOCK();
+ #else
      /* stolen from kern_time.c */
  #ifndef	AFS_AUX_ENV
      boottime.tv_sec += atv->tv_sec - time.tv_sec;
***************
*** 367,372 ****
--- 379,385 ----
  #ifdef	AFS_AUX_ENV
      logtchg(atv->tv_sec);
  #endif
+ #endif  /* AFS_DARWIN_ENV || AFS_FBSD_ENV */
  #endif	/* AFS_SGI_ENV */
  #endif /* AFS_SUN55_ENV */
  #endif /* AFS_SUN5_ENV */
***************
*** 729,734 ****
--- 742,763 ----
  }
  #endif
  
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ void afs_osi_TraverseProcTable()
+ {   
+     struct proc *p;
+     LIST_FOREACH(p, &allproc, p_list) {
+         if (p->p_stat == SIDL)
+             continue;
+         if (p->p_stat == SZOMB)
+             continue;
+         if (p->p_flag & P_SYSTEM)
+             continue;
+           afs_GCPAGs_perproc_func(p);
+     }
+ }   
+ #endif
+ 
  /* return a pointer (sometimes a static copy ) to the cred for a
   * given AFS_PROC.
   * subsequent calls may overwrite the previously returned value.
***************
*** 885,890 ****
--- 914,944 ----
  
      return rv;
  }
+ #elif defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *pr)
+ {   
+     struct AFS_UCRED *rv=NULL;
+     static struct AFS_UCRED cr;
+ 
+     if(pr == NULL) {
+        return NULL;
+     }
+    
+     if((pr->p_stat == SSLEEP) ||
+        (pr->p_stat == SRUN) ||
+        (pr->p_stat == SSTOP)) {
+        pcred_readlock(pr);
+        cr.cr_ref=1;
+        cr.cr_uid=pr->p_cred->pc_ucred->cr_uid;
+        cr.cr_ngroups=pr->p_cred->pc_ucred->cr_ngroups;
+        bcopy(pr->p_cred->pc_ucred->cr_groups, cr.cr_groups,NGROUPS *
+              sizeof(gid_t));
+        pcred_unlock(pr);
+        rv = &cr;
+     }
+     
+     return rv;
+ }  
  #else
  const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *pr)
  {
Index: openafs/src/afs/afs_osi.h
diff -c openafs/src/afs/afs_osi.h:1.3.2.1 openafs/src/afs/afs_osi.h:1.3.2.3
*** openafs/src/afs/afs_osi.h:1.3.2.1	Fri Jan 19 04:29:35 2001
--- openafs/src/afs/afs_osi.h	Mon Apr 23 03:28:37 2001
***************
*** 109,119 ****
  /*
   * Vnode related macros
   */
  extern struct vnodeops *afs_ops;
- #define	vType(vc)	    (vc)->v.v_type
- #define	vSetType(vc,type)   (vc)->v.v_type = (type)
  #define	IsAfsVnode(vc)	    ((vc)->v_op == afs_ops)
  #define	SetAfsVnode(vc)	    (vc)->v_op = afs_ops
  #define	vSetVfsp(vc,vfsp)   (vc)->v.v_vfsp = (vfsp)
  
  #ifdef AFS_SGI65_ENV
--- 109,125 ----
  /*
   * Vnode related macros
   */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ extern int (**afs_vnodeop_p)();
+ #define IsAfsVnode(vc)      ((vc)->v_op == afs_vnodeop_p)
+ #define SetAfsVnode(vc)     (vc)->v_op = afs_vnodeop_p
+ #else
  extern struct vnodeops *afs_ops;
  #define	IsAfsVnode(vc)	    ((vc)->v_op == afs_ops)
  #define	SetAfsVnode(vc)	    (vc)->v_op = afs_ops
+ #endif
+ #define	vType(vc)	    (vc)->v.v_type
+ #define	vSetType(vc,type)   (vc)->v.v_type = (type)
  #define	vSetVfsp(vc,vfsp)   (vc)->v.v_vfsp = (vfsp)
  
  #ifdef AFS_SGI65_ENV
***************
*** 230,236 ****
--- 236,248 ----
   * (Also, of course, the vnode is assumed to be one of ours.  Can't use this
   * macro for V-file vnodes.)
   */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ /* Bare refcount manipulation would probably work on this platform, but just
+    calling VREF does not */
+ #define AFS_FAST_HOLD(vp) osi_vnhold((vp),0)
+ #else
  #define AFS_FAST_HOLD(vp) VN_HOLD(&(vp)->v)
+ #endif
  #define AFS_FAST_RELE(vp) AFS_RELE(&(vp)->v)
  
  /*
***************
*** 270,276 ****
  		AFS_GLOCK();					\
  	} while(0)
  
! #ifdef AFS_OSF_ENV
  #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)			\
  	do {							\
  	    int haveGlock = ISAFS_GLOCK();			\
--- 282,288 ----
  		AFS_GLOCK();					\
  	} while(0)
  
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)			\
  	do {							\
  	    int haveGlock = ISAFS_GLOCK();			\
***************
*** 281,287 ****
  	    if (haveGlock)					\
  		AFS_GLOCK();					\
  	} while(0)
! #else /* AFS_OSF_ENV */
  #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)			\
  	do {							\
  	    int haveGlock = ISAFS_GLOCK();			\
--- 293,299 ----
  	    if (haveGlock)					\
  		AFS_GLOCK();					\
  	} while(0)
! #else /* AFS_OSF_ENV || AFS_FBSD_ENV */
  #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)			\
  	do {							\
  	    int haveGlock = ISAFS_GLOCK();			\
***************
*** 291,297 ****
  	    if (haveGlock)					\
  		AFS_GLOCK();					\
  	} while(0)
! #endif /* AFS_OSF_ENV */
  
  #else /* AFS_GLOBAL_SUNLOCK */
  
--- 303,309 ----
  	    if (haveGlock)					\
  		AFS_GLOCK();					\
  	} while(0)
! #endif /* AFS_OSF_ENV || AFS_FBSD_ENV */
  
  #else /* AFS_GLOBAL_SUNLOCK */
  
***************
*** 310,327 ****
  	    CODE = copyout((SRC),(DST),(LEN));			\
  	} while(0)
  
! #ifdef AFS_OSF_ENV
  #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)			\
  	do {							\
  	    (UIO)->uio_rw = (RW);				\
  	    CODE = uiomove((SRC),(LEN),(UIO));			\
  	} while(0)
! #else /* AFS_OSF_ENV */
  #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)			\
  	do {							\
  	    CODE = uiomove((SRC),(LEN),(RW),(UIO));		\
  	} while(0)
! #endif /* AFS_OSF_ENV */
  
  #endif /* AFS_GLOBAL_SUNLOCK */
  
--- 322,339 ----
  	    CODE = copyout((SRC),(DST),(LEN));			\
  	} while(0)
  
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)			\
  	do {							\
  	    (UIO)->uio_rw = (RW);				\
  	    CODE = uiomove((SRC),(LEN),(UIO));			\
  	} while(0)
! #else /* AFS_OSF_ENV || AFS_FBSD_ENV */
  #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)			\
  	do {							\
  	    CODE = uiomove((SRC),(LEN),(RW),(UIO));		\
  	} while(0)
! #endif /* AFS_OSF_ENV || AFS_FBSD_ENV */
  
  #endif /* AFS_GLOBAL_SUNLOCK */
  
Index: openafs/src/afs/afs_osi_pag.c
diff -c openafs/src/afs/afs_osi_pag.c:1.2 openafs/src/afs/afs_osi_pag.c:1.2.2.3
*** openafs/src/afs/afs_osi_pag.c:1.2	Sat Nov  4 05:03:12 2000
--- openafs/src/afs/afs_osi_pag.c	Mon Apr 23 03:28:37 2001
***************
*** 100,106 ****
  int
  #if	defined(AFS_SUN5_ENV)
  afs_setpag (struct AFS_UCRED **credpp)
! #elif	defined(AFS_OSF_ENV)
  afs_setpag (struct proc *p, void *args, int *retval)
  #else
  afs_setpag (void) 
--- 100,106 ----
  int
  #if	defined(AFS_SUN5_ENV)
  afs_setpag (struct AFS_UCRED **credpp)
! #elif  defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  afs_setpag (struct proc *p, void *args, int *retval)
  #else
  afs_setpag (void) 
***************
*** 127,133 ****
  
  #if	defined(AFS_SUN5_ENV)
      code = AddPag(genpag(), credpp);
! #elif	defined(AFS_OSF_ENV)
      code = AddPag(p, genpag(), &p->p_rcred);
  #elif	defined(AFS_AIX41_ENV)
      {
--- 127,133 ----
  
  #if	defined(AFS_SUN5_ENV)
      code = AddPag(genpag(), credpp);
! #elif	defined(AFS_OSF_ENV) || defined(AFS_FBSD_ENV)
      code = AddPag(p, genpag(), &p->p_rcred);
  #elif	defined(AFS_AIX41_ENV)
      {
***************
*** 159,170 ****
  	code = AddPag(genpag(), &credp);
  	crfree(credp);
      }
  #else
      code = AddPag(genpag(), &u.u_cred);
  #endif
  
      afs_Trace1(afs_iclSetp, CM_TRACE_SETPAG, ICL_TYPE_INT32, code);
! #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV)
  #if defined(AFS_SGI53_ENV) && defined(MP)
      AFS_GUNLOCK();
  #endif /* defined(AFS_SGI53_ENV) && defined(MP) */    
--- 159,176 ----
  	code = AddPag(genpag(), &credp);
  	crfree(credp);
      }
+ #elif defined(AFS_DARWIN_ENV)  || defined(AFS_FBSD_ENV)
+     {
+        struct ucred *credp=crdup(p->p_cred->pc_ucred);
+        code=AddPag(p, genpag(), &credp);
+        crfree(credp);
+     }
  #else
      code = AddPag(genpag(), &u.u_cred);
  #endif
  
      afs_Trace1(afs_iclSetp, CM_TRACE_SETPAG, ICL_TYPE_INT32, code);
! #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  #if defined(AFS_SGI53_ENV) && defined(MP)
      AFS_GUNLOCK();
  #endif /* defined(AFS_SGI53_ENV) && defined(MP) */    
***************
*** 176,195 ****
  #endif
  }
  
! #ifdef	AFS_OSF_ENV
  int AddPag(struct proc *p, afs_int32 aval, struct AFS_UCRED **credpp)
! #else	/* AFS_OSF_ENV */
  int AddPag(afs_int32 aval, struct AFS_UCRED **credpp)
  #endif
  {
      afs_int32 newpag, code;
      AFS_STATCNT(AddPag);
! #ifdef	AFS_OSF_ENV
      if (code = setpag(p, credpp, aval, &newpag, 0))
  #else	/* AFS_OSF_ENV */
      if (code = setpag(credpp, aval, &newpag, 0))
  #endif
! #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV)
  	return (code);
  #else
  	return (setuerror(code), code);
--- 182,201 ----
  #endif
  }
  
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  int AddPag(struct proc *p, afs_int32 aval, struct AFS_UCRED **credpp)
! #else	/* AFS_OSF_ENV || AFS_FBSD_ENV */
  int AddPag(afs_int32 aval, struct AFS_UCRED **credpp)
  #endif
  {
      afs_int32 newpag, code;
      AFS_STATCNT(AddPag);
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
      if (code = setpag(p, credpp, aval, &newpag, 0))
  #else	/* AFS_OSF_ENV */
      if (code = setpag(credpp, aval, &newpag, 0))
  #endif
! #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  	return (code);
  #else
  	return (setuerror(code), code);
***************
*** 211,217 ****
--- 217,228 ----
  	 * think it's ok to use the real uid to make setuid
           * programs (without setpag) to work properly.
           */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+         av->uid = acred->cr_uid;    /* default when no pag is set */
+                                     /* bsd creds don't have ruid */
+ #else
  	av->uid	= acred->cr_ruid;    /* default when no pag is set */
+ #endif
      }
      av->initd = 0;
      return 0;
***************
*** 268,284 ****
      if (cred == NULL) {
  	return NOPAG;
      }
  #ifdef	AFS_AIX_ENV
      if (cred->cr_ngrps < 2) {
  	return NOPAG;
      }
  #else
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DUX40_ENV) || defined(AFS_LINUX_ENV)
      if (cred->cr_ngroups < 2) return NOPAG;
  #endif
  #endif
      g0 = cred->cr_groups[0];
      g1 = cred->cr_groups[1];
      pag = (afs_int32)afs_get_pag_from_groups(g0, g1);
      return pag;
  }
--- 279,305 ----
      if (cred == NULL) {
  	return NOPAG;
      }
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     if (cred == NOCRED || cred == FSCRED) {
+         return NOPAG;
+     }
+     if (cred->cr_ngroups < 3) return NOPAG;
+     /* gid is stored in cr_groups[0] */
+     g0 = cred->cr_groups[1];
+     g1 = cred->cr_groups[2];
+ #else
  #ifdef	AFS_AIX_ENV
      if (cred->cr_ngrps < 2) {
  	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
      g0 = cred->cr_groups[0];
      g1 = cred->cr_groups[1];
+ #endif
      pag = (afs_int32)afs_get_pag_from_groups(g0, g1);
      return pag;
  }
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.4.2.6 openafs/src/afs/afs_pioctl.c:1.4.2.9
*** openafs/src/afs/afs_pioctl.c:1.4.2.6	Tue Mar  6 16:38:25 2001
--- openafs/src/afs/afs_pioctl.c	Mon Apr 23 00:03:27 2001
***************
*** 196,209 ****
  	}
  #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */
  
! #if defined(AFS_LINUX_64BIT_KERNEL)
  	struct afs_ioctl32 dst32;
  
  #ifdef AFS_SPARC64_LINUX20_ENV
! 	if (current->tss.flags & SPARC_FLAG_32BIT) {
  #else
  #error Not done for this linux type
! #endif
  		AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code);
  		if (!code)
  			afs_ioctl32_to_afs_ioctl(&dst32, dst);
--- 196,210 ----
  	}
  #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */
  
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV)
  	struct afs_ioctl32 dst32;
  
  #ifdef AFS_SPARC64_LINUX20_ENV
! 	if (current->tss.flags & SPARC_FLAG_32BIT) 
  #else
  #error Not done for this linux type
! #endif /* AFS_SPARC64_LINUX20_ENV */
! 	  {
  		AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code);
  		if (!code)
  			afs_ioctl32_to_afs_ioctl(&dst32, dst);
***************
*** 380,385 ****
--- 381,398 ----
          caddr_t arg;
      } *uap = (struct a *)args;
  #else /* AFS_OSF_ENV */
+ #ifdef AFS_DARWIN_ENV
+ struct ioctl_args {
+         int fd;
+         u_long com;
+         caddr_t arg;
+ };
+ afs_xioctl(p, uap, retval) 
+         struct proc *p; 
+         register struct ioctl_args *uap;
+         register_t *retval;
+ {
+ #else
  #ifdef AFS_LINUX22_ENV
  struct afs_ioctl_sys {
      unsigned int com;
***************
*** 398,408 ****
  	caddr_t arg;
        } *uap = (struct a *)u.u_ap;
  #endif /* AFS_LINUX22_ENV */
  #endif /* AFS_OSF_ENV */
  #endif	/* AFS_SUN5_ENV */
  #endif
  #ifndef AFS_LINUX22_ENV
! #if	defined(AFS_AIX32_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV)
        struct file *fd;
  #else
        register struct file *fd;
--- 411,422 ----
  	caddr_t arg;
        } *uap = (struct a *)u.u_ap;
  #endif /* AFS_LINUX22_ENV */
+ #endif /* AFS_DARWIN_ENV */
  #endif /* AFS_OSF_ENV */
  #endif	/* AFS_SUN5_ENV */
  #endif
  #ifndef AFS_LINUX22_ENV
! #if	defined(AFS_AIX32_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
        struct file *fd;
  #else
        register struct file *fd;
***************
*** 412,417 ****
--- 426,435 ----
        register int ioctlDone = 0, code = 0;
        
        AFS_STATCNT(afs_xioctl);
+ #ifdef AFS_DARWIN_ENV
+         if ((code=fdgetf(p, uap->fd, &fd)))
+            return code;
+ #else
  #ifdef AFS_LINUX22_ENV
      ua.com = com;
      ua.arg = arg;
***************
*** 448,453 ****
--- 466,472 ----
  #endif
  #endif
  #endif
+ #endif
        
        /* first determine whether this is any sort of vnode */
  #ifdef AFS_LINUX22_ENV
***************
*** 483,488 ****
--- 502,510 ----
  	    if (code) {
  	      osi_FreeSmallSpace(datap);
  	      AFS_GUNLOCK();
+ #ifdef AFS_DARWIN_ENV
+               return code;
+ #else 
  #if	defined(AFS_SUN5_ENV)
  #ifdef	AFS_SUN54_ENV
  	      releasef(uap->fd);
***************
*** 510,515 ****
--- 532,538 ----
  #endif
  #endif
  #endif
+ #endif
  	    }
  	    code = HandleIoctl(tvc, uap->com, datap);
  	    osi_FreeSmallSpace(datap);
***************
*** 552,557 ****
--- 575,583 ----
  #endif
            code = ioctl(uap, rvp);
  #else
+ #if defined(AFS_DARWIN_ENV)
+         return ioctl(p, uap, retval);
+ #else
  #ifdef  AFS_OSF_ENV
  	  code = ioctl(p, args, retval);
  #ifdef	AFS_OSF30_ENV
***************
*** 568,573 ****
--- 594,600 ----
  #endif
  #endif
  #endif
+ #endif
        }
  #ifdef	AFS_SUN5_ENV
        if (ioctlDone)
***************
*** 581,587 ****
  #ifdef AFS_LINUX22_ENV
        return -code;
  #else
! #if	!defined(AFS_OSF_ENV)
        if (!getuerror())
  	  setuerror(code);
  #if	defined(AFS_AIX32_ENV) && !defined(AFS_AIX41_ENV)
--- 608,614 ----
  #ifdef AFS_LINUX22_ENV
        return -code;
  #else
! #if    !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV)
        if (!getuerror())
  	  setuerror(code);
  #if	defined(AFS_AIX32_ENV) && !defined(AFS_AIX41_ENV)
***************
*** 592,598 ****
  #endif
  #endif /* AFS_LINUX22_ENV */
  #endif	/* AFS_SUN5_ENV */
! #ifdef	AFS_OSF_ENV
        return (code);
  #endif
      }
--- 619,625 ----
  #endif
  #endif /* AFS_LINUX22_ENV */
  #endif	/* AFS_SUN5_ENV */
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
        return (code);
  #endif
      }
***************
*** 644,651 ****
--- 671,698 ----
  
  extern struct mount *afs_globalVFS;
  #else	/* AFS_OSF_ENV */
+ #ifdef AFS_DARWIN_ENV
+ afs_pioctl(p, args, retval)
+         struct proc *p;
+         void *args;
+         int *retval;
+ {
+     struct a {
+         char    *path;
+         int     cmd;
+         caddr_t cmarg;
+         int     follow; 
+     } *uap = (struct a *) args;
+     
+     AFS_STATCNT(afs_pioctl);
+     return (afs_syscall_pioctl(uap->path, uap->cmd, uap->cmarg, uap->follow, p->p_cred->pc_ucred));
+ }   
+ 
+ extern struct mount *afs_globalVFS;
+ #else   /* AFS_OSF_ENV */
  extern struct vfs *afs_globalVFS;
  #endif
+ #endif
  
  /* macro to avoid adding any more #ifdef's to pioctl code. */
  #if defined(AFS_LINUX22_ENV) || defined(AFS_AIX41_ENV)
***************
*** 659,668 ****
      rval_t *rvp;
      struct AFS_UCRED *credp;
  #else
  afs_syscall_pioctl(path, com, cmarg, follow)
  #endif
      char *path;
!     int	com;
      caddr_t cmarg;
      int	follow;
  {
--- 706,720 ----
      rval_t *rvp;
      struct AFS_UCRED *credp;
  #else
+ #ifdef AFS_DARWIN_ENV
+ afs_syscall_pioctl(path, com, cmarg, follow, credp)
+     struct AFS_UCRED *credp;
+ #else
  afs_syscall_pioctl(path, com, cmarg, follow)
  #endif
+ #endif
      char *path;
!     unsigned int	com;
      caddr_t cmarg;
      int	follow;
  {
***************
*** 685,691 ****
  #ifndef	AFS_SUN5_ENV
      if (! _VALIDVICEIOCTL(com)) {
  	PIOCTL_FREE_CRED();
! #ifdef AFS_OSF_ENV
          return EINVAL;
  #else	/* AFS_OSF_ENV */
  #if defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
--- 737,743 ----
  #ifndef	AFS_SUN5_ENV
      if (! _VALIDVICEIOCTL(com)) {
  	PIOCTL_FREE_CRED();
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
          return EINVAL;
  #else	/* AFS_OSF_ENV */
  #if defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
***************
*** 700,706 ****
      code = copyin_afs_ioctl(cmarg, &data);
      if (code) {
  	PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
  	return (code);
  #else
  	setuerror(code);
--- 752,758 ----
      code = copyin_afs_ioctl(cmarg, &data);
      if (code) {
  	PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
  	return (code);
  #else
  	setuerror(code);
***************
*** 708,716 ****
  #endif
    }
      if ((com & 0xff) == PSetClientContext) {
! #ifdef AFS_LINUX22_ENV
  	return EINVAL; /* Not handling these yet. */
! #endif
  #if	defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV)
  	code = HandleClientContext(&data, &com, &foreigncreds, credp);
  #else
--- 760,768 ----
  #endif
    }
      if ((com & 0xff) == PSetClientContext) {
! #if defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
  	return EINVAL; /* Not handling these yet. */
! #else
  #if	defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV)
  	code = HandleClientContext(&data, &com, &foreigncreds, credp);
  #else
***************
*** 724,742 ****
  #endif /* AFS_SGI_ENV */
  #endif
  #endif
        if (code) {
  	  if (foreigncreds) {
  	      crfree(foreigncreds);
  	  }
  	  PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
  	  return (code);
  #else
  	  return (setuerror(code), code);
  #endif
        }
      } 
! #ifndef AFS_LINUX22_ENV
      if (foreigncreds) {
        /*
         * We could have done without temporary setting the u.u_cred below
--- 776,795 ----
  #endif /* AFS_SGI_ENV */
  #endif
  #endif
+ #endif
        if (code) {
  	  if (foreigncreds) {
  	      crfree(foreigncreds);
  	  }
  	  PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
  	  return (code);
  #else
  	  return (setuerror(code), code);
  #endif
        }
      } 
! #if !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
      if (foreigncreds) {
        /*
         * We could have done without temporary setting the u.u_cred below
***************
*** 773,779 ****
      if ((com & 0xff) == 15) {
        /* special case prefetch so entire pathname eval occurs in helper process.
  	 otherwise, the pioctl call is essentially useless */
! #if	defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV)
  	code =  Prefetch(path, &data, follow,
  			 foreigncreds ? foreigncreds : credp);
  #else
--- 826,832 ----
      if ((com & 0xff) == 15) {
        /* special case prefetch so entire pathname eval occurs in helper process.
  	 otherwise, the pioctl call is essentially useless */
! #if	defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
  	code =  Prefetch(path, &data, follow,
  			 foreigncreds ? foreigncreds : credp);
  #else
***************
*** 787,793 ****
  #endif /* AFS_SGI64_ENV */
  #endif /* AFS_HPUX101_ENV */
  #endif
! #ifndef AFS_LINUX22_ENV
  	if (foreigncreds) {
  #ifdef	AFS_AIX41_ENV
   	    crset(tmpcred);	/* restore original credentials */
--- 840,846 ----
  #endif /* AFS_SGI64_ENV */
  #endif /* AFS_HPUX101_ENV */
  #endif
! #if !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
  	if (foreigncreds) {
  #ifdef	AFS_AIX41_ENV
   	    crset(tmpcred);	/* restore original credentials */
***************
*** 808,814 ****
  	}
  #endif /* AFS_LINUX22_ENV */
  	PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
  	return (code);
  #else
  	return (setuerror(code), code);
--- 861,867 ----
  	}
  #endif /* AFS_LINUX22_ENV */
  	PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
  	return (code);
  #else
  	return (setuerror(code), code);
***************
*** 830,836 ****
  #endif /* AFS_AIX41_ENV */
  	AFS_GLOCK();
  	if (code) {
! #ifndef AFS_LINUX22_ENV
  	    if (foreigncreds) {
  #ifdef	AFS_AIX41_ENV
  		crset(tmpcred);	/* restore original credentials */
--- 883,889 ----
  #endif /* AFS_AIX41_ENV */
  	AFS_GLOCK();
  	if (code) {
! #if !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
  	    if (foreigncreds) {
  #ifdef	AFS_AIX41_ENV
  		crset(tmpcred);	/* restore original credentials */
***************
*** 851,857 ****
  	    }
  #endif /* AFS_LINUX22_ENV */
  	    PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
  	    return (code);
  #else
  	    return(setuerror(code), code);
--- 904,910 ----
  	    }
  #endif /* AFS_LINUX22_ENV */
  	    PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
  	    return (code);
  #else
  	    return(setuerror(code), code);
***************
*** 906,912 ****
        code = afs_HandlePioctl(vp, com, &data, follow, &credp);
        }
  #else
! #ifdef AFS_LINUX22_ENV
        code = afs_HandlePioctl(vp, com, &data, follow, &credp);
  #else
        code = afs_HandlePioctl(vp, com, &data, follow, &u.u_cred);
--- 959,965 ----
        code = afs_HandlePioctl(vp, com, &data, follow, &credp);
        }
  #else
! #if defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
        code = afs_HandlePioctl(vp, com, &data, follow, &credp);
  #else
        code = afs_HandlePioctl(vp, com, &data, follow, &u.u_cred);
***************
*** 916,922 ****
  #endif /* AFS_AIX41_ENV */
  #endif /* AFS_SUN5_ENV */
      } else {
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
  	code = EINVAL;	/* not in /afs */
  #else
  	setuerror(EINVAL);
--- 969,975 ----
  #endif /* AFS_AIX41_ENV */
  #endif /* AFS_SUN5_ENV */
      } else {
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
  	code = EINVAL;	/* not in /afs */
  #else
  	setuerror(EINVAL);
***************
*** 929,935 ****
  #endif
      }
  
! #ifndef AFS_LINUX22_ENV
      if (foreigncreds) {
  #ifdef	AFS_AIX41_ENV
  	crset(tmpcred);
--- 982,988 ----
  #endif
      }
  
! #if !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
      if (foreigncreds) {
  #ifdef	AFS_AIX41_ENV
  	crset(tmpcred);
***************
*** 957,963 ****
  #endif
      }
      PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
      return (code);
  #else
      if (!getuerror()) 	
--- 1010,1016 ----
  #endif
      }
      PIOCTL_FREE_CRED();
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
      return (code);
  #else
      if (!getuerror()) 	
***************
*** 1368,1378 ****
--- 1421,1438 ----
      afs_PutCell(tcell, READ_LOCK);
      if (set_parent_pag) {
  	int pag;
+ #ifdef AFS_DARWIN_ENV
+         struct proc *p=current_proc(); /* XXX */
+         uprintf("Process %d (%s) tried to change pags in PSetTokens\n",
+                 p->p_pid, p->p_comm);
+         if (!setpag(p, acred, -1, &pag, 1)) {
+ #else   
  #ifdef	AFS_OSF_ENV
  	if (!setpag(u.u_procp, acred, -1, &pag, 1)) {	/* XXX u.u_procp is a no-op XXX */
  #else
  	if (!setpag(acred, -1, &pag, 1)) {
  #endif
+ #endif
  	    afs_InitReq(&treq, *acred);
  	    areq = &treq;
  	}
***************
*** 1502,1511 ****
--- 1562,1577 ----
      cp = ain;
      bcopy(cp, (char *)&volstat, sizeof(AFSFetchVolumeStatus));
      cp += sizeof(AFSFetchVolumeStatus);
+     if (strlen(cp) >= sizeof(volName))
+ 	return E2BIG;
      strcpy(volName, cp);
      cp += strlen(volName)+1;
+     if (strlen(cp) >= sizeof(offLineMsg))
+ 	return E2BIG;
      strcpy(offLineMsg, cp);
      cp +=  strlen(offLineMsg)+1;
+     if (strlen(cp) >= sizeof(motd))
+ 	return E2BIG;
      strcpy(motd, cp);
      storeStat.Mask = 0;
      if (volstat.MinQuota != -1) {
***************
*** 1969,1975 ****
--- 2035,2045 ----
  {
      register char *tp;
      register afs_int32 code;
+ #if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV)
+     size_t bufferSize;
+ #else
      u_int bufferSize;
+ #endif
  
      AFS_STATCNT(Prefetch);
      if (!apath) return EINVAL;
***************
*** 2471,2478 ****
--- 2541,2552 ----
  #if	defined(AFS_SGI_ENV) || defined(AFS_ALPHA_ENV)  || defined(AFS_SUN5_ENV)  || defined(AFS_HPUX_ENV)
  		VN_HOLD((struct vnode *)tvc);
  #else
+ #if defined(AFS_DARWIN_ENV)
+ 		osi_vnhold(tvc, 0);
+ #else
  		tvc->vrefCount++;
  #endif
+ #endif
  		ReleaseReadLock(&afs_xvcache);
  #if	defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV)
  		afs_BozonLock(&tvc->pvnLock, tvc);	/* Since afs_TryToSmush will do a pvn_vptrunc */
***************
*** 2618,2624 ****
      AFS_STATCNT(PSetSysName);
      if (!afs_globalVFS) {
        /* Afsd is NOT running; disable it */
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
  	return (EINVAL);
  #else
  	return (setuerror(EINVAL), EINVAL);
--- 2692,2698 ----
      AFS_STATCNT(PSetSysName);
      if (!afs_globalVFS) {
        /* Afsd is NOT running; disable it */
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
  	return (EINVAL);
  #else
  	return (setuerror(EINVAL), EINVAL);
Index: openafs/src/afs/afs_prototypes.h
diff -c openafs/src/afs/afs_prototypes.h:1.2 openafs/src/afs/afs_prototypes.h:1.2.2.2
*** openafs/src/afs/afs_prototypes.h:1.2	Sat Nov  4 05:03:13 2000
--- openafs/src/afs/afs_prototypes.h	Mon Apr 23 03:28:37 2001
***************
*** 38,46 ****
  /* afs_osi_pag.c */
  extern afs_uint32 genpag(void);
  extern afs_uint32 getpag(void);
! #ifdef	AFS_OSF_ENV
  extern int AddPag(struct proc *p, afs_int32 aval, struct AFS_UCRED **credpp);
! #else	/* AFS_OSF_ENV */
  extern int AddPag(afs_int32 aval, struct AFS_UCRED **credpp);
  #endif
  extern afs_uint32 afs_get_pag_from_groups(gid_t g0, gid_t g1);
--- 38,46 ----
  /* afs_osi_pag.c */
  extern afs_uint32 genpag(void);
  extern afs_uint32 getpag(void);
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  extern int AddPag(struct proc *p, afs_int32 aval, struct AFS_UCRED **credpp);
! #else	/* AFS_OSF_ENV || AFS_FBSD_ENV */
  extern int AddPag(afs_int32 aval, struct AFS_UCRED **credpp);
  #endif
  extern afs_uint32 afs_get_pag_from_groups(gid_t g0, gid_t g1);
***************
*** 119,125 ****
  			 int acell, struct cell *tcell, struct vrequest *areq);
  extern void afs_ResetVolumeInfo(struct volume *tv);
  
! #if defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV)
  #include "../afs/osi_prototypes.h"
  #endif
  
--- 119,125 ----
  			 int acell, struct cell *tcell, struct vrequest *areq);
  extern void afs_ResetVolumeInfo(struct volume *tv);
  
! #if defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  #include "../afs/osi_prototypes.h"
  #endif
  
Index: openafs/src/afs/afs_server.c
diff -c openafs/src/afs/afs_server.c:1.3.2.1 openafs/src/afs/afs_server.c:1.3.2.3
*** openafs/src/afs/afs_server.c:1.3.2.1	Wed Dec 13 16:48:56 2000
--- openafs/src/afs/afs_server.c	Mon Apr 23 03:28:38 2001
***************
*** 1202,1207 ****
--- 1202,1214 ----
  #ifdef AFS_SGI62_ENV
      (void) hash_enum(&hashinfo_inaddr, afsi_enum_set_rank, HTF_INET, NULL,
  		     (caddr_t)sa, NULL);
+ #elif defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     {
+         struct in_ifaddr *ifa;
+         TAILQ_FOREACH(ifa , &in_ifaddrhead, ia_link) {
+             afsi_SetServerIPRank(sa, ifa);
+         }
+     }
  #else
      {
  	extern struct in_ifaddr *in_ifaddr;
Index: openafs/src/afs/afs_user.c
diff -c openafs/src/afs/afs_user.c:1.3 openafs/src/afs/afs_user.c:1.3.2.2
*** openafs/src/afs/afs_user.c:1.3	Sun Nov  5 23:17:06 2000
--- openafs/src/afs/afs_user.c	Mon Apr 23 03:28:38 2001
***************
*** 606,612 ****
--- 606,616 ----
      afs_GCPAGs_cred_count++;
  
      pag = PagInCred(pcred);
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD40_ENV)
+     uid = (pag != NOPAG ? pag : pcred->cr_uid);
+ #else
      uid = (pag != NOPAG ? pag : pcred->cr_ruid);
+ #endif
      hash = UHash(uid);
  
      /* if this token is PAG based, or it's UID based and 
Index: openafs/src/afs/afs_vcache.c
diff -c openafs/src/afs/afs_vcache.c:1.3.2.1 openafs/src/afs/afs_vcache.c:1.3.2.2
*** openafs/src/afs/afs_vcache.c:1.3.2.1	Fri Jan 19 04:39:07 2001
--- openafs/src/afs/afs_vcache.c	Mon Apr 23 00:03:30 2001
***************
*** 66,71 ****
--- 66,73 ----
  #ifdef AFS_OSF_ENV
  extern struct mount *afs_globalVFS;
  extern struct vnodeops Afs_vnodeops;
+ #elif defined(AFS_DARWIN_ENV)
+ extern struct mount *afs_globalVFS;
  #else
  extern struct vfs *afs_globalVFS;
  #endif /* AFS_OSF_ENV */
***************
*** 703,708 ****
--- 705,721 ----
  	   else if (QNext(uq) != tq)
  		refpanic("VLRU inconsistent");
  
+ #ifdef AFS_DARWIN_ENV
+ 	   if (tvc->opens == 0 && ((tvc->states & CUnlinkedDel) == 0) &&
+                 tvc->vrefCount == 1 && UBCINFOEXISTS(&tvc->v)) {
+                osi_VM_TryReclaim(tvc, &fv_slept);
+                if (fv_slept) {
+                   uq = VLRU.prev;
+                   i = 0;
+                   continue;  /* start over - may have raced. */
+                }
+             }
+ #endif
  	   if (tvc->vrefCount == 0 && tvc->opens == 0
  	       && (tvc->states & CUnlinkedDel) == 0) {
  		code = afs_FlushVCache(tvc, &fv_slept);
***************
*** 867,872 ****
--- 880,896 ----
  #else
      SetAfsVnode((struct vnode *)tvc);
  #endif /* AFS_SGI64_ENV */
+ #ifdef AFS_DARWIN_ENV
+     tvc->v.v_ubcinfo = UBC_INFO_NULL;
+     lockinit(&tvc->rwlock, PINOD, "vcache rwlock", 0, 0);
+     cache_purge((struct vnode *)tvc); 
+     tvc->v.v_data=tvc;
+     tvc->v.v_tag=VT_AFS;
+     /* VLISTNONE(&tvc->v); */
+     tvc->v.v_freelist.tqe_next=0;
+     tvc->v.v_freelist.tqe_prev=(struct vnode **)0xdeadb;
+     /*tvc->vrefCount++;*/
+ #endif 
      /*
       * The proper value for mvstat (for root fids) is setup by the caller.
       */
***************
*** 1113,1118 ****
--- 1137,1148 ----
  		    crfree(cred);
  		}
  	    }	       
+ #ifdef AFS_DARWIN_ENV
+             if (tvc->vrefCount == 1 && UBCINFOEXISTS(&tvc->v)) {
+ 		if (tvc->opens) panic("flushactive open, hasubc, but refcnt 1");
+ 		osi_VM_TryReclaim(tvc,0);
+ 	    }
+ #endif
  	}
      }
      ReleaseReadLock(&afs_xvcache);
***************
*** 1601,1606 ****
--- 1631,1639 ----
  	vcache2inode(tvc);
  #endif
  	ReleaseWriteLock(&tvc->lock);
+ #ifdef AFS_DARWIN_ENV
+         osi_VM_Setup(tvc);
+ #endif
  	return tvc;
      }
  
***************
*** 1657,1662 ****
--- 1690,1698 ----
      }
  
      ReleaseWriteLock(&tvc->lock);
+ #ifdef AFS_DARWIN_ENV
+     osi_VM_Setup(avc);
+ #endif
      return tvc;
  
  } /*afs_GetVCache*/
***************
*** 1812,1817 ****
--- 1848,1856 ----
      afs_ProcessFS(tvc, &OutStatus, areq);
  
      ReleaseWriteLock(&tvc->lock);
+ #ifdef AFS_DARWIN_ENV
+     osi_VM_Setup(tvc);
+ #endif
      return tvc;
  
  }
***************
*** 2116,2121 ****
--- 2155,2161 ----
  return code;
  }
  
+ #if 0
  /*
   * afs_StuffVcache
   *
***************
*** 2254,2259 ****
--- 2294,2300 ----
       */
      afs_PutVCache(tvc, WRITE_LOCK);
  } /*afs_StuffVcache*/
+ #endif
  
  /*
   * afs_PutVCache
***************
*** 2376,2381 ****
--- 2417,2426 ----
  #ifdef AFS_LINUX22_ENV
      if (tvc && (tvc->states & CStatd))
  	vcache2inode(tvc); /* mainly to reset i_nlink */
+ #endif
+ #ifdef AFS_DARWIN_ENV
+     if (tvc)
+         osi_VM_Setup(tvc);
  #endif
      return tvc;
  } /*afs_FindVCache*/
Index: openafs/src/afs/afsincludes.h
diff -c openafs/src/afs/afsincludes.h:1.2 openafs/src/afs/afsincludes.h:1.2.2.2
*** openafs/src/afs/afsincludes.h:1.2	Sat Nov  4 05:03:15 2000
--- openafs/src/afs/afsincludes.h	Mon Apr 23 03:28:39 2001
***************
*** 51,56 ****
  #include "../afs/afs_axscache.h"
  #include "../afs/icl.h"
  #include "../afs/afs_prototypes.h"
! #ifdef AFS_LINUX20_ENV
  #include "../afs/osi_machdep.h"
  #endif
--- 51,56 ----
  #include "../afs/afs_axscache.h"
  #include "../afs/icl.h"
  #include "../afs/afs_prototypes.h"
! #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  #include "../afs/osi_machdep.h"
  #endif
Index: openafs/src/afs/exporter.h
diff -c openafs/src/afs/exporter.h:1.2.2.1 openafs/src/afs/exporter.h:1.2.2.3
*** openafs/src/afs/exporter.h:1.2.2.1	Fri Jan 19 04:29:36 2001
--- openafs/src/afs/exporter.h	Mon Apr 23 03:28:39 2001
***************
*** 39,48 ****
--- 39,52 ----
  #define	AFS_XLATOR_MAGIC	0x87654321
  #endif
  
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #define AFS_NFSXLATORREQ(cred) 0
+ #else
  #ifdef	AFS_OSF_ENV
  #define	AFS_NFSXLATORREQ(cred)    ((cred)->cr_ruid == NFSXLATOR_CRED)
  #else
  #define	AFS_NFSXLATORREQ(cred)    ((cred)->cr_rgid == NFSXLATOR_CRED)
+ #endif
  #endif
  
  struct	exporterops {
Index: openafs/src/afs/lock.h
diff -c openafs/src/afs/lock.h:1.2 openafs/src/afs/lock.h:1.2.2.2
*** openafs/src/afs/lock.h:1.2	Sat Nov  4 05:03:15 2000
--- openafs/src/afs/lock.h	Mon Apr 23 03:28:39 2001
***************
*** 109,115 ****
--- 109,119 ----
  #ifdef AFS_LINUX20_ENV
  #define MyPidxx current->pid
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #define MyPidxx (current_proc()->p_pid )
+ #else
  #define MyPidxx (u.u_procp->p_pid )
+ #endif /* AFS_DARWIN_ENV */
  #endif /* AFS_LINUX20_ENV */
  #endif /* AFS_SGI64_ENV */
  #endif /* AFS_HPUX101_ENV */
Index: openafs/src/afs/sysincludes.h
diff -c openafs/src/afs/sysincludes.h:1.3.2.1 openafs/src/afs/sysincludes.h:1.3.2.3
*** openafs/src/afs/sysincludes.h:1.3.2.1	Tue Mar  6 16:11:16 2001
--- openafs/src/afs/sysincludes.h	Mon Apr 23 03:28:39 2001
***************
*** 41,46 ****
--- 41,50 ----
  #include <linux/errno.h>
  
  #else /* AFS_LINUX22_ENV */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #define _MACH_ETAP_H_   
+ typedef unsigned short                  etap_event_t; 
+ #endif
  #if	!defined(AFS_OSF_ENV)
  #include "../h/errno.h"
  #include "../h/types.h"
***************
*** 128,134 ****
  #include "../h/socketvar.h"
  #include "../h/protosw.h"
  
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV)
  #  include "../h/dirent.h"
  #  ifdef	AFS_SUN5_ENV
  #    include "../h/sysmacros.h"
--- 132,138 ----
  #include "../h/socketvar.h"
  #include "../h/protosw.h"
  
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_FBSD_ENV)
  #  include "../h/dirent.h"
  #  ifdef	AFS_SUN5_ENV
  #    include "../h/sysmacros.h"
***************
*** 180,185 ****
--- 184,214 ----
  #    include "../h/swap.h"	/* for struct swpdbd, for vnode.h compiler warnings */
  #    include "../h/dbd.h"	/* for union idbd, for vnode.h compiler warnings */
  #  endif /* AFS_HPUX_ENV */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD40_ENV)
+ #  include <sys/uio.h>
+ #  include <sys/mount.h> 
+ #  include <sys/namei.h>
+ #  include <sys/vnode.h>  
+ #  include <sys/queue.h>    
+ #ifndef AFS_FBSD_ENV
+ #  include <sys/ubc.h>
+ #define timeout_fcn_t mach_timeout_fcn_t
+ #  include <kern/sched_prim.h>
+ #else
+ #  include <ufs/ufs/dinode.h>
+ #  include <vm/vm.h>
+ #  include <vm/vm_extern.h>
+ #  include <vm/pmap.h>
+ #  include <vm/vm_map.h>
+ #  include <sys/lock.h>
+ #endif
+ #undef timeout_fcn_t
+ #define _DIR_H_
+ #define doff_t          int32_t
+ #  include <ufs/ufs/quota.h>
+ #  include <ufs/ufs/inode.h>
+ #  include <ufs/ffs/fs.h>
+ #else
  #  include "../h/vfs.h"
  #  include "../h/vnode.h"
  #  ifdef	AFS_SUN5_ENV
***************
*** 193,198 ****
--- 222,228 ----
  #      endif /* !AFS_HPUX_ENV */
  #    endif /* !AFS_AIX32_ENV */
  #  endif /* AFS_SUN5_ENV */
+ #endif /* AFS_DARWIN_ENV || AFS_FBSD_ENV */
  #endif /* AFS_DEC_ENV */
  
  /* These mainly deal with networking and rpc headers */
***************
*** 213,219 ****
--- 243,251 ----
  
  /* Miscellaneous headers */
  #include "../h/proc.h"
+ #if !defined(AFS_FBSD_ENV)
  #include "../h/ioctl.h"
+ #endif /* AFS_FBSD_ENV */
  
  #if	defined(AFS_HPUX101_ENV)
  #include "../h/proc_iface.h"
***************
*** 224,231 ****
  #include "../h/unistd.h"
  #include "../h/tty.h"
  #endif
  
- #if !defined(AFS_SGI_ENV) && !defined(AFS_SUN_ENV) && !defined(AFS_MACH_ENV) && !defined(AFS_AIX32_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SUN5_ENV)
  #  include "../h/text.h"
  #endif 
  
--- 256,264 ----
  #include "../h/unistd.h"
  #include "../h/tty.h"
  #endif
+ 
+ #if !defined(AFS_SGI_ENV) && !defined(AFS_SUN_ENV) && !defined(AFS_MACH_ENV) && !defined(AFS_AIX32_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  
  #  include "../h/text.h"
  #endif 
  
Index: openafs/src/afs/DARWIN/osi_file.c
diff -c /dev/null openafs/src/afs/DARWIN/osi_file.c:1.2.4.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_file.c	Mon Apr 23 00:03:35 2001
***************
*** 0 ****
--- 1,293 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #include "../afs/param.h"       /* Should be always first */
+ #include "../afs/sysincludes.h" /* Standard vendor system headers */
+ #include "../afs/afsincludes.h" /* Afs-based standard headers */
+ #include "../afs/afs_stats.h"  /* afs statistics */
+ #include "../afs/osi_inode.h"
+ 
+ 
+ int afs_osicred_initialized=0;
+ struct  AFS_UCRED afs_osi_cred;
+ afs_lock_t afs_xosi;            /* lock is for tvattr */
+ extern struct osi_dev cacheDev;
+ extern struct mount *afs_cacheVfsp;
+ int afs_CacheFSType = -1;
+ 
+ /* Initialize the cache operations. Called while initializing cache files. */
+ void afs_InitDualFSCacheOps(struct vnode *vp)
+ {
+     int code;
+     static int inited = 0;
+ 
+     if (inited)
+         return;
+     inited = 1;
+ 
+     if (vp == NULL)
+         return;
+     if (strncmp("hfs", vp->v_mount->mnt_vfc->vfc_name, 3) == 0)
+        afs_CacheFSType = AFS_APPL_HFS_CACHE;
+     else 
+     if (strncmp("ufs", vp->v_mount->mnt_vfc->vfc_name, 3) == 0)
+        afs_CacheFSType = AFS_APPL_UFS_CACHE;
+     else
+        osi_Panic("Unknown cache vnode type\n");
+ }
+ 
+ ino_t VnodeToIno(vnode_t *avp)
+ {
+    unsigned long ret;
+ 
+    if (afs_CacheFSType == AFS_APPL_UFS_CACHE) {
+       struct inode *ip = VTOI(avp);
+       ret=ip->i_number;
+    } else if (afs_CacheFSType == AFS_APPL_HFS_CACHE) {
+ #ifndef VTOH
+       struct vattr va;
+       if (VOP_GETATTR(avp, &va, &afs_osi_cred, current_proc()))
+          osi_Panic("VOP_GETATTR failed in VnodeToIno\n"); 
+       ret=va.va_fileid;
+ #else
+       struct hfsnode *hp = VTOH(avp);
+       ret=H_FILEID(hp);
+ #endif
+    } else
+        osi_Panic("VnodeToIno called before cacheops initialized\n");
+    return ret;
+ }
+ 
+ 
+ dev_t VnodeToDev(vnode_t *avp)
+ {
+ 
+     
+    if (afs_CacheFSType == AFS_APPL_UFS_CACHE) {
+       struct inode *ip = VTOI(avp);
+       return ip->i_dev;
+    } else
+    if (afs_CacheFSType == AFS_APPL_HFS_CACHE) {
+ #ifndef VTOH /* slow, but works */
+       struct vattr va;
+       if (VOP_GETATTR(avp, &va, &afs_osi_cred, current_proc()))
+          osi_Panic("VOP_GETATTR failed in VnodeToDev\n"); 
+       return va.va_fsid; /* XXX they say it's the dev.... */
+ #else
+       struct hfsnode *hp = VTOH(avp);
+       return H_DEV(hp);
+ #endif
+    } else
+        osi_Panic("VnodeToDev called before cacheops initialized\n");
+ }
+ 
+ void *osi_UFSOpen(ainode)
+     afs_int32 ainode;
+ {
+     struct vnode *vp;
+     struct vattr va;
+     register struct osi_file *afile = NULL;
+     extern int cacheDiskType;
+     afs_int32 code = 0;
+     int dummy;
+     AFS_STATCNT(osi_UFSOpen);
+     if(cacheDiskType != AFS_FCACHE_TYPE_UFS) {
+ 	osi_Panic("UFSOpen called for non-UFS cache\n");
+     }
+     if (!afs_osicred_initialized) {
+ 	/* valid for alpha_osf, SunOS, Ultrix */
+ 	bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED));
+ 	afs_osi_cred.cr_ref++;
+ 	afs_osi_cred.cr_ngroups=1;
+ 	afs_osicred_initialized = 1;
+     }
+     afile = (struct osi_file *) osi_AllocSmallSpace(sizeof(struct osi_file));
+     AFS_GUNLOCK();
+     if (afs_CacheFSType == AFS_APPL_HFS_CACHE) 
+        code = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, &ainode, &vp, &va, &dummy); /* XXX hfs is broken */
+     else
+ 	if (afs_CacheFSType == AFS_APPL_UFS_CACHE)
+ 	    code = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t)ainode, &vp, &va, &dummy);
+ 	else
+ 	    panic("osi_UFSOpen called before cacheops initialized\n");
+     AFS_GLOCK();
+     if (code) {
+ 	osi_FreeSmallSpace(afile);
+ 	osi_Panic("UFSOpen: igetinode failed");
+     }
+     afile->vnode = vp;
+     afile->size = va.va_size;
+     afile->offset = 0;
+     afile->proc = (int (*)()) 0;
+     afile->inum = ainode;        /* for hint validity checking */
+     return (void *)afile;
+ }
+ 
+ afs_osi_Stat(afile, astat)
+     register struct osi_file *afile;
+     register struct osi_stat *astat; {
+     register afs_int32 code;
+     struct vattr tvattr;
+     AFS_STATCNT(osi_Stat);
+     MObtainWriteLock(&afs_xosi,320);
+     AFS_GUNLOCK();
+     code=VOP_GETATTR(afile->vnode, &tvattr, &afs_osi_cred, current_proc());
+     AFS_GLOCK();
+     if (code == 0) {
+ 	astat->size = tvattr.va_size;
+ 	astat->blksize = tvattr.va_blocksize;
+ 	astat->mtime = tvattr.va_mtime.tv_sec;
+ 	astat->atime = tvattr.va_atime.tv_sec;
+     }
+     MReleaseWriteLock(&afs_xosi);
+     return code;
+ }
+ 
+ osi_UFSClose(afile)
+      register struct osi_file *afile;
+   {
+       AFS_STATCNT(osi_Close);
+       if(afile->vnode) {
+ 	AFS_RELE(afile->vnode);
+       }
+       
+       osi_FreeSmallSpace(afile);
+       return 0;
+   }
+ 
+ osi_UFSTruncate(afile, asize)
+     register struct osi_file *afile;
+     afs_int32 asize; {
+     struct AFS_UCRED *oldCred;
+     struct vattr tvattr;
+     register afs_int32 code;
+     struct osi_stat tstat;
+     AFS_STATCNT(osi_Truncate);
+ 
+     /* This routine only shrinks files, and most systems
+      * have very slow truncates, even when the file is already
+      * small enough.  Check now and save some time.
+      */
+     code = afs_osi_Stat(afile, &tstat);
+     if (code || tstat.size <= asize) return code;
+     MObtainWriteLock(&afs_xosi,321);    
+     VATTR_NULL(&tvattr);
+     tvattr.va_size = asize;
+     AFS_GUNLOCK();
+     code=VOP_SETATTR(afile->vnode, &tvattr, &afs_osi_cred, current_proc());
+     AFS_GLOCK();
+     MReleaseWriteLock(&afs_xosi);
+     return code;
+ }
+ 
+ void osi_DisableAtimes(avp)
+ struct vnode *avp;
+ {
+ 
+ 
+    if (afs_CacheFSType == AFS_APPL_UFS_CACHE) {
+       struct inode *ip = VTOI(avp);
+       ip->i_flag &= ~IN_ACCESS;
+    }
+ #ifdef VTOH /* can't do this without internals */
+    else if (afs_CacheFSType == AFS_APPL_HFS_CACHE) {
+       struct hfsnode *hp = VTOH(avp);
+       hp->h_nodeflags &= ~IN_ACCESS;
+    }
+ #endif
+ }
+ 
+ 
+ /* Generic read interface */
+ afs_osi_Read(afile, offset, aptr, asize)
+     register struct osi_file *afile;
+     int offset;
+     char *aptr;
+     afs_int32 asize; {
+     struct AFS_UCRED *oldCred;
+     unsigned int resid;
+     register afs_int32 code;
+     AFS_STATCNT(osi_Read);
+ 
+     /**
+       * If the osi_file passed in is NULL, panic only if AFS is not shutting
+       * down. No point in crashing when we are already shutting down
+       */
+     if ( !afile ) {
+ 	if ( !afs_shuttingdown )
+ 	    osi_Panic("osi_Read called with null param");
+ 	else
+ 	    return EIO;
+     }
+ 
+     if (offset != -1) afile->offset = offset;
+     AFS_GUNLOCK();
+     code = gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, afile->offset,
+ 	          AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid);
+     AFS_GLOCK();
+     if (code == 0) {
+ 	code = asize - resid;
+ 	afile->offset += code;
+ 	osi_DisableAtimes(afile->vnode);
+     }
+     else {
+ 	afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
+ 	         ICL_TYPE_INT32, code);
+ 	code = -1;
+     }
+     return code;
+ }
+ 
+ /* Generic write interface */
+ afs_osi_Write(afile, offset, aptr, asize)
+     register struct osi_file *afile;
+     char *aptr;
+     afs_int32 offset;
+     afs_int32 asize; {
+     struct AFS_UCRED *oldCred;
+     unsigned int resid;
+     register afs_int32 code;
+     AFS_STATCNT(osi_Write);
+     if ( !afile )
+ 	osi_Panic("afs_osi_Write called with null param");
+     if (offset != -1) afile->offset = offset;
+     {
+ 	AFS_GUNLOCK();
+ 	code = gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, afile->offset,
+ 	          AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid);
+ 	AFS_GLOCK();
+     }
+     if (code == 0) {
+ 	code = asize - resid;
+ 	afile->offset += code;
+     }
+     else {
+ 	code = -1;
+     }
+     if (afile->proc) {
+ 	(*afile->proc)(afile, code);
+     }
+     return code;
+ }
+ 
+ 
+ 
+ 
+ 
+ void
+ shutdown_osifile()
+ {
+   extern int afs_cold_shutdown;
+ 
+   AFS_STATCNT(shutdown_osifile);
+   if (afs_cold_shutdown) {
+     afs_osicred_initialized = 0;
+   }
+ }
+ 
Index: openafs/src/afs/DARWIN/osi_groups.c
diff -c /dev/null openafs/src/afs/DARWIN/osi_groups.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_groups.c	Mon Apr 23 00:03:35 2001
***************
*** 0 ****
--- 1,169 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ /*
+  * osi_groups.c
+  *
+  * Implements:
+  * Afs_xsetgroups (syscall)
+  * setpag
+  *
+  */
+ #include "../afs/param.h"
+ #include "../afs/sysincludes.h"
+ #include "../afs/afsincludes.h"
+ #include "../afs/afs_stats.h"  /* statistics */
+ 
+ static int
+ afs_getgroups(
+     struct ucred *cred,
+     int ngroups,
+     gid_t *gidset);
+ 
+ static int
+ afs_setgroups(
+     struct proc *proc,
+     struct ucred **cred,
+     int ngroups,
+     gid_t *gidset,
+     int change_parent);
+ 
+ int
+ Afs_xsetgroups(p, args, retval)
+     struct proc *p;
+     void *args;
+     int *retval;
+ {
+     int code = 0;
+     struct vrequest treq;
+     struct ucred *cr;
+ 
+     pcred_readlock(p);
+     cr=crdup(p->p_cred->pc_ucred);
+     pcred_unlock(p);
+ 
+     AFS_STATCNT(afs_xsetgroups);
+     AFS_GLOCK();
+     
+     code = afs_InitReq(&treq, cr);
+     AFS_GUNLOCK();
+     crfree(cr);
+     if (code) return setgroups(p, args, retval); /* afs has shut down */
+ 
+     code = setgroups(p, args, retval);
+     /* Note that if there is a pag already in the new groups we don't
+      * overwrite it with the old pag.
+      */
+     pcred_readlock(p);
+     cr=crdup(p->p_cred->pc_ucred);
+     pcred_unlock(p);
+ 
+     if (PagInCred(cr) == NOPAG) {
+ 	if (((treq.uid >> 24) & 0xff) == 'A') {
+ 	    AFS_GLOCK();
+ 	    /* we've already done a setpag, so now we redo it */
+ 	    AddPag(p, treq.uid, &cr );
+ 	    AFS_GUNLOCK();
+ 	}
+     }
+     crfree(cr);
+     return code;
+ }
+ 
+ 
+ int
+ setpag(proc, cred, pagvalue, newpag, change_parent)
+     struct proc *proc;
+     struct ucred **cred;
+     afs_uint32 pagvalue;
+     afs_uint32 *newpag;
+     afs_uint32 change_parent;
+ {
+     gid_t gidset[NGROUPS];
+     int ngroups, code;
+     int j;
+ 
+     AFS_STATCNT(setpag);
+     ngroups = afs_getgroups(*cred, NGROUPS, gidset);
+     if (afs_get_pag_from_groups(gidset[1], gidset[2]) == NOPAG) {
+ 	/* We will have to shift grouplist to make room for pag */
+ 	if (ngroups + 2 > NGROUPS) {
+ 	    return (E2BIG);
+ 	}
+ 	for (j = ngroups -1; j >= 1; j--) {
+ 	    gidset[j+2] = gidset[j];
+ 	}
+ 	ngroups += 2;
+     }
+     *newpag = (pagvalue == -1 ? genpag(): pagvalue);
+     afs_get_groups_from_pag(*newpag, &gidset[1], &gidset[2]);
+     code = afs_setgroups(proc, cred, ngroups, gidset, change_parent);
+     return code;
+ }
+ 
+ 
+ static int
+ afs_getgroups(
+     struct ucred *cred,
+     int ngroups,
+     gid_t *gidset)
+ {
+     int ngrps, savengrps;
+     gid_t *gp;
+ 
+     AFS_STATCNT(afs_getgroups);
+     savengrps = ngrps = MIN(ngroups, cred->cr_ngroups);
+     gp = cred->cr_groups;
+     while (ngrps--)
+ 	*gidset++ = *gp++;   
+     return savengrps;
+ }
+ 
+ 
+ 
+ static int
+ afs_setgroups(
+     struct proc *proc,
+     struct ucred **cred,
+     int ngroups,
+     gid_t *gidset,
+     int change_parent)
+ {
+     int ngrps;
+     int i;
+     gid_t *gp;
+     struct ucred *oldcr, *cr;
+ 
+     AFS_STATCNT(afs_setgroups);
+     /*
+      * The real setgroups() call does this, so maybe we should too.
+      *
+      */
+     if (ngroups > NGROUPS)
+ 	return EINVAL;
+     cr = *cred;
+     cr->cr_ngroups = ngroups;
+     gp = cr->cr_groups;
+     while (ngroups--)
+ 	*gp++ = *gidset++;
+     if (change_parent) {
+ 	crhold(cr);
+ 	pcred_writelock(proc->p_pptr);
+ 	oldcr=proc->p_pptr->p_cred->pc_ucred;
+ 	proc->p_pptr->p_cred->pc_ucred=cr;
+ 	pcred_unlock(proc->p_pptr);
+ 	crfree(oldcr);
+     }
+     crhold(cr);
+     pcred_writelock(proc);
+     oldcr=proc->p_cred->pc_ucred;
+     proc->p_cred->pc_ucred=cr;
+     pcred_unlock(proc);
+     crfree(oldcr);
+     return(0);
+ }
Index: openafs/src/afs/DARWIN/osi_inode.c
diff -c /dev/null openafs/src/afs/DARWIN/osi_inode.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_inode.c	Mon Apr 23 00:03:36 2001
***************
*** 0 ****
--- 1,317 ----
+ /*
+  * 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
+  */
+ /*
+  * MACOS inode operations
+  *
+  * Implements:
+  *
+  */
+ #include "../afs/param.h"       /* Should be always first */
+ #include "../afs/sysincludes.h" /* Standard vendor system headers */
+ #include "../afs/afsincludes.h" /* Afs-based standard headers */
+ #include "../afs/osi_inode.h"
+ #include "../afs/afs_stats.h" /* statistics stuff */
+ #include <ufs/ufs/ufsmount.h>
+ extern struct ucred afs_osi_cred;
+ 
+ getinode(fs, dev, inode, vpp, perror)
+      struct mount *fs;
+      struct vnode **vpp;
+      dev_t dev;
+      ino_t inode;
+      int *perror;
+ {
+     struct vnode *vp;
+     int code;
+ 
+     *vpp = 0;
+     *perror = 0;
+     if (!fs) {
+ 	register struct ufsmount *ump;
+ #ifdef VFSTOHFS
+ 	register struct hfsmount *hmp;
+ #endif
+ 	register struct vnode *vp;
+ 	register struct mount *mp;
+ 	extern struct mount *rootfs;
+ 	if (mp = rootfs) do {
+ 	    /*
+ 	     * XXX Also do the test for MFS 
+ 	     */
+ 	    if (!strcmp(mp->mnt_vfc->vfc_name, "ufs")) {        
+ 	        ump = VFSTOUFS(mp);
+ 	        if (ump->um_fs == NULL)
+ 	            break;
+ 	        if (ump->um_dev == dev) {
+ 	            fs = ump->um_mountp;
+ 	        }
+ 	    }
+ #ifdef VFSTOHFS
+ 	    if (!strcmp(mp->mnt_vfc->vfc_name, "hfs")) {
+ 	        hmp = VFSTOHFS(mp);
+ #if 0
+ 	        if (hmp->hfs_mp == NULL)
+ 	            break;
+ #endif
+ 	        if (hmp->hfs_raw_dev == dev) {
+ 	            fs = hmp->hfs_mp;
+ 	        }
+ 	    }   
+ #endif
+ 
+ 	    mp = CIRCLEQ_NEXT(mp, mnt_list);
+ 	} while (mp != rootfs);
+ 	if (!fs)
+ 	    return(ENXIO);
+     }
+     code=VFS_VGET(fs, (void *)inode, &vp);
+     if (code) {
+ 	*perror = BAD_IGET;
+ 	return code;
+     } else { 
+ 	*vpp = vp;
+ 	return(0);
+     }
+ }
+ extern int afs_CacheFSType;
+ igetinode(vfsp, dev, inode, vpp, va, perror)
+      struct vnode **vpp;
+      struct mount *vfsp;
+      dev_t dev;
+      ino_t inode;
+      struct vattr *va;
+      int *perror;
+ {
+     struct vnode *pvp, *vp;
+     extern struct osi_dev cacheDev;
+     register int code = 0;
+ 
+     *perror = 0;
+ 
+     AFS_STATCNT(igetinode);
+     if ((code = getinode(vfsp, dev, inode, &vp, perror)) != 0) {
+ 	return(code);
+     }
+     if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK) {
+         printf("igetinode: bad type %d\n", vp->v_type);
+ 	iforget(vp);        
+ 	return(ENOENT);
+     }
+     VOP_GETATTR(vp, va, &afs_osi_cred, current_proc());
+     if (va->va_mode == 0) {
+ 	/* Not an allocated inode */
+ 	iforget(vp);        
+ 	return(ENOENT);
+     }
+     if (vfsp && afs_CacheFSType == AFS_APPL_HFS_CACHE && va->va_nlink == 0) {
+         printf("igetinode: hfs nlink 0\n");
+     }
+     if (va->va_nlink == 0) {
+ 	vput(vp);
+ 	return(ENOENT);
+     }
+ 
+     VOP_UNLOCK(vp, 0, current_proc());
+     *vpp = vp;
+     return(0);
+ }
+ 
+ iforget(vp)
+ struct vnode *vp;
+ {
+ 
+     AFS_STATCNT(iforget);
+     /* XXX could sleep */
+     vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, current_proc());
+     /* this whole thing is too wierd.  Why??? XXX */
+     if (vp->v_usecount == 1) {
+ 	vp->v_usecount=0;
+ 	VOP_UNLOCK(vp,0, current_proc());
+ #if 0
+ 	simple_lock(&vnode_free_list_slock);
+ 	TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist);
+ 	freevnodes++;
+ 	simple_unlock(&vnode_free_list_slock);
+ #else
+ 	printf("iforget: leaking vnode\n");
+ #endif
+     } else {
+ 	vput(vp);
+     }
+ }
+ 
+ #if 0
+ /*
+  * icreate system call -- create an inode
+  */
+ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval)
+      long *retval;
+      long dev, near_inode, param1, param2, param3, param4;
+ {
+     int dummy, err=0;
+     struct inode *ip, *newip;
+     register int code;
+     struct vnode *vp;
+     
+     AFS_STATCNT(afs_syscall_icreate);
+     
+     if (!afs_suser())
+ 	return(EPERM);
+ 
+     code = getinode(0, (dev_t)dev, 2, &ip, &dummy);
+     if (code) {
+ 	return(ENOENT);
+     }
+     code = ialloc(ip, (ino_t)near_inode, 0, &newip);
+     iput(ip);
+     if (code) {
+ 	return(code);
+     }
+     IN_LOCK(newip);
+     newip->i_flag |= IACC|IUPD|ICHG;
+     
+     newip->i_nlink = 1;
+ 
+     newip->i_mode = IFREG;
+     
+     IN_UNLOCK(newip);
+     vp = ITOV(newip);
+     VN_LOCK(vp);
+     vp->v_type = VREG;
+     VN_UNLOCK(vp);
+     
+     if ( !vp->v_object)
+ 	{
+ 	    extern struct vfs_ubcops ufs_ubcops;
+ 	    extern struct vm_ubc_object* ubc_object_allocate();
+ 	    struct vm_ubc_object* vop;
+ 	    vop = ubc_object_allocate(&vp, &ufs_ubcops,
+ 	                              vp->v_mount->m_funnel);
+ 	    VN_LOCK(vp);
+ 	    vp->v_object = vop;
+ 	    VN_UNLOCK(vp);
+ 	}
+     
+     
+     IN_LOCK(newip);
+     newip->i_flags |= IC_XUID|IC_XGID;
+     newip->i_flags &= ~IC_PROPLIST;
+     newip->i_vicep1 = param1;
+     if (param2 == 0x1fffffff/*INODESPECIAL*/)   {
+ 	newip->i_vicep2 = ((0x1fffffff << 3) + (param4 & 0x3));
+ 	newip->i_vicep3a = (u_short)(param3 >> 16);
+ 	newip->i_vicep3b = (u_short)param3;
+     } else {
+ 	newip->i_vicep2 = (((param2 >> 16) & 0x1f) << 27) +
+ 	    (((param4 >> 16) & 0x1f) << 22) + 
+ 	        (param3 & 0x3fffff);        
+ 	newip->i_vicep3a = (u_short)param4;
+ 	newip->i_vicep3b = (u_short)param2;
+     }
+     newip->i_vicemagic = VICEMAGIC;
+     
+     *retval = newip->i_number;
+     IN_UNLOCK(newip);
+     iput(newip);
+     return(code);
+ }
+ 
+ 
+ afs_syscall_iopen(dev, inode, usrmod, retval)
+      long *retval;
+      int dev, inode, usrmod;
+ {
+     struct file *fp;
+     struct inode *ip;
+     struct vnode *vp = (struct vnode *)0;
+     int dummy;
+     int fd;
+     extern struct fileops vnops;
+     register int code;
+     
+     AFS_STATCNT(afs_syscall_iopen);
+     
+     if (!afs_suser())
+ 	return(EPERM);
+ 
+     code = igetinode(0, (dev_t)dev, (ino_t)inode, &ip, &dummy);
+     if (code) {
+ 	return(code);
+     }
+     if ((code = falloc(&fp, &fd)) != 0) {
+ 	iput(ip);
+ 	return(code);
+     }
+     IN_UNLOCK(ip);
+     
+     FP_LOCK(fp);
+     fp->f_flag = (usrmod-FOPEN) & FMASK;
+     fp->f_type = DTYPE_VNODE;
+     fp->f_ops = &vnops;
+     fp->f_data = (caddr_t)ITOV(ip);
+     
+     FP_UNLOCK(fp);
+     U_FD_SET(fd, fp, &u.u_file_state);
+     *retval = fd;
+     return(0);
+ }
+ 
+ 
+ /*
+  * Support for iinc() and idec() system calls--increment or decrement
+  * count on inode.
+  * Restricted to super user.
+  * Only VICEMAGIC type inodes.
+  */
+ afs_syscall_iincdec(dev, inode, inode_p1, amount)
+      int dev, inode, inode_p1, amount;
+ {
+     int dummy;
+     struct inode *ip;
+     register int code;
+     
+     if (!afs_suser())
+ 	return(EPERM);
+ 
+     code = igetinode(0, (dev_t)dev, (ino_t)inode, &ip, &dummy);
+     if (code) {
+ 	return(code);
+     }
+     if (!IS_VICEMAGIC(ip)) {
+ 	return(EPERM);
+     } else if (ip->i_vicep1 != inode_p1) {
+ 	return(ENXIO);
+     }
+     ip->i_nlink += amount;
+     if (ip->i_nlink == 0) {
+ 	CLEAR_VICEMAGIC(ip);
+     }
+     ip->i_flag |= ICHG;
+     iput(ip);
+     return(0);
+ }
+ #else
+ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval)
+      long *retval;
+      long dev, near_inode, param1, param2, param3, param4;
+ {
+      return EOPNOTSUPP;
+ }
+ afs_syscall_iopen(dev, inode, usrmod, retval)
+      long *retval;
+      int dev, inode, usrmod;
+ {
+      return EOPNOTSUPP;
+ }
+ afs_syscall_iincdec(dev, inode, inode_p1, amount)
+      int dev, inode, inode_p1, amount;
+ {
+      return EOPNOTSUPP;
+ }
+ #endif
Index: openafs/src/afs/DARWIN/osi_inode.h
diff -c /dev/null openafs/src/afs/DARWIN/osi_inode.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_inode.h	Mon Apr 23 00:03:36 2001
***************
*** 0 ****
--- 1,42 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ /*
+  * osi_inode.h
+  *
+  * Inode information required for MACOS servers and salvager.
+  */
+ #ifndef _OSI_INODE_H_
+ #define _OSI_INODE_H_
+ 
+ #define BAD_IGET        -1000
+ 
+ #define VICEMAGIC       0x84fa1cb6
+ 
+ #define DI_VICEP3(p) ((p)->di_vicep3)
+ #define I_VICEP3(p) ((p)->i_vicep3)
+ 
+ #define i_vicemagic     i_din.di_flags
+ #define i_vicep1        i_din.di_gen
+ #define i_vicep2        i_din.di_uid
+ #define i_vicep3        i_din.di_gid
+ #define i_vicep4        i_din.di_spare[0]       /* not used */
+ 
+ #define di_vicemagic    di_flags
+ #define di_vicep1       di_gen
+ #define di_vicep2       di_uid
+ #define di_vicep3       di_gid
+ #define di_vicep4       di_spare[0]             /* not used */
+ 
+ #define  IS_VICEMAGIC(ip)        ((ip)->i_vicemagic == VICEMAGIC)
+ #define  IS_DVICEMAGIC(dp)       ((dp)->di_vicemagic == VICEMAGIC)
+ 
+ #define  CLEAR_VICEMAGIC(ip)     (ip)->i_vicemagic = 0
+ #define  CLEAR_DVICEMAGIC(dp)    (dp)->di_vicemagic = 0
+ 
+ #endif /* _OSI_INODE_H_ */
Index: openafs/src/afs/DARWIN/osi_machdep.h
diff -c /dev/null openafs/src/afs/DARWIN/osi_machdep.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_machdep.h	Mon Apr 23 00:03:37 2001
***************
*** 0 ****
--- 1,109 ----
+ /*
+  * 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
+  */
+ /*
+  *
+  * MACOS OSI header file. Extends afs_osi.h.
+  *
+  * afs_osi.h includes this file, which is the only way this file should
+  * be included in a source file. This file can redefine macros declared in
+  * afs_osi.h.
+  */
+ 
+ #ifndef _OSI_MACHDEP_H_
+ #define _OSI_MACHDEP_H_
+ 
+ #ifdef XAFS_DARWIN_ENV
+ #ifndef _MACH_ETAP_H_
+ #define _MACH_ETAP_H_
+ typedef unsigned short                  etap_event_t;
+ #endif
+ #endif
+ 
+ #include <sys/lock.h>
+ #include <kern/thread.h>
+ #include <sys/user.h>
+ 
+ #define getpid()                current_proc()->p_pid
+ #define getppid()               current_proc()->p_pptr->p_pid
+ #undef gop_lookupname
+ #define gop_lookupname osi_lookupname
+ 
+ #define FTRUNC 0
+ 
+ /* vcexcl - used only by afs_create */
+ enum vcexcl { EXCL, NONEXCL } ;
+ 
+ /* 
+  * Time related macros
+  */
+ extern struct timeval time;
+ #define osi_Time() (time.tv_sec)
+ #define afs_hz      hz
+ 
+ #define PAGESIZE 8192
+ 
+ #define AFS_UCRED       ucred
+ 
+ #define AFS_PROC        struct proc
+ 
+ #define osi_vnhold(avc,r)  do { \
+        if ((avc)->vrefCount) { VN_HOLD(&((avc)->v)); } \
+        else (avc)->vrefCount = 1;  } while(0)
+ 
+ #define gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
+   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid),current_proc())
+ 
+ #undef afs_suser
+ 
+ #ifdef KERNEL
+ extern thread_t afs_global_owner;
+ /* simple locks cannot be used since sleep can happen at any time */
+ /* Should probably use mach locks rather than bsd locks, since we use the
+    mach thread control api's elsewhere (mach locks not used for consistency
+    with rx, since rx needs lock_write_try() in order to use mach locks
+  */
+ extern struct lock__bsd__ afs_global_lock;
+ #define AFS_GLOCK() \
+     do { \
+         lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, current_proc()); \
+ 	osi_Assert(afs_global_owner == 0); \
+ 	afs_global_owner = current_thread(); \
+     } while (0)
+ #define AFS_GUNLOCK() \
+     do { \
+ 	osi_Assert(afs_global_owner == current_thread()); \
+ 	afs_global_owner = 0; \
+         lockmgr(&afs_global_lock, LK_RELEASE, 0, current_proc()); \
+     } while(0)
+ #define ISAFS_GLOCK() (afs_global_owner == current_thread())
+ #define AFS_RXGLOCK()
+ #define AFS_RXGUNLOCK()
+ #define ISAFS_RXGLOCK() 1
+ 
+ #define SPLVAR
+ #define NETPRI
+ #define USERPRI
+ #if 0
+ #undef SPLVAR
+ #define SPLVAR int x;
+ #undef NETPRI
+ #define NETPRI x=splnet();
+ #undef USERPRI
+ #define USERPRI splx(x);
+ #endif
+ 
+ #define AFS_APPL_UFS_CACHE 1
+ #define AFS_APPL_HFS_CACHE 2
+ 
+ extern ino_t VnodeToIno(vnode_t *vp);
+ extern dev_t VnodeToDev(vnode_t *vp);
+ 
+ #endif /* KERNEL */
+ 
+ #endif /* _OSI_MACHDEP_H_ */
Index: openafs/src/afs/DARWIN/osi_misc.c
diff -c /dev/null openafs/src/afs/DARWIN/osi_misc.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_misc.c	Mon Apr 23 00:03:37 2001
***************
*** 0 ****
--- 1,54 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #include "../afs/param.h"
+ #include "../afs/sysincludes.h"
+ #include "../afs/afsincludes.h"
+ #include <sys/namei.h>
+ 
+ int osi_lookupname(char *aname, enum uio_seg seg, int followlink,
+ 	                  struct vnode **dirvpp, struct vnode **vpp)
+ {
+    struct nameidata n;
+    int flags,error;
+    flags=0;
+    flags=LOCKLEAF;
+    if (followlink)
+      flags|=FOLLOW;
+    else 
+      flags|=NOFOLLOW;
+ /*   if (dirvpp) flags|=WANTPARENT;*/ /* XXX LOCKPARENT? */
+    NDINIT(&n, LOOKUP, flags, seg, aname, current_proc());
+    if (error=namei(&n))
+       return error;
+    *vpp=n.ni_vp;
+ /*
+    if (dirvpp)
+       *dirvpp = n.ni_dvp;
+ #/
+    /* should we do this? */
+    VOP_UNLOCK(n.ni_vp, 0, current_proc());
+    return 0;
+ }
+ 
+ /*
+  * afs_suser() returns true if the caller is superuser, false otherwise.
+  *
+  * Note that it must NOT set errno.
+  */
+ 
+ afs_suser() {
+     int error;
+     struct proc *p=current_proc();
+ 
+     if ((error = suser(p->p_ucred, &p->p_acflag)) == 0) {
+ 	return(1);
+     }
+     return(0);
+ }
Index: openafs/src/afs/DARWIN/osi_module.c
diff -c /dev/null openafs/src/afs/DARWIN/osi_module.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_module.c	Mon Apr 23 00:03:37 2001
***************
*** 0 ****
--- 1,58 ----
+ #include "../afs/param.h"
+ #include "../afs/sysincludes.h"
+ #include "../afs/afsincludes.h"
+ #include "../sys/syscall.h"
+ #include <mach/kmod.h>
+ #define VERSION "1.0.3"
+ 
+ 
+ struct vfsconf afs_vfsconf;
+ extern struct vfsops afs_vfsops;
+ extern struct mount *afs_globalVFS;
+ extern int Afs_xsetgroups();
+ extern int afs_xioctl();
+ extern int afs3_syscall();
+ 
+ extern int ioctl();
+ extern int setgroups();
+ kern_return_t afs_modload(struct kmod_info *ki, void *data)
+ {
+    if (sysent[AFS_SYSCALL].sy_call != nosys) {
+       printf("AFS_SYSCALL in use. aborting\n");
+       return KERN_FAILURE;
+    }
+    bzero(&afs_vfsconf, sizeof(struct vfsconf));
+    strcpy(afs_vfsconf.vfc_name, "afs");
+    afs_vfsconf.vfc_vfsops=&afs_vfsops;
+    afs_vfsconf.vfc_typenum=VT_AFS;
+    afs_vfsconf.vfc_flags=MNT_NODEV;
+    if (vfsconf_add(&afs_vfsconf)) {
+        printf("AFS: vfsconf_add failed. aborting\n"); 
+        return KERN_FAILURE;
+    }
+    sysent[SYS_setgroups].sy_call=Afs_xsetgroups;
+    sysent[SYS_ioctl].sy_call=afs_xioctl;
+    sysent[AFS_SYSCALL].sy_call=afs3_syscall;
+    sysent[AFS_SYSCALL].sy_narg = 5;
+    sysent[AFS_SYSCALL].sy_parallel = 0;
+ #ifdef KERNEL_FUNNEL
+    sysent[AFS_SYSCALL].sy_funnel=KERNEL_FUNNEL;
+ #endif
+    return KERN_SUCCESS;
+ }
+ kern_return_t afs_modunload(struct kmod_info *ki, void *data)
+ {
+    if (afs_globalVFS) 
+       return KERN_FAILURE;
+    if (vfsconf_del("afs"))
+       return KERN_FAILURE;
+    /* give up syscall entries for ioctl & setgroups, which we've stolen */
+    sysent[SYS_ioctl].sy_call = ioctl;
+    sysent[SYS_setgroups].sy_call = setgroups;
+    /* give up the stolen syscall entry */
+    sysent[AFS_SYSCALL].sy_narg = 0;
+    sysent[AFS_SYSCALL].sy_call = nosys;
+    return KERN_SUCCESS;
+  } 
+ 
+ KMOD_EXPLICIT_DECL(openafs, VERSION, afs_modload, afs_modunload)
Index: openafs/src/afs/DARWIN/osi_prototypes.h
diff -c /dev/null openafs/src/afs/DARWIN/osi_prototypes.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_prototypes.h	Mon Apr 23 00:03:38 2001
***************
*** 0 ****
--- 1,23 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ /*
+  * osi_prototypes.h
+  *
+  * Exported macos support routines.
+  */
+ #ifndef _OSI_PROTO_H_
+ #define _OSI_PROTO_H_
+ 
+ /* osi_misc.c */
+ extern int osi_lookupname(char *aname, enum uio_seg seg, int followlink,
+ 	                  struct vnode **dirvpp, struct vnode **vpp);
+ /* osi_vm.c */
+ extern void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size);
+ extern int osi_VM_Setup(struct vcache *avc);
+ #endif /* _OSI_PROTO_H_ */
Index: openafs/src/afs/DARWIN/osi_sleep.c
diff -c /dev/null openafs/src/afs/DARWIN/osi_sleep.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_sleep.c	Mon Apr 23 00:03:38 2001
***************
*** 0 ****
--- 1,186 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #include "../afs/param.h"       /* Should be always first */
+ #include "../afs/sysincludes.h" /* Standard vendor system headers */
+ #include "../afs/afsincludes.h" /* Afs-based standard headers */
+ #include "../afs/afs_stats.h"   /* afs statistics */
+ 
+ 
+ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
+ void afs_osi_Wakeup(char *event);
+ void afs_osi_Sleep(char *event);
+ 
+ static char waitV;
+ 
+ 
+ void afs_osi_InitWaitHandle(struct afs_osi_WaitHandle *achandle)
+ {
+     AFS_STATCNT(osi_InitWaitHandle);
+     achandle->proc = (caddr_t) 0;
+ }
+ 
+ /* cancel osi_Wait */
+ void afs_osi_CancelWait(struct afs_osi_WaitHandle *achandle)
+ {
+     caddr_t proc;
+ 
+     AFS_STATCNT(osi_CancelWait);
+     proc = achandle->proc;
+     if (proc == 0) return;
+     achandle->proc = (caddr_t) 0;   /* so dude can figure out he was signalled */
+     afs_osi_Wakeup(&waitV);
+ }
+ 
+ /* afs_osi_Wait
+  * Waits for data on ahandle, or ams ms later.  ahandle may be null.
+  * Returns 0 if timeout and EINTR if signalled.
+  */
+ int afs_osi_Wait(afs_int32 ams, struct afs_osi_WaitHandle *ahandle, int aintok)
+ {
+     int code;
+     afs_int32 endTime, tid;
+     struct proc *p=current_proc();
+ 
+     AFS_STATCNT(osi_Wait);
+     endTime = osi_Time() + (ams/1000);
+     if (ahandle)
+ 	ahandle->proc = (caddr_t)p;
+     do {
+ 	AFS_ASSERT_GLOCK();
+ 	code = 0;
+ 	code = osi_TimedSleep(&waitV, ams, aintok);
+ 
+ 	if (code) break;        /* if something happened, quit now */
+ 	/* if we we're cancelled, quit now */
+ 	if (ahandle && (ahandle->proc == (caddr_t) 0)) {
+ 	    /* we've been signalled */
+ 	    break;
+ 	}
+     } while (osi_Time() < endTime);
+     return code;
+ }
+ 
+ 
+ 
+ typedef struct afs_event {
+     struct afs_event *next;     /* next in hash chain */
+     char *event;                /* lwp event: an address */
+     int refcount;               /* Is it in use? */
+     int seq;                    /* Sequence number: this is incremented
+ 	                           by wakeup calls; wait will not return until
+ 	                           it changes */
+ } afs_event_t;
+ 
+ #define HASHSIZE 128
+ afs_event_t *afs_evhasht[HASHSIZE];/* Hash table for events */
+ #define afs_evhash(event)       (afs_uint32) ((((long)event)>>2) & (HASHSIZE-1));
+ int afs_evhashcnt = 0;
+ 
+ /* Get and initialize event structure corresponding to lwp event (i.e. address)
+  * */
+ static afs_event_t *afs_getevent(char *event)
+ {
+     afs_event_t *evp, *newp = 0;
+     int hashcode;
+ 
+     AFS_ASSERT_GLOCK();
+     hashcode = afs_evhash(event);
+     evp = afs_evhasht[hashcode];
+     while (evp) {
+ 	if (evp->event == event) {
+ 	    evp->refcount++;
+ 	    return evp;
+ 	}
+ 	if (evp->refcount == 0)
+ 	    newp = evp;
+ 	evp = evp->next;
+     }
+     if (!newp) {
+ 	newp = (afs_event_t *) osi_AllocSmallSpace(sizeof (afs_event_t));
+ 	afs_evhashcnt++;
+ 	newp->next = afs_evhasht[hashcode];
+ 	afs_evhasht[hashcode] = newp;
+ 	newp->seq = 0;
+     }
+     newp->event = event;
+     newp->refcount = 1;
+     return newp;
+ }
+ 
+ /* Release the specified event */
+ #define relevent(evp) ((evp)->refcount--)
+ 
+ 
+ void afs_osi_Sleep(char *event)
+ {
+     struct afs_event *evp;
+     int seq;
+ 
+     evp = afs_getevent(event);
+     seq = evp->seq;
+     while (seq == evp->seq) {
+ 	AFS_ASSERT_GLOCK();
+ 	assert_wait((event_t)event, 0);
+ 	AFS_GUNLOCK();
+ 	thread_block(0);
+ 	AFS_GLOCK();
+     }
+     relevent(evp);
+ }
+ 
+ /* osi_TimedSleep
+  * 
+  * Arguments:
+  * event - event to sleep on
+  * ams --- max sleep time in milliseconds
+  * aintok - 1 if should sleep interruptibly
+  *
+  * Returns 0 if timeout and EINTR if signalled.
+  */
+ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
+ {
+     int code = 0;
+     struct afs_event *evp;
+     int ticks,seq;
+ 
+     ticks = ( ams * afs_hz )/1000;
+ 
+ 
+     evp = afs_getevent(event);
+     seq=evp->seq;
+     assert_wait((event_t)event, aintok ? THREAD_ABORTSAFE : 0);
+     AFS_GUNLOCK();
+     thread_set_timer(ticks, NSEC_PER_SEC / hz);
+     thread_block(0);
+     AFS_GLOCK();
+ #if 0 /* thread_t structure only available if MACH_KERNEL_PRIVATE */
+     if (current_thread()->wait_result != THREAD_AWAKENED)
+ 	code = EINTR;
+ #else
+     if (seq == evp->seq)
+ 	code = EINTR;
+ #endif
+     
+     relevent(evp);
+     return code;
+ }
+ 
+ 
+ void afs_osi_Wakeup(char *event)
+ {
+     struct afs_event *evp;
+     
+     evp = afs_getevent(event);
+     if (evp->refcount > 1) {
+ 	evp->seq++;    
+ 	thread_wakeup((event_t)event);
+     }
+     relevent(evp);
+ }
Index: openafs/src/afs/DARWIN/osi_vfsops.c
diff -c /dev/null openafs/src/afs/DARWIN/osi_vfsops.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_vfsops.c	Mon Apr 23 00:03:38 2001
***************
*** 0 ****
--- 1,295 ----
+ #include <afs/param.h>  /* Should be always first */
+ #include <afs/sysincludes.h>            /* Standard vendor system headers */
+ #include <afs/afsincludes.h>            /* Afs-based standard headers */
+ #include <afs/afs_stats.h>              /* statistics */
+ #include <sys/malloc.h>
+ #include <sys/namei.h>
+ #include <sys/conf.h>
+ #include <sys/syscall.h>
+ 
+ struct vcache *afs_globalVp = 0;
+ struct mount *afs_globalVFS = 0;
+ 
+ int
+ afs_quotactl()
+ {
+ 	return EOPNOTSUPP;
+ }
+ 
+ int
+ afs_fhtovp(mp, fhp, vpp)
+ struct mount *mp;
+ struct fid *fhp;
+ struct vnode **vpp;
+ {
+ 
+ 	return (EINVAL);
+ }
+ 
+ int
+ afs_vptofh(vp, fhp)
+ struct vnode *vp;
+ struct fid *fhp;
+ {
+ 
+ 	return (EINVAL);
+ }
+ 
+ int
+ afs_start(mp, flags, p)
+ struct mount *mp;
+ int flags;
+ struct proc *p;
+ {
+     return (0);                         /* nothing to do. ? */
+ }
+ 
+ int
+ afs_mount(mp, path, data, ndp, p)
+ register struct mount *mp;
+ char *path;
+ caddr_t data;
+ struct nameidata *ndp;
+ struct proc *p;
+ {
+     /* ndp contains the mounted-from device.  Just ignore it.
+        we also don't care about our proc struct. */
+     size_t size;
+     int error;
+ 
+     if (mp->mnt_flag & MNT_UPDATE)
+ 	return EINVAL;
+ 
+     AFS_GLOCK();
+     AFS_STATCNT(afs_mount);
+ 
+     if (afs_globalVFS) { /* Don't allow remounts. */
+ 	AFS_GUNLOCK();
+ 	return (EBUSY);
+     }
+ 
+     afs_globalVFS = mp;
+     mp->vfs_bsize = 8192;
+     vfs_getnewfsid(mp);
+     mp->mnt_stat.f_iosize=8192;
+     
+     (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN-1, &size);
+     bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
+     bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
+     strcpy(mp->mnt_stat.f_mntfromname, "AFS");
+     /* null terminated string "AFS" will fit, just leave it be. */
+     strcpy(mp->mnt_stat.f_fstypename, "afs");
+     AFS_GUNLOCK();
+     (void) afs_statfs(mp, &mp->mnt_stat, p);
+     return 0;
+ }
+ 
+ int
+ afs_unmount(mp, flags, p)
+ struct mount *mp;
+ int flags;
+ struct proc *p;
+ {
+     
+     AFS_GLOCK();
+     AFS_STATCNT(afs_unmount);
+     afs_globalVFS = 0;
+     afs_shutdown();
+     AFS_GUNLOCK();
+ 
+     return 0;
+ }
+ 
+ int
+ afs_root(struct mount *mp,
+ 	      struct vnode **vpp)
+ {
+     int error;
+     struct vrequest treq;
+     register struct vcache *tvp=0;
+     struct proc *p=current_proc();
+     struct ucred cr;
+ 
+     pcred_readlock(p);
+     cr=*p->p_cred->pc_ucred;
+     pcred_unlock(p);
+     AFS_GLOCK();
+     AFS_STATCNT(afs_root);
+     if (afs_globalVp && (afs_globalVp->states & CStatd)) {
+ 	tvp = afs_globalVp;
+         error=0;
+     } else {
+ 	
+ 	if (!(error = afs_InitReq(&treq, &cr)) &&
+ 	    !(error = afs_CheckInit())) {
+ 	    tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
+ 	                        (struct vcache*)0, WRITE_LOCK);
+ 	    /* we really want this to stay around */
+ 	    if (tvp) {
+ 	        afs_globalVp = tvp;
+ 	    } else
+ 	        error = ENOENT;
+ 	}
+     }
+     if (tvp) {
+         osi_vnhold(tvp,0);
+     AFS_GUNLOCK();
+         vn_lock((struct vnode *)tvp, LK_EXCLUSIVE | LK_RETRY, p);
+     AFS_GLOCK();
+ 	afs_globalVFS = mp;
+ 	*vpp = (struct vnode *) tvp;
+         tvp->v.v_flag |= VROOT;
+     }
+ 
+     afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *vpp,
+ 	       ICL_TYPE_INT32, error);
+     AFS_GUNLOCK();
+     return error;
+ }
+ 
+ int
+ afs_vget(mp, lfl, vp)
+ struct mount *mp;
+ struct vnode *vp;
+ int lfl;
+ {
+     int error;
+     printf("vget called. help!\n");
+     if (vp->v_usecount < 0) {
+ 	vprint("bad usecount", vp);
+ 	panic("afs_vget");
+     }
+     error = vget(vp, lfl, current_proc());
+     if (!error)
+ 	insmntque(vp, afs_globalVFS);   /* take off free list */
+     return error;
+ }
+ 
+ int afs_statfs(struct mount *mp, struct statfs *abp, struct proc *p)
+ {
+     AFS_GLOCK();
+     AFS_STATCNT(afs_statfs);
+ 
+ #if 0
+     abp->f_type = MOUNT_AFS;
+ #endif
+     abp->f_bsize = mp->vfs_bsize;
+     abp->f_iosize = mp->vfs_bsize;
+ 
+     /* Fake a high number below to satisfy programs that use the statfs call
+      * to make sure that there's enough space in the device partition before
+      * storing something there.
+      */
+     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
+ 	abp->f_ffree  = 2000000;
+ 
+     abp->f_fsid.val[0] = mp->mnt_stat.f_fsid.val[0];
+     abp->f_fsid.val[1] = mp->mnt_stat.f_fsid.val[1];
+     if (abp != &mp->mnt_stat) {
+ 	abp->f_type = mp->mnt_vfc->vfc_typenum;
+ 	bcopy((caddr_t)mp->mnt_stat.f_mntonname,
+ 	      (caddr_t)&abp->f_mntonname[0], MNAMELEN);
+ 	bcopy((caddr_t)mp->mnt_stat.f_mntfromname,
+ 	      (caddr_t)&abp->f_mntfromname[0], MNAMELEN);
+     }
+ 
+     AFS_GUNLOCK();
+     return 0;
+ }
+ 
+ int afs_sync(mp, waitfor, cred, p) 
+ struct mount *mp;
+ int waitfor;
+ struct ucred *cred;
+ struct prioc *p;
+ {
+ return 0;
+ }
+ 
+ int afs_sysctl() {
+    return EOPNOTSUPP;
+ }
+ 
+ 
+ typedef (*PFI)();
+ extern int vfs_opv_numops; /* The total number of defined vnode operations */
+ extern struct vnodeopv_desc afs_vnodeop_opv_desc;
+ int afs_init(struct vfsconf *vfc) {
+         int j;
+         int (**opv_desc_vector)();
+         struct vnodeopv_entry_desc *opve_descp;
+  
+ 
+ 
+         MALLOC(afs_vnodeop_p, PFI *, vfs_opv_numops*sizeof(PFI), M_TEMP, M_WAITOK);
+ 
+         bzero (afs_vnodeop_p, vfs_opv_numops*sizeof(PFI));
+ 
+         opv_desc_vector = afs_vnodeop_p;
+         for (j=0; afs_vnodeop_opv_desc.opv_desc_ops[j].opve_op; j++) {
+             opve_descp = &(afs_vnodeop_opv_desc.opv_desc_ops[j]);
+ 
+             /*
+              * Sanity check:  is this operation listed
+              * in the list of operations?  We check this
+              * by seeing if its offest is zero.  Since
+              * the default routine should always be listed
+              * first, it should be the only one with a zero
+              * offset.  Any other operation with a zero
+              * offset is probably not listed in
+              * vfs_op_descs, and so is probably an error.
+              *
+              * A panic here means the layer programmer
+              * has committed the all-too common bug
+              * of adding a new operation to the layer's
+              * list of vnode operations but
+              * not adding the operation to the system-wide
+              * list of supported operations.
+              */
+             if (opve_descp->opve_op->vdesc_offset == 0 &&
+                 opve_descp->opve_op->vdesc_offset != VOFFSET(vop_default)) {
+                 printf("afs_init: operation %s not listed in %s.\n",
+                        opve_descp->opve_op->vdesc_name,
+                        "vfs_op_descs");
+                panic ("load_afs: bad operation");
+                 }
+             /*
+              * Fill in this entry.
+              */
+             opv_desc_vector[opve_descp->opve_op->vdesc_offset] =
+                 opve_descp->opve_impl;
+             }
+ 
+         /*
+          * Finally, go back and replace unfilled routines
+          * with their default.  (Sigh, an O(n^3) algorithm.  I
+                                  * could make it better, but that'd be work, and n is small.)
+          */
+ 
+         /*
+          * Force every operations vector to have a default routine.
+          */
+         opv_desc_vector = afs_vnodeop_p;
+         if (opv_desc_vector[VOFFSET(vop_default)]==NULL) {
+             panic("afs_init: operation vector without default routine.");
+             }
+         for (j = 0;j<vfs_opv_numops; j++)
+             if (opv_desc_vector[j] == NULL)
+                 opv_desc_vector[j] =
+                     opv_desc_vector[VOFFSET(vop_default)];
+ }
+ 
+ struct vfsops afs_vfsops = {
+   afs_mount,
+   afs_start,
+   afs_unmount,
+   afs_root,
+   afs_quotactl,
+   afs_statfs,
+   afs_sync,
+   afs_vget,
+   afs_fhtovp,
+   afs_vptofh,
+   afs_init,
+   afs_sysctl
+ };
Index: openafs/src/afs/DARWIN/osi_vm.c
diff -c /dev/null openafs/src/afs/DARWIN/osi_vm.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_vm.c	Mon Apr 23 00:03:38 2001
***************
*** 0 ****
--- 1,311 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #include "../afs/param.h"       /* Should be always first */
+ #include "../afs/sysincludes.h" /* Standard vendor system headers */
+ #include "../afs/afsincludes.h" /* Afs-based standard headers */
+ #include "../afs/afs_stats.h"  /* statistics */
+ #include <sys/ubc.h>
+ 
+ /* Try to discard pages, in order to recycle a vcache entry.
+  *
+  * We also make some sanity checks:  ref count, open count, held locks.
+  *
+  * We also do some non-VM-related chores, such as releasing the cred pointer
+  * (for AIX and Solaris) and releasing the gnode (for AIX).
+  *
+  * Locking:  afs_xvcache lock is held.  If it is dropped and re-acquired,
+  *   *slept should be set to warn the caller.
+  *
+  * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it
+  * is not dropped and re-acquired for any platform.  It may be that *slept is
+  * therefore obsolescent.
+  *
+  * OSF/1 Locking:  VN_LOCK has been called.
+  */
+ int
+ osi_VM_FlushVCache(avc, slept)
+     struct vcache *avc;
+     int *slept;
+ {
+     struct vnode *vp=(struct vnode *)avc;
+     if (avc->vrefCount)
+ 	return EBUSY;
+ 
+     if (avc->opens)
+ 	return EBUSY;
+ 
+     /* if a lock is held, give up */
+     if (CheckLock(&avc->lock) || afs_CheckBozonLock(&avc->pvnLock))
+ 	return EBUSY;
+ 
+     AFS_GUNLOCK();
+     cache_purge(vp);
+     if (UBCINFOEXISTS(vp))
+ 	{
+                 ubc_clean(vp, 1);
+                 ubc_uncache(vp);
+                 ubc_release(vp);
+ 	        ubc_info_free(vp);
+ 	}
+ 
+     AFS_GLOCK();
+ 
+     return 0;
+ }
+ 
+ 
+ /* Try to store pages to cache, in order to store a file back to the server.
+  *
+  * Locking:  the vcache entry's lock is held.  It will usually be dropped and
+  * re-obtained.
+  */
+ void
+ osi_VM_StoreAllSegments(avc)
+     struct vcache *avc;
+ {
+     struct vnode *vp=(struct vnode *)avc;
+     ReleaseWriteLock(&avc->lock);
+     AFS_GUNLOCK();
+     if (UBCINFOEXISTS(vp)) {
+ 	ubc_pushdirty(vp);
+     }
+     AFS_GLOCK();
+     ObtainWriteLock(&avc->lock,94);
+ }
+ 
+ /* Try to invalidate pages, for "fs flush" or "fs flushv"; or
+  * try to free pages, when deleting a file.
+  *
+  * Locking:  the vcache entry's lock is held.  It may be dropped and 
+  * re-obtained.
+  *
+  * Since we drop and re-obtain the lock, we can't guarantee that there won't
+  * be some pages around when we return, newly created by concurrent activity.
+  */
+ void
+ osi_VM_TryToSmush(avc, acred, sync)
+     struct vcache *avc;
+     struct AFS_UCRED *acred;
+     int sync;
+ {
+     struct vnode *vp=(struct vnode *)avc;
+     void *object;
+     kern_return_t kret;
+     off_t size, lastpg;
+     
+     ReleaseWriteLock(&avc->lock);
+     AFS_GUNLOCK();
+     if (UBCINFOEXISTS(vp))  {
+         size=ubc_getsize(vp);
+         kret=ubc_invalidate(vp,0,size); 
+         if (kret != 1) /* should be KERN_SUCCESS */
+             printf("TryToSmush: invalidate failed (error = %d)\n", kret);
+     }
+     AFS_GLOCK();
+     ObtainWriteLock(&avc->lock,59);
+ }
+ 
+ /* Purge VM for a file when its callback is revoked.
+  *
+  * Locking:  No lock is held, not even the global lock.
+  */
+ /* XXX this seems to not be referenced anywhere. *somebody* ought to be calling
+    this, and also making sure that ubc's idea of the filesize is right more
+    often */
+ void
+ osi_VM_FlushPages(avc, credp)
+     struct vcache *avc;
+     struct AFS_UCRED *credp;
+ {
+     struct vnode *vp=(struct vnode *)avc;
+     void *object;
+     kern_return_t kret;
+     off_t size;
+     if (UBCINFOEXISTS(vp))  {
+         size=ubc_getsize(vp);
+         kret=ubc_invalidate(vp,0,size);
+         if (kret != 1) /* Should be KERN_SUCCESS */
+           printf("VMFlushPages: invalidate failed (error = %d)\n", kret);
+         /* XXX what about when not CStatd */
+         if (avc->states & CStatd && size != avc->m.Length) 
+             ubc_setsize(vp, avc->m.Length);
+     }
+ }
+ 
+ /* Purge pages beyond end-of-file, when truncating a file.
+  *
+  * Locking:  no lock is held, not even the global lock.
+  * activeV is raised.  This is supposed to block pageins, but at present
+  * it only works on Solaris.
+  */
+ void
+ osi_VM_Truncate(avc, alen, acred)
+     struct vcache *avc;
+     int alen;
+     struct AFS_UCRED *acred;
+ {
+     struct vnode *vp=(struct vnode *)avc;
+     if (UBCINFOEXISTS(vp))  {
+ 	ubc_setsize(vp, alen);
+     }
+ }
+ 
+ extern struct  AFS_UCRED afs_osi_cred;
+ extern afs_rwlock_t afs_xvcache;
+ /* vnreclaim and vinactive are probably not aggressive enough to keep
+    enough afs vcaches free, so we try to do some of it ourselves */
+ /* XXX there's probably not nearly enough locking here */
+ void osi_VM_TryReclaim(avc, slept)
+      struct vcache *avc;
+      int *slept;
+ {
+     struct proc *p=current_proc();
+     struct vnode *vp=(struct vnode *)avc;
+     void *obj;
+ 
+     if (slept)
+        *slept=0;
+     VN_HOLD(vp); /* remove from inactive list */
+     if (!simple_lock_try(&vp->v_interlock)) {
+         AFS_RELE(vp);
+         return;
+     }
+     if (!UBCINFOEXISTS(vp) || vp->v_count != 2) {
+         simple_unlock(&vp->v_interlock);
+         AFS_RELE(vp);
+         return;
+     }
+     if (vp->v_ubcinfo->ui_holdcnt) {
+         simple_unlock(&vp->v_interlock);
+         AFS_RELE(vp);
+         return;
+     }
+     if (slept && ubc_issetflags(vp, UI_WASMAPPED)) {
+        /* We can't possibly release this in time for this NewVCache to get it */
+         simple_unlock(&vp->v_interlock);
+         AFS_RELE(vp);
+         return;
+     }
+ 
+     vp->v_usecount--; /* we want the usecount to be 1 */
+ 
+     if (slept) {
+         ReleaseWriteLock(&afs_xvcache);
+         *slept=1;
+     } else
+         ReleaseReadLock(&afs_xvcache);
+     AFS_GUNLOCK();
+     obj=0;
+     if (ubc_issetflags(vp, UI_WASMAPPED)) {
+         simple_unlock(&vp->v_interlock);
+         ubc_release(vp);
+         if (ubc_issetflags(vp, UI_HASOBJREF))
+             printf("ubc_release didn't release the reference?!\n");
+     } else if (!vn_lock(vp, LK_EXCLUSIVE|LK_INTERLOCK,current_proc())) {
+ #ifdef UBC_NOREACTIVATE
+         obj = ubc_getobject(vp,(UBC_NOREACTIVATE|UBC_HOLDOBJECT));
+ #else
+         obj = ubc_getobject(vp);
+ #endif
+         (void)ubc_clean(vp, 1);
+         vinvalbuf(vp, V_SAVE, &afs_osi_cred, p, 0, 0);
+         if (vp->v_usecount == 1)
+            VOP_INACTIVE(vp, p);
+         else
+            VOP_UNLOCK(vp, 0, p);
+         if (ISSET(vp->v_flag, VTERMINATE))
+             panic("afs_vnreclaim: already teminating");
+         SET(vp->v_flag, VTERMINATE);
+         memory_object_destroy(obj, 0);
+         while (ISSET(vp->v_flag, VTERMINATE)) {
+               SET(vp->v_flag, VTERMWANT);
+               tsleep((caddr_t)&vp->v_ubcinfo, PINOD, "afs_vnreclaim", 0);
+         }
+    } else {
+         if (simple_lock_try(&vp->v_interlock))
+             panic("afs_vnreclaim: slept, but did no work :(");
+         if (UBCINFOEXISTS(vp) && vp->v_count == 1) {
+            vp->v_usecount++;
+            simple_unlock(&vp->v_interlock);
+            AFS_RELE(vp);
+         } else 
+            simple_unlock(&vp->v_interlock);
+    }
+    AFS_GLOCK();
+    if (slept)
+       ObtainWriteLock(&afs_xvcache,175);
+    else
+       ObtainReadLock(&afs_xvcache);
+ }
+ 
+ void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size) {
+ 
+     void *object;
+     struct vcache *avc = (struct vcache *)vp;
+ 
+     object=NULL;
+ #ifdef UBC_NOREACTIVATE
+     if (UBCINFOEXISTS(vp))
+         object = ubc_getobject(vp, UBC_NOREACTIVATE);
+ #else
+     if (UBCINFOEXISTS(vp))
+         object = ubc_getobject(vp);
+ #endif
+     if (!object)
+         return;
+ 
+     offset=trunc_page(offset);
+     size=round_page(size+1);
+ 
+ #ifdef UBC_NOREACTIVATE
+     while (size) {
+         memory_object_page_op(object, (vm_offset_t)offset, 
+                               UPL_POP_SET | UPL_POP_BUSY | UPL_POP_DUMP,
+                               0, 0);
+         size-=PAGE_SIZE;
+         offset+=PAGE_SIZE;
+     }
+ #else 
+     ubc_setsize(vp, offset);
+     size=(offset + size > avc->m.Length) ? offset + size : avc->m.Length;
+     ubc_setsize(vp, size);
+ #endif
+ 
+ }
+ int osi_VM_Setup(struct vcache *avc) {
+    int error;
+    struct vnode *vp=(struct vnode *)avc;
+ 
+    if (UBCISVALID(vp) && (avc->states & CStatd)) {
+       if (!UBCINFOEXISTS(vp) && !ISSET(vp->v_flag, VTERMINATE)) {
+          osi_vnhold(avc,0);  
+          AFS_GUNLOCK();
+          if ((error=ubc_info_init(&avc->v)))  {
+              AFS_GLOCK();
+              AFS_RELE(avc);
+              return error;
+          }
+          simple_lock(&avc->v.v_interlock);
+          if (!ubc_issetflags(&avc->v, UI_HASOBJREF))
+ #ifdef UBC_NOREACTIVATE
+             if (ubc_getobject(&avc->v, (UBC_NOREACTIVATE|UBC_HOLDOBJECT)))
+                    panic("VM_Setup: null object");
+ #else
+             (void)_ubc_getobject(&avc->v, 1); /* return value not used */
+ #endif
+          simple_unlock(&avc->v.v_interlock);
+          AFS_GLOCK();
+          AFS_RELE(avc);
+       }
+       if (UBCINFOEXISTS(&avc->v))
+           ubc_setsize(&avc->v, avc->m.Length);
+    }
+    return 0;
+ }
Index: openafs/src/afs/DARWIN/osi_vnodeops.c
diff -c /dev/null openafs/src/afs/DARWIN/osi_vnodeops.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:10 2001
--- openafs/src/afs/DARWIN/osi_vnodeops.c	Mon Apr 23 00:03:39 2001
***************
*** 0 ****
--- 1,1359 ----
+ #include <afs/param.h>  /* Should be always first */
+ #include <afs/sysincludes.h>            /* Standard vendor system headers */
+ #include <afs/afsincludes.h>            /* Afs-based standard headers */
+ #include <afs/afs_stats.h>              /* statistics */
+ #include <sys/malloc.h>
+ #include <sys/namei.h>
+ #include <sys/ubc.h>
+ 
+ int afs_vop_lookup(struct vop_lookup_args *);
+ int afs_vop_create(struct vop_create_args *);
+ int afs_vop_mknod(struct vop_mknod_args *);
+ int afs_vop_open(struct vop_open_args *);
+ int afs_vop_close(struct vop_close_args *);
+ int afs_vop_access(struct vop_access_args *);
+ int afs_vop_getattr(struct vop_getattr_args *);
+ int afs_vop_setattr(struct vop_setattr_args *);
+ int afs_vop_read(struct vop_read_args *);
+ int afs_vop_write(struct vop_write_args *);
+ int afs_vop_pagein(struct vop_pagein_args *);
+ int afs_vop_pageout(struct vop_pageout_args *);
+ int afs_vop_ioctl(struct vop_ioctl_args *);
+ int afs_vop_select(struct vop_select_args *);
+ int afs_vop_mmap(struct vop_mmap_args *);
+ int afs_vop_fsync(struct vop_fsync_args *);
+ int afs_vop_seek(struct vop_seek_args *);
+ int afs_vop_remove(struct vop_remove_args *);
+ int afs_vop_link(struct vop_link_args *);
+ int afs_vop_rename(struct vop_rename_args *);
+ int afs_vop_mkdir(struct vop_mkdir_args *);
+ int afs_vop_rmdir(struct vop_rmdir_args *);
+ int afs_vop_symlink(struct vop_symlink_args *);
+ int afs_vop_readdir(struct vop_readdir_args *);
+ int afs_vop_readlink(struct vop_readlink_args *);
+ extern int ufs_abortop(struct vop_abortop_args *);
+ int afs_vop_inactive(struct vop_inactive_args *);
+ int afs_vop_reclaim(struct vop_reclaim_args *);
+ int afs_vop_lock(struct vop_lock_args *);
+ int afs_vop_unlock(struct vop_unlock_args *);
+ int afs_vop_bmap(struct vop_bmap_args *);
+ int afs_vop_strategy(struct vop_strategy_args *);
+ int afs_vop_print(struct vop_print_args *);
+ int afs_vop_islocked(struct vop_islocked_args *);
+ int afs_vop_pathconf(struct vop_pathconf_args *);
+ int afs_vop_advlock(struct vop_advlock_args *);
+ int afs_vop_truncate(struct vop_truncate_args *);
+ int afs_vop_update(struct vop_update_args *);
+ int afs_vop_blktooff __P((struct vop_blktooff_args *));
+ int afs_vop_offtoblk __P((struct vop_offtoblk_args *));
+ int afs_vop_cmap __P((struct vop_cmap_args *));
+ 
+ 
+ #define afs_vop_opnotsupp \
+ 	((int (*) __P((struct  vop_reallocblks_args *)))eopnotsupp)
+ #define afs_vop_valloc afs_vop_opnotsupp
+ #define afs_vop_vfree afs_vop_opnotsupp
+ #define afs_vop_blkatoff afs_vop_opnotsupp
+ #define afs_vop_reallocblks afs_vop_opnotsupp
+ 
+ /* Global vfs data structures for AFS. */
+ int (**afs_vnodeop_p)();
+ struct vnodeopv_entry_desc afs_vnodeop_entries[] = {
+ 	{ &vop_default_desc, vn_default_error },
+ 	{ &vop_lookup_desc, afs_vop_lookup },          /* lookup */
+ 	{ &vop_create_desc, afs_vop_create },          /* create */
+ 	{ &vop_mknod_desc, afs_vop_mknod },            /* mknod */
+ 	{ &vop_open_desc, afs_vop_open },              /* open */
+ 	{ &vop_close_desc, afs_vop_close },            /* close */
+ 	{ &vop_access_desc, afs_vop_access },          /* access */
+ 	{ &vop_getattr_desc, afs_vop_getattr },        /* getattr */
+ 	{ &vop_setattr_desc, afs_vop_setattr },        /* setattr */
+ 	{ &vop_read_desc, afs_vop_read },              /* read */
+ 	{ &vop_write_desc, afs_vop_write },            /* write */
+ 	{ &vop_pagein_desc, afs_vop_pagein },              /* read */
+ 	{ &vop_pageout_desc, afs_vop_pageout },            /* write */
+ 	{ &vop_ioctl_desc, afs_vop_ioctl }, /* XXX ioctl */
+ 	{ &vop_select_desc, afs_vop_select },          /* select */
+ 	{ &vop_mmap_desc, afs_vop_mmap },              /* mmap */
+ 	{ &vop_fsync_desc, afs_vop_fsync },            /* fsync */
+ 	{ &vop_seek_desc, afs_vop_seek },              /* seek */
+ 	{ &vop_remove_desc, afs_vop_remove },          /* remove */
+ 	{ &vop_link_desc, afs_vop_link },              /* link */
+ 	{ &vop_rename_desc, afs_vop_rename },          /* rename */
+ 	{ &vop_mkdir_desc, afs_vop_mkdir },            /* mkdir */
+ 	{ &vop_rmdir_desc, afs_vop_rmdir },            /* rmdir */
+ 	{ &vop_symlink_desc, afs_vop_symlink },        /* symlink */
+ 	{ &vop_readdir_desc, afs_vop_readdir },        /* readdir */
+ 	{ &vop_readlink_desc, afs_vop_readlink },      /* readlink */
+ 	/* Yes, we use the ufs_abortop call.  It just releases the namei
+ 	   buffer stuff */
+ 	{ &vop_abortop_desc, ufs_abortop },             /* abortop */
+ 	{ &vop_inactive_desc, afs_vop_inactive },      /* inactive */
+ 	{ &vop_reclaim_desc, afs_vop_reclaim },        /* reclaim */
+ 	{ &vop_lock_desc, afs_vop_lock },              /* lock */
+ 	{ &vop_unlock_desc, afs_vop_unlock },          /* unlock */
+ 	{ &vop_bmap_desc, afs_vop_bmap },              /* bmap */
+ 	{ &vop_strategy_desc, afs_vop_strategy },      /* strategy */
+ 	{ &vop_print_desc, afs_vop_print },            /* print */
+ 	{ &vop_islocked_desc, afs_vop_islocked },      /* islocked */
+ 	{ &vop_pathconf_desc, afs_vop_pathconf },      /* pathconf */
+ 	{ &vop_advlock_desc, afs_vop_advlock },        /* advlock */
+ 	{ &vop_blkatoff_desc, afs_vop_blkatoff },      /* blkatoff */
+ 	{ &vop_valloc_desc, afs_vop_valloc },          /* valloc */
+ 	{ &vop_reallocblks_desc, afs_vop_reallocblks }, /* reallocblks */
+ 	{ &vop_vfree_desc, afs_vop_vfree },            /* vfree */
+ 	{ &vop_truncate_desc, afs_vop_truncate },      /* truncate */
+ 	{ &vop_update_desc, afs_vop_update },          /* update */
+ 	{ &vop_blktooff_desc, afs_vop_blktooff },           /* blktooff */
+ 	{ &vop_offtoblk_desc, afs_vop_offtoblk },           /* offtoblk */
+ 	{ &vop_cmap_desc, afs_vop_cmap },           /* cmap */
+ 	{ &vop_bwrite_desc, vn_bwrite },
+ 	{ (struct vnodeop_desc*)NULL, (int(*)())NULL }
+ };
+ struct vnodeopv_desc afs_vnodeop_opv_desc =
+ 	{ &afs_vnodeop_p, afs_vnodeop_entries };
+ 
+ #define GETNAME()       \
+     struct componentname *cnp = ap->a_cnp; \
+     char *name; \
+     MALLOC(name, char *, cnp->cn_namelen+1, M_TEMP, M_WAITOK); \
+     bcopy(cnp->cn_nameptr, name, cnp->cn_namelen); \
+     name[cnp->cn_namelen] = '\0'
+ 
+ #define DROPNAME() FREE(name, M_TEMP)
+ 	
+ 
+ 
+ int
+ afs_vop_lookup(ap)
+ struct vop_lookup_args /* {
+ 	                  struct vnodeop_desc * a_desc;
+ 	                  struct vnode *a_dvp;
+ 	                  struct vnode **a_vpp;
+ 	                  struct componentname *a_cnp;
+ 	                  } */ *ap;
+ {
+     int error;
+     struct vcache *vcp;
+     struct vnode *vp, *dvp;
+     register int flags = ap->a_cnp->cn_flags;
+     int lockparent;                     /* 1 => lockparent flag is set */
+     int wantparent;                     /* 1 => wantparent or lockparent flag */
+     struct proc *p;
+     GETNAME();
+     p=cnp->cn_proc;
+     lockparent = flags & LOCKPARENT;
+     wantparent = flags & (LOCKPARENT|WANTPARENT);
+ 
+     if (ap->a_dvp->v_type != VDIR) {
+ 	*ap->a_vpp = 0;
+ 	DROPNAME();
+ 	return ENOTDIR;
+     }
+     dvp = ap->a_dvp;
+     if (flags & ISDOTDOT) 
+        VOP_UNLOCK(dvp, 0, p);
+     AFS_GLOCK();
+     error = afs_lookup((struct vcache *)dvp, name, &vcp, cnp->cn_cred);
+     AFS_GUNLOCK();
+     if (error) {
+         if (flags & ISDOTDOT) 
+            VOP_LOCK(dvp, LK_EXCLUSIVE | LK_RETRY, p);
+ 	if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) &&
+ 	    (flags & ISLASTCN) && error == ENOENT)
+ 	    error = EJUSTRETURN;
+ 	if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))
+ 	    cnp->cn_flags |= SAVENAME;
+ 	DROPNAME();
+ 	*ap->a_vpp = 0;
+ 	return (error);
+     }
+     vp = (struct vnode *)vcp;  /* always get a node if no error */
+ 
+     /* The parent directory comes in locked.  We unlock it on return
+        unless the caller wants it left locked.
+        we also always return the vnode locked. */
+ 
+     if (flags & ISDOTDOT) {
+ 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+         /* always return the child locked */
+         if (lockparent && (flags & ISLASTCN) &&
+            (error = vn_lock(dvp, LK_EXCLUSIVE, p))) {
+             vput(vp);
+             DROPNAME();
+             return (error);
+         }
+     } else if (vp == dvp) {
+ 	/* they're the same; afs_lookup() already ref'ed the leaf.
+ 	   It came in locked, so we don't need to ref OR lock it */
+     } else {
+ 	if (!lockparent || !(flags & ISLASTCN))
+ 	    VOP_UNLOCK(dvp, 0, p);         /* done with parent. */
+ 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+         /* always return the child locked */
+     }
+     *ap->a_vpp = vp;
+ 
+     if ((cnp->cn_nameiop == RENAME && wantparent && (flags & ISLASTCN) ||
+ 	 (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))))
+ 	cnp->cn_flags |= SAVENAME;
+ 
+     DROPNAME();
+     return error;
+ }
+ 
+ int
+ afs_vop_create(ap)
+ 	struct vop_create_args /* {
+ 	        struct vnode *a_dvp;
+ 	        struct vnode **a_vpp;
+ 	        struct componentname *a_cnp;
+ 	        struct vattr *a_vap;
+ 	} */ *ap;
+ {
+     int error = 0;
+     struct vcache *vcp;
+     register struct vnode *dvp = ap->a_dvp;
+     struct proc *p;
+     GETNAME();
+     p=cnp->cn_proc;
+ 
+     /* vnode layer handles excl/nonexcl */
+     AFS_GLOCK();
+     error = afs_create((struct vcache *)dvp, name, ap->a_vap, NONEXCL,
+ 	               ap->a_vap->va_mode, &vcp,
+ 	               cnp->cn_cred);
+     AFS_GUNLOCK();
+     if (error) {
+ 	VOP_ABORTOP(dvp, cnp);
+ 	vput(dvp);
+ 	DROPNAME();
+ 	return(error);
+     }
+ 
+     if (vcp) {
+ 	*ap->a_vpp = (struct vnode *)vcp;
+ 	vn_lock((struct vnode *)vcp, LK_EXCLUSIVE| LK_RETRY, p);
+         if (UBCINFOMISSING((struct vnode *)vcp) ||
+             UBCINFORECLAIMED((struct vnode *)vcp))
+                 ubc_info_init((struct vnode *)vcp);
+     }
+     else *ap->a_vpp = 0;
+ 
+     if ((cnp->cn_flags & SAVESTART) == 0)
+ 	FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
+     vput(dvp);
+     DROPNAME();
+     return error;
+ }
+ 
+ int
+ afs_vop_mknod(ap)
+ 	struct vop_mknod_args /* {
+ 	        struct vnode *a_dvp;
+ 	        struct vnode **a_vpp;
+ 	        struct componentname *a_cnp;
+ 	        struct vattr *a_vap;
+ 	} */ *ap;
+ {
+     FREE_ZONE(ap->a_cnp->cn_pnbuf, ap->a_cnp->cn_pnlen, M_NAMEI);
+     vput(ap->a_dvp);
+     return(ENODEV);
+ }
+ 
+ int
+ afs_vop_open(ap)
+ 	struct vop_open_args /* {
+ 	        struct vnode *a_vp;
+ 	        int  a_mode;
+ 	        struct ucred *a_cred;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+     int error;
+     struct vcache *vc = (struct vcache *)ap->a_vp;
+     AFS_GLOCK();
+     error = afs_open(&vc, ap->a_mode, ap->a_cred);
+ #ifdef DIAGNOSTIC
+     if ((struct vnode *)vc != ap->a_vp)
+ 	panic("AFS open changed vnode!");
+ #endif
+     afs_BozonLock(&vc->pvnLock, vc);
+     osi_FlushPages(vc);
+     afs_BozonUnlock(&vc->pvnLock, vc);
+     AFS_GUNLOCK();
+     return error;
+ }
+ 
+ int
+ afs_vop_close(ap)
+ 	struct vop_close_args /* {
+ 	        struct vnode *a_vp;
+ 	        int  a_fflag;
+ 	        struct ucred *a_cred;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+     int code;
+     struct vcache *avc=ap->a_vp;
+     AFS_GLOCK();
+     if (ap->a_cred) 
+         code=afs_close(avc, ap->a_fflag, ap->a_cred, ap->a_p);
+     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();
+     return code;
+ }
+ 
+ int
+ afs_vop_access(ap)
+ 	struct vop_access_args /* {
+ 	        struct vnode *a_vp;
+ 	        int  a_mode;
+ 	        struct ucred *a_cred;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+     int code;
+     AFS_GLOCK();
+     code=afs_access((struct vcache *)ap->a_vp, ap->a_mode, ap->a_cred);
+     AFS_GUNLOCK();
+     return code;
+ }
+ int
+ afs_vop_getattr(ap)
+ 	struct vop_getattr_args /* {
+ 	        struct vnode *a_vp;
+ 	        struct vattr *a_vap;
+ 	        struct ucred *a_cred;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+     int code;
+     AFS_GLOCK();
+     code=afs_getattr((struct vcache *)ap->a_vp, ap->a_vap, ap->a_cred);
+     AFS_GUNLOCK();
+     return code;
+ }
+ int
+ afs_vop_setattr(ap)
+ 	struct vop_setattr_args /* {
+ 	        struct vnode *a_vp;
+ 	        struct vattr *a_vap;
+ 	        struct ucred *a_cred;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+     int code;
+     AFS_GLOCK();
+     code=afs_setattr((struct vcache *)ap->a_vp, ap->a_vap, ap->a_cred);
+     AFS_GUNLOCK();
+     return code;
+ }
+ int
+ afs_vop_read(ap)
+ 	struct vop_read_args /* {
+ 	        struct vnode *a_vp;
+ 	        struct uio *a_uio;
+ 	        int a_ioflag;
+ 	        struct ucred *a_cred;
+ 	} */ *ap;
+ {
+     int code;
+     struct vcache *avc=(struct vcache *)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();
+     return code;
+ }
+ int
+ afs_vop_pagein(ap)
+ 	struct vop_pagein_args /* {
+ 	        struct vnode *a_vp;
+         	upl_t a_pl;
+         	vm_offset_t a_pl_offset;
+         	off_t a_f_offset;
+         	size_t a_size;
+         	struct ucred *a_cred;
+         	int a_flags;
+ 	} */ *ap;
+ {
+     register struct vnode *vp = ap->a_vp;
+     upl_t pl = ap->a_pl;
+     size_t size= ap->a_size;
+     off_t f_offset = ap->a_f_offset;
+     vm_offset_t pl_offset = ap->a_pl_offset;
+     int flags  = ap->a_flags;
+     struct ucred *cred;
+     vm_offset_t ioaddr;
+     struct uio      auio;
+     struct iovec    aiov;
+     struct uio * uio = &auio;
+     int nocommit = flags & UPL_NOCOMMIT;
+ 
+     int code;
+     struct vcache *tvc=(struct vcache *)vp;
+ 
+     if (UBCINVALID(vp)) {
+ #if DIAGNOSTIC
+         panic("afs_vop_pagein: invalid vp");
+ #endif /* DIAGNOSTIC */
+         return (EPERM);
+     }
+ 
+     UBCINFOCHECK("afs_vop_pagein", vp);
+     if(pl == (upl_t)NULL) {
+             panic("afs_vop_pagein: no upl");
+     }
+ 
+     cred = ubc_getcred(vp);
+     if (cred == NOCRED)
+         cred = ap->a_cred;
+ 
+     if (size == 0) {
+             if (!nocommit)
+                     kernel_upl_abort_range(pl, pl_offset, size, 
+                             UPL_ABORT_ERROR |  UPL_ABORT_FREE_ON_EMPTY);
+             return (0);
+     }
+     if (f_offset < 0) {
+             if (!nocommit)
+                     kernel_upl_abort_range(pl, pl_offset, size, 
+                             UPL_ABORT_ERROR | UPL_ABORT_FREE_ON_EMPTY);
+             return (EINVAL);
+     }
+     if (f_offset & PAGE_MASK)
+             panic("afs_vop_pagein: offset not page aligned");
+ 
+     auio.uio_iov = &aiov;
+     auio.uio_iovcnt = 1;
+     auio.uio_offset = f_offset;
+     auio.uio_segflg = UIO_SYSSPACE;
+     auio.uio_rw = UIO_READ;
+     auio.uio_procp = NULL;
+     kernel_upl_map(kernel_map, pl, &ioaddr);
+     ioaddr += pl_offset;
+     auio.uio_resid = aiov.iov_len = size;
+     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);
+       tvc->states |= CMAPPED;
+       ReleaseWriteLock(&tvc->lock);
+     }
+     afs_BozonUnlock(&tvc->pvnLock, tvc);
+     AFS_GUNLOCK();
+     kernel_upl_unmap(kernel_map, pl);
+     if (!nocommit) {
+       if (code)
+ 	 kernel_upl_abort_range(pl, pl_offset, size, 
+ 			 UPL_ABORT_ERROR |  UPL_ABORT_FREE_ON_EMPTY);
+       else
+          kernel_upl_commit_range(pl, pl_offset, size,
+                           UPL_COMMIT_CLEAR_DIRTY | UPL_COMMIT_FREE_ON_EMPTY,
+                           UPL_GET_INTERNAL_PAGE_LIST(pl), MAX_UPL_TRANSFER);
+     }
+     return code;
+ }
+ 
+ int
+ afs_vop_write(ap)
+ 	struct vop_write_args /* {
+ 	        struct vnode *a_vp;
+ 	        struct uio *a_uio;
+ 	        int a_ioflag;
+ 	        struct ucred *a_cred;
+ 	} */ *ap;
+ {
+     int code;
+     struct vcache *avc=(struct vcache *)ap->a_vp;
+     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))
+        osi_VM_NukePages(ap->a_vp, ap->a_uio->uio_offset, ap->a_uio->uio_resid);
+     code=afs_write((struct vcache *)ap->a_vp, ap->a_uio, ap->a_ioflag, ap->a_cred, 0);
+     afs_BozonUnlock(&avc->pvnLock, avc);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ int
+ afs_vop_pageout(ap)
+ 	struct vop_pageout_args /* {
+ 	        struct vnode *a_vp;
+                 upl_t   a_pl,
+                 vm_offset_t   a_pl_offset,
+                 off_t         a_f_offset,
+                 size_t        a_size,
+                 struct ucred *a_cred,
+                 int           a_flags
+ 	} */ *ap;
+ {
+     register struct vnode *vp = ap->a_vp;
+     upl_t pl = ap->a_pl;
+     size_t size= ap->a_size;
+     off_t f_offset = ap->a_f_offset;
+     vm_offset_t pl_offset = ap->a_pl_offset;
+     int flags  = ap->a_flags;
+     struct ucred *cred;
+     vm_offset_t ioaddr;
+     struct uio      auio;
+     struct iovec    aiov;
+     struct uio * uio = &auio;
+     int nocommit = flags & UPL_NOCOMMIT;
+ 
+     int code;
+     struct vcache *tvc=(struct vcache *)vp;
+ 
+     if (UBCINVALID(vp)) {
+ #if DIAGNOSTIC
+         panic("afs_vop_pageout: invalid vp");
+ #endif /* DIAGNOSTIC */
+         return (EPERM);
+     }
+ 
+     UBCINFOCHECK("afs_vop_pageout", vp);
+     if(pl == (upl_t)NULL) {
+             panic("afs_vop_pageout: no upl");
+     }
+ #if 1
+     { int lbn, iosize, s;
+       struct buf *bp;
+       int biosize = DEV_BSIZE;
+ 
+       lbn = f_offset / DEV_BSIZE;
+ 
+         for (iosize = size; iosize > 0; iosize -= biosize, lbn++) {
+ 
+                 s = splbio();
+                 if (bp = incore(vp, lbn)) {
+                         if (ISSET(bp->b_flags, B_BUSY))
+                                 panic("nfs_pageout: found BUSY buffer incore\n")
+ ;
+                         
+                         bremfree(bp);
+                         SET(bp->b_flags, (B_BUSY | B_INVAL));
+                         brelse(bp);
+                 }
+                 splx(s);
+         }
+     }
+ #endif
+     cred = ubc_getcred(vp);
+     if (cred == NOCRED)
+         cred = ap->a_cred;
+ 
+     if (size == 0) {
+             if (!nocommit)
+                     kernel_upl_abort_range(pl, pl_offset, size, 
+                             UPL_ABORT_FREE_ON_EMPTY);
+             return (0);
+     }
+     if (flags & (IO_APPEND | IO_SYNC))
+                 panic("nfs_pageout: (IO_APPEND | IO_SYNC)");
+     if (f_offset < 0) {
+             if (!nocommit)
+                     kernel_upl_abort_range(pl, pl_offset, size, 
+                             UPL_ABORT_FREE_ON_EMPTY);
+             return (EINVAL);
+     }
+     if (f_offset >= tvc->m.Length) {
+             if (!nocommit)
+                     kernel_upl_abort_range(pl, pl_offset, size,
+                             UPL_ABORT_FREE_ON_EMPTY);
+             return (EINVAL);
+     }
+ 
+     if (f_offset & PAGE_MASK)
+             panic("afs_vop_pageout: offset not page aligned");
+ 
+     auio.uio_iov = &aiov;
+     auio.uio_iovcnt = 1;
+     auio.uio_offset = f_offset;
+     auio.uio_segflg = UIO_SYSSPACE;
+     auio.uio_rw = UIO_WRITE;
+     auio.uio_procp = NULL;
+     kernel_upl_map(kernel_map, pl, &ioaddr);
+     ioaddr += pl_offset;
+     auio.uio_resid = aiov.iov_len = size;
+     aiov.iov_base = (caddr_t)ioaddr;
+ #if 1 /* USV [ */
+         {
+                 /* 
+                  * check for partial page and clear the
+                  * contents past end of the file before
+                  * releasing it in the VM page cache
+                  */
+                 if ((f_offset < tvc->m.Length) && (f_offset + size) > tvc->m.Length) {
+                         size_t io = tvc->m.Length - f_offset;
+ 
+                         bzero((caddr_t)(ioaddr + pl_offset + io), size - io);
+                 }
+         }
+ #endif /* ] USV */
+ 
+     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);
+ 
+     code=afs_write(tvc, uio, flags, cred, 0);
+ 
+     ObtainWriteLock(&tvc->lock, 1);
+     afs_FakeClose(tvc, cred);
+     ReleaseWriteLock(&tvc->lock);
+     afs_BozonUnlock(&tvc->pvnLock, tvc);
+     AFS_GUNLOCK();
+     kernel_upl_unmap(kernel_map, pl);
+     if (!nocommit) {
+             if(code)
+                     kernel_upl_abort_range(pl, pl_offset, size, 
+                         UPL_ABORT_FREE_ON_EMPTY);
+             else
+                     kernel_upl_commit_range(pl, pl_offset, size,
+                          UPL_COMMIT_CLEAR_DIRTY | UPL_COMMIT_FREE_ON_EMPTY,
+                          UPL_GET_INTERNAL_PAGE_LIST(pl), MAX_UPL_TRANSFER);
+     }
+ 
+     return code;
+ }
+ int
+ afs_vop_ioctl(ap)
+ 	struct vop_ioctl_args /* {
+ 	        struct vnode *a_vp;
+ 	        int  a_command;
+ 	        caddr_t  a_data;
+ 	        int  a_fflag;
+ 	        struct ucred *a_cred;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+     struct vcache *tvc = (struct vcache *)ap->a_vp;
+     struct afs_ioctl data;
+     int error = 0;
+   
+     /* in case we ever get in here... */
+ 
+     AFS_STATCNT(afs_ioctl);
+     if (((ap->a_command >> 8) & 0xff) == 'V') {
+ 	/* This is a VICEIOCTL call */
+     AFS_GLOCK();
+ 	error = HandleIoctl(tvc, (struct file *)0/*Not used*/,
+ 	                    ap->a_command, ap->a_data);
+     AFS_GUNLOCK();
+ 	return(error);
+     } else {
+ 	/* No-op call; just return. */
+ 	return(ENOTTY);
+     }
+ }
+ 
+ /* ARGSUSED */
+ int
+ afs_vop_select(ap)
+ 	struct vop_select_args /* {
+ 	        struct vnode *a_vp;
+ 	        int  a_which;
+ 	        int  a_fflags;
+ 	        struct ucred *a_cred;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+ 	/*
+ 	 * We should really check to see if I/O is possible.
+ 	 */
+ 	return (1);
+ }
+ /*
+  * Mmap a file
+  *
+  * NB Currently unsupported.
+  */
+ /* ARGSUSED */
+ int
+ afs_vop_mmap(ap)
+ 	struct vop_mmap_args /* {
+ 	        struct vnode *a_vp;
+ 	        int  a_fflags;
+ 	        struct ucred *a_cred;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+ 	return (EINVAL);
+ }
+ 
+ int
+ afs_vop_fsync(ap)
+ 	struct vop_fsync_args /* {
+ 	        struct vnode *a_vp;
+ 	        struct ucred *a_cred;
+ 	        int a_waitfor;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+     int wait = ap->a_waitfor == MNT_WAIT;
+     int error;
+     register struct vnode *vp = ap->a_vp;
+ 
+     AFS_GLOCK();
+     /*vflushbuf(vp, wait);*/
+     if (ap->a_cred)
+       error=afs_fsync((struct vcache *)vp, ap->a_cred);
+     else
+       error=afs_fsync((struct vcache *)vp, &afs_osi_cred);
+     AFS_GUNLOCK();
+     return error;
+ }
+ 
+ int
+ afs_vop_seek(ap)
+ 	struct vop_seek_args /* {
+ 	        struct vnode *a_vp;
+ 	        off_t  a_oldoff;
+ 	        off_t  a_newoff;
+ 	        struct ucred *a_cred;
+ 	} */ *ap;
+ {
+     if (ap->a_newoff > ULONG_MAX)       /* AFS doesn't support 64-bit offsets */
+ 	return EINVAL;
+     return (0);
+ }
+ 
+ int
+ afs_vop_remove(ap)
+ 	struct vop_remove_args /* {
+ 	        struct vnode *a_dvp;
+ 	        struct vnode *a_vp;
+ 	        struct componentname *a_cnp;
+ 	} */ *ap;
+ {
+     int error = 0;
+     register struct vnode *vp = ap->a_vp;
+     register struct vnode *dvp = ap->a_dvp;
+ 
+     GETNAME();
+     AFS_GLOCK();
+     error =  afs_remove((struct vcache *)dvp, name, cnp->cn_cred);
+     AFS_GUNLOCK();
+     cache_purge(vp);
+     if (dvp == vp)
+ 	vrele(vp);
+     else
+ 	vput(vp);
+     vput(dvp);
+     if (UBCINFOEXISTS(vp)) {
+              int wasmapped=ubc_issetflags(vp, UI_WASMAPPED);
+              int hasobjref=ubc_issetflags(vp, UI_HASOBJREF);
+              if (wasmapped)
+                 (void) ubc_uncache(vp); 
+              if (hasobjref)
+                 ubc_release(vp);
+              /* WARNING vp may not be valid after this */
+     }
+ 
+     FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
+     DROPNAME();
+     return error;
+ }
+ 
+ int
+ afs_vop_link(ap)
+ 	struct vop_link_args /* {
+ 	        struct vnode *a_vp;
+ 	        struct vnode *a_tdvp;
+ 	        struct componentname *a_cnp;
+ 	} */ *ap;
+ {
+     int error = 0;
+     register struct vnode *dvp = ap->a_tdvp;
+     register struct vnode *vp = ap->a_vp;
+     struct proc *p;
+ 
+     GETNAME();
+     p=cnp->cn_proc;
+     if (dvp->v_mount != vp->v_mount) {
+ 	VOP_ABORTOP(vp, cnp);
+ 	error = EXDEV;
+ 	goto out;
+     }
+     if (vp->v_type == VDIR) {
+ 	VOP_ABORTOP(vp, cnp);
+ 	error = EISDIR;
+ 	goto out;
+     }
+     if (error = vn_lock(vp, LK_EXCLUSIVE, p)) {
+ 	VOP_ABORTOP(dvp, cnp);
+ 	goto out;
+     }
+     AFS_GLOCK();
+     error = afs_link((struct vcache *)vp, (struct vcache *)dvp, name, cnp->cn_cred);
+     AFS_GUNLOCK();
+     FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
+     if (dvp != vp)
+ 	VOP_UNLOCK(vp,0, p);
+ out:
+     vput(dvp);
+     DROPNAME();
+     return error;
+ }
+ 
+ int
+ afs_vop_rename(ap)
+ 	struct vop_rename_args  /* {
+ 	        struct vnode *a_fdvp;
+ 	        struct vnode *a_fvp;
+ 	        struct componentname *a_fcnp;
+ 	        struct vnode *a_tdvp;
+ 	        struct vnode *a_tvp;
+ 	        struct componentname *a_tcnp;
+ 	} */ *ap;
+ {
+     int error = 0;
+     struct componentname *fcnp = ap->a_fcnp;
+     char *fname;
+     struct componentname *tcnp = ap->a_tcnp;
+     char *tname;
+     struct vnode *tvp = ap->a_tvp;
+     register struct vnode *tdvp = ap->a_tdvp;
+     struct vnode *fvp = ap->a_fvp;
+     register struct vnode *fdvp = ap->a_fdvp;
+     struct proc *p=fcnp->cn_proc;
+ 
+     /*
+      * Check for cross-device rename.
+      */
+     if ((fvp->v_mount != tdvp->v_mount) ||
+ 	(tvp && (fvp->v_mount != tvp->v_mount))) {
+ 	error = EXDEV;
+ abortit:
+ 	VOP_ABORTOP(tdvp, tcnp); /* XXX, why not in NFS? */
+ 	if (tdvp == tvp)
+ 	    vrele(tdvp);
+ 	else
+ 	    vput(tdvp);
+ 	if (tvp)
+ 	    vput(tvp);
+ 	VOP_ABORTOP(fdvp, fcnp); /* XXX, why not in NFS? */
+ 	vrele(fdvp);
+ 	vrele(fvp);
+ 	return (error);
+     }
+     /*
+      * if fvp == tvp, we're just removing one name of a pair of
+      * directory entries for the same element.  convert call into rename.
+      ( (pinched from NetBSD 1.0's ufs_rename())
+      */
+     if (fvp == tvp) {
+ 	if (fvp->v_type == VDIR) {
+ 	    error = EINVAL;
+ 	    goto abortit;
+ 	}
+ 
+ 	/* Release destination completely. */
+ 	VOP_ABORTOP(tdvp, tcnp);
+ 	vput(tdvp);
+ 	vput(tvp);
+ 
+ 	/* Delete source. */
+ 	vrele(fdvp);
+ 	vrele(fvp);
+ 	fcnp->cn_flags &= ~MODMASK;
+ 	fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
+ 	if ((fcnp->cn_flags & SAVESTART) == 0)
+ 	    panic("afs_rename: lost from startdir");
+ 	fcnp->cn_nameiop = DELETE;
+ 	(void) relookup(fdvp, &fvp, fcnp);
+ 	return (VOP_REMOVE(fdvp, fvp, fcnp));
+     }
+     if (error = vn_lock(fvp, LK_EXCLUSIVE, p))
+ 	goto abortit;
+ 
+     MALLOC(fname, char *, fcnp->cn_namelen+1, M_TEMP, M_WAITOK);
+     bcopy(fcnp->cn_nameptr, fname, fcnp->cn_namelen);
+     fname[fcnp->cn_namelen] = '\0';
+     MALLOC(tname, char *, tcnp->cn_namelen+1, M_TEMP, M_WAITOK);
+     bcopy(tcnp->cn_nameptr, tname, tcnp->cn_namelen);
+     tname[tcnp->cn_namelen] = '\0';
+ 
+ 
+     AFS_GLOCK();
+     /* XXX use "from" or "to" creds? NFS uses "to" creds */
+     error = afs_rename((struct vcache *)fdvp, fname, (struct vcache *)tdvp, tname, tcnp->cn_cred);
+     AFS_GUNLOCK();
+ 
+     VOP_UNLOCK(fvp, 0, p);
+     FREE(fname, M_TEMP);
+     FREE(tname, M_TEMP);
+     if (error)
+ 	goto abortit;                   /* XXX */
+     if (tdvp == tvp)
+ 	vrele(tdvp);
+     else
+ 	vput(tdvp);
+     if (tvp)
+ 	vput(tvp);
+     vrele(fdvp);
+     vrele(fvp);
+     return error;
+ }
+ 
+ int
+ afs_vop_mkdir(ap)
+ 	struct vop_mkdir_args /* {
+ 	        struct vnode *a_dvp;
+ 	        struct vnode **a_vpp;
+ 	        struct componentname *a_cnp;
+ 	        struct vattr *a_vap;
+ 	} */ *ap;
+ {
+     register struct vnode *dvp = ap->a_dvp;
+     register struct vattr *vap = ap->a_vap;
+     int error = 0;
+     struct vcache *vcp;
+     struct proc *p;
+ 
+     GETNAME();
+     p=cnp->cn_proc;
+ #ifdef DIAGNOSTIC
+     if ((cnp->cn_flags & HASBUF) == 0)
+ 	panic("afs_vop_mkdir: no name");
+ #endif
+     AFS_GLOCK();
+     error = afs_mkdir((struct vcache *)dvp, name, vap, &vcp, cnp->cn_cred);
+     AFS_GUNLOCK();
+     if (error) {
+ 	VOP_ABORTOP(dvp, cnp);
+ 	vput(dvp);
+ 	DROPNAME();
+ 	return(error);
+     }
+     if (vcp) {
+ 	*ap->a_vpp = (struct vnode *)vcp;
+ 	vn_lock((struct vnode *)vcp, LK_EXCLUSIVE|LK_RETRY, p);
+     } else
+ 	*ap->a_vpp = 0;
+     DROPNAME();
+     FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
+     vput(dvp);
+     return error;
+ }
+ 
+ int
+ afs_vop_rmdir(ap)
+ 	struct vop_rmdir_args /* {
+ 	        struct vnode *a_dvp;
+ 	        struct vnode *a_vp;
+ 	        struct componentname *a_cnp;
+ 	} */ *ap;
+ {
+     int error = 0;
+     register struct vnode *vp = ap->a_vp;
+     register struct vnode *dvp = ap->a_dvp;
+ 
+     GETNAME();
+     if (dvp == vp) {
+ 	vrele(dvp);
+ 	vput(vp);
+ 	FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
+ 	DROPNAME();
+ 	return (EINVAL);
+     }
+ 
+     AFS_GLOCK();
+     error = afs_rmdir((struct vcache *)dvp, name, cnp->cn_cred);
+     AFS_GUNLOCK();
+     DROPNAME();
+     vput(dvp);
+     vput(vp);
+     return error;
+ }
+ 
+ int
+ afs_vop_symlink(ap)
+ 	struct vop_symlink_args /* {
+ 	        struct vnode *a_dvp;
+ 	        struct vnode **a_vpp;
+ 	        struct componentname *a_cnp;
+ 	        struct vattr *a_vap;
+ 	        char *a_target;
+ 	} */ *ap;
+ {
+     register struct vnode *dvp = ap->a_dvp;
+     int error = 0;
+     /* NFS ignores a_vpp; so do we. */
+ 
+     GETNAME();
+     AFS_GLOCK();
+     error = afs_symlink((struct vcache *)dvp, name, ap->a_vap, ap->a_target,
+ 	                cnp->cn_cred);
+     AFS_GUNLOCK();
+     DROPNAME();
+     FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
+     vput(dvp);
+     return error;
+ }
+ 
+ int
+ afs_vop_readdir(ap)
+ 	struct vop_readdir_args /* {
+ 	        struct vnode *a_vp;
+ 	        struct uio *a_uio;
+ 	        struct ucred *a_cred;
+ 	        int *a_eofflag;
+ 	        u_long *a_cookies;
+ 	        int ncookies;
+ 	} */ *ap;
+ {
+     int error;
+     off_t off;
+ /*    printf("readdir %x cookies %x ncookies %d\n", ap->a_vp, ap->a_cookies,
+ 	   ap->a_ncookies); */
+     off=ap->a_uio->uio_offset;
+     AFS_GLOCK();
+     error= afs_readdir((struct vcache *)ap->a_vp, ap->a_uio, ap->a_cred,
+ 	               ap->a_eofflag);
+     AFS_GUNLOCK();
+     if (!error && ap->a_ncookies != NULL) {
+ 	struct uio *uio = ap->a_uio;
+ 	const struct dirent *dp, *dp_start, *dp_end;
+ 	int ncookies;
+ 	u_long *cookies, *cookiep;
+ 
+ 	if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1)
+ 	    panic("afs_readdir: burned cookies");
+ 	dp = (const struct dirent *)
+ 	    ((const char *)uio->uio_iov->iov_base - (uio->uio_offset - off));
+ 
+ 	dp_end = (const struct dirent *) uio->uio_iov->iov_base;
+ 	for (dp_start = dp, ncookies = 0;
+ 	     dp < dp_end;
+ 	     dp = (const struct dirent *)((const char *) dp + dp->d_reclen))
+ 	    ncookies++;
+ 
+ 	MALLOC(cookies, u_long *, ncookies * sizeof(u_long),
+ 	       M_TEMP, M_WAITOK);
+ 	for (dp = dp_start, cookiep = cookies;
+ 	     dp < dp_end;
+ 	     dp = (const struct dirent *)((const char *) dp + dp->d_reclen)) {
+ 	    off += dp->d_reclen;
+ 	    *cookiep++ = off;
+ 	}
+ 	*ap->a_cookies = cookies;
+ 	*ap->a_ncookies = ncookies;
+     }
+ 
+     return error;
+ }
+ 
+ int
+ afs_vop_readlink(ap)
+ 	struct vop_readlink_args /* {
+ 	        struct vnode *a_vp;
+ 	        struct uio *a_uio;
+ 	        struct ucred *a_cred;
+ 	} */ *ap;
+ {
+     int error;
+ /*    printf("readlink %x\n", ap->a_vp);*/
+     AFS_GLOCK();
+     error= afs_readlink((struct vcache *)ap->a_vp, ap->a_uio, ap->a_cred);
+     AFS_GUNLOCK();
+     return error;
+ }
+ 
+ extern int prtactive;
+ 
+ int
+ afs_vop_inactive(ap)
+ 	struct vop_inactive_args /* {
+ 	        struct vnode *a_vp;
+                 struct proc *a_p;
+ 	} */ *ap;
+ {
+     register struct vnode *vp = ap->a_vp;
+ 
+     if (prtactive && vp->v_usecount != 0)
+ 	vprint("afs_vop_inactive(): pushing active", vp);
+ 
+     AFS_GLOCK();
+     afs_InactiveVCache((struct vcache *)vp, 0);   /* decrs ref counts */
+     AFS_GUNLOCK();
+     VOP_UNLOCK(vp, 0, ap->a_p);
+     return 0;
+ }
+ 
+ int
+ afs_vop_reclaim(ap)
+ 	struct vop_reclaim_args /* {
+ 	        struct vnode *a_vp;
+ 	} */ *ap;
+ {
+     int error;
+     int sl;
+     register struct vnode *vp = ap->a_vp;
+ 
+     cache_purge(vp);                    /* just in case... */
+ 
+ #if 0 
+     AFS_GLOCK();
+     error = afs_FlushVCache((struct vcache *)vp, &sl); /* tosses our stuff from vnode */
+     AFS_GUNLOCK();
+     ubc_unlink(vp);
+     if (!error && vp->v_data)
+ 	panic("afs_reclaim: vnode not cleaned");
+     return error;
+ #else
+    if (vp->v_usecount == 2) {
+         vprint("reclaim count==2", vp);
+    } else if (vp->v_usecount == 1) {
+         vprint("reclaim count==1", vp);
+    } else 
+         vprint("reclaim bad count", vp);
+ 
+    return 0;
+ #endif
+ }
+ 
+ int
+ afs_vop_lock(ap)
+ 	struct vop_lock_args /* {
+ 	        struct vnode *a_vp;
+ 	} */ *ap;
+ {
+ 	register struct vnode *vp = ap->a_vp;
+ 	register struct vcache *avc = (struct vcache *)vp;
+ 
+ 	if (vp->v_tag == VT_NON)
+ 	        return (ENOENT);
+ 	return (lockmgr(&avc->rwlock, ap->a_flags, &vp->v_interlock,
+                 ap->a_p));
+ }
+ 
+ int
+ afs_vop_unlock(ap)
+ 	struct vop_unlock_args /* {
+ 	        struct vnode *a_vp;
+ 	} */ *ap;
+ {
+     struct vnode *vp = ap->a_vp;
+     struct vcache *avc = (struct vcache *)vp;
+     return (lockmgr(&avc->rwlock, ap->a_flags | LK_RELEASE,
+             &vp->v_interlock, ap->a_p));
+ 
+ }
+ 
+ int
+ afs_vop_bmap(ap)
+ 	struct vop_bmap_args /* {
+ 	        struct vnode *a_vp;
+ 	        daddr_t  a_bn;
+ 	        struct vnode **a_vpp;
+ 	        daddr_t *a_bnp;
+ 	        int *a_runp;
+ 	        int *a_runb;
+ 	} */ *ap;
+ {
+     struct vcache *vcp;
+     int error;
+     if (ap->a_bnp) {
+ 	*ap->a_bnp = ap->a_bn * (PAGE_SIZE / DEV_BSIZE);
+     }
+     if (ap->a_vpp) {
+ 	*ap->a_vpp = ap->a_vp;
+     }
+ 	if (ap->a_runp != NULL)
+ 	        *ap->a_runp = 0;
+ #ifdef notyet
+ 	if (ap->a_runb != NULL)
+ 	        *ap->a_runb = 0;
+ #endif
+  
+     return 0;
+ }
+ int
+ afs_vop_strategy(ap)
+ 	struct vop_strategy_args /* {
+ 	        struct buf *a_bp;
+ 	} */ *ap;
+ {
+     int error;
+     AFS_GLOCK();
+     error= afs_ustrategy(ap->a_bp);
+     AFS_GUNLOCK();
+     return error;
+ }
+ int
+ afs_vop_print(ap)
+ 	struct vop_print_args /* {
+ 	        struct vnode *a_vp;
+ 	} */ *ap;
+ {
+     register struct vnode *vp = ap->a_vp;
+     register struct vcache *vc = (struct vcache *)ap->a_vp;
+     int s = vc->states;
+     char buf[20];
+     printf("tag %d, fid: %ld.%x.%x.%x, opens %d, writers %d", vp->v_tag, vc->fid.Cell,
+ 	   vc->fid.Fid.Volume, vc->fid.Fid.Vnode, vc->fid.Fid.Unique, vc->opens,
+ 	   vc->execsOrWriters);
+     printf("\n  states%s%s%s%s%s", (s&CStatd) ? " statd" : "", (s&CRO) ? " readonly" : "",(s&CDirty) ? " dirty" : "",(s&CMAPPED) ? " mapped" : "", (s&CVFlushed) ? " flush in progress" : "");
+     if (UBCISVALID(vp))
+         printf("\n  UBC: %s%s",
+                UBCINFOEXISTS(vp) ? "exists, " : "does not exist",
+                UBCINFOEXISTS(vp) ?
+                  sprintf(buf, "holdcnt %d", vp->v_ubcinfo->ui_holdcnt),buf : "");
+     printf("\n");
+     return 0;
+ }
+ 
+ int
+ afs_vop_islocked(ap)
+ 	struct vop_islocked_args /* {
+ 	        struct vnode *a_vp;
+ 	} */ *ap;
+ {
+     struct vcache *vc = (struct vcache *)ap->a_vp;
+     return lockstatus(&vc->rwlock);
+ }
+ 
+ /*
+  * Return POSIX pathconf information applicable to ufs filesystems.
+  */
+ afs_vop_pathconf(ap)
+ 	struct vop_pathconf_args /* {
+ 	        struct vnode *a_vp;
+ 	        int a_name;
+ 	        int *a_retval;
+ 	} */ *ap;
+ {
+     AFS_STATCNT(afs_cntl);
+     switch (ap->a_name) {
+       case _PC_LINK_MAX:
+ 	*ap->a_retval = LINK_MAX;
+ 	break;
+       case _PC_NAME_MAX:
+ 	*ap->a_retval = NAME_MAX;
+ 	break;
+       case _PC_PATH_MAX:
+ 	*ap->a_retval = PATH_MAX;
+ 	break;
+       case _PC_CHOWN_RESTRICTED:
+ 	*ap->a_retval = 1;
+ 	break;
+       case _PC_NO_TRUNC:
+ 	*ap->a_retval = 1;
+ 	break;
+       case _PC_PIPE_BUF:
+ 	return EINVAL;
+ 	break;
+       default:
+ 	return EINVAL;
+     }
+     return 0;
+ }
+ 
+ /*
+  * Advisory record locking support (fcntl() POSIX style)
+  */
+ int
+ afs_vop_advlock(ap)
+ 	struct vop_advlock_args /* {
+ 	        struct vnode *a_vp;
+ 	        caddr_t  a_id;
+ 	        int  a_op;
+ 	        struct flock *a_fl;
+ 	        int  a_flags;
+ 	} */ *ap;
+ {
+     int error;
+     struct proc *p=current_proc();
+     struct ucred cr;
+     pcred_readlock(p);
+     cr=*p->p_cred->pc_ucred;
+     pcred_unlock(p);
+     AFS_GLOCK();
+     error= afs_lockctl((struct vcache *)ap->a_vp, ap->a_fl, ap->a_op, &cr,
+ 	               (int) ap->a_id);
+     AFS_GUNLOCK();
+     return error;
+ }
+ 
+ int
+ afs_vop_truncate(ap)
+ 	struct vop_truncate_args /* {
+ 	        struct vnode *a_vp;
+ 	        off_t a_length;
+ 	        int a_flags;
+ 	        struct ucred *a_cred;
+ 	        struct proc *a_p;
+ 	} */ *ap;
+ {
+     printf("stray afs_vop_truncate\n");
+     return EOPNOTSUPP;
+ }
+ 
+ int
+ afs_vop_update(ap)
+ 	struct vop_update_args /* {
+ 	        struct vnode *a_vp;
+ 	        struct timeval *a_access;
+ 	        struct timeval *a_modify;
+ 	        int a_waitfor;
+ 	} */ *ap;
+ {
+     printf("stray afs_vop_update\n");
+     return EOPNOTSUPP;
+ }
+ 
+ int afs_vop_blktooff(ap)
+         struct vop_blktooff_args /* {
+                 struct vnode *a_vp;
+                 daddr_t a_lblkno;
+                 off_t *a_offset;    
+         } */ *ap;
+ {
+ 	*ap->a_offset = (off_t)(ap->a_lblkno *  DEV_BSIZE);
+         return 0;
+ }
+ 
+ int afs_vop_offtoblk(ap)
+         struct vop_offtoblk_args /* {
+                 struct vnode *a_vp;
+                 off_t a_offset;    
+                 daddr_t *a_lblkno;
+         } */ *ap;
+ {
+ 	*ap->a_lblkno = (daddr_t)(ap->a_offset /  DEV_BSIZE);
+ 
+         return (0);
+ }
+ 
+ int afs_vop_cmap(ap)
+         struct vop_cmap_args /* {
+                 struct vnode *a_vp;
+                 off_t a_foffset;    
+                 size_t a_size;
+                 daddr_t *a_bpn;
+                 size_t *a_run;
+                 void *a_poff;
+         } */ *ap;
+ {
+         *ap->a_bpn = (daddr_t)(ap->a_foffset /  DEV_BSIZE);	
+         *ap->a_run= MAX(ap->a_size, AFS_CHUNKSIZE(ap->a_foffset));
+ 	return 0;
+ }
+ 
Index: openafs/src/afs/DUX/osi_file.c
diff -c openafs/src/afs/DUX/osi_file.c:1.2 openafs/src/afs/DUX/osi_file.c:1.2.2.1
*** openafs/src/afs/DUX/osi_file.c:1.2	Sat Nov  4 05:03:19 2000
--- openafs/src/afs/DUX/osi_file.c	Sun Apr 22 23:33:16 2001
***************
*** 23,58 ****
  void *osi_UFSOpen(ainode)
      afs_int32 ainode;
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
      extern int cacheDiskType;
      afs_int32 code = 0;
      int dummy;
      AFS_STATCNT(osi_UFSOpen);
!     if(cacheDiskType != AFS_FCACHE_TYPE_UFS) {
  	osi_Panic("UFSOpen called for non-UFS cache\n");
!     }
!     if (!afs_osicred_initialized) {
! 	/* valid for alpha_osf, SunOS, Ultrix */
! 	bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED));
! 	afs_osi_cred.cr_ref++;
! 	afs_osicred_initialized = 1;
!     }
      afile = (struct osi_file *) osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
!     code = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t)ainode, &ip, &dummy);
!     AFS_GLOCK();
!     if (code) {
! 	osi_FreeSmallSpace(afile);
! 	osi_Panic("UFSOpen: igetinode failed");
      }
!     IN_UNLOCK(ip);
!     afile->vnode = ITOV(ip);
!     afile->size = VTOI(afile->vnode)->i_size;
!     afile->offset = 0;
!     afile->proc = (int (*)()) 0;
!     afile->inum = ainode;        /* for hint validity checking */
!     return (void *)afile;
  }
  
  afs_osi_Stat(afile, astat)
--- 23,104 ----
  void *osi_UFSOpen(ainode)
      afs_int32 ainode;
  {
+     static struct vnode *tags_vnode = NULL;
      struct inode *ip;
      register struct osi_file *afile = NULL;
      extern int cacheDiskType;
      afs_int32 code = 0;
      int dummy;
      AFS_STATCNT(osi_UFSOpen);
!     if(cacheDiskType != AFS_FCACHE_TYPE_UFS) 
  	osi_Panic("UFSOpen called for non-UFS cache\n");
! 
      afile = (struct osi_file *) osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
! 
!     switch(afs_cacheVfsp->m_stat.f_type) {
!     case MOUNT_UFS:
!        code = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t)ainode, &ip, &dummy);
!        if (code) {
!            osi_FreeSmallSpace(afile);
!            osi_Panic("UFSOpen: igetinode failed");
!        }
!        IN_UNLOCK(ip);
!        afile->vnode = ITOV(ip);
!        afile->size = VTOI(afile->vnode)->i_size;
!        afile->offset = 0;
!        afile->proc = NULL;
!        afile->inum = ainode;        /* for hint validity checking */
!        break;
!     case MOUNT_MSFS: {
!        char path[1024];
!        struct nameidata nd, *ndp = &nd;
!        struct utask_nd utnd = { NULL, NULL };
!        struct vattr attr;
! 
!        bzero(&nd, sizeof(nd));
!        ndp->ni_utnd = &utnd;
!        ndp->ni_nameiop = LOOKUP;
!        ndp->ni_cred = &afs_osi_cred;
!        ndp->ni_segflg  = UIO_SYSSPACE;
! 
!        /* get hold of a vnode for the .tags directory, so we can
!            lookup files relative to it */
!        if(tags_vnode == NULL) {
!            ndp->ni_cdir = afs_cacheVfsp->m_vnodecovered;
!            strcpy(path, afs_cacheVfsp->m_stat.f_mntonname);
!            strcat(path, "/.tags");
!            ndp->ni_dirp = path;
!            if((code = namei(ndp)))
!                osi_Panic("failed to lookup %s (%d)", path, code);
!            tags_vnode = ndp->ni_vp;
!        }
!        sprintf(path, "%d", ainode);
!        ndp->ni_dirp = path;
!        ndp->ni_cdir = tags_vnode;
!        if((code = namei(ndp)))
!            osi_Panic("failed to lookup %s (%d)", path, code);
! 
!        /* XXX this sucks, chances are we're going to do this again right
!           away, but apparently we can't just set the size to 0 */
!        VOP_GETATTR(ndp->ni_vp, &attr, &afs_osi_cred, code);
!        if(code) 
!            osi_Panic("failed to stat %s (%d)", path, code);
! 
!        afile->vnode = ndp->ni_vp;
!        afile->size = attr.va_size;
!        afile->offset = 0;
!        afile->proc = NULL;
!        afile->inum = ainode;        /* for hint validity checking */
!        break;
      }
!     default:
! 	osi_Panic("UFSOpen called for unknown cache-type (%d)", 
! 		  afs_cacheVfsp->m_stat.f_type);
!     }
! 
!     AFS_GLOCK();
!     return afile;
  }
  
  afs_osi_Stat(afile, astat)
***************
*** 121,127 ****
  void osi_DisableAtimes(avp)
  struct vnode *avp;
  {
!    struct inode *ip = VTOI(avp);
     ip->i_flag &= ~IACC;
  }
  
--- 167,175 ----
  void osi_DisableAtimes(avp)
  struct vnode *avp;
  {
!    struct inode *ip;
!    assert(avp->v_tag == VT_UFS);
!    ip = VTOI(avp);
     ip->i_flag &= ~IACC;
  }
  
Index: openafs/src/afs/DUX/osi_inode.c
diff -c openafs/src/afs/DUX/osi_inode.c:1.2.2.2 openafs/src/afs/DUX/osi_inode.c:1.2.2.4
*** openafs/src/afs/DUX/osi_inode.c:1.2.2.2	Tue Mar  6 16:41:24 2001
--- openafs/src/afs/DUX/osi_inode.c	Sun Apr 22 23:33:16 2001
***************
*** 20,25 ****
--- 20,61 ----
  #include "../afs/afs_stats.h" /* statistics stuff */
  #include <ufs/ufsmount.h>
  
+ /* given a vnode, return the `inode number'; if it's a UFS vnode just
+    return the i_number from the in kernel inode struct, if not stat
+    the file to get the inumber from there */
+ afs_uint32
+ osi_vnodeToInumber(struct vnode *vnode)
+ {
+     int error;
+     struct vattr attr;
+ 
+     /* use faster version with UFS */
+     if(vnode->v_tag == VT_UFS)
+ 	return VTOI(vnode)->i_number;
+     /* otherwise stat the file */
+     VOP_GETATTR(vnode, &attr, NULL, error);
+     if(error)
+ 	osi_Panic("VOP_GETATTR = %d", error);
+     return attr.va_fileid;
+ }
+ 
+ /* return the id of the device containing the file */
+ afs_uint32
+ osi_vnodeToDev(struct vnode *vnode)
+ {
+     int error;
+     struct vattr attr;
+ 
+     /* use faster version with UFS */
+     if(vnode->v_tag == VT_UFS)
+ 	return VTOI(vnode)->i_dev;
+     /* otherwise stat the file */
+     VOP_GETATTR(vnode, &attr, NULL, error);
+     if(error)
+ 	osi_Panic("VOP_GETATTR = %d", error);
+     return attr.va_rdev;
+ }
+ 
  getinode(fs, dev, inode, ipp, perror)
       struct mount *fs;
       struct inode **ipp;
***************
*** 67,72 ****
--- 103,109 ----
      }
      vp = (struct vnode *) fake_vnode;
      fake_inode_init(vp, fs);
+     assert(vp->v_tag == VT_UFS);
      code = iget(VTOI(vp), inode, &ip, 0);
      if (code != 0) {
  	*perror = BAD_IGET;
Index: openafs/src/afs/FBSD/opt_posix.h
diff -c /dev/null openafs/src/afs/FBSD/opt_posix.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/opt_posix.h	Mon Apr 23 03:28:45 2001
***************
*** 0 ****
--- 1,2 ----
+ #define P1003_1B 1
+ #define _KPOSIX_PRIORITY_SCHEDULING 1
Index: openafs/src/afs/FBSD/osi_file.c
diff -c /dev/null openafs/src/afs/FBSD/osi_file.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_file.c	Mon Apr 23 03:28:45 2001
***************
*** 0 ****
--- 1,234 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #include "../afs/param.h"	/* Should be always first */
+ #include "../afs/sysincludes.h"	/* Standard vendor system headers */
+ #include "../afs/afsincludes.h"	/* Afs-based standard headers */
+ #include "../afs/afs_stats.h"  /* afs statistics */
+ 
+ 
+ int afs_osicred_initialized=0;
+ struct  AFS_UCRED afs_osi_cred;
+ afs_lock_t afs_xosi;		/* lock is for tvattr */
+ extern struct osi_dev cacheDev;
+ extern struct mount *afs_cacheVfsp;
+ 
+ 
+ void *osi_UFSOpen(ainode)
+     afs_int32 ainode;
+ {
+     struct inode *ip;
+     register struct osi_file *afile = NULL;
+     extern int cacheDiskType;
+     afs_int32 code = 0;
+     int dummy;
+     AFS_STATCNT(osi_UFSOpen);
+     if(cacheDiskType != AFS_FCACHE_TYPE_UFS) {
+ 	osi_Panic("UFSOpen called for non-UFS cache\n");
+     }
+     if (!afs_osicred_initialized) {
+ 	/* valid for alpha_osf, SunOS, Ultrix */
+ 	bzero((char *)&afs_osi_cred, sizeof(struct AFS_UCRED));
+ 	afs_osi_cred.cr_ref++;
+ 	afs_osicred_initialized = 1;
+     }
+     afile = (struct osi_file *) osi_AllocSmallSpace(sizeof(struct osi_file));
+     AFS_GUNLOCK();
+     code = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t)ainode, &ip, &dummy);
+     AFS_GLOCK();
+     if (code) {
+ 	osi_FreeSmallSpace(afile);
+ 	osi_Panic("UFSOpen: igetinode failed");
+     }
+     IN_UNLOCK(ip);
+     afile->vnode = ITOV(ip);
+     afile->size = VTOI(afile->vnode)->i_size;
+     afile->offset = 0;
+     afile->proc = (int (*)()) 0;
+     afile->inum = ainode;        /* for hint validity checking */
+     return (void *)afile;
+ }
+ 
+ afs_osi_Stat(afile, astat)
+     register struct osi_file *afile;
+     register struct osi_stat *astat; {
+     register afs_int32 code;
+     struct vattr tvattr;
+     AFS_STATCNT(osi_Stat);
+     MObtainWriteLock(&afs_xosi,320);
+     AFS_GUNLOCK();
+     VOP_GETATTR(afile->vnode, &tvattr, &afs_osi_cred, code);
+     AFS_GLOCK();
+     if (code == 0) {
+ 	astat->size = tvattr.va_size;
+ 	astat->blksize = tvattr.va_blocksize;
+ 	astat->mtime = tvattr.va_mtime.tv_sec;
+ 	astat->atime = tvattr.va_atime.tv_sec;
+     }
+     MReleaseWriteLock(&afs_xosi);
+     return code;
+ }
+ 
+ osi_UFSClose(afile)
+      register struct osi_file *afile;
+   {
+       AFS_STATCNT(osi_Close);
+       if(afile->vnode) {
+ 	AFS_RELE(afile->vnode);
+       }
+       
+       osi_FreeSmallSpace(afile);
+       return 0;
+   }
+ 
+ osi_UFSTruncate(afile, asize)
+     register struct osi_file *afile;
+     afs_int32 asize; {
+     struct AFS_UCRED *oldCred;
+     struct vattr tvattr;
+     register afs_int32 code;
+     struct osi_stat tstat;
+     AFS_STATCNT(osi_Truncate);
+ 
+     /* This routine only shrinks files, and most systems
+      * have very slow truncates, even when the file is already
+      * small enough.  Check now and save some time.
+      */
+     code = afs_osi_Stat(afile, &tstat);
+     if (code || tstat.size <= asize) return code;
+     MObtainWriteLock(&afs_xosi,321);    
+     VATTR_NULL(&tvattr);
+     /* note that this credential swapping stuff is only necessary because
+ 	of ufs's references directly to cred instead of to
+ 	credentials parameter.  Probably should fix ufs some day. */
+     oldCred = curproc->p_cred->pc_ucred; /* remember old credentials pointer  */
+     curproc->p_cred->pc_ucred = &afs_osi_cred;
+     /* temporarily use superuser credentials */
+     tvattr.va_size = asize;
+     AFS_GUNLOCK();
+     VOP_SETATTR(afile->vnode, &tvattr, &afs_osi_cred, code);
+     AFS_GLOCK();
+     curproc->p_cred->pc_ucred = oldCred;     /* restore */
+     MReleaseWriteLock(&afs_xosi);
+     return code;
+ }
+ 
+ void osi_DisableAtimes(avp)
+ struct vnode *avp;
+ {
+    struct inode *ip = VTOI(avp);
+    ip->i_flag &= ~IACC;
+ }
+ 
+ 
+ /* Generic read interface */
+ afs_osi_Read(afile, offset, aptr, asize)
+     register struct osi_file *afile;
+     int offset;
+     char *aptr;
+     afs_int32 asize; {
+     struct AFS_UCRED *oldCred;
+     unsigned int resid;
+     register afs_int32 code;
+     register afs_int32 cnt1=0;
+     AFS_STATCNT(osi_Read);
+ 
+     /**
+       * If the osi_file passed in is NULL, panic only if AFS is not shutting
+       * down. No point in crashing when we are already shutting down
+       */
+     if ( !afile ) {
+ 	if ( !afs_shuttingdown )
+ 	    osi_Panic("osi_Read called with null param");
+ 	else
+ 	    return EIO;
+     }
+ 
+     if (offset != -1) afile->offset = offset;
+     AFS_GUNLOCK();
+     code = gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, afile->offset,
+                   AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid);
+     AFS_GLOCK();
+     if (code == 0) {
+ 	code = asize - resid;
+ 	afile->offset += code;
+ 	osi_DisableAtimes(afile->vnode);
+     }
+     else {
+ 	afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
+ 		 ICL_TYPE_INT32, code);
+ 	code = -1;
+     }
+     return code;
+ }
+ 
+ /* Generic write interface */
+ afs_osi_Write(afile, offset, aptr, asize)
+     register struct osi_file *afile;
+     char *aptr;
+     afs_int32 offset;
+     afs_int32 asize; {
+     struct AFS_UCRED *oldCred;
+     unsigned int resid;
+     register afs_int32 code;
+     AFS_STATCNT(osi_Write);
+     if ( !afile )
+         osi_Panic("afs_osi_Write called with null param");
+     if (offset != -1) afile->offset = offset;
+     {
+         struct ucred *tmpcred = curproc->p_cred->pc_ucred;
+ 	curproc->p_cred->pc_ucred = &afs_osi_cred;
+ 	AFS_GUNLOCK();
+ 	code = gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize, afile->offset,
+                   AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid);
+ 	AFS_GLOCK();
+ 	curproc->p_cred->pc_ucred = tmpcred;
+     }
+     if (code == 0) {
+ 	code = asize - resid;
+ 	afile->offset += code;
+     }
+     else {
+ 	code = -1;
+     }
+     if (afile->proc) {
+ 	(*afile->proc)(afile, code);
+     }
+     return code;
+ }
+ 
+ 
+ /*  This work should be handled by physstrat in ca/machdep.c.
+     This routine written from the RT NFS port strategy routine.
+     It has been generalized a bit, but should still be pretty clear. */
+ int afs_osi_MapStrategy(aproc, bp)
+ 	int (*aproc)();
+ 	register struct buf *bp;
+ {
+     afs_int32 returnCode;
+ 
+     AFS_STATCNT(osi_MapStrategy);
+     returnCode = (*aproc) (bp);
+ 
+     return returnCode;
+ }
+ 
+ 
+ 
+ void
+ shutdown_osifile()
+ {
+   extern int afs_cold_shutdown;
+ 
+   AFS_STATCNT(shutdown_osifile);
+   if (afs_cold_shutdown) {
+     afs_osicred_initialized = 0;
+   }
+ }
+ 
Index: openafs/src/afs/FBSD/osi_groups.c
diff -c /dev/null openafs/src/afs/FBSD/osi_groups.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_groups.c	Mon Apr 23 03:28:45 2001
***************
*** 0 ****
--- 1,160 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ /*
+  * osi_groups.c
+  *
+  * Implements:
+  * Afs_xsetgroups (syscall)
+  * setpag
+  *
+  */
+ #include "../afs/param.h"
+ #include "../afs/sysincludes.h"
+ #include "../afs/afsincludes.h"
+ #include "../afs/afs_stats.h"  /* statistics */
+ 
+ #define NOCRED  ((struct ucred *) -1)
+ #define NOUID   ((uid_t) -1)
+ #define NOGID   ((gid_t) -1)
+ 
+ 
+ static int
+ afs_getgroups(
+     struct ucred *cred,
+     int ngroups,
+     gid_t *gidset);
+ 
+ static int
+ afs_setgroups(
+     struct proc *proc,
+     struct ucred **cred,
+     int ngroups,
+     gid_t *gidset,
+     int change_parent);
+ 
+ int
+ Afs_xsetgroups(p, args, retval)
+     struct proc *p;
+     void *args;
+     int *retval;
+ {
+     int code = 0;
+     struct vrequest treq;
+ 
+     AFS_STATCNT(afs_xsetgroups);
+     AFS_GLOCK();
+ 
+     /*    code = afs_InitReq(&treq, u.u_cred); */
+     code = afs_InitReq(&treq, curproc->p_cred->pc_ucred);
+     AFS_GUNLOCK();
+     if (code) return code;
+ 
+     code = setgroups(p, args, retval);
+     /* Note that if there is a pag already in the new groups we don't
+      * overwrite it with the old pag.
+      */
+     if (PagInCred(curproc->p_cred->pc_ucred) == NOPAG) {
+ 	if (((treq.uid >> 24) & 0xff) == 'A') {
+ 	    AFS_GLOCK();
+ 	    /* we've already done a setpag, so now we redo it */
+ 	    AddPag(p, treq.uid, &p->p_rcred);
+ 	    AFS_GUNLOCK();
+ 	}
+     }
+     return code;
+ }
+ 
+ 
+ int
+ setpag(proc, cred, pagvalue, newpag, change_parent)
+     struct proc *proc;
+     struct ucred **cred;
+     afs_uint32 pagvalue;
+     afs_uint32 *newpag;
+     afs_uint32 change_parent;
+ {
+     gid_t gidset[NGROUPS];
+     int ngroups, code;
+     int j;
+ 
+     AFS_STATCNT(setpag);
+     ngroups = afs_getgroups(*cred, NGROUPS, gidset);
+     if (afs_get_pag_from_groups(gidset[0], gidset[1]) == NOPAG) {
+ 	/* We will have to shift grouplist to make room for pag */
+ 	if (ngroups + 2 > NGROUPS) {
+ 	    return (E2BIG);
+ 	}
+ 	for (j = ngroups -1; j >= 0; j--) {
+  	    gidset[j+2] = gidset[j];
+  	}
+ 	ngroups += 2;
+     }
+     *newpag = (pagvalue == -1 ? genpag(): pagvalue);
+     afs_get_groups_from_pag(*newpag, &gidset[0], &gidset[1]);
+     code = afs_setgroups(proc, cred, ngroups, gidset, change_parent);
+     return code;
+ }
+ 
+ 
+ static int
+ afs_getgroups(
+     struct ucred *cred,
+     int ngroups,
+     gid_t *gidset)
+ {
+     int ngrps, savengrps;
+     gid_t *gp;
+ 
+     AFS_STATCNT(afs_getgroups);
+     savengrps = ngrps = MIN(ngroups, cred->cr_ngroups);
+     gp = cred->cr_groups;
+     while (ngrps--)
+ 	*gidset++ = *gp++;   
+     return savengrps;
+ }
+ 
+ 
+ 
+ static int
+ afs_setgroups(
+     struct proc *proc,
+     struct ucred **cred,
+     int ngroups,
+     gid_t *gidset,
+     int change_parent)
+ {
+     int ngrps;
+     int i;
+     gid_t *gp;
+     struct ucred *newcr, *cr;
+ 
+     AFS_STATCNT(afs_setgroups);
+     /*
+      * The real setgroups() call does this, so maybe we should too.
+      *
+      */
+     if (ngroups > NGROUPS)
+ 	return EINVAL;
+     cr = *cred;
+     if (!change_parent) {
+ 	crhold(cr);
+ 	newcr = crcopy(cr);
+     } else
+ 	newcr = cr;
+     newcr->cr_ngroups = ngroups;
+     gp = newcr->cr_groups;
+     while (ngroups--)
+ 	*gp++ = *gidset++;
+     if (!change_parent) {
+ 	substitute_real_creds(proc, NOUID, NOUID, NOGID, NOGID, newcr);
+     }
+     *cred = newcr;
+     return(0);
+ }
Index: openafs/src/afs/FBSD/osi_inode.c
diff -c /dev/null openafs/src/afs/FBSD/osi_inode.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_inode.c	Mon Apr 23 03:28:46 2001
***************
*** 0 ****
--- 1,279 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ /*
+  * FreeBSD inode operations
+  *
+  * Implements:
+  *
+  */
+ #include "../afs/param.h"	/* Should be always first */
+ #include "../afs/sysincludes.h"	/* Standard vendor system headers */
+ #include "../afs/afsincludes.h"	/* Afs-based standard headers */
+ #include "../afs/osi_inode.h"
+ #include "../afs/afs_stats.h" /* statistics stuff */
+ #include <sys/queue.h>
+ #include <sys/lock.h>
+ #include <ufs/ufsmount.h>
+ #include <ufs/ufs/dinode.h>
+ 
+ getinode(fs, dev, inode, ipp, perror)
+      struct mount *fs;
+      struct inode **ipp;
+      dev_t dev;
+      ino_t inode;
+      int *perror;
+ {
+     register struct vnode *vp;
+     char fake_vnode[FAKE_INODE_SIZE];
+     struct inode *ip;
+     int code;
+ 
+     *ipp = 0;
+     *perror = 0;
+     if (!fs) {
+ 	register struct ufsmount *ump;
+ 	register struct vnode *vp;
+ 	register struct mount *mp;
+ 	
+ 	MOUNTLIST_LOCK();
+ 	if (mp = TAILQ_FIRST(&mountlist)) do {
+ 	    /*
+ 	     * XXX Also do the test for MFS 
+ 	     */
+ #undef m_data
+ #undef m_next
+ 	    if (mp->mnt_stat.f_type == MOUNT_UFS) {	
+ 		MOUNTLIST_UNLOCK();
+ 		ump = VFSTOUFS(mp);
+ 		if (ump->um_fs == NULL)
+ 		    break;
+ 		if (ump->um_dev == dev) {
+ 		    fs = ump->um_mountp;
+ 		}
+ 		MOUNTLIST_LOCK();
+ 	    }
+ 	    mp = TAILQ_NEXT(mp, mnt_list);
+ 	} while (mp != TAILQ_FIRST(&mountlist));
+ 	MOUNTLIST_UNLOCK();
+ 	if (!fs)
+ 	    return(ENXIO);
+     }
+     vp = (struct vnode *) fake_vnode;
+     fake_inode_init(vp, fs);
+     code = iget(VTOI(vp), inode, &ip, 0);
+     if (code != 0) {
+ 	*perror = BAD_IGET;
+         return code;
+     } else {
+ 	*ipp = ip;
+         return(0);
+     }
+ }
+ 
+ igetinode(vfsp, dev, inode, ipp, perror)
+      struct inode **ipp;
+      struct mount *vfsp;
+      dev_t dev;
+      ino_t inode;
+      int *perror;
+ {
+     struct inode *pip, *ip;
+     extern struct osi_dev cacheDev;
+     register int code = 0;
+ 
+     *perror = 0;
+ 
+     AFS_STATCNT(igetinode);
+ 
+     if ((code = getinode(vfsp, dev, inode, &ip, perror)) != 0) {
+ 	return(code);
+     }
+ 
+     if (ip->i_mode == 0) {
+ 	/* Not an allocated inode */
+ 	iforget(ip);	    
+ 	return(ENOENT);
+     }
+ 
+     if (ip->i_nlink == 0 || (ip->i_mode&IFMT) != IFREG) {
+ 	iput(ip);
+ 	return(ENOENT);
+     }
+ 
+     *ipp = ip;
+     return(0);
+ }
+ 
+ iforget(ip)
+ struct inode *ip;
+ {
+     struct vnode *vp = ITOV(ip);
+ 
+     AFS_STATCNT(iforget);
+ 
+     VN_LOCK(vp);
+     /* this whole thing is too wierd.  Why??? XXX */
+     if (vp->v_usecount == 1) {
+ 	VN_UNLOCK(vp);
+ 	idrop(ip);
+     } else {
+ 	VN_UNLOCK(vp);
+     }
+ }
+ 
+ /*
+  * icreate system call -- create an inode
+  */
+ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, retval)
+      long *retval;
+      long dev, near_inode, param1, param2, param3, param4;
+ {
+     int dummy, err=0;
+     struct inode *ip, *newip;
+     register int code;
+     struct vnode *vp;
+     
+     AFS_STATCNT(afs_syscall_icreate);
+     
+     if (!afs_suser())
+ 	return(EPERM);
+ 
+     code = getinode(0, (dev_t)dev, 2, &ip, &dummy);
+     if (code) {
+ 	return(ENOENT);
+     }
+     code = ialloc(ip, (ino_t)near_inode, 0, &newip);
+     iput(ip);
+     if (code) {
+ 	return(code);
+     }
+     IN_LOCK(newip);
+     newip->i_flag |= IACC|IUPD|ICHG;
+     
+     newip->i_nlink = 1;
+ 
+     newip->i_mode = IFREG;
+     
+     IN_UNLOCK(newip);
+     vp = ITOV(newip);
+     VN_LOCK(vp);
+     vp->v_type = VREG;
+     VN_UNLOCK(vp);
+     
+     /*
+     if ( !vp->v_object)
+         {
+ 	    extern struct vfs_ubcops ufs_ubcops;
+ 	    extern struct vm_ubc_object* ubc_object_allocate();
+ 	    struct vm_ubc_object* vop;
+ 	    vop = ubc_object_allocate(&vp, &ufs_ubcops,
+ 				      vp->v_mount->m_funnel);
+ 	    VN_LOCK(vp);
+ 	    vp->v_object = vop;
+ 	    VN_UNLOCK(vp);
+         }
+     */
+     
+     IN_LOCK(newip);
+     /*    newip->i_flags |= IC_XUID|IC_XGID; */
+     /*    newip->i_flags &= ~IC_PROPLIST; */
+     newip->i_vicep1 = param1;
+     if (param2 == 0x1fffffff/*INODESPECIAL*/)	{
+ 	newip->i_vicep2 = ((0x1fffffff << 3) + (param4 & 0x3));
+ 	newip->i_vicep3a = (u_short)(param3 >> 16);
+ 	newip->i_vicep3b = (u_short)param3;
+     } else {
+ 	newip->i_vicep2 = (((param2 >> 16) & 0x1f) << 27) +
+ 	    (((param4 >> 16) & 0x1f) << 22) + 
+ 		(param3 & 0x3fffff);	    
+ 	newip->i_vicep3a = (u_short)param4;
+ 	newip->i_vicep3b = (u_short)param2;
+     }
+     newip->i_vicemagic = VICEMAGIC;
+     
+     *retval = newip->i_number;
+     IN_UNLOCK(newip);
+     iput(newip);
+     return(code);
+ }
+ 
+ 
+ afs_syscall_iopen(dev, inode, usrmod, retval)
+      long *retval;
+      int dev, inode, usrmod;
+ {
+     struct file *fp;
+     struct inode *ip;
+     struct vnode *vp = (struct vnode *)0;
+     int dummy;
+     int fd;
+     extern struct fileops vnops;
+     register int code;
+     
+     AFS_STATCNT(afs_syscall_iopen);
+     
+     if (!afs_suser())
+ 	return(EPERM);
+ 
+     code = igetinode(0, (dev_t)dev, (ino_t)inode, &ip, &dummy);
+     if (code) {
+ 	return(code);
+     }
+     if ((code = falloc(curproc, &fp, &fd)) != 0) {
+ 	iput(ip);
+ 	return(code);
+     }
+     IN_UNLOCK(ip);
+     
+     /* FreeBSD doesn't do much mp stuff yet :( */
+     /* FP_LOCK(fp); */
+     fp->f_flag = (usrmod) & FMASK;
+     fp->f_type = DTYPE_VNODE;
+     fp->f_ops = &vnops;
+     fp->f_data = (caddr_t)ITOV(ip);
+     
+     /* FP_UNLOCK(fp); */
+     return(0);
+ }
+ 
+ 
+ /*
+  * Support for iinc() and idec() system calls--increment or decrement
+  * count on inode.
+  * Restricted to super user.
+  * Only VICEMAGIC type inodes.
+  */
+ afs_syscall_iincdec(dev, inode, inode_p1, amount)
+      int dev, inode, inode_p1, amount;
+ {
+     int dummy;
+     struct inode *ip;
+     register int code;
+     
+     if (!afs_suser())
+ 	return(EPERM);
+ 
+     code = igetinode(0, (dev_t)dev, (ino_t)inode, &ip, &dummy);
+     if (code) {
+ 	return(code);
+     }
+     if (!IS_VICEMAGIC(ip)) {
+ 	return(EPERM);
+     } else if (ip->i_vicep1 != inode_p1) {
+ 	return(ENXIO);
+     }
+     ip->i_nlink += amount;
+     if (ip->i_nlink == 0) {
+ 	CLEAR_VICEMAGIC(ip);
+     }
+     ip->i_flag |= ICHG;
+     iput(ip);
+     return(0);
+ }
Index: openafs/src/afs/FBSD/osi_inode.h
diff -c /dev/null openafs/src/afs/FBSD/osi_inode.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_inode.h	Mon Apr 23 03:28:46 2001
***************
*** 0 ****
--- 1,70 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ /*
+  * osi_inode.h
+  *
+  * Inode information required for DUX servers and salvager.
+  */
+ #ifndef _OSI_INODE_H_
+ #define _OSI_INODE_H_
+ 
+ #define BAD_IGET	-1000
+ 
+ #define VICEMAGIC       0xb61cfa84
+ 
+ #define DI_VICEP3(p) \
+ 	( ((u_int)((p)->di_vicep3a)) << 16 | ((u_int)((p)->di_vicep3b)) )
+ #define I_VICE3(p) \
+ 	( ((u_int)((p)->i_vicep3a)) << 16 | ((u_int)((p)->i_vicep3b)) )
+ 
+ #define FAKE_INODE_SIZE    (sizeof(struct vnode)+sizeof(struct inode))
+ #define MOUNTLIST_UNLOCK() simple_lock_unlock(&mountlist_slock)
+ #define MOUNTLIST_LOCK()   simple_lock(&mountlist_slock)
+ 
+ /* FreeBSD doesn't actually have a di_proplb, so we use di_spare[0] */
+ #define di_proplb       di_spare[0]
+ /* For some reason, they're called "oldids" instead of "bc_{u,g}id" */
+ #define di_bcuid        di_u.oldids[0]
+ #define di_bcgid        di_u.oldids[1]
+ 
+ #define i_vicemagic	i_din.di_spare[0]
+ #define i_vicep1	i_din.di_uid
+ #define i_vicep2	i_din.di_gid
+ #define i_vicep3a	i_din.di_u.oldids[0]
+ #define i_vicep3b	i_din.di_u.oldids[1]
+ #define i_vicep4	i_din.di_spare[1]	/* not used */
+ 
+ #define di_vicemagic	di_spare[0]
+ #define di_vicep1	di_uid
+ #define di_vicep2	di_gid
+ #define di_vicep3a	di_u.oldids[0]
+ #define di_vicep3b	di_u.oldids[1]
+ #define di_vicep4	di_spare[1]		/* not used */
+ 
+ /*
+  * Macros for handling inode numbers:
+  *     inode number to file system block offset.
+  *     inode number to cylinder group number.
+  *     inode number to file system block address.
+  */
+ #define itoo(fs, x)     ((x) % INOPB(fs))
+ #define itog(fs, x)     ((x) / (fs)->fs_ipg)
+ #define itod(fs, x) \
+         ((daddr_t)(cgimin(fs, itog(fs, x)) + \
+         (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs))))))
+ 
+ 
+ #define  IS_VICEMAGIC(ip)        ((ip)->i_vicemagic == VICEMAGIC)
+ #define  IS_DVICEMAGIC(dp)       ((dp)->di_vicemagic == VICEMAGIC)
+ 
+ #define  CLEAR_VICEMAGIC(ip)     (ip)->i_vicemagic = 0
+ #define  CLEAR_DVICEMAGIC(dp)    (dp)->di_vicemagic = 0
+ 
+ #endif /* _OSI_INODE_H_ */
Index: openafs/src/afs/FBSD/osi_machdep.h
diff -c /dev/null openafs/src/afs/FBSD/osi_machdep.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_machdep.h	Mon Apr 23 03:28:46 2001
***************
*** 0 ****
--- 1,91 ----
+ /*
+  * 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
+  */
+ 
+ /*
+  *
+  * DUX OSI header file. Extends afs_osi.h.
+  *
+  * afs_osi.h includes this file, which is the only way this file should
+  * be included in a source file. This file can redefine macros declared in
+  * afs_osi.h.
+  */
+ 
+ #ifndef _OSI_MACHDEP_H_
+ #define _OSI_MACHDEP_H_
+ 
+ #include <sys/lock.h>
+ /* #include <kern/sched_prim.h> */
+ /* #include <sys/unix_defs.h> */
+ 
+ #define getpid()		curproc
+ extern struct simplelock afs_rxglobal_lock;
+ 
+ /* 
+  * Time related macros
+  */
+ extern struct timeval time;
+ #define osi_Time() (time.tv_sec)
+ #define	afs_hz	    hz
+ 
+ #define PAGESIZE 8192
+ 
+ #define	AFS_UCRED	ucred
+ #define	AFS_PROC	struct proc
+ 
+ #define afs_bufferpages bufpages
+ 
+ #define osi_vnhold(avc,r)  do { \
+        if ((avc)->vrefCount) { VN_HOLD((struct vnode *)(avc)); } \
+        else osi_Panic("refcnt==0");  } while(0)
+ 
+ #define	gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
+   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
+ 
+ #undef afs_suser
+ 
+ #ifdef KERNEL
+ extern struct simplelock afs_global_lock;
+ #if 0
+ extern thread_t afs_global_owner;
+ #define AFS_GLOCK() \
+     do { \
+ 	usimple_lock(&afs_global_lock); \
+  	osi_Assert(afs_global_owner == (thread_t)0); \
+    	afs_global_owner = current_thread(); \
+     } while (0)
+ #define AFS_GUNLOCK() \
+     do { \
+  	osi_Assert(afs_global_owner == current_thread()); \
+         afs_global_owner = (thread_t)0; \
+ 	usimple_unlock(&afs_global_lock); \
+     } while(0)
+ #define ISAFS_GLOCK() (afs_global_owner == current_thread())
+ #else
+ #define AFS_GLOCK() \
+     do { \
+ 	simple_lock(&afs_global_lock); \
+     } while (0)
+ #define AFS_GUNLOCK() \
+     do { \
+ 	simple_unlock(&afs_global_lock); \
+     } while(0)
+ #endif /* 0 */
+ #define AFS_RXGLOCK()
+ #define AFS_RXGUNLOCK()
+ #define ISAFS_RXGLOCK() 1
+ 
+ #undef SPLVAR
+ #define SPLVAR
+ #undef NETPRI
+ #define NETPRI
+ #undef USERPRI
+ #define USERPRI
+ #endif /* KERNEL */
+ 
+ #endif /* _OSI_MACHDEP_H_ */
Index: openafs/src/afs/FBSD/osi_misc.c
diff -c /dev/null openafs/src/afs/FBSD/osi_misc.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_misc.c	Mon Apr 23 03:28:46 2001
***************
*** 0 ****
--- 1,34 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ /* 
+  * osi_misc.c
+  *
+  * Implements:
+  * afs_suser
+  */
+ 
+ #include "../afs/param.h"	/* Should be always first */
+ #include "../afs/sysincludes.h"	/* Standard vendor system headers */
+ #include "../afs/afsincludes.h"	/* Afs-based standard headers */
+ 
+ /*
+  * afs_suser() returns true if the caller is superuser, false otherwise.
+  *
+  * Note that it must NOT set errno.
+  */
+ 
+ afs_suser() {
+     int error;
+ 
+     if (suser(curproc) == 0) {
+ 	return(1);
+     }
+     return(0);
+ }
Index: openafs/src/afs/FBSD/osi_sleep.c
diff -c /dev/null openafs/src/afs/FBSD/osi_sleep.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_sleep.c	Mon Apr 23 03:28:47 2001
***************
*** 0 ****
--- 1,184 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ 
+ #include "../afs/param.h"	/* Should be always first */
+ #include "../afs/sysincludes.h"	/* Standard vendor system headers */
+ #include "../afs/afsincludes.h"	/* Afs-based standard headers */
+ #include "../afs/afs_stats.h"   /* afs statistics */
+ 
+ 
+ 
+ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
+ void afs_osi_Wakeup(char *event);
+ void afs_osi_Sleep(char *event);
+ 
+ static char waitV;
+ 
+ 
+ void afs_osi_InitWaitHandle(struct afs_osi_WaitHandle *achandle)
+ {
+     AFS_STATCNT(osi_InitWaitHandle);
+     achandle->proc = (caddr_t) 0;
+ }
+ 
+ /* cancel osi_Wait */
+ void afs_osi_CancelWait(struct afs_osi_WaitHandle *achandle)
+ {
+     caddr_t proc;
+ 
+     AFS_STATCNT(osi_CancelWait);
+     proc = achandle->proc;
+     if (proc == 0) return;
+     achandle->proc = (caddr_t) 0;   /* so dude can figure out he was signalled */
+     afs_osi_Wakeup(&waitV);
+ }
+ 
+ /* afs_osi_Wait
+  * Waits for data on ahandle, or ams ms later.  ahandle may be null.
+  * Returns 0 if timeout and EINTR if signalled.
+  */
+ int afs_osi_Wait(afs_int32 ams, struct afs_osi_WaitHandle *ahandle, int aintok)
+ {
+     int code;
+     afs_int32 endTime, tid;
+ 
+     AFS_STATCNT(osi_Wait);
+     endTime = osi_Time() + (ams/1000);
+     if (ahandle)
+       ahandle->proc = (caddr_t) curproc;
+     do {
+ 	AFS_ASSERT_GLOCK();
+ 	code = 0;
+ 	code = osi_TimedSleep(&waitV, ams, aintok);
+ 
+ 	if (code) break;	/* if something happened, quit now */
+ 	/* if we we're cancelled, quit now */
+ 	if (ahandle && (ahandle->proc == (caddr_t) 0)) {
+ 	    /* we've been signalled */
+ 	    break;
+ 	}
+     } while (osi_Time() < endTime);
+     return code;
+ }
+ 
+ 
+ 
+ 
+ typedef struct afs_event {
+     struct afs_event *next;	/* next in hash chain */
+     char *event;		/* lwp event: an address */
+     int refcount;		/* Is it in use? */
+     int seq;			/* Sequence number: this is incremented
+ 				   by wakeup calls; wait will not return until
+ 				   it changes */
+     int cond;
+ } afs_event_t;
+ 
+ #define HASHSIZE 128
+ afs_event_t *afs_evhasht[HASHSIZE];/* Hash table for events */
+ #define afs_evhash(event)	(afs_uint32) ((((long)event)>>2) & (HASHSIZE-1));
+ int afs_evhashcnt = 0;
+ 
+ /* Get and initialize event structure corresponding to lwp event (i.e. address)
+  * */
+ static afs_event_t *afs_getevent(char *event)
+ {
+     afs_event_t *evp, *newp = 0;
+     int hashcode;
+ 
+     AFS_ASSERT_GLOCK();
+     hashcode = afs_evhash(event);
+     evp = afs_evhasht[hashcode];
+     while (evp) {
+ 	if (evp->event == event) {
+ 	    evp->refcount++;
+ 	    return evp;
+ 	}
+ 	if (evp->refcount == 0)
+ 	    newp = evp;
+ 	evp = evp->next;
+     }
+     if (!newp) {
+ 	newp = (afs_event_t *) osi_AllocSmallSpace(sizeof (afs_event_t));
+ 	afs_evhashcnt++;
+ 	newp->next = afs_evhasht[hashcode];
+ 	afs_evhasht[hashcode] = newp;
+ 	newp->seq = 0;
+     }
+     newp->event = event;
+     newp->refcount = 1;
+     return newp;
+ }
+ 
+ /* Release the specified event */
+ #define relevent(evp) ((evp)->refcount--)
+ 
+ 
+ void afs_osi_Sleep(char *event)
+ {
+     struct afs_event *evp;
+     int seq;
+ 
+     evp = afs_getevent(event);
+     seq = evp->seq;
+     while (seq == evp->seq) {
+ 	AFS_ASSERT_GLOCK();
+ 	assert_wait((vm_offset_t)(&evp->cond), 0);
+ 	AFS_GUNLOCK();
+ 	thread_block();
+ 	AFS_GLOCK();
+     }
+     relevent(evp);
+ }
+ 
+ /* osi_TimedSleep
+  * 
+  * Arguments:
+  * event - event to sleep on
+  * ams --- max sleep time in milliseconds
+  * aintok - 1 if should sleep interruptibly
+  *
+  * Returns 0 if timeout and EINTR if signalled.
+  */
+ static int osi_TimedSleep(char *event, afs_int32 ams, int aintok)
+ {
+     int code = 0;
+     struct afs_event *evp;
+     int ticks;
+ 
+     ticks = ( ams * afs_hz )/1000;
+ 
+ 
+     evp = afs_getevent(event);
+ 
+     assert_wait((vm_offset_t)(&evp->cond), aintok);
+     AFS_GUNLOCK();
+     thread_set_timeout(ticks);
+     thread_block();
+     AFS_GLOCK();
+     /*    if (current_thread()->wait_result != THREAD_AWAKENED)
+ 	  code = EINTR; */
+     
+     relevent(evp);
+     return code;
+ }
+ 
+ 
+ void afs_osi_Wakeup(char *event)
+ {
+     struct afs_event *evp;
+ 
+     evp = afs_getevent(event);
+     if (evp->refcount > 1) {
+ 	evp->seq++;    
+ 	thread_wakeup((vm_offset_t)(&evp->cond));
+     }
+     relevent(evp);
+ }
Index: openafs/src/afs/FBSD/osi_vfsops.c
diff -c /dev/null openafs/src/afs/FBSD/osi_vfsops.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_vfsops.c	Mon Apr 23 03:28:47 2001
***************
*** 0 ****
--- 1,481 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ /*
+  * osi_vfsops.c for DUX
+  */
+ #include "../afs/param.h"	/* Should be always first */
+ #include "../afs/sysincludes.h"	/* Standard vendor system headers */
+ #include "../afs/afsincludes.h"	/* Afs-based standard headers */
+ #include "../afs/afs_stats.h"   /* statistics stuff */
+ #include <sys/types.h>
+ #include <kern/mach_param.h>
+ #include <sys/sysconfig.h>
+ #include <sys/systm.h>
+ #include <sys/resource.h>
+ #include <sys/errno.h>
+ #include <sys/conf.h>
+ #include <machine/machlimits.h>
+ 
+ 
+ struct vcache *afs_globalVp = 0;
+ struct mount *afs_globalVFS = 0;
+ 
+ static u_char afs_mntid;
+ int afs_vfsdev = 0;
+ udecl_simple_lock_data(, afsmntid_lock)
+ #define AFSMNTID_LOCK()         usimple_lock(&afsmntid_lock)
+ #define AFSMNTID_UNLOCK()       usimple_unlock(&afsmntid_lock)
+ #define AFSMNTID_LOCK_INIT()    usimple_lock_init(&afsmntid_lock)
+ 
+ 
+ int mp_afs_mount(struct mount *afsp,char * path, caddr_t data,
+ 		 struct nameidata *ndp)
+ {
+     u_int size;
+ 
+     fsid_t tfsid;
+     struct mount *xmp, *getvfs();
+     int code;
+ 
+     AFS_GLOCK();
+     AFS_STATCNT(afs_mount);
+ 
+     if (afs_globalVFS) { /* Don't allow remounts. */
+ 	AFS_GUNLOCK();
+ 	return (EBUSY);
+     }
+ 
+     afs_globalVFS = afsp;
+     afsp->vfs_bsize = 8192;
+ /*
+  * Generate a unique afs mount i.d. ( see nfs_mount() ).
+  */
+     afsp->m_stat.f_fsid.val[0] = makedev(130, 0);
+     afsp->m_stat.f_fsid.val[1] = MOUNT_AFS;
+     AFSMNTID_LOCK();
+     if (++afs_mntid == 0)
+         ++afs_mntid;
+     AFSMNTID_UNLOCK();
+     BM(AFSMNTID_LOCK());
+     tfsid.val[0] = makedev(130, afs_mntid);
+     tfsid.val[1] = MOUNT_AFS;
+     BM(AFSMNTID_UNLOCK());
+ 
+     while (xmp = getvfs(&tfsid)) {
+         UNMOUNT_READ_UNLOCK(xmp);
+         tfsid.val[0]++;
+         AFSMNTID_LOCK();
+         afs_mntid++;
+         AFSMNTID_UNLOCK();
+     }
+     if (major(tfsid.val[0]) != 130) {
+ 	AFS_GUNLOCK();
+         return (ENOENT);
+     }
+     afsp->m_stat.f_fsid.val[0] = tfsid.val[0];
+ 
+     afsp->m_stat.f_mntonname = AFS_KALLOC(MNAMELEN);
+     afsp->m_stat.f_mntfromname = AFS_KALLOC(MNAMELEN); 
+     if ( !afsp->m_stat.f_mntonname || !afsp->m_stat.f_mntfromname)
+ 	panic("malloc failure in afs_mount\n");
+ 
+     bzero(afsp->m_stat.f_mntonname, MNAMELEN);
+     bzero(afsp->m_stat.f_mntfromname, MNAMELEN);
+     AFS_COPYINSTR(path, (caddr_t)afsp->m_stat.f_mntonname, MNAMELEN, &size, code);
+     bcopy("AFS", afsp->m_stat.f_mntfromname, 4);
+     AFS_GUNLOCK();
+     (void) mp_afs_statfs(afsp);
+     AFS_GLOCK();
+     afs_vfsdev = afsp->m_stat.f_fsid.val[0];
+ 
+ #ifndef	AFS_NONFSTRANS
+     /* Set up the xlator in case it wasn't done elsewhere */
+     afs_xlatorinit_v2();
+     afs_xlatorinit_v3();
+ #endif
+     AFS_GUNLOCK();
+     return 0;
+ }
+ 
+ 
+ int mp_afs_unmount (struct mount *afsp, int flag)
+ {
+     AFS_GLOCK();
+     AFS_STATCNT(afs_unmount);
+     afs_globalVFS = 0;
+     afs_shutdown();
+     AFS_GUNLOCK();
+     return 0;
+ }
+ 
+ 
+ int mp_afs_start(struct mount *mp, int flags)
+ {
+     return(0);
+ }
+ 
+ int mp_afs_root (struct mount *afsp, struct vnode **avpp)
+ {
+     register afs_int32 code = 0;
+     struct vrequest treq;
+     register struct vcache *tvp=0;
+ 
+     AFS_GLOCK();
+     AFS_STATCNT(afs_root);
+     if (afs_globalVp && (afs_globalVp->states & CStatd)) {
+ 	tvp = afs_globalVp;
+     } else {
+ 	if (!(code = afs_InitReq(&treq, cred)) &&
+ 	    !(code = afs_CheckInit())) {
+ 	    tvp = afs_GetVCache(&afs_rootFid, &treq, (afs_int32 *)0,
+ 				(struct vcache*)0, WRITE_LOCK);
+ 	    /* we really want this to stay around */
+ 	    if (tvp) {
+ 		afs_globalVp = tvp;
+ 	    } else
+ 		code = ENOENT;
+ 	}
+     }
+     if (tvp) {
+ 	AFS_GUNLOCK();
+ 	VN_HOLD((struct vnode *)tvp);
+ 	VN_LOCK((struct vnode *)tvp);
+ 	tvp->v.v_flag |= VROOT;	    /* No-op on Ultrix 2.2 */
+ 	VN_UNLOCK((struct vnode *)tvp);
+ 	AFS_GLOCK();
+ 
+ 	afs_globalVFS = afsp;
+ 	*avpp = (struct vnode *) tvp;
+     }
+ 
+     afs_Trace2(afs_iclSetp, CM_TRACE_VFSROOT, ICL_TYPE_POINTER, *avpp,
+ 	       ICL_TYPE_INT32, code);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ 
+ mp_afs_quotactl(struct mount *mp, int cmd, uid_t uid, caddr_t arg)
+ {
+     return EOPNOTSUPP;
+ }
+ 
+ int mp_afs_statfs(struct mount *afsp)
+ {
+     struct nstatfs *abp = &afsp->m_stat;
+ 
+     AFS_GLOCK();
+     AFS_STATCNT(afs_statfs);
+ 
+     abp->f_type = MOUNT_AFS;
+     abp->f_bsize = afsp->vfs_bsize;
+ 
+     /* Fake a high number below to satisfy programs that use the statfs call
+      * to make sure that there's enough space in the device partition before
+      * storing something there.
+      */
+     abp->f_blocks = abp->f_bfree = abp->f_bavail = abp->f_files =
+ 	abp->f_ffree  = 2000000;
+     abp->f_fsize = 1024;
+ 
+     abp->f_fsid.val[0] = afsp->m_stat.f_fsid.val[0];
+     abp->f_fsid.val[1] = afsp->m_stat.f_fsid.val[1];
+ 
+     AFS_GUNLOCK();
+     return 0;
+ }
+ 
+ 
+ int mp_afs_sync(struct mount *mp, int flags)
+ {
+     AFS_STATCNT(afs_sync);
+     return 0;
+ }
+ 
+ 
+ int mp_afs_fhtovp(struct mount *afsp, struct fid *fidp, struct vnode **avcp)
+ {
+     struct vrequest treq;
+     register code = 0;
+ 
+     AFS_GLOCK();
+     AFS_STATCNT(afs_vget);
+ 
+     *avcp = NULL;
+ 
+     if ((code = afs_InitReq(&treq, cred)) == 0) {
+ 	code = afs_osi_vget((struct vcache**)avcp, fidp, &treq);
+     }
+ 
+     afs_Trace3(afs_iclSetp, CM_TRACE_VGET, ICL_TYPE_POINTER, *avcp,
+ 	       ICL_TYPE_INT32, treq.uid, ICL_TYPE_FID, fidp);
+ 
+     code = afs_CheckCode(code, &treq, 42);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ 
+ /*
+  *  afs_vptofh
+  * 
+  * afs_vptofh can return two flavors of NFS fid, depending on if submounts are
+  * allowed. The reason for this is that we can't guarantee that we found all 
+  * the entry points any OS might use to get the fid for the NFS mountd.
+  * Hence we return a "magic" fid for all but /afs. If it goes through the
+  * translator code, it will get transformed into a SmallFid that we recognize.
+  * So, if submounts are disallowed, and an NFS client tries a submount, it will
+  * get a fid which we don't recognize and the mount will either fail or we
+  * will ignore subsequent requests for that mount.
+  *
+  * The Alpha fid is organized differently than for other platforms. Their
+  * intention was to have the data portion of the fid aligned on a 4 byte
+  * boundary. To do so, the fid is organized as:
+  * u_short reserved
+  * u_short len
+  * char data[8]
+  * The len field is the length of the entire fid, from reserved through data.
+  * This length is used by fid_copy to include copying the reserved field. 
+  * Alpha's zero the reserved field before handing us the fid, but they use
+  * it in fid_cmp. We use the reserved field to store the 16 bits of the Vnode.
+  *
+  * Note that the SmallFid only allows for 8 bits of the cell index and
+  * 16 bits of the vnode. 
+  */
+ 
+ #define AFS_FIDDATASIZE 8
+ #define AFS_SIZEOFSMALLFID 12 /* full size of fid, including len field */
+ extern int afs_NFSRootOnly; /* 1 => only allow NFS mounts of /afs. */
+ int afs_fid_vnodeoverflow=0, afs_fid_uniqueoverflow=0;
+ 
+ int mp_afs_vptofh(struct vnode *avn, struct fid *fidp)
+ {
+     struct SmallFid Sfid;
+     long addr[2];
+     register struct cell *tcell;
+     int rootvp = 0;
+     struct vcache *avc = (struct vcache *)avn;
+ 
+     AFS_GLOCK();
+     AFS_STATCNT(afs_fid);
+ 
+     if (afs_shuttingdown) {
+ 	AFS_GUNLOCK();
+ 	return EIO;
+     }
+ 
+     if (afs_NFSRootOnly && (avc == afs_globalVp)) rootvp = 1;
+     if (!afs_NFSRootOnly || rootvp) {
+ 	tcell = afs_GetCell(avc->fid.Cell, READ_LOCK);
+ 	Sfid.Volume = avc->fid.Fid.Volume;
+ 	fidp->fid_reserved = avc->fid.Fid.Vnode;
+ 	Sfid.CellAndUnique = ((tcell->cellIndex << 24) +
+ 			      (avc->fid.Fid.Unique & 0xffffff));
+ 	afs_PutCell(tcell, READ_LOCK);
+ 	if (avc->fid.Fid.Vnode > 0xffff)
+ 	    afs_fid_vnodeoverflow++;
+ 	if (avc->fid.Fid.Unique > 0xffffff)
+ 	    afs_fid_uniqueoverflow++;
+     } else {
+ 	fidp->fid_reserved = AFS_XLATOR_MAGIC;
+ 	addr[0] = (long)avc;
+ 	AFS_GUNLOCK();
+ 	VN_HOLD((struct vnode *)avc);
+ 	AFS_GLOCK();
+     }
+ 
+     /* Use the fid pointer passed to us. */
+     fidp->fid_len = AFS_SIZEOFSMALLFID;
+     if (afs_NFSRootOnly) {
+ 	if (rootvp) {
+ 	    bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE);   
+ 	} else {
+ 	    bcopy((caddr_t)addr, fidp->fid_data, AFS_FIDDATASIZE);   
+ 	}
+     } else {
+ 	bcopy((caddr_t)&Sfid, fidp->fid_data, AFS_FIDDATASIZE);   
+     }
+     AFS_GUNLOCK();
+     return 0;
+ }
+ 
+ 
+ int mp_Afs_init(void); /* vfs_init - defined below */
+ 
+ 
+ /* This is only called by vfs_mount when afs is going to be mounted as root.
+  * Since we don't support diskless clients we shouldn't come here.
+  */
+ int afsmountroot=0;
+ int mp_afs_mountroot(struct mount *afsp, struct vnode **vp)
+ {
+     AFS_GLOCK();
+     AFS_STATCNT(afs_mountroot);
+     afsmountroot++;
+     AFS_GUNLOCK();
+     return EINVAL;
+ }
+ 
+ 
+ /* It's called to setup swapping over the net for diskless clients; again
+  * not for us.
+  */
+ int afsswapvp=0;
+ int mp_afs_swapvp(void)
+ {
+     AFS_GLOCK();
+     AFS_STATCNT(afs_swapvp);
+     afsswapvp++;
+     AFS_GUNLOCK();
+     return EINVAL;
+ }
+ 
+ 
+ struct vfsops afs_vfsops = {
+     mp_afs_mount,
+     mp_afs_start,
+     mp_afs_unmount,
+     mp_afs_root,
+     mp_afs_quotactl,
+     mp_afs_statfs,
+     mp_afs_sync,
+     mp_afs_fhtovp,	/* afs_vget */
+     mp_afs_vptofh,
+     mp_Afs_init,
+     mp_afs_mountroot,
+     mp_afs_swapvp
+ };
+ 
+ 
+ /*
+  * System Call Entry Points
+  */
+ #define NULL_FUNC          (int (*)(int))0
+ 
+ int     (*afs_syscall_func)() = NULL_FUNC;
+ int     (*afs_xsetgroups_func)() = NULL_FUNC;
+ int     (*afs_xioctl_func)() = NULL_FUNC;
+ 
+ afssyscall(p, args, retval)
+     struct proc *p;
+     void *args;
+     long *retval;
+ {
+     int     (*func)();
+     int code;
+ 
+     AFS_GLOCK();
+     func = afs_syscall_func;
+     if (func == NULL_FUNC) {
+ 	code = nosys(p, args, retval);
+     } else {
+ 	code = (*func)(p, args, retval);
+     }
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ afsxsetgroups(p, args, retval)
+     struct proc *p;
+     void *args;
+     long *retval;
+ {
+     int     (*func)();
+     int code;
+ 
+     AFS_GLOCK();
+     func = afs_xsetgroups_func;
+     if (func == NULL_FUNC) {
+ 	code = nosys(p, args, retval);
+     } else {
+ 	code = (*func)(p, args, retval);
+     }
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ afsxioctl(p, args, retval)
+     struct proc *p;
+     void *args;
+     long *retval;
+ {
+     int     (*func)();
+     int code;
+ 
+     AFS_GLOCK();
+     func = afs_xioctl_func;
+     if (func == NULL_FUNC) {
+ 	code = nosys(p, args, retval);
+     } else {
+ 	code = (*func)(p, args, retval);
+     }
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ 
+ /*
+  * VFS initialization and unload
+  */
+ 
+ afs_unconfig()
+ {
+     return EBUSY;
+ }
+ 
+ 
+ cfg_subsys_attr_t afs_attributes[]  = {
+     {"", 0, 0, 0, 0, 0, 0}	/* must be the last element */
+ };
+ 
+ afs_configure(cfg_op_t op, caddr_t indata, size_t indata_size, caddr_t outdata, size_t outdata_size)
+ {
+     cfg_attr_t	*attributes;
+     int	ret = ESUCCESS;
+     int	i, j, size;
+     caddr_t p;
+ 
+     switch (op) {
+     case CFG_OP_CONFIGURE:
+ 	/*
+ 	 * The indata parameter is a list of attributes to be configured, and 
+ 	 * indata_size is the count of attributes.
+ 	 */
+ 	if ((ret = vfssw_add_fsname(MOUNT_AFS, &afs_vfsops, "afs")) != 0)
+ 	    return(ret);
+ 	break;
+     case CFG_OP_UNCONFIGURE:
+ 	if ((ret = afs_unconfig()) != 0)
+ 	    return(ret);
+ 	break;
+     default:
+ 	ret = EINVAL;
+ 	break;
+     }
+     return ret;
+ }
+ 
+ 
+ int mp_Afs_init(void)
+ {
+     extern int Afs_xsetgroups(), afs_xioctl(), afs3_syscall();
+     
+     AFS_GLOCK();
+     sysent[AFS_SYSCALL].sy_call = afs3_syscall;
+     sysent[AFS_SYSCALL].sy_parallel = 0;
+     sysent[AFS_SYSCALL].sy_narg = 6;
+     sysent[SYS_setgroups].sy_call = Afs_xsetgroups;
+     afs_xioctl_func = afsxioctl;    
+     afs_xsetgroups_func = afsxsetgroups;
+     afs_syscall_func = afssyscall;
+     AFS_GUNLOCK();
+ 
+     return 0;
+ }
Index: openafs/src/afs/FBSD/osi_vm.c
diff -c /dev/null openafs/src/afs/FBSD/osi_vm.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_vm.c	Mon Apr 23 03:28:47 2001
***************
*** 0 ****
--- 1,210 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ 
+ /* osi_vm.c implements:
+  *
+  * osi_VM_FlushVCache(avc, slept)
+  * osi_ubc_flush_dirty_and_wait(vp, flags)
+  * osi_VM_StoreAllSegments(avc)
+  * osi_VM_TryToSmush(avc, acred, sync)
+  * osi_VM_FlushPages(avc, credp)
+  * osi_VM_Truncate(avc, alen, acred)
+  */
+ 
+ #include "../afs/param.h"	/* Should be always first */
+ #include "../afs/sysincludes.h"	/* Standard vendor system headers */
+ #include "../afs/afsincludes.h"	/* Afs-based standard headers */
+ #include "../afs/afs_stats.h"  /* statistics */
+ /* #include <vm/vm_ubc.h> */
+ #include <limits.h>
+ #include <float.h>
+ 
+ /* Try to discard pages, in order to recycle a vcache entry.
+  *
+  * We also make some sanity checks:  ref count, open count, held locks.
+  *
+  * We also do some non-VM-related chores, such as releasing the cred pointer
+  * (for AIX and Solaris) and releasing the gnode (for AIX).
+  *
+  * Locking:  afs_xvcache lock is held.  If it is dropped and re-acquired,
+  *   *slept should be set to warn the caller.
+  *
+  * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it
+  * is not dropped and re-acquired for any platform.  It may be that *slept is
+  * therefore obsolescent.
+  *
+  * OSF/1 Locking:  VN_LOCK has been called.
+  */
+ int
+ osi_VM_FlushVCache(avc, slept)
+     struct vcache *avc;
+     int *slept;
+ {
+ #ifdef SECRETLY_OSF1
+     if (avc->vrefCount > 1)
+ 	return EBUSY;
+ 
+     if (avc->opens)
+ 	return EBUSY;
+ 
+     /* if a lock is held, give up */
+     if (CheckLock(&avc->lock) || afs_CheckBozonLock(&avc->pvnLock))
+ 	return EBUSY;
+ 
+     AFS_GUNLOCK();
+     ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+     AFS_GLOCK();
+ #endif /* SECRETLY_OSF1 */
+ 
+     return 0;
+ }
+ 
+ /*
+  * osi_ubc_flush_dirty_and_wait -- ensure all dirty pages cleaned
+  *
+  * Alpha OSF/1 doesn't make it easy to wait for all dirty pages to be cleaned.
+  * NFS tries to do this by calling waitforio(), which waits for v_numoutput
+  * to go to zero.  But that isn't good enough, because afs_putpage() doesn't
+  * increment v_numoutput until it has obtained the vcache entry lock.  Suppose
+  * that Process A, trying to flush a page, is waiting for that lock, and
+  * Process B tries to close the file.  Process B calls waitforio() which thinks
+  * that everything is cool because v_numoutput is still zero.  Process B then
+  * proceeds to call afs_StoreAllSegments().  Finally when B is finished, A gets
+  * to proceed and flush its page.  But then it's too late because the file is
+  * already closed.
+  *
+  * (I suspect that waitforio() is not adequate for NFS, just as it isn't
+  * adequate for us.  But that's not my problem.)
+  *
+  * The only way we can be sure that there are no more dirty pages is if there
+  * are no more pages with pg_busy set.  We look for them on the cleanpl.
+  *
+  * For some reason, ubc_flush_dirty() only looks at the dirtypl, not the
+  * dirtywpl.  I don't know why this is good enough, but I assume it is.  By
+  * the same token, I only look for busy pages on the cleanpl, not the cleanwpl.
+  *
+  * Called with the global lock NOT held.
+  */
+ void
+ osi_ubc_flush_dirty_and_wait(vp, flags)
+ struct vnode *vp;
+ int flags; {
+     int retry;
+     vm_page_t pp;
+     int first;
+ 
+ #ifdef SECRETLY_OSF1
+     do {
+ 	struct vm_ubc_object* vop;
+ 	vop = (struct vm_ubc_object*)(vp->v_object);
+ 	ubc_flush_dirty(vop, flags); 
+ 
+ 	vm_object_lock(vop);
+ 	if (vop->vu_dirtypl)
+ 	    /* shouldn't happen, but who knows */
+ 	    retry = 1;
+ 	else {
+ 	    retry = 0;
+ 	    if (vop->vu_cleanpl) {
+ 		for (first = 1, pp = vop->vu_cleanpl;
+ 		     first || pp != vop->vu_cleanpl;
+ 		     first = 0, pp = pp->pg_onext) {
+ 		    if (pp->pg_busy) {
+ 			retry = 1;
+ 			pp->pg_wait = 1;
+ 			assert_wait_mesg((vm_offset_t)pp, FALSE, "pg_wait");
+ 			vm_object_unlock(vop);
+ 			thread_block();
+ 			break;
+ 		    }
+ 		}
+ 	    }
+ 	    if (retry) continue;
+ 	}
+ 	vm_object_unlock(vop);
+     } while (retry);
+ #endif /* SECRETLY_OSF1 */
+ }
+ 
+ /* Try to store pages to cache, in order to store a file back to the server.
+  *
+  * Locking:  the vcache entry's lock is held.  It will usually be dropped and
+  * re-obtained.
+  */
+ void
+ osi_VM_StoreAllSegments(avc)
+     struct vcache *avc;
+ {
+ #ifdef SECRETLY_OSF1
+     ReleaseWriteLock(&avc->lock);
+     AFS_GUNLOCK();
+     osi_ubc_flush_dirty_and_wait((struct vnode *)avc, 0);
+     AFS_GLOCK();
+     ObtainWriteLock(&avc->lock,94);
+ #endif /* SECRETLY_OSF1 */
+ }
+ 
+ /* Try to invalidate pages, for "fs flush" or "fs flushv"; or
+  * try to free pages, when deleting a file.
+  *
+  * Locking:  the vcache entry's lock is held.  It may be dropped and 
+  * re-obtained.
+  *
+  * Since we drop and re-obtain the lock, we can't guarantee that there won't
+  * be some pages around when we return, newly created by concurrent activity.
+  */
+ void
+ osi_VM_TryToSmush(avc, acred, sync)
+     struct vcache *avc;
+     struct AFS_UCRED *acred;
+     int sync;
+ {
+ #ifdef SECRETLY_OSF1
+     ReleaseWriteLock(&avc->lock);
+     AFS_GUNLOCK();
+     osi_ubc_flush_dirty_and_wait((struct vnode *)avc, 0);
+     ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+     AFS_GLOCK();
+     ObtainWriteLock(&avc->lock,59);
+ #endif /* SECRETLY_OSF1 */
+ }
+ 
+ /* Purge VM for a file when its callback is revoked.
+  *
+  * Locking:  No lock is held, not even the global lock.
+  */
+ void
+ osi_VM_FlushPages(avc, credp)
+     struct vcache *avc;
+     struct AFS_UCRED *credp;
+ {
+ #ifdef SECRETLY_OSF1
+     ubc_flush_dirty(((struct vnode *)avc)->v_object, 0);
+     ubc_invalidate(((struct vnode *)avc)->v_object, 0, 0, B_INVAL);
+ #endif /* SECRETLY_OSF1 */
+ }
+ 
+ /* Purge pages beyond end-of-file, when truncating a file.
+  *
+  * Locking:  no lock is held, not even the global lock.
+  * activeV is raised.  This is supposed to block pageins, but at present
+  * it only works on Solaris.
+  */
+ void
+ osi_VM_Truncate(avc, alen, acred)
+     struct vcache *avc;
+     int alen;
+     struct AFS_UCRED *acred;
+ {
+ #ifdef SECRETLY_OSF1
+     ubc_invalidate(((struct vnode *)avc)->v_object, alen,
+                         MAXINT - alen, B_INVAL);
+ #endif /* SECRETLY_OSF1 */
+ }
Index: openafs/src/afs/FBSD/osi_vnodeops.c
diff -c /dev/null openafs/src/afs/FBSD/osi_vnodeops.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/osi_vnodeops.c	Mon Apr 23 03:28:48 2001
***************
*** 0 ****
--- 1,1091 ----
+ /*
+  * 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
+  */
+ 
+ /*
+  * vnodeops structure and Digital Unix specific ops and support routines.
+  */
+ 
+ #include "../afs/param.h"	/* Should be always first */
+ 
+ #include "../afs/sysincludes.h"	/* Standard vendor system headers */
+ #include "../afs/afsincludes.h"	/* Afs-based standard headers */
+ #include "../afs/afs_stats.h" /* statistics */
+ #include <vm/vm.h>
+ #include <vm/vnode_pager.h>
+ #include <vm/vm_map.h>
+ /* #include <vm/vm_ubc.h> */
+ #include "../afs/afs_cbqueue.h"
+ #include "../afs/nfsclient.h"
+ #include "../afs/afs_osidnlc.h"
+ 
+ 
+ extern int afs_lookup(), afs_create(), afs_noop(), afs_open(), afs_close();
+ extern int afs_access(), afs_getattr(), afs_setattr(), afs_badop();
+ extern int afs_fsync(), afs_seek(), afs_remove(), afs_link(), afs_rename();
+ extern int afs_mkdir(), afs_rmdir(), afs_symlink(), afs_readdir();
+ extern int afs_readlink(), afs_lockctl();
+ extern int vn_pathconf_default(), seltrue();
+ 
+ int mp_afs_lookup(), mp_afs_create(), mp_afs_open();
+ int mp_afs_access(), mp_afs_getattr(), mp_afs_setattr(), mp_afs_ubcrdwr();
+ int mp_afs_ubcrdwr(), mp_afs_mmap();
+ int mp_afs_fsync(), mp_afs_seek(), mp_afs_remove(), mp_afs_link();
+ int mp_afs_rename(), mp_afs_mkdir(), mp_afs_rmdir(), mp_afs_symlink();
+ int mp_afs_readdir(), mp_afs_readlink(), mp_afs_abortop(), mp_afs_inactive();
+ int mp_afs_reclaim(), mp_afs_bmap(), mp_afs_strategy(), mp_afs_print();
+ int mp_afs_page_read(), mp_afs_page_write(), mp_afs_swap(), mp_afs_bread();
+ int mp_afs_brelse(), mp_afs_lockctl(), mp_afs_syncdata(), mp_afs_close();
+ int mp_afs_closex();
+ 
+ #if 0
+ /* AFS vnodeops */
+ struct vnodeops Afs_vnodeops = {
+ 	mp_afs_lookup,
+ 	mp_afs_create,
+ 	afs_noop,	/* vn_mknod */
+ 	mp_afs_open,
+ 	mp_afs_close,
+ 	mp_afs_access,
+ 	mp_afs_getattr,
+ 	mp_afs_setattr,
+ 	mp_afs_ubcrdwr,
+ 	mp_afs_ubcrdwr,
+ 	afs_badop,	/* vn_ioctl */
+ 	seltrue,	/* vn_select */
+ 	mp_afs_mmap,
+ 	mp_afs_fsync,
+ 	mp_afs_seek,
+ 	mp_afs_remove,
+ 	mp_afs_link,
+ 	mp_afs_rename,
+ 	mp_afs_mkdir,
+ 	mp_afs_rmdir,
+ 	mp_afs_symlink,
+ 	mp_afs_readdir,
+ 	mp_afs_readlink,
+ 	mp_afs_abortop,
+ 	mp_afs_inactive,
+ 	mp_afs_reclaim,
+ 	mp_afs_bmap,
+ 	mp_afs_strategy,
+ 	mp_afs_print,
+ 	mp_afs_page_read,
+ 	mp_afs_page_write,
+ 	mp_afs_swap,
+ 	mp_afs_bread,
+ 	mp_afs_brelse,
+ 	mp_afs_lockctl,
+ 	mp_afs_syncdata,
+ 	afs_noop,	/* Lock */
+ 	afs_noop,	/* unLock */
+ 	afs_noop,	/* get ext attrs */
+ 	afs_noop,	/* set ext attrs */
+ 	afs_noop,	/* del ext attrs */
+ 	vn_pathconf_default,
+ };
+ struct vnodeops *afs_ops = &Afs_vnodeops;
+ #endif /* 0 */
+ 
+ /* vnode file operations, and our own */
+ extern int vn_read();
+ extern int vn_write();
+ extern int vn_ioctl();
+ extern int vn_select();
+ extern int afs_closex();
+ 
+ struct fileops afs_fileops = {
+     vn_read,
+     vn_write,
+     vn_ioctl,
+     vn_select,
+     mp_afs_closex,
+ };
+ 
+ #if 0
+ mp_afs_lookup(adp, ndp)
+     struct vcache *adp;
+     struct nameidata *ndp;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_lookup(adp, ndp);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_create(ndp, attrs)
+     struct nameidata *ndp;
+     struct vattr *attrs;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_create(ndp, attrs);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_open(avcp, aflags, acred)
+     struct vcache **avcp;
+     afs_int32 aflags;
+     struct AFS_UCRED *acred;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_open(avcp, aflags, acred);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_access(avc, amode, acred)
+     struct vcache *avc;
+     afs_int32 amode;
+     struct AFS_UCRED *acred;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_access(avc, amode, acred);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_close(avc, flags, cred)
+     struct vnode *avc;
+     int flags;
+     struct ucred *cred;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_close(avc, flags, cred);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_getattr(avc, attrs, acred)
+     struct vcache *avc;
+     struct vattr *attrs;
+     struct AFS_UCRED *acred;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_getattr(avc, attrs, acred);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_setattr(avc, attrs, acred)
+     struct vcache *avc;
+     struct vattr *attrs;
+     struct AFS_UCRED *acred;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_setattr(avc, attrs, acred);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_fsync(avc, fflags, acred, waitfor)
+     struct vcache *avc;
+     int fflags;
+     struct AFS_UCRED *acred;
+     int waitfor;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_fsync(avc, fflags, acred, waitfor);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_remove(ndp)
+     struct nameidata *ndp;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_remove(ndp);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_link(avc, ndp)
+     struct vcache *avc;
+     struct nameidata *ndp;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_link(avc, ndp);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_rename(fndp, tndp)
+     struct nameidata *fndp, *tndp;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_rename(fndp, tndp);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_mkdir(ndp, attrs)
+     struct nameidata *ndp;
+     struct vattr *attrs;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_mkdir(ndp, attrs);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_rmdir(ndp)
+     struct nameidata *ndp;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_rmdir(ndp);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_symlink(ndp, attrs, atargetName)
+     struct nameidata *ndp;
+     struct vattr *attrs;
+     register char *atargetName;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_symlink(ndp, attrs, atargetName);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_readdir(avc, auio, acred, eofp)
+     struct vcache *avc;
+     struct uio *auio;
+     struct AFS_UCRED *acred;
+     int *eofp;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_readdir(avc, auio, acred, eofp);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_readlink(avc, auio, acred)
+     struct vcache *avc;
+     struct uio *auio;
+     struct AFS_UCRED *acred;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_readlink(avc, auio, acred);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_lockctl(avc, af, flag, acred, clid, offset)
+     struct vcache *avc;
+     struct eflock *af;
+     struct AFS_UCRED *acred;
+     int flag;
+     pid_t clid;
+     off_t offset;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_lockctl(avc, af, flag, acred, clid, offset);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_closex(afd)
+     struct file *afd;
+ {
+     int code;
+     AFS_GLOCK();
+     code = afs_closex(afd);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ mp_afs_seek(avc, oldoff, newoff, cred)
+     struct vcache *avc;
+     off_t oldoff, newoff;
+     struct ucred *cred;
+ {
+     if ((int) newoff < 0)
+ 	return(EINVAL);
+     else
+ 	return(0);
+ }
+ 
+ mp_afs_abortop(ndp)
+     struct nameidata *ndp;
+ {
+     return(0);
+ }
+ 
+ mp_afs_inactive(avc, acred)
+     register struct vcache *avc;
+     struct AFS_UCRED *acred;
+ {
+     AFS_GLOCK();
+     afs_InactiveVCache(avc, acred);
+     AFS_GUNLOCK();
+ }
+ 
+ 
+ mp_afs_reclaim(avc)
+     struct vcache *avc;
+ {
+     return(0);
+ }
+ 
+ mp_afs_print(avc)
+     struct vcache *avc;
+ {
+     return(0);
+ }
+ 
+ mp_afs_page_read(avc, uio, acred)
+     struct vcache *avc;
+     struct uio *uio;
+     struct ucred *acred;
+ {
+     int error;
+     struct vrequest treq;
+ 
+     AFS_GLOCK();
+     error = afs_rdwr(avc, uio, UIO_READ, 0, acred);
+     afs_Trace3(afs_iclSetp, CM_TRACE_PAGE_READ, ICL_TYPE_POINTER, avc,
+ 	       ICL_TYPE_INT32, error,  ICL_TYPE_INT32, avc->states);
+     if (error) {
+ 	error = EIO;
+     } else if ((avc->states) == 0) {
+ 	afs_InitReq(&treq, acred);
+ 	ObtainWriteLock(&avc->lock,161);
+ 	afs_Wire(avc, &treq);
+ 	ReleaseWriteLock(&avc->lock);
+     }
+     AFS_GUNLOCK();
+     return(error);
+ }
+ 
+ 
+ mp_afs_page_write(avc, uio, acred, pager, offset)
+     struct vcache *avc;
+     struct uio *uio;
+     struct ucred *acred;
+     memory_object_t pager;
+     vm_offset_t     offset;
+ {
+     int error;
+ 
+     AFS_GLOCK();
+     error = afs_rdwr(avc, uio, UIO_WRITE, 0, acred);
+     afs_Trace3(afs_iclSetp, CM_TRACE_PAGE_WRITE, ICL_TYPE_POINTER, avc,
+ 	       ICL_TYPE_INT32, error, ICL_TYPE_INT32, avc->states);
+     if (error) {
+ 	error = EIO;
+     }
+     AFS_GUNLOCK();
+     return(error);
+ }
+ 
+ 
+ int DO_FLUSH=1;
+ mp_afs_ubcrdwr(avc, uio, ioflag, cred)
+     struct vcache *avc;
+     struct uio *uio;
+     int ioflag;
+     struct ucred *cred;
+ {
+     register afs_int32 code;
+     register char *data;
+     afs_int32 fileBase, size, cnt=0;
+     afs_int32 pageBase;
+     register afs_int32 tsize;
+     register afs_int32 pageOffset;
+     int eof;
+     struct vrequest treq;
+     int rw = uio->uio_rw;
+     int rv, flags;
+     int newpage=0;
+     vm_page_t page;
+     afs_int32 save_resid;
+     struct dcache *tdc;
+     int didFakeOpen=0;
+     int counter=0;
+ 
+     AFS_GLOCK();
+     afs_InitReq(&treq, cred);
+     if (AFS_NFSXLATORREQ(cred) && rw == UIO_READ) {
+ 	if (!afs_AccessOK(avc, PRSFS_READ, &treq,
+ 			  CHECK_MODE_BITS|CMB_ALLOW_EXEC_AS_READ))  {
+ 	    AFS_GUNLOCK();
+ 	    return EACCES;
+ 	}
+     }
+     afs_Trace4(afs_iclSetp, CM_TRACE_VMRW, ICL_TYPE_POINTER, avc,
+ 	       ICL_TYPE_INT32, (rw==UIO_WRITE? 1 : 0),
+ 	       ICL_TYPE_LONG, uio->uio_offset,
+ 	       ICL_TYPE_LONG, uio->uio_resid);
+     code = afs_VerifyVCache(avc, &treq);
+     if (code) {
+ 	code = afs_CheckCode(code, &treq, 35);
+ 	AFS_GUNLOCK();
+ 	return code;
+     }
+     if (vType(avc) != VREG) {
+ 	AFS_GUNLOCK();
+ 	return EISDIR;	/* can't read or write other things */
+     }
+     afs_BozonLock(&avc->pvnLock, avc);
+     osi_FlushPages(avc);	/* hold bozon lock, but not basic vnode lock */
+     ObtainWriteLock(&avc->lock,162);
+     /* adjust parameters when appending files */
+     if ((ioflag & IO_APPEND) && uio->uio_rw == UIO_WRITE)
+ 	uio->uio_offset = avc->m.Length;	/* write at EOF position */
+     if (uio->uio_rw == UIO_WRITE) {
+ 	avc->states |= CDirty;
+ 	afs_FakeOpen(avc);
+ 	didFakeOpen=1;
+ 	/*
+ 	 * before starting any I/O, we must ensure that the file is big enough
+ 	 * to hold the results (since afs_putpage will be called to force
+ 	 * the I/O.
+ 	 */
+ 	size = uio->afsio_resid + uio->afsio_offset;	/* new file size */
+ 	if (size > avc->m.Length) avc->m.Length = size;	/* file grew */
+ 	avc->m.Date = osi_Time();	/* Set file date (for ranlib) */
+ 	if (uio->afsio_resid > PAGE_SIZE)
+ 	    cnt = uio->afsio_resid / PAGE_SIZE;
+ 	save_resid = uio->afsio_resid;
+     }
+ 
+     while (1) {
+ 	/*
+ 	 * compute the amount of data to move into this block,
+ 	 * based on uio->afsio_resid.
+ 	 */
+ 	size = uio->afsio_resid;		/* transfer size */
+ 	fileBase = uio->afsio_offset;		/* start file position */
+ 	pageBase = fileBase & ~(PAGE_SIZE-1);	/* file position of the page */
+ 	pageOffset = fileBase & (PAGE_SIZE-1);	/* start offset within page */
+ 	tsize = PAGE_SIZE-pageOffset;		/* amount left in this page */
+ 	/*
+ 	 * we'll read tsize bytes,
+ 	 * but first must make sure tsize isn't too big
+ 	 */
+ 	if (tsize > size) tsize = size; /* don't read past end of request */
+ 	eof = 0;	/* flag telling us if we hit the EOF on the read */
+ 	if (uio->uio_rw == UIO_READ) {	/* we're doing a read operation */
+ 	    /* don't read past EOF */
+ 	    if (tsize + fileBase > avc->m.Length) {
+ 		tsize = avc->m.Length - fileBase;
+ 		eof = 1;	/* we did hit the EOF */
+ 		if (tsize < 0) tsize = 0;	/* better safe than sorry */
+ 	    }
+ 	}
+ 	if (tsize <= 0) break;	/* nothing to transfer, we're done */
+ 
+ 	/* Purge dirty chunks of file if there are too many dirty chunks.
+ 	 * Inside the write loop, we only do this at a chunk boundary.
+ 	 * Clean up partial chunk if necessary at end of loop.
+ 	 */
+ 	if (uio->uio_rw == UIO_WRITE && counter > 0
+ 	    && AFS_CHUNKOFFSET(fileBase) == 0) {
+ 	    code = afs_DoPartialWrite(avc, &treq);
+ 	    avc->states |= CDirty;
+ 	}
+ 
+ 	if (code) {
+ 	    break;
+ 	}
+ 
+ 	flags = 0;
+ 	ReleaseWriteLock(&avc->lock);
+ 	AFS_GUNLOCK();
+ 	code = ubc_lookup(((struct vnode *)avc)->v_object, pageBase,
+ 			  PAGE_SIZE, PAGE_SIZE, &page, &flags);
+ 	AFS_GLOCK();
+ 	ObtainWriteLock(&avc->lock,163);
+ 
+ 	if (code) {
+ 	    break;
+ 	}
+ 	if (flags & B_NOCACHE) {
+ 	    /*
+ 	       No page found. We should not read the page in if
+ 	       1. the write starts on a page edge (ie, pageoffset == 0)
+ 	       and either
+ 		     1. we will fill the page  (ie, size == PAGESIZE), or
+ 		     2. we are writing past eof
+ 	     */
+ 	    if ((uio->uio_rw == UIO_WRITE) &&
+ 		((pageOffset == 0 && (size == PAGE_SIZE || fileBase >= avc->m.Length)))) {
+ 		struct vnode *vp = (struct vnode *)avc;
+ 		/* we're doing a write operation past eof; no need to read it */
+ 		newpage = 1;
+ 		AFS_GUNLOCK();
+ 		ubc_page_zero(page, 0, PAGE_SIZE);
+ 		ubc_page_release(page, B_DONE);
+ 		AFS_GLOCK();
+ 	    } else {
+ 		/* page wasn't cached, read it in. */
+ 		struct buf *bp;
+ 
+ 		AFS_GUNLOCK();
+ 		bp = ubc_bufalloc(page, 1, PAGE_SIZE, 1, B_READ);
+ 		AFS_GLOCK();
+ 		bp->b_dev = 0;
+ 		bp->b_vp = (struct vnode *)avc;
+ 		bp->b_blkno = btodb(pageBase);
+ 		ReleaseWriteLock(&avc->lock);
+ 		code = afs_ustrategy(bp, cred);	/* do the I/O */
+ 		ObtainWriteLock(&avc->lock,164);
+ 		AFS_GUNLOCK();
+ 		ubc_sync_iodone(bp);
+ 		AFS_GLOCK();
+ 		if (code) {
+ 		    AFS_GUNLOCK();
+ 	    	    ubc_page_release(page, 0);
+ 		    AFS_GLOCK();
+ 		    break;
+ 		}
+ 	    }
+ 	}
+ 	AFS_GUNLOCK();
+ 	ubc_page_wait(page);
+ 	data = (char *)page->pg_addr; /* DUX 4.0D */
+ 	if (data == 0)
+             data = (char *)PHYS_TO_KSEG(page->pg_phys_addr);  /* DUX 4.0E */
+ 	AFS_GLOCK();
+ 	ReleaseWriteLock(&avc->lock);	/* uiomove may page fault */
+ 	AFS_GUNLOCK();
+ 	code = uiomove(data+pageOffset, tsize, uio);
+ 	ubc_unload(page, pageOffset, page_size);
+ 	if (uio->uio_rw == UIO_WRITE) {
+ 		vm_offset_t toffset;
+ 
+ 		/* Mark the page dirty and release it to avoid a deadlock
+ 		 * in ubc_dirty_kluster when more than one process writes
+ 		 * this page at the same time. */
+ 		toffset = page->pg_offset;
+ 		flags |= B_DIRTY;
+ 		ubc_page_release(page, flags);
+ 
+ 		if (cnt > 10) {
+ 		    vm_page_t pl;
+ 		    int kpcnt;
+ 		    struct buf *bp;
+ 
+ 		    /* We released the page, so we can get a null page
+ 		     * list if another thread calls the strategy routine.
+ 		     */
+ 		    pl = ubc_dirty_kluster(((struct vnode *)avc)->v_object, 
+ 			   NULL, toffset, 0, B_WANTED, FALSE, &kpcnt);
+ 		    if (pl) {
+ 			bp = ubc_bufalloc(pl, 1, PAGE_SIZE, 1, B_WRITE);
+ 			bp->b_dev = 0;
+ 			bp->b_vp = (struct vnode *)avc;
+ 			bp->b_blkno = btodb(pageBase);
+ 			AFS_GLOCK();
+ 			code = afs_ustrategy(bp, cred);	/* do the I/O */
+ 			AFS_GUNLOCK();
+ 			ubc_sync_iodone(bp);
+ 			if (code) {
+ 			    AFS_GLOCK();
+ 			    ObtainWriteLock(&avc->lock,415);
+ 			    break;
+ 			}
+ 		    }
+ 		}
+ 	} else {
+ 	    ubc_page_release(page, flags);
+ 	}
+ 	AFS_GLOCK();
+ 	ObtainWriteLock(&avc->lock,165);
+ 	/*
+ 	 * If reading at a chunk boundary, start prefetch of next chunk.
+ 	 */
+ 	if (uio->uio_rw == UIO_READ
+ 	    && (counter == 0 || AFS_CHUNKOFFSET(fileBase) == 0)) {
+ 	    tdc = afs_FindDCache(avc, fileBase);
+ 	    if (tdc) {
+ 		if (!(tdc->flags & DFNextStarted))
+ 		    afs_PrefetchChunk(avc, tdc, cred, &treq);
+ 		afs_PutDCache(tdc);
+ 	    }
+ 	}
+ 	counter++;
+ 	if (code) break;
+     }
+     if (didFakeOpen)
+ 	afs_FakeClose(avc, cred);
+     if (uio->uio_rw == UIO_WRITE && code == 0 && (avc->states & CDirty)) {
+ 	code = afs_DoPartialWrite(avc, &treq);
+     }
+     ReleaseWriteLock(&avc->lock);
+     afs_BozonUnlock(&avc->pvnLock, avc);
+     if (DO_FLUSH || (!newpage && (cnt < 10))) {
+ 	AFS_GUNLOCK();
+ 	ubc_flush_dirty(((struct vnode *)avc)->v_object, flags); 
+ 	AFS_GLOCK();
+     }
+ 
+     ObtainSharedLock(&avc->lock, 409);
+     if (!code) {
+ 	if (avc->vc_error) {
+ 	    code = avc->vc_error;
+ 	}
+     }
+     /* This is required since we may still have dirty pages after the write.
+      * I could just let close do the right thing, but stat's before the close
+      * return the wrong length.
+      */
+     if (code == EDQUOT || code == ENOSPC) {
+ 	uio->uio_resid = save_resid;
+ 	UpgradeSToWLock(&avc->lock, 410);
+ 	osi_ReleaseVM(avc, cred);
+ 	ConvertWToSLock(&avc->lock);
+     }
+     ReleaseSharedLock(&avc->lock);
+ 
+     if (!code && (ioflag & IO_SYNC) && (uio->uio_rw == UIO_WRITE)
+ 	&& !AFS_NFSXLATORREQ(cred)) {
+ 	code = afs_fsync(avc, 0, cred, 0);
+     }
+ out:
+     code = afs_CheckCode(code, &treq, 36);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ 
+ /*
+  * Now for some bad news.  Since we artificially hold on to vnodes by doing
+  * and extra VNHOLD in afs_NewVCache(), there is no way for us to know
+  * when we need to flush the pages when a program exits.  Particularly
+  * if it closes the file after mapping it R/W.
+  *
+  */
+ 
+ mp_afs_mmap(avc, offset, map, addrp, len, prot, maxprot, flags, cred)
+     register struct vcache *avc;
+     vm_offset_t offset;
+     vm_map_t map;
+     vm_offset_t *addrp;
+     vm_size_t len;
+     vm_prot_t prot;
+     vm_prot_t maxprot;
+     int flags;
+     struct ucred *cred;
+ {
+     struct vp_mmap_args args;
+     register struct vp_mmap_args *ap = &args;
+     struct vnode *vp = (struct vnode *)avc;
+     int code;
+     struct vrequest treq;
+ #if	!defined(DYNEL)
+     extern kern_return_t u_vp_create();
+ #endif
+ 
+     AFS_GLOCK();
+     afs_InitReq(&treq, cred);
+     code = afs_VerifyVCache(avc, &treq);
+     if (code) {
+       code = afs_CheckCode(code, &treq, 37);
+       AFS_GUNLOCK();
+       return code;
+     }
+     afs_BozonLock(&avc->pvnLock, avc);
+     osi_FlushPages(avc);	/* ensure old pages are gone */
+     afs_BozonUnlock(&avc->pvnLock, avc);
+     ObtainWriteLock(&avc->lock,166);
+     avc->states |= CMAPPED;
+     ReleaseWriteLock(&avc->lock);
+     ap->a_offset = offset;
+     ap->a_vaddr = addrp;
+     ap->a_size = len;
+     ap->a_prot = prot,
+     ap->a_maxprot = maxprot;
+     ap->a_flags = flags;
+     AFS_GUNLOCK();
+     code = u_vp_create(map, vp->v_object, (vm_offset_t) ap);
+     AFS_GLOCK();
+     code = afs_CheckCode(code, &treq, 38);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ 
+ int mp_afs_getpage(vop, offset, len, protp, pl, plsz, mape, addr, rw, cred)
+     vm_ubc_object_t vop;
+     vm_offset_t offset;
+     vm_size_t len;
+     vm_prot_t *protp;
+     vm_page_t *pl;
+     int plsz;
+     vm_map_entry_t mape;
+     vm_offset_t addr;
+     int rw;
+     struct ucred *cred;
+ {
+     register afs_int32 code;
+     struct vrequest treq;
+     int flags = 0;
+     int i, pages = (len + PAGE_SIZE - 1) >> page_shift;
+     vm_page_t *pagep;
+     vm_offset_t off;
+ 
+    struct vcache *avc =  (struct vcache *)vop->vu_vp;
+ 
+     /* first, obtain the proper lock for the VM system */
+ 
+     AFS_GLOCK();
+     afs_InitReq(&treq, cred);
+     code = afs_VerifyVCache(avc, &treq);
+     if (code) {
+ 	*pl = VM_PAGE_NULL;
+ 	code = afs_CheckCode(code, &treq, 39); /* failed to get it */
+ 	AFS_GUNLOCK();
+ 	return code;
+     }
+ 	
+     /* clean all dirty pages for this vnode */
+     AFS_GUNLOCK();
+     ubc_flush_dirty(vop,0);
+     AFS_GLOCK();
+ 
+     afs_BozonLock(&avc->pvnLock, avc);
+     ObtainWriteLock(&avc->lock,167);
+     afs_Trace4(afs_iclSetp, CM_TRACE_PAGEIN, ICL_TYPE_POINTER, avc,
+ 	       ICL_TYPE_LONG, offset, ICL_TYPE_LONG, len,
+ 	       ICL_TYPE_INT32, (int) rw);
+     for (i = 0; i < pages; i++) {
+ 	pagep = &pl[i];
+ 	off = offset + PAGE_SIZE * i;
+ 	if (protp) protp[i] = 0;
+ 	flags = 0;
+ 	ReleaseWriteLock(&avc->lock);
+ 	AFS_GUNLOCK();
+ 	code = ubc_lookup(((struct vnode *)avc)->v_object, off,
+ 			PAGE_SIZE, PAGE_SIZE, pagep, &flags);
+ 	AFS_GLOCK();
+ 	ObtainWriteLock(&avc->lock,168);
+ 	if (code) {
+ 	    goto out;
+ 	}
+ 	if(flags & B_NOCACHE) {		/* if (page) */
+ 	    if ((rw & B_WRITE) && (offset+len >= avc->m.Length)) {
+ 		struct vnode *vp = (struct vnode *)avc;
+ 		/* we're doing a write operation past eof; no need to read it */
+ 		AFS_GUNLOCK();
+ 		ubc_page_zero(*pagep, 0, PAGE_SIZE);
+ 		ubc_page_release(*pagep, B_DONE);
+ 		AFS_GLOCK();
+ 	    } else {
+ 		/* page wasn't cached, read it in. */
+ 		struct buf *bp;
+ 
+ 		AFS_GUNLOCK();
+ 		bp = ubc_bufalloc(*pagep, 1, PAGE_SIZE, 1, B_READ);
+ 		AFS_GLOCK();
+ 		bp->b_dev = 0;
+ 		bp->b_vp = (struct vnode *)avc;
+ 		bp->b_blkno = btodb(off);
+ 		ReleaseWriteLock(&avc->lock);
+ 		code = afs_ustrategy(bp, cred);	/* do the I/O */
+ 		ObtainWriteLock(&avc->lock,169);
+ 		AFS_GUNLOCK();
+ 		ubc_sync_iodone(bp);
+ 		AFS_GLOCK();
+ 		if (code) {
+ 		    AFS_GUNLOCK();
+ 		    ubc_page_release(pl[i], 0);
+ 		    AFS_GLOCK();
+ 		    goto out;
+ 		}
+ 	    }
+ 	}
+ 	if ((rw & B_READ) == 0) {
+ 	    AFS_GUNLOCK();
+ 	    ubc_page_dirty(pl[i]);
+ 	    AFS_GLOCK();
+ 	} else {
+ 	    if (protp && (flags & B_DIRTY) == 0) {
+ 		protp[i] = VM_PROT_WRITE;
+ 	    }
+ 	}
+     }
+ out:
+     pl[i] = VM_PAGE_NULL;
+     ReleaseWriteLock(&avc->lock);
+     afs_BozonUnlock(&avc->pvnLock, avc);
+     afs_Trace3(afs_iclSetp, CM_TRACE_PAGEINDONE, ICL_TYPE_INT32, code,
+ 	       ICL_TYPE_POINTER, *pagep, ICL_TYPE_INT32, flags);
+     code = afs_CheckCode(code, &treq, 40);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ 
+ int mp_afs_putpage(vop, pl, pcnt, flags, cred)
+     vm_ubc_object_t vop;
+     vm_page_t *pl;
+     int pcnt;
+     int flags;
+     struct ucred *cred;
+ {
+     register afs_int32 code=0;
+     struct vcache *avc = (struct vcache *)vop->vu_vp;
+     struct vnode *vp = (struct vnode *)avc;
+     int i;
+ 
+     AFS_GLOCK();
+     afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUT, ICL_TYPE_POINTER, avc,
+ 	       ICL_TYPE_INT32, pcnt, ICL_TYPE_INT32, vp->v_flag,
+ 	       ICL_TYPE_INT32, flags);
+     if (flags & B_UBC) {
+ 	AFS_GUNLOCK();
+ 	VN_LOCK(vp);
+ 	if (vp->v_flag & VXLOCK) {
+ 	    VN_UNLOCK(vp);
+ 	    for (i = 0; i < pcnt; i++) {
+ 		ubc_page_release(pl[i], B_DONE|B_DIRTY);
+ 		pl[i] = VM_PAGE_NULL;
+ 	    }
+ 	    return(0);
+ 	} else {
+ 	    VN_UNLOCK(vp);
+ 	}
+ 	AFS_GLOCK();
+     }
+ 
+     /* first, obtain the proper lock for the VM system */
+     afs_BozonLock(&avc->pvnLock, avc);
+     ObtainWriteLock(&avc->lock,170);
+     for (i = 0; i < pcnt; i++) {
+ 	vm_page_t page = pl[i];
+ 	struct buf *bp;
+ 
+ 	/* write it out */
+ 	AFS_GUNLOCK();
+ 	bp = ubc_bufalloc(page, 1, PAGE_SIZE, 1, B_WRITE);
+ 	AFS_GLOCK();
+ 	bp->b_dev = 0;
+ 	bp->b_vp = (struct vnode *)avc;
+ 	bp->b_blkno = btodb(page->pg_offset);
+ 	ReleaseWriteLock(&avc->lock);
+ 	code = afs_ustrategy(bp, cred);	/* do the I/O */
+ 	ObtainWriteLock(&avc->lock,171);
+ 	AFS_GUNLOCK();
+ 	ubc_sync_iodone(bp);
+ 	AFS_GLOCK();
+ 	if (code) {
+ 	    goto done;
+ 	} else {
+ 	    pl[i] = VM_PAGE_NULL;
+ 	}
+     }
+ done:
+     ReleaseWriteLock(&avc->lock);
+     afs_BozonUnlock(&avc->pvnLock, avc);
+     afs_Trace2(afs_iclSetp, CM_TRACE_PAGEOUTDONE, ICL_TYPE_INT32, code,
+ 	       ICL_TYPE_INT32, avc->m.Length);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ 
+ int mp_afs_swap(avc, swapop, argp)
+     struct vcache *avc;
+     vp_swap_op_t swapop;
+     vm_offset_t argp;
+ {
+     return EIO;
+ }
+ 
+ int mp_afs_syncdata(avc, flag, offset, length, cred)
+     struct vcache *avc;
+     int flag;
+     vm_offset_t offset;
+     vm_size_t length;
+     struct ucred *cred;
+ {
+     /* NFS V3 makes this call, ignore it. We'll sync the data in afs_fsync. */
+     if (AFS_NFSXLATORREQ(cred))
+ 	return 0;
+     else
+ 	return EINVAL;
+ }
+ 
+ /* a freelist of one */
+ struct buf *afs_bread_freebp = 0;
+ 
+ /*
+  *  Only rfs_read calls this, and it only looks at bp->b_un.b_addr.
+  *  Thus we can use fake bufs (ie not from the real buffer pool).
+  */
+ mp_afs_bread(vp, lbn, bpp, cred)
+ 	struct ucred *cred;
+ 	struct vnode *vp;
+ 	daddr_t lbn;
+ 	struct buf **bpp;
+ {
+ 	int offset, fsbsize, error;
+ 	struct buf *bp;
+ 	struct iovec iov;
+ 	struct uio uio;
+ 
+ 	AFS_GLOCK();
+ 	AFS_STATCNT(afs_bread);
+ 	fsbsize = vp->v_vfsp->vfs_bsize;
+ 	offset = lbn * fsbsize;
+ 	if (afs_bread_freebp) {
+ 		bp = afs_bread_freebp;
+ 		afs_bread_freebp = 0;
+ 	} else {
+ 		bp = (struct buf *) AFS_KALLOC(sizeof(*bp));
+ 		bp->b_un.b_addr = (caddr_t) AFS_KALLOC(fsbsize);
+ 	}
+ 
+ 	iov.iov_base = bp->b_un.b_addr;
+ 	iov.iov_len = fsbsize;
+ 	uio.afsio_iov = &iov;
+ 	uio.afsio_iovcnt = 1;
+ 	uio.afsio_seg = AFS_UIOSYS;
+ 	uio.afsio_offset = offset;
+ 	uio.afsio_resid = fsbsize;
+ 	*bpp = 0;
+ 	error = afs_read((struct vcache *)vp, &uio, cred, lbn, bpp, 0);
+ 	if (error) {
+ 		afs_bread_freebp = bp;
+ 		AFS_GUNLOCK();
+ 		return error;
+ 	}
+ 	if (*bpp) {
+ 		afs_bread_freebp = bp;
+ 	} else {
+ 		*(struct buf **)&bp->b_vp = bp; /* mark as fake */
+ 		*bpp = bp;
+ 	}
+ 	AFS_GUNLOCK();
+ 	return 0;
+ }
+ 
+ 
+ mp_afs_brelse(vp, bp)
+ struct vnode *vp;
+ struct buf *bp;
+ {
+     AFS_GLOCK();
+     AFS_STATCNT(afs_brelse);
+ 	if ((struct buf *)bp->b_vp != bp) { /* not fake */
+ 	    brelse(bp);
+ 	} else if (afs_bread_freebp) {
+ 		AFS_KFREE(bp->b_un.b_addr, vp->v_vfsp->vfs_bsize);
+ 		AFS_KFREE(bp, sizeof(*bp));
+ 	} else {
+ 		afs_bread_freebp = bp;
+ 	}
+     AFS_GUNLOCK();
+ }
+ 
+ 
+ mp_afs_bmap(avc, abn, anvp, anbn)
+     register struct vcache *avc;
+     afs_int32 abn, *anbn;
+     struct vcache **anvp;
+ {
+     AFS_GLOCK();
+     AFS_STATCNT(afs_bmap);
+     if (anvp)
+ 	*anvp = avc;
+     if (anbn)
+ 	*anbn =	abn * (8192 / DEV_BSIZE);   /* in 512 byte units */
+     AFS_GUNLOCK();
+     return 0;
+ }
+ 
+ 
+ /* real strategy */
+ mp_afs_strategy (abp)
+     register struct buf *abp;
+ {
+     register afs_int32 code;
+ 
+     AFS_GLOCK();
+     AFS_STATCNT(afs_strategy);
+     code = afs_osi_MapStrategy(afs_ustrategy, abp);
+     AFS_GUNLOCK();
+     return code;
+ }
+ 
+ 
+ mp_afs_refer(vm_ubc_object_t vop)
+ {
+         VREF(vop->vu_vp);
+ }
+ 
+ 
+ mp_afs_release(vm_ubc_object_t vop)
+ {
+         vrele(vop->vu_vp);
+ }
+ 
+ 
+ mp_afs_write_check(vm_ubc_object_t vop, vm_page_t pp)
+ {
+         return TRUE;
+ }
+ 
+ 
+ 
+ struct vfs_ubcops afs_ubcops = {
+         mp_afs_refer,              /* refer vnode */
+         mp_afs_release,            /* release vnode */
+         mp_afs_getpage,            /* get page */
+         mp_afs_putpage,            /* put page */
+         mp_afs_write_check,        /* check writablity */
+ };
+ #endif /* 0 */
+ 
+ /*
+  * Cover function for lookup name using OSF equivalent, namei()
+  *
+  * Note, the result vnode (ni_vp) in the namei data structure is remains
+  * locked after return.
+  */
+ lookupname(namep, seg, follow, dvpp, cvpp)
+     char *namep;		/* path name */
+     int seg;		/* address space containing name */
+     int follow;		/* follow symbolic links */
+     struct vnode **dvpp;	/* result, containing parent vnode */
+     struct vnode **cvpp;	/* result, containing final component vnode */
+ {
+     /* Should I use free-bee in u-area? */
+     struct nameidata *ndp = &u.u_nd;
+     int error;
+ 
+     ndp->ni_nameiop = ((follow) ? (LOOKUP|FOLLOW) : (LOOKUP));
+     ndp->ni_segflg = seg;
+     ndp->ni_dirp = namep;
+     error = namei(ndp);
+     if (dvpp != (struct vnode **)0)
+ 	*dvpp = ndp->ni_dvp;
+     if (cvpp != (struct vnode **)0)
+ 	*cvpp = ndp->ni_vp;
+     return(error);
+ }
+ 
Index: openafs/src/afs/FBSD/vnode_if.h
diff -c /dev/null openafs/src/afs/FBSD/vnode_if.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:11 2001
--- openafs/src/afs/FBSD/vnode_if.h	Mon Apr 23 03:28:48 2001
***************
*** 0 ****
--- 1,1348 ----
+ /*
+  * 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
+  */
+ 
+ /*
+  * This file is produced automatically.
+  * Do not modify anything in here by hand.
+  *
+  * Created from @(#)vnode_if.sh	8.1 (Berkeley) 6/10/93
+  */
+ 
+ extern struct vnodeop_desc vop_default_desc;
+ struct vop_islocked_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_islocked_desc;
+ static __inline int VOP_ISLOCKED __P((
+ 	struct vnode *vp,
+ 	struct proc *p));
+ static __inline int VOP_ISLOCKED(vp, p)
+ 	struct vnode *vp;
+ 	struct proc *p;
+ {
+ 	struct vop_islocked_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_islocked);
+ 	a.a_vp = vp;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_islocked), &a);
+ 	return (rc);
+ }
+ struct vop_lookup_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_dvp;
+ 	struct vnode **a_vpp;
+ 	struct componentname *a_cnp;
+ };
+ extern struct vnodeop_desc vop_lookup_desc;
+ static __inline int VOP_LOOKUP __P((
+ 	struct vnode *dvp,
+ 	struct vnode **vpp,
+ 	struct componentname *cnp));
+ static __inline int VOP_LOOKUP(dvp, vpp, cnp)
+ 	struct vnode *dvp;
+ 	struct vnode **vpp;
+ 	struct componentname *cnp;
+ {
+ 	struct vop_lookup_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_lookup);
+ 	a.a_dvp = dvp;
+ 	a.a_vpp = vpp;
+ 	a.a_cnp = cnp;
+ 	rc = VCALL(dvp, VOFFSET(vop_lookup), &a);
+ 	return (rc);
+ }
+ struct vop_cachedlookup_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_dvp;
+ 	struct vnode **a_vpp;
+ 	struct componentname *a_cnp;
+ };
+ extern struct vnodeop_desc vop_cachedlookup_desc;
+ static __inline int VOP_CACHEDLOOKUP __P((
+ 	struct vnode *dvp,
+ 	struct vnode **vpp,
+ 	struct componentname *cnp));
+ static __inline int VOP_CACHEDLOOKUP(dvp, vpp, cnp)
+ 	struct vnode *dvp;
+ 	struct vnode **vpp;
+ 	struct componentname *cnp;
+ {
+ 	struct vop_cachedlookup_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_cachedlookup);
+ 	a.a_dvp = dvp;
+ 	a.a_vpp = vpp;
+ 	a.a_cnp = cnp;
+ 	rc = VCALL(dvp, VOFFSET(vop_cachedlookup), &a);
+ 	return (rc);
+ }
+ struct vop_create_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_dvp;
+ 	struct vnode **a_vpp;
+ 	struct componentname *a_cnp;
+ 	struct vattr *a_vap;
+ };
+ extern struct vnodeop_desc vop_create_desc;
+ static __inline int VOP_CREATE __P((
+ 	struct vnode *dvp,
+ 	struct vnode **vpp,
+ 	struct componentname *cnp,
+ 	struct vattr *vap));
+ static __inline int VOP_CREATE(dvp, vpp, cnp, vap)
+ 	struct vnode *dvp;
+ 	struct vnode **vpp;
+ 	struct componentname *cnp;
+ 	struct vattr *vap;
+ {
+ 	struct vop_create_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_create);
+ 	a.a_dvp = dvp;
+ 	a.a_vpp = vpp;
+ 	a.a_cnp = cnp;
+ 	a.a_vap = vap;
+ 	rc = VCALL(dvp, VOFFSET(vop_create), &a);
+ 	return (rc);
+ }
+ struct vop_whiteout_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_dvp;
+ 	struct componentname *a_cnp;
+ 	int a_flags;
+ };
+ extern struct vnodeop_desc vop_whiteout_desc;
+ static __inline int VOP_WHITEOUT __P((
+ 	struct vnode *dvp,
+ 	struct componentname *cnp,
+ 	int flags));
+ static __inline int VOP_WHITEOUT(dvp, cnp, flags)
+ 	struct vnode *dvp;
+ 	struct componentname *cnp;
+ 	int flags;
+ {
+ 	struct vop_whiteout_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_whiteout);
+ 	a.a_dvp = dvp;
+ 	a.a_cnp = cnp;
+ 	a.a_flags = flags;
+ 	rc = VCALL(dvp, VOFFSET(vop_whiteout), &a);
+ 	return (rc);
+ }
+ struct vop_mknod_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_dvp;
+ 	struct vnode **a_vpp;
+ 	struct componentname *a_cnp;
+ 	struct vattr *a_vap;
+ };
+ extern struct vnodeop_desc vop_mknod_desc;
+ static __inline int VOP_MKNOD __P((
+ 	struct vnode *dvp,
+ 	struct vnode **vpp,
+ 	struct componentname *cnp,
+ 	struct vattr *vap));
+ static __inline int VOP_MKNOD(dvp, vpp, cnp, vap)
+ 	struct vnode *dvp;
+ 	struct vnode **vpp;
+ 	struct componentname *cnp;
+ 	struct vattr *vap;
+ {
+ 	struct vop_mknod_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_mknod);
+ 	a.a_dvp = dvp;
+ 	a.a_vpp = vpp;
+ 	a.a_cnp = cnp;
+ 	a.a_vap = vap;
+ 	rc = VCALL(dvp, VOFFSET(vop_mknod), &a);
+ 	return (rc);
+ }
+ struct vop_open_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	int a_mode;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_open_desc;
+ static __inline int VOP_OPEN __P((
+ 	struct vnode *vp,
+ 	int mode,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_OPEN(vp, mode, cred, p)
+ 	struct vnode *vp;
+ 	int mode;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_open_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_open);
+ 	a.a_vp = vp;
+ 	a.a_mode = mode;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_open), &a);
+ 	return (rc);
+ }
+ struct vop_close_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	int a_fflag;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_close_desc;
+ static __inline int VOP_CLOSE __P((
+ 	struct vnode *vp,
+ 	int fflag,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_CLOSE(vp, fflag, cred, p)
+ 	struct vnode *vp;
+ 	int fflag;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_close_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_close);
+ 	a.a_vp = vp;
+ 	a.a_fflag = fflag;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_close), &a);
+ 	return (rc);
+ }
+ struct vop_access_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	int a_mode;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_access_desc;
+ static __inline int VOP_ACCESS __P((
+ 	struct vnode *vp,
+ 	int mode,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_ACCESS(vp, mode, cred, p)
+ 	struct vnode *vp;
+ 	int mode;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_access_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_access);
+ 	a.a_vp = vp;
+ 	a.a_mode = mode;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_access), &a);
+ 	return (rc);
+ }
+ struct vop_getattr_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct vattr *a_vap;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_getattr_desc;
+ static __inline int VOP_GETATTR __P((
+ 	struct vnode *vp,
+ 	struct vattr *vap,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_GETATTR(vp, vap, cred, p)
+ 	struct vnode *vp;
+ 	struct vattr *vap;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_getattr_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_getattr);
+ 	a.a_vp = vp;
+ 	a.a_vap = vap;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_getattr), &a);
+ 	return (rc);
+ }
+ struct vop_setattr_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct vattr *a_vap;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_setattr_desc;
+ static __inline int VOP_SETATTR __P((
+ 	struct vnode *vp,
+ 	struct vattr *vap,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_SETATTR(vp, vap, cred, p)
+ 	struct vnode *vp;
+ 	struct vattr *vap;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_setattr_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_setattr);
+ 	a.a_vp = vp;
+ 	a.a_vap = vap;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_setattr), &a);
+ 	return (rc);
+ }
+ struct vop_read_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct uio *a_uio;
+ 	int a_ioflag;
+ 	struct ucred *a_cred;
+ };
+ extern struct vnodeop_desc vop_read_desc;
+ static __inline int VOP_READ __P((
+ 	struct vnode *vp,
+ 	struct uio *uio,
+ 	int ioflag,
+ 	struct ucred *cred));
+ static __inline int VOP_READ(vp, uio, ioflag, cred)
+ 	struct vnode *vp;
+ 	struct uio *uio;
+ 	int ioflag;
+ 	struct ucred *cred;
+ {
+ 	struct vop_read_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_read);
+ 	a.a_vp = vp;
+ 	a.a_uio = uio;
+ 	a.a_ioflag = ioflag;
+ 	a.a_cred = cred;
+ 	rc = VCALL(vp, VOFFSET(vop_read), &a);
+ 	return (rc);
+ }
+ struct vop_write_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct uio *a_uio;
+ 	int a_ioflag;
+ 	struct ucred *a_cred;
+ };
+ extern struct vnodeop_desc vop_write_desc;
+ static __inline int VOP_WRITE __P((
+ 	struct vnode *vp,
+ 	struct uio *uio,
+ 	int ioflag,
+ 	struct ucred *cred));
+ static __inline int VOP_WRITE(vp, uio, ioflag, cred)
+ 	struct vnode *vp;
+ 	struct uio *uio;
+ 	int ioflag;
+ 	struct ucred *cred;
+ {
+ 	struct vop_write_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_write);
+ 	a.a_vp = vp;
+ 	a.a_uio = uio;
+ 	a.a_ioflag = ioflag;
+ 	a.a_cred = cred;
+ 	rc = VCALL(vp, VOFFSET(vop_write), &a);
+ 	return (rc);
+ }
+ struct vop_lease_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct proc *a_p;
+ 	struct ucred *a_cred;
+ 	int a_flag;
+ };
+ extern struct vnodeop_desc vop_lease_desc;
+ static __inline int VOP_LEASE __P((
+ 	struct vnode *vp,
+ 	struct proc *p,
+ 	struct ucred *cred,
+ 	int flag));
+ static __inline int VOP_LEASE(vp, p, cred, flag)
+ 	struct vnode *vp;
+ 	struct proc *p;
+ 	struct ucred *cred;
+ 	int flag;
+ {
+ 	struct vop_lease_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_lease);
+ 	a.a_vp = vp;
+ 	a.a_p = p;
+ 	a.a_cred = cred;
+ 	a.a_flag = flag;
+ 	rc = VCALL(vp, VOFFSET(vop_lease), &a);
+ 	return (rc);
+ }
+ struct vop_ioctl_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	u_long a_command;
+ 	caddr_t a_data;
+ 	int a_fflag;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_ioctl_desc;
+ static __inline int VOP_IOCTL __P((
+ 	struct vnode *vp,
+ 	u_long command,
+ 	caddr_t data,
+ 	int fflag,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_IOCTL(vp, command, data, fflag, cred, p)
+ 	struct vnode *vp;
+ 	u_long command;
+ 	caddr_t data;
+ 	int fflag;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_ioctl_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_ioctl);
+ 	a.a_vp = vp;
+ 	a.a_command = command;
+ 	a.a_data = data;
+ 	a.a_fflag = fflag;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_ioctl), &a);
+ 	return (rc);
+ }
+ struct vop_poll_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	int a_events;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_poll_desc;
+ static __inline int VOP_POLL __P((
+ 	struct vnode *vp,
+ 	int events,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_POLL(vp, events, cred, p)
+ 	struct vnode *vp;
+ 	int events;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_poll_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_poll);
+ 	a.a_vp = vp;
+ 	a.a_events = events;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_poll), &a);
+ 	return (rc);
+ }
+ struct vop_revoke_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	int a_flags;
+ };
+ extern struct vnodeop_desc vop_revoke_desc;
+ static __inline int VOP_REVOKE __P((
+ 	struct vnode *vp,
+ 	int flags));
+ static __inline int VOP_REVOKE(vp, flags)
+ 	struct vnode *vp;
+ 	int flags;
+ {
+ 	struct vop_revoke_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_revoke);
+ 	a.a_vp = vp;
+ 	a.a_flags = flags;
+ 	rc = VCALL(vp, VOFFSET(vop_revoke), &a);
+ 	return (rc);
+ }
+ struct vop_mmap_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	int a_fflags;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_mmap_desc;
+ static __inline int VOP_MMAP __P((
+ 	struct vnode *vp,
+ 	int fflags,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_MMAP(vp, fflags, cred, p)
+ 	struct vnode *vp;
+ 	int fflags;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_mmap_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_mmap);
+ 	a.a_vp = vp;
+ 	a.a_fflags = fflags;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_mmap), &a);
+ 	return (rc);
+ }
+ struct vop_fsync_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct ucred *a_cred;
+ 	int a_waitfor;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_fsync_desc;
+ static __inline int VOP_FSYNC __P((
+ 	struct vnode *vp,
+ 	struct ucred *cred,
+ 	int waitfor,
+ 	struct proc *p));
+ static __inline int VOP_FSYNC(vp, cred, waitfor, p)
+ 	struct vnode *vp;
+ 	struct ucred *cred;
+ 	int waitfor;
+ 	struct proc *p;
+ {
+ 	struct vop_fsync_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_fsync);
+ 	a.a_vp = vp;
+ 	a.a_cred = cred;
+ 	a.a_waitfor = waitfor;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_fsync), &a);
+ 	return (rc);
+ }
+ struct vop_remove_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_dvp;
+ 	struct vnode *a_vp;
+ 	struct componentname *a_cnp;
+ };
+ extern struct vnodeop_desc vop_remove_desc;
+ static __inline int VOP_REMOVE __P((
+ 	struct vnode *dvp,
+ 	struct vnode *vp,
+ 	struct componentname *cnp));
+ static __inline int VOP_REMOVE(dvp, vp, cnp)
+ 	struct vnode *dvp;
+ 	struct vnode *vp;
+ 	struct componentname *cnp;
+ {
+ 	struct vop_remove_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_remove);
+ 	a.a_dvp = dvp;
+ 	a.a_vp = vp;
+ 	a.a_cnp = cnp;
+ 	rc = VCALL(dvp, VOFFSET(vop_remove), &a);
+ 	return (rc);
+ }
+ struct vop_link_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_tdvp;
+ 	struct vnode *a_vp;
+ 	struct componentname *a_cnp;
+ };
+ extern struct vnodeop_desc vop_link_desc;
+ static __inline int VOP_LINK __P((
+ 	struct vnode *tdvp,
+ 	struct vnode *vp,
+ 	struct componentname *cnp));
+ static __inline int VOP_LINK(tdvp, vp, cnp)
+ 	struct vnode *tdvp;
+ 	struct vnode *vp;
+ 	struct componentname *cnp;
+ {
+ 	struct vop_link_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_link);
+ 	a.a_tdvp = tdvp;
+ 	a.a_vp = vp;
+ 	a.a_cnp = cnp;
+ 	rc = VCALL(tdvp, VOFFSET(vop_link), &a);
+ 	return (rc);
+ }
+ struct vop_rename_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_fdvp;
+ 	struct vnode *a_fvp;
+ 	struct componentname *a_fcnp;
+ 	struct vnode *a_tdvp;
+ 	struct vnode *a_tvp;
+ 	struct componentname *a_tcnp;
+ };
+ extern struct vnodeop_desc vop_rename_desc;
+ static __inline int VOP_RENAME __P((
+ 	struct vnode *fdvp,
+ 	struct vnode *fvp,
+ 	struct componentname *fcnp,
+ 	struct vnode *tdvp,
+ 	struct vnode *tvp,
+ 	struct componentname *tcnp));
+ static __inline int VOP_RENAME(fdvp, fvp, fcnp, tdvp, tvp, tcnp)
+ 	struct vnode *fdvp;
+ 	struct vnode *fvp;
+ 	struct componentname *fcnp;
+ 	struct vnode *tdvp;
+ 	struct vnode *tvp;
+ 	struct componentname *tcnp;
+ {
+ 	struct vop_rename_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_rename);
+ 	a.a_fdvp = fdvp;
+ 	a.a_fvp = fvp;
+ 	a.a_fcnp = fcnp;
+ 	a.a_tdvp = tdvp;
+ 	a.a_tvp = tvp;
+ 	a.a_tcnp = tcnp;
+ 	rc = VCALL(fdvp, VOFFSET(vop_rename), &a);
+ 	return (rc);
+ }
+ struct vop_mkdir_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_dvp;
+ 	struct vnode **a_vpp;
+ 	struct componentname *a_cnp;
+ 	struct vattr *a_vap;
+ };
+ extern struct vnodeop_desc vop_mkdir_desc;
+ static __inline int VOP_MKDIR __P((
+ 	struct vnode *dvp,
+ 	struct vnode **vpp,
+ 	struct componentname *cnp,
+ 	struct vattr *vap));
+ static __inline int VOP_MKDIR(dvp, vpp, cnp, vap)
+ 	struct vnode *dvp;
+ 	struct vnode **vpp;
+ 	struct componentname *cnp;
+ 	struct vattr *vap;
+ {
+ 	struct vop_mkdir_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_mkdir);
+ 	a.a_dvp = dvp;
+ 	a.a_vpp = vpp;
+ 	a.a_cnp = cnp;
+ 	a.a_vap = vap;
+ 	rc = VCALL(dvp, VOFFSET(vop_mkdir), &a);
+ 	return (rc);
+ }
+ struct vop_rmdir_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_dvp;
+ 	struct vnode *a_vp;
+ 	struct componentname *a_cnp;
+ };
+ extern struct vnodeop_desc vop_rmdir_desc;
+ static __inline int VOP_RMDIR __P((
+ 	struct vnode *dvp,
+ 	struct vnode *vp,
+ 	struct componentname *cnp));
+ static __inline int VOP_RMDIR(dvp, vp, cnp)
+ 	struct vnode *dvp;
+ 	struct vnode *vp;
+ 	struct componentname *cnp;
+ {
+ 	struct vop_rmdir_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_rmdir);
+ 	a.a_dvp = dvp;
+ 	a.a_vp = vp;
+ 	a.a_cnp = cnp;
+ 	rc = VCALL(dvp, VOFFSET(vop_rmdir), &a);
+ 	return (rc);
+ }
+ struct vop_symlink_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_dvp;
+ 	struct vnode **a_vpp;
+ 	struct componentname *a_cnp;
+ 	struct vattr *a_vap;
+ 	char *a_target;
+ };
+ extern struct vnodeop_desc vop_symlink_desc;
+ static __inline int VOP_SYMLINK __P((
+ 	struct vnode *dvp,
+ 	struct vnode **vpp,
+ 	struct componentname *cnp,
+ 	struct vattr *vap,
+ 	char *target));
+ static __inline int VOP_SYMLINK(dvp, vpp, cnp, vap, target)
+ 	struct vnode *dvp;
+ 	struct vnode **vpp;
+ 	struct componentname *cnp;
+ 	struct vattr *vap;
+ 	char *target;
+ {
+ 	struct vop_symlink_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_symlink);
+ 	a.a_dvp = dvp;
+ 	a.a_vpp = vpp;
+ 	a.a_cnp = cnp;
+ 	a.a_vap = vap;
+ 	a.a_target = target;
+ 	rc = VCALL(dvp, VOFFSET(vop_symlink), &a);
+ 	return (rc);
+ }
+ struct vop_readdir_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct uio *a_uio;
+ 	struct ucred *a_cred;
+ 	int *a_eofflag;
+ 	int *a_ncookies;
+ 	u_long **a_cookies;
+ };
+ extern struct vnodeop_desc vop_readdir_desc;
+ static __inline int VOP_READDIR __P((
+ 	struct vnode *vp,
+ 	struct uio *uio,
+ 	struct ucred *cred,
+ 	int *eofflag,
+ 	int *ncookies,
+ 	u_long **cookies));
+ static __inline int VOP_READDIR(vp, uio, cred, eofflag, ncookies, cookies)
+ 	struct vnode *vp;
+ 	struct uio *uio;
+ 	struct ucred *cred;
+ 	int *eofflag;
+ 	int *ncookies;
+ 	u_long **cookies;
+ {
+ 	struct vop_readdir_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_readdir);
+ 	a.a_vp = vp;
+ 	a.a_uio = uio;
+ 	a.a_cred = cred;
+ 	a.a_eofflag = eofflag;
+ 	a.a_ncookies = ncookies;
+ 	a.a_cookies = cookies;
+ 	rc = VCALL(vp, VOFFSET(vop_readdir), &a);
+ 	return (rc);
+ }
+ struct vop_readlink_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct uio *a_uio;
+ 	struct ucred *a_cred;
+ };
+ extern struct vnodeop_desc vop_readlink_desc;
+ static __inline int VOP_READLINK __P((
+ 	struct vnode *vp,
+ 	struct uio *uio,
+ 	struct ucred *cred));
+ static __inline int VOP_READLINK(vp, uio, cred)
+ 	struct vnode *vp;
+ 	struct uio *uio;
+ 	struct ucred *cred;
+ {
+ 	struct vop_readlink_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_readlink);
+ 	a.a_vp = vp;
+ 	a.a_uio = uio;
+ 	a.a_cred = cred;
+ 	rc = VCALL(vp, VOFFSET(vop_readlink), &a);
+ 	return (rc);
+ }
+ struct vop_inactive_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_inactive_desc;
+ static __inline int VOP_INACTIVE __P((
+ 	struct vnode *vp,
+ 	struct proc *p));
+ static __inline int VOP_INACTIVE(vp, p)
+ 	struct vnode *vp;
+ 	struct proc *p;
+ {
+ 	struct vop_inactive_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_inactive);
+ 	a.a_vp = vp;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_inactive), &a);
+ 	return (rc);
+ }
+ struct vop_reclaim_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_reclaim_desc;
+ static __inline int VOP_RECLAIM __P((
+ 	struct vnode *vp,
+ 	struct proc *p));
+ static __inline int VOP_RECLAIM(vp, p)
+ 	struct vnode *vp;
+ 	struct proc *p;
+ {
+ 	struct vop_reclaim_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_reclaim);
+ 	a.a_vp = vp;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_reclaim), &a);
+ 	return (rc);
+ }
+ struct vop_lock_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	int a_flags;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_lock_desc;
+ static __inline int VOP_LOCK __P((
+ 	struct vnode *vp,
+ 	int flags,
+ 	struct proc *p));
+ static __inline int VOP_LOCK(vp, flags, p)
+ 	struct vnode *vp;
+ 	int flags;
+ 	struct proc *p;
+ {
+ 	struct vop_lock_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_lock);
+ 	a.a_vp = vp;
+ 	a.a_flags = flags;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_lock), &a);
+ 	return (rc);
+ }
+ struct vop_unlock_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	int a_flags;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_unlock_desc;
+ static __inline int VOP_UNLOCK __P((
+ 	struct vnode *vp,
+ 	int flags,
+ 	struct proc *p));
+ static __inline int VOP_UNLOCK(vp, flags, p)
+ 	struct vnode *vp;
+ 	int flags;
+ 	struct proc *p;
+ {
+ 	struct vop_unlock_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_unlock);
+ 	a.a_vp = vp;
+ 	a.a_flags = flags;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_unlock), &a);
+ 	return (rc);
+ }
+ struct vop_bmap_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	daddr_t a_bn;
+ 	struct vnode **a_vpp;
+ 	daddr_t *a_bnp;
+ 	int *a_runp;
+ 	int *a_runb;
+ };
+ extern struct vnodeop_desc vop_bmap_desc;
+ static __inline int VOP_BMAP __P((
+ 	struct vnode *vp,
+ 	daddr_t bn,
+ 	struct vnode **vpp,
+ 	daddr_t *bnp,
+ 	int *runp,
+ 	int *runb));
+ static __inline int VOP_BMAP(vp, bn, vpp, bnp, runp, runb)
+ 	struct vnode *vp;
+ 	daddr_t bn;
+ 	struct vnode **vpp;
+ 	daddr_t *bnp;
+ 	int *runp;
+ 	int *runb;
+ {
+ 	struct vop_bmap_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_bmap);
+ 	a.a_vp = vp;
+ 	a.a_bn = bn;
+ 	a.a_vpp = vpp;
+ 	a.a_bnp = bnp;
+ 	a.a_runp = runp;
+ 	a.a_runb = runb;
+ 	rc = VCALL(vp, VOFFSET(vop_bmap), &a);
+ 	return (rc);
+ }
+ struct vop_strategy_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct buf *a_bp;
+ };
+ extern struct vnodeop_desc vop_strategy_desc;
+ static __inline int VOP_STRATEGY __P((
+ 	struct vnode *vp,
+ 	struct buf *bp));
+ static __inline int VOP_STRATEGY(vp, bp)
+ 	struct vnode *vp;
+ 	struct buf *bp;
+ {
+ 	struct vop_strategy_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_strategy);
+ 	a.a_vp = vp;
+ 	a.a_bp = bp;
+ 	rc = VCALL(vp, VOFFSET(vop_strategy), &a);
+ 	return (rc);
+ }
+ struct vop_print_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ };
+ extern struct vnodeop_desc vop_print_desc;
+ static __inline int VOP_PRINT __P((
+ 	struct vnode *vp));
+ static __inline int VOP_PRINT(vp)
+ 	struct vnode *vp;
+ {
+ 	struct vop_print_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_print);
+ 	a.a_vp = vp;
+ 	rc = VCALL(vp, VOFFSET(vop_print), &a);
+ 	return (rc);
+ }
+ struct vop_pathconf_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	int a_name;
+ 	register_t *a_retval;
+ };
+ extern struct vnodeop_desc vop_pathconf_desc;
+ static __inline int VOP_PATHCONF __P((
+ 	struct vnode *vp,
+ 	int name,
+ 	register_t *retval));
+ static __inline int VOP_PATHCONF(vp, name, retval)
+ 	struct vnode *vp;
+ 	int name;
+ 	register_t *retval;
+ {
+ 	struct vop_pathconf_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_pathconf);
+ 	a.a_vp = vp;
+ 	a.a_name = name;
+ 	a.a_retval = retval;
+ 	rc = VCALL(vp, VOFFSET(vop_pathconf), &a);
+ 	return (rc);
+ }
+ struct vop_advlock_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	caddr_t a_id;
+ 	int a_op;
+ 	struct flock *a_fl;
+ 	int a_flags;
+ };
+ extern struct vnodeop_desc vop_advlock_desc;
+ static __inline int VOP_ADVLOCK __P((
+ 	struct vnode *vp,
+ 	caddr_t id,
+ 	int op,
+ 	struct flock *fl,
+ 	int flags));
+ static __inline int VOP_ADVLOCK(vp, id, op, fl, flags)
+ 	struct vnode *vp;
+ 	caddr_t id;
+ 	int op;
+ 	struct flock *fl;
+ 	int flags;
+ {
+ 	struct vop_advlock_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_advlock);
+ 	a.a_vp = vp;
+ 	a.a_id = id;
+ 	a.a_op = op;
+ 	a.a_fl = fl;
+ 	a.a_flags = flags;
+ 	rc = VCALL(vp, VOFFSET(vop_advlock), &a);
+ 	return (rc);
+ }
+ struct vop_balloc_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	off_t a_startoffset;
+ 	int a_size;
+ 	struct ucred *a_cred;
+ 	int a_flags;
+ 	struct buf **a_bpp;
+ };
+ extern struct vnodeop_desc vop_balloc_desc;
+ static __inline int VOP_BALLOC __P((
+ 	struct vnode *vp,
+ 	off_t startoffset,
+ 	int size,
+ 	struct ucred *cred,
+ 	int flags,
+ 	struct buf **bpp));
+ static __inline int VOP_BALLOC(vp, startoffset, size, cred, flags, bpp)
+ 	struct vnode *vp;
+ 	off_t startoffset;
+ 	int size;
+ 	struct ucred *cred;
+ 	int flags;
+ 	struct buf **bpp;
+ {
+ 	struct vop_balloc_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_balloc);
+ 	a.a_vp = vp;
+ 	a.a_startoffset = startoffset;
+ 	a.a_size = size;
+ 	a.a_cred = cred;
+ 	a.a_flags = flags;
+ 	a.a_bpp = bpp;
+ 	rc = VCALL(vp, VOFFSET(vop_balloc), &a);
+ 	return (rc);
+ }
+ struct vop_reallocblks_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct cluster_save *a_buflist;
+ };
+ extern struct vnodeop_desc vop_reallocblks_desc;
+ static __inline int VOP_REALLOCBLKS __P((
+ 	struct vnode *vp,
+ 	struct cluster_save *buflist));
+ static __inline int VOP_REALLOCBLKS(vp, buflist)
+ 	struct vnode *vp;
+ 	struct cluster_save *buflist;
+ {
+ 	struct vop_reallocblks_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_reallocblks);
+ 	a.a_vp = vp;
+ 	a.a_buflist = buflist;
+ 	rc = VCALL(vp, VOFFSET(vop_reallocblks), &a);
+ 	return (rc);
+ }
+ struct vop_getpages_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	vm_page_t *a_m;
+ 	int a_count;
+ 	int a_reqpage;
+ 	vm_ooffset_t a_offset;
+ };
+ extern struct vnodeop_desc vop_getpages_desc;
+ static __inline int VOP_GETPAGES __P((
+ 	struct vnode *vp,
+ 	vm_page_t *m,
+ 	int count,
+ 	int reqpage,
+ 	vm_ooffset_t offset));
+ static __inline int VOP_GETPAGES(vp, m, count, reqpage, offset)
+ 	struct vnode *vp;
+ 	vm_page_t *m;
+ 	int count;
+ 	int reqpage;
+ 	vm_ooffset_t offset;
+ {
+ 	struct vop_getpages_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_getpages);
+ 	a.a_vp = vp;
+ 	a.a_m = m;
+ 	a.a_count = count;
+ 	a.a_reqpage = reqpage;
+ 	a.a_offset = offset;
+ 	rc = VCALL(vp, VOFFSET(vop_getpages), &a);
+ 	return (rc);
+ }
+ struct vop_putpages_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	vm_page_t *a_m;
+ 	int a_count;
+ 	int a_sync;
+ 	int *a_rtvals;
+ 	vm_ooffset_t a_offset;
+ };
+ extern struct vnodeop_desc vop_putpages_desc;
+ static __inline int VOP_PUTPAGES __P((
+ 	struct vnode *vp,
+ 	vm_page_t *m,
+ 	int count,
+ 	int sync,
+ 	int *rtvals,
+ 	vm_ooffset_t offset));
+ static __inline int VOP_PUTPAGES(vp, m, count, sync, rtvals, offset)
+ 	struct vnode *vp;
+ 	vm_page_t *m;
+ 	int count;
+ 	int sync;
+ 	int *rtvals;
+ 	vm_ooffset_t offset;
+ {
+ 	struct vop_putpages_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_putpages);
+ 	a.a_vp = vp;
+ 	a.a_m = m;
+ 	a.a_count = count;
+ 	a.a_sync = sync;
+ 	a.a_rtvals = rtvals;
+ 	a.a_offset = offset;
+ 	rc = VCALL(vp, VOFFSET(vop_putpages), &a);
+ 	return (rc);
+ }
+ struct vop_freeblks_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	daddr_t a_addr;
+ 	daddr_t a_length;
+ };
+ extern struct vnodeop_desc vop_freeblks_desc;
+ static __inline int VOP_FREEBLKS __P((
+ 	struct vnode *vp,
+ 	daddr_t addr,
+ 	daddr_t length));
+ static __inline int VOP_FREEBLKS(vp, addr, length)
+ 	struct vnode *vp;
+ 	daddr_t addr;
+ 	daddr_t length;
+ {
+ 	struct vop_freeblks_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_freeblks);
+ 	a.a_vp = vp;
+ 	a.a_addr = addr;
+ 	a.a_length = length;
+ 	rc = VCALL(vp, VOFFSET(vop_freeblks), &a);
+ 	return (rc);
+ }
+ struct vop_bwrite_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	struct buf *a_bp;
+ };
+ extern struct vnodeop_desc vop_bwrite_desc;
+ static __inline int VOP_BWRITE __P((
+ 	struct vnode *vp,
+ 	struct buf *bp));
+ static __inline int VOP_BWRITE(vp, bp)
+ 	struct vnode *vp;
+ 	struct buf *bp;
+ {
+ 	struct vop_bwrite_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_bwrite);
+ 	a.a_vp = vp;
+ 	a.a_bp = bp;
+ 	rc = VCALL(vp, VOFFSET(vop_bwrite), &a);
+ 	return (rc);
+ }
+ struct vop_getacl_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	acl_type_t a_type;
+ 	struct acl *a_aclp;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_getacl_desc;
+ static __inline int VOP_GETACL __P((
+ 	struct vnode *vp,
+ 	acl_type_t type,
+ 	struct acl *aclp,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_GETACL(vp, type, aclp, cred, p)
+ 	struct vnode *vp;
+ 	acl_type_t type;
+ 	struct acl *aclp;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_getacl_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_getacl);
+ 	a.a_vp = vp;
+ 	a.a_type = type;
+ 	a.a_aclp = aclp;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_getacl), &a);
+ 	return (rc);
+ }
+ struct vop_setacl_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	acl_type_t a_type;
+ 	struct acl *a_aclp;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_setacl_desc;
+ static __inline int VOP_SETACL __P((
+ 	struct vnode *vp,
+ 	acl_type_t type,
+ 	struct acl *aclp,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_SETACL(vp, type, aclp, cred, p)
+ 	struct vnode *vp;
+ 	acl_type_t type;
+ 	struct acl *aclp;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_setacl_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_setacl);
+ 	a.a_vp = vp;
+ 	a.a_type = type;
+ 	a.a_aclp = aclp;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_setacl), &a);
+ 	return (rc);
+ }
+ struct vop_aclcheck_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	acl_type_t a_type;
+ 	struct acl *a_aclp;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_aclcheck_desc;
+ static __inline int VOP_ACLCHECK __P((
+ 	struct vnode *vp,
+ 	acl_type_t type,
+ 	struct acl *aclp,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_ACLCHECK(vp, type, aclp, cred, p)
+ 	struct vnode *vp;
+ 	acl_type_t type;
+ 	struct acl *aclp;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_aclcheck_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_aclcheck);
+ 	a.a_vp = vp;
+ 	a.a_type = type;
+ 	a.a_aclp = aclp;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_aclcheck), &a);
+ 	return (rc);
+ }
+ struct vop_getextattr_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	char *a_name;
+ 	struct uio *a_uio;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_getextattr_desc;
+ static __inline int VOP_GETEXTATTR __P((
+ 	struct vnode *vp,
+ 	char *name,
+ 	struct uio *uio,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_GETEXTATTR(vp, name, uio, cred, p)
+ 	struct vnode *vp;
+ 	char *name;
+ 	struct uio *uio;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_getextattr_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_getextattr);
+ 	a.a_vp = vp;
+ 	a.a_name = name;
+ 	a.a_uio = uio;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_getextattr), &a);
+ 	return (rc);
+ }
+ struct vop_setextattr_args {
+ 	struct vnodeop_desc *a_desc;
+ 	struct vnode *a_vp;
+ 	char *a_name;
+ 	struct uio *a_uio;
+ 	struct ucred *a_cred;
+ 	struct proc *a_p;
+ };
+ extern struct vnodeop_desc vop_setextattr_desc;
+ static __inline int VOP_SETEXTATTR __P((
+ 	struct vnode *vp,
+ 	char *name,
+ 	struct uio *uio,
+ 	struct ucred *cred,
+ 	struct proc *p));
+ static __inline int VOP_SETEXTATTR(vp, name, uio, cred, p)
+ 	struct vnode *vp;
+ 	char *name;
+ 	struct uio *uio;
+ 	struct ucred *cred;
+ 	struct proc *p;
+ {
+ 	struct vop_setextattr_args a;
+ 	int rc;
+ 	a.a_desc = VDESC(vop_setextattr);
+ 	a.a_vp = vp;
+ 	a.a_name = name;
+ 	a.a_uio = uio;
+ 	a.a_cred = cred;
+ 	a.a_p = p;
+ 	rc = VCALL(vp, VOFFSET(vop_setextattr), &a);
+ 	return (rc);
+ }
Index: openafs/src/afs/LINUX/osi_file.c
diff -c openafs/src/afs/LINUX/osi_file.c:1.4.2.2 openafs/src/afs/LINUX/osi_file.c:1.4.2.4
*** openafs/src/afs/LINUX/osi_file.c:1.4.2.2	Tue Mar  6 16:08:27 2001
--- openafs/src/afs/LINUX/osi_file.c	Mon Apr 23 03:54:11 2001
***************
*** 132,139 ****
--- 132,145 ----
      lock_kernel();
      code = inode_change_ok(inode, &newattrs);
      if (!code)
+ #ifdef INODE_SETATTR_NOT_VOID
+ 	code = inode_setattr(inode, &newattrs);
+ #else
  	inode_setattr(inode, &newattrs);
+ #endif
      unlock_kernel();
+     if (!code)
+ 	truncate_inode_pages(&inode->i_data, asize);
  #else
      if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) {
  	code = inode->i_sb->s_op->notify_change(&afile->dentry, &newattrs);
Index: openafs/src/afs/LINUX/osi_groups.c
diff -c openafs/src/afs/LINUX/osi_groups.c:1.2.2.2 openafs/src/afs/LINUX/osi_groups.c:1.2.2.4
*** openafs/src/afs/LINUX/osi_groups.c:1.2.2.2	Fri Jan 19 04:29:39 2001
--- openafs/src/afs/LINUX/osi_groups.c	Mon Apr 23 03:05:31 2001
***************
*** 126,132 ****
      return code;
  }
  
! #ifdef AFS_SPARC64_LINUX20_ENV
  asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist)
  {
      gid_t gl[NGROUPS];
--- 126,164 ----
      return code;
  }
  
! #if defined(AFS_LINUX24_ENV)
! /* Intercept the standard uid32 system call. */
! extern int (*sys_setgroups32p)(int gidsetsize, gid_t *grouplist);
! asmlinkage int afs_xsetgroups32(int gidsetsize, gid_t *grouplist)
! {
!     int code;
!     cred_t *cr = crref();
!     afs_uint32 junk;
!     int old_pag;
!     
!     lock_kernel();
!     old_pag = PagInCred(cr);
!     crfree(cr);
!     unlock_kernel();
! 
!     code = (*sys_setgroups32p)(gidsetsize, grouplist);
!     if (code) {
! 	return code;
!     }
! 
!     lock_kernel();
!     cr = crref();
!     if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
! 	/* re-install old pag if there's room. */
! 	code = setpag(&cr, old_pag, &junk, 0);
!     }
!     crfree(cr);
!     unlock_kernel();
! 
!     return code;
! }
! #endif
! #if defined(AFS_SPARC64_LINUX20_ENV)
  asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist)
  {
      gid_t gl[NGROUPS];
Index: openafs/src/afs/LINUX/osi_misc.c
diff -c openafs/src/afs/LINUX/osi_misc.c:1.3.2.2 openafs/src/afs/LINUX/osi_misc.c:1.3.2.5
*** openafs/src/afs/LINUX/osi_misc.c:1.3.2.2	Tue Mar  6 16:08:27 2001
--- openafs/src/afs/LINUX/osi_misc.c	Mon Apr 23 03:52:29 2001
***************
*** 302,308 ****
--- 302,314 ----
  #else
  	    if (ip->i_nrpages) {
  #endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+ 	        truncate_inode_pages(&ip->i_data, 0);
+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
+ 	        truncate_inode_pages(ip, 0);
+ #else
  		invalidate_inode_pages(ip);
+ #endif
  #if defined(AFS_LINUX24_ENV)
  		if (ip->i_data.nrpages) {
  #else
***************
*** 411,417 ****
  		 ICL_TYPE_POINTER, avc,
  		 ICL_TYPE_POINTER, dp);
      }
!     
    } /* if bad parent */
   
    return;
--- 417,425 ----
  		 ICL_TYPE_POINTER, avc,
  		 ICL_TYPE_POINTER, dp);
      }
!     if (avc)
! 	AFS_RELE(avc);
!     crfree(credp);
    } /* if bad parent */
   
    return;
Index: openafs/src/afs/LINUX/osi_module.c
diff -c openafs/src/afs/LINUX/osi_module.c:1.3.2.1 openafs/src/afs/LINUX/osi_module.c:1.3.2.6
*** openafs/src/afs/LINUX/osi_module.c:1.3.2.1	Fri Jan 19 04:29:39 2001
--- openafs/src/afs/LINUX/osi_module.c	Mon Apr 23 03:46:07 2001
***************
*** 22,32 ****
--- 22,38 ----
  
  
  asmlinkage int (*sys_settimeofdayp)(struct timeval *tv, struct timezone *tz);
+ #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 int (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist);
  
+ #ifdef AFS_SPARC64_LINUX20_ENV
  extern unsigned int sys_call_table[];  /* changed to uint because SPARC64 has syscaltable of 32bit items */
+ #else
+ extern void * sys_call_table[]; /* safer for other linuces */
+ #endif
  extern struct file_system_type afs_file_system;
  
  static long get_page_offset(void);
***************
*** 42,49 ****
  /* Since sys_ni_syscall is not exported, I need to cache it in order to restore
   * it.
   */
  static unsigned int afs_ni_syscall = 0;
! 
  #ifdef AFS_SPARC64_LINUX20_ENV
  static unsigned int afs_ni_syscall32 = 0;
  asmlinkage int (*sys_setgroupsp32)(int gidsetsize, __kernel_gid_t32 *grouplist);
--- 48,59 ----
  /* Since sys_ni_syscall is not exported, I need to cache it in order to restore
   * it.
   */
+ #ifdef AFS_SPARC64_LINUX20_ENV
  static unsigned int afs_ni_syscall = 0;
! #else
! static void* afs_ni_syscall = 0;
! #endif
!  
  #ifdef AFS_SPARC64_LINUX20_ENV
  static unsigned int afs_ni_syscall32 = 0;
  asmlinkage int (*sys_setgroupsp32)(int gidsetsize, __kernel_gid_t32 *grouplist);
***************
*** 63,91 ****
  }
  #endif
  
  #define POINTER2SYSCALL (unsigned int)(unsigned long)
  #define SYSCALL2POINTER (void *)(long)
  
  int init_module(void)
  {
      extern int afs_syscall();
      extern int afs_xsetgroups();
! #ifdef AFS_SPARC64_LINUX20_ENV
      extern int afs_xsetgroups32();
  #endif
  
      /* obtain PAGE_OFFSET value */
      afs_linux_page_offset = get_page_offset();
  
      if (afs_linux_page_offset == 0) {
          /* couldn't obtain page offset so can't continue */
          printf("afs: Unable to obtain PAGE_OFFSET. Exiting..");
          return -EIO;
      }
  
      /* Initialize pointers to kernel syscalls. */
      sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday];
      sys_socketcallp = SYSCALL2POINTER sys_call_table[__NR_socketcall];
      sys_killp = SYSCALL2POINTER sys_call_table[__NR_kill];
  
      /* setup AFS entry point. */
--- 73,114 ----
  }
  #endif
  
+ #if defined(AFS_LINUX24_ENV)
+ asmlinkage int (*sys_setgroups32p)(int gidsetsize, __kernel_gid32_t *grouplist);
+ #endif 
+ 
+ #ifdef AFS_SPARC64_LINUX20_ENV
  #define POINTER2SYSCALL (unsigned int)(unsigned long)
  #define SYSCALL2POINTER (void *)(long)
+ #else
+ #define POINTER2SYSCALL (void *)
+ #define SYSCALL2POINTER (void *)
+ #endif
  
  int init_module(void)
  {
      extern int afs_syscall();
      extern int afs_xsetgroups();
! #if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_LINUX24_ENV)
      extern int afs_xsetgroups32();
  #endif
  
      /* obtain PAGE_OFFSET value */
      afs_linux_page_offset = get_page_offset();
  
+ #ifndef AFS_S390_LINUX22_ENV
      if (afs_linux_page_offset == 0) {
          /* couldn't obtain page offset so can't continue */
          printf("afs: Unable to obtain PAGE_OFFSET. Exiting..");
          return -EIO;
      }
+ #endif
  
      /* Initialize pointers to kernel syscalls. */
      sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday];
+ #if !defined(AFS_ALPHA_LINUX20_ENV)
      sys_socketcallp = SYSCALL2POINTER sys_call_table[__NR_socketcall];
+ #endif /* no socketcall on alpha */
      sys_killp = SYSCALL2POINTER sys_call_table[__NR_kill];
  
      /* setup AFS entry point. */
***************
*** 112,117 ****
--- 135,144 ----
      sys_setgroupsp32 = SYSCALL2POINTER sys_call_table32[__NR_setgroups];
      sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups32;
  #endif
+ #if defined(__NR_setgroups32)
+     sys_setgroups32p = SYSCALL2POINTER sys_call_table[__NR_setgroups32];
+     sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32;
+ #endif
  
      return 0;
  }
***************
*** 126,132 ****
      sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp32;
      sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32;
  #endif
! 
      unregister_filesystem(&afs_file_system);
  
      osi_linux_free_inode_pages(); /* Invalidate all pages using AFS inodes. */
--- 153,161 ----
      sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp32;
      sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32;
  #endif
! #if defined(__NR_setgroups32)
!     sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p;
! #endif
      unregister_filesystem(&afs_file_system);
  
      osi_linux_free_inode_pages(); /* Invalidate all pages using AFS inodes. */
***************
*** 137,143 ****
  
  static long get_page_offset(void)
  {
! #if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV)
      return PAGE_OFFSET;
  #else
      struct task_struct *p;
--- 166,172 ----
  
  static long get_page_offset(void)
  {
! #if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV)
      return PAGE_OFFSET;
  #else
      struct task_struct *p;
Index: openafs/src/afs/LINUX/osi_vfs.h
diff -c openafs/src/afs/LINUX/osi_vfs.h:1.3.2.3 openafs/src/afs/LINUX/osi_vfs.h:1.3.2.4
*** openafs/src/afs/LINUX/osi_vfs.h:1.3.2.3	Tue Mar  6 16:13:11 2001
--- openafs/src/afs/LINUX/osi_vfs.h	Mon Apr 23 03:54:11 2001
***************
*** 50,55 ****
--- 50,58 ----
  #if !defined(AFS_LINUX24_ENV)
  	unsigned long		i_nrpages;
  #endif
+ #ifdef STRUCT_INODE_HAS_I_BYTES
+         unsigned short          i_bytes;
+ #endif
  	struct semaphore	i_sem;
  #if defined(AFS_LINUX24_ENV)
          struct semaphore        i_zombie;
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.3.2.2 openafs/src/afs/LINUX/osi_vfsops.c:1.3.2.4
*** openafs/src/afs/LINUX/osi_vfsops.c:1.3.2.2	Tue Mar  6 16:08:27 2001
--- openafs/src/afs/LINUX/osi_vfsops.c	Mon Apr 23 03:50:31 2001
***************
*** 89,94 ****
--- 89,97 ----
      sb->s_blocksize_bits = 10;
      sb->s_magic = AFS_VFSMAGIC;
      sb->s_op = &afs_sops;	/* Super block (vfs) ops */
+ #if defined(MAX_NON_LFS)
+     sb->s_maxbytes = MAX_NON_LFS;
+ #endif
      code = afs_root(sb);
      if (code)
  	MOD_DEC_USE_COUNT;
***************
*** 134,140 ****
  		/* setup super_block and mount point inode. */
  		afs_globalVp = tvp;
  #if defined(AFS_LINUX24_ENV)
! 		afsp->s_root = d_alloc_root((struct inode*)tvp);
  #else
  		afsp->s_root = d_alloc_root((struct inode*)tvp, NULL);
  #endif
--- 137,143 ----
  		/* setup super_block and mount point inode. */
  		afs_globalVp = tvp;
  #if defined(AFS_LINUX24_ENV)
! 		afsp->s_root = d_alloc_root((struct inode*)&tvp->v);
  #else
  		afsp->s_root = d_alloc_root((struct inode*)tvp, NULL);
  #endif
***************
*** 255,262 ****
      AFS_GLOCK();
      AFS_STATCNT(afs_unmount);
  
!     if (!suser())
  	return;
  
      afs_globalVFS = 0;
      afs_globalVp = 0;
--- 258,267 ----
      AFS_GLOCK();
      AFS_STATCNT(afs_unmount);
  
!     if (!suser()) {
! 	AFS_GUNLOCK();
  	return;
+     }
  
      afs_globalVFS = 0;
      afs_globalVp = 0;
Index: openafs/src/afs/LINUX/osi_vm.c
diff -c openafs/src/afs/LINUX/osi_vm.c:1.2 openafs/src/afs/LINUX/osi_vm.c:1.2.2.3
*** openafs/src/afs/LINUX/osi_vm.c:1.2	Sat Nov  4 05:03:25 2000
--- openafs/src/afs/LINUX/osi_vm.c	Mon Apr 23 03:55:35 2001
***************
*** 45,51 ****
--- 45,57 ----
      if (avc->opens != 0)
  	return EBUSY;
  
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+     truncate_inode_pages(&ip->i_data, 0);
+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
+     truncate_inode_pages(ip, 0);
+ #else
      invalidate_inode_pages(ip);
+ #endif
      return 0;
  }
  
***************
*** 88,94 ****
--- 94,110 ----
   */
  void osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
  {
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+     struct inode *ip = (struct inode*)avc;
+ 
+     truncate_inode_pages(&ip->i_data, 0);
+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
+     struct inode *ip = (struct inode*)avc;
+ 
+     truncate_inode_pages(ip, 0);
+ #else
      invalidate_inode_pages((struct inode*)avc);
+ #endif
  }
  
  /* Purge pages beyond end-of-file, when truncating a file.
***************
*** 99,103 ****
--- 115,129 ----
   */
  void osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
  {
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+     struct inode *ip = (struct inode*)avc;
+ 
+     truncate_inode_pages(&ip->i_data, alen);
+ #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
+     struct inode *ip = (struct inode*)avc;
+ 
+     truncate_inode_pages(ip, alen);
+ #else
      invalidate_inode_pages((struct inode*)avc);
+ #endif
  }
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.6.2.4 openafs/src/afs/LINUX/osi_vnodeops.c:1.6.2.15
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.6.2.4	Tue Mar  6 16:08:27 2001
--- openafs/src/afs/LINUX/osi_vnodeops.c	Mon Apr 23 03:54:55 2001
***************
*** 231,237 ****
  
  	/* filldir returns -EINVAL when the buffer is full. */
  #ifdef AFS_LINUX24_ENV
! 	code = (*filldir)(dirbuf, de->name, len, offset, ino, DT_DIR);
  #else
  	code = (*filldir)(dirbuf, de->name, len, offset, ino); 
  #endif
--- 231,269 ----
  
  	/* filldir returns -EINVAL when the buffer is full. */
  #ifdef AFS_LINUX24_ENV
!         {
!              unsigned int type=DT_UNKNOWN;
!              struct VenusFid afid;
!              struct vcache *tvc;
!              int vtype;
!              afid.Cell=avc->fid.Cell;
!              afid.Fid.Volume=avc->fid.Fid.Volume;
!              afid.Fid.Vnode=ntohl(de->fid.vnode);
!              afid.Fid.Unique=ntohl(de->fid.vunique);
!              if ((avc->states & CForeign) == 0 &&
!                  (ntohl(de->fid.vnode) & 1)) {
!                   type=DT_DIR;
!              } else if ((tvc=afs_FindVCache(&afid,0,0,0,0))) {
!                   if (tvc->mvstat) {
!                        type=DT_DIR;
!                   } else if (((tvc->states) & (CStatd|CTruth))) {
!                        /* CTruth will be set if the object has 
!                         *ever* been statd */
!                        vtype=vType(tvc);
!                        if (vtype == VDIR)
!                             type=DT_DIR;
!                        else if (vtype == VREG)
!                             type=DT_REG;
!                        /* Don't do this until we're sure it can't be a mtpt */
!                        /* else if (vtype == VLNK)
!                           type=DT_LNK; */
!                        /* what other types does AFS support? */
!                   }
! 		  /* clean up from afs_FindVCache */
! 		  afs_PutVCache(tvc, WRITE_LOCK);
!              }
!              code = (*filldir)(dirbuf, de->name, len, offset, ino, type);
!         }
  #else
  	code = (*filldir)(dirbuf, de->name, len, offset, ino); 
  #endif
***************
*** 619,633 ****
      lock_kernel();
  #endif
  
-     /* If it's a negative dentry, then there's nothing to do. */
-     if (!vcp) {
- #ifdef AFS_LINUX24_ENV
-         unlock_kernel();
- #endif
- 	AFS_GUNLOCK();
- 	return 0;
-     }
- 
      /* Make this a fast path (no crref), since it's called so often. */
      if (vcp->states & CStatd) {
          if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */
--- 651,656 ----
***************
*** 654,715 ****
      return -code ;
  }
  
- /* Validate a dentry. Return 0 if unchanged, 1 if VFS layer should re-evaluate.
-  * In kernels 2.2.10 and above, we are passed an additional flags var which
-  * may have either the LOOKUP_FOLLOW OR LOOKUP_DIRECTORY set in which case
-  * we are advised to follow the entry if it is a link or to make sure that 
-  * it is a directory. But since the kernel itself checks these possibilities
-  * later on, we shouldn't have to do it until later. Perhaps in the future..
-  */
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10)
  static int afs_linux_dentry_revalidate(struct dentry *dp, int flags)
  #else
  static int afs_linux_dentry_revalidate(struct dentry *dp)
  #endif
  {
!     int code;
!     cred_t *credp;
!     struct vrequest treq;
!     struct vcache *vcp = (struct vcache*)dp->d_inode;
! 
!     AFS_GLOCK();
! #ifdef AFS_LINUX24_ENV
!     lock_kernel();
! #endif
! 
!     /* If it's a negative dentry, then there's nothing to do. */
!     if (!vcp) {
! #ifdef AFS_LINUX24_ENV
! 	unlock_kernel();
! #endif
! 	AFS_GUNLOCK();
! 	return 0;
!     }
! 
!     /* Make this a fast path (no crref), since it's called so often. */
!     if (vcp->states & CStatd) {
!         if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */
! 	    check_bad_parent(dp); /* check and correct mvid */
! 	vcache2inode(vcp);
! #ifdef AFS_LINUX24_ENV
! 	unlock_kernel();
! #endif
! 	AFS_GUNLOCK();
! 	return 0;
!     }
! 
!     credp = crref();
!     code = afs_InitReq(&treq, credp);
!     if (!code)
! 	code = afs_VerifyVCache(vcp, &treq);
! 
! #ifdef AFS_LINUX24_ENV
!     unlock_kernel();
! #endif
!     AFS_GUNLOCK();
!     crfree(credp);
! 
!     return 1;
  }
  
  /* afs_dentry_iput */
--- 677,691 ----
      return -code ;
  }
  
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10)
  static int afs_linux_dentry_revalidate(struct dentry *dp, int flags)
  #else
  static int afs_linux_dentry_revalidate(struct dentry *dp)
  #endif
  {
!     /* Force revalidation as this may be a different client than the
!        one which caused an entry to get cached */
!     return 0;
  }
  
  /* afs_dentry_iput */
***************
*** 789,794 ****
--- 765,773 ----
  #endif
  
  	dp->d_op = afs_dops;
+         /* This DV is probably wrong, unfortunately, Perhaps we should 
+            VerifyVCache the directory  */
+         dp->d_time=hgetlo(((struct vcache *)dip)->m.DataVersion);
  	d_instantiate(dp, ip);
      }
  
***************
*** 835,840 ****
--- 814,821 ----
  	    ip->i_op = &afs_symlink_iops;
  #endif
      }
+     /* directory ought to be stat'd here.... */
+     dp->d_time=hgetlo(((struct vcache *)dip)->m.DataVersion);
      dp->d_op = afs_dops;
      d_add(dp, (struct inode*)vcp);
  
***************
*** 900,908 ****
      AFS_GUNLOCK();
      if (!code) {
  	d_delete(dp);
! 	if (putback)
  	    d_add(dp, NULL); /* means definitely does _not_ exist */
      }
      crfree(credp);
      return -code;
  }
--- 881,893 ----
      AFS_GUNLOCK();
      if (!code) {
  	d_delete(dp);
! 	if (putback) {
!            /* This DV is probably wrong, unfortunately, Perhaps we should 
!               VerifyVCache the directory  */
!             dp->d_time=hgetlo(((struct vcache *)dip)->m.DataVersion);
  	    d_add(dp, NULL); /* means definitely does _not_ exist */
      }
+     }
      crfree(credp);
      return -code;
  }
***************
*** 949,954 ****
--- 934,942 ----
  	tvcp->v.v_fop = &afs_dir_fops;
  #endif
  	dp->d_op = afs_dops;
+         /* This DV is probably wrong, unfortunately, Perhaps we should 
+            VerifyVCache the directory  */
+         dp->d_time=hgetlo(((struct vcache *)dip)->m.DataVersion);
  	d_instantiate(dp, (struct inode*)tvcp);
      }
      AFS_GUNLOCK();
***************
*** 965,976 ****
      AFS_GLOCK();
      code = afs_rmdir((struct vcache*)dip, name, credp);
  
!     /* Linux likes to see ENOTDIR returned from an rmdir() syscall
       * that failed because a directory is not empty. So, we map
!      * EEXIST to ENOTDIR on linux.
       */
      if (code == EEXIST) {
! 	code = ENOTDIR;
      }
      
      if (!code) {
--- 953,964 ----
      AFS_GLOCK();
      code = afs_rmdir((struct vcache*)dip, name, credp);
  
!     /* Linux likes to see ENOTEMPTY returned from an rmdir() syscall
       * that failed because a directory is not empty. So, we map
!      * EEXIST to ENOTEMPTY on linux.
       */
      if (code == EEXIST) {
! 	code = ENOTEMPTY;
      }
      
      if (!code) {
***************
*** 1008,1015 ****
  		      newname, credp);
      AFS_GUNLOCK();
  
!     if (!code)
  	d_move(olddp, newdp);
  
      crfree(credp);
      return -code;
--- 996,1008 ----
  		      newname, credp);
      AFS_GUNLOCK();
  
!     if (!code) {
!         /* update time so it doesn't expire immediately */
!         /* This DV is probably wrong, unfortunately, Perhaps we should 
!            VerifyVCache the directory  */
!         newdp->d_time=hgetlo(((struct vcache *)newdp->d_parent->d_inode)->m.DataVersion);
  	d_move(olddp, newdp);
+     }
  
      crfree(credp);
      return -code;
***************
*** 1099,1105 ****
--- 1092,1104 ----
  {
      int code;
      cred_t *credp = crref();
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+     char *address;
+     loff_t offset = pp->index << PAGE_CACHE_SHIFT;
+ #else
      ulong address = afs_linux_page_address(pp);
+     loff_t offset = pageoff(pp);
+ #endif
      uio_t tuio;
      struct iovec iovec;
      struct inode *ip = FILE_INODE(fp);
***************
*** 1111,1136 ****
  	       ICL_TYPE_POINTER, pp,
  	       ICL_TYPE_INT32, cnt,
  	       ICL_TYPE_INT32, 99999); /* not a possible code value */
!     atomic_add(1, &pp->count);
! #if defined(AFS_LINUX24_ENV)
      ClearPageError(pp);
  #else
      set_bit(PG_locked, &pp->flags); /* other bits? See mm.h */
      clear_bit(PG_error, &pp->flags);
  #endif
  
! #if defined(AFS_LINUX24_ENV)
!     setup_uio(&tuio, &iovec, (char*)address, pp->index << PAGE_CACHE_SHIFT,
! 	      PAGESIZE, UIO_READ, AFS_UIOSYS);
! #else
!     setup_uio(&tuio, &iovec, (char*)address, pageoff(pp), PAGESIZE,
  	      UIO_READ, AFS_UIOSYS);
- #endif
- #if defined(AFS_LINUX24_ENV)
-     lock_kernel();
- #endif
      code = afs_rdwr((struct vcache*)ip, &tuio, UIO_READ, 0, credp);
! #if defined(AFS_LINUX24_ENV)
      unlock_kernel();
  #endif
  
--- 1110,1131 ----
  	       ICL_TYPE_POINTER, pp,
  	       ICL_TYPE_INT32, cnt,
  	       ICL_TYPE_INT32, 99999); /* not a possible code value */
! 
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
!     address = kmap(pp);
      ClearPageError(pp);
+ 
+     lock_kernel();
  #else
+     atomic_add(1, &pp->count);
      set_bit(PG_locked, &pp->flags); /* other bits? See mm.h */
      clear_bit(PG_error, &pp->flags);
  #endif
  
!     setup_uio(&tuio, &iovec, (char*)address, offset, PAGESIZE,
  	      UIO_READ, AFS_UIOSYS);
      code = afs_rdwr((struct vcache*)ip, &tuio, UIO_READ, 0, credp);
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
      unlock_kernel();
  #endif
  
***************
*** 1138,1160 ****
  	if (tuio.uio_resid) /* zero remainder of page */
  	    memset((void*)(address+(PAGESIZE-tuio.uio_resid)), 0,
  		   tuio.uio_resid);
! #if defined(AFS_LINUX24_ENV)
! #ifndef __powerpc__
!         flush_dcache_page(pp);
! #endif
!         SetPageUptodate(pp);
  #else
  	set_bit(PG_uptodate, &pp->flags);
  #endif
      }
  
! #if defined(AFS_LINUX24_ENV)
      UnlockPage(pp);
  #else
      clear_bit(PG_locked, &pp->flags);
      wake_up(&pp->wait);
- #endif
      free_page(address);
  
      crfree(credp);
      afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE,
--- 1133,1154 ----
  	if (tuio.uio_resid) /* zero remainder of page */
  	    memset((void*)(address+(PAGESIZE-tuio.uio_resid)), 0,
  		   tuio.uio_resid);
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
! 	flush_dcache_page(pp);
! 	SetPageUptodate(pp);
  #else
  	set_bit(PG_uptodate, &pp->flags);
  #endif
      }
  
! #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
!     kunmap(pp);
      UnlockPage(pp);
  #else
      clear_bit(PG_locked, &pp->flags);
      wake_up(&pp->wait);
      free_page(address);
+ #endif
  
      crfree(credp);
      afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE,
***************
*** 1192,1198 ****
      AFS_GUNLOCK();
      SetPageUptodate(pp);
      UnlockPage(pp);
-     /* kunmap(pp); */
      if (status == offset)
  	return 0;
      else
--- 1186,1191 ----
***************
*** 1245,1265 ****
                          unsigned int count)
  {
      struct vcache *vcp = (struct vcache *) ip;
!     u8 *page_addr = (u8*) afs_linux_page_address(pp);
      int code = 0;
      cred_t *credp;
      uio_t tuio;
      struct iovec iovec;
      int f_flags = 0;
  
      credp = crref();
      afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
                ICL_TYPE_POINTER, pp,
                ICL_TYPE_INT32, atomic_read(&pp->count),
                ICL_TYPE_INT32, 99999);
!     setup_uio(&tuio, &iovec, page_addr + offset,
!              (pp->index << PAGE_CACHE_SHIFT) + offset, count,
!              UIO_WRITE, AFS_UIOSYS);
  
      code = afs_write(vcp, &tuio, f_flags, credp, 0);
  
--- 1238,1260 ----
                          unsigned int count)
  {
      struct vcache *vcp = (struct vcache *) ip;
!     char *buffer;
!     loff_t base;
      int code = 0;
      cred_t *credp;
      uio_t tuio;
      struct iovec iovec;
      int f_flags = 0;
  
+     buffer = kmap(pp) + offset;
+     base = (pp->index << PAGE_CACHE_SHIFT) + offset;
+ 
      credp = crref();
      afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
                ICL_TYPE_POINTER, pp,
                ICL_TYPE_INT32, atomic_read(&pp->count),
                ICL_TYPE_INT32, 99999);
!     setup_uio(&tuio, &iovec, buffer, base, count, UIO_WRITE, AFS_UIOSYS);
  
      code = afs_write(vcp, &tuio, f_flags, credp, 0);
  
***************
*** 1272,1277 ****
--- 1267,1273 ----
                ICL_TYPE_INT32, code);
  
      crfree(credp);
+     kunmap(pp);
  
      return code;
  }
***************
*** 1309,1315 ****
  	       ICL_TYPE_POINTER, pp,
  	       ICL_TYPE_INT32, atomic_read(&pp->count),
  	       ICL_TYPE_INT32, 99999);
!     setup_uio(&tuio, &iovec, page_addr + offset, pageoff(pp) + offset, count,
  	      UIO_WRITE, AFS_UIOSYS);
  
      code = afs_write(vcp, &tuio, fp->f_flags, credp, 0);
--- 1305,1311 ----
  	       ICL_TYPE_POINTER, pp,
  	       ICL_TYPE_INT32, atomic_read(&pp->count),
  	       ICL_TYPE_INT32, 99999);
!     setup_uio(&tuio, &iovec, page_addr + offset, pp->offset + offset, count,
  	      UIO_WRITE, AFS_UIOSYS);
  
      code = afs_write(vcp, &tuio, fp->f_flags, credp, 0);
***************
*** 1333,1348 ****
  #if defined(AFS_LINUX24_ENV)
  static int afs_linux_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to)
  {
!     long status;
  
      AFS_GLOCK();
      lock_kernel();
!     status = afs_linux_updatepage(file, page, offset, to-offset);
      unlock_kernel();
      AFS_GUNLOCK();
      kunmap(page);
  
!     return status;
  }
  
  static int afs_linux_prepare_write(struct file *file, struct page *page,
--- 1329,1344 ----
  #if defined(AFS_LINUX24_ENV)
  static int afs_linux_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to)
  {
!     int code;
  
      AFS_GLOCK();
      lock_kernel();
!     code = afs_linux_updatepage(file, page, offset, to-offset);
      unlock_kernel();
      AFS_GUNLOCK();
      kunmap(page);
  
!     return code;
  }
  
  static int afs_linux_prepare_write(struct file *file, struct page *page,
***************
*** 1451,1468 ****
      AFS_GLOCK();
      lock_kernel();
      code = afs_linux_ireadlink(ip, p, PAGE_SIZE, AFS_UIOSYS);
-     unlock_kernel();
-     AFS_GUNLOCK();
  
      if (code<0)
             goto fail;
      p[code] = '\0';            /* null terminate? */
      SetPageUptodate(page);
      kunmap(page);
      UnlockPage(page);
      return 0;
  
  fail:
      SetPageError(page);
      kunmap(page);
      UnlockPage(page);
--- 1447,1468 ----
      AFS_GLOCK();
      lock_kernel();
      code = afs_linux_ireadlink(ip, p, PAGE_SIZE, AFS_UIOSYS);
  
      if (code<0)
             goto fail;
      p[code] = '\0';            /* null terminate? */
+     unlock_kernel();
+     AFS_GUNLOCK();
+ 
      SetPageUptodate(page);
      kunmap(page);
      UnlockPage(page);
      return 0;
  
  fail:
+     unlock_kernel();
+     AFS_GUNLOCK();
+ 
      SetPageError(page);
      kunmap(page);
      UnlockPage(page);
Index: openafs/src/afs/SOLARIS/osi_file.c
diff -c openafs/src/afs/SOLARIS/osi_file.c:1.2 openafs/src/afs/SOLARIS/osi_file.c:1.2.2.1
*** openafs/src/afs/SOLARIS/osi_file.c:1.2	Sat Nov  4 05:03:25 2000
--- openafs/src/afs/SOLARIS/osi_file.c	Mon Apr 23 03:33:30 2001
***************
*** 263,269 ****
--- 263,273 ----
  {
     if (afs_CacheFSType == AFS_SUN_UFS_CACHE) {
         struct inode *ip = VTOI(avp);
+        rw_enter(&ip->i_contents, RW_READER);
+        mutex_enter(&ip->i_tlock);
         ip->i_flag &= ~IACC;
+        mutex_exit(&ip->i_tlock);
+        rw_exit(&ip->i_contents);
     }
  }
  
Index: openafs/src/afs/SOLARIS/osi_inode.c
diff -c openafs/src/afs/SOLARIS/osi_inode.c:1.3.2.1 openafs/src/afs/SOLARIS/osi_inode.c:1.3.2.3
*** openafs/src/afs/SOLARIS/osi_inode.c:1.3.2.1	Fri Jan 19 05:24:04 2001
--- openafs/src/afs/SOLARIS/osi_inode.c	Mon Apr 23 03:47:08 2001
***************
*** 19,26 ****
  #include "../afs/osi_inode.h"
  #include "../afs/afs_stats.h" /* statistics stuff */
  
! extern int (*ufs_iputp)(), (*ufs_iallocp)(), (*ufs_iupdatp)(),  (*ufs_igetp)();
  
  getinode(vfsp, dev, inode, ipp, credp,perror)
       struct vfs *vfsp;
       struct AFS_UCRED *credp;
--- 19,33 ----
  #include "../afs/osi_inode.h"
  #include "../afs/afs_stats.h" /* statistics stuff */
  
! extern int (*ufs_iallocp)(), (*ufs_iupdatp)(), (*ufs_igetp)(),
!            (*ufs_itimes_nolockp)();
  
+ #define AFS_ITIMES(ip) { \
+         mutex_enter(&(ip)->i_tlock); \
+         (*ufs_itimes_nolockp)(ip); \
+         mutex_exit(&(ip)->i_tlock); \
+ }
+ 
  getinode(vfsp, dev, inode, ipp, credp,perror)
       struct vfs *vfsp;
       struct AFS_UCRED *credp;
***************
*** 34,39 ****
--- 41,47 ----
      struct vnode *vp;
      struct fs *fs;
      struct inode *pip;
+     struct ufsvfs *ufsvfsp;
      
      AFS_STATCNT(getinode);
      
***************
*** 48,54 ****
  	) {
  	return (ENODEV);
      }
!     if (code = (*ufs_igetp)(vfsp, inode, &ip, credp)) {
  	*perror = BAD_IGET;
  	return code;
      }
--- 56,72 ----
  	) {
  	return (ENODEV);
      }
!     ufsvfsp = (struct ufsvfs *)vfsp->vfs_data;
! 
! #if defined(AFS_SUN57_ENV)
!     rw_enter(&ufsvfsp->vfs_dqrwlock, RW_READER);
! #endif
!     code = (*ufs_igetp)(vfsp, inode, &ip, credp);
! #if defined(AFS_SUN57_ENV)
!     rw_exit(&ufsvfsp->vfs_dqrwlock);
! #endif
! 
!     if (code) {
  	*perror = BAD_IGET;
  	return code;
      }
***************
*** 81,94 ****
      
      if (ip->i_mode == 0) {
  	/* Not an allocated inode */
  	rw_exit(&ip->i_contents);
! 	(*ufs_iputp)(ip);
  	return (ENOENT);
      }
      
      if (ip->i_nlink == 0 || (ip->i_mode&IFMT) != IFREG) {
  	rw_exit(&ip->i_contents);
! 	(*ufs_iputp)(ip);
  	return (ENOENT);
      }
      
--- 99,114 ----
      
      if (ip->i_mode == 0) {
  	/* Not an allocated inode */
+ 	AFS_ITIMES(ip);
  	rw_exit(&ip->i_contents);
! 	VN_RELE(ITOV(ip));
  	return (ENOENT);
      }
      
      if (ip->i_nlink == 0 || (ip->i_mode&IFMT) != IFREG) {
+ 	AFS_ITIMES(ip);
  	rw_exit(&ip->i_contents);
! 	VN_RELE(ITOV(ip));
  	return (ENOENT);
      }
      
***************
*** 122,127 ****
--- 142,148 ----
      struct inode *ip, *newip;
      register int code;
      dev_t newdev;
+     struct ufsvfs *ufsvfsp;
  
      AFS_STATCNT(afs_syscall_icreate);
      
***************
*** 142,152 ****
      if (code) {
  	return (code);
      }
!     if (code = (*ufs_iallocp)(ip, near_inode, 0, &newip, credp)) {	
! 	(*ufs_iputp)(ip);
  	return (code);
      }
-     (*ufs_iputp)(ip);
      rw_enter(&newip->i_contents, RW_WRITER);
      mutex_enter(&newip->i_tlock);
      newip->i_flag |= IACC|IUPD|ICHG;
--- 163,188 ----
      if (code) {
  	return (code);
      }
! 
!     ufsvfsp = ip->i_ufsvfs;
!     rw_enter(&ip->i_rwlock, RW_WRITER);
! #if defined(AFS_SUN57_ENV)
!     rw_enter(&ufsvfsp->vfs_dqrwlock, RW_READER);
! #endif
!     rw_enter(&ip->i_contents, RW_WRITER);
!     code = (*ufs_iallocp)(ip, near_inode, 0, &newip, credp);
! #if defined(AFS_SUN57_ENV)
!     rw_exit(&ufsvfsp->vfs_dqrwlock);
! #endif
!     rw_exit(&ip->i_rwlock);
! 
!     AFS_ITIMES(ip);
!     rw_exit(&ip->i_contents);
!     VN_RELE(ITOV(ip));
! 
!     if (code) {
  	return (code);
      }
      rw_enter(&newip->i_contents, RW_WRITER);
      mutex_enter(&newip->i_tlock);
      newip->i_flag |= IACC|IUPD|ICHG;
***************
*** 184,191 ****
       */
      if (CrSync)
  	(*ufs_iupdatp)(newip, 1);
      rw_exit(&newip->i_contents);
!     (*ufs_iputp)(newip);
      return (code);
  }
  
--- 220,228 ----
       */
      if (CrSync)
  	(*ufs_iupdatp)(newip, 1);
+     AFS_ITIMES(newip);
      rw_exit(&newip->i_contents);
!     VN_RELE(ITOV(newip));
      return (code);
  }
  
***************
*** 224,230 ****
      }
      code = falloc((struct vnode *)NULL, FWRITE|FREAD, &fp, &fd);
      if (code) {
! 	(*ufs_iputp)(ip);
  	return (code);
      }
      
--- 261,270 ----
      }
      code = falloc((struct vnode *)NULL, FWRITE|FREAD, &fp, &fd);
      if (code) {
! 	rw_enter(&ip->i_contents, RW_READER);
! 	AFS_ITIMES(ip);
! 	rw_exit(&ip->i_contents);
! 	VN_RELE(ITOV(ip));
  	return (code);
      }
      
***************
*** 284,292 ****
      if (code) {
  	return (code);
      }
!     if (!IS_VICEMAGIC(ip))
  	code = EPERM;
!     else {
  	rw_enter(&ip->i_contents, RW_WRITER);
  	ip->i_nlink += amount;
  	if (ip->i_nlink == 0) {
--- 324,336 ----
      if (code) {
  	return (code);
      }
!     if (!IS_VICEMAGIC(ip)) {
  	code = EPERM;
! 	rw_enter(&ip->i_contents, RW_READER);
! 	AFS_ITIMES(ip);
! 	rw_exit(&ip->i_contents);
! 	VN_RELE(ITOV(ip));
!     } else {
  	rw_enter(&ip->i_contents, RW_WRITER);
  	ip->i_nlink += amount;
  	if (ip->i_nlink == 0) {
***************
*** 300,308 ****
  	/* We may want to force the inode to the disk in case of crashes, other references, etc. */
  	if (IncSync)
  	    (*ufs_iupdatp)(ip, 1);
  	rw_exit(&ip->i_contents);
      }
-     (*ufs_iputp)(ip);
      return (code);
  }
  
--- 344,353 ----
  	/* We may want to force the inode to the disk in case of crashes, other references, etc. */
  	if (IncSync)
  	    (*ufs_iupdatp)(ip, 1);
+ 	AFS_ITIMES(ip);
  	rw_exit(&ip->i_contents);
+ 	VN_RELE(ITOV(ip));
      }
      return (code);
  }
  
Index: openafs/src/afs/SOLARIS/osi_vfsops.c
diff -c openafs/src/afs/SOLARIS/osi_vfsops.c:1.4 openafs/src/afs/SOLARIS/osi_vfsops.c:1.4.2.1
*** openafs/src/afs/SOLARIS/osi_vfsops.c:1.4	Tue Nov 14 19:38:24 2000
--- openafs/src/afs/SOLARIS/osi_vfsops.c	Mon Apr 23 03:33:30 2001
***************
*** 231,240 ****
  /*
   * afsinit - intialize VFS
   */
- void (*ufs_iputp)();
  int (*ufs_iallocp)();
  void (*ufs_iupdatp)();
  int (*ufs_igetp)();
  
  struct streamtab *udp_infop = 0;
  struct ill_s *ill_g_headp = 0;
--- 231,240 ----
  /*
   * afsinit - intialize VFS
   */
  int (*ufs_iallocp)();
  void (*ufs_iupdatp)();
  int (*ufs_igetp)();
+ void (*ufs_itimes_nolockp)();
  
  struct streamtab *udp_infop = 0;
  struct ill_s *ill_g_headp = 0;
***************
*** 302,315 ****
      nfs_checkauth = (int (*)()) modlookup("nfssrv", "checkauth");
      if ( !nfs_checkauth ) afs_warn("nfs_checkauth not initialised");
  #endif
-     ufs_iputp = (int (*)()) modlookup("ufs", "ufs_iput");    
      ufs_iallocp = (int (*)()) modlookup("ufs", "ufs_ialloc");    
      ufs_iupdatp = (int (*)()) modlookup("ufs", "ufs_iupdat");
      ufs_igetp = (int (*)()) modlookup("ufs", "ufs_iget");    
      udp_infop = (struct streamtab *) modlookup("udp", "udpinfo");    
      ill_g_headp = (struct ill_s *) modlookup("ip", "ill_g_head");    
  
!     if ( !ufs_iputp || !ufs_iallocp || !ufs_iupdatp ||
  	 !ufs_igetp || !udp_infop || !ill_g_headp )
  	afs_warn("AFS to UFS mapping cannot be fully initialised\n");
  
--- 302,315 ----
      nfs_checkauth = (int (*)()) modlookup("nfssrv", "checkauth");
      if ( !nfs_checkauth ) afs_warn("nfs_checkauth not initialised");
  #endif
      ufs_iallocp = (int (*)()) modlookup("ufs", "ufs_ialloc");    
      ufs_iupdatp = (int (*)()) modlookup("ufs", "ufs_iupdat");
      ufs_igetp = (int (*)()) modlookup("ufs", "ufs_iget");    
+     ufs_itimes_nolockp = (void (*)()) modlookup("ufs", "ufs_itimes_nolock");
      udp_infop = (struct streamtab *) modlookup("udp", "udpinfo");    
      ill_g_headp = (struct ill_s *) modlookup("ip", "ill_g_head");    
  
!     if ( !ufs_iallocp || !ufs_iupdatp || !ufs_itimes_nolockp ||
  	 !ufs_igetp || !udp_infop || !ill_g_headp )
  	afs_warn("AFS to UFS mapping cannot be fully initialised\n");
  
Index: openafs/src/afs/UKERNEL/afs_usrops.c
diff -c openafs/src/afs/UKERNEL/afs_usrops.c:1.2 openafs/src/afs/UKERNEL/afs_usrops.c:1.2.2.2
*** openafs/src/afs/UKERNEL/afs_usrops.c:1.2	Sat Nov  4 05:03:28 2000
--- openafs/src/afs/UKERNEL/afs_usrops.c	Mon Apr 23 03:28:52 2001
***************
*** 1845,1851 ****
  	iob.out = tbuffer;
  	iob.out_size = sizeof(tbuffer);
  
! #if defined(AFS_USR_SUN5_ENV) || defined(AFS_USR_OSF_ENV) || defined(AFS_USR_HPUX_ENV) || defined(AFS_USR_LINUX22_ENV)
  	rc = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, 0, _VICEIOCTL(8), &iob, 0);
  #elif defined(AFS_USR_SGI_ENV)
  	rc = syscall(AFS_PIOCTL, 0, _VICEIOCTL(8), &iob, 0);
--- 1845,1851 ----
  	iob.out = tbuffer;
  	iob.out_size = sizeof(tbuffer);
  
! #if defined(AFS_USR_SUN5_ENV) || defined(AFS_USR_OSF_ENV) || defined(AFS_USR_HPUX_ENV) || defined(AFS_USR_LINUX22_ENV) || defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
  	rc = syscall(AFS_SYSCALL, AFSCALL_PIOCTL, 0, _VICEIOCTL(8), &iob, 0);
  #elif defined(AFS_USR_SGI_ENV)
  	rc = syscall(AFS_PIOCTL, 0, _VICEIOCTL(8), &iob, 0);
Index: openafs/src/afs/UKERNEL/sysincludes.h
diff -c openafs/src/afs/UKERNEL/sysincludes.h:1.3.2.1 openafs/src/afs/UKERNEL/sysincludes.h:1.3.2.3
*** openafs/src/afs/UKERNEL/sysincludes.h:1.3.2.1	Wed Dec 13 16:49:09 2000
--- openafs/src/afs/UKERNEL/sysincludes.h	Mon Apr 23 03:28:54 2001
***************
*** 11,17 ****
--- 11,19 ----
  #define __AFS_SYSINCLUDESH__ 1
  
  #include  <stdio.h>
+ #if !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_USR_FBSD_ENV) /* must be included after KERNEL undef'd */
  #include  <errno.h>
+ #endif
  #include  <stdlib.h>
  #include  <string.h>
  #include  <unistd.h>
***************
*** 112,117 ****
--- 114,142 ----
  #define FREAD			0x0001
  #endif /* AFS_USR_LINUX22_ENV */
  
+ #if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
+ #ifdef KERNEL
+ #undef KERNEL
+ #define AFS_USR_UNDEF_KERNEL_ENV 1
+ #endif
+ #include  <errno.h>
+ #include  <sys/param.h>
+ #include  <sys/types.h>
+ #include  <sys/socket.h>
+ #include  <net/if.h>
+ #include  <sys/file.h>
+ #include  <sys/ioctl.h>
+ #include  <sys/stat.h>
+ #include  <sys/fcntl.h>
+ #include  <sys/uio.h>
+ #include  <netinet/in.h>
+ #include  <netdb.h>
+ #include  <arpa/inet.h>
+ #ifndef O_SYNC
+ #define O_SYNC O_FSYNC
+ #endif
+ #endif /* AFS_USR_DARWIN_ENV || AFS_USR_FBSD_ENV */
+ 
  /* glibc 2.2 has pthread_attr_setstacksize */
  #if defined(AFS_LINUX22_ENV) || defined(AFS_USR_LINUX22_ENV) && (__GLIBC_MINOR__ < 2)
  #define pthread_attr_setstacksize(a,b) 0
***************
*** 158,163 ****
--- 183,193 ----
  #undef socket
  #endif /* AFS_USR_SGI_ENV */
  
+ #if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
+ #undef if_mtu
+ #undef if_metric
+ #endif
+ 
  #define mount			usr_mount
  #define fs			usr_fs
  #define uio			usr_uio
***************
*** 1296,1302 ****
--- 1326,1334 ----
  struct usr_ucred {
  	unsigned long		cr_ref;
  	long			cr_uid;
+ #if !defined(AFS_USR_FBSD_ENV)
  	long			cr_gid;
+ #endif
  	long			cr_ruid;
  	long			cr_rgid;
  	long			cr_suid;
Index: openafs/src/afs/VNOPS/afs_vnop_attrs.c
diff -c openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.2.2.1 openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.2.2.3
*** openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.2.2.1	Fri Jan 19 04:46:06 2001
--- openafs/src/afs/VNOPS/afs_vnop_attrs.c	Mon Apr 23 03:28:58 2001
***************
*** 97,107 ****
       * anyway, so the difference between 512K and 1000000 shouldn't matter
       * much, and "&" is a lot faster than "%".
       */
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV)
      attrs->va_atime.tv_nsec = attrs->va_mtime.tv_nsec =
  	attrs->va_ctime.tv_nsec =
  	    (hgetlo(avc->m.DataVersion) & 0x7ffff) * 1000;
! #ifdef	AFS_AIX41_ENV
      attrs->va_blocksize = PAGESIZE;		/* XXX Was 8192 XXX */
  #else
      attrs->va_blksize = PAGESIZE;		/* XXX Was 8192 XXX */
--- 97,107 ----
       * anyway, so the difference between 512K and 1000000 shouldn't matter
       * much, and "&" is a lot faster than "%".
       */
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
      attrs->va_atime.tv_nsec = attrs->va_mtime.tv_nsec =
  	attrs->va_ctime.tv_nsec =
  	    (hgetlo(avc->m.DataVersion) & 0x7ffff) * 1000;
! #if defined(AFS_AIX41_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
      attrs->va_blocksize = PAGESIZE;		/* XXX Was 8192 XXX */
  #else
      attrs->va_blksize = PAGESIZE;		/* XXX Was 8192 XXX */
***************
*** 137,143 ****
      attrs->va_flags = 0;
  #endif	/* AFS_OSF_ENV */
  
! #if !defined(AFS_OSF_ENV)
  #if !defined(AFS_HPUX_ENV)
  #ifdef	AFS_SUN5_ENV
      attrs->va_nblocks = (attrs->va_size? ((attrs->va_size + 1023)>>10) << 1 : 0);
--- 137,143 ----
      attrs->va_flags = 0;
  #endif	/* AFS_OSF_ENV */
  
! #if !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #if !defined(AFS_HPUX_ENV)
  #ifdef	AFS_SUN5_ENV
      attrs->va_nblocks = (attrs->va_size? ((attrs->va_size + 1023)>>10) << 1 : 0);
***************
*** 151,157 ****
  #else /* !defined(AFS_HPUX_ENV) */
      attrs->va_blocks = (attrs->va_size? ((attrs->va_size + 1023)>>10) : 0);
  #endif /* !defined(AFS_HPUX_ENV) */
! #else	/* ! AFS_OSF_ENV */
      attrs->va_bytes = (attrs->va_size? (attrs->va_size + 1023) : 1024);
  #ifdef	va_bytes_rsv
      attrs->va_bytes_rsv = -1;
--- 151,157 ----
  #else /* !defined(AFS_HPUX_ENV) */
      attrs->va_blocks = (attrs->va_size? ((attrs->va_size + 1023)>>10) : 0);
  #endif /* !defined(AFS_HPUX_ENV) */
! #else	/* ! AFS_OSF_ENV && !AFS_FBSD_ENV */
      attrs->va_bytes = (attrs->va_size? (attrs->va_size + 1023) : 1024);
  #ifdef	va_bytes_rsv
      attrs->va_bytes_rsv = -1;
***************
*** 232,238 ****
  		  return EACCES;
  	      }
  	      if (avc->mvstat == 2) {
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV)
  		  attrs->va_mtime.tv_nsec += ((++avc->xlatordv) * 1000); 
  #else
  		  attrs->va_mtime.tv_usec += ++avc->xlatordv; 
--- 232,238 ----
  		  return EACCES;
  	      }
  	      if (avc->mvstat == 2) {
! #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  		  attrs->va_mtime.tv_nsec += ((++avc->xlatordv) * 1000); 
  #else
  		  attrs->va_mtime.tv_usec += ++avc->xlatordv; 
***************
*** 359,365 ****
  #endif
  	mask |= AFS_SETMODTIME;
  #ifndef	AFS_SGI_ENV
! #if	defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV)
  	if (av->va_mtime.tv_nsec == -1)
  #else
  	if (av->va_mtime.tv_usec == -1)
--- 359,365 ----
  #endif
  	mask |= AFS_SETMODTIME;
  #ifndef	AFS_SGI_ENV
! #if	defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  	if (av->va_mtime.tv_nsec == -1)
  #else
  	if (av->va_mtime.tv_usec == -1)
Index: openafs/src/afs/VNOPS/afs_vnop_create.c
diff -c openafs/src/afs/VNOPS/afs_vnop_create.c:1.2 openafs/src/afs/VNOPS/afs_vnop_create.c:1.2.2.1
*** openafs/src/afs/VNOPS/afs_vnop_create.c:1.2	Sat Nov  4 05:03:30 2000
--- openafs/src/afs/VNOPS/afs_vnop_create.c	Mon Apr 23 00:03:47 2001
***************
*** 287,293 ****
        (afs_Analyze(tc, code, &adp->fid, &treq,
  		   AFS_STATS_FS_RPCIDX_CREATEFILE, SHARED_LOCK, (struct cell *)0));
  
! #ifdef	AFS_OSF_ENV
      if (code == EEXIST && aexcl == NONEXCL) {
  	/* This lookup was handled in the common vn_open code in the
  	   vnode layer */
--- 287,293 ----
        (afs_Analyze(tc, code, &adp->fid, &treq,
  		   AFS_STATS_FS_RPCIDX_CREATEFILE, SHARED_LOCK, (struct cell *)0));
  
! #if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
      if (code == EEXIST && aexcl == NONEXCL) {
  	/* This lookup was handled in the common vn_open code in the
  	   vnode layer */
Index: openafs/src/afs/VNOPS/afs_vnop_fid.c
diff -c openafs/src/afs/VNOPS/afs_vnop_fid.c:1.2 openafs/src/afs/VNOPS/afs_vnop_fid.c:1.2.2.1
*** openafs/src/afs/VNOPS/afs_vnop_fid.c:1.2	Sat Nov  4 05:03:30 2000
--- openafs/src/afs/VNOPS/afs_vnop_fid.c	Mon Apr 23 00:03:47 2001
***************
*** 15,21 ****
   */
  
  #include "../afs/param.h"	/* Should be always first */
! #if !defined(AFS_DUX40_ENV) && !defined(AFS_LINUX20_ENV)
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
  #include "../afs/afs_stats.h" /* statistics */
--- 15,21 ----
   */
  
  #include "../afs/param.h"	/* Should be always first */
! #if !defined(AFS_DUX40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
  #include "../afs/sysincludes.h"	/* Standard vendor system headers */
  #include "../afs/afsincludes.h"	/* Afs-based standard headers */
  #include "../afs/afs_stats.h" /* statistics */
Index: openafs/src/afs/VNOPS/afs_vnop_flock.c
diff -c openafs/src/afs/VNOPS/afs_vnop_flock.c:1.3 openafs/src/afs/VNOPS/afs_vnop_flock.c:1.3.2.3
*** openafs/src/afs/VNOPS/afs_vnop_flock.c:1.3	Sun Nov  5 23:22:53 2000
--- openafs/src/afs/VNOPS/afs_vnop_flock.c	Mon Apr 23 03:28:59 2001
***************
*** 40,46 ****
  #if	defined(AFS_SUN5_ENV)
      register proc_t *procp = ttoproc(curthread);    
  #else
! #if !defined(AFS_AIX41_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_SGI65_ENV)
  #ifdef AFS_SGI_ENV
      struct proc *procp = OSI_GET_CURRENT_PROCP();
  #else
--- 40,46 ----
  #if	defined(AFS_SUN5_ENV)
      register proc_t *procp = ttoproc(curthread);    
  #else
! #if !defined(AFS_AIX41_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_SGI65_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #ifdef AFS_SGI_ENV
      struct proc *procp = OSI_GET_CURRENT_PROCP();
  #else
***************
*** 80,86 ****
  #endif
          slp->pid = clid;
  #else
! #if	defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV)
  	slp->pid = clid;
  #else
  #if defined(AFS_LINUX20_ENV) || defined(AFS_HPUX_ENV)
--- 80,86 ----
  #endif
          slp->pid = clid;
  #else
! #if	defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  	slp->pid = clid;
  #else
  #if defined(AFS_LINUX20_ENV) || defined(AFS_HPUX_ENV)
***************
*** 119,125 ****
  #endif
          flock->l_pid = clid;
  #else
! #if	defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV)
  	flock->l_pid = clid;
  #else
  #if defined(AFS_LINUX20_ENV) || defined(AFS_HPUX_ENV)
--- 119,125 ----
  #endif
          flock->l_pid = clid;
  #else
! #if	defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  	flock->l_pid = clid;
  #else
  #if defined(AFS_LINUX20_ENV) || defined(AFS_HPUX_ENV)
***************
*** 154,160 ****
  #if	defined(AFS_SUN5_ENV)
      register proc_t *procp = ttoproc(curthread);    
  #else
! #if !defined(AFS_AIX41_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_SGI65_ENV)
  #ifdef AFS_SGI64_ENV
      struct proc *procp = curprocp;
  #else /* AFS_SGI64_ENV */
--- 154,160 ----
  #if	defined(AFS_SUN5_ENV)
      register proc_t *procp = ttoproc(curthread);    
  #else
! #if !defined(AFS_AIX41_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_SGI65_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #ifdef AFS_SGI64_ENV
      struct proc *procp = curprocp;
  #else /* AFS_SGI64_ENV */
***************
*** 171,177 ****
        }
  #endif
        if ((flock1->l_pid == alp->pid) || 
! #if defined(AFS_AIX41_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_HPUX_ENV)
  	  (!onlymine && (flock1->l_pid == getppid()))
  #else
  #if defined(AFS_SGI65_ENV)
--- 171,177 ----
        }
  #endif
        if ((flock1->l_pid == alp->pid) || 
! #if defined(AFS_AIX41_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  	  (!onlymine && (flock1->l_pid == getppid()))
  #else
  #if defined(AFS_SGI65_ENV)
***************
*** 481,487 ****
  pid_t clid;
  off_t offset;
  #else
! #if defined(AFS_SGI_ENV) || (defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV))
  afs_lockctl(avc, af, acmd, acred, clid)
  pid_t clid;
  #else
--- 481,487 ----
  pid_t clid;
  off_t offset;
  #else
! #if defined(AFS_SGI_ENV) || (defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  afs_lockctl(avc, af, acmd, acred, clid)
  pid_t clid;
  #else
***************
*** 536,541 ****
--- 536,545 ----
  	   this way at least, they can get work done */
  	if (af->l_len == 0x7fffffff)
  	    af->l_len = 0;	/* since some systems indicate it as EOF */
+ #ifdef AFS_LINUX_64BIT_KERNEL
+ 	if (af->l_len == LONG_MAX)
+ 	    af->l_len = 0;      /* since some systems indicate it as EOF */
+ #endif
  	/* next line makes byte range locks always succeed,
  	   even when they should block */
  	if (af->l_whence != 0 || af->l_start != 0 || af->l_len != 0) {
***************
*** 824,830 ****
  #endif
  
  
! #if	!defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(UKERNEL) && !defined(AFS_LINUX20_ENV)
  /* Flock not support on System V systems */
  #ifdef AFS_OSF_ENV
  extern struct fileops afs_fileops;
--- 828,834 ----
  #endif
  
  
! #if	!defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(UKERNEL) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  /* Flock not support on System V systems */
  #ifdef AFS_OSF_ENV
  extern struct fileops afs_fileops;
***************
*** 852,858 ****
--- 856,866 ----
      uap = (struct a *)args;
      getf(&fd, uap->fd, FILE_FLAGS_NULL, &u.u_file_state);
  #else /* AFS_OSF_ENV */
+ #if defined(AFS_FBSD_ENV)
+     uap = (struct a *)u.u_ap;
+ #else
      uap = (struct a *)u.u_ap;
+ #endif /* AFS_FBSD_ENV */
      fd = getf(uap->fd);
  #endif
      if (!fd) return;
Index: openafs/src/afs/VNOPS/afs_vnop_read.c
diff -c openafs/src/afs/VNOPS/afs_vnop_read.c:1.2 openafs/src/afs/VNOPS/afs_vnop_read.c:1.2.2.1
*** openafs/src/afs/VNOPS/afs_vnop_read.c:1.2	Sat Nov  4 05:03:31 2000
--- openafs/src/afs/VNOPS/afs_vnop_read.c	Mon Apr 23 00:03:48 2001
***************
*** 420,425 ****
--- 420,432 ----
  	    code = osi_file_uio_rdwr(tfile, auio, UIO_READ);
  	    AFS_GLOCK();
  #else
+ #if defined(AFS_DARWIN_ENV)
+             AFS_GUNLOCK();
+             VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
+             code = VOP_READ(tfile->vnode, auio, 0, &afs_osi_cred);
+             VOP_UNLOCK(tfile->vnode, 0, current_proc());
+             AFS_GLOCK();
+ #else
  	    code = VOP_RDWR(tfile->vnode, auio, UIO_READ, 0, &afs_osi_cred);
  #endif
  #endif
***************
*** 427,432 ****
--- 434,440 ----
  #endif
  #endif
  #endif
+ #endif
  	    auio->afsio_offset += avc->quick.minLoc;
  	    osi_UFSClose(tfile);
  	    /* Fix up LRU info */
***************
*** 750,756 ****
--- 758,772 ----
  	    code = osi_file_uio_rdwr(tfile, &tuio, UIO_READ);
  	    AFS_GLOCK();
  #else
+ #if defined(AFS_DARWIN_ENV)
+             AFS_GUNLOCK();
+             VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
+             code = VOP_READ(tfile->vnode, &tuio, 0, &afs_osi_cred);
+             VOP_UNLOCK(tfile->vnode, 0, current_proc());
+             AFS_GLOCK();
+ #else
  	    code = VOP_RDWR(tfile->vnode, &tuio, UIO_READ, 0, &afs_osi_cred);
+ #endif
  #endif
  #endif
  #endif
Index: openafs/src/afs/VNOPS/afs_vnop_readdir.c
diff -c openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.2.2.3 openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.2.2.4
*** openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.2.2.3	Tue Mar  6 16:12:26 2001
--- openafs/src/afs/VNOPS/afs_vnop_readdir.c	Mon Apr 23 00:03:49 2001
***************
*** 136,141 ****
--- 136,147 ----
  #else
  struct min_direct {	/* miniature direct structure */
  			/* If struct direct changes, this must too */
+ #ifdef AFS_DARWIN_ENV
+     afs_uint32  d_fileno;
+     u_short     d_reclen;
+     u_char      d_type;
+     u_char      d_namlen;
+ #else   
  #ifdef	AFS_SUN5_ENV
      afs_uint32	d_fileno;
      afs_int32	d_off;
***************
*** 151,156 ****
--- 157,163 ----
      u_short	d_reclen;
      u_short	d_namlen;
  #endif
+ #endif
  };
  #endif /* AFS_SGI_ENV */
  
***************
*** 337,342 ****
--- 344,352 ----
  #if defined(AFS_SUN_ENV) || defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV)
      sdirEntry.d_off = off;
  #endif
+ #if defined(AFS_DARWIN_ENV)
+     sdirEntry.d_type=DT_UNKNOWN;
+ #endif
  
  #if defined(AFS_SGI_ENV)
      AFS_UIOMOVE(&sdirEntry, DIRENTBASESIZE, UIO_READ, auio, code);
***************
*** 409,415 ****
   * It has to do with 'offset' (seek locations).
  */
  
! #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)
  afs_readdir(OSI_VC_ARG(avc), auio, acred, eofp)
      int *eofp;
  #else
--- 419,425 ----
   * It has to do with 'offset' (seek locations).
  */
  
! #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
  afs_readdir(OSI_VC_ARG(avc), auio, acred, eofp)
      int *eofp;
  #else
***************
*** 466,472 ****
  #endif /* AFS_SGI61_ENV */
  #endif /* defined(AFS_SGI53_ENV) */
  
! #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)
      /* Not really used by the callee so we ignore it for now */
      if (eofp) *eofp = 0;
  #endif
--- 476,482 ----
  #endif /* AFS_SGI61_ENV */
  #endif /* defined(AFS_SGI53_ENV) */
  
! #if	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
      /* Not really used by the callee so we ignore it for now */
      if (eofp) *eofp = 0;
  #endif
Index: openafs/src/afs/VNOPS/afs_vnop_strategy.c
diff -c openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.2 openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.2.2.2
*** openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.2	Sat Nov  4 05:03:32 2000
--- openafs/src/afs/VNOPS/afs_vnop_strategy.c	Mon Apr 23 03:28:59 2001
***************
*** 25,31 ****
  
  
  
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV)
  afs_ustrategy(abp, credp)
      struct AFS_UCRED *credp;
  #else
--- 25,31 ----
  
  
  
! #if	defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  afs_ustrategy(abp, credp)
      struct AFS_UCRED *credp;
  #else
***************
*** 36,49 ****
      struct uio tuio;
      register struct vcache *tvc = (struct vcache *) abp->b_vp;
      register afs_int32 len = abp->b_bcount;
! #if	!defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV)
  #ifdef	AFS_AIX41_ENV
      struct ucred *credp;
  #else
      struct AFS_UCRED *credp = u.u_cred;
  #endif
  #endif
! #if	defined(AFS_SUN_ENV) || defined(AFS_SUN5_ENV)
      int async = abp->b_flags & B_ASYNC;
  #endif
      struct iovec tiovec[1];
--- 36,49 ----
      struct uio tuio;
      register struct vcache *tvc = (struct vcache *) abp->b_vp;
      register afs_int32 len = abp->b_bcount;
! #if	!defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #ifdef	AFS_AIX41_ENV
      struct ucred *credp;
  #else
      struct AFS_UCRED *credp = u.u_cred;
  #endif
  #endif
! #if	defined(AFS_SUN_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
      int async = abp->b_flags & B_ASYNC;
  #endif
      struct iovec tiovec[1];
***************
*** 71,77 ****
  	*/
  	tuio.afsio_iov = tiovec;
  	tuio.afsio_iovcnt = 1;
! #if	defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV)
  	tuio.afsio_offset = (u_int) dbtob(abp->b_blkno);
  #if	defined(AFS_SUN5_ENV)
  	tuio._uio_offset._p._u = 0;
--- 71,77 ----
  	*/
  	tuio.afsio_iov = tiovec;
  	tuio.afsio_iovcnt = 1;
! #if	defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_FBSD_ENV)
  	tuio.afsio_offset = (u_int) dbtob(abp->b_blkno);
  #if	defined(AFS_SUN5_ENV)
  	tuio._uio_offset._p._u = 0;
***************
*** 84,90 ****
--- 84,94 ----
  	tuio.afsio_fmode = 0;
  #endif
  	tuio.afsio_resid = abp->b_bcount;
+ #if defined(AFS_FBSD_ENV)
+ 	tiovec[0].iov_base = abp->b_saveaddr;
+ #else
  	tiovec[0].iov_base = abp->b_un.b_addr;
+ #endif /* AFS_FBSD_ENV */
  	tiovec[0].iov_len = abp->b_bcount;
  	/* are user's credentials valid here?  probably, but this
  	     sure seems like the wrong things to do. */
***************
*** 95,101 ****
--- 99,109 ----
  #endif
  	if (code == 0) {
  	    if (tuio.afsio_resid > 0)
+ #if defined(AFS_FBSD_ENV)
+ 		bzero(abp->b_saveaddr + abp->b_bcount - tuio.afsio_resid, tuio.afsio_resid);
+ #else
  		bzero(abp->b_un.b_addr + abp->b_bcount - tuio.afsio_resid, tuio.afsio_resid);
+ #endif /* AFS_FBSD_ENV */
  #ifdef	AFS_AIX32_ENV
  	    /*
  	     * If we read a block that is past EOF and the user was not storing
***************
*** 140,146 ****
--- 148,158 ----
  	len = MIN(abp->b_bcount, ((struct vcache *)abp->b_vp)->m.Length - dbtob(abp->b_blkno));
  #endif	/* AFS_ALPHA_ENV */
  	tuio.afsio_resid = len;
+ #if defined(AFS_FBSD_ENV)
+ 	tiovec[0].iov_base = abp->b_saveaddr;
+ #else
  	tiovec[0].iov_base = abp->b_un.b_addr;
+ #endif /* AFS_FBSD_ENV */
  	tiovec[0].iov_len = len;
  	/* are user's credentials valid here?  probably, but this
  	     sure seems like the wrong things to do. */
Index: openafs/src/afs/VNOPS/afs_vnop_write.c
diff -c openafs/src/afs/VNOPS/afs_vnop_write.c:1.2.2.1 openafs/src/afs/VNOPS/afs_vnop_write.c:1.2.2.3
*** openafs/src/afs/VNOPS/afs_vnop_write.c:1.2.2.1	Tue Mar  6 16:24:09 2001
--- openafs/src/afs/VNOPS/afs_vnop_write.c	Mon Apr 23 03:29:00 2001
***************
*** 529,535 ****
--- 529,543 ----
  	code = osi_file_uio_rdwr(tfile, &tuio, UIO_WRITE);
  	AFS_GLOCK();
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+         AFS_GUNLOCK();
+         VOP_LOCK(tfile->vnode, LK_EXCLUSIVE, current_proc());
+         code = VOP_WRITE(tfile->vnode, &tuio, 0, &afs_osi_cred);
+         VOP_UNLOCK(tfile->vnode, 0, current_proc());
+         AFS_GLOCK();
+ #else
  	code = VOP_RDWR(tfile->vnode, &tuio, UIO_WRITE, 0, &afs_osi_cred);
+ #endif /* AFS_DARWIN_ENV || AFS_FBSD_ENV */
  #endif /* AFS_LINUX20_ENV */
  #endif /* AFS_HPUX100_ENV */
  #endif /* AFS_OSF_ENV */
***************
*** 601,606 ****
--- 609,617 ----
       * If write is implemented via VM, afs_fsync() is called from the high-level
       * write op.
       */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+      if (noLock && (aio & IO_SYNC)) {
+ #else 
  #ifdef	AFS_HPUX_ENV
      /* On hpux on synchronous writes syncio will be set to IO_SYNC. If
       * we're doing them because the file was opened with O_SYNCIO specified,
***************
*** 610,615 ****
--- 621,627 ----
  #else
      if (noLock && (aio & FSYNC)) {
  #endif
+ #endif
  	if (!AFS_NFSXLATORREQ(acred))
  	    afs_fsync(avc, acred);
      }
***************
*** 638,644 ****
  
  
  
! #if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) && !defined (AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
  #ifdef AFS_DUX50_ENV
  #define vno_close(X) vn_close((X), 0, NOCRED)
  #elif defined(AFS_DUX40_ENV)
--- 650,656 ----
  
  
  
! #if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) && !defined (AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #ifdef AFS_DUX50_ENV
  #define vno_close(X) vn_close((X), 0, NOCRED)
  #elif defined(AFS_DUX40_ENV)
Index: openafs/src/afsd/Makefile
diff -c openafs/src/afsd/Makefile:1.3 openafs/src/afsd/Makefile:1.3.2.3
*** openafs/src/afsd/Makefile:1.3	Sun Nov  5 23:24:09 2000
--- openafs/src/afsd/Makefile	Mon Apr 23 03:29:03 2001
***************
*** 12,25 ****
  SRCDIR = DEST/
  
  SOURCES = afsd.c sys.c
- INSTALL = ${SRCDIR}bin/install
- INSTALLro = ${SRCDIR}bin/install -m 644
- INSTALLex = ${SRCDIR}bin/install -m 755
  
  COMPONENT=afsd
  include ../config/Makefile.${SYS_NAME}
  include ../config/Makefile.version
  
  CFLAGS = -g -I${SRCDIR}include ${XCFLAGS}
  LDFLAGS = -g ${XLDFLAGS}
  
--- 12,24 ----
  SRCDIR = DEST/
  
  SOURCES = afsd.c sys.c
  
  COMPONENT=afsd
  include ../config/Makefile.${SYS_NAME}
  include ../config/Makefile.version
  
+ INSTALLro = ${INSTALL} -m 644
+ INSTALLex = ${INSTALL} -m 755
  CFLAGS = -g -I${SRCDIR}include ${XCFLAGS}
  LDFLAGS = -g ${XLDFLAGS}
  
***************
*** 38,45 ****
  
  afsd: afsd.o $(AFSLIBS)
  	case ${SYS_NAME} in \
- 	rs_aix*) \
- 		${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} ;; \
  	sgi_61 | sgi_62 | sgi_63) \
  		${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} /usr/lib/libdwarf.a /usr/lib/libelf.a ;; \
  	sgi_64 | sgi_65 ) \
--- 37,42 ----
***************
*** 104,109 ****
--- 101,114 ----
  		*linux* ) \
  			${INSTALLex} -f afs.rc.linux ${DESTDIR}root.client/usr/vice/etc/afs.rc; \
  			${INSTALL} -f afs.conf.linux ${DESTDIR}root.client/usr/vice/etc/afs.conf ;; \
+ 		ppc_darwin*) \
+ 			mkdir -p ${DESTDIR}root.client/usr/vice/etc/afs.kext/Contents/MacOS ;\
+ 			${INSTALL} -f afs.ppc_darwin.plist ${DESTDIR}root.client/usr/vice/etc/afs.kext/Contents/Info.plist ; \
+ 			${INSTALLex} -f afs.rc.darwin ${DESTDIR}root.client/usr/vice/etc/afs.rc ; \
+ 			${INSTALL} -f afs.rc.darwin.plist ${DESTDIR}root.client/usr/vice/etc/StartupParameters.plist ;; \
+ 		*fbsd*) \
+ 			mkdir -p ${DESTDIR}root.client/usr/vice/etc/afs.rc; \
+ 			${INSTALL} -f afs.rc.fbsd ${DESTDIR}root.client/usr/vice/etc/afs.rc.fbsd ;; \
  		* )  \
  			echo No rc scripts installed for ${SYS_NAME} ;; \
  	esac
Index: openafs/src/afsd/afs.ppc_darwin.plist
diff -c /dev/null openafs/src/afsd/afs.ppc_darwin.plist:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:15 2001
--- openafs/src/afsd/afs.ppc_darwin.plist	Mon Apr 23 02:05:48 2001
***************
*** 0 ****
--- 1,31 ----
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+ <plist version="0.9">
+ <dict>
+ 	<key>CFBundleDevelopmentRegion</key>
+ 	<string>English</string>
+ 	<key>CFBundleExecutable</key>
+ 	<string>afs</string>
+ 	<key>CFBundleIdentifier</key>
+ 	<string>org.openafs.filesystems.afs</string>
+ 	<key>CFBundleInfoDictionaryVersion</key>
+ 	<string>6.0</string>
+ 	<key>CFBundleName</key>
+ 	<string>afs</string>
+ 	<key>CFBundlePackageType</key>
+ 	<string>KEXT</string>
+ 	<key>CFBundleShortVersionString</key>
+ 	<string>1.0.3</string>
+ 	<key>CFBundleSignature</key>
+ 	<string>????</string>
+ 	<key>CFBundleVersion</key>
+ 	<string>1.0.3</string>
+ 	<key>OSBundleLibraries</key>
+ 	<dict>
+ 		<key>com.apple.kernel.bsd</key>
+ 		<string>1.0.0b1</string>
+ 		<key>com.apple.kernel.mach</key>
+ 		<string>1.0.0b1</string>
+ 	</dict>
+ </dict>
+ </plist>
Index: openafs/src/afsd/afs.rc.darwin
diff -c /dev/null openafs/src/afsd/afs.rc.darwin:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:15 2001
--- openafs/src/afsd/afs.rc.darwin	Mon Apr 23 02:05:49 2001
***************
*** 0 ****
--- 1,123 ----
+ #!/bin/sh
+ # Copyright 2000, International Business Machines Corporation and others.
+ # All Rights Reserved.
+ # 
+ # This software has been released under the terms of the IBM Public
+ # License.  For details, see the LICENSE file in the top-level source
+ # directory or online at http://www.openafs.org/dl/license10.html
+ 
+ . /etc/rc.common
+ 
+ CheckForNetwork 
+ 
+ if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi
+ 
+ if [ -r /var/db/openafs ]; then
+    VICEETC=/var/db/openafs/etc
+    AFSD=/usr/sbin/afsd
+ else
+    VICEETC=/usr/vice/etc
+    AFSD=$VICEETC/afsd
+ fi
+ CONFIG=$VICEETC/config
+ AFSDOPT=$CONFIG/afsd.options
+ PACKAGE=$CONFIG/package.options
+ 
+ LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
+ MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
+ SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
+ 
+ if [ -f $AFSDOPT ]; then
+     OPTIONS=`cat $AFSDOPT`
+ else
+     OPTIONS=$MEDIUM
+ fi
+ 
+ # Need the commands ps, awk, kill, sleep
+ PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
+ if kmodstat | grep -q openafs ; then
+ :
+ else
+ if [ -d $VICEETC/afs.kext ]; then
+ 	echo "Loading AFS kernel extensions"
+ 	kextload $VICEETC/afs.kext
+ else
+ 	echo "$VICEETC/afs.kext does not exist. Skipping AFS startup."
+ 	exit 1
+ fi
+ fi
+ if kmodstat | grep -q openafs ; then
+ :
+ else
+ 	echo "AFS kernel extensions failed to initialize. Skipping AFS startup."
+ fi
+ 
+ #
+ # Start the AFS server processes if a bosserver exists
+ #
+ 
+ if [ -x /usr/afs/bin/bosserver ]; then
+ 	echo "Starting AFS Server processes"
+ 	/usr/afs/bin/bosserver
+ 	OPTIONS="$OPTIONS -nosettime"
+ 	sleep 30
+ fi
+ 
+ #
+ # Check that all of the client configuration files exist
+ #
+ 
+ for file in $AFSD $VICEETC/cacheinfo \
+ 	    $VICEETC/ThisCell $VICEETC/CellServDB
+ do
+ 	if [ ! -f ${file} ]; then
+ 		echo "${file} does not exist. Not starting AFS client."
+ 		exit 1
+ 	fi
+ done
+ 
+ #
+ # Check that the root directory for AFS (/afs) 
+ # and the cache directory (/usr/vice/cache) both exist
+ #
+ 
+ for dir in `awk -F: '{print $1, $2}' $VICEETC/cacheinfo`
+ do
+ 	if [ ! -d ${dir} ]; then
+ 		echo "${dir} does not exist. Not starting AFS client."
+ 		exit 2
+ 	fi
+ done
+ 
+ echo "Starting afsd"
+ $AFSD $OPTIONS
+ 
+ #
+ # Run package to update the disk
+ #
+ if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
+ 	/usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1
+ case $? in
+ 0)
+ 	(echo "Package completed successfully") > /dev/console 2>&1
+ 	date > /dev/console 2>&1
+ 	;;
+ 4)
+ 	(echo "Rebooting to restart system") > /dev/console 2>&1
+ 	sync
+ 	/sbin/reboot
+ 	;;
+ *)
+ 	(echo "Package update failed; continuing") > /dev/console 2>&1
+ 	;;
+ esac
+ 
+ fi
+ 
+ #
+ # Start AFS inetd services
+ # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
+ #
+ if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
+ 	/usr/sbin/inetd.afs /etc/inetd.conf.afs
+ fi
Index: openafs/src/afsd/afs.rc.darwin.plist
diff -c /dev/null openafs/src/afsd/afs.rc.darwin.plist:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:15 2001
--- openafs/src/afsd/afs.rc.darwin.plist	Mon Apr 23 02:05:49 2001
***************
*** 0 ****
--- 1,11 ----
+ {
+   Description     = "OpenAFS network file system";
+   Provides        = ("AFS");
+   Requires        = ("Resolver");
+   OrderPreference = "None";
+   Messages =
+   {
+     start = "Starting OpenAFS file system";
+     stop  = "Stopping OpenAFS file system";
+   };
+ }
Index: openafs/src/afsd/afs.rc.fbsd
diff -c /dev/null openafs/src/afsd/afs.rc.fbsd:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:15 2001
--- openafs/src/afsd/afs.rc.fbsd	Mon Apr 23 03:29:03 2001
***************
*** 0 ****
--- 1,123 ----
+ #!/bin/sh
+ # Copyright 2000, International Business Machines Corporation and others.
+ # All Rights Reserved.
+ # 
+ # This software has been released under the terms of the IBM Public
+ # License.  For details, see the LICENSE file in the top-level source
+ # directory or online at http://www.openafs.org/dl/license10.html
+ 
+ . /etc/rc.common
+ 
+ CheckForNetwork 
+ 
+ if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi
+ 
+ if [ -r /var/db/openafs ]; then
+    VICEETC=/var/db/openafs/etc
+    AFSD=/usr/sbin/afsd
+ else
+    VICEETC=/usr/vice/etc
+    AFSD=$VICEETC/afsd
+ fi
+ CONFIG=$VICEETC/config
+ AFSDOPT=$CONFIG/afsd.options
+ PACKAGE=$CONFIG/package.options
+ 
+ LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
+ MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
+ SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
+ 
+ if [ -f $AFSDOPT ]; then
+     OPTIONS=`cat $AFSDOPT`
+ else
+     OPTIONS=$MEDIUM
+ fi
+ 
+ # Need the commands ps, awk, kill, sleep
+ PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
+ if kmodstat | grep -q openafs ; then
+ :
+ else
+ if [ -d $VICEETC/afs.ko ]; then
+ 	echo "Loading AFS kernel extensions"
+ 	kldload $VICEETC/afs.ko
+ else
+ 	echo "$VICEETC/afs.ko does not exist. Skipping AFS startup."
+ 	exit 1
+ fi
+ fi
+ if kldstat | grep -q openafs ; then
+ :
+ else
+ 	echo "AFS kernel extensions failed to initialize. Skipping AFS startup."
+ fi
+ 
+ #
+ # Start the AFS server processes if a bosserver exists
+ #
+ 
+ if [ -x /usr/afs/bin/bosserver ]; then
+ 	echo "Starting AFS Server processes"
+ 	/usr/afs/bin/bosserver
+ 	OPTIONS="$OPTIONS -nosettime"
+ 	sleep 30
+ fi
+ 
+ #
+ # Check that all of the client configuration files exist
+ #
+ 
+ for file in $AFSD $VICEETC/cacheinfo \
+ 	    $VICEETC/ThisCell $VICEETC/CellServDB
+ do
+ 	if [ ! -f ${file} ]; then
+ 		echo "${file} does not exist. Not starting AFS client."
+ 		exit 1
+ 	fi
+ done
+ 
+ #
+ # Check that the root directory for AFS (/afs) 
+ # and the cache directory (/usr/vice/cache) both exist
+ #
+ 
+ for dir in `awk -F: '{print $1, $2}' $VICEETC/cacheinfo`
+ do
+ 	if [ ! -d ${dir} ]; then
+ 		echo "${dir} does not exist. Not starting AFS client."
+ 		exit 2
+ 	fi
+ done
+ 
+ echo "Starting afsd"
+ $AFSD $OPTIONS
+ 
+ #
+ # Run package to update the disk
+ #
+ if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
+ 	/usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1
+ case $? in
+ 0)
+ 	(echo "Package completed successfully") > /dev/console 2>&1
+ 	date > /dev/console 2>&1
+ 	;;
+ 4)
+ 	(echo "Rebooting to restart system") > /dev/console 2>&1
+ 	sync
+ 	/sbin/reboot
+ 	;;
+ *)
+ 	(echo "Package update failed; continuing") > /dev/console 2>&1
+ 	;;
+ esac
+ 
+ fi
+ 
+ #
+ # Start AFS inetd services
+ # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
+ #
+ if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
+ 	/usr/sbin/inetd.afs /etc/inetd.conf.afs
+ fi
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.3.2.1 openafs/src/afsd/afsd.c:1.3.2.4
*** openafs/src/afsd/afsd.c:1.3.2.1	Tue Mar  6 17:30:07 2001
--- openafs/src/afsd/afsd.c	Mon Apr 23 03:29:03 2001
***************
*** 93,99 ****
  #endif
  #endif
  
! #if defined(AFS_OSF_ENV) || defined(AFS_DEC_ENV)
  #include <sys/mount.h>
  #else
  #include <sys/vfs.h>
--- 93,99 ----
  #endif
  #endif
  
! #if defined(AFS_OSF_ENV) || defined(AFS_DEC_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  #include <sys/mount.h>
  #else
  #include <sys/vfs.h>
***************
*** 132,138 ****
  #if AFS_HAVE_STATVFS
  #include <sys/statvfs.h>
  #else
! #if !defined(AFS_OSF_ENV)
  #include <sys/statfs.h>
  #endif
  #endif
--- 132,138 ----
  #if AFS_HAVE_STATVFS
  #include <sys/statvfs.h>
  #else
! #if !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #include <sys/statfs.h>
  #endif
  #endif
***************
*** 601,606 ****
--- 601,612 ----
  	}
  	else  if ((strcmp(currp->d_name,          ".") == 0) ||
  	          (strcmp(currp->d_name,         "..") == 0) ||
+ #ifdef AFS_DECOSF_ENV
+ 		  /* these are magic AdvFS files */
+ 		  (strcmp(currp->d_name,         ".tags") == 0) ||
+ 		  (strcmp(currp->d_name,         "quota.user") == 0) ||
+ 		  (strcmp(currp->d_name,         "quota.group") == 0) ||
+ #endif
  		  (strcmp(currp->d_name, "lost+found") == 0)) {
  	    /*
  	     * Don't do anything - this file is legit, and is to be left alone.
***************
*** 1337,1342 ****
--- 1343,1351 ----
  #ifdef AFS_DEC_ENV
      if ((mount("AFS",cacheMountDir,mountFlags,GT_AFS,(caddr_t) 0)) < 0) {
  #else
+ #ifdef AFS_FBSD_ENV
+     if ((mount("AFS",cacheMountDir,mountFlags,(caddr_t) 0)) < 0) {
+ #else
  #ifdef	AFS_AUX_ENV
      if ((fsmount(MOUNT_AFS,cacheMountDir,mountFlags,(caddr_t) 0)) < 0)	{
  #else
***************
*** 1374,1380 ****
  #else
  #if defined(AFS_SGI_ENV)
      mountFlags = MS_FSS;
- 
      if ((mount(MOUNT_AFS,cacheMountDir,mountFlags,(caddr_t) MOUNT_AFS)) < 0) {
  #else
  #ifdef AFS_LINUX20_ENV
--- 1383,1388 ----
***************
*** 1389,1394 ****
--- 1397,1403 ----
  #endif /* AFS_HPUX_ENV */
  #endif /* AFS_AIX_ENV */
  #endif /* AFS_AUX_ENV */
+ #endif /* AFS_FBSD_ENV */
  #endif /* AFS_DEC_ENV */
           printf("%s: Can't mount AFS on %s(%d)\n",
  		   rn, cacheMountDir, errno);
Index: openafs/src/afsmonitor/Makefile
diff -c openafs/src/afsmonitor/Makefile:1.2 openafs/src/afsmonitor/Makefile:1.2.2.1
*** openafs/src/afsmonitor/Makefile:1.2	Sat Nov  4 05:03:48 2000
--- openafs/src/afsmonitor/Makefile	Mon Apr 23 00:04:01 2001
***************
*** 13,20 ****
  COMPONENT=afsmonitor
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
- 
  CFLAGS=-g -I. \
  	-I${SRCDIR}include \
  	-I${SRCDIR}include/afs \
--- 13,18 ----
Index: openafs/src/afsmonitor/afsmonitor.c
diff -c openafs/src/afsmonitor/afsmonitor.c:1.2 openafs/src/afsmonitor/afsmonitor.c:1.2.2.2
*** openafs/src/afsmonitor/afsmonitor.c:1.2	Sat Nov  4 05:03:49 2000
--- openafs/src/afsmonitor/afsmonitor.c	Mon Apr 23 03:29:06 2001
***************
*** 1722,1728 ****
     }
  
     /* copy connection information */
! #ifdef AFS_LINUX20_ENV
     bcopy(&(xstat_fs_Results.connP->skt), &(tmp_fsPR->connP->skt), 
  		sizeof(struct sockaddr_in));
  #else
--- 1722,1728 ----
     }
  
     /* copy connection information */
! #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
     bcopy(&(xstat_fs_Results.connP->skt), &(tmp_fsPR->connP->skt), 
  		sizeof(struct sockaddr_in));
  #else
***************
*** 2454,2460 ****
  
  
     /* copy connection information */
! #ifdef AFS_LINUX20_ENV
     bcopy(&(xstat_cm_Results.connP->skt), &(tmp_cmPR->connP->skt), 
  		sizeof(struct sockaddr_in));
  #else
--- 2454,2460 ----
  
  
     /* copy connection information */
! #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
     bcopy(&(xstat_cm_Results.connP->skt), &(tmp_cmPR->connP->skt), 
  		sizeof(struct sockaddr_in));
  #else
Index: openafs/src/afsweb/Makefile
diff -c openafs/src/afsweb/Makefile:1.2 openafs/src/afsweb/Makefile:1.2.2.1
*** openafs/src/afsweb/Makefile:1.2	Sat Nov  4 05:03:50 2000
--- openafs/src/afsweb/Makefile	Mon Apr 23 00:04:09 2001
***************
*** 11,17 ****
  include ../config/Makefile.${SYS_NAME}
  
  UKERNELDIR=../libuafs/
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET=${SRCDIR}bin/compile_et
  
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
--- 11,16 ----
***************
*** 160,166 ****
               ${SRCDIR}include/rx/xdr.h \
               ${SRCDIR}include/rx/rxkad.h \
               ${SRCDIR}include/afs/com_err.h \
!     	    weblog_errors.h $(DCE_DLOG_INCLUDES)
  deslib=${SRCDIR}lib/libdes.a
  rxkadlib=${SRCDIR}lib/librxkad.a
  authlib=${SRCDIR}lib/afs/libauth.a
--- 159,165 ----
               ${SRCDIR}include/rx/xdr.h \
               ${SRCDIR}include/rx/rxkad.h \
               ${SRCDIR}include/afs/com_err.h \
! 	     weblog_errors.h $(DCE_DLOG_INCLUDES)
  deslib=${SRCDIR}lib/libdes.a
  rxkadlib=${SRCDIR}lib/librxkad.a
  authlib=${SRCDIR}lib/afs/libauth.a
Index: openafs/src/afsweb/weblog.c
diff -c openafs/src/afsweb/weblog.c:1.2 openafs/src/afsweb/weblog.c:1.2.2.1
*** openafs/src/afsweb/weblog.c:1.2	Sat Nov  4 05:03:53 2000
--- openafs/src/afsweb/weblog.c	Mon Apr 23 02:25:46 2001
***************
*** 274,280 ****
  
  #include "adkint.h"
  #include "assert.h"
- #include <permit_xprt.h>
  #include <des.h>
  #include <afs/afsutil.h>
  
--- 274,279 ----
Index: openafs/src/audit/Makefile
diff -c openafs/src/audit/Makefile:1.2 openafs/src/audit/Makefile:1.2.2.1
*** openafs/src/audit/Makefile:1.2	Sat Nov  4 05:03:53 2000
--- openafs/src/audit/Makefile	Mon Apr 23 00:04:14 2001
***************
*** 20,26 ****
  
  UKERNELDIR = ../libuafs/
  LOCALDIR = ${DESTDIR}root.server/usr/afs/local/
- INSTALL = ${SRCDIR}bin/install
  
  audobjs = audit.o
  
--- 20,25 ----
Index: openafs/src/auth/Makefile
diff -c openafs/src/auth/Makefile:1.2 openafs/src/auth/Makefile:1.2.2.1
*** openafs/src/auth/Makefile:1.2	Sat Nov  4 05:03:54 2000
--- openafs/src/auth/Makefile	Mon Apr 23 00:04:20 2001
***************
*** 12,18 ****
  
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
- INSTALL = ${SRCDIR}bin/install
  COMPILE_ET = ${SRCDIR}bin/compile_et
  OBJS= cellconfig.o ktc.o userok.o writeconfig.o authcon.o \
      acfg_errors.o ktc_errors.o # comktc.o comvice.o comauth.o 
--- 12,17 ----
***************
*** 48,55 ****
  #comauth.o: comauth.c ${INCLS} ${SRCDIR}include/afs/vice.h
  
  ktc.krb.o: ktc.c ${INCLS} ${SRCDIR}include/afs/vice.h
! 	${CC} ${CFLAGS} -DMAYBE_NO_KTC -DAFS_KERBEROS_ENV -c ktc.c
! 	mv ktc.o ktc.krb.o
  
  ktc.o: ktc.c ${INCLS} ${SRCDIR}include/afs/vice.h
  	${CC} ${CFLAGS} -DMAYBE_NO_KTC -c ktc.c
--- 47,53 ----
  #comauth.o: comauth.c ${INCLS} ${SRCDIR}include/afs/vice.h
  
  ktc.krb.o: ktc.c ${INCLS} ${SRCDIR}include/afs/vice.h
! 	${CC} ${CFLAGS} -DMAYBE_NO_KTC -DAFS_KERBEROS_ENV -c ktc.c -o ktc.krb.o
  
  ktc.o: ktc.c ${INCLS} ${SRCDIR}include/afs/vice.h
  	${CC} ${CFLAGS} -DMAYBE_NO_KTC -c ktc.c
Index: openafs/src/auth/authcon.c
diff -c openafs/src/auth/authcon.c:1.3 openafs/src/auth/authcon.c:1.3.2.1
*** openafs/src/auth/authcon.c:1.3	Sat Nov  4 22:25:14 2000
--- openafs/src/auth/authcon.c	Mon Apr 23 02:25:50 2001
***************
*** 7,25 ****
   * directory or online at http://www.openafs.org/dl/license10.html
   */
  
- /*
-  * Revision 2.3  90/08/31  16:11:49
-  * Move permit_xprt.h.
-  * 
-  * Revision 2.2  90/08/20  10:05:54
-  * Include permit_xprt.h.
-  * Use stds.h.
-  * 
-  * Revision 2.1  90/08/07  18:51:45
-  * Start with clean version to sync test and dev trees.
-  * */
- /* See RCS log for older history. */
- 
  #if defined(UKERNEL)
  #include "../afs/param.h"
  #include "../afs/sysincludes.h"
--- 7,12 ----
***************
*** 59,78 ****
  extern int afsconf_GetKey();
  extern struct rx_securityClass *rxkad_NewServerSecurityObject();
  extern struct rx_securityClass *rxkad_NewClientSecurityObject();
- 
- /*
-  * Note: it is necessary for the #include of permit_xprt.h occur
-  * AFTER the above declaration of rxkad_NewClientSecurityObject() --
-  * otherwise, depending on the version of permit_xprt.h that gets
-  * included, there might be a syntax error.
-  */
- 
- #if defined(UKERNEL)
- #include "../afs/permit_xprt.h"
- #else /* defined(UKERNEL) */
- #include "../permit_xprt.h"
- #endif /* defined(UKERNEL) */
- 
  
  /* return a null security object if nothing else can be done */
  static afs_int32 QuickAuth(astr, aindex)
--- 46,51 ----
Index: openafs/src/bozo/Makefile
diff -c openafs/src/bozo/Makefile:1.2 openafs/src/bozo/Makefile:1.2.2.1
*** openafs/src/bozo/Makefile:1.2	Sat Nov  4 05:03:58 2000
--- openafs/src/bozo/Makefile	Mon Apr 23 00:04:24 2001
***************
*** 9,15 ****
  COMPONENT=bozo
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET=$(SRCDIR)bin/compile_et
  CFLAGS=-g -I${SRCDIR}include ${XCFLAGS}
  RPCINCLS=${SRCDIR}include/lwp.h ${SRCDIR}include/rx/rx.h bosint.h
--- 9,14 ----
Index: openafs/src/bozo/bos.c
diff -c openafs/src/bozo/bos.c:1.2.2.3 openafs/src/bozo/bos.c:1.2.2.4
*** openafs/src/bozo/bos.c:1.2.2.3	Tue Mar  6 16:49:30 2001
--- openafs/src/bozo/bos.c	Mon Apr 23 02:25:53 2001
***************
*** 53,59 ****
  static DoStat();
  
  #include "bosint.h"
- #include "../permit_xprt.h"
  
  #define MRAFS_OFFSET  9
  #define ADDPARMOFFSET 26
--- 53,58 ----
Index: openafs/src/bozo/bosserver.c
diff -c openafs/src/bozo/bosserver.c:1.2.2.4 openafs/src/bozo/bosserver.c:1.2.2.5
*** openafs/src/bozo/bosserver.c:1.2.2.4	Tue Mar  6 17:27:19 2001
--- openafs/src/bozo/bosserver.c	Sun Apr 22 23:27:16 2001
***************
*** 24,29 ****
--- 24,30 ----
  #else
  #include <unistd.h>
  #include <netinet/in.h>
+ #include <syslog.h>
  #endif /* AFS_NT40_ENV */
  #include <afs/cellconfig.h>
  #include <rx/rx.h>
***************
*** 55,60 ****
--- 56,65 ----
  extern int rx_stackSize;    /* for rx_SetStackSize macro */
  
  int DoLogging = 0;
+ int DoSyslog = 0;
+ #ifndef AFS_NT40_ENV
+ int DoSyslogFacility = LOG_DAEMON;
+ #endif
  static afs_int32 nextRestart;
  static afs_int32 nextDay;
  
***************
*** 117,122 ****
--- 122,141 ----
  	i++;
      }
  
+ #ifndef AFS_NT40_ENV
+     /* if syslog logging is on, pass "-syslog" to new bosserver */
+     if (DoSyslog) {
+ 	char *arg=(char *)malloc(40); /* enough for -syslog=# */
+ 	if ( DoSyslogFacility != LOG_DAEMON ) {
+ 	    snprintf(arg, 40, "-syslog=%d", DoSyslogFacility);
+ 	} else {
+ 	    strcpy(arg, "-syslog");
+ 	}
+ 	argv[i] = arg;
+ 	i++;
+     }
+ #endif
+ 
      /* null-terminate argument list */
      argv[i] = NULL;
  
***************
*** 714,719 ****
--- 733,748 ----
  	    /* set extra logging flag */
  	    DoLogging = 1;
  	}
+ #ifndef AFS_NT40_ENV
+ 	else if (strcmp(argv[code], "-syslog")==0) {
+ 	    /* set syslog logging flag */
+ 	    DoSyslog = 1;
+ 	} 
+ 	else if (strncmp(argv[code], "-syslog=",8)==0) {
+ 	    DoSyslog = 1;
+ 	    DoSyslogFacility = atoi(argv[code]+8);
+ 	}
+ #endif
  	else if (strcmp(argv[code], "-enable_peer_stats")==0) {
  	    rx_enablePeerRPCStats();
  	}
***************
*** 730,735 ****
--- 759,767 ----
  	    /* hack to support help flag */
  
  	    printf("Usage: bosserver [-noauth] [-log] "
+ #ifndef AFS_NT40_ENV
+ 		   "[-syslog[=FACILITY]] "
+ #endif
  		   /* "[-enable_peer_stats] [-enable_process_stats] " */
  		   "[-help]\n");
  	    fflush(stdout);
***************
*** 772,792 ****
      background();
  #endif /* ! AFS_NT40_ENV */
  
!     /* switch to logging information to the BosLog file */
!     strcpy(namebuf, AFSDIR_BOZLOG_FILE);
!     strcat(namebuf, ".old");
!     renamefile(AFSDIR_BOZLOG_FILE, namebuf);	/* try rename first */
!     bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
!     if (!bozo_logFile) {
! 	printf("bosserver: can't initialize log file (%s).\n",
! 	       AFSDIR_SERVER_BOZLOG_FILEPATH);
! 	exit(1);
      }
  
-     /* keep log closed normally, so can be removed */
- 
-     fclose(bozo_logFile);
- 
      /* Write current state of directory permissions to log file */
      DirAccessOK ();
  
--- 804,827 ----
      background();
  #endif /* ! AFS_NT40_ENV */
  
!     if (!DoSyslog) {
! 	strcpy(namebuf, AFSDIR_BOZLOG_FILE);
! 	strcat(namebuf, ".old");
! 	renamefile(AFSDIR_BOZLOG_FILE, namebuf);    /* try rename first */
! 	bozo_logFile = fopen(AFSDIR_BOZLOG_FILE, "a");
! 	if (!bozo_logFile) {
! 	    printf("bosserver: can't initialize log file (%s).\n",
! 		   AFSDIR_SERVER_BOZLOG_FILEPATH);
! 	    exit(1);
! 	}
!         /* keep log closed normally, so can be removed */
!         fclose(bozo_logFile);
!     } else {
! #ifndef AFS_NT40_ENV
! 	openlog("bosserver", LOG_PID, DoSyslogFacility);
! #endif
      }
  
      /* Write current state of directory permissions to log file */
      DirAccessOK ();
  
***************
*** 880,910 ****
  char *a, *b, *c, *d, *e, *f; {
      char tdate[26];
      time_t myTime;
- 
-     myTime = time(0);
-     strcpy(tdate, ctime(&myTime));	/* copy out of static area asap */
-     tdate[24] = ':';
  
!     /* log normally closed, so can be removed */
! 
!     bozo_logFile=fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
!     if(bozo_logFile == NULL)
!     {
! 	printf("bosserver: WARNING: problem with %s", AFSDIR_SERVER_BOZLOG_FILEPATH);
! 	fflush(stdout);
!     }
  
!     if (bozo_logFile) {
! 	fprintf(bozo_logFile, "%s ", tdate);
! 	fprintf(bozo_logFile, a, b, c, d, e, f);
! 	fflush(bozo_logFile);
!     }
!     else {
! 	printf("%s ", tdate);
! 	printf(a, b, c, d, e, f);
      }
- 
-     /* close so rm BosLog works */
- 
-     fclose(bozo_logFile);
  }
--- 915,948 ----
  char *a, *b, *c, *d, *e, *f; {
      char tdate[26];
      time_t myTime;
  
!     if (DoSyslog) {
! #ifndef AFS_NT40_ENV
! 	syslog(LOG_INFO, a, b, c, d, e, f);
! #endif
!     } else {
! 	myTime = time(0);
! 	strcpy(tdate, ctime(&myTime));	/* copy out of static area asap */
! 	tdate[24] = ':';
! 
! 	/* log normally closed, so can be removed */
! 
! 	bozo_logFile=fopen(AFSDIR_SERVER_BOZLOG_FILEPATH, "a");
! 	if(bozo_logFile == NULL) {
! 	    printf("bosserver: WARNING: problem with %s", AFSDIR_SERVER_BOZLOG_FILEPATH);
! 	    fflush(stdout);
! 	}
  
! 	if (bozo_logFile) {
! 	    fprintf(bozo_logFile, "%s ", tdate);
! 	    fprintf(bozo_logFile, a, b, c, d, e, f);
! 	    fflush(bozo_logFile);
! 	} else {
! 	    printf("%s ", tdate);
! 	    printf(a, b, c, d, e, f);
! 	}
! 	
! 	/* close so rm BosLog works */
! 	fclose(bozo_logFile);
      }
  }
Index: openafs/src/bu_utils/Makefile
diff -c openafs/src/bu_utils/Makefile:1.2 openafs/src/bu_utils/Makefile:1.2.2.1
*** openafs/src/bu_utils/Makefile:1.2	Sat Nov  4 05:04:01 2000
--- openafs/src/bu_utils/Makefile	Mon Apr 23 00:04:27 2001
***************
*** 9,15 ****
  COMPONENT=bu_utils
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET = ${DESTDIR}/bin/compile_et
  CFLAGS= -g -w -I${SRCDIR}include -I${SRCDIR}include/afs ${XCFLAGS}
  LDFLAGS = ${XLDFLAGS}
--- 9,14 ----
Index: openafs/src/bubasics/Makefile
diff -c openafs/src/bubasics/Makefile:1.2 openafs/src/bubasics/Makefile:1.2.2.1
*** openafs/src/bubasics/Makefile:1.2	Sat Nov  4 05:04:02 2000
--- openafs/src/bubasics/Makefile	Mon Apr 23 00:04:31 2001
***************
*** 9,15 ****
  COMPONENT=bubasics
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  RXGEN=${SRCDIR}bin/rxgen
  COMPILE_ET = ${SRCDIR}bin/compile_et
  
--- 9,14 ----
Index: openafs/src/bucoord/Makefile
diff -c openafs/src/bucoord/Makefile:1.2 openafs/src/bucoord/Makefile:1.2.2.1
*** openafs/src/bucoord/Makefile:1.2	Sat Nov  4 05:04:03 2000
--- openafs/src/bucoord/Makefile	Mon Apr 23 00:04:35 2001
***************
*** 9,15 ****
  COMPONENT=bucoord
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET = ${SRCDIR}bin/compile_et
  
  CFLAGS= ${DBUG} -w -I${SRCDIR}include -I${SRCDIR}include/afs ${XCFLAGS}
--- 9,14 ----
Index: openafs/src/bucoord/ubik_db_if.c
diff -c openafs/src/bucoord/ubik_db_if.c:1.2 openafs/src/bucoord/ubik_db_if.c:1.2.2.1
*** openafs/src/bucoord/ubik_db_if.c:1.2	Sat Nov  4 05:04:07 2000
--- openafs/src/bucoord/ubik_db_if.c	Sun Apr 22 23:50:58 2001
***************
*** 1395,1401 ****
--- 1395,1405 ----
      fclose(ctPtr->textStream);
    
    sprintf(tmpFileName, "%s/bu_XXXXXX", gettmpdir());
+ #ifdef AFS_LINUX20_ENV
+   mkstemp(tmpFileName);
+ #else
    mktemp(tmpFileName);
+ #endif
    ctPtr->textStream = fopen(tmpFileName, "w+");
    if ( ctPtr->textStream == NULL )
      ERROR(BUDB_INTERNALERROR);
Index: openafs/src/bucoord/vol_sets.c
diff -c openafs/src/bucoord/vol_sets.c:1.2.2.1 openafs/src/bucoord/vol_sets.c:1.2.2.2
*** openafs/src/bucoord/vol_sets.c:1.2.2.1	Tue Mar  6 17:17:44 2001
--- openafs/src/bucoord/vol_sets.c	Mon Apr 23 03:32:41 2001
***************
*** 188,193 ****
--- 188,199 ----
  
      vsname = as->parms[0].items->data;
  
+     code = bc_UpdateVolumeSet();
+     if (code) {
+        com_err(whoami, code, "; Can't retrieve volume sets");
+        return(code);
+     }
+ 
      /* lock schedules and check validity */
      ctPtr = &bc_globalConfig->configText[TB_VOLUMESET];
  
Index: openafs/src/budb/Makefile
diff -c openafs/src/budb/Makefile:1.2 openafs/src/budb/Makefile:1.2.2.1
*** openafs/src/budb/Makefile:1.2	Sat Nov  4 05:04:08 2000
--- openafs/src/budb/Makefile	Mon Apr 23 00:04:39 2001
***************
*** 12,18 ****
  COMPONENT=budb
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET = ${SRCDIR}bin/compile_et
  RXGEN=${SRCDIR}bin/rxgen
  
--- 12,17 ----
Index: openafs/src/budb/db_text.c
diff -c openafs/src/budb/db_text.c:1.2 openafs/src/budb/db_text.c:1.2.2.1
*** openafs/src/budb/db_text.c:1.2	Sat Nov  4 05:04:10 2000
--- openafs/src/budb/db_text.c	Sun Apr 22 23:51:01 2001
***************
*** 518,524 ****
--- 518,528 ----
  {
      int retval = -1;
  
+ #ifdef AFS_LINUX20_ENV
+     retval = open(mkstemp(st), O_RDWR|O_CREAT|O_EXCL, 0600);
+ #else
      retval = open(mktemp(st), O_RDWR|O_CREAT|O_EXCL, 0600);
+ #endif
  
  error_exit:
      return(retval);
Index: openafs/src/butc/Makefile
diff -c openafs/src/butc/Makefile:1.2 openafs/src/butc/Makefile:1.2.2.1
*** openafs/src/butc/Makefile:1.2	Sat Nov  4 05:04:12 2000
--- openafs/src/butc/Makefile	Mon Apr 23 00:04:43 2001
***************
*** 9,16 ****
  COMPONENT=butc
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
- 
  CFLAGS=-g -w ${INCDIRS} ${XCFLAGS}
  
  INCDIRS= -I${SRCDIR}include/afs -I${SRCDIR}include/rx -I${SRCDIR}include
--- 9,14 ----
Index: openafs/src/butc/dump.c
diff -c openafs/src/butc/dump.c:1.2 openafs/src/butc/dump.c:1.2.2.1
*** openafs/src/butc/dump.c:1.2	Sat Nov  4 05:04:13 2000
--- openafs/src/butc/dump.c	Mon Apr 23 00:04:43 2001
***************
*** 97,103 ****
     else \
       sprintf(dumpname, "%s (DumpId %u)", name, dbDumpId);
  
! #ifdef AFS_NT40_ENV
  localtime_r(t, tm)
     time_t *t;
     struct tm *tm;
--- 97,103 ----
     else \
       sprintf(dumpname, "%s (DumpId %u)", name, dbDumpId);
  
! #if defined(AFS_NT40_ENV) || defined(AFS_DARWIN_ENV)
  localtime_r(t, tm)
     time_t *t;
     struct tm *tm;
Index: openafs/src/butc/tcudbprocs.c
diff -c openafs/src/butc/tcudbprocs.c:1.2 openafs/src/butc/tcudbprocs.c:1.2.2.1
*** openafs/src/butc/tcudbprocs.c:1.2	Sat Nov  4 05:04:15 2000
--- openafs/src/butc/tcudbprocs.c	Sun Apr 22 23:51:05 2001
***************
*** 1386,1392 ****
--- 1386,1396 ----
  
      /* open the text file */
      sprintf(filename, "%s/bu_XXXXXX", gettmpdir());
+ #ifdef AFS_LINUX20_ENV
+     fid = open(mkstemp(filename), O_RDWR|O_CREAT|O_EXCL, 0600);
+ #else
      fid = open(mktemp(filename), O_RDWR|O_CREAT|O_EXCL, 0600);
+ #endif
      if (fid < 0) 
      {
          ErrorLog(0, rstTapeInfoPtr->taskId, errno, 0, 
Index: openafs/src/butm/Makefile
diff -c openafs/src/butm/Makefile:1.2 openafs/src/butm/Makefile:1.2.2.1
*** openafs/src/butm/Makefile:1.2	Sat Nov  4 05:04:16 2000
--- openafs/src/butm/Makefile	Mon Apr 23 00:04:46 2001
***************
*** 10,16 ****
  SHELL = /bin/sh
  SRCDIR=DEST/
  DESTDIR=DEST/
- INSTALL=${SRCDIR}bin/install
  
  CFLAGS = -g -w -I${SRCDIR}include ${XCFLAGS}
  LDFLAGS = -g ${XLDFLAGS}
--- 10,15 ----
Index: openafs/src/cmd/Makefile
diff -c openafs/src/cmd/Makefile:1.2 openafs/src/cmd/Makefile:1.2.2.1
*** openafs/src/cmd/Makefile:1.2	Sat Nov  4 05:04:17 2000
--- openafs/src/cmd/Makefile	Mon Apr 23 00:04:49 2001
***************
*** 11,17 ****
  COMPONENT=cmd
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET = ${SRCDIR}bin/compile_et
  
  INCLS=cmd.h ${XINCLS}
--- 11,16 ----
Index: openafs/src/cmd/cmd.c
diff -c openafs/src/cmd/cmd.c:1.2.2.1 openafs/src/cmd/cmd.c:1.2.2.2
*** openafs/src/cmd/cmd.c:1.2.2.1	Tue Mar  6 16:51:14 2001
--- openafs/src/cmd/cmd.c	Mon Apr 23 03:37:20 2001
***************
*** 223,229 ****
      }
  }
  
! static AproposProc(as, arock)
  char *arock;
  register struct cmd_syndesc *as; {
      register struct cmd_syndesc *ts;
--- 223,229 ----
      }
  }
  
! static int AproposProc(as, arock)
  char *arock;
  register struct cmd_syndesc *as; {
      register struct cmd_syndesc *ts;
***************
*** 249,255 ****
      return 0;
  }
  
! static HelpProc(as, arock)
  char *arock;
  register struct cmd_syndesc *as; {
      register struct cmd_syndesc *ts;
--- 249,255 ----
      return 0;
  }
  
! static int HelpProc(as, arock)
  char *arock;
  register struct cmd_syndesc *as; {
      register struct cmd_syndesc *ts;
***************
*** 294,300 ****
      return(code);
  }
  
! cmd_SetBeforeProc(aproc, arock)
  int (*aproc)();
  char *arock; {
      beforeProc = aproc;
--- 294,300 ----
      return(code);
  }
  
! int cmd_SetBeforeProc(aproc, arock)
  int (*aproc)();
  char *arock; {
      beforeProc = aproc;
***************
*** 302,308 ****
      return 0;
  }
  
! cmd_SetAfterProc(aproc, arock)
  int (*aproc)();
  char *arock; {
      afterProc = aproc;
--- 302,308 ----
      return 0;
  }
  
! int cmd_SetAfterProc(aproc, arock)
  int (*aproc)();
  char *arock; {
      afterProc = aproc;
***************
*** 311,317 ****
  }
  
  /* thread on list in alphabetical order */
! static SortSyntax(as)
  struct cmd_syndesc *as; {
      register struct cmd_syndesc **ld, *ud;
  
--- 311,317 ----
  }
  
  /* thread on list in alphabetical order */
! static int SortSyntax(as)
  struct cmd_syndesc *as; {
      register struct cmd_syndesc **ld, *ud;
  
***************
*** 440,446 ****
  }
  
  /* add a text item to the end of the parameter list */
! static AddItem(aparm, aval)
  register struct cmd_parmdesc *aparm;
  register char *aval; {
      register struct cmd_item *ti, *ni;
--- 440,446 ----
  }
  
  /* add a text item to the end of the parameter list */
! static int AddItem(aparm, aval)
  register struct cmd_parmdesc *aparm;
  register char *aval; {
      register struct cmd_item *ti, *ni;
***************
*** 450,456 ****
      assert(ti->data);
      strcpy(ti->data, aval);
      /* now put ti at the *end* of the list */
!     if (ni=aparm->items) {
  	for(;ni;ni=ni->next) if	(ni->next == 0)	break;	/* skip to last one */
  	ni->next = ti;
      }
--- 450,456 ----
      assert(ti->data);
      strcpy(ti->data, aval);
      /* now put ti at the *end* of the list */
!     if ((ni=aparm->items)) {
  	for(;ni;ni=ni->next) if	(ni->next == 0)	break;	/* skip to last one */
  	ni->next = ti;
      }
***************
*** 459,465 ****
  }
  
  /* skip to next non-flag item, if any */
! static AdvanceType(as, aval)
  register afs_int32 aval;
  register struct cmd_syndesc *as; {
      register afs_int32 next;
--- 459,465 ----
  }
  
  /* skip to next non-flag item, if any */
! static int AdvanceType(as, aval)
  register afs_int32 aval;
  register struct cmd_syndesc *as; {
      register afs_int32 next;
***************
*** 504,510 ****
  }
  
  /* move the expands flag to the last one in the list */
! static SetupExpandsFlag(as)
  register struct cmd_syndesc *as; {
      register struct cmd_parmdesc *tp;
      register int last, i;
--- 504,510 ----
  }
  
  /* move the expands flag to the last one in the list */
! static int SetupExpandsFlag(as)
  register struct cmd_syndesc *as; {
      register struct cmd_parmdesc *tp;
      register int last, i;
***************
*** 563,569 ****
  
  } /*InsertInitOpcode*/
  
! static NoParmsOK(as)
  register struct cmd_syndesc *as; {
      register int i;
      register struct cmd_parmdesc *td;
--- 563,569 ----
  
  } /*InsertInitOpcode*/
  
! static int NoParmsOK(as)
  register struct cmd_syndesc *as; {
      register int i;
      register struct cmd_parmdesc *td;
***************
*** 580,586 ****
  }
  
  /* Call the appropriate function, or return syntax error code.  Note: if no opcode is specified, an initialization routine exists, and it has NOT been called before, we invoke the special initialization opcode*/
! cmd_Dispatch(argc, argv)
  int argc;
  char **argv;
   {
--- 580,586 ----
  }
  
  /* Call the appropriate function, or return syntax error code.  Note: if no opcode is specified, an initialization routine exists, and it has NOT been called before, we invoke the special initialization opcode*/
! int cmd_Dispatch(argc, argv)
  int argc;
  char **argv;
   {
***************
*** 831,837 ****
  }
  
  /* free token list returned by parseLine */
! static FreeTokens(alist)
      register struct cmd_token *alist; {
      register struct cmd_token *nlist;
      for(; alist; alist = nlist) {
--- 831,837 ----
  }
  
  /* free token list returned by parseLine */
! static int FreeTokens(alist)
      register struct cmd_token *alist; {
      register struct cmd_token *nlist;
      for(; alist; alist = nlist) {
***************
*** 843,849 ****
  }
  
  /* free an argv list returned by parseline */
! cmd_FreeArgv(argv)
  register char **argv; {
      register char *tp;
      for(tp = *argv; tp; argv++, tp = *argv)
--- 843,849 ----
  }
  
  /* free an argv list returned by parseline */
! int cmd_FreeArgv(argv)
  register char **argv; {
      register char *tp;
      for(tp = *argv; tp; argv++, tp = *argv)
***************
*** 855,861 ****
      data is still malloc'd, and will be freed when the caller calls cmd_FreeArgv
      later on */
  #define INITSTR ""
! static CopyBackArgs(alist, argv, an, amaxn)
  register struct cmd_token *alist;
  register char **argv;
  afs_int32 amaxn;
--- 855,861 ----
      data is still malloc'd, and will be freed when the caller calls cmd_FreeArgv
      later on */
  #define INITSTR ""
! static int CopyBackArgs(alist, argv, an, amaxn)
  register struct cmd_token *alist;
  register char **argv;
  afs_int32 amaxn;
***************
*** 887,911 ****
      return 0;
  }
  
! static quote(x)
  register int x; {
      if (x == '"' || x == 39 /* single quote */) return 1;
      else return 0;
  }
  
! static space(x)
  register int x; {
      if (x == 0 || x == ' ' || x == '\t' || x== '\n') return 1;
      else return 0;
  }
  
! cmd_ParseLine(aline, argv, an, amaxn)
  char **argv;
  afs_int32 *an;
  afs_int32 amaxn;
  char *aline; {
      char tbuffer[256];
!     register char *tptr;
      int inToken, inQuote;
      struct cmd_token *first, *last;
      register struct cmd_token *ttok;
--- 887,911 ----
      return 0;
  }
  
! static int quote(x)
  register int x; {
      if (x == '"' || x == 39 /* single quote */) return 1;
      else return 0;
  }
  
! static int space(x)
  register int x; {
      if (x == 0 || x == ' ' || x == '\t' || x== '\n') return 1;
      else return 0;
  }
  
! int cmd_ParseLine(aline, argv, an, amaxn)
  char **argv;
  afs_int32 *an;
  afs_int32 amaxn;
  char *aline; {
      char tbuffer[256];
!     register char *tptr = 0;
      int inToken, inQuote;
      struct cmd_token *first, *last;
      register struct cmd_token *ttok;
***************
*** 920,926 ****
  	if (tc == 0 || (!inQuote && space(tc))) {    /* terminating null gets us in here, too */
  	    if (inToken) {
  		inToken	= 0;	/* end of this token */
! 		*tptr++ = 0;
  		ttok = (struct cmd_token *) malloc(sizeof(struct cmd_token));
  		assert(ttok);
  		ttok->next = (struct cmd_token *) 0;
--- 920,929 ----
  	if (tc == 0 || (!inQuote && space(tc))) {    /* terminating null gets us in here, too */
  	    if (inToken) {
  		inToken	= 0;	/* end of this token */
! 		if ( !tptr )
! 		    return -1; /* should never get here */
! 		else
! 		    *tptr++ = 0;
  		ttok = (struct cmd_token *) malloc(sizeof(struct cmd_token));
  		assert(ttok);
  		ttok->next = (struct cmd_token *) 0;
Index: openafs/src/cmd/cmd.p.h
diff -c openafs/src/cmd/cmd.p.h:1.2.2.1 openafs/src/cmd/cmd.p.h:1.2.2.2
*** openafs/src/cmd/cmd.p.h:1.2.2.1	Tue Mar  6 16:51:15 2001
--- openafs/src/cmd/cmd.p.h	Mon Apr 23 03:37:21 2001
***************
*** 66,77 ****
    char *helpp
  );
  
! extern cmd_SetBeforeProc(
    int (*aproc)(),
    char *arock
  );
  
! extern cmd_SetAfterProc(
    int (*aproc)(),
    char *arock
  );
--- 66,77 ----
    char *helpp
  );
  
! extern int cmd_SetBeforeProc(
    int (*aproc)(),
    char *arock
  );
  
! extern int cmd_SetAfterProc(
    int (*aproc)(),
    char *arock
  );
***************
*** 94,109 ****
    char *ahelp
  );
  
! extern cmd_Dispatch(
    int argc,
    char **argv
  );
  
! extern cmd_FreeArgv(
    char **argv
  );
  
! extern cmd_ParseLine(
    char *aline,
    char **argv,
    afs_int32 *an,
--- 94,109 ----
    char *ahelp
  );
  
! extern int cmd_Dispatch(
    int argc,
    char **argv
  );
  
! extern int cmd_FreeArgv(
    char **argv
  );
  
! extern int cmd_ParseLine(
    char *aline,
    char **argv,
    afs_int32 *an,
Index: openafs/src/comerr/Makefile
diff -c openafs/src/comerr/Makefile:1.2 openafs/src/comerr/Makefile:1.2.2.1
*** openafs/src/comerr/Makefile:1.2	Sun Nov  5 15:01:51 2000
--- openafs/src/comerr/Makefile	Mon Apr 23 00:04:52 2001
***************
*** 17,23 ****
  LIBOBJS= error_msg.o et_name.o com_err.o
  
  UKERNELDIR=../libuafs/
- INSTALL=${SRCDIR}bin/install
  
  CFLAGS= ${OPTMZ} -I${DESTDIR}include ${XCFLAGS}
  FILES=	Makefile et_name.c error_msg.c compile_et.c \
--- 17,22 ----
Index: openafs/src/config/Makefile
diff -c openafs/src/config/Makefile:1.3 openafs/src/config/Makefile:1.3.2.1
*** openafs/src/config/Makefile:1.3	Tue Nov  7 10:51:03 2000
--- openafs/src/config/Makefile	Mon Apr 23 02:25:56 2001
***************
*** 68,74 ****
  ${KERNELDIR}/afs/afs_sysnames.h ${DESTDIR}include/afs/afs_sysnames.h :: afs_sysnames.h
  	$(RM) -f $@; $(CP) $? $@
  
! DESTINCLS = ${DESTDIR}include/afs/afs_args.h ${DESTDIR}include/afs/venus.h ${DESTDIR}include/afs/debug.h ${DESTDIR}include/afs/afs_sysnames.h  ${DESTDIR}include/afs/param.h  ${DESTDIR}include/afs/stds.h  ${DESTDIR}include/afs/icl.h ../permit_xprt.h
  
  ${KERNELDIR}/afs/stds.h ${DESTDIR}include/afs/stds.h :: stds.h
  	$(RM) -f $@; $(CP) $? $@
--- 68,74 ----
  ${KERNELDIR}/afs/afs_sysnames.h ${DESTDIR}include/afs/afs_sysnames.h :: afs_sysnames.h
  	$(RM) -f $@; $(CP) $? $@
  
! DESTINCLS = ${DESTDIR}include/afs/afs_args.h ${DESTDIR}include/afs/venus.h ${DESTDIR}include/afs/debug.h ${DESTDIR}include/afs/afs_sysnames.h  ${DESTDIR}include/afs/param.h  ${DESTDIR}include/afs/stds.h  ${DESTDIR}include/afs/icl.h 
  
  ${KERNELDIR}/afs/stds.h ${DESTDIR}include/afs/stds.h :: stds.h
  	$(RM) -f $@; $(CP) $? $@
***************
*** 88,111 ****
  ${DESTDIR}include/afs/debug.h :: debug.h 
  	$(RM) -f $@; $(CP) $? $@
  
- ${KERNELDIR}/afs/permit_xprt.h ../permit_xprt.h:
- 	$(RM) -f ${KERNELDIR}/afs/permit_xprt.h ../permit_xprt.h
- 	if [ -f SRC/../xprt/permit_xprt.h ] ; then \
- 	   echo "XPRT" ; \
- 	   perm_src=`pwd`/../xprt ; \
- 	   echo "perm_src='$$perm_src'" ; \
- 	   set -x ; \
- 	   $(CP) $$perm_src/permit_export.h ${KERNELDIR}/afs/permit_xprt.h ; \
- 	   ln -s $$perm_src/permit_xprt.h   ../permit_xprt.h ; \
- 	else \
- 	   echo "CONFIG" ; \
- 	   perm_src=`pwd` ; \
- 	   echo "perm_src='$$perm_src'" ; \
- 	   set -x ; \
- 	   $(CP) $$perm_src/permit_xprt.h   ${KERNELDIR}/afs/permit_xprt.h ; \
- 	   ln -s $$perm_src/permit_xprt.h   ../permit_xprt.h ; \
- 	fi		     
- 
  $(UKDIRS): 
  	set $@; $(MKDIR_IF_NEEDED)
  
--- 88,93 ----
***************
*** 133,151 ****
  ${UKERNELDIR}/afs/afs_args.h :: afs_args.h 
  	$(RM) -f $@; $(CP) $? $@
  
- ${UKERNELDIR}/afs/permit_xprt.h:
- 	$(RM) -f ${UKERNELDIR}/afs/permit_xprt.h
- 	if [ -f SRC/../xprt/permit_xprt.h ] ; then \
- 	   echo "XPRT" ; \
- 	   perm_src=`pwd`/../xprt ; \
- 	else \
- 	   echo "CONFIG" ; \
- 	   perm_src=`pwd`/../config ; \
- 	fi; \
- 	echo "perm_src='$$perm_src'" ; \
- 	set -x ; \
- 	ln -s $$perm_src/permit_xprt.h   ${UKERNELDIR}/afs/permit_xprt.h
- 
  # lkversion is the target the Linux build uses to verify the build machine
  # has headers in the right place for the requested kernel builds.
  #
--- 115,120 ----
***************
*** 161,168 ****
  	esac
  
  install.noversion: $(KDIRS) noversionMakef all $(DESTINCLS) venus.h
- 	$(RM) -f ${DESTDIR}/include/afs/permit_xprt.h
- 	$(CP) permit_xprt.h ${DESTDIR}/include/afs/
  
  system: install
  install: version install.noversion kinstall ukinstall
--- 130,135 ----
***************
*** 174,187 ****
  
  kinstall: lkversion config $(KDIRS) ${KERNELDIR}/afs/param.h \
  	${KERNELDIR}/afs/stds.h \
! 	${KERNELDIR}/afs/permit_xprt.h ${KERNELDIR}/afs/afs_sysnames.h \
  	${KERNELDIR}/config/Makefile.${SYS_NAME} \
  	${KERNELDIR}/afs/afs_args.h \
  	${KERNELDIR}/afs/icl.h \
  	${KERNELDIR}/afs/AFS_component_version_number.c
  
  ukinstall webinstall: $(DESTINCLS) config $(UKDIRS) ${UKERNELDIR}/afs/param.h ${UKERNELDIR}/afs/stds.h \
! 	${UKERNELDIR}/afs/permit_xprt.h ${UKERNELDIR}/afs/afs_sysnames.h \
  	${UKERNELDIR}/config/Makefile.${SYS_NAME} \
  	${UKERNELDIR}/afs/afs_args.h \
  	${UKERNELDIR}/afs/icl.h \
--- 141,154 ----
  
  kinstall: lkversion config $(KDIRS) ${KERNELDIR}/afs/param.h \
  	${KERNELDIR}/afs/stds.h \
! 	${KERNELDIR}/afs/afs_sysnames.h \
  	${KERNELDIR}/config/Makefile.${SYS_NAME} \
  	${KERNELDIR}/afs/afs_args.h \
  	${KERNELDIR}/afs/icl.h \
  	${KERNELDIR}/afs/AFS_component_version_number.c
  
  ukinstall webinstall: $(DESTINCLS) config $(UKDIRS) ${UKERNELDIR}/afs/param.h ${UKERNELDIR}/afs/stds.h \
! 	${UKERNELDIR}/afs/afs_sysnames.h \
  	${UKERNELDIR}/config/Makefile.${SYS_NAME} \
  	${UKERNELDIR}/afs/afs_args.h \
  	${UKERNELDIR}/afs/icl.h \
Index: openafs/src/config/Makefile.alpha_dux40
diff -c openafs/src/config/Makefile.alpha_dux40:1.2 openafs/src/config/Makefile.alpha_dux40:1.2.2.1
*** openafs/src/config/Makefile.alpha_dux40:1.2	Sat Nov  4 05:04:19 2000
--- openafs/src/config/Makefile.alpha_dux40	Mon Apr 23 00:04:55 2001
***************
*** 21,28 ****
  DBG=-g3
  CSTATIC=-non_shared
  RANLIB=/bin/true
! WASHTOOL=${SRCDIR}bin/washtool
! INSTALL=${SRCDIR}bin/install
  
  #this is for the vol package
  FS_CONV_OSF40D= $(DESTDIR)root.server/usr/afs/bin/fs_conv_dux40D
--- 21,28 ----
  DBG=-g3
  CSTATIC=-non_shared
  RANLIB=/bin/true
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  
  #this is for the vol package
  FS_CONV_OSF40D= $(DESTDIR)root.server/usr/afs/bin/fs_conv_dux40D
Index: openafs/src/config/Makefile.alpha_dux50
diff -c openafs/src/config/Makefile.alpha_dux50:1.1.2.1 openafs/src/config/Makefile.alpha_dux50:1.1.2.2
*** openafs/src/config/Makefile.alpha_dux50:1.1.2.1	Tue Mar  6 16:23:57 2001
--- openafs/src/config/Makefile.alpha_dux50	Mon Apr 23 00:04:55 2001
***************
*** 22,29 ****
  CP=cp
  CSTATIC=-non_shared
  RANLIB=/bin/true
! WASHTOOL=${SRCDIR}bin/washtool
! INSTALL=${SRCDIR}bin/install
  
  #this is for the vol package
  FS_CONV_OSF40D= $(DESTDIR)root.server/usr/afs/bin/fs_conv_dux40D
--- 22,29 ----
  CP=cp
  CSTATIC=-non_shared
  RANLIB=/bin/true
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  
  #this is for the vol package
  FS_CONV_OSF40D= $(DESTDIR)root.server/usr/afs/bin/fs_conv_dux40D
Index: openafs/src/config/Makefile.alpha_linux_2216_22
diff -c /dev/null openafs/src/config/Makefile.alpha_linux_2216_22:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/Makefile.alpha_linux_2216_22	Sun Apr 22 23:51:08 2001
***************
*** 0 ****
--- 1,48 ----
+ # Makefile for Linux 2.2.16 kernel on Alpha with glibc 2.2
+ # Keep macros within each section in sorted order for clean diff displays.
+ #
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = LINUX
+ # Base directory for linux kernel source. Actually a prefix which is complete
+ # when LINUX_VERS is appended to it.
+ LINUX_SRCDIR = /usr/src/linux-
+ # Default list of Linux kernels to build. Build will run only if all
+ # can be built. To build a different set, specify LINUX_VERS to make.
+ LINUX_VERS = 2.2.16
+ 
+ #
+ # compilation and link editor flags
+ DBG=-g
+ OPTMZ=-O2
+ PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
+ # Put -O2 here to _ensure_ all Makefiles pick it up.
+ XCFLAGS= -O2
+ MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
+ XLDFLAGS=
+ SHARE_LDFLAGS = -shared -Xlinker -x
+ SHLIB_SUFFIX=so
+ SHLIB_CFLAGS=
+ #
+ # libraries
+ MTLIBS=-lpthread
+ TXLIBS= /usr/lib/libncurses.so
+ XLIBS=
+ #
+ # programs
+ AR=ar
+ AS=as
+ CP=cp
+ INSTALL=${SRCDIR}bin/install
+ LD=ld   
+ MT_CC=cc
+ MV=mv
+ RANLIB=ranlib
+ RM=rm
+ WASHTOOL=${SRCDIR}bin/washtool
+ #
+ # Other OS specific requirements
+ #
+ YACC = bison -y
+ LEX = flex -l
+ # Used in des library.
+ CRYPT_OBJ = crypt.o
Index: openafs/src/config/Makefile.hp_ux102
diff -c /dev/null openafs/src/config/Makefile.hp_ux102:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/Makefile.hp_ux102	Mon Apr 23 02:55:06 2001
***************
*** 0 ****
--- 1,37 ----
+ # 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 = HPUX
+ CC=/opt/ansic/bin/cc -Ae
+ MT_CC=/opt/ansic/bin/cc -Ae
+ XCFLAGS0=-ldld -lc -Wp,-H200000 -Wl,-a,archive -DAUTH_DBM_LOG +z -Wl,+k -D_LARGEFILE64_SOURCE
+ XCFLAGS=${XCFLAGS0} +DA1.0
+ XCFLAGS64=${XCFLAGS0} +DA2.0W
+ MT_CFLAGS=-D_POSIX_C_SOURCE=199506L -DAFS_PTHREAD_ENV ${XCFLAGS}
+ XLIBS=
+ XLIBELFA=
+ TXLIBS=/usr/lib/libHcurses.a
+ MTLIBS=-L/opt/dce/lib -ldce
+ SHLIB_SUFFIX=sl
+ LWP_OPTMZ=-O
+ OPTMZ=-O
+ DBG=-g
+ RANLIB=ranlib
+ WASHTOOL=${DESTDIR}bin/washtool
+ INSTALL=${DESTDIR}bin/install
+ RM=/bin/rm
+ CP=/bin/cp
+ AR=/bin/ar
+ AS=/usr/ccs/bin/as
+ MV=/bin/mv
+ LD=/bin/ld   
+ LEX=/opt/langtools/bin/lex
+ DBM=/lib/libndbm.a
+ PAM_CFLAGS=+DA1.0 +z -Wl,+k
+ SHARE_LDFLAGS=-b -Bsymbolic
+ PAMLIBS=/usr/lib/libpam.1
+ YACC=/opt/langtools/bin/yacc
Index: openafs/src/config/Makefile.hp_ux110
diff -c openafs/src/config/Makefile.hp_ux110:1.2 openafs/src/config/Makefile.hp_ux110:1.2.2.1
*** openafs/src/config/Makefile.hp_ux110:1.2	Sat Nov  4 05:04:19 2000
--- openafs/src/config/Makefile.hp_ux110	Mon Apr 23 00:04:55 2001
***************
*** 21,28 ****
  OPTMZ=-O
  DBG=-g
  RANLIB=ranlib
! INSTALL=${SRCDIR}bin/install
! WASHTOOL=${SRCDIR}bin/washtool
  RM=/bin/rm
  CP=/bin/cp
  AR=/bin/ar
--- 21,28 ----
  OPTMZ=-O
  DBG=-g
  RANLIB=ranlib
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  RM=/bin/rm
  CP=/bin/cp
  AR=/bin/ar
Index: openafs/src/config/Makefile.i386_fbsd_42
diff -c /dev/null openafs/src/config/Makefile.i386_fbsd_42:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/Makefile.i386_fbsd_42	Mon Apr 23 03:29:10 2001
***************
*** 0 ****
--- 1,52 ----
+ # Copyright 1998 Transarc Corporation 
+ #
+ # Keep macros within each section in sorted order for clean diff displays.
+ #
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = FBSD
+ # Pointers to destination and source directories
+ DESTDIR=DEST/
+ SRCDIR=DEST/
+ # Base directory for linux kernel source. Actually a prefix which is complete
+ # when LINUX_VERS is appended to it.
+ # LINUX_SRCDIR = /usr/src/linux-
+ # Default list of Linux kernels to build. Build will run only if all
+ # can be built. To build a different set, specify LINUX_VERS to make.
+ # LINUX_VERS = 2.2.5-15 2.2.10 2.2.12 2.2.12-20 2.2.13 2.2.14
+ 
+ #
+ # compilation and link editor flags
+ DBG=-g
+ OPTMZ=-O2
+ PAM_CFLAGS = -O2 -pipe -fPIC
+ # Put -O2 here to _ensure_ all Makefiles pick it up.
+ XCFLAGS= -O2 -pipe
+ MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
+ XLDFLAGS=
+ SHARE_LDFLAGS = -shared -Xlinker -x
+ SHLIB_SUFFIX=so
+ SHLIB_CFLAGS=
+ #
+ # libraries
+ MTLIBS=-pthread
+ TXLIBS= /usr/lib/libncurses.so
+ XLIBS=-lcompat
+ #
+ # programs
+ AR=ar
+ AS=as
+ CP=cp
+ INSTALL=${SRCDIR}bin/install
+ LD=ld   
+ MT_CC=cc
+ MV=mv
+ RANLIB=ranlib
+ RM=rm
+ WASHTOOL=${SRCDIR}bin/washtool
+ #
+ # Other OS specific requirements
+ #
+ YACC = bison -y
+ LEX = flex -l
+ # Used in des library.
+ CRYPT_OBJ = crypt.o
Index: openafs/src/config/Makefile.i386_linux22
diff -c openafs/src/config/Makefile.i386_linux22:1.2 openafs/src/config/Makefile.i386_linux22:1.2.2.1
*** openafs/src/config/Makefile.i386_linux22:1.2	Sat Nov  4 05:04:19 2000
--- openafs/src/config/Makefile.i386_linux22	Mon Apr 23 00:04:55 2001
***************
*** 39,51 ****
  AR=ar
  AS=as
  CP=cp
- INSTALL=${SRCDIR}bin/install
  LD=ld   
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # Other OS specific requirements
  #
--- 39,51 ----
  AR=ar
  AS=as
  CP=cp
  LD=ld   
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # Other OS specific requirements
  #
Index: openafs/src/config/Makefile.i386_linux24
diff -c openafs/src/config/Makefile.i386_linux24:1.1 openafs/src/config/Makefile.i386_linux24:1.1.2.1
*** openafs/src/config/Makefile.i386_linux24:1.1	Sun Nov  5 15:13:38 2000
--- openafs/src/config/Makefile.i386_linux24	Mon Apr 23 00:04:56 2001
***************
*** 30,42 ****
  AR=ar
  AS=as
  CP=cp
- INSTALL=${SRCDIR}bin/install
  LD=ld
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # Other OS specific requirements
  #
--- 30,42 ----
  AR=ar
  AS=as
  CP=cp
  LD=ld
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # Other OS specific requirements
  #
Index: openafs/src/config/Makefile.ppc_darwin_12
diff -c /dev/null openafs/src/config/Makefile.ppc_darwin_12:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/Makefile.ppc_darwin_12	Mon Apr 23 02:07:08 2001
***************
*** 0 ****
--- 1,46 ----
+ # Keep macros within each section in sorted order for clean diff displays.
+ #
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = DARWIN
+ #
+ # Pointers to destination and source directories
+ DESTDIR=DEST/
+ DESTDIR=DEST/
+ #
+ # compilation and link editor flags
+ XCFLAGS=-traditional-cpp
+ #MT_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV ${XCFLAGS}
+ #MT_CC=cc
+ KROOT=
+ KINCLUDES=-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers
+ #SHARE_LDFLAGS =
+ LWP_OPTMZ=-g
+ OPTMZ=-g
+ DBG=-g
+ REGEX_OBJ=regex.o
+ 
+ 
+ #
+ # libraries
+ #XLIBS=
+ TXLIBS=
+ #MTLIBS=
+ #XLIBELFA=
+ #XLIBKVM=
+ #
+ SHLIB_SUFFIX=
+ SHLIB_CFLAGS=
+ #
+ # programs
+ AR=ar
+ AS=as
+ CC=cc
+ CP=cp
+ INSTALL=${DESTDIR}bin/pinstall
+ LEX=lex -l
+ LD= ld
+ LORDER = lorder
+ MV=mv
+ RANLIB=ranlib
+ RM=rm
+ STRIP= strip
Index: openafs/src/config/Makefile.ppc_darwin_13
diff -c /dev/null openafs/src/config/Makefile.ppc_darwin_13:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/Makefile.ppc_darwin_13	Mon Apr 23 02:07:08 2001
***************
*** 0 ****
--- 1,46 ----
+ # Keep macros within each section in sorted order for clean diff displays.
+ #
+ # AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+ AFS_OSTYPE = DARWIN
+ #
+ # Pointers to destination and source directories
+ DESTDIR=DEST/
+ DESTDIR=DEST/
+ #
+ # compilation and link editor flags
+ XCFLAGS=-traditional-cpp
+ #MT_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV ${XCFLAGS}
+ #MT_CC=cc
+ KROOT=
+ KINCLUDES=-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers
+ #SHARE_LDFLAGS =
+ LWP_OPTMZ=-g
+ OPTMZ=-g
+ DBG=-g
+ REGEX_OBJ=regex.o
+ 
+ 
+ #
+ # libraries
+ #XLIBS=
+ TXLIBS=
+ #MTLIBS=
+ #XLIBELFA=
+ #XLIBKVM=
+ #
+ SHLIB_SUFFIX=
+ SHLIB_CFLAGS=
+ #
+ # programs
+ AR=ar
+ AS=as
+ CC=cc
+ CP=cp
+ INSTALL=${DESTDIR}bin/pinstall
+ LEX=lex -l
+ LD= ld
+ LORDER = lorder
+ MV=mv
+ RANLIB=ranlib
+ RM=rm
+ STRIP= strip
Index: openafs/src/config/Makefile.ppc_linux24
diff -c openafs/src/config/Makefile.ppc_linux24:1.1 openafs/src/config/Makefile.ppc_linux24:1.1.2.1
*** openafs/src/config/Makefile.ppc_linux24:1.1	Sun Nov  5 15:13:38 2000
--- openafs/src/config/Makefile.ppc_linux24	Mon Apr 23 00:04:56 2001
***************
*** 30,42 ****
  AR=ar
  AS=as
  CP=cp
- INSTALL=${SRCDIR}bin/install
  LD=ld
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # Other OS specific requirements
  #
--- 30,42 ----
  AR=ar
  AS=as
  CP=cp
  LD=ld
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # Other OS specific requirements
  #
Index: openafs/src/config/Makefile.rs_aix42
diff -c openafs/src/config/Makefile.rs_aix42:1.2 openafs/src/config/Makefile.rs_aix42:1.2.2.1
*** openafs/src/config/Makefile.rs_aix42:1.2	Sat Nov  4 05:04:19 2000
--- openafs/src/config/Makefile.rs_aix42	Mon Apr 23 00:04:56 2001
***************
*** 29,41 ****
  AR=ar
  AS=as
  CP=cp
- INSTALL=${SRCDIR}bin/install
  LD=ld   
  LEX=lex
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # This is the XBSA make flag and pathname to XBSA header files (xbsa.h)
  XBSA_FLAGS=-Dxbsa
--- 29,41 ----
  AR=ar
  AS=as
  CP=cp
  LD=ld   
  LEX=lex
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # This is the XBSA make flag and pathname to XBSA header files (xbsa.h)
  XBSA_FLAGS=-Dxbsa
Index: openafs/src/config/Makefile.s390_linux22
diff -c openafs/src/config/Makefile.s390_linux22:1.1.2.2 openafs/src/config/Makefile.s390_linux22:1.1.2.3
*** openafs/src/config/Makefile.s390_linux22:1.1.2.2	Tue Mar  6 17:23:53 2001
--- openafs/src/config/Makefile.s390_linux22	Mon Apr 23 00:04:56 2001
***************
*** 35,47 ****
  AR=ar
  AS=as
  CP=cp
- INSTALL=${SRCDIR}bin/install
  LD=gcc
  MT_CC=gcc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # Other OS specific requirements
  #
--- 35,47 ----
  AR=ar
  AS=as
  CP=cp
  LD=gcc
  MT_CC=gcc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # Other OS specific requirements
  #
Index: openafs/src/config/Makefile.sgi_62
diff -c openafs/src/config/Makefile.sgi_62:1.2 openafs/src/config/Makefile.sgi_62:1.2.2.1
*** openafs/src/config/Makefile.sgi_62:1.2	Sat Nov  4 05:04:19 2000
--- openafs/src/config/Makefile.sgi_62	Mon Apr 23 00:04:56 2001
***************
*** 33,45 ****
  AS=as
  CP=cp
  MT_CC=cc
- INSTALL=${SRCDIR}bin/install
  LD=ld   
  LEX=lex
  MV=mv
  RANLIB=/bin/true
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # This is for the vol package
  XFS_SIZE_CHECK = $(DESTDIR)root.server/usr/afs/bin/xfs_size_check
--- 33,45 ----
  AS=as
  CP=cp
  MT_CC=cc
  LD=ld   
  LEX=lex
  MV=mv
  RANLIB=/bin/true
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # This is for the vol package
  XFS_SIZE_CHECK = $(DESTDIR)root.server/usr/afs/bin/xfs_size_check
Index: openafs/src/config/Makefile.sgi_63
diff -c openafs/src/config/Makefile.sgi_63:1.2 openafs/src/config/Makefile.sgi_63:1.2.2.1
*** openafs/src/config/Makefile.sgi_63:1.2	Sat Nov  4 05:04:19 2000
--- openafs/src/config/Makefile.sgi_63	Mon Apr 23 00:04:57 2001
***************
*** 33,42 ****
  AS=as
  CP=cp
  MT_CC=cc
- INSTALL=${SRCDIR}bin/install
  LD=ld   
  LEX=lex
  MV=mv
  RANLIB=/bin/true
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
--- 33,42 ----
  AS=as
  CP=cp
  MT_CC=cc
  LD=ld   
  LEX=lex
  MV=mv
  RANLIB=/bin/true
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
Index: openafs/src/config/Makefile.sgi_64
diff -c openafs/src/config/Makefile.sgi_64:1.2 openafs/src/config/Makefile.sgi_64:1.2.2.1
*** openafs/src/config/Makefile.sgi_64:1.2	Sat Nov  4 05:04:19 2000
--- openafs/src/config/Makefile.sgi_64	Mon Apr 23 00:04:57 2001
***************
*** 34,46 ****
  AS=as
  CP=cp
  MT_CC=cc
- INSTALL=${SRCDIR}bin/install
  LD=ld   
  LEX=lex
  MV=mv
  RANLIB=/bin/true
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # This is for the vol package
  XFS_SIZE_CHECK = $(DESTDIR)root.server/usr/afs/bin/xfs_size_check
--- 34,46 ----
  AS=as
  CP=cp
  MT_CC=cc
  LD=ld   
  LEX=lex
  MV=mv
  RANLIB=/bin/true
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # This is for the vol package
  XFS_SIZE_CHECK = $(DESTDIR)root.server/usr/afs/bin/xfs_size_check
Index: openafs/src/config/Makefile.sgi_65
diff -c openafs/src/config/Makefile.sgi_65:1.2.2.1 openafs/src/config/Makefile.sgi_65:1.2.2.2
*** openafs/src/config/Makefile.sgi_65:1.2.2.1	Fri Jan 19 04:08:40 2001
--- openafs/src/config/Makefile.sgi_65	Mon Apr 23 00:04:57 2001
***************
*** 34,46 ****
  AS=as
  CP=cp
  MT_CC=/usr/bin/cc
- INSTALL=${SRCDIR}bin/install
  LD=/usr/bin/ld   
  LEX=lex
  MV=mv
  RANLIB=/bin/true
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # This is for the vol package
  XFS_SIZE_CHECK = $(DESTDIR)root.server/usr/afs/bin/xfs_size_check
--- 34,46 ----
  AS=as
  CP=cp
  MT_CC=/usr/bin/cc
  LD=/usr/bin/ld   
  LEX=lex
  MV=mv
  RANLIB=/bin/true
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # This is for the vol package
  XFS_SIZE_CHECK = $(DESTDIR)root.server/usr/afs/bin/xfs_size_check
Index: openafs/src/config/Makefile.sparc64_linux22
diff -c openafs/src/config/Makefile.sparc64_linux22:1.1.2.1 openafs/src/config/Makefile.sparc64_linux22:1.1.2.2
*** openafs/src/config/Makefile.sparc64_linux22:1.1.2.1	Fri Jan 19 04:29:46 2001
--- openafs/src/config/Makefile.sparc64_linux22	Mon Apr 23 00:04:57 2001
***************
*** 34,46 ****
  AR=ar
  AS=as
  CP=cp
- INSTALL=${SRCDIR}bin/install
  LD=ld   
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # Other OS specific requirements
  #
--- 34,46 ----
  AR=ar
  AS=as
  CP=cp
  LD=ld   
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # Other OS specific requirements
  #
Index: openafs/src/config/Makefile.sparc_linux22
diff -c openafs/src/config/Makefile.sparc_linux22:1.1.2.1 openafs/src/config/Makefile.sparc_linux22:1.1.2.2
*** openafs/src/config/Makefile.sparc_linux22:1.1.2.1	Fri Jan 19 04:29:46 2001
--- openafs/src/config/Makefile.sparc_linux22	Mon Apr 23 00:04:58 2001
***************
*** 34,46 ****
  AR=ar
  AS=as
  CP=cp
- INSTALL=${SRCDIR}bin/install
  LD=ld   
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # Other OS specific requirements
  #
--- 34,46 ----
  AR=ar
  AS=as
  CP=cp
  LD=ld   
  MT_CC=cc
  MV=mv
  RANLIB=ranlib
  RM=rm
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # Other OS specific requirements
  #
Index: openafs/src/config/Makefile.sun4x_55
diff -c openafs/src/config/Makefile.sun4x_55:1.2 openafs/src/config/Makefile.sun4x_55:1.2.2.1
*** openafs/src/config/Makefile.sun4x_55:1.2	Sat Nov  4 05:04:20 2000
--- openafs/src/config/Makefile.sun4x_55	Mon Apr 23 00:04:58 2001
***************
*** 32,38 ****
  CC=/opt/SUNWspro/bin/cc
  MT_CC=/opt/SUNWspro/bin/cc
  CP=/bin/cp
- INSTALL=${SRCDIR}bin/install
  LEX=lex
  LD= /usr/ccs/bin/ld
  LORDER = /usr/ccs/bin/lorder
--- 32,37 ----
***************
*** 40,46 ****
  RANLIB=/bin/true
  RM=rm
  STRIP= /usr/ccs/bin/strip
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # this is for the vol package
  FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26
--- 39,46 ----
  RANLIB=/bin/true
  RM=rm
  STRIP= /usr/ccs/bin/strip
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # this is for the vol package
  FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26
Index: openafs/src/config/Makefile.sun4x_56
diff -c openafs/src/config/Makefile.sun4x_56:1.2.2.1 openafs/src/config/Makefile.sun4x_56:1.2.2.2
*** openafs/src/config/Makefile.sun4x_56:1.2.2.1	Fri Jan 19 05:05:06 2001
--- openafs/src/config/Makefile.sun4x_56	Mon Apr 23 00:04:58 2001
***************
*** 36,42 ****
  CC=/opt/SUNWspro/bin/cc
  MT_CC=/opt/SUNWspro/bin/cc
  CP=/bin/cp
- INSTALL=${SRCDIR}bin/install
  LEX=lex
  LD= /usr/ccs/bin/ld
  LORDER = /usr/ccs/bin/lorder
--- 36,41 ----
***************
*** 44,50 ****
  RANLIB=/bin/true
  RM=rm
  STRIP= /usr/ccs/bin/strip
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # this is for the vol package
  FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26
--- 43,50 ----
  RANLIB=/bin/true
  RM=rm
  STRIP= /usr/ccs/bin/strip
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # this is for the vol package
  FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26
Index: openafs/src/config/Makefile.sun4x_57
diff -c openafs/src/config/Makefile.sun4x_57:1.2 openafs/src/config/Makefile.sun4x_57:1.2.2.1
*** openafs/src/config/Makefile.sun4x_57:1.2	Sat Nov  4 05:04:20 2000
--- openafs/src/config/Makefile.sun4x_57	Mon Apr 23 00:04:58 2001
***************
*** 40,46 ****
  CC=/opt/SUNWspro/bin/cc
  MT_CC=/opt/SUNWspro/bin/cc
  CP=/bin/cp
- INSTALL=${SRCDIR}bin/install
  LEX=lex
  LD= /usr/ccs/bin/ld
  LORDER = /usr/ccs/bin/lorder
--- 40,45 ----
***************
*** 48,54 ****
  RANLIB=/bin/true
  RM=rm
  STRIP= /usr/ccs/bin/strip
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # this is for the vol package
  FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26
--- 47,54 ----
  RANLIB=/bin/true
  RM=rm
  STRIP= /usr/ccs/bin/strip
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # this is for the vol package
  FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26
Index: openafs/src/config/Makefile.sun4x_58
diff -c openafs/src/config/Makefile.sun4x_58:1.1.2.1 openafs/src/config/Makefile.sun4x_58:1.1.2.2
*** openafs/src/config/Makefile.sun4x_58:1.1.2.1	Fri Jan 19 04:01:48 2001
--- openafs/src/config/Makefile.sun4x_58	Mon Apr 23 00:04:58 2001
***************
*** 33,39 ****
  CC=/opt/SUNWspro/bin/cc
  MT_CC=/opt/SUNWspro/bin/cc
  CP=/bin/cp
- INSTALL=${SRCDIR}bin/install
  LEX=lex
  LD= /usr/ccs/bin/ld
  LORDER = /usr/ccs/bin/lorder
--- 33,38 ----
***************
*** 41,47 ****
  RANLIB=/bin/true
  RM=rm
  STRIP= /usr/ccs/bin/strip
! WASHTOOL=${SRCDIR}bin/washtool
  #
  # this is for the vol package
  FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26
--- 40,47 ----
  RANLIB=/bin/true
  RM=rm
  STRIP= /usr/ccs/bin/strip
! WASHTOOL=${DESTDIR}bin/washtool
! INSTALL=${DESTDIR}bin/install
  #
  # this is for the vol package
  FS_CONV_SOL26= $(DESTDIR)root.server/usr/afs/bin/fs_conv_sol26
Index: openafs/src/config/Makefile.sunx86_54
diff -c openafs/src/config/Makefile.sunx86_54:1.2 openafs/src/config/Makefile.sunx86_54:1.2.2.1
*** openafs/src/config/Makefile.sunx86_54:1.2	Sat Nov  4 05:04:20 2000
--- openafs/src/config/Makefile.sunx86_54	Mon Apr 23 00:04:59 2001
***************
*** 18,20 ****
--- 18,22 ----
  LD = /usr/ccs/bin/ld
  LORDER = /usr/ccs/bin/lorder
  STRIP= /usr/ccs/bin/strip
+ WASHTOOL=${DESTDIR}bin/washtool
+ INSTALL=${DESTDIR}bin/install
Index: openafs/src/config/Makefile.version-NOCML
diff -c openafs/src/config/Makefile.version-NOCML:1.2.2.4 openafs/src/config/Makefile.version-NOCML:1.2.2.5
*** openafs/src/config/Makefile.version-NOCML:1.2.2.4	Wed Mar  7 12:58:09 2001
--- openafs/src/config/Makefile.version-NOCML	Mon Apr 23 04:05:37 2001
***************
*** 8,15 ****
  AFS_component_version_number.o: AFS_component_version_number.c
  
  AFS_component_version_number.c: 
! 	echo 'char cml_version_number[]="@(#) OpenAFS stable 1.0.3 built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c;
! 	echo 'char* AFSVersion = "openafs stable 1.0.3"; ' >>AFS_component_version_number.c;
  
  noversion: install
  
--- 8,15 ----
  AFS_component_version_number.o: AFS_component_version_number.c
  
  AFS_component_version_number.c: 
! 	echo 'char cml_version_number[]="@(#) OpenAFS stable 1.0.4 built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c;
! 	echo 'char* AFSVersion = "openafs stable 1.0.4"; ' >>AFS_component_version_number.c;
  
  noversion: install
  
Index: openafs/src/config/NTMakefile
diff -c openafs/src/config/NTMakefile:1.2 openafs/src/config/NTMakefile:1.2.2.1
*** openafs/src/config/NTMakefile:1.2	Sat Nov  4 05:04:21 2000
--- openafs/src/config/NTMakefile	Mon Apr 23 02:25:57 2001
***************
*** 26,50 ****
  	$(INCFILEDIR)\debug.h \
  	$(INCFILEDIR)\param.h \
  	$(INCFILEDIR)\afs_sysnames.h \
- 	$(INCFILEDIR)\permit_xprt.h \
  	$(INCFILEDIR)\stds.h \
! 	$(INCFILEDIR)\icl.h \
! 	..\permit_xprt.h
  
  
  $(INCFILEDIR)\param.h: param.$(SYS_NAME).h
  	$(COPY) $? $@
- 
- !IF (EXIST($(SRCROOT)\xprt\permit_xprt.h))
- ..\permit_xprt.h: $(SRCROOT)\xprt\permit_xprt.h
- 	$(DEL) ..\permit_xprt.h
- 	$(COPY) $(SRCROOT)\xprt\permit_xprt.h ..\permit_xprt.h
- !ELSE
- ..\permit_xprt.h: .\permit_xprt.h
- 	$(DEL) ..\permit_xprt.h
- 	$(COPY) .\permit_xprt.h ..\permit_xprt.h
- !ENDIF
- 
  
  idirs: doclink
  !	IF (!EXIST($(DESTDIR)\include))
--- 26,37 ----
  	$(INCFILEDIR)\debug.h \
  	$(INCFILEDIR)\param.h \
  	$(INCFILEDIR)\afs_sysnames.h \
  	$(INCFILEDIR)\stds.h \
! 	$(INCFILEDIR)\icl.h 
  
  
  $(INCFILEDIR)\param.h: param.$(SYS_NAME).h
  	$(COPY) $? $@
  
  idirs: doclink
  !	IF (!EXIST($(DESTDIR)\include))
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.4.2.3 openafs/src/config/afs_sysnames.h:1.4.2.6
*** openafs/src/config/afs_sysnames.h:1.4.2.3	Tue Mar  6 16:23:57 2001
--- openafs/src/config/afs_sysnames.h	Mon Apr 23 03:29:11 2001
***************
*** 47,52 ****
--- 47,54 ----
  #define SYS_NAME_ID_mac2_51		 500	
  #define SYS_NAME_ID_mac_aux10		 501
  #define SYS_NAME_ID_mac_mach51		 502
+ #define SYS_NAME_ID_ppc_darwin_12        503
+ #define SYS_NAME_ID_ppc_darwin_13        504
  
  #define SYS_NAME_ID_next_mach20		 601
  #define SYS_NAME_ID_next_mach30		 602
***************
*** 125,130 ****
--- 127,137 ----
  #define SYS_NAME_ID_s390_linux22        1901
  #define SYS_NAME_ID_s390_linux24        1902
  
+ #define SYS_NAME_ID_alpha_linux_2       2000
+ #define SYS_NAME_ID_alpha_linux_22      2001
+ #define SYS_NAME_ID_alpha_linux_24      2002
+ 
+ #define SYS_NAME_ID_i386_fbsd_42        2100
  
  /*
   * Placeholder to keep system-wide standard flags since this file is included by all 
Index: openafs/src/config/config.c
diff -c openafs/src/config/config.c:1.2 openafs/src/config/config.c:1.2.2.1
*** openafs/src/config/config.c:1.2	Sat Nov  4 05:04:21 2000
--- openafs/src/config/config.c	Mon Apr 23 03:37:29 2001
***************
*** 16,24 ****
  
  #include "AFS_component_version_number.c"
  
! main(argc, argv)
! int argc;
! char **argv; {
      register FILE *infile;
      register FILE *outfile;
      char *alist[3];
--- 16,25 ----
  
  #include "AFS_component_version_number.c"
  
! /* prototypes */
! int mc_copy(FILE *, FILE *, char **);
! 
! int main(int argc, char **argv) {
      register FILE *infile;
      register FILE *outfile;
      char *alist[3];
Index: openafs/src/config/mc.c
diff -c openafs/src/config/mc.c:1.2 openafs/src/config/mc.c:1.2.2.1
*** openafs/src/config/mc.c:1.2	Sat Nov  4 05:04:22 2000
--- openafs/src/config/mc.c	Mon Apr 23 03:37:29 2001
***************
*** 13,23 ****
  #include <sys/types.h>
  #include <sys/file.h>
  #include <stdio.h>
  
- #if  defined(__alpha)
- extern void *malloc(int size);
- #endif
- 
  #define TOK_DONTUSE 1 /* Don't copy if match and this flag is set. */
  struct token {
      struct token *next;
--- 13,20 ----
  #include <sys/types.h>
  #include <sys/file.h>
  #include <stdio.h>
+ #include <stdlib.h>
  
  #define TOK_DONTUSE 1 /* Don't copy if match and this flag is set. */
  struct token {
      struct token *next;
***************
*** 26,32 ****
  };
  
  /* free token list returned by parseLine */
! static FreeTokens(alist)
      register struct token *alist; {
      register struct token *nlist;
      for(; alist; alist = nlist) {
--- 23,29 ----
  };
  
  /* free token list returned by parseLine */
! static int FreeTokens(alist)
      register struct token *alist; {
      register struct token *nlist;
      for(; alist; alist = nlist) {
***************
*** 38,48 ****
  }
  
  #define	space(x)    ((x) == ' ' || (x) == '\t' || (x) == '<' || (x) == '>')
! static ParseLine(aline, alist)
      char *aline;
      struct token **alist; {
      char tbuffer[MAXTOKLEN+1];
!     register char *tptr;
      int inToken;
      struct token *first, *last;
      register struct token *ttok;
--- 35,45 ----
  }
  
  #define	space(x)    ((x) == ' ' || (x) == '\t' || (x) == '<' || (x) == '>')
! static int ParseLine(aline, alist)
      char *aline;
      struct token **alist; {
      char tbuffer[MAXTOKLEN+1];
!     register char *tptr = NULL;
      int inToken;
      struct token *first, *last;
      register struct token *ttok;
***************
*** 57,63 ****
  	if (tc == 0 || space(tc)) {    /* terminating null gets us in here, too */
  	    if (inToken) {
  		inToken	= 0;	/* end of this token */
! 		*tptr++ = 0;
  		ttok = (struct token *) malloc(sizeof(struct token));
  		ttok->next = (struct token *) 0;
  		if (dontUse) {
--- 54,63 ----
  	if (tc == 0 || space(tc)) {    /* terminating null gets us in here, too */
  	    if (inToken) {
  		inToken	= 0;	/* end of this token */
! 		if ( !tptr )
! 	   	    return -1; /* should never get here */
! 		else
! 		    *tptr++ = 0;
  		ttok = (struct token *) malloc(sizeof(struct token));
  		ttok->next = (struct token *) 0;
  		if (dontUse) {
***************
*** 101,107 ****
  }
  /* read a line into a buffer, putting in null termination and stopping on appropriate
      end of line char.  Returns 0 at eof, > 0 at normal line end, and < 0 on error */
! static GetLine(afile, abuffer, amax)
      FILE *afile;
      int amax;
      register char *abuffer; {
--- 101,107 ----
  }
  /* read a line into a buffer, putting in null termination and stopping on appropriate
      end of line char.  Returns 0 at eof, > 0 at normal line end, and < 0 on error */
! static int GetLine(afile, abuffer, amax)
      FILE *afile;
      int amax;
      register char *abuffer; {
***************
*** 124,130 ****
  	}
      }
  }
! mc_copy(ain, aout, alist)
      register FILE *ain;
      register FILE *aout;
      char *alist[]; {
--- 124,131 ----
  	}
      }
  }
! 
! int mc_copy(ain, aout, alist)
      register FILE *ain;
      register FILE *aout;
      char *alist[]; {
Index: openafs/src/config/mkvers.c
diff -c openafs/src/config/mkvers.c:1.2 openafs/src/config/mkvers.c:1.2.2.1
*** openafs/src/config/mkvers.c:1.2	Sat Nov  4 05:04:22 2000
--- openafs/src/config/mkvers.c	Mon Apr 23 00:04:59 2001
***************
*** 16,22 ****
--- 16,24 ----
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <errno.h>
+ #ifndef __APPLE_CC__
  #include <malloc.h>
+ #endif
  #include <assert.h>
  #include <string.h>
  
Index: openafs/src/config/param.alpha_linux_2216_22.h
diff -c /dev/null openafs/src/config/param.alpha_linux_2216_22.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/param.alpha_linux_2216_22.h	Sun Apr 22 23:51:09 2001
***************
*** 0 ****
--- 1,68 ----
+ #ifndef _PARAM_ALPHA_LINUX2216_22_H_
+ #define _PARAM_ALPHA_LINUX2216_22_H_
+ 
+ /* Linux 2.2.16 kernel on Alpha with glibc 2.2 */
+  
+ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+  * it's a judgment call. If something is obviously sparc64 specific, use that
+  * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+  * in the sysname is the current version of the client. This takes into
+  * account the perferred OS user space configuration as well as the kernel.
+  */
+ 
+ #define AFS_LINUX20_ENV        1
+ #define AFS_LINUX22_ENV        1
+ #define AFS_ALPHA_LINUX20_ENV  1
+ #define AFS_ALPHA_LINUX22_ENV  1
+ #define __alpha        1
+ #define AFS_LINUX_64BIT_KERNEL 1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+ #define AFS_SYSCALL 338
+ #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_NAMEI_ENV     1   /* User space interface to file system */
+ 
+ #define AFS_64BIT_ENV          1       /* Defines afs_int32 as int, not long. */
+ #define AFS_64BITPOINTER_ENV   1       /* pointers are 64 bits. */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS             0       /* if nonzero, garbage collect PAGs */
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME       "alpha_linux_22"
+ #define SYS_NAME_ID    SYS_NAME_ID_alpha_linux_22
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+ 
+ #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+ #include <linux/config.h>
+ #ifdef CONFIG_SMP
+ #undef CONFIG_SMP
+ #endif
+ /* Using "AFS_SMP" to map to however many #define's are required to get
+  * MP to compile for Linux
+  */
+ #ifdef AFS_SMP
+ #define CONFIG_SMP
+ #define __SMP__
+ #define AFS_GLOBAL_SUNLOCK
+ #endif
+ 
+ #endif /* __KERNEL__  && !DUMP_KERNEL*/
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* _PARAM_ALPHA_LINUX2216_22_H_ */
Index: openafs/src/config/param.alpha_linux_2216_22_usr.h
diff -c /dev/null openafs/src/config/param.alpha_linux_2216_22_usr.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/param.alpha_linux_2216_22_usr.h	Sun Apr 22 23:51:09 2001
***************
*** 0 ****
--- 1,54 ----
+ #ifndef _PARAM_ALPHA_LINUX2216_22_USR_H_
+ #define _PARAM_ALPHA_LINUX2216_22_USR_H_
+ 
+ /* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel,
+  * it's a judgment call. If something is obviously sparc64 specific, use that
+  * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2"
+  * in the sysname is the current version of the client. This takes into
+  * account the perferred OS user space configuration as well as the kernel.
+  */
+ 
+ #define UKERNEL                        1       /* user space kernel */
+ #define AFS_ENV                        1
+ #define AFS_USR_LINUX20_ENV    1
+ #define AFS_USR_LINUX22_ENV    1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
+ #define AFS_SYSCALL 338
+ #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV       1
+ #define AFS_NAMEI_ENV     1   /* User space interface to file system */
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS             0       /* if nonzero, garbage collect PAGs */
+ 
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME       "alpha_linux_22"
+ #define SYS_NAME_ID    SYS_NAME_ID_alpha_linux_22
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+ 
+ #define        afsio_iov       uio_iov
+ #define        afsio_iovcnt    uio_iovcnt
+ #define        afsio_offset    uio_offset
+ #define        afsio_seg       uio_segflg
+ #define        afsio_fmode     uio_fmode
+ #define        afsio_resid     uio_resid
+ #define        AFS_UIOSYS      1
+ #define        AFS_UIOUSER     UIO_USERSPACE
+ #define        AFS_CLBYTES     MCLBYTES
+ #define        AFS_MINCHANGE   2
+ #define        VATTR_NULL      usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #endif /* _PARAM_ALPHA_LINUX2216_22_USR_H_ */
Index: openafs/src/config/param.hp_ux102.h
diff -c /dev/null openafs/src/config/param.hp_ux102.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/param.hp_ux102.h	Mon Apr 23 02:55:06 2001
***************
*** 0 ****
--- 1,87 ----
+ /*
+  * 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
+  */
+ 
+ /* THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT */
+ 
+ #ifndef	_PARAM_HP_UX10_2_H_
+ #define	_PARAM_HP_UX10_2_H_
+ 
+ #define AFS_HPUX_ENV	1
+ #define	AFS_HPUX90_ENV	1
+ #define	AFS_HPUX100_ENV	1
+ #define	AFS_HPUX101_ENV	1
+ #define	AFS_HPUX102_ENV	1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_SYSCALL	48 /* slot reserved for AFS */
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"hp_ux102"
+ #define SYS_NAME_ID	SYS_NAME_ID_hp_ux102
+ #define AFSBIG_ENDIAN	1
+ #define AFS_HAVE_FFS    1
+ #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_GLOBAL_SUNLOCK 1
+ #define RXK_LISTENER_ENV   1
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define AFS_GCPAGS		0       /* if nonzero, garbage collect PAGs */
+ /*
+  * #define AFS_VM_RDWR_ENV	1
+  */
+ #define AFS_TEXT_ENV	1	/* Older kernels use TEXT */
+ #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
+ #define _KERNEL 1
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_seg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIOSEG_KERNEL
+ #define	AFS_UIOUSER	UIOSEG_USER
+ #define	AFS_CLBYTES	CLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	osi_GetTime(x)	do { struct timeval osi_GetTimeVar; uniqtime(&osi_GetTimeVar); (x)->tv_sec = osi_GetTimeVar.tv_sec; (x)->tv_usec = osi_GetTimeVar.tv_usec; } while(0)
+ #define	AFS_KALLOC	kmem_alloc
+ #define	AFS_KFREE	kmem_free
+ #define	VATTR_NULL	vattr_null
+ 
+ #if defined(__LP64__)
+ #define AFS_HPUX_64BIT_ENV 1
+ #endif
+ 
+ #ifndef UKERNEL
+ /*
+  * On HP-UX, sys/socket.h includes sys/uio.h, and sys/file.h and
+  * sys/uio.h #include each other, and there's no simple way to avoid a
+  * warning about the struct uio declaration not being visible outside
+  * of some prototype or other.  So, we put in a tenative declaration to
+  * supress the warnings.
+  */
+ struct uio;
+ #endif
+ #endif /* KERNEL */
+ #define	AFS_DIRENT	
+ /* Non-standard definitions */
+ #ifndef	EDQUOT
+ #define	EDQUOT		69	/* Disc quota exceeded 		*/
+ #endif
+ 
+ #endif /* _PARAM_HP_UX10_2_H_ */
Index: openafs/src/config/param.hp_ux102_usr.h
diff -c /dev/null openafs/src/config/param.hp_ux102_usr.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/param.hp_ux102_usr.h	Mon Apr 23 02:55:06 2001
***************
*** 0 ****
--- 1,64 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #ifndef	_PARAM_USR_HPUX102_H_
+ #define	_PARAM_USR_HPUX102_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_HPUX_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   48 /* slot reserved for AFS */
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS	 1
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"hp_ux102"
+ #define SYS_NAME_ID	SYS_NAME_ID_hp_ux102
+ #define AFSBIG_ENDIAN	1
+ #define AFS_HAVE_FFS            1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS	0	/* System doesn't support statvfs */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef KERNEL
+ #define	AFS_UIOFMODE		1	/* Only in afs/afs_vnodeops.c (afs_ustrategy) */
+ #define	AFS_SYSVLOCK		1	/* sys v locking supported */
+ /*#define	AFS_USEBUFFERS	1*/
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ #endif /* KERNEL */
+ #define	AFS_DIRENT	
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #endif	/* _PARAM_USR_HPUX102_H_ */
Index: openafs/src/config/param.i386_fbsd_42.h
diff -c /dev/null openafs/src/config/param.i386_fbsd_42.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/param.i386_fbsd_42.h	Mon Apr 23 03:29:11 2001
***************
*** 0 ****
--- 1,136 ----
+ #ifndef	_PARAM_FBSD_42_H_
+ #define	_PARAM_FBSD_42_H_
+ 
+ #include <sys/param.h>
+ 
+ #define AFS_XBSD_ENV 1             /* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define AFS_KERBEROS_ENV
+ #define O_SYNC O_FSYNC
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 (struct simplelock *)0, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 (struct simplelock *)0, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VM_RDWR_ENV	1
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ #define AFS_MINPHYS_ENV	1
+ #define CMUSTD_ENV	1
+ 
+ #define AFS_SYSCALL	210
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS 1
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ #define SYS_NAME	"i386_fbsd_42"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_42
+ 
+ #define AFS_HAVE_FFS            1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS	0	/* System doesn't supports statvfs */
+ 
+ #define AFS_GCPAGS		1       /* if nonzero, garbage collect PAGs */
+ #define AFS_3DISPARES   1       /* Utilize the 3 available disk inode spares */
+ #define AFS_USE_GETTIMEOFDAY 1  /* use gettimeofday to implement rx clock */
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ #include <machine/endian.h>
+ #if	BYTE_ORDER == BIG_ENDIAN
+ #define	AFSBIG_ENDIAN		1
+ #else
+ #if	BYTE_ORDER == LITTLE_ENDIAN
+ #define	AFSLITTLE_ENDIAN	1
+ #else
+ #error	machine/endian.h must define BYTE_ORDER!
+ #endif
+ #endif
+ #endif	/* ! ASSEMBLER && ! __LANGUAGE_ASSEMBLY__ */
+ 
+ #define NEARINODE_HINT  1 /* hint to ufs module to scatter inodes on disk*/
+ #define nearInodeHash(volid, hval) {                          \
+                 unsigned char*  ts = (unsigned char*)&(volid);\
+                 for ((hval)=0; ts<(unsigned char*)&(volid)+sizeof(volid);ts++){\
+                     (hval) *= 173;                      \
+                     (hval) += *ts;                      \
+                 }                                       \
+                 }
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	1	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define	AFS_KALLOC(x)	kalloc(x)
+ #define	AFS_KFREE(x,y)	kfree(x,y)
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #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};
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif	/* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #endif	/* _PARAM_FBSD_42_H_ */
Index: openafs/src/config/param.i386_fbsd_42_usr.h
diff -c /dev/null openafs/src/config/param.i386_fbsd_42_usr.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:30 2001
--- openafs/src/config/param.i386_fbsd_42_usr.h	Mon Apr 23 03:29:12 2001
***************
*** 0 ****
--- 1,61 ----
+ #ifndef _PARAM_USR_I386_FBSD_42_H_
+ #define _PARAM_USR_I386_FBSD_42_H_
+ 
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ #define AFS_KERBEROS_ENV
+ 
+ #define O_SYNC O_FSYNC
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 210
+ #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_NAMEI_ENV     1   /* User space interface to file system */
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS		0       /* if nonzero, garbage collect PAGs */
+ 
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"i386_fbsd_42"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_42
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1       /* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <limits.h>
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <netinet/in.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ 
+ #endif /* _PARAM_USR_I386_FBSD_42_H_ */
Index: openafs/src/config/param.i386_linux22.h
diff -c openafs/src/config/param.i386_linux22.h:1.2.2.2 openafs/src/config/param.i386_linux22.h:1.2.2.3
*** openafs/src/config/param.i386_linux22.h:1.2.2.2	Tue Mar  6 17:19:19 2001
--- openafs/src/config/param.i386_linux22.h	Mon Apr 23 03:42:28 2001
***************
*** 25,31 ****
  
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
- #define AFS_64BIT_ENV
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  #include <afs/afs_sysnames.h>
--- 25,30 ----
Index: openafs/src/config/param.i386_linux24_usr.h
diff -c openafs/src/config/param.i386_linux24_usr.h:1.1 openafs/src/config/param.i386_linux24_usr.h:1.1.2.1
*** openafs/src/config/param.i386_linux24_usr.h:1.1	Sun Nov  5 15:13:39 2000
--- openafs/src/config/param.i386_linux24_usr.h	Mon Apr 23 02:45:33 2001
***************
*** 17,22 ****
--- 17,23 ----
  
  #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
  #define AFS_SYSCALL 137
+ #define AFS_64BIT_ENV
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  #include <afs/afs_sysnames.h>
Index: openafs/src/config/param.ppc_darwin_12.h
diff -c /dev/null openafs/src/config/param.ppc_darwin_12.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:31 2001
--- openafs/src/config/param.ppc_darwin_12.h	Mon Apr 23 02:07:09 2001
***************
*** 0 ****
--- 1,58 ----
+ #ifndef _PARAM_PPC_DARWIN_H_
+ #define _PARAM_PPC_DARWIN_H_
+ 
+ #define AFS_ENV                 1
+ #define AFS_64BIT_ENV           1       /* Defines afs_int32 as int, not long. */
+ #define AFS_PPC_ENV 1
+ #define AFS_VFSINCL_ENV 1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_DARWIN_ENV
+ #define AFS_NONFSTRANS
+ #define AFS_SYSCALL             230
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS    "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_ppc_darwin_12   1
+ #define SYS_NAME        "ppc_darwin_12"
+ #define SYS_NAME_ID     SYS_NAME_ID_ppc_darwin_12
+ #define AFSBIG_ENDIAN   1
+ #define AFS_HAVE_FFS    1       /* Use system's ffs. */
+ 
+ #define AFS_GCPAGS                1       /* if nonzero, garbage collect PAGs */
+ #define RXK_LISTENER_ENV         1
+ 
+ #ifdef KERNEL
+ #undef MACRO_BEGIN
+ #undef MACRO_END
+ #include <kern/macro_help.h>
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define AFS_VFS34       1       /* What is VFS34??? */
+ #define afsio_iov       uio_iov
+ #define afsio_iovcnt    uio_iovcnt
+ #define afsio_offset    uio_offset
+ #define afsio_seg       uio_segflg
+ #define afsio_resid     uio_resid
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ #define AFS_CLBYTES     CLBYTES
+ #define osi_GetTime(x)  microtime(x)
+ #define AFS_KALLOC(x)   kalloc(x)
+ #define AFS_KFREE(x,y)  kfree(x,y)
+ #define v_count         v_usecount
+ #define v_vfsp          v_mount
+ #define vfs_bsize       mnt_stat.f_bsize
+ #define vfs_fsid        mnt_stat.f_fsid
+ #define va_nodeid       va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct          dirent
+ #define vnode_t         struct vnode
+ 
+ #define VN_RELE(vp)     vrele(((struct vnode *)(vp)))
+ #define VN_HOLD(vp)     VREF(((struct vnode *)(vp)))
+ 
+ #endif
+ #endif  _PARAM_PPC_DARWIN_H_
Index: openafs/src/config/param.ppc_darwin_12_usr.h
diff -c /dev/null openafs/src/config/param.ppc_darwin_12_usr.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:31 2001
--- openafs/src/config/param.ppc_darwin_12_usr.h	Mon Apr 23 02:07:09 2001
***************
*** 0 ****
--- 1,46 ----
+ #ifndef _PARAM_PPC_DARWIN_H_
+ #define _PARAM_PPC_DARWIN_H_
+ 
+ #define AFS_VFSINCL_ENV 1       /* NOBODY uses this.... */
+ #define AFS_ENV                 1
+ #define AFS_64BIT_ENV           1       /* Defines afs_int32 as int, not long. */
+ #define AFS_PPC_ENV 1
+ 
+ #include <afs/afs_sysnames.h>
+ #define AFS_USERSPACE_ENV
+ #define AFS_USR_DARWIN_ENV
+ #define AFS_NONFSTRANS 
+ #define AFS_SYSCALL             230
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS    "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_ppc_darwin_12   1
+ #define SYS_NAME        "ppc_darwin_12"
+ #define SYS_NAME_ID     SYS_NAME_ID_ppc_darwin_12
+ #define AFSBIG_ENDIAN   1
+ #define AFS_HAVE_FFS    1       /* Use system's ffs. */
+ 
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ 
+ #define AFS_GCPAGS                0       /* if nonzero, garbage collect PAGs */
+ #define RXK_LISTENER_ENV          1
+ 
+ #define AFS_VFS34       1       /* What is VFS34??? */
+ #define afsio_iov       uio_iov
+ #define afsio_iovcnt    uio_iovcnt
+ #define afsio_offset    uio_offset
+ #define afsio_seg       uio_segflg
+ #define afsio_resid     uio_resid
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ #define        VATTR_NULL      usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #endif  _PARAM_PPC_DARWIN_H_
Index: openafs/src/config/param.ppc_darwin_13.h
diff -c /dev/null openafs/src/config/param.ppc_darwin_13.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:31 2001
--- openafs/src/config/param.ppc_darwin_13.h	Mon Apr 23 02:07:09 2001
***************
*** 0 ****
--- 1,60 ----
+ #ifndef _PARAM_PPC_DARWIN_H_
+ #define _PARAM_PPC_DARWIN_H_
+ 
+ #define AFS_ENV                 1
+ #define AFS_64BIT_ENV           1       /* Defines afs_int32 as int, not long. */
+ #define AFS_PPC_ENV 1
+ #define AFS_VFSINCL_ENV 1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_DARWIN_ENV
+ #define AFS_DARWIN13_ENV
+ #define AFS_NONFSTRANS
+ #define AFS_SYSCALL             230
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS    "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_ppc_darwin_12   1
+ #define sys_ppc_darwin_13   1
+ #define SYS_NAME        "ppc_darwin_13"
+ #define SYS_NAME_ID     SYS_NAME_ID_ppc_darwin_13
+ #define AFSBIG_ENDIAN   1
+ #define AFS_HAVE_FFS    1       /* Use system's ffs. */
+ 
+ #define AFS_GCPAGS                1       /* if nonzero, garbage collect PAGs */
+ #define RXK_LISTENER_ENV         1
+ 
+ #ifdef KERNEL
+ #undef MACRO_BEGIN
+ #undef MACRO_END
+ #include <kern/macro_help.h>
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define AFS_VFS34       1       /* What is VFS34??? */
+ #define afsio_iov       uio_iov
+ #define afsio_iovcnt    uio_iovcnt
+ #define afsio_offset    uio_offset
+ #define afsio_seg       uio_segflg
+ #define afsio_resid     uio_resid
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ #define AFS_CLBYTES     CLBYTES
+ #define osi_GetTime(x)  microtime(x)
+ #define AFS_KALLOC(x)   kalloc(x)
+ #define AFS_KFREE(x,y)  kfree(x,y)
+ #define v_count         v_usecount
+ #define v_vfsp          v_mount
+ #define vfs_bsize       mnt_stat.f_bsize
+ #define vfs_fsid        mnt_stat.f_fsid
+ #define va_nodeid       va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct          dirent
+ #define vnode_t         struct vnode
+ 
+ #define VN_RELE(vp)     vrele(((struct vnode *)(vp)))
+ #define VN_HOLD(vp)     VREF(((struct vnode *)(vp)))
+ 
+ #endif
+ #endif  _PARAM_PPC_DARWIN_H_
Index: openafs/src/config/param.ppc_darwin_13_usr.h
diff -c /dev/null openafs/src/config/param.ppc_darwin_13_usr.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:31 2001
--- openafs/src/config/param.ppc_darwin_13_usr.h	Mon Apr 23 02:07:10 2001
***************
*** 0 ****
--- 1,48 ----
+ #ifndef _PARAM_PPC_DARWIN_H_
+ #define _PARAM_PPC_DARWIN_H_
+ 
+ #define AFS_VFSINCL_ENV 1       /* NOBODY uses this.... */
+ #define AFS_ENV                 1
+ #define AFS_64BIT_ENV           1       /* Defines afs_int32 as int, not long. */
+ #define AFS_PPC_ENV 1
+ 
+ #include <afs/afs_sysnames.h>
+ #define AFS_USERSPACE_ENV
+ #define AFS_USR_DARWIN_ENV
+ #define AFS_USR_DARWIN13_ENV
+ #define AFS_NONFSTRANS 
+ #define AFS_SYSCALL             230
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS    "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_ppc_darwin_12   1
+ #define sys_ppc_darwin_13   1
+ #define SYS_NAME        "ppc_darwin_13"
+ #define SYS_NAME_ID     SYS_NAME_ID_ppc_darwin_13
+ #define AFSBIG_ENDIAN   1
+ #define AFS_HAVE_FFS    1       /* Use system's ffs. */
+ 
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ 
+ #define AFS_GCPAGS                0       /* if nonzero, garbage collect PAGs */
+ #define RXK_LISTENER_ENV          1
+ 
+ #define AFS_VFS34       1       /* What is VFS34??? */
+ #define afsio_iov       uio_iov
+ #define afsio_iovcnt    uio_iovcnt
+ #define afsio_offset    uio_offset
+ #define afsio_seg       uio_segflg
+ #define afsio_resid     uio_resid
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ #define        VATTR_NULL      usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #endif  _PARAM_PPC_DARWIN_H_
Index: openafs/src/dauth/Makefile
diff -c openafs/src/dauth/Makefile:1.2 openafs/src/dauth/Makefile:1.2.2.1
*** openafs/src/dauth/Makefile:1.2	Sat Nov  4 05:04:25 2000
--- openafs/src/dauth/Makefile	Mon Apr 23 00:05:05 2001
***************
*** 9,15 ****
  COMPONENT=	dauth
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=	${SRCDIR}bin/install
  COMPILE_ET = 	${SRCDIR}bin/compile_et
  OPTMZ=	-g
  
--- 9,14 ----
***************
*** 17,27 ****
  LDFLAGS =	${OPTMZ} ${XLDFLAGS}
  
  INCLS=		${SRCDIR}include/ubik.h \
!             	${SRCDIR}include/lwp.h \
!              	${SRCDIR}include/lock.h  \
!              	${SRCDIR}include/rx/rx.h \
!              	${SRCDIR}include/rx/xdr.h \
! 	     	${SRCDIR}include/afs/com_err.h
  
  VERSION =	AFS_component_version_number.o
  OBJS =		adkint.cs.o adkint.xdr.o
--- 16,26 ----
  LDFLAGS =	${OPTMZ} ${XLDFLAGS}
  
  INCLS=		${SRCDIR}include/ubik.h \
! 	       	${SRCDIR}include/lwp.h \
! 	       	${SRCDIR}include/lock.h  \
! 	       	${SRCDIR}include/rx/rx.h \
! 	       	${SRCDIR}include/rx/xdr.h \
! 		${SRCDIR}include/afs/com_err.h
  
  VERSION =	AFS_component_version_number.o
  OBJS =		adkint.cs.o adkint.xdr.o
***************
*** 71,77 ****
  dlog_test:	dlog.c $(OBJS) $(LIBS)
  		$(CC) $(LDFLAGS) -DDLOG_TEST -o dlog_test dlog.c $(OBJS) \
  			$(LIBS) ${XLIBS}
! 	
  system: 	install
  
  ${DESTDIR}bin/dlog: dlog
--- 70,76 ----
  dlog_test:	dlog.c $(OBJS) $(LIBS)
  		$(CC) $(LDFLAGS) -DDLOG_TEST -o dlog_test dlog.c $(OBJS) \
  			$(LIBS) ${XLIBS}
! 
  system: 	install
  
  ${DESTDIR}bin/dlog: dlog
Index: openafs/src/dauth/dlog.c
diff -c openafs/src/dauth/dlog.c:1.2 openafs/src/dauth/dlog.c:1.2.2.1
*** openafs/src/dauth/dlog.c:1.2	Sat Nov  4 05:04:25 2000
--- openafs/src/dauth/dlog.c	Mon Apr 23 02:26:01 2001
***************
*** 89,97 ****
  #include <des.h>
  #include <afs/afsutil.h>
  
- #include "../permit_xprt.h"
- 
- 
  /*
   * The password reading routine in des/readpassword.c will not work if the
   * buffer size passed in is greater than BUFSIZ, so we pretty well have to
--- 89,94 ----
Index: openafs/src/des/Makefile
diff -c openafs/src/des/Makefile:1.1 openafs/src/des/Makefile:1.1.6.2
*** openafs/src/des/Makefile:1.1	Fri Nov  3 21:26:02 2000
--- openafs/src/des/Makefile	Mon Apr 23 02:26:06 2001
***************
*** 26,32 ****
  include ../config/Makefile.${SYS_NAME}
  
  UKERNELDIR=../libuafs/
- INSTALL=${SRCDIR}bin/install
  SRC	=.
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
--- 26,31 ----
***************
*** 208,216 ****
  	rm -f ${DES_LIB}
  	ar r ${DES_LIB} ${TARGOBJS} ${COMMONOBJS} AFS_component_version_number.o
  	$(RANLIB) ${DES_LIB}
- 
- # export stuff
- des.o cbc_encrypt.o pcbc_encrypt.o new_rnd_key.o cksum.o testit.o verify.o: ../permit_xprt.h
  
  #	host system stuff
  make_ip: make_ip.o misc.o
--- 207,212 ----
Index: openafs/src/des/andrew-conf.h
diff -c openafs/src/des/andrew-conf.h:1.2.2.2 openafs/src/des/andrew-conf.h:1.2.2.4
*** openafs/src/des/andrew-conf.h:1.2.2.2	Fri Jan 19 04:33:47 2001
--- openafs/src/des/andrew-conf.h	Mon Apr 23 00:05:12 2001
***************
*** 31,37 ****
  #if defined(sgi)
  #include "conf-sgi.h"
  #else
! #ifdef	__alpha
  #include "conf-bsd-alpha.h"
  #else
  #if	defined(AFS_X86_ENV)
--- 31,37 ----
  #if defined(sgi)
  #include "conf-sgi.h"
  #else
! #if defined(__alpha) && !defined(AFS_ALPHA_LINUX20_ENV)
  #include "conf-bsd-alpha.h"
  #else
  #if	defined(AFS_X86_ENV)
***************
*** 53,66 ****
--- 53,74 ----
  #ifdef AFS_S390_LINUX20_ENV
  #include "conf-s390-linux.h"
  #else
+ #ifdef AFS_ALPHA_LINUX20_ENV
+ #include "conf-alpha-linux.h"
+ #else
  #include "conf-i386-linux.h"
+ #endif /* AFS_ALPHA_LINUX20_ENV */
  #endif /* AFS_S390_LINUX20_ENV */
  #endif /* AFS_SPARC64_LINUX20_ENV */
  #endif /* AFS_SPARC_LINUX20_ENV */
  #endif
  #else
+ #if defined(AFS_DARWIN_ENV) && defined(AFS_PPC_ENV)
+ #include "conf-ppc-darwin.h"
+ #else
  Sorry, you lose.
  Figure out what the machine looks like and fix this file to include it.
+ #endif
  #endif /* AFS_LINUX20_ENV */
  #endif /* AFS_NT40_ENV */
  #endif /* NCR || X86 */
Index: openafs/src/des/cbc_encrypt.c
diff -c openafs/src/des/cbc_encrypt.c:1.1 openafs/src/des/cbc_encrypt.c:1.1.6.3
*** openafs/src/des/cbc_encrypt.c:1.1	Fri Nov  3 21:26:05 2000
--- openafs/src/des/cbc_encrypt.c	Mon Apr 23 03:37:33 2001
***************
*** 23,32 ****
  #include <afs/param.h>
  
  #define XPRT_CBC_ENCRYPT
- #include "../permit_xprt.h"
  
  extern int des_debug;
  extern int des_debug_print();
  
  /*
   * This routine performs DES cipher-block-chaining operation, either
--- 23,32 ----
  #include <afs/param.h>
  
  #define XPRT_CBC_ENCRYPT
  
  extern int des_debug;
  extern int des_debug_print();
+ extern int des_ecb_encrypt();
  
  /*
   * This routine performs DES cipher-block-chaining operation, either
***************
*** 47,53 ****
   * cleartext.
   */
  
! AFS_HIDE afs_int32
  des_cbc_encrypt(in,out,length,key,iv,encrypt)
      des_cblock *in;		/* >= length bytes of input text */
      des_cblock *out;		/* >= length bytes of output text */
--- 47,53 ----
   * cleartext.
   */
  
! afs_int32
  des_cbc_encrypt(in,out,length,key,iv,encrypt)
      des_cblock *in;		/* >= length bytes of input text */
      des_cblock *out;		/* >= length bytes of output text */
Index: openafs/src/des/cksum.c
diff -c openafs/src/des/cksum.c:1.1 openafs/src/des/cksum.c:1.1.6.3
*** openafs/src/des/cksum.c:1.1	Fri Nov  3 21:26:06 2000
--- openafs/src/des/cksum.c	Mon Apr 23 03:37:33 2001
***************
*** 30,39 ****
  #include "des_internal.h"
  
  #define XPRT_CKSUM
- #include "../permit_xprt.h"
  
  extern int des_debug;
  extern int des_debug_print();
  
  /*
   * This routine performs DES cipher-block-chaining checksum operation,
--- 30,39 ----
  #include "des_internal.h"
  
  #define XPRT_CKSUM
  
  extern int des_debug;
  extern int des_debug_print();
+ extern int des_ecb_encrypt();
  
  /*
   * This routine performs DES cipher-block-chaining checksum operation,
***************
*** 50,56 ****
   * multiple of eight bytes.
   */
  
! AFS_HIDE afs_uint32
  des_cbc_cksum(in,out,length,key,iv)
      des_cblock *in;		/* >= length bytes of inputtext */
      des_cblock *out;		/* >= length bytes of outputtext */
--- 50,56 ----
   * multiple of eight bytes.
   */
  
! afs_uint32
  des_cbc_cksum(in,out,length,key,iv)
      des_cblock *in;		/* >= length bytes of inputtext */
      des_cblock *out;		/* >= length bytes of outputtext */
Index: openafs/src/des/conf-alpha-linux.h
diff -c /dev/null openafs/src/des/conf-alpha-linux.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:31 2001
--- openafs/src/des/conf-alpha-linux.h	Sun Apr 22 23:51:12 2001
***************
*** 0 ****
--- 1,18 ----
+ /*
+  * Copyright 1988 by the Massachusetts Institute of Technology.
+  *
+  * For copying and distribution information, please see the file
+  * <mit-copyright.h>.
+  *
+  * Machine-type definitions: Alpha
+  */
+ 
+ #include <mit-cpyright.h>
+ 
+ #define ALPHA
+ 
+ /* 'course this is a joke, but I am not going to rewrite this mess */
+ #define BITS32
+ 
+ #define BIG
+ #define LSBFIRST
Index: openafs/src/des/conf-ppc-darwin.h
diff -c /dev/null openafs/src/des/conf-ppc-darwin.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:31 2001
--- openafs/src/des/conf-ppc-darwin.h	Mon Apr 23 02:07:13 2001
***************
*** 0 ****
--- 1,6 ----
+ #define BITS32
+ #define BIG
+ #undef BSDUNIX
+ #define MSBFIRST
+ #define MUSTALIGN
+ 
Index: openafs/src/des/des.c
diff -c openafs/src/des/des.c:1.1 openafs/src/des/des.c:1.1.6.3
*** openafs/src/des/des.c:1.1	Fri Nov  3 21:26:24 2000
--- openafs/src/des/des.c	Mon Apr 23 03:37:34 2001
***************
*** 48,54 ****
  #include "stats.h"
  
  #define XPRT_DES
- #include "../permit_xprt.h"
  
  #ifdef DEBUG
  #define DBG_PRINT(s) if (des_debug & 2) \
--- 48,53 ----
***************
*** 59,72 ****
  #endif
  
  extern int des_debug;
! extern des_cblock_print_file ();
! extern des_debug_print ();
  
  #ifdef AFS_PTHREAD_ENV
  pthread_mutex_t rxkad_stats_mutex;
  #endif /* AFS_PTHREAD_ENV */
      
! AFS_HIDE afs_int32
  des_ecb_encrypt(clear, cipher, schedule, encrypt)
      afs_uint32 *clear;
      afs_uint32 *cipher;
--- 58,72 ----
  #endif
  
  extern int des_debug;
! extern int des_cblock_print_file ();
! extern int des_debug_print ();
! extern int swap_long_bytes_bit_number(int);
  
  #ifdef AFS_PTHREAD_ENV
  pthread_mutex_t rxkad_stats_mutex;
  #endif /* AFS_PTHREAD_ENV */
      
! afs_int32
  des_ecb_encrypt(clear, cipher, schedule, encrypt)
      afs_uint32 *clear;
      afs_uint32 *cipher;
Index: openafs/src/des/key_sched.c
diff -c openafs/src/des/key_sched.c:1.1 openafs/src/des/key_sched.c:1.1.6.1
*** openafs/src/des/key_sched.c:1.1	Fri Nov  3 21:26:28 2000
--- openafs/src/des/key_sched.c	Mon Apr 23 03:37:34 2001
***************
*** 36,47 ****
  #include "stats.h"
  
  extern int des_debug;
! extern rev_swap_bit_pos_0();
  
  typedef char key[64];
  /* the following are really void but cc86 doesnt allow it */
  static int make_key_sched();
  
  #ifdef AFS_DUX40_ENV
  #pragma weak des_key_sched = afs_des_key_sched
  int afs_des_key_sched(k,schedule)
--- 36,50 ----
  #include "stats.h"
  
  extern int des_debug;
! extern int rev_swap_bit_pos_0();
! extern int des_check_key_parity(des_cblock);
! extern int des_is_weak_key(des_cblock);
  
  typedef char key[64];
  /* the following are really void but cc86 doesnt allow it */
  static int make_key_sched();
  
+ 
  #ifdef AFS_DUX40_ENV
  #pragma weak des_key_sched = afs_des_key_sched
  int afs_des_key_sched(k,schedule)
***************
*** 246,249 ****
--- 249,254 ----
  	fprintf(stderr,"\n");
      }
  #endif
+ 
+ 	return(0);
  }
Index: openafs/src/des/make_fp.c
diff -c openafs/src/des/make_fp.c:1.1 openafs/src/des/make_fp.c:1.1.6.1
*** openafs/src/des/make_fp.c:1.1	Fri Nov  3 21:26:30 2000
--- openafs/src/des/make_fp.c	Mon Apr 23 03:37:34 2001
***************
*** 11,20 ****
--- 11,23 ----
  #include <mit-cpyright.h>
  #include <stdio.h>
  #include "des_internal.h"
+ 
+ #define WANT_FP_TABLE
  #include "tables.h"
  
  extern unsigned int swap_bit_pos_0_to_ansi PROTOTYPE((unsigned int));
  extern afs_int32 swap_long_bytes();
+ extern afs_int32 swap_long_bytes_bit_number();
  extern void test_set PROTOTYPE((FILE *, char const *, int,
  				char const *, int));
  
Index: openafs/src/des/make_ip.c
diff -c openafs/src/des/make_ip.c:1.1 openafs/src/des/make_ip.c:1.1.6.1
*** openafs/src/des/make_ip.c:1.1	Fri Nov  3 21:26:31 2000
--- openafs/src/des/make_ip.c	Mon Apr 23 03:37:34 2001
***************
*** 11,20 ****
--- 11,26 ----
  #include <mit-cpyright.h>
  #include <stdio.h>
  #include "des_internal.h"
+ 
+ #define WANT_IP_TABLE
  #include "tables.h"
  
  extern afs_int32 swap_bit_pos_0();
  extern afs_int32 rev_swap_bit_pos_0();
+ extern void test_set PROTOTYPE((FILE *, char const *, int,
+                 char const *, int));
+ extern int swap_long_bytes_bit_number(int);
+ extern int swap_bit_pos_0_to_ansi(int);
  
  #define SWAP(x) swap_long_bytes_bit_number(swap_bit_pos_0_to_ansi(x))
  
Index: openafs/src/des/make_keyperm.c
diff -c openafs/src/des/make_keyperm.c:1.1 openafs/src/des/make_keyperm.c:1.1.6.1
*** openafs/src/des/make_keyperm.c:1.1	Fri Nov  3 21:26:31 2000
--- openafs/src/des/make_keyperm.c	Mon Apr 23 03:37:34 2001
***************
*** 186,194 ****
          }
  
          /* now output the resulting key permutation */
!         fprintf(stream, "    /* ks permutation iteration = %2d */",
                  iter);
          for (i = 1; i <= 6; i++) {
              fprintf(stream, "\n    ");
              for (j = 1; j <= 8; j++) {
                  /*
--- 186,195 ----
          }
  
          /* now output the resulting key permutation */
!         fprintf(stream, "\n    /* ks permutation iteration = %2d */",
                  iter);
          for (i = 1; i <= 6; i++) {
+ 			if ( i == 1 ) fprintf(stream, "\n    {");
              fprintf(stream, "\n    ");
              for (j = 1; j <= 8; j++) {
                  /*
***************
*** 197,207 ****
                   */
                  fprintf(stream, "%d", ks_perm[iter][(i-1)*8+j]-1);
                  /* omit last comma */
!                 if ((j != 8) || (i != 6) || (iter != 16)) {
                      fprintf(stream,", ");
                  }
              }
          }
      }
      fprintf(stream,"\n};\n");
  }
--- 198,213 ----
                   */
                  fprintf(stream, "%d", ks_perm[iter][(i-1)*8+j]-1);
                  /* omit last comma */
!                 if ((j != 8) || (i != 6)) {
                      fprintf(stream,", ");
                  }
              }
          }
+ 		if ( iter != 16) {
+ 			fprintf(stream, "\n    }, ");
+ 		} else {
+ 			fprintf(stream, "\n    }");
+ 		}
      }
      fprintf(stream,"\n};\n");
  }
Index: openafs/src/des/make_p_table.c
diff -c openafs/src/des/make_p_table.c:1.1 openafs/src/des/make_p_table.c:1.1.6.1
*** openafs/src/des/make_p_table.c:1.1	Fri Nov  3 21:26:33 2000
--- openafs/src/des/make_p_table.c	Mon Apr 23 03:37:35 2001
***************
*** 9,14 ****
--- 9,16 ----
  #include <mit-cpyright.h>
  #include <stdio.h>
  #include "des_internal.h"
+ 
+ #define WANT_P_TABLE
  #include "tables.h"
  
  extern afs_uint32 swap_byte_bits();
***************
*** 25,31 ****
  #ifdef BIG
      /* flip p into p_temp */
      for (i = 0; i<32; i++)
! 	P_temp[P[rev_swap_bit_pos_0(i)]] = rev_swap_bit_pos_0(i);
  
      /*
       * now for each byte of input, figure out all possible combinations
--- 27,33 ----
  #ifdef BIG
      /* flip p into p_temp */
      for (i = 0; i<32; i++)
! 	P_temp[(int) P[rev_swap_bit_pos_0(i)]] = rev_swap_bit_pos_0(i);
  
      /*
       * now for each byte of input, figure out all possible combinations
***************
*** 47,57 ****
      fprintf(stream,
  	    "\n\tstatic afs_uint32 const P_prime[4][256] = {\n\t");
      for (i = 0; i < 4; i++) {
! 	fprintf(stream,"\n");
  	for (j = 0; j < 64; j++) {
  	    fprintf(stream,"\n");
  	    for (k = 0; k < 4; k++) {
  		fprintf(stream,"0x%08X",P_prime[i][j*4+k]);
  		if ((i == 3) && (j == 63) && (k == 3))
  		    fprintf(stream,"\n};");
  		else
--- 49,61 ----
      fprintf(stream,
  	    "\n\tstatic afs_uint32 const P_prime[4][256] = {\n\t");
      for (i = 0; i < 4; i++) {
! 	fprintf(stream,"\n{ ");
  	for (j = 0; j < 64; j++) {
  	    fprintf(stream,"\n");
  	    for (k = 0; k < 4; k++) {
  		fprintf(stream,"0x%08X",P_prime[i][j*4+k]);
+ 		if ((j == 63) && (k == 3))
+ 		    fprintf(stream, "}");
  		if ((i == 3) && (j == 63) && (k == 3))
  		    fprintf(stream,"\n};");
  		else
Index: openafs/src/des/make_s_table.c
diff -c openafs/src/des/make_s_table.c:1.1 openafs/src/des/make_s_table.c:1.1.6.1
*** openafs/src/des/make_s_table.c:1.1	Fri Nov  3 21:26:33 2000
--- openafs/src/des/make_s_table.c	Mon Apr 23 03:37:35 2001
***************
*** 8,13 ****
--- 8,15 ----
  #include <mit-cpyright.h>
  #include <stdio.h>
  #include "des_internal.h"
+ 
+ #define WANT_S_TABLE
  #include "tables.h"
  
  extern afs_uint32 swap_bit_pos_0();
***************
*** 51,62 ****
      }
  
      for (i = 0; i<=7; i++) {
!         fprintf(stream,"\n");
          k =0;
          for (j = 0; j<= 3; j++) {
              fprintf(stream,"\n");
              for (m = 0; m <= 15; m++) {
                  fprintf(stream,"%2d",temp[i][k]);
                  if ((k++ != 63) || (i !=7)) {
                      fprintf(stream,", ");
                  }
--- 53,68 ----
      }
  
      for (i = 0; i<=7; i++) {
!         fprintf(stream,"\n{ ");
          k =0;
          for (j = 0; j<= 3; j++) {
              fprintf(stream,"\n");
              for (m = 0; m <= 15; m++) {
                  fprintf(stream,"%2d",temp[i][k]);
+ 		if (k==63)
+ 		{
+ 		    fprintf(stream,"\n}");
+ 		}
                  if ((k++ != 63) || (i !=7)) {
                      fprintf(stream,", ");
                  }
Index: openafs/src/des/misc.c
diff -c openafs/src/des/misc.c:1.1 openafs/src/des/misc.c:1.1.6.1
*** openafs/src/des/misc.c:1.1	Fri Nov  3 21:26:34 2000
--- openafs/src/des/misc.c	Mon Apr 23 03:37:35 2001
***************
*** 238,244 ****
  #endif /* LSBFIRST */
  }
  
! swap_long_bytes_bit_number(x)
      afs_uint32 x;
  {
      /*
--- 238,244 ----
  #endif /* LSBFIRST */
  }
  
! int swap_long_bytes_bit_number(x)
      afs_uint32 x;
  {
      /*
***************
*** 290,296 ****
  
  #include "AFS_component_version_number.c"
  
! main(argc, argv)
      int argc;
      char *argv[];
  {
--- 290,296 ----
  
  #include "AFS_component_version_number.c"
  
! int main(argc, argv)
      int argc;
      char *argv[];
  {
Index: openafs/src/des/new_rnd_key.c
diff -c openafs/src/des/new_rnd_key.c:1.1 openafs/src/des/new_rnd_key.c:1.1.6.3
*** openafs/src/des/new_rnd_key.c:1.1	Fri Nov  3 21:26:35 2000
--- openafs/src/des/new_rnd_key.c	Mon Apr 23 03:37:35 2001
***************
*** 19,37 ****
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
  #endif
  #include <des.h>
  #include "des_internal.h"
  #include "stats.h"
  
  extern void des_fixup_key_parity();
  extern int des_is_weak_key();
  
  void des_set_random_generator_seed();
  static afs_int32 des_set_sequence_number(des_cblock new_sequence_number);
  static afs_int32 des_generate_random_block(des_cblock block);
  
  #define XPRT_NEW_RND_KEY
- #include "../permit_xprt.h"
  
  static int is_inited = 0;
  #ifdef AFS_PTHREAD_ENV
--- 19,39 ----
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
  #endif
+ #include <string.h>
  #include <des.h>
  #include "des_internal.h"
  #include "stats.h"
  
  extern void des_fixup_key_parity();
  extern int des_is_weak_key();
+ extern int des_ecb_encrypt();
+ extern int des_key_sched();
  
  void des_set_random_generator_seed();
  static afs_int32 des_set_sequence_number(des_cblock new_sequence_number);
  static afs_int32 des_generate_random_block(des_cblock block);
  
  #define XPRT_NEW_RND_KEY
  
  static int is_inited = 0;
  #ifdef AFS_PTHREAD_ENV
***************
*** 93,99 ****
   *
   * Note: this routine calls des_set_random_generator_seed.
   */
! #if !defined(BSDUNIX) && !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
    you lose...   (aka, you get to implement an analog of this for your
  		 system...)
  #else
--- 95,101 ----
   *
   * Note: this routine calls des_set_random_generator_seed.
   */
! #if !defined(BSDUNIX) && !defined(AFS_SGI_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
    you lose...   (aka, you get to implement an analog of this for your
  		 system...)
  #else
***************
*** 104,109 ****
--- 106,112 ----
  #include <afs/afsutil.h>
  #else
  #include <sys/time.h>
+ #include <unistd.h>
  #endif
  
  void des_init_random_number_generator(key)
Index: openafs/src/des/pcbc_encrypt.c
diff -c openafs/src/des/pcbc_encrypt.c:1.1 openafs/src/des/pcbc_encrypt.c:1.1.6.3
*** openafs/src/des/pcbc_encrypt.c:1.1	Fri Nov  3 21:26:35 2000
--- openafs/src/des/pcbc_encrypt.c	Mon Apr 23 03:37:35 2001
***************
*** 27,36 ****
  #include "des_internal.h"
  
  #define XPRT_PCBC_ENCRYPT
- #include "../permit_xprt.h"
  
  extern int des_debug;
  extern int des_debug_print();
  
  /*
   * pcbc_encrypt is an "error propagation chaining" encrypt operation
--- 27,36 ----
  #include "des_internal.h"
  
  #define XPRT_PCBC_ENCRYPT
  
  extern int des_debug;
  extern int des_debug_print();
+ extern int des_ecb_encrypt();
  
  /*
   * pcbc_encrypt is an "error propagation chaining" encrypt operation
***************
*** 62,68 ****
   *
   */
  
! AFS_HIDE afs_int32
  des_pcbc_encrypt(in,out,length,key,iv,encrypt)
      des_cblock *in;		/* >= length bytes of inputtext */
      des_cblock *out;		/* >= length bytes of outputtext */
--- 62,68 ----
   *
   */
  
! afs_int32
  des_pcbc_encrypt(in,out,length,key,iv,encrypt)
      des_cblock *in;		/* >= length bytes of inputtext */
      des_cblock *out;		/* >= length bytes of outputtext */
Index: openafs/src/des/read_pssword.c
diff -c openafs/src/des/read_pssword.c:1.1 openafs/src/des/read_pssword.c:1.1.6.3
*** openafs/src/des/read_pssword.c:1.1	Fri Nov  3 21:26:37 2000
--- openafs/src/des/read_pssword.c	Mon Apr 23 03:37:35 2001
***************
*** 28,40 ****
  #ifdef	AFS_SUN5_ENV
  #define BSD_COMP
  #endif
  #include <sys/ioctl.h>
  #include <signal.h>
  #include <setjmp.h>
  #endif
  
! #if defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)
  #include <signal.h>
  #endif
  
  #ifdef	AFS_HPUX_ENV
--- 28,44 ----
  #ifdef	AFS_SUN5_ENV
  #define BSD_COMP
  #endif
+ #if defined(AFS_FBSD_ENV)
+ #define USE_OLD_TTY
+ #endif
  #include <sys/ioctl.h>
  #include <signal.h>
  #include <setjmp.h>
  #endif
  
! #if defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  #include <signal.h>
+ #include <unistd.h>
  #endif
  
  #ifdef	AFS_HPUX_ENV
***************
*** 48,53 ****
--- 52,60 ----
  #include <termios.h>
  #endif
  
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include <termios.h>
+ #endif
  #ifdef AFS_NT40_ENV
  #include <windows.h>
  #endif
***************
*** 70,78 ****
  #endif
  static sigtype sig_restore();
  static push_signals(), pop_signals();
- int des_read_pw_string();
  #endif
  
  /*** Routines ****************************************************** */
  int
  des_read_password(k,prompt,verify)
--- 77,87 ----
  #endif
  static sigtype sig_restore();
  static push_signals(), pop_signals();
  #endif
  
+ int des_read_pw_string(char *, int, char *, int);
+ int des_string_to_key(char *, des_cblock *);
+ 
  /*** Routines ****************************************************** */
  int
  des_read_password(k,prompt,verify)
***************
*** 94,105 ****
      if (ok == 0)
  	des_string_to_key(key_string, k);
  
  lose:
      bzero(key_string, sizeof (key_string));
      return ok;
  }
  
! #if	defined	(AFS_AIX_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) || defined(AFS_LINUX20_ENV)
  static void catch(int);
  #endif
  
--- 103,116 ----
      if (ok == 0)
  	des_string_to_key(key_string, k);
  
+ #ifdef BSDUNIX
  lose:
+ #endif
      bzero(key_string, sizeof (key_string));
      return ok;
  }
  
! #if	defined	(AFS_AIX_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  static void catch(int);
  #endif
  
***************
*** 121,131 ****
  {
      int ok = 0, cnt1=0;
      char *ptr;
! #ifdef	AFS_HPUX_ENV
      register int fno;
      struct sigaction newsig, oldsig;
      struct termios save_ttyb, ttyb;
  #endif
  #if	defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
      struct termios ttyb;
      struct sigaction osa, sa;
--- 132,145 ----
  {
      int ok = 0, cnt1=0;
      char *ptr;
! #if defined(AFS_HPUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
      register int fno;
      struct sigaction newsig, oldsig;
      struct termios save_ttyb, ttyb;
  #endif
+ #if defined(AFS_DARWIN_ENV)
+     FILE *fi;
+ #endif
  #if	defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV)
      struct termios ttyb;
      struct sigaction osa, sa;
***************
*** 156,162 ****
  	return -1;
      }
  
! #ifdef	AFS_HPUX_ENV
      if ((fi = fopen("/dev/tty", "r")) == NULL)
          return -1;
      setbuf(fi, (char *)NULL);			/* We don't want any buffering for our i/o. */
--- 170,176 ----
  	return -1;
      }
  
! #if defined(AFS_HPUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
      if ((fi = fopen("/dev/tty", "r")) == NULL)
          return -1;
      setbuf(fi, (char *)NULL);			/* We don't want any buffering for our i/o. */
***************
*** 288,294 ****
--- 302,310 ----
  	ok = 1;
      }
  
+ #ifdef BSDUNIX
  lose:
+ #endif
      if (!ok)
  	bzero(s, maxa);
      printf("\n");
***************
*** 382,388 ****
  #endif
  
  
! #if	defined	(AFS_AIX_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) || defined(AFS_LINUX20_ENV)
  static void
  catch(int junk)
  {
--- 398,404 ----
  #endif
  
  
! #if	defined	(AFS_AIX_ENV) || defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  static void
  catch(int junk)
  {
Index: openafs/src/des/strng_to_key.c
diff -c openafs/src/des/strng_to_key.c:1.1 openafs/src/des/strng_to_key.c:1.1.6.2
*** openafs/src/des/strng_to_key.c:1.1	Fri Nov  3 21:26:38 2000
--- openafs/src/des/strng_to_key.c	Mon Apr 23 03:37:36 2001
***************
*** 22,27 ****
--- 22,28 ----
  
  #include <mit-cpyright.h>
  #include <stdio.h>
+ #include <string.h>
  #include <afs/param.h>
  #include <des.h>
  #include "des_internal.h"
***************
*** 31,42 ****
  extern void des_fixup_key_parity();
  extern afs_uint32 des_cbc_cksum();
  
! #include "../permit_xprt.h"
  
  /*
   * convert an arbitrary length string to a DES key
   */
! int
  des_string_to_key(str,key)
      char *str;
      register des_cblock *key;
--- 32,44 ----
  extern void des_fixup_key_parity();
  extern afs_uint32 des_cbc_cksum();
  
! /* prototypes */
! int des_key_sched(register des_cblock *k, des_key_schedule schedule);
  
  /*
   * convert an arbitrary length string to a DES key
   */
! void
  des_string_to_key(str,key)
      char *str;
      register des_cblock *key;
Index: openafs/src/des/tables.h
diff -c openafs/src/des/tables.h:1.1 openafs/src/des/tables.h:1.1.6.1
*** openafs/src/des/tables.h:1.1	Fri Nov  3 21:26:39 2000
--- openafs/src/des/tables.h	Mon Apr 23 03:37:36 2001
***************
*** 12,17 ****
--- 12,18 ----
  /*
   * Initial permutation, adjust to zero based subscript
   */
+ #ifdef WANT_IP_TABLE
  static	char	IP[] = {
  	58-1, 50-1, 42-1, 34-1, 26-1, 18-1, 10-1,  2-1, 
  	60-1, 52-1, 44-1, 36-1, 28-1, 20-1, 12-1,  4-1, 
***************
*** 22,31 ****
--- 23,34 ----
  	61-1, 53-1, 45-1, 37-1, 29-1, 21-1, 13-1,  5-1, 
  	63-1, 55-1, 47-1, 39-1, 31-1, 23-1, 15-1,  7-1, 
  };
+ #endif
  
  /*
   * Final permutation,  FP = IP^(-1) adjust to zero based subscript
   */
+ #ifdef WANT_FP_TABLE
  static	char	FP[] = {
  	40-1,  8-1, 48-1, 16-1, 56-1, 24-1, 64-1, 32-1, 
  	39-1,  7-1, 47-1, 15-1, 55-1, 23-1, 63-1, 31-1, 
***************
*** 36,43 ****
--- 39,48 ----
  	34-1,  2-1, 42-1, 10-1, 50-1, 18-1, 58-1, 26-1, 
  	33-1,  1-1, 41-1,  9-1, 49-1, 17-1, 57-1, 25-1, 
  };
+ #endif
  
  /* the E selection function, adjusted to zero based subscripts */
+ #ifdef WANT_E_TABLE
  static	char	E[] = {
  	32-1,	1-1,	2-1,	3-1,	4-1,	5-1,
  	 4-1,	5-1,	6-1,	7-1,	8-1,	9-1,
***************
*** 48,55 ****
--- 53,62 ----
  	24-1,	25-1,	26-1,	27-1,	28-1,	29-1,
  	28-1,	29-1,	30-1,	31-1,	32-1, 	1-1,
  };
+ #endif
  
  /* the P permutation, adjusted to zero based subscripts */
+ #ifdef WANT_P_TABLE
  static	char	P[] = {
  	16-1,	 7-1,	20-1,	21-1,	
  	29-1,	12-1,	28-1,	17-1,	
***************
*** 60,105 ****
  	19-1,	13-1,	30-1,	 6-1,	
  	22-1,	11-1,	 4-1,	25-1,	
  };
  
  /* S tables, original form */
  static	char	S[8][64] = {
! 	14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7,
  	 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8,
  	 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0,
! 	15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13,
  
! 	15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10,
  	 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5,
  	 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15,
! 	13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9,
  
! 	10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8,
  	13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1,
  	13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7,
! 	 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12,
  
! 	 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15,
  	13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9,
  	10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4,
! 	 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14,
  
! 	 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9,
  	14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6,
  	 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14,
! 	11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3,
  
! 	12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11,
  	10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8,
  	 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6,
! 	 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13,
  
! 	 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1,
  	13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6,
  	 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2,
! 	 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12,
  
! 	13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7,
  	 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2,
  	 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8,
! 	 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11,
  };
--- 67,115 ----
  	19-1,	13-1,	30-1,	 6-1,	
  	22-1,	11-1,	 4-1,	25-1,	
  };
+ #endif
  
  /* S tables, original form */
+ #ifdef WANT_S_TABLE
  static	char	S[8][64] = {
! {	14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7,
  	 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8,
  	 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0,
! 	15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13, },
  
! {	15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10,
  	 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5,
  	 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15,
! 	13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9, },
  
! {	10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8,
  	13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1,
  	13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7,
! 	 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12, },
  
! {	 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15,
  	13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9,
  	10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4,
! 	 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14, },
  
! {	 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9,
  	14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6,
  	 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14,
! 	11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3, },
  
! {	12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11,
  	10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8,
  	 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6,
! 	 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13, },
  
! {	 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1,
  	13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6,
  	 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2,
! 	 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12, },
  
! {	13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7,
  	 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2,
  	 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8,
! 	 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11 }
  };
+ #endif
Index: openafs/src/des/util.c
diff -c openafs/src/des/util.c:1.1 openafs/src/des/util.c:1.1.6.1
*** openafs/src/des/util.c:1.1	Fri Nov  3 21:26:39 2000
--- openafs/src/des/util.c	Mon Apr 23 03:37:36 2001
***************
*** 12,18 ****
  #include <sys/types.h>
  #include <des.h>
  
! des_cblock_print_file(x, fp)
      des_cblock *x;
      FILE *fp;
  {
--- 12,18 ----
  #include <sys/types.h>
  #include <des.h>
  
! int des_cblock_print_file(x, fp)
      des_cblock *x;
      FILE *fp;
  {
***************
*** 26,31 ****
--- 26,33 ----
  	    fprintf(fp,", ");
      }
      fprintf(fp," }");
+ 
+ 	return(0);
  }
  
  #ifdef DEBUG
Index: openafs/src/des/weak_key.c
diff -c openafs/src/des/weak_key.c:1.1 openafs/src/des/weak_key.c:1.1.6.1
*** openafs/src/des/weak_key.c:1.1	Fri Nov  3 21:26:40 2000
--- openafs/src/des/weak_key.c	Mon Apr 23 03:37:36 2001
***************
*** 12,17 ****
--- 12,18 ----
   * Originally written 8/85 by Steve Miller, MIT Project Athena.
   */
  
+ #include <string.h>
  #include <des.h>
  #include "des_internal.h"
  
Index: openafs/src/des/test/testit.c
diff -c openafs/src/des/test/testit.c:1.1 openafs/src/des/test/testit.c:1.1.6.1
*** openafs/src/des/test/testit.c:1.1	Fri Nov  3 21:26:44 2000
--- openafs/src/des/test/testit.c	Mon Apr 23 02:26:11 2001
***************
*** 30,37 ****
  extern int des_cbc_encrypt();
  extern int des_pcbc_encrypt();
  
- #include "../../permit_xprt.h"
- 
  char *progname;
  int sflag;
  int vflag;
--- 30,35 ----
Index: openafs/src/des/test/verify.c
diff -c openafs/src/des/test/verify.c:1.1 openafs/src/des/test/verify.c:1.1.6.1
*** openafs/src/des/test/verify.c:1.1	Fri Nov  3 21:26:45 2000
--- openafs/src/des/test/verify.c	Mon Apr 23 02:26:12 2001
***************
*** 27,34 ****
  extern int des_ecb_encrypt();
  extern int des_cbc_encrypt();
  
- #include "../../permit_xprt.h"
- 
  char *progname;
  int nflag = 2;
  int vflag;
--- 27,32 ----
Index: openafs/src/des_stub/Makefile
diff -c openafs/src/des_stub/Makefile:1.2 openafs/src/des_stub/Makefile:1.2.2.1
*** openafs/src/des_stub/Makefile:1.2	Sat Nov  4 05:04:27 2000
--- openafs/src/des_stub/Makefile	Mon Apr 23 00:05:20 2001
***************
*** 14,20 ****
  
  RM     = /bin/rm
  UKERNELDIR=../libuafs/
- INSTALL=${SRCDIR}bin/install
  SRC    =.
  DESPAR =../../../DESLIB/dest/
  DESINC =${DESPAR}include/
--- 14,19 ----
Index: openafs/src/dir/Makefile
diff -c openafs/src/dir/Makefile:1.2 openafs/src/dir/Makefile:1.2.2.1
*** openafs/src/dir/Makefile:1.2	Sat Nov  4 05:04:27 2000
--- openafs/src/dir/Makefile	Mon Apr 23 00:05:26 2001
***************
*** 11,17 ****
  
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
- INSTALL = ${SRCDIR}bin/install
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
  INCDIRS= -I${DESTDIR}include ${XINCLS}
--- 11,16 ----
Index: openafs/src/dir/dir.c
diff -c openafs/src/dir/dir.c:1.2 openafs/src/dir/dir.c:1.2.2.1
*** openafs/src/dir/dir.c:1.2	Sat Nov  4 05:04:27 2000
--- openafs/src/dir/dir.c	Mon Apr 23 03:29:20 2001
***************
*** 20,26 ****
  #include "../h/errno.h"
  #endif
  #include "../h/time.h"
! #if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV)
  #include "../h/errno.h"
  #else
  #if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV)
--- 20,26 ----
  #include "../h/errno.h"
  #endif
  #include "../h/time.h"
! #if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV)
  #include "../h/errno.h"
  #else
  #if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV)
***************
*** 31,36 ****
--- 31,43 ----
  #include "../afs/sysincludes.h"
  #endif
  #ifndef AFS_SGI64_ENV
+ #if defined(AFS_FBSD_ENV)
+ #include "../h/lock.h"
+ #include "../vm/vm.h"
+ #include "../vm/vm_extern.h"
+ #include "../vm/pmap.h"
+ #include "../vm/vm_map.h"
+ #endif /* AFS_FBSD_ENV */
  #include "../h/user.h"
  #endif /* AFS_SGI64_ENV */
  #include "../h/uio.h"
Index: openafs/src/export/Makefile
diff -c openafs/src/export/Makefile:1.2.2.1 openafs/src/export/Makefile:1.2.2.2
*** openafs/src/export/Makefile:1.2.2.1	Tue Mar  6 17:28:37 2001
--- openafs/src/export/Makefile	Mon Apr 23 00:05:31 2001
***************
*** 13,19 ****
  COMPONENT=export
  include ../config/Makefile.${SYS_NAME}
  
-   INSTALL = ${SRCDIR}bin/install
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
       DEFS =
--- 13,18 ----
Index: openafs/src/fsint/Makefile
diff -c openafs/src/fsint/Makefile:1.2 openafs/src/fsint/Makefile:1.2.2.1
*** openafs/src/fsint/Makefile:1.2	Sat Nov  4 05:04:30 2000
--- openafs/src/fsint/Makefile	Mon Apr 23 00:05:36 2001
***************
*** 10,16 ****
  SHELL = /bin/sh
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
- INSTALL = ${SRCDIR}bin/install
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
  OBJS=afsaux.o afscbint.cs.o afscbint.ss.o afscbint.xdr.o afsint.cs.o afsint.ss.o afsint.xdr.o
--- 10,15 ----
Index: openafs/src/fsint/afsaux.c
diff -c openafs/src/fsint/afsaux.c:1.2 openafs/src/fsint/afsaux.c:1.2.2.1
*** openafs/src/fsint/afsaux.c:1.2	Sat Nov  4 05:04:30 2000
--- openafs/src/fsint/afsaux.c	Mon Apr 23 00:05:36 2001
***************
*** 16,22 ****
  #include "../afs/afsincludes.h"
  #include "../rx/xdr.h"
  #else /* defined(UKERNEL) */
! #if defined(AFS_ALPHA_ENV) || defined(AFS_LINUX20_ENV)
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
  #else
--- 16,22 ----
  #include "../afs/afsincludes.h"
  #include "../rx/xdr.h"
  #else /* defined(UKERNEL) */
! #if defined(AFS_ALPHA_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
  #else
***************
*** 57,68 ****
  /* these things are defined in R (but not RX's) library.  For now, we add them
      only for the kernel system.  Later, when R is expunged, we'll remove the ifdef */
  #ifdef KERNEL
  #ifdef	AFS_AIXNFS11
  #define	AUTH_DES 1
  #endif
  #if (defined(AFS_AIX_ENV) && !defined(AUTH_DES)) || (!defined(AFS_SUN_ENV)) && !defined(AFS_SGI_ENV) && !defined(AFS_ALPHA_ENV) && !defined(AFS_SUN5_ENV)
  #ifndef	AFS_AIX32_ENV
! #if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV)
  /*
   * XDR chars; from user mode xdr package.
   */
--- 57,69 ----
  /* these things are defined in R (but not RX's) library.  For now, we add them
      only for the kernel system.  Later, when R is expunged, we'll remove the ifdef */
  #ifdef KERNEL
+ #ifndef AFS_USR_DARWIN_ENV
  #ifdef	AFS_AIXNFS11
  #define	AUTH_DES 1
  #endif
  #if (defined(AFS_AIX_ENV) && !defined(AUTH_DES)) || (!defined(AFS_SUN_ENV)) && !defined(AFS_SGI_ENV) && !defined(AFS_ALPHA_ENV) && !defined(AFS_SUN5_ENV)
  #ifndef	AFS_AIX32_ENV
! #if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
  /*
   * XDR chars; from user mode xdr package.
   */
***************
*** 145,150 ****
--- 146,152 ----
  	}
  	return(TRUE);	
  }
+ #endif
  #endif /* KERNEL */
  
  #ifndef KERNEL
Index: openafs/src/fsprobe/Makefile
diff -c openafs/src/fsprobe/Makefile:1.2 openafs/src/fsprobe/Makefile:1.2.2.1
*** openafs/src/fsprobe/Makefile:1.2	Sat Nov  4 05:04:30 2000
--- openafs/src/fsprobe/Makefile	Mon Apr 23 00:05:42 2001
***************
*** 12,19 ****
  COMPONENT=fsprobe
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
- 
  CFLAGS=-g -I. \
  	-I${SRCDIR}include \
  	-I${SRCDIR}include/afs \
--- 12,17 ----
Index: openafs/src/gtx/Makefile
diff -c openafs/src/gtx/Makefile:1.2 openafs/src/gtx/Makefile:1.2.2.1
*** openafs/src/gtx/Makefile:1.2	Sat Nov  4 05:04:31 2000
--- openafs/src/gtx/Makefile	Mon Apr 23 00:05:47 2001
***************
*** 12,18 ****
  COMPONENT=gtx
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET=$(SRCDIR)bin/compile_et
  CFLAGS= ${DBUG} -I. -I${SRCDIR}include -I${SRCDIR}include/afs ${XCFLAGS}
  LDFLAGS = ${XLDFLAGS}
--- 12,17 ----
Index: openafs/src/gtx/curseswindows.c
diff -c openafs/src/gtx/curseswindows.c:1.2 openafs/src/gtx/curseswindows.c:1.2.2.1
*** openafs/src/gtx/curseswindows.c:1.2	Sat Nov  4 05:04:32 2000
--- openafs/src/gtx/curseswindows.c	Mon Apr 23 00:05:47 2001
***************
*** 754,761 ****
--- 754,766 ----
      struct gator_cursesgwin *cwp;	/*Curses-specific data*/
  
      cwp = (struct gator_cursesgwin *)(gwp->w_data);
+ #ifdef AFS_DARWIN_ENV
+     aparms->maxx = cwp->wp->maxx;
+     aparms->maxy = cwp->wp->maxy;
+ #else
      aparms->maxx = cwp->wp->_maxx;
      aparms->maxy = cwp->wp->_maxy;
+ #endif
  
      return(0);
  
Index: openafs/src/inetd/Makefile
diff -c openafs/src/inetd/Makefile:1.1 openafs/src/inetd/Makefile:1.1.6.1
*** openafs/src/inetd/Makefile:1.1	Fri Nov  3 21:27:09 2000
--- openafs/src/inetd/Makefile	Mon Apr 23 00:05:52 2001
***************
*** 4,10 ****
  
  INCLUDES = -I${DESTDIR}include
  DEFINES = ${INCLUDES}
- INSTALL = ${DESTDIR}bin/install
  LIBDIR = ${DESTDIR}lib/
  AFSLIBS =  ${LIBDIR}afs/libkauth.a ${LIBDIR}libubik.a\
  		   ${LIBDIR}afs/libauth.a ${LIBDIR}afs/libsys.a \
--- 4,9 ----
Index: openafs/src/kauth/Makefile
diff -c openafs/src/kauth/Makefile:1.2 openafs/src/kauth/Makefile:1.2.2.2
*** openafs/src/kauth/Makefile:1.2	Sat Nov  4 05:04:36 2000
--- openafs/src/kauth/Makefile	Mon Apr 23 02:26:17 2001
***************
*** 13,25 ****
  include ../config/Makefile.${SYS_NAME}
  
  UKERNELDIR = ../libuafs/
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET = ${SRCDIR}bin/compile_et
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
  CFLAGS = ${OPTMZ} -I${SRCDIR}include ${XCFLAGS}
  LDFLAGS = ${OPTMZ} ${XLDFLAGS}
- PE = ../permit_xprt.h
  INCLS=${SRCDIR}include/ubik.h \
               ${SRCDIR}include/lwp.h \
               ${SRCDIR}include/lock.h  \
--- 13,23 ----
***************
*** 94,103 ****
  # tightly controlled.
  #	${CC} ${CFLAGS} -c kaprocs.c -DSPECIAL=1 -DGETPASSWORD
  
! kaprocs.o: kaprocs.c ${INCLS} ${PE} kaport.h
  	${CC} ${CFLAGS} -c kaprocs.c -DSPECIAL=1
  
! authclient.o: authclient.c ${INCLS} ${PE}
  
  
  #authserver.o: authserver.c ${INCLS}
--- 92,101 ----
  # tightly controlled.
  #	${CC} ${CFLAGS} -c kaprocs.c -DSPECIAL=1 -DGETPASSWORD
  
! kaprocs.o: kaprocs.c ${INCLS} kaport.h
  	${CC} ${CFLAGS} -c kaprocs.c -DSPECIAL=1
  
! authclient.o: authclient.c ${INCLS}
  
  
  #authserver.o: authserver.c ${INCLS}
***************
*** 190,197 ****
  	${CC} ${LDFLAGS} -o kpwvalid kpwvalid.o ${LIBS} ${XLIBS}
  
  user.krb.o: user.c ${INCLS} ${SRCDIR}include/afs/vice.h
! 	${CC} ${CFLAGS} -DAFS_KERBEROS_ENV -c user.c
! 	mv user.o user.krb.o
  
  user.o: user.c ${INCLS} ${SRCDIR}include/afs/vice.h
  	${CC} ${CFLAGS} -c user.c
--- 188,194 ----
  	${CC} ${LDFLAGS} -o kpwvalid kpwvalid.o ${LIBS} ${XLIBS}
  
  user.krb.o: user.c ${INCLS} ${SRCDIR}include/afs/vice.h
! 	${CC} ${CFLAGS} -DAFS_KERBEROS_ENV -c user.c -o user.krb.o
  
  user.o: user.c ${INCLS} ${SRCDIR}include/afs/vice.h
  	${CC} ${CFLAGS} -c user.c
***************
*** 201,207 ****
  kdb.o: kdb.c AFS_component_version_number.o
  
  krb_udp.o: krb_udp.c kaserver.h kautils.h kauth.h prot.h \
! 	   ${SRCDIR}include/lwp.h ${PE} AFS_component_version_number.o
  
  krb_udp: krb_udp.o libkauth.a
  	${CC} ${LDFLAGS} -o krb_udp krb_udp.o libkauth.a ${SRCDIR}lib/liblwp.a ${deslib} ${rxkadlib} ${SRCDIR}lib/afs/libcom_err.a ${utilib} ${auditlib}
--- 198,204 ----
  kdb.o: kdb.c AFS_component_version_number.o
  
  krb_udp.o: krb_udp.c kaserver.h kautils.h kauth.h prot.h \
! 	   ${SRCDIR}include/lwp.h AFS_component_version_number.o
  
  krb_udp: krb_udp.o libkauth.a
  	${CC} ${LDFLAGS} -o krb_udp krb_udp.o libkauth.a ${SRCDIR}lib/liblwp.a ${deslib} ${rxkadlib} ${SRCDIR}lib/afs/libcom_err.a ${utilib} ${auditlib}
Index: openafs/src/kauth/admin_tools.c
diff -c openafs/src/kauth/admin_tools.c:1.2.2.1 openafs/src/kauth/admin_tools.c:1.2.2.2
*** openafs/src/kauth/admin_tools.c:1.2.2.1	Wed Dec 13 16:49:30 2000
--- openafs/src/kauth/admin_tools.c	Mon Apr 23 02:11:32 2001
***************
*** 707,712 ****
--- 707,719 ----
      ka_PrintBytes ((char *)&key, sizeof(key));
      printf ("'.\n");
  
+     des_string_to_key (as->parms[0].items->data, &key);
+       
+     printf ("Converting %s with the DES string to key yields key='",
+ 	    as->parms[0].items->data);
+     ka_PrintBytes (&key, sizeof(key));
+     printf ("'.\n");
+ 
      return 0;
  }
  
***************
*** 1329,1334 ****
--- 1336,1346 ----
  	  ka_StringToKey (passwd, cell, &key);
  	  code = ka_GetAdminToken (name, instance, cell, &key, KA_SIXHOURS,
  				   &token, 0/* !new */);
+ 	  if (code == KABADREQUEST) {
+ 	      des_string_to_key (passwd, &key);
+ 	      code = ka_GetAdminToken (name, instance, cell, &key, KA_SIXHOURS,
+ 				       &token, 0/* !new */);
+ 	  }
  	  if ((code == KABADREQUEST) && (strlen(passwd) > 8)) {
  	     /* try with only the first 8 characters incase they set
  	      * their password with an old style passwd program. */
Index: openafs/src/kauth/authclient.c
diff -c openafs/src/kauth/authclient.c:1.2 openafs/src/kauth/authclient.c:1.2.2.1
*** openafs/src/kauth/authclient.c:1.2	Sat Nov  4 05:04:36 2000
--- openafs/src/kauth/authclient.c	Mon Apr 23 02:26:17 2001
***************
*** 43,49 ****
  #include "../afs/kautils.h"
  #include "../afs/pthread_glock.h"
  
- #include "../afs/permit_xprt.h"
  #else /* defined(UKERNEL) */
  #include <afs/param.h>
  #include <afs/stds.h>
--- 43,48 ----
***************
*** 63,70 ****
  #include <afs/afsutil.h>
  #include "kauth.h"
  #include "kautils.h"
- 
- #include "../permit_xprt.h"
  #endif /* defined(UKERNEL) */
  
  
--- 62,67 ----
Index: openafs/src/kauth/client.c
diff -c openafs/src/kauth/client.c:1.3 openafs/src/kauth/client.c:1.3.2.1
*** openafs/src/kauth/client.c:1.3	Sat Nov  4 21:21:42 2000
--- openafs/src/kauth/client.c	Mon Apr 23 02:26:17 2001
***************
*** 7,19 ****
   * directory or online at http://www.openafs.org/dl/license10.html
   */
  
- /*
-  * Revision 2.2  90/08/20  11:15:39
-  * Include permit_xprt.h.
-  * Cleanup line length.
-  *  */
- /* See RCS log for older history. */
- 
  #if defined(UKERNEL)
  #include "../afs/param.h"
  #include "../afs/sysincludes.h"
--- 7,12 ----
***************
*** 28,34 ****
  #include "../afs/pthread_glock.h"
  #include "../des/des.h"
  
- #include "../afs/permit_xprt.h"
  #else /* defined(UKERNEL) */
  #include <afs/param.h>
  #include <afs/stds.h>
--- 21,26 ----
***************
*** 43,50 ****
  #include <afs/afsutil.h>
  #include "kauth.h"
  #include "kautils.h"
- 
- #include "../permit_xprt.h"
  #endif /* defined(UKERNEL) */
  
  
--- 35,40 ----
Index: openafs/src/kauth/kaprocs.c
diff -c openafs/src/kauth/kaprocs.c:1.2.2.1 openafs/src/kauth/kaprocs.c:1.2.2.2
*** openafs/src/kauth/kaprocs.c:1.2.2.1	Wed Dec 13 16:49:31 2000
--- openafs/src/kauth/kaprocs.c	Mon Apr 23 02:26:18 2001
***************
*** 41,49 ****
  #include "kaport.h"
  #include "afs/audit.h"
  
- #include "../permit_xprt.h"
- 
- 
  extern struct ubik_dbase *KA_dbase;
  struct kaheader cheader;
  Date		cheaderReadTime;	/* time cheader last read in */
--- 41,46 ----
Index: openafs/src/kauth/kaserver.c
diff -c openafs/src/kauth/kaserver.c:1.2.2.1 openafs/src/kauth/kaserver.c:1.2.2.3
*** openafs/src/kauth/kaserver.c:1.2.2.1	Tue Mar  6 16:49:42 2001
--- openafs/src/kauth/kaserver.c	Mon Apr 23 03:29:24 2001
***************
*** 63,69 ****
  int npwSums = KA_NPWSUMS;               /* needs to be variable sometime */
  
  #include <stdarg.h>
! #if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
  #undef vfprintf
  #define vfprintf(stream,fmt,args) _doprnt(fmt,args,stream)
  #endif
--- 63,69 ----
  int npwSums = KA_NPWSUMS;               /* needs to be variable sometime */
  
  #include <stdarg.h>
! #if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #undef vfprintf
  #define vfprintf(stream,fmt,args) _doprnt(fmt,args,stream)
  #endif
Index: openafs/src/kauth/kautils.c
diff -c openafs/src/kauth/kautils.c:1.2 openafs/src/kauth/kautils.c:1.2.2.2
*** openafs/src/kauth/kautils.c:1.2	Sat Nov  4 05:04:39 2000
--- openafs/src/kauth/kautils.c	Mon Apr 23 02:26:18 2001
***************
*** 42,51 ****
  #include "kauth.h"
  #include "kautils.h"
  
- #include "../permit_xprt.h"
  
- 
- 
  /* This should match the behavior of ParseLoginName on input so that the output
   * and input are compatible.  In names "." should show as \056 and in names and
   * instances "@" should show as \100 */
--- 42,48 ----
***************
*** 184,195 ****
    afs_int32 tlen)
  {
      char tbuffer[32]; /* need at least 26 bytes */
  
      if (!time) strcpy (tstr, "no date");/* special case this */
      else if (time == NEVERDATE) strcpy(tstr, "never");
      else {
  	strncpy(tstr,
! 		afs_ctime((time_t *)&time, tbuffer, sizeof(tbuffer)), tlen);
  	tstr[strlen(tstr)-1] = '\0';	/* punt the newline character */
      }
  }
--- 181,194 ----
    afs_int32 tlen)
  {
      char tbuffer[32]; /* need at least 26 bytes */
+     time_t passtime; /* modern systems have 64 bit time */
  
      if (!time) strcpy (tstr, "no date");/* special case this */
      else if (time == NEVERDATE) strcpy(tstr, "never");
      else {
+ 	passtime = time;
  	strncpy(tstr,
! 		afs_ctime(&passtime, tbuffer, sizeof(tbuffer)), tlen);
  	tstr[strlen(tstr)-1] = '\0';	/* punt the newline character */
      }
  }
Index: openafs/src/kauth/klogin.c
diff -c openafs/src/kauth/klogin.c:1.2 openafs/src/kauth/klogin.c:1.2.2.2
*** openafs/src/kauth/klogin.c:1.2	Sat Nov  4 05:04:40 2000
--- openafs/src/kauth/klogin.c	Mon Apr 23 03:29:25 2001
***************
*** 29,35 ****
   * login -h hostname (for telnetd, etc.)
   */
  #include <afs/param.h>
! #if !defined(AFS_SUN_ENV) && !defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV)
  #include <sys/param.h>
  
  #define quota(a,b,c,d) 0
--- 29,35 ----
   * login -h hostname (for telnetd, etc.)
   */
  #include <afs/param.h>
! #if !defined(AFS_SUN_ENV) && !defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) &&!defined(AFS_FBSD_ENV)
  #include <sys/param.h>
  
  #define quota(a,b,c,d) 0
Index: openafs/src/kauth/kpasswd.c
diff -c openafs/src/kauth/kpasswd.c:1.2 openafs/src/kauth/kpasswd.c:1.2.2.1
*** openafs/src/kauth/kpasswd.c:1.2	Sat Nov  4 05:04:41 2000
--- openafs/src/kauth/kpasswd.c	Mon Apr 23 02:11:34 2001
***************
*** 198,204 ****
--- 198,206 ----
  
      struct ubik_client *conn = 0;
      struct ktc_encryptionKey key;
+     struct ktc_encryptionKey mitkey;
      struct ktc_encryptionKey newkey;
+     struct ktc_encryptionKey newmitkey;
  
      struct ktc_token    token;
  
***************
*** 211,216 ****
--- 213,225 ----
      int	foundPassword =	0;		/*Not yet, anyway*/
      int	foundNewPassword = 0;		/*Not yet, anyway*/
      int	foundExplicitCell = 0;		/*Not yet, anyway*/
+ #ifdef DEFAULT_MITV4_STRINGTOKEY
+     int dess2k = 1;
+ #elif DEFAULT_AFS_STRINGTOKEY
+     int dess2k = 0;
+ #else
+     int dess2k = -1;
+ #endif
  
      /* blow away command line arguments */
      for (i=1; i<zero_argc; i++) bzero (zero_argv[i], strlen(zero_argv[i]));
***************
*** 352,357 ****
--- 361,367 ----
  	    code = read_pass (passwd, sizeof(passwd), "Old password: ", 0);
  	    if (code || (strlen (passwd) == 0)) {
  		if (code) code = KAREADPW;
+ 		bzero (&mitkey, sizeof(mitkey));
  		bzero (&key, sizeof(key));
  		bzero (passwd, sizeof(passwd));
  		if (code) com_err (rn, code, "reading password");
***************
*** 360,365 ****
--- 370,376 ----
  	}
      } 
      ka_StringToKey (passwd, realm, &key);
+     des_string_to_key(passwd, &mitkey);
      give_to_child(passwd);
  
      /* Get new password if it wasn't provided. */
***************
*** 407,412 ****
--- 418,424 ----
  	npasswd[8] = 0;	/* in case the password was exactly 8 chars long */
  #endif
      ka_StringToKey (npasswd, realm, &newkey);
+     des_string_to_key(npasswd, &newmitkey);
      bzero (npasswd, sizeof(npasswd));
  
      if (lexplicit) ka_ExplicitCell (realm, serverList);
***************
*** 422,447 ****
  
      code = ka_GetAdminToken (pw->pw_name, instance, realm,
  			     &key, ADMIN_LIFETIME, &token, /*!new*/0);
! 
!     if ((code == KABADREQUEST) && (strlen (passwd) > 8)) {
! 	/* try with only the first 8 characters incase they set their password
!          * with an old style passwd program. */
! 	char pass8[9];
! 	strncpy (pass8, passwd, 8);
! 	pass8[8] = 0;
! 	ka_StringToKey (pass8, realm, &key);
! 	bzero (pass8, sizeof(pass8));
! 	bzero (passwd, sizeof(passwd));
  	code = ka_GetAdminToken (pw->pw_name, instance, realm,
! 				 &key, ADMIN_LIFETIME, &token, /*!new*/0);
  #ifdef notdef
! 	/* the folks in testing really *hate* this message */
! 	if (code == 0) {
! 	    fprintf (stderr, "Warning: only the first 8 characters of your old password were significant.\n");
! 	}
  #endif
!     }	
  
      bzero (&key, sizeof(key));
      if (code == KAUBIKCALL) com_err (rn, code, "(Authentication Server unavailable, try later)");
      else if (code) {
--- 434,473 ----
  
      code = ka_GetAdminToken (pw->pw_name, instance, realm,
  			     &key, ADMIN_LIFETIME, &token, /*!new*/0);
!     if (code == KABADREQUEST) {
  	code = ka_GetAdminToken (pw->pw_name, instance, realm,
! 				 &mitkey, ADMIN_LIFETIME, &token, /*!new*/0);
! 	if ((code == KABADREQUEST) && (strlen (passwd) > 8)) {
! 	    /* try with only the first 8 characters incase they set their password
! 	     * with an old style passwd program. */
! 	    char pass8[9];
! 	    strncpy (pass8, passwd, 8);
! 	    pass8[8] = 0;
! 	    ka_StringToKey (pass8, realm, &key);
! 	    bzero (pass8, sizeof(pass8));
! 	    bzero (passwd, sizeof(passwd));
! 	    code = ka_GetAdminToken (pw->pw_name, instance, realm,
! 				     &key, ADMIN_LIFETIME, &token, /*!new*/0);
  #ifdef notdef
! 	    /* the folks in testing really *hate* this message */
! 	    if (code == 0) {
! 		fprintf (stderr, "Warning: only the first 8 characters of your old password were significant.\n");
! 	    }
  #endif
! 	    if (code == 0) {
! 		if (dess2k == -1)
! 		    dess2k=0;
! 	    }
! 	} else {
! 	    if (dess2k == -1)
! 		dess2k=1;
! 	}
!     } else {
! 	if (dess2k == -1)
! 	    dess2k=0;
!     } 
  
+     bzero (&mitkey, sizeof(mitkey));
      bzero (&key, sizeof(key));
      if (code == KAUBIKCALL) com_err (rn, code, "(Authentication Server unavailable, try later)");
      else if (code) {
***************
*** 454,461 ****
  	code = ka_AuthServerConn (realm, KA_MAINTENANCE_SERVICE, &token, &conn);
  	if (code) com_err (rn, code, "contacting Admin Server");
  	else {
! 	    code = ka_ChangePassword (pw->pw_name, instance, conn, 0, &newkey);
  	    bzero (&newkey, sizeof(newkey));
  	    if (code) {
  	      char * reason;
  	      reason = (char *) error_message(code);
--- 480,491 ----
  	code = ka_AuthServerConn (realm, KA_MAINTENANCE_SERVICE, &token, &conn);
  	if (code) com_err (rn, code, "contacting Admin Server");
  	else {
! 	    if (dess2k == 1)
! 		code = ka_ChangePassword (pw->pw_name, instance, conn, 0, &newmitkey);
! 	    else
! 		code = ka_ChangePassword (pw->pw_name, instance, conn, 0, &newkey);
  	    bzero (&newkey, sizeof(newkey));
+ 	    bzero (&newmitkey, sizeof(newmitkey));
  	    if (code) {
  	      char * reason;
  	      reason = (char *) error_message(code);
***************
*** 465,470 ****
--- 495,501 ----
  	}
      }
      bzero (&newkey, sizeof(newkey));
+     bzero (&newmitkey, sizeof(newmitkey));
  
      /* Might need to close down the ubik_Client connection */
      if (conn) {
Index: openafs/src/kauth/krb_udp.c
diff -c openafs/src/kauth/krb_udp.c:1.2.2.4 openafs/src/kauth/krb_udp.c:1.2.2.6
*** openafs/src/kauth/krb_udp.c:1.2.2.4	Tue Mar  6 17:25:31 2001
--- openafs/src/kauth/krb_udp.c	Mon Apr 23 02:26:19 2001
***************
*** 41,49 ****
  #include "afs/audit.h"
  #include "kalog.h"
  
- #include "../permit_xprt.h"
- 
- 
  /* my kerberos error codes */
  #define KERB_ERR_BAD_MSG_TYPE  99
  #define KERB_ERR_BAD_LIFETIME  98
--- 41,46 ----
***************
*** 446,452 ****
        code = KERB_ERR_PKT_VER;	/* was KABADTICKET */
        goto abort;
      }
!     if (celllen == 0) strcpy (cell, lrealm);
  
      if (krb_udp_debug) {
  	printf ("UGetTicket: got ticket from '%s'.'%s'@'%s'\n",
--- 443,452 ----
        code = KERB_ERR_PKT_VER;	/* was KABADTICKET */
        goto abort;
      }
!     if (celllen == 0) {
! 	strncpy (cell, lrealm, MAXKTCREALMLEN-1);
! 	cell[MAXKTCREALMLEN-1] = 0;
!     };
  
      if (krb_udp_debug) {
  	printf ("UGetTicket: got ticket from '%s'.'%s'@'%s'\n",
Index: openafs/src/kauth/user.c
diff -c openafs/src/kauth/user.c:1.2.2.1 openafs/src/kauth/user.c:1.2.2.2
*** openafs/src/kauth/user.c:1.2.2.1	Tue Mar  6 16:53:43 2001
--- openafs/src/kauth/user.c	Mon Apr 23 03:29:25 2001
***************
*** 179,185 ****
      }
  #endif
  
! #if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_USR_LINUX20_ENV)
      /* handle smoothly the case where no AFS system calls exists (yet) */
      old = (int (*)())signal(SIGSYS, SIG_IGN);
  #endif
--- 179,185 ----
      }
  #endif
  
! #if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_USR_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
      /* handle smoothly the case where no AFS system calls exists (yet) */
      old = (int (*)())signal(SIGSYS, SIG_IGN);
  #endif
Index: openafs/src/kauth/user_nt.c
diff -c openafs/src/kauth/user_nt.c:1.2 openafs/src/kauth/user_nt.c:1.2.2.1
*** openafs/src/kauth/user_nt.c:1.2	Sat Nov  4 05:04:42 2000
--- openafs/src/kauth/user_nt.c	Mon Apr 23 02:26:20 2001
***************
*** 23,29 ****
  #include <rx/rxkad.h>
  #include <crypt.h>
  #include <des.h>
- #include "../permit_xprt.h"
  
  int krb_add_host (struct sockaddr_in *server_list_p);
  static void krb_set_port(long port);
--- 23,28 ----
Index: openafs/src/libacl/Makefile
diff -c openafs/src/libacl/Makefile:1.2 openafs/src/libacl/Makefile:1.2.2.1
*** openafs/src/libacl/Makefile:1.2	Sat Nov  4 05:04:45 2000
--- openafs/src/libacl/Makefile	Mon Apr 23 00:06:06 2001
***************
*** 9,15 ****
  COMPONENT=libacl
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL = ${SRCDIR}bin/install
  INCDIRS= -I${DESTDIR}include -I.. -I${BACKDIR}include -I${DESTDIR}include/afs 
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
--- 9,14 ----
***************
*** 26,32 ****
  	rm -f libacl.a
  	ar rv libacl.a $(LIBOBJS) AFS_component_version_number.o
  	$(RANLIB) libacl.a
! 	
  aclprocs.o: aclprocs.c acl.h
  
  netprocs.o: netprocs.c acl.h
--- 25,31 ----
  	rm -f libacl.a
  	ar rv libacl.a $(LIBOBJS) AFS_component_version_number.o
  	$(RANLIB) libacl.a
! 
  aclprocs.o: aclprocs.c acl.h
  
  netprocs.o: netprocs.c acl.h
Index: openafs/src/libacl/aclprocs.c
diff -c openafs/src/libacl/aclprocs.c:1.2 openafs/src/libacl/aclprocs.c:1.2.2.1
*** openafs/src/libacl/aclprocs.c:1.2	Sat Nov  4 05:04:45 2000
--- openafs/src/libacl/aclprocs.c	Sun Apr 22 23:51:21 2001
***************
*** 248,260 ****
  	if (sscanf(nextc, "%s\t%d\n", lnames.namelist_val[i], &k) != 2)
  	    return(-1);
  	(*acl)->entries[i].rights = k;
! 	nextc = (char *) (1 + index(nextc, '\n'));
      }
      j=i;
      for (i = (*acl)->total - 1; i >= (*acl)->total -  (*acl)->negative; i--,j++) {
  	if (sscanf(nextc, "%s\t%d\n", lnames.namelist_val[j], &((*acl)->entries[j].rights)) != 2)
  	    return(-1);
! 	nextc = (char *) (1 + index(nextc, '\n'));
      }
      lids.idlist_len = 0;
      lids.idlist_val = 0;
--- 248,262 ----
  	if (sscanf(nextc, "%s\t%d\n", lnames.namelist_val[i], &k) != 2)
  	    return(-1);
  	(*acl)->entries[i].rights = k;
! 	nextc = (char *) (index(nextc, '\n'));
! 	nextc ++;       /* 1 + index can cast ptr to integer */
      }
      j=i;
      for (i = (*acl)->total - 1; i >= (*acl)->total -  (*acl)->negative; i--,j++) {
  	if (sscanf(nextc, "%s\t%d\n", lnames.namelist_val[j], &((*acl)->entries[j].rights)) != 2)
  	    return(-1);
! 	nextc = (char *) (index(nextc, '\n'));
! 	nextc ++;
      }
      lids.idlist_len = 0;
      lids.idlist_val = 0;
Index: openafs/src/libadmin/bos/afs_bosAdmin.c
diff -c openafs/src/libadmin/bos/afs_bosAdmin.c:1.2 openafs/src/libadmin/bos/afs_bosAdmin.c:1.2.2.1
*** openafs/src/libadmin/bos/afs_bosAdmin.c:1.2	Sat Nov  4 05:04:48 2000
--- openafs/src/libadmin/bos/afs_bosAdmin.c	Mon Apr 23 02:26:27 2001
***************
*** 23,29 ****
  #ifdef AFS_NT40_ENV
  #include <io.h>
  #endif
- #include "../../permit_xprt.h"
  
  
  /*
--- 23,28 ----
Index: openafs/src/libadmin/client/afs_clientAdmin.c
diff -c openafs/src/libadmin/client/afs_clientAdmin.c:1.2 openafs/src/libadmin/client/afs_clientAdmin.c:1.2.2.1
*** openafs/src/libadmin/client/afs_clientAdmin.c:1.2	Sat Nov  4 05:04:51 2000
--- openafs/src/libadmin/client/afs_clientAdmin.c	Mon Apr 23 02:26:34 2001
***************
*** 40,48 ****
  #include <afs/vlserver.h>
  #include <afs/pthread_glock.h>
  
- 
- #include "../../permit_xprt.h"
- 
  /*
   * AFS client administration functions.
   *
--- 40,45 ----
Index: openafs/src/libafs/Makefile.common
diff -c openafs/src/libafs/Makefile.common:1.2.2.1 openafs/src/libafs/Makefile.common:1.2.2.2
*** openafs/src/libafs/Makefile.common:1.2.2.1	Tue Mar  6 16:54:46 2001
--- openafs/src/libafs/Makefile.common	Mon Apr 23 00:06:11 2001
***************
*** 10,16 ****
  SHELL=/bin/sh
  DESTDIR = DEST/
  SRCDIR = DEST/
- INSTALL = $(DESTDIR)bin/install
  INCLUDE= -I.  -I/usr/include
  Aobj=COMMON
  Dobj=DYNEL
--- 10,15 ----
Index: openafs/src/libafs/Makefile.extradefs
diff -c /dev/null openafs/src/libafs/Makefile.extradefs:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:39 2001
--- openafs/src/libafs/Makefile.extradefs	Mon Apr 23 03:58:05 2001
***************
*** 0 ****
--- 1,8 ----
+ # 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
+ 
+ #Placeholder for extra definitions
Index: openafs/src/libafs/MakefileProto.DARWIN
diff -c /dev/null openafs/src/libafs/MakefileProto.DARWIN:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:39 2001
--- openafs/src/libafs/MakefileProto.DARWIN	Mon Apr 23 02:07:17 2001
***************
*** 0 ****
--- 1,115 ----
+ #/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */
+ # $Header: /usr1/cvs/openafs/src/libafs/MakefileProto.DARWIN,v 1.1.2.1 2001/04/23 06:07:17 shadow Exp $
+ # 
+ # MakefileProto for Digital Unix systems
+ #
+ 
+ DESTDIR=DEST/
+ include $(DESTDIR)../obj/config/Makefile.${SYS_NAME}
+ 
+ 
+ # OS specific object files:
+ AFS_OS_OBJS = \
+ 	osi_misc.o \
+ 	osi_file.o \
+ 	osi_inode.o \
+ 	osi_groups.o \
+ 	osi_sleep.o \
+ 	osi_vm.o \
+ 	osi_vnodeops.o \
+ 	osi_module.o \
+ 	xdr.o \
+ 	xdr_array.o
+ 
+ 
+ #AFS_OS_NFSOBJS = osi_vfsops_nfs.o
+ 
+ AFS_OS_NONFSOBJS = osi_vfsops.o
+ 
+ 
+ # System specific build commands and flags
+ KDEFS=
+ DBUG = -g
+ DEFINES= -D_KERNEL -DKERNEL -DKERNEL_PRIVATE -DDIAGNOSTIC -DUSE_SELECT -DMACH_USER_API -DMACH_KERNEL
+ OPTF=${OPT} 
+ OPTF2=${OPT2} 
+ KOPTS=-traditional-cpp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
+ #CFLAGS=-Werror-implicit-function-declaration -I. -I.. ${KINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
+ #CFLAGS=-framework Kernel -I. -I.. ${KINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
+ CFLAGS=-I. -I.. ${KINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
+ 
+ 
+ # Name of directory to hold object files and libraries.
+ KOBJ = MODLOAD
+ 
+ # This tells Makefile.common to use it's single directory build target.
+ COMPDIRS = single_compdir
+ 
+ include Makefile.common
+ 
+ setup:
+ 	-mkdir $(KOBJ)
+ 	-rm $(KOBJ)/Makefile $(KOBJ)/Makefile.common
+ 	ln -s ../Makefile $(KOBJ)/Makefile
+ 	ln -s ../Makefile.common $(KOBJ)/Makefile.common
+ 	-rm -f  h net netinet rpc ufs nfs  machine sys vm mach kern
+ 	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/net net
+ 	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/machine machine
+ 	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/netinet netinet
+ 	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/nfs nfs
+ 	-ln -s /usr/include/rpc rpc
+ 	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/sys sys
+ 	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/ufs ufs
+ 	-ln -s $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/sys h
+ 
+ 
+ # Below this line are targets when in the COMMON directory:
+ LIBAFS = libafs.o
+ LIBAFSNONFS = libafs.nonfs.o
+ 
+ DEST_LIBAFS = ${DESTDIR}/root.client/usr/vice/etc/afs.kext/Contents/MacOS/afs-nfs
+ DEST_LIBAFSNONFS = ${DESTDIR}/root.client/usr/vice/etc/afs.kext/Contents/MacOS/afs
+ 
+ 
+ libafs: $(DEST_LIBAFSNONFS) ;
+ 
+ 
+ $(DEST_LIBAFS): $(LIBAFS)
+ 	$(INSTALL) -f $? $@
+ 
+ $(DEST_LIBAFSNONFS): $(LIBAFSNONFS)
+ 	$(INSTALL) -f $? $@
+ 
+ ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
+ 	$(LD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS}
+ 
+ ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
+ 	$(LD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS}
+ 
+ 
+ # Object build rules:
+ osi_groups.o: $(AFS)/osi_groups.c
+ 	$(CRULE1)
+ osi_file.o: $(AFS)/osi_file.c
+ 	$(CRULE1)
+ osi_inode.o: $(AFS)/osi_inode.c
+ 	$(CRULE1)
+ osi_misc.o: $(AFS)/osi_misc.c
+ 	$(CRULE1)
+ osi_sleep.o: $(AFS)/osi_sleep.c
+ 	$(CRULE1)
+ osi_vfsops_nfs.o: $(AFS)/osi_vfsops.c
+ 	$(CRULE1) -o osi_vfsops_nfs.o
+ osi_vfsops.o: $(AFS)/osi_vfsops.c
+ 	$(CRULE1) -DAFS_NONFSTRANS
+ osi_vm.o: $(AFS)/osi_vm.c
+ 	$(CRULE1)
+ osi_vnodeops.o: $(AFS)/osi_vnodeops.c
+ 	$(CRULE1)
+ osi_module.o: $(AFS)/osi_module.c
+ 	$(CRULE1)
+ xdr.o: $(RX)/xdr.c
+ 	$(CRULE1);
+ xdr_array.o: $(RX)/xdr_array.c
+ 	$(CRULE1);
+ 
Index: openafs/src/libafs/MakefileProto.FBSD
diff -c /dev/null openafs/src/libafs/MakefileProto.FBSD:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:40 2001
--- openafs/src/libafs/MakefileProto.FBSD	Mon Apr 23 03:29:31 2001
***************
*** 0 ****
--- 1,112 ----
+ #/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */
+ #
+ # MakefileProto for Digital Unix systems
+ #
+ 
+ DESTDIR=DEST/
+ # include $(DESTDIR)/../obj/config/Makefile.${SYS_NAME}
+ 
+ 
+ # OS specific object files:
+ AFS_OS_OBJS = \
+ 	osi_groups.o \
+ 	osi_file.o \
+ 	osi_inode.o \
+ 	osi_misc.o \
+ 	osi_sleep.o \
+ 	osi_vm.o \
+ 	osi_vnodeops.o 
+ 
+ AFS_OS_NFSOBJS = \
+ 	osi_vfsops_nfs.o
+ 
+ AFS_OS_NONFSOBJS = \
+ 	osi_vfsops.o
+ 
+ 
+ # System specific build commands and flags
+ # KDEFS=-DLANGUAGE_C  -I/usr/sys/include -I../include \
+ # 	 -I/usr/src/sys/${HEADER_RT} -I/usr/src/sys/sys \
+ # 	-DSWAPTYPE=1 -DUERF -DOSF -DCOMPAT_43 -DUFS \
+ #	-DRT -DKERNEL -D_KERNEL
+ KDEFS=-Wall -fformat-extensions -ansi -nostdinc -I/usr/include -D_KERNEL \
+ 	-elf -mpreferred-stack-boundary=2 -I/usr/src/sys/sys -I../afs
+ DBUG = -O2
+ DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT
+ OPTF=${OPT} 
+ OPTF2=${OPT2} 
+ CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
+ 
+ 
+ # Name of directory to hold object files and libraries.
+ KOBJ = STATIC
+ 
+ # This tells Makefile.common to use it's single directory build target.
+ COMPDIRS = single_compdir
+ 
+ include Makefile.common
+ 
+ setup:
+ 	-mkdir $(KOBJ)
+ 	-rm $(KOBJ)/Makefile $(KOBJ)/Makefile.common
+ 	ln -s ../Makefile $(KOBJ)/Makefile
+ 	ln -s ../Makefile.common $(KOBJ)/Makefile.common
+ 	-rm -f  h net netinet rpc ufs nfs  machine sys vm
+ 	-ln -s /usr/src/sys/net net
+ 	-ln -s /usr/src/sys/i386/include machine
+ 	-ln -s /usr/src/sys/netinet netinet
+ 	-ln -s /usr/src/sys/nfs nfs
+ 	-ln -s /usr/include/rpc rpc
+ 	-ln -s /usr/src/sys/sys sys
+ 	-ln -s /usr/src/sys/ufs/ufs ufs
+ 	-ln -s /usr/src/sys/sys h
+ 	-ln -s /usr/src/sys/vm vm
+ 	-touch $(KOBJ)/sec_net.h
+ 
+ 
+ # Below this line are targets when in the COMMON directory:
+ LIBAFS = libafs.o
+ LIBAFSNONFS = libafs.nonfs.o
+ 
+ DEST_LIBAFS = ${DESTDIR}/root.client/bin/${LIBAFS}
+ DEST_LIBAFSNONFS = ${DESTDIR}/root.client/bin/${LIBAFSNONFS}
+ 
+ 
+ # libafs:	$(DEST_LIBAFS) $(DEST_LIBAFSNONFS)
+ # libafs:	$(DEST_LIBAFSNONFS)
+ libafs:
+ 	echo WARNING: No kernel module for ${SYS_NAME}
+ 
+ 
+ $(DEST_LIBAFS): $(LIBAFS)
+ 	$(INSTALL) -f $? $@
+ 
+ $(DEST_LIBAFSNONFS): $(LIBAFSNONFS)
+ 	$(INSTALL) -f $? $@
+ 
+ ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
+ 	$(LD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS}
+ 
+ ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
+ 	$(LD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS}
+ 
+ 
+ # Object build rules:
+ osi_groups.o: $(AFS)/osi_groups.c
+ 	$(CRULE1)
+ osi_file.o: $(AFS)/osi_file.c
+ 	$(CRULE1)
+ osi_inode.o: $(AFS)/osi_inode.c
+ 	$(CRULE1)
+ osi_misc.o: $(AFS)/osi_misc.c
+ 	$(CRULE1)
+ osi_sleep.o: $(AFS)/osi_sleep.c
+ 	$(CRULE1)
+ osi_vfsops_nfs.o: $(AFS)/osi_vfsops.c
+ 	$(CRULE1) -o osi_vfsops_nfs.o
+ osi_vfsops.o: $(AFS)/osi_vfsops.c
+ 	$(CRULE1) -DAFS_NONFSTRANS
+ osi_vm.o: $(AFS)/osi_vm.c
+ 	$(CRULE1)
+ osi_vnodeops.o: $(AFS)/osi_vnodeops.c
+ 	$(CRULE1)
Index: openafs/src/libafs/MakefileProto.HPUX
diff -c openafs/src/libafs/MakefileProto.HPUX:1.2 openafs/src/libafs/MakefileProto.HPUX:1.2.2.1
*** openafs/src/libafs/MakefileProto.HPUX:1.2	Sat Nov  4 05:05:04 2000
--- openafs/src/libafs/MakefileProto.HPUX	Mon Apr 23 02:16:18 2001
***************
*** 100,105 ****
--- 100,106 ----
  
  # Compile the clients.
  ${COMPDIRS}:
+ 	if false; then \
  	for b in $(BITS); do \
  	    for t in $(KOBJ); do \
  		dir=$$t.$$b; \
***************
*** 109,118 ****
  		64)	bopts="$(KDEFS_64)"; bsuff="64";; \
  		esac; \
  		cd $$dir; \
! 		$(MAKE) BITSUFFIX=$$bsuff CPU_KDEFS="$$bopts" DESTDIR=../${DESTDIR} libafs || exit $$?; \
  		cd ..; \
  	    done; \
! 	done
  
  
  # Below this line are targets when in the static directory:
--- 110,120 ----
  		64)	bopts="$(KDEFS_64)"; bsuff="64";; \
  		esac; \
  		cd $$dir; \
! 		$(MAKE) BITSUFFIX=$$bsuff CPU_KDEFS="$$bopts" DESTDIR=${DESTDIR} libafs || exit $$?; \
  		cd ..; \
  	    done; \
! 	done; \
! 	fi
  
  
  # Below this line are targets when in the static directory:
Index: openafs/src/libafs/MakefileProto.LINUX
diff -c openafs/src/libafs/MakefileProto.LINUX:1.3.2.6 openafs/src/libafs/MakefileProto.LINUX:1.3.2.12
*** openafs/src/libafs/MakefileProto.LINUX:1.3.2.6	Tue Mar  6 17:23:56 2001
--- openafs/src/libafs/MakefileProto.LINUX	Mon Apr 23 22:52:33 2001
***************
*** 38,48 ****
  # -Wall
  <i386_linux22 i386_linux24>
  CCFLAGS =   -O2 -fomit-frame-pointer \
! 	-fno-strength-reduce -pipe -m486 -malign-loops=2 -malign-jumps=2 \
  	-malign-functions=2
! DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
  <s390_linux22 s390_linux24>
! CCFLAGS =   -O2 -fomit-frame-pointer -fno-strength-reduce \
  	-fno-strict-aliasing -fsigned-char 
  DEFINES = -D__KERNEL__  -D__s390__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
  <sparc_linux22 sparc_linux24>
--- 38,51 ----
  # -Wall
  <i386_linux22 i386_linux24>
  CCFLAGS =   -O2 -fomit-frame-pointer \
! 	-fno-strength-reduce -pipe -march=i486 -malign-loops=2 -malign-jumps=2 \
  	-malign-functions=2
! DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} ${KDEFINES}
! <alpha_linux_22 alpha_linux_24>
! CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce -pipe -mno-fp-regs -ffixed-8
! DEFINES = -D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
  <s390_linux22 s390_linux24>
! CCFLAGS =   -O -fomit-frame-pointer -fno-strength-reduce \
  	-fno-strict-aliasing -fsigned-char 
  DEFINES = -D__KERNEL__  -D__s390__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
  <sparc_linux22 sparc_linux24>
***************
*** 70,75 ****
--- 73,81 ----
  KOBJ = MODLOAD
  MPS = MP SP
  
+ # To pick up anything we might have missed
+ include Makefile.extradefs
+ 
  # COMPDIRS is called in Makefile.common to do the actual builds.
  COMPDIRS=linux_compdirs
  
***************
*** 85,90 ****
--- 91,99 ----
  			mkdir -p $${KDIR}; \
  			ln -fs ../Makefile $${KDIR}/Makefile ; \
  			ln -fs ../Makefile.common $${KDIR}/Makefile.common; \
+ <i386_linux22 i386_linux24>
+ 			sh ./redhat.sh ${LINUX_SRCDIR}$$v $${KDIR}/Makefile.extradefs; \
+ <all>
  		done \
  	done
  	
***************
*** 108,115 ****
--- 117,128 ----
  		rm -f asm-generic; \
  		ln -s ${LINUX_SRCDIR}$$v/include/asm-generic asm-generic; \
  		rm -f asm; \
+ <alpha_linux_22 alpha_linux_24>
+ 		ln -s ${LINUX_SRCDIR}$$v/include/asm-alpha asm ; \
  <i386_linux22 i386_linux24>
  		ln -s ${LINUX_SRCDIR}$$v/include/asm-i386 asm ; \
+ <s390_linux22 s390_linux24>
+ 		ln -s ${LINUX_SRCDIR}$$v/include/asm-s390 asm ; \
  <ppc_linux22 ppc_linux24>
  		ln -s ${LINUX_SRCDIR}$$v/include/asm-ppc asm ; \
  <sparc_linux22 sparc_linux24>
***************
*** 121,134 ****
  			KDIR=${KOBJ}-$$v-$$m ; \
  			echo Building in directory: $${KDIR} ; \
  			if [ "$$m" = "MP" ] ; then \
! 				SMP_DEF="-DAFS_SMP" ; \
  				TARG="libafs.mp" ; \
  			else  \
! 				SMP_DEF="" ; \
  				TARG=libafs ; \
  			fi ; \
  			cd $${KDIR} ; \
! 			$(MAKE) DESTDIR=${DESTDIR} SMP_DEF=$${SMP_DEF} $${TARG} CLIENT=$$v || exit $$?; \
  			cd ../ ; \
  		done \
  	done
--- 134,147 ----
  			KDIR=${KOBJ}-$$v-$$m ; \
  			echo Building in directory: $${KDIR} ; \
  			if [ "$$m" = "MP" ] ; then \
! 				SMP_DEF="-DAFS_SMP -D__BOOT_KERNEL_SMP=1 -D__BOOT_KERNEL_UP=0 -D__SMP__" ; \
  				TARG="libafs.mp" ; \
  			else  \
! 				SMP_DEF="-D__BOOT_KERNEL_SMP=0 -D__BOOT_KERNEL_UP=1 -U__SMP__" ; \
  				TARG=libafs ; \
  			fi ; \
  			cd $${KDIR} ; \
! 			$(MAKE) DESTDIR=${DESTDIR} SMP_DEF="$${SMP_DEF}" $${TARG} CLIENT=$$v || exit $$?; \
  			cd ../ ; \
  		done \
  	done
Index: openafs/src/libafs/MakefileProto.SOLARIS
diff -c openafs/src/libafs/MakefileProto.SOLARIS:1.3.2.1 openafs/src/libafs/MakefileProto.SOLARIS:1.3.2.2
*** openafs/src/libafs/MakefileProto.SOLARIS:1.3.2.1	Fri Jan 19 04:12:13 2001
--- openafs/src/libafs/MakefileProto.SOLARIS	Mon Apr 23 03:02:38 2001
***************
*** 111,116 ****
--- 111,118 ----
  DEST_LIBAFS = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFS}
  DEST_LIBAFSNONFS = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFSNONFS}
  
+ # Without this line, gmake tries to build libafs.o
+ .PHONY: libafs
  
  # libafs:	$(DEST_LIBAFS) $(DEST_LIBAFSNONFS)
  libafs:	$(DEST_LIBAFSNONFS)
Index: openafs/src/libafs/redhat.sh
diff -c /dev/null openafs/src/libafs/redhat.sh:1.1.2.2
*** /dev/null	Wed Apr 25 02:16:40 2001
--- openafs/src/libafs/redhat.sh	Mon Apr 23 22:52:34 2001
***************
*** 0 ****
--- 1,24 ----
+ #!/bin/sh
+ # This is a bridge script until we take care of tightly linking Linux inode 
+ # internals to AFS vnode internals
+ 
+ IBYTES=""
+ SETATTR=""
+ 
+ if [ -e $1/include/linux/fs.h ] ; then
+ grep i_bytes $1/include/linux/fs.h > /dev/null
+ if [ $? = 0 ]; then
+ IBYTES="-DSTRUCT_INODE_HAS_I_BYTES=1"
+ fi
+ 
+ grep "extern int inode_setattr" $1/include/linux/fs.h > /dev/null
+ if [ $? = 0 ]; then
+ SETATTR="-DINODE_SETATTR_NOT_VOID=1"
+ fi
+ 
+ if [ -e $2 ] ; then
+ /bin/rm $2
+ fi
+ echo "KDEFINES = ${IBYTES} ${SETATTR}" > $2
+ fi
+ exit 0
Index: openafs/src/libafsauthent/Makefile
diff -c openafs/src/libafsauthent/Makefile:1.2 openafs/src/libafsauthent/Makefile:1.2.2.1
*** openafs/src/libafsauthent/Makefile:1.2	Sat Nov  4 05:05:04 2000
--- openafs/src/libafsauthent/Makefile	Mon Apr 23 00:06:15 2001
***************
*** 12,18 ****
  include ../config/Makefile.${SYS_NAME}
  
  CC=${MT_CC}
- INSTALL = ${SRCDIR}bin/install
  CFLAGS = ${OPTMZ} ${DBG} -I${SRCDIR}include ${MT_CFLAGS} 
  CCRULE = ${CC} ${CFLAGS} -c $?
  
--- 12,17 ----
Index: openafs/src/libafsrpc/Makefile
diff -c openafs/src/libafsrpc/Makefile:1.2.2.2 openafs/src/libafsrpc/Makefile:1.2.2.4
*** openafs/src/libafsrpc/Makefile:1.2.2.2	Tue Mar  6 16:38:45 2001
--- openafs/src/libafsrpc/Makefile	Mon Apr 23 03:29:36 2001
***************
*** 11,17 ****
  COMPONENT=libafsrpc
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL = ${SRCDIR}bin/install
  CC=${MT_CC}
  INCLUDES = -I${SRCDIR}include -I.. -I../rx
  CFLAGS = ${OPTMZ} ${DBG} ${INCLUDES} -DRXDEBUG ${MT_CFLAGS}
--- 11,16 ----
***************
*** 242,248 ****
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.2.2.2 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
--- 241,247 ----
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.2.2.4 $
  #
  # 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.
***************
*** 321,332 ****
  		/usr/ccs/lib/cpp  ${SFLAGS} ${SYS}/syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
  		rm syscall.ss;;				\
! 	 sgi_* ) \
                  ${CC} ${CFLAGS} -c ${SYS}/syscall.s;;          \
  	 alpha_dux?? ) \
  		${AS} -P ${CFLAGS} -D_NO_PROTO -DMACH -DOSF -nostdinc -traditional -DASSEMBLER ${SYS}/syscall.s; \
  		${AS} -o syscall.o syscall.i; \
  		rm -f syscall.ss syscall.i;; \
  	 *) \
  		/lib/cpp  ${SFLAGS} ${SYS}/syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
--- 320,333 ----
  		/usr/ccs/lib/cpp  ${SFLAGS} ${SYS}/syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
  		rm syscall.ss;;				\
! 	 sgi_* | ppc_darwin* ) \
                  ${CC} ${CFLAGS} -c ${SYS}/syscall.s;;          \
  	 alpha_dux?? ) \
  		${AS} -P ${CFLAGS} -D_NO_PROTO -DMACH -DOSF -nostdinc -traditional -DASSEMBLER ${SYS}/syscall.s; \
  		${AS} -o syscall.o syscall.i; \
  		rm -f syscall.ss syscall.i;; \
+ 	 *fbsd* ) \
+ 		touch syscall.o ;; \
  	 *) \
  		/lib/cpp  ${SFLAGS} ${SYS}/syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
Index: openafs/src/libafsrpc/afsrpc.def
diff -c openafs/src/libafsrpc/afsrpc.def:1.1 openafs/src/libafsrpc/afsrpc.def:1.1.6.1
*** openafs/src/libafsrpc/afsrpc.def:1.1	Fri Nov  3 21:28:07 2000
--- openafs/src/libafsrpc/afsrpc.def	Mon Apr 23 02:39:23 2001
***************
*** 196,198 ****
--- 196,200 ----
  	rx_SetRxStatUserOk			@201
  	rx_RxStatUserOk				@202
  	rx_enable_hot_thread			@203 DATA
+ 	xdr_int64				@204
+ 	xdr_uint64				@205
Index: openafs/src/libuafs/Makefile.common
diff -c openafs/src/libuafs/Makefile.common:1.2.2.1 openafs/src/libuafs/Makefile.common:1.2.2.4
*** openafs/src/libuafs/Makefile.common:1.2.2.1	Tue Mar  6 16:38:48 2001
--- openafs/src/libuafs/Makefile.common	Mon Apr 23 02:17:09 2001
***************
*** 9,15 ****
  #
  
  SHELL=/bin/sh
- INSTALL = ${SRCDIR}bin/install
  INCLUDE=  -I. -I/usr/include
  UOBJ	=../UAFS
  WEBOBJ	=../AFSWEB
--- 9,14 ----
***************
*** 28,43 ****
  	${INSTALL} AFSWEB/$(LIBAFSWEB) ${DESTDIR}root.afsweb/usr/lib
  	${INSTALL} AFSWEB/$(LIBAFSWEBKRB) ${DESTDIR}root.afsweb/usr/lib
  
! ukinstall: UAFS/$(LIBUAFS)
  	${INSTALL} afs/param.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/stds.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/afs_sysnames.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/afs_stats.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/sysincludes.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/afs_usrops.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} des/libdes.a ${DESTDIR}root.perf/lib
! 	${INSTALL} UAFS/$(LIBUAFS) ${DESTDIR}root.perf/lib
! 	$(CC) $(TEST_CFLAGS) $(TEST_LDFLAGS) -o linktest linktest.c -I${DESTDIR}include -I${DESTDIR}include/rx -I${DESTDIR}root.perf/include ${DESTDIR}root.perf/lib/$(LIBUAFS) ${DESTDIR}root.perf/lib/libdes.a $(TEST_LIBS)
  
  CRULE1=	$(CC) $(OPTF) -DKERNEL $(CFLAGS) -c $?
  CRULE2=	$(CC) $(OPTF) $(WEBOPTS) -DKERNEL $(CFLAGS) -c $?
--- 27,48 ----
  	${INSTALL} AFSWEB/$(LIBAFSWEB) ${DESTDIR}root.afsweb/usr/lib
  	${INSTALL} AFSWEB/$(LIBAFSWEBKRB) ${DESTDIR}root.afsweb/usr/lib
  
! ukinsthdrs:
  	${INSTALL} afs/param.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/stds.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/afs_sysnames.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/afs_stats.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/sysincludes.h ${DESTDIR}root.perf/include/afs
  	${INSTALL} afs/afs_usrops.h ${DESTDIR}root.perf/include/afs
+ 
+ ukinstlibs:
  	${INSTALL} des/libdes.a ${DESTDIR}root.perf/lib
! 	${INSTALL} UAFS/$(LIBUAFS) ${DESTDIR}root.perf/lib	
! 
! ukinstall: ukinsthdrs UAFS/$(LIBUAFS) linktest ukinstlibs
! 
! linktest: UAFS/$(LIBUAFS) des/libdes.a
! 	$(CC) $(TEST_CFLAGS) $(TEST_LDFLAGS) -o linktest linktest.c -I${DESTDIR}include -I${DESTDIR}include/rx -I${DESTDIR}root.perf/include UAFS/$(LIBUAFS) des/libdes.a $(TEST_LIBS)
  
  CRULE1=	$(CC) $(OPTF) -DKERNEL $(CFLAGS) -c $?
  CRULE2=	$(CC) $(OPTF) $(WEBOPTS) -DKERNEL $(CFLAGS) -c $?
Index: openafs/src/libuafs/MakefileProto.DARWIN
diff -c /dev/null openafs/src/libuafs/MakefileProto.DARWIN:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:40 2001
--- openafs/src/libuafs/MakefileProto.DARWIN	Mon Apr 23 02:07:20 2001
***************
*** 0 ****
--- 1,82 ----
+ # 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
+ 
+ # MakefileProto for Solaris systems
+ #
+ 
+ include ../config/Makefile.${SYS_NAME}
+ 
+ MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
+ 
+ # System specific build commands and flags
+ CC = cc
+ DEFINES= -D_REENTRANT -DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE
+ KOPTS=
+ CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG} $(XCFLAGS)
+ OPTF=-O
+ # WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD
+ 
+ TEST_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV
+ TEST_LDFLAGS=
+ TEST_LIBS=
+ 
+ LIBUAFS = libuafs.a
+ LIBAFSWEB = nsafs.so
+ LIBAFSWEBKRB = nsafs.krb.so
+ 
+ include Makefile.common
+ 
+ setup_common:
+ 	-rm -f  h net netinet rpc ufs nfs  machine sys inet nsapi
+ 	-ln -s /usr/include/sys h
+ 	-ln -s /usr/include/net net
+ 	-ln -s /usr/include/netinet netinet
+ 	-ln -s /usr/include/rpc rpc
+ 	-ln -s /usr/include/sys sys
+ 	-ln -s /usr/include/nfs nfs
+ 	-ln -s /usr/include/inet inet
+ 	-ln -s /usr/include/ufs ufs
+ 	-ln -s $(NS_INCL) nsapi
+ 
+ setup_uafs: setup_common
+ 	set UAFS; $(MKDIR_IF_NEEDED)
+ 	-rm -f UAFS/Makefile UAFS/Makefile.common
+ 	ln -s ../Makefile UAFS/Makefile
+ 	ln -s ../Makefile.common UAFS/Makefile.common
+ 
+ setup_nsafs: setup_common
+ 	set AFSWEB; $(MKDIR_IF_NEEDED)
+ 	-rm -f AFSWEB/Makefile AFSWEB/Makefile.common
+ 	ln -s ../Makefile AFSWEB/Makefile
+ 	ln -s ../Makefile.common AFSWEB/Makefile.common
+ 
+ UAFS/$(LIBUAFS): setup_uafs
+ 	cd UAFS; \
+ 	$(MAKE) $(LIBUAFS) DESTDIR=${DESTDIR}; \
+ 	ranlib $(LIBUAFS)
+ 
+ AFSWEB/$(LIBAFSWEB): setup_nsafs
+ 	cd AFSWEB; \
+ 	$(MAKE) $(LIBAFSWEB) DESTDIR=${DESTDIR}
+ 
+ AFSWEB/$(LIBAFSWEBKRB): setup_nsafs
+ 	cd AFSWEB; \
+ 	$(MAKE) $(LIBAFSWEBKRB) DESTDIR=${DESTDIR}
+ 
+ # Below this line are targets when in the COMMON directory:
+ 
+ $(LIBUAFS): $(UAFSOBJ)
+ 	-rm -f $(LIBUAFS)
+ 	$(AR) $(ARFLAGS) $(LIBUAFS) $(UAFSOBJ)
+ 
+ $(LIBAFSWEB): $(AFSWEBOBJ) ${DES}/libdes.a
+ 	-rm -f $(LIBAFSWEB)
+ 	ld -b $(LIBAFSWEB) $(AFSWEBOBJ) ${DES}/libdes.a $(WEBLIBS)
+ 
+ $(LIBAFSWEBKRB): $(AFSWEBOBJKRB) ${DES}/libdes.a
+ 	-rm -f $(LIBAFSWEBKRB)
+ 	ld -b $(LIBAFSWEBKRB) $(AFSWEBOBJKRB) ${DES}/libdes.a $(WEBLIBS)
Index: openafs/src/libuafs/MakefileProto.FBSD
diff -c /dev/null openafs/src/libuafs/MakefileProto.FBSD:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:40 2001
--- openafs/src/libuafs/MakefileProto.FBSD	Mon Apr 23 03:29:42 2001
***************
*** 0 ****
--- 1,76 ----
+ #/* Copyright (C) 1995, 1989 Transarc Corporation - All rights reserved */
+ # 
+ # MakefileProto for Solaris systems
+ #
+ 
+ include ../config/Makefile.${SYS_NAME}
+ 
+ MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
+ 
+ # System specific build commands and flags
+ CC = gcc
+ DEFINES= -D_REENTRANT -DAFSDEBUG -DKERNEL -DUKERNEL -DAFS -DVICE
+ KOPTS=
+ CFLAGS=-I. -I.. ${FSINCLUDES} $(DEFINES) $(KOPTS) ${DBUG}
+ OPTF=-O
+ # WEBOPTS = -I../nsapi -DNETSCAPE_NSAPI -DNET_SSL -DXP_UNIX -DMCC_HTTPD
+ 
+ TEST_CFLAGS=-pthread -D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_FBSD40_ENV
+ TEST_LDFLAGS=
+ TEST_LIBS=
+ 
+ LIBUAFS = libuafs.a
+ LIBAFSWEB = nsafs.so
+ LIBAFSWEBKRB = nsafs.krb.so
+ 
+ include Makefile.common
+ 
+ setup_common:
+ 	-rm -f  h net netinet rpc ufs nfs  machine sys inet nsapi
+ 	-ln -s /usr/include/sys h
+ 	-ln -s /usr/include/net net
+ 	-ln -s /usr/include/netinet netinet
+ 	-ln -s /usr/include/rpc rpc
+ 	-ln -s /usr/include/sys sys
+ 	-ln -s /usr/include/nfs nfs
+ 	-ln -s /usr/include/inet inet
+ 	-ln -s /usr/include/ufs ufs
+ 	-ln -s $(NS_INCL) nsapi
+ 
+ setup_uafs: setup_common
+ 	set UAFS; $(MKDIR_IF_NEEDED)
+ 	-rm -f UAFS/Makefile UAFS/Makefile.common
+ 	ln -s ../Makefile UAFS/Makefile
+ 	ln -s ../Makefile.common UAFS/Makefile.common
+ 
+ setup_nsafs: setup_common
+ 	set AFSWEB; $(MKDIR_IF_NEEDED)
+ 	-rm -f AFSWEB/Makefile AFSWEB/Makefile.common
+ 	ln -s ../Makefile AFSWEB/Makefile
+ 	ln -s ../Makefile.common AFSWEB/Makefile.common
+ 
+ UAFS/$(LIBUAFS): setup_uafs
+ 	cd UAFS; \
+ 	$(MAKE) $(LIBUAFS) DESTDIR=${DESTDIR}
+ 
+ AFSWEB/$(LIBAFSWEB): setup_nsafs
+ cd AFSWEB; \
+ 	$(MAKE) $(LIBAFSWEB) DESTDIR=${DESTDIR}
+ 
+ AFSWEB/$(LIBAFSWEBKRB): setup_nsafs
+ 	cd AFSWEB; \
+ 	$(MAKE) $(LIBAFSWEBKRB) DESTDIR=${DESTDIR}
+ 
+ # Below this line are targets when in the COMMON directory:
+ 
+ $(LIBUAFS): $(UAFSOBJ)
+ 	-rm -f $(LIBUAFS)
+ 	$(AR) $(ARFLAGS) $(LIBUAFS) $(UAFSOBJ)
+ 
+ $(LIBAFSWEB): $(AFSWEBOBJ) ${DES}/libdes.a
+ 	-rm -f $(LIBAFSWEB)
+ 	ld -b $(LIBAFSWEB) $(AFSWEBOBJ) ${DES}/libdes.a $(WEBLIBS)
+ 
+ $(LIBAFSWEBKRB): $(AFSWEBOBJKRB) ${DES}/libdes.a
+ 	-rm -f $(LIBAFSWEBKRB)
+ 	ld -b $(LIBAFSWEBKRB) $(AFSWEBOBJKRB) ${DES}/libdes.a $(WEBLIBS)
Index: openafs/src/log/Makefile
diff -c openafs/src/log/Makefile:1.2 openafs/src/log/Makefile:1.2.2.1
*** openafs/src/log/Makefile:1.2	Sat Nov  4 05:05:07 2000
--- openafs/src/log/Makefile	Mon Apr 23 00:06:33 2001
***************
*** 15,23 ****
  
  PROGRAMS=	unlog tokens tokens.krb kseal
  
- INSTALL = ${SRCDIR}bin/install
- INSTALLro = ${SRCDIR}bin/install -m 644
- 
  INCLS=${SRCDIR}include/afs/auth.h ${SRCDIR}include/rx/rx.h \
  ${SRCDIR}include/rx/xdr.h ${SRCDIR}include/des.h ${SRCDIR}include/rx/rxkad.h \
  ${SRCDIR}include/afs/cellconfig.h
--- 15,20 ----
Index: openafs/src/login/Makefile
diff -c openafs/src/login/Makefile:1.1 openafs/src/login/Makefile:1.1.6.1
*** openafs/src/login/Makefile:1.1	Fri Nov  3 21:28:14 2000
--- openafs/src/login/Makefile	Mon Apr 23 00:06:39 2001
***************
*** 21,27 ****
  include ../config/Makefile.${SYS_NAME}
  
  LIBDIR = ${DESTDIR}lib/
- INSTALL=${SRCDIR}bin/install
  AFSLIBS = ${LIBDIR}afs/libkauth.a ${LIBDIR}afs/libprot.a ${LIBDIR}libubik.a \
  	  ${LIBDIR}afs/libauth.a ${DESTDIR}lib/librxkad.a ${LIBDIR}afs/libsys.a \
  	  ${DESTDIR}lib/libdes.a ${LIBDIR}librx.a ${LIBDIR}liblwp.a \
--- 21,26 ----
Index: openafs/src/login/login.c
diff -c openafs/src/login/login.c:1.1 openafs/src/login/login.c:1.1.6.1
*** openafs/src/login/login.c:1.1	Fri Nov  3 21:28:15 2000
--- openafs/src/login/login.c	Mon Apr 23 03:29:47 2001
***************
*** 53,58 ****
--- 53,60 ----
  #if  !defined(AFS_HPUX_ENV) && !defined(AFS_AIX_ENV)
  #if defined(AFS_SUN_ENV) || (defined(AFS_ATHENA_STDENV) && !defined(AFS_DEC_ENV)) || defined(AFS_OSF_ENV)
  #include <ufs/quota.h>
+ #elif defined(AFS_FBSD_ENV)
+ #include <ufs/ufs/quota.h>
  #else
  #include <sys/quota.h>
  #endif
***************
*** 71,76 ****
--- 73,82 ----
  #include <sys/ttold.h>
  #include <sys/filio.h>
  #endif
+ #ifdef AFS_FBSD_ENV
+ #define USE_OLD_TTY 1
+ #include <sys/ttydefaults.h>
+ #endif
  #include <sys/ioctl.h>
  
  #include <utmp.h>
***************
*** 79,85 ****
  #include <dirent.h>
  #endif
  #include <signal.h>
! #if !defined(AIX) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX32_ENV)
  #include <lastlog.h>
  #endif
  #include <errno.h>
--- 85,91 ----
  #include <dirent.h>
  #endif
  #include <signal.h>
! #if !defined(AIX) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX32_ENV) && !defined(AFS_FBSD_ENV)
  #include <lastlog.h>
  #endif
  #include <errno.h>
Index: openafs/src/lwp/Makefile
diff -c openafs/src/lwp/Makefile:1.3.2.2 openafs/src/lwp/Makefile:1.3.2.4
*** openafs/src/lwp/Makefile:1.3.2.2	Tue Mar  6 17:23:44 2001
--- openafs/src/lwp/Makefile	Mon Apr 23 03:29:54 2001
***************
*** 9,17 ****
  COMPONENT=lwp
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL = ${SRCDIR}bin/install
- 
- include ../config/Makefile.${SYS_NAME}
  # this is important code, so let's optimize it.  The optimizer aggravates any
  # subtle bugs that may have been introduced in process.s, be warned!
  OPTIMIZE=${LWP_OPTMZ}
--- 9,14 ----
***************
*** 69,76 ****
  				s390*) \
  					/lib/cpp -P -I${SRCDIR}include process.s >process.ss; \
  					${AS} -ahlns process.ss -o process.o >process.lst; \
  					rm process.ss ;; \
! 				hp* | *_linux* | sgi_64 | sgi_65) \
  					${CC} ${CFLAGS} -c process.c;; \
  				ncrx86_*) \
  					/usr/ccs/lib/cpp -P -I${SRCDIR}include process.s process.ss; \
--- 66,79 ----
  				s390*) \
  					/lib/cpp -P -I${SRCDIR}include process.s >process.ss; \
  					${AS} -ahlns process.ss -o process.o >process.lst; \
+ 					rm process.ss ;; \
+ 				ppc_darwin* ) \
+ 					$(CC) -c ${XCFLAGS} -I${SRCDIR}include process.s;; \
+ 				i386_fbsd* ) \
+ 					/usr/bin/cpp -P process.fbsd.s > process.ss; \
+ 					${AS} -o process.o process.ss; \
  					rm process.ss ;; \
! 				hp* | *_linux* | sgi_64 | sgi_65 ) \
  					${CC} ${CFLAGS} -c process.c;; \
  				ncrx86_*) \
  					/usr/ccs/lib/cpp -P -I${SRCDIR}include process.s process.ss; \
Index: openafs/src/lwp/lwp.c
diff -c openafs/src/lwp/lwp.c:1.2.2.4 openafs/src/lwp/lwp.c:1.2.2.8
*** openafs/src/lwp/lwp.c:1.2.2.4	Tue Mar  6 17:23:44 2001
--- openafs/src/lwp/lwp.c	Mon Apr 23 03:29:54 2001
***************
*** 39,45 ****
  extern void *malloc(int size);
  extern void *realloc(void *ptr, int size);
  #endif
! #if defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV)
  extern int PRE_Block;	/* from preempt.c */
  #else
  extern char PRE_Block;	/* from preempt.c */
--- 39,45 ----
  extern void *malloc(int size);
  extern void *realloc(void *ptr, int size);
  #endif
! #if defined(AFS_OSF_ENV) || defined(AFS_S390_LINUX20_ENV)
  extern int PRE_Block;	/* from preempt.c */
  #else
  extern char PRE_Block;	/* from preempt.c */
***************
*** 343,349 ****
  #ifdef __hp9000s800
  	savecontext(Create_Process_Part2, &temp2->context, stackptr+MINFRAME);
  #else
! #ifdef AFS_SGI62_ENV
  	/* Need to have the sp on an 8-byte boundary for storing doubles. */
  	savecontext(Create_Process_Part2, &temp2->context,
  		    stackptr+stacksize-16); /* 16 = 2 * jmp_buf_type*/
--- 343,349 ----
  #ifdef __hp9000s800
  	savecontext(Create_Process_Part2, &temp2->context, stackptr+MINFRAME);
  #else
! #if defined(AFS_SGI62_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  	/* Need to have the sp on an 8-byte boundary for storing doubles. */
  	savecontext(Create_Process_Part2, &temp2->context,
  		    stackptr+stacksize-16); /* 16 = 2 * jmp_buf_type*/
***************
*** 485,491 ****
  	    savecontext(Dispatcher, &(temp -> context),
  			&(LWPANCHOR.dsptchstack[MINFRAME]));
  #else
! #ifdef AFS_SGI62_ENV
  	    savecontext(Dispatcher, &(temp -> context),
  			&(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-8]));
  #else
--- 485,491 ----
  	    savecontext(Dispatcher, &(temp -> context),
  			&(LWPANCHOR.dsptchstack[MINFRAME]));
  #else
! #if defined(AFS_SGI62_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  	    savecontext(Dispatcher, &(temp -> context),
  			&(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-8]));
  #else
Index: openafs/src/lwp/preempt.c
diff -c openafs/src/lwp/preempt.c:1.2.2.2 openafs/src/lwp/preempt.c:1.2.2.4
*** openafs/src/lwp/preempt.c:1.2.2.2	Tue Mar  6 17:23:45 2001
--- openafs/src/lwp/preempt.c	Mon Apr 23 03:29:55 2001
***************
*** 17,23 ****
  \*******************************************************************/
  #include <afs/param.h>
  
! #ifdef AFS_LINUX20_ENV
  int PRE_Block = 0;
  #else
  #include <sys/time.h>
--- 17,23 ----
  \*******************************************************************/
  #include <afs/param.h>
  
! #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  int PRE_Block = 0;
  #else
  #include <sys/time.h>
Index: openafs/src/lwp/process.c
diff -c openafs/src/lwp/process.c:1.3.2.2 openafs/src/lwp/process.c:1.3.2.5
*** openafs/src/lwp/process.c:1.3.2.2	Tue Mar  6 17:23:45 2001
--- openafs/src/lwp/process.c	Mon Apr 23 03:29:55 2001
***************
*** 44,52 ****
--- 44,59 ----
  #elif   defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV)
  #define LWP_SP 0
  #define LWP_FP 1
+ #elif defined(AFS_ALPHA_LINUX20_ENV)
+ #define LWP_SP 8
+ #define LWP_FP 7
  #else
  #error Unsupported linux LWP system type.
  #endif
+ #elif   defined(AFS_X86_FBSD_ENV)
+ #define LWP_SP 4
+ #elif   defined(AFS_DARWIN_ENV)
+ #define LWP_SP 16
  #else
       Need offset to SP in jmp_buf for this platform.
  #endif
***************
*** 62,69 ****
  typedef __uint64_t jmp_buf_type;
  #endif
  #else
  typedef int jmp_buf_type;
! #endif
  
  static jmp_buf	jmp_tmp;
  static char	(*EP)();
--- 69,80 ----
  typedef __uint64_t jmp_buf_type;
  #endif
  #else
+ #ifdef AFS_ALPHA_LINUX20_ENV
+ typedef long jmp_buf_type;
+ #else
  typedef int jmp_buf_type;
! #endif /*AFS_ALPHA_LINUX20_ENV*/
! #endif /*SGI*/
  
  static jmp_buf	jmp_tmp;
  static char	(*EP)();
Index: openafs/src/lwp/process.fbsd.s
diff -c /dev/null openafs/src/lwp/process.fbsd.s:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:42 2001
--- openafs/src/lwp/process.fbsd.s	Mon Apr 23 03:29:55 2001
***************
*** 0 ****
--- 1,90 ----
+ /*
+  * 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	IGNORE_STDS_H	1
+ /* Sun 386i... I hope this does the right thing!!!
+  * 
+  * Written by Derek Atkins <warlord@MIT.EDU>
+  * (debugging help by Chris Provenzano <proven@mit.edu>)
+  * 11/1991
+  *
+  * "ojala que es correcto!"
+  */
+ 	.file "process.s"
+ 
+ 	.data
+ 
+ 	.text
+ 
+ /*
+  * struct savearea {
+  * 	char	*topstack;
+  * }
+  */
+ 
+ 	.set 	topstack,0
+ 
+ /*
+  * savecontext(f, area1, newsp)
+  *	int (*f)(); struct savearea *area1; char *newsp;
+  */
+ 
+ /* offsets, to make my life easier! */
+ 	.set	f,8
+ 	.set	area1,12
+ 	.set	newsp,16
+ 
+ 
+ .globl	PRE_Block
+ .globl	savecontext
+ 
+ savecontext:
+ 	pushl	%ebp			/* New Frame! */
+ 	movl	%esp,%ebp
+ 	pusha				/* Push all registers */
+ 	movl	$1,PRE_Block		/* Pre-emption code */
+ 	movl	area1(%ebp),%eax	/* eax = base of savearea */
+ 	movl	%esp,(%eax)		/* area->topstack = esp */
+ 	movl	newsp(%ebp),%eax	/* get new sp into eax */
+ 	cmpl	$0,%eax
+ 	je	L1			/* if new sp is 0 then dont change esp */
+ 	movl	%eax,%esp		/* go ahead.  make my day! */
+ L1:
+ 	jmp	*f(%ebp)			/* ebx = &f */
+ 
+ /* Shouldnt be here....*/
+ 
+ 	call	abort
+ 
+ /*
+  * returnto(area2)
+  *	struct savearea *area2;
+  */
+ 
+ /* stack offset */
+ 	.set	area2,8
+ 
+ .globl	returnto
+ 
+ returnto:
+ 	pushl	%ebp
+ 	movl	%esp, %ebp		/* New frame, to get correct pointer */
+ 	movl	area2(%ebp),%eax	/* eax = area2 */
+ 	movl	(%eax),%esp		/* restore esp */
+ 	popa 
+ 	movl	$0,PRE_Block		/* clear it up... */
+ 	popl	%ebp
+ 	ret
+ 
+ /* I see, said the blind man, as he picked up his hammer and saw! */
+ 	pushl	$1234
+ 	call	abort
+ 
+ 
+ 
Index: openafs/src/lwp/process.s
diff -c openafs/src/lwp/process.s:1.2.2.1 openafs/src/lwp/process.s:1.2.2.3
*** openafs/src/lwp/process.s:1.2.2.1	Tue Mar  6 17:23:45 2001
--- openafs/src/lwp/process.s	Mon Apr 23 02:40:25 2001
***************
*** 202,208 ****
                .long   PRE_Block
        .L0:
                l       %r5,0(%r5)              /* Get A(PRE_Block) */
!               mvi     0(%r5),1                /* Set it */
                lr      %r6,%r3                 /* Get base of savearea */
                st      %r15,0(%r3)             /* Save stack pointer */
                ltr     %r4,%r4                 /* If new sp is 0 */
--- 202,208 ----
                .long   PRE_Block
        .L0:
                l       %r5,0(%r5)              /* Get A(PRE_Block) */
!               mvi     3(%r5),1                /* Set it */
                lr      %r6,%r3                 /* Get base of savearea */
                st      %r15,0(%r3)             /* Save stack pointer */
                ltr     %r4,%r4                 /* If new sp is 0 */
***************
*** 236,243 ****
                   .long          PRE_Block
        .L3:
                l       %r5,0(%r5)              /* Get A(PRE_Block) */
!               xc      0(4,%r5),0(%r5)         /* Clear it */
!               l       %r15,0(%r15)
                lm      %r6,%r15,24(%r15)       /* Restore registers */
                br      %r14                    /* Return */
  
--- 236,244 ----
                   .long          PRE_Block
        .L3:
                l       %r5,0(%r5)              /* Get A(PRE_Block) */
!               /*xc      0(4,%r5),0(%r5)         /* Clear it */
! 	      mvi     3(%r5),0                /* Clear it */ 
! 	      l       %r15,0(%r15)
                lm      %r6,%r15,24(%r15)       /* Restore registers */
                br      %r14                    /* Return */
  
***************
*** 1231,1234 ****
--- 1232,1390 ----
  
  
  #endif /* AFS_NCR_ENV */
+ #ifdef AFS_PPC_ENV
+ /* Comments:
+  *    1. Registers R10..R31 and CR0..CR7 are saved
+  *    2. "struct savearea" must hold at least 3 pointers (long)
+  *    3. This code will only work on 32 bit machines (601..604), not 620
+  *    4. No floating point registers are saved
+  *    5. The save stack "frame" is bigger than absolutely necessary.  The
+  *       PowerPC [AIX] ABI needs this extra space.
+  */
+ 
+ 
+ /* Mach-O assemblers */
+ #if !defined(NeXT) && !defined(__APPLE__)
+ #define r0    0
+ #define r1    1
+ #define r2    2
+ #define r3    3
+ #define r4    4
+ #define r5    5
+ #define r6    6
+ #define r7    7
+ #define r8    8
+ #define r9    9
+ #define r10   10
+ #define r11   11
+ #define r12   12
+ #define r13   13
+ #define r14   14
+ #define r15   15
+ #define r16   16
+ #define r17   17
+ #define r18   18
+ #define r19   19
+ #define r20   20
+ #define r21   21
+ #define r22   22
+ #define r23   23
+ #define r24   24
+ #define r25   25
+ #define r26   26
+ #define r27   27
+ #define r28   28
+ #define r29   29
+ #define r30   30
+ #define r31   31
+ #endif /* !NeXT && !__APPLE__ */
  
+ 
+ /*
+  * savecontext(int (*f)(), struct savearea *save, char *newsp)
+  */
+ 
+ #define FRAME_SIZE    (32*4)+(8*4)
+ #define FRAME_OFFSET  (8*4)
+ #define TOP_OF_STACK  (0*4)
+ #define RETURN                (1*4)
+ #define CCR           (2*4)
+ 
+ #if defined(NeXT) || defined(__APPLE__)
+       .globl  _savecontext
+ _savecontext:
+       lis     r9,ha16(_PRE_Block)     /* Disable interrupt fiddling */
+       li      r8,1
+       stb     r8,lo16(_PRE_Block)(r9)
+ #else
+       .globl  savecontext
+ savecontext:
+       lis     r9,PRE_Block@ha         /* Disable interrupt fiddling */
+       li      r8,1
+       stb     r8,PRE_Block@l(r9)
+ #endif /* NeXT || __APPLE__ */
+       subi    r1,r1,FRAME_SIZE
+       mfcr    r9
+       stw     r9,CCR(r4)
+       stw     r10,10*4+FRAME_OFFSET(r1)       /* Save registers */
+       stw     r11,11*4+FRAME_OFFSET(r1)
+       stw     r12,12*4+FRAME_OFFSET(r1)
+       stw     r13,13*4+FRAME_OFFSET(r1)
+       stw     r14,14*4+FRAME_OFFSET(r1)
+       stw     r15,15*4+FRAME_OFFSET(r1)
+       stw     r16,16*4+FRAME_OFFSET(r1)
+       stw     r17,17*4+FRAME_OFFSET(r1)
+       stw     r18,18*4+FRAME_OFFSET(r1)
+       stw     r19,19*4+FRAME_OFFSET(r1)
+       stw     r20,20*4+FRAME_OFFSET(r1)
+       stw     r21,21*4+FRAME_OFFSET(r1)
+       stw     r22,22*4+FRAME_OFFSET(r1)
+       stw     r23,23*4+FRAME_OFFSET(r1)
+       stw     r24,24*4+FRAME_OFFSET(r1)
+       stw     r25,25*4+FRAME_OFFSET(r1)
+       stw     r26,26*4+FRAME_OFFSET(r1)
+       stw     r27,27*4+FRAME_OFFSET(r1)
+       stw     r28,28*4+FRAME_OFFSET(r1)
+       stw     r29,29*4+FRAME_OFFSET(r1)
+       stw     r30,30*4+FRAME_OFFSET(r1)
+       stw     r31,31*4+FRAME_OFFSET(r1)
+       stw     r1,TOP_OF_STACK(r4)
+       cmpi    0,r5,0                          /* New stack specified? */
+       mflr    r0
+       stw     r0,RETURN(r4)
+       mtlr    r3
+       beq     L1                             /* No - don't muck with pointer */
+ 
+       mr      r1,r5
+ L1:	   blr                                     /* Return */
+ 
+ /*
+  * returnto(struct savearea *area)
+  */
+ #if defined(NeXT) || defined(__APPLE__)
+       .globl  _returnto
+ _returnto:
+ #else
+       .globl  returnto
+ returnto:
+ #endif /* NeXT || __APPLE__ */
+       lwz     r1,TOP_OF_STACK(r3)             /* Update stack pointer */
+       lwz     r0,RETURN(r3)                   /* Get return address */
+       mtlr    r0
+       lwz     r4,CCR(r3)
+       mtcrf   0xFF,r4
+       lwz     r10,10*4+FRAME_OFFSET(r1)       /* Restore registers */
+       lwz     r11,11*4+FRAME_OFFSET(r1)
+       lwz     r12,12*4+FRAME_OFFSET(r1)
+       lwz     r13,13*4+FRAME_OFFSET(r1)
+       lwz     r14,14*4+FRAME_OFFSET(r1)
+       lwz     r15,15*4+FRAME_OFFSET(r1)
+       lwz     r16,16*4+FRAME_OFFSET(r1)
+       lwz     r17,17*4+FRAME_OFFSET(r1)
+       lwz     r18,18*4+FRAME_OFFSET(r1)
+       lwz     r19,19*4+FRAME_OFFSET(r1)
+       lwz     r20,20*4+FRAME_OFFSET(r1)
+       lwz     r21,21*4+FRAME_OFFSET(r1)
+       lwz     r22,22*4+FRAME_OFFSET(r1)
+       lwz     r23,23*4+FRAME_OFFSET(r1)
+       lwz     r24,24*4+FRAME_OFFSET(r1)
+       lwz     r25,25*4+FRAME_OFFSET(r1)
+       lwz     r26,26*4+FRAME_OFFSET(r1)
+       lwz     r27,27*4+FRAME_OFFSET(r1)
+       lwz     r28,28*4+FRAME_OFFSET(r1)
+       lwz     r29,29*4+FRAME_OFFSET(r1)
+       lwz     r30,30*4+FRAME_OFFSET(r1)
+       lwz     r31,31*4+FRAME_OFFSET(r1)
+ #if defined(NeXT) || defined(__APPLE__)
+       lis     r9,ha16(_PRE_Block)         /* Re-enable interrupt fiddling */
+       li      r8,0
+       stb     r8,lo16(_PRE_Block)(r9)
+ #else
+       lis     r9,PRE_Block@ha         /* Re-enable interrupt fiddling */
+       li      r8,0
+       stb     r8,PRE_Block@l(r9)
+ #endif /* NeXT || __APPLE__ */
+       addi    r1,r1,FRAME_SIZE
+       blr
+ #endif
+ 	
Index: openafs/src/lwp/timer.c
diff -c openafs/src/lwp/timer.c:1.2 openafs/src/lwp/timer.c:1.2.2.1
*** openafs/src/lwp/timer.c:1.2	Sat Nov  4 05:05:12 2000
--- openafs/src/lwp/timer.c	Mon Apr 23 03:29:55 2001
***************
*** 52,58 ****
  
  static globalInitDone = 0;
  
! #if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
  extern insque();
  #endif
  
--- 52,58 ----
  
  static globalInitDone = 0;
  
! #if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
  extern insque();
  #endif
  
***************
*** 256,262 ****
      return (e == tlist ? NULL : e);
  }
  
! #if defined(AFS_HPUX_ENV) || defined(AFS_NT40_ENV)
  /* This used to be in hputils.c, but it's only use is in the LWP package. */
  /*
   * Emulate the vax instructions for queue insertion and deletion, somewhat.
--- 256,262 ----
      return (e == tlist ? NULL : e);
  }
  
! #if defined(AFS_HPUX_ENV) || defined(AFS_NT40_ENV) || defined(AFS_FBSD_ENV)
  /* This used to be in hputils.c, but it's only use is in the LWP package. */
  /*
   * Emulate the vax instructions for queue insertion and deletion, somewhat.
***************
*** 285,288 ****
      elementp->Prev = elementp->Next = (struct TM_Elem*)0;
  }
  
! #endif /* AFS_HPUX_ENV || AFS_NT40_ENV */
--- 285,288 ----
      elementp->Prev = elementp->Next = (struct TM_Elem*)0;
  }
  
! #endif /* AFS_HPUX_ENV || AFS_NT40_ENV || AFS_FBSD_ENV */
Index: openafs/src/lwp/waitkey.c
diff -c openafs/src/lwp/waitkey.c:1.2 openafs/src/lwp/waitkey.c:1.2.2.2
*** openafs/src/lwp/waitkey.c:1.2	Sat Nov  4 05:05:13 2000
--- openafs/src/lwp/waitkey.c	Mon Apr 23 03:29:55 2001
***************
*** 154,161 ****
--- 154,166 ----
      if (stdin->_IO_read_ptr < stdin->_IO_read_end)
  	return 1;
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     if (stdin->_bf._size > 0)
+         return 1;
+ #else
      if (stdin->_cnt > 0)
  	return 1;
+ #endif
  #endif
  
  
Index: openafs/src/mpp/Makefile
diff -c openafs/src/mpp/Makefile:1.1 openafs/src/mpp/Makefile:1.1.6.1
*** openafs/src/mpp/Makefile:1.1	Fri Nov  3 21:28:23 2000
--- openafs/src/mpp/Makefile	Mon Apr 23 00:06:52 2001
***************
*** 5,11 ****
  DESTDIR=DEST/
  SRCDIR=DEST/
  CFLAGS= ${OPTMZ} ${XCFLAGS}
- INSTALL=${SRCDIR}bin/install
  LIBS = ${XLIBS}
  
  PROGRAM=mpp
--- 5,10 ----
Index: openafs/src/ntp/Makefile
diff -c openafs/src/ntp/Makefile:1.2.2.1 openafs/src/ntp/Makefile:1.2.2.2
*** openafs/src/ntp/Makefile:1.2.2.1	Fri Jan 19 04:12:25 2001
--- openafs/src/ntp/Makefile	Mon Apr 23 00:06:58 2001
***************
*** 9,15 ****
  COMPONENT=ntp
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  INCPATH= -I${DESTDIR}include
  BINDIR=/usr/local/etc
  LINKDIR=/etc
--- 9,14 ----
Index: openafs/src/null/Makefile
diff -c openafs/src/null/Makefile:1.2 openafs/src/null/Makefile:1.2.2.1
*** openafs/src/null/Makefile:1.2	Sat Nov  4 05:05:18 2000
--- openafs/src/null/Makefile	Mon Apr 23 00:07:03 2001
***************
*** 8,14 ****
  # Makefile for the null library.
  DESTDIR=DEST/
  SRCDIR=DEST/
- INSTALL=${SRCDIR}bin/install
  SHELL=/bin/sh
  
  COMPONENT=null
--- 8,13 ----
Index: openafs/src/package/Makefile
diff -c openafs/src/package/Makefile:1.1 openafs/src/package/Makefile:1.1.6.1
*** openafs/src/package/Makefile:1.1	Fri Nov  3 21:28:29 2000
--- openafs/src/package/Makefile	Mon Apr 23 00:07:09 2001
***************
*** 15,21 ****
  YFLAGS   = -vd
  #LFLAGS  = -ll
  LINT     = lint -hp
- INSTALL  = ${SRCDIR}bin/install
  
  HFILES = package.h \
  	 validupdates.h \
--- 15,20 ----
Index: openafs/src/package/gram.y
diff -c openafs/src/package/gram.y:1.1 openafs/src/package/gram.y:1.1.6.1
*** openafs/src/package/gram.y:1.1	Fri Nov  3 21:28:30 2000
--- openafs/src/package/gram.y	Mon Apr 23 03:30:03 2001
***************
*** 26,32 ****
  
  char *emalloc();
  
! #if defined(AFS_AIX41_ENV) || defined(AFS_LINUX20_ENV)
  int test_linecounter;	/*Line number currently being parsed*/
  char *ch2str();
  char *appendchtostr();
--- 26,32 ----
  
  char *emalloc();
  
! #if defined(AFS_AIX41_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV)
  int test_linecounter;	/*Line number currently being parsed*/
  char *ch2str();
  char *appendchtostr();
Index: openafs/src/package/test_gram.y
diff -c openafs/src/package/test_gram.y:1.1 openafs/src/package/test_gram.y:1.1.6.1
*** openafs/src/package/test_gram.y:1.1	Fri Nov  3 21:28:33 2000
--- openafs/src/package/test_gram.y	Mon Apr 23 03:30:03 2001
***************
*** 28,34 ****
  
  char *emalloc();
  
! #if defined(AFS_AIX41_ENV) || defined(AFS_LINUX20_ENV)
  int test_linecounter;	/*Line number currently being parsed*/
  
  char *ch2str();
--- 28,34 ----
  
  char *emalloc();
  
! #if defined(AFS_AIX41_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV)
  int test_linecounter;	/*Line number currently being parsed*/
  
  char *ch2str();
Index: openafs/src/pam/Makefile
diff -c openafs/src/pam/Makefile:1.2 openafs/src/pam/Makefile:1.2.2.2
*** openafs/src/pam/Makefile:1.2	Sat Nov  4 05:05:18 2000
--- openafs/src/pam/Makefile	Mon Apr 23 03:30:09 2001
***************
*** 6,19 ****
  # directory or online at http://www.openafs.org/dl/license10.html
  
  SHELL=/bin/sh
- INSTALL = ${SRCDIR}bin/install
  KERNELDIR = ../libafs/
  
  COMPONENT=afs
  include ../config/Makefile.${SYS_NAME}
  
  LIBDIR = ${DESTDIR}lib/
- INSTALL=${SRCDIR}bin/install
    LIBSA = ${LIBDIR}afs/libprot.a ${LIBDIR}libubik.a
  AFSLIBS = ${DESTDIR}lib/librxkad.a 	    \
  	  ${LIBDIR}afs/libsys.a ${DESTDIR}lib/libdes.a 	    \
--- 6,17 ----
***************
*** 54,59 ****
--- 52,59 ----
  			$(SHOBJS) $(LIBS) ;; \
  	*linux*) \
  		$(CC) $(LDFLAGS) -o $@ afs_setcred.o $(SHOBJS) $(LIBS) ;;\
+ 	*fbsd*) \
+ 		$(CC) $(LDFLAGS) -o $@ afs_setcred.o $(SHOBJS) $(LIBS) ;;\
  	* ) \
  		echo No link line for system $(SYS_NAME). ;; \
  	esac
***************
*** 69,74 ****
--- 69,76 ----
  			afs_setcred_krb.o $(SHOBJS) $(LDFLAGS) $(KLIBS) ;; \
  	*linux*) \
  		$(CC) $(LDFLAGS) -o $@ afs_setcred_krb.o $(SHOBJS) $(KLIBS) ;;\
+ 	*fbsd*) \
+ 		$(CC) $(LDFLAGS) -o $@ afs_setcred_krb.o $(SHOBJS) $(KLIBS) ;;\
  	* ) \
  		echo No link line for system $(SYS_NAME). ;; \
  	esac
***************
*** 82,87 ****
--- 84,91 ----
  		$(CC) $(CFLAGS) -o $@ test_pam.o ${PAMLIBS};; \
  	*linux*) \
  		$(CC) $(CFLAGS) -rdynamic -o $@ test_pam.o -lpam -ldl;; \
+ 	*fbsd*) \
+ 		$(CC) $(CFLAGS) -rdynamic -o $@ test_pam.o -lpam ;; \
  	*) \
  		echo No link line for system $(SYS_NAME). ;; \
  	esac
Index: openafs/src/pam/test_pam.c
diff -c openafs/src/pam/test_pam.c:1.2 openafs/src/pam/test_pam.c:1.2.2.1
*** openafs/src/pam/test_pam.c:1.2	Sat Nov  4 05:05:19 2000
--- openafs/src/pam/test_pam.c	Mon Apr 23 03:30:10 2001
***************
*** 29,35 ****
  static const char *new_envstring = "GOTHEREVIATESTPAM=1";
  static const char *new_homestring = "HOME=/tmp";
  
! #ifdef AFS_LINUX20_ENV
  #define getpassphrase getpass
  #endif
  
--- 29,35 ----
  static const char *new_envstring = "GOTHEREVIATESTPAM=1";
  static const char *new_homestring = "HOME=/tmp";
  
! #if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV)
  #define getpassphrase getpass
  #endif
  
Index: openafs/src/pinstall/Makefile
diff -c openafs/src/pinstall/Makefile:1.2 openafs/src/pinstall/Makefile:1.2.2.1
*** openafs/src/pinstall/Makefile:1.2	Sat Nov  4 05:05:20 2000
--- openafs/src/pinstall/Makefile	Mon Apr 23 00:07:20 2001
***************
*** 47,53 ****
  	- [ -d test ] && ./test/test_install
  
  ${DESTDIR}bin/install: pinstall
! 	./pinstall -f pinstall ${DESTDIR}bin/install
  
  # Note: Some rule needs to appear here so that OSF's make does not try to
  # compile install from install.c. A ";" will not work since other platforms
--- 47,58 ----
  	- [ -d test ] && ./test/test_install
  
  ${DESTDIR}bin/install: pinstall
! 	case ${SYS_NAME} in \
! 		ppc_darwin*) \
! 			./pinstall -f pinstall ${DESTDIR}bin/pinstall ;;\
! 		*) \
! 			./pinstall -f pinstall ${DESTDIR}bin/install ;;\
! 	esac
  
  # Note: Some rule needs to appear here so that OSF's make does not try to
  # compile install from install.c. A ";" will not work since other platforms
Index: openafs/src/pinstall/install.c
diff -c openafs/src/pinstall/install.c:1.2 openafs/src/pinstall/install.c:1.2.2.4
*** openafs/src/pinstall/install.c:1.2	Sat Nov  4 05:05:20 2000
--- openafs/src/pinstall/install.c	Mon Apr 23 03:44:02 2001
***************
*** 66,86 ****
  #include <string.h>
  #include <elf.h>
  #else
  #include <strings.h>
  #include <a.out.h>
  #endif
  #ifdef	AFS_HPUX_ENV
  #include <utime.h>
  #endif
  
  struct stat istat, ostat;
  
  extern int errno;
  extern int sys_nerr;
! #ifndef AFS_LINUX20_ENV
  extern char *sys_errlist[];
  #endif
! #if	defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DECOSF_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)
  extern struct passwd *getpwnam();
  int stripcalled = 0;
  #endif
--- 66,94 ----
  #include <string.h>
  #include <elf.h>
  #else
+ #ifdef AFS_DARWIN_ENV
+ #include <fcntl.h>
+ #include <string.h>
+ #else
  #include <strings.h>
  #include <a.out.h>
  #endif
+ #endif
  #ifdef	AFS_HPUX_ENV
  #include <utime.h>
  #endif
+ #include <unistd.h>
+ #include <string.h>
+ #include <sys/wait.h>
  
  struct stat istat, ostat;
  
  extern int errno;
  extern int sys_nerr;
! #if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  extern char *sys_errlist[];
  #endif
! #if	defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DECOSF_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  extern struct passwd *getpwnam();
  int stripcalled = 0;
  #endif
***************
*** 110,118 ****
      int  i;
  
      bzero (sets, sizeof(sets));
!     while (*set) sets[*set++] = 1;
      i = strlen (s);
!     while (i > 0) if (sets[s[--i]]) return &s[i];
      return 0;
  }
  
--- 118,126 ----
      int  i;
  
      bzero (sets, sizeof(sets));
!     while (*set) sets[(int) *set++] = 1;
      i = strlen (s);
!     while (i > 0) if (sets[(int)s[--i]]) return &s[i];
      return 0;
  }
  
***************
*** 121,155 ****
      static char tbuffer[100];
      if (aerrno < 0 || aerrno >= sys_nerr) {
  	sprintf(tbuffer, "undefined error code %d", aerrno);
! 	return tbuffer;
      }
!     return sys_errlist[aerrno];
  }
  
  stripName(aname)
      char *aname;
      {if (rindex(aname, '.') == 0) return 1;
      else return 0;
      }
  
  atoo(astr)
      register char *astr;
      {register afs_int32 value;
      register char tc;
      value = 0;
!     while (tc = *astr++)
  	{value <<= 3;
  	value += tc-'0';
  	}
      return value;
      }
  
! #if	defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DECOSF_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)
  /*
   * Implementation lifted from that for AIX 3.1, since there didn't seem to be any
   * reason why it wouldn't work.
   */
! static
  quickStrip (iname, oname, ignored, copy_only)
  char *iname, *oname; {
  	int pid, status;
--- 129,166 ----
      static char tbuffer[100];
      if (aerrno < 0 || aerrno >= sys_nerr) {
  	sprintf(tbuffer, "undefined error code %d", aerrno);
!     } else {
! 	strcpy(tbuffer, sys_errlist[aerrno]);
      }
!     return tbuffer;
  }
  
+ int
  stripName(aname)
      char *aname;
      {if (rindex(aname, '.') == 0) return 1;
      else return 0;
      }
  
+ int
  atoo(astr)
      register char *astr;
      {register afs_int32 value;
      register char tc;
      value = 0;
!     while ((tc = *astr++))
  	{value <<= 3;
  	value += tc-'0';
  	}
      return value;
      }
  
! #if	defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DECOSF_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
  /*
   * Implementation lifted from that for AIX 3.1, since there didn't seem to be any
   * reason why it wouldn't work.
   */
! static int
  quickStrip (iname, oname, ignored, copy_only)
  char *iname, *oname; {
  	int pid, status;
***************
*** 211,217 ****
  		strip[1] = oname;
  #ifdef	AFS_SUN5_ENV
  #define	STRIP_BIN	"/usr/ccs/bin/strip"
! #elif defined(AFS_LINUX20_ENV)
  #define STRIP_BIN	"/usr/bin/strip"
  #else
  #define	STRIP_BIN	"/bin/strip"
--- 222,228 ----
  		strip[1] = oname;
  #ifdef	AFS_SUN5_ENV
  #define	STRIP_BIN	"/usr/ccs/bin/strip"
! #elif defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  #define STRIP_BIN	"/usr/bin/strip"
  #else
  #define	STRIP_BIN	"/bin/strip"
***************
*** 243,248 ****
--- 254,260 ----
   *	Since /bin/strip will make that call for us, we will lie so that
   *	it has a chance.
   */
+ int
  AIXobject(ignored) {
  
  	return !0;
***************
*** 446,461 ****
  
  #include "AFS_component_version_number.c"
  
  main (argc, argv)
      int argc;
      char **argv;
  {
      int setOwner, setMode, setGroup, ifd, ofd;
!     afs_int32 mode, owner, group;
      struct passwd *tpw;
      struct group *tgp;
      char *fnames[MAXFILES], *newNames[MAXFILES];
!     afs_int32 rcode, code, newcode;
      char *dname;
      char pname[1024];
  #if defined (AFS_HPUX_ENV)
--- 458,474 ----
  
  #include "AFS_component_version_number.c"
  
+ int
  main (argc, argv)
      int argc;
      char **argv;
  {
      int setOwner, setMode, setGroup, ifd, ofd;
!     afs_int32 mode=0, owner, group;
      struct passwd *tpw;
      struct group *tgp;
      char *fnames[MAXFILES], *newNames[MAXFILES];
!     afs_int32 rcode, code;
      char *dname;
      char pname[1024];
  #if defined (AFS_HPUX_ENV)
***************
*** 463,469 ****
--- 476,485 ----
  #endif /* AFS_HPUX_ENV */
      char pnametmp[1024];
      int pnamelen;
+ #if defined (AFS_AIX_ENV) || defined(AFS_FBSD_ENV)
+     afs_int32 newcode;
      static char diskBuffer[BUFSIZE];	/* must be static to avoid compiler bugs for large stuff */
+ #endif
      char myHostName[100];
      struct timeval tvp[2];
      int isDir;
***************
*** 671,680 ****
  		continue;
  	    }
  	}
! #if	defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DECOSF_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)
  	stripcalled = 0;
  	if (strip == 1 ||
! 	    (strip == -1 && ((istat.st_mode & 0111) == 0111) && stripName(newNames[i])) && AIXobject(fnames[i]))
  	    stripcalled = 1;
  	if (!stripcalled) {
  	    /* Simply copy target to dest */
--- 687,696 ----
  		continue;
  	    }
  	}
! #if	defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DECOSF_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
  	stripcalled = 0;
  	if (strip == 1 ||
! 	    ((strip == -1 && ((istat.st_mode & 0111) == 0111) && stripName(newNames[i])) && AIXobject(fnames[i])))
  	    stripcalled = 1;
  	if (!stripcalled) {
  	    /* Simply copy target to dest */
Index: openafs/src/procmgmt/Makefile
diff -c openafs/src/procmgmt/Makefile:1.2 openafs/src/procmgmt/Makefile:1.2.2.1
*** openafs/src/procmgmt/Makefile:1.2	Sat Nov  4 05:05:20 2000
--- openafs/src/procmgmt/Makefile	Mon Apr 23 00:07:28 2001
***************
*** 8,14 ****
  include ../config/Makefile.${SYS_NAME}
  include ../config/Makefile.version
  
- INSTALL=${SRCDIR}bin/install
  CFLAGS = $(DBUG) -I${SRCDIR}include ${XCFLAGS}
  
  ########################################################################
--- 8,13 ----
Index: openafs/src/ptserver/Makefile
diff -c openafs/src/ptserver/Makefile:1.2.2.2 openafs/src/ptserver/Makefile:1.2.2.4
*** openafs/src/ptserver/Makefile:1.2.2.2	Fri Jan 19 04:07:14 2001
--- openafs/src/ptserver/Makefile	Mon Apr 23 02:26:42 2001
***************
*** 10,22 ****
  include ../config/Makefile.${SYS_NAME}
  
  UKERNELDIR=../libuafs/
- INSTALL=${SRCDIR}bin/install
  RXGEN=${SRCDIR}bin/rxgen
  COMPILE_ET = ${SRCDIR}bin/compile_et
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
  CFLAGS = $(DBUG) -I${SRCDIR}include ${XCFLAGS}
- PE = ../permit_xprt.h
  INCLS=${SRCDIR}include/ubik.h \
  	${SRCDIR}include/lock.h  \
  	${SRCDIR}include/lwp.h \
--- 10,20 ----
***************
*** 99,105 ****
  
  ptclient.o: ptclient.c ${INCLS} AFS_component_version_number.c
  
! ptuser.o: ptuser.c ${LINCLS} ${PE}
  
  pterror.h pterror.c: pterror.et
  	$(RM) -f pterror.h pterror.c; ${COMPILE_ET} pterror
--- 97,103 ----
  
  ptclient.o: ptclient.c ${INCLS} AFS_component_version_number.c
  
! ptuser.o: ptuser.c ${LINCLS}
  
  pterror.h pterror.c: pterror.et
  	$(RM) -f pterror.h pterror.c; ${COMPILE_ET} pterror
***************
*** 125,131 ****
  readpwd.o: readpwd.c ${LINCLS} AFS_component_version_number.c
  
  testpt: testpt.o libprot.a ${SRCDIR}lib/afs/libcmd.a $(LIBS)
! 	$(CC) ${CFLAGS} -o testpt testpt.o -lm ${SRCDIR}lib/afs/libcmd.a libprot.a $(LIBS) ${XLIBS}
  
  testpt.o: testpt.c ${INCLS} ${SRCDIR}include/afs/cmd.h AFS_component_version_number.c
  
--- 123,134 ----
  readpwd.o: readpwd.c ${LINCLS} AFS_component_version_number.c
  
  testpt: testpt.o libprot.a ${SRCDIR}lib/afs/libcmd.a $(LIBS)
! 	case "$(SYS_NAME)" in \
! 	ppc_darwin_12 ) \
! 		$(CC) ${CFLAGS} -o testpt testpt.o ${SRCDIR}lib/afs/libcmd.a libprot.a $(LIBS) ;; \
! 	* ) \
! 		$(CC) ${CFLAGS} -o testpt testpt.o -lm ${SRCDIR}lib/afs/libcmd.a libprot.a $(LIBS) ${XLIBS} ;; \
! 	esac
  
  testpt.o: testpt.c ${INCLS} ${SRCDIR}include/afs/cmd.h AFS_component_version_number.c
  
Index: openafs/src/ptserver/pts.c
diff -c openafs/src/ptserver/pts.c:1.2.2.1 openafs/src/ptserver/pts.c:1.2.2.2
*** openafs/src/ptserver/pts.c:1.2.2.1	Wed Dec 13 16:49:49 2000
--- openafs/src/ptserver/pts.c	Sun Apr 22 23:22:35 2001
***************
*** 125,132 ****
  	if (code) {
  	    if (owner || id) 
  		com_err (whoami, code,
! 			 "; unable to create group %s with id %d owned by '%s' %s",
! 			 namei->data, id, owner, (force?"(ignored)":""));
  	    else com_err (whoami, code,
  			 "; unable to create group %s %s", namei->data, (force?"(ignored)":""));
  	    if (!force)
--- 125,135 ----
  	if (code) {
  	    if (owner || id) 
  		com_err (whoami, code,
! 			 "; unable to create group %s with id %d%s%s%s%s",
! 			 namei->data, id, owner ? " owned by '" : "",
! 			 owner ? owner : "",
! 			 owner ? "'" : "",
! 			 (force ? " (ignored)" : ""));
  	    else com_err (whoami, code,
  			 "; unable to create group %s %s", namei->data, (force?"(ignored)":""));
  	    if (!force)
Index: openafs/src/ptserver/ptserver.c
diff -c openafs/src/ptserver/ptserver.c:1.2.2.1 openafs/src/ptserver/ptserver.c:1.2.2.2
*** openafs/src/ptserver/ptserver.c:1.2.2.1	Tue Mar  6 16:49:45 2001
--- openafs/src/ptserver/ptserver.c	Sun Apr 22 23:41:08 2001
***************
*** 143,155 ****
  	else if (strncmp (arg, "-enable_process_stats", alen) == 0) {
  	    rx_enableProcessRPCStats();
  	}
  	else if (*arg == '-') {
  	  usage:
  
  		/* hack in help flag support */
  
  	    	printf ("Usage: ptserver [-database <db path>] "
! 			"[-p <number of processes>] [-rebuildDB] "
  			/* "[-enable_peer_stats] [-enable_process_stats] " */
  			"[-help]\n");
  		fflush(stdout);
--- 143,168 ----
  	else if (strncmp (arg, "-enable_process_stats", alen) == 0) {
  	    rx_enableProcessRPCStats();
  	}
+ #ifndef AFS_NT40_ENV
+ 	else if (strncmp(arg, "-syslog", alen)==0) {
+ 	    /* set syslog logging flag */
+ 	    serverLogSyslog = 1;
+ 	} 
+ 	else if (strncmp(arg, "-syslog=", MIN(8,alen))==0) {
+ 	    serverLogSyslog = 1;
+ 	    serverLogSyslogFacility = atoi(arg+8);
+ 	}
+ #endif
  	else if (*arg == '-') {
  	  usage:
  
  		/* hack in help flag support */
  
  	    	printf ("Usage: ptserver [-database <db path>] "
! #ifndef AFS_NT40_ENV
! 			"[-syslog[=FACILITY]] "
! #endif
! 			"[-p <number of processes>] [-rebuild] "
  			/* "[-enable_peer_stats] [-enable_process_stats] " */
  			"[-help]\n");
  		fflush(stdout);
Index: openafs/src/ptserver/ptserver.h
diff -c openafs/src/ptserver/ptserver.h:1.2 openafs/src/ptserver/ptserver.h:1.2.2.1
*** openafs/src/ptserver/ptserver.h:1.2	Sat Nov  4 05:05:25 2000
--- openafs/src/ptserver/ptserver.h	Mon Apr 23 02:12:38 2001
***************
*** 20,25 ****
--- 20,26 ----
  
  #define	PRBADID		0x80000000
  
+ #define SYSVIEWERID     -203
  #define	SYSADMINID	-204
  #define SYSBACKUPID     -205
  #define	ANYUSERID	-101
Index: openafs/src/ptserver/ptuser.c
diff -c openafs/src/ptserver/ptuser.c:1.2 openafs/src/ptserver/ptuser.c:1.2.2.1
*** openafs/src/ptserver/ptuser.c:1.2	Sat Nov  4 05:05:25 2000
--- openafs/src/ptserver/ptuser.c	Mon Apr 23 02:26:43 2001
***************
*** 23,29 ****
  #include "../afs/ptclient.h"
  #include "../afs/pterror.h"
  
- #include "../afs/permit_xprt.h"
  #else /* defined(UKERNEL) */
  #include <afs/param.h>
  #include <afs/stds.h>
--- 23,28 ----
***************
*** 43,50 ****
  #include <afs/afsutil.h>
  #include "ptclient.h"
  #include "pterror.h"
- 
- #include "../permit_xprt.h"
  #endif /* defined(UKERNEL) */
  
  
--- 42,47 ----
Index: openafs/src/ptserver/ptutils.c
diff -c openafs/src/ptserver/ptutils.c:1.2.2.2 openafs/src/ptserver/ptutils.c:1.2.2.3
*** openafs/src/ptserver/ptutils.c:1.2.2.2	Fri Jan 19 05:09:39 2001
--- openafs/src/ptserver/ptutils.c	Mon Apr 23 02:12:39 2001
***************
*** 167,172 ****
--- 167,174 ----
      } else if (aid < 0) {		/* checking on group */
  	if ((flags & mem) && IsAMemberOf (ut, cid, aid)) return 1;
      }
+     /* Allow members of SYSVIEWERID to get membership and status only */
+     if (((mem == PRP_STATUS_MEM)||(mem == PRP_MEMBER_MEM))&&(IsAMemberOf (ut, cid, SYSVIEWERID))) return 1;
      if (IsAMemberOf (ut, cid, SYSADMINID)) return 1;
      return 0;				/* no access */
  }
***************
*** 1048,1053 ****
--- 1050,1056 ----
      InitialGroup (SYSBACKUPID, "system:backup");
      InitialGroup (ANYUSERID, "system:anyuser");
      InitialGroup (AUTHUSERID, "system:authuser");
+     InitialGroup (SYSVIEWERID, "system:ptsviewers");
      InitialGroup (ANONYMOUSID, "anonymous");
  
      /* Well, we don't really want the max id set to anonymousid, so we'll set
Index: openafs/src/rcp/Makefile
diff -c openafs/src/rcp/Makefile:1.1.6.1 openafs/src/rcp/Makefile:1.1.6.2
*** openafs/src/rcp/Makefile:1.1.6.1	Fri Jan 19 04:12:28 2001
--- openafs/src/rcp/Makefile	Mon Apr 23 00:07:38 2001
***************
*** 24,30 ****
  OBJS=   rcp.o ../rsh/rcmd.o ../rsh/herror.o ../inetd/ta-rauth.o
  COMPONENT=rcp
  
- INSTALL = ${DESTDIR}bin/install
  CFLAGS = ${OPTMZ} -I${DESTDIR}include ${XCFLAGS}
  LIBDIR = ${DESTDIR}lib/
  AFSLIBS =  ${LIBDIR}afs/libkauth.a ${LIBDIR}libubik.a\
--- 24,29 ----
Index: openafs/src/rcp/rcp.c
diff -c openafs/src/rcp/rcp.c:1.1 openafs/src/rcp/rcp.c:1.1.6.2
*** openafs/src/rcp/rcp.c:1.1	Fri Nov  3 21:28:50 2000
--- openafs/src/rcp/rcp.c	Mon Apr 23 03:30:23 2001
***************
*** 78,84 ****
  int	rem;
  char	*colon(), *index(), *rindex(), *malloc(), *strcpy();
  int	errs;
! #ifndef AFS_LINUX20_ENV
  extern char *sys_errlist[];
  #endif
  void	lostconn();
--- 78,84 ----
  int	rem;
  char	*colon(), *index(), *rindex(), *malloc(), *strcpy();
  int	errs;
! #if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  extern char *sys_errlist[];
  #endif
  void	lostconn();
Index: openafs/src/rlogind/Makefile
diff -c openafs/src/rlogind/Makefile:1.1.6.1 openafs/src/rlogind/Makefile:1.1.6.2
*** openafs/src/rlogind/Makefile:1.1.6.1	Fri Jan 19 04:12:31 2001
--- openafs/src/rlogind/Makefile	Mon Apr 23 00:07:42 2001
***************
*** 25,31 ****
  SRCS=	rlogind.c ../rsh/rcmd.c ../rsh/herror.c ../inetd/ta-rauth.c
  OBJS=	rlogind.o ../rsh/rcmd.o ../rsh/herror.o ../inetd/ta-rauth.o
  MAN=
- INSTALL = ${DESTDIR}bin/install
  LIBDIR = ${DESTDIR}lib/
  AFSLIBS =  ${LIBDIR}afs/libkauth.a ${LIBDIR}afs/libprot.a ${LIBDIR}libubik.a\
  		   ${LIBDIR}afs/libauth.a ${DESTDIR}lib/librxkad.a ${LIBDIR}afs/libsys.a \
--- 25,30 ----
Index: openafs/src/rsh/Makefile
diff -c openafs/src/rsh/Makefile:1.1.6.1 openafs/src/rsh/Makefile:1.1.6.2
*** openafs/src/rsh/Makefile:1.1.6.1	Fri Jan 19 04:12:34 2001
--- openafs/src/rsh/Makefile	Mon Apr 23 00:07:49 2001
***************
*** 20,26 ****
  COMPONENT=rsh
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL = ${SRCDIR}bin/install
  LIBDIR = ${DESTDIR}lib/
  INCLUDES= -I${SRCDIR}include
  CFLAGS=	${DBUG} ${INCLUDES} ${XCFLAGS}
--- 20,25 ----
Index: openafs/src/rsh/herror.c
diff -c openafs/src/rsh/herror.c:1.1 openafs/src/rsh/herror.c:1.1.6.1
*** openafs/src/rsh/herror.c:1.1	Fri Nov  3 21:28:52 2000
--- openafs/src/rsh/herror.c	Mon Apr 23 00:07:50 2001
***************
*** 20,25 ****
--- 20,26 ----
  #endif /* LIBC_SCCS and not lint */
  
  #include <afs/param.h>
+ #ifndef AFS_DARWIN_ENV
  #include <sys/types.h>
  #include <sys/uio.h>
  
***************
*** 64,66 ****
--- 65,68 ----
  	v->iov_len = 1;
  	writev(2, iov, (v - iov) + 1);
  }
+ #endif
Index: openafs/src/rsh/rcmd.c
diff -c openafs/src/rsh/rcmd.c:1.1.6.1 openafs/src/rsh/rcmd.c:1.1.6.3
*** openafs/src/rsh/rcmd.c:1.1.6.1	Wed Dec 13 16:50:01 2000
--- openafs/src/rsh/rcmd.c	Mon Apr 23 03:30:29 2001
***************
*** 97,103 ****
  #endif
  	char **ahost;
          u_short rport;
! #ifdef AFS_LINUX20_ENV
  	const char *locuser, *remuser, *cmd;
  #else
  	char *locuser, *remuser, *cmd;
--- 97,103 ----
  #endif
  	char **ahost;
          u_short rport;
! #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  	const char *locuser, *remuser, *cmd;
  #else
  	char *locuser, *remuser, *cmd;
***************
*** 359,365 ****
  
  int	_check_rhosts_file = 1;
  
! #if defined(AFS_HPUX102_ENV) || defined(AFS_LINUX20_ENV)
  ruserok(rhost, superuser, ruser, luser)
          const char *rhost;
          int superuser;
--- 359,365 ----
  
  int	_check_rhosts_file = 1;
  
! #if defined(AFS_HPUX102_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  ruserok(rhost, superuser, ruser, luser)
          const char *rhost;
          int superuser;
Index: openafs/src/rx/Makefile
diff -c openafs/src/rx/Makefile:1.4.2.2 openafs/src/rx/Makefile:1.4.2.5
*** openafs/src/rx/Makefile:1.4.2.2	Tue Mar  6 16:38:51 2001
--- openafs/src/rx/Makefile	Mon Apr 23 03:30:35 2001
***************
*** 11,17 ****
  
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
- INSTALL=${SRCDIR}bin/install
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
  #CC=pcc
--- 11,16 ----
***************
*** 82,89 ****
  
  rxdumptrace: rx_trace.c
  	rm -f rxdumptrace
! 	$(CC) $(CFLAGS) -DDUMPTRACE -o rxdumptrace rx_trace.c  ${LIBS} ${XLIBS}
! 	rm -f rx_trace.o
  
  rx_getaddr.o: rx.h rx_getaddr.c
  
--- 81,88 ----
  
  rxdumptrace: rx_trace.c
  	rm -f rxdumptrace
! 	$(CC) $(CFLAGS) -DDUMPTRACE -c -o rxdumptrace.o rx_trace.c
! 	$(CC) $(CFLAGS) -o rxdumptrace rxdumptrace.o  ${LIBS} ${XLIBS}
  
  rx_getaddr.o: rx.h rx_getaddr.c
  
***************
*** 123,136 ****
  	case ${SYS_NAME} in \
  	alpha_dux* ) \
  		$(INSTALL) DUX/*.[ch] $(KERNELDIR)rx;; \
! 	hp_ux* ) \
! 		$(INSTALL) HPUX/*.[ch] $(KERNELDIR)rx;; \
  	*_linux* ) \
  		$(INSTALL) LINUX/*.[ch] $(KERNELDIR)rx;; \
  	rs_aix* ) \
  		$(INSTALL) AIX/*.[ch] $(KERNELDIR)rx;; \
  	sgi_* ) \
  		$(INSTALL) IRIX/*.[ch] $(KERNELDIR)rx;; \
  	sun4x_5* ) \
  		$(INSTALL) SOLARIS/*.[ch]  $(KERNELDIR)rx;; \
  	* ) \
--- 122,137 ----
  	case ${SYS_NAME} in \
  	alpha_dux* ) \
  		$(INSTALL) DUX/*.[ch] $(KERNELDIR)rx;; \
! 	i386_fbsd* ) \
! 		$(INSTALL) FBSD/*.[ch] $(KERNELDIR)rx;; \
  	*_linux* ) \
  		$(INSTALL) LINUX/*.[ch] $(KERNELDIR)rx;; \
  	rs_aix* ) \
  		$(INSTALL) AIX/*.[ch] $(KERNELDIR)rx;; \
  	sgi_* ) \
  		$(INSTALL) IRIX/*.[ch] $(KERNELDIR)rx;; \
+ 	ppc_darwin* ) \
+ 		$(INSTALL) DARWIN/*.[ch]  $(KERNELDIR)rx;; \
  	sun4x_5* ) \
  		$(INSTALL) SOLARIS/*.[ch]  $(KERNELDIR)rx;; \
  	* ) \
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.2.2.4 openafs/src/rx/rx.c:1.2.2.8
*** openafs/src/rx/rx.c:1.2.2.4	Tue Mar  6 16:58:46 2001
--- openafs/src/rx/rx.c	Mon Apr 23 03:13:00 2001
***************
*** 95,100 ****
--- 95,103 ----
  extern afs_uint32 LWP_ThreadId();
  #endif /* RXDEBUG */
  
+ int (*registerProgram)() = 0;
+ int (*swapNameProgram)() = 0;
+ 
  #ifdef	AFS_GLOBAL_RXLOCK_KERNEL
  struct rx_tq_debug {
      afs_int32 rxi_start_aborted; /* rxi_start awoke after rxi_Send in error. */
***************
*** 252,258 ****
  ** pretty good that the next packet coming in is from the same connection 
  ** as the last packet, since we're send multiple packets in a transmit window.
  */
! struct rx_connection *rxLastConn; 
  
  #ifdef RX_ENABLE_LOCKS
  /* The locking hierarchy for rx fine grain locking is composed of five
--- 255,261 ----
  ** pretty good that the next packet coming in is from the same connection 
  ** as the last packet, since we're send multiple packets in a transmit window.
  */
! struct rx_connection *rxLastConn = 0; 
  
  #ifdef RX_ENABLE_LOCKS
  /* The locking hierarchy for rx fine grain locking is composed of five
***************
*** 618,624 ****
  void rx_StartServer(donateMe)
  {
      register struct rx_service *service;
!     register int i;
      SPLVAR;
      clock_NewTime();
  
--- 621,627 ----
  void rx_StartServer(donateMe)
  {
      register struct rx_service *service;
!     register int i, nProcs;
      SPLVAR;
      clock_NewTime();
  
***************
*** 651,658 ****
  
      AFS_RXGUNLOCK();
      USERPRI;
  
!     if (donateMe) rx_ServerProc(); /* Never returns */
      return;
  }
  
--- 654,680 ----
  
      AFS_RXGUNLOCK();
      USERPRI;
+ 
+     if (donateMe) {
+ #ifndef AFS_NT40_ENV
+ #ifndef KERNEL
+ 	int code;
+         char name[32];
+ #ifdef AFS_PTHREAD_ENV
+         pid_t pid;
+         pid = pthread_self();
+ #else /* AFS_PTHREAD_ENV */
+         PROCESS pid;
+         code = LWP_CurrentProcess(&pid);
+ #endif /* AFS_PTHREAD_ENV */
  
!         sprintf(name,"srv_%d", ++nProcs);
! 	if (registerProgram)
!             (*registerProgram)(pid, name);
! #endif /* KERNEL */
! #endif /* AFS_NT40_ENV */
! 	rx_ServerProc(); /* Never returns */
!     }
      return;
  }
  
***************
*** 3151,3157 ****
      } else if (call->nSoftAcks > (u_short)rxi_SoftAckRate) {
  	rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY);
  	np = rxi_SendAck(call, np, seq, serial, flags,
! 			 RX_ACK_DELAY, istack);
      } else if (call->nSoftAcks) {
  	clock_GetTime(&when);
  	if (haveLast && !(flags & RX_CLIENT_INITIATED)) {
--- 3173,3179 ----
      } else if (call->nSoftAcks > (u_short)rxi_SoftAckRate) {
  	rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY);
  	np = rxi_SendAck(call, np, seq, serial, flags,
! 			 RX_ACK_IDLE, istack);
      } else if (call->nSoftAcks) {
  	clock_GetTime(&when);
  	if (haveLast && !(flags & RX_CLIENT_INITIATED)) {
***************
*** 3267,3279 ****
  	if (tp->header.seq >= first) break;
  	call->tfirst = tp->header.seq + 1;
  	if (tp->header.serial == serial) {
! 	  rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
  #ifdef ADAPT_WINDOW
  	  rxi_ComputeRate(peer, call, tp, np, ap->reason);
  #endif
  	}
! 	else if ((tp->firstSerial == serial)) {
! 	  rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
  #ifdef ADAPT_WINDOW
  	  rxi_ComputeRate(peer, call, tp, np, ap->reason);
  #endif
--- 3289,3305 ----
  	if (tp->header.seq >= first) break;
  	call->tfirst = tp->header.seq + 1;
  	if (tp->header.serial == serial) {
! 	  /* Use RTT if not delayed by client. */
! 	  if (ap->reason != RX_ACK_DELAY)
! 	      rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
  #ifdef ADAPT_WINDOW
  	  rxi_ComputeRate(peer, call, tp, np, ap->reason);
  #endif
  	}
! 	else if (tp->firstSerial == serial) {
! 	    /* Use RTT if not delayed by client. */
! 	    if (ap->reason != RX_ACK_DELAY)
! 		rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
  #ifdef ADAPT_WINDOW
  	  rxi_ComputeRate(peer, call, tp, np, ap->reason);
  #endif
***************
*** 3334,3346 ****
  #endif /* RX_ENABLE_LOCKS */
  #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
  	if (tp->header.serial == serial) {
! 	  rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
  #ifdef ADAPT_WINDOW
  	  rxi_ComputeRate(peer, call, tp, np, ap->reason);
  #endif
  	}
  	else if ((tp->firstSerial == serial)) {
! 	  rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
  #ifdef ADAPT_WINDOW
  	  rxi_ComputeRate(peer, call, tp, np, ap->reason);
  #endif
--- 3360,3376 ----
  #endif /* RX_ENABLE_LOCKS */
  #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
  	if (tp->header.serial == serial) {
! 	    /* Use RTT if not delayed by client. */
! 	    if (ap->reason != RX_ACK_DELAY)
! 		rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
  #ifdef ADAPT_WINDOW
  	  rxi_ComputeRate(peer, call, tp, np, ap->reason);
  #endif
  	}
  	else if ((tp->firstSerial == serial)) {
! 	    /* Use RTT if not delayed by client. */
! 	    if (ap->reason != RX_ACK_DELAY)
! 		rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
  #ifdef ADAPT_WINDOW
  	  rxi_ComputeRate(peer, call, tp, np, ap->reason);
  #endif
***************
*** 3820,3826 ****
  	if (call->flags & RX_CALL_CLEARED) {
  	    /* send an ack now to start the packet flow up again */
  	    call->flags &= ~RX_CALL_CLEARED;
! 	    rxi_SendAck(call, 0, 0, 0, 0, RX_ACK_DELAY, 0);
  	}
  #ifdef	RX_ENABLE_LOCKS
  	CV_SIGNAL(&sq->cv);
--- 3850,3856 ----
  	if (call->flags & RX_CALL_CLEARED) {
  	    /* send an ack now to start the packet flow up again */
  	    call->flags &= ~RX_CALL_CLEARED;
! 	    rxi_SendAck(call, 0, 0, 0, 0, RX_ACK_IDLE, 0);
  	}
  #ifdef	RX_ENABLE_LOCKS
  	CV_SIGNAL(&sq->cv);
***************
*** 4447,4453 ****
  }
  
  /* Send all of the packets in the list in single datagram */
! static void rxi_SendList(call, list, len, istack, moreFlag, now, retryTime)
    struct rx_call *call;
    struct rx_packet **list;
    int len;
--- 4477,4483 ----
  }
  
  /* Send all of the packets in the list in single datagram */
! static void rxi_SendList(call, list, len, istack, moreFlag, now, retryTime, resending)
    struct rx_call *call;
    struct rx_packet **list;
    int len;
***************
*** 4455,4460 ****
--- 4485,4491 ----
    int moreFlag;
    struct clock *now;
    struct clock *retryTime;
+   int resending;
  {
      int i;
      int requestAck = 0;
***************
*** 4464,4469 ****
--- 4495,4501 ----
  
      MUTEX_ENTER(&peer->peer_lock);
      peer->nSent += len;
+     if (resending) peer->reSends += len;
      MUTEX_ENTER(&rx_stats_mutex);
      rx_stats.dataPacketsSent += len;
      MUTEX_EXIT(&rx_stats_mutex);
***************
*** 4517,4522 ****
--- 4549,4555 ----
  
  	MUTEX_ENTER(&peer->peer_lock);
  	peer->nSent++;
+ 	if (resending) peer->reSends++;
  	MUTEX_ENTER(&rx_stats_mutex);
  	rx_stats.dataPacketsSent++;
  	MUTEX_EXIT(&rx_stats_mutex);
***************
*** 4565,4577 ****
   * We always keep the last list we should have sent so we
   * can set the RX_MORE_PACKETS flags correctly.
   */
! static void rxi_SendXmitList(call, list, len, istack, now, retryTime)
    struct rx_call *call;
    struct rx_packet **list;
    int len;
    int istack;
    struct clock *now;
    struct clock *retryTime;
  {
      int i, cnt, lastCnt = 0;
      struct rx_packet **listP, **lastP = 0;
--- 4598,4611 ----
   * We always keep the last list we should have sent so we
   * can set the RX_MORE_PACKETS flags correctly.
   */
! static void rxi_SendXmitList(call, list, len, istack, now, retryTime, resending)
    struct rx_call *call;
    struct rx_packet **list;
    int len;
    int istack;
    struct clock *now;
    struct clock *retryTime;
+   int resending;
  {
      int i, cnt, lastCnt = 0;
      struct rx_packet **listP, **lastP = 0;
***************
*** 4585,4591 ****
  		|| list[i]->acked
  		|| list[i]->length > RX_JUMBOBUFFERSIZE)) {
  	    if (lastCnt > 0) {
! 		rxi_SendList(call, lastP, lastCnt, istack, 1, now, retryTime);
  		/* If the call enters an error state stop sending, or if
  		 * we entered congestion recovery mode, stop sending */
  		if (call->error || (call->flags & RX_CALL_FAST_RECOVER_WAIT))
--- 4619,4625 ----
  		|| list[i]->acked
  		|| list[i]->length > RX_JUMBOBUFFERSIZE)) {
  	    if (lastCnt > 0) {
! 		rxi_SendList(call, lastP, lastCnt, istack, 1, now, retryTime, resending);
  		/* If the call enters an error state stop sending, or if
  		 * we entered congestion recovery mode, stop sending */
  		if (call->error || (call->flags & RX_CALL_FAST_RECOVER_WAIT))
***************
*** 4608,4614 ****
  		|| list[i]->length != RX_JUMBOBUFFERSIZE) {
  		if (lastCnt > 0) {
  		    rxi_SendList(call, lastP, lastCnt, istack, 1,
! 				 now, retryTime);
  		    /* If the call enters an error state stop sending, or if
  		     * we entered congestion recovery mode, stop sending */
  		    if (call->error || (call->flags&RX_CALL_FAST_RECOVER_WAIT))
--- 4642,4648 ----
  		|| list[i]->length != RX_JUMBOBUFFERSIZE) {
  		if (lastCnt > 0) {
  		    rxi_SendList(call, lastP, lastCnt, istack, 1,
! 				 now, retryTime, resending);
  		    /* If the call enters an error state stop sending, or if
  		     * we entered congestion recovery mode, stop sending */
  		    if (call->error || (call->flags&RX_CALL_FAST_RECOVER_WAIT))
***************
*** 4643,4659 ****
  	}
  	if (lastCnt > 0) {
  	    rxi_SendList(call, lastP, lastCnt, istack, morePackets,
! 			 now, retryTime);
  	    /* If the call enters an error state stop sending, or if
  	     * we entered congestion recovery mode, stop sending */
  	    if (call->error || (call->flags & RX_CALL_FAST_RECOVER_WAIT))
  	        return;
  	}
  	if (morePackets) {
! 	    rxi_SendList(call, listP, cnt, istack, 0, now, retryTime);
  	}
      } else if (lastCnt > 0) {
! 	rxi_SendList(call, lastP, lastCnt, istack, 0, now, retryTime);
      }
  }
  
--- 4677,4693 ----
  	}
  	if (lastCnt > 0) {
  	    rxi_SendList(call, lastP, lastCnt, istack, morePackets,
! 			 now, retryTime, resending);
  	    /* If the call enters an error state stop sending, or if
  	     * we entered congestion recovery mode, stop sending */
  	    if (call->error || (call->flags & RX_CALL_FAST_RECOVER_WAIT))
  	        return;
  	}
  	if (morePackets) {
! 	    rxi_SendList(call, listP, cnt, istack, 0, now, retryTime, resending);
  	}
      } else if (lastCnt > 0) {
! 	rxi_SendList(call, lastP, lastCnt, istack, 0, now, retryTime, resending);
      }
  }
  
***************
*** 4688,4693 ****
--- 4722,4728 ----
      int nXmitPackets;
      int maxXmitPackets;
      struct rx_packet **xmitList;
+     int resending = 0;
  
      /* If rxi_Start is being called as a result of a resend event,
       * then make sure that the event pointer is removed from the call
***************
*** 4696,4701 ****
--- 4731,4737 ----
      if (event && event == call->resendEvent) {
  	CALL_RELE(call, RX_CALL_REFCOUNT_RESEND);
  	call->resendEvent = NULL;
+ 	resending = 1;
  	if (queue_IsEmpty(&call->tq)) {
  	    /* Nothing to do */
  	    return;
***************
*** 4845,4851 ****
  	 * ready to send. Now we loop to send the packets */
  	if (nXmitPackets > 0) {
  	    rxi_SendXmitList(call, xmitList, nXmitPackets, istack,
! 			     &now, &retryTime);
  	}
  	osi_Free(xmitList, maxXmitPackets * sizeof(struct rx_packet *));
  
--- 4881,4887 ----
  	 * ready to send. Now we loop to send the packets */
  	if (nXmitPackets > 0) {
  	    rxi_SendXmitList(call, xmitList, nXmitPackets, istack,
! 			     &now, &retryTime, resending);
  	}
  	osi_Free(xmitList, maxXmitPackets * sizeof(struct rx_packet *));
  
***************
*** 5265,5274 ****
  {
  	struct clock thisRtt, *rttp = &thisRtt;
  
        register int rtt_timeout;
        static char id[]="@(#)adaptive RTO";
  
!     clock_GetTime(rttp);
      if (clock_Lt(rttp, sentp)) {
        clock_Zero(rttp);
        return;     /* somebody set the clock back, don't count this time. */
--- 5301,5321 ----
  {
  	struct clock thisRtt, *rttp = &thisRtt;
  
+ #if defined(AFS_ALPHA_LINUX22_ENV) && defined(AFS_PTHREAD_ENV) && !defined(KERNEL)
+ 	/* making year 2038 bugs to get this running now - stroucki */
+ 	struct timeval temptime;
+ #endif
        register int rtt_timeout;
        static char id[]="@(#)adaptive RTO";
  
! #if defined(AFS_ALPHA_LINUX20_ENV) && defined(AFS_PTHREAD_ENV) && !defined(KERNEL)
!       /* yet again. This was the worst Heisenbug of the port - stroucki */
!       clock_GetTime(&temptime);
!       rttp->sec=(afs_int32)temptime.tv_sec;
!       rttp->usec=(afs_int32)temptime.tv_usec;
! #else
!       clock_GetTime(rttp);
! #endif
      if (clock_Lt(rttp, sentp)) {
        clock_Zero(rttp);
        return;     /* somebody set the clock back, don't count this time. */
Index: openafs/src/rx/rx.h
diff -c openafs/src/rx/rx.h:1.2 openafs/src/rx/rx.h:1.2.2.1
*** openafs/src/rx/rx.h:1.2	Sat Nov  4 05:05:29 2000
--- openafs/src/rx/rx.h	Sun Apr 22 23:54:51 2001
***************
*** 690,695 ****
--- 690,697 ----
  #define	RX_ACK_PING		6   /* This is a keep-alive ack */
  #define	RX_ACK_PING_RESPONSE	7   /* Ack'ing because we were pinged */
  #define	RX_ACK_DELAY		8   /* Ack generated since nothing has happened since receiving packet */
+ #define RX_ACK_IDLE             9   /* Similar to RX_ACK_DELAY, but can 
+ 					      be */
  
  /* Packet acknowledgement type */ 
  #define	RX_ACK_TYPE_NACK	0   /* I Don't have this packet */
Index: openafs/src/rx/rx_getaddr.c
diff -c openafs/src/rx/rx_getaddr.c:1.2 openafs/src/rx/rx_getaddr.c:1.2.2.2
*** openafs/src/rx/rx_getaddr.c:1.2	Sat Nov  4 05:05:31 2000
--- openafs/src/rx/rx_getaddr.c	Mon Apr 23 03:30:35 2001
***************
*** 20,25 ****
--- 20,31 ----
  #include <net/if.h>
  #include <netinet/in.h>
  #include <sys/ioctl.h>
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include <sys/sysctl.h>
+ #include <net/route.h>
+ #include <net/if_dl.h>
+ #endif
+ 
  /*
   * By including this, we get any system dependencies. In particular,
   * the pthreads for solaris requires the socket call to be mapped.
***************
*** 100,112 ****
--- 106,325 ----
  #undef socket
  #endif /* UKERNEL */
  
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #define ROUNDUP(a) \
+         ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+ #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
+ 
+ static void
+ rt_xaddrs(cp, cplim, rtinfo)
+         caddr_t cp, cplim;
+         struct rt_addrinfo *rtinfo;
+ {
+         struct sockaddr *sa;
+         int i;
+ 
+         memset(rtinfo->rti_info, 0, sizeof(rtinfo->rti_info));
+         for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) {
+                 if ((rtinfo->rti_addrs & (1 << i)) == 0)
+                         continue;
+                 rtinfo->rti_info[i] = sa = (struct sockaddr *)cp;
+                 ADVANCE(cp, sa);
+         }
+ }
+ #endif
+ 
+ 
  /* this function returns the total number of interface addresses 
  ** the buffer has to be passed in by the caller
  */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  int rx_getAllAddr (buffer,maxSize)
  afs_int32	buffer[];
  int 	maxSize;	/* sizeof of buffer in afs_int32 units */
  {
+      size_t needed;
+      int mib[6];
+      struct  if_msghdr *ifm, *nextifm;
+      struct  ifa_msghdr *ifam;
+      struct  sockaddr_dl *sdl;
+      struct  rt_addrinfo info;
+      char    *buf, *lim, *next;
+      int count=0,addrcount=0;
+      
+      mib[0] = CTL_NET;
+      mib[1] = PF_ROUTE;
+      mib[2] = 0;
+      mib[3] = AF_INET;     /* address family */
+      mib[4] = NET_RT_IFLIST;
+      mib[5] = 0;
+      if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+           return 0;
+      if ((buf = malloc(needed)) == NULL)
+           return 0;
+      if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
+           free(buf);
+           return 0;
+      }
+      lim = buf + needed;
+      next = buf;
+      while (next < lim) {
+           ifm = (struct if_msghdr *)next;
+           if (ifm->ifm_type != RTM_IFINFO) {
+                printf("out of sync parsing NET_RT_IFLIST\n");
+                free(buf);
+                return 0;
+           }
+           sdl = (struct sockaddr_dl *)(ifm + 1);
+           next += ifm->ifm_msglen;
+           ifam = NULL;
+           addrcount = 0;
+           while (next < lim) {
+                nextifm = (struct if_msghdr *)next;
+                if (nextifm->ifm_type != RTM_NEWADDR)
+                     break;
+                if (ifam == NULL)
+                     ifam = (struct ifa_msghdr *)nextifm;
+                addrcount++;
+                next += nextifm->ifm_msglen;
+           }
+           if ((ifm->ifm_flags & IFF_UP) == 0)
+                continue; /* not up */
+           if (ifm->ifm_flags & IFF_LOOPBACK) {
+                continue;        /* skip aliased loopbacks as well. */
+           }
+           while (addrcount > 0) {
+                struct sockaddr_in *a;
+                
+                info.rti_addrs = ifam->ifam_addrs;
+                
+                /* Expand the compacted addresses */
+                rt_xaddrs((char *)(ifam + 1), ifam->ifam_msglen + (char *)ifam,
+                          &info);
+                if (info.rti_info[RTAX_IFA]->sa_family != AF_INET)
+                     continue;
+                a=info.rti_info[RTAX_IFA];
+                
+                if ( count >= maxSize )  /* no more space */
+                     printf("Too many interfaces..ignoring 0x%x\n",
+                            a->sin_addr.s_addr);
+                else
+                     buffer[count++] = a->sin_addr.s_addr;
+                addrcount--;
+                ifam = (struct ifa_msghdr *)((char *)ifam + ifam->ifam_msglen);
+           }
+      }
+      free(buf);
+      return count;
+ }
+ int rxi_getAllAddrMaskMtu (addrBuffer, maskBuffer, mtuBuffer, maxSize)
+    afs_int32   addrBuffer[];   /* the network addrs in net byte order */
+    afs_int32   maskBuffer[];   /* the subnet masks */
+    afs_int32   mtuBuffer[];    /* the MTU sizes */
+    int     maxSize;        /* sizeof of buffer in afs_int32 units */
+ {
+     int     s;
+      
+      size_t needed;
+      int mib[6];
+      struct  if_msghdr *ifm, *nextifm;
+      struct  ifa_msghdr *ifam;
+      struct  sockaddr_dl *sdl;
+      struct  rt_addrinfo info;
+      char    *buf, *lim, *next;
+      int count=0,addrcount=0;
+ 
+      mib[0] = CTL_NET;
+      mib[1] = PF_ROUTE;
+      mib[2] = 0;
+      mib[3] = AF_INET;     /* address family */
+      mib[4] = NET_RT_IFLIST;
+      mib[5] = 0;
+      if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+           return 0;
+      if ((buf = malloc(needed)) == NULL)
+           return 0;
+      if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
+           free(buf);
+           return 0;
+      }
+      s=socket(PF_INET, SOCK_DGRAM, 0);
+      if (s < 0)
+           return 0;
+      lim = buf + needed;
+      next = buf;
+      while (next < lim) {
+           ifm = (struct if_msghdr *)next;
+           if (ifm->ifm_type != RTM_IFINFO) {
+                printf("out of sync parsing NET_RT_IFLIST\n");
+                free(buf);
+                return 0;
+           }
+           sdl = (struct sockaddr_dl *)(ifm + 1);
+           next += ifm->ifm_msglen;
+           ifam = NULL;
+           addrcount = 0;
+           while (next < lim) {
+                nextifm = (struct if_msghdr *)next;
+                if (nextifm->ifm_type != RTM_NEWADDR)
+                     break;
+                if (ifam == NULL)
+                     ifam = (struct ifa_msghdr *)nextifm;
+                addrcount++;
+                next += nextifm->ifm_msglen;
+           }
+           if ((ifm->ifm_flags & IFF_UP) == 0)
+                continue; /* not up */
+           if (ifm->ifm_flags & IFF_LOOPBACK) {
+                continue;        /* skip aliased loopbacks as well. */
+           }
+           while (addrcount > 0) {
+                struct sockaddr_in *a;
+                
+                info.rti_addrs = ifam->ifam_addrs;
+                
+                /* Expand the compacted addresses */
+                rt_xaddrs((char *)(ifam + 1), ifam->ifam_msglen + (char *)ifam,
+                          &info);
+                if (info.rti_info[RTAX_IFA]->sa_family != AF_INET)
+                     continue;
+                a=info.rti_info[RTAX_IFA];
+                
+                if ( count >= maxSize ) {  /* no more space */
+                     printf("Too many interfaces..ignoring 0x%x\n",
+                            a->sin_addr.s_addr);
+                } else {
+                     struct ifreq ifr;
+                     
+                     addrBuffer[count] = a->sin_addr.s_addr;
+                     a=info.rti_info[RTAX_NETMASK];
+                     if (a)
+                          maskBuffer[count]=a->sin_addr.s_addr;
+                     else
+                          maskBuffer[count] = htonl(0xffffffff);
+                     memset(&ifr, sizeof(ifr), 0);
+                     ifr.ifr_addr.sa_family=AF_INET;
+                     strncpy(ifr.ifr_name, sdl->sdl_data, sdl->sdl_nlen);
+                     if (ioctl(s, SIOCGIFMTU, (caddr_t)&ifr) < 0)
+                          mtuBuffer[count]=1500;
+                     else
+                          mtuBuffer[count]=ifr.ifr_mtu;
+                     count++;
+                }
+                addrcount--;
+                ifam = (struct ifa_msghdr *)((char *)ifam + ifam->ifam_msglen);
+           }
+      }
+      free(buf);
+      return count;
+ }
+ 
+      
+ #else
+ int rx_getAllAddr (buffer,maxSize)
+ afs_int32      buffer[];
+ int    maxSize;        /* sizeof of buffer in afs_int32 units */
+ {
      int     s;
      int     i, len, count=0;
      struct ifconf   ifc;
***************
*** 125,137 ****
      len = ifc.ifc_len / sizeof(struct ifreq);
      if (len > NIFS)
  	len = NIFS;
! #if	defined(AFS_AIX41_ENV)
      if ( ifc.ifc_len > sizeof(ifs) ) 	/* safety check */
  	ifc.ifc_len = sizeof(ifs); 
      for ( cp = (char *)ifc.ifc_buf, 
  		cplim= ifc.ifc_buf+ifc.ifc_len;
  		cp < cplim;
! 		cp += sizeof(ifr->ifr_name) + MAX(a->sin_len, sizeof(*a))){
  	ifr = (struct ifreq *)cp;
  #else
      for (i = 0; i < len; ++i) {
--- 338,355 ----
      len = ifc.ifc_len / sizeof(struct ifreq);
      if (len > NIFS)
  	len = NIFS;
! #if    defined(AFS_AIX41_ENV) || defined (AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
      if ( ifc.ifc_len > sizeof(ifs) ) 	/* safety check */
  	ifc.ifc_len = sizeof(ifs); 
      for ( cp = (char *)ifc.ifc_buf, 
  		cplim= ifc.ifc_buf+ifc.ifc_len;
  		cp < cplim;
! #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
! 	        cp += _SIZEOF_ADDR_IFREQ(*ifr))
! #else
!                 cp += sizeof(ifr->ifr_name) + MAX(a->sin_len, sizeof(*a)))
! #endif
!        {
  	ifr = (struct ifreq *)cp;
  #else
      for (i = 0; i < len; ++i) {
***************
*** 258,263 ****
--- 476,482 ----
     return count;
  #endif /* AFS_USERSPACE_IP_ADDR */
  }
+ #endif
  
  #endif /* ! AFS_NT40_ENV */
  #endif /* !KERNEL || UKERNEL */
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.2.2.1 openafs/src/rx/rx_kcommon.c:1.2.2.3
*** openafs/src/rx/rx_kcommon.c:1.2.2.1	Fri Jan 19 17:24:46 2001
--- openafs/src/rx/rx_kcommon.c	Mon Apr 23 03:30:35 2001
***************
*** 423,429 ****
   */
  
  
! #if ! defined(AFS_AIX_ENV) && ! defined(AFS_SUN5_ENV) && ! defined(UKERNEL) && ! defined(AFS_LINUX20_ENV)
  /* Routine called during the afsd "-shutdown" process to put things back to
   * the initial state.
   */
--- 423,429 ----
   */
  
  
! #if ! defined(AFS_AIX_ENV) && ! defined(AFS_SUN5_ENV) && ! defined(UKERNEL) && ! defined(AFS_LINUX20_ENV) && !defined (AFS_DARWIN_ENV) && !defined (AFS_FBSD_ENV)
  /* Routine called during the afsd "-shutdown" process to put things back to
   * the initial state.
   */
***************
*** 548,554 ****
  
  #else /* AFS_USERSPACE_IP_ADDR */
  
! #if !defined(AFS_AIX41_ENV) && !defined(AFS_DUX40_ENV)
  #define IFADDR2SA(f) (&((f)->ifa_addr))
  #else /* AFS_AIX41_ENV */
  #define IFADDR2SA(f) ((f)->ifa_addr)
--- 548,554 ----
  
  #else /* AFS_USERSPACE_IP_ADDR */
  
! #if !defined(AFS_AIX41_ENV) && !defined(AFS_DUX40_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #define IFADDR2SA(f) (&((f)->ifa_addr))
  #else /* AFS_AIX41_ENV */
  #define IFADDR2SA(f) ((f)->ifa_addr)
***************
*** 569,578 ****
--- 569,588 ----
      bzero(addrs, sizeof(addrs));
      bzero(mtus, sizeof(mtus));
  
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     TAILQ_FOREACH(ifn, &ifnet, if_link) {
+       if (i >= ADDRSPERSITE) break;
+ #else 
      for (ifn = ifnet; ifn != NULL && i < ADDRSPERSITE; ifn = ifn->if_next) {
+ #endif
        rxmtu = (ifn->if_mtu - RX_IPUDP_SIZE);
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+       TAILQ_FOREACH(ifad, &ifn->if_addrhead, ifa_link) {
+       if (i >= ADDRSPERSITE) break;
+ #else
        for (ifad = ifn->if_addrlist; ifad != NULL && i < ADDRSPERSITE;
  	   ifad = ifad->ifa_next){
+ #endif
  	if (IFADDR2SA(ifad)->sa_family == AF_INET) {
  	  ifinaddr = ntohl(((struct sockaddr_in *) IFADDR2SA(ifad))->sin_addr.s_addr);
  	  if (myNetAddrs[i] != ifinaddr) { 
***************
*** 626,639 ****
--- 636,661 ----
  
    /* if we're given an address, skip everything until we find it */
    if (!*pifad)
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     *pifad = TAILQ_FIRST(&in_ifaddrhead);
+ #else 
      *pifad = in_ifaddr;
+ #endif
    else {
      if (((ppaddr & (*pifad)->ia_subnetmask) == (*pifad)->ia_subnet))
        match_value = 2; /* don't find matching nets, just subnets */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     *pifad = TAILQ_NEXT(*pifad, ia_link);
+ #else   
      *pifad = (*pifad)->ia_next;
+ #endif
    }
      
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+   for (ifa = *pifad; ifa; ifa = TAILQ_NEXT(ifa, ia_link) ) {
+ #else
    for (ifa = *pifad; ifa; ifa = ifa->ia_next ) {
+ #endif
      if ((ppaddr & ifa->ia_netmask) == ifa->ia_net) {
        if ((ppaddr & ifa->ia_subnetmask) == ifa->ia_subnet) {
  	sin=IA_SIN(ifa);
***************
*** 691,696 ****
--- 713,721 ----
  #endif
  
      AFS_STATCNT(osi_NewSocket);
+ #if (defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL);
+ #endif
  #if	defined(AFS_HPUX102_ENV)
  #if     defined(AFS_HPUX110_ENV)
      /* blocking socket */
***************
*** 701,711 ****
  #else
  #ifdef AFS_SGI65_ENV
      code = socreate(AF_INET, &newSocket, SOCK_DGRAM,IPPROTO_UDP);
  #else
      code = socreate(AF_INET, &newSocket, SOCK_DGRAM, 0);
  #endif /* AFS_SGI65_ENV */
  #endif /* AFS_HPUX102_ENV */
!     if (code) return (struct osi_socket *) 0;
  
      myaddr.sin_family = AF_INET;
      myaddr.sin_port = aport;
--- 726,738 ----
  #else
  #ifdef AFS_SGI65_ENV
      code = socreate(AF_INET, &newSocket, SOCK_DGRAM,IPPROTO_UDP);
+ #elif defined(AFS_FBSD_ENV)
+     code = socreate(AF_INET, &newSocket, SOCK_DGRAM,IPPROTO_UDP, curproc);
  #else
      code = socreate(AF_INET, &newSocket, SOCK_DGRAM, 0);
  #endif /* AFS_SGI65_ENV */
  #endif /* AFS_HPUX102_ENV */
!     if (code) goto bad;
  
      myaddr.sin_family = AF_INET;
      myaddr.sin_port = aport;
***************
*** 715,721 ****
      bindnam = allocb_wait((addrsize+SO_MSGOFFSET+1), BPRI_MED);
      if (!bindnam) {
         setuerror(ENOBUFS);
!        return(struct osi_socket *) 0;
      }
      bcopy((caddr_t)&myaddr, (caddr_t)bindnam->b_rptr+SO_MSGOFFSET, addrsize);
      bindnam->b_wptr = bindnam->b_rptr + (addrsize+SO_MSGOFFSET+1);
--- 742,748 ----
      bindnam = allocb_wait((addrsize+SO_MSGOFFSET+1), BPRI_MED);
      if (!bindnam) {
         setuerror(ENOBUFS);
!        goto bad;
      }
      bcopy((caddr_t)&myaddr, (caddr_t)bindnam->b_rptr+SO_MSGOFFSET, addrsize);
      bindnam->b_wptr = bindnam->b_rptr + (addrsize+SO_MSGOFFSET+1);
***************
*** 724,730 ****
      if (code) {
         soclose(newSocket);
         m_freem(nam);
!        return(struct osi_socket *) 0;
      }
  
      freeb(bindnam);
--- 751,757 ----
      if (code) {
         soclose(newSocket);
         m_freem(nam);
!        goto bad;
      }
  
      freeb(bindnam);
***************
*** 735,750 ****
  	if (code)
  	    osi_Panic("osi_NewSocket: last attempt to reserve 32K failed!\n");
      }
  #ifdef  AFS_OSF_ENV
      nam = m_getclr(M_WAIT, MT_SONAME);
  #else   /* AFS_OSF_ENV */
      nam = m_get(M_WAIT, MT_SONAME);
  #endif
      if (nam == NULL) {
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_SGI64_ENV)
   	setuerror(ENOBUFS);
  #endif
! 	return (struct osi_socket *) 0;
      }
      nam->m_len = sizeof(myaddr);
  #ifdef  AFS_OSF_ENV
--- 762,790 ----
  	if (code)
  	    osi_Panic("osi_NewSocket: last attempt to reserve 32K failed!\n");
      }
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     myaddr.sin_len = sizeof(myaddr);
+ #if defined(AFS_FBSD_ENV)
+     code = sobind(newSocket, (struct sockaddr *)&myaddr, curproc);
+ #else
+     code = sobind(newSocket, (struct sockaddr *)&myaddr);
+ #endif
+     if (code) {
+         printf("sobind fails\n");
+         soclose(newSocket);
+         goto bad;
+     }
+ #else
  #ifdef  AFS_OSF_ENV
      nam = m_getclr(M_WAIT, MT_SONAME);
  #else   /* AFS_OSF_ENV */
      nam = m_get(M_WAIT, MT_SONAME);
  #endif
      if (nam == NULL) {
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_SGI64_ENV) && !defined(AFS_FBSD_ENV)
   	setuerror(ENOBUFS);
  #endif
! 	goto bad;
      }
      nam->m_len = sizeof(myaddr);
  #ifdef  AFS_OSF_ENV
***************
*** 755,760 ****
--- 795,802 ----
      BHV_PDATA(&bhv) = (void*)newSocket;
      code = sobind(&bhv, nam);
      m_freem(nam);
+ #elif defined(AFS_FBSD_ENV)
+     code = sobind(newSocket, nam, curproc);
  #else
      code = sobind(newSocket, nam);
  #endif
***************
*** 763,773 ****
  #ifndef AFS_SGI65_ENV
  	m_freem(nam);
  #endif
! 	return (struct osi_socket *) 0;
      }
  #endif /* else AFS_HPUX110_ENV */
  
      return (struct osi_socket *) newSocket;
  }
  
  
--- 805,825 ----
  #ifndef AFS_SGI65_ENV
  	m_freem(nam);
  #endif
! 	goto bad;
      }
+ #endif /* else AFS_DARWIN_ENV */
  #endif /* else AFS_HPUX110_ENV */
  
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
+ #endif
      return (struct osi_socket *) newSocket;
+ 
+ bad:
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
+ #endif
+     return (struct osi_socket *) 0;
  }
  
  
***************
*** 776,782 ****
--- 828,840 ----
      register struct socket *asocket;
  {
      AFS_STATCNT(osi_FreeSocket);
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL);
+ #endif
      soclose(asocket);
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
+ #endif
      return 0;
  }
  #endif /* !SUN5 && !LINUX20 */
***************
*** 938,943 ****
--- 996,1004 ----
  #ifdef AFS_SUN5_ENV
      rxk_ListenerPid = ttoproc(curthread)->p_pidp->pid_id;
  #endif /* AFS_SUN5_ENV */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+     rxk_ListenerPid = current_proc()->p_pid;
+ #endif
  #if defined(RX_ENABLE_LOCKS) && !defined(AFS_SUN5_ENV)
      AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS && !AFS_SUN5_ENV */
***************
*** 977,983 ****
  #endif /* AFS_SUN5_ENV */
  }
  
! #if !defined(AFS_LINUX20_ENV) && !defined(AFS_SUN5_ENV)
  /* The manner of stopping the rx listener thread may vary. Most unix's should
   * be able to call soclose.
   */
--- 1038,1044 ----
  #endif /* AFS_SUN5_ENV */
  }
  
! #if !defined(AFS_LINUX20_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  /* The manner of stopping the rx listener thread may vary. Most unix's should
   * be able to call soclose.
   */
Index: openafs/src/rx/rx_kcommon.h
diff -c openafs/src/rx/rx_kcommon.h:1.2 openafs/src/rx/rx_kcommon.h:1.2.2.2
*** openafs/src/rx/rx_kcommon.h:1.2	Sat Nov  4 05:05:31 2000
--- openafs/src/rx/rx_kcommon.h	Mon Apr 23 03:30:36 2001
***************
*** 14,19 ****
--- 14,25 ----
  #ifndef _RX_KCOMMON_H_
  #define _RX_KCOMMON_H_
  
+ #ifdef AFS_DARWIN_ENV
+ #ifndef _MACH_ETAP_H_
+ #define _MACH_ETAP_H_
+ typedef unsigned short                  etap_event_t;
+ #endif
+ #endif  
  #include "../h/types.h"
  #include "../h/param.h"
  #ifndef AFS_LINUX22_ENV
***************
*** 29,39 ****
  #ifndef AFS_LINUX22_ENV
  #include "../h/socketvar.h"
  #include "../h/protosw.h"
! #ifndef AFS_SUN5_ENV
  #include "../h/domain.h"
  #include "../h/dir.h"
  #include "../h/buf.h"
  #include "../h/mbuf.h"
  #endif
  #endif /* AFS_LINUX22_ENV */
  #ifdef AFS_SGI62_ENV
--- 35,53 ----
  #ifndef AFS_LINUX22_ENV
  #include "../h/socketvar.h"
  #include "../h/protosw.h"
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_FBSD_ENV)
  #include "../h/domain.h"
  #include "../h/dir.h"
  #include "../h/buf.h"
  #include "../h/mbuf.h"
+ #else
+ #if defined(AFS_FBSD_ENV)
+ #include "../h/dirent.h"
+ #include "../h/socket.h"
+ #include "../h/domain.h"
+ #include "../h/buf.h"
+ #include "../h/mbuf.h"
+ #endif /* AFS_FBSD_ENV */
  #endif
  #endif /* AFS_LINUX22_ENV */
  #ifdef AFS_SGI62_ENV
***************
*** 99,103 ****
--- 113,121 ----
  extern struct ifnet *rxi_FindIfnet();
  
  extern int rxk_initDone;
+ 
+ #if defined(AFS_FBSD_ENV)
+ extern struct domain inetdomain;
+ #endif /* AFS_FBSD_ENV */
  
  #endif /* _RX_KCOMMON_H_ */
Index: openafs/src/rx/rx_lwp.c
diff -c openafs/src/rx/rx_lwp.c:1.2.2.2 openafs/src/rx/rx_lwp.c:1.2.2.4
*** openafs/src/rx/rx_lwp.c:1.2.2.2	Tue Mar  6 17:00:46 2001
--- openafs/src/rx/rx_lwp.c	Mon Apr 23 03:14:36 2001
***************
*** 36,41 ****
--- 36,44 ----
  
  #define MAXTHREADNAMELENGTH 64
  
+ extern int (*registerProgram)();
+ extern int (*swapNameProgram)();
+ 
  int debugSelectFailure;	/* # of times select failed */
  /*
   * Sleep on the unique wait channel provided.
***************
*** 54,61 ****
      LWP_NoYieldSignal(addr);
  }
  
! PROCESS rx_listenerPid;	/* LWP process id of socket listener process */
! static void rx_ListenerProc(void *dummy);
  
  /*
   * Delay the current thread the specified number of seconds.
--- 57,64 ----
      LWP_NoYieldSignal(addr);
  }
  
! PROCESS rx_listenerPid = 0;	/* LWP process id of socket listener process */
! void rx_ListenerProc(void *dummy);
  
  /*
   * Delay the current thread the specified number of seconds.
***************
*** 97,104 ****
--- 100,113 ----
      long (*proc)();
  {
      PROCESS scratchPid;
+     static int number = 0;
+     char name[32];
+ 
+     sprintf(name, "srv_%d", ++number);
      LWP_CreateProcess(proc, stacksize, RX_PROCESS_PRIORITY,
  		      0, "rx_ServerProc", &scratchPid);
+     if (registerProgram)
+ 	(*registerProgram)(scratchPid, name);
  }
  
  void rxi_StartListener() {
***************
*** 106,111 ****
--- 115,122 ----
  #define	RX_LIST_STACK	24000
      LWP_CreateProcess(rx_ListenerProc, RX_LIST_STACK, LWP_MAX_PRIORITY, 0,
  		      "rx_Listener", &rx_listenerPid);
+     if (registerProgram)
+ 	(*registerProgram)(rx_listenerPid, "listener");
  }
  
  /* The main loop which listens to the net for datagrams, and handles timeouts
***************
*** 151,157 ****
          exit(1);
      }
      rx_listenerPid = pid;
!     swapthreadname(pid, "listener", &name);
  
      for (;;) {
  	/* Grab a new packet only if necessary (otherwise re-use the old one) */
--- 162,169 ----
          exit(1);
      }
      rx_listenerPid = pid;
!     if (swapNameProgram)
!        (*swapNameProgram)(pid, "listener", &name);
  
      for (;;) {
  	/* Grab a new packet only if necessary (otherwise re-use the old one) */
***************
*** 245,250 ****
--- 257,266 ----
  			    if (p) {
  				rxi_FreePacket(p);
  			    }
+ 			    if (swapNameProgram) {
+ 				(*swapNameProgram)(rx_listenerPid, &name, 0);
+ 				rx_listenerPid = 0;
+ 			    }
  			    return;
  			}
  		    }
***************
*** 260,265 ****
--- 276,285 ----
  			if (newcallp && *newcallp) {
  			    if (p) {
  				rxi_FreePacket(p);
+ 			    }
+ 			    if (swapNameProgram) {
+ 				(*swapNameProgram)(rx_listenerPid, &name, 0);
+ 				rx_listenerPid = 0;
  			    }
  			    return;
  			}
Index: openafs/src/rx/rx_packet.h
diff -c openafs/src/rx/rx_packet.h:1.2 openafs/src/rx/rx_packet.h:1.2.2.2
*** openafs/src/rx/rx_packet.h:1.2	Sat Nov  4 05:05:33 2000
--- openafs/src/rx/rx_packet.h	Mon Apr 23 03:30:36 2001
***************
*** 40,46 ****
--- 40,48 ----
  #define MAX(a,b)  ((a)>(b)?(a):(b))
  #endif
  #else /* AFS_NT40_ENV */
+ #if !defined(AFS_DARWIN_ENV) && !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_USR_FBSD_ENV)
  #include <sys/sysmacros.h>      /* MIN, MAX on Solaris */
+ #endif
  #include <sys/param.h>          /* MIN, MAX elsewhere */
  #endif /* AFS_NT40_ENV */
  
Index: openafs/src/rx/rx_rdwr.c
diff -c openafs/src/rx/rx_rdwr.c:1.2.2.1 openafs/src/rx/rx_rdwr.c:1.2.2.3
*** openafs/src/rx/rx_rdwr.c:1.2.2.1	Tue Mar  6 17:01:32 2001
--- openafs/src/rx/rx_rdwr.c	Mon Apr 23 03:30:37 2001
***************
*** 1,4 ****
! /*
   * Copyright 2000, International Business Machines Corporation and others.
   * All Rights Reserved.
   * 
--- 1,4 ----
!  /*
   * Copyright 2000, International Business Machines Corporation and others.
   * All Rights Reserved.
   * 
***************
*** 10,15 ****
--- 10,18 ----
  #ifdef	KERNEL
  #include "../afs/param.h"
  #ifndef UKERNEL
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include "../afs/sysincludes.h"
+ #else
  #include "../h/types.h"
  #include "../h/time.h"
  #include "../h/stat.h"
***************
*** 23,28 ****
--- 26,32 ----
  #if defined(AFS_SGI_ENV)
  #include "../afs/sysincludes.h"
  #endif
+ #endif
  #include "../afs/afs_args.h"
  #include "../afs/afs_osi.h"
  #if	(defined(AFS_AUX_ENV) || defined(AFS_AIX_ENV))
***************
*** 34,40 ****
  #ifdef RXDEBUG
  #undef RXDEBUG	    /* turn off debugging */
  #endif /* RXDEBUG */
- #include "../afsint/afsint.h"
  
  #include "../rx/rx_kmutex.h"
  #include "../rx/rx_kernel.h"
--- 38,43 ----
Index: openafs/src/rx/rxdebug.c
diff -c openafs/src/rx/rxdebug.c:1.2 openafs/src/rx/rxdebug.c:1.2.2.1
*** openafs/src/rx/rxdebug.c:1.2	Sat Nov  4 05:05:35 2000
--- openafs/src/rx/rxdebug.c	Sun Apr 22 23:55:38 2001
***************
*** 463,468 ****
--- 463,471 ----
  		break;
  	    }
  
+ 	    if ((onlyHost != -1) && (onlyHost != tpeer.host)) continue;
+ 	    if ((onlyPort != -1) && (onlyPort != tpeer.port)) continue;
+ 
  	    /* now display the peer */
  	    hostAddr.s_addr = tpeer.host;
  	    printf("Peer at host %s, port %hu\n",
***************
*** 475,480 ****
--- 478,487 ----
  		   tpeer.bytesSent.high, tpeer.bytesSent.low);
  	    printf("\tbytes received high %d low %d\n",
  		   tpeer.bytesReceived.high, tpeer.bytesReceived.low);
+ 	    printf("\trtt %d msec, rtt_dev %d msec\n",
+ 		   tpeer.rtt >> 3, tpeer.rtt_dev >> 2);
+ 	    printf("\ttimeout %d.%03d sec\n",
+ 		   tpeer.timeout.sec, tpeer.timeout.usec / 1000);
  	}
      }
      exit(0);
Index: openafs/src/rx/DARWIN/rx_kmutex.h
diff -c /dev/null openafs/src/rx/DARWIN/rx_kmutex.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:51 2001
--- openafs/src/rx/DARWIN/rx_kmutex.h	Mon Apr 23 00:07:58 2001
***************
*** 0 ****
--- 1,107 ----
+ /*
+  * 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
+  */
+ 
+ /*
+  * rx_kmutex.h - mutex and condition variable macros for kernel environment.
+  *
+  * MACOS implementation.
+  */
+ 
+ #ifndef _RX_KMUTEX_H_
+ #define _RX_KMUTEX_H_
+ 
+ #include <sys/lock.h>
+ #include <kern/thread.h>
+ #include <sys/vm.h>
+ 
+ #define RX_ENABLE_LOCKS         1
+ #define AFS_GLOBAL_RXLOCK_KERNEL
+ 
+ /*
+  * Condition variables
+  *
+  * In Digital Unix (OSF/1), we use something akin to the ancient sleep/wakeup
+  * mechanism.  The condition variable itself plays no role; we just use its
+  * address as a convenient unique number.
+  * 
+  * XXX in darwin, both mach and bsd facilities are available. Should really
+  * stick to one or the other (but mach locks don't have a _try.....)
+  */
+ #define CV_INIT(cv,a,b,c)
+ #define CV_DESTROY(cv)
+ #define CV_WAIT(cv, lck)    { \
+ 	                        int isGlockOwner = ISAFS_GLOCK(); \
+ 	                        if (isGlockOwner) AFS_GUNLOCK();  \
+ 	                        assert_wait((event_t)(cv), 0);  \
+ 	                        MUTEX_EXIT(lck);        \
+ 	                        thread_block(0);                \
+ 	                        if (isGlockOwner) AFS_GLOCK();  \
+ 	                        MUTEX_ENTER(lck); \
+ 	                    }
+ 
+ #define CV_TIMEDWAIT(cv,lck,t)  { \
+ 	                        int isGlockOwner = ISAFS_GLOCK(); \
+ 	                        if (isGlockOwner) AFS_GUNLOCK();  \
+ 	                        assert_wait((event_t)(cv), 0);  \
+ 	                        thread_set_timer(t, NSEC_PER_SEC/hz);   \
+ 	                        MUTEX_EXIT(lck);        \
+ 	                        thread_block(0);                \
+ 	                        if (isGlockOwner) AFS_GLOCK();  \
+ 	                        MUTEX_ENTER(lck);       \
+ 
+ #define CV_SIGNAL(cv)           thread_wakeup_one((event_t)(cv))
+ #define CV_BROADCAST(cv)        thread_wakeup((event_t)(cv))
+ 
+ typedef struct {
+     struct lock__bsd__ lock;
+     thread_t owner;
+ } afs_kmutex_t;
+ typedef int afs_kcondvar_t;
+ 
+ #define osi_rxWakeup(cv)        thread_wakeup((event_t)(cv))
+ 
+ #define LOCK_INIT(a,b) \
+     do { \
+ 	lockinit(&(a)->lock,PSOCK, "afs rx lock", 0, 0); \
+ 	(a)->owner = (thread_t)0; \
+     } while(0);
+ #define MUTEX_INIT(a,b,c,d) \
+     do { \
+ 	lockinit(&(a)->lock,PSOCK, "afs rx mutex", 0, 0); \
+ 	(a)->owner = (thread_t)0; \
+     } while(0);
+ #define MUTEX_DESTROY(a) \
+     do { \
+ 	(a)->owner = (thread_t)-1; \
+     } while(0);
+ #define MUTEX_ENTER(a) \
+     do { \
+ 	lockmgr(&(a)->lock, LK_EXCLUSIVE, 0, current_proc()); \
+ 	osi_Assert((a)->owner == (thread_t)0); \
+ 	(a)->owner = current_thread(); \
+     } while(0);
+ #define MUTEX_TRYENTER(a) \
+     ( lockmgr(&(a)->lock, LK_EXCLUSIVE|LK_NOWAIT, 0, current_proc()) ? 0 : ((a)->owner = current_thread(), 1) )
+ #define xMUTEX_TRYENTER(a) \
+     ( osi_Assert((a)->owner == (thread_t)0), (a)->owner = current_thread(), 1)
+ #define MUTEX_EXIT(a) \
+     do { \
+ 	osi_Assert((a)->owner == current_thread()); \
+ 	(a)->owner = (thread_t)0; \
+ 	lockmgr(&(a)->lock, LK_RELEASE, 0, current_proc()); \
+     } while(0);
+ 
+ #undef MUTEX_ISMINE
+ #define MUTEX_ISMINE(a) (((afs_kmutex_t *)(a))->owner == current_thread())
+ 
+ #undef osirx_AssertMine
+ extern void osirx_AssertMine(afs_kmutex_t *lockaddr, char *msg);
+ 
+ #endif /* _RX_KMUTEX_H_ */
+ 
Index: openafs/src/rx/DARWIN/rx_knet.c
diff -c /dev/null openafs/src/rx/DARWIN/rx_knet.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:51 2001
--- openafs/src/rx/DARWIN/rx_knet.c	Mon Apr 23 00:07:58 2001
***************
*** 0 ****
--- 1,163 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #include "../afs/param.h"
+ #include "../rx/rx_kcommon.h"
+ 
+ int osi_NetReceive(asocket, addr, dvec, nvecs, alength)
+     struct socket *asocket;
+     struct sockaddr_in *addr;
+     struct iovec *dvec;
+     int nvecs;
+     int *alength;
+ {
+     struct uio u;
+     int i;
+     struct iovec iov[RX_MAXIOVECS];
+     struct sockaddr *sa;
+     int code;
+ 
+     int haveGlock = ISAFS_GLOCK();
+     /*AFS_STATCNT(osi_NetReceive);*/
+ 
+     if (nvecs > RX_MAXIOVECS) {
+         osi_Panic("osi_NetReceive: %d: Too many iovecs.\n", nvecs);
+     }
+ 
+     for (i = 0 ; i < nvecs ; i++) {
+         iov[i].iov_base = dvec[i].iov_base;
+         iov[i].iov_len = dvec[i].iov_len;
+     }
+ 
+     u.uio_iov=&iov[0];
+     u.uio_iovcnt=nvecs;
+     u.uio_offset=0;
+     u.uio_resid=*alength;
+     u.uio_segflg=UIO_SYSSPACE; 
+     u.uio_rw=UIO_READ;
+     u.uio_procp=NULL;  
+ 
+     if (haveGlock) { 
+         AFS_GUNLOCK();
+     }
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL);
+ #endif
+     code = soreceive(asocket, &sa, &u, NULL, NULL, NULL);
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
+ #endif
+     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;
+ }
+ 
+ extern int rxk_ListenerPid;
+ void osi_StopListener(void)
+ {
+    struct proc *p;
+ 
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL);
+ #endif
+    soclose(rx_socket);
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
+ #endif
+    p=pfind(rxk_ListenerPid); 
+    if (p)
+        psignal(p, SIGUSR1);
+ }
+ 
+ /* rx_NetSend - send asize bytes at adata from asocket to host at addr.
+  *
+  * Now, why do we allocate a new buffer when we could theoretically use the one
+  * pointed to by adata?  Because PRU_SEND returns after queueing the message,
+  * not after sending it.  If the sender changes the data after queueing it,
+  * we'd see the already-queued data change.  One attempt to fix this without
+  * adding a copy would be to have this function wait until the datagram is
+  * sent; however this doesn't work well.  In particular, if a host is down, and
+  * an ARP fails to that host, this packet will be queued until the ARP request
+  * comes back, which could be hours later.  We can't block in this routine that
+  * long, since it prevents RPC timeouts from happening.
+  */
+ /* XXX In the brave new world, steal the data bufs out of the rx_packet iovec,
+  * and just queue those.  XXX
+  */
+ 
+ 
+ int 
+ osi_NetSend(asocket, addr, dvec, nvecs, alength, istack)
+      register struct socket *asocket;
+      struct iovec *dvec;
+      int nvecs;
+      register afs_int32 alength;
+      struct sockaddr_in *addr;
+      int istack;
+ {
+     register afs_int32 code;
+     int s;
+     int len;
+     int i;
+     struct iovec iov[RX_MAXIOVECS];
+     char *tdata;
+     struct uio u;
+     struct mbuf *nam;
+     int haveGlock = ISAFS_GLOCK();
+ 
+     AFS_STATCNT(osi_NetSend);
+     if (nvecs > RX_MAXIOVECS) {
+         osi_Panic("osi_NetSend: %d: Too many iovecs.\n", nvecs);
+     } 
+ 
+     for (i = 0 ; i < nvecs ; i++) {
+         iov[i].iov_base = dvec[i].iov_base; 
+         iov[i].iov_len = dvec[i].iov_len; 
+     } 
+ 
+     u.uio_iov=&iov[0];
+     u.uio_iovcnt=nvecs;
+     u.uio_offset=0;
+     u.uio_resid=alength;
+     u.uio_segflg=UIO_SYSSPACE;
+     u.uio_rw=UIO_WRITE;
+     u.uio_procp=NULL;
+     if (haveGlock) {
+ 	AFS_GUNLOCK();
+     }
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL);
+ #endif
+     nam=m_get(M_DONTWAIT, MT_SONAME);
+     if (nam == NULL) {
+         code=ENOBUFS;
+         goto bad;
+     }
+     nam->m_len=addr->sin_len=sizeof(struct sockaddr_in);
+     bcopy((caddr_t)addr, mtod(nam, caddr_t), addr->sin_len);
+     code = sosend(asocket, mtod(nam, struct sockaddr *), &u, NULL, NULL, 0);
+     m_freem(nam);
+ bad:
+ #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
+     thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
+ #endif
+     if (haveGlock) {
+ 	AFS_GLOCK();
+     }
+     return code;
+ }
Index: openafs/src/rx/FBSD/rx_kmutex.h
diff -c /dev/null openafs/src/rx/FBSD/rx_kmutex.h:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:51 2001
--- openafs/src/rx/FBSD/rx_kmutex.h	Mon Apr 23 03:30:43 2001
***************
*** 0 ****
--- 1,96 ----
+ /* Copyright Transarc Corporation 1998 - All Rights Reserved
+  *
+  * rx_kmutex.h - mutex and condition variable macros for kernel environment.
+  *
+  * DUX implementation.
+  */
+ 
+ #ifndef _RX_KMUTEX_H_
+ #define _RX_KMUTEX_H_
+ 
+ #ifdef AFS_FBSD40_ENV
+ 
+ #include <sys/lock.h>
+ /* #include <kern/sched_prim.h> */
+ /* #include <sys/unix_defs.h> */
+ 
+ #define RX_ENABLE_LOCKS		1
+ #define AFS_GLOBAL_RXLOCK_KERNEL
+ 
+ /*
+  * Condition variables
+  *
+  * In Digital Unix (OSF/1), we use something akin to the ancient sleep/wakeup
+  * mechanism.  The condition variable itself plays no role; we just use its
+  * address as a convenient unique number.
+  */
+ #define CV_INIT(cv,a,b,c)
+ #define CV_DESTROY(cv)
+ #define CV_WAIT(cv, lck)    { \
+ 				int isGlockOwner = ISAFS_GLOCK(); \
+ 				if (isGlockOwner) AFS_GUNLOCK();  \
+ 				assert_wait((vm_offset_t)(cv), 0);	\
+ 				MUTEX_EXIT(lck);	\
+ 				thread_block();		\
+ 				if (isGlockOwner) AFS_GLOCK();  \
+ 				MUTEX_ENTER(lck); \
+ 			    }
+ 
+ #define CV_TIMEDWAIT(cv,lck,t)	{ \
+ 				int isGlockOwner = ISAFS_GLOCK(); \
+ 				if (isGlockOwner) AFS_GUNLOCK();  \
+ 				assert_wait((vm_offset_t)(cv), 0);	\
+ 				thread_set_timeout(t);	\
+ 				MUTEX_EXIT(lck);	\
+ 				thread_block();		\
+ 				if (isGlockOwner) AFS_GLOCK();  \
+ 				MUTEX_ENTER(lck);	\
+ 
+ #define CV_SIGNAL(cv)		thread_wakeup_one((vm_offset_t)(cv))
+ #define CV_BROADCAST(cv)	thread_wakeup((vm_offset_t)(cv))
+ 
+ typedef struct {
+     struct simplelock lock;
+ } afs_kmutex_t;
+ typedef int afs_kcondvar_t;
+ 
+ #define osi_rxWakeup(cv)	thread_wakeup((vm_offset_t)(cv))
+ 
+ #define LOCK_INIT(a,b) \
+     do { \
+ 	usimple_lock_init(&(a)->lock); \
+     } while(0);
+ #define MUTEX_INIT(a,b,c,d) \
+     do { \
+ 	usimple_lock_init(&(a)->lock); \
+     } while(0);
+ #define MUTEX_DESTROY(a) \
+     do { \
+ 	usimple_lock_terminate(&(a)->lock); \
+     } while(0);
+ #define MUTEX_ENTER(a) \
+     do { \
+ 	usimple_lock(&(a)->lock); \
+     } while(0);
+ #define MUTEX_TRYENTER(a) \
+    usimple_lock(&(a)->lock)
+ #define MUTEX_EXIT(a) \
+     do { \
+ 	usimple_unlock(&(a)->lock); \
+     } while(0);
+ 
+ #undef MUTEX_ISMINE
+ #define MUTEX_ISMINE(a) 1
+ /* 
+   #define MUTEX_ISMINE(a) 
+   (((afs_kmutex_t *)(a))->owner == current_thread())
+ */ 
+ 
+ #undef osirx_AssertMine
+ extern void osirx_AssertMine(afs_kmutex_t *lockaddr, char *msg);
+ 
+ #endif	/* FBSD40 */
+ 
+ 
+ #endif /* _RX_KMUTEX_H_ */
+ 
Index: openafs/src/rx/FBSD/rx_knet.c
diff -c /dev/null openafs/src/rx/FBSD/rx_knet.c:1.1.2.1
*** /dev/null	Wed Apr 25 02:16:51 2001
--- openafs/src/rx/FBSD/rx_knet.c	Mon Apr 23 03:30:43 2001
***************
*** 0 ****
--- 1,361 ----
+ /*
+ ****************************************************************************
+ *        Copyright IBM Corporation 1988, 1989 - All Rights Reserved        *
+ *        Copyright Transarc Corporation 1989 - All Rights Reserved         *
+ *                                                                          *
+ * 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 IBM not be used in        *
+ * advertising or publicity pertaining to distribution of the software      *
+ * without specific, written prior permission.                              *
+ *                                                                          *
+ * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY      *
+ * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER  *
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING   *
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.    *
+ ****************************************************************************
+ */
+ 
+ #include "../afs/param.h"
+ #ifdef AFS_FBSD40_ENV
+ #include "../rx/rx_kcommon.h"
+ 
+ 
+ static struct protosw parent_proto;	/* udp proto switch */
+ static void rxk_input (struct mbuf *am, int iphlen);
+ static void rxk_fasttimo (void);
+ 
+ /* start intercepting basic calls */
+ rxk_init() {
+     register struct protosw *tpro, *last;
+     if (rxk_initDone) return 0;
+ 
+     last = inetdomain.dom_protoswNPROTOSW;
+     for (tpro = inetdomain.dom_protosw; tpro < last; tpro++)
+       if (tpro->pr_protocol == IPPROTO_UDP) {
+ 	/* force UDP checksumming on for AFS	*/
+ 	 extern int udpcksum;
+ 	 udpcksum = 1;	
+           bcopy(tpro, &parent_proto, sizeof(parent_proto));
+           tpro->pr_input = rxk_input;
+           tpro->pr_fasttimo = rxk_fasttimo;
+           /*
+            * don't bother with pr_drain and pr_ctlinput
+            * until we have something to do
+            */
+           rxk_initDone = 1;
+           return 0;
+       }
+     osi_Panic("inet:no udp");
+ }
+ 
+ 
+ static void rxk_input (struct mbuf *am, int iphlen)
+ {
+     void (*tproc)();
+     register unsigned short *tsp;
+     int hdr;
+     struct udphdr *tu;
+     register struct ip *ti;
+     struct udpiphdr *tvu;
+     register int i;
+     char *phandle;
+     afs_int32 code;
+     struct sockaddr_in taddr;
+     int tlen;
+     short port;
+     int data_len, comp_sum;
+ 
+     SPLVAR;
+     NETPRI;
+ 
+     /* make sure we have base ip and udp headers in first mbuf */
+     if (iphlen > sizeof (struct ip)) {
+         ip_stripoptions(am, (struct mbuf *)0);
+         iphlen = sizeof (struct ip);
+     }
+ 
+     if (am->m_len < sizeof(struct udpiphdr)) {
+         am = m_pullup(am, sizeof(struct udpiphdr));
+         if (!am) {
+ 	    USERPRI;
+ 	    return;
+         }
+     }
+ 
+     ti = mtod(am, struct ip *);
+     /* skip basic ip hdr */
+     tu = (struct udphdr *)(((char *)ti) + sizeof(struct ip)); 
+     
+     /* now read the port out */
+     port = tu->uh_dport;
+ 
+     if (port) {
+ 	for(tsp=rxk_ports, i=0; i<MAXRXPORTS;i++) {
+ 	    if (*tsp++ == port) {
+ 		/* checksum the packet */
+ 		/*
+ 		 * Make mbuf data length reflect UDP length.
+ 		 * If not enough data to reflect UDP length, drop.
+ 		 */
+ 		tvu = (struct udpiphdr *)ti;
+ 		tlen = ntohs((u_short)tvu->ui_ulen);
+ 		if ((int)ti->ip_len != tlen) {
+ 		    if (tlen > (int)ti->ip_len) {
+ 			m_free(am);
+ 			USERPRI;
+ 			return;
+ 		    }
+ 		    m_adj(am, tlen - (int)ti->ip_len);
+ 		}
+ 		/* deliver packet to rx */
+ 		taddr.sin_family = AF_INET;	    /* compute source address */
+ 		taddr.sin_port = tu->uh_sport;
+ 		taddr.sin_addr.s_addr = ti->ip_src.s_addr;
+ 		taddr.sin_len = sizeof(taddr);
+ 		tvu = (struct udpiphdr *) ti;	/* virtual udp structure, for cksum */
+ 		/* handle the checksum.  Note that this code damages the actual ip
+ 		   header (replacing it with the virtual one, which is the same size),
+ 		   so we must ensure we get everything out we need, first */
+ 		if ( tu->uh_sum != 0) {
+ 			/* if the checksum is there, always check it. It's crazy not
+ 			 * to, unless you can really be sure that your
+ 			 * underlying network (and interfaces and drivers and
+ 			 * DMA hardware, etc!) is error-free. First, fill
+ 			 * in entire virtual ip header. */
+ 		        memset(tvu->ui_i.ih_x1, 0, 9);
+ 			tvu->ui_len = tvu->ui_ulen;
+ 			tlen = ntohs((unsigned short)(tvu->ui_ulen));
+ 			if (in_cksum(am, sizeof(struct ip) + tlen)) {
+ 			    /* checksum, including cksum field, doesn't come out 0, so
+ 			       this packet is bad */
+ 			    m_freem(am);
+ 			    USERPRI;
+ 			    return;
+ 			}
+ 		      }
+ 
+ 		/*
+ 		 * 28 is IP (20) + UDP (8) header.  ulen includes
+ 		 * udp header, and we *don't* tell RX about udp
+ 		 * header either.  So, we remove those 8 as well.
+ 		 */
+ 		data_len = ntohs(tu->uh_ulen);
+ 		data_len -= 8;
+ 		AFS_RXGLOCK();
+ 		if (!(*rxk_GetPacketProc)(&phandle, data_len)) {
+ 		  if (rx_mb_to_packet(am, m_freem, 28, data_len, phandle)) {
+ 		    /* XXX should just increment counter here.. */
+ 		    printf("rx: truncated UDP packet\n");
+ 		    rxi_FreePacket(phandle);
+ 		  }
+ 		  else 
+ 		    (*rxk_PacketArrivalProc)(phandle, &taddr,
+ 					     rxk_portRocks[i], data_len);
+ 		}else m_freem(am);
+ 		AFS_RXGUNLOCK();
+ 		USERPRI;
+ 		return;
+ 		}
+ 	    }
+ 	}
+ 
+     /* if we get here, try to deliver packet to udp */
+     if (tproc = parent_proto.pr_input) (*tproc)(am,iphlen);
+     USERPRI;
+     return;
+ }
+ 
+ 
+ /* 
+  * UDP fast timer to raise events for all but Solaris and NCR. 
+  * Called about 5 times per second (at unknown priority?).  Must go to
+  * splnet or obtain global lock before touching anything significant.
+  */
+ static void rxk_fasttimo (void)
+ {
+     void (*tproc)();
+     struct clock temp;
+ 
+     /* do rx fasttimo processing here */
+     rxevent_RaiseEvents(&temp);
+     if (tproc = parent_proto.pr_fasttimo) (*tproc)();
+ }
+ 
+ 
+ /* rx_NetSend - send asize bytes at adata from asocket to host at addr.
+  *
+  * Now, why do we allocate a new buffer when we could theoretically use the one
+  * pointed to by adata?  Because PRU_SEND returns after queueing the message,
+  * not after sending it.  If the sender changes the data after queueing it,
+  * we'd see the already-queued data change.  One attempt to fix this without
+  * adding a copy would be to have this function wait until the datagram is
+  * sent; however this doesn't work well.  In particular, if a host is down, and
+  * an ARP fails to that host, this packet will be queued until the ARP request
+  * comes back, which could be hours later.  We can't block in this routine that
+  * long, since it prevents RPC timeouts from happening.
+  */
+ /* XXX In the brave new world, steal the data bufs out of the rx_packet iovec,
+  * and just queue those.  XXX
+  */
+ 
+ /* set lock on sockbuf sb; can't call sblock since we're at interrupt level
+  * sometimes */
+ static trysblock(sb)    
+ register struct sockbuf *sb; {
+     AFS_STATCNT(trysblock);
+     if (sb->sb_flags & SB_LOCK){
+ 	return -1;  /* can't lock socket */
+     }
+     sb->sb_flags |= SB_LOCK;
+     return 0;
+ }
+ 
+ int 
+ osi_NetSend(asocket, addr, dvec, nvec, asize, istack)
+      register struct socket *asocket;
+      struct iovec *dvec;
+      int nvec;
+      register afs_int32 asize;
+      struct sockaddr_in *addr;
+      int istack;
+ {
+     register struct mbuf *tm, *um;
+     register afs_int32 code;
+     int s;
+     struct mbuf *top = 0;
+     register struct mbuf *m, **mp;
+     int len;
+     char *tdata;
+     caddr_t tpa;
+     int i,tl,rlen;
+     int mlen;
+     int haveGlock;
+ 
+     AFS_STATCNT(osi_NetSend);
+ 
+ /* Actually, the Ultrix way is as good as any for us, so we don't bother with
+  * special mbufs any more.  Used to think we could get away with not copying
+  * the data to the interface, but there's no way to tell the caller not to
+  * reuse the buffers after sending, so we lost out on that trick anyway */
+ 
+     s = splnet();
+     mp = &top;
+     i = 0;
+     tdata = dvec[i].iov_base;
+     tl = dvec[i].iov_len;
+     while (1) {
+ 	mlen = MLEN;
+         if (top == 0) {
+             MGETHDR(m, M_DONTWAIT, MT_DATA);
+             if (!m) {
+                 splx(s);
+                 return 1;
+             }
+             mlen = MHLEN;
+             m->m_pkthdr.len = 0;
+             m->m_pkthdr.rcvif = (struct ifnet *)0;
+         } else
+ 	MGET(m, M_DONTWAIT, MT_DATA);
+ 	if (!m) {
+ 	    /* can't get an mbuf, give up */
+ 	    if (top) m_freem(top);	/* free mbuf list we're building */
+ 	    splx(s);
+ 	    return 1;
+ 	}
+ 	/*
+ 	 * WARNING: the `4 * MLEN' is somewhat dubious.  It is better than
+ 	 * `NBPG', which may have no relation to `CLBYTES'.  Also, `CLBYTES'
+ 	 * may be so large that we never use clusters, resulting in far
+ 	 * too many mbufs being used.  It is often better to briefly use
+ 	 * a cluster, even if we are only using a portion of it.  Since
+ 	 * we are on the xmit side, it shouldn't end up sitting on a queue
+ 	 * for a potentially unbounded time (except perhaps if we are talking
+ 	 * to ourself).
+ 	 */
+ 	if (asize >= 4 * MLEN) {	/* try to get cluster mbuf */
+ 	    register struct mbuf *p;
+ 
+ 	    /* different algorithms for getting cluster mbuf */
+             MCLGET(m, M_DONTWAIT);
+             if ((m->m_flags & M_EXT) == 0)
+                 goto nopages;
+             mlen = MCLBYTES;
+ 
+ 	    /* now compute usable size */
+             len = MIN(mlen, asize);
+ /* Should I look at MAPPED_MBUFS??? */
+ 	} else {
+ nopages:
+             len = MIN(mlen, asize);
+ 	}
+ 	m->m_len = 0;
+         *mp = m;	/* XXXX */
+         top->m_pkthdr.len += len;
+ 	tpa = mtod(m, caddr_t);
+ 	while (len) {
+ 	  rlen = MIN(len, tl);
+ 	  bcopy(tdata, tpa, rlen);
+ 	  asize -= rlen;
+ 	  len -= rlen;
+ 	  tpa += rlen;
+ 	  m->m_len += rlen;
+ 	  tdata += rlen;
+ 	  tl -= rlen;
+ 	  if (tl <= 0) {
+ 	    i++;
+ 	    if (i > nvec) {
+ 	      /* shouldn't come here! */
+ 	      asize = 0;   /* so we make progress toward completion */
+ 	      break;
+ 	    }
+ 	    tdata = dvec[i].iov_base;
+ 	    tl = dvec[i].iov_len;
+ 	  }
+ 	}
+ 	*mp = m;
+ 	mp = &m->m_next;
+ 	if (asize <= 0)
+ 	  break;
+     }
+     tm = top;
+ 
+     tm->m_act = (struct mbuf *) 0;
+ 
+     /* setup mbuf corresponding to destination address */
+     um = m_get(M_DONTWAIT, MT_SONAME);
+     if (!um) {
+ 	if (top) m_freem(top);	/* free mbuf chain */
+ 	/* if this were vfs40, we'd do sbunlock(asocket, &asocket->so_snd), but
+ 	   we don't do the locking at all for vfs40 systems */
+ 	splx(s);
+ 	return 1;
+     }
+     bcopy(addr, mtod(um, caddr_t), sizeof(*addr));
+     um->m_len = sizeof(*addr);
+     /* note that udp_usrreq frees funny mbuf.  We hold onto data, but mbuf
+      * around it is gone.  we free address ourselves.  */
+     /*    haveGlock = ISAFS_GLOCK();
+     if (haveGlock) {
+ 	AFS_GUNLOCK();
+ 	}  */
+     /* SOCKET_LOCK(asocket); */
+     /* code = (*asocket->so_proto->pr_usrreq)(asocket, PRU_SEND, tm, um, 0); */
+     code = (*asocket->so_proto->pr_usrreqs->pru_send)(asocket, 0, tm, 
+ 						      (struct sockaddr *) addr,
+ 						      um, curproc);
+     /* SOCKET_UNLOCK(asocket); */
+     /* if (haveGlock) {
+ 	AFS_GLOCK();
+ 	} */
+     splx(s);
+     m_free(um);
+ 
+     return code;
+ }
+ 
+ #endif /* AFS_FBSD40_ENV */
Index: openafs/src/rx/test/generator.c
diff -c openafs/src/rx/test/generator.c:1.2 openafs/src/rx/test/generator.c:1.2.2.1
*** openafs/src/rx/test/generator.c:1.2	Sat Nov  4 05:05:41 2000
--- openafs/src/rx/test/generator.c	Mon Apr 23 02:26:51 2001
***************
*** 930,936 ****
  	    "#include <rx/rx_null.h>\n"
  	    "#include <rx/rxkad.h>\n"
  	    "#include <afs/cmd.h>\n"
- 	    "#include \"../../../permit_xprt.h\"\n"
  	    "#include \"%s%d.h\"\n"
  	    ,
  	    platform[4], serverName, srv_no);
--- 930,935 ----
***************
*** 1264,1270 ****
  	"#include <rx/rx_null.h>\n"
  	"#include <rx/rxkad.h>\n"
  	"#include <afs/cmd.h>\n"
- 	"#include \"../../../permit_xprt.h\"\n"
  	"#include \"%s.h\"\n\n"
  	"struct ktc_encryptionKey serviceKey =\n"
  	"\t{0x45, 0xe3, 0x3d, 0x16, 0x29, 0x64, 0x8a, 0x8f};\n"
--- 1263,1268 ----
Index: openafs/src/rxgen/Makefile
diff -c openafs/src/rxgen/Makefile:1.1 openafs/src/rxgen/Makefile:1.1.6.1
*** openafs/src/rxgen/Makefile:1.1	Fri Nov  3 21:29:19 2000
--- openafs/src/rxgen/Makefile	Mon Apr 23 00:08:01 2001
***************
*** 9,15 ****
  include ../config/Makefile.${SYS_NAME}
  
  UKERNELDIR=../libuafs/
- INSTALL =${SRCDIR}bin/install
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
  SRCS= rpc_main.c rpc_hout.c rpc_cout.c rpc_parse.c rpc_scan.c rpc_util.c \
--- 9,14 ----
Index: openafs/src/rxgen/rpc_main.c
diff -c openafs/src/rxgen/rpc_main.c:1.1.6.1 openafs/src/rxgen/rpc_main.c:1.1.6.3
*** openafs/src/rxgen/rpc_main.c:1.1.6.1	Tue Mar  6 16:38:55 2001
--- openafs/src/rxgen/rpc_main.c	Mon Apr 23 03:30:48 2001
***************
*** 88,95 ****
--- 88,99 ----
  static char *cmdname;
  #ifdef	AFS_SUN5_ENV
  static char CPP[] = "/usr/ccs/lib/cpp";
+ #elif defined(AFS_FBSD_ENV)
+ static char CPP[] = "/usr/bin/cpp";
  #elif defined(AFS_NT40_ENV)
  static char CPP[MAXCMDLINE];
+ #elif defined(AFS_DARWIN_ENV)
+ static char CPP[] = "cc -E";
  #else
  static char CPP[] = "/lib/cpp";
  #endif
Index: openafs/src/rxkad/Makefile
diff -c openafs/src/rxkad/Makefile:1.2 openafs/src/rxkad/Makefile:1.2.2.2
*** openafs/src/rxkad/Makefile:1.2	Sat Nov  4 05:05:43 2000
--- openafs/src/rxkad/Makefile	Mon Apr 23 02:26:57 2001
***************
*** 14,28 ****
  
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET = ${SRCDIR}bin/compile_et
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
  CFLAGS = ${OPTMZ} -I${SRCDIR}include ${XCFLAGS}
- PE = ../permit_xprt.h
  INCLS= ${SRCDIR}include/rx/rx.h \
         ${SRCDIR}include/rx/xdr.h \
!        rxkad.h ${PE}
  
  OBJS= rxkad_client.o rxkad_server.o rxkad_common.o ticket.o rxkad_errs.o
  
--- 14,26 ----
  
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
  COMPILE_ET = ${SRCDIR}bin/compile_et
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
  CFLAGS = ${OPTMZ} -I${SRCDIR}include ${XCFLAGS}
  INCLS= ${SRCDIR}include/rx/rx.h \
         ${SRCDIR}include/rx/xdr.h \
!        rxkad.h
  
  OBJS= rxkad_client.o rxkad_server.o rxkad_common.o ticket.o rxkad_errs.o
  
***************
*** 63,69 ****
  
  ticket.o: ticket.c lifetimes.h ${INCLS}
  
! fcrypt.o: fcrypt.c fcrypt.h sboxes.h rxkad.h ${PE}
  	${CC} ${CFLAGS} -c fcrypt.c
  
  kinstall: ${KSRCS}
--- 61,67 ----
  
  ticket.o: ticket.c lifetimes.h ${INCLS}
  
! fcrypt.o: fcrypt.c fcrypt.h sboxes.h rxkad.h
  	${CC} ${CFLAGS} -c fcrypt.c
  
  kinstall: ${KSRCS}
Index: openafs/src/rxkad/rxkad_client.c
diff -c openafs/src/rxkad/rxkad_client.c:1.2 openafs/src/rxkad/rxkad_client.c:1.2.2.2
*** openafs/src/rxkad/rxkad_client.c:1.2	Sat Nov  4 05:05:43 2000
--- openafs/src/rxkad/rxkad_client.c	Mon Apr 23 02:26:57 2001
***************
*** 51,62 ****
  
  #include "private_data.h"
  #define XPRT_RXKAD_CLIENT
- #ifdef KERNEL
- #include "../afs/permit_xprt.h"
- #else
- #include "../permit_xprt.h"
- #endif
- 
  
  char *rxi_Alloc();
  
--- 51,56 ----
***************
*** 185,191 ****
      bzero ((void *)tcp, size);
      tsc->privateData = (char *) tcp;
      tcp->type |= rxkad_client;
!     tcp->level = xprt_CoerceLevel(level);
      code = fc_keysched (sessionkey, tcp->keysched);
      if (code) return 0;			/* bad key */
      bcopy ((void *)sessionkey, (void *)tcp->ivec, sizeof(tcp->ivec));
--- 179,185 ----
      bzero ((void *)tcp, size);
      tsc->privateData = (char *) tcp;
      tcp->type |= rxkad_client;
!     tcp->level = level;
      code = fc_keysched (sessionkey, tcp->keysched);
      if (code) return 0;			/* bad key */
      bcopy ((void *)sessionkey, (void *)tcp->ivec, sizeof(tcp->ivec));
Index: openafs/src/rxkad/rxkad_common.c
diff -c openafs/src/rxkad/rxkad_common.c:1.2 openafs/src/rxkad/rxkad_common.c:1.2.2.2
*** openafs/src/rxkad/rxkad_common.c:1.2	Sat Nov  4 05:05:43 2000
--- openafs/src/rxkad/rxkad_common.c	Mon Apr 23 02:26:58 2001
***************
*** 19,25 ****
  #endif
  #include "../h/types.h"
  #include "../h/time.h"
- #include "../netinet/in.h"
  #ifndef AFS_LINUX22_ENV
  #include "../rpc/types.h"
  #include "../rpc/xdr.h"
--- 19,24 ----
***************
*** 50,61 ****
  
  #include "private_data.h"
  #define XPRT_RXKAD_COMMON
- #ifdef KERNEL
- #include "../afs/permit_xprt.h"
- #else
- #include "../permit_xprt.h"
- #endif
- 
  
  char *rxi_Alloc();
  
--- 49,54 ----
Index: openafs/src/rxkad/rxkad_server.c
diff -c openafs/src/rxkad/rxkad_server.c:1.2.2.1 openafs/src/rxkad/rxkad_server.c:1.2.2.2
*** openafs/src/rxkad/rxkad_server.c:1.2.2.1	Wed Dec 13 16:50:26 2000
--- openafs/src/rxkad/rxkad_server.c	Mon Apr 23 02:26:58 2001
***************
*** 26,33 ****
  #include <afs/afsutil.h>
  #include "private_data.h"
  #define XPRT_RXKAD_SERVER
- #include "../permit_xprt.h"
- 
  
  /*
   * This can be set to allow alternate ticket decoding.
--- 26,31 ----
Index: openafs/src/rxkad/ticket.c
diff -c openafs/src/rxkad/ticket.c:1.2 openafs/src/rxkad/ticket.c:1.2.2.1
*** openafs/src/rxkad/ticket.c:1.2	Sat Nov  4 05:05:44 2000
--- openafs/src/rxkad/ticket.c	Mon Apr 23 02:26:58 2001
***************
*** 7,24 ****
   * directory or online at http://www.openafs.org/dl/license10.html
   */
  
- /*
-  * Revision 2.3  90/08/31  16:19:53
-  * Move permit_xprt.h.
-  * 
-  * Revision 2.2  90/08/20  10:21:25
-  * Include permit_xprt.h.
-  * Cleanup; prune log, flush andrew style ticket functions.
-  * 
-  * Revision 2.1  90/08/07  19:33:44
-  * Start with clean version to sync test and dev trees.
-  * */
- 
  #if defined(UKERNEL)
  #include "../afs/param.h"
  #include "../afs/sysincludes.h"
--- 7,12 ----
***************
*** 29,36 ****
  #include "../des/des.h"
  #include "../afs/lifetimes.h"
  #include "../afs/rxkad.h"
- 
- #include "../afs/permit_xprt.h"
  #else /* defined(UKERNEL) */
  #include <afs/param.h>
  #include <afs/stds.h>
--- 17,22 ----
***************
*** 45,52 ****
  #include <des.h>
  #include "lifetimes.h"
  #include "rxkad.h"
- 
- #include "../permit_xprt.h"
  #endif /* defined(UKERNEL) */
  
  
--- 31,36 ----
Index: openafs/src/rxkad/domestic/crypt_conn.c
diff -c openafs/src/rxkad/domestic/crypt_conn.c:1.2 openafs/src/rxkad/domestic/crypt_conn.c:1.2.2.3
*** openafs/src/rxkad/domestic/crypt_conn.c:1.2	Sat Nov  4 05:05:44 2000
--- openafs/src/rxkad/domestic/crypt_conn.c	Mon Apr 23 02:27:04 2001
***************
*** 39,52 ****
  
  #include "private_data.h"
  #define XPRT_RXKAD_CRYPT
- #ifdef KERNEL
- #include "../afs/permit_xprt.h"
- #else
- #include "../permit_xprt.h"
- #endif
  
- 
- AFS_HIDE
  afs_int32 rxkad_DecryptPacket (conn, schedule, ivec, len, packet)
    IN struct rx_connection *conn;
    IN fc_KeySchedule *schedule;
--- 39,45 ----
***************
*** 60,66 ****
      char * data;
      int i,tlen;
  
-     if (!xprt_CryptOK (conn)) return RXKADILLEGALLEVEL;
      obj = rx_SecurityObjectOf(conn);
      tp = (struct rxkad_cprivate *)obj->privateData;
      LOCK_RXKAD_STATS
--- 53,58 ----
***************
*** 84,90 ****
      return 0;
  }
  
- AFS_HIDE
  afs_int32 rxkad_EncryptPacket (conn, schedule, ivec, len, packet)
    IN struct rx_connection *conn;
    IN fc_KeySchedule *schedule;
--- 76,81 ----
***************
*** 98,104 ****
      char *data;
      int i,tlen;
  
-     if (!xprt_CryptOK (conn)) return RXKADILLEGALLEVEL;
      obj = rx_SecurityObjectOf(conn);
      tp = (struct rxkad_cprivate *)obj->privateData;
      LOCK_RXKAD_STATS
--- 89,94 ----
Index: openafs/src/rxkad/domestic/fcrypt.c
diff -c openafs/src/rxkad/domestic/fcrypt.c:1.2 openafs/src/rxkad/domestic/fcrypt.c:1.2.2.2
*** openafs/src/rxkad/domestic/fcrypt.c:1.2	Sat Nov  4 05:05:44 2000
--- openafs/src/rxkad/domestic/fcrypt.c	Mon Apr 23 02:27:04 2001
***************
*** 56,66 ****
  #endif
  
  #define XPRT_FCRYPT
- #ifdef KERNEL
- #include "../afs/permit_xprt.h"
- #else
- #include "../permit_xprt.h"
- #endif
  
  int fc_keysched (key, schedule)
    IN struct ktc_encryptionKey *key;
--- 56,61 ----
***************
*** 104,110 ****
      return 0;
  }
  
- AFS_HIDE
  afs_int32 fc_ecb_encrypt(clear, cipher, schedule, encrypt)
    IN afs_uint32  *clear;
    OUT afs_uint32 *cipher;
--- 99,104 ----
***************
*** 194,200 ****
   * NOTE: fc_cbc_encrypt now modifies its 5th argument, to permit chaining over
   * scatter/gather vectors.
   */
- AFS_HIDE
  afs_int32 fc_cbc_encrypt (input, output, length, key, xor, encrypt)
    char		*input;
    char		*output;
--- 188,193 ----
Index: openafs/src/rxkad/test/stress_c.c
diff -c openafs/src/rxkad/test/stress_c.c:1.2 openafs/src/rxkad/test/stress_c.c:1.2.2.1
*** openafs/src/rxkad/test/stress_c.c:1.2	Sat Nov  4 05:05:45 2000
--- openafs/src/rxkad/test/stress_c.c	Mon Apr 23 02:27:11 2001
***************
*** 29,40 ****
  #define FT_ApproxTime() (int)time(0)
  #endif
  
- #ifdef rx_GetPacketCksum
- #include "../../permit_xprt.h"
- #endif
- 
  extern int maxSkew;
- 
  
  static char *whoami;
  
--- 29,35 ----
Index: openafs/src/rxstat/Makefile
diff -c openafs/src/rxstat/Makefile:1.2 openafs/src/rxstat/Makefile:1.2.2.1
*** openafs/src/rxstat/Makefile:1.2	Sat Nov  4 05:05:46 2000
--- openafs/src/rxstat/Makefile	Mon Apr 23 00:08:07 2001
***************
*** 11,17 ****
  
  KERNELDIR = ../libafs/
  UKERNELDIR = ../libuafs/
- INSTALL=${SRCDIR}bin/install
  RXGEN=${SRCDIR}bin/rxgen
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
--- 11,16 ----
Index: openafs/src/scout/Makefile
diff -c openafs/src/scout/Makefile:1.2 openafs/src/scout/Makefile:1.2.2.1
*** openafs/src/scout/Makefile:1.2	Sat Nov  4 05:05:47 2000
--- openafs/src/scout/Makefile	Mon Apr 23 00:08:10 2001
***************
*** 10,17 ****
  COMPONENT=scout
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
- 
  CFLAGS= ${DBUG} -I. \
  	-I${SRCDIR}include \
  	-I${SRCDIR}include/afs \
--- 10,15 ----
Index: openafs/src/sgistuff/Makefile
diff -c openafs/src/sgistuff/Makefile:1.2.2.1 openafs/src/sgistuff/Makefile:1.2.2.2
*** openafs/src/sgistuff/Makefile:1.2.2.1	Fri Jan 19 04:12:36 2001
--- openafs/src/sgistuff/Makefile	Mon Apr 23 00:08:12 2001
***************
*** 17,23 ****
  CFLAGS = ${OPTIMIZE} -I${SRCDIR}include ${XCFLAGS}
  LDFLAGS = ${OPTIMIZE} ${XLDFLAGS}
  LIBDIR = ${DESTDIR}lib/
- INSTALL=${SRCDIR}bin/install
  AFSLIBS = ${LIBDIR}afs/libkauth.a ${LIBDIR}afs/libprot.a ${LIBDIR}libubik.a \
  	  ${LIBDIR}afs/libauth.a ${DESTDIR}lib/librxkad.a ${LIBDIR}afs/libsys.a \
  	  ${DESTDIR}lib/libdes.a ${LIBDIR}librx.a ${LIBDIR}liblwp.a \
--- 17,22 ----
Index: openafs/src/sia/Makefile
diff -c openafs/src/sia/Makefile:1.2 openafs/src/sia/Makefile:1.2.2.1
*** openafs/src/sia/Makefile:1.2	Sat Nov  4 05:05:47 2000
--- openafs/src/sia/Makefile	Mon Apr 23 00:08:15 2001
***************
*** 27,34 ****
  
  all: test-reauth ${DESTDIR}/lib/afs/libafssiad.so ${DESTDIR}/lib/afs/libafssiad.krb.so
  
- INSTALL=${SRCDIR}bin/install
- 
  CFLAGS = $(DEBUG) -I${SRCDIR}include ${XCFLAGS}
  
  ${DESTDIR}/lib/afs/libafssiad.so: libafssiad.so
--- 27,32 ----
Index: openafs/src/sys/Makefile
diff -c openafs/src/sys/Makefile:1.2 openafs/src/sys/Makefile:1.2.2.2
*** openafs/src/sys/Makefile:1.2	Sat Nov  4 05:05:48 2000
--- openafs/src/sys/Makefile	Mon Apr 23 03:30:56 2001
***************
*** 14,20 ****
  MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
  
  UKERNELDIR=../libuafs/
- INSTALL = ${SRCDIR}bin/install
  CFLAGS= ${DBUG}  -I${SRCDIR}include  ${XCFLAGS} ${DBG_DEFS}
  SFLAGS=-P -I${SRCDIR}include  
  LIBS= libsys.a ${SRCDIR}lib/librx.a libsys.a ${SRCDIR}lib/liblwp.a ${SRCDIR}lib/afs/util.a ${XLIBS}
--- 14,19 ----
***************
*** 80,92 ****
  		/usr/ccs/lib/cpp  ${SFLAGS} syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
  		rm syscall.ss;;				\
! 	 sgi_* ) \
                  ${CC} ${CFLAGS} -c syscall.s;;          \
  	 alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \
  		${AS} -P ${CFLAGS} -D_NO_PROTO -DMACH -DOSF -nostdinc -traditional -DASSEMBLER syscall.s; \
  		${AS} -o syscall.o syscall.i; \
  		rm -f syscall.ss syscall.i;; \
  	 hp_ux11? ) \
  		touch syscall.o;; \
  	 *) \
  		/lib/cpp  ${SFLAGS} syscall.s syscall.ss; \
--- 79,93 ----
  		/usr/ccs/lib/cpp  ${SFLAGS} syscall.s syscall.ss; \
  		as -o syscall.o syscall.ss;		\
  		rm syscall.ss;;				\
! 	 sgi_* |ppc_darwin* ) \
                  ${CC} ${CFLAGS} -c syscall.s;;          \
  	 alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \
  		${AS} -P ${CFLAGS} -D_NO_PROTO -DMACH -DOSF -nostdinc -traditional -DASSEMBLER syscall.s; \
  		${AS} -o syscall.o syscall.i; \
  		rm -f syscall.ss syscall.i;; \
  	 hp_ux11? ) \
+ 		touch syscall.o;; \
+ 	i386_fbsd* ) \
  		touch syscall.o;; \
  	 *) \
  		/lib/cpp  ${SFLAGS} syscall.s syscall.ss; \
Index: openafs/src/tbutc/Makefile
diff -c openafs/src/tbutc/Makefile:1.2 openafs/src/tbutc/Makefile:1.2.2.1
*** openafs/src/tbutc/Makefile:1.2	Sat Nov  4 05:05:51 2000
--- openafs/src/tbutc/Makefile	Mon Apr 23 00:08:20 2001
***************
*** 15,21 ****
  include ../config/Makefile.${SYS_NAME}
  
  CC      =${MT_CC}
- INSTALL =${SRCDIR}bin/install
  CFLAGS  = ${DBG} -w ${MT_CFLAGS}
  
  LDFLAGS = ${DBG} ${XLDFLAGS}
--- 15,20 ----
Index: openafs/src/tbutc/NTMakefile
diff -c openafs/src/tbutc/NTMakefile:1.2 openafs/src/tbutc/NTMakefile:1.2.2.1
*** openafs/src/tbutc/NTMakefile:1.2	Sat Nov  4 05:05:51 2000
--- openafs/src/tbutc/NTMakefile	Mon Apr 23 02:46:13 2001
***************
*** 47,53 ****
  BUTCOBJS   = dbentries.obj tcprocs.obj lwps.obj tcmain.obj list.obj recoverDb.obj \
  	     tcudbprocs.obj dump.obj tcstatus.obj butc_xbsa.obj \
               $(LWPOBJS) $(BUCOORDOBJS)
! BUTCINCLUDE= -I. -I$(DESTDIR)\include -I$(XBSADIR)\ 
  BUTCLIBS   = $(DESTDIR)\lib\afs\afsbudb.lib \
  	     $(DESTDIR)\lib\afs\afsbubasics.lib \
  	     $(VOLSERLIBS) \
--- 47,53 ----
  BUTCOBJS   = dbentries.obj tcprocs.obj lwps.obj tcmain.obj list.obj recoverDb.obj \
  	     tcudbprocs.obj dump.obj tcstatus.obj butc_xbsa.obj \
               $(LWPOBJS) $(BUCOORDOBJS)
! BUTCINCLUDE= -I. -I$(DESTDIR)\include -I$(XBSADIR)\
  BUTCLIBS   = $(DESTDIR)\lib\afs\afsbudb.lib \
  	     $(DESTDIR)\lib\afs\afsbubasics.lib \
  	     $(VOLSERLIBS) \
***************
*** 57,62 ****
--- 57,63 ----
  	     $(DESTDIR)\lib\afsubik.lib \
  	     $(DESTDIR)\lib\afs\afsauth.lib \
  \
+ 	     $(DESTDIR)\lib\afsrpc.lib \
               $(DESTDIR)\lib\afsrxkad.lib \
  	     $(DESTDIR)\lib\afsrx.lib \
               $(DESTDIR)\lib\afslwp.lib \
***************
*** 64,70 ****
               $(DESTDIR)\lib\afs\afsutil.lib \
               $(DESTDIR)\lib\afs\afsusd.lib \
  	     $(DESTDIR)\lib\afs\afspioctl.lib \
- 	     $(DESTDIR)\lib\afsrpc.lib \
               $(DESTDIR)\lib\afs\afscmd.lib \
               $(DESTDIR)\lib\afs\afscom_err.lib \
  	     $(DESTDIR)\lib\afs\afsreg.lib \
--- 65,70 ----
Index: openafs/src/tsm41/Makefile
diff -c openafs/src/tsm41/Makefile:1.2 openafs/src/tsm41/Makefile:1.2.2.1
*** openafs/src/tsm41/Makefile:1.2	Sat Nov  4 05:05:51 2000
--- openafs/src/tsm41/Makefile	Mon Apr 23 00:08:23 2001
***************
*** 9,15 ****
  OPTIMIZE=-g
  CFLAGS = ${OPTIMIZE} -I${SRCDIR}include ${XCFLAGS}
  LIBDIR = ${DESTDIR}lib/
- INSTALL=${SRCDIR}bin/install
  AFSLIBS = ${LIBDIR}afs/libkauth.a ${LIBDIR}afs/libprot.a ${LIBDIR}libubik.a \
  	  ${LIBDIR}afs/libauth.a ${DESTDIR}lib/librxkad.a ${LIBDIR}afs/libsys.a \
  	  ${DESTDIR}lib/libdes.a ${LIBDIR}librx.a ${LIBDIR}liblwp.a \
--- 9,14 ----
Index: openafs/src/tviced/Makefile
diff -c openafs/src/tviced/Makefile:1.2.2.2 openafs/src/tviced/Makefile:1.2.2.4
*** openafs/src/tviced/Makefile:1.2.2.2	Tue Mar  6 17:02:52 2001
--- openafs/src/tviced/Makefile	Mon Apr 23 03:00:16 2001
***************
*** 10,16 ****
  include ../config/Makefile.${SYS_NAME}
  
  CC=${MT_CC}
- INSTALL=${SRCDIR}bin/install
  INCLUDES=-I. -I.. -I${SRCDIR}include -I${SRCDIR}include/afs
  CFLAGS=${DBG} ${OPTMZ} -DNINTERFACE ${INCLUDES} ${MT_CFLAGS} -DRXDEBUG
  LDFLAGS=${DBG} ${XLDFLAGS}
--- 10,15 ----
***************
*** 183,196 ****
  	${CC} -c ${CFLAGS} ${FSINT}/afsint.xdr.c
  
  fileserver: callback_clean1 viced.o ${objects} ${LIBS}
! 	case ${SYS_NAME} in \
! 	*linux*) \
! 	    ${CC} ${LDFLAGS} -o fileserver ${objects} ${LIBS} \
! 	    ${MTLIBS} ${XLIBS} ;; \
! 	*) \
! 	    ${CC} ${LDFLAGS} -o fileserver ${objects} ${LIBS} \
! 	    ${MTLIBS} ${XLIBS} ;; \
! 	esac;
  
  ${DESTDIR}root.server/usr/afs/bin/fileserver : fileserver
  	${INSTALL} -ns fileserver ${DESTDIR}root.server/usr/afs/bin/fileserver
--- 182,188 ----
  	${CC} -c ${CFLAGS} ${FSINT}/afsint.xdr.c
  
  fileserver: callback_clean1 viced.o ${objects} ${LIBS}
! 	${CC} ${LDFLAGS} -o fileserver ${objects} ${LIBS} ${MTLIBS} ${XLIBS}
  
  ${DESTDIR}root.server/usr/afs/bin/fileserver : fileserver
  	${INSTALL} -ns fileserver ${DESTDIR}root.server/usr/afs/bin/fileserver
Index: openafs/src/ubik/Makefile
diff -c openafs/src/ubik/Makefile:1.2 openafs/src/ubik/Makefile:1.2.2.1
*** openafs/src/ubik/Makefile:1.2	Sat Nov  4 05:05:52 2000
--- openafs/src/ubik/Makefile	Mon Apr 23 00:08:28 2001
***************
*** 12,18 ****
  
  CFLAGS=${OPTMZ} -I./ -I${SRCDIR}include ${XCFLAGS}
  UKERNELDIR=../libuafs/
- INSTALL=${SRCDIR}bin/install
  LIBOBJS=disk.o  remote.o beacon.o recovery.o ubik.o  vote.o lock.o phys.o \
  	ubik_int.cs.o ubik_int.ss.o ubik_int.xdr.o ubikcmd.o \
  	ubikclient.o uerrors.o
--- 12,17 ----
Index: openafs/src/ubik/beacon.c
diff -c openafs/src/ubik/beacon.c:1.2.2.1 openafs/src/ubik/beacon.c:1.2.2.3
*** openafs/src/ubik/beacon.c:1.2.2.1	Tue Mar  6 16:49:53 2001
--- openafs/src/ubik/beacon.c	Mon Apr 23 02:47:22 2001
***************
*** 211,222 ****
                  }
                  ++nServers;
              }
! 	    ts->vote_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
! 		VOTE_SERVICE_ID, 
! 		ubikSecClass, ubikSecIndex);		/* for vote reqs */
! 	    ts->disk_rxcid = rx_NewConnection(servAddr, ubik_callPortal, 
! 		DISK_SERVICE_ID, ubikSecClass, 
! 		ubikSecIndex);				/* for disk reqs */
  	    ts->up = 1;
  	}
      } else {
--- 211,226 ----
                  }
                  ++nServers;
              }
! 	    /* for vote reqs */
! 	    ts->vote_rxcid = rx_NewConnection(info->hostAddr[i].sin_addr.s_addr,
! 					      ubik_callPortal, 
! 					      VOTE_SERVICE_ID, 
! 					      ubikSecClass, ubikSecIndex);
! 	    /* for disk reqs */
! 	    ts->disk_rxcid = rx_NewConnection(info->hostAddr[i].sin_addr.s_addr,
! 					      ubik_callPortal, 
! 					      DISK_SERVICE_ID, ubikSecClass, 
! 					      ubikSecIndex);		     
  	    ts->up = 1;
  	}
      } else {
***************
*** 611,619 ****
  		code = UBADHOST; /* remote CellServDB inconsistency */
  		ubik_print("Inconsistent Cell Info on server: ");
  		for ( j=0; j < UBIK_MAX_INTERFACE_ADDR && ts->addr[j]; j++)
! 		    printf("%s ", afs_inet_ntoa(ts->addr[j]));
! 		printf("\n");
! 		fflush(stdout); fflush(stderr);     
  	    }
  	    else {
  		ts->up= 0;	/* mark the remote server as down */
--- 615,622 ----
  		code = UBADHOST; /* remote CellServDB inconsistency */
  		ubik_print("Inconsistent Cell Info on server: ");
  		for ( j=0; j < UBIK_MAX_INTERFACE_ADDR && ts->addr[j]; j++)
! 		    ubik_print("%s ", afs_inet_ntoa(ts->addr[j]));
! 		ubik_print("\n");
  	    }
  	    else {
  		ts->up= 0;	/* mark the remote server as down */
Index: openafs/src/ubik/lock.c
diff -c openafs/src/ubik/lock.c:1.2 openafs/src/ubik/lock.c:1.2.2.1
*** openafs/src/ubik/lock.c:1.2	Sat Nov  4 05:05:52 2000
--- openafs/src/ubik/lock.c	Mon Apr 23 02:47:23 2001
***************
*** 74,80 ****
       return UDONE;
  
    if (atrans->locktype != 0) {
!      printf("Ubik: Internal Error: attempted to take lock twice\n");
       abort();
    }
  
--- 74,80 ----
       return UDONE;
  
    if (atrans->locktype != 0) {
!      ubik_print("Ubik: Internal Error: attempted to take lock twice\n");
       abort();
    }
  
Index: openafs/src/ubik/remote.c
diff -c openafs/src/ubik/remote.c:1.2 openafs/src/ubik/remote.c:1.2.2.1
*** openafs/src/ubik/remote.c:1.2	Sat Nov  4 05:05:53 2000
--- openafs/src/ubik/remote.c	Mon Apr 23 02:47:23 2001
***************
*** 592,599 ****
      {
  	ubik_print("Inconsistent Cell Info from server: ");
  	for ( i=0; i < UBIK_MAX_INTERFACE_ADDR && inAddr->hostAddr[i]; i++)
! 	    printf("%s ", afs_inet_ntoa(htonl(inAddr->hostAddr[i])));
! 	printf("\n");
  	printServerInfo();
          return UBADHOST;
      }
--- 592,599 ----
      {
  	ubik_print("Inconsistent Cell Info from server: ");
  	for ( i=0; i < UBIK_MAX_INTERFACE_ADDR && inAddr->hostAddr[i]; i++)
! 	    ubik_print("%s ", afs_inet_ntoa(htonl(inAddr->hostAddr[i])));
! 	ubik_print("\n");
  	printServerInfo();
          return UBADHOST;
      }
***************
*** 604,612 ****
      
      ubik_print("ubik: A Remote Server has addresses: ");
      for ( i=0; i < UBIK_MAX_INTERFACE_ADDR && ts->addr[i]; i++)
! 	printf("%s ", afs_inet_ntoa(ts->addr[i]));
!     printf("\n");
!     fflush(stdout); fflush(stderr);
  
      return 0;
  }
--- 604,611 ----
      
      ubik_print("ubik: A Remote Server has addresses: ");
      for ( i=0; i < UBIK_MAX_INTERFACE_ADDR && ts->addr[i]; i++)
! 	ubik_print("%s ", afs_inet_ntoa(ts->addr[i]));
!     ubik_print("\n");
  
      return 0;
  }
***************
*** 619,630 ****
      ubik_print("Local CellServDB:");
      for ( ts=ubik_servers; ts; ts= ts->next, j++)
      {
! 	printf("Server %d: ", j);
  	for ( i=0; (i<UBIK_MAX_INTERFACE_ADDR) && ts->addr[i]; i++)
! 	    printf("%s ", afs_inet_ntoa(ts->addr[i]));
      }
!     printf("\n");
!     fflush(stdout); fflush(stderr);
  }
  
  SDISK_SetVersion(rxcall, atid, oldversionp, newversionp)
--- 618,628 ----
      ubik_print("Local CellServDB:");
      for ( ts=ubik_servers; ts; ts= ts->next, j++)
      {
! 	ubik_print("Server %d: ", j);
  	for ( i=0; (i<UBIK_MAX_INTERFACE_ADDR) && ts->addr[i]; i++)
! 	    ubik_print("%s ", afs_inet_ntoa(ts->addr[i]));
      }
!     ubik_print("\n");
  }
  
  SDISK_SetVersion(rxcall, atid, oldversionp, newversionp)
Index: openafs/src/ubik/ubik.c
diff -c openafs/src/ubik/ubik.c:1.2.2.1 openafs/src/ubik/ubik.c:1.2.2.2
*** openafs/src/ubik/ubik.c:1.2.2.1	Tue Mar  6 16:49:54 2001
--- openafs/src/ubik/ubik.c	Mon Apr 23 02:47:23 2001
***************
*** 500,506 ****
  	    to us, or timeout.  Put safety check in anyway */
  	if (now - realStart > 10 * BIGTIME) {
  	    ubik_stats.escapes++;
! 	    printf("ubik escaping from commit wait\n");
  	    break;
  	}
  	for(ts = ubik_servers; ts; ts=ts->next) {
--- 500,506 ----
  	    to us, or timeout.  Put safety check in anyway */
  	if (now - realStart > 10 * BIGTIME) {
  	    ubik_stats.escapes++;
! 	    ubik_print("ubik escaping from commit wait\n");
  	    break;
  	}
  	for(ts = ubik_servers; ts; ts=ts->next) {
***************
*** 824,832 ****
      char *a, *b, *c, *d;
  {
      ubik_print("Ubik PANIC: ");
!     printf(a, b, c, d);
      abort();
!     printf("BACK FROM ABORT\n");    /* shouldn't come back */
      exit(1);	                    /* never know, though  */
  }
  
--- 824,832 ----
      char *a, *b, *c, *d;
  {
      ubik_print("Ubik PANIC: ");
!     ubik_print(a, b, c, d);
      abort();
!     ubik_print("BACK FROM ABORT\n");    /* shouldn't come back */
      exit(1);	                    /* never know, though  */
  }
  
Index: openafs/src/ubik/udebug.c
diff -c openafs/src/ubik/udebug.c:1.2.2.1 openafs/src/ubik/udebug.c:1.2.2.2
*** openafs/src/ubik/udebug.c:1.2.2.1	Tue Mar  6 16:49:54 2001
--- openafs/src/ubik/udebug.c	Mon Apr 23 02:49:48 2001
***************
*** 318,324 ****
      sigaction(SIGSEGV, &nsa, NULL);
  #endif
      ts = cmd_CreateSyntax((char *) 0, CommandProc, 0, "probe ubik server");
!     cmd_AddParm(ts, "-servers", CMD_SINGLE, CMD_REQUIRED, "server machine");
      cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "IP port");
      cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "print all info");
  
--- 318,324 ----
      sigaction(SIGSEGV, &nsa, NULL);
  #endif
      ts = cmd_CreateSyntax((char *) 0, CommandProc, 0, "probe ubik server");
!     cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "server machine");
      cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "IP port");
      cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "print all info");
  
Index: openafs/src/ubik/vote.c
diff -c openafs/src/ubik/vote.c:1.2.2.1 openafs/src/ubik/vote.c:1.2.2.2
*** openafs/src/ubik/vote.c:1.2.2.1	Tue Mar  6 16:49:55 2001
--- openafs/src/ubik/vote.c	Mon Apr 23 02:49:03 2001
***************
*** 236,242 ****
         he's lowest, these loops don't occur.  because if someone knows he's
         lowest, he will send out beacons telling others to vote for him. */
      if (!amIClone &&
!         (ntohl((afs_uint32) ubik_host) <= ntohl((afs_uint32) lowestHost)
          || lowestTime + BIGTIME < now)) {
  	lowestTime = now;
  	lowestHost = ubik_host[0];
--- 236,242 ----
         he's lowest, these loops don't occur.  because if someone knows he's
         lowest, he will send out beacons telling others to vote for him. */
      if (!amIClone &&
!         (ntohl((afs_uint32) ubik_host[0]) <= ntohl((afs_uint32) lowestHost)
          || lowestTime + BIGTIME < now)) {
  	lowestTime = now;
  	lowestHost = ubik_host[0];
***************
*** 294,302 ****
  	    (otherHost != lastYesHost) ||
  	    (lastYesState != astate)) {
  	   /* A new vote or a change in the vote or changed quorum */
! 	   ubik_dprint("Ubik: vote 'yes' for %d.%d.%d.%d %s\n",
! 		       ((otherHost>>24)&0xff), ((otherHost>>16)&0xff),
! 		       ((otherHost>> 8)&0xff), (otherHost      &0xff),
  		       (astate?"(in quorum)":"(NOT in quorum)"));
  	}
  
--- 294,301 ----
  	    (otherHost != lastYesHost) ||
  	    (lastYesState != astate)) {
  	   /* A new vote or a change in the vote or changed quorum */
! 	   ubik_dprint("Ubik: vote 'yes' for %s %s\n",
! 				afs_inet_ntoa(otherHost),
  		       (astate?"(in quorum)":"(NOT in quorum)"));
  	}
  
Index: openafs/src/update/Makefile
diff -c openafs/src/update/Makefile:1.2 openafs/src/update/Makefile:1.2.2.1
*** openafs/src/update/Makefile:1.2	Sat Nov  4 05:05:55 2000
--- openafs/src/update/Makefile	Mon Apr 23 00:08:31 2001
***************
*** 9,15 ****
  COMPONENT=update
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  LIBRX=${SRCDIR}lib/librx.a
  LIBS = ${SRCDIR}lib/afs/libauth.a ${SRCDIR}lib/librxkad.a \
         ${SRCDIR}lib/libdes.a ${LIBRX} ${SRCDIR}lib/liblwp.a \
--- 9,14 ----
Index: openafs/src/usd/Makefile
diff -c openafs/src/usd/Makefile:1.2 openafs/src/usd/Makefile:1.2.2.1
*** openafs/src/usd/Makefile:1.2	Sat Nov  4 05:05:57 2000
--- openafs/src/usd/Makefile	Mon Apr 23 00:08:34 2001
***************
*** 9,15 ****
  COMPONENT=ptserver
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  RXGEN=${SRCDIR}bin/rxgen
  COMPILE_ET = ${SRCDIR}bin/compile_et
  
--- 9,14 ----
Index: openafs/src/usd/usd_file.c
diff -c openafs/src/usd/usd_file.c:1.2.2.1 openafs/src/usd/usd_file.c:1.2.2.2
*** openafs/src/usd/usd_file.c:1.2.2.1	Wed Dec 13 16:50:48 2000
--- openafs/src/usd/usd_file.c	Mon Apr 23 00:08:35 2001
***************
*** 17,22 ****
--- 17,25 ----
  #include <sys/tape.h>
  #include <sys/statfs.h>
  #else
+ #ifdef AFS_DARWIN_ENV
+ #include <sys/ioccom.h>
+ #endif
  #include <sys/mtio.h>
  #endif /* AFS_AIX_ENV */
  #ifdef AFS_DUX40_ENV
***************
*** 333,340 ****
--- 336,345 ----
  
      oflags = (flags & USD_OPEN_RDWR) ? O_RDWR : O_RDONLY;
  
+ #ifdef O_SYNC /* AFS_DARWIN_ENV XXX */
      if (flags & USD_OPEN_SYNC)
  	oflags |= O_SYNC;
+ #endif
  
      if (flags & USD_OPEN_CREATE)
  	oflags |= O_CREAT;
Index: openafs/src/uss/Makefile
diff -c openafs/src/uss/Makefile:1.2 openafs/src/uss/Makefile:1.2.2.1
*** openafs/src/uss/Makefile:1.2	Sat Nov  4 05:05:58 2000
--- openafs/src/uss/Makefile	Mon Apr 23 00:08:37 2001
***************
*** 12,19 ****
  COMPONENT=uss
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL = ${SRCDIR}bin/install
- 
  #
  # This makefile creates the following things:
  #
--- 12,17 ----
Index: openafs/src/uss/uss_common.h
diff -c openafs/src/uss/uss_common.h:1.2 openafs/src/uss/uss_common.h:1.2.2.2
*** openafs/src/uss/uss_common.h:1.2	Sat Nov  4 05:05:59 2000
--- openafs/src/uss/uss_common.h	Mon Apr 23 03:31:01 2001
***************
*** 60,66 ****
  #define uss_VolumeLen		300
  #define uss_DirPoolLen		300
  
! #ifndef AFS_LINUX20_ENV
  extern char *sys_errlist[];
  #endif
  
--- 60,66 ----
  #define uss_VolumeLen		300
  #define uss_DirPoolLen		300
  
! #if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  extern char *sys_errlist[];
  #endif
  
Index: openafs/src/util/Makefile
diff -c openafs/src/util/Makefile:1.2.2.1 openafs/src/util/Makefile:1.2.2.3
*** openafs/src/util/Makefile:1.2.2.1	Tue Mar  6 17:14:41 2001
--- openafs/src/util/Makefile	Mon Apr 23 02:14:59 2001
***************
*** 11,22 ****
  
  CFLAGS = ${OPTMZ} -I$(SRCDIR)include ${XCFLAGS}
  LDFLAGS = ${OPTMZ} ${XLDFLAGS}
- INSTALL = ${SRCDIR}bin/install
  
  objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \
  	 hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
  	 dirpath.o fileutil.o netutils.o flipbase64.o \
! 	 afs_atomlist.o afs_lhash.o snprintf.o
  
  headers = assert.h potpourri.h itc.h errors.h afsutil.h pthread_glock.h \
  	  dirpath.h afs_atomlist.h afs_lhash.h
--- 11,21 ----
  
  CFLAGS = ${OPTMZ} -I$(SRCDIR)include ${XCFLAGS}
  LDFLAGS = ${OPTMZ} ${XLDFLAGS}
  
  objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \
  	 hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
  	 dirpath.o fileutil.o netutils.o flipbase64.o \
! 	 afs_atomlist.o afs_lhash.o snprintf.o ${REGEX_OBJ}
  
  headers = assert.h potpourri.h itc.h errors.h afsutil.h pthread_glock.h \
  	  dirpath.h afs_atomlist.h afs_lhash.h
***************
*** 34,39 ****
--- 33,39 ----
  	${DESTDIR}include/afs/pthread_nosigs.h \
  	${objects} util.a ${DESTDIR}bin/sys ${someheaders} doc 
  	${INSTALL} util.a ${DESTDIR}lib/afs
+ 	${INSTALL} util.a ${DESTDIR}lib/afs/libafsutil.a
  	${INSTALL} assert.h errors.h vice.h remote.h ktime.h fileutil.h \
  		netutils.h packages.h afsutil.h pthread_glock.h \
  		afs_atomlist.h afs_lhash.h \
***************
*** 61,70 ****
  
  ${DESTDIR}include/afs/dirpath.h: dirpath.h
  	${INSTALL} dirpath.h  ${DESTDIR}include/afs
! 	
  ${DESTDIR}include/afs/pthread_nosigs.h: pthread_nosigs.h
  	${INSTALL} pthread_nosigs.h  ${DESTDIR}include/afs
! 	
  doc:
  	echo no documents in this directory
  
--- 61,70 ----
  
  ${DESTDIR}include/afs/dirpath.h: dirpath.h
  	${INSTALL} dirpath.h  ${DESTDIR}include/afs
! 
  ${DESTDIR}include/afs/pthread_nosigs.h: pthread_nosigs.h
  	${INSTALL} pthread_nosigs.h  ${DESTDIR}include/afs
! 
  doc:
  	echo no documents in this directory
  
Index: openafs/src/util/afsutil.h
diff -c openafs/src/util/afsutil.h:1.2 openafs/src/util/afsutil.h:1.2.2.5
*** openafs/src/util/afsutil.h:1.2	Sat Nov  4 05:06:02 2000
--- openafs/src/util/afsutil.h	Mon Apr 23 03:03:20 2001
***************
*** 25,30 ****
--- 25,34 ----
  #include <stdio.h>
  #include <stdarg.h>
  extern int LogLevel;
+ #ifndef AFS_NT40_ENV
+ extern int serverLogSyslog;
+ extern int serverLogSyslogFacility;
+ #endif
  extern void FSLog(const char *format, ...);
  #define ViceLog(level, str)  if ((level) <= LogLevel) (FSLog str)
  
***************
*** 53,59 ****
  
  
  /* Convert a 4 byte integer to a text string. */
! extern char*	afs_inet_ntoa(afs_int32 addr);
  
  
  /* copy strings, converting case along the way. */
--- 57,63 ----
  
  
  /* Convert a 4 byte integer to a text string. */
! extern char*	afs_inet_ntoa(afs_uint32 addr);
  
  
  /* copy strings, converting case along the way. */
***************
*** 108,116 ****
   * early in name.
   */
  typedef char lb64_string_t[12];
  char *int64_to_flipbase64(b64_string_t s, u_int64_t a);
  int64_t flipbase64_to_int64(char *s);
! #define int32_to_flipbase64(S, A) int64_to_flipbase64(S, (u_int64_t)(A))
  #endif
  
  /* This message preserves our ability to license AFS to the U.S. Government
--- 112,126 ----
   * early in name.
   */
  typedef char lb64_string_t[12];
+ #ifdef AFS_64BIT_ENV
+ #define int32_to_flipbase64(S, A) int64_to_flipbase64(S, (afs_int64)(A))
+ char *int64_to_flipbase64(b64_string_t s, afs_int64 a);
+ afs_int64 flipbase64_to_int64(char *s);
+ #else
+ #define int32_to_flipbase64(S, A) int64_to_flipbase64(S, (u_int64_t)(A))
  char *int64_to_flipbase64(b64_string_t s, u_int64_t a);
  int64_t flipbase64_to_int64(char *s);
! #endif
  #endif
  
  /* This message preserves our ability to license AFS to the U.S. Government
Index: openafs/src/util/dirpath.c
diff -c openafs/src/util/dirpath.c:1.2.2.2 openafs/src/util/dirpath.c:1.2.2.3
*** openafs/src/util/dirpath.c:1.2.2.2	Tue Mar  6 17:07:06 2001
--- openafs/src/util/dirpath.c	Mon Apr 23 00:08:42 2001
***************
*** 26,31 ****
--- 26,34 ----
  #include <windows.h>
  #include <WINNT\afssw.h>
  #endif
+ #ifdef AFS_DARWIN_ENV
+ #include <unistd.h>
+ #endif
  
  /* local vars */
  /* static storage for path strings */
***************
*** 153,158 ****
--- 156,166 ----
      strcpy(afsSrvDirPath, AFSDIR_CANONICAL_SERVER_AFS_DIRPATH);
  
      /* setup the root client directory path */
+ #ifdef AFS_DARWIN_ENV
+     if (access(AFSDIR_ALTERNATE_CLIENT_VICE_DIRPATH, F_OK) == 0)
+         strcpy(afsClntDirPath, AFSDIR_ALTERNATE_CLIENT_VICE_DIRPATH);
+     else 
+ #endif
      strcpy(afsClntDirPath, AFSDIR_CANONICAL_CLIENT_VICE_DIRPATH);
  
      /* setup top level dirpath; valid for both server and client */
Index: openafs/src/util/dirpath.h
diff -c openafs/src/util/dirpath.h:1.2.2.2 openafs/src/util/dirpath.h:1.2.2.3
*** openafs/src/util/dirpath.h:1.2.2.2	Tue Mar  6 17:07:07 2001
--- openafs/src/util/dirpath.h	Mon Apr 23 00:08:42 2001
***************
*** 160,165 ****
--- 160,168 ----
  #define AFSDIR_CANONICAL_USR_DIRPATH            "/usr"
  #define AFSDIR_CANONICAL_SERVER_AFS_DIRPATH     "/usr/afs"
  #define AFSDIR_CANONICAL_CLIENT_VICE_DIRPATH    "/usr/vice"
+ #ifdef AFS_DARWIN_ENV
+ #define AFSDIR_ALTERNATE_CLIENT_VICE_DIRPATH    "/var/db/openafs"
+ #endif
  
  #define AFSDIR_CANONICAL_SERVER_BIN_DIRPATH \
  AFSDIR_CANONICAL_SERVER_AFS_DIRPATH "/" AFSDIR_BIN_DIR
Index: openafs/src/util/fileutil.c
diff -c openafs/src/util/fileutil.c:1.2 openafs/src/util/fileutil.c:1.2.2.1
*** openafs/src/util/fileutil.c:1.2	Sat Nov  4 05:06:04 2000
--- openafs/src/util/fileutil.c	Mon Apr 23 02:33:35 2001
***************
*** 18,23 ****
--- 18,24 ----
  
  #ifdef AFS_NT40_ENV
  #include <windows.h>
+ #include <io.h>
  #include "errmap_nt.h"
  #else
  #include <unistd.h>
***************
*** 105,118 ****
  bufio_p BufioOpen(char *path, int oflag, int mode)
  {
      bufio_p bp;
-     BUFIO_FD fd;
  
      bp = (bufio_p)malloc(sizeof(bufio_t));
      if (bp == NULL) {
  	return NULL;
      }
! 
      bp->fd = open(path, oflag, mode);
      if (bp->fd == BUFIO_INVALID_FD) {
  	free(bp);
  	return NULL;
--- 106,121 ----
  bufio_p BufioOpen(char *path, int oflag, int mode)
  {
      bufio_p bp;
  
      bp = (bufio_p)malloc(sizeof(bufio_t));
      if (bp == NULL) {
  	return NULL;
      }
! #ifdef AFS_NT40_ENV
!     bp->fd = _open(path, oflag, mode);
! #else
      bp->fd = open(path, oflag, mode);
+ #endif
      if (bp->fd == BUFIO_INVALID_FD) {
  	free(bp);
  	return NULL;
***************
*** 144,150 ****
--- 147,157 ----
      len = bp->len;
      while (1) {
  	if (pos >= len) {
+ #ifdef AFS_NT40_ENV
+ 	    rc = _read(bp->fd, bp->buf, BUFIO_BUFSIZE);
+ #else
  	    rc = read(bp->fd, bp->buf, BUFIO_BUFSIZE);
+ #endif
  	    if (rc < 0) {
  		bp->eof = 1;
  		return -1;
***************
*** 190,196 ****
--- 197,207 ----
      }
      fd = bp->fd;
      free(bp);
+ #ifdef AFS_NT40_ENV
+     rc = _close(fd);
+ #else
      rc = close(fd);
+ #endif
  
      return rc;
  }
Index: openafs/src/util/flipbase64.c
diff -c openafs/src/util/flipbase64.c:1.2 openafs/src/util/flipbase64.c:1.2.2.3
*** openafs/src/util/flipbase64.c:1.2	Sat Nov  4 05:06:04 2000
--- openafs/src/util/flipbase64.c	Mon Apr 23 02:44:03 2001
***************
*** 27,36 ****
   * The supplied string 's' must be at least 12 bytes long.
   * lb64_string in stds.h provides a typedef to get the length.
   */
  char *int64_to_flipbase64(lb64_string_t s, u_int64_t a)
  {
      int i, j;
!     int64_t n;
  
      i = 0;
      if (a==0)
--- 27,44 ----
   * The supplied string 's' must be at least 12 bytes long.
   * lb64_string in stds.h provides a typedef to get the length.
   */
+ #ifdef AFS_64BIT_ENV
+ char *int64_to_flipbase64(lb64_string_t s, afs_int64 a)
+ #else
  char *int64_to_flipbase64(lb64_string_t s, u_int64_t a)
+ #endif
  {
      int i, j;
! #ifdef AFS_64BIT_ENV
!     afs_int64 n;
! #else
!     u_int64_t n;
! #endif
  
      i = 0;
      if (a==0)
***************
*** 46,55 ****
--- 54,72 ----
  
  
  /* Mapping: +=0, ==1, 0-9 = 2-11, A-Z = 12-37, a-z = 38-63 */
+ #ifdef AFS_64BIT_ENV
+ afs_int64 flipbase64_to_int64(char *s)
+ #else
  int64_t flipbase64_to_int64(char *s)
+ #endif
  {
+ #ifdef AFS_64BIT_ENV
+     afs_int64 n = 0;
+     afs_int64 result = 0;
+ #else
      int64_t n = 0;
      int64_t result = 0;
+ #endif
      int shift;
  
      for (shift = 0; *s; s++, shift += 6) {
Index: openafs/src/util/hostparse.c
diff -c openafs/src/util/hostparse.c:1.2 openafs/src/util/hostparse.c:1.2.2.1
*** openafs/src/util/hostparse.c:1.2	Sat Nov  4 05:06:04 2000
--- openafs/src/util/hostparse.c	Mon Apr 23 03:03:21 2001
***************
*** 41,47 ****
      static char *addrp[2];
      static char addr[4];
      register char *ptr = ahost;
!     afs_int32 tval, numeric=0;
      int dots=0;
  
      tc = *ahost;    /* look at the first char */
--- 41,47 ----
      static char *addrp[2];
      static char addr[4];
      register char *ptr = ahost;
!     afs_uint32 tval, numeric=0;
      int dots=0;
  
      tc = *ahost;    /* look at the first char */
***************
*** 103,109 ****
   * variable addr is in network byte order.
   */
  char *hostutil_GetNameByINet(addr)
!   afs_int32 addr;
  {
    struct hostent *th;
    static char    tbuffer[256];
--- 103,109 ----
   * variable addr is in network byte order.
   */
  char *hostutil_GetNameByINet(addr)
!   afs_uint32 addr;
  {
    struct hostent *th;
    static char    tbuffer[256];
***************
*** 130,136 ****
  ** w.x.y.z 	# machineName
  ** returns the network interface in network byte order 
  */
! afs_int32
  extractAddr(line, maxSize)
  char* line;
  int maxSize;
--- 130,136 ----
  ** w.x.y.z 	# machineName
  ** returns the network interface in network byte order 
  */
! afs_uint32
  extractAddr(line, maxSize)
  char* line;
  int maxSize;
***************
*** 138,145 ****
  	char byte1[32], byte2[32], byte3[32], byte4[32];
  	int i=0;
  	char*	endPtr;
! 	afs_int32 val1, val2, val3, val4;
! 	afs_int32 val=0;
  
  	/* skip empty spaces */
  	while ( isspace(*line) && maxSize ) 
--- 138,145 ----
  	char byte1[32], byte2[32], byte3[32], byte4[32];
  	int i=0;
  	char*	endPtr;
! 	afs_uint32 val1, val2, val3, val4;
! 	afs_uint32 val=0;
  
  	/* skip empty spaces */
  	while ( isspace(*line) && maxSize ) 
***************
*** 224,230 ****
  ** On Solaris, if we pass a 4 byte integer directly into inet_ntoa(), it
  ** causes a memory fault. 
  */
! char* afs_inet_ntoa(afs_int32 addr)
  {
      struct in_addr temp;
      temp.s_addr = addr;
--- 224,230 ----
  ** On Solaris, if we pass a 4 byte integer directly into inet_ntoa(), it
  ** causes a memory fault. 
  */
! char* afs_inet_ntoa(afs_uint32 addr)
  {
      struct in_addr temp;
      temp.s_addr = addr;
Index: openafs/src/util/netutils.c
diff -c openafs/src/util/netutils.c:1.2 openafs/src/util/netutils.c:1.2.2.3
*** openafs/src/util/netutils.c:1.2	Sat Nov  4 05:06:05 2000
--- openafs/src/util/netutils.c	Mon Apr 23 03:31:05 2001
***************
*** 14,27 ****
  
  #include <stdlib.h>
  #include <stdio.h>
- #include <errno.h>
- #include <sys/errno.h>
  #ifdef KERNEL
  #include "../afs/param.h"
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
  #else
  #include <netinet/in.h>
  #endif
  
  #include "assert.h"
--- 14,30 ----
  
  #include <stdlib.h>
  #include <stdio.h>
  #ifdef KERNEL
  #include "../afs/param.h"
  #include "../afs/sysincludes.h"
  #include "../afs/afsincludes.h"
  #else
+ #ifdef __FreeBSD__
+ #include <sys/types.h>
+ #endif
  #include <netinet/in.h>
+ #include <errno.h>
+ #include <sys/errno.h>
  #endif
  
  #include "assert.h"
***************
*** 38,44 ****
  ** w.x.y.z 	# machineName
   * returns the network interface IP Address in NBO
   */
! u_long
  extract_Addr(line, maxSize)
  char* line;
  int maxSize;
--- 41,47 ----
  ** w.x.y.z 	# machineName
   * returns the network interface IP Address in NBO
   */
! afs_uint32
  extract_Addr(line, maxSize)
  char* line;
  int maxSize;
***************
*** 46,53 ****
    char bytes[4][32];
    int i=0,n=0;
    char*   endPtr;
!   u_long val[4];
!   u_long retval=0;
    
    /* skip empty spaces */
    while ( isspace(*line) && maxSize ) {
--- 49,56 ----
    char bytes[4][32];
    int i=0,n=0;
    char*   endPtr;
!   afs_uint32 val[4];
!   afs_uint32 retval=0;
    
    /* skip empty spaces */
    while ( isspace(*line) && maxSize ) {
***************
*** 96,103 ****
   * parsed by extract_Addr().
   */
  int parseNetRestrictFile(outAddrs, mask, mtu, maxAddrs, nAddrs, reason, fileName)
!   afs_int32  outAddrs[];           /* output address array */
!   afs_int32  *mask, *mtu;          /* optional mask and mtu */
    afs_uint32 maxAddrs;	   	   /* max number of addresses */
    afs_uint32 *nAddrs;              /* number of Addresses in output array */
    char       reason[];             /* reason for failure */
--- 99,106 ----
   * parsed by extract_Addr().
   */
  int parseNetRestrictFile(outAddrs, mask, mtu, maxAddrs, nAddrs, reason, fileName)
!   afs_uint32  outAddrs[];           /* output address array */
!   afs_uint32  *mask, *mtu;          /* optional mask and mtu */
    afs_uint32 maxAddrs;	   	   /* max number of addresses */
    afs_uint32 *nAddrs;              /* number of Addresses in output array */
    char       reason[];             /* reason for failure */
***************
*** 107,113 ****
    char   line[MAX_NETFILE_LINE];
    int lineNo, usedfile;
    afs_uint32 i, neaddrs, nfaddrs, nOutaddrs;
!   afs_int32  addr, eAddrs[MAXIPADDRS], eMask[MAXIPADDRS], eMtu[MAXIPADDRS];
  
    assert(outAddrs);
    assert(reason);
--- 110,116 ----
    char   line[MAX_NETFILE_LINE];
    int lineNo, usedfile;
    afs_uint32 i, neaddrs, nfaddrs, nOutaddrs;
!   afs_uint32  addr, eAddrs[MAXIPADDRS], eMask[MAXIPADDRS], eMtu[MAXIPADDRS];
  
    assert(outAddrs);
    assert(reason);
***************
*** 196,212 ****
   */
  int
  ParseNetInfoFile(final, mask, mtu, max, reason, fileName)
! afs_int32   *final, *mask, *mtu;
  int 	max;			/* max number of interfaces */
  char reason[];
  const char *fileName;
  {
  
!   afs_int32  existingAddr[MAXIPADDRS], existingMask[MAXIPADDRS], existingMtu[MAXIPADDRS];
    char   line[MAX_NETFILE_LINE];
    FILE*  fp;
    int 	  i, existNu, count = 0;
!   afs_int32  addr;
    int 	  lineNo=0;
    int    l;
    
--- 199,215 ----
   */
  int
  ParseNetInfoFile(final, mask, mtu, max, reason, fileName)
! afs_uint32   *final, *mask, *mtu;
  int 	max;			/* max number of interfaces */
  char reason[];
  const char *fileName;
  {
  
!   afs_uint32  existingAddr[MAXIPADDRS], existingMask[MAXIPADDRS], existingMtu[MAXIPADDRS];
    char   line[MAX_NETFILE_LINE];
    FILE*  fp;
    int 	  i, existNu, count = 0;
!   afs_uint32  addr;
    int 	  lineNo=0;
    int    l;
    
***************
*** 294,306 ****
   * entries.
   */
  int filterAddrs(addr1,addr2,mask1,mask2,mtu1,mtu2,n1,n2)
! u_long addr1[],addr2[];
! afs_int32  mask1[], mask2[];
! afs_int32  mtu1[], mtu2[];
  {
!   u_long taddr[MAXIPADDRS];
!   afs_int32  tmask[MAXIPADDRS];
!   afs_int32  tmtu[MAXIPADDRS];
    int count=0,i=0,j=0,found=0;
    
    assert(addr1);
--- 297,309 ----
   * entries.
   */
  int filterAddrs(addr1,addr2,mask1,mask2,mtu1,mtu2,n1,n2)
! afs_uint32 addr1[],addr2[];
! afs_uint32  mask1[], mask2[];
! afs_uint32  mtu1[], mtu2[];
  {
!   afs_uint32 taddr[MAXIPADDRS];
!   afs_uint32  tmask[MAXIPADDRS];
!   afs_uint32  tmtu[MAXIPADDRS];
    int count=0,i=0,j=0,found=0;
    
    assert(addr1);
***************
*** 349,364 ****
   * set of IP addresses to use
   */
  int parseNetFiles(addrbuf, maskbuf,mtubuf,max,reason, niFileName, nrFileName)
! afs_int32  addrbuf[];
! afs_int32  maskbuf[];
! afs_int32  mtubuf[];
! u_long max;        /* Entries in addrbuf, maskbuf and mtubuf */
  char reason[];
  const char *niFileName;
  const char *nrFileName;
  {
!   afs_int32	addrbuf1[MAXIPADDRS],maskbuf1[MAXIPADDRS], mtubuf1[MAXIPADDRS];
!   afs_int32     addrbuf2[MAXIPADDRS],maskbuf2[MAXIPADDRS], mtubuf2[MAXIPADDRS];
    int nAddrs1=0;
    afs_uint32 nAddrs2=0;
    int code,i;
--- 352,367 ----
   * set of IP addresses to use
   */
  int parseNetFiles(addrbuf, maskbuf,mtubuf,max,reason, niFileName, nrFileName)
! afs_uint32  addrbuf[];
! afs_uint32  maskbuf[];
! afs_uint32  mtubuf[];
! afs_uint32 max;        /* Entries in addrbuf, maskbuf and mtubuf */
  char reason[];
  const char *niFileName;
  const char *nrFileName;
  {
!   afs_uint32	addrbuf1[MAXIPADDRS],maskbuf1[MAXIPADDRS], mtubuf1[MAXIPADDRS];
!   afs_uint32     addrbuf2[MAXIPADDRS],maskbuf2[MAXIPADDRS], mtubuf2[MAXIPADDRS];
    int nAddrs1=0;
    afs_uint32 nAddrs2=0;
    int code,i;
Index: openafs/src/util/netutils.h
diff -c openafs/src/util/netutils.h:1.2 openafs/src/util/netutils.h:1.2.2.1
*** openafs/src/util/netutils.h:1.2	Sat Nov  4 05:06:05 2000
--- openafs/src/util/netutils.h	Mon Apr 23 03:03:22 2001
***************
*** 17,25 ****
  /* Network and IP address utility and file parsing functions */
  
  extern int parseNetRestrictFile(
! 				afs_int32 outAddrs[], 
! 				afs_int32 mask[], 
! 				afs_int32 mtu[],
  				afs_uint32 maxAddrs,
  				afs_uint32 *nAddrs, 
  				char reason[], 
--- 17,25 ----
  /* Network and IP address utility and file parsing functions */
  
  extern int parseNetRestrictFile(
! 				afs_uint32 outAddrs[], 
! 				afs_uint32 mask[], 
! 				afs_uint32 mtu[],
  				afs_uint32 maxAddrs,
  				afs_uint32 *nAddrs, 
  				char reason[], 
***************
*** 27,42 ****
  				);
  
  extern int filterAddrs(
! 		       u_long addr1[],u_long addr2[],
! 		       afs_int32  mask1[], afs_int32 mask2[],
! 		       afs_int32  mtu1[], afs_int32 mtu2[]
  		       );
  
  extern int parseNetFiles(
! 			 afs_int32  addrbuf[],
! 			 afs_int32  maskbuf[],
! 			 afs_int32  mtubuf[],
! 			 u_long max,
  			 char reason[],
  			 const char *niFilename,
  			 const char *nrFilename
--- 27,42 ----
  				);
  
  extern int filterAddrs(
! 		       afs_uint32 addr1[],afs_uint32 addr2[],
! 		       afs_uint32  mask1[], afs_uint32 mask2[],
! 		       afs_uint32  mtu1[], afs_uint32 mtu2[]
  		       );
  
  extern int parseNetFiles(
! 			 afs_uint32  addrbuf[],
! 			 afs_uint32  maskbuf[],
! 			 afs_uint32  mtubuf[],
! 			 afs_uint32 max,
  			 char reason[],
  			 const char *niFilename,
  			 const char *nrFilename
Index: openafs/src/util/serverLog.c
diff -c openafs/src/util/serverLog.c:1.2.2.1 openafs/src/util/serverLog.c:1.2.2.5
*** openafs/src/util/serverLog.c:1.2.2.1	Tue Mar  6 17:08:52 2001
--- openafs/src/util/serverLog.c	Mon Apr 23 03:14:28 2001
***************
*** 27,32 ****
--- 27,33 ----
  #endif
  #include <sys/param.h>
  #include <sys/time.h>
+ #include <syslog.h>
  #endif
  #include <afs/procmgmt.h>  /* signal(), kill(), wait(), etc. */
  #include <fcntl.h>
***************
*** 60,85 ****
  #define F_OK 0
  #endif
  
! char *threadname();
  
  static int serverLogFD = -1;
  
  #include <stdarg.h>
  int LogLevel;
  int mrafsStyleLogs = 0;
  int printLocks = 0;
  static char ourName[MAXPATHLEN];
  
- void WriteLogBuffer(buf,len)
-     char *buf;
-     afs_uint32 len;
- {
-     LOCK_SERVERLOG();
-     if (serverLogFD > 0)
-         write(serverLogFD, buf, len);
-     UNLOCK_SERVERLOG();
- }
- 
  /* VARARGS1 */
  void FSLog (const char *format, ...)
  {
--- 61,81 ----
  #define F_OK 0
  #endif
  
! char *(*threadNameProgram)();
  
  static int serverLogFD = -1;
  
+ #ifndef AFS_NT40_ENV
+ int serverLogSyslog = 0;
+ int serverLogSyslogFacility = LOG_DAEMON;
+ #endif
+ 
  #include <stdarg.h>
  int LogLevel;
  int mrafsStyleLogs = 0;
  int printLocks = 0;
  static char ourName[MAXPATHLEN];
  
  /* VARARGS1 */
  void FSLog (const char *format, ...)
  {
***************
*** 99,105 ****
      info = &timeStamp[25];
  
      if (mrafsStyleLogs) {
!        name = threadname();
         sprintf(info, "[%s] ", name);
         info += strlen(info);
      }
--- 95,101 ----
      info = &timeStamp[25];
  
      if (mrafsStyleLogs) {
!        name = (*threadNameProgram)();
         sprintf(info, "[%s] ", name);
         info += strlen(info);
      }
***************
*** 110,122 ****
  
      len = strlen(tbuffer);
      LOCK_SERVERLOG();
!     if (serverLogFD > 0)
! 	write(serverLogFD, tbuffer, len);
      UNLOCK_SERVERLOG();
  
! #if !defined(AFS_PTHREAD_ENV)
!     fflush(stdout);
!     fflush(stderr);     /* in case they're sharing the same FD */
  #endif
  }
  
--- 106,125 ----
  
      len = strlen(tbuffer);
      LOCK_SERVERLOG();
! #ifndef AFS_NT40_ENV
!     if ( serverLogSyslog ){
! 	syslog(LOG_INFO, "%s", info);
!     } else 
! #endif
! 	if (serverLogFD > 0)
! 	    write(serverLogFD, tbuffer, len);
      UNLOCK_SERVERLOG();
  
! #if !defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
!     if ( ! serverLogSyslog ) {
!         fflush(stdout);
!         fflush(stderr);     /* in case they're sharing the same FD */
!     }
  #endif
  }
  
***************
*** 189,194 ****
--- 192,204 ----
      struct tm *TimeFields;
      char FileName[MAXPATHLEN]; 
  
+ #ifndef AFS_NT40_ENV
+     if ( serverLogSyslog ) {
+ 	openlog(NULL, LOG_PID, serverLogSyslogFacility);
+ 	return;
+     }
+ #endif
+ 
      if (mrafsStyleLogs) {
          TM_GetTimeOfDay(&Start, 0);
          TimeFields = localtime(&Start.tv_sec);
***************
*** 243,248 ****
--- 253,264 ----
  
      if (access(fileName, F_OK)==0)
  	return 0; /* exists, no need to reopen. */
+ 
+ #if !defined(AFS_NT40_ENV)
+     if ( serverLogSyslog ) {
+ 	return 0;
+     }
+ #endif
  
  #if defined(AFS_PTHREAD_ENV)
      LOCK_SERVERLOG();
Index: openafs/src/util/snprintf.c
diff -c openafs/src/util/snprintf.c:1.5.2.5 openafs/src/util/snprintf.c:1.5.2.6
*** openafs/src/util/snprintf.c:1.5.2.5	Tue Mar  6 17:27:44 2001
--- openafs/src/util/snprintf.c	Mon Apr 23 02:18:09 2001
***************
*** 1,8 ****
  /* snprintf.c - Formatted, length-limited print to a string */
  
  #include <afs/param.h>
! #if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV)
! 
  #include <sys/types.h>
  #include <stdarg.h>
  #include <stdio.h>
--- 1,7 ----
  /* snprintf.c - Formatted, length-limited print to a string */
  
  #include <afs/param.h>
! #if defined(AFS_OSF20_ENV) && !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || defined(AFS_NT40_ENV)
  #include <sys/types.h>
  #include <stdarg.h>
  #include <stdio.h>
Index: openafs/src/util/uuid.c
diff -c openafs/src/util/uuid.c:1.2 openafs/src/util/uuid.c:1.2.2.1
*** openafs/src/util/uuid.c:1.2	Sat Nov  4 05:06:07 2000
--- openafs/src/util/uuid.c	Mon Apr 23 03:03:22 2001
***************
*** 294,300 ****
  char hostName1[128] = "localhost";
  static int uuid_get_address (uuid_address_p_t addr)
  {
!     afs_int32 code, addr1;
      struct hostent *he;
  
      code = gethostname(hostName1, 64);
--- 294,301 ----
  char hostName1[128] = "localhost";
  static int uuid_get_address (uuid_address_p_t addr)
  {
!     afs_int32 code;
!     afs_uint32 addr1;
      struct hostent *he;
  
      code = gethostname(hostName1, 64);
Index: openafs/src/util/vice.h
diff -c openafs/src/util/vice.h:1.2 openafs/src/util/vice.h:1.2.2.1
*** openafs/src/util/vice.h:1.2	Sat Nov  4 05:06:07 2000
--- openafs/src/util/vice.h	Sun Apr 22 23:51:43 2001
***************
*** 62,68 ****
   * version of _IOW() to check the size of user space arguments -- except
   * on Digital Unix.
   */
! #if defined(KERNEL) && !defined(AFS_OSF_ENV)
  #define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl32))
  #else
  #define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl))
--- 62,68 ----
   * version of _IOW() to check the size of user space arguments -- except
   * on Digital Unix.
   */
! #if defined(KERNEL) && !defined(AFS_OSF_ENV) && !defined(AFS_ALPHA_LINUX20_ENV)
  #define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl32))
  #else
  #define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl))
Index: openafs/src/venus/Makefile
diff -c openafs/src/venus/Makefile:1.2.2.4 openafs/src/venus/Makefile:1.2.2.7
*** openafs/src/venus/Makefile:1.2.2.4	Sat Jan 20 18:20:17 2001
--- openafs/src/venus/Makefile	Mon Apr 23 03:53:14 2001
***************
*** 10,17 ****
  LINUX_VERS=dummy
  include ../config/Makefile.${SYS_NAME}
  
! INSTALL = ${DESTDIR}bin/install
! INSTALLex = ${DESTDIR}bin/install -m 755
  CCXPG2= /usr/xpg2bin/cc
  
  CFLAGS = ${OPTMZ} -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS}
--- 10,16 ----
  LINUX_VERS=dummy
  include ../config/Makefile.${SYS_NAME}
  
! INSTALLex = ${INSTALL} -m 755
  CCXPG2= /usr/xpg2bin/cc
  
  CFLAGS = ${OPTMZ} -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS}
***************
*** 75,81 ****
  	${INSTALL} -s $? $@
  
  ${DESTDIR}etc/kdump: kdump
! 	set -x; \
  	case ${SYS_NAME} in \
  	sgi_6? ) \
  		${INSTALLex} -f kdump.sh.sgi_ipnos $@; \
--- 74,80 ----
  	${INSTALL} -s $? $@
  
  ${DESTDIR}etc/kdump: kdump
! 	-set -x; \
  	case ${SYS_NAME} in \
  	sgi_6? ) \
  		${INSTALLex} -f kdump.sh.sgi_ipnos $@; \
***************
*** 100,106 ****
  	esac
  
  ${DESTDIR}etc/kdump64: kdump64
! 	set -x; \
  	case ${SYS_NAME} in \
  	sun4x_57 | hp_ux11* ) \
  		${INSTALL} -s $? $@ ;;\
--- 99,105 ----
  	esac
  
  ${DESTDIR}etc/kdump64: kdump64
! 	-set -x; \
  	case ${SYS_NAME} in \
  	sun4x_57 | hp_ux11* ) \
  		${INSTALL} -s $? $@ ;;\
***************
*** 162,169 ****
  	$(CC) -o cmdebug cmdebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
  
  kdump.o: kdump.c ${INCLS} AFS_component_version_number.c
! 	set -x; \
  	case ${SYS_NAME} in \
  		*linux* ) \
  			for lv in ${LINUX_VERS}; do \
  				${CC} -g -I${LINUX_SRCDIR}$$lv/include -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS} -o kdump-$$lv.o -c kdump.c ; \
--- 161,172 ----
  	$(CC) -o cmdebug cmdebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
  
  kdump.o: kdump.c ${INCLS} AFS_component_version_number.c
! 	-set -x; \
  	case ${SYS_NAME} in \
+ 		alpha_linux* ) \
+ 			for lv in ${LINUX_VERS}; do \
+ 				${CC} -g -I${LINUX_SRCDIR}$$lv/include -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS} -mno-fp-regs -ffixed-8 -o kdump-$$lv.o -c kdump.c ; \
+ 				done ;; \
  		*linux* ) \
  			for lv in ${LINUX_VERS}; do \
  				${CC} -g -I${LINUX_SRCDIR}$$lv/include -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS} -o kdump-$$lv.o -c kdump.c ; \
***************
*** 197,210 ****
  	esac ;
  
  kdump64.o : kdump.c ${INCLS} AFS_component_version_number.c
! 	set -x; \
  	case ${SYS_NAME} in \
  	sun4x_57 | hp_ux11* ) \
  		${CC} -g -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS64} -o kdump64.o -c kdump.c ;; \
  	esac
  
  kdump:  kdump.o
! 	set -x; \
  	case ${SYS_NAME} in \
  	sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_54) \
  		${CC} -g -o kdump kdump.o ${DESTDIR}lib/afs/libcmd.a  ${DESTDIR}lib/afs/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
--- 200,213 ----
  	esac ;
  
  kdump64.o : kdump.c ${INCLS} AFS_component_version_number.c
! 	-set -x; \
  	case ${SYS_NAME} in \
  	sun4x_57 | hp_ux11* ) \
  		${CC} -g -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS64} -o kdump64.o -c kdump.c ;; \
  	esac
  
  kdump:  kdump.o
! 	-set -x; \
  	case ${SYS_NAME} in \
  	sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_54) \
  		${CC} -g -o kdump kdump.o ${DESTDIR}lib/afs/libcmd.a  ${DESTDIR}lib/afs/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
***************
*** 242,248 ****
  ## kdump to read from 64 bit kernel dumps
  
  kdump64 : kdump64.o
! 	set -x; \
  	case ${SYS_NAME} in \
  	sun4x_57 | hp_ux11* )  \
  		${CC} -g ${XCFLAGS64} -o kdump64 kdump64.o ${DESTDIR}lib/afs/libcmd64.a ${XLIBELFA}  ${XLIBKVM} ${XLIBS} ;; \
--- 245,251 ----
  ## kdump to read from 64 bit kernel dumps
  
  kdump64 : kdump64.o
! 	-set -x; \
  	case ${SYS_NAME} in \
  	sun4x_57 | hp_ux11* )  \
  		${CC} -g ${XCFLAGS64} -o kdump64 kdump64.o ${DESTDIR}lib/afs/libcmd64.a ${XLIBELFA}  ${XLIBKVM} ${XLIBS} ;; \
Index: openafs/src/venus/fs.c
diff -c openafs/src/venus/fs.c:1.2.2.2 openafs/src/venus/fs.c:1.2.2.3
*** openafs/src/venus/fs.c:1.2.2.2	Fri Jan 19 04:55:52 2001
--- openafs/src/venus/fs.c	Mon Apr 23 02:52:41 2001
***************
*** 3045,3050 ****
--- 3045,3052 ----
      ts = cmd_CreateSyntax("setcrypt", SetCryptCmd, 0, "set cache manager encryption flag");
      cmd_AddParm(ts, "-crypt", CMD_SINGLE, 0, "on or off");
  
+     ts = cmd_CreateSyntax("getcrypt", GetCryptCmd, 0, "set cache manager encryption flag");
+ 
      ts = cmd_CreateSyntax("rxstatproc", RxStatProcCmd, 0,
  			  "Manage per process RX statistics");
      cmd_AddParm(ts, "-enable", CMD_FLAG, CMD_OPTIONAL,
Index: openafs/src/venus/fstrace.c
diff -c openafs/src/venus/fstrace.c:1.2.2.1 openafs/src/venus/fstrace.c:1.2.2.2
*** openafs/src/venus/fstrace.c:1.2.2.1	Fri Jan 19 04:30:15 2001
--- openafs/src/venus/fstrace.c	Mon Apr 23 00:08:48 2001
***************
*** 13,19 ****
  #include <afs/param.h>
  #include <stdio.h>
  #include <sys/types.h>
! #if !defined(AFS_SUN3_ENV) && !defined(sys_vax_ul43)
  #include <time.h>
  /*#ifdef	AFS_AIX_ENV*/
  #include <sys/time.h>
--- 13,19 ----
  #include <afs/param.h>
  #include <stdio.h>
  #include <sys/types.h>
! #if !defined(AFS_SUN3_ENV) && !defined(sys_vax_ul43) && !defined(AFS_DARWIN_ENV)
  #include <time.h>
  /*#ifdef	AFS_AIX_ENV*/
  #include <sys/time.h>
Index: openafs/src/venus/kdump.c
diff -c openafs/src/venus/kdump.c:1.4.2.3 openafs/src/venus/kdump.c:1.4.2.6
*** openafs/src/venus/kdump.c:1.4.2.3	Fri Jan 19 04:36:45 2001
--- openafs/src/venus/kdump.c	Mon Apr 23 03:31:10 2001
***************
*** 195,200 ****
--- 195,207 ----
  #include <vfs/vnode.h>
  #include <sys/inode.h>
  #else /* AFS_MACH_ENV */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include <sys/vnode.h>
+ #include <sys/mount.h>
+ #include <ufs/ufs/quota.h> 
+ #include <ufs/ufs/inode.h>
+ #include <ufs/ffs/fs.h> 
+ #else
  #include "sys/vfs.h"
  #ifdef AFS_LINUX20_ENV
  #define UIO_MAXIOV 1 /* don't care */
***************
*** 220,236 ****
--- 227,249 ----
  #ifdef AFS_SPARC_LINUX20_ENV
  #define _SPARC_STATFS_H
  #else
+ #ifdef AFS_ALPHA_LINUX20_ENV
+ #define _ALPHA_STATFS_H
+ #else
  #define _I386_STATFS_H
+ #endif /* AFS_ALPHA_LINUX20_ENV */
  #endif /* AFS_SPARC_LINUX20_ENV */
  #endif /* AFS_SPARC64_LINUX20_ENV */
  #endif /* AFS_S390_LINUX20_ENV */
  struct timezone {
      int a,b;
  };
+ #ifndef AFS_ALPHA_LINUX20_ENV
  typedef struct timeval {
      int tv_sec;
      int tv_usec;
  } timeval_t; /* Needed here since KERNEL defined. */
+ #endif /*AFS_ALPHA_LINUX20_ENV*/
  #if defined(AFSBIG_ENDIAN)
  #define _LINUX_BYTEORDER_BIG_ENDIAN_H
  #else
***************
*** 274,279 ****
--- 287,293 ----
  #endif
  #endif
  #endif
+ #endif
  #endif /* AFS_MACH_ENV */
  #include <signal.h>
  #endif
***************
*** 924,929 ****
--- 938,944 ----
  #endif /*AFS_KDUMP_LIB */
  #endif
  
+ #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  int
  findsym( char *sname, off_t *offset )
  {
***************
*** 988,999 ****
--- 1003,1018 ----
  	}
  #endif	/* defined(AFS_SUN5_ENV) */
  }
+ #endif
  
  #define CBHTSIZE 128
  
  kdump()
  {
      int cell, cnt, cnt1;
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+    printf("Kdump not supported\n");
+ #else
  #ifndef AFS_KDUMP_LIB
  
      kmem = opencore(core);
***************
*** 1123,1131 ****
--- 1142,1152 ----
      if (Dgcpags || Dall) {
  	print_gcpags(1);
      }
+ #endif
      return 0;
  }
  
+ #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;
  
***************
*** 4010,4015 ****
--- 4031,4037 ----
  #endif
  }
  
+ #endif
  #if 0
  #define OffsetOf(s,mem)	((long)(&(((s *)0)->mem)))
  #define SizeOf(s,mem)	((long)sizeof(((s *)0)->mem))
Index: openafs/src/venus/up.c
diff -c openafs/src/venus/up.c:1.2 openafs/src/venus/up.c:1.2.2.2
*** openafs/src/venus/up.c:1.2	Sat Nov  4 05:06:12 2000
--- openafs/src/venus/up.c	Mon Apr 23 03:31:13 2001
***************
*** 42,48 ****
  
  extern char *index ();
  extern char *rindex ();
! #ifndef AFS_LINUX20_ENV
  extern sys_nerr;
  extern char *sys_errlist[];
  #endif
--- 42,48 ----
  
  extern char *index ();
  extern char *rindex ();
! #if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  extern sys_nerr;
  extern char *sys_errlist[];
  #endif
Index: openafs/src/vfsck/Makefile
diff -c openafs/src/vfsck/Makefile:1.1 openafs/src/vfsck/Makefile:1.1.6.1
*** openafs/src/vfsck/Makefile:1.1	Fri Nov  3 21:30:14 2000
--- openafs/src/vfsck/Makefile	Mon Apr 23 00:08:55 2001
***************
*** 19,25 ****
  COMPONENT=vfsck
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
  CFLAGS=	${DBUG} -w -I${SRCDIR}include ${XCFLAGS}
  LIBC=	/lib/libc.a
  SRCS=	dir.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \
--- 19,24 ----
***************
*** 44,50 ****
  	    ${CC} -o vfsck -I/usr/old/usr/include ${DBUG} -w -I${SRCDIR}include ${SRCS} ${NON_SHARED} +DA1.0 -Wl,-a,archive -D_FILE64 \
  			;;					\
  	  hp?00_ux101 | hp_ux10? )				\
!     	    ${CC} -o vfsck ${CFLAGS} ${SRCS} ${NON_SHARED} ${XLIBS} -D_FILE64\
  			;;					\
  	    * )							\
  	    ${CC} -o vfsck ${CFLAGS} ${SRCS} ${NON_SHARED} ${XLIBS}\
--- 43,49 ----
  	    ${CC} -o vfsck -I/usr/old/usr/include ${DBUG} -w -I${SRCDIR}include ${SRCS} ${NON_SHARED} +DA1.0 -Wl,-a,archive -D_FILE64 \
  			;;					\
  	  hp?00_ux101 | hp_ux10? )				\
! 	    ${CC} -o vfsck ${CFLAGS} ${SRCS} ${NON_SHARED} ${XLIBS} -D_FILE64\
  			;;					\
  	    * )							\
  	    ${CC} -o vfsck ${CFLAGS} ${SRCS} ${NON_SHARED} ${XLIBS}\
Index: openafs/src/viced/Makefile
diff -c openafs/src/viced/Makefile:1.2 openafs/src/viced/Makefile:1.2.2.1
*** openafs/src/viced/Makefile:1.2	Sat Nov  4 05:06:14 2000
--- openafs/src/viced/Makefile	Mon Apr 23 00:09:00 2001
***************
*** 10,16 ****
  include ../config/Makefile.${SYS_NAME}
  
  DBUG = -g
- INSTALL = ${SRCDIR}bin/install
  CFLAGS =  -DNINTERFACE ${DBUG} -I. -I${SRCDIR}include -I${SRCDIR}include/afs \
  	 ${XCFLAGS} ${DBG_DEFS} -DRXDEBUG
  LDFLAGS = ${DBUG} ${XLDFLAGS}
--- 10,15 ----
***************
*** 70,76 ****
  check_sysid: check_sysid.c
  	${CC} ${CFLAGS} -IDEST/include -o check_sysid check_sysid.c
  
! fileserver: callback_clean1 viced.o ${objects} ${headers} ${LIBS}
  	set -x; \
  	case ${SYS_NAME} in \
  	*linux*) \
--- 69,75 ----
  check_sysid: check_sysid.c
  	${CC} ${CFLAGS} -IDEST/include -o check_sysid check_sysid.c
  
! fileserver: viced.o ${objects} ${headers} ${LIBS}
  	set -x; \
  	case ${SYS_NAME} in \
  	*linux*) \
***************
*** 84,94 ****
  	    ${auditlib} ${LIBS} ${XLIBS} ;; \
  	esac
  
! fsprobe: fsprobe.c  AFS_component_version_number.c
! 	${CC} ${CFLAGS} -DINTERPRET_DUMP -o fsprobe fsprobe.c ${LIBS} ${XLIBS}  
! cbd: callback_clean2 callback.c AFS_component_version_number.c
! 	${CC} ${CFLAGS} -DINTERPRET_DUMP -o cbd callback.c ${LIBS} ${XLIBS}  
  
  lint:
  	lint -uvn  -I${SRCDIR}include viced.c afsfileprocs.c host.c physio.c callback.c ${SRCDIR}lib/afs/llib-lutil.ln
  
--- 83,100 ----
  	    ${auditlib} ${LIBS} ${XLIBS} ;; \
  	esac
  
! fsprobe.o: fsprobe.c  AFS_component_version_number.c
! 	${CC} ${CFLAGS} -DINTERPRET_DUMP -c fsprobe.c
  
+ fsprobe: fsprobe.o
+ 	${CC} ${CFLAGS} -o fsprobe fsprobe.o ${LIBS} ${XLIBS}  
+ 
+ cbd.o: callback.c AFS_component_version_number.c
+ 	${CC} ${CFLAGS} -DINTERPRET_DUMP -c -o cbd.o callback.c
+ 
+ cbd: cbd.o
+ 	${CC} ${CFLAGS} -DINTERPRET_DUMP -o cbd cbd.o ${LIBS} ${XLIBS}  
+ 
  lint:
  	lint -uvn  -I${SRCDIR}include viced.c afsfileprocs.c host.c physio.c callback.c ${SRCDIR}lib/afs/llib-lutil.ln
  
***************
*** 105,117 ****
  	${INSTALL} fs_stats.h ${DESTDIR}/include/afs
  
  system: install
- 
- callback_clean1 callback_clean2: 
- 	case ${SYS_NAME} in \
- 	ncrx86_*) \
- 		${RM}  -f callback.o;\
- 		echo ${RM} callback.o;;\
- 	esac;
  
  clean:
  	rm -f *.o llib-lvice.ln fileserver core AFS_component_version_number.c
--- 111,116 ----
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.2.2.1 openafs/src/viced/afsfileprocs.c:1.2.2.4
*** openafs/src/viced/afsfileprocs.c:1.2.2.1	Tue Mar  6 16:38:58 2001
--- openafs/src/viced/afsfileprocs.c	Mon Apr 23 03:31:19 2001
***************
*** 74,80 ****
  #include <rx/rx.h>
  #include <rx/rx_globals.h>
  #include <sys/stat.h>
! #if ! defined(AFS_SGI_ENV) && ! defined(AFS_AIX32_ENV) && ! defined(AFS_NT40_ENV) && ! defined(AFS_LINUX20_ENV)
  #include <sys/map.h>
  #endif
  #if !defined(AFS_NT40_ENV)
--- 74,80 ----
  #include <rx/rx.h>
  #include <rx/rx_globals.h>
  #include <sys/stat.h>
! #if ! defined(AFS_SGI_ENV) && ! defined(AFS_AIX32_ENV) && ! defined(AFS_NT40_ENV) && ! defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #include <sys/map.h>
  #endif
  #if !defined(AFS_NT40_ENV)
***************
*** 85,91 ****
  #include <sys/statfs.h>
  #include <sys/lockf.h>
  #else
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV)
  #include <sys/dk.h>
  #endif
  #endif
--- 85,91 ----
  #include <sys/statfs.h>
  #include <sys/lockf.h>
  #else
! #if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #include <sys/dk.h>
  #endif
  #endif
***************
*** 314,320 ****
      else if (thost->hostFlags & VENUSDOWN) {
        if (BreakDelayedCallBacks_r(thost)) {
  	ViceLog(0,("BreakDelayedCallbacks FAILED for host %08x which IS UP.  Possible network or routing failure.\n",thost->host));
! 	code = -1;
        }
      } else {
         code =  0;
--- 314,331 ----
      else if (thost->hostFlags & VENUSDOWN) {
        if (BreakDelayedCallBacks_r(thost)) {
  	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;
! 	    }
! 	}
        }
      } else {
         code =  0;
Index: openafs/src/viced/callback.c
diff -c openafs/src/viced/callback.c:1.2 openafs/src/viced/callback.c:1.2.2.1
*** openafs/src/viced/callback.c:1.2	Sat Nov  4 05:06:15 2000
--- openafs/src/viced/callback.c	Sun Apr 22 23:51:53 2001
***************
*** 141,147 ****
      u_short	    ncbs;
      u_short	    firstcb;
      u_short	    spare;
! #ifdef	AFS_ALPHA_ENV
      u_short	    spare1;
      u_short	    spare2;
  #endif
--- 141,147 ----
      u_short	    ncbs;
      u_short	    firstcb;
      u_short	    spare;
! #if defined(AFS_ALPHA_ENV) || defined(AFS_ALPHA_LINUX20_ENV)
      u_short	    spare1;
      u_short	    spare2;
  #endif
Index: openafs/src/viced/viced.c
diff -c openafs/src/viced/viced.c:1.2 openafs/src/viced/viced.c:1.2.2.2
*** openafs/src/viced/viced.c:1.2	Sat Nov  4 05:06:17 2000
--- openafs/src/viced/viced.c	Sun Apr 22 23:51:54 2001
***************
*** 563,570 ****
      assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
      /* Block signals in the threads */
      AFS_SIGSET_CLEAR();
!     assert(pthread_create(&serverPid, &tattr, FiveMinuteCheckLWP, &fiveminutes) == 0);
!     assert(pthread_create(&serverPid, &tattr, HostCheckLWP, &fiveminutes) == 0);
      AFS_SIGSET_RESTORE();
  #else /* AFS_PTHREAD_ENV */
      assert(LWP_CreateProcess(FiveMinuteCheckLWP, stack*1024, LWP_MAX_PRIORITY - 2,
--- 563,570 ----
      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,
***************
*** 1177,1182 ****
--- 1177,1194 ----
  	    if (!strcmp(argv[i], "-enable_process_stats")) {
  		rx_enableProcessRPCStats();
  	    }
+ #ifndef AFS_NT40_ENV
+         else 
+ 	    if (strcmp(argv[i], "-syslog")==0) {
+ 		/* set syslog logging flag */
+ 		serverLogSyslog = 1;
+ 	    } 
+ 	else 
+ 	    if (strncmp(argv[i], "-syslog=", 8)==0) {
+ 		serverLogSyslog = 1;
+ 		serverLogSyslogFacility = atoi(argv[i]+8);
+ 	    }
+ #endif
  	else {
  	    return(-1);
  	}
Index: openafs/src/vlserver/Makefile
diff -c openafs/src/vlserver/Makefile:1.2 openafs/src/vlserver/Makefile:1.2.2.1
*** openafs/src/vlserver/Makefile:1.2	Sat Nov  4 05:06:18 2000
--- openafs/src/vlserver/Makefile	Mon Apr 23 00:09:06 2001
***************
*** 12,18 ****
  
  KERNELDIR=../libafs/
  UKERNELDIR=../libuafs/
- INSTALL=${SRCDIR}bin/install
  COMPILE_ET = ${SRCDIR}bin/compile_et
  
  CFLAGS = ${DBUG} -I. -I.. -I${SRCDIR}include ${XCFLAGS}
--- 12,17 ----
Index: openafs/src/vlserver/vlserver.c
diff -c openafs/src/vlserver/vlserver.c:1.2.2.2 openafs/src/vlserver/vlserver.c:1.2.2.3
*** openafs/src/vlserver/vlserver.c:1.2.2.2	Tue Mar  6 16:49:47 2001
--- openafs/src/vlserver/vlserver.c	Sun Apr 22 23:41:00 2001
***************
*** 164,172 ****
--- 164,183 ----
  	    rx_enablePeerRPCStats();
  	} else if (strcmp(argv[index], "-enable_process_stats") == 0) {
  	    rx_enableProcessRPCStats();
+ #ifndef AFS_NT40_ENV
+ 	} else if (strcmp(argv[index], "-syslog")==0) {
+ 	    /* set syslog logging flag */
+ 	    serverLogSyslog = 1;
+ 	} else if (strncmp(argv[index], "-syslog=", 8)==0) {
+ 	    serverLogSyslog = 1;
+ 	    serverLogSyslogFacility = atoi(argv[index]+8);
+ #endif
  	} else {
  	    /* support help flag */
  	    printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
+ #ifndef AFS_NT40_ENV
+ 		   "[-syslog[=FACILITY]] "
+ #endif
  		   /*" [-enable_peer_stats] [-enable_process_stats] " */
  		   "[-help]\n");
  	    fflush(stdout);
Index: openafs/src/vol/Makefile
diff -c openafs/src/vol/Makefile:1.2.2.1 openafs/src/vol/Makefile:1.2.2.4
*** openafs/src/vol/Makefile:1.2.2.1	Tue Mar  6 16:10:51 2001
--- openafs/src/vol/Makefile	Mon Apr 23 03:31:26 2001
***************
*** 11,17 ****
  include ../config/Makefile.version
  
  INCDIRS= -I. -I${DESTDIR}include ${FSINCLUDES}
- INSTALL = ${SRCDIR}bin/install
  LDFLAGS = ${OPTMZ} ${PROF} ${LDIRS} ${XLDFLAGS}
  
  LIBS= ${DESTDIR}lib/afs/libcmd.a vlib.a ${SRCDIR}lib/afs/util.a \
--- 11,16 ----
***************
*** 77,90 ****
  
  # new salvager:  remove references to /vice by linking with novice.o
  salvager: vol-salvage.o physio.o vlib.a
! 	case ${SYS_NAME} in \
!                 *linux* ) \
!                         ${CC} ${LDFLAGS} -o salvager vol-salvage.o physio.o \
! 				${LIBS}  ;; \
!                 *) \
!                         ${CC} ${LDFLAGS} -o salvager vol-salvage.o physio.o \
! 				${LIBS};; \
!         esac
  
  vol-salvage: vol-salvage.o
  vol-info: vol-info.o physio.o ihandle.o
--- 76,82 ----
  
  # new salvager:  remove references to /vice by linking with novice.o
  salvager: vol-salvage.o physio.o vlib.a
! 	${CC} ${LDFLAGS} -o salvager vol-salvage.o physio.o ${LIBS}
  
  vol-salvage: vol-salvage.o
  vol-info: vol-info.o physio.o ihandle.o
***************
*** 100,106 ****
  
  gi: ${DESTDIR}/lib/afs/libsys.a
  	case ${SYS_NAME} in \
!                 *linux* | sgi_* ) \
  			echo "Don't build gi on ${SYS_NAME}";; \
                  *) \
  			${CC} ${CFLAGS} -c gi.c ; \
--- 92,98 ----
  
  gi: ${DESTDIR}/lib/afs/libsys.a
  	case ${SYS_NAME} in \
!                 *linux* | sgi_* | *fbsd* ) \
  			echo "Don't build gi on ${SYS_NAME}";; \
                  *) \
  			${CC} ${CFLAGS} -c gi.c ; \
Index: openafs/src/vol/devname.c
diff -c openafs/src/vol/devname.c:1.2.2.1 openafs/src/vol/devname.c:1.2.2.3
*** openafs/src/vol/devname.c:1.2.2.1	Tue Mar  6 16:10:52 2001
--- openafs/src/vol/devname.c	Mon Apr 23 03:31:27 2001
***************
*** 21,30 ****
  #ifdef	AFS_SUN5_ENV
  #include <sys/fs/ufs_fs.h>
  #else
  #include <ufs/fs.h>
  #endif
  #else /* AFS_VFSINCL_ENV */
! #if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX22_ENV)
  #include <sys/fs.h>
  #endif
  #endif /* AFS_VFSINCL_ENV */
--- 21,35 ----
  #ifdef	AFS_SUN5_ENV
  #include <sys/fs/ufs_fs.h>
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ffs/fs.h>
+ #else
  #include <ufs/fs.h>
  #endif
+ #endif
  #else /* AFS_VFSINCL_ENV */
! #if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_FBSD_ENV)
  #include <sys/fs.h>
  #endif
  #endif /* AFS_VFSINCL_ENV */
Index: openafs/src/vol/listinodes.c
diff -c openafs/src/vol/listinodes.c:1.2.2.1 openafs/src/vol/listinodes.c:1.2.2.4
*** openafs/src/vol/listinodes.c:1.2.2.1	Tue Mar  6 16:10:52 2001
--- openafs/src/vol/listinodes.c	Wed Apr 25 01:47:32 2001
***************
*** 10,15 ****
--- 10,16 ----
  #ifndef lint
  #endif
  /*
+ 
  	System:		VICE-TWO
  	Module:		listinodes.c
  	Institution:	The Information Technology Center, Carnegie-Mellon University
***************
*** 49,56 ****
--- 50,63 ----
  #ifdef	  AFS_SUN5_ENV
  #include <sys/fs/ufs_fs.h>
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ffs/fs.h>
+ #define itod ino_to_fsba
+ #else
  #include <ufs/fs.h>
  #endif
+ #endif
  #else /* AFS_VFSINCL_ENV */
  #ifdef	AFS_AIX_ENV
  #include <sys/filsys.h>
***************
*** 65,72 ****
--- 72,81 ----
  #ifdef	  AFS_SUN5_ENV
  #include <sys/fs/ufs_inode.h>
  #else
+ #if !defined(AFS_DARWIN_ENV)
  #include <ufs/inode.h>
  #endif
+ #endif
  #else /* AFS_VFSINCL_ENV */
  #ifdef AFS_DEC_ENV
  #include <sys/time.h>
***************
*** 1243,1249 ****
     if (
        (super.fs.fs_magic != FS_MAGIC)
     || (super.fs.fs_ncg < 1)
! #if	defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV)
     || (super.fs.fs_cpg < 1)
  #else
     || (super.fs.fs_cpg < 1 || super.fs.fs_cpg > MAXCPG)
--- 1252,1258 ----
     if (
        (super.fs.fs_magic != FS_MAGIC)
     || (super.fs.fs_ncg < 1)
! #if	defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
     || (super.fs.fs_cpg < 1)
  #else
     || (super.fs.fs_cpg < 1 || super.fs.fs_cpg > MAXCPG)
***************
*** 1279,1286 ****
  #else
     for (c = 0; c < super.fs.fs_ncg; c++) {
         daddr_t dblk1;
! #ifdef	AFS_SUN5_ENV
         daddr_t f1;
         offset_t off;
  #endif /* AFS_SUN5_ENV */
  	i = c*super.fs.fs_ipg; e = i+super.fs.fs_ipg;
--- 1288,1299 ----
  #else
     for (c = 0; c < super.fs.fs_ncg; c++) {
         daddr_t dblk1;
! #if defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV)
         daddr_t f1;
+ #if defined(AFS_DARWIN_ENV)
+ #define offset_t off_t
+ #define llseek lseek
+ #endif
         offset_t off;
  #endif /* AFS_SUN5_ENV */
  	i = c*super.fs.fs_ipg; e = i+super.fs.fs_ipg;
***************
*** 1288,1294 ****
  	dblk1 = fsbtodb(&super.fs, itod(&super.fs, i));
  	if (lseek(pfd, (off_t) ((off_t)dblk1 * DEV_BSIZE), L_SET) == -1) {
  #else
! #ifdef	AFS_SUN5_ENV 
  	f1 = fsbtodb(&super.fs,itod(&super.fs,i));
  	off = (offset_t)f1 << DEV_BSHIFT;
  	if (llseek(pfd, off, L_SET) == -1) {
--- 1301,1307 ----
  	dblk1 = fsbtodb(&super.fs, itod(&super.fs, i));
  	if (lseek(pfd, (off_t) ((off_t)dblk1 * DEV_BSIZE), L_SET) == -1) {
  #else
! #if defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV)
  	f1 = fsbtodb(&super.fs,itod(&super.fs,i));
  	off = (offset_t)f1 << DEV_BSHIFT;
  	if (llseek(pfd, off, L_SET) == -1) {
***************
*** 1444,1449 ****
--- 1457,1467 ----
  }
  #endif 	/* !AFS_SGI_ENV */
  #endif	/* !AFS_AIX31_ENV	*/
+ 
+ #ifdef AFS_DARWIN_ENV
+ #undef dbtob
+ #define dbtob(db) ((unsigned)(db) << DEV_BSHIFT)
+ #endif
  
  int bread(fd, buf, blk, size)
  	int fd;
Index: openafs/src/vol/namei_ops.c
diff -c openafs/src/vol/namei_ops.c:1.2 openafs/src/vol/namei_ops.c:1.2.2.2
*** openafs/src/vol/namei_ops.c:1.2	Sat Nov  4 05:06:23 2000
--- openafs/src/vol/namei_ops.c	Mon Apr 23 03:01:09 2001
***************
*** 22,27 ****
--- 22,33 ----
  #include <sys/file.h>
  #include <sys/param.h>
  #include <lock.h>
+ #ifdef AFS_AIX_ENV
+ #include <sys/lockf.h>
+ #endif
+ #ifdef AFS_SUN5_ENV
+ #include <unistd.h>
+ #endif
  #include <afs/afsutil.h>
  #include <lwp.h>
  #include "nfs.h"
***************
*** 805,811 ****
--- 811,821 ----
      namei_GetLCOffsetAndIndexFromIno(ino, &offset, &index);
  
      if (lockit) {
+ #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV)
+         if (lockf(h->fd_fd, F_LOCK, 0) < 0)
+ #else
  	if (flock(h->fd_fd, LOCK_EX)<0)
+ #endif
  	    return -1;
      }
  
***************
*** 820,826 ****
--- 830,840 ----
  
   bad_getLinkByte:
      if (lockit)
+ #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV)
+ 	lockf(h->fd_fd, F_ULOCK, 0);
+ #else
  	flock(h->fd_fd, LOCK_UN);
+ #endif
      return -1;
  }
  
***************
*** 840,846 ****
--- 854,864 ----
  	return -1;
  
      /* Only one manipulates at a time. */
+ #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV)
+     if (lockf(fdP->fd_fd, F_LOCK, 0) < 0) {
+ #else
      if (flock(fdP->fd_fd, LOCK_EX)<0) {
+ #endif
  	FDH_REALLYCLOSE(fdP);
  	return -1;
      }
***************
*** 858,868 ****
      }
  	
      /* Now find a free column in this row and claim it. */
-     coldata = 0x7;
      for (col = 0; col<NAMEI_MAXVOLS; col++) {
! 	coldata <<= col * 3;
! 	if ((row & coldata) == 0)
! 	    break;
      }
      if (col >= NAMEI_MAXVOLS)
  	goto badGetFreeTag;
--- 876,885 ----
      }
  	
      /* Now find a free column in this row and claim it. */
      for (col = 0; col<NAMEI_MAXVOLS; col++) {
!         coldata = 7 << (col * 3);
!         if ((row & coldata) == 0)
!             break;
      }
      if (col >= NAMEI_MAXVOLS)
  	goto badGetFreeTag;
***************
*** 877,888 ****
--- 894,913 ----
  	goto badGetFreeTag;
      }
      FDH_SYNC(fdP);
+ #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV)
+     lockf(fdP->fd_fd, F_ULOCK, 0);
+ #else
      flock(fdP->fd_fd, LOCK_UN);
+ #endif
      FDH_REALLYCLOSE(fdP);
      return col;;
  
   badGetFreeTag:
+ #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV)
+     lockf(fdP->fd_fd, F_ULOCK, 0);
+ #else
      flock(fdP->fd_fd, LOCK_UN);
+ #endif
      FDH_REALLYCLOSE(fdP);
      return -1;
  }
***************
*** 902,910 ****
  
      namei_GetLCOffsetAndIndexFromIno(ino, &offset, &index);
  
- 
      if (!locked) {
  	if (flock(fdP->fd_fd, LOCK_EX)<0) {
  	    return -1;
  	}
      }
--- 927,938 ----
  
      namei_GetLCOffsetAndIndexFromIno(ino, &offset, &index);
  
      if (!locked) {
+ #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV)
+         if (lockf(fdP->fd_fd, F_LOCK, 0) < 0) {
+ #else
  	if (flock(fdP->fd_fd, LOCK_EX)<0) {
+ #endif
  	    return -1;
  	}
      }
***************
*** 943,949 ****
--- 971,981 ----
  
      
  bad_SetLinkCount:
+ #if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV)
+     lockf(fdP->fd_fd, F_ULOCK, 0);
+ #else
      flock(fdP->fd_fd, LOCK_UN);
+ #endif
  
      return code;
  }
Index: openafs/src/vol/partition.c
diff -c openafs/src/vol/partition.c:1.2.2.2 openafs/src/vol/partition.c:1.2.2.6
*** openafs/src/vol/partition.c:1.2.2.2	Tue Mar  6 17:22:52 2001
--- openafs/src/vol/partition.c	Mon Apr 23 03:31:27 2001
***************
*** 10,15 ****
--- 10,16 ----
  #ifndef lint
  #endif
  /*
+ 
  	System:		VICE-TWO
  	Module:		partition.c
  	Institution:	The Information Technology Center, Carnegie-Mellon University
***************
*** 24,33 ****
  #include <winioctl.h>
  #else
  #include <sys/param.h>
! 
  #if AFS_HAVE_STATVFS
  #include <sys/statvfs.h>
  #endif /* AFS_HAVE_STATVFS */
  
  #if !defined(AFS_SGI_ENV)
  #ifdef	AFS_OSF_ENV
--- 25,38 ----
  #include <winioctl.h>
  #else
  #include <sys/param.h>
! #include <sys/types.h>
!  
  #if AFS_HAVE_STATVFS
  #include <sys/statvfs.h>
  #endif /* AFS_HAVE_STATVFS */
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include <sys/mount.h>
+ #endif
  
  #if !defined(AFS_SGI_ENV)
  #ifdef	AFS_OSF_ENV
***************
*** 39,48 ****
  #ifdef	AFS_SUN5_ENV
  #include <sys/fs/ufs_fs.h>
  #else
  #include <ufs/fs.h>
  #endif
  #else /* AFS_VFSINCL_ENV */
! #if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX22_ENV)
  #include <sys/fs.h>
  #endif
  #endif /* AFS_VFSINCL_ENV */
--- 44,58 ----
  #ifdef	AFS_SUN5_ENV
  #include <sys/fs/ufs_fs.h>
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ffs/fs.h>
+ #else
  #include <ufs/fs.h>
  #endif
+ #endif
  #else /* AFS_VFSINCL_ENV */
! #if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
  #include <sys/fs.h>
  #endif
  #endif /* AFS_VFSINCL_ENV */
***************
*** 101,107 ****
  #include "ntops.h"
  #else
  #include "namei_ops.h"
! #endif
  #endif /* AFS_NAMEI_ENV */
  #include "vnode.h"
  #include "volume.h"
--- 111,122 ----
  #include "ntops.h"
  #else
  #include "namei_ops.h"
! #if defined(AFS_SGI_ENV)
! #include <sys/dir.h>
! #else
! #include <dirent.h>
! #endif /* AFS_SGI_ENV */
! #endif /* AFS_NT40_ENV */
  #endif /* AFS_NAMEI_ENV */
  #include "vnode.h"
  #include "volume.h"
***************
*** 226,231 ****
--- 241,249 ----
       char *devname;
  {
      struct stat status;
+ #if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV)
+     char AFSIDatPath[MAXPATHLEN];
+ #endif
  
      /* Only keep track of "/vicepx" partitions since it can get hairy
       * when NFS mounts are involved.. */
***************
*** 249,254 ****
--- 267,299 ----
      }
  #endif
  
+ #if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV)
+     strcpy(AFSIDatPath, part);
+     strcat(AFSIDatPath, "/AFSIDat");
+ #ifdef AFS_NAMEI_ENV
+     if (stat(AFSIDatPath, &status) < 0) {
+ 	DIR *dirp;
+ 	struct dirent *dp;
+ 
+ 	dirp = opendir(part);
+ 	assert(dirp);
+ 	while (dp = readdir(dirp)) {
+ 	    if (dp->d_name[0] == 'V') {
+ 		Log("This program is compiled with AFS_NAMEI_ENV, but partition %s seems to contain volumes which don't use the namei-interface; aborting\n", part);
+ 		closedir(dirp);
+ 	        return -1;
+ 	    }
+ 	}
+ 	closedir(dirp);
+     }
+ #else /* AFS_NAMEI_ENV */
+     if (stat(AFSIDatPath, &status) == 0) {
+ 	Log("This program is compiled without AFS_NAMEI_ENV, but partition %s seems to contain volumes which use the namei-interface; aborting\n", part);
+ 	return -1;
+     }
+ #endif /* AFS_NAMEI_ENV */f
+ #endif
+ 
  #ifdef AFS_SGI_XFS_IOPS_ENV
      if (VerifyXFSInodeSize(part, status.st_fstype) < 0)
  	return -1;
***************
*** 409,415 ****
  
  }
  #endif
! #ifdef AFS_DUX40_ENV
  int VAttachPartitions(void)
  {
      int errors = 0;
--- 454,460 ----
  
  }
  #endif
! #if defined(AFS_DUX40_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  int VAttachPartitions(void)
  {
      int errors = 0;
Index: openafs/src/vol/vol-info.c
diff -c openafs/src/vol/vol-info.c:1.2 openafs/src/vol/vol-info.c:1.2.2.2
*** openafs/src/vol/vol-info.c:1.2	Sat Nov  4 05:06:26 2000
--- openafs/src/vol/vol-info.c	Mon Apr 23 03:14:40 2001
***************
*** 58,63 ****
--- 58,66 ----
  int DumpInodeNumber = 0;	/* Dump inode numbers with vnodes */
  int DumpDate = 0;		/* Dump vnode date (server modify date) with vnode */
  int InodeTimes = 0;		/* Dump some of the dates associated with inodes */
+ #if defined(AFS_NAMEI_ENV)
+ int PrintFileNames = 0;
+ #endif
  int online = 0;
  int dheader=0;
  int dsizeOnly = 0, totvolsize=0, Vauxsize = 0, Vdiskused = 0, Vvnodesize = 0;
***************
*** 74,81 ****
--- 77,89 ----
  struct DiskPartition *FindCurrentPartition(void);
  Volume *AttachVolume(struct DiskPartition *dp, char *volname,
  		     register struct VolumeHeader *header);
+ #if defined(AFS_NAMEI_ENV)
+ void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber,
+ 		Inode ino, Volume* vp);
+ #else
  void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber,
  		Inode ino);
+ #endif
  void PrintVnodes(Volume *vp, VnodeClass class);
  
  char *date(time_t date)
***************
*** 256,261 ****
--- 264,275 ----
  	orphaned = 1;
  	DumpVnodes = 1;
      } else    
+ #if defined(AFS_NAMEI_ENV)
+     if (as->parms[12].items) {
+ 	PrintFileNames = 1;
+ 	DumpVnodes = 1;
+     } else    
+ #endif
  	orphaned = 0;    
  
      DInit(10);
***************
*** 593,598 ****
--- 607,615 ----
      cmd_AddParm(ts, "-fixheader", CMD_FLAG, CMD_OPTIONAL, "Try to fix header");    
      cmd_AddParm(ts, "-saveinodes", CMD_FLAG, CMD_OPTIONAL, "Try to save all inodes");    
      cmd_AddParm(ts, "-orphaned", CMD_FLAG, CMD_OPTIONAL, "List all dir/files without a parent");    
+ #if defined(AFS_NAMEI_ENV)
+     cmd_AddParm(ts, "-filenames", CMD_FLAG, CMD_OPTIONAL, "Print filenames");    
+ #endif
      code = cmd_Dispatch(argc, argv);
      return code;
  }
***************
*** 769,784 ****
--- 786,818 ----
  		       ino, nfile, total);
  	    }
  	} else {
+ #if defined(AFS_NAMEI_ENV)
+ 	    PrintVnode(offset, vnode,
+ 		       bitNumberToVnodeNumber(vnodeIndex, class), ino, vp);
+ #else
  	    PrintVnode(offset, vnode,
  		       bitNumberToVnodeNumber(vnodeIndex, class), ino);
+ #endif
  	}
      }
      STREAM_CLOSE(file);
      FDH_CLOSE(fdP);
  }
  
+ #if defined(AFS_NAMEI_ENV)
+ void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber, Inode ino, Volume *vp)
+ #else
  void PrintVnode(int offset, VnodeDiskObject *vnode, int vnodeNumber, Inode ino)
+ #endif
  {
+ #if defined(AFS_NAMEI_ENV)
+     IHandle_t *ihtmpp;
+ #if !defined(AFS_NT40_ENV)
+     namei_t filename;
+ #else
+     char filename[MAX_PATH];
+ #endif
+ #endif
      Vvnodesize += vnode->length;
      if (dsizeOnly) return;
      if (orphaned && (vnode->length ==0 || vnode->parent || !offset)) return;
***************
*** 788,792 ****
--- 822,838 ----
  	printf(" inode: %s", PrintInode(NULL, ino));
      if (DumpDate)
  	printf(" ServerModTime: %s", date(vnode->serverModifyTime));
+ #if defined(AFS_NAMEI_ENV)
+     if(PrintFileNames) {
+ 	    IH_INIT(ihtmpp, V_device(vp), V_parentId(vp), ino);
+ #if !defined(AFS_NT40_ENV)
+ 	    namei_HandleToName(&filename, ihtmpp);
+ 	    printf(" UFS-Filename: %s",filename.n_path);
+ #else
+ 	    nt_HandleToName(filename, ihtmpp);
+ 	    printf(" NTFS-Filename: %s",filename);
+ #endif
+     }
+ #endif
      printf("\n");
  }
Index: openafs/src/vol/vol-salvage.c
diff -c openafs/src/vol/vol-salvage.c:1.2.2.2 openafs/src/vol/vol-salvage.c:1.2.2.5
*** openafs/src/vol/vol-salvage.c:1.2.2.2	Fri Jan 19 04:06:00 2001
--- openafs/src/vol/vol-salvage.c	Mon Apr 23 03:31:28 2001
***************
*** 120,132 ****
  #ifdef	AFS_SUN5_ENV
  #include <sys/fs/ufs_inode.h>
  #else
  #include <ufs/inode.h>
  #endif
  #else /* AFS_VFSINCL_ENV */
  #ifdef	AFS_OSF_ENV
  #include <ufs/inode.h>
  #else	/* AFS_OSF_ENV */
! #ifndef AFS_LINUX20_ENV
  #include <sys/inode.h>
  #endif
  #endif
--- 120,137 ----
  #ifdef	AFS_SUN5_ENV
  #include <sys/fs/ufs_inode.h>
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ffs/fs.h>
+ #else
  #include <ufs/inode.h>
  #endif
+ #endif
  #else /* AFS_VFSINCL_ENV */
  #ifdef	AFS_OSF_ENV
  #include <ufs/inode.h>
  #else	/* AFS_OSF_ENV */
! #if !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
  #include <sys/inode.h>
  #endif
  #endif
***************
*** 166,171 ****
--- 171,179 ----
  #include <afs/afsutil.h>
  #include <afs/fileutil.h>
  #include <afs/procmgmt.h>  /* signal(), kill(), wait(), etc. */
+ #ifndef AFS_NT40_ENV
+ #include <syslog.h>
+ #endif
  
  #include "nfs.h"
  #include "lwp.h"
***************
*** 207,212 ****
--- 215,226 ----
  int     ShowMounts = 0;        	/* -showmounts flag */
  int     orphans = ORPH_IGNORE;  /* -orphans option */
  int	Showmode = 0;
+ 
+ #ifndef AFS_NT40_ENV
+ int useSyslog = 0;	/* -syslog flag */
+ int useSyslogFacility = LOG_DAEMON; /* -syslogfacility option */
+ #endif
+ 
  #define	MAXPARALLEL	32
  
  int	OKToZap;		/* -o flag */
***************
*** 547,554 ****
  	  orphans = ORPH_ATTACH;
      }
  
  #ifdef FAST_RESTART
!     if (ti = as->parms[16].items) {  /* -DontSalvage */
        printf("Exiting immediately without salvage. Look into the FileLog");
        printf(" to find volumes which really need to be salvaged!\n");
        Exit(0);
--- 561,579 ----
  	  orphans = ORPH_ATTACH;
      }
  
+ #ifndef AFS_NT40_ENV /* ignore options on NT */
+ 	if ( ti = as->parms[16].items) { /* -syslog */
+ 		useSyslog = 1;
+ 		ShowLog = 0;
+ 	}
+ 	if ( ti = as->parms[17].items) { /* -syslogfacility */
+ 		useSyslogFacility = atoi(ti->data);
+ 	}
+ #endif
+ 
+ 
  #ifdef FAST_RESTART
!     if (ti = as->parms[18].items) {  /* -DontSalvage */
        printf("Exiting immediately without salvage. Look into the FileLog");
        printf(" to find volumes which really need to be salvaged!\n");
        Exit(0);
***************
*** 721,726 ****
--- 746,757 ----
      cmd_AddParm(ts, "-showsuid", CMD_FLAG,CMD_OPTIONAL, "Report on suid/sgid files");
      cmd_AddParm(ts, "-showmounts", CMD_FLAG,CMD_OPTIONAL, "Report on mountpoints");
      cmd_AddParm(ts, "-orphans", CMD_SINGLE, CMD_OPTIONAL, "ignore | remove | attach");
+ 
+ 	/* note - syslog isn't avail on NT, but if we make it conditional, have
+ 		to deal with screwy offsets for cmd params */
+     cmd_AddParm(ts, "-syslog", CMD_FLAG, CMD_OPTIONAL, "Write salvage log to syslogs");
+     cmd_AddParm(ts, "-syslogfacility", CMD_SINGLE, CMD_OPTIONAL, "Syslog facility number to use");
+ 
  #ifdef FAST_RESTART
      cmd_AddParm(ts, "-DontSalvage", CMD_FLAG, CMD_OPTIONAL, "Don't salvage. This my be set in BosConfig to let the fileserver restart immediately after a crash. Bad volumes will be taken offline");
  #endif /* FAST_RESTART */
***************
*** 745,751 ****
--- 776,786 ----
  #else
      salvageLock = open(AFSDIR_SERVER_SLVGLOCK_FILEPATH, O_CREAT|O_RDWR, 0666);
      assert(salvageLock >= 0);
+ #ifdef AFS_DARWIN_ENV
+     if (flock(salvageLock, LOCK_EX) == -1) {
+ #else
      if (lockf(salvageLock, F_LOCK, 0) == -1) {
+ #endif
  	fprintf(stderr,
  		"salvager:  There appears to be another salvager running!  Aborted.\n");
  	Exit(1);
***************
*** 1001,1008 ****
  	     ShowLog = 0;
  	     for (fd =0; fd < 16; fd++) close(fd);
  	     open("/", 0); dup2(0, 1); dup2(0, 2);
! 	     sprintf(logFileName, "%s.%d", AFSDIR_SERVER_SLVGLOG_FILEPATH, jobs[startjob]->jobnumb);
! 	     logFile = fopen(logFileName, "w");
  	     if (!logFile) logFile = stdout;
  
  	     SalvageFileSys1(jobs[startjob]->partP, 0);
--- 1036,1050 ----
  	     ShowLog = 0;
  	     for (fd =0; fd < 16; fd++) close(fd);
  	     open("/", 0); dup2(0, 1); dup2(0, 2);
! #ifndef AFS_NT40_ENV
! 		 if ( useSyslog ) {
! 		 	openlog(NULL, LOG_PID, useSyslogFacility);
! 		 } else
! #endif
! 		 {
! 	       sprintf(logFileName, "%s.%d", AFSDIR_SERVER_SLVGLOG_FILEPATH, jobs[startjob]->jobnumb);
! 	       logFile = fopen(logFileName, "w");
! 		 }
  	     if (!logFile) logFile = stdout;
  
  	     SalvageFileSys1(jobs[startjob]->partP, 0);
***************
*** 1013,1018 ****
--- 1055,1063 ----
      } /* while ( thisjob || (!partP && numjobs > 0) ) */
  
      /* If waited for all jobs to complete, now collect log files and return */
+ #ifndef AFS_NT40_ENV
+ 	if ( ! useSyslog ) /* if syslogging - no need to collect */
+ #endif
      if (!partP) {
         for (i=0; i<jobcount; i++) {
  	  sprintf(logFileName, "%s.%d", AFSDIR_SERVER_SLVGLOG_FILEPATH, i);
***************
*** 1025,1032 ****
  	  (void)unlink(logFileName);
         }
         fflush(logFile);
-        return;
      }
  }
  
  
--- 1070,1077 ----
  	  (void)unlink(logFileName);
         }
         fflush(logFile);
      }
+ 	return;
  }
  
  
***************
*** 3513,3518 ****
--- 3558,3570 ----
  {
    char oldSlvgLog[AFSDIR_PATH_MAX];
  
+ #ifndef AFS_NT40_ENV
+   if ( useSyslog ) {
+ 		ShowLog = 0;
+ 		return;
+   }
+ #endif
+ 
    strcpy(oldSlvgLog, AFSDIR_SERVER_SLVGLOG_FILEPATH);
    strcat(oldSlvgLog, ".old");
      if (!logFile) {
***************
*** 3534,3539 ****
--- 3586,3599 ----
  {
      char line[256];
  
+ #ifndef AFS_NT40_ENV
+ 	if ( useSyslog ) {
+ 		printf("Can't show log since using syslog.\n");
+ 		fflush(stdout);
+ 		return;
+ 	}
+ #endif
+ 
      rewind(logFile);
      fclose(logFile);
  
***************
*** 3553,3570 ****
  char *a, *b, *c, *d, *e, *f, *g, *h, *i, *j, *k;
  {
      struct timeval now;
!     gettimeofday(&now, 0);
!     fprintf(logFile, "%s ", TimeStamp(now.tv_sec, 1));
!     fprintf(logFile, a,b,c,d,e,f,g,h,i,j,k);
!     fflush(logFile);
  }
  
  void Abort(a,b,c,d,e,f,g,h,i,j,k)
  char *a, *b, *c, *d, *e, *f, *g, *h, *i, *j, *k;
  {
!     fprintf(logFile, a,b,c,d,e,f,g,h,i,j,k);
!     fflush(logFile);
!     if (ShowLog) showlog();
      if (debug)
  	abort();
      Exit(1);
--- 3613,3647 ----
  char *a, *b, *c, *d, *e, *f, *g, *h, *i, *j, *k;
  {
      struct timeval now;
! 
! #ifndef AFS_NT40_ENV
! 	if ( useSyslog )
! 	{
! 		syslog(LOG_INFO, a,b,c,d,e,f,g,h,i,j,k);
! 	} else 
! #endif
! 	{
! 	    gettimeofday(&now, 0);
! 	    fprintf(logFile, "%s ", TimeStamp(now.tv_sec, 1));
! 	    fprintf(logFile, a,b,c,d,e,f,g,h,i,j,k);
! 	    fflush(logFile);
! 	}
  }
  
  void Abort(a,b,c,d,e,f,g,h,i,j,k)
  char *a, *b, *c, *d, *e, *f, *g, *h, *i, *j, *k;
  {
! #ifndef AFS_NT40_ENV
! 	if ( useSyslog )
! 	{
! 		syslog(LOG_INFO, a,b,c,d,e,f,g,h,i,j,k);
! 	} else 
! #endif
! 	{
! 	    fprintf(logFile, a,b,c,d,e,f,g,h,i,j,k);
! 	    fflush(logFile);
! 	    if (ShowLog) showlog();
! 	}
      if (debug)
  	abort();
      Exit(1);
Index: openafs/src/vol/volume.c
diff -c openafs/src/vol/volume.c:1.2.2.3 openafs/src/vol/volume.c:1.2.2.5
*** openafs/src/vol/volume.c:1.2.2.3	Tue Mar  6 16:10:53 2001
--- openafs/src/vol/volume.c	Mon Apr 23 03:31:29 2001
***************
*** 33,42 ****
  #ifdef	AFS_SUN5_ENV
  #include <sys/fs/ufs_fs.h>
  #else
  #include <ufs/fs.h>
  #endif
  #else /* AFS_VFSINCL_ENV */
! #if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX20_ENV)
  #include <sys/fs.h>
  #endif
  #endif /* AFS_VFSINCL_ENV */
--- 33,47 ----
  #ifdef	AFS_SUN5_ENV
  #include <sys/fs/ufs_fs.h>
  #else
+ #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ #include <ufs/ufs/dinode.h>
+ #include <ufs/ffs/fs.h>
+ #else
  #include <ufs/fs.h>
  #endif
+ #endif
  #else /* AFS_VFSINCL_ENV */
! #if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
  #include <sys/fs.h>
  #endif
  #endif /* AFS_VFSINCL_ENV */
Index: openafs/src/volser/Makefile
diff -c openafs/src/volser/Makefile:1.2.2.1 openafs/src/volser/Makefile:1.2.2.2
*** openafs/src/volser/Makefile:1.2.2.1	Tue Mar  6 16:11:02 2001
--- openafs/src/volser/Makefile	Mon Apr 23 00:09:20 2001
***************
*** 9,16 ****
  COMPONENT=volser
  include ../config/Makefile.${SYS_NAME}
  
- INSTALL=${SRCDIR}bin/install
- 
  COMPILE_ET=${SRCDIR}bin/compile_et
  CFLAGS=${DBG} ${OPTMZ} -I${SRCDIR}include ${XCFLAGS} ${DBG_DEFS}
  LDFLAGS=${DBG} ${OPTMZ} ${XLDFLAGS}
--- 9,14 ----
Index: openafs/src/volser/volmain.c
diff -c openafs/src/volser/volmain.c:1.2.2.1 openafs/src/volser/volmain.c:1.2.2.2
*** openafs/src/volser/volmain.c:1.2.2.1	Fri Jan 19 04:30:26 2001
--- openafs/src/volser/volmain.c	Sun Apr 22 23:41:04 2001
***************
*** 274,284 ****
--- 274,297 ----
  	else if (strcmp(argv[code], "-enable_process_stats")==0) {
  	    rx_enableProcessRPCStats();
  	}
+ #ifndef AFS_NT40_ENV
+ 	else if (strcmp(argv[code], "-syslog")==0) {
+ 	    /* set syslog logging flag */
+ 	    serverLogSyslog = 1;
+ 	} 
+ 	else if (strncmp(argv[code], "-syslog=", 8)==0) {
+ 	    serverLogSyslog = 1;
+ 	    serverLogSyslogFacility = atoi(argv[code]+8);
+ 	}
+ #endif
  	else {
  	    printf("volserver: unrecognized flag '%s'\n", argv[code]);
  usage:
  	    printf("Usage: volserver [-log] [-p <number of processes>] "
  		   "[-udpsize <size of socket buffer in bytes>] "
+ #ifndef AFS_NT40_ENV
+ 		   "[-syslog[=FACILITY]] "
+ #endif
  		   /* "[-enable_peer_stats] [-enable_process_stats] " */
  		   "[-help]\n");
  	    VS_EXIT(1);
Index: openafs/src/volser/vsutils.c
diff -c openafs/src/volser/vsutils.c:1.2 openafs/src/volser/vsutils.c:1.2.2.1
*** openafs/src/volser/vsutils.c:1.2	Sat Nov  4 05:06:36 2000
--- openafs/src/volser/vsutils.c	Mon Apr 23 03:04:03 2001
***************
*** 359,365 ****
  	}
      }
  }
! #endif	notdef
  
  
  /*
--- 359,365 ----
  	}
      }
  }
! #endif /* notdef */
  
  
  /*
Index: openafs/src/xstat/Makefile
diff -c openafs/src/xstat/Makefile:1.2 openafs/src/xstat/Makefile:1.2.2.1
*** openafs/src/xstat/Makefile:1.2	Sat Nov  4 05:06:36 2000
--- openafs/src/xstat/Makefile	Mon Apr 23 00:09:24 2001
***************
*** 10,16 ****
  SHELL = /bin/sh
  COMPONENT=xstat
  include ../config/Makefile.${SYS_NAME}
- INSTALL=${SRCDIR}bin/install
  
  CFLAGS= ${DBUG} -I. \
  	-I${SRCDIR}include \
--- 10,15 ----
