venus: Remove dedebug 38/15738/3 master
authorAndrew Deason <adeason@sinenomine.net>
Thu, 18 Apr 2024 02:28:11 +0000 (21:28 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 18 Apr 2024 20:50:37 +0000 (16:50 -0400)
This utility has never been built by default, currently does not build
(because RXAFSCB_GetDE doesn't exist), and generates many warnings.
Remove the dead code.

Change-Id: I4c91eb44b3b3c265f0741b9918601abf338b492a
Reviewed-on: https://gerrit.openafs.org/15738
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

222 files changed:
CODING
INSTALL
Makefile.in
acinclude.m4
build-tools/libafsdep
doc/man-pages/generate-man
doc/man-pages/pod1/pts.pod
doc/man-pages/pod1/vos.pod.in
doc/man-pages/pod8/bos.pod
doc/xml/AdminGuide/auagd014.xml
src/WINNT/afsd/cm_volume.c
src/WINNT/install/NSIS/CellServDB
src/WINNT/install/wix/CellServDB
src/afs/AIX/osi_machdep.h
src/afs/AIX/osi_sleep.c
src/afs/FBSD/osi_vfsops.c
src/afs/HPUX/osi_vfsops.c
src/afs/LINUX/osi_alloc.c
src/afs/LINUX/osi_compat.h
src/afs/LINUX/osi_crypto.c
src/afs/LINUX/osi_file.c
src/afs/LINUX/osi_gcpags.c
src/afs/LINUX/osi_groups.c
src/afs/LINUX/osi_ioctl.c
src/afs/LINUX/osi_machdep.h
src/afs/LINUX/osi_module.c
src/afs/LINUX/osi_pag_module.c
src/afs/LINUX/osi_pagecopy.c
src/afs/LINUX/osi_probe.c
src/afs/LINUX/osi_syscall.c
src/afs/LINUX/osi_sysctl.c
src/afs/LINUX/osi_vcache.c
src/afs/LINUX/osi_vnodeops.c
src/afs/NBSD/osi_kmod.c
src/afs/NBSD/osi_vfsops.c
src/afs/OBSD/osi_vfsops.c
src/afs/SOLARIS/osi_vfsops.c
src/afs/UKERNEL/afs_usrops.c
src/afs/UKERNEL/afsincludes.h
src/afs/VNOPS/afs_vnop_lookup.c
src/afs/afs.h
src/afs/afs_buffer.c
src/afs/afs_bypasscache.c
src/afs/afs_bypasscache.h
src/afs/afs_call.c
src/afs/afs_callback.c
src/afs/afs_daemons.c
src/afs/afs_dcache.c
src/afs/afs_disconnected.c
src/afs/afs_dynroot.c
src/afs/afs_fetchstore.c
src/afs/afs_icl.c
src/afs/afs_memcache.c
src/afs/afs_nfsclnt.c
src/afs/afs_osi.c
src/afs/afs_osi.h
src/afs/afs_pag_call.c
src/afs/afs_pag_cred.c
src/afs/afs_pioctl.c
src/afs/afs_prototypes.h
src/afs/afs_server.c
src/afs/afs_user.c
src/afs/afs_vcache.c
src/afs/afsincludes.h
src/afsd/CellServDB
src/afsd/afsd.c
src/afsd/afsd_kernel.c
src/aklog/klog.c
src/audit/audit.c
src/auth/authcon.c
src/auth/ktc.c
src/bozo/bnode.c
src/bozo/bnode_internal.h
src/bozo/bos.c
src/bozo/bosoprocs.c
src/bozo/bosprototypes.h
src/bozo/bosserver.c
src/bozo/cronbnodeops.c
src/bozo/ezbnodeops.c
src/bozo/fsbnodeops.c
src/bu_utils/fms.c
src/bucoord/.gitignore
src/bucoord/Makefile.in
src/bucoord/btest.c
src/bucoord/main.c
src/bucoord/ttest.c [deleted file]
src/butc/.gitignore
src/butc/Makefile.in
src/butc/NTMakefile
src/butc/tdump.c
src/butc/test.c [deleted file]
src/butm/.gitignore [new file with mode: 0644]
src/butm/Makefile.in
src/butm/butm_test.c
src/butm/test_ftm.c
src/cf/c-flexible-array.m4 [new file with mode: 0644]
src/cf/crosstools.m4
src/cf/curses.m4
src/cf/gcc.m4 [new file with mode: 0644]
src/cf/gss.m4
src/cf/linux-checks.m4
src/cf/linux-kernel-assorted.m4
src/cf/linux-kernel-func.m4
src/cf/linux-kernel-header.m4
src/cf/linux-kernel-path.m4
src/cf/linux-kernel-sig.m4
src/cf/linux-kernel-struct.m4
src/cf/linux-test1.m4
src/cf/linux-test4.m4
src/cf/options.m4
src/cf/osconf.m4
src/cf/ostype.m4
src/cf/sysname.m4
src/comerr/Makefile.in
src/config/afs_args.h
src/config/afs_sysnames.h
src/config/param.darwin_220.h [new file with mode: 0644]
src/config/param.darwin_230.h [new file with mode: 0644]
src/config/param.i386_dfbsd_23.h
src/config/param.rs_aix71.h [new file with mode: 0644]
src/config/param.rs_aix72.h
src/config/param.rs_aix73.h [new file with mode: 0644]
src/crypto/hcrypto/kernel/config.h
src/crypto/hcrypto/kernel/roken.h
src/crypto/rfc3961/Makefile.in
src/crypto/rfc3961/krb5_locl.h
src/dir/Makefile.in
src/dir/dir.c
src/dir/dir.h
src/dir/salvage.c
src/export/.gitignore
src/export/Makefile.in
src/external/libafsdep
src/finale/Makefile.in
src/fsint/afsint.xg
src/fsint/liboafs_fsint.la.sym
src/fsprobe/fsprobe_callback.c
src/kauth/kadatabase.c
src/kauth/kkids.c
src/libadmin/adminutil/afs_utilAdmin.c
src/libadmin/adminutil/afs_utilAdmin.h
src/libadmin/vos/vsprocs.c
src/libafs/Makefile.common.in
src/libafs/MakefileProto.AIX.in
src/libafs/MakefileProto.LINUX.in
src/libafs/afs.arm_darwin_220.plist.in [new file with mode: 0644]
src/libafs/afs.arm_darwin_230.plist.in [new file with mode: 0644]
src/libafs/afs.x86_darwin_220.plist.in [new file with mode: 0644]
src/libafs/afs.x86_darwin_230.plist.in [new file with mode: 0644]
src/libafs/make_kbuild_makefile.pl
src/libuafs/Makefile.common.in
src/libuafs/ukernel_swig.i
src/lwp/Makefile.in
src/opr/opr.h
src/packaging/MacOS/OpenAFS.post_install
src/packaging/MacOS/ReadMe.rtf.22 [new file with mode: 0644]
src/packaging/MacOS/ReadMe.rtf.23 [new file with mode: 0644]
src/packaging/MacOS/pkgbuild.sh.in
src/packaging/RedHat/makesrpm.pl
src/packaging/RedHat/openafs-client.modules [deleted file]
src/packaging/RedHat/openafs.spec.in
src/ptserver/db_verify.c
src/ptserver/pts.c
src/roken/Makefile.in
src/rx/AIX/rx_knet.c
src/rx/LINUX/rx_knet.c
src/rx/UKERNEL/rx_knet.c
src/rx/liboafs_rx.la.sym
src/rx/rx.c
src/rx/rx.h
src/rx/rx_atomic.h
src/rx/rx_event.c
src/rx/rx_getaddr.c
src/rx/rx_globals.h
src/rx/rx_internal.h
src/rx/rx_kcommon.c
src/rx/rx_kernel.h
src/rx/rx_packet.c
src/rx/rx_prototypes.h
src/rx/rx_pthread.c
src/rx/rx_rdwr.c
src/rx/xdr.c
src/rxdebug/rxdebug.c
src/rxgen/rpc_parse.c
src/rxkad/fcrypt.c
src/rxkad/rxkad_common.c
src/rxkad/ticket5.c
src/sys/rmtsysnet.c
src/tools/dumpscan/dumptool.c
src/tools/rxperf/rxperf.c
src/ubik/beacon.c
src/ubik/recovery.c
src/ubik/remote.c
src/ubik/ubik.p.h
src/uss/uss_acl.c
src/util/afsutil.h
src/util/liboafs_util.la.sym
src/util/pthread_glock.c
src/util/volparse.c
src/venus/Makefile.in
src/venus/dedebug.c [deleted file]
src/viced/afsfileprocs.c
src/viced/callback.c
src/viced/host.c
src/viced/serialize_state.c
src/viced/state_analyzer.c
src/viced/viced.c
src/vlserver/vlclient.c
src/vol/clone.c
src/vol/namei_ops.c
src/vol/volume.c
src/volser/dumpstuff.c
src/volser/restorevol.c
src/volser/vos.c
src/volser/vsutils.c
src/xstat/xstat_fs_callback.c
tests/TESTS
tests/rx/.gitignore
tests/rx/Makefile.in
tests/rx/atomic-t.c [new file with mode: 0644]
tests/rx/perf-t
tests/util/volutil-t.c

diff --git a/CODING b/CODING
index fef643d..aff53f9 100644 (file)
--- a/CODING
+++ b/CODING
@@ -306,13 +306,13 @@ the fix is to mark that warning as ignored, but only for clang. For example:
   # endif
   #endif
 
-If the source cannot be changed to add a pragma, you might be abe to use the
+If the source cannot be changed to add a pragma, you might be able to use the
 autoconf function AX_APPEND_COMPILE_FLAGS to create a new macro that disables
 the warning and then use macro for the build options for that file. For an
 example, see how the autoconf macro CFLAGS_NOIMPLICIT_FALLTHROUGH is defined and
 used.
 
-Finally if there isn't a way to disable the specific warning, you will need to
+Finally, if there isn't a way to disable the specific warning, you will need to
 disable all warnings for the file in question. You can do this by supplying
 the autoconf macro @CFLAGS_NOERROR@ in the build options for the file. For
 example:
@@ -339,6 +339,8 @@ external/heimdal/hcrypto/evp.c:      cast-function-type
              : Linux kernel build uses -Wcast-function-type
 external/heimdal/hcrypto/evp-algs.c: cast-function-type
              : Linux kernel build uses -Wcast-function-type
+external/heimdal/krb5/crypto.c: use-after-free : False postive on certain GCC
+                                                 compilers
 kauth/admin_tools.c  : strict-proto  : ubik_Call
 kauth/authclient.c   : strict-proto  : ubik_Call nonsense
 libadmin/kas/afs_kasAdmin.c: strict-proto : ubik_Call nonsense
@@ -351,4 +353,6 @@ rxkad/ticket5.c      : format-truncation : inside included file v5der.c in the
                                        function _heim_time2generalizedtime, the
                                        two snprintf calls raise
                                        format-truncation warnings due to the
-                                       arithmetic on tm_year and tm_mon fields
\ No newline at end of file
+                                       arithmetic on tm_year and tm_mon fields
+lwp/process.c        : dangling-pointer : Ignore the legitimate use of saving
+                                       the address of a stack variable
diff --git a/INSTALL b/INSTALL
index 3d362e0..a308672 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -58,7 +58,8 @@ A  Configuring
          ppc_darwin_70, ppc_darwin_80, ppc_darwin_90
       ppc_linux26
       ppc_nbsd16, ppc_nbsd20
-      rs_aix42, rs_aix51, rs_aix52, rs_aix53, rs_aix61
+      rs_aix42, rs_aix51, rs_aix52, rs_aix53, rs_aix61, rs_aix71,
+         rs_aix72, rs_aix73
       s390_linux26
       s390x_linux26
       sgi_62, sgi_63, sgi_64, sgi_65 (file server not tested)
@@ -580,4 +581,4 @@ J  Creating 'configure'
 
    It is possible to create the configure script on one system to be used on
    another. Ensure that the files created by 'regen.sh' are copied to the
-   target system.
\ No newline at end of file
+   target system.
index 3387796..5c431d9 100644 (file)
@@ -458,9 +458,6 @@ kauth_depinstall: config rxgen comerr
 ptserver_depinstall: config rxgen comerr
        +${COMPILE_PART1} ptserver ${COMPILE_DEPINSTALL}
 
-${DEST}/bin/dedebug: dedebug
-       ${INSTALL} $? $@
-
 
 #
 # libafs build targets
@@ -797,6 +794,7 @@ distclean: clean
        /bin/rm -rf lib include packages
        /bin/rm -f config.log config.cache config.status \
        src/config/afsconfig.h src/config/stamp-h1 \
+       src/config/cc-wrapper \
        src/libafs/Makefile \
        src/libuafs/Makefile \
        Makefile \
@@ -878,6 +876,7 @@ distclean: clean
        src/packaging/MacOS/OpenAFS.Info.plist \
        src/packaging/MacOS/OpenAFS.info \
        src/packaging/MacOS/buildpkg.sh \
+       src/packaging/MacOS/pkgbuild.sh \
        src/packaging/RedHat/openafs.spec \
        src/pam/Makefile \
        src/platform/Makefile \
index 209fa34..4df1bcd 100644 (file)
@@ -56,6 +56,7 @@ OPENAFS_HCRYPTO
 OPENAFS_CURSES
 OPENAFS_C_ATTRIBUTE
 OPENAFS_C_PRAGMA
+OPENAFS_C_FLEXIBLE_ARRAY
 OPENAFS_MORE_ROKEN_CHECKS
 OPENAFS_NETDB_CHECKS
 OPENAFS_ROKEN_HEADERS
index f7bfa3a..c32b2f6 100644 (file)
@@ -2,5 +2,6 @@ config.guess
 config.sub
 git-version
 install-sh
+ltmain.sh
 missing
 mkinstalldirs
index 726e0cb..c696bc0 100755 (executable)
@@ -49,8 +49,9 @@ pod3=`ls pod3`
 if [ -n "$pod3" ] ; then
     cd pod3
     for f in *.pod ; do
-        pod2man -c 'AFS Library Reference' -r 'OpenAFS' -s 3 "$f" \
-            > ../man3/`echo "$f" | sed -e 's/\.pod$//' -e 's/^AFS\./AFS::/'`.3
+        name=`echo "$f" | sed -e 's/\.pod$//' -e 's/^AFS\./AFS::/'`
+        pod2man -c 'AFS Library Reference' -r 'OpenAFS' -s 3 "$f" -n "$name" \
+            > ../man3/${name}.3
        # Perl module manpages are named AFS.foo instead of AFS::foo, since
        # we cannot have colons in filenames on Windows. So here, we assume
        # anything with "AFS." should be "AFS::" instead.
index 1a3a009..36eebc1 100644 (file)
@@ -111,18 +111,36 @@ The value of the AFSCELL environment variable.
 
 The local F</usr/vice/etc/ThisCell> file.
 
+=item *
+
+The local F</usr/afs/etc/ThisCell> file.
+
+=back
+
 Do not combine the B<-cell> and B<-localauth> options. A command on which
 the B<-localauth> flag is included always runs in the local cell (as
 defined in the server machine's local F</usr/afs/etc/ThisCell> file),
 whereas a command on which the B<-cell> argument is included runs in the
 specified foreign cell.
 
-=back
-
 =item B<-config> <I<config directory>>
 
 The location of the directory to use to obtain configuration information,
 including the CellServDB. This is primarily provided for testing purposes.
+If the B<-config> and B<-localauth> arguments are omitted, the command
+interpreter searches for the configuration information in the following order:
+
+=over 4
+
+=item *
+
+The F</usr/vice/etc> directory.
+
+=item *
+
+The F</usr/afs/etc> directory.
+
+=back
 
 =item B<-force>
 
index 3dab98b..1438376 100644 (file)
@@ -157,6 +157,10 @@ The value of the AFSCELL environment variable.
 
 The local F</usr/vice/etc/ThisCell> file.
 
+=item *
+
+The local F</usr/afs/etc/ThisCell> file.
+
 =back
 
 Do not combine the B<-cell> and B<-localauth> options. A command on which
@@ -169,6 +173,20 @@ specified foreign cell.
 
 The location of the directory to use to obtain configuration information,
 including the CellServDB. This is primarily provided for testing purposes.
+If the B<-config> and B<-localauth> arguments are omitted, the command
+interpreter searches for the configuration information in the following order:
+
+=over 4
+
+=item *
+
+The F</usr/vice/etc> directory.
+
+=item *
+
+The F</usr/afs/etc> directory.
+
+=back
 
 =item B<-help>
 
index 70f9126..59889ed 100644 (file)
@@ -147,6 +147,10 @@ The value of the AFSCELL environment variable.
 
 The local F</usr/vice/etc/ThisCell> file.
 
+=item *
+
+The local F</usr/afs/etc/ThisCell> file.
+
 =back
 
 Do not combine the B<-cell> and B<-localauth> options. A command on which
index 70dbde2..4774212 100644 (file)
     90-second ubik recovery time has passed, the database servers should have
     elected a new coordinator, allowing write transactions to proceed
     again.</para>
-    </sect2>
 
     <sect2 id="Header_430">
       <title>To create a new server encryption key in emergencies</title>
index 1fdbf41..017c50f 100644 (file)
@@ -1989,9 +1989,9 @@ cm_VolumeStateByName(cm_volume_t *volp, char *volname)
     size_t len = strlen(volname);
     cm_vol_state_t *statep;
 
-    if (cm_stricmp_utf8N(".readonly", &volname[len-9]) == 0)
+    if (len >= 9 && cm_stricmp_utf8N(".readonly", &volname[len - 9]) == 0)
         statep = &volp->vol[ROVOL];
-    else if (cm_stricmp_utf8N(".backup", &volname[len-7]) == 0)
+    else if (len >= 7 && cm_stricmp_utf8N(".backup", &volname[len - 7]) == 0)
         statep = &volp->vol[BACKVOL];
     else
         statep = &volp->vol[RWVOL];
index a6bd8fc..63e3330 100644 (file)
@@ -1,4 +1,4 @@
->grand.central.org      #GCO Public CellServDB 14 May 2018
+>grand.central.org      #GCO Public CellServDB 31 Oct 2023
 18.9.48.14                      #grand.mit.edu
 128.2.13.219                    #grand-old-opry.central.org
 >wu-wien.ac.at          #University of Economics, Vienna, Austria
 129.128.98.17                   #mystery.ucs.ualberta.ca
 129.128.125.40                  #drake.ucs.ualberta.ca
 >cern.ch                #European Laboratory for Particle Physics, Geneva
-137.138.128.148                 #afsdb1.cern.ch
-137.138.246.50                  #afsdb3.cern.ch
-137.138.246.51                  #afsdb2.cern.ch
+137.138.54.120                  #afsdb13.cern.ch
+188.184.21.218                  #afsdb11.cern.ch
+188.184.23.130                  #afsdb14.cern.ch
+188.184.81.230                  #afsdb12.cern.ch
 >ams.cern.ch            #AMS Experiment
-137.138.188.185                 #ams.cern.ch
-137.138.199.58                  #pcamsf4.cern.ch
 >epfl.ch                #Swiss Federal Institute of Technology at Lausanne
 128.178.109.111                 #kd1.epfl.ch
 128.178.109.112                 #kd2.epfl.ch
@@ -59,8 +58,8 @@
 195.113.0.40                    #sal.ruk.cuni.cz
 >ics.muni.cz            #Masaryk university
 147.228.240.30                  #afs-plzen.meta.zcu.cz
-147.251.9.9                     #smaug2.ics.muni.cz
-195.113.214.4                   #tarkil-xen.cesnet.cz
+147.251.3.244                   #kuduk1.ics.muni.cz
+195.113.214.10                  #afs-praha.grid.cesnet.cz
 >zcu.cz                 #University of West Bohemia, Czech Republic
 147.228.10.18                   #sauron.zcu.cz
 147.228.52.10                   #oknos.zcu.cz
 141.20.1.65                     #commodus.cms.hu-berlin.de
 141.20.1.66                     #faustinus.cms.hu-berlin.de
 141.20.1.67                     #marcellus.cms.hu-berlin.de
->ifh.de                 #DESY Zeuthen
-141.34.22.10                    #romulus.ifh.de
-141.34.22.11                    #remus.ifh.de
-141.34.22.29                    #hekate.ifh.de
+>ifh.de                 #Deutsches Elektronen-Synchrotron Zeuthen
+141.34.22.10                    #romulus.zeuthen.desy.de
+141.34.22.11                    #remus.zeuthen.desy.de
+141.34.22.29                    #hekate.zeuthen.desy.de
 >integra-ev.de          #INTEGRA e.V.
 134.155.48.8                    #afsdb2.integra-ev.de
 134.155.48.63                   #afsdb1.integra-ev.de
@@ -95,7 +94,7 @@
 >ipp-garching.mpg.de    #Institut fuer Plasmaphysik
 130.183.9.5                     #afs-db1.rzg.mpg.de
 130.183.14.14                   #afs-db3.bc.rzg.mpg.de
-130.183.100.10                  #afs-db2.aug.ipp-garching.mpg.de
+130.183.30.30                   #afs-db4.mpcdf.mpg.de
 >mpe.mpg.de             #MPE cell
 130.183.130.7                   #irafs1.mpe-garching.mpg.de
 130.183.134.20                  #irafs2.mpe-garching.mpg.de
 129.206.119.10                  #afsdb.urz.uni-heidelberg.de
 129.206.119.16                  #afsdb1.urz.uni-heidelberg.de
 129.206.119.17                  #afsdb2.urz.uni-heidelberg.de
->ziti.uni-heidelberg.de #Institute of Computer Science at the University of Heidelberg
-147.142.42.246                  #mp-sun.ziti.uni-heidelberg.de
-147.142.42.252                  #mp-pizza.ziti.uni-heidelberg.de
->uni-hohenheim.de       #University of Hohenheim
-144.41.2.2                      #rs13.serv.uni-hohenheim.de
-144.41.2.3                      #rs14.serv.uni-hohenheim.de
-144.41.2.4                      #rs15.serv.uni-hohenheim.de
 >rz.uni-jena.de         #Rechenzentrum University of Jena, Germany
 141.35.2.180                    #afs00.rz.uni-jena.de
 141.35.2.181                    #afs01.rz.uni-jena.de
 134.155.97.204                  #afsdb1.uni-mannheim.de
 134.155.97.205                  #afsdb2.uni-mannheim.de
 134.155.97.206                  #afsdb3.uni-mannheim.de
->mathematik.uni-stuttgart.de #University of Stuttgart, Math Dept.
-129.69.61.1                     #fbm01.mathematik.uni-stuttgart.de
-129.69.61.2                     #fbm02.mathematik.uni-stuttgart.de
-129.69.61.3                     #fbm03.mathematik.uni-stuttgart.de
->stud.mathematik.uni-stuttgart.de #CIP-Pool of Math. Dept, University of Stuttgart
-129.69.61.28                    #omni.mathematik.uni-stuttgart.de
-129.69.116.201                  #stud01.mathematik.uni-stuttgart.de
-129.69.116.202                  #stud02.mathematik.uni-stuttgart.de
-129.69.116.203                  #stud03.mathematik.uni-stuttgart.de
 >physik.uni-wuppertal.de #Physics department of Bergische Universität Wuppertal
 132.195.104.3                   #afs1.physik.uni-wuppertal.de
 132.195.104.230                 #afs2.physik.uni-wuppertal.de
 128.2.10.2                      #afsdb-01.andrew.cmu.edu
 128.2.10.7                      #afsdb-02.andrew.cmu.edu
 128.2.10.11                     #afsdb-03.andrew.cmu.edu
->mw.andrew.cmu.edu      #Carnegie Mellon University - Middleware Test Cell
-128.2.234.24                    #null.andrew.cmu.edu
-128.2.234.170                   #mw-mgr.andrew.cmu.edu
 >club.cc.cmu.edu        #Carnegie Mellon University Computer Club
 128.2.204.149                   #barium.club.cc.cmu.edu
 128.237.157.11                  #sodium.club.cc.cmu.edu
 128.237.157.13                  #potassium.club.cc.cmu.edu
->chem.cmu.edu           #Carnegie Mellon University - Chemistry Dept.
-128.2.40.134                    #afs.chem.cmu.edu
-128.2.40.140                    #afs2.chem.cmu.edu
 >cs.cmu.edu             #Carnegie Mellon University - School of Comp. Sci.
-128.2.172.58                    #date.srv.cs.cmu.edu
-128.2.172.60                    #fig.srv.cs.cmu.edu
-128.2.200.97                    #watermelon.srv.cs.cmu.edu
+128.2.104.79                    #afsdb-scs-01.srv.cs.cmu.edu
+128.2.104.80                    #afsdb-scs-02.srv.cs.cmu.edu
+128.2.156.64                    #afsdb-scs-03.srv.cs.cmu.edu
 >ece.cmu.edu            #Carnegie Mellon University - Elec. Comp. Eng. Dept.
 128.2.129.7                     #porok.ece.cmu.edu
 128.2.129.8                     #vicio.ece.cmu.edu
 128.2.129.9                     #e-xing.ece.cmu.edu
->scotch.ece.cmu.edu     #CMU ECE CALCM research group
-128.2.134.82                    #lagavulin.ece.cmu.edu
 >qatar.cmu.edu          #Carnegie Mellon University - Qatar
-86.36.46.6                      #afs1.qatar.cmu.edu
-86.36.46.7                      #afs2.qatar.cmu.edu
->sbp.ri.cmu.edu         #Carnegie Mellon University - Sensor Based Planning Lab
-128.2.179.12                    #nihao.sbp.ri.cmu.edu
-128.2.179.113                   #youtheman.sbp.ri.cmu.edu
+86.36.46.6                      #afsdb-01.qatar.cmu.edu
+86.36.46.7                      #afsdb-02.qatar.cmu.edu
+86.36.46.9                      #afsdb-03.qatar.cmu.edu
+>ee.cooper.edu          #The Cooper Union EE Department
+199.98.27.202                   #stallman.ee.cooper.edu
 >cnf.cornell.edu        #CNF
 128.253.198.9                   #hole.cnf.cornell.edu
 128.253.198.27                  #smoke.cnf.cornell.edu
 129.170.30.144                  #dbicafs2.dartmouth.edu
 129.170.30.145                  #dbicafs3.dartmouth.edu
 >northstar.dartmouth.edu #Dartmouth College Research Computing
-129.170.16.22                   #halley.dartmouth.edu
-129.170.16.26                   #andromeda.dartmouth.edu
-129.170.199.250                 #kuiper.dartmouth.edu
+129.170.137.194                 #halley.dartmouth.edu
+129.170.137.195                 #andromeda.dartmouth.edu
+129.170.137.196                 #kuiper.dartmouth.edu
 >cs.hm.edu              #Department Computer Science Munich University Of Applied Science
 129.187.208.31                  #afs1.cs.hm.edu
 >eecs.harvard.edu       #Harvard - EECS
 140.247.60.64                   #lefkada.eecs.harvard.edu
 140.247.60.83                   #corfu.eecs.harvard.edu
->iastate.edu            #Iowa State University
-129.186.1.243                   #afsdb-1.iastate.edu
-129.186.6.243                   #afsdb-2.iastate.edu
-129.186.142.243                 #afsdb-3.iastate.edu
 >acm.jhu.edu            #Johns Hopkins ACM chapter
 128.220.35.191                  #chicago.acm.jhu.edu
 128.220.70.76                   #typhon.acm.jhu.edu
 18.4.60.19                      #reynelda.mit.edu
 18.4.60.22                      #rosebud.mit.edu
 18.4.60.23                      #ronald-ann.mit.edu
->msu.edu                #Michigan State University Main Cell
-35.9.7.10                       #afsdb0.cl.msu.edu
-35.9.7.11                       #afsdb1.cl.msu.edu
-35.9.7.12                       #afsdb2.cl.msu.edu
 >nd.edu                 #University of Notre Dame
 129.74.223.17                   #john.helios.nd.edu
 129.74.223.33                   #lizardo.helios.nd.edu
 136.142.8.20                    #afs10.srv.cis.pitt.edu
 136.142.8.21                    #afs11.srv.cis.pitt.edu
 >cs.pitt.edu            #University of Pittsburgh - Computer Science
-136.142.22.5                    #afs01.cs.pitt.edu
-136.142.22.6                    #afs02.cs.pitt.edu
-136.142.22.7                    #afs03.cs.pitt.edu
+136.142.55.232                  #afs01.cs.pitt.edu
+136.142.55.233                  #afs02.cs.pitt.edu
+136.142.55.234                  #afs03.cs.pitt.edu
 >psc.edu                #PSC (Pittsburgh Supercomputing Center)
 128.182.59.182                  #shaggy.psc.edu
 128.182.66.184                  #velma.psc.edu
 130.85.24.87                    #db3.afs.umbc.edu
 130.85.24.101                   #db1.afs.umbc.edu
 >glue.umd.edu           #University of Maryland - Project Glue
-128.8.70.11                     #olmec.umd.edu
-128.8.236.4                     #egypt.umd.edu
+128.8.163.205                   #hurricane.umd.edu
+128.8.236.2                     #cyclone.umd.edu
 128.8.236.230                   #babylon.umd.edu
->wam.umd.edu            #University of Maryland Network WAM Project
-128.8.70.9                      #csc-srv.wam.umd.edu
-128.8.236.5                     #avw-srv.wam.umd.edu
-128.8.236.231                   #ptx-srv.wam.umd.edu
 >umich.edu              #University of Michigan - Campus
 141.211.1.32                    #fear.ifs.umich.edu
 141.211.1.33                    #surprise.ifs.umich.edu
 141.211.1.34                    #ruthless.ifs.umich.edu
 >atlas.umich.edu        #ATLAS group cell in physics at University of Michigan
-141.211.43.102                  #linat02.grid.umich.edu
-141.211.43.103                  #linat03.grid.umich.edu
-141.211.43.104                  #linat04.grid.umich.edu
+192.41.230.102                  #linat02.aglt2.org
+192.41.230.103                  #linat03.aglt2.org
+192.41.230.104                  #linat04.aglt2.org
 >citi.umich.edu         #University of Michigan - Center for Information Technology Integ
 141.212.112.5                   #babylon.citi.umich.edu
 >isis.unc.edu           #Univ. of NC at Chapel Hill - ITS
 147.156.163.11                  #alpha.ific.uv.es
 >alteholz.eu            #alteholz.eu
 78.47.192.125                   #krb1eu.afs.alteholz.net
->in2p3.fr               #IN2P3
-134.158.104.11                  #ccafsdb01.in2p3.fr
-134.158.104.12                  #ccafsdb02.in2p3.fr
-134.158.104.13                  #ccafsdb03.in2p3.fr
 >mcc.ac.gb              #University of Manchester
 130.88.203.41                   #nevis.mc.man.ac.uk
 130.88.203.144                  #eryri.mc.man.ac.uk
 193.205.219.60                  #beta2.dia.uniroma3.it
 193.205.219.61                  #gamma2.dia.uniroma3.it
 >italia                 #Italian public AFS cell
-193.204.5.9                     #afs.caspur.it
+192.107.82.220                  #afsitalia.portici.enea.it
 >cmf.nrl.navy.mil       #Naval Research Laboratory - Center for Computational Science
 134.207.12.68                   #picard.cmf.nrl.navy.mil
 134.207.12.69                   #riker.cmf.nrl.navy.mil
 >laroia.net             #Laroia Networks
 66.66.102.254                   #supercore.laroia.net
 >pallissard.net         #pallissard.net
-35.184.35.247                   #files.pallissard.net
 >sinenomine.net         #Sine Nomine Associates
-207.89.43.108                   #afsdb3.sinenomine.net
-207.89.43.109                   #afsdb4.sinenomine.net
-207.89.43.110                   #afsdb5.sinenomine.net
+198.44.193.30                   #afsdb3.sinenomine.net
+198.44.193.31                   #afsdb4.sinenomine.net
+198.44.193.32                   #afsdb5.sinenomine.net
 >slackers.net           #The Slackers' Network
 199.4.150.159                   #alexandria.slackers.net
 >tproa.net              #The People's Republic of Ames
 66.93.61.184                    #vice1.coed.org
 128.237.157.35                  #vice3.coed.org
 >dementia.org           #Dementia Unlimited (old)
-128.2.13.209                    #dedlock.dementix.org
-128.2.234.204                   #vorkana.dementix.org
-128.2.235.26                    #meredith.dementix.org
+204.29.154.67                   #alice-comfort.dementix.org
 >dementix.org           #Dementia Unlimited
-128.2.13.209                    #dedlock.dementix.org
-128.2.234.204                   #vorkana.dementix.org
-128.2.235.26                    #meredith.dementix.org
+204.29.154.67                   #alice-comfort.dementix.org
 >idahofuturetruck.org   #University of Idaho hybrid vehicle development
 12.18.238.210                   #dsle210.fsr.net
 >afs.ietfng.org         #ietfng.org
 >riscpkg.org            #The RISC OS Packaging Project
 83.104.175.10                   #delenn.riscpkg.org
 >kth.se                 #Royal Institute of Technology, Stockholm, Sweden
-130.237.32.145                  #sonen.e.kth.se
+130.237.48.5                    #sonen.e.kth.se
 130.237.48.7                    #anden.e.kth.se
 130.237.48.244                  #fadern.e.kth.se
 >ict.kth.se             #Royal Institute of Technology, Information and Communication tec
 130.237.216.12                  #afsdb2.ict.kth.se
 130.237.216.13                  #afsdb3.ict.kth.se
 >it.kth.se              #Royal Institute of Technology, Teleinformatics, Kista
-130.237.216.14                  #afsdb1.it.kth.se
-130.237.216.15                  #afsdb2.it.kth.se
-130.237.216.16                  #afsdb3.it.kth.se
+130.237.48.68                   #itafs-2.sys.kth.se
 >md.kth.se              #Royal Institute of Technology, MMK
-130.237.32.63                   #mdafs-1.sys.kth.se
+130.237.48.170                  #mdafs-3.sys.kth.se
 >mech.kth.se            #Royal Institute of Technology, MECH
 130.237.233.142                 #matterhorn.mech.kth.se
 130.237.233.143                 #castor.mech.kth.se
 130.237.233.144                 #pollux.mech.kth.se
 >nada.kth.se            #Royal Institute of Technology, NADA
-130.237.223.12                  #afsdb-2.csc.kth.se
-130.237.224.78                  #afsdb-3.csc.kth.se
-130.237.227.23                  #afsdb-4.csc.kth.se
+130.237.48.8                    #nadaafs-3.sys.kth.se
+130.237.48.41                   #nadaafs-1.sys.kth.se
+130.237.48.58                   #nadaafs-2.sys.kth.se
 >pdc.kth.se             #Royal Institute of Technology, PDC
 130.237.232.29                  #crab.pdc.kth.se
 130.237.232.112                 #anna.pdc.kth.se
 130.237.83.23                   #afs.haninge.kth.se
 >sanchin.se             #Sanchin Consulting AB, Sweden
 192.195.148.10                  #sesan.sanchin.se
->su.se                  #Stockholm University
-130.237.162.81                  #afsdb1.su.se
-130.237.162.82                  #afsdb2.su.se
-130.237.162.230                 #afsdb3.su.se
 >fysik.su.se            #Stockholm University, Physics Department
 130.237.244.134                 #srv01.fysik.su.se
 130.237.244.135                 #srv02.fysik.su.se
 >p-ng.si                #University of Nova Gorica
 193.2.120.2                     #solkan.p-ng.si
 193.2.120.9                     #sabotin.p-ng.si
+>ung.si                 #University of Nova Gorica
+193.2.120.63                    #afs1.ung.si
 >ihep.su                #Institute for High-Energy Physics
 194.190.165.201                 #fs0001.ihep.su
 194.190.165.202                 #fs0002.ihep.su
index a6bd8fc..63e3330 100644 (file)
@@ -1,4 +1,4 @@
->grand.central.org      #GCO Public CellServDB 14 May 2018
+>grand.central.org      #GCO Public CellServDB 31 Oct 2023
 18.9.48.14                      #grand.mit.edu
 128.2.13.219                    #grand-old-opry.central.org
 >wu-wien.ac.at          #University of Economics, Vienna, Austria
 129.128.98.17                   #mystery.ucs.ualberta.ca
 129.128.125.40                  #drake.ucs.ualberta.ca
 >cern.ch                #European Laboratory for Particle Physics, Geneva
-137.138.128.148                 #afsdb1.cern.ch
-137.138.246.50                  #afsdb3.cern.ch
-137.138.246.51                  #afsdb2.cern.ch
+137.138.54.120                  #afsdb13.cern.ch
+188.184.21.218                  #afsdb11.cern.ch
+188.184.23.130                  #afsdb14.cern.ch
+188.184.81.230                  #afsdb12.cern.ch
 >ams.cern.ch            #AMS Experiment
-137.138.188.185                 #ams.cern.ch
-137.138.199.58                  #pcamsf4.cern.ch
 >epfl.ch                #Swiss Federal Institute of Technology at Lausanne
 128.178.109.111                 #kd1.epfl.ch
 128.178.109.112                 #kd2.epfl.ch
@@ -59,8 +58,8 @@
 195.113.0.40                    #sal.ruk.cuni.cz
 >ics.muni.cz            #Masaryk university
 147.228.240.30                  #afs-plzen.meta.zcu.cz
-147.251.9.9                     #smaug2.ics.muni.cz
-195.113.214.4                   #tarkil-xen.cesnet.cz
+147.251.3.244                   #kuduk1.ics.muni.cz
+195.113.214.10                  #afs-praha.grid.cesnet.cz
 >zcu.cz                 #University of West Bohemia, Czech Republic
 147.228.10.18                   #sauron.zcu.cz
 147.228.52.10                   #oknos.zcu.cz
 141.20.1.65                     #commodus.cms.hu-berlin.de
 141.20.1.66                     #faustinus.cms.hu-berlin.de
 141.20.1.67                     #marcellus.cms.hu-berlin.de
->ifh.de                 #DESY Zeuthen
-141.34.22.10                    #romulus.ifh.de
-141.34.22.11                    #remus.ifh.de
-141.34.22.29                    #hekate.ifh.de
+>ifh.de                 #Deutsches Elektronen-Synchrotron Zeuthen
+141.34.22.10                    #romulus.zeuthen.desy.de
+141.34.22.11                    #remus.zeuthen.desy.de
+141.34.22.29                    #hekate.zeuthen.desy.de
 >integra-ev.de          #INTEGRA e.V.
 134.155.48.8                    #afsdb2.integra-ev.de
 134.155.48.63                   #afsdb1.integra-ev.de
@@ -95,7 +94,7 @@
 >ipp-garching.mpg.de    #Institut fuer Plasmaphysik
 130.183.9.5                     #afs-db1.rzg.mpg.de
 130.183.14.14                   #afs-db3.bc.rzg.mpg.de
-130.183.100.10                  #afs-db2.aug.ipp-garching.mpg.de
+130.183.30.30                   #afs-db4.mpcdf.mpg.de
 >mpe.mpg.de             #MPE cell
 130.183.130.7                   #irafs1.mpe-garching.mpg.de
 130.183.134.20                  #irafs2.mpe-garching.mpg.de
 129.206.119.10                  #afsdb.urz.uni-heidelberg.de
 129.206.119.16                  #afsdb1.urz.uni-heidelberg.de
 129.206.119.17                  #afsdb2.urz.uni-heidelberg.de
->ziti.uni-heidelberg.de #Institute of Computer Science at the University of Heidelberg
-147.142.42.246                  #mp-sun.ziti.uni-heidelberg.de
-147.142.42.252                  #mp-pizza.ziti.uni-heidelberg.de
->uni-hohenheim.de       #University of Hohenheim
-144.41.2.2                      #rs13.serv.uni-hohenheim.de
-144.41.2.3                      #rs14.serv.uni-hohenheim.de
-144.41.2.4                      #rs15.serv.uni-hohenheim.de
 >rz.uni-jena.de         #Rechenzentrum University of Jena, Germany
 141.35.2.180                    #afs00.rz.uni-jena.de
 141.35.2.181                    #afs01.rz.uni-jena.de
 134.155.97.204                  #afsdb1.uni-mannheim.de
 134.155.97.205                  #afsdb2.uni-mannheim.de
 134.155.97.206                  #afsdb3.uni-mannheim.de
->mathematik.uni-stuttgart.de #University of Stuttgart, Math Dept.
-129.69.61.1                     #fbm01.mathematik.uni-stuttgart.de
-129.69.61.2                     #fbm02.mathematik.uni-stuttgart.de
-129.69.61.3                     #fbm03.mathematik.uni-stuttgart.de
->stud.mathematik.uni-stuttgart.de #CIP-Pool of Math. Dept, University of Stuttgart
-129.69.61.28                    #omni.mathematik.uni-stuttgart.de
-129.69.116.201                  #stud01.mathematik.uni-stuttgart.de
-129.69.116.202                  #stud02.mathematik.uni-stuttgart.de
-129.69.116.203                  #stud03.mathematik.uni-stuttgart.de
 >physik.uni-wuppertal.de #Physics department of Bergische Universität Wuppertal
 132.195.104.3                   #afs1.physik.uni-wuppertal.de
 132.195.104.230                 #afs2.physik.uni-wuppertal.de
 128.2.10.2                      #afsdb-01.andrew.cmu.edu
 128.2.10.7                      #afsdb-02.andrew.cmu.edu
 128.2.10.11                     #afsdb-03.andrew.cmu.edu
->mw.andrew.cmu.edu      #Carnegie Mellon University - Middleware Test Cell
-128.2.234.24                    #null.andrew.cmu.edu
-128.2.234.170                   #mw-mgr.andrew.cmu.edu
 >club.cc.cmu.edu        #Carnegie Mellon University Computer Club
 128.2.204.149                   #barium.club.cc.cmu.edu
 128.237.157.11                  #sodium.club.cc.cmu.edu
 128.237.157.13                  #potassium.club.cc.cmu.edu
->chem.cmu.edu           #Carnegie Mellon University - Chemistry Dept.
-128.2.40.134                    #afs.chem.cmu.edu
-128.2.40.140                    #afs2.chem.cmu.edu
 >cs.cmu.edu             #Carnegie Mellon University - School of Comp. Sci.
-128.2.172.58                    #date.srv.cs.cmu.edu
-128.2.172.60                    #fig.srv.cs.cmu.edu
-128.2.200.97                    #watermelon.srv.cs.cmu.edu
+128.2.104.79                    #afsdb-scs-01.srv.cs.cmu.edu
+128.2.104.80                    #afsdb-scs-02.srv.cs.cmu.edu
+128.2.156.64                    #afsdb-scs-03.srv.cs.cmu.edu
 >ece.cmu.edu            #Carnegie Mellon University - Elec. Comp. Eng. Dept.
 128.2.129.7                     #porok.ece.cmu.edu
 128.2.129.8                     #vicio.ece.cmu.edu
 128.2.129.9                     #e-xing.ece.cmu.edu
->scotch.ece.cmu.edu     #CMU ECE CALCM research group
-128.2.134.82                    #lagavulin.ece.cmu.edu
 >qatar.cmu.edu          #Carnegie Mellon University - Qatar
-86.36.46.6                      #afs1.qatar.cmu.edu
-86.36.46.7                      #afs2.qatar.cmu.edu
->sbp.ri.cmu.edu         #Carnegie Mellon University - Sensor Based Planning Lab
-128.2.179.12                    #nihao.sbp.ri.cmu.edu
-128.2.179.113                   #youtheman.sbp.ri.cmu.edu
+86.36.46.6                      #afsdb-01.qatar.cmu.edu
+86.36.46.7                      #afsdb-02.qatar.cmu.edu
+86.36.46.9                      #afsdb-03.qatar.cmu.edu
+>ee.cooper.edu          #The Cooper Union EE Department
+199.98.27.202                   #stallman.ee.cooper.edu
 >cnf.cornell.edu        #CNF
 128.253.198.9                   #hole.cnf.cornell.edu
 128.253.198.27                  #smoke.cnf.cornell.edu
 129.170.30.144                  #dbicafs2.dartmouth.edu
 129.170.30.145                  #dbicafs3.dartmouth.edu
 >northstar.dartmouth.edu #Dartmouth College Research Computing
-129.170.16.22                   #halley.dartmouth.edu
-129.170.16.26                   #andromeda.dartmouth.edu
-129.170.199.250                 #kuiper.dartmouth.edu
+129.170.137.194                 #halley.dartmouth.edu
+129.170.137.195                 #andromeda.dartmouth.edu
+129.170.137.196                 #kuiper.dartmouth.edu
 >cs.hm.edu              #Department Computer Science Munich University Of Applied Science
 129.187.208.31                  #afs1.cs.hm.edu
 >eecs.harvard.edu       #Harvard - EECS
 140.247.60.64                   #lefkada.eecs.harvard.edu
 140.247.60.83                   #corfu.eecs.harvard.edu
->iastate.edu            #Iowa State University
-129.186.1.243                   #afsdb-1.iastate.edu
-129.186.6.243                   #afsdb-2.iastate.edu
-129.186.142.243                 #afsdb-3.iastate.edu
 >acm.jhu.edu            #Johns Hopkins ACM chapter
 128.220.35.191                  #chicago.acm.jhu.edu
 128.220.70.76                   #typhon.acm.jhu.edu
 18.4.60.19                      #reynelda.mit.edu
 18.4.60.22                      #rosebud.mit.edu
 18.4.60.23                      #ronald-ann.mit.edu
->msu.edu                #Michigan State University Main Cell
-35.9.7.10                       #afsdb0.cl.msu.edu
-35.9.7.11                       #afsdb1.cl.msu.edu
-35.9.7.12                       #afsdb2.cl.msu.edu
 >nd.edu                 #University of Notre Dame
 129.74.223.17                   #john.helios.nd.edu
 129.74.223.33                   #lizardo.helios.nd.edu
 136.142.8.20                    #afs10.srv.cis.pitt.edu
 136.142.8.21                    #afs11.srv.cis.pitt.edu
 >cs.pitt.edu            #University of Pittsburgh - Computer Science
-136.142.22.5                    #afs01.cs.pitt.edu
-136.142.22.6                    #afs02.cs.pitt.edu
-136.142.22.7                    #afs03.cs.pitt.edu
+136.142.55.232                  #afs01.cs.pitt.edu
+136.142.55.233                  #afs02.cs.pitt.edu
+136.142.55.234                  #afs03.cs.pitt.edu
 >psc.edu                #PSC (Pittsburgh Supercomputing Center)
 128.182.59.182                  #shaggy.psc.edu
 128.182.66.184                  #velma.psc.edu
 130.85.24.87                    #db3.afs.umbc.edu
 130.85.24.101                   #db1.afs.umbc.edu
 >glue.umd.edu           #University of Maryland - Project Glue
-128.8.70.11                     #olmec.umd.edu
-128.8.236.4                     #egypt.umd.edu
+128.8.163.205                   #hurricane.umd.edu
+128.8.236.2                     #cyclone.umd.edu
 128.8.236.230                   #babylon.umd.edu
->wam.umd.edu            #University of Maryland Network WAM Project
-128.8.70.9                      #csc-srv.wam.umd.edu
-128.8.236.5                     #avw-srv.wam.umd.edu
-128.8.236.231                   #ptx-srv.wam.umd.edu
 >umich.edu              #University of Michigan - Campus
 141.211.1.32                    #fear.ifs.umich.edu
 141.211.1.33                    #surprise.ifs.umich.edu
 141.211.1.34                    #ruthless.ifs.umich.edu
 >atlas.umich.edu        #ATLAS group cell in physics at University of Michigan
-141.211.43.102                  #linat02.grid.umich.edu
-141.211.43.103                  #linat03.grid.umich.edu
-141.211.43.104                  #linat04.grid.umich.edu
+192.41.230.102                  #linat02.aglt2.org
+192.41.230.103                  #linat03.aglt2.org
+192.41.230.104                  #linat04.aglt2.org
 >citi.umich.edu         #University of Michigan - Center for Information Technology Integ
 141.212.112.5                   #babylon.citi.umich.edu
 >isis.unc.edu           #Univ. of NC at Chapel Hill - ITS
 147.156.163.11                  #alpha.ific.uv.es
 >alteholz.eu            #alteholz.eu
 78.47.192.125                   #krb1eu.afs.alteholz.net
->in2p3.fr               #IN2P3
-134.158.104.11                  #ccafsdb01.in2p3.fr
-134.158.104.12                  #ccafsdb02.in2p3.fr
-134.158.104.13                  #ccafsdb03.in2p3.fr
 >mcc.ac.gb              #University of Manchester
 130.88.203.41                   #nevis.mc.man.ac.uk
 130.88.203.144                  #eryri.mc.man.ac.uk
 193.205.219.60                  #beta2.dia.uniroma3.it
 193.205.219.61                  #gamma2.dia.uniroma3.it
 >italia                 #Italian public AFS cell
-193.204.5.9                     #afs.caspur.it
+192.107.82.220                  #afsitalia.portici.enea.it
 >cmf.nrl.navy.mil       #Naval Research Laboratory - Center for Computational Science
 134.207.12.68                   #picard.cmf.nrl.navy.mil
 134.207.12.69                   #riker.cmf.nrl.navy.mil
 >laroia.net             #Laroia Networks
 66.66.102.254                   #supercore.laroia.net
 >pallissard.net         #pallissard.net
-35.184.35.247                   #files.pallissard.net
 >sinenomine.net         #Sine Nomine Associates
-207.89.43.108                   #afsdb3.sinenomine.net
-207.89.43.109                   #afsdb4.sinenomine.net
-207.89.43.110                   #afsdb5.sinenomine.net
+198.44.193.30                   #afsdb3.sinenomine.net
+198.44.193.31                   #afsdb4.sinenomine.net
+198.44.193.32                   #afsdb5.sinenomine.net
 >slackers.net           #The Slackers' Network
 199.4.150.159                   #alexandria.slackers.net
 >tproa.net              #The People's Republic of Ames
 66.93.61.184                    #vice1.coed.org
 128.237.157.35                  #vice3.coed.org
 >dementia.org           #Dementia Unlimited (old)
-128.2.13.209                    #dedlock.dementix.org
-128.2.234.204                   #vorkana.dementix.org
-128.2.235.26                    #meredith.dementix.org
+204.29.154.67                   #alice-comfort.dementix.org
 >dementix.org           #Dementia Unlimited
-128.2.13.209                    #dedlock.dementix.org
-128.2.234.204                   #vorkana.dementix.org
-128.2.235.26                    #meredith.dementix.org
+204.29.154.67                   #alice-comfort.dementix.org
 >idahofuturetruck.org   #University of Idaho hybrid vehicle development
 12.18.238.210                   #dsle210.fsr.net
 >afs.ietfng.org         #ietfng.org
 >riscpkg.org            #The RISC OS Packaging Project
 83.104.175.10                   #delenn.riscpkg.org
 >kth.se                 #Royal Institute of Technology, Stockholm, Sweden
-130.237.32.145                  #sonen.e.kth.se
+130.237.48.5                    #sonen.e.kth.se
 130.237.48.7                    #anden.e.kth.se
 130.237.48.244                  #fadern.e.kth.se
 >ict.kth.se             #Royal Institute of Technology, Information and Communication tec
 130.237.216.12                  #afsdb2.ict.kth.se
 130.237.216.13                  #afsdb3.ict.kth.se
 >it.kth.se              #Royal Institute of Technology, Teleinformatics, Kista
-130.237.216.14                  #afsdb1.it.kth.se
-130.237.216.15                  #afsdb2.it.kth.se
-130.237.216.16                  #afsdb3.it.kth.se
+130.237.48.68                   #itafs-2.sys.kth.se
 >md.kth.se              #Royal Institute of Technology, MMK
-130.237.32.63                   #mdafs-1.sys.kth.se
+130.237.48.170                  #mdafs-3.sys.kth.se
 >mech.kth.se            #Royal Institute of Technology, MECH
 130.237.233.142                 #matterhorn.mech.kth.se
 130.237.233.143                 #castor.mech.kth.se
 130.237.233.144                 #pollux.mech.kth.se
 >nada.kth.se            #Royal Institute of Technology, NADA
-130.237.223.12                  #afsdb-2.csc.kth.se
-130.237.224.78                  #afsdb-3.csc.kth.se
-130.237.227.23                  #afsdb-4.csc.kth.se
+130.237.48.8                    #nadaafs-3.sys.kth.se
+130.237.48.41                   #nadaafs-1.sys.kth.se
+130.237.48.58                   #nadaafs-2.sys.kth.se
 >pdc.kth.se             #Royal Institute of Technology, PDC
 130.237.232.29                  #crab.pdc.kth.se
 130.237.232.112                 #anna.pdc.kth.se
 130.237.83.23                   #afs.haninge.kth.se
 >sanchin.se             #Sanchin Consulting AB, Sweden
 192.195.148.10                  #sesan.sanchin.se
->su.se                  #Stockholm University
-130.237.162.81                  #afsdb1.su.se
-130.237.162.82                  #afsdb2.su.se
-130.237.162.230                 #afsdb3.su.se
 >fysik.su.se            #Stockholm University, Physics Department
 130.237.244.134                 #srv01.fysik.su.se
 130.237.244.135                 #srv02.fysik.su.se
 >p-ng.si                #University of Nova Gorica
 193.2.120.2                     #solkan.p-ng.si
 193.2.120.9                     #sabotin.p-ng.si
+>ung.si                 #University of Nova Gorica
+193.2.120.63                    #afs1.ung.si
 >ihep.su                #Institute for High-Energy Physics
 194.190.165.201                 #fs0001.ihep.su
 194.190.165.202                 #fs0002.ihep.su
index 0c79c03..23ad9c1 100644 (file)
@@ -18,6 +18,7 @@
 #ifndef _OSI_MACHDEP_H_
 #define _OSI_MACHDEP_H_
 
+#include <sys/time.h>
 
 #undef osi_ThreadUnique
 #define osi_ThreadUnique()     thread_self()
index 3723546..c69f42f 100644 (file)
@@ -14,6 +14,7 @@
 #include "afs/sysincludes.h"   /* Standard vendor system headers */
 #include "afsincludes.h"       /* Afs-based standard headers */
 #include "afs/afs_stats.h"     /* afs statistics */
+#include <sys/malloc.h>                /* pinned_heap */
 
 static char waitV;
 
index d15620c..9fb3f0f 100644 (file)
@@ -18,7 +18,6 @@ struct mount *afs_globalVFS = NULL;
 int afs_pbuf_freecnt = -1;
 
 extern int Afs_xsetgroups();
-extern int afs_xioctl();
 
 static struct syscall_helper_data afs_syscalls[] = {
     {
index 175db35..04966f5 100644 (file)
@@ -290,7 +290,7 @@ int afs_vfs_slot = -1;
 
 afsc_link()
 {
-    extern int Afs_syscall(), afs_xioctl(), Afs_xsetgroups();
+    extern int Afs_syscall(), Afs_xsetgroups();
 
     /* For now nothing special is required during AFS initialization. */
     AFS_STATCNT(afsc_link);
index 482a0c7..86cd0e5 100644 (file)
@@ -336,7 +336,7 @@ osi_linux_free_afs_memory(void)
  *          our hash table.
  */
 void
-osi_linux_verify_alloced_memory()
+osi_linux_verify_alloced_memory(void)
 {
     mutex_lock(&afs_linux_alloc_sem);
 
index 53a079b..44bcb44 100644 (file)
 # include <linux/freezer.h>
 #endif
 
+#if defined(HAVE_LINUX_FILELOCK_H)
+# include <linux/filelock.h>
+#endif
+
 #if defined(LINUX_KEYRING_SUPPORT)
 # include <linux/rwsem.h>
 # include <linux/key.h>
@@ -45,6 +49,10 @@ typedef struct path afs_linux_path_t;
 # define d_alias d_u.d_alias
 #endif
 
+#if defined(STRUCT_DENTRY_HAS_D_U_D_CHILD)
+# define d_child d_u.d_child
+#endif
+
 #if defined(STRUCT_FILE_HAS_F_PATH)
 # if !defined(f_dentry)
 #  define f_dentry f_path.dentry
@@ -138,7 +146,9 @@ hlist_unhashed(const struct hlist_node *h) {
 #define AOP_WRITEPAGE_ACTIVATE WRITEPAGE_ACTIVATE
 #endif
 
-#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_WRITE_BEGIN) && !defined(HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN)
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_WRITE_BEGIN) && \
+    !defined(HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_WITHFLAGS) && \
+    !defined(HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_NOFLAGS)
 static inline struct page *
 grab_cache_page_write_begin(struct address_space *mapping, pgoff_t index,
                            unsigned int flags) {
@@ -528,7 +538,9 @@ afs_inode_setattr(struct osi_file *afile, struct iattr *newattrs) {
 
     int code = 0;
     struct inode *inode = OSIFILE_INODE(afile);
-#if defined(IOP_TAKES_USER_NAMESPACE)
+#if defined(IOP_TAKES_MNT_IDMAP)
+    code = inode->i_op->setattr(afs_mnt_idmap, afile->filp->f_dentry, newattrs);
+#elif defined(IOP_TAKES_USER_NAMESPACE)
     code = inode->i_op->setattr(afs_ns, afile->filp->f_dentry, newattrs);
 #elif !defined(HAVE_LINUX_INODE_SETATTR)
     code = inode->i_op->setattr(afile->filp->f_dentry, newattrs);
@@ -757,7 +769,9 @@ afs_d_path(struct dentry *dp, struct vfsmount *mnt, char *buf, int buflen)
 static inline int
 afs_setattr_prepare(struct dentry *dp, struct iattr *newattrs)
 {
-#if defined(IOP_TAKES_USER_NAMESPACE)
+#if defined(IOP_TAKES_MNT_IDMAP)
+    return setattr_prepare(afs_mnt_idmap, dp, newattrs);
+#elif defined(IOP_TAKES_USER_NAMESPACE)
     return setattr_prepare(afs_ns, dp, newattrs);
 #elif defined(HAVE_LINUX_SETATTR_PREPARE)
     return setattr_prepare(dp, newattrs);
@@ -766,4 +780,46 @@ afs_setattr_prepare(struct dentry *dp, struct iattr *newattrs)
 #endif
 }
 
+/*
+ * afs_d_alias_foreach - Iterate over dentry aliases of an inode. Use like this:
+ *
+ * afs_d_alias_lock(inode);
+ * afs_d_alias_foreach(dentry, inode, node) {
+ *     spin_lock(&dentry->d_lock);
+ *     dentry->d_foo = bar;
+ *     spin_unlock(&dentry->d_lock);
+ * }
+ * afs_d_alias_unlock(inode);
+ *
+ * 'node' is a struct hlist_node, and is only used when D_ALIAS_IS_HLIST &&
+ * !HLIST_ITERATOR_NO_NODE.
+ *
+ * afs_d_alias_foreach_reverse is the same, but traverses the list in the
+ * reverse direction when possible (non-D_ALIAS_IS_HLIST). For
+ * D_ALIAS_IS_HLIST, Linux doesn't provide macros for going in reverse (struct
+ * hlist_head doesn't point directly to the end of the list), so just traverse
+ * forwards.
+ *
+ * @pre afs_d_alias_lock(inode) held
+ */
+#if defined(D_ALIAS_IS_HLIST)
+
+# if defined(HLIST_ITERATOR_NO_NODE)
+#  define afs_d_alias_foreach(dentry, inode, node) \
+         hlist_for_each_entry((dentry), &((inode)->i_dentry), d_alias)
+# else
+#  define afs_d_alias_foreach(dentry, inode, node) \
+         hlist_for_each_entry((dentry), (node), &((inode)->i_dentry), d_alias)
+# endif /* HLIST_ITERATOR_NO_NODE */
+# define afs_d_alias_foreach_reverse afs_d_alias_foreach
+
+#else /* D_ALIAS_IS_HLIST */
+
+# define afs_d_alias_foreach(dentry, inode, node) \
+        list_for_each_entry((dentry), &((inode)->i_dentry), d_alias)
+# define afs_d_alias_foreach_reverse(dentry, inode, node) \
+        list_for_each_entry_reverse((dentry), &((inode)->i_dentry), d_alias)
+
+#endif /* D_ALIAS_IS_HLIST */
+
 #endif /* AFS_LINUX_OSI_COMPAT_H */
index ead1916..7f8435c 100644 (file)
@@ -25,6 +25,9 @@
 #include <afsconfig.h>
 #include "afs/param.h"
 
+#include "afs/sysincludes.h"
+#include "afsincludes.h"
+
 #include <linux/random.h>
 
 int
index b8bdce7..cb91ecb 100644 (file)
@@ -47,7 +47,7 @@ extern struct cred *cache_creds;
 #endif
 
 /* Old export ops: decode_fh will call back here. Accept any dentry it suggests */
-int
+static int
 afs_fh_acceptable(void *context, struct dentry *dp)
 {
     return 1;
@@ -138,7 +138,7 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
     }
 
     afile->offset = 0;
-    afile->proc = (int (*)())0;
+    afile->proc = NULL;
     return (void *)afile;
 }
 
@@ -175,9 +175,8 @@ afs_osi_Stat(struct osi_file *afile, struct osi_stat *astat)
 {
     AFS_STATCNT(osi_Stat);
     astat->size = i_size_read(OSIFILE_INODE(afile));
-    astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec;
-    astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec;
-
+    astat->mtime = afs_inode_get_mtime_sec(OSIFILE_INODE(afile));
+    astat->atime = afs_inode_get_atime_sec(OSIFILE_INODE(afile));
     return 0;
 }
 
index 34ceb06..8168a4b 100644 (file)
  * table, calling afs_GCPAGs_perproc_func() for each process.
  */
 
-
-#ifdef EXPORTED_TASKLIST_LOCK
-extern rwlock_t tasklist_lock __attribute__((weak));
-#endif
 void
 afs_osi_TraverseProcTable(void)
 {
index 2b910a5..62cd302 100644 (file)
@@ -166,8 +166,11 @@ __setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
 }
 
 #ifdef LINUX_KEYRING_SUPPORT
-extern struct key_type key_type_keyring __attribute__((weak));
+# if defined(EXPORTED_KEY_TYPE_KEYRING)
 static struct key_type *__key_type_keyring = &key_type_keyring;
+# else
+static struct key_type *__key_type_keyring;
+# endif
 
 /* install_session_keyring returns negative error values */
 static int
index 327520c..3e79774 100644 (file)
@@ -34,9 +34,6 @@
 
 extern struct proc_dir_entry *openafs_procfs;
 
-extern asmlinkage long
-afs_syscall(long syscall, long parm1, long parm2, long parm3, long parm4);
-
 static int
 afs_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
          unsigned long arg)
@@ -81,6 +78,7 @@ static struct proc_ops afs_syscall_ops = {
 # ifdef STRUCT_PROC_OPS_HAS_PROC_COMPAT_IOCTL
     .proc_compat_ioctl = afs_unlocked_ioctl,
 # endif
+    .proc_lseek = default_llseek,
 };
 #else
 static struct file_operations afs_syscall_ops = {
index 87d351c..e638173 100644 (file)
@@ -118,6 +118,46 @@ osi_GetTime(osi_timeval32_t *atv)
 }
 #endif
 
+#if defined(HAVE_LINUX_INODE_SET_CTIME)
+# define afs_inode_set_ctime(inode, sec, nsec) inode_set_ctime((inode), (sec), (nsec))
+#else
+static inline void
+afs_inode_set_ctime(struct inode *inode, time_t sec, long nsec)
+{
+    inode->i_ctime.tv_sec = sec;
+    inode->i_ctime.tv_nsec = nsec;
+}
+#endif
+#if defined(HAVE_LINUX_INODE_ATIME_MTIME_ACCESSORS)
+# define afs_inode_set_atime(inode, sec, nsec) inode_set_atime((inode), (sec), (nsec))
+# define afs_inode_get_atime_sec(inode) inode_get_atime_sec((inode))
+# define afs_inode_set_mtime(inode, sec, nsec) inode_set_mtime((inode), (sec), (nsec))
+# define afs_inode_get_mtime_sec(inode) inode_get_mtime_sec((inode))
+#else
+static inline void
+afs_inode_set_atime(struct inode *inode, time_t sec, long nsec)
+{
+    inode->i_atime.tv_sec = sec;
+    inode->i_atime.tv_nsec = nsec;
+}
+static inline time_t
+afs_inode_get_atime_sec(struct inode *inode)
+{
+    return inode->i_atime.tv_sec;
+}
+static inline void
+afs_inode_set_mtime(struct inode *inode, time_t sec, long nsec)
+{
+    inode->i_mtime.tv_sec = sec;
+    inode->i_mtime.tv_nsec = nsec;
+}
+static inline time_t
+afs_inode_get_mtime_sec(struct inode *inode)
+{
+    return inode->i_mtime.tv_sec;
+}
+#endif /* HAVE_LINUX_INODE_ATIME_MTIME_ACCESSORS */
+
 #undef gop_lookupname
 #define gop_lookupname osi_lookupname
 
@@ -217,6 +257,10 @@ extern struct user_namespace *afs_ns;
 #  define afs_current_user_ns() ((struct user_namespace *)NULL)
 # endif
 
+#if defined(IOP_TAKES_MNT_IDMAP)
+extern struct mnt_idmap *afs_mnt_idmap;
+#endif
+
 static inline kuid_t afs_make_kuid(uid_t uid) {
     return make_kuid(afs_ns, uid);
 }
index cb09cc6..8ace127 100644 (file)
 #include <linux/sched.h>
 #include <linux/kernel.h>
 
+#if defined(IOP_TAKES_MNT_IDMAP)
+# include <linux/fs_struct.h>
+#endif
+
 #include "osi_pagecopy.h"
 
 extern struct file_system_type afs_fs_type;
@@ -42,7 +46,21 @@ int afs_global_owner = 0;
 struct user_namespace *afs_ns;
 #endif
 
-int __init
+#if defined(IOP_TAKES_MNT_IDMAP)
+struct mnt_idmap *afs_mnt_idmap;
+
+static void
+afs_init_idmap(void)
+{
+    struct path fs_root;
+
+    get_fs_root(current->fs, &fs_root);
+    afs_mnt_idmap = mnt_idmap(fs_root.mnt);
+    path_put(&fs_root);
+}
+#endif
+
+static int __init
 afs_init(void)
 {
     int err;
@@ -51,6 +69,10 @@ afs_init(void)
     afs_ns = afs_current_user_ns();
 #endif
 
+#if defined(IOP_TAKES_MNT_IDMAP)
+    afs_init_idmap();
+#endif
+
     osi_Init();
 
     /* Initialize CellLRU since it is used while traversing CellServDB proc
@@ -88,7 +110,7 @@ afs_init(void)
     return 0;
 }
 
-void __exit
+static void __exit
 afs_cleanup(void)
 {
     afs_shutdown_pagecopy();
index 5583207..ea3d1bd 100644 (file)
@@ -47,7 +47,7 @@ int afs_global_owner = 0;
 struct user_namespace *afs_ns;
 #endif
 
-int __init
+static int __init
 afspag_init(void)
 {
 #if !defined(EXPORTED_PROC_ROOT_FS)
@@ -79,7 +79,7 @@ afspag_init(void)
     return 0;
 }
 
-void __exit
+static void __exit
 afspag_cleanup(void)
 {
 #if !defined(EXPORTED_PROC_ROOT_FS)
index 7142a1b..42f5e38 100644 (file)
@@ -61,6 +61,7 @@
 #include <linux/wait.h>
 #include <linux/workqueue.h>
 #include <linux/slab.h>
+#include "osi_pagecopy.h"
 
 static DECLARE_WAIT_QUEUE_HEAD (afs_pagecopy_wq);
 static spinlock_t afs_pagecopy_lock;
index 1b0f830..0e118fc 100644 (file)
 #ifdef OSI_PROBE_STANDALONE
 # define OSI_PROBE_DEBUG
 #endif
+
 #ifndef OSI_PROBE_STANDALONE
 # include <afsconfig.h>
 # include "afs/param.h"
+
+# include "afs/sysincludes.h"
+# include "afsincludes.h"
 #endif
 
 #include <linux/version.h>
 /* Slightly kludgy, but too bad */
 #define scsi_command_size scsi_command_size_tbl
 #endif
-#ifndef OSI_PROBE_STANDALONE
-# include "afs/sysincludes.h"
-# include "afsincludes.h"
-#endif
 #include <linux/sched.h>
 #ifdef HAVE_LINUX_CONFIG_H
 # include <linux/config.h>
 #define PROBETYPE long
 #endif
 
-#if defined(AFS_S390X_LINUX_ENV) && !defined(AFS_S390X_LINUX_ENV) 
-#define _SS(x) ((x) << 1)
-#define _SX(x) ((x) &~ 1)
-#else
-#define _SS(x) (x)
-#define _SX(x) (x)
-#endif
-
 /* Older Linux doesn't have __user. The sys_read prototype needs it. */
 #ifndef __user
 #define __user
@@ -894,17 +886,17 @@ static int check_table(probectl *P, PROBETYPE *ptr)
     if (i >= 0) return i;
 #endif
 
-    for (x = ptr, i = 0; i < _SS(NR_syscalls); i++, x++) {
+    for (x = ptr, i = 0; i < NR_syscalls; i++, x++) {
 #ifdef OSI_PROBE_DEBUG
        if (probe_debug & 0x0040) {
            for (j = 0; j < 4; j++) {
-               if (_SS(P->debug_ignore_NR[j]) == _SX(i + P->offset)) break;
+               if (P->debug_ignore_NR[j] == i + P->offset) break;
            }
            if (j < 4) continue;
        }
 #endif
        for (j = 0; j < 8; j++) {
-           if (_SS(probe_ignore_syscalls[j]) == _SX(i) + P->offset) break;
+           if (probe_ignore_syscalls[j] == i + P->offset) break;
        }
        if (j < 8) continue;
        if (*x <= ktxt_lower_bound) {
@@ -987,9 +979,9 @@ static void *try(probectl *P, tryctl *T, PROBETYPE *aptr,
        if ((probe_debug & 0x0002) && DEBUG_IN_RANGE(P,ptr))
            printk("<7>try 0x%lx\n", (unsigned long)ptr);
 #endif
-       if (ptr[_SS(T->NR1 - P->offset)] != ip1)        continue;
-       if (ptr[_SS(T->NR2 - P->offset)] != ip2)        continue;
-       if (ip3 && ptr[_SS(T->NR3 - P->offset)] != ip3) continue;
+       if (ptr[T->NR1 - P->offset] != ip1)        continue;
+       if (ptr[T->NR2 - P->offset] != ip2)        continue;
+       if (ip3 && ptr[T->NR3 - P->offset] != ip3) continue;
 
 #ifdef OSI_PROBE_DEBUG
        if (probe_debug & 0x0002)
@@ -1023,7 +1015,7 @@ static int check_harder(probectl *P, PROBETYPE *p)
 
     /* Check zapped syscalls */
     for (i = 1; i < P->n_zapped_syscalls; i++) {
-       if (p[_SS(P->zapped_syscalls[i])] != p[_SS(P->zapped_syscalls[0])]) {
+       if (p[P->zapped_syscalls[i]] != p[P->zapped_syscalls[0]]) {
 #ifdef OSI_PROBE_DEBUG
            if ((probe_debug & 0x0020) && DEBUG_IN_RANGE(P,p))
                printk("<7>check_harder 0x%lx zapped failed i=%d\n", (unsigned long)p, i);
@@ -1035,7 +1027,7 @@ static int check_harder(probectl *P, PROBETYPE *p)
     /* Check unique syscalls */
     for (i = 0; i < P->n_unique_syscalls; i++) {
        for (s = 0; s < NR_syscalls; s++) {
-           if (p[_SS(s)] == p[_SS(P->unique_syscalls[i])]
+           if (p[s] == p[P->unique_syscalls[i]]
                && s != P->unique_syscalls[i]) {
 #ifdef OSI_PROBE_DEBUG
                if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p))
@@ -1052,7 +1044,7 @@ static int check_harder(probectl *P, PROBETYPE *p)
     ip1 = (unsigned long)(P->verify_fn);
 #endif
 
-    if (ip1 && p[_SS(P->verifyNR - P->offset)] != ip1) {
+    if (ip1 && p[P->verifyNR - P->offset] != ip1) {
 #ifdef OSI_PROBE_DEBUG
        if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p))
            printk("<7>check_harder 0x%lx verify failed\n", (unsigned long)p);
@@ -1345,7 +1337,7 @@ static int check_table_readable(probectl *P, PROBETYPE *ptr)
     PROBETYPE *next_page;
     int i = 0, delta;
 
-    while (i < _SS(NR_syscalls)) {
+    while (i < NR_syscalls) {
        next_page = (PROBETYPE *)PAGE_ALIGN((unsigned long)(ptr+1));
        delta = next_page - ptr;
        if (!check_access((unsigned long)ptr, 0)) {
index 836491c..dc78da8 100644 (file)
 #include <afsconfig.h>
 #include "afs/param.h"
 
+#include <linux/module.h> /* early to avoid printf->printk mapping */
+#include "afs/sysincludes.h"
+#include "afsincludes.h"
+
 #ifdef LINUX_KEYRING_SUPPORT
 /* The syscall probing stuff is unnecessary (and is never called) if we have
  * keyrings support; we rely on keyrings instead of group ids to track PAGs.
@@ -31,9 +35,6 @@ osi_syscall_clean(void)
 
 #else /* LINUX_KEYRING_SUPPORT */
 
-#include <linux/module.h> /* early to avoid printf->printk mapping */
-#include "afs/sysincludes.h"
-#include "afsincludes.h"
 #include <linux/unistd.h>              /* For syscall numbers. */
 #include <linux/mm.h>
 
@@ -90,9 +91,6 @@ osi_syscall_clean(void)
 
 
 /***** ALL PLATFORMS *****/
-extern asmlinkage long
-afs_syscall(long syscall, long parm1, long parm2, long parm3, long parm4);
-
 static SYSCALLTYPE *afs_sys_call_table;
 static SYSCALLTYPE afs_ni_syscall = 0;
 
index 5980bdc..c1116fc 100644 (file)
@@ -54,6 +54,14 @@ extern afs_int32 afs_pct2;
 # define AFS_SYSCTL_INT(num, perms, var) \
        AFS_SYSCTL_INT2(num, perms, #var, var)
 
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0)
+/* end of list sentinel not needed */
+#  define AFS_SYSCTL_SENTINEL
+# else
+/* NULL entry to mark the end of the list */
+#  define AFS_SYSCTL_SENTINEL { .procname = NULL }
+# endif
+
 static struct ctl_table_header *afs_sysctl = NULL;
 
 static struct ctl_table afs_sysctl_table[] = {
@@ -75,11 +83,9 @@ static struct ctl_table afs_sysctl_table[] = {
     AFS_SYSCTL_INT( 13, 0644, afs_cacheBlocks),
     AFS_SYSCTL_INT2(14, 0644, "md5inum", afs_md5inum),
 
-    {
-       .procname       = 0
-    }
+    AFS_SYSCTL_SENTINEL
 };
-
+# if !defined(HAVE_LINUX_REGISTER_SYSCTL)
 static struct ctl_table fs_sysctl_table[] = {
     {
        AFS_SYSCTL_NAME(1)
@@ -87,15 +93,15 @@ static struct ctl_table fs_sysctl_table[] = {
        .mode           = 0555,
        .child          = afs_sysctl_table
     },
-    {
-       .procname       = 0
-    }
+    AFS_SYSCTL_SENTINEL
 };
-
+# endif
 int
-osi_sysctl_init()
+osi_sysctl_init(void)
 {
-# if defined(REGISTER_SYSCTL_TABLE_NOFLAG)
+# if defined(HAVE_LINUX_REGISTER_SYSCTL)
+    afs_sysctl = register_sysctl("afs", afs_sysctl_table);
+# elif defined(REGISTER_SYSCTL_TABLE_NOFLAG)
     afs_sysctl = register_sysctl_table(fs_sysctl_table);
 # else
     afs_sysctl = register_sysctl_table(fs_sysctl_table, 0);
@@ -107,7 +113,7 @@ osi_sysctl_init()
 }
 
 void
-osi_sysctl_clean()
+osi_sysctl_clean(void)
 {
     if (afs_sysctl) {
        unregister_sysctl_table(afs_sysctl);
index 478602b..874aa59 100644 (file)
 
 #include "osi_compat.h"
 
+#if defined(STRUCT_DENTRY_HAS_D_CHILDREN)
+# define afs_for_each_child(child, parent) \
+        hlist_for_each_entry((child), &(parent)->d_children, d_sib)
+#else
+# define afs_for_each_child(child, parent) \
+        list_for_each_entry((child), &(parent)->d_subdirs, d_child)
+#endif
+
 static void
 TryEvictDirDentries(struct inode *inode)
 {
@@ -26,15 +34,7 @@ TryEvictDirDentries(struct inode *inode)
     afs_d_alias_lock(inode);
 
  restart:
-#if defined(D_ALIAS_IS_HLIST)
-# if defined(HLIST_ITERATOR_NO_NODE)
-    hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
-# else
-    hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) {
-# endif
-#else
-    list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
-#endif
+    afs_d_alias_foreach(dentry, inode, p) {
        spin_lock(&dentry->d_lock);
        if (d_unhashed(dentry)) {
            spin_unlock(&dentry->d_lock);
@@ -280,3 +280,56 @@ osi_ShouldDeferRemunlink(struct vcache *avc)
     }
     return 0;
 }
+
+/*
+ * Invalidate Linux-specific cached data for the given vcache. This doesn't
+ * handle anything with the OpenAFS disk cache or stat cache, etc; those things
+ * are handled by afs_ResetVCache().
+ *
+ * The Linux-specific stuff we clear here is dcache entries. This means
+ * clearing d_time in all dentry's for the vcache, and all immediate children
+ * (for directories). We don't call d_invalidate() or any similar functions
+ * here; let afs_linux_dentry_revalidate() figure out what to do with the
+ * invalid dentry's whenever they are accessed.
+ *
+ * @pre AFS_GLOCK held
+ */
+void
+osi_ResetVCache(struct vcache *avc)
+{
+    struct dentry *dp;
+    struct inode *ip = AFSTOV(avc);
+#if defined(D_ALIAS_IS_HLIST) && !defined(HLIST_ITERATOR_NO_NODE)
+    struct hlist_node *node;
+#endif
+
+    AFS_GUNLOCK();
+
+    afs_d_alias_lock(ip);
+
+    afs_d_alias_foreach(dp, ip, node) {
+       spin_lock(&dp->d_lock);
+
+       /* Invalidate the dentry for the given vcache. */
+       dp->d_time = 0;
+
+       if (S_ISDIR(ip->i_mode)) {
+           /*
+            * If the vcache is a dir, also invalidate all of its children.
+            * Note that we can lock child->d_lock while dp->d_lock is held,
+            * because 'dp' is an ancestor of 'child'.
+            */
+           struct dentry *child;
+           afs_for_each_child(child, dp) {
+               spin_lock(&child->d_lock);
+               child->d_time = 0;
+               spin_unlock(&child->d_lock);
+           }
+       }
+
+       spin_unlock(&dp->d_lock);
+    }
+    afs_d_alias_unlock(ip);
+
+    AFS_GLOCK();
+}
index c0cc250..511b083 100644 (file)
@@ -32,7 +32,7 @@
 #endif
 #include <linux/pagemap.h>
 #include <linux/writeback.h>
-#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
+#if defined(HAVE_LINUX_FOLIO_ADD_LRU) || defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
 # include <linux/swap.h>
 #else
 # include <linux/pagevec.h>
 # define D_SPLICE_ALIAS_RACE
 #endif
 
+#if defined(STRUCT_FILE_OPERATIONS_HAS_ITERATE_SHARED)
+# define USE_FOP_ITERATE 1
+#elif defined(STRUCT_FILE_OPERATIONS_HAS_ITERATE) && !defined(FMODE_KABI_ITERATE)
 /* Workaround for RH 7.5 which introduced file operation iterate() but requires
  * each file->f_mode to be marked with FMODE_KABI_ITERATE.  Instead OpenAFS will
  * continue to use file opearation readdir() in this case.
  */
-#if defined(STRUCT_FILE_OPERATIONS_HAS_ITERATE) && !defined(FMODE_KABI_ITERATE)
-#define USE_FOP_ITERATE 1
+# define USE_FOP_ITERATE 1
 #else
-#undef USE_FOP_ITERATE
+# undef USE_FOP_ITERATE
 #endif
 
 /* Kernels from before 2.6.19 may not be able to return errors from
@@ -78,7 +80,8 @@ extern struct vcache *afs_globalVp;
 
 /* Handle interfacing with Linux's pagevec/lru facilities */
 
-#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) || defined(HAVE_LINUX_LRU_CACHE_ADD)
+#if defined(HAVE_LINUX_FOLIO_ADD_LRU) || \
+    defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) || defined(HAVE_LINUX_LRU_CACHE_ADD)
 
 /*
  * Linux's lru_cache_add_file provides a simplified LRU interface without
@@ -97,7 +100,10 @@ afs_lru_cache_init(struct afs_lru_pages *alrupages)
 static inline void
 afs_lru_cache_add(struct afs_lru_pages *alrupages, struct page *page)
 {
-# if defined(HAVE_LINUX_LRU_CACHE_ADD)
+# if defined(HAVE_LINUX_FOLIO_ADD_LRU)
+    struct folio *folio = page_folio(page);
+    folio_add_lru(folio);
+# elif defined(HAVE_LINUX_LRU_CACHE_ADD)
     lru_cache_add(page);
 # elif defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
     lru_cache_add_file(page);
@@ -148,6 +154,23 @@ afs_lru_cache_finalize(struct afs_lru_pages *alrupages)
 }
 #endif /* !HAVE_LINUX_LRU_ADD_FILE */
 
+static inline int
+afs_add_to_page_cache_lru(struct afs_lru_pages *alrupages, struct page *page,
+                         struct address_space *mapping,
+                         pgoff_t index, gfp_t gfp)
+{
+#if defined(HAVE_LINUX_ADD_TO_PAGE_CACHE_LRU)
+    return add_to_page_cache_lru(page, mapping, index, gfp);
+#else
+    int code;
+    code = add_to_page_cache(page, mapping, index, gfp);
+    if (code == 0) {
+       afs_lru_cache_add(alrupages, page);
+    }
+    return code;
+#endif
+}
+
 /* This function converts a positive error code from AFS into a negative
  * code suitable for passing into the Linux VFS layer. It checks that the
  * error code is within the permissable bounds for the ERR_PTR mechanism.
@@ -384,8 +407,6 @@ afs_linux_write(struct file *fp, const char *buf, size_t count, loff_t * offp)
 }
 #endif
 
-extern int BlobScan(struct dcache * afile, afs_int32 ablob, afs_int32 *ablobOut);
-
 /* This is a complete rewrite of afs_readdir, since we can make use of
  * filldir instead of afs_readdir_move. Note that changes to vcache/dcache
  * handling and use of bulkstats will need to be reflected here as well.
@@ -403,7 +424,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir)
     int code;
     int offset;
     afs_int32 dirpos;
-    struct DirEntry *de;
+    struct DirEntryFlex *de;
     struct DirBuffer entry;
     ino_t ino;
     int len;
@@ -508,7 +529,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir)
            goto unlock_out;
         }
 
-       de = (struct DirEntry *)entry.data;
+       de = entry.data;
        ino = afs_calc_inum (avc->f.fid.Cell, avc->f.fid.Fid.Volume,
                             ntohl(de->fid.vnode));
        len = strlen(de->name);
@@ -592,10 +613,6 @@ out1:
 }
 
 
-/* in afs_pioctl.c */
-extern int afs_xioctl(struct inode *ip, struct file *fp, unsigned int com,
-                     unsigned long arg);
-
 static long afs_unlocked_xioctl(struct file *fp, unsigned int com,
                                unsigned long arg) {
     return afs_xioctl(FILE_INODE(fp), fp, com, arg);
@@ -695,6 +712,61 @@ afs_linux_fsync(struct file *fp, int datasync)
 
 }
 
+/* Handle getting/setting file_lock type */
+
+static inline unsigned char
+afs_get_flock_type(struct file_lock *flp)
+{
+#if defined(HAVE_FILE_LOCK_CORE)
+    return flp->c.flc_type;
+#else
+    return flp->fl_type;
+#endif
+}
+
+static inline void
+afs_set_flock_type(struct file_lock *flp, unsigned char type)
+{
+#if defined(HAVE_FILE_LOCK_CORE)
+    flp->c.flc_type = type;
+#else
+    flp->fl_type = type;
+#endif
+}
+
+/* Handle getting/setting file_lock pid */
+
+static inline pid_t
+afs_get_flock_pid(struct file_lock *flp)
+{
+#if defined(HAVE_FILE_LOCK_CORE)
+    return flp->c.flc_pid;
+#else
+    return flp->fl_pid;
+#endif
+}
+
+static inline void
+afs_set_flock_pid(struct file_lock *flp, pid_t pid)
+{
+#if defined(HAVE_FILE_LOCK_CORE)
+    flp->c.flc_pid = pid;
+#else
+    flp->fl_pid = pid;
+#endif
+}
+
+/* Handle clearing file_lock sleep */
+
+static inline void
+afs_clear_flock_sleep(struct file_lock *flp)
+{
+#if defined(HAVE_FILE_LOCK_CORE)
+       flp->c.flc_flags &= ~FL_SLEEP;
+#else
+       flp->fl_flags &= ~FL_SLEEP;
+#endif
+}
 
 static int
 afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp)
@@ -706,8 +778,8 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp)
 
     /* Convert to a lock format afs_lockctl understands. */
     memset(&flock, 0, sizeof(flock));
-    flock.l_type = flp->fl_type;
-    flock.l_pid = flp->fl_pid;
+    flock.l_type = afs_get_flock_type(flp);
+    flock.l_pid = afs_get_flock_pid(flp);
     flock.l_whence = 0;
     flock.l_start = flp->fl_start;
     if (flp->fl_end == OFFSET_MAX)
@@ -729,10 +801,10 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp)
     code = afs_convert_code(afs_lockctl(vcp, &flock, cmd, credp));
     AFS_GUNLOCK();
 
-    if ((code == 0 || flp->fl_type == F_UNLCK) &&
-        (cmd == F_SETLK || cmd == F_SETLKW)) {
+    if ((code == 0 || afs_get_flock_type(flp) == F_UNLCK) &&
+       (cmd == F_SETLK || cmd == F_SETLKW)) {
        code = afs_posix_lock_file(fp, flp);
-       if (code && flp->fl_type != F_UNLCK) {
+       if (code && afs_get_flock_type(flp) != F_UNLCK) {
            struct AFS_FLOCK flock2;
            flock2 = flock;
            flock2.l_type = F_UNLCK;
@@ -745,17 +817,17 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp)
      * kernel, as lockctl knows nothing about byte range locks
      */
     if (code == 0 && cmd == F_GETLK && flock.l_type == F_UNLCK) {
-        afs_posix_test_lock(fp, flp);
-        /* If we found a lock in the kernel's structure, return it */
-        if (flp->fl_type != F_UNLCK) {
-            crfree(credp);
-            return 0;
-        }
+       afs_posix_test_lock(fp, flp);
+       /* If we found a lock in the kernel's structure, return it */
+       if (afs_get_flock_type(flp) != F_UNLCK) {
+           crfree(credp);
+           return 0;
+       }
     }
 
     /* Convert flock back to Linux's file_lock */
-    flp->fl_type = flock.l_type;
-    flp->fl_pid = flock.l_pid;
+    afs_set_flock_type(flp, flock.l_type);
+    afs_set_flock_pid(flp, flock.l_pid);
     flp->fl_start = flock.l_start;
     if (flock.l_len == 0)
        flp->fl_end = OFFSET_MAX; /* Lock to end of file */
@@ -775,8 +847,8 @@ afs_linux_flock(struct file *fp, int cmd, struct file_lock *flp) {
     struct AFS_FLOCK flock;
     /* Convert to a lock format afs_lockctl understands. */
     memset(&flock, 0, sizeof(flock));
-    flock.l_type = flp->fl_type;
-    flock.l_pid = flp->fl_pid;
+    flock.l_type = afs_get_flock_type(flp);
+    flock.l_pid = afs_get_flock_pid(flp);
     flock.l_whence = 0;
     flock.l_start = 0;
     flock.l_len = 0;
@@ -795,11 +867,11 @@ afs_linux_flock(struct file *fp, int cmd, struct file_lock *flp) {
     code = afs_convert_code(afs_lockctl(vcp, &flock, cmd, credp));
     AFS_GUNLOCK();
 
-    if ((code == 0 || flp->fl_type == F_UNLCK) &&
-        (cmd == F_SETLK || cmd == F_SETLKW)) {
-       flp->fl_flags &=~ FL_SLEEP;
+    if ((code == 0 || afs_get_flock_type(flp) == F_UNLCK) &&
+       (cmd == F_SETLK || cmd == F_SETLKW)) {
+       afs_clear_flock_sleep(flp);
        code = flock_lock_file_wait(fp, flp);
-       if (code && flp->fl_type != F_UNLCK) {
+       if (code && afs_get_flock_type(flp) != F_UNLCK) {
            struct AFS_FLOCK flock2;
            flock2 = flock;
            flock2.l_type = F_UNLCK;
@@ -809,8 +881,8 @@ afs_linux_flock(struct file *fp, int cmd, struct file_lock *flp) {
        }
     }
     /* Convert flock back to Linux's file_lock */
-    flp->fl_type = flock.l_type;
-    flp->fl_pid = flock.l_pid;
+    afs_set_flock_type(flp, flock.l_type);
+    afs_set_flock_pid(flp, flock.l_pid);
 
     crfree(credp);
     return code;
@@ -891,7 +963,9 @@ out:
 
 struct file_operations afs_dir_fops = {
   .read =      generic_read_dir,
-#if defined(USE_FOP_ITERATE)
+#if defined(STRUCT_FILE_OPERATIONS_HAS_ITERATE_SHARED)
+  .iterate_shared = afs_linux_readdir,
+#elif defined(USE_FOP_ITERATE)
   .iterate =   afs_linux_readdir,
 #else
   .readdir =   afs_linux_readdir,
@@ -939,7 +1013,11 @@ struct file_operations afs_file_fops = {
 # else
   .splice_write = generic_file_splice_write,
 # endif
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(6,5,0)
+  .splice_read = filemap_splice_read,
+# else
   .splice_read = generic_file_splice_read,
+# endif
 #endif
   .release =   afs_linux_release,
   .fsync =     afs_linux_fsync,
@@ -973,16 +1051,7 @@ canonical_dentry(struct inode *ip)
 
     afs_d_alias_lock(ip);
 
-#if defined(D_ALIAS_IS_HLIST)
-# if defined(HLIST_ITERATOR_NO_NODE)
-    hlist_for_each_entry(cur, &ip->i_dentry, d_alias) {
-# else
-    hlist_for_each_entry(cur, p, &ip->i_dentry, d_alias) {
-# endif
-#else
-    list_for_each_entry_reverse(cur, &ip->i_dentry, d_alias) {
-#endif
-
+    afs_d_alias_foreach_reverse(cur, ip, p) {
        if (!vcp->target_link || cur == vcp->target_link) {
            ret = cur;
            break;
@@ -1109,23 +1178,23 @@ vattr2inode(struct inode *ip, struct vattr *vp)
     ip->i_uid = afs_make_kuid(vp->va_uid);
     ip->i_gid = afs_make_kgid(vp->va_gid);
     i_size_write(ip, vp->va_size);
-    ip->i_atime.tv_sec = vp->va_atime.tv_sec;
-    ip->i_atime.tv_nsec = 0;
-    ip->i_mtime.tv_sec = vp->va_mtime.tv_sec;
+    afs_inode_set_atime(ip, vp->va_atime.tv_sec, 0);
     /* Set the mtime nanoseconds to the sysname generation number.
      * This convinces NFS clients that all directories have changed
      * any time the sysname list changes.
      */
-    ip->i_mtime.tv_nsec = afs_sysnamegen;
-    ip->i_ctime.tv_sec = vp->va_ctime.tv_sec;
-    ip->i_ctime.tv_nsec = 0;
+    afs_inode_set_mtime(ip, vp->va_mtime.tv_sec, afs_sysnamegen);
+    afs_inode_set_ctime(ip, vp->va_ctime.tv_sec, 0);
 }
 
 /* afs_notify_change
  * Linux version of setattr call. What to change is in the iattr struct.
  * We need to set bits in both the Linux inode as well as the vcache.
  */
-#if defined(IOP_TAKES_USER_NAMESPACE)
+#if defined(IOP_TAKES_MNT_IDMAP)
+static int
+afs_notify_change(struct mnt_idmap *idmap, struct dentry *dp, struct iattr *iattrp)
+#elif defined(IOP_TAKES_USER_NAMESPACE)
 static int
 afs_notify_change(struct user_namespace *mnt_userns, struct dentry *dp, struct iattr *iattrp)
 #else
@@ -1159,7 +1228,22 @@ out:
     return afs_convert_code(code);
 }
 
-#if defined(IOP_TAKES_USER_NAMESPACE)
+#if defined(IOP_TAKES_MNT_IDMAP)
+static int
+afs_linux_getattr(struct mnt_idmap *idmap, const struct path *path, struct kstat *stat,
+                 u32 request_mask, unsigned int sync_mode)
+{
+       int err = afs_linux_revalidate(path->dentry);
+       if (!err) {
+# if defined(GENERIC_FILLATTR_TAKES_REQUEST_MASK)
+               generic_fillattr(afs_mnt_idmap, request_mask, path->dentry->d_inode, stat);
+# else
+               generic_fillattr(afs_mnt_idmap, path->dentry->d_inode, stat);
+# endif
+       }
+       return err;
+}
+#elif defined(IOP_TAKES_USER_NAMESPACE)
 static int
 afs_linux_getattr(struct user_namespace *mnt_userns, const struct path *path, struct kstat *stat,
                  u32 request_mask, unsigned int sync_mode)
@@ -1636,7 +1720,11 @@ struct dentry_operations afs_dentry_operations = {
  * name is in kernel space at this point.
  */
 
-#if defined(IOP_TAKES_USER_NAMESPACE)
+#if defined(IOP_TAKES_MNT_IDMAP)
+static int
+afs_linux_create(struct mnt_idmap *idmap, struct inode *dip,
+                struct dentry *dp, umode_t mode, bool excl)
+#elif defined(IOP_TAKES_USER_NAMESPACE)
 static int
 afs_linux_create(struct user_namespace *mnt_userns, struct inode *dip,
                 struct dentry *dp, umode_t mode, bool excl)
@@ -1928,7 +2016,11 @@ afs_linux_unlink(struct inode *dip, struct dentry *dp)
 }
 
 
-#if defined(IOP_TAKES_USER_NAMESPACE)
+#if defined(IOP_TAKES_MNT_IDMAP)
+static int
+afs_linux_symlink(struct mnt_idmap *idmap, struct inode *dip,
+                 struct dentry *dp, const char *target)
+#elif defined(IOP_TAKES_USER_NAMESPACE)
 static int
 afs_linux_symlink(struct user_namespace *mnt_userns, struct inode *dip,
                  struct dentry *dp, const char *target)
@@ -1963,7 +2055,11 @@ out:
     return afs_convert_code(code);
 }
 
-#if defined(IOP_TAKES_USER_NAMESPACE)
+#if defined(IOP_TAKES_MNT_IDMAP)
+static int
+afs_linux_mkdir(struct mnt_idmap *idmap, struct inode *dip,
+               struct dentry *dp, umode_t mode)
+#elif defined(IOP_TAKES_USER_NAMESPACE)
 static int
 afs_linux_mkdir(struct user_namespace *mnt_userns, struct inode *dip,
                struct dentry *dp, umode_t mode)
@@ -2043,7 +2139,13 @@ afs_linux_rmdir(struct inode *dip, struct dentry *dp)
 }
 
 
-#if defined(IOP_TAKES_USER_NAMESPACE)
+#if defined(IOP_TAKES_MNT_IDMAP)
+static int
+afs_linux_rename(struct mnt_idmap *idmap,
+                struct inode *oldip, struct dentry *olddp,
+                struct inode *newip, struct dentry *newdp,
+                unsigned int flags)
+#elif defined(IOP_TAKES_USER_NAMESPACE)
 static int
 afs_linux_rename(struct user_namespace *mnt_userns,
                 struct inode *oldip, struct dentry *olddp,
@@ -2067,7 +2169,7 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
     struct dentry *rehash = NULL;
 
 #if defined(HAVE_LINUX_INODE_OPERATIONS_RENAME_TAKES_FLAGS) || \
-    defined(IOP_TAKES_USER_NAMESPACE)
+    defined(IOP_TAKES_MNT_IDMAP) || defined(IOP_TAKES_USER_NAMESPACE)
     if (flags)
        return -EINVAL;         /* no support for new flags yet */
 #endif
@@ -2202,6 +2304,22 @@ afs_linux_put_link(struct dentry *dentry, struct nameidata *nd)
 
 #endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */
 
+/*
+ * Call the mapping function that reads data for a given page.
+ * Note: When we return, it is expected that the page is unlocked.  It is the
+ * responsibility of the called function (e.g. ->readpage) to unlock the given
+ * page, even when an error occurs.
+ */
+static int
+mapping_read_page(struct address_space *mapping, struct page *page)
+{
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
+    return mapping->a_ops->read_folio(NULL, page_folio(page));
+#else
+    return mapping->a_ops->readpage(NULL, page);
+#endif
+}
+
 /* Populate a page by filling it from the cache file pointed at by cachefp
  * (which contains indicated chunk)
  * If task is NULL, the page copy occurs syncronously, and the routine
@@ -2249,12 +2367,11 @@ afs_linux_read_cache(struct file *cachefp, struct page *page,
                goto out;
            }
 
-           code = add_to_page_cache(newpage, cachemapping,
-                                    pageindex, GFP_KERNEL);
+           code = afs_add_to_page_cache_lru(alrupages, newpage, cachemapping,
+                                            pageindex, GFP_KERNEL);
            if (code == 0) {
                cachepage = newpage;
                newpage = NULL;
-               afs_lru_cache_add(alrupages, cachepage);
            } else {
                put_page(newpage);
                newpage = NULL;
@@ -2268,9 +2385,9 @@ afs_linux_read_cache(struct file *cachefp, struct page *page,
 
     if (!PageUptodate(cachepage)) {
        ClearPageError(cachepage);
-       /* Note that ->readpage always handles unlocking the given page, even
-        * when an error is returned. */
-       code = cachemapping->a_ops->readpage(NULL, cachepage);
+       /* Note that mapping_read_page always handles unlocking the given page,
+        * even when an error is returned. */
+       code = mapping_read_page(cachemapping, cachepage);
        if (!code && !task) {
            wait_on_page_locked(cachepage);
        }
@@ -2304,6 +2421,22 @@ afs_linux_read_cache(struct file *cachefp, struct page *page,
     return code;
 }
 
+/*
+ * Return true if the file has a mapping that can read pages
+ */
+static int inline
+file_can_read_pages(struct file *fp)
+{
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
+    if (fp->f_dentry->d_inode->i_mapping->a_ops->read_folio != NULL)
+       return 1;
+#else
+    if (fp->f_dentry->d_inode->i_mapping->a_ops->readpage != NULL)
+       return 1;
+#endif
+    return 0;
+}
+
 static int inline
 afs_linux_readpage_fastpath(struct file *fp, struct page *pp, int *codep)
 {
@@ -2399,7 +2532,8 @@ afs_linux_readpage_fastpath(struct file *fp, struct page *pp, int *codep)
        AFS_GLOCK();
        goto out;
     }
-    if (!cacheFp->f_dentry->d_inode->i_mapping->a_ops->readpage) {
+
+    if (!file_can_read_pages(cacheFp)) {
        cachefs_noreadpage = 1;
        AFS_GLOCK();
        goto out;
@@ -2532,12 +2666,98 @@ afs_linux_prefetch(struct file *fp, struct page *pp)
 
 }
 
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READAHEAD)
+/*
+ * Bypass the cache while performing a readahead.
+ * See the comments for afs_linux_readahead for the semantics
+ * for 'rac'.
+ */
+static void
+afs_linux_bypass_readahead(struct readahead_control *rac)
+{
+    struct file *fp = rac->file;
+    unsigned num_pages = readahead_count(rac);
+    afs_int32 page_ix;
+    afs_offs_t offset;
+    struct iovec* iovecp;
+    struct nocache_read_request *ancr;
+    struct page *pp;
+    afs_int32 code = 0;
+
+    cred_t *credp;
+    struct inode *ip = FILE_INODE(fp);
+    struct vcache *avc = VTOAFS(ip);
+    afs_int32 base_index = 0;
+    afs_int32 page_count = 0;
+    afs_int32 isize;
+
+    ancr = afs_alloc_ncr(num_pages);
+    if (ancr == NULL)
+       goto done;
+
+    iovecp = ancr->auio->uio_iov;
+
+    for (page_ix = 0; page_ix < num_pages; ++page_ix) {
+       pp = readahead_page(rac);
+       if (pp == NULL)
+           break;
+
+       isize = (i_size_read(fp->f_mapping->host) - 1) >> PAGE_SHIFT;
+       if (pp->index > isize) {
+           if (PageLocked(pp))
+               unlock_page(pp);
+           put_page(pp);
+           continue;
+       }
+
+       if (page_ix == 0) {
+           offset = page_offset(pp);
+           ancr->offset = ancr->auio->uio_offset = offset;
+           base_index = pp->index;
+       }
+       iovecp[page_ix].iov_len = PAGE_SIZE;
+       if (base_index != pp->index) {
+           if (PageLocked(pp))
+                unlock_page(pp);
+           put_page(pp);
+           iovecp[page_ix].iov_base = NULL;
+           base_index++;
+           ancr->length -= PAGE_SIZE;
+           continue;
+       }
+       base_index++;
+       page_count++;
+       /* save the page for background map */
+       iovecp[page_ix].iov_base = pp;
+    }
+
+    /* If there were useful pages in the page list, schedule
+     * the read */
+    if (page_count > 0) {
+       credp = crref();
+       /* The background thread frees the ancr */
+       code = afs_ReadNoCache(avc, ancr, credp);
+       crfree(credp);
+    } else {
+       /* If there is nothing for the background thread to handle,
+        * it won't be freeing the things that we never gave it */
+       afs_free_ncr(&ancr);
+    }
+    /* we do not flush, release, or unmap pages--that will be
+     * done for us by the background thread as each page comes in
+     * from the fileserver */
+
+ done:
+    /* The vfs layer will unlock/put any of the pages in the rac that were not
+     * processed */
+    return;
+}
+#else /* STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READAHEAD */
 static int
 afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping,
                           struct list_head *page_list, unsigned num_pages)
 {
     afs_int32 page_ix;
-    struct uio *auio;
     afs_offs_t offset;
     struct iovec* iovecp;
     struct nocache_read_request *ancr;
@@ -2552,20 +2772,10 @@ afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping,
     afs_int32 page_count = 0;
     afs_int32 isize;
 
-    /* background thread must free: iovecp, auio, ancr */
-    iovecp = osi_Alloc(num_pages * sizeof(struct iovec));
-
-    auio = osi_Alloc(sizeof(struct uio));
-    auio->uio_iov = iovecp;
-    auio->uio_iovcnt = num_pages;
-    auio->uio_flag = UIO_READ;
-    auio->uio_seg = AFS_UIOSYS;
-    auio->uio_resid = num_pages * PAGE_SIZE;
-
-    ancr = osi_Alloc(sizeof(struct nocache_read_request));
-    ancr->auio = auio;
-    ancr->offset = auio->uio_offset;
-    ancr->length = auio->uio_resid;
+    ancr = afs_alloc_ncr(num_pages);
+    if (ancr == NULL)
+       return afs_convert_code(ENOMEM);
+    iovecp = ancr->auio->uio_iov;
 
     afs_lru_cache_init(&lrupages);
 
@@ -2582,12 +2792,13 @@ afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping,
        if(pp->index > isize) {
            if(PageLocked(pp))
                unlock_page(pp);
+           put_page(pp);
            continue;
        }
 
        if(page_ix == 0) {
            offset = page_offset(pp);
-           ancr->offset = auio->uio_offset = offset;
+           ancr->offset = ancr->auio->uio_offset = offset;
            base_index = pp->index;
        }
         iovecp[page_ix].iov_len = PAGE_SIZE;
@@ -2626,21 +2837,20 @@ afs_linux_bypass_readpages(struct file *fp, struct address_space *mapping,
     if(page_count) {
        afs_lru_cache_finalize(&lrupages);
        credp = crref();
+       /* background thread frees the ancr */
         code = afs_ReadNoCache(avc, ancr, credp);
        crfree(credp);
     } else {
         /* If there is nothing for the background thread to handle,
          * it won't be freeing the things that we never gave it */
-        osi_Free(iovecp, num_pages * sizeof(struct iovec));
-        osi_Free(auio, sizeof(struct uio));
-        osi_Free(ancr, sizeof(struct nocache_read_request));
+       afs_free_ncr(&ancr);
     }
     /* we do not flush, release, or unmap pages--that will be
      * done for us by the background thread as each page comes in
      * from the fileserver */
     return afs_convert_code(code);
 }
-
+#endif /* STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READAHEAD */
 
 static int
 afs_linux_bypass_readpage(struct file *fp, struct page *pp)
@@ -2665,8 +2875,17 @@ afs_linux_bypass_readpage(struct file *fp, struct page *pp)
     ClearPageError(pp);
 
     /* receiver frees */
-    auio = osi_Alloc(sizeof(struct uio));
-    iovecp = osi_Alloc(sizeof(struct iovec));
+    ancr = afs_alloc_ncr(1);
+    if (ancr == NULL) {
+       SetPageError(pp);
+       return afs_convert_code(ENOMEM);
+    }
+    /*
+     * afs_alloc_ncr has already set the auio->uio_iov, make sure setup_uio
+     * uses the existing value when it sets auio->uio_iov.
+     */
+    auio = ancr->auio;
+    iovecp = auio->uio_iov;
 
     /* address can be NULL, because we overwrite it with 'pp', below */
     setup_uio(auio, iovecp, NULL, page_offset(pp),
@@ -2676,8 +2895,6 @@ afs_linux_bypass_readpage(struct file *fp, struct page *pp)
     get_page(pp); /* see above */
     auio->uio_iov->iov_base = (void*) pp;
     /* the background thread will free this */
-    ancr = osi_Alloc(sizeof(struct nocache_read_request));
-    ancr->auio = auio;
     ancr->offset = page_offset(pp);
     ancr->length = PAGE_SIZE;
 
@@ -2739,11 +2956,189 @@ afs_linux_readpage(struct file *fp, struct page *pp)
     return code;
 }
 
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
+static int
+afs_linux_read_folio(struct file *fp, struct folio *folio)
+{
+    struct page *pp = &folio->page;
+
+    return afs_linux_readpage(fp, pp);
+}
+#endif
+
+/*
+ * Updates the adc and acacheFp parameters
+ * Returns:
+ *    0 - success
+ *   -1 - problem getting inode or no mapping function
+ */
+static int
+get_dcache_readahead(struct dcache **adc, struct file **acacheFp,
+                    struct vcache *avc, loff_t offset)
+{
+    struct dcache *tdc = *adc;
+    struct file *cacheFp = *acacheFp;
+    int code;
+
+    if (tdc != NULL && tdc->f.chunk != AFS_CHUNK(offset)) {
+       AFS_GLOCK();
+       ReleaseReadLock(&tdc->lock);
+       afs_PutDCache(tdc);
+       AFS_GUNLOCK();
+       tdc = NULL;
+       if (cacheFp != NULL) {
+           filp_close(cacheFp, NULL);
+           cacheFp = NULL;
+       }
+    }
+
+    if (tdc == NULL) {
+       AFS_GLOCK();
+       tdc = afs_FindDCache(avc, offset);
+       if (tdc != NULL) {
+           ObtainReadLock(&tdc->lock);
+           if (!afs_IsDCacheFresh(tdc, avc) ||
+               (tdc->dflags & DFFetching) != 0) {
+               ReleaseReadLock(&tdc->lock);
+               afs_PutDCache(tdc);
+               tdc = NULL;
+           }
+       }
+       AFS_GUNLOCK();
+       if (tdc != NULL) {
+           cacheFp = afs_linux_raw_open(&tdc->f.inode);
+           if (cacheFp == NULL) {
+               /* Problem getting the inode */
+               code = -1;
+               goto out;
+           }
+           if (!file_can_read_pages(cacheFp)) {
+               cachefs_noreadpage = 1;
+               /* No mapping function */
+               code = -1;
+               goto out;
+           }
+       }
+    }
+    code = 0;
+
+ out:
+    if (code != 0) {
+       if (cacheFp != NULL) {
+           filp_close(cacheFp, NULL);
+           cacheFp = NULL;
+       }
+       if (tdc != NULL) {
+           AFS_GLOCK();
+           ReleaseReadLock(&tdc->lock);
+           afs_PutDCache(tdc);
+           AFS_GUNLOCK();
+           tdc = NULL;
+       }
+    }
+    *adc = tdc;
+    *acacheFp = cacheFp;
+    return code;
+}
+
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READAHEAD)
+/*
+ * Readahead reads a number of pages for a particular file. We use
+ * this to optimise the reading, by limiting the number of times upon which
+ * we have to lookup, lock and open vcaches and dcaches.
+ *
+ * Upon return, the vfs layer handles unlocking and putting any pages in the
+ * rac that we did not process here.
+ *
+ * Note: any errors detected during readahead are ignored at this stage by the
+ * vfs. We just need to unlock/put the page and return.  Errors will be detected
+ * later in the vfs processing.
+ */
+static void
+afs_linux_readahead(struct readahead_control *rac)
+{
+    struct page *page;
+    struct address_space *mapping = rac->mapping;
+    struct inode *inode = mapping->host;
+    struct vcache *avc = VTOAFS(inode);
+    struct dcache *tdc;
+    struct file *cacheFp = NULL;
+    int code;
+    loff_t offset;
+    struct afs_lru_pages lrupages;
+    struct afs_pagecopy_task *task;
+
+    if (afs_linux_bypass_check(inode)) {
+       afs_linux_bypass_readahead(rac);
+       return;
+    }
+    if (cacheDiskType == AFS_FCACHE_TYPE_MEM)
+       return;
+
+    /* No readpage (ex: tmpfs) , skip */
+    if (cachefs_noreadpage)
+       return;
+
+    AFS_GLOCK();
+    code = afs_linux_VerifyVCache(avc, NULL);
+    if (code != 0) {
+       AFS_GUNLOCK();
+       return;
+    }
+
+    ObtainWriteLock(&avc->lock, 912);
+    AFS_GUNLOCK();
+
+    task = afs_pagecopy_init_task();
+
+    tdc = NULL;
+
+    afs_lru_cache_init(&lrupages);
+
+    while ((page = readahead_page(rac)) != NULL) {
+       offset = page_offset(page);
+
+       code = get_dcache_readahead(&tdc, &cacheFp, avc, offset);
+       if (code != 0) {
+           if (PageLocked(page)) {
+               unlock_page(page);
+           }
+           put_page(page);
+           goto done;
+       }
+
+       if (tdc != NULL) {
+           /* afs_linux_read_cache will unlock the page */
+           afs_linux_read_cache(cacheFp, page, tdc->f.chunk, &lrupages, task);
+       } else if (PageLocked(page)) {
+           unlock_page(page);
+       }
+       put_page(page);
+    }
+
+ done:
+    afs_lru_cache_finalize(&lrupages);
+
+    if (cacheFp != NULL)
+       filp_close(cacheFp, NULL);
+
+    afs_pagecopy_put_task(task);
+
+    AFS_GLOCK();
+    if (tdc != NULL) {
+       ReleaseReadLock(&tdc->lock);
+       afs_PutDCache(tdc);
+    }
+
+    ReleaseWriteLock(&avc->lock);
+    AFS_GUNLOCK();
+    return;
+}
+#else /* STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READAHEAD */
 /* Readpages reads a number of pages for a particular file. We use
  * this to optimise the reading, by limiting the number of times upon which
  * we have to lookup, lock and open vcaches and dcaches
  */
-
 static int
 afs_linux_readpages(struct file *fp, struct address_space *mapping,
                    struct list_head *page_list, unsigned int num_pages)
@@ -2788,48 +3183,15 @@ afs_linux_readpages(struct file *fp, struct address_space *mapping,
        list_del(&page->lru);
        offset = page_offset(page);
 
-       if (tdc && tdc->f.chunk != AFS_CHUNK(offset)) {
-           AFS_GLOCK();
-           ReleaseReadLock(&tdc->lock);
-           afs_PutDCache(tdc);
-           AFS_GUNLOCK();
-           tdc = NULL;
-           if (cacheFp) {
-               filp_close(cacheFp, NULL);
-               cacheFp = NULL;
-           }
-       }
-
-       if (!tdc) {
-           AFS_GLOCK();
-           if ((tdc = afs_FindDCache(avc, offset))) {
-               ObtainReadLock(&tdc->lock);
-               if (!afs_IsDCacheFresh(tdc, avc) ||
-                   (tdc->dflags & DFFetching)) {
-                   ReleaseReadLock(&tdc->lock);
-                   afs_PutDCache(tdc);
-                   tdc = NULL;
-               }
-           }
-           AFS_GUNLOCK();
-           if (tdc) {
-               cacheFp = afs_linux_raw_open(&tdc->f.inode);
-               if (cacheFp == NULL) {
-                   /* Problem getting the inode */
-                   goto out;
-               }
-               if (!cacheFp->f_dentry->d_inode->i_mapping->a_ops->readpage) {
-                   cachefs_noreadpage = 1;
-                   goto out;
-               }
-           }
+       code = get_dcache_readahead(&tdc, &cacheFp, avc, offset);
+       if (code != 0) {
+           put_page(page);
+           goto out;
        }
 
-       if (tdc && !add_to_page_cache(page, mapping, page->index,
-                                     GFP_KERNEL)) {
-           afs_lru_cache_add(&lrupages, page);
-
-           /* Note that add_to_page_cache() locked 'page'.
+       if (tdc && !afs_add_to_page_cache_lru(&lrupages, page, mapping, page->index,
+                                             GFP_KERNEL)) {
+           /* Note that afs_add_to_page_cache_lru() locks the 'page'.
             * afs_linux_read_cache() is guaranteed to handle unlocking it. */
            afs_linux_read_cache(cacheFp, page, tdc->f.chunk, &lrupages, task);
        }
@@ -2853,6 +3215,7 @@ out:
     AFS_GUNLOCK();
     return 0;
 }
+#endif /* STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READAHEAD */
 
 /* Prepare an AFS vcache for writeback. Should be called with the vcache
  * locked */
@@ -3102,7 +3465,10 @@ done:
  * Check access rights - returns error if can't check or permission denied.
  */
 
-#if defined(IOP_TAKES_USER_NAMESPACE)
+#if defined(IOP_TAKES_MNT_IDMAP)
+static int
+afs_linux_permission(struct mnt_idmap *idmap, struct inode *ip, int mode)
+#elif defined(IOP_TAKES_USER_NAMESPACE)
 static int
 afs_linux_permission(struct user_namespace *mnt_userns, struct inode *ip, int mode)
 #elif defined(IOP_PERMISSION_TAKES_FLAGS)
@@ -3170,9 +3536,11 @@ afs_linux_prepare_write(struct file *file, struct page *page, unsigned from,
                        unsigned to)
 {
 
-    /* http://kerneltrap.org/node/4941 details the expected behaviour of
-     * prepare_write. Essentially, if the page exists within the file,
-     * and is not being fully written, then we should populate it.
+    /*
+     * Linux's Documentation/filesystems/vfs.txt (.rst) details the expected
+     * behaviour of prepare_write (prior to 2.6.28) and write_begin (2.6.28).
+     * Essentially, if the page exists within the file, and is not being fully
+     * written, then we should populate it.
      */
 
     if (!PageUptodate(page)) {
@@ -3189,7 +3557,7 @@ afs_linux_prepare_write(struct file *file, struct page *page, unsigned from,
            SetPageChecked(page);
        /* Is the page readable, if it's wronly, we don't care, because we're
         * not actually going to read from it ... */
-       } else if ((file->f_flags && O_ACCMODE) != O_WRONLY) {
+       } else if ((file->f_flags & O_ACCMODE) != O_WRONLY) {
            /* We don't care if fillpage fails, because if it does the page
             * won't be marked as up to date
             */
@@ -3215,6 +3583,33 @@ afs_linux_write_end(struct file *file, struct address_space *mapping,
     return code;
 }
 
+# if defined(HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_NOFLAGS)
+static int
+afs_linux_write_begin(struct file *file, struct address_space *mapping,
+                     loff_t pos, unsigned len,
+                     struct page **pagep, void **fsdata)
+{
+    struct page *page;
+    pgoff_t index = pos >> PAGE_SHIFT;
+    unsigned int from = pos & (PAGE_SIZE - 1);
+    int code;
+
+    page = grab_cache_page_write_begin(mapping, index);
+    if (!page) {
+       return -ENOMEM;
+    }
+
+    *pagep = page;
+
+    code = afs_linux_prepare_write(file, page, from, from + len);
+    if (code) {
+       unlock_page(page);
+       put_page(page);
+    }
+
+    return code;
+}
+# else
 static int
 afs_linux_write_begin(struct file *file, struct address_space *mapping,
                                 loff_t pos, unsigned len, unsigned flags,
@@ -3240,7 +3635,8 @@ afs_linux_write_begin(struct file *file, struct address_space *mapping,
 
     return code;
 }
-#endif
+# endif /* HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_NOFLAGS */
+#endif /* STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_WRITE_BEGIN */
 
 #ifndef STRUCT_DENTRY_OPERATIONS_HAS_D_AUTOMOUNT
 static void *
@@ -3290,10 +3686,19 @@ static struct inode_operations afs_file_iops = {
 };
 
 static struct address_space_operations afs_file_aops = {
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
+  .read_folio =                afs_linux_read_folio,
+#else
   .readpage =          afs_linux_readpage,
+#endif
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READAHEAD)
+  .readahead =         afs_linux_readahead,
+#else
   .readpages =                 afs_linux_readpages,
+#endif
   .writepage =         afs_linux_writepage,
-#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_DIRTY_FOLIO)
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_DIRTY_FOLIO) && \
+    defined(HAVE_LINUX_BLOCK_DIRTY_FOLIO)
   .dirty_folio =       block_dirty_folio,
 #else
   .set_page_dirty =    __set_page_dirty_buffers,
@@ -3359,9 +3764,22 @@ afs_symlink_filler(struct file *file, struct page *page)
     unlock_page(page);
     return code;
 }
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
+static int
+afs_symlink_filler_folio(struct file *file, struct folio *folio)
+{
+    struct page *page = &folio->page;
+    return afs_symlink_filler(file, page);
+}
+#endif
+
 
 static struct address_space_operations afs_symlink_aops = {
+#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READ_FOLIO)
+  .read_folio =        afs_symlink_filler_folio
+#else
   .readpage =  afs_symlink_filler
+#endif
 };
 #endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */
 
@@ -3382,6 +3800,7 @@ static struct inode_operations afs_symlink_iops = {
   .put_link =          afs_linux_put_link,
 #endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */
   .setattr =           afs_notify_change,
+  .getattr =           afs_linux_getattr,
 };
 
 void
index f658565..eefaf56 100644 (file)
@@ -44,7 +44,6 @@
 #include "afs/afsincludes.h"    /* Afs-based standard headers */
 
 extern int afs3_syscall(struct lwp *, const void *, register_t *);
-extern int afs_xioctl(struct lwp *, const void *, register_t *);
 extern int Afs_xsetgroups(struct lwp *, const void *, register_t *);
 
 #if !defined(AFS_NBSD60_ENV)
index 70d0a4a..73bb8e7 100644 (file)
@@ -110,7 +110,6 @@ VFS_PROTOS(afs);
 #ifndef AFS_NBSD60_ENV
 extern int sys_lkmnosys(struct lwp *, const void *, register_t *);
 extern int afs3_syscall(struct lwp *, const void *, register_t *);
-extern int afs_xioctl(struct lwp *, const void *, register_t *);
 extern int Afs_xsetgroups(struct lwp *, const void *, register_t *);
 static int afs_badcall(struct lwp *, const void *, register_t *);
 
index a1c56e4..e357e62 100644 (file)
@@ -108,7 +108,7 @@ NONINFRINGEMENT.
 /* from /usr/src/sys/kern/vfs_subr.c */
 extern void insmntque(struct vnode *, struct mount *);
 
-extern int sys_lkmnosys(), afs_xioctl(), Afs_xsetgroups();
+extern int sys_lkmnosys(), Afs_xsetgroups();
 
 static int lkmid = -1;
 static int afs_badcall(struct proc *p, void *xx, register_t * yy);
index 30da483..ef59a56 100644 (file)
@@ -389,7 +389,6 @@ afsinit(int fstype, char *dummy)
 afsinit(struct vfssw *vfsswp, int fstype)
 #endif
 {
-    extern int afs_xioctl();
     extern int afs_xsetgroups();
 
     AFS_STATCNT(afsinit);
index 2e0b9fe..2d11b44 100644 (file)
@@ -2373,12 +2373,16 @@ uafs_pread_nocache_r(int fd, char *buf, int len, off_t offset)
     }
 
     /* these get freed in PrefetchNoCache, so... */
-    bparms = afs_osi_Alloc(sizeof(struct nocache_read_request));
+    bparms = afs_alloc_ncr(0);
+    if (bparms == NULL) {
+       errno = ENOMEM;
+       return -1;
+    }
 
     code = afs_CreateReq(&bparms->areq, get_user_struct()->u_cred);
     if (code) {
        afs_DestroyReq(bparms->areq);
-       afs_osi_Free(bparms, sizeof(struct nocache_read_request));
+       afs_free_ncr(&bparms);
        errno = code;
        return -1;
     }
index 3b8d0ff..01e6bce 100644 (file)
@@ -7,6 +7,9 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
+#ifndef OPENAFS_AFS_UKERNEL_AFSINCLUDES_H
+#define OPENAFS_AFS_UKERNEL_AFSINCLUDES_H 1
+
 /* AFS based headers */
 #include "afs/stds.h"
 #include "rx/rx.h"
@@ -28,3 +31,5 @@
 #include "afs/afs_prototypes.h"
 #include "afs/discon.h"
 #include "roken.h"
+
+#endif /* OPENAFS_AFS_UKERNEL_AFSINCLUDES_H */
\ No newline at end of file
index db9de71..5720c8f 100644 (file)
@@ -658,8 +658,6 @@ afs_CheckBulkStatus(struct afs_conn *tc, int nFids, AFSBulkStats *statParm,
     return 0;
 }
 
-extern int BlobScan(struct dcache * afile, afs_int32 ablob, afs_int32 *ablobOut);
-
 /* called with an unlocked directory and directory cookie.  Areqp
  * describes who is making the call.
  * Scans the next N (about 30, typically) directory entries, and does
index 370b708..4bde047 100644 (file)
@@ -791,6 +791,7 @@ struct nbvdata {
 #define VTOAFS(v) ((struct vcache *)(v)->v_data)
 #define AFSTOV(vc) ((vc)->v)
 #else
+#define AFS_VCACHE_EMBEDDED_VNODE
 #define VTOAFS(V) ((struct vcache *)(V))
 #define AFSTOV(V) (&(V)->v)
 #endif
@@ -861,10 +862,10 @@ struct multiPage_range {
  * !(avc->nextfree) && !avc->vlruq.next => (FreeVCList == avc->nextfree)
  */
 struct vcache {
-#if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_SUN511_ENV) || (defined(AFS_LINUX_ENV) && !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE))
-    struct vnode *v;
-#else
+#if defined(AFS_VCACHE_EMBEDDED_VNODE)
     struct vnode v;            /* Has reference count in v.v_count */
+#else
+    struct vnode *v;
 #endif
     struct afs_q vlruq;                /* lru q next and prev */
 #if !defined(AFS_LINUX_ENV)
index 37b70f9..4a9b58e 100644 (file)
@@ -515,31 +515,6 @@ DFlushBuffer(struct buffer *ab)
     afs_CFileClose(tfile);
 }
 
-void
-DFlushDCache(struct dcache *adc)
-{
-    int i;
-    struct buffer *tb;
-
-    ObtainReadLock(&afs_bufferLock);
-
-    for (i = 0; i <= PHPAGEMASK; i++)
-        for (tb = phTable[pHash(adc->index, i)]; tb; tb = tb->hashNext)
-           if (tb->fid == adc->index) {
-               ObtainWriteLock(&tb->lock, 701);
-               tb->lockers++;
-               ReleaseReadLock(&afs_bufferLock);
-               if (tb->dirty) {
-                   DFlushBuffer(tb);
-               }
-               tb->lockers--;
-               ReleaseWriteLock(&tb->lock);
-               ObtainReadLock(&afs_bufferLock);
-           }
-
-    ReleaseReadLock(&afs_bufferLock);
-}
-
 int
 DFlush(void)
 {
index c51bd25..395f366 100644 (file)
@@ -113,6 +113,86 @@ afs_size_t cache_bypass_threshold  =       AFS_CACHE_BYPASS_DISABLED; /* file size >
 int cache_bypass_prefetch = 1; /* Should we do prefetching ? */
 
 /*
+ * Allocate and initialize nocache_read_request/uid/iovec.
+ * Returns NULL if there was a memory allocation error.
+ * Note: UKERNEL always passes 0 for the number of pages since the iovec
+ * and the uio are allocated by the caller
+ */
+struct nocache_read_request *
+afs_alloc_ncr(unsigned num_pages)
+{
+    struct nocache_read_request *ancr = NULL;
+#if !defined(UKERNEL)
+    struct uio *auio = NULL;
+    struct iovec *iovecp = NULL;
+#endif
+
+    ancr = osi_Alloc(sizeof(*ancr));
+    if (ancr == NULL)
+       goto error;
+
+#if defined(UKERNEL)
+    osi_Assert(num_pages == 0);
+#else
+    iovecp = osi_Alloc(num_pages * sizeof(*iovecp));
+    if (iovecp == NULL)
+       goto error;
+
+    auio = osi_Alloc(sizeof(*auio));
+    if (auio == NULL)
+       goto error;
+    auio->uio_iov = iovecp;
+    auio->uio_iovcnt = num_pages;
+    auio->uio_flag = UIO_READ;
+    auio->uio_seg = AFS_UIOSYS;
+    auio->uio_offset = 0;
+    auio->uio_resid = num_pages * PAGE_SIZE;
+
+    ancr->auio = auio;
+    ancr->offset = auio->uio_offset;
+    ancr->length = auio->uio_resid;
+#endif
+
+    return ancr;
+
+ error:
+#if !defined(UKERNEL)
+    osi_Free(iovecp, num_pages * sizeof(*iovecp));
+    osi_Free(auio, sizeof(*auio));
+#endif
+    osi_Free(ancr, sizeof(*ancr));
+    return NULL;
+}
+
+/*
+ * Free a nocache_read_request and associated structures
+ * Note: UKERNEL the iovec and uio structures are managed by the caller
+ */
+void
+afs_free_ncr(struct nocache_read_request **a_ancr)
+{
+    struct nocache_read_request *ancr = *a_ancr;
+#if !defined(UKERNEL)
+    struct uio *auio;
+    struct iovec *aiovec;
+#endif
+
+    if (ancr == NULL)
+       return;
+
+#if !defined(UKERNEL)
+    auio = ancr->auio;
+    if (auio != NULL) {
+       aiovec = auio->uio_iov;
+       osi_Free(aiovec, auio->uio_iovcnt * sizeof(*aiovec));
+    }
+    osi_Free(auio, sizeof(*auio));
+#endif
+    osi_Free(ancr, sizeof(*ancr));
+    *a_ancr = NULL;
+}
+
+/*
  * This is almost exactly like the PFlush() routine in afs_pioctl.c,
  * but that routine is static.  We are about to change a file from
  * normal caching to bypass it's caching.  Therefore, we want to
@@ -332,17 +412,13 @@ afs_NoCacheFetchProc(struct rx_call *acall,
     afs_int32 length;
     afs_int32 code;
     int moredata, iovno, iovoff, iovmax, result, locked;
-    struct iovec *ciov;
     struct iovec *rxiov;
     int nio = 0;
-    bypass_page_t pp;
 
     int curpage, bytes;
     int pageoff;
 
     rxiov = osi_AllocSmallSpace(sizeof(struct iovec) * RX_MAXIOVECS);
-    ciov = auio->uio_iov;
-    pp = (bypass_page_t) ciov->iov_base;
     iovmax = auio->uio_iovcnt - 1;
     iovno = iovoff = result = 0;
 
@@ -395,6 +471,7 @@ afs_NoCacheFetchProc(struct rx_call *acall,
            /* properly, this should track uio_resid, not a fixed page size! */
            while (pageoff < auio->uio_iov[curpage].iov_len) {
                /* If no more iovs, issue new read. */
+               bypass_page_t pp;
                if (iovno >= nio) {
                    COND_GUNLOCK(locked);
                    bytes = rx_Readv(acall, rxiov, &nio, RX_MAXIOVECS, length);
@@ -517,10 +594,7 @@ cleanup:
     AFS_GLOCK();
     afs_DestroyReq(areq);
     AFS_GUNLOCK();
-    osi_Free(bparms->auio->uio_iov,
-            bparms->auio->uio_iovcnt * sizeof(struct iovec));
-    osi_Free(bparms->auio, sizeof(struct uio));
-    osi_Free(bparms, sizeof(struct nocache_read_request));
+    afs_free_ncr(&bparms);
     return code;
 }
 
@@ -647,12 +721,7 @@ done:
 
     afs_DestroyReq(areq);
     osi_Free(tcallspec, sizeof(struct tlocal1));
-    osi_Free(bparms, sizeof(struct nocache_read_request));
-#ifndef UKERNEL
-    /* in UKERNEL, the "pages" are passed in */
-    osi_Free(iovecp, auio->uio_iovcnt * sizeof(struct iovec));
-    osi_Free(auio, sizeof(struct uio));
-#endif
+    afs_free_ncr(&bparms);
     return code;
 }
 #endif
index 2cda654..11f5464 100644 (file)
@@ -103,7 +103,8 @@ enum cache_bypass_strategies
 extern int cache_bypass_prefetch;
 extern int cache_bypass_strategy;
 extern afs_size_t cache_bypass_threshold;
-
+struct nocache_read_request *afs_alloc_ncr(unsigned num_pages);
+void afs_free_ncr(struct nocache_read_request **ancr);
 void afs_TransitionToBypass(struct vcache *, afs_ucred_t *, int);
 void afs_TransitionToCaching(struct vcache *, afs_ucred_t *, int);
 
index 3d90543..ad42cfb 100644 (file)
@@ -289,7 +289,7 @@ afsd_thread(int *rock)
     }
 }
 
-void
+static void
 afs_DaemonOp(long parm, long parm2, long parm3, long parm4, long parm5,
             long parm6)
 {
@@ -458,7 +458,7 @@ afsd_thread(void *rock)
     return 0;
 }
 
-void
+static void
 # if defined(AFS_LINUX_ENV) && !defined(INIT_WORK_HAS_DATA)
 afsd_launcher(struct work_struct *work)
 # else
@@ -479,7 +479,7 @@ afsd_launcher(void *rock)
 # endif /* !HAVE_LINUX_KTHREAD_RUN */
 }
 
-void
+static void
 afs_DaemonOp(long parm, long parm2, long parm3, long parm4, long parm5,
             long parm6)
 {
index f87e4eb..a1a61ef 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "afs/sysincludes.h"   /*Standard vendor system headers */
 #include "afsincludes.h"       /*AFS-based standard headers */
+#define FSINT_COMMON_XG
+#include "afs/afscbint.h"
 #include "afs/afs_stats.h"     /*Cache Manager stats */
 #include "afs/opr.h"
 #include "afs/afs_args.h"
@@ -1449,71 +1451,6 @@ SRXAFSCB_GetCacheConfig(struct rx_call *a_call, afs_uint32 callerVersion,
 }
 
 /*------------------------------------------------------------------------
- * EXPORTED SRXAFSCB_FetchData
- *
- * Description:
- *      Routine to do third party move from a remioserver to the original
- *      issuer of an ArchiveData request. Presently supported only by the
- *      "fs" command, not by the AFS client.
- *
- * Arguments:
- *      rxcall:        Ptr to Rx call on which this request came in.
- *      Fid:           pointer to AFSFid structure.
- *      Fd:            File descriptor inside fs command.
- *      Position:      Offset in the file.
- *      Length:        Data length to transfer.
- *      TotalLength:   Pointer to total file length field
- *
- * Returns:
- *      0 on success
- *
- * Environment:
- *      Nothing interesting.
- *
- * Side Effects:
- *------------------------------------------------------------------------*/
-int
-SRXAFSCB_FetchData(struct rx_call *rxcall, struct AFSFid *Fid, afs_int32 Fd,
-                  afs_int64 Position, afs_int64 Length,
-                  afs_int64 * TotalLength)
-{
-    return ENOSYS;
-}
-
-/*------------------------------------------------------------------------
- * EXPORTED SRXAFSCB_StoreData
- *
- * Description:
- *      Routine to do third party move from a remioserver to the original
- *      issuer of a RetrieveData request. Presently supported only by the
- *      "fs" command, not by the AFS client.
- *
- * Arguments:
- *      rxcall:        Ptr to Rx call on which this request came in.
- *      Fid:           pointer to AFSFid structure.
- *      Fd:            File descriptor inside fs command.
- *      Position:      Offset in the file.
- *      Length:        Data length to transfer.
- *      TotalLength:   Pointer to total file length field
- *
- * Returns:
- *      0 on success
- *
- * Environment:
- *      Nothing interesting.
- *
- * Side Effects:
- *      As advertised.
- *------------------------------------------------------------------------*/
-int
-SRXAFSCB_StoreData(struct rx_call *rxcall, struct AFSFid *Fid, afs_int32 Fd,
-                  afs_int64 Position, afs_int64 Length,
-                  afs_int64 * TotalLength)
-{
-    return ENOSYS;
-}
-
-/*------------------------------------------------------------------------
  * EXPORTED SRXAFSCB_GetCellByNum
  *
  * Description:
index f965f45..1cdae34 100644 (file)
@@ -319,7 +319,11 @@ afs_CheckRootVolume(void)
 
            if ((len < 9) || strcmp(&rootVolName[len - 9], ".readonly")) {
                bufsize = sizeof(buf);
-               len = snprintf(buf, bufsize, "%s.readonly", rootVolName);
+               len = strlcpy(buf, rootVolName, bufsize);
+               if (len >= bufsize) {
+                   return ENAMETOOLONG;
+               }
+               len = strlcat(buf, ".readonly", bufsize);
                if (len >= bufsize) {
                    return ENAMETOOLONG;
                }
@@ -1042,7 +1046,9 @@ afs_BackgroundDaemon(void)
 {
     struct brequest *tb;
     int i, foundAny;
+#ifdef AFS_NEW_BKG
     int n_processed = 0;
+#endif
 
     AFS_STATCNT(afs_BackgroundDaemon);
     /* initialize subsystem */
@@ -1119,7 +1125,9 @@ afs_BackgroundDaemon(void)
            tb->flags |= BSTARTED;
            ReleaseWriteLock(&afs_xbrs);
            foundAny = 1;
+#ifdef AFS_NEW_BKG
            n_processed++;
+#endif
            afs_Trace1(afs_iclSetp, CM_TRACE_BKG1, ICL_TYPE_INT32,
                       tb->opcode);
            if (tb->opcode == BOP_FETCH)
index 4b9f2f6..9585503 100644 (file)
@@ -2559,7 +2559,6 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte,
 
        if (size)
            afs_stats_cmperf.dcacheMisses++;
-       code = 0;
        /*
         * Dynamic root support:  fetch data from local memory.
         */
@@ -2633,7 +2632,6 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte,
                        newCallback = tc->parent->srvr->server;
                        setNewCallback = 1;
                    }
-                   i = osi_Time();
                    code = afs_CacheFetchProc(tc, rxconn, file, Position, tdc,
                                               avc, size, tsmall);
                } else
@@ -3654,8 +3652,6 @@ afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk, int aflags)
        cacheDiskType = AFS_FCACHE_TYPE_MEM;
        afs_cacheType = &afs_MemCacheOps;
        afiles = (afiles < aDentries) ? afiles : aDentries;     /* min */
-       ablocks = afiles * (AFS_FIRSTCSIZE / 1024);
-       /* ablocks is reported in 1K blocks */
        code = afs_InitMemCache(afiles, AFS_FIRSTCSIZE, aflags);
        if (code != 0) {
            afs_warn("afsd: memory cache too large for available memory.\n");
index b6d480f..66c5d95 100644 (file)
@@ -102,7 +102,7 @@ afs_FindDCacheByFid(struct VenusFid *afid)
  *
  * \return Mask of operations.
  */
-int
+static int
 afs_GenStoreStatus(struct vcache *avc, struct AFSStoreStatus *astat)
 {
     if (!avc || !astat || !avc->f.ddirty_flags)
@@ -157,7 +157,7 @@ get_parent_dir_fid_hook(void *hdata, char *aname, afs_int32 vnode,
  *
  * \return 0 on success, -1 on failure
  */
-int
+static int
 afs_GetParentDirFid(struct vcache *avc, struct VenusFid *afid)
 {
     struct dcache *tdc;
@@ -234,7 +234,7 @@ get_vnode_name_hook(void *hdata, char *aname, afs_int32 vnode,
  * \param deleted Has this file been deleted? If yes, use the shadow
  * dir for looking up the name.
  */
-int
+static int
 afs_GetVnodeName(struct vcache *avc, struct VenusFid *afid, char *aname,
                 int deleted)
 {
@@ -358,7 +358,7 @@ chk_del_children_hook(void *hdata, char *aname, afs_int32 vnode,
  *
  * \note afs_DDirtyVCListLock must be write locked.
  */
-int
+static int
 afs_CheckDeletedChildren(struct vcache *avc)
 {
     struct dcache *tdc;
@@ -452,7 +452,7 @@ fix_children_fids_hook(void *hdata, char *aname, afs_int32 vnode,
  * \param old_fid The current dir's fid.
  * \param new_fid The new dir's fid.
  */
-void
+static void
 afs_FixChildrenFids(struct VenusFid *old_fid, struct VenusFid *new_fid)
 {
     struct dcache *tdc;
@@ -499,7 +499,7 @@ afs_DbgListDirEntries(struct VenusFid *afid)
  *        be deferred to later in the resync process
  */
 
-int
+static int
 afs_GetParentVCache(struct vcache *avc, int deleted, struct VenusFid *afid,
                    char *aname, struct vcache **adp)
 {
@@ -548,7 +548,7 @@ end:
  * - Get the new name from the current dir.
  * - Old dir fid and new dir fid are collected along the way.
  * */
-int
+static int
 afs_ProcessOpRename(struct vcache *avc, struct vrequest *areq)
 {
     struct VenusFid old_pdir_fid, new_pdir_fid;
@@ -651,7 +651,7 @@ done:
  * - Handle errors.
  * - Reorder vhash and dcaches in their hashes, using the newly acquired fid.
  */
-int
+static int
 afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq,
                    afs_ucred_t *acred)
 {
@@ -921,7 +921,7 @@ end:
  *
  * \note avc must be write locked.
  */
-int
+static int
 afs_ProcessOpRemove(struct vcache *avc, struct vrequest *areq)
 {
     char *tname = NULL;
@@ -1022,7 +1022,7 @@ end:
  *
  * \return 0 for success. On failure, other error codes.
  */
-int
+static int
 afs_SendChanges(struct vcache *avc, struct vrequest *areq)
 {
     struct afs_conn *tc;
@@ -1335,37 +1335,6 @@ afs_DisconDiscardAll(afs_ucred_t *acred)
 }
 
 /*!
- * Print list of disconnected files.
- *
- * \note Call with afs_DDirtyVCListLock read locked.
- */
-void
-afs_DbgDisconFiles(void)
-{
-    struct vcache *tvc;
-    struct afs_q *q;
-    int i = 0;
-
-    afs_warn("List of dirty files: \n");
-
-    ObtainReadLock(&afs_disconDirtyLock);
-    for (q = QPrev(&afs_disconDirty); q != &afs_disconDirty; q = QPrev(q)) {
-        tvc = QEntry(q, struct vcache, dirtyq);
-
-       afs_warn("Cell=%u Volume=%u VNode=%u Unique=%u\n",
-               tvc->f.fid.Cell,
-               tvc->f.fid.Fid.Volume,
-               tvc->f.fid.Fid.Vnode,
-               tvc->f.fid.Fid.Unique);
-
-       i++;
-       if (i >= 30)
-           osi_Panic("afs_DbgDisconFiles: loop in dirty list\n");
-    }
-    ReleaseReadLock(&afs_disconDirtyLock);
-}
-
-/*!
  * Generate a fake fid for a disconnected shadow dir.
  * Similar to afs_GenFakeFid, only that it uses the dhash
  * to search for a uniquifier because a shadow dir lives only
index 060a399..f19343f 100644 (file)
@@ -228,7 +228,7 @@ afs_dynroot_addDirEnt(struct DirHeader *dirHeader, int *curPageP,
 {
     char *dirBase = (char *)dirHeader;
     struct PageHeader *pageHeader;
-    struct DirEntry *dirEntry;
+    struct DirEntryFlex *dirEntry;
     int sizeOfEntry, i, t1, t2;
     int curPage = *curPageP;
     int curChunk = *curChunkP;
@@ -257,7 +257,7 @@ afs_dynroot_addDirEnt(struct DirHeader *dirHeader, int *curPageP,
        dirHeader->alloMap[curPage] = EPP - 1;
     }
 
-    dirEntry = (struct DirEntry *)(pageHeader + curChunk);
+    dirEntry = (struct DirEntryFlex *)(pageHeader + curChunk);
     dirEntry->flag = 1;
     dirEntry->length = 0;
     dirEntry->next = 0;
@@ -369,7 +369,8 @@ afs_RebuildDynroot(void)
        dotLen = strlen(c->cellName) + 2;
        dotCell = afs_osi_Alloc(dotLen);
        osi_Assert(dotCell != NULL);
-       osi_Assert(snprintf(dotCell, dotLen, ".%s", c->cellName) < dotLen);
+       osi_Assert(strlcpy(dotCell, ".", dotLen) < dotLen);
+       osi_Assert(strlcat(dotCell, c->cellName, dotLen) < dotLen);
 
        afs_dynroot_computeDirEnt(c->cellName, &curPage, &curChunk);
        afs_dynroot_computeDirEnt(dotCell, &curPage, &curChunk);
@@ -387,7 +388,8 @@ afs_RebuildDynroot(void)
        dotLen = strlen(ca->alias) + 2;
        dotCell = afs_osi_Alloc(dotLen);
        osi_Assert(dotCell != NULL);
-       osi_Assert(snprintf(dotCell, dotLen, ".%s", ca->alias) < dotLen);
+       osi_Assert(strlcpy(dotCell, ".", dotLen) < dotLen);
+       osi_Assert(strlcat(dotCell, ca->alias, dotLen) < dotLen);
 
        afs_dynroot_computeDirEnt(ca->alias, &curPage, &curChunk);
        afs_dynroot_computeDirEnt(dotCell, &curPage, &curChunk);
@@ -448,7 +450,8 @@ afs_RebuildDynroot(void)
        dotLen = strlen(c->cellName) + 2;
        dotCell = afs_osi_Alloc(dotLen);
        osi_Assert(dotCell != NULL);
-       osi_Assert(snprintf(dotCell, dotLen, ".%s", c->cellName) < dotLen);
+       osi_Assert(strlcpy(dotCell, ".", dotLen) < dotLen);
+       osi_Assert(strlcat(dotCell, c->cellName, dotLen) < dotLen);
        afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, c->cellName,
                              VNUM_FROM_CIDX_RW(cellidx, 0), dirSize);
        afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, dotCell,
@@ -467,7 +470,8 @@ afs_RebuildDynroot(void)
        dotLen = strlen(ca->alias) + 2;
        dotCell = afs_osi_Alloc(dotLen);
        osi_Assert(dotCell != NULL);
-       osi_Assert(snprintf(dotCell, dotLen, ".%s", ca->alias) < dotLen);
+       osi_Assert(strlcpy(dotCell, ".", dotLen) < dotLen);
+       osi_Assert(strlcat(dotCell, ca->alias, dotLen) < dotLen);
        afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ca->alias,
                              VNUM_FROM_CAIDX_RW(aliasidx, 0), dirSize);
        afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, dotCell,
@@ -726,8 +730,8 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status)
                linklen = rw + namelen;
                avc->linkData = afs_osi_Alloc(linklen + 1);
                osi_Assert(avc->linkData != NULL);
-               osi_Assert(snprintf(avc->linkData, linklen + 1, "%s%s", prefix,
-                          realName) < linklen + 1);
+               osi_Assert(strlcpy(avc->linkData, prefix, linklen + 1) < linklen + 1);
+               osi_Assert(strlcat(avc->linkData, realName, linklen + 1) < linklen + 1);
            }
 
            status->UnixModeBits = 0755;
@@ -749,8 +753,10 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status)
            linklen = 2 + namelen + strlen(bp);
            avc->linkData = afs_osi_Alloc(linklen + 1);
            osi_Assert(avc->linkData != NULL);
-           osi_Assert(snprintf(avc->linkData, linklen + 1, "%%%s:%s",
-                      c->cellName, bp) < linklen + 1);
+           osi_Assert(strlcpy(avc->linkData, "%", linklen + 1) < linklen + 1);
+           osi_Assert(strlcat(avc->linkData, c->cellName, linklen + 1) < linklen + 1);
+           osi_Assert(strlcat(avc->linkData, ":", linklen + 1) < linklen + 1);
+           osi_Assert(strlcat(avc->linkData, bp, linklen + 1) < linklen + 1);
 
            status->UnixModeBits = 0644;
            status->ParentVnode = AFS_DYNROOT_MOUNT_VNODE;
@@ -773,8 +779,9 @@ afs_DynrootNewVnode(struct vcache *avc, struct AFSFetchStatus *status)
            linklen = 1 + namelen + 10;
            avc->linkData = afs_osi_Alloc(linklen + 1);
            osi_Assert(avc->linkData != NULL);
-           osi_Assert(snprintf(avc->linkData, linklen + 1, "%s%s:root.cell",
-                      prefix, c->cellName) < linklen + 1);
+           osi_Assert(strlcpy(avc->linkData, prefix, linklen + 1) < linklen + 1);
+           osi_Assert(strlcat(avc->linkData, c->cellName, linklen + 1) < linklen + 1);
+           osi_Assert(strlcat(avc->linkData, ":root.cell", linklen + 1) < linklen + 1);
 
            status->UnixModeBits = 0644;
            afs_PutCell(c, READ_LOCK);
index e2b3f2b..cce3f86 100644 (file)
@@ -77,14 +77,14 @@ FillStoreStats(int code, int idx, osi_timeval32_t xferStartTime,
 
 
 
-afs_int32
+static afs_int32
 rxfs_storeUfsPrepare(void *r, afs_uint32 size, afs_uint32 *tlen)
 {
     *tlen = (size > AFS_LRALLOCSIZ ?  AFS_LRALLOCSIZ : size);
     return 0;
 }
 
-afs_int32
+static afs_int32
 rxfs_storeMemPrepare(void *r, afs_uint32 size, afs_uint32 *tlen)
 {
     afs_int32 code;
@@ -105,7 +105,7 @@ rxfs_storeMemPrepare(void *r, afs_uint32 size, afs_uint32 *tlen)
     return code;
 }
 
-afs_int32
+static afs_int32
 rxfs_storeUfsRead(void *r, struct osi_file *tfile, afs_uint32 offset,
                  afs_uint32 tlen, afs_uint32 *bytesread)
 {
@@ -126,7 +126,7 @@ rxfs_storeUfsRead(void *r, struct osi_file *tfile, afs_uint32 offset,
     return 0;
 }
 
-afs_int32
+static afs_int32
 rxfs_storeMemRead(void *r, struct osi_file *tfile, afs_uint32 offset,
                  afs_uint32 tlen, afs_uint32 *bytesread)
 {
@@ -142,7 +142,7 @@ rxfs_storeMemRead(void *r, struct osi_file *tfile, afs_uint32 offset,
     return 0;
 }
 
-afs_int32
+static afs_int32
 rxfs_storeMemWrite(void *r, afs_uint32 l, afs_uint32 *byteswritten)
 {
     afs_int32 code;
@@ -159,7 +159,7 @@ rxfs_storeMemWrite(void *r, afs_uint32 l, afs_uint32 *byteswritten)
     return 0;
 }
 
-afs_int32
+static afs_int32
 rxfs_storeUfsWrite(void *r, afs_uint32 l, afs_uint32 *byteswritten)
 {
     afs_int32 code;
@@ -179,7 +179,7 @@ rxfs_storeUfsWrite(void *r, afs_uint32 l, afs_uint32 *byteswritten)
     return 0;
 }
 
-afs_int32
+static afs_int32
 rxfs_storePadd(void *rock, afs_uint32 size)
 {
     afs_int32 code = 0;
@@ -203,7 +203,7 @@ rxfs_storePadd(void *rock, afs_uint32 size)
     return 0;
 }
 
-afs_int32
+static afs_int32
 rxfs_storeStatus(void *rock)
 {
     struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)rock;
@@ -213,7 +213,7 @@ rxfs_storeStatus(void *rock)
     return 1;
 }
 
-afs_int32
+static afs_int32
 rxfs_storeClose(void *r, struct AFSFetchStatus *OutStatus, int *doProcessFS)
 {
     afs_int32 code;
@@ -236,7 +236,7 @@ rxfs_storeClose(void *r, struct AFSFetchStatus *OutStatus, int *doProcessFS)
     return code;
 }
 
-afs_int32
+static afs_int32
 rxfs_storeDestroy(void **r, afs_int32 code)
 {
     struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)*r;
@@ -255,7 +255,7 @@ rxfs_storeDestroy(void **r, afs_int32 code)
     return code;
 }
 
-afs_int32
+static afs_int32
 afs_GenericStoreProc(struct storeOps *ops, void *rock,
                     struct dcache *tdc, int *shouldwake,
                     afs_size_t *bytesXferred)
@@ -353,7 +353,7 @@ struct storeOps rxfs_storeMemOps = {
 #endif
 };
 
-afs_int32
+static afs_int32
 rxfs_storeInit(struct vcache *avc, struct afs_conn *tc,
                 struct rx_connection *rxconn, afs_size_t base,
                afs_size_t bytes, afs_size_t length,
@@ -437,7 +437,7 @@ unsigned int storeallmissing = 0;
  * \param ops pointer to the block of storeOps to be used for this operation
  * \param rock pointer to the opaque protocol-specific data of this operation
  */
-afs_int32
+static afs_int32
 afs_CacheStoreDCaches(struct vcache *avc, struct dcache **dclist,
                      afs_size_t bytes, afs_hyper_t *anewDV, int *doProcessFS,
                      struct AFSFetchStatus *OutStatus, afs_uint32 nchunks,
@@ -564,7 +564,6 @@ afs_CacheStoreVCache(struct dcache **dcList, struct vcache *avc,
                     afs_hyper_t *anewDV, afs_size_t *amaxStoredLength)
 {
     afs_int32 code = 0;
-    struct storeOps *ops;
     void * rock = NULL;
     unsigned int i, j;
 
@@ -619,7 +618,8 @@ afs_CacheStoreVCache(struct dcache **dcList, struct vcache *avc,
                       ICL_HANDLE_OFFSET(length));
 
            do {
-               tc = afs_Conn(&avc->f.fid, areq, 0, &rxconn);
+               struct storeOps *ops = NULL;
+               tc = afs_Conn(&avc->f.fid, areq, 0, &rxconn);
 
 #ifdef AFS_64BIT_CLIENT
              restart:
@@ -720,7 +720,7 @@ struct rxfs_fetchVariables {
     afs_int32 iovmax;
 };
 
-afs_int32
+static afs_int32
 rxfs_fetchUfsRead(void *r, afs_uint32 size, afs_uint32 *bytesread)
 {
     afs_int32 code;
@@ -738,7 +738,7 @@ rxfs_fetchUfsRead(void *r, afs_uint32 size, afs_uint32 *bytesread)
     return 0;
 }
 
-afs_int32
+static afs_int32
 rxfs_fetchMemRead(void *r, afs_uint32 tlen, afs_uint32 *bytesread)
 {
     afs_int32 code;
@@ -755,7 +755,7 @@ rxfs_fetchMemRead(void *r, afs_uint32 tlen, afs_uint32 *bytesread)
 }
 
 
-afs_int32
+static afs_int32
 rxfs_fetchMemWrite(void *r, struct osi_file *fP, afs_uint32 offset,
                   afs_uint32 tlen, afs_uint32 *byteswritten)
 {
@@ -771,7 +771,7 @@ rxfs_fetchMemWrite(void *r, struct osi_file *fP, afs_uint32 offset,
     return 0;
 }
 
-afs_int32
+static afs_int32
 rxfs_fetchUfsWrite(void *r, struct osi_file *fP, afs_uint32 offset,
                   afs_uint32 tlen, afs_uint32 *byteswritten)
 {
@@ -787,7 +787,7 @@ rxfs_fetchUfsWrite(void *r, struct osi_file *fP, afs_uint32 offset,
 }
 
 
-afs_int32
+static afs_int32
 rxfs_fetchClose(void *r, struct vcache *avc, struct dcache * adc,
                struct afs_FetchOutput *o)
 {
@@ -814,7 +814,7 @@ rxfs_fetchClose(void *r, struct vcache *avc, struct dcache * adc,
     return code;
 }
 
-afs_int32
+static afs_int32
 rxfs_fetchDestroy(void **r, afs_int32 code)
 {
     struct rxfs_fetchVariables *v = (struct rxfs_fetchVariables *)*r;
@@ -833,7 +833,7 @@ rxfs_fetchDestroy(void **r, afs_int32 code)
     return code;
 }
 
-afs_int32
+static afs_int32
 rxfs_fetchMore(void *r, afs_int32 *length, afs_uint32 *moredata)
 {
     afs_int32 code;
@@ -882,7 +882,7 @@ struct fetchOps rxfs_fetchMemOps = {
     rxfs_fetchDestroy
 };
 
-afs_int32
+static afs_int32
 rxfs_fetchInit(struct afs_conn *tc, struct rx_connection *rxconn,
                struct vcache *avc, afs_offs_t base,
               afs_uint32 size, afs_int32 *alength, struct dcache *adc,
index 42b4a0c..08a1660 100644 (file)
@@ -34,7 +34,7 @@ int afs_icl_sizeofLong = ICL_LONG;
 int afs_icl_inited = 0;
 
 /* init function, called once, under afs_icl_lock */
-int
+static int
 afs_icl_Init(void)
 {
     afs_icl_inited = 1;
@@ -539,7 +539,7 @@ afs_icl_AppendString(struct afs_icl_log *logp, char *astr)
 #endif
 
 
-void
+static void
 afs_icl_AppendOne(struct afs_icl_log *logp, int type, long parm)
 {
     if (type) {
index 936cbe9..419083d 100644 (file)
@@ -302,16 +302,6 @@ afs_MemCacheTruncate(struct osi_file *fP, int size)
     return 0;
 }
 
-int
-afs_MemExtendEntry(struct memCacheEntry *mceP, afs_uint32 size)
-{
-    int code = 0;
-    ObtainWriteLock(&mceP->afs_memLock, 560);
-    code = _afs_MemExtendEntry(mceP, size);
-    ReleaseWriteLock(&mceP->afs_memLock);
-    return code;
-}
-
 void
 shutdown_memcache(void)
 {
index fbb5006..4c7806d 100644 (file)
@@ -160,7 +160,6 @@ afs_nfsclient_init(void)
     osi_Assert(ISAFS_GLOCK());
 #endif
     if (!init_nfsexporter) {
-       extern struct afs_exporter *exporter_add();
 
        init_nfsexporter = 1;
        LOCK_INIT(&afs_xnfspag, "afs_xnfspag");
index bcd78de..e8f852e 100644 (file)
@@ -15,7 +15,8 @@
 #include "afsincludes.h"       /* Afs-based standard headers */
 #include "afs/afs_stats.h"     /* afs statistics */
 #ifdef AFS_AIX_ENV
-#include <sys/adspace.h>       /* for vm_att(), vm_det() */
+# include <sys/adspace.h>      /* for vm_att(), vm_det() */
+# include <sys/malloc.h>        /* pinned_heap */
 #endif
 
 /* osi_Init -- do once per kernel installation initialization.
  *     -- On HP called from afsc_link.
  *     -- On SGI called from afs_init. */
 
-/* No hckernel-specific header for this prototype. */
-#ifndef UKERNEL
-extern void init_hckernel_mutex(void);
-#endif
-
 afs_lock_t afs_ftf;            /* flush text lock */
 
 #ifdef AFS_SGI_ENV
@@ -151,14 +147,6 @@ afs_osi_MaskUserLoop(void)
 #endif
 }
 
-void
-afs_osi_UnmaskUserLoop(void)
-{
-#ifdef AFS_DARWIN_ENV
-    afs_osi_fullSigRestore();
-#endif
-}
-
 /* register rxk listener proc info */
 void
 afs_osi_RxkRegister(void)
@@ -241,7 +229,7 @@ shutdown_osisleep(void)
                afs_warn("nonzero refcount in shutdown_osisleep()\n");
            } else {
 #if defined(AFS_AIX_ENV)
-               xmfree(tmp);
+               xmfree(tmp, pinned_heap);
 #elif defined(AFS_FBSD_ENV)
                afs_osi_Free(tmp, sizeof(*tmp));
 #elif defined(AFS_SGI_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_SUN5_ENV)
index bba3a46..b10cad6 100644 (file)
@@ -149,6 +149,12 @@ extern void osi_PrePopulateVCache(struct vcache *);
 extern void osi_PostPopulateVCache(struct vcache *);
 extern void osi_AttachVnode(struct vcache *, int seq);
 
+#ifdef AFS_LINUX_ENV
+extern void osi_ResetVCache(struct vcache *avc);
+#else
+# define osi_ResetVCache(avc) do { } while (0)
+#endif
+
 /**
  * Increment the refcount on the given vcache.
  *
@@ -447,4 +453,9 @@ extern int osi_ShouldDeferRemunlink(struct vcache *avc);
 # define osi_ShouldDeferRemunlink(avc) 0
 #endif
 
+/* No hckernel-specific header for this prototype. */
+#ifndef UKERNEL
+extern void init_hckernel_mutex(void);
+#endif
+
 #endif /* _AFS_OSI_ */
index 637d60a..9b7a906 100644 (file)
@@ -514,8 +514,8 @@ out:
 
 
 int
-afs_syscall_call(parm, parm2, parm3, parm4, parm5, parm6)
-     long parm, parm2, parm3, parm4, parm5, parm6;
+afs_syscall_call(long parm, long parm2, long parm3,
+                long parm4, long parm5, long parm6)
 {
     /* Superusers may shut us down, such as with afsd -shutdown. */
     if (parm == AFSOP_SHUTDOWN && afs_suser(NULL))
index 3dce854..e77cf8a 100644 (file)
@@ -32,7 +32,7 @@ static struct afspag_cell *cells = 0;
 static struct afspag_cell *primary_cell = 0;
 
 
-struct afspag_cell *
+static struct afspag_cell *
 afspag_GetCell(char *acell)
 {
     struct afspag_cell *tcell;
@@ -66,7 +66,7 @@ out:
 }
 
 
-struct afspag_cell *
+static struct afspag_cell *
 afspag_GetPrimaryCell(void)
 {
     struct afspag_cell *tcell;
index 94ee107..21e3619 100644 (file)
@@ -1426,12 +1426,6 @@ DECL_PIOCTL(PGetFID)
  *
  * \post Changed ACL, via direct writing to the wire
  */
-int
-dummy_PSetAcl(char *ain, char *aout)
-{
-    return 0;
-}
-
 DECL_PIOCTL(PSetAcl)
 {
     afs_int32 code;
@@ -2204,8 +2198,11 @@ afs_LookupName(struct vcache *avc, struct vrequest *areq, char *aname,
     struct dcache *tdc;
     afs_size_t offset, len;
 
-    memset(asys, 0, sizeof(*asys));
-    memset(afid, 0, sizeof(*afid));
+    /* do not leave garbage in the output parameters in error cases */
+    if (asys != NULL)
+       memset(asys, 0, sizeof(*asys));
+    if (afid != NULL)
+       memset(afid, 0, sizeof(*afid));
 
     if (!avc || !areq || !aname || !asys || !afid) {
        afs_warn("afs: Internal error, bad args to afs_LookupName: %p, %p, %p, "
index 7f73530..606a3cf 100644 (file)
@@ -65,51 +65,7 @@ extern osi_timeval32_t lastCallBack_time;
 extern struct interfaceAddr afs_cb_interface;
 
 extern int afs_RXCallBackServer(void);
-extern int SRXAFSCB_GetCE(struct rx_call *a_call, afs_int32 a_index,
-                         struct AFSDBCacheEntry *a_result);
-extern int SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index,
-                           struct AFSDBCacheEntry64 *a_result);
-extern int SRXAFSCB_GetLock(struct rx_call *a_call, afs_int32 a_index,
-                           struct AFSDBLock *a_result);
-extern int SRXAFSCB_CallBack(struct rx_call *a_call,
-                            struct AFSCBFids *a_fids,
-                            struct AFSCBs *a_callbacks);
-extern int SRXAFSCB_Probe(struct rx_call *a_call);
-extern int SRXAFSCB_InitCallBackState(struct rx_call *a_call);
-extern int SRXAFSCB_XStatsVersion(struct rx_call *a_call,
-                                 afs_int32 * a_versionP);
-extern int SRXAFSCB_GetXStats(struct rx_call *a_call,
-                             afs_int32 a_clientVersionNum,
-                             afs_int32 a_collectionNumber,
-                             afs_int32 * a_srvVersionNumP,
-                             afs_int32 * a_timeP, AFSCB_CollData * a_dataP);
-extern int afs_RXCallBackServer(void);
 extern int shutdown_CB(void);
-extern int SRXAFSCB_InitCallBackState2(struct rx_call *a_call,
-                                      struct interfaceAddr *addr);
-extern int SRXAFSCB_WhoAreYou(struct rx_call *a_call,
-                             struct interfaceAddr *addr);
-extern int SRXAFSCB_InitCallBackState3(struct rx_call *a_call,
-                                      afsUUID * a_uuid);
-extern int SRXAFSCB_ProbeUuid(struct rx_call *a_call, afsUUID * a_uuid);
-extern int SRXAFSCB_GetServerPrefs(struct rx_call *a_call, afs_int32 a_index,
-                                  afs_int32 * a_srvr_addr,
-                                  afs_int32 * a_srvr_rank);
-extern int SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index,
-                                 char **a_name, serverList * a_hosts);
-extern int SRXAFSCB_GetLocalCell(struct rx_call *a_call, char **a_name);
-extern int SRXAFSCB_GetCacheConfig(struct rx_call *a_call,
-                                  afs_uint32 callerVersion,
-                                  afs_uint32 * serverVersion,
-                                  afs_uint32 * configCount,
-                                  cacheConfig * config);
-extern int SRXAFSCB_FetchData(struct rx_call *rxcall, struct AFSFid *Fid,
-                             afs_int32 Fd, afs_int64 Position,
-                             afs_int64 Length, afs_int64 * TotalLength);
-extern int SRXAFSCB_StoreData(struct rx_call *rxcall, struct AFSFid *Fid,
-                             afs_int32 Fd, afs_int64 Position,
-                             afs_int64 Length, afs_int64 * TotalLength);
-
 
 /* afs_cbqueue.c */
 extern afs_rwlock_t afs_xcbhash;
@@ -338,6 +294,8 @@ extern void init_sys_error_to_et(void);
 
 /* afs_exporter.c */
 extern struct afs_exporter *root_exported;
+extern struct afs_exporter * exporter_add(afs_int32 size, struct exporterops *ops,
+                                         afs_int32 state, afs_int32 type, char *data);
 extern struct afs_exporter *exporter_find(int type);
 extern void shutdown_exporter(void);
 
@@ -805,6 +763,23 @@ extern int afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg,
 extern int HandleIoctl(struct vcache *avc, afs_int32 acom,
                       struct afs_ioctl *adata);
 
+#if defined(AFS_SUN5_ENV)
+struct afs_ioctl_sys;
+extern int afs_xioctl(struct afs_ioctl_sys *uap, rval_t *rvp);
+#elif defined(AFS_LINUX_ENV)
+extern int afs_xioctl(struct inode *ip, struct file *fp, unsigned int com, unsigned long arg);
+#elif defined(AFS_DAWRIN_ENV) & !defined(AFS_DARWIN80)
+extern int afs_xioctl(afs_proc_t *p, struct ioctl_args *uap, register_t *retval);
+#elif defined(AFS_FBSD_ENV)
+extern int afs_xioctl(struct thread *td, struct ioctl_args *uap, register_t *retval);
+#elif defined(AFS_NBSD_ENV)
+extern int afs_xioctl(afs_proc_t *p, const struct sys_ioctl_args *uap, register_t *retval);
+#elif defined(AFS_XBSD_ENV)
+extern int afs_xioctl(afs_proc_t *p, const struct ioctl_args *uap, register_t *retval);
+#elif defined(UKERNEL)
+extern int afs_xioctl(void);
+#endif
+
 
 /* afs_segments.c */
 extern int afs_StoreAllSegments(struct vcache *avc,
@@ -914,6 +889,10 @@ extern int afs3_syscall(afs_proc_t *p, void *args, long *retval);
 extern int Afs_syscall(void);
 #endif
 
+#if defined(AFS_LINUX_ENV)
+extern asmlinkage long afs_syscall(long syscall, long parm1, long parm2, long parm3, long parm4);
+#endif
+
 /* afs_tokens.c */
 struct ktc_tokenUnion;
 struct ktc_setTokenData;
@@ -1280,6 +1259,7 @@ extern void afs_PrefetchChunk(struct vcache *avc, struct dcache *adc,
 
 /* VNOPS/afs_vnop_readdir.c */
 extern int afs_rd_stash_i;
+extern int BlobScan(struct dcache * afile, afs_int32 ablob, int *ablobOut);
 #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
 extern int afs_readdir(OSI_VC_DECL(avc), struct uio *auio,
                       afs_ucred_t *acred, int *eofp);
index 71cfef2..ba9796b 100644 (file)
@@ -556,7 +556,7 @@ CkSrv_MarkUpDown(struct afs_conn **conns, struct rx_connection **rxconns,
     }
 }
 
-void
+static void
 CkSrv_GetCaps(int nconns, struct rx_connection **rxconns,
              struct afs_conn **conns)
 {
index 23cd454..5631b37 100644 (file)
@@ -77,7 +77,7 @@ afs_GCUserData(void)
            delFlag = 0;        /* should we delete this dude? */
            /* Don't garbage collect users in use now (refCount) */
            if (tu->refCount == 0) {
-               if (tu->tokens) {
+               if (tu->tokens != NULL && (tu->states & UHasTokens) != 0) {
                    /* Need to walk the token stack, and dispose of
                     * all expired tokens */
                    afs_DiscardExpiredTokens(&tu->tokens, now);
@@ -324,7 +324,6 @@ afs_ComputePAGStats(void)
     struct unixuser *currPAGP; /*Ptr to curr PAG */
     struct unixuser *cmpPAGP;  /*Ptr to PAG being compared */
     struct afs_stats_AuthentInfo *authP;       /*Ptr to stats area */
-    int curr_Record;           /*Curr record */
     int currChain;             /*Curr hash chain */
     int currChainLen;          /*Length of curr hash chain */
     int currPAGRecords;                /*# records in curr PAG */
@@ -339,7 +338,6 @@ afs_ComputePAGStats(void)
      * can't bzero the structure, since some fields are cumulative over
      * the CM's lifetime.
      */
-    curr_Record = 0;
     authP = &(afs_stats_cmfullperf.authent);
     authP->curr_PAGs = 0;
     authP->curr_Records = 0;
@@ -357,7 +355,6 @@ afs_ComputePAGStats(void)
             * the total number of records in existence.
             */
            currChainLen++;
-           curr_Record++;
            /*
             * We've found a previously-uncounted PAG.  If it's been deleted
             * but just not garbage-collected yet, we step over it.
index d48a297..e132ccc 100644 (file)
@@ -726,7 +726,7 @@ afs_FlushReclaimedVcaches(void)
 #endif
 }
 
-void
+static void
 afs_PostPopulateVCache(struct vcache *avc, struct VenusFid *afid, int seq)
 {
     /*
@@ -2538,6 +2538,8 @@ afs_ResetVCache(struct vcache *avc, afs_ucred_t *acred, afs_int32 skipdnlc)
        afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1);
        avc->linkData = NULL;
     }
+
+    osi_ResetVCache(avc);
 }
 
 /*!
@@ -3054,7 +3056,6 @@ afs_DisconGiveUpCallbacks(void)
 {
     int i;
     struct vcache *tvc;
-    int nq=0;
 
     ObtainWriteLock(&afs_xvcache, 1002); /* XXX - should be a unique number */
 
@@ -3065,7 +3066,6 @@ afs_DisconGiveUpCallbacks(void)
            int slept = 0;
             if (afs_QueueVCB(tvc, &slept)) {
                 tvc->callback = NULL;
-                nq++;
             }
            if (slept) {
                goto retry;
@@ -3158,7 +3158,10 @@ afs_StaleVCacheFlags(struct vcache *avc, afs_stalevc_flags_t flags,
 
     if (do_dnlc) {
        if ((avc->f.fid.Fid.Vnode & 1) ||
-           AFSTOV(avc) == NULL || vType(avc) == VDIR ||
+#if !defined(AFS_VCACHE_EMBEDDED_VNODE)
+           AFSTOV(avc) == NULL ||
+#endif
+           vType(avc) == VDIR ||
            (avc->f.states & CForeign)) {
            /* This vcache is (or could be) a directory. */
            osi_dnlc_purgedp(avc);
index 9841f2f..c01e4a9 100644 (file)
@@ -18,6 +18,7 @@
 
 /* AFS based headers */
 # include "afs/stds.h"
+# include "roken.h"
 # ifdef        AFS_AIX_ENV
 #  include "osi_vfs.h"
 # elif defined(AFS_HPUX_ENV) || defined(AFS_NBSD_ENV)
index a6bd8fc..63e3330 100644 (file)
@@ -1,4 +1,4 @@
->grand.central.org      #GCO Public CellServDB 14 May 2018
+>grand.central.org      #GCO Public CellServDB 31 Oct 2023
 18.9.48.14                      #grand.mit.edu
 128.2.13.219                    #grand-old-opry.central.org
 >wu-wien.ac.at          #University of Economics, Vienna, Austria
 129.128.98.17                   #mystery.ucs.ualberta.ca
 129.128.125.40                  #drake.ucs.ualberta.ca
 >cern.ch                #European Laboratory for Particle Physics, Geneva
-137.138.128.148                 #afsdb1.cern.ch
-137.138.246.50                  #afsdb3.cern.ch
-137.138.246.51                  #afsdb2.cern.ch
+137.138.54.120                  #afsdb13.cern.ch
+188.184.21.218                  #afsdb11.cern.ch
+188.184.23.130                  #afsdb14.cern.ch
+188.184.81.230                  #afsdb12.cern.ch
 >ams.cern.ch            #AMS Experiment
-137.138.188.185                 #ams.cern.ch
-137.138.199.58                  #pcamsf4.cern.ch
 >epfl.ch                #Swiss Federal Institute of Technology at Lausanne
 128.178.109.111                 #kd1.epfl.ch
 128.178.109.112                 #kd2.epfl.ch
@@ -59,8 +58,8 @@
 195.113.0.40                    #sal.ruk.cuni.cz
 >ics.muni.cz            #Masaryk university
 147.228.240.30                  #afs-plzen.meta.zcu.cz
-147.251.9.9                     #smaug2.ics.muni.cz
-195.113.214.4                   #tarkil-xen.cesnet.cz
+147.251.3.244                   #kuduk1.ics.muni.cz
+195.113.214.10                  #afs-praha.grid.cesnet.cz
 >zcu.cz                 #University of West Bohemia, Czech Republic
 147.228.10.18                   #sauron.zcu.cz
 147.228.52.10                   #oknos.zcu.cz
 141.20.1.65                     #commodus.cms.hu-berlin.de
 141.20.1.66                     #faustinus.cms.hu-berlin.de
 141.20.1.67                     #marcellus.cms.hu-berlin.de
->ifh.de                 #DESY Zeuthen
-141.34.22.10                    #romulus.ifh.de
-141.34.22.11                    #remus.ifh.de
-141.34.22.29                    #hekate.ifh.de
+>ifh.de                 #Deutsches Elektronen-Synchrotron Zeuthen
+141.34.22.10                    #romulus.zeuthen.desy.de
+141.34.22.11                    #remus.zeuthen.desy.de
+141.34.22.29                    #hekate.zeuthen.desy.de
 >integra-ev.de          #INTEGRA e.V.
 134.155.48.8                    #afsdb2.integra-ev.de
 134.155.48.63                   #afsdb1.integra-ev.de
@@ -95,7 +94,7 @@
 >ipp-garching.mpg.de    #Institut fuer Plasmaphysik
 130.183.9.5                     #afs-db1.rzg.mpg.de
 130.183.14.14                   #afs-db3.bc.rzg.mpg.de
-130.183.100.10                  #afs-db2.aug.ipp-garching.mpg.de
+130.183.30.30                   #afs-db4.mpcdf.mpg.de
 >mpe.mpg.de             #MPE cell
 130.183.130.7                   #irafs1.mpe-garching.mpg.de
 130.183.134.20                  #irafs2.mpe-garching.mpg.de
 129.206.119.10                  #afsdb.urz.uni-heidelberg.de
 129.206.119.16                  #afsdb1.urz.uni-heidelberg.de
 129.206.119.17                  #afsdb2.urz.uni-heidelberg.de
->ziti.uni-heidelberg.de #Institute of Computer Science at the University of Heidelberg
-147.142.42.246                  #mp-sun.ziti.uni-heidelberg.de
-147.142.42.252                  #mp-pizza.ziti.uni-heidelberg.de
->uni-hohenheim.de       #University of Hohenheim
-144.41.2.2                      #rs13.serv.uni-hohenheim.de
-144.41.2.3                      #rs14.serv.uni-hohenheim.de
-144.41.2.4                      #rs15.serv.uni-hohenheim.de
 >rz.uni-jena.de         #Rechenzentrum University of Jena, Germany
 141.35.2.180                    #afs00.rz.uni-jena.de
 141.35.2.181                    #afs01.rz.uni-jena.de
 134.155.97.204                  #afsdb1.uni-mannheim.de
 134.155.97.205                  #afsdb2.uni-mannheim.de
 134.155.97.206                  #afsdb3.uni-mannheim.de
->mathematik.uni-stuttgart.de #University of Stuttgart, Math Dept.
-129.69.61.1                     #fbm01.mathematik.uni-stuttgart.de
-129.69.61.2                     #fbm02.mathematik.uni-stuttgart.de
-129.69.61.3                     #fbm03.mathematik.uni-stuttgart.de
->stud.mathematik.uni-stuttgart.de #CIP-Pool of Math. Dept, University of Stuttgart
-129.69.61.28                    #omni.mathematik.uni-stuttgart.de
-129.69.116.201                  #stud01.mathematik.uni-stuttgart.de
-129.69.116.202                  #stud02.mathematik.uni-stuttgart.de
-129.69.116.203                  #stud03.mathematik.uni-stuttgart.de
 >physik.uni-wuppertal.de #Physics department of Bergische Universität Wuppertal
 132.195.104.3                   #afs1.physik.uni-wuppertal.de
 132.195.104.230                 #afs2.physik.uni-wuppertal.de
 128.2.10.2                      #afsdb-01.andrew.cmu.edu
 128.2.10.7                      #afsdb-02.andrew.cmu.edu
 128.2.10.11                     #afsdb-03.andrew.cmu.edu
->mw.andrew.cmu.edu      #Carnegie Mellon University - Middleware Test Cell
-128.2.234.24                    #null.andrew.cmu.edu
-128.2.234.170                   #mw-mgr.andrew.cmu.edu
 >club.cc.cmu.edu        #Carnegie Mellon University Computer Club
 128.2.204.149                   #barium.club.cc.cmu.edu
 128.237.157.11                  #sodium.club.cc.cmu.edu
 128.237.157.13                  #potassium.club.cc.cmu.edu
->chem.cmu.edu           #Carnegie Mellon University - Chemistry Dept.
-128.2.40.134                    #afs.chem.cmu.edu
-128.2.40.140                    #afs2.chem.cmu.edu
 >cs.cmu.edu             #Carnegie Mellon University - School of Comp. Sci.
-128.2.172.58                    #date.srv.cs.cmu.edu
-128.2.172.60                    #fig.srv.cs.cmu.edu
-128.2.200.97                    #watermelon.srv.cs.cmu.edu
+128.2.104.79                    #afsdb-scs-01.srv.cs.cmu.edu
+128.2.104.80                    #afsdb-scs-02.srv.cs.cmu.edu
+128.2.156.64                    #afsdb-scs-03.srv.cs.cmu.edu
 >ece.cmu.edu            #Carnegie Mellon University - Elec. Comp. Eng. Dept.
 128.2.129.7                     #porok.ece.cmu.edu
 128.2.129.8                     #vicio.ece.cmu.edu
 128.2.129.9                     #e-xing.ece.cmu.edu
->scotch.ece.cmu.edu     #CMU ECE CALCM research group
-128.2.134.82                    #lagavulin.ece.cmu.edu
 >qatar.cmu.edu          #Carnegie Mellon University - Qatar
-86.36.46.6                      #afs1.qatar.cmu.edu
-86.36.46.7                      #afs2.qatar.cmu.edu
->sbp.ri.cmu.edu         #Carnegie Mellon University - Sensor Based Planning Lab
-128.2.179.12                    #nihao.sbp.ri.cmu.edu
-128.2.179.113                   #youtheman.sbp.ri.cmu.edu
+86.36.46.6                      #afsdb-01.qatar.cmu.edu
+86.36.46.7                      #afsdb-02.qatar.cmu.edu
+86.36.46.9                      #afsdb-03.qatar.cmu.edu
+>ee.cooper.edu          #The Cooper Union EE Department
+199.98.27.202                   #stallman.ee.cooper.edu
 >cnf.cornell.edu        #CNF
 128.253.198.9                   #hole.cnf.cornell.edu
 128.253.198.27                  #smoke.cnf.cornell.edu
 129.170.30.144                  #dbicafs2.dartmouth.edu
 129.170.30.145                  #dbicafs3.dartmouth.edu
 >northstar.dartmouth.edu #Dartmouth College Research Computing
-129.170.16.22                   #halley.dartmouth.edu
-129.170.16.26                   #andromeda.dartmouth.edu
-129.170.199.250                 #kuiper.dartmouth.edu
+129.170.137.194                 #halley.dartmouth.edu
+129.170.137.195                 #andromeda.dartmouth.edu
+129.170.137.196                 #kuiper.dartmouth.edu
 >cs.hm.edu              #Department Computer Science Munich University Of Applied Science
 129.187.208.31                  #afs1.cs.hm.edu
 >eecs.harvard.edu       #Harvard - EECS
 140.247.60.64                   #lefkada.eecs.harvard.edu
 140.247.60.83                   #corfu.eecs.harvard.edu
->iastate.edu            #Iowa State University
-129.186.1.243                   #afsdb-1.iastate.edu
-129.186.6.243                   #afsdb-2.iastate.edu
-129.186.142.243                 #afsdb-3.iastate.edu
 >acm.jhu.edu            #Johns Hopkins ACM chapter
 128.220.35.191                  #chicago.acm.jhu.edu
 128.220.70.76                   #typhon.acm.jhu.edu
 18.4.60.19                      #reynelda.mit.edu
 18.4.60.22                      #rosebud.mit.edu
 18.4.60.23                      #ronald-ann.mit.edu
->msu.edu                #Michigan State University Main Cell
-35.9.7.10                       #afsdb0.cl.msu.edu
-35.9.7.11                       #afsdb1.cl.msu.edu
-35.9.7.12                       #afsdb2.cl.msu.edu
 >nd.edu                 #University of Notre Dame
 129.74.223.17                   #john.helios.nd.edu
 129.74.223.33                   #lizardo.helios.nd.edu
 136.142.8.20                    #afs10.srv.cis.pitt.edu
 136.142.8.21                    #afs11.srv.cis.pitt.edu
 >cs.pitt.edu            #University of Pittsburgh - Computer Science
-136.142.22.5                    #afs01.cs.pitt.edu
-136.142.22.6                    #afs02.cs.pitt.edu
-136.142.22.7                    #afs03.cs.pitt.edu
+136.142.55.232                  #afs01.cs.pitt.edu
+136.142.55.233                  #afs02.cs.pitt.edu
+136.142.55.234                  #afs03.cs.pitt.edu
 >psc.edu                #PSC (Pittsburgh Supercomputing Center)
 128.182.59.182                  #shaggy.psc.edu
 128.182.66.184                  #velma.psc.edu
 130.85.24.87                    #db3.afs.umbc.edu
 130.85.24.101                   #db1.afs.umbc.edu
 >glue.umd.edu           #University of Maryland - Project Glue
-128.8.70.11                     #olmec.umd.edu
-128.8.236.4                     #egypt.umd.edu
+128.8.163.205                   #hurricane.umd.edu
+128.8.236.2                     #cyclone.umd.edu
 128.8.236.230                   #babylon.umd.edu
->wam.umd.edu            #University of Maryland Network WAM Project
-128.8.70.9                      #csc-srv.wam.umd.edu
-128.8.236.5                     #avw-srv.wam.umd.edu
-128.8.236.231                   #ptx-srv.wam.umd.edu
 >umich.edu              #University of Michigan - Campus
 141.211.1.32                    #fear.ifs.umich.edu
 141.211.1.33                    #surprise.ifs.umich.edu
 141.211.1.34                    #ruthless.ifs.umich.edu
 >atlas.umich.edu        #ATLAS group cell in physics at University of Michigan
-141.211.43.102                  #linat02.grid.umich.edu
-141.211.43.103                  #linat03.grid.umich.edu
-141.211.43.104                  #linat04.grid.umich.edu
+192.41.230.102                  #linat02.aglt2.org
+192.41.230.103                  #linat03.aglt2.org
+192.41.230.104                  #linat04.aglt2.org
 >citi.umich.edu         #University of Michigan - Center for Information Technology Integ
 141.212.112.5                   #babylon.citi.umich.edu
 >isis.unc.edu           #Univ. of NC at Chapel Hill - ITS
 147.156.163.11                  #alpha.ific.uv.es
 >alteholz.eu            #alteholz.eu
 78.47.192.125                   #krb1eu.afs.alteholz.net
->in2p3.fr               #IN2P3
-134.158.104.11                  #ccafsdb01.in2p3.fr
-134.158.104.12                  #ccafsdb02.in2p3.fr
-134.158.104.13                  #ccafsdb03.in2p3.fr
 >mcc.ac.gb              #University of Manchester
 130.88.203.41                   #nevis.mc.man.ac.uk
 130.88.203.144                  #eryri.mc.man.ac.uk
 193.205.219.60                  #beta2.dia.uniroma3.it
 193.205.219.61                  #gamma2.dia.uniroma3.it
 >italia                 #Italian public AFS cell
-193.204.5.9                     #afs.caspur.it
+192.107.82.220                  #afsitalia.portici.enea.it
 >cmf.nrl.navy.mil       #Naval Research Laboratory - Center for Computational Science
 134.207.12.68                   #picard.cmf.nrl.navy.mil
 134.207.12.69                   #riker.cmf.nrl.navy.mil
 >laroia.net             #Laroia Networks
 66.66.102.254                   #supercore.laroia.net
 >pallissard.net         #pallissard.net
-35.184.35.247                   #files.pallissard.net
 >sinenomine.net         #Sine Nomine Associates
-207.89.43.108                   #afsdb3.sinenomine.net
-207.89.43.109                   #afsdb4.sinenomine.net
-207.89.43.110                   #afsdb5.sinenomine.net
+198.44.193.30                   #afsdb3.sinenomine.net
+198.44.193.31                   #afsdb4.sinenomine.net
+198.44.193.32                   #afsdb5.sinenomine.net
 >slackers.net           #The Slackers' Network
 199.4.150.159                   #alexandria.slackers.net
 >tproa.net              #The People's Republic of Ames
 66.93.61.184                    #vice1.coed.org
 128.237.157.35                  #vice3.coed.org
 >dementia.org           #Dementia Unlimited (old)
-128.2.13.209                    #dedlock.dementix.org
-128.2.234.204                   #vorkana.dementix.org
-128.2.235.26                    #meredith.dementix.org
+204.29.154.67                   #alice-comfort.dementix.org
 >dementix.org           #Dementia Unlimited
-128.2.13.209                    #dedlock.dementix.org
-128.2.234.204                   #vorkana.dementix.org
-128.2.235.26                    #meredith.dementix.org
+204.29.154.67                   #alice-comfort.dementix.org
 >idahofuturetruck.org   #University of Idaho hybrid vehicle development
 12.18.238.210                   #dsle210.fsr.net
 >afs.ietfng.org         #ietfng.org
 >riscpkg.org            #The RISC OS Packaging Project
 83.104.175.10                   #delenn.riscpkg.org
 >kth.se                 #Royal Institute of Technology, Stockholm, Sweden
-130.237.32.145                  #sonen.e.kth.se
+130.237.48.5                    #sonen.e.kth.se
 130.237.48.7                    #anden.e.kth.se
 130.237.48.244                  #fadern.e.kth.se
 >ict.kth.se             #Royal Institute of Technology, Information and Communication tec
 130.237.216.12                  #afsdb2.ict.kth.se
 130.237.216.13                  #afsdb3.ict.kth.se
 >it.kth.se              #Royal Institute of Technology, Teleinformatics, Kista
-130.237.216.14                  #afsdb1.it.kth.se
-130.237.216.15                  #afsdb2.it.kth.se
-130.237.216.16                  #afsdb3.it.kth.se
+130.237.48.68                   #itafs-2.sys.kth.se
 >md.kth.se              #Royal Institute of Technology, MMK
-130.237.32.63                   #mdafs-1.sys.kth.se
+130.237.48.170                  #mdafs-3.sys.kth.se
 >mech.kth.se            #Royal Institute of Technology, MECH
 130.237.233.142                 #matterhorn.mech.kth.se
 130.237.233.143                 #castor.mech.kth.se
 130.237.233.144                 #pollux.mech.kth.se
 >nada.kth.se            #Royal Institute of Technology, NADA
-130.237.223.12                  #afsdb-2.csc.kth.se
-130.237.224.78                  #afsdb-3.csc.kth.se
-130.237.227.23                  #afsdb-4.csc.kth.se
+130.237.48.8                    #nadaafs-3.sys.kth.se
+130.237.48.41                   #nadaafs-1.sys.kth.se
+130.237.48.58                   #nadaafs-2.sys.kth.se
 >pdc.kth.se             #Royal Institute of Technology, PDC
 130.237.232.29                  #crab.pdc.kth.se
 130.237.232.112                 #anna.pdc.kth.se
 130.237.83.23                   #afs.haninge.kth.se
 >sanchin.se             #Sanchin Consulting AB, Sweden
 192.195.148.10                  #sesan.sanchin.se
->su.se                  #Stockholm University
-130.237.162.81                  #afsdb1.su.se
-130.237.162.82                  #afsdb2.su.se
-130.237.162.230                 #afsdb3.su.se
 >fysik.su.se            #Stockholm University, Physics Department
 130.237.244.134                 #srv01.fysik.su.se
 130.237.244.135                 #srv02.fysik.su.se
 >p-ng.si                #University of Nova Gorica
 193.2.120.2                     #solkan.p-ng.si
 193.2.120.9                     #sabotin.p-ng.si
+>ung.si                 #University of Nova Gorica
+193.2.120.63                    #afs1.ung.si
 >ihep.su                #Institute for High-Energy Physics
 194.190.165.201                 #fs0001.ihep.su
 194.190.165.202                 #fs0002.ihep.su
index 0d29767..06cd96d 100644 (file)
@@ -559,7 +559,7 @@ ParseCacheInfoFile(void)
     FILE *cachefd;             /*Descriptor for cache info file */
     int parseResult;           /*Result of our fscanf() */
     int tCacheBlocks;
-    char tCacheBaseDir[1024], *tbd, tCacheMountDir[1024], *tmd;
+    char tCacheBaseDir[1025], *tbd, tCacheMountDir[1025], *tmd;
 
     if (afsd_debug)
        printf("%s: Opening cache info file '%s'...\n", rn, fullpn_CacheInfo);
index c45c64f..94f1a32 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/opr.h>
 
 #include <roken.h>
 
@@ -77,8 +78,6 @@
 #include <afs/afs_args.h>
 #include <afs/cellconfig.h>
 #include <afs/afssyscalls.h>
-#include <afs/afsutil.h>
-
 #ifdef AFS_DARWIN_ENV
 #ifdef AFS_DARWIN80_ENV
 #include <sys/xattr.h>
@@ -346,7 +345,7 @@ afsd_call_syscall(struct afsd_syscall_args *args)
         const char *syscall_str;
 
 #if defined(AFS_SYSCALL)
-        syscall_str = AFS_STRINGIZE(AFS_SYSCALL);
+       syscall_str = opr_stringize(AFS_SYSCALL);
 #else
         syscall_str = "[AFS_SYSCALL]";
 #endif
index e30175b..6a75399 100644 (file)
@@ -129,7 +129,7 @@ main(int argc, char *argv[])
     cmd_AddParm(ts, "-silent", CMD_FLAG, CMD_OPTIONAL, "silent operation");
     /* Note: -lifetime is not implemented in this version of klog. */
     cmd_AddParm(ts, "-lifetime", CMD_SINGLE, CMD_OPTIONAL,
-               "ticket lifetime in hh[:mm[:ss]]");
+               "ignored (for compatibility with the krb4-based klog)");
     cmd_AddParm(ts, "-setpag", CMD_FLAG, CMD_OPTIONAL,
                "Create a new setpag before authenticating");
     cmd_AddParm(ts, "-tmp", CMD_FLAG, CMD_OPTIONAL,
index acb9e86..0fe7d1b 100644 (file)
@@ -62,14 +62,15 @@ static int default_interface = 0; /* Set default to the file interface */
  * Audit interface calling sequence:
  * osi_audit_interface - sets the default audit interface
  * osi_audit_file
- *    create_instance - Called during command arg processing (-auditlog)
+ *    create_interface - Called during command arg processing (-auditlog)
  *    open_file - Called during command arg processing (-auditlog)
- * osi_audit_open_interface
+ * osi_audit_open
  *    open_interface - Called after thread environment has been established
- * osi_audit_close_interface
- *    close_interface - Called during main process shutdown
  * osi_audit
  *    send_msg - Called during audit events
+ * osi_audit_close
+ *    close_interface - Called during main process shutdown
+
  */
 struct audit_log {
     struct opr_queue link;
@@ -93,7 +94,6 @@ static pthread_once_t audit_lock_once = PTHREAD_ONCE_INIT;
 static struct opr_queue audit_logs = {&audit_logs, &audit_logs};
 
 static int osi_audit_all = (-1);       /* Not determined yet */
-static int osi_echo_trail = (-1);
 
 static int auditout_open = 0;          /* True if any interface is open */
 
@@ -325,11 +325,9 @@ audmakebuf(char *audEvent, va_list vaList)
                break;
            }
        default:
-#ifdef AFS_AIX32_ENV
            code =
                auditlog("AFS_Aud_EINVAL", (-1), audEvent,
                         (strlen(audEvent) + 1));
-#endif
            return;
            break;
        }                       /* end switch */
@@ -337,7 +335,7 @@ audmakebuf(char *audEvent, va_list vaList)
        vaEntry = va_arg(vaList, int);
     }                          /* end while */
 }
-#endif
+#endif /* AFS_AIX32_ENV */
 
 static void
 printbuf(int rec, char *audEvent, char *afsName, afs_int32 hostId,
@@ -604,7 +602,7 @@ osi_audit_internal(char *audEvent,  /* Event name (15 chars or less) */
     pthread_once(&audit_lock_once, osi_audit_init_lock);
 #endif /* AFS_PTHREAD_ENV */
 
-    if ((osi_audit_all < 0) || (osi_echo_trail < 0))
+    if (osi_audit_all < 0)
        osi_audit_check();
     if (!osi_audit_all && !auditout_open)
        return 0;
@@ -663,7 +661,7 @@ osi_audit(char *audEvent,   /* Event name (15 chars or less) */
 {
     va_list vaList;
 
-    if ((osi_audit_all < 0) || (osi_echo_trail < 0))
+    if (osi_audit_all < 0)
        osi_audit_check();
     if (!osi_audit_all && !auditout_open)
        return 0;
@@ -771,16 +769,12 @@ osi_audit_check(void)
     osi_audit_all = 1;         /* say we made check (>= 0) */
     /* and assume audit all events (for now) */
     onoff = 0;                 /* assume we will turn auditing off */
-    osi_echo_trail = 0;                /* assume no echoing   */
 
     fds = fopen(AFSDIR_SERVER_AUDIT_FILEPATH, "r");
     if (fds) {
        while (fscanf(fds, "%256s", event) > 0) {
            if (strcmp(event, "AFS_AUDIT_AllEvents") == 0)
                onoff = 1;
-
-           if (strcmp(event, "Echo_Trail") == 0)
-               osi_echo_trail = 1;
        }
        fclose(fds);
     }
index b39cef0..e503787 100644 (file)
@@ -461,7 +461,7 @@ afsconf_BuildServerSecurityObjects_int(struct afsconf_bsso_info *info,
                                              _afsconf_GetRxkadKrb5Key, NULL);
 #ifdef AFS_RXGK_ENV
     (*classes)[RX_SECIDX_GK] =
-        rxgk_NewServerSecurityObject(rock, afsconf_GetRXGKKey);
+       rxgk_NewServerSecurityObject(dir, afsconf_GetRXGKKey);
 #endif
 }
 
index b26bd6e..004ac1f 100644 (file)
@@ -12,8 +12,6 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-#include <roken.h>
-
 #include <afs/stds.h>
 #include <afs/opr.h>
 #include <afs/pthread_glock.h>
@@ -26,6 +24,8 @@
 #if defined(UKERNEL)
 # include "afsincludes.h"
 # include <afs_usrops.h>
+#else
+# include <roken.h>
 #endif
 
 #ifdef AFS_AIX_ENV
index 0f430ce..f89773b 100644 (file)
@@ -158,17 +158,15 @@ SaveCore(struct bnode *abnode, struct bnode_proc
 }
 
 int
-bnode_GetString(struct bnode *abnode, char *abuffer,
-               afs_int32 alen)
+bnode_GetString(struct bnode *abnode, char **adesc)
 {
-    return BOP_GETSTRING(abnode, abuffer, alen);
+    return BOP_GETSTRING(abnode, adesc);
 }
 
 int
-bnode_GetParm(struct bnode *abnode, afs_int32 aindex,
-             char *abuffer, afs_int32 alen)
+bnode_GetParm(struct bnode *abnode, afs_int32 aindex, char **aparm)
 {
-    return BOP_GETPARM(abnode, aindex, abuffer, alen);
+    return BOP_GETPARM(abnode, aindex, aparm);
 }
 
 int
@@ -178,6 +176,17 @@ bnode_GetStat(struct bnode *abnode, afs_int32 * astatus)
 }
 
 int
+bnode_GetNotifier(struct bnode *abnode, char **anotifier)
+{
+    if (abnode->notifier == NULL)
+       return BZNOENT;
+    *anotifier = strdup(abnode->notifier);
+    if (*anotifier == NULL)
+       return BZIO;
+    return 0;
+}
+
+int
 bnode_RestartP(struct bnode *abnode)
 {
     return BOP_RESTARTP(abnode);
@@ -200,6 +209,14 @@ bnode_HasCore(struct bnode *abnode)
     return BOP_HASCORE(abnode);
 }
 
+/* wait until bnode_Check() gets called for this bnode */
+static void
+bnode_Wait(struct bnode *abnode)
+{
+    abnode->flags |= BNODE_WAIT;
+    LWP_WaitProcess(abnode);
+}
+
 /* wait for all bnodes to stabilize */
 int
 bnode_WaitAll(void)
@@ -219,8 +236,7 @@ bnode_WaitAll(void)
            return code;
        }
        if (stat != tb->goal) {
-           tb->flags |= BNODE_WAIT;
-           LWP_WaitProcess(tb);
+           bnode_Wait(tb);
            bnode_Release(tb);
            goto retry;
        }
@@ -253,8 +269,7 @@ bnode_WaitStatus(struct bnode *abnode, int astatus)
            return -1;          /* no longer our goal, don't keep waiting */
        }
        /* otherwise, block */
-       abnode->flags |= BNODE_WAIT;
-       LWP_WaitProcess(abnode);
+       bnode_Wait(abnode);
     }
 }
 
@@ -685,72 +700,41 @@ bproc(void *unused)
 }
 
 static afs_int32
-SendNotifierData(int fd, struct bnode_proc *tp)
+SendNotifierData(FILE *fp, struct bnode_proc *tp)
 {
     struct bnode *tb = tp->bnode;
-    char buffer[1000], *bufp = buffer, *buf1;
-    int len;
 
     /*
      * First sent out the bnode_proc struct
      */
-    (void)sprintf(bufp, "BEGIN bnode_proc\n");
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "comLine: %s\n", tp->comLine);
-    bufp += strlen(bufp);
-    if (!(buf1 = tp->coreName))
-       buf1 = "(null)";
-    (void)sprintf(bufp, "coreName: %s\n", buf1);
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "pid: %ld\n", afs_printable_int32_ld(tp->pid));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "lastExit: %ld\n", afs_printable_int32_ld(tp->lastExit));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "flags: %ld\n", afs_printable_int32_ld(tp->flags));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "END bnode_proc\n");
-    bufp += strlen(bufp);
-    len = (int)(bufp - buffer);
-    if (write(fd, buffer, len) < 0) {
+    fprintf(fp, "BEGIN bnode_proc\n");
+    fprintf(fp, "comLine: %s\n", tp->comLine);
+    fprintf(fp, "coreName: %s\n", (tp->coreName == NULL ? "(null)" : tp->coreName));
+    fprintf(fp, "pid: %ld\n", afs_printable_int32_ld(tp->pid));
+    fprintf(fp, "lastExit: %ld\n", afs_printable_int32_ld(tp->lastExit));
+    fprintf(fp, "flags: %ld\n", afs_printable_int32_ld(tp->flags));
+    fprintf(fp, "END bnode_proc\n");
+    if (ferror(fp) != 0)
        return -1;
-    }
 
     /*
      * Now sent out the bnode struct
      */
-    bufp = buffer;
-    (void)sprintf(bufp, "BEGIN bnode\n");
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "name: %s\n", tb->name);
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "rsTime: %ld\n", afs_printable_int32_ld(tb->rsTime));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "rsCount: %ld\n", afs_printable_int32_ld(tb->rsCount));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "procStartTime: %ld\n", afs_printable_int32_ld(tb->procStartTime));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "procStarts: %ld\n", afs_printable_int32_ld(tb->procStarts));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "lastAnyExit: %ld\n", afs_printable_int32_ld(tb->lastAnyExit));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "lastErrorExit: %ld\n", afs_printable_int32_ld(tb->lastErrorExit));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "errorCode: %ld\n", afs_printable_int32_ld(tb->errorCode));
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "errorSignal: %ld\n", afs_printable_int32_ld(tb->errorSignal));
-    bufp += strlen(bufp);
-/*
-    (void) sprintf(bufp, "lastErrorName: %s\n", tb->lastErrorName);
-    bufp += strlen(bufp);
-*/
-    (void)sprintf(bufp, "goal: %d\n", tb->goal);
-    bufp += strlen(bufp);
-    (void)sprintf(bufp, "END bnode\n");
-    bufp += strlen(bufp);
-    len = (int)(bufp - buffer);
-    if (write(fd, buffer, len) < 0) {
+    fprintf(fp, "BEGIN bnode\n");
+    fprintf(fp, "name: %s\n", tb->name);
+    fprintf(fp, "rsTime: %ld\n", afs_printable_int32_ld(tb->rsTime));
+    fprintf(fp, "rsCount: %ld\n", afs_printable_int32_ld(tb->rsCount));
+    fprintf(fp, "procStartTime: %ld\n", afs_printable_int32_ld(tb->procStartTime));
+    fprintf(fp, "procStarts: %ld\n", afs_printable_int32_ld(tb->procStarts));
+    fprintf(fp, "lastAnyExit: %ld\n", afs_printable_int32_ld(tb->lastAnyExit));
+    fprintf(fp, "lastErrorExit: %ld\n", afs_printable_int32_ld(tb->lastErrorExit));
+    fprintf(fp, "errorCode: %ld\n", afs_printable_int32_ld(tb->errorCode));
+    fprintf(fp, "errorSignal: %ld\n", afs_printable_int32_ld(tb->errorSignal));
+    fprintf(fp, "goal: %d\n", tb->goal);
+    fprintf(fp, "END bnode\n");
+    if (ferror(fp) != 0)
        return -1;
-    }
+
     return 0;
 }
 
@@ -786,8 +770,12 @@ hdl_notifier(struct bnode_proc *tp)
            perror(tb->notifier);
            exit(1);
        }
-       SendNotifierData(fileno(fout), tp);
-       pclose(fout);
+       if (SendNotifierData(fout, tp) != 0)
+           bozo_Log("BNODE: Failed to send notifier data to '%s'\n",
+                    tb->notifier);
+       if (pclose(fout) < 0)
+           bozo_Log("BNODE: Failed to close notifier pipe to '%s', %d\n",
+                    tb->notifier, errno);
        exit(0);
     } else if (pid < 0) {
        bozo_Log("Failed to fork creating process to handle notifier '%s'\n",
index 0172176..a8d5161 100644 (file)
@@ -12,8 +12,8 @@
 #define        BOP_SETSTAT(bnode, a)   ((*(bnode)->ops->setstat)((bnode),(a)))
 #define        BOP_DELETE(bnode)       ((*(bnode)->ops->delete)((bnode)))
 #define        BOP_PROCEXIT(bnode, a)  ((*(bnode)->ops->procexit)((bnode),(a)))
-#define        BOP_GETSTRING(bnode, a, b)      ((*(bnode)->ops->getstring)((bnode),(a), (b)))
-#define        BOP_GETPARM(bnode, n, b, l)     ((*(bnode)->ops->getparm)((bnode),(n),(b),(l)))
+#define        BOP_GETSTRING(bnode, a) ((*(bnode)->ops->getstring)((bnode),(a)))
+#define        BOP_GETPARM(bnode, n, b)        ((*(bnode)->ops->getparm)((bnode),(n),(b)))
 #define        BOP_RESTARTP(bnode)     ((*(bnode)->ops->restartp)((bnode)))
 #define BOP_HASCORE(bnode)     ((*(bnode)->ops->hascore)((bnode)))
 #define BOP_PROCSTARTED(bnode,p)       ((*(bnode)->ops->procstarted)((bnode),(p)))
@@ -27,9 +27,8 @@ struct bnode_ops {
     int (*setstat) ( struct bnode *, afs_int32 );
     int (*delete) ( struct bnode * );
     int (*procexit) ( struct bnode *, struct bnode_proc * );
-    int (*getstring) ( struct bnode *, char *abuffer, afs_int32 alen );
-    int (*getparm) ( struct bnode *, afs_int32 aindex, char *abuffer,
-                    afs_int32 alen);
+    int (*getstring) ( struct bnode *, char **adesc );
+    int (*getparm) ( struct bnode *, afs_int32 aindex, char **aparm);
     int (*restartp) ( struct bnode *);
     int (*hascore) ( struct bnode *);
     int (*procstarted) ( struct bnode *, struct bnode_proc * );
index 8609047..aafd10d 100644 (file)
@@ -91,6 +91,7 @@ GetConn(struct cmd_syndesc *as, int aencrypt)
     char *hostname;
     char *cellname = NULL;
     const char *confdir;
+    const char *retry_confdir;
     afs_int32 code;
     struct rx_connection *tconn;
     afs_int32 addr;
@@ -116,16 +117,23 @@ GetConn(struct cmd_syndesc *as, int aencrypt)
     if (as->parms[ADDPARMOFFSET + 2].items) { /* -localauth */
        secFlags |= AFSCONF_SECOPTS_LOCALAUTH;
        confdir = AFSDIR_SERVER_ETC_DIRPATH;
+       retry_confdir = NULL;
     } else {
        confdir = AFSDIR_CLIENT_ETC_DIRPATH;
+       retry_confdir = AFSDIR_SERVER_ETC_DIRPATH;
     }
 
     if (as->parms[ADDPARMOFFSET + 1].items) { /* -noauth */
+       /* If we're running with -noauth, we don't need a configuration
+        * directory. */
        secFlags |= AFSCONF_SECOPTS_NOAUTH;
     } else {
-       /* If we're running with -noauth, we don't need a configuration
-        * directory */
        tdir = afsconf_Open(confdir);
+       if (tdir == NULL && retry_confdir != NULL) {
+           fprintf(stderr, "bos: Retrying initialization with directory %s\n",
+                   retry_confdir);
+           tdir = afsconf_Open(retry_confdir);
+       }
        if (tdir == NULL) {
            fprintf(stderr, "bos: can't open cell database (%s)\n", confdir);
            exit(1);
index 5c00176..cfe0d92 100644 (file)
@@ -306,13 +306,13 @@ SBOZO_Install(struct rx_call *acall, char *aname, afs_int32 asize, afs_int32 mod
        return BZNOENT;
     }
     if (asprintf(&fpNew, "%s.NEW", filepath) < 0) {
-       ret = ENOMEM;
+       ret = BZIO;
        fpNew = NULL;
        goto out;
     }
     tbuffer = malloc(AFSDIR_PATH_MAX);
     if (tbuffer == NULL) {
-       ret =  ENOMEM;
+       ret = BZIO;
        goto out;
     }
 
@@ -433,7 +433,7 @@ SBOZO_GetCellName(struct rx_call *acall, char **aname)
     if (code == 0) {
        *aname = strdup(tname);
        if (*aname == NULL)
-           code = ENOMEM;
+           code = BZIO;
     }
 
     return code;
@@ -1128,28 +1128,15 @@ SBOZO_GetStatus(struct rx_call *acall, char *ainstance, afs_int32 *astat,
     afs_int32 code;
 
     tb = bnode_FindInstance(ainstance);
-    if (!tb) {
-       code = BZNOENT;
-       goto fail;
-    }
+    if (!tb)
+       return BZNOENT;
 
     bnode_Hold(tb);
     code = bnode_GetStat(tb, astat);
-    if (code) {
-       bnode_Release(tb);
-       goto fail;
-    }
-
-    *astatDescr = malloc(BOZO_BSSIZE);
-    code = bnode_GetString(tb, *astatDescr, BOZO_BSSIZE);
+    if (code == 0)
+       code = bnode_GetString(tb, astatDescr);
     bnode_Release(tb);
-    if (code)
-       (*astatDescr)[0] = 0;   /* null string means no further info */
-    return 0;
 
-  fail:
-    *astatDescr = malloc(1);
-    **astatDescr = 0;
     return code;
 }
 
@@ -1165,7 +1152,7 @@ eifunc(struct bnode *abnode, void *param)
 
     if (arock->counter-- == 0) {
        /* done */
-       strcpy(arock->iname, abnode->name);
+       arock->iname = strdup(abnode->name);
        return 1;
     } else {
        /* not there yet */
@@ -1244,15 +1231,19 @@ SBOZO_EnumerateInstance(struct rx_call *acall, afs_int32 anum,
 {
     struct eidata tdata;
 
-    *ainstance = malloc(BOZO_BSSIZE);
-    **ainstance = 0;
+    if (anum < 0)
+       return BZDOM;
+
     tdata.counter = anum;
-    tdata.iname = *ainstance;
+    tdata.iname = NULL;
     bnode_ApplyInstance(eifunc, &tdata);
     if (tdata.counter >= 0)
        return BZDOM;           /* anum > # of actual instances */
-    else
-       return 0;
+    if (tdata.iname == NULL)
+       return BZIO;
+
+    *ainstance = tdata.iname;
+    return 0;
 }
 
 struct bozo_bosEntryStats bozo_bosEntryStats[] = {
@@ -1385,14 +1376,15 @@ SBOZO_GetInstanceInfo(IN struct rx_call *acall,
     struct bnode *tb;
 
     tb = bnode_FindInstance(ainstance);
-    *atype = malloc(BOZO_BSSIZE);
-    **atype = 0;
     if (!tb)
        return BZNOENT;
     if (tb->type)
-       strcpy(*atype, tb->type->name);
+       *atype = strdup(tb->type->name);
     else
-       (*atype)[0] = 0;        /* null string */
+       *atype = strdup("");
+    if (*atype == NULL)
+       return BZIO;
+
     memset(astatus, 0, sizeof(struct bozo_status));    /* good defaults */
     astatus->goal = tb->goal;
     astatus->fileGoal = tb->fileGoal;
@@ -1418,24 +1410,18 @@ SBOZO_GetInstanceParm(struct rx_call *acall,
                      char **aparm)
 {
     struct bnode *tb;
-    char *tp;
     afs_int32 code;
 
-    tp = malloc(BOZO_BSSIZE);
-    *aparm = tp;
-    *tp = 0;                   /* null-terminate string in error case */
     tb = bnode_FindInstance(ainstance);
     if (!tb)
        return BZNOENT;
+
     bnode_Hold(tb);
     if (anum == 999) {
-       if (tb->notifier) {
-           memcpy(tp, tb->notifier, strlen(tb->notifier) + 1);
-           code = 0;
-       } else
-           code = BZNOENT;     /* XXXXX */
-    } else
-       code = bnode_GetParm(tb, anum, tp, BOZO_BSSIZE);
+       code = bnode_GetNotifier(tb, aparm);
+    } else {
+       code = bnode_GetParm(tb, anum, aparm);
+    }
     bnode_Release(tb);
 
     /* Not Currently Audited */
index b22ccff..a308e4d 100644 (file)
 
 /* bnode.c */
 int bnode_CoreName(struct bnode *abnode, char *acoreName, char *abuffer);
-int bnode_GetString(struct bnode *abnode, char *abuffer, afs_int32 alen);
-int bnode_GetParm(struct bnode *abnode, afs_int32 aindex, char *abuffer,
-                 afs_int32 alen);
+int bnode_GetString(struct bnode *abnode, char **adesc);
+int bnode_GetParm(struct bnode *abnode, afs_int32 aindex, char **aparm);
 int bnode_GetStat(struct bnode *abnode, afs_int32 * astatus);
+int bnode_GetNotifier(struct bnode *abnode, char **anotifier);
 int bnode_RestartP(struct bnode *abnode);
 int bnode_HasCore(struct bnode *abnode);
 int bnode_WaitAll(void);
index ff608b9..bb6b23e 100644 (file)
@@ -247,13 +247,9 @@ MakeDir(const char *adir)
 static int
 CreateDirs(const char *coredir)
 {
-    if ((!strncmp
-        (AFSDIR_USR_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
-         strlen(AFSDIR_USR_DIRPATH)))
-       ||
-       (!strncmp
+    if (!strncmp
         (AFSDIR_USR_DIRPATH, AFSDIR_SERVER_BIN_DIRPATH,
-         strlen(AFSDIR_USR_DIRPATH)))) {
+         strlen(AFSDIR_USR_DIRPATH))) {
        if (MakeDir(AFSDIR_USR_DIRPATH))
            return errno;
     }
@@ -273,29 +269,6 @@ CreateDirs(const char *coredir)
        return errno;
     if (MakeDir(AFSDIR_SERVER_LOGS_DIRPATH))
        return errno;
-#ifndef AFS_NT40_ENV
-    if (!strncmp
-       (AFSDIR_CLIENT_VICE_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
-        strlen(AFSDIR_CLIENT_VICE_DIRPATH))) {
-       if (MakeDir(AFSDIR_CLIENT_VICE_DIRPATH))
-           return errno;
-    }
-    if (MakeDir(AFSDIR_CLIENT_ETC_DIRPATH))
-       return errno;
-
-    if (symlink(AFSDIR_SERVER_THISCELL_FILEPATH,
-           AFSDIR_CLIENT_THISCELL_FILEPATH)) {
-       if (errno != EEXIST) {
-           return errno;
-       }
-    }
-    if (symlink(AFSDIR_SERVER_CELLSERVDB_FILEPATH,
-           AFSDIR_CLIENT_CELLSERVDB_FILEPATH)) {
-       if (errno != EEXIST) {
-           return errno;
-       }
-    }
-#endif /* AFS_NT40_ENV */
     if (coredir) {
        if (MakeDir(coredir))
            return errno;
@@ -324,7 +297,6 @@ bzwrite(struct bnode *abnode, void *arock)
 {
     struct bztemp *at = (struct bztemp *)arock;
     int i;
-    char tbuffer[BOZO_BSSIZE];
     afs_int32 code;
 
     if (abnode->notifier)
@@ -334,13 +306,16 @@ bzwrite(struct bnode *abnode, void *arock)
        fprintf(at->file, "bnode %s %s %d\n", abnode->type->name,
                abnode->name, abnode->fileGoal);
     for (i = 0;; i++) {
-       code = bnode_GetParm(abnode, i, tbuffer, BOZO_BSSIZE);
+       char *parm = NULL;
+
+       code = bnode_GetParm(abnode, i, &parm);
        if (code) {
            if (code != BZDOM)
                return code;
            break;
        }
-       fprintf(at->file, "parm %s\n", tbuffer);
+       fprintf(at->file, "parm %s\n", parm);
+       free(parm);
     }
     fprintf(at->file, "end\n");
     return 0;
index c46bf8c..51c1823 100644 (file)
@@ -33,8 +33,8 @@ static int cron_getstat(struct bnode *bnode, afs_int32 *status);
 static int cron_setstat(struct bnode *bnode, afs_int32 status);
 static int cron_procstarted(struct bnode *bnode, struct bnode_proc *proc);
 static int cron_procexit(struct bnode *bnode, struct bnode_proc *proc);
-static int cron_getstring(struct bnode *bnode, char *abuffer, afs_int32 alen);
-static int cron_getparm(struct bnode *bnode, afs_int32, char *, afs_int32);
+static int cron_getstring(struct bnode *bnode, char **adesc);
+static int cron_getparm(struct bnode *bnode, afs_int32 aindex, char **aparm);
 
 #define        SDTIME          60      /* time in seconds given to a process to evaporate */
 
@@ -302,28 +302,38 @@ cron_procexit(struct bnode *bn, struct bnode_proc *aproc)
 }
 
 static int
-cron_getstring(struct bnode *bn, char *abuffer, afs_int32 alen)
+cron_getstring(struct bnode *bn, char **adesc)
 {
+    int code;
+    char *desc = NULL;
     struct cronbnode *abnode = (struct cronbnode *)bn;
+
     if (abnode->running)
-       strcpy(abuffer, "running now");
+       code = asprintf(&desc, "running now");
     else if (abnode->when == 0)
-       strcpy(abuffer, "waiting to run once");
+       code = asprintf(&desc, "waiting to run once");
     else
-       sprintf(abuffer, "run next at %s", ktime_DateOf(abnode->when));
+       code = asprintf(&desc, "run next at %s", ktime_DateOf(abnode->when));
+    if (code < 0)
+       return BZIO;
+    *adesc = desc;
     return 0;
 }
 
 static int
-cron_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
-            afs_int32 alen)
+cron_getparm(struct bnode *bn, afs_int32 aindex, char **aparm)
 {
     struct cronbnode *abnode = (struct cronbnode *)bn;
+    char *parm;
+
     if (aindex == 0)
-       strcpy(abuffer, abnode->command);
-    else if (aindex == 1) {
-       strcpy(abuffer, abnode->whenString);
-    } else
+       parm = abnode->command;
+    else if (aindex == 1)
+       parm = abnode->whenString;
+    else
        return BZDOM;
+    *aparm = strdup(parm);
+    if (*aparm == NULL)
+       return BZIO;
     return 0;
 }
index 586b177..57d10a8 100644 (file)
@@ -33,8 +33,8 @@ static int ez_timeout(struct bnode *bnode);
 static int ez_getstat(struct bnode *bnode, afs_int32 *status);
 static int ez_setstat(struct bnode *bnode, afs_int32 status);
 static int ez_procexit(struct bnode *bnode, struct bnode_proc *proc);
-static int ez_getstring(struct bnode *bnode, char *abuffer, afs_int32 alen);
-static int ez_getparm(struct bnode *bnode, afs_int32, char *, afs_int32);
+static int ez_getstring(struct bnode *bnode, char **adesc);
+static int ez_getparm(struct bnode *bnode, afs_int32 aindex, char **parm);
 static int ez_procstarted(struct bnode *bnode, struct bnode_proc *proc);
 
 #define        SDTIME          60      /* time in seconds given to a process to evaporate */
@@ -233,18 +233,25 @@ ez_procexit(struct bnode *bn, struct bnode_proc *aproc)
 }
 
 static int
-ez_getstring(struct bnode *abnode, char *abuffer, afs_int32 alen)
+ez_getstring(struct bnode *abnode, char **adesc)
 {
-    return -1;                 /* don't have much to add */
+    *adesc = strdup("");  /* Don't have much to add. */
+    if (*adesc == NULL)
+       return BZIO;
+    return 0;
 }
 
 static int
-ez_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
-          afs_int32 alen)
+ez_getparm(struct bnode *bn, afs_int32 aindex, char **aparm)
 {
     struct ezbnode *abnode = (struct ezbnode *) bn;
-    if (aindex > 0)
+
+    if (aindex != 0)
        return BZDOM;
-    strcpy(abuffer, abnode->command);
+
+    *aparm = strdup(abnode->command);
+    if (*aparm == NULL)
+       return BZIO;
+
     return 0;
 }
index 0aa55ab..c6bcef9 100644 (file)
@@ -100,11 +100,9 @@ static int fs_getstat(struct bnode *abnode, afs_int32 * astatus);
 static int fs_setstat(struct bnode *abnode, afs_int32 astatus);
 static int fs_procstarted(struct bnode *abnode, struct bnode_proc *aproc);
 static int fs_procexit(struct bnode *abnode, struct bnode_proc *aproc);
-static int fs_getstring(struct bnode *abnode, char *abuffer, afs_int32 alen);
-static int fs_getparm(struct bnode *abnode, afs_int32 aindex,
-                     char *abuffer, afs_int32 alen);
-static int dafs_getparm(struct bnode *abnode, afs_int32 aindex,
-                       char *abuffer, afs_int32 alen);
+static int fs_getstring(struct bnode *abnode, char **adesc);
+static int fs_getparm(struct bnode *abnode, afs_int32 aindex, char **aparm);
+static int dafs_getparm(struct bnode *abnode, afs_int32 aindex, char **aparm);
 
 static int SetSalFlag(struct fsbnode *abnode, int aflag);
 static int RestoreSalFlag(struct fsbnode *abnode);
@@ -1064,85 +1062,89 @@ NudgeProcs(struct fsbnode *abnode)
 }
 
 static int
-fs_getstring(struct bnode *bn, char *abuffer, afs_int32 alen)
+fs_getstring(struct bnode *bn, char **adesc)
 {
     struct fsbnode *abnode = (struct fsbnode *)bn;
+    const char *desc;
 
-    if (alen < 40)
-       return -1;
     if (abnode->b.goal == 1) {
        if (abnode->fileRunning) {
            if (abnode->fileSDW)
-               strcpy(abuffer, "file server shutting down");
+               desc = "file server shutting down";
            else if (abnode->scancmd) {
                if (!abnode->volRunning && !abnode->scanRunning)
-                   strcpy(abuffer,
-                          "file server up; volser and scanner down");
+                   desc = "file server up; volser and scanner down";
                else if (abnode->volRunning && !abnode->scanRunning)
-                   strcpy(abuffer,
-                          "file server up; volser up; scanner down");
+                   desc = "file server up; volser up; scanner down";
                else if (!abnode->volRunning && abnode->scanRunning)
-                   strcpy(abuffer,
-                          "file server up; volser down; scanner up");
-
+                   desc = "file server up; volser down; scanner up";
                else
-                   strcpy(abuffer, "file server running");
+                   desc = "file server running";
            } else if (!abnode->volRunning)
-               strcpy(abuffer, "file server up; volser down");
+               desc = "file server up; volser down";
            else
-               strcpy(abuffer, "file server running");
+               desc = "file server running";
        } else if (abnode->salRunning) {
-           strcpy(abuffer, "salvaging file system");
+           desc = "salvaging file system";
        } else
-           strcpy(abuffer, "starting file server");
+           desc = "starting file server";
     } else {
        /* shutting down */
        if (abnode->fileRunning || abnode->volRunning || abnode->scanRunning) {
-           strcpy(abuffer, "file server shutting down");
+           desc = "file server shutting down";
        } else if (abnode->salRunning)
-           strcpy(abuffer, "salvager shutting down");
+           desc = "salvager shutting down";
        else
-           strcpy(abuffer, "file server shut down");
+           desc = "file server shut down";
     }
+    *adesc = strdup(desc);
+    if (*adesc == NULL)
+       return BZIO;
     return 0;
 }
 
 static int
-fs_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
-          afs_int32 alen)
+fs_getparm(struct bnode *bn, afs_int32 aindex, char **aparm)
 {
     struct fsbnode *abnode = (struct fsbnode *)bn;
+    char *parm;
 
     if (aindex == 0)
-       strcpy(abuffer, abnode->filecmd);
+       parm = abnode->filecmd;
     else if (aindex == 1)
-       strcpy(abuffer, abnode->volcmd);
+       parm = abnode->volcmd;
     else if (aindex == 2)
-       strcpy(abuffer, abnode->salcmd);
+       parm = abnode->salcmd;
     else if (aindex == 3 && abnode->scancmd)
-       strcpy(abuffer, abnode->scancmd);
+       parm = abnode->scancmd;
     else
        return BZDOM;
+    *aparm = strdup(parm);
+    if (*aparm == NULL)
+       return BZIO;
     return 0;
 }
 
 static int
-dafs_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
-            afs_int32 alen)
+dafs_getparm(struct bnode *bn, afs_int32 aindex, char **aparm)
 {
     struct fsbnode *abnode = (struct fsbnode *)bn;
+    char *parm;
 
     if (aindex == 0)
-       strcpy(abuffer, abnode->filecmd);
+       parm = abnode->filecmd;
     else if (aindex == 1)
-       strcpy(abuffer, abnode->volcmd);
+       parm = abnode->volcmd;
     else if (aindex == 2)
-       strcpy(abuffer, abnode->salsrvcmd);
+       parm = abnode->salsrvcmd;
     else if (aindex == 3)
-       strcpy(abuffer, abnode->salcmd);
+       parm = abnode->salcmd;
     else if (aindex == 4 && abnode->scancmd)
-       strcpy(abuffer, abnode->scancmd);
+       parm = abnode->scancmd;
     else
        return BZDOM;
+    *aparm = strdup(parm);
+    if (*aparm == NULL)
+       return BZIO;
     return 0;
 }
index c2a9949..720faaa 100644 (file)
@@ -89,7 +89,6 @@ fileMarkSize(char *tapeDevice)
     usd_handle_t hTape;
     FILE *logFile;
     int count = 0;
-    afs_uint32 countr;
     afs_int32 code = 0;
 
     code =
@@ -118,12 +117,10 @@ fileMarkSize(char *tapeDevice)
 
     /* measure capacity of tape */
     nbfTape = 0;
-    countr = 0;
     while (1) {
        code = dataBlock(hTape, bufferSize);
        nbfTape++;
        count++;
-       countr++;
        if (code)
            break;
 
@@ -166,7 +163,6 @@ fileMarkSize(char *tapeDevice)
     nFileMarks = 0;
     nBlocks = 0;
     count = 0;
-    countr = 0;
     while (1) {
        code = dataBlock(hTape, bufferSize);
        nBlocks++;
@@ -177,7 +173,6 @@ fileMarkSize(char *tapeDevice)
        if (code)
            break;
        count++;
-       countr++;
 
        if (count >= 2) {
            count = 0;
index aef3d8b..73c3238 100644 (file)
@@ -5,3 +5,4 @@
 /backup
 /bc.h
 /bucoord_errs.c
+/btest
index b1dcca8..02da296 100644 (file)
@@ -24,7 +24,8 @@ LIBS=${TOP_LIBDIR}/libbudb.a ${TOP_LIBDIR}/libbubasics.a \
        ${TOP_LIBDIR}/libafsrfc3961.a \
        ${TOP_LIBDIR}/libafshcrypto_lwp.a
 
-all: ${TOP_LIBDIR}/libbxdb.a ${TOP_INCDIR}/afs/bucoord_prototypes.h ${TOP_INCDIR}/afs/bc.h backup
+all: ${TOP_LIBDIR}/libbxdb.a ${TOP_INCDIR}/afs/bucoord_prototypes.h \
+        ${TOP_INCDIR}/afs/bc.h backup btest
 
 generated: bucoord_errs.c bc.h
 
@@ -42,15 +43,8 @@ libbxdb.a: dsstub.o ubik_db_if.o status.o dlq.o bucoord_errs.o volstub.o AFS_com
        $(AR) crv $@ dsstub.o ubik_db_if.o status.o dlq.o bucoord_errs.o volstub.o AFS_component_version_number.o
        $(RANLIB) $@
 
-ttest: ttest.o ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a libbxdb.a
-       $(AFS_LDRULE) ttest.o libbxdb.a ${TOP_LIBDIR}/libbubasics.a \
-               ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a
-
-ttest.o: AFS_component_version_number.c
-
-btest: btest.o ${TOP_LIBDIR}/libbubasics.a ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a
-       $(AFS_LDRULE) btest.o ${TOP_LIBDIR}/libbubasics.a \
-               ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a
+btest: btest.o ${LIBS}
+       $(AFS_LDRULE) btest.o ${LIBS} $(LIB_roken) ${XLIBS}
 
 btest.o: AFS_component_version_number.c
 
@@ -89,7 +83,6 @@ main.o: bc.h
 restore.o: bc.h
 status.o: bc.h
 tape_hosts.o: bc.h
-ttest.o: bc.h
 ubik_db_if.o: bc.h
 vol_sets.o: bc.h
 volstub.o: bc.h
@@ -120,6 +113,6 @@ dest: libbxdb.a backup
 #
 
 clean:
-       $(RM) -f *.o backup convert *.ss.c *.cs.c *.xdr.c *.a core btest ttest AFS_component_version_number.c bc.h bucoord_errs.c
+       $(RM) -f *.o backup convert *.ss.c *.cs.c *.xdr.c *.a core btest AFS_component_version_number.c bc.h bucoord_errs.c
 
 include ../config/Makefile.version
index d0dfae2..d2d8529 100644 (file)
@@ -15,6 +15,7 @@
 #include <lwp.h>
 #include <rx/rx.h>
 #include <afs/bubasics.h>
+#include <afs/bumon.h>
 #include "bc.h"
 
 #include "AFS_component_version_number.c"
index 972ac2d..1ed0997 100644 (file)
@@ -351,7 +351,6 @@ doDispatch(afs_int32 targc,
     afs_int32 code, c;
     FILE *fd;
     int i;
-    int lineNumber;
     int noExecute;             /* local capy of global variable */
     char *internalLoadFile;
 
@@ -382,9 +381,7 @@ doDispatch(afs_int32 targc,
        if (noExecute)
            printf("Would have executed the following commands:\n");
 
-       lineNumber = 0;
        while (fgets(lineBuffer, sizeof(lineBuffer) - 1, fd)) { /* Get commands from file */
-           lineNumber++;
 
            i = strlen(lineBuffer) - 1;
            if (lineBuffer[i] == '\n')  /* Drop return at end of line */
diff --git a/src/bucoord/ttest.c b/src/bucoord/ttest.c
deleted file mode 100644 (file)
index 121002c..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright 2000, International Business Machines Corporation and others.
- * All Rights Reserved.
- *
- * This software has been released under the terms of the IBM Public
- * License.  For details, see the LICENSE file in the top-level source
- * directory or online at http://www.openafs.org/dl/license10.html
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-
-#include <lwp.h>
-#include <rx/rx.h>
-#include <afs/bubasics.h>
-#include <afs/butc.h>
-#include <afs/budb.h>
-
-#include "bc.h"
-
-/* dump information */
-static afs_int32 transID = 1000;       /* dump or restore transaction id */
-static afs_int32 bytesDumped = 0;
-
-#include "AFS_component_version_number.c"
-
-main(argc, argv)
-     int argc;
-     char **argv;
-{
-    int i;
-    afs_int32 code;
-    struct rx_service *tservice;
-    struct rx_securityClass *rxsc[1];
-
-    for (i = 1; i < argc; i++) {
-       /* parse args */
-       if (*argv[i] == '-') {
-           /* switch */
-       } else {
-           printf("ttest takes only switches (not '%s')\n", argv[i]);
-           exit(1);
-       }
-    }
-    code = rx_Init(htons(BC_TAPEPORT));
-    if (code) {
-       printf("ttest: could not initialize rx, code %d.\n", code);
-       exit(1);
-    }
-    rxsc[0] = rxnull_NewServerSecurityObject();
-    tservice =
-       rx_NewService(0, 1, "tape-controller", rxsc, 1, TC_ExecuteRequest);
-    rx_SetMinProcs(tservice, 3);
-    rx_SetMaxProcs(tservice, 5);
-    rx_StartServer(1);         /* don't donate this process to the rpc pool; it has work to do */
-    /* never returns */
-    printf("RETURNED FROM STARTSERVER!\n");
-    exit(1);
-}
-
-STC_LabelTape(acall)
-     struct rx_call *acall;
-{
-    printf("Got a tape labelling call.\n");
-    return 0;
-}
-
-STC_PerformDump(acall, adumpName, atapeSet, adumpArray, aparent, alevel,
-               adumpID)
-     struct rx_call *acall;
-     char *adumpName;
-     afs_int32 aparent, alevel;
-     struct tc_tapeSet *atapeSet;
-     struct tc_dumpArray *adumpArray;
-     afs_int32 *adumpID;
-{
-    int i;
-    struct tc_dumpDesc *tdescr;
-    afs_int32 code;
-    struct sockaddr_in taddr;
-    struct budb_dumpEntry tdentry;
-    struct budb_volumeEntry tventry;
-    struct budb_tapeEntry ttentry;
-    afs_int32 new;
-
-    printf("tape controller received request to start dump %s.\n", adumpName);
-    *adumpID = ++transID;      /* send result back to caller */
-
-    memset(&tdentry, 0, sizeof(tdentry));
-    tdentry.created = time(0);
-    strcpy(tdentry.name, atapeSet->format);
-    strcat(tdentry.name, ".");
-    strcat(tdentry.name, adumpName);
-    tdentry.parent = aparent;
-    tdentry.level = alevel;
-    tdentry.incTime = 0;       /* useless? */
-    tdentry.nVolumes = 1000000000;     /* bogus, but not important */
-    tdentry.tapes.a = 1;       /* a*x+b is tape numbering scheme */
-    tdentry.tapes.b = 0;
-    tdentry.tapes.maxTapes = 1000000000;       /* don't care */
-    strcpy(tdentry.tapes.format, atapeSet->format);    /* base name (e.g. sys) */
-    strcat(tdentry.tapes.format, ".");
-    strcat(tdentry.tapes.format, adumpName);   /* e.g. .daily */
-    strcat(tdentry.tapes.format, ".%d");       /* so we get basename.0, basename.1, etc */
-    code = bcdb_CreateDump(&tdentry);
-    if (code) {
-       printf("ttape: failed to create dump, code %d\n", code);
-       return code;
-    }
-    printf("created dump %d\n", tdentry.id);
-
-    /* start tape (preent all fits on one tape at first */
-    memset(&ttentry, 0, sizeof(ttentry));
-    sprintf(ttentry.name, tdentry.tapes.format, 1);
-    ttentry.written = time(0);
-    ttentry.dump = tdentry.id; /* dump we're in */
-    ttentry.seq = 0;
-    ttentry.nVolumes = 0;      /* perhaps we'll adjust during dump */
-    ttentry.flags = BUDB_TAPE_BEINGWRITTEN;    /* starting I/O */
-    code = bcdb_UseTape(&ttentry, &new);
-    if (code) {
-       printf("ttape: failed to start tape %s, code %d\n", ttentry.name,
-              code);
-       return code;
-    }
-
-    tdescr = adumpArray->tc_dumpArray_val;
-    for (i = 0; i < adumpArray->tc_dumpArray_len; i++, tdescr++) {
-       memcpy(&taddr, tdescr->hostID, sizeof(taddr));
-       printf("dumping volid %s(%d) from host %08x since date %d\n",
-              tdescr->name, tdescr->vid, taddr.sin_addr.s_addr,
-              tdescr->date);
-       memset(&tventry, 0, sizeof(tventry));
-       strcpy(tventry.name, tdescr->name);
-       tventry.clone = tdescr->date;
-       tventry.seq = 0;        /* frag in volume */
-       tventry.incTime = tdescr->date; /* date from which this is an incremental? */
-       tventry.id = tdescr->vid;
-       tventry.dump = tdentry.id;
-       strcpy(tventry.tape, ttentry.name);
-       tventry.position = i;
-       tventry.flags = (BUDB_VOL_LASTFRAG | BUDB_VOL_FIRSTFRAG);
-       code = bcdb_AddVolume(&tventry);
-       if (code) {
-           printf("failed to append volume entry for volume %d, code %d\n",
-                  tdescr->vid, code);
-           return code;
-       }
-    }
-
-    ttentry.flags = BUDB_TAPE_WRITTEN;
-    code = bcdb_FinishTape(&ttentry);
-    if (code) {
-       printf("ttape: failed to finish tape, code %d\n", code);
-       return code;
-    }
-
-    code = bcdb_FinishDump(&tdentry);
-    if (code) {
-       printf("ttest: failed to finish dump, code %d\n", code);
-       return code;
-    }
-    bytesDumped = 0;
-    return 0;
-}
-
-STC_PerformRestore(acall, aname, arestore, adumpID)
-     struct rx_call *acall;
-     char *aname;
-     struct tc_restoreArray *arestore;
-     afs_int32 *adumpID;
-{
-    int i;
-    struct tc_restoreDesc *tdescr;
-    struct sockaddr_in taddr;
-
-    printf("tape controller received request to start restore %s.\n", aname);
-    tdescr = arestore->tc_restoreArray_val;
-    for (i = 0; i < arestore->tc_restoreArray_len; i++, tdescr++) {
-       memcpy(&taddr, tdescr->hostID, sizeof(taddr));
-       printf
-           ("restoring frag %d of volume %s from tape %s at position %d.\n    New name is '%s', new vid is %d, new host is %08x, new partition is %d\n",
-            tdescr->frag, tdescr->oldName, tdescr->tapeName,
-            tdescr->position, tdescr->newName, tdescr->vid,
-            taddr.sin_addr.s_addr, tdescr->partition);
-    }
-    *adumpID = ++transID;
-    bytesDumped = 0;
-    return 0;
-}
-
-/* check the status of a dump; the tape coordinator is assumed to sit on
-    the status of completed dumps for a reasonable period (2 - 12 hours)
-    so that they can be examined later */
-STC_CheckDump(acall, adumpID, astatus)
-     struct rx_call *acall;
-     afs_int32 adumpID;
-     struct tc_dumpStat *astatus;
-{
-    if (adumpID != transID)
-       return 2;
-    astatus->dumpID = adumpID;
-    astatus->bytesDumped = (bytesDumped += 1470);
-    astatus->flags = 0;
-    if (bytesDumped > 2000)
-       astatus->flags = TC_STAT_DONE;
-    return 0;
-}
-
-STC_AbortDump(acall, adumpID)
-     struct rx_call *acall;
-     afs_int32 adumpID;
-{
-    return 0;
-}
-
-/* this call waits for a dump to complete; it ties up an LWP on the tape
-coordinator */
-STC_WaitForDump()
-{
-    return 1;
-}
-
-STC_EndDump(acall, adumpID)
-     struct rx_call *acall;
-     afs_int32 adumpID;
-{
-    return 0;
-}
-
-STC_GetTMInfo(acall)
-     struct rx_call *acall;
-{
-    return 0;
-}
index 58438fd..23752e1 100644 (file)
@@ -4,3 +4,4 @@
 
 /butc
 /read_tape
+/tdump
index fbdc49f..518819e 100644 (file)
@@ -49,15 +49,10 @@ LIBS=${TOP_LIBDIR}/libbudb.a \
        $(TOP_LIBDIR)/libopr.a \
        ${TOP_LIBDIR}/libprocmgmt.a
 
-TESTOBJS=test.o
-
 SOBJS=dbentries.o tcprocs.o lwps.o tcmain.o list.o recoverDb.o tcudbprocs.o \
        dump.o tcstatus.o
 
-all: butc read_tape
-
-butc_test: ${TESTOBJS} ${LIBS} ${INCLS} ${HACKS}
-       $(AFS_LDRULE) ${TESTOBJS} ${LIBS} $(LIB_roken) ${XLIBS}
+all: butc read_tape tdump
 
 tdump: tdump.c AFS_component_version_number.c
        $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) $(AFS_LDFLAGS) \
@@ -73,7 +68,6 @@ butc: ${SOBJS} ${LIBS} ${INCLS} ${HACKS}
 tcmain.o: tcmain.c ${INCLS} AFS_component_version_number.c
 dbentries.o: dbentries.c ${INCLS}
 tcprocs.o: tcprocs.c ${INCLS}
-test.o: test.c ${INCLS} AFS_component_version_number.c
 lwps.o: lwps.c ${INCLS}
 list.o: list.c ${INCLS}
 recoverDb.o: recoverDb.c ${INCLS}
@@ -92,7 +86,7 @@ read_tape: read_tape.c
 CFLAGS_tcudbprocs.o=@CFLAGS_NOERROR@
 
 clean:
-       $(RM) -f butc *.o butc_test core tdump read_tape AFS_component_version_number.c
+       $(RM) -f butc *.o core tdump read_tape AFS_component_version_number.c
 
 install: butc read_tape
        ${INSTALL} -d ${DESTDIR}${sbindir}
index 70b89f8..a41b6be 100644 (file)
@@ -82,13 +82,5 @@ clean::
        $(DEL) AFS_component_version_number.h
 
 
-############################################################################
-# Auxiliary build targets not built by default; e.g. test programs
-$(OUT)\butc_test.exe: $(OUT)\test.obj
-       $(EXECONLINK)
-        $(_VC_MANIFEST_EMBED_EXE)
-        $(CODESIGN_USERLAND)
-        $(SYMSTORE_IMPORT)
-
 mkdir:
 
index ef184af..ccb3103 100644 (file)
@@ -15,9 +15,7 @@
 #define BLKSIZE (4096+24)      /* actual block size on our backup tapes */
 
 afs_int32
-glong(cp, index)
-     int index;
-     char *cp;
+glong(char *cp, int index)
 {
     afs_int32 temp;
     memcpy(&temp, cp + index * 4, sizeof(afs_int32));
@@ -26,9 +24,8 @@ glong(cp, index)
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
     char tbuffer[10000];
     int fd;
diff --git a/src/butc/test.c b/src/butc/test.c
deleted file mode 100644 (file)
index 515f5bd..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Copyright 2000, International Business Machines Corporation and others.
- * All Rights Reserved.
- *
- * This software has been released under the terms of the IBM Public
- * License.  For details, see the LICENSE file in the top-level source
- * directory or online at http://www.openafs.org/dl/license10.html
- */
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-
-#ifdef AFS_AIX_ENV
-#include <sys/statfs.h>
-#endif
-
-#include <lock.h>
-#include <rx/xdr.h>
-#include <rx/rx.h>
-#include <rx/rx_globals.h>
-#include <afs/nfs.h>
-#include <afs/vlserver.h>
-#include <afs/cellconfig.h>
-#include <afs/keys.h>
-#include <ubik.h>
-#include <afs/afsint.h>
-#include <afs/cmd.h>
-#include <rx/rxkad.h>
-#include <afs/tcdata.h>
-
-#define SERVERNAME "server1"
-
-afs_int32 code = 0;
-struct tc_tapeSet ttapeSet;
-char tdumpSetName[TC_MAXNAMELEN];
-tc_dumpArray tdumps;           /*defined by rxgen */
-tc_restoreArray trestores;     /*defined by rxgen */
-afs_int32 tdumpID;
-struct tc_dumpStat tstatus;
-int rxInitDone = 0;
-
-struct rx_connection *
-UV_Bind(aserver, port)
-     afs_uint32 aserver;
-     afs_int32 port;
-{
-    struct rx_connection *tc;
-    struct rx_securityClass *uvclass;
-
-    uvclass = rxnull_NewClientSecurityObject();
-    tc = rx_NewConnection(aserver, htons(port), TCSERVICE_ID, uvclass, 0);
-    return tc;
-}
-
-
-/* return host address in network byte order */
-afs_uint32
-GetServer(aname)
-     char *aname;
-{
-    struct hostent *th;
-    afs_uint32 addr;
-    char b1, b2, b3, b4;
-    afs_int32 code;
-
-    code = sscanf(aname, "%d.%d.%d.%d", &b1, &b2, &b3, &b4);
-    if (code == 4) {
-       addr = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
-       return htonl(addr);     /* convert to network order (128 in byte 0) */
-    }
-    th = gethostbyname(aname);
-    if (!th)
-       return 0;
-    memcpy(&addr, th->h_addr, sizeof(addr));
-    return addr;
-}
-
-
-static int
-PerformDump(struct cmd_syndesc *as, void *arock)
-{
-    struct rx_connection *aconn;
-    afs_uint32 server;
-    FILE *fopen(), *fp;
-    struct tc_dumpDesc *ptr;
-    int i;
-    afs_int32 parentDumpID, dumpLevel;
-
-    server = GetServer(SERVERNAME);
-    if (!server) {
-       printf("cant get server id \n");
-       exit(1);
-    }
-    parentDumpID = 1;
-    dumpLevel = 1;
-    strcpy(tdumpSetName, "Test");
-    ttapeSet.id = 1;
-    ttapeSet.maxTapes = 10;
-    fp = fopen("dumpScr", "r");
-    fscanf(fp, "%u %u %u\n", &tdumps.tc_dumpArray_len, &ttapeSet.a,
-          &ttapeSet.b);
-    strcpy(ttapeSet.format, "tapeName%u");
-    strcpy(ttapeSet.tapeServer, "diskTapes");
-    tdumps.tc_dumpArray_val =
-       malloc(tdumps.tc_dumpArray_len * sizeof(struct tc_dumpDesc));
-    ptr = tdumps.tc_dumpArray_val;
-    for (i = 0; i < tdumps.tc_dumpArray_len; i++) {
-       fscanf(fp, "%s\n", ptr->name);
-       fscanf(fp, "%s\n", ptr->hostAddr);
-       fscanf(fp, "%u %u %u\n", &ptr->vid, &ptr->partition, &ptr->date);
-       ptr++;
-    }
-
-    aconn = UV_Bind(server, TCPORT);
-    code =
-       TC_PerformDump(aconn, tdumpSetName, &ttapeSet, &tdumps, parentDumpID,
-                      dumpLevel, &tdumpID);
-    free(tdumps.tc_dumpArray_val);
-    if (code) {
-       printf("call to TC_PerformDump failed %u\n", code);
-       exit(1);
-    }
-    printf("dumpid returned %u\n", tdumpID);
-
-    return 0;
-}
-
-static int
-PerformRestore(struct cmd_syndesc *as, void *arock)
-{
-    struct rx_connection *aconn;
-    afs_uint32 server;
-    int i;
-    FILE *fopen(), *fp;
-    struct tc_restoreDesc *ptr;
-
-    server = GetServer(SERVERNAME);
-    if (!server) {
-       printf("cant get server id \n");
-       exit(1);
-    }
-    aconn = UV_Bind(server, TCPORT);
-    strcpy(tdumpSetName, "");
-    strcpy(tdumpSetName, "Test");
-    fp = fopen("restoreScr", "r");
-    fscanf(fp, "%u\n", &trestores.tc_restoreArray_len);
-    trestores.tc_restoreArray_val
-       = malloc(trestores.tc_restoreArray_len *
-                sizeof(struct tc_restoreDesc));
-    ptr = trestores.tc_restoreArray_val;
-    for (i = 0; i < trestores.tc_restoreArray_len; i++) {
-       fscanf(fp, "%s\n", ptr->oldName);
-       fscanf(fp, "%s\n", ptr->newName);
-       fscanf(fp, "%s\n", ptr->tapeName);
-       fscanf(fp, "%s\n", ptr->hostAddr);
-       fscanf(fp, "%u %u %u %u %d %u\n", &ptr->origVid, &ptr->vid,
-              &ptr->partition, &ptr->flags, &ptr->frag, &ptr->position);
-       ptr++;
-
-    }
-    code = TC_PerformRestore(aconn, tdumpSetName, &trestores, &tdumpID);
-    if (code) {
-       printf("call to TC_PerformRestore failed %u\n", code);
-       exit(1);
-    }
-    printf("dumpid returned %u\n", tdumpID);
-    return 0;
-}
-
-static int
-CheckDump(struct cmd_syndesc *as, void *arock)
-{
-    struct rx_connection *aconn;
-    afs_uint32 server;
-    server = GetServer(SERVERNAME);
-    if (!server) {
-       printf("cant get server id \n");
-       exit(1);
-    }
-    tdumpID = atol(as->parms[0].items->data);
-    aconn = UV_Bind(server, TCPORT);
-    code = TC_CheckDump(aconn, tdumpID, &tstatus);
-    if (code) {
-       printf("call to TC_CheckDump failed %u\n", code);
-       exit(1);
-    }
-    return 0;
-}
-
-static int
-AbortDump(struct cmd_syndesc *as, void *arock)
-{
-    struct rx_connection *aconn;
-    afs_uint32 server;
-    server = GetServer(SERVERNAME);
-    if (!server) {
-       printf("cant get server id \n");
-       exit(1);
-    }
-    tdumpID = atol(as->parms[0].items->data);
-    aconn = UV_Bind(server, TCPORT);
-    code = TC_AbortDump(aconn, tdumpID);
-    if (code) {
-       printf("call to TC_AbortDump failed %u\n", code);
-       exit(1);
-    }
-    return 0;
-}
-
-static int
-WaitForDump(struct cmd_syndesc *as, void *arock)
-{
-    struct rx_connection *aconn;
-    afs_uint32 server;
-    server = GetServer(SERVERNAME);
-    if (!server) {
-       printf("cant get server id \n");
-       exit(1);
-    }
-    tdumpID = atol(as->parms[0].items->data);
-    aconn = UV_Bind(server, TCPORT);
-    code = TC_WaitForDump(aconn, tdumpID);
-    if (code) {
-       printf("call to TC_WaitForDump failed %u\n", code);
-       exit(1);
-    }
-    return 0;
-}
-
-static int
-EndDump(struct cmd_syndesc *as, void *arock)
-{
-    struct rx_connection *aconn;
-    afs_uint32 server;
-    server = GetServer(SERVERNAME);
-    if (!server) {
-       printf("cant get server id \n");
-       exit(1);
-    }
-    tdumpID = atol(as->parms[0].items->data);
-    aconn = UV_Bind(server, TCPORT);
-    code = TC_EndDump(aconn, tdumpID);
-    if (code) {
-       printf("call to TC_EndDump failed %u\n", code);
-       exit(1);
-    }
-    return 0;
-}
-
-static int
-MyBeforeProc(struct cmd_syndesc *as, void *arock)
-{
-    afs_int32 code;
-
-    code = rx_Init(0);
-    if (code) {
-       printf("Could not initialize rx.\n");
-       return code;
-    }
-    rxInitDone = 1;
-    rx_SetRxDeadTime(50);
-    return 0;
-}
-
-#include "AFS_component_version_number.c"
-
-main(argc, argv)
-     int argc;
-     char **argv;
-{
-    afs_int32 code;
-
-    struct cmd_syndesc *ts;
-
-#ifdef AFS_AIX32_ENV
-    /*
-     * The following signal action for AIX is necessary so that in case of a
-     * crash (i.e. core is generated) we can include the user's data section
-     * in the core dump. Unfortunately, by default, only a partial core is
-     * generated which, in many cases, isn't too useful.
-     */
-    struct sigaction nsa;
-
-    sigemptyset(&nsa.sa_mask);
-    nsa.sa_handler = SIG_DFL;
-    nsa.sa_flags = SA_FULLDUMP;
-    sigaction(SIGABRT, &nsa, NULL);
-    sigaction(SIGSEGV, &nsa, NULL);
-#endif
-    cmd_SetBeforeProc(MyBeforeProc, NULL);
-
-    ts = cmd_CreateSyntax("dump", PerformDump, NULL, 0, "perform a dump");
-
-    ts = cmd_CreateSyntax("restore", PerformRestore, NULL, 0, "perform a restore");
-
-    ts = cmd_CreateSyntax("check", CheckDump, NULL, 0, "check a dump");
-    cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "dump id");
-
-    ts = cmd_CreateSyntax("abort", AbortDump, NULL, 0, "abort a dump");
-    cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "dump id");
-
-    ts = cmd_CreateSyntax("wait", WaitForDump, NULL, 0, "wait for a dump");
-    cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "dump id");
-
-    ts = cmd_CreateSyntax("end", EndDump, NULL, 0, "end a dump");
-    cmd_AddParm(ts, "-id", CMD_SINGLE, 0, "dump id");
-
-    code = cmd_Dispatch(argc, argv);
-    if (rxInitDone)
-       rx_Finalize();
-    exit(code);
-}
diff --git a/src/butm/.gitignore b/src/butm/.gitignore
new file mode 100644 (file)
index 0000000..c048339
--- /dev/null
@@ -0,0 +1,6 @@
+# After changing this file, please run
+#     git ls-files -i --exclude-standard
+# to check that you haven't inadvertently ignored any tracked files.
+
+/test_ftm
+/butm_test
index be04ebf..469341f 100644 (file)
@@ -19,9 +19,11 @@ LIBS=${TOP_LIBDIR}/libbubasics.a \
        ${TOP_LIBDIR}/libbutm.a \
        ${TOP_LIBDIR}/libafscom_err.a \
        ${TOP_LIBDIR}/util.a \
+       $(TOP_LIBDIR)/libopr.a \
        ${XLIBS}
 
-all: ${TOP_LIBDIR}/libbutm.a ${TOP_INCDIR}/afs/butm_prototypes.h
+all: ${TOP_LIBDIR}/libbutm.a ${TOP_INCDIR}/afs/butm_prototypes.h \
+        test_ftm butm_test
 
 ${TOP_LIBDIR}/libbutm.a: libbutm.a
        ${INSTALL_DATA} $? $@
@@ -39,11 +41,16 @@ file_tm.o: file_tm.c ${INCLS} AFS_component_version_number.c
 test_ftm.o: test_ftm.c ${INCLS} AFS_component_version_number.c
 
 test_ftm: test_ftm.o libbutm.a
-       $(AFS_LDRULE) test_ftm.o libbutm.a ${LIBS}
+       $(AFS_LDRULE) test_ftm.o libbutm.a ${LIBS} $(LIB_roken)
 
 test: test_ftm
        echo 'Usage: ./test_ftm -conf config -tape xxx *'
 
+butm_test.o: butm_test.c ${INCLS} AFS_component_version_number.c
+
+butm_test: butm_test.o libbutm.a
+       $(AFS_LDRULE) butm_test.o libbutm.a ${LIBS} $(LIB_roken)
+
 install: libbutm.a
        ${INSTALL} -d ${DESTDIR}${libdir}/afs
        ${INSTALL_DATA} libbutm.a ${DESTDIR}${libdir}/afs/libbutm.a
@@ -53,6 +60,6 @@ dest: libbutm.a
        ${INSTALL_DATA} libbutm.a ${DEST}/lib/afs/libbutm.a
 
 clean:
-       $(RM) -f *.o *.a core test_ftm AFS_component_version_number.c
+       $(RM) -f *.o *.a core test_ftm butm_test AFS_component_version_number.c
 
 include ../config/Makefile.version
index 001faf4..bd13d1b 100644 (file)
 #include <afs/com_err.h>
 #include <lwp.h>
 #include <afs/butm.h>
+#include "butm_prototypes.h"
 #include "AFS_component_version_number.c"
 
 
+int isafile = 0;
+int debugLevel = 1;
 
 static char *whoami = "TEST FAIL";
 
-#define NULL (char *)0
 #define PASS(str, err) printf("TEST: %s\n", str); \
                        if (code != err) \
                        { \
-                          printf("FAILURE: expected %u; got %u\n", err, code); \
-                          if (code) afs_com_err(whoami, code, ""); \
+                          printf("FAILURE: expected %lu; got %lu\n", err, code); \
+                          if (code) afs_com_err(whoami, code, "Failed test %s", str); \
                       } \
-                       else printf("PASSED; got %u\n", err); \
+                       else printf("PASSED; got %lu\n", err); \
                        printf("\n");
 
 #define PASSq(str, err) if (code != err) \
                         { \
                           printf("TEST: %s\n", str); \
-                           printf("FAILURE: expected %u; got %u\n", err, code); \
-                           if (code) afs_com_err(whoami, code, ""); \
+                           printf("FAILURE: expected %lu; got %lu\n", err, code); \
+                           if (code) afs_com_err(whoami, code, "Failed test %s", str); \
                           printf("\n"); \
                        }
 #define NOREWIND 0
 #define REWIND   1
 
-char tapeBlock[16384];
+extern char tapeBlock[];
 char *dataBlock;
 long dataSize;
 
-main(argc, argv)
-     int argc;
-     char *argv[];
+int
+main(int argc, char *argv[])
 {
-    char *config = 0;
-    char *tape = "testtape.0";
     long code;
-    char **files;
-    int nFiles;
-    int i;
-    int past;
+    int nBytes = 0;
+    PROCESS parent_pid;
 
     struct butm_tapeInfo tapeInfo;
     struct tapeConfig tapeConfig;
 
-    struct butm_tapeLabel tapeLabelWrite, tapeLabelRead;
-
     /* -------------
      * General Setup
      * ------------- */
@@ -73,173 +68,24 @@ main(argc, argv)
     tapeConfig.capacity = 100;
     tapeConfig.fileMarkSize = 16384;
     tapeConfig.portOffset = 0;
-    tapeConfig.aixScsi = 0;
 
-    goto start;
+    code = LWP_InitializeProcessSupport(1, &parent_pid);
+    if (code) {
+       afs_com_err(whoami, code, "Can't init LWP lib");
+       exit(1);
+    }
+    code = IOMGR_Initialize();
+    if (code) {
+       afs_com_err(whoami, code, "Can't init LWP IOMGR lib");
+       exit(1);
+    }
 
     /* ------------- */
     /* START TESTING */
     /* ------------- */
 
-    /* butm_file_Instantiate tests */
-    /* --------------------------- */
-    code = butm_file_Instantiate(NULL, &tapeConfig);
-    PASS("Bad info paramater", BUTM_BADARGUMENT)
-
-       code = butm_file_Instantiate(&tapeInfo, NULL);
-    PASS("Bad config parameter", BUTM_BADCONFIG);
-
-    tapeInfo.structVersion = 0;
-    code = butm_file_Instantiate(&tapeInfo, &tapeConfig);
-    PASS("Bad version number", BUTM_OLDINTERFACE);
-    tapeInfo.structVersion = BUTM_MAJORVERSION;
-
-    tapeConfig.capacity = 0;
-    code = butm_file_Instantiate(&tapeInfo, &tapeConfig);
-    PASS("zero capacity tape", BUTM_BADCONFIG);
-    tapeConfig.capacity = 100;
-
-    tapeConfig.fileMarkSize = 0;
     code = butm_file_Instantiate(&tapeInfo, &tapeConfig);
-    PASS("zero length filemark", BUTM_BADCONFIG);
-    tapeConfig.fileMarkSize = 16384;
-
-    strcpy(tapeConfig.device, "");
-    code = butm_file_Instantiate(&tapeInfo, &tapeConfig);
-    PASS("no tape device name", BUTM_BADCONFIG);
-    strcpy(tapeConfig.device, "/dev/rmt0");
-
-    /* file_Mount and file_Dismount tests */
-    /* ---------------------------------- */
-
-    strcpy(tapeConfig.device, "/dev/Bogus");
-    code = butm_file_Instantiate(&tapeInfo, &tapeConfig);
-    PASSq("file Instantiate", 0);
-    strcpy(tapeConfig.device, "/dev/rmt0");
-
-    code = tapeInfo.ops.mount(NULL, "TAPE_NAME");
-    PASS("Null tapeInfo ptr for mount", BUTM_BADARGUMENT);
-
-    code = tapeInfo.ops.dismount(NULL);
-    PASS("Null info ptr for dismount", BUTM_BADARGUMENT);
-
-    /* --------- */
-
-    code = tapeInfo.ops.mount(&tapeInfo, NULL);
-    PASS("NULL virtual tape name", BUTM_BADARGUMENT);
-
-    code = tapeInfo.ops.mount(&tapeInfo, "-MORE_THAN_THIRTY_TWO_CHARACTERS-");
-    PASS(">32 character tape name", BUTM_BADARGUMENT);
-
-    code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME");
-    PASS("Bogus tape name", BUTM_MOUNTFAIL);
-
-    /* --------- */
-
-    code = butm_file_Instantiate(&tapeInfo, &tapeConfig);
-    PASSq("file Instantiate", 0);
-
-    code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME");
-    PASS("Open tape drive", 0);
-
-    code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME");
-    PASS("Open tape drive 2nd time", BUTM_PARALLELMOUNTS);
-
-    code = tapeInfo.ops.dismount(&tapeInfo);
-    PASSq("Unmount the tape drive", 0);
-
-    code = tapeInfo.ops.dismount(&tapeInfo);
-    PASS("Unmount the tape drive which is not mounted", 0);
-
-    /* file_writeLabel and file_readLabel tests */
-    /* ---------------------------------------- */
-
-    code = butm_file_Instantiate(&tapeInfo, &tapeConfig);
-    PASSq("file Instantiate", 0);
-
-    code = tapeInfo.ops.create(NULL, &tapeLabelWrite, REWIND);
-    PASS("NULL info to Write label", BUTM_BADARGUMENT);
-
-    code = tapeInfo.ops.readLabel(NULL, &tapeLabelWrite, REWIND);
-    PASS("NULL info to Read Label", BUTM_BADARGUMENT);
-
-    /* ---------- */
-
-    code = tapeInfo.ops.create(&tapeInfo, &tapeLabelWrite, REWIND);
-    PASS("Write label to unmounted tape", BUTM_NOMOUNT);
-
-    code = tapeInfo.ops.readLabel(&tapeInfo, &tapeLabelRead, REWIND);
-    PASS("Read label of unmounted tape", BUTM_NOMOUNT);
-
-    /* ---------- */
-
-    code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME");
-    PASSq("Mount tape", 0);
-
-    memset(tapeLabelWrite, 0, sizeof(tapeLabelWrite));
-    tapeLabelWrite.structVersion = CUR_TAPE_VERSION;
-    tapeLabelWrite.creationTime = time(0);
-    tapeLabelWrite.expirationDate = time(0);
-    strcpy(tapeLabelWrite.name, "TAPE_LABEL_NAME");
-    /* tapeLabelWrite.creator. */
-    strcpy(tapeLabelWrite.cell, "CELLNAME");
-    tapeLabelWrite.dumpid = 999;
-    tapeLabelWrite.useCount = 8888;
-    strcpy(tapeLabelWrite.comment, "THIS IS THE COMMENT FIELD");
-    tapeLabelWrite.size = 77777;
-    strcpy(tapeLabelWrite.dumpPath, "/FULL/WEEK3/DAY4/HOUR7");
-
-    code = tapeInfo.ops.create(&tapeInfo, &tapeLabelWrite, REWIND);
-    PASS("Write a label", 0);
-
-    code = tapeInfo.ops.readLabel(&tapeInfo, &tapeLabelRead, REWIND);
-    PASS("Read a label", 0);
-
-    if (memcmp(&tapeLabelWrite, &tapeLabelRead, sizeof(tapeLabelWrite)))
-       printf("FAILURE: Label Read is not same as label Written\n");
-    else
-       printf("PASSED: Label Read is same as label Written\n");
-
-    code = tapeInfo.ops.dismount(&tapeInfo);
-    PASSq("Unmount the tape drive", 0);
-
-    /* ---------- */
-
-    code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME");
-    PASSq("Mount tape", 0);
-
-    code = tapeInfo.ops.create(&tapeInfo, NULL, REWIND);
-    PASS("Write a NULL label", BUTM_BADARGUMENT);
-
-    tapeLabelWrite.structVersion = 0;
-    code = tapeInfo.ops.create(&tapeInfo, &tapeLabelWrite, REWIND);
-    PASS("Write label with bad version in it", BUTM_OLDINTERFACE);
-    tapeLabelWrite.structVersion = CUR_TAPE_VERSION;
-
-    code = tapeInfo.ops.dismount(&tapeInfo);
-    PASSq("Unmount the tape drive", 0);
-
-    /* file_WriteFileBegin and file_ReadFileBegin tests */
-    /* file_WriteFileEnd   and file_ReadFileEnd   tests */
-    /* ------------------------------------------------ */
-
-  start:
-    code = butm_file_Instantiate(&tapeInfo, &tapeConfig);
-    PASSq("file Instantiate", 0);
-
-    code = tapeInfo.ops.writeFileBegin(NULL);
-    PASS("Null info ptr for writeFileBegin", BUTM_BADARGUMENT);
-
-    code = tapeInfo.ops.readFileBegin(NULL);
-    PASS("Null info ptr for readFileBegin", BUTM_BADARGUMENT);
-
-    code = tapeInfo.ops.writeFileEnd(NULL);
-    PASS("Null info ptr for writeFileEnd", BUTM_BADARGUMENT);
-
-    code = tapeInfo.ops.readFileEnd(NULL);
-    PASS("Null info ptr for readFileEnd", BUTM_BADARGUMENT);
-
-    /* ---------- */
+    PASSq("file Instantiate", 0L);
 
     code = tapeInfo.ops.writeFileBegin(&tapeInfo);
     PASS("Tape not mounted for writeFileBegin", BUTM_NOMOUNT);
@@ -256,7 +102,7 @@ main(argc, argv)
     /* ---------- */
 
     code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME");
-    PASSq("Mount tape", 0);
+    PASSq("Mount tape", 0L);
 
     code = tapeInfo.ops.writeFileEnd(&tapeInfo);
     PASS("Write a fileEnd as first entry on tape", BUTM_BADOP);
@@ -265,35 +111,35 @@ main(argc, argv)
     PASS("Read a fileEnd as first entry on tape", BUTM_BADOP);
 
     code = tapeInfo.ops.dismount(&tapeInfo);
-    PASSq("Unmount the tape drive", 0);
+    PASSq("Unmount the tape drive", 0L);
 
     /* ---------- */
 
     code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME");
-    PASSq("Mount tape", 0);
+    PASSq("Mount tape", 0L);
 
     code = tapeInfo.ops.writeFileBegin(&tapeInfo);
-    PASS("Write a fileBegin", 0);
+    PASS("Write a fileBegin", 0L);
 
     code = tapeInfo.ops.writeFileEnd(&tapeInfo);
-    PASS("Write a fileEnd", 0);
+    PASS("Write a fileEnd", 0L);
 
     code = tapeInfo.ops.dismount(&tapeInfo);
-    PASSq("Unmount the tape drive", 0);
+    PASSq("Unmount the tape drive", 0L);
 
     /* ---------- */
 
     code = tapeInfo.ops.mount(&tapeInfo, "TAPE_NAME");
-    PASSq("Mount tape", 0);
+    PASSq("Mount tape", 0L);
 
     code = tapeInfo.ops.readFileBegin(&tapeInfo);
-    PASS("Read a fileBegin", 0);
+    PASS("Read a fileBegin", 0L);
 
     code = tapeInfo.ops.readFileEnd(&tapeInfo);
-    PASS("Read a fileEnd", 0);
+    PASS("Read a fileEnd", 0L);
 
     code = tapeInfo.ops.dismount(&tapeInfo);
-    PASSq("Unmount the tape drive", 0);
+    PASSq("Unmount the tape drive", 0L);
 
     /* file_WriteFileData and file_ReadFileData tests */
     /* ---------------------------------------------- */
@@ -303,37 +149,31 @@ main(argc, argv)
 
 
     code = butm_file_Instantiate(&tapeInfo, &tapeConfig);
-    PASSq("file Instantiate", 0);
-
-    code = tapeInfo.ops.writeFileData(NULL, dataBlock, dataSize);
-    PASS("Null info ptr for writeFileData", BUTM_BADARGUMENT);
-
-    code = tapeInfo.ops.readFileData(NULL, dataBlock, dataSize, nBytes);
-    PASS("Null info ptr for readFileData", BUTM_BADARGUMENT);
+    PASSq("file Instantiate", 0L);
 
     /* ---------- */
 
-    code = tapeInfo.ops.writeFileData(&tapeInfo, NULL, dataSize);
+    code = tapeInfo.ops.writeFileData(&tapeInfo, NULL, dataSize, 0);
     PASS("Null data ptr for writeFileData", BUTM_BADARGUMENT);
 
-    code = tapeInfo.ops.readFileData(&tapeInfo, NULL, dataSize, nBytes);
+    code = tapeInfo.ops.readFileData(&tapeInfo, NULL, dataSize, &nBytes);
     PASS("Null data ptr for readFileData", BUTM_BADARGUMENT);
 
     /* ---------- */
 
-    code = tapeInfo.ops.writeFileData(&tapeInfo, dataBlock, -1);
+    code = tapeInfo.ops.writeFileData(&tapeInfo, dataBlock, -1, 0);
     PASS("Neg. data size for writeFileData", BUTM_BADARGUMENT);
 
-    code = tapeInfo.ops.readFileData(&tapeInfo, dataBlock, -1, nBytes);
+    code = tapeInfo.ops.readFileData(&tapeInfo, dataBlock, -1, &nBytes);
     PASS("Neg. data size for readFileData", BUTM_BADARGUMENT);
 
     /* ---------- */
 
-    code = tapeInfo.ops.writeFileData(&tapeInfo, dataBlock, dataSize + 1);
+    code = tapeInfo.ops.writeFileData(&tapeInfo, dataBlock, dataSize + 1, 0);
     PASS("Large data size for writeFileData", BUTM_BADARGUMENT);
 
     code =
-       tapeInfo.ops.readFileData(&tapeInfo, dataBlock, dataSize + 1, nBytes);
+       tapeInfo.ops.readFileData(&tapeInfo, dataBlock, dataSize + 1, &nBytes);
     PASS("Large data size for readFileData", BUTM_BADARGUMENT);
 
     /* ---------- */
@@ -343,11 +183,11 @@ main(argc, argv)
 
     /* ---------- */
 
-    code = tapeInfo.ops.writeFileData(&tapeInfo, dataBlock, dataSize);
+    code = tapeInfo.ops.writeFileData(&tapeInfo, dataBlock, dataSize, 0);
     PASS("First write for WriteFileData", BUTM_BADOP);
 
-    code = tapeInfo.ops.readFileData(&tapeInfo, dataBlock, dataSize, nBytes);
+    code = tapeInfo.ops.readFileData(&tapeInfo, dataBlock, dataSize, &nBytes);
     PASS("First read for readFileData", BUTM_BADOP);
 
-  end:return;
+    return 0;
 }
index 9daa1d6..3a3884a 100644 (file)
@@ -21,6 +21,7 @@
 #include <afs/butm.h>
 
 #include "error_macros.h"
+#include "butm_prototypes.h"
 
 int isafile = 0, debugLevel = 1;
 
@@ -56,12 +57,10 @@ struct BufferBlock {
 
 struct tapeConfig confInfo;
 char dumpDone;
-int PerformDumpTest(TestInfo * tip);
+void *PerformDumpTest(void *rock);
 
-static
-GetDeviceInfo(filename, config)
-     char *filename;
-     struct tapeConfig *config;
+static int
+GetDeviceInfo(char *filename, struct tapeConfig *config)
 {
     FILE *devFile;
     char line[356];
@@ -95,12 +94,13 @@ GetDeviceInfo(filename, config)
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char *argv[];
+int
+main(int argc, char *argv[])
 {
     char *config = 0;
-    char *tape = "testtape.0", *parent_pid, *pid;
+    char *tape = "testtape.0";
+    PROCESS parent_pid;
+    PROCESS pid;
     afs_int32 code;
     char **files;
     int nFiles, i;
@@ -192,9 +192,6 @@ main(argc, argv)
        LWP_DestroyProcess(pid);
     }
 
-    IOMGR_Finalize();
-    LWP_TerminateProcessSupport();
-
     exit(code);
 
   usage:
@@ -205,9 +202,10 @@ main(argc, argv)
 }
 
 
-int
-PerformDumpTest(TestInfo * tip)
+void *
+PerformDumpTest(void *rock)
 {                              /* Dump Files into target tape/file */
+    TestInfo *tip = rock;
     struct butm_tapeInfo info;
     struct butm_tapeLabel label;
     int i, past, code;
@@ -216,7 +214,7 @@ PerformDumpTest(TestInfo * tip)
     bufferBlock = malloc(sizeof(struct BufferBlock));
 
     info.structVersion = BUTM_MAJORVERSION;
-    if (code = butm_file_Instantiate(&info, tip->tc_Infop)) {
+    if ((code = butm_file_Instantiate(&info, tip->tc_Infop))) {
        afs_com_err(whoami, code, "instantiating file tape");
        ERROR_EXIT(2);
     }
@@ -239,7 +237,7 @@ PerformDumpTest(TestInfo * tip)
     strcpy(label.cell, T_REALM);
     strcpy(label.comment, T_COMMENT);
 
-    if (code = butm_Mount(&info, tip->tapeName)) {
+    if ((code = butm_Mount(&info, tip->tapeName))) {
        afs_com_err(whoami, code, "setting up tape");
        ERROR_EXIT(2);
     }
@@ -264,12 +262,12 @@ PerformDumpTest(TestInfo * tip)
            afs_com_err(whoami, errno, "opening file to write on tape");
            ERROR_EXIT(3);
        }
-       if (code = butm_WriteFileBegin(&info)) {
+       if ((code = butm_WriteFileBegin(&info))) {
            afs_com_err(whoami, code, "beginning butm write file");
            ERROR_EXIT(3);
        }
        while ((len = read(fid, bufferBlock->data, BUTM_BLKSIZE)) > 0) {
-           if (code = butm_WriteFileData(&info, bufferBlock->data, 1, len)) {
+           if ((code = butm_WriteFileData(&info, bufferBlock->data, 1, len))) {
                afs_com_err(whoami, code, "butm writing file data");
                ERROR_EXIT(3);
            }
@@ -278,7 +276,7 @@ PerformDumpTest(TestInfo * tip)
            afs_com_err(whoami, errno, "reading file data");
            ERROR_EXIT(3);
        }
-       if (code = butm_WriteFileEnd(&info)) {
+       if ((code = butm_WriteFileEnd(&info))) {
            afs_com_err(whoami, code, "ending butm write file");
            ERROR_EXIT(3);
        }
@@ -295,7 +293,7 @@ PerformDumpTest(TestInfo * tip)
     /* now read the tape back in and make sure everything is OK */
 
     label.structVersion = BUTM_MAJORVERSION;
-    if (code = butm_Mount(&info, tip->tapeName)) {
+    if ((code = butm_Mount(&info, tip->tapeName))) {
        afs_com_err(whoami, code, "setting up tape");
        ERROR_EXIT(5);
     }
@@ -307,7 +305,7 @@ PerformDumpTest(TestInfo * tip)
            ERROR_EXIT(code);
        }
     }
-    if (code = butm_ReadLabel(&info, &label, !tip->appended /*rewind */ )) {
+    if ((code = butm_ReadLabel(&info, &label, !tip->appended /*rewind */ ))) {
        afs_com_err(whoami, code, "reading tape label");
        ERROR_EXIT(5);
     }
@@ -352,7 +350,7 @@ PerformDumpTest(TestInfo * tip)
                    i + 1);
            ERROR_EXIT(6);
        }
-       if (code = butm_ReadFileBegin(&info)) {
+       if ((code = butm_ReadFileBegin(&info))) {
            afs_com_err(whoami, code, "Beginning butm %dth read file", i + 1);
            ERROR_EXIT(6);
        }
@@ -390,7 +388,7 @@ PerformDumpTest(TestInfo * tip)
                break;
        }
 
-       if (code = butm_ReadFileEnd(&info)) {
+       if ((code = butm_ReadFileEnd(&info))) {
            afs_com_err(whoami, code, "Ending butm %dth read file", i + 1);
            ERROR_EXIT(7);
        }
@@ -407,7 +405,7 @@ PerformDumpTest(TestInfo * tip)
            ERROR_EXIT(8);
        }
     }
-    if (code = butm_Dismount(&info)) {
+    if ((code = butm_Dismount(&info))) {
        afs_com_err(whoami, code, "Finishing up tape");
        ERROR_EXIT(8);
     }
@@ -419,5 +417,5 @@ PerformDumpTest(TestInfo * tip)
     ERROR_EXIT(0);
   error_exit:
     LWP_SignalProcess(&tip->dumpDone);
-    return (code);
+    return (void *)(intptr_t)code;
 }
diff --git a/src/cf/c-flexible-array.m4 b/src/cf/c-flexible-array.m4
new file mode 100644 (file)
index 0000000..e281166
--- /dev/null
@@ -0,0 +1,16 @@
+AC_DEFUN([OPENAFS_C_FLEXIBLE_ARRAY],[
+  dnl Check to see if the compiler support C99 flexible arrays, e.g., var[]
+  AC_MSG_CHECKING([for C99 flexible arrays])
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+      struct flexarraytest {
+          int flag;
+          int numbers[];
+      };
+      ]], [[]])
+    ],
+    [AC_MSG_RESULT([yes])
+     AC_DEFINE([HAVE_FLEXIBLE_ARRAY], [1],
+       [Define to 1 if your compiler supports C99 flexible arrays.])
+    ],[AC_MSG_RESULT([no])]
+  )
+])
index 4c8e97b..2ea0c87 100644 (file)
@@ -6,7 +6,6 @@ if test "x$with_crosstools_dir" != "x"; then
         RXGEN_PATH=$with_crosstools_dir/rxgen
     else
         AC_MSG_ERROR(Tools not found in $with_crosstools_dir)
-        exit 1
     fi
 else
     COMPILE_ET_PATH="${SRCDIR_PARENT}/src/comerr/compile_et"
index 24c6535..1691845 100644 (file)
@@ -19,7 +19,11 @@ AC_DEFUN([OPENAFS_CURSES_LIB],
     AC_CHECK_LIB([ncurses], [initscr],
                 [AC_CHECK_LIB([ncurses], [LINES], [openafs_cv_curses_lib=-lncurses],
                               [AC_CHECK_LIB([tinfo], [LINES],
-                                            [openafs_cv_curses_lib="-lncurses -ltinfo"])])])
+                                            [openafs_cv_curses_lib="-lncurses -ltinfo"],
+                                            [AC_CHECK_LIB([ncurses], [_nc_LINES],
+                                                          [openafs_cv_curses_lib=-lncurses],
+                                                          [AC_CHECK_LIB([tinfo], [_nc_LINES],
+                                                                        [openafs_cv_curses_lib="-lncurses -ltinfo"])])])])])
     AS_IF([test "x$openafs_cv_curses_lib" = x],
          [AC_CHECK_LIB([Hcurses], [initscr], [openafs_cv_curses_lib=-lHcurses])])
     AS_IF([test "x$openafs_cv_curses_lib" = x],
diff --git a/src/cf/gcc.m4 b/src/cf/gcc.m4
new file mode 100644 (file)
index 0000000..bcd30ac
--- /dev/null
@@ -0,0 +1,51 @@
+dnl Checks for specific gcc behavior
+
+dnl Helper to test for UAF warning message
+dnl _OPENAFS_UAF_COMPILE_IFELSE([success], [fail])
+AC_DEFUN([_OPENAFS_UAF_COMPILE_IFELSE],[
+    AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+               #include <stdlib.h>
+               struct gcc_check {
+                   char *ptr;
+               };
+               void test(struct gcc_check *p, char *cp, int size)
+               {
+                   p->ptr = realloc(cp, size);
+                   if (p->ptr == NULL && size != 0) {
+                       free(cp);       /* If compiler has UAF bug this will be flagged */
+                   }
+               }
+           ]]
+       )],
+       [$1],
+       [$2]
+    )
+])
+
+dnl Check to see if the GCC compiler incorrectly flags use-after-free (UAF).
+dnl This false positive has been observed with gcc 12 when
+dnl optimization is disabled (-O0) and gcc 13.
+AC_DEFUN([OPENAFS_GCC_UAF_BUG_CHECK],[
+    CFLAGS_USE_AFTER_FREE_GCCBUG=
+    AS_IF([test "x$GCC" = "xyes"], [
+       AC_MSG_CHECKING([gcc use-after-free warning bug])
+       ac_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -Wall -Werror -O0 -U_FORTIFY_SOURCE"
+       _OPENAFS_UAF_COMPILE_IFELSE(
+           [AC_MSG_RESULT(no)],
+           [
+               dnl Compiler flagged an error.  Run one more check to ensure
+               dnl the error was only the false positive for a UAF.
+               AX_APPEND_COMPILE_FLAGS([-Wno-use-after-free],
+                                       [CFLAGS_USE_AFTER_FREE_GCCBUG], [-Werror])
+               CFLAGS=" $CFLAGS $CFLAGS_USE_AFTER_FREE_GCCBUG"
+               _OPENAFS_UAF_COMPILE_IFELSE(
+                   [AC_MSG_RESULT(yes)],
+                   [AC_MSG_ERROR([Unexpected compiler error while testing for gcc use-after-free bug])])
+           ]
+       )
+       CFLAGS="$ac_save_CFLAGS"
+    ])
+    AC_SUBST([CFLAGS_USE_AFTER_FREE_GCCBUG])
+])
index 002685e..896b1ed 100644 (file)
@@ -1,6 +1,16 @@
 AC_DEFUN([OPENAFS_GSS],
+  [
 dnl Probe for GSSAPI
-  [RRA_LIB_GSSAPI
+dnl
+dnl Don't do this if we don't have krb5. Otherwise, if someone runs configure
+dnl with no arguments on a system without krb5 libs, RRA_LIB_GSSAPI will fail,
+dnl preventing the build from moving forwards.
+dnl
+dnl Also don't probe for GSSAPI if --without-gssapi was given, so we don't
+dnl accidentally autodetect gss libs and use them.
+  AS_IF([test x"$BUILD_KRB5" = xyes && test x"$with_gssapi" != xno],
+       [RRA_LIB_GSSAPI])
+
 dnl Check for the characteristics of whatever GSSAPI we found, if we found one
   BUILD_GSSAPI=no
   AS_IF([test x"$GSSAPI_LIBS" != x],
index f0d2daf..81a015e 100644 (file)
@@ -16,11 +16,11 @@ if test "x$enable_debug_kernel" = "xno"; then
 fi
 AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing -fno-strength-reduce \
                          -fno-common -pipe],
-                        [LINUX_GCC_KOPTS])
+                        [LINUX_GCC_KOPTS],[-Werror])
 AC_SUBST(LINUX_GCC_KOPTS)
 
 dnl Setup the kernel build environment
-LINUX_KBUILD_USES_EXTRA_CFLAGS
+LINUX_KBUILD_FIND_CFLAGS_METHOD
 LINUX_KBUILD_SPARSE_CHECKS
 LINUX_KERNEL_COMPILE_WORKS
 ])
index 6fa6051..88f9e18 100644 (file)
@@ -39,7 +39,9 @@ LINUX_LINUX_KEYRING_SUPPORT
 LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
 LINUX_KEY_ALLOC_NEEDS_CRED
 LINUX_INIT_WORK_HAS_DATA
-LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
+dnl Don't bother checking register_sysctl_table if using register_sysctl
+AS_IF([test "x$ac_cv_linux_func_register_sysctl" != "xyes"],
+      [LINUX_REGISTER_SYSCTL_TABLE_NOFLAG])
 LINUX_HAVE_DCACHE_LOCK
 LINUX_D_COUNT_IS_INT
 LINUX_IOP_GETATTR_TAKES_PATH_STRUCT
@@ -56,6 +58,8 @@ LINUX_IOP_LOOKUP_TAKES_UNSIGNED
 LINUX_D_INVALIDATE_IS_VOID
 LINUX_KERNEL_READ_OFFSET_IS_LAST
 LINUX_KEYRING_SEARCH_TAKES_RECURSE
+LINUX_GENERIC_FILLATTR_TAKES_REQUEST_MASK
+LINUX_FILE_LOCK_CORE
 ])
 
 
@@ -73,6 +77,5 @@ else
 fi
 if test "x$ac_cv_linux_func_page_get_link" != "xyes" -a "x$ac_cv_linux_struct_inode_operations_has_get_link" = "xyes"; then
     AC_MSG_ERROR([Your kernel does not use follow_link - not supported without symlink cache API])
-    exit 1
 fi
 ])
index cd4afe9..93f96f5 100644 (file)
@@ -59,9 +59,14 @@ AC_CHECK_LINUX_FUNC([find_task_by_pid],
 AC_CHECK_LINUX_FUNC([generic_file_aio_read],
                     [#include <linux/fs.h>],
                     [generic_file_aio_read(NULL,NULL,0,0);])
-AC_CHECK_LINUX_FUNC([grab_cache_page_write_begin],
+dnl - linux 5.19 removed the flags parameter, need to test
+dnl - with and without the flags parameter
+AC_CHECK_LINUX_FUNC([grab_cache_page_write_begin_withflags],
                     [#include <linux/pagemap.h>],
                     [grab_cache_page_write_begin(NULL, 0, 0);])
+AC_CHECK_LINUX_FUNC([grab_cache_page_write_begin_noflags],
+                    [#include <linux/pagemap.h>],
+                    [grab_cache_page_write_begin(NULL, 0);])
 AC_CHECK_LINUX_FUNC([hlist_unhashed],
                     [#include <linux/list.h>],
                     [hlist_unhashed(0);])
@@ -89,7 +94,11 @@ AC_CHECK_LINUX_FUNC([ktime_get_real_ts64],
                     [struct timespec64 *s;
                     ktime_get_real_ts64(s);])
 AC_CHECK_LINUX_FUNC([locks_lock_file_wait],
-                    [#include <linux/fs.h>],
+                   [#ifdef HAVE_LINUX_FILELOCK_H
+                    # include <linux/filelock.h>
+                    #else
+                    # include <linux/fs.h>
+                    #endif],
                     [locks_lock_file_wait(NULL, NULL);])
 AC_CHECK_LINUX_FUNC([override_creds],
                     [#include <linux/cred.h>],
@@ -168,10 +177,17 @@ AC_CHECK_LINUX_FUNC([in_compat_syscall],
 
 dnl lru_cache_add exported in Linux 5.8
 dnl    replaces lru_cache_add_file
+dnl removed in linux 6.1.  folio_add_lru is a replacement
 AC_CHECK_LINUX_FUNC([lru_cache_add],
                     [#include <linux/swap.h>],
                     [lru_cache_add(NULL);])
 
+dnl Linux 5.16 added folio_add_lru as a replacement for
+dnl lru_cache_add
+AC_CHECK_LINUX_FUNC([folio_add_lru],
+                    [#include <linux/swap.h>],
+                   [folio_add_lru(NULL);])
+
 dnl Linux 5.8 replaced kernel_setsockopt with helper functions
 dnl e.g. ip_sock_set_mtu_discover, ip_sock_set_recverr
 AC_CHECK_LINUX_FUNC([ip_sock_set],
@@ -184,6 +200,59 @@ AC_CHECK_LINUX_FUNC([kthread_complete_and_exit],
                      #include <linux/kthread.h>],
                     [kthread_complete_and_exit(0, 0);])
 
+dnl Linux 6.0 removed add_to_page_cache.  It's replacement, filemap_add_folio,
+dnl was added in 5.15 and is GPL-only, but has a NON-GPL wrapper called
+dnl add_to_page_cache_lru.
+dnl Note prior to 5.15, add_to_page_cache_lru was either not exported or
+dnl or exported as GPL-only.
+AC_CHECK_LINUX_FUNC([add_to_page_cache_lru],
+                    [#include <linux/kernel.h>
+                     #include <linux/pagemap.h>],
+                    [add_to_page_cache_lru(NULL, NULL, 0, 0);])
+
+dnl RHEL9.1 partially added support for address_space_operations' dirty_folio
+dnl it did not add block_dirty_folio
+AC_CHECK_LINUX_FUNC([block_dirty_folio],
+                   [#include <linux/kernel.h>
+                    #include <linux/buffer_head.h>],
+                   [block_dirty_folio(NULL, NULL);])
+
+dnl Linux 6.5 removed the Linux function register_sysctl_table(), which
+dnl was deprecated in Linux 6.3 in favor of register_sysctl() which was
+dnl introduced in Linux 3.3
+dnl Linux 6.6 changed the function register_sysctl to a macro that requires
+dnl an array of ctl_table structures as its 2nd parameter
+AC_CHECK_LINUX_FUNC([register_sysctl],
+                   [#include <linux/kernel.h>
+                    #include <linux/sysctl.h>],
+                   [[static struct ctl_table cf_sysctl_table[1];
+                   (void)register_sysctl(NULL, cf_sysctl_table);]])
+
+dnl Linux 6.6 requires the use of a getter/setter for accessing a inode's
+dnl ctime member.  Test for the setter inode_set_ctime
+AC_CHECK_LINUX_FUNC([inode_set_ctime],
+                   [#include <linux/fs.h>],
+                   [inode_set_ctime(NULL, 0, 0);])
+
+dnl Linux 6.7 requires the use of a getter/setter for accessing a inode's
+dnl atime and mtime members.  Test for the setters.  Assummes that the
+dnl getters are present if the setters are.
+AC_CHECK_LINUX_FUNC([inode_atime_mtime_accessors],
+                   [#include <linux/fs.h>],
+                   [inode_set_atime(NULL, 0, 0);
+                    inode_set_mtime(NULL, 0, 0);])
+
+dnl Linux 6.8 removed the strlcpy() function.  We test to see if we can redefine
+dnl a strlcpy() function.  We use a totally different function signature to
+dnl to ensure that this fails when the kernel does provide strlcpy().
+AC_CHECK_LINUX_FUNC([no_strlcpy],
+                   [[#include <linux/string.h>
+                    size_t strlcpy(char *d);
+                    size_t strlcpy(char *d) { return strlen(d); }]],
+                   [[static char buff[10];
+                    size_t s;
+                    s = strlcpy(buff);]])
+
 dnl Consequences - things which get set as a result of the
 dnl                above tests
 AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],
index 8507eaa..fc52830 100644 (file)
@@ -10,4 +10,6 @@ AC_CHECK_LINUX_HEADER([seq_file.h])
 AC_CHECK_LINUX_HEADER([sched/signal.h])
 AC_CHECK_LINUX_HEADER([uaccess.h])
 AC_CHECK_LINUX_HEADER([stdarg.h])
+dnl Linux 6.3 relocated file locking related declarations into it's own header
+AC_CHECK_LINUX_HEADER([filelock.h])
 ])
index 2c6212a..0afeaea 100644 (file)
@@ -36,13 +36,11 @@ else
           linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1`
           if test "x$linux_kvers" = "x"; then
             AC_MSG_ERROR(Linux headers lack version definition [2])
-            exit 1
           else
             LINUX_VERSION="$linux_kvers"
           fi
         else
           AC_MSG_ERROR(Linux headers lack version definition)
-          exit 1
         fi
       else
         LINUX_VERSION="$linux_kvers"
@@ -59,11 +57,8 @@ fi
 if test "x$enable_kernel_module" = "xno"; then
  if test "x$with_linux_kernel_headers" != "x"; then
   AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
-  exit 1
  else
   AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
  fi
 fi
-dnl do we need to determine SUBARCH from autoconf.h
-SUBARCH=default
 ])
index e0cc9a2..5301f35 100644 (file)
@@ -28,4 +28,17 @@ dnl define.
 AS_IF([test AS_VAR_GET([ac_cv_linux_operation_inode_operations_create_user_namespace]) = yes],
       [AC_DEFINE([IOP_TAKES_USER_NAMESPACE], 1,
                  [define if inodeops require struct user_namespace])])
+dnl Linux 6.3 replaced the user_namespace parameter with mnt_idmap for
+dnl the inode operations functions.
+AC_CHECK_LINUX_OPERATION([inode_operations], [create], [mnt_idmap],
+                         [#include <linux/fs.h>],
+                         [int],
+                         [struct mnt_idmap *idmap,
+                         struct inode *inode, struct dentry *dentry,
+                         umode_t umode, bool flag])
+dnl if HAVE_LINUX_INODE_OPERATIONS_CREATE_MNT_IDMAP, create a more generic
+dnl define.
+AS_IF([test AS_VAR_GET([ac_cv_linux_operation_inode_operations_create_mnt_idmap]) = yes],
+      [AC_DEFINE([IOP_TAKES_MNT_IDMAP], 1,
+                 [define if inodeops require struct mnt_idmap])])
 ])
\ No newline at end of file
index 2d8cee6..5cd346f 100644 (file)
@@ -5,11 +5,21 @@ AC_CHECK_LINUX_STRUCT([address_space_operations],
                       [write_begin], [fs.h])
 dnl linux 5.18 replaced set_page_dirty with dirty_folio
 AC_CHECK_LINUX_STRUCT([address_space_operations], [dirty_folio], [fs.h])
+dnl linux 5.18 replaced readpages with readahead (introduced in 5.8)
+AC_CHECK_LINUX_STRUCT([address_space_operations], [readahead], [fs.h])
+dnl linux 5.18 replaced readpage with read_folio
+AC_CHECK_LINUX_STRUCT([address_space_operations], [read_folio], [fs.h])
 AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
                       [backing-dev.h])
 AC_CHECK_LINUX_STRUCT([cred], [session_keyring], [cred.h])
 AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
 AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_alias], [dcache.h])
+dnl linux 2.6.16 moved dentry->d_child to dentry->d_u.d_child
+dnl linux 3.19 moved it back to dentry->d_child
+AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_child], [dcache.h])
+dnl linux 6.8 uses hlist for dentry children and renamed
+dnl d_subdirs/d_child to d_childern/d_sib
+AC_CHECK_LINUX_STRUCT([dentry], [d_children], [dcache.h])
 AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h])
 AC_CHECK_LINUX_STRUCT([group_info], [gid], [cred.h])
 AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
@@ -19,6 +29,7 @@ AC_CHECK_LINUX_STRUCT([inode], [i_mutex], [fs.h])
 AC_CHECK_LINUX_STRUCT([inode], [i_security], [fs.h])
 AC_CHECK_LINUX_STRUCT([file], [f_path], [fs.h])
 AC_CHECK_LINUX_STRUCT([file_operations], [flock], [fs.h])
+AC_CHECK_LINUX_STRUCT([file_operations], [iterate_shared], [fs.h])
 AC_CHECK_LINUX_STRUCT([file_operations], [iterate], [fs.h])
 AC_CHECK_LINUX_STRUCT([file_operations], [read_iter], [fs.h])
 AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
@@ -29,7 +40,6 @@ AC_CHECK_LINUX_STRUCT([key], [payload.value], [key.h])
 AC_CHECK_LINUX_STRUCT([key_type], [instantiate_prep], [key-type.h])
 AC_CHECK_LINUX_STRUCT([key_type], [match_preparse], [key-type.h])
 AC_CHECK_LINUX_STRUCT([key_type], [preparse], [key-type.h])
-AC_CHECK_LINUX_STRUCT([msghdr], [msg_iter], [socket.h])
 AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
 AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
 AC_CHECK_LINUX_STRUCT([proc_ops], [proc_compat_ioctl], [proc_fs.h])
index 9390b9a..010a446 100644 (file)
@@ -2,12 +2,9 @@
 #                 [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
 #
 AC_DEFUN([AC_TRY_KBUILD26],[  rm -fr conftest.dir
-  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
-    CFLAGS_PREFIX='EXTRA_'
-  fi
   if mkdir conftest.dir &&
     cat >conftest.dir/Makefile <<_ACEOF &&
-${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
+${ac_linux_kbuild_cflags_var} += $CPPFLAGS
 
 obj-m += conftest.o
 _ACEOF
@@ -19,7 +16,7 @@ _ACEOF
 /* end confdefs.h */
 #include <linux/module.h>
 $1
-
+void conftest(void);
 void conftest(void)
 { 
 $2
@@ -72,18 +69,41 @@ AC_DEFUN([LINUX_KERNEL_COMPILE_WORKS], [
     AC_MSG_FAILURE([Fix problem or use --disable-kernel-module...]))
   AC_MSG_RESULT(yes)])
 
-AC_DEFUN([LINUX_KBUILD_USES_EXTRA_CFLAGS], [
-  AC_MSG_CHECKING([if linux kbuild requires EXTRA_CFLAGS])
-  save_CPPFLAGS="$CPPFLAGS"
-  CPPFLAGS=-Wall
-  AC_TRY_KBUILD(
+AC_DEFUN([AC_LINUX_KBUILD_CHECK_CFLAGS],[
+    save_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS=-DCHECK_OPENAFS_CFLAGS
+    AC_TRY_KBUILD(
 [#include <linux/sched.h>
-#include <linux/fs.h>],
-    [],
-    ac_linux_kbuild_requires_extra_cflags=no,
-    ac_linux_kbuild_requires_extra_cflags=yes)
+#include <linux/fs.h>
+#ifndef CHECK_OPENAFS_CFLAGS
+# error cflags not passed to the compiler
+#endif
+],
+       [],
+       $1, $2
+    )
     CPPFLAGS="$save_CPPFLAGS"
-    AC_MSG_RESULT($ac_linux_kbuild_requires_extra_cflags)])
+])
+
+AC_DEFUN([LINUX_KBUILD_FIND_CFLAGS_METHOD],
+   [AC_MSG_CHECKING([how to set cflags for linux kbuild])
+    ac_linux_kbuild_cflags_var=ccflags-y
+    AC_LINUX_KBUILD_CHECK_CFLAGS(
+        [AC_MSG_RESULT([ccflags-y])],
+        [ac_linux_kbuild_cflags_var=EXTRA_CFLAGS
+         AC_LINUX_KBUILD_CHECK_CFLAGS(
+             [AC_MSG_RESULT([EXTRA_CFLAGS])],
+             [ac_linux_kbuild_cflags_var=CFLAGS
+              AC_LINUX_KBUILD_CHECK_CFLAGS(
+                 [AC_MSG_RESULT([CFLAGS])],
+                  [ac_linux_kbuild_cflags_var=
+                 AC_MSG_ERROR([cannot find way to set linux kbuild cflags])])
+             ])
+       ])
+    LINUX_KBUILD_CFLAGS_VAR=$ac_linux_kbuild_cflags_var
+    AC_SUBST([LINUX_KBUILD_CFLAGS_VAR])
+])
+
 
 AC_DEFUN([LINUX_KBUILD_SPARSE_CHECKS], [
   AC_ARG_WITH([sparse],
@@ -107,12 +127,13 @@ AC_DEFUN([LINUX_KBUILD_SPARSE_CHECKS], [
 ])
 
 
-dnl AC_CHECK_LINUX_BUILD([msg], [var], [includes], [code], [define], [CFLAGS])
+dnl AC_CHECK_LINUX_BUILD([msg], [var], [includes], [code],
+dnl                      [define], [description], [CFLAGS])
 AC_DEFUN([AC_CHECK_LINUX_BUILD],
  [AS_VAR_PUSHDEF([ac_linux_build], [$2])dnl
   AC_CACHE_CHECK([$1], [ac_linux_build],
    [save_CPPFLAGS="$CPPFLAGS"
-     CPPFLAGS="$CPPFLAGS $7"
+     CPPFLAGS="$CPPFLAGS -Wno-error $7"
      AC_TRY_KBUILD([$3], [$4],
                  AS_VAR_SET([ac_linux_build], [yes]),
                  AS_VAR_SET([ac_linux_build], [no]))
@@ -136,7 +157,7 @@ AC_DEFUN([AC_CHECK_LINUX_FUNC],
  [AS_VAR_PUSHDEF([ac_linux_func], [ac_cv_linux_func_$1])dnl
   AC_CACHE_CHECK([for $1], [ac_linux_func],
     [save_CPPFLAGS="$CPPFLAGS"
-     CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
+     CPPFLAGS="$CPPFLAGS -Wno-error -Werror-implicit-function-declaration"
      AC_TRY_KBUILD([$2], [$3],
                   AS_VAR_SET([ac_linux_func], [yes]),
                   AS_VAR_SET([ac_linux_func], [no]))
@@ -152,7 +173,7 @@ AC_DEFUN([AC_CHECK_LINUX_TYPE],
  [AC_CHECK_LINUX_BUILD([for $1],
                        [ac_cv_linux_type_$1_exists],
                        [#include <linux/$2>],
-                       [$1 _test; ],
+                       [static $1 _test; ],
                        AS_TR_CPP(HAVE_LINUX_$1),
                        [Define if kernel defines $1])
  ])
@@ -167,7 +188,7 @@ AC_DEFUN([AC_CHECK_LINUX_TYPED_STRUCT],
  [AC_CHECK_LINUX_BUILD([for $2 in $1],
                       [ac_cv_linux_$1_has_$2],
                       [#include <linux/$3>],
-                      [$1 _test; printk("%x\n", &_test.$2); ],
+                      [static $1 _test; printk("%x\n", &_test.$2); ],
                       AS_TR_CPP($1_HAS_$2),
                       [Define if kernel $1 has the $2 element])
  ])
@@ -178,7 +199,10 @@ AC_DEFUN([AC_CHECK_LINUX_OPERATION],
   AC_CACHE_CHECK([operation $2 in $1], [ac_linux_operation],
     [save_CPPFLAGS="$CPPFLAGS"
      CPPFLAGS="$CPPFLAGS -Werror"
-     AC_TRY_KBUILD([$4], [struct $1 ops; $5 op($6) { return ($5)0; }; ops.$2 = op;],
+     AC_TRY_KBUILD(
+      [$4
+       static $5 op($6) { return ($5)0; };],
+      [static struct $1 ops;  ops.$2 = op;],
                   AS_VAR_SET([ac_linux_operation], [yes]),
                   AS_VAR_SET([ac_linux_operation], [no]))
      CPPFLAGS="$save_CPPFLAGS"
index f7699ce..b229306 100644 (file)
@@ -132,7 +132,7 @@ AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], [
 #ifdef HAVE_LINUX_SCHED_SIGNAL_H
 #include <linux/sched/signal.h>
 #endif],
-                      [struct task_struct _tsk; printk("%d\n", _tsk.signal->rlim);],
+                      [static struct task_struct _tsk; printk("%d\n", _tsk.signal->rlim);],
                       [STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM],
                       [define if your struct task_struct has signal->rlim],
                       [])
@@ -142,7 +142,11 @@ AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], [
 AC_DEFUN([LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG], [
   AC_CHECK_LINUX_BUILD([for 3rd argument in posix_lock_file found in new kernels],
                       [ac_cv_linux_kernel_posix_lock_file_wait_arg],
-                      [#include <linux/fs.h>],
+                      [#ifdef HAVE_LINUX_FILELOCK_H
+                       # include <linux/filelock.h>
+                       #else
+                       # include <linux/fs.h>
+                       #endif],
                       [posix_lock_file(0,0,0);],
                       [POSIX_LOCK_FILE_WAIT_ARG],
                       [define if your kernel uses 3 arguments for posix_lock_file],
@@ -174,8 +178,8 @@ AC_DEFUN([LINUX_INODE_SETATTR_RETURN_TYPE], [
   AC_CHECK_LINUX_BUILD([for inode_setattr return type],
                       [ac_cv_linux_func_inode_setattr_returns_int],
                       [#include <linux/fs.h>],
-                      [struct inode _inode;
-                       struct iattr _iattr;
+                      [static struct inode _inode;
+                       static struct iattr _iattr;
                        int i;
                        i = inode_setattr(&_inode, &_iattr);],
                       [INODE_SETATTR_NOT_VOID],
@@ -188,7 +192,7 @@ AC_DEFUN([LINUX_IATTR_64BIT_TIME], [
                        [ac_cv_linux_func_iattr_ctime_takes_timespec64],
                        [#include <linux/fs.h>
                         #include <linux/timekeeping.h>],
-                       [struct iattr _attrs;
+                       [static struct iattr _attrs;
                        #if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64)
                         ktime_get_coarse_real_ts64(&_attrs.ia_ctime);
                        #else
@@ -206,9 +210,9 @@ AC_DEFUN([LINUX_AOP_WRITEBACK_CONTROL], [
 [#include <linux/fs.h>
 #include <linux/mm.h>
 #include <linux/writeback.h>],
-[struct address_space_operations _aops;
-struct page _page;
-struct writeback_control _writeback_control;
+[static struct address_space_operations _aops;
+static struct page _page;
+static struct writeback_control _writeback_control;
 (void)_aops.writepage(&_page, &_writeback_control);],
                       [AOP_WRITEPAGE_TAKES_WRITEBACK_CONTROL],
                       [define if aops.writepage takes a struct writeback_control],
@@ -235,9 +239,9 @@ AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_NAMEIDATA], [
                       [ac_cv_linux_func_i_create_takes_nameidata],
 [#include <linux/fs.h>
 #include <linux/namei.h>],
-[struct inode _inode;
-struct dentry _dentry;
-struct nameidata _nameidata;
+[static struct inode _inode;
+static struct dentry _dentry;
+static struct nameidata _nameidata;
 (void)_inode.i_op->create(&_inode, &_dentry, 0, &_nameidata);],
 
                       [IOP_CREATE_TAKES_NAMEIDATA],
@@ -251,9 +255,9 @@ AC_DEFUN([LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA], [
                       [ac_cv_linux_func_i_lookup_takes_nameidata],
 [#include <linux/fs.h>
 #include <linux/namei.h>],
-[struct inode _inode;
-struct dentry _dentry;
-struct nameidata _nameidata;
+[static struct inode _inode;
+static struct dentry _dentry;
+static struct nameidata _nameidata;
 (void)_inode.i_op->lookup(&_inode, &_dentry, &_nameidata);],
                       [IOP_LOOKUP_TAKES_NAMEIDATA],
                       [define if your iops.lookup takes a nameidata argument],
@@ -266,8 +270,8 @@ AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA], [
                       [ac_cv_linux_func_i_permission_takes_nameidata],
 [#include <linux/fs.h>
 #include <linux/namei.h>],
-[struct inode _inode;
-struct nameidata _nameidata;
+[static struct inode _inode;
+static struct nameidata _nameidata;
 (void)_inode.i_op->permission(&_inode, 0, &_nameidata);],
                       [IOP_PERMISSION_TAKES_NAMEIDATA],
                       [define if your iops.permission takes a nameidata argument],
@@ -293,8 +297,8 @@ AC_DEFUN([LINUX_IOP_I_PUT_LINK_TAKES_COOKIE], [
                       [ac_cv_linux_func_i_put_link_takes_cookie],
 [#include <linux/fs.h>
 #include <linux/namei.h>],
-[struct inode _inode;
-struct dentry _dentry;
+[static struct inode _inode;
+static struct dentry _dentry;
 struct nameidata *_nameidata;
 void *cookie;
 (void)_inode.i_op->put_link(&_dentry, _nameidata, cookie);],
@@ -369,7 +373,7 @@ AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [
                        [ac_cv_key_alloc_needs_struct_task],
                        [#include <linux/rwsem.h>
                        #include <linux/key.h> ],
-                       [struct task_struct *t=NULL;
+                       [static struct task_struct *t=NULL;
                        struct key k = {};
                        (void) key_alloc(NULL, NULL, k.uid, k.gid, t, 0, 0);],
                        [KEY_ALLOC_NEEDS_STRUCT_TASK],
@@ -396,9 +400,9 @@ AC_DEFUN([LINUX_INIT_WORK_HAS_DATA], [
   AC_CHECK_LINUX_BUILD([whether INIT_WORK has a _data argument],
                       [ac_cv_linux_init_work_has_data],
 [#include <linux/kernel.h>
-#include <linux/workqueue.h>],
-[ 
-void f(struct work_struct *w) {}
+#include <linux/workqueue.h>
+static void f(struct work_struct *w) {}],
+[
 struct work_struct *w;
 int *i;
 INIT_WORK(w,f,i);],
@@ -423,8 +427,8 @@ AC_DEFUN([LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T], [
   AC_CHECK_LINUX_BUILD([whether file_operations.flush takes a fl_owner_t],
                       [ac_cv_linux_func_f_flush_takes_fl_owner_t],
                       [#include <linux/fs.h>],
-[struct inode _inode;
-struct file _file;
+[static struct inode _inode;
+static struct file _file;
 fl_owner_t id;
 (void)_inode.i_fop->flush(&_file, &id);],
                       [FOP_FLUSH_TAKES_FL_OWNER_T],
@@ -437,9 +441,9 @@ AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_DENTRY], [
   AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a dentry argument],
                       [ac_cv_linux_func_f_fsync_takes_dentry],
                       [#include <linux/fs.h>],
-[struct inode _inode;
-struct file _file;
-struct dentry _d;
+[static struct inode _inode;
+static struct file _file;
+static struct dentry _d;
 (void)_inode.i_fop->fsync(&_file, &_d, 0);],
                       [FOP_FSYNC_TAKES_DENTRY],
                       [define if your fops.fsync takes an dentry argument],
@@ -453,8 +457,8 @@ AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_RANGE], [
   AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a range],
                       [ac_cv_linux_func_f_fsync_takes_range],
                       [#include <linux/fs.h>],
-[struct inode _inode;
-struct file _file;
+[static struct inode _inode;
+static struct file _file;
 loff_t start, end;
 (void)_inode.i_fop->fsync(&_file, start, end, 0);],
                       [FOP_FSYNC_TAKES_RANGE],
@@ -488,8 +492,9 @@ AC_DEFUN([LINUX_KMEM_CACHE_CREATE_TAKES_DTOR], [
 AC_DEFUN([LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID],[
   AC_CHECK_LINUX_BUILD([whether kmem_cache_create constructor takes a void pointer],
                        [ac_cv_linux_kmem_cache_create_ctor_takes_void],
-                       [#include <linux/slab.h>],
-                       [void _ctor(void *v) { }; kmem_cache_create(NULL, 0, 0, 0, _ctor);],
+                       [#include <linux/slab.h>
+                        static void _ctor(void *v) { };],
+                       [kmem_cache_create(NULL, 0, 0, 0, _ctor);],
                        [KMEM_CACHE_CTOR_TAKES_VOID],
                        [define if kmem_cache_create constructor takes a single void ptr],
                        [-Werror])
@@ -503,7 +508,7 @@ AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_SPLICE], [
   AC_CHECK_LINUX_BUILD([for splice_write and splice_read in struct file_operations],
                       [ac_cv_linux_fs_struct_fop_has_splice],
                       [#include <linux/fs.h>],
-                      [struct file_operations _fop;
+                      [static struct file_operations _fop;
                        _fop.splice_write(NULL, NULL, NULL, 0, 0);
                        _fop.splice_read(NULL, NULL, NULL, 0, 0);],
                       [STRUCT_FILE_OPERATIONS_HAS_SPLICE],
@@ -553,7 +558,7 @@ AC_DEFUN([LINUX_NEW_EXPORT_OPS], [
   AC_CHECK_LINUX_BUILD([if kernel uses new export ops],
                       [ac_cv_linux_new_export_ops],
                       [#include <linux/exportfs.h>],
-                      [struct export_operations _eops;
+                      [static struct export_operations _eops;
                        _eops.fh_to_parent(NULL, NULL, 0, 0);],
                       [NEW_EXPORT_OPS],
                       [define if kernel uses new export ops],
@@ -662,7 +667,7 @@ AC_DEFUN([LINUX_IOP_GETATTR_TAKES_PATH_STRUCT], [
   AC_CHECK_LINUX_BUILD([whether 4.11+ inode.i_op->getattr takes a struct path argument],
                         [ac_cv_linux_iop_getattr_takes_path_struct],
                         [#include <linux/fs.h>
-                        int _getattr(const struct path *path, struct kstat *stat, u32 request_mask,
+                        static int _getattr(const struct path *path, struct kstat *stat, u32 request_mask,
                           unsigned int sync_mode) {return 0;};
                         struct inode_operations _i_ops;],
                         [_i_ops.getattr = _getattr;],
@@ -687,10 +692,10 @@ AC_DEFUN([LINUX_IOP_MKDIR_TAKES_UMODE_T], [
 AC_DEFUN([LINUX_IOP_CREATE_TAKES_UMODE_T], [
   AC_CHECK_LINUX_BUILD([whether inode.i_op->create takes a umode_t argument],
                        [ac_cv_linux_iop_create_takes_umode_t],
-                       [#include <linux/fs.h>],
-                       [struct inode_operations _i_ops;
-                       int _create(struct inode *i, struct dentry *d, umode_t m, struct nameidata *n)
-                               {return 0;};
+                       [#include <linux/fs.h>
+                        static int _create(struct inode *i, struct dentry *d, umode_t m, struct nameidata *n)
+                        {return 0;};],
+                       [static struct inode_operations _i_ops;
                        _i_ops.create = _create;],
                        [IOP_CREATE_TAKES_UMODE_T],
                        [define if inode.i_op->create takes a umode_t argument],
@@ -727,7 +732,7 @@ AC_DEFUN([LINUX_DENTRY_OPEN_TAKES_PATH], [
   AC_CHECK_LINUX_BUILD([whether dentry_open takes a path argument],
                        [ac_cv_linux_dentry_open_takes_path],
                        [#include <linux/fs.h>],
-                       [struct path p;
+                       [static struct path p;
                        dentry_open(&p, 0, NULL);],
                        [DENTRY_OPEN_TAKES_PATH],
                        [define if dentry_open takes a path argument],
@@ -775,8 +780,8 @@ AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_BOOL], [
                        [ac_cv_linux_func_i_create_takes_bool],
                        [#include <linux/fs.h>
                        #include <linux/namei.h>],
-                       [struct inode _inode = {};
-                       struct dentry _dentry;
+                       [static struct inode _inode = {};
+                       static struct dentry _dentry;
                        bool b = true;
                        (void)_inode.i_op->create(&_inode, &_dentry, 0, b);],
                       [IOP_CREATE_TAKES_BOOL],
@@ -849,3 +854,34 @@ AC_DEFUN([LINUX_KEYRING_SEARCH_TAKES_RECURSE], [
                        [define if your keyring_search has the recurse parameter],
                        [])
 ])
+
+dnl Linux 6.6 added the 'request_mask' parameter to generic_fillattr.
+AC_DEFUN([LINUX_GENERIC_FILLATTR_TAKES_REQUEST_MASK], [
+  AC_CHECK_LINUX_BUILD([whether generic_fillattr has the request_mask parameter],
+                       [ac_cv_linux_func_generic_fillattr_takes_request_mask],
+                       [#include <linux/fs.h>],
+                       [
+                       generic_fillattr(NULL, 0, NULL, NULL);
+                       ],
+                       [GENERIC_FILLATTR_TAKES_REQUEST_MASK],
+                       [define if your generic_fillattr has the request_mask_parameter],
+                       [])
+])
+
+dnl linux 6.9 moved and renamed fl_type, fl_pid  and fl_flags
+dnl from file_lock into a new structure file_lock_core.  Check for these as a
+dnl single test
+AC_DEFUN([LINUX_FILE_LOCK_CORE], [
+  AC_CHECK_LINUX_BUILD([whether fl_type fl_pid and fl_flags are in structure file_lock_core],
+                       [ac_cv_linux_file_lock_core],
+                       [#include <linux/filelock.h>],
+                       [
+                       static struct file_lock flock;
+                       flock.c.flc_type = 0;
+                       flock.c.flc_pid = 0;
+                       flock.c.flc_flags = 0;
+                       ],
+                       [HAVE_FILE_LOCK_CORE],
+                       [define if file_lock_core exists],
+                       [])
+])
index 904e097..a54b619 100644 (file)
@@ -265,7 +265,6 @@ enable_login="no"
 ])
 
 AC_DEFUN([OPENAFS_OPTION_TESTS],[
-# Fast restart
 if test "$enable_supergroups" = "yes"; then
         AC_DEFINE(SUPERGROUPS, 1, [define if you want to have support for nested pts groups])
 fi
index d98a1fe..e260aff 100644 (file)
@@ -319,7 +319,7 @@ case $AFS_SYSNAME in
                XLIBS="${LIB_AFSDB} -framework CoreFoundation"
                ;;
 
-       *_darwin_190 | *_darwin_200 | *_darwin_210)
+       *_darwin_190 | *_darwin_200 | *_darwin_210 | *_darwin_220 | *_darwin_230)
                AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration -framework SystemConfiguration -framework IOKit -framework CoreFoundation"
                MT_CFLAGS="-D_REENTRANT"
                MT_LIBS='${XLIBS}'
@@ -377,7 +377,7 @@ case $AFS_SYSNAME in
                TSM_LIBS="-lsys -lcsys -lc"
                ;;
 
-       rs_aix61)       
+       rs_aix61 | rs_aix7*)
                CC="cc"
                DBG="-g"
                LIBSYS_AIX_EXP="afsl.exp"
@@ -392,11 +392,6 @@ case $AFS_SYSNAME in
                TSM_LIBS="-lsys -lcsys -lc"
                ;;
 
-       rs_aix72)
-               TSM_IMPORTS="-bI:/lib/aio.exp"
-               TSM_LIBS="-lsys -lc"
-               ;;
-
        s390_linux26)
                LD="ld"
                KERN_OPTMZ=-O2
@@ -631,6 +626,7 @@ CFLAGS_NOUNUSED=
 CFLAGS_NOOLDSTYLE=
 CFLAGS_NOIMPLICIT_FALLTHROUGH=
 CFLAGS_NOCAST_FUNCTION_TYPE=
+CFLAGS_NODANGLING_POINTER=
 XCFLAGS_NOCHECKING="$XCFLAGS"
 
 if test "x$GCC" = "xyes"; then
@@ -645,14 +641,25 @@ if test "x$GCC" = "xyes"; then
       CFLAGS_NOUNUSED="-Wno-unused"
       CFLAGS_NOOLDSTYLE="-Wno-old-style-definition"
       AX_APPEND_COMPILE_FLAGS([-Wno-implicit-fallthrough],
-                               [CFLAGS_NOIMPLICIT_FALLTHROUGH])
-      AX_APPEND_COMPILE_FLAGS([-Wno-cast-function-type],
-                              [CFLAGS_NOCAST_FUNCTION_TYPE])
+                             [CFLAGS_NOIMPLICIT_FALLTHROUGH], [-Werror])
+      AX_APPEND_COMPILE_FLAGS([-Wno-dangling-pointer],
+                             [CFLAGS_NODANGLING_POINTER], [-Werror])
+      OPENAFS_GCC_UAF_BUG_CHECK
       AC_DEFINE(IGNORE_SOME_GCC_WARNINGS, 1, [define to disable some gcc warnings in warnings-as-errors mode])
     else
       CFLAGS_NOSTRICT=
     fi
   fi
+dnl If a linux kernel has CONFIG_WERROR enabled, the openafs kernel module
+dnl will be built with the -Werror compiler flag even when the openafs tree is
+dnl configured with --disable-checking.
+
+dnl Provide compiler flags that can be used to disable certain warnings when the
+dnl openafs tree is configued with --enable-checking or --disable-checking.
+  AS_IF([test "x$enable_checking" != "xall"],
+       [AX_APPEND_COMPILE_FLAGS([-Wno-cast-function-type],
+                                [CFLAGS_NOCAST_FUNCTION_TYPE], [-Werror])
+  ])
 else
   case $AFS_SYSNAME in
     sun*_51?)
@@ -673,7 +680,7 @@ fi
 
 dnl add additional checks if compilers support the flags
 AS_IF([test "x$enable_checking" != "xno"],
-      [AX_APPEND_COMPILE_FLAGS([-Wimplicit-fallthrough], [XCFLAGS])
+      [AX_APPEND_COMPILE_FLAGS([-Wimplicit-fallthrough], [XCFLAGS], [-Werror])
 ])
 
 dnl horribly cheating, assuming double / is ok.
@@ -732,6 +739,7 @@ AC_SUBST(CFLAGS_NOUNUSED)
 AC_SUBST(CFLAGS_NOOLDSTYLE)
 AC_SUBST(CFLAGS_NOIMPLICIT_FALLTHROUGH)
 AC_SUBST(CFLAGS_NOCAST_FUNCTION_TYPE)
+AC_SUBST(CFLAGS_NODANGLING_POINTER)
 AC_SUBST(CFLAGS_WERROR)
 AC_SUBST(XCFLAGS64)
 AC_SUBST(XLDFLAGS)
index 76e2b0c..ff0abe8 100644 (file)
@@ -40,6 +40,10 @@ case $system in
                 MKAFS_OSTYPE=DARWIN
                 AC_MSG_RESULT(arm_darwin)
                 ;;
+        aarch64-*-darwin*)
+                MKAFS_OSTYPE=DARWIN
+                AC_MSG_RESULT(arm_darwin)
+                ;;
         powerpc-*-darwin*)
                 MKAFS_OSTYPE=DARWIN
                 AC_MSG_RESULT(ppc_darwin)
index 9a0927e..dbe62d5 100644 (file)
@@ -198,6 +198,10 @@ else
                        AFS_SYSNAME="arm_darwin_200"
                        OSXSDK="macosx11.0"
                        ;;
+               aarch64-apple-darwin20.*)
+                       AFS_SYSNAME="arm_darwin_200"
+                       OSXSDK="macosx11.0"
+                       ;;
                x86_64-apple-darwin21.*)
                        AFS_SYSNAME="x86_darwin_210"
                        OSXSDK="macosx12.0"
@@ -206,6 +210,34 @@ else
                        AFS_SYSNAME="arm_darwin_210"
                        OSXSDK="macosx12.0"
                        ;;
+               aarch64-apple-darwin21.*)
+                       AFS_SYSNAME="arm_darwin_210"
+                       OSXSDK="macosx12.0"
+                       ;;
+               x86_64-apple-darwin22.*)
+                       AFS_SYSNAME="x86_darwin_220"
+                       OSXSDK="macosx13.0"
+                       ;;
+               arm-apple-darwin22.*)
+                       AFS_SYSNAME="arm_darwin_220"
+                       OSXSDK="macosx13.0"
+                       ;;
+               aarch64-apple-darwin22.*)
+                       AFS_SYSNAME="arm_darwin_220"
+                       OSXSDK="macosx13.0"
+                       ;;
+               x86_64-apple-darwin23.*)
+                       AFS_SYSNAME="x86_darwin_230"
+                       OSXSDK="macosx14.0"
+                       ;;
+               arm-apple-darwin23.*)
+                       AFS_SYSNAME="arm_darwin_230"
+                       OSXSDK="macosx14.0"
+                       ;;
+               aarch64-apple-darwin23.*)
+                       AFS_SYSNAME="arm_darwin_230"
+                       OSXSDK="macosx14.0"
+                       ;;
                 sparc-sun-solaris2.8)
                         AFS_SYSNAME="sun4x_58"
                         ;;
@@ -298,17 +330,24 @@ else
                         AFS_SYSNAME="rs_aix61"
                         enable_pam="no"
                         ;;
+               power*-ibm-aix7.1*)
+                        AFS_SYSNAME="rs_aix71"
+                        enable_pam="no"
+                        ;;
                 power*-ibm-aix7.2*)
                         AFS_SYSNAME="rs_aix72"
                         enable_pam="no"
                         ;;
+                power*-ibm-aix7.3*)
+                        AFS_SYSNAME="rs_aix73"
+                        enable_pam="no"
+                        ;;
                 x86_64-*-linux-gnu)
                         AFS_SYSNAME="amd64_linuxXX"
                         enable_pam="yes"
                         ;;
                 *)
                         AC_MSG_ERROR(An AFS sysname is required)
-                        exit 1
                         ;;
         esac
         case $AFS_SYSNAME in
@@ -395,6 +434,12 @@ case $AFS_SYSNAME in
         *_darwin_210)
                 AFS_PARAM=param.darwin_210.h
                 ;;
+        *_darwin_220)
+                AFS_PARAM=param.darwin_220.h
+                ;;
+        *_darwin_230)
+                AFS_PARAM=param.darwin_230.h
+                ;;
         *)
                 AFS_PARAM=param.${AFS_SYSNAME}.h
                 ;;
index b40c26c..a867e1a 100644 (file)
@@ -37,7 +37,7 @@ et_lex.lex.c: et_lex.lex.l
 
 compile_et:    compile_et.o error_table.o
        $(Q)case $(SYS_NAME) in \
-       *_linux* | *_umlinux* | *_darwin* | rs_aix72 ) \
+       *_linux* | *_umlinux* | *_darwin* | rs_aix72 | rs_aix73 ) \
        $(LT_LDRULE_static_NOQ) compile_et.o error_table.o -L${TOP_LIBDIR} -lopr $(buildtool_roken) $(MT_LIBS);; \
        * ) \
        $(LT_LDRULE_static_NOQ) compile_et.o error_table.o -L${TOP_LIBDIR} -lopr -ll $(buildtool_roken) $(MT_LIBS);; \
index d173a12..ff3ddb7 100644 (file)
@@ -203,10 +203,10 @@ enum {
 
 /*
  * Note that the AFS_*ALLOCSIZ values should be multiples of sizeof(void*) to
- * accomodate pointer alignment.
+ * accommodate pointer alignment.
  */
 /* Used in rx.c as well as afs directory. */
-#if    defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)
+#if (defined(AFS_AIX32_ENV) && !defined(AFS_AIX61_ENV)) || defined(AFS_HPUX_ENV)
 /* XXX Because of rxkad_cprivate... XXX */
 #define AFS_SMALLOCSIZ         (38*sizeof(void *))     /* "Small" allocated size */
 #else
index 08c2ac1..196a5d9 100644 (file)
 #define SYS_NAME_ID_arm_darwin_200       546
 #define SYS_NAME_ID_amd64_darwin_210     547
 #define SYS_NAME_ID_arm_darwin_210       548
+#define SYS_NAME_ID_amd64_darwin_220     549
+#define SYS_NAME_ID_arm_darwin_220       550
+#define SYS_NAME_ID_amd64_darwin_230     551
+#define SYS_NAME_ID_arm_darwin_230       552
 
 #define SYS_NAME_ID_next_mach20                 601
 #define SYS_NAME_ID_next_mach30                 602
 #define SYS_NAME_ID_rs_aix53            707
 #define SYS_NAME_ID_rs_aix61            708
 #define SYS_NAME_ID_rs_aix72            709
+#define SYS_NAME_ID_rs_aix71            710
+#define SYS_NAME_ID_rs_aix73            711
 
 #define SYS_NAME_ID_sun3_411            906
 #define SYS_NAME_ID_sun3x_411           912
diff --git a/src/config/param.darwin_220.h b/src/config/param.darwin_220.h
new file mode 100644 (file)
index 0000000..c799c7f
--- /dev/null
@@ -0,0 +1,199 @@
+#ifndef AFS_PARAM_H
+# define AFS_PARAM_H
+
+# ifndef UKERNEL
+/* This section for kernel libafs compiles only */
+
+#  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_64BIT_SIZEOF            1 /* seriously? */
+
+#  include <afs/afs_sysnames.h>
+
+#  define AFS_DARWIN_ENV
+#  define AFS_DARWIN70_ENV
+#  define AFS_DARWIN80_ENV
+#  define AFS_DARWIN90_ENV
+#  define AFS_DARWIN100_ENV
+#  define AFS_DARWIN110_ENV
+#  define AFS_DARWIN120_ENV
+#  define AFS_DARWIN130_ENV
+#  define AFS_DARWIN140_ENV
+#  define AFS_DARWIN150_ENV
+#  define AFS_DARWIN160_ENV
+#  define AFS_DARWIN170_ENV
+#  define AFS_DARWIN180_ENV
+#  define AFS_DARWIN190_ENV
+#  define AFS_DARWIN200_ENV
+#  define AFS_DARWIN210_ENV
+#  define AFS_DARWIN220_ENV
+#  undef  AFS_NONFSTRANS
+#  define AFS_NONFSTRANS
+#  define AFS_SYSCALL                 230
+#  define AFS_NAMEI_ENV               1
+#  define DARWIN_REFBASE              3
+#  define AFS_WARNUSER_MARINER_ENV    1
+#  define AFS_CACHE_VNODE_PATH
+#  define AFS_NEW_BKG                 1
+#  define NEED_IOCTL32
+
+/* File system entry (used if mount.h doesn't define MOUNT_AFS) */
+#  define AFS_MOUNT_AFS               "afs"
+
+#  define AFS_HAVE_FFS                1        /* Use system's ffs. */
+
+#  define AFS_GCPAGS                  0
+#  define RXK_UPCALL_ENV              1
+#  define RXK_TIMEDSLEEP_ENV          1
+#  define AFS_USERSPACE_IP_ADDR       1
+#  define AFS_SOCKPROXY_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 AFS_KALLOC(x)              _MALLOC(x, M_TEMP, M_WAITOK)
+#   define AFS_KFREE(x,y)             _FREE(x,M_TEMP)
+
+#   define v_count                    v_usecount
+#   define v_vfsp                     v_mount
+#   define vfs_bsize                  mnt_stat.f_bsize
+#   define vfs_fsid                   mnt_stat.f_fsid
+#   define va_nodeid                  va_fileid
+#   define vfs_vnodecovered           mnt_vnodecovered
+#   define direct                     dirent
+
+#   define BIND_8_COMPAT
+#  endif /* KERNEL */
+
+# else /* !defined(UKERNEL) */
+
+/* This section for user space compiles only */
+
+#  define AFS_ENV                     1
+#  define AFS_64BIT_ENV               1        /* Defines afs_int32 as int, not long. */
+#  define AFS_64BIT_CLIENT            1
+
+#  include <afs/afs_sysnames.h>
+
+#  define AFS_USERSPACE_ENV
+#  define AFS_USR_DARWIN_ENV
+#  define AFS_USR_DARWIN70_ENV
+#  define AFS_USR_DARWIN80_ENV
+#  define AFS_USR_DARWIN90_ENV
+#  define AFS_USR_DARWIN100_ENV
+#  define AFS_USR_DARWIN110_ENV
+#  define AFS_USR_DARWIN120_ENV
+#  define AFS_USR_DARWIN130_ENV
+#  define AFS_USR_DARWIN140_ENV
+#  define AFS_USR_DARWIN150_ENV
+#  define AFS_USR_DARWIN160_ENV
+#  define AFS_USR_DARWIN170_ENV
+#  define AFS_USR_DARWIN180_ENV
+#  define AFS_USR_DARWIN190_ENV
+#  define AFS_USR_DARWIN200_ENV
+#  define AFS_USR_DARWIN210_ENV
+#  define AFS_USR_DARWIN220_ENV
+
+#  undef  AFS_NONFSTRANS
+#  define AFS_NONFSTRANS
+
+#  define AFS_SYSCALL                 230
+#  define DARWIN_REFBASE              0
+#  define AFS_WARNUSER_MARINER_ENV    1
+
+/* File system entry (used if mount.h doesn't define MOUNT_AFS) */
+#  define AFS_MOUNT_AFS               "afs"
+
+#  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 VATTR_NULL                  usr_vattr_null
+
+#  define AFS_DIRENT
+#  ifndef CMSERVERPREF
+#   define CMSERVERPREF
+#  endif
+
+#  define BIND_8_COMPAT
+# endif /* !defined(UKERNEL) */
+
+/* Machine / Operating system information */
+# if defined(__amd64__)
+
+#  define AFS_X86_ENV                 1
+#  define AFS_64BITUSERPOINTER_ENV    1
+
+#  define sys_x86_darwin_12           1
+#  define sys_x86_darwin_13           1
+#  define sys_x86_darwin_14           1
+#  define sys_x86_darwin_60           1
+#  define sys_x86_darwin_70           1
+#  define sys_x86_darwin_80           1
+#  define sys_x86_darwin_90           1
+#  define sys_x86_darwin_100          1
+#  define sys_amd64_darwin_100        1
+#  define sys_amd64_darwin_110        1
+#  define sys_amd64_darwin_120        1
+#  define sys_amd64_darwin_130        1
+#  define sys_amd64_darwin_140        1
+#  define sys_amd64_darwin_150        1
+#  define sys_amd64_darwin_160        1
+#  define sys_amd64_darwin_170        1
+#  define sys_amd64_darwin_180        1
+#  define sys_amd64_darwin_190        1
+#  define sys_amd64_darwin_200        1
+#  define sys_amd64_darwin_210        1
+#  define sys_amd64_darwin_220        1
+
+#  define SYS_NAME                    "amd64_darwin_220"
+#  define SYS_NAME_ID                 SYS_NAME_ID_amd64_darwin_220
+#  define AFSLITTLE_ENDIAN            1
+
+# elif defined(__arm64__)
+
+#  define AFS_ARM_ENV                 1
+#  define AFS_ARM64_DARWIN_ENV        1
+
+#  define sys_arm_darwin_200          1
+#  define sys_arm_darwin_210          1
+#  define sys_arm_darwin_220          1
+
+#  define SYS_NAME                    "arm_darwin_220"
+#  define SYS_NAME_ID                 SYS_NAME_ID_arm_darwin_220
+#  define AFSLITTLE_ENDIAN            1
+
+# else
+# error Unsupported architecture
+# endif /* __amd64__ */
+
+#endif /* AFS_PARAM_H */
diff --git a/src/config/param.darwin_230.h b/src/config/param.darwin_230.h
new file mode 100644 (file)
index 0000000..000ebb0
--- /dev/null
@@ -0,0 +1,203 @@
+#ifndef AFS_PARAM_H
+# define AFS_PARAM_H
+
+# ifndef UKERNEL
+/* This section for kernel libafs compiles only */
+
+#  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_64BIT_SIZEOF            1 /* seriously? */
+
+#  include <afs/afs_sysnames.h>
+
+#  define AFS_DARWIN_ENV
+#  define AFS_DARWIN70_ENV
+#  define AFS_DARWIN80_ENV
+#  define AFS_DARWIN90_ENV
+#  define AFS_DARWIN100_ENV
+#  define AFS_DARWIN110_ENV
+#  define AFS_DARWIN120_ENV
+#  define AFS_DARWIN130_ENV
+#  define AFS_DARWIN140_ENV
+#  define AFS_DARWIN150_ENV
+#  define AFS_DARWIN160_ENV
+#  define AFS_DARWIN170_ENV
+#  define AFS_DARWIN180_ENV
+#  define AFS_DARWIN190_ENV
+#  define AFS_DARWIN200_ENV
+#  define AFS_DARWIN210_ENV
+#  define AFS_DARWIN220_ENV
+#  define AFS_DARWIN230_ENV
+#  undef  AFS_NONFSTRANS
+#  define AFS_NONFSTRANS
+#  define AFS_SYSCALL                 230
+#  define AFS_NAMEI_ENV               1
+#  define DARWIN_REFBASE              3
+#  define AFS_WARNUSER_MARINER_ENV    1
+#  define AFS_CACHE_VNODE_PATH
+#  define AFS_NEW_BKG                 1
+#  define NEED_IOCTL32
+
+/* File system entry (used if mount.h doesn't define MOUNT_AFS) */
+#  define AFS_MOUNT_AFS               "afs"
+
+#  define AFS_HAVE_FFS                1        /* Use system's ffs. */
+
+#  define AFS_GCPAGS                  0
+#  define RXK_UPCALL_ENV              1
+#  define RXK_TIMEDSLEEP_ENV          1
+#  define AFS_USERSPACE_IP_ADDR       1
+#  define AFS_SOCKPROXY_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 AFS_KALLOC(x)              _MALLOC(x, M_TEMP, M_WAITOK)
+#   define AFS_KFREE(x,y)             _FREE(x,M_TEMP)
+
+#   define v_count                    v_usecount
+#   define v_vfsp                     v_mount
+#   define vfs_bsize                  mnt_stat.f_bsize
+#   define vfs_fsid                   mnt_stat.f_fsid
+#   define va_nodeid                  va_fileid
+#   define vfs_vnodecovered           mnt_vnodecovered
+#   define direct                     dirent
+
+#   define BIND_8_COMPAT
+#  endif /* KERNEL */
+
+# else /* !defined(UKERNEL) */
+
+/* This section for user space compiles only */
+
+#  define AFS_ENV                     1
+#  define AFS_64BIT_ENV               1        /* Defines afs_int32 as int, not long. */
+#  define AFS_64BIT_CLIENT            1
+
+#  include <afs/afs_sysnames.h>
+
+#  define AFS_USERSPACE_ENV
+#  define AFS_USR_DARWIN_ENV
+#  define AFS_USR_DARWIN70_ENV
+#  define AFS_USR_DARWIN80_ENV
+#  define AFS_USR_DARWIN90_ENV
+#  define AFS_USR_DARWIN100_ENV
+#  define AFS_USR_DARWIN110_ENV
+#  define AFS_USR_DARWIN120_ENV
+#  define AFS_USR_DARWIN130_ENV
+#  define AFS_USR_DARWIN140_ENV
+#  define AFS_USR_DARWIN150_ENV
+#  define AFS_USR_DARWIN160_ENV
+#  define AFS_USR_DARWIN170_ENV
+#  define AFS_USR_DARWIN180_ENV
+#  define AFS_USR_DARWIN190_ENV
+#  define AFS_USR_DARWIN200_ENV
+#  define AFS_USR_DARWIN210_ENV
+#  define AFS_USR_DARWIN220_ENV
+#  define AFS_USR_DARWIN230_ENV
+
+#  undef  AFS_NONFSTRANS
+#  define AFS_NONFSTRANS
+
+#  define AFS_SYSCALL                 230
+#  define DARWIN_REFBASE              0
+#  define AFS_WARNUSER_MARINER_ENV    1
+
+/* File system entry (used if mount.h doesn't define MOUNT_AFS) */
+#  define AFS_MOUNT_AFS               "afs"
+
+#  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 VATTR_NULL                  usr_vattr_null
+
+#  define AFS_DIRENT
+#  ifndef CMSERVERPREF
+#   define CMSERVERPREF
+#  endif
+
+#  define BIND_8_COMPAT
+# endif /* !defined(UKERNEL) */
+
+/* Machine / Operating system information */
+# if defined(__amd64__)
+
+#  define AFS_X86_ENV                 1
+#  define AFS_64BITUSERPOINTER_ENV    1
+
+#  define sys_x86_darwin_12           1
+#  define sys_x86_darwin_13           1
+#  define sys_x86_darwin_14           1
+#  define sys_x86_darwin_60           1
+#  define sys_x86_darwin_70           1
+#  define sys_x86_darwin_80           1
+#  define sys_x86_darwin_90           1
+#  define sys_x86_darwin_100          1
+#  define sys_amd64_darwin_100        1
+#  define sys_amd64_darwin_110        1
+#  define sys_amd64_darwin_120        1
+#  define sys_amd64_darwin_130        1
+#  define sys_amd64_darwin_140        1
+#  define sys_amd64_darwin_150        1
+#  define sys_amd64_darwin_160        1
+#  define sys_amd64_darwin_170        1
+#  define sys_amd64_darwin_180        1
+#  define sys_amd64_darwin_190        1
+#  define sys_amd64_darwin_200        1
+#  define sys_amd64_darwin_210        1
+#  define sys_amd64_darwin_220        1
+#  define sys_amd64_darwin_230        1
+
+#  define SYS_NAME                    "amd64_darwin_230"
+#  define SYS_NAME_ID                 SYS_NAME_ID_amd64_darwin_230
+#  define AFSLITTLE_ENDIAN            1
+
+# elif defined(__arm64__)
+
+#  define AFS_ARM_ENV                 1
+#  define AFS_ARM64_DARWIN_ENV        1
+
+#  define sys_arm_darwin_200          1
+#  define sys_arm_darwin_210          1
+#  define sys_arm_darwin_220          1
+#  define sys_arm_darwin_230          1
+
+#  define SYS_NAME                    "arm_darwin_230"
+#  define SYS_NAME_ID                 SYS_NAME_ID_arm_darwin_230
+#  define AFSLITTLE_ENDIAN            1
+
+# else
+# error Unsupported architecture
+# endif /* __amd64__ */
+
+#endif /* AFS_PARAM_H */
index 46b5aaf..f38c12c 100644 (file)
@@ -74,7 +74,6 @@
 #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)
diff --git a/src/config/param.rs_aix71.h b/src/config/param.rs_aix71.h
new file mode 100644 (file)
index 0000000..61874ea
--- /dev/null
@@ -0,0 +1,173 @@
+#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_AIX61_ENV          1
+#define AFS_AIX71_ENV          1
+
+#define AFS_64BIT_CLIENT       1
+#define AFS_NAMEI_ENV          1
+#ifdef AFS_NAMEI_ENV
+#define AFS_64BIT_IOPS_ENV     1
+#endif
+
+#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 */
+
+#define AFS_FSNO       4
+#define AFS_SYSCALL    31
+
+/* Machine / Operating system information */
+#define SYS_NAME       "rs_aix71"
+#define SYS_NAME_ID    SYS_NAME_ID_rs_aix71
+#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_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_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_CLIENT        1
+#define AFS_NAMEI_ENV           1
+#ifdef AFS_NAMEI_ENV
+#define AFS_64BIT_IOPS_ENV     1
+#endif
+
+#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
+
+#define AFS_FSNO        4
+
+/* Machine / Operating system information */
+#define sys_rs_aix51   1
+#define SYS_NAME       "rs_aix71"
+#define SYS_NAME_ID    SYS_NAME_ID_rs_aix71
+#define AFSBIG_ENDIAN  1
+#define AFS_HAVE_FFS            1      /* Use system's ffs. */
+#define AFS_HAVE_STATVFS       1       /* System supports 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        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 8289576..82c13e9 100644 (file)
@@ -21,6 +21,8 @@
 #define AFS_AIX52_ENV          1
 #define AFS_AIX53_ENV          1
 #define AFS_AIX61_ENV          1
+#define AFS_AIX71_ENV          1
+#define AFS_AIX72_ENV          1
 
 #define AFS_64BIT_CLIENT       1
 #define AFS_NAMEI_ENV          1
diff --git a/src/config/param.rs_aix73.h b/src/config/param.rs_aix73.h
new file mode 100644 (file)
index 0000000..8de7599
--- /dev/null
@@ -0,0 +1,174 @@
+#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_AIX61_ENV          1
+#define AFS_AIX71_ENV          1
+#define AFS_AIX72_ENV          1
+#define AFS_AIX73_ENV          1
+
+#define AFS_64BIT_CLIENT       1
+#define AFS_NAMEI_ENV          1
+#ifdef AFS_NAMEI_ENV
+#define AFS_64BIT_IOPS_ENV     1
+#endif
+
+#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 */
+
+#define AFS_FSNO       4
+#define AFS_SYSCALL    31
+
+/* Machine / Operating system information */
+#define SYS_NAME       "rs_aix73"
+#define SYS_NAME_ID    SYS_NAME_ID_rs_aix73
+#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_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_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_CLIENT        1
+#define AFS_NAMEI_ENV           1
+#ifdef AFS_NAMEI_ENV
+#define AFS_64BIT_IOPS_ENV     1
+#endif
+
+#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
+
+#define AFS_FSNO        4
+
+/* Machine / Operating system information */
+#define SYS_NAME       "rs_aix73"
+#define SYS_NAME_ID    SYS_NAME_ID_rs_aix73
+#define AFSBIG_ENDIAN  1
+#define AFS_HAVE_FFS            1      /* Use system's ffs. */
+#define AFS_HAVE_STATVFS       1       /* System supports 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        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 9623fa9..ea0f60b 100644 (file)
@@ -91,7 +91,13 @@ extern int osi_readRandom(void *, afs_size_t);
 static_inline pid_t getpid(void) {return 1;};
 #endif
 static_inline int open(const char *path, int flags, ...) {return -1;}
-static_inline void abort(void) {osi_Panic("hckernel aborting\n");}
+
+#ifdef abort
+# undef abort
+#endif
+#define abort _afscrypto_abort
+static_inline void _afscrypto_abort(void) {osi_Panic("hckernel aborting\n");}
+
 static_inline void rk_cloexec(int fd) {}
 static_inline ssize_t read(int d, void *buf, size_t nbytes) {return -1;}
 static_inline int close(int d) {return -1;}
index e69de29..f1b33e1 100644 (file)
@@ -0,0 +1,56 @@
+#ifndef OPENAFS_HCRYPTO_KERNEL_ROKEN_H
+#define OPENAFS_HCRYPTO_KERNEL_ROKEN_H
+
+/*
+ * This is a stub roken.h used for building roken code (or roken-using code) in
+ * the kernel. For userspace code, use a real roken.h. This just contains a few
+ * prototypes of roken functions we actually use in kernel code.
+ */
+
+#ifndef KERNEL
+# error "This header is for kernel code only"
+#endif
+
+/*
+ * The following function annotations are not needed when building for kernel
+ * space
+ */
+#define ROKEN_LIB_FUNCTION
+#define ROKEN_LIB_CALL
+#define ROKEN_LIB_VARIABLE
+
+/*
+ * Our HAVE_STRLCPY et al from autoconf refer to whether, e.g., strlcpy() is
+ * available in userspace. Whether it's available in the kernel is another
+ * question, so set them again here. Usually they are available (they are
+ * missing only for a few cases) so define them by default, and
+ * undefine them for a few cases below.
+ */
+#undef HAVE_STRLCPY
+#define HAVE_STRLCPY 1
+#undef HAVE_STRLCAT
+#define HAVE_STRLCAT 1
+
+#ifdef AFS_AIX_ENV
+# undef HAVE_STRLCPY
+# undef HAVE_STRLCAT
+#elif defined(AFS_LINUX_ENV) && defined(HAVE_LINUX_NO_STRLCPY)
+# undef HAVE_STRLCPY
+#endif
+
+/* strlcpy.c */
+#ifndef HAVE_STRLCPY
+# define strlcpy rk_strlcpy
+ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcpy (char *, const char *, size_t);
+#endif
+
+/* strlcat.c */
+#ifndef HAVE_STRLCAT
+# define strlcat rk_strlcat
+ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcat (char *, const char *, size_t);
+#endif
+
+/* ct.c */
+int ct_memcmp(const void *p1, const void *p2, size_t len);
+
+#endif /* OPENAFS_HCRYPTO_KERNEL_ROKEN_H */
index 6fce447..e389048 100644 (file)
@@ -48,6 +48,7 @@ ${TOP_LIBDIR}/libafsrfc3961.a: libafsrfc3961.a
 
 CFLAGS_crypto-arcfour.lo=@CFLAGS_NOERROR@
 CFLAGS_crypto-des-common.lo=@CFLAGS_NOERROR@
+CFLAGS_crypto.lo=@CFLAGS_USE_AFTER_FREE_GCCBUG@
 
 context.lo: context.c ${HEADERS}
 copy.lo: copy.c ${HEADERS}
index e7166fa..04292ee 100644 (file)
@@ -5,6 +5,7 @@
 #ifdef KERNEL
 
 #include "config.h"
+#include <roken.h>
 
 #else
 #include <afsconfig.h>
@@ -101,15 +102,34 @@ typedef enum krb5_salttype {
     KRB5_AFS3_SALT = 10
 } krb5_salttype;
 
-typedef enum krb5_keytype {
-    KEYTYPE_NULL        = 0,
-    KEYTYPE_DES         = 1,
-    KEYTYPE_DES3        = 7,
-    KEYTYPE_AES128      = 17,
-    KEYTYPE_AES256      = 18,
-    KEYTYPE_ARCFOUR     = 23,
-    KEYTYPE_ARCFOUR_56  = 24
-} krb5_keytype;
+/*
+ * Ew, gross!
+ *
+ * crypto.c from heimdal has hard-coded references to the symbol
+ * KEYTYPE_ARCFOUR and the enum krb5_keytype.  This enum is effectively
+ * deprecated, with comments like "Deprecated: keytypes doesn't exists, they
+ * are really enctypes" appearing near public APIs that handle krb5_keytypes.
+ *
+ * In particular, the internal "type" information about the struct
+ * _krb5_key_type is just a krb5_enctype, and the accessor to retrieve the
+ * alleged krb5_keytype value just returns this "type" (of type krb5_enctype)
+ * with an "XXX" comment but no cast.  Since krb5_keytype is otherwise unused
+ * for OpenAFS and we are not constrained to provide ABI compatible functions
+ * that expose the krb5_keytype type in the way that Heimdal is, just alias
+ * the deprecated krb5_keytype type to the underlying krb5_enctype to silence
+ * compiler warnings about implicit conversion between different enumeration
+ * types.
+ *
+ * The actual enum values are used in one place in the file, to check whether
+ * a checksum is an arcfour checksum, so provide an anonymous enum to alias
+ * that one consumer as well.
+ */
+
+typedef krb5_enctype krb5_keytype;
+
+enum {
+  KEYTYPE_ARCFOUR = ETYPE_ARCFOUR_HMAC_MD5
+};
 
 #define KRB5_ENCTYPE_NULL ETYPE_NULL
 #define KRB5_ENCTYPE_OLD_DES3_CBC_SHA1 ETYPE_OLD_DES3_CBC_SHA1
@@ -266,11 +286,138 @@ int copy_EncryptionKey(const krb5_keyblock *, krb5_keyblock *);
 krb5_error_code krb5_enctype_to_string(krb5_context context,
                                       krb5_enctype etype,
                                       char **string);
-#ifdef KERNEL
-/* Roken provides this in userspace, but we're on our own in the kernel. */
-int ct_memcmp(const void *p1, const void *p2, size_t len);
-#endif
 
+/*
+ * Unused prototypes from heimdal/krb5.  These are functions that are not used
+ * outside of their compilation unit at all, but we may need to declare them to
+ * avoid compiler warnings.
+ */
+struct _krb5_key_data;
+struct _krb5_encryption_type;
+/* heimdal/krb5/crypto.c */
+KRB5_LIB_FUNCTION krb5_error_code _krb5_derive_key(krb5_context context,
+                                                  struct _krb5_encryption_type *et,
+                                                  struct _krb5_key_data *key,
+                                                  const void *constant,
+                                                  size_t len);
+KRB5_LIB_FUNCTION krb5_error_code krb5_allow_weak_crypto(krb5_context context,
+                                                        krb5_boolean enable);
+KRB5_LIB_FUNCTION krb5_error_code krb5_checksum_disable(krb5_context context,
+                                                       krb5_cksumtype type);
+KRB5_LIB_FUNCTION krb5_boolean krb5_checksum_is_keyed(krb5_context context,
+                                                     krb5_cksumtype type);
+KRB5_LIB_FUNCTION krb5_error_code krb5_cksumtype_valid(krb5_context context,
+                                                      krb5_cksumtype ctype);
+KRB5_LIB_FUNCTION krb5_error_code krb5_create_checksum_iov(krb5_context context,
+                                                          krb5_crypto crypto,
+                                                          unsigned usage,
+                                                          krb5_crypto_iov *data,
+                                                          unsigned int num_data,
+                                                          krb5_cksumtype *type);
+KRB5_LIB_FUNCTION krb5_error_code krb5_crypto_getblocksize(krb5_context context,
+                                                          krb5_crypto crypto,
+                                                          size_t *blocksize);
+KRB5_LIB_FUNCTION krb5_error_code krb5_crypto_getenctype(krb5_context context,
+                                                        krb5_crypto crypto,
+                                                        krb5_enctype *enctype);
+KRB5_LIB_FUNCTION krb5_error_code krb5_crypto_getpadsize(krb5_context context,
+                                                        krb5_crypto crypto,
+                                                        size_t *padsize);
+KRB5_LIB_FUNCTION krb5_error_code krb5_crypto_length(krb5_context context,
+                                                    krb5_crypto crypto,
+                                                    int type,
+                                                    size_t *len);
+KRB5_LIB_FUNCTION krb5_error_code krb5_crypto_length_iov(krb5_context context,
+                                                        krb5_crypto crypto,
+                                                        krb5_crypto_iov *data,
+                                                        unsigned int num_data);
+KRB5_LIB_FUNCTION krb5_error_code krb5_decrypt_iov_ivec(krb5_context context,
+                                                       krb5_crypto crypto,
+                                                       unsigned usage,
+                                                       krb5_crypto_iov *data,
+                                                       unsigned int num_data,
+                                                       void *ivec);
+KRB5_LIB_FUNCTION krb5_error_code krb5_decrypt_ivec(krb5_context context,
+                                                   krb5_crypto crypto,
+                                                   unsigned usage,
+                                                   void *data,
+                                                   size_t len,
+                                                   krb5_data *result,
+                                                   void *ivec);
+KRB5_LIB_FUNCTION krb5_error_code krb5_encrypt_iov_ivec(krb5_context context,
+                                                       krb5_crypto crypto,
+                                                       unsigned usage,
+                                                       krb5_crypto_iov *data,
+                                                       int num_data,
+                                                       void *ivec);
+KRB5_LIB_FUNCTION krb5_error_code krb5_encrypt_ivec(krb5_context context,
+                                                   krb5_crypto crypto,
+                                                   unsigned usage,
+                                                   const void *data,
+                                                   size_t len,
+                                                   krb5_data *result,
+                                                   void *ivec);
+KRB5_LIB_FUNCTION krb5_error_code krb5_enctype_disable(krb5_context context,
+                                                      krb5_enctype enctype);
+KRB5_LIB_FUNCTION krb5_error_code krb5_enctype_enable(krb5_context context,
+                                                     krb5_enctype enctype);
+KRB5_LIB_FUNCTION krb5_error_code krb5_enctype_to_keytype(krb5_context context,
+                                                         krb5_enctype etype,
+                                                         krb5_keytype *keytype);
+KRB5_LIB_FUNCTION size_t krb5_get_wrapped_length (krb5_context context,
+                                                 krb5_crypto  crypto,
+                                                 size_t       data_len);
+KRB5_LIB_FUNCTION krb5_error_code krb5_hmac(krb5_context context,
+                                           krb5_cksumtype cktype,
+                                           const void *data,
+                                           size_t len,
+                                           unsigned usage,
+                                           krb5_keyblock *key,
+                                           Checksum *result);
+KRB5_LIB_FUNCTION krb5_boolean krb5_is_enctype_weak(krb5_context context,
+                                                   krb5_enctype enctype);
+KRB5_LIB_FUNCTION krb5_error_code krb5_string_to_enctype(krb5_context context,
+                                                        const char *string,
+                                                        krb5_enctype *etype);
+KRB5_LIB_FUNCTION krb5_error_code krb5_verify_checksum_iov(krb5_context context,
+                                                          krb5_crypto crypto,
+                                                          unsigned usage,
+                                                          krb5_crypto_iov *data,
+                                                          unsigned int num_data,
+                                                          krb5_cksumtype *type);
+KRB5_LIB_FUNCTION krb5_error_code krb5_generate_random_keyblock(krb5_context context,
+                                                               krb5_enctype type,
+                                                               krb5_keyblock *key);
+KRB5_LIB_FUNCTION krb5_boolean krb5_checksum_is_collision_proof(krb5_context context,
+                                                               krb5_cksumtype type);
+
+KRB5_LIB_FUNCTION krb5_error_code krb5_cksumtype_to_enctype(krb5_context context,
+                                                           krb5_cksumtype ctype,
+                                                           krb5_enctype *etype);
+KRB5_LIB_FUNCTION krb5_error_code krb5_encrypt_EncryptedData(krb5_context context,
+                                                            krb5_crypto crypto,
+                                                            unsigned usage,
+                                                            void *data,
+                                                            size_t len,
+                                                            int kvno,
+                                                            EncryptedData *result);
+KRB5_LIB_FUNCTION krb5_error_code krb5_crypto_getconfoundersize(krb5_context context,
+                                                               krb5_crypto crypto,
+                                                               size_t *confoundersize);
+
+KRB5_LIB_FUNCTION krb5_error_code krb5_decrypt_EncryptedData(krb5_context context,
+                                                            krb5_crypto crypto,
+                                                            unsigned usage,
+                                                            const EncryptedData *e,
+                                                            krb5_data *result);
+/* heimdal/krb5/data.c */
+KRB5_LIB_FUNCTION krb5_error_code krb5_data_realloc(krb5_data *p, int len);
+KRB5_LIB_FUNCTION krb5_error_code krb5_copy_data(krb5_context context,
+                                                const krb5_data *indata,
+                                                krb5_data **outdata);
+KRB5_LIB_FUNCTION int krb5_data_cmp(const krb5_data *data1, const krb5_data *data2);
+/* heimdal/krb5/store-int.c */
+KRB5_LIB_FUNCTION krb5_ssize_t _krb5_get_int(void *buffer, unsigned long *value, size_t size);
 
 #include "crypto.h"
 
index 2d3f6d7..8acc240 100644 (file)
@@ -60,5 +60,6 @@ dest: libdir.a dir.h
 #
 clean:
        $(RM) -f *.o *.a core AFS_component_version_number.c
+       cd test && $(MAKE) clean
 
 include ../config/Makefile.version
index 84a5e2c..b3d8b7b 100644 (file)
@@ -32,9 +32,7 @@
 #    include "h/kernel.h"
 #   endif
 #  endif
-#  if  defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DARWIN80_ENV)
-#   include "afs/sysincludes.h"
-#  endif
+#  include "afs/sysincludes.h"
 #  if !defined(AFS_SGI_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_OBSD48_ENV) && !defined(AFS_NBSD_ENV)
 #   include "h/user.h"
 #  endif /* AFS_SGI_ENV */
@@ -45,6 +43,7 @@
 #  ifndef AFS_LINUX_ENV
 #   include "netinet/in.h"
 #  endif
+#  include "afsincludes.h"
 # else /* !defined(UKERNEL) */
 #  include "afs/stds.h"
 #  include "afs/sysincludes.h"
@@ -97,7 +96,7 @@ afs_dir_Create(dir_file_t dir, char *entry, void *voidfid)
     int blobs, firstelt;
     int i;
     struct DirBuffer entrybuf, prevbuf, headerbuf;
-    struct DirEntry *ep;
+    struct DirEntryFlex *ep;
     struct DirHeader *dhp;
     int code;
     size_t rlen;
@@ -125,7 +124,7 @@ afs_dir_Create(dir_file_t dir, char *entry, void *voidfid)
     /* First, we fill in the directory entry. */
     if (afs_dir_GetBlob(dir, firstelt, &entrybuf) != 0)
        return EIO;
-    ep = (struct DirEntry *)entrybuf.data;
+    ep = entrybuf.data;
 
     ep->flag = FFIRST;
     ep->fid.vnode = htonl(vfid[1]);
index 3948689..25c450e 100644 (file)
@@ -51,6 +51,32 @@ struct DirHeader {
     unsigned short hashTable[NHASHENT];
 };
 
+/*
+ * This struct is just a copy of DirEntry, but with name defined as a flexible
+ * array if possible.
+ *
+ * Using this helps us convince safety-minded string functions (e.g.
+ * _FORTIFY_SOURCE) that an OpenAFS directory entry name really does fit
+ * in the allotted space, and thus avoid undefined behavior.
+ */
+struct DirEntryFlex {
+    char flag;
+    char length;                /* currently unused */
+    unsigned short next;
+    struct MKFid fid;
+#ifdef HAVE_FLEXIBLE_ARRAY
+    char name[];
+#else
+    char name[16];
+#endif
+};
+
+/*
+ * This struct was the original format for directory entries in very early
+ * versions of AFS.  But now it just represents the minimum possible on-disk
+ * representation of a directory entry.  The 16-character limit was relieved by
+ * the introduction of extension struct DirXEntry in AFS-2.
+*/
 struct DirEntry {
     /* A directory entry */
     char flag;
index 463323e..6d19949 100644 (file)
 #include <roken.h>
 
 #include "dir.h"
+#include <afs/afsint.h>            /* for AFSNAMEMAX */
+
 /* Defined in vol/vol-salvage.c */
 extern void Log(const char *format, ...)
     AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
 
-#define printf Log             /* To make it work with volume salvager */
-
 /* This routine is called with one parameter, the id (the same thing that is
  * passed to physio or the buffer package) of a directory to check.  It
  * returns 1 if the directory looks good, and 0 otherwise. */
 
-#define MAXENAME 256
-
 /* figure out how many pages in use in a directory, given ptr to its (locked)
  * header */
 static int
@@ -92,18 +90,18 @@ DirOK(void *file)
         * error.  Claim the dir is OK, but log something.
         */
        if (physerr != 0) {
-           printf("Could not read first page in directory (%d)\n", physerr);
+           Log("Could not read first page in directory (%d)\n", physerr);
            Die("dirok1");
            AFS_UNREACHED(return 1);
        }
-       printf("First page in directory does not exist.\n");
+       Log("First page in directory does not exist.\n");
        return 0;
     }
     dhp = (struct DirHeader *)headerbuf.data;
 
     /* Check magic number for first page */
     if (dhp->header.tag != htons(1234)) {
-       printf("Bad first pageheader magic number.\n");
+       Log("Bad first pageheader magic number.\n");
        DRelease(&headerbuf, 0);
        return 0;
     }
@@ -124,13 +122,13 @@ DirOK(void *file)
                /* First page's dirheader uses 13 entries and at least
                 * two must exist for "." and ".."
                 */
-               printf("The dir header alloc map for page %d is bad.\n", i);
+               Log("The dir header alloc map for page %d is bad.\n", i);
                DRelease(&headerbuf, 0);
                return 0;
            }
        } else {
            if ((j < 0) || (j > EPP)) {
-               printf("The dir header alloc map for page %d is bad.\n", i);
+               Log("The dir header alloc map for page %d is bad.\n", i);
                DRelease(&headerbuf, 0);
                return 0;
            }
@@ -139,9 +137,7 @@ DirOK(void *file)
        /* Check if contiguous */
        if (k) {                /* last page found */
            if (j != EPP) {     /* remaining entries must be EPP */
-               printf
-                   ("A partially-full page occurs in slot %d, after the dir end.\n",
-                    i);
+               Log("A partially-full page occurs in slot %d, after the dir end.\n", i);
                DRelease(&headerbuf, 0);
                return 0;
            }
@@ -158,8 +154,7 @@ DirOK(void *file)
      ** not exists for pages between MAXPAGES and BIGMAXPAGES */
     usedPages = ComputeUsedPages(dhp);
     if (usedPages < up) {
-       printf
-           ("Count of used directory pages does not match count in directory header\n");
+       Log("Count of used directory pages does not match count in directory header\n");
        DRelease(&headerbuf, 0);
        return 0;
     }
@@ -175,18 +170,18 @@ DirOK(void *file)
            DRelease(&headerbuf, 0);
            if (physerr != 0) {
                /* couldn't read page, but not because it wasn't there permanently */
-               printf("Failed to read dir page %d (errno %d)\n", i, physerr);
+               Log("Failed to read dir page %d (errno %d)\n", i, physerr);
                Die("dirok2");
                AFS_UNREACHED(return 1);
            }
-           printf("Directory shorter than alloMap indicates (page %d)\n", i);
+           Log("Directory shorter than alloMap indicates (page %d)\n", i);
            return 0;
        }
        pp = (struct PageHeader *)pagebuf.data;
 
        /* check the tag field */
        if (pp->tag != htons(1234)) {
-           printf("Directory page %d has a bad magic number.\n", i);
+           Log("Directory page %d has a bad magic number.\n", i);
            DRelease(&pagebuf, 0);
            DRelease(&headerbuf, 0);
            return 0;
@@ -219,9 +214,8 @@ DirOK(void *file)
 
        /* Now check that the count of free entries matches the count in the alloMap */
        if ((i < MAXPAGES) && ((count & 0xff) != (dhp->alloMap[i] & 0xff))) {
-           printf
-               ("Header alloMap count doesn't match count in freebitmap for page %d.\n",
-                i);
+           Log("Header alloMap count doesn't match count in freebitmap for page %d.\n",
+               i);
            DRelease(&pagebuf, 0);
            DRelease(&headerbuf, 0);
            return 0;
@@ -254,7 +248,7 @@ DirOK(void *file)
        for (entry = ntohs(dhp->hashTable[i]); entry; entry = ne) {
            /* Verify that the entry is within range */
            if (entry < 0 || entry >= maxents) {
-               printf("Out-of-range hash id %d in chain %d.\n", entry, i);
+               Log("Out-of-range hash id %d in chain %d.\n", entry, i);
                DRelease(&headerbuf, 0);
                return 0;
            }
@@ -266,12 +260,11 @@ DirOK(void *file)
                    /* something went wrong reading the page, but it wasn't
                     * really something wrong with the dir that we can fix.
                     */
-                   printf("Could not get dir blob %d (errno %d)\n", entry,
-                          physerr);
+                   Log("Could not get dir blob %d (errno %d)\n", entry, physerr);
                    DRelease(&headerbuf, 0);
                    Die("dirok3");
                }
-               printf("Invalid hash id %d in chain %d.\n", entry, i);
+               Log("Invalid hash id %d in chain %d.\n", entry, i);
                DRelease(&headerbuf, 0);
                return 0;
            }
@@ -281,7 +274,7 @@ DirOK(void *file)
 
            /* There can't be more than maxents entries */
            if (++entcount >= maxents) {
-               printf("Directory's hash chain %d is circular.\n", i);
+               Log("Directory's hash chain %d is circular.\n", i);
                DRelease(&entrybuf, 0);
                DRelease(&headerbuf, 0);
                return 0;
@@ -289,8 +282,7 @@ DirOK(void *file)
 
            /* A null name is no good */
            if (ep->name[0] == '\000') {
-               printf("Dir entry %p in chain %d has bogus (null) name.\n",
-                       ep, i);
+               Log("Dir entry %p in chain %d has bogus (null) name.\n", ep, i);
                DRelease(&entrybuf, 0);
                DRelease(&headerbuf, 0);
                return 0;
@@ -298,8 +290,7 @@ DirOK(void *file)
 
            /* The entry flag better be FFIRST */
            if (ep->flag != FFIRST) {
-               printf("Dir entry %p in chain %d has bogus flag field.\n",
-                       ep, i);
+               Log("Dir entry %p in chain %d has bogus flag field.\n", ep, i);
                DRelease(&entrybuf, 0);
                DRelease(&headerbuf, 0);
                return 0;
@@ -307,8 +298,8 @@ DirOK(void *file)
 
            /* Check the size of the name */
            j = strlen(ep->name);
-           if (j >= MAXENAME) {        /* MAXENAME counts the null */
-               printf("Dir entry %p in chain %d has too-long name.\n", ep, i);
+           if (j > AFSNAMEMAX) {           /* does not include the nul */
+               Log("Dir entry %p in chain %d has too-long name.\n", ep, i);
                DRelease(&entrybuf, 0);
                DRelease(&headerbuf, 0);
                return 0;
@@ -324,8 +315,8 @@ DirOK(void *file)
 
            /* Hash the name and make sure it is in the correct name hash */
            if ((j = afs_dir_DirHash(ep->name)) != i) {
-               printf("Dir entry %p should be in hash bucket %d but IS in %d.\n",
-                      ep, j, i);
+               Log("Dir entry %p should be in hash bucket %d but IS in %d.\n",
+                   ep, j, i);
                DRelease(&entrybuf, 0);
                DRelease(&headerbuf, 0);
                return 0;
@@ -336,9 +327,8 @@ DirOK(void *file)
                if (strcmp(ep->name, ".") == 0) {
                    havedot = 1;
                } else {
-                   printf
-                       ("Dir entry %p, index 13 has name '%s' should be '.'\n",
-                        ep, ep->name);
+                   Log("Dir entry %p, index 13 has name '%s' should be '.'\n",
+                       ep, ep->name);
                    DRelease(&entrybuf, 0);
                    DRelease(&headerbuf, 0);
                    return 0;
@@ -350,9 +340,8 @@ DirOK(void *file)
                if (strcmp(ep->name, "..") == 0) {
                    havedotdot = 1;
                } else {
-                   printf
-                       ("Dir entry %p, index 14 has name '%s' should be '..'\n",
-                        ep, ep->name);
+                   Log("Dir entry %p, index 14 has name '%s' should be '..'\n",
+                       ep, ep->name);
                    DRelease(&entrybuf, 0);
                    DRelease(&headerbuf, 0);
                    return 0;
@@ -367,8 +356,7 @@ DirOK(void *file)
 
     /* Verify that we found '.' and '..' in the correct place */
     if (!havedot || !havedotdot) {
-       printf
-           ("Directory entry '.' or '..' does not exist or is in the wrong index.\n");
+       Log("Directory entry '.' or '..' does not exist or is in the wrong index.\n");
        DRelease(&headerbuf, 0);
        return 0;
     }
@@ -380,9 +368,8 @@ DirOK(void *file)
     for (i = 0; i < usedPages; i++) {
        code = DReadWithErrno(file, i, &pagebuf, &physerr);
        if (code) {
-           printf
-               ("Failed on second attempt to read dir page %d (errno %d)\n",
-                i, physerr);
+           Log("Failed on second attempt to read dir page %d (errno %d)\n",
+               i, physerr);
            DRelease(&headerbuf, 0);
            /* if physerr is 0, then the dir is really bad, and we return dir
             * *not* OK.  Otherwise, we Die instead of returning true (1),
@@ -399,9 +386,8 @@ DirOK(void *file)
        count = i * (EPP / 8);
        for (j = 0; j < EPP / 8; j++) {
            if (eaMap[count + j] != pp->freebitmap[j]) {
-               printf
-                   ("Entry freebitmap error, page %d, map offset %d, %x should be %x.\n",
-                    i, j, pp->freebitmap[j], eaMap[count + j]);
+               Log("Entry freebitmap error, page %d, map offset %d, %x should be %x.\n",
+                   i, j, pp->freebitmap[j], eaMap[count + j]);
                DRelease(&pagebuf, 0);
                DRelease(&headerbuf, 0);
                return 0;
@@ -434,7 +420,7 @@ DirSalvage(void *fromFile, void *toFile, afs_int32 vn, afs_int32 vu,
           afs_int32 pvn, afs_int32 pvu)
 {
     afs_int32 dot[3], dotdot[3], lfid[3], code, usedPages;
-    char tname[256];
+    char tname[AFSNAMEMAX+1];
     int i;
     char *tp;
     struct DirBuffer headerbuf, entrybuf;
@@ -453,14 +439,14 @@ DirSalvage(void *fromFile, void *toFile, afs_int32 vn, afs_int32 vu,
 
     code = afs_dir_MakeDir(toFile, dot, dotdot);
     if (code) {
-       printf("Failed to create target directory\n");
+       Log("Failed to create target directory\n");
        return code;
     }
 
     /* Find out how many pages are valid. */
     code = DReadWithErrno(fromFile, 0, &headerbuf, &physerr);
     if (code) {
-       printf("Failed to read first page of fromDir!\n");
+       Log("Failed to read first page of fromDir!\n");
        /* if physerr != 0, then our call failed and we should let our
         * caller know that there's something wrong with the new dir.  If not,
         * then we return here anyway, with an empty, but at least good, directory.
@@ -478,28 +464,25 @@ DirSalvage(void *fromFile, void *toFile, afs_int32 vn, afs_int32 vu,
            if (!entry)
                break;
            if (entry < 0 || entry >= usedPages * EPP) {
-               printf
-                   ("Warning: bogus hash table entry encountered, ignoring.\n");
+               Log("Warning: bogus hash table entry encountered, ignoring.\n");
                break;
            }
 
            code = afs_dir_GetBlobWithErrno(fromFile, entry, &entrybuf, &physerr);
            if (code) {
                if (physerr != 0) {
-                   printf
-                       ("can't continue down hash chain (entry %d, errno %d)\n",
-                        entry, physerr);
+                   Log("can't continue down hash chain (entry %d, errno %d)\n",
+                       entry, physerr);
                    DRelease(&headerbuf, 0);
                    return physerr;
                }
-               printf
-                   ("Warning: bogus hash chain encountered, switching to next.\n");
+               Log("Warning: bogus hash chain encountered, switching to next.\n");
                break;
            }
            ep = (struct DirEntry *)entrybuf.data;
 
-           strncpy(tname, ep->name, MAXENAME);
-           tname[MAXENAME - 1] = '\000';       /* just in case */
+           strncpy(tname, ep->name, sizeof(tname));
+           tname[sizeof(tname) - 1] = '\0';    /* just in case */
            tp = tname;
 
            entry = ntohs(ep->next);
@@ -509,9 +492,8 @@ DirSalvage(void *fromFile, void *toFile, afs_int32 vn, afs_int32 vu,
                lfid[2] = ntohl(ep->fid.vunique);
                code = afs_dir_Create(toFile, tname, lfid);
                if (code) {
-                   printf
-                       ("Create of %s returned code %d, skipping to next hash chain.\n",
-                        tname, code);
+                   Log("Create of %s returned code %d, skipping to next hash chain.\n",
+                       tname, code);
                    DRelease(&entrybuf, 0);
                    break;
                }
index 8de20f3..7fbcf7e 100644 (file)
@@ -2,7 +2,11 @@
 #     git ls-files -i --exclude-standard
 # to check that you haven't inadvertently ignored any tracked files.
 
+/cfgafs
 /cfgafs64
+/cfgexport
 /cfgexport64
+/export64.exp
+/export64.ext
 /export.ext.nonfs
 /export64.ext.nonfs
index 58649e1..f104030 100644 (file)
@@ -62,7 +62,7 @@ export64.exp: ${srcdir}/export4-64.exp ${srcdir}/export5-64.exp
                cp -p ${srcdir}/export4-64.exp export64.exp ;; \
        rs_aix5* ) \
                cp -p ${srcdir}/export5-64.exp export64.exp ;; \
-       rs_aix6* ) \
+       rs_aix[67]* ) \
                cp -p ${srcdir}/export5-64.exp export64.exp ;; \
        esac
 
@@ -100,7 +100,7 @@ symtab.o symtab64.o: ${srcdir}/symtab.c
                mv symtab.o symtab64.o ; \
                $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -DAFS_AIX51_ENV \
                        -c ${srcdir}/symtab.c ;; \
-       rs_aix6* ) \
+       rs_aix[67]* ) \
                $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -q64 -D__XCOFF64__ \
                        -DAFS_64BIT_KERNEL -DAFS_AIX51_ENV \
                        -c ${srcdir}/symtab.c ; \
@@ -118,7 +118,7 @@ export.o export64.o: ${srcdir}/export.c
                mv export.o export64.o ; \
                $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -DAFS_AIX51_ENV \
                        -c ${srcdir}/export.c ;; \
-       rs_aix6* ) \
+       rs_aix[67]* ) \
                $(CC) $(AFS_CPPFLAGS) $(AFS_CFLAGS) -q64 \
                        -D__XCOFF64__ -DAFS_64BIT_KERNEL -DAFS_AIX51_ENV \
                        -c ${srcdir}/export.c ; \
@@ -139,7 +139,7 @@ export.nonfs.o export64.nonfs.o: ${srcdir}/export.c
                $(CC) $(CPPFLAGS) $(CFLAGS) ${INCS} -DAFS_NONFSTRANS \
                        -DAFS_AIX51_ENV -c ${srcdir}/export.c ; \
                mv export.o export.nonfs.o ;; \
-       rs_aix6* ) \
+       rs_aix[67]* ) \
                $(CC) $(CPPFLAGS) $(CFLAGS) -q64 ${INCS} -D__XCOFF64__ \
                        -DAFS_64BIT_KERNEL -DAFS_NONFSTRANS -DAFS_AIX51_ENV \
                        -c ${srcdir}/export.c ; \
@@ -192,15 +192,15 @@ install: $(EXPORTS32) $(EXPORTS64)
          ${INSTALL_DATA} export.exp ${DESTDIR}${libdir}/afs/export.exp ; \
          ${INSTALL_DATA} export.ext ${DESTDIR}${afskerneldir}/export.ext ; \
          ${INSTALL_DATA} export.ext.nonfs ${DESTDIR}${afskerneldir}/export.ext.nonfs ; \
-         ${INSTALL_DATA} cfgexport ${DESTDIR}${afskerneldir}/cfgexport ; \
-         ${INSTALL_DATA} cfgafs ${DESTDIR}${afskerneldir}/cfgafs ; \
+         ${INSTALL} cfgexport ${DESTDIR}${afskerneldir}/cfgexport ; \
+         ${INSTALL} cfgafs ${DESTDIR}${afskerneldir}/cfgafs ; \
        fi
        if [ "xyes" = "x$(AIX64)" ]; then \
          ${INSTALL_DATA} export64.exp ${DESTDIR}${libdir}/afs/export64.exp ; \
          ${INSTALL_DATA} export64.ext ${DESTDIR}${afskerneldir}/export64.ext ; \
          ${INSTALL_DATA} export64.ext.nonfs ${DESTDIR}${afskerneldir}/export64.ext.nonfs ; \
-         ${INSTALL_DATA} cfgexport64 ${DESTDIR}${afskerneldir}/cfgexport64 ; \
-         ${INSTALL_DATA} cfgafs64 ${DESTDIR}${afskerneldir}/cfgafs64 ; \
+         ${INSTALL} cfgexport64 ${DESTDIR}${afskerneldir}/cfgexport64 ; \
+         ${INSTALL} cfgafs64 ${DESTDIR}${afskerneldir}/cfgafs64 ; \
        fi
 
 dest: $(EXPORTS32) $(EXPORTS64)
index fb365df..a30c02e 100644 (file)
@@ -24,3 +24,5 @@ heimdal/krb5/crypto-evp.c
 heimdal/krb5/keyblock.c
 heimdal/krb5/store-int.c
 heimdal/roken/ct.c
+heimdal/roken/strlcat.c
+heimdal/roken/strlcpy.c
index 89878d8..1d04fca 100644 (file)
@@ -43,7 +43,7 @@ LIBS=${TOP_LIBDIR}/libubik.a \
        ${TOP_LIBDIR}/libafsrfc3961.a \
        ${XLIBS}
 
-OBJS=${TOP_SRCDIR}/afs/unified_afs.o
+OBJS=$(top_builddir)/src/afs/unified_afs.o
 
 all: translate_et
 
index e929668..89dfa7b 100644 (file)
@@ -535,6 +535,7 @@ FsCmd(
 ) = 220;
 
 #ifdef RPC_CLIENT
+%int RXAFS_ResidencyCmd(struct rx_connection *z_conn, AFSFid *Fid, struct FsCmdInputs *Inputs, struct FsCmdOutputs *Outputs);
 %int RXAFS_ResidencyCmd(struct rx_connection *z_conn, AFSFid *Fid, struct FsCmdInputs *Inputs, struct FsCmdOutputs *Outputs)
 %{
 %  return RXAFS_FsCmd(z_conn, Fid, Inputs, Outputs);
index 6af0f60..e7f147c 100644 (file)
@@ -16,6 +16,7 @@ RXAFS_GetStatistics
 RXAFS_GetStatistics64
 RXAFS_GiveUpCallBacks
 RXAFS_MakeDir
+RXAFS_OpCodeIndex
 RXAFS_ReleaseLock
 RXAFS_RemoveDir
 RXAFS_RemoveFile
index 6414bc3..6420003 100644 (file)
@@ -745,10 +745,3 @@ SRXAFSCB_TellMeAboutYourself(struct rx_call * rxcall,
      */
     return (0);
 }
-
-int SRXAFSCB_GetDE(struct rx_call *a_call, afs_int32 a_index,
-                  afs_int32 addr, afs_int32 inode, afs_int32 flags,
-                  afs_int32 time, char ** fileName)
-{
-    return RXGEN_OPCODE;
-}
index c63f643..e08bb68 100644 (file)
@@ -413,9 +413,10 @@ ka_NewKey(struct ubik_trans *tt, afs_int32 tentryaddr,
     int code, i;
     Date now = time(0);
     afs_int32 newkeyver;       /* new key version number */
-    afs_int32 newtotalkeyentries = 0, oldtotalkeyentries = 0, keyentries;
+    afs_int32 newtotalkeyentries = 0, keyentries;
     int addednewkey = 0, modified;
 #ifdef AUTH_DBM_LOG
+    afs_int32 oldtotalkeyentries = 0;
     int foundcurrentkey = 0;
 #endif
 
@@ -451,11 +452,12 @@ ka_NewKey(struct ubik_trans *tt, afs_int32 tentryaddr,
        keyentries = 0;         /* Number of valid key entries in the block */
        for (i = 0; i < NOLDKEYS; i++) {
            /* foreachkey */
+#ifdef AUTH_DBM_LOG
            /* Keep count of number of entries found */
            if (okeys.keys[i].superseded != 0) {
                oldtotalkeyentries++;
            }
-
+#endif
            /* If we find the entry that is not superseded, then supersede it */
            if (ntohl(okeys.keys[i].superseded) == NEVERDATE) {
                okeys.keys[i].superseded = htonl(now);
index 979e544..d5437f1 100644 (file)
@@ -15,6 +15,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 #include <afs/stds.h>
+#include <afs/opr.h>
 
 #include <roken.h>
 
@@ -228,7 +229,7 @@ static struct Acl *
 ParseAcl(char *astr)
 {
     int nplus, nminus, i, trights;
-    char tname[MAXNAME];
+    char tname[MAXNAME + 1] = "";
     struct AclEntry *first, *last, *tl;
     struct Acl *ta;
     sscanf(astr, "%d", &nplus);
@@ -242,7 +243,7 @@ ParseAcl(char *astr)
     last = 0;
     first = 0;
     for (i = 0; i < nplus; i++) {
-       sscanf(astr, "%100s %d", tname, &trights);
+       sscanf(astr, "%" opr_stringize(MAXNAME) "s %d", tname, &trights);
        SkipLine(astr);
        tl = malloc(sizeof(struct AclEntry));
        if (!first)
index b713e72..4798117 100644 (file)
@@ -1524,13 +1524,14 @@ util_RPCStatsGetDone(const void *iterationId, afs_status_p st)
  */
 
 int ADMINAPI
-util_RPCStatsStateGet(struct rx_connection *conn, 
-                     int (*rpc) (struct rx_connection *,
-                                 afs_RPCStatsState_p),
+util_RPCStatsStateGet(struct rx_connection *conn,
+                     afs_int32 (*rpc) (struct rx_connection *,
+                                       afs_int32 *),
                      afs_RPCStatsState_p state, afs_status_p st)
 {
     int rc = 0;
     afs_status_t tst = 0;
+    afs_int32 istate;
 
     if (conn == NULL) {
        tst = ADMRXCONNNULL;
@@ -1547,7 +1548,8 @@ util_RPCStatsStateGet(struct rx_connection *conn,
        goto fail_util_RPCStatsStateGet;
     }
 
-    tst = (*rpc) (conn, state);
+    tst = (*rpc) (conn, &istate);
+    *state = istate;
 
     if (!tst) {
        rc = 1;
index 3f4bdd2..c4e3d68 100644 (file)
@@ -65,8 +65,8 @@ extern int ADMINAPI util_RPCStatsGetDone(const void *iterationId,
                                         afs_status_p st);
 
 extern int ADMINAPI util_RPCStatsStateGet(struct rx_connection *conn,
-                                         int (*rpc) (struct rx_connection *,
-                                                     afs_RPCStatsState_p),
+                                         afs_int32 (*rpc) (struct rx_connection *,
+                                                     afs_int32 *),
                                          afs_RPCStatsState_p state,
                                          afs_status_p st);
 
index facd3d5..67bd35a 100644 (file)
@@ -2865,27 +2865,20 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
     afs_uint32 maxVolid = 0;
     struct nvldbentry entry;
     int noError = 1, error, same;
-    int totalC, totalU, totalCE, totalUE, totalG;
-    int counter;
     int aserver = ntohl(rx_HostOf(rx_PeerOf(server)));
     afs_status_t tst;
 
-    totalC = totalU = totalCE = totalUE = totalG = 0;
-    counter = 0;
-
     /* get the next  available id's from the vldb server */
     vcode = ubik_VL_GetNewVolumeId(cellHandle->vos, 0, 0, &maxVolid);
     if (vcode) {
        return (vcode);
     }
-    totalG = myQueue->count;
-    if (totalG == 0)
+    if (myQueue->count == 0)
        return 0;
     while (1) {
        Lp_QEnumerate(myQueue, &success, &elem, 0);
        if (!success)
            break;
-       counter++;
 
        if (!elem.isValid[RWVOL] && !elem.isValid[ROVOL] && !elem.isValid[BACKVOL]) {   /*something is wrong with elem */
            noError = 0;
@@ -2924,7 +2917,6 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
        aVLDB_GetEntryByID(cellHandle, elem.ids[RWVOL], RWVOL, &entry, &tst);
        if (tst && (tst != VL_NOENT)) {
            noError = 0;
-           totalCE++;
        } else if (tst && (tst == VL_NOENT)) {  /*entry doesnot exist */
            /*set up a vldb entry for elem */
            memset(&entry, 0, sizeof(entry));
@@ -2963,11 +2955,8 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
 
            }
            VLDB_CreateEntry(cellHandle, &entry, &tst);
-           if (tst) {
+           if (tst)
                noError = 0;
-               totalCE++;
-           } else
-               totalC++;
        } else {                /* Update the existing entry */
            strncpy(entry.name, elem.name, VOLSER_OLDMAXVOLNAME);       /*the name Could have changed */
 
@@ -3100,8 +3089,6 @@ ProcessEntries(afs_cell_handle_p cellHandle, struct qHead *myQueue,
                              LOCKREL_TIMESTAMP, &tst);
            if (tst) {
                noError = 0;
-               totalUE++;
-
                vcode =
                    ubik_VL_ReleaseLock(cellHandle->vos, 0,
                              elem.ids[RWVOL], RWVOL,
@@ -3493,7 +3480,6 @@ UV_SyncServer(afs_cell_handle_p cellHandle, struct rx_connection *server,
     afs_int32 nentries;
     struct VldbListByAttributes attributes;
     nbulkentries arrayEntries;
-    int totalF;
     struct nvldbentry *vllist;
     int j;
     afs_int32 si, nsi;
@@ -3519,12 +3505,10 @@ UV_SyncServer(afs_cell_handle_p cellHandle, struct rx_connection *server,
            goto fail_UV_SyncServer;
        }
        nsi = -1;
-       totalF = 0;
        for (j = 0; j < nentries; j++) {        /* process each entry */
            vllist = &arrayEntries.nbulkentries_val[j];
            if (!CheckVldb(cellHandle, vllist, &modified, &tst)) {
                noError = 0;
-               totalF++;
            }
        }
        if (arrayEntries.nbulkentries_val) {
index 2e77531..845eb41 100644 (file)
@@ -196,7 +196,9 @@ AFSAOBJS = \
        crypto-keyblock.o \
        crypto-store-int.o \
        crypto-random.o \
-       afs_uuid.o $(AFS_OS_OBJS)
+       afs_uuid.o      \
+       strlcat-kernel.o\
+       strlcpy-kernel.o $(AFS_OS_OBJS)
 
 # These next two allow nfs and nonfs builds to occur in the same directory.
 AFSNFSOBJS = \
@@ -281,7 +283,9 @@ AFSPAGOBJS = \
        xdr_afsuuid.o   \
        xdr.o           \
        Ktoken.xdr.o    \
-       afs_uuid.o $(AFS_OS_PAGOBJS)
+       afs_uuid.o      \
+       strlcat-kernel.o\
+       strlcpy-kernel.o $(AFS_OS_PAGOBJS)
 
 
 # Compilation rules
@@ -711,6 +715,10 @@ osi_crypto.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_crypto.c
        $(CRULE_OPT) $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_crypto.c
 osi_kstat.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_kstat.c
        $(CRULE_NOOPT) $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_kstat.c
+strlcat-kernel.o: $(TOP_SRCDIR)/external/heimdal/roken/strlcat.c
+       $(CRULE_OPT) $(TOP_SRCDIR)/external/heimdal/roken/strlcat.c
+strlcpy-kernel.o: $(TOP_SRCDIR)/external/heimdal/roken/strlcpy.c
+       $(CRULE_OPT) $(TOP_SRCDIR)/external/heimdal/roken/strlcpy.c
 
 clean:
        -$(RM) -rf STATIC* MODLOAD* $(AFS_OS_CLEAN)
index 697ba7a..acb9634 100644 (file)
@@ -83,7 +83,7 @@ DESTDIRS = aix_destdirs
 KMODS=32 
 <rs_aix50 rs_aix51 rs_aix52 rs_aix53>
 KMODS=32 64
-<rs_aix61>
+<rs_aix61 rs_aix71 rs_aix72 rs_aix73>
 KMODS=64
 <all>
 
@@ -156,7 +156,6 @@ install_afs.ext.32: afs.ext.32
 
 install_afs.ext.64: afs.ext.64
        ${INSTALL} -d $(DESTDIR)$(afskerneldir)
-       $(DESTDIR)$(afskerneldir)/afs.ext.64
        $(INSTALL) -m 644 afs.ext.64 $(DESTDIR)$(afskerneldir)/afs.ext.64
        -${STRIP} -X 64 $(DESTDIR)$(afskerneldir)/afs.ext.64
        $(INSTALL) -m 644 afs.ext.64.map $(DESTDIR)$(afskerneldir)/afs.ext.64.map
index 98b176d..2827500 100644 (file)
@@ -59,7 +59,7 @@ AFS_OS_PAGOBJS = \
        osi_flush.o \
 <all>
        osi_ioctl.o \
-       osi_pag_module.o 
+       osi_pag_module.o
 
 AFS_OS_NFSOBJS =
 
@@ -71,6 +71,7 @@ COMMON_DEFINES=-D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
 
 LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@
 LINUX_KERNEL_BUILD=@LINUX_KERNEL_BUILD@
+LINUX_KBUILD_CFLAGS_VAR=@LINUX_KBUILD_CFLAGS_VAR@
 
 CFLAGS_fcrypt.o = -I${TOP_SRCDIR}/rxkad -I$(TOP_OBJDIR)/src/rxkad
 CFLAGS_crypt_conn.o = -I${TOP_SRCDIR}/rxkad -I$(TOP_OBJDIR)/src/rxkad
diff --git a/src/libafs/afs.arm_darwin_220.plist.in b/src/libafs/afs.arm_darwin_220.plist.in
new file mode 100644 (file)
index 0000000..a138571
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>afs</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.openafs.filesystems.afs</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>8.0</string>
+       <key>CFBundleName</key>
+       <string>afs</string>
+       <key>CFBundlePackageType</key>
+       <string>KEXT</string>
+       <key>CFBundleShortVersionString</key>
+       <string>@MACOS_VERSION@</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>@MACOS_VERSION@</string>
+       <key>OSBundleLibraries</key>
+       <dict>
+               <key>com.apple.kpi.bsd</key>
+               <string>8.0.0</string>
+               <key>com.apple.kpi.mach</key>
+               <string>8.0.0</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>8.0</string>
+       </dict>
+</dict>
+</plist>
diff --git a/src/libafs/afs.arm_darwin_230.plist.in b/src/libafs/afs.arm_darwin_230.plist.in
new file mode 100644 (file)
index 0000000..a138571
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>afs</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.openafs.filesystems.afs</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>8.0</string>
+       <key>CFBundleName</key>
+       <string>afs</string>
+       <key>CFBundlePackageType</key>
+       <string>KEXT</string>
+       <key>CFBundleShortVersionString</key>
+       <string>@MACOS_VERSION@</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>@MACOS_VERSION@</string>
+       <key>OSBundleLibraries</key>
+       <dict>
+               <key>com.apple.kpi.bsd</key>
+               <string>8.0.0</string>
+               <key>com.apple.kpi.mach</key>
+               <string>8.0.0</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>8.0</string>
+       </dict>
+</dict>
+</plist>
diff --git a/src/libafs/afs.x86_darwin_220.plist.in b/src/libafs/afs.x86_darwin_220.plist.in
new file mode 100644 (file)
index 0000000..a138571
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>afs</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.openafs.filesystems.afs</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>8.0</string>
+       <key>CFBundleName</key>
+       <string>afs</string>
+       <key>CFBundlePackageType</key>
+       <string>KEXT</string>
+       <key>CFBundleShortVersionString</key>
+       <string>@MACOS_VERSION@</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>@MACOS_VERSION@</string>
+       <key>OSBundleLibraries</key>
+       <dict>
+               <key>com.apple.kpi.bsd</key>
+               <string>8.0.0</string>
+               <key>com.apple.kpi.mach</key>
+               <string>8.0.0</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>8.0</string>
+       </dict>
+</dict>
+</plist>
diff --git a/src/libafs/afs.x86_darwin_230.plist.in b/src/libafs/afs.x86_darwin_230.plist.in
new file mode 100644 (file)
index 0000000..a138571
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>afs</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.openafs.filesystems.afs</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>8.0</string>
+       <key>CFBundleName</key>
+       <string>afs</string>
+       <key>CFBundlePackageType</key>
+       <string>KEXT</string>
+       <key>CFBundleShortVersionString</key>
+       <string>@MACOS_VERSION@</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>@MACOS_VERSION@</string>
+       <key>OSBundleLibraries</key>
+       <dict>
+               <key>com.apple.kpi.bsd</key>
+               <string>8.0.0</string>
+               <key>com.apple.kpi.mach</key>
+               <string>8.0.0</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>8.0</string>
+       </dict>
+</dict>
+</plist>
index 3de680e..3302ebe 100755 (executable)
@@ -160,7 +160,13 @@ foreach (sort keys %vars) {
   next unless /^[AC]FLAGS_/;
   print $F "$_ = $vars{$_}\n";
 }
-print $F "EXTRA_CFLAGS=$cflags\n";
+
+if ($vars{LINUX_KBUILD_CFLAGS_VAR} ne "") {
+  print $F "$vars{LINUX_KBUILD_CFLAGS_VAR}=$cflags\n"
+} else {
+  die "Unable to set cflags";
+}
+
 print $F "obj-m := $TARG.o afspag.o\n";
 print $F "$TARG-objs := ", join("\\\n $_", @libafs_objs), "\n";
 print $F "afspag-objs := ", join("\\\n $_", @afspag_objs), "\n";
index 30bc93f..4791216 100644 (file)
@@ -493,6 +493,8 @@ clean:
        -$(RM) -rf PERLUAFS afs afsint config rx
        -$(RM) -rf h
        -$(RM) -f linktest $(AFS_OS_CLEAN)
+       -$(RM) -f *.o *.a
+       -${RM} -f AFS_component_version_number.c
 
 install: libuafs.a libuafs_pic.la @LIBUAFS_BUILD_PERL@
        ${INSTALL} -d ${DESTDIR}${libdir}
index 94fc6d4..2958889 100644 (file)
@@ -31,6 +31,7 @@
 #include <afs_usrops.h>
 #include <afs/cmd.h>
 #include <afs/afs_args.h>
+#include <afs/com_err.h>
 %}
 
 %include "typemaps.i";
index 39d7402..7a54196 100644 (file)
@@ -60,6 +60,7 @@ process.default.s:
 # Making process.o for $(SYS_NAME)
 # The files "process.s" and "process.S" may be used internally,
 # but will be removed after building the .o
+CFLAGS_process.o = @CFLAGS_NODANGLING_POINTER@
 process.o      : process.default.s process.i386.s process.amd64.s process.c lwp.o
        @set -x; case "$(SYS_NAME)" in \
        sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53  | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5* | arm_linux* ) \
index 8970c92..556d58b 100644 (file)
@@ -9,6 +9,11 @@
 
 /* assert.c */
 
+/* A simple macro to help show the value of #define'd constants. e.g. If 'FOO'
+ * is defined as 5, then opr_stringize(FOO) expands to "5" */
+#define opr_stringize_(s) #s
+#define opr_stringize(s) opr_stringize_(s)
+
 #ifdef AFS_NT40_ENV
 # define opr_abort() opr_NTAbort()
 extern void opr_NTAbort(void);
index 6e7e706..620ddae 100644 (file)
@@ -162,14 +162,26 @@ if [ $majorvers -ge 19 ]; then
     # If so, inform what needs to be done to load the client. This procedure is
     # unnecessary if OpenAFS is being reinstalled.
     if [ ! -d /afs ]; then
-       osascript -e 'display alert "OpenAFS successfully installed" message Â¬
-       "If OpenAFS is being installed for the first time on this machine, " & Â¬
-       "follow the steps below:\n\n" & Â¬
-       "1. Navigate to System Preferences > Security & Privacy;\n\n" & Â¬
-       "2. Under the General tab towards the bottom of the window, allow " & Â¬
-       "the OpenAFS kernel extension to load by clicking on Allow;\n\n" & Â¬
-       "3. Reboot the machine;\n\n" & Â¬
-       "Note: An entry for /afs was added in /etc/synthetic.conf. This " & Â¬
-       "change takes effect only after rebooting the system."'
+       if [ $majorvers -ge 22 ]; then
+               osascript -e 'display alert "OpenAFS successfully installed" message Â¬
+               "If OpenAFS is being installed for the first time on this machine, " & Â¬
+               "follow the steps below:\n\n" & Â¬
+               "1. Navigate to System Settings > Privacy & Security;\n\n" & Â¬
+               "2. Under the Security section towards the bottom of the window, allow " & Â¬
+               "the OpenAFS kernel extension to load by clicking on Allow;\n\n" & Â¬
+               "3. Reboot the machine;\n\n" & Â¬
+               "Note: An entry for /afs was added in /etc/synthetic.conf. This " & Â¬
+               "change takes effect only after rebooting the system."'
+       else
+               osascript -e 'display alert "OpenAFS successfully installed" message Â¬
+               "If OpenAFS is being installed for the first time on this machine, " & Â¬
+               "follow the steps below:\n\n" & Â¬
+               "1. Navigate to System Preferences > Security & Privacy;\n\n" & Â¬
+               "2. Under the General tab towards the bottom of the window, allow " & Â¬
+               "the OpenAFS kernel extension to load by clicking on Allow;\n\n" & Â¬
+               "3. Reboot the machine;\n\n" & Â¬
+               "Note: An entry for /afs was added in /etc/synthetic.conf. This " & Â¬
+               "change takes effect only after rebooting the system."'
+       fi
     fi
 fi
diff --git a/src/packaging/MacOS/ReadMe.rtf.22 b/src/packaging/MacOS/ReadMe.rtf.22
new file mode 100644 (file)
index 0000000..3efbf9b
--- /dev/null
@@ -0,0 +1,7 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww9000\viewh9000\viewkind0
+\pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural
+
+\f0\fs24 \cf0 This release of OpenAFS is targeted at MacOS 13.X (Ventura) and is not recommended for use with any other version.}
diff --git a/src/packaging/MacOS/ReadMe.rtf.23 b/src/packaging/MacOS/ReadMe.rtf.23
new file mode 100644 (file)
index 0000000..b8d18b8
--- /dev/null
@@ -0,0 +1,7 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf320
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\margl1440\margr1440\vieww9000\viewh9000\viewkind0
+\pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural
+
+\f0\fs24 \cf0 This release of OpenAFS is targeted at MacOS 14.X (Sonoma) and is not recommended for use with any other version.}
index 39b8608..edaa721 100644 (file)
@@ -173,6 +173,14 @@ elif [ x"$majorvers" = x21 ]; then
     RELNAME="Monterey"
     THISREL=17
     OSVER=12
+elif [ x"$majorvers" = x22 ]; then
+    RELNAME="Ventura"
+    THISREL=18
+    OSVER=13
+elif [ x"$majorvers" = x23 ]; then
+    RELNAME="Sonoma"
+    THISREL=19
+    OSVER=14
 
 
 elif [ x"$majorvers" = x ] ; then
index 7d6e1a9..9e8854c 100755 (executable)
@@ -19,11 +19,13 @@ use File::Spec;
 my $help = 0;
 my $man = 0;
 my $dir = ".";
+my $cellservdb_url;
 
 GetOptions(
     "help|?" => \$help,
     "man" => \$man,
     "dir=s" => \$dir,
+    "cellservdb-url=s" => \$cellservdb_url,
 ) or pod2usage(-exitval => 1, -verbose => 1);
 pod2usage(-exitval => 0, -verbose => 1) if $help;
 pod2usage(-exitval => 0, -verbose => 2, -noperldoc => 1) if $man;
@@ -133,22 +135,36 @@ undef $dirh;
 # This file needs particular modes.
 chmod 0755, $tmpdir."/rpmdir/SOURCES/openafs-kvers-is.sh";
 
-# Create the specfile. Use sed for this, cos its easier
-system("cat ".$srcdir."/src/packaging/RedHat/openafs.spec.in | ".
-       "sed -e 's/\@PACKAGE_VERSION\@/$afsversion/g' ".
-       "    -e 's/\@LINUX_PKGVER\@/$linuxver/g' ".
-       "    -e 's/\@LINUX_PKGREL\@/$linuxrel/g' ".
-       "    -e 's/\%define afsvers.*/%define afsvers $afsversion/g' ".
-       "    -e 's/\%define pkgvers.*/%define pkgvers $linuxver/g' > ".
-       $tmpdir."/rpmdir/SPECS/openafs.spec") == 0
-  or die "sed failed : $!\n";
+my $spec_template = "$srcdir/src/packaging/RedHat/openafs.spec.in";
+my $cellservdb_substitute = "";
+if ($cellservdb_url) {
+    # Set the CellServDB source URL in the generated the spec file.
+    $cellservdb_substitute = "-e 's%^Source20:.*%Source20: $cellservdb_url%'";
+} else {
+    # Extract the CellServDB source URL from the spec file template.
+    open(my $fh, $spec_template) or die "Unable to open $spec_template: $!\n";
+    while (<$fh>) {
+        if (/^Source20:\s*(.*)\s*$/) {
+            $cellservdb_url = $1;
+            last;
+        }
+    }
+    close($fh);
+    if (not $cellservdb_url) {
+        die "Unable to find CellServDB source directive in $spec_template\n";
+    }
+}
 
 if ($cellservdb) {
-    File::Copy::copy($cellservdb,
-                    $tmpdir."/rpmdir/SOURCES/$cellservdb")
-       or die "Unable to copy $cellservdb into position\n";
+    my $filename = File::Basename::fileparse($cellservdb_url);
+    my $dest = "$tmpdir/rpmdir/SOURCES/$filename";
+    print "Copying $cellservdb to $dest\n";
+    File::Copy::copy($cellservdb, "$dest")
+        or die "Unable to copy $cellservdb to $dest: $!\n";
 } else {
-    system("cd ".$tmpdir."/rpmdir/SOURCES && wget `cat ".$srcdir."/src/packaging/RedHat/openafs.spec.in |grep dl/cellservdb |awk '{print \$2}'`")
+    print "Downloading $cellservdb_url\n";
+    system("cd $tmpdir/rpmdir/SOURCES && wget $cellservdb_url") == 0
+        or die "Unable to download $cellservdb_url: $!\n";
 }
 
 if ($relnotes) {
@@ -169,6 +185,17 @@ if ($changelog) {
   system("touch $tmpdir/rpmdir/SOURCES/ChangeLog");
 }
 
+# Create the specfile. Use sed for this, cos its easier
+system("cat $spec_template | ".
+       "sed -e 's/\@PACKAGE_VERSION\@/$afsversion/g' ".
+       "    -e 's/\@LINUX_PKGVER\@/$linuxver/g' ".
+       "    -e 's/\@LINUX_PKGREL\@/$linuxrel/g' ".
+       "    -e 's/\%define afsvers.*/%define afsvers $afsversion/g' ".
+       "    -e 's/\%define pkgvers.*/%define pkgvers $linuxver/g' ".
+       "    $cellservdb_substitute  >".
+       "$tmpdir/rpmdir/SPECS/openafs.spec") == 0
+  or die "sed failed : $!\n";
+
 # Build an RPM
 system("rpmbuild -bs --nodeps --define \"dist %undefined\" ".
        "--define \"build_modules 0\" ".
@@ -220,6 +247,13 @@ Print full man page and exit.
 
 Place the generated SRPM file in I<path> instead of the current directory.
 
+=item B<--cellservdb-url> I<URL>
+
+The URL of the CellServDB file to be downloaded when B<cellservdb> is not
+specified, and the URL to be set in the C<Source20> source directive in the
+generated F<openafs.spec> RPM spec file.  When not specified, I<URL> is is read
+from the F<openafs.spec.in> file extracted from the source archive.
+
 =back
 
 =cut
diff --git a/src/packaging/RedHat/openafs-client.modules b/src/packaging/RedHat/openafs-client.modules
deleted file mode 100644 (file)
index 055d117..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-# Load the OpenAFS kernel module at boot
-exec /sbin/modprobe openafs
index 023af2c..a08c464 100644 (file)
@@ -114,7 +114,7 @@ Source1: http://www.openafs.org/dl/openafs/%{afsvers}/openafs-%{afsvers}-doc.tar
 Source10: http://www.openafs.org/dl/openafs/%{afsvers}/RELNOTES-%{afsvers}
 Source11: http://www.openafs.org/dl/openafs/%{afsvers}/ChangeLog
 
-Source20: https://www.central.org/dl/cellservdb/CellServDB.2018-05-14
+Source20: https://www.central.org/dl/cellservdb/CellServDB.2023-10-31
 
 Source996: openafs-kvers-is.sh
 Source997: openafs-buildfedora.pl
@@ -145,7 +145,6 @@ what gets built:
  --without authlibs               Disable authlibs package (default: with authlibs)
  --without krb5                   Disable krb5 support (default: with krb5)
  --with bitmap-later              Enable "bitmap later" support
- --with bos-restricted            Enable "bos restricted" mode
  --with supergroups               Enable "supergroups"
  --with kauth                     Build the openafs-kauth-server and openafs-kauth-client
                                   packages which contain the legacy kaserver and
@@ -545,7 +544,6 @@ PrintRedhatKernelFix() {
 config_opts="--enable-redhat-buildsys \
        %{?_with_kauth:--enable-kauth} \
        %{?_with_bitmap_later:--enable-bitmap-later} \
-       %{?_with_bos_restricted:--enable-bos-restricted-mode} \
        %{?_with_supergroups:--enable-supergroups} \
        --enable-transarc-paths"
 
@@ -816,7 +814,6 @@ install -m 755 src/packaging/RedHat/openafs-server.init $RPM_BUILD_ROOT%{initdir
 mkdir -p $RPM_BUILD_ROOT%{_unitdir}
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules
 install -m 644 src/packaging/RedHat/openafs-client.service $RPM_BUILD_ROOT%{_unitdir}/openafs-client.service
-install -m 755 src/packaging/RedHat/openafs-client.modules $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules/openafs-client.modules
 install -m 644 src/packaging/RedHat/openafs-server.service $RPM_BUILD_ROOT%{_unitdir}/openafs-server.service
 %endif
 
@@ -1209,7 +1206,6 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %{initdir}/openafs-client
 %else
 %{_unitdir}/openafs-client.service
-%{_sysconfdir}/sysconfig/modules/openafs-client.modules
 %endif
 %{_mandir}/man1/cmdebug.1.gz
 %{_mandir}/man1/up.1.gz
index bea96c0..7e1ac7e 100644 (file)
@@ -993,7 +993,6 @@ DumpRecreate(char map[], struct misc_data *misc)
     afs_int32 flags;
     afs_int32 owner;
     char *name;
-    int builtinUsers = 0;
     int createLow = 0;         /* users uncreate from here */
 #if defined(SUPERGROUPS)
     struct idused *idmap;      /* map of all id's */
@@ -1036,10 +1035,8 @@ DumpRecreate(char map[], struct misc_data *misc)
                    || !strcmp(e.name, "system:anyuser")
                    || !strcmp(e.name, "system:authuser")
                    || !strcmp(e.name, "system:backup")
-                   || !strcmp(e.name, "anonymous")) {
-                   builtinUsers++;
+                   || !strcmp(e.name, "anonymous"))
                    goto user_done;
-               }
 
                /* check for duplicate id.  This may still lead to duplicate
                 * names. */
index 90d6f16..1a0b1e1 100644 (file)
@@ -46,7 +46,7 @@ struct sourcestack {
 
 struct authstate {
     int sec;
-    const char *confdir;
+    int initialized;
     char cell[MAXCELLCHARS];
 };
 
@@ -186,6 +186,7 @@ GetGlobals(struct cmd_syndesc *as, void *arock)
     afs_int32 sec;
     int changed = 0;
     const char* confdir;
+    const char* retry_confdir;
     RXGK_Level rxgk_level = RXGK_LEVEL_BOGUS;
 
     whoami = as->a0name;
@@ -198,7 +199,7 @@ GetGlobals(struct cmd_syndesc *as, void *arock)
     }
     sec = state->sec;
 
-    if (state->confdir == NULL) {
+    if (state->initialized == 0) {
        changed = 1;
     }
 
@@ -229,16 +230,21 @@ GetGlobals(struct cmd_syndesc *as, void *arock)
     if (as->parms[OPT_test].items || as->parms[OPT_localauth].items) {
        changed = 1;
        confdir = AFSDIR_SERVER_ETC_DIRPATH;
+       retry_confdir = NULL;
     } else {
-       if (sec == 2)
+       if (sec == 2) {
            confdir = AFSDIR_SERVER_ETC_DIRPATH;
-       else
+           retry_confdir = NULL;
+       } else {
            confdir = AFSDIR_CLIENT_ETC_DIRPATH;
+           retry_confdir = AFSDIR_SERVER_ETC_DIRPATH;
+       }
     }
 
     if (as->parms[OPT_config].items) { /* -config */
        changed = 1;
        confdir = as->parms[OPT_config].items->data;
+       retry_confdir = NULL;
     }
 
     if (as->parms[OPT_rxgk].items) {
@@ -261,6 +267,11 @@ GetGlobals(struct cmd_syndesc *as, void *arock)
     if (changed) {
        CleanUp(as, arock);
        code = pr_Initialize2(sec, confdir, cell, rxgk_level);
+       if (code != 0 && retry_confdir != NULL) {
+           fprintf(stderr, "pts: Retrying initialization with directory %s\n",
+                   retry_confdir);
+           code = pr_Initialize2(sec, retry_confdir, cell, rxgk_level);
+       }
     } else {
        code = 0;
     }
@@ -269,7 +280,7 @@ GetGlobals(struct cmd_syndesc *as, void *arock)
        return code;
     }
     state->sec = sec;
-    state->confdir = confdir;
+    state->initialized = 1;
     if (cell && cell != state->cell)
         strncpy(state->cell, cell, MAXCELLCHARS-1);
 
index 0a36d1f..c16206f 100644 (file)
@@ -46,7 +46,7 @@ dest: $(SHARED_LIBS) librokenafs.a
 
 clean:
        $(LT_CLEAN)
-       $(RM) -f $(OBJECTS) librokenafs.a err.h roken.h
+       $(RM) -f *.o librokenafs.a err.h roken.h
 
 $(TOP_LIBDIR)/librokenafs.$(SHLIB_SUFFIX): librokenafs.la
        $(LT_INSTALL_DATA) librokenafs.la $(TOP_LIBDIR)/librokenafs.la
index 54a6c85..5f47ff6 100644 (file)
@@ -72,7 +72,12 @@ rxk_input(struct mbuf *am, int hlen)
  * are in a separate kernel extension, and they are unwilling to export their
  * symbols to us.  We can get there indirectly, however.
  */
-#include <net/netisr.h>
+#ifdef AFS_AIX72_ENV /* Avoid including net/netisr.h on AIX 7.2 and higher */
+# define NETISR_MAX    64
+# define NET_KPROC     0
+#else
+# include <net/netisr.h>
+#endif
 static struct ifqueue rxk_q;   /* RXKluge queue        */
 static struct arpcom rxk_bogosity;
 
index 42444e5..0ca67a5 100644 (file)
@@ -108,11 +108,11 @@ osi_HandleSocketError(osi_socket so, void *cmsgbuf, size_t cmsgbuf_len)
     int code;
     struct socket *sop = (struct socket *)so;
 
+    memset(&msg, 0, sizeof(msg));
     msg.msg_name = &addr;
     msg.msg_namelen = sizeof(addr);
     msg.msg_control = cmsgbuf;
     msg.msg_controllen = cmsgbuf_len;
-    msg.msg_flags = 0;
 
     code = kernel_recvmsg(sop, &msg, NULL, 0, 0,
                          MSG_ERRQUEUE|MSG_DONTWAIT|MSG_TRUNC);
@@ -153,12 +153,9 @@ osi_NetSend(osi_socket sop, struct sockaddr_in *to, struct iovec *iovec,
     struct msghdr msg;
     int code;
 
-
+    memset(&msg, 0, sizeof(msg));
     msg.msg_name = to;
     msg.msg_namelen = sizeof(*to);
-    msg.msg_control = NULL;
-    msg.msg_controllen = 0;
-    msg.msg_flags = 0;
 
     code = kernel_sendmsg(sop, &msg, (struct kvec *) iovec, iovcnt, size);
 
@@ -201,17 +198,8 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *from, struct iovec *iov,
     }
 
     memcpy(tmpvec, iov, iovcnt * sizeof(struct iovec));
+    memset(&msg, 0, sizeof(msg));
     msg.msg_name = from;
-#if defined(STRUCT_MSGHDR_HAS_MSG_ITER)
-    msg.msg_iter.iov = tmpvec;
-    msg.msg_iter.nr_segs = iovcnt;
-#else
-    msg.msg_iov = tmpvec;
-    msg.msg_iovlen = iovcnt;
-#endif
-    msg.msg_control = NULL;
-    msg.msg_controllen = 0;
-    msg.msg_flags = 0;
 
     code = kernel_recvmsg(sop, &msg, (struct kvec *)tmpvec, iovcnt,
                          *lengthp, 0);
index 2f7c6c5..66f6f01 100644 (file)
@@ -155,7 +155,6 @@ rx_ServerProc(void *unused)
      * number of threads handling incoming calls */
     threadID = rxi_availProcs++;
 
-    AFS_GUNLOCK();
     while (1) {
        sock = OSI_NULLSOCKET;
        rxi_ServerProc(threadID, newcall, &sock);
@@ -168,7 +167,6 @@ rx_ServerProc(void *unused)
        /* assert(threadID != -1); */
        /* assert(newcall != NULL); */
     }
-    AFS_GLOCK();
     return NULL;
 }
 
index d3e8ab0..7c82044 100644 (file)
@@ -33,6 +33,9 @@ rx_FreeStatistics
 rx_GetCachedConnection
 rx_GetCallAbortCode
 rx_GetCallStatus
+rx_GetConnDeadTime
+rx_GetConnHardDeadTime
+rx_GetConnIdleDeadTime
 rx_GetConnection
 rx_GetConnectionEpoch
 rx_GetConnectionId
index 8fb718f..5dfea93 100644 (file)
@@ -31,9 +31,7 @@
 #  endif
 #  include "afs/afs_args.h"
 #  include "afs/afs_osi.h"
-#  ifdef RX_KERNEL_TRACE
-#   include "rx_kcommon.h"
-#  endif
+#  include "rx_kcommon.h"
 #  if  defined(AFS_AIX_ENV)
 #   include "h/systm.h"
 #  endif
@@ -553,7 +551,7 @@ rx_InitHost(u_int host, u_int port)
 #endif /* RX_ENABLE_LOCKS && KERNEL */
 
     rxi_nCalls = 0;
-    rx_connDeadTime = 12;
+    rx_connDeadTime = RX_DEFAULT_DEAD_TIME;
     rx_tranquil = 0;           /* reset flag */
     rxi_ResetStatistics();
     htable = osi_Alloc(rx_hashTableSize * sizeof(struct rx_connection *));
@@ -1122,12 +1120,12 @@ rxi_CheckConnTimeouts(struct rx_connection *conn)
     /* a connection's timeouts must have the relationship
      * deadTime <= idleDeadTime <= hardDeadTime. Otherwise, for example, a
      * total loss of network to a peer may cause an idle timeout instead of a
-     * dead timeout, simply because the idle timeout gets hit first. Also set
-     * a minimum deadTime of 6, just to ensure it doesn't get set too low. */
+     * dead timeout, simply because the idle timeout gets hit first. Also
+     * enforce a minimum deadTime, just to ensure it doesn't get set too low. */
     /* this logic is slightly complicated by the fact that
      * idleDeadTime/hardDeadTime may not be set at all, but it's not too bad.
      */
-    conn->secondsUntilDead = MAX(conn->secondsUntilDead, 6);
+    conn->secondsUntilDead = MAX(conn->secondsUntilDead, RX_MINDEADTIME);
     if (conn->idleDeadTime) {
        conn->idleDeadTime = MAX(conn->idleDeadTime, conn->secondsUntilDead);
     }
@@ -1147,7 +1145,7 @@ rx_SetConnDeadTime(struct rx_connection *conn, int seconds)
      * keepalives to be dropped without timing out the connection. */
     conn->secondsUntilDead = seconds;
     rxi_CheckConnTimeouts(conn);
-    conn->secondsUntilPing = conn->secondsUntilDead / 6;
+    conn->secondsUntilPing = conn->secondsUntilDead / RX_PINGS_LOST_BEFORE_DEAD;
 }
 
 void
@@ -1164,6 +1162,24 @@ rx_SetConnIdleDeadTime(struct rx_connection *conn, int seconds)
     rxi_CheckConnTimeouts(conn);
 }
 
+int
+rx_GetConnDeadTime(struct rx_connection *conn)
+{
+    return conn->secondsUntilDead;
+}
+
+int
+rx_GetConnHardDeadTime(struct rx_connection *conn)
+{
+    return conn->hardDeadTime;
+}
+
+int
+rx_GetConnIdleDeadTime(struct rx_connection *conn)
+{
+    return conn->idleDeadTime;
+}
+
 int rxi_lowPeerRefCount = 0;
 int rxi_lowConnRefCount = 0;
 
@@ -3313,9 +3329,17 @@ rxi_ReceiveServerCall(osi_socket socket, struct rx_packet *np,
     struct rx_call *call;
 
     channel = np->header.cid & RX_CHANNELMASK;
+
     MUTEX_ENTER(&conn->conn_call_lock);
-    call = conn->call[channel];
 
+    if (np->header.callNumber < conn->callNumber[channel]) {
+       MUTEX_EXIT(&conn->conn_call_lock);
+       if (rx_stats_active)
+           rx_atomic_inc(&rx_stats.spuriousPacketsRead);
+       return NULL;
+    }
+
+    call = conn->call[channel];
     if (!call) {
        if (np->header.type != RX_PACKET_TYPE_DATA) {
            /*
@@ -3371,13 +3395,6 @@ rxi_ReceiveServerCall(osi_socket socket, struct rx_packet *np,
        return call;
     }
 
-    if (np->header.callNumber < conn->callNumber[channel]) {
-       MUTEX_EXIT(&conn->conn_call_lock);
-       if (rx_stats_active)
-           rx_atomic_inc(&rx_stats.spuriousPacketsRead);
-       return NULL;
-    }
-
     MUTEX_ENTER(&call->lock);
     MUTEX_EXIT(&conn->conn_call_lock);
 
@@ -6554,7 +6571,7 @@ mtuout:
     return -1;
 }
 
-void
+static void
 rxi_NatKeepAliveEvent(struct rxevent *event, void *arg1,
                      void *dummy, int dummy2)
 {
@@ -6656,7 +6673,7 @@ rx_SetConnSecondsUntilNatPing(struct rx_connection *conn, afs_int32 seconds)
  * declared dead; if nothing has been sent for a while, we send a
  * keep-alive packet (if we're actually trying to keep the call alive)
  */
-void
+static void
 rxi_KeepAliveEvent(struct rxevent *event, void *arg1, void *dummy,
                   int dummy2)
 {
@@ -6697,7 +6714,7 @@ rxi_KeepAliveEvent(struct rxevent *event, void *arg1, void *dummy,
 }
 
 /* Does what's on the nameplate. */
-void
+static void
 rxi_GrowMTUEvent(struct rxevent *event, void *arg1, void *dummy, int dummy2)
 {
     struct rx_call *call = arg1;
@@ -6764,7 +6781,7 @@ rxi_ScheduleGrowMTUEvent(struct rx_call *call, int secs)
        when = now;
        if (!secs) {
            if (call->conn->secondsUntilPing)
-               secs = (6*call->conn->secondsUntilPing)-1;
+               secs = (RX_PINGS_LOST_BEFORE_DEAD * call->conn->secondsUntilPing)-1;
 
            if (call->conn->secondsUntilDead)
                secs = MIN(secs, (call->conn->secondsUntilDead-1));
@@ -8309,7 +8326,7 @@ static int rxi_monitor_processStats = 0;
 static int rxi_monitor_peerStats = 0;
 
 
-void
+static void
 rxi_ClearRPCOpStat(rx_function_entry_v1_p rpc_stat)
 {
     rpc_stat->invocations = 0;
index c9fd112..bb5ea49 100644 (file)
@@ -163,7 +163,19 @@ extern u_short rx_PortOf(struct rx_peer *peer);
 
 /* Configurable parameters */
 #define RX_IDLE_DEAD_TIME      60      /* default idle dead time */
+#define RX_DEFAULT_DEAD_TIME   12      /* Default timeout for an unresponsive connection */
 #define RX_MAX_SERVICES                20      /* Maximum number of services that may be installed */
+/*
+ * The number of consecutive keepalives (ping acks) that must be lost/missing
+ * before declaring an rx_call dead timeout (RX_CALL_DEAD).  This number was
+ * chosen to be relatively small while allowing for "several" pings to be lost
+ * without triggering a timeout. (We are running on UDP after all).  Since the
+ * miniumum non-zero secondsUntilPing is 1 second, this also determines the
+ * minimum rx dead time.
+ */
+#define RX_PINGS_LOST_BEFORE_DEAD 6
+#define RX_MINDEADTIME (RX_PINGS_LOST_BEFORE_DEAD * 1)
+
 #if defined(KERNEL) && defined(AFS_AIX51_ENV) && defined(__64__)
 # define RX_DEFAULT_STACK_SIZE 24000
 #else
index 2979041..b075e29 100644 (file)
@@ -33,99 +33,117 @@ typedef struct {
 } rx_atomic_t;
 
 static_inline void
-rx_atomic_set(rx_atomic_t *atomic, int val) {
+rx_atomic_set(rx_atomic_t *atomic, int val)
+{
     atomic->var = val;
 }
 
 static_inline int
-rx_atomic_read(rx_atomic_t *atomic) {
+rx_atomic_read(rx_atomic_t *atomic)
+{
     return atomic->var;
 }
 
 static_inline void
-rx_atomic_inc(rx_atomic_t *atomic) {
+rx_atomic_inc(rx_atomic_t *atomic)
+{
     InterlockedIncrement(&atomic->var);
 }
 
 static_inline int
-rx_atomic_inc_and_read(rx_atomic_t *atomic) {
+rx_atomic_inc_and_read(rx_atomic_t *atomic)
+{
     return InterlockedIncrement(&atomic->var);
 }
 
 static_inline void
-rx_atomic_add(rx_atomic_t *atomic, int change) {
+rx_atomic_add(rx_atomic_t *atomic, int change)
+{
     InterlockedExchangeAdd(&atomic->var, change);
 }
 
 static_inline int
-rx_atomic_add_and_read(rx_atomic_t *atomic, int change) {
+rx_atomic_add_and_read(rx_atomic_t *atomic, int change)
+{
     return InterlockedExchangeAdd(&atomic->var, change) + change;
 }
 
 static_inline void
-rx_atomic_dec(rx_atomic_t *atomic) {
+rx_atomic_dec(rx_atomic_t *atomic)
+{
     InterlockedDecrement(&atomic->var);
 }
 
 static_inline int
-rx_atomic_dec_and_read(rx_atomic_t *atomic) {
+rx_atomic_dec_and_read(rx_atomic_t *atomic)
+{
     return InterlockedDecrement(&atomic->var);
 }
 
 static_inline void
-rx_atomic_sub(rx_atomic_t *atomic, int change) {
+rx_atomic_sub(rx_atomic_t *atomic, int change)
+{
     InterlockedExchangeAdd(&atomic->var, 0 - change);
 }
 
 #elif defined(AFS_AIX61_ENV) || defined(AFS_USR_AIX61_ENV)
-#include <sys/atomic_op.h>
+# include <sys/atomic_op.h>
 
 typedef struct {
    volatile int var;
 } rx_atomic_t;
 
 static_inline void
-rx_atomic_set(rx_atomic_t *atomic, int val) {
+rx_atomic_set(rx_atomic_t *atomic, int val)
+{
     atomic->var = val;
 }
 
 static_inline int
-rx_atomic_read(rx_atomic_t *atomic) {
+rx_atomic_read(rx_atomic_t *atomic)
+{
     return atomic->var;
 }
 
 static_inline void
-rx_atomic_inc(rx_atomic_t *atomic) {
+rx_atomic_inc(rx_atomic_t *atomic)
+{
     fetch_and_add(&atomic->var, 1);
 }
 
 static_inline int
-rx_atomic_inc_and_read(rx_atomic_t *atomic) {
+rx_atomic_inc_and_read(rx_atomic_t *atomic)
+{
     return (fetch_and_add(&atomic->var, 1) + 1);
 }
 
 static_inline void
-rx_atomic_add(rx_atomic_t *atomic, int change) {
+rx_atomic_add(rx_atomic_t *atomic, int change)
+{
     fetch_and_add(&atomic->var, change);
 }
 
 static_inline int
-rx_atomic_add_and_read(rx_atomic_t *atomic, int change) {
+rx_atomic_add_and_read(rx_atomic_t *atomic, int change)
+{
     return (fetch_and_add(&atomic->var, change) + change);
 }
 
 static_inline void
-rx_atomic_dec(rx_atomic_t *atomic) {
+rx_atomic_dec(rx_atomic_t *atomic)
+{
     fetch_and_add(&atomic->var, -1);
 }
 
 static_inline int
-rx_atomic_dec_and_read(rx_atomic_t *atomic) {
+rx_atomic_dec_and_read(rx_atomic_t *atomic)
+{
     return (fetch_and_add(&atomic->var, -1) - 1);
 }
 
 static_inline void
-rx_atomic_sub(rx_atomic_t *atomic, int change) {
+rx_atomic_sub(rx_atomic_t *atomic, int change)
+{
     fetch_and_add(&atomic->var, -change);
 }
 
@@ -155,71 +173,79 @@ OSAtomicDecrement32(volatile int *value)
 {
     return OSDecrementAtomic(value) - 1;
 }
-
-# endif
+# endif /* KERNEL && !UKERNEL */
 
 typedef struct {
     volatile int var;
 } rx_atomic_t;
 
 static_inline void
-rx_atomic_set(rx_atomic_t *atomic, int val) {
+rx_atomic_set(rx_atomic_t *atomic, int val)
+{
     atomic->var = val;
 }
 
 static_inline int
-rx_atomic_read(rx_atomic_t *atomic) {
+rx_atomic_read(rx_atomic_t *atomic)
+{
     return atomic->var;
 }
 
 static_inline void
-rx_atomic_inc(rx_atomic_t *atomic) {
+rx_atomic_inc(rx_atomic_t *atomic)
+{
     OSAtomicIncrement32(&atomic->var);
 }
 
 static_inline int
-rx_atomic_inc_and_read(rx_atomic_t *atomic) {
+rx_atomic_inc_and_read(rx_atomic_t *atomic)
+{
     return OSAtomicIncrement32(&atomic->var);
 }
 
 static_inline void
-rx_atomic_add(rx_atomic_t *atomic, int change) {
+rx_atomic_add(rx_atomic_t *atomic, int change)
+{
     OSAtomicAdd32(change, &atomic->var);
 }
 
 static_inline int
-rx_atomic_add_and_read(rx_atomic_t *atomic, int change) {
+rx_atomic_add_and_read(rx_atomic_t *atomic, int change)
+{
     return OSAtomicAdd32(change, &atomic->var);
 }
 
 static_inline void
-rx_atomic_dec(rx_atomic_t *atomic) {
+rx_atomic_dec(rx_atomic_t *atomic)
+{
     OSAtomicDecrement32(&atomic->var);
 }
 
 static_inline int
-rx_atomic_dec_and_read(rx_atomic_t *atomic) {
+rx_atomic_dec_and_read(rx_atomic_t *atomic)
+{
     return OSAtomicDecrement32(&atomic->var);
 }
 
 static_inline void
-rx_atomic_sub(rx_atomic_t *atomic, int change) {
+rx_atomic_sub(rx_atomic_t *atomic, int change)
+{
     OSAtomicAdd32(0 - change, &atomic->var);
 }
 #elif defined(AFS_LINUX_ENV) && defined(KERNEL)
-#include <asm/atomic.h>
+# include <asm/atomic.h>
 
 typedef atomic_t rx_atomic_t;
 
-#define rx_atomic_set(X, V)      atomic_set(X, V)
-#define rx_atomic_read(X)        atomic_read(X)
-#define rx_atomic_inc(X)         atomic_inc(X)
-#define rx_atomic_inc_and_read(X) atomic_inc_return(X)
-#define rx_atomic_add(X, V)      atomic_add(V, X)
-#define rx_atomic_add_and_read(X, V) atomic_add_return(V, X)
-#define rx_atomic_dec(X)         atomic_dec(X)
-#define rx_atomic_dec_and_read(X) atomic_dec_return(X)
-#define rx_atomic_sub(X, V)      atomic_sub(V, X)
+# define rx_atomic_set(X, V)     atomic_set(X, V)
+# define rx_atomic_read(X)       atomic_read(X)
+# define rx_atomic_inc(X)        atomic_inc(X)
+# define rx_atomic_inc_and_read(X) atomic_inc_return(X)
+# define rx_atomic_add(X, V)     atomic_add(V, X)
+# define rx_atomic_add_and_read(X, V) atomic_add_return(V, X)
+# define rx_atomic_dec(X)        atomic_dec(X)
+# define rx_atomic_dec_and_read(X) atomic_dec_return(X)
+# define rx_atomic_sub(X, V)     atomic_sub(V, X)
 
 #elif defined(AFS_SUN510_ENV) || (defined(AFS_SUN5_ENV) && defined(KERNEL) && !defined(UKERNEL))
 
@@ -229,59 +255,68 @@ typedef atomic_t rx_atomic_t;
 #  include <atomic.h>
 # endif
 
-#ifndef AFS_SUN510_ENV
-# define atomic_inc_32(X)    atomic_add_32((X), 1)
-# define atomic_inc_32_nv(X) atomic_add_32_nv((X), 1)
-# define atomic_dec_32(X)    atomic_add_32((X), -1)
-# define atomic_dec_32_nv(X) atomic_add_32_nv((X), -1)
-#endif
+# ifndef AFS_SUN510_ENV
+#  define atomic_inc_32(X)    atomic_add_32((X), 1)
+#  define atomic_inc_32_nv(X) atomic_add_32_nv((X), 1)
+#  define atomic_dec_32(X)    atomic_add_32((X), -1)
+#  define atomic_dec_32_nv(X) atomic_add_32_nv((X), -1)
+# endif
 
 typedef struct {
     volatile unsigned int var;
 } rx_atomic_t;
 
 static_inline void
-rx_atomic_set(rx_atomic_t *atomic, int val) {
+rx_atomic_set(rx_atomic_t *atomic, int val)
+{
     atomic->var = val;
 }
 
 static_inline int
-rx_atomic_read(rx_atomic_t *atomic) {
+rx_atomic_read(rx_atomic_t *atomic)
+{
     return atomic->var;
 }
 
 static_inline void
-rx_atomic_inc(rx_atomic_t *atomic) {
+rx_atomic_inc(rx_atomic_t *atomic)
+{
     atomic_inc_32(&atomic->var);
 }
 
 static_inline int
-rx_atomic_inc_and_read(rx_atomic_t *atomic) {
+rx_atomic_inc_and_read(rx_atomic_t *atomic)
+{
     return atomic_inc_32_nv(&atomic->var);
 }
 
 static_inline void
-rx_atomic_add(rx_atomic_t *atomic, int change) {
+rx_atomic_add(rx_atomic_t *atomic, int change)
+{
     atomic_add_32(&atomic->var, change);
 }
 
 static_inline int
-rx_atomic_add_and_read(rx_atomic_t *atomic, int change) {
+rx_atomic_add_and_read(rx_atomic_t *atomic, int change)
+{
     return atomic_add_32_nv(&atomic->var, change);
 }
 
 static_inline void
-rx_atomic_dec(rx_atomic_t *atomic) {
+rx_atomic_dec(rx_atomic_t *atomic)
+{
     atomic_dec_32(&atomic->var);
 }
 
 static_inline int
-rx_atomic_dec_and_read(rx_atomic_t *atomic) {
+rx_atomic_dec_and_read(rx_atomic_t *atomic)
+{
     return atomic_dec_32_nv(&atomic->var);
 }
 
 static_inline void
-rx_atomic_sub(rx_atomic_t *atomic, int change) {
+rx_atomic_sub(rx_atomic_t *atomic, int change)
+{
     atomic_add_32(&atomic->var, 0 - change);
 }
 
@@ -292,74 +327,86 @@ typedef struct {
 } rx_atomic_t;
 
 static_inline void
-rx_atomic_set(rx_atomic_t *atomic, int val) {
+rx_atomic_set(rx_atomic_t *atomic, int val)
+{
     atomic->var = val;
 }
 
 static_inline int
-rx_atomic_read(rx_atomic_t *atomic) {
+rx_atomic_read(rx_atomic_t *atomic)
+{
     return atomic->var;
 }
 
 static_inline void
-rx_atomic_inc(rx_atomic_t *atomic) {
+rx_atomic_inc(rx_atomic_t *atomic)
+{
     (void)__sync_fetch_and_add(&atomic->var, 1);
 }
 
 static_inline int
-rx_atomic_inc_and_read(rx_atomic_t *atomic) {
+rx_atomic_inc_and_read(rx_atomic_t *atomic)
+{
     return __sync_add_and_fetch(&atomic->var, 1);
 }
 
 static_inline void
-rx_atomic_add(rx_atomic_t *atomic, int change) {
+rx_atomic_add(rx_atomic_t *atomic, int change)
+{
     (void)__sync_fetch_and_add(&atomic->var, change);
 }
 
 static_inline int
-rx_atomic_add_and_read(rx_atomic_t *atomic, int change) {
-    return __sync_fetch_and_add(&atomic->var, change);
+rx_atomic_add_and_read(rx_atomic_t *atomic, int change)
+{
+    return __sync_add_and_fetch(&atomic->var, change);
 }
 
 static_inline void
-rx_atomic_dec(rx_atomic_t *atomic) {
+rx_atomic_dec(rx_atomic_t *atomic)
+{
     (void)__sync_fetch_and_sub(&atomic->var, 1);
 }
 
 static_inline int
-rx_atomic_dec_and_read(rx_atomic_t *atomic) {
+rx_atomic_dec_and_read(rx_atomic_t *atomic)
+{
     return __sync_sub_and_fetch(&atomic->var, 1);
 }
 
 static_inline void
-rx_atomic_sub(rx_atomic_t *atomic, int change) {
+rx_atomic_sub(rx_atomic_t *atomic, int change)
+{
     (void)__sync_fetch_and_sub(&atomic->var, change);
 }
 
-#else
+#else /* AFS_NT40_ENV */
 
-/* If we're on a platform where we have no idea how to do atomics,
- * then we fall back to using a single process wide mutex to protect
- * all atomic variables. This won't be the quickest thing ever.
+/*
+ * If we're on a platform where we have no idea how to do atomics, then we fall
+ * back to using a single process wide mutex to protect all atomic variables.
+ * This won't be the quickest thing ever.
  */
 
-#ifdef RX_ENABLE_LOCKS
+# ifdef RX_ENABLE_LOCKS
 extern afs_kmutex_t rx_atomic_mutex;
-#endif
+# endif
 
 typedef struct {
     int var;
 } rx_atomic_t;
 
 static_inline void
-rx_atomic_set(rx_atomic_t *atomic, int val) {
+rx_atomic_set(rx_atomic_t *atomic, int val)
+{
     MUTEX_ENTER(&rx_atomic_mutex);
     atomic->var = val;
     MUTEX_EXIT(&rx_atomic_mutex);
 }
 
 static_inline int
-rx_atomic_read(rx_atomic_t *atomic) {
+rx_atomic_read(rx_atomic_t *atomic)
+{
     int out;
 
     MUTEX_ENTER(&rx_atomic_mutex);
@@ -370,14 +417,16 @@ rx_atomic_read(rx_atomic_t *atomic) {
 }
 
 static_inline void
-rx_atomic_inc(rx_atomic_t *atomic) {
+rx_atomic_inc(rx_atomic_t *atomic)
+{
    MUTEX_ENTER(&rx_atomic_mutex);
    atomic->var++;
    MUTEX_EXIT(&rx_atomic_mutex);
 }
 
 static_inline int
-rx_atomic_inc_and_read(rx_atomic_t *atomic) {
+rx_atomic_inc_and_read(rx_atomic_t *atomic)
+{
     int retval;
     MUTEX_ENTER(&rx_atomic_mutex);
     atomic->var++;
@@ -387,14 +436,16 @@ rx_atomic_inc_and_read(rx_atomic_t *atomic) {
 }
 
 static_inline void
-rx_atomic_add(rx_atomic_t *atomic, int change) {
+rx_atomic_add(rx_atomic_t *atomic, int change)
+{
     MUTEX_ENTER(&rx_atomic_mutex);
     atomic->var += change;
     MUTEX_EXIT(&rx_atomic_mutex);
 }
 
 static_inline int
-rx_atomic_add_and_read(rx_atomic_t *atomic, int change) {
+rx_atomic_add_and_read(rx_atomic_t *atomic, int change)
+{
     int retval;
 
     MUTEX_ENTER(&rx_atomic_mutex);
@@ -406,14 +457,16 @@ rx_atomic_add_and_read(rx_atomic_t *atomic, int change) {
 }
 
 static_inline void
-rx_atomic_dec(rx_atomic_t *atomic) {
+rx_atomic_dec(rx_atomic_t *atomic)
+{
     MUTEX_ENTER(&rx_atomic_mutex);
     atomic->var--;
     MUTEX_EXIT(&rx_atomic_mutex);
 }
 
 static_inline int
-rx_atomic_dec_and_read(rx_atomic_t *atomic) {
+rx_atomic_dec_and_read(rx_atomic_t *atomic)
+{
     int retval;
     MUTEX_ENTER(&rx_atomic_mutex);
     atomic->var--;
@@ -424,12 +477,13 @@ rx_atomic_dec_and_read(rx_atomic_t *atomic) {
 
 
 static_inline void
-rx_atomic_sub(rx_atomic_t *atomic, int change) {
+rx_atomic_sub(rx_atomic_t *atomic, int change)
+{
     MUTEX_ENTER(&rx_atomic_mutex);
     atomic->var -= change;
     MUTEX_EXIT(&rx_atomic_mutex);
 }
 
-#endif
+#endif /* AFS_NT40_ENV */
 
-#endif
+#endif /* OPENAFS_RX_ATOMIC_H */
index 6638e5b..c3fb672 100644 (file)
@@ -126,8 +126,8 @@ rxevent_alloc(void) {
        mrec->next = freeEvents.mallocs;
        freeEvents.mallocs = mrec;
        MUTEX_EXIT(&freeEvents.lock);
-#endif
        ev = &evlist[0];
+#endif
     } else {
        ev = opr_queue_First(&freeEvents.list, struct rxevent, q);
        opr_queue_Remove(&ev->q);
index 5bf7ed9..1a35ad6 100644 (file)
 #  include "rx_globals.h"
 # endif /* AFS_NT40_ENV */
 #else /* KERNEL */
-# ifdef UKERNEL
-#  include "rx/rx_kcommon.h"
-# else /* UKERNEL */
+# include "rx/rx_kcommon.h"
+# ifndef UKERNEL
 #  include "rx/rx.h"
-# endif /* UKERNEL */
+# endif
 #endif /* KERNEL */
 
 #define NIFS           512
index a6695ea..1c473b5 100644 (file)
@@ -65,7 +65,7 @@ EXT int rx_extraPackets GLOBALSINIT(256);
 EXT int rx_stackSize GLOBALSINIT(RX_DEFAULT_STACK_SIZE);
 
 /* Time until an unresponsive connection is declared dead */
-EXT int rx_connDeadTime GLOBALSINIT(12);
+EXT int rx_connDeadTime GLOBALSINIT(RX_DEFAULT_DEAD_TIME);
 
 /* Set rx default connection dead time; set on both services and connections at creation time */
 #ifdef AFS_NT40_ENV
index fe72f03..992682f 100644 (file)
@@ -77,5 +77,7 @@ extern void rxi_SendRaw(struct rx_call *call, struct rx_connection *conn,
                        int type, char *data, int bytes, int istack);
 extern struct rx_packet *rxi_SplitJumboPacket(struct rx_packet *p);
 
+#if !defined(AFS_AIX_ENV) || (defined(AFS_AIX_ENV) && (!defined(KERNEL) || defined(UKERNEL)))
 /* rx_kcommon.c / rx_user.c */
 extern void osi_Msg(const char *fmt, ...) AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
+#endif
index 98f1b45..b86f145 100644 (file)
@@ -33,7 +33,6 @@ int (*rxk_PacketArrivalProc) (struct rx_packet * ahandle, struct sockaddr_in * a
 int (*rxk_GetPacketProc) (struct rx_packet **ahandle, int asize);
 #endif
 
-osi_socket *rxk_NewSocketHost(afs_uint32 ahost, short aport);
 extern struct interfaceAddr afs_cb_interface;
 
 rxk_ports_t rxk_ports;
@@ -1288,18 +1287,20 @@ osi_StopListener(void)
 # endif /* RXK_LISTENER_ENV */
 #endif /* !UKERNEL */
 
+#if !defined(AFS_AIX_ENV) || (defined(AFS_AIX_ENV) && (!defined(KERNEL) || defined(UKERNEL)))
 void
 osi_Msg(const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
-#if defined(AFS_LINUX_ENV)
+# if defined(AFS_LINUX_ENV)
     vprintk(fmt, ap);
-#else
+# else
     vprintf(fmt, ap);
-#endif
+# endif
     va_end(ap);
 }
+#endif
 
 #if !defined(AFS_LINUX_ENV)
 void
index 6b96ff3..ec50709 100644 (file)
@@ -58,6 +58,10 @@ extern void osi_Panic(char *fmt, ...)
     (void)((exp) || (osi_AssertFailK( #exp , __FILE__, __LINE__), 0))
 #endif
 
+#if (defined(AFS_AIX_ENV) && defined(KERNEL))
+# define osi_Msg printf
+#endif
+
 #define        osi_YieldIfPossible()
 #define        osi_WakeupAndYieldIfPossible(x)     rx_Wakeup(x)
 
index edf37ca..7d8942b 100644 (file)
@@ -16,9 +16,7 @@
 #  include "afsincludes.h"
 #  include "rx_kcommon.h"
 # else /* defined(UKERNEL) */
-#  ifdef RX_KERNEL_TRACE
-#   include "rx_kcommon.h"
-#  endif
+#  include "rx_kcommon.h"
 #  include "h/types.h"
 #  ifndef AFS_LINUX_ENV
 #   include "h/systm.h"
index aee5b42..00ccd07 100644 (file)
@@ -24,9 +24,10 @@ extern void rx_rto_setPeerTimeoutSecs(struct rx_peer *, int secs);
 
 extern int rx_Init(u_int port);
 extern int rx_InitHost(u_int host, u_int port);
-#ifdef AFS_NT40_ENV
+
 extern void rx_DebugOnOff(int on);
 extern void rx_StatsOnOff(int on);
+#ifdef AFS_NT40_ENV
 extern void rx_StartClientThread(void);
 #endif
 extern void rx_StartServer(int donateMe);
@@ -39,6 +40,9 @@ extern void rx_SetConnDeadTime(struct rx_connection *conn,
                               int seconds);
 extern void rx_SetConnHardDeadTime(struct rx_connection *conn, int seconds);
 extern void rx_SetConnIdleDeadTime(struct rx_connection *conn, int seconds);
+extern int rx_GetConnDeadTime(struct rx_connection *conn);
+extern int rx_GetConnHardDeadTime(struct rx_connection *conn);
+extern int rx_GetConnIdleDeadTime(struct rx_connection *conn);
 extern void rxi_DestroyConnection(struct rx_connection *conn);
 extern void rx_GetConnection(struct rx_connection *conn);
 extern void rx_DestroyConnection(struct rx_connection *conn);
@@ -331,6 +335,8 @@ extern void rxi_ListenerProc(osi_socket usockp, int *tnop,
 extern void rxk_init(void);
 # endif
 
+extern osi_socket *rxk_NewSocketHost(afs_uint32 ahost, short aport);
+
 /* UKERNEL/rx_knet.c */
 # ifdef UKERNEL
 extern void afs_rxevent_daemon(void);
index e9195a1..ba921cf 100644 (file)
@@ -133,12 +133,7 @@ rxi_StartServerProc(void *(*proc) (void *), int stacksize)
 static void *
 event_handler(void *argp)
 {
-    unsigned long rx_pthread_n_event_expired = 0;
-    unsigned long rx_pthread_n_event_waits = 0;
-    long rx_pthread_n_event_woken = 0;
-    unsigned long rx_pthread_n_event_error = 0;
     struct timespec rx_pthread_next_event_time = { 0, 0 };
-    int error;
 
     MUTEX_ENTER(&event_handler_mutex);
 
@@ -162,24 +157,7 @@ event_handler(void *argp)
        clock_Add(&cv, &next);
        rx_pthread_next_event_time.tv_sec = cv.sec;
        rx_pthread_next_event_time.tv_nsec = cv.usec * 1000;
-       rx_pthread_n_event_waits++;
-       error = CV_TIMEDWAIT(&rx_event_handler_cond, &event_handler_mutex, &rx_pthread_next_event_time);
-        if (error == 0) {
-           rx_pthread_n_event_woken++;
-        }
-#ifdef AFS_NT40_ENV
-        else if (error == ETIMEDOUT) {
-           rx_pthread_n_event_expired++;
-       } else {
-            rx_pthread_n_event_error++;
-        }
-#else
-        else if (errno == ETIMEDOUT) {
-            rx_pthread_n_event_expired++;
-        } else {
-            rx_pthread_n_event_error++;
-        }
-#endif
+       CV_TIMEDWAIT(&rx_event_handler_cond, &event_handler_mutex, &rx_pthread_next_event_time);
        rx_pthread_event_rescheduled = 0;
     }
     AFS_UNREACHED(return(NULL));
index ee1c3e3..b620c82 100644 (file)
@@ -12,9 +12,7 @@
 
 #ifdef KERNEL
 # ifndef UKERNEL
-#  ifdef RX_KERNEL_TRACE
-#   include "rx_kcommon.h"
-#  endif
+#  include "rx_kcommon.h"
 #  if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
 #   include "afs/sysincludes.h"
 #  else
index bfc1b7f..88f7772 100644 (file)
@@ -530,7 +530,7 @@ xdr_string(XDR * xdrs, char **cpp, u_int maxsize)
     if (!xdr_u_int(xdrs, &size)) {
        return (FALSE);
     }
-    if (size > maxsize) {
+    if (xdrs->x_op != XDR_FREE && size > maxsize) {
        return (FALSE);
     }
     nodesize = size + 1;
index 5cd30b2..795e21b 100644 (file)
@@ -58,7 +58,6 @@ PortName(char *aname)
 int
 MainCommand(struct cmd_syndesc *as, void *arock)
 {
-    int i;
     osi_socket s;
     int j;
     struct sockaddr_in taddr;
@@ -331,7 +330,7 @@ MainCommand(struct cmd_syndesc *as, void *arock)
        if (onlyPort != -1)
            printf("Showing only connections on port %u\n", ntohs(onlyPort));
 
-       for (i = 0;; i++) {
+       while (1) {
            code =
                rx_GetServerConnections(s, host, port, &nextconn, allconns,
                                        supportedDebugValues, &tconn,
@@ -581,7 +580,7 @@ MainCommand(struct cmd_syndesc *as, void *arock)
            printf("Skipped %d dallying connections.\n", dallyCounter);
     }
     if (showPeers && withPeers) {
-       for (i = 0;; i++) {
+       while (1) {
            struct rx_debugPeer tpeer;
            code =
                rx_GetServerPeers(s, host, port, &nextpeer, allconns, &tpeer,
index c050bd3..e468da3 100644 (file)
@@ -2111,8 +2111,14 @@ er_TailofOldStyleProc_setup(void)
 static void
 h_ProcMainBody_setup(void)
 {
+    char *pprefix = PackagePrefix[PackageIndex];
     f_print(fout,"\nextern int %s%sExecuteRequest(struct rx_call *);\n",
-           prefix, PackagePrefix[PackageIndex]);
+           prefix, pprefix);
+    f_print(fout,"extern char * %s%sTranslateOpCode(int op);\n", prefix,
+           pprefix);
+    f_print(fout,"extern struct %s%sstats *%s%sOpCodeStats(int op);\n",
+           prefix, pprefix,
+           prefix, pprefix);
 }
 
 static void
@@ -2124,6 +2130,10 @@ h_HeadofOldStyleProc_setup(void)
     f_print(fout,"\nextern int %s%sExecuteRequest(struct rx_call *);\n",
            prefix, pprefix);
     f_print(fout,"\nextern int %sOpCodeIndex(int op);\n", PackagePrefix[PackageIndex]);
+    f_print(fout, "extern char * %s%sTranslateOpCode(int op);\n",
+           prefix, pprefix);
+    f_print(fout, "extern struct %s%sstats *%s%sOpCodeStats(int op);\n",
+           prefix, pprefix, prefix, pprefix);
 }
 
 void
index 7108933..c904fb6 100644 (file)
@@ -178,13 +178,13 @@ afs_int32
 fc_cbc_encrypt(void *input, void *output, afs_int32 length,
               const fc_KeySchedule key, afs_uint32 * xor, int encrypt)
 {
-    afs_uint32 i, j;
+    afs_uint32 j;
     afs_uint32 t_input[2];
     afs_uint32 t_output[2];
     unsigned char *t_in_p = (unsigned char *)t_input;
 
     if (encrypt) {
-       for (i = 0; length > 0; i++, length -= 8) {
+       for (; length > 0; length -= 8) {
            /* get input */
            memcpy(t_input, input, sizeof(t_input));
            input=((char *)input) + sizeof(t_input);
@@ -213,7 +213,7 @@ fc_cbc_encrypt(void *input, void *output, afs_int32 length,
        t_output[1] = 0;
     } else {
        /* decrypt */
-       for (i = 0; length > 0; i++, length -= 8) {
+       for (; length > 0; length -= 8) {
            /* get input */
            memcpy(t_input, input, sizeof(t_input));
            input=((char *)input) + sizeof(t_input);
index 5f6ba9b..328650b 100644 (file)
@@ -192,7 +192,6 @@ rxkad_Init(void)
 /* static prototypes */
 static afs_int32 ComputeSum(struct rx_packet *apacket,
                            fc_KeySchedule * aschedule, afs_int32 * aivec);
-static afs_int32 FreeObject(struct rx_securityClass *aobj);
 
 /* this call sets up an endpoint structure, leaving it in *network* byte
  * order so that it can be used quickly for encryption.
@@ -398,10 +397,7 @@ rxkad_DestroyConnection(struct rx_securityClass *aobj,
        }
        INC_RXKAD_STATS(destroyClient);
     }
-    aobj->refCount--;          /* decrement connection counter */
-    if (aobj->refCount <= 0) {
-       (void)FreeObject(aobj);
-    }
+    (void)rxkad_Close(aobj);   /* decrement connection counter */
 }
 
 /* either: decode packet */
index ea5ed3e..bc1c855 100644 (file)
@@ -673,6 +673,7 @@ rxkad_derive_des_key(const void *in, size_t insize,
        HMAC_Update(&mctx, Lbuf, 4);
        mdsize = sizeof(tmp);
        HMAC_Final(&mctx, tmp, &mdsize);
+       HMAC_CTX_cleanup(&mctx);
        memcpy(ktmp, tmp, 8);
        DES_set_odd_parity(&ktmp);
        if (!DES_is_weak_key(&ktmp)) {
index 296145e..da6b3e6 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/opr.h>
 
 #include <roken.h>
 
@@ -65,7 +66,7 @@ struct Acl *
 RParseAcl(char *astr)
 {
     int nplus, nminus, i, trights;
-    char tname[MAXNAME];
+    char tname[MAXNAME + 1] = "";
     struct AclEntry *first, *last, *tl;
     struct Acl *ta;
     sscanf(astr, "%d", &nplus);
@@ -80,7 +81,7 @@ RParseAcl(char *astr)
     last = 0;
     first = 0;
     for (i = 0; i < nplus; i++) {
-       sscanf(astr, "%100s %d", tname, &trights);
+       sscanf(astr, "%" opr_stringize(MAXNAME) "s %d", tname, &trights);
        astr = RSkipLine(astr);
        tl = malloc(sizeof(struct AclEntry));
        if (!first)
@@ -97,7 +98,7 @@ RParseAcl(char *astr)
     last = 0;
     first = 0;
     for (i = 0; i < nminus; i++) {
-       sscanf(astr, "%100s %d", tname, &trights);
+       sscanf(astr, "%" opr_stringize(MAXNAME) "s %d", tname, &trights);
        astr = RSkipLine(astr);
        tl = malloc(sizeof(struct AclEntry));
        if (!first)
index 4ded93c..95f75fa 100644 (file)
@@ -1282,7 +1282,7 @@ static void
 DirectoryList(int argc, char **argv, struct vnodeData *vdata,
              VolumeDiskData * vol)
 {
-    int errflg = 0, lflag = 0, iflag = 0, Fflag = 0, sflag = 0, Rflag = 0;
+    int errflg = 0, lflag = 0, iflag = 0, Fflag = 0, Rflag = 0;
     int c;
 
     optind = 1;
@@ -1302,7 +1302,7 @@ DirectoryList(int argc, char **argv, struct vnodeData *vdata,
            Rflag++;
            break;
        case 's':
-           sflag++;
+           /* Unused and ignored */
            break;
        case '?':
        default:
index bcefe9a..26c13e5 100644 (file)
@@ -118,7 +118,7 @@ start_timer(void)
  */
 
 static void
-end_and_print_timer(char *str, long long bytes)
+end_and_print_timer(FILE *output, char *str, long long bytes)
 {
     long long start_l, stop_l;
     double kbps;
@@ -128,15 +128,15 @@ end_and_print_timer(char *str, long long bytes)
     gettimeofday(&timer_stop, NULL);
     start_l = timer_start.tv_sec * 1000000 + timer_start.tv_usec;
     stop_l = timer_stop.tv_sec * 1000000 + timer_stop.tv_usec;
-    printf("%s:\t%8llu msec", str, (stop_l - start_l) / 1000);
+    fprintf(output, "%s:\t%8llu msec", str, (stop_l - start_l) / 1000);
 
     kbps = bytes * 8000.0 / (stop_l - start_l);
     if (kbps > 1000000.0)
-        printf("\t[%.4g Gbit/s]\n", kbps/1000000.0);
+        fprintf(output, "\t[%.4g Gbit/s]\n", kbps/1000000.0);
     else if (kbps > 1000.0)
-        printf("\t[%.4g Mbit/s]\n", kbps/1000.0);
+        fprintf(output, "\t[%.4g Mbit/s]\n", kbps/1000.0);
     else
-        printf("\t[%.4g kbit/s]\n", kbps);
+        fprintf(output, "\t[%.4g kbit/s]\n", kbps);
 }
 
 /*
@@ -685,7 +685,7 @@ static void
 do_client(const char *server, short port, char *filename, afs_int32 command,
          afs_int32 times, afs_int32 bytes, afs_int32 sendbytes, afs_int32 readbytes,
           int dumpstats, int nojumbo, int maxmtu, int maxwsize, int minpeertimeout,
-          int udpbufsz, int nostats, int hotthread, int threads)
+          int udpbufsz, int nostats, int hotthread, int threads, FILE *output)
 {
     struct rx_connection *conn;
     afs_uint32 addr;
@@ -804,20 +804,21 @@ do_client(const char *server, short port, char *filename, afs_int32 command,
 
     switch (command) {
     case RX_PERF_RPC:
-        end_and_print_timer(stamp, (long long)threads*times*(sendbytes+readbytes));
+        end_and_print_timer(output, stamp, (long long)threads*times*(sendbytes+readbytes));
         break;
     case RX_PERF_RECV:
     case RX_PERF_SEND:
     case RX_PERF_FILE:
-        end_and_print_timer(stamp, (long long)threads*times*bytes);
+        end_and_print_timer(output, stamp, (long long)threads*times*bytes);
         break;
     }
 
     DBFPRINT(("done for good\n"));
 
+
     if (dumpstats) {
-       rx_PrintStats(stdout);
-       rx_PrintPeerStats(stdout, rx_PeerOf(conn));
+       rx_PrintStats(output);
+       rx_PrintPeerStats(output, rx_PeerOf(conn));
     }
     rx_Finalize();
 
@@ -987,10 +988,11 @@ rxperf_client(int argc, char **argv)
     int minpeertimeout = 0;
     char *ptr;
     int ch;
+    FILE *output = NULL;
 
     cmd = RX_PERF_UNKNOWN;
 
-    while ((ch = getopt(argc, argv, "T:S:R:b:c:d:p:P:r:s:w:W:f:HDNjm:u:4:t:V")) != -1) {
+    while ((ch = getopt(argc, argv, "T:S:R:b:c:d:o:p:P:r:s:w:W:f:HDNjm:u:4:t:V")) != -1) {
        switch (ch) {
        case 'b':
            bytes = strtol(optarg, &ptr, 0);
@@ -1018,6 +1020,16 @@ rxperf_client(int argc, char **argv)
            errx(1, "compiled without RXDEBUG");
 #endif
            break;
+       case 'o':
+           if (output == NULL) {
+               output = fopen(optarg, "w");
+               if (output == NULL) {
+                   err(1, "can't open %s", optarg);
+               }
+           } else {
+               warnx("-o option given more than once, ignoring -o %s", optarg);
+           }
+           break;
        case 'P':
            minpeertimeout = strtol(optarg, &ptr, 0);
            if (ptr != 0 && ptr[0] != '\0')
@@ -1130,7 +1142,14 @@ rxperf_client(int argc, char **argv)
 
     do_client(host, port, filename, cmd, times, bytes, sendbytes,
              readbytes, dumpstats, nojumbo, maxmtu, maxwsize, minpeertimeout,
-              udpbufsz, nostats, hotthreads, threads);
+             udpbufsz, nostats, hotthreads, threads,
+             (output == NULL ? stdout : output));
+
+    if (output != NULL) {
+       if (fclose(output) < 0) {
+           err(1, "fclose");
+       }
+    }
 
     return 0;
 }
index 305a118..996c23f 100644 (file)
@@ -233,33 +233,53 @@ ubeacon_InitSecurityClass(void)
     }
 }
 
+/*!
+ * Create a new client connection to the VOTE service on the specified host.
+ * Ensure that the Rx dead time for this connection is compliant with the ubik
+ * invariant:
+ *
+ *    SMALLTIME 60s > (rpc timeout) + max(rpc timeout, POLLTIME 15s)
+ *
+ * Therefore the rx dead time for VOTE connections must be less than 30s.
+ *
+ * \param shost            IPv4 address of db server, in network order
+ *
+ * \pre UBIK_ADDR_LOCK
+ */
+struct rx_connection *
+ubeacon_NewVOTEConnection(afs_uint32 shost)
+{
+    struct rx_connection *vote_conn;
+
+    vote_conn = rx_NewConnection(shost, ubik_callPortal, VOTE_SERVICE_ID,
+                                addr_globals.ubikSecClass, addr_globals.ubikSecIndex);
+    opr_Assert(vote_conn != NULL);
+    rx_SetConnDeadTime(vote_conn, VOTE_RPCTIMEOUT);
+    rx_SetConnHardDeadTime(vote_conn, VOTE_RPCTIMEOUT);
+    return vote_conn;
+}
+
 void
 ubeacon_ReinitServer(struct ubik_server *ts)
 {
     if (tokenCheckProc && !(*tokenCheckProc) (securityRock)) {
-       struct rx_connection *disk_rxcid;
-       struct rx_connection *vote_rxcid;
-       struct rx_connection *tmp;
+       afs_uint32 host;
+
        UBIK_ADDR_LOCK;
        ubeacon_InitSecurityClass();
-       disk_rxcid =
-           rx_NewConnection(rx_HostOf(rx_PeerOf(ts->disk_rxcid)),
+
+       host = rx_HostOf(rx_PeerOf(ts->disk_rxcid));
+       rx_PutConnection(ts->disk_rxcid);
+       ts->disk_rxcid =
+           rx_NewConnection(host,
                             ubik_callPortal, DISK_SERVICE_ID,
                             addr_globals.ubikSecClass, addr_globals.ubikSecIndex);
-       if (disk_rxcid) {
-           tmp = ts->disk_rxcid;
-           ts->disk_rxcid = disk_rxcid;
-           rx_PutConnection(tmp);
-       }
-       vote_rxcid =
-           rx_NewConnection(rx_HostOf(rx_PeerOf(ts->vote_rxcid)),
-                            ubik_callPortal, VOTE_SERVICE_ID,
-                            addr_globals.ubikSecClass, addr_globals.ubikSecIndex);
-       if (vote_rxcid) {
-           tmp = ts->vote_rxcid;
-           ts->vote_rxcid = vote_rxcid;
-           rx_PutConnection(tmp);
-       }
+       opr_Assert(ts->disk_rxcid != NULL);
+
+       host = rx_HostOf(rx_PeerOf(ts->vote_rxcid));
+       rx_PutConnection(ts->vote_rxcid);
+       ts->vote_rxcid = ubeacon_NewVOTEConnection(host);
+
        UBIK_ADDR_UNLOCK;
     }
 }
@@ -340,10 +360,8 @@ ubeacon_InitServerListCommon(afs_uint32 ame, struct afsconf_cell *info,
                ++nServers;
            }
            /* for vote reqs */
-           ts->vote_rxcid =
-               rx_NewConnection(info->hostAddr[i].sin_addr.s_addr,
-                                ubik_callPortal, VOTE_SERVICE_ID,
-                                addr_globals.ubikSecClass, addr_globals.ubikSecIndex);
+           ts->vote_rxcid = ubeacon_NewVOTEConnection(info->hostAddr[i].sin_addr.s_addr);
+
            /* for disk reqs */
            ts->disk_rxcid =
                rx_NewConnection(info->hostAddr[i].sin_addr.s_addr,
@@ -360,8 +378,7 @@ ubeacon_InitServerListCommon(afs_uint32 ame, struct afsconf_cell *info,
            ts->next = ubik_servers;
            ubik_servers = ts;
            ts->addr[0] = servAddr;     /* primary address in  net byte order */
-           ts->vote_rxcid = rx_NewConnection(servAddr, ubik_callPortal, VOTE_SERVICE_ID,
-                       addr_globals.ubikSecClass, addr_globals.ubikSecIndex);  /* for vote reqs */
+           ts->vote_rxcid = ubeacon_NewVOTEConnection(servAddr);       /* for vote reqs */
            ts->disk_rxcid = rx_NewConnection(servAddr, ubik_callPortal, DISK_SERVICE_ID,
                        addr_globals.ubikSecClass, addr_globals.ubikSecIndex);  /* for disk reqs */
            ts->isClone = 0;    /* don't know about clones */
index 2b837b4..4c49f0e 100644 (file)
@@ -470,7 +470,9 @@ urecovery_Interact(void *dummy)
     char hoststr[16];
     char pbuffer[1028];
     int fd = -1;
+#ifndef AFS_PTHREAD_ENV
     afs_int32 pass;
+#endif
     int first;
 
     memset(pbuffer, 0, sizeof(pbuffer));
@@ -663,12 +665,15 @@ urecovery_Interact(void *dummy)
                goto FetchEndCall;
            }
 
+#ifndef AFS_PTHREAD_ENV
            pass = 0;
+#endif
            while (length > 0) {
                tlen = (length > sizeof(tbuffer) ? sizeof(tbuffer) : length);
 #ifndef AFS_PTHREAD_ENV
                if (pass % 4 == 0)
                    IOMGR_Poll();
+               pass++;
 #endif
                nbytes = rx_Read(rxcall, tbuffer, tlen);
                if (nbytes != tlen) {
@@ -678,7 +683,6 @@ urecovery_Interact(void *dummy)
                    goto FetchEndCall;
                }
                nbytes = write(fd, tbuffer, tlen);
-               pass++;
                if (nbytes != tlen) {
                    code = UIOERROR;
                    close(fd);
@@ -963,10 +967,7 @@ DoProbe(struct ubik_server *server)
 
        /* make new connections */
        server->disk_rxcid = conns[success_i];
-       server->vote_rxcid = rx_NewConnection(addr, ubik_callPortal,
-                                             VOTE_SERVICE_ID, addr_globals.ubikSecClass,
-                                             addr_globals.ubikSecIndex);
-
+       server->vote_rxcid = ubeacon_NewVOTEConnection(addr);
        connSuccess = conns[success_i];
        strcpy(buffer, afs_inet_ntoa_r(server->addr[0], hoststr));
 
index 66d2318..211045e 100644 (file)
@@ -482,8 +482,9 @@ SDISK_SendFile(struct rx_call *rxcall, afs_int32 file,
     char pbuffer[1028];
     int fd = -1;
     afs_int32 epoch = 0;
-    afs_int32 pass;
-
+#if !defined(AFS_PTHREAD_ENV)
+    afs_int32 pass = 0;
+#endif
     /* send the file back to the requester */
 
     dbase = ubik_dbase;
@@ -543,7 +544,6 @@ SDISK_SendFile(struct rx_call *rxcall, afs_int32 file,
        close(fd);
        goto failed_locked;
     }
-    pass = 0;
     memcpy(&ubik_dbase->version, &tversion, sizeof(struct ubik_version));
     UBIK_VERSION_UNLOCK;
     while (length > 0) {
@@ -551,6 +551,7 @@ SDISK_SendFile(struct rx_call *rxcall, afs_int32 file,
 #if !defined(AFS_PTHREAD_ENV)
        if (pass % 4 == 0)
            IOMGR_Poll();
+       pass++;
 #endif
        code = rx_Read(rxcall, tbuffer, tlen);
        if (code != tlen) {
@@ -560,7 +561,6 @@ SDISK_SendFile(struct rx_call *rxcall, afs_int32 file,
            goto failed;
        }
        code = write(fd, tbuffer, tlen);
-       pass++;
        if (code != tlen) {
            ViceLog(0, ("write failed tlen=%d, error=%d\n", tlen, code));
            code = UIOERROR;
index 52869ad..a64ad21 100644 (file)
@@ -275,6 +275,7 @@ extern int (*ubik_SyncWriterCacheProc) (void);
 #define RPCTIMEOUT 20
 #define BIGTIME 75
 #define SMALLTIME 60
+#define VOTE_RPCTIMEOUT 12
 /*\}*/
 
 /*!
@@ -491,6 +492,7 @@ extern int ubeacon_InitServerListByInfo(afs_uint32 ame,
                                        struct afsconf_cell *info,
                                        char clones[]);
 extern int ubeacon_InitServerList(afs_uint32 ame, afs_uint32 aservers[]);
+extern struct rx_connection *ubeacon_NewVOTEConnection(afs_uint32 host);
 extern void *ubeacon_Interact(void *);
 extern int ubeacon_updateUbikNetworkAddress(afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR]);
 extern struct beacon_data beacon_globals;
index ee945e8..003eff8 100644 (file)
@@ -17,6 +17,7 @@
  */
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/opr.h>
 
 #include <roken.h>
 
@@ -404,7 +405,7 @@ ParseAcl(char *a_str)
 {                              /*ParseAcl */
 
     int nplus, nminus, i, trights;
-    char tname[MAXNAME];
+    char tname[MAXNAME + 1] = "";
     struct AclEntry *first, *last, *tl;
     struct Acl *ta;
 
@@ -430,7 +431,7 @@ ParseAcl(char *a_str)
     last = 0;
     first = 0;
     for (i = 0; i < nplus; i++) {
-       sscanf(a_str, "%100s %d", tname, &trights);
+       sscanf(a_str, "%" opr_stringize(MAXNAME) "s %d", tname, &trights);
        a_str = SkipLine(a_str);
        tl = malloc(sizeof(struct AclEntry));
        if (!first)
@@ -450,7 +451,7 @@ ParseAcl(char *a_str)
     last = 0;
     first = 0;
     for (i = 0; i < nminus; i++) {
-       sscanf(a_str, "%100s %d", tname, &trights);
+       sscanf(a_str, "%" opr_stringize(MAXNAME) "s %d", tname, &trights);
        a_str = SkipLine(a_str);
        tl = malloc(sizeof(struct AclEntry));
        if (!first)
index bbebcc1..bd78946 100644 (file)
@@ -121,11 +121,6 @@ extern int re_exec(const char *p1);
 /* b64_string_t is 8 bytes, in stds.h */
      typedef char lb64_string_t[12];
 
-/* A simple macro to help show the value of #define'd constants. e.g. If 'FOO'
- * is defined as 5, then AFS_STRINGIZE(FOO) expands to "5" */
-#define AFS_STRINGIZE_(s) #s
-#define AFS_STRINGIZE(s) AFS_STRINGIZE_(s)
-
 #include <afs/ktime.h>
 #include "afsutil_prototypes.h"
 
index 4674738..04842e6 100644 (file)
@@ -21,6 +21,7 @@ SetupLogSoftSignals
 WriteLogBuffer
 afsUUID_from_string
 afsUUID_to_string
+afs_exec_alt
 afs_htonuuid
 afs_inet_ntoa_r
 afs_ntohuuid
index 93f9ee6..542428e 100644 (file)
@@ -74,6 +74,7 @@ pthread_recursive_mutex_unlock(pthread_recursive_mutex_t * mut)
        mut->times_inside--;
        if (mut->times_inside == 0) {
            mut->locked = 0;
+           mut->owner = 0;
            rc = pthread_mutex_unlock(&mut->mut);
        }
     } else {
index 79004fe..cd55705 100644 (file)
@@ -34,7 +34,7 @@ volutil_GetPartitionID(char *aname)
 {
     char tc;
     afs_int32 temp;
-    char ascii[3];
+    char ascii[3] = {0};
 
     tc = *aname;
     if (tc == 0)
@@ -53,7 +53,6 @@ volutil_GetPartitionID(char *aname)
            return temp;
     }
     /* otherwise check for vicepa or /vicepa, or just plain "a" */
-    ascii[2] = 0;
     if (strlen(aname) <= 2) {
        strcpy(ascii, aname);
     } else if (!strncmp(aname, "/vicep", 6)) {
@@ -64,6 +63,10 @@ volutil_GetPartitionID(char *aname)
            return -1;  /* bad partition name: trailing characters */
     } else
        return -1;              /* bad partition name */
+    if (ascii[0] == '\0') {
+       /* Invalid partition name "/vicep" or "vicep". */
+       return -1;
+    }
     /* now partitions are named /vicepa ... /vicepz, /vicepaa, /vicepab, .../vicepzz,
      * and are numbered from 0.  Do the appropriate conversion */
     if (ascii[1] == 0) {
index 3c9bd03..a4c62c3 100644 (file)
@@ -120,11 +120,6 @@ cmdebug.o: cmdebug.c ${INCLS} AFS_component_version_number.c
 cmdebug: cmdebug.o ${CMLIBS}
        $(AFS_LDRULE) cmdebug.o ${CMLIBS} $(LIB_roken) ${XLIBS}
 
-dedebug.o: dedebug.c ${INCLS} AFS_component_version_number.c
-
-dedebug: dedebug.o ${CMLIBS}
-       $(AFS_LDRULE) dedebug.o ${CMLIBS} $(LIB_roken) ${XLIBS}
-
 #
 # Install targets
 #
@@ -159,7 +154,7 @@ dest: fs livesys up fstrace cmdebug afsio
 clean:
        $(LT_CLEAN)
        $(RM) -f *.o *.a up fs core cmdebug \
-               AFS_component_version_number.c fstrace gcpags livesys dedebug \
+               AFS_component_version_number.c fstrace gcpags livesys \
                cacheout afsio
 
 .PHONY: test
diff --git a/src/venus/dedebug.c b/src/venus/dedebug.c
deleted file mode 100644 (file)
index bdf4620..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2000, International Business Machines Corporation and others.
- * All Rights Reserved.
- *
- * This software has been released under the terms of the IBM Public
- * License.  For details, see the LICENSE file in the top-level source
- * directory or online at http://www.openafs.org/dl/license10.html
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-
-#include <afs/afscbint.h>
-#include <afs/cmd.h>
-#include <afs/com_err.h>
-#include <rx/rx.h>
-#include <lock.h>
-
-extern struct rx_securityClass *rxnull_NewServerSecurityObject();
-extern struct hostent *hostutil_GetHostByName();
-
-static PrintCacheEntries(struct rx_connection *aconn, int aint32)
-{
-    int i;
-    afs_int32 code, addr, inode, flags, time;
-    char *fileName;
-
-    for(i=0;i<100000;i++) {
-       code = RXAFSCB_GetDE(aconn, i, &addr, &inode, &flags, &time, &fileName);
-       if (code) {
-           if (code == 1) break;
-           printf("cmdebug: failed to get cache entry %d (%s)\n", i,
-                  afs_error_message(code));
-           return code;
-       }
-
-       /* otherwise print this entry */
-       printf("%d: ** dentry %d %08x %d %d %s\n",
-              i, addr, inode, flags, time, fileName);
-
-       printf("\n");
-    }
-    printf("Returned %d entries.\n", i);
-    return 0;
-}
-
-static int
-CommandProc(struct cmd_syndesc *as, void *arock)
-{
-    struct rx_connection *conn;
-    char *hostName;
-    struct hostent *thp;
-    afs_int32 port;
-    struct rx_securityClass *secobj;
-    int int32p;
-    afs_int32 addr;
-
-    hostName = as->parms[0].items->data;
-    if (as->parms[1].items)
-       port = atoi(as->parms[1].items->data);
-    else
-       port = 7001;
-    thp = hostutil_GetHostByName(hostName);
-    if (!thp) {
-       printf("cmdebug: can't resolve address for host %s.\n", hostName);
-       exit(1);
-    }
-    memcpy(&addr, thp->h_addr, sizeof(afs_int32));
-    secobj = rxnull_NewServerSecurityObject();
-    conn = rx_NewConnection(addr, htons(port), 1, secobj, 0);
-    if (!conn) {
-       printf("cmdebug: failed to create connection for host %s\n", hostName);
-       exit(1);
-    }
-    if (as->parms[2].items) int32p = 1;
-    else int32p = 0;
-    PrintCacheEntries(conn, int32p);
-    return 0;
-}
-
-#include "AFS_component_version_number.c"
-
-main(argc, argv)
-int argc;
-char **argv; {
-    struct cmd_syndesc *ts;
-
-#ifdef AFS_AIX32_ENV
-    /*
-     * The following signal action for AIX is necessary so that in case of a
-     * crash (i.e. core is generated) we can include the user's data section
-     * in the core dump. Unfortunately, by default, only a partial core is
-     * generated which, in many cases, isn't too useful.
-     */
-    struct sigaction nsa;
-
-    sigemptyset(&nsa.sa_mask);
-    nsa.sa_handler = SIG_DFL;
-    nsa.sa_flags = SA_FULLDUMP;
-    sigaction(SIGSEGV, &nsa, NULL);
-#endif
-    rx_Init(0);
-
-    ts = cmd_CreateSyntax(NULL, CommandProc, NULL, 0, "probe unik server");
-    cmd_AddParm(ts, "-servers", CMD_SINGLE, CMD_REQUIRED, "server machine");
-    cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "IP port");
-    cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "print all info");
-
-    cmd_Dispatch(argc, argv);
-    exit(0);
-}
index cd477ce..cfebe61 100644 (file)
@@ -2310,6 +2310,12 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid,
             Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr),
             ntohs(rxr_PortOf(tcon)), t_client->z.ViceId));
 
+    /* Avoid signed integer complications later. */
+    if (Pos < 0 || Len < 0 || Len >= MAX_AFS_INT64 - Pos) {
+       errorCode = EFBIG;
+       goto Bad_FetchData;
+    }
+
     queue_NodeInit(&tcbv);
     tcbv.call = acall;
     cbv = &tcbv;
index 41398ef..5c3cec0 100644 (file)
@@ -958,7 +958,6 @@ DeleteFileCallBacks(AFSFid * fid)
     struct FileEntry *fe;
     struct CallBack *cb;
     afs_uint32 cbi;
-    int n;
 
     H_LOCK;
     cbstuff.DeleteFiles++;
@@ -970,7 +969,8 @@ DeleteFileCallBacks(AFSFid * fid)
                 fid->Unique));
        return 0;
     }
-    for (n = 0, cbi = fe->firstcb; cbi; n++) {
+    cbi = fe->firstcb;
+    while (cbi != 0) {
        cb = itocb(cbi);
        cbi = cb->cnext;
        TDel(cb);
@@ -1073,7 +1073,7 @@ BreakDelayedCallBacks_r(struct host *host)
        while (!(host->z.hostFlags & HOSTDELETED)) {
            nfids = 0;
            host->z.hostFlags &= ~VENUSDOWN;    /* presume up */
-           cbi = first = host->z.cblist;
+           cbi = host->z.cblist;
            if (!cbi)
                break;
            do {
@@ -2159,7 +2159,6 @@ cb_stateSaveTimeouts(struct fs_dump_state * state)
 
     AssignInt64(state->eof_offset, &state->cb_hdr->timeout_offset);
 
-    memset(state->cb_timeout_hdr, 0, sizeof(struct callback_state_fehash_header));
     state->cb_timeout_hdr->magic = CALLBACK_STATE_TIMEOUT_MAGIC;
     state->cb_timeout_hdr->records = CB_NUM_TIMEOUT_QUEUES;
     state->cb_timeout_hdr->len = sizeof(struct callback_state_timeout_header) +
@@ -2232,7 +2231,6 @@ cb_stateSaveFEHash(struct fs_dump_state * state)
 
     AssignInt64(state->eof_offset, &state->cb_hdr->fehash_offset);
 
-    memset(state->cb_fehash_hdr, 0, sizeof(struct callback_state_fehash_header));
     state->cb_fehash_hdr->magic = CALLBACK_STATE_FEHASH_MAGIC;
     state->cb_fehash_hdr->records = FEHASH_SIZE;
     state->cb_fehash_hdr->len = sizeof(struct callback_state_fehash_header) +
index e430973..5cdcc9a 100644 (file)
@@ -1823,7 +1823,7 @@ h_GetHost_r(struct rx_connection *tcon)
 {
     struct host *host;
     struct host *oldHost;
-    int code;
+    int code = -1;
     struct interfaceAddr interf;
     int interfValid = 0;
     struct Identity *identP = NULL;
@@ -3291,6 +3291,10 @@ h_stateVerifyHost(struct host * h, void* rock)
        return H_ENUMERATE_BAIL(0);
     }
 
+    if (h_stateVerifyAddrHash(state, h, h->z.host, h->z.port, 1)) {
+       state->bail = 1;
+    }
+
     if (h->z.interface) {
        for (i = h->z.interface->numberOfInterfaces-1; i >= 0; i--) {
            if (h_stateVerifyAddrHash(state, h, h->z.interface->interface[i].addr,
@@ -3302,8 +3306,6 @@ h_stateVerifyHost(struct host * h, void* rock)
        if (h_stateVerifyUuidHash(state, h)) {
            state->bail = 1;
        }
-    } else if (h_stateVerifyAddrHash(state, h, h->z.host, h->z.port, 1)) {
-       state->bail = 1;
     }
 
     if (cb_stateVerifyHCBList(state, h)) {
index aaf4988..05ed4df 100644 (file)
@@ -1015,13 +1015,11 @@ fs_stateAlloc(struct fs_dump_state * state)
     memset(state, 0, sizeof(struct fs_dump_state));
     state->fd = -1;
     state->fn = (char *)AFSDIR_SERVER_FSSTATE_FILEPATH;
-    state->hdr = malloc(sizeof(struct fs_state_header));
-    state->h_hdr = malloc(sizeof(struct host_state_header));
-    state->cb_hdr = malloc(sizeof(struct callback_state_header));
-    state->cb_timeout_hdr =
-       malloc(sizeof(struct callback_state_timeout_header));
-    state->cb_fehash_hdr =
-       malloc(sizeof(struct callback_state_fehash_header));
+    state->hdr = calloc(1, sizeof(*state->hdr));
+    state->h_hdr = calloc(1, sizeof(*state->h_hdr));
+    state->cb_hdr = calloc(1, sizeof(*state->cb_hdr));
+    state->cb_timeout_hdr = calloc(1, sizeof(*state->cb_timeout_hdr));
+    state->cb_fehash_hdr = calloc(1, sizeof(*state->cb_fehash_hdr));
     if ((state->hdr == NULL) || (state->h_hdr == NULL) || (state->cb_hdr == NULL) ||
        (state->cb_timeout_hdr == NULL) || (state->cb_fehash_hdr == NULL))
        ret = 1;
index b46c4ca..251f285 100644 (file)
@@ -1244,7 +1244,7 @@ dump_he_entry(void)
     char hoststr[16];
     DPFSO0("hostDiskEntry");
     DPFS1("host", afs_inet_ntoa_r(he_cursor.he.host, hoststr));
-    DPFV1("port", "u", he_cursor.he.port);
+    DPFV1("port", "hu", ntohs(he_cursor.he.port));
     DPFX1("hostFlags", he_cursor.he.hostFlags);
     DPFV1("Console", "u", he_cursor.he.Console);
     DPFV1("hcpsfailed", "u", he_cursor.he.hcpsfailed);
@@ -1288,7 +1288,8 @@ dump_he_interfaces(void)
        snprintf(temp_str, sizeof(temp_str), "interface[%d]", i);
        DPFSO1(temp_str);
        DPFS2("addr", afs_inet_ntoa_r(ifp->interface[i].addr, hoststr));
-       DPFV2("port", "u", ifp->interface[i].port);
+       DPFV2("port", "hu", ntohs(ifp->interface[i].port));
+       DPFV2("valid", "hd", ifp->interface[i].valid);
        DPFSC1;
     }
 
index cff86ea..db34abd 100644 (file)
@@ -1673,7 +1673,7 @@ WriteSysIdFile(void)
     }
     vsn.magic = SYSIDMAGIC;
     vsn.version = 1;
-    if ((i = write(fd, (char *)&vsn, sizeof(vsn))) != sizeof(vsn)) {
+    if (write(fd, &vsn, sizeof(vsn)) != sizeof(vsn)) {
        ViceLog(0,
                ("%s: write failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH,
                 errno));
@@ -1681,17 +1681,14 @@ WriteSysIdFile(void)
     }
     uuid = FS_HostUUID;
     afs_htonuuid(&uuid);
-    if ((i =
-        write(fd, (char *)&uuid,
-              sizeof(struct afsUUID))) != sizeof(struct afsUUID)) {
+    if (write(fd, &uuid, sizeof(afsUUID)) != sizeof(afsUUID)) {
        ViceLog(0,
                ("%s: write of uuid failed (%d)\n",
                 AFSDIR_SERVER_SYSID_FILEPATH, errno));
        return EIO;
     }
-    if ((i =
-        write(fd, (char *)&FS_HostAddr_cnt,
-              sizeof(afs_int32))) != sizeof(afs_int32)) {
+    if (write(fd, &FS_HostAddr_cnt, sizeof(FS_HostAddr_cnt)) !=
+                   sizeof(FS_HostAddr_cnt)) {
        ViceLog(0,
                ("%s: write of # of entries failed (%d)\n",
                 AFSDIR_SERVER_SYSID_FILEPATH, errno));
index 8c5044c..20c14a5 100644 (file)
@@ -437,8 +437,7 @@ handleit(struct cmd_syndesc *as, void *arock)
                    ("\t%d didn't hash properly by backup volid (out of %d)\n\t%d didn't hash properly by ro volid (out of %d)\n",
                     num3, num31, num4, num41);
            } else if (!strcmp(oper, "fixhash")) {
-               int index, count, num = 0, num1 = 0, num2 = 0, next_index, x =
-                   0;
+               int index, count, num = 0, num1 = 0, next_index, x = 0;
                struct vldbentry tentry;
 
                VL = SVL = malloc(ALLOCNT * sizeof(struct Vlent));
@@ -484,7 +483,6 @@ handleit(struct cmd_syndesc *as, void *arock)
                                  entry.volumeId[RWVOL], RWVOL, &tentry);
                    if (code == VL_NOENT) {
                        num1++;
-                       num2++;
                        updateentry.Mask = VLUPDATE_RWID;
                        updateentry.spares3 = entry.volumeId[RWVOL];
                        printf("\tVolume %s %d (not in rw id hash)\n",
index deaa079..469ce37 100644 (file)
@@ -267,21 +267,6 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone)
 
            /* If a directory, mark vnode in old volume as cloned */
            if ((rwvnode->type == vDirectory) && ReadWriteOriginal) {
-#ifdef DVINC
-               /*
-                * It is my firmly held belief that immediately after
-                * copy-on-write, the two directories can be identical.
-                * If the new copy is changed (presumably, that is the very
-                * next thing that will happen) then the dataVersion will
-                * get bumped.
-                */
-               /* NOTE:  the dataVersion++ is incredibly important!!!.
-                * This will cause the inode created by the file server
-                * on copy-on-write to be stamped with a dataVersion bigger
-                * than the current one.  The salvager will then do the
-                * right thing */
-               rwvnode->dataVersion++;
-#endif /* DVINC */
                rwvnode->cloned = 1;
                code = STREAM_ASEEK(rwfile, offset);
                if (code == -1)
@@ -293,10 +278,6 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone)
                code = STREAM_ASEEK(rwfile, offset + vcp->diskSize);
                if (code == -1)
                    goto clonefailed;
-#ifdef DVINC
-               rwvnode->dataVersion--; /* Really needs to be set to the value in the inode,
-                                        * for the read-only volume */
-#endif /* DVINC */
            }
        }
 
index d2f94bb..d77f33f 100644 (file)
@@ -2023,13 +2023,17 @@ _namei_examine_special(char * path1,
         * this like a normal file, we won't try to INC or DEC it. */
        info.linkCount = 0;
     } else {
-       char path2[512];
+       char *path2;
        /* Open this handle */
-       snprintf(path2, sizeof(path2),
-                "%s" OS_DIRSEP "%s", path1, dname);
+       if (asprintf(&path2, "%s" OS_DIRSEP "%s", path1, dname) < 0) {
+           Log("_namei_examine_special: memory allocation failure\n");
+           ret = -1;
+           goto error;
+       }
        linkHandle->fd_fd = OS_OPEN(path2, Testing ? O_RDONLY : O_RDWR, 0666);
        info.linkCount =
            namei_GetLinkCount(linkHandle, (Inode) 0, 1, 1, Testing);
+       free(path2);
     }
 
     if (!judgeFun ||
index 420aa93..6c167ca 100644 (file)
@@ -1025,7 +1025,7 @@ VInitPreAttachVolumes(int nthreads, struct volume_init_queue *vq)
     while (nthreads) {
         /* dequeue next volume */
        opr_mutex_enter(&vq->mutex);
-        if (queue_IsEmpty(vq)) {
+       while (queue_IsEmpty(vq)) {
            opr_cv_wait(&vq->cv, &vq->mutex);
         }
         vb = queue_First(vq, volume_init_batch);
@@ -1195,7 +1195,9 @@ VShutdown_r(void)
     if (VInit < 2) {
         Log("VShutdown:  aborting attach volumes\n");
         vinit_attach_abort = 1;
-        VOL_CV_WAIT(&vol_init_attach_cond);
+       while (VInit < 2) {
+           VOL_CV_WAIT(&vol_init_attach_cond);
+       }
     }
 
     for (params.n_parts=0, diskP = DiskPartitionList;
@@ -1320,11 +1322,13 @@ VShutdown_r(void)
     if (VInit < 2) {
         Log("VShutdown:  aborting attach volumes\n");
         vinit_attach_abort = 1;
+       while (VInit < 2) {
 #ifdef AFS_PTHREAD_ENV
-        VOL_CV_WAIT(&vol_init_attach_cond);
+           VOL_CV_WAIT(&vol_init_attach_cond);
 #else
-        LWP_WaitProcess(VInitAttachVolumes);
+           LWP_WaitProcess(VInitAttachVolumes);
 #endif /* AFS_PTHREAD_ENV */
+       }
     }
 
     Log("VShutdown:  shutting down on-line volumes...\n");
@@ -3361,6 +3365,8 @@ attach2(Error * ec, VolumeId volumeId, char *path, struct DiskPartition64 *partp
        goto locked_error;
     }
 
+    free(vp->vnodeIndex[vSmall].bitmap);
+    free(vp->vnodeIndex[vLarge].bitmap);
     vp->vnodeIndex[vSmall].bitmap = vp->vnodeIndex[vLarge].bitmap = NULL;
 #ifndef BITMAP_LATER
     if (programType == fileServer && VolumeWriteable(vp)) {
@@ -8510,9 +8516,9 @@ DeleteVolumeFromHashTable(Volume * vp)
 Volume *
 VLookupVolume_r(Error * ec, VolumeId volumeId, Volume * hint)
 {
-    int looks = 0;
     Volume * vp, *np;
 #ifdef AFS_DEMAND_ATTACH_FS
+    int looks = 0;
     Volume *pp;
 #endif
     VolumeHashChainHead * head;
@@ -8537,7 +8543,9 @@ VLookupVolume_r(Error * ec, VolumeId volumeId, Volume * hint)
 
     /* search the chain for this volume id */
     for(queue_Scan(head, vp, np, Volume)) {
+#ifdef AFS_DEMAND_ATTACH_FS
        looks++;
+#endif
        if (vp->hashid == volumeId) {
            break;
        }
index bbc66f1..056bf3f 100644 (file)
@@ -1082,7 +1082,6 @@ ProcessIndex(Volume * vp, VnodeClass class, afs_foff_t ** Bufp, int *sizep,
     int i, nVnodes, code;
     afs_foff_t offset;
     afs_foff_t *Buf;
-    int cnt = 0;
     afs_sfsize_t size;
     StreamHandle_t *afile;
     FdHandle_t *fdP;
@@ -1101,7 +1100,6 @@ ProcessIndex(Volume * vp, VnodeClass class, afs_foff_t ** Bufp, int *sizep,
        Buf = *Bufp;
        for (i = 0; i < *sizep; i++) {
            if (Buf[i]) {
-               cnt++;
                STREAM_ASEEK(afile, Buf[i]);
                code = STREAM_READ(vnode, vcp->diskSize, 1, afile);
                if (code == 1) {
@@ -1152,7 +1150,6 @@ ProcessIndex(Volume * vp, VnodeClass class, afs_foff_t ** Bufp, int *sizep,
                }
                if (vnode->type != vNull && VNDISK_GET_INO(vnode)) {
                    Buf[(offset >> vcp->logSize) - 1] = offset;
-                   cnt++;
                }
                offset += vcp->diskSize;
            }
index 3762558..7ae7d11 100644 (file)
@@ -948,9 +948,9 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
     if (strlcat(rootdir, dh.volumeName, sizeof(rootdir)) >= sizeof(rootdir))
        goto str_error_exit;
     len = strlen(rootdir);
-    if (strcmp(".backup", rootdir + len - 7) == 0) {
+    if (len >= 7 && strcmp(".backup", rootdir + len - 7) == 0) {
        rootdir[len - 7] = 0;
-    } else if (strcmp(".readonly", rootdir + len - 9) == 0) {
+    } else if (len >= 9 && strcmp(".readonly", rootdir + len - 9) == 0) {
        rootdir[len - 9] = 0;
     }
 
index 1a3b712..44de660 100644 (file)
@@ -109,7 +109,6 @@ cmd_AddParmAtOffset(ts, COMMONPARM_OFFSET_RXGK, \
 
 int rxInitDone = 0;
 extern struct ubik_client *cstruct;
-const char *confdir;
 
 static struct tqHead busyHead, notokHead;
 
@@ -175,9 +174,9 @@ VolNameOK(char *name)
     size_t total;
 
     total = strlen(name);
-    if (!strcmp(&name[total - 9], ".readonly")) {
+    if (total >= 9 && !strcmp(&name[total - 9], ".readonly")) {
        return 0;
-    } else if (!strcmp(&name[total - 7], ".backup")) {
+    } else if (total >= 7 && !strcmp(&name[total - 7], ".backup")) {
        return 0;
     } else {
        return 1;
@@ -5847,6 +5846,8 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
     char *rxgk_seclevel_str = NULL;
     afs_int32 code;
     int secFlags;
+    const char *confdir = AFSDIR_CLIENT_ETC_DIRPATH;
+    const char *retry_confdir = AFSDIR_SERVER_ETC_DIRPATH;
 
     /* Initialize the ubik_client connection */
     rx_SetRxDeadTime(90);
@@ -5863,6 +5864,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
     if (as->parms[COMMONPARM_OFFSET_LOCALAUTH].items) {        /* -localauth specified */
        secFlags |= AFSCONF_SECOPTS_LOCALAUTH;
        confdir = AFSDIR_SERVER_ETC_DIRPATH;
+       retry_confdir = NULL;
     }
 
     if (as->parms[COMMONPARM_OFFSET_ENCRYPT].items     /* -encrypt specified */
@@ -5872,8 +5874,10 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
         )
        secFlags |= AFSCONF_SECOPTS_ALWAYSENCRYPT;
 
-    if (as->parms[COMMONPARM_OFFSET_CONFIG].items)   /* -config flag set */
+    if (as->parms[COMMONPARM_OFFSET_CONFIG].items) {  /* -config flag set */
        confdir = as->parms[COMMONPARM_OFFSET_CONFIG].items->data;
+       retry_confdir = NULL;
+    }
 
     if (cmd_OptionAsString(as, COMMONPARM_OFFSET_RXGK, &rxgk_seclevel_str) == 0) {
        if (strcmp(rxgk_seclevel_str, "clear") == 0)
@@ -5892,8 +5896,14 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
        rxgk_seclevel_str = NULL;
     }
 
-    if ((code = vsu_ClientInit(confdir, tcell, secFlags, UV_SetSecurity,
-                              &cstruct))) {
+    code = vsu_ClientInit(confdir, tcell, secFlags, UV_SetSecurity, &cstruct);
+    if (code != 0 && retry_confdir != NULL) {
+       fprintf(STDERR, "vos: Retrying initialization with directory %s\n",
+               retry_confdir);
+       code = vsu_ClientInit(retry_confdir, tcell, secFlags, UV_SetSecurity,
+                             &cstruct);
+    }
+    if (code != 0) {
        fprintf(STDERR, "could not initialize VLDB library (code=%lu) \n",
                (unsigned long)code);
        exit(1);
@@ -5935,8 +5945,6 @@ main(int argc, char **argv)
     sigaction(SIGSEGV, &nsa, NULL);
 #endif
 
-    confdir = AFSDIR_CLIENT_ETC_DIRPATH;
-
     cmd_SetBeforeProc(MyBeforeProc, NULL);
 
     ts = cmd_CreateSyntax("create", CreateVolume, NULL, 0, "create a new volume");
index 642d273..3428d83 100644 (file)
@@ -418,12 +418,12 @@ vsu_ExtractName(char rname[], char name[])
     strncpy(sname, name, sizeof(sname));
     sname[sizeof(sname) - 1] = '\0';
     total = strlen(sname);
-    if (!strcmp(&sname[total - 9], ".readonly")) {
+    if (total >= 9 && !strcmp(&sname[total - 9], ".readonly")) {
        /*discard the last 8 chars */
        sname[total - 9] = '\0';
        strcpy(rname, sname);
        return 0;
-    } else if (!strcmp(&sname[total - 7], ".backup")) {
+    } else if (total >= 7 && !strcmp(&sname[total - 7], ".backup")) {
        /*discard last 6 chars */
        sname[total - 7] = '\0';
        strcpy(rname, sname);
index 05c3e4d..bd64cb0 100644 (file)
@@ -768,10 +768,3 @@ SRXAFSCB_TellMeAboutYourself(struct rx_call * rxcall,
      */
     return (0);
 }
-
-int SRXAFSCB_GetDE(struct rx_call *a_call, afs_int32 a_index, afs_int32 addr,
-                  afs_int32 inode, afs_int32 flags, afs_int32 time,
-                  char **fileName)
-{
-    return RXGEN_OPCODE;
-}
index 72f1158..1b03efa 100644 (file)
@@ -18,6 +18,7 @@ opr/time
 opr/uuid
 ptserver/pt_util
 ptserver/pts-man
+rx/atomic
 rx/event
 rx/perf
 volser/vos-man
index 6389919..230b582 100644 (file)
@@ -1 +1,2 @@
+/atomic-t
 /event-t
index 5af2d17..fe172e4 100644 (file)
@@ -10,10 +10,13 @@ MODULE_CFLAGS = -I$(TOP_OBJDIR)
 LIBS = $(abs_top_builddir)/tests/common/libafstest_common.la \
        $(abs_top_builddir)/src/rx/liboafs_rx.la
 
-BINS = event-t
+BINS = atomic-t event-t
 
 all: $(BINS)
 
+atomic-t: atomic-t.o $(LIBS)
+       $(LT_LDRULE_static) atomic-t.o $(LIBS) $(LIB_roken) $(XLIBS)
+
 event-t: event-t.o $(LIBS)
        $(LT_LDRULE_static) event-t.o $(LIBS) $(LIB_roken) $(XLIBS)
 install:
diff --git a/tests/rx/atomic-t.c b/tests/rx/atomic-t.c
new file mode 100644 (file)
index 0000000..b909e67
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2022 Sine Nomine Associates. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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 AUTHOR 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.
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+#include <roken.h>
+#include <pthread.h>
+
+#include <tests/tap/basic.h>
+
+#include <afs/opr.h>
+#include <rx/rx_atomic.h>
+
+struct thread_args {
+    rx_atomic_t atom;
+    int min_val;
+    int max_val;
+};
+
+/* This runs various atomic ops using the starting value of 'val', and results
+ * in setting various values in the range [val-20,val+20]. */
+static void
+test_simple(int val)
+{
+    rx_atomic_t atom = RX_ATOMIC_INIT(val);
+
+    diag("init val %d", val);
+
+    is_int(val, rx_atomic_read(&atom), "rx_atomic_read -> %d", val);
+
+    val += 5;
+    rx_atomic_set(&atom, val);
+    is_int(val, rx_atomic_read(&atom), "rx_atomic_set -> %d", val);
+
+    val++;
+    rx_atomic_inc(&atom);
+    is_int(val, rx_atomic_read(&atom), "rx_atomic_inc -> %d", val);
+
+    val++;
+    is_int(val, rx_atomic_inc_and_read(&atom), "rx_atomic_inc_and_read -> %d", val);
+
+    val += 3;
+    rx_atomic_add(&atom, 3);
+    is_int(val, rx_atomic_read(&atom), "rx_atomic_add -> %d", val);
+
+    val += 10;
+    is_int(val, rx_atomic_add_and_read(&atom, 10), "rx_atomic_add_and_read -> %d", val);
+
+    val--;
+    rx_atomic_dec(&atom);
+    is_int(val, rx_atomic_read(&atom), "rx_atomic_dec -> %d", val);
+
+    val--;
+    is_int(val, rx_atomic_dec_and_read(&atom), "rx_atomic_dec_and_read -> %d", val);
+
+    val -= 3;
+    rx_atomic_sub(&atom, 3);
+    is_int(val, rx_atomic_read(&atom), "rx_atomic_sub -> %d", val);
+
+    /* Get back to 20 below the initial value. */
+    val -= 35;
+    rx_atomic_sub(&atom, 35);
+    is_int(val, rx_atomic_read(&atom), "rx_atomic_sub -> %d", val);
+}
+
+static void *
+atom_thread(void *rock)
+{
+#define I_REPS 1000
+#define J_REPS 1000
+
+    struct thread_args *args = rock;
+    rx_atomic_t *atom = &args->atom;
+    int i, j;
+    int val;
+    const char *last_op;
+
+    for (i = 0; i < I_REPS; i++) {
+       last_op = "rx_atomic_inc/dec";
+       for (j = 0; j < J_REPS; j++) {
+           rx_atomic_inc(atom);
+           rx_atomic_dec(atom);
+       }
+
+       val = rx_atomic_read(atom);
+       if (val < args->min_val || val > args->max_val) {
+           goto fail;
+       }
+
+       for (j = 0; j < J_REPS; j++) {
+           val = rx_atomic_inc_and_read(atom);
+           if (val < args->min_val || val > args->max_val) {
+               last_op = "rx_atomic_inc_and_read";
+               goto fail;
+           }
+
+           val = rx_atomic_dec_and_read(atom);
+           if (val < args->min_val || val > args->max_val) {
+               last_op = "rx_atomic_dec_and_read";
+               goto fail;
+           }
+       }
+
+       last_op = "rx_atomic/add/sub/add_and_read";
+       for (j = 0; j < J_REPS; j++) {
+           rx_atomic_add(atom, 2);
+           rx_atomic_sub(atom, 4);
+           val = rx_atomic_add_and_read(atom, 2);
+           if (val < args->min_val || val > args->max_val) {
+               goto fail;
+           }
+       }
+    }
+
+    return rock;
+
+ fail:
+    printf("# bad value after %s: %d (min %d, max %d)\n",
+          last_op, val, args->min_val, args->max_val);
+    return NULL;
+}
+
+static void
+test_threads(int val)
+{
+#define N_THREADS 10
+    pthread_t tid[N_THREADS];
+    struct thread_args args;
+    int thread_i;
+
+    memset(&args, 0, sizeof(args));
+    args.min_val = val - N_THREADS * 2;
+    args.max_val = val + N_THREADS * 2;
+
+    diag("threaded init val %d", val);
+
+    rx_atomic_set(&args.atom, val);
+
+    for (thread_i = 0; thread_i < N_THREADS; thread_i++) {
+       opr_Verify(pthread_create(&tid[thread_i], NULL, atom_thread, &args) == 0);
+    }
+
+    for (thread_i = 0; thread_i < N_THREADS; thread_i++) {
+       void *ret;
+       opr_Verify(pthread_join(tid[thread_i], &ret) == 0);
+
+       ok(ret != NULL, "atom thread %d/%d", thread_i, N_THREADS - 1);
+    }
+
+    is_int(val, rx_atomic_read(&args.atom), "final atomic value");
+}
+
+int
+main(void)
+{
+    plan(61);
+
+    test_simple(0);
+
+    /* Pick a couple of values that will cause us to cross from positive to
+     * negative, and negative to positive, for at least one operation. */
+    test_simple(14);
+    test_simple(-14);
+
+    /* Pick a couple of large values somewhat close to positive/negative 2^31,
+     * but not close enough that we overflow. */
+    test_simple(2147483600);
+    test_simple(-2147483600);
+
+    test_threads(0);
+
+    return 0;
+}
+
index 0fc2cad..fd4ff17 100755 (executable)
@@ -11,21 +11,45 @@ use POSIX qw(:sys_wait_h :signal_h);
 my $port = 4000;
 my $rxperf = obj_path("src/tools/rxperf/rxperf");
 
+
+# Wait for the server to finish initializing.
+sub
+wait_for_server {
+    my $pid = shift;
+    for (my $i = 0; $i < 10; $i++) {
+        if ($i > 0) {
+            sleep(1);
+        }
+        my $rc = system($rxperf, "client", "-c", "rpc", "-p", $port, "-S",
+                        "128", "-R", "128", "-T", "1", "-H", "-N",
+                        "-o", "/dev/null");
+        if ($rc == 0) {
+            return;
+        }
+    }
+    kill("TERM", $pid);
+    waitpid($pid, 0);
+    die("Unable to contact rxperf server.");
+}
+
 # Start up an rxperf server
 
 my $pid = fork();
 if ($pid == -1) {
     fail("Failed to fork rxperf server");
     exit(1);
-} elsif ($pid == 0) { 
+} elsif ($pid == 0) {
     exec({$rxperf}
         "rxperf", "server", "-p", $port, "-u", "1024", "-H", "-N");
     die("Kabooom ?");
 }
+# Give the server some time to initialize
+wait_for_server($pid);
+
 pass("Started rxperf server");
 
 # Start up an rxperf client, and run a test
-is(0, 
+is(0,
    system("$rxperf client -c rpc -p $port -S 1048576 -R 1048576 -T 30 -u 1024 -H -N"),
    "single threaded client ran successfully");
 
@@ -45,5 +69,3 @@ if (WIFSIGNALED($ecode) && WTERMSIG($ecode) != SIGTERM) {
 } else {
     pass("Server exited succesfully");
 }
-
-
index c598071..87f5b9c 100644 (file)
@@ -32,6 +32,8 @@
 char *out_of_range_names[] = {
     "/vicepiv",
     "/vicepzz",
+    "vicepiv",
+    "vicepzz",
     "iv",
     "zz",
     "255",
@@ -45,6 +47,10 @@ char *invalid_names[] = {
     "/vicep",
     "/vicepbogus",
     "/vicep0",
+    "vice",
+    "vicep",
+    "vicepbogus",
+    "vicep0",
     "foo",
     "!?",
     "-1",
@@ -173,7 +179,7 @@ test_partition_id_to_name(void)
 int
 main(int argc, char **argv)
 {
-    plan(1293);
+    plan(1299);
     test_partition_name_to_id();
     test_partition_id_to_name();
     return 0;