Index: openafs/src/JAVA/libjafs/File.c
diff -c openafs/src/JAVA/libjafs/File.c:1.3.2.2 openafs/src/JAVA/libjafs/File.c:1.3.2.3
*** openafs/src/JAVA/libjafs/File.c:1.3.2.2	Tue Apr 10 14:43:28 2007
--- openafs/src/JAVA/libjafs/File.c	Sun Nov 30 15:25:00 2008
***************
*** 20,25 ****
--- 20,26 ----
   */
  
  #include <afs/param.h>
+ #include <afs/com_err.h>
  #include <errno.h>
  
  #include "Internal.h"
Index: openafs/src/WINNT/afsd/fs.c
diff -c openafs/src/WINNT/afsd/fs.c:1.16.2.22 openafs/src/WINNT/afsd/fs.c:1.16.2.23
*** openafs/src/WINNT/afsd/fs.c:1.16.2.22	Wed Oct 31 00:13:20 2007
--- openafs/src/WINNT/afsd/fs.c	Sun Nov 30 15:25:02 2008
***************
*** 9,14 ****
--- 9,15 ----
  
  #include <afs/param.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  
  #include <windows.h>
  #include <stdlib.h>
Index: openafs/src/WINNT/afsd/symlink.c
diff -c openafs/src/WINNT/afsd/symlink.c:1.2.20.6 openafs/src/WINNT/afsd/symlink.c:1.2.20.7
*** openafs/src/WINNT/afsd/symlink.c:1.2.20.6	Wed Oct 31 00:13:21 2007
--- openafs/src/WINNT/afsd/symlink.c	Sun Nov 30 15:25:02 2008
***************
*** 9,14 ****
--- 9,15 ----
  
  #include <afs/param.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  
  #include <windows.h>
  #include <stdlib.h>
Index: openafs/src/WINNT/install/NSIS/CellServDB
diff -c openafs/src/WINNT/install/NSIS/CellServDB:1.2.2.7 openafs/src/WINNT/install/NSIS/CellServDB:1.2.2.8
*** openafs/src/WINNT/install/NSIS/CellServDB:1.2.2.7	Thu Jul  5 19:44:55 2007
--- openafs/src/WINNT/install/NSIS/CellServDB	Sun Dec 21 00:46:42 2008
***************
*** 11,19 ****
  193.170.243.12                  #baloo.oeaw.ac.at
  193.170.243.14                  #akela.oeaw.ac.at
  >cgv.tugraz.at          #CGV cell
! 129.27.224.133                  #phobos.cgv.tugraz.at
! 129.27.224.134                  #deimos.cgv.tugraz.at
! 129.27.224.210                  #trinculo.cgv.tugraz.at
  >itp.tugraz.at          #Institute of Theoretical and Computational Physics, TU Graz, Aus
  129.27.161.7                    #faepafs1.tu-graz.ac.at
  129.27.161.15                   #faepafs2.tu-graz.ac.at
--- 11,19 ----
  193.170.243.12                  #baloo.oeaw.ac.at
  193.170.243.14                  #akela.oeaw.ac.at
  >cgv.tugraz.at          #CGV cell
! 129.27.218.30                   #phobos.cgv.tugraz.at
! 129.27.218.31                   #deimos.cgv.tugraz.at
! 129.27.218.32                   #trinculo.cgv.tugraz.at
  >itp.tugraz.at          #Institute of Theoretical and Computational Physics, TU Graz, Aus
  129.27.161.7                    #faepafs1.tu-graz.ac.at
  129.27.161.15                   #faepafs2.tu-graz.ac.at
***************
*** 44,49 ****
--- 44,51 ----
  129.129.190.142                 #afs02.psi.ch
  >extundo.com            #Simon Josefsson's cell
  195.42.214.241                  #slipsten.extundo.com
+ >freedaemon.com         #Free Daemon Consulting, Oklahoma City, OK, USA
+ 66.210.104.254                  #afs0.freedaemon.com
  >membrain.com           #membrain.com
  66.93.118.125                   #stormy
  130.85.24.11                    #weasel
***************
*** 206,225 ****
  129.186.6.243                   #afsdb-2.iastate.edu
  129.186.142.243                 #afsdb-3.iastate.edu
  >athena.mit.edu         #MIT/Athena cell
! 18.7.1.66                       #paris.mit.edu.
! 18.7.1.74                       #chimera.mit.edu.
! 18.158.0.37                     #prill.mit.edu.
  >dev.mit.edu            #MIT/IS Development cell
! 18.7.1.70                       #wham.mit.edu.
! 18.92.1.219                     #click.mit.edu.
! 18.92.1.220                     #whirr.mit.edu.
  >net.mit.edu            #MIT/Network Group cell
  18.7.7.73                       #gracie.mit.edu
  18.7.21.95                      #george.mit.edu
  >sipb.mit.edu           #MIT/SIPB cell
! 18.181.0.19                     #reynelda.mit.edu.
! 18.181.0.22                     #rosebud.mit.edu.
! 18.181.0.23                     #ronald-ann.mit.edu.
  >soap.mit.edu           #MIT School Of Architecture & Planning
  18.89.1.204                     #crypt.mit.edu
  18.89.1.209                     #grotto.mit.edu
--- 208,227 ----
  129.186.6.243                   #afsdb-2.iastate.edu
  129.186.142.243                 #afsdb-3.iastate.edu
  >athena.mit.edu         #MIT/Athena cell
! 18.7.1.66                       #paris.mit.edu
! 18.7.1.74                       #chimera.mit.edu
! 18.158.0.37                     #prill.mit.edu
  >dev.mit.edu            #MIT/IS Development cell
! 18.7.1.70                       #wham.mit.edu
! 18.92.1.219                     #click.mit.edu
! 18.92.1.220                     #whirr.mit.edu
  >net.mit.edu            #MIT/Network Group cell
  18.7.7.73                       #gracie.mit.edu
  18.7.21.95                      #george.mit.edu
  >sipb.mit.edu           #MIT/SIPB cell
! 18.181.0.19                     #reynelda.mit.edu
! 18.181.0.22                     #rosebud.mit.edu
! 18.181.0.23                     #ronald-ann.mit.edu
  >soap.mit.edu           #MIT School Of Architecture & Planning
  18.89.1.204                     #crypt.mit.edu
  18.89.1.209                     #grotto.mit.edu
***************
*** 321,330 ****
  141.211.43.104                  #linat04.grid.umich.edu
  >citi.umich.edu         #Center for Information Technology Integration
  141.211.133.5                   #babylon.citi.umich.edu
- >lsa.umich.edu          #University of Michigan - College of LS&A
- 141.211.211.53                  #gerow.lsa.umich.edu
- 141.211.211.72                  #collines.lsa.umich.edu
- 141.211.211.153                 #hodges.lsa.umich.edu
  >sph.umich.edu          #University of Michigan -- School of Public  Health
  141.211.51.137                  #afssph7.sph.umich.edu
  141.211.51.139                  #afssph0.sph.umich.edu
--- 323,328 ----
***************
*** 356,361 ****
--- 354,361 ----
  144.92.13.16                    #moe.cae.wisc.edu
  >hep.wisc.edu           #University of Wisconsin -- High Energy Physics
  128.104.28.219                  #anise.hep.wisc.edu
+ 144.92.180.7                    #rosemary.hep.wisc.edu
+ 144.92.180.30                   #fennel.hep.wisc.edu
  >physics.wisc.edu       #Univ. of Wisconsin-Madison, Physics Department
  128.104.160.13                  #kendra.physics.wisc.edu
  128.104.160.14                  #fray.physics.wisc.edu
***************
*** 377,382 ****
--- 377,384 ----
  >grif.fr                #GRIF cell
  192.54.208.18                   #node03.datagrid.cea.fr
  >in2p3.fr               #IN2P3 production cell
+ 134.158.104.11                  #ccafsdb01.in2p3.fr
+ 134.158.104.12                  #ccafsdb02.in2p3.fr
  134.158.232.11                  #ccafsdb1.in2p3.fr
  134.158.232.12                  #ccafsdb2.in2p3.fr
  134.158.232.13                  #ccafsdb3.in2p3.fr
***************
*** 406,411 ****
--- 408,415 ----
  128.55.128.250                  #mars.nersc.gov
  128.55.128.252                  #alfred.nersc.gov
  128.55.128.254                  #lurch.nersc.gov
+ >doe.atomki.hu          #Institute of Nuclear Research (MTA ATOMKI), Debrecen, Hungary
+ 193.6.179.31                    #afs.doe.atomki.hu
  >bme.hu                 #Budapest University of Technology and Economics
  152.66.241.6                    #afs.iit.bme.hu
  >kfki.hu                #Research Institute for Nuclear and Particle Physics - Budapest,H
***************
*** 449,454 ****
--- 453,460 ----
  >pi.infn.it             #INFN, Sezione di Pisa
  131.114.134.26                  #unknownhost.pi.infn.it
  192.84.133.50                   #aix1.pi.infn.it
+ >roma3.infn.it          #Istituto Nazionale di Fisica Nucleare (INFN), Italia
+ 193.205.159.17                  #afsrm3.roma3.infn.it
  >psm.it                 #Progetto San Marco, Universita' di Roma-1
  151.100.1.65                    #atlante.psm.uniroma1.it
  >tgrid.it               #CASPUR-CILEA-CINECA Grid Cell
***************
*** 587,589 ****
--- 593,598 ----
  194.36.2.5                      #afs3.hep.man.ac.uk
  >rl.ac.uk               #Rutherford Appleton Lab, England
  130.246.183.164                 #wallace.cc.rl.ac.uk
+ 130.246.183.203                 #afs1.gridpp.rl.ac.uk
+ 130.246.183.204                 #afs2.gridpp.rl.ac.uk
+ 130.246.183.205                 #afs3.gridpp.rl.ac.uk
Index: openafs/src/WINNT/install/wix/CellServDB
diff -c openafs/src/WINNT/install/wix/CellServDB:1.2.2.7 openafs/src/WINNT/install/wix/CellServDB:1.2.2.8
*** openafs/src/WINNT/install/wix/CellServDB:1.2.2.7	Thu Jul  5 19:44:59 2007
--- openafs/src/WINNT/install/wix/CellServDB	Sun Dec 21 00:46:42 2008
***************
*** 11,19 ****
  193.170.243.12                  #baloo.oeaw.ac.at
  193.170.243.14                  #akela.oeaw.ac.at
  >cgv.tugraz.at          #CGV cell
! 129.27.224.133                  #phobos.cgv.tugraz.at
! 129.27.224.134                  #deimos.cgv.tugraz.at
! 129.27.224.210                  #trinculo.cgv.tugraz.at
  >itp.tugraz.at          #Institute of Theoretical and Computational Physics, TU Graz, Aus
  129.27.161.7                    #faepafs1.tu-graz.ac.at
  129.27.161.15                   #faepafs2.tu-graz.ac.at
--- 11,19 ----
  193.170.243.12                  #baloo.oeaw.ac.at
  193.170.243.14                  #akela.oeaw.ac.at
  >cgv.tugraz.at          #CGV cell
! 129.27.218.30                   #phobos.cgv.tugraz.at
! 129.27.218.31                   #deimos.cgv.tugraz.at
! 129.27.218.32                   #trinculo.cgv.tugraz.at
  >itp.tugraz.at          #Institute of Theoretical and Computational Physics, TU Graz, Aus
  129.27.161.7                    #faepafs1.tu-graz.ac.at
  129.27.161.15                   #faepafs2.tu-graz.ac.at
***************
*** 44,49 ****
--- 44,51 ----
  129.129.190.142                 #afs02.psi.ch
  >extundo.com            #Simon Josefsson's cell
  195.42.214.241                  #slipsten.extundo.com
+ >freedaemon.com         #Free Daemon Consulting, Oklahoma City, OK, USA
+ 66.210.104.254                  #afs0.freedaemon.com
  >membrain.com           #membrain.com
  66.93.118.125                   #stormy
  130.85.24.11                    #weasel
***************
*** 206,225 ****
  129.186.6.243                   #afsdb-2.iastate.edu
  129.186.142.243                 #afsdb-3.iastate.edu
  >athena.mit.edu         #MIT/Athena cell
! 18.7.1.66                       #paris.mit.edu.
! 18.7.1.74                       #chimera.mit.edu.
! 18.158.0.37                     #prill.mit.edu.
  >dev.mit.edu            #MIT/IS Development cell
! 18.7.1.70                       #wham.mit.edu.
! 18.92.1.219                     #click.mit.edu.
! 18.92.1.220                     #whirr.mit.edu.
  >net.mit.edu            #MIT/Network Group cell
  18.7.7.73                       #gracie.mit.edu
  18.7.21.95                      #george.mit.edu
  >sipb.mit.edu           #MIT/SIPB cell
! 18.181.0.19                     #reynelda.mit.edu.
! 18.181.0.22                     #rosebud.mit.edu.
! 18.181.0.23                     #ronald-ann.mit.edu.
  >soap.mit.edu           #MIT School Of Architecture & Planning
  18.89.1.204                     #crypt.mit.edu
  18.89.1.209                     #grotto.mit.edu
--- 208,227 ----
  129.186.6.243                   #afsdb-2.iastate.edu
  129.186.142.243                 #afsdb-3.iastate.edu
  >athena.mit.edu         #MIT/Athena cell
! 18.7.1.66                       #paris.mit.edu
! 18.7.1.74                       #chimera.mit.edu
! 18.158.0.37                     #prill.mit.edu
  >dev.mit.edu            #MIT/IS Development cell
! 18.7.1.70                       #wham.mit.edu
! 18.92.1.219                     #click.mit.edu
! 18.92.1.220                     #whirr.mit.edu
  >net.mit.edu            #MIT/Network Group cell
  18.7.7.73                       #gracie.mit.edu
  18.7.21.95                      #george.mit.edu
  >sipb.mit.edu           #MIT/SIPB cell
! 18.181.0.19                     #reynelda.mit.edu
! 18.181.0.22                     #rosebud.mit.edu
! 18.181.0.23                     #ronald-ann.mit.edu
  >soap.mit.edu           #MIT School Of Architecture & Planning
  18.89.1.204                     #crypt.mit.edu
  18.89.1.209                     #grotto.mit.edu
***************
*** 321,330 ****
  141.211.43.104                  #linat04.grid.umich.edu
  >citi.umich.edu         #Center for Information Technology Integration
  141.211.133.5                   #babylon.citi.umich.edu
- >lsa.umich.edu          #University of Michigan - College of LS&A
- 141.211.211.53                  #gerow.lsa.umich.edu
- 141.211.211.72                  #collines.lsa.umich.edu
- 141.211.211.153                 #hodges.lsa.umich.edu
  >sph.umich.edu          #University of Michigan -- School of Public  Health
  141.211.51.137                  #afssph7.sph.umich.edu
  141.211.51.139                  #afssph0.sph.umich.edu
--- 323,328 ----
***************
*** 356,361 ****
--- 354,361 ----
  144.92.13.16                    #moe.cae.wisc.edu
  >hep.wisc.edu           #University of Wisconsin -- High Energy Physics
  128.104.28.219                  #anise.hep.wisc.edu
+ 144.92.180.7                    #rosemary.hep.wisc.edu
+ 144.92.180.30                   #fennel.hep.wisc.edu
  >physics.wisc.edu       #Univ. of Wisconsin-Madison, Physics Department
  128.104.160.13                  #kendra.physics.wisc.edu
  128.104.160.14                  #fray.physics.wisc.edu
***************
*** 377,382 ****
--- 377,384 ----
  >grif.fr                #GRIF cell
  192.54.208.18                   #node03.datagrid.cea.fr
  >in2p3.fr               #IN2P3 production cell
+ 134.158.104.11                  #ccafsdb01.in2p3.fr
+ 134.158.104.12                  #ccafsdb02.in2p3.fr
  134.158.232.11                  #ccafsdb1.in2p3.fr
  134.158.232.12                  #ccafsdb2.in2p3.fr
  134.158.232.13                  #ccafsdb3.in2p3.fr
***************
*** 406,411 ****
--- 408,415 ----
  128.55.128.250                  #mars.nersc.gov
  128.55.128.252                  #alfred.nersc.gov
  128.55.128.254                  #lurch.nersc.gov
+ >doe.atomki.hu          #Institute of Nuclear Research (MTA ATOMKI), Debrecen, Hungary
+ 193.6.179.31                    #afs.doe.atomki.hu
  >bme.hu                 #Budapest University of Technology and Economics
  152.66.241.6                    #afs.iit.bme.hu
  >kfki.hu                #Research Institute for Nuclear and Particle Physics - Budapest,H
***************
*** 449,454 ****
--- 453,460 ----
  >pi.infn.it             #INFN, Sezione di Pisa
  131.114.134.26                  #unknownhost.pi.infn.it
  192.84.133.50                   #aix1.pi.infn.it
+ >roma3.infn.it          #Istituto Nazionale di Fisica Nucleare (INFN), Italia
+ 193.205.159.17                  #afsrm3.roma3.infn.it
  >psm.it                 #Progetto San Marco, Universita' di Roma-1
  151.100.1.65                    #atlante.psm.uniroma1.it
  >tgrid.it               #CASPUR-CILEA-CINECA Grid Cell
***************
*** 587,589 ****
--- 593,598 ----
  194.36.2.5                      #afs3.hep.man.ac.uk
  >rl.ac.uk               #Rutherford Appleton Lab, England
  130.246.183.164                 #wallace.cc.rl.ac.uk
+ 130.246.183.203                 #afs1.gridpp.rl.ac.uk
+ 130.246.183.204                 #afs2.gridpp.rl.ac.uk
+ 130.246.183.205                 #afs3.gridpp.rl.ac.uk
Index: openafs/src/afs/afs.h
diff -c openafs/src/afs/afs.h:1.48.2.35 openafs/src/afs/afs.h:1.48.2.36
*** openafs/src/afs/afs.h:1.48.2.35	Mon Oct 20 12:41:00 2008
--- openafs/src/afs/afs.h	Mon Jan 19 14:27:19 2009
***************
*** 170,184 ****
  /* The actual number of bytes in the SmallFid, not the sizeof struct. */
  #define SIZEOF_SMALLFID 10
  
  
- /*
-   * Queues implemented with both pointers and short offsets into a disk file.
-   */
  struct afs_q {
      struct afs_q *next;
      struct afs_q *prev;
  };
  
  struct vrequest {
      afs_int32 uid;		/* user id making the request */
      afs_int32 busyCount;	/* how many busies we've seen so far */
--- 170,213 ----
  /* The actual number of bytes in the SmallFid, not the sizeof struct. */
  #define SIZEOF_SMALLFID 10
  
+ /* Queues 
+  * ------
+  *
+  *  Circular queues, implemented with pointers. Structures may contain as many
+  *  queues as required, which may be located at any point within the structure,
+  *  providing the QEntry macro is used to translate between a queue pointer, and
+  *  the address of its containing structure
+  */
  
  struct afs_q {
      struct afs_q *next;
      struct afs_q *prev;
  };
  
+ #define	QInit(q)    ((q)->prev = (q)->next = (q))
+ #define	QAdd(q,e)   ((e)->next = (q)->next, (e)->prev = (q), \
+ 			(q)->next->prev = (e), (q)->next = (e))
+ #define	QRemove(e)  ((e)->next->prev = (e)->prev, (e)->prev->next = (e)->next, (e)->prev = NULL, (e)->next = NULL)
+ #define	QNext(e)    ((e)->next)
+ #define QPrev(e)    ((e)->prev)
+ #define QEmpty(q)   ((q)->prev == (q))
+ /* this one takes q1 and sticks it on the end of q2 - that is, the other end, not the end
+  * that things are added onto.  q1 shouldn't be empty, it's silly */
+ #define QCat(q1,q2) ((q2)->prev->next = (q1)->next, (q1)->next->prev=(q2)->prev, (q1)->prev->next=(q2), (q2)->prev=(q1)->prev, (q1)->prev=(q1)->next=(q1))
+ 
+ /* Given a pointer to an afs_q within a structure, go back to the address of
+  * the parent structure
+  */
+ 
+ #define QEntry(queue, structure, member) \
+ 	((structure *)((char *)(queue)-(char *)(&((structure *)NULL)->member)))
+ 
+ /* And implement operations for individual lists in terms of the above macro */
+ 
+ #define QTOV(e)	    QEntry(e, struct vcache, vlruq)
+ #define QTOC(e)	    QEntry(e, struct cell, lruq)
+ #define QTOVH(e)    QEntry(e, struct vcache, vhashq)
+ 
  struct vrequest {
      afs_int32 uid;		/* user id making the request */
      afs_int32 busyCount;	/* how many busies we've seen so far */
***************
*** 318,346 ****
  	 (!(afid)->Fid.Unique && ((tvc)->states & CUnique))))
  
  
- /*
-   * Operations on circular queues implemented with pointers.  Note: these queue
-   * objects are always located at the beginning of the structures they are linking.
-   */
- #define	QInit(q)    ((q)->prev = (q)->next = (q))
- #define	QAdd(q,e)   ((e)->next = (q)->next, (e)->prev = (q), \
- 			(q)->next->prev = (e), (q)->next = (e))
- #define	QRemove(e)  ((e)->next->prev = (e)->prev, (e)->prev->next = (e)->next, (e)->prev = NULL, (e)->next = NULL)
- #define	QNext(e)    ((e)->next)
- #define QPrev(e)    ((e)->prev)
- #define QEmpty(q)   ((q)->prev == (q))
- /* this one takes q1 and sticks it on the end of q2 - that is, the other end, not the end
-  * that things are added onto.  q1 shouldn't be empty, it's silly */
- #define QCat(q1,q2) ((q2)->prev->next = (q1)->next, (q1)->next->prev=(q2)->prev, (q1)->prev->next=(q2), (q2)->prev=(q1)->prev, (q1)->prev=(q1)->next=(q1))
- /*
-  * Do lots of address arithmetic to go from vlruq to the base of the vcache
-  * structure.  Don't move struct vnode, since we think of a struct vcache as
-  * a specialization of a struct vnode
-  */
- #define	QTOV(e)	    ((struct vcache *)(((char *) (e)) - (((char *)(&(((struct vcache *)(e))->vlruq))) - ((char *)(e)))))
- #define	QTOC(e)	    ((struct cell *)((char *) (e)))
- #define	QTOVH(e)   ((struct vcache *)(((char *) (e)) - (((char *)(&(((struct vcache *)(e))->vhashq))) - ((char *)(e)))))
- 
  #define	SRVADDR_MH	1
  #define	SRVADDR_ISDOWN	0x20	/* same as SRVR_ISDOWN */
  #define  SRVADDR_NOUSE    0x40	/* Don't use this srvAddr */
--- 347,352 ----
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.74.2.32 openafs/src/afs/afs_call.c:1.74.2.33
*** openafs/src/afs/afs_call.c:1.74.2.32	Sat Jun 28 23:26:03 2008
--- openafs/src/afs/afs_call.c	Thu Mar 19 22:32:59 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74.2.32 2008/06/29 03:26:03 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74.2.33 2009/03/20 02:32:59 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 825,831 ****
  	    afs_CacheInit(cparms.cacheScaches, cparms.cacheFiles,
  			  cparms.cacheBlocks, cparms.cacheDcaches,
  			  cparms.cacheVolumes, cparms.chunkSize,
! 			  cparms.memCacheFlag, cparms.inodes, cparms.users);
  
      } else if (parm == AFSOP_CACHEINODE) {
  	ino_t ainode = parm2;
--- 825,832 ----
  	    afs_CacheInit(cparms.cacheScaches, cparms.cacheFiles,
  			  cparms.cacheBlocks, cparms.cacheDcaches,
  			  cparms.cacheVolumes, cparms.chunkSize,
! 			  cparms.memCacheFlag, cparms.inodes, cparms.users, 
! 			  cparms.dynamic_vcaches);
  
      } else if (parm == AFSOP_CACHEINODE) {
  	ino_t ainode = parm2;
Index: openafs/src/afs/afs_cbqueue.c
diff -c openafs/src/afs/afs_cbqueue.c:1.9.2.4 openafs/src/afs/afs_cbqueue.c:1.9.2.5
*** openafs/src/afs/afs_cbqueue.c:1.9.2.4	Thu Mar  2 01:44:05 2006
--- openafs/src/afs/afs_cbqueue.c	Thu Mar 19 22:32:59 2009
***************
*** 75,81 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cbqueue.c,v 1.9.2.4 2006/03/02 06:44:05 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 75,81 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cbqueue.c,v 1.9.2.5 2009/03/20 02:32:59 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 180,186 ****
   */
  
  /* Sanity check on the callback queue. Allow for slop in the computation. */
! #ifdef AFS_OSF_ENV
  #define CBQ_LIMIT (afs_maxvcount + 10)
  #else
  #define CBQ_LIMIT (afs_cacheStats + afs_stats_cmperf.vcacheXAllocs + 10)
--- 180,186 ----
   */
  
  /* Sanity check on the callback queue. Allow for slop in the computation. */
! #if defined(AFS_OSF_ENV) || defined(AFS_LINUX22_ENV)
  #define CBQ_LIMIT (afs_maxvcount + 10)
  #else
  #define CBQ_LIMIT (afs_cacheStats + afs_stats_cmperf.vcacheXAllocs + 10)
Index: openafs/src/afs/afs_daemons.c
diff -c openafs/src/afs/afs_daemons.c:1.28.2.14 openafs/src/afs/afs_daemons.c:1.28.2.15
*** openafs/src/afs/afs_daemons.c:1.28.2.14	Mon Oct 22 20:03:01 2007
--- openafs/src/afs/afs_daemons.c	Thu Mar 19 22:32:59 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_daemons.c,v 1.28.2.14 2007/10/23 00:03:01 shadow Exp $");
  
  #ifdef AFS_AIX51_ENV
  #define __FULL_PROTO
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_daemons.c,v 1.28.2.15 2009/03/20 02:32:59 shadow Exp $");
  
  #ifdef AFS_AIX51_ENV
  #define __FULL_PROTO
***************
*** 40,45 ****
--- 40,47 ----
  #define afs_CheckRXEpoch() {if (rxepoch_checked == 0 && rxkad_EpochWasSet) { \
  	rxepoch_checked = 1; afs_GCUserData(/* force flag */ 1);  } }
  
+ extern int afsd_dynamic_vcaches;
+ 
  /* PAG garbage collection */
  /* We induce a compile error if param.h does not define AFS_GCPAGS */
  afs_int32 afs_gcpags = AFS_GCPAGS;
***************
*** 116,128 ****
      struct afs_exporter *exporter;
      afs_int32 now;
      afs_int32 last3MinCheck, last10MinCheck, last60MinCheck, lastNMinCheck;
!     afs_int32 last1MinCheck;
      afs_uint32 lastCBSlotBump;
      char cs_warned = 0;
  
      AFS_STATCNT(afs_Daemon);
      last1MinCheck = last3MinCheck = last60MinCheck = last10MinCheck =
! 	lastNMinCheck = 0;
  
      afs_rootFid.Fid.Volume = 0;
      while (afs_initState < 101)
--- 118,130 ----
      struct afs_exporter *exporter;
      afs_int32 now;
      afs_int32 last3MinCheck, last10MinCheck, last60MinCheck, lastNMinCheck;
!     afs_int32 last1MinCheck, last5MinCheck;
      afs_uint32 lastCBSlotBump;
      char cs_warned = 0;
  
      AFS_STATCNT(afs_Daemon);
      last1MinCheck = last3MinCheck = last60MinCheck = last10MinCheck =
!     last5MinCheck = lastNMinCheck = 0;
  
      afs_rootFid.Fid.Volume = 0;
      while (afs_initState < 101)
***************
*** 150,155 ****
--- 152,158 ----
      last3MinCheck = now - 90 + ((afs_random() & 0x7fffffff) % 180);
      last60MinCheck = now - 1800 + ((afs_random() & 0x7fffffff) % 3600);
      last10MinCheck = now - 300 + ((afs_random() & 0x7fffffff) % 600);
+     last5MinCheck = now - 150 + ((afs_random() & 0x7fffffff) % 300);
      lastNMinCheck = now - 90 + ((afs_random() & 0x7fffffff) % 180);
  
      /* start off with afs_initState >= 101 (basic init done) */
***************
*** 191,196 ****
--- 194,212 ----
  					 * tickets */
  	    last3MinCheck = now;
  	}
+ #ifdef AFS_MAXVCOUNT_ENV
+     if (afsd_dynamic_vcaches && (last5MinCheck + 300 < now)) {
+         /* start with trying to drop us back to our base usage */
+         int anumber;
+         if (afs_maxvcount <= afs_cacheStats) 
+         anumber = VCACHE_FREE;
+         else
+         anumber = VCACHE_FREE + (afs_maxvcount - afs_cacheStats);
+ 
+         afs_ShakeLooseVCaches(anumber);
+         last5MinCheck = now;
+     }
+ #endif
  	if (!afs_CheckServerDaemonStarted) {
  	    /* Do the check here if the correct afsd is not installed. */
  	    if (!cs_warned) {
Index: openafs/src/afs/afs_init.c
diff -c openafs/src/afs/afs_init.c:1.28.2.8 openafs/src/afs/afs_init.c:1.28.2.9
*** openafs/src/afs/afs_init.c:1.28.2.8	Thu Jun 12 13:25:03 2008
--- openafs/src/afs/afs_init.c	Thu Mar 19 22:32:59 2009
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_init.c,v 1.28.2.8 2008/06/12 17:25:03 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_init.c,v 1.28.2.9 2009/03/20 02:32:59 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 45,50 ****
--- 45,53 ----
  static struct vnode *volumeVnode;
  #endif
  
+ /* This is the kernel side of the dynamic vcache setting */
+ int afsd_dynamic_vcaches = 0;	/* Enable dynamic-vcache support */
+ 
  /*
   * Initialization order is important.  Must first call afs_CacheInit,
   * then cache file and volume file initialization routines.  Next, the
***************
*** 81,87 ****
  int
  afs_CacheInit(afs_int32 astatSize, afs_int32 afiles, afs_int32 ablocks,
  	      afs_int32 aDentries, afs_int32 aVolumes, afs_int32 achunk,
! 	      afs_int32 aflags, afs_int32 ninodes, afs_int32 nusers)
  {
      register afs_int32 i;
      register struct volume *tv;
--- 84,90 ----
  int
  afs_CacheInit(afs_int32 astatSize, afs_int32 afiles, afs_int32 ablocks,
  	      afs_int32 aDentries, afs_int32 aVolumes, afs_int32 achunk,
! 	      afs_int32 aflags, afs_int32 ninodes, afs_int32 nusers, afs_int32 dynamic_vcaches)
  {
      register afs_int32 i;
      register struct volume *tv;
***************
*** 98,103 ****
--- 101,113 ----
      afs_stats_cmperf.sysName_ID = SYS_NAME_ID_UNDEFINED;
  #endif /* SYS_NAME_ID */
  
+ #ifdef AFS_MAXVCOUNT_ENV
+ 	afsd_dynamic_vcaches = dynamic_vcaches;
+     printf("%s dynamically allocated vcaches\n", ( afsd_dynamic_vcaches ? "enabling" : "disabling" ));
+ #else
+ 	afsd_dynamic_vcaches = 0;
+ #endif
+ 
      printf("Starting AFS cache scan...");
      if (afs_cacheinit_flag)
  	return 0;
Index: openafs/src/afs/afs_nfsdisp.c
diff -c openafs/src/afs/afs_nfsdisp.c:1.18.2.4 openafs/src/afs/afs_nfsdisp.c:1.18.2.5
*** openafs/src/afs/afs_nfsdisp.c:1.18.2.4	Wed Aug 13 19:49:37 2008
--- openafs/src/afs/afs_nfsdisp.c	Thu Jan 15 08:27:43 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_nfsdisp.c,v 1.18.2.4 2008/08/13 23:49:37 shadow Exp $");
  
  /* Ugly Ugly Ugly  but precludes conflicting XDR macros; We want kernel xdr */
  #define __XDR_INCLUDE__
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_nfsdisp.c,v 1.18.2.5 2009/01/15 13:27:43 shadow Exp $");
  
  /* Ugly Ugly Ugly  but precludes conflicting XDR macros; We want kernel xdr */
  #define __XDR_INCLUDE__
***************
*** 378,385 ****
  afs_nfs2_getattr(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_GETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 378,385 ----
  afs_nfs2_getattr(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_GETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 393,400 ****
  afs_nfs2_setattr(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_SETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 393,400 ----
  afs_nfs2_setattr(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_SETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 408,415 ****
  afs_nfs2_lookup(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_LOOKUP, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 408,415 ----
  afs_nfs2_lookup(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_LOOKUP, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 426,433 ****
  afs_nfs2_readlink(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_READLINK, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 426,433 ----
  afs_nfs2_readlink(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_READLINK, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 441,448 ****
  afs_nfs2_read(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_READ, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 441,448 ----
  afs_nfs2_read(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_READ, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 456,463 ****
  afs_nfs2_write(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_WRITE, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 456,463 ----
  afs_nfs2_write(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_WRITE, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 471,478 ****
  afs_nfs2_create(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_CREATE, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 471,478 ----
  afs_nfs2_create(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_CREATE, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 489,496 ****
  afs_nfs2_remove(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_REMOVE, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 489,496 ----
  afs_nfs2_remove(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_REMOVE, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 504,511 ****
  afs_nfs2_rename(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_RENAME, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 504,511 ----
  afs_nfs2_rename(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_RENAME, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 519,526 ****
  afs_nfs2_link(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_LINK, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 519,526 ----
  afs_nfs2_link(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_LINK, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 534,541 ****
  afs_nfs2_symlink(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_SYMLINK, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 534,541 ----
  afs_nfs2_symlink(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_SYMLINK, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 549,556 ****
  afs_nfs2_mkdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_MKDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 549,556 ----
  afs_nfs2_mkdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_MKDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 567,574 ****
  afs_nfs2_rmdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_RMDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 567,574 ----
  afs_nfs2_rmdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_RMDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 582,589 ****
  afs_nfs2_readdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_READDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 582,589 ----
  afs_nfs2_readdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_READDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 597,604 ****
  afs_nfs2_statfs(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs2_dispatcher(0, RFS_STATFS, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
--- 597,604 ----
  afs_nfs2_statfs(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs2_dispatcher(0, RFS_STATFS, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs2_noaccess((struct afs_nfs2_resp *)xp);
***************
*** 633,640 ****
  afs_acl2_getacl(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_GETACL, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 633,640 ----
  afs_acl2_getacl(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_GETACL, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 650,657 ****
  afs_acl2_setacl(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_SETACL, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 650,657 ----
  afs_acl2_setacl(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_SETACL, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 667,674 ****
  afs_acl2_getattr(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_GETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 667,674 ----
  afs_acl2_getattr(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_GETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 684,691 ****
  afs_acl2_access(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_ACCESS, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 684,691 ----
  afs_acl2_access(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_ACCESS, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 702,709 ****
  afs_acl2_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_GETXATTRDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 702,709 ----
  afs_acl2_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs2_dispatcher(1, ACLPROC2_GETXATTRDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1140,1147 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_GETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1140,1147 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_GETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1158,1165 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_SETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1158,1165 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_SETATTR, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1176,1183 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_LOOKUP, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1176,1183 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_LOOKUP, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1199,1206 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_ACCESS, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1199,1206 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_ACCESS, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1217,1224 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_READLINK, (char *)args, &exp, rp,
  			    crp);
--- 1217,1224 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_READLINK, (char *)args, &exp, rp,
  			    crp);
***************
*** 1236,1243 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs3_dispatcher(0, NFSPROC3_READ, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
--- 1236,1243 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs3_dispatcher(0, NFSPROC3_READ, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
***************
*** 1253,1260 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_WRITE, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1253,1260 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_WRITE, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1271,1278 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_CREATE, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1271,1278 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_CREATE, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1294,1301 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_MKDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1294,1301 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_MKDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1317,1324 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_SYMLINK, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1317,1324 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_SYMLINK, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1340,1347 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_MKNOD, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1340,1347 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_MKNOD, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1363,1370 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_REMOVE, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1363,1370 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_REMOVE, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1381,1388 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_RMDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1381,1388 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_RMDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1399,1406 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_RENAME, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1399,1406 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_RENAME, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1417,1424 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call = afs_nfs3_dispatcher(0, NFSPROC3_LINK, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
--- 1417,1424 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call = afs_nfs3_dispatcher(0, NFSPROC3_LINK, (char *)args, &exp, rp, crp);
      if (call > 1)
  	afs_nfs3_noaccess((struct afs_nfs3_resp *)xp);
***************
*** 1434,1441 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_READDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1434,1441 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_READDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1452,1459 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_READDIRPLUS, (char *)args, &exp, rp,
  			    crp);
--- 1452,1459 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_READDIRPLUS, (char *)args, &exp, rp,
  			    crp);
***************
*** 1473,1480 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_FSSTAT, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1473,1480 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_FSSTAT, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1491,1498 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_FSINFO, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1491,1498 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_FSINFO, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1509,1516 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_PATHCONF, (char *)args, &exp, rp,
  			    crp);
--- 1509,1516 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_PATHCONF, (char *)args, &exp, rp,
  			    crp);
***************
*** 1528,1535 ****
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_COMMIT, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1528,1535 ----
  {
      u_int call;
      afs_nfs3_resp dummy;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(0, NFSPROC3_COMMIT, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1570,1577 ****
  afs_acl3_getacl(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(1, ACLPROC3_GETACL, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1570,1577 ----
  afs_acl3_getacl(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(1, ACLPROC3_GETACL, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1587,1594 ****
  afs_acl3_setacl(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(1, ACLPROC3_SETACL, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1587,1594 ----
  afs_acl3_setacl(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(1, ACLPROC3_SETACL, (char *)args, &exp, rp, crp);
      if (call > 1)
***************
*** 1605,1612 ****
  afs_acl3_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct cred *svcred = curthread->t_cred;
!     curthread->t_cred = (struct cred *)crp;
      call =
  	afs_nfs3_dispatcher(1, ACLPROC3_GETXATTRDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
--- 1605,1612 ----
  afs_acl3_getxattrdir(char *args, char *xp, char *exp, char *rp, char *crp)
  {
      u_int call;
!     struct AFS_UCRED *svcred = curthread->t_cred;
!     curthread->t_cred = (struct AFS_UCRED *)crp;
      call =
  	afs_nfs3_dispatcher(1, ACLPROC3_GETXATTRDIR, (char *)args, &exp, rp, crp);
      if (call > 1)
Index: openafs/src/afs/afs_osi.c
diff -c openafs/src/afs/afs_osi.c:1.48.2.18 openafs/src/afs/afs_osi.c:1.48.2.19
*** openafs/src/afs/afs_osi.c:1.48.2.18	Sun Oct 12 14:44:46 2008
--- openafs/src/afs/afs_osi.c	Thu Jan 15 08:27:43 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.48.2.18 2008/10/12 18:44:46 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.48.2.19 2009/01/15 13:27:43 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 1120,1129 ****
  	|| (pr->state == TASK_UNINTERRUPTIBLE)
  	|| (pr->state == TASK_STOPPED)) {
  	cr.cr_ref = 1;
! 	cr.cr_uid = pr->uid;
  #if defined(AFS_LINUX26_ENV)
  	get_group_info(pr->group_info);
  	cr.cr_group_info = pr->group_info;
  #else
  	cr.cr_ngroups = pr->ngroups;
  	memcpy(cr.cr_groups, pr->groups, NGROUPS * sizeof(gid_t));
--- 1120,1134 ----
  	|| (pr->state == TASK_UNINTERRUPTIBLE)
  	|| (pr->state == TASK_STOPPED)) {
  	cr.cr_ref = 1;
! 	cr.cr_uid = task_uid(pr);
  #if defined(AFS_LINUX26_ENV)
+ #if defined(STRUCT_TASK_HAS_CRED)
+ 	get_group_info(pr->cred->group_info);
+ 	cr.cr_group_info = pr->cred->group_info;
+ #else
  	get_group_info(pr->group_info);
  	cr.cr_group_info = pr->group_info;
+ #endif
  #else
  	cr.cr_ngroups = pr->ngroups;
  	memcpy(cr.cr_groups, pr->groups, NGROUPS * sizeof(gid_t));
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.81.2.33 openafs/src/afs/afs_pioctl.c:1.81.2.34
*** openafs/src/afs/afs_pioctl.c:1.81.2.33	Fri Apr 18 16:13:32 2008
--- openafs/src/afs/afs_pioctl.c	Mon Jan 19 13:09:34 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.81.2.33 2008/04/18 20:13:32 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.81.2.34 2009/01/19 18:09:34 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
***************
*** 88,94 ****
  DECL_PIOCTL(PRxStatProc);
  DECL_PIOCTL(PRxStatPeer);
  DECL_PIOCTL(PPrefetchFromTape);
! DECL_PIOCTL(PResidencyCmd);
  DECL_PIOCTL(PCallBackAddr);
  DECL_PIOCTL(PNewUuid);
  /*
--- 88,94 ----
  DECL_PIOCTL(PRxStatProc);
  DECL_PIOCTL(PRxStatPeer);
  DECL_PIOCTL(PPrefetchFromTape);
! DECL_PIOCTL(PFsCmd);
  DECL_PIOCTL(PCallBackAddr);
  DECL_PIOCTL(PNewUuid);
  /*
***************
*** 182,188 ****
  	PBogus,			/* 64 -- arla: force cache check */
  	PBogus,			/* 65 -- arla: break callback */
  	PPrefetchFromTape,	/* 66 -- MR-AFS: prefetch file from tape */
! 	PResidencyCmd,		/* 67 -- MR-AFS: generic commnd interface */
  	PBogus,			/* 68 -- arla: fetch stats */
  	PGetVnodeXStatus2,	/* 69 - get caller access and some vcache status */
  };
--- 182,188 ----
  	PBogus,			/* 64 -- arla: force cache check */
  	PBogus,			/* 65 -- arla: break callback */
  	PPrefetchFromTape,	/* 66 -- MR-AFS: prefetch file from tape */
! 	PFsCmd,			/* 67 -- RXOSD: generic commnd interface */
  	PBogus,			/* 68 -- arla: fetch stats */
  	PGetVnodeXStatus2,	/* 69 - get caller access and some vcache status */
  };
***************
*** 3781,3801 ****
      return code;
  }
  
! DECL_PIOCTL(PResidencyCmd)
  {
      register afs_int32 code;
      struct conn *tc;
      struct vcache *tvc;
!     struct ResidencyCmdInputs *Inputs;
!     struct ResidencyCmdOutputs *Outputs;
      struct VenusFid tfid;
      struct AFSFid *Fid;
  
!     Inputs = (struct ResidencyCmdInputs *)ain;
!     Outputs = (struct ResidencyCmdOutputs *)aout;
      if (!avc)
  	return EINVAL;
!     if (!ain || ainSize != sizeof(struct ResidencyCmdInputs))
  	return EINVAL;
  
      Fid = &Inputs->fid;
--- 3781,3801 ----
      return code;
  }
  
! DECL_PIOCTL(PFsCmd)
  {
      register afs_int32 code;
      struct conn *tc;
      struct vcache *tvc;
!     struct FsCmdInputs *Inputs;
!     struct FsCmdOutputs *Outputs;
      struct VenusFid tfid;
      struct AFSFid *Fid;
  
!     Inputs = (struct FsCmdInputs *)ain;
!     Outputs = (struct FsCmdOutputs *)aout;
      if (!avc)
  	return EINVAL;
!     if (!ain || ainSize != sizeof(struct FsCmdInputs))
  	return EINVAL;
  
      Fid = &Inputs->fid;
***************
*** 3819,3826 ****
  	    if (tc) {
  		RX_AFS_GUNLOCK();
  		code =
! 		    RXAFS_ResidencyCmd(tc->id, Fid, Inputs,
! 				       (struct ResidencyCmdOutputs *)aout);
  		RX_AFS_GLOCK();
  	    } else
  		code = -1;
--- 3819,3826 ----
  	    if (tc) {
  		RX_AFS_GUNLOCK();
  		code =
! 		    RXAFS_FsCmd(tc->id, Fid, Inputs, 
! 					(struct FsCmdOutputs *)aout);
  		RX_AFS_GLOCK();
  	    } else
  		code = -1;
***************
*** 3844,3850 ****
      afs_PutVCache(tvc);
  
      if (!code) {
! 	*aoutSize = sizeof(struct ResidencyCmdOutputs);
      }
      return code;
  }
--- 3844,3850 ----
      afs_PutVCache(tvc);
  
      if (!code) {
! 	*aoutSize = sizeof(struct FsCmdOutputs);
      }
      return code;
  }
Index: openafs/src/afs/afs_prototypes.h
diff -c openafs/src/afs/afs_prototypes.h:1.53.2.25 openafs/src/afs/afs_prototypes.h:1.53.2.27
*** openafs/src/afs/afs_prototypes.h:1.53.2.25	Sat Jun 28 23:26:04 2008
--- openafs/src/afs/afs_prototypes.h	Fri Mar 20 11:05:09 2009
***************
*** 376,382 ****
  			 afs_int32 ablocks, afs_int32 aDentries,
  			 afs_int32 aVolumes, afs_int32 achunk,
  			 afs_int32 aflags, afs_int32 ninodes,
! 			 afs_int32 nusers);
  extern void afs_ComputeCacheParms(void);
  extern int afs_InitCacheInfo(register char *afile);
  extern int afs_InitVolumeInfo(char *afile);
--- 376,382 ----
  			 afs_int32 ablocks, afs_int32 aDentries,
  			 afs_int32 aVolumes, afs_int32 achunk,
  			 afs_int32 aflags, afs_int32 ninodes,
! 			 afs_int32 nusers, afs_int32 dynamic_vcaches);
  extern void afs_ComputeCacheParms(void);
  extern int afs_InitCacheInfo(register char *afile);
  extern int afs_InitVolumeInfo(char *afile);
***************
*** 823,828 ****
--- 823,829 ----
  
  
  /* afs_vcache.c */
+ extern int afs_ShakeLooseVCaches(afs_int32 anumber);
  extern afs_int32 afs_maxvcount;
  extern afs_int32 afs_vcount;
  extern int afsvnumbers;
Index: openafs/src/afs/afs_trace.et
diff -c openafs/src/afs/afs_trace.et:1.17.2.2 openafs/src/afs/afs_trace.et:1.17.2.3
*** openafs/src/afs/afs_trace.et:1.17.2.2	Fri Nov 23 09:34:57 2007
--- openafs/src/afs/afs_trace.et	Mon Jan 12 08:24:37 2009
***************
*** 132,139 ****
  	ec	CM_TRACE_VMRDWR, "afs_vm_rdwr: vp = 0x%lx, xfrSize 0x%lx,  toffset 0x%x"
  	ec	CM_TRACE_READFAST, "ReadFast vp 0x%lx off (0x%x, 0x%x) resid 0x%x file length (0x%x, 0x%x)"
  	ec	CM_TRACE_FETCH64CODE, "StartRX_FetchData64 for vp 0x%lx returned %d"
! 	ec	CM_TRACE_FETCH64LENG, "FetchData64 for vp 0xl%x code = %d, length = (0x%x, 0x%x)"
! 	ec	CM_TRACE_FETCH64READ, "FetchData64 for vp 0xl%x code = %d, length = 0x%x"
  	ec	CM_TRACE_VMWRITE, "afs_vm_rdwr: vp 0x%lx offset (0x%x, 0x%x) length (0x%x, 0x%x)"
  	ec	CM_TRACE_VMWRITE2, "afs_vm_rdwr: vp 0x%lx first page 0x%x pages %d"
  	ec	CM_TRACE_VMSTOREALL, "osi_VM_StoreAllSegments for vp 0x%lx call %d"
--- 132,139 ----
  	ec	CM_TRACE_VMRDWR, "afs_vm_rdwr: vp = 0x%lx, xfrSize 0x%lx,  toffset 0x%x"
  	ec	CM_TRACE_READFAST, "ReadFast vp 0x%lx off (0x%x, 0x%x) resid 0x%x file length (0x%x, 0x%x)"
  	ec	CM_TRACE_FETCH64CODE, "StartRX_FetchData64 for vp 0x%lx returned %d"
! 	ec      CM_TRACE_FETCH64LENG, "FetchData64 for vp 0x%lx code = %d, length = (0x%x, 0x%x)"
! 	ec      CM_TRACE_FETCH64READ, "FetchData64 for vp 0x%lx code = %d, length = 0x%x"
  	ec	CM_TRACE_VMWRITE, "afs_vm_rdwr: vp 0x%lx offset (0x%x, 0x%x) length (0x%x, 0x%x)"
  	ec	CM_TRACE_VMWRITE2, "afs_vm_rdwr: vp 0x%lx first page 0x%x pages %d"
  	ec	CM_TRACE_VMSTOREALL, "osi_VM_StoreAllSegments for vp 0x%lx call %d"
Index: openafs/src/afs/afs_vcache.c
diff -c openafs/src/afs/afs_vcache.c:1.65.2.50 openafs/src/afs/afs_vcache.c:1.65.2.54
*** openafs/src/afs/afs_vcache.c:1.65.2.50	Tue Aug 26 10:02:11 2008
--- openafs/src/afs/afs_vcache.c	Wed Mar 25 15:34:59 2009
***************
*** 39,45 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.65.2.50 2008/08/26 14:02:11 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 39,45 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.65.2.54 2009/03/25 19:34:59 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 77,82 ****
--- 77,83 ----
  static struct afs_cbr *afs_cbrHashT[CBRSIZE];
  afs_int32 afs_bulkStatsLost;
  int afs_norefpanic = 0;
+ extern int afsd_dynamic_vcaches;
  
  /* Forward declarations */
  static afs_int32 afs_QueueVCB(struct vcache *avc);
***************
*** 253,258 ****
--- 254,260 ----
  	VN_UNLOCK(AFSTOV(avc));
  #endif
  	AFS_RELE(AFSTOV(avc));
+ 	afs_stats_cmperf.vcacheXAllocs--;
      } else {
  	if (afs_norefpanic) {
  	    printf("flush vc refcnt < 1");
***************
*** 313,318 ****
--- 315,322 ----
   * held, so we don't have to worry about blocking in osi_Alloc.
   */
  static struct afs_cbr *afs_cbrSpace = 0;
+ /* if alloc limit below changes, fix me! */
+ static struct afs_cbr *afs_cbrHeads[2];
  struct afs_cbr *
  afs_AllocCBR(void)
  {
***************
*** 334,339 ****
--- 338,344 ----
  	    }
  	    tsp[AFS_NCBRS - 1].next = 0;
  	    afs_cbrSpace = tsp;
+ 	    afs_cbrHeads[afs_stats_cmperf.CallBackAlloced] = tsp;
  	    afs_stats_cmperf.CallBackAlloced++;
  	}
      }
***************
*** 621,674 ****
  #endif
  }
  
! /*
!  * afs_NewVCache
!  *
!  * Description:
!  *	This routine is responsible for allocating a new cache entry
!  *	from the free list.  It formats the cache entry and inserts it
!  *	into the appropriate hash tables.  It must be called with
!  *	afs_xvcache write-locked so as to prevent several processes from
!  *	trying to create a new cache entry simultaneously.
!  *
!  * Parameters:
!  *	afid  : The file id of the file whose cache entry is being
!  *		created.
!  */
! /* LOCK: afs_NewVCache  afs_xvcache W */
! struct vcache *
! afs_NewVCache(struct VenusFid *afid, struct server *serverp)
  {
!     struct vcache *tvc;
      afs_int32 i, j;
!     afs_int32 anumber = VCACHE_FREE;
! #ifdef	AFS_AIX_ENV
!     struct gnode *gnodepnt;
! #endif
! #ifdef	AFS_OSF_ENV
!     struct vcache *nvc;
! #endif /* AFS_OSF_ENV */
      struct afs_q *tq, *uq;
      int code, fv_slept;
  
!     AFS_STATCNT(afs_NewVCache);
! 
!     afs_FlushReclaimedVcaches();
  
! #if defined(AFS_OSF_ENV) || defined(AFS_LINUX22_ENV)
! #if defined(AFS_OSF30_ENV) || defined(AFS_LINUX22_ENV)
!     if (afs_vcount >= afs_maxvcount)
! #else
!     /*
!      * If we are using > 33 % of the total system vnodes for AFS vcache
!      * entries or we are using the maximum number of vcache entries,
!      * then free some.  (if our usage is > 33% we should free some, if
!      * our usage is > afs_maxvcount, set elsewhere to 0.5*nvnode,
!      * we _must_ free some -- no choice).
!      */
!     if (((3 * afs_vcount) > nvnode) || (afs_vcount >= afs_maxvcount))
  #endif
!     {
  	int i;
  	char *panicstr;
  
--- 626,654 ----
  #endif
  }
  
! int
! afs_ShakeLooseVCaches(afs_int32 anumber)
  {
! #if defined(AFS_OSF_ENV) || defined(AFS_LINUX22_ENV)
      afs_int32 i, j;
!     struct vcache *tvc;
      struct afs_q *tq, *uq;
      int code, fv_slept;
+     afs_int32 target = anumber;
+     int haveGlock = 1;
  
!     /* Should probably deal better */
!     if (!ISAFS_GLOCK()) {
! 	haveGlock = 0;
! 	AFS_GLOCK();
!     }
  
!     if (
! #ifdef AFS_MAXVCOUNT_ENV
! 	afsd_dynamic_vcaches || /* Always run if dynamic vcaches are enabled. */
  #endif
! 	afs_vcount >= afs_maxvcount
! 	) {
  	int i;
  	char *panicstr;
  
***************
*** 678,684 ****
  	    uq = QPrev(tq);
  	    if (tvc->states & CVFlushed) {
  		refpanic("CVFlushed on VLRU");
! 	    } else if (i++ > afs_maxvcount) {
  		refpanic("Exceeded pool of AFS vnodes(VLRU cycle?)");
  	    } else if (QNext(uq) != tq) {
  		refpanic("VLRU inconsistent");
--- 658,668 ----
  	    uq = QPrev(tq);
  	    if (tvc->states & CVFlushed) {
  		refpanic("CVFlushed on VLRU");
! 	    } else if (
! #ifdef AFS_MAXVCOUNT_ENV
! 	    ! afsd_dynamic_vcaches && 
! #endif
! 	    i++ > afs_maxvcount) {
  		refpanic("Exceeded pool of AFS vnodes(VLRU cycle?)");
  	    } else if (QNext(uq) != tq) {
  		refpanic("VLRU inconsistent");
***************
*** 744,767 ****
  	    if (tq == uq)
  		break;
  	}
! 	if (anumber == VCACHE_FREE) {
! 	    printf("afs_NewVCache: warning none freed, using %d of %d\n",
  		   afs_vcount, afs_maxvcount);
- 	    if (afs_vcount >= afs_maxvcount) {
- 	    	printf("afs_NewVCache - none freed\n");
- 		return NULL;
- 	    }
  	}
      }
  
! #if defined(AFS_LINUX22_ENV)
  {
      struct inode *ip;
  
      AFS_GUNLOCK();
      ip = new_inode(afs_globalVFS);
      if (!ip)
! 	osi_Panic("afs_NewVCache: no more inodes");
      AFS_GLOCK();
  #if defined(STRUCT_SUPER_HAS_ALLOC_INODE)
      tvc = VTOAFS(ip);
--- 728,775 ----
  	    if (tq == uq)
  		break;
  	}
! 	if (
! #ifdef AFS_MAXVCOUNT_ENV
!         !afsd_dynamic_vcaches &&
! #endif
!         anumber == target) {
! 	    printf("afs_ShakeLooseVCaches: warning none freed, using %d of %d\n",
  		   afs_vcount, afs_maxvcount);
  	}
      }
+ /*
+     printf("recycled %d entries\n", target-anumber);
+ */
+     if (!haveGlock)
+ 	AFS_GUNLOCK();
+ #endif
+     return 0;
+ }
  
! 
! static struct vcache *
! afs_AllocVCache(void) 
  {
+     struct vcache *tvc;
+ #if defined(AFS_OSF30_ENV)
+     struct vcache *nvc;
+     AFS_GUNLOCK();
+     if (getnewvnode(MOUNT_AFS, &Afs_vnodeops, &nvc)) {
+ 	/* What should we do ???? */
+ 	osi_Panic("afs_AllocVCache: no more vnodes");
+     }
+     AFS_GLOCK();
+ 
+     tvc = nvc;
+     tvc->nextfree = NULL;
+     afs_vcount++;
+ #elif defined(AFS_LINUX22_ENV)
      struct inode *ip;
  
      AFS_GUNLOCK();
      ip = new_inode(afs_globalVFS);
      if (!ip)
! 	osi_Panic("afs_AllocVCache: no more inodes");
      AFS_GLOCK();
  #if defined(STRUCT_SUPER_HAS_ALLOC_INODE)
      tvc = VTOAFS(ip);
***************
*** 770,788 ****
      ip->u.generic_ip = tvc;
      tvc->v = ip;
  #endif
! }
! #else
!     AFS_GUNLOCK();
!     if (getnewvnode(MOUNT_AFS, &Afs_vnodeops, &nvc)) {
! 	/* What should we do ???? */
! 	osi_Panic("afs_NewVCache: no more vnodes");
      }
!     AFS_GLOCK();
  
!     tvc = nvc;
!     tvc->nextfree = NULL;
  #endif
!     afs_vcount++;
  #else /* AFS_OSF_ENV */
      /* pull out a free cache entry */
      if (!freeVCList) {
--- 778,867 ----
      ip->u.generic_ip = tvc;
      tvc->v = ip;
  #endif
! 
!     afs_vcount++;
! #ifdef AFS_MAXVCOUNT_ENV
!     /* track the peak */
!     if (afsd_dynamic_vcaches && afs_maxvcount < afs_vcount) {
! 	afs_maxvcount = afs_vcount;
! 	printf("peak vnodes: %d\n", afs_maxvcount);
      }
! #endif
!     afs_stats_cmperf.vcacheXAllocs++;	/* count in case we have a leak */
! #else
!     /* none free, making one is better than a panic */
!     afs_stats_cmperf.vcacheXAllocs++;	/* count in case we have a leak */
!     tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache));
! #if defined(AFS_DARWIN_ENV) && !defined(UKERNEL)
!     tvc->v = NULL; /* important to clean this, or use memset 0 */
! #endif
! #ifdef	KERNEL_HAVE_PIN
!     pin((char *)tvc, sizeof(struct vcache));	/* XXX */
! #endif
! #if defined(AFS_SGI_ENV)
!     {
! 	char name[METER_NAMSZ];
! 	memset(tvc, 0, sizeof(struct vcache));
! 	tvc->v.v_number = ++afsvnumbers;
! 	tvc->vc_rwlockid = OSI_NO_LOCKID;
! 	initnsema(&tvc->vc_rwlock, 1,
! 		  makesname(name, "vrw", tvc->v.v_number));
! #ifndef	AFS_SGI53_ENV
! 	initnsema(&tvc->v.v_sync, 0,
! 		  makesname(name, "vsy", tvc->v.v_number));
! #endif
! #ifndef AFS_SGI62_ENV
! 	initnlock(&tvc->v.v_lock,
! 		  makesname(name, "vlk", tvc->v.v_number));
! #endif
!     }
! #endif /* AFS_SGI_ENV */
! #endif
!     return tvc;
! }
  
! /*!
!  *   This routine is responsible for allocating a new cache entry
!  * from the free list.  It formats the cache entry and inserts it
!  * into the appropriate hash tables.  It must be called with
!  * afs_xvcache write-locked so as to prevent several processes from
!  * trying to create a new cache entry simultaneously.
!  *
!  * LOCK: afs_NewVCache  afs_xvcache W
!  *
!  * \param afid The file id of the file whose cache entry is being created.
!  *
!  * \return The new vcache struct.
!  */
! struct vcache *
! afs_NewVCache(struct VenusFid *afid, struct server *serverp)
! {
!     struct vcache *tvc;
!     afs_int32 i, j;
!     afs_int32 anumber = VCACHE_FREE;
! #ifdef	AFS_AIX_ENV
!     struct gnode *gnodepnt;
  #endif
!     struct afs_q *tq, *uq;
!     int code, fv_slept;
! 
!     AFS_STATCNT(afs_NewVCache);
! 
!     afs_FlushReclaimedVcaches();
! 
! #if defined(AFS_OSF_ENV) || defined(AFS_LINUX22_ENV)
! #ifdef AFS_MAXVCOUNT_ENV
!     if(!afsd_dynamic_vcaches) {
! #endif
!     afs_ShakeLooseVCaches(anumber);
!     if (afs_vcount >= afs_maxvcount) {
! 	printf("afs_NewVCache - none freed\n");
! 	return NULL;
!     }
! #ifdef AFS_MAXVCOUNT_ENV
!     }
! #endif
!     tvc = afs_AllocVCache();
  #else /* AFS_OSF_ENV */
      /* pull out a free cache entry */
      if (!freeVCList) {
***************
*** 870,902 ****
  	}
      }
      if (!freeVCList) {
! 	/* none free, making one is better than a panic */
! 	afs_stats_cmperf.vcacheXAllocs++;	/* count in case we have a leak */
! 	tvc = (struct vcache *)afs_osi_Alloc(sizeof(struct vcache));
! #if defined(AFS_DARWIN_ENV) && !defined(UKERNEL)
! 	tvc->v = NULL; /* important to clean this, or use memset 0 */
! #endif
! #ifdef	KERNEL_HAVE_PIN
! 	pin((char *)tvc, sizeof(struct vcache));	/* XXX */
! #endif
! #if defined(AFS_SGI_ENV)
! 	{
! 	    char name[METER_NAMSZ];
! 	    memset(tvc, 0, sizeof(struct vcache));
! 	    tvc->v.v_number = ++afsvnumbers;
! 	    tvc->vc_rwlockid = OSI_NO_LOCKID;
! 	    initnsema(&tvc->vc_rwlock, 1,
! 		      makesname(name, "vrw", tvc->v.v_number));
! #ifndef	AFS_SGI53_ENV
! 	    initnsema(&tvc->v.v_sync, 0,
! 		      makesname(name, "vsy", tvc->v.v_number));
! #endif
! #ifndef AFS_SGI62_ENV
! 	    initnlock(&tvc->v.v_lock,
! 		      makesname(name, "vlk", tvc->v.v_number));
! #endif
! 	}
! #endif /* AFS_SGI_ENV */
      } else {
  	tvc = freeVCList;	/* take from free list */
  	freeVCList = tvc->nextfree;
--- 949,955 ----
  	}
      }
      if (!freeVCList) {
! 	tvc = afs_AllocVCache();
      } else {
  	tvc = freeVCList;	/* take from free list */
  	freeVCList = tvc->nextfree;
***************
*** 1769,1775 ****
  	newvcache = 1;
  
  	ConvertWToSLock(&afs_xvcache);
! 	if (!tvc)
  	{
  		ReleaseSharedLock(&afs_xvcache);
  		return NULL;
--- 1822,1828 ----
  	newvcache = 1;
  
  	ConvertWToSLock(&afs_xvcache);
! 	if (tvc == NULL)
  	{
  		ReleaseSharedLock(&afs_xvcache);
  		return NULL;
***************
*** 3022,3028 ****
       */
  
      {
! 	register struct afs_q *tq, *uq;
  	register struct vcache *tvc;
  	for (tq = VLRU.prev; tq != &VLRU; tq = uq) {
  	    tvc = QTOV(tq);
--- 3075,3081 ----
       */
  
      {
! 	register struct afs_q *tq, *uq = NULL;
  	register struct vcache *tvc;
  	for (tq = VLRU.prev; tq != &VLRU; tq = uq) {
  	    tvc = QTOV(tq);
***************
*** 3077,3083 ****
  		    tvc->linkData = 0;
  		}
  
! 		afs_FreeAllAxs(&(tvc->Access));
  	    }
  	    afs_vhashT[i] = 0;
  	}
--- 3130,3137 ----
  		    tvc->linkData = 0;
  		}
  
! 		if (tvc->Access)
! 		    afs_FreeAllAxs(&(tvc->Access));
  	    }
  	    afs_vhashT[i] = 0;
  	}
***************
*** 3085,3092 ****
      /*
       * Free any leftover callback queue
       */
!     for (tsp = afs_cbrSpace; tsp; tsp = nsp) {
! 	nsp = tsp->next;
  	afs_osi_Free((char *)tsp, AFS_NCBRS * sizeof(struct afs_cbr));
      }
      afs_cbrSpace = 0;
--- 3139,3147 ----
      /*
       * Free any leftover callback queue
       */
!     for (i = 0; i < afs_stats_cmperf.CallBackAlloced; i++) {
! 	tsp = afs_cbrHeads[i];
! 	afs_cbrHeads[i] = 0;
  	afs_osi_Free((char *)tsp, AFS_NCBRS * sizeof(struct afs_cbr));
      }
      afs_cbrSpace = 0;
Index: openafs/src/afs/FBSD/osi_vnodeops.c
diff -c openafs/src/afs/FBSD/osi_vnodeops.c:1.18.2.5 openafs/src/afs/FBSD/osi_vnodeops.c:1.18.2.6
*** openafs/src/afs/FBSD/osi_vnodeops.c:1.18.2.5	Tue Aug 26 10:02:14 2008
--- openafs/src/afs/FBSD/osi_vnodeops.c	Mon Jan 12 09:33:37 2009
***************
*** 48,54 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_vnodeops.c,v 1.18.2.5 2008/08/26 14:02:14 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
--- 48,54 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_vnodeops.c,v 1.18.2.6 2009/01/12 14:33:37 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
***************
*** 1044,1051 ****
      if (((ap->a_command >> 8) & 0xff) == 'V') {
  	/* This is a VICEIOCTL call */
  	AFS_GLOCK();
! 	error = HandleIoctl(tvc, NULL /*Not used */ ,
! 			    ap->a_command, ap->a_data);
  	AFS_GUNLOCK();
  	return (error);
      } else {
--- 1044,1050 ----
      if (((ap->a_command >> 8) & 0xff) == 'V') {
  	/* This is a VICEIOCTL call */
  	AFS_GLOCK();
! 	error = HandleIoctl(tvc, ap->a_command, ap->a_data);
  	AFS_GUNLOCK();
  	return (error);
      } else {
Index: openafs/src/afs/LINUX/osi_cred.c
diff -c openafs/src/afs/LINUX/osi_cred.c:1.10.2.3 openafs/src/afs/LINUX/osi_cred.c:1.10.2.4
*** openafs/src/afs/LINUX/osi_cred.c:1.10.2.3	Mon Dec 18 21:29:56 2006
--- openafs/src/afs/LINUX/osi_cred.c	Thu Jan 15 08:27:43 2009
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_cred.c,v 1.10.2.3 2006/12/19 02:29:56 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_cred.c,v 1.10.2.4 2009/01/15 13:27:43 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 79,93 ****
  {
      cred_t *cr = crget();
  
!     cr->cr_uid = current->fsuid;
!     cr->cr_ruid = current->uid;
!     cr->cr_gid = current->fsgid;
!     cr->cr_rgid = current->gid;
  
  #if defined(AFS_LINUX26_ENV)
      task_lock(current);
!     get_group_info(current->group_info);
!     cr->cr_group_info = current->group_info;
      task_unlock(current);
  #else
      memcpy(cr->cr_groups, current->groups, NGROUPS * sizeof(gid_t));
--- 79,93 ----
  {
      cred_t *cr = crget();
  
!     cr->cr_uid = current_fsuid();
!     cr->cr_ruid = current_uid();
!     cr->cr_gid = current_fsgid();
!     cr->cr_rgid = current_gid();
  
  #if defined(AFS_LINUX26_ENV)
      task_lock(current);
!     get_group_info(current_group_info());
!     cr->cr_group_info = current_group_info();
      task_unlock(current);
  #else
      memcpy(cr->cr_groups, current->groups, NGROUPS * sizeof(gid_t));
***************
*** 101,110 ****
--- 101,120 ----
  void
  crset(cred_t * cr)
  {
+ #if defined(STRUCT_TASK_HAS_CRED)
+     struct cred *new_creds;
+ 
+     new_creds = prepare_creds();
+     new_creds->fsuid = cr->cr_uid;
+     new_creds->uid = cr->cr_ruid;
+     new_creds->fsgid = cr->cr_gid;
+     new_creds->gid = cr->cr_rgid;
+ #else
      current->fsuid = cr->cr_uid;
      current->uid = cr->cr_ruid;
      current->fsgid = cr->cr_gid;
      current->gid = cr->cr_rgid;
+ #endif
  #if defined(AFS_LINUX26_ENV)
  {
      struct group_info *old_info;
***************
*** 113,120 ****
--- 123,136 ----
      get_group_info(cr->cr_group_info);
  
      task_lock(current);
+ #if defined(STRUCT_TASK_HAS_CRED)
+     old_info = current->cred->group_info;
+     new_creds->group_info = cr->cr_group_info;
+     commit_creds(new_creds);
+ #else
      old_info = current->group_info;
      current->group_info = cr->cr_group_info;
+ #endif
      task_unlock(current);
  
      put_group_info(old_info);
Index: openafs/src/afs/LINUX/osi_file.c
diff -c openafs/src/afs/LINUX/osi_file.c:1.19.2.16 openafs/src/afs/LINUX/osi_file.c:1.19.2.19
*** openafs/src/afs/LINUX/osi_file.c:1.19.2.16	Wed Mar 26 00:10:52 2008
--- openafs/src/afs/LINUX/osi_file.c	Thu Jan 15 08:27:43 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_file.c,v 1.19.2.16 2008/03/26 04:10:52 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include "h/module.h" /* early to avoid printf->printk mapping */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_file.c,v 1.19.2.19 2009/01/15 13:27:43 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include "h/module.h" /* early to avoid printf->printk mapping */
***************
*** 78,88 ****
  #endif
      tip->i_flags |= MS_NOATIME;	/* Disable updating access times. */
  
      filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR);
      if (IS_ERR(filp))
  	osi_Panic("Can't open inode %d\n", ainode);
      afile->filp = filp;
!     afile->size = FILE_INODE(filp)->i_size;
      AFS_GLOCK();
      afile->offset = 0;
      afile->proc = (int (*)())0;
--- 78,92 ----
  #endif
      tip->i_flags |= MS_NOATIME;	/* Disable updating access times. */
  
+ #if defined(STRUCT_TASK_HAS_CRED)
+     filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, current_cred());
+ #else
      filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR);
+ #endif
      if (IS_ERR(filp))
  	osi_Panic("Can't open inode %d\n", ainode);
      afile->filp = filp;
!     afile->size = i_size_read(FILE_INODE(filp));
      AFS_GLOCK();
      afile->offset = 0;
      afile->proc = (int (*)())0;
***************
*** 133,139 ****
  	code = filp->f_op->open(tip, filp);
      if (code)
  	osi_Panic("Can't open inode %d\n", ainode);
!     afile->size = tip->i_size;
      AFS_GLOCK();
      afile->offset = 0;
      afile->proc = (int (*)())0;
--- 137,143 ----
  	code = filp->f_op->open(tip, filp);
      if (code)
  	osi_Panic("Can't open inode %d\n", ainode);
!     afile->size = i_size_read(tip);
      AFS_GLOCK();
      afile->offset = 0;
      afile->proc = (int (*)())0;
***************
*** 148,154 ****
      register afs_int32 code;
      AFS_STATCNT(osi_Stat);
      MObtainWriteLock(&afs_xosi, 320);
!     astat->size = OSIFILE_INODE(afile)->i_size;
  #if defined(AFS_LINUX26_ENV)
      astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec;
      astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec;
--- 152,158 ----
      register afs_int32 code;
      AFS_STATCNT(osi_Stat);
      MObtainWriteLock(&afs_xosi, 320);
!     astat->size = i_size_read(OSIFILE_INODE(afile));
  #if defined(AFS_LINUX26_ENV)
      astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec;
      astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec;
***************
*** 238,244 ****
      if (!code)
  	truncate_inode_pages(&inode->i_data, asize);
  #else
!     inode->i_size = asize;
      if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) {
  	code = inode->i_sb->s_op->notify_change(&afile->dentry, &newattrs);
      }
--- 242,248 ----
      if (!code)
  	truncate_inode_pages(&inode->i_data, asize);
  #else
!     i_size_write(inode, asize);
      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.25.2.16 openafs/src/afs/LINUX/osi_groups.c:1.25.2.20
*** openafs/src/afs/LINUX/osi_groups.c:1.25.2.16	Sun Jun  8 23:39:44 2008
--- openafs/src/afs/LINUX/osi_groups.c	Mon Mar 23 11:17:02 2009
***************
*** 20,26 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.16 2008/06/09 03:39:44 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 20,26 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.20 2009/03/23 15:17:02 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 50,56 ****
  
      crset(*cr);
  
! #ifdef STRUCT_TASK_STRUCT_HAS_PARENT
      if (change_parent) {
  	old_info = current->parent->group_info;
  	get_group_info(group_info);
--- 50,56 ----
  
      crset(*cr);
  
! #if defined(STRUCT_TASK_STRUCT_HAS_PARENT) && !defined(STRUCT_TASK_HAS_CRED)
      if (change_parent) {
  	old_info = current->parent->group_info;
  	get_group_info(group_info);
***************
*** 244,257 ****
  	not_in_quota = KEY_ALLOC_IN_QUOTA;
  	sprintf(desc, "_ses.%u", task->tgid);
  
! #ifdef KEY_ALLOC_NEEDS_STRUCT_TASK
  	keyring = key_alloc(__key_type_keyring, desc,
! 			    task->uid, task->gid, task,
  			    (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
  			    not_in_quota);
  #else
  	keyring = key_alloc(__key_type_keyring, desc,
! 			    task->uid, task->gid,
  			    (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
  			    not_in_quota);
  #endif
--- 244,262 ----
  	not_in_quota = KEY_ALLOC_IN_QUOTA;
  	sprintf(desc, "_ses.%u", task->tgid);
  
! #if defined(KEY_ALLOC_NEEDS_STRUCT_TASK)
! 	keyring = key_alloc(__key_type_keyring, desc,
! 			    task_uid(task), task_gid(task), task,
! 			    (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
! 			    not_in_quota);
! #elif defined(KEY_ALLOC_NEEDS_CRED)
  	keyring = key_alloc(__key_type_keyring, desc,
! 			    task_uid(task), task_gid(task), current_cred(),
  			    (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
  			    not_in_quota);
  #else
  	keyring = key_alloc(__key_type_keyring, desc,
! 			    task_uid(task), task_gid(task),
  			    (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_ALL,
  			    not_in_quota);
  #endif
***************
*** 269,277 ****
  
      /* install the keyring */
      spin_lock_irq(&task->sighand->siglock);
!     old = task->signal->session_keyring;
      smp_wmb();
!     task->signal->session_keyring = keyring;
      spin_unlock_irq(&task->sighand->siglock);
  
      if (old)
--- 274,282 ----
  
      /* install the keyring */
      spin_lock_irq(&task->sighand->siglock);
!     old = task_session_keyring(task);
      smp_wmb();
!     task_session_keyring(task) = keyring;
      spin_unlock_irq(&task->sighand->siglock);
  
      if (old)
***************
*** 337,358 ****
  
  	(void) install_session_keyring(current, NULL);
  
! 	if (current->signal->session_keyring) {
  	    struct key *key;
  	    key_perm_t perm;
  
  	    perm = KEY_POS_VIEW | KEY_POS_SEARCH;
  	    perm |= KEY_USR_VIEW | KEY_USR_SEARCH;
  
! #ifdef KEY_ALLOC_NEEDS_STRUCT_TASK
  	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, current, perm, 1);
  #else
  	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, perm, 1);
  #endif
  
  	    if (!IS_ERR(key)) {
  		key_instantiate_and_link(key, (void *) newpag, sizeof(afs_uint32),
! 					 current->signal->session_keyring, NULL);
  		key_put(key);
  	    }
  	}
--- 342,365 ----
  
  	(void) install_session_keyring(current, NULL);
  
! 	if (current_session_keyring()) {
  	    struct key *key;
  	    key_perm_t perm;
  
  	    perm = KEY_POS_VIEW | KEY_POS_SEARCH;
  	    perm |= KEY_USR_VIEW | KEY_USR_SEARCH;
  
! #if defined(KEY_ALLOC_NEEDS_STRUCT_TASK)
  	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, current, perm, 1);
+ #elif defined(KEY_ALLOC_NEEDS_CRED)
+ 	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, current_cred(), perm, 1);
  #else
  	    key = key_alloc(&key_type_afs_pag, "_pag", 0, 0, perm, 1);
  #endif
  
  	    if (!IS_ERR(key)) {
  		key_instantiate_and_link(key, (void *) newpag, sizeof(afs_uint32),
! 					 current_session_keyring(), NULL);
  		key_put(key);
  	    }
  	}
***************
*** 549,574 ****
  {
      int code;
      afs_uint32 *userpag, pag = NOPAG;
      int g0, g1;
  
      if (key->uid != 0 || key->gid != 0)
  	return -EPERM;
  
      code = -EINVAL;
!     get_group_info(current->group_info);
  
      if (datalen != sizeof(afs_uint32) || !data)
  	goto error;
  
!     if (current->group_info->ngroups < NUMPAGGROUPS)
  	goto error;
  
      /* ensure key being set matches current pag */
  #ifdef AFS_LINUX26_ONEGROUP_ENV
!     pag = afs_get_pag_from_groups(current->group_info);
  #else
!     g0 = GROUP_AT(current->group_info, 0);
!     g1 = GROUP_AT(current->group_info, 1);
  
      pag = afs_get_pag_from_groups(g0, g1);
  #endif
--- 556,583 ----
  {
      int code;
      afs_uint32 *userpag, pag = NOPAG;
+ #ifndef AFS_LINUX26_ONEGROUP_ENV
      int g0, g1;
+ #endif
  
      if (key->uid != 0 || key->gid != 0)
  	return -EPERM;
  
      code = -EINVAL;
!     get_group_info(current_group_info());
  
      if (datalen != sizeof(afs_uint32) || !data)
  	goto error;
  
!     if (current_group_info()->ngroups < NUMPAGGROUPS)
  	goto error;
  
      /* ensure key being set matches current pag */
  #ifdef AFS_LINUX26_ONEGROUP_ENV
!     pag = afs_get_pag_from_groups(current_group_info());
  #else
!     g0 = GROUP_AT(current_group_info(), 0);
!     g1 = GROUP_AT(current_group_info(), 1);
  
      pag = afs_get_pag_from_groups(g0, g1);
  #endif
***************
*** 584,590 ****
      code = 0;
  
  error:
!     put_group_info(current->group_info);
      return code;
  }
  
--- 593,599 ----
      code = 0;
  
  error:
!     put_group_info(current_group_info());
      return code;
  }
  
***************
*** 651,658 ****
  #else
  	p = find_task_by_vpid(1);
  #endif
! 	if (p && p->user->session_keyring)
! 	    __key_type_keyring = p->user->session_keyring->type;
  # ifdef EXPORTED_TASKLIST_LOCK
  	if (&tasklist_lock)
  	    read_unlock(&tasklist_lock);
--- 660,667 ----
  #else
  	p = find_task_by_vpid(1);
  #endif
! 	if (p && task_user(p)->session_keyring)
! 	    __key_type_keyring = task_user(p)->session_keyring->type;
  # ifdef EXPORTED_TASKLIST_LOCK
  	if (&tasklist_lock)
  	    read_unlock(&tasklist_lock);
Index: openafs/src/afs/LINUX/osi_machdep.h
diff -c openafs/src/afs/LINUX/osi_machdep.h:1.22.2.18 openafs/src/afs/LINUX/osi_machdep.h:1.22.2.19
*** openafs/src/afs/LINUX/osi_machdep.h:1.22.2.18	Fri Nov 23 08:45:04 2007
--- openafs/src/afs/LINUX/osi_machdep.h	Thu Jan 15 08:27:43 2009
***************
*** 155,161 ****
  #endif
  
  /* cred struct */
! typedef struct cred {		/* maps to task field: */
      int cr_ref;
      uid_t cr_uid;		/* euid */
      uid_t cr_ruid;		/* uid */
--- 155,161 ----
  #endif
  
  /* cred struct */
! typedef struct afs_cred {		/* maps to task field: */
      int cr_ref;
      uid_t cr_uid;		/* euid */
      uid_t cr_ruid;		/* uid */
***************
*** 167,176 ****
      gid_t cr_groups[NGROUPS];	/* 32 groups - empty set to NOGROUP */
      int cr_ngroups;
  #endif
!     struct cred *cr_next;
  } cred_t;
! #define AFS_UCRED cred
  #define AFS_PROC struct task_struct
  #define crhold(c) (c)->cr_ref++
  
  /* UIO manipulation */
--- 167,200 ----
      gid_t cr_groups[NGROUPS];	/* 32 groups - empty set to NOGROUP */
      int cr_ngroups;
  #endif
!     struct afs_cred *cr_next;
  } cred_t;
! #define AFS_UCRED afs_cred
  #define AFS_PROC struct task_struct
+ #if !defined(current_cred)
+ #define current_gid() (current->gid)
+ #define current_uid() (current->uid)
+ #define current_fsgid() (current->fsgid)
+ #define current_fsuid() (current->fsuid)
+ #endif
+ #if defined(STRUCT_TASK_HAS_CRED)
+ #define current_group_info() (current->cred->group_info)
+ #define task_gid(task) (task->cred->gid)
+ #define task_user(task) (task->cred->user)
+ #define task_session_keyring(task) (task->cred->tgcred->session_keyring)
+ #define current_session_keyring() (current->cred->tgcred->session_keyring)
+ #else
+ #define current_group_info() (current->group_info)
+ #if !defined(task_gid)
+ #define task_gid(task) (task->gid)
+ #endif
+ #if !defined(task_uid)
+ #define task_uid(task) (task->uid)
+ #endif
+ #define task_user(task) (task->user)
+ #define task_session_keyring(task) (task->signal->session_keyring)
+ #define current_session_keyring() (current->signal->session_keyring)
+ #endif
  #define crhold(c) (c)->cr_ref++
  
  /* UIO manipulation */
Index: openafs/src/afs/LINUX/osi_module.c
diff -c openafs/src/afs/LINUX/osi_module.c:1.52.2.31 openafs/src/afs/LINUX/osi_module.c:1.52.2.32
*** openafs/src/afs/LINUX/osi_module.c:1.52.2.31	Fri Aug 22 15:17:02 2008
--- openafs/src/afs/LINUX/osi_module.c	Sun Mar 15 14:42:34 2009
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.52.2.31 2008/08/22 19:17:02 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.52.2.32 2009/03/15 18:42:34 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
***************
*** 83,88 ****
--- 83,89 ----
  	struct afs_q *cq, *tq;
  	loff_t n = 0;
  
+ 	AFS_GLOCK();
  	ObtainReadLock(&afs_xcell);
  	for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
  		tq = QNext(cq);
***************
*** 91,98 ****
  			break;
  	}
  	if (cq == &CellLRU)
! 		return NULL;
  
  	return cq;
  }
  
--- 92,100 ----
  			break;
  	}
  	if (cq == &CellLRU)
! 		cq = NULL;
  
+ 	AFS_GUNLOCK();
  	return cq;
  }
  
***************
*** 100,117 ****
  {
  	struct afs_q *cq = p, *tq;
  
  	(*pos)++;
  	tq = QNext(cq);
  
  	if (tq == &CellLRU)
! 		return NULL;
  
  	return tq;
  }
  
  static void c_stop(struct seq_file *m, void *p)
  {
  	ReleaseReadLock(&afs_xcell);
  }
  
  static int c_show(struct seq_file *m, void *p)
--- 102,124 ----
  {
  	struct afs_q *cq = p, *tq;
  
+ 
+ 	AFS_GLOCK();
  	(*pos)++;
  	tq = QNext(cq);
  
  	if (tq == &CellLRU)
! 		tq = NULL;
  
+ 	AFS_GUNLOCK();
  	return tq;
  }
  
  static void c_stop(struct seq_file *m, void *p)
  {
+ 	AFS_GLOCK();
  	ReleaseReadLock(&afs_xcell);
+ 	AFS_GUNLOCK();
  }
  
  static int c_show(struct seq_file *m, void *p)
Index: openafs/src/afs/LINUX/osi_probe.c
diff -c openafs/src/afs/LINUX/osi_probe.c:1.1.2.26 openafs/src/afs/LINUX/osi_probe.c:1.1.2.27
*** openafs/src/afs/LINUX/osi_probe.c:1.1.2.26	Thu Jul  3 16:33:25 2008
--- openafs/src/afs/LINUX/osi_probe.c	Thu Jan 15 08:13:21 2009
***************
*** 1210,1223 ****
      if (probe_debug & 0x0001) {                                                              \
  	printk("<7>osi_probe: %s = 0x%016lx %s\n", P->symbol, (unsigned long)(x), (m)); \
      }                                                                                      \
!     if ((x)) {                                                                             \
  	*method = (m);                                                                     \
          final_answer = (void *)(x);                                                        \
      }                                                                                      \
  } while (0)
  #else
  #define check_result(x,m) do {  \
!     if ((x)) {                  \
          *method = (m);          \
          return (void *)(x);     \
      }                           \
--- 1210,1223 ----
      if (probe_debug & 0x0001) {                                                              \
  	printk("<7>osi_probe: %s = 0x%016lx %s\n", P->symbol, (unsigned long)(x), (m)); \
      }                                                                                      \
!     if ((x) && ((int)(x)) != -ENOENT) {                                                    \
  	*method = (m);                                                                     \
          final_answer = (void *)(x);                                                        \
      }                                                                                      \
  } while (0)
  #else
  #define check_result(x,m) do {  \
!     if ((x) && ((int)(x)) != -ENOENT) { \
          *method = (m);          \
          return (void *)(x);     \
      }                           \
Index: openafs/src/afs/LINUX/osi_vfs.hin
diff -c openafs/src/afs/LINUX/osi_vfs.hin:1.6.2.2 openafs/src/afs/LINUX/osi_vfs.hin:1.6.2.3
*** openafs/src/afs/LINUX/osi_vfs.hin:1.6.2.2	Mon Jul 11 15:29:56 2005
--- openafs/src/afs/LINUX/osi_vfs.hin	Fri Jan  9 09:58:03 2009
***************
*** 78,81 ****
--- 78,86 ----
  
  #define VATTR_NULL(A) memset(A, 0, sizeof(struct vattr))
  
+ #ifndef HAVE_LINUX_I_SIZE_READ
+ #define i_size_read(X) ((X)->i_size)
+ #define i_size_write(X,Y) (X)->i_size = Y
+ #endif
+ 
  #endif /* OSI_VFS_H_ */
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.28 openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.31
*** openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.28	Fri Nov 23 08:45:04 2007
--- openafs/src/afs/LINUX/osi_vfsops.c	Wed Mar 18 08:57:17 2009
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.28 2007/11/23 13:45:04 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.31 2009/03/18 12:57:17 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
***************
*** 143,148 ****
--- 143,151 ----
      sb->s_blocksize_bits = 10;
      sb->s_magic = AFS_VFSMAGIC;
      sb->s_op = &afs_sops;	/* Super block (vfs) ops */
+ #if defined(HAVE_BDI_INIT)
+     bdi_init(&afs_backing_dev_info);
+ #endif
  #if defined(MAX_NON_LFS)
  #ifdef AFS_64BIT_CLIENT
  #if !defined(MAX_LFS_FILESIZE)
***************
*** 394,399 ****
--- 397,405 ----
  #endif
  
      osi_linux_verify_alloced_memory();
+ #if defined(HAVE_BDI_INIT)
+     bdi_destroy(&afs_backing_dev_info);
+ #endif
      AFS_GUNLOCK();
  
      sbp->s_dev = 0;
***************
*** 532,538 ****
      ip->i_mode = vp->va_mode;
      ip->i_uid = vp->va_uid;
      ip->i_gid = vp->va_gid;
!     ip->i_size = vp->va_size;
  #if defined(AFS_LINUX26_ENV)
      ip->i_atime.tv_sec = vp->va_atime.tv_sec;
      ip->i_atime.tv_nsec = 0;
--- 538,544 ----
      ip->i_mode = vp->va_mode;
      ip->i_uid = vp->va_uid;
      ip->i_gid = vp->va_gid;
!     i_size_write(ip, vp->va_size);
  #if defined(AFS_LINUX26_ENV)
      ip->i_atime.tv_sec = vp->va_atime.tv_sec;
      ip->i_atime.tv_nsec = 0;
Index: openafs/src/afs/LINUX/osi_vm.c
diff -c openafs/src/afs/LINUX/osi_vm.c:1.16.2.2 openafs/src/afs/LINUX/osi_vm.c:1.16.2.4
*** openafs/src/afs/LINUX/osi_vm.c:1.16.2.2	Mon Oct 20 08:10:00 2008
--- openafs/src/afs/LINUX/osi_vm.c	Fri Mar 20 11:55:57 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vm.c,v 1.16.2.2 2008/10/20 12:10:00 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vm.c,v 1.16.2.4 2009/03/20 15:55:57 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 52,58 ****
  	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
--- 52,58 ----
  	return EBUSY;
  
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
!     return vmtruncate(ip, 0);
  #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
      truncate_inode_pages(ip, 0);
  #else
***************
*** 131,139 ****
  osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
  {
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
!     struct inode *ip = AFSTOV(avc);
! 
!     truncate_inode_pages(&ip->i_data, 0);
  #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
      struct inode *ip = AFSTOV(avc);
  
--- 131,137 ----
  osi_VM_FlushPages(struct vcache *avc, struct AFS_UCRED *credp)
  {
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
!     invalidate_remote_inode(AFSTOV(avc));
  #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
      struct inode *ip = AFSTOV(avc);
  
***************
*** 153,161 ****
  osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
  {
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
!     struct inode *ip = AFSTOV(avc);
! 
!     truncate_inode_pages(&ip->i_data, alen);
  #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
      struct inode *ip = AFSTOV(avc);
  
--- 151,157 ----
  osi_VM_Truncate(struct vcache *avc, int alen, struct AFS_UCRED *acred)
  {
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
!     vmtruncate(AFSTOV(avc), alen);
  #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
      struct inode *ip = AFSTOV(avc);
  
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.73 openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.77
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.73	Sat Nov  8 11:49:59 2008
--- openafs/src/afs/LINUX/osi_vnodeops.c	Thu Mar 19 00:54:50 2009
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.73 2008/11/08 16:49:59 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.77 2009/03/19 04:54:50 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 47,52 ****
--- 47,53 ----
  
  #if defined(AFS_LINUX26_ENV)
  #define UnlockPage(pp) unlock_page(pp)
+ extern struct backing_dev_info afs_backing_dev_info;
  #endif
  
  extern struct vcache *afs_globalVp;
***************
*** 1581,1587 ****
  
      code = afs_write(vcp, &tuio, f_flags, credp, 0);
  
!     ip->i_size = vcp->m.Length;
      ip->i_blocks = ((vcp->m.Length + 1023) >> 10) << 1;
  
      if (!code) {
--- 1582,1588 ----
  
      code = afs_write(vcp, &tuio, f_flags, credp, 0);
  
!     i_size_write(ip, vcp->m.Length);
      ip->i_blocks = ((vcp->m.Length + 1023) >> 10) << 1;
  
      if (!code) {
***************
*** 1635,1647 ****
  #endif
  
      inode = (struct inode *)mapping->host;
!     end_index = inode->i_size >> PAGE_CACHE_SHIFT;
  
      /* easy case */
      if (pp->index < end_index)
  	goto do_it;
      /* things got complicated... */
!     offset = inode->i_size & (PAGE_CACHE_SIZE - 1);
      /* OK, are we completely out? */
      if (pp->index >= end_index + 1 || !offset)
  	return -EIO;
--- 1636,1648 ----
  #endif
  
      inode = (struct inode *)mapping->host;
!     end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT;
  
      /* easy case */
      if (pp->index < end_index)
  	goto do_it;
      /* things got complicated... */
!     offset = i_size_read(inode) & (PAGE_CACHE_SIZE - 1);
      /* OK, are we completely out? */
      if (pp->index >= end_index + 1 || !offset)
  	return -EIO;
***************
*** 1684,1690 ****
  
      code = afs_write(vcp, &tuio, fp->f_flags, credp, 0);
  
!     ip->i_size = vcp->m.Length;
      ip->i_blocks = ((vcp->m.Length + 1023) >> 10) << 1;
  
      if (!code) {
--- 1685,1691 ----
  
      code = afs_write(vcp, &tuio, fp->f_flags, credp, 0);
  
!     i_size_write(ip, vcp->m.Length);
      ip->i_blocks = ((vcp->m.Length + 1023) >> 10) << 1;
  
      if (!code) {
***************
*** 1791,1797 ****
--- 1792,1802 ----
  {
      struct page *page;
      pgoff_t index = pos >> PAGE_CACHE_SHIFT;
+ #if defined(HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN)
+     page = grab_cache_page_write_begin(mapping, index, flags);
+ #else
      page = __grab_cache_page(mapping, index);
+ #endif
      *pagep = page;
  
      return 0;
***************
*** 1925,1930 ****
--- 1930,1938 ----
      if (vattr)
  	vattr2inode(ip, vattr);
  
+ #if defined(AFS_LINUX26_ENV)
+     ip->i_mapping->backing_dev_info = &afs_backing_dev_info;
+ #endif
  /* Reset ops if symlink or directory. */
      if (S_ISREG(ip->i_mode)) {
  	ip->i_op = &afs_file_iops;
Index: openafs/src/afs/SOLARIS/osi_file.c
diff -c openafs/src/afs/SOLARIS/osi_file.c:1.13.2.3 openafs/src/afs/SOLARIS/osi_file.c:1.13.2.5
*** openafs/src/afs/SOLARIS/osi_file.c:1.13.2.3	Mon Mar 17 11:28:55 2008
--- openafs/src/afs/SOLARIS/osi_file.c	Thu Mar 19 15:30:28 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/SOLARIS/osi_file.c,v 1.13.2.3 2008/03/17 15:28:55 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/SOLARIS/osi_file.c,v 1.13.2.5 2009/03/19 19:30:28 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 175,196 ****
  osi_UfsOpen(afs_int32 ainode)
  #endif
  {
      struct inode *ip;
      register struct osi_file *afile = NULL;
      afs_int32 code = 0;
      int dummy;
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
      code =
  	igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode, &ip,
  		  CRED(), &dummy);
      AFS_GLOCK();
      if (code) {
  	osi_FreeSmallSpace(afile);
! 	osi_Panic("UfsOpen: igetinode failed");
      }
      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 */
--- 175,259 ----
  osi_UfsOpen(afs_int32 ainode)
  #endif
  {
+ #ifdef AFS_CACHE_VNODE_PATH
+     struct vnode *vp;
+ #else
      struct inode *ip;
+ #endif
      register struct osi_file *afile = NULL;
      afs_int32 code = 0;
      int dummy;
+     char fname[1024];
+ #ifdef AFS_CACHE_VNODE_PATH
+     char namebuf[1024];
+     struct pathname lookpn;
+ #endif
+     struct osi_stat tstat;
      afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
      AFS_GUNLOCK();
+ 
+ /*
+  * AFS_CACHE_VNODE_PATH can be used with any file system, including ZFS or tmpfs.
+  * The ainode is not an inode number but a signed index used to generate file names. 
+  */
+ #ifdef AFS_CACHE_VNODE_PATH
+ 	switch (ainode) {
+ 	case AFS_CACHE_CELLS_INODE:
+ 	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
+ 	    break;
+ 	case AFS_CACHE_ITEMS_INODE:
+ 	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CacheItems");
+ 	    break;
+ 	case AFS_CACHE_VOLUME_INODE:
+ 	    snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "VolumeItems");
+ 	    break;
+ 	default:
+ 		dummy = ainode / afs_numfilesperdir;
+ 		snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode);
+     }
+ 		
+ 	/* Can not use vn_open or lookupname, they use user's CRED() 
+      * We need to run as root So must use low level lookuppnvp 
+      * assume fname starts with /
+ 	 */
+ 
+ 	code = pn_get_buf(fname, AFS_UIOSYS, &lookpn, namebuf, sizeof(namebuf));
+     if (code != 0) 
+         osi_Panic("UfsOpen: pn_get_buf failed %ld %s %ld", code, fname, ainode);
+  
+ 	VN_HOLD(rootdir); /* released in loopuppnvp */
+ 	code = lookuppnvp(&lookpn, NULL, FOLLOW, NULL, &vp, 
+            rootdir, rootdir, &afs_osi_cred); 
+     if (code != 0)  
+         osi_Panic("UfsOpen: lookuppnvp failed %ld %s %ld", code, fname, ainode);
+ 	
+ #ifdef AFS_SUN511_ENV
+     code = VOP_OPEN(&vp, FREAD|FWRITE, &afs_osi_cred, NULL);
+ #else
+     code = VOP_OPEN(&vp, FREAD|FWRITE, &afs_osi_cred);
+ #endif
+ 
+     if (code != 0)
+         osi_Panic("UfsOpen: VOP_OPEN failed %ld %s %ld", code, fname, ainode);
+ 
+ #else
      code =
  	igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, (ino_t) ainode, &ip,
  		  CRED(), &dummy);
+ #endif
      AFS_GLOCK();
      if (code) {
  	osi_FreeSmallSpace(afile);
! 	osi_Panic("UfsOpen: igetinode failed %ld %s %ld", code, fname, ainode);
      }
+ #ifdef AFS_CACHE_VNODE_PATH
+ 	afile->vnode = vp;
+ 	code = afs_osi_Stat(afile, &tstat);
+ 	afile->size = tstat.size;
+ #else
      afile->vnode = ITOV(ip);
      afile->size = VTOI(afile->vnode)->i_size;
+ #endif
      afile->offset = 0;
      afile->proc = (int (*)())0;
      afile->inum = ainode;	/* for hint validity checking */
***************
*** 304,315 ****
--- 367,380 ----
  osi_DisableAtimes(struct vnode *avp)
  {
      if (afs_CacheFSType == AFS_SUN_UFS_CACHE) {
+ #ifndef AFS_CACHE_VNODE_PATH 
  	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);
+ #endif
      }
  }
  
Index: openafs/src/afs/SOLARIS/osi_vnodeops.c
diff -c openafs/src/afs/SOLARIS/osi_vnodeops.c:1.20.2.12 openafs/src/afs/SOLARIS/osi_vnodeops.c:1.20.2.13
*** openafs/src/afs/SOLARIS/osi_vnodeops.c:1.20.2.12	Mon Mar 17 11:28:55 2008
--- openafs/src/afs/SOLARIS/osi_vnodeops.c	Sun Mar 15 14:13:55 2009
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.20.2.12 2008/03/17 15:28:55 shadow Exp $");
  
  /*
   * SOLARIS/osi_vnodeops.c
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/SOLARIS/osi_vnodeops.c,v 1.20.2.13 2009/03/15 18:13:55 shadow Exp $");
  
  /*
   * SOLARIS/osi_vnodeops.c
***************
*** 363,369 ****
      else
  	tdc = afs_GetDCache(avc, (afs_offs_t) off, &treq, &offset, &nlen, 1);
      if (!tdc)
! 	return EINVAL;
      code = afs_VerifyVCache(avc, &treq);
      if (code) {
  	afs_PutDCache(tdc);
--- 363,369 ----
      else
  	tdc = afs_GetDCache(avc, (afs_offs_t) off, &treq, &offset, &nlen, 1);
      if (!tdc)
! 	return afs_CheckCode(EINVAL, &treq, 62);
      code = afs_VerifyVCache(avc, &treq);
      if (code) {
  	afs_PutDCache(tdc);
Index: openafs/src/afs/UKERNEL/afs_usrops.c
diff -c openafs/src/afs/UKERNEL/afs_usrops.c:1.27.2.9 openafs/src/afs/UKERNEL/afs_usrops.c:1.27.2.10
*** openafs/src/afs/UKERNEL/afs_usrops.c:1.27.2.9	Mon Oct 27 19:54:09 2008
--- openafs/src/afs/UKERNEL/afs_usrops.c	Mon Dec 29 16:26:24 2008
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.27.2.9 2008/10/27 23:54:09 shadow Exp $");
  
  
  #ifdef	UKERNEL
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.27.2.10 2008/12/29 21:26:24 shadow Exp $");
  
  
  #ifdef	UKERNEL
***************
*** 56,62 ****
  
  struct usr_vnode *afs_FileTable[MAX_OSI_FILES];
  int afs_FileFlags[MAX_OSI_FILES];
! int afs_FileOffsets[MAX_OSI_FILES];
  
  #define MAX_CACHE_LOOPS 4
  
--- 56,62 ----
  
  struct usr_vnode *afs_FileTable[MAX_OSI_FILES];
  int afs_FileFlags[MAX_OSI_FILES];
! off_t afs_FileOffsets[MAX_OSI_FILES];
  
  #define MAX_CACHE_LOOPS 4
  
***************
*** 107,114 ****
  
  usr_key_t afs_global_u_key;
  
! struct usr_proc *afs_global_procp;
! struct usr_ucred *afs_global_ucredp;
  struct usr_sysent usr_sysent[200];
  
  #ifdef AFS_USR_OSF_ENV
--- 107,114 ----
  
  usr_key_t afs_global_u_key;
  
! struct usr_proc *afs_global_procp = NULL;
! struct usr_ucred *afs_global_ucredp = NULL;
  struct usr_sysent usr_sysent[200];
  
  #ifdef AFS_USR_OSF_ENV
***************
*** 1562,1568 ****
  	cacheStatEntries = cacheStatEntriesParam;
      }
      strcpy(cacheBaseDir, cacheBaseDirParam);
!     if (nDaemons != 0) {
  	nDaemons = nDaemonsParam;
      } else {
  	nDaemons = 3;
--- 1562,1568 ----
  	cacheStatEntries = cacheStatEntriesParam;
      }
      strcpy(cacheBaseDir, cacheBaseDirParam);
!     if (nDaemonsParam != 0) {
  	nDaemons = nDaemonsParam;
      } else {
  	nDaemons = 3;
***************
*** 1847,1853 ****
  			 (long)pathname_for_V[currVFile], 0, 0, 0);
  	}
      /*end for */
! #ifndef NETSCAPE_NSAPI
      /*
       * Copy our tokens from the kernel to the user space client
       */
--- 1847,1857 ----
  			 (long)pathname_for_V[currVFile], 0, 0, 0);
  	}
      /*end for */
! /*#ifndef NETSCAPE_NSAPI*/
! #if 0
! /* this breaks solaris if the kernel-mode client has never been installed,
!  * and it doesn't seem to work now anyway, so just disable it */
! 
      /*
       * Copy our tokens from the kernel to the user space client
       */
***************
*** 2692,2697 ****
--- 2696,2702 ----
  		errno = code;
  		return -1;
  	    }
+ 	    fileP = AFSTOV(vc);
  	} else {
  	    fileP = NULL;
  	    code = uafs_LookupName(nameP, dirP, &fileP, 1, 0);
***************
*** 2764,2769 ****
--- 2769,2775 ----
       */
      if ((flags & O_TRUNC) && (attrs.va_size != 0)) {
  	usr_vattr_null(&attrs);
+ 	attrs.va_mask = ATTR_SIZE;
  	attrs.va_size = 0;
  	code = afs_setattr(VTOAFS(fileP), &attrs, u.u_cred);
  	if (code != 0) {
***************
*** 2835,2847 ****
  {
      int retval;
      AFS_GLOCK();
!     retval = uafs_write_r(fd, buf, len);
      AFS_GUNLOCK();
      return retval;
  }
  
  int
! uafs_write_r(int fd, char *buf, int len)
  {
      int code;
      struct usr_uio uio;
--- 2841,2863 ----
  {
      int retval;
      AFS_GLOCK();
!     retval = uafs_pwrite_r(fd, buf, len, afs_FileOffsets[fd]);
!     AFS_GUNLOCK();
!     return retval;
! }
! 
! int
! uafs_pwrite(int fd, char *buf, int len, off_t offset)
! {
!     int retval;
!     AFS_GLOCK();
!     retval = uafs_pwrite_r(fd, buf, len, offset);
      AFS_GUNLOCK();
      return retval;
  }
  
  int
! uafs_pwrite_r(int fd, char *buf, int len, off_t offset)
  {
      int code;
      struct usr_uio uio;
***************
*** 2864,2870 ****
      iov[0].iov_len = len;
      uio.uio_iov = &iov[0];
      uio.uio_iovcnt = 1;
!     uio.uio_offset = afs_FileOffsets[fd];
      uio.uio_segflg = 0;
      uio.uio_fmode = FWRITE;
      uio.uio_resid = len;
--- 2880,2886 ----
      iov[0].iov_len = len;
      uio.uio_iov = &iov[0];
      uio.uio_iovcnt = 1;
!     uio.uio_offset = offset;
      uio.uio_segflg = 0;
      uio.uio_fmode = FWRITE;
      uio.uio_resid = len;
***************
*** 2891,2903 ****
  {
      int retval;
      AFS_GLOCK();
!     retval = uafs_read_r(fd, buf, len);
      AFS_GUNLOCK();
      return retval;
  }
  
  int
! uafs_read_r(int fd, char *buf, int len)
  {
      int code;
      struct usr_uio uio;
--- 2907,2929 ----
  {
      int retval;
      AFS_GLOCK();
!     retval = uafs_pread_r(fd, buf, len, afs_FileOffsets[fd]);
!     AFS_GUNLOCK();
!     return retval;
! }
! 
! int
! uafs_pread(int fd, char *buf, int len, off_t offset)
! {
!     int retval;
!     AFS_GLOCK();
!     retval = uafs_pread_r(fd, buf, len, offset);
      AFS_GUNLOCK();
      return retval;
  }
  
  int
! uafs_pread_r(int fd, char *buf, int len, off_t offset)
  {
      int code;
      struct usr_uio uio;
***************
*** 2921,2927 ****
      iov[0].iov_len = len;
      uio.uio_iov = &iov[0];
      uio.uio_iovcnt = 1;
!     uio.uio_offset = afs_FileOffsets[fd];
      uio.uio_segflg = 0;
      uio.uio_fmode = FREAD;
      uio.uio_resid = len;
--- 2947,2953 ----
      iov[0].iov_len = len;
      uio.uio_iov = &iov[0];
      uio.uio_iovcnt = 1;
!     uio.uio_offset = offset;
      uio.uio_segflg = 0;
      uio.uio_fmode = FREAD;
      uio.uio_resid = len;
***************
*** 3105,3110 ****
--- 3131,3137 ----
  	return -1;
      }
      usr_vattr_null(&attrs);
+     attrs.va_mask = ATTR_MODE;
      attrs.va_mode = mode;
      code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred);
      VN_RELE(vp);
***************
*** 3141,3146 ****
--- 3168,3174 ----
  	return -1;
      }
      usr_vattr_null(&attrs);
+     attrs.va_mask = ATTR_MODE;
      attrs.va_mode = mode;
      code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred);
      if (code != 0) {
***************
*** 3176,3181 ****
--- 3204,3210 ----
  	return -1;
      }
      usr_vattr_null(&attrs);
+     attrs.va_mask = ATTR_SIZE;
      attrs.va_size = length;
      code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred);
      VN_RELE(vp);
***************
*** 3212,3217 ****
--- 3241,3247 ----
  	return -1;
      }
      usr_vattr_null(&attrs);
+     attrs.va_mask = ATTR_SIZE;
      attrs.va_size = length;
      code = afs_setattr(VTOAFS(vp), &attrs, u.u_cred);
      if (code != 0) {
Index: openafs/src/afs/UKERNEL/afs_usrops.h
diff -c openafs/src/afs/UKERNEL/afs_usrops.h:1.5 openafs/src/afs/UKERNEL/afs_usrops.h:1.5.2.1
*** openafs/src/afs/UKERNEL/afs_usrops.h:1.5	Tue May  4 05:31:11 2004
--- openafs/src/afs/UKERNEL/afs_usrops.h	Mon Dec 29 16:26:24 2008
***************
*** 61,67 ****
  extern struct usr_vnode *afs_CurrentDir;
  extern struct usr_vnode *afs_FileTable[];
  extern int afs_FileFlags[];
! extern int afs_FileOffsets[];
  
  extern char afs_mountDir[];
  extern int afs_mountDirLen;
--- 61,67 ----
  extern struct usr_vnode *afs_CurrentDir;
  extern struct usr_vnode *afs_FileTable[];
  extern int afs_FileFlags[];
! extern off_t afs_FileOffsets[];
  
  extern char afs_mountDir[];
  extern int afs_mountDirLen;
***************
*** 90,98 ****
  extern int uafs_creat(char *path, int mode);
  extern int uafs_creat_r(char *path, int mode);
  extern int uafs_write(int fd, char *buf, int len);
! extern int uafs_write_r(int fd, char *buf, int len);
  extern int uafs_read(int fd, char *buf, int len);
! extern int uafs_read_r(int fd, char *buf, int len);
  extern int uafs_fsync(int fd);
  extern int uafs_fsync_r(int fd);
  extern int uafs_close(int fd);
--- 90,100 ----
  extern int uafs_creat(char *path, int mode);
  extern int uafs_creat_r(char *path, int mode);
  extern int uafs_write(int fd, char *buf, int len);
! extern int uafs_pwrite(int fd, char *buf, int len, off_t offset);
! extern int uafs_pwrite_r(int fd, char *buf, int len, off_t offset);
  extern int uafs_read(int fd, char *buf, int len);
! extern int uafs_pread(int fd, char *buf, int leni, off_t offset);
! extern int uafs_pread_r(int fd, char *buf, int len, off_t offset);
  extern int uafs_fsync(int fd);
  extern int uafs_fsync_r(int fd);
  extern int uafs_close(int fd);
Index: openafs/src/afs/UKERNEL/sysincludes.h
diff -c openafs/src/afs/UKERNEL/sysincludes.h:1.15.2.2 openafs/src/afs/UKERNEL/sysincludes.h:1.15.2.3
*** openafs/src/afs/UKERNEL/sysincludes.h:1.15.2.2	Thu Nov  9 19:08:56 2006
--- openafs/src/afs/UKERNEL/sysincludes.h	Mon Dec 29 16:26:24 2008
***************
*** 1017,1038 ****
      unsigned long f_files;
  };
  
  struct usr_vattr {
!     long va_mask;
      usr_vtype_t va_type;
!     unsigned short va_mode;
!     long va_uid;
!     long va_gid;
!     unsigned long va_fsid;
!     unsigned long va_nodeid;
!     unsigned long va_nlink;
!     unsigned long va_size;
      struct timeval va_atime;
      struct timeval va_mtime;
      struct timeval va_ctime;
!     unsigned long va_rdev;
      unsigned long va_blocksize;
!     unsigned long va_blocks;
      unsigned long va_vcode;
  };
  
--- 1017,1044 ----
      unsigned long f_files;
  };
  
+ #define ATTR_MODE	(1 << 0)
+ #define ATTR_UID	(1 << 1)
+ #define ATTR_GID	(1 << 2)
+ #define ATTR_MTIME	(1 << 3)
+ #define ATTR_SIZE	(1 << 4)
+ 
  struct usr_vattr {
!     int va_mask;	/* bitmask of ATTR_* values above */
      usr_vtype_t va_type;
!     mode_t va_mode;
!     uid_t va_uid;
!     gid_t va_gid;
!     int va_fsid;
!     ino_t va_nodeid;
!     nlink_t va_nlink;
!     afs_size_t va_size;
      struct timeval va_atime;
      struct timeval va_mtime;
      struct timeval va_ctime;
!     dev_t va_rdev;
      unsigned long va_blocksize;
!     blkcnt_t va_blocks;
      unsigned long va_vcode;
  };
  
Index: openafs/src/afs/VNOPS/afs_vnop_attrs.c
diff -c openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.27.2.11 openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.27.2.14
*** openafs/src/afs/VNOPS/afs_vnop_attrs.c:1.27.2.11	Thu Nov  9 19:08:57 2006
--- openafs/src/afs/VNOPS/afs_vnop_attrs.c	Tue Jan 13 14:37:28 2009
***************
*** 24,30 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.27.2.11 2006/11/10 00:08:57 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 24,30 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.27.2.14 2009/01/13 19:37:28 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 344,350 ****
  #elif	defined(AFS_AIX_ENV)
  /* Boy, was this machine dependent bogosity hard to swallow????.... */
      if (av->va_mode != -1) {
! #elif	defined(AFS_LINUX22_ENV)
      if (av->va_mask & ATTR_MODE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_MODE) {
--- 344,350 ----
  #elif	defined(AFS_AIX_ENV)
  /* Boy, was this machine dependent bogosity hard to swallow????.... */
      if (av->va_mode != -1) {
! #elif	defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (av->va_mask & ATTR_MODE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_MODE) {
***************
*** 363,369 ****
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_gid)) {
! #elif defined(AFS_LINUX22_ENV)
      if (av->va_mask & ATTR_GID) {
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_GID) {
--- 363,369 ----
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_gid)) {
! #elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (av->va_mask & ATTR_GID) {
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_GID) {
***************
*** 383,389 ****
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_uid)) {
! #elif defined(AFS_LINUX22_ENV)
      if (av->va_mask & ATTR_UID) {
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_UID) {
--- 383,389 ----
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_uid)) {
! #elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (av->va_mask & ATTR_UID) {
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_UID) {
***************
*** 403,409 ****
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_modify_time)) {
! #elif	defined(AFS_LINUX22_ENV)
      if (av->va_mask & ATTR_MTIME) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_MTIME) {
--- 403,409 ----
      }
  #if     defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(av, va_modify_time)) {
! #elif	defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (av->va_mask & ATTR_MTIME) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (av->va_mask & AT_MTIME) {
***************
*** 482,488 ****
       */
  #if	defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
! #elif	defined(AFS_LINUX22_ENV)
      if (attrs->va_mask & ATTR_SIZE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (attrs->va_mask & AT_SIZE) {
--- 482,488 ----
       */
  #if	defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
! #elif	defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (attrs->va_mask & ATTR_SIZE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (attrs->va_mask & AT_SIZE) {
***************
*** 515,533 ****
  #endif
  #if	defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
! #elif	defined(AFS_LINUX22_ENV)
      if (attrs->va_mask & ATTR_SIZE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (attrs->va_mask & AT_SIZE) {
  #elif	defined(AFS_OSF_ENV) || defined(AFS_XBSD_ENV)
      if (attrs->va_size != VNOVAL) {
! #else
      if (attrs->va_size != -1) {
  #endif
  	afs_size_t tsize = attrs->va_size;
  	ObtainWriteLock(&avc->lock, 128);
  	avc->states |= CDirty;
  	code = afs_TruncateAllSegments(avc, tsize, &treq, acred);
  	/* if date not explicitly set by this call, set it ourselves, since we
  	 * changed the data */
  	if (!(astat.Mask & AFS_SETMODTIME)) {
--- 515,542 ----
  #endif
  #if	defined(AFS_DARWIN80_ENV)
      if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
! #elif	defined(AFS_LINUX22_ENV) || defined(UKERNEL)
      if (attrs->va_mask & ATTR_SIZE) {
  #elif	defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
      if (attrs->va_mask & AT_SIZE) {
  #elif	defined(AFS_OSF_ENV) || defined(AFS_XBSD_ENV)
      if (attrs->va_size != VNOVAL) {
! #elif	defined(AFS_AIX41_ENV)
      if (attrs->va_size != -1) {
+ #else
+     if (attrs->va_size != ~0) {
  #endif
  	afs_size_t tsize = attrs->va_size;
  	ObtainWriteLock(&avc->lock, 128);
  	avc->states |= CDirty;
  	code = afs_TruncateAllSegments(avc, tsize, &treq, acred);
+ #ifdef AFS_LINUX26_ENV
+ 	/* We must update the Linux kernel's idea of file size as soon as
+ 	 * possible, to avoid racing with delayed writepages delivered by
+ 	 * pdflush */
+ 	if (code == 0) 
+ 	    i_size_write(AFSTOV(avc), tsize);
+ #endif
  	/* if date not explicitly set by this call, set it ourselves, since we
  	 * changed the data */
  	if (!(astat.Mask & AFS_SETMODTIME)) {
Index: openafs/src/afs/VNOPS/afs_vnop_create.c
diff -c openafs/src/afs/VNOPS/afs_vnop_create.c:1.16.2.10 openafs/src/afs/VNOPS/afs_vnop_create.c:1.16.2.11
*** openafs/src/afs/VNOPS/afs_vnop_create.c:1.16.2.10	Sat Dec  8 13:00:45 2007
--- openafs/src/afs/VNOPS/afs_vnop_create.c	Mon Dec 29 16:26:25 2008
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.16.2.10 2007/12/08 18:00:45 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.16.2.11 2008/12/29 21:26:25 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 217,222 ****
--- 217,224 ----
  		    VATTR_INIT(attrs);
  		    VATTR_SET_SUPPORTED(attrs, va_data_size);
  		    VATTR_SET_ACTIVE(attrs, va_data_size);
+ #elif defined(UKERNEL)
+ 		    attrs->va_mask = ATTR_SIZE;
  #elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
  		    attrs->va_mask = AT_SIZE;
  #else
Index: openafs/src/afsd/afs.rc.linux
diff -c openafs/src/afsd/afs.rc.linux:1.9.2.4 openafs/src/afsd/afs.rc.linux:1.9.2.5
*** openafs/src/afsd/afs.rc.linux:1.9.2.4	Mon Jan 21 16:05:15 2008
--- openafs/src/afsd/afs.rc.linux	Mon Jan 19 15:54:01 2009
***************
*** 1,4 ****
! #! /bin/sh
  # Copyright 2000, International Business Machines Corporation and others.
  # All Rights Reserved.
  # 
--- 1,4 ----
! #! /bin/bash
  # Copyright 2000, International Business Machines Corporation and others.
  # All Rights Reserved.
  # 
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.43.2.25 openafs/src/afsd/afsd.c:1.43.2.26
*** openafs/src/afsd/afsd.c:1.43.2.25	Wed Oct 31 18:32:17 2007
--- openafs/src/afsd/afsd.c	Thu Mar 19 22:32:59 2009
***************
*** 32,37 ****
--- 32,40 ----
    *	-nosettime  Don't keep checking the time to avoid drift (default).
    *     -settime    Keep checking the time to avoid drift.
    *	-verbose     Be chatty.
+   *	-disable-dynamic-vcaches     Disable the use of -stat value as the starting size of
+   *                          the size of the vcache/stat cache pool, 
+   *                          but increase that pool dynamically as needed.
    *	-debug	   Print out additional debugging info.
    *	-kerndev    [OBSOLETE] The kernel device for AFS.
    *	-dontfork   [OBSOLETE] Don't fork off as a new process.
***************
*** 58,64 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.43.2.25 2007/10/31 22:32:17 shadow Exp $");
  
  #define VFS 1
  
--- 61,67 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.43.2.26 2009/03/20 02:32:59 shadow Exp $");
  
  #define VFS 1
  
***************
*** 312,317 ****
--- 315,321 ----
  #ifdef notdef
  static int inodes = 60;		/* VERY conservative, but has to be */
  #endif
+ int afsd_dynamic_vcaches = 0;	/* Enable dynamic-vcache support */
  int afsd_verbose = 0;		/*Are we being chatty? */
  int afsd_debug = 0;		/*Are we printing debugging info? */
  int afsd_CloseSynch = 0;	/*Are closes synchronous or not? */
***************
*** 1736,1741 ****
--- 1740,1764 ----
  	}
      }
      
+     if (as->parms[34].items) {
+ #ifdef AFS_MAXVCOUNT_ENV
+        /* -disable-dynamic-vcaches */
+        afsd_dynamic_vcaches = FALSE;
+ #else
+        printf("afsd: Error toggling flag, dynamically allocated vcaches not supported on your platform\n");
+        exit(1);
+ #endif
+     }
+ #ifdef AFS_MAXVCOUNT_ENV
+     else {
+        /* -dynamic-vcaches */
+        afsd_dynamic_vcaches = TRUE;
+     }
+ 
+     if (afsd_verbose)
+     printf("afsd: %s dynamically allocated vcaches\n", ( afsd_dynamic_vcaches ? "enabling" : "disabling" ));
+ #endif
+ 
      /*
       * Pull out all the configuration info for the workstation's AFS cache and
       * the cellular community we're willing to let our users see.
***************
*** 2073,2078 ****
--- 2096,2102 ----
      cparams.chunkSize = chunkSize;
      cparams.setTimeFlag = cacheSetTime;
      cparams.memCacheFlag = cacheFlags;
+     cparams.dynamic_vcaches = afsd_dynamic_vcaches;
  #ifdef notdef
      cparams.inodes = inodes;
  #endif
***************
*** 2445,2450 ****
--- 2469,2475 ----
      cmd_AddParm(ts, "-settime", CMD_FLAG, CMD_OPTIONAL,
                 "set the time");
      cmd_AddParm(ts, "-rxpck", CMD_SINGLE, CMD_OPTIONAL, "set rx_extraPackets to this value");
+     cmd_AddParm(ts, "-disable-dynamic-vcaches", CMD_FLAG, CMD_OPTIONAL, "disable stat/vcache cache growing as needed");
      return (cmd_Dispatch(argc, argv));
  }
  
Index: openafs/src/aklog/Makefile.in
diff -c openafs/src/aklog/Makefile.in:1.1.2.12 openafs/src/aklog/Makefile.in:1.1.2.14
*** openafs/src/aklog/Makefile.in:1.1.2.12	Sat Jun 28 03:19:05 2008
--- openafs/src/aklog/Makefile.in	Tue Feb 17 17:06:11 2009
***************
*** 9,17 ****
  AKLIBS = ${LIBS} @KRB5LIBS@
  AFSLIBS = ${TOP_LIBDIR}/libprot.a ${TOP_LIBDIR}/libubik.a \
  	  ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/librxkad.a \
! 	  ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a \
! 	  ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/libdes.a \
! 	  ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/libafsutil.a
  
  SRCS=	aklog.c aklog_main.c  krb_util.c linked_list.c
  OBJS=   aklog.o aklog_main.o krb_util.o linked_list.o
--- 9,18 ----
  AKLIBS = ${LIBS} @KRB5LIBS@
  AFSLIBS = ${TOP_LIBDIR}/libprot.a ${TOP_LIBDIR}/libubik.a \
  	  ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/librxkad.a \
! 	  ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/librx.a \
! 	  ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libsys.a \
! 	  ${TOP_LIBDIR}/libdes.a ${TOP_LIBDIR}/libcom_err.a \
! 	  ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libafsutil.a 
  
  SRCS=	aklog.c aklog_main.c  krb_util.c linked_list.c
  OBJS=   aklog.o aklog_main.o krb_util.o linked_list.o
***************
*** 26,32 ****
  
  klog: klog.o skipwrap.o ${AFSLIBS}
  	${CC} -o $@ ${CFLAGS} skipwrap.o klog.o ${AKLIBS} ${AFSLIBS} \
! 		${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/librx.a ${XLIBS}
  
  #
  # Installation targets
--- 27,33 ----
  
  klog: klog.o skipwrap.o ${AFSLIBS}
  	${CC} -o $@ ${CFLAGS} skipwrap.o klog.o ${AKLIBS} ${AFSLIBS} \
! 		${XLIBS}
  
  #
  # Installation targets
Index: openafs/src/aklog/aklog_main.c
diff -c openafs/src/aklog/aklog_main.c:1.1.2.28 openafs/src/aklog/aklog_main.c:1.1.2.31
*** openafs/src/aklog/aklog_main.c:1.1.2.28	Wed Oct 29 15:44:10 2008
--- openafs/src/aklog/aklog_main.c	Sun Mar 15 14:02:52 2009
***************
*** 1,5 ****
  /* 
!  * $Id: aklog_main.c,v 1.1.2.28 2008/10/29 19:44:10 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
--- 1,5 ----
  /* 
!  * $Id: aklog_main.c,v 1.1.2.31 2009/03/15 18:02:52 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
***************
*** 36,42 ****
  
  #include <afsconfig.h>
  RCSID
!      ("$Header: /cvs/openafs/src/aklog/aklog_main.c,v 1.1.2.28 2008/10/29 19:44:10 shadow Exp $");
  #include <stdio.h>
  #include <string.h>
  #include <ctype.h>
--- 36,42 ----
  
  #include <afsconfig.h>
  RCSID
!      ("$Header: /cvs/openafs/src/aklog/aklog_main.c,v 1.1.2.31 2009/03/15 18:02:52 shadow Exp $");
  #include <stdio.h>
  #include <string.h>
  #include <ctype.h>
***************
*** 637,661 ****
  
  	if (! do524) {
  	    char *p;
  	    int len;
  
  	    if (dflag)
  	    	printf("Using Kerberos V5 ticket natively\n");
  
  	    len = min(get_princ_len(context, v5cred->client, 0),
! 	    	      second_comp(context, v5cred->client) ?
! 					MAXKTCNAMELEN - 2 : MAXKTCNAMELEN - 1);
  	    strncpy(username, get_princ_str(context, v5cred->client, 0), len);
  	    username[len] = '\0';
! 
  	    if (second_comp(context, v5cred->client)) {
! 	    	strcat(username, ".");
  		p = username + strlen(username);
  		len = min(get_princ_len(context, v5cred->client, 1),
  			  MAXKTCNAMELEN - strlen(username) - 1);
  		strncpy(p, get_princ_str(context, v5cred->client, 1), len);
  		p[len] = '\0';
  	    }
  
  	    memset(&atoken, 0, sizeof(atoken));
  	    atoken.kvno = RXKAD_TKT_TYPE_KERBEROS_V5;
--- 637,676 ----
  
  	if (! do524) {
  	    char *p;
+ 	    char k4name[ANAME_SZ], k4inst[INST_SZ], k4realm[REALM_SZ];
  	    int len;
  
  	    if (dflag)
  	    	printf("Using Kerberos V5 ticket natively\n");
  
+ #ifndef HAVE_NO_KRB5_524
+ 	    status = krb5_524_conv_principal (context, v5cred->client, &k4name, &k4inst, &k4realm);
+ 	    if (status) {
+ 		afs_com_err(progname, status, "while converting principal "
+ 			"to Kerberos V4 format");
+ 		return(AKLOG_KERBEROS);
+ 	    }
+ 	    strcpy (username, k4name);
+ 	    if (k4inst[0]) {
+ 		strcat (username, ".");
+ 		strcat (username, k4inst);
+ 	    }
+ #else
  	    len = min(get_princ_len(context, v5cred->client, 0),
! 		      second_comp(context, v5cred->client) ?
! 		      MAXKTCNAMELEN - 2 : MAXKTCNAMELEN - 1);
  	    strncpy(username, get_princ_str(context, v5cred->client, 0), len);
  	    username[len] = '\0';
! 	    
  	    if (second_comp(context, v5cred->client)) {
! 		strcat(username, ".");
  		p = username + strlen(username);
  		len = min(get_princ_len(context, v5cred->client, 1),
  			  MAXKTCNAMELEN - strlen(username) - 1);
  		strncpy(p, get_princ_str(context, v5cred->client, 1), len);
  		p[len] = '\0';
  	    }
+ #endif
  
  	    memset(&atoken, 0, sizeof(atoken));
  	    atoken.kvno = RXKAD_TKT_TYPE_KERBEROS_V5;
Index: openafs/src/audit/audit.c
diff -c openafs/src/audit/audit.c:1.8.2.12 openafs/src/audit/audit.c:1.8.2.16
*** openafs/src/audit/audit.c:1.8.2.12	Fri Oct 13 15:42:19 2006
--- openafs/src/audit/audit.c	Wed Mar 18 23:45:01 2009
***************
*** 11,21 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/audit/audit.c,v 1.8.2.12 2006/10/13 19:42:19 shadow Exp $");
  
  #include <fcntl.h>
  #include <stdarg.h>
  #include <string.h>
  #ifdef AFS_AIX32_ENV
  #include <sys/audit.h>
  #else
--- 11,28 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/audit/audit.c,v 1.8.2.16 2009/03/19 03:45:01 shadow Exp $");
  
  #include <fcntl.h>
  #include <stdarg.h>
  #include <string.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #ifndef AFS_NT40_ENV
+ #include <unistd.h>
+ #else
+ #include <io.h>
+ #endif
  #ifdef AFS_AIX32_ENV
  #include <sys/audit.h>
  #else
***************
*** 233,256 ****
  	    break;
  	case AUD_FIDS:		/* array of Fids */
  	    vaFids = va_arg(vaList, struct AFSCBFids *);
- 	    vaFid = NULL;
  
  	    if (vaFids) {
                  int i;
!                 if (vaFid)
                      fprintf(out, "FIDS %u FID %u:%u:%u ", vaFids->AFSCBFids_len, vaFid->Volume,
                               vaFid->Vnode, vaFid->Unique);
!                 else
                      fprintf(out, "FIDS 0 FID 0:0:0 ");
  
-                 for ( i = 1; i < vaFids->AFSCBFids_len; i++ ) {
-                     vaFid = vaFids->AFSCBFids_val;
-                     if (vaFid)
-                         fprintf(out, "FID %u:%u:%u ", vaFid->Volume,
-                                  vaFid->Vnode, vaFid->Unique);
-                     else
-                         fprintf(out, "FID 0:0:0 ");
-                 }
              }
  	    break;
  	default:
--- 240,260 ----
  	    break;
  	case AUD_FIDS:		/* array of Fids */
  	    vaFids = va_arg(vaList, struct AFSCBFids *);
  
  	    if (vaFids) {
                  int i;
!                 
!                 vaFid = vaFids->AFSCBFids_val;
!                 
!                 if (vaFid) {
                      fprintf(out, "FIDS %u FID %u:%u:%u ", vaFids->AFSCBFids_len, vaFid->Volume,
                               vaFid->Vnode, vaFid->Unique);
!                     for ( i = 1; i < vaFids->AFSCBFids_len; i++, vaFid++ ) 
!                         fprintf(out, "FID %u:%u:%u ", vaFid->Volume,
!                                 vaFid->Vnode, vaFid->Unique);
!                 } else
                      fprintf(out, "FIDS 0 FID 0:0:0 ");
  
              }
  	    break;
  	default:
***************
*** 447,458 ****
                      }
                      if ((clen = strlen(tcell))) {
  #if defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
!                         static char local_realm[AFS_REALM_SZ] = "";
!                         if (!local_realm[0]) {
!                             if (afs_krb_get_lrealm(local_realm, 0) != 0 /*KSUCCESS*/)
!                                 strncpy(local_realm, "UNKNOWN.LOCAL.REALM", AFS_REALM_SZ);
                          }
!                         if (strcasecmp(local_realm, tcell)) {
                              if (strlen(vname) + 1 + clen >= sizeof(vname))
                                  goto done;
                              strcat(vname, "@");
--- 451,493 ----
                      }
                      if ((clen = strlen(tcell))) {
  #if defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
!                         static char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ];
! 			static int  num_lrealms = -1;
! 			int i, lrealm_match;
! 
! 			if (num_lrealms == -1) {
! 			    for (i=0; i<AFS_NUM_LREALMS; i++) {
! 				if (afs_krb_get_lrealm(local_realms[i], i) != 0 /*KSUCCESS*/)
! 				    break;
! 			    }
! 
! 			    if (i == 0)
! 				strncpy(local_realms[0], "UNKNOWN.LOCAL.REALM", AFS_REALM_SZ);
! 			    num_lrealms = i;
                          }
! 
! 			/* Check to see if the ticket cell matches one of the local realms */
! 			lrealm_match = 0;
! 			for ( i=0;i<num_lrealms;i++ ) {
! 			    if (!strcasecmp(local_realms[i], tcell)) {
! 				lrealm_match = 1;
! 				break;
! 			    }
! 			}
! 			/* If yes, then make sure that the name is not present in 
!   			 * an exclusion list */
! 			if (lrealm_match) {
! 			    char uname[256];
! 			    if (inst[0])
! 				snprintf(uname,sizeof(uname),"%s.%s@%s",name,inst,tcell);
! 			    else
! 				snprintf(uname,sizeof(uname),"%s@%s",name,tcell);
! 
! 			    if (afs_krb_exclusion(uname))
! 				lrealm_match = 0;
! 			}
! 
! 			if (!lrealm_match) {	
                              if (strlen(vname) + 1 + clen >= sizeof(vname))
                                  goto done;
                              strcat(vname, "@");
***************
*** 527,534 ****
  }
  
  int
! osi_audit_file(FILE *out)
  {
!     auditout = out;
      return 0;
  }
--- 562,596 ----
  }
  
  int
! osi_audit_file(char *fileName)
  {
!     int tempfd, flags;
!     char oldName[MAXPATHLEN];
!     
! #ifndef AFS_NT40_ENV
!     struct stat statbuf;
!     
!     if ((lstat(fileName, &statbuf) == 0)
!         && (S_ISFIFO(statbuf.st_mode))) {
!         flags = O_WRONLY | O_NONBLOCK;
!     } else 
! #endif
!     {
!         strcpy(oldName, fileName);
!         strcat(oldName, ".old");
!         renamefile(fileName, oldName);
!         flags = O_WRONLY | O_TRUNC | O_CREAT;
!     }
!     tempfd = open(fileName, flags, 0666);
!     if (tempfd > -1) {
!         auditout = fdopen(tempfd, "a");
!         if (!auditout) {
!             printf("Warning: auditlog %s not writable, ignored.\n", fileName);
!             return 1;
!         }
!     } else { 
!         printf("Warning: auditlog %s not writable, ignored.\n", fileName);
!         return 1;
!     }
      return 0;
  }
Index: openafs/src/audit/audit.h
diff -c openafs/src/audit/audit.h:1.5.2.5 openafs/src/audit/audit.h:1.5.2.6
*** openafs/src/audit/audit.h:1.5.2.5	Mon Feb 13 12:56:49 2006
--- openafs/src/audit/audit.h	Wed Dec 17 13:16:25 2008
***************
*** 291,296 ****
  /* prototypes for audit functions */
  int osi_audit(char *audEvent, afs_int32 errCode, ...);
  int osi_auditU(struct rx_call *call, char *audEvent, int errCode, ...);
! int osi_audit_file(FILE *out);
  void osi_audit_init(void);
  
--- 291,296 ----
  /* prototypes for audit functions */
  int osi_audit(char *audEvent, afs_int32 errCode, ...);
  int osi_auditU(struct rx_call *call, char *audEvent, int errCode, ...);
! int osi_audit_file(char *filename);
  void osi_audit_init(void);
  
Index: openafs/src/auth/ktc.c
diff -c openafs/src/auth/ktc.c:1.15.2.10 openafs/src/auth/ktc.c:1.15.2.11
*** openafs/src/auth/ktc.c:1.15.2.10	Thu Dec 13 13:54:09 2007
--- openafs/src/auth/ktc.c	Fri Mar 20 18:45:37 2009
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/ktc.c,v 1.15.2.10 2007/12/13 18:54:09 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/ktc.c,v 1.15.2.11 2009/03/20 22:45:37 shadow Exp $");
  
  #if defined(UKERNEL)
  #include "afs/sysincludes.h"
***************
*** 56,64 ****
--- 56,66 ----
  #include <sys/lockf.h>
  #ifdef AFS_AIX51_ENV
  #include <sys/cred.h>
+ #ifdef HAVE_SYS_PAG_H
  #include <sys/pag.h>
  #endif
  #endif
+ #endif
  #ifdef HAVE_UNISTD_H
  #include <unistd.h>
  #endif
Index: openafs/src/auth/userok.c
diff -c openafs/src/auth/userok.c:1.12.2.3 openafs/src/auth/userok.c:1.12.2.4
*** openafs/src/auth/userok.c:1.12.2.3	Thu Feb 28 23:46:20 2008
--- openafs/src/auth/userok.c	Wed Mar 18 23:44:59 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/userok.c,v 1.12.2.3 2008/02/29 04:46:20 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/auth/userok.c,v 1.12.2.4 2009/03/19 03:44:59 shadow Exp $");
  
  #include <afs/stds.h>
  #include <afs/pthread_glock.h>
***************
*** 382,388 ****
  
  	afs_uint32 exp;
  	static char lcell[MAXCELLCHARS] = "";
! 	static char lrealm[AFS_REALM_SZ] = "";
  
  	/* get auth details from server connection */
  	code =
--- 382,390 ----
  
  	afs_uint32 exp;
  	static char lcell[MAXCELLCHARS] = "";
! 	static char lrealms[AFS_NUM_LREALMS][AFS_REALM_SZ];
! 	static int  num_lrealms = -1;
! 	int lrealm_match = 0, i;
  
  	/* get auth details from server connection */
  	code =
***************
*** 419,429 ****
  	/* if running a krb environment, also get the local realm */
  	/* note - this assumes AFS_REALM_SZ <= MAXCELLCHARS */
  	/* just set it to lcell if it fails */
! 	if (!lrealm[0]) {
! 	    if (afs_krb_get_lrealm(lrealm, 0) != 0)	/* KSUCCESS */
! 		strncpy(lrealm, lcell, AFS_REALM_SZ);
  	}
  
  
  	/* start with no uname and no authorization */
  	strcpy(uname, "");
--- 421,460 ----
  	/* if running a krb environment, also get the local realm */
  	/* note - this assumes AFS_REALM_SZ <= MAXCELLCHARS */
  	/* just set it to lcell if it fails */
! 	if (num_lrealms == -1) {
! 	    for (i=0; i<AFS_NUM_LREALMS; i++) {
! 		if (afs_krb_get_lrealm(lrealms[i], i) != 0 /*KSUCCESS*/)
! 		    break;
! 	    }
! 
! 	    if (i == 0) {
! 		strncpy(lrealms[0], lcell, AFS_REALM_SZ);
! 		num_lrealms = 1;
! 	    } else {
! 		num_lrealms = i;
! 	    }
  	}
  
+ 	/* See if the ticket cell matches one of the local realms */
+ 	lrealm_match = 0;
+ 	for ( i=0;i<num_lrealms;i++ ) {
+ 	    if (!strcasecmp(lrealms[i], tcell)) {
+ 		lrealm_match = 1;
+ 		break;
+ 	    }
+ 	}
+ 
+ 	/* If yes, then make sure that the name is not present in 
+ 	 * an exclusion list */
+ 	if (lrealm_match) {
+ 	    if (tinst[0])
+ 		snprintf(uname,sizeof(uname),"%s.%s@%s",tname,tinst,tcell);
+ 	    else
+ 		snprintf(uname,sizeof(uname),"%s@%s",tname,tcell);
+ 
+ 	    if (afs_krb_exclusion(uname))
+ 		lrealm_match = 0;
+ 	}
  
  	/* start with no uname and no authorization */
  	strcpy(uname, "");
***************
*** 435,442 ****
  	    strcpy(uname, "<LocalAuth>");
  	    flag = 1;
  
! 	    /* cell of connection matches local cell or krb4 realm */
! 	} else if (!strcasecmp(tcell, lcell) || !strcasecmp(tcell, lrealm)) {
  	    if ((tmp = CompFindUser(adir, tname, ".", tinst, NULL))) {
  		strcpy(uname, tmp);
  		flag = 1;
--- 466,473 ----
  	    strcpy(uname, "<LocalAuth>");
  	    flag = 1;
  
! 	    /* cell of connection matches local cell or one of the realms */
! 	} else if (!strcasecmp(tcell, lcell) || lrealm_match) {
  	    if ((tmp = CompFindUser(adir, tname, ".", tinst, NULL))) {
  		strcpy(uname, tmp);
  		flag = 1;
***************
*** 446,452 ****
  		flag = 1;
  #endif
  	    }
- 
  	    /* cell of conn doesn't match local cell or realm */
  	} else {
  	    if ((tmp = CompFindUser(adir, tname, ".", tinst, tcell))) {
--- 477,482 ----
Index: openafs/src/bozo/bnode.c
diff -c openafs/src/bozo/bnode.c:1.17.2.9 openafs/src/bozo/bnode.c:1.17.2.10
*** openafs/src/bozo/bnode.c:1.17.2.9	Mon Jun 30 16:31:41 2008
--- openafs/src/bozo/bnode.c	Mon Feb 16 23:32:30 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bnode.c,v 1.17.2.9 2008/06/30 20:31:41 rra Exp $");
  
  #include <stddef.h>
  #include <stdlib.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bnode.c,v 1.17.2.10 2009/02/17 04:32:30 shadow Exp $");
  
  #include <stddef.h>
  #include <stdlib.h>
***************
*** 147,153 ****
      TM_GetTimeOfDay(&Start, 0);
      TimeFields = localtime(&Start.tv_sec);
      sprintf(FileName, "%s.%d%02d%02d%02d%02d%02d", tbuffer,
! 	    TimeFields->tm_year, TimeFields->tm_mon + 1, TimeFields->tm_mday,
  	    TimeFields->tm_hour, TimeFields->tm_min, TimeFields->tm_sec);
      strcpy(tbuffer, FileName);
  #endif
--- 147,153 ----
      TM_GetTimeOfDay(&Start, 0);
      TimeFields = localtime(&Start.tv_sec);
      sprintf(FileName, "%s.%d%02d%02d%02d%02d%02d", tbuffer,
! 	    TimeFields->tm_year + 1900, TimeFields->tm_mon + 1, TimeFields->tm_mday,
  	    TimeFields->tm_hour, TimeFields->tm_min, TimeFields->tm_sec);
      strcpy(tbuffer, FileName);
  #endif
Index: openafs/src/bozo/bosserver.c
diff -c openafs/src/bozo/bosserver.c:1.23.2.17 openafs/src/bozo/bosserver.c:1.23.2.18
*** openafs/src/bozo/bosserver.c:1.23.2.17	Sat Oct 18 11:10:57 2008
--- openafs/src/bozo/bosserver.c	Wed Dec 17 13:16:27 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bosserver.c,v 1.23.2.17 2008/10/18 15:10:57 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bosserver.c,v 1.23.2.18 2008/12/17 18:16:27 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 841,874 ****
  	    }
  	}
  	else if (strcmp(argv[code], "-auditlog") == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++code];
  
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 	    
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	}
  	else {
  
--- 841,849 ----
  	    }
  	}
  	else if (strcmp(argv[code], "-auditlog") == 0) {
  	    char *fileName = argv[++code];
  
!             osi_audit_file(fileName);
  	}
  	else {
  
Index: openafs/src/bucoord/ubik_db_if.c
diff -c openafs/src/bucoord/ubik_db_if.c:1.10.2.2 openafs/src/bucoord/ubik_db_if.c:1.10.2.4
*** openafs/src/bucoord/ubik_db_if.c:1.10.2.2	Tue Apr 10 14:43:41 2007
--- openafs/src/bucoord/ubik_db_if.c	Thu Jan 22 14:33:26 2009
***************
*** 13,19 ****
  #include <afs/stds.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bucoord/ubik_db_if.c,v 1.10.2.2 2007/04/10 18:43:41 shadow Exp $");
  
  #include <sys/types.h>
  #include <fcntl.h>
--- 13,19 ----
  #include <afs/stds.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bucoord/ubik_db_if.c,v 1.10.2.4 2009/01/22 19:33:26 shadow Exp $");
  
  #include <sys/types.h>
  #include <fcntl.h>
***************
*** 44,50 ****
  afs_int32 bcdb_CreateDump(register struct budb_dumpEntry *) ;
  afs_int32 bcdb_deleteDump(afs_int32, afs_int32, afs_int32, budb_dumpsList *);
  /*note the pinter to the function comes from ubik/ubikclient ubik_Call function.*/
! afs_int32 bcdb_listDumps (int (), afs_int32,afs_int32,afs_int32, budb_dumpsList *,
   budb_dumpsList *);
  afs_int32 bcdb_DeleteVDP(char *, char *, afs_int32 );
  afs_int32 bcdb_FindClone(afs_int32, char *, afs_int32 *);
--- 44,50 ----
  afs_int32 bcdb_CreateDump(register struct budb_dumpEntry *) ;
  afs_int32 bcdb_deleteDump(afs_int32, afs_int32, afs_int32, budb_dumpsList *);
  /*note the pinter to the function comes from ubik/ubikclient ubik_Call function.*/
! afs_int32 bcdb_listDumps (afs_int32, afs_int32,afs_int32,afs_int32, budb_dumpsList *,
   budb_dumpsList *);
  afs_int32 bcdb_DeleteVDP(char *, char *, afs_int32 );
  afs_int32 bcdb_FindClone(afs_int32, char *, afs_int32 *);
***************
*** 109,115 ****
      return (code);
  }
  
! afs_int32 bcdb_listDumps (int (*sflags) (), afs_int32 groupId,afs_int32 fromTime, afs_int32 toTime,budb_dumpsList *dumps, budb_dumpsList *flags)
  {
      afs_int32 code, sflag = 0;
      budb_dumpsList dumpsList, *dumpsPtr;
--- 109,115 ----
      return (code);
  }
  
! afs_int32 bcdb_listDumps (afs_int32 sflags, afs_int32 groupId,afs_int32 fromTime, afs_int32 toTime,budb_dumpsList *dumps, budb_dumpsList *flags)
  {
      afs_int32 code, sflag = 0;
      budb_dumpsList dumpsList, *dumpsPtr;
Index: openafs/src/budb/server.c
diff -c openafs/src/budb/server.c:1.14.2.9 openafs/src/budb/server.c:1.14.2.11
*** openafs/src/budb/server.c:1.14.2.9	Mon Mar 10 18:35:34 2008
--- openafs/src/budb/server.c	Mon Dec 22 14:23:31 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/server.c,v 1.14.2.9 2008/03/10 22:35:34 shadow Exp $");
  
  #include <fcntl.h>
  #include <sys/stat.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/budb/server.c,v 1.14.2.11 2008/12/22 19:23:31 shadow Exp $");
  
  #include <fcntl.h>
  #include <sys/stat.h>
***************
*** 220,252 ****
  	ubik_nBuffers = 0;
  
      if (as->parms[7].items != 0) {
- 	int tempfd, flags;
- 	FILE *auditout;
- 	char oldName[MAXPATHLEN];
  	char *fileName = as->parms[7].items->data;
- #ifndef AFS_NT40_ENV
- 	struct stat statbuf;
  
! 	if ((lstat(fileName, &statbuf) == 0) 
! 	    && (S_ISFIFO(statbuf.st_mode))) {
! 	    flags = O_WRONLY | O_NONBLOCK;
! 	} else 
! #endif
! 	{
! 	    strcpy(oldName, fileName);
! 	    strcat(oldName, ".old");
! 	    renamefile(fileName, oldName);
! 	    flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	}
! 	tempfd = open(fileName, flags, 0666);
! 	if (tempfd > -1) {
! 	    auditout = fdopen(tempfd, "a");
! 	    if (auditout) {
! 		osi_audit_file(auditout);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	} else
! 	    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
      }
  
      return 0;
--- 220,228 ----
  	ubik_nBuffers = 0;
  
      if (as->parms[7].items != 0) {
  	char *fileName = as->parms[7].items->data;
  
!         osi_audit_file(fileName);
      }
  
      return 0;
***************
*** 535,541 ****
      code = ubik_ServerInitByInfo (globalConfPtr->myHost,
  				  htons(AFSCONF_BUDBPORT), 
  				  &cellinfo,
! 				  &clones,              
  				  dbNamePtr,           /* name prefix */
  				  &BU_dbase);
  
--- 511,517 ----
      code = ubik_ServerInitByInfo (globalConfPtr->myHost,
  				  htons(AFSCONF_BUDBPORT), 
  				  &cellinfo,
! 				  clones,              
  				  dbNamePtr,           /* name prefix */
  				  &BU_dbase);
  
Index: openafs/src/butc/afsxbsa.c
diff -c openafs/src/butc/afsxbsa.c:1.1.6.2 openafs/src/butc/afsxbsa.c:1.1.6.3
*** openafs/src/butc/afsxbsa.c:1.1.6.2	Tue Jul 15 06:33:57 2008
--- openafs/src/butc/afsxbsa.c	Mon Dec 15 17:21:37 2008
***************
*** 648,653 ****
--- 648,655 ----
  #endif
  #if defined(AFS_AIX_ENV)
          dynlib = dlopen("/usr/lib/libApiDS.a(dsmapish.o)", RTLD_NOW | RTLD_LOCAL | RTLD_MEMBER);
+ #elif defined (AFS_AMD64_LINUX26_ENV)
+ 	dynlib = dlopen("/usr/lib64/libApiTSM64.so", RTLD_NOW | RTLD_LOCAL);
  #elif defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV)
          dynlib = dlopen("/usr/lib/libApiDS.so", RTLD_NOW | RTLD_LOCAL);
  #else
Index: openafs/src/butc/dump.c
diff -c openafs/src/butc/dump.c:1.17.2.4 openafs/src/butc/dump.c:1.17.2.5
*** openafs/src/butc/dump.c:1.17.2.4	Thu May  1 20:59:48 2008
--- openafs/src/butc/dump.c	Sun Mar 15 14:19:37 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/dump.c,v 1.17.2.4 2008/05/02 00:59:48 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/butc/dump.c,v 1.17.2.5 2009/03/15 18:19:37 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 358,363 ****
--- 358,370 ----
  		}
  	    }
  
+ #ifdef xbsa
+ 	    /* Set aside space for the trailing volume header when using large buffers. */
+ 	    if (XBSAMAXBUFFER < toread + sizeof(hostVolumeHeader)) {
+ 		toread = XBSAMAXBUFFER - sizeof(hostVolumeHeader);
+ 	    }
+ #endif
+ 
  	    /* Read some volume data. */
  	    if (fragmentvolume) {
  		bytesread = 0;
Index: openafs/src/cf/kerberos.m4
diff -c openafs/src/cf/kerberos.m4:1.1.2.16 openafs/src/cf/kerberos.m4:1.1.2.18
*** openafs/src/cf/kerberos.m4:1.1.2.16	Fri Apr 18 16:50:28 2008
--- openafs/src/cf/kerberos.m4	Sat Mar 21 12:30:15 2009
***************
*** 1,5 ****
  dnl
! dnl $Id: kerberos.m4,v 1.1.2.16 2008/04/18 20:50:28 shadow Exp $
  dnl
  dnl Kerberos autoconf glue
  dnl
--- 1,5 ----
  dnl
! dnl $Id: kerberos.m4,v 1.1.2.18 2009/03/21 16:30:15 shadow Exp $
  dnl
  dnl Kerberos autoconf glue
  dnl
***************
*** 37,43 ****
  
  AC_ARG_WITH([krb5], [--with-krb5 Support for Kerberos 5 (manual configuration)])
  
! if test X$with_krb5 = Xyes; then
          if test X$conf_krb5 = XYES; then
  		AC_MSG_ERROR([--with-krb5-config and --with-krb5 are mutually exclusive, choose only one])
  	fi
--- 37,43 ----
  
  AC_ARG_WITH([krb5], [--with-krb5 Support for Kerberos 5 (manual configuration)])
  
! if test X$with_krb5 != X; then
          if test X$conf_krb5 = XYES; then
  		AC_MSG_ERROR([--with-krb5-config and --with-krb5 are mutually exclusive, choose only one])
  	fi
***************
*** 51,59 ****
--- 51,61 ----
  fi
  
  BUILD_KRB5=no
+ MAKE_KRB5=#
  if test X$conf_krb5 = XYES; then
  	AC_MSG_RESULT([Configuring support for Kerberos 5 utilities])
  	BUILD_KRB5=yes
+ 	MAKE_KRB5=
  	save_CPPFLAGS="$CPPFLAGS"
  	CPPFLAGS="$CPPFLAGS $KRB5CFLAGS"
  	save_LIBS="$LIBS"
***************
*** 122,127 ****
--- 124,130 ----
  fi
  
  AC_SUBST(BUILD_KRB5)
+ AC_SUBST(MAKE_KRB5)
  AC_SUBST(KRB5CFLAGS)
  AC_SUBST(KRB5LIBS)
  
Index: openafs/src/cf/linux-test1.m4
diff -c openafs/src/cf/linux-test1.m4:1.3.2.13 openafs/src/cf/linux-test1.m4:1.3.2.14
*** openafs/src/cf/linux-test1.m4:1.3.2.13	Sun Oct 12 14:02:37 2008
--- openafs/src/cf/linux-test1.m4	Sat Feb 21 10:37:01 2009
***************
*** 29,35 ****
  _ACEOF
      echo make -C $LINUX_KERNEL_BUILD M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD &&
      make -C $LINUX_KERNEL_BUILD M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD 2>conftest.err &&
!     ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
      then [$3]
      else
        sed '/^ *+/d' conftest.err >&AS_MESSAGE_LOG_FD
--- 29,35 ----
  _ACEOF
      echo make -C $LINUX_KERNEL_BUILD M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD &&
      make -C $LINUX_KERNEL_BUILD M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD 2>conftest.err &&
!     ! grep -i "WARNING: .* undefined!$" conftest.err >/dev/null 2>&1
      then [$3]
      else
        sed '/^ *+/d' conftest.err >&AS_MESSAGE_LOG_FD
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.20.2.51 openafs/src/cf/linux-test4.m4:1.20.2.58
*** openafs/src/cf/linux-test4.m4:1.20.2.51	Sat Nov  8 11:49:58 2008
--- openafs/src/cf/linux-test4.m4	Mon Mar 23 11:17:01 2009
***************
*** 772,789 ****
  AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [
    AC_MSG_CHECKING([if key_alloc() takes a struct task *])
    AC_CACHE_VAL([ac_cv_key_alloc_needs_struct_task], [
      AC_TRY_KBUILD(
  [#include <linux/rwsem.h>
  #include <linux/key.h>
  ],
! [(void) key_alloc(NULL, NULL, 0, 0, NULL, 0, 0);],
        ac_cv_key_alloc_needs_struct_task=yes,
!       ac_cv_key_alloc_needs_struct_task=no)])
    AC_MSG_RESULT($ac_cv_key_alloc_needs_struct_task)
    if test "x$ac_cv_key_alloc_needs_struct_task" = "xyes"; then
      AC_DEFINE([KEY_ALLOC_NEEDS_STRUCT_TASK], 1, [define if key_alloc takes a struct task *])
    fi])
  
  AC_DEFUN([LINUX_DO_SYNC_READ], [
    AC_MSG_CHECKING([for linux do_sync_read()])
    AC_CACHE_VAL([ac_cv_linux_do_sync_read], [
--- 772,812 ----
  AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [
    AC_MSG_CHECKING([if key_alloc() takes a struct task *])
    AC_CACHE_VAL([ac_cv_key_alloc_needs_struct_task], [
+     save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS -Werror"
      AC_TRY_KBUILD(
  [#include <linux/rwsem.h>
  #include <linux/key.h>
  ],
! [struct task_struct *t=NULL;
! (void) key_alloc(NULL, NULL, 0, 0, t, 0, 0);],
        ac_cv_key_alloc_needs_struct_task=yes,
!       ac_cv_key_alloc_needs_struct_task=no)
!     CPPFLAGS="$save_CPPFLAGS"])
    AC_MSG_RESULT($ac_cv_key_alloc_needs_struct_task)
    if test "x$ac_cv_key_alloc_needs_struct_task" = "xyes"; then
      AC_DEFINE([KEY_ALLOC_NEEDS_STRUCT_TASK], 1, [define if key_alloc takes a struct task *])
    fi])
  
+ AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_CRED], [
+   AC_MSG_CHECKING([if key_alloc() takes credentials])
+   AC_CACHE_VAL([ac_cv_key_alloc_needs_cred], [
+     save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS -Werror"
+     AC_TRY_KBUILD(
+ [#include <linux/rwsem.h>
+ #include <linux/key.h>
+ ],
+ [struct cred *c = NULL;
+ (void) key_alloc(NULL, NULL, 0, 0, c, 0, 0);],
+       ac_cv_key_alloc_needs_cred=yes,
+       ac_cv_key_alloc_needs_cred=no)
+     CPPFLAGS="$save_CPPFLAGS"])
+   AC_MSG_RESULT($ac_cv_key_alloc_needs_cred)
+   if test "x$ac_cv_key_alloc_needs_cred" = "xyes"; then
+     AC_DEFINE([KEY_ALLOC_NEEDS_CRED], 1, [define if key_alloc takes credentials])
+   fi])
+ 
  AC_DEFUN([LINUX_DO_SYNC_READ], [
    AC_MSG_CHECKING([for linux do_sync_read()])
    AC_CACHE_VAL([ac_cv_linux_do_sync_read], [
***************
*** 816,821 ****
--- 839,860 ----
      AC_DEFINE([GENERIC_FILE_AIO_READ], 1, [define if your kernel has generic_file_aio_read()])
    fi])
  
+ AC_DEFUN([LINUX_HAVE_I_SIZE_READ], [
+   AC_MSG_CHECKING([for linux i_size_read()])
+   AC_CACHE_VAL([ac_cv_linux_i_size_read], [
+     save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
+     AC_TRY_KBUILD(
+ [#include <linux/fs.h>],
+ [i_size_read(NULL);],
+       ac_cv_linux_i_size_read=yes,
+       ac_cv_linux_i_size_read=no)
+     CPPFLAGS="$save_CPPFLAGS"])
+   AC_MSG_RESULT($ac_cv_linux_i_size_read)
+   if test "x$ac_cv_linux_i_size_read" = "xyes"; then
+     AC_DEFINE([HAVE_LINUX_I_SIZE_READ], 1, [define if your kernel has i_size_read()])
+   fi])
+ 
  AC_DEFUN([LINUX_FREEZER_H_EXISTS], [
    AC_MSG_CHECKING([for linux/freezer.h existance])
    AC_CACHE_VAL([ac_cv_linux_freezer_h_exists], [
***************
*** 1045,1050 ****
--- 1084,1102 ----
      AC_DEFINE([LINUX_SEMAPHORE_H], 1, [define if linux/semaphore.h exists])
    fi])
  
+ AC_DEFUN([LINUX_HAVE_BDI_INIT], [
+   AC_MSG_CHECKING([for linux bdi_init()])
+   AC_CACHE_VAL([ac_cv_linux_bdi_init], [
+     AC_TRY_KBUILD(
+ [#include <linux/backing-dev.h>],
+ [bdi_init(NULL);],
+       ac_cv_linux_bdi_init=yes,
+       ac_cv_linux_bdi_init=no)])
+   AC_MSG_RESULT($ac_cv_linux_bdi_init)
+   if test "x$ac_cv_linux_bdi_init" = "xyes"; then
+     AC_DEFINE([HAVE_BDI_INIT], 1, [define if your kernel has a bdi_init()])
+   fi])
+ 
  AC_DEFUN([LINUX_HAVE_WRITE_BEGIN_AOP], [
    AC_MSG_CHECKING([for linux write_begin() address space op])
    AC_CACHE_VAL([ac_cv_linux_write_begin], [
***************
*** 1057,1059 ****
--- 1109,1140 ----
    if test "x$ac_cv_linux_write_begin" = "xyes"; then
      AC_DEFINE([HAVE_WRITE_BEGIN], 1, [define if your kernel has a write_begin() address space op])
    fi])
+ 
+ AC_DEFUN([LINUX_HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN], [
+   AC_MSG_CHECKING([for linux grab_cache_page_write_begin()])
+   AC_CACHE_VAL([ac_cv_linux_grab_cache_page_write_begin], [
+     AC_TRY_KBUILD(
+ [#include <linux/pagemap.h>],
+ [grab_cache_page_write_begin(NULL, 0, 0);],
+       ac_cv_linux_grab_cache_page_write_begin=yes,
+       ac_cv_linux_grab_cache_page_write_begin=no)])
+   AC_MSG_RESULT($ac_cv_linux_grab_cache_page_write_begin)
+   if test "x$ac_cv_linux_grab_cache_page_write_begin" = "xyes"; then
+     AC_DEFINE([HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN], 1, [define if your kernel has grab_cache_page_write_begin()])
+   fi])
+ 
+ AC_DEFUN([LINUX_STRUCT_TASK_HAS_CRED], [
+   AC_MSG_CHECKING([if struct task has cred])
+   AC_CACHE_VAL([ac_cv_linux_struct_task_has_cred], [
+     AC_TRY_KBUILD(
+ [#include <linux/sched.h>
+ #include <linux/cred.h>],
+ [struct task_struct _t;
+ uid_t _u;
+ _u =_t.cred->uid ;],
+       ac_cv_linux_struct_task_has_cred=yes,
+       ac_cv_linux_struct_task_has_cred=no)])
+   AC_MSG_RESULT($ac_cv_linux_struct_task_has_cred)
+   if test "x$ac_cv_linux_struct_task_has_cred" = "xyes"; then
+     AC_DEFINE([STRUCT_TASK_HAS_CRED], 1, [define if struct task has a cred pointer])
+   fi])
Index: openafs/src/cf/osconf.m4
diff -c openafs/src/cf/osconf.m4:1.51.2.38 openafs/src/cf/osconf.m4:1.51.2.40
*** openafs/src/cf/osconf.m4:1.51.2.38	Wed Sep  3 14:27:39 2008
--- openafs/src/cf/osconf.m4	Mon Dec 29 12:29:30 2008
***************
*** 234,240 ****
  		SHLIB_LINKER="ld -b"
  		;;
  
! 	*fbsd_*)
  		LEX="flex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-pthread"
--- 234,240 ----
  		SHLIB_LINKER="ld -b"
  		;;
  
! 	i386_fbsd_*)
  		LEX="flex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-pthread"
***************
*** 246,251 ****
--- 246,263 ----
  		YACC="byacc"
  		;;
  
+ 	amd64_fbsd_*)
+ 		LEX="flex -l"
+ 		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
+ 		MT_LIBS="-pthread"
+ 		PAM_CFLAGS="-O2 -pipe -fPIC"
+ 		SHLIB_LDFLAGS="-shared -Xlinker -x"
+ 		SHLIB_LINKER="${MT_CC} -shared"
+ 		TXLIBS="-lncurses"
+ 		XCFLAGS="-O2 -pipe -fPIC"
+ 		YACC="byacc"
+ 		;;
+ 
  	*nbsd2*|*nbsd3*|*nbsd4*)
  		LEX="flex -l"
  		MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -D_REENTRANT '
***************
*** 474,480 ****
  		;;
  
  	ppc_darwin_70)
! 		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration"
  		LEX="lex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}'
  		KROOT=
--- 486,492 ----
  		;;
  
  	ppc_darwin_70)
! 		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
  		LEX="lex -l"
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}'
  		KROOT=
Index: openafs/src/cf/socklen.m4
diff -c /dev/null openafs/src/cf/socklen.m4:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:17 2009
--- openafs/src/cf/socklen.m4	Fri Mar 20 09:53:09 2009
***************
*** 0 ****
--- 1,18 ----
+ AC_DEFUN([AC_TYPE_SOCKLEN_T],
+ [
+ AC_CACHE_CHECK([for socklen_t], 
+ ac_cv_type_socklen_t, [
+         AC_TRY_COMPILE([
+                       #include <sys/types.h>
+                       #include <sys/socket.h>
+               ],
+               [
+                       socklen_t len = 42; return 0;
+               ],
+               ac_cv_type_socklen_t="yes", ac_cv_type_socklen_t="no")
+         ])
+ 
+         if test "x$ac_cv_type_socklen_t" = "xno"; then
+               AC_DEFINE(socklen_t, int, [the type of the last argument to getsockopt etc])
+         fi
+ ])
Index: openafs/src/config/afs_args.h
diff -c openafs/src/config/afs_args.h:1.13.2.9 openafs/src/config/afs_args.h:1.13.2.10
*** openafs/src/config/afs_args.h:1.13.2.9	Wed Jan 30 16:37:35 2008
--- openafs/src/config/afs_args.h	Thu Mar 19 22:32:59 2009
***************
*** 141,146 ****
--- 141,147 ----
      afs_int32 memCacheFlag;
      afs_int32 inodes;
      afs_int32 users;
+     afs_int32 dynamic_vcaches;
  };
  
  /*
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.50.2.31 openafs/src/config/afs_sysnames.h:1.50.2.33
*** openafs/src/config/afs_sysnames.h:1.50.2.31	Wed Sep  3 14:27:39 2008
--- openafs/src/config/afs_sysnames.h	Wed Mar 18 23:45:02 2009
***************
*** 187,193 ****
  #define SYS_NAME_ID_i386_fbsd_61        2113
  #define SYS_NAME_ID_i386_fbsd_62        2114
  #define SYS_NAME_ID_i386_fbsd_70        2115
! #define SYS_NAME_ID_i386_fbsd_80        2116
  
  #define SYS_NAME_ID_ia64_linux2		2200
  #define SYS_NAME_ID_ia64_linux22	2201
--- 187,194 ----
  #define SYS_NAME_ID_i386_fbsd_61        2113
  #define SYS_NAME_ID_i386_fbsd_62        2114
  #define SYS_NAME_ID_i386_fbsd_70        2115
! #define SYS_NAME_ID_i386_fbsd_71        2116
! #define SYS_NAME_ID_i386_fbsd_80        2117
  
  #define SYS_NAME_ID_ia64_linux2		2200
  #define SYS_NAME_ID_ia64_linux22	2201
***************
*** 262,267 ****
--- 263,271 ----
  #define SYS_NAME_ID_ppc64_linux26	2903
  
  #define SYS_NAME_ID_amd64_fbsd_53        3008
+ #define SYS_NAME_ID_amd64_fbsd_70        3009
+ #define SYS_NAME_ID_amd64_fbsd_71        3010
+ #define SYS_NAME_ID_amd64_fbsd_80        3011
  
  #define SYS_NAME_ID_amd64_w2k           3400
  
***************
*** 295,298 ****
--- 299,304 ----
  #ifdef	AFS_KERBREALM_ENV
  #define	AFS_REALM_SZ		64
  #endif
+ /* Specifies the number of equivalent local realm names */
+ #define AFS_NUM_LREALMS         4
  #endif /* __AFS_SYSNAMES_INCL_ENV_ */
Index: openafs/src/config/param.alpha_linux_22.h
diff -c openafs/src/config/param.alpha_linux_22.h:1.5.2.3 openafs/src/config/param.alpha_linux_22.h:1.5.2.4
*** openafs/src/config/param.alpha_linux_22.h:1.5.2.3	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.alpha_linux_22.h	Thu Mar 19 22:32:59 2009
***************
*** 28,33 ****
--- 28,34 ----
  
  #define AFS_64BIT_ENV          1	/* Defines afs_int32 as int, not long. */
  #define AFS_64BITPOINTER_ENV   1	/* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  #ifdef CONFIG_SMP
Index: openafs/src/config/param.alpha_linux_24.h
diff -c openafs/src/config/param.alpha_linux_24.h:1.5.2.4 openafs/src/config/param.alpha_linux_24.h:1.5.2.5
*** openafs/src/config/param.alpha_linux_24.h:1.5.2.4	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.alpha_linux_24.h	Thu Mar 19 22:32:59 2009
***************
*** 30,35 ****
--- 30,36 ----
  
  #define AFS_64BIT_ENV          1	/* Defines afs_int32 as int, not long. */
  #define AFS_64BITPOINTER_ENV   1	/* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  #ifdef CONFIG_SMP
Index: openafs/src/config/param.alpha_linux_26.h
diff -c openafs/src/config/param.alpha_linux_26.h:1.1.2.6 openafs/src/config/param.alpha_linux_26.h:1.1.2.8
*** openafs/src/config/param.alpha_linux_26.h:1.1.2.6	Mon Jun 30 16:52:22 2008
--- openafs/src/config/param.alpha_linux_26.h	Thu Mar 19 23:12:39 2009
***************
*** 33,39 ****
  #define AFS_64BIT_ENV          1
  #define AFS_64BIT_CLIENT       1
  #define AFS_64BITPOINTER_ENV   1       /* pointers are 64 bits */
! 
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
--- 33,39 ----
  #define AFS_64BIT_ENV          1
  #define AFS_64BIT_CLIENT       1
  #define AFS_64BITPOINTER_ENV   1       /* pointers are 64 bits */
! #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 104,109 ****
--- 104,110 ----
  #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	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.amd64_fbsd_70.h
diff -c /dev/null openafs/src/config/param.amd64_fbsd_70.h:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:17 2009
--- openafs/src/config/param.amd64_fbsd_70.h	Mon Dec 15 15:38:21 2008
***************
*** 0 ****
--- 1,213 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"amd64_fbsd_70"
+ #define SYS_NAME_ID	SYS_NAME_ID_amd64_fbsd_70
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_FBSD60_ENV 1
+ #define AFS_FBSD61_ENV 1
+ #define AFS_FBSD62_ENV 1
+ #define AFS_FBSD70_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
+ #define AFS_X86_FBSD62_ENV 1
+ #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD60_ENV	1
+ #define AFS_USR_FBSD61_ENV	1
+ #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.amd64_fbsd_71.h
diff -c /dev/null openafs/src/config/param.amd64_fbsd_71.h:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:17 2009
--- openafs/src/config/param.amd64_fbsd_71.h	Mon Dec 15 15:38:21 2008
***************
*** 0 ****
--- 1,216 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"amd64_fbsd_71"
+ #define SYS_NAME_ID	SYS_NAME_ID_amd64_fbsd_71
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_FBSD60_ENV 1
+ #define AFS_FBSD61_ENV 1
+ #define AFS_FBSD62_ENV 1
+ #define AFS_FBSD70_ENV 1
+ #define AFS_FBSD71_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
+ #define AFS_X86_FBSD62_ENV 1
+ #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_FBSD71_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD60_ENV	1
+ #define AFS_USR_FBSD61_ENV	1
+ #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD71_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.amd64_fbsd_80.h
diff -c /dev/null openafs/src/config/param.amd64_fbsd_80.h:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:17 2009
--- openafs/src/config/param.amd64_fbsd_80.h	Mon Dec 15 15:38:22 2008
***************
*** 0 ****
--- 1,219 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"amd64_fbsd_80"
+ #define SYS_NAME_ID	SYS_NAME_ID_amd64_fbsd_80
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BITPOINTER_ENV 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_FBSD60_ENV 1
+ #define AFS_FBSD61_ENV 1
+ #define AFS_FBSD62_ENV 1
+ #define AFS_FBSD70_ENV 1
+ #define AFS_FBSD71_ENV 1
+ #define AFS_FBSD80_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
+ #define AFS_X86_FBSD62_ENV 1
+ #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_FBSD71_ENV 1
+ #define AFS_X86_FBSD80_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD60_ENV	1
+ #define AFS_USR_FBSD61_ENV	1
+ #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD71_ENV	1
+ #define AFS_USR_FBSD80_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BITPOINTER_ENV  1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.amd64_linux24.h
diff -c openafs/src/config/param.amd64_linux24.h:1.3.2.5 openafs/src/config/param.amd64_linux24.h:1.3.2.7
*** openafs/src/config/param.amd64_linux24.h:1.3.2.5	Tue Feb 13 14:12:46 2007
--- openafs/src/config/param.amd64_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 39,44 ****
--- 39,45 ----
  #define AFS_64BIT_CLIENT	1
  
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 125,130 ****
--- 126,132 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 183
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.amd64_linux26.h
diff -c openafs/src/config/param.amd64_linux26.h:1.1.2.6 openafs/src/config/param.amd64_linux26.h:1.1.2.8
*** openafs/src/config/param.amd64_linux26.h:1.1.2.6	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.amd64_linux26.h	Thu Mar 19 23:12:39 2009
***************
*** 29,34 ****
--- 29,35 ----
  #define AFS_64BIT_ENV		1
  #define AFS_64BIT_CLIENT	1
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 107,112 ****
--- 108,114 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 183
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.arm_linux24.h
diff -c openafs/src/config/param.arm_linux24.h:1.1.4.2 openafs/src/config/param.arm_linux24.h:1.1.4.3
*** openafs/src/config/param.arm_linux24.h:1.1.4.2	Tue Jan 15 00:14:02 2008
--- openafs/src/config/param.arm_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 108,113 ****
--- 108,114 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #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>
  
Index: openafs/src/config/param.arm_linux26.h
diff -c openafs/src/config/param.arm_linux26.h:1.1.4.4 openafs/src/config/param.arm_linux26.h:1.1.4.5
*** openafs/src/config/param.arm_linux26.h:1.1.4.4	Wed Feb 27 17:31:39 2008
--- openafs/src/config/param.arm_linux26.h	Thu Mar 19 23:12:39 2009
***************
*** 113,118 ****
--- 113,119 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #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>
  
Index: openafs/src/config/param.hp_ux110.h
diff -c openafs/src/config/param.hp_ux110.h:1.9.2.1 openafs/src/config/param.hp_ux110.h:1.9.2.2
*** openafs/src/config/param.hp_ux110.h:1.9.2.1	Mon Mar 10 12:25:26 2008
--- openafs/src/config/param.hp_ux110.h	Thu Mar 19 23:12:39 2009
***************
*** 123,128 ****
--- 123,129 ----
  #define AFS_GREEDY43_ENV	1	/* Used only in rx/rx_user.c */
  #define AFS_ENV			1
  #define AFS_USR_HPUX_ENV    	1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.hp_ux11i.h
diff -c openafs/src/config/param.hp_ux11i.h:1.4.2.2 openafs/src/config/param.hp_ux11i.h:1.4.2.3
*** openafs/src/config/param.hp_ux11i.h:1.4.2.2	Mon Mar 10 12:25:26 2008
--- openafs/src/config/param.hp_ux11i.h	Thu Mar 19 23:12:39 2009
***************
*** 126,131 ****
--- 126,132 ----
  #define AFS_GREEDY43_ENV	1	/* Used only in rx/rx_user.c */
  #define AFS_ENV			1
  #define AFS_USR_HPUX_ENV    	1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.i386_fbsd_71.h
diff -c /dev/null openafs/src/config/param.i386_fbsd_71.h:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:17 2009
--- openafs/src/config/param.i386_fbsd_71.h	Mon Dec 15 15:38:22 2008
***************
*** 0 ****
--- 1,214 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"i386_fbsd_71"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_71
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include <sys/param.h>
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_FBSD60_ENV 1
+ #define AFS_FBSD61_ENV 1
+ #define AFS_FBSD62_ENV 1
+ #define AFS_FBSD70_ENV 1
+ #define AFS_FBSD71_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
+ #define AFS_X86_FBSD62_ENV 1
+ #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_FBSD71_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&ip->i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&ip->i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) < (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) > (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD60_ENV	1
+ #define AFS_USR_FBSD61_ENV	1
+ #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD71_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <limits.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ /* general user-space compiles */
+ 
+ #if defined(UKERNEL) || !defined(KERNEL)
+ #define STDLIB_HAS_MALLOC_PROTOS 1
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.i386_fbsd_80.h
diff -c openafs/src/config/param.i386_fbsd_80.h:1.1.2.2 openafs/src/config/param.i386_fbsd_80.h:1.1.2.3
*** openafs/src/config/param.i386_fbsd_80.h:1.1.2.2	Tue Aug 26 10:02:15 2008
--- openafs/src/config/param.i386_fbsd_80.h	Mon Dec 15 15:38:22 2008
***************
*** 41,46 ****
--- 41,47 ----
  #define AFS_FBSD61_ENV 1
  #define AFS_FBSD62_ENV 1
  #define AFS_FBSD70_ENV 1
+ #define AFS_FBSD71_ENV 1
  #define AFS_FBSD80_ENV 1
  #define AFS_X86_FBSD_ENV 1
  #define AFS_X86_FBSD40_ENV 1
***************
*** 52,57 ****
--- 53,59 ----
  #define AFS_X86_FBSD60_ENV 1 /* added at 70--ie, some changes should port <-- */
  #define AFS_X86_FBSD62_ENV 1
  #define AFS_X86_FBSD70_ENV 1
+ #define AFS_X86_FBSD71_ENV 1
  #define AFS_X86_FBSD80_ENV 1
  #define AFS_X86_ENV 1
  #define AFS_NONFSTRANS 1
***************
*** 162,167 ****
--- 164,170 ----
  #define AFS_USR_FBSD60_ENV	1
  #define AFS_USR_FBSD61_ENV	1
  #define AFS_USR_FBSD70_ENV	1
+ #define AFS_USR_FBSD71_ENV	1
  #define AFS_USR_FBSD80_ENV	1
  #define AFS_USR_FBSD_ENV	1
  #define AFS_NONFSTRANS 1
Index: openafs/src/config/param.i386_linux22.h
diff -c openafs/src/config/param.i386_linux22.h:1.15.2.3 openafs/src/config/param.i386_linux22.h:1.15.2.4
*** openafs/src/config/param.i386_linux22.h:1.15.2.3	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.i386_linux22.h	Thu Mar 19 22:32:59 2009
***************
*** 30,35 ****
--- 30,36 ----
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  #ifdef CONFIG_SMP
Index: openafs/src/config/param.i386_linux24.h
diff -c openafs/src/config/param.i386_linux24.h:1.19.2.4 openafs/src/config/param.i386_linux24.h:1.19.2.6
*** openafs/src/config/param.i386_linux24.h:1.19.2.4	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.i386_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 25,30 ****
--- 25,31 ----
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #define AFS_64BIT_ENV		1
  #define AFS_64BIT_CLIENT	1
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 111,116 ****
--- 112,118 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.i386_linux26.h
diff -c openafs/src/config/param.i386_linux26.h:1.3.2.7 openafs/src/config/param.i386_linux26.h:1.3.2.9
*** openafs/src/config/param.i386_linux26.h:1.3.2.7	Sat Mar 22 20:54:03 2008
--- openafs/src/config/param.i386_linux26.h	Thu Mar 19 23:12:39 2009
***************
*** 27,32 ****
--- 27,33 ----
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #define AFS_64BIT_ENV		1
  #define AFS_64BIT_CLIENT	1
+ #define AFS_MAXVCOUNT_ENV       1
  
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
***************
*** 119,124 ****
--- 120,126 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.i386_umlinux22.h
diff -c openafs/src/config/param.i386_umlinux22.h:1.2.2.3 openafs/src/config/param.i386_umlinux22.h:1.2.2.4
*** openafs/src/config/param.i386_umlinux22.h:1.2.2.3	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.i386_umlinux22.h	Thu Mar 19 22:32:59 2009
***************
*** 32,37 ****
--- 32,38 ----
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  #ifdef CONFIG_SMP
Index: openafs/src/config/param.i386_umlinux24.h
diff -c openafs/src/config/param.i386_umlinux24.h:1.2.2.4 openafs/src/config/param.i386_umlinux24.h:1.2.2.6
*** openafs/src/config/param.i386_umlinux24.h:1.2.2.4	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.i386_umlinux24.h	Thu Mar 19 23:12:39 2009
***************
*** 28,33 ****
--- 28,34 ----
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #define AFS_64BIT_ENV		1
  #define AFS_64BIT_CLIENT	1
+ #define AFS_MAXVCOUNT_ENV       1
  
  #ifdef AFS_LARGEFILE_ENV
  #define _FILE_OFFSET_BITS	64
***************
*** 112,117 ****
--- 113,119 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #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>
  
Index: openafs/src/config/param.i386_umlinux26.h
diff -c openafs/src/config/param.i386_umlinux26.h:1.1.2.5 openafs/src/config/param.i386_umlinux26.h:1.1.2.7
*** openafs/src/config/param.i386_umlinux26.h:1.1.2.5	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.i386_umlinux26.h	Thu Mar 19 23:12:39 2009
***************
*** 27,32 ****
--- 27,33 ----
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #define AFS_64BIT_ENV		1
  #define AFS_64BIT_CLIENT	1
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 113,118 ****
--- 114,120 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #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>
  
Index: openafs/src/config/param.ia64_linux24.h
diff -c openafs/src/config/param.ia64_linux24.h:1.9.2.5 openafs/src/config/param.ia64_linux24.h:1.9.2.7
*** openafs/src/config/param.ia64_linux24.h:1.9.2.5	Tue Apr  3 15:31:27 2007
--- openafs/src/config/param.ia64_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 39,44 ****
--- 39,45 ----
  #define AFS_64BIT_CLIENT	1	
  
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 125,130 ****
--- 126,132 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 1141
  #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>
  
Index: openafs/src/config/param.ia64_linux26.h
diff -c openafs/src/config/param.ia64_linux26.h:1.1.2.7 openafs/src/config/param.ia64_linux26.h:1.1.2.9
*** openafs/src/config/param.ia64_linux26.h:1.1.2.7	Tue Apr  3 15:31:27 2007
--- openafs/src/config/param.ia64_linux26.h	Thu Mar 19 23:12:39 2009
***************
*** 41,46 ****
--- 41,47 ----
  #define AFS_64BIT_CLIENT	1	
  
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  #include <linux/init.h>
***************
*** 135,140 ****
--- 136,142 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 1141
  #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>
  
Index: openafs/src/config/param.parisc_linux24.h
diff -c openafs/src/config/param.parisc_linux24.h:1.7.2.4 openafs/src/config/param.parisc_linux24.h:1.7.2.6
*** openafs/src/config/param.parisc_linux24.h:1.7.2.4	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.parisc_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 23,28 ****
--- 23,29 ----
  #define AFS_64BIT_CLIENT  1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 96,101 ****
--- 97,103 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #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>
  
Index: openafs/src/config/param.ppc64_linux24.h
diff -c openafs/src/config/param.ppc64_linux24.h:1.2.2.5 openafs/src/config/param.ppc64_linux24.h:1.2.2.7
*** openafs/src/config/param.ppc64_linux24.h:1.2.2.5	Wed Jun  6 13:33:50 2007
--- openafs/src/config/param.ppc64_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 27,32 ****
--- 27,33 ----
  #define AFS_64BIT_CLIENT	1
  
  #define AFS_64BITPOINTER_ENV   1     /* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 117,122 ****
--- 118,124 ----
  #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.ppc64_linux26.h
diff -c openafs/src/config/param.ppc64_linux26.h:1.1.2.6 openafs/src/config/param.ppc64_linux26.h:1.1.2.8
*** openafs/src/config/param.ppc64_linux26.h:1.1.2.6	Wed Jun  6 13:33:50 2007
--- openafs/src/config/param.ppc64_linux26.h	Thu Mar 19 23:12:39 2009
***************
*** 29,34 ****
--- 29,35 ----
  #define AFS_64BIT_CLIENT	1
  
  #define AFS_64BITPOINTER_ENV   1     /* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 119,124 ****
--- 120,126 ----
  #define AFS_MOUNT_AFS "afs"    /* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.ppc_darwin_70.h
diff -c openafs/src/config/param.ppc_darwin_70.h:1.4.2.2 openafs/src/config/param.ppc_darwin_70.h:1.4.2.3
*** openafs/src/config/param.ppc_darwin_70.h:1.4.2.2	Tue Nov 29 00:02:24 2005
--- openafs/src/config/param.ppc_darwin_70.h	Mon Dec 29 12:29:31 2008
***************
*** 6,12 ****
  
  #define AFS_ENV                 1
  #define AFS_64BIT_ENV           1	/* Defines afs_int32 as int, not long. */
- #define AFS_64BIT_CLIENT        1
  #define AFS_64BIT_IOPS_ENV 1
  #define AFS_PPC_ENV 1
  #define AFS_VFSINCL_ENV 1
--- 6,11 ----
Index: openafs/src/config/param.ppc_linux22.h
diff -c openafs/src/config/param.ppc_linux22.h:1.8.2.3 openafs/src/config/param.ppc_linux22.h:1.8.2.4
*** openafs/src/config/param.ppc_linux22.h:1.8.2.3	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.ppc_linux22.h	Thu Mar 19 22:32:59 2009
***************
*** 21,26 ****
--- 21,27 ----
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  #ifdef CONFIG_SMP
Index: openafs/src/config/param.ppc_linux24.h
diff -c openafs/src/config/param.ppc_linux24.h:1.10.2.5 openafs/src/config/param.ppc_linux24.h:1.10.2.7
*** openafs/src/config/param.ppc_linux24.h:1.10.2.5	Wed Jun  6 13:33:50 2007
--- openafs/src/config/param.ppc_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 25,30 ****
--- 25,31 ----
  #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 104,109 ****
--- 105,111 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.ppc_linux26.h
diff -c openafs/src/config/param.ppc_linux26.h:1.1.2.6 openafs/src/config/param.ppc_linux26.h:1.1.2.8
*** openafs/src/config/param.ppc_linux26.h:1.1.2.6	Wed Jun  6 13:33:50 2007
--- openafs/src/config/param.ppc_linux26.h	Thu Mar 19 23:12:39 2009
***************
*** 27,32 ****
--- 27,33 ----
  #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 107,112 ****
--- 108,114 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.s390_linux22.h
diff -c openafs/src/config/param.s390_linux22.h:1.10.2.3 openafs/src/config/param.s390_linux22.h:1.10.2.4
*** openafs/src/config/param.s390_linux22.h:1.10.2.3	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.s390_linux22.h	Thu Mar 19 22:32:59 2009
***************
*** 31,36 ****
--- 31,37 ----
  #define AFS_SYSCALL 137
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  #ifdef CONFIG_SMP
Index: openafs/src/config/param.s390_linux24.h
diff -c openafs/src/config/param.s390_linux24.h:1.12.2.4 openafs/src/config/param.s390_linux24.h:1.12.2.6
*** openafs/src/config/param.s390_linux24.h:1.12.2.4	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.s390_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 35,40 ****
--- 35,41 ----
  #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 119,124 ****
--- 120,126 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #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>
  
Index: openafs/src/config/param.s390_linux26.h
diff -c openafs/src/config/param.s390_linux26.h:1.1.2.5 openafs/src/config/param.s390_linux26.h:1.1.2.7
*** openafs/src/config/param.s390_linux26.h:1.1.2.5	Mon Jun 30 16:52:22 2008
--- openafs/src/config/param.s390_linux26.h	Thu Mar 19 23:12:39 2009
***************
*** 37,42 ****
--- 37,43 ----
  #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 127,132 ****
--- 128,134 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
  #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>
  
Index: openafs/src/config/param.s390x_linux24.h
diff -c openafs/src/config/param.s390x_linux24.h:1.1.2.5 openafs/src/config/param.s390x_linux24.h:1.1.2.6
*** openafs/src/config/param.s390x_linux24.h:1.1.2.5	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.s390x_linux24.h	Thu Mar 19 22:32:59 2009
***************
*** 40,45 ****
--- 40,46 ----
  #define AFS_64BIT_KERNEL  1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
Index: openafs/src/config/param.s390x_linux26.h
diff -c openafs/src/config/param.s390x_linux26.h:1.1.2.7 openafs/src/config/param.s390x_linux26.h:1.1.2.8
*** openafs/src/config/param.s390x_linux26.h:1.1.2.7	Mon Jun 30 16:52:22 2008
--- openafs/src/config/param.s390x_linux26.h	Thu Mar 19 22:32:59 2009
***************
*** 43,48 ****
--- 43,49 ----
  #define AFS_LINUX_64BIT_KERNEL  1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
Index: openafs/src/config/param.sparc64_linux22.h
diff -c openafs/src/config/param.sparc64_linux22.h:1.8.2.3 openafs/src/config/param.sparc64_linux22.h:1.8.2.4
*** openafs/src/config/param.sparc64_linux22.h:1.8.2.3	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.sparc64_linux22.h	Thu Mar 19 22:32:59 2009
***************
*** 36,41 ****
--- 36,42 ----
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_32BIT_USR_ENV	1	/* user level processes are 32bit */
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  #ifdef CONFIG_SMP
Index: openafs/src/config/param.sparc64_linux24.h
diff -c openafs/src/config/param.sparc64_linux24.h:1.7.2.5 openafs/src/config/param.sparc64_linux24.h:1.7.2.7
*** openafs/src/config/param.sparc64_linux24.h:1.7.2.5	Wed Jun  6 13:33:50 2007
--- openafs/src/config/param.sparc64_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 39,44 ****
--- 39,45 ----
  #define AFS_64BIT_CLIENT	1
  #define AFS_32BIT_USR_ENV       1
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 135,140 ****
--- 136,142 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 227
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.sparc64_linux26.h
diff -c openafs/src/config/param.sparc64_linux26.h:1.1.4.6 openafs/src/config/param.sparc64_linux26.h:1.1.4.8
*** openafs/src/config/param.sparc64_linux26.h:1.1.4.6	Wed Jun  6 13:33:50 2007
--- openafs/src/config/param.sparc64_linux26.h	Thu Mar 19 23:12:39 2009
***************
*** 41,46 ****
--- 41,47 ----
  #define AFS_64BIT_CLIENT	1
  #define AFS_32BIT_USR_ENV       1
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 137,142 ****
--- 138,144 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 227
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.sparc_linux22.h
diff -c openafs/src/config/param.sparc_linux22.h:1.9.2.3 openafs/src/config/param.sparc_linux22.h:1.9.2.4
*** openafs/src/config/param.sparc_linux22.h:1.9.2.3	Thu Nov  9 18:18:31 2006
--- openafs/src/config/param.sparc_linux22.h	Thu Mar 19 22:33:00 2009
***************
*** 31,36 ****
--- 31,37 ----
  #define AFS_SYSCALL 227
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  #ifdef CONFIG_SMP
Index: openafs/src/config/param.sparc_linux24.h
diff -c openafs/src/config/param.sparc_linux24.h:1.8.2.6 openafs/src/config/param.sparc_linux24.h:1.8.2.8
*** openafs/src/config/param.sparc_linux24.h:1.8.2.6	Tue Jul 17 00:06:41 2007
--- openafs/src/config/param.sparc_linux24.h	Thu Mar 19 23:12:39 2009
***************
*** 34,39 ****
--- 34,40 ----
  #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_MAXVCOUNT_ENV       1
  
  #if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
  
***************
*** 136,141 ****
--- 137,143 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 227
  #define AFS_64BIT_IOPS_ENV  1
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #include <afs/afs_sysnames.h>
  
Index: openafs/src/config/param.sun4x_510.h
diff -c openafs/src/config/param.sun4x_510.h:1.2.2.6 openafs/src/config/param.sun4x_510.h:1.2.2.8
*** openafs/src/config/param.sun4x_510.h:1.2.2.6	Fri Dec 23 20:09:53 2005
--- openafs/src/config/param.sun4x_510.h	Mon Dec 22 15:34:33 2008
***************
*** 34,39 ****
--- 34,41 ----
  #define AFS_3DISPARES		1	/* Utilize the 3 available disk inode 'spares' */
  #endif /* AFS_NAMEI_ENV */
  
+ #define AFS_CACHE_VNODE_PATH 1
+ 
  #include <afs/afs_sysnames.h>
  
  #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
***************
*** 53,58 ****
--- 55,61 ----
  #define AFS_HAVE_FFS		1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS		1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV		1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY	1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sun4x_511.h
diff -c openafs/src/config/param.sun4x_511.h:1.1.2.2 openafs/src/config/param.sun4x_511.h:1.1.2.4
*** openafs/src/config/param.sun4x_511.h:1.1.2.2	Thu Dec 28 16:59:45 2006
--- openafs/src/config/param.sun4x_511.h	Mon Dec 22 15:34:33 2008
***************
*** 35,40 ****
--- 35,42 ----
  #define AFS_3DISPARES		1	/* Utilize the 3 available disk inode 'spares' */
  #endif /* AFS_NAMEI_ENV */
  
+ #define AFS_CACHE_VNODE_PATH 1
+ 
  #include <afs/afs_sysnames.h>
  
  #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
***************
*** 54,59 ****
--- 56,62 ----
  #define AFS_HAVE_FFS		1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS		1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV		1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY	1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sun4x_58.h
diff -c openafs/src/config/param.sun4x_58.h:1.11.2.5 openafs/src/config/param.sun4x_58.h:1.11.2.6
*** openafs/src/config/param.sun4x_58.h:1.11.2.5	Fri Dec 23 20:09:53 2005
--- openafs/src/config/param.sun4x_58.h	Mon Dec 22 15:34:33 2008
***************
*** 51,56 ****
--- 51,57 ----
  #define AFS_HAVE_FFS    1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sun4x_59.h
diff -c openafs/src/config/param.sun4x_59.h:1.5.2.5 openafs/src/config/param.sun4x_59.h:1.5.2.6
*** openafs/src/config/param.sun4x_59.h:1.5.2.5	Fri Dec 23 20:09:53 2005
--- openafs/src/config/param.sun4x_59.h	Mon Dec 22 15:34:33 2008
***************
*** 52,57 ****
--- 52,58 ----
  #define AFS_HAVE_FFS    1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sunx86_510.h
diff -c openafs/src/config/param.sunx86_510.h:1.2.2.8 openafs/src/config/param.sunx86_510.h:1.2.2.10
*** openafs/src/config/param.sunx86_510.h:1.2.2.8	Fri Dec 23 20:09:53 2005
--- openafs/src/config/param.sunx86_510.h	Mon Dec 22 15:34:33 2008
***************
*** 38,43 ****
--- 38,45 ----
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
+ #define AFS_CACHE_VNODE_PATH 1
+ 
  #include <afs/afs_sysnames.h>
  
  #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
***************
*** 63,68 ****
--- 65,71 ----
  #define AFS_HAVE_FFS		1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS		1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV		1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY	1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sunx86_511.h
diff -c openafs/src/config/param.sunx86_511.h:1.1.2.2 openafs/src/config/param.sunx86_511.h:1.1.2.4
*** openafs/src/config/param.sunx86_511.h:1.1.2.2	Thu Dec 28 16:59:45 2006
--- openafs/src/config/param.sunx86_511.h	Mon Dec 22 15:34:33 2008
***************
*** 39,44 ****
--- 39,46 ----
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
+ #define AFS_CACHE_VNODE_PATH 1
+ 
  #include <afs/afs_sysnames.h>
  
  #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
***************
*** 64,69 ****
--- 66,72 ----
  #define AFS_HAVE_FFS		1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS		1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV		1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY	1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sunx86_58.h
diff -c openafs/src/config/param.sunx86_58.h:1.6.2.5 openafs/src/config/param.sunx86_58.h:1.6.2.6
*** openafs/src/config/param.sunx86_58.h:1.6.2.5	Fri Dec 23 20:09:53 2005
--- openafs/src/config/param.sunx86_58.h	Mon Dec 22 15:34:33 2008
***************
*** 62,67 ****
--- 62,68 ----
  #define AFS_HAVE_FFS    1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.sunx86_59.h
diff -c openafs/src/config/param.sunx86_59.h:1.2.2.5 openafs/src/config/param.sunx86_59.h:1.2.2.6
*** openafs/src/config/param.sunx86_59.h:1.2.2.5	Fri Dec 23 20:09:53 2005
--- openafs/src/config/param.sunx86_59.h	Mon Dec 22 15:34:33 2008
***************
*** 63,68 ****
--- 63,69 ----
  #define AFS_HAVE_FFS    1	/* Use system's ffs. */
  #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
  #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_HAVE_STATVFS64	1	/* System supports statvfs64 */
  #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
  #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
  
Index: openafs/src/config/param.x86_darwin_100.h
diff -c /dev/null openafs/src/config/param.x86_darwin_100.h:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:17 2009
--- openafs/src/config/param.x86_darwin_100.h	Mon Feb 16 23:25:40 2009
***************
*** 0 ****
--- 1,190 ----
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef AFS_PARAM_H
+ #define AFS_PARAM_H
+ 
+ #define AFS_ENV                 1
+ #define AFS_64BIT_ENV           1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT        1
+ #define AFS_64BIT_IOPS_ENV	1
+ #if defined(__ppc__)
+ #define AFS_PPC_ENV		1
+ #elif defined(__i386__)
+ #define AFS_X86_ENV		1
+ #else
+ #error Unsupported architecture
+ #endif
+ #define AFS_VFSINCL_ENV		1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_DARWIN_ENV
+ #define AFS_DARWIN13_ENV
+ #define AFS_DARWIN14_ENV
+ #define AFS_DARWIN60_ENV
+ #define AFS_DARWIN70_ENV
+ #define AFS_DARWIN80_ENV
+ #define AFS_DARWIN90_ENV
+ #define AFS_DARWIN100_ENV
+ #define AFS_NONFSTRANS
+ #define AFS_SYSCALL             230
+ #define AFS_NAMEI_ENV 1
+ #define DARWIN_REFBASE 3
+ #define AFS_CACHE_VNODE_PATH
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS    "afs"
+ 
+ /* Machine / Operating system information */
+ #if defined(__ppc__)
+ #define sys_ppc_darwin_12	1
+ #define sys_ppc_darwin_13	1
+ #define sys_ppc_darwin_14	1
+ #define sys_ppc_darwin_60	1
+ #define sys_ppc_darwin_70	1
+ #define sys_ppc_darwin_80	1
+ #define sys_ppc_darwin_90	1
+ #define sys_ppc_darwin_100	1
+ #define SYS_NAME		"ppc_darwin_100"
+ #define SYS_NAME_ID		SYS_NAME_ID_ppc_darwin_100
+ #define AFSBIG_ENDIAN		1
+ #elif defined(__i386__)
+ #define sys_x86_darwin_12	1
+ #define sys_x86_darwin_13	1
+ #define sys_x86_darwin_14	1
+ #define sys_x86_darwin_60	1
+ #define sys_x86_darwin_70	1
+ #define sys_x86_darwin_80	1
+ #define sys_x86_darwin_90	1
+ #define sys_x86_darwin_100	1
+ #define SYS_NAME		"x86_darwin_100"
+ #define SYS_NAME_ID		SYS_NAME_ID_x86_darwin_100
+ #define AFSLITTLE_ENDIAN	1
+ #else
+ #error Unsupported architecture
+ #endif
+ #define AFS_HAVE_FFS    1	/* Use system's ffs. */
+ 
+ #define AFS_GCPAGS               0
+ #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)   _MALLOC(x, M_TEMP, M_WAITOK)
+ #define AFS_KFREE(x,y)  _FREE(x,M_TEMP)
+ #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 BIND_8_COMPAT
+ 
+ #endif
+ #endif /* AFS_PARAM_H */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #ifndef AFS_PARAM_H
+ #define AFS_PARAM_H
+ 
+ #define AFS_VFSINCL_ENV 1	/* NOBODY uses this.... */
+ #define AFS_ENV                 1
+ #define AFS_64BIT_ENV           1	/* Defines afs_int32 as int, not long. */
+ #if defined(__ppc__)
+ #define AFS_PPC_ENV		1
+ #elif defined(__i386__)
+ #define AFS_X86_ENV		1
+ #else
+ #error Unsupported architecture
+ #endif
+ 
+ #include <afs/afs_sysnames.h>
+ #define AFS_USERSPACE_ENV
+ #define AFS_USR_DARWIN_ENV
+ #define AFS_USR_DARWIN13_ENV
+ #define AFS_USR_DARWIN14_ENV
+ #define AFS_USR_DARWIN60_ENV
+ #define AFS_USR_DARWIN70_ENV
+ #define AFS_USR_DARWIN80_ENV
+ #define AFS_USR_DARWIN90_ENV
+ #define AFS_USR_DARWIN100_ENV
+ #define AFS_NONFSTRANS
+ #define AFS_SYSCALL             230
+ #define DARWIN_REFBASE 0
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS    "afs"
+ 
+ /* Machine / Operating system information */
+ #if defined(__ppc__)
+ #define sys_ppc_darwin_12	1
+ #define sys_ppc_darwin_13	1
+ #define sys_ppc_darwin_14	1
+ #define sys_ppc_darwin_60	1
+ #define sys_ppc_darwin_70	1
+ #define sys_ppc_darwin_80	1
+ #define sys_ppc_darwin_90	1
+ #define sys_ppc_darwin_100	1
+ #define SYS_NAME		"ppc_darwin_100"
+ #define SYS_NAME_ID		SYS_NAME_ID_ppc_darwin_100
+ #define AFSBIG_ENDIAN		1
+ #elif defined(__i386__)
+ #define sys_x86_darwin_12	1
+ #define sys_x86_darwin_13	1
+ #define sys_x86_darwin_14	1
+ #define sys_x86_darwin_60	1
+ #define sys_x86_darwin_70	1
+ #define sys_x86_darwin_80	1
+ #define sys_x86_darwin_100	1
+ #define SYS_NAME		"x86_darwin_100"
+ #define SYS_NAME_ID		SYS_NAME_ID_x86_darwin_100
+ #define AFSLITTLE_ENDIAN	1
+ #else
+ #error Unsupported architecture
+ #endif
+ #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
+ 
+ #define BIND_8_COMPAT
+ #endif /* AFS_PARAM_H */
+ 
+ #endif /* !defined(UKERNEL) */
Index: openafs/src/config/stds.h
diff -c openafs/src/config/stds.h:1.21.2.4 openafs/src/config/stds.h:1.21.2.5
*** openafs/src/config/stds.h:1.21.2.4	Sat Aug 16 15:15:50 2008
--- openafs/src/config/stds.h	Mon Mar 23 14:19:55 2009
***************
*** 255,258 ****
--- 255,295 ----
  };
  typedef struct afsUUID afsUUID;
  
+ /* A macro that can be used when printf'ing 64 bit integers, as Unix and 
+  * windows use a different format string
+  */
+ #ifdef AFS_NT40_ENV
+ #define AFS_INT64_FMT "l64d"
+ #else
+ #define AFS_INT64_FMT "lld"
+ #endif
+ 
+ /* Functions to safely cast afs_int32 and afs_uint32 so they can be used in 
+  * printf statemements with %ld and %lu
+  */
+ #ifdef AFS_NT40_ENV
+ #define static_inline __inline static
+ #define hdr_static_inline(x) __inline static x
+ #elif defined(AFS_HPUX_ENV) || defined(AFS_USR_HPUX_ENV)
+ #define static_inline static __inline
+ #define hdr_static_inline(x) static __inline x
+ #elif defined(AFS_AIX_ENV) || defined(AFS_USR_AIX_ENV)
+ #define static_inline static
+ #define hdr_static_inline(x) static x
+ #elif defined(AFS_SGI_ENV) || defined(AFS_USR_SGI_ENV)
+ #define static_inline static
+ #define hdr_static_inline(x) x
+ #else
+ #define static_inline static inline
+ #define hdr_static_inline(x) static inline x
+ #endif
+ 
+ #ifdef  AFS_64BIT_ENV
+ hdr_static_inline(afs_int32) afs_cast_int32(afs_int32 d) { return (afs_int32) d; }
+ hdr_static_inline(afs_uint32) afs_cast_uint32(afs_uint32 d) { return (afs_uint32) d; }
+ #else
+ hdr_static_inline(long) afs_cast_int32(afs_int32 d) { return (long) d; }
+ hdr_static_inline(unsigned long) afs_cast_uint32(afs_uint32 d) { return (unsigned long) d; }
+ #endif
+ 
  #endif /* OPENAFS_CONFIG_AFS_STDS_H */
Index: openafs/src/config/venus.h
diff -c openafs/src/config/venus.h:1.10.2.2 openafs/src/config/venus.h:1.10.2.3
*** openafs/src/config/venus.h:1.10.2.2	Tue Jun 12 15:20:13 2007
--- openafs/src/config/venus.h	Mon Jan 19 13:09:32 2009
***************
*** 172,179 ****
  #define VIOC_RXSTAT_PEER	_VICEIOCTL(54)	/* Control peer RX stats */
  #define VIOC_GETRXKCRYPT        _VICEIOCTL(55)	/* Set rxkad enc flag */
  #define VIOC_SETRXKCRYPT        _VICEIOCTL(56)	/* Set rxkad enc flag */
! #define VIOC_PREFETCHTAPE       _VICEIOCTL(66)	/* MR-AFS prefetch from tape */
! #define VIOC_RESIDENCY_CMD      _VICEIOCTL(67)	/* generic MR-AFS cmds */
  #define VIOC_STATISTICS         _VICEIOCTL(68)	/* arla: fetch statistics */
  #define VIOC_GETVCXSTATUS2      _VICEIOCTL(69)  /* vcache statistics */
  
--- 172,179 ----
  #define VIOC_RXSTAT_PEER	_VICEIOCTL(54)	/* Control peer RX stats */
  #define VIOC_GETRXKCRYPT        _VICEIOCTL(55)	/* Set rxkad enc flag */
  #define VIOC_SETRXKCRYPT        _VICEIOCTL(56)	/* Set rxkad enc flag */
! #define VIOC_PREFETCHTAPE       _VICEIOCTL(66)	/* osd prefetch from tape */
! #define VIOC_FS_CMD      	_VICEIOCTL(67)	/* fs extensions for osd etc. */
  #define VIOC_STATISTICS         _VICEIOCTL(68)	/* arla: fetch statistics */
  #define VIOC_GETVCXSTATUS2      _VICEIOCTL(69)  /* vcache statistics */
  
Index: openafs/src/fsint/afsint.xg
diff -c openafs/src/fsint/afsint.xg:1.13.2.2 openafs/src/fsint/afsint.xg:1.13.2.3
*** openafs/src/fsint/afsint.xg:1.13.2.2	Sat Aug 16 15:15:45 2008
--- openafs/src/fsint/afsint.xg	Mon Jan 19 13:09:33 2009
***************
*** 393,399 ****
      afs_uint32 Residency4;
  };
  
! struct ResidencyCmdInputs {
      afs_int32  command;
      struct AFSFid fid;
      afs_int64  int64s[MAXCMDINT64S];
--- 393,399 ----
      afs_uint32 Residency4;
  };
  
! struct FsCmdInputs {
      afs_int32  command;
      struct AFSFid fid;
      afs_int64  int64s[MAXCMDINT64S];
***************
*** 401,407 ****
      char       chars[MAXCMDCHARS];
  };
  
! struct ResidencyCmdOutputs {
      afs_int32  code;
      struct AFSFetchStatus status;
      afs_int64  int64s[MAXCMDINT64S];
--- 401,407 ----
      char       chars[MAXCMDCHARS];
  };
  
! struct FsCmdOutputs {
      afs_int32  code;
      struct AFSFetchStatus status;
      afs_int64  int64s[MAXCMDINT64S];
***************
*** 660,669 ****
    AFSVolSync *Sync
  ) = 163;
  
! ResidencyCmd(
    IN AFSFid *Fid,
!   IN struct ResidencyCmdInputs *Inputs,
!   OUT struct ResidencyCmdOutputs *Outputs
  ) = 220;
  
  InlineBulkStatus(
--- 660,669 ----
    AFSVolSync *Sync
  ) = 163;
  
! FsCmd(
    IN AFSFid *Fid,
!   IN struct FsCmdInputs *Inputs,
!   OUT struct FsCmdOutputs *Outputs
  ) = 220;
  
  InlineBulkStatus(
Index: openafs/src/gtx/windows.c
diff -c openafs/src/gtx/windows.c:1.6 openafs/src/gtx/windows.c:1.6.2.1
*** openafs/src/gtx/windows.c:1.6	Tue Jul 15 19:15:13 2003
--- openafs/src/gtx/windows.c	Mon Mar 16 22:39:43 2009
***************
*** 19,25 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/gtx/windows.c,v 1.6 2003/07/15 23:15:13 shadow Exp $");
  
  /* On DUX "IN" is a variable in curses.h, so this can be a bit of a problem */
  #ifdef IN
--- 19,25 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/gtx/windows.c,v 1.6.2.1 2009/03/17 02:39:43 shadow Exp $");
  
  /* On DUX "IN" is a variable in curses.h, so this can be a bit of a problem */
  #ifdef IN
***************
*** 114,120 ****
  	    fprintf(stderr, "[%s:%s] Initializing for the X11 package\n", mn,
  		    rn);
  	gwinbops = gator_X11_gwinbops;
! 	code = gator_X11gwin_init(params);
  	if (code) {
  	    fprintf(stderr,
  		    "[%s:%s] Error in X11 initialization routine, gator_X11gwin_init(): %d\n",
--- 114,120 ----
  	    fprintf(stderr, "[%s:%s] Initializing for the X11 package\n", mn,
  		    rn);
  	gwinbops = gator_X11_gwinbops;
! 	code = gator_X11gwin_init(gwin_debug);
  	if (code) {
  	    fprintf(stderr,
  		    "[%s:%s] Error in X11 initialization routine, gator_X11gwin_init(): %d\n",
Index: openafs/src/kauth/kaserver.c
diff -c openafs/src/kauth/kaserver.c:1.17.2.8 openafs/src/kauth/kaserver.c:1.17.2.10
*** openafs/src/kauth/kaserver.c:1.17.2.8	Mon Mar 10 18:35:35 2008
--- openafs/src/kauth/kaserver.c	Mon Dec 22 14:23:32 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/kaserver.c,v 1.17.2.8 2008/03/10 22:35:35 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/kauth/kaserver.c,v 1.17.2.10 2008/12/22 19:23:32 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 249,282 ****
  		lclpath = dbpath;
  	}
  	else if (strncmp(arg, "-auditlog", arglen) == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++a];
  	    
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 	    
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	} else if (strcmp(arg, "-localfiles") == 0)
  	    lclpath = argv[++a];
  	else if (strcmp(arg, "-servers") == 0)
--- 249,257 ----
  		lclpath = dbpath;
  	}
  	else if (strncmp(arg, "-auditlog", arglen) == 0) {
  	    char *fileName = argv[++a];
  	    
! 	    osi_audit_file(fileName);
  	} else if (strcmp(arg, "-localfiles") == 0)
  	    lclpath = argv[++a];
  	else if (strcmp(arg, "-servers") == 0)
***************
*** 416,422 ****
      else
  	code =
  	    ubik_ServerInitByInfo(myHost, htons(AFSCONF_KAUTHPORT), &cellinfo,
! 				  &clones, dbpath, &KA_dbase);
  
      if (code) {
  	afs_com_err(whoami, code, "Ubik init failed");
--- 391,397 ----
      else
  	code =
  	    ubik_ServerInitByInfo(myHost, htons(AFSCONF_KAUTHPORT), &cellinfo,
! 				  clones, dbpath, &KA_dbase);
  
      if (code) {
  	afs_com_err(whoami, code, "Ubik init failed");
Index: openafs/src/libafs/MakefileProto.FBSD.in
diff -c openafs/src/libafs/MakefileProto.FBSD.in:1.24.2.1 openafs/src/libafs/MakefileProto.FBSD.in:1.24.2.4
*** openafs/src/libafs/MakefileProto.FBSD.in:1.24.2.1	Tue Aug 26 10:02:16 2008
--- openafs/src/libafs/MakefileProto.FBSD.in	Mon Jan 12 09:33:38 2009
***************
*** 26,40 ****
  AFS_OS_NONFSOBJS = \
  	osi_vfsops.o
  
- 
  # System specific build commands and flags
  KSRC = @BSD_KERNEL_PATH@
  KBLD = @BSD_KERNEL_BUILD@
  KDEFS=-Wall -nostdinc -I/usr/include -D_KERNEL -DKLD_MODULE \
! 	    -elf -mpreferred-stack-boundary=2 \
  <i386_fbsd_42 i386_fbsd_43 i386_fbsd_44 i386_fbsd_45 i386_fbsd_46 i386_fbsd_47>
  	     -fformat-extensions \
! <i386_fbsd_42 i386_fbsd_43 i386_fbsd_44 i386_fbsd_45 i386_fbsd_46 i386_fbsd_47>	-include ${KBLD}/opt_global.h
  <all -i386_fbsd_42 -i386_fbsd_43 -i386_fbsd_44 -i386_fbsd_45 -i386_fbsd_46 -i386_fbsd_47>
  	-mno-align-long-strings -fformat-extensions -fno-common -ffreestanding \
  	-I${KBLD} -include opt_global.h -fno-strict-aliasing
--- 26,45 ----
  AFS_OS_NONFSOBJS = \
  	osi_vfsops.o
  
  # System specific build commands and flags
  KSRC = @BSD_KERNEL_PATH@
  KBLD = @BSD_KERNEL_BUILD@
+ <amd64_fbsd_70 amd64_fbsd_71 amd64_fbsd_80>
+ KOPTS = -fPIC
+ <all>
+ 
  KDEFS=-Wall -nostdinc -I/usr/include -D_KERNEL -DKLD_MODULE \
! 	    -elf \
  <i386_fbsd_42 i386_fbsd_43 i386_fbsd_44 i386_fbsd_45 i386_fbsd_46 i386_fbsd_47>
+ 	     -mpreferred-stack-boundary=2 \
  	     -fformat-extensions \
! <i386_fbsd_42 i386_fbsd_43 i386_fbsd_44 i386_fbsd_45 i386_fbsd_46 i386_fbsd_47>
! 	-include ${KBLD}/opt_global.h -mpreferred-stack-boundary=2
  <all -i386_fbsd_42 -i386_fbsd_43 -i386_fbsd_44 -i386_fbsd_45 -i386_fbsd_46 -i386_fbsd_47>
  	-mno-align-long-strings -fformat-extensions -fno-common -ffreestanding \
  	-I${KBLD} -include opt_global.h -fno-strict-aliasing
***************
*** 43,53 ****
  DBUG = -O2
  #DBUG = -O -g
  DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT
- OPTF=${OPT} 
- OPTF2=${OPT2} 
  CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
  
- 
  # Name of directory to hold object files and libraries.
  KOBJ = MODLOAD
  
--- 48,55 ----
***************
*** 65,76 ****
  	ln -fs ../Makefile.common $(KOBJ)/Makefile.common
  	-$(RM) -f  h net netinet rpc ufs nfs  machine sys vm
  	-ln -fs ${KSRC}/net net
! 	-ln -fs ${KSRC}/i386/include machine
  	-ln -fs ${KSRC}/netinet netinet
  	-ln -fs ${KSRC}/nfs nfs
! <all -i386_fbsd_80>
  	-ln -fs /usr/include/rpc rpc
! <i386_fbsd_80>
  	-ln -fs ${KSRC}/rpc rpc
  <all>
  	-ln -fs ${KSRC}/sys sys
--- 67,78 ----
  	ln -fs ../Makefile.common $(KOBJ)/Makefile.common
  	-$(RM) -f  h net netinet rpc ufs nfs  machine sys vm
  	-ln -fs ${KSRC}/net net
! 	-ln -fs ${KSRC}/${CPUARCH}/include machine
  	-ln -fs ${KSRC}/netinet netinet
  	-ln -fs ${KSRC}/nfs nfs
! <all -fbsd_71 -fbsd_80>
  	-ln -fs /usr/include/rpc rpc
! <fbsd_71 fbsd_80>
  	-ln -fs ${KSRC}/rpc rpc
  <all>
  	-ln -fs ${KSRC}/sys sys
Index: openafs/src/libafs/afs.x86_darwin_100.plist.in
diff -c /dev/null openafs/src/libafs/afs.x86_darwin_100.plist.in:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:17 2009
--- openafs/src/libafs/afs.x86_darwin_100.plist.in	Mon Feb 16 23:25:41 2009
***************
*** 0 ****
--- 1,33 ----
+ <?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>8.0</string>
+ 	<key>CFBundleName</key>
+ 	<string>afs</string>
+ 	<key>CFBundlePackageType</key>
+ 	<string>KEXT</string>
+ 	<key>CFBundleShortVersionString</key>
+ 	<string>@MACOS_VERSION@</string>
+ 	<key>CFBundleSignature</key>
+ 	<string>????</string>
+ 	<key>CFBundleVersion</key>
+ 	<string>@MACOS_VERSION@</string>
+ 	<key>OSBundleLibraries</key>
+ 	<dict>
+ 		<key>com.apple.kpi.bsd</key>
+ 		<string>8.0.0</string>
+ 		<key>com.apple.kpi.mach</key>
+ 		<string>8.0.0</string>
+ 		<key>com.apple.kpi.libkern</key>
+ 		<string>8.0</string>
+ 	</dict>
+ </dict>
+ </plist>
Index: openafs/src/libuafs/MakefileProto.FBSD.in
diff -c openafs/src/libuafs/MakefileProto.FBSD.in:1.11.2.1 openafs/src/libuafs/MakefileProto.FBSD.in:1.11.2.2
*** openafs/src/libuafs/MakefileProto.FBSD.in:1.11.2.1	Tue Aug 26 10:02:15 2008
--- openafs/src/libuafs/MakefileProto.FBSD.in	Mon Dec 15 15:38:22 2008
***************
*** 19,27 ****
  
  TEST_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_FBSD40_ENV
  TEST_LDFLAGS=
! <all -i386_fbsd_62 -i386_fbsd_70 -i386_fbsd_80>
  TEST_LIBS=-lc_r
! <i386_fbsd_62 i386_fbsd_70 i386_fbsd_80>
  TEST_LIBS=-lpthread
  <all>
  
--- 19,27 ----
  
  TEST_CFLAGS=-D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_FBSD40_ENV
  TEST_LDFLAGS=
! <all -i386_fbsd_62 -i386_fbsd_70 -i386_fbsd_71 -i386_fbsd_80 -amd64_fbsd_62 -amd64_fbsd_70 -amd64_fbsd_71 -amd64_fbsd_80>
  TEST_LIBS=-lc_r
! <i386_fbsd_62 i386_fbsd_70 i386_fbsd_71 i386_fbsd_80 amd64_fbsd_62 amd64_fbsd_70 amd64_fbsd_71 amd64_fbsd_80>
  TEST_LIBS=-lpthread
  <all>
  
Index: openafs/src/lwp/process.amd64.s
diff -c openafs/src/lwp/process.amd64.s:1.1.2.1 openafs/src/lwp/process.amd64.s:1.1.2.2
*** openafs/src/lwp/process.amd64.s:1.1.2.1	Sun Feb 20 20:12:10 2005
--- openafs/src/lwp/process.amd64.s	Mon Dec 15 15:38:22 2008
***************
*** 1,4 ****
! /* $Id: process.amd64.s,v 1.1.2.1 2005/02/21 01:12:10 shadow Exp $ */
  
  /*
   * Copyright (c) 2003,2005 Kungliga Tekniska Högskolan
--- 1,4 ----
! /* $Id: process.amd64.s,v 1.1.2.2 2008/12/15 20:38:22 shadow Exp $ */
  
  /*
   * Copyright (c) 2003,2005 Kungliga Tekniska Högskolan
***************
*** 85,91 ****
  	movq	%rsi, area1(%rbp)	/* i multiples of 24, so 32 it is) */
  	movq	%rdx, newsp(%rbp)	/* and copy them there. */
  
! 	movl    $1,_C_LABEL(PRE_Block)  /* Do not allow any interrupts */
  
  	pushq	%rsp			/* Push all registers onto the stack */
  	pushq	%rax			/* Probably not _all_ are necessary */
--- 85,92 ----
  	movq	%rsi, area1(%rbp)	/* i multiples of 24, so 32 it is) */
  	movq	%rdx, newsp(%rbp)	/* and copy them there. */
  
! 	movq	PRE_Block@GOTPCREL(%rip), %rax
! 	movl	$1,(%rax)		/* Do not allow any interrupts */
  
  	pushq	%rsp			/* Push all registers onto the stack */
  	pushq	%rax			/* Probably not _all_ are necessary */
***************
*** 149,156 ****
  	popq	%rcx
  	popq	%rax
  	popq	%rsp			/* See savecontext */
! 	
! 	movl    $0,_C_LABEL(PRE_Block)  /* clear it up... */
  	addq	$32, %rsp		/* We did rsp-32 above, correct that */
  	popq    %rbp
  	ret
--- 150,158 ----
  	popq	%rcx
  	popq	%rax
  	popq	%rsp			/* See savecontext */
! 
! 	movq    PRE_Block@GOTPCREL(%rip), %rax
! 	movl    $0,(%rax)	
  	addq	$32, %rsp		/* We did rsp-32 above, correct that */
  	popq    %rbp
  	ret
Index: openafs/src/packaging/MacOS/InstallationCheck.10
diff -c /dev/null openafs/src/packaging/MacOS/InstallationCheck.10:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:17 2009
--- openafs/src/packaging/MacOS/InstallationCheck.10	Mon Feb 16 23:25:41 2009
***************
*** 0 ****
--- 1,10 ----
+ #!/bin/sh
+ majorvers=`uname -r | sed 's/\..*//'`
+ echo "InstallationCheck: os release is $majorvers"
+ if [ $majorvers -ne 10 ]; then
+ echo "InstallationCheck: not ok"
+ 	exit 112
+ fi
+ 
+ echo "InstallationCheck: ok"
+ exit 0
Index: openafs/src/packaging/MacOS/ReadMe.rtf.10
diff -c /dev/null openafs/src/packaging/MacOS/ReadMe.rtf.10:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:17 2009
--- openafs/src/packaging/MacOS/ReadMe.rtf.10	Mon Feb 16 23:25:41 2009
***************
*** 0 ****
--- 1,13 ----
+ {\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf100
+ {\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+ {\colortbl;\red255\green255\blue255;}
+ \margl1440\margr1440\vieww9000\viewh9000\viewkind0
+ \pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural
+ 
+ \f0\fs20 \cf0 This release of OpenAFS is targeted at MacOS 10.6. (Snow Leopard)
+ \
+ Select a client cell name by editing /var/db/openafs/etc/ThisCell\
+ \
+ The included afssettings program is distributed under the Apple Public Source License, version 2.0. See http://www.opensource.apple.com/apsl/2.0.txt or the included file 2.0.txt.\
+ \
+ Reboot when all of this is done.}
Index: openafs/src/packaging/RedHat/mockbuild.pl
diff -c openafs/src/packaging/RedHat/mockbuild.pl:1.1.2.5 openafs/src/packaging/RedHat/mockbuild.pl:1.1.2.6
*** openafs/src/packaging/RedHat/mockbuild.pl:1.1.2.5	Fri Sep 12 09:07:52 2008
--- openafs/src/packaging/RedHat/mockbuild.pl	Tue Feb  3 14:34:31 2009
***************
*** 16,21 ****
--- 16,22 ----
  my $resultbase="/tmp/result/";
  my $stashbase="/disk/scratch/repository/";
  my $mockcommand = "/usr/bin/mock";
+ my $resultfile;
  my $buildall = 0;
  my $ignorerelease = 1;
  my @newrpms;
***************
*** 134,139 ****
--- 135,160 ----
  					basearch => "x86_64",
  					updaterepo => "updates-released",
  					results => "fedora-9/x86_64" },
+ 		 "fedora-10-i386" => { osver => "fc10",
+ 				      kmod => '1',
+ 				      basearch => 'i386',
+ 				      updaterepo => "updates-released",
+ 				      results => 'fedora-10/i386' },
+ 		 "fedora-10-x86_64" => { osver => "fc10",
+ 					kmod => "1",
+ 					basearch => "x86_64",
+ 					updaterepo => "updates-released",
+ 					results => "fedora-10/x86_64" },
+ 		 "fedora-11-i386" => { osver => "fc11",
+ 				      kmod => '1',
+ 				      basearch => 'i386',
+ #				      updaterepo => "updates-released",
+ 				      results => 'fedora-11/i386' },
+ 		 "fedora-11-x86_64" => { osver => "fc11",
+ 					kmod => "1",
+ 					basearch => "x86_64",
+ #					updaterepo => "updates-released",
+ 					results => "fedora-11/x86_64" },
  		 "fedora-development-i386" => { osver => "fcd",
  					  kmod => '1',
  					  basearch => 'i386',
***************
*** 153,158 ****
--- 174,180 ----
  
  my $help;
  my $ok = GetOptions("resultdir=s" => \$resultbase,
+ 		    "resultlist=s" => \$resultfile,
  		    "help" => \$help);
  
  my @platforms = @ARGV;
***************
*** 234,240 ****
  	  next if ($variant eq "xen0"); # Fedora 5 has some bad xen0 kernel-devels
  	  next if ($variant eq "smp");
        }
!       if ($platform=~/fedora-8/ || $platform=~/fedora-9/ || $platform=~/fedora-development/) {
  	  next if ($variant =~/debug$/); # Fedora 8 debug kernels are bad
        }
        print "$arch : $variant : $version\n";
--- 256,262 ----
  	  next if ($variant eq "xen0"); # Fedora 5 has some bad xen0 kernel-devels
  	  next if ($variant eq "smp");
        }
!       if ($platform=~/fedora-8/ || $platform=~/fedora-9/ || $platform=~/fedora-10/ || $platform=~/fedora-development/) {
  	  next if ($variant =~/debug$/); # Fedora 8 debug kernels are bad
        }
        print "$arch : $variant : $version\n";
***************
*** 282,288 ****
  		   $osver.".".$oafsrelease.".".$basearch.".rpm ".
  		   $resultdir) == 0
            or die "Copy failed with : $!\n";
!       push @newrpms, $mockresults."/".$rpm."-".$oafsversion."-".
  		     $osver.".".$oafsrelease.".".$basearch.".rpm";
      }
    } else {
--- 304,310 ----
  		   $osver.".".$oafsrelease.".".$basearch.".rpm ".
  		   $resultdir) == 0
            or die "Copy failed with : $!\n";
!       push @newrpms, $resultdir."/".$rpm."-".$oafsversion."-".
  		     $osver.".".$oafsrelease.".".$basearch.".rpm";
      }
    } else {
***************
*** 342,348 ****
            }
            system("cp ".$mockresults."/kmod-openafs-".$variant.$oafsversion."-".$oafsrelease.".".$kversion.".".$arch.".rpm $resultdir") == 0
              or die "Copy failed with : $!\n";
! 	  push @newrpms, $mockresults."/kmod-openafs-".$variant.$oafsversion."-".$oafsrelease.".".$kversion.".".$arch.".rpm";
          }
        } else {
           print "All kernel modules already built for $version on $arch\n";
--- 364,370 ----
            }
            system("cp ".$mockresults."/kmod-openafs-".$variant.$oafsversion."-".$oafsrelease.".".$kversion.".".$arch.".rpm $resultdir") == 0
              or die "Copy failed with : $!\n";
! 	  push @newrpms, $resultdir."/kmod-openafs-".$variant.$oafsversion."-".$oafsrelease.".".$kversion.".".$arch.".rpm";
          }
        } else {
           print "All kernel modules already built for $version on $arch\n";
***************
*** 384,387 ****
--- 406,413 ----
  print "=====================================================================\n";
  print "All builds complete\nBuilt:\n";
  print join("\n",@newrpms);
+ if (defined($resultfile)) {
+   my $resultfh=new IO::File $resultfile, 'w';
+   print $resultfh join("\n",@newrpms);
+ }
  
Index: openafs/src/packaging/RedHat/openafs-kmodtool
diff -c openafs/src/packaging/RedHat/openafs-kmodtool:1.1.4.3 openafs/src/packaging/RedHat/openafs-kmodtool:1.1.4.4
*** openafs/src/packaging/RedHat/openafs-kmodtool:1.1.4.3	Tue Apr 22 08:50:56 2008
--- openafs/src/packaging/RedHat/openafs-kmodtool	Tue Feb  3 14:34:31 2009
***************
*** 39,44 ****
--- 39,48 ----
  {
    verrel=${1:-$(uname -r)}
    verrel=${verrel%%$knownvariants}
+   case "$verrel" in
+     *.fc9*)  verrel="`echo ${verrel} | sed -e 's/^\(.*.fc9[^\.]*\)\.[^\.]\+.\?$/\1/'`" ;;
+     *.fc1?*) verrel="`echo ${verrel} | sed -e 's/^\(.*.fc1[0-9][^\.]*\)\.[^\.]\+.\?$/\1/'`" ;;
+   esac
  }
  
  print_verrel ()
***************
*** 72,77 ****
--- 76,82 ----
      esac
      case "$verrel" in
          *.fc9*) kname="${verrel}.%{_target_cpu}${variant:+.${variant}}" ;;
+         *.fc1?*)  kname="${verrel}.%{_target_cpu}${variant:+.${variant}}" ;;
          *)      kname="${verrel}${variant}"                             ;;
      esac
  
Index: openafs/src/packaging/RedHat/openafs.spec.in
diff -c openafs/src/packaging/RedHat/openafs.spec.in:1.1.2.27 openafs/src/packaging/RedHat/openafs.spec.in:1.1.2.29
*** openafs/src/packaging/RedHat/openafs.spec.in:1.1.2.27	Wed Nov  5 16:29:57 2008
--- openafs/src/packaging/RedHat/openafs.spec.in	Wed Mar 25 14:42:48 2009
***************
*** 1,4 ****
! # Openafs Spec $Revision: 1.1.2.27 $
  
  %define afsvers @VERSION@
  %define pkgvers @LINUX_PKGVER@
--- 1,7 ----
! # Openafs Spec $Revision: 1.1.2.29 $
! 
! # TEMPORARY fix for patch fuzz so we can build on Fedora 10
! %define _default_patch_fuzz 2
  
  %define afsvers @VERSION@
  %define pkgvers @LINUX_PKGVER@
***************
*** 266,272 ****
  Source10: http://www.openafs.org/dl/openafs/%{afsvers}/RELNOTES-%{afsvers}
  Source11: http://www.openafs.org/dl/openafs/%{afsvers}/ChangeLog
  
! Source20: http://dl.central.org/dl/cellservdb/CellServDB.2008-04-23
  
  Source30: openafs-kernel-version.sh
  Source996: openafs-kvers-is.sh
--- 269,275 ----
  Source10: http://www.openafs.org/dl/openafs/%{afsvers}/RELNOTES-%{afsvers}
  Source11: http://www.openafs.org/dl/openafs/%{afsvers}/ChangeLog
  
! Source20: http://dl.central.org/dl/cellservdb/CellServDB.2008-11-07
  
  Source30: openafs-kernel-version.sh
  Source996: openafs-kvers-is.sh
***************
*** 1014,1020 ****
  tar cf - -C ${sysname}/dest/lib . | tar xf - -C $RPM_BUILD_ROOT%{_libdir}
  tar cf - -C ${sysname}/dest/etc . | tar xf - -C $RPM_BUILD_ROOT%{_sbindir}
  tar cf - -C ${sysname}/dest/root.server%{_prefix}/afs bin | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/afs
! tar cf - -C ${sysname}/dest/root.client%{_prefix}/vice/etc afsd | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/vice/etc
  
  # Link kpasswd to kapasswd
  ln -f $RPM_BUILD_ROOT%{_bindir}/kpasswd $RPM_BUILD_ROOT%{_bindir}/kapasswd
--- 1017,1023 ----
  tar cf - -C ${sysname}/dest/lib . | tar xf - -C $RPM_BUILD_ROOT%{_libdir}
  tar cf - -C ${sysname}/dest/etc . | tar xf - -C $RPM_BUILD_ROOT%{_sbindir}
  tar cf - -C ${sysname}/dest/root.server%{_prefix}/afs bin | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/afs
! tar cf - -C ${sysname}/dest/root.client%{_prefix}/vice/etc afsd C | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/vice/etc
  
  # Link kpasswd to kapasswd
  ln -f $RPM_BUILD_ROOT%{_bindir}/kpasswd $RPM_BUILD_ROOT%{_bindir}/kapasswd
***************
*** 1049,1055 ****
  
  # Items below here should not have to change with each driver version
  PACKAGE_NAME="%{name}"
! MAKE[0]="SMP=SP; eval \\\`grep CONFIG_SMP /boot/config-\${kernelver_array[0]}\\\`; [ -n \"\\\$CONFIG_SMP\" ] && SMP=MP; ./configure --with-linux-kernel-headers=\${kernel_source_dir}; make MPS=\\\$SMP; mv src/libafs/MODLOAD-*/openafs.ko ."
  CLEAN="make -C src/libafs clean"
  
  BUILT_MODULE_NAME[0]="\$PACKAGE_NAME"
--- 1052,1058 ----
  
  # Items below here should not have to change with each driver version
  PACKAGE_NAME="%{name}"
! MAKE[0]="SMP=SP; eval \\\`grep CONFIG_SMP /boot/config-\${kernelver_array[0]}\\\`; [ -n \"\\\$CONFIG_SMP\" ] && SMP=MP; KMODNAME=openafs.ko; DSTKMOD=\\".\\"; [ \\"\\\`echo \\"\${kernelver_array[0]}\\" | sed -e 's/^\\([0-9]*\\.[0-9]*\\)\\..*/\\1/'\\\`\\" = \\"2.4\\" ] && KMODNAME=\\"libafs-*\\" && DSTKMOD=openafs.o; ./configure --with-linux-kernel-headers=\${kernel_source_dir}; make MPS=\\\$SMP; mv src/libafs/MODLOAD-*/\\\$KMODNAME \\\$DSTKMOD"
  CLEAN="make -C src/libafs clean"
  
  BUILT_MODULE_NAME[0]="\$PACKAGE_NAME"
***************
*** 1432,1443 ****
--- 1435,1448 ----
  %dir %{_prefix}/vice
  %dir %{_prefix}/vice/cache
  %dir %{_prefix}/vice/etc
+ %dir %{_prefix}/vice/etc/C
  %{_prefix}/vice/etc/CellServDB.dist
  %config %{_prefix}/vice/etc/ThisCell
  %config %{_prefix}/vice/etc/cacheinfo
  %{_bindir}/cmdebug
  %{_bindir}/up
  %{_prefix}/vice/etc/afsd
+ %{_prefix}/vice/etc/C/afszcm.cat
  %{pamdir}/pam_afs.krb.so.1
  %{pamdir}/pam_afs.krb.so
  %{pamdir}/pam_afs.so.1
***************
*** 1449,1454 ****
--- 1454,1460 ----
  %{_mandir}/man5/cacheinfo.*
  %{_mandir}/man8/afsd.*
  %{_mandir}/man5/CellAlias.*
+ %{_mandir}/man5/afszcm.cat.*
  
  %files server
  %defattr(-,root,root)
Index: openafs/src/pam/afs_util.c
diff -c openafs/src/pam/afs_util.c:1.12.2.6 openafs/src/pam/afs_util.c:1.12.2.7
*** openafs/src/pam/afs_util.c:1.12.2.6	Thu Dec 13 13:54:08 2007
--- openafs/src/pam/afs_util.c	Fri Mar 20 18:45:38 2009
***************
*** 21,31 ****
  #include <stdlib.h>
  #ifdef AFS_AIX51_ENV
  #include <sys/cred.h>
  #include <sys/pag.h>
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/afs_util.c,v 1.12.2.6 2007/12/13 18:54:08 shadow Exp $");
  
  #include "afs_util.h"
  
--- 21,33 ----
  #include <stdlib.h>
  #ifdef AFS_AIX51_ENV
  #include <sys/cred.h>
+ #ifdef HAVE_SYS_PAG_H
  #include <sys/pag.h>
  #endif
+ #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/pam/afs_util.c,v 1.12.2.7 2009/03/20 22:45:38 shadow Exp $");
  
  #include "afs_util.h"
  
Index: openafs/src/ptserver/pt_util.c
diff -c openafs/src/ptserver/pt_util.c:1.9.2.9 openafs/src/ptserver/pt_util.c:1.9.2.10
*** openafs/src/ptserver/pt_util.c:1.9.2.9	Mon Oct 27 19:54:10 2008
--- openafs/src/ptserver/pt_util.c	Sun Nov 30 15:25:02 2008
***************
*** 1,4 ****
! /* $Id: pt_util.c,v 1.9.2.9 2008/10/27 23:54:10 shadow Exp $ */
  
  /*
   *
--- 1,4 ----
! /* $Id: pt_util.c,v 1.9.2.10 2008/11/30 20:25:02 shadow Exp $ */
  
  /*
   *
***************
*** 21,29 ****
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.9.2.9 2008/10/27 23:54:10 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <afs/afsutil.h>
--- 21,30 ----
  
  #include <afsconfig.h>
  #include <afs/param.h>
+ #include <afs/com_err.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.9.2.10 2008/11/30 20:25:02 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <afs/afsutil.h>
Index: openafs/src/ptserver/ptprocs.c
diff -c openafs/src/ptserver/ptprocs.c:1.21.2.9 openafs/src/ptserver/ptprocs.c:1.21.2.10
*** openafs/src/ptserver/ptprocs.c:1.21.2.9	Tue Oct 30 11:24:02 2007
--- openafs/src/ptserver/ptprocs.c	Wed Mar 18 23:45:02 2009
***************
*** 51,57 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptprocs.c,v 1.21.2.9 2007/10/30 15:24:02 shadow Exp $");
  
  #include <afs/stds.h>
  #include <ctype.h>
--- 51,57 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptprocs.c,v 1.21.2.10 2009/03/19 03:45:02 shadow Exp $");
  
  #include <afs/stds.h>
  #include <ctype.h>
***************
*** 87,92 ****
--- 87,93 ----
  extern afs_int32 Initdb();
  extern int pr_noAuth;
  extern afs_int32 initd;
+ extern char *pr_realmName;
  afs_int32 iNewEntry(), newEntry(), whereIsIt(), dumpEntry(), addToGroup(),
  nameToID(), Delete(), removeFromGroup();
  afs_int32 getCPS(), getCPS2(), getHostCPS(), listMax(), setMax(), listEntry();
***************
*** 172,193 ****
  	if (exp < FT_ApproxTime())
  	    goto done;
  #endif
! 	if (strlen(tcell)) {
! 	    extern char *pr_realmName;
! #if	defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
! 	    static char local_realm[AFS_REALM_SZ] = "";
! 	    if (!local_realm[0]) {
! 		if (afs_krb_get_lrealm(local_realm, 0) != 0 /*KSUCCESS*/)
! 		    strncpy(local_realm, pr_realmName, AFS_REALM_SZ);
! 	    }
! #endif
! 	    if (
! #if	defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
! 		   strcasecmp(local_realm, tcell) &&
! #endif
! 		   strcasecmp(pr_realmName, tcell))
! 		foreign = 1;
! 	}
  	strncpy(vname, name, sizeof(vname));
  	if (ilen = strlen(inst)) {
  	    if (strlen(vname) + 1 + ilen >= sizeof(vname))
--- 173,181 ----
  	if (exp < FT_ApproxTime())
  	    goto done;
  #endif
! 	if (tcell[0])
! 	    foreign = afs_is_foreign_ticket_name(name,inst,tcell,pr_realmName);
! 
  	strncpy(vname, name, sizeof(vname));
  	if (ilen = strlen(inst)) {
  	    if (strlen(vname) + 1 + ilen >= sizeof(vname))
***************
*** 634,640 ****
  	ABORT_WITH(tt, code);
  
      for (i = 0; i < aname->namelist_len; i++) {
! 	code = NameToID(tt, aname->namelist_val[i], &aid->idlist_val[i]);
  	if (code != PRSUCCESS)
  	    aid->idlist_val[i] = ANONYMOUSID;
          osi_audit(PTS_NmToIdEvent, code, AUD_STR,
--- 622,645 ----
  	ABORT_WITH(tt, code);
  
      for (i = 0; i < aname->namelist_len; i++) {
! 	char vname[256];
! 	char *nameinst, *cell;
! 
! 	strncpy(vname, aname->namelist_val[i], sizeof(vname));
! 	vname[sizeof(vname)-1] ='\0';
! 
! 	nameinst = vname;
! 	cell = strchr(vname, '@');
! 	if (cell) {
! 	    *cell = '\0';
! 	    cell++;
! 	}
! 
! 	if (cell && afs_is_foreign_ticket_name(nameinst,NULL,cell,pr_realmName))
! 	    code = NameToID(tt, aname->namelist_val[i], &aid->idlist_val[i]);
! 	else 
! 	    code = NameToID(tt, nameinst, &aid->idlist_val[i]);
! 
  	if (code != PRSUCCESS)
  	    aid->idlist_val[i] = ANONYMOUSID;
          osi_audit(PTS_NmToIdEvent, code, AUD_STR,
***************
*** 2275,2281 ****
  }
  #endif /* IP_WILDCARDS */
  
- 
  afs_int32
  WhoIsThisWithName(acall, at, aid, aname)
       struct rx_call *acall;
--- 2280,2285 ----
***************
*** 2303,2313 ****
      } else if (code == 2) {	/* kad class */
  
  	int clen;
- 	extern char *pr_realmName;
  
  	if ((code = rxkad_GetServerInfo(acall->conn, NULL, 0 /*was &exp */ ,
  					name, inst, tcell, NULL)))
  	    goto done;
  	strncpy(vname, name, sizeof(vname));
  	if ((ilen = strlen(inst))) {
  	    if (strlen(vname) + 1 + ilen >= sizeof(vname))
--- 2307,2318 ----
      } else if (code == 2) {	/* kad class */
  
  	int clen;
  
  	if ((code = rxkad_GetServerInfo(acall->conn, NULL, 0 /*was &exp */ ,
  					name, inst, tcell, NULL)))
  	    goto done;
+ 
+ 
  	strncpy(vname, name, sizeof(vname));
  	if ((ilen = strlen(inst))) {
  	    if (strlen(vname) + 1 + ilen >= sizeof(vname))
***************
*** 2316,2334 ****
  	    strcat(vname, inst);
  	}
  	if ((clen = strlen(tcell))) {
  
! #if	defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
! 	    static char local_realm[AFS_REALM_SZ] = "";
! 	    if (!local_realm[0]) {
! 		if (afs_krb_get_lrealm(local_realm, 0) != 0 /*KSUCCESS*/)
! 		    strncpy(local_realm, pr_realmName, AFS_REALM_SZ);
! 	    }
! #endif
! 	    if (
! #if	defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
! 		   strcasecmp(local_realm, tcell) &&
! #endif
! 		   strcasecmp(pr_realmName, tcell)) {
  		if (strlen(vname) + 1 + clen >= sizeof(vname))
  		    goto done;
  		strcat(vname, "@");
--- 2321,2329 ----
  	    strcat(vname, inst);
  	}
  	if ((clen = strlen(tcell))) {
+ 	    int foreign = afs_is_foreign_ticket_name(name,inst,tcell,pr_realmName);
  
! 	    if (foreign) {
  		if (strlen(vname) + 1 + clen >= sizeof(vname))
  		    goto done;
  		strcat(vname, "@");
Index: openafs/src/ptserver/ptserver.c
diff -c openafs/src/ptserver/ptserver.c:1.21.2.12 openafs/src/ptserver/ptserver.c:1.21.2.14
*** openafs/src/ptserver/ptserver.c:1.21.2.12	Sun Aug 24 21:15:20 2008
--- openafs/src/ptserver/ptserver.c	Mon Dec 22 14:23:32 2008
***************
*** 113,119 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.21.2.12 2008/08/25 01:15:20 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
--- 113,119 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.21.2.14 2008/12/22 19:23:32 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
***************
*** 336,370 ****
  	}
  #endif
  	else if (strncmp(arg, "-auditlog", alen) == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++a];
  
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		    osi_audit(PTS_StartEvent, 0, AUD_END);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	}
  	else if (!strncmp(arg, "-rxmaxmtu", alen)) {
  	    if ((a + 1) >= argc) {
--- 336,345 ----
  	}
  #endif
  	else if (strncmp(arg, "-auditlog", alen) == 0) {
  	    char *fileName = argv[++a];
  
!             osi_audit_file(fileName);
!             osi_audit(PTS_StartEvent, 0, AUD_END);
  	}
  	else if (!strncmp(arg, "-rxmaxmtu", alen)) {
  	    if ((a + 1) >= argc) {
***************
*** 536,542 ****
      }
  
      code =
! 	ubik_ServerInitByInfo(myHost, htons(AFSCONF_PROTPORT), &info, &clones,
  			      pr_dbaseName, &dbase);
      if (code) {
  	afs_com_err(whoami, code, "Ubik init failed");
--- 511,517 ----
      }
  
      code =
! 	ubik_ServerInitByInfo(myHost, htons(AFSCONF_PROTPORT), &info, clones,
  			      pr_dbaseName, &dbase);
      if (code) {
  	afs_com_err(whoami, code, "Ubik init failed");
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.58.2.53 openafs/src/rx/rx.c:1.58.2.55
*** openafs/src/rx/rx.c:1.58.2.53	Thu Sep 25 13:26:47 2008
--- openafs/src/rx/rx.c	Sat Mar  7 09:11:01 2009
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58.2.53 2008/09/25 17:26:47 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58.2.55 2009/03/07 14:11:01 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
***************
*** 5380,5386 ****
       * idle connections) */
      conn->lastSendTime = call->lastSendTime = clock_Sec();
      /* Don't count keepalives here, so idleness can be tracked. */
!     if (p->header.type != RX_PACKET_TYPE_ACK)
  	call->lastSendData = call->lastSendTime;
  }
  
--- 5380,5386 ----
       * idle connections) */
      conn->lastSendTime = call->lastSendTime = clock_Sec();
      /* Don't count keepalives here, so idleness can be tracked. */
!     if ((p->header.type != RX_PACKET_TYPE_ACK) || (((struct rx_ackPacket *)rx_DataOf(p))->reason != RX_ACK_PING))
  	call->lastSendData = call->lastSendTime;
  }
  
***************
*** 5789,5796 ****
  		for (i = 0; i < RX_MAXCALLS; i++) {
  		    call = conn->call[i];
  		    if (call) {
  			havecalls = 1;
! 			MUTEX_ENTER(&call->lock);
  #ifdef RX_ENABLE_LOCKS
  			result = rxi_CheckCall(call, 1);
  #else /* RX_ENABLE_LOCKS */
--- 5789,5799 ----
  		for (i = 0; i < RX_MAXCALLS; i++) {
  		    call = conn->call[i];
  		    if (call) {
+ 			int code;
  			havecalls = 1;
! 			code = MUTEX_TRYENTER(&call->lock);
! 			if (!code)
! 			    continue;
  #ifdef RX_ENABLE_LOCKS
  			result = rxi_CheckCall(call, 1);
  #else /* RX_ENABLE_LOCKS */
Index: openafs/src/rx/rx_prototypes.h
diff -c openafs/src/rx/rx_prototypes.h:1.14.2.23 openafs/src/rx/rx_prototypes.h:1.14.2.24
*** openafs/src/rx/rx_prototypes.h:1.14.2.23	Thu Sep 25 13:16:14 2008
--- openafs/src/rx/rx_prototypes.h	Sat Mar 21 11:46:07 2009
***************
*** 583,590 ****
--- 583,594 ----
  extern void rxi_InitPeerParams(struct rx_peer *pp);
  
  #if defined(AFS_AIX32_ENV) && !defined(KERNEL)
+ #ifndef osi_Alloc
  extern void *osi_Alloc(afs_int32 x);
+ #endif
+ #ifndef osi_Free
  extern void osi_Free(void *x, afs_int32 size);
+ #endif
  #endif /* defined(AFS_AIX32_ENV) && !defined(KERNEL) */
  
  extern void rx_GetIFInfo(void);
Index: openafs/src/rx/rx_rdwr.c
diff -c openafs/src/rx/rx_rdwr.c:1.21.2.11 openafs/src/rx/rx_rdwr.c:1.21.2.13
*** openafs/src/rx/rx_rdwr.c:1.21.2.11	Thu Oct  2 07:55:03 2008
--- openafs/src/rx/rx_rdwr.c	Mon Jan  5 18:17:48 2009
***************
*** 15,21 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_rdwr.c,v 1.21.2.11 2008/10/02 11:55:03 jaltman Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 15,21 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_rdwr.c,v 1.21.2.13 2009/01/05 23:17:48 jaltman Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 231,236 ****
--- 231,238 ----
  		    osi_rxSleep(&call->rq);
  #endif
  		}
+                 /* cp is no longer valid since we may have given up the lock */
+                 cp = call->currentPacket;
  
  		call->startWait = 0;
  #ifdef RX_ENABLE_LOCKS
***************
*** 690,695 ****
--- 692,703 ----
      do {
  	if (call->nFree == 0) {
  	    if (!call->error && cp) {
+                 /* Clear the current packet now so that if
+                  * we are forced to wait and drop the lock 
+                  * the packet we are planning on using 
+                  * cannot be freed.
+                  */
+ 		call->currentPacket = (struct rx_packet *)0;
  #ifdef AFS_GLOBAL_RXLOCK_KERNEL
  		/* Wait until TQ_BUSY is reset before adding any
  		 * packets to the transmit queue
***************
*** 711,717 ****
  		hadd32(call->bytesSent, cp->length);
  		rxi_PrepareSendPacket(call, cp, 0);
  		queue_Append(&call->tq, cp);
! 		cp = call->currentPacket = NULL;
  		if (!
  		    (call->
  		     flags & (RX_CALL_FAST_RECOVER |
--- 719,725 ----
  		hadd32(call->bytesSent, cp->length);
  		rxi_PrepareSendPacket(call, cp, 0);
  		queue_Append(&call->tq, cp);
! 		cp = NULL;
  		if (!
  		    (call->
  		     flags & (RX_CALL_FAST_RECOVER |
***************
*** 1050,1056 ****
  int
  rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
  {
!     struct rx_packet *cp = call->currentPacket;
      int nextio;
      int requestCount;
      struct rx_queue tmpq;
--- 1058,1064 ----
  int
  rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
  {
!     struct rx_packet *cp = NULL;
      int nextio;
      int requestCount;
      struct rx_queue tmpq;
***************
*** 1073,1078 ****
--- 1081,1088 ----
  #endif /* RX_ENABLE_LOCKS */
      }
  #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
+     /* cp is no longer valid since we may have given up the lock */
+     cp = call->currentPacket;
  
      if (call->error) {
  	if (cp) {
***************
*** 1171,1176 ****
--- 1181,1188 ----
  #endif
  	call->startWait = 0;
      }
+     /* cp is no longer valid since we may have given up the lock */
+     cp = call->currentPacket;
  
      if (call->error) {
  	if (cp) {
***************
*** 1202,1208 ****
  void
  rxi_FlushWrite(register struct rx_call *call)
  {
!     register struct rx_packet *cp = call->currentPacket;
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
--- 1214,1220 ----
  void
  rxi_FlushWrite(register struct rx_call *call)
  {
!     register struct rx_packet *cp = NULL;
  
      /* Free any packets from the last call to ReadvProc/WritevProc */
      if (queue_IsNotEmpty(&call->iovq)) {
***************
*** 1242,1247 ****
--- 1254,1262 ----
  	}
  #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
  
+         /* cp is no longer valid since we may have given up the lock */
+         cp = call->currentPacket;
+ 
  	if (cp) {
  	    /* cp->length is only supposed to be the user's data */
  	    /* cp->length was already set to (then-current) 
Index: openafs/src/rxdebug/rxdumptrace.c
diff -c /dev/null openafs/src/rxdebug/rxdumptrace.c:1.1.4.2
*** /dev/null	Wed Mar 25 23:28:18 2009
--- openafs/src/rxdebug/rxdumptrace.c	Mon Feb 16 23:25:42 2009
***************
*** 0 ****
--- 1,103 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #include <afsconfig.h>
+ #include <afs/param.h>
+ 
+ RCSID
+     ("$Header: /cvs/openafs/src/rxdebug/rxdumptrace.c,v 1.1.4.2 2009/02/17 04:25:42 shadow Exp $");
+ 
+ #ifdef RXDEBUG
+ #include <string.h>
+ #ifdef AFS_NT40_ENV
+ #include <fcntl.h>
+ #include <io.h>
+ #else
+ #include <sys/file.h>
+ #include <unistd.h>
+ #endif
+ #include "rx.h"
+ #include "rx_globals.h"
+ #include "rx_trace.h"
+ 
+ extern char *rxi_tracename;
+ extern int rxi_logfd;
+ 
+ struct rx_trace {
+     afs_uint32 cid;
+     unsigned short call;
+     unsigned short qlen;
+     afs_uint32 now;
+     afs_uint32 waittime;
+     afs_uint32 servicetime;
+     afs_uint32 event;
+ };
+ 
+ #include <errno.h>
+ #ifdef AFS_NT40_ENV
+ #include <afs/afsutil.h>
+ #endif
+ 
+ int
+ main(argc, argv)
+      char **argv;
+ {
+     struct rx_trace ip;
+     int err = 0;
+ 
+     setlinebuf(stdout);
+     argv++;
+     argc--;
+     while (argc && **argv == '-') {
+ 	if (strcmp(*argv, "-trace") == 0) {
+ 	    strcpy(rxi_tracename, *(++argv));
+ 	    argc--;
+ 	} else {
+ 	    err++;
+ 	    break;
+ 	}
+ 	argv++, argc--;
+     }
+     if (err || argc != 0) {
+ 	printf("usage: dumptrace [-trace pathname]");
+ 	exit(1);
+     }
+ 
+     rxi_logfd = open(rxi_tracename, O_RDONLY);
+     if (rxi_logfd < 0) {
+ 	perror("");
+ 	exit(errno);
+     }
+ 
+     while (read(rxi_logfd, &ip, sizeof(struct rx_trace))) {
+ 	printf("%9u ", ip.now);
+ 	switch (ip.event) {
+ 	case RX_CALL_END:
+ 	    putchar('E');
+ 	    break;
+ 	case RX_CALL_START:
+ 	    putchar('S');
+ 	    break;
+ 	case RX_CALL_ARRIVAL:
+ 	    putchar('A');
+ 	    break;
+ 	case RX_TRACE_DROP:
+ 	    putchar('D');
+ 	    break;
+ 	default:
+ 	    putchar('U');
+ 	    break;
+ 	}
+ 	printf(" %3u %7u %7u      %x.%x\n", ip.qlen, ip.servicetime,
+ 	       ip.waittime, ip.cid, ip.call);
+     }
+     return 0;
+ }
+ 
+ #endif
Index: openafs/src/rxgen/rpc_main.c
diff -c openafs/src/rxgen/rpc_main.c:1.21.2.7 openafs/src/rxgen/rpc_main.c:1.21.2.8
*** openafs/src/rxgen/rpc_main.c:1.21.2.7	Mon Jun 30 19:57:46 2008
--- openafs/src/rxgen/rpc_main.c	Sun Dec 21 01:05:22 2008
***************
*** 37,43 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxgen/rpc_main.c,v 1.21.2.7 2008/06/30 23:57:46 rra Exp $");
  
  #include <limits.h>
  #include <stdio.h>
--- 37,43 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxgen/rpc_main.c,v 1.21.2.8 2008/12/21 06:05:22 jaltman Exp $");
  
  #include <limits.h>
  #include <stdio.h>
***************
*** 94,104 ****
--- 94,108 ----
  char yflag = 0;			/* if set, only emit function name arrays to xdr file */
  int debug = 0;
  static char *cmdname;
+ #ifdef AFS_NT40_ENV
+ static char *CPP = NULL;
+ #else /* AFS_NT40_ENV */
  #ifdef PATH_CPP
  static char CPP[] = PATH_CPP;
  #else
  static char CPP[] = "/lib/cpp";
  #endif
+ #endif /* AFS_NT40_ENV */
  static char CPPFLAGS[] = "-C";
  
  #ifdef	AFS_ALPHA_ENV
***************
*** 144,159 ****
  main(int argc, char *argv[])
  {
      struct commandline cmd;
- #ifdef AFS_NT40_ENV
-     char *ep;
  
!     /* initialize CPP with the correct pre-processor on NT */
!     ep = getenv("RXGEN_CPPCMD");
!     if (ep)
! 	strcpy(CPP, ep);
!     else
! 	strcpy(CPP, "cl /EP /C /nologo");
! #endif
  #ifdef	AFS_AIX32_ENV
      /*
       * The following signal action for AIX is necessary so that in case of a 
--- 148,161 ----
  main(int argc, char *argv[])
  {
      struct commandline cmd;
  
! #ifdef AFS_NT40_ENV
!     /* initialize CPP with the correct pre-processor for Windows */
!     CPP = getenv("RXGEN_CPPCMD");
!     if (!CPP)
! 	CPP = "cl /EP /C /nologo";
! #endif /* AFS_NT40_ENV */
!     
  #ifdef	AFS_AIX32_ENV
      /*
       * The following signal action for AIX is necessary so that in case of a 
Index: openafs/src/sys/pagsh.c
diff -c openafs/src/sys/pagsh.c:1.9.2.8 openafs/src/sys/pagsh.c:1.9.2.9
*** openafs/src/sys/pagsh.c:1.9.2.8	Thu Dec 13 16:23:42 2007
--- openafs/src/sys/pagsh.c	Fri Mar 20 18:45:37 2009
***************
*** 11,23 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/sys/pagsh.c,v 1.9.2.8 2007/12/13 21:23:42 shadow Exp $");
  
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
  #ifdef AFS_AIX51_ENV
  #include <sys/cred.h>
  #include <sys/pag.h>
  #include <errno.h>
  #endif
  #endif
--- 11,25 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/sys/pagsh.c,v 1.9.2.9 2009/03/20 22:45:37 shadow Exp $");
  
  #ifdef	AFS_AIX32_ENV
  #include <signal.h>
  #ifdef AFS_AIX51_ENV
  #include <sys/cred.h>
+ #ifdef HAVE_SYS_PAG_H
  #include <sys/pag.h>
+ #endif
  #include <errno.h>
  #endif
  #endif
Index: openafs/src/tests/afs-newcell.pl
diff -c openafs/src/tests/afs-newcell.pl:1.1.10.2 openafs/src/tests/afs-newcell.pl:1.1.10.3
*** openafs/src/tests/afs-newcell.pl:1.1.10.2	Mon Mar 31 11:53:48 2008
--- openafs/src/tests/afs-newcell.pl	Mon Mar 16 23:07:21 2009
***************
*** 584,589 ****
--- 584,590 ----
      unwind($os->command('remove', "$path->{'afsconfdir'}/ThisCell"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/CellServDB"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/UserList"));
+     unwind($os->command('remove', "$path->{'afsconfdir'}/KeyFile"));
      unwind($os->command('remove', "$path->{'afsbosconfigdir'}/BosConfig"));
      unwind($os->command('fileserver-stop'));
  }
***************
*** 680,686 ****
  if ($with_dafs) {
    run( "$bos create $server dafs dafs ".
         "-cmd \"$path->{'afssrvlibexecdir'}/fileserver $options_fileserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/volserver $options_volserver\"".
         "-cmd \"$path->{'afssrvlibexecdir'}/salvageserver $options_salvageserver\" ".
         "-cmd \"$path->{'afssrvlibexecdir'}/salvager $options_salvager\" ".
         "-noauth");
--- 681,687 ----
  if ($with_dafs) {
    run( "$bos create $server dafs dafs ".
         "-cmd \"$path->{'afssrvlibexecdir'}/fileserver $options_fileserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/volserver $options_volserver\" ".
         "-cmd \"$path->{'afssrvlibexecdir'}/salvageserver $options_salvageserver\" ".
         "-cmd \"$path->{'afssrvlibexecdir'}/salvager $options_salvager\" ".
         "-noauth");
Index: openafs/src/tests/OpenAFS/Auth.pm
diff -c openafs/src/tests/OpenAFS/Auth.pm:1.1.4.3 openafs/src/tests/OpenAFS/Auth.pm:1.1.4.4
*** openafs/src/tests/OpenAFS/Auth.pm:1.1.4.3	Mon Mar 31 11:53:50 2008
--- openafs/src/tests/OpenAFS/Auth.pm	Mon Mar 16 23:07:23 2009
***************
*** 380,386 ****
    my $self = shift;
    my $principal = shift || 'admin';
    #run("echo \"Proceeding w/o authentication\"|klog -pipe ${principal}\@$self->{'realm'}");
!   run("klog $principal\@$self->{'realm'}");
  }
  
  1;
--- 380,386 ----
    my $self = shift;
    my $principal = shift || 'admin';
    #run("echo \"Proceeding w/o authentication\"|klog -pipe ${principal}\@$self->{'realm'}");
!   run("klog $principal");
  }
  
  1;
Index: openafs/src/tests/OpenAFS/vos.pm
diff -c openafs/src/tests/OpenAFS/vos.pm:1.1 openafs/src/tests/OpenAFS/vos.pm:1.1.10.1
*** openafs/src/tests/OpenAFS/vos.pm:1.1	Tue Jan 15 14:22:11 2002
--- openafs/src/tests/OpenAFS/vos.pm	Mon Mar 16 23:07:23 2009
***************
*** 144,149 ****
--- 144,150 ----
  #: - id           ID of this volume
  #: - kind         Kind of volume (RW, RO, or BK)
  #: - inuse        Disk space in use
+ #: - state        On-line or Off-line
  #: - maxquota     Maximum disk usage quota
  #: - minquota     Minimum disk usage quota (optional)
  #: - stamp_create Time when volume was originally created
***************
*** 172,178 ****
    push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
    %result = &wrapper('vos', \@args,
  		     [$vos_err_parse,
! 		      ['^(\S+)\s*(\d+)\s*(RW|RO|BK)\s*(\d+)\s*K',          'name', 'id', 'kind', 'inuse'],
  		      ['MaxQuota\s*(\d+)\s*K',                             'maxquota'     ],
  		      ['MinQuota\s*(\d+)\s*K',                             'minquota'     ],
  		      ['Creation\s*(.*\S+)',                               'stamp_create' ],
--- 173,179 ----
    push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
    %result = &wrapper('vos', \@args,
  		     [$vos_err_parse,
! 		      ['^(\S+)\s*(\d+)\s*(RW|RO|BK)\s*(\d+)\s*K\s*([-\w]+)',          'name', 'id', 'kind', 'inuse', 'state'],
  		      ['MaxQuota\s*(\d+)\s*K',                             'maxquota'     ],
  		      ['MinQuota\s*(\d+)\s*K',                             'minquota'     ],
  		      ['Creation\s*(.*\S+)',                               'stamp_create' ],
Index: openafs/src/tests/OpenAFS/wrapper.pm
diff -c openafs/src/tests/OpenAFS/wrapper.pm:1.1 openafs/src/tests/OpenAFS/wrapper.pm:1.1.10.1
*** openafs/src/tests/OpenAFS/wrapper.pm:1.1	Tue Jan 15 14:22:11 2002
--- openafs/src/tests/OpenAFS/wrapper.pm	Mon Mar 16 23:07:23 2009
***************
*** 77,83 ****
  
  If specified, the path to be used for the program to execute, instead of
  deriving it from the command name.  This is useful when we want the
! command's argv[0] (which is always I<$cmd}) to be different from the
  path to the program.
  
  =item errors_last
--- 77,83 ----
  
  If specified, the path to be used for the program to execute, instead of
  deriving it from the command name.  This is useful when we want the
! command's argv[0] (which is always I<$cmd>) to be different from the
  path to the program.
  
  =item errors_last
Index: openafs/src/tsm41/Makefile.in
diff -c openafs/src/tsm41/Makefile.in:1.7.6.3 openafs/src/tsm41/Makefile.in:1.7.6.5
*** openafs/src/tsm41/Makefile.in:1.7.6.3	Fri Jul 13 15:55:21 2007
--- openafs/src/tsm41/Makefile.in	Fri Mar 20 18:59:17 2009
***************
*** 58,66 ****
  		aix_ktc_krb.o \
  
  AUTHLIBS= \
! 		afs_dynamic_auth \
! 		aklog_dynamic_auth \
! 		afs_dynamic_kerbauth
  
  IMPORTS = -bI:/lib/aio.exp -bI:/lib/netinet.exp -bI:/lib/sockets.exp -bI:/lib/statcmd.exp 
  LDFLAGS = -eafs_initialize ${IMPORTS} -lsys -lcsys -lc
--- 58,64 ----
  		aix_ktc_krb.o \
  
  AUTHLIBS= \
! 		afs_dynamic_auth afs_dynamic_kerbauth @MAKE_KRB5@ aklog_dynamic_auth
  
  IMPORTS = -bI:/lib/aio.exp -bI:/lib/netinet.exp -bI:/lib/sockets.exp -bI:/lib/statcmd.exp 
  LDFLAGS = -eafs_initialize ${IMPORTS} -lsys -lcsys -lc
***************
*** 71,77 ****
  install install.noversion:
  
  clean:
! 	$(RM) -f $(AUTHLIBS) $(AUTHFILES) so_locations
  
  afs_dynamic_auth: ${AUTH_OBJS} ${AFSLIBS} ${AUTHFILES}
  	$(LD) -o $@ ${AUTH_OBJS} $(AFSLIBS) ${AUTHFILES} ${XLIBS} ${LDFLAGS}
--- 69,75 ----
  install install.noversion:
  
  clean:
! 	$(RM) -f *.o $(AUTHLIBS) $(AUTHFILES) so_locations
  
  afs_dynamic_auth: ${AUTH_OBJS} ${AFSLIBS} ${AUTHFILES}
  	$(LD) -o $@ ${AUTH_OBJS} $(AFSLIBS) ${AUTHFILES} ${XLIBS} ${LDFLAGS}
***************
*** 100,105 ****
--- 98,105 ----
  		${CC} ${CFLAGS} -c ${srcdir}/aix41_auth.c -o $@ ;; \
  	rs_aix5*) \
  		${CC} ${CFLAGS} -c ${srcdir}/aix5_auth.c -o $@ ;; \
+ 	rs_aix6*) \
+ 		${CC} ${CFLAGS} -c ${srcdir}/aix5_auth.c -o $@ ;; \
  	*) \
  		echo "not building aix lam binary for ${SYS_NAME}" ;; \
  	esac
***************
*** 114,120 ****
  ${DEST}/root.client/usr/vice/etc/afs_dynamic_kerbauth: afs_dynamic_kerbauth
  	${INSTALL} $? $@
  
  dest: \
! 	${DEST}/root.client/usr/vice/etc/afs_dynamic_auth \
! 	${DEST}/root.client/usr/vice/etc/afs_dynamic_kerbauth
  
--- 114,122 ----
  ${DEST}/root.client/usr/vice/etc/afs_dynamic_kerbauth: afs_dynamic_kerbauth
  	${INSTALL} $? $@
  
+ ${DEST}/root.client/usr/vice/etc/aklog_dynamic_auth: aklog_dynamic_auth
+ 	${INSTALL} $? $@
+ 
  dest: \
! 	${DEST}/root.client/usr/vice/etc/afs_dynamic_auth ${DEST}/root.client/usr/vice/etc/afs_dynamic_kerbauth @MAKE_KRB5@ ${DEST}/root.client/usr/vice/etc/aklog_dynamic_auth
  
Index: openafs/src/tsm41/aix_aklog.c
diff -c openafs/src/tsm41/aix_aklog.c:1.1.4.6 openafs/src/tsm41/aix_aklog.c:1.1.4.8
*** openafs/src/tsm41/aix_aklog.c:1.1.4.6	Thu Jan  3 13:05:26 2008
--- openafs/src/tsm41/aix_aklog.c	Fri Mar 20 18:45:38 2009
***************
*** 9,17 ****
  
  #include <afsconfig.h>
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/tsm41/aix_aklog.c,v 1.1.4.6 2008/01/03 18:05:26 shadow Exp $");
  
  #if defined(AFS_AIX51_ENV)
  #include <sys/types.h>
--- 9,18 ----
  
  #include <afsconfig.h>
  #include <afs/param.h>
+ #include <afs/com_err.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/tsm41/aix_aklog.c,v 1.1.4.8 2009/03/20 22:45:38 shadow Exp $");
  
  #if defined(AFS_AIX51_ENV)
  #include <sys/types.h>
***************
*** 23,29 ****
--- 24,32 ----
  #include <netdb.h>
  #include <sys/socket.h>
  #include <sys/file.h>
+ #ifdef HAVE_SYS_PAG_H
  #include <sys/pag.h>
+ #endif
  #include <errno.h>
  #include <usersec.h>
  #include <syslog.h>
Index: openafs/src/ubik/recovery.c
diff -c openafs/src/ubik/recovery.c:1.13.2.7 openafs/src/ubik/recovery.c:1.13.2.9
*** openafs/src/ubik/recovery.c:1.13.2.7	Sat Oct 18 11:24:57 2008
--- openafs/src/ubik/recovery.c	Thu Mar 19 23:49:16 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/recovery.c,v 1.13.2.7 2008/10/18 15:24:57 jaltman Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/recovery.c,v 1.13.2.9 2009/03/20 03:49:16 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 578,584 ****
  	    }
  #ifndef OLD_URECOVERY
  	    flen = length;
! 	    afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.TMP", ubik_dbase->pathName);
  	    fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600);
  	    if (fd < 0) {
  		code = errno;
--- 578,584 ----
  	    }
  #ifndef OLD_URECOVERY
  	    flen = length;
! 	    afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
  	    fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600);
  	    if (fd < 0) {
  		code = errno;
***************
*** 639,665 ****
  #ifdef OLD_URECOVERY
  		(*ubik_dbase->sync) (ubik_dbase, 0);	/* get data out first */
  #else
! 		afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB0", ubik_dbase->pathName);
  #ifdef AFS_NT40_ENV
! 		afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName);
  		code = unlink(pbuffer);
  		if (!code)
  		    code = rename(tbuffer, pbuffer);
! 		afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.TMP", ubik_dbase->pathName);
  #endif
  		if (!code) 
  		    code = rename(pbuffer, tbuffer);
! 		if (!code) 
! 		    code = (*ubik_dbase->open) (ubik_dbase, 0);
! 		if (!code)
  #endif
! 		/* after data is good, sync disk with correct label */
! 		code =
! 		    (*ubik_dbase->setlabel) (ubik_dbase, 0,
! 					     &ubik_dbase->version);
  #ifndef OLD_URECOVERY
  #ifdef AFS_NT40_ENV
! 		afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName);
  		unlink(pbuffer);
  #endif
  #endif
--- 639,665 ----
  #ifdef OLD_URECOVERY
  		(*ubik_dbase->sync) (ubik_dbase, 0);	/* get data out first */
  #else
! 		afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
  #ifdef AFS_NT40_ENV
! 		afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
  		code = unlink(pbuffer);
  		if (!code)
  		    code = rename(tbuffer, pbuffer);
! 		afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
  #endif
  		if (!code) 
  		    code = rename(pbuffer, tbuffer);
! 		if (!code) {
! 		    (*ubik_dbase->open) (ubik_dbase, 0);
  #endif
! 		    /* after data is good, sync disk with correct label */
! 		    code =
! 			(*ubik_dbase->setlabel) (ubik_dbase, 0,
! 						 &ubik_dbase->version);
  #ifndef OLD_URECOVERY
+ 		}
  #ifdef AFS_NT40_ENV
! 		afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
  		unlink(pbuffer);
  #endif
  #endif
Index: openafs/src/ubik/remote.c
diff -c openafs/src/ubik/remote.c:1.12.2.9 openafs/src/ubik/remote.c:1.12.2.11
*** openafs/src/ubik/remote.c:1.12.2.9	Mon Oct 27 19:54:10 2008
--- openafs/src/ubik/remote.c	Thu Mar 19 23:49:16 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.12.2.9 2008/10/27 23:54:10 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.12.2.11 2009/03/20 03:49:16 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 550,556 ****
      (*dbase->setlabel) (dbase, file, &tversion);	/* setlabel does sync */
  #ifndef OLD_URECOVERY
      flen = length;
!     afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.TMP", ubik_dbase->pathName);
      fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600);
      if (fd < 0) {
  	code = errno;
--- 550,556 ----
      (*dbase->setlabel) (dbase, file, &tversion);	/* setlabel does sync */
  #ifndef OLD_URECOVERY
      flen = length;
!     afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
      fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600);
      if (fd < 0) {
  	code = errno;
***************
*** 605,628 ****
  #ifdef OLD_URECOVERY
      (*ubik_dbase->sync) (dbase, file);
  #else
!     afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB0", ubik_dbase->pathName);
  #ifdef AFS_NT40_ENV
!     afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName);
      code = unlink(pbuffer);
      if (!code)
  	code = rename(tbuffer, pbuffer);
!     afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.TMP", ubik_dbase->pathName);
  #endif
      if (!code) 
  	code = rename(pbuffer, tbuffer);
!     if (!code) 
! 	code = (*ubik_dbase->open) (ubik_dbase, 0);
!     if (!code)
  #endif
!     code = (*ubik_dbase->setlabel) (dbase, file, avers);
  #ifndef OLD_URECOVERY
  #ifdef AFS_NT40_ENV
!     afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName);
      unlink(pbuffer);
  #endif
  #endif
--- 605,628 ----
  #ifdef OLD_URECOVERY
      (*ubik_dbase->sync) (dbase, file);
  #else
!     afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
  #ifdef AFS_NT40_ENV
!     afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
      code = unlink(pbuffer);
      if (!code)
  	code = rename(tbuffer, pbuffer);
!     afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
  #endif
      if (!code) 
  	code = rename(pbuffer, tbuffer);
!     if (!code) {
! 	(*ubik_dbase->open) (ubik_dbase, 0);
  #endif
! 	code = (*ubik_dbase->setlabel) (dbase, file, avers);
  #ifndef OLD_URECOVERY
+     }
  #ifdef AFS_NT40_ENV
!     afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file);
      unlink(pbuffer);
  #endif
  #endif
Index: openafs/src/ubik/ubik.p.h
diff -c openafs/src/ubik/ubik.p.h:1.11.2.7 openafs/src/ubik/ubik.p.h:1.11.2.8
*** openafs/src/ubik/ubik.p.h:1.11.2.7	Mon Apr 28 17:48:25 2008
--- openafs/src/ubik/ubik.p.h	Mon Mar 16 09:46:22 2009
***************
*** 164,170 ****
      int (*sync) (struct ubik_dbase * adbase, afs_int32 afile);
      int (*stat) (struct ubik_dbase * adbase, afs_int32 afid,
  		 struct ubik_stat * astat);
!     int (*open) (struct ubik_dbase * adbase, afs_int32 afid);
      int (*setlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/* set the version label */
      int (*getlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/* retrieve the version label */
      int (*getnfiles) (struct ubik_dbase * adbase);	/* find out number of files */
--- 164,170 ----
      int (*sync) (struct ubik_dbase * adbase, afs_int32 afile);
      int (*stat) (struct ubik_dbase * adbase, afs_int32 afid,
  		 struct ubik_stat * astat);
!     void (*open) (struct ubik_dbase * adbase, afs_int32 afid);
      int (*setlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/* set the version label */
      int (*getlabel) (struct ubik_dbase * adbase, afs_int32 afile, struct ubik_version * aversion);	/* retrieve the version label */
      int (*getnfiles) (struct ubik_dbase * adbase);	/* find out number of files */
Index: openafs/src/update/client.c
diff -c openafs/src/update/client.c:1.12.2.2 openafs/src/update/client.c:1.12.2.3
*** openafs/src/update/client.c:1.12.2.2	Tue Oct 30 11:24:08 2007
--- openafs/src/update/client.c	Tue Feb  3 14:44:51 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/update/client.c,v 1.12.2.2 2007/10/30 15:24:08 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/update/client.c,v 1.12.2.3 2009/02/03 19:44:51 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
***************
*** 449,455 ****
      if (fstat(fd, &status) < 0) {
  	afs_com_err(whoami, errno, "Could not stat %s", localFile);
  	close(fd);
! 	printf("could not stast %s\n", localFile);
  	return UPDATE_ERROR;
      }
      if (update_ReceiveFile(fd, call, &status))
--- 449,455 ----
      if (fstat(fd, &status) < 0) {
  	afs_com_err(whoami, errno, "Could not stat %s", localFile);
  	close(fd);
! 	printf("could not stat %s\n", localFile);
  	return UPDATE_ERROR;
      }
      if (update_ReceiveFile(fd, call, &status))
***************
*** 676,681 ****
--- 676,682 ----
      if (errcode) {
  	printf("failed to fetch file %s \n", filename);
  	afs_com_err(whoami, errcode, "fetching file");
+         unlink(newfile);
  	return 1;
      }
  
***************
*** 686,691 ****
--- 687,693 ----
  	       (unsigned int)mode);
  	afs_com_err(whoami, errno, "could not change protection on %s to %u",
  		newfile, mode);
+         unlink(newfile);
  	return 1;
      }
  #ifdef AFS_NT40_ENV
***************
*** 713,718 ****
--- 715,721 ----
  	afs_com_err(whoami, errno,
  		"could not change access and modify times on %s to %u %u",
  		newfile, atime, mtime);
+         unlink(newfile);
  	return 1;
      }
  
Index: openafs/src/util/afsutil.h
diff -c openafs/src/util/afsutil.h:1.17.2.7 openafs/src/util/afsutil.h:1.17.2.9
*** openafs/src/util/afsutil.h:1.17.2.7	Tue Aug 26 10:12:24 2008
--- openafs/src/util/afsutil.h	Sun Dec 21 00:59:57 2008
***************
*** 43,50 ****
  extern void SetLogThreadNumProgram(int (*func) (void) );
  
  /*@printflike@*/ extern void FSLog(const char *format, ...);
! #define ViceLog(level, str)  if ((level) <= LogLevel) (FSLog str)
! #define vViceLog(level, str) if ((level) <= LogLevel) (vFSLog str)
  
  extern int OpenLog(const char *filename);
  extern int ReOpenLog(const char *fileName);
--- 43,50 ----
  extern void SetLogThreadNumProgram(int (*func) (void) );
  
  /*@printflike@*/ extern void FSLog(const char *format, ...);
! #define ViceLog(level, str)  do { if ((level) <= LogLevel) (FSLog str); } while (0)
! #define vViceLog(level, str) do { if ((level) <= LogLevel) (vFSLog str); } while (0)
  
  extern int OpenLog(const char *filename);
  extern int ReOpenLog(const char *fileName);
Index: openafs/src/util/afsutil_prototypes.h
diff -c openafs/src/util/afsutil_prototypes.h:1.7.2.5 openafs/src/util/afsutil_prototypes.h:1.7.2.6
*** openafs/src/util/afsutil_prototypes.h:1.7.2.5	Wed Oct 31 00:26:29 2007
--- openafs/src/util/afsutil_prototypes.h	Wed Mar 18 23:45:03 2009
***************
*** 74,80 ****
  
  /* get_krbrlm.c */
  extern int afs_krb_get_lrealm(char *r, int n);
! 
  /* hostparse.c */
  extern struct hostent *hostutil_GetHostByName(register char *ahost);
  extern char *hostutil_GetNameByINet(afs_uint32 addr);
--- 74,81 ----
  
  /* get_krbrlm.c */
  extern int afs_krb_get_lrealm(char *r, int n);
! extern int afs_krb_exclusion(char *name);
! extern int afs_is_foreign_ticket_name(char *tname, char *tinst, char * tcell, char *localrealm);
  /* hostparse.c */
  extern struct hostent *hostutil_GetHostByName(register char *ahost);
  extern char *hostutil_GetNameByINet(afs_uint32 addr);
Index: openafs/src/util/dirpath.c
diff -c openafs/src/util/dirpath.c:1.15.2.1 openafs/src/util/dirpath.c:1.15.2.2
*** openafs/src/util/dirpath.c:1.15.2.1	Mon Nov 20 18:47:24 2006
--- openafs/src/util/dirpath.c	Wed Mar 18 23:45:03 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/dirpath.c,v 1.15.2.1 2006/11/20 23:47:24 rra Exp $");
  
  #include <stddef.h>
  #include <stdlib.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/dirpath.c,v 1.15.2.2 2009/03/19 03:45:03 shadow Exp $");
  
  #include <stddef.h>
  #include <stdlib.h>
***************
*** 365,370 ****
--- 365,372 ----
      pathp = dirPathArray[AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID];
      AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_MIGR_DIR, AFSDIR_MIGRATE_LOGNAME);
  
+     pathp = dirPathArray[AFSDIR_SERVER_KRB_EXCL_FILEPATH_ID];
+     AFSDIR_SERVER_FILEPATH(pathp, AFSDIR_SERVER_ETC_DIR, AFSDIR_KRB_EXCL_FILE);
  
      /* client file paths */
  #ifdef AFS_NT40_ENV
Index: openafs/src/util/dirpath.hin
diff -c openafs/src/util/dirpath.hin:1.4 openafs/src/util/dirpath.hin:1.4.8.1
*** openafs/src/util/dirpath.hin:1.4	Thu Nov  1 00:24:38 2001
--- openafs/src/util/dirpath.hin	Wed Mar 18 23:45:03 2009
***************
*** 144,149 ****
--- 144,150 ----
  #define AFSDIR_BOSVR_FILE       "bosserver"
  #define AFSDIR_VOLSERLOG_FILE   "VolserLog"
  #define AFSDIR_AUDIT_FILE       "Audit"
+ #define AFSDIR_KRB_EXCL_FILE    "krb.excl"
  
  #define AFSDIR_ROOTVOL_FILE     "RootVolume"
  #define AFSDIR_HOSTDUMP_FILE    "hosts.dump"
***************
*** 262,267 ****
--- 263,269 ----
        AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID,
        AFSDIR_SERVER_BIN_FILE_DIRPATH_ID,
        AFSDIR_CLIENT_CELLALIAS_FILEPATH_ID,
+       AFSDIR_SERVER_KRB_EXCL_FILEPATH_ID,
        AFSDIR_PATHSTRING_MAX } afsdir_id_t;
  
  /* getDirPath() returns a pointer to a string from an internal array of path strings 
***************
*** 329,334 ****
--- 331,337 ----
  #define AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH_ID)
  #define AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH_ID)
  #define AFSDIR_SERVER_MIGRATELOG_FILEPATH getDirPath(AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_KRB_EXCL_FILEPATH getDirPath(AFSDIR_SERVER_KRB_EXCL_FILEPATH_ID)
  
  /* client file paths */
  #define AFSDIR_CLIENT_THISCELL_FILEPATH getDirPath(AFSDIR_CLIENT_THISCELL_FILEPATH_ID)
Index: openafs/src/util/dirpath_nt.h
diff -c openafs/src/util/dirpath_nt.h:1.6 openafs/src/util/dirpath_nt.h:1.6.2.1
*** openafs/src/util/dirpath_nt.h:1.6	Tue Jul 13 23:28:45 2004
--- openafs/src/util/dirpath_nt.h	Wed Mar 18 23:45:03 2009
***************
*** 135,140 ****
--- 135,141 ----
  #define AFSDIR_BOSVR_FILE       "bosserver"
  #define AFSDIR_VOLSERLOG_FILE   "VolserLog"
  #define AFSDIR_AUDIT_FILE       "Audit"
+ #define AFSDIR_KRB_EXCL_FILE    "krb.excl"
  
  #define AFSDIR_ROOTVOL_FILE     "RootVolume"
  #define AFSDIR_HOSTDUMP_FILE    "hosts.dump"
***************
*** 257,262 ****
--- 258,264 ----
      AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID,
      AFSDIR_SERVER_BIN_FILE_DIRPATH_ID,
      AFSDIR_CLIENT_CELLALIAS_FILEPATH_ID,
+     AFSDIR_SERVER_KRB_EXCL_FILEPATH_ID,
      AFSDIR_PATHSTRING_MAX
  } afsdir_id_t;
  
***************
*** 325,330 ****
--- 327,333 ----
  #define AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_WEIGHTING_CONSTANTS_FILEPATH_ID)
  #define AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH getDirPath(AFSDIR_SERVER_THRESHOLD_CONSTANTS_FILEPATH_ID)
  #define AFSDIR_SERVER_MIGRATELOG_FILEPATH getDirPath(AFSDIR_SERVER_MIGRATELOG_FILEPATH_ID)
+ #define AFSDIR_SERVER_KRB_EXCL_FILEPATH getDirPath(AFSDIR_SERVER_KRB_EXCL_FILEPATH_ID)
  
  /* client file paths */
  #define AFSDIR_CLIENT_THISCELL_FILEPATH getDirPath(AFSDIR_CLIENT_THISCELL_FILEPATH_ID)
Index: openafs/src/util/get_krbrlm.c
diff -c openafs/src/util/get_krbrlm.c:1.6.2.1 openafs/src/util/get_krbrlm.c:1.6.2.2
*** openafs/src/util/get_krbrlm.c:1.6.2.1	Tue Oct 30 11:24:09 2007
--- openafs/src/util/get_krbrlm.c	Wed Mar 18 23:45:03 2009
***************
*** 7,13 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/get_krbrlm.c,v 1.6.2.1 2007/10/30 15:24:09 shadow Exp $");
  
  #include <stdio.h>
  #include <string.h>
--- 7,13 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/get_krbrlm.c,v 1.6.2.2 2009/03/19 03:45:03 shadow Exp $");
  
  #include <stdio.h>
  #include <string.h>
***************
*** 28,48 ****
  #define	KSUCCESS	0
  #define	KFAILURE	(-1)
  
  int
  afs_krb_get_lrealm(char *r, int n)
  {
      FILE *cnffile/*, *fopen()*/;
  
!     if (n > 1)
! 	return (KFAILURE);	/* Temporary restriction */
  
      if ((cnffile = fopen(AFSDIR_SERVER_KCONF_FILEPATH, "r")) == NULL) {
  	return (KFAILURE);
      }
!     if (fscanf(cnffile, "%s", r) != 1) {
! 	(void)fclose(cnffile);
! 	return (KFAILURE);
      }
      (void)fclose(cnffile);
!     return (KSUCCESS);
  }
--- 28,175 ----
  #define	KSUCCESS	0
  #define	KFAILURE	(-1)
  
+ static char *
+ parse_str(char *buffer, char *result, int size)
+ {
+     int n=0;
+ 
+     if (!buffer)
+         goto cleanup;
+ 
+     while (*buffer && isspace(*buffer))
+         buffer++;
+     while (*buffer && !isspace(*buffer)) {
+ 	if (n < size - 1) {
+ 	    *result++=*buffer++;
+ 	    n++;
+ 	} else {
+ 	    buffer++;
+ 	}
+     }
+ 
+   cleanup:
+     *result='\0';
+     return buffer;
+ }
+ 
+ 
  int
  afs_krb_get_lrealm(char *r, int n)
  {
+     char linebuf[2048];
+     char tr[AFS_REALM_SZ] = "";
+     char *p;
      FILE *cnffile/*, *fopen()*/;
+     int i;
+     int rv = KFAILURE;
  
!     *r = '\0';
  
      if ((cnffile = fopen(AFSDIR_SERVER_KCONF_FILEPATH, "r")) == NULL) {
  	return (KFAILURE);
      }
!     if (fgets(linebuf, sizeof(linebuf)-1, cnffile) == NULL) {
! 	goto cleanup;
!     }
!     linebuf[sizeof(linebuf)-1] = '\0';
!     for (i=0, p=linebuf; i<=n && *p; i++) {
!         p = parse_str(p, tr, AFS_REALM_SZ);
      }
+ 
+     if (*tr) {
+ 	strcpy(r,tr);
+ 	rv = KSUCCESS;
+     }
+ 
+   cleanup:
      (void)fclose(cnffile);
!     return rv;
  }
+ 
+ int
+ afs_krb_exclusion(char * name)
+ {
+     char linebuf[2048];
+     char excl_name[256] = "";
+     FILE *cnffile/*, *fopen()*/;
+     int exclude = 0;
+ 
+     if ((cnffile = fopen(AFSDIR_SERVER_KRB_EXCL_FILEPATH, "r")) == NULL)
+ 	return exclude;
+ 
+     for (;;) {
+ 	if (fgets(linebuf, sizeof(linebuf)-1, cnffile) == NULL) {
+ 	    goto cleanup;
+ 	}
+ 	linebuf[sizeof(linebuf)-1] = '\0';
+         parse_str(linebuf, excl_name, sizeof(excl_name));
+ 
+ 	if (!strcmp(name,excl_name)) {
+ 	    exclude = 1;
+ 	    break;
+ 	}
+     }
+ 
+   cleanup:
+     (void)fclose(cnffile);
+     return exclude;
+ }
+ 
+ int 
+ afs_is_foreign_ticket_name(char *tname, char *tinst, char * tcell, char *localrealm)
+ {
+     int foreign = 0;
+ 
+     if (localrealm && strcasecmp(localrealm, tcell))
+ 	foreign = 1;
+ 
+ #if	defined(AFS_ATHENA_STDENV) || defined(AFS_KERBREALM_ENV)
+     if (foreign) {
+ 	static char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ];
+ 	static int  num_lrealms = -1;
+ 	int lrealm_match, i;
+ 	char uname[256];
+ 
+ 	if (num_lrealms == -1) {
+ 	    for (i=0; i<AFS_NUM_LREALMS; i++) {
+ 		if (afs_krb_get_lrealm(local_realms[i], i) != 0 /*KSUCCESS*/)
+ 		    break;
+ 	    }
+ 
+ 	    if (i==0 && localrealm) {
+ 		strncpy(local_realms[0], localrealm, AFS_REALM_SZ);
+ 		num_lrealms = 1;
+ 	    } else {
+ 		num_lrealms = i;
+ 	    }
+ 	}
+ 
+ 	/* See if the ticket cell matches one of the local realms */
+ 	lrealm_match = 0;
+ 	for ( i=0;i<num_lrealms;i++ ) {
+ 	    if (!strcasecmp(local_realms[i], tcell)) {
+ 		lrealm_match = 1;
+ 		break;
+ 	    }
+ 	}
+ 
+ 	/* If yes, then make sure that the name is not present in 
+ 	 * an exclusion list */
+ 	if (lrealm_match) {
+ 	    if (tinst && tinst[0])
+ 		snprintf(uname,sizeof(uname),"%s.%s@%s",tname,tinst,tcell);
+ 	    else
+ 		snprintf(uname,sizeof(uname),"%s@%s",tname,tcell);
+ 
+ 	    if (afs_krb_exclusion(uname))
+ 		lrealm_match = 0;
+ 	}
+ 
+ 	foreign = !lrealm_match;
+     }
+ #endif
+     return foreign;
+ }
+ 
+ 
+ 
Index: openafs/src/util/test/dirpath_test.c
diff -c openafs/src/util/test/dirpath_test.c:1.5 openafs/src/util/test/dirpath_test.c:1.5.2.1
*** openafs/src/util/test/dirpath_test.c:1.5	Tue Jul 15 19:17:18 2003
--- openafs/src/util/test/dirpath_test.c	Wed Mar 18 23:45:03 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/test/dirpath_test.c,v 1.5 2003/07/15 23:17:18 shadow Exp $");
  
  #include <stdio.h>
  #include <afs/afsutil.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/test/dirpath_test.c,v 1.5.2.1 2009/03/19 03:45:03 shadow Exp $");
  
  #include <stdio.h>
  #include <afs/afsutil.h>
***************
*** 124,129 ****
--- 124,131 ----
  	   AFSDIR_SERVER_FILELOG_FILEPATH);
      printf("AFSDIR_SERVER_AUDIT_FILEPATH = %s\n",
  	   AFSDIR_SERVER_AUDIT_FILEPATH);
+     printf("AFSDIR_SERVER_KRB_EXCL_FILEPATH  = %s\n",
+ 	   AFSDIR_SERVER_KRB_EXCL_FILEPATH);
      printf("\n");
      printf("\n");
      printf("AFSDIR_CLIENT_THISCELL_FILEPATH = %s\n",
Index: openafs/src/venus/fs.c
diff -c openafs/src/venus/fs.c:1.24.2.12 openafs/src/venus/fs.c:1.24.2.14
*** openafs/src/venus/fs.c:1.24.2.12	Fri Mar  7 20:15:36 2008
--- openafs/src/venus/fs.c	Mon Feb 16 22:59:53 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/fs.c,v 1.24.2.12 2008/03/08 01:15:36 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/fs.c,v 1.24.2.14 2009/02/17 03:59:53 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
***************
*** 46,51 ****
--- 46,52 ----
  #include <afs/vlserver.h>
  #include <afs/cmd.h>
  #include <afs/afsutil.h>
+ #include <afs/com_err.h>
  #include <stdlib.h>
  #include <assert.h>
  #include <afs/ptclient.h>
***************
*** 307,318 ****
  Parent(char *apath)
  {
      char *tp;
!     strcpy(tspace, apath);
      tp = strrchr(tspace, '/');
!     if (tp) {
! 	*tp = 0;
!     } else
! 	strcpy(tspace, ".");
      return tspace;
  }
  
--- 308,322 ----
  Parent(char *apath)
  {
      char *tp;
!     strlcpy(tspace, apath, sizeof(tspace));
      tp = strrchr(tspace, '/');
!     if (tp == (char *)tspace)
! 	tp++;
!     else if (tp == (char *)NULL) {
! 	tp      = (char *)tspace;
! 	*(tp++) = '.';
!     }
!     *tp = '\0';
      return tspace;
  }
  
***************
*** 1621,1627 ****
  	 * Find rightmost slash, if any.
  	 */
  	last_component = (char *)strrchr(true_name, '/');
! 	if (last_component) {
  	    /*
  	     * Found it.  Designate everything before it as the parent directory,
  	     * everything after it as the final component.
--- 1625,1635 ----
  	 * Find rightmost slash, if any.
  	 */
  	last_component = (char *)strrchr(true_name, '/');
! 	if (last_component == (char *)true_name) {
! 	    strcpy(parent_dir, "/");
! 	    last_component++;
! 	}
! 	else if (last_component != (char *)NULL) {
  	    /*
  	     * Found it.  Designate everything before it as the parent directory,
  	     * everything after it as the final component.
***************
*** 3717,3723 ****
  	 * Find rightmost slash, if any.
  	 */
  	last_component = (char *)strrchr(true_name, '/');
! 	if (last_component) {
  	    /*
  	     * Found it.  Designate everything before it as the parent directory,
  	     * everything after it as the final component.
--- 3725,3735 ----
  	 * Find rightmost slash, if any.
  	 */
  	last_component = (char *)strrchr(true_name, '/');
! 	if (last_component == (char *)true_name) {
! 	    strcpy(parent_dir, "/");
! 	    last_component++;
! 	}
! 	else if (last_component != (char *)NULL) {
  	    /*
  	     * Found it.  Designate everything before it as the parent directory,
  	     * everything after it as the final component.
Index: openafs/src/venus/livesys.c
diff -c openafs/src/venus/livesys.c:1.4.2.3 openafs/src/venus/livesys.c:1.4.2.4
*** openafs/src/venus/livesys.c:1.4.2.3	Fri Mar  7 20:15:37 2008
--- openafs/src/venus/livesys.c	Sun Nov 30 15:25:03 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/livesys.c,v 1.4.2.3 2008/03/08 01:15:37 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/livesys.c,v 1.4.2.4 2008/11/30 20:25:03 shadow Exp $");
  
  #include <afs/afs_args.h>
  #include <rx/xdr.h>
***************
*** 24,29 ****
--- 24,30 ----
  #include <sys/stat.h>
  #include <string.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  #include <afs/vice.h>
  #include <afs/venus.h>
  #include <afs/com_err.h>
Index: openafs/src/venus/twiddle.c
diff -c openafs/src/venus/twiddle.c:1.7.2.3 openafs/src/venus/twiddle.c:1.7.2.4
*** openafs/src/venus/twiddle.c:1.7.2.3	Fri Mar  7 20:15:37 2008
--- openafs/src/venus/twiddle.c	Sun Nov 30 15:25:03 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/twiddle.c,v 1.7.2.3 2008/03/08 01:15:37 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/twiddle.c,v 1.7.2.4 2008/11/30 20:25:03 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <sys/ioctl.h>
***************
*** 22,27 ****
--- 22,28 ----
  #include <netinet/in.h>
  #include <sys/stat.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  #include <afs/vice.h>
  #include <afs/venus.h>
  #ifdef	AFS_AIX32_ENV
Index: openafs/src/venus/whatfid.c
diff -c openafs/src/venus/whatfid.c:1.5.2.2 openafs/src/venus/whatfid.c:1.5.2.3
*** openafs/src/venus/whatfid.c:1.5.2.2	Wed Oct 31 00:13:50 2007
--- openafs/src/venus/whatfid.c	Sun Nov 30 15:25:03 2008
***************
*** 14,20 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/whatfid.c,v 1.5.2.2 2007/10/31 04:13:50 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 14,20 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/venus/whatfid.c,v 1.5.2.3 2008/11/30 20:25:03 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 26,31 ****
--- 26,32 ----
  #include <netdb.h>
  #include <netinet/in.h>
  #include <afs/stds.h>
+ #include <afs/com_err.h>
  #include <afs/vice.h>
  #include <afs/venus.h>
  #include "afs/prs_fs.h"
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.81.2.50 openafs/src/viced/afsfileprocs.c:1.81.2.53
*** openafs/src/viced/afsfileprocs.c:1.81.2.50	Fri Sep  5 12:58:05 2008
--- openafs/src/viced/afsfileprocs.c	Wed Mar 25 09:07:27 2009
***************
*** 29,35 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.50 2008/09/05 16:58:05 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 29,35 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.53 2009/03/25 13:07:27 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 2051,2061 ****
  }
  
  afs_int32
! SRXAFS_ResidencyCmd(struct rx_call * acall, struct AFSFid * Fid,
! 		    struct ResidencyCmdInputs * Inputs,
! 		    struct ResidencyCmdOutputs * Outputs)
  {
!     return EINVAL;
  }
  
  static struct afs_buffer {
--- 2051,2071 ----
  }
  
  afs_int32
! SRXAFS_FsCmd(struct rx_call * acall, struct AFSFid * Fid,
! 		    struct FsCmdInputs * Inputs,
! 		    struct FsCmdOutputs * Outputs)
  {
!     afs_int32 code = 0;
!     struct AFSCallBack callback;
!     struct AFSVolSync sync;
! 
!     switch (Inputs->command) {
!     default:
!         code = EINVAL;
!     }
!     ViceLog(1,("FsCmd: cmd = %d, code=%d\n", 
! 			Inputs->command, Outputs->code));
!     return code;
  }
  
  static struct afs_buffer {
Index: openafs/src/viced/callback.c
diff -c openafs/src/viced/callback.c:1.55.2.27 openafs/src/viced/callback.c:1.55.2.30
*** openafs/src/viced/callback.c:1.55.2.27	Tue Mar 11 13:40:55 2008
--- openafs/src/viced/callback.c	Thu Mar 19 16:13:23 2009
***************
*** 83,89 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/callback.c,v 1.55.2.27 2008/03/11 17:40:55 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>		/* for malloc() */
--- 83,89 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/callback.c,v 1.55.2.30 2009/03/19 20:13:23 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>		/* for malloc() */
***************
*** 532,550 ****
      tfirst = CBtime(FT_ApproxTime());
      /* N.B. The "-1", below, is because
       * FE[0] and CB[0] are not used--and not allocated */
!     FE = ((struct FileEntry *)(calloc(nblks, sizeof(struct FileEntry)))) - 1;
      if (!FE) {
  	ViceLog(0, ("Failed malloc in InitCallBack\n"));
  	assert(0);
      }
      cbstuff.nFEs = nblks;
      while (cbstuff.nFEs)
  	FreeFE(&FE[cbstuff.nFEs]);	/* This is correct */
!     CB = ((struct CallBack *)(calloc(nblks, sizeof(struct CallBack)))) - 1;
      if (!CB) {
  	ViceLog(0, ("Failed malloc in InitCallBack\n"));
  	assert(0);
      }
      cbstuff.nCBs = nblks;
      while (cbstuff.nCBs)
  	FreeCB(&CB[cbstuff.nCBs]);	/* This is correct */
--- 532,552 ----
      tfirst = CBtime(FT_ApproxTime());
      /* N.B. The "-1", below, is because
       * FE[0] and CB[0] are not used--and not allocated */
!     FE = ((struct FileEntry *)(calloc(nblks, sizeof(struct FileEntry))));
      if (!FE) {
  	ViceLog(0, ("Failed malloc in InitCallBack\n"));
  	assert(0);
      }
+     FE--;  /* FE[0] is supposed to point to junk */
      cbstuff.nFEs = nblks;
      while (cbstuff.nFEs)
  	FreeFE(&FE[cbstuff.nFEs]);	/* This is correct */
!     CB = ((struct CallBack *)(calloc(nblks, sizeof(struct CallBack))));
      if (!CB) {
  	ViceLog(0, ("Failed malloc in InitCallBack\n"));
  	assert(0);
      }
+     CB--;  /* CB[0] is supposed to point to junk */
      cbstuff.nCBs = nblks;
      while (cbstuff.nCBs)
  	FreeCB(&CB[cbstuff.nCBs]);	/* This is correct */
***************
*** 1797,1802 ****
--- 1799,1806 ----
  }
  
  #define MAGIC 0x12345678	/* To check byte ordering of dump when it is read in */
+ #define MAGICV2 0x12345679      /* To check byte ordering & version of dump when it is read in */
+ 
  
  #ifndef INTERPRET_DUMP
  
***************
*** 1804,1810 ****
  DumpCallBackState(void)
  {
      int fd, oflag;
!     afs_uint32 magic = MAGIC, now = FT_ApproxTime(), freelisthead;
  
      oflag = O_WRONLY | O_CREAT | O_TRUNC;
  #ifdef AFS_NT40_ENV
--- 1808,1814 ----
  DumpCallBackState(void)
  {
      int fd, oflag;
!     afs_uint32 magic = MAGICV2, now = (afs_int32) FT_ApproxTime(), freelisthead;
  
      oflag = O_WRONLY | O_CREAT | O_TRUNC;
  #ifdef AFS_NT40_ENV
***************
*** 1842,1852 ****
  /* This is only compiled in for the callback analyzer program */
  /* Returns the time of the dump */
  time_t
! ReadDump(char *file)
  {
      int fd, oflag;
      afs_uint32 magic, freelisthead;
      afs_uint32 now;
  
      oflag = O_RDONLY;
  #ifdef AFS_NT40_ENV
--- 1846,1859 ----
  /* This is only compiled in for the callback analyzer program */
  /* Returns the time of the dump */
  time_t
! ReadDump(char *file, int timebits)
  {
      int fd, oflag;
      afs_uint32 magic, freelisthead;
      afs_uint32 now;
+ #ifdef AFS_64BIT_ENV
+     afs_int64 now64;
+ #endif
  
      oflag = O_RDONLY;
  #ifdef AFS_NT40_ENV
***************
*** 1858,1872 ****
  	exit(1);
      }
      read(fd, &magic, sizeof(magic));
!     if (magic != MAGIC) {
! 	fprintf(stderr,
! 		"Magic number of %s is invalid.  You might be trying to\n",
! 		file);
! 	fprintf(stderr,
! 		"run this program on a machine type with a different byte ordering.\n");
! 	exit(1);
      }
!     read(fd, &now, sizeof(now));
      read(fd, &cbstuff, sizeof(cbstuff));
      read(fd, TimeOuts, sizeof(TimeOuts));
      read(fd, timeout, sizeof(timeout));
--- 1865,1889 ----
  	exit(1);
      }
      read(fd, &magic, sizeof(magic));
!     if (magic == MAGICV2) {
! 	timebits = 32;
!     } else {
! 	if (magic != MAGIC) {
! 	    fprintf(stderr,
! 		    "Magic number of %s is invalid.  You might be trying to\n",
! 		    file);
! 	    fprintf(stderr,
! 		    "run this program on a machine type with a different byte ordering.\n");
! 	    exit(1);
! 	}
      }
! #ifdef AFS_64BIT_ENV
!     if (timebits == 64) {
! 	read(fd, &now64, sizeof(afs_int64));
! 	now = (afs_int32) now64;
!     } else
! #endif
! 	read(fd, &now, sizeof(afs_int32));
      read(fd, &cbstuff, sizeof(cbstuff));
      read(fd, TimeOuts, sizeof(TimeOuts));
      read(fd, timeout, sizeof(timeout));
***************
*** 1898,1905 ****
      static AFSFid fid;
      register struct FileEntry *fe;
      register struct CallBack *cb;
!     time_t now;
! 
      memset(&fid, 0, sizeof(fid));
      argc--;
      argv++;
--- 1915,1923 ----
      static AFSFid fid;
      register struct FileEntry *fe;
      register struct CallBack *cb;
!     afs_int32 now;
!     int timebits = 32;
!     
      memset(&fid, 0, sizeof(fid));
      argc--;
      argv++;
***************
*** 1931,1936 ****
--- 1949,1967 ----
  	    all = 1;
  	} else if (!strcmp(*argv, "-raw")) {
  	    raw = 1;
+ 	} else if (!strcmp(*argv, "-timebits")) {
+ 	    if (argc < 1) {
+ 		err++;
+ 		break;
+ 	    }
+ 	    argc--;
+ 	    timebits = atoi(*++argv);
+ 	    if ((timebits != 32)
+ #ifdef AFS_64BIT_ENV
+ 		&& (timebits != 64)
+ #endif
+ 		) 
+ 		err++;
  	} else if (!strcmp(*argv, "-volume")) {
  	    if (argc < 1) {
  		err++;
***************
*** 1944,1955 ****
      }
      if (err || argc != 1) {
  	fprintf(stderr,
! 		"Usage: cbd [-host cbid] [-fid volume vnode] [-stats] [-all] callbackdumpfile\n");
  	fprintf(stderr,
  		"[cbid is shown for each host in the hosts.dump file]\n");
  	exit(1);
      }
!     now = ReadDump(*argv);
      if (stats || noptions == 0) {
  	time_t uxtfirst = UXtime(tfirst);
  	printf("The time of the dump was %u %s", now, ctime(&now));
--- 1975,1990 ----
      }
      if (err || argc != 1) {
  	fprintf(stderr,
! 		"Usage: cbd [-host cbid] [-fid volume vnode] [-stats] [-all] [-timebits 32"
! #ifdef AFS_64BIT_ENV
! 		"|64"
! #endif
! 		"] callbackdumpfile\n");
  	fprintf(stderr,
  		"[cbid is shown for each host in the hosts.dump file]\n");
  	exit(1);
      }
!     now = ReadDump(*argv, timebits);
      if (stats || noptions == 0) {
  	time_t uxtfirst = UXtime(tfirst);
  	printf("The time of the dump was %u %s", now, ctime(&now));
Index: openafs/src/viced/host.c
diff -c openafs/src/viced/host.c:1.57.2.60 openafs/src/viced/host.c:1.57.2.64
*** openafs/src/viced/host.c:1.57.2.60	Mon Oct 27 19:54:10 2008
--- openafs/src/viced/host.c	Wed Mar 18 23:45:02 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.57.2.60 2008/10/27 23:54:10 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.57.2.64 2009/03/19 03:45:02 shadow Exp $");
  
  #include <stdio.h>
  #include <errno.h>
***************
*** 180,186 ****
   */
  static struct h_AddrHashChain *hostAddrHashTable[h_HASHENTRIES];
  static struct h_UuidHashChain *hostUuidHashTable[h_HASHENTRIES];
! #define h_HashIndex(hostip) ((hostip) & (h_HASHENTRIES-1))
  #define h_UuidHashIndex(uuidp) (((int)(afs_uuid_hash(uuidp))) & (h_HASHENTRIES-1))
  
  struct HTBlock {		/* block of HTSPERBLOCK file entries */
--- 180,186 ----
   */
  static struct h_AddrHashChain *hostAddrHashTable[h_HASHENTRIES];
  static struct h_UuidHashChain *hostUuidHashTable[h_HASHENTRIES];
! #define h_HashIndex(hostip) (ntohl(hostip) & (h_HASHENTRIES-1))
  #define h_UuidHashIndex(uuidp) (((int)(afs_uuid_hash(uuidp))) & (h_HASHENTRIES-1))
  
  struct HTBlock {		/* block of HTSPERBLOCK file entries */
***************
*** 1420,1431 ****
--- 1420,1436 ----
      char hoststr[16], hoststr2[16];
      Capabilities caps;
      struct rx_connection *cb_conn = NULL;
+     struct rx_connection *cb_in = NULL;
  
      caps.Capabilities_val = NULL;
  
      haddr = rxr_HostOf(tcon);
      hport = rxr_PortOf(tcon);
    retry:
+     if (cb_in) {
+         rx_DestroyConnection(cb_in);
+         cb_in = NULL;
+     }
      if (caps.Capabilities_val)
  	free(caps.Capabilities_val);
      caps.Capabilities_val = NULL;
***************
*** 1460,1472 ****
  	}
  	host->hostFlags |= HWHO_INPROGRESS;
  	host->hostFlags &= ~ALTADDR;
  	cb_conn = host->callback_rxcon;
  	rx_GetConnection(cb_conn);
  	H_UNLOCK;
! 	code =
! 	    RXAFSCB_TellMeAboutYourself(cb_conn, &interf, &caps);
! 	if (code == RXGEN_OPCODE)
! 	    code = RXAFSCB_WhoAreYou(cb_conn, &interf);
  	rx_PutConnection(cb_conn);
  	cb_conn=NULL;
  	H_LOCK;
--- 1465,1509 ----
  	}
  	host->hostFlags |= HWHO_INPROGRESS;
  	host->hostFlags &= ~ALTADDR;
+ 
+         /* We received a new connection from an IP address/port
+          * that is associated with 'host' but the address/port of
+          * the callback connection does not have to match it.
+          * If there is a match, we can use the existing callback
+          * connection to verify the UUID.  If they do not match
+          * we need to use a new callback connection to verify the
+          * UUID of the incoming caller and perhaps use the old 
+          * callback connection to verify that the old address/port
+          * is still valid.
+          */
+        
  	cb_conn = host->callback_rxcon;
  	rx_GetConnection(cb_conn);
  	H_UNLOCK;
!         if (haddr == host->host && hport == host->port) {
!             /* The existing callback connection matches the 
!              * incoming connection so just use it.
!              */
! 	    code =
! 		RXAFSCB_TellMeAboutYourself(cb_conn, &interf, &caps);
! 	    if (code == RXGEN_OPCODE)
! 		code = RXAFSCB_WhoAreYou(cb_conn, &interf);
! 	} else {
!             /* We do not have a match.  Create a new connection
!              * for the new addr/port and use multi_Rx to probe
!              * both of them simultaneously.
!              */
! 	    if (!sc)
!                 sc = rxnull_NewClientSecurityObject();
!             cb_in = rx_NewConnection(haddr, hport, 1, sc, 0);
!             rx_SetConnDeadTime(cb_in, 50);
!             rx_SetConnHardDeadTime(cb_in, AFS_HARDDEADTIME);
! 	    
!             code =
!                 RXAFSCB_TellMeAboutYourself(cb_in, &interf, &caps);
! 	    if (code == RXGEN_OPCODE)
!                 code = RXAFSCB_WhoAreYou(cb_in, &interf);
! 	}
  	rx_PutConnection(cb_conn);
  	cb_conn=NULL;
  	H_LOCK;
***************
*** 1479,1496 ****
  	    }
  	    identP->valid = 0;
  	    rx_SetSpecific(tcon, rxcon_ident_key, identP);
! 	    /* The host on this connection was unable to respond to 
! 	     * the WhoAreYou. We will treat this as a new connection
! 	     * from the existing host. The worst that can happen is
! 	     * that we maintain some extra callback state information */
! 	    if (host->interface) {
! 		ViceLog(0,
! 			("Host %s:%d used to support WhoAreYou, deleting.\n",
! 			 afs_inet_ntoa_r(host->host, hoststr),
! 			 ntohs(host->port)));
! 		host->hostFlags |= HOSTDELETED;
! 		host->hostFlags &= ~HWHO_INPROGRESS;
! 		h_Unlock_r(host);
  		if (!held)
  		    h_Release_r(host);
  		host = NULL;
--- 1516,1552 ----
  	    }
  	    identP->valid = 0;
  	    rx_SetSpecific(tcon, rxcon_ident_key, identP);
! 	    if (cb_in == NULL) {
! 		/* The host on this connection was unable to respond to 
! 		 * the WhoAreYou. We will treat this as a new connection
! 		 * from the existing host. The worst that can happen is
! 		 * that we maintain some extra callback state information */
! 		if (host->interface) {
! 		    ViceLog(0,
! 			    ("Host %x (%s:%d) used to support WhoAreYou, deleting.\n",
! 			     host, 
! 			     afs_inet_ntoa_r(host->host, hoststr),
! 			     ntohs(host->port)));
! 		    host->hostFlags |= HOSTDELETED;
! 		    host->hostFlags &= ~HWHO_INPROGRESS;
! 		    host->hostFlags |= ALTADDR;
! 		    h_Unlock_r(host);
! 		    if (!held)
! 			h_Release_r(host);
! 		    host = NULL;
! 		    goto retry;
! 		}
! 	    } else {
! 		/* The incoming connection does not support WhoAreYou but
!                 * the original one might have.  Use removeAddress_r() to
!                  * remove this addr/port from the host that was found.
!                  * If there are no more addresses left for the host it 
!                  * will be deleted.  Then we retry.
!                  */
!                 removeAddress_r(host, haddr, hport);
!                 host->hostFlags &= ~HWHO_INPROGRESS;
! 		host->hostFlags |= ALTADDR;
!                 h_Unlock_r(host);
  		if (!held)
  		    h_Release_r(host);
  		host = NULL;
***************
*** 1511,1533 ****
  	     * then this is not the same host as before. */
  	    if (!host->interface
  		|| !afs_uuid_equal(&interf.uuid, &host->interface->uuid)) {
!                 ViceLog(25,
!                          ("Uuid doesn't match host %x (%s:%d). Host deleted.\n",
!                            host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
! 		host->hostFlags |= HOSTDELETED;
  		host->hostFlags &= ~HWHO_INPROGRESS;
  		h_Unlock_r(host);
  		if (!held)
  		    h_Release_r(host);
  		host = NULL;
  		goto retry;
  	    }
  	} else {
! 	    ViceLog(0,
! 		    ("CB: WhoAreYou failed for host %x (%s:%d), error %d\n", 
!                      host, afs_inet_ntoa_r(host->host, hoststr),
! 		     ntohs(host->port), code));
! 	    host->hostFlags |= VENUSDOWN;
  	}
  	if (caps.Capabilities_val
  	    && (caps.Capabilities_val[0] & CAPABILITY_ERRORTRANS))
--- 1567,1670 ----
  	     * then this is not the same host as before. */
  	    if (!host->interface
  		|| !afs_uuid_equal(&interf.uuid, &host->interface->uuid)) {
! 		if (cb_in) {
!                     ViceLog(25,
! 			    ("Uuid doesn't match connection (%s:%d).\n",
! 			     afs_inet_ntoa_r(haddr, hoststr), ntohs(hport)));
! 		    
!                     removeAddress_r(host, haddr, hport);
! 		} else {
! 		    ViceLog(25,
! 			    ("Uuid doesn't match host %x (%s:%d).\n",
! 			     host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
! 		    
! 		    removeAddress_r(host, host->host, host->port);
! 		}
  		host->hostFlags &= ~HWHO_INPROGRESS;
+ 		host->hostFlags |= ALTADDR;
  		h_Unlock_r(host);
  		if (!held)
  		    h_Release_r(host);
  		host = NULL;
  		goto retry;
+ 	    } else if (cb_in) {
+ 		/* the UUID matched the client at the incoming addr/port 
+                  * but this is not the address of the active callback 
+                  * connection.  Try that connection and see if the client
+                  * is still there and if the reported UUID is the same.
+                  */
+                 int code2;
+                 afsUUID uuid = host->interface->uuid;
+                 cb_conn = host->callback_rxcon;
+                 rx_GetConnection(cb_conn);
+                 rx_SetConnDeadTime(cb_conn, 2);
+                 rx_SetConnHardDeadTime(cb_conn, AFS_HARDDEADTIME);
+                 H_UNLOCK;
+                 code2 = RXAFSCB_ProbeUuid(cb_conn, &uuid);
+                 H_LOCK;
+                 rx_SetConnDeadTime(cb_conn, 50);
+                 rx_SetConnHardDeadTime(cb_conn, AFS_HARDDEADTIME);
+                 rx_PutConnection(cb_conn);
+                 cb_conn=NULL;
+                 if (code2) {
+                     /* The primary address is either not responding or
+                      * is not the client we are looking for.  Need to
+                      * remove the primary address and add swap in the new 
+                      * callback connection, and destroy the old one.
+                      */
+                     struct rx_connection *rxconn;
+                     ViceLog(0,("CB: ProbeUuid for host %x (%s:%d) failed %d\n",
+ 			       host, 
+ 			       afs_inet_ntoa_r(host->host, hoststr),
+ 			       ntohs(host->port),code2));
+ 		    
+                     removeInterfaceAddr_r(host, host->host, host->port);
+                     addInterfaceAddr_r(host, haddr, hport);
+                     host->host = haddr;
+                     host->port = hport;
+                     rxconn = host->callback_rxcon;
+                     host->callback_rxcon = cb_in;
+                     cb_in = NULL;
+ 		    
+                     if (rxconn) {
+                         struct client *client;
+                         /*
+                          * If rx_DestroyConnection calls h_FreeConnection we will
+ 			 * deadlock on the host_glock_mutex. Work around the problem
+                          * by unhooking the client from the connection before
+                          * destroying the connection.
+                          */
+                         client = rx_GetSpecific(rxconn, rxcon_client_key);
+                         rx_SetSpecific(rxconn, rxcon_client_key, (void *)0);
+                         rx_DestroyConnection(rxconn);
+                    }
+                }
  	    }
  	} else {
! 	    if (cb_in) {
!                 /* A callback to the incoming connection address is failing.  
!                  * Assume that the addr/port is no longer associated with the host
!                  * returned by h_Lookup_r.
!                  */
!                 ViceLog(0,
! 			("CB: WhoAreYou failed for connection (%s:%d) , error %d\n",
! 			 afs_inet_ntoa_r(haddr, hoststr), ntohs(hport), code));
! 		removeAddress_r(host, haddr, hport);
! 		host->hostFlags &= ~HWHO_INPROGRESS;
! 		host->hostFlags |= ALTADDR;
! 		h_Unlock_r(host);
! 		if (!held)
! 		    h_Release_r(host);
! 		host = NULL;
! 		rx_DestroyConnection(cb_in);
! 		return 0;
! 	    } else {
! 		ViceLog(0,
! 			("CB: WhoAreYou failed for host %x (%s:%d), error %d\n",
! 			 host, afs_inet_ntoa_r(host->host, hoststr),
! 			 ntohs(host->port), code));
! 		host->hostFlags |= VENUSDOWN;
! 	    }
  	}
  	if (caps.Capabilities_val
  	    && (caps.Capabilities_val[0] & CAPABILITY_ERRORTRANS))
***************
*** 1811,1817 ****
  
  
  static char localcellname[PR_MAXNAMELEN + 1];
! char local_realm[AFS_REALM_SZ] = "";
  
  /* not reentrant */
  void
--- 1948,1955 ----
  
  
  static char localcellname[PR_MAXNAMELEN + 1];
! char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ];
! int  num_lrealms = -1;
  
  /* not reentrant */
  void
***************
*** 1819,1831 ****
  {
      memset(&nulluuid, 0, sizeof(afsUUID));
      afsconf_GetLocalCell(confDir, localcellname, PR_MAXNAMELEN);
!     if (!local_realm[0]) {
! 	if (afs_krb_get_lrealm(local_realm, 0) != 0 /*KSUCCESS*/) {
  	    ViceLog(0,
  		    ("afs_krb_get_lrealm failed, using %s.\n",
  		     localcellname));
! 	    strcpy(local_realm, localcellname);
  	}
      }
      rxcon_ident_key = rx_KeyCreate((rx_destructor_t) free);
      rxcon_client_key = rx_KeyCreate((rx_destructor_t) 0);
--- 1957,1982 ----
  {
      memset(&nulluuid, 0, sizeof(afsUUID));
      afsconf_GetLocalCell(confDir, localcellname, PR_MAXNAMELEN);
!     if (num_lrealms == -1) {
! 	int i;
! 	for (i=0; i<AFS_NUM_LREALMS; i++) {
! 	    if (afs_krb_get_lrealm(local_realms[i], i) != 0 /*KSUCCESS*/)
! 		break;
! 	}
! 	
! 	if (i == 0) {
  	    ViceLog(0,
  		    ("afs_krb_get_lrealm failed, using %s.\n",
  		     localcellname));
! 	    strncpy(local_realms[0], localcellname, AFS_REALM_SZ);
! 	    num_lrealms = i =1;
! 	} else {
! 	    num_lrealms = i;
  	}
+  
+ 	/* initialize the rest of the local realms to nullstring for debugging */
+ 	for (; i<AFS_NUM_LREALMS; i++)
+ 	    local_realms[i][0] = '\0';
      }
      rxcon_ident_key = rx_KeyCreate((rx_destructor_t) free);
      rxcon_client_key = rx_KeyCreate((rx_destructor_t) 0);
***************
*** 1855,1865 ****
  
      cnamelen = strlen(acell);
      if (cnamelen) {
! 	if (strcasecmp(local_realm, acell)
! 	    && strcasecmp(localcellname, acell)) {
  	    ViceLog(2,
! 		    ("MapName: cell is foreign.  cell=%s, localcell=%s, localrealm=%s\n",
! 		     acell, localcellname, local_realm));
  	    if ((anamelen + cnamelen + 1) >= PR_MAXNAMELEN) {
  		ViceLog(2,
  			("MapName: Name too long, using AnonymousID for %s@%s\n",
--- 2006,2015 ----
  
      cnamelen = strlen(acell);
      if (cnamelen) {
! 	if (afs_is_foreign_ticket_name(aname, NULL, acell, localcellname)) {
  	    ViceLog(2,
! 		    ("MapName: cell is foreign.  cell=%s, localcell=%s, localrealms={%s,%s,%s,%s}\n",
! 		    acell, localcellname, local_realms[0],local_realms[1],local_realms[2],local_realms[3]));
  	    if ((anamelen + cnamelen + 1) >= PR_MAXNAMELEN) {
  		ViceLog(2,
  			("MapName: Name too long, using AnonymousID for %s@%s\n",
Index: openafs/src/viced/viced.c
diff -c openafs/src/viced/viced.c:1.58.2.30 openafs/src/viced/viced.c:1.58.2.36
*** openafs/src/viced/viced.c:1.58.2.30	Sun Aug 24 21:15:21 2008
--- openafs/src/viced/viced.c	Wed Mar 25 09:07:27 2009
***************
*** 20,26 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/viced.c,v 1.58.2.30 2008/08/25 01:15:21 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 20,26 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/viced.c,v 1.58.2.36 2009/03/25 13:07:27 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 315,330 ****
  }
  
  #if defined(AFS_PTHREAD_ENV)
! char *
  threadNum(void)
  {
!     return pthread_getspecific(rx_thread_id_key);
  }
  #endif
  
  /* proc called by rxkad module to get a key */
  static int
! get_key(char *arock, register afs_int32 akvno, char *akey)
  {
      /* find the key */
      static struct afsconf_key tkey;
--- 315,330 ----
  }
  
  #if defined(AFS_PTHREAD_ENV)
! int
  threadNum(void)
  {
!     return (int)pthread_getspecific(rx_thread_id_key);
  }
  #endif
  
  /* proc called by rxkad module to get a key */
  static int
! get_key(void *arock, register afs_int32 akvno, char *akey)
  {
      /* find the key */
      static struct afsconf_key tkey;
***************
*** 1078,1084 ****
  		return -1;
  	    }
  	} else if (!strcmp(argv[i], "-realm")) {
! 	    extern char local_realm[AFS_REALM_SZ];
  	    if ((i + 1) >= argc) {
  		fprintf(stderr, "missing argument for -realm\n"); 
  		return -1; 
--- 1078,1085 ----
  		return -1;
  	    }
  	} else if (!strcmp(argv[i], "-realm")) {
! 	    extern char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ];
! 	    extern int  num_lrealms;
  	    if ((i + 1) >= argc) {
  		fprintf(stderr, "missing argument for -realm\n"); 
  		return -1; 
***************
*** 1089,1095 ****
  		     AFS_REALM_SZ);
  		return -1;
  	    }
! 	    strncpy(local_realm, argv[i], AFS_REALM_SZ);
  	} else if (!strcmp(argv[i], "-udpsize")) {
  	    if ((i + 1) >= argc) {
  		printf("You have to specify -udpsize <integer value>\n");
--- 1090,1104 ----
  		     AFS_REALM_SZ);
  		return -1;
  	    }
! 	    if (num_lrealms == -1) 
! 		num_lrealms = 0;
! 	    if (num_lrealms >= AFS_NUM_LREALMS) {
! 		printf
! 		    ("a maximum of %d -realm arguments can be specified.\n",
! 		     AFS_NUM_LREALMS);
! 		return -1;
! 	    }
! 	    strncpy(local_realms[num_lrealms++], argv[i], AFS_REALM_SZ);
  	} else if (!strcmp(argv[i], "-udpsize")) {
  	    if ((i + 1) >= argc) {
  		printf("You have to specify -udpsize <integer value>\n");
***************
*** 1120,1153 ****
  	    rx_enableProcessRPCStats();
  	}
  	else if (strcmp(argv[i], "-auditlog") == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++i];
! 	    
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 	    
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	}
  #ifndef AFS_NT40_ENV
  	else if (strcmp(argv[i], "-syslog") == 0) {
--- 1129,1137 ----
  	    rx_enableProcessRPCStats();
  	}
  	else if (strcmp(argv[i], "-auditlog") == 0) {
  	    char *fileName = argv[++i];
! 
!             osi_audit_file(fileName);
  	}
  #ifndef AFS_NT40_ENV
  	else if (strcmp(argv[i], "-syslog") == 0) {
Index: openafs/src/viced/viced.h
diff -c openafs/src/viced/viced.h:1.6.2.2 openafs/src/viced/viced.h:1.6.2.3
*** openafs/src/viced/viced.h:1.6.2.2	Wed Apr 23 14:58:09 2008
--- openafs/src/viced/viced.h	Tue Nov 11 15:31:40 2008
***************
*** 198,204 ****
  
  #define MAX_FILESERVER_THREAD	128	/* max number of threads in fileserver, subject to system limits. match to FD_HANDLE_SETASIDE */
  
! #define FILESERVER_HELPER_THREADS 7	/* Listner, IOMGR, FiveMinute, 
  					 * HostCheck, Signal, min 2 for RXSTATS */
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
--- 198,204 ----
  
  #define MAX_FILESERVER_THREAD	128	/* max number of threads in fileserver, subject to system limits. match to FD_HANDLE_SETASIDE */
  
! #define FILESERVER_HELPER_THREADS 8	/* Listner, IOMGR, FiveMinute, FsyncCk 
  					 * HostCheck, Signal, min 2 for RXSTATS */
  #ifdef AFS_PTHREAD_ENV
  #include <pthread.h>
Index: openafs/src/vlserver/vldb_check.c
diff -c openafs/src/vlserver/vldb_check.c:1.11.2.7 openafs/src/vlserver/vldb_check.c:1.11.2.9
*** openafs/src/vlserver/vldb_check.c:1.11.2.7	Mon Oct 27 19:54:11 2008
--- openafs/src/vlserver/vldb_check.c	Tue Feb 17 09:34:41 2009
***************
*** 36,41 ****
--- 36,45 ----
  #define MISBKH 0x400000          /* mischained (BK) */
  #define MISNH  0x800000          /* mischained (name) */
  
+ #define VLDB_CHECK_NO_VLDB_CHECK_ERROR 0
+ #define VLDB_CHECK_WARNING  1
+ #define VLDB_CHECK_ERROR    2
+ #define VLDB_CHECK_FATAL    4
  #define vldbread(x,y,z) vldbio(x,y,z,0)
  #define vldbwrite(x,y,z) vldbio(x,y,z,1)
  
***************
*** 43,50 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vldb_check.c,v 1.11.2.7 2008/10/27 23:54:11 shadow Exp $");
  
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <fcntl.h>
--- 47,55 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vldb_check.c,v 1.11.2.9 2009/02/17 14:34:41 shadow Exp $");
  
+ #include <stdlib.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <fcntl.h>
***************
*** 69,79 ****
  #define ADDR(x) (x/sizeof(struct nvlentry))
  
  int fd;
! int listentries, listservers, listheader, listuheader, verbose;
  
  int fix = 0;
  int fixed = 0;
  int passes = 0;
  
  struct er {
      long addr;
--- 74,88 ----
  #define ADDR(x) (x/sizeof(struct nvlentry))
  
  int fd;
! int listentries, listservers, listheader, listuheader, verbose, quiet;
  
  int fix = 0;
  int fixed = 0;
  int passes = 0;
+ /* if quiet, don't send anything to stdout */
+ int quiet = 0; 
+ /*  error level. 0 = no error, 1 = warning, 2 = error, 4 = fatal */
+ int error_level  = 0; 
  
  struct er {
      long addr;
***************
*** 81,86 ****
--- 90,120 ----
  } *record;
  int serveraddrs[MAXSERVERID + 2];
  
+ /*  Used to control what goes to stdout based on quiet flag */
+ void 
+ quiet_println(const char *fmt,...) {
+     va_list args;                                             
+     if (!quiet) {
+         va_start(args, fmt);                                      
+         vfprintf(stdout, fmt, args);                              
+         va_end(args);                                             
+     }
+ }
+ 
+ /*  Used to set the error level and ship messages to stderr */
+ void                                                   
+ log_error(int eval, const char *fmt, ...)                          
+ {                                                             
+     va_list args;                                             
+     if (error_level < eval) error_level  = eval ;  /*  bump up the severity */
+     va_start(args, fmt);                                      
+     vfprintf(stderr, fmt, args);                              
+     va_end(args);                                             
+ 
+     if (error_level  == VLDB_CHECK_FATAL) exit(VLDB_CHECK_FATAL);
+ }  
+ 
+ 
  #if 0
  int
  writeUbikHeader()
***************
*** 98,113 ****
  
      offset = lseek(fd, 0, 0);
      if (offset != 0) {
! 	printf("error: lseek to 0 failed: %d %d\n", offset, errno);
! 	return (-1);
      }
  
      /* now read the info */
      r = read(fd, &uheader, sizeof(uheader));
      if (r != sizeof(uheader)) {
! 	printf("error: read of %d bytes failed: %d %d\n", sizeof(uheader), r,
  	       errno);
! 	return (-1);
      }
  
      uheader.magic = ntohl(uheader.magic);
--- 132,147 ----
  
      offset = lseek(fd, 0, 0);
      if (offset != 0) {
! 	log_error(VLDB_CHECK_FATAL,"error: lseek to 0 failed: %d %d\n", offset, errno);
! 	return (VLDB_CHECK_FATAL);
      }
  
      /* now read the info */
      r = read(fd, &uheader, sizeof(uheader));
      if (r != sizeof(uheader)) {
! 	log_error(VLDB_CHECK_FATAL,"error: read of %d bytes failed: %d %d\n", sizeof(uheader), r,
  	       errno);
! 	return (VLDB_CHECK_FATAL);
      }
  
      uheader.magic = ntohl(uheader.magic);
***************
*** 116,133 ****
      uheader.version.counter = ntohl(uheader.version.counter);
  
      if (listuheader) {
! 	printf("Ubik Header\n");
! 	printf("   Magic           = 0x%x\n", uheader.magic);
! 	printf("   Size            = %u\n", uheader.size);
! 	printf("   Version.epoch   = %u\n", uheader.version.epoch);
! 	printf("   Version.counter = %u\n", uheader.version.counter);
      }
  
      if (uheader.size != HDRSIZE)
! 	printf("Ubik header size is %u (should be %u)\n", uheader.size,
  	       HDRSIZE);
      if (uheader.magic != UBIK_MAGIC)
! 	printf("Ubik header magic is 0x%x (should be 0x%x)\n", uheader.magic,
  	       UBIK_MAGIC);
  
      return (0);
--- 150,167 ----
      uheader.version.counter = ntohl(uheader.version.counter);
  
      if (listuheader) {
! 	quiet_println("Ubik Header\n");
! 	quiet_println("   Magic           = 0x%x\n", uheader.magic);
! 	quiet_println("   Size            = %u\n", uheader.size);
! 	quiet_println("   Version.epoch   = %u\n", uheader.version.epoch);
! 	quiet_println("   Version.counter = %u\n", uheader.version.counter);
      }
  
      if (uheader.size != HDRSIZE)
! 	log_error(VLDB_CHECK_WARNING,"VLDB_CHECK_WARNING: Ubik header size is %u (should be %u)\n", uheader.size,
  	       HDRSIZE);
      if (uheader.magic != UBIK_MAGIC)
! 	log_error(VLDB_CHECK_ERROR,"Ubik header magic is 0x%x (should be 0x%x)\n", uheader.magic,
  	       UBIK_MAGIC);
  
      return (0);
***************
*** 142,148 ****
      p = position + HDRSIZE;
      offset = lseek(fd, p, 0);
      if (offset != p) {
! 	printf("error: lseek to %d failed: %d %d\n", p, offset, errno);
  	return (-1);
      }
  
--- 176,182 ----
      p = position + HDRSIZE;
      offset = lseek(fd, p, 0);
      if (offset != p) {
! 	log_error(VLDB_CHECK_FATAL,"error: lseek to %d failed: %d %d\n", p, offset, errno);
  	return (-1);
      }
  
***************
*** 152,158 ****
  	r = read(fd, buffer, size);
  
      if (r != size) {
! 	printf("error: %s of %d bytes failed: %d %d\n", rdwr==1?"write":"read",
  	       size, r, errno);
  	return (-1);
      }
--- 186,192 ----
  	r = read(fd, buffer, size);
  
      if (r != size) {
! 	log_error(VLDB_CHECK_FATAL,"error: %s of %d bytes failed: %d %d\n", rdwr==1?"write":"read",
  	       size, r, errno);
  	return (-1);
      }
***************
*** 212,218 ****
  {
      int i, j;
  
!     vldbread(0, headerp, sizeof(*headerp));
  
      headerp->vital_header.vldbversion =
  	ntohl(headerp->vital_header.vldbversion);
--- 246,252 ----
  {
      int i, j;
  
!     vldbread(0, (char *)headerp, sizeof(*headerp));
  
      headerp->vital_header.vldbversion =
  	ntohl(headerp->vital_header.vldbversion);
***************
*** 240,274 ****
  	    headerp->VolidHash[i][j] = ntohl(headerp->VolidHash[i][j]);
  
      if (listheader) {
! 	printf("vldb header\n");
! 	printf("   vldbversion      = %u\n",
  	       headerp->vital_header.vldbversion);
! 	printf("   headersize       = %u [actual=%u]\n",
  	       headerp->vital_header.headersize, sizeof(*headerp));
! 	printf("   freePtr          = 0x%x\n", headerp->vital_header.freePtr);
! 	printf("   eofPtr           = %u\n", headerp->vital_header.eofPtr);
! 	printf("   allocblock calls = %10u\n", headerp->vital_header.allocs);
! 	printf("   freeblock  calls = %10u\n", headerp->vital_header.frees);
! 	printf("   MaxVolumeId      = %u\n",
  	       headerp->vital_header.MaxVolumeId);
! 	printf("   rw vol entries   = %u\n",
  	       headerp->vital_header.totalEntries[0]);
! 	printf("   ro vol entries   = %u\n",
  	       headerp->vital_header.totalEntries[1]);
! 	printf("   bk vol entries   = %u\n",
  	       headerp->vital_header.totalEntries[2]);
! 	printf("   multihome info   = 0x%x (%u)\n", headerp->SIT,
  	       headerp->SIT);
! 	printf("   server ip addr   table: size = %d entries\n",
  	       MAXSERVERID + 1);
! 	printf("   volume name hash table: size = %d buckets\n", HASHSIZE);
! 	printf("   volume id   hash table: %d tables with %d buckets each\n",
  	       MAXTYPES, HASHSIZE);
      }
  
      /* Check the header size */
      if (headerp->vital_header.headersize != sizeof(*headerp))
! 	printf("Header reports its size as %d (should be %d)\n",
  	       headerp->vital_header.headersize, sizeof(*headerp));
      return;
  }
--- 274,308 ----
  	    headerp->VolidHash[i][j] = ntohl(headerp->VolidHash[i][j]);
  
      if (listheader) {
! 	quiet_println("vldb header\n");
! 	quiet_println("   vldbversion      = %u\n",
  	       headerp->vital_header.vldbversion);
! 	quiet_println("   headersize       = %u [actual=%u]\n",
  	       headerp->vital_header.headersize, sizeof(*headerp));
! 	quiet_println("   freePtr          = 0x%x\n", headerp->vital_header.freePtr);
! 	quiet_println("   eofPtr           = %u\n", headerp->vital_header.eofPtr);
! 	quiet_println("   allocblock calls = %10u\n", headerp->vital_header.allocs);
! 	quiet_println("   freeblock  calls = %10u\n", headerp->vital_header.frees);
! 	quiet_println("   MaxVolumeId      = %u\n",
  	       headerp->vital_header.MaxVolumeId);
! 	quiet_println("   rw vol entries   = %u\n",
  	       headerp->vital_header.totalEntries[0]);
! 	quiet_println("   ro vol entries   = %u\n",
  	       headerp->vital_header.totalEntries[1]);
! 	quiet_println("   bk vol entries   = %u\n",
  	       headerp->vital_header.totalEntries[2]);
! 	quiet_println("   multihome info   = 0x%x (%u)\n", headerp->SIT,
  	       headerp->SIT);
! 	quiet_println("   server ip addr   table: size = %d entries\n",
  	       MAXSERVERID + 1);
! 	quiet_println("   volume name hash table: size = %d buckets\n", HASHSIZE);
! 	quiet_println("   volume id   hash table: %d tables with %d buckets each\n",
  	       MAXTYPES, HASHSIZE);
      }
  
      /* Check the header size */
      if (headerp->vital_header.headersize != sizeof(*headerp))
! 	log_error(VLDB_CHECK_WARNING,"Header reports its size as %d (should be %d)\n",
  	       headerp->vital_header.headersize, sizeof(*headerp));
      return;
  }
***************
*** 303,309 ****
  	for (j = 0; j < HASHSIZE; j++)
  	    headerp->VolidHash[i][j] = htonl(headerp->VolidHash[i][j]);
  
!     vldbwrite(0, headerp, sizeof(*headerp));
  }
  
  void
--- 337,343 ----
  	for (j = 0; j < HASHSIZE; j++)
  	    headerp->VolidHash[i][j] = htonl(headerp->VolidHash[i][j]);
  
!     vldbwrite(0, (char *)headerp, sizeof(*headerp));
  }
  
  void
***************
*** 312,318 ****
      int i, j;
      struct extentaddr *e;
  
!     vldbread(addr, mhblockP, VL_ADDREXTBLK_SIZE);
  
      mhblockP->ex_count = ntohl(mhblockP->ex_count);
      mhblockP->ex_flags = ntohl(mhblockP->ex_flags);
--- 346,352 ----
      int i, j;
      struct extentaddr *e;
  
!     vldbread(addr, (char *)mhblockP, VL_ADDREXTBLK_SIZE);
  
      mhblockP->ex_count = ntohl(mhblockP->ex_count);
      mhblockP->ex_flags = ntohl(mhblockP->ex_flags);
***************
*** 335,341 ****
  {
      int i;
  
!     vldbread(addr, vlentryp, sizeof(*vlentryp));
  
      for (i = 0; i < MAXTYPES; i++)
  	vlentryp->volumeId[i] = ntohl(vlentryp->volumeId[i]);
--- 369,375 ----
  {
      int i;
  
!     vldbread(addr, (char *)vlentryp, sizeof(*vlentryp));
  
      for (i = 0; i < MAXTYPES; i++)
  	vlentryp->volumeId[i] = ntohl(vlentryp->volumeId[i]);
***************
*** 361,407 ****
      }
  
      if (listentries) {
! 	printf("address %u: ", addr);
  	if (vlentryp->flags == VLCONTBLOCK) {
! 	    printf("mh extension block\n");
  	} else if (vlentryp->flags == VLFREE) {
! 	    printf("free vlentry\n");
  	} else {
! 	    printf("vlentry %s\n", vlentryp->name);
! 	    printf("   rw id = %u ; ro id = %u ; bk id = %u\n",
  		   vlentryp->volumeId[0], vlentryp->volumeId[1],
  		   vlentryp->volumeId[2]);
! 	    printf("   flags         =");
  	    if (vlentryp->flags & VLF_RWEXISTS)
! 		printf(" rw");
  	    if (vlentryp->flags & VLF_ROEXISTS)
! 		printf(" ro");
  	    if (vlentryp->flags & VLF_BACKEXISTS)
! 		printf(" bk");
  	    if (vlentryp->flags & 0xffff8fff)
! 		printf(" errorflag(0x%x)", vlentryp->flags);
! 	    printf("\n");
! 	    printf("   LockAfsId     = %d\n", vlentryp->LockAfsId);
! 	    printf("   LockTimestamp = %d\n", vlentryp->LockTimestamp);
! 	    printf("   cloneId       = %u\n", vlentryp->cloneId);
! 	    printf
  		("   next hash for rw = %u ; ro = %u ; bk = %u ; name = %u\n",
  		 vlentryp->nextIdHash[0], vlentryp->nextIdHash[1],
  		 vlentryp->nextIdHash[2], vlentryp->nextNameHash);
  	    for (i = 0; i < NMAXNSERVERS; i++) {
  		if (vlentryp->serverNumber[i] != 255) {
! 		    printf("   server %d ; partition %d ; flags =",
  			   vlentryp->serverNumber[i],
  			   vlentryp->serverPartition[i]);
  		    if (vlentryp->serverFlags[i] & VLSF_RWVOL)
! 			printf(" rw");
  		    if (vlentryp->serverFlags[i] & VLSF_ROVOL)
! 			printf(" ro");
  		    if (vlentryp->serverFlags[i] & VLSF_BACKVOL)
! 			printf(" bk");
  		    if (vlentryp->serverFlags[i] & VLSF_NEWREPSITE)
! 			printf(" newro");
! 		    printf("\n");
  		}
  	    }
  	}
--- 395,441 ----
      }
  
      if (listentries) {
! 	quiet_println("address %u: ", addr);
  	if (vlentryp->flags == VLCONTBLOCK) {
! 	    quiet_println("mh extension block\n");
  	} else if (vlentryp->flags == VLFREE) {
! 	    quiet_println("free vlentry\n");
  	} else {
! 	    quiet_println("vlentry %s\n", vlentryp->name);
! 	    quiet_println("   rw id = %u ; ro id = %u ; bk id = %u\n",
  		   vlentryp->volumeId[0], vlentryp->volumeId[1],
  		   vlentryp->volumeId[2]);
! 	    quiet_println("   flags         =");
  	    if (vlentryp->flags & VLF_RWEXISTS)
! 		quiet_println(" rw");
  	    if (vlentryp->flags & VLF_ROEXISTS)
! 		quiet_println(" ro");
  	    if (vlentryp->flags & VLF_BACKEXISTS)
! 		quiet_println(" bk");
  	    if (vlentryp->flags & 0xffff8fff)
! 		quiet_println(" errorflag(0x%x)", vlentryp->flags);
! 	    quiet_println("\n");
! 	    quiet_println("   LockAfsId     = %d\n", vlentryp->LockAfsId);
! 	    quiet_println("   LockTimestamp = %d\n", vlentryp->LockTimestamp);
! 	    quiet_println("   cloneId       = %u\n", vlentryp->cloneId);
! 	    quiet_println
  		("   next hash for rw = %u ; ro = %u ; bk = %u ; name = %u\n",
  		 vlentryp->nextIdHash[0], vlentryp->nextIdHash[1],
  		 vlentryp->nextIdHash[2], vlentryp->nextNameHash);
  	    for (i = 0; i < NMAXNSERVERS; i++) {
  		if (vlentryp->serverNumber[i] != 255) {
! 		    quiet_println("   server %d ; partition %d ; flags =",
  			   vlentryp->serverNumber[i],
  			   vlentryp->serverPartition[i]);
  		    if (vlentryp->serverFlags[i] & VLSF_RWVOL)
! 			quiet_println(" rw");
  		    if (vlentryp->serverFlags[i] & VLSF_ROVOL)
! 			quiet_println(" ro");
  		    if (vlentryp->serverFlags[i] & VLSF_BACKVOL)
! 			quiet_println(" bk");
  		    if (vlentryp->serverFlags[i] & VLSF_NEWREPSITE)
! 			quiet_println(" newro");
! 		    quiet_println("\n");
  		}
  	    }
  	}
***************
*** 414,421 ****
  {
      int i;
  
!     if (verbose)
! 	printf("Writing back entry at addr %u\n", addr);
      fixed++;
      for (i = 0; i < MAXTYPES; i++)
  	vlentryp->volumeId[i] = htonl(vlentryp->volumeId[i]);
--- 448,454 ----
  {
      int i;
  
!     if (verbose) quiet_println("Writing back entry at addr %u\n", addr);
      fixed++;
      for (i = 0; i < MAXTYPES; i++)
  	vlentryp->volumeId[i] = htonl(vlentryp->volumeId[i]);
***************
*** 431,437 ****
  	vlentryp->serverPartition[i] = htonl(vlentryp->serverPartition[i]);
  	vlentryp->serverFlags[i] = htonl(vlentryp->serverFlags[i]);
      }
!     vldbwrite(addr, vlentryp, sizeof(*vlentryp));
  }
  
  void
--- 464,470 ----
  	vlentryp->serverPartition[i] = htonl(vlentryp->serverPartition[i]);
  	vlentryp->serverFlags[i] = htonl(vlentryp->serverFlags[i]);
      }
!     vldbwrite(addr, (char *)vlentryp, sizeof(*vlentryp));
  }
  
  void
***************
*** 446,457 ****
      vldbread(addr, sitbuf, VL_ADDREXTBLK_SIZE);
      extent = (struct extentaddr *)sitbuf;
  
!     printf("multihome info block: base %d\n", base);
      if (base == 0) {
! 	printf("   count = %u\n", ntohl(extent->ex_count));
! 	printf("   flags = %u\n", ntohl(extent->ex_flags));
  	for (i = 0; i < VL_MAX_ADDREXTBLKS; i++) {
! 	    printf("   contaddrs[%d] = %u\n", i,
  		   ntohl(extent->ex_contaddrs[i]));
  	}
      }
--- 479,490 ----
      vldbread(addr, sitbuf, VL_ADDREXTBLK_SIZE);
      extent = (struct extentaddr *)sitbuf;
  
!     quiet_println("multihome info block: base %d\n", base);
      if (base == 0) {
! 	quiet_println("   count = %u\n", ntohl(extent->ex_count));
! 	quiet_println("   flags = %u\n", ntohl(extent->ex_flags));
  	for (i = 0; i < VL_MAX_ADDREXTBLKS; i++) {
! 	    quiet_println("   contaddrs[%d] = %u\n", i,
  		   ntohl(extent->ex_contaddrs[i]));
  	}
      }
***************
*** 464,472 ****
  	if (j >= VL_MAX_ADDREXTBLKS)
  	    continue;
  
! 	printf("   base %d index %d:\n", base, i);
  
! 	printf("       afsuuid    = (%x %x %x /%d/%d/ /%x/%x/%x/%x/%x/%x/)\n",
  	       ntohl(extent[i].ex_hostuuid.time_low),
  	       ntohl(extent[i].ex_hostuuid.time_mid),
  	       ntohl(extent[i].ex_hostuuid.time_hi_and_version),
--- 497,505 ----
  	if (j >= VL_MAX_ADDREXTBLKS)
  	    continue;
  
! 	quiet_println("   base %d index %d:\n", base, i);
  
! 	quiet_println("       afsuuid    = (%x %x %x /%d/%d/ /%x/%x/%x/%x/%x/%x/)\n",
  	       ntohl(extent[i].ex_hostuuid.time_low),
  	       ntohl(extent[i].ex_hostuuid.time_mid),
  	       ntohl(extent[i].ex_hostuuid.time_hi_and_version),
***************
*** 478,488 ****
  	       ntohl(extent[i].ex_hostuuid.node[3]),
  	       ntohl(extent[i].ex_hostuuid.node[4]),
  	       ntohl(extent[i].ex_hostuuid.node[5]));
! 	printf("       uniquifier = %u\n", ntohl(extent[i].ex_uniquifier));
  	for (j = 0; j < VL_MAXIPADDRS_PERMH; j++) {
  	    a = ntohl(extent[i].ex_addrs[j]);
  	    if (a) {
! 		printf("       %d.%d.%d.%d\n", (a >> 24) & 0xff,
  		       (a >> 16) & 0xff, (a >> 8) & 0xff, (a) & 0xff);
  	    }
  	}
--- 511,521 ----
  	       ntohl(extent[i].ex_hostuuid.node[3]),
  	       ntohl(extent[i].ex_hostuuid.node[4]),
  	       ntohl(extent[i].ex_hostuuid.node[5]));
! 	quiet_println("       uniquifier = %u\n", ntohl(extent[i].ex_uniquifier));
  	for (j = 0; j < VL_MAXIPADDRS_PERMH; j++) {
  	    a = ntohl(extent[i].ex_addrs[j]);
  	    if (a) {
! 		quiet_println("       %d.%d.%d.%d\n", (a >> 24) & 0xff,
  		       (a >> 16) & 0xff, (a >> 8) & 0xff, (a) & 0xff);
  	    }
  	}
***************
*** 505,512 ****
      afs_uint32 entrysize = 0;
      afs_uint32 maxvolid = 0;
  
!     if (verbose)
! 	printf("Read each entry in the database\n");
      for (addr = header->vital_header.headersize;
  	 addr < header->vital_header.eofPtr; addr += entrysize) {
  
--- 538,544 ----
      afs_uint32 entrysize = 0;
      afs_uint32 maxvolid = 0;
  
!     if (verbose) quiet_println("Read each entry in the database\n");
      for (addr = header->vital_header.headersize;
  	 addr < header->vital_header.eofPtr; addr += entrysize) {
  
***************
*** 514,520 ****
  	readentry(addr, &vlentry, &type);
  	if (type == VL) {
  	    if (!(vlentry.flags & VLF_RWEXISTS))
! 		printf("WARNING: VLDB entry '%s' has no RW volume\n",
  		       vlentry.name);
  
  	    for (i = 0; i < MAXTYPES; i++)
--- 546,552 ----
  	readentry(addr, &vlentry, &type);
  	if (type == VL) {
  	    if (!(vlentry.flags & VLF_RWEXISTS))
! 		log_error(VLDB_CHECK_WARNING,"VLDB_CHECK_WARNING: VLDB entry '%s' has no RW volume\n",
  		       vlentry.name);
  
  	    for (i = 0; i < MAXTYPES; i++)
***************
*** 540,551 ****
  		    continue;
   		}
  		if (e) {
! 		    printf
! 			("VLDB entry '%s' contains an unknown RW/RO index serverFlag\n",
  			 vlentry.name);
  		    e = 0;
  		}
! 		printf
  		    ("   index %d : serverNumber %d : serverPartition %d : serverFlag %d\n",
  		     j, vlentry.serverNumber[j], vlentry.serverPartition[j],
  		     vlentry.serverFlags[j]);
--- 572,583 ----
  		    continue;
   		}
  		if (e) {
! 		   log_error 
! 			(VLDB_CHECK_ERROR,"VLDB entry '%s' contains an unknown RW/RO index serverFlag\n",
  			 vlentry.name);
  		    e = 0;
  		}
! 		quiet_println
  		    ("   index %d : serverNumber %d : serverPartition %d : serverFlag %d\n",
  		     j, vlentry.serverNumber[j], vlentry.serverPartition[j],
  		     vlentry.serverFlags[j]);
***************
*** 554,560 ****
  
  	rindex = addr / sizeof(vlentry);
  	if (record[rindex].type) {
! 	    printf("INTERNAL ERROR: record holder %d already in use\n",
  		   rindex);
  	    return;
  	}
--- 586,592 ----
  
  	rindex = addr / sizeof(vlentry);
  	if (record[rindex].type) {
! 	    log_error(VLDB_CHECK_ERROR,"INTERNAL VLDB_CHECK_ERROR: record holder %d already in use\n",
  		   rindex);
  	    return;
  	}
***************
*** 572,591 ****
  	    entrysize = VL_ADDREXTBLK_SIZE;
  	    mhcount++;
  	} else {
! 	    printf("Unknown entry at %u. Aborting\n", addr);
  	    break;
  	}
      }
      if (verbose) {
! 	printf("Found %d entries, %d free entries, %d multihomed blocks\n",
  	       vlcount, freecount, mhcount);
! 	printf("Found %d RW volumes, %d BK volumes, %d RO volumes\n", rwcount,
  	       bkcount, rocount);
      }
  
      /* Check the maxmimum volume id in the header */
      if (maxvolid != header->vital_header.MaxVolumeId - 1)
! 	printf
  	    ("Header's maximum volume id is %u and largest id found in VLDB is %u\n",
  	     header->vital_header.MaxVolumeId, maxvolid);
  }
--- 604,623 ----
  	    entrysize = VL_ADDREXTBLK_SIZE;
  	    mhcount++;
  	} else {
! 	    log_error(VLDB_CHECK_ERROR, "Unknown entry at %u. Aborting\n", addr);
  	    break;
  	}
      }
      if (verbose) {
! 	quiet_println("Found %d entries, %d free entries, %d multihomed blocks\n",
  	       vlcount, freecount, mhcount);
! 	quiet_println("Found %d RW volumes, %d BK volumes, %d RO volumes\n", rwcount,
  	       bkcount, rocount);
      }
  
      /* Check the maxmimum volume id in the header */
      if (maxvolid != header->vital_header.MaxVolumeId - 1)
! 	quiet_println
  	    ("Header's maximum volume id is %u and largest id found in VLDB is %u\n",
  	     header->vital_header.MaxVolumeId, maxvolid);
  }
***************
*** 619,637 ****
  	if (next < 1) {
  	    switch(type & 0xf0) {
  	    case RWH:
! 	      if (vlentry.nextIdHash[0] != 0) {printf("bwoop\n");}
  		vlentry.nextIdHash[0] = new;
  		break;
  	    case ROH:
! 	      if (vlentry.nextIdHash[1] != 0) {printf("bwoop\n");}
  		vlentry.nextIdHash[1] = new;
  		break;
  	    case BKH:
! 	      if (vlentry.nextIdHash[2] != 0) {printf("bwoop\n");}
  		vlentry.nextIdHash[2] = new;
  		break;
  	    case NH:
! 	      if (vlentry.nextNameHash != 0) {printf("bwoop\n");}
  		vlentry.nextNameHash = new;
  		break;
  	    }
--- 651,669 ----
  	if (next < 1) {
  	    switch(type & 0xf0) {
  	    case RWH:
! 	      if (vlentry.nextIdHash[0] != 0) {quiet_println("bwoop\n");}
  		vlentry.nextIdHash[0] = new;
  		break;
  	    case ROH:
! 	      if (vlentry.nextIdHash[1] != 0) {quiet_println("bwoop\n");}
  		vlentry.nextIdHash[1] = new;
  		break;
  	    case BKH:
! 	      if (vlentry.nextIdHash[2] != 0) {quiet_println("bwoop\n");}
  		vlentry.nextIdHash[2] = new;
  		break;
  	    case NH:
! 	      if (vlentry.nextNameHash != 0) {quiet_println("bwoop\n");}
  		vlentry.nextNameHash = new;
  		break;
  	    }
***************
*** 655,668 ****
      afs_int32 i, type, rindex;
  
      /* Now follow the Name Hash Table */
!     if (verbose)
! 	printf("Check Volume Name Hash\n");
      for (i = 0; i < HASHSIZE; i++) {
  	chainlength = 0;
  	for (addr = header->VolnameHash[i]; addr; addr = vlentry.nextNameHash) {
  	    readentry(addr, &vlentry, &type);
  	    if (type != VL) {
! 		printf("Name Hash %d: Bad entry at %u: Not a valid vlentry\n",
  		       i, addr);
  		continue;
  	    }
--- 687,699 ----
      afs_int32 i, type, rindex;
  
      /* Now follow the Name Hash Table */
!     if (verbose) quiet_println("Check Volume Name Hash\n");
      for (i = 0; i < HASHSIZE; i++) {
  	chainlength = 0;
  	for (addr = header->VolnameHash[i]; addr; addr = vlentry.nextNameHash) {
  	    readentry(addr, &vlentry, &type);
  	    if (type != VL) {
! 		log_error(VLDB_CHECK_ERROR,"Name Hash %d: Bad entry at %u: Not a valid vlentry\n",
  		       i, addr);
  		continue;
  	    }
***************
*** 670,682 ****
  	    rindex = addr / sizeof(vlentry);
  
  	    if (record[rindex].addr != addr && record[rindex].addr) {
! 		printf
! 		    ("INTERNAL ERROR: addresses %u and %u use same record slot %d\n",
  		     record[rindex].addr, addr, rindex);
  	    }
  	    if (record[rindex].type & NH) {
! 		printf
! 		    ("Name Hash %d: Bad entry '%s': Already in the name hash\n",
  		     i, vlentry.name);
  		record[rindex].type |= MULTN;
  		break;
--- 701,713 ----
  	    rindex = addr / sizeof(vlentry);
  
  	    if (record[rindex].addr != addr && record[rindex].addr) {
! 	        log_error	
! 		    (VLDB_CHECK_ERROR,"INTERNAL VLDB_CHECK_ERROR: addresses %u and %u use same record slot %d\n",
  		     record[rindex].addr, addr, rindex);
  	    }
  	    if (record[rindex].type & NH) {
! 	        log_error	
! 		    (VLDB_CHECK_ERROR,"Name Hash %d: Bad entry '%s': Already in the name hash\n",
  		     i, vlentry.name);
  		record[rindex].type |= MULTN;
  		break;
***************
*** 689,696 ****
  
  	    /* Hash the name and check if in correct hash table */
  	    if (NameHash(vlentry.name) != i) {
! 		printf
! 		    ("Name Hash %d: Bad entry '%s': Incorrect name hash chain (should be in %d)\n",
  		     i, vlentry.name, NameHash(vlentry.name));
  		record[rindex].type |= MULTN;
  	    }
--- 720,727 ----
  
  	    /* Hash the name and check if in correct hash table */
  	    if (NameHash(vlentry.name) != i) {
! 	        log_error	
! 		    (VLDB_CHECK_ERROR,"Name Hash %d: Bad entry '%s': Incorrect name hash chain (should be in %d)\n",
  		     i, vlentry.name, NameHash(vlentry.name));
  		record[rindex].type |= MULTN;
  	    }
***************
*** 701,707 ****
  	    shortest = chainlength;
      }
      if (verbose) {
! 	printf
  	    ("%d entries in name hash, longest is %d, shortest is %d, average length is %f\n",
  	     count, longest, shortest, ((float)count / (float)HASHSIZE));
      }
--- 732,738 ----
  	    shortest = chainlength;
      }
      if (verbose) {
! 	quiet_println
  	    ("%d entries in name hash, longest is %d, shortest is %d, average length is %f\n",
  	     count, longest, shortest, ((float)count / (float)HASHSIZE));
      }
***************
*** 722,729 ****
      afs_int32 i, j, hash, type, rindex, ref, badref, badhash;
  
      /* Now follow the RW, RO, and BK Hash Tables */
!     if (verbose)
! 	printf("Check RW, RO, and BK id Hashes\n");
      for (i = 0; i < MAXTYPES; i++) {
  	hash = ((i == 0) ? RWH : ((i == 1) ? ROH : BKH));
  	ref = ((i == 0) ? REFRW : ((i == 1) ? REFRO : REFBK));
--- 753,759 ----
      afs_int32 i, j, hash, type, rindex, ref, badref, badhash;
  
      /* Now follow the RW, RO, and BK Hash Tables */
!     if (verbose) quiet_println("Check RW, RO, and BK id Hashes\n");
      for (i = 0; i < MAXTYPES; i++) {
  	hash = ((i == 0) ? RWH : ((i == 1) ? ROH : BKH));
  	ref = ((i == 0) ? REFRW : ((i == 1) ? REFRO : REFBK));
***************
*** 738,758 ****
  		 addr = vlentry.nextIdHash[i]) {
  		readentry(addr, &vlentry, &type);
  		if (type != VL) {
! 		    printf
! 			("%s Id Hash %d: Bad entry at %u: Not a valid vlentry\n",
  			 vtype(i), j, addr);
  		    continue;
  		}
  
  		rindex = addr / sizeof(vlentry);
  		if (record[rindex].addr != addr && record[rindex].addr) {
! 		    printf
! 			("INTERNAL ERROR: addresses %u and %u use same record slot %d\n",
  			 record[rindex].addr, addr, rindex);
  		}
  		if (record[rindex].type & hash) {
! 		    printf
! 			("%s Id Hash %d: Bad entry '%s': Already in the hash table\n",
  			 vtype(i), j, vlentry.name);
  		    record[rindex].type |= badref;
  		    break;
--- 768,788 ----
  		 addr = vlentry.nextIdHash[i]) {
  		readentry(addr, &vlentry, &type);
  		if (type != VL) {
! 		   log_error 
! 			(VLDB_CHECK_ERROR,"%s Id Hash %d: Bad entry at %u: Not a valid vlentry\n",
  			 vtype(i), j, addr);
  		    continue;
  		}
  
  		rindex = addr / sizeof(vlentry);
  		if (record[rindex].addr != addr && record[rindex].addr) {
! 		   log_error 
! 			(VLDB_CHECK_ERROR,"INTERNAL VLDB_CHECK_ERROR: addresses %u and %u use same record slot %d\n",
  			 record[rindex].addr, addr, rindex);
  		}
  		if (record[rindex].type & hash) {
! 		   log_error 
! 			(VLDB_CHECK_ERROR,"%s Id Hash %d: Bad entry '%s': Already in the hash table\n",
  			 vtype(i), j, vlentry.name);
  		    record[rindex].type |= badref;
  		    break;
***************
*** 765,772 ****
  
  		/* Hash the id and check if in correct hash table */
  		if (IdHash(vlentry.volumeId[i]) != j) {
! 		    printf
! 			("%s Id Hash %d: Bad entry '%s': Incorrect Id hash chain (should be in %d)\n",
  			 vtype(i), j, vlentry.name,
  			 IdHash(vlentry.volumeId[i]));
  		    record[rindex].type |= badhash;
--- 795,802 ----
  
  		/* Hash the id and check if in correct hash table */
  		if (IdHash(vlentry.volumeId[i]) != j) {
! 		   log_error 
! 			(VLDB_CHECK_ERROR,"%s Id Hash %d: Bad entry '%s': Incorrect Id hash chain (should be in %d)\n",
  			 vtype(i), j, vlentry.name,
  			 IdHash(vlentry.volumeId[i]));
  		    record[rindex].type |= badhash;
***************
*** 780,789 ****
  		shortest = chainlength;
  	}
  	if (verbose) {
! 	    printf
  		("%d entries in %s hash, longest is %d, shortest is %d, average length is %f\n",
! 		 count, vtype(i), longest, shortest,
! 		 ((float)count / (float)HASHSIZE));
  	}
      }
      return;
--- 810,818 ----
  		shortest = chainlength;
  	}
  	if (verbose) {
! 	    quiet_println
  		("%d entries in %s hash, longest is %d, shortest is %d, average length is %f\n",
! 		 count, vtype(i), longest, shortest,((float)count / (float)HASHSIZE));
  	}
      }
      return;
***************
*** 802,827 ****
      afs_int32 type, rindex;
  
      /* Now follow the Free Chain */
!     if (verbose)
! 	printf("Check Volume Free Chain\n");
      for (addr = header->vital_header.freePtr; addr;
  	 addr = vlentry.nextIdHash[0]) {
  	readentry(addr, &vlentry, &type);
  	if (type != FR) {
! 	    printf
! 		("Free Chain %d: Bad entry at %u: Not a valid free vlentry (0x%x)\n",
  		 count, addr, type);
  	    continue;
  	}
  
  	rindex = addr / sizeof(vlentry);
  	if (record[rindex].addr != addr && record[rindex].addr) {
! 	    printf
! 		("INTERNAL ERROR: addresses %u and %u use same record slot %d\n",
  		 record[rindex].addr, addr, rindex);
  	}
  	if (record[rindex].type & FRC) {
! 	    printf("Free Chain: Bad entry at %u: Already in the free chain\n",
  		   addr);
  	    break;
  	}
--- 831,855 ----
      afs_int32 type, rindex;
  
      /* Now follow the Free Chain */
!     if (verbose) quiet_println("Check Volume Free Chain\n");
      for (addr = header->vital_header.freePtr; addr;
  	 addr = vlentry.nextIdHash[0]) {
  	readentry(addr, &vlentry, &type);
  	if (type != FR) {
! 	   log_error 
! 		(VLDB_CHECK_ERROR,"Free Chain %d: Bad entry at %u: Not a valid free vlentry (0x%x)\n",
  		 count, addr, type);
  	    continue;
  	}
  
  	rindex = addr / sizeof(vlentry);
  	if (record[rindex].addr != addr && record[rindex].addr) {
! 	   log_error 
! 		(VLDB_CHECK_ERROR,"INTERNAL VLDB_CHECK_ERROR: addresses %u and %u use same record slot %d\n",
  		 record[rindex].addr, addr, rindex);
  	}
  	if (record[rindex].type & FRC) {
! 	    log_error(VLDB_CHECK_ERROR,"Free Chain: Bad entry at %u: Already in the free chain\n",
  		   addr);
  	    break;
  	}
***************
*** 830,836 ****
  	count++;
      }
      if (verbose)
! 	printf("%d entries on free chain\n", count);
      return;
  }
  
--- 858,864 ----
  	count++;
      }
      if (verbose)
!      quiet_println("%d entries on free chain\n", count);
      return;
  }
  
***************
*** 866,872 ****
      memset(&nulluuid, 0, sizeof(nulluuid));
  
      if (verbose)
! 	printf("Check Multihomed blocks\n");
  
      if (header->SIT) {
  	/* Read the first MH block and from it, gather the 
--- 894,900 ----
      memset(&nulluuid, 0, sizeof(nulluuid));
  
      if (verbose)
! 	quiet_println("Check Multihomed blocks\n");
  
      if (header->SIT) {
  	/* Read the first MH block and from it, gather the 
***************
*** 874,881 ****
  	 */
  	readMH(header->SIT, MHblock);
  	if (MHblock->ex_flags != VLCONTBLOCK) {
! 	    printf
! 		("Multihomed Block 0: Bad entry at %u: Not a valid multihomed block\n",
  		 header->SIT);
  	}
  
--- 902,909 ----
  	 */
  	readMH(header->SIT, MHblock);
  	if (MHblock->ex_flags != VLCONTBLOCK) {
! 	   log_error 
! 		(VLDB_CHECK_ERROR,"Multihomed Block 0: Bad entry at %u: Not a valid multihomed block\n",
  		 header->SIT);
  	}
  
***************
*** 884,891 ****
  	}
  
  	if (header->SIT != caddrs[0]) {
! 	    printf
! 		("MH block does not point to self %u in header, %u in block\n",
  		 header->SIT, caddrs[0]);
  	}
  
--- 912,919 ----
  	}
  
  	if (header->SIT != caddrs[0]) {
! 	   log_error 
! 		(VLDB_CHECK_ERROR,"MH block does not point to self %u in header, %u in block\n",
  		 header->SIT, caddrs[0]);
  	}
  
***************
*** 896,915 ****
  
  	    readMH(caddrs[i], MHblock);
  	    if (MHblock->ex_flags != VLCONTBLOCK) {
! 		printf
! 		    ("Multihomed Block 0: Bad entry at %u: Not a valid multihomed block\n",
  		     header->SIT);
  	    }
  
  	    rindex = caddrs[i] / sizeof(vlentry);
  	    if (record[rindex].addr != caddrs[i] && record[rindex].addr) {
! 		printf
! 		    ("INTERNAL ERROR: addresses %u and %u use same record slot %d\n",
  		     record[rindex].addr, caddrs[i], rindex);
  	    }
  	    if (record[rindex].type & FRC) {
! 		printf
! 		    ("MH Blocks Chain %d: Bad entry at %u: Already a MH block\n",
  		     i, record[rindex].addr);
  		break;
  	    }
--- 924,943 ----
  
  	    readMH(caddrs[i], MHblock);
  	    if (MHblock->ex_flags != VLCONTBLOCK) {
! 	        log_error	
! 		    (VLDB_CHECK_ERROR,"Multihomed Block 0: Bad entry at %u: Not a valid multihomed block\n",
  		     header->SIT);
  	    }
  
  	    rindex = caddrs[i] / sizeof(vlentry);
  	    if (record[rindex].addr != caddrs[i] && record[rindex].addr) {
! 	        log_error	
! 		    (VLDB_CHECK_ERROR,"INTERNAL VLDB_CHECK_ERROR: addresses %u and %u use same record slot %d\n",
  		     record[rindex].addr, caddrs[i], rindex);
  	    }
  	    if (record[rindex].type & FRC) {
! 	        log_error	
! 		    (VLDB_CHECK_ERROR,"MH Blocks Chain %d: Bad entry at %u: Already a MH block\n",
  		     i, record[rindex].addr);
  		break;
  	    }
***************
*** 944,951 ****
  
  		if (memcmp(&e->ex_hostuuid, &nulluuid, sizeof(afsUUID)) == 0) {
  		    if (ipindex != -1) {
! 			printf
! 			    ("Server Addrs index %d references null MH block %d, index %d\n",
  			     ipindex, i, j);
  			serveraddrs[ipindex] = 0;	/* avoids printing 2nd error below */
  		    }
--- 972,979 ----
  
  		if (memcmp(&e->ex_hostuuid, &nulluuid, sizeof(afsUUID)) == 0) {
  		    if (ipindex != -1) {
! 		        log_error	
! 			    (VLDB_CHECK_ERROR,"Server Addrs index %d references null MH block %d, index %d\n",
  			     ipindex, i, j);
  			serveraddrs[ipindex] = 0;	/* avoids printing 2nd error below */
  		    }
***************
*** 963,970 ****
  		if (ipaddrs) {
  		    mhentries++;
  		    if (ipindex == -1) {
! 			printf
! 			    ("MH block %d, index %d: Not referenced by server addrs\n",
  			     i, j);
  		    } else {
  			serveraddrs[ipindex] = ipaddrs;	/* It is good */
--- 991,998 ----
  		if (ipaddrs) {
  		    mhentries++;
  		    if (ipindex == -1) {
! 		        log_error    	
! 			    (VLDB_CHECK_ERROR,"MH block %d, index %d: Not referenced by server addrs\n",
  			     i, j);
  		    } else {
  			serveraddrs[ipindex] = ipaddrs;	/* It is good */
***************
*** 972,1004 ****
  		}
  
  		if (listservers && ipaddrs) {
! 		    printf("MH block %d, index %d:", i, j);
  		    for (m = 0; m < VL_MAXIPADDRS_PERMH; m++) {
  			if (!e->ex_addrs[m])
  			    continue;
! 			printf(" %d.%d.%d.%d",
  			       (e->ex_addrs[m] & 0xff000000) >> 24,
  			       (e->ex_addrs[m] & 0x00ff0000) >> 16,
  			       (e->ex_addrs[m] & 0x0000ff00) >> 8,
  			       (e->ex_addrs[m] & 0x000000ff));
  		    }
! 		    printf("\n");
  		}
  	    }
  /*
   *      if (mhentries != MHblock->ex_count) {
!  *	   printf("MH blocks says it has %d entries (found %d)\n",
   *		  MHblock->ex_count, mhentries);
   *	}
   */
  	}
      }
      if (verbose)
! 	printf("%d multihomed blocks\n", mhblocks);
  
      /* Check the server addresses */
      if (verbose)
! 	printf("Check server addresses\n");
      mhentries = regentries = 0;
      for (i = 0; i <= MAXSERVERID; i++) {
  	if (header->IpMappedAddr[i]) {
--- 1000,1032 ----
  		}
  
  		if (listservers && ipaddrs) {
! 		    quiet_println("MH block %d, index %d:", i, j);
  		    for (m = 0; m < VL_MAXIPADDRS_PERMH; m++) {
  			if (!e->ex_addrs[m])
  			    continue;
! 			quiet_println(" %d.%d.%d.%d",
  			       (e->ex_addrs[m] & 0xff000000) >> 24,
  			       (e->ex_addrs[m] & 0x00ff0000) >> 16,
  			       (e->ex_addrs[m] & 0x0000ff00) >> 8,
  			       (e->ex_addrs[m] & 0x000000ff));
  		    }
! 		    quiet_println("\n");
  		}
  	    }
  /*
   *      if (mhentries != MHblock->ex_count) {
!  *	   quiet_println("MH blocks says it has %d entries (found %d)\n",
   *		  MHblock->ex_count, mhentries);
   *	}
   */
  	}
      }
      if (verbose)
! 	quiet_println("%d multihomed blocks\n", mhblocks);
  
      /* Check the server addresses */
      if (verbose)
! 	quiet_println("Check server addresses\n");
      mhentries = regentries = 0;
      for (i = 0; i <= MAXSERVERID; i++) {
  	if (header->IpMappedAddr[i]) {
***************
*** 1006,1027 ****
  		mhentries++;
  		if (((header->IpMappedAddr[i] & 0x00ff0000) >> 16) >
  		    VL_MAX_ADDREXTBLKS)
! 		    printf
! 			("IP Addr for entry %d: Multihome block is bad (%d)\n",
  			 i, ((header->IpMappedAddr[i] & 0x00ff0000) >> 16));
  		if (((header->IpMappedAddr[i] & 0x0000ffff) > VL_MHSRV_PERBLK)
  		    || ((header->IpMappedAddr[i] & 0x0000ffff) < 1))
! 		    printf
! 			("IP Addr for entry %d: Multihome index is bad (%d)\n",
  			 i, (header->IpMappedAddr[i] & 0x0000ffff));
  		if (serveraddrs[i] == -1) {
! 		    printf
! 			("warning: IP Addr for entry %d: Multihome entry has no ip addresses\n",
  			 i);
  		    serveraddrs[i] = 0;
  		}
  		if (listservers) {
! 		    printf("   Server ip addr %d = MH block %d, index %d\n",
  			   i, (header->IpMappedAddr[i] & 0x00ff0000) >> 16,
  			   (header->IpMappedAddr[i] & 0x0000ffff));
  		}
--- 1034,1055 ----
  		mhentries++;
  		if (((header->IpMappedAddr[i] & 0x00ff0000) >> 16) >
  		    VL_MAX_ADDREXTBLKS)
! 		   log_error 
! 			(VLDB_CHECK_ERROR,"IP Addr for entry %d: Multihome block is bad (%d)\n",
  			 i, ((header->IpMappedAddr[i] & 0x00ff0000) >> 16));
  		if (((header->IpMappedAddr[i] & 0x0000ffff) > VL_MHSRV_PERBLK)
  		    || ((header->IpMappedAddr[i] & 0x0000ffff) < 1))
! 		    log_error 
! 			(VLDB_CHECK_ERROR,"IP Addr for entry %d: Multihome index is bad (%d)\n",
  			 i, (header->IpMappedAddr[i] & 0x0000ffff));
  		if (serveraddrs[i] == -1) {
! 		    log_error 
! 			(VLDB_CHECK_WARNING,"warning: IP Addr for entry %d: Multihome entry has no ip addresses\n",
  			 i);
  		    serveraddrs[i] = 0;
  		}
  		if (listservers) {
! 		    quiet_println("   Server ip addr %d = MH block %d, index %d\n",
  			   i, (header->IpMappedAddr[i] & 0x00ff0000) >> 16,
  			   (header->IpMappedAddr[i] & 0x0000ffff));
  		}
***************
*** 1029,1035 ****
  		regentries++;
  		serveraddrs[i] = 1;	/* It is good */
  		if (listservers) {
! 		    printf("   Server ip addr %d = %d.%d.%d.%d\n", i,
  			   (header->IpMappedAddr[i] & 0xff000000) >> 24,
  			   (header->IpMappedAddr[i] & 0x00ff0000) >> 16,
  			   (header->IpMappedAddr[i] & 0x0000ff00) >> 8,
--- 1057,1063 ----
  		regentries++;
  		serveraddrs[i] = 1;	/* It is good */
  		if (listservers) {
! 		    quiet_println("   Server ip addr %d = %d.%d.%d.%d\n", i,
  			   (header->IpMappedAddr[i] & 0xff000000) >> 24,
  			   (header->IpMappedAddr[i] & 0x00ff0000) >> 16,
  			   (header->IpMappedAddr[i] & 0x0000ff00) >> 8,
***************
*** 1039,1045 ****
  	}
      }
      if (verbose) {
! 	printf("%d simple entries, %d multihomed entries, Total = %d\n",
  	       regentries, mhentries, mhentries + regentries);
      }
      return;
--- 1067,1073 ----
  	}
      }
      if (verbose) {
! 	quiet_println("%d simple entries, %d multihomed entries, Total = %d\n",
  	       regentries, mhentries, mhentries + regentries);
      }
      return;
***************
*** 1049,1055 ****
  FixBad(afs_uint32 idx, afs_uint32 addr, afs_uint32 type, afs_uint32 tmp, 
         struct nvlentry *vlentry, afs_uint32 hash) {
      SetHashEnd(addr, type, tmp);
!     printf("linked unlinked chain %u (index %d) to end of chain %d for %s hash\n", 
  	   tmp, ADDR(tmp), hash, type==NH?"Name":(type==RWH?"RW":(type==ROH?"RO":"BK")));
  }
  
--- 1077,1083 ----
  FixBad(afs_uint32 idx, afs_uint32 addr, afs_uint32 type, afs_uint32 tmp, 
         struct nvlentry *vlentry, afs_uint32 hash) {
      SetHashEnd(addr, type, tmp);
!     quiet_println("linked unlinked chain %u (index %d) to end of chain %d for %s hash\n", 
  	   tmp, ADDR(tmp), hash, type==NH?"Name":(type==RWH?"RW":(type==ROH?"RO":"BK")));
  }
  
***************
*** 1062,1080 ****
      struct nvlentry vlentry, vlentry2;
      int i, j, help = 0;
  
      dbfile = as->parms[0].items->data;	/* -database */
      listuheader = (as->parms[1].items ? 1 : 0);	/* -uheader  */
      listheader = (as->parms[2].items ? 1 : 0);	/* -vheader  */
      listservers = (as->parms[3].items ? 1 : 0);	/* -servers  */
      listentries = (as->parms[4].items ? 1 : 0);	/* -entries  */
      verbose = (as->parms[5].items ? 1 : 0);	/* -verbose  */
!     fix = (as->parms[6].items ? 1 : 0);	/* -fix  */
  
   restart:
      /* open the vldb database file */
      fd = open(dbfile, (fix > 0)?O_RDWR:O_RDONLY, 0);
      if (fd < 0) {
! 	printf("can't open file '%s'. error = %d\n", dbfile, errno);
  	return 0;
      }
  
--- 1090,1117 ----
      struct nvlentry vlentry, vlentry2;
      int i, j, help = 0;
  
+     error_level = 0;  /*  start clean with no error status */
      dbfile = as->parms[0].items->data;	/* -database */
      listuheader = (as->parms[1].items ? 1 : 0);	/* -uheader  */
      listheader = (as->parms[2].items ? 1 : 0);	/* -vheader  */
      listservers = (as->parms[3].items ? 1 : 0);	/* -servers  */
      listentries = (as->parms[4].items ? 1 : 0);	/* -entries  */
      verbose = (as->parms[5].items ? 1 : 0);	/* -verbose  */
!     quiet = (as->parms[6].items ? 1 : 0);  /* -quiet */
!     fix = (as->parms[7].items ? 1 : 0);    /* -fix  */
! 
!     /* sanity check */
!     if (quiet && (verbose || listuheader || listheader ||listservers \
!                 || listentries)) {
!         log_error(VLDB_CHECK_FATAL," -quiet cannot be used other display flags\n");
!         return VLDB_CHECK_FATAL;
!     }
  
   restart:
      /* open the vldb database file */
      fd = open(dbfile, (fix > 0)?O_RDWR:O_RDONLY, 0);
      if (fd < 0) {
! 	log_error(VLDB_CHECK_FATAL,"can't open file '%s'. error = %d\n", dbfile, errno);
  	return 0;
      }
  
***************
*** 1082,1089 ****
      readUbikHeader();
      readheader(&header);
      if (header.vital_header.vldbversion < 3) {
! 	printf("does not support vldb with version less than 3\n");
! 	return 0;
      }
  
      maxentries = (header.vital_header.eofPtr / sizeof(vlentry)) + 1;
--- 1119,1126 ----
      readUbikHeader();
      readheader(&header);
      if (header.vital_header.vldbversion < 3) {
! 	log_error(VLDB_CHECK_FATAL,"does not support vldb with version less than 3\n");
! 	return VLDB_CHECK_FATAL;
      }
  
      maxentries = (header.vital_header.eofPtr / sizeof(vlentry)) + 1;
***************
*** 1112,1118 ****
       * valid (the serveraddrs array).
       */
      if (verbose)
! 	printf("Verify each volume entry\n");
      for (i = 0; i < maxentries; i++) {
  	int nextp = 0;
  	int reft = 0;
--- 1149,1155 ----
       * valid (the serveraddrs array).
       */
      if (verbose)
! 	quiet_println("Verify each volume entry\n");
      for (i = 0; i < maxentries; i++) {
  	int nextp = 0;
  	int reft = 0;
***************
*** 1134,1140 ****
  	    readentry(record[i].addr, &vlentry, &type);
  
  	    if (InvalidVolname(vlentry.name))
! 		printf("Volume '%s' at addr %u has an invalid name\n",
  		       vlentry.name, record[i].addr);
  
  	    if (!(record[i].type & NH)) {
--- 1171,1177 ----
  	    readentry(record[i].addr, &vlentry, &type);
  
  	    if (InvalidVolname(vlentry.name))
! 		log_error(VLDB_CHECK_ERROR,"Volume '%s' at addr %u has an invalid name\n",
  		       vlentry.name, record[i].addr);
  
  	    if (!(record[i].type & NH)) {
***************
*** 1230,1300 ****
  	    }
  
  	    if (foundbad) {
! 		printf("%d: Volume '%s' %snot found in %s hash %d", i, 
  		       vlentry.name, volidbuf, which, hash);
  		if (nextp) {
! 		    printf(" (next %d", nextp);
  		    if (!(record[nextp].type & reft)) {
! 			printf(" not in chain ");
  			record[nextp].type |= reft;
  		    } else if (nextp != 0) {
! 			printf(" next in chain");
  			if (fix) {
! 			    printf(", unchaining");
  			    *nextpp = 0;
  			    writeentry(record[i].addr, &vlentry);
  			}
  		    }
! 		    printf(")");
  		}
! 		printf("\n");
  	    }
  	
  	    for (j = 0; j < NMAXNSERVERS; j++) {
  		if ((vlentry.serverNumber[j] != 255)
  		    && (serveraddrs[vlentry.serverNumber[j]] == 0)) {
! 		    printf
! 			("Volume '%s', index %d points to empty server entry %d\n",
  			 vlentry.name, j, vlentry.serverNumber[j]);
  		}
  	    }
  	
  	    if (record[i].type & 0xffff0f00)
! 		printf
! 		    ("Volume '%s' id %u also found on other chains (0x%x)\n",
  		     vlentry.name, vlentry.volumeId[0], record[i].type);
  	    
  	    /* A free entry */
  	} else if (record[i].type & FR) {
  	    if (!(record[i].type & FRC))
! 		printf("Free vlentry at %u not on free chain\n",
  		       record[i].addr);
  	    
  	    if (record[i].type & 0xfffffdf0)
! 		printf
! 		    ("Free vlentry at %u also found on other chains (0x%x)\n",
  		     record[i].addr, record[i].type);
  	    
  	    /* A multihomed entry */
  	} else if (record[i].type & MH) {
  	    if (!(record[i].type & MHC))
! 		printf("Multihomed block at %u is orphaned\n",
  		       record[i].addr);
  	    
  	    if (record[i].type & 0xfffffef0)
! 		printf
! 		    ("Multihomed block at %u also found on other chains (0x%x)\n",
  		     record[i].addr, record[i].type);
  	    
  	} else {
! 	    printf("Unknown entry type at %u (0x%x)\n", record[i].addr,
  		   record[i].type);
  	}
      }
  
!     if (verbose)
! 	printf("Verify each chain head\n");
! 
      {
  	afs_uint32 addr;
  	int hash;
--- 1267,1335 ----
  	    }
  
  	    if (foundbad) {
! 		log_error(VLDB_CHECK_ERROR,"%d: Volume '%s' %snot found in %s hash %d", i, 
  		       vlentry.name, volidbuf, which, hash);
  		if (nextp) {
! 		    log_error(VLDB_CHECK_ERROR," (next %d", nextp);
  		    if (!(record[nextp].type & reft)) {
! 			log_error(VLDB_CHECK_ERROR," not in chain ");
  			record[nextp].type |= reft;
  		    } else if (nextp != 0) {
! 			log_error(VLDB_CHECK_ERROR," next in chain");
  			if (fix) {
! 			    log_error(VLDB_CHECK_ERROR,", unchaining");
  			    *nextpp = 0;
  			    writeentry(record[i].addr, &vlentry);
  			}
  		    }
! 		    log_error(VLDB_CHECK_ERROR,")");
  		}
! 		log_error(VLDB_CHECK_ERROR,"\n");
  	    }
  	
  	    for (j = 0; j < NMAXNSERVERS; j++) {
  		if ((vlentry.serverNumber[j] != 255)
  		    && (serveraddrs[vlentry.serverNumber[j]] == 0)) {
! 		   log_error 
! 			(VLDB_CHECK_ERROR,"Volume '%s', index %d points to empty server entry %d\n",
  			 vlentry.name, j, vlentry.serverNumber[j]);
  		}
  	    }
  	
  	    if (record[i].type & 0xffff0f00)
! 	        log_error	
! 		    (VLDB_CHECK_ERROR,"Volume '%s' id %u also found on other chains (0x%x)\n",
  		     vlentry.name, vlentry.volumeId[0], record[i].type);
  	    
  	    /* A free entry */
  	} else if (record[i].type & FR) {
  	    if (!(record[i].type & FRC))
! 		log_error(VLDB_CHECK_ERROR,"Free vlentry at %u not on free chain\n",
  		       record[i].addr);
  	    
  	    if (record[i].type & 0xfffffdf0)
! 	        log_error	
! 		    (VLDB_CHECK_ERROR,"Free vlentry at %u also found on other chains (0x%x)\n",
  		     record[i].addr, record[i].type);
  	    
  	    /* A multihomed entry */
  	} else if (record[i].type & MH) {
  	    if (!(record[i].type & MHC))
! 		log_error(VLDB_CHECK_ERROR,"Multihomed block at %u is orphaned\n",
  		       record[i].addr);
  	    
  	    if (record[i].type & 0xfffffef0)
! 	        log_error	
! 		    (VLDB_CHECK_ERROR,"Multihomed block at %u also found on other chains (0x%x)\n",
  		     record[i].addr, record[i].type);
  	    
  	} else {
! 	    log_error(VLDB_CHECK_ERROR,"Unknown entry type at %u (0x%x)\n", record[i].addr,
  		   record[i].type);
  	}
      }
  
!     if (verbose)  quiet_println("Verify each chain head\n");
      {
  	afs_uint32 addr;
  	int hash;
***************
*** 1313,1360 ****
  	    }
  	}
  	for (i = 0; i <= 2; i++) {
! 	    for (j = 0; j < HASHSIZE; j++) {
! 		addr = header.VolidHash[i][j]; 
  		if (i == 0 && (record[ADDR(addr)].type & MULTRW)) {
  		    hash = IdHash(vlentry.volumeId[i]);
  		    if (hash != j) {
  			header.VolidHash[i][j] = vlentry.nextIdHash[i];
  			vlentry.nextIdHash[i] = 0;
! 			if (fix)
  			    writeentry(record[i].addr, &vlentry);
  		    }
  		}
  
  		if (i == 1 && (record[ADDR(addr)].type & MULTRO)) {
  		    hash = IdHash(vlentry.volumeId[i]);
  		    if (hash != j) {
  			header.VolidHash[i][j] = vlentry.nextIdHash[i];
  			vlentry.nextIdHash[i] = 0;
! 			if (fix)
  			    writeentry(record[i].addr, &vlentry);
  		    }
  		}
  
  		if (i == 2 && (record[ADDR(addr)].type & MULTBK)) {
  		    hash = IdHash(vlentry.volumeId[i]);
  		    if (hash != j) {
  			header.VolidHash[i][j] = vlentry.nextIdHash[i];
  			vlentry.nextIdHash[i] = 0;
! 			if (fix)
  			    writeentry(record[i].addr, &vlentry);
  		    }
  		}
  	    }
  	}
      }
      /* By the time we get here, unchained entries are really unchained */
!     printf("Scanning %u entries for possible repairs\n", maxentries);
      for (i = 0; i < maxentries; i++) {
  	int *nextpp;
  	if (record[i].type & VL) {
  	    readentry(record[i].addr, &vlentry, &type);
  	    if (!(record[i].type & REFN)) {
! 		printf("%d: Record %u (type 0x%x) not in a name chain\n", i, 
  		       record[i].addr, record[i].type);
  		if (strlen(vlentry.name)>0) {
  		    if (fix) {
--- 1348,1401 ----
  	    }
  	}
  	for (i = 0; i <= 2; i++) {
!          for (j = 0, addr = header.VolidHash[i][j]; j < HASHSIZE; j++) {
!         if (verbose) quiet_println("got %d %d %d\n", i, j, ADDR(addr));
  		if (i == 0 && (record[ADDR(addr)].type & MULTRW)) {
  		    hash = IdHash(vlentry.volumeId[i]);
  		    if (hash != j) {
  			header.VolidHash[i][j] = vlentry.nextIdHash[i];
  			vlentry.nextIdHash[i] = 0;
! 			if (fix) {
!                          quiet_println("fix %d %d %d\n", i, j, ADDR(addr));
  			    writeentry(record[i].addr, &vlentry);
  		    }
  		}
+ 		}
  
  		if (i == 1 && (record[ADDR(addr)].type & MULTRO)) {
  		    hash = IdHash(vlentry.volumeId[i]);
  		    if (hash != j) {
  			header.VolidHash[i][j] = vlentry.nextIdHash[i];
  			vlentry.nextIdHash[i] = 0;
! 			if (fix) {
!                          quiet_println("fix %d %d %d\n", i, j, addr);
  			    writeentry(record[i].addr, &vlentry);
  		    }
  		}
+ 		}
  
  		if (i == 2 && (record[ADDR(addr)].type & MULTBK)) {
  		    hash = IdHash(vlentry.volumeId[i]);
  		    if (hash != j) {
  			header.VolidHash[i][j] = vlentry.nextIdHash[i];
  			vlentry.nextIdHash[i] = 0;
! 			if (fix) {
!                          quiet_println("fix %d %d %d\n", i, j, addr);
  			    writeentry(record[i].addr, &vlentry);
  		    }
  		}
  	    }
  	}
      }
+     }
      /* By the time we get here, unchained entries are really unchained */
!     quiet_println("Scanning %u entries for possible repairs\n", maxentries);
      for (i = 0; i < maxentries; i++) {
  	int *nextpp;
  	if (record[i].type & VL) {
  	    readentry(record[i].addr, &vlentry, &type);
  	    if (!(record[i].type & REFN)) {
! 		log_error(VLDB_CHECK_ERROR,"%d: Record %u (type 0x%x) not in a name chain\n", i, 
  		       record[i].addr, record[i].type);
  		if (strlen(vlentry.name)>0) {
  		    if (fix) {
***************
*** 1373,1379 ****
  		}
  	    }
  	    if (vlentry.volumeId[0] && !(record[i].type & REFRW)) {
! 		printf("%d: Record %u (type 0x%x) not in a RW chain\n", i,
  		       record[i].addr, record[i].type);
  		if (fix) {
  		    if (header.VolidHash[0][IdHash(vlentry.volumeId[0])] == 0)
--- 1414,1420 ----
  		}
  	    }
  	    if (vlentry.volumeId[0] && !(record[i].type & REFRW)) {
! 		log_error(VLDB_CHECK_ERROR,"%d: Record %u (type 0x%x) not in a RW chain\n", i,
  		       record[i].addr, record[i].type);
  		if (fix) {
  		    if (header.VolidHash[0][IdHash(vlentry.volumeId[0])] == 0)
***************
*** 1383,1389 ****
  		}
  	    }
  	    if (vlentry.volumeId[1] && !(record[i].type & REFRO)) {
! 		printf("%d: Record %u (type 0x%x) not in a RO chain\n", i, 
  		       record[i].addr, record[i].type);
  		if (fix) {
  		    if (header.VolidHash[1][IdHash(vlentry.volumeId[1])] == 0)
--- 1424,1430 ----
  		}
  	    }
  	    if (vlentry.volumeId[1] && !(record[i].type & REFRO)) {
! 		log_error(VLDB_CHECK_ERROR,"%d: Record %u (type 0x%x) not in a RO chain\n", i, 
  		       record[i].addr, record[i].type);
  		if (fix) {
  		    if (header.VolidHash[1][IdHash(vlentry.volumeId[1])] == 0)
***************
*** 1393,1399 ****
  		}
  	    }
  	    if (vlentry.volumeId[2] && !(record[i].type & REFBK)) {
! 		printf("%d: Record %u (type 0x%x) not in a BK chain\n", i, 
  		       record[i].addr, record[i].type);
  		if (fix) {
  		    if (header.VolidHash[2][IdHash(vlentry.volumeId[2])] == 0)
--- 1434,1440 ----
  		}
  	    }
  	    if (vlentry.volumeId[2] && !(record[i].type & REFBK)) {
! 		log_error(VLDB_CHECK_ERROR,"%d: Record %u (type 0x%x) not in a BK chain\n", i, 
  		       record[i].addr, record[i].type);
  		if (fix) {
  		    if (header.VolidHash[2][IdHash(vlentry.volumeId[2])] == 0)
***************
*** 1418,1424 ****
        else
  	return 1;
      }
!     return 0;
  }
  
  int
--- 1459,1465 ----
        else
  	return 1;
      }
!     return error_level;
  }
  
  int
***************
*** 1438,1443 ****
--- 1479,1485 ----
  		"Display server list");
      cmd_AddParm(ts, "-entries", CMD_FLAG, CMD_OPTIONAL, "Display entries");
      cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");
+     cmd_AddParm(ts, "-quiet", CMD_FLAG, CMD_OPTIONAL, "quiet");
      cmd_AddParm(ts, "-fix", CMD_FLAG, CMD_OPTIONAL, "attempt to patch the database (potentially dangerous)");
  
      return cmd_Dispatch(argc, argv);
Index: openafs/src/vlserver/vlserver.c
diff -c openafs/src/vlserver/vlserver.c:1.18.2.14 openafs/src/vlserver/vlserver.c:1.18.2.16
*** openafs/src/vlserver/vlserver.c:1.18.2.14	Sat Oct 18 11:10:57 2008
--- openafs/src/vlserver/vlserver.c	Mon Dec 22 14:23:32 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.18.2.14 2008/10/18 15:10:57 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.18.2.16 2008/12/22 19:23:32 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 211,244 ****
  	    strcpy(rxi_tracename, argv[++index]);
  
         } else if (strcmp(argv[index], "-auditlog") == 0) {
- 	   int tempfd, flags;
-            FILE *auditout;
-            char oldName[MAXPATHLEN];
             char *fileName = argv[++index];
  
! #ifndef AFS_NT40_ENV
!            struct stat statbuf;
! 
!            if ((lstat(fileName, &statbuf) == 0) 
!                && (S_ISFIFO(statbuf.st_mode))) {
!                flags = O_WRONLY | O_NONBLOCK;
!            } else 
! #endif
!            {
!                strcpy(oldName, fileName);
!                strcat(oldName, ".old");
!                renamefile(fileName, oldName);
!                flags = O_WRONLY | O_TRUNC | O_CREAT;
!            }
!            tempfd = open(fileName, flags, 0666);
!            if (tempfd > -1) {
!                auditout = fdopen(tempfd, "a");
!                if (auditout) {
!                    osi_audit_file(auditout);
!                } else
!                    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
!            } else
!                printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	} else if (strcmp(argv[index], "-enable_peer_stats") == 0) {
  	    rx_enablePeerRPCStats();
  	} else if (strcmp(argv[index], "-enable_process_stats") == 0) {
--- 211,219 ----
  	    strcpy(rxi_tracename, argv[++index]);
  
         } else if (strcmp(argv[index], "-auditlog") == 0) {
             char *fileName = argv[++index];
  
!            osi_audit_file(fileName);
  	} else if (strcmp(argv[index], "-enable_peer_stats") == 0) {
  	    rx_enablePeerRPCStats();
  	} else if (strcmp(argv[index], "-enable_process_stats") == 0) {
***************
*** 362,368 ****
      ubik_CheckRXSecurityProc = afsconf_CheckAuth;
      ubik_CheckRXSecurityRock = (char *)tdir;
      code =
! 	ubik_ServerInitByInfo(myHost, htons(AFSCONF_VLDBPORT), &info, &clones,
  			      vl_dbaseName, &VL_dbase);
      if (code) {
  	printf("vlserver: Ubik init failed with code %d\n", code);
--- 337,343 ----
      ubik_CheckRXSecurityProc = afsconf_CheckAuth;
      ubik_CheckRXSecurityRock = (char *)tdir;
      code =
! 	ubik_ServerInitByInfo(myHost, htons(AFSCONF_VLDBPORT), &info, clones,
  			      vl_dbaseName, &VL_dbase);
      if (code) {
  	printf("vlserver: Ubik init failed with code %d\n", code);
Index: openafs/src/vol/fssync.c
diff -c openafs/src/vol/fssync.c:1.26.2.10 openafs/src/vol/fssync.c:1.26.2.12
*** openafs/src/vol/fssync.c:1.26.2.10	Tue Apr  1 16:05:47 2008
--- openafs/src/vol/fssync.c	Mon Mar 23 14:19:57 2009
***************
*** 51,65 ****
  #include <afs/afsutil.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/Attic/fssync.c,v 1.26.2.10 2008/04/01 20:05:47 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
- #include <unistd.h>
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
  #include <time.h>
  #else
  #include <sys/param.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
--- 51,65 ----
  #include <afs/afsutil.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/Attic/fssync.c,v 1.26.2.12 2009/03/23 18:19:57 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
  #ifdef AFS_NT40_ENV
  #include <winsock2.h>
  #include <time.h>
  #else
+ #include <unistd.h>
  #include <sys/param.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
***************
*** 527,533 ****
  	if (v)
  	    v->volumeID = 0;
  	tvolName[0] = '/';
! 	sprintf(&tvolName[1], VFORMAT, command.volume);
  
  	vp = VAttachVolumeByName_r(&error, command.partName, tvolName,
  				   V_VOLUPD);
--- 527,533 ----
  	if (v)
  	    v->volumeID = 0;
  	tvolName[0] = '/';
! 	sprintf(&tvolName[1], VFORMAT, afs_cast_uint32(command.volume));
  
  	vp = VAttachVolumeByName_r(&error, command.partName, tvolName,
  				   V_VOLUPD);
***************
*** 667,673 ****
  	    Volume *vp;
  
  	    tvolName[0] = '/';
! 	    sprintf(&tvolName[1], VFORMAT, p[i].volumeID);
  	    vp = VAttachVolumeByName_r(&error, p[i].partName, tvolName,
  				       V_VOLUPD);
  	    if (vp)
--- 667,673 ----
  	    Volume *vp;
  
  	    tvolName[0] = '/';
! 	    sprintf(&tvolName[1], VFORMAT, afs_cast_uint32(p[i].volumeID));
  	    vp = VAttachVolumeByName_r(&error, p[i].partName, tvolName,
  				       V_VOLUPD);
  	    if (vp)
Index: openafs/src/vol/listinodes.c
diff -c openafs/src/vol/listinodes.c:1.13.2.7 openafs/src/vol/listinodes.c:1.13.2.8
*** openafs/src/vol/listinodes.c:1.13.2.7	Sat Aug 16 15:15:48 2008
--- openafs/src/vol/listinodes.c	Mon Mar 23 14:19:57 2009
***************
*** 23,29 ****
  #include <string.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/listinodes.c,v 1.13.2.7 2008/08/16 19:15:48 shadow Exp $");
  
  #ifndef AFS_NAMEI_ENV
  #if defined(AFS_LINUX20_ENV) || defined(AFS_SUN4_ENV)
--- 23,29 ----
  #include <string.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/listinodes.c,v 1.13.2.8 2009/03/23 18:19:57 shadow Exp $");
  
  #ifndef AFS_NAMEI_ENV
  #if defined(AFS_LINUX20_ENV) || defined(AFS_SUN4_ENV)
***************
*** 1664,1670 ****
  
      memset(&specinos, 0, sizeof(specinos));
  	   
!     (void)afs_snprintf(headername, sizeof headername, VFORMAT, volumeId);
      (void)afs_snprintf(oldpath, sizeof oldpath, "%s/%s", pname, headername);
      fd = open(oldpath, O_RDONLY);
      if (fd < 0) {
--- 1664,1670 ----
  
      memset(&specinos, 0, sizeof(specinos));
  	   
!     (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_cast_uint32(volumeId));
      (void)afs_snprintf(oldpath, sizeof oldpath, "%s/%s", pname, headername);
      fd = open(oldpath, O_RDONLY);
      if (fd < 0) {
***************
*** 1767,1773 ****
      }
  #endif
  
!     (void)afs_snprintf(headername, sizeof headername, VFORMAT, h.id);
      (void)afs_snprintf(newpath, sizeof newpath, "%s/%s", pname, headername);
      fd = open(newpath, O_CREAT | O_EXCL | O_RDWR, 0644);
      if (fd < 0) {
--- 1767,1773 ----
      }
  #endif
  
!     (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_cast_uint32(h.id));
      (void)afs_snprintf(newpath, sizeof newpath, "%s/%s", pname, headername);
      fd = open(newpath, O_CREAT | O_EXCL | O_RDWR, 0644);
      if (fd < 0) {
Index: openafs/src/vol/namei_ops.c
diff -c openafs/src/vol/namei_ops.c:1.21.2.18 openafs/src/vol/namei_ops.c:1.21.2.19
*** openafs/src/vol/namei_ops.c:1.21.2.18	Fri Oct 10 10:43:02 2008
--- openafs/src/vol/namei_ops.c	Mon Mar 23 14:19:57 2009
***************
*** 13,19 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/namei_ops.c,v 1.21.2.18 2008/10/10 14:43:02 shadow Exp $");
  
  #ifdef AFS_NAMEI_ENV
  #include <stdio.h>
--- 13,19 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/namei_ops.c,v 1.21.2.19 2009/03/23 18:19:57 shadow Exp $");
  
  #ifdef AFS_NAMEI_ENV
  #include <stdio.h>
***************
*** 1572,1578 ****
      char headername[16];
      afs_int32 error = 0;
  
!     (void)afs_snprintf(headername, sizeof headername, VFORMAT, volumeId);
      (void)afs_snprintf(oldpath, sizeof oldpath, "%s/%s", pname, headername);
      fd = open(oldpath, O_RDONLY);
      if (fd < 0) {
--- 1572,1578 ----
      char headername[16];
      afs_int32 error = 0;
  
!     (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_cast_uint32(volumeId));
      (void)afs_snprintf(oldpath, sizeof oldpath, "%s/%s", pname, headername);
      fd = open(oldpath, O_RDONLY);
      if (fd < 0) {
***************
*** 1722,1728 ****
      h.smallVnodeIndex_hi = h.id;
      h.largeVnodeIndex_hi = h.id;
      h.linkTable_hi = h.id;
!     (void)afs_snprintf(headername, sizeof headername, VFORMAT, h.id);
      (void)afs_snprintf(newpath, sizeof newpath, "%s/%s", pname, headername);
      fd = open(newpath, O_CREAT | O_EXCL | O_RDWR, 0644);
      if (fd < 0) {
--- 1722,1728 ----
      h.smallVnodeIndex_hi = h.id;
      h.largeVnodeIndex_hi = h.id;
      h.linkTable_hi = h.id;
!     (void)afs_snprintf(headername, sizeof headername, VFORMAT, afs_cast_uint32(h.id));
      (void)afs_snprintf(newpath, sizeof newpath, "%s/%s", pname, headername);
      fd = open(newpath, O_CREAT | O_EXCL | O_RDWR, 0644);
      if (fd < 0) {
Index: openafs/src/vol/vnode.c
diff -c openafs/src/vol/vnode.c:1.19.2.6 openafs/src/vol/vnode.c:1.19.2.7
*** openafs/src/vol/vnode.c:1.19.2.6	Fri Dec 28 17:16:51 2007
--- openafs/src/vol/vnode.c	Mon Feb 16 23:37:59 2009
***************
*** 17,23 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vnode.c,v 1.19.2.6 2007/12/28 22:16:51 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
--- 17,23 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vnode.c,v 1.19.2.7 2009/02/17 04:37:59 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
***************
*** 959,964 ****
--- 959,965 ----
  	for (vnp = VnodeHashTable[i]; vnp; vnp = vnp->hashNext) {
  	    if (vnp->volumePtr == vp) {
  		IH_REALLYCLOSE(vnp->handle);
+ 		IH_RELEASE(vnp->handle);
  	    }
  	}
      }
Index: openafs/src/vol/vol-info.c
diff -c openafs/src/vol/vol-info.c:1.18.2.5 openafs/src/vol/vol-info.c:1.18.2.6
*** openafs/src/vol/vol-info.c:1.18.2.5	Sat Aug 16 15:15:49 2008
--- openafs/src/vol/vol-info.c	Mon Mar 23 14:19:57 2009
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vol-info.c,v 1.18.2.5 2008/08/16 19:15:49 shadow Exp $");
  
  #include <ctype.h>
  #include <errno.h>
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vol-info.c,v 1.18.2.6 2009/03/23 18:19:57 shadow Exp $");
  
  #include <ctype.h>
  #include <errno.h>
***************
*** 322,328 ****
  	    }
  	}
  	(void)afs_snprintf(name1, sizeof name1, VFORMAT,
! 			   (unsigned long)volumeId);
  	if (dsizeOnly && !saveinodes)
  	    printf
  		("Volume-Id\t  Volsize  Auxsize Inodesize  AVolsize SizeDiff                (VolName)\n");
--- 322,328 ----
  	    }
  	}
  	(void)afs_snprintf(name1, sizeof name1, VFORMAT,
! 			   afs_cast_uint32(volumeId));
  	if (dsizeOnly && !saveinodes)
  	    printf
  		("Volume-Id\t  Volsize  Auxsize Inodesize  AVolsize SizeDiff                (VolName)\n");
Index: openafs/src/vol/vol-salvage.c
diff -c openafs/src/vol/vol-salvage.c:1.41.2.19 openafs/src/vol/vol-salvage.c:1.41.2.20
*** openafs/src/vol/vol-salvage.c:1.41.2.19	Mon Oct 27 19:54:12 2008
--- openafs/src/vol/vol-salvage.c	Mon Mar 23 14:19:57 2009
***************
*** 92,98 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vol-salvage.c,v 1.41.2.19 2008/10/27 23:54:12 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
--- 92,98 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vol-salvage.c,v 1.41.2.20 2009/03/23 18:19:57 shadow Exp $");
  
  #include <stdlib.h>
  #include <stdio.h>
***************
*** 1787,1793 ****
  		    || (vsp->header.id == singleVolumeNumber
  			|| vsp->header.parent == singleVolumeNumber)) {
  		    (void)afs_snprintf(nameShouldBe, sizeof nameShouldBe,
! 				       VFORMAT, vsp->header.id);
  		    if (singleVolumeNumber
  			&& vsp->header.id != singleVolumeNumber)
  			AskOffline(vsp->header.id);
--- 1787,1793 ----
  		    || (vsp->header.id == singleVolumeNumber
  			|| vsp->header.parent == singleVolumeNumber)) {
  		    (void)afs_snprintf(nameShouldBe, sizeof nameShouldBe,
! 				       VFORMAT, afs_cast_uint32(vsp->header.id));
  		    if (singleVolumeNumber
  			&& vsp->header.id != singleVolumeNumber)
  			AskOffline(vsp->header.id);
***************
*** 2237,2243 ****
  
      if (isp->volSummary == NULL) {
  	char name[64];
! 	(void)afs_snprintf(name, sizeof name, VFORMAT, isp->volumeId);
  	if (check) {
  	    Log("No header file for volume %u\n", isp->volumeId);
  	    return -1;
--- 2237,2243 ----
  
      if (isp->volSummary == NULL) {
  	char name[64];
! 	(void)afs_snprintf(name, sizeof name, VFORMAT, afs_cast_uint32(isp->volumeId));
  	if (check) {
  	    Log("No header file for volume %u\n", isp->volumeId);
  	    return -1;
***************
*** 2264,2270 ****
  	    if (isp->volSummary->fileName) {
  		strcpy(name, isp->volSummary->fileName);
  	    } else {
! 		(void)afs_snprintf(name, sizeof name, VFORMAT, isp->volumeId);
  		isp->volSummary->fileName = ToString(name);
  	    }
  
--- 2264,2270 ----
  	    if (isp->volSummary->fileName) {
  		strcpy(name, isp->volSummary->fileName);
  	    } else {
! 	      (void)afs_snprintf(name, sizeof name, VFORMAT, afs_cast_uint32(isp->volumeId));
  		isp->volSummary->fileName = ToString(name);
  	    }
  
Index: openafs/src/vol/volume.c
diff -c openafs/src/vol/volume.c:1.35.2.15 openafs/src/vol/volume.c:1.35.2.16
*** openafs/src/vol/volume.c:1.35.2.15	Mon Oct 27 20:54:49 2008
--- openafs/src/vol/volume.c	Mon Mar 23 14:19:57 2009
***************
*** 20,26 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/volume.c,v 1.35.2.15 2008/10/28 00:54:49 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
--- 20,26 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/volume.c,v 1.35.2.16 2009/03/23 18:19:57 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
***************
*** 1680,1686 ****
  
      *ec = 0;
      name[0] = '/';
!     (void)afs_snprintf(&name[1], (sizeof name) - 1, VFORMAT, volumeId);
      for (dp = DiskPartitionList; dp; dp = dp->next) {
  	struct afs_stat status;
  	strcpy(path, VPartitionPath(dp));
--- 1680,1686 ----
  
      *ec = 0;
      name[0] = '/';
!     (void)afs_snprintf(&name[1], (sizeof name) - 1, VFORMAT, afs_cast_uint32(volumeId));
      for (dp = DiskPartitionList; dp; dp = dp->next) {
  	struct afs_stat status;
  	strcpy(path, VPartitionPath(dp));
***************
*** 1712,1718 ****
  VolumeExternalName(VolumeId volumeId)
  {
      static char name[VMAXPATHLEN];
!     (void)afs_snprintf(name, sizeof name, VFORMAT, volumeId);
      return name;
  }
  
--- 1712,1718 ----
  VolumeExternalName(VolumeId volumeId)
  {
      static char name[VMAXPATHLEN];
!     (void)afs_snprintf(name, sizeof name, VFORMAT, afs_cast_uint32(volumeId));
      return name;
  }
  
Index: openafs/src/vol/vutil.c
diff -c openafs/src/vol/vutil.c:1.15.2.3 openafs/src/vol/vutil.c:1.15.2.4
*** openafs/src/vol/vutil.c:1.15.2.3	Thu Sep  4 14:17:23 2008
--- openafs/src/vol/vutil.c	Mon Mar 23 14:19:57 2009
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vutil.c,v 1.15.2.3 2008/09/04 18:17:23 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vutil.c,v 1.15.2.4 2009/03/23 18:19:57 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 171,177 ****
      vol.stamp.magic = VOLUMEINFOMAGIC;
      vol.stamp.version = VOLUMEINFOVERSION;
      vol.destroyMe = DESTROY_ME;
!     (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, vol.id);
      (void)afs_snprintf(volumePath, sizeof volumePath, "%s/%s",
  		       VPartitionPath(partition), headerName);
      fd = afs_open(volumePath, O_CREAT | O_EXCL | O_WRONLY, 0600);
--- 171,177 ----
      vol.stamp.magic = VOLUMEINFOMAGIC;
      vol.stamp.version = VOLUMEINFOVERSION;
      vol.destroyMe = DESTROY_ME;
!     (void)afs_snprintf(headerName, sizeof headerName, VFORMAT, afs_cast_uint32(vol.id));
      (void)afs_snprintf(volumePath, sizeof volumePath, "%s/%s",
  		       VPartitionPath(partition), headerName);
      fd = afs_open(volumePath, O_CREAT | O_EXCL | O_WRONLY, 0600);
Index: openafs/src/volser/vol-dump.c
diff -c openafs/src/volser/vol-dump.c:1.1.2.2 openafs/src/volser/vol-dump.c:1.1.2.4
*** openafs/src/volser/vol-dump.c:1.1.2.2	Sat Aug 16 15:15:49 2008
--- openafs/src/volser/vol-dump.c	Mon Mar 23 14:19:57 2009
***************
*** 18,24 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vol-dump.c,v 1.1.2.2 2008/08/16 19:15:49 shadow Exp $");
  
  #include <ctype.h>
  #include <errno.h>
--- 18,24 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vol-dump.c,v 1.1.2.4 2009/03/23 18:19:57 shadow Exp $");
  
  #include <ctype.h>
  #include <errno.h>
***************
*** 90,100 ****
  int verbose = 0;
  
  /* Forward Declarations */
! void HandleVolume(struct DiskPartition64 *partP, char *name, char *filename);
  Volume *AttachVolume(struct DiskPartition64 *dp, char *volname,
  		     register struct VolumeHeader *header);
  static void DoMyVolDump(Volume * vp, struct DiskPartition64 *dp,
! 			char *dumpfile);
  
  #ifndef AFS_NT40_ENV
  #include "AFS_component_version_number.c"
--- 90,100 ----
  int verbose = 0;
  
  /* Forward Declarations */
! void HandleVolume(struct DiskPartition64 *partP, char *name, char *filename, int fromtime);
  Volume *AttachVolume(struct DiskPartition64 *dp, char *volname,
  		     register struct VolumeHeader *header);
  static void DoMyVolDump(Volume * vp, struct DiskPartition64 *dp,
! 			char *dumpfile, int fromtime);
  
  #ifndef AFS_NT40_ENV
  #include "AFS_component_version_number.c"
***************
*** 176,181 ****
--- 176,183 ----
      struct DiskPartition64 *partP = NULL;
      char name1[128];
      char tmpPartName[20];
+     int fromtime = 0;
+     afs_int32 code;
  
  
  #ifndef AFS_NT40_ENV
***************
*** 195,200 ****
--- 197,210 ----
  	fileName = ti->data;
      if ((ti = as->parms[3].items))
  	verbose = 1;
+     if (as->parms[4].items && strcmp(as->parms[4].items->data, "0")) {
+ 	code = ktime_DateToInt32(as->parms[4].items->data, &fromtime);
+ 	if (code) {
+ 	    fprintf(STDERR, "failed to parse date '%s' (error=%d))\n",
+ 		as->parms[4].items->data, code);
+ 		return code;
+ 	}
+     }
  
      DInit(10);
  
***************
*** 231,243 ****
  	exit(1);
      }
  
!     (void)afs_snprintf(name1, sizeof name1, VFORMAT, (unsigned long)volumeId);
!     HandleVolume(partP, name1, fileName);
      return 0;
  }
  
  void
! HandleVolume(struct DiskPartition64 *dp, char *name, char *filename)
  {
      struct VolumeHeader header;
      struct VolumeDiskHeader diskHeader;
--- 241,253 ----
  	exit(1);
      }
  
!     (void)afs_snprintf(name1, sizeof name1, VFORMAT, afs_cast_uint32(volumeId));
!     HandleVolume(partP, name1, fileName, fromtime);
      return 0;
  }
  
  void
! HandleVolume(struct DiskPartition64 *dp, char *name, char *filename, int fromtime)
  {
      struct VolumeHeader header;
      struct VolumeDiskHeader diskHeader;
***************
*** 279,285 ****
  	exit(1);
      }
  
!     DoMyVolDump(vp, dp, filename);
  }
  
  
--- 289,295 ----
  	exit(1);
      }
  
!     DoMyVolDump(vp, dp, filename, fromtime);
  }
  
  
***************
*** 298,303 ****
--- 308,314 ----
      cmd_AddParm(ts, "-file", CMD_LIST, CMD_OPTIONAL, "Dump filename");
      cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL,
  		"Trace dump progress (very verbose)");
+     cmd_AddParm(ts, "-time", CMD_SINGLE, CMD_OPTIONAL, "dump from time");
      code = cmd_Dispatch(argc, argv);
      return code;
  }
***************
*** 831,847 ****
  
  
  static void
! DoMyVolDump(Volume * vp, struct DiskPartition64 *dp, char *dumpfile)
  {
      int code = 0;
-     int fromtime = 0;
      int dumpAllDirs = 0;
      int dumpfd = 0;
  
      if (dumpfile) {
  	unlink(dumpfile);
  	dumpfd =
! 	    open(dumpfile, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR);
  	if (dumpfd < 0) {
  	    fprintf(stderr, "Failed to open dump file! Exiting.\n");
  	    exit(1);
--- 842,857 ----
  
  
  static void
! DoMyVolDump(Volume * vp, struct DiskPartition64 *dp, char *dumpfile, int fromtime)
  {
      int code = 0;
      int dumpAllDirs = 0;
      int dumpfd = 0;
  
      if (dumpfile) {
  	unlink(dumpfile);
  	dumpfd =
! 	    afs_open(dumpfile, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR);
  	if (dumpfd < 0) {
  	    fprintf(stderr, "Failed to open dump file! Exiting.\n");
  	    exit(1);
Index: openafs/src/volser/volmain.c
diff -c openafs/src/volser/volmain.c:1.18.2.15 openafs/src/volser/volmain.c:1.18.2.16
*** openafs/src/volser/volmain.c:1.18.2.15	Sun Aug 24 21:15:18 2008
--- openafs/src/volser/volmain.c	Wed Dec 17 13:16:28 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.18.2.15 2008/08/25 01:15:18 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volmain.c,v 1.18.2.16 2008/12/17 18:16:28 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
***************
*** 311,345 ****
  		lwps = MAXLWP;
  	    }
  	} else if (strcmp(argv[code], "-auditlog") == 0) {
- 	    int tempfd, flags;
- 	    FILE *auditout;
- 	    char oldName[MAXPATHLEN];
  	    char *fileName = argv[++code];
  
! #ifndef AFS_NT40_ENV
! 	    struct stat statbuf;
! 	    
! 	    if ((lstat(fileName, &statbuf) == 0) 
! 		&& (S_ISFIFO(statbuf.st_mode))) {
! 		flags = O_WRONLY | O_NONBLOCK;
! 	    } else 
! #endif
! 	    {
! 		strcpy(oldName, fileName);
! 		strcat(oldName, ".old");
! 		renamefile(fileName, oldName);
! 		flags = O_WRONLY | O_TRUNC | O_CREAT;
! 	    }
! 	    tempfd = open(fileName, flags, 0666);
! 	    if (tempfd > -1) {
! 		auditout = fdopen(tempfd, "a");
! 		if (auditout) {
! 		    osi_audit_file(auditout);
! 		    osi_audit(VS_StartEvent, 0, AUD_END);
! 		} else
! 		    printf("Warning: auditlog %s not writable, ignored.\n", fileName);
! 	    } else
! 		printf("Warning: auditlog %s not writable, ignored.\n", fileName);
  	} else if (strcmp(argv[code], "-nojumbo") == 0) {
  	    rxJumbograms = 0;
  	} else if (strcmp(argv[code], "-jumbo") == 0) {
--- 311,320 ----
  		lwps = MAXLWP;
  	    }
  	} else if (strcmp(argv[code], "-auditlog") == 0) {
  	    char *fileName = argv[++code];
  
!             osi_audit_file(fileName);
!             osi_audit(VS_StartEvent, 0, AUD_END);
  	} else if (strcmp(argv[code], "-nojumbo") == 0) {
  	    rxJumbograms = 0;
  	} else if (strcmp(argv[code], "-jumbo") == 0) {
Index: openafs/src/volser/volprocs.c
diff -c openafs/src/volser/volprocs.c:1.34.2.17 openafs/src/volser/volprocs.c:1.34.2.18
*** openafs/src/volser/volprocs.c:1.34.2.17	Sat Aug 16 16:07:57 2008
--- openafs/src/volser/volprocs.c	Mon Mar 23 14:19:57 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.34.2.17 2008/08/16 20:07:57 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.34.2.18 2009/03/23 18:19:57 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 152,158 ****
      if (asize < 18)
  	return -1;
      /* It's better using the Generic VFORMAT since otherwise we have to make changes to too many places... The 14 char limitation in names hits us again in AIX; print in field of 9 digits (still 10 for the rest), right justified with 0 padding */
!     (void)afs_snprintf(aname, asize, VFORMAT, (unsigned long)avol);
      return 0;
  }
  
--- 152,158 ----
      if (asize < 18)
  	return -1;
      /* It's better using the Generic VFORMAT since otherwise we have to make changes to too many places... The 14 char limitation in names hits us again in AIX; print in field of 9 digits (still 10 for the rest), right justified with 0 padding */
!     (void)afs_snprintf(aname, asize, VFORMAT, afs_cast_uint32(avol));
      return 0;
  }
  
Index: openafs/src/volser/vos.c
diff -c openafs/src/volser/vos.c:1.40.2.27 openafs/src/volser/vos.c:1.40.2.29
*** openafs/src/volser/vos.c:1.40.2.27	Sat Aug 16 15:56:25 2008
--- openafs/src/volser/vos.c	Mon Mar 23 14:19:57 2009
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40.2.27 2008/08/16 19:56:25 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40.2.29 2009/03/23 18:19:57 shadow Exp $");
  
  #include <sys/types.h>
  #include <string.h>
***************
*** 505,511 ****
  		*totalOK += 1;
  	    } else {
  		fprintf(STDOUT, "Off-line");
! 		*totalNotOK++;
  	    }
  	    if (pntr->needsSalvaged == 1)
  		fprintf(STDOUT, "**needs salvage**");
--- 505,511 ----
  		*totalOK += 1;
  	    } else {
  		fprintf(STDOUT, "Off-line");
! 		*totalNotOK += 1;
  	    }
  	    if (pntr->needsSalvaged == 1)
  		fprintf(STDOUT, "**needs salvage**");
***************
*** 546,558 ****
  	    qPut(&busyHead, pntr->volid);
  	    if (disp)
  		fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 			(unsigned long)pntr->volid);
  	} else {
  	    *totalNotOK += 1;
  	    qPut(&notokHead, pntr->volid);
  	    if (disp)
  		fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 			(unsigned long)pntr->volid);
  	}
  	fprintf(STDOUT, "\n");
      } else {			/* default listing */
--- 546,558 ----
  	    qPut(&busyHead, pntr->volid);
  	    if (disp)
  		fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 			afs_cast_uint32(pntr->volid));
  	} else {
  	    *totalNotOK += 1;
  	    qPut(&notokHead, pntr->volid);
  	    if (disp)
  		fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 			afs_cast_uint32(pntr->volid));
  	}
  	fprintf(STDOUT, "\n");
      } else {			/* default listing */
***************
*** 581,593 ****
  	    qPut(&busyHead, pntr->volid);
  	    if (disp)
  		fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 			(unsigned long)pntr->volid);
  	} else {
  	    *totalNotOK += 1;
  	    qPut(&notokHead, pntr->volid);
  	    if (disp)
  		fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 			(unsigned long)pntr->volid);
  	}
      }
  }
--- 581,593 ----
  	    qPut(&busyHead, pntr->volid);
  	    if (disp)
  		fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 			afs_cast_uint32(pntr->volid));
  	} else {
  	    *totalNotOK += 1;
  	    qPut(&notokHead, pntr->volid);
  	    if (disp)
  		fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 			afs_cast_uint32(pntr->volid));
  	}
      }
  }
***************
*** 776,789 ****
  	    qPut(&busyHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 			(unsigned long)a_xInfoP->volid);
  	} /*Busy volume */
  	else {
  	    (*a_totalNotOKP)++;
  	    qPut(&notokHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 			(unsigned long)a_xInfoP->volid);
  	}			/*Screwed volume */
  	fprintf(STDOUT, "\n");
      } /*Long listing */
--- 776,789 ----
  	    qPut(&busyHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 			afs_cast_uint32(a_xInfoP->volid));
  	} /*Busy volume */
  	else {
  	    (*a_totalNotOKP)++;
  	    qPut(&notokHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 			afs_cast_uint32(a_xInfoP->volid));
  	}			/*Screwed volume */
  	fprintf(STDOUT, "\n");
      } /*Long listing */
***************
*** 815,828 ****
  	    qPut(&busyHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 			(unsigned long)a_xInfoP->volid);
  	} /*Busy volume */
  	else {
  	    (*a_totalNotOKP)++;
  	    qPut(&notokHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 			(unsigned long)a_xInfoP->volid);
  	}			/*Screwed volume */
      }				/*Default listing */
  }				/*XDisplayFormat */
--- 815,828 ----
  	    qPut(&busyHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 			afs_cast_uint32(a_xInfoP->volid));
  	} /*Busy volume */
  	else {
  	    (*a_totalNotOKP)++;
  	    qPut(&notokHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 			afs_cast_uint32(a_xInfoP->volid));
  	}			/*Screwed volume */
      }				/*Default listing */
  }				/*XDisplayFormat */
***************
*** 977,990 ****
  	    qPut(&busyHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "BUSY_VOL\t%lu\n",
! 			(unsigned long)a_xInfoP->volid);
  	} /*Busy volume */
  	else {
  	    (*a_totalNotOKP)++;
  	    qPut(&notokHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "COULD_NOT_ATTACH\t%lu\n",
! 			(unsigned long)a_xInfoP->volid);
  	}			/*Screwed volume */
      } /*Long listing */
      else {
--- 977,990 ----
  	    qPut(&busyHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "BUSY_VOL\t%lu\n",
! 			afs_cast_uint32(a_xInfoP->volid));
  	} /*Busy volume */
  	else {
  	    (*a_totalNotOKP)++;
  	    qPut(&notokHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "COULD_NOT_ATTACH\t%lu\n",
! 			afs_cast_uint32(a_xInfoP->volid));
  	}			/*Screwed volume */
      } /*Long listing */
      else {
***************
*** 1014,1027 ****
  	    qPut(&busyHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "VOLUME_BUSY\t%lu\n",
! 			(unsigned long)a_xInfoP->volid);
  	} /*Busy volume */
  	else {
  	    (*a_totalNotOKP)++;
  	    qPut(&notokHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "COULD_NOT_ATTACH_VOLUME\t%lu\n",
! 			(unsigned long)a_xInfoP->volid);
  	}			/*Screwed volume */
      }				/*Default listing */
  }				/*XDisplayFormat */
--- 1014,1027 ----
  	    qPut(&busyHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "VOLUME_BUSY\t%lu\n",
! 			afs_cast_uint32(a_xInfoP->volid));
  	} /*Busy volume */
  	else {
  	    (*a_totalNotOKP)++;
  	    qPut(&notokHead, a_xInfoP->volid);
  	    if (a_showProblems)
  		fprintf(STDOUT, "COULD_NOT_ATTACH_VOLUME\t%lu\n",
! 		        afs_cast_uint32(a_xInfoP->volid));
  	}			/*Screwed volume */
      }				/*Default listing */
  }				/*XDisplayFormat */
***************
*** 1147,1160 ****
  	while (busyHead.count) {
  	    qGet(&busyHead, &volid);
  	    fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 		    (unsigned long)volid);
  	}
      }
      if (totalNotOK) {
  	while (notokHead.count) {
  	    qGet(&notokHead, &volid);
  	    fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 		    (unsigned long)volid);
  	}
      }
      if (!quiet) {
--- 1147,1160 ----
  	while (busyHead.count) {
  	    qGet(&busyHead, &volid);
  	    fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 		    afs_cast_uint32(volid));
  	}
      }
      if (totalNotOK) {
  	while (notokHead.count) {
  	    qGet(&notokHead, &volid);
  	    fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 		    afs_cast_uint32(volid));
  	}
      }
      if (!quiet) {
***************
*** 1235,1248 ****
  	while (busyHead.count) {
  	    qGet(&busyHead, &volid);
  	    fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 		    (unsigned long)volid);
  	}
      }
      if (totalNotOK) {
  	while (notokHead.count) {
  	    qGet(&notokHead, &volid);
  	    fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 		    (unsigned long)volid);
  	}
      }
  
--- 1235,1248 ----
  	while (busyHead.count) {
  	    qGet(&busyHead, &volid);
  	    fprintf(STDOUT, "**** Volume %lu is busy ****\n",
! 		    afs_cast_uint32(volid));
  	}
      }
      if (totalNotOK) {
  	while (notokHead.count) {
  	    qGet(&notokHead, &volid);
  	    fprintf(STDOUT, "**** Could not attach volume %lu ****\n",
! 		    afs_cast_uint32(volid));
  	}
      }
  
***************
*** 1328,1341 ****
  	while (busyHead.count) {
  	    qGet(&busyHead, &volid);
  	    fprintf(STDOUT, "BUSY_VOL\t%lu\n",
! 		    (unsigned long)volid);
  	}
      }
      if (totalNotOK) {
  	while (notokHead.count) {
  	    qGet(&notokHead, &volid);
  	    fprintf(STDOUT, "COULD_NOT_ATTACH\t%lu\n",
! 		    (unsigned long)volid);
  	}
      }
  
--- 1328,1341 ----
  	while (busyHead.count) {
  	    qGet(&busyHead, &volid);
  	    fprintf(STDOUT, "BUSY_VOL\t%lu\n",
! 		    afs_cast_uint32(volid));
  	}
      }
      if (totalNotOK) {
  	while (notokHead.count) {
  	    qGet(&notokHead, &volid);
  	    fprintf(STDOUT, "COULD_NOT_ATTACH\t%lu\n",
! 		    afs_cast_uint32(volid));
  	}
      }
  
***************
*** 1556,1569 ****
  
      if (verbose) {
  	fprintf(STDOUT, "Fetching VLDB entry for %lu .. ",
! 		(unsigned long)volid);
  	fflush(STDOUT);
      }
      vcode = VLDB_GetEntryByID(volid, -1, &entry);
      if (vcode) {
  	fprintf(STDERR,
  		"Could not fetch the entry for volume number %lu from VLDB \n",
! 		(unsigned long)volid);
  	return (vcode);
      }
      if (verbose)
--- 1556,1569 ----
  
      if (verbose) {
  	fprintf(STDOUT, "Fetching VLDB entry for %lu .. ",
! 		afs_cast_uint32(volid));
  	fflush(STDOUT);
      }
      vcode = VLDB_GetEntryByID(volid, -1, &entry);
      if (vcode) {
  	fprintf(STDERR,
  		"Could not fetch the entry for volume number %lu from VLDB \n",
! 		afs_cast_uint32(volid));
  	return (vcode);
      }
      if (verbose)
***************
*** 1705,1711 ****
      if (code) {
  	fprintf(STDERR,
  		"Could not fetch the entry for volume number %lu from VLDB \n",
! 		(unsigned long)volid);
  	return (code);
      }
      MapHostToNetwork(&entry);
--- 1705,1711 ----
      if (code) {
  	fprintf(STDERR,
  		"Could not fetch the entry for volume number %lu from VLDB \n",
! 		afs_cast_uint32(volid));
  	return (code);
      }
      MapHostToNetwork(&entry);
***************
*** 1737,1743 ****
      if (code)
  	fprintf(STDERR,
  		"Could not update volume info fields for volume number %lu\n",
! 		(unsigned long)volid);
      return (code);
  }
  
--- 1737,1743 ----
      if (code)
  	fprintf(STDERR,
  		"Could not update volume info fields for volume number %lu\n",
! 		afs_cast_uint32(volid));
      return (code);
  }
  
***************
*** 1949,1955 ****
      }
      MapPartIdIntoName(pnum, part);
      fprintf(STDOUT, "Volume %lu created on partition %s of %s\n",
! 	    (unsigned long)volid, part, as->parms[0].items->data);
  
      return 0;
  }
--- 1949,1955 ----
      }
      MapPartIdIntoName(pnum, part);
      fprintf(STDOUT, "Volume %lu created on partition %s of %s\n",
! 	    afs_cast_uint32(volid), part, as->parms[0].items->data);
  
      return 0;
  }
***************
*** 2035,2041 ****
  	if (code) {
  	    fprintf(STDERR,
  		    "Could not fetch the entry for volume %lu from VLDB\n",
! 		    (unsigned long)volid);
  	    PrintError("", code);
  	    return (code);
  	}
--- 2035,2041 ----
  	if (code) {
  	    fprintf(STDERR,
  		    "Could not fetch the entry for volume %lu from VLDB\n",
! 		    afs_cast_uint32(volid));
  	    PrintError("", code);
  	    return (code);
  	}
***************
*** 2093,2099 ****
  
      MapPartIdIntoName(partition, pname);
      fprintf(STDOUT, "Volume %lu on partition %s server %s deleted\n",
! 	    (unsigned long)volid, pname, hostutil_GetNameByINet(server));
      return 0;
  }
  
--- 2093,2099 ----
  
      MapPartIdIntoName(partition, pname);
      fprintf(STDOUT, "Volume %lu on partition %s server %s deleted\n",
! 	    afs_cast_uint32(volid), pname, hostutil_GetNameByINet(server));
      return 0;
  }
  
***************
*** 2188,2203 ****
      code = UV_ListOneVolume(fromserver, frompart, volid, &p);
      if (code) {
  	fprintf(STDERR, "vos:cannot access volume %lu\n",
! 		(unsigned long)volid);
  	exit(1);
      }
      if (TESTM)
! 	fprintf(STDOUT, "volume %lu size %d\n", (unsigned long)volid,
  		p->size);
      if (partition.free <= p->size) {
  	fprintf(STDERR,
  		"vos: no space on target partition %s to move volume %lu\n",
! 		toPartName, (unsigned long)volid);
  	free(p);
  	exit(1);
      }
--- 2188,2203 ----
      code = UV_ListOneVolume(fromserver, frompart, volid, &p);
      if (code) {
  	fprintf(STDERR, "vos:cannot access volume %lu\n",
! 		afs_cast_uint32(volid));
  	exit(1);
      }
      if (TESTM)
! 	fprintf(STDOUT, "volume %lu size %d\n", afs_cast_uint32(volid),
  		p->size);
      if (partition.free <= p->size) {
  	fprintf(STDERR,
  		"vos: no space on target partition %s to move volume %lu\n",
! 		toPartName, afs_cast_uint32(volid));
  	free(p);
  	exit(1);
      }
***************
*** 2219,2225 ****
      MapPartIdIntoName(topart, toPartName);
      MapPartIdIntoName(frompart, fromPartName);
      fprintf(STDOUT, "Volume %lu moved from %s %s to %s %s \n",
! 	    (unsigned long)volid, as->parms[1].items->data, fromPartName,
  	    as->parms[3].items->data, toPartName);
  
      return 0;
--- 2219,2225 ----
      MapPartIdIntoName(topart, toPartName);
      MapPartIdIntoName(frompart, fromPartName);
      fprintf(STDOUT, "Volume %lu moved from %s %s to %s %s \n",
! 	    afs_cast_uint32(volid), as->parms[1].items->data, fromPartName,
  	    as->parms[3].items->data, toPartName);
  
      return 0;
***************
*** 2339,2352 ****
      code = UV_ListOneVolume(fromserver, frompart, volid, &p);
      if (code) {
  	fprintf(STDERR, "vos:cannot access volume %lu\n",
! 		(unsigned long)volid);
  	exit(1);
      }
  
      if (partition.free <= p->size) {
  	fprintf(STDERR,
  		"vos: no space on target partition %s to copy volume %lu\n",
! 		toPartName, (unsigned long)volid);
  	free(p);
  	exit(1);
      }
--- 2339,2352 ----
      code = UV_ListOneVolume(fromserver, frompart, volid, &p);
      if (code) {
  	fprintf(STDERR, "vos:cannot access volume %lu\n",
! 		afs_cast_uint32(volid));
  	exit(1);
      }
  
      if (partition.free <= p->size) {
  	fprintf(STDERR,
  		"vos: no space on target partition %s to copy volume %lu\n",
! 		toPartName, afs_cast_uint32(volid));
  	free(p);
  	exit(1);
      }
***************
*** 2364,2370 ****
      MapPartIdIntoName(topart, toPartName);
      MapPartIdIntoName(frompart, fromPartName);
      fprintf(STDOUT, "Volume %lu copied from %s %s to %s on %s %s \n",
! 	    (unsigned long)volid, as->parms[1].items->data, fromPartName,
  	    tovolume, as->parms[4].items->data, toPartName);
  
      return 0;
--- 2364,2370 ----
      MapPartIdIntoName(topart, toPartName);
      MapPartIdIntoName(frompart, fromPartName);
      fprintf(STDOUT, "Volume %lu copied from %s %s to %s on %s %s \n",
! 	    afs_cast_uint32(volid), as->parms[1].items->data, fromPartName,
  	    tovolume, as->parms[4].items->data, toPartName);
  
      return 0;
***************
*** 2464,2470 ****
  	code = UV_ListOneVolume(fromserver, frompart, volid, &p);
  	if (code) {
  	    fprintf(STDERR, "vos:cannot access volume %lu\n",
! 		(unsigned long)volid);
  	    exit(1);
  	}
  	strcpy(toVolName, p->name);
--- 2464,2470 ----
  	code = UV_ListOneVolume(fromserver, frompart, volid, &p);
  	if (code) {
  	    fprintf(STDERR, "vos:cannot access volume %lu\n",
! 		    afs_cast_uint32(volid));
  	    exit(1);
  	}
  	strcpy(toVolName, p->name);
***************
*** 2525,2531 ****
  	code = UV_ListOneVolume(fromserver, frompart, volid, &p);
  	if (code) {
  	    fprintf(STDERR, "vos:cannot access volume %lu\n",
! 		(unsigned long)volid);
  	    exit(1);
  	}
      }
--- 2525,2531 ----
  	code = UV_ListOneVolume(fromserver, frompart, volid, &p);
  	if (code) {
  	    fprintf(STDERR, "vos:cannot access volume %lu\n",
! 		    afs_cast_uint32(volid));
  	    exit(1);
  	}
      }
***************
*** 2540,2546 ****
      if (partition.free <= p->size) {
  	fprintf(STDERR,
  		"vos: no space on target partition %s to copy volume %lu\n",
! 		toPartName, (unsigned long)volid);
  	free(p);
  	if (q) free(q);
  	exit(1);
--- 2540,2546 ----
      if (partition.free <= p->size) {
  	fprintf(STDERR,
  		"vos: no space on target partition %s to copy volume %lu\n",
! 		toPartName, afs_cast_uint32(volid));
  	free(p);
  	if (q) free(q);
  	exit(1);
***************
*** 2560,2566 ****
      MapPartIdIntoName(topart, toPartName);
      MapPartIdIntoName(frompart, fromPartName);
      fprintf(STDOUT, "Volume %lu shadowed from %s %s to %s %s \n",
! 	    (unsigned long)volid, as->parms[1].items->data, fromPartName,
  	    as->parms[3].items->data, toPartName);
  
      return 0;
--- 2560,2566 ----
      MapPartIdIntoName(topart, toPartName);
      MapPartIdIntoName(frompart, fromPartName);
      fprintf(STDOUT, "Volume %lu shadowed from %s %s to %s %s \n",
! 	    afs_cast_uint32(volid), as->parms[1].items->data, fromPartName,
  	    as->parms[3].items->data, toPartName);
  
      return 0;
***************
*** 2730,2736 ****
  	if (!code) {
  	    fprintf(STDERR,
  		    "FATAL ERROR: backup volume %lu exists on server %lu\n",
! 		    (unsigned long)buvolid, (unsigned long)buserver);
  	    exit(1);
  	}
      }
--- 2730,2736 ----
  	if (!code) {
  	    fprintf(STDERR,
  		    "FATAL ERROR: backup volume %lu exists on server %lu\n",
! 		    afs_cast_uint32(buvolid), (unsigned long)buserver);
  	    exit(1);
  	}
      }
***************
*** 3124,3130 ****
  	    if (vol_elsewhere) {
  		fprintf(STDERR,
  			"%s volume %lu already exists on a different server/part; not allowed\n",
! 			readonly ? "RO" : "RW", (unsigned long)avolid);
  		exit(1);
  	    }
  	}
--- 3124,3130 ----
  	    if (vol_elsewhere) {
  		fprintf(STDERR,
  			"%s volume %lu already exists on a different server/part; not allowed\n",
! 			readonly ? "RO" : "RW", afs_cast_uint32(avolid));
  		exit(1);
  	    }
  	}
***************
*** 3896,3902 ****
  	    backupid = entry.volumeId[BACKVOL];
  	fprintf(STDERR,
  		"Warning: Entry for volume number %lu exists in VLDB (but we're zapping it anyway!)\n",
! 		(unsigned long)volid);
      }
      if (zapbackupid) {
  	volintInfo *pntr = (volintInfo *) 0;
--- 3896,3902 ----
  	    backupid = entry.volumeId[BACKVOL];
  	fprintf(STDERR,
  		"Warning: Entry for volume number %lu exists in VLDB (but we're zapping it anyway!)\n",
! 		afs_cast_uint32(volid));
      }
      if (zapbackupid) {
  	volintInfo *pntr = (volintInfo *) 0;
***************
*** 3917,3923 ****
  		exit(1);
  	    }
  	    fprintf(STDOUT, "Backup Volume %lu deleted\n",
! 		    (unsigned long)backupid);
  	}
      }
      code = UV_VolumeZap(server, part, volid);
--- 3917,3923 ----
  		exit(1);
  	    }
  	    fprintf(STDOUT, "Backup Volume %lu deleted\n",
! 		    afs_cast_uint32(backupid));
  	}
      }
      code = UV_VolumeZap(server, part, volid);
***************
*** 3925,3931 ****
  	PrintDiagnostics("zap", code);
  	exit(1);
      }
!     fprintf(STDOUT, "Volume %lu deleted\n", (unsigned long)volid);
  
      return 0;
  }
--- 3925,3931 ----
  	PrintDiagnostics("zap", code);
  	exit(1);
      }
!     fprintf(STDOUT, "Volume %lu deleted\n", afs_cast_uint32(volid));
  
      return 0;
  }
***************
*** 4092,4098 ****
      if (vcode) {
  	fprintf(STDERR,
  		"Could not fetch the entry for volume %lu from VLDB \n",
! 		(unsigned long)volid);
  	PrintError("", vcode);
  	return (vcode);
      }
--- 4092,4098 ----
      if (vcode) {
  	fprintf(STDERR,
  		"Could not fetch the entry for volume %lu from VLDB \n",
! 		afs_cast_uint32(volid));
  	PrintError("", vcode);
  	return (vcode);
      }
***************
*** 4107,4113 ****
  	if (index == -1) {
  	    fprintf(STDERR,
  		    "RO volume is not found in VLDB entry for volume %lu\n",
! 		    (unsigned long)volid);
  	    return -1;
  	}
  
--- 4107,4113 ----
  	if (index == -1) {
  	    fprintf(STDERR,
  		    "RO volume is not found in VLDB entry for volume %lu\n",
! 		    afs_cast_uint32(volid));
  	    return -1;
  	}
  
***************
*** 4120,4126 ****
      if (index == -1) {
  	fprintf(STDERR,
  		"RW Volume is not found in VLDB entry for volume %lu\n",
! 		(unsigned long)volid);
  	return -1;
      }
      if (volid == rentry->volumeId[RWVOL]) {
--- 4120,4126 ----
      if (index == -1) {
  	fprintf(STDERR,
  		"RW Volume is not found in VLDB entry for volume %lu\n",
! 		afs_cast_uint32(volid));
  	return -1;
      }
      if (volid == rentry->volumeId[RWVOL]) {
***************
*** 4137,4143 ****
      }
      fprintf(STDERR,
              "unexpected volume type for volume %lu\n",
!             (unsigned long)volid);
      return -1;
  }
  
--- 4137,4143 ----
      }
      fprintf(STDERR,
              "unexpected volume type for volume %lu\n",
!             afs_cast_uint32(volid));
      return -1;
  }
  
***************
*** 4939,4945 ****
      if (totalE)
  	fprintf(STDOUT,
  		"Could not lock %lu VLDB entries of %lu locked entries\n",
! 		(unsigned long)totalE, (unsigned long)nentries);
      else {
  	if (as->parms[0].items) {
  	    fprintf(STDOUT,
--- 4939,4945 ----
      if (totalE)
  	fprintf(STDOUT,
  		"Could not lock %lu VLDB entries of %lu locked entries\n",
! 		afs_cast_uint32(totalE), (unsigned long)nentries);
      else {
  	if (as->parms[0].items) {
  	    fprintf(STDOUT,
***************
*** 5406,5412 ****
      if (vcode) {
  	fprintf(STDERR,
  		"Could not fetch the entry for volume %lu from VLDB\n",
! 		(unsigned long)volid);
  	PrintError("convertROtoRW", code);
  	return vcode;
      }
--- 5406,5412 ----
      if (vcode) {
  	fprintf(STDERR,
  		"Could not fetch the entry for volume %lu from VLDB\n",
! 		afs_cast_uint32(volid));
  	PrintError("convertROtoRW", code);
  	return vcode;
      }
***************
*** 5473,5479 ****
      if (code) {
  	fprintf(STDERR,
  		"Converting RO volume %lu to RW volume failed with code %d\n",
! 		(unsigned long)volid, code);
  	PrintError("convertROtoRW ", code);
  	return -1;
      }
--- 5473,5479 ----
      if (code) {
  	fprintf(STDERR,
  		"Converting RO volume %lu to RW volume failed with code %d\n",
! 		afs_cast_uint32(volid), code);
  	PrintError("convertROtoRW ", code);
  	return -1;
      }
