Index: openafs/src/LICENSE
diff -c openafs/src/LICENSE:1.1 openafs/src/LICENSE:1.1.20.1
*** openafs/src/LICENSE:1.1	Sat Nov  4 03:38:12 2000
--- openafs/src/LICENSE	Fri Apr 15 15:03:25 2005
***************
*** 231,233 ****
--- 231,692 ----
     party to this Agreement will bring a legal action under this Agreement
     more than one year after the cause of action arose. Each party waives
     its rights to a jury trial in any resulting litigation.
+ 
+ Kerberos 5 ticket support in rxkad is subject to the following copyright:
+ /*
+  * Copyright (c) 1995, 1996, 1997, 2002 Kungliga Tekniska Högskolan
+  * (Royal Institute of Technology, Stockholm, Sweden).
+  * All rights reserved.
+  * 
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 
+  * 3. Neither the name of the Institute nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  * 
+  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ Some code in rxkad/ticket5.c is subject to the following copyright:
+ /*
+  * Copyright 1992, 2002 by the Massachusetts Institute of Technology.
+  * All Rights Reserved.
+  *
+  * Export of this software from the United States of America may
+  *   require a specific license from the United States Government.
+  *   It is the responsibility of any person or organization contemplating
+  *   export to obtain such a license before exporting.
+  * 
+  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+  * distribute this software and its documentation for any purpose and
+  * without fee is hereby granted, provided that the above copyright
+  * notice appear in all copies and that both that copyright notice and
+  * this permission notice appear in supporting documentation, and that
+  * the name of M.I.T. not be used in advertising or publicity pertaining
+  * to distribution of the software without specific, written prior
+  * permission.  Furthermore if you modify this software you must label
+  * your software as modified software and not distribute it in such a
+  * fashion that it might be confused with the original M.I.T. software.
+  * M.I.T. makes no representations about the suitability of
+  * this software for any purpose.  It is provided "as is" without express
+  * or implied warranty.
+  */
+ 
+ afssettings is subject to the following license:
+ APPLE PUBLIC SOURCE LICENSE
+ Version 2.0 - August 6, 2003
+ 
+ Please read this License carefully before downloading this software.
+ By downloading or using this software, you are agreeing to be bound by
+ the terms of this License. If you do not or cannot agree to the terms
+ of this License, please do not download or use the software.
+ 
+ 1. General; Definitions. This License applies to any program or other
+ work which Apple Computer, Inc. ("Apple") makes publicly available and
+ which contains a notice placed by Apple identifying such program or
+ work as "Original Code" and stating that it is subject to the terms of
+ this Apple Public Source License version 2.0 ("License"). As used in
+ this License:
+ 
+ 1.1 "Applicable Patent Rights" mean: (a) in the case where Apple is
+ the grantor of rights, (i) claims of patents that are now or hereafter
+ acquired, owned by or assigned to Apple and (ii) that cover subject
+ matter contained in the Original Code, but only to the extent
+ necessary to use, reproduce and/or distribute the Original Code
+ without infringement; and (b) in the case where You are the grantor of
+ rights, (i) claims of patents that are now or hereafter acquired,
+ owned by or assigned to You and (ii) that cover subject matter in Your
+ Modifications, taken alone or in combination with Original Code.
+ 
+ 1.2 "Contributor" means any person or entity that creates or
+ contributes to the creation of Modifications.
+ 
+ 1.3 "Covered Code" means the Original Code, Modifications, the
+ combination of Original Code and any Modifications, and/or any
+ respective portions thereof.
+ 
+ 1.4 "Externally Deploy" means: (a) to sublicense, distribute or
+ otherwise make Covered Code available, directly or indirectly, to
+ anyone other than You; and/or (b) to use Covered Code, alone or as
+ part of a Larger Work, in any way to provide a service, including but
+ not limited to delivery of content, through electronic communication
+ with a client other than You.
+ 
+ 1.5 "Larger Work" means a work which combines Covered Code or portions
+ thereof with code not governed by the terms of this License.
+ 
+ 1.6 "Modifications" mean any addition to, deletion from, and/or change
+ to, the substance and/or structure of the Original Code, any previous
+ Modifications, the combination of Original Code and any previous
+ Modifications, and/or any respective portions thereof. When code is
+ released as a series of files, a Modification is: (a) any addition to
+ or deletion from the contents of a file containing Covered Code;
+ and/or (b) any new file or other representation of computer program
+ statements that contains any part of Covered Code.
+ 
+ 1.7 "Original Code" means (a) the Source Code of a program or other
+ work as originally made available by Apple under this License,
+ including the Source Code of any updates or upgrades to such programs
+ or works made available by Apple under this License, and that has been
+ expressly identified by Apple as such in the header file(s) of such
+ work; and (b) the object code compiled from such Source Code and
+ originally made available by Apple under this License.
+ 
+ 1.8 "Source Code" means the human readable form of a program or other
+ work that is suitable for making modifications to it, including all
+ modules it contains, plus any associated interface definition files,
+ scripts used to control compilation and installation of an executable
+ (object code).
+ 
+ 1.9 "You" or "Your" means an individual or a legal entity exercising
+ rights under this License. For legal entities, "You" or "Your"
+ includes any entity which controls, is controlled by, or is under
+ common control with, You, where "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of fifty percent
+ (50%) or more of the outstanding shares or beneficial ownership of
+ such entity.
+ 
+ 2. Permitted Uses; Conditions & Restrictions. Subject to the terms
+ and conditions of this License, Apple hereby grants You, effective on
+ the date You accept this License and download the Original Code, a
+ world-wide, royalty-free, non-exclusive license, to the extent of
+ Apple's Applicable Patent Rights and copyrights covering the Original
+ Code, to do the following:
+ 
+ 2.1 Unmodified Code. You may use, reproduce, display, perform,
+ internally distribute within Your organization, and Externally Deploy
+ verbatim, unmodified copies of the Original Code, for commercial or
+ non-commercial purposes, provided that in each instance:
+ 
+ (a) You must retain and reproduce in all copies of Original Code the
+ copyright and other proprietary notices and disclaimers of Apple as
+ they appear in the Original Code, and keep intact all notices in the
+ Original Code that refer to this License; and
+ 
+ (b) You must include a copy of this License with every copy of Source
+ Code of Covered Code and documentation You distribute or Externally
+ Deploy, and You may not offer or impose any terms on such Source Code
+ that alter or restrict this License or the recipients' rights
+ hereunder, except as permitted under Section 6.
+ 
+ 2.2 Modified Code. You may modify Covered Code and use, reproduce,
+ display, perform, internally distribute within Your organization, and
+ Externally Deploy Your Modifications and Covered Code, for commercial
+ or non-commercial purposes, provided that in each instance You also
+ meet all of these conditions:
+ 
+ (a) You must satisfy all the conditions of Section 2.1 with respect to
+ the Source Code of the Covered Code;
+ 
+ (b) You must duplicate, to the extent it does not already exist, the
+ notice in Exhibit A in each file of the Source Code of all Your
+ Modifications, and cause the modified files to carry prominent notices
+ stating that You changed the files and the date of any change; and
+ 
+ (c) If You Externally Deploy Your Modifications, You must make
+ Source Code of all Your Externally Deployed Modifications either
+ available to those to whom You have Externally Deployed Your
+ Modifications, or publicly available. Source Code of Your Externally
+ Deployed Modifications must be released under the terms set forth in
+ this License, including the license grants set forth in Section 3
+ below, for as long as you Externally Deploy the Covered Code or twelve
+ (12) months from the date of initial External Deployment, whichever is
+ longer. You should preferably distribute the Source Code of Your
+ Externally Deployed Modifications electronically (e.g. download from a
+ web site).
+ 
+ 2.3 Distribution of Executable Versions. In addition, if You
+ Externally Deploy Covered Code (Original Code and/or Modifications) in
+ object code, executable form only, You must include a prominent
+ notice, in the code itself as well as in related documentation,
+ stating that Source Code of the Covered Code is available under the
+ terms of this License with information on how and where to obtain such
+ Source Code.
+ 
+ 2.4 Third Party Rights. You expressly acknowledge and agree that
+ although Apple and each Contributor grants the licenses to their
+ respective portions of the Covered Code set forth herein, no
+ assurances are provided by Apple or any Contributor that the Covered
+ Code does not infringe the patent or other intellectual property
+ rights of any other entity. Apple and each Contributor disclaim any
+ liability to You for claims brought by any other entity based on
+ infringement of intellectual property rights or otherwise. As a
+ condition to exercising the rights and licenses granted hereunder, You
+ hereby assume sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party patent
+ license is required to allow You to distribute the Covered Code, it is
+ Your responsibility to acquire that license before distributing the
+ Covered Code.
+ 
+ 3. Your Grants. In consideration of, and as a condition to, the
+ licenses granted to You under this License, You hereby grant to any
+ person or entity receiving or distributing Covered Code under this
+ License a non-exclusive, royalty-free, perpetual, irrevocable license,
+ under Your Applicable Patent Rights and other intellectual property
+ rights (other than patent) owned or controlled by You, to use,
+ reproduce, display, perform, modify, sublicense, distribute and
+ Externally Deploy Your Modifications of the same scope and extent as
+ Apple's licenses under Sections 2.1 and 2.2 above.
+ 
+ 4. Larger Works. You may create a Larger Work by combining Covered
+ Code with other code not governed by the terms of this License and
+ distribute the Larger Work as a single product. In each such instance,
+ You must make sure the requirements of this License are fulfilled for
+ the Covered Code or any portion thereof.
+ 
+ 5. Limitations on Patent License. Except as expressly stated in
+ Section 2, no other patent rights, express or implied, are granted by
+ Apple herein. Modifications and/or Larger Works may require additional
+ patent licenses from Apple which Apple may grant in its sole
+ discretion.
+ 
+ 6. Additional Terms. You may choose to offer, and to charge a fee for,
+ warranty, support, indemnity or liability obligations and/or other
+ rights consistent with the scope of the license granted herein
+ ("Additional Terms") to one or more recipients of Covered Code.
+ However, You may do so only on Your own behalf and as Your sole
+ responsibility, and not on behalf of Apple or any Contributor. You
+ must obtain the recipient's agreement that any such Additional Terms
+ are offered by You alone, and You hereby agree to indemnify, defend
+ and hold Apple and every Contributor harmless for any liability
+ incurred by or claims asserted against Apple or such Contributor by
+ reason of any such Additional Terms.
+ 
+ 7. Versions of the License. Apple may publish revised and/or new
+ versions of this License from time to time. Each version will be given
+ a distinguishing version number. Once Original Code has been published
+ under a particular version of this License, You may continue to use it
+ under the terms of that version. You may also choose to use such
+ Original Code under the terms of any subsequent version of this
+ License published by Apple. No one other than Apple has the right to
+ modify the terms applicable to Covered Code created under this
+ License.
+ 
+ 8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in
+ part pre-release, untested, or not fully tested works. The Covered
+ Code may contain errors that could cause failures or loss of data, and
+ may be incomplete or contain inaccuracies. You expressly acknowledge
+ and agree that use of the Covered Code, or any portion thereof, is at
+ Your sole and entire risk. THE COVERED CODE IS PROVIDED "AS IS" AND
+ WITHOUT WARRANTY, UPGRADES OR SUPPORT OF ANY KIND AND APPLE AND
+ APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE" FOR THE
+ PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM
+ ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF
+ MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR
+ PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NONINFRINGEMENT OF THIRD
+ PARTY RIGHTS. APPLE AND EACH CONTRIBUTOR DOES NOT WARRANT AGAINST
+ INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE
+ FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS,
+ THAT THE OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR
+ ERROR-FREE, OR THAT DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO
+ ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY APPLE, AN APPLE
+ AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR SHALL CREATE A WARRANTY.
+ You acknowledge that the Covered Code is not intended for use in the
+ operation of nuclear facilities, aircraft navigation, communication
+ systems, or air traffic control machines in which case the failure of
+ the Covered Code could lead to death, personal injury, or severe
+ physical or environmental damage.
+ 
+ 9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO
+ EVENT SHALL APPLE OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL,
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING
+ TO THIS LICENSE OR YOUR USE OR INABILITY TO USE THE COVERED CODE, OR
+ ANY PORTION THEREOF, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY,
+ TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF
+ APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY
+ REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF
+ INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY
+ TO YOU. In no event shall Apple's total liability to You for all
+ damages (other than as may be required by applicable law) under this
+ License exceed the amount of fifty dollars ($50.00).
+ 
+ 10. Trademarks. This License does not grant any rights to use the
+ trademarks or trade names "Apple", "Apple Computer", "Mac", "Mac OS",
+ "QuickTime", "QuickTime Streaming Server" or any other trademarks,
+ service marks, logos or trade names belonging to Apple (collectively
+ "Apple Marks") or to any trademark, service mark, logo or trade name
+ belonging to any Contributor. You agree not to use any Apple Marks in
+ or as part of the name of products derived from the Original Code or
+ to endorse or promote products derived from the Original Code other
+ than as expressly permitted by and in strict compliance at all times
+ with Apple's third party trademark usage guidelines which are posted
+ at http://www.apple.com/legal/guidelinesfor3rdparties.html.
+ 
+ 11. Ownership. Subject to the licenses granted under this License,
+ each Contributor retains all rights, title and interest in and to any
+ Modifications made by such Contributor. Apple retains all rights,
+ title and interest in and to the Original Code and any Modifications
+ made by or on behalf of Apple ("Apple Modifications"), and such Apple
+ Modifications will not be automatically subject to this License. Apple
+ may, at its sole discretion, choose to license such Apple
+ Modifications under this License, or on different terms from those
+ contained in this License or may choose not to license them at all.
+ 
+ 12. Termination.
+ 
+ 12.1 Termination. This License and the rights granted hereunder will
+ terminate:
+ 
+ (a) automatically without notice from Apple if You fail to comply with
+ any term(s) of this License and fail to cure such breach within 30
+ days of becoming aware of such breach;
+ 
+ (b) immediately in the event of the circumstances described in Section
+ 13.5(b); or
+ 
+ (c) automatically without notice from Apple if You, at any time during
+ the term of this License, commence an action for patent infringement
+ against Apple; provided that Apple did not first commence
+ an action for patent infringement against You in that instance.
+ 
+ 12.2 Effect of Termination. Upon termination, You agree to immediately
+ stop any further use, reproduction, modification, sublicensing and
+ distribution of the Covered Code. All sublicenses to the Covered Code
+ which have been properly granted prior to termination shall survive
+ any termination of this License. Provisions which, by their nature,
+ should remain in effect beyond the termination of this License shall
+ survive, including but not limited to Sections 3, 5, 8, 9, 10, 11,
+ 12.2 and 13. No party will be liable to any other for compensation,
+ indemnity or damages of any sort solely as a result of terminating
+ this License in accordance with its terms, and termination of this
+ License will be without prejudice to any other right or remedy of
+ any party.
+ 
+ 13. Miscellaneous.
+ 
+ 13.1 Government End Users. The Covered Code is a "commercial item" as
+ defined in FAR 2.101. Government software and technical data rights in
+ the Covered Code include only those rights customarily provided to the
+ public as defined in this License. This customary commercial license
+ in technical data and software is provided in accordance with FAR
+ 12.211 (Technical Data) and 12.212 (Computer Software) and, for
+ Department of Defense purchases, DFAR 252.227-7015 (Technical Data --
+ Commercial Items) and 227.7202-3 (Rights in Commercial Computer
+ Software or Computer Software Documentation). Accordingly, all U.S.
+ Government End Users acquire Covered Code with only those rights set
+ forth herein.
+ 
+ 13.2 Relationship of Parties. This License will not be construed as
+ creating an agency, partnership, joint venture or any other form of
+ legal association between or among You, Apple or any Contributor, and
+ You will not represent to the contrary, whether expressly, by
+ implication, appearance or otherwise.
+ 
+ 13.3 Independent Development. Nothing in this License will impair
+ Apple's right to acquire, license, develop, have others develop for
+ it, market and/or distribute technology or products that perform the
+ same or similar functions as, or otherwise compete with,
+ Modifications, Larger Works, technology or products that You may
+ develop, produce, market or distribute.
+ 
+ 13.4 Waiver; Construction. Failure by Apple or any Contributor to
+ enforce any provision of this License will not be deemed a waiver of
+ future enforcement of that or any other provision. Any law or
+ regulation which provides that the language of a contract shall be
+ construed against the drafter will not apply to this License.
+ 
+ 13.5 Severability. (a) If for any reason a court of competent
+ jurisdiction finds any provision of this License, or portion thereof,
+ to be unenforceable, that provision of the License will be enforced to
+ the maximum extent permissible so as to effect the economic benefits
+ and intent of the parties, and the remainder of this License will
+ continue in full force and effect. (b) Notwithstanding the foregoing,
+ if applicable law prohibits or restricts You from fully and/or
+ specifically complying with Sections 2 and/or 3 or prevents the
+ enforceability of either of those Sections, this License will
+ immediately terminate and You must immediately discontinue any use of
+ the Covered Code and destroy all copies of it that are in your
+ possession or control.
+ 
+ 13.6 Dispute Resolution. Any litigation or other dispute resolution
+ between You and Apple relating to this License shall take place in the
+ Northern District of California, and You and Apple hereby consent to
+ the personal jurisdiction of, and venue in, the state and federal
+ courts within that District with respect to this License. The
+ application of the United Nations Convention on Contracts for the
+ International Sale of Goods is expressly excluded.
+ 
+ 13.7 Entire Agreement; Governing Law. This License constitutes the
+ entire agreement between the parties with respect to the subject
+ matter hereof. This License shall be governed by the laws of the
+ United States and the State of California, except that body of
+ California law concerning conflicts of law.
+ 
+ Where You are located in the province of Quebec, Canada, the following
+ clause applies: The parties hereby confirm that they have requested
+ that this License and all related documents be drafted in English. Les
+ parties ont exige que le present contrat et tous les documents
+ connexes soient rediges en anglais.
+ 
+ EXHIBIT A.
+ 
+ "Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
+ Reserved.
+ 
+ This file contains Original Code and/or Modifications of Original Code
+ as defined in and that are subject to the Apple Public Source License
+ Version 2.0 (the 'License'). You may not use this file except in
+ compliance with the License. Please obtain a copy of the License at
+ http://www.opensource.apple.com/apsl/ and read it before using this
+ file.
+ 
+ The Original Code and all software distributed under the License are
+ distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ Please see the License for the specific language governing rights and
+ limitations under the License."
+ 
+ Some portions of Rx are subject to the following license:
+ /*
+  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+  * unrestricted use provided that this legend is included on all tape
+  * media and as a part of the software program in whole or part.  Users
+  * may copy or modify Sun RPC without charge, but are not authorized
+  * to license or distribute it to anyone else except as part of a product or
+  * program developed by the user or with the express written consent of
+  * Sun Microsystems, Inc.
+  *
+  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+  *
+  * Sun RPC is provided with no support and without any obligation on the
+  * part of Sun Microsystems, Inc. to assist in its use, correction,
+  * modification or enhancement.
+  *
+  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+  * OR ANY PART THEREOF.
+  *
+  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+  * or profits or other special, indirect and consequential damages, even if
+  * Sun has been advised of the possibility of such damages.
+  *
+  * Sun Microsystems, Inc.
+  * 2550 Garcia Avenue
+  * Mountain View, California  94043
+  */
Index: openafs/src/WINNT/afsapplib/.cvsignore
diff -c /dev/null openafs/src/WINNT/afsapplib/.cvsignore:1.1.2.2
*** /dev/null	Thu Apr 28 22:55:43 2005
--- openafs/src/WINNT/afsapplib/.cvsignore	Thu Apr 28 08:00:53 2005
***************
*** 0 ****
--- 1,2 ----
+ AFS_component_version_number.h
+ lang/AFS_component_version_number.h
Index: openafs/src/WINNT/afsd/NTMakefile
diff -c openafs/src/WINNT/afsd/NTMakefile:1.27.2.7 openafs/src/WINNT/afsd/NTMakefile:1.27.2.8
*** openafs/src/WINNT/afsd/NTMakefile:1.27.2.7	Fri Mar 11 01:58:37 2005
--- openafs/src/WINNT/afsd/NTMakefile	Thu Apr 28 08:05:19 2005
***************
*** 213,227 ****
  LOGON_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\afslogon.dll
  
  LOGON_DLLOBJS =\
! 	$(OUT)\afslogon.obj \
      $(OUT)\logon_ad.obj \
! 	$(OUT)\afslogon.res
  
  LOGON_DLLLIBS =\
! 	$(DESTDIR)\lib\afsauthent.lib \
! 	$(DESTDIR)\lib\libafsconf.lib \
      $(DESTDIR)\lib\afsrxkad.lib \
      $(DESTDIR)\lib\afsdes.lib \
      $(AFSKFWLIB)
  
  LOGON_DLLSDKLIBS =\
--- 213,228 ----
  LOGON_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\afslogon.dll
  
  LOGON_DLLOBJS =\
!     $(OUT)\afslogon.obj \
      $(OUT)\logon_ad.obj \
!     $(OUT)\afslogon.res
  
  LOGON_DLLLIBS =\
!     $(DESTDIR)\lib\afsauthent.lib \
!     $(DESTDIR)\lib\libafsconf.lib \
      $(DESTDIR)\lib\afsrxkad.lib \
      $(DESTDIR)\lib\afsdes.lib \
+     $(LANAHELPERLIB) \
      $(AFSKFWLIB)
  
  LOGON_DLLSDKLIBS =\
Index: openafs/src/WINNT/afsd/afsd.c
diff -c openafs/src/WINNT/afsd/afsd.c:1.8.2.1 openafs/src/WINNT/afsd/afsd.c:1.8.2.2
*** openafs/src/WINNT/afsd/afsd.c:1.8.2.1	Fri Nov  5 14:21:42 2004
--- openafs/src/WINNT/afsd/afsd.c	Tue Apr 19 02:27:57 2005
***************
*** 36,41 ****
--- 36,43 ----
  extern void afsd_DbgBreakAllocInit();
  extern void afsd_DbgBreakAdd(DWORD requestNumber);
  
+ HANDLE WaitToTerminate = NULL;
+ 
  /*
   * Notifier function for use by osi_panic
   */
Index: openafs/src/WINNT/afsd/afsd.h
diff -c openafs/src/WINNT/afsd/afsd.h:1.5.2.3 openafs/src/WINNT/afsd/afsd.h:1.5.2.5
*** openafs/src/WINNT/afsd/afsd.h:1.5.2.3	Mon Apr  4 22:17:15 2005
--- openafs/src/WINNT/afsd/afsd.h	Tue Apr 19 17:07:14 2005
***************
*** 123,128 ****
--- 123,130 ----
  
  extern long rx_mtu;
  
+ extern HANDLE WaitToTerminate;
+ 
  #define CAPABILITY_ERRORTRANS (1<<0)
  #define CAPABILITY_BITS 1
  
***************
*** 130,133 ****
--- 132,150 ----
  #define LOG_PACKET 1
  #undef  NOTSERVICE
  
+ #define AFSD_HOOK_DLL  "afsdhook.dll"
+ #define AFSD_INIT_HOOK "AfsdInitHook"
+ typedef BOOL ( APIENTRY * AfsdInitHook )(void);
+ #define AFSD_RX_STARTED_HOOK "AfsdRxStartedHook"
+ typedef BOOL ( APIENTRY * AfsdRxStartedHook )(void);
+ #define AFSD_SMB_STARTED_HOOK "AfsdSmbStartedHook"
+ typedef BOOL ( APIENTRY * AfsdSmbStartedHook )(void);
+ #define AFSD_STARTED_HOOK "AfsdStartedHook"
+ typedef BOOL ( APIENTRY * AfsdStartedHook )(void);
+ #define AFSD_DAEMON_HOOK "AfsdDaemonHook"
+ typedef BOOL ( APIENTRY * AfsdDaemonHook )(void);
+ #define AFSD_STOPPING_HOOK "AfsdStoppingHook"
+ typedef BOOL ( APIENTRY * AfsdStoppingHook )(void);
+ #define AFSD_STOPPED_HOOK "AfsdStoppedHook"
+ typedef BOOL ( APIENTRY * AfsdStoppedHook )(void);
  #endif /* AFSD_H_ENV */
Index: openafs/src/WINNT/afsd/afsd_service.c
diff -c openafs/src/WINNT/afsd/afsd_service.c:1.28.2.13 openafs/src/WINNT/afsd/afsd_service.c:1.28.2.15
*** openafs/src/WINNT/afsd/afsd_service.c:1.28.2.13	Fri Mar 11 01:58:38 2005
--- openafs/src/WINNT/afsd/afsd_service.c	Tue Apr 19 17:07:14 2005
***************
*** 987,996 ****
      return success;
  }
  
- typedef BOOL ( APIENTRY * AfsdInitHook )(void);
- #define AFSD_INIT_HOOK "AfsdInitHook"
- #define AFSD_HOOK_DLL  "afsdhook.dll"
- 
  /*
  control serviceex exists only on 2000/xp. These functions will be loaded dynamically.
  */
--- 987,992 ----
***************
*** 1009,1017 ****
  #ifdef JUMP
      int jmpret;
  #endif /* JUMP */
!     HANDLE hInitHookDll;
!     HANDLE hAdvApi32;
!     AfsdInitHook initHook;
  
  #ifdef _DEBUG
      _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF /*| _CRTDBG_CHECK_ALWAYS_DF*/ | 
--- 1005,1012 ----
  #ifdef JUMP
      int jmpret;
  #endif /* JUMP */
!     HMODULE hHookDll;
!     HMODULE hAdvApi32;
  
  #ifdef _DEBUG
      _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF /*| _CRTDBG_CHECK_ALWAYS_DF*/ | 
***************
*** 1109,1125 ****
      }
  
      /* allow an exit to be called prior to any initialization */
!     hInitHookDll = LoadLibrary(AFSD_HOOK_DLL);
!     if (hInitHookDll)
      {
!         BOOL hookRc = FALSE;
!         initHook = ( AfsdInitHook ) GetProcAddress(hInitHookDll, AFSD_INIT_HOOK);
          if (initHook)
          {
              hookRc = initHook();
          }
!         FreeLibrary(hInitHookDll);
!         hInitHookDll = NULL;
  
          if (hookRc == FALSE)
          {
--- 1104,1120 ----
      }
  
      /* allow an exit to be called prior to any initialization */
!     hHookDll = LoadLibrary(AFSD_HOOK_DLL);
!     if (hHookDll)
      {
!         BOOL hookRc = TRUE;
!         AfsdInitHook initHook = ( AfsdInitHook ) GetProcAddress(hHookDll, AFSD_INIT_HOOK);
          if (initHook)
          {
              hookRc = initHook();
          }
!         FreeLibrary(hHookDll);
!         hHookDll = NULL;
  
          if (hookRc == FALSE)
          {
***************
*** 1172,1177 ****
--- 1167,1199 ----
  			osi_panic(reason, __FILE__, __LINE__);
          }
  
+         /* allow an exit to be called post rx initialization */
+         hHookDll = LoadLibrary(AFSD_HOOK_DLL);
+         if (hHookDll)
+         {
+             BOOL hookRc = TRUE;
+             AfsdRxStartedHook rxStartedHook = ( AfsdRxStartedHook ) GetProcAddress(hHookDll, AFSD_RX_STARTED_HOOK);
+             if (rxStartedHook)
+             {
+                 hookRc = rxStartedHook();
+             }
+             FreeLibrary(hHookDll);
+             hHookDll = NULL;
+ 
+             if (hookRc == FALSE)
+             {
+                 ServiceStatus.dwCurrentState = SERVICE_STOPPED;
+                 ServiceStatus.dwWin32ExitCode = NO_ERROR;
+                 ServiceStatus.dwCheckPoint = 0;
+                 ServiceStatus.dwWaitHint = 0;
+                 ServiceStatus.dwControlsAccepted = 0;
+                 SetServiceStatus(StatusHandle, &ServiceStatus);
+                        
+                 /* exit if initialization failed */
+                 return;
+             }
+         }
+ 
  #ifndef NOTSERVICE
          ServiceStatus.dwCheckPoint++;
          ServiceStatus.dwWaitHint -= 5000;
***************
*** 1183,1188 ****
--- 1205,1237 ----
              osi_panic(reason, __FILE__, __LINE__);
          }
  
+         /* allow an exit to be called post smb initialization */
+         hHookDll = LoadLibrary(AFSD_HOOK_DLL);
+         if (hHookDll)
+         {
+             BOOL hookRc = TRUE;
+             AfsdSmbStartedHook smbStartedHook = ( AfsdSmbStartedHook ) GetProcAddress(hHookDll, AFSD_SMB_STARTED_HOOK);
+             if (smbStartedHook)
+             {
+                 hookRc = smbStartedHook();
+             }
+             FreeLibrary(hHookDll);
+             hHookDll = NULL;
+ 
+             if (hookRc == FALSE)
+             {
+                 ServiceStatus.dwCurrentState = SERVICE_STOPPED;
+                 ServiceStatus.dwWin32ExitCode = NO_ERROR;
+                 ServiceStatus.dwCheckPoint = 0;
+                 ServiceStatus.dwWaitHint = 0;
+                 ServiceStatus.dwControlsAccepted = 0;
+                 SetServiceStatus(StatusHandle, &ServiceStatus);
+                        
+                 /* exit if initialization failed */
+                 return;
+             }
+         }
+ 
          MountGlobalDrives();
  
  #ifndef NOTSERVICE
***************
*** 1204,1209 ****
--- 1253,1285 ----
          }
      }
  
+     /* allow an exit to be called when started */
+     hHookDll = LoadLibrary(AFSD_HOOK_DLL);
+     if (hHookDll)
+     {
+         BOOL hookRc = TRUE;
+         AfsdStartedHook startedHook = ( AfsdStartedHook ) GetProcAddress(hHookDll, AFSD_STARTED_HOOK);
+         if (startedHook)
+         {
+             hookRc = startedHook();
+         }
+         FreeLibrary(hHookDll);
+         hHookDll = NULL;
+ 
+         if (hookRc == FALSE)
+         {
+             ServiceStatus.dwCurrentState = SERVICE_STOPPED;
+             ServiceStatus.dwWin32ExitCode = NO_ERROR;
+             ServiceStatus.dwCheckPoint = 0;
+             ServiceStatus.dwWaitHint = 0;
+             ServiceStatus.dwControlsAccepted = 0;
+             SetServiceStatus(StatusHandle, &ServiceStatus);
+                        
+             /* exit if initialization failed */
+             return;
+         }
+     }
+ 
      WaitForSingleObject(WaitToTerminate, INFINITE);
  
      afsi_log("Received Termination Signal, Stopping Service");
***************
*** 1217,1222 ****
--- 1293,1326 ----
          DeregisterEventSource(h);
      }
  
+     /* allow an exit to be called prior to stopping the service */
+     hHookDll = LoadLibrary(AFSD_HOOK_DLL);
+     if (hHookDll)
+     {
+         BOOL hookRc = TRUE;
+         AfsdStoppingHook stoppingHook = ( AfsdStoppingHook ) GetProcAddress(hHookDll, AFSD_STOPPING_HOOK);
+         if (stoppingHook)
+         {
+             hookRc = stoppingHook();
+         }
+         FreeLibrary(hHookDll);
+         hHookDll = NULL;
+ 
+         if (hookRc == FALSE)
+         {
+             ServiceStatus.dwCurrentState = SERVICE_STOPPED;
+             ServiceStatus.dwWin32ExitCode = NO_ERROR;
+             ServiceStatus.dwCheckPoint = 0;
+             ServiceStatus.dwWaitHint = 0;
+             ServiceStatus.dwControlsAccepted = 0;
+             SetServiceStatus(StatusHandle, &ServiceStatus);
+                        
+             /* exit if initialization failed */
+             return;
+         }
+     }
+ 
+ 
  #ifdef AFS_FREELANCE_CLIENT
      cm_FreelanceShutdown();
      afsi_log("Freelance Shutdown complete");
***************
*** 1247,1252 ****
--- 1351,1370 ----
          PowerNotificationThreadExit();
  #endif
  
+     /* allow an exit to be called after stopping the service */
+     hHookDll = LoadLibrary(AFSD_HOOK_DLL);
+     if (hHookDll)
+     {
+         BOOL hookRc = TRUE;
+         AfsdStoppedHook stoppedHook = ( AfsdStoppedHook ) GetProcAddress(hHookDll, AFSD_STOPPED_HOOK);
+         if (stoppedHook)
+         {
+             hookRc = stoppedHook();
+         }
+         FreeLibrary(hHookDll);
+         hHookDll = NULL;
+     }
+ 
      /* Remove the ExceptionFilter */
      SetUnhandledExceptionFilter(NULL);
  
Index: openafs/src/WINNT/afsd/afskfw.c
diff -c openafs/src/WINNT/afsd/afskfw.c:1.8.2.10 openafs/src/WINNT/afsd/afskfw.c:1.8.2.11
*** openafs/src/WINNT/afsd/afskfw.c:1.8.2.10	Fri Mar 11 01:58:38 2005
--- openafs/src/WINNT/afsd/afskfw.c	Tue Apr 19 01:11:17 2005
***************
*** 3409,3411 ****
--- 3409,3457 ----
      return serverReachable;
  }
  
+ BOOL
+ KFW_AFS_get_lsa_principal(char * szUser, DWORD *dwSize)
+ {
+     krb5_context   ctx = 0;
+     krb5_error_code code;
+     krb5_ccache mslsa_ccache=0;
+     krb5_principal princ = 0;
+     char * pname = 0;
+     BOOL success = 0;
+ 
+     if (!KFW_is_available())
+         return FALSE;
+ 
+     if (code = pkrb5_init_context(&ctx))
+         goto cleanup;
+ 
+     if (code = pkrb5_cc_resolve(ctx, "MSLSA:", &mslsa_ccache))
+         goto cleanup;
+ 
+     if (code = pkrb5_cc_get_principal(ctx, mslsa_ccache, &princ))
+         goto cleanup;
+ 
+     if (code = pkrb5_unparse_name(ctx, princ, &pname))
+         goto cleanup;
+ 
+     if ( strlen(pname) < *dwSize ) {
+         strncpy(szUser, pname, *dwSize);
+         szUser[*dwSize-1] = '\0';
+         success = 1;
+     }
+     *dwSize = strlen(pname);
+ 
+   cleanup:
+     if (pname)
+         pkrb5_free_unparsed_name(ctx, pname);
+ 
+     if (princ)
+         pkrb5_free_principal(ctx, princ);
+ 
+     if (mslsa_ccache)
+         pkrb5_cc_close(ctx, mslsa_ccache);
+ 
+     if (ctx)
+         pkrb5_free_context(ctx);
+     return success;
+ }
\ No newline at end of file
Index: openafs/src/WINNT/afsd/afskfw.h
diff -c openafs/src/WINNT/afsd/afskfw.h:1.2 openafs/src/WINNT/afsd/afskfw.h:1.2.2.1
*** openafs/src/WINNT/afsd/afskfw.h:1.2	Thu May  6 16:46:31 2004
--- openafs/src/WINNT/afsd/afskfw.h	Tue Apr 19 01:11:17 2005
***************
*** 60,65 ****
--- 60,66 ----
  BOOL KFW_probe_kdc(struct afsconf_cell *);
  int  KFW_AFS_get_cellconfig(char *, struct afsconf_cell *, char *);
  void KFW_import_windows_lsa(void);
+ BOOL KFW_AFS_get_lsa_principal(char *, DWORD *);
  
  /* From afs/krb_prot.h */
  /* values for kerb error codes */
Index: openafs/src/WINNT/afsd/afslogon.c
diff -c openafs/src/WINNT/afsd/afslogon.c:1.24.2.8 openafs/src/WINNT/afsd/afslogon.c:1.24.2.9
*** openafs/src/WINNT/afsd/afslogon.c:1.24.2.8	Wed Mar 23 17:31:45 2005
--- openafs/src/WINNT/afsd/afslogon.c	Tue Apr 19 01:11:17 2005
***************
*** 16,21 ****
--- 16,22 ----
  
  #include <winsock2.h>
  #include <lm.h>
+ #include <nb30.h>
  
  #include <afs/param.h>
  #include <afs/stds.h>
***************
*** 26,31 ****
--- 27,33 ----
  #include "cm_config.h"
  #include "krb.h"
  #include "afskfw.h"
+ #include "lanahelper.h"
  
  #include <WINNT\afsreg.h>
  
***************
*** 561,568 ****
      }
  
      if (hkTemp) {
-         HRESULT hr;
-         size_t len;
          CHAR * thesecells;
  
          /* dwSize still has the size of the required buffer in bytes. */
--- 563,568 ----
***************
*** 988,999 ****
      DWORD  len = 1024;
      PTOKEN_USER  tokenUser = NULL;
      DWORD  retLen;
-     HANDLE hToken;
  
      /* Make sure the AFS Libraries are initialized */
      AfsLogonInit();
  
!     DebugEvent0("AFS_Logoff_Event - Starting");
  
      if (!GetTokenInformation(pInfo->hToken, TokenUser, NULL, 0, &retLen))
      {
--- 988,998 ----
      DWORD  len = 1024;
      PTOKEN_USER  tokenUser = NULL;
      DWORD  retLen;
  
      /* Make sure the AFS Libraries are initialized */
      AfsLogonInit();
  
!     DebugEvent0("AFS_Logoff_Event - Start");
  
      if (!GetTokenInformation(pInfo->hToken, TokenUser, NULL, 0, &retLen))
      {
***************
*** 1002,1008 ****
  
              if (!GetTokenInformation(pInfo->hToken, TokenUser, tokenUser, retLen, &retLen))
              {
!                 DebugEvent("GetTokenInformation failed: GLE = %lX", GetLastError());
              }
          }
      }
--- 1001,1007 ----
  
              if (!GetTokenInformation(pInfo->hToken, TokenUser, tokenUser, retLen, &retLen))
              {
!                 DebugEvent("AFS_Logoff_Event - GetTokenInformation failed: GLE = %lX", GetLastError());
              }
          }
      }
***************
*** 1020,1026 ****
      }
      
      if (strlen(profileDir)) {
!         DebugEvent("Profile Directory: %s", profileDir);
          if (!IsPathInAfs(profileDir)) {
              if (code = ktc_ForgetAllTokens())
                  DebugEvent("AFS_Logoff_Event - ForgetAllTokens failed [%lX]",code);
--- 1019,1025 ----
      }
      
      if (strlen(profileDir)) {
!         DebugEvent("AFS_Logoff_Event - Profile Directory: %s", profileDir);
          if (!IsPathInAfs(profileDir)) {
              if (code = ktc_ForgetAllTokens())
                  DebugEvent("AFS_Logoff_Event - ForgetAllTokens failed [%lX]",code);
***************
*** 1035,1039 ****
--- 1034,1125 ----
  
      if ( tokenUser )
          LocalFree(tokenUser);
+ 
+     DebugEvent0("AFS_Logoff_Event - End");
  }   
  
+ VOID AFS_Logon_Event( PWLX_NOTIFICATION_INFO pInfo )
+ {
+     DWORD code;
+     TCHAR profileDir[1024] = TEXT("");
+     DWORD  len = 1024;
+     PTOKEN_USER  tokenUser = NULL;
+     DWORD  retLen;
+     HANDLE hToken;
+ 
+     WCHAR szUserW[128] = L"";
+     char  szUserA[128] = "";
+     char  szClient[MAX_PATH];
+     char szPath[MAX_PATH] = "";
+     NETRESOURCE nr;
+     DWORD res;
+     DWORD gle;
+     DWORD dwSize;
+ 
+     /* Make sure the AFS Libraries are initialized */
+     AfsLogonInit();
+ 
+     DebugEvent0("AFS_Logon_Event - Start");
+ 
+     if (!GetTokenInformation(pInfo->hToken, TokenUser, NULL, 0, &retLen))
+     {
+         if ( GetLastError() == ERROR_INSUFFICIENT_BUFFER ) {
+             tokenUser = (PTOKEN_USER) LocalAlloc(LPTR, retLen);
+ 
+             if (!GetTokenInformation(pInfo->hToken, TokenUser, tokenUser, retLen, &retLen))
+             {
+                 DebugEvent("AFS_Logon_Event - GetTokenInformation failed: GLE = %lX", GetLastError());
+             }
+         }
+     }
+ 
+     /* We can't use pInfo->Domain for the domain since in the cross realm case 
+      * this is source domain and not the destination domain.
+      */
+     if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, pInfo->Domain)) {
+         WCHAR Domain[64]=L"";
+         GetLocalShortDomain(Domain, sizeof(Domain));
+         if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser->User.Sid, Domain)) {
+             if (NetUserGetProfilePath(pInfo->Domain, pInfo->UserName, profileDir, len))
+                 GetUserProfileDirectory(pInfo->hToken, profileDir, &len);
+         }
+     }
+     
+     if (strlen(profileDir)) {
+         DebugEvent("AFS_Logon_Event - Profile Directory: %s", profileDir);
+     } else {
+         DebugEvent0("AFS_Logon_Event - Unable to load profile");
+     }
+ 
+     dwSize = sizeof(szUserA);
+     if (!KFW_AFS_get_lsa_principal(szUserA, &dwSize)) {
+         StringCbPrintfW(szUserW, sizeof(szUserW), L"%s\\%s", pInfo->Domain, pInfo->UserName);
+         WideCharToMultiByte(CP_ACP, 0, szUserW, -1, szUserA, MAX_PATH, NULL, NULL);
+     }
+ 
+     if (szUserA[0])
+     {
+         lana_GetNetbiosName(szClient, LANA_NETBIOS_NAME_FULL);
+         StringCbPrintf(szPath, sizeof(szPath), "\\\\%s", szClient);
+ 
+         DebugEvent("AFS_Logon_Event - Logon Name: %s", szUserA);
+ 
+         memset (&nr, 0x00, sizeof(NETRESOURCE));
+         nr.dwType=RESOURCETYPE_DISK;
+         nr.lpLocalName=0;
+         nr.lpRemoteName=szPath;
+         res = WNetAddConnection2(&nr,NULL,szUserA,0);
+         if (res)
+             DebugEvent("AFS_Logon_Event - WNetAddConnection2(%s,%s) failed: 0x%X",
+                         szPath, szUserA,res);
+         else
+             DebugEvent0("AFS_Logon_Event - WNetAddConnection2() succeeded");
+     } else 
+         DebugEvent("AFS_Logon_Event - User name conversion failed: GLE = 0x%X",GetLastError());
+ 
+     if ( tokenUser )
+         LocalFree(tokenUser);
+ 
+     DebugEvent0("AFS_Logon_Event - End");
+ }
+ 
Index: openafs/src/WINNT/afsd/afslogon.def
diff -c openafs/src/WINNT/afsd/afslogon.def:1.3 openafs/src/WINNT/afsd/afslogon.def:1.3.2.1
*** openafs/src/WINNT/afsd/afslogon.def:1.3	Thu Jul 22 05:23:52 2004
--- openafs/src/WINNT/afsd/afslogon.def	Thu Apr 28 08:05:19 2005
***************
*** 10,14 ****
--- 10,15 ----
      NPPasswordChangeNotify
      AFS_Startup_Event
      AFS_Logoff_Event
+     AFS_Logon_Event
  
  
Index: openafs/src/WINNT/afsd/cm_aclent.c
diff -c openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.5 openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.6
*** openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.5	Fri Mar 11 01:58:39 2005
--- openafs/src/WINNT/afsd/cm_aclent.c	Tue Apr 19 01:11:17 2005
***************
*** 37,53 ****
      cm_aclent_t **laclpp;
          
      if (aclp->backp) {
!         /* 
!          * Remove the entry from the vnode's list 
!          */
!         laclpp = &aclp->backp->randomACLp;
!         for (taclp = *laclpp; taclp; laclpp = &taclp->nextp, taclp = *laclpp) {
!             if (taclp == aclp) 
!                 break;
!         }
!         if (!taclp) 
!             osi_panic("CleanupACLEnt race", __FILE__, __LINE__);
!         *laclpp = aclp->nextp;			/* remove from vnode list */
          aclp->backp = NULL;
      }
  
--- 37,56 ----
      cm_aclent_t **laclpp;
          
      if (aclp->backp) {
!         if (aclp->backp->randomACLp) {
!             /* 
!              * Remove the entry from the vnode's list 
!              */
!             lock_AssertMutex(&aclp->backp->mx);
!             laclpp = &aclp->backp->randomACLp;
!             for (taclp = *laclpp; taclp; laclpp = &taclp->nextp, taclp = *laclpp) {
!                 if (taclp == aclp) 
!                     break;
!             }
!             if (!taclp) 
!                 osi_panic("CleanupACLEnt race", __FILE__, __LINE__);
!             *laclpp = aclp->nextp;			/* remove from vnode list */
!         }
          aclp->backp = NULL;
      }
  
***************
*** 110,119 ****
   * This function returns a free (not in the LRU queue) acl cache entry.
   * It must be called with the cm_aclLock lock held
   */
! static cm_aclent_t *GetFreeACLEnt(void)
  {
      cm_aclent_t *aclp;
! 
      if (cm_data.aclLRUp == NULL)
          osi_panic("empty aclent LRU", __FILE__, __LINE__);
  
--- 113,123 ----
   * This function returns a free (not in the LRU queue) acl cache entry.
   * It must be called with the cm_aclLock lock held
   */
! static cm_aclent_t *GetFreeACLEnt(cm_scache_t * scp)
  {
      cm_aclent_t *aclp;
!     cm_scache_t *ascp = 0;
! 	
      if (cm_data.aclLRUp == NULL)
          osi_panic("empty aclent LRU", __FILE__, __LINE__);
  
***************
*** 121,128 ****
--- 125,138 ----
      cm_data.aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q);
      osi_QRemove((osi_queue_t **) &cm_data.aclLRUp, &aclp->q);
  
+     if (aclp->backp && scp != aclp->backp) {
+         ascp = aclp->backp;
+         lock_ObtainMutex(&ascp->mx);
+     }
      CleanupACLEnt(aclp);
  
+     if (ascp)
+         lock_ReleaseMutex(&ascp->mx);
      return aclp;
  }
  
***************
*** 153,159 ****
       * and  reuse. But first try the free list and see if there's already 
       * someone there.
       */
!     aclp = GetFreeACLEnt();		 /* can't fail, panics instead */
      osi_QAddH((osi_queue_t **) &cm_data.aclLRUp, (osi_queue_t **) &cm_data.aclLRUEndp, &aclp->q);
      aclp->backp = scp;
      aclp->nextp = scp->randomACLp;
--- 163,169 ----
       * and  reuse. But first try the free list and see if there's already 
       * someone there.
       */
!     aclp = GetFreeACLEnt(scp);		 /* can't fail, panics instead */
      osi_QAddH((osi_queue_t **) &cm_data.aclLRUp, (osi_queue_t **) &cm_data.aclLRUEndp, &aclp->q);
      aclp->backp = scp;
      aclp->nextp = scp->randomACLp;
Index: openafs/src/WINNT/afsd/cm_callback.c
diff -c openafs/src/WINNT/afsd/cm_callback.c:1.20.2.10 openafs/src/WINNT/afsd/cm_callback.c:1.20.2.11
*** openafs/src/WINNT/afsd/cm_callback.c:1.20.2.10	Mon Apr  4 22:17:15 2005
--- openafs/src/WINNT/afsd/cm_callback.c	Wed Apr 27 11:32:52 2005
***************
*** 1499,1504 ****
--- 1499,1505 ----
      cm_racingRevokes_t *nrevp;		/* where we'll be next */
      int freeFlag;
      cm_server_t * serverp = 0;
+     int discardScp = 0;
  
      lock_ObtainWrite(&cm_callbackLock);
      if (flags & CM_CALLBACK_MAINTAINCOUNT) {
***************
*** 1561,1576 ****
                        scp,
                        cbrp->callbackCount, revp->callbackCount,
                        cm_callbackCount);
!             cm_DiscardSCache(scp);
!             /*
!              * Since we don't have a callback to preserve, it's
!              * OK to drop the lock and re-obtain it.
!              */
!             lock_ReleaseMutex(&scp->mx);
!             lock_ReleaseWrite(&cm_callbackLock);
!             cm_CallbackNotifyChange(scp);
!             lock_ObtainMutex(&scp->mx);
!             lock_ObtainWrite(&cm_callbackLock);
          }
          if (freeFlag) 
              free(revp);
--- 1562,1568 ----
                        scp,
                        cbrp->callbackCount, revp->callbackCount,
                        cm_callbackCount);
!             discardScp = 1;
          }
          if (freeFlag) 
              free(revp);
***************
*** 1582,1587 ****
--- 1574,1586 ----
  
      lock_ReleaseWrite(&cm_callbackLock);
  
+     if ( discardScp ) {
+         cm_DiscardSCache(scp);
+         lock_ReleaseMutex(&scp->mx);
+         cm_CallbackNotifyChange(scp);
+         lock_ObtainMutex(&scp->mx);
+     }
+ 
      if ( serverp ) {
          lock_ObtainWrite(&cm_serverLock);
          cm_FreeServer(serverp);
Index: openafs/src/WINNT/afsd/cm_daemon.c
diff -c openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.2 openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.5
*** openafs/src/WINNT/afsd/cm_daemon.c:1.4.2.2	Fri Mar 11 01:58:41 2005
--- openafs/src/WINNT/afsd/cm_daemon.c	Tue Apr 19 17:07:14 2005
***************
*** 21,26 ****
--- 21,27 ----
  #include <string.h>
  
  #include <rx/rx.h>
+ #include <rx/rx_prototypes.h>
  
  #include "afsd.h"
  
***************
*** 42,47 ****
--- 43,50 ----
  {
      cm_bkgRequest_t *rp;
  
+     rx_StartClientThread();
+ 
      lock_ObtainWrite(&cm_daemonLock);
      while (daemon_ShutdownFlag == 0) {
          if (!cm_bkgListEndp) {
***************
*** 109,114 ****
--- 112,118 ----
      char thostName[200];
      unsigned long code;
      struct hostent *thp;
+     HMODULE hHookDll;
  
      /* ping all file servers, up or down, with unauthenticated connection,
       * to find out whether we have all our callbacks from the server still.
***************
*** 176,181 ****
--- 180,204 ----
              lastTokenCacheCheck = now;
              cm_CheckTokenCache(now);
          }
+ 
+         /* allow an exit to be called prior to stopping the service */
+         hHookDll = LoadLibrary(AFSD_HOOK_DLL);
+         if (hHookDll)
+         {
+             BOOL hookRc = TRUE;
+             AfsdDaemonHook daemonHook = ( AfsdDaemonHook ) GetProcAddress(hHookDll, AFSD_DAEMON_HOOK);
+             if (daemonHook)
+             {
+                 hookRc = daemonHook();
+             }
+             FreeLibrary(hHookDll);
+             hHookDll = NULL;
+ 
+             if (hookRc == FALSE)
+             {
+                 SetEvent(WaitToTerminate);
+             }
+         }
      }
  }       
  
Index: openafs/src/WINNT/afsd/cm_memmap.c
diff -c openafs/src/WINNT/afsd/cm_memmap.c:1.1.2.1 openafs/src/WINNT/afsd/cm_memmap.c:1.1.2.2
*** openafs/src/WINNT/afsd/cm_memmap.c:1.1.2.1	Fri Mar 11 02:22:40 2005
--- openafs/src/WINNT/afsd/cm_memmap.c	Tue Apr 19 01:11:17 2005
***************
*** 102,114 ****
  }
  
  DWORD
! ComputeSizeOfMappingFile(DWORD stats, DWORD chunkSize, DWORD cacheBlocks, DWORD blockSize)
  {
      DWORD size;
      
      size       =  ComputeSizeOfConfigData()
!                +  ComputeSizeOfVolumes(stats/2) 
!                +  ComputeSizeOfCells(stats/4) 
                 +  ComputeSizeOfACLCache(stats)
                 +  ComputeSizeOfSCache(stats)
                 +  ComputeSizeOfSCacheHT(stats)
--- 102,114 ----
  }
  
  DWORD
! ComputeSizeOfMappingFile(DWORD stats, DWORD maxVols, DWORD maxCells, DWORD chunkSize, DWORD cacheBlocks, DWORD blockSize)
  {
      DWORD size;
      
      size       =  ComputeSizeOfConfigData()
!                +  ComputeSizeOfVolumes(maxVols) 
!                +  ComputeSizeOfCells(maxCells) 
                 +  ComputeSizeOfACLCache(stats)
                 +  ComputeSizeOfSCache(stats)
                 +  ComputeSizeOfSCacheHT(stats)
***************
*** 417,427 ****
      PSECURITY_ATTRIBUTES psa;
      int newFile = 1;
      DWORD mappingSize;
      char * baseAddress = NULL;
      cm_config_data_t * config_data_p;
      char * p;
  
!     mappingSize = ComputeSizeOfMappingFile(stats, chunkSize, cacheBlocks, CM_CONFIGDEFAULT_BLOCKSIZE);
  
      if ( !virtualCache ) {
          psa = CreateCacheFileSA();
--- 417,429 ----
      PSECURITY_ATTRIBUTES psa;
      int newFile = 1;
      DWORD mappingSize;
+     DWORD maxVols = stats/2;
+     DWORD maxCells = stats/4;
      char * baseAddress = NULL;
      cm_config_data_t * config_data_p;
      char * p;
  
!     mappingSize = ComputeSizeOfMappingFile(stats, maxVols, maxCells, chunkSize, cacheBlocks, CM_CONFIGDEFAULT_BLOCKSIZE);
  
      if ( !virtualCache ) {
          psa = CreateCacheFileSA();
***************
*** 529,534 ****
--- 531,538 ----
              if ( config_data_p->size == sizeof(cm_config_data_t) &&
                   config_data_p->magic == CM_CONFIG_DATA_MAGIC &&
                   config_data_p->stats == stats &&
+                  config_data_p->maxVolumes == maxVols &&
+                  config_data_p->maxCells == maxCells &&
                   config_data_p->chunkSize == chunkSize &&
                   config_data_p->buf_nbuffers == cacheBlocks &&
                   config_data_p->blockSize == CM_CONFIGDEFAULT_BLOCKSIZE &&
***************
*** 622,630 ****
  
          baseAddress += ComputeSizeOfConfigData();
          cm_data.volumeBaseAddress = (cm_volume_t *) baseAddress;
!         baseAddress += ComputeSizeOfVolumes(stats/2);
          cm_data.cellBaseAddress = (cm_cell_t *) baseAddress;
!         baseAddress += ComputeSizeOfCells(stats/4);
          cm_data.aclBaseAddress = (cm_aclent_t *) baseAddress;
          baseAddress += ComputeSizeOfACLCache(stats);
          cm_data.scacheBaseAddress = (cm_scache_t *) baseAddress;
--- 626,634 ----
  
          baseAddress += ComputeSizeOfConfigData();
          cm_data.volumeBaseAddress = (cm_volume_t *) baseAddress;
!         baseAddress += ComputeSizeOfVolumes(maxVols);
          cm_data.cellBaseAddress = (cm_cell_t *) baseAddress;
!         baseAddress += ComputeSizeOfCells(maxCells);
          cm_data.aclBaseAddress = (cm_aclent_t *) baseAddress;
          baseAddress += ComputeSizeOfACLCache(stats);
          cm_data.scacheBaseAddress = (cm_scache_t *) baseAddress;
***************
*** 653,662 ****
      RpcStringFree(&p);
  
      afsi_log("Initializing Volume Data");
!     cm_InitVolume(newFile, stats/2);
  
      afsi_log("Initializing Cell Data");
!     cm_InitCell(newFile, stats/4);
  
      afsi_log("Initializing ACL Data");
      cm_InitACLCache(newFile, 2*stats);
--- 657,666 ----
      RpcStringFree(&p);
  
      afsi_log("Initializing Volume Data");
!     cm_InitVolume(newFile, maxVols);
  
      afsi_log("Initializing Cell Data");
!     cm_InitCell(newFile, maxCells);
  
      afsi_log("Initializing ACL Data");
      cm_InitACLCache(newFile, 2*stats);
Index: openafs/src/WINNT/afsd/cm_vnodeops.c
diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.15 openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.16
*** openafs/src/WINNT/afsd/cm_vnodeops.c:1.19.2.15	Sat Apr  2 03:35:49 2005
--- openafs/src/WINNT/afsd/cm_vnodeops.c	Tue Apr 19 01:11:17 2005
***************
*** 2692,2698 ****
                void **lockpp)
  {
      long code;
!     int Which = ((LockType & 0x1) ? LockRead : LockWrite);
      AFSFid tfid;
      AFSVolSync volSync;
      cm_conn_t *connp;
--- 2692,2698 ----
                void **lockpp)
  {
      long code;
!     int Which = ((LockType & LOCKING_ANDX_SHARED_LOCK) ? LockRead : LockWrite);
      AFSFid tfid;
      AFSVolSync volSync;
      cm_conn_t *connp;
***************
*** 2706,2718 ****
       */
      q = scp->fileLocks;
      while (q) {
!         fileLock = (cm_file_lock_t *)
!             ((char *) q - offsetof(cm_file_lock_t, fileq));
!         if ((fileLock->flags &
!               (CM_FILELOCK_FLAG_INVALID | CM_FILELOCK_FLAG_WAITING))
!              == 0) {
!             if ((LockType & 0x1) == 0
!                  || (fileLock->LockType & 0x1) == 0)
                  return CM_ERROR_WOULDBLOCK;
              found = 1;
          }
--- 2706,2715 ----
       */
      q = scp->fileLocks;
      while (q) {
!         fileLock = (cm_file_lock_t *)((char *) q - offsetof(cm_file_lock_t, fileq));
!         if ((fileLock->flags & (CM_FILELOCK_FLAG_INVALID | CM_FILELOCK_FLAG_WAITING)) == 0) {
!             if ((LockType & LOCKING_ANDX_SHARED_LOCK) == 0 ||
!                 (fileLock->LockType & LOCKING_ANDX_SHARED_LOCK) == 0)
                  return CM_ERROR_WOULDBLOCK;
              found = 1;
          }
***************
*** 2766,2772 ****
                  cm_user_t *userp, cm_req_t *reqp)
  {
      long code = 0;
!     int Which = ((LockType & 0x1) ? LockRead : LockWrite);
      AFSFid tfid;
      AFSVolSync volSync;
      cm_conn_t *connp;
--- 2763,2769 ----
                  cm_user_t *userp, cm_req_t *reqp)
  {
      long code = 0;
!     int Which = ((LockType & LOCKING_ANDX_SHARED_LOCK) ? LockRead : LockWrite);
      AFSFid tfid;
      AFSVolSync volSync;
      cm_conn_t *connp;
***************
*** 2795,2801 ****
              ourLock = fileLock;
              qq = q;
          }
!         else if (fileLock->LockType & 0x1)
              anotherReader = 1;
          q = osi_QNext(q);
      }
--- 2792,2798 ----
              ourLock = fileLock;
              qq = q;
          }
!         else if (fileLock->LockType & LOCKING_ANDX_SHARED_LOCK)
              anotherReader = 1;
          q = osi_QNext(q);
      }
***************
*** 2907,2913 ****
  long cm_RetryLock(cm_file_lock_t *oldFileLock, int vcp_is_dead)
  {
      long code;
!     int Which = ((oldFileLock->LockType & 0x1) ? LockRead : LockWrite);
      cm_scache_t *scp;
      AFSFid tfid;
      AFSVolSync volSync;
--- 2904,2910 ----
  long cm_RetryLock(cm_file_lock_t *oldFileLock, int vcp_is_dead)
  {
      long code;
!     int Which = ((oldFileLock->LockType & LOCKING_ANDX_SHARED_LOCK) ? LockRead : LockWrite);
      cm_scache_t *scp;
      AFSFid tfid;
      AFSVolSync volSync;
***************
*** 2939,2946 ****
          if ((fileLock->flags &
                (CM_FILELOCK_FLAG_INVALID | CM_FILELOCK_FLAG_WAITING))
               == 0) {
!             if ((oldFileLock->LockType & 0x1) == 0
!                  || (fileLock->LockType & 0x1) == 0) {
                  cm_ReleaseSCache(scp);
                  return CM_ERROR_WOULDBLOCK;
              }
--- 2936,2943 ----
          if ((fileLock->flags &
                (CM_FILELOCK_FLAG_INVALID | CM_FILELOCK_FLAG_WAITING))
               == 0) {
!             if ((oldFileLock->LockType & LOCKING_ANDX_SHARED_LOCK) == 0
!                  || (fileLock->LockType & LOCKING_ANDX_SHARED_LOCK) == 0) {
                  cm_ReleaseSCache(scp);
                  return CM_ERROR_WOULDBLOCK;
              }
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.55.2.20 openafs/src/WINNT/afsd/smb.c:1.55.2.22
*** openafs/src/WINNT/afsd/smb.c:1.55.2.20	Thu Mar 31 18:36:42 2005
--- openafs/src/WINNT/afsd/smb.c	Tue Apr 19 02:27:57 2005
***************
*** 25,30 ****
--- 25,32 ----
  #include <time.h>
  
  #include <osi.h>
+ #include <rx\rx.h>
+ #include <rx/rx_prototypes.h>
  
  #include "afsd.h"
  #include <WINNT\afsreg.h>
***************
*** 152,158 ****
  static showErrors = 1;
  /* MessageBox or something like it */
  int (_stdcall *smb_MBfunc)(HWND, LPCTSTR, LPCTSTR, UINT) = NULL;
- extern HANDLE WaitToTerminate;
  #endif /* DJGPP */
  
  /* GMT time info:
--- 154,159 ----
***************
*** 6956,6961 ****
--- 6957,6964 ----
      dos_ptr dos_ncb;
  #endif /* DJGPP */
  
+     rx_StartClientThread();
+ 
      outncbp = GetNCB();
      outbufp = GetPacket();
      outbufp->ncbp = outncbp;
Index: openafs/src/WINNT/afsd/smb.h
diff -c openafs/src/WINNT/afsd/smb.h:1.14.2.11 openafs/src/WINNT/afsd/smb.h:1.14.2.12
*** openafs/src/WINNT/afsd/smb.h:1.14.2.11	Thu Mar 31 18:36:43 2005
--- openafs/src/WINNT/afsd/smb.h	Tue Apr 19 01:11:18 2005
***************
*** 365,370 ****
--- 365,376 ----
  #define SMB_ATTR_NOT_CONTENT_INDEXED 0x2000
  #define SMB_ATTR_ENCRYPTED      0x4000
  
+ #define LOCKING_ANDX_SHARED_LOCK        0x01 /* Read-only lock */
+ #define LOCKING_ANDX_OPLOCK_RELEASE     0x02 /* Oplock break notification */
+ #define LOCKING_ANDX_CHANGE_LOCKTYPE    0x04 /* Change lock type */
+ #define LOCKING_ANDX_CANCEL_LOCK        0x08 /* Cancel outstanding request */
+ #define LOCKING_ANDX_LARGE_FILES        0x10 /* Large file locking format */
+ 
  /* for tracking in-progress directory searches */
  typedef struct smb_dirSearch {
      osi_queue_t q;			/* queue of all outstanding cookies */
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.42.2.24 openafs/src/WINNT/afsd/smb3.c:1.42.2.25
*** openafs/src/WINNT/afsd/smb3.c:1.42.2.24	Thu Mar 31 18:36:43 2005
--- openafs/src/WINNT/afsd/smb3.c	Tue Apr 19 01:11:18 2005
***************
*** 4832,4838 ****
      op = smb_GetSMBData(inp, NULL);
  
      for (i=0; i<NumberOfUnlocks; i++) {
!         if (LockType & 0x10) {
              /* Large Files */
              LOffset.HighPart = *((LONG *)(op + 4));
              LOffset.LowPart = *((DWORD *)(op + 8));
--- 4832,4838 ----
      op = smb_GetSMBData(inp, NULL);
  
      for (i=0; i<NumberOfUnlocks; i++) {
!         if (LockType & LOCKING_ANDX_LARGE_FILES) {
              /* Large Files */
              LOffset.HighPart = *((LONG *)(op + 4));
              LOffset.LowPart = *((DWORD *)(op + 8));
***************
*** 4857,4863 ****
      }       
  
      for (i=0; i<NumberOfLocks; i++) {
!         if (LockType & 0x10) {
              /* Large Files */
              LOffset.HighPart = *((LONG *)(op + 4));
              LOffset.LowPart = *((DWORD *)(op + 8));
--- 4857,4863 ----
      }       
  
      for (i=0; i<NumberOfLocks; i++) {
!         if (LockType & LOCKING_ANDX_LARGE_FILES) {
              /* Large Files */
              LOffset.HighPart = *((LONG *)(op + 4));
              LOffset.LowPart = *((DWORD *)(op + 8));
Index: openafs/src/WINNT/afsreg/syscfg.c
diff -c openafs/src/WINNT/afsreg/syscfg.c:1.2.20.1 openafs/src/WINNT/afsreg/syscfg.c:1.2.20.3
*** openafs/src/WINNT/afsreg/syscfg.c:1.2.20.1	Fri Mar 11 01:58:59 2005
--- openafs/src/WINNT/afsreg/syscfg.c	Tue Apr 19 01:12:41 2005
***************
*** 64,70 ****
  
      hIpHlp = LoadLibrary("iphlpapi");
      if (hIpHlp != NULL) {
!         (FARPROC) pGetAdaptersAddresses = GetProcAddress(hIpHlp, "GetAdaptersAddressess");
          if (pGetAdaptersAddresses == NULL)
              FreeLibrary(hIpHlp);
      }
--- 64,70 ----
  
      hIpHlp = LoadLibrary("iphlpapi");
      if (hIpHlp != NULL) {
!         (FARPROC) pGetAdaptersAddresses = GetProcAddress(hIpHlp, "GetAdaptersAddresses");
          if (pGetAdaptersAddresses == NULL)
              FreeLibrary(hIpHlp);
      }
***************
*** 171,177 ****
      }
  
    done:
!     CloseHandle(hIpHlp);
      return nConfig;
  }
  
--- 171,177 ----
      }
  
    done:
!     FreeLibrary(hIpHlp);
      return nConfig;
  }
  
Index: openafs/src/WINNT/client_exp/gui2fs.cpp
diff -c openafs/src/WINNT/client_exp/gui2fs.cpp:1.10.2.2 openafs/src/WINNT/client_exp/gui2fs.cpp:1.10.2.3
*** openafs/src/WINNT/client_exp/gui2fs.cpp:1.10.2.2	Wed Aug 18 13:52:30 2004
--- openafs/src/WINNT/client_exp/gui2fs.cpp	Wed Apr 20 22:20:05 2005
***************
*** 69,112 ****
  
  FILE *OpenFile(char *file, char *rwp)
  {
! 	char wdir[256];
! 	long code;
! 	long tlen;
! 	FILE *fp;
  
! 	code = GetWindowsDirectory(wdir, sizeof(wdir));
! 	if (code == 0 || code > sizeof(wdir)) 
! 		return FALSE;
  
! 	/* add trailing backslash, if required */
! 	tlen = strlen(wdir);
! 	if (wdir[tlen - 1] != '\\')
! 		strcat(wdir, "\\");
  
! 	strcat(wdir, file);
  
! 	fp = fopen(wdir, rwp);
  
! 	return fp;
! }
  
  CString StripPath(CString& strPath)
  {
! 	int nIndex = strPath.ReverseFind('\\');
  
! 	CString strFile = strPath.Mid(nIndex + 1);
! 	if (strFile.IsEmpty())
! 		return strPath;
  
! 	return strFile;
  }
  
  CStringArray& StripPath(CStringArray& files)
  {
! 	for (int i = 0; i < files.GetSize(); i++)
! 		files[i] = StripPath(files[i]);
  
! 	return files;
  }
  
  void Flush(const CStringArray& files)
--- 69,112 ----
  
  FILE *OpenFile(char *file, char *rwp)
  {
!     char wdir[256];
!     long code;
!     long tlen;
!     FILE *fp;
  
!     code = GetWindowsDirectory(wdir, sizeof(wdir));
!     if (code == 0 || code > sizeof(wdir)) 
!         return FALSE;
  
!     /* add trailing backslash, if required */
!     tlen = strlen(wdir);
!     if (wdir[tlen - 1] != '\\')
!         strcat(wdir, "\\");
  
!     strcat(wdir, file);
  
!     fp = fopen(wdir, rwp);
  
!     return fp;
! }       
  
  CString StripPath(CString& strPath)
  {
!     int nIndex = strPath.ReverseFind('\\');
  
!     CString strFile = strPath.Mid(nIndex + 1);
!     if (strFile.IsEmpty())
!         return strPath;
  
!     return strFile;
  }
  
  CStringArray& StripPath(CStringArray& files)
  {
!     for (int i = 0; i < files.GetSize(); i++)
!         files[i] = StripPath(files[i]);
  
!     return files;
  }
  
  void Flush(const CStringArray& files)
***************
*** 115,160 ****
      struct ViceIoctl blob;
      int error = 0;
  
! 	HOURGLASS hourglass;
  
! 	for (int i = 0; i < files.GetSize(); i++) {
! 		blob.in_size = blob.out_size = 0;
  
! 		code = pioctl(PCCHAR(files[i]), VIOCFLUSH, &blob, 0);
! 		if (code) {
! 			error = 1;
! 			if (errno == EMFILE)
! 				ShowMessageBox(IDS_FLUSH_FAILED, MB_ICONEXCLAMATION, IDS_FLUSH_FAILED, files[i]);
! 			else 
! 				ShowMessageBox(IDS_FLUSH_ERROR, MB_ICONEXCLAMATION, IDS_FLUSH_ERROR, files[i], strerror(errno));
! 		}
!     }
  
! 	if (!error)
! 		ShowMessageBox(IDS_FLUSH_OK, MB_ICONEXCLAMATION, IDS_FLUSH_OK);
! }
  
  void FlushVolume(const CStringArray& files)
  {
      register LONG code;
      struct ViceIoctl blob;
! 	int error = 0;
  
! 	HOURGLASS hourglass;
  
! 	for (int i = 0; i < files.GetSize(); i++) {
! 		blob.in_size = blob.out_size = 0;
  
! 		code = pioctl(PCCHAR(files[i]), VIOC_FLUSHVOLUME, &blob, 0);
! 		if (code) {
! 			error = 1;
! 			ShowMessageBox(IDS_FLUSH_VOLUME_ERROR, MB_ICONEXCLAMATION, IDS_FLUSH_VOLUME_ERROR, files[i], strerror(errno));
! 		}
!     }
  
! 	if (!code)
! 		ShowMessageBox(IDS_FLUSH_VOLUME_OK, MB_ICONEXCLAMATION, IDS_FLUSH_VOLUME_OK);
! }
  
  void WhichCell(CStringArray& files)
  {
--- 115,160 ----
      struct ViceIoctl blob;
      int error = 0;
  
!     HOURGLASS hourglass;
  
!     for (int i = 0; i < files.GetSize(); i++) {
!         blob.in_size = blob.out_size = 0;
  
!         code = pioctl(PCCHAR(files[i]), VIOCFLUSH, &blob, 0);
!         if (code) {
!             error = 1;
!             if (errno == EMFILE)
!                 ShowMessageBox(IDS_FLUSH_FAILED, MB_ICONEXCLAMATION, IDS_FLUSH_FAILED, files[i]);
!             else 
!                 ShowMessageBox(IDS_FLUSH_ERROR, MB_ICONEXCLAMATION, IDS_FLUSH_ERROR, files[i], strerror(errno));
!         }
!     }   
  
!     if (!error)
!         ShowMessageBox(IDS_FLUSH_OK, MB_ICONEXCLAMATION, IDS_FLUSH_OK);
! }       
  
  void FlushVolume(const CStringArray& files)
  {
      register LONG code;
      struct ViceIoctl blob;
!     int error = 0;
  
!     HOURGLASS hourglass;
  
!     for (int i = 0; i < files.GetSize(); i++) {
!         blob.in_size = blob.out_size = 0;
  
!         code = pioctl(PCCHAR(files[i]), VIOC_FLUSHVOLUME, &blob, 0);
!         if (code) {
!             error = 1;
!             ShowMessageBox(IDS_FLUSH_VOLUME_ERROR, MB_ICONEXCLAMATION, IDS_FLUSH_VOLUME_ERROR, files[i], strerror(errno));
!         }
!     }   
  
!     if (!code)
!         ShowMessageBox(IDS_FLUSH_VOLUME_OK, MB_ICONEXCLAMATION, IDS_FLUSH_VOLUME_OK);
! }       
  
  void WhichCell(CStringArray& files)
  {
***************
*** 164,196 ****
      CString str;
      CString str2;
  
! 	CStringArray results;
  
      error = 0;
  
! 	HOURGLASS hourglass;
  
! 	for (int i = 0; i < files.GetSize(); i++) {
! 		blob.in_size = 0;
! 		blob.out_size = MAXSIZE;
! 		blob.out = space;
! 
! 		code = pioctl(PCCHAR(files[i]), VIOC_FILE_CELL_NAME, &blob, 1);
! 		if (code) {
! 			if (code == ENOENT) {
! 				LoadString (str, IDS_CANT_GET_CELL);
! 				results.Add(str);
! 			} else
! 				results.Add(GetAfsError(errno));
! 		} else
! 			results.Add(space);
! 	}
! 
! 	LoadString (str, IDS_SHOW_CELL);
! 	LoadString (str2, IDS_SHOW_CELL_COLUMN);
! 	CResultsDlg dlg(SHOW_CELL_HELP_ID);
! 	dlg.SetContents(str, str2, StripPath(files), results);
! 	dlg.DoModal();
  }
  
  void WSCellCmd()
--- 164,196 ----
      CString str;
      CString str2;
  
!     CStringArray results;
  
      error = 0;
  
!     HOURGLASS hourglass;
  
!     for (int i = 0; i < files.GetSize(); i++) {
!         blob.in_size = 0;
!         blob.out_size = MAXSIZE;
!         blob.out = space;
! 
!         code = pioctl(PCCHAR(files[i]), VIOC_FILE_CELL_NAME, &blob, 1);
!         if (code) {
!             if (code == ENOENT) {
!                 LoadString (str, IDS_CANT_GET_CELL);
!                 results.Add(str);
!             } else
!                 results.Add(GetAfsError(errno));
!         } else
!             results.Add(space);
!     }       
! 
!     LoadString (str, IDS_SHOW_CELL);
!     LoadString (str2, IDS_SHOW_CELL_COLUMN);
!     CResultsDlg dlg(SHOW_CELL_HELP_ID);
!     dlg.SetContents(str, str2, StripPath(files), results);
!     dlg.DoModal();
  }
  
  void WSCellCmd()
***************
*** 198,204 ****
      register LONG code;
      struct ViceIoctl blob;
      
! 	HOURGLASS hourglass;
  
      blob.in_size = 0;
      blob.in = (char *) 0;
--- 198,204 ----
      register LONG code;
      struct ViceIoctl blob;
      
!     HOURGLASS hourglass;
  
      blob.in_size = 0;
      blob.in = (char *) 0;
***************
*** 208,217 ****
      code = pioctl((char *) 0, VIOC_GET_WS_CELL, &blob, 1);
  
      if (code) {
! 		//Die(errno, (char *) 0);
      }
      //else
! 		//printf("This workstation belongs to cell '%s'\n", space);
  }
  
  BOOL CheckVolumes()
--- 208,217 ----
      code = pioctl((char *) 0, VIOC_GET_WS_CELL, &blob, 1);
  
      if (code) {
!         //Die(errno, (char *) 0);
      }
      //else
!     //printf("This workstation belongs to cell '%s'\n", space);
  }
  
  BOOL CheckVolumes()
***************
*** 223,235 ****
      blob.out_size = 0;
      code = pioctl(0, VIOCCKBACK, &blob, 1);
      if (code) {
! 		ShowMessageBox(IDS_CHECK_VOLUMES_ERROR, MB_ICONEXCLAMATION, IDS_CHECK_VOLUMES_ERROR, GetAfsError(errno, CString()));
! 		return FALSE;
      }
  
      ShowMessageBox(IDS_CHECK_VOLUMES_OK, MB_OK, IDS_CHECK_VOLUMES_OK);
  
! 	return TRUE;
  }
  
  void SetCacheSizeCmd(LONG nNewCacheSize)
--- 223,235 ----
      blob.out_size = 0;
      code = pioctl(0, VIOCCKBACK, &blob, 1);
      if (code) {
!         ShowMessageBox(IDS_CHECK_VOLUMES_ERROR, MB_ICONEXCLAMATION, IDS_CHECK_VOLUMES_ERROR, GetAfsError(errno, CString()));
!         return FALSE;
      }
  
      ShowMessageBox(IDS_CHECK_VOLUMES_OK, MB_OK, IDS_CHECK_VOLUMES_OK);
  
!     return TRUE;
  }
  
  void SetCacheSizeCmd(LONG nNewCacheSize)
***************
*** 237,334 ****
      register LONG code;
      struct ViceIoctl blob;
      
! 	HOURGLASS hourglass;
  
! 	blob.in = (char *) &nNewCacheSize;
      blob.in_size = sizeof(LONG);
      blob.out_size = 0;
  
      code = pioctl(0, VIOCSETCACHESIZE, &blob, 1);
      //if (code)
! 	//	Die(errno, (char *) 0);
      //else
! 	//	printf("New cache size set.\n");
  }
  
  void WhereIs(CStringArray& files)
  {
      register LONG code;
      struct ViceIoctl blob;
!    	CStringArray servers;
! 	CStringArray resultFiles;
! 	CString str;
! 	CString str2;
! 
! 	HOURGLASS hourglass;
! 
! 	for (int i = 0; i < files.GetSize(); i++) {
! 		blob.out_size = MAXSIZE;
! 		blob.in_size = 0;
! 		blob.out = space;
! 		memset(space, 0, sizeof(space));
! 
! 		code = pioctl(PCCHAR(files[i]), VIOCWHEREIS, &blob, 1);
! 		if (code) {
! 			resultFiles.Add(StripPath(files[i]));
! 			servers.Add(GetAfsError(errno));
! 			continue;
! 		}
! 		
! 		LONG *hosts = (LONG *)space;
! 		BOOL bFirst = TRUE;
! 		str = "";
! 
! 		for (int j = 0; j < MAXHOSTS; j++) {
! 			if (hosts[j] == 0)
! 				break;
! 			char *hostName = hostutil_GetNameByINet(hosts[j]);
! 			if (bFirst) {
! 				resultFiles.Add(StripPath(files[i]));
! 				bFirst = FALSE;
! 			} else
! 				resultFiles.Add(" ");
! 			servers.Add(hostName);
! 		}
! 	}
! 
! 	LoadString (str, IDS_SHOW_FS);
! 	LoadString (str2, IDS_SHOW_FS_COLUMN);
! 	CResultsDlg dlg(SHOW_FILE_SERVERS_HELP_ID);
! 	dlg.SetContents(str, str2, resultFiles, servers);
! 	dlg.DoModal();
! }
  
  CString GetAfsError(int code, const char *filename)
  {
      CString strMsg;
  
! 	if (code == EINVAL) {
! 		if (filename)
! 		    strMsg.Format("Invalid argument; it is possible that the file is not in AFS");
! 		else 
! 			strMsg.Format("Invalid argument");
      } else if (code == ENOENT) {
! 		if (filename) 
! 			strMsg.Format("The file does not exist");
! 		else 
! 			strMsg.Format("No such file returned");
      } else if (code == EROFS)  {
! 		strMsg.Format("You can not change a backup or readonly volume");
      } else if (code == EACCES || code == EPERM) {
! 		strMsg.Format("You do not have the required rights to do this operation");
      } else if (code == ENODEV) {
! 		strMsg.Format("AFS service may not have started");
      } else if (code == ESRCH) {
! 		strMsg.Format("Cell name not recognized");
      } else if (code == ETIMEDOUT) {
! 		strMsg.Format("Connection timed out");
      } else if (code == EPIPE) {
! 		strMsg.Format("Volume name or ID not recognized");
      } else {
! 		strMsg.Format("Error 0x%x occurred", code);
      }
  
! 	return strMsg;
  }
  
  
--- 237,334 ----
      register LONG code;
      struct ViceIoctl blob;
      
!     HOURGLASS hourglass;
  
!     blob.in = (char *) &nNewCacheSize;
      blob.in_size = sizeof(LONG);
      blob.out_size = 0;
  
      code = pioctl(0, VIOCSETCACHESIZE, &blob, 1);
      //if (code)
!     //	Die(errno, (char *) 0);
      //else
!     //	printf("New cache size set.\n");
  }
  
  void WhereIs(CStringArray& files)
  {
      register LONG code;
      struct ViceIoctl blob;
!     CStringArray servers;
!     CStringArray resultFiles;
!     CString str;
!     CString str2;
! 
!     HOURGLASS hourglass;
! 
!     for (int i = 0; i < files.GetSize(); i++) {
!         blob.out_size = MAXSIZE;
!         blob.in_size = 0;
!         blob.out = space;
!         memset(space, 0, sizeof(space));
! 
!         code = pioctl(PCCHAR(files[i]), VIOCWHEREIS, &blob, 1);
!         if (code) {
!             resultFiles.Add(StripPath(files[i]));
!             servers.Add(GetAfsError(errno));
!             continue;
!         }
! 
!         LONG *hosts = (LONG *)space;
!         BOOL bFirst = TRUE;
!         str = "";
! 
!         for (int j = 0; j < MAXHOSTS; j++) {
!             if (hosts[j] == 0)
!                 break;
!             char *hostName = hostutil_GetNameByINet(hosts[j]);
!             if (bFirst) {
!                 resultFiles.Add(StripPath(files[i]));
!                 bFirst = FALSE;
!             } else
!                 resultFiles.Add(" ");
!             servers.Add(hostName);
!         }
!     }
! 
!     LoadString (str, IDS_SHOW_FS);
!     LoadString (str2, IDS_SHOW_FS_COLUMN);
!     CResultsDlg dlg(SHOW_FILE_SERVERS_HELP_ID);
!     dlg.SetContents(str, str2, resultFiles, servers);
!     dlg.DoModal();
! }       
  
  CString GetAfsError(int code, const char *filename)
  {
      CString strMsg;
  
!     if (code == EINVAL) {
!         if (filename)
!             strMsg.Format("Invalid argument; it is possible that the file is not in AFS");
!         else 
!             strMsg.Format("Invalid argument");
      } else if (code == ENOENT) {
!         if (filename) 
!             strMsg.Format("The file does not exist");
!         else 
!             strMsg.Format("No such file returned");
      } else if (code == EROFS)  {
!         strMsg.Format("You can not change a backup or readonly volume");
      } else if (code == EACCES || code == EPERM) {
!         strMsg.Format("You do not have the required rights to do this operation");
      } else if (code == ENODEV) {
!         strMsg.Format("AFS service may not have started");
      } else if (code == ESRCH) {
!         strMsg.Format("Cell name not recognized");
      } else if (code == ETIMEDOUT) {
!         strMsg.Format("Connection timed out");
      } else if (code == EPIPE) {
!         strMsg.Format("Volume name or ID not recognized");
      } else {
!         strMsg.Format("Error 0x%x occurred", code);
      }
  
!     return strMsg;
  }
  
  
***************
*** 345,353 ****
  };
  
  struct Acl {
!     int dfs;				//	Originally true if a dfs acl; now also the type
! 							//	of the acl (1, 2, or 3, corresponding to object,
! 							//	initial dir, or initial object).
      sec_rgy_name_t cell;	//	DFS cell name
      int nplus;
      int nminus;
--- 345,353 ----
  };
  
  struct Acl {
!     int dfs;			//	Originally true if a dfs acl; now also the type
!                                 //	of the acl (1, 2, or 3, corresponding to object,
! 				//	initial dir, or initial object).
      sec_rgy_name_t cell;	//	DFS cell name
      int nplus;
      int nminus;
***************
*** 391,420 ****
      struct AclEntry *te, *ne;
      LONG ctr = 0;
      
! 	for (te = *ae; te; te = ne) {
          if ((!dfs && te->rights == 0) || te->rights == -1) {
              *lp = te->next;
              ne = te->next;
              free(te);
              ctr++;
! 		}
          else {
              ne = te->next;
              lp = &te->next;
! 		}
      }
      
! 	return ctr;
  }
  
  char *SkipLine (register char *astr)
  {
      while (*astr != '\n') 
! 		astr++;
      
! 	astr++;
      
! 	return astr;
  }
  
  /* tell if a name is 23 or -45 (digits or minus digits), which are bad names we must prune */
--- 391,420 ----
      struct AclEntry *te, *ne;
      LONG ctr = 0;
      
!     for (te = *ae; te; te = ne) {
          if ((!dfs && te->rights == 0) || te->rights == -1) {
              *lp = te->next;
              ne = te->next;
              free(te);
              ctr++;
!         }
          else {
              ne = te->next;
              lp = &te->next;
!         }
      }
      
!     return ctr;
  }
  
  char *SkipLine (register char *astr)
  {
      while (*astr != '\n') 
!         astr++;
      
!     astr++;
      
!     return astr;
  }
  
  /* tell if a name is 23 or -45 (digits or minus digits), which are bad names we must prune */
***************
*** 422,431 ****
  {
      register int tc;
  
! 	/* all must be '-' or digit to be bad */
      while (tc = *aname++) {
! 		if ((tc != '-') && (tc < '0' || tc > '9')) 
! 			return 0;
      }
  
      return 1;
--- 422,431 ----
  {
      register int tc;
  
!     /* all must be '-' or digit to be bad */
      while (tc = *aname++) {
!         if ((tc != '-') && (tc < '0' || tc > '9')) 
!             return 0;
      }
  
      return 1;
***************
*** 433,450 ****
  
  CString GetRightsString(register LONG arights, int dfs)
  {
! 	CString str;
  
      if (!dfs) {
! 		if (arights & PRSFS_READ) str += "r";
! 		if (arights & PRSFS_LOOKUP) str += "l";
! 		if (arights & PRSFS_INSERT) str += "i";
! 		if (arights & PRSFS_DELETE) str += "d";
! 		if (arights & PRSFS_WRITE) str += "w";
! 		if (arights & PRSFS_LOCK) str += "k";
! 		if (arights & PRSFS_ADMINISTER) str += "a";
      } else {
! 		ASSERT(FALSE);
  /*
  		if (arights & DFS_READ) str += "r"; else str += "-";
  		if (arights & DFS_WRITE) str += "w"; else printf("-");
--- 433,450 ----
  
  CString GetRightsString(register LONG arights, int dfs)
  {
!     CString str;
  
      if (!dfs) {
!         if (arights & PRSFS_READ) str += "r";
!         if (arights & PRSFS_LOOKUP) str += "l";
!         if (arights & PRSFS_INSERT) str += "i";
!         if (arights & PRSFS_DELETE) str += "d";
!         if (arights & PRSFS_WRITE) str += "w";
!         if (arights & PRSFS_LOCK) str += "k";
!         if (arights & PRSFS_ADMINISTER) str += "a";
      } else {
!         ASSERT(FALSE);
  /*
  		if (arights & DFS_READ) str += "r"; else str += "-";
  		if (arights & DFS_WRITE) str += "w"; else printf("-");
***************
*** 454,462 ****
  		if (arights & DFS_DELETE) str += "d"; else printf("-");
  		if (arights & (DFS_USRALL)) str += "+";
  */
! 	}	
  
! 	return str;
  }
  
  char *AclToString(struct Acl *acl)
--- 454,462 ----
  		if (arights & DFS_DELETE) str += "d"; else printf("-");
  		if (arights & (DFS_USRALL)) str += "+";
  */
!     }	
  
!     return str;
  }
  
  char *AclToString(struct Acl *acl)
***************
*** 467,488 ****
      struct AclEntry *tp;
      
      if (acl->dfs)
! 		sprintf(dfsstring, " dfs:%d %s", acl->dfs, acl->cell);
      else
! 		dfsstring[0] = '\0';
      sprintf(mydata, "%d%s\n%d\n", acl->nplus, dfsstring, acl->nminus);
      
! 	for(tp = acl->pluslist; tp; tp = tp->next) {
          sprintf(tstring, "%s %d\n", tp->name, tp->rights);
          strcat(mydata, tstring);
      }
      
! 	for(tp = acl->minuslist; tp; tp = tp->next) {
          sprintf(tstring, "%s %d\n", tp->name, tp->rights);
          strcat(mydata, tstring);
      }
      
! 	return mydata;
  }
  
  struct Acl *EmptyAcl(const CString& strCellName)
--- 467,488 ----
      struct AclEntry *tp;
      
      if (acl->dfs)
!         sprintf(dfsstring, " dfs:%d %s", acl->dfs, acl->cell);
      else
!         dfsstring[0] = '\0';
      sprintf(mydata, "%d%s\n%d\n", acl->nplus, dfsstring, acl->nminus);
      
!     for(tp = acl->pluslist; tp; tp = tp->next) {
          sprintf(tstring, "%s %d\n", tp->name, tp->rights);
          strcat(mydata, tstring);
      }
      
!     for(tp = acl->minuslist; tp; tp = tp->next) {
          sprintf(tstring, "%s %d\n", tp->name, tp->rights);
          strcat(mydata, tstring);
      }
      
!     return mydata;
  }
  
  struct Acl *EmptyAcl(const CString& strCellName)
***************
*** 559,600 ****
      register struct AclEntry *te, **le, *ne;
      int changes;
  
! 	HOURGLASS hourglass;
  
      /* Don't correct DFS ACL's for now */
      if (aa->dfs)
! 		return 0;
  
      /* prune out bad entries */
      changes = 0;	    /* count deleted entries */
      le = &aa->pluslist;
      for(te = aa->pluslist; te; te = ne) {
! 		ne = te->next;
! 		if (BadName(te->name)) {
! 			/* zap this dude */
! 			*le = te->next;
! 			aa->nplus--;
! 			free(te);
! 			changes++;
! 		}
! 		else
! 			le = &te->next;
      }
  
      le = &aa->minuslist;
      
! 	for(te = aa->minuslist; te; te = ne) {
! 		ne = te->next;
! 		if (BadName(te->name)) {
! 			/* zap this dude */
! 			*le = te->next;
! 			aa->nminus--;
! 			free(te);
! 			changes++;
! 		}
! 		else
! 			le = &te->next;
!     }
  
      return changes;
  }
--- 559,600 ----
      register struct AclEntry *te, **le, *ne;
      int changes;
  
!     HOURGLASS hourglass;
  
      /* Don't correct DFS ACL's for now */
      if (aa->dfs)
!         return 0;
  
      /* prune out bad entries */
      changes = 0;	    /* count deleted entries */
      le = &aa->pluslist;
      for(te = aa->pluslist; te; te = ne) {
!         ne = te->next;
!         if (BadName(te->name)) {
!             /* zap this dude */
!             *le = te->next;
!             aa->nplus--;
!             free(te);
!             changes++;
!         }
!         else
!             le = &te->next;
      }
  
      le = &aa->minuslist;
      
!     for(te = aa->minuslist; te; te = ne) {
!         ne = te->next;
!         if (BadName(te->name)) {
!             /* zap this dude */
!             *le = te->next;
!             aa->nminus--;
!             free(te);
!             changes++;
!         }
!         else
!             le = &te->next;
!     }   
  
      return changes;
  }
***************
*** 606,654 ****
      struct ViceIoctl blob;
      int changes;
  
! 	ShowMessageBox(IDS_CLEANACL_MSG, MB_OK, IDS_CLEANACL_MSG);
  
! 	HOURGLASS hourglass;
  
! 	for (int i = 0; i < names.GetSize(); i++) {
! 		blob.out_size = MAXSIZE;
! 		blob.in_size = 0;
! 		blob.out = space;
! 
! 		code = pioctl(PCCHAR(names[i]), VIOCGETAL, &blob, 1);
! 		if (code) {
! 			ShowMessageBox(IDS_CLEANACL_ERROR, MB_ICONEXCLAMATION, 0, names[i], GetAfsError(errno));
! 			continue;
! 		}
! 		
! 		ta = ParseAcl(space);
! 		if (ta->dfs) {
! 			ShowMessageBox(IDS_CLEANACL_NOT_SUPPORTED, MB_ICONEXCLAMATION, IDS_CLEANACL_NOT_SUPPORTED, names[i]);
! 			continue;
! 		}
! 
! 		changes = CleanAcl(ta);
! 		if (!changes)
! 			continue;
! 
! 		/* now set the acl */
! 		blob.in = AclToString(ta);
! 		blob.in_size = strlen((char *)blob.in) + 1;
! 		blob.out_size = 0;
  		
! 		code = pioctl(PCCHAR(names[i]), VIOCSETAL, &blob, 1);
! 		if (code) {
! 			if (errno == EINVAL) {
! 				ShowMessageBox(IDS_CLEANACL_INVALID_ARG, MB_ICONEXCLAMATION, IDS_CLEANACL_INVALID_ARG, names[i]);
! 				continue;
! 			}
! 			else {
! 				ShowMessageBox(IDS_CLEANACL_ERROR, MB_ICONEXCLAMATION, 0, names[i], GetAfsError(errno));
! 				continue;
! 			}
! 		}
! 	}
! }
  
  // Derived from fs.c's ListAclCmd
  BOOL GetRights(const CString& strDir, CStringArray& strNormal, CStringArray& strNegative)
--- 606,654 ----
      struct ViceIoctl blob;
      int changes;
  
!     ShowMessageBox(IDS_CLEANACL_MSG, MB_OK, IDS_CLEANACL_MSG);
  
!     HOURGLASS hourglass;
  
!     for (int i = 0; i < names.GetSize(); i++) {
!         blob.out_size = MAXSIZE;
!         blob.in_size = 0;
!         blob.out = space;
! 
!         code = pioctl(PCCHAR(names[i]), VIOCGETAL, &blob, 1);
!         if (code) {
!             ShowMessageBox(IDS_CLEANACL_ERROR, MB_ICONEXCLAMATION, 0, names[i], GetAfsError(errno));
!             continue;
!         }
! 
!         ta = ParseAcl(space);
!         if (ta->dfs) {
!             ShowMessageBox(IDS_CLEANACL_NOT_SUPPORTED, MB_ICONEXCLAMATION, IDS_CLEANACL_NOT_SUPPORTED, names[i]);
!             continue;
!         }
! 
!         changes = CleanAcl(ta);
!         if (!changes)
!             continue;
! 
!         /* now set the acl */
!         blob.in = AclToString(ta);
!         blob.in_size = strlen((char *)blob.in) + 1;
!         blob.out_size = 0;
  		
!         code = pioctl(PCCHAR(names[i]), VIOCSETAL, &blob, 1);
!         if (code) {
!             if (errno == EINVAL) {
!                 ShowMessageBox(IDS_CLEANACL_INVALID_ARG, MB_ICONEXCLAMATION, IDS_CLEANACL_INVALID_ARG, names[i]);
!                 continue;
!             }
!             else {
!                 ShowMessageBox(IDS_CLEANACL_ERROR, MB_ICONEXCLAMATION, 0, names[i], GetAfsError(errno));
!                 continue;
!             }
!         }
!     }
! }       
  
  // Derived from fs.c's ListAclCmd
  BOOL GetRights(const CString& strDir, CStringArray& strNormal, CStringArray& strNegative)
***************
*** 659,728 ****
      struct AclEntry *te;
      int idf = 0; //getidf(as, parm_listacl_id);
  
! 	HOURGLASS hourglass;
  
! 	blob.out_size = MAXSIZE;
! 	blob.in_size = idf;
! 	blob.in = blob.out = space;
  	
! 	code = pioctl(PCCHAR(strDir), VIOCGETAL, &blob, 1);
! 	if (code) {
! 		ShowMessageBox(IDS_GETRIGHTS_ERROR, MB_ICONEXCLAMATION, IDS_GETRIGHTS_ERROR, strDir, GetAfsError(errno));
! 		return FALSE;
! 	}
! 
! 	ta = ParseAcl(space);
! 	if (ta->dfs) {
! 		ShowMessageBox(IDS_DFSACL_ERROR, MB_ICONEXCLAMATION, IDS_DFSACL_ERROR);
! 		return FALSE;
! 	}
  
  //	if (ta->dfs)
  //		printf("  Default cell = %s\n", ta->cell);
  
! 	CString strRight;
  
! 	if (ta->nplus > 0) {
! 		for (te = ta->pluslist; te; te = te->next) {
! 			strNormal.Add(te->name);
! 			strNormal.Add(GetRightsString(te->rights, ta->dfs));
! 		}
! 	}
! 
! 	if (ta->nminus > 0) {
! 		for (te = ta->minuslist; te; te = te->next) {
! 			strNegative.Add(te->name);
! 			strNegative.Add(GetRightsString(te->rights, ta->dfs));
! 		}
! 	}
  
! 	return TRUE;
  }
  
  struct AclEntry *FindList(register struct AclEntry *pCurEntry, const char *entryName)
  {
      while (pCurEntry) {
          if (!foldcmp(pCurEntry->name, PCCHAR(entryName)))
! 			return pCurEntry;
! 		pCurEntry = pCurEntry->next;
      }
      
! 	return 0;
  }
  
  void ChangeList (struct Acl *pAcl, BYTE bNormalRights, const char *entryName, LONG nEntryRights)
  {
! 	ASSERT(pAcl);
! 	ASSERT(entryName);
      
! 	struct AclEntry *pEntry;
  
! 	HOURGLASS hourglass;
  
      pEntry = (bNormalRights ? pAcl->pluslist : pAcl->minuslist);
      pEntry = FindList(pEntry, entryName);
  
! 	/* Found the item already in the list. */
      if (pEntry) {
          pEntry->rights = nEntryRights;
          if (bNormalRights)
--- 659,728 ----
      struct AclEntry *te;
      int idf = 0; //getidf(as, parm_listacl_id);
  
!     HOURGLASS hourglass;
  
!     blob.out_size = MAXSIZE;
!     blob.in_size = idf;
!     blob.in = blob.out = space;
  	
!     code = pioctl(PCCHAR(strDir), VIOCGETAL, &blob, 1);
!     if (code) {
!         ShowMessageBox(IDS_GETRIGHTS_ERROR, MB_ICONEXCLAMATION, IDS_GETRIGHTS_ERROR, strDir, GetAfsError(errno));
!         return FALSE;
!     }
! 
!     ta = ParseAcl(space);
!     if (ta->dfs) {
!         ShowMessageBox(IDS_DFSACL_ERROR, MB_ICONEXCLAMATION, IDS_DFSACL_ERROR);
!         return FALSE;
!     }
  
  //	if (ta->dfs)
  //		printf("  Default cell = %s\n", ta->cell);
  
!     CString strRight;
  
!     if (ta->nplus > 0) {
!         for (te = ta->pluslist; te; te = te->next) {
!             strNormal.Add(te->name);
!             strNormal.Add(GetRightsString(te->rights, ta->dfs));
!         }
!     }
  
!     if (ta->nminus > 0) {
!         for (te = ta->minuslist; te; te = te->next) {
!             strNegative.Add(te->name);
!             strNegative.Add(GetRightsString(te->rights, ta->dfs));
!         }
!     }
! 
!     return TRUE;
  }
  
  struct AclEntry *FindList(register struct AclEntry *pCurEntry, const char *entryName)
  {
      while (pCurEntry) {
          if (!foldcmp(pCurEntry->name, PCCHAR(entryName)))
!             return pCurEntry;
!         pCurEntry = pCurEntry->next;
      }
      
!     return 0;
  }
  
  void ChangeList (struct Acl *pAcl, BYTE bNormalRights, const char *entryName, LONG nEntryRights)
  {
!     ASSERT(pAcl);
!     ASSERT(entryName);
      
!     struct AclEntry *pEntry;
  
!     HOURGLASS hourglass;
  
      pEntry = (bNormalRights ? pAcl->pluslist : pAcl->minuslist);
      pEntry = FindList(pEntry, entryName);
  
!     /* Found the item already in the list. */
      if (pEntry) {
          pEntry->rights = nEntryRights;
          if (bNormalRights)
***************
*** 736,757 ****
      pEntry = (struct AclEntry *) malloc(sizeof (struct AclEntry));
      ASSERT(pEntry);
  	
! 	strcpy(pEntry->name, entryName);
      pEntry->rights = nEntryRights;
      
! 	if (bNormalRights) {
          pEntry->next = pAcl->pluslist;
          pAcl->pluslist = pEntry;
          pAcl->nplus++;
          if (nEntryRights == 0 || nEntryRights == -1)
! 			pAcl->nplus -= PruneList(&pAcl->pluslist, pAcl->dfs);
      }
      else {
          pEntry->next = pAcl->minuslist;
          pAcl->minuslist = pEntry;
          pAcl->nminus++;
          if (nEntryRights == 0)
! 			pAcl->nminus -= PruneList(&pAcl->minuslist, pAcl->dfs);
      }
  }
  
--- 736,757 ----
      pEntry = (struct AclEntry *) malloc(sizeof (struct AclEntry));
      ASSERT(pEntry);
  	
!     strcpy(pEntry->name, entryName);
      pEntry->rights = nEntryRights;
      
!     if (bNormalRights) {
          pEntry->next = pAcl->pluslist;
          pAcl->pluslist = pEntry;
          pAcl->nplus++;
          if (nEntryRights == 0 || nEntryRights == -1)
!             pAcl->nplus -= PruneList(&pAcl->pluslist, pAcl->dfs);
      }
      else {
          pEntry->next = pAcl->minuslist;
          pAcl->minuslist = pEntry;
          pAcl->nminus++;
          if (nEntryRights == 0)
!             pAcl->nminus -= PruneList(&pAcl->minuslist, pAcl->dfs);
      }
  }
  
***************
*** 765,782 ****
  
      *rtypep = add;	/* add rights, by default */
  
! 	if (!strcmp(arights,"read")) 
! 		return PRSFS_READ | PRSFS_LOOKUP;
! 	if (!strcmp(arights, "write")) 
! 		return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK;
! 	if (!strcmp(arights, "mail")) 
! 		return PRSFS_INSERT | PRSFS_LOCK | PRSFS_LOOKUP;
! 	if (!strcmp(arights, "all")) 
! 		return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK | PRSFS_ADMINISTER;
!     
! 	if (!strcmp(arights, "none")) {
! 		*rtypep = destroy; /* Remove entire entry */
! 		return 0;
      }
  
      len = strlen(arights);
--- 765,782 ----
  
      *rtypep = add;	/* add rights, by default */
  
!     if (!strcmp(arights,"read")) 
!         return PRSFS_READ | PRSFS_LOOKUP;
!     if (!strcmp(arights, "write")) 
!         return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK;
!     if (!strcmp(arights, "mail")) 
!         return PRSFS_INSERT | PRSFS_LOCK | PRSFS_LOOKUP;
!     if (!strcmp(arights, "all")) 
!         return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK | PRSFS_ADMINISTER;
!     
!     if (!strcmp(arights, "none")) {
!         *rtypep = destroy; /* Remove entire entry */
!         return 0;
      }
  
      len = strlen(arights);
***************
*** 784,801 ****
  
      for (i = 0; i < len; i++) {
          tc = *arights++;
! 		if (tc == 'r') mode |= PRSFS_READ;
! 		else if (tc == 'l') mode |= PRSFS_LOOKUP;
! 		else if (tc == 'i') mode |= PRSFS_INSERT;
! 		else if (tc == 'd') mode |= PRSFS_DELETE;
! 		else if (tc == 'w') mode |= PRSFS_WRITE;
! 		else if (tc == 'k') mode |= PRSFS_LOCK;
! 		else if (tc == 'a') mode |= PRSFS_ADMINISTER;
! 		else {
! 			fprintf(stderr, "illegal rights character '%c'.\n", tc);
! 			exit(1);
! 		}
!     }
      return mode;
  }
  
--- 784,801 ----
  
      for (i = 0; i < len; i++) {
          tc = *arights++;
!         if (tc == 'r') mode |= PRSFS_READ;
!         else if (tc == 'l') mode |= PRSFS_LOOKUP;
!         else if (tc == 'i') mode |= PRSFS_INSERT;
!         else if (tc == 'd') mode |= PRSFS_DELETE;
!         else if (tc == 'w') mode |= PRSFS_WRITE;
!         else if (tc == 'k') mode |= PRSFS_LOCK;
!         else if (tc == 'a') mode |= PRSFS_ADMINISTER;
!         else {
!             fprintf(stderr, "illegal rights character '%c'.\n", tc);
!             exit(1);
!         }
!     }   
      return mode;
  }
  
***************
*** 805,843 ****
      struct ViceIoctl blob;
      struct Acl *pAcl;
      LONG rights;
! 	enum rtype rtype;
  
! 	HOURGLASS hourglass;
  
! 	// Create a new ACL
! 	pAcl = EmptyAcl(strCellName);
  
! 	// Set its normal rights
! 	for (int i = 0; i < normal.GetSize(); i += 2) {
! 		rights = Convert(normal[i + 1], 0, &rtype);
! 		ChangeList(pAcl, TRUE, normal[i], rights);
! 	}
! 
! 	// Set its negative rights
! 	for (i = 0; i < negative.GetSize(); i += 2) {
! 		rights = Convert(negative[i + 1], 0, &rtype);
! 		ChangeList(pAcl, FALSE, negative[i], rights);
! 	}
! 
! 	// Write the ACL
! 	blob.in = AclToString(pAcl);
! 	blob.out_size = 0;
! 	blob.in_size = 1 + strlen((const char *)blob.in);
! 	
! 	code = pioctl(PCCHAR(strDir), VIOCSETAL, &blob, 1);
! 	if (code) {
! 		if (errno == EINVAL)
! 			ShowMessageBox(IDS_SAVE_ACL_EINVAL_ERROR, MB_ICONEXCLAMATION, IDS_SAVE_ACL_EINVAL_ERROR, strDir);
! 		else
! 			ShowMessageBox(IDS_SAVE_ACL_ERROR, MB_ICONEXCLAMATION, IDS_SAVE_ACL_ERROR, strDir, GetAfsError(errno, strDir));
! 	}
  
! 	ZapAcl(pAcl);
  
      return (code == 0);
  }
--- 805,843 ----
      struct ViceIoctl blob;
      struct Acl *pAcl;
      LONG rights;
!     enum rtype rtype;
  
!     HOURGLASS hourglass;
  
!     // Create a new ACL
!     pAcl = EmptyAcl(strCellName);
  
!     // Set its normal rights
!     for (int i = 0; i < normal.GetSize(); i += 2) {
!         rights = Convert(normal[i + 1], 0, &rtype);
!         ChangeList(pAcl, TRUE, normal[i], rights);
!     }
! 
!     // Set its negative rights
!     for (i = 0; i < negative.GetSize(); i += 2) {
!         rights = Convert(negative[i + 1], 0, &rtype);
!         ChangeList(pAcl, FALSE, negative[i], rights);
!     }
  
!     // Write the ACL
!     blob.in = AclToString(pAcl);
!     blob.out_size = 0;
!     blob.in_size = 1 + strlen((const char *)blob.in);
! 
!     code = pioctl(PCCHAR(strDir), VIOCSETAL, &blob, 1);
!     if (code) {
!         if (errno == EINVAL)
!             ShowMessageBox(IDS_SAVE_ACL_EINVAL_ERROR, MB_ICONEXCLAMATION, IDS_SAVE_ACL_EINVAL_ERROR, strDir);
!         else
!             ShowMessageBox(IDS_SAVE_ACL_ERROR, MB_ICONEXCLAMATION, IDS_SAVE_ACL_ERROR, strDir, GetAfsError(errno, strDir));
!     }       
! 
!     ZapAcl(pAcl);
  
      return (code == 0);
  }
***************
*** 849,939 ****
      struct Acl *pToAcl;
      int idf = 0; // getidf(as, parm_copyacl_id);
  
! 	HOURGLASS hourglass;
  
! 	// Get ACL to copy to
! 	blob.out_size = MAXSIZE;
! 	blob.in_size = idf;
! 	blob.in = blob.out = space;
! 	
! 	code = pioctl(PCCHAR(strToDir), VIOCGETAL, &blob, 1);
! 	if (code) {
! 		ShowMessageBox(IDS_ACL_READ_ERROR, MB_ICONEXCLAMATION, IDS_ACL_READ_ERROR, strToDir, GetAfsError(errno, strToDir));
! 		return FALSE;
! 	}
! 	
! 	if (bClear) 
! 		pToAcl = EmptyAcl(space);
! 	else 
! 		pToAcl = ParseAcl(space);
! 	
! 	CleanAcl(pToAcl);
  	
! 	if (pToAcl->dfs) {
! 		ShowMessageBox(IDS_NO_DFS_COPY_ACL, MB_ICONEXCLAMATION, IDS_NO_DFS_COPY_ACL, strToDir);
! 		ZapAcl(pToAcl);
! 		return FALSE;
! 	}
! 
! 	enum rtype rtype;
! 
! 	// Set normal rights
! 	for (int i = 0; i < normal.GetSize(); i += 2) {
! 		LONG rights = Convert(normal[i + 1], 0, &rtype);
! 		ChangeList(pToAcl, TRUE, normal[i], rights);
! 	}
! 
! 	// Set negative rights
! 	for (i = 0; i < negative.GetSize(); i += 2) {
! 		LONG rights = Convert(negative[i + 1], 0, &rtype);
! 		ChangeList(pToAcl, FALSE, normal[i], rights);
! 	}
! 
! 	// Save modified ACL
! 	blob.in = AclToString(pToAcl);
! 	blob.out_size = 0;
! 	blob.in_size = 1 + strlen((char *)blob.in);
  	
! 	code = pioctl(PCCHAR(strToDir), VIOCSETAL, &blob, 1);
! 	if (code) {
! 		ZapAcl(pToAcl);
! 		if (errno == EINVAL)
! 			ShowMessageBox(IDS_COPY_ACL_EINVAL_ERROR, MB_ICONEXCLAMATION, IDS_COPY_ACL_EINVAL_ERROR, strToDir);
! 		else 
! 			ShowMessageBox(IDS_COPY_ACL_ERROR, MB_ICONEXCLAMATION, IDS_COPY_ACL_ERROR, strToDir, GetAfsError(errno, strToDir));
! 		return FALSE;
! 	}
  
! 	ZapAcl(pToAcl);
  
! 	ShowMessageBox(IDS_COPY_ACL_OK, MB_OK, IDS_COPY_ACL_OK);
  
      return TRUE;
  }
  
  CString ParseMountPoint(const CString strFile, CString strMountPoint)
  {
! 	CString strType;
! 	CString strVolume;
! 	CString strCell;
! 	CString strMountPointInfo;
! 
! 	if (strMountPoint[0] == '#')
! 		strType = "Regular";
! 	else if (strMountPoint[0] == '%')
! 		strType = "Read/Write";
! 
! 	int nColon = strMountPoint.Find(':');
! 	if (nColon >= 0) {
! 		strCell = strMountPoint.Mid(1, nColon - 1);
! 		strVolume = strMountPoint.Mid(nColon + 1);
! 	} else
! 		strVolume = strMountPoint.Mid(1);
  
! 	strMountPointInfo = strFile + "\t" + strVolume + "\t" + strCell + "\t" + strType;
  
! 	return strMountPointInfo;
! }
  
  BOOL ListMount(CStringArray& files)
  {
--- 849,939 ----
      struct Acl *pToAcl;
      int idf = 0; // getidf(as, parm_copyacl_id);
  
!     HOURGLASS hourglass;
  
!     // Get ACL to copy to
!     blob.out_size = MAXSIZE;
!     blob.in_size = idf;
!     blob.in = blob.out = space;
  	
!     code = pioctl(PCCHAR(strToDir), VIOCGETAL, &blob, 1);
!     if (code) {
!         ShowMessageBox(IDS_ACL_READ_ERROR, MB_ICONEXCLAMATION, IDS_ACL_READ_ERROR, strToDir, GetAfsError(errno, strToDir));
!         return FALSE;
!     }
  	
!     if (bClear) 
!         pToAcl = EmptyAcl(space);
!     else 
!         pToAcl = ParseAcl(space);
! 
!     CleanAcl(pToAcl);
! 
!     if (pToAcl->dfs) {
!         ShowMessageBox(IDS_NO_DFS_COPY_ACL, MB_ICONEXCLAMATION, IDS_NO_DFS_COPY_ACL, strToDir);
!         ZapAcl(pToAcl);
!         return FALSE;
!     }
! 
!     enum rtype rtype;
! 
!     // Set normal rights
!     for (int i = 0; i < normal.GetSize(); i += 2) {
!         LONG rights = Convert(normal[i + 1], 0, &rtype);
!         ChangeList(pToAcl, TRUE, normal[i], rights);
!     }
! 
!     // Set negative rights
!     for (i = 0; i < negative.GetSize(); i += 2) {
!         LONG rights = Convert(negative[i + 1], 0, &rtype);
!         ChangeList(pToAcl, FALSE, normal[i], rights);
!     }
! 
!     // Save modified ACL
!     blob.in = AclToString(pToAcl);
!     blob.out_size = 0;
!     blob.in_size = 1 + strlen((char *)blob.in);
! 
!     code = pioctl(PCCHAR(strToDir), VIOCSETAL, &blob, 1);
!     if (code) {
!         ZapAcl(pToAcl);
!         if (errno == EINVAL)
!             ShowMessageBox(IDS_COPY_ACL_EINVAL_ERROR, MB_ICONEXCLAMATION, IDS_COPY_ACL_EINVAL_ERROR, strToDir);
!         else 
!             ShowMessageBox(IDS_COPY_ACL_ERROR, MB_ICONEXCLAMATION, IDS_COPY_ACL_ERROR, strToDir, GetAfsError(errno, strToDir));
!         return FALSE;
!     }
  
!     ZapAcl(pToAcl);
  
!     ShowMessageBox(IDS_COPY_ACL_OK, MB_OK, IDS_COPY_ACL_OK);
  
      return TRUE;
  }
  
  CString ParseMountPoint(const CString strFile, CString strMountPoint)
  {
!     CString strType;
!     CString strVolume;
!     CString strCell;
!     CString strMountPointInfo;
! 
!     if (strMountPoint[0] == '#')
!         strType = "Regular";
!     else if (strMountPoint[0] == '%')
!         strType = "Read/Write";
! 
!     int nColon = strMountPoint.Find(':');
!     if (nColon >= 0) {
!         strCell = strMountPoint.Mid(1, nColon - 1);
!         strVolume = strMountPoint.Mid(nColon + 1);
!     } else
!         strVolume = strMountPoint.Mid(1);
  
!     strMountPointInfo = strFile + "\t" + strVolume + "\t" + strCell + "\t" + strType;
  
!     return strMountPointInfo;
! }       
  
  BOOL ListMount(CStringArray& files)
  {
***************
*** 944,1009 ****
      char true_name[1024];			/* ``True'' dirname (e.g., symlink target) */
      char parent_dir[1024];			/* Parent directory of true name */
      register char *last_component;	/* Last component of true name */
! 	CStringArray mountPoints;
      
! 	HOURGLASS hourglass;
  
      error = 0;
  
      for (int i = 0; i < files.GetSize(); i++) {
! 		strcpy(orig_name, files[i]);
! 		strcpy(true_name, orig_name);
  
! 		/*
! 		 * 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.
! 			 */
! 			strncpy(parent_dir, true_name, last_component - true_name + 1);
! 			parent_dir[last_component - true_name + 1] = 0;
! 			last_component++;   /* Skip the slash */
! 		}
! 		else {
! 			/*
! 			 * No slash appears in the given file name.  Set parent_dir to the current
! 			 * directory, and the last component as the given name.
! 			 */
! 			fs_ExtractDriveLetter(true_name, parent_dir);
! 			strcat(parent_dir, ".");
! 			last_component = true_name;
! 			fs_StripDriveLetter(true_name, true_name, sizeof(true_name));
! 		}
! 
! 		blob.in = last_component;
! 		blob.in_size = strlen(last_component) + 1;
! 		blob.out_size = MAXSIZE;
! 		blob.out = space;
! 		memset(space, 0, MAXSIZE);
! 
! 		code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, &blob, 1);
! 		if (code == 0) {
! 			int nPos = strlen(space) - 1;
! 			if (space[nPos] == '.')
! 				space[nPos] = 0;
! 			mountPoints.Add(ParseMountPoint(StripPath(files[i]), space));
! 		} else {
! 			error = 1;
! 			if (errno == EINVAL)
! 				mountPoints.Add(GetMessageString(IDS_NOT_MOUNT_POINT_ERROR, StripPath(files[i])));
! 			else
! 				mountPoints.Add(GetMessageString(IDS_LIST_MOUNT_POINT_ERROR, GetAfsError(errno, StripPath(files[i]))));
! 		}
! 	}
! 
! 	CMountPointsDlg dlg;
! 	dlg.SetMountPoints(mountPoints);
! 	dlg.DoModal();
  
! 	return !error;
  }
  
  BOOL IsPathInAfs(const CHAR *strPath)
--- 944,1009 ----
      char true_name[1024];			/* ``True'' dirname (e.g., symlink target) */
      char parent_dir[1024];			/* Parent directory of true name */
      register char *last_component;	/* Last component of true name */
!     CStringArray mountPoints;
      
!     HOURGLASS hourglass;
  
      error = 0;
  
      for (int i = 0; i < files.GetSize(); i++) {
!         strcpy(orig_name, files[i]);
!         strcpy(true_name, orig_name);
  
!         /*
!          * 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.
!              */
!             strncpy(parent_dir, true_name, last_component - true_name + 1);
!             parent_dir[last_component - true_name + 1] = 0;
!             last_component++;   /* Skip the slash */
!         }
!         else {
!             /*
!              * No slash appears in the given file name.  Set parent_dir to the current
!              * directory, and the last component as the given name.
!              */
!             fs_ExtractDriveLetter(true_name, parent_dir);
!             strcat(parent_dir, ".");
!             last_component = true_name;
!             fs_StripDriveLetter(true_name, true_name, sizeof(true_name));
!         }
  
!         blob.in = last_component;
!         blob.in_size = strlen(last_component) + 1;
!         blob.out_size = MAXSIZE;
!         blob.out = space;
!         memset(space, 0, MAXSIZE);
! 
!         code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, &blob, 1);
!         if (code == 0) {
!             int nPos = strlen(space) - 1;
!             if (space[nPos] == '.')
!                 space[nPos] = 0;
!             mountPoints.Add(ParseMountPoint(StripPath(files[i]), space));
!         } else {
!             error = 1;
!             if (errno == EINVAL)
!                 mountPoints.Add(GetMessageString(IDS_NOT_MOUNT_POINT_ERROR, StripPath(files[i])));
!             else
!                 mountPoints.Add(GetMessageString(IDS_LIST_MOUNT_POINT_ERROR, GetAfsError(errno, StripPath(files[i]))));
!         }
!     }
! 
!     CMountPointsDlg dlg;
!     dlg.SetMountPoints(mountPoints);
!     dlg.DoModal();
! 
!     return !error;
  }
  
  BOOL IsPathInAfs(const CHAR *strPath)
***************
*** 1031,1044 ****
      strcpy(tspace, apath);
      tp = strrchr(tspace, '\\');
      if (tp) {
! 		*(tp+1) = 0;	/* lv trailing slash so Parent("k:\foo") is "k:\" not "k:" */
      }
      else {
! 		fs_ExtractDriveLetter(apath, tspace);
      	strcat(tspace, ".");
      }
      
! 	return tspace;
  }
  
  BOOL MakeMount(const CString& strDir, const CString& strVolName, const CString& strCellName, BOOL bRW)
--- 1031,1044 ----
      strcpy(tspace, apath);
      tp = strrchr(tspace, '\\');
      if (tp) {
!         *(tp+1) = 0;	/* lv trailing slash so Parent("k:\foo") is "k:\" not "k:" */
      }
      else {
!         fs_ExtractDriveLetter(apath, tspace);
      	strcat(tspace, ".");
      }
      
!     return tspace;
  }
  
  BOOL MakeMount(const CString& strDir, const CString& strVolName, const CString& strCellName, BOOL bRW)
***************
*** 1048,1096 ****
      char localCellName[1000];
      struct ViceIoctl blob;
  
! 	HOURGLASS hourglass;
  
! 	ASSERT(strVolName.GetLength() < 64);
  
! /*
  
! defect #3069
  
      if (as->parms[5].items && !as->parms[2].items) {
  	fprintf(stderr,"fs: must provide cell when creating cellular mount point.\n");
  	return FALSE;
      }
! */
  
      if (strCellName.GetLength() > 0)	/* cell name specified */
! 		cellName = PCCHAR(strCellName);
      else
! 		cellName = (char *) 0;
  
      if (!IsPathInAfs(Parent(PCCHAR(strDir)))) {
! 		ShowMessageBox(IDS_MAKE_MP_NOT_AFS_ERROR, MB_ICONEXCLAMATION, IDS_MAKE_MP_NOT_AFS_ERROR);
! 		return FALSE;
      }
  
      if (cellName) {
! 		blob.in_size = 0;
! 		blob.out_size = MAXSIZE;
! 		blob.out = space;
! 		code = pioctl(Parent(PCCHAR(strDir)), VIOC_FILE_CELL_NAME, &blob, 1);
!     }
  
      strcpy(localCellName, (cellName? cellName : space));
  
      if (bRW)	/* if -rw specified */
! 		strcpy(space, "%");
      else
! 		strcpy(space, "#");
  
      /* If cellular mount point, prepend cell prefix */
! 	if (cellName) {
! 		strcat(space, localCellName);
! 		strcat(space, ":");
!     }
  
      strcat(space, strVolName);	/* append volume name */
      strcat(space, ".");		/* stupid convention; these end with a period */
--- 1048,1096 ----
      char localCellName[1000];
      struct ViceIoctl blob;
  
!     HOURGLASS hourglass;
  
!     ASSERT(strVolName.GetLength() < 64);
  
!     /*
  
!     defect #3069
  
      if (as->parms[5].items && !as->parms[2].items) {
  	fprintf(stderr,"fs: must provide cell when creating cellular mount point.\n");
  	return FALSE;
      }
!     */
  
      if (strCellName.GetLength() > 0)	/* cell name specified */
!         cellName = PCCHAR(strCellName);
      else
!         cellName = (char *) 0;
  
      if (!IsPathInAfs(Parent(PCCHAR(strDir)))) {
!         ShowMessageBox(IDS_MAKE_MP_NOT_AFS_ERROR, MB_ICONEXCLAMATION, IDS_MAKE_MP_NOT_AFS_ERROR);
!         return FALSE;
      }
  
      if (cellName) {
!         blob.in_size = 0;
!         blob.out_size = MAXSIZE;
!         blob.out = space;
!         code = pioctl(Parent(PCCHAR(strDir)), VIOC_FILE_CELL_NAME, &blob, 1);
!     }   
  
      strcpy(localCellName, (cellName? cellName : space));
  
      if (bRW)	/* if -rw specified */
!         strcpy(space, "%");
      else
!         strcpy(space, "#");
  
      /* If cellular mount point, prepend cell prefix */
!     if (cellName) {
!         strcat(space, localCellName);
!         strcat(space, ":");
!     }   
  
      strcat(space, strVolName);	/* append volume name */
      strcat(space, ".");		/* stupid convention; these end with a period */
***************
*** 1105,1229 ****
      code = pioctl(PCCHAR(strDir), VIOC_AFS_CREATE_MT_PT, &blob, 0);
  
      if (code) {
! 		ShowMessageBox(IDS_MOUNT_POINT_ERROR, MB_ICONEXCLAMATION, IDS_MOUNT_POINT_ERROR, GetAfsError(errno, strDir));
! 		return FALSE;
      }
      
! 	return TRUE;
  }
  
  /*
  */
  long fs_ExtractDriveLetter(const char *inPathp, char *outPathp)
  {
! 	if (inPathp[0] != 0 && inPathp[1] == ':') {
! 		/* there is a drive letter */
!                 *outPathp++ = *inPathp++;
!                 *outPathp++ = *inPathp++;
!                 *outPathp++ = 0;
!         }
! 	else *outPathp = 0;
  
!         return 0;
! }
  
  /* strip the drive letter from a component */
  long fs_StripDriveLetter(const char *inPathp, char *outPathp, long outSize)
  {
! 	char tempBuffer[1000];
!         strcpy(tempBuffer, inPathp);
!         if (tempBuffer[0] != 0 && tempBuffer[1] == ':') {
! 		/* drive letter present */
!                 strcpy(outPathp, tempBuffer+2);
!         }
!         else {
!         	/* no drive letter present */
!         	strcpy(outPathp, tempBuffer);
! 	}
!         return 0;
! }
  
  
  BOOL RemoveSymlink(const char * linkName)
  {
! 	BOOL error = FALSE;
      INT code=0;
      struct ViceIoctl blob;
      char tbuffer[1024];
      char lsbuffer[1024];
! 	char tpbuffer[1024];
      char *tp;
      
! 	HOURGLASS hourglass;
  
! 	tp = (char *) strrchr(linkName, '\\');
! 	if (!tp)
! 	    tp = (char *) strrchr(linkName, '/');
! 	if (tp) {
! 	    strncpy(tbuffer, linkName, code=tp-linkName+1);  /* the dir name */
!             tbuffer[code] = 0;
! 	    tp++;   /* skip the slash */
! 	}
! 	else {
! 	    fs_ExtractDriveLetter(linkName, tbuffer);
! 	    strcat(tbuffer, ".");
!          fs_StripDriveLetter(tp, tpbuffer, 0);
! 		 tp=tpbuffer;
! 	}
! 	blob.in = tp;
! 	blob.in_size = strlen(tp)+1;
! 	blob.out = lsbuffer;
! 	blob.out_size = sizeof(lsbuffer);
! 	code = pioctl(tbuffer, VIOC_LISTSYMLINK, &blob, 0);
! 	if (code)
! 		return FALSE;
! 	blob.out_size = 0;
! 	blob.in = tp;
! 	blob.in_size = strlen(tp)+1;
! 	return (pioctl(tbuffer, VIOC_DELSYMLINK, &blob, 0)==0);
! }
  
  BOOL IsSymlink(const char * true_name)
  {
      char parent_dir[MAXSIZE];		/*Parent directory of true name*/
! 	char strip_name[MAXSIZE];
      struct ViceIoctl blob;
! 	char *last_component;
      int code;
  
      HOURGLASS hourglass;
  
! 	last_component = (char *) strrchr(true_name, '\\');
! 	if (!last_component)
! 	    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.
! 	     */
! 	    strncpy(parent_dir, true_name, last_component - true_name + 1);
! 	    parent_dir[last_component - true_name + 1] = 0;
! 	    last_component++;   /*Skip the slash*/
! 	}
! 	else {
! 	    /*
! 	     * No slash appears in the given file name.  Set parent_dir to the current
! 	     * directory, and the last component as the given name.
! 	     */
! 	    fs_ExtractDriveLetter(true_name, parent_dir);
! 	    strcat(parent_dir, ".");
! 	    last_component = strip_name;
          fs_StripDriveLetter(true_name, strip_name, sizeof(strip_name));
! 	}
  
! 	blob.in = last_component;
! 	blob.in_size = strlen(last_component)+1;
! 	blob.out_size = MAXSIZE;
! 	blob.out = space;
! 	memset(space, 0, MAXSIZE);
! 	code = pioctl(parent_dir, VIOC_LISTSYMLINK, &blob, 1);
! 	return (code==0);
! }
  
  
  /*
--- 1105,1262 ----
      code = pioctl(PCCHAR(strDir), VIOC_AFS_CREATE_MT_PT, &blob, 0);
  
      if (code) {
!         ShowMessageBox(IDS_MOUNT_POINT_ERROR, MB_ICONEXCLAMATION, IDS_MOUNT_POINT_ERROR, GetAfsError(errno, strDir));
!         return FALSE;
      }
      
!     return TRUE;
  }
  
  /*
  */
  long fs_ExtractDriveLetter(const char *inPathp, char *outPathp)
  {
!     if (inPathp[0] != 0 && inPathp[1] == ':') {
!         /* there is a drive letter */
!         *outPathp++ = *inPathp++;
!         *outPathp++ = *inPathp++;
!         *outPathp++ = 0;
!     }
!     else *outPathp = 0;
  
!     return 0;
! }       
  
  /* strip the drive letter from a component */
  long fs_StripDriveLetter(const char *inPathp, char *outPathp, long outSize)
  {
!     char tempBuffer[1000];
!     strcpy(tempBuffer, inPathp);
!     if (tempBuffer[0] != 0 && tempBuffer[1] == ':') {
!         /* drive letter present */
!         strcpy(outPathp, tempBuffer+2);
!     }
!     else {
!         /* no drive letter present */
!         strcpy(outPathp, tempBuffer);
!     }
!     return 0;
! }       
  
  
  BOOL RemoveSymlink(const char * linkName)
  {
!     BOOL error = FALSE;
      INT code=0;
      struct ViceIoctl blob;
      char tbuffer[1024];
      char lsbuffer[1024];
!     char tpbuffer[1024];
      char *tp;
      
!     HOURGLASS hourglass;
  
!     tp = (char *) strrchr(linkName, '\\');
!     if (!tp)
!         tp = (char *) strrchr(linkName, '/');
!     if (tp) {
!         strncpy(tbuffer, linkName, code=tp-linkName+1);  /* the dir name */
!         tbuffer[code] = 0;
!         tp++;   /* skip the slash */
!     }
!     else {
!         fs_ExtractDriveLetter(linkName, tbuffer);
!         strcat(tbuffer, ".");
!         fs_StripDriveLetter(tp, tpbuffer, 0);
!         tp=tpbuffer;
!     }
!     blob.in = tp;
!     blob.in_size = strlen(tp)+1;
!     blob.out = lsbuffer;
!     blob.out_size = sizeof(lsbuffer);
!     code = pioctl(tbuffer, VIOC_LISTSYMLINK, &blob, 0);
!     if (code)
!         return FALSE;
!     blob.out_size = 0;
!     blob.in = tp;
!     blob.in_size = strlen(tp)+1;
!     return (pioctl(tbuffer, VIOC_DELSYMLINK, &blob, 0)==0);
! }       
  
  BOOL IsSymlink(const char * true_name)
  {
      char parent_dir[MAXSIZE];		/*Parent directory of true name*/
!     char strip_name[MAXSIZE];
      struct ViceIoctl blob;
!     char *last_component;
      int code;
  
      HOURGLASS hourglass;
  
!     last_component = (char *) strrchr(true_name, '\\');
!     if (!last_component)
!         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.
!          */
!         strncpy(parent_dir, true_name, last_component - true_name + 1);
!         parent_dir[last_component - true_name + 1] = 0;
!         last_component++;   /*Skip the slash*/
!     }
!     else {
!         /*
!          * No slash appears in the given file name.  Set parent_dir to the current
!          * directory, and the last component as the given name.
!          */
!         fs_ExtractDriveLetter(true_name, parent_dir);
!         strcat(parent_dir, ".");
!         last_component = strip_name;
          fs_StripDriveLetter(true_name, strip_name, sizeof(strip_name));
!     }
  
!     blob.in = last_component;
!     blob.in_size = strlen(last_component)+1;
!     blob.out_size = MAXSIZE;
!     blob.out = space;
!     memset(space, 0, MAXSIZE);
!     code = pioctl(parent_dir, VIOC_LISTSYMLINK, &blob, 1);
!     return (code==0);
! }       
! 
! 
! BOOL IsMountPoint(const char * name)
! {
!     register LONG code = 0;
!     struct ViceIoctl blob;
!     char tbuffer[1024];
!     char lsbuffer[1024];
!     register char *tp;
!     char szCurItem[1024];
!     strcpy(szCurItem, name);
! 	
!     tp = (char *)strrchr(szCurItem, '\\');
!     if (tp) {
!         strncpy(tbuffer, szCurItem, code = tp - szCurItem + 1);  /* the dir name */
!         tbuffer[code] = 0;
!         tp++;   /* skip the slash */
!     } else {
!         fs_ExtractDriveLetter(szCurItem, tbuffer);
!         strcat(tbuffer, ".");
!         tp = szCurItem;
!         fs_StripDriveLetter(tp, tp, 0);
!     }
! 
!     blob.in = tp;
!     blob.in_size = strlen(tp)+1;
!     blob.out = lsbuffer;
!     blob.out_size = sizeof(lsbuffer);
! 
!     code = pioctl(tbuffer, VIOC_AFS_STAT_MT_PT, &blob, 0);
! 
!     return (code==0);
! }       
  
  
  /*
***************
*** 1239,1299 ****
      char tbuffer[1024];
      char lsbuffer[1024];
      register char *tp;
! 	BOOL error = FALSE;
! 	CStringArray results;
! 	CString str;
! 	CString str2;
  
! 	HOURGLASS hourglass;
  
      for (int i = 0; i < files.GetSize(); i++) {
! 		char szCurItem[1024];
! 		strcpy(szCurItem, files[i]);
! 	
! 		tp = (char *)strrchr(szCurItem, '\\');
! 		if (tp) {
! 			strncpy(tbuffer, szCurItem, code = tp - szCurItem + 1);  /* the dir name */
! 			tbuffer[code] = 0;
! 			tp++;   /* skip the slash */
! 		} else {
! 			fs_ExtractDriveLetter(szCurItem, tbuffer);
! 			strcat(tbuffer, ".");
! 			tp = szCurItem;
! 			fs_StripDriveLetter(tp, tp, 0);
! 		}
! 
! 		blob.in = tp;
! 		blob.in_size = strlen(tp)+1;
! 		blob.out = lsbuffer;
! 		blob.out_size = sizeof(lsbuffer);
! 
! 		code = pioctl(tbuffer, VIOC_AFS_STAT_MT_PT, &blob, 0);
! 		if (code) {
! 			error = TRUE;
! 			if (errno == EINVAL)
! 				results.Add(GetMessageString(IDS_NOT_MOUNT_POINT_ERROR, StripPath(files[i])));
! 			else
! 				results.Add(GetMessageString(IDS_ERROR, GetAfsError(errno, StripPath(files[i]))));
! 			continue;	// don't bother trying
! 		}
! 		
! 		blob.out_size = 0;
! 		blob.in = tp;
! 		blob.in_size = strlen(tp)+1;
! 		
! 		code = pioctl(tbuffer, VIOC_AFS_DELETE_MT_PT, &blob, 0);
! 		if (code) {
! 			error = TRUE;
! 			results.Add(GetMessageString(IDS_ERROR, GetAfsError(errno, StripPath(files[i]))));
! 		} else
! 			results.Add(GetMessageString(IDS_DELETED));
!     }
  
! 	LoadString (str, IDS_REMOVE_MP);
! 	LoadString (str2, IDS_REMOVE_MP_COLUMN);
! 	CResultsDlg dlg(REMOVE_MOUNT_POINTS_HELP_ID);
! 	dlg.SetContents(str, str2, StripPath(files), results);
! 	dlg.DoModal();
  
      return !error;
  }
--- 1272,1311 ----
      char tbuffer[1024];
      char lsbuffer[1024];
      register char *tp;
!     BOOL error = FALSE;
!     CStringArray results;
!     CString str;
!     CString str2;
  
!     HOURGLASS hourglass;
  
      for (int i = 0; i < files.GetSize(); i++) {
!         if (!IsMountPoint(files[i])) {
!             error = TRUE;
!             if (errno == EINVAL)
!                 results.Add(GetMessageString(IDS_NOT_MOUNT_POINT_ERROR, StripPath(files[i])));
!             else
!                 results.Add(GetMessageString(IDS_ERROR, GetAfsError(errno, StripPath(files[i]))));
!             continue;	// don't bother trying
!         }
  
!         blob.out_size = 0;
!         blob.in = tp;
!         blob.in_size = strlen(tp)+1;
! 
!         code = pioctl(tbuffer, VIOC_AFS_DELETE_MT_PT, &blob, 0);
!         if (code) {
!             error = TRUE;
!             results.Add(GetMessageString(IDS_ERROR, GetAfsError(errno, StripPath(files[i]))));
!         } else
!             results.Add(GetMessageString(IDS_DELETED));
!     }   
! 
!     LoadString (str, IDS_REMOVE_MP);
!     LoadString (str2, IDS_REMOVE_MP_COLUMN);
!     CResultsDlg dlg(REMOVE_MOUNT_POINTS_HELP_ID);
!     dlg.SetContents(str, str2, StripPath(files), results);
!     dlg.DoModal();
  
      return !error;
  }
***************
*** 1305,1316 ****
      struct VolumeStatus *status;
      char *name;
  
! 	HOURGLASS hourglass;
  
! 	volInfo.m_strFilePath = strFile;
      volInfo.m_strFileName = StripPath(strFile);
  
! /*
  	volInfo.m_strName = "VolumeName";
  	volInfo.m_nID = 10;
  	volInfo.m_nQuota = 20 * 1024 * 1024;
--- 1317,1328 ----
      struct VolumeStatus *status;
      char *name;
  
!     HOURGLASS hourglass;
  
!     volInfo.m_strFilePath = strFile;
      volInfo.m_strFileName = StripPath(strFile);
  
!     /*
  	volInfo.m_strName = "VolumeName";
  	volInfo.m_nID = 10;
  	volInfo.m_nQuota = 20 * 1024 * 1024;
***************
*** 1320,1348 ****
  	volInfo.m_nPartFree = 30 * 1024 * 1024;
  	volInfo.m_nDup = -1;
  	return TRUE;
! */
  
! 	blob.out_size = MAXSIZE;
! 	blob.in_size = 0;
! 	blob.out = space;
! 
! 	code = pioctl(PCCHAR(strFile), VIOCGETVOLSTAT, &blob, 1);
! 	if (code) {
! 		volInfo.m_strErrorMsg = GetAfsError(errno, strFile);
! 		return FALSE;
! 	}
! 
! 	status = (VolumeStatus *)space;
! 	name = (char *)status + sizeof(*status);
! 
! 	volInfo.m_strName = name;
! 	volInfo.m_nID = status->Vid;
! 	volInfo.m_nQuota = status->MaxQuota;
! 	volInfo.m_nNewQuota = status->MaxQuota;
! 	volInfo.m_nUsed = status->BlocksInUse;
! 	volInfo.m_nPartSize = status->PartMaxBlocks;
! 	volInfo.m_nPartFree = status->PartBlocksAvail;
! 	volInfo.m_nDup = -1;
  
      return TRUE;
  }
--- 1332,1360 ----
  	volInfo.m_nPartFree = 30 * 1024 * 1024;
  	volInfo.m_nDup = -1;
  	return TRUE;
!      */
  
!     blob.out_size = MAXSIZE;
!     blob.in_size = 0;
!     blob.out = space;
! 
!     code = pioctl(PCCHAR(strFile), VIOCGETVOLSTAT, &blob, 1);
!     if (code) {
!         volInfo.m_strErrorMsg = GetAfsError(errno, strFile);
!         return FALSE;
!     }
! 
!     status = (VolumeStatus *)space;
!     name = (char *)status + sizeof(*status);
! 
!     volInfo.m_strName = name;
!     volInfo.m_nID = status->Vid;
!     volInfo.m_nQuota = status->MaxQuota;
!     volInfo.m_nNewQuota = status->MaxQuota;
!     volInfo.m_nUsed = status->BlocksInUse;
!     volInfo.m_nPartSize = status->PartMaxBlocks;
!     volInfo.m_nPartFree = status->PartBlocksAvail;
!     volInfo.m_nDup = -1;
  
      return TRUE;
  }
***************
*** 1354,1402 ****
      struct VolumeStatus *status;
      char *input;
  
! 	HOURGLASS hourglass;
  
! 	blob.out_size = MAXSIZE;
! 	blob.in_size = sizeof(*status) + 3;	/* for the three terminating nulls */
! 	blob.out = space;
! 	blob.in = space;
! 	
! 	status = (VolumeStatus *)space;
! 	status->MinQuota = -1;
! 	status->MaxQuota = volInfo.m_nNewQuota;
  	
! 	input = (char *)status + sizeof(*status);
! 	*(input++) = '\0';	/* never set name: this call doesn't change vldb */
! 	*(input++) = '\0';	// No offmsg
! 	*(input++) = '\0';	// No motd
  
  #ifdef LOGGING_ON
!    	FILE *fp = OpenFile(szLogFileName, "a");
! 	if (fp) {
! 		fprintf(fp, "\nSetVolInfo() pioctl parms:\n");
! 		fprintf(fp, "\tpathp = %s\n\topcode = VIOCSETVOLSTAT (%d)\n\tblobp = %ld\n", PCCHAR(volInfo.m_strFilePath), VIOCSETVOLSTAT, &blob);
! 		fprintf(fp, "\t\tblobp.in = %ld (VolumeStatus *status)\n\t\tblobp.in_size = %ld\n\t\tblobp.out = %ld ((VolumeStatus *status))\n\t\tblobp.out_size = %ld\n", blob.in, blob.in_size, blob.out, blob.out_size);
! 		fprintf(fp, "\t\t\tstatus->MinQuota = %ld\n", status->MinQuota);
! 		fprintf(fp, "\t\t\tstatus->MaxQuota = %ld\n", status->MaxQuota);
! 		fprintf(fp, "\t\t\tOther status fields aren't set\n");
! 		fprintf(fp, "\t\t\t3 nulls follow the VolumeStatus structure.\n");
! 		fprintf(fp, "\tfollow = 1\n");
! 		fclose(fp);		
! 	}
  #endif
  
! 	code = pioctl(PCCHAR(volInfo.m_strFilePath), VIOCSETVOLSTAT, &blob, 1);
! 	if (code) {
! 		ShowMessageBox(IDS_SET_QUOTA_ERROR, MB_ICONEXCLAMATION, IDS_SET_QUOTA_ERROR, GetAfsError(errno, volInfo.m_strName));
! 		return FALSE;
! 	}
  
      return TRUE;
  }
  
  int GetCellName(char *cellNamep, struct afsconf_cell *infop)
  {
! 	strcpy(infop->name, cellNamep);
      return 0;
  }
  
--- 1366,1414 ----
      struct VolumeStatus *status;
      char *input;
  
!     HOURGLASS hourglass;
  
!     blob.out_size = MAXSIZE;
!     blob.in_size = sizeof(*status) + 3;	/* for the three terminating nulls */
!     blob.out = space;
!     blob.in = space;
! 
!     status = (VolumeStatus *)space;
!     status->MinQuota = -1;
!     status->MaxQuota = volInfo.m_nNewQuota;
  	
!     input = (char *)status + sizeof(*status);
!     *(input++) = '\0';	/* never set name: this call doesn't change vldb */
!     *(input++) = '\0';	// No offmsg
!     *(input++) = '\0';	// No motd
  
  #ifdef LOGGING_ON
!     FILE *fp = OpenFile(szLogFileName, "a");
!     if (fp) {
!         fprintf(fp, "\nSetVolInfo() pioctl parms:\n");
!         fprintf(fp, "\tpathp = %s\n\topcode = VIOCSETVOLSTAT (%d)\n\tblobp = %ld\n", PCCHAR(volInfo.m_strFilePath), VIOCSETVOLSTAT, &blob);
!         fprintf(fp, "\t\tblobp.in = %ld (VolumeStatus *status)\n\t\tblobp.in_size = %ld\n\t\tblobp.out = %ld ((VolumeStatus *status))\n\t\tblobp.out_size = %ld\n", blob.in, blob.in_size, blob.out, blob.out_size);
!         fprintf(fp, "\t\t\tstatus->MinQuota = %ld\n", status->MinQuota);
!         fprintf(fp, "\t\t\tstatus->MaxQuota = %ld\n", status->MaxQuota);
!         fprintf(fp, "\t\t\tOther status fields aren't set\n");
!         fprintf(fp, "\t\t\t3 nulls follow the VolumeStatus structure.\n");
!         fprintf(fp, "\tfollow = 1\n");
!         fclose(fp);		
!     }
  #endif
  
!     code = pioctl(PCCHAR(volInfo.m_strFilePath), VIOCSETVOLSTAT, &blob, 1);
!     if (code) {
!         ShowMessageBox(IDS_SET_QUOTA_ERROR, MB_ICONEXCLAMATION, IDS_SET_QUOTA_ERROR, GetAfsError(errno, volInfo.m_strName));
!         return FALSE;
!     }
  
      return TRUE;
  }
  
  int GetCellName(char *cellNamep, struct afsconf_cell *infop)
  {
!     strcpy(infop->name, cellNamep);
      return 0;
  }
  
***************
*** 1409,1415 ****
      struct afsconf_cell info;
      struct chservinfo checkserv;
  
! 	HOURGLASS hourglass;
  
      memset(&checkserv, 0, sizeof(struct chservinfo));
      blob.in_size = sizeof(struct chservinfo);
--- 1421,1427 ----
      struct afsconf_cell info;
      struct chservinfo checkserv;
  
!     HOURGLASS hourglass;
  
      memset(&checkserv, 0, sizeof(struct chservinfo));
      blob.in_size = sizeof(struct chservinfo);
***************
*** 1420,1646 ****
      memset(space, 0, sizeof(LONG));	/* so we assure zero when nothing is copied back */
  
      /* prepare flags for checkservers command */
! 	if (nCellsToCheck == LOCAL_CELL)
! 		temp = 2;	/* default to checking local cell only */
      else if (nCellsToCheck == ALL_CELLS)
! 		temp &= ~2;	/* turn off local cell check */
  
! 	if (bFast)
! 		temp |= 1;	/* set fast flag */
      
      checkserv.magic = 0x12345678;	/* XXX */
      checkserv.tflags = temp;
  
      /* now copy in optional cell name, if specified */
      if (nCellsToCheck == SPECIFIC_CELL) {
! 		GetCellName(PCCHAR(strCellName), &info);
! 		strcpy(checkserv.tbuffer,info.name);
! 		checkserv.tsize = strlen(info.name) + 1;
      } else {
! 		strcpy(checkserv.tbuffer, "\0");
! 		checkserv.tsize = 0;
! 	}
  
! 	checkserv.tinterval = -1;	/* don't change current interval */
  
      code = pioctl(0, VIOCCKSERV, &blob, 1);
      if (code) {
! 		ShowMessageBox(IDS_CHECK_SERVERS_ERROR, MB_ICONEXCLAMATION, IDS_CHECK_SERVERS_ERROR, GetAfsError(errno, CString()));
! 		return FALSE;
      }
  
      memcpy(&temp, space, sizeof(LONG));
  
! 	if (temp == 0) {
! 		ShowMessageBox(IDS_ALL_SERVERS_RUNNING, MB_OK, IDS_ALL_SERVERS_RUNNING);
! 		return TRUE;
! 	}
! 
! 	CStringArray servers;
! 	for (j = 0; j < MAXHOSTS; j++) {
! 		memcpy(&temp, space + j * sizeof(LONG), sizeof(LONG));
! 		if (temp == 0)
! 			break;
! 		
! 		char *name = hostutil_GetNameByINet(temp);
! 		servers.Add(name);
! 	}
! 
! 	CDownServersDlg dlg;
! 	dlg.SetServerNames(servers);
! 	dlg.DoModal();
  
      return TRUE;
! }
  
  BOOL GetTokenInfo(CStringArray& tokenInfo)
  {
! 	int cellNum;
! 	int rc;
! 	time_t current_time;
! 	time_t tokenExpireTime;
! 	char *expireString;
! 	char userName[100];
  //	char s[100];
! 	struct ktc_principal serviceName, clientName;
! 	struct ktc_token token;
! 	
! 	CString strTokenInfo;
! 	CString strUserName;
! 	CString strCellName;
! 	CString strExpir;
  
! //	tokenInfo.Add("");
  //	return TRUE;
  
  
! 	HOURGLASS hourglass;
  
  //	printf("\nTokens held by the Cache Manager:\n\n");
! 	cellNum = 0;
! 	current_time = time(0);
  
! 	while (1) {
! 		rc = ktc_ListTokens(cellNum, &cellNum, &serviceName);
! 		if (rc == KTC_NOENT) {
! 			/* end of list */
! //			printf("   --End of list --\n");
! 			break;
! 		}
! 		else if (rc == KTC_NOCM) {
! 			ShowMessageBox(IDS_GET_TOKENS_NO_AFS_SERVICE);
! //			printf("AFS service may not have started\n");
! 			break;
! 		}
! 		else if (rc) {
! 			ShowMessageBox(IDS_GET_TOKENS_UNEXPECTED_ERROR, MB_ICONEXCLAMATION, IDS_GET_TOKENS_UNEXPECTED_ERROR, rc);
! 			return FALSE;
! //			printf("Unexpected error, code %d\n", rc);
! //			exit(1);
! 		}
! 		else {
! 			rc = ktc_GetToken(&serviceName, &token, sizeof(token), &clientName);
! 			if (rc) {
! 				ShowMessageBox(IDS_GET_TOKENS_UNEXPECTED_ERROR2, MB_ICONEXCLAMATION, IDS_GET_TOKENS_UNEXPECTED_ERROR2, 
! 					serviceName.name, serviceName.instance,	serviceName.cell, rc);
! 				continue;
! 			}
! 
! 			tokenExpireTime = token.endTime;
! 			
! 			strcpy(userName, clientName.name);
! 			if (clientName.instance[0] != 0) {
! 				strcat(userName, ".");
! 				strcat(userName, clientName.instance);
! 			}
  
! 			BOOL bShowName = FALSE;
  
! 			if (userName[0] == '\0')
! 				; //printf("Tokens");
  // AFS ID is not returned at this time.
! //			else if (strncmp(userName, "AFS ID", 6) == 0)
! //				printf("User's (%s) tokens", userName);
! //				sscanf(userName, "(AFS ID %s)", szAfsID);
! 			else if (strncmp(userName, "Unix UID", 8) == 0)
! 				; //printf("Tokens");
! 			else
! 				strUserName = userName;
! //				printf("User %s's tokens", userName);
  			
! //			printf(" for %s%s%s@%s ", serviceName.name, serviceName.instance[0] ? "." : "",	serviceName.instance, serviceName.cell);
! 			strCellName = serviceName.cell;
  			
! 			if (tokenExpireTime <= current_time)
! 				strExpir = "[>> Expired <<]";
! //				printf("[>> Expired <<]\n");
! 			else {
! 				expireString = ctime(&tokenExpireTime);
! 				expireString += 4;	 /* Skip day of week */
! 				expireString[12] = '\0'; /* Omit secs & year */
! //				printf("[Expires %s]\n", expireString);
! 				strExpir.Format("%s", expireString);
! 			}
! 		
! 			strTokenInfo = strUserName + "\t" + strCellName + "\t" + strExpir + "\t" + strCellName;
! 			tokenInfo.Add(strTokenInfo);
! 		}
! 	}
  
  //	printf("Press <Enter> or <Return> when finished: ");
  //	gets(s);
! 	return TRUE;
  }
  
  UINT MakeSymbolicLink(const char *strName ,const char *strDir)
  {
      struct ViceIoctl blob;
! 	char space[MAXSIZE];
! 	UINT code;
  
      HOURGLASS hourglass;
  
      /*lets confirm its a good symlink*/
! 	if (!IsPathInAfs(strDir))
! 		return 1;
! 	LPTSTR lpsz = new TCHAR[strlen(strDir)+1];
! 	_tcscpy(lpsz, strName);
      strcpy(space, strDir);
      blob.out_size = 0;
      blob.in_size = 1 + strlen(space);
      blob.in = space;
      blob.out = NULL;
      if ((code=pioctl(lpsz, VIOC_SYMLINK, &blob, 0))!=0)
! 		return code;
! 	return 0;
  }
  
  void ListSymbolicLinkPath(const char *strName,char *strPath,UINT nlenPath)
  {
! 	ASSERT(nlenPath<MAX_PATH);
      struct ViceIoctl blob;
      char orig_name[MAX_PATH+1];		/*Original name, may be modified*/
      char true_name[MAX_PATH+1];		/*``True'' dirname (e.g., symlink target)*/
      char parent_dir[MAX_PATH+1];		/*Parent directory of true name*/
      char *last_component;	/*Last component of true name*/
! 	UINT code;    
  
! 	HOURGLASS hourglass;
  
      strcpy(orig_name, strName);
! 	strcpy(true_name, orig_name);
  	/*
  	 * Find rightmost slash, if any.
  	 */
! 	last_component = (char *) strrchr(true_name, '\\');
! 	if (!last_component)
! 	    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.
  	     */
! 	    strncpy(parent_dir, true_name, last_component - true_name + 1);
! 	    parent_dir[last_component - true_name + 1] = 0;
! 	    last_component++;   /*Skip the slash*/
! 	}
! 	else {
! 	    /*
! 	     * No slash appears in the given file name.  Set parent_dir to the current
! 	     * directory, and the last component as the given name.
! 	     */
! 	    fs_ExtractDriveLetter(true_name, parent_dir);
! 	    strcat(parent_dir, ".");
! 	    last_component = true_name;
!             fs_StripDriveLetter(true_name, true_name, sizeof(true_name));
! 	}
! 	blob.in = last_component;
! 	blob.in_size = strlen(last_component)+1;
! 	blob.out_size = MAXSIZE;
! 	blob.out = space;
! 	memset(space, 0, MAXSIZE);
! 	if ((code = pioctl(parent_dir, VIOC_LISTSYMLINK, &blob, 1)))
! 		strcpy(space,"???");
! 	ASSERT(strlen(space)<MAX_PATH);
! 	strncpy(strPath,space,nlenPath);
! }
--- 1432,1658 ----
      memset(space, 0, sizeof(LONG));	/* so we assure zero when nothing is copied back */
  
      /* prepare flags for checkservers command */
!     if (nCellsToCheck == LOCAL_CELL)
!         temp = 2;	/* default to checking local cell only */
      else if (nCellsToCheck == ALL_CELLS)
!         temp &= ~2;	/* turn off local cell check */
  
!     if (bFast)
!         temp |= 1;	/* set fast flag */
      
      checkserv.magic = 0x12345678;	/* XXX */
      checkserv.tflags = temp;
  
      /* now copy in optional cell name, if specified */
      if (nCellsToCheck == SPECIFIC_CELL) {
!         GetCellName(PCCHAR(strCellName), &info);
!         strcpy(checkserv.tbuffer,info.name);
!         checkserv.tsize = strlen(info.name) + 1;
      } else {
!         strcpy(checkserv.tbuffer, "\0");
!         checkserv.tsize = 0;
!     }
  
!     checkserv.tinterval = -1;	/* don't change current interval */
  
      code = pioctl(0, VIOCCKSERV, &blob, 1);
      if (code) {
!         ShowMessageBox(IDS_CHECK_SERVERS_ERROR, MB_ICONEXCLAMATION, IDS_CHECK_SERVERS_ERROR, GetAfsError(errno, CString()));
!         return FALSE;
      }
  
      memcpy(&temp, space, sizeof(LONG));
  
!     if (temp == 0) {
!         ShowMessageBox(IDS_ALL_SERVERS_RUNNING, MB_OK, IDS_ALL_SERVERS_RUNNING);
!         return TRUE;
!     }
! 
!     CStringArray servers;
!     for (j = 0; j < MAXHOSTS; j++) {
!         memcpy(&temp, space + j * sizeof(LONG), sizeof(LONG));
!         if (temp == 0)
!             break;
! 
!         char *name = hostutil_GetNameByINet(temp);
!         servers.Add(name);
!     }
! 
!     CDownServersDlg dlg;
!     dlg.SetServerNames(servers);
!     dlg.DoModal();
  
      return TRUE;
! }       
  
  BOOL GetTokenInfo(CStringArray& tokenInfo)
  {
!     int cellNum;
!     int rc;
!     time_t current_time;
!     time_t tokenExpireTime;
!     char *expireString;
!     char userName[100];
  //	char s[100];
!     struct ktc_principal serviceName, clientName;
!     struct ktc_token token;
  
!     CString strTokenInfo;
!     CString strUserName;
!     CString strCellName;
!     CString strExpir;
! 
! //      tokenInfo.Add("");
  //	return TRUE;
  
  
!     HOURGLASS hourglass;
  
  //	printf("\nTokens held by the Cache Manager:\n\n");
!     cellNum = 0;
!     current_time = time(0);
  
!     while (1) {
!         rc = ktc_ListTokens(cellNum, &cellNum, &serviceName);
!         if (rc == KTC_NOENT) {
!             /* end of list */
! //	    printf("   --End of list --\n");
!             break;
!         }
!         else if (rc == KTC_NOCM) {
!             ShowMessageBox(IDS_GET_TOKENS_NO_AFS_SERVICE);
! //	    printf("AFS service may not have started\n");
!             break;
!         }
!         else if (rc) {
!             ShowMessageBox(IDS_GET_TOKENS_UNEXPECTED_ERROR, MB_ICONEXCLAMATION, IDS_GET_TOKENS_UNEXPECTED_ERROR, rc);
!             return FALSE;
! //	    printf("Unexpected error, code %d\n", rc);
! //	    exit(1);
!         }
!         else {
!             rc = ktc_GetToken(&serviceName, &token, sizeof(token), &clientName);
!             if (rc) {
!                 ShowMessageBox(IDS_GET_TOKENS_UNEXPECTED_ERROR2, MB_ICONEXCLAMATION, IDS_GET_TOKENS_UNEXPECTED_ERROR2, 
!                                 serviceName.name, serviceName.instance,	serviceName.cell, rc);
!                 continue;
!             }
! 
!             tokenExpireTime = token.endTime;
! 
!             strcpy(userName, clientName.name);
!             if (clientName.instance[0] != 0) {
!                 strcat(userName, ".");
!                 strcat(userName, clientName.instance);
!             }
  
!             BOOL bShowName = FALSE;
  
!             if (userName[0] == '\0')
!                 ; //printf("Tokens");
  // AFS ID is not returned at this time.
! //	    else if (strncmp(userName, "AFS ID", 6) == 0)
! //	    	printf("User's (%s) tokens", userName);
! //	    	sscanf(userName, "(AFS ID %s)", szAfsID);
! 	    else if (strncmp(userName, "Unix UID", 8) == 0)
!                 ; //printf("Tokens");
!             else
!                 strUserName = userName;
! //		printf("User %s's tokens", userName);
  			
! //		printf(" for %s%s%s@%s ", serviceName.name, serviceName.instance[0] ? "." : "",	serviceName.instance, serviceName.cell);
!             strCellName = serviceName.cell;
  			
!             if (tokenExpireTime <= current_time)
!                 strExpir = "[>> Expired <<]";
! //		printf("[>> Expired <<]\n");
!             else {
!                 expireString = ctime(&tokenExpireTime);
!                 expireString += 4;	 /* Skip day of week */
!                 expireString[12] = '\0'; /* Omit secs & year */
! //		printf("[Expires %s]\n", expireString);
!                 strExpir.Format("%s", expireString);
!             }
! 
!             strTokenInfo = strUserName + "\t" + strCellName + "\t" + strExpir + "\t" + strCellName;
!             tokenInfo.Add(strTokenInfo);
!         }
!     }
  
  //	printf("Press <Enter> or <Return> when finished: ");
  //	gets(s);
!     return TRUE;
  }
  
  UINT MakeSymbolicLink(const char *strName ,const char *strDir)
  {
      struct ViceIoctl blob;
!     char space[MAXSIZE];
!     UINT code;
  
      HOURGLASS hourglass;
  
      /*lets confirm its a good symlink*/
!     if (!IsPathInAfs(strDir))
!         return 1;
!     LPTSTR lpsz = new TCHAR[strlen(strDir)+1];
!     _tcscpy(lpsz, strName);
      strcpy(space, strDir);
      blob.out_size = 0;
      blob.in_size = 1 + strlen(space);
      blob.in = space;
      blob.out = NULL;
      if ((code=pioctl(lpsz, VIOC_SYMLINK, &blob, 0))!=0)
!         return code;
!     return 0;
  }
  
  void ListSymbolicLinkPath(const char *strName,char *strPath,UINT nlenPath)
  {
!     ASSERT(nlenPath<MAX_PATH);
      struct ViceIoctl blob;
      char orig_name[MAX_PATH+1];		/*Original name, may be modified*/
      char true_name[MAX_PATH+1];		/*``True'' dirname (e.g., symlink target)*/
      char parent_dir[MAX_PATH+1];		/*Parent directory of true name*/
      char *last_component;	/*Last component of true name*/
!     UINT code;    
  
!     HOURGLASS hourglass;
  
      strcpy(orig_name, strName);
!     strcpy(true_name, orig_name);
  	/*
  	 * Find rightmost slash, if any.
  	 */
!     last_component = (char *) strrchr(true_name, '\\');
!     if (!last_component)
!         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.
  	     */
!         strncpy(parent_dir, true_name, last_component - true_name + 1);
!         parent_dir[last_component - true_name + 1] = 0;
!         last_component++;   /*Skip the slash*/
!     }
!     else {
!         /*
!          * No slash appears in the given file name.  Set parent_dir to the current
!          * directory, and the last component as the given name.
!          */
!         fs_ExtractDriveLetter(true_name, parent_dir);
!         strcat(parent_dir, ".");
!         last_component = true_name;
!         fs_StripDriveLetter(true_name, true_name, sizeof(true_name));
!     }
!     blob.in = last_component;
!     blob.in_size = strlen(last_component)+1;
!     blob.out_size = MAXSIZE;
!     blob.out = space;
!     memset(space, 0, MAXSIZE);
!     if ((code = pioctl(parent_dir, VIOC_LISTSYMLINK, &blob, 1)))
!         strcpy(space,"???");
!     ASSERT(strlen(space)<MAX_PATH);
!     strncpy(strPath,space,nlenPath);
! }       
Index: openafs/src/WINNT/client_exp/gui2fs.h
diff -c openafs/src/WINNT/client_exp/gui2fs.h:1.5 openafs/src/WINNT/client_exp/gui2fs.h:1.5.2.1
*** openafs/src/WINNT/client_exp/gui2fs.h:1.5	Fri Nov 21 02:59:58 2003
--- openafs/src/WINNT/client_exp/gui2fs.h	Wed Apr 20 22:20:05 2005
***************
*** 39,44 ****
--- 39,45 ----
  long fs_StripDriveLetter(const char *inPathp, char *outPathp, long outSize);
  long fs_ExtractDriveLetter(const char *inPathp, char *outPathp);
  BOOL IsSymlink(const char * true_name);
+ BOOL IsMountPoint(const char * name);
  UINT MakeSymbolicLink(const char *,const char *);
  void ListSymbolicLinkPath(const char *strName,char *strPath,UINT nlenPath);
  #endif //__GUI2FS_H__
Index: openafs/src/WINNT/client_exp/shell_ext.cpp
diff -c openafs/src/WINNT/client_exp/shell_ext.cpp:1.9.2.1 openafs/src/WINNT/client_exp/shell_ext.cpp:1.9.2.2
*** openafs/src/WINNT/client_exp/shell_ext.cpp:1.9.2.1	Fri Mar 11 02:00:26 2005
--- openafs/src/WINNT/client_exp/shell_ext.cpp	Wed Apr 20 22:20:05 2005
***************
*** 224,232 ****
  	// Mount Point submenu of the AFS submenu
  	HMENU hMountPointMenu = CreatePopupMenu();
  	int indexMountPointMenu = 0;
! 	::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_SHOW, GetMessageString(IDS_MP_SHOW_ITEM));
! 	::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_REMOVE, GetMessageString(IDS_MP_REMOVE_ITEM));
! 	::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_MAKE, GetMessageString(IDS_MP_MAKE_ITEM));
  	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hMountPointMenu, GetMessageString(IDS_MOUNT_POINT_ITEM));
  
  	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_FLUSH, GetMessageString(IDS_FLUSH_FILE_DIR_ITEM));	
--- 224,239 ----
  	// Mount Point submenu of the AFS submenu
  	HMENU hMountPointMenu = CreatePopupMenu();
  	int indexMountPointMenu = 0;
!         int nMountPointSelected = MF_GRAYED;
!         for (int n = pThis->m_astrFileNames.GetSize() - 1 ; n >= 0; n--) {
!             if ( IsMountPoint(pThis->m_astrFileNames[n]) ) {
!                 nMountPointSelected = MF_ENABLED;
!                 break;
!             }
!         }
!         ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_SHOW, GetMessageString(IDS_MP_SHOW_ITEM));
! 	::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION | nMountPointSelected, idCmdFirst + IDM_MOUNTPOINT_REMOVE, GetMessageString(IDS_MP_REMOVE_ITEM));
!         ::InsertMenu(hMountPointMenu, indexMountPointMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_MOUNTPOINT_MAKE, GetMessageString(IDS_MP_MAKE_ITEM));
  	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION | MF_POPUP, (UINT)hMountPointMenu, GetMessageString(IDS_MOUNT_POINT_ITEM));
  
  	::InsertMenu(hAfsMenu, indexAfsMenu++, MF_STRING | MF_BYPOSITION, idCmdFirst + IDM_FLUSH, GetMessageString(IDS_FLUSH_FILE_DIR_ITEM));	
Index: openafs/src/WINNT/install/NSIS/OpenAFS.nsi
diff -c openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.69.2.7 openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.69.2.8
*** openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.69.2.7	Fri Mar 11 02:02:43 2005
--- openafs/src/WINNT/install/NSIS/OpenAFS.nsi	Thu Apr 28 08:05:33 2005
***************
*** 722,727 ****
--- 722,728 ----
    WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Asynchronous" 0
    WriteRegDWORD HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Impersonate"  1
    WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "DLLName" "afslogon.dll"
+   WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Logon" "AFS_Logon_Event"
    WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Logoff" "AFS_Logoff_Event"
    WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" "Startup" "AFS_Startup_Event"
  
Index: openafs/src/WINNT/install/wix/feature.wxi
diff -c openafs/src/WINNT/install/wix/feature.wxi:1.5.2.4 openafs/src/WINNT/install/wix/feature.wxi:1.5.2.5
*** openafs/src/WINNT/install/wix/feature.wxi:1.5.2.4	Fri Mar 11 02:02:49 2005
--- openafs/src/WINNT/install/wix/feature.wxi	Thu Apr 28 08:05:45 2005
***************
*** 4,9 ****
--- 4,10 ----
              Description="$(loc.StrAFSProdDesc)" Display="expand" InstallDefault="local" Level="30"
              Title="OpenAFS">
             <ComponentRef Id="efl_desktop_INI" />
+            <ComponentRef Id="efl_replace_afs_CMD" />
              <Feature Id="feaClient" AllowAdvertise="no" Description="$(loc.StrAFSClientLongDesc)" Display="expand"
                  InstallDefault="followParent" Level="30" Title="$(loc.StrAFSClientDesc)">
                  
Index: openafs/src/WINNT/install/wix/files.wxi
diff -c openafs/src/WINNT/install/wix/files.wxi:1.9.2.4 openafs/src/WINNT/install/wix/files.wxi:1.9.2.5
*** openafs/src/WINNT/install/wix/files.wxi:1.9.2.4	Fri Mar 11 02:02:49 2005
--- openafs/src/WINNT/install/wix/files.wxi	Thu Apr 28 08:05:45 2005
***************
*** 9,15 ****
              <Registry Id="reg_afslogon04" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Impersonate" Type="integer" Value="1" />
              <Registry Id="reg_afslogon05" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="DLLName" Type="string" Value="[#fileafslogon_DLL]" />
              <Registry Id="reg_afslogon06" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Logoff" Type="string" Value="AFS_Logoff_Event" />
!             <Registry Id="reg_afslogon07" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Startup" Type="string" Value="AFS_Startup_Event" />
          </Component>
      <?ifdef DebugSyms?>
          <Component Id="cmp_ClientSystemDebug" Guid="DD34DA09-D9DA-4A5A-9521-87B7738A7D53">
--- 9,16 ----
              <Registry Id="reg_afslogon04" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Impersonate" Type="integer" Value="1" />
              <Registry Id="reg_afslogon05" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="DLLName" Type="string" Value="[#fileafslogon_DLL]" />
              <Registry Id="reg_afslogon06" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Logoff" Type="string" Value="AFS_Logoff_Event" />
!             <Registry Id="reg_afslogon07" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Logon" Type="string" Value="AFS_Logon_Event" />
!             <Registry Id="reg_afslogon08" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Startup" Type="string" Value="AFS_Startup_Event" />
          </Component>
      <?ifdef DebugSyms?>
          <Component Id="cmp_ClientSystemDebug" Guid="DD34DA09-D9DA-4A5A-9521-87B7738A7D53">
***************
*** 22,27 ****
--- 23,31 ----
  	    <Component Id="efl_desktop_INI" Guid="0ADB427F-3648-4BE0-983B-C454AA51895C">
  		<File Id="fildesktop_INI" Name="desktop.ini" KeyPath="yes" DiskId="1" src="$(var.SrcDir)WINNT\install\wix\afsdesktop.ini" Hidden="yes" System="yes" />
  	    </Component>
+             <Component Id="efl_replace_afs_CMD" Guid="C9C93F3E-EEBA-4056-9669-5EF78D748D50">
+                <File Id="filreplace_afs_CMD" Name="replafs.cmd" LongName="replace_afs.cmd" KeyPath="yes" DiskId="1" src="$(var.SrcDir)\WINNT\install\wix\replace_afs.cmd" />
+             </Component>
              <Directory Id="dirCommon" Name="Common">
                  <Component Id="cmp_CommonDir" Guid="C86B03A1-AE97-48B1-A77B-1B2395F1E117" KeyPath="yes">
                      <Environment Id="envCommon" Name="PATH" Action="create" System="yes" Permanent="no" Part="last" Separator=";" Value="[AFSDIR]Common" />
Index: openafs/src/WINNT/install/wix/replace_afs.cmd
diff -c /dev/null openafs/src/WINNT/install/wix/replace_afs.cmd:1.1.2.2
*** /dev/null	Thu Apr 28 22:55:46 2005
--- openafs/src/WINNT/install/wix/replace_afs.cmd	Thu Apr 28 08:05:45 2005
***************
*** 0 ****
--- 1,59 ----
+ @echo off
+ 
+ if "%1"=="" goto show_usage
+ 
+ rem Instead of running the script from the current location
+ rem we copy ourselves over to the TMP directory and run
+ rem from there.
+ 
+ if not "%2"=="intemp" goto copy_and_run
+ 
+ rem Do the actual work
+ 
+ setlocal
+ echo This will replace the current installation of OpenAFS with
+ echo the upgraded version at :
+ echo   "%~f1"
+ set /p response=Continue? (y/n):
+ if "%response%"=="y" goto do_this
+ if "%response%"=="Y" goto do_this
+ endlocal
+ 
+ echo Cancelling.  No changes were made to your computer.
+ 
+ goto end_script
+ 
+ :do_this
+ endlocal
+ 
+ echo Running MSIEXEC:
+ echo on
+ 
+ msiexec /fvomus "%~f1"
+ 
+ @echo off
+ echo Done.
+ 
+ goto end_script
+ 
+ :copy_and_run
+ 
+ copy "%~f0" "%TMP%\tmp_replace_afs.cmd"
+ "%TMP%\tmp_replace_afs.cmd" "%~f1" intemp
+ 
+ goto end_script
+ 
+ :show_usage
+ echo %0: Upgrade an existing installation of OpenAFS
+ echo.
+ echo This command replaces the existing installation with a new
+ echo installation.  You need to obtain the new .MSI from openafs.org
+ echo and run this command as follows :
+ echo.
+ echo   %0 [path to new .msi]
+ echo.
+ echo The latest release can be found at the following URL:
+ echo      http://www.openafs.org/release/latest.html
+ echo.
+ 
+ :end_script
Index: openafs/src/WINNT/pthread/pthread.c
diff -c openafs/src/WINNT/pthread/pthread.c:1.6.2.5 openafs/src/WINNT/pthread/pthread.c:1.6.2.7
*** openafs/src/WINNT/pthread/pthread.c:1.6.2.5	Fri Mar 11 02:02:56 2005
--- openafs/src/WINNT/pthread/pthread.c	Tue Apr 19 01:13:01 2005
***************
*** 1043,1050 ****
      void *rc = NULL;
      char **tsd = TlsGetValue(tsd_index);
  
! 	if (tsd == NULL)
! 		return NULL;
  
      if ((key > -1) && (key < PTHREAD_KEYS_MAX )) {
  	rc = (void *) *(tsd + key);
--- 1043,1050 ----
      void *rc = NULL;
      char **tsd = TlsGetValue(tsd_index);
  
!     if (tsd == NULL)
!         return NULL;
  
      if ((key > -1) && (key < PTHREAD_KEYS_MAX )) {
  	rc = (void *) *(tsd + key);
***************
*** 1114,1119 ****
--- 1114,1122 ----
      int rc = 0;
      char **tsd;
  
+     /* make sure all thread-local storage has been allocated */
+     pthread_self();
+ 
      if (p_tsd_done || (!pthread_once(&pthread_tsd_once, pthread_tsd_init))) {
  	if ((key > -1) && (key < PTHREAD_KEYS_MAX )) {
  	    if (!pthread_mutex_lock(&pthread_tsd_mutex)) {
Index: openafs/src/afs/afs_cell.c
diff -c openafs/src/afs/afs_cell.c:1.30 openafs/src/afs/afs_cell.c:1.30.2.1
*** openafs/src/afs/afs_cell.c:1.30	Sat May  8 00:22:19 2004
--- openafs/src/afs/afs_cell.c	Wed Apr  6 01:09:09 2005
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cell.c,v 1.30 2004/05/08 04:22:19 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cell.c,v 1.30.2.1 2005/04/06 05:09:09 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 819,824 ****
--- 819,825 ----
  {
      RWLOCK_INIT(&afs_xcell, "afs_xcell");
  #ifdef AFS_AFSDB_ENV
+     RWLOCK_INIT(&afsdb_client_lock, "afsdb_client_lock");
      RWLOCK_INIT(&afsdb_req.lock, "afsdb_req.lock");
  #endif
      QInit(&CellLRU);
Index: openafs/src/afs/afs_osi.h
diff -c openafs/src/afs/afs_osi.h:1.22.2.4 openafs/src/afs/afs_osi.h:1.22.2.8
*** openafs/src/afs/afs_osi.h:1.22.2.4	Mon Apr  4 00:01:14 2005
--- openafs/src/afs/afs_osi.h	Sun Apr 24 19:40:40 2005
***************
*** 48,59 ****
--- 48,63 ----
  
  struct osi_file {
      afs_int32 size;		/* file size in bytes XXX Must be first field XXX */
+ #ifdef AFS_LINUX24_ENV
+     struct file *filp;		/* May need this if we really open the file. */
+ #else
  #ifdef AFS_LINUX22_ENV
      struct dentry dentry;	/* merely to hold the pointer to the inode. */
      struct file file;		/* May need this if we really open the file. */
  #else
      struct vnode *vnode;
  #endif
+ #endif
  #if	defined(AFS_HPUX102_ENV)
      k_off_t offset;
  #else
***************
*** 119,125 ****
  /*
   * Vnode related macros
   */
! #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  #define vSetVfsp(vc, vfsp)      AFSTOV(vc)->v_mount = (vfsp)
  #define vSetType(vc, type)      AFSTOV(vc)->v_type = (type)
  #define vType(vc)               AFSTOV(vc)->v_type
--- 123,129 ----
  /*
   * Vnode related macros
   */
! #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
  #define vSetVfsp(vc, vfsp)      AFSTOV(vc)->v_mount = (vfsp)
  #define vSetType(vc, type)      AFSTOV(vc)->v_type = (type)
  #define vType(vc)               AFSTOV(vc)->v_type
***************
*** 129,144 ****
  #define	vSetVfsp(vc,vfsp)   (vc)->v.v_vfsp = (vfsp)
  #endif
  
! #ifndef AFS_OBSD_ENV
! #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
  extern int (**afs_vnodeop_p) ();
! #define IsAfsVnode(vc)      ((vc)->v_op == afs_vnodeop_p)
! #define SetAfsVnode(vc)     (vc)->v_op = afs_vnodeop_p
  #else
  extern struct vnodeops *afs_ops;
! #define	IsAfsVnode(vc)	    ((vc)->v_op == afs_ops)
! #define	SetAfsVnode(vc)	    (vc)->v_op = afs_ops
! #endif
  #endif
  
  #ifdef AFS_SGI65_ENV
--- 133,146 ----
  #define	vSetVfsp(vc,vfsp)   (vc)->v.v_vfsp = (vfsp)
  #endif
  
! #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
  extern int (**afs_vnodeop_p) ();
! #define IsAfsVnode(v)      ((v)->v_op == afs_vnodeop_p)
! #define SetAfsVnode(v)     /* nothing; done in getnewvnode() */
  #else
  extern struct vnodeops *afs_ops;
! #define	IsAfsVnode(v)	    ((v)->v_op == afs_ops)
! #define	SetAfsVnode(v)	    (v)->v_op = afs_ops
  #endif
  
  #ifdef AFS_SGI65_ENV
***************
*** 146,156 ****
               lookupname((fnamep),(segflg),(followlink),NULL,(compvpp),\
  			NULL)
  #else
- #ifndef AFS_OBSD_ENV
  #define	gop_lookupname(fnamep,segflg,followlink,compvpp) \
               lookupname((fnamep),(segflg),(followlink),NULL,(compvpp))
  #endif
- #endif
  
  /*
   * In IRIX 6.5 we cannot have DEBUG turned on since certain
--- 148,156 ----
***************
*** 208,215 ****
  #ifdef AFS_GLOBAL_SUNLOCK
  #define AFS_ASSERT_GLOCK() \
      (ISAFS_GLOCK() || (osi_Panic("afs global lock not held at %s:%d\n", __FILE__, __LINE__), 0))
- #define AFS_ASSERT_RXGLOCK() \
-     (ISAFS_RXGLOCK() || (osi_Panic("rx global lock not held at %s:%d\n", __FILE__, __LINE__), 0))
  #endif /* AFS_GLOBAL_SUNLOCK */
  
  #ifdef RX_ENABLE_LOCKS
--- 208,213 ----
***************
*** 227,236 ****
  #define AFS_GUNLOCK()
  #define ISAFS_GLOCK() 1
  #define AFS_ASSERT_GLOCK()
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
- #define AFS_ASSERT_RXGLOCK()
  #endif
  
  /* On an MP that uses multithreading, splnet is not sufficient to provide
--- 225,230 ----
Index: openafs/src/afs/afs_pioctl.c
diff -c openafs/src/afs/afs_pioctl.c:1.81.2.12 openafs/src/afs/afs_pioctl.c:1.81.2.13
*** openafs/src/afs/afs_pioctl.c:1.81.2.12	Mon Apr  4 00:01:14 2005
--- openafs/src/afs/afs_pioctl.c	Sun Apr 24 16:12:39 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.81.2.12 2005/04/04 04:01:14 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.13 2005/04/24 20:12:39 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #ifdef AFS_OBSD_ENV
***************
*** 195,201 ****
  #define PSetClientContext 99	/*  Special pioctl to setup caller's creds  */
  int afs_nobody = NFS_NOBODY;
  
! #if (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV))
  static void
  afs_ioctl32_to_afs_ioctl(const struct afs_ioctl32 *src, struct afs_ioctl *dst)
  {
--- 195,201 ----
  #define PSetClientContext 99	/*  Special pioctl to setup caller's creds  */
  int afs_nobody = NFS_NOBODY;
  
! #if (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64)) || defined(NEED_IOCTL32)
  static void
  afs_ioctl32_to_afs_ioctl(const struct afs_ioctl32 *src, struct afs_ioctl *dst)
  {
***************
*** 603,610 ****
  		AFS_GLOCK();
  		datap =
  		    (struct afs_ioctl *)osi_AllocSmallSpace(AFS_SMALLOCSIZ);
! 		AFS_COPYIN((char *)uap->arg, (caddr_t) datap,
! 			   sizeof(struct afs_ioctl), code);
  		if (code) {
  		    osi_FreeSmallSpace(datap);
  		    AFS_GUNLOCK();
--- 603,609 ----
  		AFS_GLOCK();
  		datap =
  		    (struct afs_ioctl *)osi_AllocSmallSpace(AFS_SMALLOCSIZ);
! 		code=copyin_afs_ioctl((char *)uap->arg, datap);
  		if (code) {
  		    osi_FreeSmallSpace(datap);
  		    AFS_GUNLOCK();
Index: openafs/src/afs/afs_prototypes.h
diff -c openafs/src/afs/afs_prototypes.h:1.53.2.6 openafs/src/afs/afs_prototypes.h:1.53.2.7
*** openafs/src/afs/afs_prototypes.h:1.53.2.6	Sun Apr  3 14:18:54 2005
--- openafs/src/afs/afs_prototypes.h	Sun Apr 24 16:11:14 2005
***************
*** 540,548 ****
  extern int osi_lookupname(char *aname, uio_seg_t seg, int followlink,
  			  struct dentry **dpp);
  extern int osi_InitCacheInfo(char *aname);
! extern int osi_rdwr(int rw, struct osi_file *file, caddr_t addrp,
! 		    size_t asize, size_t * resid);
! extern int osi_file_uio_rdwr(struct osi_file *osifile, uio_t * uiop, int rw);
  extern void setup_uio(uio_t * uiop, struct iovec *iovecp, const char *buf,
  		      afs_offs_t pos, int count, uio_flag_t flag,
  		      uio_seg_t seg);
--- 540,546 ----
  extern int osi_lookupname(char *aname, uio_seg_t seg, int followlink,
  			  struct dentry **dpp);
  extern int osi_InitCacheInfo(char *aname);
! extern int osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw);
  extern void setup_uio(uio_t * uiop, struct iovec *iovecp, const char *buf,
  		      afs_offs_t pos, int count, uio_flag_t flag,
  		      uio_seg_t seg);
Index: openafs/src/afs/afs_vcache.c
diff -c openafs/src/afs/afs_vcache.c:1.65.2.15 openafs/src/afs/afs_vcache.c:1.65.2.18
*** openafs/src/afs/afs_vcache.c:1.65.2.15	Mon Apr  4 00:01:14 2005
--- openafs/src/afs/afs_vcache.c	Sat Apr 23 20:58:04 2005
***************
*** 39,45 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.65.2.15 2005/04/04 04:01:14 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.18 2005/04/24 00:58:04 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 814,820 ****
  	struct vnode *vp;
  
  	AFS_GUNLOCK();
! #ifdef AFS_FBSD50_ENV
  	if (getnewvnode(MOUNT_AFS, afs_globalVFS, afs_vnodeop_p, &vp))
  #else
  	if (getnewvnode(VT_AFS, afs_globalVFS, afs_vnodeop_p, &vp))
--- 814,822 ----
  	struct vnode *vp;
  
  	AFS_GUNLOCK();
! #if defined(AFS_FBSD60_ENV)
! 	if (getnewvnode(MOUNT_AFS, afs_globalVFS, &afs_vnodeops, &vp))
! #elif defined(AFS_FBSD50_ENV)
  	if (getnewvnode(MOUNT_AFS, afs_globalVFS, afs_vnodeop_p, &vp))
  #else
  	if (getnewvnode(VT_AFS, afs_globalVFS, afs_vnodeop_p, &vp))
***************
*** 933,942 ****
  #ifdef STRUCT_INODE_HAS_I_SB_LIST
  	list_add(&ip->i_sb_list, &ip->i_sb->s_inodes);
  #endif
! #ifdef STRUCT_INODE_HAS_INOTIFY_LOCK
  	INIT_LIST_HEAD(&ip->inotify_watches); 
  	spin_lock_init(&ip->inotify_lock); 
  #endif 
      }
  #endif
  
--- 935,948 ----
  #ifdef STRUCT_INODE_HAS_I_SB_LIST
  	list_add(&ip->i_sb_list, &ip->i_sb->s_inodes);
  #endif
! #if defined(STRUCT_INODE_HAS_INOTIFY_LOCK) || defined(STRUCT_INODE_HAS_INOTIFY_SEM)
  	INIT_LIST_HEAD(&ip->inotify_watches); 
+ #if defined(STRUCT_INODE_HAS_INOTIFY_SEM) 
+ 	sema_init(&ip->inotify_sem, 1); 
+ #else
  	spin_lock_init(&ip->inotify_lock); 
  #endif 
+ #endif 
      }
  #endif
  
***************
*** 1703,1713 ****
  	return tvc;
      }
  #endif /* AFS_OSF_ENV */
- #ifdef AFS_OBSD_ENV
-     VOP_LOCK(AFSTOV(tvc), LK_EXCLUSIVE | LK_RETRY, curproc);
-     uvm_vnp_uncache(AFSTOV(tvc));
-     VOP_UNLOCK(AFSTOV(tvc), 0, curproc);
- #endif
  #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
      /*
       * XXX - I really don't like this.  Should try to understand better.
--- 1709,1714 ----
***************
*** 1721,1739 ****
       * to vinvalbuf; otherwise, we leave it alone.
       */
      {
! 	struct vnode *vp;
  	int iheldthelock;
  
! 	vp = AFSTOV(tvc);
! #ifdef AFS_FBSD50_ENV
! 	iheldthelock = VOP_ISLOCKED(vp, curthread);
! 	if (!iheldthelock)
! 	    vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
! 	vinvalbuf(vp, V_SAVE, osi_curcred(), curthread, PINOD, 0);
! 	if (!iheldthelock)
! 	    VOP_UNLOCK(vp, LK_EXCLUSIVE, curthread);
! #else
! #ifdef AFS_DARWIN_ENV
  	iheldthelock = VOP_ISLOCKED(vp);
  	if (!iheldthelock)
  	    vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, current_proc());
--- 1722,1731 ----
       * to vinvalbuf; otherwise, we leave it alone.
       */
      {
! 	struct vnode *vp = AFSTOV(tvc);
  	int iheldthelock;
  
! #if defined(AFS_DARWIN_ENV)
  	iheldthelock = VOP_ISLOCKED(vp);
  	if (!iheldthelock)
  	    vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, current_proc());
***************
*** 1747,1760 ****
  	  ObtainWriteLock(&tvc->lock, 954);
  	if (!iheldthelock)
  	    VOP_UNLOCK(vp, LK_EXCLUSIVE, current_proc());
! #else
  	iheldthelock = VOP_ISLOCKED(vp, curproc);
  	if (!iheldthelock)
  	    vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curproc);
  	vinvalbuf(vp, V_SAVE, osi_curcred(), curproc, PINOD, 0);
  	if (!iheldthelock)
  	    VOP_UNLOCK(vp, LK_EXCLUSIVE, curproc);
! #endif
  #endif
      }
  #endif
--- 1739,1772 ----
  	  ObtainWriteLock(&tvc->lock, 954);
  	if (!iheldthelock)
  	    VOP_UNLOCK(vp, LK_EXCLUSIVE, current_proc());
! #elif defined(AFS_FBSD60_ENV)
! 	iheldthelock = VOP_ISLOCKED(vp, curthread);
! 	if (!iheldthelock)
! 	    vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
! 	vinvalbuf(vp, V_SAVE, curthread, PINOD, 0);
! 	if (!iheldthelock)
! 	    VOP_UNLOCK(vp, LK_EXCLUSIVE, curthread);
! #elif defined(AFS_FBSD50_ENV)
! 	iheldthelock = VOP_ISLOCKED(vp, curthread);
! 	if (!iheldthelock)
! 	    vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curthread);
! 	vinvalbuf(vp, V_SAVE, osi_curcred(), curthread, PINOD, 0);
! 	if (!iheldthelock)
! 	    VOP_UNLOCK(vp, LK_EXCLUSIVE, curthread);
! #elif defined(AFS_FBSD40_ENV)
  	iheldthelock = VOP_ISLOCKED(vp, curproc);
  	if (!iheldthelock)
  	    vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, curproc);
  	vinvalbuf(vp, V_SAVE, osi_curcred(), curproc, PINOD, 0);
  	if (!iheldthelock)
  	    VOP_UNLOCK(vp, LK_EXCLUSIVE, curproc);
! #elif defined(AFS_OBSD_ENV)
! 	iheldthelock = VOP_ISLOCKED(vp, curproc);
! 	if (!iheldthelock)
! 	    VOP_LOCK(vp, LK_EXCLUSIVE | LK_RETRY, curproc);
! 	uvm_vnp_uncache(vp);
! 	if (!iheldthelock)
! 	    VOP_UNLOCK(vp, 0, curproc);
  #endif
      }
  #endif
Index: openafs/src/afs/lock.h
diff -c openafs/src/afs/lock.h:1.13 openafs/src/afs/lock.h:1.13.2.1
*** openafs/src/afs/lock.h:1.13	Tue Jul 15 19:14:13 2003
--- openafs/src/afs/lock.h	Wed Apr 13 22:31:32 2005
***************
*** 59,68 ****
  
  #undef MObtainWriteLock		/* Defined also in ../rx/rx_machdep.h" */
  #undef MReleaseWriteLock
- #ifndef RXObtainWriteLock
- #define RXObtainWriteLock(lock)	ObtainWriteLock(lock)
- #define RXReleaseWriteLock(lock) ReleaseWriteLock(lock)
- #endif
  #define MObtainReadLock(lock)	ObtainReadLock(lock)
  #define MObtainWriteLock(lock,src)	ObtainWriteLock(lock,src)
  #define MObtainSharedLock(lock,src)	ObtainSharedLock(lock,src)
--- 59,64 ----
Index: openafs/src/afs/AIX/osi_machdep.h
diff -c openafs/src/afs/AIX/osi_machdep.h:1.3.2.1 openafs/src/afs/AIX/osi_machdep.h:1.3.2.2
*** openafs/src/afs/AIX/osi_machdep.h:1.3.2.1	Fri Mar 11 01:50:33 2005
--- openafs/src/afs/AIX/osi_machdep.h	Wed Apr 13 22:31:34 2005
***************
*** 69,78 ****
  			    simple_unlock((void *)&afs_global_lock);	\
  			} while(0)
  #define ISAFS_GLOCK()	lock_mine((void *)&afs_global_lock)
- 
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
  #endif
  
  #endif /* _OSI_MACHDEP_H_ */
--- 69,74 ----
Index: openafs/src/afs/DARWIN/osi_machdep.h
diff -c openafs/src/afs/DARWIN/osi_machdep.h:1.3.2.2 openafs/src/afs/DARWIN/osi_machdep.h:1.3.2.3
*** openafs/src/afs/DARWIN/osi_machdep.h:1.3.2.2	Mon Apr  4 00:01:19 2005
--- openafs/src/afs/DARWIN/osi_machdep.h	Wed Apr 13 22:31:35 2005
***************
*** 85,93 ****
          lockmgr(&afs_global_lock, LK_RELEASE, 0, current_proc()); \
      } while(0)
  #define ISAFS_GLOCK() (afs_global_owner == current_thread())
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
  
  #define SPLVAR
  #define NETPRI
--- 85,90 ----
Index: openafs/src/afs/DARWIN/osi_vnodeops.c
diff -c openafs/src/afs/DARWIN/osi_vnodeops.c:1.18.2.3 openafs/src/afs/DARWIN/osi_vnodeops.c:1.18.2.4
*** openafs/src/afs/DARWIN/osi_vnodeops.c:1.18.2.3	Mon Apr  4 00:01:19 2005
--- openafs/src/afs/DARWIN/osi_vnodeops.c	Thu Apr 28 21:51:07 2005
***************
*** 5,11 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.18.2.3 2005/04/04 04:01:19 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
--- 5,11 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.18.2.4 2005/04/29 01:51:07 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
***************
*** 345,353 ****
      if (AFSTOV(vc) != vp)
  	panic("AFS open changed vnode!");
  #endif
- #if 0
      osi_FlushPages(vc, ap->a_cred);
- #endif
      AFS_GUNLOCK();
  #ifdef AFS_DARWIN14_ENV
      if (error && didhold)
--- 345,351 ----
***************
*** 373,381 ****
  	code = afs_close(avc, ap->a_fflag, ap->a_cred, ap->a_p);
      else
  	code = afs_close(avc, ap->a_fflag, &afs_osi_cred, ap->a_p);
- #if 0
      osi_FlushPages(avc, ap->a_cred);	/* hold bozon lock, but not basic vnode lock */
- #endif
      AFS_GUNLOCK();
  
      return code;
--- 371,377 ----
***************
*** 443,451 ****
      struct vnode *vp = ap->a_vp;
      struct vcache *avc = VTOAFS(vp);
      AFS_GLOCK();
- #if 0
      osi_FlushPages(avc, ap->a_cred);	/* hold bozon lock, but not basic vnode lock */
- #endif
      code = afs_read(avc, ap->a_uio, ap->a_cred, 0, 0, 0);
      AFS_GUNLOCK();
      return code;
--- 439,445 ----
***************
*** 521,529 ****
      auio.uio_resid = aiov.iov_len = size;
      aiov.iov_base = (caddr_t) ioaddr;
      AFS_GLOCK();
- #if 0
      osi_FlushPages(tvc, ap->a_cred);	/* hold bozon lock, but not basic vnode lock */
- #endif
      code = afs_read(tvc, uio, cred, 0, 0, 0);
      if (code == 0) {
  	ObtainWriteLock(&tvc->lock, 2);
--- 515,521 ----
***************
*** 564,572 ****
      struct vcache *avc = VTOAFS(ap->a_vp);
      void *object;
      AFS_GLOCK();
- #if 0
      osi_FlushPages(avc, ap->a_cred);	/* hold bozon lock, but not basic vnode lock */
- #endif
      if (UBCINFOEXISTS(ap->a_vp)) {
  	ubc_clean(ap->a_vp, 1);
      }
--- 556,562 ----
***************
*** 709,717 ****
  #endif /* ] USV */
  
      AFS_GLOCK();
- #if 0
      osi_FlushPages(tvc, ap->a_cred);	/* hold bozon lock, but not basic vnode lock */
- #endif
      ObtainWriteLock(&tvc->lock, 1);
      afs_FakeOpen(tvc);
      ReleaseWriteLock(&tvc->lock);
--- 699,705 ----
Index: openafs/src/afs/DUX/osi_machdep.h
diff -c openafs/src/afs/DUX/osi_machdep.h:1.3 openafs/src/afs/DUX/osi_machdep.h:1.3.8.1
*** openafs/src/afs/DUX/osi_machdep.h:1.3	Mon Mar 25 12:11:52 2002
--- openafs/src/afs/DUX/osi_machdep.h	Wed Apr 13 22:31:36 2005
***************
*** 63,71 ****
  	usimple_unlock(&afs_global_lock); \
      } while(0)
  #define ISAFS_GLOCK() (afs_global_owner == current_thread())
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
  
  #undef SPLVAR
  #define SPLVAR
--- 63,68 ----
Index: openafs/src/afs/FBSD/osi_machdep.h
diff -c openafs/src/afs/FBSD/osi_machdep.h:1.9 openafs/src/afs/FBSD/osi_machdep.h:1.9.2.2
*** openafs/src/afs/FBSD/osi_machdep.h:1.9	Wed Jul 28 23:13:45 2004
--- openafs/src/afs/FBSD/osi_machdep.h	Sat Apr 23 20:58:05 2005
***************
*** 66,77 ****
--- 66,84 ----
  #define VN_RELE(vp)		vrele(vp)
  #define VN_HOLD(vp)		VREF(vp)
  
+ #ifdef AFS_FBSD60_ENV
+ #undef IsAfsVnode
+ #define IsAfsVnode(v) ((v)->v_op == &afs_vnodeops)
+ extern struct vop_vector afs_vnodeops;
+ #endif
+ 
  #if defined(AFS_FBSD50_ENV)
  #define VT_AFS		"afs"
  #define VROOT		VV_ROOT
  #define v_flag		v_vflag
  #define osi_curcred()	(curthread->td_ucred)
  #define afs_suser(x)	(!suser(curthread))
+ #define getpid()	(curthread->td_proc->p_pid)
  #define simple_lock(x)	mtx_lock(x)
  #define simple_unlock(x) mtx_unlock(x)
  #define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
***************
*** 86,92 ****
  
  #define osi_curcred()	(curproc->p_cred->pc_ucred)
  #define afs_suser(x)	(!suser(curproc))
! #define getpid()	curproc
  #define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
    vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
  extern struct proc *afs_global_owner;
--- 93,99 ----
  
  #define osi_curcred()	(curproc->p_cred->pc_ucred)
  #define afs_suser(x)	(!suser(curproc))
! #define getpid()	(curproc->p_pid)
  #define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
    vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
  extern struct proc *afs_global_owner;
***************
*** 107,116 ****
  #define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
  #endif /* FBSD50 */
  
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
- 
  #undef SPLVAR
  #define SPLVAR int splvar
  #undef NETPRI
--- 114,119 ----
Index: openafs/src/afs/FBSD/osi_vfsops.c
diff -c openafs/src/afs/FBSD/osi_vfsops.c:1.16.2.1 openafs/src/afs/FBSD/osi_vfsops.c:1.16.2.2
*** openafs/src/afs/FBSD/osi_vfsops.c:1.16.2.1	Tue Nov  9 12:11:34 2004
--- openafs/src/afs/FBSD/osi_vfsops.c	Sat Apr 23 20:58:05 2005
***************
*** 2,8 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_vfsops.c,v 1.16.2.1 2004/11/09 17:11:34 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
--- 2,8 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_vfsops.c,v 1.16.2.2 2005/04/24 00:58:05 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
***************
*** 79,84 ****
--- 79,92 ----
      return 0;
  }
  
+ #ifdef AFS_FBSD60_ENV
+ static int
+ afs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td)
+ {
+     return kernel_mount(ma, flags);
+ }
+ #endif
+ 
  int
  afs_unmount(struct mount *mp, int flags, THREAD_OR_PROC)
  {
***************
*** 211,217 ****
--- 219,229 ----
  }
  
  int
+ #ifdef AFS_FBSD60_ENV
+ afs_sync(struct mount *mp, int waitfor, struct thread *td)
+ #else
  afs_sync(struct mount *mp, int waitfor, struct ucred *cred, THREAD_OR_PROC)
+ #endif
  {
      return 0;
  }
***************
*** 222,227 ****
--- 234,252 ----
      return 0;
  }
  
+ #ifdef AFS_FBSD60_ENV
+ struct vfsops afs_vfsops = {
+ 	.vfs_init =		afs_init,
+ 	.vfs_mount =		afs_mount,
+ 	.vfs_cmount =		afs_cmount,
+ 	.vfs_root =		afs_root,
+ 	.vfs_statfs =		afs_statfs,
+ 	.vfs_sync =		afs_sync,
+ 	.vfs_uninit =		vfs_stduninit,
+ 	.vfs_unmount =		afs_unmount,
+ 	.vfs_sysctl =		vfs_stdsysctl,
+ };
+ #else
  struct vfsops afs_vfsops = {
  #ifdef AFS_FBSD53_ENV
      afs_mount,
***************
*** 244,246 ****
--- 269,272 ----
      vfs_stdsysctl,
  #endif
  };
+ #endif
Index: openafs/src/afs/FBSD/osi_vnodeops.c
diff -c openafs/src/afs/FBSD/osi_vnodeops.c:1.18.2.1 openafs/src/afs/FBSD/osi_vnodeops.c:1.18.2.2
*** openafs/src/afs/FBSD/osi_vnodeops.c:1.18.2.1	Sun Apr  3 14:15:37 2005
--- openafs/src/afs/FBSD/osi_vnodeops.c	Sat Apr 23 20:58:05 2005
***************
*** 48,54 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_vnodeops.c,v 1.18.2.1 2005/04/03 18:15:37 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.2 2005/04/24 00:58:05 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
***************
*** 65,70 ****
--- 65,137 ----
  #include <vm/vnode_pager.h>
  extern int afs_pbuf_freecnt;
  
+ #ifdef AFS_FBSD60_ENV
+ static vop_access_t	afs_vop_access;
+ static vop_advlock_t	afs_vop_advlock;
+ static vop_close_t	afs_vop_close;
+ static vop_create_t	afs_vop_create;
+ static vop_fsync_t	afs_vop_fsync;
+ static vop_getattr_t	afs_vop_getattr;
+ static vop_getpages_t	afs_vop_getpages;
+ static vop_inactive_t	afs_vop_inactive;
+ static vop_ioctl_t	afs_vop_ioctl;
+ static vop_link_t	afs_vop_link;
+ static vop_lookup_t	afs_vop_lookup;
+ static vop_mkdir_t	afs_vop_mkdir;
+ static vop_mknod_t	afs_vop_mknod;
+ static vop_open_t	afs_vop_open;
+ static vop_pathconf_t	afs_vop_pathconf;
+ static vop_poll_t	afs_vop_poll;
+ static vop_print_t	afs_vop_print;
+ static vop_putpages_t	afs_vop_putpages;
+ static vop_read_t	afs_vop_read;
+ static vop_readdir_t	afs_vop_readdir;
+ static vop_readlink_t	afs_vop_readlink;
+ static vop_reclaim_t	afs_vop_reclaim;
+ static vop_remove_t	afs_vop_remove;
+ static vop_rename_t	afs_vop_rename;
+ static vop_rmdir_t	afs_vop_rmdir;
+ static vop_setattr_t	afs_vop_setattr;
+ static vop_strategy_t	afs_vop_strategy;
+ static vop_symlink_t	afs_vop_symlink;
+ static vop_write_t	afs_vop_write;
+ 
+ struct vop_vector afs_vnodeops = {
+ 	.vop_default =		&default_vnodeops,
+ 	.vop_access =		afs_vop_access,
+ 	.vop_advlock =		afs_vop_advlock,
+ 	.vop_close =		afs_vop_close,
+ 	.vop_create =		afs_vop_create,
+ 	.vop_fsync =		afs_vop_fsync,
+ 	.vop_getattr =		afs_vop_getattr,
+ 	.vop_getpages =		afs_vop_getpages,
+ 	.vop_inactive =		afs_vop_inactive,
+ 	.vop_ioctl =		afs_vop_ioctl,
+ 	.vop_lease =		VOP_NULL,
+ 	.vop_link =		afs_vop_link,
+ 	.vop_lookup =		afs_vop_lookup,
+ 	.vop_mkdir =		afs_vop_mkdir,
+ 	.vop_mknod =		afs_vop_mknod,
+ 	.vop_open =		afs_vop_open,
+ 	.vop_pathconf =		afs_vop_pathconf,
+ 	.vop_poll =		afs_vop_poll,
+ 	.vop_print =		afs_vop_print,
+ 	.vop_putpages =		afs_vop_putpages,
+ 	.vop_read =		afs_vop_read,
+ 	.vop_readdir =		afs_vop_readdir,
+ 	.vop_readlink =		afs_vop_readlink,
+ 	.vop_reclaim =		afs_vop_reclaim,
+ 	.vop_remove =		afs_vop_remove,
+ 	.vop_rename =		afs_vop_rename,
+ 	.vop_rmdir =		afs_vop_rmdir,
+ 	.vop_setattr =		afs_vop_setattr,
+ 	.vop_strategy =		afs_vop_strategy,
+ 	.vop_symlink =		afs_vop_symlink,
+ 	.vop_write =		afs_vop_write,
+ };
+ 
+ #else /* AFS_FBSD60_ENV */
+ 
  int afs_vop_lookup(struct vop_lookup_args *);
  int afs_vop_create(struct vop_create_args *);
  int afs_vop_mknod(struct vop_mknod_args *);
***************
*** 94,105 ****
  int afs_vop_readlink(struct vop_readlink_args *);
  int afs_vop_inactive(struct vop_inactive_args *);
  int afs_vop_reclaim(struct vop_reclaim_args *);
- int afs_vop_lock(struct vop_lock_args *);
- int afs_vop_unlock(struct vop_unlock_args *);
  int afs_vop_bmap(struct vop_bmap_args *);
  int afs_vop_strategy(struct vop_strategy_args *);
  int afs_vop_print(struct vop_print_args *);
- int afs_vop_islocked(struct vop_islocked_args *);
  int afs_vop_advlock(struct vop_advlock_args *);
  
  
--- 161,169 ----
***************
*** 153,158 ****
--- 217,223 ----
  };
  struct vnodeopv_desc afs_vnodeop_opv_desc =
      { &afs_vnodeop_p, afs_vnodeop_entries };
+ #endif /* AFS_FBSD60_ENV */
  
  #define GETNAME()       \
      struct componentname *cnp = ap->a_cnp; \
***************
*** 882,891 ****
--- 947,960 ----
  
      AFS_GLOCK();
      /*vflushbuf(vp, wait); */
+ #ifdef AFS_FBSD60_ENV
+     error = afs_fsync(VTOAFS(vp), ap->a_td->td_ucred);
+ #else
      if (ap->a_cred)
  	error = afs_fsync(VTOAFS(vp), ap->a_cred);
      else
  	error = afs_fsync(VTOAFS(vp), afs_osi_credp);
+ #endif
      AFS_GUNLOCK();
      return error;
  }
***************
*** 1286,1294 ****
--- 1355,1368 ----
       */
      if (code)
  	printf("afs_vop_reclaim: afs_FlushVCache failed code %d\n", code);
+ 
+ #ifdef AFS_FBSD60_ENV
+     vnode_destroy_vobject(vp);
+ #endif
      return 0;
  }
  
+ #ifndef AFS_FBSD60_ENV
  int
  afs_vop_bmap(ap)
       struct vop_bmap_args	/* {
***************
*** 1313,1318 ****
--- 1387,1393 ----
  
      return 0;
  }
+ #endif
  
  int
  afs_vop_strategy(ap)
Index: openafs/src/afs/HPUX/osi_machdep.h
diff -c openafs/src/afs/HPUX/osi_machdep.h:1.12 openafs/src/afs/HPUX/osi_machdep.h:1.12.2.1
*** openafs/src/afs/HPUX/osi_machdep.h:1.12	Tue Jul 15 19:14:21 2003
--- openafs/src/afs/HPUX/osi_machdep.h	Wed Apr 13 22:31:37 2005
***************
*** 80,89 ****
  
  #endif
  
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
- 
  /* Uses splnet only in the SP case */
  #define SPLVAR      register ulong_t splvar
  #define NETPRI      NET_SPLNET(splvar)
--- 80,85 ----
Index: openafs/src/afs/IRIX/osi_machdep.h
diff -c openafs/src/afs/IRIX/osi_machdep.h:1.7.2.1 openafs/src/afs/IRIX/osi_machdep.h:1.7.2.2
*** openafs/src/afs/IRIX/osi_machdep.h:1.7.2.1	Wed Aug 25 03:09:34 2004
--- openafs/src/afs/IRIX/osi_machdep.h	Wed Apr 13 22:31:38 2005
***************
*** 172,182 ****
      (AFS_ASSERT_GLOCK(), afs_global_owner = 0, mutex_exit(&afs_global_lock))
  #define ISAFS_GLOCK() (osi_ThreadUnique() == afs_global_owner)
  #endif /* AFS_SGI64_ENV */
- 
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
- 
  #else /* MP */
  #define AFS_GLOCK()
  #define AFS_GUNLOCK()
--- 172,177 ----
Index: openafs/src/afs/LINUX/osi_file.c
diff -c openafs/src/afs/LINUX/osi_file.c:1.19.2.4 openafs/src/afs/LINUX/osi_file.c:1.19.2.7
*** openafs/src/afs/LINUX/osi_file.c:1.19.2.4	Thu Mar 10 23:37:17 2005
--- openafs/src/afs/LINUX/osi_file.c	Sun Apr 24 16:12:22 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_file.c,v 1.19.2.4 2005/03/11 04:37:17 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.7 2005/04/24 20:12:22 shadow Exp $");
  
  #ifdef AFS_LINUX24_ENV
  #include "h/module.h" /* early to avoid printf->printk mapping */
***************
*** 26,33 ****
--- 26,124 ----
  struct AFS_UCRED afs_osi_cred;
  afs_lock_t afs_xosi;		/* lock is for tvattr */
  extern struct osi_dev cacheDev;
+ #if defined(AFS_LINUX24_ENV)
+ extern struct vfsmount *afs_cacheMnt;
+ #endif
  extern struct super_block *afs_cacheSBp;
  
+ /*#if defined(AFS_LINUX26_ENV) && (defined(CONFIG_EXPORTFS) || defined(CONFIG_EXPORTFS_MODULE))
+ #define HAS_UFSOPEN
+ extern struct export_operations export_op_default;
+ 
+ #define CALL(ops,fun) ((ops->fun)?(ops->fun):export_op_default.fun)
+ 
+ XXX something based on encode_fh / find_exported_dentry 
+ This would require us to store an inode -> fh mapping (acquired by
+ afs_InitCacheFile or lookupname), but probably solves the resiserfs issue.
+ #elif... */
+ 
+ #if defined(AFS_LINUX24_ENV) && !defined(HAS_UFSOPEN)
+ #define HAS_UFSOPEN
+ void *
+ osi_UFSOpen(afs_int32 ainode)
+ {
+     register struct osi_file *afile = NULL;
+     extern int cacheDiskType;
+     struct inode *tip = NULL;
+ #ifndef AFS_LINUX26_ENV
+     afs_int32 code = 0;
+     struct list_head *lp = NULL;
+     struct dentry *tdp = NULL;
+ #endif
+     struct dentry *dp = NULL;
+     struct file *filp = NULL;
+     AFS_STATCNT(osi_UFSOpen);
+     if (cacheDiskType != AFS_FCACHE_TYPE_UFS) {
+ 	osi_Panic("UFSOpen called for non-UFS cache\n");
+     }
+     if (!afs_osicred_initialized) {
+ 	/* valid for alpha_osf, SunOS, Ultrix */
+ 	memset((char *)&afs_osi_cred, 0, sizeof(struct AFS_UCRED));
+ 	crhold(&afs_osi_cred);	/* don't let it evaporate, since it is static */
+ 	afs_osicred_initialized = 1;
+     }
+     afile = (struct osi_file *)osi_AllocLargeSpace(sizeof(struct osi_file));
+     AFS_GUNLOCK();
+     if (!afile) {
+ 	osi_Panic("osi_UFSOpen: Failed to allocate %d bytes for osi_file.\n",
+ 		  sizeof(struct osi_file));
+     }
+     memset(afile, 0, sizeof(struct osi_file));
+     tip = iget(afs_cacheSBp, (u_long) ainode);
+     if (!tip)
+ 	osi_Panic("Can't get inode %d\n", ainode);
+     tip->i_flags |= MS_NOATIME;	/* Disable updating access times. */
+ 
+ #ifdef AFS_LINUX26_ENV
+     dp = d_alloc_anon(tip);
+ #else
+     spin_lock(&dcache_lock);
+     for (lp = tip->i_dentry.next;  lp != &tip->i_dentry; lp = lp->next) {
+         tdp = list_entry(lp, struct dentry, d_alias);
+         if ( !(tdp->d_flags & DCACHE_NFSD_DISCONNECTED)) {
+              dget_locked(tdp);
+              dp=tdp;
+              break;
+         }
+     }
+     if (tdp && !dp) {
+              dget_locked(tdp);
+              dp=tdp;
+     }
+     tdp = NULL;
+     spin_unlock(&dcache_lock);
+     if (!dp)
+            dp = d_alloc_root(tip);
+     iput(tip);
+ #endif
+     if (!dp) 
+            osi_Panic("Can't get dentry for inode %d\n", ainode);          
+ 
+     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;
+     afile->inum = ainode;	/* for hint validity checking */
+     return (void *)afile;
+ }
+ #endif
+ 
+ #if !defined(HAS_UFSOPEN)
  void *
  osi_UFSOpen(afs_int32 ainode)
  {
***************
*** 65,70 ****
--- 156,162 ----
      filp->f_mapping = tip->i_mapping;
  #endif
  #if defined(AFS_LINUX24_ENV)
+     filp->f_mode = FMODE_READ|FMODE_WRITE;
      filp->f_op = fops_get(tip->i_fop);
  #else
      filp->f_op = tip->i_op->default_file_ops;
***************
*** 80,85 ****
--- 172,178 ----
      afile->inum = ainode;	/* for hint validity checking */
      return (void *)afile;
  }
+ #endif
  
  int
  afs_osi_Stat(register struct osi_file *afile, register struct osi_stat *astat)
***************
*** 87,106 ****
      register afs_int32 code;
      AFS_STATCNT(osi_Stat);
      MObtainWriteLock(&afs_xosi, 320);
!     astat->size = FILE_INODE(&afile->file)->i_size;
!     astat->blksize = FILE_INODE(&afile->file)->i_blksize;
  #if defined(AFS_LINUX26_ENV)
!     astat->mtime = FILE_INODE(&afile->file)->i_mtime.tv_sec;
!     astat->atime = FILE_INODE(&afile->file)->i_atime.tv_sec;
  #else
!     astat->mtime = FILE_INODE(&afile->file)->i_mtime;
!     astat->atime = FILE_INODE(&afile->file)->i_atime;
  #endif
      code = 0;
      MReleaseWriteLock(&afs_xosi);
      return code;
  }
  
  int
  osi_UFSClose(register struct osi_file *afile)
  {
--- 180,214 ----
      register afs_int32 code;
      AFS_STATCNT(osi_Stat);
      MObtainWriteLock(&afs_xosi, 320);
!     astat->size = OSIFILE_INODE(afile)->i_size;
!     astat->blksize = OSIFILE_INODE(afile)->i_blksize;
  #if defined(AFS_LINUX26_ENV)
!     astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec;
!     astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec;
  #else
!     astat->mtime = OSIFILE_INODE(afile)->i_mtime;
!     astat->atime = OSIFILE_INODE(afile)->i_atime;
  #endif
      code = 0;
      MReleaseWriteLock(&afs_xosi);
      return code;
  }
  
+ #ifdef AFS_LINUX24_ENV
+ int
+ osi_UFSClose(register struct osi_file *afile)
+ {
+     AFS_STATCNT(osi_Close);
+     if (afile) {
+ 	if (OSIFILE_INODE(afile)) {
+              filp_close(afile->filp, NULL);
+ 	}
+     }
+ 
+     osi_FreeLargeSpace(afile);
+     return 0;
+ }
+ #else
  int
  osi_UFSClose(register struct osi_file *afile)
  {
***************
*** 117,122 ****
--- 225,231 ----
      osi_FreeLargeSpace(afile);
      return 0;
  }
+ #endif
  
  int
  osi_UFSTruncate(register struct osi_file *afile, afs_int32 asize)
***************
*** 124,130 ****
      register afs_int32 code;
      struct osi_stat tstat;
      struct iattr newattrs;
!     struct inode *inode = FILE_INODE(&afile->file);
      AFS_STATCNT(osi_Truncate);
  
      /* This routine only shrinks files, and most systems
--- 233,239 ----
      register afs_int32 code;
      struct osi_stat tstat;
      struct iattr newattrs;
!     struct inode *inode = OSIFILE_INODE(afile);
      AFS_STATCNT(osi_Truncate);
  
      /* This routine only shrinks files, and most systems
***************
*** 184,197 ****
  afs_osi_Read(register struct osi_file *afile, int offset, void *aptr,
  	     afs_int32 asize)
  {
!     size_t resid;
!     register afs_int32 code;
      AFS_STATCNT(osi_Read);
  
!     /**
!       * If the osi_file passed in is NULL, panic only if AFS is not shutting
!       * down. No point in crashing when we are already shutting down
!       */
      if (!afile) {
  	if (!afs_shuttingdown)
  	    osi_Panic("osi_Read called with null param");
--- 293,308 ----
  afs_osi_Read(register struct osi_file *afile, int offset, void *aptr,
  	     afs_int32 asize)
  {
!     struct uio auio;
!     struct iovec iov;
!     afs_int32 code;
! 
      AFS_STATCNT(osi_Read);
  
!     /*
!      * If the osi_file passed in is NULL, panic only if AFS is not shutting
!      * down. No point in crashing when we are already shutting down
!      */
      if (!afile) {
  	if (!afs_shuttingdown)
  	    osi_Panic("osi_Read called with null param");
***************
*** 201,214 ****
  
      if (offset != -1)
  	afile->offset = offset;
      AFS_GUNLOCK();
!     code = osi_rdwr(UIO_READ, afile, (caddr_t) aptr, asize, &resid);
      AFS_GLOCK();
      if (code == 0) {
! 	code = asize - resid;
  	afile->offset += code;
      } else {
! 	afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
  		   ICL_TYPE_INT32, code);
  	code = -1;
      }
--- 312,326 ----
  
      if (offset != -1)
  	afile->offset = offset;
+     setup_uio(&auio, &iov, aptr, afile->offset, asize, UIO_READ, AFS_UIOSYS);
      AFS_GUNLOCK();
!     code = osi_rdwr(afile, &auio, UIO_READ);
      AFS_GLOCK();
      if (code == 0) {
! 	code = asize - auio.uio_resid;
  	afile->offset += code;
      } else {
! 	afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, auio.uio_resid,
  		   ICL_TYPE_INT32, code);
  	code = -1;
      }
***************
*** 220,241 ****
  afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr,
  	      afs_int32 asize)
  {
!     size_t resid;
!     register afs_int32 code;
      AFS_STATCNT(osi_Write);
      if (!afile) {
  	if (!afs_shuttingdown)
  	    osi_Panic("afs_osi_Write called with null param");
  	else
  	    return EIO;
      }
      if (offset != -1)
  	afile->offset = offset;
      AFS_GUNLOCK();
!     code = osi_rdwr(UIO_WRITE, afile, (caddr_t) aptr, asize, &resid);
      AFS_GLOCK();
      if (code == 0) {
! 	code = asize - resid;
  	afile->offset += code;
      } else {
  	if (code == ENOSPC)
--- 332,358 ----
  afs_osi_Write(register struct osi_file *afile, afs_int32 offset, void *aptr,
  	      afs_int32 asize)
  {
!     struct uio auio;
!     struct iovec iov;
!     afs_int32 code;
! 
      AFS_STATCNT(osi_Write);
+ 
      if (!afile) {
  	if (!afs_shuttingdown)
  	    osi_Panic("afs_osi_Write called with null param");
  	else
  	    return EIO;
      }
+ 
      if (offset != -1)
  	afile->offset = offset;
+     setup_uio(&auio, &iov, aptr, afile->offset, asize, UIO_WRITE, AFS_UIOSYS);
      AFS_GUNLOCK();
!     code = osi_rdwr(afile, &auio, UIO_WRITE);
      AFS_GLOCK();
      if (code == 0) {
! 	code = asize - auio.uio_resid;
  	afile->offset += code;
      } else {
  	if (code == ENOSPC)
***************
*** 243,251 ****
  		("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
  	code = -1;
      }
!     if (afile->proc) {
! 	(*afile->proc) (afile, code);
!     }
      return code;
  }
  
--- 360,369 ----
  		("\n\n\n*** Cache partition is FULL - Decrease cachesize!!! ***\n\n");
  	code = -1;
      }
! 
!     if (afile->proc)
! 	(*afile->proc)(afile, code);
! 
      return code;
  }
  
Index: openafs/src/afs/LINUX/osi_machdep.h
diff -c openafs/src/afs/LINUX/osi_machdep.h:1.22.2.4 openafs/src/afs/LINUX/osi_machdep.h:1.22.2.8
*** openafs/src/afs/LINUX/osi_machdep.h:1.22.2.4	Sun Mar 20 15:19:20 2005
--- openafs/src/afs/LINUX/osi_machdep.h	Wed Apr 27 17:56:12 2005
***************
*** 179,184 ****
--- 179,193 ----
  /* Get/set the inode in the osifile struct. */
  #define FILE_INODE(F) (F)->f_dentry->d_inode
  
+ #ifdef AFS_LINUX24_ENV
+ #define OSIFILE_INODE(a) FILE_INODE((a)->filp)
+ #else
+ #define OSIFILE_INODE(a) FILE_INODE(&(a)->file)
+ #endif
+ 
+ #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+ #define NEED_IOCTL32
+ #endif
  
  /* page offset is obtained and stored here during module initialization 
   * We need a variable to do this because, the PAGE_OFFSET macro defined in
***************
*** 190,196 ****
  /* function to help with the page offset stuff */
  #define afs_linux_page_address(page) (afs_linux_page_offset + PAGE_SIZE * (page - mem_map))
  
! #if defined(__KERNEL__) && defined(CONFIG_SMP)
  #include "../h/sched.h"
  #include "linux/wait.h"
  
--- 199,205 ----
  /* function to help with the page offset stuff */
  #define afs_linux_page_address(page) (afs_linux_page_offset + PAGE_SIZE * (page - mem_map))
  
! #if defined(__KERNEL__)
  #include "../h/sched.h"
  #include "linux/wait.h"
  
***************
*** 222,231 ****
  #define AFS_GUNLOCK()
  #define ISAFS_GLOCK() 1
  #define AFS_ASSERT_GLOCK()
- #define AFS_ASSERT_RXGLOCK()
  #endif
  
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
  #endif /* OSI_MACHDEP_H_ */
--- 231,236 ----
Index: openafs/src/afs/LINUX/osi_misc.c
diff -c openafs/src/afs/LINUX/osi_misc.c:1.34.2.5 openafs/src/afs/LINUX/osi_misc.c:1.34.2.8
*** openafs/src/afs/LINUX/osi_misc.c:1.34.2.5	Fri Mar 11 01:50:41 2005
--- openafs/src/afs/LINUX/osi_misc.c	Wed Apr 27 23:11:51 2005
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_misc.c,v 1.34.2.5 2005/03/11 06:50:41 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_misc.c,v 1.34.2.8 2005/04/28 03:11:51 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 110,121 ****
  osi_InitCacheInfo(char *aname)
  {
      int code;
!     struct dentry *dp,*dpp;
      extern ino_t cacheInode;
      extern struct osi_dev cacheDev;
      extern afs_int32 afs_fsfragsize;
      extern struct super_block *afs_cacheSBp;
!     extern struct vfsmnt *afs_cacheMnt;
      code = osi_lookupname_internal(aname, 1, &afs_cacheMnt, &dp);
      if (code)
  	return ENOENT;
--- 110,121 ----
  osi_InitCacheInfo(char *aname)
  {
      int code;
!     struct dentry *dp;
      extern ino_t cacheInode;
      extern struct osi_dev cacheDev;
      extern afs_int32 afs_fsfragsize;
      extern struct super_block *afs_cacheSBp;
!     extern struct vfsmount *afs_cacheMnt;
      code = osi_lookupname_internal(aname, 1, &afs_cacheMnt, &dp);
      if (code)
  	return ENOENT;
***************
*** 135,193 ****
  #define FOP_WRITE(F, B, C) (F)->f_op->write(F, B, (size_t)(C), &(F)->f_pos)
  
  /* osi_rdwr
!  * Seek, then read or write to an open inode. addrp points to data in
   * kernel space.
   */
  int
! osi_rdwr(int rw, struct osi_file *file, caddr_t addrp, size_t asize,
! 	 size_t * resid)
! {
!     int code = 0;
!     KERNEL_SPACE_DECL;
!     struct file *filp = &file->file;
!     off_t offset = file->offset;
!     unsigned long savelim;
! 
!     /* Seek to the desired position. Return -1 on error. */
!     if (filp->f_op->llseek) {
! 	if (filp->f_op->llseek(filp, (loff_t) offset, 0) != offset)
! 	    return -1;
!     } else
! 	filp->f_pos = offset;
! 
!     savelim = current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur;
!     current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
! 
!     /* Read/Write the data. */
!     TO_USER_SPACE();
!     if (rw == UIO_READ)
! 	code = FOP_READ(filp, addrp, asize);
!     else if (rw == UIO_WRITE)
! 	code = FOP_WRITE(filp, addrp, asize);
!     else			/* all is well? */
! 	code = asize;
!     TO_KERNEL_SPACE();
! 
!     current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = savelim;
! 
!     if (code >= 0) {
! 	*resid = asize - code;
! 	return 0;
!     } else
! 	return -1;
! }
! 
! /* This variant is called from AFS read/write routines and takes a uio
!  * struct and, if successful, returns 0.
!  */
! int
! osi_file_uio_rdwr(struct osi_file *osifile, uio_t * uiop, int rw)
  {
      struct file *filp = &osifile->file;
      KERNEL_SPACE_DECL;
      int code = 0;
      struct iovec *iov;
!     int count;
      unsigned long savelim;
  
      savelim = current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur;
--- 135,155 ----
  #define FOP_WRITE(F, B, C) (F)->f_op->write(F, B, (size_t)(C), &(F)->f_pos)
  
  /* osi_rdwr
!  * seek, then read or write to an open inode. addrp points to data in
   * kernel space.
   */
  int
! osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw)
  {
+ #ifdef AFS_LINUX24_ENV
+     struct file *filp = osifile->filp;
+ #else
      struct file *filp = &osifile->file;
+ #endif
      KERNEL_SPACE_DECL;
      int code = 0;
      struct iovec *iov;
!     afs_size_t count;
      unsigned long savelim;
  
      savelim = current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur;
***************
*** 196,202 ****
      if (uiop->uio_seg == AFS_UIOSYS)
  	TO_USER_SPACE();
  
!     filp->f_pos = uiop->uio_offset;
      while (code == 0 && uiop->uio_resid > 0 && uiop->uio_iovcnt > 0) {
  	iov = uiop->uio_iov;
  	count = iov->iov_len;
--- 158,170 ----
      if (uiop->uio_seg == AFS_UIOSYS)
  	TO_USER_SPACE();
  
!     /* seek to the desired position. Return -1 on error. */
!     if (filp->f_op->llseek) {
! 	if (filp->f_op->llseek(filp, (loff_t) uiop->uio_offset, 0) != uiop->uio_offset)
! 	    return -1;
!     } else
! 	filp->f_pos = uiop->uio_offset;
! 
      while (code == 0 && uiop->uio_resid > 0 && uiop->uio_iovcnt > 0) {
  	iov = uiop->uio_iov;
  	count = iov->iov_len;
Index: openafs/src/afs/LINUX/osi_module.c
diff -c openafs/src/afs/LINUX/osi_module.c:1.52.2.10 openafs/src/afs/LINUX/osi_module.c:1.52.2.14
*** openafs/src/afs/LINUX/osi_module.c:1.52.2.10	Sun Apr  3 14:21:06 2005
--- openafs/src/afs/LINUX/osi_module.c	Sun Apr 24 19:53:44 2005
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.52.2.10 2005/04/03 18:21:06 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.14 2005/04/24 23:53:44 shadow Exp $");
  
  #include <linux/module.h> /* early to avoid printf->printk mapping */
  #include "afs/sysincludes.h"
***************
*** 50,64 ****
  unsigned long afs_linux_page_offset = 0;	/* contains the PAGE_OFFSET value */
  #endif
  
! 
! static int afs_ioctl(struct inode *, struct file *, unsigned int,
  		     unsigned long);
  
  static struct file_operations afs_syscall_fops = {
      .ioctl = afs_ioctl,
  };
  
  int
  csdbproc_read(char *buffer, char **start, off_t offset, int count,
  	      int *eof, void *data)
  {
--- 50,141 ----
  unsigned long afs_linux_page_offset = 0;	/* contains the PAGE_OFFSET value */
  #endif
  
! static inline int afs_ioctl(struct inode *, struct file *, unsigned int,
  		     unsigned long);
+ #if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL)
+ static long afs_unlocked_ioctl(struct file *, unsigned int, unsigned long);
+ #endif
  
  static struct file_operations afs_syscall_fops = {
+ #ifdef HAVE_UNLOCKED_IOCTL
+     .unlocked_ioctl = afs_unlocked_ioctl,
+ #else
      .ioctl = afs_ioctl,
+ #endif
+ #ifdef HAVE_COMPAT_IOCTL
+     .compat_ioctl = afs_unlocked_ioctl,
+ #endif
  };
  
  int
+ csdbproc_info(char *buffer, char **start, off_t offset, int
+ length)
+ {
+     int len = 0;
+     off_t pos = 0;
+     int cnt;
+     struct afs_q *cq, *tq;
+     struct cell *tc;
+     char tbuffer[16];
+     /* 90 - 64 cellname, 10 for 32 bit num and index, plus
+        decor */
+     char temp[91];
+     afs_uint32 addr;
+     
+     ObtainReadLock(&afs_xcell);
+ 
+     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
+         tc = QTOC(cq); tq = QNext(cq);
+ 
+         pos += 90;
+ 
+         if (pos <= offset) {
+             len = 0;
+         } else {
+             sprintf(temp, ">%s #(%d/%d)\n", tc->cellName, 
+                     tc->cellNum, tc->cellIndex);
+             sprintf(buffer + len, "%-89s\n", temp);
+             len += 90;
+             if (pos >= offset+length) {
+                 ReleaseReadLock(&afs_xcell);
+                 goto done;
+             }
+         }
+ 
+         for (cnt = 0; cnt < MAXCELLHOSTS; cnt++) {
+             if (!tc->cellHosts[cnt]) break;
+             pos += 90;
+             if (pos <= offset) {
+                 len = 0;
+             } else {
+                 addr = ntohl(tc->cellHosts[cnt]->addr->sa_ip);
+                 sprintf(tbuffer, "%d.%d.%d.%d", 
+                         (int)((addr>>24) & 0xff),
+ (int)((addr>>16) & 0xff),
+                         (int)((addr>>8)  & 0xff), (int)( addr & 0xff));
+                 sprintf(temp, "%s #%s\n", tbuffer, tbuffer);
+                 sprintf(buffer + len, "%-89s\n", temp);
+                 len += 90;
+                 if (pos >= offset+length) {
+                     ReleaseReadLock(&afs_xcell);
+                     goto done;
+                 }
+             }
+         }
+     }
+ 
+     ReleaseReadLock(&afs_xcell);
+     
+ done:
+     *start = buffer + len - (pos - offset);
+     len = pos - offset;
+     if (len > length)
+         len = length;
+     return len;
+ }
+ 
+ 
+ int
  csdbproc_read(char *buffer, char **start, off_t offset, int count,
  	      int *eof, void *data)
  {
***************
*** 98,104 ****
  }
  
  static struct proc_dir_entry *openafs_procfs;
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
  static int ioctl32_done;
  #endif
  
--- 175,181 ----
  }
  
  static struct proc_dir_entry *openafs_procfs;
! #if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
  static int ioctl32_done;
  #endif
  
***************
*** 116,124 ****
  
      entry1->owner = THIS_MODULE;
  
!     entry2 = create_proc_read_entry(PROC_CELLSERVDB_NAME, (S_IFREG|S_IRUGO), openafs_procfs, csdbproc_read, NULL);
  
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
      if (register_ioctl32_conversion(VIOC_SYSCALL32, NULL) == 0) 
  	ioctl32_done = 1;
  #endif
--- 193,201 ----
  
      entry1->owner = THIS_MODULE;
  
!     entry2 = create_proc_info_entry(PROC_CELLSERVDB_NAME, (S_IFREG|S_IRUGO), openafs_procfs, csdbproc_info);
  
! #if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
      if (register_ioctl32_conversion(VIOC_SYSCALL32, NULL) == 0) 
  	ioctl32_done = 1;
  #endif
***************
*** 131,137 ****
      remove_proc_entry(PROC_CELLSERVDB_NAME, openafs_procfs);
      remove_proc_entry(PROC_SYSCALL_NAME, openafs_procfs);
      remove_proc_entry(PROC_FSDIRNAME, proc_root_fs);
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
      if (ioctl32_done)
  	    unregister_ioctl32_conversion(VIOC_SYSCALL32);
  #endif
--- 208,214 ----
      remove_proc_entry(PROC_CELLSERVDB_NAME, openafs_procfs);
      remove_proc_entry(PROC_SYSCALL_NAME, openafs_procfs);
      remove_proc_entry(PROC_FSDIRNAME, proc_root_fs);
! #if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
      if (ioctl32_done)
  	    unregister_ioctl32_conversion(VIOC_SYSCALL32);
  #endif
***************
*** 147,157 ****
  {
  
      struct afsprocdata sysargs;
      struct afsprocdata32 sysargs32;
  
      if (cmd != VIOC_SYSCALL && cmd != VIOC_SYSCALL32) return -EINVAL;
  
! #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
  #ifdef AFS_SPARC64_LINUX24_ENV
      if (current->thread.flags & SPARC_FLAG_32BIT)
  #elif defined(AFS_SPARC64_LINUX20_ENV)
--- 224,236 ----
  {
  
      struct afsprocdata sysargs;
+ #ifdef NEED_IOCTL32
      struct afsprocdata32 sysargs32;
+ #endif
  
      if (cmd != VIOC_SYSCALL && cmd != VIOC_SYSCALL32) return -EINVAL;
  
! #ifdef NEED_IOCTL32
  #ifdef AFS_SPARC64_LINUX24_ENV
      if (current->thread.flags & SPARC_FLAG_32BIT)
  #elif defined(AFS_SPARC64_LINUX20_ENV)
***************
*** 196,201 ****
--- 275,286 ----
      }
  }
  
+ #if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL)
+ static long afs_unlocked_ioctl(struct file *file, unsigned int cmd,
+                                unsigned long arg) {
+     return afs_ioctl(FILE_INODE(file), file, cmd, arg);
+ }
+ #endif
  
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
  int __init
Index: openafs/src/afs/LINUX/osi_prototypes.h
diff -c openafs/src/afs/LINUX/osi_prototypes.h:1.6.2.5 openafs/src/afs/LINUX/osi_prototypes.h:1.6.2.6
*** openafs/src/afs/LINUX/osi_prototypes.h:1.6.2.5	Fri Mar 11 01:50:41 2005
--- openafs/src/afs/LINUX/osi_prototypes.h	Sun Apr 24 16:11:15 2005
***************
*** 34,42 ****
  extern int osi_lookupname(char *aname, uio_seg_t seg, int followlink,
  			  struct dentry **dpp);
  extern int osi_InitCacheInfo(char *aname);
! extern int osi_rdwr(int rw, struct osi_file *file, caddr_t addrp,
! 		    size_t asize, size_t * resid);
! extern int osi_file_uio_rdwr(struct osi_file *osifile, uio_t * uiop, int rw);
  extern void afs_osi_SetTime(osi_timeval_t * tvp);
  extern void osi_linux_free_inode_pages(void);
  extern void check_bad_parent(struct dentry *dp);
--- 34,40 ----
  extern int osi_lookupname(char *aname, uio_seg_t seg, int followlink,
  			  struct dentry **dpp);
  extern int osi_InitCacheInfo(char *aname);
! extern int osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw);
  extern void afs_osi_SetTime(osi_timeval_t * tvp);
  extern void osi_linux_free_inode_pages(void);
  extern void check_bad_parent(struct dentry *dp);
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.13 openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.19
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.13	Fri Mar 11 01:51:11 2005
--- openafs/src/afs/LINUX/osi_vnodeops.c	Mon Apr 25 10:55:47 2005
***************
*** 22,33 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.13 2005/03/11 06:51:11 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
  #include "afs/afs_stats.h"
- #include "afs/afs_osidnlc.h"
  #include "h/mm.h"
  #ifdef HAVE_MM_INLINE_H
  #include "h/mm_inline.h"
--- 22,32 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.19 2005/04/25 14:55:47 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
  #include "afs/afs_stats.h"
  #include "h/mm.h"
  #ifdef HAVE_MM_INLINE_H
  #include "h/mm_inline.h"
***************
*** 426,431 ****
--- 425,437 ----
  extern int afs_xioctl(struct inode *ip, struct file *fp, unsigned int com,
  		      unsigned long arg);
  
+ #if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL)
+ static long afs_unlocked_xioctl(struct file *fp, unsigned int com,
+                                unsigned long arg) {
+     return afs_xioctl(FILE_INODE(fp), fp, com, arg);
+ 
+ }
+ #endif
  
  /* We need to detect unmap's after close. To do that, we need our own
   * vm_operations_struct's. And we need to set them up for both the
***************
*** 733,739 ****
--- 739,752 ----
    .read =	generic_read_dir,
  #endif
    .readdir =	afs_linux_readdir,
+ #ifdef HAVE_UNLOCKED_IOCTL
+   .unlocked_ioctl = afs_unlocked_xioctl,
+ #else
    .ioctl =	afs_xioctl,
+ #endif
+ #ifdef HAVE_COMPAT_IOCTL
+   .compat_ioctl = afs_unlocked_xioctl,
+ #endif
    .open =	afs_linux_open,
    .release =	afs_linux_release,
  };
***************
*** 741,747 ****
--- 754,767 ----
  struct file_operations afs_file_fops = {
    .read =	afs_linux_read,
    .write =	afs_linux_write,
+ #ifdef HAVE_UNLOCKED_IOCTL
+   .unlocked_ioctl = afs_unlocked_xioctl,
+ #else
    .ioctl =	afs_xioctl,
+ #endif
+ #ifdef HAVE_COMPAT_IOCTL
+   .compat_ioctl = afs_unlocked_xioctl,
+ #endif
    .mmap =	afs_linux_mmap,
    .open =	afs_linux_open,
    .flush =	afs_linux_flush,
***************
*** 844,927 ****
  afs_linux_dentry_revalidate(struct dentry *dp)
  #endif
  {
!     char *name = NULL;
!     cred_t *credp = crref();
      struct vrequest treq;
!     struct vcache *lookupvcp = NULL;
!     int code, bad_dentry = 1;
!     struct sysname_info sysState;
      struct vcache *vcp, *parentvcp;
  
-     sysState.allocked = 0;
- 
  #ifdef AFS_LINUX24_ENV
      lock_kernel();
  #endif
      AFS_GLOCK();
  
      vcp = ITOAFS(dp->d_inode);
!     parentvcp = ITOAFS(dp->d_parent->d_inode);
! 
!     /* If it's a negative dentry, then there's nothing to do. */
!     if (!vcp || !parentvcp)
! 	goto done;
  
!     /* If it is the AFS root, then there's no chance it needs 
!      * revalidating */
!     if (vcp == afs_globalVp) {
! 	bad_dentry = 0;
  	goto done;
      }
  
!     if ((code = afs_InitReq(&treq, credp)))
  	goto done;
  
!     Check_AtSys(parentvcp, dp->d_name.name, &sysState, &treq);
!     name = sysState.name;
  
!     /* First try looking up the DNLC */
!     if ((lookupvcp = osi_dnlc_lookup(parentvcp, name, WRITE_LOCK))) {
! 	/* Verify that the dentry does not point to an old inode */
! 	if (vcp != lookupvcp)
! 	    goto done;
! 	/* Check and correct mvid */
! 	if (*name != '/' && vcp->mvstat == 2)
! 	    check_bad_parent(dp);
! 	vcache2inode(vcp);
! 	bad_dentry = 0;
  	goto done;
      }
  
!     /* A DNLC lookup failure cannot be trusted. Try a real lookup. 
!        Make sure to try the real name and not the @sys expansion; 
!        afs_lookup will expand @sys itself. */
!   
!     code = afs_lookup(parentvcp, dp->d_name.name, &lookupvcp, credp);
  
!     /* Verify that the dentry does not point to an old inode */
!     if (vcp != lookupvcp)
! 	goto done;
  
      bad_dentry = 0;
  
    done:
      /* Clean up */
-     if (lookupvcp)
- 	afs_PutVCache(lookupvcp);
-     if (sysState.allocked)
- 	osi_FreeLargeSpace(name);
- 
      AFS_GUNLOCK();
- 
      if (bad_dentry) {
  	shrink_dcache_parent(dp);
  	d_drop(dp);
      }
- 
  #ifdef AFS_LINUX24_ENV
      unlock_kernel();
  #endif
!     crfree(credp);
  
      return !bad_dentry;
  }
--- 864,936 ----
  afs_linux_dentry_revalidate(struct dentry *dp)
  #endif
  {
!     cred_t *credp = NULL;
      struct vrequest treq;
!     int code, bad_dentry;
      struct vcache *vcp, *parentvcp;
  
  #ifdef AFS_LINUX24_ENV
      lock_kernel();
  #endif
      AFS_GLOCK();
  
      vcp = ITOAFS(dp->d_inode);
!     parentvcp = ITOAFS(dp->d_parent->d_inode);		/* dget_parent()? */
  
!     /* If it's a negative dentry, it's never valid */
!     if (!vcp || !parentvcp) {
! 	bad_dentry = 1;
  	goto done;
      }
  
!     /* If it's @sys, perhaps it has been changed */
!     if (!afs_ENameOK(dp->d_name.name)) {
! 	bad_dentry = 10;
  	goto done;
+     }
  
!     /* If it's the AFS root no chance it needs revalidating */
!     if (vcp == afs_globalVp)
! 	goto good_dentry;
  
!     /* Get a validated vcache entry */
!     credp = crref();
!     code = afs_InitReq(&treq, credp);
!     if (code) {
! 	bad_dentry = 2;
! 	goto done;
!     }
!     code = afs_VerifyVCache(vcp, &treq);
!     if (code) {
! 	bad_dentry = 3;
  	goto done;
      }
  
!     /* If we aren't the last looker, verify access */
!     if (vcp->last_looker != treq.uid) {
! 	if (!afs_AccessOK(vcp, (vType(vcp) == VREG) ? PRSFS_READ : PRSFS_LOOKUP, &treq, CHECK_MODE_BITS)) {
! 	    bad_dentry = 5;
! 	    goto done;
! 	}
  
! 	vcp->last_looker = treq.uid;
!     }
  
+   good_dentry:
      bad_dentry = 0;
  
    done:
      /* Clean up */
      AFS_GUNLOCK();
      if (bad_dentry) {
  	shrink_dcache_parent(dp);
  	d_drop(dp);
      }
  #ifdef AFS_LINUX24_ENV
      unlock_kernel();
  #endif
!     if (credp)
! 	crfree(credp);
  
      return !bad_dentry;
  }
***************
*** 931,947 ****
  static void
  afs_dentry_iput(struct dentry *dp, struct inode *ip)
  {
-     int isglock;
- 
-     if (ICL_SETACTIVE(afs_iclSetp)) {
- 	isglock = ISAFS_GLOCK();
- 	if (!isglock) AFS_GLOCK();
- 	afs_Trace3(afs_iclSetp, CM_TRACE_DENTRYIPUT, ICL_TYPE_POINTER, ip,
- 		   ICL_TYPE_STRING, dp->d_parent->d_name.name,
- 		   ICL_TYPE_STRING, dp->d_name.name);
- 	if (!isglock) AFS_GUNLOCK();
-     }
- 
      osi_iput(ip);
  }
  #endif
--- 940,945 ----
***************
*** 949,964 ****
  static int
  afs_dentry_delete(struct dentry *dp)
  {
-     int isglock;
-     if (ICL_SETACTIVE(afs_iclSetp)) {
- 	isglock = ISAFS_GLOCK();
- 	if (!isglock) AFS_GLOCK();
- 	afs_Trace3(afs_iclSetp, CM_TRACE_DENTRYDELETE, ICL_TYPE_POINTER,
- 		   dp->d_inode, ICL_TYPE_STRING, dp->d_parent->d_name.name,
- 		   ICL_TYPE_STRING, dp->d_name.name);
- 	if (!isglock) AFS_GUNLOCK();
-     }
- 
      if (dp->d_inode && (ITOAFS(dp->d_inode)->states & CUnlinked))
  	return 1;		/* bad inode? */
  
--- 947,952 ----
***************
*** 1835,1840 ****
--- 1823,1829 ----
    .follow_link =	page_follow_link,
  #else
    .follow_link =	page_follow_link_light,
+   .put_link =           page_put_link,
  #endif
    .setattr =		afs_notify_change,
  #else
Index: openafs/src/afs/NBSD/osi_machdep.h
diff -c openafs/src/afs/NBSD/osi_machdep.h:1.1 openafs/src/afs/NBSD/osi_machdep.h:1.1.8.1
*** openafs/src/afs/NBSD/osi_machdep.h:1.1	Tue Jan  1 14:32:58 2002
--- openafs/src/afs/NBSD/osi_machdep.h	Wed Apr 13 22:31:40 2005
***************
*** 76,84 ****
  	simple_unlock(&afs_global_lock); \
      } while(0)
  #endif /* 0 */
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
  
  #undef SPLVAR
  #define SPLVAR
--- 76,81 ----
Index: openafs/src/afs/OBSD/osi_machdep.h
diff -c openafs/src/afs/OBSD/osi_machdep.h:1.16.2.1 openafs/src/afs/OBSD/osi_machdep.h:1.16.2.4
*** openafs/src/afs/OBSD/osi_machdep.h:1.16.2.1	Fri Mar 11 01:50:43 2005
--- openafs/src/afs/OBSD/osi_machdep.h	Sun Apr 24 19:40:44 2005
***************
*** 16,22 ****
   * afs_osi.h.
   */
  
! /* $Id: osi_machdep.h,v 1.16.2.1 2005/03/11 06:50:43 shadow Exp $ */
  
  #ifndef _OSI_MACHDEP_H_
  #define _OSI_MACHDEP_H_
--- 16,22 ----
   * afs_osi.h.
   */
  
! /* $Id: osi_machdep.h,v 1.16.2.4 2005/04/24 23:40:44 shadow Exp $ */
  
  #ifndef _OSI_MACHDEP_H_
  #define _OSI_MACHDEP_H_
***************
*** 40,55 ****
  #define v_vfsp		v_mount
  
  /* vnode */
- #define SetAfsVnode(vn)		/* nothing; done in getnewvnode() */
- #define IsAfsVnode(vn)	((vn)->v_op == afs_vnodeop_p)
  #define VN_HOLD(vp)	afs_vget((vp), 0)
  #define VN_RELE(vp)	vrele(vp)
  #define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0)
  #define va_nodeid	va_fileid
  #define vnode_t		struct vnode
- #define vSetType(vc, type)	AFSTOV(vc)->v_type = (type)
- #define vSetVfsp(vc, vfsp)	AFSTOV(vc)->v_mount = (vfsp)
- #define vType(vc)		(vc)->v->v_type
  
  /* uio */
  #define afsio_iov	uio_iov
--- 40,50 ----
***************
*** 108,118 ****
  extern void afs_nbsd_Free(void *p, size_t asize);
  extern int afs_vget();
  
  #define	gop_lookupname(fnamep, segflg, followlink, compvpp) \
  	afs_nbsd_lookupname((fnamep), (segflg), (followlink), (compvpp))
  
  #ifdef KERNEL
- extern int (**afs_vnodeop_p) ();
  
  #ifdef AFS_GLOBAL_SUNLOCK
  extern struct proc *afs_global_owner;
--- 103,113 ----
  extern void afs_nbsd_Free(void *p, size_t asize);
  extern int afs_vget();
  
+ #undef gop_lookupname
  #define	gop_lookupname(fnamep, segflg, followlink, compvpp) \
  	afs_nbsd_lookupname((fnamep), (segflg), (followlink), (compvpp))
  
  #ifdef KERNEL
  
  #ifdef AFS_GLOBAL_SUNLOCK
  extern struct proc *afs_global_owner;
***************
*** 139,147 ****
  #define AFS_ASSERT_GLOCK()
  #define ISAFS_GLOCK() 1
  #endif
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
  
  #undef SPLVAR
  #define SPLVAR int splvar
--- 134,139 ----
Index: openafs/src/afs/SOLARIS/osi_machdep.h
diff -c openafs/src/afs/SOLARIS/osi_machdep.h:1.7 openafs/src/afs/SOLARIS/osi_machdep.h:1.7.2.1
*** openafs/src/afs/SOLARIS/osi_machdep.h:1.7	Wed Jul 28 23:13:50 2004
--- openafs/src/afs/SOLARIS/osi_machdep.h	Wed Apr 13 22:31:42 2005
***************
*** 74,83 ****
  #define AFS_GLOCK()	mutex_enter(&afs_global_lock);
  #define AFS_GUNLOCK()	mutex_exit(&afs_global_lock);
  #define ISAFS_GLOCK()	mutex_owned(&afs_global_lock)
- 
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK() 1
  #endif
  
  
--- 74,79 ----
Index: openafs/src/afs/UKERNEL/afs_usrops.c
diff -c openafs/src/afs/UKERNEL/afs_usrops.c:1.27.2.2 openafs/src/afs/UKERNEL/afs_usrops.c:1.27.2.3
*** openafs/src/afs/UKERNEL/afs_usrops.c:1.27.2.2	Fri Mar 11 01:50:46 2005
--- openafs/src/afs/UKERNEL/afs_usrops.c	Wed Apr 13 22:31:42 2005
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.27.2.2 2005/03/11 06:50:46 shadow Exp $");
  
  
  #ifdef	UKERNEL
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.27.2.3 2005/04/14 02:31:42 shadow Exp $");
  
  
  #ifdef	UKERNEL
***************
*** 459,474 ****
  {
      int index;
      osi_wait_t *waitp;
-     int rxGlockOwner = ISAFS_RXGLOCK();
      int glockOwner = ISAFS_GLOCK();
  
      usr_mutex_lock(&osi_waitq_lock);
      if (glockOwner) {
  	AFS_GUNLOCK();
      }
-     if (rxGlockOwner) {
- 	AFS_RXGUNLOCK();
-     }
      index = WAITHASH(x);
      if (osi_waithash_avail == NULL) {
  	waitp = (osi_wait_t *) afs_osi_Alloc(sizeof(osi_wait_t));
--- 459,470 ----
***************
*** 495,503 ****
      if (glockOwner) {
  	AFS_GLOCK();
      }
-     if (rxGlockOwner) {
- 	AFS_RXGLOCK();
-     }
  }
  
  int
--- 491,496 ----
***************
*** 533,539 ****
      osi_wait_t *waitp;
      struct timespec tv;
      int ret;
-     int rxGlockOwner = ISAFS_RXGLOCK();
      int glockOwner = ISAFS_GLOCK();
  
      tv.tv_sec = msec / 1000;
--- 526,531 ----
***************
*** 542,566 ****
  	if (glockOwner) {
  	    AFS_GUNLOCK();
  	}
- 	if (rxGlockOwner) {
- 	    AFS_RXGUNLOCK();
- 	}
  	usr_thread_sleep(&tv);
  	ret = 0;
  	if (glockOwner) {
  	    AFS_GLOCK();
  	}
- 	if (rxGlockOwner) {
- 	    AFS_RXGLOCK();
- 	}
      } else {
  	usr_mutex_lock(&osi_waitq_lock);
  	if (glockOwner) {
  	    AFS_GUNLOCK();
  	}
- 	if (rxGlockOwner) {
- 	    AFS_RXGUNLOCK();
- 	}
  	index = WAITHASH((caddr_t) handle);
  	if (osi_waithash_avail == NULL) {
  	    waitp = (osi_wait_t *) afs_osi_Alloc(sizeof(osi_wait_t));
--- 534,549 ----
***************
*** 593,601 ****
  	if (glockOwner) {
  	    AFS_GLOCK();
  	}
- 	if (rxGlockOwner) {
- 	    AFS_RXGLOCK();
- 	}
      }
      return ret;
  }
--- 576,581 ----
Index: openafs/src/afs/VNOPS/afs_vnop_lookup.c
diff -c openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.50.2.7 openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.50.2.8
*** openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.50.2.7	Sat Mar 26 02:11:37 2005
--- openafs/src/afs/VNOPS/afs_vnop_lookup.c	Sun Apr 24 10:03:24 2005
***************
*** 18,24 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.50.2.7 2005/03/26 07:11:37 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 18,24 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.50.2.8 2005/04/24 14:03:24 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 1198,1204 ****
  
      /* Check for read access as well.  We need read access in order to
       * stat files, but not to stat subdirectories. */
!     if (!afs_AccessOK(adp, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS))
  	no_read_access = 1;
  
      /* special case lookup of ".".  Can we check for it sooner in this code,
--- 1198,1204 ----
  
      /* Check for read access as well.  We need read access in order to
       * stat files, but not to stat subdirectories. */
!     if (!afs_AccessOK(adp, PRSFS_READ, &treq, CHECK_MODE_BITS))
  	no_read_access = 1;
  
      /* special case lookup of ".".  Can we check for it sooner in this code,
Index: openafs/src/afs/VNOPS/afs_vnop_read.c
diff -c openafs/src/afs/VNOPS/afs_vnop_read.c:1.26.2.1 openafs/src/afs/VNOPS/afs_vnop_read.c:1.26.2.2
*** openafs/src/afs/VNOPS/afs_vnop_read.c:1.26.2.1	Sun Apr  3 14:15:39 2005
--- openafs/src/afs/VNOPS/afs_vnop_read.c	Sun Apr 24 16:11:15 2005
***************
*** 19,25 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_read.c,v 1.26.2.1 2005/04/03 18:15:39 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 19,25 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_read.c,v 1.26.2.2 2005/04/24 20:11:15 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 788,794 ****
  	    AFS_GLOCK();
  #elif defined(AFS_LINUX20_ENV)
  	    AFS_GUNLOCK();
! 	    code = osi_file_uio_rdwr(tfile, &tuio, UIO_READ);
  	    AFS_GLOCK();
  #elif defined(AFS_DARWIN_ENV)
  	    AFS_GUNLOCK();
--- 788,794 ----
  	    AFS_GLOCK();
  #elif defined(AFS_LINUX20_ENV)
  	    AFS_GUNLOCK();
! 	    code = osi_rdwr(tfile, &tuio, UIO_READ);
  	    AFS_GLOCK();
  #elif defined(AFS_DARWIN_ENV)
  	    AFS_GUNLOCK();
Index: openafs/src/afs/VNOPS/afs_vnop_strategy.c
diff -c openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.18.2.1 openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.18.2.2
*** openafs/src/afs/VNOPS/afs_vnop_strategy.c:1.18.2.1	Sun Apr  3 14:15:40 2005
--- openafs/src/afs/VNOPS/afs_vnop_strategy.c	Sat Apr 23 20:58:06 2005
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.18.2.1 2005/04/03 18:15:40 shadow Exp $");
  
  #if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
  
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_strategy.c,v 1.18.2.2 2005/04/24 00:58:06 shadow Exp $");
  
  #if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
  
***************
*** 186,199 ****
  	code = afs_rdwr(VTOAFS(abp->b_vp), &tuio, UIO_WRITE, 0, credp);
  #endif
      }
! #if	!defined(AFS_AIX32_ENV) && !defined(AFS_SUN5_ENV)
! #if defined(AFS_DUX40_ENV) || (defined (AFS_XBSD_ENV) && !defined (AFS_FBSD50_ENV))
      if (code) {
  	abp->b_error = code;
  	abp->b_flags |= B_ERROR;
      }
      biodone(abp);
- #if defined(AFS_DUX40_ENV)
      if (code && !(abp->b_flags & B_READ)) {
  	/* prevent ubc from retrying writes */
  	AFS_GUNLOCK();
--- 186,205 ----
  	code = afs_rdwr(VTOAFS(abp->b_vp), &tuio, UIO_WRITE, 0, credp);
  #endif
      }
! 
! #if defined(AFS_DUX40_ENV) || defined (AFS_XBSD_ENV)
      if (code) {
  	abp->b_error = code;
+ #if !defined(AFS_FBSD50_ENV)
  	abp->b_flags |= B_ERROR;
+ #endif
      }
+ #endif
+ 
+ #if defined(AFS_AIX32_ENV)
+     crfree(credp);
+ #elif defined(AFS_DUX40_ENV)
      biodone(abp);
      if (code && !(abp->b_flags & B_READ)) {
  	/* prevent ubc from retrying writes */
  	AFS_GUNLOCK();
***************
*** 201,216 ****
  		       (vm_offset_t) dbtob(abp->b_blkno), PAGE_SIZE, B_INVAL);
  	AFS_GLOCK();
      }
! #endif
  #elif defined(AFS_FBSD50_ENV)
      biodone(&abp->b_io);
! #else /* AFS_DUX40_ENV */
      iodone(abp);
- #endif /* AFS_DUX40_ENV */
- #endif
- #ifdef	AFS_AIX32_ENV
-     crfree(credp);
  #endif
      afs_Trace3(afs_iclSetp, CM_TRACE_STRATEGYDONE, ICL_TYPE_POINTER, tvc,
  	       ICL_TYPE_INT32, code, ICL_TYPE_LONG, tuio.afsio_resid);
      return code;
--- 207,222 ----
  		       (vm_offset_t) dbtob(abp->b_blkno), PAGE_SIZE, B_INVAL);
  	AFS_GLOCK();
      }
! #elif defined(AFS_FBSD60_ENV)
!     (*abp->b_iodone)(abp);
  #elif defined(AFS_FBSD50_ENV)
      biodone(&abp->b_io);
! #elif defined(AFS_XBSD_ENV)
!     biodone(abp);
! #elif !defined(AFS_SUN5_ENV)
      iodone(abp);
  #endif
+ 
      afs_Trace3(afs_iclSetp, CM_TRACE_STRATEGYDONE, ICL_TYPE_POINTER, tvc,
  	       ICL_TYPE_INT32, code, ICL_TYPE_LONG, tuio.afsio_resid);
      return code;
Index: openafs/src/afs/VNOPS/afs_vnop_write.c
diff -c openafs/src/afs/VNOPS/afs_vnop_write.c:1.36.2.4 openafs/src/afs/VNOPS/afs_vnop_write.c:1.36.2.5
*** openafs/src/afs/VNOPS/afs_vnop_write.c:1.36.2.4	Sun Apr  3 14:15:40 2005
--- openafs/src/afs/VNOPS/afs_vnop_write.c	Sun Apr 24 16:11:15 2005
***************
*** 21,27 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.36.2.4 2005/04/03 18:15:40 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 21,27 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.36.2.5 2005/04/24 20:11:15 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 560,566 ****
  	}
  #elif defined(AFS_LINUX20_ENV)
  	AFS_GUNLOCK();
! 	code = osi_file_uio_rdwr(tfile, &tuio, UIO_WRITE);
  	AFS_GLOCK();
  #elif defined(AFS_DARWIN_ENV)
  	AFS_GUNLOCK();
--- 560,566 ----
  	}
  #elif defined(AFS_LINUX20_ENV)
  	AFS_GUNLOCK();
! 	code = osi_rdwr(tfile, &tuio, UIO_WRITE);
  	AFS_GLOCK();
  #elif defined(AFS_DARWIN_ENV)
  	AFS_GUNLOCK();
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.43.2.5 openafs/src/afsd/afsd.c:1.43.2.7
*** openafs/src/afsd/afsd.c:1.43.2.5	Sun Apr  3 14:15:41 2005
--- openafs/src/afsd/afsd.c	Sun Apr 24 10:28:40 2005
***************
*** 57,63 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.43.2.5 2005/04/03 18:15:41 shadow Exp $");
  
  #define VFS 1
  
--- 57,63 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.43.2.7 2005/04/24 14:28:40 shadow Exp $");
  
  #define VFS 1
  
***************
*** 333,340 ****
    *	Sets globals.
    *---------------------------------------------------------------------------*/
  
! int
! ParseCacheInfoFile()
  {
      static char rn[] = "ParseCacheInfoFile";	/*This routine's name */
      FILE *cachefd;		/*Descriptor for cache info file */
--- 333,339 ----
    *	Sets globals.
    *---------------------------------------------------------------------------*/
  
! int ParseCacheInfoFile(void)
  {
      static char rn[] = "ParseCacheInfoFile";	/*This routine's name */
      FILE *cachefd;		/*Descriptor for cache info file */
***************
*** 396,403 ****
  	    ("\tcacheMountDir: '%s'\n\tcacheBaseDir: '%s'\n\tcacheBlocks: %d\n",
  	     tmd, tbd, tCacheBlocks);
      }
!     if (!(cacheFlags & AFSCALL_INIT_MEMCACHE))
! 	PartSizeOverflow(tbd, cacheBlocks);
  
      return (0);
  }
--- 395,403 ----
  	    ("\tcacheMountDir: '%s'\n\tcacheBaseDir: '%s'\n\tcacheBlocks: %d\n",
  	     tmd, tbd, tCacheBlocks);
      }
!     if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)) {
! 	return(PartSizeOverflow(tbd, cacheBlocks));
!     }
  
      return (0);
  }
***************
*** 407,416 ****
   * isn't a mounted partition it's also ignored since we can't guarantee 
   * what will be stored afterwards. Too many if's. This is now purely
   * advisory. ODS with over 2G partition also gives warning message.
   */
! PartSizeOverflow(path, cs)
!      char *path;
!      int cs;
  {
      int bsize = -1, totalblks, mint;
  #if AFS_HAVE_STATVFS
--- 407,418 ----
   * isn't a mounted partition it's also ignored since we can't guarantee 
   * what will be stored afterwards. Too many if's. This is now purely
   * advisory. ODS with over 2G partition also gives warning message.
+  *
+  * Returns:
+  *	0 if everything went well,
+  *	1 otherwise.
   */
! int PartSizeOverflow(char *path, int cs)
  {
      int bsize = -1, totalblks, mint;
  #if AFS_HAVE_STATVFS
***************
*** 425,431 ****
      }
      totalblks = statbuf.f_blocks;
      bsize = statbuf.f_frsize;
! #else
      struct statfs statbuf;
  
      if (statfs(path, &statbuf) < 0) {
--- 427,441 ----
      }
      totalblks = statbuf.f_blocks;
      bsize = statbuf.f_frsize;
! #if AFS_AIX51_ENV
!     if(strcmp(statbuf.f_basetype, "jfs")) {
!         fprintf(stderr, "Cache filesystem '%s' must be jfs (now %s)\n",
!                 path, statbuf.f_basetype);
!         return 1;
!     }
! #endif /* AFS_AIX51_ENV */
! 
! #else /* AFS_HAVE_STATVFS */
      struct statfs statbuf;
  
      if (statfs(path, &statbuf) < 0) {
***************
*** 453,459 ****
--- 463,472 ----
  	printf
  	    ("Cache size (%d) must be less than 95%% of partition size (which is %d). Lower cache size\n",
  	     cs, mint);
+         return 1;
      }
+ 
+     return 0;
  }
  
  /*-----------------------------------------------------------------------------
***************
*** 1761,1766 ****
--- 1774,1787 ----
  	    printf("%s: Forking AFSDB lookup handler.\n", rn);
  	code = fork();
  	if (code == 0) {
+ 	    /* Since the AFSDB lookup handler runs as a user process, 
+ 	     * need to drop the controlling TTY, etc.
+ 	     */
+ 	    if (daemon(0, 0) == -1) {
+ 		printf("Error starting AFSDB lookup handler: %s\n",
+ 			strerror(errno));
+ 		exit(1);
+ 	    }
  	    AfsdbLookupHandler();
  	    exit(1);
  	}
Index: openafs/src/bozo/bosserver.c
diff -c openafs/src/bozo/bosserver.c:1.23 openafs/src/bozo/bosserver.c:1.23.2.3
*** openafs/src/bozo/bosserver.c:1.23	Sun Dec  7 17:49:18 2003
--- openafs/src/bozo/bosserver.c	Tue Apr 26 21:37:04 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/bozo/bosserver.c,v 1.23 2003/12/07 22:49:18 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.3 2005/04/27 01:37:04 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 580,585 ****
--- 580,586 ----
  }
  #endif
  
+ #if 0
  /*
   * This routine causes the calling process to go into the background and
   * to lose its controlling tty.
***************
*** 701,706 ****
--- 702,708 ----
      }
  }
  #endif /* ! AFS_NT40_ENV */
+ #endif
  
  /* start a process and monitor it */
  
***************
*** 718,723 ****
--- 720,726 ----
      char namebuf[AFSDIR_PATH_MAX];
  #ifndef AFS_NT40_ENV
      int nofork = 0;
+     struct stat sb;
  #endif
  #ifdef	AFS_AIX32_ENV
      struct sigaction nsa;
***************
*** 856,869 ****
      fflush(stdout);
  #endif
  
!     /* go into the background and remove our controlling tty */
  
  #ifndef AFS_NT40_ENV
      if (!nofork)
! 	background();
  #endif /* ! AFS_NT40_ENV */
  
!     if (!DoSyslog) {
  	strcpy(namebuf, AFSDIR_BOZLOG_FILE);
  	strcat(namebuf, ".old");
  	renamefile(AFSDIR_BOZLOG_FILE, namebuf);	/* try rename first */
--- 859,879 ----
      fflush(stdout);
  #endif
  
!     /* go into the background and remove our controlling tty, close open 
!        file desriptors
!      */
  
  #ifndef AFS_NT40_ENV
      if (!nofork)
! 	daemon(1, 0);
  #endif /* ! AFS_NT40_ENV */
  
!     if ((!DoSyslog)
! #ifndef AFS_NT40_ENV
! 	&& (!(fstat(AFSDIR_BOZLOG_FILE, &sb) == 0) && 
! 	(S_ISFIFO(sb.st_mode)))
! #endif
! 	) {
  	strcpy(namebuf, AFSDIR_BOZLOG_FILE);
  	strcat(namebuf, ".old");
  	renamefile(AFSDIR_BOZLOG_FILE, namebuf);	/* try rename first */
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.20.2.5 openafs/src/cf/linux-test4.m4:1.20.2.6
*** openafs/src/cf/linux-test4.m4:1.20.2.5	Sun Mar 20 15:38:55 2005
--- openafs/src/cf/linux-test4.m4	Wed Apr 13 21:18:49 2005
***************
*** 251,256 ****
--- 251,271 ----
  AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_inotify_lock)
  CPPFLAGS="$save_CPPFLAGS"])
  
+ AC_DEFUN([LINUX_FS_STRUCT_INODE_HAS_INOTIFY_SEM], [
+ AC_MSG_CHECKING(for inotify_sem in struct inode)
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS"
+ AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_inotify_sem, 
+ [
+ AC_TRY_COMPILE(
+ [#include <linux/fs.h>],
+ [struct inode _inode;
+ printf("%x\n", _inode.inotify_sem);], 
+ ac_cv_linux_fs_struct_inode_has_inotify_sem=yes,
+ ac_cv_linux_fs_struct_inode_has_inotify_sem=no)])
+ AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_inotify_sem)
+ CPPFLAGS="$save_CPPFLAGS"])
+ 
  
  AC_DEFUN([LINUX_FS_STRUCT_INODE_HAS_I_MAPPING_OVERLOAD], [
  AC_MSG_CHECKING(for i_mapping_overload in struct inode)
Index: openafs/src/cf/osconf.m4
diff -c openafs/src/cf/osconf.m4:1.51.2.13 openafs/src/cf/osconf.m4:1.51.2.16
*** openafs/src/cf/osconf.m4:1.51.2.13	Sun Apr  3 16:01:13 2005
--- openafs/src/cf/osconf.m4	Wed Apr 27 23:07:30 2005
***************
*** 433,438 ****
--- 433,451 ----
  		EXTRA_VLIBOBJS="fstab.o"
  		;;
  
+ 	ppc_darwin_80)
+ 		AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration"
+ 		LEX="lex -l"
+ 		MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}'
+ 		KROOT=
+ 		KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers'
+ 		LWP_OPTMZ="-O2"
+ 		REGEX_OBJ="regex.o"
+ 		XCFLAGS="-no-cpp-precomp"
+ 		TXLIBS="-lncurses"
+ 		EXTRA_VLIBOBJS="fstab.o"
+ 		;;
+ 
  	ppc_linux*)
  		KERN_OPTMZ=-O2
  		LEX="flex -l"
***************
*** 491,496 ****
--- 504,525 ----
  		SHLIB_LINKER="${MT_CC} -bM:SRE -berok"
  		AIX64=""
  		;;
+ 
+ 	rs_aix53)	
+ 		DBG="-g"
+ 		LEX="lex"
+ 		LIBSYS_AIX_EXP="afsl.exp"
+ 		MT_CC="xlc_r"
+ 		MT_CFLAGS='-DAFS_PTHREAD_ENV ${XCFLAGS}'
+ 		MT_LIBS="-lpthreads"
+ 		SHLIB_SUFFIX="o"
+ 		TXLIBS="-lcurses"
+ 		XCFLAGS="-K -D_NO_PROTO -D_NONSTD_TYPES -D_MBI=void"
+ 		XLIBS="${LIB_AFSDB} -ldl"
+ 		SHLIB_LINKER="${MT_CC} -bM:SRE -berok"
+ 		AIX64=""
+ 		;;
+ 
  	s390_linux22)
  		CC="gcc"
  		CCOBJ="gcc"
***************
*** 535,541 ****
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_CFLAGS="-O -Dlinux -DLINUX_PAM -fPIC"
! 		SHLIB_LDFLAGS="-shared -Xlinker -x"
  		TXLIBS="-lncurses"
  		XCFLAGS="-O -g -D_LARGEFILE64_SOURCE -D__s390x__"
  		YACC="bison -y"
--- 564,570 ----
  		MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
  		MT_LIBS="-lpthread"
  		PAM_CFLAGS="-O -Dlinux -DLINUX_PAM -fPIC"
! 		SHLIB_LDFLAGS="-shared -Xlinker -x -Xlinker -Bsymbolic"
  		TXLIBS="-lncurses"
  		XCFLAGS="-O -g -D_LARGEFILE64_SOURCE -D__s390x__"
  		YACC="bison -y"
Index: openafs/src/comerr/.cvsignore
diff -c openafs/src/comerr/.cvsignore:1.1 openafs/src/comerr/.cvsignore:1.1.14.1
*** openafs/src/comerr/.cvsignore:1.1	Mon Sep 10 16:14:12 2001
--- openafs/src/comerr/.cvsignore	Sat Apr 23 20:59:13 2005
***************
*** 2,4 ****
--- 2,5 ----
  Makefile
  compile_et
  et_lex.lex.c
+ y.tab.h
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.1.2.4 openafs/src/config/NTMakefile.amd64_w2k:1.1.2.5
*** openafs/src/config/NTMakefile.amd64_w2k:1.1.2.4	Mon Apr  4 07:38:39 2005
--- openafs/src/config/NTMakefile.amd64_w2k	Thu Apr 28 14:13:30 2005
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8100
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8200
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.46.2.19 openafs/src/config/NTMakefile.i386_nt40:1.46.2.20
*** openafs/src/config/NTMakefile.i386_nt40:1.46.2.19	Mon Apr  4 07:38:39 2005
--- openafs/src/config/NTMakefile.i386_nt40	Thu Apr 28 14:13:30 2005
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8100
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8200
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/config/NTMakefile.i386_w2k
diff -c openafs/src/config/NTMakefile.i386_w2k:1.1.2.4 openafs/src/config/NTMakefile.i386_w2k:1.1.2.5
*** openafs/src/config/NTMakefile.i386_w2k:1.1.2.4	Mon Apr  4 07:38:39 2005
--- openafs/src/config/NTMakefile.i386_w2k	Thu Apr 28 14:13:30 2005
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8100
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8200
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.50.2.11 openafs/src/config/afs_sysnames.h:1.50.2.14
*** openafs/src/config/afs_sysnames.h:1.50.2.11	Sun Apr  3 16:01:14 2005
--- openafs/src/config/afs_sysnames.h	Sat Apr 23 20:58:06 2005
***************
*** 48,53 ****
--- 48,54 ----
  #define SYS_NAME_ID_hp_ux11i             416
  #define SYS_NAME_ID_ia64_hpux1122	 417
  #define SYS_NAME_ID_ia64_hpux1123	 418
+ #define SYS_NAME_ID_hp_ux1123		 419
  
  #define SYS_NAME_ID_mac2_51		 500
  #define SYS_NAME_ID_mac_aux10		 501
***************
*** 67,72 ****
--- 68,74 ----
  #define SYS_NAME_ID_rs_aix51		 704
  #define SYS_NAME_ID_rs_aix43		 705
  #define SYS_NAME_ID_rs_aix52		 706
+ #define SYS_NAME_ID_rs_aix53		 707
  
  #define SYS_NAME_ID_sun3_411		 906
  #define SYS_NAME_ID_sun3x_411		 912
***************
*** 172,177 ****
--- 174,180 ----
  #define SYS_NAME_ID_i386_fbsd_51        2106
  #define SYS_NAME_ID_i386_fbsd_52        2107
  #define SYS_NAME_ID_i386_fbsd_53        2108
+ #define SYS_NAME_ID_i386_fbsd_60        2112
  
  #define SYS_NAME_ID_ia64_linux2		2200
  #define SYS_NAME_ID_ia64_linux22	2201
Index: openafs/src/config/param.alpha_linux_22.h
diff -c openafs/src/config/param.alpha_linux_22.h:1.5 openafs/src/config/param.alpha_linux_22.h:1.5.2.2
*** openafs/src/config/param.alpha_linux_22.h:1.5	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.alpha_linux_22.h	Wed Apr 27 17:56:13 2005
***************
*** 42,49 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
  #include <linux/modversions.h>
--- 42,49 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
  #include <linux/modversions.h>
***************
*** 63,68 ****
--- 63,69 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.alpha_linux_24.h
diff -c openafs/src/config/param.alpha_linux_24.h:1.5 openafs/src/config/param.alpha_linux_24.h:1.5.2.2
*** openafs/src/config/param.alpha_linux_24.h:1.5	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.alpha_linux_24.h	Sun Apr 24 20:02:18 2005
***************
*** 44,51 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
  #include <linux/modversions.h>
--- 44,51 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
  #include <linux/modversions.h>
***************
*** 65,70 ****
--- 65,71 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.alpha_linux_26.h
diff -c openafs/src/config/param.alpha_linux_26.h:1.1.2.1 openafs/src/config/param.alpha_linux_26.h:1.1.2.3
*** openafs/src/config/param.alpha_linux_26.h:1.1.2.1	Sun Apr  3 16:01:14 2005
--- openafs/src/config/param.alpha_linux_26.h	Sun Apr 24 20:02:18 2005
***************
*** 54,61 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
  #include <afs/afs_sysnames.h>
--- 54,61 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
  #include <afs/afs_sysnames.h>
***************
*** 67,72 ****
--- 67,73 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.amd64_linux24.h
diff -c openafs/src/config/param.amd64_linux24.h:1.3 openafs/src/config/param.amd64_linux24.h:1.3.2.2
*** openafs/src/config/param.amd64_linux24.h:1.3	Mon Aug  9 00:07:33 2004
--- openafs/src/config/param.amd64_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 55,62 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 55,62 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 78,83 ****
--- 78,84 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.amd64_linux26.h
diff -c openafs/src/config/param.amd64_linux26.h:1.1.2.2 openafs/src/config/param.amd64_linux26.h:1.1.2.4
*** openafs/src/config/param.amd64_linux26.h:1.1.2.2	Tue Dec  7 01:09:26 2004
--- openafs/src/config/param.amd64_linux26.h	Sun Apr 24 20:02:18 2005
***************
*** 49,56 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
--- 49,56 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
***************
*** 63,68 ****
--- 63,69 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.hp_ux1123.h
diff -c /dev/null openafs/src/config/param.hp_ux1123.h:1.1.2.1
*** /dev/null	Thu Apr 28 22:55:47 2005
--- openafs/src/config/param.hp_ux1123.h	Wed Apr 13 21:40:09 2005
***************
*** 0 ****
--- 1,102 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ /* THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define AFS_HPUX_ENV	1
+ #define	AFS_HPUX90_ENV	1
+ #define	AFS_HPUX100_ENV	1
+ #define	AFS_HPUX101_ENV	1
+ #define	AFS_HPUX102_ENV	1
+ #define	AFS_HPUX110_ENV	1
+ #define	AFS_HPUX1111_ENV 1
+ #define	AFS_HPUX1122_ENV 1
+ #define	AFS_HPUX1123_ENV 1
+ 
+ #define AFS_64BIT_ENV		1       /* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1
+ #if defined(__LP64__)
+ #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
+ #endif
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_SYSCALL	48 /* slot reserved for AFS */
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"hp_ux1123"
+ #define SYS_NAME_ID	SYS_NAME_ID_hp_ux1123
+ #define AFSBIG_ENDIAN	1
+ #define AFS_HAVE_FFS    1
+ #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_GLOBAL_SUNLOCK 1
+ #define RXK_LISTENER_ENV   1
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define AFS_GCPAGS		0       /* if nonzero, garbage collect PAGs */
+ #define AFS_USE_VOID_PTR 1
+ /*
+  * #define AFS_VM_RDWR_ENV	1
+  */
+ #define AFS_TEXT_ENV	1	/* Older kernels use TEXT */
+ #define AFS_USE_GETTIMEOFDAY 1  /* use gettimeofday to implement rx clock */
+ #define NEARINODE_HINT  1   /* hint to ufs module to scatter inodes on disk*/
+ #define nearInodeHash(volid, hval) {                                 \
+                 unsigned char*  ts = (unsigned char*)&(volid)+sizeof(volid)-1;\
+                 for ( (hval)=0; ts >= (unsigned char*)&(volid); ts--){\
+                     (hval) *= 173;                      \
+                     (hval) += *ts;                      \
+                 }                                       \
+                 }
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef KERNEL
+ #define _KERNEL 1
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_seg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIOSEG_KERNEL
+ #define	AFS_UIOUSER	UIOSEG_USER
+ #define	AFS_CLBYTES	CLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	osi_GetTime(x)	do { struct timeval osi_GetTimeVar; uniqtime(&osi_GetTimeVar); (x)->tv_sec = osi_GetTimeVar.tv_sec; (x)->tv_usec = osi_GetTimeVar.tv_usec; } while(0)
+ #define	AFS_KALLOC	kmem_alloc
+ #define	AFS_KFREE	kmem_free
+ #define	VATTR_NULL	vattr_null
+ 
+ #if defined(__LP64__)
+ #define AFS_HPUX_64BIT_ENV 1
+ #endif
+ 
+ #ifndef UKERNEL
+ /*
+  * On HP-UX, sys/socket.h includes sys/uio.h, and sys/file.h and
+  * sys/uio.h #include each other, and there's no simple way to avoid a
+  * warning about the struct uio declaration not being visible outside
+  * of some prototype or other.  So, we put in a tenative declaration to
+  * supress the warnings.
+  */
+ struct uio;
+ 
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
+ #endif
+ #endif /* KERNEL */
+ #define	AFS_DIRENT	
+ /* Non-standard definitions */
+ #ifndef	EDQUOT
+ #define	EDQUOT		69	/* Disc quota exceeded 		*/
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.i386_fbsd_60.h
diff -c /dev/null openafs/src/config/param.i386_fbsd_60.h:1.1.2.2
*** /dev/null	Thu Apr 28 22:55:47 2005
--- openafs/src/config/param.i386_fbsd_60.h	Sun Apr 24 16:10:27 2005
***************
*** 0 ****
--- 1,203 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #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_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_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_VM_RDWR_ENV	1
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_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 SYS_NAME	"i386_fbsd_60"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_60
+ 
+ #define AFS_HAVE_FFS            1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS	0	/* System doesn't supports statvfs */
+ 
+ #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 */
+ 
+ #define AFSLITTLE_ENDIAN 1
+ 
+ /* 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_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 */
+ 
+ /* Machine / Operating system information */
+ #include <afs/afs_sysnames.h>
+ #define SYS_NAME	"i386_fbsd_60"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_60
+ 
+ #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 */
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include <limits.h>
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/fcntl.h>
+ #include <netinet/in.h>
+ #include <sys/uio.h>
+ #include <sys/socket.h>
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.i386_linux22.h
diff -c openafs/src/config/param.i386_linux22.h:1.15 openafs/src/config/param.i386_linux22.h:1.15.2.2
*** openafs/src/config/param.i386_linux22.h:1.15	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.i386_linux22.h	Wed Apr 27 17:56:13 2005
***************
*** 47,54 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 47,54 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 71,76 ****
--- 71,77 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.i386_linux24.h
diff -c openafs/src/config/param.i386_linux24.h:1.19 openafs/src/config/param.i386_linux24.h:1.19.2.2
*** openafs/src/config/param.i386_linux24.h:1.19	Fri Jul 25 00:30:31 2003
--- openafs/src/config/param.i386_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 44,51 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 44,51 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 63,68 ****
--- 63,69 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.i386_linux26.h
diff -c openafs/src/config/param.i386_linux26.h:1.3 openafs/src/config/param.i386_linux26.h:1.3.2.2
*** openafs/src/config/param.i386_linux26.h:1.3	Thu Jul 29 17:29:18 2004
--- openafs/src/config/param.i386_linux26.h	Sun Apr 24 20:02:18 2005
***************
*** 50,57 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
--- 50,57 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
***************
*** 64,69 ****
--- 64,70 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.i386_umlinux22.h
diff -c openafs/src/config/param.i386_umlinux22.h:1.2 openafs/src/config/param.i386_umlinux22.h:1.2.2.2
*** openafs/src/config/param.i386_umlinux22.h:1.2	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.i386_umlinux22.h	Wed Apr 27 17:56:13 2005
***************
*** 49,56 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 49,56 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 73,78 ****
--- 73,79 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.i386_umlinux24.h
diff -c openafs/src/config/param.i386_umlinux24.h:1.2 openafs/src/config/param.i386_umlinux24.h:1.2.2.2
*** openafs/src/config/param.i386_umlinux24.h:1.2	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.i386_umlinux24.h	Sun Apr 24 20:02:18 2005
***************
*** 52,59 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 52,59 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 71,76 ****
--- 71,77 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.i386_umlinux26.h
diff -c openafs/src/config/param.i386_umlinux26.h:1.1.2.1 openafs/src/config/param.i386_umlinux26.h:1.1.2.3
*** openafs/src/config/param.i386_umlinux26.h:1.1.2.1	Tue Dec  7 01:08:46 2004
--- openafs/src/config/param.i386_umlinux26.h	Sun Apr 24 20:02:18 2005
***************
*** 50,57 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
--- 50,57 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
***************
*** 64,69 ****
--- 64,70 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.ia64_linux24.h
diff -c openafs/src/config/param.ia64_linux24.h:1.9 openafs/src/config/param.ia64_linux24.h:1.9.2.2
*** openafs/src/config/param.ia64_linux24.h:1.9	Mon Aug  9 00:07:33 2004
--- openafs/src/config/param.ia64_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 55,62 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 55,62 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 78,83 ****
--- 78,84 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.ia64_linux26.h
diff -c openafs/src/config/param.ia64_linux26.h:1.1.2.2 openafs/src/config/param.ia64_linux26.h:1.1.2.4
*** openafs/src/config/param.ia64_linux26.h:1.1.2.2	Sun Feb 20 20:12:43 2005
--- openafs/src/config/param.ia64_linux26.h	Sun Apr 24 20:02:18 2005
***************
*** 64,71 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 64,71 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 87,92 ****
--- 87,93 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.parisc_linux24.h
diff -c openafs/src/config/param.parisc_linux24.h:1.7 openafs/src/config/param.parisc_linux24.h:1.7.2.2
*** openafs/src/config/param.parisc_linux24.h:1.7	Mon Aug  9 00:07:33 2004
--- openafs/src/config/param.parisc_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 39,46 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 39,46 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 61,66 ****
--- 61,67 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.ppc64_linux24.h
diff -c openafs/src/config/param.ppc64_linux24.h:1.2 openafs/src/config/param.ppc64_linux24.h:1.2.2.2
*** openafs/src/config/param.ppc64_linux24.h:1.2	Mon Aug  9 00:07:33 2004
--- openafs/src/config/param.ppc64_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 43,50 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 43,50 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 66,71 ****
--- 66,72 ----
  #define AFS_HAVE_FFS        1       /* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.ppc64_linux26.h
diff -c openafs/src/config/param.ppc64_linux26.h:1.1.2.1 openafs/src/config/param.ppc64_linux26.h:1.1.2.3
*** openafs/src/config/param.ppc64_linux26.h:1.1.2.1	Thu Feb 24 00:05:50 2005
--- openafs/src/config/param.ppc64_linux26.h	Sun Apr 24 20:02:18 2005
***************
*** 49,57 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
! 
  
  #endif /* __KERNEL__  && !DUMP_KERNEL*/
  
--- 49,56 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
! #define AFS_GLOBAL_SUNLOCK
  
  #endif /* __KERNEL__  && !DUMP_KERNEL*/
  
***************
*** 68,73 ****
--- 67,73 ----
  #define AFS_HAVE_FFS        1       /* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0  /* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1   /* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.ppc_darwin_80.h
diff -c /dev/null openafs/src/config/param.ppc_darwin_80.h:1.1.2.1
*** /dev/null	Thu Apr 28 22:55:47 2005
--- openafs/src/config/param.ppc_darwin_80.h	Tue Apr 19 12:03:06 2005
***************
*** 0 ****
--- 1,141 ----
+ #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
+ #define AFS_PPC_ENV 1
+ #define AFS_VFSINCL_ENV 1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ #define AFS_DARWIN_ENV
+ #define AFS_DARWIN13_ENV
+ #define AFS_DARWIN14_ENV
+ #define AFS_DARWIN60_ENV
+ #define AFS_DARWIN70_ENV
+ #define AFS_DARWIN80_ENV
+ #define AFS_NONFSTRANS
+ #define AFS_SYSCALL             230
+ #define AFS_NAMEI_ENV 1
+ #define DARWIN_REFBASE 3
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS    "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_ppc_darwin_12   1
+ #define sys_ppc_darwin_13   1
+ #define sys_ppc_darwin_14   1
+ #define sys_ppc_darwin_60   1
+ #define sys_ppc_darwin_70   1
+ #define sys_ppc_darwin_80   1
+ #define SYS_NAME        "ppc_darwin_80"
+ #define SYS_NAME_ID     SYS_NAME_ID_ppc_darwin_80
+ #define AFSBIG_ENDIAN   1
+ #define AFS_HAVE_FFS    1	/* Use system's ffs. */
+ 
+ #define AFS_GCPAGS                1	/* if nonzero, garbage collect PAGs */
+ #define RXK_LISTENER_ENV         1
+ 
+ #ifdef KERNEL
+ #undef MACRO_BEGIN
+ #undef MACRO_END
+ #include <kern/macro_help.h>
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define AFS_VFS34       1	/* What is VFS34??? */
+ #define afsio_iov       uio_iov
+ #define afsio_iovcnt    uio_iovcnt
+ #define afsio_offset    uio_offset
+ #define afsio_seg       uio_segflg
+ #define afsio_resid     uio_resid
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ #define AFS_CLBYTES     CLBYTES
+ #define osi_GetTime(x)  microtime(x)
+ #define AFS_KALLOC(x)   kalloc(x)
+ #define AFS_KFREE(x,y)  kfree(x,y)
+ #define v_count         v_usecount
+ #define v_vfsp          v_mount
+ #define vfs_bsize       mnt_stat.f_bsize
+ #define vfs_fsid        mnt_stat.f_fsid
+ #define va_nodeid       va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct          dirent
+ #define vnode_t         struct vnode
+ 
+ //#define VN_RELE(vp)     vrele(((struct vnode *)(vp)))
+ //#define VN_HOLD(vp)     VREF(((struct vnode *)(vp)))
+ #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. */
+ #define AFS_PPC_ENV 1
+ 
+ #include <afs/afs_sysnames.h>
+ #define AFS_USERSPACE_ENV
+ #define AFS_USR_DARWIN_ENV
+ #define AFS_USR_DARWIN13_ENV
+ #define AFS_USR_DARWIN14_ENV
+ #define AFS_USR_DARWIN60_ENV
+ #define AFS_USR_DARWIN70_ENV
+ #define AFS_USR_DARWIN80_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 */
+ #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_NAME        "ppc_darwin_80"
+ #define SYS_NAME_ID     SYS_NAME_ID_ppc_darwin_80
+ #define AFSBIG_ENDIAN   1
+ #define AFS_HAVE_FFS    1	/* Use system's ffs. */
+ 
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ 
+ #define AFS_GCPAGS                0	/* if nonzero, garbage collect PAGs */
+ #define RXK_LISTENER_ENV          1
+ 
+ #define AFS_VFS34       1	/* What is VFS34??? */
+ #define afsio_iov       uio_iov
+ #define afsio_iovcnt    uio_iovcnt
+ #define afsio_offset    uio_offset
+ #define afsio_seg       uio_segflg
+ #define afsio_resid     uio_resid
+ #define AFS_UIOSYS      UIO_SYSSPACE
+ #define AFS_UIOUSER     UIO_USERSPACE
+ #define        VATTR_NULL      usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #define BIND_8_COMPAT
+ #endif /* AFS_PARAM_H */
+ 
+ #endif /* !defined(UKERNEL) */
Index: openafs/src/config/param.ppc_linux22.h
diff -c openafs/src/config/param.ppc_linux22.h:1.8 openafs/src/config/param.ppc_linux22.h:1.8.2.2
*** openafs/src/config/param.ppc_linux22.h:1.8	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.ppc_linux22.h	Wed Apr 27 17:56:13 2005
***************
*** 35,42 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 35,42 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 58,63 ****
--- 58,64 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.ppc_linux24.h
diff -c openafs/src/config/param.ppc_linux24.h:1.10 openafs/src/config/param.ppc_linux24.h:1.10.2.2
*** openafs/src/config/param.ppc_linux24.h:1.10	Mon Aug  9 00:07:34 2004
--- openafs/src/config/param.ppc_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 41,48 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 41,48 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 63,68 ****
--- 63,69 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.ppc_linux26.h
diff -c openafs/src/config/param.ppc_linux26.h:1.1.2.1 openafs/src/config/param.ppc_linux26.h:1.1.2.3
*** openafs/src/config/param.ppc_linux26.h:1.1.2.1	Tue Nov  9 12:19:58 2004
--- openafs/src/config/param.ppc_linux26.h	Sun Apr 24 20:02:18 2005
***************
*** 47,54 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
--- 47,54 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  
***************
*** 65,70 ****
--- 65,71 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV            1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.rs_aix53.h
diff -c /dev/null openafs/src/config/param.rs_aix53.h:1.1.2.2
*** /dev/null	Thu Apr 28 22:55:47 2005
--- openafs/src/config/param.rs_aix53.h	Sun Apr 24 10:28:43 2005
***************
*** 0 ****
--- 1,182 ----
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define	AFS_AIX_ENV		1
+ #define	AFS_AIX32_ENV		1
+ #define	AFS_AIX41_ENV		1
+ #define AFS_AIX42_ENV		1
+ #define AFS_AIX51_ENV		1
+ #define AFS_AIX52_ENV		1
+ #define AFS_AIX53_ENV		1
+ 
+ #define AFS_64BIT_ENV		1
+ #define AFS_64BIT_CLIENT	1
+ #define AFS_NAMEI_ENV		1
+ #ifdef AFS_NAMEI_ENV
+ #define AFS_64BIT_IOPS_ENV	1
+ #endif
+ #define BITMAP_LATER		1
+ #define FAST_RESTART		1
+ 
+ #define AFS_HAVE_FLOCK_SYSID    1
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ /* Global lock in AFS part of client. */
+ #define AFS_GLOBAL_SUNLOCK 1
+ #define AFS_GCPAGS		1	/* if nonzero, garbage collect PAGs */
+ 
+ /* File system entry (used if vmount.h doesn't define MNT_AFS */
+ #define AFS_MOUNT_AFS	4
+ #define AFS_SYSCALL    31
+ 
+ /* Machine / Operating system information */
+ #define SYS_NAME	"rs_aix53"
+ #define SYS_NAME_ID	SYS_NAME_ID_rs_aix53
+ #define AFSBIG_ENDIAN	1
+ #define RIOS		1	/* POWERseries 6000. (sj/pc)    */
+ #define AFS_VM_RDWR_ENV 1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
+ #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
+ 
+ #ifndef _POWER
+ #define _POWER		1	/* _POWERseries!                */
+ #endif
+ #ifndef COMPAT_43
+ #define COMPAT_43
+ #endif
+ 
+ #define KERNEL_HAVE_UERROR 1
+ #define KERNEL_HAVE_PIN 1
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define	AFS_SHORTGID	1
+ #define	AFS_UIOFMODE	1
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	AFS_MINCHANGE	2
+ #define osi_GetTime(x)          do {curtime(x); (x)->tv_usec = (x)->tv_usec/1000;} while (0)
+ #define	osi_GTime(x)	time	/* something for the silly time(0)?? */
+ #define	AFS_KALLOC	kmem_alloc
+ #define	AFS_KFREE	kmem_free
+ #define	VATTR_NULL(V)	memset((void*)V, -1, sizeof(*(V)))
+ #define va_nodeid	va_serialno
+ #endif /* !_KERNEL      */
+ #define	AFS_DIRENT
+ #endif /* AFS_PARAM_H */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define AFS_64BIT_ENV           1
+ #define AFS_64BIT_CLIENT        1
+ #define AFS_NAMEI_ENV           1
+ #ifdef AFS_NAMEI_ENV
+ #define AFS_64BIT_IOPS_ENV	1
+ #endif
+ #define BITMAP_LATER            1
+ #define FAST_RESTART            1
+ 
+ #define AFS_VFS_ENV	1
+ /* Used only in vfsck code; is it needed any more???? */
+ #define RXK_LISTENER_ENV	1
+ #define AFS_USERSPACE_IP_ADDR	1
+ #define AFS_GCPAGS		0	/* if nonzero, garbage collect PAGs */
+ 
+ #ifdef KERNEL
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_USR_AIX_ENV		1
+ #define AFS_USR_AIX41_ENV	1
+ #define AFS_USR_AIX42_ENV	1
+ #define AFS_USR_AIX51_ENV		1
+ 
+ #else /* KERNEL */
+ 
+ #define	AFS_AIX_ENV		1
+ #define	AFS_AIX32_ENV		1
+ #define	AFS_AIX41_ENV		1
+ #define AFS_AIX42_ENV		1
+ #define AFS_AIX51_ENV		1
+ 
+ #define AFS_HAVE_FLOCK_SYSID    1
+ 
+ #endif /* KERNEL */
+ 
+ #include <afs/afs_sysnames.h>
+ 
+ 													       /*#define AFS_GLOBAL_SUNLOCK    1 *//* For global locking */
+ 
+ #define	AFS_3DISPARES		1	/* Utilize the 3 available disk inode 'spares' */
+ #define	AFS_SYSCALL		105
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS	 4
+ 
+ /* Machine / Operating system information */
+ #define sys_rs_aix51	1
+ #define SYS_NAME	"rs_aix51"
+ #define SYS_NAME_ID	SYS_NAME_ID_rs_aix51
+ #define AFSBIG_ENDIAN	1
+ #define AFS_HAVE_FFS            1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS	0	/* System doesn't support statvfs */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef KERNEL
+ #define	AFS_UIOFMODE		1	/* Only in afs/afs_vnodeops.c (afs_ustrategy) */
+ #define	AFS_SYSVLOCK		1	/* sys v locking supported */
+ /*#define	AFS_USEBUFFERS	1*/
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ #endif /* KERNEL */
+ #define	AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #endif /* AFS_PARAM_H */
+ 
+ #endif /* !defined(UKERNEL) */
Index: openafs/src/config/param.s390_linux22.h
diff -c openafs/src/config/param.s390_linux22.h:1.10 openafs/src/config/param.s390_linux22.h:1.10.2.2
*** openafs/src/config/param.s390_linux22.h:1.10	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.s390_linux22.h	Wed Apr 27 17:56:13 2005
***************
*** 48,55 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 48,55 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 71,76 ****
--- 71,77 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.s390_linux24.h
diff -c openafs/src/config/param.s390_linux24.h:1.12 openafs/src/config/param.s390_linux24.h:1.12.2.2
*** openafs/src/config/param.s390_linux24.h:1.12	Mon Aug  9 00:07:34 2004
--- openafs/src/config/param.s390_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 54,61 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
  #include <linux/modversions.h>
--- 54,61 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
  #include <linux/modversions.h>
***************
*** 75,80 ****
--- 75,81 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.s390x_linux24.h
diff -c openafs/src/config/param.s390x_linux24.h:1.1.2.1 openafs/src/config/param.s390x_linux24.h:1.1.2.3
*** openafs/src/config/param.s390x_linux24.h:1.1.2.1	Wed Aug 25 03:03:38 2004
--- openafs/src/config/param.s390x_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 59,66 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
  #include <linux/modversions.h>
--- 59,66 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
  #include <linux/modversions.h>
***************
*** 80,85 ****
--- 80,86 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.s390x_linux26.h
diff -c openafs/src/config/param.s390x_linux26.h:1.1.2.1 openafs/src/config/param.s390x_linux26.h:1.1.2.3
*** openafs/src/config/param.s390x_linux26.h:1.1.2.1	Sun Feb 20 20:15:36 2005
--- openafs/src/config/param.s390x_linux26.h	Sun Apr 24 20:02:18 2005
***************
*** 63,70 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  extern unsigned long __per_cpu_offset[NR_CPUS];
  extern SYSCALLTYPE sys_call_table_emu[] __attribute__((weak));
  #endif /* __KERNEL__  && !DUMP_KERNEL */
--- 63,70 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  extern unsigned long __per_cpu_offset[NR_CPUS];
  extern SYSCALLTYPE sys_call_table_emu[] __attribute__((weak));
  #endif /* __KERNEL__  && !DUMP_KERNEL */
***************
*** 82,87 ****
--- 82,88 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.sparc64_linux22.h
diff -c openafs/src/config/param.sparc64_linux22.h:1.8 openafs/src/config/param.sparc64_linux22.h:1.8.2.2
*** openafs/src/config/param.sparc64_linux22.h:1.8	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.sparc64_linux22.h	Wed Apr 27 17:56:13 2005
***************
*** 50,57 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 50,57 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 73,78 ****
--- 73,79 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.sparc64_linux24.h
diff -c openafs/src/config/param.sparc64_linux24.h:1.7 openafs/src/config/param.sparc64_linux24.h:1.7.2.2
*** openafs/src/config/param.sparc64_linux24.h:1.7	Mon Aug  9 00:07:34 2004
--- openafs/src/config/param.sparc64_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 57,64 ****
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #define __SMP__
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  #include <afs/afs_sysnames.h>
--- 57,64 ----
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #define __SMP__
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #endif /* __KERNEL__  && !DUMP_KERNEL */
  #include <afs/afs_sysnames.h>
***************
*** 74,79 ****
--- 74,80 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  
  #ifdef KERNEL
Index: openafs/src/config/param.sparc_linux22.h
diff -c openafs/src/config/param.sparc_linux22.h:1.9 openafs/src/config/param.sparc_linux22.h:1.9.2.2
*** openafs/src/config/param.sparc_linux22.h:1.9	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.sparc_linux22.h	Wed Apr 27 17:56:13 2005
***************
*** 45,52 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 45,52 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 67,72 ****
--- 67,73 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
Index: openafs/src/config/param.sparc_linux24.h
diff -c openafs/src/config/param.sparc_linux24.h:1.8 openafs/src/config/param.sparc_linux24.h:1.8.2.2
*** openafs/src/config/param.sparc_linux24.h:1.8	Mon Aug  9 00:07:34 2004
--- openafs/src/config/param.sparc_linux24.h	Sun Apr 24 20:02:18 2005
***************
*** 50,57 ****
  #ifndef __SMP__
  #define __SMP__
  #endif
- #define AFS_GLOBAL_SUNLOCK
  #endif
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
--- 50,57 ----
  #ifndef __SMP__
  #define __SMP__
  #endif
  #endif
+ #define AFS_GLOBAL_SUNLOCK
  
  #if defined(MODULE) && defined(CONFIG_MODVERSIONS)
  #define MODVERSIONS
***************
*** 72,77 ****
--- 72,78 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #ifdef KERNEL
  #ifndef MIN
***************
*** 149,154 ****
--- 150,156 ----
  #define AFS_HAVE_FFS        1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS    0	/* System doesn't support statvfs */
  #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY       1	/* use gettimeofday to implement rx clock */
  
  #define	afsio_iov	uio_iov
  #define	afsio_iovcnt	uio_iovcnt
Index: openafs/src/config/param.sunx86_510.h
diff -c openafs/src/config/param.sunx86_510.h:1.2.2.4 openafs/src/config/param.sunx86_510.h:1.2.2.5
*** openafs/src/config/param.sunx86_510.h:1.2.2.4	Sun Apr  3 14:15:48 2005
--- openafs/src/config/param.sunx86_510.h	Tue Apr 19 12:03:13 2005
***************
*** 34,40 ****
  #define AFS_X86_ENV		1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
- #define AFS_64BIT_CLIENT	1	
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
--- 34,39 ----
***************
*** 101,106 ****
--- 100,106 ----
  #if defined(__amd64)
  #define	AFS_SUN57_64BIT_ENV	1
  #define AFS_64BIT_INO   	1
+ #define AFS_64BIT_CLIENT	1	
  #endif
  
  /**
Index: openafs/src/config/param.sunx86_57.h
diff -c openafs/src/config/param.sunx86_57.h:1.4.2.1 openafs/src/config/param.sunx86_57.h:1.4.2.2
*** openafs/src/config/param.sunx86_57.h:1.4.2.1	Sun Apr  3 14:15:48 2005
--- openafs/src/config/param.sunx86_57.h	Tue Apr 19 12:03:13 2005
***************
*** 86,112 ****
  #define	AFS_MINCHANGE	2
  #define	osi_GetTime(x)	uniqtime(x)
  
- /**
-   * These defines are for the 64 bit Solaris 7 port
-   * AFS_SYSCALL32 is used to protect the ILP32 syscall interface
-   * AFS_64BIT_ENV is for use of 64 bit inode numbers
-   */
- #if defined(__sparcv9)
- #define	AFS_SUN57_64BIT_ENV	1
- #define AFS_64BIT_INO   	1
- #endif
- 
- /**
-   * Solaris 7 64 bit has two versions of uniqtime. Since we consistently
-   * use 32 bit quantities for time in afs, we now use uniqtime32
-   */
- #if defined(AFS_SUN57_64BIT_ENV)
- #undef osi_GetTime
- #define osi_GetTime(x)  uniqtime32(x)
- #endif
- 
- 
- 
  #define	AFS_KALLOC(n)	kmem_alloc(n, KM_SLEEP)
  #define AFS_KALLOC_NOSLEEP(n)   kmem_alloc(n, KM_NOSLEEP)
  #define	AFS_KFREE	kmem_free
--- 86,91 ----
Index: openafs/src/config/param.sunx86_58.h
diff -c openafs/src/config/param.sunx86_58.h:1.6.2.1 openafs/src/config/param.sunx86_58.h:1.6.2.2
*** openafs/src/config/param.sunx86_58.h:1.6.2.1	Sun Apr  3 14:15:48 2005
--- openafs/src/config/param.sunx86_58.h	Tue Apr 19 12:03:13 2005
***************
*** 33,39 ****
  #define AFS_X86_ENV		1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
- #define AFS_64BIT_CLIENT	1	
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
--- 33,38 ----
***************
*** 92,118 ****
  #define	AFS_MINCHANGE	2
  #define	osi_GetTime(x)	uniqtime(x)
  
- /**
-   * These defines are for the 64 bit Solaris 7 port
-   * AFS_SYSCALL32 is used to protect the ILP32 syscall interface
-   * AFS_64BIT_ENV is for use of 64 bit inode numbers
-   */
- #if defined(__sparcv9)
- #define	AFS_SUN57_64BIT_ENV	1
- #define AFS_64BIT_INO   	1
- #endif
- 
- /**
-   * Solaris 7 64 bit has two versions of uniqtime. Since we consistently
-   * use 32 bit quantities for time in afs, we now use uniqtime32
-   */
- #if defined(AFS_SUN57_64BIT_ENV)
- #undef osi_GetTime
- #define osi_GetTime(x)  uniqtime32(x)
- #endif
- 
- 
- 
  #define	AFS_KALLOC(n)	kmem_alloc(n, KM_SLEEP)
  #define AFS_KALLOC_NOSLEEP(n)   kmem_alloc(n, KM_NOSLEEP)
  #define	AFS_KFREE	kmem_free
--- 91,96 ----
Index: openafs/src/config/param.sunx86_59.h
diff -c openafs/src/config/param.sunx86_59.h:1.2.2.1 openafs/src/config/param.sunx86_59.h:1.2.2.2
*** openafs/src/config/param.sunx86_59.h:1.2.2.1	Sun Apr  3 14:15:48 2005
--- openafs/src/config/param.sunx86_59.h	Tue Apr 19 12:03:13 2005
***************
*** 34,40 ****
  #define AFS_X86_ENV		1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
- #define AFS_64BIT_CLIENT	1	
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
--- 34,39 ----
***************
*** 93,119 ****
  #define	AFS_MINCHANGE	2
  #define	osi_GetTime(x)	uniqtime(x)
  
- /**
-   * These defines are for the 64 bit Solaris 7 port
-   * AFS_SYSCALL32 is used to protect the ILP32 syscall interface
-   * AFS_64BIT_ENV is for use of 64 bit inode numbers
-   */
- #if defined(__sparcv9)
- #define	AFS_SUN57_64BIT_ENV	1
- #define AFS_64BIT_INO   	1
- #endif
- 
- /**
-   * Solaris 7 64 bit has two versions of uniqtime. Since we consistently
-   * use 32 bit quantities for time in afs, we now use uniqtime32
-   */
- #if defined(AFS_SUN57_64BIT_ENV)
- #undef osi_GetTime
- #define osi_GetTime(x)  uniqtime32(x)
- #endif
- 
- 
- 
  #define	AFS_KALLOC(n)	kmem_alloc(n, KM_SLEEP)
  #define AFS_KALLOC_NOSLEEP(n)   kmem_alloc(n, KM_NOSLEEP)
  #define	AFS_KFREE	kmem_free
--- 92,97 ----
Index: openafs/src/export/Makefile.in
diff -c openafs/src/export/Makefile.in:1.15.2.2 openafs/src/export/Makefile.in:1.15.2.4
*** openafs/src/export/Makefile.in:1.15.2.2	Wed Aug 25 03:13:48 2004
--- openafs/src/export/Makefile.in	Sat Apr 23 20:59:03 2005
***************
*** 163,169 ****
  @AIX64@	${INSTALL} $? $@
  
  ${DEST}/root.client/usr/vice/etc/dkload/cfgafs: cfgafs
! @AIX64@	${INSTALL} $? $@
  
  ${DEST}/root.client/usr/vice/etc/dkload/cfgafs64: @AIX64@cfgafs64
  @AIX64@	${INSTALL} $? $@
--- 163,169 ----
  @AIX64@	${INSTALL} $? $@
  
  ${DEST}/root.client/usr/vice/etc/dkload/cfgafs: cfgafs
! 	${INSTALL} $? $@
  
  ${DEST}/root.client/usr/vice/etc/dkload/cfgafs64: @AIX64@cfgafs64
  @AIX64@	${INSTALL} $? $@
Index: openafs/src/libacl/acl.h
diff -c openafs/src/libacl/acl.h:1.3 openafs/src/libacl/acl.h:1.3.2.1
*** openafs/src/libacl/acl.h:1.3	Tue Jul 15 19:15:18 2003
--- openafs/src/libacl/acl.h	Sun Apr 24 19:16:31 2005
***************
*** 54,60 ****
  username or groupname followed by a decimal number representing the rights mask for that name.  Each
  entry in the list looks as if it had been produced by printf() using a format list of "%s\t%d\n".
  
! Note that the number of entries must be less than ACL_MAXENTRIES
  */
  
  /* This is temporary hack to get around changing the volume package
--- 54,60 ----
  username or groupname followed by a decimal number representing the rights mask for that name.  Each
  entry in the list looks as if it had been produced by printf() using a format list of "%s\t%d\n".
  
! Note that the number of entries must be less than or equal to ACL_MAXENTRIES
  */
  
  /* This is temporary hack to get around changing the volume package
Index: openafs/src/libafs/MakefileProto.AIX.in
diff -c openafs/src/libafs/MakefileProto.AIX.in:1.23 openafs/src/libafs/MakefileProto.AIX.in:1.23.2.1
*** openafs/src/libafs/MakefileProto.AIX.in:1.23	Mon Jun 21 15:53:07 2004
--- openafs/src/libafs/MakefileProto.AIX.in	Tue Apr 19 11:55:20 2005
***************
*** 70,76 ****
  
  <rs_aix42>
  KMODS=32 
! <rs_aix50 rs_aix51 rs_aix52>
  KMODS=32 64
  <all>
  
--- 70,76 ----
  
  <rs_aix42>
  KMODS=32 
! <rs_aix50 rs_aix51 rs_aix52 rs_aix53>
  KMODS=32 64
  <all>
  
Index: openafs/src/libafs/MakefileProto.DARWIN.in
diff -c openafs/src/libafs/MakefileProto.DARWIN.in:1.21 openafs/src/libafs/MakefileProto.DARWIN.in:1.21.2.1
*** openafs/src/libafs/MakefileProto.DARWIN.in:1.21	Sun Aug  8 19:12:57 2004
--- openafs/src/libafs/MakefileProto.DARWIN.in	Tue Apr 19 12:03:07 2005
***************
*** 4,10 ****
  # 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
! # $Header: /cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.21 2004/08/08 23:12:57 shadow Exp $
  # 
  # MakefileProto for Digital Unix systems
  #
--- 4,10 ----
  # 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
! # $Header: /cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.21.2.1 2005/04/19 16:03:07 shadow Exp $
  # 
  # MakefileProto for Digital Unix systems
  #
***************
*** 40,46 ****
  <ppc_darwin_14 ppc_darwin_13 ppc_darwin_12>
  KOPTS=-no-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
  <all>
! CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${KINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG} ${OPTMZ}
  KINCLUDES=-I${KROOT}/System/Library/Frameworks/Kernel.Framework/Headers
  
  
--- 40,46 ----
  <ppc_darwin_14 ppc_darwin_13 ppc_darwin_12>
  KOPTS=-no-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
  <all>
! CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG} ${OPTMZ}
  KINCLUDES=-I${KROOT}/System/Library/Frameworks/Kernel.Framework/Headers
  
  
Index: openafs/src/libafs/MakefileProto.HPUX.in
diff -c openafs/src/libafs/MakefileProto.HPUX.in:1.19 openafs/src/libafs/MakefileProto.HPUX.in:1.19.2.1
*** openafs/src/libafs/MakefileProto.HPUX.in:1.19	Thu Dec  4 11:10:50 2003
--- openafs/src/libafs/MakefileProto.HPUX.in	Wed Apr 13 21:40:09 2005
***************
*** 21,33 ****
  	osi_vm.o
  
  AFS_OS_NFSOBJS = \
! <ia64_hpux1123>
  	hpux_mod_nfs.modmeta.o \
  <all>
  	osi_vfsops_nfs.o
  
  AFS_OS_NONFSOBJS = \
! <ia64_hpux1123>
  	hpux_mod.modmeta.o \
  <all>
  	osi_vfsops.o
--- 21,33 ----
  	osi_vm.o
  
  AFS_OS_NFSOBJS = \
! <ia64_hpux1123 hp_ux1123>
  	hpux_mod_nfs.modmeta.o \
  <all>
  	osi_vfsops_nfs.o
  
  AFS_OS_NONFSOBJS = \
! <ia64_hpux1123 hp_ux1123>
  	hpux_mod.modmeta.o \
  <all>
  	osi_vfsops.o
***************
*** 57,62 ****
--- 57,64 ----
  # for 11.23, see the DDK BE/Sample_makefiles/Makefile.bld
  # for mod drivers.
  #
+ # 11.23 uses new compiler, with new options. The same compiler is on pa_risc and ia64 
+ #
  <hp_ux110 hp_ux102 hp_ux11i>
  KDEFS= +ES1.Xindirect_calls +XixdU +Hx0 +ESlit +ESsfc +ESssf -Wp,-H300000 -D_KERNEL -D_KERNEL_BUILD -D_UNSUPPORTED \
  	-DMP +R500 -Wl,+k $(CPU_KDEFS)
***************
*** 76,81 ****
--- 78,89 ----
  KDEFS_64 = +DD64
  
  <ia64_hpux1123>
+ ARCH=ipf
+ 
+ <hp_ux1123>
+ ARCH=pa
+ 
+ <ia64_hpux1123 hp_ux1123>
  
  CCOPTS_common= -Ae +DD64 +O2
  
***************
*** 93,103 ****
  
  LDOPTS_ipf= +noobjdebug
  
  # above from the Makefile.bld example
  
! LDOPTS= $(LDOPTS_ipf)
  KDEFS= $(CCOPTS_common) $(IDENTS_common) $(CPU_KDEFS) 
! KDEFS_64= $(CCOPTS_ipf) $(IDENTS_ipf)
  
  MODLINK=/opt/ddk/11.23/BE/bin/modlink
  MODMETA=/opt/ddk/11.23/BE/bin/modmeta
--- 101,124 ----
  
  LDOPTS_ipf= +noobjdebug
  
+ # Definitions which apply to PA only
+ 
+ CCOPTS_pa= +DS2.0 +ES1.Xindirect_calls +ESlit +ESsfc +ESssf \
+ 	+ordering_unaware +Oentrysched +Ofastaccess +Omultiprocessor \
+ 	-Wp,-H300000 +Xid
+ 
+ IDENTS_pa= -DCOMB_FLIPPER -DKGDB_ON -DLP64_TMP_NODBG -DNEW_MFCTL_W \
+ 	-DNEW_RDB -DPARISC -DRDB -DSPP_OBP_BOOT -DSPP_RUNWAY_ERR_ENABLED \
+ 	-D__NO_EM_HDRS -D__ROSEVILLE__ -D__TEMP64__ -D__hp9000s800
+ 
+ LDOPTS_pa=
+ 
+ 
  # above from the Makefile.bld example
  
! LDOPTS= ${LDOPTS_${ARCH}}
  KDEFS= $(CCOPTS_common) $(IDENTS_common) $(CPU_KDEFS) 
! KDEFS_64= ${CCOPTS_${ARCH}} ${IDENTS_${ARCH}}
  
  MODLINK=/opt/ddk/11.23/BE/bin/modlink
  MODMETA=/opt/ddk/11.23/BE/bin/modmeta
***************
*** 121,127 ****
  
  <hp_ux11i hp_ux110 hp_ux102>
  BITS = 64 32
! <ia64_hpux1122 ia64_hpux1123>
  BITS = 64
  <all>
  
--- 142,148 ----
  
  <hp_ux11i hp_ux110 hp_ux102>
  BITS = 64 32
! <ia64_hpux1122 ia64_hpux1123 hp_ux1123>
  BITS = 64
  <all>
  
***************
*** 144,150 ****
  	ln -fs /etc/conf/ufs ufs
  <ia64_hpux1122>
  	ln -fs /etc/conf/sys ufs
! <ia64_hpux1123>
  	ln -fs /usr/include/sys h
  	ln -fs /usr/include/net net
  	ln -fs /usr/include/netinet netinet
--- 165,171 ----
  	ln -fs /etc/conf/ufs ufs
  <ia64_hpux1122>
  	ln -fs /etc/conf/sys ufs
! <ia64_hpux1123 hp_ux1123>
  	ln -fs /usr/include/sys h
  	ln -fs /usr/include/net net
  	ln -fs /usr/include/netinet netinet
***************
*** 190,199 ****
  
  
  # Below this line are targets when in the static directory:
! <all -ia64_hpux1123>
  LIBAFS = libafs$(BITSUFFIX).a
  LIBAFSNONFS = libafs$(BITSUFFIX).nonfs.a
! <ia64_hpux1123>
  LIBAFS = afs$(BITSUFFIX)_nfs
  LIBAFSNONFS =afs$(BITSUFFIX)
  <all>
--- 211,220 ----
  
  
  # Below this line are targets when in the static directory:
! <all -ia64_hpux1123 -hp_ux1123>
  LIBAFS = libafs$(BITSUFFIX).a
  LIBAFSNONFS = libafs$(BITSUFFIX).nonfs.a
! <ia64_hpux1123 hp_ux1123>
  LIBAFS = afs$(BITSUFFIX)_nfs
  LIBAFSNONFS =afs$(BITSUFFIX)
  <all>
***************
*** 222,243 ****
  	${INSTALL} -f $? $@
  
  ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
! <all -ia64_hpux1123>
  	$(AR) cru $@ $?
  	$(RANLIB) $@
! <ia64_hpux1123>
  	$(MODLINK) -o $@ $(AFSAOBJS) $(AFSNFSOBJS)
  <all>
  
  ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
! <all -ia64_hpux1123>
  	$(AR) cru $@ $?
  	$(RANLIB) $@
! <ia64_hpux1123>
  	$(MODLINK) -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
  <all>
  
! <ia64_hpux1123>
  hpux_mod.modmeta.c: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/hpux_mod.modmeta
  	$(MODMETA) ${IDENTS_common} ${IDENTS_ipf} \
  		-DAFSLIB_NAME=${LIBAFSNONFS} \
--- 243,264 ----
  	${INSTALL} -f $? $@
  
  ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
! <all -ia64_hpux1123 -hp_ux1123>
  	$(AR) cru $@ $?
  	$(RANLIB) $@
! <ia64_hpux1123 hp_ux1123>
  	$(MODLINK) -o $@ $(AFSAOBJS) $(AFSNFSOBJS)
  <all>
  
  ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
! <all -ia64_hpux1123 -hp_ux1123>
  	$(AR) cru $@ $?
  	$(RANLIB) $@
! <ia64_hpux1123 hp_ux1123>
  	$(MODLINK) -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
  <all>
  
! <ia64_hpux1123 hp_ux1123>
  hpux_mod.modmeta.c: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/hpux_mod.modmeta
  	$(MODMETA) ${IDENTS_common} ${IDENTS_ipf} \
  		-DAFSLIB_NAME=${LIBAFSNONFS} \
Index: openafs/src/libafs/afs.ppc_darwin_70.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2 openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.1
*** openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2	Fri Oct 24 02:26:11 2003
--- openafs/src/libafs/afs.ppc_darwin_70.plist.in	Thu Apr 28 22:45:47 2005
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.2.10</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.2.10</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.82</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.3.82</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
Index: openafs/src/libafs/afs.ppc_darwin_80.plist.in
diff -c /dev/null openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.1.2.1
*** /dev/null	Thu Apr 28 22:55:48 2005
--- openafs/src/libafs/afs.ppc_darwin_80.plist.in	Tue Apr 19 12:03:07 2005
***************
*** 0 ****
--- 1,31 ----
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+ <plist version="0.9">
+ <dict>
+ 	<key>CFBundleDevelopmentRegion</key>
+ 	<string>English</string>
+ 	<key>CFBundleExecutable</key>
+ 	<string>afs</string>
+ 	<key>CFBundleIdentifier</key>
+ 	<string>org.openafs.filesystems.afs</string>
+ 	<key>CFBundleInfoDictionaryVersion</key>
+ 	<string>8.0</string>
+ 	<key>CFBundleName</key>
+ 	<string>afs</string>
+ 	<key>CFBundlePackageType</key>
+ 	<string>KEXT</string>
+ 	<key>CFBundleShortVersionString</key>
+ 	<string>1.3.82</string>
+ 	<key>CFBundleSignature</key>
+ 	<string>????</string>
+ 	<key>CFBundleVersion</key>
+ 	<string>1.3.82</string>
+ 	<key>OSBundleLibraries</key>
+ 	<dict>
+ 		<key>com.apple.kernel.bsd</key>
+ 		<string>8.0.0</string>
+ 		<key>com.apple.kernel.mach</key>
+ 		<string>8.0.0</string>
+ 	</dict>
+ </dict>
+ </plist>
Index: openafs/src/libafsauthent/NTMakefile
diff -c openafs/src/libafsauthent/NTMakefile:1.10.2.2 openafs/src/libafsauthent/NTMakefile:1.10.2.3
*** openafs/src/libafsauthent/NTMakefile:1.10.2.2	Tue Dec  7 01:15:56 2004
--- openafs/src/libafsauthent/NTMakefile	Thu Apr 28 08:08:24 2005
***************
*** 8,14 ****
  # This is a pthread safe library containing ubikclient, auth, kauth.
  
  
! AFSDEV_AUXCDEFINES = -DAFS_PTHREAD_ENV
  
  RELDIR=libafsauthent
  !include ..\config\NTMakefile.$(SYS_NAME)
--- 8,14 ----
  # This is a pthread safe library containing ubikclient, auth, kauth.
  
  
! AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -DAFS_PTHREAD_ENV -I..\WINNT\kfw\inc\loadfuncs -I..\WINNT\kfw\inc\krb5
  
  RELDIR=libafsauthent
  !include ..\config\NTMakefile.$(SYS_NAME)
Index: openafs/src/libafsrpc/afsrpc.def
diff -c openafs/src/libafsrpc/afsrpc.def:1.3.2.2 openafs/src/libafsrpc/afsrpc.def:1.3.2.3
*** openafs/src/libafsrpc/afsrpc.def:1.3.2.2	Fri Mar 11 02:03:24 2005
--- openafs/src/libafsrpc/afsrpc.def	Tue Apr 19 01:13:48 2005
***************
*** 212,216 ****
--- 212,217 ----
          RXAFS_ResidencyCmd                      @217
          StartRXAFS_FetchData64                  @218
          StartRXAFS_StoreData64                  @219
+         rx_StartClientThread                    @220
  
  
Index: openafs/src/packaging/MacOS/OpenAFS.Info.plist
diff -c openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.8 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.9
*** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.8	Wed Apr  6 01:03:43 2005
--- openafs/src/packaging/MacOS/OpenAFS.Info.plist	Thu Apr 28 22:45:48 2005
***************
*** 3,15 ****
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.3.81</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.81</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
--- 3,15 ----
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.3.82</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.82</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
Index: openafs/src/packaging/MacOS/OpenAFS.info
diff -c openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.8 openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.9
*** openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.8	Wed Apr  6 01:03:43 2005
--- openafs/src/packaging/MacOS/OpenAFS.info	Thu Apr 28 22:45:48 2005
***************
*** 1,5 ****
  Title OpenAFS
! Version 1.3.81
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
--- 1,5 ----
  Title OpenAFS
! Version 1.3.82
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
Index: openafs/src/ptserver/Makefile.in
diff -c openafs/src/ptserver/Makefile.in:1.14.2.1 openafs/src/ptserver/Makefile.in:1.14.2.2
*** openafs/src/ptserver/Makefile.in:1.14.2.1	Sun Jan 30 22:58:39 2005
--- openafs/src/ptserver/Makefile.in	Tue Apr 26 21:55:54 2005
***************
*** 14,20 ****
  	${TOP_INCDIR}/rx/xdr.h \
  	${TOP_INCDIR}/afs/keys.h \
  	${TOP_INCDIR}/afs/cellconfig.h \
! 	ptserver.h ptclient.h ptuser.h ptint.h pterror.h map.h
  
  LINCLS=${TOP_INCDIR}/ubik.h \
  	${TOP_INCDIR}/lock.h \
--- 14,20 ----
  	${TOP_INCDIR}/rx/xdr.h \
  	${TOP_INCDIR}/afs/keys.h \
  	${TOP_INCDIR}/afs/cellconfig.h \
! 	ptserver.h ptclient.h ptuser.h ptint.h pterror.h map.h ptprototypes.h
  
  LINCLS=${TOP_INCDIR}/ubik.h \
  	${TOP_INCDIR}/lock.h \
Index: openafs/src/ptserver/pt_util.c
diff -c openafs/src/ptserver/pt_util.c:1.9 openafs/src/ptserver/pt_util.c:1.9.2.1
*** openafs/src/ptserver/pt_util.c:1.9	Wed Jun 23 10:27:41 2004
--- openafs/src/ptserver/pt_util.c	Fri Apr 15 15:40:43 2005
***************
*** 1,4 ****
! /* $Id: pt_util.c,v 1.9 2004/06/23 14:27:41 shadow Exp $ */
  
  /*
   *
--- 1,4 ----
! /* $Id: pt_util.c,v 1.9.2.1 2005/04/15 19:40:43 shadow Exp $ */
  
  /*
   *
***************
*** 23,29 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.9 2004/06/23 14:27:41 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <errno.h>
--- 23,29 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/pt_util.c,v 1.9.2.1 2005/04/15 19:40:43 shadow Exp $");
  
  #include <afs/cmd.h>		/*Command line parsing */
  #include <errno.h>
***************
*** 44,49 ****
--- 44,50 ----
  extern char *optarg;
  extern int optind;
  
+ int restricted = 0;
  int display_entry();
  void add_group();
  void display_groups();
Index: openafs/src/ptserver/ptprocs.c
diff -c openafs/src/ptserver/ptprocs.c:1.21 openafs/src/ptserver/ptprocs.c:1.21.2.2
*** openafs/src/ptserver/ptprocs.c:1.21	Wed Jun 23 09:45:09 2004
--- openafs/src/ptserver/ptprocs.c	Tue Apr 26 21:55:54 2005
***************
*** 51,57 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptprocs.c,v 1.21 2004/06/23 13:45:09 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.2 2005/04/27 01:55:54 shadow Exp $");
  
  #include <afs/stds.h>
  #include <ctype.h>
***************
*** 67,72 ****
--- 67,73 ----
  #include <winsock2.h>
  #else
  #include <netinet/in.h>
+ #include <arpa/inet.h>
  #endif
  #ifdef HAVE_STRING_H
  #include <string.h>
***************
*** 77,82 ****
--- 78,84 ----
  #endif
  #include "ptserver.h"
  #include "pterror.h"
+ #include "ptprototypes.h"
  #include "afs/audit.h"
  
  #ifdef AFS_ATHENA_STDENV
***************
*** 86,91 ****
--- 88,94 ----
  
  #define	IP_WILDCARDS	1	/* XXX Should be defined outside of here XXX */
  
+ extern int restricted;
  extern struct ubik_dbase *dbase;
  extern afs_int32 Initdb();
  extern int pr_noAuth;
***************
*** 119,124 ****
--- 122,130 ----
       afs_int32 flag;		/* indicates type of entry */
       int admin;			/* sysadmin membership */
  {
+     if (restricted && !admin) 
+ 	return 0;
+ 
      if (flag & PRFOREIGN) {
  	/* Foreign users are recognized by the '@' sign and 
  	 * not by the PRFOREIGN flag.
***************
*** 346,352 ****
  	    ABORT_WITH(tt, PRPERM);
  	admin = IsAMemberOf(tt, cid, SYSADMINID);
      } else {
! 	admin = (!strcmp(aname, cname)) || IsAMemberOf(tt, cid, SYSADMINID);
  	oid = cid = SYSADMINID;
      }
      if (!CreateOK(tt, cid, oid, flag, admin))
--- 352,358 ----
  	    ABORT_WITH(tt, PRPERM);
  	admin = IsAMemberOf(tt, cid, SYSADMINID);
      } else {
! 	admin = ((!restricted && !strcmp(aname, cname))) || IsAMemberOf(tt, cid, SYSADMINID);
  	oid = cid = SYSADMINID;
      }
      if (!CreateOK(tt, cid, oid, flag, admin))
Index: openafs/src/ptserver/ptprototypes.h
diff -c /dev/null openafs/src/ptserver/ptprototypes.h:1.1.2.2
*** /dev/null	Thu Apr 28 22:55:48 2005
--- openafs/src/ptserver/ptprototypes.h	Tue Apr 26 21:55:54 2005
***************
*** 0 ****
--- 1,46 ----
+ /*
+  * Copyright 2000, International Business Machines Corporation and others.
+  * All Rights Reserved.
+  * 
+  * This software has been released under the terms of the IBM Public
+  * License.  For details, see the LICENSE file in the top-level source
+  * directory or online at http://www.openafs.org/dl/license10.html
+  */
+ 
+ #ifndef _PTPROTOTYPES_H_
+ #define _PTPROTOTYPES_H_
+ 
+ /* utils.c */
+ #if defined(SUPERGROUPS)
+ extern afs_int32 IsAMemberOfSG(struct ubik_trans *at, afs_int32 aid, afs_int32 gid, afs_int32 depth) ;
+ #endif /* SUPERGROUPS */
+ 
+ extern afs_int32 IDHash(afs_int32 x);
+ extern afs_int32 NameHash(register unsigned char *aname);
+ extern afs_int32 pr_Write(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, char *buff, afs_int32 len);
+ extern afs_int32 pr_Read(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, char *buff, afs_int32 len);
+ extern int pr_WriteEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct prentry *tentry);
+ extern int pr_ReadEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct prentry *tentry);
+ extern int pr_WriteCoEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct contentry *tentry);
+ extern int pr_ReadCoEntry(struct ubik_trans *tt, afs_int32 afd, afs_int32 pos, struct contentry *tentry);
+ extern afs_int32 AllocBlock(register struct ubik_trans *at);
+ extern afs_int32 FreeBlock(register struct ubik_trans *at, afs_int32 pos);
+ extern afs_int32 FindByID(register struct ubik_trans *at, afs_int32 aid);
+ extern afs_int32 FindByName(register struct ubik_trans *at, char aname[PR_MAXNAMELEN], struct prentry *tentryp);
+ extern afs_int32 AllocID(register struct ubik_trans *at, afs_int32 flag, afs_int32 *aid);
+ extern afs_int32 IDToName(register struct ubik_trans *at, afs_int32 aid, char aname[PR_MAXNAMELEN]);
+ extern afs_int32 NameToID(register struct ubik_trans *at, char aname[PR_MAXNAMELEN], afs_int32 *aid);
+ extern int IDCmp(afs_int32 *a, afs_int32 *b);
+ extern afs_int32 RemoveFromIDHash(struct ubik_trans *tt, afs_int32 aid, afs_int32 *loc);
+ extern afs_int32 AddToIDHash(struct ubik_trans *tt, afs_int32 aid, afs_int32 loc);
+ extern afs_int32 RemoveFromNameHash(struct ubik_trans *tt, char *aname, afs_int32 *loc);
+ extern afs_int32 AddToNameHash(struct ubik_trans *tt, char *aname, afs_int32 loc);
+ extern afs_int32 AddToOwnerChain(struct ubik_trans *at, afs_int32 gid, afs_int32 oid);
+ extern afs_int32 RemoveFromOwnerChain(struct ubik_trans *at, afs_int32 gid, afs_int32 oid);
+ extern afs_int32 AddToOrphan(struct ubik_trans *at, afs_int32 gid);
+ extern afs_int32 RemoveFromOrphan(struct ubik_trans *at, afs_int32 gid);
+ extern afs_int32 IsOwnerOf(struct ubik_trans *at, afs_int32 aid, afs_int32 gid);
+ extern afs_int32 OwnerOf(struct ubik_trans *at, afs_int32 gid);
+ extern afs_int32 IsAMemberOf(struct ubik_trans *at, afs_int32 aid, afs_int32 gid);
+ 
+ #endif
Index: openafs/src/ptserver/ptserver.c
diff -c openafs/src/ptserver/ptserver.c:1.21 openafs/src/ptserver/ptserver.c:1.21.2.1
*** openafs/src/ptserver/ptserver.c:1.21	Wed Jun 23 10:27:42 2004
--- openafs/src/ptserver/ptserver.c	Fri Apr 15 15:40:43 2005
***************
*** 112,118 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.21 2004/06/23 14:27:42 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
--- 112,118 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptserver.c,v 1.21.2.1 2005/04/15 19:40:43 shadow Exp $");
  
  #include <afs/stds.h>
  #ifdef	AFS_AIX32_ENV
***************
*** 163,168 ****
--- 163,170 ----
  int pr_realmNameLen;
  char *pr_realmName;
  
+ int restricted = 0;
+ 
  static struct afsconf_cell info;
  
  extern int prp_group_default;
***************
*** 296,301 ****
--- 298,306 ----
  	    prp_user_default = prp_access_mask(argv[++a]);
  	    prp_group_default = prp_access_mask(argv[++a]);
  	}
+ 	else if (strncmp(arg, "-restricted", alen) == 0) {
+ 	    restricted = 1;
+ 	}
  	else if (strncmp(arg, "-enable_peer_stats", alen) == 0) {
  	    rx_enablePeerRPCStats();
  	} else if (strncmp(arg, "-enable_process_stats", alen) == 0) {
***************
*** 319,324 ****
--- 324,330 ----
  		   "[-syslog[=FACILITY]] "
  		   "[-p <number of processes>] [-rebuild] "
  		   "[-groupdepth <depth>] "
+ 		   "[-restricted] "
  		   "[-enable_peer_stats] [-enable_process_stats] "
  		   "[-default_access default_user_access default_group_access] "
  		   "[-help]\n");
***************
*** 326,331 ****
--- 332,338 ----
  	    printf("Usage: ptserver [-database <db path>] "
  		   "[-p <number of processes>] [-rebuild] "
  		   "[-default_access default_user_access default_group_access] "
+ 		   "[-restricted] "
  		   "[-groupdepth <depth>] " "[-help]\n");
  #endif
  #else
***************
*** 335,344 ****
--- 342,353 ----
  		   "[-p <number of processes>] [-rebuild] "
  		   "[-enable_peer_stats] [-enable_process_stats] "
  		   "[-default_access default_user_access default_group_access] "
+ 		   "[-restricted] "
  		   "[-help]\n");
  #else /* AFS_NT40_ENV */
  	    printf("Usage: ptserver [-database <db path>] "
  		   "[-default_access default_user_access default_group_access] "
+ 		   "[-restricted] "
  		   "[-p <number of processes>] [-rebuild] " "[-help]\n");
  #endif
  #endif
Index: openafs/src/ptserver/ptuser.h
diff -c openafs/src/ptserver/ptuser.h:1.1.2.1 openafs/src/ptserver/ptuser.h:1.1.2.2
*** openafs/src/ptserver/ptuser.h:1.1.2.1	Sun Jan 30 22:58:39 2005
--- openafs/src/ptserver/ptuser.h	Sun Apr 17 22:29:11 2005
***************
*** 41,44 ****
  int pr_ListMaxGroupId(afs_int32 *mid);
  int pr_SetMaxGroupId(afs_int32 mid);
  afs_int32 pr_SetFieldsEntry(afs_int32 id, afs_int32 mask, afs_int32 flags, afs_int32 ngroups, afs_int32 nusers);
! #endif /* PTUSER_H */
\ No newline at end of file
--- 41,44 ----
  int pr_ListMaxGroupId(afs_int32 *mid);
  int pr_SetMaxGroupId(afs_int32 mid);
  afs_int32 pr_SetFieldsEntry(afs_int32 id, afs_int32 mask, afs_int32 flags, afs_int32 ngroups, afs_int32 nusers);
! #endif /* PTUSER_H */
Index: openafs/src/ptserver/ptutils.c
diff -c openafs/src/ptserver/ptutils.c:1.18 openafs/src/ptserver/ptutils.c:1.18.2.1
*** openafs/src/ptserver/ptutils.c:1.18	Wed Jun 23 11:01:04 2004
--- openafs/src/ptserver/ptutils.c	Fri Apr 15 15:40:43 2005
***************
*** 24,30 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptutils.c,v 1.18 2004/06/23 15:01:04 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 24,30 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/ptserver/ptutils.c,v 1.18.2.1 2005/04/15 19:40:43 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 53,59 ****
  /* Foreign cells are represented by the group system:authuser@cell*/
  #define AUTHUSER_GROUP "system:authuser"
  
! 
  extern struct ubik_dbase *dbase;
  extern struct afsconf_dir *prdir;
  extern int pr_noAuth;
--- 53,59 ----
  /* Foreign cells are represented by the group system:authuser@cell*/
  #define AUTHUSER_GROUP "system:authuser"
  
! extern int restricted;
  extern struct ubik_dbase *dbase;
  extern struct afsconf_dir *prdir;
  extern int pr_noAuth;
***************
*** 319,324 ****
--- 319,326 ----
  	return 1;
      if (cid == SYSADMINID)
  	return 1;		/* special case fileserver */
+     if (restricted && ((mem == PRP_ADD_MEM) || (mem == any == 0)))
+ 	return 0;
      if (tentry) {
  	flags = tentry->flags;
  	oid = tentry->owner;
***************
*** 1866,1871 ****
--- 1868,1875 ----
      code = pr_ReadEntry(at, 0, loc, &tentry);
      if (code)
  	return PRDBFAIL;
+     if (restricted && !IsAMemberOf(at, cid, SYSADMINID)) 
+ 	return PRPERM;
      if (tentry.owner != cid && !IsAMemberOf(at, cid, SYSADMINID)
  	&& !IsAMemberOf(at, cid, tentry.owner) && !pr_noAuth)
  	return PRPERM;
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.58.2.13 openafs/src/rx/rx.c:1.58.2.17
*** openafs/src/rx/rx.c:1.58.2.13	Mon Apr  4 00:27:01 2005
--- openafs/src/rx/rx.c	Wed Apr 20 17:23:47 2005
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58.2.13 2005/04/04 04:27:01 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58.2.17 2005/04/20 21:23:47 jaltman Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
***************
*** 217,222 ****
--- 217,223 ----
      assert(pthread_cond_init(&rx_listener_cond, (const pthread_condattr_t *)0)
  	   == 0);
      assert(pthread_key_create(&rx_thread_id_key, NULL) == 0);
+     assert(pthread_key_create(&rx_ts_info_key, NULL) == 0);
  }
  
  pthread_once_t rx_once_init = PTHREAD_ONCE_INIT;
***************
*** 461,474 ****
  
      /* Malloc up a bunch of packets & buffers */
      rx_nFreePackets = 0;
-     rx_nPackets = rx_extraPackets + RX_MAX_QUOTA + 2;	/* fudge */
      queue_Init(&rx_freePacketQueue);
      rxi_NeedMorePackets = FALSE;
      rxi_MorePackets(rx_nPackets);
      rx_CheckPackets();
  
      NETPRI;
-     AFS_RXGLOCK();
  
      clock_Init();
  
--- 462,479 ----
  
      /* Malloc up a bunch of packets & buffers */
      rx_nFreePackets = 0;
      queue_Init(&rx_freePacketQueue);
      rxi_NeedMorePackets = FALSE;
+ #ifdef RX_ENABLE_TSFPQ
+     rx_nPackets = 0;	/* in TSFPQ version, rx_nPackets is managed by rxi_MorePackets* */
+     rxi_MorePacketsTSFPQ(rx_extraPackets + RX_MAX_QUOTA + 2, RX_TS_FPQ_FLUSH_GLOBAL, 0);
+ #else /* RX_ENABLE_TSFPQ */
+     rx_nPackets = rx_extraPackets + RX_MAX_QUOTA + 2;	/* fudge */
      rxi_MorePackets(rx_nPackets);
+ #endif /* RX_ENABLE_TSFPQ */
      rx_CheckPackets();
  
      NETPRI;
  
      clock_Init();
  
***************
*** 534,540 ****
       * implementation environment--kernel or user space) */
      rxi_StartListener();
  
-     AFS_RXGUNLOCK();
      USERPRI;
      tmp_status = rxinit_status = 0;
      UNLOCK_RX_INIT;
--- 539,544 ----
***************
*** 655,660 ****
--- 659,676 ----
  }
  #endif /* KERNEL */
  
+ #ifdef AFS_NT40_ENV
+ /* This routine is only required on Windows */
+ void
+ rx_StartClientThread(void)
+ {
+ #ifdef AFS_PTHREAD_ENV
+     int pid;
+     pid = (int) pthread_self();
+ #endif /* AFS_PTHREAD_ENV */
+ }
+ #endif /* AFS_NT40_ENV */
+ 
  /* This routine must be called if any services are exported.  If the
   * donateMe flag is set, the calling process is donated to the server
   * process pool */
***************
*** 667,673 ****
      clock_NewTime();
  
      NETPRI;
-     AFS_RXGLOCK();
      /* Start server processes, if necessary (exact function is dependent
       * on the implementation environment--kernel or user space).  DonateMe
       * will be 1 if there is 1 pre-existing proc, i.e. this one.  In this
--- 683,688 ----
***************
*** 694,700 ****
      /* Turn on reaping of idle server connections */
      rxi_ReapConnections();
  
-     AFS_RXGUNLOCK();
      USERPRI;
  
      if (donateMe) {
--- 709,714 ----
***************
*** 717,722 ****
--- 731,742 ----
  #endif /* AFS_NT40_ENV */
  	rx_ServerProc();	/* Never returns */
      }
+ #ifdef RX_ENABLE_TSFPQ
+     /* no use leaving packets around in this thread's local queue if
+      * it isn't getting donated to the server thread pool. 
+      */
+     rxi_FlushLocalPacketsTSFPQ();
+ #endif /* RX_ENABLE_TSFPQ */
      return;
  }
  
***************
*** 746,752 ****
      CV_INIT(&conn->conn_call_cv, "conn call cv", CV_DEFAULT, 0);
  #endif
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&rx_connHashTable_lock);
      cid = (rx_nextCid += RX_MAXCALLS);
      conn->type = RX_CLIENT_CONNECTION;
--- 766,771 ----
***************
*** 780,786 ****
      MUTEX_EXIT(&rx_stats_mutex);
  
      MUTEX_EXIT(&rx_connHashTable_lock);
-     AFS_RXGUNLOCK();
      USERPRI;
      return conn;
  }
--- 799,804 ----
***************
*** 1010,1018 ****
      SPLVAR;
  
      NETPRI;
-     AFS_RXGLOCK();
      rxi_DestroyConnection(conn);
-     AFS_RXGUNLOCK();
      USERPRI;
  }
  
--- 1028,1034 ----
***************
*** 1022,1032 ****
      SPLVAR;
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&conn->conn_data_lock);
      conn->refCount++;
      MUTEX_EXIT(&conn->conn_data_lock);
-     AFS_RXGUNLOCK();
      USERPRI;
  }
  
--- 1038,1046 ----
***************
*** 1052,1058 ****
  
      NETPRI;
      clock_GetTime(&queueTime);
-     AFS_RXGLOCK();
      MUTEX_ENTER(&conn->conn_call_lock);
  
      /*
--- 1066,1071 ----
***************
*** 1127,1138 ****
  
      MUTEX_EXIT(&call->lock);
      MUTEX_EXIT(&conn->conn_call_lock);
-     AFS_RXGUNLOCK();
      USERPRI;
  
  #ifdef	AFS_GLOBAL_RXLOCK_KERNEL
      /* Now, if TQ wasn't cleared earlier, do it now. */
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
      while (call->flags & RX_CALL_TQ_BUSY) {
  	call->flags |= RX_CALL_TQ_WAIT;
--- 1140,1149 ----
***************
*** 1147,1153 ****
  	queue_Init(&call->tq);
      }
      MUTEX_EXIT(&call->lock);
-     AFS_RXGUNLOCK();
  #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
  
      return call;
--- 1158,1163 ----
***************
*** 1250,1256 ****
  
      tservice = rxi_AllocService();
      NETPRI;
-     AFS_RXGLOCK();
      for (i = 0; i < RX_MAX_SERVICES; i++) {
  	register struct rx_service *service = rx_services[i];
  	if (service) {
--- 1260,1265 ----
***************
*** 1263,1269 ****
  		    (osi_Msg
  		     "rx_NewService: tried to install service %s with service id %d, which is already in use for service %s\n",
  		     serviceName, serviceId, service->serviceName);
- 		    AFS_RXGUNLOCK();
  		    USERPRI;
  		    rxi_FreeService(tservice);
  		    return service;
--- 1272,1277 ----
***************
*** 1278,1284 ****
  		 * service on same port) get a new one */
  		socket = rxi_GetHostUDPSocket(htonl(INADDR_ANY), port);
  		if (socket == OSI_NULLSOCKET) {
- 		    AFS_RXGUNLOCK();
  		    USERPRI;
  		    rxi_FreeService(tservice);
  		    return 0;
--- 1286,1291 ----
***************
*** 1298,1309 ****
  	    service->executeRequestProc = serviceProc;
  	    service->checkReach = 0;
  	    rx_services[i] = service;	/* not visible until now */
- 	    AFS_RXGUNLOCK();
  	    USERPRI;
  	    return service;
  	}
      }
-     AFS_RXGUNLOCK();
      USERPRI;
      rxi_FreeService(tservice);
      (osi_Msg "rx_NewService: cannot support > %d services\n",
--- 1305,1314 ----
***************
*** 1343,1356 ****
  	    SPLVAR;
  
  	    NETPRI;
- 	    AFS_RXGLOCK();
  	    MUTEX_ENTER(&call->lock);
  
  	    rxi_CallError(call, RX_RESTARTING);
  	    rxi_SendCallAbort(call, (struct rx_packet *)0, 0, 0);
  
  	    MUTEX_EXIT(&call->lock);
- 	    AFS_RXGUNLOCK();
  	    USERPRI;
  	}
  #ifdef	KERNEL
--- 1348,1359 ----
***************
*** 1392,1398 ****
      SPLVAR;
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&rx_serverPool_lock);
  
  #ifdef RX_ENABLE_LOCKS
--- 1395,1400 ----
***************
*** 1420,1426 ****
  #endif /* RX_ENABLE_LOCKS */
      }
      MUTEX_EXIT(&rx_serverPool_lock);
-     AFS_RXGUNLOCK();
      USERPRI;
  }
  
--- 1422,1427 ----
***************
*** 1631,1637 ****
      SPLVAR;
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&freeSQEList_lock);
  
      if ((sq = rx_FreeSQEList)) {
--- 1632,1637 ----
***************
*** 1726,1732 ****
  	    osi_rxSleep(sq);
  #ifdef	KERNEL
  	    if (afs_termState == AFSOP_STOP_RXCALLBACK) {
- 		AFS_RXGUNLOCK();
  		USERPRI;
  		rxi_Free(sq, sizeof(struct rx_serverQueueEntry));
  		return (struct rx_call *)0;
--- 1726,1731 ----
***************
*** 1767,1773 ****
  	dpf(("rx_GetCall(socketp=0x%x, *socketp=0x%x)\n", socketp, *socketp));
      }
  
-     AFS_RXGUNLOCK();
      USERPRI;
  
      return call;
--- 1766,1771 ----
***************
*** 1815,1821 ****
      dpf(("rx_EndCall(call %x)\n", call));
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
  
      if (rc == 0 && call->error == 0) {
--- 1813,1818 ----
***************
*** 1926,1932 ****
  	MUTEX_EXIT(&conn->conn_call_lock);
  	conn->flags &= ~RX_CONN_BUSY;
      }
-     AFS_RXGUNLOCK();
      USERPRI;
      /*
       * Map errors to the local host's errno.h format.
--- 1923,1928 ----
Index: openafs/src/rx/rx_clock.h
diff -c openafs/src/rx/rx_clock.h:1.13 openafs/src/rx/rx_clock.h:1.13.2.1
*** openafs/src/rx/rx_clock.h:1.13	Tue Jul 15 19:16:09 2003
--- openafs/src/rx/rx_clock.h	Wed Apr 13 22:10:53 2005
***************
*** 110,122 ****
  #define clock_ElapsedTime(cv1, cv2) \
      (((cv2)->sec - (cv1)->sec)*1000 + ((cv2)->usec - (cv1)->usec)/1000)
  
- #ifdef AFS_PTHREAD_ENV
- #define clock_Advance(cv)
- #else
- /* Advance the known value of the current clock time (clock_now) by the specified clock value */
- #define clock_Advance(cv) clock_Add(&clock_now, cv)
- #endif /* AFS_PTHREAD_ENV */
- 
  /* Some comparison operators for clock values */
  #define	clock_Gt(a, b)	((a)->sec>(b)->sec || ((a)->sec==(b)->sec && (a)->usec>(b)->usec))
  #define	clock_Ge(a, b)	((a)->sec>(b)->sec || ((a)->sec==(b)->sec && (a)->usec>=(b)->usec))
--- 110,115 ----
Index: openafs/src/rx/rx_event.c
diff -c openafs/src/rx/rx_event.c:1.14.2.2 openafs/src/rx/rx_event.c:1.14.2.3
*** openafs/src/rx/rx_event.c:1.14.2.2	Tue Dec  7 01:10:06 2004
--- openafs/src/rx/rx_event.c	Wed Apr 13 22:31:44 2005
***************
*** 19,25 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_event.c,v 1.14.2.2 2004/12/07 06:10:06 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 19,25 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_event.c,v 1.14.2.3 2005/04/14 02:31:44 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 198,204 ****
      int isEarliest = 0;
  
      MUTEX_ENTER(&rxevent_lock);
-     AFS_ASSERT_RXGLOCK();
  #ifdef RXDEBUG
      if (rx_Log_event) {
  	struct clock now;
--- 198,203 ----
***************
*** 337,343 ****
      /* Append it to the free list (rather than prepending) to keep the free
       * list hot so nothing pages out
       */
-     AFS_ASSERT_RXGLOCK();
      MUTEX_ENTER(&rxevent_lock);
      if (!ev) {
  	MUTEX_EXIT(&rxevent_lock);
--- 336,341 ----
***************
*** 383,390 ****
  
      MUTEX_ENTER(&rxevent_lock);
  
-     AFS_ASSERT_RXGLOCK();
- 
      /* Events are sorted by time, so only scan until an event is found that has
       * not yet timed out */
  
--- 381,386 ----
Index: openafs/src/rx/rx_globals.h
diff -c openafs/src/rx/rx_globals.h:1.9.2.4 openafs/src/rx/rx_globals.h:1.9.2.8
*** openafs/src/rx/rx_globals.h:1.9.2.4	Mon Apr  4 00:27:02 2005
--- openafs/src/rx/rx_globals.h	Mon Apr 25 16:56:03 2005
***************
*** 9,14 ****
--- 9,18 ----
  
  /* RX:  Globals for internal use, basically */
  
+ #ifndef AFS_RX_GLOBALS_H
+ #define AFS_RX_GLOBALS_H
+ 
+ 
  #ifdef	KERNEL
  #include "rx/rx.h"
  #else /* KERNEL */
***************
*** 22,28 ****
  #else
  #define	EXT extern
  #endif
! #endif
  
  /* Basic socket for client requests; other sockets (for receiving server requests) are in the service structures */
  EXT osi_socket rx_socket;
--- 26,32 ----
  #else
  #define	EXT extern
  #endif
! #endif /* !INIT */
  
  /* Basic socket for client requests; other sockets (for receiving server requests) are in the service structures */
  EXT osi_socket rx_socket;
***************
*** 141,151 ****
  
  EXT int rx_nPackets INIT(100);	/* obsolete; use rx_extraPackets now */
  
  /* List of free packets */
  EXT struct rx_queue rx_freePacketQueue;
  #ifdef RX_ENABLE_LOCKS
  EXT afs_kmutex_t rx_freePktQ_lock;
! #endif
  
  /* Number of free packets */
  EXT int rx_nFreePackets INIT(0);
--- 145,344 ----
  
  EXT int rx_nPackets INIT(100);	/* obsolete; use rx_extraPackets now */
  
+ /*
+  * pthreads thread-specific rx info support
+  * the rx_ts_info_t struct is meant to support all kinds of
+  * thread-specific rx data:
+  *
+  *  _FPQ member contains a thread-specific free packet queue
+  */
+ #ifdef AFS_PTHREAD_ENV
+ EXT pthread_key_t rx_ts_info_key;
+ typedef struct rx_ts_info_t {
+     struct {
+         struct rx_queue queue;
+         int len;                /* local queue length */
+         int delta;              /* number of new packets alloc'd locally since last sync w/ global queue */
+         
+         /* FPQ stats */
+         int checkin_ops;
+         int checkout_ops;
+         int gtol_ops;
+         int gtol_xfer;
+         int ltog_ops;
+         int ltog_xfer;
+         int alloc_ops;
+         int alloc_xfer;
+     } _FPQ;
+ } rx_ts_info_t;
+ EXT struct rx_ts_info_t * rx_ts_info_init();   /* init function for thread-specific data struct */
+ #define RX_TS_INFO_GET(ts_info_p) \
+     do { \
+         ts_info_p = (struct rx_ts_info_t*)pthread_getspecific(rx_ts_info_key); \
+         if (ts_info_p == NULL) { \
+             assert((ts_info_p = rx_ts_info_init()) != NULL); \
+         } \
+     } while(0)
+ #endif /* AFS_PTHREAD_ENV */
+ 
+ 
  /* List of free packets */
+ /* in pthreads rx, free packet queue is now a two-tiered queueing system
+  * in which the first tier is thread-specific, and the second tier is
+  * a global free packet queue */
  EXT struct rx_queue rx_freePacketQueue;
+ #define RX_FPQ_MARK_FREE(p) \
+     do { \
+         if ((p)->flags & RX_PKTFLAG_FREE) \
+             osi_Panic("rx packet already free\n"); \
+         (p)->flags |= RX_PKTFLAG_FREE; \
+     } while(0)
+ #define RX_FPQ_MARK_USED(p) \
+     do { \
+         if (!((p)->flags & RX_PKTFLAG_FREE)) \
+             osi_Panic("rx packet not free\n"); \
+         (p)->flags = 0;		/* clear RX_PKTFLAG_FREE, initialize the rest */ \
+         (p)->header.flags = 0; \
+     } while(0)
+ #define RX_PACKET_IOV_INIT(p) \
+     do { \
+ 	(p)->wirevec[0].iov_base = (char *)((p)->wirehead); \
+ 	(p)->wirevec[0].iov_len = RX_HEADER_SIZE; \
+ 	(p)->wirevec[1].iov_base = (char *)((p)->localdata); \
+ 	(p)->wirevec[1].iov_len = RX_FIRSTBUFFERSIZE; \
+     } while(0)
+ #define RX_PACKET_IOV_FULLINIT(p) \
+     do { \
+ 	(p)->wirevec[0].iov_base = (char *)((p)->wirehead); \
+ 	(p)->wirevec[0].iov_len = RX_HEADER_SIZE; \
+ 	(p)->wirevec[1].iov_base = (char *)((p)->localdata); \
+ 	(p)->wirevec[1].iov_len = RX_FIRSTBUFFERSIZE; \
+ 	(p)->niovecs = 2; \
+ 	(p)->length = RX_FIRSTBUFFERSIZE; \
+     } while(0)
  #ifdef RX_ENABLE_LOCKS
  EXT afs_kmutex_t rx_freePktQ_lock;
! #endif /* RX_ENABLE_LOCKS */
! 
! #if defined(AFS_PTHREAD_ENV)
! #define RX_ENABLE_TSFPQ
! EXT int rx_TSFPQGlobSize INIT(3); /* number of packets to transfer between global and local queues in one op */
! EXT int rx_TSFPQLocalMax INIT(15); /* max number of packets on local FPQ before returning a glob to the global pool */
! EXT int rx_TSFPQMaxProcs INIT(0); /* max number of threads expected */
! EXT void rxi_MorePacketsTSFPQ(int apackets, int flush_global, int num_keep_local); /* more flexible packet alloc function */
! EXT void rxi_AdjustLocalPacketsTSFPQ(int num_keep_local, int allow_overcommit); /* adjust thread-local queue length, for places where we know how many packets we will need a priori */
! EXT void rxi_FlushLocalPacketsTSFPQ(void); /* flush all thread-local packets to global queue */
! #define RX_TS_FPQ_FLUSH_GLOBAL 1
! #define RX_TS_FPQ_PULL_GLOBAL 1
! #define RX_TS_FPQ_ALLOW_OVERCOMMIT 1
! /* compute the localmax and globsize values from rx_TSFPQMaxProcs and rx_nPackets.
!    arbitarily set local max so that all threads consume 90% of packets, if all local queues are full.
!    arbitarily set transfer glob size to 20% of max local packet queue length.
!    also set minimum values of 15 and 3. */
! #define RX_TS_FPQ_COMPUTE_LIMITS \
!     do { \
!         register int newmax, newglob; \
!         newmax = (rx_nPackets * 9) / (10 * rx_TSFPQMaxProcs); \
!         newmax = (newmax >= 15) ? newmax : 15; \
!         newglob = newmax / 5; \
!         newglob = (newglob >= 3) ? newglob : 3; \
!         rx_TSFPQLocalMax = newmax; \
!         rx_TSFPQGlobSize = newglob; \
!     } while(0)
! /* move packets from local (thread-specific) to global free packet queue.
!    rx_freePktQ_lock must be held. default is to move the difference between the current lenght, and the 
!    allowed max plus one extra glob. */
! #define RX_TS_FPQ_LTOG(rx_ts_info_p) \
!     do { \
!         register int i; \
!         register struct rx_packet * p; \
!         register int tsize = (rx_ts_info_p)->_FPQ.len - rx_TSFPQLocalMax + rx_TSFPQGlobSize; \
!         for (i=0,p=queue_Last(&((rx_ts_info_p)->_FPQ), rx_packet); \
!              i < tsize; i++,p=queue_Prev(p, rx_packet)); \
!         queue_SplitAfterPrepend(&((rx_ts_info_p)->_FPQ),&rx_freePacketQueue,p); \
!         (rx_ts_info_p)->_FPQ.len -= tsize; \
!         rx_nFreePackets += tsize; \
!         (rx_ts_info_p)->_FPQ.ltog_ops++; \
!         (rx_ts_info_p)->_FPQ.ltog_xfer += tsize; \
!         if ((rx_ts_info_p)->_FPQ.delta) { \
!             (rx_ts_info_p)->_FPQ.alloc_ops++; \
!             (rx_ts_info_p)->_FPQ.alloc_xfer += (rx_ts_info_p)->_FPQ.delta; \
!             MUTEX_ENTER(&rx_stats_mutex); \
!             rx_nPackets += (rx_ts_info_p)->_FPQ.delta; \
!             RX_TS_FPQ_COMPUTE_LIMITS; \
!             MUTEX_EXIT(&rx_stats_mutex); \
!            (rx_ts_info_p)->_FPQ.delta = 0; \
!         } \
!     } while(0)
! /* same as above, except user has direct control over number to transfer */
! #define RX_TS_FPQ_LTOG2(rx_ts_info_p,num_transfer) \
!     do { \
!         register int i; \
!         register struct rx_packet * p; \
!         for (i=0,p=queue_Last(&((rx_ts_info_p)->_FPQ), rx_packet); \
! 	     i < (num_transfer); i++,p=queue_Prev(p, rx_packet)); \
!         queue_SplitAfterPrepend(&((rx_ts_info_p)->_FPQ),&rx_freePacketQueue,p); \
!         (rx_ts_info_p)->_FPQ.len -= (num_transfer); \
!         rx_nFreePackets += (num_transfer); \
!         (rx_ts_info_p)->_FPQ.ltog_ops++; \
!         (rx_ts_info_p)->_FPQ.ltog_xfer += (num_transfer); \
!         if ((rx_ts_info_p)->_FPQ.delta) { \
!             (rx_ts_info_p)->_FPQ.alloc_ops++; \
!             (rx_ts_info_p)->_FPQ.alloc_xfer += (rx_ts_info_p)->_FPQ.delta; \
!             MUTEX_ENTER(&rx_stats_mutex); \
!             rx_nPackets += (rx_ts_info_p)->_FPQ.delta; \
!             RX_TS_FPQ_COMPUTE_LIMITS; \
!             MUTEX_EXIT(&rx_stats_mutex); \
!             (rx_ts_info_p)->_FPQ.delta = 0; \
!         } \
!     } while(0)
! /* move packets from global to local (thread-specific) free packet queue.
!    rx_freePktQ_lock must be held. */
! #define RX_TS_FPQ_GTOL(rx_ts_info_p) \
!     do { \
!         register int i, tsize; \
!         register struct rx_packet * p; \
!         tsize = (rx_TSFPQGlobSize <= rx_nFreePackets) ? \
!                  rx_TSFPQGlobSize : rx_nFreePackets; \
!         for (i=0,p=queue_First(&rx_freePacketQueue, rx_packet); \
!              i < tsize; i++,p=queue_Next(p, rx_packet)); \
!         queue_SplitBeforeAppend(&rx_freePacketQueue,&((rx_ts_info_p)->_FPQ),p); \
!         (rx_ts_info_p)->_FPQ.len += i; \
!         rx_nFreePackets -= i; \
!         (rx_ts_info_p)->_FPQ.gtol_ops++; \
!         (rx_ts_info_p)->_FPQ.gtol_xfer += i; \
!     } while(0)
! /* same as above, except user has direct control over number to transfer */
! #define RX_TS_FPQ_GTOL2(rx_ts_info_p,num_transfer) \
!     do { \
!         register int i; \
!         register struct rx_packet * p; \
!         for (i=0,p=queue_First(&rx_freePacketQueue, rx_packet); \
!              i < (num_transfer); i++,p=queue_Next(p, rx_packet)); \
!         queue_SplitBeforeAppend(&rx_freePacketQueue,&((rx_ts_info_p)->_FPQ),p); \
!         (rx_ts_info_p)->_FPQ.len += i; \
!         rx_nFreePackets -= i; \
!         (rx_ts_info_p)->_FPQ.gtol_ops++; \
!         (rx_ts_info_p)->_FPQ.gtol_xfer += i; \
!     } while(0)
! /* checkout a packet from the thread-specific free packet queue */
! #define RX_TS_FPQ_CHECKOUT(rx_ts_info_p,p) \
!     do { \
!         (p) = queue_First(&((rx_ts_info_p)->_FPQ), rx_packet); \
!         queue_Remove(p); \
!         RX_FPQ_MARK_USED(p); \
!         (rx_ts_info_p)->_FPQ.len--; \
!         (rx_ts_info_p)->_FPQ.checkout_ops++; \
!     } while(0)
! /* check a packet into the thread-specific free packet queue */
! #define RX_TS_FPQ_CHECKIN(rx_ts_info_p,p) \
!     do { \
!         queue_Prepend(&((rx_ts_info_p)->_FPQ), (p)); \
!         RX_FPQ_MARK_FREE(p); \
!         (rx_ts_info_p)->_FPQ.len++; \
!         (rx_ts_info_p)->_FPQ.checkin_ops++; \
!     } while(0)
! #endif /* AFS_PTHREAD_ENV */
  
  /* Number of free packets */
  EXT int rx_nFreePackets INIT(0);
***************
*** 338,340 ****
--- 531,535 ----
   * the request path.
   */
  EXT int rx_enable_hot_thread INIT(0);
+ 
+ #endif /* AFS_RX_GLOBALS_H */
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.44.2.1 openafs/src/rx/rx_kcommon.c:1.44.2.3
*** openafs/src/rx/rx_kcommon.c:1.44.2.1	Wed Aug 25 03:09:41 2004
--- openafs/src/rx/rx_kcommon.c	Fri Apr 15 14:37:14 2005
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.1 2004/08/25 07:09:41 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.3 2005/04/15 18:37:14 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 30,36 ****
  int (*rxk_GetPacketProc) (char **ahandle, int asize);
  #endif
  
! struct osi_socket *rxk_NewSocketHost(afs_uint32 ahost, short aport);
  extern struct interfaceAddr afs_cb_interface;
  
  rxk_ports_t rxk_ports;
--- 30,36 ----
  int (*rxk_GetPacketProc) (char **ahandle, int asize);
  #endif
  
! osi_socket *rxk_NewSocketHost(afs_uint32 ahost, short aport);
  extern struct interfaceAddr afs_cb_interface;
  
  rxk_ports_t rxk_ports;
***************
*** 105,113 ****
  osi_socket
  rxi_GetHostUDPSocket(u_int host, u_short port)
  {
!     struct osi_socket *sockp;
!     sockp = (struct osi_socket *)rxk_NewSocketHost(host, port);
!     if (sockp == (struct osi_socket *)0)
  	return OSI_NULLSOCKET;
      rxk_AddPort(port, (char *)sockp);
      return (osi_socket) sockp;
--- 105,113 ----
  osi_socket
  rxi_GetHostUDPSocket(u_int host, u_short port)
  {
!     osi_socket *sockp;
!     sockp = (osi_socket *)rxk_NewSocketHost(host, port);
!     if (sockp == (osi_socket *)0)
  	return OSI_NULLSOCKET;
      rxk_AddPort(port, (char *)sockp);
      return (osi_socket) sockp;
***************
*** 761,767 ****
  /* rxk_NewSocket creates a new socket on the specified port. The port is
   * in network byte order.
   */
! struct osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      register afs_int32 code;
--- 761,767 ----
  /* rxk_NewSocket creates a new socket on the specified port. The port is
   * in network byte order.
   */
! osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      register afs_int32 code;
***************
*** 905,921 ****
  #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
      thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
  #endif
!     return (struct osi_socket *)newSocket;
  
    bad:
      AFS_GLOCK();
  #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
      thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
  #endif
!     return (struct osi_socket *)0;
  }
  
! struct osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(0, aport);
--- 905,921 ----
  #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
      thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
  #endif
!     return (osi_socket *)newSocket;
  
    bad:
      AFS_GLOCK();
  #if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
      thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
  #endif
!     return (osi_socket *)0;
  }
  
! osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(0, aport);
***************
*** 964,972 ****
  	AFS_GUNLOCK();
  #endif /* RX_ENABLE_LOCKS */
  	NETPRI;
- 	AFS_RXGLOCK();
  	rxevent_RaiseEvents(&temp);
- 	AFS_RXGUNLOCK();
  	USERPRI;
  #ifdef RX_ENABLE_LOCKS
  	AFS_GLOCK();
--- 964,970 ----
***************
*** 1151,1159 ****
  		osi_Panic("rxk_Listener: No more Rx buffers!\n");
  	}
  	if (!(code = rxk_ReadPacket(rx_socket, rxp, &host, &port))) {
- 	    AFS_RXGLOCK();
  	    rxp = rxi_ReceivePacket(rxp, rx_socket, host, port, 0, 0);
- 	    AFS_RXGUNLOCK();
  	}
      }
  
--- 1149,1155 ----
Index: openafs/src/rx/rx_lwp.h
diff -c openafs/src/rx/rx_lwp.h:1.3 openafs/src/rx/rx_lwp.h:1.3.2.1
*** openafs/src/rx/rx_lwp.h:1.3	Tue Jul 15 19:16:09 2003
--- openafs/src/rx/rx_lwp.h	Wed Apr 13 22:31:44 2005
***************
*** 19,26 ****
  
  #define CALL_HOLD(call, type)
  #define CALL_RELE(call, type)
- #define RXObtainWriteLock(a) AFS_ASSERT_RXGLOCK()
- #define RXReleaseWriteLock(a)
  
  #define MUTEX_DESTROY(a)
  #define MUTEX_ENTER(a)
--- 19,24 ----
Index: openafs/src/rx/rx_packet.c
diff -c openafs/src/rx/rx_packet.c:1.35.2.10 openafs/src/rx/rx_packet.c:1.35.2.14
*** openafs/src/rx/rx_packet.c:1.35.2.10	Mon Apr  4 00:27:02 2005
--- openafs/src/rx/rx_packet.c	Wed Apr 20 17:23:47 2005
***************
*** 15,21 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_packet.c,v 1.35.2.10 2005/04/04 04:27:02 shadow Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
--- 15,21 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_packet.c,v 1.35.2.14 2005/04/20 21:23:47 jaltman Exp $");
  
  #ifdef KERNEL
  #if defined(UKERNEL)
***************
*** 244,249 ****
--- 244,278 ----
      return (resid ? (r - resid) : r);
  }
  
+ #ifdef RX_ENABLE_TSFPQ
+ static struct rx_packet *
+ allocCBuf(int class)
+ {
+     struct rx_packet *c;
+     register struct rx_ts_info_t * rx_ts_info;
+     SPLVAR;
+ 
+     RX_TS_INFO_GET(rx_ts_info);
+ 
+     if (queue_IsEmpty(&rx_ts_info->_FPQ)) {
+         NETPRI;
+         MUTEX_ENTER(&rx_freePktQ_lock);
+ 
+ 	if (queue_IsEmpty(&rx_freePacketQueue)) {
+ 	    rxi_MorePacketsNoLock(rx_initSendWindow);
+ 	}
+ 
+ 	RX_TS_FPQ_GTOL(rx_ts_info);
+ 
+ 	MUTEX_EXIT(&rx_freePktQ_lock);
+ 	USERPRI;
+     }
+ 
+     RX_TS_FPQ_CHECKOUT(rx_ts_info, c);
+ 
+     return c;
+ }
+ #else /* RX_ENABLE_TSFPQ */
  static struct rx_packet *
  allocCBuf(int class)
  {
***************
*** 251,256 ****
--- 280,286 ----
      SPLVAR;
  
      NETPRI;
+ 
      MUTEX_ENTER(&rx_freePktQ_lock);
  
  #ifdef KERNEL
***************
*** 306,315 ****
--- 336,371 ----
      USERPRI;
      return c;
  }
+ #endif /* RX_ENABLE_TSFPQ */
  
  /*
   * Free a packet currently used as a continuation buffer
   */
+ #ifdef RX_ENABLE_TSFPQ
+ void
+ rxi_freeCBuf(struct rx_packet *c)
+ {
+     register struct rx_ts_info_t * rx_ts_info;
+     register int i;
+     SPLVAR;
+ 
+     RX_TS_INFO_GET(rx_ts_info);
+     RX_TS_FPQ_CHECKIN(rx_ts_info,c);
+ 
+     if (rx_ts_info->_FPQ.len > rx_TSFPQLocalMax) {
+         NETPRI;
+ 	MUTEX_ENTER(&rx_freePktQ_lock);
+ 
+ 	RX_TS_FPQ_LTOG(rx_ts_info);
+ 
+ 	/* Wakeup anyone waiting for packets */
+ 	rxi_PacketsUnWait();
+ 
+ 	MUTEX_EXIT(&rx_freePktQ_lock);
+ 	USERPRI;
+     }
+ }
+ #else /* RX_ENABLE_TSFPQ */
  void
  rxi_freeCBuf(struct rx_packet *c)
  {
***************
*** 325,330 ****
--- 381,387 ----
      MUTEX_EXIT(&rx_freePktQ_lock);
      USERPRI;
  }
+ #endif /* RX_ENABLE_TSFPQ */
  
  /* this one is kind of awful.
   * In rxkad, the packet has been all shortened, and everything, ready for 
***************
*** 380,385 ****
--- 437,479 ----
  }
  
  /* Add more packet buffers */
+ #ifdef RX_ENABLE_TSFPQ
+ void
+ rxi_MorePackets(int apackets)
+ {
+     struct rx_packet *p, *e;
+     register struct rx_ts_info_t * rx_ts_info;
+     int getme;
+     SPLVAR;
+ 
+     getme = apackets * sizeof(struct rx_packet);
+     p = rx_mallocedP = (struct rx_packet *)osi_Alloc(getme);
+ 
+     PIN(p, getme);		/* XXXXX */
+     memset((char *)p, 0, getme);
+     RX_TS_INFO_GET(rx_ts_info);
+ 
+     for (e = p + apackets; p < e; p++) {
+         RX_PACKET_IOV_INIT(p);
+ 	p->niovecs = 2;
+ 
+ 	RX_TS_FPQ_CHECKIN(rx_ts_info,p);
+     }
+     rx_ts_info->_FPQ.delta += apackets;
+ 
+     if (rx_ts_info->_FPQ.len > rx_TSFPQLocalMax) {
+         NETPRI;
+ 	MUTEX_ENTER(&rx_freePktQ_lock);
+ 
+ 	RX_TS_FPQ_LTOG(rx_ts_info);
+ 	rxi_NeedMorePackets = FALSE;
+ 	rxi_PacketsUnWait();
+ 
+ 	MUTEX_EXIT(&rx_freePktQ_lock);
+ 	USERPRI;
+     }
+ }
+ #else /* RX_ENABLE_TSFPQ */
  void
  rxi_MorePackets(int apackets)
  {
***************
*** 393,406 ****
      PIN(p, getme);		/* XXXXX */
      memset((char *)p, 0, getme);
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&rx_freePktQ_lock);
  
      for (e = p + apackets; p < e; p++) {
! 	p->wirevec[0].iov_base = (char *)(p->wirehead);
! 	p->wirevec[0].iov_len = RX_HEADER_SIZE;
! 	p->wirevec[1].iov_base = (char *)(p->localdata);
! 	p->wirevec[1].iov_len = RX_FIRSTBUFFERSIZE;
  	p->flags |= RX_PKTFLAG_FREE;
  	p->niovecs = 2;
  
--- 487,496 ----
      PIN(p, getme);		/* XXXXX */
      memset((char *)p, 0, getme);
      NETPRI;
      MUTEX_ENTER(&rx_freePktQ_lock);
  
      for (e = p + apackets; p < e; p++) {
!         RX_PACKET_IOV_INIT(p);
  	p->flags |= RX_PKTFLAG_FREE;
  	p->niovecs = 2;
  
***************
*** 410,419 ****
      rxi_NeedMorePackets = FALSE;
      rxi_PacketsUnWait();
  
-     AFS_RXGUNLOCK();
      MUTEX_EXIT(&rx_freePktQ_lock);
      USERPRI;
  }
  
  #ifndef KERNEL
  /* Add more packet buffers */
--- 500,548 ----
      rxi_NeedMorePackets = FALSE;
      rxi_PacketsUnWait();
  
      MUTEX_EXIT(&rx_freePktQ_lock);
      USERPRI;
  }
+ #endif /* RX_ENABLE_TSFPQ */
+ 
+ #ifdef RX_ENABLE_TSFPQ
+ void
+ rxi_MorePacketsTSFPQ(int apackets, int flush_global, int num_keep_local)
+ {
+     struct rx_packet *p, *e;
+     register struct rx_ts_info_t * rx_ts_info;
+     int getme;
+     SPLVAR;
+ 
+     getme = apackets * sizeof(struct rx_packet);
+     p = rx_mallocedP = (struct rx_packet *)osi_Alloc(getme);
+ 
+     PIN(p, getme);		/* XXXXX */
+     memset((char *)p, 0, getme);
+     RX_TS_INFO_GET(rx_ts_info);
+ 
+     for (e = p + apackets; p < e; p++) {
+         RX_PACKET_IOV_INIT(p);
+ 	p->niovecs = 2;
+ 
+ 	RX_TS_FPQ_CHECKIN(rx_ts_info,p);
+     }
+     rx_ts_info->_FPQ.delta += apackets;
+ 
+     if (flush_global && 
+         (num_keep_local < apackets)) {
+         NETPRI;
+ 	MUTEX_ENTER(&rx_freePktQ_lock);
+ 
+ 	RX_TS_FPQ_LTOG2(rx_ts_info, (apackets - num_keep_local));
+ 	rxi_NeedMorePackets = FALSE;
+ 	rxi_PacketsUnWait();
+ 
+ 	MUTEX_EXIT(&rx_freePktQ_lock);
+ 	USERPRI;
+     }
+ }
+ #endif /* RX_ENABLE_TSFPQ */
  
  #ifndef KERNEL
  /* Add more packet buffers */
***************
*** 433,448 ****
      memset((char *)p, 0, getme);
  
      for (e = p + apackets; p < e; p++) {
! 	p->wirevec[0].iov_base = (char *)(p->wirehead);
! 	p->wirevec[0].iov_len = RX_HEADER_SIZE;
! 	p->wirevec[1].iov_base = (char *)(p->localdata);
! 	p->wirevec[1].iov_len = RX_FIRSTBUFFERSIZE;
  	p->flags |= RX_PKTFLAG_FREE;
  	p->niovecs = 2;
  
  	queue_Append(&rx_freePacketQueue, p);
      }
      rx_nFreePackets += apackets;
      rxi_NeedMorePackets = FALSE;
      rxi_PacketsUnWait();
  }
--- 562,582 ----
      memset((char *)p, 0, getme);
  
      for (e = p + apackets; p < e; p++) {
!         RX_PACKET_IOV_INIT(p);
  	p->flags |= RX_PKTFLAG_FREE;
  	p->niovecs = 2;
  
  	queue_Append(&rx_freePacketQueue, p);
      }
+ 
      rx_nFreePackets += apackets;
+ #ifdef RX_ENABLE_TSFPQ
+     /* TSFPQ patch also needs to keep track of total packets */
+     MUTEX_ENTER(&rx_stats_mutex);
+     rx_nPackets += apackets;
+     RX_TS_FPQ_COMPUTE_LIMITS;
+     MUTEX_EXIT(&rx_stats_mutex);
+ #endif /* RX_ENABLE_TSFPQ */
      rxi_NeedMorePackets = FALSE;
      rxi_PacketsUnWait();
  }
***************
*** 458,463 ****
--- 592,635 ----
      UNPIN(rx_mallocedP, (rx_maxReceiveWindow + 2) * sizeof(struct rx_packet));
  }
  
+ #ifdef RX_ENABLE_TSFPQ
+ void
+ rxi_AdjustLocalPacketsTSFPQ(int num_keep_local, int allow_overcommit)
+ {
+     register struct rx_ts_info_t * rx_ts_info;
+     register int xfer;
+     SPLVAR;
+ 
+     RX_TS_INFO_GET(rx_ts_info);
+ 
+     if (num_keep_local != rx_ts_info->_FPQ.len) {
+         NETPRI;
+ 	MUTEX_ENTER(&rx_freePktQ_lock);
+         if (num_keep_local < rx_ts_info->_FPQ.len) {
+             xfer = rx_ts_info->_FPQ.len - num_keep_local;
+ 	    RX_TS_FPQ_LTOG2(rx_ts_info, xfer);
+ 	    rxi_PacketsUnWait();
+         } else {
+             xfer = num_keep_local - rx_ts_info->_FPQ.len;
+             if ((num_keep_local > rx_TSFPQLocalMax) && !allow_overcommit)
+                 xfer = rx_TSFPQLocalMax - rx_ts_info->_FPQ.len;
+             if (rx_nFreePackets < xfer) {
+                 rxi_MorePacketsNoLock(xfer - rx_nFreePackets);
+             }
+             RX_TS_FPQ_GTOL2(rx_ts_info, xfer);
+         }
+ 	MUTEX_EXIT(&rx_freePktQ_lock);
+ 	USERPRI;
+     }
+ }
+ 
+ void
+ rxi_FlushLocalPacketsTSFPQ(void)
+ {
+     rxi_AdjustLocalPacketsTSFPQ(0, 0);
+ }
+ #endif /* RX_ENABLE_TSFPQ */
+ 
  /* Allocate more packets iff we need more continuation buffers */
  /* In kernel, can't page in memory with interrupts disabled, so we
   * don't use the event mechanism. */
***************
*** 483,499 ****
     */
  
  /* Actually free the packet p. */
  void
  rxi_FreePacketNoLock(struct rx_packet *p)
  {
      dpf(("Free %lx\n", (unsigned long)p));
  
!     if (p->flags & RX_PKTFLAG_FREE)
! 	osi_Panic("rxi_FreePacketNoLock: packet already free\n");
      rx_nFreePackets++;
-     p->flags |= RX_PKTFLAG_FREE;
      queue_Append(&rx_freePacketQueue, p);
  }
  
  int
  rxi_FreeDataBufsNoLock(struct rx_packet *p, int first)
--- 655,709 ----
     */
  
  /* Actually free the packet p. */
+ #ifdef RX_ENABLE_TSFPQ
+ void
+ rxi_FreePacketNoLock(struct rx_packet *p)
+ {
+     register struct rx_ts_info_t * rx_ts_info;
+     dpf(("Free %lx\n", (unsigned long)p));
+ 
+     RX_TS_INFO_GET(rx_ts_info);
+     RX_TS_FPQ_CHECKIN(rx_ts_info,p);
+     if (rx_ts_info->_FPQ.len > rx_TSFPQLocalMax) {
+         RX_TS_FPQ_LTOG(rx_ts_info);
+     }
+ }
+ #else /* RX_ENABLE_TSFPQ */
  void
  rxi_FreePacketNoLock(struct rx_packet *p)
  {
      dpf(("Free %lx\n", (unsigned long)p));
  
!     RX_FPQ_MARK_FREE(p);
      rx_nFreePackets++;
      queue_Append(&rx_freePacketQueue, p);
  }
+ #endif /* RX_ENABLE_TSFPQ */
+ 
+ #ifdef RX_ENABLE_TSFPQ
+ void
+ rxi_FreePacketTSFPQ(struct rx_packet *p, int flush_global)
+ {
+     register struct rx_ts_info_t * rx_ts_info;
+     dpf(("Free %lx\n", (unsigned long)p));
+ 
+     RX_TS_INFO_GET(rx_ts_info);
+     RX_TS_FPQ_CHECKIN(rx_ts_info,p);
+ 
+     if (flush_global && (rx_ts_info->_FPQ.len > rx_TSFPQLocalMax)) {
+         NETPRI;
+ 	MUTEX_ENTER(&rx_freePktQ_lock);
+ 
+ 	RX_TS_FPQ_LTOG(rx_ts_info);
+ 
+ 	/* Wakeup anyone waiting for packets */
+ 	rxi_PacketsUnWait();
+ 
+ 	MUTEX_EXIT(&rx_freePktQ_lock);
+ 	USERPRI;
+     }
+ }
+ #endif /* RX_ENABLE_TSFPQ */
  
  int
  rxi_FreeDataBufsNoLock(struct rx_packet *p, int first)
***************
*** 517,522 ****
--- 727,771 ----
      return 0;
  }
  
+ #ifdef RX_ENABLE_TSFPQ
+ int
+ rxi_FreeDataBufsTSFPQ(struct rx_packet *p, int first, int flush_global)
+ {
+     struct iovec *iov, *end;
+     register struct rx_ts_info_t * rx_ts_info;
+ 
+     RX_TS_INFO_GET(rx_ts_info);
+ 
+     if (first != 1)		/* MTUXXX */
+ 	osi_Panic("FreeDataBufs 1: first must be 1");
+     iov = &p->wirevec[1];
+     end = iov + (p->niovecs - 1);
+     if (iov->iov_base != (caddr_t) p->localdata)	/* MTUXXX */
+ 	osi_Panic("FreeDataBufs 2: vec 1 must be localdata");
+     for (iov++; iov < end; iov++) {
+ 	if (!iov->iov_base)
+ 	    osi_Panic("FreeDataBufs 3: vecs 2-niovecs must not be NULL");
+ 	RX_TS_FPQ_CHECKIN(rx_ts_info,RX_CBUF_TO_PACKET(iov->iov_base, p));
+     }
+     p->length = 0;
+     p->niovecs = 0;
+ 
+     if (flush_global && (rx_ts_info->_FPQ.len > rx_TSFPQLocalMax)) {
+         NETPRI;
+ 	MUTEX_ENTER(&rx_freePktQ_lock);
+ 
+ 	RX_TS_FPQ_LTOG(rx_ts_info);
+ 
+ 	/* Wakeup anyone waiting for packets */
+ 	rxi_PacketsUnWait();
+ 
+ 	MUTEX_EXIT(&rx_freePktQ_lock);
+ 	USERPRI;
+     }
+     return 0;
+ }
+ #endif /* RX_ENABLE_TSFPQ */
+ 
  int rxi_nBadIovecs = 0;
  
  /* rxi_RestoreDataBufs 
***************
*** 530,539 ****
      int i;
      struct iovec *iov = &p->wirevec[2];
  
!     p->wirevec[0].iov_base = (char *)(p->wirehead);
!     p->wirevec[0].iov_len = RX_HEADER_SIZE;
!     p->wirevec[1].iov_base = (char *)(p->localdata);
!     p->wirevec[1].iov_len = RX_FIRSTBUFFERSIZE;
  
      for (i = 2, iov = &p->wirevec[2]; i < p->niovecs; i++, iov++) {
  	if (!iov->iov_base) {
--- 779,785 ----
      int i;
      struct iovec *iov = &p->wirevec[2];
  
!     RX_PACKET_IOV_INIT(p);
  
      for (i = 2, iov = &p->wirevec[2]; i < p->niovecs; i++, iov++) {
  	if (!iov->iov_base) {
***************
*** 545,550 ****
--- 791,843 ----
      }
  }
  
+ #ifdef RX_ENABLE_TSFPQ
+ int
+ rxi_TrimDataBufs(struct rx_packet *p, int first)
+ {
+     int length;
+     struct iovec *iov, *end;
+     register struct rx_ts_info_t * rx_ts_info;
+     SPLVAR;
+ 
+     if (first != 1)
+ 	osi_Panic("TrimDataBufs 1: first must be 1");
+ 
+     /* Skip over continuation buffers containing message data */
+     iov = &p->wirevec[2];
+     end = iov + (p->niovecs - 2);
+     length = p->length - p->wirevec[1].iov_len;
+     for (; iov < end && length > 0; iov++) {
+ 	if (!iov->iov_base)
+ 	    osi_Panic("TrimDataBufs 3: vecs 1-niovecs must not be NULL");
+ 	length -= iov->iov_len;
+     }
+ 
+     /* iov now points to the first empty data buffer. */
+     if (iov >= end)
+ 	return 0;
+ 
+     RX_TS_INFO_GET(rx_ts_info);
+     for (; iov < end; iov++) {
+ 	if (!iov->iov_base)
+ 	    osi_Panic("TrimDataBufs 4: vecs 2-niovecs must not be NULL");
+ 	RX_TS_FPQ_CHECKIN(rx_ts_info,RX_CBUF_TO_PACKET(iov->iov_base, p));
+ 	p->niovecs--;
+     }
+     if (rx_ts_info->_FPQ.len > rx_TSFPQLocalMax) {
+         NETPRI;
+         MUTEX_ENTER(&rx_freePktQ_lock);
+ 
+ 	RX_TS_FPQ_LTOG(rx_ts_info);
+         rxi_PacketsUnWait();
+ 
+         MUTEX_EXIT(&rx_freePktQ_lock);
+ 	USERPRI;
+     }
+ 
+     return 0;
+ }
+ #else /* RX_ENABLE_TSFPQ */
  int
  rxi_TrimDataBufs(struct rx_packet *p, int first)
  {
***************
*** 585,593 ****
--- 878,895 ----
  
      return 0;
  }
+ #endif /* RX_ENABLE_TSFPQ */
  
  /* Free the packet p.  P is assumed not to be on any queue, i.e.
   * remove it yourself first if you call this routine. */
+ #ifdef RX_ENABLE_TSFPQ
+ void
+ rxi_FreePacket(struct rx_packet *p)
+ {
+     rxi_FreeDataBufsTSFPQ(p, 1, 0);
+     rxi_FreePacketTSFPQ(p, RX_TS_FPQ_FLUSH_GLOBAL);
+ }
+ #else /* RX_ENABLE_TSFPQ */
  void
  rxi_FreePacket(struct rx_packet *p)
  {
***************
*** 604,615 ****
      MUTEX_EXIT(&rx_freePktQ_lock);
      USERPRI;
  }
! 
  
  /* rxi_AllocPacket sets up p->length so it reflects the number of 
   * bytes in the packet at this point, **not including** the header.
   * The header is absolutely necessary, besides, this is the way the
   * length field is usually used */
  struct rx_packet *
  rxi_AllocPacketNoLock(int class)
  {
--- 906,983 ----
      MUTEX_EXIT(&rx_freePktQ_lock);
      USERPRI;
  }
! #endif /* RX_ENABLE_TSFPQ */
  
  /* rxi_AllocPacket sets up p->length so it reflects the number of 
   * bytes in the packet at this point, **not including** the header.
   * The header is absolutely necessary, besides, this is the way the
   * length field is usually used */
+ #ifdef RX_ENABLE_TSFPQ
+ struct rx_packet *
+ rxi_AllocPacketNoLock(int class)
+ {
+     register struct rx_packet *p;
+     register struct rx_ts_info_t * rx_ts_info;
+ 
+     RX_TS_INFO_GET(rx_ts_info);
+ 
+ #ifdef KERNEL
+     if (rxi_OverQuota(class)) {
+ 	rxi_NeedMorePackets = TRUE;
+ 	MUTEX_ENTER(&rx_stats_mutex);
+ 	switch (class) {
+ 	case RX_PACKET_CLASS_RECEIVE:
+ 	    rx_stats.receivePktAllocFailures++;
+ 	    break;
+ 	case RX_PACKET_CLASS_SEND:
+ 	    rx_stats.sendPktAllocFailures++;
+ 	    break;
+ 	case RX_PACKET_CLASS_SPECIAL:
+ 	    rx_stats.specialPktAllocFailures++;
+ 	    break;
+ 	case RX_PACKET_CLASS_RECV_CBUF:
+ 	    rx_stats.receiveCbufPktAllocFailures++;
+ 	    break;
+ 	case RX_PACKET_CLASS_SEND_CBUF:
+ 	    rx_stats.sendCbufPktAllocFailures++;
+ 	    break;
+ 	}
+ 	MUTEX_EXIT(&rx_stats_mutex);
+ 	return (struct rx_packet *)0;
+     }
+ #endif /* KERNEL */
+ 
+     MUTEX_ENTER(&rx_stats_mutex);
+     rx_stats.packetRequests++;
+     MUTEX_EXIT(&rx_stats_mutex);
+ 
+     if (queue_IsEmpty(&rx_ts_info->_FPQ)) {
+ 
+ #ifdef KERNEL
+         if (queue_IsEmpty(&rx_freePacketQueue))
+ 	    osi_Panic("rxi_AllocPacket error");
+ #else /* KERNEL */
+         if (queue_IsEmpty(&rx_freePacketQueue))
+ 	    rxi_MorePacketsNoLock(rx_initSendWindow);
+ #endif /* KERNEL */
+ 
+ 
+ 	RX_TS_FPQ_GTOL(rx_ts_info);
+     }
+ 
+     RX_TS_FPQ_CHECKOUT(rx_ts_info,p);
+ 
+     dpf(("Alloc %lx, class %d\n", (unsigned long)p, class));
+ 
+ 
+     /* have to do this here because rx_FlushWrite fiddles with the iovs in
+      * order to truncate outbound packets.  In the near future, may need 
+      * to allocate bufs from a static pool here, and/or in AllocSendPacket
+      */
+     RX_PACKET_IOV_FULLINIT(p);
+     return p;
+ }
+ #else /* RX_ENABLE_TSFPQ */
  struct rx_packet *
  rxi_AllocPacketNoLock(int class)
  {
***************
*** 655,682 ****
  
      rx_nFreePackets--;
      p = queue_First(&rx_freePacketQueue, rx_packet);
!     if (!(p->flags & RX_PKTFLAG_FREE))
! 	osi_Panic("rxi_AllocPacket: packet not free\n");
  
      dpf(("Alloc %lx, class %d\n", (unsigned long)p, class));
  
-     queue_Remove(p);
-     p->flags = 0;		/* clear RX_PKTFLAG_FREE, initialize the rest */
-     p->header.flags = 0;
  
      /* have to do this here because rx_FlushWrite fiddles with the iovs in
       * order to truncate outbound packets.  In the near future, may need 
       * to allocate bufs from a static pool here, and/or in AllocSendPacket
       */
!     p->wirevec[0].iov_base = (char *)(p->wirehead);
!     p->wirevec[0].iov_len = RX_HEADER_SIZE;
!     p->wirevec[1].iov_base = (char *)(p->localdata);
!     p->wirevec[1].iov_len = RX_FIRSTBUFFERSIZE;
!     p->niovecs = 2;
!     p->length = RX_FIRSTBUFFERSIZE;
      return p;
  }
  
  struct rx_packet *
  rxi_AllocPacket(int class)
  {
--- 1023,1092 ----
  
      rx_nFreePackets--;
      p = queue_First(&rx_freePacketQueue, rx_packet);
!     queue_Remove(p);
!     RX_FPQ_MARK_USED(p);
  
      dpf(("Alloc %lx, class %d\n", (unsigned long)p, class));
  
  
      /* have to do this here because rx_FlushWrite fiddles with the iovs in
       * order to truncate outbound packets.  In the near future, may need 
       * to allocate bufs from a static pool here, and/or in AllocSendPacket
       */
!     RX_PACKET_IOV_FULLINIT(p);
      return p;
  }
+ #endif /* RX_ENABLE_TSFPQ */
  
+ #ifdef RX_ENABLE_TSFPQ
+ struct rx_packet *
+ rxi_AllocPacketTSFPQ(int class, int pull_global)
+ {
+     register struct rx_packet *p;
+     register struct rx_ts_info_t * rx_ts_info;
+ 
+     RX_TS_INFO_GET(rx_ts_info);
+ 
+     MUTEX_ENTER(&rx_stats_mutex);
+     rx_stats.packetRequests++;
+     MUTEX_EXIT(&rx_stats_mutex);
+ 
+     if (pull_global && queue_IsEmpty(&rx_ts_info->_FPQ)) {
+         MUTEX_ENTER(&rx_freePktQ_lock);
+ 
+         if (queue_IsEmpty(&rx_freePacketQueue))
+             rxi_MorePacketsNoLock(rx_initSendWindow);
+ 
+ 	RX_TS_FPQ_GTOL(rx_ts_info);
+ 
+         MUTEX_EXIT(&rx_freePktQ_lock);
+     } else if (queue_IsEmpty(&rx_ts_info->_FPQ)) {
+         return NULL;
+     }
+ 
+     RX_TS_FPQ_CHECKOUT(rx_ts_info,p);
+ 
+     dpf(("Alloc %lx, class %d\n", (unsigned long)p, class));
+ 
+     /* have to do this here because rx_FlushWrite fiddles with the iovs in
+      * order to truncate outbound packets.  In the near future, may need 
+      * to allocate bufs from a static pool here, and/or in AllocSendPacket
+      */
+     RX_PACKET_IOV_FULLINIT(p);
+     return p;
+ }
+ #endif /* RX_ENABLE_TSFPQ */
+ 
+ #ifdef RX_ENABLE_TSFPQ
+ struct rx_packet *
+ rxi_AllocPacket(int class)
+ {
+     register struct rx_packet *p;
+ 
+     p = rxi_AllocPacketTSFPQ(class, RX_TS_FPQ_PULL_GLOBAL);
+     return p;
+ }
+ #else /* RX_ENABLE_TSFPQ */
  struct rx_packet *
  rxi_AllocPacket(int class)
  {
***************
*** 687,692 ****
--- 1097,1103 ----
      MUTEX_EXIT(&rx_freePktQ_lock);
      return p;
  }
+ #endif /* RX_ENABLE_TSFPQ */
  
  /* This guy comes up with as many buffers as it {takes,can get} given
   * the MTU for this call. It also sets the packet length before
***************
*** 706,711 ****
--- 1117,1144 ----
  	rx_GetSecurityHeaderSize(rx_ConnectionOf(call)) +
  	rx_GetSecurityMaxTrailerSize(rx_ConnectionOf(call));
  
+ #ifdef RX_ENABLE_TSFPQ
+     if ((p = rxi_AllocPacketTSFPQ(RX_PACKET_CLASS_SEND, 0))) {
+         want += delta;
+ 	want = MIN(want, mud);
+ 
+ 	if ((unsigned)want > p->length)
+ 	    (void)rxi_AllocDataBuf(p, (want - p->length),
+ 				   RX_PACKET_CLASS_SEND_CBUF);
+ 
+ 	if ((unsigned)p->length > mud)
+             p->length = mud;
+ 
+ 	if (delta >= p->length) {
+ 	    rxi_FreePacket(p);
+ 	    p = NULL;
+ 	} else {
+ 	    p->length -= delta;
+ 	}
+ 	return p;
+     }
+ #endif /* RX_ENABLE_TSFPQ */
+ 
      while (!(call->error)) {
  	MUTEX_ENTER(&rx_freePktQ_lock);
  	/* if an error occurred, or we get the packet we want, we're done */
***************
*** 1487,1493 ****
  	} else
  	    nbytes -= apacket->wirevec[i].iov_len;
      }
-     AFS_RXGUNLOCK();
  #ifdef KERNEL
  #ifdef RX_KERNEL_TRACE
      if (ICL_SETACTIVE(afs_iclSetp)) {
--- 1920,1925 ----
***************
*** 1519,1525 ****
  	AFS_GLOCK();
  #endif
  #endif
-     AFS_RXGLOCK();
      if (saven) {		/* means we truncated the packet above. */
  	apacket->wirevec[i - 1].iov_len = savelen;
  	apacket->niovecs = saven;
--- 1951,1956 ----
***************
*** 1605,1611 ****
  	 * blocking socket, but unfortunately the interface doesn't
  	 * allow us to have the socket block in send mode, and not
  	 * block in receive mode */
- 	AFS_RXGUNLOCK();
  #ifdef KERNEL
  	waslocked = ISAFS_GLOCK();
  #ifdef RX_KERNEL_TRACE
--- 2036,2041 ----
***************
*** 1656,1662 ****
  	    AFS_GLOCK();
  #endif
  #endif
- 	AFS_RXGLOCK();
  #ifdef RXDEBUG
      }
      dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %lx resend %d.%0.3d len %d", deliveryType, p->header.serial, rx_packetTypes[p->header.type - 1], peer->host, peer->port, p->header.serial, p->header.epoch, p->header.cid, p->header.callNumber, p->header.seq, p->header.flags, (unsigned long)p, p->retryTime.sec, p->retryTime.usec / 1000, p->length));
--- 2086,2091 ----
***************
*** 1799,1805 ****
  	 * blocking socket, but unfortunately the interface doesn't
  	 * allow us to have the socket block in send mode, and not
  	 * block in receive mode */
- 	AFS_RXGUNLOCK();
  #if	defined(AFS_SUN5_ENV) && defined(KERNEL)
  	waslocked = ISAFS_GLOCK();
  	if (!istack && waslocked)
--- 2228,2233 ----
***************
*** 1832,1838 ****
  	if (!istack && waslocked)
  	    AFS_GLOCK();
  #endif
- 	AFS_RXGLOCK();
  #ifdef RXDEBUG
      }
  
--- 2260,2265 ----
Index: openafs/src/rx/rx_prototypes.h
diff -c openafs/src/rx/rx_prototypes.h:1.14.2.5 openafs/src/rx/rx_prototypes.h:1.14.2.8
*** openafs/src/rx/rx_prototypes.h:1.14.2.5	Sun Apr  3 14:18:56 2005
--- openafs/src/rx/rx_prototypes.h	Mon Apr 25 13:19:59 2005
***************
*** 335,341 ****
  extern int rxk_FreeSocket(register struct socket *asocket);
  #endif
  #ifndef AFS_NT40_ENV
! extern struct osi_socket *rxk_NewSocket(short aport);
  #endif
  #endif
  extern int rxk_ReadPacket(osi_socket so, struct rx_packet *p, int *host,
--- 335,341 ----
  extern int rxk_FreeSocket(register struct socket *asocket);
  #endif
  #ifndef AFS_NT40_ENV
! extern osi_socket *rxk_NewSocket(short aport);
  #endif
  #endif
  extern int rxk_ReadPacket(osi_socket so, struct rx_packet *p, int *host,
***************
*** 354,360 ****
  
  
  /* ARCH/rx_kmutex.c */
! #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
  extern void afs_mutex_init(afs_kmutex_t * l);
  extern void afs_mutex_enter(afs_kmutex_t * l);
  extern int afs_mutex_tryenter(afs_kmutex_t * l);
--- 354,360 ----
  
  
  /* ARCH/rx_kmutex.c */
! #if defined(KERNEL) && defined(AFS_LINUX20_ENV)
  extern void afs_mutex_init(afs_kmutex_t * l);
  extern void afs_mutex_enter(afs_kmutex_t * l);
  extern int afs_mutex_tryenter(afs_kmutex_t * l);
Index: openafs/src/rx/rx_pthread.c
diff -c openafs/src/rx/rx_pthread.c:1.17.2.3 openafs/src/rx/rx_pthread.c:1.17.2.5
*** openafs/src/rx/rx_pthread.c:1.17.2.3	Mon Apr  4 00:27:02 2005
--- openafs/src/rx/rx_pthread.c	Wed Apr 20 17:23:47 2005
***************
*** 19,25 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_pthread.c,v 1.17.2.3 2005/04/04 04:27:02 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
--- 19,25 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_pthread.c,v 1.17.2.5 2005/04/20 21:23:47 jaltman Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
***************
*** 420,422 ****
--- 420,438 ----
      }
      return 0;
  }
+ 
+ struct rx_ts_info_t * rx_ts_info_init() {
+     register struct rx_ts_info_t * rx_ts_info;
+     rx_ts_info = (rx_ts_info_t *) malloc(sizeof(rx_ts_info_t));
+     assert(rx_ts_info != NULL && pthread_setspecific(rx_ts_info_key, rx_ts_info) == 0);
+     memset(rx_ts_info, 0, sizeof(rx_ts_info_t));
+ #ifdef RX_ENABLE_TSFPQ
+     queue_Init(&rx_ts_info->_FPQ);
+ 
+     MUTEX_ENTER(&rx_stats_mutex);
+     rx_TSFPQMaxProcs++;
+     RX_TS_FPQ_COMPUTE_LIMITS;
+     MUTEX_EXIT(&rx_stats_mutex);
+ #endif /* RX_ENABLE_TSFPQ */
+     return rx_ts_info;
+ }
Index: openafs/src/rx/rx_pthread.h
diff -c openafs/src/rx/rx_pthread.h:1.4 openafs/src/rx/rx_pthread.h:1.4.2.1
*** openafs/src/rx/rx_pthread.h:1.4	Tue Jul 15 19:16:10 2003
--- openafs/src/rx/rx_pthread.h	Wed Apr 13 22:31:44 2005
***************
*** 94,109 ****
  #endif
  #define MUTEX_EXIT(l) osi_Assert(pthread_mutex_unlock(l) == 0)
  
- #ifdef RXObtainWriteLock
- #undef RXObtainWriteLock
- #endif
- #define RXObtainWriteLock(l) MUTEX_ENTER(l)
- 
- #ifdef RXReleaseWriteLock
- #undef RXReleaseWriteLock
- #endif
- #define RXReleaseWriteLock(l) MUTEX_EXIT(l)
- 
  #ifdef CV_INIT
  #undef CV_INIT
  #endif
--- 94,99 ----
Index: openafs/src/rx/rx_queue.h
diff -c openafs/src/rx/rx_queue.h:1.3 openafs/src/rx/rx_queue.h:1.3.2.1
*** openafs/src/rx/rx_queue.h:1.3	Tue Jul 15 19:16:10 2003
--- openafs/src/rx/rx_queue.h	Mon Apr 25 16:56:03 2005
***************
*** 64,73 ****
  /* N.B.  I don't think it is possible to write this expression, correctly, with less than one comma (you can easily write an alternative expression with no commas that works with most or all compilers, but it's not clear that it really is un-ambiguous, legal C-code). */
  #define _QA(q,i,a,b) (((i->a=q->a)->b=i)->b=q, q->a=i)
  
! /* These ones splice two queues together.  If (a,b) is (next,prev) then (*q2) is appended to (*q1), otherwise (*q2) is prepended to (*q1). */
  #define _QS(q1,q2,a,b) if (queue_IsEmpty(q2)); else \
      ((((q2->a->b=q1)->a->b=q2->b)->a=q1->a, q1->a=q2->a), queue_Init(q2))
  
  /* Basic remove operation.  Doesn't update the queue item to indicate it's been removed */
  #define _QR(i) ((_Q(i)->prev->next=_Q(i)->next)->prev=_Q(i)->prev)
  
--- 64,83 ----
  /* N.B.  I don't think it is possible to write this expression, correctly, with less than one comma (you can easily write an alternative expression with no commas that works with most or all compilers, but it's not clear that it really is un-ambiguous, legal C-code). */
  #define _QA(q,i,a,b) (((i->a=q->a)->b=i)->b=q, q->a=i)
  
! /* These ones splice two queues together.  If (a,b) is (next,prev) then (*q2) is prepended to (*q1), otherwise (*q2) is appended to (*q1). */
  #define _QS(q1,q2,a,b) if (queue_IsEmpty(q2)); else \
      ((((q2->a->b=q1)->a->b=q2->b)->a=q1->a, q1->a=q2->a), queue_Init(q2))
  
+ /* This one removes part of queue (*q1) and attaches it to queue (*q2).
+  * If (a,b) is (next,prev) then the subchain is prepended to (*q2), 
+  * otherwise the subchain is appended to (*q2).
+  * If (c,d) is (prev,next) then the subchain is the elements in (*q1) before (i),
+  * otherwise the subchain is the elements in (*q1) after (i).
+  * If (x,y) is (q1,i) then operation is either BeforePrepend of AfterAppend.
+  * If (x,y) is (i,q1) then operation is either BeforeAppend or AfterPrepend. */
+ #define _QSP(q1,q2,i,a,b,c,d,x,y) if (!queue_IsEnd(q1,i->c)) \
+     (((y->b->a=q2->a)->b=y->b), ((x->a->b=q2)->a=x->a), ((i->c=q1)->d=i))
+ 
  /* Basic remove operation.  Doesn't update the queue item to indicate it's been removed */
  #define _QR(i) ((_Q(i)->prev->next=_Q(i)->next)->prev=_Q(i)->prev)
  
***************
*** 94,99 ****
--- 104,121 ----
  /* Splice the members of queue (*q2) to the end of (*q1), re-initialize (*q2) */
  #define queue_SpliceAppend(q1,q2) _QS(_Q(q1),_Q(q2),prev,next)
  
+ /* split the members after i off of queue (*q1), and append them onto queue (*q2) */
+ #define queue_SplitAfterAppend(q1,q2,i) _QSP(_Q(q1),_Q(q2),_Q(i),prev,next,next,prev,_Q(q1),_Q(i))
+ 
+ /* split the members after i off of queue (*q1), and prepend them onto queue (*q2) */
+ #define queue_SplitAfterPrepend(q1,q2,i) _QSP(_Q(q1),_Q(q2),_Q(i),next,prev,next,prev,_Q(i),_Q(q1))
+ 
+ /* split the members before i off of queue (*q1), and append them onto queue (*q2) */
+ #define queue_SplitBeforeAppend(q1,q2,i) _QSP(_Q(q1),_Q(q2),_Q(i),prev,next,prev,next,_Q(i),_Q(q1))
+ 
+ /* split the members before i off of queue (*q1), and prepend them onto queue (*q2) */
+ #define queue_SplitBeforePrepend(q1,q2,i) _QSP(_Q(q1),_Q(q2),_Q(i),next,prev,prev,next,_Q(q1),_Q(i))
+ 
  /* Replace the queue (*q1) with the contents of the queue (*q2), re-initialize (*q2) */
  #define queue_Replace(q1,q2) if (queue_IsEmpty(q2)) queue_Init(q1); else \
      (*_Q(q1) = *_Q(q2), _Q(q1)->next->prev = _Q(q1)->prev->next = _Q(q1), queue_Init(q2))
Index: openafs/src/rx/rx_rdwr.c
diff -c openafs/src/rx/rx_rdwr.c:1.21.2.3 openafs/src/rx/rx_rdwr.c:1.21.2.4
*** openafs/src/rx/rx_rdwr.c:1.21.2.3	Sun Apr  3 14:15:51 2005
--- openafs/src/rx/rx_rdwr.c	Wed Apr 13 22:31:44 2005
***************
*** 15,21 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_rdwr.c,v 1.21.2.3 2005/04/03 18:15:51 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
--- 15,21 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_rdwr.c,v 1.21.2.4 2005/04/14 02:31:44 shadow Exp $");
  
  #ifdef KERNEL
  #ifndef UKERNEL
***************
*** 337,347 ****
      }
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
      bytes = rxi_ReadProc(call, buf, nbytes);
      MUTEX_EXIT(&call->lock);
-     AFS_RXGUNLOCK();
      USERPRI;
      return bytes;
  }
--- 337,345 ----
***************
*** 396,406 ****
      }
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
      bytes = rxi_ReadProc(call, (char *)value, sizeof(afs_int32));
      MUTEX_EXIT(&call->lock);
-     AFS_RXGUNLOCK();
      USERPRI;
      return bytes;
  }
--- 394,402 ----
***************
*** 644,654 ****
      SPLVAR;
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
      bytes = rxi_ReadvProc(call, iov, nio, maxio, nbytes);
      MUTEX_EXIT(&call->lock);
-     AFS_RXGUNLOCK();
      USERPRI;
      return bytes;
  }
--- 640,648 ----
***************
*** 867,877 ****
      }
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
      bytes = rxi_WriteProc(call, buf, nbytes);
      MUTEX_EXIT(&call->lock);
-     AFS_RXGUNLOCK();
      USERPRI;
      return bytes;
  }
--- 861,869 ----
***************
*** 926,936 ****
      }
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
      bytes = rxi_WriteProc(call, (char *)value, sizeof(afs_int32));
      MUTEX_EXIT(&call->lock);
-     AFS_RXGUNLOCK();
      USERPRI;
      return bytes;
  }
--- 918,926 ----
***************
*** 1059,1069 ****
      SPLVAR;
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
      bytes = rxi_WritevAlloc(call, iov, nio, maxio, nbytes);
      MUTEX_EXIT(&call->lock);
-     AFS_RXGUNLOCK();
      USERPRI;
      return bytes;
  }
--- 1049,1057 ----
***************
*** 1230,1240 ****
      SPLVAR;
  
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
      bytes = rxi_WritevProc(call, iov, nio, nbytes);
      MUTEX_EXIT(&call->lock);
-     AFS_RXGUNLOCK();
      USERPRI;
      return bytes;
  }
--- 1218,1226 ----
***************
*** 1324,1333 ****
  {
      SPLVAR;
      NETPRI;
-     AFS_RXGLOCK();
      MUTEX_ENTER(&call->lock);
      rxi_FlushWrite(call);
      MUTEX_EXIT(&call->lock);
-     AFS_RXGUNLOCK();
      USERPRI;
  }
--- 1310,1317 ----
Index: openafs/src/rx/rx_user.h
diff -c openafs/src/rx/rx_user.h:1.6.2.1 openafs/src/rx/rx_user.h:1.6.2.2
*** openafs/src/rx/rx_user.h:1.6.2.1	Wed Aug 25 03:09:42 2004
--- openafs/src/rx/rx_user.h	Wed Apr 13 22:31:44 2005
***************
*** 24,37 ****
  #define AFS_GLOCK()
  #define AFS_GUNLOCK()
  #define AFS_ASSERT_GLOCK()
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
  #ifndef UKERNEL
  /* Defined in rx/UKERNEL/rx_kmutex.h */
  #define ISAFS_GLOCK()
- #define ISAFS_RXGLOCK()
  #endif
- #define AFS_ASSERT_RXGLOCK()
  /* Some "operating-system independent" stuff, for the user mode implementation */
  #ifdef UAFS_CLIENT
  typedef void *osi_socket;
--- 24,33 ----
Index: openafs/src/rx/AIX/rx_kmutex.h
diff -c openafs/src/rx/AIX/rx_kmutex.h:1.6 openafs/src/rx/AIX/rx_kmutex.h:1.6.2.1
*** openafs/src/rx/AIX/rx_kmutex.h:1.6	Tue Jul 15 19:16:13 2003
--- openafs/src/rx/AIX/rx_kmutex.h	Wed Apr 13 22:31:45 2005
***************
*** 68,82 ****
  					      __LINE__), \
  				simple_unlock((void *)(a))
  
- 
- #define RXObtainWriteLock(a)    simple_lock((void *)(a)), \
- 				rxdb_grablock((void *)(a), thread_self(),rxdb_fileID,\
- 					      __LINE__)
- 
- #define RXReleaseWriteLock(a)	rxdb_droplock((void *)(a), thread_self(), rxdb_fileID,\
- 					      __LINE__), \
- 				simple_unlock((void *)(a))
- 
  #define CV_WAIT(_cv, _lck) \
      do { \
  	int haveGlock = ISAFS_GLOCK(); \
--- 68,73 ----
***************
*** 112,119 ****
  #define MUTEX_ENTER(a) 		simple_lock((void *)(a))
  #define MUTEX_TRYENTER(a)	simple_lock_try((void *)(a))
  #define MUTEX_EXIT(a) 		simple_unlock((void *)(a))
- #define RXObtainWriteLock(a) 	simple_lock((void *)(a))
- #define RXReleaseWriteLock(a)	simple_unlock((void *)(a))
  
  #define CV_WAIT(_cv, _lck) \
      do { \
--- 103,108 ----
Index: openafs/src/rx/DUX/rx_knet.c
diff -c openafs/src/rx/DUX/rx_knet.c:1.11 openafs/src/rx/DUX/rx_knet.c:1.11.2.1
*** openafs/src/rx/DUX/rx_knet.c:1.11	Sun Aug  8 20:58:50 2004
--- openafs/src/rx/DUX/rx_knet.c	Wed Apr 13 22:31:45 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/DUX/rx_knet.c,v 1.11 2004/08/09 00:58:50 shadow Exp $");
  
  #ifdef AFS_DUX40_ENV
  #include "rx/rx_kcommon.h"
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/DUX/rx_knet.c,v 1.11.2.1 2005/04/14 02:31:45 shadow Exp $");
  
  #ifdef AFS_DUX40_ENV
  #include "rx/rx_kcommon.h"
***************
*** 144,150 ****
  		 */
  		data_len = ntohs(tu->uh_ulen);
  		data_len -= 8;
- 		AFS_RXGLOCK();
  		if (!(*rxk_GetPacketProc) (&phandle, data_len)) {
  		    if (rx_mb_to_packet(am, m_freem, 28, data_len, phandle)) {
  			/* XXX should just increment counter here.. */
--- 144,149 ----
***************
*** 155,161 ****
  						  rxk_portRocks[i], data_len);
  		} else
  		    m_freem(am);
- 		AFS_RXGUNLOCK();
  		USERPRI;
  		return;
  	    }
--- 154,159 ----
Index: openafs/src/rx/FBSD/rx_knet.c
diff -c openafs/src/rx/FBSD/rx_knet.c:1.14 openafs/src/rx/FBSD/rx_knet.c:1.14.2.1
*** openafs/src/rx/FBSD/rx_knet.c:1.14	Wed Mar 10 18:01:55 2004
--- openafs/src/rx/FBSD/rx_knet.c	Wed Apr 13 22:31:46 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/FBSD/rx_knet.c,v 1.14 2004/03/10 23:01:55 rees Exp $");
  
  #ifdef AFS_FBSD40_ENV
  #include <sys/malloc.h>
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/FBSD/rx_knet.c,v 1.14.2.1 2005/04/14 02:31:46 shadow Exp $");
  
  #ifdef AFS_FBSD40_ENV
  #include <sys/malloc.h>
***************
*** 283,289 ****
  		 */
  		data_len = ntohs(tu->uh_ulen);
  		data_len -= 8;
- 		AFS_RXGLOCK();
  		if (!(*rxk_GetPacketProc) (&phandle, data_len)) {
  		    if (rx_mb_to_packet(am, m_freem, 28, data_len, phandle)) {
  			/* XXX should just increment counter here.. */
--- 283,288 ----
***************
*** 294,300 ****
  						  rxk_portRocks[i], data_len);
  		} else
  		    m_freem(am);
- 		AFS_RXGUNLOCK();
  		USERPRI;
  		return;
  	    }
--- 293,298 ----
Index: openafs/src/rx/HPUX/rx_kmutex.h
diff -c openafs/src/rx/HPUX/rx_kmutex.h:1.11 openafs/src/rx/HPUX/rx_kmutex.h:1.11.2.1
*** openafs/src/rx/HPUX/rx_kmutex.h:1.11	Wed Nov 26 20:17:42 2003
--- openafs/src/rx/HPUX/rx_kmutex.h	Wed Apr 13 22:31:47 2005
***************
*** 132,141 ****
  
  #ifdef AFS_HPUX102_ENV
  
- #define RXObtainWriteLock(a) AFS_ASSERT_RXGLOCK()
- #define RXReleaseWriteLock(a)
- 
- 
  #if defined(AFS_HPUX110_ENV)
  #undef osirx_AssertMine
  extern void osirx_AssertMine(afs_kmutex_t * lockaddr, char *msg);
--- 132,137 ----
Index: openafs/src/rx/IRIX/rx_knet.c
diff -c openafs/src/rx/IRIX/rx_knet.c:1.14 openafs/src/rx/IRIX/rx_knet.c:1.14.2.1
*** openafs/src/rx/IRIX/rx_knet.c:1.14	Tue Jul 15 19:16:21 2003
--- openafs/src/rx/IRIX/rx_knet.c	Fri Apr 15 14:37:15 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/IRIX/rx_knet.c,v 1.14 2003/07/15 23:16:21 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  #include "h/tcp-param.h"
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/IRIX/rx_knet.c,v 1.14.2.1 2005/04/15 18:37:15 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  #include "h/tcp-param.h"
***************
*** 416,422 ****
  
  #ifdef AFS_SGI65_ENV
  osi_NetSend(asocket, addr, dvec, nvec, asize, istack)
!      register struct osi_socket *asocket;
       struct iovec *dvec;
       int nvec;
       register afs_int32 asize;
--- 416,422 ----
  
  #ifdef AFS_SGI65_ENV
  osi_NetSend(asocket, addr, dvec, nvec, asize, istack)
!      register osi_socket *asocket;
       struct iovec *dvec;
       int nvec;
       register afs_int32 asize;
Index: openafs/src/rx/LINUX/rx_kmutex.c
diff -c openafs/src/rx/LINUX/rx_kmutex.c:1.7.2.1 openafs/src/rx/LINUX/rx_kmutex.c:1.7.2.2
*** openafs/src/rx/LINUX/rx_kmutex.c:1.7.2.1	Sun Mar 20 15:13:45 2005
--- openafs/src/rx/LINUX/rx_kmutex.c	Mon Apr 25 13:20:00 2005
***************
*** 17,30 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_kmutex.c,v 1.7.2.1 2005/03/20 20:13:45 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  #include "rx_kmutex.h"
  #include "rx/rx_kernel.h"
  
- #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
- 
  void
  afs_mutex_init(afs_kmutex_t * l)
  {
--- 17,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_kmutex.c,v 1.7.2.2 2005/04/25 17:20:00 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  #include "rx_kmutex.h"
  #include "rx/rx_kernel.h"
  
  void
  afs_mutex_init(afs_kmutex_t * l)
  {
***************
*** 139,143 ****
  	AFS_GLOCK();
      MUTEX_ENTER(l);
  }
- 
- #endif
--- 137,139 ----
Index: openafs/src/rx/LINUX/rx_kmutex.h
diff -c openafs/src/rx/LINUX/rx_kmutex.h:1.11.2.1 openafs/src/rx/LINUX/rx_kmutex.h:1.11.2.3
*** openafs/src/rx/LINUX/rx_kmutex.h:1.11.2.1	Sun Mar 20 15:13:45 2005
--- openafs/src/rx/LINUX/rx_kmutex.h	Mon Apr 25 13:23:19 2005
***************
*** 24,30 ****
  #define	AFS_GLOBAL_RXLOCK_KERNEL 1
  
  
- #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
  #define RX_ENABLE_LOCKS 1
  
  #ifndef _LINUX_CODA_FS_I
--- 24,29 ----
***************
*** 80,104 ****
  #define CV_BROADCAST(cv)	wake_up((struct wait_queue**)cv)
  #endif
  
- #else
- 
- #define MUTEX_ISMINE(a)
- #define osirx_AssertMine(addr, msg)
- 
- #define MUTEX_DESTROY(a)
- #define MUTEX_ENTER(a)
- #define MUTEX_TRYENTER(a) 1
- #define MUTEX_EXIT(a)
- #define MUTEX_INIT(a,b,c,d)
- #define CV_INIT(a,b,c,d)
- #define CV_DESTROY(a)
- #endif
- 
- /* Since we're using the RX listener daemon, we don't need to hold off
-  * interrupts.
-  */
- #define SPLVAR
- #define NETPRI
- #define USERPRI
- 
  #endif /* RX_KMUTEX_H_ */
--- 79,82 ----
Index: openafs/src/rx/LINUX/rx_knet.c
diff -c openafs/src/rx/LINUX/rx_knet.c:1.23.2.5 openafs/src/rx/LINUX/rx_knet.c:1.23.2.6
*** openafs/src/rx/LINUX/rx_knet.c:1.23.2.5	Sun Jan 30 23:25:34 2005
--- openafs/src/rx/LINUX/rx_knet.c	Fri Apr 15 14:37:17 2005
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.23.2.5 2005/01/31 04:25:34 shadow Exp $");
  
  #include <linux/version.h>
  #ifdef AFS_LINUX22_ENV
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.23.2.6 2005/04/15 18:37:17 shadow Exp $");
  
  #include <linux/version.h>
  #ifdef AFS_LINUX22_ENV
***************
*** 29,35 ****
  /* rxk_NewSocket
   * open and bind RX socket
   */
! struct osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      struct socket *sockp;
--- 29,35 ----
  /* rxk_NewSocket
   * open and bind RX socket
   */
! osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      struct socket *sockp;
***************
*** 70,79 ****
      sockp->ops->setsockopt(sockp, SOL_IP, IP_MTU_DISCOVER, (char *)&pmtu,
                             sizeof(pmtu));
      TO_KERNEL_SPACE();
!     return (struct osi_socket *)sockp;
  }
  
! struct osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
--- 70,79 ----
      sockp->ops->setsockopt(sockp, SOL_IP, IP_MTU_DISCOVER, (char *)&pmtu,
                             sizeof(pmtu));
      TO_KERNEL_SPACE();
!     return (osi_socket *)sockp;
  }
  
! osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
Index: openafs/src/rx/OBSD/rx_kmutex.h
diff -c openafs/src/rx/OBSD/rx_kmutex.h:1.3 openafs/src/rx/OBSD/rx_kmutex.h:1.3.2.1
*** openafs/src/rx/OBSD/rx_kmutex.h:1.3	Thu Jan 23 15:34:58 2003
--- openafs/src/rx/OBSD/rx_kmutex.h	Wed Apr 13 22:31:47 2005
***************
*** 21,29 ****
  /* You can't have AFS_GLOBAL_SUNLOCK and not RX_ENABLE_LOCKS */
  #define RX_ENABLE_LOCKS 1
  #define AFS_GLOBAL_RXLOCK_KERNEL
- #ifndef AFS_GLOBAL_SUNLOCK
- #define AFS_ASSERT_RXGLOCK()
- #endif
  
  /* This is incomplete and probably wouldn't work with NCPUS > 1 */
  
--- 21,26 ----
Index: openafs/src/rx/SOLARIS/rx_knet.c
diff -c openafs/src/rx/SOLARIS/rx_knet.c:1.19 openafs/src/rx/SOLARIS/rx_knet.c:1.19.2.1
*** openafs/src/rx/SOLARIS/rx_knet.c:1.19	Wed Jul 28 18:34:13 2004
--- openafs/src/rx/SOLARIS/rx_knet.c	Fri Apr 15 14:37:19 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.19 2004/07/28 22:34:13 shadow Exp $");
  
  #ifdef AFS_SUN5_ENV
  #include "rx/rx_kcommon.h"
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.19.2.1 2005/04/15 18:37:19 shadow Exp $");
  
  #ifdef AFS_SUN5_ENV
  #include "rx/rx_kcommon.h"
***************
*** 221,227 ****
  struct sockaddr_in rx_sockaddr;
  
  /* Allocate a new socket at specified port in network byte order. */
! struct osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      vnode_t *accessvp;
--- 221,227 ----
  struct sockaddr_in rx_sockaddr;
  
  /* Allocate a new socket at specified port in network byte order. */
! osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      vnode_t *accessvp;
***************
*** 315,331 ****
  	return NULL;
      }
  
!     return (struct osi_socket *)so;
  }
  
! struct osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
  }
  
  int
! osi_FreeSocket(register struct osi_socket *asocket)
  {
      extern int rxk_ListenerPid;
      struct sonode *so = (struct sonode *)asocket;
--- 315,331 ----
  	return NULL;
      }
  
!     return (osi_socket *)so;
  }
  
! osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
  }
  
  int
! osi_FreeSocket(register osi_socket *asocket)
  {
      extern int rxk_ListenerPid;
      struct sonode *so = (struct sonode *)asocket;
***************
*** 509,515 ****
  dev_t afs_udp_rdev = (dev_t) 0;
  
  /* Allocate a new socket at specified port in network byte order. */
! struct osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      TIUSER *udp_tiptr;
--- 509,515 ----
  dev_t afs_udp_rdev = (dev_t) 0;
  
  /* Allocate a new socket at specified port in network byte order. */
! osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      TIUSER *udp_tiptr;
***************
*** 523,529 ****
      afs_udp_rdev = makedevice(11 /*CLONE*/, ddi_name_to_major("udp"));
      code = t_kopen(NULL, afs_udp_rdev, FREAD | FWRITE, &udp_tiptr, CRED());
      if (code) {
! 	return (struct osi_socket *)0;
      }
  
      code = t_kalloc(udp_tiptr, T_BIND, T_ADDR, (char **)&reqp);
--- 523,529 ----
      afs_udp_rdev = makedevice(11 /*CLONE*/, ddi_name_to_major("udp"));
      code = t_kopen(NULL, afs_udp_rdev, FREAD | FWRITE, &udp_tiptr, CRED());
      if (code) {
! 	return (osi_socket *)0;
      }
  
      code = t_kalloc(udp_tiptr, T_BIND, T_ADDR, (char **)&reqp);
***************
*** 534,540 ****
      if (code) {
  	t_kfree(udp_tiptr, (char *)reqp, T_BIND);
  	t_kclose(udp_tiptr, 0);
! 	return (struct osi_socket *)0;
      }
  
      reqp->addr.len = sizeof(struct sockaddr_in);
--- 534,540 ----
      if (code) {
  	t_kfree(udp_tiptr, (char *)reqp, T_BIND);
  	t_kclose(udp_tiptr, 0);
! 	return (osi_socket *)0;
      }
  
      reqp->addr.len = sizeof(struct sockaddr_in);
***************
*** 548,560 ****
  	t_kfree(udp_tiptr, (char *)reqp, T_BIND);
  	t_kfree(udp_tiptr, (char *)rspp, T_BIND);
  	t_kclose(udp_tiptr, 0);
! 	return (struct osi_socket *)0;
      }
      if (memcmp(reqp->addr.buf, rspp->addr.buf, rspp->addr.len)) {
  	t_kfree(udp_tiptr, (char *)reqp, T_BIND);
  	t_kfree(udp_tiptr, (char *)rspp, T_BIND);
  	t_kclose(udp_tiptr, 0);
! 	return (struct osi_socket *)0;
      }
      t_kfree(udp_tiptr, (char *)reqp, T_BIND);
      t_kfree(udp_tiptr, (char *)rspp, T_BIND);
--- 548,560 ----
  	t_kfree(udp_tiptr, (char *)reqp, T_BIND);
  	t_kfree(udp_tiptr, (char *)rspp, T_BIND);
  	t_kclose(udp_tiptr, 0);
! 	return (osi_socket *)0;
      }
      if (memcmp(reqp->addr.buf, rspp->addr.buf, rspp->addr.len)) {
  	t_kfree(udp_tiptr, (char *)reqp, T_BIND);
  	t_kfree(udp_tiptr, (char *)rspp, T_BIND);
  	t_kclose(udp_tiptr, 0);
! 	return (osi_socket *)0;
      }
      t_kfree(udp_tiptr, (char *)reqp, T_BIND);
      t_kfree(udp_tiptr, (char *)rspp, T_BIND);
***************
*** 568,584 ****
      q->q_next->q_hiwat = rx_UdpBufSize;
      RD(q)->q_hiwat = rx_UdpBufSize;
  
!     return (struct osi_socket *)udp_tiptr;
  }
  
! struct osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
  }
  
  int
! osi_FreeSocket(register struct osi_socket *asocket)
  {
      extern int rxk_ListenerPid;
      TIUSER *udp_tiptr = (TIUSER *) asocket;
--- 568,584 ----
      q->q_next->q_hiwat = rx_UdpBufSize;
      RD(q)->q_hiwat = rx_UdpBufSize;
  
!     return (osi_socket *)udp_tiptr;
  }
  
! osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
  }
  
  int
! osi_FreeSocket(register osi_socket *asocket)
  {
      extern int rxk_ListenerPid;
      TIUSER *udp_tiptr = (TIUSER *) asocket;
***************
*** 681,687 ****
  
  
  int
! osi_NetReceive(struct osi_socket *asocket, struct sockaddr_in *addr,
  	       struct iovec *dvec, int nvecs, int *alength)
  {
      int i;
--- 681,687 ----
  
  
  int
! osi_NetReceive(osi_socket *asocket, struct sockaddr_in *addr,
  	       struct iovec *dvec, int nvecs, int *alength)
  {
      int i;
Index: openafs/src/rx/UKERNEL/rx_kmutex.h
diff -c openafs/src/rx/UKERNEL/rx_kmutex.h:1.5 openafs/src/rx/UKERNEL/rx_kmutex.h:1.5.2.1
*** openafs/src/rx/UKERNEL/rx_kmutex.h:1.5	Sun Nov  9 21:04:23 2003
--- openafs/src/rx/UKERNEL/rx_kmutex.h	Wed Apr 13 22:31:48 2005
***************
*** 49,59 ****
  extern void osirx_AssertMine(afs_kmutex_t * lockaddr, char *msg);
  #endif
  
- #define AFS_RXGLOCK()
- #define AFS_RXGUNLOCK()
- #define ISAFS_RXGLOCK()		1
- #define AFS_ASSERT_RXGLOCK()
- 
  #define SPLVAR
  #define NETPRI
  #define USERPRI
--- 49,54 ----
Index: openafs/src/rx/UKERNEL/rx_knet.c
diff -c openafs/src/rx/UKERNEL/rx_knet.c:1.10 openafs/src/rx/UKERNEL/rx_knet.c:1.10.2.1
*** openafs/src/rx/UKERNEL/rx_knet.c:1.10	Wed Jul 28 18:34:14 2004
--- openafs/src/rx/UKERNEL/rx_knet.c	Fri Apr 15 14:37:20 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/UKERNEL/rx_knet.c,v 1.10 2004/07/28 22:34:14 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/UKERNEL/rx_knet.c,v 1.10.2.1 2005/04/15 18:37:20 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 169,175 ****
   * routines. Allocate the socket buffer here, but don't open it until
   * we start the receiver threads.
   */
! struct osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      struct usr_socket *usockp;
--- 169,175 ----
   * routines. Allocate the socket buffer here, but don't open it until
   * we start the receiver threads.
   */
! osi_socket *
  rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      struct usr_socket *usockp;
***************
*** 179,188 ****
  
      usockp->sock = -1;
  
!     return (struct osi_socket *)usockp;
  }
  
! struct osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
--- 179,188 ----
  
      usockp->sock = -1;
  
!     return (osi_socket *)usockp;
  }
  
! osi_socket *
  rxk_NewSocket(short aport)
  {
      return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
Index: openafs/src/rxkad/rxkad_prototypes.h
diff -c openafs/src/rxkad/rxkad_prototypes.h:1.9.2.3 openafs/src/rxkad/rxkad_prototypes.h:1.9.2.4
*** openafs/src/rxkad/rxkad_prototypes.h:1.9.2.3	Tue Dec  7 01:10:16 2004
--- openafs/src/rxkad/rxkad_prototypes.h	Fri Apr 15 14:35:46 2005
***************
*** 31,37 ****
  extern afs_int32 fc_ecb_encrypt(void * clear, void * cipher,
  				fc_KeySchedule schedule, int encrypt);
  extern afs_int32 fc_cbc_encrypt(void *input, void *output, afs_int32 length,
! 				fc_KeySchedule key, afs_uint32 * xor,
  				int encrypt);
  
  /* rxkad_client.c */
--- 31,37 ----
  extern afs_int32 fc_ecb_encrypt(void * clear, void * cipher,
  				fc_KeySchedule schedule, int encrypt);
  extern afs_int32 fc_cbc_encrypt(void *input, void *output, afs_int32 length,
! 				fc_KeySchedule key, afs_uint32 * iv,
  				int encrypt);
  
  /* rxkad_client.c */
Index: openafs/src/sys/NTMakefile
diff -c openafs/src/sys/NTMakefile:1.6.2.1 openafs/src/sys/NTMakefile:1.6.2.2
*** openafs/src/sys/NTMakefile:1.6.2.1	Tue Dec  7 01:15:58 2004
--- openafs/src/sys/NTMakefile	Thu Apr 28 08:11:38 2005
***************
*** 5,10 ****
--- 5,11 ----
  # License.  For details, see the LICENSE file in the top-level source
  # directory or online at http://www.openafs.org/dl/license10.html
  
+ AFSDEV_AUXCDEFINES = $(AFSDEV_AUXCDEFINES) -I..\WINNT\kfw\inc\loadfuncs -I..\WINNT\kfw\inc\krb5
  RELDIR=sys
  !INCLUDE ..\config\NTMakefile.$(SYS_NAME)
  !INCLUDE ..\config\NTMakefile.version
Index: openafs/src/sys/pioctl_nt.c
diff -c openafs/src/sys/pioctl_nt.c:1.18.2.8 openafs/src/sys/pioctl_nt.c:1.18.2.9
*** openafs/src/sys/pioctl_nt.c:1.18.2.8	Fri Mar 11 02:03:37 2005
--- openafs/src/sys/pioctl_nt.c	Thu Apr 28 08:11:38 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.18.2.8 2005/03/11 07:03:37 shadow Exp $");
  
  #include <afs/stds.h>
  #include <windows.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.18.2.9 2005/04/28 12:11:38 jaltman Exp $");
  
  #include <afs/stds.h>
  #include <windows.h>
***************
*** 43,48 ****
--- 43,51 ----
  #include <WINNT/afsreg.h>
  #include <lanahelper.h>
  
+ #include <loadfuncs-krb5.h>
+ #include <krb5.h>
+ 
  static char AFSConfigKeyName[] = AFSREG_CLT_SVC_PARAM_SUBKEY;
  
  #define FS_IOCTLREQUEST_MAXSIZE	8192
***************
*** 123,128 ****
--- 126,302 ----
      return debug;
  }
  
+ 
+ // krb5 functions
+ DECL_FUNC_PTR(krb5_cc_default_name);
+ DECL_FUNC_PTR(krb5_cc_set_default_name);
+ DECL_FUNC_PTR(krb5_get_default_config_files);
+ DECL_FUNC_PTR(krb5_free_config_files);
+ DECL_FUNC_PTR(krb5_free_context);
+ DECL_FUNC_PTR(krb5_get_default_realm);
+ DECL_FUNC_PTR(krb5_free_default_realm);
+ DECL_FUNC_PTR(krb5_init_context);
+ DECL_FUNC_PTR(krb5_cc_default);
+ DECL_FUNC_PTR(krb5_parse_name);
+ DECL_FUNC_PTR(krb5_free_principal);
+ DECL_FUNC_PTR(krb5_cc_close);
+ DECL_FUNC_PTR(krb5_cc_get_principal);
+ DECL_FUNC_PTR(krb5_build_principal);
+ DECL_FUNC_PTR(krb5_c_random_make_octets);
+ DECL_FUNC_PTR(krb5_get_init_creds_password);
+ DECL_FUNC_PTR(krb5_free_cred_contents);
+ DECL_FUNC_PTR(krb5_cc_resolve);
+ DECL_FUNC_PTR(krb5_unparse_name);
+ DECL_FUNC_PTR(krb5_free_unparsed_name);
+ 
+ FUNC_INFO krb5_fi[] = {
+     MAKE_FUNC_INFO(krb5_cc_default_name),
+     MAKE_FUNC_INFO(krb5_cc_set_default_name),
+     MAKE_FUNC_INFO(krb5_get_default_config_files),
+     MAKE_FUNC_INFO(krb5_free_config_files),
+     MAKE_FUNC_INFO(krb5_free_context),
+     MAKE_FUNC_INFO(krb5_get_default_realm),
+     MAKE_FUNC_INFO(krb5_free_default_realm),
+     MAKE_FUNC_INFO(krb5_init_context),
+     MAKE_FUNC_INFO(krb5_cc_default),
+     MAKE_FUNC_INFO(krb5_parse_name),
+     MAKE_FUNC_INFO(krb5_free_principal),
+     MAKE_FUNC_INFO(krb5_cc_close),
+     MAKE_FUNC_INFO(krb5_cc_get_principal),
+     MAKE_FUNC_INFO(krb5_build_principal),
+     MAKE_FUNC_INFO(krb5_c_random_make_octets),
+     MAKE_FUNC_INFO(krb5_get_init_creds_password),
+     MAKE_FUNC_INFO(krb5_free_cred_contents),
+     MAKE_FUNC_INFO(krb5_cc_resolve),
+     MAKE_FUNC_INFO(krb5_unparse_name),
+     MAKE_FUNC_INFO(krb5_free_unparsed_name),
+     END_FUNC_INFO
+ };
+ 
+ static int
+ LoadFuncs(
+     const char* dll_name,
+     FUNC_INFO fi[],
+     HINSTANCE* ph,  // [out, optional] - DLL handle
+     int* pindex,    // [out, optional] - index of last func loaded (-1 if none)
+     int cleanup,    // cleanup function pointers and unload on error
+     int go_on,      // continue loading even if some functions cannot be loaded
+     int silent      // do not pop-up a system dialog if DLL cannot be loaded
+     )
+ {
+     HINSTANCE h;
+     int i, n, last_i;
+     int error = 0;
+     UINT em;
+ 
+     if (ph) *ph = 0;
+     if (pindex) *pindex = -1;
+ 
+     for (n = 0; fi[n].func_ptr_var; n++)
+         *(fi[n].func_ptr_var) = 0;
+ 
+     if (silent)
+         em = SetErrorMode(SEM_FAILCRITICALERRORS);
+     h = LoadLibrary(dll_name);
+     if (silent)
+         SetErrorMode(em);
+ 
+     if (!h)
+         return 0;
+ 
+     last_i = -1;
+     for (i = 0; (go_on || !error) && (i < n); i++)
+     {
+         void* p = (void*)GetProcAddress(h, fi[i].func_name);
+         if (!p)
+             error = 1;
+         else
+         {
+             last_i = i;
+             *(fi[i].func_ptr_var) = p;
+         }
+     }
+     if (pindex) *pindex = last_i;
+     if (error && cleanup && !go_on) {
+         for (i = 0; i < n; i++) {
+             *(fi[i].func_ptr_var) = 0;
+         }
+         FreeLibrary(h);
+         return 0;
+     }
+     if (ph) *ph = h;
+     if (error) return 0;
+     return 1;
+ }
+ 
+ #define KERB5DLL "krb5_32.dll"
+ static BOOL
+ IsKrb5Available()
+ {
+     static HINSTANCE hKrb5DLL = 0;
+ 
+     if ( hKrb5DLL )
+         return TRUE;
+ 
+     hKrb5DLL = LoadLibrary(KERB5DLL);
+     if (hKrb5DLL) {
+         if (!LoadFuncs(KERB5DLL, krb5_fi, 0, 0, 1, 0, 0))
+         {
+             FreeLibrary(hKrb5DLL);
+             hKrb5DLL = 0;
+             return FALSE;
+         }
+     }
+     return TRUE;
+ }
+ 
+ static BOOL
+ GetLSAPrincipalName(char * szUser, DWORD *dwSize)
+ {
+     krb5_context   ctx = 0;
+     krb5_error_code code;
+     krb5_ccache mslsa_ccache=0;
+     krb5_principal princ = 0;
+     char * pname = 0;
+     BOOL success = 0;
+ 
+     if (!IsKrb5Available())
+         return FALSE;
+ 
+     if (code = pkrb5_init_context(&ctx))
+         goto cleanup;
+ 
+     if (code = pkrb5_cc_resolve(ctx, "MSLSA:", &mslsa_ccache))
+         goto cleanup;
+ 
+     if (code = pkrb5_cc_get_principal(ctx, mslsa_ccache, &princ))
+         goto cleanup;
+ 
+     if (code = pkrb5_unparse_name(ctx, princ, &pname))
+         goto cleanup;
+ 
+     if ( strlen(pname) < *dwSize ) {
+         strncpy(szUser, pname, *dwSize);
+         szUser[*dwSize-1] = '\0';
+         success = 1;
+     }
+     *dwSize = strlen(pname);
+ 
+   cleanup:
+     if (pname)
+         pkrb5_free_unparsed_name(ctx, pname);
+ 
+     if (princ)
+         pkrb5_free_principal(ctx, princ);
+ 
+     if (mslsa_ccache)
+         pkrb5_cc_close(ctx, mslsa_ccache);
+ 
+     if (ctx)
+         pkrb5_free_context(ctx);
+     return success;
+ }
+ 
  static long
  GetIoctlHandle(char *fileNamep, HANDLE * handlep)
  {
***************
*** 213,226 ****
                                 (va_list *) NULL
                                 ) )
              {
!                 fprintf(stderr,"pioctl CreateFile(%s) failed: 0x%8X\r\n\t[%s]\r\n",
                          tbuffer,gle,buf);
              }
          }
- #ifdef COMMENT
-         if (gle != ERROR_DOWNGRADE_DETECTED)
-             return -1;                                   
- #endif
  
          lana_GetNetbiosName(szClient, LANA_NETBIOS_NAME_FULL);
  
--- 387,396 ----
                                 (va_list *) NULL
                                 ) )
              {
!                 fprintf(stderr,"pioctl CreateFile(%s) failed: 0x%X\r\n\t[%s]\r\n",
                          tbuffer,gle,buf);
              }
          }
  
          lana_GetNetbiosName(szClient, LANA_NETBIOS_NAME_FULL);
  
***************
*** 234,240 ****
  
          if ( szUser[0] ) {
              if ( ioctlDebug )
!                 fprintf(stderr, "pioctl logon user: [%s]\r\n",szUser);
  
              sprintf(szPath, "\\\\%s", szClient);
              memset (&nr, 0x00, sizeof(NETRESOURCE));
--- 404,472 ----
  
          if ( szUser[0] ) {
              if ( ioctlDebug )
!                 fprintf(stderr, "pioctl Explorer logon user: [%s]\r\n",szUser);
! 
!             sprintf(szPath, "\\\\%s", szClient);
!             memset (&nr, 0x00, sizeof(NETRESOURCE));
!             nr.dwType=RESOURCETYPE_DISK;
!             nr.lpLocalName=0;
!             nr.lpRemoteName=szPath;
!             res = WNetAddConnection2(&nr,NULL,szUser,0);
!             if (res) {
!                 if ( ioctlDebug ) {
!                     fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n",
!                              szPath,szUser,res);
!                 }
!                 gonext = 1;
!             }
! 
!             sprintf(szPath, "\\\\%s\\all", szClient);
!             res = WNetAddConnection2(&nr,NULL,szUser,0);
!             if (res) {
!                 if ( ioctlDebug ) {
!                     fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n",
!                              szPath,szUser,res);
!                 }
!                 gonext = 1;
!             }
! 
!             if (gonext)
!                 goto try_lsa_principal;
! 
!             fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE,
!                              FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
!                              FILE_FLAG_WRITE_THROUGH, NULL);
!             fflush(stdout);
!             if (fh == INVALID_HANDLE_VALUE) {
!                 gle = GetLastError();
!                 if (gle && ioctlDebug ) {
!                     char buf[4096];
! 
!                     if ( FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
!                                         NULL,
!                                         gle,
!                                         MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
!                                         buf,
!                                         4096,
!                                         (va_list *) NULL
!                                         ) )
!                     {
!                         fprintf(stderr,"pioctl CreateFile(%s) failed: 0x%X\r\n\t[%s]\r\n",
!                                  tbuffer,gle,buf);
!                     }
!                 }
!             }
!         }
!     }
! 
!   try_lsa_principal:
!     if (fh == INVALID_HANDLE_VALUE) {
!         int  gonext = 0;
! 
!         dwSize = sizeof(szUser);
!         if (GetLSAPrincipalName(szUser, &dwSize)) {
!             if ( ioctlDebug )
!                 fprintf(stderr, "pioctl LSA Principal logon user: [%s]\r\n",szUser);
  
              sprintf(szPath, "\\\\%s", szClient);
              memset (&nr, 0x00, sizeof(NETRESOURCE));
***************
*** 261,267 ****
              }
  
              if (gonext)
!                 goto next_attempt;
  
              fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE,
                               FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
--- 493,499 ----
              }
  
              if (gonext)
!                 goto try_sam_compat;
  
              fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE,
                               FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
***************
*** 281,287 ****
                                          (va_list *) NULL
                                          ) )
                      {
!                         fprintf(stderr,"pioctl CreateFile(%s) failed: 0x%8X\r\n\t[%s]\r\n",
                                   tbuffer,gle,buf);
                      }
                  }
--- 513,519 ----
                                          (va_list *) NULL
                                          ) )
                      {
!                         fprintf(stderr,"pioctl CreateFile(%s) failed: 0x%X\r\n\t[%s]\r\n",
                                   tbuffer,gle,buf);
                      }
                  }
***************
*** 289,299 ****
          }
      }
  
!   next_attempt:
      if ( fh == INVALID_HANDLE_VALUE ) {
          if (GetUserNameEx(NameSamCompatible, szUser, &dwSize)) {
              if ( ioctlDebug )
!                 fprintf(stderr, "pioctl logon user: [%s]\r\n",szUser);
  
              sprintf(szPath, "\\\\%s", szClient);
              memset (&nr, 0x00, sizeof(NETRESOURCE));
--- 521,532 ----
          }
      }
  
!   try_sam_compat:
      if ( fh == INVALID_HANDLE_VALUE ) {
+         dwSize = sizeof(szUser);
          if (GetUserNameEx(NameSamCompatible, szUser, &dwSize)) {
              if ( ioctlDebug )
!                 fprintf(stderr, "pioctl SamCompatible logon user: [%s]\r\n",szUser);
  
              sprintf(szPath, "\\\\%s", szClient);
              memset (&nr, 0x00, sizeof(NETRESOURCE));
***************
*** 336,348 ****
                                          (va_list *) NULL
                                          ) )
                      {
!                         fprintf(stderr,"pioctl CreateFile(%s) failed: 0x%8X\r\n\t[%s]\r\n",
                                   tbuffer,gle,buf);
                      }
                  }
                  return -1;
              }
          } else {
              return -1;
          }
      }
--- 569,582 ----
                                          (va_list *) NULL
                                          ) )
                      {
!                         fprintf(stderr,"pioctl CreateFile(%s) failed: 0x%X\r\n\t[%s]\r\n",
                                   tbuffer,gle,buf);
                      }
                  }
                  return -1;
              }
          } else {
+             fprintf(stderr, "GetUserNameEx(NameSamCompatible) failed: 0x%X\r\n", GetLastError());
              return -1;
          }
      }
Index: openafs/src/tbutc/Makefile.in
diff -c openafs/src/tbutc/Makefile.in:1.13 openafs/src/tbutc/Makefile.in:1.13.2.1
*** openafs/src/tbutc/Makefile.in:1.13	Fri Aug  8 16:10:12 2003
--- openafs/src/tbutc/Makefile.in	Sun Apr 24 16:05:22 2005
***************
*** 24,39 ****
  BUCOORDOBJS=ubik_db_if.o ../bucoord/volstub.o ../bucoord/dlq.o \
  	    status.o ../bucoord/bucoord_errs.o
  
! VOLSERLIBOBJ=../volser/volint.cs.o  vsprocs.o ../volser/vsutils.o \
!             ../volser/lockprocs.o ../volser/volint.xdr.o ../volser/volerr.o \
!             ../volser/volint.ss.o  AFS_component_version_number.o 
! VOLSERLIBS  =libvolser.a
  
  LWPOBJS     =lock.o
  
  BUTCOBJS   =dbentries.o tcprocs.o lwps.o tcmain.o list.o recoverDb.o \
  	    tcudbprocs.o dump.o tcstatus.o butc_xbsa.o \
!             ${LWPOBJS} ${BUCOORDOBJS}
  
  BUTCINCLS=${TOP_INCDIR}/afs/partition.h \
  	    ${TOP_INCDIR}/afs/volume.h \
--- 24,37 ----
  BUCOORDOBJS=ubik_db_if.o ../bucoord/volstub.o ../bucoord/dlq.o \
  	    status.o ../bucoord/bucoord_errs.o
  
! VOLSEROBJS=vsprocs.o
! VOLSERLIBS=${TOP_LIBDIR}/libvosadmin.a ${TOP_LIBDIR}/libafsadminutil.a
  
  LWPOBJS     =lock.o
  
  BUTCOBJS   =dbentries.o tcprocs.o lwps.o tcmain.o list.o recoverDb.o \
  	    tcudbprocs.o dump.o tcstatus.o butc_xbsa.o \
!             ${LWPOBJS} ${BUCOORDOBJS} ${VOLSEROBJS}
  
  BUTCINCLS=${TOP_INCDIR}/afs/partition.h \
  	    ${TOP_INCDIR}/afs/volume.h \
***************
*** 54,67 ****
  	    ${TOP_LIBDIR}/libbubasics.a \
  	    ${VOLSERLIBS} \
              ${BUTMLIBS} \
- 	    ${TOP_LIBDIR}/libvldb.a \
  	    ${TOP_LIBDIR}/libafsauthent.a \
  	    ${TOP_LIBDIR}/libafsrpc.a \
              ${TOP_LIBDIR}/libcmd.a \
  	    ${TOP_LIBDIR}/util.a \
  	    ${TOP_LIBDIR}/libusd.a \
! 	    ${TOP_LIBDIR}/libprocmgmt.a \
! 	    ${TOP_LIBDIR}/librx.a
  
  #
  # Build targets
--- 52,63 ----
  	    ${TOP_LIBDIR}/libbubasics.a \
  	    ${VOLSERLIBS} \
              ${BUTMLIBS} \
  	    ${TOP_LIBDIR}/libafsauthent.a \
  	    ${TOP_LIBDIR}/libafsrpc.a \
              ${TOP_LIBDIR}/libcmd.a \
  	    ${TOP_LIBDIR}/util.a \
  	    ${TOP_LIBDIR}/libusd.a \
! 	    ${TOP_LIBDIR}/libprocmgmt.a
  
  #
  # Build targets
***************
*** 72,82 ****
  butc: ${BUTCOBJS} ${BUTCLIBS}
  	${CC} ${CFLAGS} ${BUTCOBJS} ${BUTCLIBS} ${MT_LIBS} ${XLIBS} -o butc
  
- libvolser.a: vsprocs.o ${VOLSERLIBOBJ}
- 	-$(RM) -f $@
- 	$(AR) crv $@ vsprocs.o ${VOLSERLIBOBJ}
- 	$(RANLIB) $@
- 
  libbutm.a: ${BUTMOBJS} AFS_component_version_number.o
  	-$(RM) -f libbutm.a
  	$(AR) crv libbutm.a $(BUTMOBJS) AFS_component_version_number.o
--- 68,73 ----
Index: openafs/src/util/Makefile.in
diff -c openafs/src/util/Makefile.in:1.24.2.2 openafs/src/util/Makefile.in:1.24.2.3
*** openafs/src/util/Makefile.in:1.24.2.2	Tue Nov  9 14:35:50 2004
--- openafs/src/util/Makefile.in	Sun Apr 24 10:27:58 2005
***************
*** 13,19 ****
  objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \
  	 hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
  	 dirpath.o fileutil.o netutils.o flipbase64.o \
! 	 afs_atomlist.o afs_lhash.o snprintf.o strlcat.o strlcpy.o ${REGEX_OBJ}
  
  includes = \
  	${TOP_INCDIR}/afs/dirpath.h \
--- 13,20 ----
  objects = assert.o base64.o casestrcpy.o ktime.o volparse.o hostparse.o \
  	 hputil.o kreltime.o isathing.o get_krbrlm.o uuid.o serverLog.o \
  	 dirpath.o fileutil.o netutils.o flipbase64.o \
! 	 afs_atomlist.o afs_lhash.o snprintf.o strlcat.o strlcpy.o \
! 	 daemon.o ${REGEX_OBJ}
  
  includes = \
  	${TOP_INCDIR}/afs/dirpath.h \
***************
*** 130,135 ****
--- 131,139 ----
  strlcpy.o: ${srcdir}/strlcpy.c ${includes}
  	${CCOBJ} ${CFLAGS} -c ${srcdir}/strlcpy.c
  
+ daemon.o: ${srcdir}/daemon.c ${includes}
+ 	${CCOBJ} ${CFLAGS} -c ${srcdir}/daemon.c
+ 
  #
  # Install targets
  #
Index: openafs/src/util/afsutil_prototypes.h
diff -c openafs/src/util/afsutil_prototypes.h:1.7 openafs/src/util/afsutil_prototypes.h:1.7.2.1
*** openafs/src/util/afsutil_prototypes.h:1.7	Wed Nov 26 20:17:43 2003
--- openafs/src/util/afsutil_prototypes.h	Sun Apr 24 10:27:58 2005
***************
*** 33,38 ****
--- 33,43 ----
  extern char *ucstring(char *d, char *s, int n);
  extern char *strcompose(char *buf, size_t len, ...);
  
+ /* daemon.c */
+ #ifndef HAVE_DAEMON
+ int daemon(int nochdir, int noclose);
+ #endif
+ 
  /* dirpath.c */
  extern unsigned int initAFSDirPath(void);
  extern const char *getDirPath(afsdir_id_t string_id);
Index: openafs/src/util/daemon.c
diff -c /dev/null openafs/src/util/daemon.c:1.1.2.2
*** /dev/null	Thu Apr 28 22:55:49 2005
--- openafs/src/util/daemon.c	Sun Apr 24 19:47:07 2005
***************
*** 0 ****
--- 1,56 ----
+ #include <afsconfig.h>
+ #include <afs/param.h>
+ 
+ #ifndef HAVE_DAEMON
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+ 
+ #include <sys/types.h>
+ 
+ int daemon(int nochdir, int noclose)
+ {
+ 	int err = -1;
+ 	pid_t pid;
+ 
+ 	pid = fork();
+ 	if (pid == -1) {
+ 		goto out;
+ 	} else if (pid) {
+ 		exit(0);
+ 	}
+ 
+ 	err = setsid();
+ 	if (err == -1) {
+ 		goto out;
+ 	}
+ 
+ 	if (!nochdir) {
+ 		err = chdir("/");
+ 		if (err == -1) {
+ 			goto out;
+ 		}
+ 	}
+ 
+ 	err = -1;
+ 	if (!noclose) {
+ 		if (!freopen("/dev/null", "r", stdin)) {
+ 			goto out;
+ 		}
+ 
+ 		if (!freopen("/dev/null", "w", stdout)) {
+ 			goto out;
+ 		}
+ 
+ 		if (!freopen("/dev/null", "w", stderr)) {
+ 			goto out;
+ 		}
+ 	}
+ 
+ 	err = 0;
+ 
+ out:
+ 	return(err);
+ }
+ #endif
Index: openafs/src/util/serverLog.c
diff -c openafs/src/util/serverLog.c:1.22.2.1 openafs/src/util/serverLog.c:1.22.2.5
*** openafs/src/util/serverLog.c:1.22.2.1	Mon Oct 18 03:12:18 2004
--- openafs/src/util/serverLog.c	Tue Apr 19 01:14:40 2005
***************
*** 20,26 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/serverLog.c,v 1.22.2.1 2004/10/18 07:12:18 shadow Exp $");
  
  #include <stdio.h>
  #ifdef AFS_NT40_ENV
--- 20,26 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/serverLog.c,v 1.22.2.5 2005/04/19 05:14:40 jaltman Exp $");
  
  #include <stdio.h>
  #ifdef AFS_NT40_ENV
***************
*** 44,49 ****
--- 44,50 ----
  #include <strings.h>
  #endif
  #endif
+ #include <sys/stat.h>
  #include "afsutil.h"
  #include "fileutil.h"
  #if defined(AFS_PTHREAD_ENV)
***************
*** 66,71 ****
--- 67,73 ----
  
  #ifdef AFS_NT40_ENV
  #define F_OK 0
+ #define O_NONBLOCK 0
  #endif
  
  char *(*threadNameProgram) ();
***************
*** 212,217 ****
--- 214,222 ----
      (void)signal(SIGHUP, ResetDebug_Signal);
      /* Note that we cannot use SIGUSR1 -- Linux stole it for pthreads! */
      (void)signal(SIGTSTP, SetDebug_Signal);
+ #ifndef AFS_NT40_ENV
+     (void)signal(SIGPIPE, SIG_IGN);
+ #endif
  }
  
  int
***************
*** 221,237 ****
       * This function should allow various libraries that inconsistently
       * use stdout/stderr to all go to the same place
       */
!     int tempfd;
      char oldName[MAXPATHLEN];
      struct timeval Start;
      struct tm *TimeFields;
      char FileName[MAXPATHLEN];
  
  #ifndef AFS_NT40_ENV
      if (serverLogSyslog) {
  	openlog(serverLogSyslogTag, LOG_PID, serverLogSyslogFacility);
  	return (0);
      }
  #endif
  
      if (mrafsStyleLogs) {
--- 226,249 ----
       * This function should allow various libraries that inconsistently
       * use stdout/stderr to all go to the same place
       */
!     int tempfd, isfifo = 0;
      char oldName[MAXPATHLEN];
      struct timeval Start;
      struct tm *TimeFields;
      char FileName[MAXPATHLEN];
  
  #ifndef AFS_NT40_ENV
+     struct stat statbuf;
+ 
      if (serverLogSyslog) {
  	openlog(serverLogSyslogTag, LOG_PID, serverLogSyslogFacility);
  	return (0);
      }
+ 
+     /* Support named pipes as logs by not rotating them */
+     if ((fstat(fileName, &statbuf) == 0)  && (S_ISFIFO(statbuf.st_mode))) {
+ 	isfifo = 1;
+     }
  #endif
  
      if (mrafsStyleLogs) {
***************
*** 247,261 ****
  		     TimeFields->tm_mon + 1, TimeFields->tm_mday,
  		     TimeFields->tm_hour, TimeFields->tm_min,
  		     TimeFields->tm_sec);
! 	rename(fileName, FileName);	/* don't check error code */
! 	tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT, 0666);
      } else {
  	strcpy(oldName, fileName);
  	strcat(oldName, ".old");
  
  	/* don't check error */
! 	renamefile(fileName, oldName);
! 	tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT, 0666);
      }
  
      if (tempfd < 0) {
--- 259,275 ----
  		     TimeFields->tm_mon + 1, TimeFields->tm_mday,
  		     TimeFields->tm_hour, TimeFields->tm_min,
  		     TimeFields->tm_sec);
! 	if (!isfifo)
! 	    renamefile(fileName, FileName);	/* don't check error code */
! 	tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT | (isfifo?O_NONBLOCK:0), 0666);
      } else {
  	strcpy(oldName, fileName);
  	strcat(oldName, ".old");
  
  	/* don't check error */
! 	if (!isfifo)
! 	    renamefile(fileName, oldName);
! 	tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT | (isfifo?O_NONBLOCK:0), 0666);
      }
  
      if (tempfd < 0) {
***************
*** 283,291 ****
--- 297,309 ----
  int
  ReOpenLog(const char *fileName)
  {
+     int isfifo = 0;
  #if !defined(AFS_PTHREAD_ENV)
      int tempfd;
  #endif
+ #if !defined(AFS_NT40_ENV)
+     struct stat statbuf;
+ #endif
  
      if (access(fileName, F_OK) == 0)
  	return 0;		/* exists, no need to reopen. */
***************
*** 294,311 ****
      if (serverLogSyslog) {
  	return 0;
      }
  #endif
  
  #if defined(AFS_PTHREAD_ENV)
      LOCK_SERVERLOG();
      if (serverLogFD > 0)
  	close(serverLogFD);
!     serverLogFD = open(fileName, O_WRONLY | O_APPEND | O_CREAT, 0666);
      UNLOCK_SERVERLOG();
      return serverLogFD < 0 ? -1 : 0;
  #else
  
!     tempfd = open(fileName, O_WRONLY | O_APPEND | O_CREAT, 0666);
      if (tempfd < 0) {
  	printf("Unable to open log file %s\n", fileName);
  	return -1;
--- 312,334 ----
      if (serverLogSyslog) {
  	return 0;
      }
+ 
+     /* Support named pipes as logs by not rotating them */
+     if ((fstat(fileName, &statbuf) == 0)  && (S_ISFIFO(statbuf.st_mode))) {
+ 	isfifo = 1;
+     }
  #endif
  
  #if defined(AFS_PTHREAD_ENV)
      LOCK_SERVERLOG();
      if (serverLogFD > 0)
  	close(serverLogFD);
!     serverLogFD = open(fileName, O_WRONLY | O_APPEND | O_CREAT | (isfifo?O_NONBLOCK:0), 0666);
      UNLOCK_SERVERLOG();
      return serverLogFD < 0 ? -1 : 0;
  #else
  
!     tempfd = open(fileName, O_WRONLY | O_APPEND | O_CREAT | (isfifo?O_NONBLOCK:0), 0666);
      if (tempfd < 0) {
  	printf("Unable to open log file %s\n", fileName);
  	return -1;
Index: openafs/src/viced/callback.c
diff -c openafs/src/viced/callback.c:1.55.2.8 openafs/src/viced/callback.c:1.55.2.9
*** openafs/src/viced/callback.c:1.55.2.8	Fri Mar 11 02:03:46 2005
--- openafs/src/viced/callback.c	Mon Apr 11 14:12:33 2005
***************
*** 83,89 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/callback.c,v 1.55.2.8 2005/03/11 07:03:46 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.9 2005/04/11 18:12:33 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>		/* for malloc() */
***************
*** 1408,1414 ****
--- 1408,1416 ----
  
      ViceLog(25, ("Fsync thread wakeup\n"));
  #ifdef AFS_PTHREAD_ENV
+     FSYNC_LOCK;
      assert(pthread_cond_broadcast(&fsync_cond) == 0);
+     FSYNC_UNLOCK;
  #else
      LWP_NoYieldSignal(fsync_wait);
  #endif
Index: openafs/src/viced/viced.c
diff -c openafs/src/viced/viced.c:1.58.2.3 openafs/src/viced/viced.c:1.58.2.4
*** openafs/src/viced/viced.c:1.58.2.3	Thu Feb 24 10:23:41 2005
--- openafs/src/viced/viced.c	Fri Apr 15 14:25:01 2005
***************
*** 20,26 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/viced.c,v 1.58.2.3 2005/02/24 15:23:41 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.4 2005/04/15 18:25:01 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 1475,1481 ****
      if (code) {
  	if (code == VL_MULTIPADDR) {
  	    ViceLog(0,
! 		    ("VL_RegisterAddrs rpc failed; The ethernet address exist on a different server; repair it\n"));
  	    ViceLog(0,
  		    ("VL_RegisterAddrs rpc failed; See VLLog for details\n"));
  	    return code;
--- 1475,1481 ----
      if (code) {
  	if (code == VL_MULTIPADDR) {
  	    ViceLog(0,
! 		    ("VL_RegisterAddrs rpc failed; The IP address exists on a different server; repair it\n"));
  	    ViceLog(0,
  		    ("VL_RegisterAddrs rpc failed; See VLLog for details\n"));
  	    return code;
Index: openafs/src/vlserver/vlprocs.c
diff -c openafs/src/vlserver/vlprocs.c:1.13 openafs/src/vlserver/vlprocs.c:1.13.2.1
*** openafs/src/vlserver/vlprocs.c:1.13	Sat Nov 29 16:38:04 2003
--- openafs/src/vlserver/vlprocs.c	Tue Apr 26 21:37:06 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlprocs.c,v 1.13 2003/11/29 21:38:04 jaltman Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlprocs.c,v 1.13.2.1 2005/04/27 01:37:06 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 1952,1958 ****
      return (ubik_EndTrans(trans));
  }
  
! #define PADDR(addr) printf("%d.%d.%d.%d", (addr>>24)&0xff, (addr>>16)&0xff, (addr>>8) &0xff, addr&0xff);
  
  afs_int32
  SVL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
--- 1952,1958 ----
      return (ubik_EndTrans(trans));
  }
  
! #define PADDR(addr) VLog(0,("%d.%d.%d.%d", (addr>>24)&0xff, (addr>>16)&0xff, (addr>>8) &0xff, addr&0xff));
  
  afs_int32
  SVL_RegisterAddrs(rxcall, uuidp, spare1, addrsp)
***************
*** 2087,2104 ****
  	|| (!foundUuidEntry && (count > 1))) {
  	VLog(0,
  	     ("The following fileserver is being registered in the VLDB:\n"));
! 	printf("      [");
  	for (k = 0; k < cnt; k++) {
  	    if (k > 0)
! 		printf(" ");
  	    PADDR(addrs[k]);
  	}
! 	printf("]\n");
  
  	if (foundUuidEntry) {
! 	    printf
! 		("   It would have replaced the existing VLDB server entry:\n");
! 	    printf("      entry %d: [", FoundUuid);
  	    base = (HostAddress[FoundUuid] >> 16) & 0xff;
  	    index = HostAddress[FoundUuid] & 0x0000ffff;
  	    exp = &ex_addr[base][index];
--- 2087,2104 ----
  	|| (!foundUuidEntry && (count > 1))) {
  	VLog(0,
  	     ("The following fileserver is being registered in the VLDB:\n"));
! 	VLog(0, ("      ["));
  	for (k = 0; k < cnt; k++) {
  	    if (k > 0)
! 		VLog(0,(" "));
  	    PADDR(addrs[k]);
  	}
! 	VLog(0,("]\n"));
  
  	if (foundUuidEntry) {
! 	    VLog(0,
! 		 ("   It would have replaced the existing VLDB server entry:\n"));
! 	    VLog(0, ("      entry %d: [", FoundUuid));
  	    base = (HostAddress[FoundUuid] >> 16) & 0xff;
  	    index = HostAddress[FoundUuid] & 0x0000ffff;
  	    exp = &ex_addr[base][index];
***************
*** 2106,2126 ****
  		if (!exp->ex_addrs[mhidx])
  		    continue;
  		if (mhidx > 0)
! 		    printf(" ");
  		PADDR(ntohl(exp->ex_addrs[mhidx]));
  	    }
! 	    printf("]\n");
  	}
  
  	if (count == 1)
! 	    printf("   Yet another VLDB server entry exists:\n");
  	else
! 	    printf("   Yet other VLDB server entries exist:\n");
  	for (j = 0; j < count; j++) {
  	    srvidx = WillChange[j];
! 	    printf("      entry %d: ", srvidx);
  	    if ((HostAddress[srvidx] & 0xff000000) == 0xff000000) {
! 		printf("[");
  		base = (HostAddress[srvidx] >> 16) & 0xff;
  		index = HostAddress[srvidx] & 0x0000ffff;
  		exp = &ex_addr[base][index];
--- 2106,2126 ----
  		if (!exp->ex_addrs[mhidx])
  		    continue;
  		if (mhidx > 0)
! 		    VLog(0,(" "));
  		PADDR(ntohl(exp->ex_addrs[mhidx]));
  	    }
! 	    VLog(0, ("]\n"));
  	}
  
  	if (count == 1)
! 	    VLog(0, ("   Yet another VLDB server entry exists:\n"));
  	else
! 	    VLog(0, ("   Yet other VLDB server entries exist:\n"));
  	for (j = 0; j < count; j++) {
  	    srvidx = WillChange[j];
! 	    VLog(0, ("      entry %d: ", srvidx));
  	    if ((HostAddress[srvidx] & 0xff000000) == 0xff000000) {
! 		VLog(0, ("["));
  		base = (HostAddress[srvidx] >> 16) & 0xff;
  		index = HostAddress[srvidx] & 0x0000ffff;
  		exp = &ex_addr[base][index];
***************
*** 2128,2152 ****
  		    if (!exp->ex_addrs[mhidx])
  			continue;
  		    if (mhidx > 0)
! 			printf(" ");
  		    PADDR(ntohl(exp->ex_addrs[mhidx]));
  		}
! 		printf("]");
  	    } else {
  		PADDR(HostAddress[srvidx]);
  	    }
! 	    printf("\n");
  	}
  
  	if (count == 1)
! 	    printf("   You must 'vos changeaddr' this other server entry\n");
  	else
! 	    printf
! 		("   You must 'vos changeaddr' these other server entries\n");
  	if (foundUuidEntry)
! 	    printf
! 		("   and/or remove the sysid file from the registering fileserver\n");
! 	printf("   before the fileserver can be registered in the VLDB.\n");
  
  	ubik_AbortTrans(trans);
  	return VL_MULTIPADDR;
--- 2128,2152 ----
  		    if (!exp->ex_addrs[mhidx])
  			continue;
  		    if (mhidx > 0)
! 			VLog(0, (" "));
  		    PADDR(ntohl(exp->ex_addrs[mhidx]));
  		}
! 		VLog(0, ("]"));
  	    } else {
  		PADDR(HostAddress[srvidx]);
  	    }
! 	    VLog(0, ("\n"));
  	}
  
  	if (count == 1)
! 	    VLog(0, ("   You must 'vos changeaddr' this other server entry\n"));
  	else
! 	    VLog(0, 
! 		("   You must 'vos changeaddr' these other server entries\n"));
  	if (foundUuidEntry)
! 	    VLog(0, 
! 		("   and/or remove the sysid file from the registering fileserver\n"));
! 	VLog(0, ("   before the fileserver can be registered in the VLDB.\n"));
  
  	ubik_AbortTrans(trans);
  	return VL_MULTIPADDR;
***************
*** 2178,2203 ****
      }
  
      VLog(0, ("The following fileserver is being registered in the VLDB:\n"));
!     printf("      [");
      for (k = 0; k < cnt; k++) {
  	if (k > 0)
! 	    printf(" ");
  	PADDR(addrs[k]);
      }
!     printf("]\n");
  
      if (foundUuidEntry) {
! 	printf
! 	    ("   It will replace the following existing entry in the VLDB (same uuid):\n");
! 	printf("      entry %d: [", FoundUuid);
  	for (k = 0; k < VL_MAXIPADDRS_PERMH; k++) {
  	    if (exp->ex_addrs[k] == 0)
  		continue;
  	    if (k > 0)
! 		printf(" ");
  	    PADDR(ntohl(exp->ex_addrs[k]));
  	}
! 	printf("]\n");
      } else if (willReplaceCnt || (count == 1)) {
  	/* If we are not replacing an entry and there is only one entry to change,
  	 * then we will replace that entry.
--- 2178,2203 ----
      }
  
      VLog(0, ("The following fileserver is being registered in the VLDB:\n"));
!     VLog(0, ("      ["));
      for (k = 0; k < cnt; k++) {
  	if (k > 0)
! 	    VLog(0, (" "));
  	PADDR(addrs[k]);
      }
!     VLog(0, ("]\n"));
  
      if (foundUuidEntry) {
! 	VLog(0, 
! 	    ("   It will replace the following existing entry in the VLDB (same uuid):\n"));
! 	VLog(0, ("      entry %d: [", FoundUuid));
  	for (k = 0; k < VL_MAXIPADDRS_PERMH; k++) {
  	    if (exp->ex_addrs[k] == 0)
  		continue;
  	    if (k > 0)
! 		VLog(0, (" "));
  	    PADDR(ntohl(exp->ex_addrs[k]));
  	}
! 	VLog(0, ("]\n"));
      } else if (willReplaceCnt || (count == 1)) {
  	/* If we are not replacing an entry and there is only one entry to change,
  	 * then we will replace that entry.
***************
*** 2213,2236 ****
  	    index = HostAddress[ReplaceEntry] & 0x0000ffff;
  	    exp = &ex_addr[fbase][index];
  
! 	    printf
! 		("   It will replace the following existing entry in the VLDB (new uuid):\n");
! 	    printf("      entry %d: [", ReplaceEntry);
  	    for (k = 0; k < VL_MAXIPADDRS_PERMH; k++) {
  		if (exp->ex_addrs[k] == 0)
  		    continue;
  		if (k > 0)
! 		    printf(" ");
  		PADDR(ntohl(exp->ex_addrs[k]));
  	    }
! 	    printf("]\n");
  	} else {
  	    /* Not a mh entry. So we have to create a new mh entry and 
  	     * put it on the ReplaceEntry slot of the HostAddress array.
  	     */
! 	    printf("   It will replace existing entry %d, ", ReplaceEntry);
  	    PADDR(HostAddress[ReplaceEntry]);
! 	    printf(", in the VLDB (new uuid):\n");
  
  	    code =
  		FindExtentBlock(trans, uuidp, 1, ReplaceEntry, &exp, &fbase);
--- 2213,2236 ----
  	    index = HostAddress[ReplaceEntry] & 0x0000ffff;
  	    exp = &ex_addr[fbase][index];
  
! 	    VLog(0, 
! 		("   It will replace the following existing entry in the VLDB (new uuid):\n"));
! 	    VLog(0, ("      entry %d: [", ReplaceEntry));
  	    for (k = 0; k < VL_MAXIPADDRS_PERMH; k++) {
  		if (exp->ex_addrs[k] == 0)
  		    continue;
  		if (k > 0)
! 		    VLog(0, (" "));
  		PADDR(ntohl(exp->ex_addrs[k]));
  	    }
! 	    VLog(0, ("]\n"));
  	} else {
  	    /* Not a mh entry. So we have to create a new mh entry and 
  	     * put it on the ReplaceEntry slot of the HostAddress array.
  	     */
! 	    VLog(0, ("   It will replace existing entry %d, ", ReplaceEntry));
  	    PADDR(HostAddress[ReplaceEntry]);
! 	    VLog(0,(", in the VLDB (new uuid):\n"));
  
  	    code =
  		FindExtentBlock(trans, uuidp, 1, ReplaceEntry, &exp, &fbase);
***************
*** 2243,2249 ****
  	/* There is no entry for this server, must create a new mh entry as
  	 * well as use a new slot of the HostAddress array.
  	 */
! 	printf("   It will create a new entry in the VLDB.\n");
  	code = FindExtentBlock(trans, uuidp, 1, -1, &exp, &fbase);
  	if (code || !exp) {
  	    ubik_AbortTrans(trans);
--- 2243,2249 ----
  	/* There is no entry for this server, must create a new mh entry as
  	 * well as use a new slot of the HostAddress array.
  	 */
! 	VLog(0, ("   It will create a new entry in the VLDB.\n"));
  	code = FindExtentBlock(trans, uuidp, 1, -1, &exp, &fbase);
  	if (code || !exp) {
  	    ubik_AbortTrans(trans);
***************
*** 2291,2300 ****
  	tex = &ex_addr[fbase][index];
  
  	if (++m == 1)
! 	    printf
! 		("   The following existing entries in the VLDB will be updated:\n");
  
! 	printf("      entry %d: [", WillChange[i]);
  	for (h = j = 0; j < VL_MAXIPADDRS_PERMH; j++) {
  	    if (tex->ex_addrs[j]) {
  		if (j > 0)
--- 2291,2300 ----
  	tex = &ex_addr[fbase][index];
  
  	if (++m == 1)
! 	    VLog(0, 
! 		("   The following existing entries in the VLDB will be updated:\n"));
  
! 	VLog(0, ("      entry %d: [", WillChange[i]));
  	for (h = j = 0; j < VL_MAXIPADDRS_PERMH; j++) {
  	    if (tex->ex_addrs[j]) {
  		if (j > 0)
***************
*** 2315,2321 ****
  	for (j = h; j < VL_MAXIPADDRS_PERMH; j++) {
  	    tex->ex_addrs[j] = 0;	/* zero rest of mh entry */
  	}
! 	printf("]\n");
  
  	/* Write out the modified mh entry */
  	tex->ex_uniquifier = htonl(ntohl(tex->ex_uniquifier) + 1);
--- 2315,2321 ----
  	for (j = h; j < VL_MAXIPADDRS_PERMH; j++) {
  	    tex->ex_addrs[j] = 0;	/* zero rest of mh entry */
  	}
! 	VLog(0, ("]\n"));
  
  	/* Write out the modified mh entry */
  	tex->ex_uniquifier = htonl(ntohl(tex->ex_uniquifier) + 1);
***************
*** 3212,3236 ****
      VLog(0,
  	 ("The following IP address is being %s:\n",
  	  (ipaddr2 ? "changed" : "removed")));
!     printf("      entry %d: ", i);
      if (exp) {
! 	printf("[");
  	for (mhidx = 0; mhidx < VL_MAXIPADDRS_PERMH; mhidx++) {
  	    if (!exp->ex_addrs[mhidx])
  		continue;
  	    if (mhidx > 0)
! 		printf(" ");
  	    PADDR(ntohl(exp->ex_addrs[mhidx]));
  	}
! 	printf("]");
      } else {
  	PADDR(ipaddr1);
      }
      if (ipaddr2) {
! 	printf(" -> ");
  	PADDR(ipaddr2);
      }
!     printf("\n");
  
      /* Change the registered uuuid addresses */
      if (exp) {
--- 3212,3236 ----
      VLog(0,
  	 ("The following IP address is being %s:\n",
  	  (ipaddr2 ? "changed" : "removed")));
!     VLog(0, ("      entry %d: ", i));
      if (exp) {
! 	VLog(0, ("["));
  	for (mhidx = 0; mhidx < VL_MAXIPADDRS_PERMH; mhidx++) {
  	    if (!exp->ex_addrs[mhidx])
  		continue;
  	    if (mhidx > 0)
! 		VLog(0, (" "));
  	    PADDR(ntohl(exp->ex_addrs[mhidx]));
  	}
! 	VLog(0, ("]"));
      } else {
  	PADDR(ipaddr1);
      }
      if (ipaddr2) {
! 	VLog(0, (" -> "));
  	PADDR(ipaddr2);
      }
!     VLog(0, ("\n"));
  
      /* Change the registered uuuid addresses */
      if (exp) {
Index: openafs/src/vol/fssync.c
diff -c openafs/src/vol/fssync.c:1.26.2.1 openafs/src/vol/fssync.c:1.26.2.3
*** openafs/src/vol/fssync.c:1.26.2.1	Wed Aug 25 03:14:19 2004
--- openafs/src/vol/fssync.c	Tue Apr 26 21:37:09 2005
***************
*** 50,56 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync.c,v 1.26.2.1 2004/08/25 07:14:19 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 50,56 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync.c,v 1.26.2.3 2005/04/27 01:37:09 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 169,186 ****
  	FS_sd = getport(&addr);
  	if (connect(FS_sd, (struct sockaddr *)&addr, sizeof(addr)) >= 0)
  	    return 1;
- #if defined(AFS_SGI_ENV)
- 	/* down with worthless error messages! */
- 	if (!*timeout) {
- 	    perror("FSYNC_clientInit failed (after many retries)");
- 	    break;
- 	}
- #else
  	if (!*timeout)
  	    break;
  	if (!(*timeout & 1))
! 	    perror("FSYNC_clientInit temporary failure (will retry)");
! #endif
  	FSYNC_clientFinis();
  	sleep(*timeout++);
      }
--- 169,178 ----
  	FS_sd = getport(&addr);
  	if (connect(FS_sd, (struct sockaddr *)&addr, sizeof(addr)) >= 0)
  	    return 1;
  	if (!*timeout)
  	    break;
  	if (!(*timeout & 1))
! 	    Log(0, ("FSYNC_clientInit temporary failure (will retry)"));
  	FSYNC_clientFinis();
  	sleep(*timeout++);
      }
***************
*** 197,203 ****
      close(FS_sd);
  #endif
      FS_sd = -1;
-     Lock_Destroy(&FSYNC_handler_lock);
  }
  
  int
--- 189,194 ----
Index: openafs/src/vol/vnode.c
diff -c openafs/src/vol/vnode.c:1.19.2.1 openafs/src/vol/vnode.c:1.19.2.2
*** openafs/src/vol/vnode.c:1.19.2.1	Wed Aug 25 03:14:19 2004
--- openafs/src/vol/vnode.c	Sun Apr 24 10:21:36 2005
***************
*** 17,23 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/vnode.c,v 1.19.2.1 2004/08/25 07:14:19 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.2 2005/04/24 14:21:36 shadow Exp $");
  
  #include <errno.h>
  #include <stdio.h>
***************
*** 428,433 ****
--- 428,434 ----
      vnp->disk.uniquifier = unique;
      vnp->handle = NULL;
      vcp->allocs++;
+     vp->header->diskstuff.filecount++;
      return vnp;
  }
  
***************
*** 760,765 ****
--- 761,768 ----
  		 * (doing so could cause a "addled bitmap" message).
  		 */
  		if (vnp->delete && !*ec) {
+ 		    if (vnp->volumePtr->header->diskstuff.filecount-- < 1)
+ 			vnp->volumePtr->header->diskstuff.filecount = 0;
  		    VFreeBitMapEntry_r(ec, &vp->vnodeIndex[class],
  				       vnodeIdToBitNumber(vnp->vnodeNumber));
  		}
Index: openafs/src/vol/vnode.h
diff -c openafs/src/vol/vnode.h:1.12 openafs/src/vol/vnode.h:1.12.2.1
*** openafs/src/vol/vnode.h:1.12	Fri Aug  8 16:40:45 2003
--- openafs/src/vol/vnode.h	Thu Apr 28 01:03:39 2005
***************
*** 138,144 ****
      VnodeId vnodeNumber;
      struct Volume
       *volumePtr;		/* Pointer to the volume containing this file */
!     byte nUsers;		/* Number of lwp's who have done a VGetVnode */
      bit32 cacheCheck;		/* Must equal the value in the volume Header
  				 * for the cache entry to be valid */
      struct Lock lock;		/* Internal lock */
--- 138,144 ----
      VnodeId vnodeNumber;
      struct Volume
       *volumePtr;		/* Pointer to the volume containing this file */
!     bit32 nUsers;		/* Number of lwp's who have done a VGetVnode */
      bit32 cacheCheck;		/* Must equal the value in the volume Header
  				 * for the cache entry to be valid */
      struct Lock lock;		/* Internal lock */
Index: openafs/src/vol/volume.c
diff -c openafs/src/vol/volume.c:1.35.2.2 openafs/src/vol/volume.c:1.35.2.3
*** openafs/src/vol/volume.c:1.35.2.2	Mon Dec 13 14:41:10 2004
--- openafs/src/vol/volume.c	Wed Apr 13 22:00:36 2005
***************
*** 20,26 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/volume.c,v 1.35.2.2 2004/12/13 19:41:10 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.3 2005/04/14 02:00:36 shadow Exp $");
  
  #include <rx/xdr.h>
  #include <afs/afsint.h>
***************
*** 325,330 ****
--- 325,331 ----
      if (programType == volumeUtility && connect) {
  	if (!VConnectFS()) {
  	    Log("Unable to connect to file server; aborted\n");
+ 	    Lock_Destroy(&FSYNC_handler_lock);
  	    exit(1);
  	}
      }
Index: openafs/src/volser/vos.c
diff -c openafs/src/volser/vos.c:1.40.2.8 openafs/src/volser/vos.c:1.40.2.9
*** openafs/src/volser/vos.c:1.40.2.8	Sun Apr  3 16:23:00 2005
--- openafs/src/volser/vos.c	Fri Apr 15 14:46:25 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40.2.8 2005/04/03 20:23:00 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40.2.9 2005/04/15 18:46:25 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 3138,3144 ****
  	    restoreflags |= RV_LUNEW;
  	    break;
  	default:
! 	    restoreflags |= RV_LUKEEP;
      }
  
      code =
--- 3138,3144 ----
  	    restoreflags |= RV_LUNEW;
  	    break;
  	default:
! 	    restoreflags |= RV_LUDUMP;
      }
  
      code =
Index: openafs/src/volser/vsprocs.c
diff -c openafs/src/volser/vsprocs.c:1.33.2.3 openafs/src/volser/vsprocs.c:1.33.2.4
*** openafs/src/volser/vsprocs.c:1.33.2.3	Sun Jan 30 23:34:47 2005
--- openafs/src/volser/vsprocs.c	Fri Apr 15 14:46:26 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.33.2.3 2005/01/31 04:34:47 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.33.2.4 2005/04/15 18:46:26 shadow Exp $");
  
  #include <stdio.h>
  #include <sys/types.h>
***************
*** 68,74 ****
  int verbose = 0;
  
  struct release {
!     afs_int32 time;
      afs_int32 vldbEntryIndex;
  };
  
--- 68,75 ----
  int verbose = 0;
  
  struct release {
!     afs_int32 crtime;
!     afs_int32 uptime;
      afs_int32 vldbEntryIndex;
  };
  
***************
*** 162,173 ****
  		  afs_int32 flags);
  static int GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
  		    struct rx_connection **connPtr, afs_int32 * transPtr,
! 		    afs_int32 * timePtr);
  static int SimulateForwardMultiple(struct rx_connection *fromconn,
  				   afs_int32 fromtid, afs_int32 fromdate,
  				   manyDests * tr, afs_int32 flags,
  				   void *cookie, manyResults * results);
- static int rel_compar(struct release *r1, struct release *r2);
  static afs_int32 CheckVolume(volintInfo * volumeinfo, afs_int32 aserver,
  			     afs_int32 apart, afs_int32 * modentry,
  			     afs_uint32 * maxvolid);
--- 163,173 ----
  		  afs_int32 flags);
  static int GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
  		    struct rx_connection **connPtr, afs_int32 * transPtr,
! 		    afs_int32 * crtimePtr, afs_int32 * uptimePtr);
  static int SimulateForwardMultiple(struct rx_connection *fromconn,
  				   afs_int32 fromtid, afs_int32 fromdate,
  				   manyDests * tr, afs_int32 flags,
  				   void *cookie, manyResults * results);
  static afs_int32 CheckVolume(volintInfo * volumeinfo, afs_int32 aserver,
  			     afs_int32 apart, afs_int32 * modentry,
  			     afs_uint32 * maxvolid);
***************
*** 3006,3020 ****
  static int
  GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
  	 struct rx_connection **connPtr, afs_int32 * transPtr,
! 	 afs_int32 * timePtr)
  {
      afs_int32 volid;
      struct volser_status tstatus;
      int code, rcode, tcode;
  
      *connPtr = (struct rx_connection *)0;
-     *timePtr = 0;
      *transPtr = 0;
  
      /* get connection to the replication site */
      *connPtr = UV_Bind(vldbEntryPtr->serverNumber[index], AFSCONF_VOLUMEPORT);
--- 3006,3021 ----
  static int
  GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
  	 struct rx_connection **connPtr, afs_int32 * transPtr,
! 	 afs_int32 * crtimePtr, afs_int32 * uptimePtr)
  {
      afs_int32 volid;
      struct volser_status tstatus;
      int code, rcode, tcode;
  
      *connPtr = (struct rx_connection *)0;
      *transPtr = 0;
+     *crtimePtr = 0;
+     *uptimePtr = 0;
  
      /* get connection to the replication site */
      *connPtr = UV_Bind(vldbEntryPtr->serverNumber[index], AFSCONF_VOLUMEPORT);
***************
*** 3086,3092 ****
  		       code);
  	    goto fail;
  	}
! 	*timePtr = tstatus.creationDate - CLOCKSKEW;
      }
  
      return 0;
--- 3087,3094 ----
  		       code);
  	    goto fail;
  	}
! 	*crtimePtr = tstatus.creationDate - CLOCKSKEW;
! 	*uptimePtr = tstatus.updateDate - CLOCKSKEW;
      }
  
      return 0;
***************
*** 3121,3132 ****
  }
  
  
- static int
- rel_compar(struct release *r1, struct release *r2)
- {
-     return (r1->time - r2->time);
- }
- 
  /* UV_ReleaseVolume()
   *    Release volume <afromvol> on <afromserver> <afrompart> to all
   *    its RO sites (full release). Unless the previous release was
--- 3123,3128 ----
***************
*** 3166,3175 ****
      manyDests tr;
      manyResults results;
      int rwindex, roindex, roclone, roexists;
!     afs_int32 rwcrdate, clcrdate;
      struct rtime {
  	int validtime;
! 	afs_uint32 time;
      } remembertime[NMAXNSERVERS];
      int releasecount = 0;
      struct volser_status volstatus;
--- 3162,3171 ----
      manyDests tr;
      manyResults results;
      int rwindex, roindex, roclone, roexists;
!     afs_int32 rwcrdate, rwupdate, clcrdate;
      struct rtime {
  	int validtime;
! 	afs_uint32 uptime;
      } remembertime[NMAXNSERVERS];
      int releasecount = 0;
      struct volser_status volstatus;
***************
*** 3266,3271 ****
--- 3262,3268 ----
  	    ONERROR(code, afromvol,
  		    "Failed to get the status of RW volume %u\n");
  	    rwcrdate = volstatus.creationDate;
+ 	    rwupdate = volstatus.updateDate;
  
  	    /* End transaction on RW */
  	    code = AFSVolEndTrans(fromconn, fromtid, &rcode);
***************
*** 3286,3296 ****
  		    "Failed to get the status of RW clone %u\n");
  	    clcrdate = volstatus.creationDate;
  
! 	    /* End transaction on RW */
  	    code = AFSVolEndTrans(fromconn, clonetid, &rcode);
  	    clonetid = 0;
  	    ONERROR((code ? code : rcode), cloneVolId,
! 		    "Failed to end transaction on RW volume %u\n");
  
  	    if (rwcrdate > clcrdate)
  		fullrelease = 2;/* Do a full release if RO clone older than RW */
--- 3283,3293 ----
  		    "Failed to get the status of RW clone %u\n");
  	    clcrdate = volstatus.creationDate;
  
! 	    /* End transaction on clone */
  	    code = AFSVolEndTrans(fromconn, clonetid, &rcode);
  	    clonetid = 0;
  	    ONERROR((code ? code : rcode), cloneVolId,
! 		    "Failed to end transaction on RW clone %u\n");
  
  	    if (rwcrdate > clcrdate)
  		fullrelease = 2;/* Do a full release if RO clone older than RW */
***************
*** 3354,3363 ****
  	    if (roclone) {
  		strcpy(vname, entry.name);
  		strcat(vname, ".readonly");
! 		VPRINT("Cloning RW volume %u to permanent RO...");
  	    } else {
  		strcpy(vname, "readonly-clone-temp");
! 		VPRINT("Cloning RW volume %u to temporary RO...");
  	    }
  	    code =
  		AFSVolClone(fromconn, clonetid, 0, readonlyVolume, vname,
--- 3351,3360 ----
  	    if (roclone) {
  		strcpy(vname, entry.name);
  		strcat(vname, ".readonly");
! 		VPRINT1("Cloning RW volume %u to permanent RO...", afromvol);
  	    } else {
  		strcpy(vname, "readonly-clone-temp");
! 		VPRINT1("Cloning RW volume %u to temporary RO...", afromvol);
  	    }
  	    code =
  		AFSVolClone(fromconn, clonetid, 0, readonlyVolume, vname,
***************
*** 3367,3384 ****
  	}
  
  	/* Get the time the RW was created for future information */
! 	VPRINT1("Getting status of RW volume %u...", cloneVolId);
  	code = AFSVolGetStatus(fromconn, clonetid, &volstatus);
! 	ONERROR(code, cloneVolId,
  		"Failed to get the status of the RW volume %u\n");
  	VDONE;
  	rwcrdate = volstatus.creationDate;
  
  	/* End the transaction on the RW volume */
! 	VPRINT1("Ending cloning transaction on RW volume %u...", cloneVolId);
  	code = AFSVolEndTrans(fromconn, clonetid, &rcode);
  	clonetid = 0;
! 	ONERROR((code ? code : rcode), cloneVolId,
  		"Failed to end cloning transaction on RW %u\n");
  	VDONE;
  
--- 3364,3382 ----
  	}
  
  	/* Get the time the RW was created for future information */
! 	VPRINT1("Getting status of RW volume %u...", afromvol);
  	code = AFSVolGetStatus(fromconn, clonetid, &volstatus);
! 	ONERROR(code, afromvol,
  		"Failed to get the status of the RW volume %u\n");
  	VDONE;
  	rwcrdate = volstatus.creationDate;
+ 	rwupdate = volstatus.updateDate;
  
  	/* End the transaction on the RW volume */
! 	VPRINT1("Ending cloning transaction on RW volume %u...", afromvol);
  	code = AFSVolEndTrans(fromconn, clonetid, &rcode);
  	clonetid = 0;
! 	ONERROR((code ? code : rcode), afromvol,
  		"Failed to end cloning transaction on RW %u\n");
  	VDONE;
  
***************
*** 3520,3532 ****
  	    code =
  		GetTrans(&entry, vldbindex, &(toconns[volcount]),
  			 &(replicas[volcount].trans),
! 			 &(times[volcount].time));
  	    if (code)
  		continue;
  
  	    /* Thisdate is the date from which we want to pick up all changes */
  	    if (forceflag || !fullrelease
! 		|| (rwcrdate > times[volcount].time)) {
  		/* If the forceflag is set, then we want to do a full dump.
  		 * If it's not a full release, we can't be sure that the creation
  		 *  date is good (so we also do a full dump).
--- 3518,3531 ----
  	    code =
  		GetTrans(&entry, vldbindex, &(toconns[volcount]),
  			 &(replicas[volcount].trans),
! 			 &(times[volcount].crtime),
! 			 &(times[volcount].uptime));
  	    if (code)
  		continue;
  
  	    /* Thisdate is the date from which we want to pick up all changes */
  	    if (forceflag || !fullrelease
! 		|| (rwcrdate > times[volcount].crtime)) {
  		/* If the forceflag is set, then we want to do a full dump.
  		 * If it's not a full release, we can't be sure that the creation
  		 *  date is good (so we also do a full dump).
***************
*** 3541,3554 ****
  		 * case time[volcount].time would be now instead of 0.
  		 */
  		thisdate =
! 		    (remembertime[vldbindex].time <
! 		     times[volcount].time) ? remembertime[vldbindex].
! 		    time : times[volcount].time;
  	    } else {
! 		thisdate = times[volcount].time;
  	    }
  	    remembertime[vldbindex].validtime = 1;
! 	    remembertime[vldbindex].time = thisdate;
  
  	    if (volcount == 0) {
  		fromdate = thisdate;
--- 3540,3553 ----
  		 * case time[volcount].time would be now instead of 0.
  		 */
  		thisdate =
! 		    (remembertime[vldbindex].uptime < times[volcount].uptime)
! 			? remembertime[vldbindex].uptime
! 			: times[volcount].uptime;
  	    } else {
! 		thisdate = times[volcount].uptime;
  	    }
  	    remembertime[vldbindex].validtime = 1;
! 	    remembertime[vldbindex].uptime = thisdate;
  
  	    if (volcount == 0) {
  		fromdate = thisdate;
***************
*** 3586,3591 ****
--- 3585,3592 ----
  
  	    if (fromdate == 0)
  		fprintf(STDOUT, " (full release)");
+ 	    else
+ 		fprintf(STDOUT, " (as of %.24s)", ctime((time_t *)&fromdate));
  	    fprintf(STDOUT, ".\n");
  	    fflush(STDOUT);
  	}
