# 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:
: 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
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
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)
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.
ptserver_depinstall: config rxgen comerr
+${COMPILE_PART1} ptserver ${COMPILE_DEPINSTALL}
-${DEST}/bin/dedebug: dedebug
- ${INSTALL} $? $@
-
#
# libafs build targets
/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 \
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 \
OPENAFS_CURSES
OPENAFS_C_ATTRIBUTE
OPENAFS_C_PRAGMA
+OPENAFS_C_FLEXIBLE_ARRAY
OPENAFS_MORE_ROKEN_CHECKS
OPENAFS_NETDB_CHECKS
OPENAFS_ROKEN_HEADERS
config.sub
git-version
install-sh
+ltmain.sh
missing
mkinstalldirs
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.
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>
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 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>
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
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>
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];
->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
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
>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
->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
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
>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
#ifndef _OSI_MACHDEP_H_
#define _OSI_MACHDEP_H_
+#include <sys/time.h>
#undef osi_ThreadUnique
#define osi_ThreadUnique() thread_self()
#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;
int afs_pbuf_freecnt = -1;
extern int Afs_xsetgroups();
-extern int afs_xioctl();
static struct syscall_helper_data afs_syscalls[] = {
{
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);
* our hash table.
*/
void
-osi_linux_verify_alloced_memory()
+osi_linux_verify_alloced_memory(void)
{
mutex_lock(&afs_linux_alloc_sem);
# 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>
# 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
#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) {
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);
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);
#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 */
#include <afsconfig.h>
#include "afs/param.h"
+#include "afs/sysincludes.h"
+#include "afsincludes.h"
+
#include <linux/random.h>
int
#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;
}
afile->offset = 0;
- afile->proc = (int (*)())0;
+ afile->proc = NULL;
return (void *)afile;
}
{
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;
}
* 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)
{
}
#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
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)
# 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 = {
}
#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
# 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);
}
#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;
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;
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
return 0;
}
-void __exit
+static void __exit
afs_cleanup(void)
{
afs_shutdown_pagecopy();
struct user_namespace *afs_ns;
#endif
-int __init
+static int __init
afspag_init(void)
{
#if !defined(EXPORTED_PROC_ROOT_FS)
return 0;
}
-void __exit
+static void __exit
afspag_cleanup(void)
{
#if !defined(EXPORTED_PROC_ROOT_FS)
#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;
#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
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) {
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)
/* 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);
/* 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))
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);
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)) {
#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.
#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>
/***** 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;
# 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[] = {
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)
.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);
}
void
-osi_sysctl_clean()
+osi_sysctl_clean(void)
{
if (afs_sysctl) {
unregister_sysctl_table(afs_sysctl);
#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)
{
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);
}
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();
+}
#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
/* 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
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);
}
#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.
}
#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.
int code;
int offset;
afs_int32 dirpos;
- struct DirEntry *de;
+ struct DirEntryFlex *de;
struct DirBuffer entry;
ino_t ino;
int len;
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);
}
-/* 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);
}
+/* 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)
/* 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)
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;
* 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 */
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;
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;
}
}
/* 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;
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,
# 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,
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;
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
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)
* 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)
}
-#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)
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)
}
-#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,
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
#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
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;
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);
}
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)
{
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;
}
+#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;
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);
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;
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)
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),
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;
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)
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);
}
AFS_GUNLOCK();
return 0;
}
+#endif /* STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_READAHEAD */
/* Prepare an AFS vcache for writeback. Should be called with the vcache
* locked */
* 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)
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)) {
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
*/
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,
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 *
};
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,
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 */
.put_link = afs_linux_put_link,
#endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */
.setattr = afs_notify_change,
+ .getattr = afs_linux_getattr,
};
void
#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)
#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 *);
/* 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);
afsinit(struct vfssw *vfsswp, int fstype)
#endif
{
- extern int afs_xioctl();
extern int afs_xsetgroups();
AFS_STATCNT(afsinit);
}
/* 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;
}
* 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"
#include "afs/afs_prototypes.h"
#include "afs/discon.h"
#include "roken.h"
+
+#endif /* OPENAFS_AFS_UKERNEL_AFSINCLUDES_H */
\ No newline at end of file
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
#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
* !(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)
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)
{
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
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;
/* 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);
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;
}
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
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);
}
}
-void
+static void
afs_DaemonOp(long parm, long parm2, long parm3, long parm4, long parm5,
long parm6)
{
return 0;
}
-void
+static void
# if defined(AFS_LINUX_ENV) && !defined(INIT_WORK_HAS_DATA)
afsd_launcher(struct work_struct *work)
# else
# endif /* !HAVE_LINUX_KTHREAD_RUN */
}
-void
+static void
afs_DaemonOp(long parm, long parm2, long parm3, long parm4, long parm5,
long parm6)
{
#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"
}
/*------------------------------------------------------------------------
- * 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:
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;
}
{
struct brequest *tb;
int i, foundAny;
+#ifdef AFS_NEW_BKG
int n_processed = 0;
+#endif
AFS_STATCNT(afs_BackgroundDaemon);
/* initialize subsystem */
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)
if (size)
afs_stats_cmperf.dcacheMisses++;
- code = 0;
/*
* Dynamic root support: fetch data from local memory.
*/
newCallback = tc->parent->srvr->server;
setNewCallback = 1;
}
- i = osi_Time();
code = afs_CacheFetchProc(tc, rxconn, file, Position, tdc,
avc, size, tsmall);
} else
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");
*
* \return Mask of operations.
*/
-int
+static int
afs_GenStoreStatus(struct vcache *avc, struct AFSStoreStatus *astat)
{
if (!avc || !astat || !avc->f.ddirty_flags)
*
* \return 0 on success, -1 on failure
*/
-int
+static int
afs_GetParentDirFid(struct vcache *avc, struct VenusFid *afid)
{
struct dcache *tdc;
* \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)
{
*
* \note afs_DDirtyVCListLock must be write locked.
*/
-int
+static int
afs_CheckDeletedChildren(struct vcache *avc)
{
struct dcache *tdc;
* \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;
* 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)
{
* - 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;
* - 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)
{
*
* \note avc must be write locked.
*/
-int
+static int
afs_ProcessOpRemove(struct vcache *avc, struct vrequest *areq)
{
char *tname = NULL;
*
* \return 0 for success. On failure, other error codes.
*/
-int
+static int
afs_SendChanges(struct vcache *avc, struct vrequest *areq)
{
struct afs_conn *tc;
}
/*!
- * 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
{
char *dirBase = (char *)dirHeader;
struct PageHeader *pageHeader;
- struct DirEntry *dirEntry;
+ struct DirEntryFlex *dirEntry;
int sizeOfEntry, i, t1, t2;
int curPage = *curPageP;
int curChunk = *curChunkP;
dirHeader->alloMap[curPage] = EPP - 1;
}
- dirEntry = (struct DirEntry *)(pageHeader + curChunk);
+ dirEntry = (struct DirEntryFlex *)(pageHeader + curChunk);
dirEntry->flag = 1;
dirEntry->length = 0;
dirEntry->next = 0;
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);
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);
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,
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,
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;
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;
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);
-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;
return code;
}
-afs_int32
+static afs_int32
rxfs_storeUfsRead(void *r, struct osi_file *tfile, afs_uint32 offset,
afs_uint32 tlen, afs_uint32 *bytesread)
{
return 0;
}
-afs_int32
+static afs_int32
rxfs_storeMemRead(void *r, struct osi_file *tfile, afs_uint32 offset,
afs_uint32 tlen, afs_uint32 *bytesread)
{
return 0;
}
-afs_int32
+static afs_int32
rxfs_storeMemWrite(void *r, afs_uint32 l, afs_uint32 *byteswritten)
{
afs_int32 code;
return 0;
}
-afs_int32
+static afs_int32
rxfs_storeUfsWrite(void *r, afs_uint32 l, afs_uint32 *byteswritten)
{
afs_int32 code;
return 0;
}
-afs_int32
+static afs_int32
rxfs_storePadd(void *rock, afs_uint32 size)
{
afs_int32 code = 0;
return 0;
}
-afs_int32
+static afs_int32
rxfs_storeStatus(void *rock)
{
struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)rock;
return 1;
}
-afs_int32
+static afs_int32
rxfs_storeClose(void *r, struct AFSFetchStatus *OutStatus, int *doProcessFS)
{
afs_int32 code;
return code;
}
-afs_int32
+static afs_int32
rxfs_storeDestroy(void **r, afs_int32 code)
{
struct rxfs_storeVariables *v = (struct rxfs_storeVariables *)*r;
return code;
}
-afs_int32
+static afs_int32
afs_GenericStoreProc(struct storeOps *ops, void *rock,
struct dcache *tdc, int *shouldwake,
afs_size_t *bytesXferred)
#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,
* \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,
afs_hyper_t *anewDV, afs_size_t *amaxStoredLength)
{
afs_int32 code = 0;
- struct storeOps *ops;
void * rock = NULL;
unsigned int i, j;
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:
afs_int32 iovmax;
};
-afs_int32
+static afs_int32
rxfs_fetchUfsRead(void *r, afs_uint32 size, afs_uint32 *bytesread)
{
afs_int32 code;
return 0;
}
-afs_int32
+static afs_int32
rxfs_fetchMemRead(void *r, afs_uint32 tlen, afs_uint32 *bytesread)
{
afs_int32 code;
}
-afs_int32
+static afs_int32
rxfs_fetchMemWrite(void *r, struct osi_file *fP, afs_uint32 offset,
afs_uint32 tlen, afs_uint32 *byteswritten)
{
return 0;
}
-afs_int32
+static afs_int32
rxfs_fetchUfsWrite(void *r, struct osi_file *fP, afs_uint32 offset,
afs_uint32 tlen, afs_uint32 *byteswritten)
{
}
-afs_int32
+static afs_int32
rxfs_fetchClose(void *r, struct vcache *avc, struct dcache * adc,
struct afs_FetchOutput *o)
{
return code;
}
-afs_int32
+static afs_int32
rxfs_fetchDestroy(void **r, afs_int32 code)
{
struct rxfs_fetchVariables *v = (struct rxfs_fetchVariables *)*r;
return code;
}
-afs_int32
+static afs_int32
rxfs_fetchMore(void *r, afs_int32 *length, afs_uint32 *moredata)
{
afs_int32 code;
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,
int afs_icl_inited = 0;
/* init function, called once, under afs_icl_lock */
-int
+static int
afs_icl_Init(void)
{
afs_icl_inited = 1;
#endif
-void
+static void
afs_icl_AppendOne(struct afs_icl_log *logp, int type, long parm)
{
if (type) {
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)
{
osi_Assert(ISAFS_GLOCK());
#endif
if (!init_nfsexporter) {
- extern struct afs_exporter *exporter_add();
init_nfsexporter = 1;
LOCK_INIT(&afs_xnfspag, "afs_xnfspag");
#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
#endif
}
-void
-afs_osi_UnmaskUserLoop(void)
-{
-#ifdef AFS_DARWIN_ENV
- afs_osi_fullSigRestore();
-#endif
-}
-
/* register rxk listener proc info */
void
afs_osi_RxkRegister(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)
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.
*
# 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_ */
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))
static struct afspag_cell *primary_cell = 0;
-struct afspag_cell *
+static struct afspag_cell *
afspag_GetCell(char *acell)
{
struct afspag_cell *tcell;
}
-struct afspag_cell *
+static struct afspag_cell *
afspag_GetPrimaryCell(void)
{
struct afspag_cell *tcell;
*
* \post Changed ACL, via direct writing to the wire
*/
-int
-dummy_PSetAcl(char *ain, char *aout)
-{
- return 0;
-}
-
DECL_PIOCTL(PSetAcl)
{
afs_int32 code;
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, "
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;
/* 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);
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,
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;
/* 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);
}
}
-void
+static void
CkSrv_GetCaps(int nconns, struct rx_connection **rxconns,
struct afs_conn **conns)
{
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);
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 */
* 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;
* 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.
#endif
}
-void
+static void
afs_PostPopulateVCache(struct vcache *avc, struct VenusFid *afid, int seq)
{
/*
afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1);
avc->linkData = NULL;
}
+
+ osi_ResetVCache(avc);
}
/*!
{
int i;
struct vcache *tvc;
- int nq=0;
ObtainWriteLock(&afs_xvcache, 1002); /* XXX - should be a unique number */
int slept = 0;
if (afs_QueueVCB(tvc, &slept)) {
tvc->callback = NULL;
- nq++;
}
if (slept) {
goto retry;
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);
/* 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)
->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
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
>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
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);
#include <afsconfig.h>
#include <afs/param.h>
+#include <afs/opr.h>
#include <roken.h>
#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>
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
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,
* 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;
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 */
break;
}
default:
-#ifdef AFS_AIX32_ENV
code =
auditlog("AFS_Aud_EINVAL", (-1), audEvent,
(strlen(audEvent) + 1));
-#endif
return;
break;
} /* end switch */
vaEntry = va_arg(vaList, int);
} /* end while */
}
-#endif
+#endif /* AFS_AIX32_ENV */
static void
printbuf(int rec, char *audEvent, char *afsName, afs_int32 hostId,
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;
{
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;
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);
}
_afsconf_GetRxkadKrb5Key, NULL);
#ifdef AFS_RXGK_ENV
(*classes)[RX_SECIDX_GK] =
- rxgk_NewServerSecurityObject(rock, afsconf_GetRXGKKey);
+ rxgk_NewServerSecurityObject(dir, afsconf_GetRXGKKey);
#endif
}
#include <afsconfig.h>
#include <afs/param.h>
-#include <roken.h>
-
#include <afs/stds.h>
#include <afs/opr.h>
#include <afs/pthread_glock.h>
#if defined(UKERNEL)
# include "afsincludes.h"
# include <afs_usrops.h>
+#else
+# include <roken.h>
#endif
#ifdef AFS_AIX_ENV
}
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
}
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);
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)
return code;
}
if (stat != tb->goal) {
- tb->flags |= BNODE_WAIT;
- LWP_WaitProcess(tb);
+ bnode_Wait(tb);
bnode_Release(tb);
goto retry;
}
return -1; /* no longer our goal, don't keep waiting */
}
/* otherwise, block */
- abnode->flags |= BNODE_WAIT;
- LWP_WaitProcess(abnode);
+ bnode_Wait(abnode);
}
}
}
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;
}
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",
#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)))
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 * );
char *hostname;
char *cellname = NULL;
const char *confdir;
+ const char *retry_confdir;
afs_int32 code;
struct rx_connection *tconn;
afs_int32 addr;
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);
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;
}
if (code == 0) {
*aname = strdup(tname);
if (*aname == NULL)
- code = ENOMEM;
+ code = BZIO;
}
return code;
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;
}
if (arock->counter-- == 0) {
/* done */
- strcpy(arock->iname, abnode->name);
+ arock->iname = strdup(abnode->name);
return 1;
} else {
/* not there yet */
{
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[] = {
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;
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 */
/* 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);
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;
}
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;
{
struct bztemp *at = (struct bztemp *)arock;
int i;
- char tbuffer[BOZO_BSSIZE];
afs_int32 code;
if (abnode->notifier)
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;
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 */
}
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;
}
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 */
}
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;
}
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);
}
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;
}
usd_handle_t hTape;
FILE *logFile;
int count = 0;
- afs_uint32 countr;
afs_int32 code = 0;
code =
/* measure capacity of tape */
nbfTape = 0;
- countr = 0;
while (1) {
code = dataBlock(hTape, bufferSize);
nbfTape++;
count++;
- countr++;
if (code)
break;
nFileMarks = 0;
nBlocks = 0;
count = 0;
- countr = 0;
while (1) {
code = dataBlock(hTape, bufferSize);
nBlocks++;
if (code)
break;
count++;
- countr++;
if (count >= 2) {
count = 0;
/backup
/bc.h
/bucoord_errs.c
+/btest
${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
$(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
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
#
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
#include <lwp.h>
#include <rx/rx.h>
#include <afs/bubasics.h>
+#include <afs/bumon.h>
#include "bc.h"
#include "AFS_component_version_number.c"
afs_int32 code, c;
FILE *fd;
int i;
- int lineNumber;
int noExecute; /* local capy of global variable */
char *internalLoadFile;
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 */
+++ /dev/null
-/*
- * 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;
-}
$(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) \
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}
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}
$(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:
#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));
#include "AFS_component_version_number.c"
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char **argv)
{
char tbuffer[10000];
int fd;
+++ /dev/null
-/*
- * 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);
-}
--- /dev/null
+# 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
${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} $? $@
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
${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
#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
* ------------- */
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);
/* ---------- */
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);
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 */
/* ---------------------------------------------- */
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);
/* ---------- */
/* ---------- */
- 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;
}
#include <afs/butm.h>
#include "error_macros.h"
+#include "butm_prototypes.h"
int isafile = 0, debugLevel = 1;
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];
#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;
LWP_DestroyProcess(pid);
}
- IOMGR_Finalize();
- LWP_TerminateProcessSupport();
-
exit(code);
usage:
}
-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;
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);
}
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);
}
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);
}
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);
}
/* 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);
}
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);
}
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);
}
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);
}
ERROR_EXIT(8);
}
}
- if (code = butm_Dismount(&info)) {
+ if ((code = butm_Dismount(&info))) {
afs_com_err(whoami, code, "Finishing up tape");
ERROR_EXIT(8);
}
ERROR_EXIT(0);
error_exit:
LWP_SignalProcess(&tip->dumpDone);
- return (code);
+ return (void *)(intptr_t)code;
}
--- /dev/null
+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])]
+ )
+])
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"
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],
--- /dev/null
+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])
+])
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],
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
])
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
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
])
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
])
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);])
[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>],
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],
#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"],
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])
])
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"
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
])
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
[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])
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])
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])
# [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
/* end confdefs.h */
#include <linux/module.h>
$1
-
+void conftest(void);
void conftest(void)
{
$2
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],
])
-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]))
[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]))
[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])
])
[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])
])
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"
#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],
[])
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],
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],
[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
[#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],
[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],
[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],
[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],
[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);],
[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],
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);],
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],
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],
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],
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])
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],
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],
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;],
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],
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],
[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],
[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],
+ [])
+])
])
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
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}'
TSM_LIBS="-lsys -lcsys -lc"
;;
- rs_aix61)
+ rs_aix61 | rs_aix7*)
CC="cc"
DBG="-g"
LIBSYS_AIX_EXP="afsl.exp"
TSM_LIBS="-lsys -lcsys -lc"
;;
- rs_aix72)
- TSM_IMPORTS="-bI:/lib/aio.exp"
- TSM_LIBS="-lsys -lc"
- ;;
-
s390_linux26)
LD="ld"
KERN_OPTMZ=-O2
CFLAGS_NOOLDSTYLE=
CFLAGS_NOIMPLICIT_FALLTHROUGH=
CFLAGS_NOCAST_FUNCTION_TYPE=
+CFLAGS_NODANGLING_POINTER=
XCFLAGS_NOCHECKING="$XCFLAGS"
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?)
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.
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)
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)
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"
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"
;;
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
*_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
;;
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);; \
/*
* 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
#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
--- /dev/null
+#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 */
--- /dev/null
+#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 */
#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)
--- /dev/null
+#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) */
#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
--- /dev/null
+#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) */
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;}
+#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 */
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}
#ifdef KERNEL
#include "config.h"
+#include <roken.h>
#else
#include <afsconfig.h>
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
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"
#
clean:
$(RM) -f *.o *.a core AFS_component_version_number.c
+ cd test && $(MAKE) clean
include ../config/Makefile.version
# 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 */
# ifndef AFS_LINUX_ENV
# include "netinet/in.h"
# endif
+# include "afsincludes.h"
# else /* !defined(UKERNEL) */
# include "afs/stds.h"
# include "afs/sysincludes.h"
int blobs, firstelt;
int i;
struct DirBuffer entrybuf, prevbuf, headerbuf;
- struct DirEntry *ep;
+ struct DirEntryFlex *ep;
struct DirHeader *dhp;
int code;
size_t rlen;
/* 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]);
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;
#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
* 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;
}
/* 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;
}
/* 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;
}
** 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;
}
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;
/* 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;
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;
}
/* 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;
}
/* 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;
/* 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;
/* 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;
/* 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;
/* 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;
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;
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;
/* 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;
}
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),
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;
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;
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.
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);
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;
}
# 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
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
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 ; \
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 ; \
$(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 ; \
${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)
heimdal/krb5/keyblock.c
heimdal/krb5/store-int.c
heimdal/roken/ct.c
+heimdal/roken/strlcat.c
+heimdal/roken/strlcpy.c
${TOP_LIBDIR}/libafsrfc3961.a \
${XLIBS}
-OBJS=${TOP_SRCDIR}/afs/unified_afs.o
+OBJS=$(top_builddir)/src/afs/unified_afs.o
all: translate_et
) = 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);
RXAFS_GetStatistics64
RXAFS_GiveUpCallBacks
RXAFS_MakeDir
+RXAFS_OpCodeIndex
RXAFS_ReleaseLock
RXAFS_RemoveDir
RXAFS_RemoveFile
*/
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;
-}
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
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);
#include <afsconfig.h>
#include <afs/param.h>
#include <afs/stds.h>
+#include <afs/opr.h>
#include <roken.h>
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);
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)
*/
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;
goto fail_util_RPCStatsStateGet;
}
- tst = (*rpc) (conn, state);
+ tst = (*rpc) (conn, &istate);
+ *state = istate;
if (!tst) {
rc = 1;
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);
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;
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));
}
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 */
LOCKREL_TIMESTAMP, &tst);
if (tst) {
noError = 0;
- totalUE++;
-
vcode =
ubik_VL_ReleaseLock(cellHandle->vos, 0,
elem.ids[RWVOL], RWVOL,
afs_int32 nentries;
struct VldbListByAttributes attributes;
nbulkentries arrayEntries;
- int totalF;
struct nvldbentry *vllist;
int j;
afs_int32 si, nsi;
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) {
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 = \
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
$(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)
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>
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
osi_flush.o \
<all>
osi_ioctl.o \
- osi_pag_module.o
+ osi_pag_module.o
AFS_OS_NFSOBJS =
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
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+<?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>
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";
-$(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}
#include <afs_usrops.h>
#include <afs/cmd.h>
#include <afs/afs_args.h>
+#include <afs/com_err.h>
%}
%include "typemaps.i";
# 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* ) \
/* 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);
# 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
--- /dev/null
+{\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.}
--- /dev/null
+{\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.}
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
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;
# 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) {
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\" ".
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
+++ /dev/null
-#!/bin/sh
-
-# Load the OpenAFS kernel module at boot
-exec /sbin/modprobe openafs
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
--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
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"
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
%{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
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 */
|| !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. */
struct authstate {
int sec;
- const char *confdir;
+ int initialized;
char cell[MAXCELLCHARS];
};
afs_int32 sec;
int changed = 0;
const char* confdir;
+ const char* retry_confdir;
RXGK_Level rxgk_level = RXGK_LEVEL_BOGUS;
whoami = as->a0name;
}
sec = state->sec;
- if (state->confdir == NULL) {
+ if (state->initialized == 0) {
changed = 1;
}
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) {
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;
}
return code;
}
state->sec = sec;
- state->confdir = confdir;
+ state->initialized = 1;
if (cell && cell != state->cell)
strncpy(state->cell, cell, MAXCELLCHARS-1);
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
* 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;
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);
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);
}
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);
* number of threads handling incoming calls */
threadID = rxi_availProcs++;
- AFS_GUNLOCK();
while (1) {
sock = OSI_NULLSOCKET;
rxi_ServerProc(threadID, newcall, &sock);
/* assert(threadID != -1); */
/* assert(newcall != NULL); */
}
- AFS_GLOCK();
return NULL;
}
rx_GetCachedConnection
rx_GetCallAbortCode
rx_GetCallStatus
+rx_GetConnDeadTime
+rx_GetConnHardDeadTime
+rx_GetConnIdleDeadTime
rx_GetConnection
rx_GetConnectionEpoch
rx_GetConnectionId
# 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
#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 *));
/* 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);
}
* 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
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;
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) {
/*
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);
return -1;
}
-void
+static void
rxi_NatKeepAliveEvent(struct rxevent *event, void *arg1,
void *dummy, int dummy2)
{
* 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)
{
}
/* 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;
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));
static int rxi_monitor_peerStats = 0;
-void
+static void
rxi_ClearRPCOpStat(rx_function_entry_v1_p rpc_stat)
{
rpc_stat->invocations = 0;
/* 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
} 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);
}
{
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))
# 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);
}
} 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);
}
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++;
}
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);
}
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--;
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 */
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);
# 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
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
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
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;
# 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
(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)
# 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"
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);
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);
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);
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);
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));
#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
if (!xdr_u_int(xdrs, &size)) {
return (FALSE);
}
- if (size > maxsize) {
+ if (xdrs->x_op != XDR_FREE && size > maxsize) {
return (FALSE);
}
nodesize = size + 1;
int
MainCommand(struct cmd_syndesc *as, void *arock)
{
- int i;
osi_socket s;
int j;
struct sockaddr_in taddr;
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,
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,
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
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
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);
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);
/* 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.
}
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 */
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)) {
#include <afsconfig.h>
#include <afs/param.h>
+#include <afs/opr.h>
#include <roken.h>
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);
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)
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)
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;
Rflag++;
break;
case 's':
- sflag++;
+ /* Unused and ignored */
break;
case '?':
default:
*/
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;
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);
}
/*
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;
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();
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);
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')
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;
}
}
}
+/*!
+ * 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;
}
}
++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,
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 */
char hoststr[16];
char pbuffer[1028];
int fd = -1;
+#ifndef AFS_PTHREAD_ENV
afs_int32 pass;
+#endif
int first;
memset(pbuffer, 0, sizeof(pbuffer));
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) {
goto FetchEndCall;
}
nbytes = write(fd, tbuffer, tlen);
- pass++;
if (nbytes != tlen) {
code = UIOERROR;
close(fd);
/* 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));
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;
close(fd);
goto failed_locked;
}
- pass = 0;
memcpy(&ubik_dbase->version, &tversion, sizeof(struct ubik_version));
UBIK_VERSION_UNLOCK;
while (length > 0) {
#if !defined(AFS_PTHREAD_ENV)
if (pass % 4 == 0)
IOMGR_Poll();
+ pass++;
#endif
code = rx_Read(rxcall, tbuffer, tlen);
if (code != tlen) {
goto failed;
}
code = write(fd, tbuffer, tlen);
- pass++;
if (code != tlen) {
ViceLog(0, ("write failed tlen=%d, error=%d\n", tlen, code));
code = UIOERROR;
#define RPCTIMEOUT 20
#define BIGTIME 75
#define SMALLTIME 60
+#define VOTE_RPCTIMEOUT 12
/*\}*/
/*!
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;
*/
#include <afsconfig.h>
#include <afs/param.h>
+#include <afs/opr.h>
#include <roken.h>
{ /*ParseAcl */
int nplus, nminus, i, trights;
- char tname[MAXNAME];
+ char tname[MAXNAME + 1] = "";
struct AclEntry *first, *last, *tl;
struct Acl *ta;
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)
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)
/* 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"
WriteLogBuffer
afsUUID_from_string
afsUUID_to_string
+afs_exec_alt
afs_htonuuid
afs_inet_ntoa_r
afs_ntohuuid
mut->times_inside--;
if (mut->times_inside == 0) {
mut->locked = 0;
+ mut->owner = 0;
rc = pthread_mutex_unlock(&mut->mut);
}
} else {
{
char tc;
afs_int32 temp;
- char ascii[3];
+ char ascii[3] = {0};
tc = *aname;
if (tc == 0)
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)) {
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) {
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
#
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
+++ /dev/null
-/*
- * 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);
-}
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;
struct FileEntry *fe;
struct CallBack *cb;
afs_uint32 cbi;
- int n;
H_LOCK;
cbstuff.DeleteFiles++;
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);
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 {
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) +
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) +
{
struct host *host;
struct host *oldHost;
- int code;
+ int code = -1;
struct interfaceAddr interf;
int interfValid = 0;
struct Identity *identP = NULL;
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,
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)) {
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;
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);
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;
}
}
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));
}
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));
("\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));
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",
/* 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)
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 */
}
}
* 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 ||
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);
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;
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");
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)) {
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;
/* 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;
}
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;
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) {
}
if (vnode->type != vNull && VNDISK_GET_INO(vnode)) {
Buf[(offset >> vcp->logSize) - 1] = offset;
- cnt++;
}
offset += vcp->diskSize;
}
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;
}
int rxInitDone = 0;
extern struct ubik_client *cstruct;
-const char *confdir;
static struct tqHead busyHead, notokHead;
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;
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);
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 */
)
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)
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);
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");
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);
*/
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;
-}
opr/uuid
ptserver/pt_util
ptserver/pts-man
+rx/atomic
rx/event
rx/perf
volser/vos-man
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:
--- /dev/null
+/*
+ * 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;
+}
+
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");
} else {
pass("Server exited succesfully");
}
-
-
char *out_of_range_names[] = {
"/vicepiv",
"/vicepzz",
+ "vicepiv",
+ "vicepzz",
"iv",
"zz",
"255",
"/vicep",
"/vicepbogus",
"/vicep0",
+ "vice",
+ "vicep",
+ "vicepbogus",
+ "vicep0",
"foo",
"!?",
"-1",
int
main(int argc, char **argv)
{
- plan(1293);
+ plan(1299);
test_partition_name_to_id();
test_partition_id_to_name();
return 0;