# endif
#endif
-If a pragma isn't available for your particular warning, you will need to
+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
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:
: strict-proto
: all (ukernel) : syscall pointer issues
afsd/afsd_kernel.c : deprecated : daemon() marked as deprecated on Darwin
-auth/ktc.c : all (ukernel) : call_syscall doesn't have a prototype
bozo/bosserver.c : deprecated : daemon() marked as deprecated on Darwin
-bucoord/ubik_db_if.c : strict-proto : Ubik_Call
-bucoord/commands.c : all : Ubik_Call
- : signed vs unsigned for dates
-butc/tcudbprocs.c : all : ubik_Call
+bucoord/ubik_db_if.c : strict-proto : ubik_Call_SingleServer
+bucoord/commands.c : all : signed vs unsigned for dates
external/heimdal/hcrypto/validate.c: all: statement with empty body
+external/heimdal/hcrypto/evp.c: cast-function-type
+ : Linux kernel build uses -Wcast-function-type
+external/heimdal/hcrypto/evp-algs.c: cast-function-type
+ : Linux kernel build uses -Wcast-function-type
+external/heimdal/krb5/crypto.c: use-after-free : False postive on certain GCC
+ compilers
kauth/admin_tools.c : strict-proto : ubik_Call
kauth/authclient.c : strict-proto : ubik_Call nonsense
libadmin/kas/afs_kasAdmin.c: strict-proto : ubik_Call nonsense
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)
afsconfdir /usr/afs/etc $(sysconfdir)/openafs/server
afslocaldir /usr/afs/local $(localstatedir)/openafs
afsdbdir /usr/afs/db $(localstatedir)/openafs/db
- afslogdir /usr/afs/logs $(localstatedir)/openafs/logs
+ afslogsdir /usr/afs/logs $(localstatedir)/openafs/logs
afsbosconfig $(afslocaldir)/BosConfig $(afsconfdir)/BosConfig
afsbosserver $(afsbindir)/bosserver $(sbindir)/bosserver
do not start with "afs" by passing the flags with the same name to
configure. For example, if you want to install the server binaries in
/usr/local/lib/openafs instead of /usr/local/libexec/openafs, pass the
- --libexecdir=/usr/local/lib flag to configure.
+ --libexecdir=/usr/local/lib flag to configure. The individual directories
+ can also be overriden by using environment variables. For example,
+ 'afslogsdir=/var/log/openafs ./configure ...'
For additional options, see section I below.
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.
tvlserver_depinstall: config rxgen ubik_depinstall auth_depinstall
+${COMPILE_PART1} tvlserver ${COMPILE_DEPINSTALL}
-auth_depinstall: config rxgen comerr
+auth_depinstall: config rxgen comerr rxgk_depinstall
+${COMPILE_PART1} auth ${COMPILE_DEPINSTALL}
fsint_depinstall: config rxgen
ptserver_depinstall: config rxgen comerr
+${COMPILE_PART1} ptserver ${COMPILE_DEPINSTALL}
-${DEST}/bin/dedebug: dedebug
- ${INSTALL} $? $@
-
#
# libafs build targets
echo Not building afsmonitor, because no curses-headers found. ; \
fi
-tests: rxtests ubiktests rpctestlib viced
+tests: rxtests ubiktests viced
# pthread based user space RX library
libafsrpc: comerr fsint hcrypto lwp rx rxkad rxstat sys util rxgk
authtools $(DIR_roken) rxgk
+${COMPILE_PART1} finale ${COMPILE_PART2}
-rpctestlib: util fsint rx opr libafsrpc libafsauthent
- +${TEST_PART1} rpctestlib ${COMPILE_PART2}
-
finale: finale_notest test_build
finale_nolibafs: finale_nolibafs_notest test_build_nolibafs
cd tests && $(MAKE) all
check test: finale_notest
- cd tests && $(MAKE) check
+ cd tests && $(MAKE) check TESTS="$(TESTS)"
force:
-${COMPILE_PART1} bozo ${COMPILE_CLEAN}
-${COMPILE_PART1} vfsck ${COMPILE_CLEAN}
-${COMPILE_PART1} tsm41 ${COMPILE_CLEAN}
- -${COMPILE_PART1} sia ${COMPILE_CLEAN}
-${COMPILE_PART1} aklog ${COMPILE_CLEAN}
-${COMPILE_PART1} pam ${COMPILE_CLEAN}
-${COMPILE_PART1} afsweb ${COMPILE_CLEAN}
/bin/rm -rf lib include packages
/bin/rm -f config.log config.cache config.status \
src/config/afsconfig.h src/config/stamp-h1 \
+ src/config/cc-wrapper \
src/libafs/Makefile \
src/libuafs/Makefile \
Makefile \
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 \
src/volser/Makefile \
src/xstat/Makefile \
tests/Makefile \
- tests/rpctestlib/Makefile \
tests/tap/Makefile \
tests/auth/Makefile \
tests/cmd/Makefile \
User-Visible OpenAFS Changes
+OpenAFS 1.9.1
+
+ All platforms
+
+ * Fix initial Rx Connection ID (CID) generation.
+ Remove stale initialization and overflow detection logic that resulted
+ in connection failures due to all CIDs being set to 0x80000002.
+ (14491, 14492, 14496)
+
+ * Fix RPC hangs if a server is restarted while a client is sending
+ data (13875 13758 13876).
+
+ * Fix xstat_cm_test/xstat_fs_test -period option bug introduced
+ by pthreaded xstats. (14366)
+
+ * Fix remote_is_server field in Rx RPC statistics. Before this fix, the
+ rxstat_get_process and rxstat_get_peer programs reported all RPC stats
+ as "accessed as a client" (14374).
+
+ * Fix an incorrect server type reported by rxstat_get_process and
+ rxstat_get_peer programs (14375).
+
+ * Fix the clock square calculation for stats reported by xstat_fs_test,
+ xstat_cm_test, rxstat_get_process, and rxstat_get_peer (14376)
+
+ * Avoid packet resend delays when ICMP socket errors are
+ encountered (14424).
+
+ * Report RxRPC packet statistics for version packets, that had previously
+ been ignored (14519).
+
+ * Fix various issues detected by static-analyzer tools (13155, 13156,
+ 13163, 13206, 13333, 14501).
+
+ All server platforms
+
+ * Add support for multiple audit log interfaces and options (13774).
+
+ * Fix a directory handle leak in the convertROtoRWvolume procedure
+ when a new transaction cannot be created (14342).
+
+ * Fix out of range memory access when orphaned vnodes are encountered
+ during salvages (14385).
+
+ * Add KeyFileExt and rxkey.keytab access rights checks to the
+ bosserver and log all access check failures instead of stopping
+ on the first failure (14239, 14330).
+
+ * Fix creation of the bosserver audit log file when the bosserver
+ is started with the -auditlog option (14381)
+
+ * Fix 'bos salvage -forceDAFS' when the DAFS fileserver is stopped (14382).
+
+ * Add VL_DBBAD ("Database is inconsistent") error code to indicate vlserver
+ database inconsistencies, and report VL_DBBAD when unable to remove
+ deleted vlentries from the database hash chains (13382, 13383)
+
+ * Fix possible memory leaks when under memory pressure (13156 13313).
+
+ * Fix possible double release of volume locks in vos release
+ and vos convertROtoRW (14426).
+
+ * Fix -partition option requires a -server option checks in vos (14005).
+
+ * Take the target read/write volume offline during the conversion
+ to a read-only volume by vos convertRWtoRO (14340).
+
+ * Check for volume lock inconsistencies in vldb_check (14307).
+
+ * Document vos restore -readonly option (14348).
+
+ * Consolidate implementation of, and more reliably use, logged warnings
+ for single-DES or missing keys (10831).
+
+ All client platforms
+
+ * Avoid panic when failing to allocate a new vnode or
+ failing to write a dcache (13701, 13804).
+
+ * Fix double release of afs_xvcb lock (14411).
+
+ * Log process name and PID on disk cache read errors (14416).
+
+ * Add cache-too-full and wait-for-drain cache manager stats (13168).
+
+ * Add afsio readdir and afsio fidreaddir commands to dump
+ AFS3 directories (12381).
+
+ * Fix diagnostic messages from "vos partinfo" to correctly refer to
+ itself (14489).
+
+ Linux
+
+ * Fix file leak in background thread regression introduced by
+ 13284 (LINUX: Turn on AFS_NEW_BKG). (13984)
+
+ * Avoid getcwd() and bind-mount call errors by returning
+ errors from the d_revalidate callback (14417).
+
+ * Fix 64/32bit compatibility mode checks for Linux 5.11
+ support (14499, 14500).
+
+ * Support Linux 5.12-RC2 (14548, 14549).
+
+ Solaris
+
+ * Add the OpenAFS provider for the Solaris kstat framework (13170).
+
+ FreeBSD
+
+ * Import the start of a series of locking and stability fixes developed by
+ Tim Creech and Andrew Deason that will culminate in a client that
+ supports FreeBSD 12.2 (13854, 13856, 13858..13860, 13998..14000, 14162,
+ 14373, 14550,
+
+
OpenAFS 1.9.0
All platforms
$(NTMAKE)
$(CD) ..\..\..
-rpctestlib: config fsint libafsrpc
- @echo ***** $@
- $(DOCD) $(TESTS)\$@
- $(CD) $(TESTS)\$@
- $(NTMAKE)
- $(CD) ..\..
-
libafscp: libafscp_headers util afs volser vlserver rx auth fsint afsdobjs
@echo ***** $@
$(DOCD) $(SRC)\$@
$(NTMAKE)
$(CD) ..\..
-install: finale afsrdr tools rpctestlib extra
+install: finale afsrdr tools extra
@echo Build Finished Successfully
OPENAFS_CURSES
OPENAFS_C_ATTRIBUTE
OPENAFS_C_PRAGMA
+OPENAFS_C_FLEXIBLE_ARRAY
OPENAFS_MORE_ROKEN_CHECKS
OPENAFS_NETDB_CHECKS
-AC_HEADER_TIME
OPENAFS_ROKEN_HEADERS
OPENAFS_BSWAP_CHECKS
OPENAFS_PIO_CHECKS
config.sub
git-version
install-sh
+ltmain.sh
missing
mkinstalldirs
AC_CONFIG_AUX_DIR([build-tools])
AC_CONFIG_SRCDIR([src/libafs/Makefile.common.in])
-AC_CONFIG_HEADER([src/config/afsconfig.h])
-MACOS_VERSION=1.9.0
+AC_CONFIG_HEADERS([src/config/afsconfig.h])
+MACOS_VERSION=1.9.1
AC_SUBST([MACOS_VERSION])
AC_CONFIG_MACRO_DIR([src/cf])
AC_CONFIG_SRCDIR([src/config/stds.h])
-AC_CONFIG_HEADER([src/config/afsconfig.h])
-MACOS_VERSION=1.9.0
+AC_CONFIG_HEADERS([src/config/afsconfig.h])
+MACOS_VERSION=1.9.1
AC_SUBST([MACOS_VERSION])
AC_USE_SYSTEM_EXTENSIONS
-AFS_LT_INIT
-
AC_PROG_CC
AC_PATH_PROGS([PATH_CPP], [cpp], [${CC-cc} -E], [$PATH:/lib:/usr/ccs/lib])
dnl Checks for summary
OPENAFS_SUMMARY_CHECK_NAMEI
-AS_IF([test -d 'doc/man-pages'],
+AS_IF([test -d "$srcdir/doc/man-pages"],
[MAN_MAKEFILE="doc/man-pages/Makefile doc/man-pages/install-man"],
[MAN_MAKEFILE=])
-AS_IF([test -f 'doc/xml/AdminGuide/Makefile.in'],
+AS_IF([test -f "$srcdir/doc/xml/AdminGuide/Makefile.in"],
[ADMINGUIDE_MAKEFILE="doc/xml/AdminGuide/Makefile"],
[ADMINGUIDE_MAKEFILE=])
-AS_IF([test -f 'doc/xml/QuickStartUnix/Makefile.in'],
+AS_IF([test -f "$srcdir/doc/xml/QuickStartUnix/Makefile.in"],
[QSUNIX_MAKEFILE="doc/xml/QuickStartUnix/Makefile"],
[QSUNIX_MAKEFILE=])
-AS_IF([test -f 'doc/xml/UserGuide/Makefile.in'],
+AS_IF([test -f "$srcdir/doc/xml/UserGuide/Makefile.in"],
[USERGUIDE_MAKEFILE="doc/xml/UserGuide/Makefile"],
[USERGUIDE_MAKEFILE=])
-AS_IF([test -f 'doc/xml/AdminRef/Makefile.in'],
+AS_IF([test -f "$srcdir/doc/xml/AdminRef/Makefile.in"],
[ADMINREF_MAKEFILE="doc/xml/AdminRef/Makefile"],
[ADMINREF_MAKEFILE=])
-AS_IF([test -f 'doc/xml/mobi-fixup.xsl.in'],
+AS_IF([test -f "$srcdir/doc/xml/mobi-fixup.xsl.in"],
[MOBI_FIXUP_XSL="doc/xml/mobi-fixup.xsl"],
[MOBI_FIXUP_XSL=])
-AS_IF([test -f 'doc/doxygen/Doxyfile.in'],
+AS_IF([test -f "$srcdir/doc/doxygen/Doxyfile.in"],
[DOXYFILE="doc/doxygen/Doxyfile"],
[DOXYFILE=])
tests/cmd/Makefile
tests/common/Makefile
tests/opr/Makefile
- tests/rpctestlib/Makefile
tests/rx/Makefile
tests/tap/Makefile
tests/util/Makefile
chmod +x install-man
mkdir -p $(DEST)/man/man1 $(DEST)/man/man3 \
$(DEST)/man/man5 $(DEST)/man/man8
- set -e; for M in man1/*.1 man3/*.3 man5/*.5 man8/*.8 ; do \
+ set -e; orig_pwd=`pwd` ; cd $(srcdir) ; \
+ for M in man1/*.1 man3/*.3 man5/*.5 man8/*.8 ; do \
+ cd $$orig_pwd ; \
if ! [ -e $$M.noinstall ] ; then \
- ./install-man $$M $(DEST)/man/$$M ; \
+ ./install-man $(srcdir)/$$M $(DEST)/man/$$M ; \
fi ; \
done
set -e; for M in ${LINKEDPAGES}; do \
chmod +x install-man
mkdir -p $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man3 \
$(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man8
- set -e; for M in man1/*.1 man3/*.3 man5/*.5 man8/*.8 ; do \
+ set -e; orig_pwd=`pwd` ; cd $(srcdir) ; \
+ for M in man1/*.1 man3/*.3 man5/*.5 man8/*.8 ; do \
+ cd $$orig_pwd ; \
if ! [ -e $$M.noinstall ] ; then \
- ./install-man $$M $(DESTDIR)$(mandir)/$$M ; \
+ ./install-man $(srcdir)/$$M $(DESTDIR)$(mandir)/$$M ; \
fi; \
done
set -e; for M in ${LINKEDPAGES}; do \
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.
=item B<-literal>
-Windows only: for a symlink or mount point, evaluates the specified object
-rather than the object it refers to.
+For a symlink or mount point, evaluates the specified object rather than
+the object it refers to.
=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
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>
processes run on the machine. It specifies how the BOS Server reacts when
a process fails, and also defines the times at which the BOS Server
automatically restarts processes as part of performance maintenance. The
-file must reside in the F</usr/afs/local> directory on each AFS server
-machine.
+F</usr/afs/local/BosConfig> file must be present on each AFS server machine.
A server process entry in the F<BosConfig> file records the following
information:
issues a remote command that affects the machine's AFS server functioning,
such as commands from the AFS command suites. Because failure to check
authorization exposes the machine's AFS server functionality to attack,
-there are normally only two circumstances in which the file is present:
-
-=over 4
-
-=item *
-
-During installation of the machine, as instructed in the I<OpenAFS Quick
-Start Guide>.
-
-=item *
-
-During correction of a server encryption key emergency, as discussed in
-the I<OpenAFS Administration Guide>.
-
-=back
-
-In all other circumstances, the absence of the file means that the AFS
-server processes perform authorization checking, verifying that the issuer
-of a command has the required privilege.
+this file should never be created. It was once necessary to use
+NoAuth when initializing a new cell, but B<-localauth> and other
+tooling means that new cells can be running securely from the start.
+As such, this file is just a historical vestige.
+
+The absence of the file means that the AFS server processes perform
+authorization checking, verifying that the issuer of a command has the
+required privilege.
Create the file in one of the following ways:
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
Offer the SANEACLS capability for the fileserver. This option is
currently unimplemented.
+-item B<-cve-2018-7168-enforce>
+
+To address L<CVE-2018-7168|https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-7168>
+disable fileserver opcode RXAFS_StoreACL (134). This opcode was replaced
+with RXAFS_StoreACL (164). The opcode 164 is always available; this option serves
+only to disable the old opcode 134, for which client intent is unreliable.
+
=item B<-help>
Prints the online help for this command. All other valid options are
S<<< [B<-mrafslogs>] >>>
S<<< [B<-transarc-logs>] >>>
S<<< [B<-saneacls>] >>>
+ S<<< [B<-cve-2018-7168-enforce>] >>>
S<<< [B<-help>] >>>
S<<< [B<-vhandle-setaside> <I<fds reserved for non-cache io>>] >>>
S<<< [B<-vhandle-max-cachesize> <I<max open files>>] >>>
S<<< [B<-follow> <I<log name>>] >>>
S<<< [B<-file> <I<output filename>>] >>>
S<<< [B<-sleep> <I<seconds between reads>>] >>>
+ S<<< [B<-debug>] >>>
[B<-help>]
B<fstrace d> S<<< [B<-se> <I<set name>>+] >>>
S<<< [B<-fo> <I<log name>>] >>>
S<<< [B<-fi> <I<output filename>>] >>>
S<<< [B<-sl> <I<seconds between reads>>] >>>
+ S<<< [B<-d>] >>>
[B<-h>]
=for html
To write the log continuously to the standard output stream or to a file,
use the B<-follow> argument. By default, the log's contents are written
out every ten seconds and then automatically cleared. To change the
-interval between writes, use the B<-sleep> argument.
+interval between writes, use the B<-sleep> argument. To display the raw
+format of each trace log entry, use the B<-debug> argument.
=head1 CAUTIONS
it is dumped continuously. Provide the B<-follow> argument along with this
one. If this argument is omitted, the default interval is ten seconds.
+=item B<-debug>
+
+Specifies that each record in the trace log should be displayed in its raw
+hex format as well as the normal decoded output.
+
=item B<-help>
Prints the online help for this command. All other valid options are
padding is an unused field and should always be zeros.
header_size is the length of the reserved space for the ubik header,
-and will always be 0x64.
+and will always be 0x40.
epoch is the ubik epoch.
<listitem>
<para>This zero-length file instructs all AFS server processes running on the machine not to perform authorization
checking. Thus, they perform any action for any user, even <emphasis role="bold">anonymous</emphasis>. This very
- insecure state is useful only in rare instances, mainly during the installation of the machine.</para>
+ insecure state was once a part of the initial installation
+procedure, but is no longer needed. It should not be used.</para>
<para>The file is created automatically when you start the initial <emphasis role="bold">bosserver</emphasis> process
with the <emphasis role="bold">-noauth</emphasis> flag, or issue the <emphasis role="bold">bos setauth</emphasis>
in that directory, then the servers do not check for authorization. When it is not present (the usual case), they perform
authorization checking.</para>
- <para>Control the presence of the <emphasis role="bold">NoAuth</emphasis> file through the BOS Server. When you disable
- authorization checking with the <emphasis role="bold">bos setauth</emphasis> command (or, during installation, by putting the
- <emphasis role="bold">-noauth</emphasis> flag on the command that starts up the BOS Server), the BOS Server creates the
- zero-length <emphasis role="bold">NoAuth</emphasis> file. When you reenable authorization checking, the BOS Server removes the
- file.</para>
-
<indexterm>
<primary>bos commands</primary>
Database and the <emphasis role="bold">KeyFile</emphasis> file on every server machine, so that the TGS and all server processes
again share the same key.</para>
- <para>Handling key emergencies requires some unusual actions. The reasons for these actions are explained in the following
- sections; the actual procedures appear in the subsequent instructions.</para>
-
- <sect2 id="HDRWQ371">
- <title>Prevent Mutual Authentication</title>
-
- <para>It is necessary to prevent the server processes from trying to mutually authenticate with you as you deal with a key
- emergency, because they possibly cannot decrypt your token. When you do not mutually authenticate, the server processes assign
- you the identity <emphasis role="bold">anonymous</emphasis>. To prevent mutual authentication, use the <emphasis
- role="bold">unlog</emphasis> command to discard your tokens and include the <emphasis role="bold">-noauth</emphasis> flag on
- every command where it is available.</para>
- </sect2>
-
- <sect2 id="Header_423">
- <title>Disable Authorization Checking by Hand</title>
-
- <para>Because the server processes recognize you as the user <emphasis role="bold">anonymous</emphasis> when you do not
- mutually authenticate, you must turn off authorization checking. Only with authorization checking disabled do the server
- processes allow the <emphasis role="bold">anonymous</emphasis> user to perform privileged actions such as key creation.</para>
-
- <para>In an emergency, disable authorization checking by creating the file <emphasis
- role="bold">/usr/afs/local/NoAuth</emphasis> by hand. In normal circumstances, use the <emphasis role="bold">bos
- setauth</emphasis> command instead.</para>
- </sect2>
-
- <sect2 id="Header_424">
- <title>Work Quickly on Each Machine</title>
-
- <para>Disabling authorization checking is a serious security exposure, because server processes on the affected machine
- perform any action for anyone. Disable authorization checking only for as long as necessary, completing all steps in an
- uninterrupted session and as quickly as possible.</para>
- </sect2>
-
- <sect2 id="Header_425">
- <title>Work at the Console</title>
-
- <para>Working at the console of each server machine on which you disable authorization checking ensures that no one else logs
- onto the console while you are working there. It does not prevent others from connecting to the machine remotely (using the
- <emphasis role="bold">telnet</emphasis> program, for example), which is why it is important to work quickly. The only way to
- ensure complete security is to disable network traffic, which is not a viable option in many environments. You can improve
- security in general by limiting the number of people who can connect remotely to your server machines at any time, as
- recommended in <link linkend="HDRWQ74">Improving Security in Your Cell</link>.</para>
- </sect2>
-
- <sect2 id="HDRWQ372">
- <title>Change Individual KeyFile Files</title>
-
- <para>If you use the Update Server to distribute the contents of the <emphasis role="bold">/usr/afs/etc</emphasis> directory,
- an emergency is the only time when it is appropriate to change the <emphasis role="bold">KeyFile</emphasis> file on individual
- machines instead. Updating each machine's file is necessary because mismatched keys can prevent the system control machine's
- <emphasis role="bold">upserver</emphasis> process from mutually authenticating with <emphasis
- role="bold">upclientetc</emphasis> processes on other server machines, in which case the <emphasis
- role="bold">upserver</emphasis> process refuses to distribute its <emphasis role="bold">KeyFile</emphasis> file to
- them.</para>
-
- <para>Even if it appears that the Update Server is working correctly, the only way to verify that is to change the key on the
- system control machine and wait the standard delay period to see if the <emphasis role="bold">upclientetc</emphasis> processes
- retrieve the key. During an emergency, it does not usually make sense to wait the standard delay period. It is more efficient
- simply to update the file on each server machine separately. Also, even if the Update Server can distribute the file
- correctly, other processes can have trouble because of mismatched keys. The following instructions add the new key file on the
- system control machine first. If the Update Server is working, then it is distributing the same change as you are making on
- each server machine individually.</para>
-
- <para>If your cell does not use the Update Server or you always change keys on server
- machines individually. The following instructions are also appropriate for you.</para>
- </sect2>
-
- <sect2 id="Header_427">
- <title>Two Component Procedures</title>
-
- <para>There are two subprocedures used frequently in the following instructions: disabling authorization checking and
- reenabling it. For the sake of clarity, the procedures are detailed here; the instructions refer to them as necessary.</para>
-
- <sect3 id="HDRWQ373">
- <title>Disabling Authorization Checking in an Emergency</title>
-
- <orderedlist>
- <listitem>
- <para>Become the local superuser <emphasis role="bold">root</emphasis> on the machine, if you are not already, by
- issuing the <emphasis role="bold">su</emphasis> command. <programlisting>
- % <emphasis role="bold">su root</emphasis>
- Password: <<replaceable>root_password</replaceable>>
-</programlisting></para>
-
- <indexterm>
- <primary>NoAuth file</primary>
-
- <secondary>creating in emergencies</secondary>
- </indexterm>
- </listitem>
-
- <listitem id="LIWQ374">
- <para>Create the file <emphasis role="bold">/usr/afs/local/NoAuth</emphasis> to disable
- authorization checking. <programlisting>
- # <emphasis role="bold">touch /usr/afs/local/NoAuth</emphasis>
-</programlisting></para>
-
- <indexterm>
- <primary>unlog command</primary>
-
- <secondary>when handling key emergency</secondary>
- </indexterm>
- </listitem>
-
- <listitem>
- <para>Discard your tokens, in case they were sealed with an incompatible key, which can prevent some commands from
- executing. <programlisting>
- # <emphasis role="bold">unlog</emphasis>
-</programlisting></para>
- </listitem>
- </orderedlist>
- </sect3>
-
- <sect3 id="HDRWQ375">
- <title>Reenabling Authorization Checking in an Emergency</title>
-
- <orderedlist>
- <listitem>
- <para>Become the local superuser <emphasis role="bold">root</emphasis> on the machine, if you are not already, by
- issuing the <emphasis role="bold">su</emphasis> command. <programlisting>
- % <emphasis role="bold">su root</emphasis>
- Password: <<replaceable>root_password</replaceable>>
-</programlisting></para>
- </listitem>
-
- <listitem>
- <para>Remove the <emphasis role="bold">/usr/afs/local/NoAuth</emphasis> file. <programlisting>
- # <emphasis role="bold">rm /usr/afs/local/NoAuth</emphasis>
-</programlisting></para>
-
- <indexterm>
- <primary>klog command</primary>
-
- <secondary>when handling key emergency</secondary>
- </indexterm>
- </listitem>
-
- <listitem>
- <para>Authenticate as an administrative identity that belongs to the <emphasis
- role="bold">system:administrators</emphasis> group and is listed in the <emphasis
- role="bold">/usr/afs/etc/UserList</emphasis> file. <programlisting>
- # <emphasis role="bold">klog</emphasis> <<replaceable>admin_user</replaceable>>
- Password: <<replaceable>admin_password</replaceable>>
-</programlisting></para>
- </listitem>
-
- <listitem>
- <para>If appropriate, log out from the console (or close the remote connection you are using), after issuing the
- <emphasis role="bold">unlog</emphasis> command to destroy your tokens.</para>
- </listitem>
- </orderedlist>
- </sect3>
- </sect2>
+ <para>Installing a new server encryption key involves logging in to each
+ server machine as root and confirming that the correct (i.e., new) key
+ are in place in the <emphasis role="bold">KeyFileExt</emphasis> or
+ <emphasis role="bold">rxkad.keytab</emphasis> (for OpenAFS 1.8.x
+ releases). The same keys must be installed on all servers in the cell,
+ and when Kerberos is used for authentication, must match the key in the
+ Kerberos database.</para>
+
+ <para>While the keys are being installed, remote operations using
+ regular authentication mechanisms, even with administrator credentials,
+ may (continue to) fail. Similarly, the ubik synchronization protocol
+ among database servers may fail to synchronize due to the servers not
+ being able to authenticate each other, making write operations to the
+ database impossible. In order to interact with individual server
+ processes, the <emphasis role="bold">-localauth</emphasis> flag is used,
+ allowing commands that are run on a system that has the cell's key (such
+ as the server itself) to successfully authenticate as an administrator.
+ Once the new keys are installed on all database servers and the
+ 90-second ubik recovery time has passed, the database servers should have
+ elected a new coordinator, allowing write transactions to proceed
+ again.</para>
<sect2 id="Header_430">
<title>To create a new server encryption key in emergencies</title>
params.out = buffer;
params.out_size = ACL_LEN;
-#if defined(AFS_PPC64_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+#if defined(AFS_PPC64_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
if(pioctl(path, VIOCGETAL, ¶ms, 1)) {
-#else /* AFS_PPC_LINUX20_ENV */
+#else /* AFS_PPC_LINUX_ENV */
if(syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, VIOCGETAL, ¶ms, 1)) {
-#endif /* AFS_PPC_LINUX20_ENV */
+#endif /* AFS_PPC_LINUX_ENV */
fprintf(stderr, "ERROR: ACL::getACL -> VIOCGETAL failed: %d, path: %s\n", errno, path);
free(buffer);
return NULL;
params.out = NULL;
params.out_size = 0;
-#if defined(AFS_PPC64_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+#if defined(AFS_PPC64_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
if(pioctl(path, VIOCSETAL, ¶ms, 1)) {
-#else /* AFS_PPC_LINUX20_ENV */
+#else /* AFS_PPC_LINUX_ENV */
if(syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, VIOCSETAL, ¶ms, 1)) {
-#endif /* AFS_PPC_LINUX20_ENV */
+#endif /* AFS_PPC_LINUX_ENV */
fprintf(stderr, "ERROR: ACL::setACL -> VIOCSETAL failed: %d, path: %s\n", errno, path);
return JNI_FALSE;
}
| directory | description |
| --------- | ----------- |
-| afsinstall | Installation scripts and notes from IBM AFS |
| afsweb | Authenticated AFS access for older versions of Apache |
| JAVA | Java API library for OpenAFS development |
| kauth | Obsolete Kerberos-4 server (`kaserver`) and related programs |
rxconnp = cm_GetRxConn(connp);
code = RXAFS_StoreACL(rxconnp, &fid, &acl, &fileStatus, &volSync);
+ if (code == RXGEN_OPCODE)
+ code = RXAFS_OldStoreACL(rxconnp, &fid, &acl, &fileStatus, &volSync);
rx_PutConnection(rxconnp);
} while (cm_Analyze(connp, userp, reqp, &scp->fid, NULL, 1, &fileStatus, &volSync, NULL, NULL, code));
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;
AFS_STATCNT(afs_unmount);
afs_globalVFS = 0;
- afs_cold_shutdown = 1;
- afs_shutdown();
+ afs_shutdown(AFS_COLD);
AFS_VFSUNLOCK();
return 0;
int afs_osicred_initialized = 0;
-afs_ucred_t afs_osi_cred;
extern struct osi_dev cacheDev;
extern struct mount *afs_cacheVfsp;
int afs_CacheFSType = -1;
ret = va.va_fileid;
#elif !defined(VTOH)
struct vattr va;
- if (VOP_GETATTR(avp, &va, &afs_osi_cred, current_proc()))
+ if (VOP_GETATTR(avp, &va, afs_osi_credp, current_proc()))
osi_Panic("VOP_GETATTR failed in VnodeToIno\n");
ret = va.va_fileid;
#else
return va.va_fsid; /* XXX they say it's the dev.... */
#elif !defined(VTOH)
struct vattr va;
- if (VOP_GETATTR(avp, &va, &afs_osi_cred, current_proc()))
+ if (VOP_GETATTR(avp, &va, afs_osi_credp, current_proc()))
osi_Panic("VOP_GETATTR failed in VnodeToDev\n");
return va.va_fsid; /* XXX they say it's the dev.... */
#else
osi_Panic("UFSOpen called for non-UFS cache\n");
}
if (!afs_osicred_initialized) {
- memset(&afs_osi_cred, 0, sizeof(afs_ucred_t));
- afs_osi_cred.cr_ref++;
+ afs_osi_credp = afs_osi_Alloc(sizeof(*afs_osi_credp));
+ osi_Assert(afs_osi_credp != NULL);
+ memset(afs_osi_credp, 0, sizeof(*afs_osi_credp));
+ afs_osi_credp->cr_ref++;
#ifndef AFS_DARWIN110_ENV
- afs_osi_cred.cr_ngroups = 1;
+ afs_osi_credp->cr_ngroups = 1;
#endif
afs_osicred_initialized = 1;
}
if (code == 0 && !VATTR_ALL_SUPPORTED(&tvattr))
code = EINVAL;
#else
- code = VOP_GETATTR(afile->vnode, &tvattr, &afs_osi_cred, current_proc());
+ code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp, current_proc());
#endif
AFS_GLOCK();
if (code == 0) {
#else
VATTR_NULL(&tvattr);
tvattr.va_size = asize;
- code = VOP_SETATTR(afile->vnode, &tvattr, &afs_osi_cred, current_proc());
+ code = VOP_SETATTR(afile->vnode, &tvattr, afs_osi_credp, current_proc());
#endif
AFS_GLOCK();
return code;
#else
code =
gop_rdwr(UIO_READ, afile->vnode, (caddr_t) aptr, asize, afile->offset,
- AFS_UIOSYS, IO_UNIT, &afs_osi_cred, &resid);
+ AFS_UIOSYS, IO_UNIT, afs_osi_credp, &resid);
#endif
AFS_GLOCK();
if (code == 0) {
#else
code =
gop_rdwr(UIO_WRITE, afile->vnode, (caddr_t) aptr, asize,
- afile->offset, AFS_UIOSYS, IO_UNIT, &afs_osi_cred,
+ afile->offset, AFS_UIOSYS, IO_UNIT, afs_osi_credp,
&resid);
#endif
AFS_GLOCK();
{
AFS_STATCNT(shutdown_osifile);
if (afs_cold_shutdown) {
+ if (afs_osi_credp != NULL) {
+ afs_osi_Free(afs_osi_credp, sizeof(*afs_osi_credp));
+ afs_osi_credp = NULL;
+ }
afs_osicred_initialized = 0;
}
}
#ifndef AFS_DARWIN80_ENV
#include <ufs/ufs/ufsmount.h>
#endif
-extern struct ucred afs_osi_cred;
+extern struct ucred *afs_osi_credp;
extern int afs_CacheFSType;
#ifdef AFS_DARWIN80_ENV
int code;
vfs_context_t ctx;
char volfspath[64];
+ size_t len = sizeof(volfspath);
*vpp = 0;
*perror = 0;
- sprintf(volfspath, "/.vol/%d/%d", dev, inode);
+ if (snprintf(volfspath, len, "/.vol/%d/%d", dev, inode) >= len) {
+ *perror = BAD_IGET;
+ return ENAMETOOLONG;
+ }
code = vnode_open(volfspath, O_RDWR, 0, 0, &vp, afs_osi_ctxtp);
if (code) {
*perror = BAD_IGET;
iforget(vp);
return (ENOENT);
}
- VOP_GETATTR(vp, va, &afs_osi_cred, current_proc());
+ VOP_GETATTR(vp, va, afs_osi_credp, current_proc());
if (va->va_mode == 0) {
/* Not an allocated inode */
iforget(vp);
#define osi_curproc() current_proc()
/* FIXME */
-#define osi_curcred() &afs_osi_cred
+#define osi_curcred() afs_osi_credp
#ifdef AFS_DARWIN80_ENV
# define afsio_free(X) uio_free(X)
EVTLOCK_LOCK(evp);
nevp = evp->next;
if (evp->refcount == 0) {
+ EVTLOCK_UNLOCK(evp);
EVTLOCK_DESTROY(evp);
*pevpp = evp->next;
osi_FreeSmallSpace(evp);
memset(mnt_stat->f_mntfromname, 0, MNAMELEN);
if (data == 0) {
- strcpy(mnt_stat->f_mntfromname, "AFS");
+ if (strlcpy(mnt_stat->f_mntfromname, "AFS", MNAMELEN) >= MNAMELEN) {
+ AFS_GUNLOCK();
+ return ENAMETOOLONG;
+ }
/* null terminated string "AFS" will fit, just leave it be. */
vfs_setfsprivate(mp, NULL);
} else {
memset(volName + size, 0, MNAMELEN - size);
if (volName[0] == 0) {
- strcpy(mnt_stat->f_mntfromname, "AFS");
+ if (strlcpy(mnt_stat->f_mntfromname, "AFS", MNAMELEN) >= MNAMELEN) {
+ AFS_GUNLOCK();
+ return ENAMETOOLONG;
+ }
vfs_setfsprivate(mp, &afs_rootFid);
} else {
struct cell *localcell = afs_GetPrimaryCell(READ_LOCK);
vflush(mp, NULLVP, FORCECLOSE/*0*/);
AFS_GLOCK();
afs_globalVFS = 0;
- afs_shutdown();
+ afs_shutdown(AFS_WARM);
} else {
AFS_GUNLOCK();
return EBUSY;
if (vop_cred)
code = afs_close(avc, ap->a_fflag, vop_cred);
else
- code = afs_close(avc, ap->a_fflag, &afs_osi_cred);
+ code = afs_close(avc, ap->a_fflag, afs_osi_credp);
osi_FlushPages(avc, vop_cred); /* hold GLOCK, but not basic vnode lock */
/* This is legit; it just forces the fstrace event to happen */
code = afs_CheckCode(code, NULL, 60);
if (vop_cred)
error = afs_fsync(VTOAFS(vp), vop_cred);
else
- error = afs_fsync(VTOAFS(vp), &afs_osi_cred);
+ error = afs_fsync(VTOAFS(vp), afs_osi_credp);
if (!haveGlock) AFS_GUNLOCK();
return error;
}
#include <sys/lock.h>
#include <sys/time.h>
#include <sys/mutex.h>
+#include <sys/sx.h>
#include <sys/vnode.h>
#include <sys/priv.h>
int afs_pbuf_freecnt = -1;
extern int Afs_xsetgroups();
-extern int afs_xioctl();
static struct syscall_helper_data afs_syscalls[] = {
{
AFS_GLOCK();
AFS_STATCNT(afs_unmount);
afs_globalVFS = 0;
- afs_shutdown();
+ afs_shutdown(AFS_WARM);
AFS_GUNLOCK();
out:
{
struct vnode *vp;
struct vm_object *obj;
- int anyio, tries;
- ReleaseWriteLock(&avc->lock);
- AFS_GUNLOCK();
- tries = 5;
vp = AFSTOV(avc);
-
/*
- * I don't understand this. Why not just call vm_object_page_clean()
- * and be done with it? I particularly don't understand why we're calling
- * vget() here. Is there some reason to believe that the vnode might
- * be being recycled at this point? I don't think there's any need for
- * this loop, either -- if we keep the vnode locked all the time,
- * that and the object lock will prevent any new pages from appearing.
- * The loop is what causes the race condition. -GAW
+ * VOP_ISLOCKED may return LK_EXCLOTHER here, since we may be running in a
+ * BOP_STORE background operation, and so we're running in a different
+ * thread than the actual syscall that has the vnode locked. So we cannot
+ * just call ASSERT_VOP_LOCKED (since that will fail if VOP_ISLOCKED
+ * returns LK_EXCLOTHER), and instead we just have our own assert here.
*/
- do {
- anyio = 0;
-
- obj = vp->v_object;
- if (obj != NULL && obj->flags & OBJ_MIGHTBEDIRTY) {
- if (!vget(vp, LK_EXCLUSIVE | LK_RETRY, curthread)) {
- obj = vp->v_object;
- if (obj != NULL) {
- AFS_VM_OBJECT_WLOCK(obj);
- vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
- AFS_VM_OBJECT_WUNLOCK(obj);
- anyio = 1;
- }
- vput(vp);
- }
- }
- } while (anyio && (--tries > 0));
- AFS_GLOCK();
- ObtainWriteLock(&avc->lock, 94);
+ osi_Assert(VOP_ISLOCKED(vp) != 0);
+
+ obj = vp->v_object;
+
+ if (obj != NULL && (obj->flags & OBJ_MIGHTBEDIRTY) != 0) {
+ ReleaseWriteLock(&avc->lock);
+ AFS_GUNLOCK();
+
+ AFS_VM_OBJECT_WLOCK(obj);
+ vm_object_page_clean(obj, 0, 0, OBJPC_SYNC);
+ AFS_VM_OBJECT_WUNLOCK(obj);
+
+ AFS_GLOCK();
+ ObtainWriteLock(&avc->lock, 94);
+ }
}
/* Try to invalidate pages, for "fs flush" or "fs flushv"; or
else
code = afs_close(avc, ap->a_fflag, afs_osi_credp);
osi_FlushPages(avc, ap->a_cred); /* hold GLOCK, but not basic vnode lock */
+
+ ObtainWriteLock(&avc->lock, 808);
+ if (avc->cred != NULL) {
+ crfree(avc->cred);
+ avc->cred = NULL;
+ }
+ ReleaseWriteLock(&avc->lock);
+
AFS_GUNLOCK();
return code;
}
{
int code;
struct vcache *avc = VTOAFS(ap->a_vp);
+ off_t start, end;
+ start = AFS_UIO_OFFSET(ap->a_uio);
+ end = start + AFS_UIO_RESID(ap->a_uio);
+
AFS_GLOCK();
osi_FlushPages(avc, ap->a_cred); /* hold GLOCK, but not basic vnode lock */
code =
afs_write(VTOAFS(ap->a_vp), ap->a_uio, ap->a_ioflag, ap->a_cred, 0);
AFS_GUNLOCK();
+
+ /* Invalidate any pages in the written area. */
+ vn_pages_remove(ap->a_vp, OFF_TO_IDX(start), OFF_TO_IDX(end));
+
return code;
}
vm_offset_t kva;
struct vnode *vp;
struct vcache *avc;
+ struct ucred *cred;
memset(&uio, 0, sizeof(uio));
memset(&iov, 0, sizeof(iov));
* sync |= IO_INVAL; */
AFS_GLOCK();
- code = afs_write(avc, &uio, sync, osi_curcred(), 0);
+
+ ObtainReadLock(&avc->lock);
+ if (avc->cred != NULL) {
+ /*
+ * Use the creds from the process that opened this file for writing; if
+ * any. Otherwise, if we use the current process's creds, we may use
+ * the creds for uid 0 if we are writing back pages from the syncer(4)
+ * process.
+ */
+ cred = crhold(avc->cred);
+ } else {
+ cred = crhold(curthread->td_ucred);
+ }
+ ReleaseReadLock(&avc->lock);
+
+ code = afs_write(avc, &uio, sync, cred, 0);
AFS_GUNLOCK();
pmap_qremove(kva, npages);
relpbuf(bp, &afs_pbuf_freecnt);
if (!code) {
+ AFS_VM_OBJECT_WLOCK(vp->v_object);
size = ap->a_count - uio.uio_resid;
for (i = 0; i < round_page(size) / PAGE_SIZE; i++) {
ap->a_rtvals[i] = VM_PAGER_OK;
vm_page_undirty(ap->a_m[i]);
}
+ AFS_VM_OBJECT_WUNLOCK(vp->v_object);
}
+ crfree(cred);
return ap->a_rtvals[0];
}
cnp->cn_cred);
if (error == 0) {
error = afs_lookup(VTOAFS(dvp), name, &vcp, cnp->cn_cred);
- if (error == 0) {
- newvp = AFSTOV(vcp);
- vn_lock(newvp, LK_EXCLUSIVE | LK_RETRY);
- }
}
AFS_GUNLOCK();
+ if (error == 0) {
+ newvp = AFSTOV(vcp);
+ vn_lock(newvp, LK_EXCLUSIVE | LK_RETRY);
+ }
DROPNAME();
*(ap->a_vpp) = newvp;
return error;
* vnode is already VI_DOOMED. We just want to lock it again, and skip the
* VI_DOOMED check.
*/
+ AFS_GUNLOCK();
VOP_LOCK(vp, LK_EXCLUSIVE);
+ AFS_GLOCK();
code = afs_FlushVCache(avc, &slept);
AFS_STATCNT(afs_unmount);
afs_globalVFS = 0;
- afs_shutdown();
+ afs_shutdown(AFS_WARM);
AFS_GUNLOCK();
return 0;
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);
*/
-#ifdef AFS_SGI65_ENV
/* TODO: Fix this later. */
static int
SGI_ProcScanFunc(void *p, void *arg, int mode)
{
return 0;
}
-#else /* AFS_SGI65_ENV */
-static int
-SGI_ProcScanFunc(proc_t * p, void *arg, int mode)
-{
- afs_int32(*perproc_func) (afs_proc_t *) = arg;
- int code = 0;
- /* we pass in the function pointer for arg,
- * mode ==0 for startup call, ==1 for each valid proc,
- * and ==2 for terminate call.
- */
- if (mode == 1) {
- code = perproc_func(p);
- }
- return code;
-}
-#endif /* AFS_SGI65_ENV */
void
afs_osi_TraverseProcTable(void)
* subsequent calls may overwrite the previously returned value.
*/
-#if defined(AFS_SGI65_ENV)
const afs_ucred_t *
afs_osi_proc2cred(afs_proc_t * p)
{
return NULL;
}
-#else
-const afs_ucred_t *
-afs_osi_proc2cred(afs_proc_t * pr)
-{
- afs_ucred_t *rv = NULL;
-
- if (pr == NULL) {
- return NULL;
- }
- rv = pr->p_cred;
-
- return rv;
-}
-#endif
-
#endif /* AFS_GCPAGS */
/* This is common code between SGI's DFS and our AFS. Do *not* alter it's
* interface or semantics without notifying SGI.
*/
-#ifdef AFS_SGI65_ENV
/* fixup_pags returns error code if relevant or 0 on no error.
* Sets up the cred for the call to estgroups. This is pretty convoluted
* in order to avoid including the private proc.h header file.
}
return 0;
}
-#else
-/*
- * Generic routine to set the PAG in the cred for AFS and DFS.
- * If flag = 0 this is a DFS pag held in one group.
- * If flag = 1 this is a AFS pag held in two group entries
- */
-static int
-afsDFS_SetPagInCred(struct ucred *credp, int pag, int flag)
-{
- int *gidset;
- int i, ngrps;
- gid_t g0, g1;
- int n = 0;
- struct ucred *newcredp;
- int groups_taken = (flag ? 2 : 1);
-
- ngrps = credp->cr_ngroups + groups_taken;
- if (ngrps >= ngroups_max)
- return E2BIG;
-
-
- if (flag) {
- /* Break out the AFS pag into two groups */
- afs_get_groups_from_pag(pag, &g0, &g1);
- }
-
- newcredp = crdup(credp);
- newcredp->cr_ngroups = ngrps;
-
- if (flag) {
- /* AFS case */
- newcredp->cr_groups[0] = g0;
- newcredp->cr_groups[1] = g1;
- } else {
- /* DFS case */
- if (PagInCred(newcredp) != NOPAG) {
- /* found an AFS PAG is set in this cred */
- n = 2;
- }
- newcredp->cr_groups[n] = pag;
- }
- for (i = n; i < credp->cr_ngroups; i++)
- newcredp->cr_groups[i + groups_taken] = credp->cr_groups[i];
-
- /* estgroups sets current threads cred from newcredp and crfree's credp */
- estgroups(credp, newcredp);
-
- return 0;
-}
-#endif /* AFS_SGI65_ENV */
/* SGI's osi_GetPagFromCred - They return a long. */
int
* This means we don't really know if our DFS PAG is in
* the first or third group entry.
*/
-#ifdef AFS_SGI65_ENV
pag = credp->cr_groups[ngroups - 1];
-#else
- pag = credp->cr_groups[0];
- if (PagInCred(credp) != NOPAG) {
- /* AFS has a PAG value in the first two group entries */
- if (ngroups < 3)
- return NOPAG;
- pag = credp->cr_groups[2];
- }
-#endif
if (((pag >> 24) & 0xff) == 'A')
return pag;
else
if (code = setgroups(ngroups, gidset))
return code;
-#ifdef AFS_SGI65_ENV
if (old_afs_pag == NOPAG && old_dfs_pag == NOPAG)
return 0;
(old_dfs_pag == NOPAG) ? 0 : old_dfs_pag);
if (!code && modcredp)
estgroups(OSI_GET_CURRENT_PROCP(), modcredp);
-#else
-
- /*
- * The setgroups gave our curent thread a new cred pointer
- * Get the value again
- */
- credp = OSI_GET_CURRENT_CRED();
- if ((PagInCred(credp) == NOPAG) && (old_afs_pag != NOPAG)) {
- /* reset the AFS PAG */
- code = afsDFS_SetPagInCred(credp, old_afs_pag, 1);
- }
- /*
- * Once again get the credp because the afsDFS_SetPagInCred might have
- * assigned a new one.
- */
- credp = OSI_GET_CURRENT_CRED();
- if ((osi_DFSGetPagFromCred(credp) == NOPAG)
- && (old_dfs_pag != NOPAG)) {
- code = afsDFS_SetPagInCred(credp, old_dfs_pag, 0);
- }
-#endif /* AFS_SGI65_ENV */
return code;
}
while (ngroups--)
*gp++ = *gidset++;
if (!change_parent) {
-#ifdef AFS_SGI65_ENV
estgroups(OSI_GET_CURRENT_PROCP(), newcr);
-#else
- estgroups(cr, newcr);
-#endif
}
*cred = newcr;
return (0);
#include "afs/param.h"
-#ifdef AFS_SGI62_ENV
#include "afs/sysincludes.h" /* Standard vendor system headers */
#include "afsincludes.h" /* Afs-based standard headers */
#include "afs/afs_stats.h" /* statistics */
avc->execsOrWriters, avc->flockCount, avc->f.states);
printflags(avc->f.states, tab_vcache);
qprintf("\n");
-#ifdef AFS_SGI64_ENV
qprintf(" mapcnt %llu, mvstat %d anyAcc 0x%x Access 0x%x\n",
avc->mapcnt, avc->mvstat, avc->f.anyAccess, avc->Access);
qprintf(" mvid 0x%x &lock 0x%x cred 0x%x\n", avc->mvid.target_root, &avc->lock,
avc->cred);
qprintf(" rwlock 0x%x (%d) id %llu trips %d\n", &avc->vc_rwlock,
valusema(&avc->vc_rwlock), avc->vc_rwlockid, avc->vc_locktrips);
-#else
- qprintf(" mapcnt %d mvstat %d anyAcc 0x%x Access 0x%x\n", avc->mapcnt,
- avc->mvstat, avc->f.anyAccess, avc->Access);
- qprintf(" mvid 0x%x &lock 0x%x cred 0x%x\n", avc->mvid.target_root, &avc->lock,
- avc->cred);
- qprintf(" rwlock 0x%x (%d) id %d trips %d\n", &avc->vc_rwlock,
- valusema(&avc->vc_rwlock), avc->vc_rwlockid, avc->vc_locktrips);
-#endif
AFS_GUNLOCK();
return 0;
}
AFS_GUNLOCK();
return 0;
}
-
-#endif /* AFS_SGI62_ENV */
#undef gop_lookupname_user
#define gop_lookupname_user(fnamep,segflg,followlink,compvpp) lookupname((fnamep),(segflg),(followlink),NULL,(compvpp), NULL)
-#ifdef AFS_SGI64_ENV
#include <sys/flock.h>
extern flid_t osi_flid;
#define v_op v_bh.bh_first->bd_ops
#define v_data v_bh.bh_first->bd_pdata
#define vfs_data vfs_bh.bh_first->bd_pdata
-#endif /* AFS_SGI64_ENV */
/*
* Global lock, semaphore, mutex and state vector support.
#define SPLOCK(l) mp_mutex_spinlock(&(l))
#define SPUNLOCK(l,s) mp_mutex_spinunlock(&(l),s)
#define SP_WAIT(l, s, cv, p) mp_sv_wait_sig(cv, p, (void*)(&(l)), s)
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
/* Add PLTWAIT for afsd's to wait so we don't rack up the load average. */
#define AFSD_PRI() ((kt_basepri(curthreadp) == PTIME_SHARE) ? PZERO : (PZERO|PLTWAIT))
#undef AFS_MUTEX_ENTER
} \
MACRO_END
-#else /* AFS_SGI65_ENV */
-/* Add PLTWAIT for afsd's to wait so we don't rack up the load average. */
-#define AFSD_PRI() ((curprocp && curprocp->p_rss==0) ? (PZERO|PLTWAIT) : PZERO)
-
-#define AFS_MUTEX_ENTER(mp) \
- MACRO_BEGIN \
- kthread_t *kt; \
- while(mutex_tryenter(mp) == 0) { \
- kt = mutex_owner(mp); \
- if (kt != NULL && kt->k_sonproc == CPU_NONE) { \
- mutex_lock(mp, AFSD_PRI()); \
- break; \
- } \
- } \
- MACRO_END
-#endif /* AFS_SGI65_ENV */
#define cv_timedwait(cv, l, t) { \
sv_timedwait(cv, AFSD_PRI(), l, 0, 0, &(t), \
sv_wait(cv, AFSD_PRI(), l, 0); \
AFS_MUTEX_ENTER(l); \
}
-#else /* AFS_SGI64_ENV */
-#ifdef AFS_SGI62_ENV
-
-#define AFS_MUTEX_ENTER(mp) \
- MACRO_BEGIN \
- struct proc *_procP; \
- while(mutex_tryenter(mp) == 0) { \
- _procP = mutex_owner(mp); \
- if (_procP != NULL && _procP->p_sonproc == CPU_NONE) { \
- mutex_enter(mp); \
- break; \
- } \
- } \
- MACRO_END
-
-#else /* AFS_SGI62_ENV */
-
-#define AFS_MUTEX_ENTER(mp) mutex_enter(mp)
-
-#endif /* AFS_SGI62_ENV */
-
-#define cv_timedwait(cv, l, t) { \
- sv_timedwait(cv, l, t); \
- AFS_GLOCK(); \
- }
-#endif /* AFS_SGI64_ENV */
#if defined(KERNEL)
#if defined(MP)
* concern no longer exists.
*/
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
/* Irix does not check for deadlocks unless it's a debug kernel. */
#define AFS_ASSERT_GNOTME() \
(!ISAFS_GLOCK() || (panic("afs global lock held be me"), 0))
#define AFS_GLOCK() \
{ AFS_ASSERT_GNOTME(); AFS_MUTEX_ENTER(&afs_global_lock); }
-#else
-#define AFS_GLOCK() AFS_MUTEX_ENTER(&afs_global_lock)
-#endif
#define AFS_GUNLOCK() { AFS_ASSERT_GLOCK(); mutex_exit(&afs_global_lock); }
#define ISAFS_GLOCK() mutex_mine(&afs_global_lock)
-#else
-extern long afs_global_owner;
-#define AFS_GLOCK() \
- MACRO_BEGIN \
- AFS_MUTEX_ENTER(&afs_global_lock) ; \
- afs_global_owner = osi_ThreadUnique(); \
- MACRO_END
-#define AFS_GUNLOCK() \
- { AFS_ASSERT_GLOCK(); afs_global_owner = 0; mutex_exit(&afs_global_lock); }
-#define ISAFS_GLOCK() (osi_ThreadUnique() == afs_global_owner)
-#endif /* AFS_SGI64_ENV */
#else /* MP */
#define AFS_GLOCK()
#define AFS_GUNLOCK()
#endif /* KERNEL */
-#if defined(AFS_SGI62_ENV)
-# define osi_InitGlock() \
+#define osi_InitGlock() \
mutex_init(&afs_global_lock, MUTEX_DEFAULT, "afs_global_lock");
-#else
-# define osi_InitGlock() \
- mutex_init(&afs_global_lock, "afs_global_lock", MUTEX_DEFAULT, NULL);
-#endif
-#ifdef AFS_SGI64_ENV
#define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),\
(int *)(aresid), &osi_flid)
-#else
-#define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
- vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr), \
- (int *)(aresid))
-#endif
-#ifdef AFS_SGI64_ENV
#undef suser
#define suser() cap_able(CAP_DEVICE_MGT)
-#endif
#define afs_suser(x) suser()
#define afs_hz HZ
-#ifdef AFS_SGI64_ENV
#undef setuerror
#undef getuerror
-#endif
/* OS independent user structure stuff */
/*
* OSI_GET_CURRENT_PID
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_GET_CURRENT_PID() (u.u_procp->p_pid)
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV) && !defined(AFS_SGI65_ENV)
-#define OSI_GET_CURRENT_PID() current_pid()
-#endif /* AFS_SGI64_ENV */
-
-#if defined(AFS_SGI65_ENV)
#define OSI_GET_CURRENT_PID() proc_pid(curproc())
-#endif
#define getpid() OSI_GET_CURRENT_PID()
/*
* OSI_GET_CURRENT_PROCP
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_GET_CURRENT_PROCP() (u.u_procp)
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV) && !defined(AFS_SGI65_ENV)
-#define OSI_GET_CURRENT_PROCP() curprocp
-#endif /* AFS_SGI64_ENV */
-
-#if defined(AFS_SGI65_ENV)
#define OSI_GET_CURRENT_PROCP() UT_TO_PROC(curuthread)
-#endif
/*
*
* Prior to IRIX 6.4, pid sufficed, now we need kthread.
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_GET_LOCKID() (u.u_procp->p_pid)
-#define OSI_NO_LOCKID (-1)
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV)
/* IRIX returns k_id, but this way, we've got the thread address for debugging. */
#define OSI_GET_LOCKID() \
(private.p_curkthread ? (uint64_t)private.p_curkthread : (uint64_t)0)
#define OSI_NO_LOCKID ((uint64_t)-1)
-#endif /* AFS_SGI64_ENV */
/*
* OSI_GET_CURRENT_CRED
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_GET_CURRENT_CRED() (u.u_cred)
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV)
#define OSI_GET_CURRENT_CRED() get_current_cred()
-#endif /* AFS_SGI64_ENV */
#define osi_curcred() OSI_GET_CURRENT_CRED()
/*
* OSI_SET_CURRENT_CRED
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_SET_CURRENT_CRED(x) u.u_cred=x
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV)
#define OSI_SET_CURRENT_CRED(C) set_current_cred((C))
-#endif /* AFS_SGI64_ENV */
/*
* OSI_GET_CURRENT_ABI
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_GET_CURRENT_ABI() (u.u_procp->p_abi)
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV)
#define OSI_GET_CURRENT_ABI() get_current_abi()
-#endif /* AFS_SGI64_ENV */
/*
* OSI_GET_CURRENT_SYSID
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_GET_CURRENT_SYSID() (u.u_procp->p_sysid)
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV)
#define OSI_GET_CURRENT_SYSID() (curprocp->p_flid.fl_sysid)
-#endif /* AFS_SGI64_ENV */
/*
* OSI_GET_CURRENT_COMM
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_GET_CURRENT_COMM() (u.u_comm)
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV)
#define OSI_GET_CURRENT_COMM() (curprocp->p_comm)
-#endif /* AFS_SGI64_ENV */
/*
* OSI_GET_CURRENT_CDIR
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_GET_CURRENT_CDIR() (u.u_cdir)
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV) && !defined(AFS_SGI65_ENV)
-#define OSI_GET_CURRENT_CDIR() (curprocp->p_cdir)
-#endif /* AFS_SGI64_ENV */
-
-#if defined(AFS_SGI65_ENV)
#define OSI_GET_CURRENT_CDIR() (curuthread->ut_cdir)
-#endif /* AFS_SGI65_ENV */
/*
* OSI_GET_CURRENT_RDIR
*/
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-#define OSI_GET_CURRENT_RDIR() (u.u_rdir)
-#endif /* AFS_SGI_ENV but not AFS_SGI64_ENV */
-
-#if defined(AFS_SGI64_ENV) && !defined(AFS_SGI65_ENV)
-#define OSI_GET_CURRENT_RDIR() (curprocp->p_rdir)
-#endif /* AFS_SGI64_ENV */
-
-#if defined(AFS_SGI65_ENV)
#define OSI_GET_CURRENT_RDIR() (curuthread->ut_rdir)
-#endif /* AFS_SGI65_ENV */
* Note that the _CONVERT routines get the ";" here so that argument lists
* can have arguments after the OSI_x_CONVERT macro is called.
*/
-#ifdef AFS_SGI64_ENV
#undef OSI_VN_ARG
#define OSI_VN_ARG(V) bhv_##V
#undef OSI_VN_DECL
#define OSI_VFS_DECL(V) bhv_desc_t *bhv_##V
#undef OSI_VFS_CONVERT
#define OSI_VFS_CONVERT(V) struct vfs * V = (struct vfs*)bhvtovfs(bhv_##V)
-#endif /* AFS_SGI64_ENV */
#define osi_procname(procname, size) strncpy(procname, proc_name(curproc()), size)
#include "afs/param.h"
-#ifdef AFS_SGI62_ENV
#include "afs/sysincludes.h" /* Standard vendor system headers */
#include "afsincludes.h" /* Afs-based standard headers */
#include "afs/afs_stats.h" /* statistics */
#else
int afs_ipno = -1;
#endif
-
-
-#endif /* AFS_SGI62_ENV */
avc->vc_rwlockid = OSI_NO_LOCKID;
initnsema(&avc->vc_rwlock, 1,
makesname(name, "vrw", avc->v.v_number));
-#ifndef AFS_SGI53_ENV
- initnsema(&avc->v.v_sync, 0,
- makesname(name, "vsy", avc->v.v_number));
-#endif
-#ifndef AFS_SGI62_ENV
- initnlock(&avc->v.v_lock,
- makesname(name, "vlk", avc->v.v_number));
-#endif
return avc;
}
memset(&(avc->vc_bhv_desc), 0, sizeof(avc->vc_bhv_desc));
bhv_desc_init(&(avc->vc_bhv_desc), avc, avc, &Afs_vnodeops);
-#if defined(AFS_SGI65_ENV)
vn_bhv_head_init(&(avc->v.v_bh), "afsvp");
vn_bhv_insert_initial(&(avc->v.v_bh), &(avc->vc_bhv_desc));
avc->v.v_mreg = avc->v.v_mregb = (struct pregion *)avc;
avc->v.v_number);
init_mutex(&avc->v.v_filocksem, MUTEX_DEFAULT, "afsvfl", (long)avc);
init_mutex(&avc->v.v_buf_lock, MUTEX_DEFAULT, "afsvnbuf", (long)avc);
-#else
- bhv_head_init(&(avc->v.v_bh));
- bhv_insert_initial(&(avc->v.v_bh), &(avc->vc_bhv_desc));
-#endif
vnode_pcache_init(&avc->v);
osi_Assert(avc->mapcnt == 0 && avc->vc_locktrips == 0);
osi_Assert(avc->vc_rwlockid == OSI_NO_LOCKID);
osi_Assert(avc->v.v_filocks == NULL);
-# if !defined(AFS_SGI65_ENV)
- osi_Assert(avc->v.v_filocksem == NULL);
-# endif
osi_Assert(avc->cred == NULL);
-# if defined(AFS_SGI64_ENV)
vnode_pcache_reinit(&avc->v);
avc->v.v_rdev = NODEV;
-# endif
vn_initlist((struct vnlist *)&avc->v);
avc->lastr = 0;
}
extern int xfs_iget(struct mount *, struct xfs_trans *, xfs_ino_t, uint,
xfs_inode_t **, daddr_t);
-#ifdef AFS_SGI64_ENV
#define XFS_ITOV(ip) BHV_TO_VNODE((struct bhv_desc *)(((char*)(ip)) + 6*sizeof(void*)))
-#else
-#define XFS_ITOV(ip) (*((vnode_t**)((((char*)(ip)) + 6*sizeof(void*)))))
-#endif
/* When we have XFS only clients, then these macros will be defined in
* terms of the XFS inode only.
#endif
-#if defined(AFS_SGI64_ENV) && defined(CKPT)
+#if defined(CKPT)
/* This is a fid for checkpoint restart. Note that the length will be
* greater than 10 and so afs_vget can distinguish this fid.
*/
extern int afs_mount(), afs_unmount(), afs_root(), afs_statfs();
-#ifdef AFS_SGI65_ENV
extern int afs_sync(OSI_VFS_DECL(afsp), int flags, struct cred *cr);
-#else
-extern int afs_sync(OSI_VFS_DECL(afsp), short flags, struct cred *cr);
-#endif
extern int afs_vget(OSI_VFS_DECL(afsp), vnode_t ** vpp, struct fid *afidp);
#ifdef MP
struct vfsops afs_lockedvfsops =
struct vfsops Afs_vfsops =
#endif
{
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
BHV_IDENTITY_INIT_POSITION(VFS_POSITION_BASE),
-#else
- VFS_POSITION_BASE,
-#endif
-#endif
afs_mount,
-#ifdef AFS_SGI64_ENV
fs_nosys, /* rootinit */
fs_nosys, /* mntupdate */
fs_dounmount,
-#endif
afs_unmount,
afs_root,
afs_statfs,
afs_sync,
afs_vget,
fs_nosys, /* mountroot */
-#ifdef AFS_SGI65_ENV
fs_nosys, /* realvfsops */
fs_import, /* import */
fs_nosys, /* quotactl */
-#else
- fs_nosys, /* swapvp */
-#endif
};
extern struct afs_q VLRU; /*vcache LRU */
-#ifdef AFS_SGI64_ENV
static bhv_desc_t afs_vfs_bhv;
-#endif
afs_mount(struct vfs *afsp, vnode_t * mvp, struct mounta *uap,
-#ifdef AFS_SGI65_ENV
char *attrs,
-#endif
cred_t * cr)
{
AFS_STATCNT(afs_mount);
afsp->vfs_bsize = 8192;
afsp->vfs_fsid.val[0] = AFS_VFSMAGIC; /* magic */
afsp->vfs_fsid.val[1] = afs_fstype;
-#ifdef AFS_SGI64_ENV
vfs_insertbhv(afsp, &afs_vfs_bhv, &Afs_vfsops, &afs_vfs_bhv);
-#else
- afsp->vfs_data = NULL;
-#endif
afsp->vfs_fstype = afs_fstype;
afsp->vfs_dev = 0xbabebabe; /* XXX this should be unique */
}
ReleaseWriteLock(&afs_xvcache);
afs_globalVFS = 0;
- afs_shutdown();
-#ifdef AFS_SGI65_ENV
+ afs_shutdown(AFS_WARM);
VFS_REMOVEBHV(afsp, &afs_vfs_bhv);
-#endif
return 0;
}
extern afs_int32 vcachegen;
#define PREEMPT_MASK 0x7f
-#ifdef AFS_SGI64_ENV
#define PREEMPT()
-#endif
int
afs_sync(OSI_VFS_DECL(afsp),
-#ifdef AFS_SGI65_ENV
int flags,
-#else
- short flags,
-#endif
struct cred *cr)
{
/* Why enable the vfs sync operation?? */
/*
* if not interested in vnodes, skip all this
*/
-#ifdef AFS_SGI61_ENV
if ((flags & (SYNC_CLOSE | SYNC_DELWRI | SYNC_PDFLUSH)) == 0)
goto end;
-#else /* AFS_SGI61_ENV */
- if ((flags & (SYNC_CLOSE | SYNC_DELWRI | SYNC_ATTR)) == 0)
- goto end;
-#endif /* AFS_SGI61_ENV */
loop:
ObtainReadLock(&afs_xvcache);
for (tq = VLRU.prev; tq != &VLRU; tq = uq) {
continue;
}
}
-#ifdef AFS_SGI61_ENV
else if (flags & SYNC_PDFLUSH) {
if (!VN_GET_DPAGES(vp)) {
VN_UNLOCK(vp, s);
continue;
}
}
-#endif /* AFS_SGI61_ENV */
vp->v_count++;
VN_UNLOCK(vp, s);
* sleep for rwlock.
*/
if (afs_rwlock_nowait(vp, 1) == 0) {
-#ifdef AFS_SGI61_ENV
if (flags & (SYNC_BDFLUSH | SYNC_PDFLUSH))
-#else /* AFS_SGI61_ENV */
- if (flags & SYNC_BDFLUSH)
-#endif /* AFS_SGI61_ENV */
{
AFS_RELE(vp);
ObtainReadLock(&afs_xvcache);
if (flags & SYNC_CLOSE) {
PFLUSHINVALVP(vp, (off_t) 0, (off_t) tvc->f.m.Length);
}
-#ifdef AFS_SGI61_ENV
else if (flags & SYNC_PDFLUSH) {
if (VN_GET_DPAGES(vp)) {
pdflush(vp, B_ASYNC);
}
}
-#endif /* AFS_SGI61_ENV */
if ((flags & SYNC_DELWRI) && AFS_VN_DIRTY(vp)) {
-#ifdef AFS_SGI61_ENV
PFLUSHVP(vp, (off_t) tvc->f.m.Length,
(flags & SYNC_WAIT) ? 0 : B_ASYNC, error);
-#else /* AFS_SGI61_ENV */
- if (flags & SYNC_WAIT)
- /* push all and wait */
- PFLUSHVP(vp, (off_t) tvc->f.m.Length, (off_t) 0, error);
- else if (flags & SYNC_BDFLUSH) {
- /* push oldest */
- error = pdflush(vp, B_ASYNC);
- } else {
- /* push all but don't wait */
- PFLUSHVP(vp, (off_t) tvc->f.m.Length, (off_t) B_ASYNC, error);
- }
-#endif /* AFS_SGI61_ENV */
}
/*
afs_int32 code = 0;
afs_int32 ret;
-#if defined(AFS_SGI64_ENV) && defined(CKPT) && !defined(_R5000_CVT_WAR)
+#if defined(CKPT) && !defined(_R5000_CVT_WAR)
afs_fid2_t *afid2;
#endif
*avcp = NULL;
-#if defined(AFS_SGI64_ENV) && defined(CKPT) && !defined(_R5000_CVT_WAR)
+#if defined(CKPT) && !defined(_R5000_CVT_WAR)
afid2 = (afs_fid2_t *) fidp;
if (afid2->af_len == sizeof(afs_fid2_t) - sizeof(afid2->af_len)) {
/* It's a checkpoint restart fid. */
#ifdef MP /* locked versions of vfs operations. */
/* wrappers for vfs calls */
-#ifdef AFS_SGI64_ENV
#define AFS_MP_VFS_ARG(A) bhv_desc_t A
-#else
-#define AFS_MP_VFS_ARG(A) struct vfs A
-#endif
int
mp_afs_mount(struct vfs *a, struct vnode *b, struct mounta *c,
-#ifdef AFS_SGI65_ENV
char *d,
-#endif
struct cred *e)
{
int rv;
AFS_GLOCK();
rv = afs_lockedvfsops.vfs_mount(a, b, c, d
-#ifdef AFS_SGI65_ENV
, e
-#endif
);
AFS_GUNLOCK();
return rv;
int
mp_afs_sync(AFS_MP_VFS_ARG(*a),
-#ifdef AFS_SGI65_ENV
int b,
-#else
- short b,
-#endif
struct cred *c)
{
int rv;
}
struct vfsops Afs_vfsops = {
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
BHV_IDENTITY_INIT_POSITION(VFS_POSITION_BASE),
-#else
- VFS_POSITION_BASE,
-#endif
-#endif
mp_afs_mount,
-#ifdef AFS_SGI64_ENV
fs_nosys, /* rootinit */
fs_nosys, /* mntupdate */
fs_dounmount,
-#endif
mp_afs_unmount,
mp_afs_root,
mp_afs_statvfs,
mp_afs_sync,
mp_afs_vget,
fs_nosys, /* mountroot */
-#ifdef AFS_SGI65_ENV
fs_nosys, /* realvfsops */
fs_import, /* import */
fs_nosys, /* quotactl */
-#else
- fs_nosys, /* swapvp */
-#endif
};
#endif /* MP */
osi_Assert(!AFS_VN_MAPPED(vp));
osi_Assert(!AFS_VN_DIRTY(&avc->v));
-#if defined(AFS_SGI65_ENV)
if (vp->v_filocks)
cleanlocks(vp, IGN_PID, 0);
mutex_destroy(&vp->v_filocksem);
-#else /* AFS_SGI65_ENV */
- if (vp->v_filocksem) {
- if (vp->v_filocks)
-#ifdef AFS_SGI64_ENV
- cleanlocks(vp, &curprocp->p_flid);
-#else
- cleanlocks(vp, IGN_PID, 0);
-#endif
- osi_Assert(vp->v_filocks == NULL);
- mutex_destroy(vp->v_filocksem);
- kmem_free(vp->v_filocksem, sizeof *vp->v_filocksem);
- vp->v_filocksem = NULL;
- }
-#endif /* AFS_SGI65_ENV */
if (avc->vrefCount)
osi_Panic("flushVcache: vm race");
-#ifdef AFS_SGI64_ENV
AFS_GUNLOCK();
vnode_pcache_reclaim(vp); /* this can sleep */
vnode_pcache_free(vp);
VOP_RECLAIM(vp, FSYNC_WAIT, code);
}
AFS_GLOCK();
-#ifdef AFS_SGI65_ENV
#ifdef VNODE_TRACING
ktrace_free(vp->v_trace);
#endif /* VNODE_TRACING */
vn_bhv_head_destroy(&(vp->v_bh));
destroy_bitlock(&vp->v_pcacheflag);
mutex_destroy(&vp->v_buf_lock);
-#else
- bhv_remove(VN_BHV_HEAD(vp), &(avc->vc_bhv_desc));
- bhv_head_destroy(&(vp->v_bh));
-#endif
vp->v_flag = 0; /* debug */
#if defined(DEBUG) && defined(VNODE_INIT_BITLOCK)
destroy_bitlock(&vp->v_flag);
#ifdef INTR_KTHREADS
AFS_VN_DESTROY_BUF_LOCK(vp);
#endif
-#endif /* AFS_SGI64_ENV */
return 0;
}
#include "afs/param.h"
-#ifdef AFS_SGI62_ENV
#include "afs/sysincludes.h" /* Standard vendor system headers */
#include "afsincludes.h" /* Afs-based standard headers */
#include "afs/afs_stats.h" /* statistics */
static void afs_strategy();
static int afs_xread(), afs_xwrite();
static int afs_xbmap(), afs_map(), afs_reclaim();
-#ifndef AFS_SGI65_ENV
-static int afs_addmap(), afs_delmap();
-#endif
extern int afs_open(), afs_close(), afs_ioctl(), afs_getattr(), afs_setattr();
extern int afs_access(), afs_lookup();
extern int afs_create(), afs_remove(), afs_link(), afs_rename();
extern int afs_symlink(), afs_readlink(), afs_fsync(), afs_fid(),
afs_frlock();
static int afs_seek(OSI_VC_DECL(a), off_t b, off_t * c);
-#ifdef AFS_SGI64_ENV
extern int afs_xinactive();
-#else
-extern void afs_xinactive();
-#endif
extern void afs_rwlock(OSI_VN_DECL(vp), AFS_RWLOCK_T b);
extern void afs_rwunlock(OSI_VN_DECL(vp), AFS_RWLOCK_T b);
static int afsrwvp(struct vcache *avc, struct uio *uio,
enum uio_rw rw, int ioflag,
-#ifdef AFS_SGI64_ENV
struct cred *cr, struct flid *flp);
-#else
- struct cred *cr);
-#endif
#ifdef MP
static void mp_afs_rwlock(OSI_VN_DECL(a), AFS_RWLOCK_T b);
static void mp_afs_rwunlock(OSI_VN_DECL(a), AFS_RWLOCK_T b);
struct vnodeops Afs_vnodeops =
#endif
{
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
BHV_IDENTITY_INIT_POSITION(VNODE_POSITION_BASE),
-#else
- VNODE_POSITION_BASE,
-#endif
-#endif
afs_open,
afs_close,
afs_xread,
afs_xbmap,
afs_strategy,
afs_map,
-#ifdef AFS_SGI65_ENV
fs_noerr, /* addmap - devices only */
fs_noerr, /* delmap - devices only */
-#else
- afs_addmap,
- afs_delmap,
-#endif
fs_poll, /* poll */
fs_nosys, /* dump */
fs_pathconf,
fs_nosys, /* attr_set */
fs_nosys, /* attr_remove */
fs_nosys, /* attr_list */
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
fs_cover,
(vop_link_removed_t) fs_noval,
fs_vnode_change,
(vop_readbuf_t) fs_nosys,
fs_strgetmsg,
fs_strputmsg,
-#else
- fs_mount,
-#endif
-#endif
};
#ifndef MP
int
afs_frlock(OSI_VN_DECL(vp), int cmd, struct flock *lfp, int flag,
off_t offset,
-#ifdef AFS_SGI65_ENV
vrwlock_t vrwlock,
-#endif
cred_t * cr)
{
int error;
OSI_VN_CONVERT(vp);
-#ifdef AFS_SGI65_ENV
struct flid flid;
int pid;
get_current_flid(&flid);
pid = flid.fl_pid;
-#endif
/*
* Since AFS doesn't support byte-wise locks (and simply
|| (lfp->l_len != MAXEND && lfp->l_len != 0)) {
AFS_RWLOCK(vp, VRWLOCK_WRITE);
AFS_GUNLOCK();
-#ifdef AFS_SGI65_ENV
error =
fs_frlock(OSI_VN_ARG(vp), cmd, lfp, flag, offset, vrwlock, cr);
-#else
- error = fs_frlock(vp, cmd, lfp, flag, offset, cr);
-#endif
AFS_GLOCK();
AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
if (error || cmd != F_GETLK)
AFS_GUNLOCK();
error = convoff(vp, lfp, 0, offset, SEEKLIMIT
-#ifdef AFS_SGI64_ENV
, OSI_GET_CURRENT_CRED()
-#endif /* AFS_SGI64_ENV */
);
AFS_GLOCK();
if (!error) {
-#ifdef AFS_SGI65_ENV
error = afs_lockctl(vp, lfp, cmd, cr, pid);
-#else
- error = afs_lockctl(vp, lfp, cmd, cr, OSI_GET_CURRENT_PID());
-#endif
}
return error;
}
* doing direct I/O on the read side....
*/
/* ARGSUSED */
-#ifdef AFS_SGI64_ENV
static int
afs_xread(OSI_VC_ARG(avc), uiop, ioflag, cr, flp)
struct flid *flp;
-#else
-static int
-afs_xread(OSI_VC_ARG(avc), uiop, ioflag, cr)
-#endif
OSI_VC_DECL(avc);
struct uio *uiop;
int ioflag;
if (avc->v.v_type != VREG)
return EISDIR;
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
if (!(ioflag & IO_ISLOCKED))
AFS_RWLOCK((vnode_t *) avc, VRWLOCK_READ);
-#endif
code = afsrwvp(avc, uiop, UIO_READ, ioflag, cr, flp);
-#ifdef AFS_SGI65_ENV
if (!(ioflag & IO_ISLOCKED))
AFS_RWUNLOCK((vnode_t *) avc, VRWLOCK_READ);
-#endif
-#else
- code = afsrwvp(avc, uiop, UIO_READ, ioflag, cr);
-#endif
return code;
}
/* ARGSUSED */
-#ifdef AFS_SGI64_ENV
static int
afs_xwrite(OSI_VC_ARG(avc), uiop, ioflag, cr, flp)
struct flid *flp;
-#else
-static int
-afs_xwrite(OSI_VC_ARG(avc), uiop, ioflag, cr)
-#endif
OSI_VC_DECL(avc);
struct uio *uiop;
int ioflag;
if (ioflag & IO_APPEND)
uiop->uio_offset = avc->f.m.Length;
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
if (!(ioflag & IO_ISLOCKED))
AFS_RWLOCK(((vnode_t *) avc), VRWLOCK_WRITE);
-#endif
code = afsrwvp(avc, uiop, UIO_WRITE, ioflag, cr, flp);
-#ifdef AFS_SGI65_ENV
if (!(ioflag & IO_ISLOCKED))
AFS_RWUNLOCK((vnode_t *) avc, VRWLOCK_WRITE);
-#endif
-#else
- code = afsrwvp(avc, uiop, UIO_WRITE, ioflag, cr);
-#endif
return code;
}
static int
afsrwvp(struct vcache *avc, struct uio *uio, enum uio_rw rw,
int ioflag,
-#ifdef AFS_SGI64_ENV
struct cred *cr, struct flid *flp)
-#else
- struct cred *cr)
-#endif
{
struct vnode *vp = AFSTOV(avc);
struct buf *bp;
bmv[0].pboff = off;
bmv[0].pbsize = MIN(cnt, uio->uio_resid);
bmv[0].eof = 0;
-#ifdef AFS_SGI64_ENV
bmv[0].pbdev = vp->v_rdev;
bmv[0].pmp = uio->uio_pmp;
-#endif
osi_Assert(cnt > 0);
/*
* initiate read-ahead if it looks like
*/
if ((avc->lastr + BTOBB(AFSBSIZE) == bn
|| uio->uio_resid > AFSBSIZE)
-#ifdef AFS_SGI61_ENV
&& (!AFS_VN_MAPPED(vp))
-#else /* AFS_SGI61_ENV */
- && ((vp->v_flag & VWASMAP) == 0)
-#endif /* AFS_SGI61_ENV */
) {
rem -= cnt;
if (rem > 0) {
bmv[1].bsize = bsize;
bmv[1].pboff = 0;
bmv[1].pbsize = acnt;
-#ifdef AFS_SGI64_ENV
bmv[1].pmp = uio->uio_pmp;
bmv[1].pbdev = vp->v_rdev;
-#endif
}
}
#ifdef DEBUG
bmv[0].bsize = bsize;
bmv[0].pboff = off;
bmv[0].pbsize = cnt;
-#ifdef AFS_SGI64_ENV
bmv[0].pmp = uio->uio_pmp;
-#endif
if (cnt == bsize)
bp = getchunk(vp, bmv, cr);
}
if (!error) {
-#ifdef AFS_SGI61_ENV
if (((ioflag & IO_SYNC) || (ioflag & IO_DSYNC)) && (rw == UIO_WRITE)
&& !AFS_NFSXLATORREQ(cr)) {
error = afs_fsync(avc, 0, cr
-#ifdef AFS_SGI65_ENV
, 0, 0
-#endif
);
}
-#else /* AFS_SGI61_ENV */
- if ((ioflag & IO_SYNC) && (rw == UIO_WRITE) && !AFS_NFSXLATORREQ(cr)) {
- error = afs_fsync(avc, 0, cr);
- }
-#endif /* AFS_SGI61_ENV */
}
if (didFakeOpen) {
ObtainWriteLock(&avc->lock, 236);
bsize = ctob(btoc(off + cnt));
bmv->pbsize = MIN(cnt, count);
bmv->eof = 0;
-#ifdef AFS_SGI64_ENV
bmv->pmp = NULL;
bmv->pbdev = avc->v.v_rdev;
-#endif
bmv->bsize = bsize;
bmv->length = BTOBBT(bsize);
*nbmv = 1;
uio->uio_offset = BBTOB(bp->b_blkno);
uio->uio_segflg = UIO_SYSSPACE;
uio->uio_limit = RLIM_INFINITY; /* we checked the limit earlier */
-#ifdef AFS_SGI64_ENV
uio->uio_pmp = NULL;
-#endif
if (bp->b_flags & B_READ) {
uio->uio_fmode = FREAD;
return *noffp < 0 ? EINVAL : 0;
}
-#if !defined(AFS_SGI65_ENV)
-/* Irix 6.5 uses addmap/delmap only for devices. */
-/* ARGSUSED */
-static int
-afs_addmap(OSI_VC_ARG(avc), off, prp, addr, len, prot, maxprot, flags, cr)
- off_t off;
-OSI_VC_DECL(avc);
- struct pregion *prp;
- addr_t addr;
- size_t len;
- u_int prot, maxprot;
- u_int flags;
- struct cred *cr;
-{
- OSI_VC_CONVERT(avc);
- struct vnode *vp = AFSTOV(avc);
-
- if (vp->v_flag & VNOMAP)
- return ENOSYS;
- if (len == 0)
- return 0;
- AFS_RWLOCK(vp, VRWLOCK_WRITE);
- if (avc->mapcnt == 0) {
- /* on first mapping add a open reference */
- ObtainWriteLock(&avc->lock, 237);
- avc->execsOrWriters++;
- avc->opens++;
- ReleaseWriteLock(&avc->lock);
- }
- avc->mapcnt += btoc(len);
- AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
- return 0;
-}
-
- /*ARGSUSED*/ static int
-afs_delmap(OSI_VC_ARG(avc), off, prp, addr, len, prot, maxprot, flags, acred)
- off_t off;
-OSI_VC_DECL(avc);
- struct pregion *prp;
- addr_t addr;
- size_t len;
- u_int prot, maxprot;
- u_int flags;
- struct cred *acred;
-{
- OSI_VC_CONVERT(avc);
- struct vnode *vp = AFSTOV(avc);
- struct brequest *tb;
- struct vrequest treq;
- afs_int32 code;
-
- if (vp->v_flag & VNOMAP)
- return ENOSYS;
- if (len == 0)
- return 0;
- AFS_RWLOCK(vp, VRWLOCK_WRITE);
- osi_Assert(avc->mapcnt > 0);
- avc->mapcnt -= btoc(len);
- osi_Assert(avc->mapcnt >= 0);
- if (avc->mapcnt == 0) {
- /* on last mapping push back and remove our reference */
- osi_Assert(avc->execsOrWriters > 0);
- osi_Assert(avc->opens > 0);
- if (avc->f.m.LinkCount == 0) {
- ObtainWriteLock(&avc->lock, 238);
- AFS_GUNLOCK();
- PTOSSVP(vp, (off_t) 0, (off_t) MAXLONG);
- AFS_GLOCK();
- ReleaseWriteLock(&avc->lock);
- }
- /*
- * mimic afs_close
- */
- code = afs_InitReq(&treq, acred);
- if (code) {
- code = afs_CheckCode(code, NULL, 64);
- AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
- } else if (afs_BBusy()) {
- /* do it yourself if daemons are all busy */
- ObtainWriteLock(&avc->lock, 239);
- code = afs_StoreOnLastReference(avc, &treq);
- ReleaseWriteLock(&avc->lock);
- /* BStore does CheckCode so we should also */
- /* VNOVNODE is "acceptable" error code from close, since
- * may happen when deleting a file on another machine while
- * it is open here. */
- if (code == VNOVNODE)
- code = 0;
- if (code) {
- afs_StoreWarn(code, avc->f.fid.Fid.Volume, /* /dev/console */
- 1);
- }
- code = afs_CheckCode(code, &treq, 52);
- AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
- } else {
- AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
- /* at least one daemon is idle, so ask it to do the store.
- * Also, note that we don't lock it any more... */
- tb = afs_BQueue(BOP_STORE, avc, 0, 1, acred,
- (afs_size_t) afs_cr_uid(acred), 0L, (void *)0,
- (void *)0, (void *)0);
- /* sleep waiting for the store to start, then retrieve error code */
- while ((tb->flags & BUVALID) == 0) {
- tb->flags |= BUWAIT;
- afs_osi_Sleep(tb);
- }
- afs_BRelease(tb);
- }
- } else {
- AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
- }
- return 0;
-}
-#endif /* ! AFS_SGI65_ENV */
-
-
/* ARGSUSED */
/*
* Note - if mapping in an ELF interpreter, one can get called without vp
* ever having been 'opened'
*/
-#ifdef AFS_SGI65_ENV
static int
afs_map(OSI_VC_ARG(avc), off, len, prot, flags, cr, vpp)
off_t off;
u_int flags;
struct cred *cr;
vnode_t **vpp;
-#else
-static int
-afs_map(OSI_VC_ARG(avc), off, prp, addrp, len, prot, maxprot, flags, cr)
- off_t off;
-OSI_VC_DECL(avc);
- struct pregion *prp;
- addr_t *addrp;
- size_t len;
- u_int prot, maxprot;
- u_int flags;
- struct cred *cr;
-#endif
{
OSI_VC_CONVERT(avc);
struct vnode *vp = AFSTOV(avc);
return afs_CheckCode(error, &treq, 53);
osi_FlushPages(avc, cr); /* ensure old pages are gone */
-#ifdef AFS_SGI65_ENV
/* If the vnode is currently opened for write, there's the potential
* that this mapping might (now or in the future) have PROT_WRITE.
* So assume it does and we'll have to call afs_StoreOnLastReference.
}
ReleaseWriteLock(&avc->lock);
AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
-#else
- AFS_RWLOCK(vp, VRWLOCK_WRITE);
- AFS_GUNLOCK();
- error =
- fs_map_subr(vp, (off_t) avc->f.m.Length, (u_int) avc->f.m.Mode, off, prp,
- *addrp, len, prot, maxprot, flags, cr);
- AFS_GLOCK();
- AFS_RWUNLOCK(vp, VRWLOCK_WRITE);
-#endif /* AFS_SGI65_ENV */
afs_Trace4(afs_iclSetp, CM_TRACE_GMAP, ICL_TYPE_POINTER, vp,
-#ifdef AFS_SGI65_ENV
ICL_TYPE_POINTER, NULL,
-#else
- ICL_TYPE_POINTER, *addrp,
-#endif
ICL_TYPE_INT32, len, ICL_TYPE_INT32, off);
return error;
}
extern afs_rwlock_t afs_xvcache;
extern afs_lock_t afs_xdcache;
-#ifdef AFS_SGI64_ENV
int
-#else
-void
-#endif
afs_xinactive(OSI_VC_ARG(avc), acred)
OSI_VC_DECL(avc);
struct ucred *acred;
/* inactive was already done, or someone did a VN_HOLD; just return */
vp->v_flag &= ~VINACT;
VN_UNLOCK(vp, s);
-#ifdef AFS_SGI64_ENV
return VN_INACTIVE_CACHE;
-#else
- return;
-#endif
}
osi_Assert((vp->v_flag & VSHARE) == 0);
vp->v_flag &= ~VINACT;
*/
VN_UNLOCK(vp, s);
-#ifdef AFS_SGI65_ENV
/* In Irix 6.5, the last unmap of a dirty mmap'd file does not
* get an explicit vnode op. Instead we only find out at VOP_INACTIVE.
*/
}
}
}
-#endif
osi_Assert((avc->f.states & (CCore | CMAPPED)) == 0);
PTOSSVP(vp, (off_t) 0, (off_t) MAXLONG);
AFS_GLOCK();
}
-#ifndef AFS_SGI65_ENV
- osi_Assert(avc->mapcnt == 0);
- afs_chkpgoob(&avc->v, btoc(avc->f.m.Length));
-
- avc->f.states &= ~CDirty; /* Give up on store-backs */
- if (avc->f.states & CUnlinked) {
- if (CheckLock(&afs_xvcache) || CheckLock(&afs_xdcache)) {
- avc->f.states |= CUnlinkedDel;
- } else {
- afs_remunlink(avc, 1); /* ignore any return code */
- }
- }
-#endif
-#ifdef AFS_SGI64_ENV
return VN_INACTIVE_CACHE;
-#endif
}
static int
afs_reclaim(OSI_VC_DECL(avc), int flag)
{
-#ifdef AFS_SGI64_ENV
/* Get's called via VOP_RELCAIM in afs_FlushVCache to clear repl_vnodeops */
return 0;
-#else
- panic("afs_reclaim");
-#endif
}
void
return 0;
}
-#if defined(AFS_SGI64_ENV) && defined(CKPT) && !defined(_R5000_CVT_WAR)
+#if defined(CKPT) && !defined(_R5000_CVT_WAR)
int
afs_fid2(OSI_VC_DECL(avc), struct fid *fidp)
{
return EINVAL;
#endif
}
-#endif /* AFS_SGI64_ENV && CKPT */
+#endif /* CKPT */
/*
#ifdef MP
-#ifdef AFS_SGI64_ENV
#define AFS_MP_VC_ARG(A) bhv_desc_t A
-#else
-#define AFS_MP_VC_ARG(A) vnode_t A
-#endif
-#ifdef AFS_SGI64_ENV
int
mp_afs_open(bhv_desc_t * bhp, vnode_t ** a, mode_t b, struct cred *c)
-#else
-int
-mp_afs_open(vnode_t ** a, mode_t b, struct cred *c)
-#endif
{
int rv;
AFS_GLOCK();
-#ifdef AFS_SGI64_ENV
rv = afs_lockedvnodeops.vop_open(bhp, a, b, c);
-#else
- rv = afs_lockedvnodeops.vop_open(a, b, c);
-#endif
AFS_GUNLOCK();
return rv;
}
-#if defined(AFS_SGI64_ENV)
-#if defined(AFS_SGI65_ENV)
int
mp_afs_close(AFS_MP_VC_ARG(*a), int b, lastclose_t c, struct cred *d)
-#else
-int
-mp_afs_close(AFS_MP_VC_ARG(*a), int b, lastclose_t c, off_t d, struct cred *e,
- struct flid *f)
-#endif
-#else
-int
-mp_afs_close(AFS_MP_VC_ARG(*a), int b, lastclose_t c, off_t d, struct cred *e)
-#endif
{
int rv;
AFS_GLOCK();
rv = afs_lockedvnodeops.vop_close(a, b, c, d
-#if !defined(AFS_SGI65_ENV)
- , e
-#if defined(AFS_SGI64_ENV)
- , f
-#endif
-#endif
);
AFS_GUNLOCK();
return rv;
}
-#ifdef AFS_SGI64_ENV
int
mp_afs_read(AFS_MP_VC_ARG(*a), struct uio *b, int c, struct cred *d,
struct flid *f)
-#else
-int
-mp_afs_read(AFS_MP_VC_ARG(*a), struct uio *b, int c, struct cred *d)
-#endif
{
int rv;
AFS_GLOCK();
-#ifdef AFS_SGI64_ENV
rv = afs_lockedvnodeops.vop_read(a, b, c, d, f);
-#else
- rv = afs_lockedvnodeops.vop_read(a, b, c, d);
-#endif
AFS_GUNLOCK();
return rv;
}
-#ifdef AFS_SGI64_ENV
int
mp_afs_write(AFS_MP_VC_ARG(*a), struct uio *b, int c, struct cred *d,
struct flid *f)
-#else
-int
-mp_afs_write(AFS_MP_VC_ARG(*a), struct uio *b, int c, struct cred *d)
-#endif
{
int rv;
AFS_GLOCK();
-#ifdef AFS_SGI64_ENV
rv = afs_lockedvnodeops.vop_write(a, b, c, d, f);
-#else
- rv = afs_lockedvnodeops.vop_write(a, b, c, d);
-#endif
AFS_GUNLOCK();
return rv;
}
int
mp_afs_ioctl(AFS_MP_VC_ARG(*a), int b, void *c, int d, struct cred *e, int *f
-#ifdef AFS_SGI65_ENV
, struct vopbd *vbds
-#endif
)
{
int rv;
AFS_GLOCK();
rv = afs_lockedvnodeops.vop_ioctl(a, b, c, d, e, f
-#ifdef AFS_SGI65_ENV
, vbds
-#endif
);
AFS_GUNLOCK();
return rv;
int
mp_afs_access(AFS_MP_VC_ARG(*a), int b,
-#ifndef AFS_SGI65_ENV
- int c,
-#endif
struct cred *d)
{
int rv;
AFS_GLOCK();
rv = afs_lockedvnodeops.vop_access(a, b,
-#ifndef AFS_SGI65_ENV
- c,
-#endif
d);
AFS_GUNLOCK();
return rv;
return rv;
}
-#ifdef AFS_SGI64_ENV
int
mp_afs_create(AFS_MP_VC_ARG(*a), char *b, struct vattr *c, int d, int e,
vnode_t ** f, struct cred *g)
-#else
-int
-mp_afs_create(AFS_MP_VC_ARG(*a), char *b, struct vattr *c, enum vcexcl d,
- int e, vnode_t ** f, struct cred *g)
-#endif
{
int rv;
AFS_GLOCK();
int
mp_afs_fsync(AFS_MP_VC_ARG(*a), int b, struct cred *c
-#ifdef AFS_SGI65_ENV
, off_t start, off_t stop
-#endif
)
{
int rv;
AFS_GLOCK();
rv = afs_lockedvnodeops.vop_fsync(a, b, c
-#ifdef AFS_SGI65_ENV
, start, stop
-#endif
);
AFS_GUNLOCK();
return rv;
int
mp_afs_frlock(AFS_MP_VC_ARG(*a), int b, struct flock *c, int d, off_t e,
-#ifdef AFS_SGI65_ENV
vrwlock_t vrwlock,
-#endif
struct cred *f)
{
int rv;
AFS_GLOCK();
rv = afs_lockedvnodeops.vop_frlock(a, b, c, d, e,
-#ifdef AFS_SGI65_ENV
vrwlock,
-#endif
f);
AFS_GUNLOCK();
return rv;
return;
}
-#ifdef AFS_SGI65_ENV
int
mp_afs_map(AFS_MP_VC_ARG(*a), off_t b, size_t c, mprot_t d, u_int e,
struct cred *f, vnode_t ** g)
-#else
-int
-mp_afs_map(AFS_MP_VC_ARG(*a), off_t b, struct pregion *c, char **d, size_t e,
- u_int f, u_int g, u_int h, struct cred *i)
-#endif
{
int rv;
AFS_GLOCK();
rv = afs_lockedvnodeops.vop_map(a, b, c, d, e, f, g
-#ifndef AFS_SGI65_ENV
- , h, i
-#endif
);
AFS_GUNLOCK();
return rv;
}
-#ifndef AFS_SGI65_ENV
-/* As of Irix 6.5, addmap and delmap are only for devices */
-int
-mp_afs_addmap(AFS_MP_VC_ARG(*a), off_t b, struct pregion *c, addr_t d,
- size_t e, u_int f, u_int g, u_int h, struct cred *i)
-{
- int rv;
- AFS_GLOCK();
- rv = afs_lockedvnodeops.vop_addmap(a, b, c, d, e, f, g, h, i);
- AFS_GUNLOCK();
- return rv;
-}
-
-int
-mp_afs_delmap(AFS_MP_VC_ARG(*a), off_t b, struct pregion *c, addr_t d,
- size_t e, u_int f, u_int g, u_int h, struct cred *i)
-{
- int rv;
- AFS_GLOCK();
- rv = afs_lockedvnodeops.vop_delmap(a, b, c, d, e, f, g, h, i);
- AFS_GUNLOCK();
- return rv;
-}
-#endif /* ! AFS_SGI65_ENV */
-
int
mp_fs_poll(AFS_MP_VC_ARG(*a), short b, int c, short *d, struct pollhead **e
-#ifdef AFS_SGI65_ENV
, unsigned int *f
-#endif
)
{
int rv;
AFS_GLOCK();
rv = afs_lockedvnodeops.vop_poll(a, b, c, d, e
-#ifdef AFS_SGI65_ENV
, f
-#endif
);
AFS_GUNLOCK();
return rv;
struct vnodeops Afs_vnodeops = {
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
BHV_IDENTITY_INIT_POSITION(VNODE_POSITION_BASE),
-#else
- VNODE_POSITION_BASE,
-#endif
-#endif
mp_afs_open,
mp_afs_close,
mp_afs_read,
mp_afs_bmap,
mp_afs_strategy,
mp_afs_map,
-#ifdef AFS_SGI65_ENV
fs_noerr, /* addmap - devices only */
fs_noerr, /* delmap - devices only */
-#else
- mp_afs_addmap,
- mp_afs_delmap,
-#endif
mp_fs_poll, /* poll */
fs_nosys, /* dump */
fs_pathconf,
fs_nosys, /* attr_set */
fs_nosys, /* attr_remove */
fs_nosys, /* attr_list */
-#ifdef AFS_SGI64_ENV
-#ifdef AFS_SGI65_ENV
fs_cover,
(vop_link_removed_t) fs_noval,
fs_vnode_change,
(vop_readbuf_t) fs_nosys,
fs_strgetmsg,
fs_strputmsg,
-#else
- fs_mount,
-#endif
-#endif
};
struct vnodeops *afs_ops = &Afs_vnodeops;
#endif /* MP */
}
return vattr.va_size;
}
-#endif /* AFS_SGI62_ENV */
/************** Linux memory allocator interface functions **********/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
DEFINE_MUTEX(afs_linux_alloc_sem);
-#else
-DECLARE_MUTEX(afs_linux_alloc_sem);
-#endif
void *
osi_linux_alloc(unsigned int asize, int drop_glock)
* 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>
# endif
#endif
+#if !defined(HAVE_LINUX_KTHREAD_COMPLETE_AND_EXIT)
+# define kthread_complete_and_exit complete_and_exit
+#endif
+
#if defined(STRUCT_DENTRY_OPERATIONS_HAS_D_AUTOMOUNT) && !defined(DCACHE_NEED_AUTOMOUNT)
# define DCACHE_NEED_AUTOMOUNT DMANAGED_AUTOMOUNT
#endif
# 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(HAVE_LINUX_INODE_SETATTR)
+#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);
#elif defined(INODE_SETATTR_NOT_VOID)
if (inode->i_op && inode->i_op->setattr)
#endif
}
+static inline int
+afs_setattr_prepare(struct dentry *dp, struct iattr *newattrs)
+{
+#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);
+#else
+ return inode_change_ok(dp->d_inode, 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;
}
AFS_CURRENT_TIME(&newattrs.ia_ctime);
/* avoid notify_change() since it wants to update dentry->d_parent */
-#ifdef HAVE_LINUX_SETATTR_PREPARE
- code = setattr_prepare(file_dentry(afile->filp), &newattrs);
-#else
- code = inode_change_ok(inode, &newattrs);
-#endif
+ code = afs_setattr_prepare(file_dentry(afile->filp), &newattrs);
if (!code)
code = afs_inode_setattr(afile, &newattrs);
if (!code)
* 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)
{
#if !defined(LINUX_KEYRING_SUPPORT) && (!defined(STRUCT_TASK_STRUCT_HAS_CRED) || defined(HAVE_LINUX_RCU_READ_LOCK))
struct task_struct *p;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && defined(EXPORTED_TASKLIST_LOCK)
- if (&tasklist_lock)
- read_lock(&tasklist_lock);
-#endif /* EXPORTED_TASKLIST_LOCK */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && defined(EXPORTED_TASKLIST_LOCK)
- else
-#endif /* EXPORTED_TASKLIST_LOCK && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
- rcu_read_lock();
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */
+ rcu_read_lock();
#if defined(for_each_process)
for_each_process(p) if (p->pid) {
afs_GCPAGs_perproc_func(p);
}
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && defined(EXPORTED_TASKLIST_LOCK)
- if (&tasklist_lock)
- read_unlock(&tasklist_lock);
-#endif /* EXPORTED_TASKLIST_LOCK */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) && defined(EXPORTED_TASKLIST_LOCK)
- else
-#endif /* EXPORTED_TASKLIST_LOCK && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) */
- rcu_read_unlock();
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */
+
+ rcu_read_unlock();
#endif
}
}
#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
return (-code);
}
-# if defined(AFS_PPC64_LINUX20_ENV)
+# if defined(AFS_PPC64_LINUX_ENV)
/* Intercept the uid16 system call as used by 32bit programs. */
extern asmlinkage long (*sys32_setgroupsp)(int gidsetsize, gid_t *grouplist);
asmlinkage long afs32_xsetgroups(int gidsetsize, gid_t *grouplist)
}
# endif
-# if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_AMD64_LINUX20_ENV)
+# if defined(AFS_SPARC64_LINUX_ENV) || defined(AFS_AMD64_LINUX_ENV)
/* Intercept the uid16 system call as used by 32bit programs. */
-# ifdef AFS_AMD64_LINUX20_ENV
+# ifdef AFS_AMD64_LINUX_ENV
extern asmlinkage long (*sys32_setgroupsp) (int gidsetsize, u16 * grouplist);
-# endif /* AFS_AMD64_LINUX20_ENV */
-# ifdef AFS_SPARC64_LINUX26_ENV
+# endif /* AFS_AMD64_LINUX_ENV */
+# ifdef AFS_SPARC64_LINUX_ENV
extern asmlinkage int (*sys32_setgroupsp) (int gidsetsize,
__kernel_gid32_t * grouplist);
-# endif /* AFS_SPARC64_LINUX26_ENV */
+# endif /* AFS_SPARC64_LINUX_ENV */
asmlinkage long
afs32_xsetgroups(int gidsetsize, u16 * grouplist)
{
}
/* Intercept the uid32 system call as used by 32bit programs. */
-# ifdef AFS_AMD64_LINUX20_ENV
+# ifdef AFS_AMD64_LINUX_ENV
extern asmlinkage long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist);
-# endif /* AFS_AMD64_LINUX20_ENV */
-# ifdef AFS_SPARC64_LINUX26_ENV
+# endif /* AFS_AMD64_LINUX_ENV */
+# ifdef AFS_SPARC64_LINUX_ENV
extern asmlinkage int (*sys32_setgroups32p) (int gidsetsize,
__kernel_gid32_t * grouplist);
-# endif /* AFS_SPARC64_LINUX26_ENV */
+# endif /* AFS_SPARC64_LINUX_ENV */
asmlinkage long
afs32_xsetgroups32(int gidsetsize, gid_t * grouplist)
{
* If that's not available, then keyring based PAGs won't work.
*/
-#if defined(EXPORTED_TASKLIST_LOCK) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(HAVE_LINUX_RCU_READ_LOCK))
+#if defined(EXPORTED_TASKLIST_LOCK) || defined(HAVE_LINUX_RCU_READ_LOCK)
if (__key_type_keyring == NULL) {
# ifdef EXPORTED_TASKLIST_LOCK
if (&tasklist_lock)
read_lock(&tasklist_lock);
# endif
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(HAVE_LINUX_RCU_READ_LOCK))
+# if defined(HAVE_LINUX_RCU_READ_LOCK)
# ifdef EXPORTED_TASKLIST_LOCK
else
# endif
if (&tasklist_lock)
read_unlock(&tasklist_lock);
# endif
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(HAVE_LINUX_RCU_READ_LOCK))
+# if defined(HAVE_LINUX_RCU_READ_LOCK)
# ifdef EXPORTED_TASKLIST_LOCK
else
# endif
#include <linux/unistd.h> /* For syscall numbers. */
#include <linux/mm.h>
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
#include <asm/ia32_unistd.h>
#endif
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
* Test to see for 64/32bit compatibility mode
* Return non-zero if in a 64bit kernel and handing a 32bit syscall
*/
-#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX_ENV) && !defined(AFS_IA64_LINUX_ENV)
static inline int
afs_in_compat_syscall(void)
{
# if defined(HAVE_LINUX_IN_COMPAT_SYSCALL)
return in_compat_syscall();
-# elif defined(AFS_SPARC64_LINUX26_ENV)
+# elif defined(AFS_SPARC64_LINUX_ENV)
return test_thread_flag(TIF_32BIT);
-# elif defined(AFS_SPARC64_LINUX24_ENV)
- return (current->thread.flags & SPARC_FLAG_32BIT) != 0;
-# elif defined(AFS_SPARC64_LINUX20_ENV)
- return (current->tss.flags & SPARC_FLAG_32BIT) != 0;
-# elif defined(AFS_AMD64_LINUX26_ENV)
+# elif defined(AFS_AMD64_LINUX_ENV)
return test_thread_flag(TIF_IA32);
-# elif defined(AFS_AMD64_LINUX20_ENV)
- return (current->thread.flags & THREAD_IA32) != 0;
-# elif defined(AFS_PPC64_LINUX26_ENV)
+# elif defined(AFS_PPC64_LINUX_ENV)
# if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
return (current->thread_info->flags & _TIF_32BIT) != 0;
# else
return (task_thread_info(current)->flags & _TIF_32BIT) != 0;
# endif
-# elif defined(AFS_PPC64_LINUX20_ENV)
- return (current->thread.flags & PPC_FLAG_32BIT) != 0;
-# elif defined(AFS_S390X_LINUX26_ENV)
+# elif defined(AFS_S390X_LINUX_ENV)
return test_thread_flag(TIF_31BIT);
-# elif defined(AFS_S390X_LINUX20_ENV)
- return (current->thread.flags & S390_FLAG_31BIT) != 0;
-# elif defined(AFS_ARM64_LINUX26_ENV)
+# elif defined(AFS_ARM64_LINUX_ENV)
return is_compat_task();
# else
# error afs_in_compat_syscall not done for this linux
# 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);
}
#define OSIFILE_INODE(a) FILE_INODE((a)->filp)
-#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX_ENV) && !defined(AFS_IA64_LINUX_ENV)
# define NEED_IOCTL32
#endif
#include <linux/sched.h>
#include <linux/wait.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
extern struct mutex afs_global_lock;
-#else
-extern struct semaphore afs_global_lock;
-# define mutex_lock(lock) down(lock)
-# define mutex_unlock(lock) up(lock)
-#endif
extern int afs_global_owner;
#define AFS_GLOCK() \
#define osi_InitGlock()
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
/* RHEL5 beta's kernel doesn't define these. They aren't gonna change, so... */
# ifndef __NR_ia32_afs_syscall
/* This could use some work, and support on more platforms. */
-int afs_thread_wrapper(void *rock)
+static int
+afs_thread_wrapper(void *rock)
+{
+ void (*proc)(void) = rock;
+ __module_get(THIS_MODULE);
+ (*proc)();
+ module_put(THIS_MODULE);
+ return 0;
+}
+
+static int
+afs_thread_wrapper_glock(void *rock)
{
void (*proc)(void) = rock;
__module_get(THIS_MODULE);
return 0;
}
-void afs_start_thread(void (*proc)(void), char *name)
+void
+afs_start_thread(void (*proc)(void), char *name, int needs_glock)
{
- kthread_run(afs_thread_wrapper, proc, "%s", name);
+ if (needs_glock) {
+ kthread_run(afs_thread_wrapper_glock, proc, "%s", name);
+ } else {
+ kthread_run(afs_thread_wrapper, proc, "%s", name);
+ }
}
#include <linux/unistd.h> /* For syscall numbers. */
#include <linux/mm.h>
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
#include <asm/ia32_unistd.h>
#endif
#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;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
DEFINE_MUTEX(afs_global_lock);
-#else
-DECLARE_MUTEX(afs_global_lock);
-#endif
int afs_global_owner = 0;
#ifdef HAVE_LINUX_KUID_T
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();
#include <linux/sunrpc/svcauth.h>
static unsigned long authtab_addr = 0;
-#if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param(authtab_addr, long, 0);
-#else
-MODULE_PARM(authtab_addr, "l");
-#endif
MODULE_PARM_DESC(authtab_addr, "Address of the authtab array.");
extern struct auth_ops *authtab[] __attribute__((weak));
#include <linux/unistd.h> /* For syscall numbers. */
#include <linux/mm.h>
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
#include <asm/ia32_unistd.h>
#endif
#include <linux/kernel.h>
static unsigned long nfs_server_addr = 0;
-#if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param(nfs_server_addr, long, 0);
-#else
-MODULE_PARM(nfs_server_addr, "l");
-#endif
MODULE_PARM_DESC(nfs_server_addr, "IP Address of NFS Server");
static char *this_cell = 0;
-#if defined(module_param_array) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param(this_cell, charp, 0);
-#else
-MODULE_PARM(this_cell, "s");
-#endif
MODULE_PARM_DESC(this_cell, "Local cell name");
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
DEFINE_MUTEX(afs_global_lock);
-#else
-DECLARE_MUTEX(afs_global_lock);
-#endif
+
struct proc_dir_entry *openafs_procfs;
int afs_global_owner = 0;
struct user_namespace *afs_ns;
#endif
-int __init
+static int __init
afspag_init(void)
{
#if !defined(EXPORTED_PROC_ROOT_FS)
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>
#include <linux/unistd.h>
#include <linux/mm.h>
-#if defined(AFS_PPC64_LINUX26_ENV)
+#if defined(AFS_PPC64_LINUX_ENV)
# include <asm/abs_addr.h>
#endif
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
# include <asm/ia32_unistd.h>
#endif
#endif
/* lower bound of valid kernel text pointers */
-#ifdef AFS_IA64_LINUX20_ENV
+#ifdef AFS_IA64_LINUX_ENV
#define ktxt_lower_bound (((unsigned long)&kernel_thread ) & 0xfff00000L)
-#elif defined(AFS_PPC64_LINUX20_ENV)
+#elif defined(AFS_PPC64_LINUX_ENV)
#define ktxt_lower_bound (KERNELBASE)
#else
#define ktxt_lower_bound (((unsigned long)&kernel_thread ) & ~0xfffffL)
/* On SPARC64 and S390X, sys_call_table contains 32-bit entries
* even though pointers are 64 bit quantities.
*/
-#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
#define SYSCALLTYPE unsigned int
#define PROBETYPE int
#else
#define PROBETYPE long
#endif
-#if defined(AFS_S390X_LINUX20_ENV) && !defined(AFS_S390X_LINUX26_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
/* Allow the user to specify sys_call_table addresses */
static unsigned long sys_call_table_addr[4] = { 0,0,0,0 };
-#if defined(module_param_array) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param_array(sys_call_table_addr, long, NULL, 0);
-#else
-MODULE_PARM(sys_call_table_addr, "1-4l");
-#endif
MODULE_PARM_DESC(sys_call_table_addr, "Location of system call tables");
/* If this is set, we are more careful about avoiding duplicate matches */
static int probe_carefully = 1;
-#if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param(probe_carefully, int, 0);
-#else
-MODULE_PARM(probe_carefully, "i");
-#endif
MODULE_PARM_DESC(probe_carefully, "Probe for system call tables carefully");
static int probe_ignore_syscalls[8] = { -1, -1, -1, -1, -1, -1, -1, -1 };
-#if defined(module_param_array) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param_array(probe_ignore_syscalls, int, NULL, 0);
-#else
-MODULE_PARM(probe_ignore_syscalls, "1-8i");
-#endif
MODULE_PARM_DESC(probe_ignore_syscalls, "Syscalls to ignore in table checks");
#ifdef OSI_PROBE_DEBUG
* 0x0080 - detail - check_table_readable
*/
static int probe_debug = 0x41;
-#if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param(probe_debug, int, 0);
-#else
-MODULE_PARM(probe_debug, "i");
-#endif
MODULE_PARM_DESC(probe_debug, "Debugging level");
static unsigned long probe_debug_addr[4] = { 0,0,0,0 };
-#if defined(module_param_array) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param_array(probe_debug_addr, long, NULL, 0);
-#else
-MODULE_PARM(probe_debug_addr, "1-4l");
-#endif
MODULE_PARM_DESC(probe_debug_addr, "Debug range starting locations");
static unsigned long probe_debug_range = 0;
-#if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param(probe_debug_range, long, 0);
-#else
-MODULE_PARM(probe_debug_range, "l");
-#endif
MODULE_PARM_DESC(probe_debug_range, "Debug range length");
static unsigned long probe_debug_tag = 0;
-#if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
module_param(probe_debug_tag, long, 0);
-#else
-MODULE_PARM(probe_debug_tag, "l");
-#endif
MODULE_PARM_DESC(probe_debug_tag, "Debugging output start tag");
#endif
int debug_ignore_NR[4]; /* syscalls to ignore for debugging */
} probectl;
-#if defined(AFS_I386_LINUX26_ENV) || defined(AFS_AMD64_LINUX26_ENV)
+#if defined(AFS_I386_LINUX_ENV) || defined(AFS_AMD64_LINUX_ENV)
static int check_access(unsigned long, int);
static int check_table_readable(probectl *, PROBETYPE *);
#endif
/* syscall pairs/triplets to probe */
/* On PPC64 and SPARC64, we need to omit the ones that might match both tables */
static tryctl main_try[] = {
-#if !defined(AFS_PPC64_LINUX20_ENV) && !defined(AFS_SPARC64_LINUX20_ENV)
+#if !defined(AFS_PPC64_LINUX_ENV) && !defined(AFS_SPARC64_LINUX_ENV)
#if defined(EXPORTED_SYS_CHDIR)
{ "scan: close+chdir+write", __NR_close, &sys_close, __NR_chdir, &sys_chdir, __NR_write, &sys_write },
#endif
#endif
{ "scan: close+wait4", __NR_close, &sys_close, __NR_wait4, &sys_wait4, -1, 0 },
-#if !defined(AFS_PPC64_LINUX20_ENV) && !defined(AFS_SPARC64_LINUX20_ENV)
+#if !defined(AFS_PPC64_LINUX_ENV) && !defined(AFS_SPARC64_LINUX_ENV)
#if defined(EXPORTED_SYS_CHDIR)
{ "scan: close+chdir", __NR_close, &sys_close, __NR_chdir, &sys_chdir, -1, 0 },
#endif
* other entries, or we might get a sys_ni_syscall into the list and
* the test would no longer work.
*/
-#if defined(AFS_SPARC64_LINUX20_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV)
/* mmap2, fstat64, getmsg, putmsg, modify_ldt */
56, 63, 151, 152, 218,
-#elif defined(AFS_SPARC_LINUX20_ENV)
+#elif defined(AFS_SPARC_LINUX_ENV)
/* memory_ordering, getmsg, putmsg, unimplemented, modify_ldt */
52, 151, 152, 164, 218,
-#else /* !AFS_SPARC_LINUX20_ENV */
+#else /* !AFS_SPARC_LINUX_ENV */
/*
* These 7 syscalls are present in the syscall table on most "older"
* corresponding __NR macros are not defined, so the tests above fail.
* Instead, we just have to know the numbers for these.
*/
-#if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+#if defined(AFS_S390_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
/* break, stty, gtty, ftime, prof, lock, mpx */
17, 31, 32, 35, 44, 53, 56,
#endif
* unimplemented, but the __NR macros are not defined. Again,
* we simply have to know their numbers.
*/
-#ifdef AFS_IA64_LINUX26_ENV
+#ifdef AFS_IA64_LINUX_ENV
/* create_module, query_module, get_kernel_sysms */
1132, 1136, 1135,
#endif
* unimplemented calls are very similar.
* mmap2 and fstat64 are implemented only for 32-bit calls
*/
-#ifdef AFS_PPC64_LINUX20_ENV
+#ifdef AFS_PPC64_LINUX_ENV
/* _mmap2, _fstat64 */
192, 197,
-#endif /* AFS_PPC64_LINUX20_ENV */
+#endif /* AFS_PPC64_LINUX_ENV */
/* Similarly for S390X, with lcown16 and fstat64 */
-#ifdef AFS_S390X_LINUX20_ENV
+#ifdef AFS_S390X_LINUX_ENV
/* lchown16, fstat64 */
16, 197,
#endif
-#endif /* !AFS_SPARC_LINUX20_ENV */
+#endif /* !AFS_SPARC_LINUX_ENV */
0
};
/* unique syscalls for try_harder */
static int main_unique_syscalls[] = {
-#if defined(AFS_SPARC64_LINUX24_ENV) || defined(AFS_SPARC_LINUX24_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV) || defined(AFS_SPARC_LINUX_ENV)
/*
* On SPARC, we need some additional unique calls to make sure
* we don't match the SunOS-compatibility table.
"system call table",
/* syscall number of first entry in table */
-#ifdef AFS_IA64_LINUX20_ENV
+#ifdef AFS_IA64_LINUX_ENV
1024,
#else
0,
main_try, /* array of combinations to try */
/* symbol in section to try scanning */
-#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV) || defined(AFS_S390_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
(unsigned long)&sys_close,
-#elif defined(AFS_AMD64_LINUX26_ENV)
+#elif defined(AFS_AMD64_LINUX_ENV)
/* On this platform, it's in a different section! */
(unsigned long)&generic_ro_fops,
#else
/* default base address for scan */
/* base address bits to force to zero */
/* default length for scan */
-#if defined(AFS_SPARC64_LINUX20_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV)
(unsigned long)(&sys_close),
0xfffff,
0x10000,
-#elif defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+#elif defined(AFS_S390_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
/* bleah; this is so suboptimal */
(unsigned long)(&sys_close),
0xfffff,
0x20000,
-#elif defined(AFS_IA64_LINUX20_ENV)
+#elif defined(AFS_IA64_LINUX_ENV)
(unsigned long)(&init_mm),
0x1fffff,
0x30000,
-#elif defined(AFS_AMD64_LINUX26_ENV)
+#elif defined(AFS_AMD64_LINUX_ENV)
(unsigned long)(&generic_ro_fops) - 0x30000,
0,
0x6000,
-#elif defined(AFS_PPC64_LINUX26_ENV)
+#elif defined(AFS_PPC64_LINUX_ENV)
(unsigned long)(&do_signal),
0xfff,
0x400,
/* syscalls to ignore for debugging */
{
-#if defined(AFS_ALPHA_LINUX20_ENV)
+#if defined(AFS_ALPHA_LINUX_ENV)
338,
-#elif defined(AFS_AMD64_LINUX20_ENV)
+#elif defined(AFS_AMD64_LINUX_ENV)
183,
-#elif defined(AFS_IA64_LINUX20_ENV)
+#elif defined(AFS_IA64_LINUX_ENV)
1141,
-#elif defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_SPARC64_LINUX20_ENV)
+#elif defined(AFS_SPARC_LINUX_ENV) || defined(AFS_SPARC64_LINUX_ENV)
227,
#else
137,
/********** Probing Configuration: amd64 ia32_sys_call_table **********/
-#if defined(AFS_AMD64_LINUX20_ENV)
+#if defined(AFS_AMD64_LINUX_ENV)
/* syscall pairs/triplets to probe */
static tryctl ia32_try[] = {
/********** Probing Configuration: IA64 **********/
-#elif defined(AFS_IA64_LINUX20_ENV)
+#elif defined(AFS_IA64_LINUX_ENV)
struct fptr {
void *ip;
unsigned long gp;
/********** Probing Configuration: ppc64, sparc64 sys_call_table32 **********/
-#elif defined(AFS_PPC64_LINUX20_ENV) || defined(AFS_SPARC64_LINUX20_ENV)
+#elif defined(AFS_PPC64_LINUX_ENV) || defined(AFS_SPARC64_LINUX_ENV)
struct fptr {
void *ip;
unsigned long gp;
/* zapped syscalls for try_harder */
static int sct32_zapped_syscalls[] = {
-#ifdef AFS_PPC64_LINUX20_ENV
+#ifdef AFS_PPC64_LINUX_ENV
/* These should be sufficient */
__NR_break, __NR_stty, __NR_gtty, __NR_ftime,
__NR_prof, __NR_lock, __NR_mpx,
#endif
-#ifdef AFS_SPARC64_LINUX20_ENV
+#ifdef AFS_SPARC64_LINUX_ENV
/* memory_ordering, getmsg, putmsg, unimplemented, modify_ldt */
52, 151, 152, 164, 218,
#endif
/* unique syscalls for try_harder */
/* mmap2 and fstat64 are implemented only for 32-bit calls */
static int sct32_unique_syscalls[] = {
-#ifdef AFS_PPC64_LINUX20_ENV
+#ifdef AFS_PPC64_LINUX_ENV
/* _mmap2, _fstat64 */
192, 197,
#endif
-#ifdef AFS_SPARC64_LINUX24_ENV
+#ifdef AFS_SPARC64_LINUX_ENV
/*
* On SPARC, we need some additional unique calls to make sure
* we don't match the SunOS-compatibility table.
sct32_try, /* array of combinations to try */
/* symbol in section to try scanning */
-#if defined(AFS_SPARC64_LINUX20_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV)
(unsigned long)&sys_close,
#else
(unsigned long)&init_mm,
/* default base address for scan */
/* base address bits to force to zero */
/* default length for scan */
-#if defined(AFS_SPARC64_LINUX20_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV)
(unsigned long)(&sys_close),
0xfffff,
0x10000,
-#elif defined(AFS_PPC64_LINUX26_ENV)
+#elif defined(AFS_PPC64_LINUX_ENV)
(unsigned long)(&do_signal),
0xfff,
0x400,
/* syscalls to ignore for debugging */
{
-#if defined(AFS_SPARC64_LINUX20_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV)
227,
#else
137,
* On earlier versions, the two tables were interleaved and so
* have related base addresses.
*/
-#elif defined(AFS_S390X_LINUX26_ENV)
+#elif defined(AFS_S390X_LINUX_ENV)
/* syscall pairs/triplets to probe */
/* nothing worthwhile is exported, so this is empty */
PROBETYPE *x;
int i, j;
-#if defined(AFS_I386_LINUX26_ENV) || defined(AFS_AMD64_LINUX26_ENV)
+#if defined(AFS_I386_LINUX_ENV) || defined(AFS_AMD64_LINUX_ENV)
i = check_table_readable(P, ptr);
if (i >= 0) return i;
#endif
- for (x = ptr, i = 0; i < _SS(NR_syscalls); i++, x++) {
+ for (x = ptr, i = 0; i < NR_syscalls; i++, x++) {
#ifdef OSI_PROBE_DEBUG
if (probe_debug & 0x0040) {
for (j = 0; j < 4; j++) {
- if (_SS(P->debug_ignore_NR[j]) == _SX(i + P->offset)) break;
+ if (P->debug_ignore_NR[j] == i + P->offset) break;
}
if (j < 4) continue;
}
#endif
for (j = 0; j < 8; j++) {
- if (_SS(probe_ignore_syscalls[j]) == _SX(i) + P->offset) break;
+ if (probe_ignore_syscalls[j] == i + P->offset) break;
}
if (j < 8) continue;
if (*x <= ktxt_lower_bound) {
int ret;
PROBETYPE *ptr;
-#if defined(AFS_IA64_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV)
+#if defined(AFS_IA64_LINUX_ENV) || defined(AFS_PPC64_LINUX_ENV)
ip1 = T->fn1 ? (unsigned long)((struct fptr *)T->fn1)->ip : 0;
ip2 = T->fn2 ? (unsigned long)((struct fptr *)T->fn2)->ip : 0;
ip3 = T->fn3 ? (unsigned long)((struct fptr *)T->fn3)->ip : 0;
return 0;
for (offset = 0; offset < datalen; offset++, aptr++) {
-#if defined(AFS_PPC64_LINUX20_ENV)
+#if defined(AFS_PPC64_LINUX_ENV)
ptr = (PROBETYPE*)(*aptr);
if ((unsigned long)ptr <= KERNELBASE) {
continue;
ptr = aptr;
#endif
if ((unsigned long)ptr < init_mm.start_code ||
-#if defined(AFS_AMD64_LINUX20_ENV)
+#if defined(AFS_AMD64_LINUX_ENV)
(unsigned long)ptr > init_mm.brk)
#else
(unsigned long)ptr > init_mm.end_data)
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)
unsigned long ip1;
int i, s;
-#if defined(AFS_I386_LINUX26_ENV) || defined(AFS_AMD64_LINUX26_ENV)
+#if defined(AFS_I386_LINUX_ENV) || defined(AFS_AMD64_LINUX_ENV)
i = check_table_readable(P, p);
if (i >= 0) return 0;
#endif
/* 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))
}
}
-#if defined(AFS_IA64_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV)
+#if defined(AFS_IA64_LINUX_ENV) || defined(AFS_PPC64_LINUX_ENV)
ip1 = P->verify_fn ? (unsigned long)((struct fptr *)(P->verify_fn))->ip : 0;
#else
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);
#endif
for (offset = 0; offset < datalen; offset++, ptr++) {
if ((unsigned long)ptr < init_mm.start_code ||
-#if defined(AFS_AMD64_LINUX20_ENV)
+#if defined(AFS_AMD64_LINUX_ENV)
(unsigned long)ptr > init_mm.brk)
#else
(unsigned long)ptr > init_mm.end_data)
{
tryctl *T;
void *answer;
-#if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+#if defined(AFS_S390_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
void *answer2;
#endif
#ifdef OSI_PROBE_DEBUG
for (T = P->trylist; T->name; T++) {
answer = try(P, T, B, L);
-#if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+#if defined(AFS_S390_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
answer2 = try(P, T, (PROBETYPE *)(2 + (void *)B), L);
#ifdef OSI_PROBE_DEBUG
if (probe_debug & 0x0003) {
/* XXX more checks here */
answer = try_harder(P, B, L);
-#if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV)
+#if defined(AFS_S390_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
answer2 = try_harder(P, (PROBETYPE *)(2 + (void *)B), L);
#ifdef OSI_PROBE_DEBUG
if (probe_debug & 0x0005) {
#endif
}
-#if defined(AFS_I386_LINUX26_ENV) || defined(AFS_AMD64_LINUX26_ENV)
+#if defined(AFS_I386_LINUX_ENV) || defined(AFS_AMD64_LINUX_ENV)
static int check_access(unsigned long address, int mode)
{
pgd_t *pgd = pgd_offset_k(address);
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)) {
return 0;
}
printk("Found %s at 0x%lx (%s)\n", P->desc, (unsigned long)answer, method);
-#if defined(AFS_I386_LINUX26_ENV) || defined(AFS_AMD64_LINUX26_ENV)
+#if defined(AFS_I386_LINUX_ENV) || defined(AFS_AMD64_LINUX_ENV)
if (!check_access((unsigned long)answer, 1)) {
printk("Address 0x%lx is not writable.\n", (unsigned long)answer);
printk("System call hooks will not be installed; proceeding anyway\n");
#include <linux/unistd.h> /* For syscall numbers. */
#include <linux/mm.h>
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
# include <asm/ia32_unistd.h>
#endif
struct dentry **dpp);
extern int osi_abspath(char *aname, char *buf, int buflen,
int followlink, char **pathp);
-extern void afs_start_thread(void (*proc)(void), char *name);
+extern void afs_start_thread(void (*proc)(void), char *name, int needs_glock);
/* osi_probe.c */
extern void *osi_find_syscall_table(int which);
#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>
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
#include <asm/ia32_unistd.h>
#endif
* even though pointers are 64 bit quantities.
* XXX unify this with osi_probe.c
*/
-#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV) || defined(AFS_S390X_LINUX_ENV)
#define SYSCALLTYPE unsigned int
#define POINTER2SYSCALL (unsigned int)(unsigned long)
#define SYSCALL2POINTER (void *)(long)
#define SYSCALL2POINTER (void *)
#endif
-#if defined(AFS_S390X_LINUX24_ENV)
+#if defined(AFS_S390X_LINUX_ENV)
#define INSERT_SYSCALL(SLOT, TMPPAGE, FUNC) \
if (SYSCALL2POINTER FUNC > 0x7fffffff) { \
TMPPAGE = kmalloc ( PAGE_SIZE, GFP_DMA|GFP_KERNEL ); \
afs_sys_call_table[_S(SLOT)] = POINTER2SYSCALL FUNC;
#endif
-#if defined(AFS_IA64_LINUX20_ENV)
+#if defined(AFS_IA64_LINUX_ENV)
#define _S(x) ((x)-1024)
#else
#define _S(x) x
/***** 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;
-#ifdef AFS_S390X_LINUX24_ENV
+#ifdef AFS_S390X_LINUX_ENV
static void *afs_sys_setgroups_page = 0;
#if defined(__NR_setgroups32)
static void *afs_sys_setgroups32_page = 0;
__kernel_gid32_t * grouplist);
/***** AMD64 *****/
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
static SYSCALLTYPE *afs_ia32_sys_call_table;
static SYSCALLTYPE ia32_ni_syscall = 0;
asmlinkage long (*sys32_setgroupsp) (int gidsetsize, u16 * grouplist);
extern asmlinkage long afs32_xsetgroups32(int gidsetsize, gid_t * grouplist);
asmlinkage long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist);
-#endif /* AFS_AMD64_LINUX20_ENV */
+#endif /* AFS_AMD64_LINUX_ENV */
/***** PPC64 *****/
-#ifdef AFS_PPC64_LINUX26_ENV
+#ifdef AFS_PPC64_LINUX_ENV
static SYSCALLTYPE *afs_sys_call_table32;
static SYSCALLTYPE afs_ni_syscall32 = 0;
static SYSCALLTYPE old_sys_setgroupsp = 0;
printf("*** error! sys32_setgroups_stub called\n");
}
-#endif /* AFS_PPC64_LINUX26_ENV */
+#endif /* AFS_PPC64_LINUX_ENV */
/***** SPARC64 *****/
-#ifdef AFS_SPARC64_LINUX26_ENV
+#ifdef AFS_SPARC64_LINUX_ENV
static SYSCALLTYPE *afs_sys_call_table32;
static SYSCALLTYPE afs_ni_syscall32 = 0;
"ret\n\t"
"nop");
}
-#endif /* AFS_SPARC64_LINUX20_ENV */
+#endif /* AFS_SPARC64_LINUX_ENV */
/***** IA64 *****/
-#ifdef AFS_IA64_LINUX20_ENV
+#ifdef AFS_IA64_LINUX_ENV
asmlinkage long
afs_syscall_stub(int r0, int r1, long r2, long r3, long r4, long gp)
unsigned long gp;
};
-#endif /* AFS_IA64_LINUX20_ENV */
+#endif /* AFS_IA64_LINUX_ENV */
/***** PPC64 *****
* Spring 2005
* Horst Birthelmer <Horst.Birthelmer@sysgo.de>
* Marius Groeger <Marius.Groeger@sysgo.de>
*/
-#if defined(AFS_PPC64_LINUX26_ENV)
+#if defined(AFS_PPC64_LINUX_ENV)
extern void flush_cache(void *, unsigned long);
#define PPC_LO(v) ((v) & 0xffff)
#define PPC_HI(v) (((v) >> 16) & 0xffff)
PPC64_STUB(afs_sys_call_stub);
PPC64_STUB(afs_xsetgroups_stub);
PPC64_STUB(afs_xsetgroups32_stub);
-#endif /* AFS_PPC64_LINUX26_ENV */
+#endif /* AFS_PPC64_LINUX_ENV */
/**********************************************************************/
int osi_syscall_init(void)
{
/***** IA64 *****/
-#ifdef AFS_IA64_LINUX20_ENV
+#ifdef AFS_IA64_LINUX_ENV
/* This needs to be first because we are declaring variables, and
* also because the handling of syscall pointers is bizarre enough
* that we want to special-case even the "common" part.
/* XXX no 32-bit syscalls on IA64? */
-#elif defined(AFS_PPC64_LINUX26_ENV)
+#elif defined(AFS_PPC64_LINUX_ENV)
afs_sys_call_table = osi_find_syscall_table(0);
if (afs_sys_call_table) {
sys32_setgroupsp = POINTER2SYSCALL sys32_setgroups_stub;
}
/***** COMMON (except IA64 or PPC64) *****/
-#else /* !AFS_IA64_LINUX20_ENV */
+#else /* !AFS_IA64_LINUX_ENV */
afs_sys_call_table = osi_find_syscall_table(0);
if (afs_sys_call_table) {
INSERT_SYSCALL(__NR_setgroups32, afs_sys_setgroups32_page, afs_xsetgroups32)
#endif
}
-#endif /* !AFS_IA64_LINUX20_ENV */
+#endif /* !AFS_IA64_LINUX_ENV */
/***** AMD64 *****/
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
afs_ia32_sys_call_table = osi_find_syscall_table(1);
if (afs_ia32_sys_call_table) {
/* setup AFS entry point for IA32 */
afs_ia32_sys_call_table[__NR_ia32_setgroups32] =
POINTER2SYSCALL afs32_xsetgroups32;
}
-#endif /* AFS_AMD64_LINUX20_ENV */
+#endif /* AFS_AMD64_LINUX_ENV */
/***** SPARC64 *****/
-#ifdef AFS_SPARC64_LINUX20_ENV
+#ifdef AFS_SPARC64_LINUX_ENV
afs_sys_call_table32 = osi_find_syscall_table(1);
if (afs_sys_call_table32) {
/* setup AFS entry point for 32-bit SPARC */
afs_sys_call_table32[__NR_setgroups32] =
POINTER2SYSCALL afs32_xsetgroups32;
}
-#endif /* AFS_SPARC64_LINUX20_ENV */
+#endif /* AFS_SPARC64_LINUX_ENV */
return 0;
}
afs_sys_call_table[_S(__NR_afs_syscall)] = afs_ni_syscall;
/* put back setgroups */
-#if defined(AFS_IA64_LINUX20_ENV)
+#if defined(AFS_IA64_LINUX_ENV)
afs_sys_call_table[_S(__NR_setgroups)] =
POINTER2SYSCALL((struct fptr *)sys_setgroupsp)->ip;
-#elif defined(AFS_PPC64_LINUX26_ENV)
+#elif defined(AFS_PPC64_LINUX_ENV)
afs_sys_call_table[_S(__NR_setgroups)] =
POINTER2SYSCALL old_sys_setgroupsp;
/* put back setgroups32 for PPC64 */
afs_sys_call_table32[__NR_setgroups] =
POINTER2SYSCALL old_sys32_setgroupsp;
-#else /* AFS_IA64_LINUX20_ENV */
+#else /* AFS_IA64_LINUX_ENV */
afs_sys_call_table[_S(__NR_setgroups)] =
POINTER2SYSCALL sys_setgroupsp;
#endif
-#if defined(__NR_setgroups32) && !defined(AFS_IA64_LINUX20_ENV)
+#if defined(__NR_setgroups32) && !defined(AFS_IA64_LINUX_ENV)
/* put back setgroups32 */
afs_sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p;
#endif
-#if defined(AFS_S390X_LINUX24_ENV)
-#if defined(__NR_setgroups32) && !defined(AFS_IA64_LINUX20_ENV)
+#if defined(AFS_S390X_LINUX_ENV)
+#if defined(__NR_setgroups32) && !defined(AFS_IA64_LINUX_ENV)
if (afs_sys_setgroups32_page)
kfree(afs_sys_setgroups32_page);
#endif
/***** IA64 *****/
-#ifdef AFS_IA64_LINUX20_ENV
+#ifdef AFS_IA64_LINUX_ENV
/* XXX no 32-bit syscalls on IA64? */
#endif
/***** AMD64 *****/
-#ifdef AFS_AMD64_LINUX20_ENV
+#ifdef AFS_AMD64_LINUX_ENV
if (afs_ia32_sys_call_table) {
/* put back AFS entry point for IA32 */
afs_ia32_sys_call_table[__NR_ia32_afs_syscall] =
/***** SPARC64 *****/
-#ifdef AFS_SPARC64_LINUX20_ENV
+#ifdef AFS_SPARC64_LINUX_ENV
if (afs_sys_call_table32) {
/* put back AFS entry point for 32-bit SPARC */
afs_sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32;
# 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);
VN_HOLD(AFSTOV(avc));
return 0;
}
+
+/**
+ * Should we defer calling afs_remunlink(avc) to a background daemon, or can we
+ * call it in the current process?
+ *
+ * @param[in] avc The vcache we're going to call afs_remunlink on
+ *
+ * @retval 0 call afs_remunlink in the current task
+ * @retval 1 call afs_remunlink in the background
+ */
+int
+osi_ShouldDeferRemunlink(struct vcache *avc)
+{
+ if (cacheDiskType == AFS_FCACHE_TYPE_UFS && current->fs == NULL) {
+ /*
+ * If current->fs is NULL (which can happen when the current process is
+ * in the middle of exiting), then calling dentry_open can result in a
+ * kernel panic with certain LSMs (e.g. Crowdstrike Falcon).
+ *
+ * If we have a disk cache, calling afs_remunlink generally involves
+ * calling dentry_open, since we need to interact with the disk cache,
+ * and so calling afs_remunlink can cause a panic. So, make sure we
+ * defer afs_remunlink to a background daemon, where current->fs is not
+ * NULL, and so it won't panic the machine.
+ */
+ return 1;
+ }
+ 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();
+}
afs_globalVFS = 0;
afs_globalVp = 0;
- afs_shutdown();
+ afs_shutdown(AFS_WARM);
mntput(afs_cacheMnt);
osi_linux_verify_alloced_memory();
#include "afsincludes.h"
#include "afs/afs_stats.h"
#include <linux/mm.h>
+#include <linux/buffer_head.h>
#ifdef HAVE_MM_INLINE_H
#include <linux/mm_inline.h>
#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);
afid.Fid.Unique = ntohl(de->fid.vunique);
if ((avc->f.states & CForeign) == 0 && (ntohl(de->fid.vnode) & 1)) {
type = DT_DIR;
- } else if ((tvc = afs_FindVCache(&afid, 0, 0))) {
+ } else if ((tvc = afs_FindVCache(&afid, 0))) {
if (tvc->mvstat != AFS_MVSTAT_FILE) {
type = DT_DIR;
} else if (((tvc->f.states) & (CStatd | CTruth))) {
}
-/* 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_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
static int
afs_notify_change(struct dentry *dp, struct iattr *iattrp)
+#endif
{
struct vattr *vattr = NULL;
cred_t *credp = crref();
return afs_convert_code(code);
}
-#if defined(IOP_GETATTR_TAKES_PATH_STRUCT)
+#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)
+{
+ int err = afs_linux_revalidate(path->dentry);
+ if (!err) {
+ generic_fillattr(afs_ns, path->dentry->d_inode, stat);
+ }
+ return err;
+}
+#elif defined(IOP_GETATTR_TAKES_PATH_STRUCT)
static int
afs_linux_getattr(const struct path *path, struct kstat *stat, u32 request_mask, unsigned int sync_mode)
{
#else
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
static DEFINE_MUTEX(dentry_race_sem);
-# else
-static DECLARE_MUTEX(dentry_race_sem);
-# endif
static inline void
dentry_race_lock(void)
*
* name is in kernel space at this point.
*/
+
+#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)
+#elif defined(IOP_CREATE_TAKES_BOOL)
static int
-#if defined(IOP_CREATE_TAKES_BOOL)
afs_linux_create(struct inode *dip, struct dentry *dp, umode_t mode,
bool excl)
#elif defined(IOP_CREATE_TAKES_UMODE_T)
+static int
afs_linux_create(struct inode *dip, struct dentry *dp, umode_t mode,
struct nameidata *nd)
#elif defined(IOP_CREATE_TAKES_NAMEIDATA)
+static int
afs_linux_create(struct inode *dip, struct dentry *dp, int mode,
struct nameidata *nd)
#else
+static int
afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
#endif
{
}
+#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)
+#else
static int
afs_linux_symlink(struct inode *dip, struct dentry *dp, const char *target)
+#endif
{
int code;
cred_t *credp = crref();
return afs_convert_code(code);
}
+#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)
+#elif defined(IOP_MKDIR_TAKES_UMODE_T)
static int
-#if defined(IOP_MKDIR_TAKES_UMODE_T)
afs_linux_mkdir(struct inode *dip, struct dentry *dp, umode_t mode)
#else
+static int
afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode)
#endif
{
}
+#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 inode *newip, struct dentry *newdp,
+ unsigned int flags)
+#elif defined(HAVE_LINUX_INODE_OPERATIONS_RENAME_TAKES_FLAGS)
static int
afs_linux_rename(struct inode *oldip, struct dentry *olddp,
- struct inode *newip, struct dentry *newdp
-#ifdef HAVE_LINUX_INODE_OPERATIONS_RENAME_TAKES_FLAGS
- , unsigned int flags
+ struct inode *newip, struct dentry *newdp,
+ unsigned int flags)
+#else
+static int
+afs_linux_rename(struct inode *oldip, struct dentry *olddp,
+ struct inode *newip, struct dentry *newdp)
#endif
- )
{
int code;
cred_t *credp = crref();
const char *newname = newdp->d_name.name;
struct dentry *rehash = NULL;
-#ifdef HAVE_LINUX_INODE_OPERATIONS_RENAME_TAKES_FLAGS
+#if defined(HAVE_LINUX_INODE_OPERATIONS_RENAME_TAKES_FLAGS) || \
+ 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 */
/* afs_linux_permission
* Check access rights - returns error if can't check or permission denied.
*/
+
+#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)
static int
-#if defined(IOP_PERMISSION_TAKES_FLAGS)
afs_linux_permission(struct inode *ip, int mode, unsigned int flags)
#elif defined(IOP_PERMISSION_TAKES_NAMEIDATA)
+static int
afs_linux_permission(struct inode *ip, int mode, struct nameidata *nd)
#else
+static int
afs_linux_permission(struct inode *ip, int mode)
#endif
{
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) && \
+ defined(HAVE_LINUX_BLOCK_DIRTY_FOLIO)
+ .dirty_folio = block_dirty_folio,
+#else
+ .set_page_dirty = __set_page_dirty_buffers,
+#endif
#if defined (STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_WRITE_BEGIN)
.write_begin = afs_linux_write_begin,
.write_end = afs_linux_write_end,
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
${GENCAT} afszcm.cat afs_trace.msf ;; \
esac
-depinstall: afszcm.cat AFS_component_version_number.c \
+depinstall: afszcm.cat unified_afs.c unified_afs.h AFS_component_version_number.c \
${TOP_INCDIR}/afs/afs_consts.h \
${TOP_INCDIR}/afs/afs.h \
${TOP_INCDIR}/afs/osi_inode.h \
#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 *);
vflush(mp, NULLVP, 0); /* don't support forced */
AFS_GLOCK();
afs_globalVFS = NULL;
- afs_cold_shutdown = 1;
- afs_shutdown(); /* XXX */
+ afs_shutdown(AFS_COLD);
AFS_GUNLOCK();
mp->mnt_data = NULL;
/* 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);
afsp->mnt_data = NULL;
AFS_GLOCK();
afs_globalVFS = 0;
- afs_cold_shutdown = 1;
- afs_shutdown(); /* XXX */
+ afs_shutdown(AFS_COLD);
AFS_GUNLOCK();
/* give up syscall entries for ioctl & setgroups, which we've stolen */
afs_globalVFS = 0;
- afs_shutdown();
+ afs_shutdown(AFS_WARM);
}
int
afsinit(struct vfssw *vfsswp, int fstype)
#endif
{
- extern int afs_xioctl();
extern int afs_xsetgroups();
AFS_STATCNT(afsinit);
pthread_mutex_t usr_sleep_mutex;
pthread_cond_t usr_sleep_cond;
-int call_syscall(long, long, long, long, long, long);
int fork_syscall(long, long, long, long, long, long);
*/
/*
- * xflock should never fall through, the only files we know
- * about are AFS files
- */
-int
-usr_flock(void)
-{
- usr_assert(0);
- return 0;
-}
-
-/*
* ioctl should never fall through, the only files we know
* about are AFS files
*/
}
/* 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;
}
extern void uafs_mount(void);
extern void uafs_setMountDir(const char *dir);
extern int uafs_access(char *path, int amode);
-
+extern int call_syscall(long syscall, long afscall, long param1, long param2,
+ long param3, long param4);
#endif /* __AFS_USROPS_H__ */
#include "afs/afs_args.h"
#include "afsd/afsd.h"
-extern int call_syscall(long, long, long, long, long, long);
void
afsd_mount_afs(const char *rn, const char *mountdir)
* 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_stats.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
{
AFS_STATCNT(afs_unmount);
afs_globalVFS = 0;
- afs_shutdown();
+ afs_shutdown(AFS_WARM);
return 0;
}
#include <arpa/inet.h>
#endif /* AFS_USR_HPUX_ENV */
-#ifdef AFS_USR_LINUX22_ENV
+#ifdef AFS_USR_LINUX_ENV
#include <sys/ioctl.h> /* _IOW() */
#include <sys/uio.h> /* struct iovec */
#include <sys/time.h> /* struct timeval */
#include <netdb.h>
#include <arpa/inet.h>
#define FREAD 0x0001
-#endif /* AFS_USR_LINUX22_ENV */
+#endif /* AFS_USR_LINUX_ENV */
#if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV) || defined(AFS_USR_DFBSD_ENV)
#ifdef _KERNEL
#include <resolv.h>
/* glibc 2.2 has pthread_attr_setstacksize */
-#if (defined(AFS_LINUX22_ENV) && !defined(AFS_USR_LINUX22_ENV)) || (defined(AFS_USR_LINUX22_ENV) && (__GLIBC_MINOR__ < 2))
+#if (defined(AFS_LINUX_ENV) && !defined(AFS_USR_LINUX_ENV)) || (defined(AFS_USR_LINUX_ENV) && (__GLIBC_MINOR__ < 2))
#define pthread_attr_setstacksize(a,b) 0
#endif
#ifdef UKERNEL
-#undef socket
#undef flock
#if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
#define statfs usr_statfs
#define file usr_file
#define dirent usr_dirent
-#define flock usr_flock
#define fid usr_fid
#define sysent usr_sysent
#define ifaddr usr_ifaddr
#define ifnet usr_ifnet
#define in_ifaddr usr_in_ifaddr
-#undef socket
-#define socket usr_socket
#define crget usr_crget
#define crcopy usr_crcopy
#define crhold usr_crhold
struct usr_vnode *b_vp;
};
-struct usr_socket {
- int sock;
- short port;
-};
-
#define NDIRSIZ_LEN(len) \
((sizeof (struct usr_dirent)+4 - (MAXNAMLEN+1)) + (((len)+1 + 3) &~ 3))
struct vcache;
#define afs_ucred_t struct usr_ucred
-#define AFS_FLOCK flock
struct usr_vnodeops {
int (*vn_strategy) (void);
int (*vn_bread) (void);
int (*vn_brelse) (void);
- int (*vn_lockctl) (struct vcache *, struct AFS_FLOCK *, int,
+ int (*vn_lockctl) (struct vcache *, struct usr_flock *, int,
afs_ucred_t *);
int (*vn_fid) (struct vcache *avc, struct fid **);
};
}
-#if defined(AFS_SUN5_ENV) || (defined(AFS_SGI_ENV) && !defined(AFS_SGI65_ENV))
+#if defined(AFS_SUN5_ENV)
int
afs_access(OSI_VC_DECL(avc), afs_int32 amode, int flags,
afs_ucred_t *acred)
attrs->va_atime.tv_nsec = attrs->va_mtime.tv_nsec =
attrs->va_ctime.tv_nsec = 0;
attrs->va_gen = hgetlo(avc->f.m.DataVersion);
-#elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV) || defined(AFS_LINUX26_ENV)
+#elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV) || defined(AFS_LINUX_ENV)
attrs->va_atime.tv_nsec = attrs->va_mtime.tv_nsec =
attrs->va_ctime.tv_nsec =
(hgetlo(avc->f.m.DataVersion) & 0x7ffff) * 1000;
/* If it's the root of AFS, replace the inode number with the
* inode number of the mounted on directory; otherwise this
* confuses getwd()... */
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
if (avc == afs_globalVp) {
struct inode *ip = AFSTOV(avc)->i_sb->s_root->d_inode;
attrs->va_nodeid = ip->i_ino; /* VTOI()? */
# else
vp = vp->v_vfsp->vfs_vnodecovered;
if (vp) { /* Ignore weird failures */
-# ifdef AFS_SGI62_ENV
+# ifdef AFS_SGI_ENV
attrs->va_nodeid = VnodeToIno(vp);
# else
struct inode *ip;
ip = (struct inode *)VTOI(vp);
if (ip) /* Ignore weird failures */
attrs->va_nodeid = ip->i_number;
-# endif /* AFS_SGI62_ENV */
+# endif /* AFS_SGI_ENV */
}
# endif /* AFS_DARWIN80_ENV */
}
-#endif /* AFS_LINUX22_ENV */
+#endif /* AFS_LINUX_ENV */
}
afs_PutUser(au, READ_LOCK);
}
#elif defined(AFS_AIX_ENV)
/* Boy, was this machine dependent bogosity hard to swallow????.... */
if (av->va_mode != -1) {
-#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
+#elif defined(AFS_LINUX_ENV) || defined(UKERNEL)
if (av->va_mask & ATTR_MODE) {
#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
if (av->va_mask & AT_MODE) {
}
#if defined(AFS_DARWIN80_ENV)
if (VATTR_IS_ACTIVE(av, va_gid)) {
-#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
+#elif defined(AFS_LINUX_ENV) || defined(UKERNEL)
if (av->va_mask & ATTR_GID) {
#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
if (av->va_mask & AT_GID) {
}
#if defined(AFS_DARWIN80_ENV)
if (VATTR_IS_ACTIVE(av, va_uid)) {
-#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
+#elif defined(AFS_LINUX_ENV) || defined(UKERNEL)
if (av->va_mask & ATTR_UID) {
#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
if (av->va_mask & AT_UID) {
}
#if defined(AFS_DARWIN80_ENV)
if (VATTR_IS_ACTIVE(av, va_modify_time)) {
-#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
+#elif defined(AFS_LINUX_ENV) || defined(UKERNEL)
if (av->va_mask & ATTR_MTIME) {
#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
if (av->va_mask & AT_MTIME) {
#endif /* AFS_DARWIN80_ENV */
mask |= AFS_SETMODTIME;
#ifndef AFS_SGI_ENV
-# if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_LINUX26_ENV)
+# if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_LINUX_ENV)
if (av->va_mtime.tv_nsec == -1)
# else
if (av->va_mtime.tv_usec == -1)
OSI_VC_CONVERT(avc);
AFS_STATCNT(afs_setattr);
-#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX22_ENV)
+#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX_ENV)
afs_Trace4(afs_iclSetp, CM_TRACE_SETATTR, ICL_TYPE_POINTER, avc,
ICL_TYPE_INT32, attrs->va_mask, ICL_TYPE_OFFSET,
ICL_HANDLE_OFFSET(attrs->va_size), ICL_TYPE_OFFSET,
*/
#if defined(AFS_DARWIN80_ENV)
if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
-#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
+#elif defined(AFS_LINUX_ENV) || defined(UKERNEL)
if (attrs->va_mask & ATTR_SIZE) {
#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
if (attrs->va_mask & AT_SIZE) {
#endif
#if defined(AFS_DARWIN80_ENV)
if (VATTR_IS_ACTIVE(attrs, va_data_size)) {
-#elif defined(AFS_LINUX22_ENV) || defined(UKERNEL)
+#elif defined(AFS_LINUX_ENV) || defined(UKERNEL)
if (attrs->va_mask & ATTR_SIZE) {
#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
if (attrs->va_mask & AT_SIZE) {
} else {
code = afs_TruncateAllSegments(avc, tsize, treq, acred);
}
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
/* We must update the Linux kernel's idea of file size as soon as
* possible, to avoid racing with delayed writepages delivered by
* pdflush */
if (code == 0)
i_size_write(AFSTOV(avc), tsize);
-#endif /* AFS_LINUX26_ENV */
+#endif /* AFS_LINUX_ENV */
#if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
vnode_pager_setsize(vp, (u_long) tsize);
#endif
* I think we can get away without it, but I'm not sure. Note that
* afs_setattr is called in here for truncation.
*/
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
int
afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, int flags,
int amode, struct vcache **avcp, afs_ucred_t *acred)
-#else /* AFS_SGI64_ENV */
+#else /* AFS_SGI_ENV */
int
afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
enum vcexcl aexcl, int amode, struct vcache **avcp,
afs_ucred_t *acred)
-#endif /* AFS_SGI64_ENV */
+#endif /* AFS_SGI_ENV */
{
afs_int32 origCBs, origZaps, finalZaps;
struct vrequest *treq = NULL;
afs_InitFakeStat(&fakestate);
-#ifdef AFS_SGI65_ENV
+#ifdef AFS_SGI_ENV
/* If avcp is passed not null, it's the old reference to this file.
* We can use this to avoid create races. For now, just decrement
* the reference count on it.
ReleaseSharedLock(&tdc->lock);
afs_PutDCache(tdc);
ReleaseWriteLock(&adp->lock);
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
if (flags & VEXCL) {
#else
if (aexcl != NONEXCL) {
ObtainWriteLock(&tvc->lock, 136);
tvc->f.states |= CCreating;
ReleaseWriteLock(&tvc->lock);
-#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
-#if defined(AFS_SGI64_ENV)
+#if defined(AFS_SGI_ENV)
code =
afs_setattr(VNODE_TO_FIRST_BHV((vnode_t *) tvc),
attrs, 0, acred);
-#else
+#elif defined(AFS_SUN5_ENV)
code = afs_setattr(tvc, attrs, 0, acred);
-#endif /* AFS_SGI64_ENV */
-#else /* SUN5 || SGI */
+#else
code = afs_setattr(tvc, attrs, acred);
-#endif /* SUN5 || SGI */
+#endif
ObtainWriteLock(&tvc->lock, 137);
tvc->f.states &= ~CCreating;
ReleaseWriteLock(&tvc->lock);
SHARED_LOCK, NULL));
if ((code == EEXIST || code == UAEEXIST) &&
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
!(flags & VEXCL)
-#else /* AFS_SGI64_ENV */
+#else /* AFS_SGI_ENV */
aexcl == NONEXCL
#endif
) {
ReleaseWriteLock(&adp->lock);
-#if defined(AFS_SGI64_ENV)
+#if defined(AFS_SGI_ENV)
code = afs_lookup(VNODE_TO_FIRST_BHV((vnode_t *) adp), aname, avcp,
NULL, 0, NULL, acred);
-#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
+#elif defined(AFS_SUN5_ENV)
code = afs_lookup(adp, aname, avcp, NULL, 0, NULL, acred);
#elif defined(UKERNEL)
code = afs_lookup(adp, aname, avcp, acred, 0);
* freeing of the vnode will change evenZaps. Don't need to update the VLRU
* queue, since the find will only succeed in the event of a create race, and
* then the vcache will be at the front of the VLRU queue anyway... */
- if (!(tvc = afs_FindVCache(&newFid, 0, DO_STATS))) {
+ if (!(tvc = afs_FindVCache(&newFid, DO_STATS))) {
tvc = afs_NewVCache(&newFid, hostp);
if (tvc) {
int finalCBs;
afs_LookupVCache(&unlinkFid, treq, adp, aname);
} else {
ObtainReadLock(&afs_xvcache);
- tvc = afs_FindVCache(&unlinkFid, 0, 1 /* do xstats */ );
+ tvc = afs_FindVCache(&unlinkFid, DO_STATS);
ReleaseReadLock(&afs_xvcache);
}
}
code = afs_dir_Lookup(tdc, aname, &tfid.Fid);
ObtainSharedLock(&afs_xvcache, 764);
- tvc = afs_FindVCache(&tfid, 0, 1 /* do xstats */ );
+ tvc = afs_FindVCache(&tfid, DO_STATS);
ReleaseSharedLock(&afs_xvcache);
if (!tvc) {
#include "afs/param.h"
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_OBSD_ENV) && !defined(AFS_NBSD_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_OBSD_ENV) && !defined(AFS_NBSD_ENV)
#include "afs/sysincludes.h" /* Standard vendor system headers */
#include "afsincludes.h" /* Afs-based standard headers */
#include "afs/afs_stats.h" /* statistics */
if (avc->f.fid.Fid.Unique > 0xffffff)
afs_fid_uniqueoverflow++;
} else {
-#if defined(AFS_SUN5_64BIT_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR == 64))
+#if defined(AFS_SUN5_64BIT_ENV) || (defined(AFS_SGI_ENV) && (_MIPS_SZPTR == 64))
addr[1] = (long)AFS_XLATOR_MAGIC << 48;
-#else /* defined(AFS_SGI61_ENV) && (_MIPS_SZPTR == 64) */
+#else /* defined(AFS_SGI_ENV) && (_MIPS_SZPTR == 64) */
addr[1] = AFS_XLATOR_MAGIC;
SizeOfSmallFid = sizeof(addr);
-#endif /* defined(AFS_SGI61_ENV) && (_MIPS_SZPTR == 64) */
+#endif /* defined(AFS_SGI_ENV) && (_MIPS_SZPTR == 64) */
addr[0] = (long)avc;
#ifndef AFS_AIX41_ENV
/* No post processing, so don't hold ref count. */
}
-#endif /* !AFS_LINUX20_ENV */
+#endif /* !AFS_LINUX_ENV */
void
lockIdSet(struct AFS_FLOCK *flock, struct SimpleLocks *slp, int clid)
{
-# if defined(AFS_SGI65_ENV)
flid_t flid;
get_current_flid(&flid);
-# else
- afs_proc_t *procp = OSI_GET_CURRENT_PROCP();
-# endif
if (slp) {
-# ifdef AFS_SGI65_ENV
slp->sysid = flid.fl_sysid;
-# else
- slp->sysid = OSI_GET_CURRENT_SYSID();
-# endif
slp->pid = clid;
} else {
-# ifdef AFS_SGI65_ENV
flock->l_sysid = flid.fl_sysid;
-# else
- flock->l_sysid = OSI_GET_CURRENT_SYSID();
-# endif
flock->l_pid = clid;
}
}
flock->l_pid = clid;
}
}
-#elif defined(AFS_LINUX20_ENV) || defined(AFS_HPUX_ENV)
+#elif defined(AFS_LINUX_ENV) || defined(AFS_HPUX_ENV)
void
lockIdSet(struct AFS_FLOCK *flock, struct SimpleLocks *slp, int clid)
{
#if defined(AFS_SUN5_ENV)
proc_t *procp = ttoproc(curthread);
#else
-#if !defined(AFS_AIX41_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_SGI65_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
-#ifdef AFS_SGI64_ENV
- afs_proc_t *procp = curprocp;
-#elif defined(UKERNEL)
+#if !defined(AFS_AIX41_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
+#if defined(UKERNEL)
afs_proc_t *procp = get_user_struct()->u_procp;
#else
afs_proc_t *procp = u.u_procp;
-#endif /* AFS_SGI64_ENV */
+#endif /* UKERNEL */
#endif
#endif
}
#endif
if ((flock1->l_pid == alp->pid) ||
-#if defined(AFS_AIX41_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_HPUX_ENV)
+#if defined(AFS_AIX41_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_HPUX_ENV)
(!onlymine && (flock1->l_pid == getppid()))
#else
-#if defined(AFS_SGI65_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
/* XXX check this. used to be *only* irix for some reason. */
(!onlymine && (flock1->l_pid == clid))
#else
lastWarnTime = avc->lastBRLWarnTime = now;
lastWarnPid = pid;
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
message = "byte-range locks only enforced for processes on this machine";
#else
message = "byte-range lock/unlock ignored; make sure no one else is running this program";
}
if (tvc->mvid.target_root && (tvc->f.states & CMValid)) {
if (!canblock) {
- afs_int32 retry;
-
- do {
- retry = 0;
- ObtainReadLock(&afs_xvcache);
- root_vp = afs_FindVCache(tvc->mvid.target_root, &retry, 0);
- if (root_vp && retry) {
- ReleaseReadLock(&afs_xvcache);
- afs_PutVCache(root_vp);
- }
- } while (root_vp && retry);
+ ObtainReadLock(&afs_xvcache);
+ root_vp = afs_FindVCache(tvc->mvid.target_root, 0);
ReleaseReadLock(&afs_xvcache);
} else {
root_vp = afs_GetVCache(tvc->mvid.target_root, areq);
static int
afs_getsysname(struct vrequest *areq, struct vcache *adp,
- char *bufp, int *num, char **sysnamelist[])
+ char *bufp, size_t bufsize, int *num, char **sysnamelist[])
{
- struct unixuser *au;
- afs_int32 error;
+ struct unixuser *au = NULL;
+ afs_int32 error, code = -1;
+ size_t rlen;
AFS_STATCNT(getsysname);
*sysnamelist = afs_sysnamelist;
- if (!afs_nfsexporter)
- strcpy(bufp, (*sysnamelist)[0]);
- else {
+ if (!afs_nfsexporter) {
+ rlen = strlcpy(bufp, (*sysnamelist)[0], bufsize);
+ if (rlen >= bufsize)
+ goto done;
+ } else {
au = afs_GetUser(areq->uid, adp->f.fid.Cell, READ_LOCK);
if (au->exporter) {
error = EXP_SYSNAME(au->exporter, (char *)0, sysnamelist, num, 0);
if (error) {
- strcpy(bufp, "@sys");
- afs_PutUser(au, READ_LOCK);
- return -1;
+ strlcpy(bufp, "@sys", bufsize);
+ goto done;
} else {
- strcpy(bufp, (*sysnamelist)[0]);
+ rlen = strlcpy(bufp, (*sysnamelist)[0], bufsize);
+ if (rlen >= bufsize)
+ goto done;
}
- } else
- strcpy(bufp, afs_sysname);
- afs_PutUser(au, READ_LOCK);
+ } else {
+ rlen = strlcpy(bufp, afs_sysname, bufsize);
+ if (rlen >= bufsize)
+ goto done;
+ }
}
- return 0;
+ code = 0;
+ done:
+ if (au != NULL)
+ afs_PutUser(au, READ_LOCK);
+ return code;
}
void
if (AFS_EQ_ATSYS(aname)) {
state->offset = 0;
- state->name = osi_AllocLargeSpace(MAXSYSNAME);
- state->allocked = 1;
+ state->name_size = MAXSYSNAME;
+ state->name = osi_AllocLargeSpace(state->name_size);
state->index =
- afs_getsysname(areq, avc, state->name, &num, sysnamelist);
+ afs_getsysname(areq, avc, state->name, state->name_size, &num,
+ sysnamelist);
} else {
state->offset = -1;
- state->allocked = 0;
+ state->name_size = 0;
state->index = 0;
state->name = (char *)aname;
}
struct sysname_info *state)
{
int num = afs_sysnamecount;
- char **sysnamelist[MAXNUMSYSNAMES];
+ char **sysnamelist[MAXNUMSYSNAMES], *buf;
+ size_t bsz;
if (state->index == -1)
return 0; /* No list */
/* Check for the initial state of aname != "@sys" in Check_AtSys */
- if (state->offset == -1 && state->allocked == 0) {
+ if (state->offset == -1 && state->name_size == 0) {
char *tname;
/* Check for .*@sys */
/*Move to the end of the string */ ;
if ((tname > state->name + 4) && (AFS_EQ_ATSYS(tname - 4))) {
- state->offset = (tname - 4) - state->name;
- tname = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
- strncpy(tname, state->name, state->offset);
- state->name = tname;
- state->allocked = 1;
+ int idx;
+ size_t len, bufsize = AFS_LRALLOCSIZ;
+
+ len = (tname - 4) - state->name;
+ if (len >= bufsize) {
+ return 0;
+ }
+
+ tname = osi_AllocLargeSpace(bufsize);
+ /* intentionally truncating state->name */
+ strlcpy(tname, state->name, len + 1);
+
+ buf = tname + len;
+ bsz = bufsize - len;
num = 0;
- state->index =
- afs_getsysname(areq, avc, state->name + state->offset, &num,
- sysnamelist);
+ idx = afs_getsysname(areq, avc, buf, bsz, &num, sysnamelist);
+ if (idx == -1) {
+ osi_FreeLargeSpace(tname);
+ return 0;
+ }
+ /*
+ * If we got here, state->name isn't pointing to any dynamically
+ * allocated memory. In other words, state->name_size must be 0.
+ */
+ state->name = tname;
+ state->offset = len;
+ state->name_size = bufsize;
+ state->index = idx;
+
return 1;
} else
return 0; /* .*@sys doesn't match either */
if (++(state->index) >= num || !(*sysnamelist)[(unsigned int)state->index])
return 0; /* end of list */
}
- strcpy(state->name + state->offset, (*sysnamelist)[(unsigned int)state->index]);
+ /*
+ * If we got here, state->name was allocated by the AtSys iterator. In other
+ * words, state->name_size must be greater than 0.
+ */
+ buf = state->name + state->offset;
+ bsz = state->name_size - state->offset;
+ if (strlcpy(buf, (*sysnamelist)[(unsigned int)state->index], bsz) >= bsz) {
+ state->index = -1;
+ return 0;
+ }
return 1;
}
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
int i;
struct VenusFid afid; /* file ID we are using now */
struct VenusFid tfid; /* another temp. file ID */
- afs_int32 retry; /* handle low-level SGI MP race conditions */
+ afs_int32 retry; /* handle low-level VFS race conditions */
long volStates; /* flags from vol structure */
struct volume *volp = 0; /* volume ptr */
struct VenusFid dotdot = {0, {0, 0, 0}};
tfid.Fid.Volume = adp->f.fid.Fid.Volume;
tfid.Fid.Vnode = ntohl(dirEntryp->fid.vnode);
tfid.Fid.Unique = ntohl(dirEntryp->fid.vunique);
- do {
- retry = 0;
- ObtainSharedLock(&afs_xvcache, 130);
- tvcp = afs_FindVCache(&tfid, &retry, IS_SLOCK /* no stats | LRU */ );
- if (tvcp && retry) {
- ReleaseSharedLock(&afs_xvcache);
- afs_PutVCache(tvcp);
- }
- } while (tvcp && retry);
+ ObtainSharedLock(&afs_xvcache, 130);
+ tvcp = afs_FindVCache(&tfid, IS_SLOCK /* no stats | LRU */ );
if (!tvcp) { /* otherwise, create manually */
UpgradeSToWLock(&afs_xvcache, 129);
tvcp = afs_NewBulkVCache(&tfid, hostp, statSeqNo);
afid.Fid.Vnode = fidsp[i].Vnode;
afid.Fid.Unique = fidsp[i].Unique;
- do {
- retry = 0;
- ObtainReadLock(&afs_xvcache);
- tvcp = afs_FindVCache(&afid, &retry, 0 /* !stats&!lru */);
- ReleaseReadLock(&afs_xvcache);
- } while (tvcp && retry);
+ ObtainReadLock(&afs_xvcache);
+ tvcp = afs_FindVCache(&afid, 0 /* !stats&!lru */);
+ ReleaseReadLock(&afs_xvcache);
if (!tvcp) {
continue;
afid.Fid.Volume = adp->f.fid.Fid.Volume;
afid.Fid.Vnode = fidsp[i].Vnode;
afid.Fid.Unique = fidsp[i].Unique;
- do {
- retry = 0;
- ObtainReadLock(&afs_xvcache);
- tvcp = afs_FindVCache(&afid, &retry, 0/* !stats&!lru */);
- ReleaseReadLock(&afs_xvcache);
- } while (tvcp && retry);
+
+ ObtainReadLock(&afs_xvcache);
+ tvcp = afs_FindVCache(&afid, 0/* !stats&!lru */);
+ ReleaseReadLock(&afs_xvcache);
/* The entry may no longer exist */
if (tvcp == NULL) {
* We only do this if the entry looks clear.
*/
afs_ProcessFS(tvcp, &statsp[i], areqp);
-#if defined(AFS_LINUX22_ENV)
+#if defined(AFS_LINUX_ENV)
afs_fill_inode(AFSTOV(tvcp), NULL); /* reset inode operations */
#endif
afid.Fid.Volume = adp->f.fid.Fid.Volume;
afid.Fid.Vnode = fidsp[i].Vnode;
afid.Fid.Unique = fidsp[i].Unique;
- do {
- retry = 0;
- ObtainReadLock(&afs_xvcache);
- tvcp = afs_FindVCache(&afid, &retry, 0 /* !stats&!lru */);
- ReleaseReadLock(&afs_xvcache);
- } while (tvcp && retry);
+
+ ObtainReadLock(&afs_xvcache);
+ tvcp = afs_FindVCache(&afid, 0 /* !stats&!lru */);
+ ReleaseReadLock(&afs_xvcache);
if (tvcp != NULL) {
if ((tvcp->f.states & CBulkFetching)
&& (tvcp->f.m.Length == statSeqNo)) {
goto done;
}
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
/*
* Special case of the dynamic mount volume in a static root.
* This is really unfortunate, but we need this for the translator.
code = EACCES;
goto done;
}
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
if (tvc->mvstat == AFS_MVSTAT_ROOT) { /* we don't trust the dnlc for root vcaches */
AFS_RELE(AFSTOV(tvc));
*avcp = 0;
hit = 1;
goto done;
}
-#else /* non - LINUX */
+#else
code = 0;
hit = 1;
goto done;
-#endif /* linux22 */
+#endif /* AFS_LINUX_ENV */
}
{ /* sub-block just to reduce stack usage */
* dirCookie tells us where to start prefetching from.
*/
if (afs_ShouldTryBulkStat(adp)) {
- afs_int32 retry;
/* if the entry is not in the cache, or is in the cache,
* but hasn't been statd, then do a bulk stat operation.
*/
- do {
- retry = 0;
- ObtainReadLock(&afs_xvcache);
- tvc = afs_FindVCache(&tfid, &retry, 0 /* !stats,!lru */ );
- ReleaseReadLock(&afs_xvcache);
- } while (tvc && retry);
+ ObtainReadLock(&afs_xvcache);
+ tvc = afs_FindVCache(&tfid, 0 /* !stats,!lru */ );
+ ReleaseReadLock(&afs_xvcache);
if (!tvc || !(tvc->f.states & CStatd))
bulkcode = afs_DoBulkStat(adp, dirCookie, treq);
if (!hit && (force_eval || tvc->mvstat != AFS_MVSTAT_MTPT)) {
osi_dnlc_enter(adp, aname, tvc, &versionNo);
} else {
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
/* So Linux inode cache is up to date. */
code = afs_VerifyVCache(tvc, treq);
#else
* both called by the vn_open call.
*/
int
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
afs_open(bhv_desc_t * bhv, struct vcache **avcp, afs_int32 aflags,
afs_ucred_t *acred)
#else
AFS_STATCNT(afs_open);
if ((code = afs_CreateReq(&treq, acred)))
return code;
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
/* avcpp can be, but is not necesarily, bhp's vnode. */
tvc = VTOAFS(BHV_TO_VNODE(bhv));
#else
if (writing)
tvc->execsOrWriters++;
tvc->opens++;
-#if defined(AFS_SGI_ENV) || defined (AFS_LINUX26_ENV)
+#if defined(AFS_SGI_ENV) || defined (AFS_LINUX_ENV) || defined(AFS_FBSD_ENV)
if (writing && tvc->cred == NULL) {
crhold(acred);
tvc->cred = acred;
int noLock)
{
afs_size_t totalLength;
- afs_size_t transferLength;
afs_size_t filePos;
afs_size_t offset, tlen;
afs_size_t len = 0;
totalLength, ICL_TYPE_OFFSET,
ICL_HANDLE_OFFSET(avc->f.m.Length));
error = 0;
- transferLength = 0;
if (!noLock)
ObtainReadLock(&avc->lock);
#if defined(AFS_TEXT_ENV) && !defined(AFS_VM_RDWR_ENV)
trimlen = len;
afsio_skip(auio, trimlen); /* update input uio structure */
totalLength -= len;
- transferLength += len;
filePos += len;
if (len <= 0)
AFS_GUNLOCK();
code = VOP_RDWR(tfile->vnode, tuiop, UIO_READ, 0, afs_osi_credp);
AFS_GLOCK();
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
AFS_GUNLOCK();
code = osi_rdwr(tfile, tuiop, UIO_READ);
AFS_GLOCK();
}
-#if !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_LINUX_ENV)
/* Changes to afs_readdir which affect dcache or vcache handling or use of
* bulk stat data should also be reflected in the Linux specific verison of
* the readdir routine.
afs_int32 d_off;
u_short d_reclen;
};
-#ifdef AFS_SGI62_ENV
#define AFS_DIRENT32BASESIZE IRIX5_DIRENTBASESIZE
#define AFS_DIRENT64BASESIZE DIRENT64BASESIZE
#else
-#define AFS_DIRENT32BASESIZE IRIX5_DIRENTBASESIZE
-#define AFS_DIRENT64BASESIZE DIRENTBASESIZE
-#endif /* AFS_SGI62_ENV */
-#else
struct min_direct { /* miniature direct structure */
/* If struct direct changes, this must too */
#if defined(AFS_DARWIN80_ENV)
uint16_t d_reclen; /* length of this record */
uint16_t d_namlen; /* length of string in d_name */
uint8_t d_type; /* file type, see below */
+#elif defined(AFS_FBSD120_ENV)
+ /* FreeBSD 12.0 moved to 64-bit inodes and bumped d_namlen to 16 bits. */
+ ino_t d_fileno;
+ off_t d_off;
+ u_short d_reclen;
+ u_char d_type;
+ u_char d_pad0;
+ u_short d_namlen;
+ u_short d_pad1;
#elif defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
afs_uint32 d_fileno;
u_short d_reclen;
#define DIRSIZ_LEN(len) \
((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((len)+1 + 3) &~ 3))
#else
-#if defined(AFS_SGI_ENV)
-#ifndef AFS_SGI53_ENV
-/* SGI 5.3 and later use 32/64 bit versions of directory size. */
-#define DIRSIZ_LEN(len) DIRENTSIZE(len)
-#endif
-#else /* AFS_SGI_ENV */
+#ifndef AFS_SGI_ENV
#define DIRSIZ_LEN(len) \
((sizeof (struct direct) - (MAXNAMLEN+1)) + (((len)+1 + 3) &~ 3))
#endif /* AFS_SGI_ENV */
return DT_DIR;
}
ObtainReadLock(&afs_xvcache);
- if ((tvc = afs_FindVCache(&tfid, 0, 0))) {
+ if ((tvc = afs_FindVCache(&tfid, 0))) {
ReleaseReadLock(&afs_xvcache);
if (tvc->mvstat != AFS_MVSTAT_FILE) {
afs_PutVCache(tvc);
#endif
char bufofzeros[64]; /* gotta fill with something */
-#ifdef AFS_SGI65_ENV
+#ifdef AFS_SGI_ENV
int
afs_readdir_move(struct DirEntry *de, struct vcache *vc, struct uio *auio,
int slen, ssize_t rlen, afs_size_t off)
struct dirent *direntp;
#endif
#endif /* AFS_SUN5_ENV */
-#ifndef AFS_SGI53_ENV
+#ifndef AFS_SGI_ENV
struct min_direct sdirEntry;
-#endif /* AFS_SGI53_ENV */
+ memset(&sdirEntry, 0, sizeof(sdirEntry));
+#endif /* AFS_SGI_ENV */
AFS_STATCNT(afs_readdir_move);
}
#endif
-#ifdef AFS_SGI53_ENV
+#ifdef AFS_SGI_ENV
{
afs_int32 use64BitDirent;
-#ifdef AFS_SGI61_ENV
-#ifdef AFS_SGI62_ENV
use64BitDirent =
ABI_IS(ABI_IRIX5_64, GETDENTS_ABI(OSI_GET_CURRENT_ABI(), auio));
-#else
- use64BitDirent =
- (auio->uio_segflg !=
- UIO_USERSPACE) ? ABI_IRIX5_64 : (ABI_IS(ABI_IRIX5_64 |
- ABI_IRIX5_N32,
- u.u_procp->p_abi));
-#endif
-#else /* AFS_SGI61_ENV */
- use64BitDirent =
- (auio->uio_segflg !=
- UIO_USERSPACE) ? ABI_IRIX5_64 : (ABI_IS(ABI_IRIX5_64,
- u.u_procp->p_abi));
-#endif /* AFS_SGI61_ENV */
if (use64BitDirent) {
struct min_dirent sdirEntry;
}
}
}
-#else /* AFS_SGI53_ENV */
+#else /* AFS_SGI_ENV */
#if defined(AFS_SUN5_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
direntp = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
direntp->d_ino = afs_calc_inum(vc->f.fid.Cell, Volume, ntohl(Vnode));
}
#endif
#endif /* AFS_SUN5_ENV */
-#endif /* AFS_SGI53_ENV */
+#endif /* AFS_SGI_ENV */
return (code);
}
int o_slen = 0, n_slen = 0;
afs_int32 us;
struct afs_fakestat_state fakestate;
-#if defined(AFS_SGI53_ENV)
+#if defined(AFS_SGI_ENV)
afs_int32 use64BitDirent, dirsiz;
-#endif /* defined(AFS_SGI53_ENV) */
+#endif /* defined(AFS_SGI_ENV) */
#ifndef AFS_HPUX_ENV
OSI_VC_CONVERT(avc);
#else
memset(&oldEntry, 0, sizeof(struct DirBuffer));
memset(&nextEntry, 0, sizeof(struct DirBuffer));
-#if defined(AFS_SGI53_ENV)
-#ifdef AFS_SGI61_ENV
-#ifdef AFS_SGI62_ENV
+#if defined(AFS_SGI_ENV)
use64BitDirent =
ABI_IS(ABI_IRIX5_64, GETDENTS_ABI(OSI_GET_CURRENT_ABI(), auio));
-#else
- use64BitDirent =
- (auio->uio_segflg !=
- UIO_USERSPACE) ? ABI_IRIX5_64 : (ABI_IS(ABI_IRIX5_64 | ABI_IRIX5_N32,
- u.u_procp->p_abi));
-#endif /* AFS_SGI62_ENV */
-#else /* AFS_SGI61_ENV */
- use64BitDirent =
- (auio->uio_segflg !=
- UIO_USERSPACE) ? ABI_IRIX5_64 : (ABI_IS(ABI_IRIX5_64,
- u.u_procp->p_abi));
-#endif /* AFS_SGI61_ENV */
-#endif /* defined(AFS_SGI53_ENV) */
+#endif /* defined(AFS_SGI_ENV) */
#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
/* Not really used by the callee so we ignore it for now */
#else
n_slen = strlen(nde->name);
#endif
-#ifdef AFS_SGI53_ENV
+#ifdef AFS_SGI_ENV
dirsiz =
use64BitDirent ? DIRENTSIZE(n_slen) : IRIX5_DIRENTSIZE(n_slen);
if (dirsiz >= (AFS_UIO_RESID(auio) - len)) {
#else
if (DIRSIZ_LEN(n_slen) >= (AFS_UIO_RESID(auio) - len)) {
-#endif /* AFS_SGI53_ENV */
+#endif /* AFS_SGI_ENV */
/* No can do no more now; ya know... at this time */
DRelease(&nextEntry, 0); /* can't use this one. */
if (len) {
code = afs_readdir_move(ode, avc, auio, o_slen, len, origOffset);
#endif /* AFS_HPUX_ENV */
}
-#ifdef AFS_SGI53_ENV
+#ifdef AFS_SGI_ENV
len = use64BitDirent ? DIRENTSIZE(o_slen =
n_slen) : IRIX5_DIRENTSIZE(o_slen =
n_slen);
#else
len = DIRSIZ_LEN(o_slen = n_slen);
-#endif /* AFS_SGI53_ENV */
+#endif /* AFS_SGI_ENV */
DRelease(&oldEntry, 0);
oldEntry = nextEntry;
return code;
}
-#endif /* !AFS_LINUX20_ENV */
+#endif /* !AFS_LINUX_ENV */
aname);
} else {
ObtainReadLock(&afs_xvcache);
- tvc = afs_FindVCache(&unlinkFid, 0, DO_STATS);
+ tvc = afs_FindVCache(&unlinkFid, DO_STATS);
ReleaseReadLock(&afs_xvcache);
}
}
fileFid.Cell = aodp->f.fid.Cell;
fileFid.Fid.Volume = aodp->f.fid.Fid.Volume;
ObtainSharedLock(&afs_xvcache, 754);
- tvc = afs_FindVCache(&fileFid, 0 , 1);
+ tvc = afs_FindVCache(&fileFid, DO_STATS);
ReleaseSharedLock(&afs_xvcache);
if (tvc) {
#include "afs/param.h"
-#if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV)
+#if !defined(AFS_HPUX_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN80_ENV)
#include "afs/sysincludes.h" /* Standard vendor system headers */
#include "afsincludes.h" /* Afs-based standard headers */
return code;
}
-#endif /* !AFS_HPUX_ENV && !AFS_SGI_ENV && !AFS_LINUX20_ENV */
+#endif /* !AFS_HPUX_ENV && !AFS_SGI_ENV && !AFS_LINUX_ENV */
if (!tvc->linkData) {
tvc->linkData = afs_osi_Alloc(alen);
osi_Assert(tvc->linkData != NULL);
- strncpy(tvc->linkData, atargetName, alen - 1);
+ memcpy(tvc->linkData, atargetName, alen - 1);
tvc->linkData[alen - 1] = 0;
}
ReleaseWriteLock(&tvc->lock);
code = VOP_RDWR(tfile->vnode, tuiop, UIO_WRITE, 0, afs_osi_credp);
AFS_GLOCK();
}
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
AFS_GUNLOCK();
code = osi_rdwr(tfile, tuiop, UIO_WRITE);
AFS_GLOCK();
afs_ucred_t *acred, int noLock)
{
afs_size_t totalLength;
- afs_size_t transferLength;
afs_size_t filePos;
afs_size_t offset, len;
afs_int32 tlen;
totalLength = AFS_UIO_RESID(auio);
filePos = AFS_UIO_OFFSET(auio);
error = 0;
- transferLength = 0;
afs_Trace4(afs_iclSetp, CM_TRACE_WRITE, ICL_TYPE_POINTER, avc,
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), ICL_TYPE_OFFSET,
ICL_HANDLE_OFFSET(totalLength), ICL_TYPE_OFFSET,
tdc->validPos = filePos + len;
}
totalLength -= len;
- transferLength += len;
filePos += len;
#if defined(AFS_SGI_ENV)
/* afs_xwrite handles setting m.Length */
afs_DoPartialWrite(struct vcache *avc, struct vrequest *areq)
{
afs_int32 code;
+ int sync;
if (afs_stats_cmperf.cacheCurrDirtyChunks <=
afs_stats_cmperf.cacheMaxDirtyChunks
afs_Trace2(afs_iclSetp, CM_TRACE_PARTIALWRITE, ICL_TYPE_POINTER, avc,
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length));
+ sync = AFS_ASYNC;
#if defined(AFS_SUN5_ENV)
- code = afs_StoreAllSegments(avc, areq, AFS_ASYNC | AFS_VMSYNC_INVAL);
-#else
- code = afs_StoreAllSegments(avc, areq, AFS_ASYNC);
+ sync |= AFS_VMSYNC_INVAL;
+#elif defined(AFS_FBSD_ENV)
+ sync |= AFS_NOVMSYNC;
#endif
+ code = afs_StoreAllSegments(avc, areq, sync);
return code;
}
+#ifdef AFS_FBSD_ENV
+static int bkg_store_disabled = 1;
+#else
+static int bkg_store_disabled = 0;
+#endif
+
/* handle any closing cleanup stuff */
int
-#if defined(AFS_SGI65_ENV)
+#if defined(AFS_SGI_ENV)
afs_close(OSI_VC_DECL(avc), afs_int32 aflags, lastclose_t lastclose,
afs_ucred_t *acred)
-#elif defined(AFS_SGI64_ENV)
-afs_close(OSI_VC_DECL(avc), afs_int32 aflags, lastclose_t lastclose,
- off_t offset, afs_ucred_t *acred, struct flid *flp)
-#elif defined(AFS_SGI_ENV)
-afs_close(OSI_VC_DECL(avc), afs_int32 aflags, lastclose_t lastclose
- off_t offset, afs_ucred_t *acred)
#elif defined(AFS_SUN5_ENV)
afs_close(OSI_VC_DECL(avc), afs_int32 aflags, int count, offset_t offset,
afs_ucred_t *acred)
afs_int32 code_checkcode = 0;
struct brequest *tb;
struct vrequest *treq = NULL;
-#ifdef AFS_SGI65_ENV
+#ifdef AFS_SGI_ENV
struct flid flid;
#endif
struct afs_fakestat_state fakestat;
}
/* unlock any locks for pid - could be wrong for child .. */
AFS_RWLOCK((vnode_t *) avc, VRWLOCK_WRITE);
-# ifdef AFS_SGI65_ENV
get_current_flid(&flid);
cleanlocks((vnode_t *) avc, flid.fl_pid, flid.fl_sysid);
HandleFlock(avc, LOCK_UN, treq, flid.fl_pid, 1 /*onlymine */ );
-# else
-# ifdef AFS_SGI64_ENV
- cleanlocks((vnode_t *) avc, flp);
-# else /* AFS_SGI64_ENV */
- cleanlocks((vnode_t *) avc, u.u_procp->p_epid, u.u_procp->p_sysid);
-# endif /* AFS_SGI64_ENV */
- HandleFlock(avc, LOCK_UN, treq, OSI_GET_CURRENT_PID(), 1 /*onlymine */ );
-# endif /* AFS_SGI65_ENV */
/* afs_chkpgoob will drop and re-acquire the global lock. */
afs_chkpgoob(&avc->v, btoc(avc->f.m.Length));
#elif defined(AFS_SUN5_ENV)
}
#endif
if (aflags & (FWRITE | FTRUNC)) {
- if (afs_BBusy() || (AFS_NFSXLATORREQ(acred)) || AFS_IS_DISCONNECTED) {
+ if (bkg_store_disabled || afs_BBusy() || (AFS_NFSXLATORREQ(acred)) || AFS_IS_DISCONNECTED) {
/* do it yourself if daemons are all busy */
ObtainWriteLock(&avc->lock, 124);
code = afs_StoreOnLastReference(avc, treq);
int
#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)
afs_fsync(OSI_VC_DECL(avc), int flag, afs_ucred_t *acred
-# ifdef AFS_SGI65_ENV
+# ifdef AFS_SGI_ENV
, off_t start, off_t stop
-# endif /* AFS_SGI65_ENV */
+# endif /* AFS_SGI_ENV */
)
#else /* !SUN5 && !SGI */
afs_fsync(OSI_VC_DECL(avc), afs_ucred_t *acred)
/*
* AFS system call opcodes
*/
-#ifdef KDUMP_KERNEL
-#include <afs/afs_args.h>
-#include <afs/afs_consts.h>
-#else
#include "afs/afs_args.h"
#include "afs/afs_consts.h"
-#endif
-
-/* jhash.h is a standalone header and is fine to pull into kernel code. */
-#include <opr/jhash.h>
/*
* afs_fsfragsize cannot be less than 1023, or some cache-tracking
#define AFS_VFS_FAKEFREE (2147483647)
/* Moved from VNOPS/afs_vnop_flocks so can be used in prototypes */
-#if defined(AFS_HPUX102_ENV)
-#define AFS_FLOCK k_flock
-#else
-#if defined(AFS_SUN5_ENV) || (defined(AFS_LINUX24_ENV) && !(defined(AFS_LINUX26_ENV) && defined(AFS_LINUX_64BIT_KERNEL)))
-#define AFS_FLOCK flock64
+#if defined(UKERNEL)
+# define AFS_FLOCK usr_flock
+#elif defined(AFS_HPUX102_ENV)
+# define AFS_FLOCK k_flock
+#elif defined(AFS_SUN5_ENV) || (defined(AFS_LINUX_ENV) && !defined(AFS_LINUX_64BIT_KERNEL))
+# define AFS_FLOCK flock64
#else
-#define AFS_FLOCK flock
-#endif /* AFS_SUN65_ENV */
-#endif /* AFS_HPUX102_ENV */
+# define AFS_FLOCK flock
+#endif /* UKERNEL */
/* The following are various levels of afs debugging */
#define AFSDEB_GENERAL 1 /* Standard debugging */
/* The basic defines for the Andrew file system
better keep things powers of two so "& (foo-1)" hack works for masking bits */
#define NBRS 15 /* max number of queued daemon requests */
-#define NUSERS 16 /* hash table size for unixuser table */
+#define NUSERS 2048 /* hash table size for unixuser table */
#define NSERVERS 16 /* hash table size for server table */
#define NVOLS 64 /* hash table size for volume table */
#define NFENTRIES 256 /* hash table size for disk volume table */
#define VCSIZEBITS 16 /* log of stat cache hash table size */
-#define VCSIZE (opr_jhash_size(VCSIZEBITS))
#define CBRSIZE 512 /* call back returns hash table size */
#define PIGGYSIZE 1350 /* max piggyback size */
#define MAXVOLS 128 /* max vols we can store */
struct sysname_info {
char *name;
+ /*
+ * 'name_size' represents the number of bytes allocated in 'name'. If 0,
+ * 'name' points to existing memory, and shouldn't be freed.
+ */
+ size_t name_size;
short offset;
- signed char index, allocked;
+ signed char index;
};
/* flags to use with AFSOP_CACHEINIT */
#define AFSCALL_INIT_MEMCACHE 0x1 /* use a memory-based cache */
+struct dcache;
+
/* below here used only for kernel procedures */
#ifdef KERNEL
+
+#include <opr/jhash.h>
+
+#define VCSIZE (opr_jhash_size(VCSIZEBITS))
+
/* Store synchrony flags - SYNC means that data should be forced to server's
* disk immediately upon completion. */
#define AFS_ASYNC 0
#define AFS_VMSYNC_INVAL 2 /* sync and invalidate pages */
#define AFS_LASTSTORE 4
#define AFS_VMSYNC 8 /* sync pages but do not invalidate */
+#define AFS_NOVMSYNC 16 /* force skipping syncing vm pages; just write afs dcache data */
/* background request structure */
#define BPARMS 4
struct AFSFid fid;
};
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
/* On Linux, we have to be able to allocate the storage for this using
* kmalloc, as otherwise we may deadlock. So, it needs to be able to fit
* in a single page
#elif defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV)
#define VREFCOUNT(v) ((v)->vrefCount)
#define VREFCOUNT_GT(v, y) (AFSTOV(v)->v_usecount > (y))
-#elif defined(AFS_LINUX24_ENV)
+#elif defined(AFS_LINUX_ENV)
#define VREFCOUNT(v) atomic_read(&(AFSTOV(v)->v_count))
#define VREFCOUNT_GT(v, y) (VREFCOUNT(v)>y)
#define VREFCOUNT_SET(v, c) atomic_set(&(AFSTOV(v)->v_count), c)
};
#define VTOAFS(v) ((((struct nbvdata *)((v)->v_data)))->afsvc)
#define AFSTOV(vc) ((vc)->v)
-#elif defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_SUN511_ENV) || (defined(AFS_LINUX22_ENV) && !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE))
+#elif defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_SUN511_ENV) || (defined(AFS_LINUX_ENV) && !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE))
#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_LINUX22_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_LINUX22_ENV)
+#if !defined(AFS_LINUX_ENV)
struct vcache *nextfree; /* next on free list (if free) */
#endif
struct vcache *hnext; /* Hash next */
char cachingStates; /* Caching policies for this file */
afs_uint32 cachingTransitions; /* # of times file has flopped between caching and not */
-#if defined(AFS_LINUX24_ENV)
+#if defined(AFS_LINUX_ENV)
off_t next_seq_offset; /* Next sequential offset (used by prefetch/readahead) */
-#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI65_ENV)
+#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
off_t next_seq_blk_offset; /* accounted in blocks for Solaris & IRIX */
#endif
unsigned int readdir_pid; /* pid of the thread in readdir */
#if defined(AFS_SGI_ENV)
daddr_t lastr; /* for read-ahead */
-#ifdef AFS_SGI64_ENV
uint64_t vc_rwlockid; /* kthread owning rwlock */
-#else
- short vc_rwlockid; /* pid of process owning rwlock */
-#endif
short vc_locktrips; /* # of rwlock reacquisitions */
sema_t vc_rwlock; /* vop_rwlock for afs */
pgno_t mapcnt; /* # of pages mapped */
struct cred *cred; /* last writer's cred */
-#ifdef AFS_SGI64_ENV
struct bhv_desc vc_bhv_desc; /* vnode's behavior data. */
-#endif
#endif /* AFS_SGI_ENV */
-#if defined(AFS_LINUX26_ENV)
- cred_t *cred; /* last writer's cred */
+#if defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV)
+ afs_ucred_t *cred; /* last writer's cred */
#endif
-#ifdef AFS_LINUX24_ENV
+#ifdef AFS_LINUX_ENV
struct dentry *target_link; /* dentry we prefer, when we are redirecting
* all requests due to duplicate dentry aliases.
* See LINUX/osi_vnodeops.c. Note that this is
void *vpacRock; /* used to read or write in visible partitions */
#endif
afs_uint32 lastBRLWarnTime; /* last time we warned about byte-range locks */
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
spinlock_t pagewriter_lock;
struct list_head pagewriters; /* threads that are writing vm pages */
#endif
};
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
struct pagewriter {
struct list_head link;
pid_t writer;
#if defined(AFS_SGI_ENV)
#define AVCRWLOCK(avc) (valusema(&(avc)->vc_rwlock) <= 0)
-/* SGI vnode rwlock macros and flags. */
-#ifndef AFS_SGI62_ENV
-/* The following are defined here. SGI 6.2 declares them in vnode.h */
-#define VRWLOCK_READ 0
-#define VRWLOCK_WRITE 1
-#define VRWLOCK_WRITE_DIRECT 2
-#endif
-
-#ifdef AFS_SGI53_ENV
-#ifdef AFS_SGI62_ENV
#define AFS_RWLOCK_T vrwlock_t
-#else
-#define AFS_RWLOCK_T int
-#endif /* AFS_SGI62_ENV */
-#ifdef AFS_SGI64_ENV
#include <ksys/behavior.h>
#define AFS_RWLOCK(V,F) \
afs_rwlock(&VTOAFS(V)->vc_bhv_desc, (F));
#define AFS_RWUNLOCK(V,F) \
afs_rwunlock(&VTOAFS(V)->vc_bhv_desc, (F));
-#else
-#define AFS_RWLOCK(V,F) afs_rwlock((vnode_t *)(V), (F) )
-#define AFS_RWUNLOCK(V,F) afs_rwunlock((vnode_t *)(V), (F) )
-#endif
-#else /* AFS_SGI53_ENV */
-#define AFS_RWLOCK(V,F) afs_rwlock((V))
-#define AFS_RWUNLOCK(V,F) afs_rwunlock((V))
-#endif /* AFS_SGI53_ENV */
#endif /* AFS_SGI_ENV */
struct vcxstat {
typedef user_addr_t uparmtype; /* 64 bit */
#else
typedef char * uparmtype;
-#ifdef AFS_SGI65_ENV
+#ifdef AFS_SGI_ENV
typedef afs_uint32 iparmtype;
#else
typedef long iparmtype;
#if defined(AFS_CACHE_VNODE_PATH)
typedef char *afs_ufs_dcache_id_t;
-#elif defined(AFS_SGI61_ENV) || defined(AFS_SUN5_64BIT_ENV)
+#elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_64BIT_ENV)
/* Using ino64_t here so that user level debugging programs compile
* the size correctly.
*/
typedef ino64_t afs_ufs_dcache_id_t;
-#elif defined(AFS_LINUX26_ENV)
+#elif defined(AFS_LINUX_ENV)
#define MAX_FH_LEN 10
typedef union {
#if defined(NEW_EXPORT_OPS)
} afs_ufs_dcache_id_t;
extern int cache_fh_type;
extern int cache_fh_len;
-#elif defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_S390X_LINUX24_ENV)
+#elif defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_S390X_LINUX_ENV)
typedef long afs_ufs_dcache_id_t;
#elif defined(AFS_AIX51_ENV) || defined(AFS_HPUX1123_ENV)
typedef ino_t afs_ufs_dcache_id_t;
#define AFS_VOLCHECK_MTPTS 0x4 /* mount point invalidation also */
#define AFS_VOLCHECK_FORCE 0x8 /* do all forcibly */
+/*
+ * Wrappers for access to credentials structure members
+ * Linux uses the kernel cred structure if available, with the
+ * wrappers defined in LINUX/osi_machdep.h
+ */
+#if defined(AFS_NBSD40_ENV)
+/* in osi_machdep.h as expected */
+#elif defined (AFS_DARWIN110_ENV)
+#define afs_cr_uid(cred) kauth_cred_getuid((kauth_cred_t)(cred))
+#define afs_cr_gid(cred) kauth_cred_getgid((kauth_cred_t)(cred))
+#elif !(defined(AFS_LINUX_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED))
+#define afs_cr_uid(cred) ((cred)->cr_uid)
+#define afs_cr_gid(cred) ((cred)->cr_gid)
+#if !defined(AFS_OBSD_ENV)
+#define afs_cr_ruid(cred) ((cred)->cr_ruid)
+#define afs_cr_rgid(cred) ((cred)->cr_rgid)
+#endif
+
+#if !defined(AFS_DARWIN110_ENV)
+static_inline void
+afs_set_cr_uid(afs_ucred_t *cred, uid_t uid) {
+ cred->cr_uid = uid;
+}
+static_inline void
+afs_set_cr_gid(afs_ucred_t *cred, gid_t gid) {
+ cred->cr_gid = gid;
+}
+#if !defined(AFS_OBSD_ENV)
+static_inline void
+afs_set_cr_ruid(afs_ucred_t *cred, uid_t uid) {
+ cred->cr_ruid = uid;
+}
+static_inline void
+afs_set_cr_rgid(afs_ucred_t *cred, gid_t gid) {
+ cred->cr_rgid = gid;
+}
+#endif /* ! AFS_OBSD_ENV */
+#endif /* ! AFS_DARWIN110_ENV */
+#endif
+
+/*
+ * Various definitions for osi_sleep and its event hash table
+ * DFBSD has no osi_sleep, and HPUX has its own hack for this stuff
+ */
+#define AFS_EVHASHSIZE 128 /* size of afs_evhasht, must be power of 2 */
+
+typedef struct afs_event {
+ struct afs_event *next; /* next in hash chain */
+ char *event; /* lwp event: an address */
+ int refcount; /* Is it in use? */
+ int seq; /* Sequence number: this is incremented
+ * by wakeup calls; wait will not return until
+ * it changes */
+#if defined(AFS_AIX_ENV)
+ tid_t cond;
+#elif defined(AFS_DARWIN_ENV)
+# ifdef AFS_DARWIN80_ENV
+ lck_mtx_t *lck;
+ thread_t owner;
+# endif
+ /* no cond member */
+#elif defined(AFS_FBSD_ENV) || defined(AFS_OBSD_ENV)
+ int cond; /* "all this gluck should probably be replaced by CVs" */
+#elif defined(AFS_LINUX_ENV)
+ wait_queue_head_t cond;
+#elif defined(AFS_NBSD_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
+ kcondvar_t cond; /* Currently associated condition variable */
+#endif
+} afs_event_t;
+
+extern afs_event_t *afs_evhasht[AFS_EVHASHSIZE]; /* Hash table for events */
+
#endif /* KERNEL */
#define AFS_FSPORT ((unsigned short) htons(7000))
/* get a file's serial number from a vnode */
#ifndef afs_vnodeToInumber
-#if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
#define afs_vnodeToInumber(V) VnodeToIno(V)
#else
#define afs_vnodeToInumber(V) (VTOI(V)->i_number)
-#endif /* AFS_SGI62_ENV */
+#endif /* AFS_SGI_ENV */
#endif
/* get a file's device number from a vnode */
#ifndef afs_vnodeToDev
-#if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
#define afs_vnodeToDev(V) VnodeToDev(V)
#elif defined(UKERNEL)
#define afs_vnodeToDev(V) (VTOI(V) ? (VTOI(V)->i_dev) : (-1))
except with libuafs, in which case it is actually defined */
struct buf;
+struct osi_file;
+struct afs_FetchOutput;
struct rxfs_storeVariables {
struct rx_call *call;
extern int afs_rmtsys_enable;
extern int afsd_dynamic_vcaches;
-/*
- * Wrappers for access to credentials structure members
- * Linux uses the kernel cred structure if available, with the
- * wrappers defined in LINUX/osi_machdep.h
- */
-#if defined(AFS_NBSD40_ENV)
-/* in osi_machdep.h as expected */
-#elif defined (AFS_DARWIN110_ENV)
-#define afs_cr_uid(cred) kauth_cred_getuid((kauth_cred_t)(cred))
-#define afs_cr_gid(cred) kauth_cred_getgid((kauth_cred_t)(cred))
-#elif !(defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED))
-#define afs_cr_uid(cred) ((cred)->cr_uid)
-#define afs_cr_gid(cred) ((cred)->cr_gid)
-#if !defined(AFS_OBSD_ENV)
-#define afs_cr_ruid(cred) ((cred)->cr_ruid)
-#define afs_cr_rgid(cred) ((cred)->cr_rgid)
-#endif
-
-#if !defined(AFS_DARWIN110_ENV)
-static_inline void
-afs_set_cr_uid(afs_ucred_t *cred, uid_t uid) {
- cred->cr_uid = uid;
-}
-static_inline void
-afs_set_cr_gid(afs_ucred_t *cred, gid_t gid) {
- cred->cr_gid = gid;
-}
-#if !defined(AFS_OBSD_ENV)
-static_inline void
-afs_set_cr_ruid(afs_ucred_t *cred, uid_t uid) {
- cred->cr_ruid = uid;
-}
-static_inline void
-afs_set_cr_rgid(afs_ucred_t *cred, gid_t gid) {
- cred->cr_rgid = gid;
-}
-#endif /* ! AFS_OBSD_ENV */
-#endif /* ! AFS_DARWIN110_ENV */
-#endif
-
#ifdef AFS_SUN5_ENV
/** The 32 bit OS expects the members of this structure to be 32 bit
extern int Afs_syscall(struct afssysa *uap, rval_t *rvp);
#endif /* AFS_SUN5_ENV */
-/*
- * Various definitions for osi_sleep and its event hash table
- * DFBSD has no osi_sleep, and HPUX has its own hack for this stuff
- */
-#define AFS_EVHASHSIZE 128 /* size of afs_evhasht, must be power of 2 */
-
-typedef struct afs_event {
- struct afs_event *next; /* next in hash chain */
- char *event; /* lwp event: an address */
- int refcount; /* Is it in use? */
- int seq; /* Sequence number: this is incremented
- * by wakeup calls; wait will not return until
- * it changes */
-#if defined(AFS_AIX_ENV)
- tid_t cond;
-#elif defined(AFS_DARWIN_ENV)
-# ifdef AFS_DARWIN80_ENV
- lck_mtx_t *lck;
- thread_t owner;
-# endif
- /* no cond member */
-#elif defined(AFS_FBSD_ENV) || defined(AFS_OBSD_ENV)
- int cond; /* "all this gluck should probably be replaced by CVs" */
-#elif defined(AFS_LINUX24_ENV)
- wait_queue_head_t cond;
-#elif defined(AFS_NBSD_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
- kcondvar_t cond; /* Currently associated condition variable */
-#endif
-} afs_event_t;
-
-extern afs_event_t *afs_evhasht[AFS_EVHASHSIZE]; /* Hash table for events */
-
#endif /* _AFS_H_ */
#include "afs/sysincludes.h" /* Standard vendor system headers */
#ifndef UKERNEL
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_FBSD_ENV)
#include <net/if.h>
#include <netinet/in.h>
#endif
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN_ENV)
#include <netinet/in_var.h>
#endif
#endif /* !UKERNEL */
if (tvp) {
struct vcache *tvc;
ObtainReadLock(&afs_xvcache);
- if ((tvc = afs_FindVCache(afid, 0, 0))) {
+ if ((tvc = afs_FindVCache(afid, 0))) {
ReleaseReadLock(&afs_xvcache);
afs_StaleVCacheFlags(tvc, AFS_STALEVC_NOCB | AFS_STALEVC_NODNLC,
CUnique);
#include "afs/sysincludes.h"
#include "afsincludes.h"
#if !defined(UKERNEL)
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX_ENV)
# include "h/param.h"
#endif
#include "h/types.h"
#if defined(AFS_AIX31_ENV)
#include "h/limits.h"
#endif
-#if !defined(AFS_AIX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX_ENV)
#include "h/kernel.h" /* Doesn't needed, so it should go */
#endif
#endif /* !defined(UKERNEL) */
#include "afsint.h"
#include "afs/lock.h"
-#if !defined(UKERNEL) && !defined(AFS_LINUX20_ENV)
+#if !defined(UKERNEL) && !defined(AFS_LINUX_ENV)
#include "h/buf.h"
#endif /* !defined(UKERNEL) */
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)
{
for (i = 0; i < nbuffers; i += NPB, tp += NPB) {
afs_osi_Free(tp->data, NPB * AFS_BUFFER_PAGESIZE);
}
- afs_osi_Free(Buffers, nbuffers * sizeof(struct buffer));
+ afs_osi_Free(Buffers, afs_max_buffers * sizeof(struct buffer));
Buffers = NULL;
nbuffers = 0;
timecounter = 1;
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
u_offset_t offset;
struct seg *segment;
caddr_t address;
-#elif defined(AFS_LINUX24_ENV) || defined(UKERNEL)
+#elif defined(AFS_LINUX_ENV) || defined(UKERNEL)
/* The tested platform, as CITI impl. just packs ab->parms */
struct uio *auio;
struct vrequest *areq;
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);
#include "afs/afs_stats.h"
#include "rx/rx_globals.h"
#if !defined(UKERNEL)
-# if !defined(AFS_LINUX20_ENV)
+# if defined(AFS_LINUX_ENV)
+# include "osi_compat.h"
+# else
# include "net/if.h"
-# ifdef AFS_SGI62_ENV
+# ifdef AFS_SGI_ENV
# include "h/hashing.h"
# endif
# if !defined(AFS_HPUX110_ENV) && !defined(AFS_DARWIN_ENV)
#endif
#include <hcrypto/rand.h>
+#if defined(AFS_DARWIN80_ENV)
+# include <mach/thread_act.h>
+#endif
+
#if defined(AFS_SUN5_ENV) || defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV)
#define AFS_MINBUFFERS 100
#else
#define AFS_MINBUFFERS 50
#endif
-#if (defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV) || defined(AFS_DARWIN80_ENV)) && !defined(UKERNEL)
+#if (defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_DARWIN80_ENV)) && !defined(UKERNEL)
/* If AFS_DAEMONOP_ENV is defined, it indicates we run "daemon" AFS syscalls by
* spawning a kernel thread to do the work, instead of running them in the
* calling process. */
static int
afs_InitSetup(int preallocs)
{
+ static int afs_InitSetup_running;
+
int code;
afs_uint32 host;
+ while (afs_InitSetup_running) {
+ afs_osi_Sleep(&afs_InitSetup_running);
+ }
+
if (afs_InitSetup_done)
return EAGAIN;
+ afs_InitSetup_running = 1;
+
#ifdef AFS_SUN510_ENV
/* Initialize a RW lock for the ifinfo global array */
rw_init(&afsifinfo_lock, NULL, RW_DRIVER, NULL);
(host >> 8) & 0xff,
(host) & 0xff,
7001);
+ AFS_GUNLOCK();
code = rx_InitHost(rx_bindhost, htons(7001));
+ AFS_GLOCK();
if (code) {
afs_warn("AFS: RX failed to initialize %d).\n", code);
- return code;
+ goto done;
}
rx_SetRxDeadTime(afs_rx_deadtime);
/* resource init creates the services */
afs_InitSetup_done = 1;
afs_osi_Wakeup(&afs_InitSetup_done);
+ done:
+ afs_InitSetup_running = 0;
+ afs_osi_Wakeup(&afs_InitSetup_running);
return code;
}
}
}
-void
+static void
afs_DaemonOp(long parm, long parm2, long parm3, long parm4, long parm5,
long parm6)
{
#endif
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX_ENV)
struct afsd_thread_info {
# if !defined(INIT_WORK_HAS_DATA)
struct work_struct tq;
int (*sys_setpriority) (int, int, int) = sys_call_table[__NR_setpriority];
# endif
# if !defined(HAVE_LINUX_KTHREAD_RUN)
-# if defined(AFS_LINUX26_ENV)
+# if defined(AFS_LINUX_ENV)
daemonize("afsd");
# else
daemonize();
/* doesn't do much, since we were forked from keventd, but
* does call mm_release, which wakes up our parent (since it
* used CLONE_VFORK) */
-# if !defined(AFS_LINUX26_ENV)
+# if !defined(AFS_LINUX_ENV)
reparent_to_init();
# endif
afs_osi_MaskSignals();
sprintf(current->comm, "afs_callback");
afs_RXCallBackServer();
AFS_GUNLOCK();
- complete_and_exit(0, 0);
+ kthread_complete_and_exit(0, 0);
break;
case AFSOP_START_AFS:
sprintf(current->comm, "afs_afsstart");
sprintf(current->comm, "afsd");
afs_Daemon();
AFS_GUNLOCK();
- complete_and_exit(0, 0);
+ kthread_complete_and_exit(0, 0);
break;
case AFSOP_START_BKG:
#ifdef AFS_NEW_BKG
afs_BackgroundDaemon();
AFS_GUNLOCK();
#endif
- complete_and_exit(0, 0);
+ kthread_complete_and_exit(0, 0);
break;
case AFSOP_START_TRUNCDAEMON:
sprintf(current->comm, "afs_trimstart");
sprintf(current->comm, "afs_cachetrim");
afs_CacheTruncateDaemon();
AFS_GUNLOCK();
- complete_and_exit(0, 0);
+ kthread_complete_and_exit(0, 0);
break;
case AFSOP_START_CS:
sprintf(current->comm, "afs_checkserver");
complete(arg->complete);
afs_CheckServerDaemon();
AFS_GUNLOCK();
- complete_and_exit(0, 0);
+ kthread_complete_and_exit(0, 0);
break;
case AFSOP_RXEVENT_DAEMON:
sprintf(current->comm, "afs_evtstart");
sprintf(current->comm, "afs_rxevent");
afs_rxevent_daemon();
AFS_GUNLOCK();
- complete_and_exit(0, 0);
+ kthread_complete_and_exit(0, 0);
break;
#ifdef RXK_LISTENER_ENV
case AFSOP_RXLISTENER_DAEMON:
sprintf(current->comm, "afs_rxlistener");
rxk_Listener();
AFS_GUNLOCK();
- complete_and_exit(0, 0);
+ kthread_complete_and_exit(0, 0);
break;
#endif
default:
return 0;
}
-void
-# if defined(AFS_LINUX26_ENV) && !defined(INIT_WORK_HAS_DATA)
+static void
+# if defined(AFS_LINUX_ENV) && !defined(INIT_WORK_HAS_DATA)
afsd_launcher(struct work_struct *work)
# else
afsd_launcher(void *rock)
# endif
{
-# if defined(AFS_LINUX26_ENV) && !defined(INIT_WORK_HAS_DATA)
+# if defined(AFS_LINUX_ENV) && !defined(INIT_WORK_HAS_DATA)
struct afsd_thread_info *rock = container_of(work, struct afsd_thread_info, tq);
# endif
# endif /* !HAVE_LINUX_KTHREAD_RUN */
}
-void
+static void
afs_DaemonOp(long parm, long parm2, long parm3, long parm4, long parm5,
long parm6)
{
DECLARE_COMPLETION(c);
-# if defined(AFS_LINUX26_ENV)
+# if defined(AFS_LINUX_ENV)
# if defined(INIT_WORK_HAS_DATA)
struct work_struct tq;
# endif
}
info.complete = &c;
info.parm = parm;
-# if defined(AFS_LINUX26_ENV)
+# if defined(AFS_LINUX_ENV)
# if !defined(INIT_WORK_HAS_DATA)
INIT_WORK(&info.tq, afsd_launcher);
schedule_work(&info.tq);
}
#endif /* AFS_SUN5_ENV */
+#ifdef AFS_SOCKPROXY_ENV
+/**
+ * Deallocate packets.
+ *
+ * @param[inout] a_pktlist list of packets to be freed
+ * @param[in] a_npkts number of packets
+ */
+static void
+sockproxy_pkts_free(struct afs_pkt_hdr **a_pktlist, size_t a_npkts)
+{
+ int pkt_i;
+ struct afs_pkt_hdr *pktlist = *a_pktlist;
+
+ if (pktlist == NULL) {
+ return;
+ }
+ *a_pktlist = NULL;
+
+ for (pkt_i = 0; pkt_i < a_npkts; pkt_i++) {
+ struct afs_pkt_hdr *pkt = &pktlist[pkt_i];
+ afs_osi_Free(pkt->payload, pkt->size);
+ pkt->payload = NULL;
+ }
+ afs_osi_Free(pktlist, a_npkts * sizeof(pktlist[0]));
+}
+
+/**
+ * Copy packets from user-space.
+ *
+ * @param[in] a_uaddr address of list of packets in user-space
+ * @param[out] a_pktlist packets copied from user-space
+ * @param[in] a_npkts number of packets to be copied
+ *
+ * @return errno error codes.
+ */
+static int
+sockproxy_pkts_copyin(user_addr_t a_uaddr, struct afs_pkt_hdr **a_pktlist,
+ size_t a_npkts)
+{
+ int code, pkt_i;
+ struct afs_pkt_hdr *pktlist_u;
+ struct afs_pkt_hdr *pktlist_k = NULL;
+
+ *a_pktlist = NULL;
+ if (a_npkts == 0) {
+ return 0;
+ }
+ if (a_npkts > AFS_SOCKPROXY_PKT_MAX) {
+ return E2BIG;
+ }
+
+ pktlist_u = afs_osi_Alloc(a_npkts * sizeof(pktlist_u[0]));
+ if (pktlist_u == NULL) {
+ code = ENOMEM;
+ goto done;
+ }
+
+ pktlist_k = afs_osi_Alloc(a_npkts * sizeof(pktlist_k[0]));
+ if (pktlist_k == NULL) {
+ code = ENOMEM;
+ goto done;
+ }
+ memset(pktlist_k, 0, a_npkts * sizeof(pktlist_k[0]));
+
+ AFS_COPYIN(a_uaddr, pktlist_u, a_npkts * sizeof(pktlist_u[0]), code);
+ if (code != 0) {
+ goto done;
+ }
+
+ for (pkt_i = 0; pkt_i < a_npkts; pkt_i++) {
+ struct afs_pkt_hdr *pkt_k = &pktlist_k[pkt_i];
+ struct afs_pkt_hdr *pkt_u = &pktlist_u[pkt_i];
+
+ if (pkt_u->size > AFS_SOCKPROXY_PAYLOAD_MAX) {
+ code = E2BIG;
+ goto done;
+ }
+ /*
+ * Notice that pkt_u->payload points to a user-space address. When
+ * copying the data from pkt_u to pkt_k, make sure that pkt_k->payload
+ * points to a valid address in kernel-space.
+ */
+ *pkt_k = *pkt_u;
+ pkt_k->payload = afs_osi_Alloc(pkt_k->size);
+ if (pkt_k->payload == NULL) {
+ code = ENOMEM;
+ goto done;
+ }
+
+ AFS_COPYIN((user_addr_t)pkt_u->payload, pkt_k->payload, pkt_k->size,
+ code);
+ if (code != 0) {
+ goto done;
+ }
+ }
+
+ *a_pktlist = pktlist_k;
+ pktlist_k = NULL;
+ code = 0;
+
+ done:
+ sockproxy_pkts_free(&pktlist_k, a_npkts);
+ afs_osi_Free(pktlist_u, a_npkts * sizeof(pktlist_u[0]));
+
+ return code;
+}
+
+/**
+ * Copy packets to user-space.
+ *
+ * @param[in] a_uaddr dst address of list of packets in user-space
+ * @param[in] a_pktlist packets to be copied to user-space
+ * @param[in] a_npkts number of packets to be copied
+ *
+ * @return 0 on success; non-zero otherwise.
+ */
+static int
+sockproxy_pkts_copyout(user_addr_t a_uaddr, struct afs_pkt_hdr *a_pktlist,
+ size_t a_npkts)
+{
+ int code, pkt_i;
+ struct afs_pkt_hdr *pktlist_u = NULL;
+ struct afs_pkt_hdr *pktlist_k = a_pktlist;
+
+ if (a_npkts == 0) {
+ return 0;
+ }
+ if (a_npkts > AFS_SOCKPROXY_PKT_MAX) {
+ return E2BIG;
+ }
+ if (a_pktlist == NULL) {
+ return EINVAL;
+ }
+
+ pktlist_u = afs_osi_Alloc(a_npkts * sizeof(pktlist_u[0]));
+ if (pktlist_u == NULL) {
+ code = ENOMEM;
+ goto done;
+ }
+
+ AFS_COPYIN(a_uaddr, pktlist_u, a_npkts * sizeof(pktlist_u[0]), code);
+ if (code != 0) {
+ goto done;
+ }
+
+ for (pkt_i = 0; pkt_i < a_npkts; pkt_i++) {
+ struct afs_pkt_hdr *pkt_k = &pktlist_k[pkt_i];
+ struct afs_pkt_hdr *pkt_u = &pktlist_u[pkt_i];
+ void *payload_uaddr;
+
+ if (pkt_k->size > pkt_u->size) {
+ code = ENOSPC;
+ goto done;
+ }
+
+ /* Copy pkt_k -> pkt_u, but preserve pkt_u->payload */
+ payload_uaddr = pkt_u->payload;
+ *pkt_u = *pkt_k;
+ pkt_u->payload = payload_uaddr;
+
+ AFS_COPYOUT(pkt_k->payload, (user_addr_t)pkt_u->payload, pkt_k->size,
+ code);
+ if (code != 0) {
+ goto done;
+ }
+ }
+
+ AFS_COPYOUT(pktlist_u, a_uaddr, a_npkts * sizeof(pktlist_u[0]), code);
+ if (code != 0) {
+ goto done;
+ }
+
+ done:
+ afs_osi_Free(pktlist_u, a_npkts * sizeof(pktlist_u[0]));
+ return code;
+}
+
+/**
+ * Receive / send packets from / to user-space.
+ *
+ * @param[in] a_parm_uspc afs_uspc_param struct
+ * @param[in] a_parm_pkts packets to be received / sent
+ *
+ * @return 0 on success; non-zero otherwise.
+ */
+static int
+sockproxy_handler(user_addr_t a_parm_uspc, user_addr_t a_parm_pkts)
+{
+ int code;
+ size_t orig_npkts, npkts;
+ struct afs_uspc_param uspc;
+
+ struct afs_pkt_hdr *pkts_recv;
+ struct afs_pkt_hdr *pkts_send;
+
+ AFS_GUNLOCK();
+
+ orig_npkts = 0;
+ memset(&uspc, 0, sizeof(uspc));
+
+ pkts_recv = NULL;
+ pkts_send = NULL;
+
+ /* get response from user-space */
+ AFS_COPYIN(a_parm_uspc, &uspc, sizeof(uspc), code);
+ if (code != 0) {
+ afs_warn("afs: AFSOP_SOCKPROXY_HANDLER can't read uspc\n");
+ goto done;
+ }
+
+ npkts = uspc.req.usp.npkts;
+ orig_npkts = npkts;
+
+ if (uspc.reqtype == AFS_USPC_SOCKPROXY_RECV && npkts > 0) {
+ /* copyin packets in from user-space */
+ code = sockproxy_pkts_copyin(a_parm_pkts, &pkts_recv, npkts);
+ if (code) {
+ afs_warn("afs: AFSOP_SOCKPROXY_HANDLER can't read pkts\n");
+ goto done;
+ }
+ }
+
+ /*
+ * send response from user-space (if any) to the rx layer and wait for a
+ * new request.
+ */
+ code = rxk_SockProxyReply(&uspc, pkts_recv, &pkts_send);
+ if (code) {
+ afs_warn("afs: AFSOP_SOCKPROXY_HANDLER rxk_SockProxyReply failed\n");
+ goto done;
+ }
+
+ /* send request to user-space process */
+ AFS_COPYOUT(&uspc, a_parm_uspc, sizeof(uspc), code);
+ if (code) {
+ afs_warn("afs: AFSOP_SOCKPROXY_HANDLER can't write uspc\n");
+ goto done;
+ }
+
+ npkts = uspc.req.usp.npkts;
+ if (uspc.reqtype == AFS_USPC_SOCKPROXY_SEND && npkts > 0) {
+ /* check if process allocated enough memory to receive the packets */
+ if (npkts > orig_npkts) {
+ code = ENOSPC;
+ goto done;
+ }
+
+ /* copyout packets to user-space */
+ code = sockproxy_pkts_copyout(a_parm_pkts, pkts_send, npkts);
+ if (code != 0) {
+ afs_warn("afs: AFSOP_SOCKPROXY_HANDLER can't write pkts\n");
+ goto done;
+ }
+ }
+ done:
+ sockproxy_pkts_free(&pkts_recv, orig_npkts);
+ AFS_GLOCK();
+
+ return code;
+}
+#endif /* AFS_SOCKPROXY_ENV */
+
#ifdef AFS_DARWIN100_ENV
# define AFSKPTR(X) k ## X
int
#endif
{
afs_int32 code = 0;
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
size_t bufferSize;
-#else /* AFS_SGI61_ENV */
+#else /* AFS_SGI_ENV */
u_int bufferSize;
-#endif /* AFS_SGI61_ENV */
+#endif /* AFS_SGI_ENV */
#ifdef AFS_DARWIN100_ENV
/* AFSKPTR macro relies on this name format/mapping */
afs_uint32 parm = (afs_uint32)kparm;
while (!afs_InitSetup_done)
afs_osi_Sleep(&afs_InitSetup_done);
-#if defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_SUN5_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_SUN5_ENV)
temp = AFS_MINBUFFERS; /* Should fix this soon */
#else
/* number of 2k buffers we could get from all of the buffer space */
get_vfs_context();
#endif
/* do it by inode */
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
ainode = (ainode << 32) | (parm3 & 0xffffffff);
#endif
code = afs_InitCacheFile(NULL, ainode);
}
}
else if (parm == AFSOP_SHUTDOWN) {
- afs_cold_shutdown = 0;
- if (parm2 == 1)
- afs_cold_shutdown = 1;
if (afs_globalVFS != 0) {
afs_warn("AFS isn't unmounted yet! Call aborted\n");
code = EACCES;
- } else
- afs_shutdown();
+ } else if (parm2 == AFS_COLD) {
+ afs_shutdown(AFS_COLD);
+ } else {
+ afs_shutdown(AFS_WARM);
+ }
} else if (parm == AFSOP_AFS_VFSMOUNT) {
#ifdef AFS_HPUX_ENV
vfsmount(parm2, parm3, parm4, parm5);
afs_SynchronousCloses = 'S';
} else if (parm == AFSOP_GETMTU) {
afs_uint32 mtu = 0;
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX_ENV)
# ifdef AFS_USERSPACE_IP_ADDR
afs_int32 i;
i = rxi_Findcbi(parm2);
afs_volume_ttl = parm2;
code = 0;
}
+#ifdef AFS_SOCKPROXY_ENV
+ } else if (parm == AFSOP_SOCKPROXY_HANDLER) {
+ code = sockproxy_handler(AFSKPTR(parm2), AFSKPTR(parm3));
+#endif
} else {
code = EINVAL;
}
out:
AFS_GUNLOCK();
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
return -code;
#else
return code;
enum afs_shutdown_state afs_shuttingdown = AFS_RUNNING;
void
-afs_shutdown(void)
+afs_shutdown(enum afs_shutdown_type cold_flag)
{
extern short afs_brsDaemons;
extern afs_int32 afs_CheckServerDaemonStarted;
if (afs_shuttingdown != AFS_RUNNING)
return;
+ afs_cold_shutdown = ((cold_flag == AFS_COLD) ? 1 : 0);
+
afs_shuttingdown = AFS_FLUSHING_CB;
/* Give up all of our callbacks if we can. */
afs_warn("CB... ");
afs_termState = AFSOP_STOP_RXCALLBACK;
+ AFS_GUNLOCK();
rx_WakeupServerProcs();
+ AFS_GLOCK();
#ifdef AFS_AIX51_ENV
shutdown_rxkernel();
#endif
afs_warn("NetIfPoller... ");
osi_StopNetIfPoller();
#endif
+ AFS_GUNLOCK();
rxi_FreeAllPackets();
+ AFS_GLOCK();
afs_termState = AFSOP_STOP_COMPLETE;
#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"
afs_int32 afs_allCBs = 0; /*Break callbacks on all objects */
a_result->lock.exclLocked = tvc->lock.excl_locked;
a_result->lock.readersReading = tvc->lock.readers_reading;
a_result->lock.numWaiting = tvc->lock.num_waiting;
-#if defined(INSTRUMENT_LOCKS)
a_result->lock.pid_last_reader = MyPidxx2Pid(tvc->lock.pid_last_reader);
a_result->lock.pid_writer = MyPidxx2Pid(tvc->lock.pid_writer);
a_result->lock.src_indicator = tvc->lock.src_indicator;
-#else
- /* On osf20 , the vcache does not maintain these three fields */
- a_result->lock.pid_last_reader = 0;
- a_result->lock.pid_writer = 0;
- a_result->lock.src_indicator = 0;
-#endif /* INSTRUMENT_LOCKS */
#ifdef AFS_64BIT_CLIENT
a_result->Length = (afs_int32) tvc->f.m.Length & 0xffffffff;
#else /* AFS_64BIT_CLIENT */
a_result->lock.exclLocked = tvc->lock.excl_locked;
a_result->lock.readersReading = tvc->lock.readers_reading;
a_result->lock.numWaiting = tvc->lock.num_waiting;
-#if defined(INSTRUMENT_LOCKS)
a_result->lock.pid_last_reader = MyPidxx2Pid(tvc->lock.pid_last_reader);
a_result->lock.pid_writer = MyPidxx2Pid(tvc->lock.pid_writer);
a_result->lock.src_indicator = tvc->lock.src_indicator;
-#else
- /* On osf20 , the vcache does not maintain these three fields */
- a_result->lock.pid_last_reader = 0;
- a_result->lock.pid_writer = 0;
- a_result->lock.src_indicator = 0;
-#endif /* INSTRUMENT_LOCKS */
a_result->Length = tvc->f.m.Length;
a_result->DataVersion = hgetlo(tvc->f.m.DataVersion);
a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */
code = 1;
} else if (a_index >= nentries) {
struct cell *tc = afs_GetCellByIndex(a_index-nentries, 0);
- strcpy(a_result->name, tc->cellName);
+ strlcpy(a_result->name, tc->cellName, sizeof(a_result->name));
a_result->lock.waitStates =
((struct afs_lock *)&(tc->lock))->wait_states;
a_result->lock.exclLocked =
((struct afs_lock *)&(tc->lock))->readers_reading;
a_result->lock.numWaiting =
((struct afs_lock *)&(tc->lock))->num_waiting;
-#ifdef INSTRUMENT_LOCKS
a_result->lock.pid_last_reader =
MyPidxx2Pid(((struct afs_lock *)&(tc->lock))->pid_last_reader);
a_result->lock.pid_writer =
MyPidxx2Pid(((struct afs_lock *)&(tc->lock))->pid_writer);
a_result->lock.src_indicator =
((struct afs_lock *)&(tc->lock))->src_indicator;
-#else
- a_result->lock.pid_last_reader = 0;
- a_result->lock.pid_writer = 0;
- a_result->lock.src_indicator = 0;
-#endif
code = 0;
} else {
/*
* Found it - copy out its contents.
*/
tl = <able[a_index];
- strcpy(a_result->name, tl->name);
+ strlcpy(a_result->name, tl->name, sizeof(a_result->name));
a_result->lock.waitStates =
((struct afs_lock *)(tl->addr))->wait_states;
a_result->lock.exclLocked =
((struct afs_lock *)(tl->addr))->readers_reading;
a_result->lock.numWaiting =
((struct afs_lock *)(tl->addr))->num_waiting;
-#ifdef INSTRUMENT_LOCKS
a_result->lock.pid_last_reader =
MyPidxx2Pid(((struct afs_lock *)(tl->addr))->pid_last_reader);
a_result->lock.pid_writer =
MyPidxx2Pid(((struct afs_lock *)(tl->addr))->pid_writer);
a_result->lock.src_indicator =
((struct afs_lock *)(tl->addr))->src_indicator;
-#else
- a_result->lock.pid_last_reader = 0;
- a_result->lock.pid_writer = 0;
- a_result->lock.src_indicator = 0;
-#endif
code = 0;
}
afs_int32 dataBytes; /*Bytes in data buffer */
XSTATS_DECLS;
+ opr_StaticAssert(sizeof(osi_timeval32_t) == SIZEOF_OSI_TIMEVAL32_T);
+
RX_AFS_GLOCK();
XSTATS_START_CMTIME(AFS_STATS_CM_RPCIDX_GETXSTATS);
/*
* Donate this process to Rx.
*/
+ AFS_GUNLOCK();
rx_ServerProc(NULL);
+ AFS_GLOCK();
return (0);
} /*afs_RXCallBackServer */
}
/*------------------------------------------------------------------------
- * 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:
*/
/* Sanity check on the callback queue. Allow for slop in the computation. */
-#if defined(AFS_LINUX22_ENV)
+#if defined(AFS_LINUX_ENV)
#define CBQ_LIMIT (afs_maxvcount + 10)
#else
#define CBQ_LIMIT (afs_cacheStats + afs_stats_cmperf.vcacheXAllocs + 10)
}
/* Return the lookup request to userspace */
- strncpy(acellName, afsdb_req.cellname, acellNameLen);
+ strlcpy(acellName, afsdb_req.cellname, acellNameLen);
ReleaseReadLock(&afsdb_req_lock);
return 0;
}
* afs_cellname_write: write in-kernel list of cells to disk
*/
-struct cell_name *afs_cellname_head; /* Export for kdump */
+static struct cell_name *afs_cellname_head;
static afs_dcache_id_t afs_cellname_inode;
static int afs_cellname_inode_set;
static int afs_cellname_dirty;
* afs_NewCellAlias: create new cell alias entry
*/
-struct cell_alias *afs_cellalias_head; /* Export for kdump */
+static struct cell_alias *afs_cellalias_head;
static afs_int32 afs_cellalias_index;
static int afs_CellOrAliasExists_nl(char *aname); /* Forward declaration */
* afs_NewCell: create or update a cell entry
*/
-struct afs_q CellLRU; /* Export for kdump */
+struct afs_q CellLRU;
+
static char *afs_thiscell = NULL;
-afs_int32 afs_cellindex; /* Export for kdump */
+afs_int32 afs_cellindex;
/*!
* Bump given cell up to the front of the LRU queue.
#include "afs/sysincludes.h" /* Standard vendor system headers */
#if !defined(UKERNEL)
-#if !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_LINUX_ENV)
#include <net/if.h>
#endif
#include <netinet/in.h>
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV)
#include <netinet/in_var.h>
#endif /* ! AFS_HPUX110_ENV */
#endif /* !defined(UKERNEL) */
afs_int32 locktype, afs_int32 replicated,
struct rx_connection **rxconn)
{
- int glocked, foundvec;
+ int foundvec;
struct afs_conn *tc = NULL;
struct sa_conn_vector *tcv = NULL;
struct rx_securityClass *csec; /*Security class object */
tu->states &= ~UHasTokens; /* remove the authentication info */
}
- glocked = ISAFS_GLOCK();
if (tc->forceConnectFS) {
UpgradeSToWLock(&afs_xconn, 38);
if (tc->id) {
if (sap->natping == tc)
sap->natping = NULL;
- if (glocked)
- AFS_GUNLOCK();
+ AFS_GUNLOCK();
rx_SetConnSecondsUntilNatPing(tc->id, 0);
rx_DestroyConnection(tc->id);
- if (glocked)
- AFS_GLOCK();
+ AFS_GLOCK();
}
/*
* Stupid hack to determine if using vldb service or file system
csec = afs_pickSecurityObject(tc, &isec);
- if (glocked)
- AFS_GUNLOCK();
+ AFS_GUNLOCK();
tc->id = rx_NewConnection(sap->sa_ip, aport, service, csec, isec);
- if (glocked)
- AFS_GLOCK();
+ AFS_GLOCK();
if (service == 52) {
rx_SetConnHardDeadTime(tc->id, afs_rx_harddead);
}
*/
if ((service != 52) && (sap->natping == NULL)) {
sap->natping = tc;
+ AFS_GUNLOCK();
rx_SetConnSecondsUntilNatPing(tc->id, 20);
+ AFS_GLOCK();
}
tc->forceConnectFS = 0; /* apparently we're appropriately connected now */
} /* end of if (tc->forceConnectFS)*/
*rxconn = tc->id;
+ AFS_GUNLOCK();
rx_GetConnection(*rxconn);
+ AFS_GLOCK();
ReleaseSharedLock(&afs_xconn);
return tc;
(unsigned long)(uintptrsz)ac, (int)ac->refCount);
}
ac->parent->refCount--;
+ AFS_GUNLOCK();
rx_PutConnection(rxconn);
+ AFS_GLOCK();
} /*afs_PutConn */
afs_int32 afs_CheckServerDaemonStarted = 0;
#ifndef DEFAULT_PROBE_INTERVAL
-#define DEFAULT_PROBE_INTERVAL 30 /* default to 3 min */
+#define DEFAULT_PROBE_INTERVAL 30
#endif
afs_int32 afs_probe_interval = DEFAULT_PROBE_INTERVAL;
afs_int32 afs_probe_all_interval = 600;
-afs_int32 afs_nat_probe_interval = 60;
afs_int32 afs_preCache = 0;
#define PROBE_WAIT() (1000 * (afs_probe_interval - ((afs_random() & 0x7fffffff) \
% (afs_probe_interval/2))))
-void
-afs_SetCheckServerNATmode(int isnat)
-{
- static afs_int32 old_intvl, old_all_intvl;
- static int wasnat;
-
- if (isnat && !wasnat) {
- old_intvl = afs_probe_interval;
- old_all_intvl = afs_probe_all_interval;
- afs_probe_interval = afs_nat_probe_interval;
- afs_probe_all_interval = afs_nat_probe_interval;
- afs_osi_CancelWait(&AFS_CSWaitHandler);
- } else if (!isnat && wasnat) {
- afs_probe_interval = old_intvl;
- afs_probe_all_interval = old_all_intvl;
- }
- wasnat = isnat;
-}
void
afs_CheckServerDaemon(void)
}
}
if (last10MinCheck + 600 < now) {
+ int addrs_changed;
#ifdef AFS_USERSPACE_IP_ADDR
extern int rxi_GetcbiInfo(void);
#endif
afs_Trace1(afs_iclSetp, CM_TRACE_PROBEUP, ICL_TYPE_INT32, 600);
#ifdef AFS_USERSPACE_IP_ADDR
- if (rxi_GetcbiInfo()) { /* addresses changed from last time */
- afs_FlushCBs();
- }
-#else /* AFS_USERSPACE_IP_ADDR */
- if (rxi_GetIFInfo()) { /* addresses changed from last time */
+ addrs_changed = rxi_GetcbiInfo();
+#else
+ AFS_GUNLOCK();
+ addrs_changed = rxi_GetIFInfo();
+ AFS_GLOCK();
+#endif
+ if (addrs_changed) { /* addresses changed from last time */
afs_FlushCBs();
}
-#endif /* else AFS_USERSPACE_IP_ADDR */
if (!afs_CheckServerDaemonStarted)
afs_CheckServers(0, NULL);
afs_GCUserData(); /* gc old conns */
struct volume *tvp = NULL;
int usingDynroot = afs_GetDynrootEnable();
int localcell;
+ size_t bufsize, len;
AFS_STATCNT(afs_CheckRootVolume);
+ bufsize = sizeof(rootVolName);
if (*afs_rootVolumeName == 0) {
- strcpy(rootVolName, "root.afs");
+ len = strlcpy(rootVolName, "root.afs", bufsize);
} else {
- strcpy(rootVolName, afs_rootVolumeName);
+ len = strlcpy(rootVolName, afs_rootVolumeName, bufsize);
+ }
+ if (len >= bufsize) {
+ return ENAMETOOLONG;
}
if (usingDynroot) {
tvp = afs_GetVolumeByName(rootVolName, localcell, 1, NULL, READ_LOCK);
if (!tvp) {
char buf[128];
- int len = strlen(rootVolName);
if ((len < 9) || strcmp(&rootVolName[len - 9], ".readonly")) {
- strcpy(buf, rootVolName);
- afs_strcat(buf, ".readonly");
+ bufsize = sizeof(buf);
+ len = strlcpy(buf, rootVolName, bufsize);
+ if (len >= bufsize) {
+ return ENAMETOOLONG;
+ }
+ len = strlcat(buf, ".readonly", bufsize);
+ if (len >= bufsize) {
+ return ENAMETOOLONG;
+ }
tvp = afs_GetVolumeByName(buf, localcell, 1, NULL, READ_LOCK);
}
}
* count to zero and fs checkv is executed when the current
* directory is /afs.
*/
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
osi_ResetRootVCache(volid);
#else
# ifdef AFS_DARWIN80_ENV
struct dcache *tdc = NULL;
struct vcache *tvc = NULL;
struct vnode *tvn = NULL;
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
struct dentry *dp = NULL;
#endif
afs_size_t offset, len;
return;
}
AFS_GUNLOCK();
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
code = gop_lookupname((char *)ab->ptr_parm[0], AFS_UIOSYS, 1, &dp);
if (dp)
tvn = (struct vnode *)dp->d_inode;
if (!tvn || !IsAfsVnode(tvn)) {
/* release it and give up */
if (tvn) {
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
dput(dp);
#else
AFS_RELE(tvn);
if (tdc) {
afs_PutDCache(tdc);
}
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
dput(dp);
#else
AFS_RELE(tvn);
{
int code;
struct vcache *tvc = ab->vc;
- osi_Assert(WriteLocked(&tvc->lock));
code = afs_InvalidateAllSegments_once(tvc);
{
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)
int cacheDiskType; /*Type of backing disk for cache */
struct afs_cacheOps *afs_cacheType;
+/* calculate number of 1k blocks needed, rounded up to nearest afs_fsfragsize */
+static_inline afs_int32
+afs_round_to_fsfragsize(afs_int32 bytes)
+{
+ return (((bytes + afs_fsfragsize) ^ afs_fsfragsize) >> 10);
+}
/*
* The PFlush algorithm makes use of the fact that Fid.Unique is not used in
}
}
-/*!
- * /struct CTD_stats
- *
- * Keep statistics on run time for afs_CacheTruncateDaemon. This is a
- * struct so we need only export one symbol for AIX.
+/*
+ * Keep statistics on run time for afs_CacheTruncateDaemon.
*/
-static struct CTD_stats {
- osi_timeval32_t CTD_beforeSleep;
- osi_timeval32_t CTD_afterSleep;
- osi_timeval32_t CTD_sleepTime;
- osi_timeval32_t CTD_runTime;
- int CTD_nSleeps;
-} CTD_stats;
+struct afs_CTD_stats CTD_stats;
u_int afs_min_cache = 0;
afs_CacheTruncateDaemon(void)
{
osi_timeval32_t CTD_tmpTime;
+ struct afs_CTD_stats *ctd_stats = &CTD_stats;
u_int counter;
u_int cb_lowat;
u_int dc_hiwat =
PERCENT((100 - CM_DCACHECOUNTFREEPCT + CM_DCACHEEXTRAPCT), afs_cacheFiles);
+
afs_min_cache =
(((10 * AFS_CHUNKSIZE(0)) + afs_fsfragsize) & ~afs_fsfragsize) >> 10;
- osi_GetTime(&CTD_stats.CTD_afterSleep);
+ osi_GetTime(&ctd_stats->CTD_afterSleep);
afs_TruncateDaemonRunning = 1;
while (1) {
cb_lowat = PERCENT((CM_DCACHESPACEFREEPCT - CM_DCACHEEXTRAPCT), afs_cacheBlocks);
if (!afs_WaitForCacheDrain && !afs_CacheTooFull
&& (afs_termState != AFSOP_STOP_TRUNCDAEMON)) {
/* Collect statistics on truncate daemon. */
- CTD_stats.CTD_nSleeps++;
- osi_GetTime(&CTD_stats.CTD_beforeSleep);
- afs_stats_GetDiff(CTD_tmpTime, CTD_stats.CTD_afterSleep,
- CTD_stats.CTD_beforeSleep);
- afs_stats_AddTo(CTD_stats.CTD_runTime, CTD_tmpTime);
+ ctd_stats->CTD_nSleeps++;
+ osi_GetTime(&ctd_stats->CTD_beforeSleep);
+ afs_stats_GetDiff(CTD_tmpTime, ctd_stats->CTD_afterSleep,
+ ctd_stats->CTD_beforeSleep);
+ afs_stats_AddTo(ctd_stats->CTD_runTime, CTD_tmpTime);
afs_TruncateDaemonRunning = 0;
afs_osi_Sleep((int *)afs_CacheTruncateDaemon);
afs_TruncateDaemonRunning = 1;
- osi_GetTime(&CTD_stats.CTD_afterSleep);
- afs_stats_GetDiff(CTD_tmpTime, CTD_stats.CTD_beforeSleep,
- CTD_stats.CTD_afterSleep);
- afs_stats_AddTo(CTD_stats.CTD_sleepTime, CTD_tmpTime);
+ osi_GetTime(&ctd_stats->CTD_afterSleep);
+ afs_stats_GetDiff(CTD_tmpTime, ctd_stats->CTD_beforeSleep,
+ ctd_stats->CTD_afterSleep);
+ afs_stats_AddTo(ctd_stats->CTD_sleepTime, CTD_tmpTime);
}
if (afs_termState == AFSOP_STOP_TRUNCDAEMON) {
afs_termState = AFSOP_STOP_AFSDB;
}
adc->dflags |= DFEntryMod;
- oldSize = ((adc->f.chunkBytes + afs_fsfragsize) ^ afs_fsfragsize) >> 10; /* round up */
+ oldSize = afs_round_to_fsfragsize(adc->f.chunkBytes);
adc->f.chunkBytes = newSize;
if (!newSize)
adc->validPos = 0;
- newSize = ((newSize + afs_fsfragsize) ^ afs_fsfragsize) >> 10; /* round up */
+ newSize = afs_round_to_fsfragsize(newSize);
afs_DCAdjustSize(adc, oldSize, newSize);
if ((newSize > oldSize) && !AFS_IS_DISCONNECTED) {
/* xdcache is lower than the xvcache lock */
ReleaseWriteLock(&afs_xdcache);
ObtainReadLock(&afs_xvcache);
- tvc = afs_FindVCache(afid, 0, 0 /* no stats, no vlru */ );
+ tvc = afs_FindVCache(afid, 0 /* no stats, no vlru */ );
ReleaseReadLock(&afs_xvcache);
ObtainWriteLock(&afs_xdcache, 527);
skip = 0;
osi_Assert(adc->refCount == 1);
- size = ((adc->f.chunkBytes + afs_fsfragsize) ^ afs_fsfragsize) >> 10; /* round up */
+ size = afs_round_to_fsfragsize(adc->f.chunkBytes);
afs_blocksDiscarded += size;
afs_stats_cmperf.cacheBlocksDiscarded = afs_blocksDiscarded;
}
afs_discardDCCount--;
- size = ((tdc->f.chunkBytes + afs_fsfragsize) ^ afs_fsfragsize) >> 10; /* round up */
+ size = afs_round_to_fsfragsize(tdc->f.chunkBytes);
afs_blocksDiscarded -= size;
afs_stats_cmperf.cacheBlocksDiscarded = afs_blocksDiscarded;
/* We can lock because we just took it off the free list */
afs_indexFlags[tdc->index] &= ~IFDiscarded;
ObtainWriteLock(&tdc->lock, 605);
afs_discardDCCount--;
- size =
- ((tdc->f.chunkBytes +
- afs_fsfragsize) ^ afs_fsfragsize) >> 10;
+ size = afs_round_to_fsfragsize(tdc->f.chunkBytes);
tdc->f.states &= ~(DRO|DBackup|DRW);
afs_DCMoveBucket(tdc, size, 0);
afs_blocksDiscarded -= size;
if (doAdjustSize || overWriteWholeChunk) {
#if defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV)
#ifdef AFS_SGI_ENV
-#ifdef AFS_SGI64_ENV
if (doAdjustSize)
adjustsize = NBPP;
-#else /* AFS_SGI64_ENV */
- if (doAdjustSize)
- adjustsize = 8192;
-#endif /* AFS_SGI64_ENV */
#else /* AFS_SGI_ENV */
if (doAdjustSize)
adjustsize = 4096;
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
}
} else {
/* Add any other 'complex' inode types here ... */
-#if !defined(AFS_LINUX26_ENV) && !defined(AFS_CACHE_VNODE_PATH)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_CACHE_VNODE_PATH)
tdc->f.inode.ufs = ainode;
#else
osi_Panic("Can't init cache with inode numbers when complex inodes are "
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)
{
/* Get the parent dir's vcache that contains the shadow fid. */
ObtainSharedLock(&afs_xvcache, 755);
- parent_vc = afs_FindVCache(&parent_fid, 0, 1);
+ parent_vc = afs_FindVCache(&parent_fid, DO_STATS);
ReleaseSharedLock(&afs_xvcache);
if (!parent_vc) {
return ENETDOWN;
tfid.Fid.Unique = unique;
ObtainSharedLock(&afs_xvcache, 757);
- tvc = afs_FindVCache(&tfid, 0, 1);
+ tvc = afs_FindVCache(&tfid, DO_STATS);
ReleaseSharedLock(&afs_xvcache);
/* Count unfinished dirty children. */
*
* \note afs_DDirtyVCListLock must be write locked.
*/
-int
+static int
afs_CheckDeletedChildren(struct vcache *avc)
{
struct dcache *tdc;
/* Get the vcache. */
ObtainSharedLock(&afs_xvcache, 759);
- tvc = afs_FindVCache(&tfid, 0, 1);
+ tvc = afs_FindVCache(&tfid, DO_STATS);
ReleaseSharedLock(&afs_xvcache);
/* Change the fields. */
* \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)
{
}
ObtainSharedLock(&afs_xvcache, 766);
- *adp = afs_FindVCache(afid, 0, 1);
+ *adp = afs_FindVCache(afid, DO_STATS);
ReleaseSharedLock(&afs_xvcache);
if (!*adp) {
/* printf("afs_GetParentVCache: Couldn't find parent dir's vcache\n"); */
* - 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
/* Is this a used vnode? */
ObtainSharedLock(&afs_xvcache, 762);
- tvc = afs_FindVCache(afid, 0, 1);
+ tvc = afs_FindVCache(afid, DO_STATS);
ReleaseSharedLock(&afs_xvcache);
if (tvc)
afs_PutVCache(tvc);
* Add directory entry by given name to a directory. Assumes the
* caller has allocated the directory to be large enough to hold
* the necessary entry.
+ *
+ * In order to make sure that memory isn't being accidentally stomped, receive
+ * the size of the directory as an argument (dirSize) and use this info to
+ * calculate the maximum number of bytes that can be occupied by the name
+ * mentioned above.
*/
static void
afs_dynroot_addDirEnt(struct DirHeader *dirHeader, int *curPageP,
- int *curChunkP, char *name, int vnode)
+ int *curChunkP, char *name, int vnode, size_t dirSize)
{
char *dirBase = (char *)dirHeader;
struct PageHeader *pageHeader;
- struct DirEntry *dirEntry;
+ struct DirEntryFlex *dirEntry;
int sizeOfEntry, i, t1, t2;
int curPage = *curPageP;
int curChunk = *curChunkP;
int didNewPage = 0;
+ size_t offset, limit;
/*
* Check if we need to flip pages.. If so, init the new page.
dirHeader->alloMap[curPage] = EPP - 1;
}
- dirEntry = (struct DirEntry *)(pageHeader + curChunk);
+ dirEntry = (struct DirEntryFlex *)(pageHeader + curChunk);
dirEntry->flag = 1;
dirEntry->length = 0;
dirEntry->next = 0;
dirEntry->fid.vnode = htonl(vnode);
dirEntry->fid.vunique = htonl(1);
- strcpy(dirEntry->name, name);
+
+ osi_Assert(dirEntry->name > dirBase);
+ offset = dirEntry->name - dirBase;
+ osi_Assert(dirSize > offset);
+ limit = dirSize - offset;
+ /*
+ * The caller must have ensured that the directory is large enough, so
+ * strlcpy() should never truncate the string.
+ */
+ strlcpy(dirEntry->name, name, limit);
for (i = curChunk; i < curChunk + sizeOfEntry; i++) {
t1 = i / 8;
void
afs_DynrootInvalidate(void)
{
- afs_int32 retry;
struct vcache *tvc;
struct VenusFid tfid;
ReleaseWriteLock(&afs_dynrootDirLock);
afs_GetDynrootFid(&tfid);
- do {
- retry = 0;
- ObtainReadLock(&afs_xvcache);
- tvc = afs_FindVCache(&tfid, &retry, 0);
- ReleaseReadLock(&afs_xvcache);
- } while (retry);
+ ObtainReadLock(&afs_xvcache);
+ tvc = afs_FindVCache(&tfid, 0);
+ ReleaseReadLock(&afs_xvcache);
if (tvc) {
afs_StaleVCacheFlags(tvc, AFS_STALEVC_NOCB, CUnique);
afs_PutVCache(tvc);
dotLen = strlen(c->cellName) + 2;
dotCell = afs_osi_Alloc(dotLen);
osi_Assert(dotCell != NULL);
- strcpy(dotCell, ".");
- afs_strcat(dotCell, c->cellName);
+ 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);
- strcpy(dotCell, ".");
- afs_strcat(dotCell, ca->alias);
+ 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);
memset(dirHeader->hashTable, 0, NHASHENT * sizeof(dirHeader->hashTable[0]));
/* Install ".", "..", and the dynamic mount directory */
- afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ".", 1);
- afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, "..", 1);
+ afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ".", 1, dirSize);
+ afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, "..", 1, dirSize);
afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
- AFS_DYNROOT_MOUNTNAME, AFS_DYNROOT_MOUNT_VNODE);
+ AFS_DYNROOT_MOUNTNAME, AFS_DYNROOT_MOUNT_VNODE,
+ dirSize);
linkCount += 3;
for (cellidx = 0; cellidx < maxcellidx; cellidx++) {
dotLen = strlen(c->cellName) + 2;
dotCell = afs_osi_Alloc(dotLen);
osi_Assert(dotCell != NULL);
- strcpy(dotCell, ".");
- afs_strcat(dotCell, c->cellName);
+ 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));
+ VNUM_FROM_CIDX_RW(cellidx, 0), dirSize);
afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, dotCell,
- VNUM_FROM_CIDX_RW(cellidx, 1));
+ VNUM_FROM_CIDX_RW(cellidx, 1), dirSize);
afs_osi_Free(dotCell, dotLen);
linkCount += 2;
dotLen = strlen(ca->alias) + 2;
dotCell = afs_osi_Alloc(dotLen);
osi_Assert(dotCell != NULL);
- strcpy(dotCell, ".");
- afs_strcat(dotCell, ca->alias);
+ 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));
+ VNUM_FROM_CAIDX_RW(aliasidx, 0), dirSize);
afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, dotCell,
- VNUM_FROM_CAIDX_RW(aliasidx, 1));
+ VNUM_FROM_CAIDX_RW(aliasidx, 1), dirSize);
afs_osi_Free(dotCell, dotLen);
afs_PutCellAlias(ca);
}
ts = afs_dynSymlinkBase;
while (ts) {
int vnum = VNUM_FROM_TYPEID(VN_TYPE_SYMLINK, ts->index);
- afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ts->name, vnum);
+ afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ts->name, vnum,
+ dirSize);
ts = ts->next;
}
int curChunk, curPage;
char *newDir;
struct DirHeader *dirHeader;
+ size_t dirSize = AFS_PAGESIZE;
- newDir = afs_osi_Alloc(AFS_PAGESIZE);
+ newDir = afs_osi_Alloc(dirSize);
osi_Assert(newDir != NULL);
/*
memset(dirHeader->hashTable, 0, NHASHENT * sizeof(dirHeader->hashTable[0]));
/* Install "." and ".." */
- afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ".", 1);
- afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, "..", 1);
+ afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, ".", 1, dirSize);
+ afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk, "..", 1, dirSize);
ObtainWriteLock(&afs_dynrootDirLock, 549);
if (afs_dynrootMountDir)
afs_osi_Free(afs_dynrootMountDir, afs_dynrootMountDirLen);
afs_dynrootMountDir = newDir;
- afs_dynrootMountDirLen = AFS_PAGESIZE;
+ afs_dynrootMountDirLen = dirSize;
ReleaseWriteLock(&afs_dynrootDirLock);
}
linklen = strlen(ts->target);
avc->linkData = afs_osi_Alloc(linklen + 1);
osi_Assert(avc->linkData != NULL);
- strcpy(avc->linkData, ts->target);
+ osi_Assert(strlcpy(avc->linkData, ts->target, linklen + 1) <
+ linklen + 1);
status->Length = linklen;
status->UnixModeBits = 0755;
linklen = 7;
} else {
int namelen = strlen(realName);
+ char *prefix = rw ? "." : "";
linklen = rw + namelen;
avc->linkData = afs_osi_Alloc(linklen + 1);
osi_Assert(avc->linkData != NULL);
- strcpy(avc->linkData, rw ? "." : "");
- afs_strcat(avc->linkData, realName);
+ 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);
- strcpy(avc->linkData, "%");
- afs_strcat(avc->linkData, c->cellName);
- afs_strcat(avc->linkData, ":");
- afs_strcat(avc->linkData, bp);
+ 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;
afs_PutCell(c, READ_LOCK);
} else {
+ char *prefix = rw ? "%" : "#";
+
c = afs_GetCellByIndex(cellidx, READ_LOCK);
if (!c) {
afs_warn("dynroot vnode inconsistency, can't find cell %d\n",
linklen = 1 + namelen + 10;
avc->linkData = afs_osi_Alloc(linklen + 1);
osi_Assert(avc->linkData != NULL);
- strcpy(avc->linkData, rw ? "%" : "#");
- afs_strcat(avc->linkData, c->cellName);
- afs_strcat(avc->linkData, ":root.cell");
+ 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);
char *aname, char *atargetName)
{
struct afs_dynSymlink *tps;
+ size_t len;
if (afs_cr_uid(acred))
return EPERM;
osi_Assert(tps != NULL);
tps->index = afs_dynSymlinkIndex++;
tps->next = afs_dynSymlinkBase;
- tps->name = afs_osi_Alloc(strlen(aname) + 1);
+ len = strlen(aname) + 1;
+ tps->name = afs_osi_Alloc(len);
osi_Assert(tps->name != NULL);
- strcpy(tps->name, aname);
- tps->target = afs_osi_Alloc(strlen(atargetName) + 1);
+ osi_Assert(strlcpy(tps->name, aname, len) < len);
+ len = strlen(atargetName) + 1;
+ tps->target = afs_osi_Alloc(len);
osi_Assert(tps->target != NULL);
- strcpy(tps->target, atargetName);
+ osi_Assert(strlcpy(tps->target, atargetName, len) < len);
afs_dynSymlinkBase = tps;
ReleaseWriteLock(&afs_dynSymlinkLock);
#include "afs/sysincludes.h" /* Standard vendor system headers */
#ifndef UKERNEL
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_FBSD_ENV)
#include <net/if.h>
#include <netinet/in.h>
#endif
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN_ENV)
#include <netinet/in_var.h>
#endif
#endif /* !UKERNEL */
-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,
#include "afsincludes.h" /* Afs-based standard headers */
#include "afs/afs_stats.h"
#include "rx/rx_globals.h"
-#if !defined(UKERNEL) && !defined(AFS_LINUX20_ENV)
+#if !defined(UKERNEL) && !defined(AFS_LINUX_ENV)
#include "net/if.h"
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
#if !defined(AFS_HPUX110_ENV) && !defined(AFS_DARWIN_ENV)
struct afs_icl_set *afs_iclSetp = (struct afs_icl_set *)0;
struct afs_icl_set *afs_iclLongTermSetp = (struct afs_icl_set *)0;
-/* Matches below where ICL_APPENDLONG is 2 INT32s */
-#if (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_DARWIN_ENV) && defined(__amd64__)
-#define ICL_LONG 2
-#else
-#define ICL_LONG 1
-#endif
-
int afs_icl_sizeofLong = ICL_LONG;
int afs_icl_inited = 0;
/* init function, called once, under afs_icl_lock */
-int
+static int
afs_icl_Init(void)
{
afs_icl_inited = 1;
afs_int32 code;
struct afs_icl_log *logp;
struct afs_icl_set *setp;
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
size_t temp;
-#else /* AFS_SGI61_ENV */
+#else /* AFS_SGI_ENV */
#if defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)
afs_uint64 temp;
#else
afs_uint32 temp;
#endif
-#endif /* AFS_SGI61_ENV */
+#endif /* AFS_SGI_ENV */
char tname[65];
afs_int32 startCookie;
afs_int32 allocated;
#define ICL_APPENDLONG(lp, x) ICL_APPENDINT32((lp), (x))
#endif
-/* routine to tell whether we're dealing with the address or the
- * object itself
- */
-int
-afs_icl_UseAddr(int type)
-{
- if (type == ICL_TYPE_HYPER || type == ICL_TYPE_STRING
- || type == ICL_TYPE_FID || type == ICL_TYPE_INT64)
- return 1;
- else
- return 0;
-}
-void
+static void
afs_icl_AppendOne(struct afs_icl_log *logp, int type, long parm)
{
if (type) {
struct afs_icl_log **outLogpp)
{
struct afs_icl_log *logp;
+ size_t namelen;
/* add into global list under lock */
ObtainWriteLock(&afs_icl_lock, 183);
memset((caddr_t) logp, 0, sizeof(*logp));
logp->refCount = 1;
- logp->name = osi_AllocSmallSpace(strlen(name) + 1);
- strcpy(logp->name, name);
+ namelen = strlen(name) + 1;
+ logp->name = osi_AllocSmallSpace(namelen);
+ osi_Assert(strlcpy(logp->name, name, namelen) < namelen);
LOCK_INIT(&logp->lock, "logp lock");
logp->logSize = logSize;
logp->datap = NULL; /* don't allocate it until we need it */
return code;
}
-/* return basic parameter information about a log */
-int
-afs_icl_GetLogParms(struct afs_icl_log *logp, afs_int32 * maxSizep,
- afs_int32 * curSizep)
-{
- ObtainReadLock(&logp->lock);
- *maxSizep = logp->logSize;
- *curSizep = logp->logElements;
- ReleaseReadLock(&logp->lock);
- return 0;
-}
-
-
/* hold and release logs */
int
afs_icl_LogHold(struct afs_icl_log *logp)
return 0;
}
-/* hold and release logs, called with lock already held */
-int
-afs_icl_LogHoldNL(struct afs_icl_log *logp)
-{
- logp->refCount++;
- return 0;
-}
-
/* keep track of how many sets believe the log itself is allocated */
int
afs_icl_LogUse(struct afs_icl_log *logp)
return tp;
}
-int
-afs_icl_EnumerateLogs(int (*aproc)
- (char *name, char *arock, struct afs_icl_log * tp),
- char *arock)
-{
- struct afs_icl_log *tp;
- afs_int32 code;
-
- code = 0;
- ObtainWriteLock(&afs_icl_lock, 195);
- for (tp = afs_icl_allLogs; tp; tp = tp->nextp) {
- tp->refCount++; /* hold this guy */
- ReleaseWriteLock(&afs_icl_lock);
- ObtainReadLock(&tp->lock);
- code = (*aproc) (tp->name, arock, tp);
- ReleaseReadLock(&tp->lock);
- ObtainWriteLock(&afs_icl_lock, 196);
- if (--tp->refCount == 0)
- afs_icl_ZapLog(tp);
- if (code)
- break;
- }
- ReleaseWriteLock(&afs_icl_lock);
- return code;
-}
-
struct afs_icl_set *afs_icl_allSets = 0;
int
struct afs_icl_set *setp;
int i;
afs_int32 states = ICL_DEFAULT_SET_STATES;
+ size_t namelen;
ObtainWriteLock(&afs_icl_lock, 197);
if (!afs_icl_inited)
* the afs_icl_lock is still held, and thus the obtain can't block.
*/
ObtainWriteLock(&setp->lock, 199);
- setp->name = osi_AllocSmallSpace(strlen(name) + 1);
- strcpy(setp->name, name);
+ namelen = strlen(name) + 1;
+ setp->name = osi_AllocSmallSpace(namelen);
+ osi_Assert(strlcpy(setp->name, name, namelen) < namelen);
setp->nevents = ICL_DEFAULTEVENTS;
setp->eventFlags = afs_osi_Alloc(ICL_DEFAULTEVENTS);
osi_Assert(setp->eventFlags != NULL);
return 0;
}
-/* function to change event enabling information for a particular set */
-int
-afs_icl_SetEnable(struct afs_icl_set *setp, afs_int32 eventID, int setValue)
-{
- char *tp;
-
- ObtainWriteLock(&setp->lock, 200);
- if (!ICL_EVENTOK(setp, eventID)) {
- ReleaseWriteLock(&setp->lock);
- return -1;
- }
- tp = &setp->eventFlags[ICL_EVENTBYTE(eventID)];
- if (setValue)
- *tp |= ICL_EVENTMASK(eventID);
- else
- *tp &= ~(ICL_EVENTMASK(eventID));
- ReleaseWriteLock(&setp->lock);
- return 0;
-}
-
-/* return indication of whether a particular event ID is enabled
- * for tracing. If *getValuep is set to 0, the event is disabled,
- * otherwise it is enabled. All events start out enabled by default.
- */
-int
-afs_icl_GetEnable(struct afs_icl_set *setp, afs_int32 eventID, int *getValuep)
-{
- ObtainReadLock(&setp->lock);
- if (!ICL_EVENTOK(setp, eventID)) {
- ReleaseWriteLock(&setp->lock);
- return -1;
- }
- if (setp->eventFlags[ICL_EVENTBYTE(eventID)] & ICL_EVENTMASK(eventID))
- *getValuep = 1;
- else
- *getValuep = 0;
- ReleaseReadLock(&setp->lock);
- return 0;
-}
-
/* hold and release event sets */
int
afs_icl_SetHold(struct afs_icl_set *setp)
}
int
-afs_icl_EnumerateSets(int (*aproc)
- (char *name, char *arock, struct afs_icl_log * tp),
- char *arock)
-{
- struct afs_icl_set *tp, *np;
- afs_int32 code;
-
- code = 0;
- ObtainWriteLock(&afs_icl_lock, 205);
- for (tp = afs_icl_allSets; tp; tp = np) {
- tp->refCount++; /* hold this guy */
- ReleaseWriteLock(&afs_icl_lock);
- code = (*aproc) (tp->name, arock, (struct afs_icl_log *)tp);
- ObtainWriteLock(&afs_icl_lock, 206);
- np = tp->nextp; /* tp may disappear next, but not np */
- if (--tp->refCount == 0 && (tp->states & ICL_SETF_DELETED))
- afs_icl_ZapSet(tp);
- if (code)
- break;
- }
- ReleaseWriteLock(&afs_icl_lock);
- return code;
-}
-
-int
-afs_icl_AddLogToSet(struct afs_icl_set *setp, struct afs_icl_log *newlogp)
-{
- int i;
- int code = -1;
-
- ObtainWriteLock(&setp->lock, 207);
- for (i = 0; i < ICL_LOGSPERSET; i++) {
- if (!setp->logs[i]) {
- setp->logs[i] = newlogp;
- code = i;
- afs_icl_LogHold(newlogp);
- if (!(setp->states & ICL_SETF_FREED)) {
- /* bump up the number of sets using the log */
- afs_icl_LogUse(newlogp);
- }
- break;
- }
- }
- ReleaseWriteLock(&setp->lock);
- return code;
-}
-
-int
afs_icl_SetSetStat(struct afs_icl_set *setp, int op)
{
int i;
#include "afsincludes.h" /* Afs-based standard headers */
#include "afs/afs_stats.h" /* afs statistics */
#include "rx/rxstat.h"
-#if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED)
+#if defined(AFS_LINUX_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED)
# include <linux/cred.h>
#endif
afs_int32 cacheInfoModTime; /*Last time cache info modified */
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_NBSD_ENV)
struct mount *afs_cacheVfsp = 0;
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
struct super_block *afs_cacheSBp = 0;
#else
struct vfs *afs_cacheVfsp = 0;
#endif
afs_rwlock_t afs_discon_lock;
extern afs_rwlock_t afs_disconDirtyLock;
-#if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED)
+#if defined(AFS_LINUX_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED)
const struct cred *cache_creds;
#endif
if (code) {
return code;
}
-#if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED)
+#if defined(AFS_LINUX_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED)
/*
* Save current credentials for later access to disk cache files.
* If selinux, apparmor or other security modules are enabled,
{
afs_int32 code;
-#if defined(AFS_LINUX22_ENV)
+#if defined(AFS_LINUX_ENV)
struct dentry *dp;
code = gop_lookupname(filename, AFS_UIOSYS, 0, &dp);
if (code)
return code;
osi_get_fh(dp, inode);
dput(dp);
-#else /* AFS_LINUX22_ENV */
+#else /* AFS_LINUX_ENV */
struct vnode *filevp;
code = gop_lookupname(filename, AFS_UIOSYS, 0, &filevp);
if (code)
else {
AFS_RELE(filevp);
}
-#endif /* AFS_LINUX22_ENV */
+#endif /* AFS_LINUX_ENV */
return 0;
}
struct osi_stat tstat;
struct osi_file *tfile;
struct afs_fheader theader;
-#ifndef AFS_LINUX22_ENV
+#ifndef AFS_LINUX_ENV
struct vnode *filevp;
#endif
int goodFile;
AFS_STATCNT(afs_InitCacheInfo);
if (cacheDiskType != AFS_FCACHE_TYPE_UFS)
osi_Panic("afs_InitCacheInfo --- called for non-ufs cache!");
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
code = osi_InitCacheInfo(afile);
if (code)
return code;
# endif /* AFS_SUN5_ENV */
# if defined(AFS_SGI_ENV)
-# ifdef AFS_SGI65_ENV
VFS_STATVFS(filevp->v_vfsp, &st, NULL, code);
if (!code)
-# else
- if (!VFS_STATFS(filevp->v_vfsp, &st, NULL))
-# endif /* AFS_SGI65_ENV */
# elif defined(AFS_SUN5_ENV) || defined(AFS_HPUX100_ENV)
if (!VFS_STATVFS(filevp->v_vfsp, &st))
# elif defined(AFS_AIX41_ENV)
if (!VFS_STATFS(filevp->v_vfsp, &st, &afs_osi_cred))
-# elif defined(AFS_LINUX20_ENV)
- {
- KERNEL_SPACE_DECL;
- TO_USER_SPACE();
-
- VFS_STATFS(filevp->v_vfsp, &st);
- TO_KERNEL_SPACE();
- }
# elif defined(AFS_DARWIN80_ENV)
afs_cacheVfsp = vnode_mount(filevp);
if (afs_cacheVfsp && ((st = *(vfs_statfs(afs_cacheVfsp))),1))
afs_fsfragsize = st.f_bsize - 1;
# endif /* AFS_SUN5_ENV || AFS_HPUX100_ENV */
}
-# if defined(AFS_LINUX20_ENV)
- cacheInode.ufs = filevp->i_ino;
- afs_cacheSBp = filevp->i_sb;
-# elif defined(AFS_XBSD_ENV)
+# if defined(AFS_XBSD_ENV)
cacheInode.ufs = VTOI(filevp)->i_number;
cacheDev.mp = filevp->v_mount;
cacheDev.held_vnode = filevp;
afs_LookupInodeByPath(afile, &cacheInode.ufs, NULL);
# endif /* !AFS_CACHE_VNODE_PATH */
cacheDev.dev = afs_vnodeToDev(filevp);
-# endif /* AFS_LINUX20_ENV */
+# endif /* AFS_XBSD_ENV */
AFS_RELE(filevp);
-#endif /* AFS_LINUX22_ENV */
+#endif /* AFS_LINUX_ENV */
if (afs_fsfragsize < AFS_MIN_FRAGSIZE) {
afs_fsfragsize = AFS_MIN_FRAGSIZE;
}
osi_Assert(afs_sysnamelist[i] != NULL);
}
afs_sysname = afs_sysnamelist[0];
- strcpy(afs_sysname, SYS_NAME);
+ osi_Assert(strlcpy(afs_sysname, SYS_NAME, MAXSYSNAME) < MAXSYSNAME);
afs_sysnamecount = 1;
afs_sysnamegen++;
}
afs_server =
rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", &secobj, 1,
RXSTATS_ExecuteRequest);
+ AFS_GUNLOCK();
rx_StartServer(0);
+ AFS_GLOCK();
afs_osi_Wakeup(&afs_server); /* wakeup anyone waiting for it */
return 0;
pag_epoch = 0;
pagCounter = 0;
#if defined(AFS_XBSD_ENV)
- /* memcache never sets this, so don't panic on shutdown */
- if (volumeVnode != NULL) {
- vrele(volumeVnode); /* let it go, finally. */
+ {
+ struct vnode *volumeVnode_free = volumeVnode;
+ struct vnode *cacheDev_free = cacheDev.held_vnode;
volumeVnode = NULL;
- }
- if (cacheDev.held_vnode) {
- vrele(cacheDev.held_vnode);
cacheDev.held_vnode = NULL;
+
+ AFS_GUNLOCK();
+ /* memcache never sets these, so they may be NULL. */
+ if (volumeVnode_free != NULL) {
+ vrele(volumeVnode_free); /* let it go, finally. */
+ }
+ if (cacheDev_free != NULL) {
+ vrele(cacheDev_free);
+ }
+ AFS_GLOCK();
}
#endif /* AFS_XBSD_ENV */
#ifdef AFS_CACHE_VNODE_PATH
memset(&cacheDev, 0, sizeof(struct osi_dev));
osi_dnlc_shutdown();
}
-#if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED)
+#if defined(AFS_LINUX_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED)
put_cred(cache_creds);
#endif
} /*shutdown_cache */
{
AFS_STATCNT(shutdown_vnodeops);
if (afs_cold_shutdown) {
-#ifndef AFS_LINUX20_ENV
+#ifndef AFS_LINUX_ENV
afs_rd_stash_i = 0;
#endif
shutdown_mariner();
shutdown_server(void)
{
int i;
- struct afs_cbr *tcbrp, *tbrp;
struct srvAddr *sa;
for (i = 0; i < NSERVERS; i++) {
afs_ReleaseConns(sa->conns);
}
}
- for (tcbrp = ts->cbrs; tcbrp; tcbrp = tbrp) {
- /*
- * Free all server's callback structs
- */
- tbrp = tcbrp->next;
- afs_FreeCBR(tcbrp);
- }
afs_osi_Free(ts, sizeof(struct server));
ts = next;
}
lock->excl_locked = 0;
lock->wait_states = 0;
lock->num_waiting = 0;
-#if defined(INSTRUMENT_LOCKS)
lock->pid_last_reader = 0;
lock->pid_writer = 0;
lock->src_indicator = 0;
-#endif /* INSTRUMENT_LOCKS */
lock->time_waiting.tv_sec = 0;
lock->time_waiting.tv_usec = 0;
}
void
-ObtainLock(struct afs_lock *lock, int how,
- unsigned int src_indicator)
-{
- switch (how) {
- case READ_LOCK:
- if (!((lock)->excl_locked & WRITE_LOCK))
- (lock)->readers_reading++;
- else
- Afs_Lock_Obtain(lock, READ_LOCK);
-#if defined(INSTRUMENT_LOCKS)
- (lock)->pid_last_reader = MyPidxx;
-#endif /* INSTRUMENT_LOCKS */
- break;
- case WRITE_LOCK:
- if (!(lock)->excl_locked && !(lock)->readers_reading)
- (lock)->excl_locked = WRITE_LOCK;
- else
- Afs_Lock_Obtain(lock, WRITE_LOCK);
-#if defined(INSTRUMENT_LOCKS)
- (lock)->pid_writer = MyPidxx;
- (lock)->src_indicator = src_indicator;
-#endif /* INSTRUMENT_LOCKS */
- break;
- case SHARED_LOCK:
- if (!(lock)->excl_locked)
- (lock)->excl_locked = SHARED_LOCK;
- else
- Afs_Lock_Obtain(lock, SHARED_LOCK);
-#if defined(INSTRUMENT_LOCKS)
- (lock)->pid_writer = MyPidxx;
- (lock)->src_indicator = src_indicator;
-#endif /* INSTRUMENT_LOCKS */
- break;
- }
-}
-
-void
-ReleaseLock(struct afs_lock *lock, int how)
-{
- if (how == READ_LOCK) {
- if (!--lock->readers_reading && lock->wait_states) {
-#if defined(INSTRUMENT_LOCKS)
- if (lock->pid_last_reader == MyPidxx)
- lock->pid_last_reader = 0;
-#endif /* INSTRUMENT_LOCKS */
- Afs_Lock_ReleaseW(lock);
- }
- } else if (how == WRITE_LOCK) {
- lock->excl_locked &= ~WRITE_LOCK;
-#if defined(INSTRUMENT_LOCKS)
- lock->pid_writer = 0;
-#endif /* INSTRUMENT_LOCKS */
- if (lock->wait_states)
- Afs_Lock_ReleaseR(lock);
- } else if (how == SHARED_LOCK) {
- lock->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK);
-#if defined(INSTRUMENT_LOCKS)
- lock->pid_writer = 0;
-#endif /* INSTRUMENT_LOCKS */
- if (lock->wait_states)
- Afs_Lock_ReleaseR(lock);
- }
-}
-
-void
Afs_Lock_Obtain(struct afs_lock *lock, int how)
{
osi_timeval32_t tt1, tt2, et;
}
}
-/*
-Wait for some change in the lock status.
-void Lock_Wait(struct afs_lock *lock)
-{
- AFS_STATCNT(Lock_Wait);
- if (lock->readers_reading || lock->excl_locked) return 1;
- lock->wait_states |= READ_LOCK;
- afs_osi_Sleep(&lock->readers_reading);
- return 0;
-}
-*/
-
-/* These next guys exist to provide an interface to drop a lock atomically with
- * blocking. They're trivial to do in a non-preemptive LWP environment.
- */
-
-/* release a write lock and sleep on an address, atomically */
-void
-afs_osi_SleepR(char *addr, struct afs_lock *alock)
-{
- AFS_STATCNT(osi_SleepR);
- ReleaseReadLock(alock);
- afs_osi_Sleep(addr);
-}
-
-/* release a write lock and sleep on an address, atomically */
-void
-afs_osi_SleepW(char *addr, struct afs_lock *alock)
-{
- AFS_STATCNT(osi_SleepW);
- ReleaseWriteLock(alock);
- afs_osi_Sleep(addr);
-}
-
-/* release a write lock and sleep on an address, atomically */
-void
-afs_osi_SleepS(char *addr, struct afs_lock *alock)
-{
- AFS_STATCNT(osi_SleepS);
- ReleaseSharedLock(alock);
- afs_osi_Sleep(addr);
-}
/* Not static - used conditionally if lock tracing is enabled */
int
marinerPtr = 1;
}
tp = marinerNames[i];
- strncpy(tp, aname, SMAR);
- tp[SMAR - 1] = 0;
+ strlcpy(tp, aname, SMAR);
marinerVCs[i] = avc;
return 0;
}
afs_MarinerLog(char *astring, struct vcache *avc)
{
struct sockaddr_in taddr;
- char *tp, *tp1, *buf;
+ char *buf;
+ size_t bufsize, buflen;
struct iovec dvec;
AFS_STATCNT(afs_MarinerLog);
#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
taddr.sin_len = sizeof(taddr);
#endif
- tp = buf = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
+ bufsize = AFS_SMALLOCSIZ;
+ buf = osi_AllocSmallSpace(bufsize);
+
+ if (strlcpy(buf, astring, bufsize) >= bufsize)
+ goto done;
- strcpy(tp, astring);
- tp += strlen(astring);
if (avc) {
- *tp++ = ' ';
- tp1 = afs_GetMariner(avc);
- strcpy(tp, tp1);
- tp += strlen(tp1);
+ char *tp1 = afs_GetMariner(avc);
+
+ if (strlcat(buf, " ", bufsize) >= bufsize)
+ goto done;
+ if (strlcat(buf, tp1, bufsize) >= bufsize)
+ goto done;
}
- *tp++ = '\n';
+ if (strlcat(buf, "\n", bufsize) >= bufsize)
+ goto done;
+
/* note, console doesn't want a terminating null */
/* I don't care if mariner packets fail to be sent */
+ buflen = strlen(buf);
dvec.iov_base = buf;
- dvec.iov_len = tp - buf;
+ dvec.iov_len = buflen;
AFS_GUNLOCK();
- (void)rxi_NetSend(afs_server->socket, &taddr, &dvec, 1, tp - buf, 0);
+ (void)rxi_NetSend(afs_server->socket, &taddr, &dvec, 1, buflen, 0);
AFS_GLOCK();
+ done:
osi_FreeSmallSpace(buf);
} /*afs_MarinerLog */
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_SGI53_ENV
+#ifdef AFS_SGI_ENV
lock_t afs_event_lock;
-#endif
-
-#ifdef AFS_SGI64_ENV
flid_t osi_flid;
#endif
kmutex_t afs_global_lock;
#endif
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
-long afs_global_owner;
-#endif
-
#if defined(AFS_DARWIN_ENV)
thread_t afs_global_owner;
#ifdef AFS_DARWIN80_ENV
crdup(osi_curcred());
#elif defined(AFS_SUN5_ENV)
afs_osi_credp = kcred;
+#elif defined(AFS_DARWIN_ENV)
+ afs_osi_credp = afs_osi_Alloc(sizeof(*afs_osi_credp));
+ osi_Assert(afs_osi_credp != NULL);
+ memset(afs_osi_credp, 0, sizeof(*afs_osi_credp));
+# if defined(AFS_DARWIN80_ENV)
+ afs_osi_credp->cr_ref = 1; /* kauth_cred_get_ref needs 1 existing ref */
+# endif
#else
memset(&afs_osi_cred, 0, sizeof(afs_ucred_t));
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX_ENV)
afs_set_cr_group_info(&afs_osi_cred, groups_alloc(0));
#endif
-#if defined(AFS_DARWIN80_ENV)
- afs_osi_cred.cr_ref = 1; /* kauth_cred_get_ref needs 1 existing ref */
-#else
-# if !(defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED))
+#if !(defined(AFS_LINUX_ENV) && defined(STRUCT_TASK_STRUCT_HAS_CRED))
crhold(&afs_osi_cred); /* don't let it evaporate */
-# endif
#endif
afs_osi_credp = &afs_osi_cred;
#endif
afs_osicred_initialized = 1;
}
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
osi_flid.fl_pid = osi_flid.fl_sysid = 0;
#endif
void
afs_osi_MaskSignals(void)
{
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
osi_linux_mask();
#endif
}
void
afs_osi_UnmaskRxkSignals(void)
{
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
osi_linux_unmaskrxk();
#endif
}
#endif
}
-void
-afs_osi_UnmaskUserLoop(void)
-{
-#ifdef AFS_DARWIN_ENV
- afs_osi_fullSigRestore();
-#endif
-}
-
/* register rxk listener proc info */
void
afs_osi_RxkRegister(void)
void
afs_osi_Invisible(void)
{
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
afs_osi_MaskSignals();
#elif defined(AFS_SUN5_ENV)
curproc->p_flag |= SSYS;
afs_osi_ctxtp_initialized = 0;
}
#endif
-#if !defined(AFS_HPUX_ENV) && !defined(UKERNEL) && !defined(AFS_DFBSD_ENV) && !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_HPUX_ENV) && !defined(UKERNEL) && !defined(AFS_DFBSD_ENV) && !defined(AFS_LINUX_ENV)
/* LINUX calls this from afs_cleanup() which hooks into module_exit */
shutdown_osisleep();
#endif
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)
osi_FreeSmallSpace(tmp);
-#elif defined(AFS_LINUX26_ENV)
+#elif defined(AFS_LINUX_ENV)
kfree(tmp);
-#elif defined(AFS_LINUX20_ENV)
- osi_linux_free(tmp);
#endif
}
}
#define _AFS_OSI_
#include "h/types.h"
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX_ENV)
#include "h/param.h"
#endif
#include <sys/lock.h>
#endif
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#ifndef _LINUX_CODA_FS_I
#define _LINUX_CODA_FS_I
#define _CODA_HEADER_
struct osi_file {
afs_int32 size; /* file size in bytes XXX Must be first field XXX */
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
struct file *filp; /* May need this if we really open the file. */
#else
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
struct dentry dentry; /* merely to hold the pointer to the inode. */
struct file file; /* May need this if we really open the file. */
#else
*
* Darwin, all of the BSDs, and Linux have their own
*/
-#if !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_LINUX_ENV)
# define vType(vc) AFSTOV(vc)->v_type
# define vSetType(vc,type) AFSTOV(vc)->v_type = (type)
# define vSetVfsp(vc,vfsp) AFSTOV(vc)->v_vfsp = (vfsp)
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.
*
* Is DEBUG only for turning the ASSERT() macro? If so, we should
* be able to eliminate DEBUG entirely.
*/
-#if !defined(AFS_SGI65_ENV) && !defined(AFS_NBSD_ENV)
+#if !defined(AFS_SGI_ENV) && !defined(AFS_NBSD_ENV)
#ifndef DEBUG
#define DEBUG 1 /* Default is to enable debugging/logging */
#endif
* different platforms. We require a fixed size timeval, at least for the
* xstats.
*/
+#define SIZEOF_OSI_TIMEVAL32_T 8
typedef struct {
afs_int32 tv_sec;
afs_int32 tv_usec;
#define AFS_NUMPAGGROUPS 2
#endif
+#ifdef AFS_LINUX_ENV
+extern int osi_ShouldDeferRemunlink(struct vcache *avc);
+#else
+# 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_ */
AFS_STATS(afs_stats_cmperf.OutStandingAllocs++);
AFS_STATS(afs_stats_cmperf.OutStandingMemUsage += size);
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
return osi_linux_alloc(size, 1);
#else
return AFS_KALLOC(size);
AFS_STATS(afs_stats_cmperf.OutStandingAllocs--);
AFS_STATS(afs_stats_cmperf.OutStandingMemUsage -= asize);
-#if defined(AFS_LINUX20_ENV)
+#if defined(AFS_LINUX_ENV)
osi_linux_free(x);
#else
AFS_KFREE(x, asize);
genpag(void)
{
AFS_STATCNT(genpag);
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
/* Ensure unique PAG's (mod 200 days) when reloading the client. */
return (('A' << 24) + ((pag_epoch + pagCounter++) & 0xffffff));
-#else /* AFS_LINUX20_ENV */
+#else /* AFS_LINUX_ENV */
return (('A' << 24) + (pagCounter++ & 0xffffff));
-#endif /* AFS_LINUX20_ENV */
+#endif /* AFS_LINUX_ENV */
}
afs_uint32
getpag(void)
{
AFS_STATCNT(getpag);
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
/* Ensure unique PAG's (mod 200 days) when reloading the client. */
return (('A' << 24) + ((pag_epoch + pagCounter) & 0xffffff));
#else
genpag(void)
{
AFS_STATCNT(genpag);
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
return (pag_epoch + pagCounter++);
#else
return (pagCounter++);
-#endif /* AFS_LINUX20_ENV */
+#endif /* AFS_LINUX_ENV */
}
afs_uint32
getpag(void)
{
AFS_STATCNT(getpag);
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
/* Ensure unique PAG's (mod 200 days) when reloading the client. */
return (pag_epoch + pagCounter);
#else
int code = 0;
-#if defined(AFS_SGI53_ENV) && defined(MP)
+#if defined(AFS_SGI_ENV) && defined(MP)
/* This is our first chance to get the global lock. */
AFS_GLOCK();
-#endif /* defined(AFS_SGI53_ENV) && defined(MP) */
+#endif /* defined(AFS_SGI_ENV) && defined(MP) */
AFS_STATCNT(afs_setpag);
credp = OSI_GET_CURRENT_CRED();
code = AddPag(genpag(), &credp);
}
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
{
afs_ucred_t *credp = crref();
code = AddPag(genpag(), &credp);
setuerror(code);
#endif
-#if defined(AFS_SGI53_ENV) && defined(MP)
+#if defined(AFS_SGI_ENV) && defined(MP)
AFS_GUNLOCK();
-#endif /* defined(AFS_SGI53_ENV) && defined(MP) */
+#endif /* defined(AFS_SGI_ENV) && defined(MP) */
return (code);
}
int code = 0;
-#if defined(AFS_SGI53_ENV) && defined(MP)
+#if defined(AFS_SGI_ENV) && defined(MP)
/* This is our first chance to get the global lock. */
AFS_GLOCK();
-#endif /* defined(AFS_SGI53_ENV) && defined(MP) */
+#endif /* defined(AFS_SGI_ENV) && defined(MP) */
AFS_STATCNT(afs_setpag);
credp = OSI_GET_CURRENT_CRED();
code = AddPag(pagval, &credp);
}
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
{
afs_ucred_t *credp = crref();
code = AddPag(pagval, &credp);
if (!getuerror())
setuerror(code);
#endif
-#if defined(AFS_SGI53_ENV) && defined(MP)
+#if defined(AFS_SGI_ENV) && defined(MP)
AFS_GUNLOCK();
-#endif /* defined(AFS_SGI53_ENV) && defined(MP) */
+#endif /* defined(AFS_SGI_ENV) && defined(MP) */
return (code);
}
int
afs_InitReq(struct vrequest *av, afs_ucred_t *acred)
{
-#if defined(AFS_LINUX26_ENV) && !defined(AFS_NONFSTRANS)
+#if defined(AFS_LINUX_ENV) && !defined(AFS_NONFSTRANS)
int code;
#endif
if (afs_shuttingdown == AFS_SHUTDOWN)
return EIO;
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
#if !defined(AFS_NONFSTRANS)
if (osi_linux_nfs_initreq(av, acred, &code))
return code;
}
#endif
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
/* osi_get_group_pag is defined in <ARCH>/osi_groups.c */
#elif defined(AFS_PAG_ONEGROUP_ENV)
/* osi_get_group_pag is defined in <ARCH>/osi_groups.c */
# if defined(AFS_AIX_ENV)
if (cred->cr_ngrps < 2)
return NOPAG;
-# elif defined(AFS_LINUX26_ENV)
+# elif defined(AFS_LINUX_ENV)
if (afs_cr_group_info(cred)->ngroups < AFS_NUMPAGGROUPS)
return NOPAG;
-# elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_XBSD_ENV)
+# elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_XBSD_ENV)
# if defined(AFS_SUN510_ENV)
if (ngroups < 2) {
# else
return NOPAG;
}
#ifndef AFS_DARWIN110_ENV
-#if defined(AFS_LINUX26_ENV) && defined(LINUX_KEYRING_SUPPORT)
+#if defined(AFS_LINUX_ENV) && defined(LINUX_KEYRING_SUPPORT)
/*
* If linux keyrings are in use and we carry the session keyring in our credentials
* structure, they should be the only criteria for determining
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN80_ENV)
/* This is the common part of the vget VFS call. */
int
afs_osi_vget(struct vcache **avcpp, struct fid *afidp, struct vrequest *areqp)
return code;
}
-#endif /* AFS_LINUX20_ENV */
+#endif /* AFS_LINUX_ENV */
osi_Active(struct vcache *avc)
{
AFS_STATCNT(osi_Active);
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || (AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || (AFS_LINUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
if ((avc->opens > 0) || (avc->f.states & CMAPPED))
return 1; /* XXX: Warning, verify this XXX */
#elif defined(AFS_SGI_ENV)
#include "afs/afs_stats.h"
#include "rx/rx_globals.h"
#include "rx/rxstat.h"
-#if !defined(UKERNEL) && !defined(AFS_LINUX20_ENV)
+#if !defined(UKERNEL) && !defined(AFS_LINUX_ENV)
#include "net/if.h"
#include "netinet/in_var.h"
#endif /* !defined(UKERNEL) */
afs_uuid_create(&afs_cb_interface.uuid);
AFS_GLOCK();
-
afs_InitStats();
+ AFS_GUNLOCK();
+
rx_Init(htons(7001));
+ AFS_GLOCK();
+
AFS_STATCNT(afs_ResourceInit);
AFS_RWLOCK_INIT(&afs_xuser, "afs_xuser");
AFS_RWLOCK_INIT(&afs_xpagcell, "afs_xpagcell");
osi_Assert(afs_sysnamelist[i] != NULL);
}
afs_sysname = afs_sysnamelist[0];
- strcpy(afs_sysname, SYS_NAME);
+ osi_Assert(strlcpy(afs_sysname, SYS_NAME, MAXSYSNAME) < MAXSYSNAME);
afs_sysnamecount = 1;
afs_sysnamegen++;
1, RXSTATS_ExecuteRequest);
pagcb_svc = rx_NewService(0, PAGCB_SERVICEID, "pagcb", &srv_secobj,
1, PAGCB_ExecuteRequest);
+ AFS_GUNLOCK();
rx_StartServer(0);
+ AFS_GLOCK();
clt_secobj = rxnull_NewClientSecurityObject();
rmtsys_conn = rx_NewConnection(nfs_server_addr, htons(7009),
RMTSYS_SERVICEID, clt_secobj, 0);
#ifdef RXK_LISTENER_ENV
- afs_start_thread(rxk_Listener, "Rx Listener");
+ afs_start_thread(rxk_Listener, "Rx Listener", 1);
#endif
- afs_start_thread((void *)(void *)rx_ServerProc, "Rx Server Thread");
- afs_start_thread(afs_rxevent_daemon, "Rx Event Daemon");
- afs_start_thread(afs_Daemon, "AFS PAG Daemon");
+ afs_start_thread((void *)(void *)rx_ServerProc, "Rx Server Thread", 0);
+ afs_start_thread(afs_rxevent_daemon, "Rx Event Daemon", 1);
+ afs_start_thread(afs_Daemon, "AFS PAG Daemon", 1);
afs_icl_InitLogs();
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;
tcell = afs_osi_Alloc(sizeof(struct afspag_cell));
if (!tcell)
goto out;
- tcell->cellname = afs_osi_Alloc(strlen(acell) + 1);
+ tcell->cellname = afs_strdup(acell);
if (!tcell->cellname) {
afs_osi_Free(tcell, sizeof(struct afspag_cell));
tcell = 0;
goto out;
}
- strcpy(tcell->cellname, acell);
tcell->cellnum = ++lastcell;
tcell->next = cells;
cells = tcell;
}
-struct afspag_cell *
+static struct afspag_cell *
afspag_GetPrimaryCell(void)
{
struct afspag_cell *tcell;
goto out;
for (i = 0; i < afs_sysnamecount; i++) {
- a_sysnames->SysNameList_val[i].sysname =
- afs_osi_Alloc(strlen(afs_sysnamelist[i]) + 1);
+ a_sysnames->SysNameList_val[i].sysname = afs_strdup(afs_sysnamelist[i]);
if (!a_sysnames->SysNameList_val[i].sysname)
goto out;
- strcpy(a_sysnames->SysNameList_val[i].sysname, afs_sysnamelist[i]);
}
ReleaseReadLock(&afs_xpagsys);
DECL_PIOCTL(PNewUuid);
DECL_PIOCTL(PPrecache);
DECL_PIOCTL(PGetPAG);
-#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX24_ENV)
+#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX_ENV)
DECL_PIOCTL(PSetCachingThreshold);
#endif
+DECL_PIOCTL(PGetLiteralFID);
/*
* A macro that says whether we're going to need HandleClientContext().
PPrecache, /* 12 */
PGetPAG, /* 13 */
PFlushAllVolumeData, /* 14 */
+ PGetLiteralFID, /* 15 -- get FID from parent directory */
};
static pioctlFunction OpioctlSw[] = {
PBogus, /* 0 */
PNFSNukeCreds, /* 1 -- nuke all creds for NFS client */
-#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX24_ENV)
+#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX_ENV)
PSetCachingThreshold /* 2 -- get/set cache-bypass size threshold */
#else
PNoop /* 2 -- get/set cache-bypass size threshold */
# endif
#elif defined(AFS_SGI_ENV)
-# if defined(AFS_SGI65_ENV)
afs_ioctl(OSI_VN_DECL(tvc), int cmd, void *arg, int flag, cred_t * cr,
rval_t * rvalp, struct vopbd * vbds)
-# else
-afs_ioctl(OSI_VN_DECL(tvc), int cmd, void *arg, int flag, cred_t * cr,
- rval_t * rvalp, struct vopbd * vbds)
-# endif
{
struct afs_ioctl data;
int error = 0;
return (code);
}
-#elif defined(AFS_LINUX22_ENV)
+#elif defined(AFS_LINUX_ENV)
struct afs_ioctl_sys {
unsigned int com;
unsigned long arg;
AFS_GLOCK();
code = afs_syscall_pioctl(uap->path, uap->cmd, uap->cmarg, uap->follow);
AFS_GUNLOCK();
-# ifdef AFS_SGI64_ENV
return code;
-# else
- return u.u_error;
-# endif
}
#elif defined(AFS_FBSD_ENV)
#endif
/* macro to avoid adding any more #ifdef's to pioctl code. */
-#if defined(AFS_LINUX22_ENV) || defined(AFS_AIX41_ENV)
+#if defined(AFS_LINUX_ENV) || defined(AFS_AIX41_ENV)
#define PIOCTL_FREE_CRED() crfree(credp)
#else
#define PIOCTL_FREE_CRED()
#ifdef AFS_NEED_CLIENTCONTEXT
afs_ucred_t *tmpcred = NULL;
#endif
-#if defined(AFS_NEED_CLIENTCONTEXT) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_NEED_CLIENTCONTEXT) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
afs_ucred_t *foreigncreds = NULL;
#endif
afs_int32 code = 0;
#ifdef AFS_AIX41_ENV
struct ucred *credp = crref(); /* don't free until done! */
#endif
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
cred_t *credp = crref(); /* don't free until done! */
struct dentry *dp;
#endif
}
if ((com & 0xff) == PSetClientContext) {
#ifdef AFS_NEED_CLIENTCONTEXT
-#if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV)
+#if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX_ENV)
code = HandleClientContext(&data, &com, &foreigncreds, credp);
#else
code = HandleClientContext(&data, &com, &foreigncreds, osi_curcred());
* like afs_osi_suser(cred) which, I think, is better since it
* generalizes and supports multi cred environments...
*/
-#if defined(AFS_SUN5_ENV) || defined(AFS_LINUX22_ENV)
+#if defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV)
tmpcred = credp;
credp = foreigncreds;
#elif defined(AFS_AIX41_ENV)
if ((com & 0xff00) >> 8 == 'V' && (com & 0xff) == 15) {
/* special case prefetch so entire pathname eval occurs in helper process.
* otherwise, the pioctl call is essentially useless */
-#if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
code =
Prefetch(path, &data, follow,
foreigncreds ? foreigncreds : credp);
lookupname(path, USR, follow, NULL, &vp,
foreigncreds ? foreigncreds : credp);
#else
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
code = gop_lookupname_user(path, AFS_UIOUSER, follow, &dp);
if (!code)
vp = (struct vnode *)dp->d_inode;
#else
code = gop_lookupname_user(path, AFS_UIOUSER, follow, &vp);
-#endif /* AFS_LINUX22_ENV */
+#endif /* AFS_LINUX_ENV */
#endif /* AFS_AIX41_ENV */
AFS_GLOCK();
if (code) {
credp = OSI_GET_CURRENT_CRED();
code = afs_HandlePioctl(vp, com, &data, follow, &credp);
}
-#elif defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#elif defined(AFS_LINUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
code = afs_HandlePioctl(vp, com, &data, follow, &credp);
#elif defined(UKERNEL)
code = afs_HandlePioctl(vp, com, &data, follow,
set_p_cred(u.u_procp, tmpcred); /* restore original credentials */
#elif defined(AFS_SGI_ENV)
OSI_SET_CURRENT_CRED(tmpcred); /* restore original credentials */
-#elif defined(AFS_SUN5_ENV) || defined(AFS_LINUX22_ENV)
+#elif defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV)
credp = tmpcred; /* restore original credentials */
#else
osi_curcred() = tmpcred; /* restore original credentials */
}
#endif /* AFS_NEED_CLIENTCONTEXT */
if (vp) {
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
/*
* Holding the global lock when calling dput can cause a deadlock
* when the kernel calls back into afs_dentry_iput
AFS_GLOCK();
#else
#if defined(AFS_FBSD_ENV)
- if (VOP_ISLOCKED(vp))
+ if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE)
VOP_UNLOCK(vp, 0);
#endif /* AFS_FBSD_ENV */
AFS_RELE(vp); /* put vnode back */
*
* \post Changed ACL, via direct writing to the wire
*/
-int
-dummy_PSetAcl(char *ain, char *aout)
-{
- return 0;
-}
-
DECL_PIOCTL(PSetAcl)
{
afs_int32 code;
if (tconn) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STOREACL);
RX_AFS_GUNLOCK();
- code =
- RXAFS_StoreACL(rxconn, (struct AFSFid *)&avc->f.fid.Fid,
- &acl, &OutStatus, &tsync);
+ code = RXAFS_StoreACL(rxconn, (struct AFSFid *)&avc->f.fid.Fid,
+ &acl, &OutStatus, &tsync);
+ if (code == RXGEN_OPCODE)
+ code = RXAFS_OldStoreACL(rxconn,
+ (struct AFSFid *)&avc->f.fid.Fid,
+ &acl, &OutStatus, &tsync);
RX_AFS_GLOCK();
XSTATS_END_TIME;
} else
}
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX_ENV)
static_inline int
_settok_setParentPag(afs_ucred_t **cred)
{
}
/*!
+ * Lookup name in the directory associated with given vcache.
+ *
+ * \param[in] avc vcache associated with directory
+ * \param[in] areq request to be passed on
+ * \param[in] aname name to be searched
+ * \param[out] asys resolved name (replace @sys by system type)
+ * \param[out] afid fid associated with aname
+ *
+ * \return 0 on success; non-zero otherwise.
+ *
+ * \notes The caller must free asys->name if asys->name_size != 0.
+ */
+static int
+afs_LookupName(struct vcache *avc, struct vrequest *areq, char *aname,
+ struct sysname_info *asys, struct VenusFid *afid)
+{
+ int code;
+ struct dcache *tdc;
+ afs_size_t offset, len;
+
+ /* 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, "
+ "%p, %p.\n", avc, areq, aname, asys, afid);
+ code = EIO;
+ goto done;
+ }
+
+ /* check if vcache is up to date */
+ code = afs_VerifyVCache(avc, areq);
+ if (code != 0) {
+ goto done;
+ }
+
+ /* must be a directory */
+ if (vType(avc) != VDIR) {
+ code = ENOTDIR;
+ goto done;
+ }
+
+ tdc = afs_GetDCache(avc, 0, areq, &offset, &len, 1);
+ if (!tdc) {
+ code = EIO;
+ goto done;
+ }
+
+ /* if @sys is present, replace it by the machine's system type */
+ Check_AtSys(avc, aname, asys, areq);
+ ObtainReadLock(&tdc->lock);
+
+ do {
+ /*
+ * Lookup name in the appropriate directory. If name is not found, try
+ * again with the next sysname from the @sys list.
+ */
+ code = afs_dir_Lookup(tdc, asys->name, &afid->Fid);
+ } while (code == ENOENT && Next_AtSys(avc, areq, asys));
+
+ ReleaseReadLock(&tdc->lock);
+ afs_PutDCache(tdc);
+ done:
+ return code;
+}
+
+/*!
* VIOC_AFS_STAT_MT_PT (29) - Stat mount point
*
* \ingroup pioctl
{
afs_int32 code;
struct vcache *tvc;
- struct dcache *tdc;
struct VenusFid tfid;
char *bufp;
char *name;
struct sysname_info sysState;
- afs_size_t offset, len;
AFS_STATCNT(PNewStatMount);
+ memset(&sysState, 0, sizeof(sysState));
+
if (!avc)
return EINVAL;
if (afs_pd_getStringPtr(ain, &name) != 0)
return EINVAL;
- code = afs_VerifyVCache(avc, areq);
- if (code)
- return code;
- if (vType(avc) != VDIR) {
- return ENOTDIR;
- }
- tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 1);
- if (!tdc)
- return EIO;
- Check_AtSys(avc, name, &sysState, areq);
- ObtainReadLock(&tdc->lock);
- do {
- code = afs_dir_Lookup(tdc, sysState.name, &tfid.Fid);
- } while (code == ENOENT && Next_AtSys(avc, areq, &sysState));
- ReleaseReadLock(&tdc->lock);
- afs_PutDCache(tdc); /* we're done with the data */
- bufp = sysState.name;
+ code = afs_LookupName(avc, areq, name, &sysState, &tfid);
if (code) {
goto out;
}
+
+ bufp = sysState.name;
tfid.Cell = avc->f.fid.Cell;
tfid.Fid.Volume = avc->f.fid.Fid.Volume;
if (!tfid.Fid.Unique && (avc->f.states & CForeign)) {
ReleaseWriteLock(&tvc->lock);
afs_PutVCache(tvc);
out:
- if (sysState.allocked)
- osi_FreeLargeSpace(bufp);
+ if (sysState.name_size != 0)
+ osi_FreeLargeSpace(sysState.name);
return code;
}
{
char *tp;
afs_int32 code;
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
size_t bufferSize;
#else
u_int bufferSize;
ReleaseWriteLock(&avc->lock);
code = 0;
out:
- if (sysState.allocked)
+ if (sysState.name_size != 0)
osi_FreeLargeSpace(bufp);
return code;
}
int t, count, num = 0, allpags = 0;
char **sysnamelist;
struct afs_pdata validate;
+ size_t len;
AFS_STATCNT(PSetSysName);
if (!afs_globalVFS) {
}
} else {
foundname = num;
- strcpy(outname, sysnamelist[0]);
+ len = sizeof(outname);
+ if (strlcpy(outname, sysnamelist[0], len) >= len) {
+ afs_PutUser(au, READ_LOCK);
+ return E2BIG;
+ }
}
afs_PutUser(au, READ_LOCK);
if (setsysname)
if (!afs_sysname)
osi_Panic("PSetSysName: !afs_sysname\n");
if (!setsysname) { /* user just wants the info */
- strcpy(outname, afs_sysname);
+ len = sizeof(outname);
+ if (strlcpy(outname, afs_sysname, len) >= len)
+ return E2BIG;
foundname = afs_sysnamecount;
sysnamelist = afs_sysnamelist;
} else { /* Local guy; only root can change sysname */
if (strlen(inname) >= MAXSYSNAME-1)
return EINVAL;
- strcpy(afs_sysname, inname);
+ if (strlcpy(afs_sysname, inname, MAXSYSNAME) >= MAXSYSNAME)
+ return E2BIG;
if (setsysname > 1) { /* ... or list */
for (count = 1; count < setsysname; ++count) {
sizeof(struct cm_initparams));
}
-#ifdef AFS_SGI65_ENV
+#ifdef AFS_SGI_ENV
/* They took crget() from us, so fake it. */
static cred_t *
crget(void)
*/
i = (*com) & 0xff;
if (!afs_osi_suser(credp)) {
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI64_ENV)
- /* Since SGI's suser() returns explicit failure after the call.. */
- u.u_error = 0;
-#endif
/* check for acceptable opcodes for normal folks, which are, so far,
* get/set tokens, sysname, and unlog.
*/
#ifdef AFS_AIX51_ENV
newcred->cr_groupset.gs_union.un_groups[0] = g0;
newcred->cr_groupset.gs_union.un_groups[1] = g1;
-#elif defined(AFS_LINUX26_ENV)
+#elif defined(AFS_LINUX_ENV)
# ifdef AFS_PAG_ONEGROUP_ENV
afs_set_cr_group_info(newcred, groups_alloc(1)); /* nothing sets this */
l = (((g0-0x3f00) & 0x3fff) << 14) | ((g1-0x3f00) & 0x3fff);
#endif
#ifdef AFS_AIX_ENV
newcred->cr_ngrps = 2;
-#elif !defined(AFS_LINUX26_ENV) && !defined(AFS_SUN510_ENV)
-# if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_FBSD_ENV)
+#elif !defined(AFS_LINUX_ENV) && !defined(AFS_SUN510_ENV)
+# if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV)
newcred->cr_ngroups = 2;
# else
for (i = 2; i < NGROUPS; i++)
{
afs_int32 code;
struct vcache *tvc;
- struct dcache *tdc;
struct VenusFid tfid;
char *bufp;
char *mount;
struct sysname_info sysState;
- afs_size_t offset, len;
AFS_STATCNT(PFlushMount);
+ memset(&sysState, 0, sizeof(sysState));
+
if (!avc)
return EINVAL;
if (afs_pd_getStringPtr(ain, &mount) != 0)
return EINVAL;
- code = afs_VerifyVCache(avc, areq);
- if (code)
- return code;
- if (vType(avc) != VDIR) {
- return ENOTDIR;
- }
- tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 1);
- if (!tdc)
- return EIO;
- Check_AtSys(avc, mount, &sysState, areq);
- ObtainReadLock(&tdc->lock);
- do {
- code = afs_dir_Lookup(tdc, sysState.name, &tfid.Fid);
- } while (code == ENOENT && Next_AtSys(avc, areq, &sysState));
- ReleaseReadLock(&tdc->lock);
- afs_PutDCache(tdc); /* we're done with the data */
- bufp = sysState.name;
+ code = afs_LookupName(avc, areq, mount, &sysState, &tfid);
if (code) {
goto out;
}
+
+ bufp = sysState.name;
tfid.Cell = avc->f.fid.Cell;
tfid.Fid.Volume = avc->f.fid.Fid.Volume;
if (!tfid.Fid.Unique && (avc->f.states & CForeign)) {
ReleaseWriteLock(&tvc->lock);
afs_PutVCache(tvc);
out:
- if (sysState.allocked)
- osi_FreeLargeSpace(bufp);
+ if (sysState.name_size != 0)
+ osi_FreeLargeSpace(sysState.name);
return code;
}
if (vType(tvc) == VLNK) {
ObtainWriteLock(&tvc->lock, 555);
if (afs_HandleLink(tvc, areq) == 0)
- strncpy((char *)&Outputs->chars, tvc->linkData, MAXCMDCHARS);
+ strlcpy((char *)&Outputs->chars, tvc->linkData, MAXCMDCHARS);
ReleaseWriteLock(&tvc->lock);
}
}
return 0;
}
-#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX24_ENV)
+#if defined(AFS_CACHE_BYPASS) && defined(AFS_LINUX_ENV)
DECL_PIOCTL(PSetCachingThreshold)
{
if (!ts->cell) /* not really an active server, anyway, it must */
continue; /* have just been added by setsprefs */
+ if ((sa->sa_flags & SRVADDR_ISDOWN) == 0 && !afs_HaveCallBacksFrom(ts)) {
+ /* Server is up, and we have no active callbacks from it. */
+ continue;
+ }
+
/* get a connection, even if host is down; bumps conn ref count */
tu = afs_GetUser(areq->uid, ts->cell->cellNum, SHARED_LOCK);
tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cellNum, tu,
if (!tc)
continue;
- if ((sa->sa_flags & SRVADDR_ISDOWN) || afs_HaveCallBacksFrom(ts)) {
- if (sa->sa_flags & SRVADDR_ISDOWN) {
- rx_SetConnDeadTime(rxconn, 3);
- }
+ if (sa->sa_flags & SRVADDR_ISDOWN) {
+ rx_SetConnDeadTime(rxconn, 3);
+ }
#ifdef RX_ENABLE_LOCKS
- AFS_GUNLOCK();
+ AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS */
- code = RXAFS_CallBackRxConnAddr(rxconn, &addr);
+ code = RXAFS_CallBackRxConnAddr(rxconn, &addr);
#ifdef RX_ENABLE_LOCKS
- AFS_GLOCK();
+ AFS_GLOCK();
#endif /* RX_ENABLE_LOCKS */
- }
+
afs_PutConn(tc, rxconn, SHARED_LOCK); /* done with it now */
} /* Outer loop over addrs */
afs_osi_Free(addrs, srvAddrCount * sizeof(*addrs));
ReleaseWriteLock(&afs_xuser);
return 0;
}
+
+/*!
+ * VIOC_GETLITERALFID (15) - Get FID from parent directory.
+ *
+ * Same as VIOCGETFID, but instead of getting the FID directly from the vcache,
+ * get this information by looking up the last component in the parent
+ * directory.
+ *
+ * \ingroup pioctl
+ *
+ * \param[in] ain last component in a path
+ * \param[out] aout 'struct VenusFid' for the FID associated with 'ain'
+ *
+ * \return 0 on success; errno otherwise.
+ */
+DECL_PIOCTL(PGetLiteralFID)
+{
+ int code;
+ char *name;
+ struct VenusFid tfid;
+ struct sysname_info sysState;
+
+ AFS_STATCNT(PGetLiteralFID);
+
+ memset(&tfid, 0, sizeof(tfid));
+ memset(&sysState, 0, sizeof(sysState));
+
+ if (!avc || (afs_pd_getStringPtr(ain, &name) != 0)) {
+ code = EINVAL;
+ goto out;
+ }
+
+ /* get fid associated with name */
+ code = afs_LookupName(avc, areq, name, &sysState, &tfid);
+ if (code) {
+ goto out;
+ }
+
+ tfid.Cell = avc->f.fid.Cell;
+ tfid.Fid.Volume = avc->f.fid.Fid.Volume;
+ code = afs_pd_putBytes(aout, &tfid, sizeof(tfid));
+ out:
+ if (sysState.name_size != 0) {
+ osi_FreeLargeSpace(sysState.name);
+ }
+ return code;
+}
/* afs_call.c */
extern int afs_cold_shutdown;
extern char afs_rootVolumeName[MAXROOTVOLNAMELEN];
-extern void afs_shutdown(void);
extern void afs_FlushCBs(void);
extern int afs_CheckInit(void);
-extern void afs_shutdown(void);
+/* for afs_shutdown */
+enum afs_shutdown_type {
+ AFS_WARM = 0,
+ AFS_COLD = 1,
+};
+extern void afs_shutdown(enum afs_shutdown_type);
+
+
extern void shutdown_afstest(void);
extern int afs_syscall_call(long parm, long parm2, long parm3,
long parm4, long parm5, long parm6);
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_size_t asparm0, afs_size_t asparm1,
void *apparm0, void *apparm1,
void *apparm2);
-extern void afs_SetCheckServerNATmode(int isnat);
extern void afs_CheckServerDaemon(void);
extern int afs_CheckRootVolume(void);
extern void afs_BRelease(struct brequest *ab);
/* 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 afs_icl_CopyOut(struct afs_icl_log *logp,
afs_int32 * bufferp, afs_int32 * bufSizep,
afs_uint32 * cookiep, afs_int32 * flagsp);
-extern int afs_icl_GetLogParms(struct afs_icl_log *logp, afs_int32 * maxSizep,
- afs_int32 * curSizep);
extern int afs_icl_LogHold(struct afs_icl_log *logp);
-extern int afs_icl_LogHoldNL(struct afs_icl_log *logp);
extern int afs_icl_LogUse(struct afs_icl_log *logp);
extern int afs_icl_LogFreeUse(struct afs_icl_log *logp);
extern int afs_icl_LogSetSize(struct afs_icl_log *logp,
extern int afs_icl_ZeroLog(struct afs_icl_log *logp);
extern int afs_icl_LogFree(struct afs_icl_log *logp);
extern struct afs_icl_log *afs_icl_FindLog(char *name);
-extern int
- afs_icl_EnumerateLogs(int (*aproc)
-
- (char *name, char *arock, struct afs_icl_log * tp),
- char *arock);
extern int afs_icl_CreateSet(char *name, struct afs_icl_log *baseLogp,
struct afs_icl_log *fatalLogp,
struct afs_icl_set **outSetpp);
struct afs_icl_log *fatalLogp,
afs_uint32 flags,
struct afs_icl_set **outSetpp);
-extern int afs_icl_SetEnable(struct afs_icl_set *setp, afs_int32 eventID,
- int setValue);
-extern int afs_icl_GetEnable(struct afs_icl_set *setp, afs_int32 eventID,
- int *getValuep);
extern int afs_icl_ZeroSet(struct afs_icl_set *setp);
-extern int
- afs_icl_EnumerateSets(int (*aproc)
-
- (char *name, char *arock, struct afs_icl_log * tp),
- char *arock);
-extern int afs_icl_AddLogToSet(struct afs_icl_set *setp,
- struct afs_icl_log *newlogp);
extern int afs_icl_SetSetStat(struct afs_icl_set *setp, int op);
extern int afs_icl_SetHold(struct afs_icl_set *setp);
extern int afs_icl_ZapSet(struct afs_icl_set *setp);
/* afs_lock.c */
extern void Lock_Init(struct afs_lock *lock);
-extern void ObtainLock(struct afs_lock *lock, int how,
- unsigned int src_indicator);
-extern void ReleaseLock(struct afs_lock *lock, int how);
extern int Afs_Lock_Trace(int op, struct afs_lock *alock, int type,
char *file, int line);
extern void Afs_Lock_Obtain(struct afs_lock *lock, int how);
extern void Afs_Lock_ReleaseR(struct afs_lock *lock);
extern void Afs_Lock_ReleaseW(struct afs_lock *lock);
-extern void afs_osi_SleepR(char *addr,
- struct afs_lock *alock);
-extern void afs_osi_SleepW(char *addr,
- struct afs_lock *alock);
-extern void afs_osi_SleepS(char *addr,
- struct afs_lock *alock);
-
-
/* afs_mariner.c */
extern int osi_readRandom(void *, afs_size_t);
/* LINUX/osi_misc.c */
-#ifdef AFS_LINUX20_ENV
-#ifdef AFS_LINUX24_ENV
+#ifdef AFS_LINUX_ENV
extern int osi_lookupname(char *aname, uio_seg_t seg, int followlink,
struct dentry **dpp);
extern int osi_InitCacheInfo(char *aname);
uio_seg_t seg);
extern int uiomove(char *dp, int length, uio_flag_t rw, struct uio *uiop);
extern void osi_linux_free_inode_pages(void);
-#endif
extern void osi_linux_mask(void);
extern void osi_linux_unmaskrxk(void);
-extern int setpag(cred_t ** cr, afs_uint32 pagvalue, afs_uint32 * newpag,
- int change_parent);
#endif
extern int afs_syscall_iopen(dev_t, int, int, rval_t *, afs_ucred_t *);
extern int afs_syscall_iincdec(dev_t, int, int, int, rval_t *,
afs_ucred_t *);
-#elif defined(AFS_SGI65_ENV)
+#elif defined(AFS_SGI_ENV)
extern int afs_syscall_icreate(afs_uint32, afs_uint32, afs_uint32, afs_uint32, afs_uint32, afs_uint32, rval_t *);
extern int afs_syscall_iopen(int, ino_t, int, rval_t *);
extern int afs_syscall_iincdec(int, int, int, int);
/* ARCH/osi_file.c */
extern int afs_osicred_initialized;
extern void *osi_UFSOpen(afs_dcache_id_t *ainode);
-#if defined(AFS_LINUX22_ENV)
+#if defined(AFS_LINUX_ENV)
extern void osi_get_fh(struct dentry *dp, afs_ufs_dcache_id_t *ainode);
#endif
extern int afs_osi_Stat(struct osi_file *afile,
extern int afs_osi_MapStrategy(int (*aproc) (struct buf * bp),
struct buf *bp);
extern void shutdown_osifile(void);
+#if defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
+extern void afs_InitDualFSCacheOps(struct vnode *vp);
+#endif
/* ARCH/osi_groups.c */
#if defined(UKERNEL)
extern int usr_setpag(afs_ucred_t **cred, afs_uint32 pagvalue,
afs_uint32 * newpag, int change_parent);
-#else
-# if defined AFS_XBSD_ENV
-# if !defined(AFS_DFBSD_ENV)
-# if defined(AFS_FBSD_ENV)
+#elif defined(AFS_LINUX_ENV)
+extern int setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag,
+ int change_parent);
+#elif defined(AFS_FBSD_ENV)
extern int setpag(struct thread *td, struct ucred **cred, afs_uint32 pagvalue,
afs_uint32 * newpag, int change_parent);
-
-# elif defined(AFS_NBSD_ENV)
+#elif defined(AFS_NBSD_ENV)
extern int setpag(afs_proc_t *proc, afs_ucred_t **cred, afs_uint32 pagvalue,
afs_uint32 * newpag, int change_parent);
-# else
+#elif defined(AFS_OBSD_ENV)
extern int setpag(afs_proc_t *proc, struct ucred **cred, afs_uint32 pagvalue,
afs_uint32 * newpag, int change_parent);
-# endif /* AFS_FBSD_ENV */
-# endif /* ! AFS_DFBSD_ENV */
-# endif /* AFS_XBSD_ENV */
+#elif defined(AFS_DARWIN_ENV)
+extern int setpag(struct proc *proc, struct ucred **cred, afs_uint32 pagvalue,
+ afs_uint32 *newpag, afs_uint32 change_parent);
#endif /* UKERNEL */
-#if defined(AFS_LINUX26_ENV) || defined(AFS_PAG_ONEGROUP_ENV)
+#if defined(AFS_LINUX_ENV) || defined(AFS_PAG_ONEGROUP_ENV)
extern afs_int32 osi_get_group_pag(afs_ucred_t *cred);
#endif
extern struct vfs *afs_globalVFS;
#endif
extern struct vcache *afs_globalVp;
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
extern void vcache2inode(struct vcache *avc);
extern void vcache2fakeinode(struct vcache *rootvp, struct vcache *mpvp);
#endif
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;
extern void afs_FlushReclaimedVcaches(void);
void afs_vcacheInit(int astatSize);
-extern struct vcache *afs_FindVCache(struct VenusFid *afid, afs_int32 * retry,
- afs_int32 flag);
+extern struct vcache *afs_FindVCache(struct VenusFid *afid, afs_int32 flag);
extern void afs_BadFetchStatus(struct afs_conn *tc);
extern int afs_CheckFetchStatus(struct afs_conn *tc,
struct AFSFetchStatus *status);
struct vrequest *areq);
extern int afs_AccessOK(struct vcache *avc, afs_int32 arights,
struct vrequest *areq, afs_int32 check_mode_bits);
-#if defined(AFS_SUN5_ENV) || (defined(AFS_SGI_ENV) && !defined(AFS_SGI65_ENV))
+#if defined(AFS_SUN5_ENV)
extern int afs_access(OSI_VC_DECL(avc), afs_int32 amode, int flags,
afs_ucred_t *acred);
#else
extern void afs_DestroyAttr(struct vattr *vattr);
/* VNOPS/afs_vnop_create.c */
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
extern int afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
int flags, int amode, struct vcache **avcp,
afs_ucred_t *acred);
-#else /* AFS_SGI64_ENV */
+#else /* AFS_SGI_ENV */
extern int afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
enum vcexcl aexcl, int amode, struct vcache **avcp,
afs_ucred_t *acred);
-#endif /* AFS_SGI64_ENV */
+#endif /* AFS_SGI_ENV */
extern int afs_LocalHero(struct vcache *avc,
struct dcache *adc,
AFSFetchStatus * astat, int aincr);
#endif
/* VNOPS/afs_vnop_open.c */
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
extern int afs_open(bhv_desc_t * bhv, struct vcache **avcp, afs_int32 aflags,
afs_ucred_t *acred);
#else
/* 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);
struct vrequest *areq);
extern int afs_closex(struct file *afd);
-#ifdef AFS_SGI65_ENV
+#ifdef AFS_SGI_ENV
extern int afs_close(OSI_VC_DECL(avc), afs_int32 aflags,
lastclose_t lastclose, afs_ucred_t *acred);
-#elif defined(AFS_SGI64_ENV)
-extern int afs_close(OSI_VC_DECL(avc), afs_int32 aflags,
- lastclose_t lastclose, off_t offset,
- afs_ucred_t *acred, struct flid *flp);
-#elif defined(AFS_SGI_ENV)
-extern int afs_close(OSI_VC_DECL(avc), afs_int32 aflags,
- lastclose_t lastclose, off_t offset,
- afs_ucred_t *acred);
#elif defined(AFS_SUN5_ENV)
extern int afs_close(OSI_VC_DECL(avc), afs_int32 aflags, int count,
offset_t offset, afs_ucred_t *acred);
afs_ucred_t *acred);
#endif
-#if defined(AFS_SGI65_ENV)
+#if defined(AFS_SGI_ENV)
extern int afs_fsync(OSI_VC_DECL(avc), int flags, afs_ucred_t *acred,
off_t start, off_t stop);
-#elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)
+#elif defined(AFS_SUN5_ENV)
extern int afs_fsync(OSI_VC_DECL(avc), int flag, afs_ucred_t *acred);
#else
extern int afs_fsync(OSI_VC_DECL(avc), afs_ucred_t *acred);
extern afs_int32 afs_uuid_create(afsUUID * uuid);
extern u_short afs_uuid_hash(afsUUID * uuid);
-#if defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI62_ENV) || defined(UKERNEL)
+#if defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_AIX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(UKERNEL)
#include "osi_prototypes.h"
#endif
dcList = osi_AllocLargeSpace(AFS_LRALLOCSIZ);
afs_Trace2(afs_iclSetp, CM_TRACE_STOREALL, ICL_TYPE_POINTER, avc,
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length));
-#if !defined(AFS_AIX32_ENV) && !defined(AFS_SGI65_ENV)
+#if !defined(AFS_AIX32_ENV) && !defined(AFS_SGI_ENV)
/* In the aix vm implementation we need to do the vm_writep even
* on the memcache case since that's we adjust the file's size
* and finish flushing partial vm pages.
*/
- if ((cacheDiskType != AFS_FCACHE_TYPE_MEM) ||
+ if ((sync & AFS_NOVMSYNC)) {
+ /* noop */
+
+ } else if ((cacheDiskType != AFS_FCACHE_TYPE_MEM) ||
(sync & AFS_VMSYNC_INVAL) || (sync & AFS_VMSYNC) ||
(sync & AFS_LASTSTORE))
-#endif /* !AFS_AIX32_ENV && !AFS_SGI65_ENV */
+#endif /* !AFS_AIX32_ENV && !AFS_SGI_ENV */
{
/* If we're not diskless, reading a file may stress the VM
* system enough to cause a pageout, and this vnode would be
} /*afs_StoreAllSegments (new 03/02/94) */
+/*!
+ * Attempt to invalidate all chunks for a given file.
+ *
+ * \pre avc->lock is write-locked
+ * \pre afs_xdcache is not held
+ *
+ * \param avc vcache to invalidate segments for
+ * \return errno-style error codes. when an error is returned, the caller must
+ * retry the invalidation until successful (see comments in
+ * afs_InvalidateAllSegments)
+ */
int
afs_InvalidateAllSegments_once(struct vcache *avc)
{
AFS_STATCNT(afs_InvalidateAllSegments);
afs_Trace2(afs_iclSetp, CM_TRACE_INVALL, ICL_TYPE_POINTER, avc,
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->f.m.Length));
+
+ osi_Assert(WriteLocked(&avc->lock));
+
hash = DVHash(&avc->f.fid);
avc->f.truncPos = AFS_NOTRUNC; /* don't truncate later */
avc->f.states &= ~CExtendedFile; /* not any more */
afs_StaleVCacheFlags(avc, 0, CDirty);
/* Blow away pages; for now, only for Solaris */
#if (defined(AFS_SUN5_ENV))
- if (WriteLocked(&avc->lock))
- osi_ReleaseVM(avc, (afs_ucred_t *)0);
+ osi_ReleaseVM(avc, (afs_ucred_t *)0);
#endif
/*
* Block out others from screwing with this table; is a read lock
#include "afs/sysincludes.h" /* Standard vendor system headers */
#if !defined(UKERNEL)
-# if !defined(AFS_LINUX20_ENV)
+# if !defined(AFS_LINUX_ENV)
# include <net/if.h>
# endif
# include <netinet/in.h>
-# ifdef AFS_SGI62_ENV
+# ifdef AFS_SGI_ENV
# include "h/hashing.h"
# endif
-# if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
+# if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV)
# include <netinet/in_var.h>
# endif /* AFS_HPUX110_ENV */
# ifdef AFS_DARWIN_ENV
}
}
-void
+static void
CkSrv_GetCaps(int nconns, struct rx_connection **rxconns,
struct afs_conn **conns)
{
if (!ts->cell) /* not really an active server, anyway, it must */
continue; /* have just been added by setsprefs */
+ if ((sa->sa_flags & SRVADDR_ISDOWN) == 0 && !afs_HaveCallBacksFrom(sa->server)) {
+ /* Server is up, and we have no active callbacks from it. */
+ continue;
+ }
+
/* get a connection, even if host is down; bumps conn ref count */
tu = afs_GetUser(treq->uid, ts->cell->cellNum, SHARED_LOCK);
tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cellNum, tu,
if (!tc)
continue;
- if ((sa->sa_flags & SRVADDR_ISDOWN) || afs_HaveCallBacksFrom(sa->server)) {
- conns[nconns]=tc;
- rxconns[nconns]=rxconn;
- if (sa->sa_flags & SRVADDR_ISDOWN) {
- rx_SetConnDeadTime(rxconn, 3);
- conntimer[nconns]=1;
- } else {
- conntimer[nconns]=0;
- }
- nconns++;
- } else /* not holding, kill ref */
- afs_PutConn(tc, rxconn, SHARED_LOCK);
+ conns[nconns]=tc;
+ rxconns[nconns]=rxconn;
+ if (sa->sa_flags & SRVADDR_ISDOWN) {
+ rx_SetConnDeadTime(rxconn, 3);
+ conntimer[nconns]=1;
+ } else {
+ conntimer[nconns]=0;
+ }
+ nconns++;
+
} /* Outer loop over addrs */
afs_osi_Free(addrs, srvAddrCount * sizeof(*addrs));
# endif /* (DARWIN || OBSD47 || FBSD) && USEIFADDR */
#endif /* AFS_USERSPACE_IP_ADDR */
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
static int
afsi_enum_set_rank(struct hashbucket *h, caddr_t mkey, caddr_t arg1,
caddr_t arg2)
afsi_SetServerIPRank((struct srvAddr *)arg1, (struct in_ifaddr *)h);
return 0; /* Never match, so we enumerate everyone */
}
-#endif /* AFS_SGI62_ENV */
+#endif /* AFS_SGI_ENV */
static int
afs_SetServerPrefs(struct srvAddr *const sa)
{
# else /* USEIFADDR */
sa->sa_iprank = LO;
-# ifdef AFS_SGI62_ENV
+# ifdef AFS_SGI_ENV
(void)hash_enum(&hashinfo_inaddr, afsi_enum_set_rank, HTF_INET, NULL,
(caddr_t) sa, NULL);
# elif defined(AFS_DARWIN80_ENV)
AFS_CS(PPrefetchFromTape) /* afs_pioctl.c */ \
AFS_CS(PFlushAllVolumeData) /* afs_pioctl.c */ \
AFS_CS(afs_InitVolSlot) /* afs_volume.c */ \
- AFS_CS(afs_SetupVolSlot) /* afs_volume.c */
+ AFS_CS(afs_SetupVolSlot) /* afs_volume.c */ \
+ AFS_CS(PGetLiteralFID) /* afs_pioctl.c */
struct afs_CMCallStats {
#define AFS_CS(call) afs_int32 C_ ## call;
struct afs_stats_AuthorInfo author; /*Authorship stats */
};
+/*
+ * Statistics on run time for afs_CacheTruncateDaemon.
+ */
+struct afs_CTD_stats {
+ osi_timeval32_t CTD_beforeSleep;
+ osi_timeval32_t CTD_afterSleep;
+ osi_timeval32_t CTD_sleepTime;
+ osi_timeval32_t CTD_runTime;
+ int CTD_nSleeps;
+};
+
#ifndef AFS_NOSTATS
/*
* We define routines to keep running counts and means. For the
#include "afsincludes.h" /* Afs-based standard headers */
#include "afs/afs_stats.h"
#include "rx/rx_globals.h"
-#if !defined(UKERNEL) && !defined(AFS_LINUX20_ENV)
+#if !defined(UKERNEL) && !defined(AFS_LINUX_ENV)
#include "net/if.h"
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
#if !defined(AFS_HPUX110_ENV) && !defined(AFS_DARWIN_ENV)
}
#endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */
-#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX_ENV) && !defined(AFS_IA64_LINUX_ENV)
if (afs_in_compat_syscall()) {
struct afs_ioctl32 dst32;
};
-#if defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN5_64BIT_ENV) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)) || defined(NEED_IOCTL32)
+#if defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN5_64BIT_ENV) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX_ENV) && !defined(AFS_IA64_LINUX_ENV)) || defined(NEED_IOCTL32)
static void
iparam32_to_iparam(const struct iparam32 *src, struct iparam *dst)
{
}
#endif /* AFS_SUN5_64BIT_ENV */
-#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX_ENV) && !defined(AFS_IA64_LINUX_ENV)
if (afs_in_compat_syscall()) {
struct iparam32 dst32;
long parm5;
long parm6;
} *uap = (struct a *)args;
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
struct afssysargs {
long syscall;
long parm1;
long linux_ret = 0;
long *retval = &linux_ret;
long eparm[4]; /* matches AFSCALL_ICL in fstrace.c */
-# ifdef AFS_SPARC64_LINUX24_ENV
+# ifdef AFS_SPARC64_LINUX_ENV
afs_int32 eparm32[4];
# endif
/* eparm is also used by AFSCALL_CALL in afsd.c */
return (ENODEV);
}
#endif
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
/* setup uap for use below - pull out the magic decoder ring to know
* which syscalls have folded argument lists.
*/
uap->parm2 = parm2;
uap->parm3 = parm3;
if (syscall == AFSCALL_ICL || syscall == AFSCALL_CALL) {
-#ifdef AFS_SPARC64_LINUX24_ENV
+#ifdef AFS_SPARC64_LINUX_ENV
/* from arch/sparc64/kernel/sys_sparc32.c */
#define AA(__x) \
({ unsigned long __ret; \
})
-#ifdef AFS_SPARC64_LINUX26_ENV
+#ifdef AFS_SPARC64_LINUX_ENV
if (test_thread_flag(TIF_32BIT))
#else
if (current->thread.flags & SPARC_FLAG_32BIT)
uap->parm5, (long *)retval);
#endif /* !AFS_NBSD40_ENV */
AFS_GUNLOCK();
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
if (!code) {
/* ICL commands can return values. */
code = -linux_ret; /* Gets negated again at exit below */
setuerror(code);
#endif
}
-#endif /* !AFS_LINUX20_ENV */
+#endif /* !AFS_LINUX_ENV */
} else {
#if defined(KERNEL_HAVE_UERROR)
setuerror(EINVAL);
} /* 32 bit procs */
#endif
#endif
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
code = -code;
#endif
return code;
xdr_destroy(&xdrs);
out:
- xdr_free((xdrproc_t) xdr_ktc_tokenUnion, &pioctlToken);
+ xdr_free((xdrproc_t) xdr_ktc_tokenUnion, pioctlToken);
osi_Free(pioctlToken, sizeof(*pioctlToken));
if (code != 0) {
#include "afs/sysincludes.h" /* Standard vendor system headers */
#if !defined(UKERNEL)
-#if !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_LINUX_ENV)
#include <net/if.h>
#endif
#include <netinet/in.h>
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV)
#include <netinet/in_var.h>
#endif /* ! AFS_HPUX110_ENV */
#endif /* !defined(UKERNEL) */
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.
afs_GCPAGs_cred_count++;
pag = PagInCred(pcred);
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_LINUX22_ENV)
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_LINUX_ENV)
uid = (pag != NOPAG ? pag : afs_cr_uid(pcred));
#elif defined(AFS_SUN510_ENV)
uid = (pag != NOPAG ? pag : crgetruid(pcred));
#include "afs/sysincludes.h" /* Standard vendor system headers */
#if !defined(UKERNEL)
-#if !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_LINUX_ENV)
#include <net/if.h>
#endif
#include <netinet/in.h>
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV)
#include <netinet/in_var.h>
#endif /* ! AFS_HPUX110_ENV */
#endif /* !defined(UKERNEL) */
int afsvnumbers = 0;
#endif
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
char *makesname();
-#endif /* AFS_SGI64_ENV */
+#endif /* AFS_SGI_ENV */
/* Exported variables */
afs_rwlock_t afs_xvcdirty; /*Lock: discon vcache dirty list mgmt */
afs_rwlock_t afs_xvcache; /*Lock: alloc new stat cache entries */
afs_rwlock_t afs_xvreclaim; /*Lock: entries reclaimed, not on free list */
afs_lock_t afs_xvcb; /*Lock: fids on which there are callbacks */
-#if !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_LINUX_ENV)
static struct vcache *freeVCList; /*Free list for stat cache entries */
struct vcache *ReclaimedVCList; /*Reclaimed list for stat entries */
static struct vcache *Initial_freeVCList; /*Initial list for above */
code = EBUSY;
goto bad;
}
-#if !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_LINUX_ENV)
if (avc->nextfree || !avc->vlruq.prev || !avc->vlruq.next) { /* qv afs.h */
refpanic("LRU vs. Free inconsistency");
}
/* remove entry from the volume hash table */
QRemove(&avc->vhashq);
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX_ENV)
{
struct pagewriter *pw, *store;
struct list_head tofree;
afs_evenZaps++;
afs_vcount--;
-#if !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_LINUX_ENV)
/* put the entry in the free list */
avc->nextfree = freeVCList;
freeVCList = avc;
} else
osi_Panic("flush vc refcnt < 1");
}
-#endif /* AFS_LINUX22_ENV */
+#endif /* AFS_LINUX_ENV */
return 0;
bad:
afs_InactiveVCache(struct vcache *avc, afs_ucred_t *acred)
{
AFS_STATCNT(afs_inactive);
+
+ ObtainWriteLock(&avc->lock, 68);
+
if (avc->f.states & CDirty) {
/* we can't keep trying to push back dirty data forever. Give up. */
afs_InvalidateAllSegments(avc); /* turns off dirty bit */
avc->f.states &= ~CMAPPED;
avc->f.states &= ~CDirty; /* Turn it off */
if (avc->f.states & CUnlinked) {
- if (CheckLock(&afs_xvcache) || CheckLock(&afs_xdcache)) {
+ if (CheckLock(&afs_xvcache) || CheckLock(&afs_xdcache) ||
+ osi_ShouldDeferRemunlink(avc)) {
avc->f.states |= CUnlinkedDel;
+ ReleaseWriteLock(&avc->lock);
return;
}
+ ReleaseWriteLock(&avc->lock);
afs_remunlink(avc, 1); /* ignore any return code */
+ return;
}
-
+ ReleaseWriteLock(&avc->lock);
}
#endif
void
afs_FlushReclaimedVcaches(void)
{
-#if !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_LINUX_ENV)
struct vcache *tvc;
int code, fv_slept;
struct vcache *tmpReclaimedVCList = NULL;
#endif
}
-void
+static void
afs_PostPopulateVCache(struct vcache *avc, struct VenusFid *afid, int seq)
{
/*
*
* Returns 1 if the stat cache looks stressed, and 0 otherwise.
*/
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
int
afs_VCacheStressed(void)
{
return 0;
}
}
-#else /* AFS_LINUX26_ENV */
+#else /* AFS_LINUX_ENV */
int
afs_VCacheStressed(void)
{
}
return 1;
}
-#endif /* AFS_LINUX26_ENV */
+#endif /* AFS_LINUX_ENV */
int
afs_ShakeLooseVCaches(afs_int32 anumber)
afs_FlushReclaimedVcaches();
-#if defined(AFS_LINUX22_ENV)
+#if defined(AFS_LINUX_ENV)
if(!afsd_dynamic_vcaches && afs_vcount >= afs_maxvcount) {
afs_ShakeLooseVCaches(anumber);
if (afs_vcount >= afs_maxvcount) {
if (tvc == NULL) {
return NULL;
}
-#else /* AFS_LINUX22_ENV */
+#else /* AFS_LINUX_ENV */
/* pull out a free cache entry */
if (!freeVCList) {
afs_ShakeLooseVCaches(anumber);
afs_vcount++; /* balanced by FlushVCache */
} /* end of if (!freeVCList) */
-#endif /* AFS_LINUX22_ENV */
+#endif /* AFS_LINUX_ENV */
#if defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV)
if (tvc->v)
* we have to do this after attaching the vnode, because the reference
* count may be held in the vnode itself */
-#if defined(AFS_LINUX22_ENV)
+#if defined(AFS_LINUX_ENV)
/* Hold it for the LRU (should make count 2) */
osi_Assert(osi_vnhold(tvc) == 0);
#elif !(defined (AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV))
afs_int32 code, newvcache = 0;
struct vcache *tvc;
struct volume *tvp;
- afs_int32 retry;
AFS_STATCNT(afs_GetVCache);
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
- loop:
-#endif
-
ObtainSharedLock(&afs_xvcache, 5);
- tvc = afs_FindVCache(afid, &retry, DO_STATS | DO_VLRU | IS_SLOCK);
- if (tvc && retry) {
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
- ReleaseSharedLock(&afs_xvcache);
- spunlock_psema(tvc->v.v_lock, retry, &tvc->v.v_sync, PINOD);
- goto loop;
-#endif
- }
+ tvc = afs_FindVCache(afid, DO_STATS | DO_VLRU | IS_SLOCK);
if (tvc) {
osi_Assert((tvc->f.states & CVInit) == 0);
/* If we are in readdir, return the vnode even if not statd */
VOP_UNLOCK(vp, LK_EXCLUSIVE, current_proc());
# elif defined(AFS_FBSD_ENV)
AFS_GUNLOCK();
- iheldthelock = VOP_ISLOCKED(vp);
+ iheldthelock = 0;
+ if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) {
+ iheldthelock = 1;
+ }
if (!iheldthelock) {
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
}
struct AFSVolSync tsync;
struct server *serverp = 0;
afs_int32 origCBs;
- afs_int32 retry;
AFS_STATCNT(afs_GetVCache);
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
- loop1:
-#endif
-
ObtainReadLock(&afs_xvcache);
- tvc = afs_FindVCache(afid, &retry, DO_STATS /* no vlru */ );
+ tvc = afs_FindVCache(afid, DO_STATS /* no vlru */ );
if (tvc) {
ReleaseReadLock(&afs_xvcache);
- if (retry) {
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
- spunlock_psema(tvc->v.v_lock, retry, &tvc->v.v_sync, PINOD);
- goto loop1;
-#endif
- }
ObtainReadLock(&tvc->lock);
if (tvc->f.states & CStatd) {
afs_RemoteLookup(&adp->f.fid, areq, aname, &nfid, &OutStatus,
&CallBack, &serverp, &tsync);
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
- loop2:
-#endif
-
ObtainSharedLock(&afs_xvcache, 6);
- tvc = afs_FindVCache(&nfid, &retry, DO_VLRU | IS_SLOCK/* no xstats now */ );
- if (tvc && retry) {
-#if defined(AFS_SGI_ENV) && !defined(AFS_SGI53_ENV)
- ReleaseSharedLock(&afs_xvcache);
- spunlock_psema(tvc->v.v_lock, retry, &tvc->v.v_sync, PINOD);
- goto loop2;
-#endif
- }
-
+ tvc = afs_FindVCache(&nfid, DO_VLRU | IS_SLOCK/* no xstats now */ );
if (!tvc) {
/* no cache entry, better grab one */
UpgradeSToWLock(&afs_xvcache, 22);
afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1);
avc->linkData = NULL;
}
+
+ osi_ResetVCache(avc);
}
/*!
* Find a vcache entry given a fid.
*
* \param afid Pointer to the fid whose cache entry we desire.
- * \param retry (SGI-specific) tell the caller to drop the lock on xvcache,
- * unlock the vnode, and try again.
* \param flag Bit 1 to specify whether to compute hit statistics. Not
* set if FindVCache is called as part of internal bookkeeping.
*
*/
struct vcache *
-afs_FindVCache(struct VenusFid *afid, afs_int32 * retry, afs_int32 flag)
+afs_FindVCache(struct VenusFid *afid, afs_int32 flag)
{
struct vcache *tvc;
*
* \param avcp Fill in pointer if we found one and only one.
* \param afid Pointer to the fid whose cache entry we desire.
- * \param retry (SGI-specific) tell the caller to drop the lock on xvcache,
- * unlock the vnode, and try again.
* \param flags bit 1 to specify whether to compute hit statistics. Not
* set if FindVCache is called as part of internal bookkeeping.
*
void
afs_vcacheInit(int astatSize)
{
-#if !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_LINUX_ENV)
struct vcache *tvp;
#endif
int i;
if (!afs_maxvcount) {
afs_maxvcount = astatSize; /* no particular limit on linux? */
}
-#if !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_LINUX_ENV)
freeVCList = NULL;
#endif
AFS_RWLOCK_INIT(&afs_xvcache, "afs_xvcache");
LOCK_INIT(&afs_xvcb, "afs_xvcb");
-#if !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_LINUX_ENV)
/* Allocate and thread the struct vcache entries */
tvp = afs_osi_Alloc(astatSize * sizeof(struct vcache));
osi_Assert(tvp != NULL);
tvc->vc_rwlockid = OSI_NO_LOCKID;
initnsema(&tvc->vc_rwlock, 1,
makesname(name, "vrw", tvc->v.v_number));
-# ifndef AFS_SGI53_ENV
- initnsema(&tvc->v.v_sync, 0, makesname(name, "vsy", tvc->v.v_number));
-# endif
-# ifndef AFS_SGI62_ENV
- initnlock(&tvc->v.v_lock, makesname(name, "vlk", tvc->v.v_number));
-# endif /* AFS_SGI62_ENV */
}
#endif
QInit(&VLRU);
{
int i;
struct afs_cbr *tsp;
+ struct afs_cbr *cbr, *cbr_next;
+ struct server *ts;
+
/*
* XXX We may potentially miss some of the vcaches because if when
* there are no free vcache entries and all the vcache entries are active
afs_vhashT[i] = 0;
}
}
+
+ /*
+ * Remove any reference to CBRs in the server structs before we free the
+ * memory for our CBRs below.
+ */
+ for (i = 0; i < NSERVERS; i++) {
+ for (ts = afs_servers[i]; ts; ts = ts->next) {
+ for (cbr = ts->cbrs; cbr; cbr = cbr_next) {
+ cbr_next = cbr->next;
+ afs_FreeCBR(cbr);
+ }
+ }
+ }
+
/*
* Free any leftover callback queue
*/
}
afs_cbrSpace = 0;
-#if !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_LINUX_ENV)
afs_osi_Free(Initial_freeVCList, afs_cacheStats * sizeof(struct vcache));
# ifdef KERNEL_HAVE_PIN
{
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);
#include "afs/sysincludes.h" /* Standard vendor system headers */
#if !defined(UKERNEL)
-#if !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_LINUX_ENV)
#include <net/if.h>
#endif
#include <netinet/in.h>
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV)
#include <netinet/in_var.h>
#endif /* ! AFS_HPUX110_ENV */
#endif /* !defined(UKERNEL) */
LockAndInstallVolumeEntry(tv, ove, tcell->cellNum);
if (agood) {
if (!tv->name) {
- tv->name = afs_osi_Alloc(strlen(aname) + 1);
+ tv->name = afs_strdup(aname);
osi_Assert(tv->name != NULL);
- strcpy(tv->name, aname);
}
}
for (i = 0; i < NMAXNSERVERS; i++) {
struct volume *tv;
struct vldbentry *tve;
char *bp, tbuf[CVBS];
+ size_t len;
tcell = afs_GetCell(fid->Cell, READ_LOCK);
if (!tcell)
bp = afs_cv2string(&tbuf[CVBS], fid->Fid.Volume);
memset(tve, 0, sizeof(*tve));
- strcpy(tve->name, "local-dynroot");
+ len = sizeof(tve->name);
+ osi_Assert(strlcpy(tve->name, "local-dynroot", len) < len);
tve->volumeId[ROVOL] = fid->Fid.Volume;
tve->flags = VLF_ROEXISTS;
#if !defined(UKERNEL)
-#if !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_LINUX_ENV)
# include <net/if.h>
# if defined(AFS_SUN5_ENV)
# include <sys/varargs.h>
#endif
#include <netinet/in.h>
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV)
#include <netinet/in_var.h>
#endif /* ! AFS_HPUX110_ENV */
#endif /* !defined(UKERNEL) */
#include <sys/fp_io.h>
#endif
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX_ENV)
# define afs_vprintf(fmt, ap) vprintk(fmt, ap)
#elif defined(AFS_SGI_ENV)
# define afs_vprintf(fmt, ap) icmn_err(CE_WARN, fmt, ap)
-#elif (defined(AFS_DARWIN80_ENV) && !defined(AFS_DARWIN90_ENV)) || (defined(AFS_LINUX22_ENV))
+#elif (defined(AFS_DARWIN80_ENV) && !defined(AFS_DARWIN90_ENV)) || (defined(AFS_LINUX_ENV))
static_inline void
afs_vprintf(const char *fmt, va_list ap)
{
{
va_list ap;
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
AFS_STATCNT(afs_warn);
if ((afs_showflags & GAGCONSOLE) || (afs_showflags & GAGUSER)) {
va_start(ap, fmt);
afs_vwarn(fmt, ap);
va_end(ap);
}
-# else /* AFS_LINUX20_ENV */
+# else /* AFS_LINUX_ENV */
AFS_STATCNT(afs_warn);
if (afs_showflags & GAGCONSOLE) {
va_start(ap, fmt);
afs_vwarnuser(fmt, ap);
va_end(ap);
}
-# endif /* AFS_LINUX20_ENV */
+# endif /* AFS_LINUX_ENV */
}
#endif /* AFS_AIX_ENV */
/* 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)
# include "osi_vfs.h"
# endif
-# if defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)
+# if defined(AFS_SGI_ENV) || defined(AFS_LINUX_ENV)
# include "osi_vfs.h"
# endif
# include "rx/rx.h"
# include "afs/lock.h"
# include "afs/volerrors.h"
# include "afs/voldefs.h"
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
# ifdef TRUE
# undef TRUE
# undef FALSE
# endif
-# endif
-# ifdef AFS_LINUX20_ENV
# undef __NFDBITS
# undef __FDMASK
# endif
# include "afs/afs_stats.h"
# include "afs/afs_prototypes.h"
# include "afs/discon.h"
-# if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+# if defined(AFS_LINUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
# include "osi_machdep.h"
# endif
* up 2 bytes
*/
-#if defined(AFS_SUN5_64BIT_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR==64)) || defined(AFS_LINUX_64BIT_KERNEL)
+#if defined(AFS_SUN5_64BIT_ENV) || (defined(AFS_SGI_ENV) && (_MIPS_SZPTR==64)) || defined(AFS_LINUX_64BIT_KERNEL)
#define AFS_XLATOR_MAGIC 0x8765 /* XXX */
#else
#define AFS_XLATOR_MAGIC 0x87654321
#ifndef __AFSLOCK_INCLUDE__
#define __AFSLOCK_INCLUDE__ 1
-#if !defined(KERNEL) && !defined(KDUMP_KERNEL)
+#if !defined(KERNEL)
#error Do not include afs/lock.h except for kernel code.
#endif
* LICENSED MATERIALS - PROPERTY OF IBM
*/
-#define INSTRUMENT_LOCKS
/* This is the max lock number in use. Please update it if you add any new
* lock numbers.
*/
# define MyPidxx (u.u_procp)
# define MyPidxx2Pid(x) (x ? (afs_int32)p_pid(x) : 0)
# endif
-#elif defined(AFS_SGI64_ENV)
-# if defined(AFS_SGI65_ENV)
+#elif defined(AFS_SGI_ENV)
typedef unsigned int afs_lock_tracker_t;
-# define MyPidxx proc_pid(curproc())
-# define MyPidxx2Pid(x) (x)
-# else
-typedef unsigned int afs_lock_tracker_t;
-# define MyPidxx current_pid()
-# define MyPidxx2Pid(x) (x)
-# endif
-#elif defined(AFS_LINUX20_ENV)
+# define MyPidxx proc_pid(curproc())
+# define MyPidxx2Pid(x) (x)
+#elif defined(AFS_LINUX_ENV)
typedef struct task_struct * afs_lock_tracker_t;
# define MyPidxx (current)
# define MyPidxx2Pid(x) (x? (x)->pid : 0)
unsigned short num_waiting; /* probably need this soon */
unsigned short spare; /* not used now */
osi_timeval32_t time_waiting; /* for statistics gathering */
-#if defined(INSTRUMENT_LOCKS)
- /* the following are useful for debugging
- ** the field 'src_indicator' is updated only by ObtainLock() and
- ** only for writes/shared locks. Hence, it indictes where in the
- ** source code the shared/write lock was set.
+ /*
+ * The following are useful for debugging:
+ * The field 'src_indicator' is updated only by ObtainWriteLock(),
+ * ObtainSharedLock(), and UpgradeSToWLock. It indicates where in the
+ * source code the shared/write lock was set.
*/
afs_lock_tracker_t pid_last_reader; /* proceess id of last reader */
afs_lock_tracker_t pid_writer; /* process id of writer, else 0 */
- unsigned int src_indicator; /* third param to ObtainLock() */
-#endif /* INSTRUMENT_LOCKS */
+ unsigned int src_indicator;
};
typedef struct afs_lock afs_lock_t;
typedef struct afs_lock afs_rwlock_t;
#define AFS_LOCK_TRACE(op, lock, type)
#endif
-#if defined(INSTRUMENT_LOCKS)
-
#define ObtainReadLock(lock)\
BEGINMAC \
AFS_LOCK_TRACE(CM_TRACE_LOCKOBTAIN, lock, READ_LOCK);\
(lock)->pid_writer = MyPid_NULL; \
ENDMAC
-#else /* INSTRUMENT_LOCKS */
-
-#define ObtainReadLock(lock)\
- BEGINMAC \
- AFS_LOCK_TRACE(CM_TRACE_LOCKOBTAIN, lock, READ_LOCK);\
- if (!((lock)->excl_locked & WRITE_LOCK)) \
- ((lock)->readers_reading)++; \
- else \
- Afs_Lock_Obtain(lock, READ_LOCK); \
- ENDMAC
-
-#define NBObtainReadLock(lock) \
- (((lock)->excl_locked & WRITE_LOCK) ? EWOULDBLOCK : (((lock)->readers_reading++), 0))
-
-#define ObtainWriteLock(lock, src)\
- BEGINMAC \
- AFS_LOCK_TRACE(CM_TRACE_LOCKOBTAIN, lock, WRITE_LOCK);\
- if (!(lock)->excl_locked && !(lock)->readers_reading)\
- (lock) -> excl_locked = WRITE_LOCK;\
- else\
- Afs_Lock_Obtain(lock, WRITE_LOCK); \
- ENDMAC
-
-#define NBObtainWriteLock(lock, src) (((lock)->excl_locked || (lock)->readers_reading) ? EWOULDBLOCK : (((lock) -> excl_locked = WRITE_LOCK), 0))
-
-#define ObtainSharedLock(lock, src)\
- BEGINMAC \
- AFS_LOCK_TRACE(CM_TRACE_LOCKOBTAIN, lock, SHARED_LOCK);\
- if (!(lock)->excl_locked)\
- (lock) -> excl_locked = SHARED_LOCK;\
- else\
- Afs_Lock_Obtain(lock, SHARED_LOCK); \
- ENDMAC
-
-#define NBObtainSharedLock(lock, src) (((lock)->excl_locked) ? EWOULDBLOCK : (((lock) -> excl_locked = SHARED_LOCK), 0))
-
-#define UpgradeSToWLock(lock, src)\
- BEGINMAC \
- AFS_LOCK_TRACE(CM_TRACE_LOCKOBTAIN, lock, BOOSTED_LOCK);\
- if (!(lock)->readers_reading)\
- (lock)->excl_locked = WRITE_LOCK;\
- else\
- Afs_Lock_Obtain(lock, BOOSTED_LOCK); \
- ENDMAC
-
-/* this must only be called with a WRITE or boosted SHARED lock! */
-#define ConvertWToSLock(lock)\
- BEGINMAC\
- AFS_LOCK_TRACE(CM_TRACE_LOCKDOWN, lock, SHARED_LOCK);\
- (lock)->excl_locked = SHARED_LOCK; \
- if((lock)->wait_states) \
- Afs_Lock_ReleaseR(lock); \
- ENDMAC
-
-#define ConvertWToRLock(lock) \
- BEGINMAC\
- AFS_LOCK_TRACE(CM_TRACE_LOCKDOWN, lock, READ_LOCK);\
- (lock)->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK);\
- ((lock)->readers_reading)++;\
- Afs_Lock_ReleaseR(lock);\
- ENDMAC
-
-#define ConvertSToRLock(lock) \
- BEGINMAC\
- AFS_LOCK_TRACE(CM_TRACE_LOCKDOWN, lock, READ_LOCK);\
- (lock)->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK);\
- ((lock)->readers_reading)++;\
- Afs_Lock_ReleaseR(lock);\
- ENDMAC
-
-#define ReleaseReadLock(lock)\
- BEGINMAC\
- AFS_LOCK_TRACE(CM_TRACE_LOCKDONE, lock, READ_LOCK);\
- if (!(--((lock)->readers_reading)) && (lock)->wait_states)\
- Afs_Lock_ReleaseW(lock) ; \
- ENDMAC
-
-#define ReleaseWriteLock(lock)\
- BEGINMAC\
- AFS_LOCK_TRACE(CM_TRACE_LOCKDONE, lock, WRITE_LOCK);\
- (lock)->excl_locked &= ~WRITE_LOCK;\
- if ((lock)->wait_states) Afs_Lock_ReleaseR(lock);\
- ENDMAC
-
-/* can be used on shared or boosted (write) locks */
-#define ReleaseSharedLock(lock)\
- BEGINMAC\
- AFS_LOCK_TRACE(CM_TRACE_LOCKDONE, lock, SHARED_LOCK);\
- (lock)->excl_locked &= ~(SHARED_LOCK | WRITE_LOCK);\
- if ((lock)->wait_states) Afs_Lock_ReleaseR(lock);\
- ENDMAC
-
-#endif /* INSTRUMENT_LOCKS */
/* I added this next macro to make sure it is safe to nuke a lock -- Mike K. */
#define LockWaiters(lock)\
on the entry while you have the purge lock held on the parent. Unfortunately, if it *is* locked,
you can not lock it yourself and wait for the other dude to release it, since the entry's locker
may need to lock another entry before unlocking the entry you want (which would result in
-deadlock). Instead, then, you must release the parent lock, and try again "later" (see Lock_Wait
-for assistance in waiting until later). Unfortunately, this is the best locking paradigm I've yet
-come up with.
+deadlock). Instead, then, you must release the parent lock, and try again "later".
+Unfortunately, this is the best locking paradigm I've yet come up with.
What are the advantages to this scheme? First, the use of the parent lock ensures that
two people don't try to add the same entry at the same time or delete an entry while someone
# include <sys/protosw.h>
# include <sys/ioctl.h>
-#elif defined(AFS_LINUX22_ENV)
+#elif defined(AFS_LINUX_ENV)
# include <linux/version.h>
# ifdef HAVE_LINUX_CONFIG_H
# include <linux/config.h>
# include <linux/net.h>
# include <linux/kdev_t.h>
# include <linux/ioctl.h>
-# if defined(AFS_LINUX26_ENV)
+# if defined(AFS_LINUX_ENV)
# include <linux/compat.h>
# include <linux/backing-dev.h>
# include <linux/pagemap.h>
# else
# include <asm/semaphore.h>
# endif
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-# include <linux/mutex.h>
-# endif
+# include <linux/mutex.h>
# include <linux/errno.h>
# include <linux/completion.h>
# if defined(HAVE_LINUX_EXPORTFS_H)
# include <linux/exportfs.h>
# endif
-# ifdef AFS_LINUX24_ENV
-# include <linux/pagemap.h>
-# endif
+# include <linux/pagemap.h>
-#else /* AFS_LINUX22_ENV */
+#else /* AFS_LINUX_ENV */
# include "h/errno.h"
# include "h/types.h"
# include "values.h"
# include "sys/sema.h"
# include "sys/cmn_err.h"
-# ifdef AFS_SGI64_ENV
-# include <ksys/behavior.h>
+# include <ksys/behavior.h>
/* in 6.5.20f, ksys/behavior.h doesn't bother to define BHV_IS_BHVL,
* but sys/vnode.h uses it in VNODE_TO_FIRST_BHV. It looks like from
* older headers like we want the old behavior, so we fake it. */
-# if defined(BHV_PREPARE) && !defined(CELL_CAPABLE)
-# define BHV_IS_BHVL(bhp) (0)
-# endif
-# endif /* AFS_SGI64_ENV */
+# if defined(BHV_PREPARE) && !defined(CELL_CAPABLE)
+# define BHV_IS_BHVL(bhp) (0)
+# endif
# include "fs/efs_inode.h"
# include "sys/kmem.h"
# include "sys/cred.h"
*
* Instead of using ASSERT(), we use our own osi_Assert().
*/
-# if defined(AFS_SGI65_ENV) && !defined(DEBUG)
+# if !defined(DEBUG)
# define DEBUG
# include "sys/debug.h"
# undef DEBUG
# include "h/dir.h"
# endif /* SGI || SUN || HPUX */
-# if !defined(AFS_SGI64_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN80_ENV) && \
+# if !defined(AFS_SGI_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN80_ENV) && \
!defined(AFS_NBSD40_ENV)
# include "h/user.h"
-# endif /* AFS_SGI64_ENV */
+# endif /* AFS_SGI_ENV */
# define MACH_USER_API 1
# if defined(AFS_FBSD_ENV)
# include "h/bio.h"
# include <sys/debug.h>
# endif
-#endif /* AFS_LINUX22_ENV */
+#endif /* AFS_LINUX_ENV */
#endif /* __AFS_SYSINCLUDESH__ so idempotent */
->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
#include <afs/afsutil.h>
#include <afs/sys_prototypes.h>
-#if defined(AFS_SGI62_ENV) && !defined(AFS_SGI65_ENV)
-#include <sym.h>
-#include <symconst.h>
-#endif
-#ifdef AFS_SGI65_ENV
+#ifdef AFS_SGI_ENV
#include <sched.h>
#endif
#include <CoreFoundation/CoreFoundation.h>
static int event_pid;
-#ifndef AFS_ARM_DARWIN_ENV
-#define MACOS_EVENT_HANDLING 1
+#if !defined(AFS_ARM_DARWIN_ENV) && !defined(AFS_ARM64_DARWIN_ENV)
+# define MACOS_EVENT_HANDLING 1
#endif
#endif /* AFS_DARWIN_ENV */
#undef VIRTUE
#undef VICE
+#ifdef AFS_SOCKPROXY_ENV
+# include <sys/types.h>
+# include <sys/socket.h>
+#endif
#define CACHEINFOFILE "cacheinfo"
#define DCACHEFILE "CacheItems"
* Global configuration variables.
*/
static int enable_rxbind = 0;
-static int afs_shutdown = 0;
static int cacheBlocks; /*Num blocks in the cache */
static int cacheFiles; /*Optimal # of files in workstation cache */
static int rwpct = 0;
static int rxmaxfrags = 0; /* Are we forcing a limit on frags? */
static int volume_ttl = 0; /* enable vldb cache timeout support */
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
#define AFSD_INO_T ino64_t
#else
#define AFSD_INO_T afs_uint32
* -2: file exists in top-level
* >=0: file exists in Dxxx
*/
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX_ENV)
AFSD_INO_T *inode_for_V; /* Array of inodes for desired
* cache files */
#endif
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);
char fullpn_FileToDelete[1024]; /*File to be deleted from cache */
char *fileToDelete; /*Ptr to last component of above */
DIR *cdirp; /*Ptr to cache directory structure */
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
struct dirent64 *currp; /*Current directory entry */
#else
struct dirent *currp; /*Current directory entry */
sprintf(fullpn_FileToDelete, "%s/", directory);
fileToDelete = fullpn_FileToDelete + strlen(fullpn_FileToDelete);
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
for (currp = readdir64(cdirp); currp; currp = readdir64(cdirp))
#else
for (currp = readdir(cdirp); currp; currp = readdir(cdirp))
{
if (afsd_debug) {
printf("%s: Current directory entry:\n", rn);
-#if defined(AFS_SGI62_ENV) || defined(AFS_DARWIN90_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_DARWIN90_ENV)
printf("\tinode=%" AFS_INT64_FMT ", reclen=%d, name='%s'\n", currp->d_ino,
currp->d_reclen, currp->d_name);
#elif defined(AFS_DFBSD_ENV) || defined(AFS_USR_DFBSD_ENV)
* file's inode, directory, and bump the number of files found
* total and in this directory.
*/
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX_ENV)
inode_for_V[vFileNum] = currp->d_ino;
#endif
dir_for_V[vFileNum] = dirNum; /* remember this directory */
SetNoBackupAttr(fullpn_CellInfoFile);
} else if ((strcmp(currp->d_name, ".") == 0)
|| (strcmp(currp->d_name, "..") == 0) ||
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
/* this is the ext3 journal file */
(strcmp(currp->d_name, ".journal") == 0) ||
#endif
vFileNum);
else {
struct stat statb;
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX_ENV)
assert(inode_for_V[vFileNum] == (AFSD_INO_T) 0);
#endif
sprintf(vFilePtr, "D%d/V%d", thisDir, vFileNum);
if (CreateCacheFile(fullpn_VFile, &statb))
printf("%s: Can't create '%s'\n", rn, fullpn_VFile);
else {
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX_ENV)
inode_for_V[vFileNum] = statb.st_ino;
#endif
dir_for_V[vFileNum] = thisDir;
/* might want to check here for anything else goofy, like cache pointed at a non-dedicated directory, etc */
-#ifdef AFS_LINUX24_ENV
+#ifdef AFS_LINUX_ENV
{
int res;
struct statfs statfsbuf;
if (res != 0) {
return "unable to statfs cache base directory";
}
-#if !defined(AFS_LINUX26_ENV)
- if (statfsbuf.f_type == 0x52654973) { /* REISERFS_SUPER_MAGIC */
- return "cannot use reiserfs as cache partition";
- } else if (statfsbuf.f_type == 0x58465342) { /* XFS_SUPER_MAGIC */
- return "cannot use xfs as cache partition";
- } else if (statfsbuf.f_type == 0x01021994) { /* TMPFS_SUPER_MAGIC */
- return "cannot use tmpfs as cache partition";
- } else if (statfsbuf.f_type != 0xEF53) {
- return "must use ext2 or ext3 for cache partition";
- }
-#endif
}
#endif
}
#endif
+#ifdef AFS_SOCKPROXY_ENV
+
+# define AFS_SOCKPROXY_RECV_IDX 0
+# define AFS_SOCKPROXY_INIT_IDX 1
+
+/*
+ * Must be less than or equal to the limits supported by libafs:
+ * AFS_SOCKPROXY_PKT_MAX and AFS_SOCKPROXY_PAYLOAD_MAX.
+ */
+# define AFS_SOCKPROXY_PKT_ALLOC 32
+# define AFS_SOCKPROXY_PAYLOAD_ALLOC 2832
+
+/**
+ * Create socket, set send and receive buffer size, and bind a name to it.
+ *
+ * @param[in] a_addr address to be assigned to the socket
+ * @param[in] a_port port to be assigned to the socket
+ * @param[out] a_sock socket
+ *
+ * @return 0 on success; errno otherwise.
+ */
+static int
+SockProxyStart(afs_int32 a_addr, afs_int32 a_port, int *a_sock)
+{
+ int code;
+ int attempt_i;
+ int blen, bsize;
+ int sock;
+ struct sockaddr_in ip4;
+
+ *a_sock = -1;
+
+ /* create an endpoint for communication */
+ sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ if (sock < 0) {
+ code = errno;
+ goto done;
+ }
+
+ /* set options on socket */
+ blen = 50000;
+ bsize = sizeof(blen);
+ for (attempt_i = 0; attempt_i < 2; attempt_i++) {
+ code = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &blen, bsize);
+ code |= setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &blen, bsize);
+ if (code == 0) {
+ break;
+ }
+ /* setsockopt didn't succeed. try a smaller size. */
+ blen = 32766;
+ }
+ if (code != 0) {
+ code = EINVAL;
+ goto done;
+ }
+ /* assign addr to the socket */
+ ip4.sin_family = AF_INET;
+ ip4.sin_port = a_port;
+ ip4.sin_addr.s_addr = a_addr;
+
+ code = bind(sock, (struct sockaddr *)&ip4, sizeof(ip4));
+ if (code != 0) {
+ code = errno;
+ goto done;
+ }
+
+ /* success */
+ *a_sock = sock;
+ sock = -1;
+
+ done:
+ if (sock >= 0) {
+ close(sock);
+ }
+ return code;
+}
+
+/**
+ * Create and initialize socket with address received from kernel-space.
+ *
+ * @param[in] a_idx index of the process responsible for this task
+ * @param[out] a_sock socket
+ */
+static void
+SockProxyStartProc(int a_idx, int *a_sock)
+{
+ int code, initialized;
+ struct afs_uspc_param uspc;
+
+ initialized = 0;
+
+ memset(&uspc, 0, sizeof(uspc));
+ uspc.req.usp.idx = a_idx;
+
+ while (!initialized) {
+ uspc.reqtype = AFS_USPC_SOCKPROXY_START;
+
+ code = afsd_syscall(AFSOP_SOCKPROXY_HANDLER, &uspc, NULL);
+ if (code) {
+ /* Error; try again. */
+ uspc.retval = -1;
+ sleep(10);
+ continue;
+ }
+
+ switch (uspc.reqtype) {
+ case AFS_USPC_SHUTDOWN:
+ exit(0);
+ break;
+
+ case AFS_USPC_SOCKPROXY_START:
+ uspc.retval =
+ SockProxyStart(uspc.req.usp.addr, uspc.req.usp.port, a_sock);
+ if (uspc.retval == 0) {
+ /* We've setup the socket successfully. */
+ initialized = 1;
+ }
+ break;
+
+ default:
+ /* Error; try again. We must handle AFS_USPC_SOCKPROXY_START before
+ * doing anything else. */
+ uspc.retval = -1;
+ sleep(10);
+ }
+ }
+ /* Startup is done. */
+}
+
+/**
+ * Send list of packets received from kernel-space.
+ *
+ * @param[in] a_sock socket
+ * @param[in] a_pktlist list of packets
+ * @param[in] a_npkts number of packets
+ *
+ * @return number of packets successfully sent; -1 if couldn't send any packet.
+ */
+static int
+SockProxySend(int a_sock, struct afs_pkt_hdr *a_pktlist, int a_npkts)
+{
+ int code;
+ int pkt_i, n_sent;
+
+ n_sent = 0;
+
+ for (pkt_i = 0; pkt_i < a_npkts; pkt_i++) {
+ struct afs_pkt_hdr *pkt = &a_pktlist[pkt_i];
+ struct sockaddr_in addr;
+ struct iovec iov;
+ struct msghdr msg;
+
+ memset(&iov, 0, sizeof(iov));
+ memset(&msg, 0, sizeof(msg));
+ memset(&addr, 0, sizeof(addr));
+
+ addr.sin_addr.s_addr = pkt->addr;
+ addr.sin_port = pkt->port;
+
+ iov.iov_base = pkt->payload;
+ iov.iov_len = pkt->size;
+
+ msg.msg_name = &addr;
+ msg.msg_namelen = sizeof(addr);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+ code = sendmsg(a_sock, &msg, 0);
+ if (code < 0) {
+ break;
+ }
+ n_sent++;
+ }
+
+ if (n_sent > 0) {
+ return n_sent;
+ }
+ return -1;
+}
+
+/**
+ * Alloc maximum number of packets, each with the largest payload possible.
+ *
+ * @param[out] a_pktlist allocated packets
+ * @param[out] a_npkts number of packets allocated
+ */
+static void
+pkts_alloc(struct afs_pkt_hdr **a_pktlist, int *a_npkts)
+{
+ int pkt_i, n_pkts;
+ struct afs_pkt_hdr *pktlist;
+
+ n_pkts = AFS_SOCKPROXY_PKT_ALLOC;
+ pktlist = calloc(n_pkts, sizeof(pktlist[0]));
+ opr_Assert(pktlist != NULL);
+
+ for (pkt_i = 0; pkt_i < n_pkts; pkt_i++) {
+ struct afs_pkt_hdr *pkt = &pktlist[pkt_i];
+ pkt->size = AFS_SOCKPROXY_PAYLOAD_ALLOC;
+
+ pkt->payload = calloc(1, pkt->size);
+ opr_Assert(pkt->payload != NULL);
+ }
+
+ *a_pktlist = pktlist;
+ *a_npkts = n_pkts;
+}
+
+/**
+ * Reset pkt->size for all packets.
+ *
+ * @param[in] a_pktlist list of packets
+ * @param[in] a_npkts number of packets
+ */
+static void
+pkts_resetsize(struct afs_pkt_hdr *a_pktlist, int a_npkts)
+{
+ int pkt_i;
+
+ for (pkt_i = 0; pkt_i < a_npkts; pkt_i++) {
+ struct afs_pkt_hdr *pkt = &a_pktlist[pkt_i];
+ pkt->size = AFS_SOCKPROXY_PAYLOAD_ALLOC;
+ }
+}
+
+/**
+ * Serve packet sending requests from kernel-space.
+ *
+ * @param[in] a_sock socket
+ * @param[in] a_idx index of the process responsible for this task
+ * @param[in] a_recvpid pid of process responsible for receiving packets
+ * (used to simplify shutdown procedures)
+ */
+static void
+SockProxySendProc(int a_sock, int a_idx, int a_recvpid)
+{
+ int code, n_pkts;
+ struct afs_pkt_hdr *pktlist;
+ struct afs_uspc_param uspc;
+
+ n_pkts = 0;
+ pktlist = NULL;
+ memset(&uspc, 0, sizeof(uspc));
+
+ pkts_alloc(&pktlist, &n_pkts);
+ uspc.reqtype = AFS_USPC_SOCKPROXY_SEND;
+ uspc.req.usp.idx = a_idx;
+
+ while (1) {
+ uspc.req.usp.npkts = n_pkts;
+ pkts_resetsize(pktlist, n_pkts);
+
+ code = afsd_syscall(AFSOP_SOCKPROXY_HANDLER, &uspc, pktlist);
+ if (code) {
+ uspc.retval = -1;
+ sleep(10);
+ continue;
+ }
+
+ switch (uspc.reqtype) {
+ case AFS_USPC_SHUTDOWN:
+ if (a_recvpid != 0) {
+ /*
+ * We're shutting down, so kill the SockProxyReceiveProc
+ * process. We don't wait for that process to get its own
+ * AFS_USPC_SHUTDOWN response, since it may be stuck in
+ * recvmsg() waiting for packets from the net.
+ */
+ kill(a_recvpid, SIGKILL);
+ }
+ exit(0);
+ break;
+
+ case AFS_USPC_SOCKPROXY_SEND:
+ uspc.retval = SockProxySend(a_sock, pktlist, uspc.req.usp.npkts);
+ break;
+
+ default:
+ /* Some other operation? */
+ uspc.retval = -1;
+ sleep(10);
+ }
+ }
+ /* never reached */
+}
+
+/**
+ * Receive list of packets from the socket received as an argument.
+ *
+ * @param[in] a_sock socket
+ * @param[out] a_pkts packets received
+ * @param[in] a_maxpkts maximum number of packets we can receive
+ *
+ * @return number of packets received.
+ */
+static int
+SockProxyRecv(int a_sock, struct afs_pkt_hdr *a_pkts, int a_maxpkts)
+{
+ int pkt_i, n_recv;
+ int flags;
+
+ struct iovec iov;
+ struct msghdr msg;
+ struct sockaddr_in from;
+
+ n_recv = 0;
+ flags = 0;
+
+ for (pkt_i = 0; pkt_i < a_maxpkts; pkt_i++) {
+ struct afs_pkt_hdr *pkt = &a_pkts[pkt_i];
+ ssize_t nbytes;
+
+ pkt->size = AFS_SOCKPROXY_PAYLOAD_ALLOC;
+
+ memset(&iov, 0, sizeof(iov));
+ iov.iov_base = pkt->payload;
+ iov.iov_len = pkt->size;
+
+ memset(&from, 0, sizeof(from));
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = &from;
+ msg.msg_namelen = sizeof(from);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+ nbytes = recvmsg(a_sock, &msg, flags);
+ if (nbytes < 0) {
+ break;
+ }
+
+ pkt->size = nbytes;
+ pkt->addr = from.sin_addr.s_addr;
+ pkt->port = from.sin_port;
+
+ n_recv++;
+ flags = MSG_DONTWAIT;
+ }
+ return n_recv;
+}
+
+/**
+ * Receive packets addressed to kernel-space and deliver those packages to it.
+ *
+ * @param[in] a_sock socket
+ * @param[in] a_idx index of the process responsible for this task
+ */
+static void
+SockProxyReceiveProc(int a_sock, int a_idx)
+{
+ int code, n_pkts;
+ struct afs_pkt_hdr *pktlist;
+ struct afs_uspc_param uspc;
+
+ n_pkts = 0;
+ pktlist = NULL;
+ pkts_alloc(&pktlist, &n_pkts);
+
+ memset(&uspc, 0, sizeof(uspc));
+ uspc.req.usp.idx = a_idx;
+ uspc.req.usp.npkts = 0;
+
+ while (1) {
+ uspc.reqtype = AFS_USPC_SOCKPROXY_RECV;
+
+ code = afsd_syscall(AFSOP_SOCKPROXY_HANDLER, &uspc, pktlist);
+ if (code) {
+ uspc.retval = -1;
+ sleep(10);
+ continue;
+ }
+
+ switch (uspc.reqtype) {
+ case AFS_USPC_SHUTDOWN:
+ exit(0);
+ break;
+
+ case AFS_USPC_SOCKPROXY_RECV:
+ uspc.req.usp.npkts = SockProxyRecv(a_sock, pktlist, n_pkts);
+ uspc.retval = 0;
+ break;
+
+ default:
+ /* Some other operation? */
+ uspc.retval = -1;
+ uspc.req.usp.npkts = 0;
+ sleep(10);
+ }
+ }
+ /* never reached */
+}
+
+/**
+ * Start processes responsible for sending and receiving packets for libafs.
+ *
+ * @param[in] a_rock not used
+ */
+static void *
+sockproxy_thread(void *a_rock)
+{
+ int idx;
+ int sock;
+ int recvpid;
+
+ sock = -1;
+ /*
+ * Since the socket proxy handler runs as a user process,
+ * need to drop the controlling TTY, etc.
+ */
+ if (afsd_daemon(0, 0) == -1) {
+ printf("Error starting socket proxy handler: %s\n", strerror(errno));
+ exit(1);
+ }
+
+ /*
+ * Before we do anything else, we must first wait for a
+ * AFS_USPC_SOCKPROXY_START request to setup our udp socket.
+ */
+ SockProxyStartProc(AFS_SOCKPROXY_INIT_IDX, &sock);
+
+ /* Now fork our AFS_USPC_SOCKPROXY_RECV process. */
+ recvpid = fork();
+ opr_Assert(recvpid >= 0);
+ if (recvpid == 0) {
+ SockProxyReceiveProc(sock, AFS_SOCKPROXY_RECV_IDX);
+ exit(1);
+ }
+
+ /* Now fork our AFS_USPC_SOCKPROXY_SEND processes. */
+ for (idx = 0; idx < AFS_SOCKPROXY_NPROCS; idx++) {
+ pid_t child;
+
+ if (idx == AFS_SOCKPROXY_RECV_IDX) {
+ /* Receiver already forked. */
+ continue;
+ }
+ if (idx == AFS_SOCKPROXY_INIT_IDX) {
+ /* We'll start the handler for this index in this process, below. */
+ continue;
+ }
+
+ child = fork();
+ opr_Assert(child >= 0);
+ if (child == 0) {
+ SockProxySendProc(sock, idx, 0);
+ exit(1);
+ }
+ }
+ SockProxySendProc(sock, AFS_SOCKPROXY_INIT_IDX, recvpid);
+
+ return NULL;
+}
+#endif /* AFS_SOCKPROXY_ENV */
+
static void *
afsdb_thread(void *rock)
{
#ifdef AFS_SUN5_ENV
struct stat st;
#endif
-#ifdef AFS_SGI65_ENV
+#ifdef AFS_SGI_ENV
struct sched_param sp;
#endif
if (cmd_OptionPresent(as, OPT_shutdown)) {
/* -shutdown */
- afs_shutdown = 1;
/*
* Cold shutdown is the default
*/
printf("afsd: Shutting down all afs processes and afs state\n");
- code = afsd_syscall(AFSOP_SHUTDOWN, 1);
+ code = afsd_syscall(AFSOP_SHUTDOWN, 1); /* always AFS_COLD */
if (code) {
printf("afsd: AFS still mounted; Not shutting down\n");
exit(1);
cacheStatEntries);
}
-#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_CACHE_VNODE_PATH) && !defined(AFS_LINUX_ENV)
/*
* Create and zero the inode table for the desired cache files.
*/
fork_rx_syscall(rn, AFSOP_RXEVENT_DAEMON);
#endif
+#ifdef AFS_SOCKPROXY_ENV
+ if (afsd_verbose)
+ printf("%s: Forking socket proxy handlers.\n", rn);
+ afsd_fork(0, sockproxy_thread, NULL);
+#endif
+
if (enable_afsdb) {
if (afsd_verbose)
printf("%s: Forking AFSDB lookup handler.\n", rn);
}
/* fall through to setup-by-inode */
}
-#if defined(AFS_SGI62_ENV) || !(defined(AFS_LINUX26_ENV) || defined(AFS_CACHE_VNODE_PATH))
+#if defined(AFS_SGI_ENV) || !(defined(AFS_LINUX_ENV) || defined(AFS_CACHE_VNODE_PATH))
afsd_syscall(AFSOP_CACHEINODE, inode_for_V[currVFile]);
#else
printf
params[0] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
break;
case AFSOP_ADDCELLALIAS:
+#ifdef AFS_SOCKPROXY_ENV
+ case AFSOP_SOCKPROXY_HANDLER:
+#endif
params[0] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
params[1] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
break;
params[3] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
break;
case AFSOP_CACHEINODE:
-#if defined AFS_SGI62_ENV
+#if defined AFS_SGI_ENV
{
afs_int64 tmp = va_arg(ap, afs_int64);
params[0] = CAST_SYSCALL_PARAM((afs_uint32)(tmp >> 32));
#include <afsconfig.h>
#include <afs/param.h>
+#include <afs/opr.h>
#include <roken.h>
#include <sys/file.h>
#include <sys/wait.h>
-#if defined(AFS_LINUX20_ENV)
+#if defined(AFS_LINUX_ENV)
#include <sys/resource.h>
#endif
#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>
#define MOUNT_AFS AFS_MOUNT_STR
#endif /* MOUNT_AFS */
-#ifdef AFS_SGI65_ENV
+#ifdef AFS_SGI_ENV
# include <sched.h>
# define SET_RTPRI(P) { \
struct sched_param sp; \
# define SET_AFSD_RTPRI() SET_RTPRI(68)
# define SET_RX_RTPRI() SET_RTPRI(199)
#else
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
# define SET_AFSD_RTPRI()
# define SET_RX_RTPRI() do { \
if (setpriority(PRIO_PROCESS, 0, -10) < 0) \
SET_AFSD_RTPRI();
}
-#if defined(AFS_LINUX20_ENV)
+#if defined(AFS_LINUX_ENV)
int
os_syscall(struct afsd_syscall_args *args)
{
const char *syscall_str;
#if defined(AFS_SYSCALL)
- syscall_str = AFS_STRINGIZE(AFS_SYSCALL);
+ syscall_str = opr_stringize(AFS_SYSCALL);
#else
syscall_str = "[AFS_SYSCALL]";
#endif
static int
HandleMTab(char *cacheMountDir)
{
-#if (defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV))
+#if (defined (AFS_HPUX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_LINUX_ENV))
FILE *tfilep;
-#if defined(AFS_SGI_ENV) || defined(AFS_LINUX20_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_LINUX_ENV)
struct mntent tmntent;
char *dir;
int i;
mountFlags = MS_FSS;
if ((mount(MOUNT_AFS, cacheMountDir, mountFlags, (caddr_t) MOUNT_AFS))
< 0) {
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
if ((mount("AFS", cacheMountDir, MOUNT_AFS, 0, NULL)) < 0) {
#elif defined(AFS_NBSD50_ENV)
if ((mount(MOUNT_AFS, cacheMountDir, mountFlags, NULL, 0)) < 0) {
+++ /dev/null
-#!/bin/perl
-# 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
-
-# A Perl5 script to install AFS from a distribution directory. Installs in
-# sets called "packages", and offers a Tk based GUI for ease of use.
-#
-
-$| = 1;
-$Debug = 0;
-$RSHas = "root"; # Default ID to use for remote installs through rsh
-$Wish = "wish4.0"; # Location of Tcl/Tk shell
-$Indent = " "; # Indent package output lines with this string
-
-&GetPaths;
-&GetSysname;
-&ReadConfigFile;
-&ParseArgs;
-if ($GUI) {
- &RunGUI; }
-else {
- &CommandlineInstallPackages; };
-
-
-
-
-
-#
-# Find out where this script is. The InstallGuides ought to be in a directory
-# next to this script
-#
-sub GetPaths {
- my($libs);
- $Command = $0;
- $Command =~ s:.*/::;
-
- $BinDir = $0;
- $BinDir =~ s:$Command$::;
- $BinDir = "." if ($BinDir eq "");
- chdir($BinDir);
- $BinDir = `/bin/pwd`; chop $BinDir;
-
- $Command = "$BinDir/$Command";
-
- $libs = $BinDir;
- $libs =~ s:bin$:lib:;
- require "$libs/patch.pl";
-
- $InstallGuideDir = "$libs/InstallGuides";
-}
-
-
-
-
-# Try to deduce the system type
-sub GetSysname {
- my($OS, $revision, $version, $hardware);
-
- if (!$ENV{HOST}) {
- $ENV{HOST} = `/bin/uname -n`;
- chop $ENV{HOST}; };
-
- if ($ENV{SYS_NAME}) {
- $Sysname = $ENV{SYS_NAME};
- return; };
-
- $OS = `/bin/uname -s`; chop $OS;
- $revision = `/bin/uname -r`; chop $revision;
- $revision =~ s/\.//g; # x.y.z --> xyz
- $version = `/bin/uname -v`; chop $version;
-
- if ($OS eq "AIX") {
- $revision = "2" if ($version == 4 && $revision == 3);
- $Sysname = "rs_aix$version$revision"; };
-
- if ($OS eq "HP-UX") {
- $revision =~ s/^[A-Z]*//;
- $revision =~ s/^0//;
- chop $revision; # only 2 digits are used for HPUX
-
- if ($revision < 102) {
- $hardware = `/bin/uname -m`; chop $hardware;
- $hardware =~ s:.*/(.).*:${1}00:; };
- $Sysname = "hp${hardware}_ux$revision"; };
-
- if ($OS =~ /IRIX/) {
- $Sysname = "sgi_$revision"; };
-
- if ($OS eq "OSF1") {
- $revision =~ s/^V//;
- $revision = "32c" if ($version == 148);
- $version = "osf";
- $version = "dux" if ($revision >= 4 && $revision < 10);
- $version = "dux" if ($revision >= 40 && $revision < 100);
- $Sysname = "alpha_$version$revision"; };
-
- if ($OS eq "SunOS") {
- $hardware = `/bin/uname -m`; chop $hardware;
- $revision = int($revision/10) if ($revision >= 500);
- $hardware = "sun4x" if ($revision >= 55 && $revision < 100);
- $revision = 412 if ($revision == 413);
- $Sysname = "${hardware}_$revision"; }
-}
-
-
-
-
-# Read the config file afsinstall.rc to find out the install path buttons for
-# the GUI, the default install path, the package names and descriptions and
-# the client configuration options
-#
-sub ReadConfigFile {
- my(@RCfiles, $rc, $filename, $name, $line, @fields, $value);
- unshift(@Section, "Reading Config File");
-
- # Read in the GENERIC afsinstall.rc file for basic options, then read the
- # system specific file, then potentially read a custome file in the user's
- # home directory
- push(@RCfiles, "$InstallGuideDir/GENERIC/afsinstall.rc");
-
- # The system specific file
- $filename = &PickInstallGuide("afsinstall.rc");
- unless($filename eq "N/A" || $filename eq "SKIP" || $filename =~ /GENERIC/) {
- push(@RCfiles, $filename); };
-
- # The personal file
- $filename = $ENV{'HOME'};
- $filename .= "/" unless ($filename =~ /\/$/);
- $filename .= ".afsinstall.rc";
- for $name (0 .. $#ARGV) {
- next unless (@ARGV[$name] =~ /^-pref/);
- $filename = @ARGV[$name + 1];
- last; };
- push(@RCfiles, $filename);
-
- for $filename (@RCfiles) {
- $rc = open(RC, $filename);
- next if (!$rc);
-
- while ($line = <RC>) {
- chomp $line;
- next if ($line =~ /\#/);
- next if ($line =~ /^$/);
- # Look for leading "sysname:" string
- if ($line =~ /^(\s*([a-zA-Z_0-9]*)\s*:)/) {
- $specific = $1;
- $sys = $2;
- $sys =~ s:x:\.\*:g;
- $sys =~ tr/A-Z/a-z/;
- next unless ($Sysname =~ /$sys/);
- $line =~ s/^$specific//; }
- # Read possible install paths
- if ($line =~ /^\s*\w+\s+\//) {
- @fields = split(/\s+/, $line);
- shift(@fields) if (@fields[0] eq "");
- $name = shift @fields;
- $value = shift @fields;
- $DefaultPaths{$name} = $value;
- if ($name ne "default") {
- unless (grep(/^$name$/, @DefaultPathsList)) {
- push(@DefaultPathsList, $name); } }
- else {
- $InstallPath = $value; }
- next; }
- # Read package names
- if ($line =~ /^\s*\w+\s+\d\s*.*/) {
- @fields = split(/\s+/, $line);
- shift(@fields) if (@fields[0] eq "");
- $name = shift @fields;
- $InstallByDefault{$name} = shift @fields;
- $PkgDescription{$name} = join(" ", @fields) if ($#fields >= 0);
- unless (grep(/^$name$/, @AvailPackages)) {
- push(@AvailPackages, $name); }
- next; };
-
- # Read configuration options
- if ($line =~ /\w+=.*/) {
- ($name,$value) = split(/=/, $line);
- $Configuration{$name} = $value;
- next;
- }
- &ErrorMsg("Unable to parse line in $filename: $line");
- }
- close(RC);
- }
- shift @Section;
-}
-
-
-
-
-# Parse the command line args.
-sub ParseArgs {
- my($pkgs, $arg);
- unshift(@Section, "Initialization");
- while ($arg = shift @ARGV) {
- if ($arg =~ /^-h/) { &Usage; };
- if ($arg eq "-v" ) { $InstallVerbose = 1; $pkgs = 0; next; };
- if ($arg eq "-gui") { $GUI = 1; $pkgs = 0; next; };
- if ($arg eq "-info") { $InfoOnly= 1; $pkgs = 0; next; };
- if ($arg eq "-src") { $InstallPath = shift @ARGV; $pkgs = 0; next; };
- if ($arg =~ /^-pref/){ shift @ARGV; $pkgs = 0; next; };
- if ($arg =~ /^-noback/){ $NoOldFiles = 1; $pkgs = 0; next; };
- if ($arg eq "-pkg") { $arg = shift @ARGV; $pkgs = 1; };
- if ($pkgs) {
- push(@Packages, $arg) unless grep(/^$arg$/, @Packages);
- next; };
- &ErrorMsg("Unknown arg", $arg);
- exit; };
-
- # If no packages specified, install default packages in afsinstall.rc file.
- if ($#Packages >= 0) {
- undef %InstallByDefault;
- for $pkgs (@Packages) {
- $InstallByDefault{$pkgs} = 1; };
- $InstallSet = "custom"; }
- else {
- if (!$GUI) {
- for $pkgs (@AvailPackages) {
- push(@Packages, $pkgs) if ($InstallByDefault{$pkgs}); }; }
- else {
- @Packages = @AvailPackages; };
- $InstallSet = "default"; };
-
- if ($GUI || $InfoOnly) {
- shift @Section;
- return; };
-
- # Where to find the distribution.
- if ($InstallPath eq "") {
- &ErrorMsg("You need to specify a source directory with -src");
- exit; };
- foreach $subdir ("", "/$Sysname", "/$Sysname/dest") {
- next if (!-d "$InstallPath$subdir/root.client" );
- $InstallPath .= $subdir;
- last; };
- if (!-d "$InstallPath/root.client") {
- &ErrorMsg("No AFS distribution under $InstallPath for type", $Sysname);
- exit 1; };
- shift @Section;
-}
-
-
-
-
-sub Usage {
- print <<"EOUSAGE";
-
-Usage: AFSinstall.pl -pkg <package>+ -src <srcdir> [-nobackup] [-v] [-gui]
-
- <package> Specify what package(s) to install
- <srcdir> Specifies the AFS build tree from which to fetch the files.
- The subdirectories ".", <sysname>, and <sysname>/dest will
- be searched
- [-noback] Do not keep previous copy of replaced files as .old files
- [-v] Verbose output
- [-gui] Use a graphical interface to select and install packages
-
-EOUSAGE
- exit;
-}
-
-
-
-
-
-#
-# Command line install
-#
-
-
-sub CommandlineInstallPackages {
- my($Package, $InstallGuide, $exitcode);
- foreach $Package (@Packages) {
- unshift(@Section, $Package);
- print "\nInstalling package $Package\n";
-
- # Find package
- if ($InfoOnly) {
- $InstallGuide = "$InstallGuideDir/info/$Package.toc"; }
- else {
- $InstallGuide = &PickInstallGuide($Package); };
-
- if ($InstallGuide eq "SKIP") {
- print "Package $Package does not apply to $Sysname\n";
- shift @Section;
- next; };
- if ($InstallGuide eq "N/A") {
- &ErrorMsg("No package named $Package for $Sysname systems\n");
- $exitcode++;
- shift @Section;
- next; }
-
- &ReadInstallGuide ($InstallGuide);
- chdir($InstallPath);
- &ErrorsAreFatal(0);
- if (!defined(&$Package)) {
- &ErrorMsg("Subroutine for $Package isn't defined in Install Guide",
- $InstallGuide);
- shift @Section;
- next; };
- DOPACKAGE: { &$Package; }; };
- exit $exitcode;
-}
-
-
-
-
-# Try to find the package among the install guide directories. First look in
-# the directory matching the sysname. If the package isn't there, go to the
-# gerenalized sysnames. They have names like ALPHA_x, HPx_10x, or SGI_6x
-# Find the longest matching generalized sysname that has the package.
-# If no generalized sysnames have the package, use the GENERIC sysname.
-sub PickInstallGuide {
- my($pkg, $best, $caps, $candidate, $wildcard, $skip);
- $pkg = @_[0];
-
- if (-f "$InstallGuideDir/$Sysname/$pkg") {
- return "$InstallGuideDir/$Sysname/$pkg"; };
- if (-f "$InstallGuideDir/$Sysname/$pkg.skip") {
- return "SKIP"; };
-
- $caps = $Sysname;
- $caps =~ tr/a-z/A-Z/;
-
- opendir(IG, $InstallGuideDir);
- while ($candidate = readdir(IG)) {
- next unless ($candidate =~ /[A-Z]/);
- next if ($candidate eq "GENERIC");
- $wildcard = $candidate;
- $wildcard =~ s/x/.*/g;
- next unless ($caps =~ /$wildcard/);
- if (-f "$InstallGuideDir/$candidate/$pkg") {
- $best = $candidate if (length($candidate) > length($best));
- $skip = 0; };
- if (-f "$InstallGuideDir/$candidate/$pkg.skip") {
- $best = $candidate if (length($candidate) >= length($best));
- $skip = 1; }; };
- closedir(IG);
- return("SKIP") if ($skip);
- $best = "GENERIC" if ($best eq "");
-
- return("N/A") unless (-f "$InstallGuideDir/$best/$pkg");
- return("$InstallGuideDir/$best/$pkg");
-}
-
-
-
-
-
-#
-# GUI section
-#
-
-
-# The main input routine. It creates the selection window and reads input from
-# it on READTCL. Once install(s) start, it adds their file descriptors to the
-# vector ReadVec and select()'s on them as well
-sub RunGUI {
- my($selected, $command, $i, $fh, $hostname, $output, $line, $rc);
- local($ReadVec);
- &ForkTCL;
- &DrawMainWindow;
- vec($ReadVec, fileno(READTCL), 1) = 1;
- while(1) {
- select($selected = $ReadVec, undef, undef, undef);
- if (vec($selected, fileno(READTCL), 1)) {
- $command = &TclRead;
- print "Command: [$command]\n" if ($Debug >= 1);
- if ($command =~ /HOST:/) { &NewHost($command); next; };
- if ($command =~ /SHOW:/) { &ForceOutputWindow($command); next; };
- if ($command =~ /STOP:/) { &EndInstall($command); next; };
- if ($command =~ /DISMISS:/){ &DestroyOutputWindow($command); next; };
- if ($command eq "DEFAULT") { &DisablePackages; next; };
- if ($command eq "CUSTOM") { &EnablePackages; next; };
- if ($command eq "PROG") { &DestroyProgressWindow; next; };
- if ($command eq "HELP") { &GUIHelp; next; };
- if ($command eq "INFO") { &GUIInstall(" -info -v"); next; };
- if ($command eq "INSTALL") { &GUIInstall; next; };
- if ($command eq "EXIT") { last; };
- print "Unknown command from GUI: \"$command\" \n"; };
-
- # Check if any pipes produced output
- for $i (0 .. $#InstallHosts) {
- $fh = "COM$i";
- next unless (vec($selected, fileno($fh), 1));
- $hostname = @InstallHosts[$i];
- $output = "HostOutput$hostname";
-
- # Read output from install command
- print STDOUT "Reading from file handle \"$fh\" \n" if ($Debug >= 3);
- $line = <$fh>; chop $line;
- print STDOUT "Subprocess $i: ($.) [$line]\n" if ($Debug >= 3);
-
- if ($line) {
- if (&TkWidgetExists(".out$i")) {
- &AppendOutputWindow($i, $line); };
-
- push(@$output, $line); };
-
- # Terminate quickly if rsh is failing
- if ($line eq "No remote authentication") {
- &ErrorWindow(" Rsh is not working on ", $hostname);
- @InstallResult[$i] = "FAILED";
- &EndInstall($i);
- next; };
-
- # Terminate quickly if Perl is wrong version
- if ($line =~ /syntax error.*my\(/i) {
- &ErrorWindow("Perl must be version 5 on", $hostname);
- &EndInstall($i);
- &DestroyOutputWindow($i);
- undef @$output;
- next; };
-
- # Fill in status boxes in Progress window as package names appear
- if ($line =~ /Installing package /) {
- $nextpkg = $';
- if (@Installing[$i]) {
- &TclPrint("set InstallResult-$i-@Installing[$i] SUCCESS"); };
- @Installing[$i] = $nextpkg;
- &TclPrint("set InstallResult-$i-@Installing[$i] WORKING"); };
-
- # If an error occurs, put an error message in package's result box.
- # Set the @Installing package name to "error" so that when the next
- # package name comes up this one doesn't get reset to "success"
- if ($line =~ /^ *ERROR:/) {
- if (@Installing[$i]) {
- &TclPrint("set InstallResult-$i-@Installing[$i] ERROR");
- @Installing[$i] = "ERROR"; };
- @InstallResult[$i] = "ERRORS"; };
-
- # When installation is done, set the last status box to done. If it
- # had an error, the @Installing pkg name is safely set to ERROR anyway.
- # If no packages were installed, it's a failure.
- # End the installation
- if (eof($fh)) {
- if (@Installing[$i]) {
- &TclPrint("set InstallResult-$i-@Installing[$i] SUCCESS"); }
- else {
- @InstallResult[$i] = "FAILED"; }
- &EndInstall($i); }; }; };
-
- &TclPrint("exit");
-}
-
-
-
-
-# Create a TCL process and attach its STDOUT and STDIN to this Perl script
-sub ForkTCL {
- my($ready);
- pipe R0, WRITETCL;
- pipe READTCL, W1;
- $TclPid = fork;
- if ($TclPid == 0) {
- open(STDIN, "<&R0");
- open(STDOUT, ">&W1");
- close(WRITETCL);
- close(READTCL);
- select(STDOUT);
- exec $Wish;
- print "Could not run wish4.0\n";
- exit; };
-
- vec($ready, fileno(WRITETCL), 1) = 1;
- select(undef, $ready, undef, 5);
- if (vec($ready, fileno(WRITETCL), 1) == 0) {
- print "Tcl/Tk didn't start\n";
- exit; };
-
- close(R0);
- close(W1);
- select WRITETCL;
- $| = 1;
- &TclPrint("wm geometry . 100x200+50+50");
- &TclPrint("proc print {args} { puts \"[lrange \$args 0 end]\"; \\");
- &TclPrint( "flush stdout }");
- select STDOUT;
-}
-
-
-
-
-sub DrawMainWindow {
- my($path, $safepath, $pkg, $n, $packer, $shortpacker, $fit);
- # Typical attributes
- $packer = " -anchor w -padx 10 -pady 5 ";
- $shortpacker = " -anchor w -padx 10";
- $fit = " -fill x -expand 1";
-
- &TclPrint("wm title . \"AFS Install\" ");
-
- # Header
- &TclPrint("set Hostname $ENV{HOST}");
- &TclPrint("frame .host -rel flat -height 3");
- &TclPrint("frame .host.name -rel flat");
- &TclPrint("label .host.name.l -text Hostname: -width 16 -anchor w");
- &TclPrint("entry .host.name.e -textvar Hostname -bd 2 -rel sunk");
- &TclPrint("bind .host.name.e <Key-Return> {print \"HOST:\$Hostname\"}");
- &TclPrint("pack .host.name.l -side left");
- &TclPrint("pack .host.name.e -side right -anchor e $fit");
- &TclPrint("pack .host.name $shortpacker $fit");
- &TclPrint("pack .host $packer $fit");
-
- # Path
- &TclPrint("set Path \"$InstallPath\"");
- &TclPrint("frame .path -rel raised -bd 2");
- &TclPrint("label .path.l -text Path -anchor w");
- &TclPrint("entry .path.e -textvar Path -wid 50 -bd 2 -rel sunk");
- &TclPrint("frame .path.go -rel flat");
-
- $n=0;
- for $path (@DefaultPathsList) {
- $safepath = $path;
- $safepath =~ s/\$/\\\$/;
- &TclPrint("button .path.go.g$n -text \"$safepath\" \\");
- &TclPrint( "-command { set Path \"$DefaultPaths{$path}\" } -bd 2");
- &TclPrint("pack .path.go.g$n -side left");
- $n++; };
- &TclPrint("button .path.go.g$n -text CLEAR -command {set Path \"\"} -bd 2");
- &TclPrint("pack .path.go.g$n -side left");
-
- &TclPrint("pack .path.l .path.e $packer $fit");
- &TclPrint("pack .path.go $shortpacker $fit");
- &TclPrint("pack .path $packer $fit");
-
- # packages
- &TclPrint("frame .pkgchoose -rel raised -bd 2");
- &TclPrint("label .pkgchoose.l -text Packages ");
- &TclPrint("pack .pkgchoose.l $packer");
-
- &TclPrint("set InstallSet $InstallSet");
- &TclPrint("radiobutton .pkgchoose.default -text \\");
- &TclPrint( "\"Default Installation\" -var InstallSet -value default");
- &TclPrint("radiobutton .pkgchoose.custom -text \"Custom Installation:\" \\");
- &TclPrint( "-var InstallSet -value custom");
- &TclPrint(".pkgchoose.default config -command { print DEFAULT }");
- &TclPrint(".pkgchoose.custom config -command { print CUSTOM }");
- &Hilight(".pkgchoose.default", "#B04040");
- &Hilight(".pkgchoose.custom", "#B04040");
- &TclPrint("pack .pkgchoose.default .pkgchoose.custom $shortpacker");
- &TclPrint("pack .pkgchoose $shortpacker $fit");
-
- &TclPrint("frame .pkg -rel raised -bd 2");
- $n=0;
- for $pkg (@AvailPackages) {
- &TclPrint("set cb$n ", 0 + $InstallByDefault{$pkg});
- &TclPrint("checkbutton .pkg.c$n -text \"$PkgDescription{$pkg}\" \\");
- &TclPrint( "-var cb$n");
- &Hilight(".pkg.c$n", "#B04040");
- &TclPrint("pack .pkg.c$n $shortpacker");
- $n++; };
-
- &DisablePackages if ($InstallSet eq "default");
- &TclPrint("pack .pkg $shortpacker $fit");
-
- # Options
- &TclPrint("frame .opt -rel raised -bd 2 ");
- &TclPrint("label .opt.label -text Options ");
- &TclPrint("pack .opt.label $shortpacker");
-
- &TclPrint("set Verbose 1") if ($InstallVerbose);
- &TclPrint("checkbutton .opt.verbose -text Verbose -var Verbose ");
- &Hilight (".opt.verbose", "#B04040");
- &TclPrint("pack .opt.verbose $shortpacker");
-
- &TclPrint("set Nooldfiles 1") if ($NoOldFiles);
- &TclPrint("checkbutton .opt.backup -text \"Don't keep backup files\" \\");
- &TclPrint(" -var Nooldfiles");
- &Hilight (".opt.backup", "#B04040");
- &TclPrint("pack .opt.backup $shortpacker");
-
- &TclPrint("pack .opt $packer $fit");
-
- # Actions
- &TclPrint("frame .action -rel flat -bd 2");
- &TclPrint("button .action.exit -text EXIT -command {print EXIT} -bd 2");
- &TclPrint("button .action.help -text HELP -command {print HELP} -bd 2");
- &TclPrint("button .action.info -text \"INFO ONLY\" -com {print INFO} -bd 2");
- &TclPrint("button .action.go -text INSTALL -com {print INSTALL} -bd 2");
- &TclPrint("pack .action.exit .action.help -side left");
- &TclPrint("pack .action.go .action.info -side right");
- &TclPrint("pack .action $packer -fill x -expand 1");
-
- &TclPrint("wm geometry . \"\"");
-}
-
-
-
-
-# After user presses ENTER in Hostname: box, determine if newly entered
-# hostname is local machine or a remote machine or a filename
-sub NewHost {
- my($hostname);
- $hostname = @_[0];
- $hostname =~ s/^HOST://;
-
- if (-f $hostname && -r $hostname) {
- &TclPrint(".host.name.l configure -text Filename: "); }
- else {
- &TclPrint(".host.name.l configure -text Hostname: "); };
-
- # Local install
- if ($hostname eq $ENV{HOST}) {
- return unless (&TkWidgetExists(".host.id"));
- &TclPrint("destroy .host.id");
- return; };
-
- # Remote install
- return if (&TkWidgetExists(".host.id"));
- &TclPrint("set UserID $RSHas");
- &TclPrint("frame .host.id -rel flat");
- &TclPrint("label .host.id.l -text \"rsh as username:\" -width 16");
- &TclPrint("entry .host.id.e -textvar UserID -bd 2 -rel sunk");
- &TclPrint("pack .host.id.l -side left -anchor w");
- &TclPrint("pack .host.id.e -side right -ancho e -fill x -expand 1");
- &TclPrint("pack .host.id -side top -padx 10 -after .host.name \\");
- &TclPrint(" -fill x -expand 1");
-}
-
-
-
-
-
-#
-# The "Default" installation is selected, so turn off the packages
-#
-sub DisablePackages {
- local($pkg, $n);
- $n = 0;
- for $pkg (@AvailPackages) {
- &TclPrint(".pkg.c$n config -state disabled");
- &TclPrint(".pkg.c$n config -selectcolor [ .pkg cget -bg ]");
- $n++; };
-}
-
-
-#
-# The "Custom" installation is selected, so turn on the packages
-#
-sub EnablePackages {
- local($pkg, $n);
- $n = 0;
- for $pkg (@AvailPackages) {
- &TclPrint(".pkg.c$n config -state normal");
- &Hilight(".pkg.c$n", "#B04040");
- $n++; };
-}
-
-
-
-
-
-#
-# GUI Based install procedure
-#
-
-# Help screen
-sub GUIHelp {
- my($line, $rc);
-
- $rc = open(HELP, "$InstallGuideDir/info/gui.toc");
- if (!$rc) {
- &ErrorWindow("Sorry, could not find the help file");
- return; };
-
- &CreateOutputWindow(0, "help");
- while ($line = <HELP>) {
- chop $line;
- $line =~ s/\"/\\\"/g;
- &AppendOutputWindow(0, $line); };
- close(HELP);
- &TclPrint(".out0.f.t see 1.0");
-}
-
-
-
-
-# Start up all pipes to start installs. Also set ReadVec with bits for all
-# running pipes.
-sub GUIInstall {
- my($rc);
- if (&TkWidgetExists(".prog")) {
- &ErrorWindow("Please close the current install window first");
- return; };
-
- $rc = &GatherData(@_);
- return if ($rc);
-
- $rc = &StartInstalls;
- return if ($rc);
-
- if (@_[0]) {
- &CreateOutputWindow(0, @InstallHosts[0]); }
- else {
- &CreateProgressWindow; };
-}
-
-
-
-
-# Get the data in the boxes of the window.
-# Sets @InstallHosts, $InstallID, $InstallPath, $InstallPkgs,
-# $InstallVerbose, and $InstallOpts
-#
-sub GatherData {
- my($pkg, $hostORfilename, $rc);
-
- @InstallHosts = ($ENV{HOST});
- undef $InstallID;
- $InstallPkgs = "";
- $InstallOpts = @_[0]; # This will be "-info -v" for Info Only install
-
- # Read the package checkbuttons. Build a list of selected package names
- &TclPrint("print \$InstallSet install");
- $InstallSet = &TclRead;
- if ($InstallSet eq "custom install") {
- for $pkg (0 .. $#AvailPackages) {
- &TclPrint("print \$cb$pkg");
- $InstallPkgs .= " @AvailPackages[$pkg]" if (&TclRead); };
- $InstallPkgs =~ s/^ //;
- if (!$InstallPkgs) {
- &ErrorWindow("No install packages specified");
- return 1; }; };
-
- return 0 if ($InstallOpts); # Info only install
-
- # Get the hostname or filename to install on
- &TclPrint("print \$Hostname");
- $hostORfilename = &TclRead;
- if (!$hostORfilename) {
- &ErrorWindow("Need to specify a hostname at top");
- return 1; };
-
- # File containing hostnames
- if (-f $hostORfilename) {
- undef @InstallHosts;
- $rc = open(HOSTS, $hostORfilename);
- if (!$rc) {
- &ErrorWindow("Cannot read", $hostORfilename);
- return 1; };
- @InstallHosts = <HOSTS>;
- chomp @InstallHosts;
- close(HOSTS); }
- else {
- @InstallHosts = ($hostORfilename); };
-
- # Remote host named. Get the username under which to rsh
- if ($hostORfilename ne $ENV{HOST}) {
- if (&TkWidgetExists(".host.id")) {
- &TclPrint("print \$UserID");
- $InstallID = &TclRead; };
- $InstallID = $RSHas if (!$InstallID); };
-
- &TclPrint("print \$Path");
- $InstallPath = &TclRead;
- if (!$InstallPath) {
- &ErrorWindow("Need to specify a path to install from");
- return 1; };
-
- &TclPrint("print \$Verbose");
- $InstallVerbose = &TclRead;
- $InstallOpts .= "-v " if ($InstallVerbose);
-
- &TclPrint("print \$Nooldfiles");
- $NoOldFiles = &TclRead;
- $InstallOpts .= "-nobackup " if ($NoOldFiles);
-
- return 0;
-}
-
-
-
-
-# Start all install processes. Splice out hostnames that couldn't be started
-# Truncates fully qualified hostnames down to hostname
-# Sets @Pid, $ReadVec, and filehandle COM<i>
-# Clears @HostOuput<hostname> and @Installing
-#
-# Returns 0 if install(s) are started, 1 otherwise
-#
-sub StartInstalls {
- my($i, $fh, $output, $command, @brokenpipes);
-
- undef @Installing;
- $i = 0; # Cannot let $i start off undefined; must be numerical
- while ($i <= $#InstallHosts) {
- $command = "";
- $command = "rsh -n -l $InstallID @InstallHosts[$i] " if ($InstallID);
- $command .= "$Command ";
- $command .= "-src $InstallPath ";
- $command .= "-pkg $InstallPkgs " if ($InstallPkgs);
- $command .= $InstallOpts;
- #$command = "/bin/echo Installing package rc\n";
-
- print STDOUT "COMMAND: \"$command\" \n" if ($Debug >= 2);
-
- $fh = "COM$i";
- @Pid[$i] = open($fh, "$command 2>&1 |");
- if (@Pid[$i]) {
- @InstallHosts[$i] =~ s:\..*::;
- print STDOUT "Install on @InstallHosts[$i] started\n" if ($Debug >= 1);
- $output = "HostOutput@InstallHosts[$i]";
- undef @$output;
- vec($ReadVec, fileno($fh), 1) = 1;
- $i++; }
- else {
- push(@brokenpipes, splice(@InstallHosts, $i, 1)); }; };
-
- if ($#brokenpipes >= 0) {
- &ErrorWindow("Could not create pipes for:", @brokenpipes); };
-
- print STDOUT $#InstallHosts + 1, " installs started\n" if ($Debug >= 1);
- return 0 if ($#InstallHosts >=0);
- return 1;
-}
-
-
-
-
-# An install process is done
-# Parameter passed in is "STOP: i" where "i" is the index into @Pid, COM<i>,
-# and @InstallHosts
-#
-# Kill the process, reset its @Pid, close it's file handle
-#
-sub EndInstall {
- my($num, $fh);
- $num = @_[0];
- $num =~ s/[^0-9]//g;
- @InstallResult[$num] = "KILLED" if (@_[0] =~ /^STOP/);
-
- kill 9, @Pid[$num] if (@Pid[$num] > 0);
- print STDOUT "Process \"$num\" killed\n" if ($Debug >= 2);
- @Pid[$num] = -1;
- if (&TkWidgetExists(".out$num.act.stop")) {
- &TclPrint("destroy .out$num.act.stop"); };
-
- $fh = "COM$num";
- vec($ReadVec, fileno($fh), 1) = 0;
- close($fh);
-
- &TclPrint("set InstallResult-$num-done @InstallResult[$num]");
-}
-
-
-
-
-# Set the colors of a Tk widget
-sub Hilight {
- my($widget, $color) = @_;
- &TclPrint("$widget configure -activebackground [ $widget cget -bg ]");
- &TclPrint("$widget configure -activeforeground black ");
- &TclPrint("$widget configure -selectcolor \"$color\" ");
-}
-
-
-
-
-# Create a window to show progress of install
-sub CreateProgressWindow {
- my($pkg, $host, $i, @pkglist, $dx, $dy);
- &TclPrint(".action.go config -state disabled");
- &TclPrint(".action.info config -state disabled");
- &TclPrint("toplevel .prog");
- &TclPrint("wm geometry .prog 100x100+100+150");
- &TclPrint("wm title .prog Installing");
- &TclPrint("wm protocol .prog WM_DELETE_WINDOW { print PROG }");
-
- # Create a "Packages" label in UL corner
- # &TclPrint("label .prog.pkg -text \"Packages\" -width 20 -anchor w");
- # &TclPrint("place .prog.pkg -x 10 -y 10");
-
- # Create the lefthand column of package names
- @pkglist = split(/ /, $InstallPkgs);
- @pkglist = @AvailPackages if ($#pkglist < 0);
- $dy = 45;
- foreach $pkg (@pkglist, "done") {
- &TclPrint("label .prog.$pkg -text \"$pkg\"");
- &TclPrint("place .prog.$pkg -in .prog -x 10 -y $dy");
- $dy += 30; };
-
- # Create a column of indicators for each host
- $i = 0;
- $dx = 100;
- foreach $host (@InstallHosts) {
- &TclPrint("button .prog.h$i -text \"$host\" -command { print SHOW: $i }");
- &TclPrint("place .prog.h$i -in .prog -x $dx -y 10");
- $dy = 40;
- $dx += 5;
-
- # Lights for each package for this host
- foreach $pkg (@pkglist, "done") {
- &TclPrint("set InstallResult-$i-$pkg \"\"");
- &TclPrint("entry .prog.h$i-$pkg -width 8 -text InstallResult-$i-$pkg");
- &TclPrint("place .prog.h$i-$pkg -in .prog -x $dx -y $dy");
- &TclPrint(".prog.h$i-$pkg config -state disabled");
- $dy += 30; };
- @InstallResult[$i] = "SUCCESS"; # gotta be optimistic
- $dx += 75;
- $i++; };
-
- # Create a "go away" button
- $dy += 15;
- &TclPrint("label .prog.verbose -text \"Click hostname to view output\"");
- &TclPrint("place .prog.verbose -in .prog -x 10 -y $dy");
- $dy += 30;
- &TclPrint("button .prog.exit -text DISMISS -com { print PROG }");
- &TclPrint("place .prog.exit -in .prog -x 10 -y $dy");
- $dy += 35;
- $dx = 200 if ($dx < 200);
-
- # Display everything
- $i = $dx . "x" . $dy . "+100+150";
- &TclPrint("wm geometry .prog $i");
-}
-
-
-
-
-# Delete the progress window
-sub DestroyProgressWindow {
- my($hostname, $output);
- &TclPrint("destroy .prog") if (&TkWidgetExists(".prog"));
- &TclPrint(".action.go config -state normal");
- &TclPrint(".action.info config -state normal");
-
- # Clear install output from memory
- for $hostname (@InstallHosts) {
- $output = "HostOutput$hostname";
- undef @$output; };
-}
-
-
-
-
-# Create the 2nd window into which install output is written.
-sub CreateOutputWindow {
- my($i, $hostname, $x);
- $i = shift @_;
- $hostname = shift @_;
- &TclPrint("destroy .out$i") if (&TkWidgetExists(".out$i"));
-
- if (&TkWidgetExists(".prog.h$i")) {
- &TclPrint(".prog.h$i config -state disabled"); };
-
- $x = 250 + $i * 10;
- &TclPrint("toplevel .out$i");
- &TclPrint("wm geometry .out$i 100x100+$x+150");
- &TclPrint("wm title .out$i \"Command Output $hostname\"");
- &TclPrint("wm protocol .out$i WM_DELETE_WINDOW { print DISMISS: $i }");
-
- &TclPrint("frame .out$i.f -bd 2");
- &TclPrint("text .out$i.f.t -width 80 -height 20 -bd 2");
- &TclPrint("scrollbar .out$i.f.s -command \".out$i.f.t yview\" -bd 2");
- &TclPrint(".out$i.f.t config -yscr \".out$i.f.s set\"");
- &TclPrint("pack .out$i.f.t -side left -expand yes -fill both");
- &TclPrint("pack .out$i.f.s -side right -fill y");
- &TclPrint("pack .out$i.f -side top -expand yes -fill both");
-
- &TclPrint("frame .out$i.act -relief flat");
- if(@Pid[$i] > 0) {
- &TclPrint("button .out$i.act.stop -text \"STOP INSTALL\" \\");
- &TclPrint( "-com {print STOP: $i } -bd 2");
- &TclPrint("pack .out$i.act.stop -padx 20 -side left"); };
- &TclPrint("button .out$i.act.dismiss -text DISMISS \\");
- &TclPrint( "-com {print DISMISS: $i } -bd 2");
- &TclPrint("pack .out$i.act.dismiss -padx 20 -side right");
-
- &TclPrint("pack .out$i.act -side bottom");
-
- &TclPrint("wm geometry .out$i \"\" ");
-
- # Create some tags in the text box for easy highlighting
- &TclPrint(".out$i.f.t tag add err 1.0 1.0");
- &TclPrint(".out$i.f.t tag configure err -background \\#B04040");
- &TclPrint(".out$i.f.t tag add header 1.0 1.0");
- &TclPrint(".out$i.f.t tag configure header -background \\#A0A0A0");
- &TclPrint(".out$i.f.t tag add normal 1.0 1.0");
-}
-
-
-
-
-# Print in the output window
-# Parameters passed in are the window number and the text to print
-sub AppendOutputWindow {
- my($i, $line, $padlen);
- $i = shift @_;
- for $line (@_) {
- # Backslash escape any quote characters that aren't already escaped
- $line =~ s/([^\\])\"/$1\\\"/g;
- # Backslash escape any bracket characters that aren't already escaped
- $line =~ s/([^\\])([\[\]])/$1\\$2/g;
-
- # Errors turn red
- if ($line =~ /^ *ERROR:/) {
- &TclPrint(".out$i.f.t insert end \"$Indent\" normal \"ERROR:\" err \\");
- &TclPrint( "\"$'\\n\" normal");
- next; }
- # Package names get highlighted in grey
- elsif ($line =~ /^Installing package/) {
- &TclPrint(".out$i.f.t insert end \"\\n\" normal \"$line \" header \\");
- &TclPrint("\"\\n\" normal");
- next; }
- # Normal text
- else {
- &TclPrint(".out$i.f.t insert end \"$line\\n\" normal"); }; };
-
- # Scroll window to end of output
- &TclPrint(".out$i.f.t see end");
-}
-
-
-
-
-# Create the output window and dump to it all of the lines of output that
-# have been accumulated so far
-sub ForceOutputWindow {
- my($i, $hostname, $output);
- $i = @_[0];
- $i =~ s/^SHOW: //;
- return if (&TkWidgetExists(".out$i"));
-
- $hostname = @InstallHosts[$i];
- $output = "HostOutput$hostname";
-
- &CreateOutputWindow($i, $hostname);
- &AppendOutputWindow($i, @$output);
-}
-
-
-
-
-sub DestroyOutputWindow {
- my($i);
- $i = @_[0];
- $i =~ s/[^0-9]//g;
- &TclPrint("destroy .out$i") if (&TkWidgetExists(".out$i"));
- &TclPrint(".prog.h$i config -state normal") if(&TkWidgetExists(".prog.h$i"));
-}
-
-
-
-
-# Create a temp window with a message and an OK button
-sub ErrorWindow {
- my($win, $phrase, $i);
- $win = ".err$ErrorWindowNumber";
- $ErrorWindowNumber++;
- &TclPrint("toplevel $win");
- &TclPrint("wm geometry $win 100x20+", 50 + $ErrorWindowNumber * 5, "+150");
- &TclPrint("wm title $win Message");
- &TclPrint("wm protocol $win WM_DELETE_WINDOW { destroy $win }");
-
- $i = 0;
- for $phrase (@_) {
- &TclPrint("label $win.l$i -text \"$phrase\"");
- &TclPrint("pack $win.l$i -side top -padx 10");
- $i++; };
- &TclPrint("button $win.b -text OK -command { destroy $win }");
- &TclPrint("pack $win.b -pady 10 -anchor center");
-
- &TclPrint("wm geometry $win \"\" ");
-}
-
-
-
-
-
-#
-# Routines for the Install Guides to use
-#
-
-
-# Read an InstallGuide file into the Perl context
-sub ReadInstallGuide {
- my($ig, $rc, $contents, $line);
- $ig = @_[0];
-
- $rc = open(IG, $ig);
- if (!$rc) {
- &ErrorMsg("Could not read Install Guide", $ig);
- return 1; };
- while ($line = <IG>) {
- $contents .= $line; };
- close(IG);
-
- eval $contents;
- &ErrorMsg("$ig could not be avalulated:$@") if ($@ ne "");
-
-}
-
-
-
-
-# Copy a file. Because there are so many error checks in this routine, a
-# wrapper is put around it so any errors can return() without a lot of
-# cleanup code.
-sub Copy {
- my(@msg);
- unshift(@Section, "Copy");
-
- @msg = &CopyWrapper(@_);
- &ErrorMsg(@msg) unless (@msg[0] eq "OK");
- close(SRC);
- close(DST);
-
- shift @Section;
-}
-
-sub CopyWrapper {
- my($srcprog, $dstprog, $prog, @prog, $mode, $rc, $olddstprog, $different);
- my($dbytes, $dstbuf, $sbytes, $srcbuf);
- $different = $olddstprog = 0;
-
- return("Wrong number of args") if ($#_ != 1);
- $srcprog = shift @_;
- $dstprog = shift @_;
-
- # If a directory was given as the dest, append the filename
- @prog = split(/\//, $srcprog);
- $prog = pop(@prog);
- $dstprog =~ s:/$::;
- $dstprog .= "/$prog" if (-d $dstprog);
-
- # Open the src and new dest file
- $rc = open(SRC, $srcprog);
- return("Could not open src file to Copy", $srcprog) if (!$rc);
-
- $newdstprog = "$dstprog.new";
- $rc = open(NEW, ">$newdstprog");
- return("Could not open new dst file for Copy", $newdstprog) if (!$rc);
-
- if (-e $dstprog) {
- $rc = open(DST, $dstprog);
- $olddstprog = "$dstprog.old"; }
- while ($sbytes = read(SRC, $srcbuf, 4096)) {
- if ($olddstprog) {
- $dbytes = read(DST, $dstbuf, 4096);
- if (!$different) {
- if ($sbytes != $dbytes || $srcbuf ne $dstbuf) {
- $different = 1; }; }; };
- print NEW $srcbuf; };
-
- if (!$olddstprog || $different) {
- &VPrint ("Copying file: \"$srcprog\" to \"$dstprog\"");
- if ($olddstprog && !$NoOldFiles) {
- unlink($olddstprog);
- rename($dstprog, $olddstprog); };
- $rc = rename($newdstprog, $dstprog);
- if (!$rc) {
- if ($! eq "Text file busy") {
- rename($dstprog, "$dstprog.busy");
- $rc = rename($newdstprog, $dstprog); }
- &ErrorMsg("Could not install new version of", $newdstprog) if (!$rc); };
-
- # Set the mode bits of the dst file identical to the src file
- &Chown(0,2, $dstprog);
- &Chmod(0755, $dstprog); }
- else {
- &VPrint("\"$dstprog\" is already a copy of \"$srcprog\"");
- unlink($newdstprog); };
- return("OK");
-}
-
-
-
-
-# Read a file, looking for an AFS marker
-sub AFSversion {
- my($filename, $version, $rc, $line);
- $filename = @_[0];
- $rc = open(FILE, $filename);
- return("") if (!$rc);
- while ($line = <FILE>) {
- next unless ($line =~ /Base configuration afs/);
- $line =~ s/.*Base configuration //;
- $line =~ s/\000.*//;
- last; };
- close(FILE);
-
- if ($line) {
- $version = $line;
- $version =~ s/;.*//;
- chomp $version;
- $version .= "+" if ($&);
- $version =~ s/ /-/g; };
- return($version);
-}
-
-
-
-# Copy a file from one place to another. At the destination site, keep a hard
-# link to the file naming what version the file is. The version string will
-# be ".orig" for non-AFS files, or the AFS version number (eg -afs3.4-5.00)
-# for AFS files. Attempt to preserve old ,orig files and NOT preserve multiple
-# AFS versions.
-sub VersionCopyFile {
- my(@msg);
- unshift(@Section, "VersionCopyFile");
-
- @msg = &VersionCopyFileWrapper(@_);
- &ErrorMsg(@msg) unless (@msg[0] eq "OK");
- shift @Section;
-}
-
-sub VersionCopyFileWrapper {
- my($from, $to, $link, $rc, $inode, @paths, $dir, $file);
- my($from_vers, $to_vers, $old_vers, $buf);
- $from = shift @_;
- $to = shift @_;
-
- # Error check
- return("No such file", $from) if (!-f $from);
- $from_vers = &AFSversion($from);
-
- # Check if there is already a file in the destination place
- if (-e $to) {
- @stats = stat(_);
- $to_vers = &AFSversion($to);
-
- # If the $to file is a soft link, just remove it
- if (-l $to) {
- &VPrint("Removing soft link \"$to\"");
- $rc = unlink($to);
- return("Could not remove symlink", $to) if ($rc != 1); }
-
- # Cannot work if $to is a directory
- elsif (-d $to) {
- return("$to is a directory"); }
-
- # The $to file exists but was not a soft symlink. Move aside or delete it.
- # If the $to file is the same version as $from, just remove $to.
- # Otherwise move $to aside
- else {
- if ($to_vers eq $from_vers) {
- &VPrint("Removing \"$to\" that is same version as \"$from\"");
- $rc = unlink($to);
- return("Could not remove \"$to\"") if (!$rc); }
- else {
- # Make a new name to which to move the old $to file
- if ($to_vers) {
- $file = "$to-$to_vers"; }
- else {
- $file = "$to.orig"; };
- &VPrint("Moving \"$to\" to \"$file\"");
- return("Cannot move old \"$to\" to \"$file\"") if (-d $file);
- unlink($file);
- $rc = rename($to, $file);
- return("Could not move \"$to\" to", $file) if (!$rc); }; }; };
-
- # Do the actual copy
- &VPrint("Copying \"$from\" to \"$to\"");
- $rc = open(SRC, $from);
- return("Could not read original file", $from) if (!$rc);
- $rc = open(DST, ">$to");
- return("Could not open for writing", $to) if (!$rc);
- while(read(SRC, $buf, 4096)) {
- $rc = print DST $buf;
- return("write() failed to", $to) if (!$rc); };
- close(DST);
- close(SRC);
-
- # Create a hard link of the dest file
- $version = &AFSversion($to);
- if ($version) {
- $link = "$to-$version"; }
- else {
- $link = "$to.orig"; };
-
- # If a file already exists where the hard link is to be, delete it
- if (-f $link) {
- &VPrint("Removing \"$link\" to place a new hard link there");
- $rc = unlink($link);
- return("Could not ($!) remove old", $link) if (!$rc); };
-
- # Make the hardlink
- &VPrint("Creating new hard link \"$link\"");
- $rc = link($to, $link);
- return("Could not make hardlink \"$to\" to", $link) if (!$rc);
- return("OK");
-}
-
-
-
-
-# Create a list of directories and any parent directories required
-# Only use absolute paths that start with /
-sub CreateDir {
- my($dir, $path, @subdirs, $subdir, $rc);
- unshift(@Section, "CreateDir");
- foreach $dir (@_) {
-
- # Make sure an absolute path was given
- if (substr($dir, 0, 1) ne "/") {
- &ErrorMsg("Won't mkdir relative directory", $dir);
- shift @Section;
- return; };
-
- # Check each parent directory. Work up parent dirs with $path variable.
- # Split up the entire path into an array. Since $dir starts with a /, the
- # first scalar in the array will be "". Remove it.
- $path = "";
- @subdirs = split(/\//, $dir);
- shift @subdirs;
-
- VPrint("Creating directory: \"$dir\"");
-
- foreach $subdir (@subdirs) {
- $path .= "/$subdir";
- next if (-d $path);
- next if (-l $path);
-
- # Create the directory and check the return code
- $rc = mkdir($path, 0775);
- next if ($rc);
- &ErrorMsg("Cannot create directory", $path);
- shift @Section;
- return; }; };
- shift @Section;
-}
-
-
-
-
-# Create a symlink. Carefully.
-sub Symlink {
- my($filename, $linkname, $rc);
- unshift(@Section, "Symlink");
- $filename = @_[0];
- $linkname = @_[1];
- &VPrint("Making \"$linkname\" point to \"$filename\"");
- &DisplaceFile($linkname);
- $rc = symlink($filename, $linkname);
- &ErrorMsg("Could not make symlink", "$linkname -> $filename") if (!$rc);
- shift @Section;
-}
-
-
-
-
-# Move a file aside. Because there are so many error checks in this routine, a
-# wrapper is put around it so any errors can return() without a lot of
-# cleanup code.
-sub DisplaceFile {
- my(@msg);
- unshift(@Section, "DisplaceFile");
-
- @msg = &DisplaceWrapper(@_);
- &ErrorMsg(@msg) unless (@msg[0] eq "OK");
- shift @Section;
-}
-
-# Move a file aside. If it is an AFS file, delete it. Otherwise move it
-# to .orig This is for files like fsck and login that have AFS equivalents
-sub DisplaceWrapper {
- my($rc, $displace, $line, $isAFS);
-
- $displace = @_[0];
- return("OK") if (!-e $displace);
-
- # If destination is just a symlink, remove it
- if (readlink($displace)) {
- &VPrint("Removing old \"$displace\" symlink");
- $rc = unlink($displace);
- return("Could not remove link", $displace) if (!$rc);
- return("OK"); };
-
- # If dest is not a file, (ie a directory) this is unfixable
- return("Not a file", $displace) if (-d $displace);
-
- # Read the file, looking for an AFS marker
- $isAFS = &AFSversion($displace);
-
- # Either remove an AFS file or rename a non-AFS file
- if ($isAFS) {
- $rc = unlink($displace);
- return("Could not remove file", $displace) if (!$rc); }
- else {
- &VPrint("Moving old file \"$displace\" aside");
- $rc = rename($displace, "$displace.orig");
- return("Could not rename file", $displace) if (!$rc); };
- return("OK");
-}
-
-
-
-
-# Change the mode bits of a file
-sub Chmod {
- my ($mode, $file, $rc);
- unshift(@Section, "Chmod");
- $mode = shift @_;
- while ($file = shift @_) {
- &VPrint("Setting mode bits on $file to ", sprintf("%lo", $mode));
- $rc = chmod($mode, $file);
- &ErrorMsg("Could not change mode bits of", $file) if (!$rc); };
- shift @Section;
-}
-
-
-
-
-# Change the owner of a file
-sub Chown {
- my ($user, $group, $file, $rc);
- unshift(@Section, "Chown");
- $user = shift @_;
- $group = shift @_;
- while ($file = shift @_) {
- &VPrint("Setting owner of \"$file\" to $user,$group");
- $rc = chown $user, $group, $file;
- &ErrorMsg("Could not change mode bits of", $file) if (!$rc); };
- shift @Section;
-}
-
-
-
-
-# Copy the UID, GID, and MODE info from one file to another
-sub CopyStat {
- my ($user, $group, $srcfile, $destfile, $mode, $rc, @statinfo);
- unshift(@Section, "CopyStat");
- $srcfile = shift @_;
- $destfile = shift @_;
- @statinfo = stat($srcfile);
- $mode = $statinfo[2];
- $user = $statinfo[4];
- $group = $statinfo[5];
- &VPrint("Copying owner,group,mode of \"$srcfile\" to \"$destfile\"");
- $rc = chown $user, $group, $destfile;
- &ErrorMsg("Could not change mode bits of", $destfile) if (!$rc);
- $rc = chmod $mode, $destfile;
- &ErrorMsg("Could not change mode bits of", $destfile) if (!$rc);
- shift @Section;
-}
-
-
-
-#
-# Misc printing routines
-#
-
-
-# This routine causes calls to ErrorMsg to be fatal
-sub ErrorsAreFatal {
- $Fatal = @_[0];
-}
-
-
-
-
-# Print a line with a prepended indent string
-sub Print {
- my($text);
- $text = join("", @_);
- print "$Indent$text\n";
-}
-
-
-
-
-# Print only if in Verbose mode
-sub VPrint {
- return unless ($InstallVerbose);
- &Print(@_);
-}
-
-
-
-
-# A routine to make consistent error messages
-sub ErrorMsg {
- my($msg, $prog);
- $msg = "ERROR: @Section[0]: ";
- $msg .= shift @_;
- $prog = shift @_;
- if ($prog) {
- $prog =~ s:^$InstallPath::;
- $msg .= " \"$prog\""; };
- $msg .= " ($!)" if (($? >> 8) && $Debug);
- &Print($msg);
- last DOPACKAGE if ($Fatal);
-}
-
-
-
-
-# Write a Tcl/Tk command to the $Wish process
-sub TclPrint {
- my($text);
- $text = join("", @_);
- print STDOUT "TO TCL:\"$text\" \n" if($Debug >= 4);
- if ($text =~ /\\$/) {
- $text =~ s:\\$: :;
- print WRITETCL $text; }
- else {
- print WRITETCL "$text\n"; };
-}
-
-
-
-
-# Read a line from Tcl/Tk, and chop off any {} symbols Tcl tacks on
-sub TclRead {
- my($line);
- print STDOUT "Reading from Tcl\n" if ($Debug >= 4);
- $line = <READTCL>;
- chop $line;
- $line =~ s:{::;
- $line =~ s:}::;
- print STDOUT "FROM TCL:\'$line\' \n" if ($Debug >= 4);
- return($line);
-}
-
-
-
-
-# Query Tcl/Tk if a particular widget is drawn. 1=yes 0=no
-sub TkWidgetExists {
- my($reply);
- &TclPrint("print reply: [ info command @_[0] ]");
- $reply = &TclRead;
- return 0 if ($reply eq "reply: ");
- return 1;
-}
+++ /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
- */
-
-#
-# Initialization file for AFSinstall on Alpha machines
-#
-#
-#
-# Alternate directories
-#
-
-#
-# Install packages
-# file Default Description
-#
-modkernel 0 Dynamic kernel libraries and afsd
-bldkernel 1 Static kernel libraries and afsd
-build 1 Perform kernel build
-installkernel 1 Install AFS aware kernel
-
-#
-# Client configuration options
-#
-# option definition
-
-
+++ /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
-
-# An InstallGuide for static kernel built libraries
-# For Alpha systems running Digital Unix 3.x
-#
-
-sub bldkernel {
-my($host);
-
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy("root.client/bin/libafs.o", "/usr/sys/BINARY"); }
-else {
- &Copy("root.client/bin/libafs.nonfs.o", "/usr/sys/BINARY/libafs.o"); };
-
-&CreateDir("/usr/vice/etc");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-
-&ErrorsAreFatal(1);
-# Patch the files
-if (!-f "/usr/sys/conf/AFS") {
- $host = $ENV{HOST};
- $host =~ tr/a-z/A-Z/;
- &Copy("/usr/sys/conf/$host", "/usr/sys/conf/AFS"); };
-
-$AFS="/sys/conf/AFS";
-$FILES="/sys/conf/files";
-$VFSCONF="/sys/vfs/vfs_conf.c";
-
-&Patch::Verbose if ($InstallVerbose);
-
-&Patch::FileOpen($AFS);
-&Patch::FileOpen($FILES);
-&Patch::FileOpen($VFSCONF);
-
-$AFSSearchInsert = <<"xxENDxx";
-options UFS
-options NFS
-xxENDxx
-$AFSNewInsert = <<"xxENDxx";
-options AFS
-xxENDxx
-
-$AFSSearchReplace = "ident\\s+.+";
-$AFSNewReplace = "ident\t\t\"AFS\"";
-
-if (!&Patch::Patch($AFS, [[0, "Insert", $AFSSearchInsert, $AFSNewInsert],
- [1, "Replace", $AFSSearchReplace, $AFSNewReplace]])) {
- &ErrorMsg("Did not succeed with patch", $AFS);
-}
-
-$FILESSearch1 = "OPTIONS/nfs\\s.*";
-$FILESNew1 = "OPTIONS/afs \t\t\toptional afs define_dynamic";
-
-#$FILESSearch2 = "nfs/nfs3_server.c\\s.*";
-#$FILESNew2 = << "xxENDxx";
-#MODULE/afs optional afs Binary
-#afs/libafs.c module afs
-#xxENDxx
-$FILESNew2 = "afs/libafs.c\t\t\toptional afs if_dynamic afs Binary";
-
-#if (!&Patch::Patch($FILES, [[1, "Insert", $FILESSearch1, $FILESNew1],
-# [1, "Insert", $FILESSearch2, $FILESNew2]])) {
-# &ErrorMsg("Did not succeed with patch", $FILES);
-#}
-if (!&Patch::Patch($FILES, [[1, "Insert", $FILESSearch1, $FILESNew1],
- [0, "EOF", $FILESSearch2, $FILESNew2]])) {
- &ErrorMsg("Did not succeed with patch", $FILES);
-}
-
-$VFSSearch1 = "#include <cdfs.h>";
-$VFSNew1 = << "xxENDxx";
-#include <afs.h>
-#if defined(AFS) && AFS
-extern struct vfsops afs_vfsops;
-#endif
-
-#include <cdfs.h>
-xxENDxx
-
-$VFSSearch2 = << "xxENDxx";
- (struct vfsops *)0, "", /* 13 = MOUNT_ADDON */
-xxENDxx
-
-$VFSNew2 = << "xxENDxx";
-#if defined(AFS)
- &afs_vfsops, "afs",
-#else
- (struct vfsops *)0, "", /* 13 = MOUNT_ADDON */
-#endif
-xxENDxx
-
-
-
-if (!&Patch::Patch($VFSCONF, [[0, "Replace", $VFSSearch1, $VFSNew1],
- [0, "Replace", $VFSSearch2, $VFSNew2]])) {
- &ErrorMsg("Did not succeed with patch", $VFSCONF);
-}
-}
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For Alpha systems running Digital Unix 3.x
-#
-
-sub build {
-&Print("Compiling with command \"doconfig -c AFS\"");
-&Print("Answering \"no\" to request to modify configuration");
-&Print("New kernel will be /usr/sys/AFS/vmunix");
-&Print("and should be installed as /vmunix");
-
-$rc = system("/bin/echo no | doconfig -c AFS ");
-$rc = $rc >> 8;
-&Print("Returned code $rc");
-}
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For Alpha systems running Digital Unix
-#
-
-
-sub installkernel {
-&VersionCopyFile("/usr/sys/AFS/vmunix", "/vmunix");
-}
+++ /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
-
-# An InstallGuide for installing the initialization script
-# For Alpha systems running Digital Unix 3.x
-#
-
-sub rc {
-&Copy("root.client/usr/vice/etc/dkload/afs.rc", "/sbin/init.d/afs");
-&Symlink("../init.d/afs", "/sbin/rc0.d/K66afs");
-&Symlink("../init.d/afs", "/sbin/rc3.d/S90afs");
-}
+++ /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
-
-# An InstallGuide for the AFS modified Unix commands
-#
-
-sub OSFunix {
- &Copy("etc/inetd", "/usr/sbin/inetd.afs");
- &Copy("etc/ftpd", "/usr/sbin/ftpd.afs");
- &Copy("etc/rlogind", "/usr/sbin/rlogind.afs");
-
- &ErrorsAreFatal(1);
- &CreateDir("/usr/vice/bin");
-
- &Copy("bin/rcp", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rcp");
- &Chmod (04755, "/usr/vice/bin/rcp");
-
- &Copy("bin/rsh", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rsh");
- &Chmod (04755, "/usr/vice/bin/rsh");
-
- # Create the inetd.conf.afs file
- $InetdConfAfs = open(INETD, "> /etc/inetd.conf.afs");
- &ErrorMsg("Can't open file", "/etc/inetd.conf.afs") if (!$InetdConfAfs);
- print INETD <<"EOINETD";
-ftp stream tcp nowait root /usr/sbin/ftpd.afs ftpd.afs
-shell stream tcp nowait root /usr/sbin/rshd rshd
-login stream tcp nowait root /usr/sbin/rlogind.afs rlogind.afs
-ta-rauth stream tcp nowait root internal ta-rauth
-EOINETD
-
- # comment out the lines in inetd.conf
- $InetdConf = "/etc/inetd.conf";
- &CopyStat($InetdConf, $InetdConfAfs);
- &Patch::Verbose if ($InstallVerbose);
- &Patch::FileOpen($InetdConf);
-
- $Search1 = "^(ftp\\s+.+)";
- $Replace1 = '"#".$1';
-
- $Search2 = "^(shell\\s+.+)";
- $Replace2 = '"#".$1';
-
- $Search3 = "^(login\\s+.+)";
- $Replace3 = '"#".$1';
-
- if (!&Patch::Patch($InetdConf, [[1, "Substitution", $Search1, $Replace1],
- [1, "Substitution", $Search2, $Replace2],
- [1, "Substitution", $Search3, $Replace3]])) {
- &ErrorMsg("Did not succeed with patch", $InetdConf);
- }
-
- # Modify the /etc/services file
- &ReadInstallGuide("$InstallGuideDir/GENERIC/unix");
- &unix;
-}
-
-sub unix {
- goto &OSFunix;
-}
-
+++ /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
-
-# An InstallGuide for installing the AFS aware file system checker
-# For Alpha systems running Digital Unix 3.x
-#
-
-sub vfsck {
-&ErrorsAreFatal(1);
-&Copy ("root.server/etc/vfsck", "/sbin/vfsck");
-&Copy ("root.server/etc/vfsck", "/usr/sbin/vfsck");
-&Symlink ("vfsck", "/sbin/ufs_fsck");
-&Symlink ("vfsck", "/usr/sbin/ufs_fsck");
-}
+++ /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
- */
-
-#
-# Initialization file for AFSinstall
-#
-#
-#
-# Alternate directories
-#
-default /afs/cellname/afsprod/3.4a
-prod /afs/cellname/afsprod/3.4a
-
-#
-# Install packages
-# file Default Description
-#
-modkernel 1 Dynamic kernel libraries and afsd
-bldkernel 0 Static kernel libraries and afsd
-fileserver 0 Fileserver
-dbserver 0 Database server
-miscserver 0 Other servers
-serveruser 0 Server control commands
-tokens 1 User tokens related commands
-unix 1 Modified unix commands
-debug 0 Debugging programs
-other 0 Other
-login 1 Install AFS integrated login
-vfsck 0 Install AFS aware vfsck
-build 0 Perform kernel build
-installkernel 0 Install AFS aware kernel
-rc 1 Create an AFS startup script
-clientconfig 1 Configuration of an AFS client
-
-#
-# Client configuration options
-#
-# option definition
-NFSEXTENSIONS=0
-CACHEDIR=/usr/vice/cache
-CACHESIZE=30000
-CELLNAME=cellname
-CELLSERVDB=/afs/cellname/cinfo/etc/CellServDB
-AFSROOT=/afs
-
+++ /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
-
-# An InstallGuide for configuration of an AFS client
-#
-
-sub clientconfig {
- my($cachefile, $cellfile, $dbfile, $replaced);
- my($afsroot, $cachedir, $cachesize, $cellname);
- my($config, $different, $line)
- &ErrorsAreFatal(1);
- &CreateDir("/usr/vice/etc");
- $cachefile = "/usr/vice/etc/cacheinfo";
- $cellfile = "/usr/vice/etc/ThisCell";
- $dbfile = "/usr/vice/etc/CellServDB";
-
- # Create a new cacheinfo file if it does not already exist
- if (! -r $cachefile) {
- $afsroot = $Configuration{"AFSROOT"};
- $cachedir = $Configuration{"CACHEDIR"};
- $cachesize = $Configuration{"CACHESIZE"};
- &ErrorMsg("AFSROOT not defined") if ($afsroot eq "");
- &ErrorMsg("CACHEDIR not defined") if ($cachedir eq "");
- &ErrorMsg("CACHESIZE not defined") if ($cachesize eq "");
- $config = "$afsroot:$cachedir:$cachesize";
-
- &CreateDir($cachedir);
-
- &CreateDir($afsroot);
- # the next 2 blocks of code will be used later when config
- # parameters can be passed through the GUI to override the
- # defaults
- if (-r $cachefile) {
- open(CONFIG, "$cachefile");
- $replaced = "$cachefile.old";
- chomp($line = <CONFIG>);
- $different = ($line ne $config);
- close CONFIG;
- }
- if (($replaced && $different) || !$replaced) {
- &VPrint("Creating new $cachefile");
- unlink($replaced) if ($replaced);
- rename($cachefile, $replaced) if ($replaced);
- open(CONFIGNEW, ">$cachefile") || &ErrorMsg("Can't open config file",
- $cachefile);
- print CONFIGNEW "$config\n";
- close CONFIGNEW;
- } else {
- &VPrint("$cachefile already created");
- }
- }
- $replaced = $different = 0;
-
- # create a new ThisCell file
- $cellname = $Configuration{"CELLNAME"};
- &ErrorMsg("CELLNAME not defined") if ($cellname eq "");
-
- if (-r $cellfile) {
- open(CELL, "$cellfile");
- $replaced = "$cellfile.old";
- chomp($line = <CELL>);
- $different = ($line ne $cellname);
- close CELL;
- }
- if (($replaced && $different) || !$replaced) {
- &VPrint("Creating new $cellfile");
- unlink($replaced) if ($replaced);
- rename($cellfile, $replaced) if ($replaced);
- open(CELLNEW, ">$cellfile") || &ErrorMsg("Can't open cell file",
- $cellfile);
- print CELLNEW "$cellname\n";
- close CELLNEW;
- } else {
- &VPrint("$cellfile already created");
- }
-
- # create a new CellServDB file
- $cellservdb = $Configuration{CELLSERVDB};
- &ErrorMsg("CELLSERVDB not defined") if ($cellservdb eq "");
- &Copy($cellservdb, $dbfile);
-}
-
-
-
-
-
+++ /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
-
-# An InstallGuide for database server processes
-#
-
-sub dbserver {
-&CreateDir ("/usr/afs/db", "/usr/afs/etc", "/usr/afs/local", "/usr/afs/logs");
-&ErrorsAreFatal(1);
-&CreateDir ("/usr/afs/bin");
-&ErrorsAreFatal(0);
-&Copy ("root.server/usr/afs/bin/bosserver", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/kaserver", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/vlserver", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/ptserver", "/usr/afs/bin");
-&Chmod(0744, "/usr/afs/bin/bosserver");
-&Chmod(0744, "/usr/afs/bin/kaserver");
-&Chmod(0744, "/usr/afs/bin/vlserver");
-&Chmod(0744, "/usr/afs/bin/ptserver");
-}
+++ /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
-
-# An InstallGuide for installing debugging programs
-#
-
-sub debug {
-&ErrorsAreFatal(1);
-&CreateDir ("/usr/vice/bin", "/usr/vice/etc/C", "/usr/afs/bin");
-&ErrorsAreFatal(0);
-&Copy ("bin/afsmonitor", "/usr/vice/bin");
-&Copy ("bin/cmdebug", "/usr/vice/bin");
-&Copy ("etc/fstrace", "/usr/vice/bin");
-&Copy ("etc/kdump", "/usr/vice/bin");
-&Copy ("etc/rxdebug", "/usr/vice/bin");
-&Copy ("bin/scout", "/usr/vice/bin");
-&Copy ("bin/udebug", "/usr/vice/bin");
-&Copy ("root.server/usr/afs/bin/volinfo", "/usr/afs/bin");
-&Copy ("root.client/usr/vice/etc/C/afszcm.cat", "/usr/vice/etc/C");
-&Chmod(0744, "/usr/afs/bin/volinfo");
-&Chmod(0744, "/usr/vice/bin/fstrace");
-&Chmod(0644, "/usr/vice/etc/C/afszcm.cat");
-}
+++ /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
-
-# An InstallGuide for fileserver processes
-#
-
-sub fileserver {
-&CreateDir ("/usr/afs/etc", "/usr/afs/local", "/usr/afs/logs");
-&ErrorsAreFatal(1);
-&CreateDir ("/usr/afs/bin");
-&ErrorsAreFatal(0);
-&Copy ("root.server/usr/afs/bin/bosserver", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/fileserver", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/volserver", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/salvager", "/usr/afs/bin");
-&Chmod(0744, "/usr/afs/bin/bosserver");
-&Chmod(0744, "/usr/afs/bin/fileserver");
-&Chmod(0744, "/usr/afs/bin/volserver");
-&Chmod(0744, "/usr/afs/bin/salvager");
-}
+++ /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
-
-# An InstallGuide for installing the AFS integrated login
-#
-
-sub login {
-&ErrorsAreFatal(1);
-&Copy("bin/login", "/bin/login.afs");
-&Symlink("login.afs", "/bin/login");
-}
+++ /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
-
-# An InstallGuide for fileserver processes
-#
-
-sub miscserver {
-&CreateDir ("/usr/afs/backup", "/usr/afs/etc");
-&CreateDir ("/usr/afs/local", "/usr/afs/logs");
-&ErrorsAreFatal(1);
-&CreateDir ("/usr/afs/bin");
-&ErrorsAreFatal(0);
-&Copy ("root.server/usr/afs/bin/buserver", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/upserver", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/upclient", "/usr/afs/bin");
-&Chmod(0744, "/usr/afs/bin/buserver");
-&Chmod(0744, "/usr/afs/bin/upserver");
-&Chmod(0744, "/usr/afs/bin/upclient");
-}
+++ /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
-
-# An InstallGuide for generic binaries not specifically listed in other
-# packages
-#
-
-sub other {
-$installdir = "/usr/afs/bin";
-
-&ErrorsAreFatal(1);
-&CreateDir($installdir);
-&ErrorsAreFatal(0);
-
-&Copy("bin/compile_et", $installdir);
-&Copy("bin/kpwvalid", $installdir);
-&Copy("bin/install", $installdir);
-&Copy("bin/pagsh", $installdir);
-&Copy("etc/rmtsysd", $installdir);
-&Copy("bin/rxgen", $installdir);
-&Copy("bin/sys", $installdir);
-&Copy("bin/up", $installdir);
-&Copy("bin/washtool", $installdir);
-&Copy("bin/xstat_cm_test", $installdir);
-&Copy("bin/xstat_fs_test", $installdir);
-}
+++ /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
-
-# An InstallGuide for AFS startup scripts
-#
-
-sub rc {
- &ErrorsAreFatal(1);
- $rc = open(RC, ">> /etc/rc.afs");
- &ErrorMsg("Can't append to file", "/etc/rc.afs") if (!$rc);
- print RC <<"EORC";
-#!/bin/sh
-#
-
-EORC
- close(rc);
- &Appendrc;
-}
-
-sub Appendrc {
- my($rmtsys, $otherrmtsys);
- &ErrorsAreFatal(1);
-
- if ($Configuration{"NFSEXTENSIONS"}) {
- $rmtsys = "-rmtsys";
- $otherrmtsys = ""; }
- else {
- $otherrmtsys = "-rmtsys";
- $rmtsys = ""; };
-
- $rc = open(RC, ">> /etc/rc.afs");
- &ErrorMsg("Can't append to file", "/etc/rc.afs") if (!$rc);
- print RC <<"EORC";
-# Choose one depending on how much usage this client gets
-#OPTIONS="-stat 300 -dcache 100 -daemons 2 -volumes 50"
-OPTIONS="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
-#OPTIONS="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
-
-# Choose one depending on if you want this machine to be an NFS Translator
-NFS="$rmtsys"
-#NFS="$otherrmtsys"
-
-# Start bosserver
-if [ -x /usr/afs/bin/bosserver ]; then
- echo 'Starting bosserver' > /dev/console
- /usr/afs/bin/bosserver &
-fi
-
-# Start afsd
-/usr/vice/etc/afsd \$OPTIONS \$NFS
-
-# Start AFS inetd services
-if [ -f /etc/inetd.afs -a -f /etc/inetd.conf.afs ]; then
- /etc/inetd.afs /etc/inetd.conf.afs
-fi
-
-EORC
- close(RC);
-}
+++ /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
-
-# An InstallGuide for user programs for controlling server processes
-#
-
-sub serveruser {
-&CreateDir ("/usr/afs/bin");
-
-&Copy ("root.server/usr/afs/bin/bos", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/fs", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/kas", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/pts", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/vos", "/usr/afs/bin");
-
-&Copy ("etc/butc", "/usr/afs/bin");
-&Copy ("etc/backup", "/usr/afs/bin");
-&Copy ("root.server/usr/afs/bin/ntpdc", "/usr/afs/bin");
-}
+++ /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
-
-# An InstallGuide for installing tokens related commands
-#
-
-sub tokens {
-# Where commands get installed
-$installdir = "/usr/afs/bin";
-
-&ErrorsAreFatal(1);
-&CreateDir($installdir);
-&ErrorsAreFatal(0);
-
-&Copy("bin/klog", $installdir);
-&Copy("bin/knfs", $installdir);
-&Copy("bin/kpasswd", $installdir);
-&Copy("bin/pagsh", $installdir);
-&Copy("bin/tokens", $installdir);
-&Copy("bin/unlog", $installdir);
-}
+++ /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
-
-# An InstallGuide for the unix remote commands
-#
-
-sub unix {
- # append the ta-rauth to the services file
- $Services = "/etc/services";
- &ErrorsAreFatal(1);
- &Patch::Verbose if ($InstallVerbose);
- &Patch::FileOpen($Services);
-
- $ServicesAppend = "ta-rauth 601/tcp rauth";
-
- if (!&Patch::Patch($Services, [[0, "EOF", "", $ServicesAppend]])) {
- &ErrorMsg("Did not succeed with patch", $Services);
- }
-}
+++ /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
-
-# An InstallGuide for installing static AFS kernel libraries
-# For HP systems running HPUX 10.20
-#
-
-sub bldkernel {
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy("root.client/bin/libafs.a", "/usr/conf/lib"); }
-else {
- &Copy("root.client/bin/libafs.nonfs.a", "/usr/conf/lib/libafs.a"); };
-
-&CreateDir("/usr/vice/etc");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("root.client/usr/vice/etc/afs.driver", "/usr/conf/master.d/afs");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-
-
-# Patch the files
-&ErrorsAreFatal(1);
-$FILE="/stand/system";
-
-&Patch::Verbose if ($InstallVerbose);
-
-&Patch::FileOpen($FILE);
-
-$Search = <<"xxENDxx";
-nfs
-xxENDxx
-
-$Add = <<"xxENDxx";
-afs
-xxENDxx
-
-if (!&Patch::Patch($FILE, [[0, "Insert", $Search, $Add]])) {
- &ErrorMsg("Did not succeed with patch", $FILE);
-}
-}
-
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For HP 9000 systems running HPUX 10.20
-#
-
-sub build {
-print "Compiling with command \"/usr/sbin/mk_kernel\"\n";
-print "in directory /stand/build\n";
-print "New kernel will be /stand/build/vmunix_test\n";
-print "Install kernel as /stand/vmunix\n";
-
-&ErrorsAreFatal(1);
-$rc = chdir("/stand/build");
-&ErrorMsg("Could not change to dir", "/stand/build") if (!$rc);
-
-$rc = system("/usr/sbin/mk_kernel");
-$rc = $rc >> 8;
-print "Returned code $rc\n";
-}
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For HP 9000 systems running HPUX 10.20
-#
-
-
-sub installkernel {
-&VersionCopyFile("/stand/build/vmunix_test", "/stand/vmunix");
-}
+++ /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
-
-# An InstallGuide for dynamic kernel loaded libraries
-# For HP 9000 systems running HPUX 9.x
-
-sub modkernel {
-&ErrorsAreFatal(1);
-&CreateDir("/usr/vice/etc/dkload");
-&ErrorsAreFatal(0);
-
-&Copy("root.client/usr/vice/etc/dkload/dkload", "/usr/vice/etc/dkload");
-&Copy("root.client/usr/vice/etc/dkload/libcommon.a", "/usr/vice/etc/dkload");
-
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy("root.client/usr/vice/etc/dkload/libafs.a", "/usr/vice/etc/dkload"); }
-else {
- &Copy("root.client/usr/vice/etc/dkload/libafs.nonfs.a",
- "/usr/vice/etc/dkload"); };
-
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for installing the initialization script
-# For HP 9000 systems running HPUX 9.x
-#
-
-sub rc {
-# Defaults
-$rcfile = "/etc/rc";
-
-# Add AFS kernel loader to RC file
-&VPrint("Updating $rcfile file");
-&ErrorsAreFatal(1);
-&DisplaceFile("/etc/rc.afs");
-
-# Append the generic RC file
-&ReadInstallGuide("$InstallGuideDir/GENERIC/rc");
-&Appendrc;
-
-# Read in the current RC file
-$Section = "rc";
-$rc = open(RC, $rcfile);
-&ErrorMsg("Could not read file", $rcfile) if (!$rc);
-@line = <RC>;
-close(RC);
-
-# Check if AFS is already referenced
-if (grep(/\bAFS\b/, @line) || grep(/\/usr\/vice\/etc/, @line)) {
- &Print("AFS appears to already be in $rcfile");
- return; };
-
-# Find where function localrc() is. If it is not there, put it in after
-# all of the leading comments
-$localrc = -1;
-$comments = 0;
-foreach $n (0 ... $#line) {
- $comments = $n unless (@line[$n] =~ /^#/ || $comments > 0);
- if (@line[$n] =~ /^localrc\(\)/) {
- $localrc = $n;
- last; }; };
-
-# Insert a localrc() function if one was not already there
-if ($localrc == -1) {
- splice(@line, $comments, 0, "localrc()\n", "{\n", "}\n", "\n");
- $localrc = $comments;
- &Print("Inserted function localrc() in $rcfile");
- &Print("This should be run after NFS is started"); };
-
-# Skip past the function name and opening curly brace. Account for "{}"
-until (@line[$localrc] =~ /\{/ || $localrc > $#line) { $localrc ++; };
-if (@line[$localrc] =~ /\}/) {
- @line[$localrc] =~ s/\}//;
- splice(@line, $localrc+1, 0, "}\n"); };
-$localrc++;
-
-# Insert a call to the AFS rc file
-splice(@line, $localrc, 0,
- "\# Start AFS\n",
- "if [ -f /etc/rc.afs ]; then\n",
- " /bin/sh /etc/rc.afs\n",
- "fi\n");
-
-# Rewrite the RC file
-$rc = open(RC, "> $rcfile");
-&ErrorMsg("Could not rewrite file" , $rcfile) if (!$rc);
-foreach $line (@line) {
- print RC $line; };
-close(RC);
-}
+++ /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
-
-# An InstallGuide for the AFS modified Unix commands
-#
-
-sub HPunix {
- &Copy("etc/inetd", "/etc/inetd.afs");
- &Copy("etc/ftpd", "/etc/ftpd.afs");
- &Copy("etc/rexecd", "/etc/rexecd.afs");
- &Copy("etc/rlogind", "/etc/rlogind.afs");
-
- &ErrorsAreFatal(1);
- &Patch::Verbose if ($InstallVerbose);
- &CreateDir("/usr/vice/bin");
-
- &Copy("bin/rcp", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rcp");
- &Chmod (04755, "/usr/vice/bin/rcp");
-
- &Copy("bin/remsh", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/remsh");
- &Chmod (04755, "/usr/vice/bin/remsh");
-
- # Create the inetd.conf.afs file
- $InetdConfAfs = "/etc/inetd.conf.afs";
- open(INETD, ">$InetdConfAfs") || &ErrorMsg("Can't open file", $InetdConfAfs);
- print INETD <<"EOINETD";
-ftp stream tcp nowait root /etc/ftpd.afs ftpd.afs
-shell stream tcp nowait root /etc/remshd remshd
-login stream tcp nowait root /etc/rlogind.afs rlogind.afs
-ta-rauth stream tcp nowait root internal ta-rauth
-exec stream tcp nowait root /etc/rexecd.afs rexecd.afs
-EOINETD
-
- # comment out the rshd line in inetd.conf
- $InetdConf = "/etc/inetd.conf";
- &CopyStat($InetdConf, $InetdConfAfs);
- &Patch::FileOpen($InetdConf);
-
- $Search1 = "^(ftp\\s+.+)";
- $Replace1 = '"#".$1';
-
- $Search2 = "^(shell\\s+.+)";
- $Replace2 = '"#".$1';
-
- $Search3 = "^(login\\s+.+)";
- $Replace3 = '"#".$1';
-
- $Search4 = "^(exec\\s+.+)";
- $Replace4 = '"#".$1';
-
- if (!&Patch::Patch($InetdConf, [[1, "Substitution", $Search1, $Replace1],
- [1, "Substitution", $Search2, $Replace2],
- [1, "Substitution", $Search3, $Replace3],
- [1, "Substitution", $Search4, $Replace4]])) {
- &ErrorMsg("Did not succeed with patch", $InetdConf);
- }
-
- # Modify the /etc/services file
- &ReadInstallGuide("$InstallGuideDir/GENERIC/unix");
- &unix;
-}
-
-sub unix {
- goto &HPunix;
-}
+++ /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
-
-# An InstallGuide for installing the AFS aware file system checker
-# For HP 9000 series systems running HPUX 9.x
-#
-
-sub vfsck {
-&ErrorsAreFatal(1);
-&Copy ("root.server/etc/vfsck", "/etc/vfsck");
-&Symlink ("vfsck", "/etc/fsck");
-}
+++ /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
- */
-
-#
-# Initialization file for AFSinstall
-#
-#
-#
-# Alternate directories
-#
-
-
-#
-# Install packages
-# file Default Description
-#
-modkernel 0 Dynamic kernel libraries and afsd
-bldkernel 1 Static kernel libraries and afsd
-build 1 Perform kernel build
-installkernel 1 Install AFS aware kernel
-
-
-#
-# Client configuration options
-#
-# option definition
+++ /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
-
-# An InstallGuide for installing static AFS kernel libraries
-# For HP systems running HPUX 10.x
-#
-
-sub bldkernel {
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy("root.client/bin/libafs.a", "/etc/conf/lib/libafs.a"); }
-else {
- &Copy("root.client/bin/libafs.nonfs.a", "/etc/conf/lib/libafs.a"); };
-
-&CreateDir("/usr/vice/etc");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For HP systems running HP-UX 10.x
-#
-
-sub build {
-my ($hostname);
-$hostname = `/bin/uname -n`;
-chop $hostname;
-$hostname = tr/a-z/A-Z/;
-&Print("Compiling with command \"/usr/sbin/config -m master.d $hostname"\"");
-&Print("in directory /stand/build_afs");
-&Print("New kernel will be /stand/build_afs/vmunix_test");
-&Print("Install kernel as /stand/vmunix");
-
-&ErrorsAreFatal(1);
-$rc = chdir("/stand/build_afs");
-&ErrorMsg("Could not change to dir", "/stand/build_afs") if (!$rc);
-
-$rc = system("/usr/sbin/config -m master.d $hostname");
-$rc = $rc >> 8;
-&Print("Returned code $rc");
-}
+++ /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
-
-# An InstallGuide for installing the initialization script
-# For HP 9000 series systems running HPUX 10.X
-#
-
-sub rc {
-&Copy("root.client/usr/vice/etc/dkload/afs.rc", "/sbin/init.d/afs");
-&Chmod (0555, "/sbin/init.d/afs");
-&Symlink("../init.d/afs", "/sbin/rc2.d/K800afs");
-&Symlink("../init.d/afs", "/sbin/rc2.d/S460afs");
-}
+++ /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
-
-# An InstallGuide for the AFS modified Unix commands
-#
-
-sub HPunix {
- &Copy("etc/inetd", "/usr/sbin/inetd.afs");
- &Symlink("/usr/sbin/inetd.afs", "/etc/inetd.afs");
- &Copy("etc/ftpd", "/usr/lbin/ftpd.afs");
- &Copy("etc/rlogind", "/usr/lbin/rlogind.afs");
-
- &ErrorsAreFatal(1);
- &Patch::Verbose if ($InstallVerbose);
- &CreateDir("/usr/vice/bin");
-
- &Copy("bin/rcp", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rcp");
- &Chmod (04755, "/usr/vice/bin/rcp");
-
- &Copy("bin/remsh", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/remsh");
- &Chmod (04755, "/usr/vice/bin/remsh");
-
- # Create the inetd.conf.afs file
- $InetdConfAfs = "/etc/inetd.conf.afs";
- open(INETD, ">$InetdConfAfs") || &ErrorMsg("Can't open file", $InetdConfAfs);
- print INETD <<"EOINETD";
-ftp stream tcp nowait root /usr/lbin/ftpd.afs ftpd.afs
-shell stream tcp nowait root /usr/lbin/remshd remshd
-login stream tcp nowait root /usr/lbin/rlogind.afs rlogind.afs
-ta-rauth stream tcp nowait root internal ta-rauth
-EOINETD
-
- # comment out the rshd line in inetd.conf
- $InetdConf = "/etc/inetd.conf";
-
- &Patch::FileOpen($InetdConf);
- &CopyStat($InetdConf, $InetdConfAfs);
- $Search1 = "^(ftp\\s+.+)";
- $Replace1 = '"#".$1';
-
- $Search2 = "^(shell\\s+.+)";
- $Replace2 = '"#".$1';
-
- $Search3 = "^(login\\s+.+)";
- $Replace3 = '"#".$1';
-
- if (!&Patch::Patch($InetdConf, [[1, "Substitution", $Search1, $Replace1],
- [1, "Substitution", $Search2, $Replace2],
- [1, "Substitution", $Search3, $Replace3]])) {
- &ErrorMsg("Did not succeed with patch", $InetdConf);
- }
-
- # Modify the /etc/services file
- &ReadInstallGuide("$InstallGuideDir/GENERIC/unix");
- &unix;
-}
-
-sub unix {
- goto &HPunix;
-}
-
+++ /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
-
-# An InstallGuide for installing the AFS aware file system checker
-# For HP systems running HPUX 10.x
-#
-
-sub vfsck {
-&ErrorsAreFatal(1);
-&Copy ("root.server/etc/vfsck", "/sbin/fs/hfs/vfsck");
-&Symlink ("vfsck", "/sbin/fs/hfs/fsck");
-}
+++ /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
-
-# An InstallGuide for AFS integrated login on rs_aix32 systems
-#
-
-sub login {
-&ErrorsAreFatal(1);
-&Symlink ("login.noafs", "/bin/login");
-&Symlink ("../bin/login", "/etc/getty");
-&Symlink ("../bin/login", "/etc/tsm");
-&Symlink ("../bin/login.afs", "/etc/afsok");
-&Copy ("bin/login.noafs", "/bin/login.noafs");
-&Copy ("bin/login.afs", "/bin/login.afs");
-&Copy ("bin/login.afs.krb", "/bin/login.afs.krb");
-}
+++ /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
-
-# An InstallGuide for dynamic kernel loaded libraries
-# For IBM RS/6000 systems running AIX 3.x
-
-sub modkernel {
-&ErrorsAreFatal(1);
-&CreateDir("/usr/vice/etc/dkload");
-&ErrorsAreFatal(0);
-
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy("root.client/usr/vice/etc/dkload/afs.ext.trans",
- "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/cfgafs", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/cfgexport", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/export.ext","/usr/vice/etc/dkload"); }
-else {
- &Copy("root.client/usr/vice/etc/dkload/afs.ext", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/cfgafs", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/cfgexport", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/export.ext.nonfs",
- "/usr/vice/etc/dkload"); }
-
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for installing the initialization script
-# For IBM RS/6000 systems running AIX 3.x
-#
-
-sub AIXrc {
-
-# Defaults
-$rcfile = "/etc/rc.afs";
-$initfile = "/etc/inittab";
-
-&ErrorsAreFatal(1);
-
-# Add AFS kernel loader to RC file
-&VPrint("Creating $rcfile file");
-&DisplaceFile($rcfile);
-$rc = open(RC, "> $rcfile");
-&ErrorMsg("Could not overwrite", $rcfile) if (!$rc);
-
-print RC <<"EORC";
-#!/bin/sh
-
-USENFS=\"$Configuration{"NFSEXTENSIONS"}\"
-
-if [ \"\$NFS\" = 1 ]; then
- ExportExt=\"\"
- AFSExt=\".trans\"
-else
- ExportExt=\".nonfs\"
- AFSExt=\"\"
-fi
-
-# Load AFS into the kernel
-/usr/vice/etc/dkload/cfgexport -a /usr/vice/etc/dkload/export.ext\${ExportExt}
-/usr/vice/etc/dkload/cfgafs -a /usr/vice/etc/dkload/afs.ext\${AFSExt}
-
-EORC
-close(RC);
-
-# Append the generic RC file
-&ReadInstallGuide("$InstallGuideDir/GENERIC/rc");
-&Appendrc;
-
-# Add AFS entry to the inittab file
-&VPrint("Adding AFS entry to $initfile");
-
-&Patch::Verbose if ($InstallVerbose);
-&Patch::FileOpen($initfile);
-$SearchString = <<"xxENDxx";
-rcnfs:2:wait:/etc/rc.nfs > /dev/console 2>&1 # Start NFS Daemons
-xxENDxx
-
-$NewString = <<"xxENDxx";
-rcafs:2:wait:/etc/rc.afs > /dev/console 2>&1 # Start AFS daemons
-xxENDxx
-
-if (!&Patch::Patch($initfile, [[0, "Insert", $SearchString, $NewString]])) {
- &ErrorMsg("Did not succeed with patch", $initfile); }
-}
-
-
-
-
-sub rc {
-goto &AIXrc;
-}
+++ /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
-
-# An InstallGuide for the AFS modified Unix commands
-#
-
-sub AIXunix {
- &Copy("etc/inetd", "/usr/sbin/inetd.afs");
- &Copy("etc/ftpd", "/usr/sbin/ftpd.afs");
- &Copy("etc/rlogind", "/usr/sbin/rlogind.afs");
- &Symlink ("/usr/sbin/inetd.afs", "/etc/inetd.afs");
- &Symlink ("/usr/sbin/ftpd.afs", "/etc/ftpd.afs");
- &Symlink ("/usr/sbin/rlogind.afs", "/etc/rlogind.afs");
-
- &ErrorsAreFatal(1);
- &Patch::Verbose if ($InstallVerbose);
- &CreateDir("/usr/vice/bin");
-
- &Copy("bin/rcp", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rcp");
- &Chmod (04755, "/usr/vice/bin/rcp");
-
- &Copy("bin/rsh", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rsh");
- &Chmod (04755, "/usr/vice/bin/rsh");
-
- # Create the inetd.conf.afs file
- $InetdConfAfs = "/etc/inetd.conf.afs";
- open(INETD, ">$InetdConfAfs") || &ErrorMsg("Can't open file", $InetdConfAfs);
- print INETD <<"EOINETD";
-ftp stream tcp nowait root /etc/ftpd.afs ftpd.afs
-shell stream tcp nowait root /etc/rshd rshd
-login stream tcp nowait root /etc/rlogind.afs rlogind.afs
-ta-rauth stream tcp nowait root internal ta-rauth
-EOINETD
-
- # comment out the rshd line in inetd.conf
- $InetdConf = "/etc/inetd.conf";
- &CopyStat($InetdConf, $InetdConfAfs);
- &Patch::FileOpen($InetdConf);
-
- $Search1 = "^(ftp\\s+.+)";
- $Replace1 = '"#".$1';
-
- $Search2 = "^(shell\\s+.+)";
- $Replace2 = '"#".$1';
-
- $Search3 = "^(login\\s+.+)";
- $Replace3 = '"#".$1';
-
- if (!&Patch::Patch($InetdConf, [[1, "Substitution", $Search1, $Replace1],
- [1, "Substitution", $Search2, $Replace2],
- [1, "Substitution", $Search3, $Replace3]])) {
- &ErrorMsg("Did not succeed with patch", $InetdConf);
- }
-
- # Modify the /etc/services file
- &ReadInstallGuide("$InstallGuideDir/GENERIC/unix");
- &unix;
-}
-
-sub unix {
- goto &AIXunix;
-}
-
-
+++ /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
-
-# An InstallGuide for installing the AFS aware file system checker
-# For RS/6000 systems running AIX 3.x
-#
-
-sub vfsck {
-&Copy("root.server/etc/v3fshelper", "/sbin/helpers");
-}
+++ /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
-
-# An InstallGuide for AFS login
-# For IBM RS/6000 systems running AIX 4.x
-#
-
-sub login {
- &Copy ("root.client/usr/vice/etc/afs_dynamic_auth", "/usr/vice/etc");
- &Copy ("root.client/usr/vice/etc/afs_dynamic_kerbauth", "/usr/vice/etc");
-
- $File1="/etc/security/user";
- $File2="/etc/security/login.cfg";
- &Patch::Verbose if ($InstallVerbose);
- &Patch::FileOpen($File1);
- &Patch::FileOpen($File2);
-
- $Search = << "xxENDxx";
- expires = 0
- SYSTEM = "compat"
-xxENDxx
-
- $New = << "xxENDxx";
- expires = 0
- SYSTEM = "AFS OR (AFS[UNAVAIL] OR compat[SUCCESS])"
- registry = DCE
-xxENDxx
-
- $Search1 = << "xxENDxx";
-root:
-xxENDxx
-
- $New1 = << "xxENDxx";
-root:
- registry = files
-xxENDxx
-
- $New2 = << "xxENDxx";
-rootl:
- admin = true
- SYSTEM = "compat"
- loginretries = 0
- registry = files
- account_locked = false
-
-xxENDxx
-
- $Search3 = << "xxENDxx";
-daemon:
- admin = true
- expires = 0101000070
-xxENDxx
-
- $New3 = << "xxENDxx";
-daemon:
- admin = true
- account_locked = false
-xxENDxx
-
- if (!&Patch::Patch($File1, [[0, "Replace", $Search, $New],
- [0, "Replace", $Search1, $New1],
- [0, "EOF", "", $New2],
- [0, "Replace", $Search3, $New3]])) {
- &VPrint("Did not succeed in patching $File1");
- }
-
- $New = << "xxENDxx";
-DCE:
- program = /usr/vice/etc/afs_dynamic_auth
-
-AFS:
- program = /usr/vice/etc/afs_dynamic_auth
- retry = 3
- timeout = 30
- retry_delay = 10
-xxENDxx
-
- if (!&Patch::Patch($File2, [[0, "EOF", "", $New]])) {
- &VPrint("Did not succeed in patching $File2");
- }
-
-}
-
+++ /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
-
-# An InstallGuide for dynamic kernel loaded libraries
-# For IBM RS/6000 systems running AIX 4.x
-#
-
-sub modkernel {
- my($useiauth,$afsext,$export, $line, $a,$b,$c);
- &ErrorsAreFatal(1);
- &CreateDir("/usr/vice/etc/dkload");
- &ErrorsAreFatal(0);
-
- if ($Configuration{"NFSEXTENSIONS"}) {
- # Determine if this AIX system uses the iauth system
- # AIX 4.1.x for x>=5
- # AIX 4.2.x for x>=1
- # AIX 4.x for x>=3
- $useiauth = 0;
- open(LPP, "/bin/lslpp -L |");
- while ($line = <LPP>) {
- next unless ($line =~ /bos.rte\s/);
- $line =~ /bos.rte\s+(\d)\.(\d)\.(\d)/;
- ($a,$b,$c) = ($1,$2,$3);
- $useiauth = 1 if ($a == 4 && $b == 1 && $c >= 5);
- $useiauth = 1 if ($a == 4 && $b == 2 && $c >= 1);
- $useiauth = 1 if ($a == 4 && $b >= 3);
- last; };
- close(LPP);
-
- if ($useiauth) {
- $export=".nonfs";
- $afsext="iauth"; }
- else {
- $export="";
- $afsext="trans"; }
-
- # Copy NFS ready kernel extensions into place
- &Copy("root.client/usr/vice/etc/dkload/cfgafs", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/cfgexport", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/afs.ext.$afsext",
- "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/export.ext$export",
- "/usr/vice/etc/dkload"); }
- else {
- # Copy non NFS ready kernel extensions into place
- &Copy("root.client/usr/vice/etc/dkload/afs.ext", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/cfgafs", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/cfgexport", "/usr/vice/etc/dkload");
- &Copy("root.client/usr/vice/etc/dkload/export.ext.nonfs",
- "/usr/vice/etc/dkload"); }
-
- &Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
- &Copy("bin/fs", "/usr/vice/etc/fs");
-
- $File="/etc/vfs";
- $Patch::Verbose if ($InstallVerbose);
-
- &Patch::FileOpen($File);
-
- $Search = << "xxENDxx";
-nfs 2 /sbin/helpers/nfsmnthelp none remote
-xxENDxx
-
- $New = << "xxENDxx";
-afs 4 none none
-xxENDxx
-
- if (!&Patch::Patch($File, [[0, "Insert", $Search, $New]])) {
- &ErrorMsg("Did not succeed in patching $File");
- }
-}
+++ /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
-
-# An InstallGuide for installing the initialization script
-# For IBM RS/6000 systems running AIX 4.x
-#
-
-sub rc {
-my($rcfile,$initfile, $method,$line,$method,%Method);
-
-# Defaults
-$rcfile = "/etc/rc.afs";
-$initfile = "/etc/inittab";
-
-&ErrorsAreFatal(1);
-
-# Add AFS kernel loader to RC file
-&VPrint("Creating $rcfile file");
-&DisplaceFile($rcfile);
-$rc = open(RC, "> $rcfile");
-&ErrorMsg("Could not overwrite", $rcfile) if (!$rc);
-
-
-$method = "none";
-if ($Configuration{"NFSEXTENSIONS"}) {
- $method = "nfs";
- # Determine if this AIX system uses the iauth system
- # AIX 4.1.x for x>=5
- # AIX 4.2.x for x>=1
- # AIX 4.x for x>=3
- open(LPP, "/bin/lslpp -L |");
- while ($line = <LPP>) {
- next unless ($line =~ /bos.rte\s/);
- $line =~ /bos.rte\s+(\d)\.(\d)\.(\d)/;
- ($a,$b,$c) = ($1,$2,$3);
- $method = "iauth" if ($a == 4 && $b == 1 && $c >= 5);
- $method = "iauth" if ($a == 4 && $b == 2 && $c >= 1);
- $method = "iauth" if ($a == 4 && $b >= 3);
- last; };
- close(LPP); };
-
-$Method{"none"} = "#USENFS=\"none\"";
-$Method{"nfs"} = "#USENFS=\"nfs\"";
-$Method{"iauth"} = "#USENFS=\"iauth\"";
-$Method{$method} =~ s:#::;
-
-print RC <<"EORC";
-#!/bin/sh
-
-
-# Choose one depending on how much usage this client gets
-#OPTIONS="-stat 300 -dcache 100 -daemons 2 -volumes 50"
-#OPTIONS="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
-OPTIONS="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
-
-# Choose one depending on how you want NFS requests handled by AFS
-$Method{"none"}
-$Method{"nfs"}
-$Method{"iauth"}
-
-if [ "\$USENFS" = "nfs" ]; then
- ExportExt=""
- AFSExt=".trans"
- NFS="-rmtsys"
-elif [ "\$USENFS" = "iauth" ]; then
- ExportExt=".nonfs"
- AFSExt=".iauth"
- NFS="-rmtsys"
-else
- ExportExt=".nonfs"
- AFSExt=""
- NFS=""
-fi
-
-# Load AFS into the kernel
-cd /usr/vice/etc/dkload
-/usr/vice/etc/dkload/cfgexport -a /usr/vice/etc/dkload/export.ext\${ExportExt}
-/usr/vice/etc/dkload/cfgafs -a /usr/vice/etc/dkload/afs.ext\${AFSExt}
-
-# Start bosserver
-if [ -x /usr/afs/bin/bosserver ]; then
- echo 'Starting bosserver' > /dev/console
- /usr/afs/bin/bosserver &
-fi
-
-# Start afsd
-/usr/vice/etc/afsd \$OPTIONS \$NFS
-
-# Start AFS inetd services
-if [ -f /etc/inetd.afs -a -f /etc/inetd.conf.afs ]; then
- /etc/inetd.afs /etc/inetd.conf.afs
-fi
-
-EORC
-close(RC);
-
-# Add AFS entry to the inittab file
-&VPrint("Adding AFS entry to $initfile");
-
-&Patch::Verbose if ($InstallVerbose);
-&Patch::FileOpen($initfile);
-$SearchString = <<"xxENDxx";
-rcnfs:2:wait:/etc/rc.nfs > /dev/console 2>&1 # Start NFS Daemons
-xxENDxx
-
-$NewString = <<"xxENDxx";
-rcafs:2:wait:/etc/rc.afs > /dev/console 2>&1 # Start AFS Daemons
-xxENDxx
-
-if (!&Patch::Patch($initfile, [[0, "Insert", $SearchString, $NewString]])) {
- &ErrorMsg("Did not succeed with patch", $initfile);
-}
-&Chmod (0755, $rcfile);
-&Chown (0,0, $rcfile);
-}
+++ /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
-
-# An InstallGuide for the AFS modified Unix commands
-# For IBM RS/6000 systems running AIX 4.x
-#
-
-sub AIXunix {
- &Copy("etc/inetd", "/usr/sbin/inetd.afs");
- &Symlink("/usr/sbin/inetd.afs", "/etc/inetd.afs");
- &Copy("etc/ftpd", "/usr/sbin/ftpd.afs");
-
- &ErrorsAreFatal(1);
- &Patch::Verbose if ($InstallVerbose);
- &CreateDir("/usr/vice/bin");
-
- &Copy("bin/rcp", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rcp");
- &Chmod (04755, "/usr/vice/bin/rcp");
-
- &Copy("bin/rsh", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rsh");
- &Chmod (04755, "/usr/vice/bin/rsh");
-
- # Create the inetd.conf.afs file
- $InetdConfAfs = "/etc/inetd.conf.afs";
- open(INETD, ">$InetdConfAfs") || &ErrorMsg("Can't open file", $InetdConfAfs);
- print INETD <<"EOINETD";
-ftp stream tcp nowait root /usr/sbin/ftpd.afs ftpd.afs
-shell stream tcp nowait root /usr/sbin/rshd rshd
-login stream tcp nowait root /usr/sbin/rlogind.afs rlogind.afs
-ta-rauth stream tcp nowait root internal ta-rauth
-EOINETD
-
- # comment out the rshd line in inetd.conf
- $InetdConf = "/etc/inetd.conf";
- &CopyStat($InetdConf, $InetdConfAfs);
- &Patch::FileOpen($InetdConf);
-
- $Search1 = "^(ftp\\s+.+)";
- $Replace1 = '"#".$1';
-
- $Search2 = "^(shell\\s+.+)";
- $Replace2 = '"#".$1';
-
- $Search3 = "^(login\\s+.+)";
- $Replace3 = '"#".$1';
-
- if (!&Patch::Patch($InetdConf, [[1, "Substitution", $Search1, $Replace1],
- [1, "Substitution", $Search2, $Replace2],
- [1, "Substitution", $Search3, $Replace3]])) {
- &ErrorMsg("Did not succeed with patch", $InetdConf);
- }
-
- # Modify the /etc/services file
- &ReadInstallGuide("$InstallGuideDir/GENERIC/unix");
- &unix;
-}
-
-sub unix {
- goto &AIXunix;
-}
-
+++ /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
-
-# An InstallGuide for installing the AFS aware file system checker
-# For IBM RS/6000 systems running AIX 4.x
-#
-
-sub vfsck {
-&Copy("root.server/etc/v3fshelper", "/sbin/helpers");
-}
+++ /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
- */
-
-#
-# Initialization file for AFSinstall
-#
-#
-#
-# Alternate directories
-#
-
-#
-# Install packages
-# file Default Description
-#
-modkernel 0 Dynamic kernel libraries and afsd
-bldkernel 1 Static kernel libraries and afsd
-build 1 Perform kernel build
-installkernel 1 Install AFS aware kernel
-
-
-#
-# Client configuration options
-#
-# option definition
+++ /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
-
-# An InstallGuide for installing static AFS kernel libraries
-# For SGI systems running IRIX 5.x
-#
-
-sub bldkernel {
-my ($chip, $chipcount, $nfs, $libafs);
-&ErrorsAreFatal(1);
-
-# Find out what kind of chip the machine has (Rx000)
-$chip = `hinv -t cpu`;
-$chip =~ /R[34][046]0*/;
-$chip = $&;
-&ErrorMsg("Could not determine chip type with", "hinv") unless ($chip =~ /^R/);
-
-# Find out if there is more than one processor (eg "2 150 MHZ IP19 Processors")
-$chipcount = `hinv -c processor`;
-$chipcount =~ s/ .*//;
-&ErrorMsg("Could not determine chip count with", "hinv") unless ($chipcount);
-
-# NFS support
-if ($Configuration{"NFSEXTENSIONS"}) {
- $nfs = ""; }
-else {
- $nfs = ".nonfs"; };
-
-# From the above, put together the name of the kernel library to use
-$libafs = "libafs.SP.$chip$nfs.a" if ($chipcount == 1);
-$libafs = "libafs.MP.$chip$nfs.a" if ($chipcount > 1);
-
-&CreateDir("/usr/vice/etc/sgiload");
-&ErrorsAreFatal(0);
-&Copy("root.client/bin/$libafs", "/var/sysgen/boot/afs.a");
-&Copy("root.client/usr/vice/etc/sgiload/afs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.rc", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.sm", "/usr/vice/etc/sgiload");
-
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-
-system("/etc/chkconfig -f afsml off");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for dynamic kernel loaded libraries
-# For SGI systems running IRIX 5.x
-#
-
-sub modkernel {
-my ($chip, $chipcount, $nfs, $libafs);
-&ErrorsAreFatal(1);
-
-# Find out what kind of chip the machine has (Rx000)
-$chip = `hinv -t cpu`;
-$chip =~ /R[34][046]0*/;
-$chip = $&;
-$chip =~ s/5/4/;
-&ErrorMsg("Could not determine chip type with", "hinv") unless ($chip =~ /^R/);
-
-# Find out if there is more than one processor (eg "2 150 MHZ IP19 Processors")
-$chipcount = `hinv -c processor`;
-$chipcount =~ s/ .*//;
-&ErrorMsg("Could not determine chip count with", "hinv") unless ($chipcount);
-
-# NFS support
-if ($Configuration{"NFSEXTENSIONS"}) {
- $nfs = ""; }
-else {
- $nfs = ".nonfs"; };
-
-# From the above, put together the name of the kernel library to use
-$libafs = "libafs.SP.$chip$nfs.o" if ($chipcount == 1);
-$libafs = "libafs.MP.$chip$nfs.o" if ($chipcount > 1);
-
-&CreateDir("/usr/vice/etc/sgiload");
-&ErrorsAreFatal(0);
-&Copy("root.client/usr/vice/etc/sgiload/$libafs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.rc", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.sm", "/usr/vice/etc/sgiload");
-
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-
-system("/etc/chkconfig -f afsml on");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for static AFS kernel libraries
-# For SGI systems running IRIX 6.x
-#
-
-sub bldkernel {
-my($chip, $ip_type, $os_vers, $chipcount, $nfs, $libafs);
-&ErrorsAreFatal(1);
-
-# Find out what kind of chip the machine has (Rx000)
-$chip = `hinv -t cpu`;
-$chip =~ /R[4581][046]0*/;
-$chip = $&;
-&ErrorMsg("Could not determine chip type with", "hinv") unless ($chip =~ /^R/);
-substr($chip, -3,3) = "000";
-$ip_type = `uname -m`;
-$os_vers = `uname -r`;
-if ($chip =~ /R5/) { $chip = "R4000_32"; }
-elsif ($chip =~ /R4/ && $os_vers =~ /6.2/ && $ip_type =~ /17|20|22/) {
- $chip = "R4000_32"; }
-
-# Find out if there is more than one processor (eg "2 150 MHZ IP19 Processors")
-$chipcount = `hinv -c processor`;
-$chipcount =~ s/ .*//;
-&ErrorMsg("Could not determine chip count with", "hinv") unless ($chipcount);
-
-# NFS support
-if ($Configuration{"NFSEXTENSIONS"}) {
- $nfs = ""; }
-else {
- $nfs = ".nonfs"; };
-
-# From the above, put together the name of the kernel library to use
-$libafs = "libafs.SP.$chip$nfs.a" if ($chipcount == 1);
-$libafs = "libafs.MP.$chip$nfs.a" if ($chipcount > 1);
-
-&CreateDir("/usr/vice/etc/sgiload");
-&ErrorsAreFatal(0);
-
-if (-f "root.client/bin/afs") {
- &Copy("root.client/bin/afs", "/usr/vice/etc/sgiload");
- &Copy("root.client/bin/afs.sm", "/usr/vice/etc/sgiload"); }
-elsif ( -f "root.client/usr/vice/etc/sgiload/afs") {
- &Copy("root.client/usr/vice/etc/sgiload/afs", "/usr/vice/etc/sgiload");
- &Copy("root.client/usr/vice/etc/sgiload/afs.sm", "/usr/vice/etc/sgiload"); };
-&Symlink("/usr/vice/etc/sgiload/afs", "/var/sysgen/master.d/afs");
-&Symlink("/usr/vice/etc/sgiload/afs.sm", "/var/sysgen/system/afs.sm");
-
-&Copy("root.client/bin/$libafs", "/var/sysgen/boot/afs.a");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-system("/etc/chkconfig -f afsml off");
-system("/etc/chkconfig -f afsclient on");
-}
+++ /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
-
-# An InstallGuide for dynamic kernel loaded libraries
-# For SGI systems running IRIX 6.x
-#
-
-sub modkernel {
-my($chip, $ip_type, $os_vers, $chipcount, $nfs, $libafs);
-&ErrorsAreFatal(1);
-
-# Find out what kind of chip the machine has (Rx000)
-$chip = `hinv -t cpu`;
-$chip =~ /R[4581][046]0*/;
-$chip = $&;
-&ErrorMsg("Could not determine chip type with", "hinv") unless ($chip =~ /^R/);
-substr($chip, -3,3) = "000";
-$ip_type = `uname -m`;
-$os_vers = `uname -r`;
-if ($chip =~ /R5/) { $chip = "R4000_32"; }
-elsif ($chip =~ /R4/ && $os_vers =~ /6.2/ && $ip_type =~ /17|20|22/) {
- $chip = "R4000_32"; }
-
-# Find out if there is more than one processor (eg "2 150 MHZ IP19 Processors")
-$chipcount = `hinv -c processor`;
-$chipcount =~ s/ .*//;
-&ErrorMsg("Could not determine chip count with", "hinv") unless ($chipcount);
-
-# NFS support
-if ($Configuration{"NFSEXTENSIONS"}) {
- $nfs = ""; }
-else {
- $nfs = ".nonfs"; };
-
-# From the above, put together the name of the kernel library to use
-$libafs = "libafs.SP.$chip$nfs.o" if ($chipcount == 1);
-$libafs = "libafs.MP.$chip$nfs.o" if ($chipcount > 1);
-
-&CreateDir("/usr/vice/etc/sgiload");
-&ErrorsAreFatal(0);
-
-&Copy("root.client/usr/vice/etc/sgiload/$libafs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-system("/etc/chkconfig -f afsml on");
-system("/etc/chkconfig -f afsclient on");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For SGI systems running IRIX
-#
-
-sub build {
-&Print("Compiling with command \"autoconfig\"");
-&Print("in directory /var/sysgen/boot");
-&Print("New kernel will be /unix.install. System will automatically move");
-&Print("it to /unix upon reboot");
-
-&ErrorsAreFatal(1);
-$rc = chdir("/var/sysgen/boot");
-&ErrorMsg("Could not change to dir", "/var/sysgen/boot") if (!$rc);
-
-$rc = system("autoconfig");
-$rc = $rc >> 8;
-&Print("Returned code $rc");
-}
+++ /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
-
-# An InstallGuide for database server processes
-# For SGI systems running IRIX
-#
-
-sub IRIXdbserver {
-&ReadInstallGuide("$InstallGuideDir/GENERIC/dbserver");
-&dbserver;
-
-system("/etc/chkconfig -f afsserver on");
-}
-
-
-
-sub dbserver {
-goto &IRIXdbserver;
-}
+++ /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
-
-# An InstallGuide for fileserver processes
-# For SGI systems running IRIX
-#
-
-
-sub IRIXfileserver {
-&ReadInstallGuide("$InstallGuideDir/GENERIC/fileserver");
-&fileserver;
-system("/etc/chkconfig -f afsserver on");
-}
-
-
-
-sub fileserver {
-goto &IRIXfileserver;
-}
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For SGI systems running IRIX. Note that Irix
-# will normally do this operation on reboot.
-#
-
-
-sub installkernel {
-&VersionCopyFile("/unix.install", "/unix");
-unlink("/unix.install");
-}
+++ /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
-
-# An InstallGuide for installing the AFS integrated login
-# For SGI systems running IRIX
-#
-
-sub login {
-&Copy ("root.client/usr/vice/etc/afsauthlib.so", "/usr/vice/etc");
-&Copy ("root.client/usr/vice/etc/afskauthlib.so", "/usr/vice/etc");
-}
+++ /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
-
-# An InstallGuide for fileserver processes
-# For SGI systems running IRIX
-#
-
-sub IRIXmiscserver {
-&ReadInstallGuide("$InstallGuideDir/GENERIC/miscserver");
-&miscserver;
-
-system("/etc/chkconfig -f afsserver on");
-}
-
-
-
-
-sub miscserver {
-goto &IRIXmiscserver;
-}
+++ /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
-
-# An InstallGuide for installing the initialization script
-# For SGI systems running IRIX
-#
-
-sub rc {
-&Copy("root.client/usr/vice/etc/sgiload/afs.rc", "/etc/init.d/afs");
-&Chmod (0555, "/etc/init.d/afs");
-&Symlink("../init.d/afs", "/etc/rc0.d/K35afs");
-&Symlink("../init.d/afs", "/etc/rc2.d/S35afs");
-}
+++ /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
-
-# An InstallGuide for the AFS modified Unix commands
-# For SGI systems running IRIX
-#
-
-sub IRIXunix {
- &Copy("etc/inetd", "/usr/etc/inetd.afs");
-
- &ErrorsAreFatal(1);
- &Patch::Verbose if ($InstallVerbose);
-
- # Create the inetd.conf.afs file
- $InetdConfAfs = "/etc/inetd.conf.afs";
- open(INETD, ">$InetdConfAfs") || &ErrorMsg("Can't open file", $InetdConfAfs);
- print INETD <<"EOINETD";
-ftp stream tcp nowait root /usr/etc/ftpd ftpd -l
-shell stream tcp nowait root /usr/etc/rshd rshd -L
-login stream tcp nowait root /usr/etc/rlogind rlogind
-ta-rauth stream tcp nowait root internal ta-rauth
-EOINETD
-
- # comment out the lines in inetd.conf
- $InetdConf = "/etc/inetd.conf";
- &CopyStat($InetdConf, $InetdConfAfs);
- &Patch::FileOpen($InetdConf);
-
- $Search1 = "^(ftp\\s+.+)";
- $Replace1 = '"#".$1';
-
- $Search2 = "^(shell\\s+.+)";
- $Replace2 = '"#".$1';
-
- $Search3 = "^(login\\s+.+)";
- $Replace3 = '"#".$1';
-
- if (!&Patch::Patch($InetdConf, [[1, "Substitution", $Search1, $Replace1],
- [1, "Substitution", $Search2, $Replace2],
- [1, "Substitution", $Search3, $Replace3]])) {
- &ErrorMsg("Did not succeed with patch", $InetdConf);
- }
-
- # Modify the /etc/services file
- &ReadInstallGuide("$InstallGuideDir/GENERIC/unix");
- &unix;
-}
-
-sub unix {
- goto &IRIXunix;
-}
-
-
+++ /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
-
-# An InstallGuide for dynamic kernel loaded libraries
-# For Sun systems running Solaris 5.x
-#
-
-sub modkernel {
-&ErrorsAreFatal(1);
-&CreateDir("/usr/vice/etc/modload");
-&ErrorsAreFatal(0);
-
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy("root.client/usr/vice/etc/modload/libafs.o","/kernel/fs/afs"); }
-else {
- &Copy("root.client/usr/vice/etc/modload/libafs.nonfs.o",
- "/kernel/fs/afs"); }
-
-&Copy("root.client/usr/vice/etc/modload/afs.rc", "/usr/vice/etc/modload");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-
-&Copy("bin/fs", "/usr/vice/etc/fs");
-# add the afs line to /etc/name_to_sysnum
-&ErrorsAreFatal(1);
-$File="/etc/name_to_sysnum";
-
-&Patch::Verbose if ($InstallVerbose);
-&Patch::FileOpen($File);
-
-$SearchString = <<"xxENDxx";
-fstatvfs 104
-nfs 106
-xxENDxx
-
-$NewString = <<"xxENDxx";
-fstatvfs 104
-afs 105
-nfs 106
-xxENDxx
-
-if (!&Patch::Patch($File, [[0, "Replace", $SearchString, $NewString]])) {
- &ErrorMsg ("Did not succeed with patch", $File);
-}
-
-}
+++ /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
-
-# An InstallGuide for installing the initialization script
-# For Sun systems running Solaris 5.x
-#
-
-sub rc {
-&Copy("root.client/usr/vice/etc/modload/afs.rc", "/etc/init.d/afs");
-&Chmod (0555, "/etc/init.d/afs");
-&Symlink("../init.d/afs", "/etc/rc3.d/S14afs");
-&Symlink("../init.d/afs", "/etc/rc2.d/K66afs");
-}
+++ /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
-
-# An InstallGuide for the AFS modified Unix commands
-# For Sun systems running Solaris 5.x
-#
-
-sub unix {
- &Copy("etc/inetd", "/usr/sbin/inetd.afs");
- &Copy("etc/ftpd", "/usr/sbin/in.ftpd.afs");
-
- &ErrorsAreFatal(1);
- &Patch::Verbose if ($InstallVerbose);
- &CreateDir("/usr/vice/bin");
-
- &Copy("bin/rcp", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rcp");
- &Chmod (04755, "/usr/vice/bin/rcp");
-
- &Copy("bin/rsh", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rsh");
- &Chmod (04755, "/usr/vice/bin/rsh");
-
- # Create the inetd.conf.afs file
- $InetdConfAfs = "/etc/inet/inetd.conf.afs";
- open(INETD, ">$InetdConfAfs") || &ErrorMsg("Can't open file", $InetdConfAfs);
- print INETD <<"EOINETD";
-ftp stream tcp nowait root /usr/sbin/in.ftpd.afs in.ftpd.afs
-shell stream tcp nowait root /usr/sbin/in.rshd in.rshd
-ta-rauth stream tcp nowait root internal ta-rauth
-EOINETD
- &Symlink("./inet/inetd.conf.afs", "/etc/inetd.conf.afs");
-
- # comment out the lines in inetd.conf
- $InetdConf = "/etc/inet/inetd.conf";
- &CopyStat($InetdConf, $InetdConfAfs);
- &Patch::FileOpen($InetdConf);
-
- $Search1 = "^(ftp\\s+.+)";
- $Replace1 = '"#".$1';
-
- $Search2 = "^(shell\\s+.+)";
- $Replace2 = '"#".$1';
-
- if (!&Patch::Patch($InetdConf, [[1, "Substitution", $Search1, $Replace1],
- [1, "Substitution", $Search2, $Replace2]])) {
- &ErrorMsg("Did not succeed with patch", $InetdConf);
- }
-
- # Modify the /etc/inet/services file
- # append the ta-rauth to the services file
- $Services = "/etc/inet/services";
- &Patch::FileOpen($Services);
- $ServicesAppend = "ta-rauth 601/tcp rauth";
-
- if (!&Patch::Patch($Services, [[0, "EOF", "", $ServicesAppend]])) {
- &ErrorMsg("Did not succeed with patch", $Services);
- }
-}
+++ /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
-
-# An InstallGuide for installing the AFS aware file system checker
-# For Sun systems running Solaris 5.x
-#
-
-sub vfsck {
-&Copy ("root.server/etc/vfsck", "/usr/lib/fs/ufs");
-&Symlink ("vfsck", "/usr/lib/fs/ufs/fsck");
-}
+++ /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
-
-# An InstallGuide for static kernel built libraries
-# For Alpha systems running Digital Unix 4.0
-#
-
-sub bldkernel {
-my($host);
-
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy("root.client/bin/libafs.o", "/usr/sys/BINARY/afs.mod"); }
-else {
- &Copy("root.client/bin/libafs.nonfs.o", "/usr/sys/BINARY/afs.mod"); };
-
-&CreateDir("/usr/vice/etc");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-
-&ErrorsAreFatal(1);
-# Patch the files
-if (!-f "/usr/sys/conf/AFS") {
- $host = $ENV{HOST};
- $host =~ tr/a-z/A-Z/;
- &Copy("/usr/sys/conf/$host", "/usr/sys/conf/AFS"); };
-
-$AFS="/sys/conf/AFS";
-$FILES="/sys/conf/files";
-$VFSCONF="/sys/vfs/vfs_conf.c";
-
-&Patch::Verbose if ($InstallVerbose);
-
-&Patch::FileOpen($AFS);
-&Patch::FileOpen($FILES);
-&Patch::FileOpen($VFSCONF);
-
-$AFSSearchInsert = <<"xxENDxx";
-options UFS
-options NFS
-xxENDxx
-$AFSNewInsert = <<"xxENDxx";
-options AFS
-xxENDxx
-$AFSSearchReplace = "ident\\s+.+";
-$AFSNewReplace = "ident\t\t\"AFS\"";
-
-if (!&Patch::Patch($AFS, [[0, "Insert", $AFSSearchInsert, $AFSNewInsert],
- [1, "Replace", $AFSSearchReplace, $AFSNewReplace]])) {
- &ErrorMsg("Did not succeed with patch", $AFS);
-}
-
-$FILESSearch1 = << "xxENDxx";
-OPTIONS/nfs optional nfs
-xxENDxx
-$FILESNew1 = << "xxENDxx";
-OPTIONS/afs optional afs
-xxENDxx
-
-$FILESSearch2 = << "xxENDxx";
-nfs/nfs3_server.c module nfs_server optimize -g3
-#
-xxENDxx
-$FILESNew2 = << "xxENDxx";
-MODULE/afs optional afs Binary
-afs/libafs.c module afs
-#
-xxENDxx
-
-if (!&Patch::Patch($FILES, [[0, "Insert", $FILESSearch1, $FILESNew1],
- [0, "Insert", $FILESSearch2, $FILESNew2]])) {
- &ErrorMsg("Did not succeed with patch", $FILES);
-}
-
-$VFSSearch1 = "#include <cdfs.h>";
-$VFSNew1 = << "xxENDxx";
-#include <afs.h>
-#if defined(AFS) && AFS
-extern struct vfsops afs_vfsops;
-#endif
-
-#include <cdfs.h>
-xxENDxx
-
-$VFSSearch2 = << "xxENDxx";
- (struct vfsops *)0, "", /* 13 = MOUNT_ADDON */
-xxENDxx
-
-$VFSNew2 = << "xxENDxx";
-#if defined(AFS)
- &afs_vfsops, "afs",
-#else
- (struct vfsops *)0, "", /* 13 = MOUNT_ADDON */
-#endif
-xxENDxx
-
-
-
-if (!&Patch::Patch($VFSCONF, [[0, "Replace", $VFSSearch1, $VFSNew1],
- [0, "Replace", $VFSSearch2, $VFSNew2]])) {
- &ErrorMsg("Did not succeed with patch", $VFSCONF);
-}
-}
+++ /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
-
-# An InstallGuide for installing integrated login
-# For Alpha systems running Digital Unix 4.x and SIA
-#
-
-sub login {
-&Copy("lib/afs/libafssiad.so", "/usr/shlib/libafssiad.so");
-}
+++ /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
-
-# An InstallGuide for the AFS modified Unix commands
-# For Alpha systems running Digital Unix 4.x and SIA
-#
-
-sub DUXunix {
- &Copy("etc/inetd", "/usr/sbin/inetd.afs");
- &Copy("etc/inetd.conf", "/etc/inetd.conf.afs");
- &CopyStat("/etc/inetd.conf", "/etc/inetd.conf.afs");
-
- &ErrorsAreFatal(1);
- &CreateDir("/usr/vice/bin");
-
- &Copy("bin/rcp", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rcp");
- &Chmod (04755, "/usr/vice/bin/rcp");
-
- &Copy("bin/rsh", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rsh");
- &Chmod (04755, "/usr/vice/bin/rsh");
-
- # comment out the rshd line in inetd.conf
- $InetdConf = "/etc/inetd.conf";
- &Patch::Verbose if ($InstallVerbose);
- &Patch::FileOpen($InetdConf);
-
- $Search = "^(shell\\s+.+)";
- $Replace = '"#".$1';
-
- if (!&Patch::Patch($InetdConf, [[1, "Substitution", $Search, $Replace]])) {
- &ErrorMsg("Did not succeed with patch", $InetdConf);
- }
-
- # Modify the /etc/services file
- &ReadInstallGuide("$InstallGuideDir/GENERIC/unix");
- &unix;
-}
-
-sub unix {
- goto &DUXunix;
-}
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For HP 9000 systems running HPUX 10.01
-#
-
-sub build {
-my ($hostname);
-$hostname = `/bin/uname -n`;
-chop $hostname;
-$hostname = tr/a-z/A-Z/;
-&Print("Compiling with command \"/usr/sbin/config system\"");
-&Print("in directory /stand");
-&Print("New kernel will be /stand/vmunix_test");
-&Print("Install kernel as /stand/vmunix");
-
-&ErrorsAreFatal(1);
-$rc = chdir("/stand");
-&ErrorMsg("Could not change to dir", "/stand") if (!$rc);
-
-$rc = system("/usr/sbin/config system");
-$rc = $rc >> 8;
-&Print("Returned code $rc");
-}
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For HP 9000/7xx systems running HPUX 10.0
-#
-
-
-sub installkernel {
-&VersionCopyFile("/stand/vmunix_test", "/stand/vmunix");
-}
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For HP 9000 systems running HPUX 10.10
-#
-
-sub build {
-my ($hostname);
-$hostname = `/bin/uname -n`;
-chop $hostname;
-$hostname =~ tr/a-z/A-Z/;
-&Print("Compiling with command \"/usr/sbin/config -m master.d $hostname\"");
-&Print("in directory /stand/build_afs");
-&Print("New kernel will be /stand/build_afs/vmunix_test");
-&Print("Install kernel as /stand/vmunix");
-
-&ErrorsAreFatal(1);
-$rc = chdir("/stand/build_afs");
-&ErrorMsg("Could not change to dir", "/stand/build_afs") if (!$rc);
-
-$rc = system("/usr/sbin/config -m master.d $hostname");
-$rc = $rc >> 8;
-&Print("Returned code $rc");
-}
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For HP 9000/7xx systems running HPUX 10.10
-#
-
-
-sub installkernel {
-&VersionCopyFile("/stand/build_afs/vmunix_test", "/stand/vmunix");
-}
+++ /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
-
-# An InstallGuide for installing static AFS kernel libraries
-# For HP 9000 systems running HPUX 9.x
-#
-
-sub bldkernel {
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy ("root.client/bin/libafs.a", "/etc/conf"); }
-else {
- &Copy ("root.client/bin/libafs.nonfs.a", "/etc/conf/libafs.a"); };
-
-&CreateDir("/usr/vice/etc");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For HP 9000/7xx systems running HPUX 9.x
-#
-
-sub build {
-&Print("Compiling with command \"make -f config.mk\"");
-&Print("in directory /etc/conf");
-&Print("New kernel will be /etc/conf/hp-ux");
-&Print("and should be installed as /hp-ux");
-
-&ErrorsAreFatal(1);
-$rc = chdir("/etc/conf");
-&ErrorMsg("Could not change to dir", "/etc/conf") if (!$rc);
-
-$rc = system("make -f config.mk");
-$rc = $rc >> 8;
-&Print("Returned code $rc");
-}
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For HP 9000/7xx systems running HPUX 9.x
-#
-
-
-sub installkernel {
-&VersionCopyFile("/etc/conf/hp-ux", "/hp-ux");
-}
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For HP 9000 systems running HPUX 10.01
-#
-
-sub build {
-my ($hostname);
-$hostname = `/bin/uname -n`;
-chop $hostname;
-$hostname = tr/a-z/A-Z/;
-&Print("Compiling with command \"/usr/sbin/config systems\"");
-&Print("in directory /stnad");
-&Print("New kernel will be /stand/vmunix_test");
-&Print("Install kernel as /stand/vmunix");
-
-&ErrorsAreFatal(1);
-$rc = chdir("/stand");
-&ErrorMsg("Could not change to dir", "/stand") if (!$rc);
-
-$rc = system("/usr/sbin/config system");
-$rc = $rc >> 8;
-&Print("Returned code $rc");
-}
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For HP 9000/8xx systems running HPUX 10.0
-#
-
-
-sub installkernel {
-&VersionCopyFile("/stand/vmunix_test", "/stand/vmunix");
-}
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For HP 9000 systems running HPUX 10.10
-#
-
-sub build {
-my ($hostname);
-$hostname = `/bin/uname -n`;
-chop $hostname;
-$hostname =~ tr/a-z/A-Z/;
-&Print("Compiling with command \"/usr/sbin/config -m master.d $hostname\"");
-&Print("in directory /stand/build_afs");
-&Print("New kernel will be /stand/build_afs/vmunix_test");
-&Print("Install kernel as /stand/vmunix");
-
-&ErrorsAreFatal(1);
-$rc = chdir("/stand/build_afs");
-&ErrorMsg("Could not change to dir", "/stand/build_afs") if (!$rc);
-
-$rc = system("/usr/sbin/config -m master.d $hostname");
-$rc = $rc >> 8;
-&Print("Returned code $rc");
-}
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For HP 9000/8xx systems running HPUX 10.10
-#
-
-
-sub installkernel {
-&VersionCopyFile("/stand/build_afs/vmunix_test", "/stand/vmunix");
-}
+++ /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
-
-# An InstallGuide for installing static AFS kernel libraries
-# For HP 9000 systems running HPUX 9.x
-#
-
-sub bldkernel {
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy ("root.client/bin/libafs.a", "/etc/conf/lib"); }
-else {
- &Copy ("root.client/bin/libafs.nonfs.a", "/etc/conf/lib/libafs.a"); };
-
-&CreateDir("/usr/vice/etc");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For HP 9000 systems running HPUX 9.x
-#
-
-sub build {
-&Print("Compiling with command \"/etc/uxgen SAFS\"");
-&Print("in directory /etc/conf/gen");
-&Print("New kernel will be /etc/conf/SAFS/hp-ux");
-&Print("and should be installed as /hp-ux");
-
-&ErrorsAreFatal(1);
-$rc = chdir("/etc/conf/gen");
-&ErrorMsg("Could not change to dir", "/etc/conf/gen") if (!$rc);
-
-$rc = system("/etc/uxgen SAFS");
-$rc = $rc >> 8;
-&Print("Returned code $rc");
-}
-
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For HP 9000/8xx systems running HPUX 9.x
-#
-
-
-sub installkernel {
-&VersionCopyFile("/etc/conf/SAFS/hp-ux", "/hp-ux");
-}
+++ /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
-
-# An InstallGuide for installing static AFS kernel libraries
-# For HP systems running HPUX 10.20
-#
-
-sub bldkernel {
-if ($Configuration{"NFSEXTENSIONS"}) {
- &Copy("root.client/bin/libafs.a", "/usr/conf/lib"); }
-else {
- &Copy("root.client/bin/libafs.nonfs.a", "/usr/conf/lib/libafs.a"); };
-
-&CreateDir("/usr/vice/etc");
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("root.client/usr/vice/etc/afs.driver", "/usr/conf/master.d/afs");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-
-
-# Patch the files
-&ErrorsAreFatal(1);
-$FILE="/stand/system";
-
-&Patch::Verbose if ($InstallVerbose);
-
-&Patch::FileOpen($FILE);
-
-$Search = <<"xxENDxx";
-nfs
-xxENDxx
-
-$Add = <<"xxENDxx";
-afs
-xxENDxx
-
-if (!&Patch::Patch($FILE, [[0, "Insert", $Search, $Add]])) {
- &ErrorMsg("Did not succeed with patch", $FILE);
-}
-}
-
+++ /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
-
-# An InstallGuide for compiling a new kernel
-# For HP 9000 systems running HPUX 10.20
-#
-
-sub build {
-print "Compiling with command \"/usr/sbin/mk_kernel\"\n";
-print "in directory /stand/build\n";
-print "New kernel will be /stand/build/vmunix_test\n";
-print "Install kernel as /stand/vmunix\n";
-
-&ErrorsAreFatal(1);
-$rc = chdir("/stand/build");
-&ErrorMsg("Could not change to dir", "/stand/build") if (!$rc);
-
-$rc = system("/usr/sbin/mk_kernel");
-$rc = $rc >> 8;
-print "Returned code $rc\n";
-}
+++ /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
-
-# An InstallGuide for installing a new kernel
-# For HP 9000 systems running HPUX 10.20
-#
-
-
-sub installkernel {
-&VersionCopyFile("/stand/build/vmunix_test", "/stand/vmunix");
-}
+++ /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
-
-# bldkernel
-#
-# An InstallGuide for installing static kernel libs
-#
-
-sub bldkernel {
-&Print("Installs the libraries necessary for building AFS into the");
-&Print("kernel, putting them in the system specific directories.");
-&Print("Also installs the AFS daemon /usr/vice/etc/afsd and the client");
-&Print("control and query program /usr/vice/etc/fs");
-&Print("If the NFS Support Option is turned on, the libraries which");
-&Print("support NFS and the NFS Translator are installed instead.");
-&Print("See also the Perform Kernel Build package.");
-}
+++ /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
-
-# build
-#
-# An InstallGuide for building a kernel with AFS
-#
-
-sub build {
-&Print("This option will execute the commands which build a new kernel");
-&Print("on the system. It will modify the system files necessary to");
-&Print("incorporate AFS into the new kernel. For details on what system");
-&Print("files must be modified, see the AFS Install Guide and current");
-&Print("Release Notes. This option will tell where the new kernel is and");
-&Print("where to install it, but will NOT remove the existing kernel file.");
-&Print("See the \"installkernel\" option for automatically installing");
-&Print("the new kernel into place.");
-}
+++ /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
-
-# clientconfig
-#
-# An InstallGuide for configuration of an AFS client
-#
-
-sub clientconfig {
-&Print("Initializes a machine for the first time to be an AFS client.");
-&Print("Creates the /usr/vice/etc directory and places therein a cacheinfo");
-&Print("file, ThisCell file, and CellServDB. These files are controlled by");
-&Print("the configuration parameters AFSROOT, CACHEDIR, CACHESIZE, CELLNAME,");
-&Print("and CELLSERVDB.");
-}
+++ /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
-
-# dbserver
-#
-# An InstallGuide for database server processes
-#
-
-sub dbserver {
-&Print("Installs the following into /usr/afs/bin:");
-&Print(" root.server/usr/afs/bin/bosserver");
-&Print(" root.server/usr/afs/bin/kaserver");
-&Print(" root.server/usr/afs/bin/vlserver");
-&Print(" root.server/usr/afs/bin/ptserver");
-}
+++ /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
-
-# debug
-#
-# An InstallGuide for installing debugging programs
-#
-
-sub debug {
-&Print("Installs the following into /usr/vice/bin:");
-&Print(" bin/afsmonitor");
-&Print(" bin/cmdebug");
-&Print(" etc/fstrace");
-&Print(" etc/kdump");
-&Print(" etc/rxdebug");
-&Print(" bin/scout");
-&Print(" bin/udebug");
-&Print("Install root.server/usr/afs/bin/volinfo into /usr/afs/bin");
-&Print("Install root.client/usr/vice/etc/C/afszcm.cat into /usr/vice/etc/C");
-}
+++ /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
-
-# fileserver
-#
-# An InstallGuide for fileserver processes
-#
-
-sub fileserver {
-&Print("Installs the following into /usr/afs/bin:");
-&Print(" root.server/usr/afs/bin/bosserver");
-&Print(" root.server/usr/afs/bin/fileserver");
-&Print(" root.server/usr/afs/bin/volserver");
-&Print(" root.server/usr/afs/bin/salvager");
-}
+++ /dev/null
-
-Help on the GUI Installer
-==========================
-
-
-Table of Contents
-------------------
-Introduction
-Install Guides
- Sysname directories
- Wildcard directories
- .skip files
-The RC File
-The Main Window
- Hostname
- Local installs
- Remote installs
- Multiple installations
- Path
- Finding the AFS distribution
- Finding the AFS sysname
- Accelerator buttons
- Setting default path from command line
- Packages
- Default vs Custom installation
- List of available packages and where it comes from
- Command line list of packages
- Adding new packages to the list
- Options
- Verbose
- Backup files
- Setting default values from command line
-Installation
- Info Only
- Install
- The Progress window
- Default installations
- Seeing the command output
- Finishing up the installation
- Why those two buttons are disabled
-Exit
-Errors
-
-
-
-INTRODUCTION
-------------
-This program is designed to install AFS on a machine from a
-standard AFS distribution directory. The AFS distribution is
-logically divided into sections called "packages", and one or more
-packages can be installed at a time. AFS can be installed on the
-local machine or to one or more remote machines on which AFS aware
-inetd is running.
-
-INSTALL GUIDES
---------------
- The installation of packages is controlled by perl subscripts
-called Install Guides. The complete set of Install Guides is kept
-under the lib/InstallGuides directory. There is one Install Guide
-per package, and it provides all of the Perl code that is necessary
-to install that package. Because different systems have different
-requirements for installation, the InstallGuides/ directory has in
-it different subdirectories for different systems. The
-subdirectories match the AFS sysnames, such as "sgi_64". Inside
-each system name subdirectory are package files that are specific
-to the system.
- There are also wildcard subdirectories, such as SGI_x, which can
-be searched if a desired package is NOT in its sysname
-subdirectory. The wildcarding consists of capitalizing the letters
-in the sysname, and using the letter "x" to match one or more
-characters. In the case of multiple wildcard directories matching a
-sysname, the longest wildcard directory wins.
- As a catchall wildcard, there is also a subdirectory "GENERIC"
-that can be searched if all other matches fail.
- If a file exists whose name is a package name with ".skip"
-appended, that package will not be installed on machines of that
-system type. This is useful to prevent GENERIC Installation Guides
-from being used, such as "bldkernel" on Solaris machines or "vfsck"
-on SGI machines.
-
-RC FILE
---------
- This installer program uses an rc script named "afsinstall.rc"
-located in the InstallGuides/ subdirectories. Locating the right one
-follows the same rules as locating an InstallGuide: look in the
-sysname subdirectory, then look in the wildcard directories, and
-lastly look in GENERIC.
- The GENERIC afsinstall.rc file is always read in, followed by the
-most system specific one available, if any. There can also be an
-afsinstall.rc file in the user's home directory given by the
-environment variable "HOME", and if it exists it will be read in
-last. If more than one of these afsinstall.rc files are read in, the
-files read later will merge with and overwrite the values and options
-from the earlier files.
- The rc file consists of three sections separated by a blank
-line. The first section sets up Path accelerator buttons, the second
-describes available packages. Both are described in the appropriate
-sections below. The third section sets configuration options similar
-to environment variables. Each line is of the form
-
-NAME=VALUE
-
-The InstallGuide files can then access the VALUE by referencing the
-key NAME in the hash Configuration. This is intended for use as
-options such as use of NFS aware kernel libraries, default cache size,
-etc. The VALUE can be omitted after the equals sign to signify a NULL
-value.
-
- The personal afsinstall.rc file in the user's home directory is
-intended to let the user select default packages to install and
-default options such as usage of NFS libraries. Because the user may
-want to set different options for different system types, system
-specific options can be put into an afsinstall.rc file. To make a
-given line in the file apply only to certain system types, the line
-can be prepended with an AFS system name followed by a colon, such as:
-
-sun4x_56 :modkernel 1 Dynamic kernel libraries and afsd
- ALPHA_x :modkernel 0 Dynamic kernel libraries and afsd
-
-The first line shows that Solaris 2.6 systems should have the
-"modkernel" package installed by default, while the wildcarded second
-line shows the same option should be off by default on all Alpha
-platforms. All systems that were not running Solaris 2.6 would
-completely skip the first line, such that the determination of
-installing the "modkernel" package by default would have to be
-resolved by one of the other afsinstall.rc files that was read in.
-The same applies for the second line in the example above for non
-Alpha machines.
-
-
-THE MAIN WINDOW
-----------------
-The install window is divided into four sections. From top to
-bottom, these sections select the host or hosts on which to
-install, locate the AFS distribution, select the packages to
-install, and set certain options.
-
-
-HOSTNAME
---------
- The top section first appears as an entry box labelled "Hostname"
-with the local hostname filled in. The local hostname was taken
-from the HOST environment variable. If an install is begun by
-pressing the "INSTALL" button, AFS will be installed on the local
-machine using the same user identity by which this program was run.
- If a new value is typed in and entered with the RETURN key, a
-second entry box will appear labelled "rsh as username:", and a
-default username is filled in. This value came from the RSHas
-variable set at the top of this program. When an installation is
-started, the program will attempt to make an rsh connection to the
-hostname entered under the identity given in the "rsh as username:"
-box. Note that rsh will still be used if the hostname entered does
-not match the HOST environment variable but still refers to the
-local host (eg entering "localhost" or the FQDN). Also note that
-setting up an AFS aware inetd on the remote machine requires that
-the AFS client is already running, so this feature is primarily
-intended for AFS upgrades and not first time installs.
- If the value entered into the "Hostname" box is a filename, the
-label for that box becomes "Filename". If an install is then
-started by pressing the "INSTALL" button, the entered file is read
-and each line of the file is used as a remote hostname on which to
-install AFS using rsh.
-
-PATH
-----
- The Path section is divided into two parts. The upper part is an
-entry box and the lower half is several default value buttons. The
-path to the distribution of AFS is entered into the upper entry
-box. When an install is started by pressing the "INSTALL" button,
-the path given is inspected, searching for signs of an AFS
-distribution. Namely, the existence of a "root.client" directory is
-used to determine if there is an AFS distribution. If the path
-given does not have an AFS distribution, the installer will also
-look for one under a directory matching the host's AFS sysname (eg
-sun4x_55) and a directory under that named "dest". If no AFS
-distribution can be found, the installation exits with an error.
- The AFS sysname is determined automatically using the output of
-/bin/uname and NOT via "fs sysname". If an installation is being
-done on a remote machine, the remote machine's AFS sysname is used,
-allowing installations on heterogeneous networks.
- The buttons in the lower half of the Path section will enter in
-path names for you into the upper entry box. By clicking on any of
-the buttons, the entry box is cleared and a new value is
-inserted. A special button "CLEAR" is automatically provided which
-simply clears the entry box. The other buttons are taken from the
-top half of the installer rc script. The lines from that file
-consist of a key word to put into the button, followed by a pathname. If
-one of the accelerator buttons has the key word "default", the
-pathname given will be entered into the entry box when the program
-starts, and no button is rendered for it.
- If the "-path" flag was given on the command line, whatever
-string followed that flag will be filled in as the default install
-path.
-
-PACKAGES
---------
- The Packages area is also divided into two halves. The upper half
-consists of two radio buttons which allow you to install either a
-default set of packages or a hand selected set of packages. The
-lower half lists the packages that can be hand selected, and is
-only used if the "Custom installation:" radio button is selected.
- The list of packages available is read from the lower section of
-the afsinstall.rc file. Each line consists of three parts: the
-package name (and, therefore, matching InstallGuide filename), the
-default mode for that package, and a brief explanation of the
-package. If the "Default Installation" radio button is selected,
-all those packages with a "mode" of "1" will be installed. These
-default packages are also initially selected in the "custom"
-packages area when the program starts.
- Note that the list of default packages can change from system to
-sytem, depending on which afsinstall.rc file in the
-lib/InstallGuides/ directories matches the system name on which AFS
-is being installed. Thus the default packages on the local machine
-may be different from those on remote machines if the remote
-machines are of different system types.
- If the "-pkg" flag was given on the command line when the
-installer was invoked, the list of package names provided will be
-selected and the "Custom installation" radio button will select
-itself.
- See the "INFO ONLY" button (below) for details about what each
-package does.
- New packages can be added by creating Perl subscripts in the
-InstallGuides/ directories and appending an entry to the
-afsinstall.rc file. The Install Guide subscript file is given the
-same name as the package name. Within the file is a function also
-with the same name as the package. Whatever code is within that
-function will be loaded in and executed when that package is
-installed. Several "smart" functions are available in the body of
-the installer program itself, such as &Copy(), &Symlink(), and
-&CreateDir(). Following the code of other existing Install Guides
-will show how these functions can be used.
-
-
-OPTIONS
--------
- There are two option buttons. The first option, labelled "Verbose"
-turns on verbose output. When selected, the installations will provide
-more output about what they are doing. Without this option, only the
-package names and error messages are output during the install. The
-second option button, "Don't keep backup files", instructs the
-installer to not keep a backup of files being overwritten. When the
-option is off, a file that is about to be overwritten will be moved
-aside by appending .old to the filename.
- Both options are off by default. The "-v" flag can be given on the
-command line to turn on the Verbose option, and the "-nobackup" flag
-will disable backup file creation.
-
-
-
-INSTALLATION
-=============
-
-INFO ONLY
----------
- If this button is pressed, no installation of AFS will actually
-occur. Instead, a window appears and gives details about what each
-selected package does. The information is derived from the "info"
-subdirectory in the InstallGuides/ area. The window has a "DISMISS"
-button for when you are finished reading.
- This help guide is actually the info guide named "gui".
-
-INSTALL
---------
- This button begins the actual installation. When pressed, a new
-window will appear, called the Progress window. The window will
-contain a column of boxes for each machine on which an
-installation is running. Note that multiple installations is only
-available by entering a filename in the "Hostname:" box (see
-above). At the top of the column(s) will be a button labelled with
-the hostname on which the installation is running. Under the
-hostname(s) there will be a box for each package that has been
-selected. When the machine begins installation of a package, the
-box contains the word "WORKING". If an error occurs with the
-installation of that package, the box says "ERROR". Installation of
-later packages will still occur despite errors in previous
-packages. When a package completes without errors the box will
-say "SUCCESS". When the installation finishes, the last box in the
-column, labelled "done" will turn to either "SUCCESS" or "ERRORS"
-depending on the outcome of all the packages.
- Note that if the "Default installation" radio button in the
-Packages area is selected, a row of boxes will be created for ALL
-available packages. If an available package is not a default
-package for a particular machine, that box will never be filled in for
-that machine. This was done because the set of default packages can
-vary if multiple installations are in progress.
- To see the full text output of a machine's installation, press
-the hostname button at the top of the column of boxes. A window
-will appear with all of the output. A scrollbar is attached for
-when the output exceeds the height of the window. The window size
-can be changed by using the window manager. At the bottom of the
-output window will be two buttons, named "STOP INSTALL" and
-"DISMISS". The first will kill the install job on that machine,
-whether it is the local host or a remote host. this is for use when
-you see things going very wrong. The second button closes the
-output window but leaves the installation running. When the
-installation is complete the "STOP INSTALL" button is removed. If
-the output window is closed, it can be reopened again by pressing
-the hostname button again in the Progress window.
- The Progress window also has a "DISMISS" button, and if this button
-is pressed the Progress window will close itself. If there are
-installations still in progress they will be terminated, and all
-output from the installs is deleted from memory. Use this button
-only when you are satisfied with the completion of the
-installation.
- While the Progress window is still open the "INSTALL" and "INFO
-ONLY" buttons in the main window are disabled. This is a safety
-feature to prevent simultaneous installation processes on the same
-machine. Closing the Progress window will reenable the two buttons.
-
-
-EXIT
-====
- The EXIT button at the bottom closes all windows and exits the
-program.
-
-
-ERRORS
-======
- There are a few errors that are checked for and are handled in
-the installation process. Error windows will appear for a certain
-set of these errors.
- If an installation is to be performed on a
-remoted machine, and that machine does not have an AFS aware inetd
-running the rsh daemon, an error window will appear telling you
-so.
- The installation program is a Perl script that requires Perl
-5. The path to the perl program is the very first line of the
-install program. If that path is to a Version 4 copy of Perl, an
-error window will appear telling you so. This can be fixed either
-by changing the first line of the installer or by upgrading the
-copy of Perl to at least Version 5.00.
+++ /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
-
-# installkernel
-#
-# An InstallGuide for installing static kernels
-#
-
-sub installernel {
-&Print("Take a kernel that has been statically built and installs it");
-&Print("in place so that it will be used after the next reboot. This");
-&Print("is intended only for use on those machines that enable");
-&Print("building AFS into the kernel instead of dynamically loading.");
-&Print("A hard link is made between the new kernel and a copy of it");
-&Print("with the AFS revision appended to the filename. If the");
-&Print("previous kernel did NOT have AFS built into it, that vendor");
-&Print("kernel is moved aside with \".orig\" appended to the filename.");
-}
+++ /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
-
-# login
-#
-# An InstallGuide for installing the AFS integrated login
-#
-
-sub login {
-&Print("Installs /bin/login.afs and makes /bin/login a symlink to it.");
-&Print("This should be installed on all client machines so that logging");
-&Print("into a system at the usual Unix login prompt will authenticate");
-&Print("the user with AFS and store a token in the kernel.");
-&Print("Note that this option is different on certain systems, such as");
-&Print("AIX and SGI, where helper files are installed in /usr/vice/etc");
-&Print("and on systems which use authentication modules such as PAM and SIA");
-}
+++ /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
-
-# miscserver
-#
-# An InstallGuide for fileserver processes
-#
-
-sub miscserver {
-&Print("Installs the following into /usr/afs/bin:");
-&Print(" root.server/usr/afs/bin/buserver");
-&Print(" root.server/usr/afs/bin/upserver");
-&Print(" root.server/usr/afs/bin/upclient");
-}
+++ /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
-
-# modkernel
-#
-# An InstallGuide for installing dynamic kernel libs
-#
-
-sub modkernel {
-&Print("Installs the libraries necessary for dynamically loading AFS");
-&Print("into the kernel, usually putting them in /usr/vice/etc/dkload");
-&Print("Also installs the AFS daemon /usr/vice/etc/afsd and the client");
-&Print("control and query program /usr/vice/etc/fs");
-&Print("If the NFS Support Option is turned on, the libraries which");
-&Print("support NFS and the NFS Translator are installed instead.");
-}
+++ /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
-
-# other
-#
-# An InstallGuide for generic binaries not specifically listed in other
-# packages
-#
-
-sub other {
-&Print("Installs the following into /usr/afs/bin:");
-&Print(" bin/compile_et");
-&Print(" bin/kpwvalid");
-&Print(" bin/install");
-&Print(" bin/pagsh");
-&Print(" etc/rmtsysd");
-&Print(" bin/rxgen");
-&Print(" bin/sys");
-&Print(" bin/up");
-&Print(" bin/washtool");
-&Print(" bin/xstat_cm_test");
-&Print(" bin/xstat_fs_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
-
-# rc
-#
-# An InstallGuide for AFS startup scripts
-#
-
-sub rc {
-&Print("Installs the following into /usr/vice/etc/dkload:");
-&Print(" root.client/usr/vice/etc/dkload/rc.afsd.small");
-&Print(" root.client/usr/vice/etc/dkload/rc.afsd.medium");
-&Print(" root.client/usr/vice/etc/dkload/rc.afsd.large");
-&Print("Creates a script to be run with the system rc scripts.");
-&Print(" * For most BSD systems, it is stored as /etc/rc.afs");
-&Print(" * For most SYSV systems, it is stored as /etc/init.d/afs");
-&Print(" or /sbin/init.d/afs, and symlinks are made in /etc/rc?.d/");
-&Print(" or /sbin/rc?.d/ so that it runs in the right order.");
-&Print(" * On AIX systems, an entry is added to /etc/inittab so that AFS");
-&Print(" is started at runlevel 2 after NFS starts.");
-&Print(" * On HP-UX 9.x systems, a command is also added into the");
-&Print(" localrc() function in /etc/rc to run /etc/rc.afs");
-}
+++ /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
-
-# serveruser
-#
-# An InstallGuide for user programs for controlling server processes
-#
-
-sub serveruser {
-&Print("Installs the following into /usr/afs/bin:");
-&Print(" root.server/usr/afs/bin/bos");
-&Print(" root.server/usr/afs/bin/fs");
-&Print(" root.server/usr/afs/bin/kas");
-&Print(" root.server/usr/afs/bin/pts");
-&Print(" root.server/usr/afs/bin/vos");
-&Print(" etc/butc");
-&Print(" etc/backup");
-&Print(" root.server/usr/afs/bin/ntpdc");
-}
+++ /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
-
-# tokens
-#
-# An InstallGuide for installing tokens related commands
-#
-
-sub tokens {
-&Print("Installs the following into /usr/afs/bin/ :");
-&Print(" bin/klog");
-&Print(" bin/knfs");
-&Print(" bin/kpasswd");
-&Print(" bin/pagsh");
-&Print(" bin/tokens");
-&Print(" bin/unlog");
-}
+++ /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
-
-# unix
-#
-# An InstallGuide for installing the AFS aware unix programs
-#
-
-sub unix {
-&Print("Installs the modified Unix programs into the system specific");
-&Print("directories. The programs include:");
-&Print(" inetd.afs");
-&Print(" rsh");
-&Print(" rcp");
-&Print(" ftpd\n");
-}
+++ /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
-
-# vfsck
-#
-# An InstallGuide for installing the AFS integrated fsck
-#
-
-sub vfsck {
-&Print("Replaces the vendor fsck program with an identical program");
-&Print("which is aware of the changes to inodes made in vice");
-&Print("partitions on fileservers. This should be installed on all");
-&Print("AFS fileservers.");
-}
+++ /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
-
-# An InstallGuide for static AFS kernel libraries
-# For SGI systems running IRIX 6.3
-#
-
-sub bldkernel {
-my ($chip, $nfs, $libafs);
-&ErrorsAreFatal(1);
-
-# Find out what kind of chip the machine has (Rx000)
-$chip = `hinv -t cpu`;
-$chip =~ /R[51]0*/;
-$chip = $&;
-&ErrorMsg("Couldn't determine chip type with", "hinv") unless ($chip =~ /^R/);
-
-# NFS support
-if ($Configuration{"NFSEXTENSIONS"}) {
- $nfs = ""; }
-else {
- $nfs = ".nonfs"; };
-
-# From the above, put together the name of the kernel library to use
-$libafs = "libafs.SP.$chip$nfs.a";
-
-&CreateDir("/usr/vice/etc/sgiload");
-&ErrorsAreFatal(0);
-
-&Copy("root.client/bin/$libafs", "/var/sysgen/boot/afs.a");
-&Copy("root.client/usr/vice/etc/sgiload/afs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.rc", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.sm", "/usr/vice/etc/sgiload");
-
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-system("/etc/chkconfig -f afsml off");
-}
+++ /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
-
-# An InstallGuide for dynamic kernel loaded libraries
-# For SGI systems running IRIX 6.x
-#
-
-sub modkernel {
-my($chip, $nfs, $libafs);
-&ErrorsAreFatal(1);
-
-# Find out what kind of chip the machine has (Rx000)
-$chip = `hinv -t cpu`;
-$chip =~ /R[51]0*/;
-$chip = $&;
-&ErrorMsg("Could not determine chip type with", "hinv") unless ($chip =~ /^R/);
-
-# NFS support
-if ($Configuration{"NFSEXTENSIONS"}) {
- $nfs = ""; }
-else {
- $nfs = ".nonfs"; };
-
-# From the above, put together the name of the kernel library to use
-$libafs = "libafs.SP.$chip$nfs.o";
-
-&CreateDir("/usr/vice/etc/sgiload");
-&ErrorsAreFatal(0);
-
-&Copy("root.client/usr/vice/etc/sgiload/$libafs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.rc", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.sm", "/usr/vice/etc/sgiload");
-
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-system("/etc/chkconfig -f afsml on");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for static AFS kernel libraries
-# For SGI systems running IRIX 6.3
-#
-
-sub bldkernel {
-my ($nfs, $libafs);
-&ErrorsAreFatal(1);
-
-# NFS support
-if ($Configuration{"NFSEXTENSIONS"}) {
- $nfs = ""; }
-else {
- $nfs = ".nonfs"; };
-
-# From the above, put together the name of the kernel library to use
-$libafs = "libafs$nfs.a";
-
-&CreateDir("/usr/vice/etc/sgiload");
-&ErrorsAreFatal(0);
-
-&Copy("root.client/bin/$libafs", "/var/sysgen/boot/afs.a");
-&Copy("root.client/usr/vice/etc/sgiload/afs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.rc", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.sm", "/usr/vice/etc/sgiload");
-
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-system("/etc/chkconfig -f afsml off");
-}
+++ /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
-
-# An InstallGuide for dynamic kernel loaded libraries
-# For SGI systems running IRIX 6.x
-#
-
-sub modkernel {
-my($nfs, $libafs);
-&ErrorsAreFatal(1);
-
-# NFS support
-if ($Configuration{"NFSEXTENSIONS"}) {
- $nfs = ""; }
-else {
- $nfs = ".nonfs"; };
-
-# From the above, put together the name of the kernel library to use
-$libafs = "libafs$nfs.o";
-
-&CreateDir("/usr/vice/etc/sgiload");
-&ErrorsAreFatal(0);
-
-&Copy("root.client/usr/vice/etc/sgiload/$libafs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.rc", "/usr/vice/etc/sgiload");
-&Copy("root.client/usr/vice/etc/sgiload/afs.sm", "/usr/vice/etc/sgiload");
-
-&Copy("root.client/usr/vice/etc/afsd", "/usr/vice/etc");
-&Chmod(0744, "/usr/vice/etc/afsd");
-system("/etc/chkconfig -f afsml on");
-&Copy("bin/fs", "/usr/vice/etc/fs");
-}
+++ /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
-
-# An InstallGuide for installing the AFS integrated login
-#
-
-sub login {
- &ErrorsAreFatal(1);
- &Copy("lib/pam_afs.so.1", "/usr/lib/security");
- &Chmod(0755, "/usr/lib/security/pam_afs.so.1");
- &Chown(0,3, "/usr/lib/security/pam_afs.so.1");
-
- $PamConf = "/etc/pam.conf";
- &Patch::Verbose if ($InstallVerbose);
- &Patch::FileOpen($PamConf);
-
- $LoginSubSearch = "^(login.+)required(.+)";
- $LoginSubReplace = '$1.optional.$2';
-
- $LoginAuthSearch = "^login\\s+auth\\s+.*pam_unix.so.1";
- $LoginAuthNew = <<"xxENDxx";
-login auth optional /usr/lib/security/pam_afs.so.1 try_first_pass ignore_root
-xxENDxx
-
- $LoginAccountSearch = "^login\\s+account\\s+.*pam_unix.so.1";
- $LoginAccountNew = <<"xxENDxx";
-login account optional /usr/lib/security/pam_afs.so.1 try_first_pass ignore_root
-xxENDxx
-
- $OtherSubSearch = "^(other.+)required(.+)";
- $OtherSubReplace = '$1.optional.$2';
-
- $OtherAuthSearch = "^other\\s+auth\\s+.*pam_unix.so.1";
- $OtherAuthNew = <<"xxENDxx";
-other auth optional /usr/lib/security/pam_afs.so.1 try_first_pass ignore_root
-xxENDxx
-
- $OtherAccountSearch = "^other\\s+account\\s+.*pam_unix.so.1";
- $OtherAccountNew = <<"xxENDxx";
-other account optional /usr/lib/security/pam_afs.so.1 try_first_pass ignore_root
-xxENDxx
-
- $DtLoginSubSearch = "^(dtlogin.+)required(.+)";
- $DtLoginSubReplace = '$1.optional.$2';
-
- $DtLoginAccountSearch = "^dtlogin\\s+account\\s+.*pam_unix.so.1";
- $DtLoginAccountNew = <<"xxENDxx";
-dtlogin account optional /usr/lib/security/pam_afs.so.1 try_first_pass ignore_root
-xxENDxx
-
- &VPrint("Patching \"$PamConf\"");
- if (!&Patch::Patch($PamConf, [[1, "Substitution", $LoginSubSearch, $LoginSubReplace],
- [1, "Insert", $LoginAuthSearch, $LoginAuthNew],
- [1, "Insert", $LoginAccountSearch, $LoginAccountNew],
- [1, "Substitution", $OtherSubSearch, $OtherSubReplace],
- [1, "Insert", $OtherAuthSearch, $OtherAuthNew],
- [1, "Insert", $OtherAccountSearch, $OtherAccountNew],
- [1, "Substitution", $DtLoginSubSearch, $DtLoginSubReplace],
- [1, "Insert", $DtLoginAccountSearch, $DtLoginAccountNew]])) {
- &ErrorMsg("Did not succeed with patch", $PamConf);
- }
- &Chmod(0644, $PamConf);
- &Chown(0,0, "/usr/lib/security/pam_afs.so.1");
-
-}
+++ /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
-
-# An InstallGuide for the AFS modified Unix commands
-# For Sun systems running Solaris 5.6
-#
-
-sub unix {
- &Copy("etc/inetd", "/usr/sbin/inetd.afs");
-
- &ErrorsAreFatal(1);
- &Patch::Verbose if ($InstallVerbose);
- &CreateDir("/usr/vice/bin");
-
- &Copy("bin/rsh", "/usr/vice/bin");
- &Chown (0,2, "/usr/vice/bin/rsh");
- &Chmod (04755, "/usr/vice/bin/rsh");
-
- &Copy("lib/pam_afs.so.1", "/usr/lib/security");
- &Chmod(0755, "/usr/lib/security/pam_afs.so.1");
- &Chown(0,3, "/usr/lib/security/pam_afs.so.1");
-
- $PamConf = "/etc/pam.conf";
- &Patch::FileOpen($PamConf);
-
- $RloginSubSearch = "^(rlogin.+)required(.+)";
- $RloginSubReplace = '$1.optional.$2';
-
- $RLoginAuthSearch = "^rlogin\\s+auth\\s+.+pam_unix.so.1";
- $RLoginAuthNew = <<"xxENDxx";
-rlogin auth optional /usr/lib/security/pam_afs.so.1 try_first_pass ignore_root
-xxENDxx
-
- $RshSubSearch = "^(rsh.+)required(.+)";
- $RshSubReplace = '$1.optional.$2';
-
- $RshSearch = "^rsh\\s+auth\\s+.*pam_rhosts_auth.so.1";
- $RshNew = <<"xxENDxx";
-rsh auth optional /usr/lib/security/pam_afs.so.1 try_first_pass ignore_root
-xxENDxx
-
- if (!&Patch::Patch($PamConf, [[1, "Substitution", $RloginSubSearch, $RloginSubReplace],
- [1, "Insert", $RLoginAuthSearch, $RLoginAuthNew],
- [1, "Substitution", $RshSubSearch, $RshSubReplace],
- [1, "Insert", $RshSearch, $RshNew]])) {
- &ErrorMsg("Did not succeed with patch", $PamConf);
- }
-
- # Create the inetd.conf.afs file
- $InetdConfAfs = "/etc/inet/inetd.conf.afs";
- open(INETD, ">$InetdConfAfs") || &ErrorMsg("Can't open file", $InetdConfAfs);
- print INETD <<"EOINETD";
-shell stream tcp nowait root /usr/sbin/in.rshd in.rshd
-ta-rauth stream tcp nowait root internal ta-rauth
-EOINETD
- &Symlink("./inet/inetd.conf.afs", "/etc/inetd.conf.afs");
-
- # comment out the rshd line in inetd.conf
- $InetdConf = "/etc/inet/inetd.conf";
- &CopyStat($InetdConf, $InetdConfAfs);
- &Patch::FileOpen($InetdConf);
-
- $Search = "^(shell\\s+.+)";
- $Replace = '"#".$1';
-
- if (!&Patch::Patch($InetdConf, [[1, "Substitution", $Search, $Replace]])) {
- &ErrorMsg("Did not succeed with patch", $InetdConf);
- }
-
- # Modify the /etc/inet/services file
- # append the ta-rauth to the services file
- $Services = "/etc/inet/services";
- &Patch::FileOpen($Services);
-
- $ServicesAppend = "ta-rauth 601/tcp rauth";
-
- if (!&Patch::Patch($Services, [[0, "EOF", "", $ServicesAppend]])) {
- &ErrorMsg("Did not succeed with patch", $Services);
- }
-}
-
+++ /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
-
-# An InstallGuide for installing the AFS aware file system checker
-# For Sun systems running Solaris 2.6
-#
-
-sub vfsck {
-my($ufs, , $afs, $file);
-$ufs = "/usr/lib/fs/ufs";
-$afs = "/usr/lib/fs/afs";
-
-&CreateDir($afs);
-&Copy("root.server/etc/vfsck", "$afs/fsck");
-
-&ErrorsAreFatal(1);
-$rc = opendir(UFS, $ufs);
-&ErrorMsg("Could not opendir", $ufs) if (!$rc);
-while($file = readdir(UFS)) {
- next if ($file eq ".");
- next if ($file eq "..");
- next if ($file eq "fsck");
- next if (-e "$afs/$file");
- &Symlink("$ufs/$file", "$afs/$file"); };
-&ErrorsAreFatal(0);
-closedir(UFS);
-}
-
+++ /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
-
-package Patch;
-@Functions = ("Substitution", "Insert", "Replace", "EOF");
-
-#
-# PatchError(Msg)
-#
-# This subroutine will print a message and exit.
-#
-# Msg is the message to print
-#
-sub PatchError {
- my ($msg) = @_;
- die $msg;
-}
-
-#
-# FileOpen(File)
-#
-# This subroutine will open the given File for reading and
-# will open a second file with the name File.new for writing.
-# The subroutine will save these newly-created subroutines in
-# an associative array for Patch to use.
-#
-# This subroutine will cause the whole program to exit if it
-# cannot open either file.
-#
-
-sub FileOpen {
- my($File) = @_;
- my $FH = "${File}_FH";
- my $FHOUT = "${FH}OUT";
- my $Error = (defined(&main::ErrorMsg)) ? \&main::ErrorMsg : \&PatchError;
- open($FH, "$File") || &$Error("Cannot open $File: $!");
- open($FHOUT, ">$File.new") || &$Error("Cannot open $File.new: $!");
- $FileHandles{$File} = [$FH, $FHOUT];
-}
-
-#
-# Verbose()
-#
-# This subroutine will cause the subroutine Patch to be in verbose
-# mode if called.
-#
-
-sub Verbose {
- $Verbose = 1;
-}
-
-#
-# Debug()
-#
-# This subroutine will cause the subroutine Patch to be in verbose
-# mode if called.
-#
-
-sub Debug {
- $Debug = 1;
-}
-
-#
-# sub Patch(File, ActionArrayReference)
-# File = string
-# ActionArrayReference = reference to an array of Actions
-# Actions = (RE, Function, SearchLines, NewLines)
-#
-# This subroutine will try to patch a given File by following
-# the given Actions provided in the Actions array passed to it
-# as a reference
-#
-# The Action array reference passed to it contains references to
-# the actual Actions to be taken.
-#
-# The Actions are implemented as an array as described above.
-# RE is a flag to use Regular Expressions or not (1 or 0)
-# Function is one of Substitution, Insert, Replace or EOF
-# SearchLines is a newline-separated string of lines to search for.
-# NewLines is a newline-separated string of lines which will be new
-# to the given file.
-#
-# ASUMPTIONS
-#
-# EOF: The function will do nothing and return Success if the New lines are
-# present anywhere in the file.
-# Returns 1 on Success, 0 otherwise
-#
-
-sub Patch {
- my ($File, $ActionList) = @_; # the filename and list reference
- my ($status, $ActionRef, $FH, $tmp, $RE);
- local($NEWFH);
- my ($SearchPatternArrayRef, $NewPatternArrayRef, $ArrayRef);
- my $ReplacementMatchRef;
- local ($SearchBufferRef, $NewBufferRef);
- my ($SearchLines, $NewLines, @SearchArray, @NewArray, $Function);
- my (%NewIndex, %NewBuffer, %SearchIndex, %SearchBuffer);
- my (%NewMatch, %NewLinesPrinted, %ReplacementMatch);
- local ($NewIndexRef, $SearchIndexRef);
- local $CurrentLine = 0;
- my $Index = 0;
- my (@Done);
- my $Errors = 0;
- my $NextLoop;
- my $Redo = 0;
-
- # Check to see if the Action List is empty
- if ($#$ActionList == -1) {
- print "No Actions specified for $File\n";
- return 0;
- }
-
- # Check to see if the given file has already been opened with FileOpen
- if (!exists($FileHandles{$File})) {
- print "$File has not been previously opened with Patch::FileOpen\n";
- return 0;
- }
-
- print "\nAttempting to patch $File...\n" if ($Verbose);
-
- $ArrayRef = $FileHandles{$File};
- ($FH, $NEWFH) = @$ArrayRef;
-
- # Initialize the assoc. arrays which will be used to keep track of indices
- # and the previously found matches
-
- foreach $ActionRef (@$ActionList) {
- my (@SearchPatternArray, @NewPatternArray);
- $Done{$Index} = 0;
-
- $SearchIndex{$Index} = 0;
- $SearchBuffer{$Index} = [];
- $NewIndex{$Index} = 0;
- $NewBuffer{$Index} = [];
- $NewLinesPrinted{$Index} = 0;
- &DebugPrint("SearchBuffer[$Index]= $SearchBuffer{$Index}");
- &DebugPrint("NewBuffer[$Index]= $NewBuffer{$Index}");
-
- # recreate the new Action Array as follows:
- # 0) Index
- # 1) Function
- # 2) Reference to SearchPattern array
- # 3) Reference to NewPattern array
- # 4) NewLines string
-
- # remove the RE flag from the list
- $RE = shift @$ActionRef;
-
- # prepend the Index number to the front of the list
- unshift(@$ActionRef, $Index);
-
- if (!grep(/$$ActionRef[1]/, @Functions)) {
- Abort("Unknown function: $$ActionRef[1]");
- return 0;
- }
- if (!$RE && $$ActionRef[1] eq "Substitution") {
- Abort("The Substitution function requires a Regular Expression");
- return 0;
- }
-
- # Since we will be using split with a limit, we need to get rid of the
- # extra new-line
- chomp $$ActionRef[2];
-
- @SearchArray = split(/\n/, $$ActionRef[2], length($$ActionRef[2]));
- if ($$ActionRef[1] ne "EOF" && $#SearchArray == -1) {
- Abort("Cannot have an empty Search parameter");
- return 0;
- }
- # The Search parameter for Substitution is limited to a single line
- if ($$ActionRef[1] eq "Substitution" &&
- $#SearchArray) {
- Abort("Cannot have a multi-line Search parameter with Substitution:");
- &PrintArray(\@SearchArray);
- return 0;
- }
- # delimit each character if we are not expecting regular expressions
- foreach $tmp (@SearchArray) {
- $tmp = quotemeta $tmp if (!$RE);
- push(@SearchPatternArray, $tmp);
- }
- $$ActionRef[2] = \@SearchPatternArray;
-
- chomp $$ActionRef[3];
- @NewArray = split(/\n/, $$ActionRef[3],length($$ActionRef[3]));
- if ($#NewArray == -1) {
- Abort("Cannot have an empty New parameter");
- return 0;
- }
- # The Replace parameter for Substitution is limited to a single line
- if ($$ActionRef[1] eq "Substitution" &&
- $#NewArray) {
- Abort("Cannot have a multi-line Replace parameter with Substitution:");
- &PrintArray(\@NewArray);
- return 0;
- }
- # delimit each character if we are not expecting regular expressions
- foreach $tmp (@NewArray) {
- $tmp = quotemeta $tmp if (!$RE);
- push(@NewPatternArray, $tmp);
- }
- splice(@$ActionRef, 3, 0, \@NewPatternArray);
-
- # Now we have to create a new string out of the Search and Replace(New)
- # parameters if the function is Substitution. This new string is used
- # to determine whether or not we have a file which has successfully
- # been substituted.
- if ($$ActionRef[1] eq "Substitution") {
- my $search = $$ActionRef[2][0];
- my $replace = $$ActionRef[3][0];
- my $new, $tmp, $end;
- my @matches;
- my $index = 0;
- # split the search string on the opening '(' if there are any
- my (@search) = split(/\(/, $search);
- foreach $tmp (@search) {
- # Check to see if the '(' was was preceeded by a '\' which indicates
- # that a match was not being performed.
- # If so prepend the current string plus the '(', lost during the split
- # to the next string.
- if (substr($tmp, -1, 1) eq "\\") {
- $search[$index+1] = "$search[$index]($search[$index+1]";
- next;
- }
- next if (!$index++); # the first array value is before a match
- # Now we need to find the occurrence of the final ')' trying not
- # to match a '\)'. Once this is found we can push the entire string
- # that was orignally between the '()' into our matches buffer.
- my $end = $[;
- while (($end = index($tmp, ")", $end)) >= $[) {
- if (substr($tmp, $end-1, 1) eq "\\") {
- } else {
- push(@matches, substr($tmp, 0, $end));
- }
- $end++;
- }
- }
-
- # if the sequence "#" is found then the intent was to place a #
- # character in the replace portion as a comment in the string to
- # pacify the perl preprocessor. The quotes need to be stripped in the
- # ReplacementMatch string.
- $replace =~ s/"#"/#/;
-
- # Split the Replace line on the input '.' characters which are used to
- # show how to combine the replace piece of the s/// function
- my (@new) = split(/\./, $replace);
- if (!$#new) {
- # We are not expecting to have any $# replacements since there were
- # no '.' characters in the string. In this case just use the actual
- # string when trying to look for that new string.
- $ReplacementMatch{$Index} = shift @new;
- } else {
- # Go through the '.'-separated components of the string and replace
- # any occurrence of $# with the original search pattern.
- # Otherwise just save the original string.
- $index = 0;
- while ($tmp = shift @new) {
- &DebugPrint("\t\t$tmp");
- if ($tmp =~ /^\$\d+$/) {
- &DebugPrint("\tFound a match");
- $ReplacementMatch{$Index} .= $matches[$index];
- $index++;
- } else {
- $ReplacementMatch{$Index} .= $tmp;
- }
- }
- &DebugPrint("index=$index, matches = $#matches");
- if ($index != $#matches+1) {
- &Abort("Substitution does not have matching matches");
- return 0;
- }
- }
- }
-
- if ($Debug) {
- print "Index = $$ActionRef[0]\n";
- print "Function = $$ActionRef[1]\n";
- print "Search = ";
- &PrintArray($$ActionRef[2]);
- print "New = ";
- &PrintArray($$ActionRef[3]);
- print "NewLines = $$ActionRef[4]\n";
- print "ReplacementMatch = $ReplacementMatch{$Index}\n";
- print "----------------------------\n";
- }
- $Index++;
- }
-
- MAINLOOP: while (<$FH>) {
- if (!$Redo) {
- $CurrentLine++;
- $LineReferences{$CurrentLine} = 0;
- }
- $Redo = 0;
- &DebugPrint("$CurrentLine=>$_");
- $NextLoop = 0;
- chomp; # get rid of newline character
- # go through each action on this line of the file
- foreach $ActionRef (@$ActionList) {
- ($Index, $Function, $SearchPatternArrayRef, $NewPatternArrayRef,
- $NewLines) = @$ActionRef;
- # define references to asociative array values for easier use
- $NewIndexRef = \$NewIndex{$Index};
- $NewBufferRef = $NewBuffer{$Index};
- $SearchIndexRef = \$SearchIndex{$Index};
- $SearchBufferRef = $SearchBuffer{$Index};
- $NewMatchRef = \$NewMatch{$Index};
- $$NewMatchRef = 0;
- $NewLinesPrintedRef = \$NewLinesPrinted{$Index};
- $ReplacementMatchRef = \$ReplacementMatch{$Index};
-
- # if the function is a substitution and the current line matches the
- # Search pattern then try to perform the substitution and flag that
- # the action as done if successful
- if ($Function eq "Substitution" &&
- /$$SearchPatternArrayRef[$$SearchIndexRef]/) {
- &DebugPrint("\tSubstitution");
- &VerbosePrint("Substituting line in $File...");
- $Done{$Index} |= s/$$SearchPatternArrayRef[$$SearchIndexRef]/"$$NewPatternArrayRef[$$NewIndexRef]"/ee;
- }
-
- # This is a look-ahead check to see if the "New" lines will be matched
- $$NewMatchRef = 1 if (($$NewIndexRef <= $#$NewPatternArrayRef) &&
- /$$NewPatternArrayRef[$$NewIndexRef]/i);
-
- # "EOF" function has no use for the Search paramaters
- # see if the "Search" lines can be found
- if ($Function ne "EOF" &&
- ($$SearchIndexRef <= $#$SearchPatternArrayRef) &&
- /$$SearchPatternArrayRef[$$SearchIndexRef]/) {
- &DebugPrint("Search");
- # print the "New" buffer and clear the indices if we were previsouly
- # tracking the "New" lines and we no longer are
- &ResetNew(1) if $$NewIndexRef && !$$NewMatchRef;
- # see if all of the "Search" lines been found
- if ($$SearchIndexRef == $#$SearchPatternArrayRef) {
- if ($Function eq "Insert") {
- # reset the search indices and print the buffer and current line
- &ResetSearch(1);
- print $NEWFH "$_\n";
- &DebugPrint("\tSearch Printed: $_");
- } else {
- # just reset the search indices
- &ResetSearch(0);
- }
- # now that we are caught up with everything else, print the newlines
- print $NEWFH "$NewLines\n";
- &DebugPrint("\tSearch Printed: $NewLines");
- # mark that the new lines have already been printed
- $$NewLinesPrintedRef = 1 if ($$NewMatchRef && $Function ne "Insert");
- $$NewLinesPrintedRef = 1 if ($Function eq "Insert");
- &VerbosePrint ("Replacing line[s] in $File...");
- $Done{$Index} = 1; # flag that this Action is done
- } else {
- # add this line to the buffer and increment the index to the next
- # "Search" line
- &AddToBuffer($SearchBufferRef, $_);
- $$SearchIndexRef++;
- }
- # set flag so that we don't check for inconsistencies
- $NextLoop = 1;
- }
- # check to see if we already determined a "New" match
- if ($$NewMatchRef) {
- &DebugPrint("New");
- # clean the "Search" buffer if it is partial and the $NextLine was not
- # set before. If it was set, then search is still active
- &ResetSearch(1) if ($$SearchIndexRef && !$NextLoop);
- &DebugPrint("$NextLoop and $$NewLinesPrintedRef");
- # see if all of the "New" lines have been found
- if ($$NewIndexRef == $#$NewPatternArrayRef) {
- # reset the Search indices but do not print the buffer
- &ResetSearch(0);
- # print the buffered lines aw sell as the current line unless they
- # were already printed by "Search"; reset the indices
- if (!$NextLoop && !$$NewLinesPrintedRef) {
- &ResetNew(1);
- print $NEWFH "$_\n";
- &DebugPrint("\tNew printed $_");
- } else {
- # the lines were previously printed; just reset everything
- &ResetNew(0);
- }
- $Done{$Index} = 1; # flag that this Action is done
- } else {
- # add the current line to the New buffer unless this line has
- # already been printed
- &AddToBuffer($NewBufferRef, $_) if (!$$NewLinesPrintedRef);
- $$NewIndexRef++;
- }
- # set flag so that we don't check for inconsistencies
- $NextLoop = 1;
- }
-
- # If the substitution action hasn't already been successful during
- # this run and the current line matches the replacement line
- # then mark the action as done
- if (!$Done{$Index} && $Function eq "Substitution" &&
- /$$ReplacementMatchRef/) {
- &DebugPrint("\tFound the ReplacementMatch");
- $Done{$Index} = 1; # flag that this Action is done
- }
-
- # if this point is reached and the NewIndex is not at zero, then some but
- # not all of the New lines were found.
- # skip this block if Search or New already succeeded
- if (!$NextLoop && $$NewIndexRef) {
- &DebugPrint("New check");
- &ResetNew(1);
- $Redo = 1;
- redo MAINLOOP;
- }
-
- # if this point is reached and the SearchIndex is not at zero, then some
- # but not all of the Search lines were found
- # skip this block if Search or New already succeeded
- if (!$NextLoop && $$SearchIndexRef) {
- &DebugPrint("Search check");
- &ResetSearch(!$Done{$Index});
- $Redo = 1;
- redo MAINLOOP;
- }
-
- # print the new lines at the end of the file if the function is "EOF", the
- # next read on the file will be EOF and the new lines are not already
- # present at the end of the file
- if (!$NextLoop && $Function eq "EOF" && eof($FH) && !$Done{$Index}) {
- &DebugPrint("EOF");
- print $NEWFH "$_\n";
- print $NEWFH "$NewLines\n";
- &DebugPrint("\tEOF Printed: $_\n$NewLines");
- &VerbosePrint("Appending new line[s] to end of $File...");
- $Done{$Index} = 1;
- next MAINLOOP;
- }
- }
- if (!$NextLoop) {
- print $NEWFH "$_\n";
- &DebugPrint("\tPrinted: $_");
- }
- }
- close $FH;
- close $NEWFH;
-
- $Errors = grep(/0/, values %Done);
- if (!$Errors ) {
- $status = system("diff $File $File.new > /dev/null 2>&1");
- if ($status) {
- if (!rename($File, "$File.old")) {
- print "Could not rename $File to $File.old: $!";
- }
- if (!rename("$File.new", $File)) {
- print "Could not rename $File.new to $File: $!";
- } else {
- &CopyStat("$File.old", $File);
- }
- }
- else {
- &VerbosePrint ("No difference. Leaving the old $File intact");
- unlink("$File.new");
- }
- return 1;
- }
- else {
- &VerbosePrint("$Errors Action[s] did not succeed.");
- unlink("$File.new");
- return 0;
- }
-}
-
-#
-# AddToBuffer(BufferRef, Line)
-#
-# This subroutine will add a given line to a buffer
-#
-# BufferRef is a reference to a buffer
-# Line is the line to be added
-#
-
-sub AddToBuffer {
- my($BufferRef, $line) = @_;
- push(@$BufferRef, [$CurrentLine, $line]);
- $LineReferences{$CurrentLine}++;
- &DebugPrint("Adding to buffer[$BufferRef]=>$CurrentLine, $line");
- &DebugPrint("References for $CurrentLine is $LineReferences{$CurrentLine}");
-}
-
-#
-# ResetSearch(Print)
-#
-# This subroutine will reset the Search variables
-#
-# Print indicates whether or not to print the contents of the SearchBuffer
-#
-
-sub ResetSearch {
- my($print) = @_;
- my($BufferedLine);
- my($ref, $lineno);
- &DebugPrint("ResetSearch");
- if ($print) {
- # print the lines that were matched up to this point since they were not
- # printed before
- foreach $ref (@$SearchBufferRef) {
- ($lineno, $BufferedLine) = @$ref;
- &DebugPrint("References for $lineno is $LineReferences{$lineno}");
- if ($LineReferences{$lineno} == 1) {
- print $NEWFH "$BufferedLine\n";
- &DebugPrint("\tResetSearch Printed: $BufferedLine [$SearchBufferRef,$lineno]");
- } else {
- &DebugPrint("not printing [$SearchBufferRef]=>$lineno,$BufferedLine\n");
- }
- $LineReferences{$lineno}--;
- }
- }
- # reset the Search indices and buffer
- $$SearchIndexRef = 0;
- @$SearchBufferRef = ();
-}
-
-#
-# ResetNew()
-#
-# This subroutine will reset the New variables
-#
-# Print indicates whether or not to print the contents of the NewBuffer
-#
-
-sub ResetNew {
- my ($print) = @_;
- my($BufferedLine);
- my($ref, $lineno);
- &DebugPrint("ResetNew");
- if ($print) {
- # print the lines that were matched up to this point since they were not
- # printed before
- foreach $ref (@$NewBufferRef) {
- ($lineno, $BufferedLine) = @$ref;
- &DebugPrint("References for $lineno is $LineReferences{$lineno}");
- if ($LineReferences{$lineno} == 1) {
- print $NEWFH "$BufferedLine\n";
- &DebugPrint("\tResetNew Printed: $BufferedLine [$NewBufferRef,$lineno]");
- } else {
- &DebugPrint("not printing [$NewBufferRef]=>$lineno,$BufferedLine\n");
- }
- $LineReferences{$lineno}--;
- }
- }
- # reset the New indices and buffer
- $$NewIndexRef = 0;
- @$NewBufferRef = ();
-}
-
-#
-# Abort()
-#
-# This subroutine will print an abort message
-#
-
-sub Abort {
- my ($mesg) = @_;
- print "Aborting, $mesg\n";
-}
-
-#
-# VerbosePrint(Msg)
-#
-# This subroutine will print a message if the program is running in verbose
-# mode set earlier by Verbose()
-#
-# Msg is the message to print
-#
-
-sub VerbosePrint {
- my ($mesg) = @_;
- print "\t$mesg\n" if ($Verbose);
-}
-
-#
-# DebugPrint(Msg)
-#
-# This subroutine will print a message if the program is running in Debug
-# mode set earlier by Debug()
-#
-# Msg is the message to print
-#
-
-sub DebugPrint {
- my ($mesg) = @_;
- print "$mesg\n" if ($Debug);
-}
-
-#
-# PrintArray(Array)
-#
-# This subroutine will print out all of the contents of an array.
-# Primarily used in debugging.
-#
-# Array is the array to print
-#
-sub PrintArray {
- my ($arrayref) = @_;
- my ($element);
- foreach $element (@$arrayref) {
- print "$element\n";
- }
-}
-
-#
-# CopyStat(SrcFile, DstFile)
-#
-# This subroutine copies the mode, uid and gid from SrcFile to DstFile
-#
-sub CopyStat {
- my ($user, $group, $srcfile, $destfile, $mode, $rc, @statinfo);
- $srcfile = shift @_;
- $destfile = shift @_;
- @statinfo = stat($srcfile);
- $mode = $statinfo[2];
- $user = $statinfo[4];
- $group = $statinfo[5];
- &VerbosePrint("Copying owner,group,mode of \"$srcfile\" to \"$destfile\"");
- $rc = chown $user, $group, $destfile;
- &VerbosePrint("Could not change mode bits of", $destfile) if (!$rc);
- $rc = chmod $mode, $destfile;
- &VerbosePrint("Could not change mode bits of", $destfile) if (!$rc);
-}
-
-1;
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,
}
}
-#if defined(USING_HEIMDAL) || defined(HAVE_KRB5_PROMPT_TYPE)
-static int
-klog_is_pass_prompt(int index, krb5_context context, krb5_prompt prompts[])
-{
- switch (prompts[index].type) {
- case KRB5_PROMPT_TYPE_PASSWORD:
- case KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN:
- return 1;
- default:
- return 0;
- }
-}
-#elif defined(HAVE_KRB5_GET_PROMPT_TYPES)
-static int
-klog_is_pass_prompt(int index, krb5_context context, krb5_prompt prompts[])
-{
- /* this isn't thread-safe or anything obviously; it just should be good
- * enough to work with klog */
- static krb5_prompt_type *types = NULL;
- if (index == 0) {
- types = NULL;
- }
- if (!types) {
- types = krb5_get_prompt_types(context);
- }
- if (!types) {
- return 0;
- }
- switch (types[index]) {
- case KRB5_PROMPT_TYPE_PASSWORD:
- case KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN:
- return 1;
- default:
- return 0;
- }
-}
-#else
-static int
-klog_is_pass_prompt(int index, krb5_context context, krb5_prompt prompts[])
-{
- /* AIX 5.3 doesn't have krb5_get_prompt_types. Neither does HP-UX, which
- * also doesn't even define KRB5_PROMPT_TYPE_PASSWORD &co. We have no way
- * of determining the the prompt type, so just assume it's a password */
- return 1;
-}
-#endif
-
-/* save and reuse password. This is necessary to make
- * "direct to service" authentication work with most
- * flavors of kerberos, when the afs principal has no instance.
- */
-struct kp_arg {
- char **pp, *pstore;
- size_t allocated;
-};
-krb5_error_code
-klog_prompter(krb5_context context,
- void *a,
- const char *name,
- const char *banner,
- int num_prompts,
- krb5_prompt prompts[])
-{
- krb5_error_code code;
- int i;
- struct kp_arg *kparg = (struct kp_arg *) a;
- size_t length;
-
- code = krb5_prompter_posix(context, a, name, banner, num_prompts, prompts);
- if (code) return code;
- for (i = 0; i < num_prompts; ++i) {
- if (klog_is_pass_prompt(i, context, prompts)) {
- length = prompts[i].reply->length;
- if (length > kparg->allocated - 1)
- length = kparg->allocated - 1;
- memcpy(kparg->pstore, prompts[i].reply->data, length);
- kparg->pstore[length] = 0;
- *kparg->pp = kparg->pstore;
- }
- }
- return 0;
-}
-
static int
CommandProc(struct cmd_syndesc *as, void *arock)
{
int authtype;
#endif
krb5_data enc_part[1];
- krb5_prompter_fct pf = NULL;
char *pass = 0;
- void *pa = 0;
- struct kp_arg klog_arg[1];
char passwd[BUFSIZ];
struct afsconf_cell cellconfig[1];
for (i = 1; i < zero_argc; i++)
memset(zero_argv[i], 0, strlen(zero_argv[i]));
zero_argc = 0;
- memset(klog_arg, 0, sizeof *klog_arg);
/* first determine quiet flag based on -silent switch */
Silent = (as->parms[aSILENT].items ? 1 : 0);
pass = passwd;
}
- /* Get the password if it wasn't provided. */
- if (!pass) {
- if (Pipe) {
- strncpy(passwd, getpipepass(), sizeof(passwd));
- pass = passwd;
- } else {
- pf = klog_prompter;
- pa = klog_arg;
- }
+ /* Get the password from stdin if it wasn't provided. */
+ if (!pass && Pipe) {
+ strncpy(passwd, getpipepass(), sizeof(passwd));
+ pass = passwd;
}
service = 0;
#endif
snprintf (service_temp, sizeof service_temp, "afs/%s", cellconfig->name);
- klog_arg->pp = &pass;
- klog_arg->pstore = passwd;
- klog_arg->allocated = sizeof(passwd);
/* XXX should allow k5 to prompt in most cases -- what about expired pw?*/
#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC
code = krb5_get_init_creds_opt_alloc(k5context, &gic_opts);
incred,
princ,
pass,
- pf, /* prompter */
- pa, /* data */
- 0, /* start_time */
- 0, /* in_tkt_service */
+ krb5_prompter_posix, /* prompter */
+ NULL, /* data */
+ 0, /* start_time */
+ 0, /* in_tkt_service */
gic_opts);
if (code != KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN)
break;
* 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);
}
audit_PrintStats
osi_audit
osi_auditU
+osi_audit_close
+osi_audit_cmd_Options
osi_audit_file
osi_audit_init
osi_audit_interface
+osi_audit_open
osi_audit_set_user_check
_afsconf_GetRxkadKrb5Key, NULL);
#ifdef AFS_RXGK_ENV
(*classes)[RX_SECIDX_GK] =
- rxgk_NewServerSecurityObject(rock, afsconf_GetRXGKKey);
+ rxgk_NewServerSecurityObject(dir, afsconf_GetRXGKKey);
#endif
}
}
#endif /* windows */
-int
-afsconf_GetCellInfo(struct afsconf_dir *adir, char *acellName, char *aservice,
- struct afsconf_cell *acellInfo)
+/* flags for _GetCellInfo */
+#define AFSCONF_GETCELL_EMPTYOK (0x1) /** it's okay to return 'empty' cells
+ * (that is, cells without any
+ * dbservers) */
+
+static int
+_GetCellInfo(struct afsconf_dir *adir, char *acellName, char *aservice,
+ struct afsconf_cell *acellInfo, afs_uint32 flags)
{
struct afsconf_entry *tce;
struct afsconf_aliasentry *tcae;
int cnLen;
int ambig;
char tbuffer[64];
+ int emptyok = 0;
+
+ if ((flags & AFSCONF_GETCELL_EMPTYOK)) {
+ emptyok = 1;
+ }
LOCK_GLOBAL_MUTEX;
if (adir)
bestce = tce;
}
}
- if (!ambig && bestce && bestce->cellInfo.numServers) {
+ if (!ambig && bestce && (bestce->cellInfo.numServers || emptyok)) {
*acellInfo = bestce->cellInfo; /* structure assignment */
if (aservice) {
tservice = afsconf_FindService(aservice);
acellInfo->clone[i] = clone[i];
}
acellInfo->numServers = numServers;
- acellInfo->flags |= AFSCONF_CELL_FLAG_DNS_QUERIED;
+ if (numServers) {
+ acellInfo->flags |= AFSCONF_CELL_FLAG_DNS_QUERIED;
+ }
}
UNLOCK_GLOBAL_MUTEX;
return 0;
}
/**
+ * Get info about a cell.
+ *
+ * @param[in] adir afsconf object.
+ * @param[in] acellName name of the cell to get. a cell name abbreviation can
+ * be given if it's unambiguous (e.g. "cell" can be given
+ * for "cell.example.com" if no other cells begin with
+ * "cell").
+ * @param[in] aservice name of the service in the cell, as accepted by
+ * afsconf_FindService. if NULL is given: for local
+ * lookups, no port information will be returned; for DNS
+ * lookups, we'll default to "afs3-vlserver".
+ * @param[out] acellInfo info for the requested cell and service
+ *
+ * @return afsconf error codes
+ */
+int
+afsconf_GetCellInfo(struct afsconf_dir *adir, char *acellName, char *aservice,
+ struct afsconf_cell *acellInfo)
+{
+ return _GetCellInfo(adir, acellName, aservice, acellInfo, 0);
+}
+
+/**
+ * Get a cell's name.
+ *
+ * This is similar to afsconf_GetCellInfo, but doesn't actually retrieve the
+ * info of the specified cell (beyond it's name). This can be useful to verify
+ * that a cell name is valid, or to canonicalize a possibly-abbreviated cell
+ * name. Unlike afsconf_GetCellInfo, this call can avoid DNS lookups if the
+ * cell name is specified in the local config, but the cell's servers are not.
+ *
+ * @param[in] adir afsconf object.
+ * @param[in] acellName name of the cell to get. a cell name abbreviation can
+ * be given if it's unambiguous (see afsconf_GetCellInfo).
+ * @param[out] buf on success, the cell's name is written to this buffer.
+ * @param[in] buf_size size of 'buf'.
+ *
+ * @return afsconf error codes
+ * @retval AFSCONF_FAILURE buf_size is too small to fit the cell's name.
+ */
+int
+afsconf_GetCellName(struct afsconf_dir *adir, char *acellName, char *buf,
+ size_t buf_size)
+{
+ int code;
+ struct afsconf_cell info;
+ code = _GetCellInfo(adir, acellName, NULL, &info, AFSCONF_GETCELL_EMPTYOK);
+ if (code) {
+ return code;
+ }
+ if (strlcpy(buf, info.name, buf_size) >= buf_size) {
+ return AFSCONF_FAILURE;
+ }
+ return 0;
+}
+
+/**
* Get the current localcell name.
*
* Internal function to get a pointer to the local cell name.
extern int afsconf_GetCellInfo(struct afsconf_dir *adir, char *acellName,
char *aservice,
struct afsconf_cell *acellInfo);
+extern int afsconf_GetCellName(struct afsconf_dir *adir, char *acellName,
+ char *buf, size_t buf_size);
extern int afsconf_GetLocalCell(struct afsconf_dir *adir,
char *aname, afs_int32 alen);
extern int afsconf_Close(struct afsconf_dir *adir);
#include <afsconfig.h>
#include <afs/param.h>
-#include <roken.h>
-
#include <afs/stds.h>
#include <afs/opr.h>
#include <afs/pthread_glock.h>
#endif
#if defined(UKERNEL)
-#include "afsincludes.h"
+# include "afsincludes.h"
+# include <afs_usrops.h>
+#else
+# include <roken.h>
#endif
#ifdef AFS_AIX_ENV
#include <afs/sys_prototypes.h>
#endif
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX_ENV)
#include <sys/syscall.h>
#if defined(SYS_keyctl)
/* Open code this value to avoid a dependency on keyutils */
#endif /* AFS_KERBEROS_ENV */
#if defined(UKERNEL)
-#define PIOCTL(A,B,C,D) (errno = (call_syscall(AFSCALL_PIOCTL,A,B,C,D)), errno?-1:0)
+#define PIOCTL(A,B,C,D) (errno = (call_syscall(AFSCALL_PIOCTL,A,B,(long)C,D,0)), errno?-1:0)
#else
#define PIOCTL pioctl
#endif
#endif /* NO_AFS_CLIENT */
if (code)
return KTC_PIOCTLFAIL;
-#if defined(AFS_LINUX26_ENV) && defined(SYS_keyctl)
+#if defined(AFS_LINUX_ENV) && defined(SYS_keyctl)
else
/*
* If we're using keyring based PAGs and the SESSION_TO_PARENT keyctl
if (code)
return KTC_PIOCTLFAIL;
-#if defined(AFS_LINUX26_ENV) && defined(SYS_keyctl)
+#if defined(AFS_LINUX_ENV) && defined(SYS_keyctl)
else
/*
* If we're using keyring based PAGs and the SESSION_TO_PARENT keyctl
+_afsconf_Touch
+afsconf_AddIdentity
+afsconf_AddKey
afsconf_AddTypedKey
+afsconf_AddUser
afsconf_BuildServerSecurityObjects
afsconf_BuildServerSecurityObjects_int
afsconf_CellAliasApply
afsconf_ClientAuthToken
afsconf_Close
afsconf_CountKeys
+afsconf_DeleteIdentity
afsconf_DeleteKey
+afsconf_DeleteKeyBySubType
+afsconf_DeleteKeyByType
+afsconf_DeleteUser
+afsconf_FindService
afsconf_GetAfsdbInfo
afsconf_GetAllKeys
afsconf_GetCellInfo
+afsconf_GetCellName
afsconf_GetExtendedCellInfo
afsconf_GetKey
+afsconf_GetKeyByTypes
+afsconf_GetKeys
+afsconf_GetKeysByType
afsconf_GetLatestKey
+afsconf_GetLatestKeysByType
+afsconf_GetLatestKeyByTypes
afsconf_GetLatestRXGKKey
afsconf_GetLocalCell
afsconf_GetNoAuthFlag
+afsconf_GetNthIdentity
+afsconf_GetNthUser
afsconf_GetRXGKKey
afsconf_IsLocalRealmMatch
+afsconf_IsSuperIdentity
afsconf_Open
afsconf_ParseNetFiles
afsconf_PickClientSecObj
+afsconf_PutTypedKeyList
afsconf_SetLocalRealm
afsconf_SetNoAuthFlag
afsconf_SetSecurityFlags
+afsconf_SuperIdentity
afsconf_SuperUser
afsconf_UpToDate
afsconf_typedKey_new
}
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;
}
FILE *fout;
struct bnode *tb = tp->bnode;
-#if defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI51_ENV)
+#if defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
setsid();
#elif defined(AFS_DARWIN90_ENV)
setpgid(0, 0);
-#elif defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV)
+#elif defined(AFS_LINUX_ENV) || defined(AFS_AIX_ENV)
setpgrp();
#else
setpgrp(0, 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 * );
static char *
DateOf(time_t atime)
{
+ static char *bad_time = "BAD TIME";
static char tbuffer[30];
char *tp;
tp = ctime(&atime);
- if (tp) {
- strlcpy(tbuffer, tp, sizeof(tbuffer));
- tbuffer[24] = 0; /* get rid of new line */
- } else
- strcpy(tbuffer, "BAD TIME");
+ if (tp == NULL)
+ return bad_time;
+ if (strlcpy(tbuffer, tp, sizeof(tbuffer)) >= sizeof(tbuffer))
+ return bad_time;
+ tp = strchr(tbuffer, '\n');
+ if (tp != NULL)
+ *tp = '\0'; /* Trim new line. */
return tbuffer;
}
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 0;
}
-/* take a name (e.g. foo/bar, and a dir e.g. /usr/afs/bin, and construct
- * /usr/afs/bin/bar */
+/**
+ * Construct a destination path.
+ *
+ * Take a name (e.g., foo/bar) and a directory (e.g., /usr/afs/bin), and
+ * construct a destination path (e.g., /usr/afs/bin/bar).
+ *
+ * @param[in] anam filename
+ * @param[in] adir directory path
+ * @param[out] apath constructed filepath output. The caller is resposible
+ * for freeing 'apath'.
+ */
static int
-ComputeDestDir(char *aname, char *adir, char *aresult, afs_int32 alen)
+ComputeDestDir(const char *aname, const char *adir, char **apath)
{
char *tp;
- strcpy(aresult, adir);
tp = strrchr(aname, '/');
- if (!tp) {
+ if (tp == NULL) {
/* no '/' in name */
- strcat(aresult, "/");
- strcat(aresult, aname);
+ if (asprintf(apath, "%s/%s", adir, aname) < 0)
+ return ENOMEM;
} else {
/* tp points at the / character */
- strcat(aresult, tp);
+ if (asprintf(apath, "%s/%s", adir, tp + 1) < 0)
+ return ENOMEM;
}
return 0;
}
GetDate(struct cmd_syndesc *as, void *arock)
{
afs_int32 code;
- char tbuffer[256];
- char destDir[256];
+ const char *destDir;
afs_int32 time, bakTime, oldTime;
struct rx_connection *tconn;
struct cmd_item *ti;
/* compute dest dir or file; default MUST be canonical form of dir path */
if (as->parms[2].items)
- strcpy(destDir, as->parms[2].items->data);
+ destDir = as->parms[2].items->data;
else
- strcpy(destDir, AFSDIR_CANONICAL_SERVER_BIN_DIRPATH);
+ destDir = AFSDIR_CANONICAL_SERVER_BIN_DIRPATH;
for (ti = as->parms[1].items; ti; ti = ti->next) {
- /* check date for each file */
- ComputeDestDir(ti->data, destDir, tbuffer, sizeof(tbuffer));
- code = BOZO_GetDates(tconn, tbuffer, &time, &bakTime, &oldTime);
+ char *path = NULL;
+
+ /* Check date for each file. */
+ code = ComputeDestDir(ti->data, destDir, &path);
+ if (code != 0) {
+ fprintf(stderr, "bos: failed to format destination path for file %s (%s)\n",
+ ti->data, em(code));
+ return 1;
+ }
+ code = BOZO_GetDates(tconn, path, &time, &bakTime, &oldTime);
if (code) {
fprintf(stderr, "bos: failed to check date on %s (%s)\n", ti->data,
em(code));
+ free(path);
return 1;
} else {
- printf("File %s ", tbuffer);
+ printf("File %s ", path);
if (time == 0)
printf("does not exist, ");
else
printf(".OLD file dated %s.", DateOf(oldTime));
printf("\n");
}
+ free(path);
}
return 0;
}
UnInstall(struct cmd_syndesc *as, void *arock)
{
afs_int32 code;
- char tbuffer[256];
- char destDir[256];
+ const char *destDir;
struct cmd_item *ti;
struct rx_connection *tconn;
/* compute dest dir or file; default MUST be canonical form of dir path */
if (as->parms[2].items)
- strcpy(destDir, as->parms[2].items->data);
+ destDir = as->parms[2].items->data;
else
- strcpy(destDir, AFSDIR_CANONICAL_SERVER_BIN_DIRPATH);
+ destDir = AFSDIR_CANONICAL_SERVER_BIN_DIRPATH;
for (ti = as->parms[1].items; ti; ti = ti->next) {
- /* uninstall each file */
- ComputeDestDir(ti->data, destDir, tbuffer, sizeof(tbuffer));
- code = BOZO_UnInstall(tconn, tbuffer);
+ char *path = NULL;
+
+ /* Uninstall each file. */
+ code = ComputeDestDir(ti->data, destDir, &path);
+ if (code) {
+ fprintf(stderr, "bos: failed to format destination path for file %s (%s)\n",
+ ti->data, em(code));
+ return 1;
+ }
+ code = BOZO_UnInstall(tconn, path);
if (code) {
fprintf(stderr, "bos: failed to uninstall %s (%s)\n", ti->data, em(code));
+ free(path);
return 1;
- } else
+ } else {
printf("bos: uninstalled file %s\n", ti->data);
+ }
+ free(path);
}
return 0;
}
static afs_int32
GetServerGoal(struct rx_connection *aconn, char *aname)
{
- char buffer[500];
- char *tp;
+ char *itype = NULL;
afs_int32 code;
struct bozo_status istatus;
- tp = buffer;
- code = BOZO_GetInstanceInfo(aconn, aname, &tp, &istatus);
+ code = BOZO_GetInstanceInfo(aconn, aname, &itype, &istatus);
+ xdr_free((xdrproc_t)xdr_string, &itype);
if (code) {
fprintf(stderr, "bos: failed to get instance info for '%s' (%s)\n", aname,
em(code));
afs_int32 code;
struct cmd_item *ti;
struct stat tstat;
- char tbuffer[256];
int fd;
struct rx_call *tcall;
- char destDir[256];
+ const char *destDir;
tconn = GetConn(as, 1);
if (!as->parms[1].items) {
/* compute dest dir or file; default MUST be canonical form of dir path */
if (as->parms[2].items)
- strcpy(destDir, as->parms[2].items->data);
+ destDir = as->parms[2].items->data;
else
- strcpy(destDir, AFSDIR_CANONICAL_SERVER_BIN_DIRPATH);
+ destDir = AFSDIR_CANONICAL_SERVER_BIN_DIRPATH;
for (ti = as->parms[1].items; ti; ti = ti->next) {
- /* install each file */
+ char *path = NULL;
+
+ /* Install each file. */
fd = open(ti->data, O_RDONLY);
if (fd < 0) {
/* better to quit on error than continue for install command */
if (code) {
fprintf(stderr, "bos: failed to stat file %s, errno is %d\n", ti->data,
errno);
+ close(fd);
return 1;
}
/* compute destination dir */
- ComputeDestDir(ti->data, destDir, tbuffer, sizeof(tbuffer));
+ code = ComputeDestDir(ti->data, destDir, &path);
+ if (code != 0) {
+ fprintf(stderr, "bos: failed to format destination path for file %s (%s)\n",
+ ti->data, em(code));
+ close(fd);
+ return 1;
+ }
tcall = rx_NewCall(tconn);
code =
- StartBOZO_Install(tcall, tbuffer, tstat.st_size,
+ StartBOZO_Install(tcall, path, tstat.st_size,
(afs_int32) tstat.st_mode, tstat.st_mtime);
if (code == 0) {
code = CopyBytes(fd, tcall);
}
code = rx_EndCall(tcall, code);
+ close(fd);
+ free(path);
if (code) {
fprintf(stderr, "bos: failed to install %s (%s)\n", ti->data, em(code));
return 1;
struct rx_connection *tconn;
afs_int32 code;
struct cmd_item *ti;
- char name[MAXHOSTCHARS];
+ char *name;
tconn = GetConn(as, 1);
for (ti = as->parms[1].items; ti; ti = ti->next) {
if (as->parms[2].items) {
- if (strlen(ti->data) > MAXHOSTCHARS - 3) {
- fprintf(stderr, "bos: host name too long\n");
- return E2BIG;
+ code = asprintf(&name, "[%s]", ti->data);
+ if (code < 0) {
+ code = ENOMEM;
+ } else {
+ code = BOZO_AddCellHost(tconn, name);
+ free(name);
}
- name[0] = '[';
- strcpy(&name[1], ti->data);
- strcat((char *)&name, "]");
- code = BOZO_AddCellHost(tconn, name);
} else
code = BOZO_AddCellHost(tconn, ti->data);
if (code)
{
struct rx_connection *tconn;
afs_int32 code;
- char tbuffer[256];
- char *tp;
+ char *cellname = NULL;
+ char *hostname = NULL;
afs_int32 i;
- tp = tbuffer;
tconn = GetConn(as, 0);
- code = BOZO_GetCellName(tconn, &tp);
+ code = BOZO_GetCellName(tconn, &cellname);
if (code) {
fprintf(stderr, "bos: failed to get cell name (%s)\n", em(code));
exit(1);
}
- printf("Cell name is %s\n", tbuffer);
+ printf("Cell name is %s\n", cellname);
for (i = 0;; i++) {
- code = BOZO_GetCellHost(tconn, i, &tp);
+ xdr_free((xdrproc_t)xdr_string, &hostname);
+ code = BOZO_GetCellHost(tconn, i, &hostname);
if (code == BZDOM)
break;
if (code != 0) {
fprintf(stderr, "bos: failed to get cell host %d (%s)\n", i, em(code));
exit(1);
}
- printf(" Host %d is %s\n", i + 1, tbuffer);
+ printf(" Host %d is %s\n", i + 1, hostname);
}
+
+ xdr_free((xdrproc_t)xdr_string, &cellname);
+ xdr_free((xdrproc_t)xdr_string, &hostname);
return 0;
}
temp = atoi(as->parms[2].items->data);
if (temp == 999) {
/* bcrypt key */
-/*
- strcpy((char *)&tkey, as->parms[1].items->data);
-*/
- strcpy((char *)&tkey, buf);
+ if (strlen(buf) > sizeof(tkey)) {
+ fprintf(stderr, "Key data too long for bcrypt key.\n");
+ exit(1);
+ }
+ strncpy((char *)&tkey, buf, sizeof(tkey));
} else { /* kerberos key */
char *tcell;
if (as->parms[ADDPARMOFFSET].items) {
struct rx_connection *tconn;
int i;
afs_int32 code;
- char tbuffer[256];
- char *tp;
+ char *name = NULL;
int lastNL, printGreeting;
tconn = GetConn(as, 0);
lastNL = 0;
printGreeting = 1;
for (i = 0;; i++) {
- tp = tbuffer;
- code = BOZO_ListSUsers(tconn, i, &tp);
+ xdr_free((xdrproc_t)xdr_string, &name);
+ code = BOZO_ListSUsers(tconn, i, &name);
if (code)
break;
if (printGreeting) {
printGreeting = 0; /* delay until after first call succeeds */
printf("SUsers are: ");
}
- printf("%s ", tbuffer);
+ printf("%s ", name);
if ((i % NPERLINE) == NPERLINE - 1) {
printf("\n");
lastNL = 1;
if (code != 1) {
/* a real error code, instead of scanned past end */
fprintf(stderr, "bos: failed to retrieve super-user list (%s)\n", em(code));
- return code;
+ goto done;
}
if (lastNL == 0)
printf("\n");
- return 0;
+ code = 0;
+
+ done:
+ xdr_free((xdrproc_t)xdr_string, &name);
+ return code;
}
static int
struct rx_connection *tconn;
afs_int32 code;
int i;
- char ibuffer[BOZO_BSSIZE];
- char *tp;
+ char *iname = NULL;
int int32p;
/* int32p==1 is obsolete, smaller, printout */
tconn = GetConn(as, 0);
for (i = 0;; i++) {
/* for each instance */
- tp = ibuffer;
- code = BOZO_EnumerateInstance(tconn, i, &tp);
+ xdr_free((xdrproc_t)xdr_string, &iname);
+ code = BOZO_EnumerateInstance(tconn, i, &iname);
if (code == BZDOM)
break;
if (code) {
em(code));
break;
}
- DoStat(ibuffer, tconn, int32p, (i == 0)); /* print status line */
+ DoStat(iname, tconn, int32p, (i == 0)); /* print status line */
}
+
+ xdr_free((xdrproc_t)xdr_string, &iname);
return 0;
}
fprintf(stderr, "bos: internal error parsing partition ID '%s'\n", aparm1);
return EINVAL;
}
- strcpy(partName, tp);
+ if (strlcpy(partName, tp, sizeof(partName)) >= sizeof(partName)) {
+ fprintf(stderr, "bos: partName buffer too small for partition ID '%s'\n", aparm1);
+ return EINVAL;
+ }
} else
partName[0] = 0;
if ((strlen(tbuffer) + 9 + strlen(partName) + 1 + strlen(aparm2) +
1) > BOZO_BSSIZE) {
fprintf(stderr, "bos: command line too big\n");
- return (E2BIG);
+ code = E2BIG;
+ goto done;
}
strcat(tbuffer, " -client ");
if ((strlen(tbuffer) + 1 + strlen(partName) + 1 + strlen(aparm2) +
1) > BOZO_BSSIZE) {
fprintf(stderr, "bos: command line too big\n");
- return (E2BIG);
+ code = E2BIG;
+ goto done;
}
strcat(tbuffer, " ");
strncpy(tbuffer, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH, BOZO_BSSIZE);
if ((strlen(tbuffer) + 4 + strlen(partName) + 1) > BOZO_BSSIZE) {
fprintf(stderr, "bos: command line too big\n");
- return (E2BIG);
+ code = E2BIG;
+ goto done;
}
strcat(tbuffer, " -force ");
strcat(tbuffer, partName);
if (parallel != NULL) {
if ((strlen(tbuffer) + 11 + strlen(parallel) + 1) > BOZO_BSSIZE) {
fprintf(stderr, "bos: command line too big\n");
- return (E2BIG);
+ code = E2BIG;
+ goto done;
}
strcat(tbuffer, " -parallel ");
strcat(tbuffer, parallel);
if (atmpDir != NULL) {
if ((strlen(tbuffer) + 9 + strlen(atmpDir) + 1) > BOZO_BSSIZE) {
fprintf(stderr, "bos: command line too big\n");
- return (E2BIG);
+ code = E2BIG;
+ goto done;
}
strcat(tbuffer, " -tmpdir ");
strcat(tbuffer, atmpDir);
if (orphans != NULL) {
if ((strlen(tbuffer) + 10 + strlen(orphans) + 1) > BOZO_BSSIZE) {
fprintf(stderr, "bos: command line too big\n");
- return (E2BIG);
+ code = E2BIG;
+ goto done;
}
strcat(tbuffer, " -orphans ");
strcat(tbuffer, orphans);
if (dodirs) {
if (strlen(tbuffer) + 14 > BOZO_BSSIZE) {
fprintf(stderr, "bos: command line too big\n");
- return (E2BIG);
+ code = E2BIG;
+ goto done;
}
strcat(tbuffer, " -salvagedirs");
}
/* now wait for bnode to disappear */
count = 0;
while (1) {
+ char *itype = NULL;
IOMGR_Sleep(1);
- tp = tbuffer;
- code = BOZO_GetInstanceInfo(aconn, "salvage-tmp", &tp, &istatus);
+ code = BOZO_GetInstanceInfo(aconn, "salvage-tmp", &itype, &istatus);
+ xdr_free((xdrproc_t)xdr_string, &itype);
if (code)
break;
if ((++count % 5) == 0)
static int
IsDAFS(struct rx_connection *aconn)
{
- char buffer[BOZO_BSSIZE];
- char *tp;
+ char *itype = NULL;
struct bozo_status istatus;
afs_int32 code;
- tp = &buffer[0];
-
- code = BOZO_GetInstanceInfo(aconn, "dafs", &tp, &istatus);
+ code = BOZO_GetInstanceInfo(aconn, "dafs", &itype, &istatus);
+ xdr_free((xdrproc_t)xdr_string, &itype);
if (code) {
/* no dafs bnode; cannot be dafs */
return 0;
}
/* dafs bnode exists but is not running; keep checking */
- code = BOZO_GetInstanceInfo(aconn, "fs", &tp, &istatus);
+ code = BOZO_GetInstanceInfo(aconn, "fs", &itype, &istatus);
+ xdr_free((xdrproc_t)xdr_string, &itype);
if (code) {
/* no fs bnode; must be dafs */
return 1;
struct rx_connection *tconn;
afs_int32 code, rc;
char *outName;
- char tname[BOZO_BSSIZE];
+ char *volume_name = NULL;
afs_int32 newID;
extern struct ubik_client *cstruct;
afs_int32 curGoal, showlog = 0, dafs = 0;
as->parms[2].items->data);
return -1;
}
- sprintf(tname, "%u", newID);
+ if (asprintf(&volume_name, "%u", newID) < 0) {
+ fprintf(stderr, "bos: out of memory\n");
+ return -1;
+ }
} else {
fprintf
(stderr, "bos: can't initialize volume system client (code %d), trying anyway.\n",
code);
- strncpy(tname, as->parms[2].items->data, sizeof(tname));
+ volume_name = strdup(as->parms[2].items->data);
+ if (volume_name == NULL) {
+ fprintf(stderr, "bos: out of memory\n");
+ return -1;
+ }
+
}
if (volutil_GetPartitionID(as->parms[1].items->data) < 0) {
/* can't parse volume ID, so complain before shutting down
*/
fprintf(stderr, "bos: can't interpret %s as partition ID.\n",
as->parms[1].items->data);
+ free(volume_name);
return -1;
}
printf("Starting salvage.\n");
- rc = DoSalvage(tconn, as->parms[1].items->data, tname, outName,
+ rc = DoSalvage(tconn, as->parms[1].items->data, volume_name, outName,
showlog, parallel, tmpDir, orphans, dafs, 0);
+ free(volume_name);
if (rc)
return rc;
}
IN int firstTime) /* true iff first instance in cmd */
{
afs_int32 temp;
- char buffer[500];
afs_int32 code;
afs_int32 i;
struct bozo_status istatus;
- char *tp;
- char *is1, *is2, *is3, *is4; /* instance strings */
-
- tp = buffer;
- code = BOZO_GetInstanceInfo(aconn, aname, &tp, &istatus);
+ char *itype = NULL;
+ char *is1 = NULL;
+ char *is2 = NULL;
+ char *is3 = NULL;
+ char *is4 = NULL;
+ char *desc = NULL;
+ char *parm = NULL;
+ char *notifier_parm = NULL;
+
+ code = BOZO_GetInstanceInfo(aconn, aname, &itype, &istatus);
if (code) {
fprintf(stderr, "bos: failed to get instance info for '%s' (%s)\n", aname,
em(code));
- return -1;
+ goto done;
}
if (firstTime && aint32p && (istatus.flags & BOZO_BADDIRACCESS))
printf
("Bosserver reports inappropriate access on server directories\n");
printf("Instance %s, ", aname);
if (aint32p)
- printf("(type is %s) ", buffer);
+ printf("(type is %s) ", itype);
if (istatus.fileGoal == istatus.goal) {
if (!istatus.goal)
printf("disabled, ");
if (istatus.flags & BOZO_HASCORE)
printf("has core file, ");
- tp = buffer;
- code = BOZO_GetStatus(aconn, aname, &temp, &tp);
+ code = BOZO_GetStatus(aconn, aname, &temp, &desc);
if (code)
fprintf(stderr, "bos: failed to get status for instance '%s' (%s)\n", aname,
em(code));
printf("starting up.\n");
else if (temp == BSTAT_SHUTTINGDOWN)
printf("shutting down.\n");
- if (buffer[0] != 0) {
- printf(" Auxiliary status is: %s.\n", buffer);
+ if (desc[0] != '\0') {
+ printf(" Auxiliary status is: %s.\n", desc);
}
}
/* are we done yet? */
- if (!aint32p)
- return 0;
+ if (!aint32p) {
+ code = 0;
+ goto done;
+ }
if (istatus.procStartTime)
printf(" Process last started at %s (%d proc starts)\n",
printf(" Last exit at %s\n", DateOf(istatus.lastAnyExit));
}
if (istatus.lastErrorExit) {
- is1 = is2 = is3 = is4 = NULL;
printf(" Last error exit at %s, ", DateOf(istatus.lastErrorExit));
code = BOZO_GetInstanceStrings(aconn, aname, &is1, &is2, &is3, &is4);
/* don't complain about failing call, since could simply mean
/* non-null instance string */
printf("by %s, ", is1);
}
- free(is1);
- free(is2);
- free(is3);
- free(is4);
}
if (istatus.errorSignal) {
if (istatus.errorSignal == SIGTERM)
if (aint32p > 1) {
/* try to display all the parms */
for (i = 0;; i++) {
- tp = buffer;
- code = BOZO_GetInstanceParm(aconn, aname, i, &tp);
+ xdr_free((xdrproc_t)xdr_string, &parm);
+ code = BOZO_GetInstanceParm(aconn, aname, i, &parm);
if (code)
break;
- printf(" Command %d is '%s'\n", i + 1, buffer);
+ printf(" Command %d is '%s'\n", i + 1, parm);
}
- tp = buffer;
- code = BOZO_GetInstanceParm(aconn, aname, 999, &tp);
+ code = BOZO_GetInstanceParm(aconn, aname, 999, ¬ifier_parm);
if (!code) {
/* Any type of failure is treated as not having a notifier program */
- printf(" Notifier is '%s'\n", buffer);
+ printf(" Notifier is '%s'\n", notifier_parm);
}
printf("\n");
}
- return 0;
+ code = 0;
+
+ done:
+ xdr_free((xdrproc_t)xdr_string, &itype);
+ xdr_free((xdrproc_t)xdr_string, &is1);
+ xdr_free((xdrproc_t)xdr_string, &is2);
+ xdr_free((xdrproc_t)xdr_string, &is3);
+ xdr_free((xdrproc_t)xdr_string, &is4);
+ xdr_free((xdrproc_t)xdr_string, &desc);
+ xdr_free((xdrproc_t)xdr_string, &parm);
+ xdr_free((xdrproc_t)xdr_string, ¬ifier_parm);
+ return code;
}
static int
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;
}
char tname[MAXCELLCHARS];
code = afsconf_GetLocalCell(bozo_confdir, tname, sizeof(tname));
- if (code) {
- /* must set output parameters even if aborting */
- *aname = malloc(1);
- **aname = 0;
- } else {
+ if (code == 0) {
*aname = strdup(tname);
+ if (*aname == NULL)
+ 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);
tdir = strdup(adir);
if (!tdir) {
- return ENOMEM;
+ error = ENOMEM;
+ goto done;
}
/* strip trailing slashes */
len = strlen(tdir);
if (!len) {
- return 0;
+ goto done;
}
p = tdir + len - 1;
while (p != tdir && *p == PATH_DELIM) {
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;
FILE *tfile;
char tbuffer[BOZO_BSSIZE];
char *tp;
- char *instp, *typep, *notifier, *notp;
+ char *instp = NULL, *typep = NULL, *notifier = NULL, *notp = NULL;
afs_int32 code;
afs_int32 ktmask, ktday, kthour, ktmin, ktsec;
afs_int32 i, goal;
if (!tfile)
return 0; /* -1 */
instp = malloc(BOZO_BSSIZE);
+ if (!instp) {
+ code = ENOMEM;
+ goto fail;
+ }
typep = malloc(BOZO_BSSIZE);
+ if (!typep) {
+ code = ENOMEM;
+ goto fail;
+ }
notp = malloc(BOZO_BSSIZE);
+ if (!notp) {
+ code = ENOMEM;
+ goto fail;
+ }
while (1) {
/* ok, read lines giving parms and such from the file */
tp = fgets(tbuffer, sizeof(tbuffer), tfile);
code = -1;
goto fail; /* no "parm " either */
}
- if (!parms[i]) /* make sure there's space */
+ if (!parms[i]) { /* make sure there's space */
parms[i] = malloc(BOZO_BSSIZE);
+ if (parms[i] == NULL) {
+ code = ENOMEM;
+ goto fail;
+ }
+ }
strcpy(parms[i], tbuffer + 5); /* remember the parameter for later */
thisparms[i] = parms[i];
}
free(instp);
if (typep)
free(typep);
+ if (notp)
+ free(notp);
for (i = 0; i < MAXPARMS; i++)
if (parms[i])
free(parms[i]);
cmd_OptionAsFlag(opts, OPT_nofork, &nofork);
if (cmd_OptionAsString(opts, OPT_cores, &DoCore) == 0) {
- if (strcmp(DoCore, "none")) {
+ if (strcmp(DoCore, "none") == 0) {
free(DoCore);
DoCore = NULL;
}
exit(code);
}
+ if (bozo_isrestricted) {
+ bozo_Log("NOTICE: bosserver is running in restricted mode.\n");
+ } else {
+ bozo_Log("WARNING: bosserver is not running in restricted mode.\n");
+ bozo_Log("WARNING: Superusers have unrestricted access to this host via bos.\n");
+ bozo_Log("WARNING: Use 'bos setrestricted' or restart with the -restricted option\n");
+ bozo_Log("WARNING: to enable restricted mode.\n");
+ }
+
if (rxBind) {
host = GetRxBindAddress();
}
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"
struct ktc_token;
extern int vldbClientInit(int noAuthFlag, int localauth, char *cellName,
struct ubik_client **cstruct, time_t *expires);
+extern int ubik_Call_SingleServer_BUDB_GetVolumes(struct ubik_client *aclient,
+ afs_int32 aflags,
+ afs_int32 majorVersion,
+ afs_int32 flags,
+ const char *name,
+ afs_int32 start,
+ afs_int32 end,
+ afs_int32 index,
+ afs_int32 *nextIndex,
+ afs_int32 *dbUpdate,
+ budb_volumeList *volumes);
+extern int ubik_Call_SingleServer_BUDB_DumpDB(struct ubik_client *aclient,
+ afs_int32 aflags,
+ int firstcall,
+ afs_int32 maxLength,
+ charListT *charListPtr,
+ afs_int32 *flags);
#endif
last = next;
/* now get all the volumes in this dump. */
- code = ubik_Call_SingleServer(BUDB_GetVolumes, udbHandle.uh_client, UF_SINGLESERVER, BUDB_MAJORVERSION, BUDB_OP_DUMPID | BUDB_OP_TAPENAME, tapeLinkPtr->tapeEntry.name, /* tape name */
- dumpid, /* dumpid (not initial dumpid) */
- 0, /* end */
- last, /* last */
- &next, /* nextindex */
- &dbTime, /* update time */
- &vl);
+ code =
+ ubik_Call_SingleServer_BUDB_GetVolumes(udbHandle.uh_client,
+ UF_SINGLESERVER,
+ BUDB_MAJORVERSION,
+ BUDB_OP_DUMPID | BUDB_OP_TAPENAME,
+ tapeLinkPtr->tapeEntry.name, /* tape name */
+ dumpid, /* dumpid (not initial dumpid) */
+ 0, /* end */
+ last, /* last */
+ &next, /* nextindex */
+ &dbTime, /* update time */
+ &vl);
if (code) {
if (code == BUDB_ENDOFLIST) { /* 0 volumes on tape */
afs_int32
doDispatch(afs_int32 targc,
- char *targv[MAXV],
+ char *targv[],
afs_int32 dispatchCount) /* to prevent infinite recursion */
{
char *sargv[MAXV];
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;
-}
* in the future, we should also put in a protocol to find the sync site
*/
-afs_int32
+static afs_int32
ubik_Call_SingleServer(int (*aproc) (), struct ubik_client *aclient,
- afs_int32 aflags, char *p1, char *p2, char *p3,
- char *p4, char *p5, char *p6, char *p7, char *p8,
- char *p9, char *p10, char *p11, char *p12, char *p13,
- char *p14, char *p15, char *p16)
+ afs_int32 aflags, long p1, long p2, long p3,
+ long p4, long p5, long p6, long p7, long p8,
+ long p9, long p10, long p11, long p12, long p13,
+ long p14, long p15, long p16)
{
afs_int32 code;
afs_int32 someCode;
return someCode;
}
+int
+ubik_Call_SingleServer_BUDB_GetVolumes(struct ubik_client *aclient,
+ afs_int32 aflags, afs_int32 majorVersion,
+ afs_int32 flags, const char *name,
+ afs_int32 start, afs_int32 end,
+ afs_int32 index, afs_int32 *nextIndex,
+ afs_int32 *dbUpdate,
+ budb_volumeList *volumes)
+{
+ return ubik_Call_SingleServer(BUDB_GetVolumes, aclient, aflags,
+ (long)majorVersion, (long)flags, (long)name,
+ (long)start, (long)end, (long)index,
+ (long)nextIndex, (long)dbUpdate,
+ (long)volumes, 0, 0, 0, 0, 0, 0, 0);
+}
+
+int
+ubik_Call_SingleServer_BUDB_DumpDB(struct ubik_client *aclient,
+ afs_int32 aflags, int firstcall,
+ afs_int32 maxLength, charListT *charListPtr,
+ afs_int32 *flags)
+{
+ return ubik_Call_SingleServer(BUDB_DumpDB, aclient, aflags, (long)firstcall,
+ (long)maxLength, (long)charListPtr,
+ (long)flags, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0);
+}
/* -------------------------------------
* debug and test routines
$(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:
#include <ctype.h>
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV)
+#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV)
#include <dlfcn.h>
#endif
#endif
#if defined(AFS_AIX_ENV)
dynlib = dlopen("/usr/lib/libApiDS.a(dsmapish.o)", RTLD_NOW | RTLD_LOCAL | RTLD_MEMBER);
-#elif defined (AFS_AMD64_LINUX26_ENV)
+#elif defined (AFS_AMD64_LINUX_ENV)
dynlib = dlopen("/usr/lib64/libApiTSM64.so", RTLD_NOW | RTLD_LOCAL);
-#elif defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV)
+#elif defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV)
dynlib = dlopen("/usr/lib/libApiDS.so", RTLD_NOW | RTLD_LOCAL);
#else
dynlib = NULL;
#ifdef DEBUG_BUTC
printf("dsm_MountLibrary : SUCCESS to Open the libApiDS shared library. \n");
#endif
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV)
+#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV)
AFSdsmBeginQuery = (dsInt16_t (*)( dsUint32_t dsmHandle, dsmQueryType queryType, dsmQueryBuff *queryBuffer)) dlsym((void *)dynlib, "dsmBeginQuery");
AFSdsmGetNextQObj = (dsInt16_t (*)( dsUint32_t dsmHandle, DataBlk *dataBlkPtr))dlsym((void *)dynlib, "dsmGetNextQObj") ;
AFSdsmEndQuery = (dsInt16_t (*)( dsUint32_t dsmHandle))dlsym((void *)dynlib, "dsmEndQuery");
XBSAQueryApiVersion(&(info->apiVersion));
#endif
#else
-#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX26_ENV)
+#if defined(AFS_AIX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV)
XBSAInit = BSAInit;
XBSABeginTxn = BSABeginTxn;
XBSAEndTxn = BSAEndTxn;
/* Query the backup database for list of volumes to delete */
for (index = next = 0; index != -1; index = next) {
- rc = ubik_Call_SingleServer(BUDB_GetVolumes, udbHandle.uh_client,
- UF_SINGLESERVER, BUDB_MAJORVERSION,
- BUDB_OP_DUMPID, tapeName, dumpid, 0,
- index, &next, &dbTime, &vl);
+ rc = ubik_Call_SingleServer_BUDB_GetVolumes(udbHandle.uh_client,
+ UF_SINGLESERVER,
+ BUDB_MAJORVERSION,
+ BUDB_OP_DUMPID,
+ tapeName, dumpid, 0, index,
+ &next, &dbTime, &vl);
if (rc) {
if (rc == BUDB_ENDOFLIST)
break;
#include <afs/procmgmt.h>
#include <roken.h>
-#ifdef IGNORE_SOME_GCC_WARNINGS
-# pragma GCC diagnostic warning "-Wimplicit-function-declaration"
-#endif
-
#include <afs/opr.h>
#include <rx/rx.h>
#include <afs/afsint.h>
/* get the data */
code =
- ubik_Call_SingleServer(BUDB_DumpDB, udbHandle.uh_client,
- UF_SINGLESERVER, firstcall,
- maxReadSize, &charList, &done);
+ ubik_Call_SingleServer_BUDB_DumpDB(udbHandle.uh_client,
+ UF_SINGLESERVER, firstcall,
+ maxReadSize, &charList,
+ &done);
if (code) {
ErrorLog(0, taskId, code, 0, "Can't read database\n");
ERROR_EXIT(code);
error_exit:
/* Let the KeepAlive process stop on its own */
code =
- ubik_Call_SingleServer(BUDB_DumpDB, udbHandle.uh_client,
- UF_END_SINGLESERVER, 0);
+ ubik_Call_SingleServer_BUDB_DumpDB(udbHandle.uh_client,
+ UF_END_SINGLESERVER, 0, 0, 0, 0);
if (writeBlock)
free(writeBlock);
charList.charListT_val = 0;
charList.charListT_len = 0;
code =
- ubik_Call_SingleServer(BUDB_DumpDB, udbHandle.uh_client,
- UF_SINGLESERVER, 0, 0, &charList, &done);
+ ubik_Call_SingleServer_BUDB_DumpDB(udbHandle.uh_client,
+ UF_SINGLESERVER, 0, 0, &charList,
+ &done);
if (code || done)
break;
}
#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);
-}
# git ls-files -i --exclude-standard
# to check that you haven't inadvertently ignored any tracked files.
-/rxdebug
-/rxdumptrace
-/rxperf
+/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;
}
if (info->posCount >= 2147467264) { /* 2GB - 16K */
info->posCount = 0;
-#if (defined(AFS_SUN_ENV) || defined(AFS_LINUX24_ENV))
+#if (defined(AFS_SUN_ENV) || defined(AFS_LINUX_ENV))
if (!isafile) {
afs_int64 off;
#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;
}
#if defined(ENABLE_REDHAT_BUILDSYS) && defined(KERNEL) && defined(REDHAT_FIX)
# include "redhat-fix.h"
#endif
+
+/*
+ * AC_HEADER_TIME, which set TIME_WITH_SYS_TIME, has been marked as obsolete
+ * prior to autoconf 2.64 and autoconf 2.70 flags its use with a warning.
+ * However the external roken code still relies on the definition.
+ */
+#define TIME_WITH_SYS_TIME 1
+
#endif /* __AFSCONFIG_H */])
])
--- /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],
AC_DEFUN([OPENAFS_HAVE_STRUCT_FIELD], [
define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
AC_CACHE_CHECK([for $2 in $1], cache_val,[
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]],
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ $3
+ #include <string.h>]],
[[$1 x; memset(&x, 0, sizeof(x)); x.$2]])],
[cache_val=yes],
[cache_val=no])
AC_DEFUN([OPENAFS_HEADER_CHECKS],[
dnl checks for header files.
-AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
AC_CHECK_HEADERS([ \
AC_DEFUN([OPENAFS_LEX],[
-AC_PROG_LEX
+AC_PROG_LEX([noyywrap])
dnl if we are flex, be lex-compatible
OPENAFS_LEX_IS_FLEX([AC_SUBST([LEX], ["$LEX -l"])])
])
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 <net/ip.h>],
[ip_sock_set_mtu_discover(NULL, 0);])
+dnl Linux 5.17 renamed complete_and_exit to kthread_complete_and_exit
+AC_CHECK_LINUX_FUNC([kthread_complete_and_exit],
+ [#include <linux/kernel.h>
+ #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([seq_file.h])
AC_CHECK_LINUX_HEADER([sched/signal.h])
AC_CHECK_LINUX_HEADER([uaccess.h])
+AC_CHECK_LINUX_HEADER([stdarg.h])
+dnl Linux 6.3 relocated file locking related declarations into it's own header
+AC_CHECK_LINUX_HEADER([filelock.h])
])
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
])
[struct inode *oinode, struct dentry *odentry,
struct inode *ninode, struct dentry *ndentry,
unsigned int flags])
-])
+dnl Linux 5.12 added the user_namespace parameter to the several
+dnl inode operations functions.
+dnl Perform a generic test using the inode_op create to test for this change.
+AC_CHECK_LINUX_OPERATION([inode_operations], [create], [user_namespace],
+ [#include <linux/fs.h>],
+ [int],
+ [struct user_namespace *mnt_userns,
+ struct inode *inode, struct dentry *dentry,
+ umode_t umode, bool flag])
+dnl if HAVE_LINUX_INODE_OPERATIONS_CREATE_USER_NAMESPACE, create a more generic
+dnl define.
+AS_IF([test AS_VAR_GET([ac_cv_linux_operation_inode_operations_create_user_namespace]) = yes],
+ [AC_DEFINE([IOP_TAKES_USER_NAMESPACE], 1,
+ [define if inodeops require struct user_namespace])])
+dnl Linux 6.3 replaced the user_namespace parameter with mnt_idmap for
+dnl the inode operations functions.
+AC_CHECK_LINUX_OPERATION([inode_operations], [create], [mnt_idmap],
+ [#include <linux/fs.h>],
+ [int],
+ [struct mnt_idmap *idmap,
+ struct inode *inode, struct dentry *dentry,
+ umode_t umode, bool flag])
+dnl if HAVE_LINUX_INODE_OPERATIONS_CREATE_MNT_IDMAP, create a more generic
+dnl define.
+AS_IF([test AS_VAR_GET([ac_cv_linux_operation_inode_operations_create_mnt_idmap]) = yes],
+ [AC_DEFINE([IOP_TAKES_MNT_IDMAP], 1,
+ [define if inodeops require struct mnt_idmap])])
+])
\ No newline at end of file
AC_CHECK_LINUX_STRUCT([address_space], [backing_dev_info], [fs.h])
AC_CHECK_LINUX_STRUCT([address_space_operations],
[write_begin], [fs.h])
+dnl linux 5.18 replaced set_page_dirty with dirty_folio
+AC_CHECK_LINUX_STRUCT([address_space_operations], [dirty_folio], [fs.h])
+dnl linux 5.18 replaced readpages with readahead (introduced in 5.8)
+AC_CHECK_LINUX_STRUCT([address_space_operations], [readahead], [fs.h])
+dnl linux 5.18 replaced readpage with read_folio
+AC_CHECK_LINUX_STRUCT([address_space_operations], [read_folio], [fs.h])
AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
[backing-dev.h])
AC_CHECK_LINUX_STRUCT([cred], [session_keyring], [cred.h])
AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_alias], [dcache.h])
+dnl linux 2.6.16 moved dentry->d_child to dentry->d_u.d_child
+dnl linux 3.19 moved it back to dentry->d_child
+AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_child], [dcache.h])
+dnl linux 6.8 uses hlist for dentry children and renamed
+dnl d_subdirs/d_child to d_childern/d_sib
+AC_CHECK_LINUX_STRUCT([dentry], [d_children], [dcache.h])
AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h])
AC_CHECK_LINUX_STRUCT([group_info], [gid], [cred.h])
AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
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
AC_CHECK_PROGS(CP, cp, [false])
AC_CHECK_PROGS(GENCAT, gencat, [false])
-dnl if ar is not present, libtool.m4 (provided by libtool) sets AR to false
-dnl if strip is not present, libtool.m4 (provided by libtool) sets STRIP to :
-AS_IF([test "x$AR" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ar'])])
-AS_IF([test "x$AS" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'as'])])
-AS_IF([test "x$MV" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'mv'])])
-AS_IF([test "x$RM" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'rm'])])
-AS_IF([test "x$LD" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ld'])])
-AS_IF([test "x$CP" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'cp'])])
-AS_IF([test "x$GENCAT" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'gencat'])])
-
-dnl TODO - need to disable STRIP if we are doing debugging in any user space code
-
case $AFS_SYSNAME in
alpha_linux_22 | alpha_linux_24 | alpha_linux_26)
CCOBJ="\$(CC) -fPIC"
XCFLAGS0="-ldld -lc -Wp,-H200000 -Wl,-a,archive -DAUTH_DBM_LOG +z -Wl,+k -D_LARGEFILE64_SOURCE"
XCFLAGS64="${XCFLAGS0} +DA2.0W"
XCFLAGS="${XCFLAGS0} +DA1.0"
- XLIBELFA="-lelf"
YACC="/opt/langtools/bin/yacc"
SHLIB_LINKER="ld -b"
;;
XCFLAGS0="-ldld -lc -Wp,-H200000 -Wl,-a,archive_shared -DAUTH_DBM_LOG +z -Wl,+k -D_LARGEFILE64_SOURCE"
XCFLAGS64="${XCFLAGS0} +DD64"
XCFLAGS="${XCFLAGS0}"
- XLIBELFA="-lelf"
YACC="/opt/langtools/bin/yacc"
SHLIB_LINKER="ld -b"
;;
XLIBS="${LIB_AFSDB} -framework CoreFoundation"
;;
- *_darwin_190)
+ *_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}'
SHLIB_LINKER="${MT_CC} -bM:SRE -berok"
AIX32="yes"
AIX64="no"
+ TSM_IMPORTS="-bI:/lib/aio.exp -bI:/lib/netinet.exp -bI:/lib/sockets.exp -bI:/lib/statcmd.exp"
+ TSM_LIBS="-lsys -lcsys -lc"
;;
rs_aix51 | rs_aix52 | rs_aix53)
SHLIB_LINKER="${MT_CC} -bM:SRE -berok"
AIX32="yes"
AIX64="yes"
+ TSM_IMPORTS="-bI:/lib/aio.exp -bI:/lib/netinet.exp -bI:/lib/sockets.exp -bI:/lib/statcmd.exp"
+ TSM_LIBS="-lsys -lcsys -lc"
;;
- rs_aix61)
+ rs_aix61 | rs_aix7*)
CC="cc"
DBG="-g"
LIBSYS_AIX_EXP="afsl.exp"
SHLIB_LINKER="${MT_CC} -bM:SRE -berok"
AIX32="no"
AIX64="yes"
+ TSM_IMPORTS="-bI:/lib/aio.exp -bI:/lib/netinet.exp -bI:/lib/sockets.exp -bI:/lib/statcmd.exp"
+ TSM_LIBS="-lsys -lcsys -lc"
;;
s390_linux26)
SHLIB_CFLAGS="-KPIC"
XCFLAGS64='${XCFLAGS} -m64'
XCFLAGS="-dy -Bdynamic"
- XLIBELFA="-lelf"
- XLIBKVM="-lkvm"
XLIBS="${LIB_AFSDB} -lsocket -lnsl -lintl -ldl"
SHLIB_LINKER="${CC} -G -dy -Bsymbolic -z text"
LWP_OPTMZ="-g"
XLDFLAGS64="-m64"
XLDFLAGS="${XARCHFLAGS}"
ASFLAGS="${XARCHFLAGS}"
- XLIBELFA="-lelf"
- XLIBKVM="-lkvm"
XLIBS="${LIB_AFSDB} -lsocket -lnsl -lintl -ldl"
SHLIB_LINKER="${CC} ${XARCHFLAGS} -G -dy -Bsymbolic -z text"
;;
MT_CFLAGS="${MT_CFLAGS} -DAFS_PTHREAD_ENV"
+AFS_LT_INIT
+
+dnl if ar is not present, libtool.m4 (provided by libtool) sets AR to false
+dnl if strip is not present, libtool.m4 (provided by libtool) sets STRIP to :
+AS_IF([test "x$AR" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ar'])])
+AS_IF([test "x$AS" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'as'])])
+AS_IF([test "x$MV" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'mv'])])
+AS_IF([test "x$RM" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'rm'])])
+AS_IF([test "x$LD" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'ld'])])
+AS_IF([test "x$CP" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'cp'])])
+AS_IF([test "x$GENCAT" = "xfalse"], [AC_MSG_ERROR([cannot find required command 'gencat'])])
+
+dnl TODO - need to disable STRIP if we are doing debugging in any user space code
+
#
# Defaults for --enable-optimize-kernel
#
CFLAGS_NOUNUSED=
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])
+ [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(SHLIB_CFLAGS)
AC_SUBST(SHLIB_LINKER)
AC_SUBST(SHLIB_SUFFIX)
+AC_SUBST(TSM_IMPORTS)
+AC_SUBST(TSM_LIBS)
AC_SUBST(VFSCK_CFLAGS)
AC_SUBST(XCFLAGS)
AC_SUBST(CFLAGS_NOERROR)
AC_SUBST(CFLAGS_NOUNUSED)
AC_SUBST(CFLAGS_NOOLDSTYLE)
AC_SUBST(CFLAGS_NOIMPLICIT_FALLTHROUGH)
+AC_SUBST(CFLAGS_NOCAST_FUNCTION_TYPE)
+AC_SUBST(CFLAGS_NODANGLING_POINTER)
AC_SUBST(CFLAGS_WERROR)
AC_SUBST(XCFLAGS64)
AC_SUBST(XLDFLAGS)
AC_SUBST(XLDFLAGS64)
-AC_SUBST(XLIBELFA)
-AC_SUBST(XLIBKVM)
AC_SUBST(XLIBS)
AC_SUBST(YACC)
AC_SUBST(KROOT)
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)
[with_swig=check])
LIBUAFS_BUILD_PERL=
+
+dnl Building with swig requires shared library support. If --disable-shared
+dnl was specified, turn off auto detection (with a notice). If --with-swig=yes
+dnl generate an error message
+AS_IF([test "x$enable_shared" != "xyes" && test "x$with_swig" != "xno"],
+ [AS_IF([test "x$with_swig" = "xyes"],
+ [AC_MSG_ERROR([--with-swig is incompatible with --disable-shared])],
+ [with_swig=no
+ AC_MSG_NOTICE([--disable-shared specified, swig autodetection is disabled])])])
+
AS_IF([test "x$with_swig" != "xno"],
[AC_CHECK_PROG([SWIG], [swig], [swig])
AS_IF([test "x$SWIG" = "xswig"],
AFS_SYSNAME="x86_darwin_190"
OSXSDK="macosx10.15"
;;
+ x86_64-apple-darwin20.*)
+ AFS_SYSNAME="x86_darwin_200"
+ OSXSDK="macosx11.0"
+ ;;
+ arm-apple-darwin20.*)
+ 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"
+ ;;
+ arm-apple-darwin21.*)
+ 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
*_linux_26) AFS_PARAM_COMMON=param.linux26.h ;;
*_fbsd_*) AFS_PARAM_COMMON=param.generic_fbsd.h ;;
esac
+
+case $AFS_SYSNAME in
+ *_darwin_200)
+ AFS_PARAM=param.darwin_200.h
+ ;;
+ *_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
+ ;;
+esac
])
AC_DEFUN([OPENAFS_OUTPUT_VARIABLES],[
AC_SUBST(VFSCK)
AC_SUBST(AFS_SYSNAME)
+AC_SUBST(AFS_PARAM)
AC_SUBST(AFS_PARAM_COMMON)
AC_SUBST(ENABLE_KERNEL_MODULE)
AC_SUBST(ENABLE_PTHREADED_UBIK)
/*
* Before calling the beforeProc and afterProc and all the implications
- * from those calls, check if the help procedure was called and call it
- * now.
+ * from those calls, handle any built-in commands.
*/
- if ((ts->proc == HelpProc) || (ts->proc == AproposProc)) {
+ if ((ts->proc == HelpProc) || (ts->proc == AproposProc) || (ts->proc == VersionProc)) {
code = (*ts->proc) (ts, ts->rock);
goto out;
}
compile_et: compile_et.o error_table.o
$(Q)case $(SYS_NAME) in \
- *_linux* | *_umlinux* | *_darwin* ) \
+ *_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);; \
LWP_OPTMZ = @LWP_OPTMZ@
LWP_DBG = @LWP_DBG@
MKAFS_OSTYPE = @MKAFS_OSTYPE@
+AFS_PARAM = @AFS_PARAM@
AFS_PARAM_COMMON = @AFS_PARAM_COMMON@
MT_CC = @MT_CC@
MT_CFLAGS = @MT_CFLAGS@
XCFLAGS = @XCFLAGS@
XLDFLAGS64 = @XLDFLAGS64@
XLDFLAGS = @XLDFLAGS@
-XLIBELFA = @XLIBELFA@
-XLIBKVM = @XLIBKVM@
XLIBS = @XLIBS@
YACC = @YACC@
KROOT = @KROOT@
LT_revision=0
LT_age=0
-# Basic rule to link a shared library.
-LT_LDLIB_shlib_common=$(LIBTOOL) --quiet --mode=link --tag=CC \
+# Basic rule to link a shared library. Only use LT_LDLIB_shlib_internal
+# directly when creating an internal-only library that is not intended for
+# public use (and so does not need an export symbol list). All other libraries
+# should be using one of the other LT_LDLIB_shlib* rules.
+LT_LDLIB_shlib_internal=$(LIBTOOL) --quiet --mode=link --tag=CC \
$(LD_WRAPPER) $(MT_CC) -rpath $(libdir) \
$(PTH_LDFLAGS) $(PTH_CFLAGS) $(LDFLAGS_$(@)) \
-o $@ \
-version-info $(LT_current):$(LT_revision):$(LT_age)
-LT_LDLIB_shlib=$(LT_LDLIB_shlib_common) -export-symbols $(srcdir)/$@.sym
+LT_LDLIB_shlib=$(LT_LDLIB_shlib_internal) -export-symbols $(srcdir)/$@.sym
-LT_LDLIB_shlib_only=$(LT_LDLIB_shlib_common) -shared -export-symbols $(srcdir)/$@.sym
+LT_LDLIB_shlib_only=$(LT_LDLIB_shlib_internal) -shared -export-symbols $(srcdir)/$@.sym
-LT_LDLIB_shlib_missing=$(LT_LDLIB_shlib_common) -shared -export-symbols-regex \
+LT_LDLIB_shlib_missing=$(LT_LDLIB_shlib_internal) -shared -export-symbols-regex \
"($$(sed -e 's/^/^/' -e 's/$$/$$|/' -e '$$ s/|$$//' $(srcdir)/$@.sym | \
tr -d '\n'))"
# Include installation targets
#
-param.h.new: ${srcdir}/param.${SYS_NAME}.h ${AFS_PARAM_COMMON}
+param.h.new: ${srcdir}/${AFS_PARAM} ${AFS_PARAM_COMMON}
if [ "X${AFS_PARAM_COMMON}" != "X" ] ; then \
- cat ${srcdir}/${AFS_PARAM_COMMON} ${srcdir}/param.${SYS_NAME}.h > param.h.new ; \
+ cat ${srcdir}/${AFS_PARAM_COMMON} ${srcdir}/${AFS_PARAM} > param.h.new ; \
else \
- cat ${srcdir}/param.${SYS_NAME}.h > param.h.new ; \
+ cat ${srcdir}/${AFS_PARAM} > param.h.new ; \
fi
${DEST}/include/afs/param.h ${DESTDIR}${includedir}/afs/param.h ${TOP_INCDIR}/afs/param.h: param.h.new
! IF (!EXIST($(OJT)\tests))
$(MKDIR) $(OJT)\tests
! ENDIF
-! IF (!EXIST($(OJT)\tests\rpctestlib))
- $(MKDIR) $(OJT)\tests\rpctestlib
-! ENDIF
! IF (!EXIST($(OJT)\libadmin))
$(MKDIR) $(OJT)\libadmin
! ENDIF
AFSPRODUCT_VER_MINOR=9
!ENDIF
!IF !DEFINED(AFSPRODUCT_VER_PATCH)
-AFSPRODUCT_VER_PATCH=0000
+AFSPRODUCT_VER_PATCH=0001
!ENDIF
!IF !DEFINED(AFSPRODUCT_VER_BUILD)
AFSPRODUCT_VER_BUILD=0
AFSPRODUCT_VER_MINOR=9
!ENDIF
!IF !DEFINED(AFSPRODUCT_VER_PATCH)
-AFSPRODUCT_VER_PATCH=0000
+AFSPRODUCT_VER_PATCH=0001
!ENDIF
!IF !DEFINED(AFSPRODUCT_VER_BUILD)
AFSPRODUCT_VER_BUILD=0
AFSPRODUCT_VER_MINOR=9
!ENDIF
!IF !DEFINED(AFSPRODUCT_VER_PATCH)
-AFSPRODUCT_VER_PATCH=0000
+AFSPRODUCT_VER_PATCH=0001
!ENDIF
!IF !DEFINED(AFSPRODUCT_VER_BUILD)
AFSPRODUCT_VER_BUILD=0
/* AFSOP_STOP_RXK_LISTENER 217 defined in osi.h */
#define AFSOP_STOP_AFSDB 218 /* Stop AFSDB handler */
#define AFSOP_STOP_NETIF 219 /* Stop Netif poller */
+#define AFSOP_SOCKPROXY_HANDLER 220 /* Userspace socket handler */
+#define AFSOP_STOP_SOCKPROXY 221 /* Stop socket proxy daemon */
-#define AFSOP_MAX_OPCODE AFSOP_STOP_NETIF /* Largest defined opcode. */
+#define AFSOP_MAX_OPCODE AFSOP_STOP_SOCKPROXY /* Largest defined opcode. */
/*
* AFS system call types and flags.
afs_int32 dUnique;
};
+struct afs_usp_param {
+ afs_int32 idx; /* process index */
+ afs_int32 addr; /* ipv4 addr (net order) to be bound to the socket */
+ afs_int32 port; /* port (net order) to be bound to the socket */
+ afs_int32 npkts; /* number of packets */
+};
+
#ifdef AFS_DARWIN_ENV
# define AFS_USPC_UMV 1
#endif
#define AFS_USPC_SHUTDOWN 2
#define AFS_USPC_NOOP 3
+#ifdef AFS_SOCKPROXY_ENV
+# define AFS_USPC_SOCKPROXY_START 4
+# define AFS_USPC_SOCKPROXY_SEND 5
+# define AFS_USPC_SOCKPROXY_RECV 6
+#endif
+
struct afs_uspc_param {
afs_int32 retval;
afs_int32 ts; /* brequest ts - always unique */
afs_int32 reqtype;
union {
struct afs_umv_param umv;
+ struct afs_usp_param usp;
} req;
};
/*
* 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
/* Defines and structures for the AFS proc replacement layer for the original syscall (AFS_SYSCALL) strategy */
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#define PROC_FSDIRNAME "openafs"
#define PROC_SYSCALL_NAME "afs_ioctl"
#define AFS_CACHE_VOLUME_INODE -4
#endif
+#ifdef AFS_SOCKPROXY_ENV
+# define AFS_SOCKPROXY_PAYLOAD_MAX 8192 /* max payload supported by libafs */
+# define AFS_SOCKPROXY_PKT_MAX 1024 /* max number of packets supported by libafs */
+# define AFS_SOCKPROXY_NPROCS 4 /* number of processes */
+struct afs_pkt_hdr {
+ afs_uint32 addr; /* ipv4 address (net order) */
+ afs_uint32 port; /* port (net order) */
+ afs_uint32 size; /* size of payload */
+ afs_uint32 pad; /* spare field, must be 0 */
+ void *payload; /* data to be sent or received */
+};
+#endif
+
#endif /* _AFS_ARGS_H_ */
#define SYS_NAME_ID_x86_darwin_190 541
#define SYS_NAME_ID_amd64_darwin_190 542
#define SYS_NAME_ID_arm_darwin_190 543
+#define SYS_NAME_ID_x86_darwin_200 544
+#define SYS_NAME_ID_amd64_darwin_200 545
+#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_aix52 706
#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
#define SYS_NAME_ID_i386_fbsd_113 2143
#define SYS_NAME_ID_i386_fbsd_120 2160
#define SYS_NAME_ID_i386_fbsd_121 2161
+#define SYS_NAME_ID_i386_fbsd_122 2162
+#define SYS_NAME_ID_i386_fbsd_123 2163
#define SYS_NAME_ID_ia64_linux2 2200
#define SYS_NAME_ID_ia64_linux22 2201
#define SYS_NAME_ID_amd64_fbsd_113 3043
#define SYS_NAME_ID_amd64_fbsd_120 3060
#define SYS_NAME_ID_amd64_fbsd_121 3061
+#define SYS_NAME_ID_amd64_fbsd_122 3062
+#define SYS_NAME_ID_amd64_fbsd_123 3063
#define SYS_NAME_ID_amd64_w2k 3400
typedef struct Lock afs_lock_t;
#endif
+#if (defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || (defined(AFS_DARWIN_ENV) && defined(__amd64__))
+#define ICL_LONG 2
+#else
+#define ICL_LONG 1
+#endif
+
#define ICL_LOGSPERSET 8 /* max logs per set */
#define ICL_DEFAULTEVENTS 1024 /* default events per event set */
#define ICL_DEFAULT_LOGSIZE 60*1024 /* number of words in default log size */
#define ICL_DEFAULT_SET_STATES 0 /* was ICL_SETF_ACTIVE */
#endif /* ICL_DEFAULT_SET_STATES */
-/* bytes required by eventFlags array, for x events */
-#define ICL_EVENTBYTES(x) ((((x) - 1) | 7) + 1)
-
/* functions for finding a particular event */
#define ICL_EVENTBYTE(x) (((x) & 0x3ff) >> 3)
#define ICL_EVENTMASK(x) (1 << ((x) & 0x7))
-#define ICL_EVENTOK(setp, x) ((x&0x3ff) >= 0 && (x&0x3ff) < (setp)->nevents)
/* define ICL syscalls by name!! */
#define ICL_OP_COPYOUT 1
#define ICL_OP_SS_DEACTIVATE 2
#define ICL_OP_SS_FREE 3
-/* define set status flags */
-#define ICL_FLAG_ACTIVE 1
-#define ICL_FLAG_FREED 2
/* The format of the circular log is:
* 1'st word:
#define ICL_RPC_MAX_SETS (64)
#define ICL_RPC_MAX_LOGS (64)
-typedef struct afs_icl_setinfo {
- u_char setName[32];
- afs_uint32 states;
-} afs_icl_setinfo_t;
-
-typedef struct afs_icl_loginfo {
- u_char logName[32];
- afs_uint32 logSize;
- afs_uint32 logElements;
- afs_uint32 states;
-} afs_icl_loginfo_t;
-
-typedef struct afs_icl_bulkSetinfo {
- afs_uint32 count;
- afs_icl_setinfo_t setinfo[1];
-} afs_icl_bulkSetinfo_t;
-
-typedef struct afs_icl_bulkLoginfo {
- afs_uint32 count;
- afs_icl_loginfo_t loginfo[1];
-} afs_icl_bulkLoginfo_t;
#endif
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_ALPHA_LINUX20_ENV 1
-#define AFS_ALPHA_LINUX22_ENV 1
-#define AFS_ALPHA_LINUX24_ENV 1
-#define AFS_ALPHA_LINUX26_ENV 1
+#define AFS_ALPHA_LINUX_ENV 1
#define __alpha 1
#define AFS_LINUX_64BIT_KERNEL 1
#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits */
--- /dev/null
+#ifndef AFS_PARAM_H
+#define AFS_PARAM_H
+
+/* Machine / Operating system information */
+#define SYS_NAME "amd64_fbsd_122"
+#define SYS_NAME_ID SYS_NAME_ID_amd64_fbsd_122
+
+#define AFS_64BITPOINTER_ENV 1
+
+#ifndef UKERNEL
+/* This section for kernel libafs compiles only */
+
+#define AFS_64BITUSERPOINTER_ENV 1
+
+#define AFS_FBSD101_ENV 1
+#define AFS_FBSD102_ENV 1
+#define AFS_FBSD103_ENV 1
+#define AFS_FBSD104_ENV 1
+#define AFS_FBSD110_ENV 1
+#define AFS_FBSD111_ENV 1
+#define AFS_FBSD120_ENV 1
+#define AFS_FBSD121_ENV 1
+#define AFS_FBSD122_ENV 1
+
+#define AFS_X86_FBSD101_ENV 1
+#define AFS_X86_FBSD102_ENV 1
+#define AFS_X86_FBSD103_ENV 1
+#define AFS_X86_FBSD104_ENV 1
+#define AFS_X86_FBSD110_ENV 1
+#define AFS_X86_FBSD111_ENV 1
+#define AFS_X86_FBSD120_ENV 1
+#define AFS_X86_FBSD121_ENV 1
+#define AFS_X86_FBSD122_ENV 1
+
+#else /* !defined(UKERNEL) */
+
+/* This section for user space compiles only */
+
+#define AFS_USR_FBSD101_ENV 1
+#define AFS_USR_FBSD102_ENV 1
+#define AFS_USR_FBSD103_ENV 1
+#define AFS_USR_FBSD104_ENV 1
+#define AFS_USR_FBSD110_ENV 1
+#define AFS_USR_FBSD111_ENV 1
+#define AFS_USR_FBSD120_ENV 1
+#define AFS_USR_FBSD121_ENV 1
+#define AFS_USR_FBSD122_ENV 1
+
+#endif /* !defined(UKERNEL) */
+
+#define USE_UCONTEXT
+
+#endif /* AFS_PARAM_H */
--- /dev/null
+#ifndef AFS_PARAM_H
+#define AFS_PARAM_H
+
+/* Machine / Operating system information */
+#define SYS_NAME "amd64_fbsd_123"
+#define SYS_NAME_ID SYS_NAME_ID_amd64_fbsd_123
+
+#define AFS_64BITPOINTER_ENV 1
+
+#ifndef UKERNEL
+/* This section for kernel libafs compiles only */
+
+#define AFS_64BITUSERPOINTER_ENV 1
+
+#define AFS_FBSD101_ENV 1
+#define AFS_FBSD102_ENV 1
+#define AFS_FBSD103_ENV 1
+#define AFS_FBSD104_ENV 1
+#define AFS_FBSD110_ENV 1
+#define AFS_FBSD111_ENV 1
+#define AFS_FBSD120_ENV 1
+#define AFS_FBSD121_ENV 1
+#define AFS_FBSD122_ENV 1
+#define AFS_FBSD123_ENV 1
+
+#define AFS_X86_FBSD101_ENV 1
+#define AFS_X86_FBSD102_ENV 1
+#define AFS_X86_FBSD103_ENV 1
+#define AFS_X86_FBSD104_ENV 1
+#define AFS_X86_FBSD110_ENV 1
+#define AFS_X86_FBSD111_ENV 1
+#define AFS_X86_FBSD120_ENV 1
+#define AFS_X86_FBSD121_ENV 1
+#define AFS_X86_FBSD122_ENV 1
+#define AFS_X86_FBSD123_ENV 1
+
+#else /* !defined(UKERNEL) */
+
+/* This section for user space compiles only */
+
+#define AFS_USR_FBSD101_ENV 1
+#define AFS_USR_FBSD102_ENV 1
+#define AFS_USR_FBSD103_ENV 1
+#define AFS_USR_FBSD104_ENV 1
+#define AFS_USR_FBSD110_ENV 1
+#define AFS_USR_FBSD111_ENV 1
+#define AFS_USR_FBSD120_ENV 1
+#define AFS_USR_FBSD121_ENV 1
+#define AFS_USR_FBSD122_ENV 1
+#define AFS_USR_FBSD123_ENV 1
+
+#endif /* !defined(UKERNEL) */
+
+#define USE_UCONTEXT
+
+#endif /* AFS_PARAM_H */
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_AMD64_LINUX20_ENV 1
-#define AFS_AMD64_LINUX22_ENV 1
-#define AFS_AMD64_LINUX24_ENV 1
-#define AFS_AMD64_LINUX26_ENV 1
+#define AFS_AMD64_LINUX_ENV 1
#define AFS_LINUX_64BIT_KERNEL 1
#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits */
#define AFS_64BITUSERPOINTER_ENV 1
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_ARM64_LINUX26_ENV 1
+#define AFS_ARM64_LINUX_ENV 1
#define AFS_LINUX_64BIT_KERNEL 1
#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits */
#define AFS_64BITUSERPOINTER_ENV 1
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_ARM_LINUX20_ENV 1
-#define AFS_ARM_LINUX22_ENV 1
-#define AFS_ARM_LINUX24_ENV 1
-#define AFS_ARM_LINUX26_ENV 1
+#define AFS_ARM_LINUX_ENV 1
#else /* !defined(UKERNEL) */
--- /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
+# 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
+
+# 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_NAME "amd64_darwin_200"
+# define SYS_NAME_ID SYS_NAME_ID_amd64_darwin_200
+# 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_NAME "arm_darwin_200"
+# define SYS_NAME_ID SYS_NAME_ID_arm_darwin_200
+# 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
+# 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
+
+# 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_NAME "amd64_darwin_210"
+# define SYS_NAME_ID SYS_NAME_ID_amd64_darwin_210
+# 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_NAME "arm_darwin_210"
+# define SYS_NAME_ID SYS_NAME_ID_arm_darwin_210
+# 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
+# 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 AFS_PARAM_H
+#define AFS_PARAM_H
+
+/* Machine / Operating system information */
+#define SYS_NAME "i386_fbsd_122"
+#define SYS_NAME_ID SYS_NAME_ID_i386_fbsd_122
+
+#define AFS_FAKEOPEN_ENV 1 /* call afs_FakeOpen as if !AFS_VM_RDWR */
+
+#ifndef UKERNEL
+/* This section for kernel libafs compiles only */
+
+#define AFS_FBSD101_ENV 1
+#define AFS_FBSD102_ENV 1
+#define AFS_FBSD103_ENV 1
+#define AFS_FBSD104_ENV 1
+#define AFS_FBSD110_ENV 1
+#define AFS_FBSD111_ENV 1
+#define AFS_FBSD120_ENV 1
+#define AFS_FBSD121_ENV 1
+#define AFS_FBSD122_ENV 1
+
+#define AFS_X86_FBSD101_ENV 1
+#define AFS_X86_FBSD102_ENV 1
+#define AFS_X86_FBSD103_ENV 1
+#define AFS_X86_FBSD104_ENV 1
+#define AFS_X86_FBSD110_ENV 1
+#define AFS_X86_FBSD111_ENV 1
+#define AFS_X86_FBSD120_ENV 1
+#define AFS_X86_FBSD121_ENV 1
+#define AFS_X86_FBSD122_ENV 1
+
+#else /* !defined(UKERNEL) */
+
+/* This section for user space compiles only */
+
+#define AFS_USR_FBSD101_ENV 1
+#define AFS_USR_FBSD102_ENV 1
+#define AFS_USR_FBSD103_ENV 1
+#define AFS_USR_FBSD104_ENV 1
+#define AFS_USR_FBSD110_ENV 1
+#define AFS_USR_FBSD111_ENV 1
+#define AFS_USR_FBSD120_ENV 1
+#define AFS_USR_FBSD121_ENV 1
+#define AFS_USR_FBSD122_ENV 1
+
+#endif /* !defined(UKERNEL) */
+
+#endif /* AFS_PARAM_H */
--- /dev/null
+#ifndef AFS_PARAM_H
+#define AFS_PARAM_H
+
+/* Machine / Operating system information */
+#define SYS_NAME "i386_fbsd_123"
+#define SYS_NAME_ID SYS_NAME_ID_i386_fbsd_123
+
+#define AFS_FAKEOPEN_ENV 1 /* call afs_FakeOpen as if !AFS_VM_RDWR */
+
+#ifndef UKERNEL
+/* This section for kernel libafs compiles only */
+
+#define AFS_FBSD101_ENV 1
+#define AFS_FBSD102_ENV 1
+#define AFS_FBSD103_ENV 1
+#define AFS_FBSD104_ENV 1
+#define AFS_FBSD110_ENV 1
+#define AFS_FBSD111_ENV 1
+#define AFS_FBSD120_ENV 1
+#define AFS_FBSD121_ENV 1
+#define AFS_FBSD122_ENV 1
+#define AFS_FBSD123_ENV 1
+
+#define AFS_X86_FBSD101_ENV 1
+#define AFS_X86_FBSD102_ENV 1
+#define AFS_X86_FBSD103_ENV 1
+#define AFS_X86_FBSD104_ENV 1
+#define AFS_X86_FBSD110_ENV 1
+#define AFS_X86_FBSD111_ENV 1
+#define AFS_X86_FBSD120_ENV 1
+#define AFS_X86_FBSD121_ENV 1
+#define AFS_X86_FBSD122_ENV 1
+#define AFS_X86_FBSD123_ENV 1
+
+#else /* !defined(UKERNEL) */
+
+/* This section for user space compiles only */
+
+#define AFS_USR_FBSD101_ENV 1
+#define AFS_USR_FBSD102_ENV 1
+#define AFS_USR_FBSD103_ENV 1
+#define AFS_USR_FBSD104_ENV 1
+#define AFS_USR_FBSD110_ENV 1
+#define AFS_USR_FBSD111_ENV 1
+#define AFS_USR_FBSD120_ENV 1
+#define AFS_USR_FBSD121_ENV 1
+#define AFS_USR_FBSD122_ENV 1
+#define AFS_USR_FBSD123_ENV 1
+
+#endif /* !defined(UKERNEL) */
+
+#endif /* AFS_PARAM_H */
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_I386_LINUX20_ENV 1
-#define AFS_I386_LINUX22_ENV 1
-#define AFS_I386_LINUX24_ENV 1
-#define AFS_I386_LINUX26_ENV 1
+#define AFS_I386_LINUX_ENV 1
#else /* !defined(UKERNEL) */
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_I386_LINUX20_ENV 1
-#define AFS_I386_LINUX22_ENV 1
-#define AFS_I386_LINUX24_ENV 1
-#define AFS_I386_LINUX26_ENV 1
+#define AFS_I386_LINUX_ENV 1
#else /* !defined(UKERNEL) */
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_IA64_LINUX20_ENV 1
-#define AFS_IA64_LINUX22_ENV 1
-#define AFS_IA64_LINUX24_ENV 1
-#define AFS_IA64_LINUX26_ENV 1
+#define AFS_IA64_LINUX_ENV 1
#define AFS_LINUX_64BIT_KERNEL 1
#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */
#define AFS_64BITUSERPOINTER_ENV 1
/* This section for kernel libafs compiles only */
#include <linux/version.h>
-#define AFS_LINUX20_ENV 1
-#define AFS_LINUX22_ENV 1
-#define AFS_LINUX24_ENV 1
-#define AFS_LINUX26_ENV 1
+#define AFS_LINUX_ENV 1
#define AFS_64BIT_IOPS_ENV 1
#define AFS_NAMEI_ENV 1 /* User space interface to file system */
#define AFS_USERSPACE_IP_ADDR 1
#define RXK_LISTENER_ENV 1
#define AFS_GCPAGS 1 /* Set to Userdisabled, allow sysctl to override */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
-# define AFS_PAG_ONEGROUP_ENV 1
-#endif
+#define AFS_PAG_ONEGROUP_ENV 1
#define AFS_HAVE_FFS 1 /* Use system's ffs */
#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */
#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */
#define AFS_PRIVATE_OSI_ALLOCSPACES 1
-#if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+#if defined(__KERNEL__)
#define AFS_GLOBAL_SUNLOCK
-#endif /* __KERNEL__ && !DUMP_KERNEL */
+#endif /* __KERNEL__ */
#ifdef KERNEL
#ifndef MIN
#else /* !defined(UKERNEL) */
/* This section for user space compiles only */
-#define AFS_USR_LINUX20_ENV 1
-#define AFS_USR_LINUX22_ENV 1
-#define AFS_USR_LINUX24_ENV 1
-#define AFS_USR_LINUX26_ENV 1
+
+#define AFS_USR_LINUX_ENV 1
#define AFS_ENV 1
#define AFS_64BIT_CLIENT 1
#ifndef UKERNEL
/* This section for kernel space compiles only */
-#define AFS_PPC64_LINUX20_ENV 1
-#define AFS_PPC64_LINUX22_ENV 1
-#define AFS_PPC64_LINUX24_ENV 1
-#define AFS_PPC64_LINUX26_ENV 1
+#define AFS_PPC64_LINUX_ENV 1
#define AFS_LINUX_64BIT_KERNEL 1
#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits */
#define AFS_64BITUSERPOINTER_ENV 1
#ifndef UKERNEL
/* This section for kernel space compiles only */
-#define AFS_PPC64_LINUX20_ENV 1
-#define AFS_PPC64_LINUX22_ENV 1
-#define AFS_PPC64_LINUX24_ENV 1
-#define AFS_PPC64_LINUX26_ENV 1
+#define AFS_PPC64_LINUX_ENV 1
#define AFS_LINUX_64BIT_KERNEL 1
#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits */
#define AFS_64BITUSERPOINTER_ENV 1
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_PPC_LINUX20_ENV 1
-#define AFS_PPC_LINUX22_ENV 1
-#define AFS_PPC_LINUX24_ENV 1
-#define AFS_PPC_LINUX26_ENV 1
+#define AFS_PPC_LINUX_ENV 1
#else /* !defined(UKERNEL) */
--- /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) */
--- /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_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_aix72"
+#define SYS_NAME_ID SYS_NAME_ID_rs_aix72
+#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_aix72"
+#define SYS_NAME_ID SYS_NAME_ID_rs_aix72
+#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) */
--- /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) */
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_S390_LINUX20_ENV 1
-#define AFS_S390_LINUX22_ENV 1
-#define AFS_S390_LINUX24_ENV 1
-#define AFS_S390_LINUX26_ENV 1
+#define AFS_S390_LINUX_ENV 1
#else /* !defined(UKERNEL) */
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_S390_LINUX20_ENV 1
-#define AFS_S390_LINUX22_ENV 1
-#define AFS_S390_LINUX24_ENV 1
-#define AFS_S390_LINUX26_ENV 1
-#define AFS_S390X_LINUX20_ENV 1
-#define AFS_S390X_LINUX22_ENV 1
-#define AFS_S390X_LINUX24_ENV 1
-#define AFS_S390X_LINUX26_ENV 1
+#define AFS_S390_LINUX_ENV 1
+#define AFS_S390X_LINUX_ENV 1
#define AFS_64BITPOINTER_ENV 1
#define AFS_64BITUSERPOINTER_ENV 1
/* This section for user space compiles only */
#define UKERNEL 1 /* user space kernel */
-#define AFS_S390X_LINUX20_ENV 1
-#define AFS_S390X_LINUX22_ENV 1
-#define AFS_S390X_LINUX24_ENV 1
-#define AFS_S390X_LINUX26_ENV 1
+#define AFS_S390X_LINUX_ENV 1
#define AFS_64BITPOINTER_ENV 1
#define AFS_64BITUSERPOINTER_ENV 1
#define AFS_ENV 1 /* NOBODY uses this.... */
#define CMUSTD_ENV 1 /* NOBODY uses this.... */
#define AFS_SGI_ENV 1
-#define AFS_SGI51_ENV 1 /* Dist from 5.0.1 */
-#define AFS_SGI52_ENV 1
-#define AFS_SGI53_ENV 1
-#define AFS_SGI61_ENV 1
-#define AFS_SGI62_ENV 1
-#define AFS_SGI63_ENV 1
-#define AFS_SGI64_ENV 1
#define AFS_SGI65_ENV 1
#define AFS_SGI_EXMAG 1 /* use magic fields in extents for AFS extra fields */
/* AFS_SGI_SHORTSTACK not required since we have a 16K stack. */
#define AFS_GREEDY43_ENV 1 /* Used only in rx/rx_user.c */
#define AFS_ENV 1
#define AFS_USR_SGI_ENV 1
-#define AFS_USR_SGI62_ENV 1
-#define AFS_USR_SGI63_ENV 1
-#define AFS_USR_SGI64_ENV 1
#define AFS_USR_SGI65_ENV 1
/*#define AFS_GLOBAL_SUNLOCK 1 *//* For global locking */
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_SPARC64_LINUX20_ENV 1
-#define AFS_SPARC64_LINUX22_ENV 1
-#define AFS_SPARC64_LINUX24_ENV 1
-#define AFS_SPARC64_LINUX26_ENV 1
+#define AFS_SPARC64_LINUX_ENV 1
#define AFS_LINUX_64BIT_KERNEL 1
#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */
#define AFS_32BIT_USR_ENV 1 /* user level processes are 32bit */
#ifndef UKERNEL
/* This section for kernel libafs compiles only */
-#define AFS_SPARC_LINUX20_ENV 1
-#define AFS_SPARC_LINUX22_ENV 1
-#define AFS_SPARC_LINUX24_ENV 1
+#define AFS_SPARC_LINUX_ENV 1
-#if defined(__KERNEL__) && !defined(KDUMP_KERNEL)
+#if defined(__KERNEL__)
#if defined(AFS_SMP) && defined(CONFIG_MODVERSIONS)
/* hack, I don't know what else with theese symbols */
#define _do_spin_lock _do_spin_lock_R__ver__do_spin_lock
#define _do_spin_unlock _do_spin_unlock_R__ver__do_spin_unlock
#define kernel_flag kernel_flag_R__ver_kernel_flag
#endif
-#endif /* __KERNEL__ && !DUMP_KERNEL */
+#endif /* __KERNEL__ */
/*
* on sparclinux is O_LARGEFILE defined but there is not off64_t,
#define AFS_HAVE_FFS 1 /* Use system's ffs. */
#define AFS_GCPAGS 0
-#define RXK_UPCALL_ENV 1
+#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
# define AFS_NONNULL(x)
#endif
-#if defined(AFS_LINUX26_ENV) && defined(fallthrough)
+#if defined(AFS_LINUX_ENV) && defined(fallthrough)
# define AFS_FALLTHROUGH fallthrough
#elif defined(HAVE_FUNC_ATTRIBUTE_FALLTHROUGH)
# define AFS_FALLTHROUGH __attribute__((fallthrough))
#define VIOCPRECACHE _CVICEIOCTL(12) /* precache size */
#define VIOC_GETPAG _CVICEIOCTL(13) /* get pag value */
#define VIOC_FLUSHALL _CVICEIOCTL(14) /* flush all volume data */
+#define VIOC_GETLITERALFID _CVICEIOCTL(15) /* get fid from parent directory */
/* OpenAFS-specific 'O' pioctl's */
#define VIOC_NFS_NUKE_CREDS _OVICEIOCTL(1) /* nuke creds for all PAG's */
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;}
# undef HAVE_ARC4RANDOM
#endif
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX_ENV)
/*
* gettimeofday is only used in rand-fortuna.c, not built for Linux.
* Linux 5.6 removes the native struct timeval, so this stub would not build.
{if (tp == NULL) return -1; tp->tv_sec = osi_Time(); tp->tv_usec = 0; return 0;}
#endif
-#if defined(KERNEL) && (defined(AFS_SUN5_ENV) || defined(AFS_ARM64_LINUX26_ENV))
+#if defined(KERNEL) && (defined(AFS_SUN5_ENV) || defined(AFS_ARM64_LINUX_ENV))
/*
* Some functions such as RAND_add take a 'double' as an argument, but floating
* point code generally cannot be used in kernelspace. We never actually use
rand.c
rand-timer.c
evp-hcrypto.h
-strcasecmp.c
heim_threads.h
+#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 */
+++ /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
- */
-
-const char hckernel_strcasecmp_placeholder[] =
- "This is not an empty compilation unit.";
-
-#ifndef afs_strcasecmp
-int
-afs_strcasecmp(const char *s1, const char *s2)
-{
- while (*s1 && *s2) {
- char c1, c2;
-
- c1 = *s1++;
- c2 = *s2++;
- if (c1 >= 'A' && c1 <= 'Z')
- c1 += 0x20;
- if (c2 >= 'A' && c2 <= 'Z')
- c2 += 0x20;
- if (c1 != c2)
- return c1 - c2;
- }
-
- return *s1 - *s2;
-}
-#endif
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"
.PHONY: test
test: ${TOP_LIBDIR}/libdir.a
- cd test && $(MAKE)
+ cd test && $(MAKE) all
buffer.o: buffer.c dir.h
#
clean:
$(RM) -f *.o *.a core AFS_component_version_number.c
+ cd test && $(MAKE) clean
include ../config/Makefile.version
#include <afsconfig.h>
#include <afs/param.h>
+#include <afs/afsint.h>
#ifdef KERNEL
# if !defined(UKERNEL)
# include "h/types.h"
-# if !defined(AFS_LINUX26_ENV)
+# if !defined(AFS_LINUX_ENV)
# include "h/param.h"
# endif
# ifdef AFS_AUX_ENV
# include "h/errno.h"
# endif
# include "h/time.h"
-# if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV)
+# if defined(AFS_AIX_ENV) || defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_LINUX_ENV)
# include "h/errno.h"
# else
-# if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV)
+# if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX_ENV)
# 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
-# if !defined(AFS_SGI64_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_OBSD48_ENV) && !defined(AFS_NBSD_ENV)
+# 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_SGI64_ENV */
+# endif /* AFS_SGI_ENV */
# include "h/uio.h"
-# if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_HPUX110_ENV)
+# if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_HPUX110_ENV)
# include "h/mbuf.h"
# endif
-# ifndef AFS_LINUX20_ENV
+# ifndef AFS_LINUX_ENV
# include "netinet/in.h"
# endif
+# include "afsincludes.h"
# else /* !defined(UKERNEL) */
# include "afs/stds.h"
# include "afs/sysincludes.h"
+# include "afsincludes.h"
# endif /* !defined(UKERNEL) */
/* afs_buffer.c */
# include "afs/dir.h"
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
# include "h/string.h"
# endif
int blobs, firstelt;
int i;
struct DirBuffer entrybuf, prevbuf, headerbuf;
- struct DirEntry *ep;
+ struct DirEntryFlex *ep;
struct DirHeader *dhp;
int code;
+ size_t rlen;
/* check name quality */
if (*entry == 0)
/* 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]);
ep->fid.vunique = htonl(vfid[2]);
- strcpy(ep->name, entry);
+
+ /*
+ * Note, the size of ep->name does not represent the maximum size of the
+ * name. FindBlobs has already ensured that the name can fit.
+ */
+ rlen = strlcpy(ep->name, entry, AFSNAMEMAX + 1);
+ if (rlen >= AFSNAMEMAX + 1) {
+ DRelease(&entrybuf, 1);
+ return ENAMETOOLONG;
+ }
/* Now we just have to thread it on the hash table list. */
if (DRead(dir, 0, &headerbuf) != 0) {
struct DirBuffer entrybuf;
struct DirEntry *entry;
int code = 0;
+ size_t rlen;
code = FindFid(dir, vnode, unique, &entrybuf);
if (code) {
}
entry = (struct DirEntry *)entrybuf.data;
- if (strlen(entry->name) >= length)
+ rlen = strlcpy(name, entry->name, length);
+ if (rlen >= length) {
code = E2BIG;
- else
- strcpy(name, entry->name);
+ }
DRelease(&entrybuf, 0);
return code;
}
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;
}
$(RM) -f *.o *.a test dtest core
dtest: dtest.o
- $(AFS_LDRULE) dtest.o $(LIBS)
+ $(AFS_LDRULE) dtest.o $(LIBS) $(LIB_roken) $(XLIBS)
# 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_builddir)/src/afs/unified_afs.o
+
all: translate_et
-translate_et: translate_et.o ${INCLS}
- $(AFS_LDRULE) translate_et.o ${LIBS} $(LIB_roken)
+translate_et: translate_et.o ${OBJS} ${INCLS}
+ $(AFS_LDRULE) translate_et.o ${OBJS} ${LIBS} $(LIB_roken)
translate_et.o: AFS_component_version_number.c
#include <afs/bnode.h>
#include <afs/afsint.h>
#include <afs/volser.h>
+#include <afs/unified_afs.h>
#include <ubik.h>
+
#define ERRCODE_RANGE 8 /* from error_table.h */
#include "AFS_component_version_number.c"
initialize_BZ_error_table();
initialize_U_error_table();
initialize_VOLS_error_table();
+ initialize_uae_error_table();
if (argc < 2) {
fprintf(stderr, "Usage is: %s [<code>]+\n", argv[0]);
AFSVolSync *Sync
) split = 133;
-StoreACL(
+/* Deprecated - CVE-2018-7168 */
+OldStoreACL(
IN AFSFid *Fid,
AFSOpaque *AccessList,
OUT AFSFetchStatus *OutStatus,
AFSVolSync *Sync
) = 163;
+StoreACL(
+ IN AFSFid *Fid,
+ AFSOpaque *AccessList,
+ OUT AFSFetchStatus *OutStatus,
+ AFSVolSync *Sync
+) = 164;
+
FsCmd(
IN AFSFid *Fid,
IN struct FsCmdInputs *Inputs,
) = 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_CreateFile
RXAFS_FetchStatus
RXAFS_GetTime
+RXAFS_GetStatistics
+RXAFS_GetStatistics64
RXAFS_GiveUpCallBacks
RXAFS_MakeDir
+RXAFS_OpCodeIndex
RXAFS_ReleaseLock
RXAFS_RemoveDir
RXAFS_RemoveFile
wait.tv_nsec = tv.tv_usec * 1000;
opr_mutex_enter(&fsprobe_force_lock);
code = opr_cv_timedwait(&fsprobe_force_cv, &fsprobe_force_lock, &wait);
- opr_Assert(code == 0 || code == ETIMEDOUT);
opr_mutex_exit(&fsprobe_force_lock);
} /*Service loop */
AFS_UNREACHED(free(stats64.ViceStatistics64_val));
*/
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;
-}
fsprobe_Cleanup
fsprobe_ForceProbeNow
fsprobe_Init
+fsprobe_Results
fsprobe_Wait
#include <roken.h>
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
+#if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_FBSD_ENV)
#include <sgtty.h>
#endif
gtxframe_RemoveFromList
gtxframe_SelfInsertCmd
gtxframe_SetFrame
+gtxframe_exitValue
gtx_Init
gtx_InputServer
gw_init
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);
#define LOG_TGTREQUEST 8
#ifdef AUTH_DBM_LOG
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#include <gdbm.h>
#define dbm_store gdbm_store
#define dbm_firstkey gdbm_firstkey
#define DBM GDBM_FILE
#define DBM_REPLACE GDBM_REPLACE
-#else /* AFS_LINUX20_ENV */
+#else /* AFS_LINUX_ENV */
#include <ndbm.h>
#define afs_dbm_nextkey(d, k) dbm_nextkey(d)
#endif
int MinHours = 0;
int npwSums = KA_NPWSUMS; /* needs to be variable sometime */
-#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
+#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
#undef vfprintf
#define vfprintf(stream,fmt,args) _doprnt(fmt,args,stream)
#endif
* On Linux, dbm is not part of the standard installation, and we can't
* statically link it in. So, ignore it for now.
*/
-%#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
+%#if !defined(AFS_HPUX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX_ENV)
%#define AUTH_DBM_LOG
%#endif
#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)
+KAA_function_names
+KAM_function_names
+KAT_function_names
initialize_KA_error_table
ka_AuthServerConn
ka_AuthSpecificServersConn
}
#endif
-#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_USR_LINUX20_ENV) && (!defined(AFS_XBSD_ENV) || defined(AFS_FBSD_ENV))
+#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_USR_LINUX_ENV) && (!defined(AFS_XBSD_ENV) || defined(AFS_FBSD_ENV))
/* handle smoothly the case where no AFS system calls exists (yet) */
(void)signal(SIGSYS, SIG_IGN);
#endif
RXKAD = ../../rxkad
+AFS = ../../afs
AUTH = ../../auth
BOZO = ../../bozo
CMD = ../../cmd
cmd_errors.o \
pterror.o \
uerrors.o \
+ unified_afs.o \
vl_errors.o \
acfg_errors.o \
volerr.o
volerr.o: ${VOLSER}/volerr.c
$(AFS_CCRULE) $(VOLSER)/volerr.c
+unified_afs.o: ${AFS}/unified_afs.c
+ $(AFS_CCRULE) $(AFS)/unified_afs.c
+
${LIBOBJS}: ${INCLS}
clean:
!include ..\..\config\NTMakefile.version
RXKAD = ..\..\rxkad
+AFS = ..\..\afs
AUTH = ..\..\auth
BOZO = ..\..\bozo
CMD = ..\..\cmd
ADMINOBJS = \
$(OUT)\afs_utilAdmin.obj
+AFSOBJS=\
+ $(OUT)\unified_afs.obj
+
DLLOBJS =\
$(ADMINOBJS) \
$(ERRORSOBJS) \
$(VOLSEROBJS) \
$(UBIKOBJS) \
$(RXKADOBJS) \
+ $(AFSOBJS) \
$(OUT)\afsadminutil.res
LIBINCLUDES = \
$(AUTHOBJS): $(AUTH)\$$(@B).c
$(C2OBJ) -I$*(*D) $**
+$(AFSOBJS): $(AFS)\$$(@B).c
+ $(C2OBJ) -I$*(*D) $**
+
$(BOZOOBJS): $(BOZO)\$$(@B).c
$(C2OBJ) -I$*(*D) $**
ec ADMRXDEBUGHANDLENULL, "the rxdebug handle parameter cannot be null"
ec ADMRXDEBUGVERSIONNULL, "the rxdebug version parameter cannot be null"
ec ADMRXDEBUGSTATSNULL, "the rxdebug stats parameter cannot be null"
+ ec ADMRPCTOOBIG, "the rpc output data exceeds buffer size."
end
#include <afs/bnode.h>
#include <afs/afscbint.h>
#include <afs/volser.h>
+#include <afs/unified_afs.h>
#include "afs_AdminInternal.h"
#include "afs_utilAdmin.h"
initialize_AU_error_table();
initialize_AV_error_table();
initialize_VOLS_error_table();
+ initialize_uae_error_table();
#ifdef AFS_KRB5_ERROR_ENV
initialize_krb5();
#endif
*/
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;
int rc = 0;
afs_status_t tst = 0;
cm_list_cell_get_p t = (cm_list_cell_get_p) rpc_specific;
- char *name;
+ char *name = NULL;
+ size_t len;
serverList sl;
unsigned int n;
/*
* Get the next entry in the CellServDB.
*/
- name = t->cell[slot].cellname;
sl.serverList_len = 0;
sl.serverList_val = NULL;
memset(t->cell[slot].serverAddr, 0, sizeof(afs_int32)*UTIL_MAX_CELL_HOSTS);
if (tst) {
goto fail_ListCellsRPC;
}
- strcpy(t->cell[slot].cellname, name);
+ len = strlcpy(t->cell[slot].cellname, name, sizeof(t->cell[slot].cellname));
+ if (len >= sizeof(t->cell[slot].cellname)) {
+ tst = ADMRPCTOOBIG;
+ goto fail_ListCellsRPC;
+ }
if (sl.serverList_val) {
for (n=0; n<sl.serverList_len && n<UTIL_MAX_CELL_HOSTS; n++) {
t->cell[slot].serverAddr[n] = sl.serverList_val[n];
}
- xdr_free((xdrproc_t) xdr_serverList, &sl);
}
/*
rc = 1;
fail_ListCellsRPC:
+ xdr_free((xdrproc_t) xdr_serverList, &sl);
+ xdr_free((xdrproc_t) xdr_string, &name);
if (st != NULL) {
*st = tst;
{
int rc = 0;
afs_status_t tst = 0;
- afs_CMCellName_p name;
+ char *name = NULL;
+ size_t len;
if (conn == NULL) {
tst = ADMRXCONNNULL;
goto fail_util_CMLocalCell;
}
- name = cellName;
tst = RXAFSCB_GetLocalCell(conn, &name);
+ if (tst != 0) {
+ goto fail_util_CMLocalCell;
+ }
- if (!tst) {
- rc = 1;
+ len = strlcpy(cellName, name, sizeof(cellName));
+ if (len >= sizeof(cellName)) {
+ tst = ADMRPCTOOBIG;
+ goto fail_util_CMLocalCell;
}
+ rc = 1;
fail_util_CMLocalCell:
+ xdr_free((xdrproc_t)xdr_string, &name);
if (st != NULL) {
*st = tst;
}
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_status_t tst = 0;
bos_server_p b_handle = (bos_server_p) serverHandle;
afs_int32 state;
+ char *desc = NULL;
+ size_t len;
if (!isValidServerHandle(b_handle, &tst)) {
goto fail_bos_ProcessExecutionStateGet;
}
tst =
- BOZO_GetStatus(b_handle->server, processName, &state,
- &auxiliaryProcessStatus);
-
+ BOZO_GetStatus(b_handle->server, processName, &state, &desc);
if (tst != 0) {
goto fail_bos_ProcessExecutionStateGet;
}
+ /* This function assumes the caller provides a BOS_MAX_NAME_LEN sized buffer. */
+ len = strlcpy(auxiliaryProcessStatus, desc, BOS_MAX_NAME_LEN);
+ if (len >= BOS_MAX_NAME_LEN) {
+ tst = ADMRPCTOOBIG;
+ goto fail_bos_ProcessExecutionStateGet;
+ }
*processStatusP = (bos_ProcessExecutionState_t) state;
+
rc = 1;
fail_bos_ProcessExecutionStateGet:
+ xdr_free((xdrproc_t)xdr_string, &desc);
if (st != NULL) {
*st = tst;
}
int rc = 0;
afs_status_t tst = 0;
process_name_get_p proc = (process_name_get_p) rpc_specific;
- char *ptr = (char *)&proc->process[slot];
+ char *name = NULL;
+ size_t len;
- tst = BOZO_EnumerateInstance(proc->server, proc->next++, &ptr);
+ tst = BOZO_EnumerateInstance(proc->server, proc->next++, &name);
if (tst == 0) {
+ len = strlcpy(proc->process[slot], name, sizeof(proc->process[slot]));
+ if (len >= sizeof(proc->process[slot])) {
+ tst = ADMRPCTOOBIG;
+ goto fail_GetProcessNameRPC;
+ }
rc = 1;
} else if (tst == BZDOM) {
tst = 0;
*last_item_contains_data = 0;
}
+ fail_GetProcessNameRPC:
+
+ xdr_free((xdrproc_t)xdr_string, &name);
if (st != NULL) {
*st = tst;
}
int rc = 0;
afs_status_t tst = 0;
bos_server_p b_handle = (bos_server_p) serverHandle;
- char type[BOS_MAX_NAME_LEN];
- char *ptr = type;
+ char *type = NULL;
struct bozo_status status;
int i;
goto fail_bos_ProcessInfoGet;
}
- tst = BOZO_GetInstanceInfo(b_handle->server, processName, &ptr, &status);
+ tst = BOZO_GetInstanceInfo(b_handle->server, processName, &type, &status);
if (tst != 0) {
goto fail_bos_ProcessInfoGet;
}
-
for (i = 0; (processTypes[i] != NULL); i++) {
if (!strcmp(processTypes[i], type)) {
*processTypeP = (bos_ProcessType_t) i;
fail_bos_ProcessInfoGet:
+ xdr_free((xdrproc_t)xdr_string, &type);
if (st != NULL) {
*st = tst;
}
int rc = 0;
afs_status_t tst = 0;
param_get_p param = (param_get_p) rpc_specific;
- char *ptr = (char *)¶m->param[slot];
+ char *parm = NULL;
+ size_t len;
tst =
BOZO_GetInstanceParm(param->server, param->processName, param->next++,
- &ptr);
+ &parm);
if (tst == 0) {
+ len = strlcpy(param->param[slot], parm, sizeof(param->param[slot]));
+ if (len >= sizeof(param->param[slot])) {
+ tst = ADMRPCTOOBIG;
+ goto fail_GetParameterRPC;
+ }
rc = 1;
} else if (tst == BZDOM) {
tst = 0;
*last_item_contains_data = 0;
}
+ fail_GetParameterRPC:
+
+ xdr_free((xdrproc_t)xdr_string, &parm);
if (st != NULL) {
*st = tst;
}
int rc = 0;
afs_status_t tst = 0;
admin_get_p admin = (admin_get_p) rpc_specific;
- char *ptr = (char *)&admin->admin[slot];
+ char *name = NULL;
+ size_t len;
- tst = BOZO_ListSUsers(admin->server, admin->next++, &ptr);
+ tst = BOZO_ListSUsers(admin->server, admin->next++, &name);
/*
* There's no way to tell the difference between an rpc failure
* and the end of the list, so we assume that any error means the
* end of the list
*/
-
- if (tst != 0) {
+ if (tst == 0) {
+ len = strlcpy(admin->admin[slot], name, sizeof(admin->admin[slot]));
+ if (len >= sizeof(admin->admin[slot])) {
+ tst = ADMRPCTOOBIG;
+ goto fail_GetAdminRPC;
+ }
+ } else {
tst = 0;
*last_item = 1;
*last_item_contains_data = 0;
}
rc = 1;
+ fail_GetAdminRPC:
+
+ xdr_free((xdrproc_t)xdr_string, &name);
if (st != NULL) {
*st = tst;
}
int rc = 0;
afs_status_t tst = 0;
bos_server_p b_handle = (bos_server_p) serverHandle;
+ char *tcellname = NULL;
+ size_t len;
if (!isValidServerHandle(b_handle, &tst)) {
goto fail_bos_CellGet;
goto fail_bos_CellGet;
}
- tst = BOZO_GetCellName(b_handle->server, &cellName);
+ tst = BOZO_GetCellName(b_handle->server, &tcellname);
+ if (tst != 0) {
+ goto fail_bos_CellGet;
+ }
- if (tst == 0) {
- rc = 1;
+ /* This function assumes the caller provides a BOS_MAX_NAME_LEN sized buffer. */
+ len = strlcpy(cellName, tcellname, BOS_MAX_NAME_LEN);
+ if (len >= BOS_MAX_NAME_LEN) {
+ tst = ADMRPCTOOBIG;
+ goto fail_bos_CellGet;
}
+ rc = 1;
+
fail_bos_CellGet:
+ xdr_free((xdrproc_t)xdr_string, &tcellname);
if (st != NULL) {
*st = tst;
}
int rc = 0;
afs_status_t tst = 0;
host_get_p host = (host_get_p) rpc_specific;
- char *ptr = (char *)&host->host[slot];
+ char *name = NULL;
+ size_t len;
- tst = BOZO_GetCellHost(host->server, host->next++, &ptr);
+ tst = BOZO_GetCellHost(host->server, host->next++, &name);
if (tst == 0) {
+ len = strlcpy(host->host[slot], name, sizeof(host->host[slot]));
+ if (len >= sizeof(host->host[slot])) {
+ tst = ADMRPCTOOBIG;
+ goto fail_GetHostRPC;
+ }
rc = 1;
} else if (tst == BZDOM) {
tst = 0;
*last_item_contains_data = 0;
}
+ fail_GetHostRPC:
+
+ xdr_free((xdrproc_t)xdr_string, &name);
if (st != NULL) {
*st = tst;
}
short dbhostFound = 0;
while (!dbhostDone) {
- short isAlias;
+ short isAlias = 0;
if (!bos_HostGetNext(dbIter, hostNameAlias, &tst2)) {
/* no more entries (or failure) */
}
dbhostDone = 1;
- } else
- if (!cfgutil_HostNameIsAlias
- (hostName, hostNameAlias, &isAlias, &tst2)) {
- tst = tst2;
- dbhostDone = 1;
-
- } else if (isAlias) {
- dbhostFound = 1;
- dbhostDone = 1;
+ } else {
+ if (!cfgutil_HostNameIsAlias(hostName, hostNameAlias,
+ &isAlias, &tst2)) {
+ tst = tst2;
+ dbhostDone = 1;
+ } else if (isAlias) {
+ dbhostFound = 1;
+ dbhostDone = 1;
+ }
}
}
char auth_cell[MAXCELLCHARS];
char exec_cell[MAXCELLCHARS];
+ if (as->nParms < USER_PARAM)
+ return 0; /* no authentication parms defined for this subcommand */
+
/*
* Check what kind of authentication is necessary based upon
* the arguments passed
ts = cmd_CreateSyntax("UtilErrorTranslate", DoUtilErrorTranslate, NULL, 0,
"translate an error code");
cmd_AddParm(ts, "-error", CMD_SINGLE, CMD_REQUIRED, "error code");
- SetupCommonCmdArgs(ts);
+ /* don't add common args, they are not needed for this function */
ts = cmd_CreateSyntax("UtilDatabaseServerList", DoUtilDatabaseServerList,
NULL, 0, "list the database servers in a cell");
ts = cmd_CreateSyntax("UtilNameToAddress", DoUtilNameToAddress, NULL, 0,
"translate a host name to an address");
cmd_AddParm(ts, "-host", CMD_SINGLE, CMD_REQUIRED, "host name");
- SetupCommonCmdArgs(ts);
+ /* don't add common args, they are not needed for this function */
}
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,
int rc = 0;
afs_status_t tst = 0;
int noError;
- afs_int32 nentries, tentries = 0;
+ 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;
- tentries += nentries;
- 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 = \
rx_pag_packet.o \
rx_multi.o \
rx_stats.o \
- strcasecmp_pag.o \
+ afs_util.o \
opr_rbtree.o \
xdr_rx.o \
xdr_mem.o \
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_NOOPT) $(TOP_SRC_RX)/rx_packet.c
rx_pag_knet.o: $(TOP_SRC_RX)/${MKAFS_OSTYPE}/rx_knet.c
$(CRULE_NOOPT) $(TOP_SRC_RX)/${MKAFS_OSTYPE}/rx_knet.c
-strcasecmp_pag.o: $(TOP_SRCDIR)/crypto/hcrypto/kernel/strcasecmp.c
- $(CRULE_NOOPT) $(TOP_SRCDIR)/crypto/hcrypto/kernel/strcasecmp.c
# Crypto
md5.o: $(TOP_SRCDIR)/external/heimdal/hcrypto/md5.c
$(CRULE_OPT) $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_crypto.c
osi_kstat.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_kstat.c
$(CRULE_NOOPT) $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_kstat.c
+strlcat-kernel.o: $(TOP_SRCDIR)/external/heimdal/roken/strlcat.c
+ $(CRULE_OPT) $(TOP_SRCDIR)/external/heimdal/roken/strlcat.c
+strlcpy-kernel.o: $(TOP_SRCDIR)/external/heimdal/roken/strlcpy.c
+ $(CRULE_OPT) $(TOP_SRCDIR)/external/heimdal/roken/strlcpy.c
clean:
-$(RM) -rf STATIC* MODLOAD* $(AFS_OS_CLEAN)
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
KOPTS_ppc=-static -nostdinc -fno-builtin -finline -fno-keep-inline-functions -msoft-float -mlong-branch -fsigned-bitfields -arch ppc -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED -mcpu=750 -mmultiple -fschedule-insns -force_cpusubtype_ALL
KOPTS_x86=-static -nostdinc -fmessage-length=0 -pipe -nostdinc -fno-builtin -Wno-trigraphs -force_cpusubtype_ALL -msoft-float -O0 -fno-common -mkernel -finline -fno-keep-inline-functions -fasm-blocks -arch i386 -Di386 -DI386 -D__I386__ -DPAGE_SIZE_FIXED
KOPTS_amd64=-static -nostdinc -fno-builtin -finline -fno-keep-inline-functions -msoft-float -fsigned-bitfields -arch x86_64 -Damd64 -DAMD64 -D__AMD64__ -DPAGE_SIZE_FIXED -march=x86-64 -falign-functions=4 -m64 -mkernel -mno-red-zone
+KOPTS_arm64=-static -nostdinc -fno-builtin -finline -fsigned-bitfields -arch arm64e -Darm64e -DARM64E -D__ARM64E__ -DPAGE_SIZE_FIXED -falign-functions=4 -m64 -mkernel -mno-red-zone
ARCH_ppc=$(shell echo "${ARCHFLAGS}" | grep -q -w ppc && echo yes || echo ${ARCHFLAGS} | egrep -q -w -v 'ppc|i386|x86_64' && arch | grep -q -w ppc && echo yes)
ARCH_x86=$(shell echo "${ARCHFLAGS}" | grep -q -w i386 && echo yes || echo ${ARCHFLAGS} | egrep -q -w -v 'ppc|i386|x86_64' && arch | grep -q -w i386 && echo yes)
-ARCH_amd64=$(shell echo "${ARCHFLAGS}" | grep -q -w x86_64 && echo yes || echo ${ARCHFLAGS} | egrep -q -w -v 'ppc|i386|x86_64' && arch | grep -q -w x86_64 && echo yes)
+ARCH_amd64=$(shell echo "${ARCHFLAGS}" | grep -q -w x86_64 && echo yes || echo ${ARCHFLAGS} | egrep -q -w -v 'ppc|i386|x86_64|arm64' && arch | grep -q -w x86_64 && echo yes)
+ARCH_arm64=$(shell echo "${ARCHFLAGS}" | grep -q -w arm64 && echo yes || echo ${ARCHFLAGS} | egrep -q -w -v 'ppc|i386|x86_64|arm64' && arch | grep -q -w arm64 && echo yes)
OBJ_ppc=$(shell echo "${ARCH_ppc}" | grep -q -w yes && echo "$@.ppc")
OBJ_x86=$(shell echo "${ARCH_x86}" | grep -q -w yes && echo "$@.x86")
OBJ_amd64=$(shell echo "${ARCH_amd64}" | grep -q -w yes && echo "$@.amd64")
+OBJ_arm64=$(shell echo "${ARCH_arm64}" | grep -q -w yes && echo "$@.arm64")
+
+<all -ppc_darwin_70 -ppc_darwin_80 -x86_darwin_80 -ppc_darwin_90 -x86_darwin_90>
+KLINKER=-Xlinker -kext
+<all>
+MODLD=$(CC) -static $(KOPTS_DBUG) -nostdlib $(patsubst arm64,arm64e,$(ARCHFLAGS))
-<all -ppc_darwin_70 -ppc_darwin_80 -x86_darwin_80 -ppc_darwin_90 -x86_darwin_90 -x86_darwin_160 -x86_darwin_170 -x86_darwin_180 -x86_darwin_190>
-MODLD=$(CC) -static $(KOPTS_DBUG) -nostdlib $(ARCHFLAGS) -Xlinker -kext
-<ppc_darwin_70 ppc_darwin_80 x86_darwin_80 ppc_darwin_90 x86_darwin_90 x86_darwin_160 x86_darwin_170 x86_darwin_180 x86_darwin_190>
-MODLD=$(CC) -static $(KOPTS_DBUG) -nostdlib $(ARCHFLAGS)
<all>
-CFLAGS_ppc=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_ppc) $(KOPTS_DBUG)
-CFLAGS_x86=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_x86) $(KOPTS_DBUG)
-CFLAGS_amd64=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_amd64) $(KOPTS_DBUG)
+CFLAGS_ppc=-I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_ppc) $(KOPTS_DBUG)
+CFLAGS_x86=-I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_x86) $(KOPTS_DBUG)
+CFLAGS_amd64=-I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_amd64) $(KOPTS_DBUG)
+CFLAGS_arm64=-I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_arm64) $(KOPTS_DBUG)
<all>
# Name of directory to hold object files and libraries.
include Makefile.common
<all -ppc_darwin_70>
+ALL_COMMON_INCLUDES=$(KINCLUDES) $(COMMON_INCLUDE)
# override suffix rule; unfortunately, this causes a warning message
.c.o:
if [ "$(ARCH_ppc)" = "yes" ]; then \
- $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.o.ppc,$@) -c $< || exit(1) \
+ $(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.o.ppc,$@) -c $< || exit(1) \
fi \
if [ "$(ARCH_x86)" = "yes" ]; then \
- $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.o.x86,$@) -c $< || exit(1) \
+ $(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.o.x86,$@) -c $< || exit(1) \
fi
if [ "$(ARCH_amd64)" = "yes" ]; then \
- $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_amd64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.amd64,$@) -c $< || exit(1) \
+ $(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(CFLAGS_amd64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.amd64,$@) -c $< || exit(1) \
fi \
- lipo -create ${OBJ_ppc} ${OBJ_x86} ${OBJ_amd64} -output $@;
+ if [ "$(ARCH_arm64)" = "yes" ]; then \
+ $(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(CFLAGS_arm64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.arm64,$@) -c $< || exit(1) \
+ fi \
+ lipo -create ${OBJ_ppc} ${OBJ_x86} ${OBJ_amd64} ${OBJ_arm64} -output $@;
-CRULE_NOOPT_ppc=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.o.ppc,$@) -c $?
-CRULE_NOOPT_x86=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.o.x86,$@) -c $?
-CRULE_NOOPT_amd64=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_amd64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.amd64,$@) -c $?
-CRULE_NOOPT=$(shell echo "${ARCH_ppc}" | grep -q -w yes && echo "${CRULE_NOOPT_ppc} && "; echo "${ARCH_x86}" | grep -q -w yes && echo "${CRULE_NOOPT_x86} && "; echo "${ARCH_amd64}" | grep -q -w yes && echo "${CRULE_NOOPT_amd64} && "; echo " lipo -create ${OBJ_ppc} ${OBJ_x86} ${OBJ_amd64} -output $@ && true")
+CRULE_NOOPT_ppc=$(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.o.ppc,$@) -c $?
+CRULE_NOOPT_x86=$(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.o.x86,$@) -c $?
+CRULE_NOOPT_amd64=$(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(CFLAGS_amd64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.amd64,$@) -c $?
+CRULE_NOOPT_arm64=$(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(CFLAGS_arm64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.arm64,$@) -c $?
+CRULE_NOOPT=$(shell echo "${ARCH_ppc}" | grep -q -w yes && echo "${CRULE_NOOPT_ppc} && "; echo "${ARCH_x86}" | grep -q -w yes && echo "${CRULE_NOOPT_x86} && "; echo "${ARCH_amd64}" | grep -q -w yes && echo "${CRULE_NOOPT_amd64} && "; echo "${ARCH_arm64}" | grep -q -w yes && echo "${CRULE_NOOPT_arm64} && "; echo " lipo -create ${OBJ_ppc} ${OBJ_x86} ${OBJ_amd64} ${OBJ_arm64} -output $@ && true")
-CRULE_OPT_ppc=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.o.ppc,$@) -c $?
-CRULE_OPT_x86=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.o.x86,$@) -c $?
-CRULE_OPT_amd64=$(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_amd64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.amd64,$@) -c $?
-CRULE_OPT=$(shell echo "${ARCH_ppc}" | grep -q -w yes && echo "${CRULE_OPT_ppc} && "; echo "${ARCH_x86}" | grep -q -w yes && echo "${CRULE_OPT_x86} && "; echo "${ARCH_amd64}" | grep -q -w yes && echo "${CRULE_OPT_amd64} && ";echo "lipo -create ${OBJ_ppc} ${OBJ_x86} ${OBJ_amd64} -output $@ && true")
+CRULE_OPT_ppc=$(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.o.ppc,$@) -c $?
+CRULE_OPT_x86=$(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.o.x86,$@) -c $?
+CRULE_OPT_amd64=$(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_amd64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.amd64,$@) -c $?
+CRULE_OPT_arm64=$(CC) $(ALL_COMMON_INCLUDES) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_arm64) $(CFLAGS-$@) -o $(patsubst %.o,%.o.arm64,$@) -c $?
+CRULE_OPT=$(shell echo "${ARCH_ppc}" | grep -q -w yes && echo "${CRULE_OPT_ppc} && "; echo "${ARCH_x86}" | grep -q -w yes && echo "${CRULE_OPT_x86} && "; echo "${ARCH_amd64}" | grep -q -w yes && echo "${CRULE_OPT_amd64} && "; echo "${ARCH_arm64}" | grep -q -w yes && echo "${CRULE_OPT_arm64} && "; echo "lipo -create ${OBJ_ppc} ${OBJ_x86} ${OBJ_amd64} ${OBJ_arm64} -output $@ && true")
<ppc_darwin_70>
-CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS)
+CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS)
KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch
<all>
-mkdir -p ${DEST_LIBAFSNONFSDSYM}/Contents/Resources/DWARF
$(INSTALL) ${LIBAFSNONFSDSYM}/Contents/Info.plist ${DEST_LIBAFSNONFSDSYM}/Contents
$(INSTALL) ${LIBAFSNONFSDSYM}/Contents/Resources/DWARF/${LIBAFSNONFS} ${DEST_LIBAFSNONFSDSYM}/Contents/Resources/DWARF
+
<all>
${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
- $(MODLD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS} -lcc_kext
+ $(MODLD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS} -lcc_kext ${KLINKER}
-<all -x86_darwin_160 -x86_darwin_170 -x86_darwin_180 -x86_darwin_190>
-${LIBAFSNONFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
- $(MODLD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} -lcc_kext
-<x86_darwin_160 x86_darwin_170 x86_darwin_180 x86_darwin_190>
${LIBAFSNONFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
- $(MODLD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} -lcc_kext -Xlinker -kext
+ $(MODLD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} -lcc_kext ${KLINKER}
<all -ppc_darwin_70 -ppc_darwin_80 -x86_darwin_80>
$(LIBAFSDSYM): ${LIBAFS}
# We have some sketchy code that redeclares prototypes
CWARNFLAGS+= -Wno-redundant-decls
+GEN_KBLD_DIR=@abs_builddir@/kconf-GENERIC
+AFS_OS_CLEAN=$(GEN_KBLD_DIR)
+
+# Starting with FreeBSD 12, opt_global.h is effectively required to build, even
+# for the GENERIC kernel. Normally this would be provided in the kernel build
+# dir (--with-bsd-kernel-build). If that dir was not specified, we can still
+# get the needed header files if we assume that the user is building for the
+# GENERIC kernel. So if we don't have a kernel build dir, generate the header
+# files in GEN_KBLD_DIR by using config(8), and specify that as the
+# KERNBUILDDIR. This won't always work, of course, but it has a chance at
+# working for the most common setups (when the user isn't using some custom
+# kernel). The kernel headers, of course, we assume are in $(KSRC).
+$(GEN_KBLD_DIR):
+ -mkdir $(GEN_KBLD_DIR)
+ cd $(KSRC)/$(MACHINE)/conf && \
+ /usr/sbin/config -d $(GEN_KBLD_DIR) GENERIC
+
# setup for bsd.kmod.mk infrastructure
.PATH: ${TOP_SRCDIR}/afs/FBSD
KMODDIR=/boot/modules
KERN_DEBUGDIR=/usr/lib/debug
KMOD= libafs
SYSDIR= ${KSRC}
-.if !empty(KBLD)
+
+.if empty(KBLD)
+KERNBUILDDIR=$(GEN_KBLD_DIR)
+.else
KERNBUILDDIR=${KBLD}
.endif
# generating headers and objects in this directory, which we want in $(KOBJ).
# We also need the install target from bsd.kmod.mk in $(KOBJ), but the one
# from Makefile.common in this directory. A prime candidate for cleanup.
-setup:
+setup: $(KERNBUILDDIR)
-mkdir $(KOBJ)
-$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common
$(CP) Makefile $(KOBJ)/Makefile
${INSTALL} -m 644 sgi_master ${DEST}/root.client/bin/afs
# Create symlinks to clients we don't need to build.
-# If this changes, also change the kdump symlinks.
install_LINKFILES:
<sgi_65>
echo "Now we support also IP22_4K, IP22_5K, IP32_5K, IP32_10K cpu boards."
<all>
# Create symlinks to clients we don't need to build.
-# If this changes, also change the kdump symlinks.
dest_LINKFILES:
<sgi_65>
ln -fs libafs.IP20.a ${DEST}/root.client/bin/libafs.IP22.a
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
CFLAGS_opr_rbtree.o = -I${TOP_SRCDIR}/opr
CFLAGS_evp.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
- -DHAVE_CONFIG_H
-CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+ -DHAVE_CONFIG_H @CFLAGS_NOCAST_FUNCTION_TYPE@
+CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
+ @CFLAGS_NOCAST_FUNCTION_TYPE@
CFLAGS_evp-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
CFLAGS_rand-timer-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
CFLAGS_rand-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
--- /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>
--- /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";
pr_GetHostCPS
pr_IdToName
pr_Initialize
+pr_IsAMemberOf
pr_ListMembers
pr_NameToId
pr_SNameToId
if (server && server->naddrs > 0) {
for (j = 0; j < server->naddrs; j++) {
code = RXAFS_StoreACL(server->conns[j], &df, acl, &dfst, &vs);
+ if (code == RXGEN_OPCODE)
+ code = RXAFS_OldStoreACL(server->conns[j], &df, acl,
+ &dfst, &vs);
if (code >= 0)
break;
}
# Increment these according to libtool's versioning rules (look them up!)
# The library output looks like libafsrpc.so.<current - age>.<revision>
-LT_current = 2
+LT_current = 3
LT_revision = 0
LT_age = 0
multi_Finalize @96
multi_Select @97
multi_Init @98
- multi_Finalize_Ignore @99
+; multi_Finalize_Ignore @99
afs_add_to_error_table @100
xdr_afsUUID @101
rx_GetSpecific @102
ktohl
life_to_time
multi_Finalize
-multi_Finalize_Ignore
multi_Init
multi_Select
opr_AssertionFailed
osi_vfsops.lo: $(TOP_SRC_AFS)/UKERNEL/osi_vfsops.c
$(LT_CCRULE) $(TOP_SRC_AFS)/UKERNEL/osi_vfsops.c -DAFS_NONFSTRANS
ktc.lo: $(TOP_SRCDIR)/auth/ktc.c
- $(LT_CCRULE) $(TOP_SRCDIR)/auth/ktc.c @CFLAGS_NOERROR@
+ $(LT_CCRULE) $(TOP_SRCDIR)/auth/ktc.c
cellconfig.lo: $(TOP_SRCDIR)/auth/cellconfig.c
$(LT_CCRULE) $(TOP_SRCDIR)/auth/cellconfig.c
keys.lo: $(TOP_SRCDIR)/auth/keys.c
-$(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}
UAFS_CFLAGS=-fPIC
endif
-TEST_CFLAGS=-pthread -D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_LINUX22_ENV $(XCFLAGS)
+TEST_CFLAGS=-pthread -D_REENTRANT -DAFS_PTHREAD_ENV -DAFS_LINUX_ENV $(XCFLAGS)
TEST_LDFLAGS=
TEST_LIBS=-lpthread @LIB_crypt@
#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* ) \
amd64=`echo $${CURRENTBUILDARCH} | grep -q x86_64 && echo process.amd64.o` ; \
armv6=`echo $${CURRENTBUILDARCH} | grep -q armv6 && echo process.armv6.o` ; \
armv7=`echo $${CURRENTBUILDARCH} | grep -q armv7 && echo process.armv7.o` ; \
- if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${amd64}" -a -z "$${armv6}" -a -z "$${armv7}" ] ; then \
+ arm64=`echo $${CURRENTBUILDARCH} | grep -q arm64 && echo process.arm64.o` ; \
+ if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${amd64}" -a -z "$${armv6}" -a -z "$${armv7}" -a -z "$${arm64}" ] ; then \
if [ `arch` = ppc ] ; then \
ppc=yes ; \
else \
fi ; \
if [ -n "$${armv6}" ] ; then \
$(CC) -x assembler-with-cpp -c -arch armv6 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.default.s -o "$${armv6}" ; \
- if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${ppc}" -a -z "$${armv7}" ] ; then \
+ if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${ppc}" -a -z "$${armv7}" -a -z "$${arm64}" ] ; then \
${MV} "$${armv6}" process.o ; \
fi ; \
fi ; \
if [ -n "$${armv7}" ] ; then \
$(CC) -x assembler-with-cpp -c -arch armv7 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.default.s -o "$${armv7}" ; \
- if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${ppc}" -a -z "$${armv6}" ] ; then \
+ if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${ppc}" -a -z "$${armv6}" -a -z "$${arm64}" ] ; then \
${MV} "$${armv7}" process.o ; \
fi ; \
fi ; \
if [ -n "$${ppc}" ] ; then \
$(CC) ${LWP_DBG} ${LWP_OPTMZ} -c -arch ppc -I${TOP_INCDIR} ${srcdir}/process.default.s -o "$${ppc}" ; \
- if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${armv6}" -a -z "$${armv7}" ] ; then \
+ if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${armv6}" -a -z "$${armv7}" -a -z "$${arm64}" ] ; then \
${MV} "$${ppc}" process.o ; \
fi ; \
fi ; \
if [ -n "$${i386}" ] ; then \
$(CC) -x assembler-with-cpp -c -arch i386 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s -o "$${i386}" ; \
- if [ -z "$${ppc}" -a -z "$${amd64}" -a -z "$${armv6}" -a -z "$${armv7}" ] ; then \
+ if [ -z "$${ppc}" -a -z "$${amd64}" -a -z "$${armv6}" -a -z "$${armv7}" -a -z "$${arm64}" ] ; then \
${MV} "$${i386}" process.o ; \
fi ; \
fi ; \
if [ -n "$${amd64}" ] ; then \
$(CC) -x assembler-with-cpp -c -arch x86_64 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.amd64.s -o "$${amd64}" ; \
- if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${armv6}" -a -z "$${armv7}" ] ; then \
+ if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${armv6}" -a -z "$${armv7}" -a -z "$${arm64}" ] ; then \
${MV} "$${amd64}" process.o ; \
fi ; \
fi ; \
+ if [ -n "$${arm64}" ] ; then \
+ $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c -arch arm64 -I${TOP_INCDIR} -I${srcdir} -I. -I${TOP_OBJDIR}/src/config ${srcdir}/process.c -o "$${arm64}" ; \
+ if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${armv6}" -a -z "$${armv7}" -a -z "$${amd64}" ] ; then \
+ ${MV} "$${arm64}" process.o ; \
+ fi ; \
+ fi ; \
if [ ! -f process.o ] ; then \
- lipo -create $${amd64} $${i386} $${ppc} $${armv6} $${armv7} -output process.o ;\
+ lipo -create $${amd64} $${i386} $${ppc} $${armv6} $${armv7} $${arm64} -output process.o ;\
fi ;; \
i386_*bsd*) \
cp ${srcdir}/process.i386.s process.S ; \
/* On Linux without __USE_XOPEN, we have __fds_bits. With __USE_XOPEN, or
* non-Linux, we have fds_bits. */
-#if defined(AFS_LINUX22_ENV) && (__GLIBC_MINOR__ > 0) && !defined(__USE_XOPEN)
+#if defined(AFS_LINUX_ENV) && (__GLIBC_MINOR__ > 0) && !defined(__USE_XOPEN)
# define FDS_BITS __fds_bits
#else
# define FDS_BITS fds_bits
iomgr_timeout.tv_sec = 100000000;
iomgr_timeout.tv_usec = 0;
}
-#if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV)
+#if defined(AFS_NT40_ENV) || defined(AFS_LINUX_ENV)
/* On NT, signals don't interrupt a select call. So this can potentially
* lead to long wait times before a signal is honored. To avoid this we
* dont do select() for longer than IOMGR_MAXWAITTIME (5 secs) */
/* Real timeout only if signal handler hasn't set
iomgr_timeout to zero. */
-#if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV)
+#if defined(AFS_NT40_ENV) || defined(AFS_LINUX_ENV)
/* On NT, real timeout only if above and if iomgr_timeout
* interval is equal to timeout interval (i.e., not adjusted
* to check for pseudo-signals).
int setlim(int limcon, uchar_t hard, int limit);
#endif
-#ifndef AFS_ARM_LINUX20_ENV
-#if defined(AFS_S390_LINUX20_ENV)
+#ifndef AFS_ARM_LINUX_ENV
+#if defined(AFS_S390_LINUX_ENV)
int PRE_Block; /* Remnants of preemption support. */
#else
char PRE_Block; /* Remnants of preemption support. */
Initialize_PCB(temp, priority, stackmemory, stacksize, ep, parm, name);
insert(temp, &runnable[priority]);
temp2 = lwp_cpptr;
-#if !defined(AFS_ARM_LINUX20_ENV) && !defined(AFS_ARM_DARWIN_ENV)
+#if !defined(AFS_ARM_LINUX_ENV) && !defined(AFS_ARM_DARWIN_ENV)
if (PRE_Block != 0)
Abort_LWP("PRE_Block not 0");
savecontext(Create_Process_Part2, &temp2->context,
stackptr + MINFRAME);
#else
-#if defined(AFS_SGI62_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
#ifdef sys_x86_darwin_80
savecontext(Create_Process_Part2, &temp2->context, stackptr + stacksize - 16 - sizeof(void *)); /* 16 = 2 * jmp_buf_type */
#else /* !sys_x86_darwin_80 */
savecontext(Create_Process_Part2, &temp2->context, stackptr + stacksize - 16); /* 16 = 2 * jmp_buf_type */
#endif /* !sys_x86_darwin_80 */
#else
-#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV) || defined(AFS_SPARC_LINUX_ENV)
savecontext(Create_Process_Part2, &temp2->context, stackptr + stacksize - 0x40); /* lomgjmp does something
* with %fp + 0x38 */
#else
-#if defined(AFS_S390_LINUX20_ENV)
+#if defined(AFS_S390_LINUX_ENV)
savecontext(Create_Process_Part2, &temp2->context,
stackptr + stacksize - MINFRAME);
-#else /* !AFS_S390_LINUX20_ENV */
+#else /* !AFS_S390_LINUX_ENV */
savecontext(Create_Process_Part2, &temp2->context,
stackptr + stacksize - sizeof(void *));
-#endif /* AFS_S390_LINUX20_ENV */
-#endif /* AFS_SPARC64_LINUX20_ENV || AFS_SPARC_LINUX20_ENV */
-#endif /* AFS_SGI62_ENV */
+#endif /* AFS_S390_LINUX_ENV */
+#endif /* AFS_SPARC64_LINUX_ENV || AFS_SPARC_LINUX_ENV */
+#endif /* AFS_SGI_ENV */
#endif
/* End of gross hack */
Initialize_PCB(temp, priority, stackptr, stacksize, ep, parm, name);
insert(temp, &runnable[priority]);
temp2 = lwp_cpptr;
-#if !defined(AFS_ARM_LINUX20_ENV) && !defined(AFS_ARM_DARWIN_ENV)
+#if !defined(AFS_ARM_LINUX_ENV) && !defined(AFS_ARM_DARWIN_ENV)
if (PRE_Block != 0)
Abort_LWP("PRE_Block not 0");
#if defined(__hp9000s800)
savecontext(Dispatcher, &(temp->context),
&(LWPANCHOR.dsptchstack[MINFRAME]));
-#elif defined(AFS_SGI62_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
+#elif defined(AFS_SGI_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
savecontext(Dispatcher, &(temp->context),
&(LWPANCHOR.
dsptchstack[(sizeof LWPANCHOR.dsptchstack) - 8]));
-#elif defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV)
+#elif defined(AFS_SPARC64_LINUX_ENV) || defined(AFS_SPARC_LINUX_ENV)
savecontext(Dispatcher, &(temp->context),
&(LWPANCHOR.
dsptchstack[(sizeof LWPANCHOR.dsptchstack) -
0x40]));
-#elif defined(AFS_S390_LINUX20_ENV)
+#elif defined(AFS_S390_LINUX_ENV)
savecontext(Dispatcher, &(temp->context),
&(LWPANCHOR.
dsptchstack[(sizeof LWPANCHOR.dsptchstack) -
printf("Dispatch %d [PCB at 0x%x] \"%s\"\n", ++dispatch_count,
runnable[i].head, runnable[i].head->name);
#endif
-#if !defined(AFS_ARM_LINUX20_ENV) && !defined(AFS_ARM_DARWIN_ENV)
+#if !defined(AFS_ARM_LINUX_ENV) && !defined(AFS_ARM_DARWIN_ENV)
if (PRE_Block != 1)
Abort_LWP("PRE_Block not 1");
#endif
#ifndef _MFC_VER /*skip if doing Microsoft foundation class */
#include <winsock2.h>
#endif
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
*/
#if defined(USE_UCONTEXT) && defined(HAVE_UCONTEXT_H)
#define AFS_LWP_MINSTACKSIZE (288 * 1024)
-#elif defined(AFS_LINUX22_ENV)
+#elif defined(AFS_LINUX_ENV)
#define AFS_LWP_MINSTACKSIZE (192 * 1024)
#else
#define AFS_LWP_MINSTACKSIZE (48 * 1024)
struct lwp_context *savearea, char *sp);
extern void returnto(struct lwp_context *savearea);
-#ifdef AFS_LINUX24_ENV
+#ifdef AFS_LINUX_ENV
/* max time we are allowed to spend in a select call on Linux to avoid
lost signal issues */
#define IOMGR_MAXWAITTIME 60 /* seconds */
#include "lwp.h"
-#if defined(AFS_S390_LINUX20_ENV)
+#if defined(AFS_S390_LINUX_ENV)
extern int PRE_Block; /* used in lwp.c and process.s */
#else
extern char PRE_Block; /* used in lwp.c and process.s */
#if defined(USE_UCONTEXT) && defined(HAVE_UCONTEXT_H)
-# if defined(AFS_LINUX20_ENV) || defined(AFS_XBSD_ENV)
+# if defined(AFS_LINUX_ENV) || defined(AFS_XBSD_ENV)
# define AFS_UCONTEXT_NOSTACK
# endif
/*
* Magic stack pointer
*/
-#if defined(AFS_SGI64_ENV)
+#if defined(AFS_SGI_ENV)
# ifdef _BSD_COMPAT
# define LWP_SP 34
# else
# endif
#elif defined(AFS_HPUX_ENV)
#define LWP_SP 1
-#elif defined(AFS_LINUX20_ENV)
-#if defined(AFS_PPC_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
+#if defined(AFS_PPC_LINUX_ENV) || defined(AFS_PPC64_LINUX_ENV)
#define LWP_SP 0
-#elif defined(AFS_I386_LINUX20_ENV)
+#elif defined(AFS_I386_LINUX_ENV)
#define LWP_SP 4
-#elif defined(AFS_S390_LINUX20_ENV)
+#elif defined(AFS_S390_LINUX_ENV)
#define LWP_SP 9
#define LWP_FP 5
-#elif defined(AFS_SPARC_LINUX20_ENV)
+#elif defined(AFS_SPARC_LINUX_ENV)
#define LWP_SP 0
#define LWP_FP 1
-#elif defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV)
+#elif defined(AFS_SPARC64_LINUX_ENV) && defined(AFS_32BIT_USR_ENV)
#define LWP_SP 0
#define LWP_FP 1
-#elif defined(AFS_ALPHA_LINUX20_ENV)
+#elif defined(AFS_ALPHA_LINUX_ENV)
#define LWP_SP 8
#define LWP_FP 7
#else
* differs based on the ISA chosen. It is int for mips1 and mips2 and
* __uint64_t for mips3 and mips4
*/
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
#if (_MIPS_ISA == _MIPS_ISA_MIPS3 || _MIPS_ISA == _MIPS_ISA_MIPS4)
typedef __uint64_t jmp_buf_type;
#endif
#else
-#if defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV)
+#if defined(AFS_ALPHA_LINUX_ENV) || defined(AFS_PPC64_LINUX_ENV)
typedef long jmp_buf_type;
#else
typedef int jmp_buf_type;
-#endif /*AFS_ALPHA_LINUX20_ENV */
+#endif /*AFS_ALPHA_LINUX_ENV */
#endif /*SGI*/
static jmp_buf jmp_tmp;
* On Sparc ucontext functions are not implemented.
*/
#define ptr_mangle(x) (x)
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#ifdef __GLIBC__
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 3)
-#if defined(AFS_SPARC64_LINUX24_ENV) || defined(AFS_SPARC_LINUX24_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV) || defined(AFS_SPARC_LINUX_ENV)
/* technically we should use POINTER_GUARD
* ( == offsetof (tcbhead_t, pointer_guard) )
* instead of 0x18
case 0:
jmpBuffer = (jmp_buf_type *) jmp_tmp;
jmpBuffer[LWP_SP] = ptr_mangle((jmp_buf_type) sp);
-#if defined(AFS_S390_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || (defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV))
+#if defined(AFS_S390_LINUX_ENV) || defined(AFS_SPARC_LINUX_ENV) || (defined(AFS_SPARC64_LINUX_ENV) && defined(AFS_32BIT_USR_ENV))
jmpBuffer[LWP_FP] = ptr_mangle((jmp_buf_type) sp);
#endif
longjmp(jmp_tmp, 1);
#if defined(HAVE_STDIO_EXT_H)
if (__fbufsize(stdin) > 0)
return 1;
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
if (stdin->_IO_read_ptr < stdin->_IO_read_end)
return 1;
#elif (defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)) && defined(AFS_DFBSD_ENV)
return;
}
-void
-stoupper(char *s)
-{
- while (*s) {
- if (islower(*s))
- *s = toupper(*s);
- s++;
- }
- return;
-}
-
/* strcompose - concatenate strings passed to it.
* Input:
* buf: storage for the composed string. Any data in it will be lost.
}
static_inline int
-opr_ffsll(long long value)
-{
- afs_int32 i;
- afs_uint64 tmp = value;
-
- if (tmp == 0)
- return 0;
- /* This loop must terminate because tmp is nonzero and thus has at least
- * one bit set. */
- for (i = 1;; ++i) {
- if (tmp & 1ull)
- return i;
- else
- tmp >>= 1;
- }
- /* NOTREACHED */
-}
-
-static_inline int
opr_fls(int value)
{
afs_int32 i;
/* NOTREACHED */
}
-static_inline int
-opr_flsll(long long value)
-{
- afs_int32 i;
- /* tmp must be unsigned to avoid undefined behavior. */
- afs_uint64 tmp = value;
-
- if (tmp == 0)
- return 0;
- /* This loop must terminate because tmp is nonzero and thus has at least
- * one bit set. */
- for (i = 64;; --i) {
- if (tmp & 0x8000000000000000ull)
- return i;
- else
- tmp <<= 1;
- }
- /* NOTREACHED */
-}
-
#endif /* OPENAFS_OPR_FFS_H */
opr_AssertionFailed
+opr_cache_free
+opr_cache_get
+opr_cache_init
+opr_cache_put
opr_dict_Free
opr_dict_Init
opr_fmt
opr_rbtree_next
opr_rbtree_remove
opr_rbtree_replace
-opr_rbtree_replace
opr_stolower
-opr_stoupper
opr_strcompose
opr_threadname_set
opr_ucstring
+opr_uuid_create
+opr_uuid_equal
+opr_uuid_freeString
+opr_uuid_fromString
+opr_uuid_hash
+opr_uuid_isNil
+opr_uuid_pack
+opr_uuid_toString
+opr_uuid_unpack
opr_softsig_Init
opr_softsig_Register
/* 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);
#define lcstring opr_lcstring
#define ucstring opr_ucstring
#define stolower opr_stolower
-#define stoupper opr_stoupper
/* XXX str* is in the implementation namespace when <string.h> is included */
#define strcompose opr_strcompose
extern char *opr_lcstring(char *d, const char *s, int n) AFS_NONNULL((1,2));
extern char *opr_ucstring(char *d, const char *s, int n) AFS_NONNULL((1,2));
extern void opr_stolower(char *s) AFS_NONNULL((1));
-extern void opr_stoupper(char *s) AFS_NONNULL((1));
extern char *opr_strcompose(char *buf, size_t len, ...) AFS_NONNULL((1));
/* threadname.c */
#define OPENAFS_OPR_LOCK_H 1
#include <pthread.h>
+#include <errno.h>
/* Mutexes */
# define opr_cv_wait(condvar, mutex) \
opr_Verify(pthread_cond_wait(condvar, mutex) == 0)
-# define opr_cv_timedwait(condvar, mutex, timeout) \
- pthread_cond_timedwait(condvar, mutex, timeout)
+static_inline int
+opr_cv_timedwait(opr_cv_t *condvar, opr_mutex_t *mutex,
+ const struct timespec *abstime)
+{
+ int code = pthread_cond_timedwait(condvar, mutex, abstime);
+ opr_Assert(code == 0 || code == ETIMEDOUT);
+ return code;
+}
# define opr_cv_signal(condvar) \
opr_Verify(pthread_cond_signal(condvar) == 0)
sigdelset(set, SIGCONT);
sigdelset(set, SIGABRT);
sigdelset(set, SIGBUS);
- sigdelset(set, SIGFPE);
sigdelset(set, SIGILL);
sigdelset(set, SIGPIPE);
sigdelset(set, SIGSEGV);
sigdelset(set, SIGTRAP);
+#ifdef AFS_AIX_ENV
+ sigdelset(set, SIGWAITING);
+#endif
}
static void *
opr_Verify(opr_softsig_Register(SIGQUIT, ExitHandler) == 0);
opr_Verify(opr_softsig_Register(SIGTSTP, StopHandler) == 0);
+ /*
+ * Some of our callers do actually specify a SIGFPE handler, but make sure
+ * the default SIGFPE behavior does actually terminate the process, in case
+ * we get a real FPE.
+ */
+ opr_Verify(opr_softsig_Register(SIGFPE, ExitHandler) == 0);
+
/* Create a signal handler thread which will respond to any incoming signals
* for us. */
opr_Verify(pthread_create(&handlerThread, NULL, signalHandler, NULL) == 0);
file_permissions -u 222 -o root -g sys
file kadb_check
file kdb
- file kdump
- file kdump32
- file kdump64
file kseal
file rmtsysd
file vsys
file_permissions -u 222 -o root -g sys
file kadb_check
file kdb
- file kdump
- file kdump32
- file kdump64
file kseal
file rmtsysd
file vsys
file_permissions -u 222 -o root -g sys
file kadb_check
file kdb
- file kdump
- file kdump32
- file kdump64
file kseal
file rmtsysd
file vsys
<options rootVolumeOnly="true" />
<volume-check>
<allowed-os-versions>
- <os-version min="10.%%OSX_MAJOR_CUR%%.0" before="10.%%OSX_MAJOR_NEXT%%.0"/>
+ <os-version min="%%OSVER_CUR%%.%%OSX_MAJOR_CUR%%.0" before="%%OSVER_NEXT%%.%%OSX_MAJOR_NEXT%%.0"/>
</allowed-os-versions>
</volume-check>
<installation-check>
--- /dev/null
+#!/bin/sh
+majorvers=`uname -r | sed 's/\..*//'`
+if [ $majorvers -ne 20 ]; then
+ exit 112
+fi
+
+# check for temporary versions of ThisCell and CellAlias
+# and move them aside
+tmpthiscell=/private/tmp/org.OpenAFS.Install.ThisCell.$USER
+tmpcellalias=/private/tmp/org.OpenAFS.Install.CellAlias.$USER
+date=`date +%Y%m%d%H%M`
+if [ -e $tmpthiscell ]; then
+ mv -f $tmpthiscell $tmpthiscell.$date
+fi
+if [ -e $tmpcellalias ]; then
+ mv -f $tmpcellalias $tmpcellalias.$date
+fi
+
+exit 0
--- /dev/null
+#!/bin/sh
+majorvers=`uname -r | sed 's/\..*//'`
+if [ $majorvers -ne 21 ]; then
+ exit 112
+fi
+
+# check for temporary versions of ThisCell and CellAlias
+# and move them aside
+tmpthiscell=/private/tmp/org.OpenAFS.Install.ThisCell.$USER
+tmpcellalias=/private/tmp/org.OpenAFS.Install.CellAlias.$USER
+date=`date +%Y%m%d%H%M`
+if [ -e $tmpthiscell ]; then
+ mv -f $tmpthiscell $tmpthiscell.$date
+fi
+if [ -e $tmpcellalias ]; then
+ mv -f $tmpcellalias $tmpcellalias.$date
+fi
+
+exit 0
--- /dev/null
+"16" = "This OpenAFS release requires Big Sur (11.0)";
--- /dev/null
+"16" = "This OpenAFS release requires Monterey (12.0)";
# Root mount point is read-only. To workaround this restriction, add a
# synthetic entity for afs into /etc/synthetic.conf. For more information,
# please read man synthetic.conf(5).
- grep -qs '^afs$' /etc/synthetic.conf || echo 'afs' >> /etc/synthetic.conf
+ if [ $majorvers -ge 21 ]; then
+ # On macOS 12, SIP is not allowing our LaunchDaemon to unmount /afs on
+ # restart/shutdown. If /afs is mounted on the user's directory, this problem
+ # doesn't happen.
+ sed -i "" "/OpenAFS\/afs/d" /etc/synthetic.conf &> /dev/null
+ sed -i "" "/^afs$/d" /etc/synthetic.conf &> /dev/null
+ echo "afs\tUsers/$USER/OpenAFS/afs" >> /etc/synthetic.conf
+ mkdir -p /Users/$USER/OpenAFS/afs
+ else
+ grep -qs '^afs$' /etc/synthetic.conf || echo 'afs' >> /etc/synthetic.conf
+ fi
elif [ $majorvers -ge 7 ]; then
# /Network is now readonly, so put AFS in /afs; make sure /afs is a directory
if [ -e /afs ]; then
mv cacheinfo.new cacheinfo
fi
+if [ $majorvers -ge 21 ]; then
+ sed -i "" "s/\/afs:/\/Users\/$USER\/OpenAFS\/afs:/" cacheinfo
+fi
+
# if the installer plugin generated ThisCell and/or CellAlias
# files, copy them in here
tmpthiscell=/private/tmp/org.OpenAFS.Install.ThisCell.$USER
# 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 11.0 (Big Sur) 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 12.0 (Monterey) 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 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="Catalina"
THISREL=15
+elif [ x"$majorvers" = x20 ]; then
+ RELNAME="BigSur"
+ # Big Sur version number is 11.0 (not 10.16). Still, set THISREL to 16 so we
+ # know that this version came after the ones listed above.
+ THISREL=16
+ OSVER=11
+elif [ x"$majorvers" = x21 ]; then
+ RELNAME="Monterey"
+ THISREL=17
+ OSVER=12
+elif [ x"$majorvers" = x22 ]; then
+ RELNAME="Ventura"
+ THISREL=18
+ OSVER=13
+elif [ x"$majorvers" = x23 ]; then
+ RELNAME="Sonoma"
+ THISREL=19
+ OSVER=14
+
+
elif [ x"$majorvers" = x ] ; then
echo "Error running uname" >&2
exit 1
fi
# generate Distribution.xml from Distribution.xml.in -- nonstandard substs
- sed -e "s/%%OSX_MAJOR_CUR%%/$THISREL/g" \
- -e "s/%%OSX_MAJOR_NEXT%%/$(( $THISREL + 1 ))/g" \
- -e "s,%%PRES_EXTRA%%,$PRES_EXTRA,g" \
- -e "s/%%OPENAFS_VERSION%%/@PACKAGE_VERSION@/g" \
- < Distribution.xml.in > Distribution.xml
+ if [ $majorvers -ge 20 ] ; then
+ # Unlike older versions, point releases for macOS Big Sur increment the
+ # second component of the release number (prior releases increment the
+ # third component of this number).
+ sed -e "s/%%OSX_MAJOR_CUR%%/0/g" \
+ -e "s/%%OSX_MAJOR_NEXT%%/0/g" \
+ -e "s/%%OSVER_CUR%%/$OSVER/g" \
+ -e "s/%%OSVER_NEXT%%/$(( $OSVER + 1 ))/g" \
+ -e "s,%%PRES_EXTRA%%,$PRES_EXTRA,g" \
+ -e "s/%%OPENAFS_VERSION%%/@PACKAGE_VERSION@/g" \
+ < Distribution.xml.in > Distribution.xml
+ else
+ sed -e "s/%%OSX_MAJOR_CUR%%/$THISREL/g" \
+ -e "s/%%OSX_MAJOR_NEXT%%/$(( $THISREL + 1 ))/g" \
+ -e "s/%%OSVER_CUR%%/10/g" \
+ -e "s/%%OSVER_NEXT%%/10/g" \
+ -e "s,%%PRES_EXTRA%%,$PRES_EXTRA,g" \
+ -e "s/%%OPENAFS_VERSION%%/@PACKAGE_VERSION@/g" \
+ < Distribution.xml.in > Distribution.xml
+ fi
rm -rf "$CURDIR/prod"
mkdir "$CURDIR/prod"
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"
rm -f $RPM_BUILD_ROOT%{_bindir}/livesys
rm -f $RPM_BUILD_ROOT%{_prefix}/afs/bin/kdb
rm -f $RPM_BUILD_ROOT%{_sbindir}/rmtsysd
-rm -rf $RPM_BUILD_ROOT%{_sbindir}/kdump*
%if !%{build_authlibs}
rm -f $RPM_BUILD_ROOT%{_libdir}/libafsauthent.so*
rm -f $RPM_BUILD_ROOT%{_libdir}/libafsrpc.so*
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
pid_t cpid, rcpid;
int status;
struct sigaction newAction, origAction;
-#if !(defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV))
+#if !(defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV))
char upwd_buf[2048]; /* size is a guess. */
struct passwd unix_pwd;
#endif
RET(PAM_AUTH_ERR);
}
#else
-#if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
+#if defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
upwd = getpwnam(user);
#else
upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
struct ubik_client *conn = 0;
PAM_CONST struct pam_conv *pam_convp = NULL;
struct passwd *upwd = NULL;
-#if !(defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV))
+#if !(defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV))
char upwd_buf[2048]; /* size is a guess. */
struct passwd unix_pwd;
#endif
RET(PAM_AUTH_ERR);
}
#else
-#if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
+#if defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
upwd = getpwnam(user);
#else
upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
case -1: /* error */
return (PAM_SESSION_ERR);
case 0: /* child */
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
setpgrp();
#endif
setsid();
int password_expires = -1;
char *reason = NULL;
struct passwd *upwd = NULL;
-#if !(defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV))
+#if !(defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV))
char upwd_buf[2048]; /* size is a guess. */
struct passwd unix_pwd;
#endif
RET(PAM_AUTH_ERR);
}
#else
-#if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
+#if defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)
upwd = getpwnam(user);
#else
upwd = getpwnam_r(user, &unix_pwd, upwd_buf, sizeof(upwd_buf));
static const char *new_envstring = "GOTHEREVIATESTPAM=1";
static const char *new_homestring = "HOME=/tmp";
-#if defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV) || defined(AFS_DARWIN_ENV)
+#if defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV) || defined(AFS_DARWIN_ENV)
#define getpassphrase getpass
#endif
ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO;
SKIP_INSTALL = NO;
- VALID_ARCHS = "i386 ppc x86_64 armv6";
+ VALID_ARCHS = "i386 ppc x86_64 armv6 arm64";
};
name = Debug;
};
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = NO;
PREBINDING = NO;
- VALID_ARCHS = "i386 ppc x86_64 armv6";
+ VALID_ARCHS = "i386 ppc x86_64 armv6 arm64";
};
name = Release;
};
B44174E708BA33C40065BEDE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
- ONLY_ACTIVE_ARCH = YES;
+ ARCHS = "$(ARCHS_STANDARD)";
+ ONLY_ACTIVE_ARCH = NO;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
B44174E808BA33C40065BEDE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = (
- ppc,
- i386,
- x86_64,
- );
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
- ONLY_ACTIVE_ARCH = YES;
+ ARCHS = "$(ARCHS_STANDARD)";
+ ONLY_ACTIVE_ARCH = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
#endif
char **ahost;
u_short rport;
-#if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_LINUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
const char *locuser, *remuser, *cmd;
#else
char *locuser, *remuser, *cmd;
int _check_rhosts_file = 1;
-#if defined(AFS_HPUX102_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_HPUX102_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
ruserok(rhost, superuser, ruser, luser)
const char *rhost;
int superuser;
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. */
cmd_AddParm(ts, "-uheader", CMD_FLAG, CMD_OPTIONAL,
"Display UBIK header");
cmd_AddParm(ts, "-pheader", CMD_FLAG, CMD_OPTIONAL,
- "Display KADB header");
+ "Display PRDB header");
cmd_AddParm(ts, "-entries", CMD_FLAG, CMD_OPTIONAL, "Display entries");
cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");
cmd_AddParm(ts, "-rebuild", CMD_SINGLE, CMD_OPTIONAL | CMD_HIDE,
+PR_function_names
initialize_PT_error_table
pr_AddToGroup
pr_ChangeEntry
pr_IDListMembers
pr_IdToName
pr_Initialize
+pr_Initialize2
pr_IsAMemberOf
pr_ListEntries
pr_ListEntry
afs_int32 loc, afs_int32 aid);
extern int AccessOK(struct ubik_trans *ut, afs_int32 cid,
struct prentry *tentry, int mem, int any);
-extern afs_int32 CreateEntry(struct ubik_trans *at, char aname[],
+extern afs_int32 CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN],
afs_int32 *aid, afs_int32 idflag,
afs_int32 flag, afs_int32 oid, afs_int32 creator);
extern afs_int32 RemoveFromEntry(struct ubik_trans *at, afs_int32 aid,
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);
idlist ids;
idlist lids;
struct prcheckentry aentry;
+ prname admins = "system:administrators";
if (GetNameOrId(as, &ids, &names))
return PRBADARG;
}
if (aentry.id == SYSADMINID)
admin = 1;
- else if (!pr_IsAMemberOf(aentry.name, "system:administrators", &flag)) {
+ else if (!pr_IsAMemberOf(aentry.name, admins, &flag)) {
if (flag)
admin = 1;
}
{
afs_int32 code;
char *name;
+ prname newname = "";
char *owner;
name = as->parms[0].items->data;
owner = as->parms[1].items->data;
- code = pr_ChangeEntry(name, "", 0, owner);
+ code = pr_ChangeEntry(name, newname, 0, owner);
if (code)
afs_com_err(whoami, code, "; unable to change owner of %s to %s", name,
owner);
afs_int32 code;
char *oldname;
char *newname;
+ prname owner = "";
oldname = as->parms[0].items->data;
newname = as->parms[1].items->data;
- code = pr_ChangeEntry(oldname, newname, 0, "");
+ code = pr_ChangeEntry(oldname, newname, 0, owner);
if (code)
afs_com_err(whoami, code, "; unable to change name of %s to %s", oldname,
newname);
#define InitialGroup(id,name) do { \
afs_int32 temp = (id); \
afs_int32 flag = (id) < 0 ? PRGRP : 0; \
+ char tname[PR_MAXNAMELEN]; \
+ if (strlcpy(tname, (name), sizeof(tname)) >= sizeof(tname)) { \
+ code = PRBADNAM; \
+ afs_com_err (whoami, code, "name too long %s", (name)); \
+ ubik_AbortTrans(tt); \
+ return code; \
+ } \
code = CreateEntry \
- (tt, (name), &temp, /*idflag*/1, flag, SYSADMINID, SYSADMINID); \
+ (tt, tname, &temp, /*idflag*/1, flag, SYSADMINID, SYSADMINID); \
if (code) { \
afs_com_err (whoami, code, "couldn't create %s with id %di.", \
(name), (id)); \
CreateUser(int u)
{
afs_int32 code;
- char name[16];
+ prname name;
afs_int32 id;
sprintf(name, "%s%d", createPrefix, u);
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;
#include <afsconfig.h>
#include "afs/param.h"
+#include "rx_kmutex.h"
#ifndef AFS_DARWIN80_ENV
/*
openafs_lck_grp = lck_grp_alloc_init("openafs", openafs_lck_grp_attr);
lck_grp_attr_free(openafs_lck_grp_attr);
-
+#ifdef AFS_SOCKPROXY_ENV
+ rxk_SockProxySetup();
+#endif
}
void rx_kmutex_finish(void) {
+#ifdef AFS_SOCKPROXY_ENV
+ rxk_SockProxyFinish();
+#endif
lck_grp_free(openafs_lck_grp);
}
typedef int afs_kcondvar_t;
extern lck_grp_t * openafs_lck_grp;
+extern void rx_kmutex_setup(void);
+extern void rx_kmutex_finish(void);
#define MUTEX_SETUP() rx_kmutex_setup()
#define MUTEX_FINISH() rx_kmutex_finish()
#include <afsconfig.h>
#include "afs/param.h"
+#ifdef AFS_SOCKPROXY_ENV
+# include <afs/afs_args.h>
+#endif
#include "rx/rx_kcommon.h"
#include "rx/rx_atomic.h"
#endif
#ifdef RXK_UPCALL_ENV
+
+struct afs_pkt_hdr;
+static void rx_upcall_common(socket_t so, struct afs_pkt_hdr *pkt);
+
+# ifdef AFS_SOCKPROXY_ENV
+
+/*
+ * Here is the kernel portion of our implementation of a userspace "proxy" for
+ * socket operations (aka "sockproxy"). This is required on macOS after 10.15,
+ * because DARWIN no longer provides an in-kernel socket API, so we need to get
+ * userspace to handle our networking. Here's how it generally works:
+ *
+ * During startup, afsd forks a process that invokes the
+ * AFSOP_SOCKPROXY_HANDLER syscall, which takes a struct afs_uspc_param, just
+ * like with AFSOP_BKG_HANDLER. Each sockproxy afsd process has an "index"
+ * associated with it, which ties the process to the corresponding entry in the
+ * rx_sockproxy_ch.proc array. We have a few afsd sockproxy processes:
+ *
+ * - The receiver process, which calls recvmsg() to receive packets from the
+ * net. This always uses index 0.
+ *
+ * - The sender processes, which calls sendmsg() to send packets to the net.
+ * These run on indices 1 through (AFS_SOCKPROXY_NPROCS - 1).
+ *
+ * During startup, we only have one afsd sockproxy process, which waits for a
+ * AFS_USPC_SOCKPROXY_START message. When afsd gets that message, it creates
+ * the socket for sending and receiving packets from the net, and then fork()s
+ * to create the other sockproxy procs, which then send and receive packets.
+ *
+ * When we need to send a packet, our osi_NetSend goes through
+ * SockProxyRequest, which finds an idle afsd sockproxy process (or waits for
+ * one to exist), and populates the relevant arguments, wakes up the afsd
+ * process, and waits for a response. The afsd process sends the packet, then
+ * responds with an error code, going through rxk_SockProxyReply which looks up
+ * the corresponding request and wakes up the SockProxyRequest caller.
+ *
+ * When receiving packets, there is no request/reply mechanism. Instead, the
+ * afsd process just receives whatever packets it can get, and submits them via
+ * AFS_USPC_SOCKPROXY_RECV. The packets are processed via rx_upcall_sockproxy,
+ * similar to the rx_upcall mechanism that existed for previous versions of
+ * DARWIN.
+ *
+ * When the client has started shutting down, all calls to
+ * AFSOP_SOCKPROXY_HANDLER will respond with AFS_USPC_SHUTDOWN, which tells the
+ * afsd process to exit. We wait for all non-receiver sockproxy procs to get
+ * the AFS_USPC_SHUTDOWN message before continuing with the shutdown process.
+ *
+ * For the receiver process, we can't just wait for it to get the
+ * AFS_USPC_SHUTDOWN message, since it may be blocked in recvmsg(). Instead, we
+ * rely on one of the other afsd sockproxy procs to kill the receiver process
+ * with a signal. If the receiver process is inside an afs syscall, it'll get
+ * a AFS_USPC_SHUTDOWN respond anyway, but if it's in userspace, it'll just get
+ * killed by the signal. We know that someone must be handling killing the
+ * receiver process, since we wait for all of the other sockproxy procs to be
+ * notified of the shutdown.
+ */
+
+struct rx_sockproxy_proc {
+ struct opr_queue entry; /* chain of processes available for use */
+ int inited; /* process successfully initialized */
+ int op; /* operation to be performed (AFS_USPC_SOCKPROXY_*) */
+ char pending; /* waiting for a reply from userspace */
+ char complete; /* response received from userspace */
+ int ret; /* value returned by op executed on userspace */
+ afs_uint32 addr; /* ipv4 address for socket */
+ afs_uint32 port; /* port for socket */
+ struct afs_pkt_hdr *pkts; /* packets to be sent */
+ int npkts; /* number of packets to be sent */
+ afs_kcondvar_t cv_op; /* request / reply received (lock: rx_sockproxy_channel.lock) */
+};
+
+struct rx_sockproxy_channel {
+ int shutdown;
+ /*
+ * processes running on userspace, each with a specific role:
+ * proc[0]: recvmsg.
+ * proc[1]: socket, setsockopt, bind, and sendmsg.
+ * ...
+ * proc[AFS_SOCKPROXY_NPROCS-2]: sendmsg.
+ * proc[AFS_SOCKPROXY_NPROCS-1]: sendmsg.
+ */
+ struct rx_sockproxy_proc proc[AFS_SOCKPROXY_NPROCS];
+ struct opr_queue procq;
+ afs_kcondvar_t cv_procq;
+ afs_kmutex_t lock;
+};
+/* communication channel between SockProxyRequest and rxk_SockProxyReply */
+static struct rx_sockproxy_channel rx_sockproxy_ch;
+
+/* osi_socket returned by rxk_NewSocketHost on success */
+static osi_socket *SockProxySocket;
+
+/* number of afsd sockproxy processes running (not counting the receive
+ * process). Protected by GLOCK. */
+static int afs_sockproxy_procs;
+
+/**
+ * Return process that provides the given operation.
+ *
+ * @param[in] a_op operation
+ *
+ * @return process on success; NULL otherwise.
+ *
+ * @pre rx_sockproxy_ch.lock held
+ */
+static struct rx_sockproxy_proc *
+SockProxyGetProc(int a_op)
+{
+ struct rx_sockproxy_proc *proc = NULL;
+ struct rx_sockproxy_channel *ch = &rx_sockproxy_ch;
+
+ switch (a_op) {
+ case AFS_USPC_SHUTDOWN:
+ case AFS_USPC_SOCKPROXY_START:
+ case AFS_USPC_SOCKPROXY_SEND:
+ /* These are normal operations to process a request for. */
+ break;
+ default:
+ /*
+ * Any other request shouldn't be going through the SockProxyRequest
+ * framework, so something weird is going on.
+ */
+ printf("afs: SockProxyGetProc internal error: op %d not found.\n", a_op);
+ return NULL;
+ }
+
+ while (!ch->shutdown && opr_queue_IsEmpty(&ch->procq)) {
+ /* no process available */
+ CV_WAIT(&ch->cv_procq, &ch->lock);
+ }
+ if (ch->shutdown) {
+ return NULL;
+ }
+ proc = opr_queue_First(&ch->procq, struct rx_sockproxy_proc, entry);
+ opr_queue_Remove(&proc->entry);
+
+ return proc;
+}
+
+/**
+ * Delegate given operation to user-space process.
+ *
+ * @param[in] a_op operation
+ * @param[in] a_sin address assigned to socket
+ * @param[in] a_pkts packets to be sent by process
+ * @param[in] a_npkts number of pkts
+ *
+ * @return value returned by the requested operation.
+ */
+static int
+SockProxyRequest(int a_op, struct sockaddr_in *a_sin,
+ struct afs_pkt_hdr *a_pkts, int a_npkts)
+{
+ int ret = -1;
+ struct rx_sockproxy_channel *ch = &rx_sockproxy_ch;
+ struct rx_sockproxy_proc *proc;
+
+ MUTEX_ENTER(&ch->lock);
+
+ proc = SockProxyGetProc(a_op);
+ if (proc == NULL) {
+ /* proc not found or shutting down */
+ goto done;
+ }
+
+ if (a_op == AFS_USPC_SOCKPROXY_START) {
+ if (a_sin == NULL) {
+ printf("SockProxyRequest: _SOCKPROXY_START given NULL sin\n");
+ goto done;
+ }
+ proc->addr = a_sin->sin_addr.s_addr;
+ proc->port = a_sin->sin_port;
+ }
+ if (a_op == AFS_USPC_SOCKPROXY_SEND) {
+ if (a_pkts == NULL) {
+ printf("SockProxyRequest: _SOCKPROXY_SEND given NULL pkts\n");
+ goto done;
+ }
+ proc->pkts = a_pkts;
+ proc->npkts = a_npkts;
+ }
+
+ proc->op = a_op;
+ proc->pending = 1;
+ proc->complete = 0;
+
+ CV_BROADCAST(&proc->cv_op);
+ /* if shutting down, there is no need to wait for the response from the
+ * userspace process since it will exit and never return. */
+ if (proc->op == AFS_USPC_SHUTDOWN) {
+ struct rx_sockproxy_proc *p;
+
+ while (!opr_queue_IsEmpty(&ch->procq)) {
+ /* wake up procs waiting for a request so they can shutdown */
+ p = opr_queue_First(&ch->procq, struct rx_sockproxy_proc, entry);
+ opr_queue_Remove(&p->entry);
+
+ p->op = AFS_USPC_SHUTDOWN;
+ CV_BROADCAST(&p->cv_op);
+ }
+ ch->shutdown = 1;
+ /* wake up other threads waiting for a proc so they can return */
+ CV_BROADCAST(&ch->cv_procq);
+
+ ret = 0;
+ goto done;
+ }
+
+ /* wait for response from userspace process */
+ while (!proc->complete) {
+ CV_WAIT(&proc->cv_op, &ch->lock);
+ }
+ ret = proc->ret;
+
+ /* add proc to the queue of procs available for use */
+ opr_queue_Append(&ch->procq, &proc->entry);
+ CV_BROADCAST(&ch->cv_procq);
+ done:
+ MUTEX_EXIT(&ch->lock);
+ return ret;
+}
+
+/**
+ * Send packets to the given address.
+ *
+ * @param[in] so not used
+ * @param[in] addr destination address
+ * @param[in] dvec vector holding data to be sent
+ * @param[in] nvecs number of dvec entries
+ * @param[in] alength packet size
+ * @param[in] istack not used
+ *
+ * @return 0 on success.
+ */
+int
+osi_NetSend(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec,
+ int nvecs, afs_int32 alength, int istack)
+{
+ int iov_i, code;
+ int haveGlock;
+
+ struct afs_pkt_hdr pkt;
+ int npkts, nbytes, n_sent;
+ char *payloadp;
+
+ npkts = 1; /* for now, send one packet at a time */
+ nbytes = 0;
+
+ AFS_STATCNT(osi_NetSend);
+
+ memset(&pkt, 0, sizeof(pkt));
+ haveGlock = ISAFS_GLOCK();
+
+ if (nvecs > RX_MAXIOVECS) {
+ osi_Panic("osi_NetSend: %d: Too many iovecs.\n", nvecs);
+ }
+ if (alength > AFS_SOCKPROXY_PAYLOAD_MAX) {
+ osi_Panic("osi_NetSend: %d: Payload is too big.\n", alength);
+ }
+ if ((afs_termState == AFSOP_STOP_RXK_LISTENER) ||
+ (afs_termState == AFSOP_STOP_COMPLETE)) {
+ return -1;
+ }
+
+ if (haveGlock) {
+ AFS_GUNLOCK();
+ }
+
+ pkt.addr = addr->sin_addr.s_addr;
+ pkt.port = addr->sin_port;
+ pkt.size = alength;
+ pkt.payload = rxi_Alloc(alength);
+
+ payloadp = pkt.payload;
+ for (iov_i = 0; iov_i < nvecs; iov_i++) {
+ nbytes += dvec[iov_i].iov_len;
+ osi_Assert(nbytes <= alength);
+
+ memcpy(payloadp, dvec[iov_i].iov_base, dvec[iov_i].iov_len);
+ payloadp += dvec[iov_i].iov_len;
+ }
+
+ /* returns the number of packets sent */
+ n_sent = SockProxyRequest(AFS_USPC_SOCKPROXY_SEND, NULL, &pkt, npkts);
+ if (n_sent > 0) {
+ /* success */
+ code = 0;
+ } else {
+ code = EIO;
+ }
+
+ rxi_Free(pkt.payload, alength);
+ if (haveGlock) {
+ AFS_GLOCK();
+ }
+ return code;
+}
+
+/**
+ * Check if index is valid for a given op.
+ *
+ * @param[in] a_op operation
+ * @param[in] a_idx index
+ *
+ * @return 1 if valid; 0 otherwise.
+ */
+static int
+IsSockProxyIndexValid(int a_op, int a_idx)
+{
+ switch (a_op) {
+ case AFS_USPC_SOCKPROXY_RECV:
+ /* index 0 is reserved for the receiver */
+ if (a_idx == 0)
+ return 1;
+ break;
+
+ case AFS_USPC_SHUTDOWN:
+ case AFS_USPC_SOCKPROXY_START:
+ case AFS_USPC_SOCKPROXY_SEND:
+ /* non-receiver procs can use any index besides 0 */
+ if (a_idx > 0 && a_idx < AFS_SOCKPROXY_NPROCS)
+ return 1;
+ break;
+ }
+ return 0;
+}
+
+/**
+ * Receive packet from user-space.
+ *
+ * @param[in] a_pkt packet to be received
+ */
+static void
+rx_upcall_sockproxy(struct afs_pkt_hdr *a_pkt)
+{
+ /*
+ * Although SockProxySocket is not used as an endpoint for communication,
+ * rxi_FindService uses this information to find the correct service
+ * structure.
+ */
+ rx_upcall_common(SockProxySocket, a_pkt);
+}
+
+/**
+ * Receive response from user-space process.
+ *
+ * @param[in] uspc control information exchanged between rx and procs
+ * @param[in] pkts_recv packets to be received
+ * @param[out] pkts_send packets to be sent (do not free; the memory is
+ * owned by the SockProxyRequest caller)
+ *
+ * @return 0 on success; -1 otherwise.
+ */
+int
+rxk_SockProxyReply(struct afs_uspc_param *uspc,
+ struct afs_pkt_hdr *pkts_recv,
+ struct afs_pkt_hdr **pkts_send)
+{
+ struct rx_sockproxy_channel *ch = &rx_sockproxy_ch;
+ struct rx_sockproxy_proc *proc;
+ int procidx, shutdown;
+
+ procidx = uspc->req.usp.idx;
+ shutdown = 0;
+
+ if (!IsSockProxyIndexValid(uspc->reqtype, procidx)) {
+ printf("rxk_SockProxyReply: bad proc %d idx %d\n",
+ uspc->reqtype, procidx);
+ return -1;
+ }
+
+ MUTEX_ENTER(&ch->lock);
+ proc = &ch->proc[procidx];
+
+ /* process successfully initialized */
+ if (proc->inited == 0) {
+ proc->inited = 1;
+ if (uspc->reqtype != AFS_USPC_SOCKPROXY_RECV) {
+ /*
+ * Don't count the _RECV process in our count of
+ * afs_sockproxy_procs. The _RECV process will be killed by one of
+ * the other sockproxy procs during shutdown, to make sure it
+ * doesn't get stuck waiting for packets.
+ */
+ MUTEX_EXIT(&ch->lock);
+ AFS_GLOCK();
+ afs_sockproxy_procs++;
+ AFS_GUNLOCK();
+ MUTEX_ENTER(&ch->lock);
+
+ /*
+ * Add proc to the queue of procs waiting for a request. Skip
+ * AFS_USPC_SOCKPROXY_RECV since there is no request/reply
+ * mechanism for this type of request.
+ */
+ opr_queue_Append(&ch->procq, &proc->entry);
+ CV_BROADCAST(&ch->cv_procq);
+ }
+ }
+
+ /* response received from userspace process */
+ if (proc->pending) {
+ proc->op = -1;
+ proc->pending = 0;
+ proc->complete = 1;
+ proc->ret = uspc->retval;
+
+ CV_BROADCAST(&proc->cv_op);
+ }
+
+ if (ch->shutdown) {
+ shutdown = 1;
+ goto done;
+ }
+
+ if (uspc->reqtype == AFS_USPC_SOCKPROXY_RECV) {
+ int pkt_i;
+
+ MUTEX_EXIT(&ch->lock);
+ for (pkt_i = 0; pkt_i < uspc->req.usp.npkts; pkt_i++) {
+ rx_upcall_sockproxy(&pkts_recv[pkt_i]);
+ }
+ return 0;
+ }
+
+ while (!proc->pending && !ch->shutdown) {
+ /* wait for requests */
+ CV_WAIT(&proc->cv_op, &ch->lock);
+ }
+ if (!IsSockProxyIndexValid(proc->op, procidx)) {
+ printf("rxk_SockProxyReply: bad proc %d idx %d\n", proc->op, procidx);
+ MUTEX_EXIT(&ch->lock);
+ return -1;
+ }
+ /* request received */
+ uspc->reqtype = proc->op;
+
+ if (ch->shutdown) {
+ shutdown = 1;
+ goto done;
+ }
+
+ if (uspc->reqtype == AFS_USPC_SOCKPROXY_START) {
+ uspc->req.usp.addr = proc->addr;
+ uspc->req.usp.port = proc->port;
+ }
+ if (uspc->reqtype == AFS_USPC_SOCKPROXY_SEND) {
+ *pkts_send = proc->pkts;
+ uspc->req.usp.npkts = proc->npkts;
+ }
+
+ done:
+ MUTEX_EXIT(&ch->lock);
+ if (shutdown) {
+ AFS_GLOCK();
+ if (uspc->reqtype != AFS_USPC_SOCKPROXY_RECV &&
+ afs_sockproxy_procs > 0) {
+ /*
+ * wait for all non-recv sockproxy procs before continuing the
+ * shutdown process.
+ */
+ afs_sockproxy_procs--;
+ if (afs_sockproxy_procs == 0) {
+ afs_termState = AFSOP_STOP_NETIF;
+ afs_osi_Wakeup(&afs_termState);
+ }
+ }
+ AFS_GUNLOCK();
+ /* tell the afsd process to exit */
+ uspc->reqtype = AFS_USPC_SHUTDOWN;
+ }
+ return 0;
+}
+
+/**
+ * Shutdown socket proxy.
+ */
+void
+osi_StopNetIfPoller(void)
+{
+ AFS_GUNLOCK();
+ SockProxyRequest(AFS_USPC_SHUTDOWN, NULL, NULL, 0);
+ AFS_GLOCK();
+
+ while (afs_termState == AFSOP_STOP_SOCKPROXY) {
+ afs_osi_Sleep(&afs_termState);
+ }
+ if (SockProxySocket != NULL) {
+ rxi_Free(SockProxySocket, sizeof(*SockProxySocket));
+ SockProxySocket = NULL;
+ }
+
+ if (afs_termState == AFSOP_STOP_NETIF) {
+ afs_termState = AFSOP_STOP_COMPLETE;
+ osi_rxWakeup(&afs_termState);
+ }
+}
+
+/**
+ * Open and bind RX socket.
+ *
+ * @param[in] ahost ip address
+ * @param[in] aport port number
+ *
+ * @return non-NULL on success; NULL otherwise.
+ */
+osi_socket *
+rxk_NewSocketHost(afs_uint32 ahost, short aport)
+{
+ int code;
+ struct sockaddr_in addr;
+
+ AFS_STATCNT(osi_NewSocket);
+
+ if (SockProxySocket != NULL) {
+ /* Just make sure we don't init twice. */
+ return SockProxySocket;
+ }
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_family = AF_INET;
+ addr.sin_port = aport;
+ addr.sin_addr.s_addr = ahost;
+
+ AFS_GUNLOCK();
+
+ code = SockProxyRequest(AFS_USPC_SOCKPROXY_START, &addr, NULL, 0);
+ if (code != 0) {
+ afs_warn("rxk_NewSocketHost: Couldn't initialize socket (%d).\n", code);
+ AFS_GLOCK();
+ return NULL;
+ }
+
+ AFS_GLOCK();
+
+ /*
+ * success. notice that the rxk_NewSocketHost interface forces us to return
+ * an osi_socket address on success. however, if AFS_SOCKPROXY_ENV is
+ * defined, the socket returned by this function is not used. since the
+ * caller is expecting an osi_socket, return one to represent success.
+ */
+ if (SockProxySocket == NULL) {
+ SockProxySocket = rxi_Alloc(sizeof(*SockProxySocket));
+ } else {
+ /* should not happen */
+ afs_warn("rxk_NewSocketHost: SockProxySocket already initialized "
+ "(this should not happen, but continuing regardless).\n");
+ }
+ return SockProxySocket;
+}
+
+/**
+ * Open and bind RX socket to all local interfaces.
+ *
+ * @param[in] aport port number
+ *
+ * @return non-NULL on success; NULL otherwise.
+ */
+osi_socket *
+rxk_NewSocket(short aport)
+{
+ return rxk_NewSocketHost(0, aport);
+}
+
+/**
+ * Init communication channel used by SockProxyRequest and rxk_SockProxyReply.
+ */
+void
+rxk_SockProxySetup(void)
+{
+ int proc_i;
+
+ opr_queue_Init(&rx_sockproxy_ch.procq);
+ CV_INIT(&rx_sockproxy_ch.cv_procq, "rx_sockproxy_cv_procq", CV_DEFAULT, 0);
+ MUTEX_INIT(&rx_sockproxy_ch.lock, "rx_sockproxy_mutex", MUTEX_DEFAULT, 0);
+
+ for (proc_i = 0; proc_i < AFS_SOCKPROXY_NPROCS; proc_i++) {
+ struct rx_sockproxy_proc *proc = &rx_sockproxy_ch.proc[proc_i];
+
+ proc->op = -1;
+ CV_INIT(&proc->cv_op, "rx_sockproxy_cv_op", CV_DEFAULT, 0);
+ }
+}
+
+/**
+ * Destroy communication channel.
+ */
+void
+rxk_SockProxyFinish(void)
+{
+ int proc_i;
+
+ for (proc_i = 0; proc_i < AFS_SOCKPROXY_NPROCS; proc_i++) {
+ struct rx_sockproxy_proc *proc = &rx_sockproxy_ch.proc[proc_i];
+
+ CV_DESTROY(&proc->cv_op);
+ }
+ MUTEX_DESTROY(&rx_sockproxy_ch.lock);
+ CV_DESTROY(&rx_sockproxy_ch.cv_procq);
+
+ memset(&rx_sockproxy_ch, 0, sizeof(rx_sockproxy_ch));
+}
+
+# else /* AFS_SOCKPROXY_ENV */
+
+/* in listener env, the listener shutdown does this. we have no listener */
+void
+osi_StopNetIfPoller(void)
+{
+ soclose(rx_socket);
+ if (afs_termState == AFSOP_STOP_NETIF) {
+ afs_termState = AFSOP_STOP_COMPLETE;
+ osi_rxWakeup(&afs_termState);
+ }
+}
+
void
rx_upcall(socket_t so, void *arg, __unused int waitflag)
{
- mbuf_t m;
+ rx_upcall_common(so, NULL);
+}
+
+# endif /* AFS_SOCKPROXY_ENV */
+
+static void
+rx_upcall_common(socket_t so, struct afs_pkt_hdr *pkt)
+{
int error = 0;
int i, flags = 0;
struct msghdr msg;
msg.msg_namelen = sizeof(struct sockaddr_storage);
sa =(struct sockaddr *) &ss;
- do {
- m = NULL;
+# ifdef AFS_SOCKPROXY_ENV
+ {
+ char *payload;
+ size_t sz;
+
+ osi_Assert(pkt != NULL);
+
+ sa->sa_family = AF_INET;
+ ((struct sockaddr_in*)sa)->sin_addr.s_addr = pkt->addr;
+ ((struct sockaddr_in*)sa)->sin_port = pkt->port;
+
+ payload = pkt->payload;
+ nbytes = pkt->size;
+ resid = nbytes;
+ noffset = 0;
+
+ for (i = 0; i < p->niovecs && resid > 0; i++) {
+ sz = MIN(resid, p->wirevec[i].iov_len);
+ memcpy(p->wirevec[i].iov_base, payload, sz);
+ resid -= sz;
+ noffset += sz;
+ payload += sz;
+ }
+ }
+# else
+ {
+ mbuf_t m = NULL;
error = sock_receivembuf(so, &msg, &m, MSG_DONTWAIT, &nbytes);
if (!error) {
size_t sz, offset = 0;
noffset += sz;
}
}
- } while (0);
- mbuf_freem(m);
+ mbuf_freem(m);
+ }
+# endif /* AFS_SOCKPROXY_ENV */
/* restore the vec to its correct state */
p->wirevec[p->niovecs - 1].iov_len = savelen;
return;
}
-/* in listener env, the listener shutdown does this. we have no listener */
-void
-osi_StopNetIfPoller(void)
-{
- soclose(rx_socket);
- if (afs_termState == AFSOP_STOP_NETIF) {
- afs_termState = AFSOP_STOP_COMPLETE;
- osi_rxWakeup(&afs_termState);
- }
-}
#elif defined(RXK_LISTENER_ENV)
int
osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec,
#error need upcall or listener
#endif
+#ifndef AFS_SOCKPROXY_ENV
int
osi_NetSend(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec,
int nvecs, afs_int32 alength, int istack)
int i;
struct iovec iov[RX_MAXIOVECS];
int haveGlock = ISAFS_GLOCK();
-#ifdef AFS_DARWIN80_ENV
+# ifdef AFS_DARWIN80_ENV
socket_t asocket = (socket_t)so;
struct msghdr msg;
size_t slen;
-#else
+# else
struct socket *asocket = (struct socket *)so;
struct uio u;
memset(&u, 0, sizeof(u));
-#endif
+# endif
memset(&iov, 0, sizeof(iov));
AFS_STATCNT(osi_NetSend);
if (haveGlock)
AFS_GUNLOCK();
-#if defined(KERNEL_FUNNEL)
+# if defined(KERNEL_FUNNEL)
thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL);
-#endif
-#ifdef AFS_DARWIN80_ENV
+# endif
+# ifdef AFS_DARWIN80_ENV
memset(&msg, 0, sizeof(struct msghdr));
msg.msg_name = addr;
msg.msg_namelen = ((struct sockaddr *)addr)->sa_len;
msg.msg_iov = &iov[0];
msg.msg_iovlen = nvecs;
code = sock_send(asocket, &msg, 0, &slen);
-#else
+# else
u.uio_iov = &iov[0];
u.uio_iovcnt = nvecs;
u.uio_offset = 0;
u.uio_rw = UIO_WRITE;
u.uio_procp = NULL;
code = sosend(asocket, (struct sockaddr *)addr, &u, NULL, NULL, 0);
-#endif
+# endif
-#if defined(KERNEL_FUNNEL)
+# if defined(KERNEL_FUNNEL)
thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
-#endif
+# endif
if (haveGlock)
AFS_GLOCK();
return code;
}
+#endif /* !AFS_SOCKPROXY_ENV */
#else /* NULL_LOCKS */
-typedef struct mtx afs_kmutex_t;
+typedef struct sx afs_kmutex_t;
#ifdef WITNESS
#define WITCLEAR_MTX(a) \
- do { memset((a), 0, sizeof(struct mtx)); } while(0)
+ do { memset((a), 0, sizeof(struct sx)); } while(0)
#else
#define WITCLEAR_MTX(a) {}
#endif
#define MUTEX_INIT(a,b,c,d) \
do { \
WITCLEAR_MTX(a); \
- mtx_init((a), (b), 0 /* type defaults to name */, MTX_DEF | MTX_DUPOK); \
+ sx_init((a), (b)); \
} while(0)
#define MUTEX_DESTROY(a) \
do { \
- mtx_destroy((a)); \
+ sx_destroy((a)); \
} while(0)
#define MUTEX_ENTER(a) \
do { \
- mtx_lock((a)); \
+ sx_xlock((a)); \
} while(0)
#define MUTEX_TRYENTER(a) \
- ( mtx_trylock((a)) )
+ ( sx_try_xlock((a)) )
#define MUTEX_EXIT(a) \
do { \
- mtx_unlock((a)); \
+ sx_xunlock((a)); \
} while(0)
#define MUTEX_ASSERT(a) \
- osi_Assert(mtx_owned((a)))
+ osi_Assert(sx_xlocked((a)))
#endif /* !NULL_LOCKS */
#ifndef _RX_KMUTEX_H_
#define _RX_KMUTEX_H_
-#ifdef AFS_SGI62_ENV
-
#ifdef MP
#define RX_ENABLE_LOCKS 1
#define MUTEX_DEFAULT 0
#endif
-#ifdef AFS_SGI62_ENV
#define MUTEX_INIT(m, nm, type , a) mutex_init(m, type, nm)
-#else
-#define MUTEX_INIT(a,b,c,d) mutex_init(a,b,c,d)
-#endif
#define MUTEX_DESTROY(a) mutex_destroy(a)
#define MUTEX_ASSERT(a)
#define CV_INIT(cv, a,b,c) cv_init(cv, a, b, c)
#define CV_SIGNAL(_cv) cv_signal(_cv)
#define CV_BROADCAST(_cv) cv_broadcast(_cv)
#define CV_DESTROY(_cv) cv_destroy(_cv)
-#ifdef AFS_SGI64_ENV
/* Add PLTWAIT for afsd's to wait so we don't rack up the load average. */
-#ifdef AFS_SGI65_ENV
#define AFSD_PRI() ((kt_basepri(curthreadp) == PTIME_SHARE) ? PZERO : (PZERO|PLTWAIT))
-#else
-#define AFSD_PRI() ((curprocp && curprocp->p_rss==0) ? (PZERO|PLTWAIT) : PZERO)
-#endif /* SGI65 */
#undef cv_wait
#define cv_wait(cv, mp) { \
sv_wait(cv, AFSD_PRI(), mp, 0); \
AFS_MUTEX_ENTER(mp); \
}
-#endif /* AFS_SGI64_ENV */
#ifdef RX_LOCKS_DB
#define MUTEX_ENTER(a) do { \
AFS_MUTEX_ENTER(a); \
#endif /* MP */
-#endif /* SGI62 */
-
#endif /* _RX_KMUTEX_H_ */
struct mbuf *maddr = NULL;
struct sockaddr_in *taddr;
struct iovec tmpvec[RX_MAXWVECS + 2];
-#ifdef AFS_SGI65_ENV
bhv_desc_t bhv;
BHV_PDATA(&bhv) = (void *)so;
-#endif
memset(&tuio, 0, sizeof(tuio));
memset(&tmpvec, 0, sizeof(tmpvec));
osi_Panic("Too many (%d) iovecs passed to osi_NetReceive\n", nvecs);
}
memcpy(tmpvec, (char *)dvec, (RX_MAXWVECS + 1) * sizeof(struct iovec));
-#ifdef AFS_SGI65_ENV
code = soreceive(&bhv, &maddr, &tuio, NULL, NULL);
-#else
- code = soreceive(so, &maddr, &tuio, NULL, NULL);
-#endif
if (code) {
-#ifdef AFS_SGI65_ENV
/* Clear the error before using the socket again. I've tried being nice
* and blocking SIGKILL and SIGSTOP from the kernel, but they get
* delivered anyway. So, time to be crude and just clear the signals
ut_unlock(ut, s);
rxk_nSignalsCleared++;
}
-#endif
/* Clear the error before using the socket again. */
so->so_error = 0;
rxk_lastSocketError = code;
* RX input, fast timer and initialization routines.
*/
-#ifdef AFS_SGI64_ENV
static void
rxk_input(struct mbuf *am, struct ifnet *aif, struct ipsec *spec)
-#else
-static void
-rxk_input(struct mbuf *am, struct ifnet *aif)
-#endif
{
void (*tproc) ();
unsigned short *tsp;
#define _MP_NETLOCKS
#endif
-#ifdef AFS_SGI65_ENV
osi_NetSend(asocket, addr, dvec, nvec, asize, istack)
osi_socket *asocket;
struct iovec *dvec;
m_freem(to);
return code;
}
-#else /* AFS_SGI65_ENV */
-
-int
-dummy_sblock(struct sockbuf *a, int b, struct socket *c, int *d, int e)
-{
- afs_warn
- ("sblock was called before it was installed. Install proper afsd.\n");
-}
-
-void
-dummy_sbunlock(struct sockbuf *a, int b, struct socket *c, int d)
-{
- afs_warn
- ("sbunlock was called before it was installed. Install proper afsd.\n");
-}
-
-int (*afs_sblockp) (struct sockbuf *, int, struct socket *, int *, int) =
- dummy_sblock;
-void (*afs_sbunlockp) (struct sockbuf *, int, struct socket *, int) =
- dummy_sbunlock;
-#define AFS_SBUNLOCK(SB, EV, SO, O) (*afs_sbunlockp)(SB, EV, SO, O)
-
-/* osi_NetSend - send asize bytes at adata from asocket to host at addr.
- *
- * Now, why do we allocate a new buffer when we could theoretically use the one
- * pointed to by adata? Because PRU_SEND returns after queueing the message,
- * not after sending it. If the sender changes the data after queueing it,
- * we'd see the already-queued data change. One attempt to fix this without
- * adding a copy would be to have this function wait until the datagram is
- * sent; however this doesn't work well. In particular, if a host is down, and
- * an ARP fails to that host, this packet will be queued until the ARP request
- * comes back, which could be hours later. We can't block in this routine that
- * long, since it prevents RPC timeouts from happening.
- */
-/* XXX In the brave new world, steal the data bufs out of the rx_packet iovec,
- * and just queue those. XXX
- */
-int
-osi_NetSend(asocket, addr, dvec, nvec, asize, istack)
- struct socket *asocket;
- struct iovec *dvec;
- int nvec;
- afs_int32 asize;
- struct sockaddr_in *addr;
- int istack;
-{
- struct mbuf *tm, *um;
- afs_int32 code;
- int s;
- struct mbuf *top = 0;
- struct mbuf *m, **mp;
- int len;
- char *tdata;
- caddr_t tpa;
- int i, tl, rlen;
-
- NETSPL_DECL(s1)
- AFS_STATCNT(osi_NetSend);
-
- (*afs_sblockp) (&asocket->so_snd, NETEVENT_SODOWN, asocket, &s1, istack);
-
- s = splnet();
- mp = ⊤
- i = 0;
- tdata = dvec[i].iov_base;
- tl = dvec[i].iov_len;
- while (1) {
- if ((m = m_vget(M_DONTWAIT, MIN(asize, VCL_MAX), MT_DATA)) == NULL) {
- if (top)
- m_freem(top);
- splx(s);
- AFS_SBUNLOCK(&asocket->so_snd, NETEVENT_SODOWN, asocket, s1);
- return 1;
- }
- len = MIN(m->m_len, asize);
- m->m_len = 0;
- tpa = mtod(m, caddr_t);
- while (len) {
- rlen = MIN(len, tl);
- memcpy(tpa, tdata, rlen);
- asize -= rlen;
- len -= rlen;
- tpa += rlen;
- m->m_len += rlen;
- tdata += rlen;
- tl -= rlen;
- if (tl <= 0) {
- i++;
- if (i > nvec) {
- /* shouldn't come here! */
- asize = 0; /* so we make progress toward completion */
- break;
- }
- tdata = dvec[i].iov_base;
- tl = dvec[i].iov_len;
- }
- }
- *mp = m;
- mp = &m->m_next;
- if (asize <= 0)
- break;
- }
- tm = top;
-
- tm->m_act = NULL;
-
- /* setup mbuf corresponding to destination address */
- um = m_get(M_DONTWAIT, MT_SONAME);
- if (!um) {
- if (top)
- m_freem(top); /* free mbuf chain */
- /* if this were vfs40, we'd do sbunlock(asocket, &asocket->so_snd), but
- * we don't do the locking at all for vfs40 systems */
- splx(s);
- AFS_SBUNLOCK(&asocket->so_snd, NETEVENT_SODOWN, asocket, s1);
- return 1;
- }
- memcpy(mtod(um, caddr_t), addr, sizeof(*addr));
- um->m_len = sizeof(*addr);
- /* note that udp_usrreq frees funny mbuf. We hold onto data, but mbuf
- * around it is gone. we free address ourselves. */
- code = (*asocket->so_proto->pr_usrreq) (asocket, PRU_SEND, tm, um, 0);
- splx(s);
- m_free(um);
- AFS_SBUNLOCK(&asocket->so_snd, NETEVENT_SODOWN, asocket, s1);
-
- return code;
-}
-#endif /* AFS_SGI65_ENV */
void
afs_mutex_init(afs_kmutex_t * l)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
mutex_init(&l->mutex);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
- init_MUTEX(&l->sem);
-#else
- l->sem = MUTEX;
-#endif
l->owner = 0;
}
void
afs_mutex_enter(afs_kmutex_t * l)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
mutex_lock(&l->mutex);
-#else
- down(&l->sem);
-#endif
if (l->owner)
osi_Panic("mutex_enter: 0x%lx held by %d", (unsigned long)l, l->owner);
l->owner = current->pid;
int
afs_mutex_tryenter(afs_kmutex_t * l)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
if (mutex_trylock(&l->mutex) == 0)
-#else
- if (down_trylock(&l->sem))
-#endif
return 0;
l->owner = current->pid;
return 1;
if (l->owner != current->pid)
osi_Panic("mutex_exit: 0x%lx held by %d", (unsigned long)l, l->owner);
l->owner = 0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
mutex_unlock(&l->mutex);
-#else
- up(&l->sem);
-#endif
}
/* CV_WAIT and CV_TIMEDWAIT sleep until the specified event occurs, or, in the
#include <linux/version.h>
#include <linux/wait.h>
#include <linux/sched.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
#include <linux/mutex.h>
-#else
-#include <asm/semaphore.h>
-#endif
typedef struct afs_kmutex {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
struct mutex mutex;
-#else
- struct semaphore sem;
-#endif
int owner;
} afs_kmutex_t;
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);
#define NANO_SECONDS_TO_SLEEP 100000000 /* 100 milliseconds */
#define LOOPS_PER_WAITCHECK 10 /* once per second */
+struct usr_socket {
+ int sock;
+ short port;
+};
+
unsigned short usr_rx_port = 0;
struct usr_ifnet *usr_ifnet = NULL;
* 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;
}
usr_assert(rx_socket != NULL);
usockp = (struct usr_socket *)rx_socket;
-#undef socket
sock = socket(PF_INET, SOCK_DGRAM, 0);
usr_assert(sock >= 0);
len = sizeof(struct sockaddr_in);
rc = getsockname(sock, (struct sockaddr *)&lcladdr, &len);
usr_assert(rc >= 0);
-#ifdef AFS_USR_LINUX22_ENV
+#ifdef AFS_USR_LINUX_ENV
optval0 = 131070;
#else
optval0 = 131072;
rc = getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (void *)&optval, &optlen);
usr_assert(rc == 0);
/* usr_assert(optval == optval0); */
-#ifdef AFS_USR_LINUX22_ENV
+#ifdef AFS_USR_LINUX_ENV
optval0 = 131070;
#else
optval0 = 131072;
int
rxi_Recvmsg(osi_socket socket, struct msghdr *msg_p, int flags)
{
+ struct usr_socket *usock = (struct usr_socket *)socket;
int ret;
do {
- ret = recvmsg(socket->sock, msg_p, flags);
+ ret = recvmsg(usock->sock, msg_p, flags);
} while (ret == -1 && errno == EAGAIN);
return ret;
}
afs_xdrmem_create
hton_syserr_conv
multi_Finalize
-multi_Finalize_Ignore
multi_Init
multi_Select
osi_AssertFailU
rx_GetCachedConnection
rx_GetCallAbortCode
rx_GetCallStatus
+rx_GetConnDeadTime
+rx_GetConnHardDeadTime
+rx_GetConnIdleDeadTime
rx_GetConnection
rx_GetConnectionEpoch
rx_GetConnectionId
rx_nPackets
rx_opaque_alloc
rx_opaque_copy
+rx_opaque_free
rx_opaque_freeContents
+rx_opaque_new
rx_opaque_populate
rx_queryPeerRPCStats
rx_queryProcessRPCStats
rx_socket
rx_stackSize
rx_tranquil
+rxevent_Cancel
+rxevent_Init
+rxevent_Post
+rxevent_Put
+rxevent_RaiseEvents
rxevent_debugFile
rxi_Alloc
rxi_AllocDataBuf
# include "h/types.h"
# include "h/time.h"
# include "h/stat.h"
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
# include "h/socket.h"
# endif
# include "netinet/in.h"
# 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;
clock_NewTime();
if (serviceId == 0) {
- (osi_Msg
+ osi_Msg(
"rx_NewService: service id for service %s is not non-zero.\n",
serviceName);
return 0;
}
if (port == 0) {
if (rx_port == 0) {
- (osi_Msg
+ osi_Msg(
"rx_NewService: A non-zero port must be specified on this call if a non-zero port was not provided at Rx initialization (service %s).\n",
serviceName);
return 0;
* installed; if the caller was intending to
* change the security classes used by this
* service, he/she loses. */
- (osi_Msg
+ osi_Msg(
"rx_NewService: tried to install service %s with service id %d, which is already in use for service %s\n",
serviceName, serviceId, service->serviceName);
USERPRI;
}
USERPRI;
rxi_FreeService(tservice);
- (osi_Msg "rx_NewService: cannot support > %d services\n",
+ osi_Msg("rx_NewService: cannot support > %d services\n",
RX_MAX_SERVICES);
return 0;
}
}
#ifdef RXDEBUG_PACKET
-#ifdef KDUMP_RX_LOCK
-static struct rx_call_rx_lock *rx_allCallsp = 0;
-#else
static struct rx_call *rx_allCallsp = 0;
-#endif
#endif /* RXDEBUG_PACKET */
/* Allocate a call structure, for the indicated channel of the
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);
int offset;
for (offset = 0; offset < nAcks && len < sizeof(msg); offset++)
- msg[len++] = (ap->acks[offset] == RX_ACK_TYPE_NACK ? '-' : '*');
+ msg[len++] = ((ap->acks[offset] & RX_ACK_TYPE_ACK) != 0 ? '*'
+ : '-');
}
msg[len++]='\n';
msg[len] = '\0';
if (nAcks) {
int offset;
for (offset = 0; offset < nAcks; offset++)
- putc(ap->acks[offset] == RX_ACK_TYPE_NACK ? '-' : '*',
+ putc((ap->acks[offset] & RX_ACK_TYPE_ACK) != 0 ? '*' : '-',
rx_Log);
}
putc('\n', rx_Log);
* be downgraded when the server has discarded a packet it
* soacked previously, or when an ack packet is received
* out of sequence. */
- if (ap->acks[tp->header.seq - first] == RX_ACK_TYPE_ACK) {
+ if ((ap->acks[tp->header.seq - first] & RX_ACK_TYPE_ACK) != 0) {
if (!(tp->flags & RX_PKTFLAG_ACKED)) {
newAckCount++;
tp->flags |= RX_PKTFLAG_ACKED;
int offset;
for (offset = 0; offset < ap->nAcks && len < sizeof(msg); offset++)
- msg[len++] = (ap->acks[offset] == RX_ACK_TYPE_NACK ? '-' : '*');
+ msg[len++] = ((ap->acks[offset] & RX_ACK_TYPE_ACK) != 0 ? '*'
+ : '-');
}
msg[len++]='\n';
msg[len] = '\0';
(unsigned int)p->header.seq, ntohl(ap->firstPacket));
if (ap->nAcks) {
for (offset = 0; offset < ap->nAcks; offset++)
- putc(ap->acks[offset] == RX_ACK_TYPE_NACK ? '-' : '*',
+ putc((ap->acks[offset] & RX_ACK_TYPE_ACK) != 0 ? '*' : '-',
rx_Log);
}
putc('\n', rx_Log);
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;
int rx_DumpCalls(FILE *outputFile, char *cookie)
{
#ifdef RXDEBUG_PACKET
-#ifdef KDUMP_RX_LOCK
- struct rx_call_rx_lock *c;
-#else
struct rx_call *c;
-#endif
#ifdef AFS_NT40_ENV
int zilch;
char output[2048];
* directory or online at http://www.openafs.org/dl/license10.html
*/
-#ifdef KDUMP_RX_LOCK
-/* kdump for SGI needs MP and SP versions of rx_serverQueueEntry,
- * rx_peer, rx_connection and rx_call structs. rx.h gets included a
- * second time to pick up mp_ versions of those structs. Currently
- * the affected struct's have #ifdef's in them for the second pass.
- * This should change once we start using only ANSI compilers.
- * Actually, kdump does not use rx_serverQueueEntry, but I'm including
- * it for completeness.
- */
-#undef _RX_
-#endif
-
#ifndef _RX_
#define _RX_
-#ifndef KDUMP_RX_LOCK
-#ifdef KERNEL
-#include "rx_kmutex.h"
-#include "rx_kernel.h"
-#if defined (AFS_OBSD_ENV) && !defined (MLEN)
-#include "sys/mbuf.h"
-#endif
-#include "netinet/in.h"
-#include "sys/socket.h"
+#ifdef KERNEL
+# include "rx_kmutex.h"
+# include "rx_kernel.h"
+# if defined (AFS_OBSD_ENV) && !defined (MLEN)
+# include "sys/mbuf.h"
+# endif
+# include "netinet/in.h"
+# include "sys/socket.h"
#else /* KERNEL */
# include <sys/types.h>
# include <stdio.h>
# include <string.h>
-#ifdef AFS_PTHREAD_ENV
-# include "rx_pthread.h"
-#else
-# include "rx_lwp.h"
-#endif
-#ifdef AFS_NT40_ENV
-#include <malloc.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#endif
+# ifdef AFS_PTHREAD_ENV
+# include "rx_pthread.h"
+# else
+# include "rx_lwp.h"
+# endif
+# ifdef AFS_NT40_ENV
+# include <malloc.h>
+# include <winsock2.h>
+# include <ws2tcpip.h>
+# endif
# include "rx_user.h"
-#ifndef AFS_NT40_ENV
-# include <netinet/in.h>
-# include <sys/socket.h>
-#endif
+# ifndef AFS_NT40_ENV
+# include <netinet/in.h>
+# include <sys/socket.h>
+# endif
#endif /* KERNEL */
#include <opr/queue.h>
/* Packets */
/* Packet classes, for rx_AllocPacket and rx_packetQuota */
-#define RX_PACKET_CLASS_RECEIVE 0
-#define RX_PACKET_CLASS_SEND 1
-#define RX_PACKET_CLASS_SPECIAL 2
-#define RX_PACKET_CLASS_RECV_CBUF 3
-#define RX_PACKET_CLASS_SEND_CBUF 4
-
-#define RX_N_PACKET_CLASSES 5 /* Must agree with above list */
-
-#define RX_PACKET_TYPES {"data", "ack", "busy", "abort", "ackall", "challenge", "response", "debug", "params", "unused", "unused", "unused", "version"}
-#define RX_N_PACKET_TYPES 13 /* Must agree with above list;
+#define RX_PACKET_CLASS_RECEIVE 0
+#define RX_PACKET_CLASS_SEND 1
+#define RX_PACKET_CLASS_SPECIAL 2
+#define RX_PACKET_CLASS_RECV_CBUF 3
+#define RX_PACKET_CLASS_SEND_CBUF 4
+
+#define RX_N_PACKET_CLASSES 5 /* Must agree with above list */
+
+#define RX_PACKET_TYPES {"data", "ack", "busy", "abort", "ackall", \
+ "challenge", "response", "debug", "params", \
+ "unused", "unused", "unused", "version"}
+#define RX_N_PACKET_TYPES 13 /* Must agree with above list;
* counts 0
* WARNING: if this number ever
* grows past 13, rxdebug packets
* will need to be modified */
-
/* For most Unixes, maximum elements in an iovec is 16 */
-#define RX_MAXIOVECS 16 /* limit for ReadvProc/WritevProc */
+#define RX_MAXIOVECS 16 /* limit for ReadvProc/WritevProc */
#define RX_MAXWVECS (RX_MAXIOVECS-1) /* need one iovec for packet header */
/* Debugging */
/* Call flags, states and modes are exposed by the debug interface */
-#ifndef KDUMP_RX_LOCK
/* Major call states */
-#define RX_STATE_NOTINIT 0 /* Call structure has never been initialized */
-#define RX_STATE_PRECALL 1 /* Server-only: call is not in progress, but packets have arrived */
-#define RX_STATE_ACTIVE 2 /* An active call; a process is dealing with this call */
-#define RX_STATE_DALLY 3 /* Dallying after process is done with call */
-#define RX_STATE_HOLD 4 /* Waiting for acks on reply data packets */
-#define RX_STATE_RESET 5 /* Call is being reset */
+#define RX_STATE_NOTINIT 0 /* Call structure has never been initialized */
+#define RX_STATE_PRECALL 1 /* Server-only: call is not in progress, but packets have arrived */
+#define RX_STATE_ACTIVE 2 /* An active call; a process is dealing with this call */
+#define RX_STATE_DALLY 3 /* Dallying after process is done with call */
+#define RX_STATE_HOLD 4 /* Waiting for acks on reply data packets */
+#define RX_STATE_RESET 5 /* Call is being reset */
/* Call modes: the modes of a call in RX_STATE_ACTIVE state (process attached) */
-#define RX_MODE_SENDING 1 /* Sending or ready to send */
-#define RX_MODE_RECEIVING 2 /* Receiving or ready to receive */
-#define RX_MODE_ERROR 3 /* Something in error for current conversation */
-#define RX_MODE_EOF 4 /* Server has flushed (or client has read) last reply packet */
+#define RX_MODE_SENDING 1 /* Sending or ready to send */
+#define RX_MODE_RECEIVING 2 /* Receiving or ready to receive */
+#define RX_MODE_ERROR 3 /* Something in error for current conversation */
+#define RX_MODE_EOF 4 /* Server has flushed (or client has read) last reply packet */
/* Flags */
-#define RX_CALL_READER_WAIT 1 /* Reader is waiting for next packet */
-#define RX_CALL_WAIT_WINDOW_ALLOC 2 /* Sender is waiting for window to allocate buffers */
-#define RX_CALL_WAIT_WINDOW_SEND 4 /* Sender is waiting for window to send buffers */
-#define RX_CALL_WAIT_PACKETS 8 /* Sender is waiting for packet buffers */
-#define RX_CALL_WAIT_PROC 16 /* Waiting for a process to be assigned */
-#define RX_CALL_RECEIVE_DONE 32 /* All packets received on this call */
-#define RX_CALL_CLEARED 64 /* Receive queue cleared in precall state */
-#define RX_CALL_TQ_BUSY 128 /* Call's Xmit Queue is busy; don't modify */
-#define RX_CALL_TQ_CLEARME 256 /* Need to clear this call's TQ later */
-#define RX_CALL_TQ_SOME_ACKED 512 /* rxi_Start needs to discard ack'd packets. */
-#define RX_CALL_TQ_WAIT 1024 /* Reader is waiting for TQ_BUSY to be reset */
-#define RX_CALL_FAST_RECOVER 2048 /* call is doing congestion recovery */
+#define RX_CALL_READER_WAIT 1 /* Reader is waiting for next packet */
+#define RX_CALL_WAIT_WINDOW_ALLOC 2 /* Sender is waiting for window to allocate buffers */
+#define RX_CALL_WAIT_WINDOW_SEND 4 /* Sender is waiting for window to send buffers */
+#define RX_CALL_WAIT_PACKETS 8 /* Sender is waiting for packet buffers */
+#define RX_CALL_WAIT_PROC 16 /* Waiting for a process to be assigned */
+#define RX_CALL_RECEIVE_DONE 32 /* All packets received on this call */
+#define RX_CALL_CLEARED 64 /* Receive queue cleared in precall state */
+#define RX_CALL_TQ_BUSY 128 /* Call's Xmit Queue is busy; don't modify */
+#define RX_CALL_TQ_CLEARME 256 /* Need to clear this call's TQ later */
+#define RX_CALL_TQ_SOME_ACKED 512 /* rxi_Start needs to discard ack'd packets. */
+#define RX_CALL_TQ_WAIT 1024 /* Reader is waiting for TQ_BUSY to be reset */
+#define RX_CALL_FAST_RECOVER 2048 /* call is doing congestion recovery */
/* 4096 was RX_CALL_FAST_RECOVER_WAIT */
-#define RX_CALL_SLOW_START_OK 8192 /* receiver acks every other packet */
-#define RX_CALL_IOVEC_WAIT 16384 /* waiting thread is using an iovec */
-#define RX_CALL_HAVE_LAST 32768 /* Last packet has been received */
-#define RX_CALL_NEED_START 0x10000 /* tells rxi_Start to start again */
+#define RX_CALL_SLOW_START_OK 8192 /* receiver acks every other packet */
+#define RX_CALL_IOVEC_WAIT 16384 /* waiting thread is using an iovec */
+#define RX_CALL_HAVE_LAST 32768 /* Last packet has been received */
+#define RX_CALL_NEED_START 0x10000 /* tells rxi_Start to start again */
/* 0x20000 was RX_CALL_PEER_BUSY */
-#define RX_CALL_ACKALL_SENT 0x40000 /* ACKALL has been sent on the call */
-#define RX_CALL_FLUSH 0x80000 /* Transmit queue should be flushed to peer */
-#endif
-
+#define RX_CALL_ACKALL_SENT 0x40000 /* ACKALL has been sent on the call */
+#define RX_CALL_FLUSH 0x80000 /* Transmit queue should be flushed to peer */
/* Configurable parameters */
-#define RX_IDLE_DEAD_TIME 60 /* default idle dead time */
-#define RX_MAX_SERVICES 20 /* Maximum number of services that may be installed */
+#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
+# define RX_DEFAULT_STACK_SIZE 24000
#else
-#define RX_DEFAULT_STACK_SIZE 16000 /* Default process stack size; overriden by rx_SetStackSize */
+# define RX_DEFAULT_STACK_SIZE 16000 /* Default process stack size; overriden by rx_SetStackSize */
#endif
/* This parameter should not normally be changed */
-#define RX_PROCESS_PRIORITY LWP_NORMAL_PRIORITY
+#define RX_PROCESS_PRIORITY LWP_NORMAL_PRIORITY
#define ADDRSPERSITE 16
-#ifndef KDUMP_RX_LOCK
/* Bottom n-bits of the Call Identifier give the call number */
-#define RX_MAXCALLS 4 /* Power of 2; max async calls per connection */
-#define RX_CIDSHIFT 2 /* Log2(RX_MAXCALLS) */
-#define RX_CHANNELMASK (RX_MAXCALLS-1)
-#define RX_CIDMASK (~RX_CHANNELMASK)
-#endif /* !KDUMP_RX_LOCK */
+#define RX_MAXCALLS 4 /* Power of 2; max async calls per connection */
+#define RX_CIDSHIFT 2 /* Log2(RX_MAXCALLS) */
+#define RX_CHANNELMASK (RX_MAXCALLS-1)
+#define RX_CIDMASK (~RX_CHANNELMASK)
#ifndef KERNEL
typedef void (*rx_destructor_t) (void *);
int rx_KeyCreate(rx_destructor_t);
osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
osi_socket rxi_GetUDPSocket(u_short port);
-#endif /* KERNEL */
-
+# endif /* !KERNEL */
int ntoh_syserr_conv(int error);
-#define RX_WAIT 1
-#define RX_DONTWAIT 0
+#define RX_WAIT 1
+#define RX_DONTWAIT 0
#define rx_GetLocalStatus(call, status) ((call)->localStatus)
-
static_inline int
rx_IsLoopbackAddr(afs_uint32 addr)
{
/* If this flag is set,no new requests are processed by rx, all new requests are
returned with an error code of RX_CALL_DEAD ( transient error ) */
-#define rx_SetRxTranquil() (rx_tranquil = 1)
-#define rx_ClearRxTranquil() (rx_tranquil = 0)
+#define rx_SetRxTranquil() (rx_tranquil = 1)
+#define rx_ClearRxTranquil() (rx_tranquil = 0)
/* Set the threshold and time to delay aborts for consecutive errors */
#define rx_SetCallAbortThreshold(A) (rxi_callAbortThreshhold = (A))
#define rx_SetConnAbortThreshold(A) (rxi_connAbortThreshhold = (A))
#define rx_SetConnAbortDelay(A) (rxi_connAbortDelay = (A))
-
-
#define cpspace(call) ((call)->curlen)
#define cppos(call) ((call)->curpos)
-#define rx_Read(call, buf, nbytes) rx_ReadProc(call, buf, nbytes)
-#define rx_Read32(call, value) rx_ReadProc32(call, value)
-#define rx_Readv(call, iov, nio, maxio, nbytes) \
+#define rx_Read(call, buf, nbytes) rx_ReadProc(call, buf, nbytes)
+#define rx_Read32(call, value) rx_ReadProc32(call, value)
+#define rx_Readv(call, iov, nio, maxio, nbytes) \
rx_ReadvProc(call, iov, nio, maxio, nbytes)
-#define rx_Write(call, buf, nbytes) rx_WriteProc(call, buf, nbytes)
-#define rx_Write32(call, value) rx_WriteProc32(call, value)
-#define rx_Writev(call, iov, nio, nbytes) \
+#define rx_Write(call, buf, nbytes) rx_WriteProc(call, buf, nbytes)
+#define rx_Write32(call, value) rx_WriteProc32(call, value)
+#define rx_Writev(call, iov, nio, nbytes) \
rx_WritevProc(call, iov, nio, nbytes)
/* This is the maximum size data packet that can be sent on this connection, accounting for security module-specific overheads. */
-#define rx_MaxUserDataSize(call) ((call)->MTU - RX_HEADER_SIZE - (call)->conn->securityHeaderSize - (call)->conn->securityMaxTrailerSize)
+#define rx_MaxUserDataSize(call) ((call)->MTU - RX_HEADER_SIZE - \
+ (call)->conn->securityHeaderSize - \
+ (call)->conn->securityMaxTrailerSize)
/* Macros to turn the hot thread feature on and off. Enabling hot threads
* allows the listener thread to trade places with an idle worker thread,
* which moves the context switch from listener to worker out of the
* critical path.
*/
-#define rx_EnableHotThread() (rx_enable_hot_thread = 1)
-#define rx_DisableHotThread() (rx_enable_hot_thread = 0)
+#define rx_EnableHotThread() (rx_enable_hot_thread = 1)
+#define rx_DisableHotThread() (rx_enable_hot_thread = 0)
#define rx_PutConnection(conn) rx_DestroyConnection(conn)
u_char checkReach; /* Check for asymmetric clients? */
int nSpecific; /* number entries in specific data */
void **specific; /* pointer to connection specific data */
-#ifdef RX_ENABLE_LOCKS
+#ifdef RX_ENABLE_LOCKS
afs_kmutex_t svc_data_lock; /* protect specific data */
#endif
};
-#endif /* KDUMP_RX_LOCK */
-
-#ifndef KDUMP_RX_LOCK
/* Flag bits for connection structure */
-#define RX_CONN_MAKECALL_WAITING 1 /* rx_NewCall is waiting for a channel */
-#define RX_CONN_DESTROY_ME 2 /* Destroy *client* connection after last call */
+#define RX_CONN_MAKECALL_WAITING 1 /* rx_NewCall is waiting for a channel */
+#define RX_CONN_DESTROY_ME 2 /* Destroy *client* connection after last call */
#define RX_CONN_USING_PACKET_CKSUM 4 /* non-zero header.spare field seen */
#define RX_CONN_KNOW_WINDOW 8 /* window size negotiation works */
-#define RX_CONN_RESET 16 /* connection is reset, remove */
-#define RX_CONN_BUSY 32 /* connection is busy; don't delete */
-#define RX_CONN_ATTACHWAIT 64 /* attach waiting for peer->lastReach */
-#define RX_CONN_MAKECALL_ACTIVE 128 /* a thread is actively in rx_NewCall */
-#define RX_CONN_NAT_PING 256 /* NAT ping requested but deferred during attachWait */
-#define RX_CONN_CACHED 512 /* connection is managed by rxi_connectionCache */
+#define RX_CONN_RESET 16 /* connection is reset, remove */
+#define RX_CONN_BUSY 32 /* connection is busy; don't delete */
+#define RX_CONN_ATTACHWAIT 64 /* attach waiting for peer->lastReach */
+#define RX_CONN_MAKECALL_ACTIVE 128 /* a thread is actively in rx_NewCall */
+#define RX_CONN_NAT_PING 256 /* NAT ping requested but deferred during attachWait */
+#define RX_CONN_CACHED 512 /* connection is managed by rxi_connectionCache */
/* Type of connection, client or server */
-#define RX_CLIENT_CONNECTION 0
-#define RX_SERVER_CONNECTION 1
-#endif /* !KDUMP_RX_LOCK */
+#define RX_CLIENT_CONNECTION 0
+#define RX_SERVER_CONNECTION 1
/* Maximum number of acknowledgements in an acknowledge packet */
-#define RX_MAXACKS 255
-
-#ifndef KDUMP_RX_LOCK
+#define RX_MAXACKS 255
/* The structure of the data portion of an acknowledge packet: An acknowledge
* packet is in network byte order at all times. An acknowledgement is always
afs_uint32 previousPacket; /* The previous packet number received (obsolete?) */
afs_uint32 serial; /* Serial number of the packet which prompted the acknowledge */
u_char reason; /* Reason for the acknowledge of ackPacket, defined below */
- u_char nAcks; /* Number of acknowledgements */
- u_char acks[RX_MAXACKS]; /* Up to RX_MAXACKS packet acknowledgements, defined below */
- /* Packets <firstPacket are implicitly acknowledged and may be discarded by the sender. Packets >= firstPacket+nAcks are implicitly NOT acknowledged. No packets with sequence numbers >= firstPacket should be discarded by the sender (they may thrown out at any time by the receiver) */
+ u_char nAcks; /* Number of acknowledgements (saturates at 255) */
+ u_char acks[RX_MAXACKS]; /* Packet acknowledgements, one bit per packet.
+ * The first (up to) RX_MAXACKS packets'
+ * acknowledgment state is indicated by bit-0
+ * of the corresponding byte of acks[]. The
+ * additional bits are reserved for future use. */
+ /*
+ * DATA packets whose sequence number is less than firstPacket are
+ * implicitly acknowledged and may be discarded by the sender.
+ * DATA packets whose sequence number is greater than or equal to
+ * (firstPacket + nAcks) are implicitly NOT acknowledged.
+ * No DATA packets with sequence numbers greater than or equal to
+ * firstPacket should be discarded by the sender (they may be thrown
+ * out by the receiver and listed as NOT acknowledged in a subsequent
+ * ACK packet.)
+ */
};
#define FIRSTACKOFFSET 4
/* Reason for acknowledge message */
-#define RX_ACK_REQUESTED 1 /* Peer requested an ack on this packet */
-#define RX_ACK_DUPLICATE 2 /* Duplicate packet */
-#define RX_ACK_OUT_OF_SEQUENCE 3 /* Packet out of sequence */
-#define RX_ACK_EXCEEDS_WINDOW 4 /* Packet sequence number higher than window; discarded */
-#define RX_ACK_NOSPACE 5 /* No buffer space at all */
-#define RX_ACK_PING 6 /* This is a keep-alive ack */
-#define RX_ACK_PING_RESPONSE 7 /* Ack'ing because we were pinged */
-#define RX_ACK_DELAY 8 /* Ack generated since nothing has happened since receiving packet */
-#define RX_ACK_IDLE 9 /* Similar to RX_ACK_DELAY, but can
+#define RX_ACK_REQUESTED 1 /* Peer requested an ack on this packet */
+#define RX_ACK_DUPLICATE 2 /* Duplicate packet */
+#define RX_ACK_OUT_OF_SEQUENCE 3 /* Packet out of sequence */
+#define RX_ACK_EXCEEDS_WINDOW 4 /* Packet sequence number higher than window; discarded */
+#define RX_ACK_NOSPACE 5 /* No buffer space at all */
+#define RX_ACK_PING 6 /* This is a keep-alive ack */
+#define RX_ACK_PING_RESPONSE 7 /* Ack'ing because we were pinged */
+#define RX_ACK_DELAY 8 /* Ack generated since nothing has happened since receiving packet */
+#define RX_ACK_IDLE 9 /* Similar to RX_ACK_DELAY, but can
* be used to compute RTT */
-#define RX_ACK_MTU -1 /* will be rewritten to ACK_PING */
+#define RX_ACK_MTU -1 /* will be rewritten to ACK_PING */
-/* Packet acknowledgement type */
-#define RX_ACK_TYPE_NACK 0 /* I Don't have this packet */
-#define RX_ACK_TYPE_ACK 1 /* I have this packet, although I may discard it later */
+/* Packet acknowledgement type (for maximum window size 255) */
+#define RX_ACK_TYPE_NACK 0x0 /* I Don't have this packet */
+#define RX_ACK_TYPE_ACK 0x1 /* I have this packet, although I may discard it later */
/* The packet size transmitted for an acknowledge is adjusted to reflect the actual size of the acks array. This macro defines the size */
#define rx_AckDataSize(nAcks) (3 + nAcks + offsetof(struct rx_ackPacket, acks[0]))
-#define RX_CHALLENGE_TIMEOUT 2 /* Number of seconds before another authentication request packet is generated */
+#define RX_CHALLENGE_TIMEOUT 2 /* Number of seconds before another authentication request packet is generated */
#define RX_CHALLENGE_MAXTRIES 50 /* Max # of times we resend challenge */
-#define RX_CHECKREACH_TIMEOUT 2 /* Number of seconds before another ping is generated */
-#define RX_CHECKREACH_TTL 60 /* Re-check reachability this often */
+#define RX_CHECKREACH_TIMEOUT 2 /* Number of seconds before another ping is generated */
+#define RX_CHECKREACH_TTL 60 /* Re-check reachability this often */
/*
* rx_GetNetworkError 'origin' constants. These define the meaning of the
*/
/* Something bad happened to the connection; temporary loss of communication */
-#define RX_CALL_DEAD (-1)
+#define RX_CALL_DEAD (-1)
/*
* An invalid operation, such as a client attempting to send data
* after having received the beginning of a reply from the server.
*/
-#define RX_INVALID_OPERATION (-2)
+#define RX_INVALID_OPERATION (-2)
/* An optional timeout per call may be specified */
-#define RX_CALL_TIMEOUT (-3)
+#define RX_CALL_TIMEOUT (-3)
/* End of data on a read. Not currently in use. */
-#define RX_EOF (-4)
+#define RX_EOF (-4)
/* Some sort of low-level protocol error. */
-#define RX_PROTOCOL_ERROR (-5)
+#define RX_PROTOCOL_ERROR (-5)
/*
* Generic user abort code; used when no more specific error code needs to be
* communicated. For example, multi rx clients use this code to abort a multi-
* rx call.
*/
-#define RX_USER_ABORT (-6)
+#define RX_USER_ABORT (-6)
/* Port already in use (from rx_Init). This error is never sent on the wire. */
-#define RX_ADDRINUSE (-7)
+#define RX_ADDRINUSE (-7)
/* EMSGSIZE returned from network. Packet too big, must fragment */
-#define RX_MSGSIZE (-8)
+#define RX_MSGSIZE (-8)
/* The value -9 was previously used for RX_CALL_IDLE but is now free for
* reuse. */
/* transient failure detected ( possibly the server is restarting ) */
/* this should be equal to VRESTARTING ( util/errors.h ) for old clients to work */
-#define RX_RESTARTING (-100)
+#define RX_RESTARTING (-100)
typedef enum {
RX_SECIDX_NULL = 0, /** rxnull, no security. */
/* For the RXS_CONFIG_FLAGS, the following bit values are defined */
/* Disable the principal name contains dot check in rxkad */
-#define RXS_CONFIG_FLAGS_DISABLE_DOTCHECK 0x01
+#define RXS_CONFIG_FLAGS_DISABLE_DOTCHECK 0x01
/* XXXX (rewrite this description) A security class object contains a set of
* procedures and some private data to implement a security model for rx
int refCount;
};
-#define RXS_OP(obj,op,args) ((obj && (obj->ops->op_ ## op)) ? (*(obj)->ops->op_ ## op)args : 0)
+#define RXS_OP(obj,op,args) ((obj && (obj->ops->op_ ## op)) ? \
+ (*(obj)->ops->op_ ## op)args : 0)
#define RXS_OP_VOID(obj,op,args) do { \
if (obj && (obj->ops->op_ ## op)) \
(*(obj)->ops->op_ ## op)args; \
#define RXS_CheckPacket(obj,call,packet) RXS_OP(obj,CheckPacket,(obj,call,packet))
#define RXS_DestroyConnection(obj,conn) RXS_OP_VOID(obj,DestroyConnection,(obj,conn))
#define RXS_GetStats(obj,conn,stats) RXS_OP(obj,GetStats,(obj,conn,stats))
-#define RXS_SetConfiguration(obj, conn, type, value, currentValue) RXS_OP(obj, SetConfiguration,(obj,conn,type,value,currentValue))
-
-
+#define RXS_SetConfiguration(obj, conn, type, value, currentValue) \
+ RXS_OP(obj, SetConfiguration,(obj,conn,type,value,currentValue))
/* Structure for keeping rx statistics. Note that this structure is returned
* by rxdebug, so, for compatibility reasons, new fields should be appended (or
};
/* Invalid rx debug package type */
-#define RX_DEBUGI_BADTYPE (-8)
+#define RX_DEBUGI_BADTYPE (-8)
#define RX_DEBUGI_VERSION_MINIMUM ('L') /* earliest real version */
-#define RX_DEBUGI_VERSION ('S') /* Latest version */
+#define RX_DEBUGI_VERSION ('S') /* Latest version */
/* first version w/ secStats */
#define RX_DEBUGI_VERSION_W_SECSTATS ('L')
/* version M is first supporting GETALLCONN and RXSTATS type */
#define RX_DEBUGI_VERSION_W_WAITED ('R')
#define RX_DEBUGI_VERSION_W_PACKETS ('S')
-#define RX_DEBUGI_GETSTATS 1 /* get basic rx stats */
-#define RX_DEBUGI_GETCONN 2 /* get connection info */
-#define RX_DEBUGI_GETALLCONN 3 /* get even uninteresting conns */
-#define RX_DEBUGI_RXSTATS 4 /* get all rx stats */
-#define RX_DEBUGI_GETPEER 5 /* get all peer structs */
+#define RX_DEBUGI_GETSTATS 1 /* get basic rx stats */
+#define RX_DEBUGI_GETCONN 2 /* get connection info */
+#define RX_DEBUGI_GETALLCONN 3 /* get even uninteresting conns */
+#define RX_DEBUGI_RXSTATS 4 /* get all rx stats */
+#define RX_DEBUGI_GETPEER 5 /* get all peer structs */
struct rx_debugStats {
afs_int32 nFreePackets;
afs_int32 sparel[10];
};
-#define RX_OTHER_IN 1 /* packets avail in in queue */
-#define RX_OTHER_OUT 2 /* packets avail in out queue */
+#define RX_OTHER_IN 1 /* packets avail in in queue */
+#define RX_OTHER_OUT 2 /* packets avail in out queue */
#define RX_SERVER_DEBUG_SEC_STATS 0x1
#define RX_SERVER_DEBUG_ALL_CONN 0x2
#define RX_SERVER_DEBUG_OLD_CONN 0x20
#define RX_SERVER_DEBUG_NEW_PACKETS 0x40
#define RX_SERVER_DEBUG_ALL_PEER 0x80
-#define RX_SERVER_DEBUG_WAITED_CNT 0x100
-#define RX_SERVER_DEBUG_PACKETS_CNT 0x200
+#define RX_SERVER_DEBUG_WAITED_CNT 0x100
+#define RX_SERVER_DEBUG_PACKETS_CNT 0x200
#define AFS_RX_STATS_CLEAR_ALL 0xffffffff
#define AFS_RX_STATS_CLEAR_INVOCATIONS 0x1
extern int rx_DumpCalls(FILE *outputFile, char *cookie);
#endif
-#endif /* _RX_ End of rx.h */
-
-#ifdef KERNEL
-#include "rx/rx_prototypes.h"
+#ifdef KERNEL
+# include "rx/rx_prototypes.h"
#else
-#include "rx_prototypes.h"
+# include "rx_prototypes.h"
#endif
static_inline afs_uint32
rx_function_entry_v1_p rpcop_stat = (rx_function_entry_v1_p)blob;
return rpcop_stat->bytes_rcvd;
}
-#endif /* !KDUMP_RX_LOCK */
+#endif /* !_RX_ */
} 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_LINUX26_ENV) && defined(KERNEL)
-#include <asm/atomic.h>
+#elif defined(AFS_LINUX_ENV) && defined(KERNEL)
+# 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 */
* well as state shared with other calls associated with this
* connection) is maintained in the connection structure. */
-#ifdef KDUMP_RX_LOCK
-struct rx_call_rx_lock {
-#else
struct rx_call {
-#endif
struct opr_queue entry; /* Call can be on various queues (one-at-a-time) */
struct opr_queue tq; /* Transmit packet queue */
struct opr_queue rq; /* Receive packet queue */
afs_kcondvar_t cv_rq;
afs_kcondvar_t cv_tq;
#endif
-#ifdef KDUMP_RX_LOCK
- struct rx_connection_rx_lock *conn; /* Parent connection for call */
-#else
struct rx_connection *conn; /* Parent connection for this call */
-#endif
afs_uint32 *callNumber; /* Pointer to call number field within connection */
afs_uint32 flags; /* Some random flags */
u_char localStatus; /* Local user status sent out of band */
u_short rqc; /* packet count in rq */
u_short iovqc; /* packet count in iovq */
-#ifdef KDUMP_RX_LOCK
- struct rx_call_rx_lock *allNextp;
-#else
struct rx_call *allNextp;
-#endif
afs_uint32 call_id;
#endif
#ifdef AFS_RXERRQ_ENV
#endif
};
-/* Only include this once, even when re-loading for kdump. */
-#ifndef _CALL_REF_DEFINED_
-#define _CALL_REF_DEFINED_
-
#ifdef RX_ENABLE_LOCKS
# define CALL_HOLD(call, type) do { \
MUTEX_EXIT(&rx_refcnt_mutex); \
} while(0)
-#ifdef RX_REFCOUNT_CHECK
+# ifdef RX_REFCOUNT_CHECK
/* RX_REFCOUNT_CHECK is used to test for call refcount leaks by event
* type.
*/
extern int rx_callHoldType;
-#define CALL_HOLD_R(call, type) do { \
+# define CALL_HOLD_R(call, type) do { \
call->refCount++; \
call->refCDebug[type]++; \
if (call->refCDebug[type] > 50) {\
osi_Panic("Huge call refCount"); \
} \
} while (0)
-#define CALL_RELE_R(call, type) do { \
+# define CALL_RELE_R(call, type) do { \
call->refCount--; \
call->refCDebug[type]--; \
if (call->refCDebug[type] > 50) {\
osi_Panic("Negative call refCount"); \
} \
} while (0)
-#else /* RX_REFCOUNT_CHECK */
-#define CALL_HOLD_R(call, type) call->refCount++
-#define CALL_RELE_R(call, type) call->refCount--
-#endif /* RX_REFCOUNT_CHECK */
+# else /* RX_REFCOUNT_CHECK */
+# define CALL_HOLD_R(call, type) call->refCount++
+# define CALL_RELE_R(call, type) call->refCount--
+# endif /* RX_REFCOUNT_CHECK */
#else /* RX_ENABLE_LOCKS */
-#define CALL_HOLD(call, type)
-#define CALL_RELE(call, type)
-#define CALL_RELE_R(call, type)
+# define CALL_HOLD(call, type)
+# define CALL_RELE(call, type)
+# define CALL_RELE_R(call, type)
#endif /* RX_ENABLE_LOCKS */
-#endif /* _CALL_REF_DEFINED_ */
-
#endif
/* A connection is an authenticated communication path, allowing limited
* multiple asynchronous conversations. */
-#ifdef KDUMP_RX_LOCK
-struct rx_connection_rx_lock {
- struct rx_connection_rx_lock *next; /* on hash chain _or_ free list */
- struct rx_peer_rx_lock *peer;
-#else
struct rx_connection {
struct rx_connection *next; /* on hash chain _or_ free list */
struct rx_peer *peer;
-#endif
#ifdef RX_ENABLE_LOCKS
afs_kmutex_t conn_call_lock; /* locks conn_call_cv */
afs_kcondvar_t conn_call_cv;
afs_uint32 epoch; /* Process start time of client side of connection */
afs_uint32 cid; /* Connection id (call channel is bottom bits) */
afs_int32 error; /* If this connection is in error, this is it */
-#ifdef KDUMP_RX_LOCK
- struct rx_call_rx_lock *call[RX_MAXCALLS];
-#else
struct rx_call *call[RX_MAXCALLS];
-#endif
afs_uint32 callNumber[RX_MAXCALLS]; /* Current call numbers */
afs_uint32 rwind[RX_MAXCALLS];
u_short twind[RX_MAXCALLS];
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
#ifdef UKERNEL
#undef ioctl
-#undef socket
#endif /* UKERNEL */
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
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
*/
#ifdef AFS_RXERRQ_ENV
-# if defined(AFS_LINUX26_ENV) || defined(AFS_USR_LINUX26_ENV)
+# if defined(AFS_LINUX_ENV) || defined(AFS_USR_LINUX_ENV)
# include <linux/types.h>
# include <linux/errqueue.h>
# include <linux/icmp.h>
extern void rxi_SendRaw(struct rx_call *call, struct rx_connection *conn,
int type, char *data, int bytes, int istack);
extern struct rx_packet *rxi_SplitJumboPacket(struct rx_packet *p);
+
+#if !defined(AFS_AIX_ENV) || (defined(AFS_AIX_ENV) && (!defined(KERNEL) || defined(UKERNEL)))
+/* rx_kcommon.c / rx_user.c */
+extern void osi_Msg(const char *fmt, ...) AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
+#endif
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;
int rxk_initDone = 0;
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_SGI62_ENV)
+#if !defined(AFS_SUN5_ENV) && !defined(AFS_SGI_ENV)
# define ADDRSPERSITE 16
static afs_uint32 myNetAddrs[ADDRSPERSITE];
static int myNetMTUs[ADDRSPERSITE];
for (i = 0; i < MAXRXPORTS; i++) {
if (rxk_ports[i]) {
rxk_ports[i] = 0;
-#if ! defined(AFS_SUN5_ENV) && ! defined(UKERNEL) && ! defined(RXK_LISTENER_ENV)
+#if ! defined(AFS_SUN5_ENV) && ! defined(UKERNEL) && ! defined(RXK_LISTENER_ENV) && ! defined(AFS_SOCKPROXY_ENV)
soclose((struct socket *)rxk_portRocks[i]);
#endif
rxk_portRocks[i] = NULL;
return 0;
}
-#ifndef AFS_LINUX26_ENV
+#ifndef AFS_LINUX_ENV
/*
* osi_AssertFailK() -- used by the osi_Assert() macro.
*
# define ADDBUF(BUF, STR) \
if (strlen(BUF) + strlen((char *)(STR)) + 1 <= sizeof BUF) { \
- strcat(BUF, (char *)(STR)); \
+ strlcat(BUF, (char *)(STR), sizeof(BUF)); \
}
buf[0] = '\0';
osi_Panic("%s", buf);
}
-#endif /* !AFS_LINUX26_ENV */
+#endif /* !AFS_LINUX_ENV */
#ifndef UKERNEL
/* This is the server process request loop. Kernel server
threadID = rxi_availProcs++;
MUTEX_EXIT(&rx_quota_mutex);
-# ifdef RX_ENABLE_LOCKS
- AFS_GUNLOCK();
-# endif /* RX_ENABLE_LOCKS */
rxi_ServerProc(threadID, NULL, NULL);
-# ifdef RX_ENABLE_LOCKS
- AFS_GLOCK();
-# endif /* RX_ENABLE_LOCKS */
return NULL;
}
RX_NET_EPOCH_ENTER();
-# if !defined(AFS_SGI62_ENV)
+# if !defined(AFS_SGI_ENV)
if (numMyNetAddrs == 0)
(void)rxi_GetIFInfo();
# endif
*/
-#if ! defined(AFS_AIX_ENV) && ! defined(AFS_SUN5_ENV) && ! defined(UKERNEL) && ! defined(AFS_LINUX20_ENV) && !defined (AFS_DARWIN_ENV) && !defined (AFS_XBSD_ENV)
+#if ! defined(AFS_AIX_ENV) && ! defined(AFS_SUN5_ENV) && ! defined(UKERNEL) && ! defined(AFS_LINUX_ENV) && !defined (AFS_DARWIN_ENV) && !defined (AFS_XBSD_ENV)
/* Routine called during the afsd "-shutdown" process to put things back to
* the initial state.
*/
}
#endif /* !AIX && !SUN && !NCR && !UKERNEL */
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_SGI62_ENV)
+#if !defined(AFS_SUN5_ENV) && !defined(AFS_SGI_ENV)
/* Determine what the network interfaces are for this machine. */
# ifdef AFS_USERSPACE_IP_ADDR
}
# endif /* else DARWIN || XBSD */
# endif /* else AFS_USERSPACE_IP_ADDR */
-#endif /* !SUN5 && !SGI62 */
+#endif /* !SUN5 && !SGI */
/* rxk_NewSocket, rxk_FreeSocket and osi_NetSend are from the now defunct
* most of it is simple to follow common code.
*/
#if !defined(UKERNEL)
-# if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV)
+# if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_SOCKPROXY_ENV)
/* rxk_NewSocket creates a new socket on the specified port. The port is
* in network byte order.
*/
struct file *fp;
extern struct fileops socketops;
# endif
-# ifdef AFS_SGI65_ENV
+# ifdef AFS_SGI_ENV
bhv_desc_t bhv;
# endif
# if (defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)) && defined(KERNEL_FUNNEL)
thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL);
# endif
- AFS_ASSERT_GLOCK();
- AFS_GUNLOCK();
# if defined(AFS_HPUX102_ENV)
# if defined(AFS_HPUX110_ENV)
/* we need a file associated with the socket so sosend in NetSend
# else /* AFS_HPUX110_ENV */
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, 0, SS_NOWAIT);
# endif /* else AFS_HPUX110_ENV */
-# elif defined(AFS_SGI65_ENV) || defined(AFS_OBSD_ENV)
+# elif defined(AFS_SGI_ENV) || defined(AFS_OBSD_ENV)
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP);
# elif defined(AFS_FBSD_ENV)
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP,
}
nam->m_len = sizeof(myaddr);
memcpy(mtod(nam, caddr_t), &myaddr, sizeof(myaddr));
-# if defined(AFS_SGI65_ENV)
+# if defined(AFS_SGI_ENV)
BHV_PDATA(&bhv) = (void *)newSocket;
code = sobind(&bhv, nam);
m_freem(nam);
if (code) {
dpf(("sobind fails (%d)\n", (int)code));
soclose(newSocket);
-# ifndef AFS_SGI65_ENV
+# ifndef AFS_SGI_ENV
m_freem(nam);
# endif
goto bad;
# endif /* else defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) */
# endif /* else AFS_HPUX110_ENV */
- AFS_GLOCK();
# if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
# endif
return (osi_socket *)newSocket;
bad:
- AFS_GLOCK();
# if defined(AFS_DARWIN_ENV) && defined(KERNEL_FUNNEL)
thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
# endif
# endif
return 0;
}
-# endif /* !SUN5 && !LINUX20 */
+# endif /* !AFS_SUN5_ENV && !AFS_LINUX_ENV && !AFS_SOCKPROXY_ENV */
# if defined(RXK_LISTENER_ENV) || defined(AFS_SUN5_ENV) || defined(RXK_UPCALL_ENV)
# ifdef RXK_TIMEDSLEEP_ENV
if (afs_termState == AFSOP_STOP_RXEVENT) {
# ifdef RXK_LISTENER_ENV
afs_termState = AFSOP_STOP_RXK_LISTENER;
+# elif defined(AFS_SOCKPROXY_ENV)
+ afs_termState = AFSOP_STOP_SOCKPROXY;
# elif defined(AFS_SUN510_ENV) || defined(RXK_UPCALL_ENV)
afs_termState = AFSOP_STOP_NETIF;
# else
* OS's socket receive routine returns as a result of a signal.
*/
int rxk_ListenerPid; /* Used to signal process to wakeup at shutdown */
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
struct task_struct *rxk_ListenerTask;
# endif
int code;
int host, port;
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
rxk_ListenerPid = current->pid;
rxk_ListenerTask = current;
allow_signal(SIGKILL); /* Allowed, but blocked until shutdown */
osi_rxWakeup(&afs_termState);
}
rxk_ListenerPid = 0;
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
rxk_ListenerTask = 0;
osi_rxWakeup(&rxk_ListenerTask);
# endif
# endif
}
-# if !defined(AFS_LINUX20_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
+# if !defined(AFS_LINUX_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
/* The manner of stopping the rx listener thread may vary. Most unix's should
* be able to call soclose.
*/
# endif /* RXK_LISTENER_ENV */
#endif /* !UKERNEL */
-#if !defined(AFS_LINUX26_ENV)
+#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)
+ vprintk(fmt, ap);
+# else
+ vprintf(fmt, ap);
+# endif
+ va_end(ap);
+}
+#endif
+
+#if !defined(AFS_LINUX_ENV)
void
# if defined(AFS_AIX_ENV)
osi_Panic(char *msg, void *a1, void *a2, void *a3)
icmn_err(CE_PANIC, msg, ap);
va_end(ap);
}
-# elif defined(AFS_DARWIN80_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_FBSD_ENV) || defined(UKERNEL)
+# elif defined(AFS_DARWIN80_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV) || defined(UKERNEL)
char buf[256];
va_list ap;
if (!msg)
va_end(ap);
printf("%s", buf);
panic("%s", buf);
-# else /* DARWIN80 || LINUX22 || FBSD || UKERNEL */
+# else /* DARWIN80 || LINUX || FBSD || UKERNEL */
va_list ap;
if (!msg)
msg = "Unknown AFS panic";
va_start(ap, msg);
vprintf(msg, ap);
va_end(ap);
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
* ((char *) 0) = 0;
# else
panic("%s", msg);
# endif
-# endif /* else DARWIN80 || LINUX22 || FBSD || UKERNEL */
+# endif /* else DARWIN80 || LINUX || FBSD || UKERNEL */
}
-#endif /* !AFS_LINUX26_ENV */
+#endif /* !AFS_LINUX_ENV */
#ifndef _RX_KCOMMON_H_
#define _RX_KCOMMON_H_
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
#ifndef _LINUX_CODA_FS_I
#define _LINUX_CODA_FS_I 1
#define _CODA_HEADER_ 1
#include "h/types.h"
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX_ENV)
#include "h/param.h"
#endif
-#ifndef AFS_LINUX22_ENV
+#ifndef AFS_LINUX_ENV
#include "h/systm.h"
#endif
#include "h/time.h"
#include "h/disp.h"
#endif
#include "h/socket.h"
-#if !defined(AFS_LINUX22_ENV) && !defined(AFS_OBSD_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_OBSD_ENV)
#include "h/socketvar.h"
#if !defined(AFS_SUN5_ENV) && !defined(AFS_XBSD_ENV)
#include "h/domain.h"
#include "h/mbuf.h"
#endif
#endif /* !defined(AFS_SUN5_ENV) && !defined(AFS_XBSD_ENV) */
-#endif /* !defined(AFS_LINUX22_ENV) && !defined(AFS_OBSD_ENV) */
-#ifdef AFS_SGI62_ENV
+#endif /* !defined(AFS_LINUX_ENV) && !defined(AFS_OBSD_ENV) */
+#ifdef AFS_SGI_ENV
#include "h/hashing.h"
#endif
#ifdef AFS_FBSD_ENV
#include "h/signalvar.h"
#endif /* AFS_OBSD_ENV */
#include "netinet/in.h"
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
#include "linux/route.h"
#else
#include "net/route.h"
#endif
-#if defined(HAVE_IN_SYSTM_H) || !defined(AFS_LINUX22_ENV)
+#if defined(HAVE_IN_SYSTM_H) || !defined(AFS_LINUX_ENV)
#include "netinet/in_systm.h"
#endif
#include "netinet/ip.h"
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_OBSD_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_OBSD_ENV)
#include "netinet/in_pcb.h"
-#endif /* ! AFS_HPUX110_ENV && ! AFS_LINUX22_ENV */
-#ifndef AFS_LINUX22_ENV
+#endif /* ! AFS_HPUX110_ENV && ! AFS_LINUX_ENV */
+#ifndef AFS_LINUX_ENV
#if !defined(AFS_DARWIN_ENV)
#include "netinet/ip_var.h"
#endif
#include "netinet/ip_icmp.h"
-#endif /* AFS_LINUX22_ENV */
+#endif /* AFS_LINUX_ENV */
#include "netinet/udp.h"
-#if !defined(AFS_SGI62_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_SGI_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV)
#include "netinet/udp_var.h"
#endif
-#if defined(AFS_HPUX102_ENV) || (defined(AFS_SGI62_ENV) && !defined(AFS_SGI64_ENV))
+#if defined(AFS_HPUX102_ENV)
#include "h/user.h"
#endif
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
#include "h/sched.h"
#include "h/netdevice.h"
#include "linux/if.h"
# include <net/if_var.h>
# endif
#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV)
#include "netinet/in_var.h"
-#endif /* ! AFS_HPUX110_ENV && ! AFS_LINUX22_ENV */
+#endif /* ! AFS_HPUX110_ENV && ! AFS_LINUX_ENV */
#include "afs/afs_osi.h"
#include "rx_kmutex.h"
#include "afs/lock.h"
# if defined(AFS_FBSD_ENV)
# include "machine/stdarg.h"
# else
-# include "stdarg.h"
+# if defined(HAVE_LINUX_STDARG_H)
+# include "linux/stdarg.h"
+# else
+# include "stdarg.h"
+# endif
# endif
#endif
#ifdef KERNEL
extern int osi_utoa(char *buf, size_t len, unsigned long val);
-#if defined(AFS_LINUX26_ENV)
+#if defined(AFS_LINUX_ENV)
# define osi_Panic(msg...) \
do { printk(KERN_CRIT "openafs: " msg); BUG(); } while (0)
# define osi_Assert(expr) \
(void)((exp) || (osi_AssertFailK( #exp , __FILE__, __LINE__), 0))
#endif
-#ifdef AFS_LINUX20_ENV
-# define osi_Msg printk)(
-#else
-# define osi_Msg printf)(
+#if (defined(AFS_AIX_ENV) && defined(KERNEL))
+# define osi_Msg printf
#endif
-#define osi_VMsg vprintf)(
#define osi_YieldIfPossible()
#define osi_WakeupAndYieldIfPossible(x) rx_Wakeup(x)
*/
if (fcntl(sock, F_SETFL, FNDELAY) == -1) {
perror("fcntl");
- (osi_Msg "rxi_Listen: unable to set non-blocking mode on socket\n");
+ osi_Msg("rxi_Listen: unable to set non-blocking mode on socket\n");
return -1;
}
if (sock > FD_SETSIZE - 1) {
- (osi_Msg "rxi_Listen: socket descriptor > (FD_SETSIZE-1) = %d\n",
+ osi_Msg("rxi_Listen: socket descriptor > (FD_SETSIZE-1) = %d\n",
FD_SETSIZE - 1);
return -1;
}
if (!sfds) {
if (!(sfds = IOMGR_AllocFDSet())) {
- (osi_Msg "rx failed to alloc fd_set: ");
+ osi_Msg("rx failed to alloc fd_set: ");
perror("rx_sendmsg");
err = ENOMEM;
goto error;
}
#ifdef AFS_NT40_ENV
if (err)
-#elif defined(AFS_LINUX22_ENV)
+#elif defined(AFS_LINUX_ENV)
/* linux unfortunately returns ECONNREFUSED if the target port
* is no longer in use */
/* and EAGAIN if a UDP checksum is incorrect */
if (err != EWOULDBLOCK && err != ENOBUFS)
#endif
{
- (osi_Msg "rx failed to send packet: ");
+ osi_Msg("rx failed to send packet: ");
perror("rx_sendmsg");
goto error;
}
#ifndef _RX_LWP_H_
#define _RX_LWP_H_
-/* KDUMP_KERNEL is defined when kdump includes this header. */
-#ifndef KDUMP_KERNEL
-
typedef int afs_kmutex_t;
typedef int afs_kcondvar_t;
#define CV_BROADCAST(cv)
#define CV_TIMEDWAIT(cv, l, t)
-#endif /* KERNEL */
-
#endif /* _RX_LWP_H_ */
* RX_LOCKS_DB versions of MUTEX_{ENTER, EXIT, TRYENTER} and CV_*WAIT to
* rx_kmutex.h and define lock macros below.
*/
-#if (defined(AFS_AIX41_ENV) || (defined(AFS_SGI53_ENV) && defined(MP))) && defined(KERNEL)
+#if (defined(AFS_AIX41_ENV) || (defined(AFS_SGI_ENV) && defined(MP))) && defined(KERNEL)
#ifdef AFS_AIX41_ENV
Simple_lock rxdb_lock;
#define RXDB_LOCK_ENTER() simple_lock(&rxdb_lock)
#define RXDB_LOCK_EXIT() simple_unlock(&rxdb_lock)
#else /* AFS_AIX41_ENV */
-#ifdef AFS_SGI53_ENV
+#ifdef AFS_SGI_ENV
afs_kmutex_t rxdb_lock;
#define RXDB_LOCK_INIT() mutex_init(&rxdb_lock, "rxdb lock", 0, 0)
#define RXDB_LOCK_ENTER() AFS_MUTEX_ENTER(&rxdb_lock)
#define RXDB_LOCK_EXIT() mutex_exit(&rxdb_lock)
-#endif /* AFS_SGI53_ENV */
+#endif /* AFS_SGI_ENV */
#endif /* AFS_AIX41_ENV */
RXDB_LOCK_EXIT();
}
-#endif /* (AIX41 || SGI53) && KERNEL */
+#endif /* (AIX41 || SGI) && KERNEL */
#endif /* RX_LOCKS_DB */
osi_Free(mh->ready, sizeof(short) * nCalls);
osi_Free(mh, sizeof(struct multi_handle));
}
-
-/* ignores all remaining multiRx calls */
-void
-multi_Finalize_Ignore(struct multi_handle *mh)
-{
- int i;
- int nCalls = mh->nConns;
- for (i = 0; i < nCalls; i++) {
- struct rx_call *call = mh->calls[i];
- if (call)
- rx_EndCall(call, 0);
- }
- MUTEX_DESTROY(&mh->lock);
- CV_DESTROY(&mh->cv);
- osi_Free(mh->calls, sizeof(struct rx_call *) * nCalls);
- osi_Free(mh->ready, sizeof(short) * nCalls);
- osi_Free(mh, sizeof(struct multi_handle));
-}
multi_Finalize(multi_h);\
} while (0)
-/* Ignore remaining multi RPC's */
-#define multi_End_Ignore\
- multi_Finalize_Ignore(multi_h);\
- } while (0)
-
#endif /* _RX_MULTI_ End of rx_multi.h */
# 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_LINUX20_ENV
+# ifndef AFS_LINUX_ENV
# include "h/systm.h"
# endif
# if defined(AFS_SGI_ENV) || defined(AFS_HPUX110_ENV) || defined(AFS_NBSD50_ENV)
# include "h/proc.h"
# endif
# include "h/socket.h"
-# if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_HPUX110_ENV)
+# if !defined(AFS_SUN5_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_HPUX110_ENV)
# if !defined(AFS_AIX41_ENV)
# include "sys/mount.h" /* it gets pulled in by something later anyway */
# endif
#define m_cpytoc(a, b, c, d) cpytoc(a, b, c, d)
#define m_cpytoiovec(a, b, c, d, e) cpytoiovec(a, b, c, d, e)
#else
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN80_ENV)
static int
m_cpytoiovec(struct mbuf *m, int off, int len, struct iovec iovs[], int niovs)
{
return len;
}
-#endif /* LINUX */
+#endif /* !AFS_LINUX_ENV && !AFS_DARWIN80_ENV */
#endif /* AFS_SUN5_ENV */
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN80_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN80_ENV)
#if defined(AFS_NBSD_ENV)
int
rx_mb_to_packet(struct mbuf *amb, void (*free) (struct mbuf *), int hdr_len, int data_len, struct rx_packet *phandle)
ap->header.flags = ap->header.flags & ~RX_CLIENT_INITIATED;
rxi_EncodePacketHeader(ap);
memset(buf, 0, sizeof(buf));
- strncpy(buf, cml_version_number + 4, sizeof(buf) - 1);
+ strlcpy(buf, cml_version_number + 4, sizeof(buf));
rx_packetwrite(ap, 0, 65, buf);
tl = ap->length;
ap->length = 65;
if (code == -WSAEHOSTUNREACH) {
down = 1;
}
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
if (code == -ENETUNREACH) {
down = 1;
}
#else /* AFS_NT40_ENV */
# if !defined(AFS_DARWIN_ENV) && !defined(AFS_USR_DARWIN_ENV) \
&& !defined(AFS_XBSD_ENV) && !defined(AFS_USR_FBSD_ENV) \
- && !defined(AFS_USR_DFBSD_ENV) && !defined(AFS_LINUX20_ENV)
+ && !defined(AFS_USR_DFBSD_ENV) && !defined(AFS_LINUX_ENV)
# include <sys/sysmacros.h> /* MIN, MAX on most commercial UNIX */
# endif
/* Linux 3.7 doesn't have sys/param.h in kernel space, and afs/param.h ensures
* that MIN and MAX are available for kernel builds. */
-# if !(defined(AFS_LINUX26_ENV) && defined(KERNEL))
+# if !(defined(AFS_LINUX_ENV) && defined(KERNEL))
# include <sys/param.h> /* MIN, MAX elsewhere */
# endif
#endif /* !AFS_NT40_ENV */
/* A peer refers to a peer process, specified by a (host,port) pair. There may
* be more than one peer on a given host. */
-#ifdef KDUMP_RX_LOCK
-struct rx_peer_rx_lock {
- struct rx_peer_rx_lock *next; /* Next in hash conflict or free list */
-#else
struct rx_peer {
struct rx_peer *next; /* Next in hash conflict or free list */
-#endif
#ifdef RX_ENABLE_LOCKS
afs_kmutex_t peer_lock; /* Lock peer */
#endif /* RX_ENABLE_LOCKS */
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);
# ifdef UKERNEL
extern void *rx_ServerProc(void *);
# endif
-# ifndef AFS_LINUX26_ENV
+# ifndef AFS_LINUX_ENV
extern void osi_AssertFailK(const char *expr, const char *file, int line) AFS_NORETURN;
# endif
extern void rxk_Listener(void);
extern void osi_StopListener(void);
/* ARCH/rx_kmutex.c */
-# if defined(AFS_LINUX20_ENV)
+# if defined(AFS_LINUX_ENV)
extern void afs_mutex_init(afs_kmutex_t * l);
extern void afs_mutex_enter(afs_kmutex_t * l);
extern int afs_mutex_tryenter(afs_kmutex_t * l);
struct iovec *dvec, int nvecs, afs_int32 asize,
int istack);
# endif
-# ifdef RXK_UPCALL_ENV
+# ifdef AFS_SOCKPROXY_ENV
+extern void rxk_SockProxySetup(void);
+extern void rxk_SockProxyFinish(void);
+extern int rxk_SockProxyReply(struct afs_uspc_param *uspc,
+ struct afs_pkt_hdr *pkts_recv,
+ struct afs_pkt_hdr **pkts_send);
+# elif defined(RXK_UPCALL_ENV)
extern void rx_upcall(socket_t so, void *arg, __unused int waitflag);
# else
extern int osi_NetReceive(osi_socket so, struct sockaddr_in *addr,
# if defined(AFS_SUN510_ENV)
extern void osi_StartNetIfPoller(void);
extern void osi_NetIfPoller(void);
-extern void osi_StopNetIfPoller(void);
extern struct afs_ifinfo afsifinfo[ADDRSPERSITE];
# endif
+# if defined(AFS_SUN510_ENV) || defined(RXK_UPCALL_ENV)
+extern void osi_StopNetIfPoller(void);
+# endif
extern void osi_StopListener(void);
extern int rxi_FindIfMTU(afs_uint32 addr);
# if defined(UKERNEL)
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);
extern void multi_Ready(struct rx_call *call,
void *mh, int index);
extern void multi_Finalize(struct multi_handle *mh);
-extern void multi_Finalize_Ignore(struct multi_handle *mh);
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));
#endif
#ifndef AFS_RXERRQ_ENV
-# ifdef AFS_LINUX22_ENV
+# ifdef AFS_LINUX_ENV
/* linux unfortunately returns ECONNREFUSED if the target port
* is no longer in use */
/* and EAGAIN if a UDP checksum is incorrect */
#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 defined(AFS_AIX_ENV) || defined(AFS_AUX_ENV) || defined(AFS_SUN5_ENV)
# include "h/systm.h"
# endif
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
# include "h/socket.h"
# endif
# include "netinet/in.h"
* in GetCall.
*/
-#ifdef KDUMP_RX_LOCK
-struct rx_serverQueueEntry_rx_lock {
-#else
struct rx_serverQueueEntry {
-#endif
struct opr_queue entry;
-#ifdef KDUMP_RX_LOCK
- struct rx_call_rx_lock *newcall;
-#else
struct rx_call *newcall;
-#endif
#ifdef RX_ENABLE_LOCKS
afs_kmutex_t lock;
afs_kcondvar_t cv;
#define IPPORT_USERRESERVED 5000
# endif
-#if defined(AFS_LINUX22_ENV) && defined(AFS_RXERRQ_ENV)
+#if defined(AFS_LINUX_ENV) && defined(AFS_RXERRQ_ENV)
# include <linux/types.h>
# include <linux/errqueue.h>
# if defined(AFS_ADAPT_PMTU) && !defined(IP_MTU)
osi_socket socketFd = OSI_NULLSOCKET;
struct sockaddr_in taddr;
char *name = "rxi_GetUDPSocket: ";
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
# if defined(AFS_ADAPT_PMTU)
int pmtu = IP_PMTUDISC_WANT;
# else
#if !defined(AFS_NT40_ENV)
if (ntohs(port) >= IPPORT_RESERVED && ntohs(port) < IPPORT_USERRESERVED) {
-/* (osi_Msg "%s*WARNING* port number %d is not a reserved port number. Use port numbers above %d\n", name, port, IPPORT_USERRESERVED);
+/* osi_Msg("%s*WARNING* port number %d is not a reserved port number. Use port numbers above %d\n", name, port, IPPORT_USERRESERVED);
*/ ;
}
if (ntohs(port) > 0 && ntohs(port) < IPPORT_RESERVED && geteuid() != 0) {
- (osi_Msg
+ osi_Msg(
"%sport number %d is a reserved port number which may only be used by root. Use port numbers above %d\n",
name, ntohs(port), IPPORT_USERRESERVED);
goto error;
break;
}
if (code) {
- (osi_Msg "%sbind failed\n", name);
+ osi_Msg("%sbind failed\n", name);
goto error;
}
#if !defined(AFS_NT40_ENV)
(socketFd, SOL_SOCKET, SO_RCVBUF, (char *)&len2,
sizeof(len2)) >= 0);
if (!greedy)
- (osi_Msg "%s*WARNING* Unable to increase buffering on socket\n",
+ osi_Msg("%s*WARNING* Unable to increase buffering on socket\n",
name);
if (rx_stats_active)
rx_atomic_set(&rx_stats.socketGreedy, greedy);
}
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
setsockopt(socketFd, SOL_IP, IP_MTU_DISCOVER, &pmtu, sizeof(pmtu));
#endif
#ifdef AFS_RXERRQ_ENV
}
void
+osi_Msg(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+}
+
+void
osi_Panic(char *msg, ...)
{
va_list ap;
va_start(ap, msg);
- (osi_Msg "Fatal Rx error: ");
- (osi_VMsg msg, ap);
+ fprintf(stderr, "Fatal Rx error: ");
+ vfprintf(stderr, msg, ap);
va_end(ap);
fflush(stderr);
fflush(stdout);
-#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN160_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN160_ENV)
int
rxi_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
{
}
#endif /* SIOCGIFFLAGS */
-#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN160_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN160_ENV)
/* this won't run on an AIX system w/o a cache manager */
rxi_syscallp = rxi_syscall;
#endif
#define osi_Assert(e) opr_Assert(e)
-#define osi_Msg fprintf)(stderr,
-#define osi_VMsg vfprintf)(stderr,
-
#endif /* RX_USER_INCLUDE */
rx_PrintStats(debugFile);
}
-#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX_ENV)
int
test_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
{
int setFD = 0;
int jumbo = 0;
-#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX_ENV)
setlinebuf(stdout);
rxi_syscallp = test_syscall;
#endif
rx_PrintStats(debugFile);
}
-#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX_ENV)
int
test_syscall(a3, a4, a5)
afs_uint32 a3, a4;
int setFD = 0;
int jumbo = 0;
-#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_NT40_ENV) && !defined(AFS_LINUX_ENV)
setlinebuf(stdout);
rxi_syscallp = test_syscall;
#endif
#ifndef NeXT
#if defined(KERNEL) && !defined(UKERNEL)
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX_ENV)
#include <sys/param.h>
#endif
-#ifndef AFS_LINUX20_ENV
+#ifndef AFS_LINUX_ENV
#include <sys/systm.h>
#endif
#endif
if (!xdr_u_int(xdrs, &size)) {
return (FALSE);
}
- if (size > maxsize) {
+ if (xdrs->x_op != XDR_FREE && size > maxsize) {
return (FALSE);
}
nodesize = size + 1;
x.x_op = XDR_FREE;
/* See note in xdr.h for the method behind this madness */
-#if defined(AFS_I386_LINUX26_ENV) && defined(KERNEL) && !defined(UKERNEL)
+#ifdef AFS_XDRPROC_NO_VARARG
(*proc)(&x, obj, 0);
#else
(*proc)(&x, obj);
* uses a register (rather than stack) based calling convention. The
* normal va_args prototype results in the arguments being placed on the
* stack, where they aren't accessible to the 'real' function.
+ *
+ * On apple-arm64, if you implement a function with fixed parameters, but
+ * redeclare it with variadic parameters, the mismatch causes unexpected
+ * behavior.
*/
-#if defined(AFS_I386_LINUX26_ENV) && defined(KERNEL) && !defined(UKERNEL)
+#if defined(AFS_I386_LINUX_ENV) && defined(KERNEL) && !defined(UKERNEL)
+# define AFS_XDRPROC_NO_VARARG
+#elif defined(AFS_ARM64_DARWIN_ENV)
+# define AFS_XDRPROC_NO_VARARG
+#endif
+
+#ifdef AFS_XDRPROC_NO_VARARG
typedef bool_t(*xdrproc_t) (void *, caddr_t, u_int);
#else
typedef bool_t(*xdrproc_t) (void *, ...);
#include <afs/param.h>
#if defined(KERNEL) && !defined(UKERNEL)
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#include "h/string.h"
#else
#include <sys/param.h>
*/
#if defined(KERNEL) && !defined(UKERNEL)
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX_ENV)
#include <sys/param.h>
#endif
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#include "h/string.h"
#else
#ifndef AFS_DARWIN90_ENV
#include <sys/systm.h>
#endif
-#endif /* AFS_LINUX20_ENV */
+#endif /* AFS_LINUX_ENV */
#endif
#include "xdr.h"
*/
#if defined(KERNEL) && !defined(UKERNEL)
-#if !defined(AFS_LINUX26_ENV)
+#if !defined(AFS_LINUX_ENV)
#include <sys/param.h>
#endif
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#include "h/string.h"
#else
#include <sys/systm.h>
#ifndef NeXT
#if defined(KERNEL) && !defined(UKERNEL)
-# if !defined(AFS_LINUX26_ENV)
+# if !defined(AFS_LINUX_ENV)
# include <sys/param.h>
# endif
#else
#if defined(KERNEL) && !defined(UKERNEL)
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#include "h/string.h"
#else
#include <sys/param.h>
# ifndef UKERNEL
# include "h/types.h"
# include "h/uio.h"
-# ifdef AFS_LINUX20_ENV
+# ifdef AFS_LINUX_ENV
# include "h/socket.h"
-# endif
-# ifdef AFS_LINUX22_ENV
# ifndef quad_t
# define quad_t __quad_t
# define u_quad_t __u_quad_t
return code;
}
-#ifdef undef /* not used */
-static u_int
-xdrrx_getpos(XDR * xdrs)
-{
- /* Not supported. What error code should we return? (It doesn't matter: it will never be called, anyway!) */
- return -1;
-}
-
-static bool_t
-xdrrx_setpos(XDR * xdrs, u_int pos)
-{
- /* Not supported */
- return FALSE;
-}
-#endif
-
static afs_int32 *
xdrrx_inline(XDR *axdrs, u_int len)
{
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,
+++ /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>
-
-
-#ifdef RXDEBUG
-
-#include <roken.h>
-
-#include <afs/afsutil.h>
-
-#include "rx.h"
-#include "rx_globals.h"
-#include "rx_trace.h"
-
-extern char *rxi_tracename;
-extern int rxi_logfd;
-
-struct rx_trace {
- afs_uint32 cid;
- unsigned short call;
- unsigned short qlen;
- afs_uint32 now;
- afs_uint32 waittime;
- afs_uint32 servicetime;
- afs_uint32 event;
-};
-
-int
-main(int argc, char **argv)
-{
- struct rx_trace ip;
- int err = 0;
-
- setlinebuf(stdout);
- argv++;
- argc--;
- while (argc && **argv == '-') {
- if (strcmp(*argv, "-trace") == 0) {
- strcpy(rxi_tracename, *(++argv));
- argc--;
- } else {
- err++;
- break;
- }
- argv++, argc--;
- }
- if (err || argc != 0) {
- printf("usage: dumptrace [-trace pathname]");
- exit(1);
- }
-
- rxi_logfd = open(rxi_tracename, O_RDONLY);
- if (rxi_logfd < 0) {
- perror("");
- exit(errno);
- }
-
- while (read(rxi_logfd, &ip, sizeof(struct rx_trace))) {
- printf("%9u ", ip.now);
- switch (ip.event) {
- case RX_CALL_END:
- putchar('E');
- break;
- case RX_CALL_START:
- putchar('S');
- break;
- case RX_CALL_ARRIVAL:
- putchar('A');
- break;
- case RX_TRACE_DROP:
- putchar('D');
- break;
- default:
- putchar('U');
- break;
- }
- printf(" %3u %7u %7u %x.%x\n", ip.qlen, ip.servicetime,
- ip.waittime, ip.cid, ip.call);
- }
- return 0;
-}
-
-#endif
}
dflt = def->def.un.default_decl;
if (dflt != NULL) {
+ f_print(fout, "\tdefault:\n");
if (!streq(dflt->type, "void")) {
- f_print(fout, "\tdefault:\n");
object =
alloc(strlen(def->def_name) + strlen(format) +
strlen(dflt->name) + 1);
print_ifstat(2, dflt->prefix, dflt->type, dflt->rel,
dflt->array_max, object, dflt->name);
free(object);
- f_print(fout, "\t\tbreak;\n");
}
+ f_print(fout, "\t\tbreak;\n");
} else {
f_print(fout, "\tdefault:\n");
f_print(fout, "\t\treturn (FALSE);\n");
static int
undefined2(char *type, char *stop)
{
- list *l;
+ rxgen_list *l;
definition *def;
for (l = defined; l != NULL; l = l->next) {
f_print(fout, "#include \"h/socket.h\"\n");
f_print(fout, "#endif\n");
f_print(fout, "#ifndef DTYPE_SOCKET /* XXXXX */\n");
- f_print(fout, "#ifndef AFS_LINUX22_ENV\n");
+ f_print(fout, "#ifndef AFS_LINUX_ENV\n");
f_print(fout, "#include \"h/file.h\"\n");
f_print(fout, "#endif\n");
f_print(fout, "#endif\n");
f_print(fout, "#include \"h/time.h\"\n");
f_print(fout, "#endif\n");
f_print(fout, "#ifndef XDR_GETLONG /* XXXXX */\n");
- f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
+ f_print(fout, "#ifdef AFS_LINUX_ENV\n");
f_print(fout, "#ifndef quad_t\n");
f_print(fout, "#define quad_t __quad_t\n");
f_print(fout, "#define u_quad_t __u_quad_t\n");
#include "rpc_parse.h"
#include "rpc_util.h"
-list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined,
+rxgen_list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined,
*uniondef_defined, *complex_defined;
char *SplitStart = NULL;
char *SplitEnd = NULL;
static int
opcodenum_is_defined(int opcode_num)
{
- list *listp;
+ rxgen_list *listp;
definition *defp;
for (listp = proc_defined[PackageIndex]; listp != NULL;
ss_ProcParams_setup(definition * defp)
{
proc1_list *plist, *plist1;
- list *listp;
+ rxgen_list *listp;
definition *defp1;
for (plist = defp->pc.plists; plist; plist = plist->next) {
{
proc1_list *plist;
definition *defp1;
- list *listp;
+ rxgen_list *listp;
for (listp = special_defined; listp != NULL; listp = listp->next) {
defp1 = (definition *) listp->val;
{
proc1_list *plist;
definition *defp1;
- list *listp;
+ rxgen_list *listp;
int somefrees = 0;
if (defp->can_fail) {
static void
er_ProcDeclExterns_setup(void)
{
- list *listp;
+ rxgen_list *listp;
definition *defp;
if ( !Sflag )
static void
er_ProcProcsArray_setup(void)
{
- list *listp;
+ rxgen_list *listp;
definition *defp;
if ((listp = proc_defined[PackageIndex])) {
static void
er_BodyofOldStyleProc_setup(void)
{
- list *listp;
+ rxgen_list *listp;
if (combinepackages) {
int temp = PackageIndex;
static void
er_BodyofOldStyleProc_setup2(void)
{
- list *listp;
+ rxgen_list *listp;
if (!cflag)
return;
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
void
h_opcode_stats_pkg(char *pprefix, int lowest, int highest, int nops,
- int statfuncs, char *ptype, list *proclist)
+ int statfuncs, char *ptype, rxgen_list *proclist)
{
- list *listp;
+ rxgen_list *listp;
if (!pprefix)
return;
static int cppline(char *line);
static int directive(char *line);
static void docppline(char *line, int *lineno, char **fname);
-#ifdef undef
-static void deverbatim(void);
-#endif
-
/*
* scan expecting 1 given token
}
*lineno = num - 1;
}
-
-
-#ifdef undef
-/* doesn't appear to be used */
-static void
-deverbatim(void)
-{
- for (where += 2; !verbatimend(where); where++) {
- if (*where == 0) {
- if (!fgets(curline, MAXLINESIZE, fin)) {
- error("unterminated code: %} is missing");
- }
- linenum++;
- where = curline - 1;
- if (verbatimend(curline)) {
- where++;
- break;
- }
- fputs(curline, fout);
- }
- }
- where += 2;
-}
-#endif
FILE *fout; /* file pointer of current output */
FILE *fin; /* file pointer of current input */
-list *defined; /* list of defined things */
+rxgen_list *defined; /* list of defined things */
/* static prototypes */
static int findit(definition * def, char *type);
* find a value in a list
*/
char *
-findval(list * lst, char *val, int (*cmp) (definition * def, char *type))
+findval(rxgen_list * lst, char *val, int (*cmp) (definition * def, char *type))
{
for (; lst != NULL; lst = lst->next) {
if ((*cmp) ((definition *) lst->val, val)) {
* store a value in a list
*/
void
-storeval(list ** lstp, char *val)
+storeval(rxgen_list ** lstp, char *val)
{
- list **l;
- list *lst;
+ rxgen_list **l;
+ rxgen_list *lst;
- for (l = lstp; *l != NULL; l = (list **) & (*l)->next);
- lst = ALLOC(list);
+ for (l = lstp; *l != NULL; l = (rxgen_list **) & (*l)->next);
+ lst = ALLOC(rxgen_list);
lst->val = val;
lst->next = NULL;
*l = lst;
#define s_print (void) sprintf
#define f_print if (scan_print) (void) fprintf
-struct list {
+struct rxgen_list {
char *val;
- struct list *next;
+ struct rxgen_list *next;
};
-typedef struct list list;
+typedef struct rxgen_list rxgen_list;
#define MAXLINESIZE 1024
extern int nfiles;
extern FILE *fout;
extern FILE *fin;
-extern list *defined;
+extern rxgen_list *defined;
extern void reinitialize(void);
extern int streq(char *a, char *b);
-extern char *findval(list * lst, char *val,
+extern char *findval(rxgen_list * lst, char *val,
int (*cmp) (definition * def, char *type));
-extern void storeval(list ** lstp, char *val);
+extern void storeval(rxgen_list ** lstp, char *val);
extern char *fixtype(char *type);
extern char *stringfix(char *type);
extern void ptype(char *prefix, char *type, int follow);
extern void pdefine(char *name, char *num);
/* rpc_parse.c */
-extern list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined,
+extern rxgen_list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined,
*uniondef_defined;
extern char *SplitStart;
extern char *SplitEnd;
#ifdef KERNEL
#ifndef UKERNEL
#include "h/types.h"
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_OBSD_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_OBSD_ENV)
#include "netinet/in.h"
#endif
#else /* UKERNEL */
#include "afs/sysincludes.h"
#endif /* UKERNEL */
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
#include <asm/byteorder.h>
#endif
#include "h/systm.h"
#endif
#include "h/types.h"
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_OBSD_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_OBSD_ENV)
#include "netinet/in.h"
#endif
#else /* UKERNEL */
#include "afs/sysincludes.h"
#endif /* UKERNEL */
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
#include <asm/byteorder.h>
#endif
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);
rxkad_NewClientSecurityObject
rxkad_NewKrb5ServerSecurityObject
rxkad_NewServerSecurityObject
+rxkad_StringToLevel
time_to_life
tkt_CheckTimes
tkt_DeriveDesKey
#if defined(AFS_AIX_ENV) || defined(AFS_AUX_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_XBSD_ENV)
#include "h/systm.h"
#endif
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#include "h/socket.h"
#endif
#ifndef AFS_OBSD_ENV
/* 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)) {
afs.exp: ${srcdir}/afs4.exp ${srcdir}/afs5.exp
@set -x; case ${SYS_NAME} in \
- rs_aix[56]* ) \
+ rs_aix[567]* ) \
cp -p ${srcdir}/afs5.exp afs.exp ;; \
rs_aix* ) \
cp -p ${srcdir}/afs4.exp afs.exp ;; \
afsl.exp: ${srcdir}/afsl4.exp ${srcdir}/afsl5.exp
@set -x; case ${SYS_NAME} in \
- rs_aix[56]* ) \
+ rs_aix[567]* ) \
cp -p ${srcdir}/afsl5.exp afsl.exp ;; \
rs_aix* ) \
cp -p ${srcdir}/afsl4.exp afsl.exp ;; \
}
-/* PrintInode
+/**
+ * Format a string to print either 32 or 64 bit inode numbers.
*
- * returns a static string used to print either 32 or 64 bit inode numbers.
+ * @param[out] s string buffer
+ * @param[in] ino inode number
+ * @returns pointer to formatted inode number string
*/
-#ifdef AFS_64BIT_IOPS_ENV
-char *
-PrintInode(char *s, Inode ino)
-#else
char *
PrintInode(afs_ino_str_t s, Inode ino)
-#endif
{
- static afs_ino_str_t result;
-
- if (!s)
- s = result;
-
#ifdef AFS_64BIT_IOPS_ENV
(void)sprintf((char *)s, "%llu", ino);
#else
#else /* AFS_NAMEI_ENV */
#ifdef AFS_64BIT_IOPS_ENV
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
typedef uint64_t Inode;
#else
#include <sys/types.h>
typedef afs_uint64 Inode;
-#endif /* AFS_SGI62_ENV */
+#endif /* AFS_SGI_ENV */
#else /* AFS_64BIT_IOPS_ENV */
typedef unsigned int Inode;
#endif
#endif
/* Glue layer. */
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
int proc_afs_syscall(long syscall, long param1, long param2, long param3,
long param4, int *rval);
#endif
#define AFS_INO_STR_LENGTH 32
typedef char afs_ino_str_t[AFS_INO_STR_LENGTH];
-/* Print either 32 or 64 bit inode numbers. char * may be NULL. In which case
- * a local statis is returned.
+/* Format either 32 or 64 bit inode numbers.
*/
-#ifdef AFS_64BIT_IOPS_ENV
-extern char *PrintInode(afs_ino_str_t, Inode);
-#else
-extern char *PrintInode();
-#endif
+extern char *PrintInode(afs_ino_str_t s, Inode ino) AFS_NONNULL((1));
/* Some places in the code assume icreate can return 0 when there's
* an error.
#include "afssyscalls.h"
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
int proc_afs_syscall(long syscall, long param1, long param2, long param3,
long param4, int *rval) {
struct afsprocdata syscall_data;
{
int inode;
struct stat status;
-#ifdef AFS_SGI61_ENV
+#ifdef AFS_SGI_ENV
int vnode, unique, datav;
-#else /* AFS_SGI61_ENV */
+#else /* AFS_SGI_ENV */
afs_int32 vnode, unique, datav;
-#endif /* AFS_SGI61_ENV */
+#endif /* AFS_SGI_ENV */
if (stat("/vicepa", &status) == -1) {
perror("stat");
int fd, n;
struct stat status;
Inode ino;
+ afs_ino_str_t inode_str;
if (argc != 3)
Usage();
}
printf("ino=%" AFS_INT64_FMT "\n", ino);
printf("About to iopen(dev=(%d,%d), inode=%s, mode=%d\n",
- major(status.st_dev), minor(status.st_dev), PrintInode(NULL, ino),
+ major(status.st_dev), minor(status.st_dev), PrintInode(inode_str, ino),
O_RDONLY);
fflush(stdout);
fd = IOPEN(status.st_dev, ino, O_RDONLY);
return (syscall(AFS_PIOCTL, path, cmd, cmarg, follow));
}
-#elif defined(AFS_LINUX20_ENV)
+#elif defined(AFS_LINUX_ENV)
int
lpioctl(char *path, int cmd, void *cmarg, int follow)
#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)
{
int errcode;
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
int rval;
rval = proc_afs_syscall(AFSCALL_SETPAG,0,0,0,0,&errcode);
#define _SYS_PROTOTYPES_H
/* glue.c */
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
extern int proc_afs_syscall(long, long, long, long, long, int *);
#endif
#ifdef AFS_DARWIN80_ENV
#include <afs/vnode.h>
#include <afs/volume.h>
-#ifdef AFS_LINUX24_ENV
+#ifdef AFS_LINUX_ENV
#define _LARGEFILE64_SOURCE 1
#endif
#ifdef RESIDENCY
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;
}
AUTHLIBS= \
afs_dynamic_auth afs_dynamic_kerbauth @MAKE_KRB5@ aklog_dynamic_auth
-IMPORTS = -bI:/lib/aio.exp -bI:/lib/netinet.exp -bI:/lib/sockets.exp -bI:/lib/statcmd.exp
-LDFLAGS = -eafs_initialize ${IMPORTS} -lsys -lcsys -lc
-AKLDFLAGS = -eaklog_initialize ${IMPORTS} -lsys -lcsys -lc
+IMPORTS = @TSM_IMPORTS@
+LDFLAGS = -eafs_initialize ${IMPORTS} @TSM_LIBS@
+AKLDFLAGS = -eaklog_initialize ${IMPORTS} @TSM_LIBS@
all: $(AUTHLIBS)
@set -e; set -x; case "$(SYS_NAME)" in \
rs_aix4*) \
${CC} ${AFS_CFLAGS} -c ${srcdir}/aix41_auth.c -o $@ ;; \
- rs_aix5*) \
- ${CC} ${AFS_CFLAGS} -c ${srcdir}/aix5_auth.c -o $@ ;; \
- rs_aix6*) \
+ rs_aix[567]*) \
${CC} ${AFS_CFLAGS} -c ${srcdir}/aix5_auth.c -o $@ ;; \
*) \
echo "not building aix lam binary for ${SYS_NAME}" ;; \
}
}
+/*!
+ * 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 */
afs_int32 apos, afs_int32 alen)
{
char *bp;
- afs_int32 offset, len, totalLen;
+ afs_int32 offset, len;
if (atrans->flags & TRDONE)
return UDONE;
- totalLen = 0;
while (alen > 0) {
bp = DRead(atrans, afile, apos >> UBIK_LOGPAGESIZE);
if (!bp)
abuffer = (char *)abuffer + len;
apos += len;
alen -= len;
- totalLen += len;
DRelease(bp, 0);
}
return 0;
afs_int32 apos, afs_int32 alen)
{
char *bp;
- afs_int32 offset, len, totalLen;
+ afs_int32 offset, len;
struct ubik_trunc *tt;
afs_int32 code;
}
/* now update vm */
- totalLen = 0;
while (alen > 0) {
bp = DRead(atrans, afile, apos >> UBIK_LOGPAGESIZE);
if (!bp) {
abuffer = (char *)abuffer + len;
apos += len;
alen -= len;
- totalLen += len;
DRelease(bp, 1); /* buffer modified */
}
return 0;
+DISK_function_names
EndDISK_GetFile
StartDISK_GetFile
VOTE_Debug
VOTE_SDebugOld
VOTE_XDebug
VOTE_XSDebug
+VOTE_function_names
initialize_U_error_table
ubik_AbortTrans
ubik_BeginTrans
ubik_BeginTransReadAny
ubik_BeginTransReadAnyWrite
ubik_CallIter
+ubik_CallRock
ubik_CheckCache
ubik_ClientDestroy
ubik_ClientInit
char hoststr[16];
char pbuffer[1028];
int fd = -1;
+#ifndef AFS_PTHREAD_ENV
afs_int32 pass;
+#endif
+ int first;
memset(pbuffer, 0, sizeof(pbuffer));
/* otherwise, begin interaction */
urecovery_state = 0;
lastProbeTime = 0;
- while (1) {
- /* Run through this loop every 4 seconds */
- tv.tv_sec = 4;
- tv.tv_usec = 0;
+ for (first = 1; ; first = 0) {
+ if (!first) {
+ /* Run through this loop every 4 seconds (but don't wait 4 seconds
+ * the first time around). */
+ tv.tv_sec = 4;
+ tv.tv_usec = 0;
#ifdef AFS_PTHREAD_ENV
- select(0, 0, 0, 0, &tv);
+ select(0, 0, 0, 0, &tv);
#else
- IOMGR_Select(0, 0, 0, 0, &tv);
+ IOMGR_Select(0, 0, 0, 0, &tv);
#endif
+ }
ViceLog(5, ("recovery running in state %x\n", urecovery_state));
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);
multi_Abort;
}
- } multi_End_Ignore;
+ } multi_End;
if (success_i >= 0) {
UBIK_ADDR_LOCK;
/* 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));
afs_int32 code;
struct ubik_dbase *dbase = NULL;
char tbuffer[1024];
- afs_int32 offset;
struct ubik_version tversion;
int tlen;
struct rx_peer *tpeer;
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;
ViceLog(0, ("Ubik: Synchronize database: receive (via SendFile) from server %s begin\n",
afs_inet_ntoa_r(otherHost, hoststr)));
- offset = 0;
UBIK_VERSION_LOCK;
epoch = tversion.epoch = 0; /* start off by labelling in-transit db as invalid */
(*dbase->setlabel) (dbase, file, &tversion); /* setlabel does sync */
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;
close(fd);
goto failed;
}
- offset += tlen;
length -= tlen;
}
code = close(fd);
#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[]);
+extern int ubeacon_updateUbikNetworkAddress(afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR]);
extern struct beacon_data beacon_globals;
extern struct addr_data addr_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)
#define uss_VolumeLen 300
#define uss_DirPoolLen 300
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
extern char *sys_errlist[];
#endif
${TOP_INCDIR}/afs/afs_lhash.h \
${TOP_INCDIR}/afs/work_queue.h \
${TOP_INCDIR}/afs/work_queue_types.h \
- ${TOP_INCDIR}/afs/thread_pool.h \
- ${TOP_INCDIR}/afs/thread_pool_types.h \
${TOP_INCDIR}/afs/tabular_output.h
all: ${includes} \
${TOP_INCDIR}/afs/work_queue_types.h: ${srcdir}/work_queue_types.h
${INSTALL_DATA} $? $@
-${TOP_INCDIR}/afs/thread_pool.h: ${srcdir}/thread_pool.h
- ${INSTALL_DATA} $? $@
-
-${TOP_INCDIR}/afs/thread_pool_types.h: ${srcdir}/thread_pool_types.h
- ${INSTALL_DATA} $? $@
-
${TOP_INCDIR}/afs/tabular_output.h: ${srcdir}/tabular_output.h
${INSTALL_DATA} $? $@
${INSTALL_DATA} ${srcdir}/afs_lhash.h ${DESTDIR}${includedir}/afs/afs_lhash.h
${INSTALL_DATA} ${srcdir}/work_queue.h ${DESTDIR}${includedir}/afs/work_queue.h
${INSTALL_DATA} ${srcdir}/work_queue_types.h ${DESTDIR}${includedir}/afs/work_queue_types.h
- ${INSTALL_DATA} ${srcdir}/thread_pool.h ${DESTDIR}${includedir}/afs/thread_pool.h
- ${INSTALL_DATA} ${srcdir}/thread_pool_types.h ${DESTDIR}${includedir}/afs/thread_pool_types.h
${INSTALL_DATA} ${srcdir}/tabular_output.h ${DESTDIR}${includedir}/afs/tabular_output.h
${INSTALL_DATA} util.a ${DESTDIR}${libdir}/afs/util.a
${INSTALL_DATA} util.a ${DESTDIR}${libdir}/afs/libafsutil.a
${INSTALL_DATA} ${srcdir}/afs_lhash.h ${DEST}/include/afs/afs_lhash.h
${INSTALL_DATA} ${srcdir}/work_queue.h ${DEST}/include/afs/work_queue.h
${INSTALL_DATA} ${srcdir}/work_queue_types.h ${DEST}/include/afs/work_queue_types.h
- ${INSTALL_DATA} ${srcdir}/thread_pool.h ${DEST}/include/afs/thread_pool.h
- ${INSTALL_DATA} ${srcdir}/thread_pool_types.h ${DEST}/include/afs/thread_pool_types.h
${INSTALL_DATA} ${srcdir}/tabular_output.h ${DEST}/include/afs/tabular_output.h
${INSTALL_DATA} util.a ${DEST}/lib/afs/util.a
${INSTALL_DATA} util.a ${DEST}/lib/afs/libafsutil.a
/* 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"
/* compare date in both formats, and return as in strcmp */
-#ifdef undef
-static int
-KTimeCmp(struct ktime *aktime, struct tm *atm)
-{
- afs_int32 tmask;
-
- /* don't compare day of the week, since we can't tell the
- * order in a cyclical set. Caller must check for equality, if
- * she cares */
- tmask = aktime->mask;
- if (tmask & KTIME_HOUR) {
- if (aktime->hour > atm->tm_hour)
- return 1;
- if (aktime->hour < atm->tm_hour)
- return -1;
- }
- if (tmask & KTIME_MIN) {
- if (aktime->min > atm->tm_min)
- return 1;
- if (aktime->min < atm->tm_min)
- return -1;
- }
- if (tmask & KTIME_SEC) {
- if (aktime->sec > atm->tm_sec)
- return 1;
- if (aktime->sec < atm->tm_sec)
- return -1;
- }
- return 0;
-}
-#endif
-
-/* compare date in both formats, and return as in strcmp */
static int
KDateCmp(struct ktime_date *akdate, struct tm *atm)
{
BufioClose
BufioGets
BufioOpen
+CloseLog
+ConstructLocalPath
+FilepathNormalize
FSLog
+GetLogDest
+GetLogFilename
+GetLogLevel
Int32To_ktimeRelDate
LogCommandLine
LogLevel
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 {
+++ /dev/null
-/*
- * Copyright 2008-2010, Sine Nomine Associates 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/opr.h>
-
-#include <lock.h>
-#include <afs/afsutil.h>
-#include <lwp.h>
-#include <afs/afsint.h>
-
-#define __AFS_THREAD_POOL_IMPL 1
-#include "work_queue.h"
-#include "thread_pool.h"
-#include "thread_pool_impl.h"
-
-/**
- * public interfaces for thread_pool.
- */
-
-/**
- * allocate a thread pool object.
- *
- * @param[inout] pool_out address in which to store pool object pointer
- *
- * @return operation status
- * @retval 0 success
- * @retval ENOMEM out of memory
- *
- * @internal
- */
-static int
-_afs_tp_alloc(struct afs_thread_pool ** pool_out)
-{
- int ret = 0;
- struct afs_thread_pool * pool;
-
- *pool_out = pool = malloc(sizeof(*pool));
- if (pool == NULL) {
- ret = ENOMEM;
- goto error;
- }
-
- error:
- return ret;
-}
-
-/**
- * free a thread pool object.
- *
- * @param[in] pool thread pool object
- *
- * @return operation status
- * @retval 0 success
- *
- * @internal
- */
-static int
-_afs_tp_free(struct afs_thread_pool * pool)
-{
- int ret = 0;
-
- free(pool);
-
- return ret;
-}
-
-/**
- * allocate a thread worker object.
- *
- * @param[inout] worker_out address in which to store worker object pointer
- *
- * @return operation status
- * @retval 0 success
- * @retval ENOMEM out of memory
- *
- * @internal
- */
-static int
-_afs_tp_worker_alloc(struct afs_thread_pool_worker ** worker_out)
-{
- int ret = 0;
- struct afs_thread_pool_worker * worker;
-
- *worker_out = worker = malloc(sizeof(*worker));
- if (worker == NULL) {
- ret = ENOMEM;
- goto error;
- }
-
- queue_NodeInit(&worker->worker_list);
-
- error:
- return ret;
-}
-
-/**
- * free a thread worker object.
- *
- * @param[in] worker thread worker object
- *
- * @return operation status
- * @retval 0 success
- *
- * @internal
- */
-static int
-_afs_tp_worker_free(struct afs_thread_pool_worker * worker)
-{
- int ret = 0;
-
- free(worker);
-
- return ret;
-}
-
-/**
- * low-level thread entry point.
- *
- * @param[in] rock opaque pointer to thread worker object
- *
- * @return opaque return pointer from pool entry function
- *
- * @internal
- */
-static void *
-_afs_tp_worker_run(void * rock)
-{
- struct afs_thread_pool_worker * worker = rock;
- struct afs_thread_pool * pool = worker->pool;
-
- /* register worker with pool */
- opr_mutex_enter(&pool->lock);
- queue_Append(&pool->thread_list, worker);
- pool->nthreads++;
- opr_mutex_exit(&pool->lock);
-
- /* call high-level entry point */
- worker->ret = (*pool->entry)(pool, worker, pool->work_queue, pool->rock);
-
- /* adjust pool live thread count */
- opr_mutex_enter(&pool->lock);
- opr_Assert(pool->nthreads);
- queue_Remove(worker);
- pool->nthreads--;
- if (!pool->nthreads) {
- opr_cv_broadcast(&pool->shutdown_cv);
- pool->state = AFS_TP_STATE_STOPPED;
- }
- opr_mutex_exit(&pool->lock);
-
- _afs_tp_worker_free(worker);
-
- return NULL;
-}
-
-/**
- * default high-level thread entry point.
- *
- * @internal
- */
-static void *
-_afs_tp_worker_default(struct afs_thread_pool *pool,
- struct afs_thread_pool_worker *worker,
- struct afs_work_queue *queue,
- void *rock)
-{
- int code = 0;
- while (code == 0 && afs_tp_worker_continue(worker)) {
- code = afs_wq_do(queue, NULL /* no call rock */);
- }
-
- return NULL;
-}
-
-/**
- * start a worker thread.
- *
- * @param[in] pool thread pool object
- * @param[inout] worker_out address in which to store worker thread object pointer
- *
- * @return operation status
- * @retval 0 success
- * @retval ENOMEM out of memory
- */
-static int
-_afs_tp_worker_start(struct afs_thread_pool * pool,
- struct afs_thread_pool_worker ** worker_out)
-{
- int ret = 0;
- pthread_attr_t attrs;
- struct afs_thread_pool_worker * worker;
-
- ret = _afs_tp_worker_alloc(worker_out);
- if (ret) {
- goto error;
- }
- worker = *worker_out;
-
- worker->pool = pool;
- worker->req_shutdown = 0;
-
- opr_Verify(pthread_attr_init(&attrs) == 0);
- opr_Verify(pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED) == 0);
-
- ret = pthread_create(&worker->tid, &attrs, &_afs_tp_worker_run, worker);
-
- error:
- return ret;
-}
-
-/**
- * create a thread pool.
- *
- * @param[inout] pool_out address in which to store pool object pointer.
- * @param[in] queue work queue serviced by thread pool
- *
- * @return operation status
- * @retval 0 success
- * @retval ENOMEM out of memory
- */
-int
-afs_tp_create(struct afs_thread_pool ** pool_out,
- struct afs_work_queue * queue)
-{
- int ret = 0;
- struct afs_thread_pool * pool;
-
- ret = _afs_tp_alloc(pool_out);
- if (ret) {
- goto error;
- }
- pool = *pool_out;
-
- opr_mutex_init(&pool->lock);
- opr_cv_init(&pool->shutdown_cv);
- queue_Init(&pool->thread_list);
- pool->work_queue = queue;
- pool->entry = &_afs_tp_worker_default;
- pool->rock = NULL;
- pool->nthreads = 0;
- pool->max_threads = 4;
- pool->state = AFS_TP_STATE_INIT;
-
- error:
- return ret;
-}
-
-/**
- * destroy a thread pool.
- *
- * @param[in] pool thread pool object to be destroyed
- *
- * @return operation status
- * @retval 0 success
- * @retval AFS_TP_ERROR pool not in a quiescent state
- */
-int
-afs_tp_destroy(struct afs_thread_pool * pool)
-{
- int ret = 0;
-
- opr_mutex_enter(&pool->lock);
- switch (pool->state) {
- case AFS_TP_STATE_INIT:
- case AFS_TP_STATE_STOPPED:
- _afs_tp_free(pool);
- break;
-
- default:
- ret = AFS_TP_ERROR;
- opr_mutex_exit(&pool->lock);
- }
-
- return ret;
-}
-
-/**
- * set the number of threads to spawn.
- *
- * @param[in] pool thread pool object
- * @param[in] threads number of threads to spawn
- *
- * @return operation status
- * @retval 0 success
- * @retval AFS_TP_ERROR thread pool has already been started
- */
-int
-afs_tp_set_threads(struct afs_thread_pool *pool,
- afs_uint32 threads)
-{
- int ret = 0;
-
- opr_mutex_enter(&pool->lock);
- if (pool->state != AFS_TP_STATE_INIT) {
- ret = AFS_TP_ERROR;
- } else {
- pool->max_threads = threads;
- }
- opr_mutex_exit(&pool->lock);
-
- return ret;
-}
-
-/**
- * set a custom thread entry point.
- *
- * @param[in] pool thread pool object
- * @param[in] entry thread entry function pointer
- * @param[in] rock opaque pointer passed to thread
- *
- * @return operation status
- * @retval 0 success
- * @retval AFS_TP_ERROR thread pool has already been started
- */
-int
-afs_tp_set_entry(struct afs_thread_pool * pool,
- afs_tp_worker_func_t * entry,
- void * rock)
-{
- int ret = 0;
-
- opr_mutex_enter(&pool->lock);
- if (pool->state != AFS_TP_STATE_INIT) {
- ret = AFS_TP_ERROR;
- } else {
- pool->entry = entry;
- pool->rock = rock;
- }
- opr_mutex_exit(&pool->lock);
-
- return ret;
-}
-
-/**
- * start a thread pool.
- *
- * @param[in] pool thread pool object
- *
- * @return operation status
- * @retval 0 success
- * @retval AFS_TP_ERROR thread create failure
- */
-int
-afs_tp_start(struct afs_thread_pool * pool)
-{
- int code, ret = 0;
- struct afs_thread_pool_worker * worker;
- afs_uint32 i;
-
- opr_mutex_enter(&pool->lock);
- if (pool->state != AFS_TP_STATE_INIT) {
- ret = AFS_TP_ERROR;
- goto done_sync;
- }
- pool->state = AFS_TP_STATE_STARTING;
- opr_mutex_exit(&pool->lock);
-
- for (i = 0; i < pool->max_threads; i++) {
- code = _afs_tp_worker_start(pool, &worker);
- if (code) {
- ret = code;
- }
- }
-
- opr_mutex_enter(&pool->lock);
- pool->state = AFS_TP_STATE_RUNNING;
- done_sync:
- opr_mutex_exit(&pool->lock);
-
- return ret;
-}
-
-/**
- * shut down all threads in pool.
- *
- * @param[in] pool thread pool object
- * @param[in] block wait for all threads to terminate, if asserted
- *
- * @return operation status
- * @retval 0 success
- */
-int
-afs_tp_shutdown(struct afs_thread_pool * pool,
- int block)
-{
- int ret = 0;
- struct afs_thread_pool_worker * worker, *nn;
-
- opr_mutex_enter(&pool->lock);
- if (pool->state == AFS_TP_STATE_STOPPED
- || pool->state == AFS_TP_STATE_STOPPING) {
- goto done_stopped;
- }
- if (pool->state != AFS_TP_STATE_RUNNING) {
- ret = AFS_TP_ERROR;
- goto done_sync;
- }
- pool->state = AFS_TP_STATE_STOPPING;
-
- for (queue_Scan(&pool->thread_list, worker, nn, afs_thread_pool_worker)) {
- worker->req_shutdown = 1;
- }
- if (!pool->nthreads) {
- pool->state = AFS_TP_STATE_STOPPED;
- }
- /* need to drop lock to get a membar here */
- opr_mutex_exit(&pool->lock);
-
- ret = afs_wq_shutdown(pool->work_queue);
- if (ret) {
- goto error;
- }
-
- opr_mutex_enter(&pool->lock);
- done_stopped:
- if (block) {
- while (pool->nthreads) {
- opr_cv_wait(&pool->shutdown_cv, &pool->lock);
- }
- }
- done_sync:
- opr_mutex_exit(&pool->lock);
-
- error:
- return ret;
-}
-
-/**
- * check whether thread pool is online.
- *
- * @param[in] pool thread pool object
- *
- * @return whether pool is online
- * @retval 1 pool is online
- * @retval 0 pool is not online
- */
-int
-afs_tp_is_online(struct afs_thread_pool * pool)
-{
- int ret;
-
- opr_mutex_enter(&pool->lock);
- ret = (pool->state == AFS_TP_STATE_RUNNING);
- opr_mutex_exit(&pool->lock);
-
- return ret;
-}
-
-/**
- * check whether a given worker thread can continue to run.
- *
- * @param[in] worker worker thread object pointer
- *
- * @return whether thread can continue to execute
- * @retval 1 execution can continue
- * @retval 0 shutdown has been requested
- */
-int
-afs_tp_worker_continue(struct afs_thread_pool_worker * worker)
-{
- return !worker->req_shutdown;
-}
+++ /dev/null
-/*
- * Copyright 2008-2010, Sine Nomine Associates 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_UTIL_THREAD_POOL_H
-#define AFS_UTIL_THREAD_POOL_H 1
-
-#include "thread_pool_types.h"
-
-/**
- * public interfaces for thread_pool.
- */
-
-/* XXX move these into an et */
-#define AFS_TP_ERROR -1 /**< fatal error in thread_pool package */
-
-extern int afs_tp_create(struct afs_thread_pool **,
- struct afs_work_queue *);
-extern int afs_tp_destroy(struct afs_thread_pool *);
-
-extern int afs_tp_set_threads(struct afs_thread_pool *, afs_uint32 threads);
-extern int afs_tp_set_entry(struct afs_thread_pool *,
- afs_tp_worker_func_t *,
- void * rock);
-
-extern int afs_tp_start(struct afs_thread_pool *);
-extern int afs_tp_shutdown(struct afs_thread_pool *,
- int block);
-
-extern int afs_tp_is_online(struct afs_thread_pool *);
-extern int afs_tp_worker_continue(struct afs_thread_pool_worker *);
-
-#endif /* AFS_UTIL_THREAD_POOL_H */
+++ /dev/null
-/*
- * Copyright 2008-2010, Sine Nomine Associates 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_UTIL_THREAD_POOL_IMPL_H
-#define AFS_UTIL_THREAD_POOL_IMPL_H 1
-
-#include "thread_pool.h"
-#include "thread_pool_impl_types.h"
-
-/**
- * implementation-private interfaces for thread_pool.
- */
-
-#endif /* AFS_UTIL_THREAD_POOL_IMPL_H */
+++ /dev/null
-/*
- * Copyright 2008-2010, Sine Nomine Associates 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_UTIL_THREAD_POOL_IMPL_TYPES_H
-#define AFS_UTIL_THREAD_POOL_IMPL_TYPES_H 1
-
-#ifndef __AFS_THREAD_POOL_IMPL
-#error "do not include this file outside of the thread pool implementation"
-#endif
-
-#include "thread_pool_types.h"
-#include <rx/rx_queue.h>
-
-/**
- *
- * implementation-private type definitions for thread_pool.
- */
-
-/**
- * thread_pool worker state.
- */
-typedef enum {
- AFS_TP_STATE_INIT, /**< initial state */
- AFS_TP_STATE_STARTING, /**< pool is starting up */
- AFS_TP_STATE_RUNNING, /**< pool is running normally */
- AFS_TP_STATE_STOPPING, /**< stop requested */
- AFS_TP_STATE_STOPPED, /**< pool is shut down */
- /* add new states above this line */
- AFS_TP_STATE_TERMINAL
-} afs_tp_state_t;
-
-/**
- * thread_pool worker.
- */
-struct afs_thread_pool_worker {
- struct rx_queue worker_list; /**< linked list of thread workers. */
- struct afs_thread_pool * pool; /**< associated thread pool */
- void * ret; /**< return value from worker thread entry point */
- pthread_t tid; /**< thread id */
- int req_shutdown; /**< request shutdown of this thread */
-};
-
-/**
- * thread pool.
- */
-struct afs_thread_pool {
- struct rx_queue thread_list; /**< linked list of threads */
- struct afs_work_queue * work_queue; /**< work queue serviced by this thread pool. */
- afs_tp_worker_func_t * entry; /**< worker thread entry point */
- void * rock; /**< opaque pointer passed to worker thread entry point */
- afs_uint32 nthreads; /**< current pool size */
- afs_tp_state_t state; /**< pool state */
- afs_uint32 max_threads; /**< pool options */
- pthread_mutex_t lock; /**< pool global state lock */
- pthread_cond_t shutdown_cv; /**< thread shutdown cv */
-};
-
-#endif /* AFS_UTIL_THREAD_POOL_IMPL_TYPES_H */
+++ /dev/null
-/*
- * Copyright 2008-2010, Sine Nomine Associates 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_UTIL_THREAD_POOL_TYPES_H
-#define AFS_UTIL_THREAD_POOL_TYPES_H 1
-
-/**
- * public type definitions for thread_pool.
- */
-
-/* forward declare opaque types */
-struct afs_thread_pool_worker;
-struct afs_thread_pool;
-struct afs_work_queue;
-
-/**
- * thread_pool worker thread entry function.
- *
- * @param[in] pool thread pool object pointer
- * @param[in] worker worker thread object pointer
- * @param[in] queue work queue object pointer
- * @param[in] rock opaque pointer
- *
- * @return opaque pointer
- */
-typedef void * afs_tp_worker_func_t(struct afs_thread_pool * pool,
- struct afs_thread_pool_worker * worker,
- struct afs_work_queue * queue,
- void * rock);
-
-#endif /* AFS_UTIL_THREAD_POOL_TYPES_H */
# include <rpc.h>
# else
# include <net/if.h>
-# if !defined(AFS_LINUX20_ENV) && !defined(AFS_ARM_DARWIN_ENV)
+# if !defined(AFS_LINUX_ENV) && !defined(AFS_ARM_DARWIN_ENV)
# include <netinet/if_ether.h>
# endif
# endif
#include <sys/types.h>
#if !defined(AFS_NT40_ENV)
-# if (!defined(AFS_FBSD_ENV) && !defined(AFS_LINUX26_ENV)) || !defined(KERNEL) || defined(UKERNEL)
+# if (!defined(AFS_FBSD_ENV) && !defined(AFS_LINUX_ENV)) || !defined(KERNEL) || defined(UKERNEL)
# include <sys/ioctl.h>
# endif
#endif /* AFS_NT40_ENV */
{
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
/fs
/fstrace
-/kdump-*
/up
-/kdump
-/kdump64
/livesys
/twiddle
LIBS = ${FSLIBS}
-all: fs up fstrace cmdebug livesys kdump-build cacheout afsio
+all: fs up fstrace cmdebug livesys cacheout afsio
#
# Build targets
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}
-
-#
-# Kernel info dumper - these are done with submakes so that
-# the build process does not attempt to rebuild them every time it runs.
-#
-
-#
-# Branching target, run the actual build depending on sysname
-#
-kdump-build: kdump.c ${INCLS} AFS_component_version_number.c
- $(MAKE) kdump kdump64
- touch kdump-build
-
-#
-# Build targets - one for each type of kdump build process we have
-#
-kdump: kdump.o
- -set -x; \
- case ${SYS_NAME} in \
- sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_5? ) \
- ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
- sun*_5? | sun*_5?? ) \
- ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
- sgi_6? ) \
- for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
- do IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
- CPU_KDEFS=`sed 's/-mips.//' $$f`; \
- echo IP = $$IP; \
- echo CPU_KDEFS = $$CPU_KDEFS; \
- case $$CPU_KDEFS in \
- *-64*) ${CC} ${XCFLAGS64} \
- $$CPU_KDEFS \
- -o kdump.$$IP kdump.$$IP.o \
- ${TOP_LIBDIR}/libcmd64.a -lelf \
- ;; \
- *) ${CC} ${XCFLAGS} ${ARCHFLAGS} \
- $$CPU_KDEFS \
- -o kdump.$$IP kdump.$$IP.o \
- ${TOP_LIBDIR}/libcmd.a -lelf \
- ;; \
- esac || exit $$? ; \
- done ;; \
- *linux26* | *linux_26* ) \
- touch kdump ;; \
- *alpha_linux* ) \
- $(MAKE) kdump-alpha_linux-@LINUX_VERSION@ ;; \
- *linux* ) \
- $(MAKE) kdump-linux-@LINUX_VERSION@ ;; \
- ncrx86_* ) ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a -lelf ${XLIBS} ;; \
- *bsd*) touch kdump ;; \
- * ) ${CC} -o kdump kdump.o ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS} ;; \
- esac
-
-kdump64:
- -set -x; \
- case ${SYS_NAME} in \
- sun4x_5[789] | sun4x_510 | hp_ux11* | sunx86_5[789] | sunx86_510 ) \
- $(MAKE) kdump64.o ; \
- ${CC} ${XCFLAGS64} -o kdump64 kdump64.o ${TOP_LIBDIR}/libcmd64.a ${XLIBELFA} ${XLIBKVM} ${XLIBS} ;; \
- esac
-
-
-kdump.o: kdump.c ${INCLS} AFS_component_version_number.c
- -set -x; \
- case ${SYS_NAME} in \
- *linux26* | *linux_26* ) \
- touch kdump.o ;; \
- alpha_linux* ) \
- $(MAKE) kdump-alpha_linux-${LINUX_VERSION}.o ;; \
- *linux* ) \
- $(MAKE) kdump-linux-${LINUX_VERSION}.o ;; \
- sgi_6? ) \
- for f in ../libafs/STATIC.IP*/CPU_KDEFS; \
- do IP=`expr "$$f" : '../libafs/STATIC.\(IP..\)'`; \
- CPU_KDEFS=`sed 's/-mips.//' $$f`; \
- echo IP = $$IP; \
- echo CPU_KDEFS = $$CPU_KDEFS; \
- case $$CPU_KDEFS in \
- *-64*) ${CC} -D_KMEMUSER -woff 1178 \
- ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_INCDIR} \
- -I${TOP_OBJDIR}/src/config \
- $$CPU_KDEFS \
- ${XCFLAGS64} \
- -c ${srcdir}/kdump.c -o kdump.$$IP.o \
- ;; \
- *) ${CC} -D_KMEMUSER -woff 1178 \
- ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_INCDIR} \
- -I${TOP_OBJDIR}/src/config \
- $$CPU_KDEFS \
- ${XCFLAGS} ${ARCHFLAGS} -DAFS_32BIT_KERNEL_ENV \
- -c ${srcdir}/kdump.c -o kdump.$$IP.o \
- ;; \
- esac || exit $$?; \
- done \
- ;; \
- *bsd*) \
- touch kdump.o ;; \
- *) \
- ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs \
- -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src -I${TOP_INCDIR} ${XCFLAGS} ${ARCHFLAGS} \
- -o kdump.o -c ${srcdir}/kdump.c ;; \
- esac ;
-
-kdump64.o : kdump.c ${INCLS} AFS_component_version_number.c
- -set -x; \
- case ${SYS_NAME} in \
- sun4x_5[789] | sun4x_510 | hp_ux11* | sunx86_5[789] | sunx86_510 ) \
- ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${TOP_SRCDIR} -I${TOP_INCDIR}/afs \
- -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src -I${TOP_INCDIR} ${XCFLAGS64} \
- -o kdump64.o -c ${srcdir}/kdump.c ;; \
- esac
-
-# *linux* - Builds kdump-X.Y.Z according to kernel version
-kdump-linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
- ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
- -I${TOP_OBJDIR}/src \
- -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
- -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
- -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
- -I${TOP_INCDIR} ${XCFLAGS} ${ARCHFLAGS} -o kdump-linux-${LINUX_VERSION}.o \
- -c ${srcdir}/kdump.c
-
-kdump-linux-@LINUX_VERSION@: kdump-linux-@LINUX_VERSION@.o
- ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-linux-${LINUX_VERSION} kdump-linux-${LINUX_VERSION}.o \
- ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
-
-# *alpha_linux* - Builds kdump-X.Y.Z according to kernel version
-kdump-alpha_linux-@LINUX_VERSION@.o: kdump.c ${INCLS} AFS_component_version_number.c
- ${CC} ${KERN_DBG} ${KERN_OPTMZ} -I${LINUX_KERNEL_PATH}/include -I${TOP_INCDIR}/afs \
- -I${TOP_OBJDIR}/src \
- -I${TOP_OBJDIR}/src/afs/${MKAFS_OSTYPE} \
- -I${TOP_OBJDIR}/src/config -I${TOP_OBJDIR}/src/libafs/afs \
- -I${TOP_SRCDIR} -I${TOP_SRCDIR}/afs/${MKAFS_OSTYPE} \
- -I${TOP_INCDIR} ${XCFLAGS} ${ARCHFLAGS} -mno-fp-regs -ffixed-8 \
- -o kdump-alpha_linux-${LINUX_VERSION}.o -c ${srcdir}/kdump.c ;;
-
-kdump-alpha_linux-@LINUX_VERSION@: kdump-alpha_linux-@LINUX_VERSION@.o
- ${CC} ${KERN_DBG} ${KERN_OPTMZ} -o kdump-alpha_linux-${LINUX_VERSION} kdump-alpha_linux-${LINUX_VERSION}.o \
- ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/util.a ${XLIBS}
-
#
# Install targets
#
-install: kdump-build fs livesys up fstrace cmdebug afsio
+install: fs livesys up fstrace cmdebug afsio
${INSTALL} -d ${DESTDIR}${bindir}
${INSTALL} -d ${DESTDIR}${afssrvbindir}
${INSTALL} -d ${DESTDIR}${sbindir}
${INSTALL_PROGRAM} fstrace ${DESTDIR}${sbindir}/fstrace
${INSTALL_PROGRAM} cmdebug ${DESTDIR}${bindir}/cmdebug
${INSTALL_PROGRAM} afsio ${DESTDIR}${bindir}/afsio ;
- -set -x; \
- case ${SYS_NAME} in \
- sgi_6? ) \
- ${INSTALL_SCRIPT} kdump.sh.sgi_ipnos ${DESTDIR}${sbindir}/kdump; \
- ln -fs kdump ${DESTDIR}${sbindir}/kdump32; \
- ln -fs kdump.IP20 ${DESTDIR}${sbindir}/kdump.IP22; \
- ln -fs kdump.IP20 ${DESTDIR}${sbindir}/kdump.IP32; \
- for f in kdump.IP??; \
- do ${INSTALL_PROGRAM} $$f ${DESTDIR}${sbindir}/$$f || exit $$? ; \
- done ;; \
- sun*_5[789] | sun*_510 ) \
- ${INSTALL_SCRIPT} kdump.sh.solaris7 ${DESTDIR}${sbindir}/kdump32; \
- ${INSTALL_PROGRAM} kdump-build ${DESTDIR}${sbindir}/kdump;; \
- *linux26* | *linux_26* ) \
- ;; \
- *linux* ) \
- ${INSTALL_SCRIPT} kdump.sh.linux ${DESTDIR}${sbindir}/kdump; \
- ${INSTALL_PROGRAM} kdump-build ${DESTDIR}${sbindir}/kdump ;; \
- hp_ux11* ) \
- ${INSTALL_SCRIPT} kdump.sh.hp_ux11 ${DESTDIR}${sbindir}/kdump; \
- ${INSTALL_PROGRAM} kdump-build ${DESTDIR}${sbindir}/kdump ;; \
- *bsd* ) \
- ;; \
- *) \
- ${INSTALL_PROGRAM} kdump-build ${DESTDIR}${sbindir}/kdump ;; \
- esac
- if [ -f kdump64 ]; then \
- ${INSTALL_PROGRAM} kdump64 ${DESTDIR}${sbindir}/kdump; \
- fi
-
-dest: kdump-build fs livesys up fstrace cmdebug afsio
+
+dest: fs livesys up fstrace cmdebug afsio
${INSTALL} -d ${DEST}/bin
${INSTALL} -d ${DEST}/etc
${INSTALL} -d ${DEST}/root.server/usr/afs/bin
${INSTALL_PROGRAM} fstrace ${DEST}/etc/fstrace
${INSTALL_PROGRAM} cmdebug ${DEST}/bin/cmdebug
${INSTALL_PROGRAM} afsio ${DEST}/bin/afsio
- -set -x; \
- case ${SYS_NAME} in \
- sgi_6? ) \
- ${INSTALL_SCRIPT} ${srcdir}/kdump.sh.sgi_ipnos ${DEST}/etc/kdump; \
- ln -fs kdump ${DEST}/etc/kdump32; \
- ln -fs kdump.IP20 ${DEST}/etc/kdump.IP22; \
- ln -fs kdump.IP20 ${DEST}/etc/kdump.IP32; \
- for f in kdump.IP??; \
- do ${INSTALL_PROGRAM} $$f ${DEST}/etc/$$f || exit $$? ; \
- done ;; \
- sun*_5[789] | sun*_510 ) \
- ${INSTALL_SCRIPT} ${srcdir}/kdump.sh.solaris7 ${DEST}/etc/kdump; \
- ${INSTALL_PROGRAM} ${srcdir}/kdump ${DEST}/etc/kdump32;; \
- *linux26* | *linux_26* ) \
- ;; \
- *alpha_linux* ) \
- ${INSTALL_SCRIPT} ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
- ${INSTALL_PROGRAM} kdump-alpha_linux-${LINUX_VERSION} ${DEST}/etc/kdump-${LINUX_VERSION} ;; \
- *linux* ) \
- ${INSTALL_SCRIPT} ${srcdir}/kdump.sh.linux ${DEST}/etc/kdump; \
- ${INSTALL_PROGRAM} kdump-linux-${LINUX_VERSION} ${DEST}/etc/kdump-${LINUX_VERSION} ;; \
- hp_ux11* ) \
- ${INSTALL_SCRIPT} ${srcdir}/kdump.sh.hp_ux11 ${DEST}/etc/kdump32; \
- ${INSTALL_PROGRAM} kdump-build ${DEST}/etc/kdump ;; \
- *bsd*) \
- ;; \
- *) \
- ${INSTALL_PROGRAM} kdump-build ${DEST}/etc/kdump ;; \
- esac
- if [ -f kdump64 ]; then \
- ${INSTALL_PROGRAM} kdump64 ${DEST}/etc/kdump; \
- fi
#
# Misc targets
clean:
$(LT_CLEAN)
- $(RM) -f *.o *.a up fs kdump-* kdump kdump64 core cmdebug \
- AFS_component_version_number.c fstrace gcpags livesys dedebug \
+ $(RM) -f *.o *.a up fs core cmdebug \
+ AFS_component_version_number.c fstrace gcpags livesys \
cacheout afsio
.PHONY: test
continue;
/* otherwise print this entry */
- printf("** Cache entry @ 0x%08x for %d.%d.%d.%d", centry.addr,
+ printf("** Cache entry @ 0x%08x for %d.%u.%u.%u", centry.addr,
centry.cell, centry.netFid.Volume, centry.netFid.Vnode,
centry.netFid.Unique);
continue;
/* otherwise print this entry */
- printf("** Cache entry @ 0x%08x for %d.%d.%d.%d", centry.addr,
+ printf("** Cache entry @ 0x%08x for %d.%u.%u.%u", centry.addr,
centry.cell, centry.netFid.Volume, centry.netFid.Vnode,
centry.netFid.Unique);
+++ /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);
-}
static int PruneList(struct AclEntry **, int);
static int CleanAcl(struct Acl *, char *);
static int SetVolCmd(struct cmd_syndesc *as, void *arock);
-static int GetCellName(char *, struct afsconf_cell *);
+static int GetCellName(char *, char *, size_t);
static void Die(int, char *);
/*
static int
GetLastComponent(const char *data, char **outdir, char **outbase,
- int *thru_symlink)
+ int *thru_symlink, int literal)
{
char orig_name[MAXPATHLEN]; /*Original name, may be modified */
char true_name[MAXPATHLEN]; /*``True'' dirname (e.g., symlink target) */
int link_chars_read; /*Num chars read in readlink() */
char *dirname = NULL;
char *basename = NULL;
+ size_t len;
*outbase = NULL;
*outdir = NULL;
}
/*
- * The lstat succeeded. If the given file is a symlink, substitute
- * the file name with the link name.
+ * The lstat succeeded. If the -literal flag wasn't specified and the given
+ * file is a symlink, substitute the file name with the link name.
*/
- if ((statbuff.st_mode & S_IFMT) == S_IFLNK) {
+ if (!literal && (statbuff.st_mode & S_IFMT) == S_IFLNK) {
if (thru_symlink)
*thru_symlink = 1;
strcpy(true_name, orig_name);
}
+ /* Trim trailing slashes, if any. */
+ len = strlen(true_name);
+ while (len > 1 && true_name[len - 1] == '/') {
+ true_name[len - 1 ] = '\0';
+ len--;
+ }
+
/* Find rightmost slash, if any. */
lastSlash = strrchr(true_name, '/');
if (lastSlash == true_name) {
for (ti = as->parms[0].items; ti; ti = ti->next) {
if (GetLastComponent(ti->data, &parent_dir,
- &last_component, &thru_symlink) != 0) {
+ &last_component, &thru_symlink, 0) != 0) {
error = 1;
continue;
}
afs_int32 j;
afs_int32 temp;
char *tp;
- struct afsconf_cell info;
struct chservinfo checkserv;
memset(&checkserv, 0, sizeof(struct chservinfo));
/* now copy in optional cell name, if specified */
if (as->parms[0].items) {
- code = GetCellName(as->parms[0].items->data, &info);
+ code = GetCellName(as->parms[0].items->data, &checkserv.tbuffer[0],
+ sizeof(checkserv.tbuffer));
if (code) {
return 1;
}
- strcpy(checkserv.tbuffer, info.name);
- checkserv.tsize = strlen(info.name) + 1;
+ checkserv.tsize = strlen(checkserv.tbuffer) + 1;
} else {
strcpy(checkserv.tbuffer, "\0");
checkserv.tsize = 0;
{
afs_int32 code;
struct ViceIoctl blob;
- struct afsconf_cell info;
+ char cellName[MAXCELLCHARS];
struct cmd_item *ti;
struct a {
afs_int32 stat;
/* once per cell */
blob.out_size = sizeof(args);
blob.out = (caddr_t) & args;
- code = GetCellName(ti->data, &info);
+ code = GetCellName(ti->data, &cellName[0], sizeof(cellName));
if (code) {
error = 1;
continue;
}
- blob.in_size = 1 + strlen(info.name);
- blob.in = info.name;
+ blob.in_size = 1 + strlen(cellName);
+ blob.in = cellName;
code = pioctl(0, VIOC_GETCELLSTATUS, &blob, 1);
if (code) {
if (errno == ENOENT)
fprintf(stderr, "%s: the cell named '%s' does not exist\n",
- pn, info.name);
+ pn, cellName);
else
- Die(errno, info.name);
+ Die(errno, cellName);
error = 1;
continue;
}
- printf("Cell %s status: ", info.name);
+ printf("Cell %s status: ", cellName);
if (args.stat & 2)
printf("no setuid allowed");
else
{
afs_int32 code;
struct ViceIoctl blob;
- struct afsconf_cell info;
struct cmd_item *ti;
struct a {
afs_int32 stat;
/* set stat for all listed cells */
for (ti = as->parms[0].items; ti; ti = ti->next) {
/* once per cell */
- code = GetCellName(ti->data, &info);
+ code = GetCellName(ti->data, &args.cname[0], sizeof(args.cname));
if (code) {
error = 1;
continue;
}
- strcpy(args.cname, info.name);
blob.in_size = sizeof(args);
blob.in = (caddr_t) & args;
blob.out_size = 0;
blob.out = (caddr_t) 0;
code = pioctl(0, VIOC_SETCELLSTATUS, &blob, 1);
if (code) {
- Die(errno, info.name); /* XXX added cell name to Die() call */
+ Die(errno, args.cname); /* XXX added cell name to Die() call */
error = 1;
}
}
}
static int
-GetCellName(char *cellName, struct afsconf_cell *info)
+GetCellName(char *cellName, char *buf, size_t buf_size)
{
struct afsconf_dir *tdir;
int code;
return -1;
}
- code = afsconf_GetCellInfo(tdir, cellName, AFSCONF_VLDBSERVICE, info);
+ code = afsconf_GetCellName(tdir, cellName, buf, buf_size);
if (code) {
fprintf(stderr, "%s: cell %s not in %s\n", pn, cellName,
AFSDIR_CLIENT_CELLSERVDB_FILEPATH);
ts = cmd_CreateSyntax("getfid", GetFidCmd, NULL, 0,
"get fid for file(s)");
cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path");
+ cmd_AddParm(ts, "-literal", CMD_FLAG, CMD_OPTIONAL,
+ "literal evaluation of mountpoints and symlinks");
ts = cmd_CreateSyntax("discon", DisconCmd, NULL, 0,
"disconnection mode");
for (ti = as->parms[0].items; ti; ti = ti->next) {
if (GetLastComponent(ti->data, &parent_dir,
- &last_component, NULL) != 0) {
+ &last_component, NULL, 0) != 0) {
error = 1;
continue;
}
struct cmd_item *ti;
afs_int32 code;
- int error = 0;
+ int error = 0, literal = 0;
char cell[MAXCELLCHARS];
SetDotDefault(&as->parms[0].items);
+ if (as->parms[1].items) {
+ /* -literal */
+ literal = 1;
+ }
for (ti = as->parms[0].items; ti; ti = ti->next) {
struct VenusFid vfid;
blob.out = (char *) &vfid;
blob.in_size = 0;
- code = pioctl(ti->data, VIOCGETFID, &blob, 1);
+ if (literal) {
+ char *parent_dir = NULL;
+ char *last_component = NULL;
+
+ if (GetLastComponent(ti->data, &parent_dir,
+ &last_component, NULL, literal) != 0) {
+ error = 1;
+ continue;
+ }
+
+ blob.in = last_component;
+ blob.in_size = strlen(last_component) + 1;
+ code = pioctl(parent_dir, VIOC_GETLITERALFID, &blob, 1);
+
+ free(parent_dir);
+ free(last_component);
+ } else {
+ code = pioctl(ti->data, VIOCGETFID, &blob, 1);
+ }
if (code) {
Die(errno,ti->data);
error = 1;
#include <afs/vice.h>
#include <afs/sys_prototypes.h>
-#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
/* For SGI 6.2, this is changed to 1 if it's a 32 bit kernel. */
-int afs_icl_sizeofLong = 2;
-#else
-int afs_icl_sizeofLong = 1;
-#endif
+int afs_icl_sizeofLong = ICL_LONG;
-#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
+#if ICL_LONG == 2
int afs_64bit_kernel = 1; /* Default for 6.2+, and always for 6.1 */
-extern int afs_icl_sizeofLong; /* Used in ICL_SIZEHACK() */
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
/* If _SC_KERN_POINTERS not in sysconf, then we can assume a 32 bit abi. */
void
}
}
-#endif /* AFS_SGI62_ENV */
-#endif /* AFS_SGI61_ENV */
+#endif /* AFS_SGI_ENV */
+#endif /* ICL_LONG == 2 */
int afs_syscall(long call, long parm0, long parm1, long parm2, long parm3,
long parm4, long parm5, long parm6);
void dce1_error_inq_text(afs_uint32 status_to_convert,
char *error_text, int *status);
-int icl_CreateSetWithFlags(char *name, struct afs_icl_log *baseLogp,
- struct afs_icl_log *fatalLogp, afs_uint32 flags,
- struct afs_icl_set **outSetpp);
-int icl_LogHold(struct afs_icl_log *logp);
-int icl_LogUse(struct afs_icl_log *logp);
-int icl_LogReleNL(struct afs_icl_log *logp);
-int icl_LogRele(struct afs_icl_log *logp);
-int icl_ZeroLog(struct afs_icl_log *logp);
-int icl_LogFreeUse(struct afs_icl_log *logp);
#define BUFFER_MULTIPLIER 1024
-/* make it big enough to snapshot everything at once, since
- * decoding takes so long.
- */
-#define IBSIZE 100000 /* default size */
-
struct logInfo {
struct logInfo *nextp;
char *name;
} *allInfo = 0;
-char dumpFileName[256] = "";
-void
-RegisterIclDumpFileName(char *name)
-{
- (void)sprintf(dumpFileName, "icl.%.250s", name);
-}
-
-/* define globals to use for bulk info */
-afs_icl_bulkSetinfo_t *setInfo = (afs_icl_bulkSetinfo_t *) 0;
-afs_icl_bulkLoginfo_t *logInfo = (afs_icl_bulkLoginfo_t *) 0;
-struct afs_icl_set *icl_allSets = 0;
+int dumpDebugFlag = 0;
-
-char *name;
/* given a type and an address, get the size of the thing
* in words.
*/
* by typesp. Also watch for prematurely running out of parameters
* before the string is gone.
*/
-#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
+#if ICL_LONG == 2
static int
CheckTypes(char *bufferp, int *typesp, int typeCount, char *outMsgBuffer)
{
}
/* not reached */
}
-#else /* AFS_SGI61_ENV */
+#else /* ICL_LONG == 2 */
static int
CheckTypes(char *bufferp, int *typesp, int typeCount)
{
}
/* not reached */
}
-#endif /* AFS_SGI61_ENV */
+#endif /* ICL_LONG == 2 */
/* display a single record.
* alp points at the first word in the array to be interpreted
* rsize gives the # of words in the array
*/
-#if defined(AFS_SGI61_ENV) && !defined(AFS_SGI62_ENV)
-#define uint64_t long long
-#endif
static void
DisplayRecord(FILE *outFilep, afs_int32 *alp, afs_int32 rsize)
{
char msgBuffer[1024];
-#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
+#if ICL_LONG == 2
char outMsgBuffer[1024];
uint64_t tempParam;
uint64_t printfParms[ICL_MAXEXPANSION * /* max parms */ 4];
char *printfStrings[ICL_MAXEXPANSION * /* max parms */ 4];
-#else /* AFS_SGI61_ENV */
+#else
long printfParms[ICL_MAXEXPANSION * /* max parms */ 4];
-#endif /* AFS_SGI61_ENV */
+#endif
int printfTypes[ICL_MAXEXPANSION * 4];
int i;
afs_int32 done = 0;
pftix = 0;
/* init things */
+ if (dumpDebugFlag) {
+ fprintf(outFilep, "DEBUG:");
+ for (i = 0; i < rsize; i++) {
+ fprintf(outFilep, " %08x", alp[i]);
+ }
+ fprintf(outFilep, "\n");
+ }
for (i = 0; i < 4 * ICL_MAXEXPANSION; i++)
printfParms[i] = 0;
/* decode each parameter, getting addrs for afs_hyper_t and strings */
case ICL_TYPE_LONG:
case ICL_TYPE_POINTER:
printfTypes[pftix++] = 0;
-#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
+#if ICL_LONG == 2
printfParms[pfpix] = alp[pix];
printfParms[pfpix] &= 0xffffffff;
if (afs_64bit_kernel) {
printfParms[pfpix] <<= 32;
printfParms[pfpix] |= alp[pix + 1];
}
-#else /* !AFS_SGI61_ENV */
+#else
printfParms[pfpix] = alp[pix];
#endif
pfpix++;
break;
case ICL_TYPE_STRING:
printfTypes[pftix++] = 1;
-#ifdef AFS_SGI64_ENV
- printfStrings[pfpix++] = (char *)&alp[pix];
-#else /* AFS_SGI64_ENV */
-#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
+#if ICL_LONG == 2
printfStrings[pfpix++] = (char *)&alp[pix];
-#else /* AFS_SGI61_ENV */
+#else
printfParms[pfpix++] = (long)&alp[pix];
-#endif /* AFS_SGI61_ENV */
-#endif /* AFS_SGI64_ENV */
+#endif
break;
case ICL_TYPE_UNIXDATE:
tmv = alp[pix];
*/
printed = 0;
if (status == 0) {
-#if defined(AFS_SGI61_ENV) || (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL))
+#if ICL_LONG == 2
if (CheckTypes(msgBuffer, printfTypes, pftix, outMsgBuffer)) {
/* we have a string to use, but it ends "(dfs / zcm)",
* so we remove the extra gunk.
fprintf(outFilep, "\n");
printed = 1;
}
-#else /* AFS_SGI61_ENV */
+#else /* ICL_LONG == 2 */
if (CheckTypes(msgBuffer, printfTypes, pftix)) {
/* we have a string to use, but it ends "(dfs / zcm)",
* so we remove the extra gunk.
fprintf(outFilep, "\n");
printed = 1;
}
-#endif /* AFS_SGI61_ENV */
+#endif /* ICL_LONG == 2 */
else {
fprintf(outFilep, "Type mismatch, using raw print.\n");
fprintf(outFilep, "%s", msgBuffer);
fprintf(outFilep, "p%d:%d ", i, alp[pix]);
break;
case ICL_TYPE_LONG:
-#ifdef AFS_SGI61_ENV
+#if ICL_LONG == 2
tempParam = alp[pix];
tempParam <<= 32;
tempParam |= alp[pix + 1];
fprintf(outFilep, "p%d:%" AFS_INT64_FMT " ", i, tempParam);
-#else /* AFS_SGI61_ENV */
+#else
fprintf(outFilep, "p%d:%d ", i, alp[pix]);
-#endif /* AFS_SGI61_ENV */
+#endif
break;
case ICL_TYPE_POINTER:
-#ifdef AFS_SGI61_ENV
+#if ICL_LONG == 2
tempParam = alp[pix];
tempParam <<= 32;
tempParam |= alp[pix + 1];
fprintf(outFilep, "p%d:0x%llx ", i, tempParam);
-#else /* AFS_SGI61_ENV */
+#else
fprintf(outFilep, "p%d:0x%x ", i, alp[pix]);
-#endif /* AFS_SGI61_ENV */
+#endif
break;
case ICL_TYPE_HYPER:
case ICL_TYPE_INT64:
long parm4, long parm5, long parm6)
{
int code;
-#if defined(AFS_DARWIN80_ENV) || defined(AFS_LINUX20_ENV)
+#if defined(AFS_DARWIN80_ENV) || defined(AFS_LINUX_ENV)
int rval;
#endif
-#ifdef AFS_LINUX20_ENV
+#ifdef AFS_LINUX_ENV
#if defined AFS_LINUX_64BIT_KERNEL
long long eparm[4];
/* don't want to sign extend it to 64bit, so using ulong */
#endif
}
}
-#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV)
+#if defined(AFS_SPARC64_LINUX_ENV) || defined(AFS_SPARC_LINUX_ENV)
/* on sparc this function returns none value, so do it myself */
__asm__ __volatile__("mov %o0, %i0; ret; restore");
#endif
#endif
#endif
#endif
-#endif /* AFS_LINUX20_ENV */
+#endif /* AFS_LINUX_ENV */
return code;
}
#endif
-
-int icl_inited = 0;
-
-/* init function, called once, under icl_lock */
-int
-icl_Init(void)
-{
- icl_inited = 1;
-
-#ifndef KERNEL
- /* setup signal handler, in user space */
-#endif /* KERNEL */
-
- return 0;
-}
-
-int
-icl_CreateSet(char *name, struct afs_icl_log *baseLogp,
- struct afs_icl_log *fatalLogp, struct afs_icl_set **outSetpp)
-{
- return icl_CreateSetWithFlags(name, baseLogp, fatalLogp, /*flags */ 0,
- outSetpp);
-}
-
-/* create a set, given pointers to base and fatal logs, if any.
- * Logs are unlocked, but referenced, and *outSetpp is returned
- * referenced. Function bumps reference count on logs, since it
- * addds references from the new icl_set. When the set is destroyed,
- * those references will be released.
- */
-int
-icl_CreateSetWithFlags(char *name, struct afs_icl_log *baseLogp,
- struct afs_icl_log *fatalLogp, afs_uint32 flags,
- struct afs_icl_set **outSetpp)
-{
- struct afs_icl_set *setp;
- int i;
- afs_int32 states = ICL_DEFAULT_SET_STATES;
-
- if (!icl_inited)
- icl_Init();
-
- for (setp = icl_allSets; setp; setp = setp->nextp) {
- if (strcmp(setp->name, name) == 0) {
- setp->refCount++;
- *outSetpp = setp;
- if (flags & ICL_CRSET_FLAG_PERSISTENT) {
- setp->states |= ICL_SETF_PERSISTENT;
- }
- return 0;
- }
- }
-
- /* determine initial state */
- if (flags & ICL_CRSET_FLAG_DEFAULT_ON)
- states = ICL_SETF_ACTIVE;
- else if (flags & ICL_CRSET_FLAG_DEFAULT_OFF)
- states = ICL_SETF_FREED;
- if (flags & ICL_CRSET_FLAG_PERSISTENT)
- states |= ICL_SETF_PERSISTENT;
-
- setp = osi_Alloc(sizeof(struct afs_icl_set));
- memset((caddr_t) setp, 0, sizeof(*setp));
- setp->refCount = 1;
- if (states & ICL_SETF_FREED)
- states &= ~ICL_SETF_ACTIVE; /* if freed, can't be active */
- setp->states = states;
-
- setp->name = osi_Alloc(strlen(name) + 1);
- strcpy(setp->name, name);
- setp->nevents = ICL_DEFAULTEVENTS;
- setp->eventFlags = osi_Alloc(ICL_DEFAULTEVENTS);
- for (i = 0; i < ICL_DEFAULTEVENTS; i++)
- setp->eventFlags[i] = 0xff; /* default to enabled */
-
- /* update this global info under the icl_lock */
- setp->nextp = icl_allSets;
- icl_allSets = setp;
-
- /* set's basic lock is still held, so we can finish init */
- if (baseLogp) {
- setp->logs[0] = baseLogp;
- icl_LogHold(baseLogp);
- if (!(setp->states & ICL_SETF_FREED))
- icl_LogUse(baseLogp); /* log is actually being used */
- }
- if (fatalLogp) {
- setp->logs[1] = fatalLogp;
- icl_LogHold(fatalLogp);
- if (!(setp->states & ICL_SETF_FREED))
- icl_LogUse(fatalLogp); /* log is actually being used */
- }
-
- *outSetpp = setp;
- return 0;
-}
-
-/* function to change event enabling information for a particular set */
-int
-icl_SetEnable(struct afs_icl_set *setp, afs_int32 eventID, int setValue)
-{
- char *tp;
-
- if (!ICL_EVENTOK(setp, eventID)) {
- return -1;
- }
- tp = &setp->eventFlags[ICL_EVENTBYTE(eventID)];
- if (setValue)
- *tp |= ICL_EVENTMASK(eventID);
- else
- *tp &= ~(ICL_EVENTMASK(eventID));
- return 0;
-}
-
-/* return indication of whether a particular event ID is enabled
- * for tracing. If *getValuep is set to 0, the event is disabled,
- * otherwise it is enabled. All events start out enabled by default.
- */
-int
-icl_GetEnable(struct afs_icl_set *setp, afs_int32 eventID, int *getValuep)
-{
- if (!ICL_EVENTOK(setp, eventID)) {
- return -1;
- }
- if (setp->eventFlags[ICL_EVENTBYTE(eventID)] & ICL_EVENTMASK(eventID))
- *getValuep = 1;
- else
- *getValuep = 0;
- return 0;
-}
-
-/* hold and release event sets */
-int
-icl_SetHold(struct afs_icl_set *setp)
-{
- setp->refCount++;
- return 0;
-}
-
-/* free a set. Called with icl_lock locked */
-int
-icl_ZapSet(struct afs_icl_set *setp)
-{
- struct afs_icl_set **lpp, *tp;
- int i;
- struct afs_icl_log *tlp;
-
- for (lpp = &icl_allSets, tp = *lpp; tp; lpp = &tp->nextp, tp = *lpp) {
- if (tp == setp) {
- /* found the dude we want to remove */
- *lpp = setp->nextp;
- osi_Free(setp->name, 1 + strlen(setp->name));
- osi_Free(setp->eventFlags, ICL_EVENTBYTES(setp->nevents));
- for (i = 0; i < ICL_LOGSPERSET; i++) {
- if ((tlp = setp->logs[i]))
- icl_LogReleNL(tlp);
- }
- osi_Free(setp, sizeof(struct afs_icl_set));
- break; /* won't find it twice */
- }
- }
- return 0;
-}
-
-/* do the release, watching for deleted entries */
-int
-icl_SetRele(struct afs_icl_set *setp)
-{
- if (--setp->refCount == 0 && (setp->states & ICL_SETF_DELETED)) {
- icl_ZapSet(setp); /* destroys setp's lock! */
- }
- return 0;
-}
-
-/* free a set entry, dropping its reference count */
-int
-icl_SetFree(struct afs_icl_set *setp)
-{
- setp->states |= ICL_SETF_DELETED;
- icl_SetRele(setp);
- return 0;
-}
-
-/* find a set by name, returning it held */
-struct afs_icl_set *
-icl_FindSet(char *name)
-{
- struct afs_icl_set *tp;
-
- for (tp = icl_allSets; tp; tp = tp->nextp) {
- if (strcmp(tp->name, name) == 0) {
- /* this is the dude we want */
- tp->refCount++;
- break;
- }
- }
- return tp;
-}
-
-/* zero out all the logs in the set */
-int
-icl_ZeroSet(struct afs_icl_set *setp)
-{
- int i;
- int code = 0;
- int tcode;
- struct afs_icl_log *logp;
-
- for (i = 0; i < ICL_LOGSPERSET; i++) {
- logp = setp->logs[i];
- if (logp) {
- icl_LogHold(logp);
- tcode = icl_ZeroLog(logp);
- if (tcode != 0)
- code = tcode; /* save the last bad one */
- icl_LogRele(logp);
- }
- }
- return code;
-}
-
-int
-icl_EnumerateSets(int (*aproc) (char *, void *, struct afs_icl_set *),
- void *arock)
-{
- struct afs_icl_set *tp, *np;
- afs_int32 code;
-
- code = 0;
- for (tp = icl_allSets; tp; tp = np) {
- tp->refCount++; /* hold this guy */
- code = (*aproc) (tp->name, arock, tp);
- np = tp->nextp; /* tp may disappear next, but not np */
- if (--tp->refCount == 0 && (tp->states & ICL_SETF_DELETED))
- icl_ZapSet(tp);
- if (code)
- break;
- }
- return code;
-}
-
-int
-icl_AddLogToSet(struct afs_icl_set *setp, struct afs_icl_log *newlogp)
-{
- int i;
- int code = -1;
-
- for (i = 0; i < ICL_LOGSPERSET; i++) {
- if (!setp->logs[i]) {
- setp->logs[i] = newlogp;
- code = i;
- icl_LogHold(newlogp);
- if (!(setp->states & ICL_SETF_FREED)) {
- /* bump up the number of sets using the log */
- icl_LogUse(newlogp);
- }
- break;
- }
- }
- return code;
-}
-
-int
-icl_SetSetStat(struct afs_icl_set *setp, int op)
-{
- int i;
- afs_int32 code;
- struct afs_icl_log *logp;
-
- switch (op) {
- case ICL_OP_SS_ACTIVATE: /* activate a log */
- /*
- * If we are not already active, see if we have released
- * our demand that the log be allocated (FREED set). If
- * we have, reassert our desire.
- */
- if (!(setp->states & ICL_SETF_ACTIVE)) {
- if (setp->states & ICL_SETF_FREED) {
- /* have to reassert desire for logs */
- for (i = 0; i < ICL_LOGSPERSET; i++) {
- logp = setp->logs[i];
- if (logp) {
- icl_LogHold(logp);
- icl_LogUse(logp);
- icl_LogRele(logp);
- }
- }
- setp->states &= ~ICL_SETF_FREED;
- }
- setp->states |= ICL_SETF_ACTIVE;
- }
- code = 0;
- break;
-
- case ICL_OP_SS_DEACTIVATE: /* deactivate a log */
- /* this doesn't require anything beyond clearing the ACTIVE flag */
- setp->states &= ~ICL_SETF_ACTIVE;
- code = 0;
- break;
-
- case ICL_OP_SS_FREE: /* deassert design for log */
- /*
- * if we are already in this state, do nothing; otherwise
- * deassert desire for log
- */
- if (setp->states & ICL_SETF_ACTIVE)
- code = EINVAL;
- else {
- if (!(setp->states & ICL_SETF_FREED)) {
- for (i = 0; i < ICL_LOGSPERSET; i++) {
- logp = setp->logs[i];
- if (logp) {
- icl_LogHold(logp);
- icl_LogFreeUse(logp);
- icl_LogRele(logp);
- }
- }
- setp->states |= ICL_SETF_FREED;
- }
- code = 0;
- }
- break;
-
- default:
- code = EINVAL;
- }
-
- return code;
-}
-
-struct afs_icl_log *afs_icl_allLogs = 0;
-
-/* hold and release logs */
-int
-icl_LogHold(struct afs_icl_log *logp)
-{
- logp->refCount++;
- return 0;
-}
-
-/* hold and release logs, called with lock already held */
-int
-icl_LogHoldNL(struct afs_icl_log *logp)
-{
- logp->refCount++;
- return 0;
-}
-
-/* keep track of how many sets believe the log itself is allocated */
-int
-icl_LogUse(struct afs_icl_log *logp)
-{
- if (logp->setCount == 0) {
- /* this is the first set actually using the log -- allocate it */
- if (logp->logSize == 0) {
- /* we weren't passed in a hint and it wasn't set */
- logp->logSize = ICL_DEFAULT_LOGSIZE;
- }
- logp->datap = osi_Alloc(sizeof(afs_int32) * logp->logSize);
- }
- logp->setCount++;
- return 0;
-}
-
-/* decrement the number of real users of the log, free if possible */
-int
-icl_LogFreeUse(struct afs_icl_log *logp)
-{
- if (--logp->setCount == 0) {
- /* no more users -- free it (but keep log structure around) */
- osi_Free(logp->datap, sizeof(afs_int32) * logp->logSize);
- logp->firstUsed = logp->firstFree = 0;
- logp->logElements = 0;
- logp->datap = NULL;
- }
- return 0;
-}
-
-/* set the size of the log to 'logSize' */
-int
-icl_LogSetSize(struct afs_icl_log *logp, afs_int32 logSize)
-{
- if (!logp->datap) {
- /* nothing to worry about since it's not allocated */
- logp->logSize = logSize;
- } else {
- /* reset log */
- logp->firstUsed = logp->firstFree = 0;
- logp->logElements = 0;
-
- /* free and allocate a new one */
- osi_Free(logp->datap, sizeof(afs_int32) * logp->logSize);
- logp->datap = osi_Alloc(sizeof(afs_int32) * logSize);
- logp->logSize = logSize;
- }
-
- return 0;
-}
-
-/* free a log. Called with icl_lock locked. */
-int
-icl_ZapLog(struct afs_icl_log *logp)
-{
- struct afs_icl_log **lpp, *tp;
-
- for (lpp = &afs_icl_allLogs, tp = *lpp; tp; lpp = &tp->nextp, tp = *lpp) {
- if (tp == logp) {
- /* found the dude we want to remove */
- *lpp = logp->nextp;
- osi_Free(logp->name, 1 + strlen(logp->name));
- osi_Free(logp->datap, logp->logSize * sizeof(afs_int32));
- osi_Free(logp, sizeof(struct icl_log));
- break; /* won't find it twice */
- }
- }
- return 0;
-}
-
-/* do the release, watching for deleted entries */
-int
-icl_LogRele(struct afs_icl_log *logp)
-{
- if (--logp->refCount == 0 && (logp->states & ICL_LOGF_DELETED)) {
- icl_ZapLog(logp); /* destroys logp's lock! */
- }
- return 0;
-}
-
-/* do the release, watching for deleted entries, log already held */
-int
-icl_LogReleNL(struct afs_icl_log *logp)
-{
- if (--logp->refCount == 0 && (logp->states & ICL_LOGF_DELETED)) {
- icl_ZapLog(logp); /* destroys logp's lock! */
- }
- return 0;
-}
-
-/* zero out the log */
-int
-icl_ZeroLog(struct afs_icl_log *logp)
-{
- logp->firstUsed = logp->firstFree = 0;
- logp->logElements = 0;
- return 0;
-}
-
-/* free a log entry, and drop its reference count */
-int
-icl_LogFree(struct afs_icl_log *logp)
-{
- logp->states |= ICL_LOGF_DELETED;
- icl_LogRele(logp);
- return 0;
-}
-
-
-int
-icl_EnumerateLogs(int (*aproc)
- (char *name, void *arock, struct afs_icl_log * tp),
- void *arock)
-{
- struct afs_icl_log *tp, *np;
- afs_int32 code;
-
- code = 0;
- for (tp = afs_icl_allLogs; tp; tp = np) {
- tp->refCount++; /* hold this guy */
- np = tp->nextp;
- code = (*aproc) (tp->name, arock, tp);
- if (--tp->refCount == 0)
- icl_ZapLog(tp);
- if (code)
- break;
- }
- return code;
-}
-
-
-afs_icl_bulkSetinfo_t *
-GetBulkSetInfo(void)
-{
- unsigned int infoSize;
-
- infoSize =
- sizeof(afs_icl_bulkSetinfo_t) + (ICL_RPC_MAX_SETS -
- 1) * sizeof(afs_icl_setinfo_t);
- if (!setInfo) {
- setInfo = calloc(1, infoSize);
- if (!setInfo) {
- (void)fprintf(stderr,
- "Could not allocate the memory for bulk set info structure\n");
- exit(1);
- }
- }
-
- return setInfo;
-}
-
-afs_icl_bulkLoginfo_t *
-GetBulkLogInfo(void)
-{
- unsigned int infoSize;
-
- infoSize =
- sizeof(afs_icl_bulkLoginfo_t) + (ICL_RPC_MAX_LOGS -
- 1) * sizeof(afs_icl_loginfo_t);
- if (!logInfo) {
- logInfo = calloc(1, infoSize);
- if (!logInfo) {
- (void)fprintf(stderr,
- "Could not allocate the memory for bulk log info structure\n");
- exit(1);
- }
- }
-
- return logInfo;
-}
-
-
static int
DoDump(struct cmd_syndesc *as, void *arock)
{
waitTime = strtol(as->parms[3].items->data, NULL, 0);
}
+ if (as->parms[4].items) {
+ dumpDebugFlag = 1;
+ }
+
if (as->parms[2].items) {
/* try to open the specified output file */
if ((outfp = fopen(as->parms[2].items->data, "w")) == NULL) {
return 1;
}
}
-#ifdef AFS_SGI64_ENV
+#ifdef AFS_SGI_ENV
startTime = time((time_t *) 0);
#else
startTime = time(0);
"path to trace log file for writing");
(void)cmd_AddParm(dumpSyntax, "-sleep", CMD_SINGLE, CMD_OPTIONAL,
"interval (secs) for writes when using -follow");
+ (void)cmd_AddParm(dumpSyntax, "-debug", CMD_FLAG, CMD_OPTIONAL,
+ "dump raw record as well");
}
main(int argc, char *argv[])
{
setlocale(LC_ALL, "");
-#ifdef AFS_SGI62_ENV
+#ifdef AFS_SGI_ENV
set_kernel_sizeof_long();
#endif
+++ /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/cmd.h>
-
-#if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
-/* Here be hacks. */
-#ifdef AFS_LINUX24_ENV
-#define __KERNEL__
-#include <linux/string.h>
-#define _STRING_H 1
-#define _SYS_STATFS_H 1
-#define _BITS_SIGCONTEXT_H 1
-#undef USE_UCONTEXT
-#endif
-
-#ifdef AFS_LINUX26_ENV
-/* For some reason, this doesn't get defined in linux/types.h
- if __KERNEL_STRICT_NAMES is defined. But the definition of
- struct inode uses it.
-*/
-#ifndef pgoff_t
-#define pgoff_t unsigned long
-#endif
-#endif
-
-#include <string.h>
-
-#ifdef __linux__
-#define _CFS_HEADER_
-#define _AFFS_FS_I
-#define _NFS_FS_I
-#define _SYSV_FS_SB
-#define _AFFS_FS_SB
-#define _NFS_FS_SB
-#define __LINUX_UFS_FS_SB_H
-#define _SYSV_FS_I
-#define _LINUX_CODA_FS_I
-#define _LINUX_NTFS_FS_SB_H
-#define _LINUX_NTFS_FS_I_H
-#define _NCP_FS_SB
-struct sysv_sb_info {
-};
-struct affs_sb_info {
-};
-struct ufs_sb_info {
-};
-struct nfs_sb_info {
-};
-struct nfs_inode_info {
-};
-struct sysv_inode_info {
-};
-struct coda_inode_info {
-};
-struct affs_inode_info {
-};
-struct nfs_lock_info {
-};
-struct ntfs_sb_info {
-};
-struct ntfs_inode_info {
-};
-struct ncp_sb_info {
-};
-#include <linux/types.h>
-#define u32 unsigned int
-#define s32 int
-#define u16 unsigned short
-#include <features.h>
-#if __GLIBC_MINOR__ >= 2
-#define _SYS_TYPES_H 1
-#endif
-#define __KERNEL__
-#endif
-
-/* This tells afs.h to pick up afs_args from the dest tree. */
-#define KDUMP_KERNEL
-
-/*
- * Need to include <netdb.h> before _KERNEL is defined since on IRIX 6.5
- * <netdb.h> includes <netinet/in.h>, which in turn declares inet_addr()
- * if _KERNEL is defined. This declaration conflicts with that in
- * <arpa/inet.h>.
- */
-#if ! defined(AFS_AIX_ENV)
-#include <netdb.h>
-#endif
-
-/* For AFS_SGI61_ENV and a 64 bit OS, _KMEMUSER should be defined on the
- * compile line for kdump.o in the Makefile. This lets us pick up
- * app32_ptr_t from types.h when included from afs/param.h.
- */
-#ifdef AFS_SGI62_ENV
-#define _KERNEL 1
-#endif
-
-#ifndef AFS_LINUX20_ENV
-#include <nlist.h>
-#endif
-
-#ifdef AFS_HPUX_ENV
-#include <a.out.h>
-#endif
-
-#include <afs/stds.h>
-
-#ifdef AFS_SUN5_ENV /*XXXXX*/
-#include <sys/t_lock.h>
-struct vnode foo;
-#endif
-
-#ifdef AFS_SGI53_ENV
-#define _KERNEL 1
-#include <sys/sema.h>
-#ifndef AFS_SGI62_ENV
-#undef _KERNEL 1
-#endif
-#endif
-
-#ifdef AFS_SGI62_ENV
-#include <sys/fcntl.h>
-#ifndef L_SET
-#define L_SET 0
-#endif
-#endif
-
-#include <sys/param.h>
-
-#ifndef AFS_SGI64_ENV
-#include <sys/user.h>
-#endif
-
-#ifndef AFS_LINUX26_ENV
-#include <sys/file.h>
-#endif
-
-/*
- * On SGIs, when _KERNEL is defined, <netinet/in.h> declares inet_addr()
- * in a way that conflicts with the declaration in <arpa/inet.h>.
- *
- * Here we bring in <netinet/in.h> without _KERNEL defined and restore
- * _KERNEL afterwards if needed.
- *
- * A better solution might be to straighten out which #includes are
- * sensitive to _KERNEL on SGIs....
- */
-#if defined(AFS_SGI_ENV) && defined(_KERNEL)
-# undef _KERNEL
-# include <netinet/in.h> /* struct in_addr */
-# define _KERNEL 1
-#else
-# include <netinet/in.h> /* struct in_addr */
-#endif
-
-#if defined(AFS_SGI_ENV)
-#ifdef AFS_SGI_ENV
-#include <sys/vnode.h>
-#endif /* AFS_SGI_ENV */
-#else
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-#include <sys/vnode.h>
-#include <sys/mount.h>
-#include <ufs/ufs/quota.h>
-#include <ufs/ufs/inode.h>
-#include <ufs/ffs/fs.h>
-#else
-#include "sys/vfs.h"
-#ifdef AFS_LINUX20_ENV
-#ifndef UIO_MAXIOV
-#define UIO_MAXIOV 1 /* don't care */
-#endif
-#if __GLIBC_MINOR__ == 0
-#include <iovec.h>
-#endif
-/*#define _TIME_H*/
-/*#define _SYS_UIO_H */
-#define _LINUX_SOCKET_H
-#undef INT_MAX
-#undef UINT_MAX
-#undef LONG_MAX
-#undef ULONG_MAX
-#define _LINUX_TIME_H
-#ifndef AFS_LINUX26_ENV
-#define _LINUX_FCNTL_H
-#endif
-#ifdef AFS_IA64_LINUX24_ENV
-#define flock64 flock
-#endif /* AFS_IA64_LINUX24_ENV */
-#ifdef AFS_S390_LINUX20_ENV
-#define _S390_STATFS_H
-#else
-#ifdef AFS_SPARC64_LINUX20_ENV
-#define _SPARC64_STATFS_H
-#define _SPARC_STATFS_H
-#else
-#ifdef AFS_SPARC_LINUX20_ENV
-#define _SPARC_STATFS_H
-#else
-#ifdef AFS_ALPHA_LINUX20_ENV
-#define _ALPHA_STATFS_H
-#else
-#define _I386_STATFS_H
-#endif /* AFS_ALPHA_LINUX20_ENV */
-#endif /* AFS_SPARC_LINUX20_ENV */
-#endif /* AFS_SPARC64_LINUX20_ENV */
-#endif /* AFS_S390_LINUX20_ENV */
-struct timezone {
- int a, b;
-};
-#if defined(WORDS_BIGENDIAN)
-#define _LINUX_BYTEORDER_BIG_ENDIAN_H
-#else
-#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
-#endif
-/* Avoid problems with timer_t redefinition */
-#ifndef timer_t
-#define timer_t ktimer_t
-#define timer_t_redefined
-#endif
-#ifdef AFS_LINUX26_ENV
-/* For some reason, this doesn't get defined in linux/types.h
- if __KERNEL_STRICT_NAMES is defined. But the definition of
- struct inode uses it.
-*/
-#ifndef HAVE_SECTOR_T
-/* got it from linux/types.h */
-typedef unsigned long sector_t;
-#endif /* HAVE_SECTOR_T */
-#endif /* AFS_LINUX26_ENV */
-#include <linux/version.h>
-#include <linux/fs.h>
-#include <osi_vfs.h>
-#ifdef timer_t_redefined
-#undef timer_t
-#undef timer_t_redefined
-#endif
-#else /* AFS_LINUX20_ENV */
-#ifdef AFS_HPUX110_ENV
-#define KERNEL
-#define _KERNEL 1
-/* Declare following so sys/vnode.h will compile with KERNEL defined */
-#define FILE FILe
-typedef enum _spustate { /* FROM /etc/conf/h/_types.h */
- SPUSTATE_NONE = 0, /* must be 0 for proper initialization */
- SPUSTATE_IDLE, /* spu is idle */
- SPUSTATE_USER, /* spu is in user mode */
- SPUSTATE_SYSTEM, /* spu is in system mode */
- SPUSTATE_UNKNOWN, /* utility code for NEW_INTERVAL() */
- SPUSTATE_NOCHANGE /* utility code for NEW_INTERVAL() */
-} spustate_t;
-#define k_off_t off_t
-#include "sys/vnode.h"
-#undef KERNEL
-#undef _KERNEL
-#else /* AFS_HPUX110_ENV */
-#include "sys/vnode.h"
-#endif /* else AFS_HPUX110_ENV */
-#endif /* else AFS_LINUX20_ENV */
-#ifdef AFS_HPUX_ENV
-#include "sys/inode.h"
-#else
-#ifndef AFS_AIX_ENV
-#ifdef AFS_SUN5_ENV
-#include "sys/fs/ufs_inode.h"
-#else
-#ifndef AFS_LINUX20_ENV
-#include "ufs/inode.h"
-#endif
-#endif
-#endif
-#endif
-#endif
-#endif
-
-/* AFS includes */
-#ifdef AFS_AIX41_ENV
-/* This definition is in rx_machdep.h, currently only for AIX 41 */
-#define RX_ENABLE_LOCKS
-/* The following two defines are from rx_machdep.h and are used in rx_
- * structures.
- */
-#define afs_kmutex_t int
-#define afs_kcondvar_t int
-#endif /* AFS_AIX41_ENV */
-
-
-#ifdef AFS_SUN5_ENV
-
-#define RX_ENABLE_LOCKS
-
-/**
- * Removed redefinitions of afs_kmutex_t and afs_kcondvar_t and included
- * the system header files in which they are defined
- */
-#include <sys/mutex.h>
-#include <sys/condvar.h>
-typedef kmutex_t afs_kmutex_t;
-typedef kcondvar_t afs_kcondvar_t;
-#endif /* AFS_SUN5_ENV */
-
-#ifdef AFS_HPUX110_ENV
-#define RX_ENABLE_LOCKS
-typedef struct {
- void *s_lock;
- int count;
- long sa_fill1;
- void *wait_list;
- void *sa_fill2[2];
- int sa_fill2b[2];
- long sa_fill2c[3];
- int sa_fill2d[16];
- int order;
- int sa_fill3;
-} afs_kmutex_t;
-typedef char *afs_kcondvar_t;
-#endif /* AFS_HPUX110_ENV */
-
-#ifdef AFS_SGI65_ENV
-#define RX_ENABLE_LOCKS 1
-typedef struct {
- __psunsigned_t opaque1;
- void *opaque2;
-} afs_kmutex_t;
-typedef struct {
- __psunsigned_t opaque;
-} afs_kcondvar_t;
-#endif /* AFS_SGI65_ENV */
-
-#ifdef AFS_LINUX20_ENV
-#include <asm/atomic.h>
-#include <asm/semaphore.h>
-#define RX_ENABLE_LOCKS 1
-typedef struct {
- struct semaphore opaque1;
- int opaque2;
-} afs_kmutex_t;
-typedef void *afs_kcondvar_t;
-#endif /* AFS_LINUX20_ENV */
-
-#include <afs/exporter.h>
-/*#include "afs/osi.h"*/
-
-typedef struct {
- int tv_sec;
- int tv_usec;
-} osi_timeval32_t; /* Needed here since KERNEL defined. */
-
-/*#include "afs/volerrors.h"*/
-#ifdef AFS_LINUX20_ENV
-#define _SYS_TIME_H
-#endif
-
-#include <afs/afsint.h>
-#include "vlserver/vldbint.h"
-#include "afs/lock.h"
-
-#define KERNEL
-
-#ifndef notdef
-#define AFS34
-#define AFS33
-#define AFS32a
-#else
-#define AFS32
-#endif
-
-
-#ifdef AFS_SGI61_ENV
-extern off64_t lseek64();
-#define KDUMP_SIZE_T size_t
-#else /* AFS_SGI61_ENV */
-#define KDUMP_SIZE_T int
-#endif /* AFS_SGI61_ENV */
-
-#include "afs/afs.h" /* XXXX Getting it from the obj tree XXX */
-#include "afs/afs_axscache.h" /* XXXX Getting it from the obj tree XXX */
-#include <afs/afs_stats.h>
-#include <afs/nfsclient.h>
-
-#include <afs/cmd.h>
-#include <rx/rx.h>
-
-
-#undef KERNEL
-
-#if defined(AFS_SGI_ENV)
-#define UNIX "/unix"
-#else
-#if defined(AFS_HPUX100_ENV)
-#define UNIX "/stand/vmunix"
-#else
-#ifdef AFS_HPUX_ENV
-#define UNIX "/hp-ux"
-#else
-#ifdef AFS_SUN5_ENV
-#define UNIX "/dev/ksyms"
-#else
-#define UNIX "/vmunix"
-#endif
-#endif /* AFS_HPUX_ENV */
-#endif /* AFS_HPUX100_ENV */
-#endif /* AFS_SGI_ENV */
-
-#if defined(AFS_SUN5_ENV)
-#define CORE "/dev/mem"
-#else
-#define CORE "/dev/kmem"
-#endif
-
-/* Forward declarations */
-void print_Conns();
-void print_cbHash();
-void print_DindexTimes();
-void print_DdvnextTbl();
-void print_DdcnextTbl();
-void print_DindexFlags();
-void print_buffers();
-void print_allocs();
-void kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len);
-void print_exporter();
-void print_nfsclient();
-void print_unixuser();
-void print_cell();
-void print_server();
-void print_conns();
-void print_conn();
-void print_volume();
-void print_venusfid();
-void print_vnode();
-void print_vcache();
-void print_dcache();
-void print_bkg();
-void print_vlru();
-void print_dlru();
-void print_callout();
-void print_dnlc();
-void print_global_locks();
-void print_global_afs_resource();
-void print_global_afs_cache();
-void print_rxstats();
-void print_rx();
-void print_services();
-#ifdef KDUMP_RX_LOCK
-void print_peertable_lock();
-void print_conntable_lock();
-void print_calltable_lock();
-#endif
-void print_peertable();
-void print_conntable();
-void print_calltable();
-void print_eventtable();
-void print_upDownStats();
-void print_cmperfstats();
-void print_cmstats();
-
-
-
-
-int opencore();
-
-#if defined(AFS_HPUX_ENV) && defined(__LP64__)
-#define afs_nlist nlist64
-#define AFSNLIST(N, C) nlist64((N), (C))
-#else /* defined(AFS_HPUX_ENV) && defined(__LP64__) */
-#ifdef AFS_SGI61_ENV
-#ifdef AFS_32BIT_KERNEL_ENV
-#define afs_nlist nlist
-#define AFSNLIST(N, C) nlist((N), (C))
-#else
-#define afs_nlist nlist64
-#define AFSNLIST(N, C) nlist64((N), (C))
-#endif /* AFS_32BIT_KERNEL_ENV */
-#else /* AFS_SGI61_ENV */
-#ifdef AFS_LINUX20_ENV
-struct afs_nlist {
- char *n_name;
- unsigned long n_value;
-};
-#else /* AFS_LINUX20_ENV */
-#define afs_nlist nlist
-#endif /* AFS_LINUX20_ENV */
-#define AFSNLIST(N, C) nlist((N), (C))
-#endif /* AFS_SGI61_ENV */
-#endif /* defined(AFS_HPUX_ENV) && defined(__LP64__) */
-
-char *obj = UNIX, *core = CORE;
-int kmem;
-
-int Dcells = 0, Dusers = 0, Dservers = 0, Dconns = 0, Dvols = 0, Ddvols =
- 0, mem = 0;
-int Dvstats = 0, Ddstats = 0, Dnfs = 0, Dglobals = 0, Dstats = 0, Dlocks =
- 0, Dall = 1;
-int Dindextimes = 0, Dindexflags = 0, Dvnodes = 0, Dbuffers = 0, DCallbacks =
- 0, Dallocs = 0, UserLevel = 0;
-int DdvnextTbl = 0, DdcnextTbl = 0;
-int Nconns = 0, Drxstats = 0, Drx = 0, Dbkg = 0, Dvlru = 0, Ddlru =
- 0, Dcallout = 0;
-int Ddnlc = 0;
-int Dgcpags = 0;
-
-#if defined(AFS_SUN5_ENV)
-#include <string.h>
-#include <sys/types.h>
-#include <sys/signal.h>
-#include <sys/elf.h>
-#include <libelf.h>
-#include <sys/elf_M32.h>
-#include <sys/proc.h>
-#include <sys/file.h>
-#define _NLIST_H /* XXXXXXXXXXXXX */
-#include <kvm.h>
-kvm_t *kd;
-#endif /* defined(AFS_SUN5_ENV) */
-
-/* Pretty Printers - print real IP addresses and the like if running
- * in interpret_mode.
- */
-int pretty = 1;
-
-char *
-PrintIPAddr(int addr)
-{
- static char str[32];
- struct in_addr in_addr;
-
- if (pretty) {
- if (addr == 1) {
- strcpy(str, "local");
- } else {
- in_addr.s_addr = addr;
- (void)strcpy(str, inet_ntoa(in_addr));
- }
- } else {
- (void)sprintf(str, "%x", addr);
- }
- return (char *)str;
-}
-
-#ifdef AFS_LINUX20_ENV
-/* Find symbols in a live kernel. */
-
-#ifdef AFS_LINUX26_ENV
-#define KSYMS "/proc/kallsyms"
-#else
-#define KSYMS "/proc/ksyms"
-#endif
-
-/* symlist_t contains all the kernel symbols. Forcing a 64 byte array is
- * a bit wasteful, but simple.
- */
-#define MAXNAMELEN 64
-typedef struct symlist {
- char s_name[MAXNAMELEN];
-#ifdef AFS_LINUX_64BIT_KERNEL
- unsigned long s_value;
-#else
- int s_value;
-#endif /* AFS_LINUX_64BIT_KERNEL */
-} symlist_t;
-
-#define KSYM_ALLOC_STEP 128
-#define KSYM_ALLOC_BASE 1024
-symlist_t *ksyms = NULL;
-int nksyms = 0;
-int availksyms = 0;
-
-#define MAXLINE 1024
-
-int
-compare_strings(const void *a, const void *b)
-{
- symlist_t *syma = (symlist_t *) a;
- symlist_t *symb = (symlist_t *) b;
- return strcmp(syma->s_name, symb->s_name);
-}
-
-/* Read in all the kernel symbols */
-void
-read_ksyms(void)
-{
- FILE *fp;
- char line[MAXLINE];
- char *p, *q;
-
- if (ksyms)
- return;
-
- fp = fopen(KSYMS, "r");
- if (fp == NULL) {
- printf("Can't open %s, exiting.\n", KSYMS);
- exit(1);
- }
-
- availksyms = KSYM_ALLOC_BASE;
- ksyms = malloc(availksyms * sizeof(symlist_t));
- if (!ksyms) {
- printf("Can't malloc %d elements for symbol list.\n", availksyms);
- exit(1);
- }
-
- /* proc is organized as <addr> <name> <module> */
- while (fgets(line, MAXLINE, fp)) {
- if (nksyms >= availksyms) {
- availksyms += KSYM_ALLOC_STEP;
- ksyms = realloc(ksyms, availksyms * sizeof(symlist_t));
- if (!ksyms) {
- printf("Failed to realloc %d symbols.\n", availksyms);
- exit(1);
- }
- }
-#ifdef AFS_LINUX_64BIT_KERNEL
- ksyms[nksyms].s_value = (unsigned long)strtoul(line, &p, 16);
-#else
- ksyms[nksyms].s_value = (int)strtoul(line, &p, 16);
-#endif /* AFS_LINUX_64BIT_KERNEL */
- p++;
-#ifdef AFS_LINUX26_ENV
- /* Linux 2.6 /proc/kallsyms has a one-char symbol type
- between address and name, so step over it and the following
- blank.
- */
- p += 2;
-#endif
- q = strchr(p, '\t');
- if (q)
- *q = '\0';
- if (strlen(p) >= MAXLINE) {
- printf("Symbol '%s' too long, ignoring it.\n", p);
- continue;
- }
- (void)strcpy(ksyms[nksyms].s_name, p);
- nksyms++;
- }
-
- /* Sort them in lexical order */
- qsort(ksyms, nksyms, sizeof(symlist_t), compare_strings);
-}
-
-
-
-/* find_symbol returns 0 if not found, otherwise value for symbol */
-#ifdef AFS_LINUX_64BIT_KERNEL
-unsigned long
-#else
-int
-#endif /* AFS_LINUX_64BIT_KERNEL */
-find_symbol(char *name)
-{
- symlist_t *tmp;
- symlist_t entry;
-
- if (!ksyms)
- read_ksyms();
-
- (void)strcpy(entry.s_name, name);
- tmp =
- (symlist_t *) bsearch(&entry, ksyms, nksyms, sizeof(symlist_t),
- compare_strings);
-
- return tmp ? tmp->s_value : 0;
-}
-
-/* nlist fills in values in list until a null name is found. */
-int
-nlist(void *notused, struct afs_nlist *nlp)
-{
- for (; nlp->n_name && *nlp->n_name; nlp++)
- nlp->n_value = find_symbol(nlp->n_name);
-
- return 0;
-}
-
-#endif
-
-#if defined(AFS_SUN5_ENV)
-#ifdef _LP64
-Elf64_Sym *tbl;
-#else
-Elf32_Sym *tbl; /* symbol tbl */
-#endif
-char *tblp; /* ptr to symbol tbl */
-int scnt = 0;
-
-#ifdef _LP64
-Elf64_Sym *
-symsrch(s)
- char *s;
-{
- Elf64_Sym *sp;
-#else
-Elf32_Sym *
-symsrch(s)
- char *s;
-{
- Elf32_Sym *sp;
-#endif /** _LP64 **/
- char *name;
- unsigned char type;
-
- for (sp = tbl; sp < &tbl[scnt]; sp++) {
-#ifdef _LP64
- type = ELF64_ST_TYPE(sp->st_info);
-#else
- type = ELF32_ST_TYPE(sp->st_info);
-#endif /** _LP64 **/
- if (((type == STB_LOCAL) || (type == STB_GLOBAL)
- || (type == STB_WEAK))
- && ((afs_uint32) sp->st_value >= 0x10000)) {
- name = tblp + sp->st_name;
- if (!strcmp(name, s))
- return (sp);
- }
- }
- return (0);
-}
-
-#endif /*defined(AFS_SUN5_ENV) */
-
-#endif /*!defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV) */
-
-#ifndef AFS_KDUMP_LIB
-static int
-cmdproc(struct cmd_syndesc *as, void *arock)
-{
- afs_int32 code = 0;
-
-#if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
- if (as->parms[0].items) { /* -kobj */
- obj = as->parms[0].items->data;
- }
- if (as->parms[1].items) { /* -kcore */
- core = as->parms[1].items->data;
- }
- if (as->parms[2].items) { /* -cells */
- Dcells = 1, Dall = 0;
- }
- if (as->parms[3].items) { /* -users */
- Dusers = 1, Dall = 0;
- }
- if (as->parms[4].items) { /* -servers */
- Dservers = 1, Dall = 0;
- }
- if (as->parms[5].items) { /* -conns */
- Dconns = 1, Dall = 0;
- }
- if (as->parms[6].items) { /* -volumes */
- Dvols = 1, Dall = 0;
- }
- if (as->parms[7].items) { /* -dvolumes */
- Ddvols = 1, Dall = 0;
- }
- if (as->parms[8].items) { /* -vstats */
- Dvstats = 1, Dall = 0;
- }
- if (as->parms[9].items) { /* -dstats */
- Ddstats = 1, Dall = 0;
- }
- if (as->parms[10].items) { /* -nfstats */
- Dnfs = 1, Dall = 0;
- }
- if (as->parms[11].items) { /* -globals */
- Dglobals = 1, Dall = 0;
- }
- if (as->parms[12].items) { /* -stats */
- Dstats = 1, Dall = 0;
- }
- if (as->parms[13].items) { /* -locks */
- Dlocks = 1, Dall = 0;
- }
- if (as->parms[14].items) { /* -mem */
- mem = 1;
- }
- if (as->parms[15].items) { /* -rxstats */
- Drxstats = 1, Dall = 0;
- }
- if (as->parms[16].items) { /* -rx */
- Drx = 1, Dall = 0;
- }
- if (as->parms[17].items) { /* -timestable */
- Dindextimes = 1, Dall = 0;
- }
- if (as->parms[18].items) { /* -flagstable */
- Dindexflags = 1, Dall = 0;
- }
- if (as->parms[19].items) { /* -cbhash */
- DCallbacks = 1, Dall = 0;
- }
- if (as->parms[20].items) { /* -vnodes */
- Dvnodes = 1, Dall = 0;
- }
- if (as->parms[21].items) { /* -buffers */
- Dbuffers = 1, Dall = 0;
- }
- if (as->parms[22].items) { /* -allocedmem */
- Dallocs = 1, Dall = 0;
- }
- if (as->parms[23].items) { /* -user */
- UserLevel = 1;
- }
- if (as->parms[24].items) { /* -bkg */
- Dbkg = 1, Dall = 0;
- }
- if (as->parms[25].items) { /* -vlru */
- Dvlru = 1, Dall = 0;
- }
- if (as->parms[26].items) { /* -callout */
- Dcallout = 1, Dall = 0;
- }
- if (as->parms[27].items) { /* -dnlc */
- Ddnlc = 1, Dall = 0;
- }
- if (as->parms[28].items) { /* -dlru */
- Ddlru = 1, Dall = 0;
- }
-
- if (as->parms[29].items) { /* -raw */
- pretty = 0;
- }
-
- if (as->parms[30].items) { /* -gcpags */
- Dgcpags = 1, Dall = 0;
- }
-
- if (as->parms[31].items) { /* -dhash */
- DdvnextTbl = 1, DdcnextTbl = 1, Dall = 0;
- }
-#endif
-
- code = kdump();
- return code;
-}
-
-#include "AFS_component_version_number.c"
-
-int
-main(int argc, char **argv)
-{
- struct cmd_syndesc *ts;
- afs_int32 code;
-
-#ifdef AFS_AIX32_ENV
- struct sigaction nsa;
-
- sigemptyset(&nsa.sa_mask);
- nsa.sa_handler = SIG_DFL;
- nsa.sa_flags = SA_FULLDUMP;
- sigaction(SIGSEGV, &nsa, NULL);
-#endif
-
- ts = cmd_CreateSyntax(NULL, cmdproc, NULL, 0,
- "Read internal cache manager structs");
- cmd_AddParm(ts, "-kobj", CMD_SINGLE, CMD_OPTIONAL,
- "kernel object (default /vmunix)");
- cmd_AddParm(ts, "-kcore", CMD_SINGLE, CMD_OPTIONAL,
- "kernel core image (default /dev/kmem)");
- cmd_AddParm(ts, "-cells", CMD_FLAG, CMD_OPTIONAL, "cell state");
- cmd_AddParm(ts, "-users", CMD_FLAG, CMD_OPTIONAL, "users state");
- cmd_AddParm(ts, "-servers", CMD_FLAG, CMD_OPTIONAL, "servers state");
- cmd_AddParm(ts, "-conns", CMD_FLAG, CMD_OPTIONAL, "conns state");
- cmd_AddParm(ts, "-volumes", CMD_FLAG, CMD_OPTIONAL,
- "incore volume state");
- cmd_AddParm(ts, "-dvolumes", CMD_FLAG, CMD_OPTIONAL, "disk volume state");
- cmd_AddParm(ts, "-vstats", CMD_FLAG, CMD_OPTIONAL, "stat file state");
- cmd_AddParm(ts, "-dstats", CMD_FLAG, CMD_OPTIONAL, "file data state");
- cmd_AddParm(ts, "-nfstats", CMD_FLAG, CMD_OPTIONAL,
- "nfs translator state");
- cmd_AddParm(ts, "-globals", CMD_FLAG, CMD_OPTIONAL,
- "general global state");
- cmd_AddParm(ts, "-stats", CMD_FLAG, CMD_OPTIONAL,
- "general cm performance state");
- cmd_AddParm(ts, "-locks", CMD_FLAG, CMD_OPTIONAL,
- "global cm related locks state");
- cmd_AddParm(ts, "-mem", CMD_FLAG, CMD_OPTIONAL,
- "core represents the physical mem (i.e. /dev/mem) and not virtual");
- cmd_AddParm(ts, "-rxstats", CMD_FLAG, CMD_OPTIONAL,
- "general rx statistics");
- cmd_AddParm(ts, "-rx", CMD_FLAG, CMD_OPTIONAL, "all info about rx");
- cmd_AddParm(ts, "-timestable", CMD_FLAG, CMD_OPTIONAL,
- "dcache LRU info table");
- cmd_AddParm(ts, "-flagstable", CMD_FLAG, CMD_OPTIONAL,
- "dcache flags info table");
- cmd_AddParm(ts, "-cbhash", CMD_FLAG, CMD_OPTIONAL,
- "vcache hashed by cbExpires");
- cmd_AddParm(ts, "-vnodes", CMD_FLAG, CMD_OPTIONAL, "afs vnodes");
- cmd_AddParm(ts, "-buffers", CMD_FLAG, CMD_OPTIONAL,
- "afs dir buffer cache");
- cmd_AddParm(ts, "-allocedmem", CMD_FLAG, CMD_OPTIONAL,
- "allocated memory");
- cmd_AddParm(ts, "-user", CMD_FLAG, CMD_OPTIONAL,
- "core is from a user-level program");
- cmd_AddParm(ts, "-bkg", CMD_FLAG, CMD_OPTIONAL, "background daemon info");
- cmd_AddParm(ts, "-vlru", CMD_FLAG, CMD_OPTIONAL, "vcache lru list");
- cmd_AddParm(ts, "-callout", CMD_FLAG, CMD_OPTIONAL,
- "callout info (aix only)");
- cmd_AddParm(ts, "-dnlc", CMD_FLAG, CMD_OPTIONAL,
- "DNLC table,freelist,trace");
- cmd_AddParm(ts, "-dlru", CMD_FLAG, CMD_OPTIONAL, "dcache lru list");
-
-
- cmd_AddParm(ts, "-raw", CMD_FLAG, CMD_OPTIONAL, "show raw values");
- cmd_AddParm(ts, "-gcpags", CMD_FLAG, CMD_OPTIONAL,
- "PAG garbage collection info");
- cmd_AddParm(ts, "-dhash", CMD_FLAG, CMD_OPTIONAL,
- "show dcache hash chains");
-
- code = cmd_Dispatch(argc, argv);
- return code;
-}
-#endif /* !AFS_KDUMP_LIB */
-
-#ifdef AFS_AIX_ENV
-#ifndef AFS_KDUMP_LIB
-int
-Knlist(struct afs_nlist *sp, int cnt, int size)
-{
- int code;
-
- if (UserLevel)
- code = nlist(obj, sp);
- else
- code = knlist(sp, cnt, size);
- return code;
-}
-#endif /*AFS_KDUMP_LIB */
-#endif
-
-#if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
-int
-findsym(char *sname, off_t * offset)
-{
-#if defined(AFS_SUN5_ENV)
-#ifdef _LP64
- Elf64_Sym *ss_ans;
-#else
- Elf32_Sym *ss_ans;
-#endif
- ss_ans = symsrch(sname);
- if (!ss_ans) {
- printf("(WARNING) Couldn't find %s in %s. Proceeding..\n", sname,
- obj);
- *offset = 0;
- return 0;
- }
- *offset = ss_ans->st_value;
- return 1;
-#else /* defined(AFS_SUN5_ENV) */
-#if defined(AFS_AIX_ENV)
- if (!UserLevel) {
- struct afs_nlist nl;
- nl.n_name = sname;
- if (Knlist(&nl, 1, sizeof nl) == -1) {
- printf("(WARNING) knlist: couldn't find %s. Proceeding...",
- sname);
- *offset = 0;
- return 0;
- }
- *offset = nl.n_value;
- return 1;
- }
-#endif /* defined(AFS_AIX_ENV) */
- {
- struct afs_nlist request[2];
-
- memset(request, 0, sizeof request);
- request[0].n_name = sname;
- if (AFSNLIST(obj, request) < 0) {
- fprintf(stderr, "nlist(%s, %s) failure: %d (%s)\n", obj, sname,
- errno, strerror(errno));
- exit(1);
- }
- *offset = request[0].n_value;
- if (!request[0].n_value) {
- printf("(WARNING) Couldn't find %s in %s. Proceeding..\n", sname,
- obj);
- return 0;
- }
- return 1;
- }
-#endif /* defined(AFS_SUN5_ENV) */
-}
-#endif
-
-#define CBHTSIZE 128
-
-int
-kdump(void)
-{
-#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
- printf("Kdump not supported\n");
-#else
- int cell, cnt, cnt1;
-#ifndef AFS_KDUMP_LIB
-
- kmem = opencore(core);
-
-#endif /* AFS_KDUMP_LIB */
-
-#ifdef KDUMP_RX_LOCK
- /* Test to see if kernel is using RX_ENABLE_LOCKS in rx structs. */
-#ifdef AFS_SGI53_ENV
-#ifdef AFS_SGI64_ENV
- use_rx_lock = 1; /* Always using fine gain locking. */
-#else
- use_rx_lock = (sysmp(MP_NPROCS) > 1) ? 1 : 0;
-#endif
-#endif /* AFS_SGI53_ENV */
-#endif /* KDUMP_RX_LOCK */
-
- if (Dcells || Dall) {
- print_cells(1); /* Handle the afs_cells structures */
- print_cellaliases(1);
- print_cellnames(1);
- }
-
- if (Dusers || Dall) {
- print_users(1); /* Handle the afs_users structs */
- }
-
- if (Dservers || Dall) {
- print_servers(1); /* Handle the afs_servers structs */
- }
-
- if (Dconns) {
- print_Conns(1); /* Handle the afs_servers structs */
- }
-
- if (Dvols || Dall) {
- print_volumes(1); /* Handle the afs_volumes structs */
- }
-
- if (Ddvols || Dall) {
- printf
- ("\n\nIGNORE reading the 'volumeinfo' file for now (NOT IMPORTANT)!\n");
- }
-
- if (DCallbacks || Dall) {
- print_cbHash(1); /* Handle the cbHashT table of queued vcaches */
- }
-
- if (Dvstats || Dall || Dvnodes) {
- print_vcaches(1); /* Handle the afs_vcaches structs */
- }
-
- if (Ddstats || Dall) {
- print_dcaches(1);
- }
-
- if (Dindextimes || Dall) {
- print_DindexTimes(1);
- }
-
- if (Dindexflags || Dall) {
- print_DindexFlags(1);
- }
-
- if (DdvnextTbl || Dall) {
- print_DdvnextTbl(1);
- }
-
- if (DdcnextTbl || Dall) {
- print_DdcnextTbl(1);
- }
-
- if (Dbuffers || Dall) {
- print_buffers(1);
- }
-
- if (Dnfs || Dall) {
- print_nfss(1);
- }
-
- if (Dstats || Dall) {
- off_t symoff;
- struct afs_CMStats afs_cmstats;
- struct afs_stats_CMPerf afs_cmperfstats;
-
- printf("\n\nPrinting count references to cm-related functions..\n\n");
- findsym("afs_cmstats", &symoff);
- kread(kmem, symoff, (char *)&afs_cmstats, sizeof afs_cmstats);
- print_cmstats(&afs_cmstats);
- printf("\n\nPrinting some cm struct performance stats..\n\n");
- findsym("afs_stats_cmperf", &symoff);
- kread(kmem, symoff, (char *)&afs_cmperfstats, sizeof afs_cmperfstats);
- print_cmperfstats(&afs_cmperfstats);
-
- }
- if (Dlocks || Dall) {
- print_global_locks(kmem);
- }
- if (Dglobals || Dall) {
- printf("\n\nPrinting Misc afs globals...\n");
- print_global_afs_resource(kmem);
- print_global_afs_cache(kmem);
- }
- if (Dbkg || Dall) {
- print_bkg(kmem);
- }
- if (Dvlru || Dall) {
- print_vlru(kmem);
- }
- if (Ddlru || Dall) {
- print_dlru(kmem);
- }
- if (Drxstats || Dall) {
- print_rxstats(kmem);
- }
- if (Drx || Dall) {
- print_rx(kmem);
- }
-#ifndef AFS_KDUMP_LIB
- if (Dallocs || Dall) {
- print_allocs(1);
- }
-#endif
- if (Dcallout || Dall) {
- print_callout(kmem);
- }
- if (Ddnlc || Dall) {
- print_dnlc(kmem);
- }
- if (Dgcpags || Dall) {
- print_gcpags(1);
- }
-#endif
- return 0;
-}
-
-#if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
-int Sum_cellnames = 0, Sum_userstp = 0, Sum_volnames = 0, Sum_exps =
- 0, Sum_nfssysnames = 0;
-int Sum_vcachemvids = 0, Sum_vcachelinkData = 0, Sum_vcacheacc =
- 0, Sum_vcachelocks = 0;
-int Sum_cellaliases = 0, Sum_cellname_names = 0;
-
-int
-print_cells(int pnt)
-{
- off_t symoff;
- struct cell *cells, cle, *clentry = &cle, *clep;
- long j = 0, cell;
- struct afs_q CellLRU, lru, *vu = &lru, *tq, *uq;
- u_long lru_addr;
-
- if (pnt)
- printf("\n\nPrinting Cells' LRU list...\n");
- findsym("CellLRU", &symoff);
- kread(kmem, symoff, (char *)&CellLRU, sizeof CellLRU);
- lru_addr = (u_long) symoff;
- for (tq = CellLRU.next; (u_long) tq != lru_addr; tq = uq) {
- clep = QTOC(tq);
- kread(kmem, (off_t) tq, (char *)vu, sizeof CellLRU);
- uq = vu->next;
- kread(kmem, (off_t) clep, (char *)clentry, sizeof *clentry);
- print_cell(kmem, clentry, clep, pnt);
- j++;
- }
- if (pnt)
- printf("... found %d 'afs_cells' entries\n", j);
-
- return j;
-}
-
-int
-print_cellaliases(int pnt)
-{
- off_t symoff;
- struct cell_alias *ca, cae;
- long j = 0;
-
- if (pnt)
- printf("\n\nPrinting cell_alias list...\n");
- findsym("afs_cellalias_head", &symoff);
- kread(kmem, symoff, (char *)&ca, sizeof ca);
- while (ca) {
- char alias[100], cell[100];
-
- kread(kmem, (off_t) ca, (char *)&cae, sizeof cae);
- kread(kmem, (off_t) cae.alias, alias, (KDUMP_SIZE_T) 40);
- alias[40] = '\0';
- Sum_cellaliases += strlen(alias) + 1;
- kread(kmem, (off_t) cae.cell, cell, (KDUMP_SIZE_T) 40);
- cell[40] = '\0';
- Sum_cellaliases += strlen(cell) + 1;
- if (pnt)
- printf("%x: alias=%s cell=%s index=%d\n", ca, alias, cell,
- cae.index);
- ca = cae.next;
- j++;
- }
- if (pnt)
- printf("... found %d 'cell_alias' entries\n", j);
-
- return j;
-}
-
-int
-print_cellnames(int pnt)
-{
- off_t symoff;
- struct cell_name *cn, cne;
- long j = 0;
-
- if (pnt)
- printf("\n\nPrinting cell_name list...\n");
- findsym("afs_cellname_head", &symoff);
- kread(kmem, symoff, (char *)&cn, sizeof cn);
- while (cn) {
- char cellname[100];
-
- kread(kmem, (off_t) cn, (char *)&cne, sizeof cne);
- kread(kmem, (off_t) cne.cellname, cellname, (KDUMP_SIZE_T) 40);
- cellname[40] = '\0';
- Sum_cellname_names += strlen(cellname) + 1;
- if (pnt)
- printf("%x: cellnum=%d cellname=%s used=%d\n", cn, cne.cellnum,
- cellname, cne.used);
- cn = cne.next;
- j++;
- }
- if (pnt)
- printf("... found %d 'cell_name' entries\n", j);
-
- return j;
-}
-
-int
-print_users(int pnt)
-{
- off_t symoff;
- struct unixuser *afs_users[NUSERS], ue, *uentry = &ue, *uep;
- int i, j;
-
- if (pnt)
- printf("\n\nPrinting 'afs_users' structures...\n");
- findsym("afs_users", &symoff);
- kread(kmem, symoff, (char *)afs_users, sizeof afs_users);
- for (i = 0, j = 0; i < NUSERS; i++) {
- for (uep = afs_users[i]; uep; uep = uentry->next, j++) {
- kread(kmem, (off_t) uep, (char *)uentry, sizeof *uentry);
- print_unixuser(kmem, uentry, uep, pnt);
- }
- }
- if (pnt)
- printf("... found %d 'afs_users' entries\n", j);
- return j;
-}
-
-struct server **serversFound = NULL;
-afs_int32 NserversFound = 0;
-#define SF_ALLOCATION_STEP 500
-
-int
-add_found_server(struct server *sep)
-{
- static afs_int32 NserversAllocated = 0;
- static afs_int32 failed = 0;
-
- if (failed)
- return -1;
-
- if (NserversFound >= NserversAllocated) {
- NserversAllocated += SF_ALLOCATION_STEP;
- if (!serversFound) {
- serversFound = malloc(NserversAllocated *
- sizeof(struct server *));
- } else {
- serversFound = realloc(serversFound,
- NserversAllocated *
- sizeof(struct server *));
- }
- if (!serversFound) {
- printf("Can't allocate %lu bytes for list of found servers.\n",
- NserversAllocated * sizeof(struct server *));
- failed = 1;
- NserversFound = 0;
- return -1;
- }
- }
- serversFound[NserversFound++] = sep;
- return 0;
-}
-
-int
-find_server(struct server *sep)
-{
- int i;
-
- for (i = 0; i < NserversFound; i++) {
- if (sep == serversFound[i])
- return 1;
- }
- return 0;
-}
-
-int
-print_servers(int pnt)
-{
- off_t symoff;
- struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
- struct srvAddr *afs_srvAddrs[NSERVERS], sa, *sap;
- afs_int32 i, nServers, nSrvAddrs, nSrvAddrStructs;
- afs_int32 afs_totalServers, afs_totalSrvAddrs;
- int failed = 0;
- int chainCount[NSERVERS];
-
- if (pnt) {
- memset(chainCount, 0, sizeof(chainCount));
- printf("\n\nPrinting 'afs_servers' structures...\n");
- }
- findsym("afs_servers", &symoff);
- kread(kmem, symoff, (char *)afs_servers, NSERVERS * sizeof(long));
- for (i = 0, nServers = 0; i < NSERVERS; i++) {
- if (pnt)
- printf(" --- Chain %d ---\n", i);
- for (sep = afs_servers[i]; sep; sep = sentry->next, nServers++) {
- kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
- if (pnt && !failed) {
- if (add_found_server(sep) < 0)
- failed = 1;
- }
- if (pnt)
- chainCount[i]++;
- if (Dconns || Dall || !pnt)
- print_server(kmem, sentry, sep, 1, pnt);
- else
- print_server(kmem, sentry, sep, 0, pnt);
- }
- }
- if (pnt) {
- if (Dconns || Dall)
- printf("... found %d 'afs_servers' entries (total conns = %d)\n",
- nServers, Nconns);
- else
- printf("... found %d 'afs_servers' entries\n", nServers);
- printf("Chain lengths:\n");
- for (i = 0; i < NSERVERS; i++) {
- printf("%2d: %5d\n", i, chainCount[i]);
- }
- }
- Dconns = 0;
-
-
- /* Verify against afs_totalServers. */
- if (pnt) {
- memset(chainCount, 0, sizeof(chainCount));
- if (findsym("afs_totalServers", &symoff)) {
- kread(kmem, symoff, (char *)&afs_totalServers, sizeof(afs_int32));
- if (afs_totalServers != nServers) {
- printf
- ("ERROR: afs_totalServers = %d, differs from # of servers in hash table.\n",
- afs_totalServers);
- } else {
- printf("afs_totalServers = %d, matches hash chain count.\n",
- afs_totalServers);
- }
- }
-
- printf("\n\nPrinting 'afs_srvAddr' structures...\n");
- if (findsym("afs_srvAddrs", &symoff)) {
- kread(kmem, symoff, (char *)afs_srvAddrs,
- NSERVERS * sizeof(long));
- nSrvAddrStructs = 0;
- for (i = 0, nSrvAddrs = 0; i < NSERVERS; i++) {
- printf(" --- Chain %d ---\n", i);
- for (sap = afs_srvAddrs[i]; sap; sap = sa.next_bkt) {
- kread(kmem, (off_t) sap, (char *)&sa, sizeof(sa));
- printf
- ("%lx: sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, nexth=%lx\n",
- sap, PrintIPAddr(sa.sa_ip), sa.sa_portal,
- sa.sa_iprank, sa.sa_flags, sa.conns, sa.server,
- sa.next_bkt);
- if (sap != (struct srvAddr *)sa.server) {
- /* only count ones not in a server struct. */
- nSrvAddrStructs++;
- }
- nSrvAddrs++;
- chainCount[i]++;
- if (!failed) {
- if (!find_server(sa.server)) {
- kread(kmem, (off_t) sa.server, (char *)sentry,
- sizeof *sentry);
- printf
- ("ERROR: Server missing from hash chain: server=%lx, server->next=%lx\n",
- sa.server, sentry->next);
- print_server(kmem, sentry, sa.server, 1, pnt);
- printf
- ("----------------------------------------------------\n");
- }
- }
-
- }
- }
- printf
- ("... found %d 'afs_srvAddr' entries, %d alloc'd (not in server struct)\n",
- nSrvAddrs, nSrvAddrStructs);
- printf("Chain lengths:\n");
- for (i = 0; i < NSERVERS; i++) {
- printf("%2d: %5d\n", i, chainCount[i]);
- }
- if (findsym("afs_totalSrvAddrs", &symoff)) {
- kread(kmem, symoff, (char *)&afs_totalSrvAddrs,
- sizeof(afs_int32));
- if (afs_totalSrvAddrs != nSrvAddrStructs) {
- printf
- ("ERROR: afs_totalSrvAddrs = %d, differs from number of alloc'd srvAddrs in hash table.\n",
- afs_totalSrvAddrs);
- } else {
- printf
- ("afs_totalSrvAddrs = %d, matches alloc'd srvAddrs in hash chain count.\n",
- afs_totalSrvAddrs);
- }
- }
- }
- }
- return nServers;
-}
-
-
-void
-print_Conns(int pnt)
-{
- off_t symoff;
- struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
- afs_int32 i, j;
-
- if (pnt)
- printf("\n\nPrinting all 'afs_conns' to the servers...\n");
- findsym("afs_servers", &symoff);
- kread(kmem, symoff, (char *)afs_servers, sizeof afs_servers);
- for (i = 0, j = 0; i < NSERVERS; i++) {
- for (sep = afs_servers[i]; sep; sep = sentry->next, j++) {
- kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
- print_server(kmem, sentry, sep, 2, pnt);
- }
- }
- if (pnt)
- printf("... found %d 'afs_conns' entries\n", Nconns);
-}
-
-
-int
-print_volumes(int pnt)
-{
- off_t symoff;
- struct volume *afs_volumes[NVOLS], ve, *ventry = &ve, *vep;
- afs_int32 i, j;
-
- if (pnt)
- printf("\n\nPrinting 'afs_volumes' structures...\n");
- findsym("afs_volumes", &symoff);
- kread(kmem, symoff, (char *)afs_volumes, NVOLS * sizeof(long));
- for (i = 0, j = 0; i < NVOLS; i++) {
- for (vep = afs_volumes[i]; vep; vep = ventry->next, j++) {
- kread(kmem, (off_t) vep, (char *)ventry, sizeof *ventry);
- print_volume(kmem, ventry, vep, pnt);
- }
- }
- if (pnt)
- printf("... found %d 'afs_volumes' entries\n", j);
- return (j);
-}
-
-void
-print_cbHash(int pnt)
-{
- off_t symoff;
- struct afs_q cbHashT[CBHTSIZE];
- afs_int32 i, j;
-
- if (pnt)
- printf("\n\nPrinting 'cbHashT' table...\n");
- findsym("cbHashT", &symoff);
- kread(kmem, symoff, (char *)cbHashT, sizeof cbHashT);
- for (i = 0; i < CBHTSIZE; i++) {
- if (pnt)
- printf("%lx: %x %x\n", (long)symoff + 8 * i, cbHashT[i].prev,
- cbHashT[i].next);
- }
- if (pnt)
- printf("... that should be %d callback hash entries\n", i);
-}
-
-int
-print_vcaches(int pnt)
-{
- off_t symoff;
- struct vcache *afs_vhashTable[VCSIZE], Ve, *Ventry = &Ve, *Vep;
- afs_int32 i, j;
-
- if (pnt)
- printf("\n\nPrinting afs_vcaches structures...\n");
- if (pnt)
- printf("print_vcaches: sizeof(struct vcache) = %ld\n",
- (long)sizeof(struct vcache));
- findsym("afs_vhashT", &symoff);
- kread(kmem, symoff, (char *)afs_vhashTable, sizeof afs_vhashTable);
- for (i = 0, j = 0; i < VCSIZE; i++) {
- if (pnt)
- printf("Printing hash chain %d...\n", i);
- for (Vep = afs_vhashTable[i]; Vep; Vep = Ventry->hnext, j++) {
- kread(kmem, (off_t) Vep, (char *)Ventry, sizeof *Ventry);
- if (Dvstats || Dall || !pnt)
- print_vcache(kmem, Ventry, Vep, pnt);
- if (Dvnodes || Dall)
- print_vnode(kmem, Ventry, Vep, pnt);
- }
- }
- if (pnt)
- printf("... found %d 'afs_vcaches' entries\n", j);
- return j;
-}
-
-int
-print_dcaches(int pnt)
-{
- off_t symoff;
- long table, *ptr;
- struct dcache dc, *dcp = &dc, *dp;
- afs_int32 i, j, count;
- struct afs_q dlru;
-
- /* Handle the afs_dcaches structs */
- if (pnt)
- printf("\n\nPrinting afs_dcache related structures...\n");
- findsym("afs_cacheFiles", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- findsym("afs_indexTable", &symoff);
- kread(kmem, symoff, (char *)&table, sizeof(long));
- ptr = malloc(count * sizeof(long));
- kread(kmem, table, (char *)ptr, count * sizeof(long));
- for (i = 0, j = 0; i < count; i++) {
- if (dp = (struct dcache *)ptr[i]) {
- if (pnt)
- printf("afs_indexTable[%d] %x: ", i, dp);
- kread(kmem, (off_t) dp, (char *)dcp, sizeof *dcp);
- print_dcache(kmem, dcp, dp, pnt);
- j++;
- }
- }
- if (pnt)
- printf("... found %d 'dcache' entries\n", j);
- findsym("afs_DLRU", &symoff);
- kread(kmem, symoff, (char *)&dlru, sizeof(struct afs_q));
- if (pnt)
- printf("DLRU next=0x%x, prev=0x%x\n", dlru.next, dlru.prev);
- free(ptr);
-
- return j;
-}
-
-
-void
-print_DindexTimes(int pnt)
-{
- off_t symoff;
- long table;
- afs_hyper_t *ptr;
- afs_int32 temp, *indexTime = &temp;
- afs_int32 i, j, count;
-
- /* Handle the afs_indexTimes array */
- if (pnt)
- printf("\n\nPrinting afs_indexTimes[]...\n");
- findsym("afs_cacheFiles", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- findsym("afs_indexTimes", &symoff);
- kread(kmem, symoff, (char *)&table, sizeof(long));
- ptr = malloc(count * sizeof(afs_hyper_t));
- kread(kmem, table, (char *)ptr, count * sizeof(afs_hyper_t));
- for (i = 0, j = 0; i < count; i++) {
- if (pnt)
- printf("afs_indexTimes[%d]\t%10d.%d\n", i, ptr[i].high,
- ptr[i].low);
-/* if (dp = (struct dcache *)ptr[i]) {
- printf("afs_indexTable[%d] %lx: ", i, dp);
- kread(kmem, (off_t) dp, (char *)dcp, sizeof *dcp);
- print_dcache(kmem, dcp, dp);
- }
-*/
- j++;
- }
- if (pnt)
- printf("afs_indexTimes has %d entries\n", j);
- free(ptr);
-}
-
-
-void
-print_DdvnextTbl(int pnt)
-{
- off_t symoff;
- long table;
- afs_int32 *ptr;
- afs_int32 temp, *indexTime = &temp;
- afs_int32 i, j, count;
-
- /* Handle the afs_dvnextTbl arrays */
- if (pnt)
- printf("\n\nPrinting afs_dvnextTbl[]...\n");
- findsym("afs_cacheFiles", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- findsym("afs_dvnextTbl", &symoff);
- kread(kmem, symoff, (char *)&table, sizeof(long));
- ptr = malloc(count * sizeof(afs_int32));
- kread(kmem, table, (char *)ptr, count * sizeof(afs_int32));
- for (i = 0, j = 0; i < count; i++) {
- if (pnt)
- printf("afs_dvnextTbl[%d]\t%d\n", i, ptr[i]);
- j++;
- }
- if (pnt)
- printf("afs_dvnextTbl has %d entries\n", j);
- free(ptr);
-}
-
-
-void
-print_DdcnextTbl(int pnt)
-{
- off_t symoff;
- long table;
- afs_int32 *ptr;
- afs_int32 temp, *indexTime = &temp;
- afs_int32 i, j, count;
-
- /* Handle the afs_dcnextTbl arrays */
- if (pnt)
- printf("\n\nPrinting afs_dcnextTbl[]...\n");
- findsym("afs_cacheFiles", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- findsym("afs_dcnextTbl", &symoff);
- kread(kmem, symoff, (char *)&table, sizeof(long));
- ptr = malloc(count * sizeof(afs_int32));
- kread(kmem, table, (char *)ptr, count * sizeof(afs_int32));
- for (i = 0, j = 0; i < count; i++) {
- if (pnt)
- printf("afs_dcnextTbl[%d]\t%d\n", i, ptr[i]);
- j++;
- }
- if (pnt)
- printf("afs_dcnextTbl has %d entries\n", j);
- free(ptr);
-}
-
-
-void
-print_DindexFlags(int pnt)
-{
- off_t symoff;
- afs_int32 count;
- long table;
- unsigned char *flags;
- afs_int32 temp, *indexTime = &temp;
- afs_int32 i, j;
-
- /* Handle the afs_indexFlags array */
- if (pnt)
- printf("\n\nPrinting afs_indexFlags[]...\n");
- findsym("afs_cacheFiles", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- findsym("afs_indexFlags", &symoff);
- kread(kmem, symoff, (char *)&table, sizeof(long));
- flags = malloc(count * sizeof(char));
- kread(kmem, table, flags, count * sizeof(char));
- for (i = 0, j = 0; i < count; i++) {
- if (pnt)
- printf("afs_indexFlags[%d]\t%4u\n", i, flags[i]);
- j++;
- }
- if (pnt)
- printf("afs_indexFlags has %d entries\n", j);
- free(flags);
-}
-
-
-void
-print_buffers(int pnt)
-{
- off_t symoff;
- long table;
- afs_int32 count;
- unsigned char *buffers;
- struct buffer *bp;
- afs_int32 i, j;
-
- if (pnt)
- printf("\n\nPrinting 'buffers' table...\n");
- findsym("Buffers", &symoff);
- kread(kmem, symoff, (char *)&table, sizeof(long));
- findsym("nbuffers", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof(int));
- buffers = malloc(count * sizeof(struct buffer));
- kread(kmem, table, buffers, count * sizeof(struct buffer));
- bp = (struct buffer *)buffers;
- for (i = 0, j = 0; i < count; i++, bp++) {
-#ifdef AFS_SGI62_ENV
- if (pnt)
- printf
- ("Buffer #%d:\tfid=%llu page=%d, accTime=%d,\n\tHash=%x, data=%x, lockers=%x, dirty=%d, hashI=%d\n",
- i, bp->fid[0], bp->page, bp->accesstime, bp->hashNext,
- bp->data, bp->lockers, bp->dirty, bp->hashIndex);
-#else
- if (pnt)
- printf
- ("Buffer #%d:\tfid=%lu page=%d, accTime=%d,\n\tHash=%x, data=%x, lockers=%x, dirty=%d, hashI=%d\n",
- i, bp->fid, bp->page, bp->accesstime, bp->hashNext,
- bp->data, bp->lockers, bp->dirty, bp->hashIndex);
-#endif
- j++;
- }
- if (pnt)
- printf("\n\t ... that should be %d buffer entries\n", i);
-}
-
-
-int
-print_nfss(int pnt)
-{
- off_t symoff;
- struct afs_exporter *exp_entry, ex, *exp = &ex, *exp1;
- struct nfsclientpag *afs_nfspags[NNFSCLIENTS], e, *entry = &e, *ep;
- long i, j, cell;
-
- /* Handle the afs_exporter structures */
- if (pnt)
- printf("\n\nPrinting 'afs_exporters' link list...\n");
- findsym("root_exported", &symoff);
- kread(kmem, symoff, (char *)&cell, sizeof(long));
- for (exp1 = (struct afs_exporter *)cell, j = 0; exp1;
- exp1 = exp->exp_next, j++) {
- kread(kmem, (off_t) exp1, (char *)exp, sizeof *exp);
- if (pnt)
- printf("AFS_EXPORTER(%x): \n", exp1);
- print_exporter(kmem, exp, exp1, pnt);
- Sum_exps++;
- }
- if (pnt)
- printf("... found %d 'afs_exporters' entries\n", j);
-
- /* Handle the afs_nfsclientpags structs */
- if (pnt)
- printf("\n\nPrinting 'afs_nfsclientpags' structures...\n");
- if (!findsym("afs_nfspags", &symoff))
- return 0;
- kread(kmem, symoff, (char *)afs_nfspags, sizeof afs_nfspags);
- for (i = 0, j = 0; i < NNFSCLIENTS; i++) {
- for (ep = afs_nfspags[i]; ep; ep = entry->next, j++) {
- kread(kmem, (off_t) ep, (char *)entry, sizeof *entry);
- print_nfsclient(kmem, entry, ep, pnt);
- }
- }
- if (pnt)
- printf("... found %d 'afs_nfsclientpags' entries\n", j);
- return j;
-}
-
-#if defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV)
-typedef struct event {
- struct event *next; /* next in hash chain */
- char *event; /* lwp event: an address */
- int refcount; /* Is it in use? */
- kcondvar_t cond; /* Currently associated condition variable */
- int seq; /* Sequence number: this is incremented
- * by wakeup calls; wait will not return until
- * it changes */
-} event_t;
-#endif
-
-
-#ifdef AFS_LINUX22_ENV
-/* This is replicated from LINUX/osi_alloc.c */
-#define MEM_SPACE sizeof(int)
-
-#define KM_TYPE 1
-#define VM_TYPE 2
-struct osi_linux_mem {
- int mem_next; /* types are or'd into low bits of next */
- char data[1];
-};
-#define MEMTYPE(A) ((A) & 0x3)
-#define MEMADDR(A) ((struct osi_linux_mem*)((A) & (~0x3)))
-#define PR_MEMTYPE(A) ((MEMTYPE(A) == KM_TYPE) ? "phys" : "virt")
-void
-print_alloced_memlist(void)
-{
- off_t symoff;
- struct osi_linux_mem *memp, memlist, next;
- off_t next_addr;
- int count;
- int n = 0;
-
- findsym("afs_linux_memlist_size", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- findsym("afs_linux_memlist", &symoff);
- kread(kmem, symoff, (char *)&memp, sizeof memp);
- if (memp) {
-#ifdef AFS_LINUX_64BIT_KERNEL
- kread(kmem, (unsigned long)memp, (char *)&next, sizeof next);
-#else
- kread(kmem, (int)memp, (char *)&next, sizeof next);
-#endif /* AFS_LINUX_64BIT_KERNEL */
- } else {
- memset(&next, 0, sizeof next);
- }
- printf("Allocated memory list: %d elements\n", count);
- printf("%20s %4s %10s\n", "Address", "Type", "Next");
- printf("%20lx %4s %10x\n", (long)((char *)memp) + MEM_SPACE,
- PR_MEMTYPE(next.mem_next), next.mem_next);
- n = 1;
- while (next_addr = (off_t) MEMADDR(next.mem_next)) {
- n++;
- memlist = next;
- kread(kmem, next_addr, (char *)&next, sizeof next);
- printf("%20lx %4s %10x\n", (long)next_addr + MEM_SPACE,
- PR_MEMTYPE(next.mem_next), next.mem_next);
- }
- printf("Found %d elements in allocated memory list, expected %d\n", n,
- count);
-}
-#endif
-
-void
-print_allocs(int pnt)
-{
- off_t symoff;
- long count, i, j, k, l, m, n, T = 0, tvs;
- struct afs_CMStats afs_cmstats;
- struct afs_stats_CMPerf afs_cmperfstats;
-
- findsym("afs_cmstats", &symoff);
- kread(kmem, symoff, (char *)&afs_cmstats, sizeof afs_cmstats);
- findsym("afs_stats_cmperf", &symoff);
- kread(kmem, symoff, (char *)&afs_cmperfstats, sizeof afs_cmperfstats);
-
- T += MAXSYSNAME;
- printf("\n\n%20s:\t%8d bytes\n", "Sysname area", MAXSYSNAME);
-
- Sum_cellnames = 0;
- i = print_cells(0);
- j = (i * sizeof(struct cell)) + Sum_cellnames;
- T += j;
- printf
- ("%20s:\t%8d bytes\t[%d cells/%d bytes each + %d bytes for cell names]\n",
- "Cell package", j, i, sizeof(struct cell), Sum_cellnames);
-
- Sum_cellaliases = 0;
- i = print_cellaliases(0);
- j = (i * sizeof(struct cell_alias)) + Sum_cellaliases;
- T += j;
- printf
- ("%20s:\t%8d bytes\t[%d cell_aliases/%d bytes each + %d bytes for cell names]\n",
- "Cell package", j, i, sizeof(struct cell_alias), Sum_cellaliases);
-
- Sum_cellname_names = 0;
- i = print_cellnames(0);
- j = (i * sizeof(struct cell_name)) + Sum_cellname_names;
- T += j;
- printf
- ("%20s:\t%8d bytes\t[%d cell_names/%d bytes each + %d bytes for cell name strings]\n",
- "Cell package", j, i, sizeof(struct cell_name), Sum_cellname_names);
-
- Sum_userstp = 0;
- i = print_users(0);
- j = (i * sizeof(struct unixuser)) + Sum_userstp;
- T += j;
- printf
- ("%20s:\t%8d bytes\t[%d users/%d bytes each + %d bytes for secret tokens]\n",
- "User package", j, i, sizeof(struct unixuser), Sum_userstp);
-
- i = print_servers(0);
- j = (i * sizeof(struct server));
- T += j;
- printf("%20s:\t%8d bytes\t[%d servers/%d bytes each]\n", "Server package",
- j, i, sizeof(struct server));
- j = (Nconns * sizeof(struct afs_conn));
- T += j;
- printf("%20s:\t%8d bytes\t[%d conns/%d bytes each]\n",
- "Connection package", j, Nconns, sizeof(struct afs_conn));
-
- i = (AFS_NCBRS * sizeof(struct afs_cbr)) * (j =
- afs_cmperfstats.
- CallBackAlloced);
- T += i;
- if (i)
- printf("%20s:\t%8d bytes\t[%d cbs/%d bytes each]\n",
- "Server CB free pool", i, (j * AFS_NCBRS),
- sizeof(struct afs_cbr));
-
- Sum_volnames = 0;
- i = print_volumes(0);
- j = (MAXVOLS * sizeof(struct volume)) + Sum_volnames;
- T += j;
- printf
- ("%20s:\t%8d bytes\t[%d volumes/%d bytes each + %d bytes for volnames - %d active entries]\n",
- "Volume package", j, MAXVOLS, sizeof(struct volume), Sum_volnames,
- i);
-
- Sum_vcachemvids = Sum_vcachelinkData = Sum_vcacheacc = Sum_vcachelocks =
- 0;
- tvs = i = print_vcaches(0);
- j = (i * sizeof(struct vcache));
-/* T += j;*/
-/* printf("%20s:\t%d bytes\t[%d vcaches/%d bytes each]\n", "Vcache package", j, i, sizeof(struct vcache));*/
-#ifdef AFS_AIX32_ENV
- i = (tvs + Sum_vcachemvids + Sum_vcachelinkData +
- Sum_vcachelocks) * AFS_SMALLOCSIZ;
- printf
- ("%20s:\t%8d bytes\t[%d act gnodes, %d mount pnts, %d symbolic links, %d unix locks]\n",
- "[VC use of sml fp]*", i, tvs, Sum_vcachemvids, Sum_vcachelinkData,
- Sum_vcachelocks);
-#else
- i = (Sum_vcachemvids + Sum_vcachelinkData +
- Sum_vcachelocks) * AFS_SMALLOCSIZ;
- printf
- ("%20s:\t8%d bytes\t[%d mount pnts, %d symbolic links, %d unix locks]\n",
- "[VC use of sml fp]*", i, Sum_vcachemvids, Sum_vcachelinkData,
- Sum_vcachelocks);
-#endif
-
-#define NAXSs (1000 / sizeof(struct axscache))
-#ifdef AFS32
- i = (NAXSs * sizeof(struct axscache));
- T += i;
- printf("%20s:\t%8d bytes\t[%d access used by vcaches/%d bytes each]\n",
- "ACL List free pool", i, Sum_vcacheacc, sizeof(struct axscache));
-#else
- {
- struct axscache *xp, xpe, *nxp = &xpe;
-
- findsym("afs_xaxscnt", &symoff);
- kread(kmem, symoff, (char *)&i, sizeof i);
- j = i * (NAXSs * sizeof(struct axscache));
- T += j;
- printf
- ("%20s:\t%8d bytes\t[%d access used by vcaches/%d bytes each - %d blocks of %d]\n",
- "ACL List free pool", j, Sum_vcacheacc, sizeof(struct axscache),
- i, (NAXSs * sizeof(struct axscache)));
- }
-#endif
-
-#ifdef AFS32
- i = print_dcaches(0);
- j = (i * sizeof(struct dcache));
- T += j;
- printf
- ("%20s:\t%8d bytes\t[%d dcaches/%d bytes each - ONLY USED COUNTED]\n",
- "Dcache package", j, i, sizeof(struct dcache));
-#else
- findsym("afs_dcentries", &symoff);
- kread(kmem, symoff, (char *)&i, sizeof i);
- j = (i * sizeof(struct dcache));
- T += j;
- printf("%20s:\t%8d bytes\t[%d dcaches/%d bytes each]\n", "Dcache package",
- j, i, sizeof(struct dcache));
-#endif
- findsym("afs_cacheFiles", &symoff);
- kread(kmem, symoff, (char *)&i, sizeof i);
- findsym("afs_cacheStats", &symoff);
- kread(kmem, symoff, (char *)&j, sizeof j);
-
- k = (j * sizeof(struct vcache));
- printf
- ("%20s:\t%8d bytes\t[%d free vcaches/%d bytes each - %d active entries]\n",
- "Vcache free list", k, j, sizeof(struct vcache), tvs);
- printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
- "Dcache Index Table", i * 4, i, 4);
-#ifndef AFS32
- printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
- "Dcache Index Times", i * 8, i, 8);
-#else
- printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
- "Dcache Index Times", i * 4, i, 4);
-#endif
- printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
- "Dcache Index Flags", i, i, 1);
-/* printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n", "Dcache free list", i, i, 1);*/
-#ifndef AFS32
- T += k + (i * 4) + (i * 8) + i;
-#else
- T += k + (i * 4) + (i * 4) + i;
-#endif
-
- i = (j = afs_cmperfstats.bufAlloced) * sizeof(struct buffer);
- T += i;
- printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n", "Buffer package",
- i, j, sizeof(struct buffer));
-#define AFS_BUFFER_PAGESIZE 2048
- i = j * AFS_BUFFER_PAGESIZE;
- T += i;
- printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
- "Xtra Buffer pkg area", i, j, AFS_BUFFER_PAGESIZE);
-
- Sum_exps = 0;
- Sum_nfssysnames = 0;
- i = print_nfss(0);
- k = Sum_exps * sizeof(struct afs_exporter);
- T += k;
- if (k)
- printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
- "Xlator Exporter list", k, Sum_exps,
- sizeof(struct afs_exporter));
-
- j = (i * sizeof(struct nfsclientpag)) + Sum_nfssysnames;
- T += j;
- if (j)
- printf
- ("%20s:\t%8d bytes\t[%d entries/%d bytes each + %d for remote sysnames]\n",
- "Xlator Nfs clnt pkg", j, i, sizeof(struct nfsclientpag),
- Sum_nfssysnames);
-
- i = (j = afs_cmperfstats.LargeBlocksAlloced) * AFS_LRALLOCSIZ;
- T += i;
- printf
- ("%20s:\t%8d bytes\t[%d entries/%d bytes each - %d active entries]\n",
- "Large Free Pool", i, j, AFS_LRALLOCSIZ,
- afs_cmperfstats.LargeBlocksActive);
-
- i = (j = afs_cmperfstats.SmallBlocksAlloced) * AFS_SMALLOCSIZ;
- T += i;
- printf
- ("%20s:\t%8d bytes\t[%d entries/%d bytes each - %d active entries]\n",
- "Small Free Pool", i, j, AFS_SMALLOCSIZ,
- afs_cmperfstats.SmallBlocksActive);
-
-#if defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV)
- findsym("afs_evhashcnt", &symoff);
- kread(kmem, symoff, (char *)&j, sizeof j);
- i = (j * sizeof(event_t));
- T += i;
- printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
- "afs glock Event Pool", i, j, sizeof(event_t));
-/* printf("XXXXXXX Count event queue allocs!!!! XXXXXX\n");*/
-
-#endif
- i = j = 0;
- if (findsym("rxevent_nFree", &symoff))
- kread(kmem, symoff, (char *)&j, sizeof j);
- if (findsym("rxevent_nPosted", &symoff))
- kread(kmem, symoff, (char *)&i, sizeof i);
- k = (i + j) * sizeof(struct rxevent);
- if (k) {
- T += k;
- printf("%20s:\t%8d bytes\t[%d free, %d posted/%d bytes each]\n",
- "Rx event pkg", k, j, i, sizeof(struct rxevent));
- } else {
- T += (k = 20 * sizeof(struct rxevent));
- printf
- ("%20s:\t%8d bytes\t[%d entries/%d bytes each - THIS IS MIN ALLOC/NOT ACTUAL]\n",
- "Rx event pkg", k, 20, sizeof(struct rxevent));
- }
-
- findsym("rx_nFreePackets", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-/*
- findsym("rx_initSendWindow", &symoff);
- kread(kmem, symoff, (char *) &i, sizeof i);
-*/
- i = 0;
- findsym("rx_nPackets", &symoff);
- kread(kmem, symoff, (char *)&j, sizeof j);
- k = (j + i + 2) * sizeof(struct rx_packet);
- T += k;
- printf("%20s:\t%8d bytes\t[%d free packets/%d bytes each]\n",
- "Rx packet freelist", k, count, sizeof(struct rx_packet));
-#define rx_hashTableSize 256 /* XXX */
- i = (rx_hashTableSize * sizeof(struct rx_connection *));
- j = (rx_hashTableSize * sizeof(struct rx_peer *));
- k = i + j;
- T += k;
- printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
- "Rx conn/peer tables", k, rx_hashTableSize,
- sizeof(struct rx_connection *));
-
- findsym("rxi_Alloccnt", &symoff);
- kread(kmem, symoff, (char *)&j, sizeof j);
- findsym("rxi_Allocsize", &symoff);
- kread(kmem, symoff, (char *)&i, sizeof i);
- T += i;
- printf("%20s:\t%8d bytes\t[%d outstanding allocs]\n", "RX misc allocs", i,
- j);
-
-
- j = afs_cmperfstats.OutStandingMemUsage;
- printf("\n\n%20s:\t%8d bytes\n", "Mem used by afs", j);
- printf("%20s:\t%8d bytes\n", "Accounted-for mem", T);
- printf("%20s:\t%8d bytes\n", "Non acc'd-for mem", j - T);
-
- printf
- ("\n\nNOTE:\n\tAll [...]* entries above aren't counted towards the total mem since they're redundant\n");
-
-#ifdef AFS_LINUX22_ENV
- if (pnt)
- print_alloced_memlist();
-#endif
-}
-
-#if defined(sparc) && !defined(__linux__)
-int
-readmem(kmem, buf, vad, len)
- int kmem, len;
-#ifdef AFS_SUN5_ENV
- uintptr_t vad;
-#else
- int vad;
-#endif /** AFS_SUN5_ENV **/
- char *buf;
-{
- int newlen;
- if ((newlen = kvm_kread(kd, vad, buf, len)) != len) {
- printf("Couldn't process dumpfile with supplied namelist %s\n", obj);
- exit(1);
- }
-}
-#endif
-
-#ifndef AFS_KDUMP_LIB
-void
-kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len)
-{
- int i;
-
- memset(buf, 0, len);
-
-#if defined(sparc) && !defined(__linux__)
-#ifndef AFS_SUN5_ENV
- if (mem) {
-#endif
- readmem(kmem, buf, (off_t) loc, len);
- return;
-#ifndef AFS_SUN5_ENV
- }
-#endif
-#endif
-#if ! defined(AFS_SUN5_ENV)
-#if defined(AFS_SGI61_ENV) && !defined(AFS_32BIT_KERNEL_ENV)
- if (lseek64(kmem, loc, L_SET /*0 */ ) != loc)
-#else
- if (lseek(kmem, loc, L_SET /*0 */ ) != loc)
-#endif
- {
- perror("lseek");
- exit(1);
- }
- if (loc == 0)
- printf("WARNING: Read failed: loc=0\n");
- else
- if ((i = read(kmem, buf, len)) != len) {
- printf("WARNING: Read failed: ");
- if (sizeof(loc) > sizeof(long)) {
- printf("loc=%llx", loc);
- } else {
- printf("loc=%lx", (long)loc);
- }
- printf(", buf=%lx, len=%ld, i=%d, errno=%d\n", (long)buf,
- (long)len, i, errno);
- return; /*exit(1); */
- }
-#endif
-}
-#endif /* AFS_KDUMP_LIB */
-
-#ifdef AFS_SUN5_ENV
-
-/**
- * When examining the dump of a 64 bit kernel, we use this function to
- * read symbols. The function opencore() calls this or rdsymbols() using
- * the macro RDSYMBOLS
- */
-
-void
-rdsymbols(void)
-{
-
- FILE *fp;
- Elf *efd;
- Elf_Scn *cn = NULL;
-#ifdef _LP64
- Elf64_Shdr *shdr;
- Elf64_Sym *stbl, *p1, *p2;
- Elf64_Shdr *(*elf_getshdr) (Elf_Scn *) = elf64_getshdr;
-#else
- Elf32_Shdr *shdr;
- Elf32_Sym *stbl, *p1, *p2;
- Elf32_Shdr *(*elf_getshdr) (Elf_Scn *) = elf32_getshdr;
-#endif
- Elf_Data *dp = NULL, *sdp = NULL;
-
- int nsyms, i, fd;
-
- if (!(fp = fopen(obj, "r"))) {
- printf("Can't open %s (%d)\n", core, errno);
- exit(1);
- }
-
- fd = fileno(fp);
- lseek(fd, 0L, 0);
- if ((efd = elf_begin(fd, ELF_C_READ, 0)) == NULL) {
- printf("Can't elf begin (%d)\n", errno);
- exit(1);
- }
- while (cn = elf_nextscn(efd, cn)) {
- if ((shdr = elf_getshdr(cn)) == NULL) {
- elf_end(efd);
- printf("Can't read section header (%d)\n", errno);
- exit(1);
- }
- if (shdr->sh_type == SHT_SYMTAB)
- break;
- }
- dp = elf_getdata(cn, dp);
- p1 = stbl = (void *)dp->d_buf;
- nsyms = dp->d_size / sizeof(*stbl);
- cn = elf_getscn(efd, shdr->sh_link);
- sdp = elf_getdata(cn, sdp);
- tblp = malloc(sdp->d_size);
- memcpy(tblp, sdp->d_buf, sdp->d_size);
- p2 = tbl = malloc(nsyms * sizeof(*stbl));
- for (i = 0, scnt = 0; i < nsyms; i++, p1++, p2++) {
- p2->st_name = p1->st_name;
- p2->st_value = p1->st_value;
- p2->st_size = p1->st_size;
- p2->st_info = p1->st_info;
- p2->st_shndx = p1->st_shndx;
- scnt++;
- }
- elf_end(efd);
- close(fd);
-}
-
-#endif /** AFS_SUN5_ENV **/
-
-
-int
-opencore(char *core)
-{
-#ifdef AFS_KDUMP_LIB
- return 0;
-#else /* AFS_KDUMP_LIB */
- int fd;
-
-#if defined(sparc) && !defined(__linux__)
-#ifndef AFS_SUN5_ENV
- if (mem) {
-#endif
-
- if ((kd = kvm_open(obj, core, NULL, O_RDONLY, "crash")) == NULL) {
- printf("Can't open kvm - core file %s\n", core);
- exit(1);
- }
-#ifndef AFS_SUN5_ENV
- } else
-#endif
-#ifdef AFS_SUN5_ENV
- rdsymbols();
-#endif
-#endif /* sparc */
-
- {
- if ((fd = open(core, O_RDONLY)) < 0) {
- perror(core);
- exit(1);
- }
- return fd;
- }
-#endif /* AFS_KDUMP_LIB */
-}
-
-
-void
-print_exporter(int kmem, struct afs_exporter *exporter,
- struct afs_exporter *ptr, int pnt)
-{
- if (pnt) {
- printf("\tstates=%x, type=%x, *data=%lx\n", exporter->exp_states,
- exporter->exp_type, exporter->exp_data);
- printf
- ("\texp_stats (calls=%d, rejectedcalls=%d, nopag=%d, invalidpag=%d)\n",
- exporter->exp_stats.calls, exporter->exp_stats.rejectedcalls,
- exporter->exp_stats.nopag, exporter->exp_stats.invalidpag);
- }
-}
-
-
-void
-print_nfsclient(int kmem, struct nfsclientpag *ep,
- struct nfsclientpag *ptr, int pnt)
-{
- char sysname[100];
- int count;
-
- if (pnt)
- printf("%lx: uid=%d, host=%x, pag=%x, lastt=%d, ref=%d count=%d\n",
- ptr, ep->uid, ep->host, ep->pag,
- ep->lastcall, ep->refCount, ep->sysnamecount);
-
- for(count = 0; count < ep->sysnamecount; count++){
- kread(kmem, (off_t) ep->sysname[count], sysname, (KDUMP_SIZE_T) 30);
- printf(" %lx: @sys[%d]=%s\n",
- ep->sysname[count], count, sysname);
- Sum_nfssysnames += MAXSYSNAME;
- }
-}
-
-
-#if defined(AFS_SUN5_ENV)
-void
-pmutex(char *sp, kmutex_t *mp)
-{
-}
-
-#endif
-
-void
-print_unixuser(int kmem, struct unixuser *uep,
- struct unixuser *ptr, int pnt)
-{
- Sum_userstp += uep->stLen;
- if (pnt) {
- printf
- ("%lx: uid=x%x, cell=%x, vid=%d, refc=%d, states=%x, tokTime=%d, tikLen=%d\n",
- ptr, uep->uid, uep->cell, uep->vid, uep->refCount, uep->states,
- uep->tokenTime, uep->stLen);
- printf
- ("\tstp=%lx, clearTok[Han=x%x, x<%x,%x,%x,%x,%x,%x,%x,%x>, vid=%d, Bt=%d, Et=%d], exporter=%lx\n",
- uep->stp, uep->ct.AuthHandle, uep->ct.HandShakeKey[0],
- uep->ct.HandShakeKey[1], uep->ct.HandShakeKey[2],
- uep->ct.HandShakeKey[3], uep->ct.HandShakeKey[4],
- uep->ct.HandShakeKey[5], uep->ct.HandShakeKey[6],
- uep->ct.HandShakeKey[7], uep->ct.ViceId, uep->ct.BeginTimestamp,
- uep->ct.EndTimestamp, uep->exporter);
- }
-}
-
-void
-print_cell(int kmem, struct cell *clep, struct cell *ptr, int pnt)
-{
- int i;
- char cellName[100];
- struct in_addr in;
-
-
- kread(kmem, (off_t) clep->cellName, cellName, (KDUMP_SIZE_T) 40);
- cellName[40] = 0;
- Sum_cellnames += strlen(cellName) + 1;
- if (pnt) {
- printf
- ("%lx: cellname=%s, states=%x, cnum=%d, cindex=%d fsport=%d vlport=%d timeout=%d cnamep=%x\n",
- ptr, cellName, clep->states, clep->cellNum, clep->cellIndex,
- clep->fsport, clep->vlport, clep->timeout, clep->cnamep);
-#ifdef AFS33
- if (clep->lcellp)
- printf("\tlinked cellp %lx\n", clep->lcellp);
-#endif
- printf("\tCell's servers: ");
- for (i = 0; i < AFS_MAXCELLHOSTS; i++) {
- if (pretty && (clep->cellHosts[i] == 0))
- break;
- printf("[%lx] ", clep->cellHosts[i]);
- }
- printf("\n");
- }
-}
-
-
-void
-print_server(int kmem, struct server *sep, struct server *ptr, int conns,
- int pnt)
-{
- struct srvAddr sa, *sap = &sa, *sap1;
- int j, mh = 0, cnt;
-
- if (conns != 2 && pnt) {
- printf
- ("%lx: cell=%lx, addr=%lx, flags=0x%x, actTime=%x, lastDownS=%x, numDownIn=%d, sumofDownt=%d\n",
- ptr, sep->cell, sep->addr, sep->flags, sep->activationTime,
- sep->lastDowntimeStart, sep->numDowntimeIncidents,
- sep->sumOfDowntimes);
- if (sep->flags & SRVR_MULTIHOMED) {
- if (pnt) {
- printf
- ("\tuuid=[%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x] addr_uniquifier=%x\n",
- sep->sr_uuid.time_low, sep->sr_uuid.time_mid,
- sep->sr_uuid.time_hi_and_version,
- sep->sr_uuid.clock_seq_hi_and_reserved,
- sep->sr_uuid.clock_seq_low, sep->sr_uuid.node[0],
- sep->sr_uuid.node[1], sep->sr_uuid.node[2],
- sep->sr_uuid.node[3], sep->sr_uuid.node[4],
- sep->sr_uuid.node[5], sep->sr_addr_uniquifier);
- }
- mh = 1;
- }
- for (j = 0, cnt = 1, sap1 = sep->addr; sap1;
- sap1 = sap->next_sa, j++, cnt++) {
- kread(kmem, (off_t) sap1, (char *)sap, sizeof(*sap));
- if (pnt) {
- if (mh) {
- printf
- ("\t #%d ip-addr(%lx): [sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, next_bkt=%lx]\n",
- cnt, sap1, PrintIPAddr(sap->sa_ip), sap->sa_portal,
- sap->sa_iprank, sap->sa_flags, sap->conns,
- sap->server, sap->next_bkt);
- } else {
- printf
- ("\t[sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, nexth=%lx]\n",
- PrintIPAddr(sap->sa_ip), sap->sa_portal,
- sap->sa_iprank, sap->sa_flags, sap->conns,
- sap->server, sap->next_bkt);
- }
- }
- }
- }
- if (sep->cbrs && pnt) {
- struct afs_cbr cba, *cbsap = &cba, *cbsap1;
-
- printf(" Callbacks to be returned:\n");
- for (j = 0, cbsap1 = sep->cbrs; cbsap1; cbsap1 = cbsap->next, j++) {
- kread(kmem, (off_t) cbsap1, (char *)cbsap, sizeof(*cbsap));
- printf(" #%2d) %lx [v=%d, n=%d, u=%d]\n", j, cbsap1,
- cbsap->fid.Volume, cbsap->fid.Vnode, cbsap->fid.Unique);
- }
- }
- if (conns) {
- for (j = 0, sap1 = sep->addr; sap1; sap1 = sap->next_sa, j++) {
- kread(kmem, (off_t) sap1, (char *)sap, sizeof(*sap));
- print_conns(kmem, sap1, sap->conns, conns, pnt);
- }
- } else if (pnt)
- printf("\n");
-}
-
-
-void
-print_conns(int kmem, struct srvAddr *srv, struct afs_conn *conns, int Con,
- int pnt)
-{
- struct afs_conn *cep, ce, *centry = &ce;
- int i = 1;
-
- cep = (struct afs_conn *)conns;
- if (pnt && Con != 2) {
- if (cep)
- printf("\tRPC connections for server %lx:\n", srv);
- else
- printf("\tNO RPC connections for server %x\n", srv);
- }
- for (; cep; cep = centry->next, Nconns++, i++) {
- if (pnt && Con != 2)
- printf("\t #%d> ", i);
- kread(kmem, (off_t) cep, (char *)centry, sizeof *centry);
- print_conn(kmem, centry, cep, pnt);
- }
-}
-
-
-void
-print_conn(int kmem, struct afs_conn *conns, struct afs_conn *ptr, int pnt)
-{
- if (!pnt)
- return;
- printf("%lx: user=%lx, rx=%lx, srvr=%lx, ref=%d, port=%d, forceC=%d\n",
- ptr, conns->user, conns->id, conns->srvr, conns->refCount,
- conns->port, conns->forceConnectFS);
-
-}
-
-
-void
-print_volume(int kmem, struct volume *vep, struct volume *ptr, int pnt)
-{
- int i;
- afs_int32 *loc;
- char Volname[100];
-
-
-
- loc = (afs_int32 *) & vep->lock;
- if (vep->name) {
- kread(kmem, (off_t) vep->name, Volname, (KDUMP_SIZE_T) 40);
- Sum_volnames += strlen(Volname) + 1;
- }
- if (!pnt)
- return;
- printf("%lx: cell=%x, vol=%d, name=%s, roVol=%d, backVol=%d\n", ptr,
- vep->cell, vep->volume, (vep->name ? Volname : "nil"), vep->roVol,
- vep->backVol);
-#ifdef AFS33
- printf
- ("\trwVol=%d, setupTime=%d, copyDate=%d, expTime=%d, vtix=%d, refC=%d, states=%x\n",
- vep->rwVol, vep->setupTime, vep->copyDate, vep->expireTime,
- vep->vtix, vep->refCount, vep->states);
-#else
- printf
- ("\trwVol=%d, setupTime=%d, copyDate=%d, vtix=%d, refC=%d, states=%x\n",
- vep->rwVol, vep->setupTime, vep->copyDate, vep->vtix, vep->refCount,
- vep->states);
-#endif
- printf("\tVolume's statuses: ");
- for (i = 0; i < AFS_MAXHOSTS && vep->serverHost[i]; i++)
- printf("[%d] ", vep->status[i]);
- printf("\n");
-
- printf("\tVolume's servers: ");
- for (i = 0; i < AFS_MAXHOSTS && vep->serverHost[i]; i++)
- printf("[%lx] ", vep->serverHost[i]);
- printf("\n");
-
- print_venusfid("\tdotdot", &vep->dotdot);
- printf("\n");
-
- print_venusfid("\tmtpnt", &vep->mtpoint);
- printf("\n");
-
-#ifdef AFS33
- if (vep->rootVnode)
- printf("\trootVnode = %d, rootUnique = %d\n", vep->rootVnode,
- vep->rootUnique);
-#endif
- printf("\tlock=0x%x\n", *loc);
-}
-
-
-void
-print_venusfid(char *string, struct VenusFid *vid)
-{
- printf("%s(c=%x, v=%d, n=%d, u=%d)", string, vid->Cell, vid->Fid.Volume,
- vid->Fid.Vnode, vid->Fid.Unique);
-}
-
-
-void
-print_vnode(int kmem, struct vnode *vep, struct vnode *ptr, int pnt)
-{
-#ifdef AFS_AIX_ENV
- struct gnode gnode;
- struct gnode *save_gnode;
-#endif /* AFS_AIX_ENV */
-
- if (!pnt)
- return;
- printf("\n");
-#ifdef AFS_AIX_ENV
- save_gnode = vep->v_gnode;
- kread(kmem, (off_t) save_gnode, (char *)&gnode, sizeof(struct gnode));
- vep->v_gnode = &gnode;
-#endif /* AFS_AIX_ENV */
-
-#ifdef AFS_SUN5_ENV
- printf("%x: v_type=%d, v_flag=%d, v_count=%d, \n", ptr, vep->v_type,
- vep->v_flag, vep->v_count);
- printf
- ("\tv_v_stream=%x, v_pages=0x%x, v_mountdhere=%d, v_rdev=%d, v_vfsp=0x%x, v_filocks=0x%x\n",
- vep->v_stream, vep->v_pages, vep->v_vfsmountedhere, vep->v_rdev,
- vep->v_vfsp, vep->v_filocks);
- pmutex("\tVnode", &vep->v_lock);
- printf("\tCond v: 0x%x\n", vep->v_cv);
-#endif
-#ifdef AFS_AIX_ENV
- vep->v_gnode = save_gnode;
-#endif /* AFS_AIX_ENV */
-#ifdef AFS_SGI65_ENV
-#if defined(AFS_32BIT_KERNEL_ENV)
- printf("%lx: v_mreg=0x%lx", ptr, vep->v_mreg);
-#else
- printf("%llx: v_mreg=0x%llx", ptr, vep->v_mreg);
-#endif
- printf(", v_mregb=0x%lx\n", vep->v_mregb);
-#endif
-#ifdef AFS_LINUX22_ENV
- /* Print out the stat cache and other inode info. */
- printf
- ("\ti_ino=%d, i_mode=%x, i_nlink=%d, i_uid=%d, i_gid=%d, i_size=%d\n",
- vep->i_ino, vep->i_mode, vep->i_nlink, vep->i_uid, vep->i_gid,
- vep->i_size);
-#ifdef AFS_LINUX24_ENV
- printf
- ("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n",
- vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version,
- vep->i_data.nrpages);
-#else
- printf
- ("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n",
- vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version,
- vep->i_nrpages);
-#endif
-#ifdef AFS_LINUX26_ENV
- printf("\ti_op=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op,
- vep->i_rdev, vep->i_sb);
-#else /* AFS_LINUX26_ENV */
- printf("\ti_op=0x%x, i_dev=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op,
- vep->i_dev, vep->i_rdev, vep->i_sb);
-#endif /* AFS_LINUX26_ENV */
-#ifdef AFS_LINUX24_ENV
- printf("\ti_sem: count=%d, sleepers=%d, wait=0x%x\n", vep->i_sem.count,
- vep->i_sem.sleepers, vep->i_sem.wait);
-#else
- printf("\ti_sem: count=%d, waking=%d, wait=0x%x\n", vep->i_sem.count,
- vep->i_sem.waking, vep->i_sem.wait);
-#endif
-#ifdef AFS_LINUX26_ENV
- printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n",
- vep->i_hash.pprev, vep->i_hash.next, vep->i_list.prev,
- vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next);
-#else /* AFS_LINUX26_ENV */
- printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n",
- vep->i_hash.prev, vep->i_hash.next, vep->i_list.prev,
- vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next);
-#endif /* AFS_LINUX26_ENV */
-#endif /* AFS_LINUX22_ENV */
-}
-
-void
-print_vcache(int kmem, struct vcache *vep, struct vcache *ptr, int pnt)
-{
- long *loc, j = 0;
- char *cloc;
- struct VenusFid vid;
- struct axscache acc, *accp = &acc, *acp;
- struct SimpleLocks sl, *slcp = &sl, *slp;
- char linkchar;
-
- if (vep->mvid) {
- kread(kmem, (off_t) vep->mvid, (char *)&vid, sizeof(struct VenusFid));
- Sum_vcachemvids++;
- }
- if (vep->linkData)
- Sum_vcachelinkData++;
- loc = (long *)&vep->lock;
-
- if (pnt) {
- if (!Dvnodes)
- printf("\n");
-#ifdef AFS33
- printf("%lx: refC=%d, pv=%d, pu=%d, flushDv=%d.%d, mapDV=%d.%d, ",
- ptr, VREFCOUNT(vep), vep->parentVnode, vep->parentUnique,
- vep->flushDV.high, vep->flushDV.low, vep->mapDV.high,
- vep->mapDV.low);
-#ifdef AFS_64BIT_CLIENT
- printf
- ("truncPos=(0x%x, 0x%x),\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ",
- (int)(vep->truncPos >> 32), (int)(vep->truncPos & 0xffffffff),
- vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters);
-#else /* AFS_64BIT_CLIENT */
- printf("truncPos=%d,\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ",
- vep->truncPos, vep->callback, vep->cbExpires, vep->opens,
- vep->execsOrWriters);
-#endif /* AFS_64BIT_CLIENT */
- printf("flcnt=%d, mvstat=%d\n", vep->flockCount, vep->mvstat);
- printf("\tstates=x%x, ", vep->states);
-#ifdef AFS_SUN5_ENV
- printf("vstates=x%x, ", vep->vstates);
-#endif /* AFS_SUN5_ENV */
- printf("dchint=%x, anyA=0x%x\n", vep->dchint, vep->anyAccess);
-#ifdef AFS_64BIT_CLIENT
- printf
- ("\tmstat[len=(0x%x, 0x%x), DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n",
- (int)(vep->m.Length >> 32), (int)(vep->m.Length & 0xffffffff),
- vep->m.DataVersion.high, vep->m.DataVersion.low, vep->m.Date,
- vep->m.Owner, vep->m.Group, vep->m.Mode, vep->m.LinkCount);
-#else /* AFS_64BIT_CLIENT */
- printf("\tquick[dc=%x, stamp=%x, f=%x, min=%d, len=%d]\n",
- vep->quick.dc, vep->quick.stamp, vep->quick.f,
- vep->quick.minLoc, vep->quick.len);
- printf
- ("\tmstat[len=%d, DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n",
- vep->m.Length, vep->m.DataVersion.high, vep->m.DataVersion.low,
- vep->m.Date, vep->m.Owner, vep->m.Group, vep->m.Mode,
- vep->m.LinkCount);
-#endif /* AFS_64BIT_CLIENT */
-#else /* AFS33 */
- printf
- ("%x: refC=%d, pv=%d, pu=%d, flushDv=%d, mapDV=%d, truncPos=%d\n",
- ptr, vep->vrefCount, vep->parentVnode, vep->parentUnique,
- vep->flushDV, vep->mapDV, vep->truncPos);
- printf("\tcallb=x%x, cbE=%d, opens=%d, XoW=%d, flcnt=%d, mvstat=%d\n",
- vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters,
- vep->flockCount, vep->mvstat);
- printf("\tstates=x%x, dchint=%x, anyA=0x%x\n", vep->states,
- vep->h1.dchint, vep->anyAccess);
- printf
- ("\tmstat[len=%d, DV=%d, Date=%d, Owner=%d, Group=%d, Mode=%d, linkc=%d]\n",
- vep->m.Length, vep->m.DataVersion, vep->m.Date, vep->m.Owner,
- vep->m.Group, vep->m.Mode, vep->m.LinkCount);
-#endif /* AFS33 */
-#ifdef AFS_AIX32_ENV
- loc = (afs_int32 *) & vep->pvmlock;
- printf("\tpvmlock=x%x, segid=%X, credp=%lx\n", *loc, vep->segid,
- vep->credp);
-#endif
- printf
- ("\tlock [wait=%x excl=%x readers=%x #waiting=%x last_reader=%d writer=%d src=%d]\n",
- vep->lock.wait_states, vep->lock.excl_locked,
- vep->lock.readers_reading, vep->lock.num_waiting,
- vep->lock.pid_last_reader, vep->lock.pid_writer,
- vep->lock.src_indicator);
- print_venusfid("\tfid", &vep->fid);
- if (vep->mvid) {
- printf(" ");
- print_venusfid("mvid", &vid);
- }
- printf("\n");
- }
- if (vep->Access) {
- if (pnt)
- printf("\tAccess Link list: %x\n", vep->Access);
- for (j = 0, acp = vep->Access; acp; acp = accp->next, j++) {
- kread(kmem, (off_t) acp, (char *)accp, sizeof(*accp));
- Sum_vcacheacc++;
- if (pnt)
- printf("\t %lx: %d) uid=0x%x, access=0x%x, next=%lx\n", acp,
- j, accp->uid, accp->axess, accp->next);
- }
- }
- if (vep->slocks) {
- if (pnt)
- printf("\tLocking Link list: %lx\n", vep->slocks);
- }
-#ifdef AFS33
- if (pnt)
- printf("\tCallbacks queue prev= %lx next= %lx\n", vep->callsort.prev,
- vep->callsort.next);
-#endif
- printf("\tvlruq.prev=%lx, vlruq.next=%lx\n", vep->vlruq.prev,
- vep->vlruq.next);
-
- /* For defect 7733 - Print linkData field for symlinks */
- if (pnt) {
- if (vep->linkData) {
- cloc = (char *)vep->linkData;
- printf("\tSymlink information = '");
- while (1) {
- kread(kmem, (off_t) cloc, &linkchar, (KDUMP_SIZE_T) 1);
- cloc++;
- if (linkchar == '\0') {
- printf("'\n");
- break;
- } else {
- printf("%c", linkchar);
- }
- }
- }
- }
-#ifdef AFS_LINUX22_ENV
- printf("\tmapcnt=%d\n", vep->mapcnt);
-#endif
-}
-
-
-void
-print_dcache(int kmem, struct dcache *dcp, struct dcache *dp, int pnt)
-{
- if (!pnt)
- return;
- printf("%lx: ", dp);
- print_venusfid(" fid", &dcp->f.fid);
- printf("refcnt=%d, dflags=%x, mflags=%x, validPos=%d\n", dcp->refCount,
- dcp->dflags, dcp->mflags, dcp->validPos);
-
-#ifdef AFS33
- printf("\tf.modtime=%d, f.versNo=%d.%d\n", dcp->f.modTime,
- dcp->f.versionNo.high, dcp->f.versionNo.low);
-#else
- printf("\tf.hvn=%d, f.hcn=%d, f.modtime=%d, f.versNo=%d\n",
- dcp->f.hvNextp, dcp->f.hcNextp, dcp->f.modTime, dcp->f.versionNo);
-#endif
-#ifdef AFS_SGI62_ENV
- printf
- ("\tf.chunk=%d, f.inode=%" AFS_INT64_FMT ", f.chunkBytes=%d, f.states=%x",
- dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
-#else
- printf
- ("\tf.chunk=%d, f.inode=%d, f.chunkBytes=%d, f.states=%x\n",
- dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
-#endif
- printf("\tlruq.prev=%lx, lruq.next=%lx, index=%d\n",
- dcp->lruq.prev, dcp->lruq.next, dcp->index);
-}
-
-void
-print_bkg(int kmem)
-{
- off_t symoff;
- struct brequest afs_brs[NBRS], ue, *uentry = &ue, *uep;
- afs_int32 count, i, j;
- short scount;
-
- printf("\n\nPrinting some background daemon info...\n\n");
- findsym("afs_brsWaiters", &symoff);
- kread(kmem, symoff, (char *)&scount, sizeof scount);
- printf("Number of processes waiting for bkg daemon %d\n", scount);
- findsym("afs_brsDaemons", &symoff);
- kread(kmem, symoff, (char *)&scount, sizeof scount);
- printf("Number of free bkg daemons %d\n", scount);
- findsym("afs_brs", &symoff);
- kread(kmem, symoff, (char *)afs_brs, sizeof afs_brs);
- printf("Print the current bkg process table\n");
- for (i = 0, j = 0; i < NBRS; i++, j++) {
-/* kread(kmem, (off_t) afs_brs[i], (char *)uentry, sizeof *uentry);*/
- uentry = &afs_brs[i];
- if (uentry->refCount == 0)
- break;
- printf
- ("[%d] vcache=0x%lx, cred=0x%lx, code=%d, refCount=%d, opcode=%d, flags=%x [%lx, %lx, %lx, %lx]\n",
- i, uentry->vc, uentry->cred, uentry->code, uentry->refCount,
- uentry->opcode, uentry->flags, uentry->size_parm[0],
- uentry->size_parm[1], uentry->ptr_parm[0], uentry->ptr_parm[1]);
-
- }
- printf("... found %d active 'afs_brs' entries\n", j);
-}
-
-void
-print_vlru(int kmem)
-{
- off_t symoff;
- struct vcache Ve, *Ventry = &Ve, *Vep, *tvc;
- struct afs_q VLRU, vlru, *vu = &vlru, *tq, *uq;
- u_long vlru_addr, l1, l2, l3;
- afs_int32 count, i, j = 0, maxvcount, vcount, nvnode;
- short scount;
-
- printf("\n\nPrinting vcache VLRU info (oldest first)...\n\n");
- findsym("afs_cacheStats", &symoff);
- kread(kmem, symoff, (char *)&maxvcount, sizeof maxvcount);
- findsym("VLRU", &symoff);
- kread(kmem, symoff, (char *)&VLRU, sizeof VLRU);
- vlru_addr = (u_long) symoff;
- for (tq = VLRU.prev; (u_long) tq != vlru_addr; tq = uq) {
- tvc = QTOV(tq);
- kread(kmem, (off_t) tq, (char *)vu, sizeof VLRU);
- uq = vu->prev;
- kread(kmem, (off_t) tvc, (char *)Ventry, sizeof *Ventry);
- print_vcache(kmem, Ventry, tvc, 1);
- j++;
- }
- printf("... found %d active vcache entries in the VLRU\n", j);
-}
-
-void
-print_dlru(int kmem)
-{
- off_t symoff;
- struct dcache Ve, *Ventry = &Ve, *Vep, *tdc;
- struct afs_q DLRU, dlru, *vu = &dlru, *tq, *uq;
- u_long dlru_addr, l1, l2, l3;
- afs_int32 count, i, j = 0, maxvcount, vcount, nvnode;
- short scount;
-
- printf("\n\nPrinting vcache DLRU info...\n\n");
- findsym("afs_DLRU", &symoff);
- kread(kmem, symoff, (char *)&DLRU, sizeof DLRU);
- dlru_addr = (u_long) symoff;
- for (tq = DLRU.prev; (u_long) tq != dlru_addr; tq = uq) {
- tdc = (struct dcache *)tq;
- kread(kmem, (off_t) tq, (char *)vu, sizeof DLRU);
- uq = vu->prev;
- kread(kmem, (off_t) tdc, (char *)Ventry, sizeof *Ventry);
- print_dcache(kmem, Ventry, tdc, 1);
- j++;
- }
- printf("... found %d active dcache entries in the DLRU\n\n\n", j);
-
- findsym("afs_freeDSList", &symoff);
- kread(kmem, symoff, (char *)&dlru_addr, sizeof dlru_addr);
- printf("\tfreeDSList link list starts at 0x%x\n", dlru_addr);
- j = 0;
- for (tdc = (struct dcache *)dlru_addr; tdc;
- tdc = (struct dcache *)Ventry->lruq.next) {
- kread(kmem, (off_t) tdc, (char *)Ventry, sizeof *Ventry);
- print_dcache(kmem, Ventry, tdc, 1);
- j++;
-/* printf("%3d) %x\n", j, tdc);*/
- }
- printf("... found %d dcache entries in the freeDSList\n", j);
-}
-
-int
-print_gcpags(int pnt)
-{
- off_t symoff;
- afs_int32 afs_gcpags;
- afs_int32 afs_gcpags_procsize;
-
- if (pnt)
- printf("\n\nPrinting GCPAGS structures...\n");
-
- findsym("afs_gcpags", &symoff);
- kread(kmem, symoff, (char *)&afs_gcpags, sizeof afs_gcpags);
-
- findsym("afs_gcpags_procsize", &symoff);
- kread(kmem, symoff, (char *)&afs_gcpags_procsize,
- sizeof afs_gcpags_procsize);
-
- printf("afs_gcpags=%d\n", afs_gcpags);
- printf("afs_gcpags_procsize=%d\n", afs_gcpags_procsize);
-
- return 0;
-}
-
-
-#ifdef AFS_AIX_ENV
-#include <sys/syspest.h> /* to define the assert and ASSERT macros */
-#include <sys/timer.h> /* For the timer related defines */
-#include <sys/intr.h> /* for the serialization defines */
-#include <sys/malloc.h> /* for the parameters to xmalloc() */
-
-struct tos {
- struct tos *toprev; /* previous tos in callout table */
- struct tos *tonext; /* next tos in callout table */
- struct trb *trb; /* this timer request block */
- afs_int32 type;
- long p1;
-};
-
-struct callo {
- int ncallo; /* number of callout table elements */
- struct tos *head; /* callout table head element */
-};
-#endif
-
-void
-print_callout(int kmem)
-{
- off_t symoff;
-#ifndef AFS_AIX_ENV
- printf("\n\nCallout table doesn't exist for this system\n");
-#else
- struct callo Co, *Coe = &Co, *Cop;
- struct tos To, *Toe = &To, *tos;
- struct trb Trb, *Trbe = &Trb, *trb;
- int i = 0;
-
-
- printf("\n\nPrinting callout table info...\n\n");
- findsym("afs_callo", &symoff);
- kread(kmem, symoff, (char *)&Co, sizeof Co);
- printf("Number of callouts %d\n", Co.ncallo);
- if (Co.ncallo > 0) {
- printf("Count\tType\taddr\tfunc\tdata\n");
- for (tos = Co.head; tos != NULL; tos = Toe->tonext) {
- i++;
- kread(kmem, (off_t) tos, (char *)&To, sizeof To);
- kread(kmem, (off_t) Toe->trb, (char *)&Trb, sizeof Trb);
- printf("%d\t%d\t%x\t%x\t%x\n", i, Toe->type, Toe->p1, Trbe->tof,
- Trbe->func_data);
- }
- }
-#endif
-}
-
-void
-print_dnlc(int kmem)
-{
- struct nc *nameHash[256];
-
-}
-
-
-void
-print_global_locks(int kmem)
-{
- off_t symoff;
- afs_int32 count;
- int i;
- static struct {
- char *name;
- } locks[] = { {
- "afs_xvcache"}, {
- "afs_xdcache"}, {
- "afs_xserver"}, {
- "afs_xvcb"}, {
- "afs_xbrs"}, {
- "afs_xcell"}, {
- "afs_xconn"}, {
- "afs_xuser"}, {
- "afs_xvolume"},
-#ifndef AFS_AIX_ENV
- {
- "osi_fsplock"},
-#endif
- {
- "osi_flplock"}, {
- "afs_xcbhash"}, {
- "afs_xinterface"}, {
- 0},};
-
-
- printf("\n\nPrinting afs global locks...\n\n");
- for (i = 0; locks[i].name; i++) {
- findsym(locks[i].name, &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("%s = 0x%x\n", locks[i].name, count);
- }
-}
-
-
-void
-print_global_afs_resource(int kmem)
-{
- off_t symoff;
- char sysname[100];
- afs_int32 count;
- long addr;
-
- printf("\n\nPrinting some general resource related globals...\n\n");
- findsym("afs_setTimeHost", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_setTimeHost = 0x%x\n", count);
- findsym("afs_volCounter", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_volCounter = 0x%x\n", count);
- findsym("afs_cellindex", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_cellIndex = 0x%x\n", count);
- findsym("afs_marinerHost", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_marinerHost = 0x%x\n", count);
- findsym("afs_sysname", &symoff);
- kread(kmem, symoff, (char *)&addr, sizeof addr);
-#ifdef AFS_HPUX_ENV
- printf("\tafs_sysname = %d\n", addr);
-#else
- kread(kmem, (off_t) addr, sysname, (KDUMP_SIZE_T) 30);
- printf("\tafs_sysname = %s\n", sysname);
-#endif
-#ifdef AFS_SGI65_ENV
- findsym("afs_ipno", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tCPU BOARD = IP%d\n", count);
-#endif
-}
-
-
-void
-print_global_afs_cache(int kmem)
-{
- off_t symoff;
- char sysname[100];
- afs_int32 count;
-#ifdef AFS_SGI62_ENV
- ino64_t inode;
-#endif
-#ifndef AFS32
- afs_hyper_t h;
-#endif
-
- printf("\n\nPrinting some general cache related globals...\n\n");
- findsym("afs_mariner", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_mariner = 0x%x\n", count);
- findsym("freeVCList", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_freeVCList = 0x%x XXX\n", count);
- findsym("afs_freeDCList", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tfreeDCList = 0x%x\n", count);
- findsym("afs_freeDCCount", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tfreeDCCount = 0x%x (%d)\n", count, count);
- findsym("afs_discardDCList", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tdiscardDCList = 0x%x\n", count);
- findsym("afs_discardDCCount", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tdiscardDCCount = 0x%x (%d)\n", count, count);
- findsym("afs_freeDSList", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tfreeDSList= 0x%x XXXX\n", count);
-#ifdef AFS_SGI62_ENV
- findsym("cacheInode", &symoff);
- kread(kmem, symoff, (char *)&inode, sizeof inode);
- printf("\tcacheInode = 0x%llx (%" AFS_INT64_FMT ")\n", inode, inode);
- findsym("volumeInode", &symoff);
- kread(kmem, symoff, (char *)&inode, sizeof inode);
- printf("\tvolumeInode = 0x%llx (%" AFS_INT64_FMT ")\n", inode, inode);
-#else
- findsym("cacheInode", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tcacheInode = 0x%x (%d)\n", count, count);
- findsym("volumeInode", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tvolumeInode = 0x%x (%d)\n", count, count);
-#endif
- findsym("cacheDiskType", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tcacheDiskType = 0x%x (%d)\n", count, count);
-#ifndef AFS32
- findsym("afs_indexCounter", &symoff);
- kread(kmem, symoff, (char *)&h, sizeof(struct afs_hyper_t));
- printf("\tafs_indexCounter = 0x%X.%X (%d.%d)\n", h.high, h.low, h.high,
- h.low);
-#endif
- findsym("afs_cacheFiles", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_cacheFiles = 0x%x (%d)\n", count, count);
- findsym("afs_cacheBlocks", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_cacheBlocks = 0x%x (%d)\n", count, count);
- findsym("afs_cacheStats", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_cacheStats = 0x%x (%d)\n", count, count);
- findsym("afs_blocksUsed", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_blocksUsed = 0x%x (%d)\n", count, count);
- findsym("afs_blocksDiscarded", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_blocksDiscarded = 0x%x (%d)\n", count, count);
- findsym("afs_fsfragsize", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_fsfragsize = 0x%x\n", count);
- findsym("afs_WaitForCacheDrain", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_WaitForCacheDrain = 0x%x (%d)\n", count, count);
- findsym("afs_CacheTooFull", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tafs_CacheTooFull = 0x%x (%d)\n", count, count);
-
-
- if (findsym("pagCounter", &symoff)) {
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\tpagCounter = 0x%x (%d)\n", count, count);
- } else {
- printf("Ignoring pagCounter\n");
- }
-}
-
-
-void
-print_rxstats(int kmem)
-{
- off_t symoff;
- char sysname[100];
- afs_int32 count, i;
- struct rx_statistics rx_stats;
-
- printf("\n\nPrinting some general RX stats...\n\n");
- findsym("rx_stats", &symoff);
- kread(kmem, symoff, (char *)&rx_stats, sizeof rx_stats);
- printf("\t\tpacketRequests = %d\n", rx_stats.packetRequests);
- printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_RECEIVE,
- rx_stats.receivePktAllocFailures);
- printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SEND,
- rx_stats.sendPktAllocFailures);
- printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SPECIAL,
- rx_stats.specialPktAllocFailures);
- printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_RECV_CBUF,
- rx_stats.receiveCbufPktAllocFailures);
- printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SEND_CBUF,
- rx_stats.sendCbufPktAllocFailures);
- printf("\t\tsocketGreedy = %d\n", rx_stats.socketGreedy);
- printf("\t\tbogusPacketOnRead = %d\n", rx_stats.bogusPacketOnRead);
- printf("\t\tbogusHost = %d\n", rx_stats.bogusHost);
- printf("\t\tnoPacketOnRead = %d\n", rx_stats.noPacketOnRead);
- printf("\t\tnoPacketBuffersOnRead = %d\n",
- rx_stats.noPacketBuffersOnRead);
- printf("\t\tselects = %d\n", rx_stats.selects);
- printf("\t\tsendSelects = %d\n", rx_stats.sendSelects);
- for (i = 0; i < RX_N_PACKET_TYPES; i++)
- printf("\t\tpacketsRead[%d] = %d\n", i, rx_stats.packetsRead[i]);
- printf("\t\tdataPacketsRead = %d\n", rx_stats.dataPacketsRead);
- printf("\t\tackPacketsRead = %d\n", rx_stats.ackPacketsRead);
- printf("\t\tdupPacketsRead = %d\n", rx_stats.dupPacketsRead);
- printf("\t\tspuriousPacketsRead = %d\n", rx_stats.spuriousPacketsRead);
- for (i = 0; i < RX_N_PACKET_TYPES; i++)
- printf("\t\tpacketsSent[%d] = %d\n", i, rx_stats.packetsSent[i]);
- printf("\t\tackPacketsSent = %d\n", rx_stats.ackPacketsSent);
- printf("\t\tpingPacketsSent = %d\n", rx_stats.pingPacketsSent);
- printf("\t\tabortPacketsSent = %d\n", rx_stats.abortPacketsSent);
- printf("\t\tbusyPacketsSent = %d\n", rx_stats.busyPacketsSent);
- printf("\t\tdataPacketsSent = %d\n", rx_stats.dataPacketsSent);
- printf("\t\tdataPacketsReSent = %d\n", rx_stats.dataPacketsReSent);
- printf("\t\tdataPacketsPushed = %d\n", rx_stats.dataPacketsPushed);
- printf("\t\tignoreAckedPacket = %d\n", rx_stats.ignoreAckedPacket);
- printf("\t\ttotalRtt = %d sec, %d usec\n", rx_stats.totalRtt.sec,
- rx_stats.totalRtt.usec);
- printf("\t\tminRtt = %d sec, %d usec\n", rx_stats.minRtt.sec,
- rx_stats.minRtt.usec);
- printf("\t\tmaxRtt = %d sec, %d usec\n", rx_stats.maxRtt.sec,
- rx_stats.maxRtt.usec);
- printf("\t\tnRttSamples = %d\n", rx_stats.nRttSamples);
- printf("\t\tnServerConns = %d\n", rx_stats.nServerConns);
- printf("\t\tnClientConns = %d\n", rx_stats.nClientConns);
- printf("\t\tnPeerStructs = %d\n", rx_stats.nPeerStructs);
- printf("\t\tnCallStructs = %d\n", rx_stats.nCallStructs);
- printf("\t\tnFreeCallStructs = %d\n", rx_stats.nFreeCallStructs);
- printf("\t\tnetSendFailures = %d\n", rx_stats.netSendFailures);
- printf("\t\tfatalErrors = %d\n", rx_stats.fatalErrors);
-}
-
-
-void
-print_rx(int kmem)
-{
- off_t symoff;
- char sysname[100], c;
- afs_int32 count, i, ar[100];
- short sm;
- struct rx_statistics rx_stats;
-
- printf("\n\nPrinting some RX globals...\n\n");
- findsym("rx_extraQuota", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\trx_extraQuota = %d\n", count);
- findsym("rx_extraPackets", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\trx_extraPackets = %d\n", count);
- findsym("rx_stackSize", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\trx_stackSize = %d\n", count);
- findsym("rx_connDeadTime", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trx_connDeadTime = %d\n", count);
- findsym("rx_idleConnectionTime", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trx_idleConnectionTime = %d\n", count);
-
- findsym("rx_idlePeerTime", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\trx_idlePeerTime = %d\n", count);
-
- findsym("rx_initSendWindow", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\trx_initSendWindow = %d\n", count);
-
- findsym("rxi_nSendFrags", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\trxi_nSendFrags = %d\n", count);
-
- findsym("rx_nPackets", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trx_nPackets = %d\n", count);
- findsym("rx_nFreePackets", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trx_nFreePackets = %d\n", count);
- findsym("rx_socket", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trx_socket = 0x%x\n", count);
- findsym("rx_port", &symoff);
- kread(kmem, symoff, (char *)&sm, sizeof sm);
-
- printf("\trx_Port = %d\n", sm);
- findsym("rx_packetQuota", &symoff);
- kread(kmem, symoff, (char *)ar, sizeof ar);
-
- for (i = 0; i < RX_N_PACKET_CLASSES; i++)
- printf("\trx_packetQuota[%d] = %d\n", i, ar[i]);
- findsym("rx_nextCid", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trx_nextCid = 0x%x\n", count);
- findsym("rx_epoch", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trx_epoch = 0u%u\n", count);
- findsym("rx_waitingForPackets", &symoff);
- kread(kmem, symoff, (char *)&c, sizeof(c));
-
- printf("\trx_waitingForPackets = %x\n", (int)c);
- findsym("rxi_nCalls", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trxi_nCalls = %d\n", count);
- findsym("rxi_dataQuota", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trxi_dataQuota = %d\n", count);
-#ifdef AFS_AIX_ENV
- if (findsym("rxi_Alloccnt", &symoff)) {
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\trxi_Alloccnt = %d\n", count);
- }
-
- if (findsym("rxi_Allocsize", &symoff)) {
- kread(kmem, symoff, (char *)&count, sizeof count);
- printf("\trxi_Allocsize = %d\n", count);
- }
-#endif
- findsym("rxi_availProcs", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trxi_availProcs = %d\n", count);
- findsym("rxi_totalMin", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trxi_totalMin = %d\n", count);
- findsym("rxi_minDeficit", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof count);
-
- printf("\trxi_minDeficit = %d\n", count);
- print_services(kmem);
-#ifdef KDUMP_RX_LOCK
- if (use_rx_lock) {
- print_peertable_lock(kmem);
- print_conntable_lock(kmem);
- print_calltable_lock(kmem);
- } else {
- print_peertable(kmem);
- print_conntable(kmem);
- print_calltable(kmem);
- }
-#else
- print_peertable(kmem);
- print_conntable(kmem);
- print_calltable(kmem);
-#endif
- print_eventtable(kmem);
- print_rxstats(kmem);
-}
-
-
-void
-print_services(afs_int32 kmem)
-{
- off_t symoff;
- struct rx_service *rx_services[RX_MAX_SERVICES], se, *sentry = &se, *sep;
- char sysname[100];
- afs_int32 count, i, j;
-
- findsym("rx_services", &symoff);
- kread(kmem, symoff, (char *)rx_services, RX_MAX_SERVICES * sizeof(long));
-
- printf("\n\nPrinting all 'rx_services' structures...\n");
- for (i = 0, j = 0; i < RX_MAX_SERVICES; i++) {
- if (rx_services[i]) {
- j++;
- kread(kmem, (off_t) rx_services[i], (char *)sentry,
- sizeof *sentry);
- kread(kmem, (off_t) sentry->serviceName, sysname,
- (KDUMP_SIZE_T) 40);
- printf
- ("\t%lx: serviceId=%d, port=%d, serviceName=%s, socket=0x%x\n",
- rx_services[i], sentry->serviceId, sentry->servicePort,
- sysname, sentry->socket);
- printf
- ("\t\tnSecObj=%d, nReqRunning=%d, maxProcs=%d, minProcs=%d, connDeadTime=%d, idleDeadTime=%d\n",
- sentry->nSecurityObjects, sentry->nRequestsRunning,
- sentry->maxProcs, sentry->minProcs, sentry->connDeadTime,
- sentry->idleDeadTime);
- }
- }
- printf("... found %d 'rx_services' entries in the table\n", j);
-}
-
-
-#ifdef KDUMP_RX_LOCK
-void
-print_peertable_lock(afs_int32 kmem)
-{
- off_t symoff;
- struct rx_peer_rx_lock *rx_peerTable[256], se, *sentry = &se, *sep;
- long count, i, j;
-
- findsym("rx_peerHashTable", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof(long));
- if (!count) {
- printf("No 'rx_peer' structures found.\n");
- return;
- }
-
- kread(kmem, count, (char *)rx_peerTable, 256 * sizeof(long));
- printf("\n\nPrinting all 'rx_peer' structures...\n");
- for (i = 0, j = 0; i < 256; i++) {
- for (sep = rx_peerTable[i]; sep; sep = sentry->next, j++) {
- kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
- printf("\t%lx: next=0x%lx, host=0x%x, ", sep, sentry->next,
- sentry->host);
- printf("ifMTU=%d, natMTU=%d, maxMTU=%d\n", sentry->ifMTU,
- sentry->natMTU, sentry->maxMTU);
- printf("\t\trtt=%d:%d, timeout(%d:%d), nSent=%d, reSends=%d\n",
- sentry->rtt, sentry->rtt_dev, sentry->timeout.sec,
- sentry->timeout.usec, sentry->nSent, sentry->reSends);
- printf("\t\trefCount=%d, port=%d, idleWhen=0x%x\n",
- sentry->refCount, sentry->port, sentry->idleWhen);
- printf
- ("\t\tCongestionQueue (0x%x:0x%x), inPacketSkew=0x%x, outPacketSkew=0x%x\n",
- sentry->congestionQueue.prev, sentry->congestionQueue.next,
- sentry->inPacketSkew, sentry->outPacketSkew);
- printf("\t\tpeer_lock=%d\n", sentry->peer_lock);
- }
- }
- printf("... found %d 'rx_peer' entries in the table\n", j);
-}
-
-#endif /* KDUMP_RX_LOCK */
-void
-print_peertable(afs_int32 kmem)
-{
- off_t symoff;
- struct rx_peer *rx_peerTable[256], se, *sentry = &se, *sep;
- long count, i, j;
-
- findsym("rx_peerHashTable", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof(long));
-
- kread(kmem, count, (char *)rx_peerTable, 256 * sizeof(long));
- printf("\n\nPrinting all 'rx_peer' structures...\n");
- for (i = 0, j = 0; i < 256; i++) {
- for (sep = rx_peerTable[i]; sep; sep = sentry->next, j++) {
- kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
- printf("\t%lx: next=0x%lx, host=0x%x, ", sep, sentry->next,
- sentry->host);
- printf("ifMTU=%d, natMTU=%d, maxMTU=%d\n", sentry->ifMTU,
- sentry->natMTU, sentry->maxMTU);
- printf("\t\trtt=%d:%d, timeout(%d:%d), nSent=%d, reSends=%d\n",
- sentry->rtt, sentry->rtt_dev, sentry->timeout.sec,
- sentry->timeout.usec, sentry->nSent, sentry->reSends);
- printf("\t\trefCount=%d, port=%d, idleWhen=0x%x\n",
- sentry->refCount, sentry->port, sentry->idleWhen);
- printf
- ("\t\tCongestionQueue (0x%x:0x%x), inPacketSkew=0x%x, outPacketSkew=0x%x\n",
- sentry->congestionQueue.prev, sentry->congestionQueue.next,
- sentry->inPacketSkew, sentry->outPacketSkew);
-#ifdef RX_ENABLE_LOCKS
- printf("\t\tpeer_lock=%d\n", sentry->peer_lock);
-#endif /* RX_ENABLE_LOCKS */
- }
- }
- printf("... found %d 'rx_peer' entries in the table\n", j);
-}
-
-
-#ifdef KDUMP_RX_LOCK
-void
-print_conntable_lock(afs_int32 kmem)
-{
- off_t symoff;
- struct rx_connection_rx_lock *rx_connTable[256], se, *sentry = &se;
- struct rx_connection_rx_lock *sep;
- long count, i, j;
-
- findsym("rx_connHashTable", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof(long));
- if (!count) {
- printf("No 'rx_connection' structures found.\n");
- return;
- }
-
- kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
- printf("\n\nPrinting all 'rx_connection' structures...\n");
- for (i = 0, j = 0; i < 256; i++) {
- for (sep = rx_connTable[i]; sep; sep = sentry->next, j++) {
- kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
- printf
- ("\t%lx: next=0x%lx, peer=0x%lx, epoch=0x%x, cid=0x%x, ackRate=%d\n",
- sep, se.next, se.peer, se.epoch, se.cid, se.ackRate);
- printf("\t\tcall[%lx=%d, %lx=%d, %lx=%d, %lx=%d]\n", se.call[0],
- se.callNumber[0], se.call[1], se.callNumber[1], se.call[2],
- se.callNumber[2], se.call[3], se.callNumber[3]);
- printf
- ("\t\ttimeout=%d, flags=0x%x, type=0x%x, serviceId=%d, service=0x%lx, refCount=%d\n",
- se.timeout, se.flags, se.type, se.serviceId, se.service,
- se.refCount);
- printf
- ("\t\tserial=%d, lastSerial=%d, secsUntilDead=%d, secsUntilPing=%d, secIndex=%d\n",
- se.serial, se.lastSerial, se.secondsUntilDead,
- se.secondsUntilPing, se.securityIndex);
- printf
- ("\t\terror=%d, secObject=0x%lx, secData=0x%lx, secHeaderSize=%d, secmaxTrailerSize=%d\n",
- se.error, se.securityObject, se.securityData,
- se.securityHeaderSize, se.securityMaxTrailerSize);
- printf
- ("\t\tchallEvent=0x%lx, lastSendTime=0x%x, maxSerial=%d, hardDeadTime=%d\n",
- se.challengeEvent, se.lastSendTime, se.maxSerial,
- se.hardDeadTime);
- if (se.flags & RX_CONN_MAKECALL_WAITING)
- printf
- ("\t\t***** Conn in RX_CONN_MAKECALL_WAITING state *****\n");
- printf
- ("\t\tcall_lock=%d, call_cv=%d, data_lock=%d, refCount=%d\n",
- se.conn_call_lock, se.conn_call_cv, se.conn_data_lock,
- se.refCount);
- }
- }
- printf("... found %d 'rx_connection' entries in the table\n", j);
-}
-#endif /* KDUMP_RX_LOCK */
-
-void
-print_conntable(afs_int32 kmem)
-{
- off_t symoff;
- struct rx_connection *rx_connTable[256], se, *sentry = &se, *sep;
- long count, i, j;
-
- findsym("rx_connHashTable", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof(long));
-
- kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
- printf("\n\nPrinting all 'rx_connection' structures...\n");
- for (i = 0, j = 0; i < 256; i++) {
- for (sep = rx_connTable[i]; sep; sep = sentry->next, j++) {
- kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
- printf
- ("\t%lx: next=0x%lx, peer=0x%lx, epoch=0x%x, cid=0x%x, ackRate=%d\n",
- sep, se.next, se.peer, se.epoch, se.cid, se.ackRate);
- printf("\t\tcall[%x=%d, %x=%d, %x=%d, %x=%d]\n", se.call[0],
- se.callNumber[0], se.call[1], se.callNumber[1], se.call[2],
- se.callNumber[2], se.call[3], se.callNumber[3]);
- printf
- ("\t\ttimeout=%d, flags=0x%x, type=0x%x, serviceId=%d, service=0x%lx, refCount=%d\n",
- se.timeout, se.flags, se.type, se.serviceId, se.service,
- se.refCount);
- printf
- ("\t\tserial=%d, lastSerial=%d, secsUntilDead=%d, secsUntilPing=%d, secIndex=%d\n",
- se.serial, se.lastSerial, se.secondsUntilDead,
- se.secondsUntilPing, se.securityIndex);
- printf
- ("\t\terror=%d, secObject=0x%lx, secData=0x%lx, secHeaderSize=%d, secmaxTrailerSize=%d\n",
- se.error, se.securityObject, se.securityData,
- se.securityHeaderSize, se.securityMaxTrailerSize);
- printf
- ("\t\tchallEvent=0x%lx, lastSendTime=0x%x, maxSerial=%d, hardDeadTime=%d\n",
- se.challengeEvent, se.lastSendTime, se.maxSerial,
- se.hardDeadTime);
- if (se.flags & RX_CONN_MAKECALL_WAITING)
- printf
- ("\t\t***** Conn in RX_CONN_MAKECALL_WAITING state *****\n");
-#ifdef RX_ENABLE_LOCKS
- printf
- ("\t\tcall_lock=%d, call_cv=%d, data_lock=%d, refCount=%d\n",
- se.conn_call_lock, se.conn_call_cv, se.conn_data_lock,
- se.refCount);
-#endif /* RX_ENABLE_LOCKS */
- }
- }
- printf("... found %d 'rx_connection' entries in the table\n", j);
-}
-
-
-#ifdef KDUMP_RX_LOCK
-void
-print_calltable_lock(afs_int32 kmem)
-{
- off_t symoff;
- struct rx_connection_rx_lock *rx_connTable[256], se;
- struct rx_connection_rx_lock *sentry = &se;
- struct rx_connection_rx_lock *sep;
- long count, i, j, k;
-
- findsym("rx_connHashTable", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof(long));
- if (!count) {
- printf("No 'rx_call' structures found.\n");
- return;
- }
-
- kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
- printf("\n\nPrinting all active 'rx_call' structures...\n");
- for (i = 0, j = 0; i < 256; i++) {
- for (sep = rx_connTable[i]; sep; sep = se.next) {
- kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
- for (k = 0; k < RX_MAXCALLS; k++) {
- struct rx_call_rx_lock ce, *centry = &ce;
- struct rx_call_rx_lock *call = se.call[k];
- if (call) {
- j++;
- kread(kmem, (off_t) call, (char *)centry, sizeof *centry);
- printf
- ("\t%lx: conn=0x%lx, qiheader(0x%lx:0x%lx), tq(0x%lx:0x%lx), rq(0x%lx:0x%lx)\n",
- call, centry->conn, centry->queue_item_header.prev,
- centry->queue_item_header.next, centry->tq.prev,
- centry->tq.next, centry->rq.prev, centry->rq.next);
- printf
- ("\t\t: curvec=%d, curpos=%d, nLeft=%d, nFree=%d, currPacket=0x%lx, callNumber=0x%x\n",
- centry->curvec, centry->curpos, centry->nLeft,
- centry->nFree, centry->currentPacket,
- centry->callNumber);
- printf
- ("\t\t: channel=%d, state=0x%x, mode=0x%x, flags=0x%x, localStatus=0x%x, remStatus=0x%x\n",
- centry->channel, centry->state, centry->mode,
- centry->flags, centry->localStatus,
- centry->remoteStatus);
- printf
- ("\t\t: error=%d, timeout=0x%x, rnext=0x%x, rprev=0x%x, rwind=0x%x, tfirst=0x%x, tnext=0x%x\n",
- centry->error, centry->timeout, centry->rnext,
- centry->rprev, centry->rwind, centry->tfirst,
- centry->tnext);
- printf
- ("\t\t: twind=%d, resendEvent=0x%lx, timeoutEvent=0x%lx, keepAliveEvent=0x%lx, delayedAckEvent=0x%lx\n",
- centry->twind, centry->resendEvent,
- centry->timeoutEvent, centry->keepAliveEvent,
- centry->delayedAckEvent);
- printf
- ("\t\t: lastSendTime=0x%x, lastReceiveTime=0x%x, lastAcked=0x%x, startTime=0x%x, startWait=0x%x\n",
- centry->lastSendTime, centry->lastReceiveTime,
- centry->lastAcked, centry->startTime,
- centry->startWait);
- if (centry->flags & RX_CALL_WAIT_PROC)
- printf
- ("\t\t******** Call in RX_CALL_WAIT_PROC state **********\n");
- if (centry->flags & RX_CALL_WAIT_WINDOW_ALLOC)
- printf
- ("\t\t******** Call in RX_CALL_WAIT_WINDOW_ALLOC state **********\n");
- if (centry->flags & RX_CALL_READER_WAIT)
- printf
- ("\t\t******** Conn in RX_CALL_READER_WAIT state **********\n");
- if (centry->flags & RX_CALL_WAIT_PACKETS)
- printf
- ("\t\t******** Conn in RX_CALL_WAIT_PACKETS state **********\n");
- printf
- ("\t\t: lock=0x%x, cv_twind=0x%x, cv_rq=0x%x, refCount=%d\n",
- centry->lock, centry->cv_twind, centry->cv_rq,
- centry->refCount);
- printf("\t\t: MTU=%d\n", centry->MTU);
- }
- }
- }
- }
- printf("... found %d 'rx_call' entries in the table\n", j);
-}
-#endif /* KDUMP_RX_LOCK */
-
-void
-print_calltable(afs_int32 kmem)
-{
- off_t symoff;
- struct rx_connection *rx_connTable[256], se, *sentry = &se, *sep;
- long count, i, j, k;
-
- findsym("rx_connHashTable", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof(long));
-
- kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
- printf("\n\nPrinting all active 'rx_call' structures...\n");
- for (i = 0, j = 0; i < 256; i++) {
- for (sep = rx_connTable[i]; sep; sep = se.next) {
- kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
- for (k = 0; k < RX_MAXCALLS; k++) {
- struct rx_call ce, *centry = &ce, *call = se.call[k];
- if (call) {
- j++;
- kread(kmem, (off_t) call, (char *)centry, sizeof *centry);
- printf
- ("\t%lx: conn=0x%lx, qiheader(0x%lx:0x%lx), tq(0x%lx:0x%lx), rq(0x%lx:0x%lx)\n",
- call, centry->conn, centry->queue_item_header.prev,
- centry->queue_item_header.next, centry->tq.prev,
- centry->tq.next, centry->rq.prev, centry->rq.next);
- printf
- ("\t\t: curvec=%d, curpos=%d, nLeft=%d, nFree=%d, currPacket=0x%lx, callNumber=0x%x\n",
- centry->curvec, centry->curpos, centry->nLeft,
- centry->nFree, centry->currentPacket,
- centry->callNumber);
- printf
- ("\t\t: channel=%d, state=0x%x, mode=0x%x, flags=0x%x, localStatus=0x%x, remStatus=0x%x\n",
- centry->channel, centry->state, centry->mode,
- centry->flags, centry->localStatus,
- centry->remoteStatus);
- printf
- ("\t\t: error=%d, timeout=0x%x, rnext=0x%x, rprev=0x%x, rwind=0x%x, tfirst=0x%x, tnext=0x%x\n",
- centry->error, centry->timeout, centry->rnext,
- centry->rprev, centry->rwind, centry->tfirst,
- centry->tnext);
- printf
- ("\t\t: twind=%d, resendEvent=0x%lx, timeoutEvent=0x%lx, keepAliveEvent=0x%lx, delayedAckEvent=0x%lx\n",
- centry->twind, centry->resendEvent,
- centry->timeoutEvent, centry->keepAliveEvent,
- centry->delayedAckEvent);
- printf
- ("\t\t: lastSendTime=0x%x, lastReceiveTime=0x%x, lastAcked=0x%x, startTime=0x%x, startWait=0x%x\n",
- centry->lastSendTime, centry->lastReceiveTime,
- centry->lastAcked, centry->startTime,
- centry->startWait);
- if (centry->flags & RX_CALL_WAIT_PROC)
- printf
- ("\t\t******** Call in RX_CALL_WAIT_PROC state **********\n");
- if (centry->flags & RX_CALL_WAIT_WINDOW_ALLOC)
- printf
- ("\t\t******** Call in RX_CALL_WAIT_WINDOW_ALLOC state **********\n");
- if (centry->flags & RX_CALL_READER_WAIT)
- printf
- ("\t\t******** Conn in RX_CALL_READER_WAIT state **********\n");
- if (centry->flags & RX_CALL_WAIT_PACKETS)
- printf
- ("\t\t******** Conn in RX_CALL_WAIT_PACKETS state **********\n");
-#ifdef RX_ENABLE_LOCKS
- printf
- ("\t\t: lock=0x%x, cv_twind=0x%x, cv_rq=0x%x, refCount=%d\n",
- centry->lock, centry->cv_twind, centry->cv_rq,
- centry->refCount);
-#endif /* RX_ENABLE_LOCKS */
- printf("\t\t: MTU=%d\n", centry->MTU);
- }
- }
- }
- }
- printf("... found %d 'rx_call' entries in the table\n", j);
-}
-
-void
-print_eventtable(afs_int32 kmem)
-{
- off_t symoff;
- struct rx_queue epq;
- struct rx_queue evq;
- char *epend, *evend;
- afs_int32 count, i, j = 0, k = 0;
-
-#if ! defined(AFS_HPUX_ENV) && ! defined(AFS_AIX_ENV)
- findsym("rxevent_nFree", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof(afs_int32));
- printf("\n\n\trxevent_nFree = %d\n", count);
-
- findsym("rxevent_nPosted", &symoff);
- kread(kmem, symoff, (char *)&count, sizeof(afs_int32));
- printf("\trxevent_nPosted = %d\n", count);
-#endif
-}
-
-/*
- * print_upDownStats
- *
- * Print the up/downtime stats for the given class of server records
- * provided.
- */
-void
-print_upDownStats(struct afs_stats_SrvUpDownInfo *a_upDownP)
-{ /*print_upDownStats */
-
- /*
- * First, print the simple values.
- */
- printf("\t\t%10d numTtlRecords\n", a_upDownP->numTtlRecords);
- printf("\t\t%10d numUpRecords\n", a_upDownP->numUpRecords);
- printf("\t\t%10d numDownRecords\n", a_upDownP->numDownRecords);
- printf("\t\t%10d sumOfRecordAges\n", a_upDownP->sumOfRecordAges);
- printf("\t\t%10d ageOfYoungestRecord\n", a_upDownP->ageOfYoungestRecord);
- printf("\t\t%10d ageOfOldestRecord\n", a_upDownP->ageOfOldestRecord);
- printf("\t\t%10d numDowntimeIncidents\n",
- a_upDownP->numDowntimeIncidents);
- printf("\t\t%10d numRecordsNeverDown\n", a_upDownP->numRecordsNeverDown);
- printf("\t\t%10d maxDowntimesInARecord\n",
- a_upDownP->maxDowntimesInARecord);
- printf("\t\t%10d sumOfDowntimes\n", a_upDownP->sumOfDowntimes);
- printf("\t\t%10d shortestDowntime\n", a_upDownP->shortestDowntime);
- printf("\t\t%10d longestDowntime\n", a_upDownP->longestDowntime);
-
- /*
- * Now, print the array values.
- */
- printf("\t\tDowntime duration distribution:\n");
- printf("\t\t\t%8d: 0 min .. 10 min\n", a_upDownP->downDurations[0]);
- printf("\t\t\t%8d: 10 min .. 30 min\n", a_upDownP->downDurations[1]);
- printf("\t\t\t%8d: 30 min .. 1 hr\n", a_upDownP->downDurations[2]);
- printf("\t\t\t%8d: 1 hr .. 2 hr\n", a_upDownP->downDurations[3]);
- printf("\t\t\t%8d: 2 hr .. 4 hr\n", a_upDownP->downDurations[4]);
- printf("\t\t\t%8d: 4 hr .. 8 hr\n", a_upDownP->downDurations[5]);
- printf("\t\t\t%8d: > 8 hr\n", a_upDownP->downDurations[6]);
-
- printf("\t\tDowntime incident distribution:\n");
- printf("\t\t\t%8d: 0 times\n", a_upDownP->downIncidents[0]);
- printf("\t\t\t%8d: 1 time\n", a_upDownP->downDurations[1]);
- printf("\t\t\t%8d: 2 .. 5 times\n", a_upDownP->downDurations[2]);
- printf("\t\t\t%8d: 6 .. 10 times\n", a_upDownP->downDurations[3]);
- printf("\t\t\t%8d: 10 .. 50 times\n", a_upDownP->downDurations[4]);
- printf("\t\t\t%8d: > 50 times\n", a_upDownP->downDurations[5]);
-} /*print_upDownStats */
-
-
-void
-print_cmperfstats(struct afs_stats_CMPerf *perfP)
-{
- struct afs_stats_SrvUpDownInfo *upDownP; /*Ptr to server up/down info */
-
- printf("\t%10d numPerfCalls\n", perfP->numPerfCalls);
- printf("\t%10d epoch\n", perfP->epoch);
- printf("\t%10d numCellsVisible\n", perfP->numCellsVisible);
- printf("\t%10d numCellsContacted\n", perfP->numCellsContacted);
- printf("\t%10d dlocalAccesses\n", perfP->dlocalAccesses);
- printf("\t%10d vlocalAccesses\n", perfP->vlocalAccesses);
- printf("\t%10d dremoteAccesses\n", perfP->dremoteAccesses);
- printf("\t%10d vremoteAccesses\n", perfP->vremoteAccesses);
- printf("\t%10d cacheNumEntries\n", perfP->cacheNumEntries);
- printf("\t%10d cacheBlocksTotal\n", perfP->cacheBlocksTotal);
- printf("\t%10d cacheBlocksInUse\n", perfP->cacheBlocksInUse);
- printf("\t%10d cacheBlocksOrig\n", perfP->cacheBlocksOrig);
- printf("\t%10d cacheMaxDirtyChunks\n", perfP->cacheMaxDirtyChunks);
- printf("\t%10d cacheCurrDirtyChunks\n", perfP->cacheCurrDirtyChunks);
- printf("\t%10d dcacheHits\n", perfP->dcacheHits);
- printf("\t%10d vcacheHits\n", perfP->vcacheHits);
- printf("\t%10d dcacheMisses\n", perfP->dcacheMisses);
- printf("\t%10d vcacheMisses\n", perfP->vcacheMisses);
- printf("\t%10d cacheFlushes\n", perfP->cacheFlushes);
- printf("\t%10d cacheFilesReused\n", perfP->cacheFilesReused);
- printf("\t%10d vcacheXAllocs\n", perfP->vcacheXAllocs);
- printf("\t%10d dcacheXAllocs\n", perfP->dcacheXAllocs);
-
- printf("\t%10d bufAlloced\n", perfP->bufAlloced);
- printf("\t%10d bufHits\n", perfP->bufHits);
- printf("\t%10d bufMisses\n", perfP->bufMisses);
- printf("\t%10d bufFlushDirty\n", perfP->bufFlushDirty);
-
- printf("\t%10d LargeBlocksActive\n", perfP->LargeBlocksActive);
- printf("\t%10d LargeBlocksAlloced\n", perfP->LargeBlocksAlloced);
- printf("\t%10d SmallBlocksActive\n", perfP->SmallBlocksActive);
- printf("\t%10d SmallBlocksAlloced\n", perfP->SmallBlocksAlloced);
- printf("\t%10d MediumBlocksActive\n", perfP->MediumBlocksActive);
- printf("\t%10d MediumBlocksAlloced\n", perfP->MediumBlocksAlloced);
- printf("\t%10d OutStandingMemUsage\n", perfP->OutStandingMemUsage);
- printf("\t%10d OutStandingAllocs\n", perfP->OutStandingAllocs);
- printf("\t%10d CallBackAlloced\n", perfP->CallBackAlloced);
- printf("\t%10d CallBackFlushes\n", perfP->CallBackFlushes);
- printf("\t%10d CallBackLoops\n", perfP->cbloops);
-
- printf("\t%10d srvRecords\n", perfP->srvRecords);
- printf("\t%10d srvNumBuckets\n", perfP->srvNumBuckets);
- printf("\t%10d srvMaxChainLength\n", perfP->srvMaxChainLength);
- printf("\t%10d srvRecordsHWM\n", perfP->srvRecordsHWM);
- printf("\t%10d srvMaxChainLengthHWM\n", perfP->srvMaxChainLengthHWM);
-
- printf("\t%10d sysName_ID\n", perfP->sysName_ID);
- printf("\t%10d osi_Read_EFAULTS\n", perfP->osiread_efaults);
-
- printf("\tFile Server up/downtimes, same cell:\n");
- print_upDownStats(&(perfP->fs_UpDown[0]));
-
- printf("\tFile Server up/downtimes, diff cell:\n");
- print_upDownStats(&(perfP->fs_UpDown[1]));
-
- printf("\tVL Server up/downtimes, same cell:\n");
- print_upDownStats(&(perfP->vl_UpDown[0]));
-
- printf("\tVL Server up/downtimes, diff cell:\n");
- print_upDownStats(&(perfP->vl_UpDown[1]));
-}
-
-
-void
-print_cmstats(struct afs_CMStats *cmp)
-{
- printf("\t%10d afs_init\n", cmp->callInfo.C_afs_init);
- printf("\t%10d gop_rdwr\n", cmp->callInfo.C_gop_rdwr);
- printf("\t%10d aix_gnode_rele\n", cmp->callInfo.C_aix_gnode_rele);
- printf("\t%10d gettimeofday\n", cmp->callInfo.C_gettimeofday);
- printf("\t%10d m_cpytoc\n", cmp->callInfo.C_m_cpytoc);
- printf("\t%10d aix_vattr_null\n", cmp->callInfo.C_aix_vattr_null);
- printf("\t%10d afs_gn_frunc\n", cmp->callInfo.C_afs_gn_ftrunc);
- printf("\t%10d afs_gn_rdwr\n", cmp->callInfo.C_afs_gn_rdwr);
- printf("\t%10d afs_gn_ioctl\n", cmp->callInfo.C_afs_gn_ioctl);
- printf("\t%10d afs_gn_locktl\n", cmp->callInfo.C_afs_gn_lockctl);
- printf("\t%10d afs_gn_readlink\n", cmp->callInfo.C_afs_gn_readlink);
- printf("\t%10d afs_gn_readdir\n", cmp->callInfo.C_afs_gn_readdir);
- printf("\t%10d afs_gn_select\n", cmp->callInfo.C_afs_gn_select);
- printf("\t%10d afs_gn_strategy\n", cmp->callInfo.C_afs_gn_strategy);
- printf("\t%10d afs_gn_symlink\n", cmp->callInfo.C_afs_gn_symlink);
- printf("\t%10d afs_gn_revoke\n", cmp->callInfo.C_afs_gn_revoke);
- printf("\t%10d afs_gn_link\n", cmp->callInfo.C_afs_gn_link);
- printf("\t%10d afs_gn_mkdir\n", cmp->callInfo.C_afs_gn_mkdir);
- printf("\t%10d afs_gn_mknod\n", cmp->callInfo.C_afs_gn_mknod);
- printf("\t%10d afs_gn_remove\n", cmp->callInfo.C_afs_gn_remove);
- printf("\t%10d afs_gn_rename\n", cmp->callInfo.C_afs_gn_rename);
- printf("\t%10d afs_gn_rmdir\n", cmp->callInfo.C_afs_gn_rmdir);
- printf("\t%10d afs_gn_fid\n", cmp->callInfo.C_afs_gn_fid);
- printf("\t%10d afs_gn_lookup\n", cmp->callInfo.C_afs_gn_lookup);
- printf("\t%10d afs_gn_open\n", cmp->callInfo.C_afs_gn_open);
- printf("\t%10d afs_gn_create\n", cmp->callInfo.C_afs_gn_create);
- printf("\t%10d afs_gn_hold\n", cmp->callInfo.C_afs_gn_hold);
- printf("\t%10d afs_gn_rele\n", cmp->callInfo.C_afs_gn_rele);
- printf("\t%10d afs_gn_unmap\n", cmp->callInfo.C_afs_gn_unmap);
- printf("\t%10d afs_gn_access\n", cmp->callInfo.C_afs_gn_access);
- printf("\t%10d afs_gn_getattr\n", cmp->callInfo.C_afs_gn_getattr);
- printf("\t%10d afs_gn_setattr\n", cmp->callInfo.C_afs_gn_setattr);
- printf("\t%10d afs_gn_fclear\n", cmp->callInfo.C_afs_gn_fclear);
- printf("\t%10d afs_gn_fsync\n", cmp->callInfo.C_afs_gn_fsync);
- printf("\t%10d phash\n", cmp->callInfo.C_pHash);
- printf("\t%10d DInit\n", cmp->callInfo.C_DInit);
- printf("\t%10d DRead\n", cmp->callInfo.C_DRead);
- printf("\t%10d FixupBucket\n", cmp->callInfo.C_FixupBucket);
- printf("\t%10d afs_newslot\n", cmp->callInfo.C_afs_newslot);
- printf("\t%10d DRelease\n", cmp->callInfo.C_DRelease);
- printf("\t%10d DFlush\n", cmp->callInfo.C_DFlush);
- printf("\t%10d DFlushEntry\n", cmp->callInfo.C_DFlushEntry);
- printf("\t%10d DVOffset\n", cmp->callInfo.C_DVOffset);
- printf("\t%10d DZap\n", cmp->callInfo.C_DZap);
- printf("\t%10d DNew\n", cmp->callInfo.C_DNew);
- printf("\t%10d afs_RemoveVCB\n", cmp->callInfo.C_afs_RemoveVCB);
- printf("\t%10d afs_NewVCache\n", cmp->callInfo.C_afs_NewVCache);
- printf("\t%10d afs_FlushActiveVcaches\n",
- cmp->callInfo.C_afs_FlushActiveVcaches);
- printf("\t%10d afs_VerifyVCache\n", cmp->callInfo.C_afs_VerifyVCache);
- printf("\t%10d afs_WriteVCache\n", cmp->callInfo.C_afs_WriteVCache);
- printf("\t%10d afs_GetVCache\n", cmp->callInfo.C_afs_GetVCache);
- printf("\t%10d afs_StuffVcache\n", cmp->callInfo.C_afs_StuffVcache);
- printf("\t%10d afs_FindVCache\n", cmp->callInfo.C_afs_FindVCache);
- printf("\t%10d afs_PutDCache\n", cmp->callInfo.C_afs_PutDCache);
- printf("\t%10d afs_PutVCache\n", cmp->callInfo.C_afs_PutVCache);
- printf("\t%10d CacheStoreProc\n", cmp->callInfo.C_CacheStoreProc);
- printf("\t%10d afs_FindDcache\n", cmp->callInfo.C_afs_FindDCache);
- printf("\t%10d afs_TryToSmush\n", cmp->callInfo.C_afs_TryToSmush);
- printf("\t%10d afs_AdjustSize\n", cmp->callInfo.C_afs_AdjustSize);
- printf("\t%10d afs_CheckSize\n", cmp->callInfo.C_afs_CheckSize);
- printf("\t%10d afs_StoreWarn\n", cmp->callInfo.C_afs_StoreWarn);
- printf("\t%10d CacheFetchProc\n", cmp->callInfo.C_CacheFetchProc);
- printf("\t%10d UFS_CacheStoreProc\n", cmp->callInfo.C_UFS_CacheStoreProc);
- printf("\t%10d UFS_CacheFetchProc\n", cmp->callInfo.C_UFS_CacheFetchProc);
- printf("\t%10d afs_GetDCache\n", cmp->callInfo.C_afs_GetDCache);
- printf("\t%10d afs_SimpleVStat\n", cmp->callInfo.C_afs_SimpleVStat);
- printf("\t%10d afs_ProcessFS\n", cmp->callInfo.C_afs_ProcessFS);
- printf("\t%10d afs_InitCacheInfo\n", cmp->callInfo.C_afs_InitCacheInfo);
- printf("\t%10d afs_InitVolumeInfo\n", cmp->callInfo.C_afs_InitVolumeInfo);
- printf("\t%10d afs_InitCacheFile\n", cmp->callInfo.C_afs_InitCacheFile);
- printf("\t%10d afs_CacheInit\n", cmp->callInfo.C_afs_CacheInit);
- printf("\t%10d afs_GetDSlot\n", cmp->callInfo.C_afs_GetDSlot);
- printf("\t%10d afs_WriteThroughDSlots\n",
- cmp->callInfo.C_afs_WriteThroughDSlots);
- printf("\t%10d afs_MemGetDSlot\n", cmp->callInfo.C_afs_MemGetDSlot);
- printf("\t%10d afs_UFSGetDSlot\n", cmp->callInfo.C_afs_UFSGetDSlot);
- printf("\t%10d afs_StoreDCache\n", cmp->callInfo.C_afs_StoreDCache);
- printf("\t%10d afs_StoreMini\n", cmp->callInfo.C_afs_StoreMini);
- printf("\t%10d afs_StoreAllSegments\n",
- cmp->callInfo.C_afs_StoreAllSegments);
- printf("\t%10d afs_InvalidateAllSegments\n",
- cmp->callInfo.C_afs_InvalidateAllSegments);
- printf("\t%10d afs_TruncateAllSegments\n",
- cmp->callInfo.C_afs_TruncateAllSegments);
- printf("\t%10d afs_CheckVolSync\n", cmp->callInfo.C_afs_CheckVolSync);
- printf("\t%10d afs_wakeup\n", cmp->callInfo.C_afs_wakeup);
- printf("\t%10d afs_CFileOpen\n", cmp->callInfo.C_afs_CFileOpen);
- printf("\t%10d afs_CFileTruncate\n", cmp->callInfo.C_afs_CFileTruncate);
- printf("\t%10d afs_GetDownD\n", cmp->callInfo.C_afs_GetDownD);
- printf("\t%10d afs_WriteDCache\n", cmp->callInfo.C_afs_WriteDCache);
- printf("\t%10d afs_FlushDCache\n", cmp->callInfo.C_afs_FlushDCache);
- printf("\t%10d afs_GetDownDSlot\n", cmp->callInfo.C_afs_GetDownDSlot);
- printf("\t%10d afs_FlushVCache\n", cmp->callInfo.C_afs_FlushVCache);
- printf("\t%10d afs_GetDownV\n", cmp->callInfo.C_afs_GetDownV);
- printf("\t%10d afs_QueueVCB\n", cmp->callInfo.C_afs_QueueVCB);
- printf("\t%10d afs_call\n", cmp->callInfo.C_afs_call);
- printf("\t%10d afs_syscall_call\n", cmp->callInfo.C_afs_syscall_call);
- printf("\t%10d afs_syscall_icreate\n",
- cmp->callInfo.C_afs_syscall_icreate);
- printf("\t%10d afs_syscall_iopen\n", cmp->callInfo.C_afs_syscall_iopen);
- printf("\t%10d afs_syscall_iincdec\n",
- cmp->callInfo.C_afs_syscall_iincdec);
- printf("\t%10d afs_syscall_ireadwrite\n",
- cmp->callInfo.C_afs_syscall_ireadwrite);
- printf("\t%10d afs_syscall\n", cmp->callInfo.C_afs_syscall);
- printf("\t%10d lpioctl\n", cmp->callInfo.C_lpioctl);
- printf("\t%10d lsetpag\n", cmp->callInfo.C_lsetpag);
- printf("\t%10d afs_CheckInit\n", cmp->callInfo.C_afs_CheckInit);
- printf("\t%10d ClearCallback\n", cmp->callInfo.C_ClearCallBack);
- printf("\t%10d SRXAFSCB_GetCE\n", cmp->callInfo.C_SRXAFSCB_GetCE);
- printf("\t%10d SRXAFSCB_GetLock\n", cmp->callInfo.C_SRXAFSCB_GetLock);
- printf("\t%10d SRXAFSCB_CallBack\n", cmp->callInfo.C_SRXAFSCB_CallBack);
- printf("\t%10d SRXAFSCB_InitCallBackState\n",
- cmp->callInfo.C_SRXAFSCB_InitCallBackState);
- printf("\t%10d SRXAFSCB_Probe\n", cmp->callInfo.C_SRXAFSCB_Probe);
- printf("\t%10d afs_Chunk\n", cmp->callInfo.C_afs_Chunk);
- printf("\t%10d afs_ChunkBase\n", cmp->callInfo.C_afs_ChunkBase);
- printf("\t%10d afs_ChunkOffset\n", cmp->callInfo.C_afs_ChunkOffset);
- printf("\t%10d afs_ChunkSize\n", cmp->callInfo.C_afs_ChunkSize);
- printf("\t%10d afs_ChunkToBase\n", cmp->callInfo.C_afs_ChunkToBase);
- printf("\t%10d afs_ChunkToSize\n", cmp->callInfo.C_afs_ChunkToSize);
- printf("\t%10d afs_SetChunkSize\n", cmp->callInfo.C_afs_SetChunkSize);
- printf("\t%10d afs_config\n", cmp->callInfo.C_afs_config);
- printf("\t%10d mem_freebytes\n", cmp->callInfo.C_mem_freebytes);
- printf("\t%10d mem_getbytes\n", cmp->callInfo.C_mem_getbytes);
- printf("\t%10d afs_Daemon\n", cmp->callInfo.C_afs_Daemon);
- printf("\t%10d afs_CheckRootVolume\n",
- cmp->callInfo.C_afs_CheckRootVolume);
- printf("\t%10d BPath\n", cmp->callInfo.C_BPath);
- printf("\t%10d BPrefetch\n", cmp->callInfo.C_BPrefetch);
- printf("\t%10d BStore\n", cmp->callInfo.C_BStore);
- printf("\t%10d afs_BBusy\n", cmp->callInfo.C_afs_BBusy);
- printf("\t%10d afs_BQueue\n", cmp->callInfo.C_afs_BQueue);
- printf("\t%10d afs_BRelease\n", cmp->callInfo.C_afs_BRelease);
- printf("\t%10d afs_BackgroundDaemon\n",
- cmp->callInfo.C_afs_BackgroundDaemon);
- printf("\t%10d exporter_add\n", cmp->callInfo.C_exporter_add);
- printf("\t%10d exporter_find\n", cmp->callInfo.C_exporter_find);
- printf("\t%10d afs_gfs_kalloc\n", cmp->callInfo.C_afs_gfs_kalloc);
- printf("\t%10d afs_gfs_kfree\n", cmp->callInfo.C_afs_gfs_kfree);
- printf("\t%10d gop_lookupname\n", cmp->callInfo.C_gop_lookupname);
- printf("\t%10d afs_uniqtime\n", cmp->callInfo.C_afs_uniqtime);
- printf("\t%10d gfs_vattr_null\n", cmp->callInfo.C_gfs_vattr_null);
- printf("\t%10d afs_lock\n", cmp->callInfo.C_afs_lock);
- printf("\t%10d afs_unlock\n", cmp->callInfo.C_afs_unlock);
- printf("\t%10d afs_update\n", cmp->callInfo.C_afs_update);
- printf("\t%10d afs_gclose\n", cmp->callInfo.C_afs_gclose);
- printf("\t%10d afs_gopen\n", cmp->callInfo.C_afs_gopen);
- printf("\t%10d afs_greadlink\n", cmp->callInfo.C_afs_greadlink);
- printf("\t%10d afs_select\n", cmp->callInfo.C_afs_select);
- printf("\t%10d afs_gbmap\n", cmp->callInfo.C_afs_gbmap);
- printf("\t%10d afs_getfsdata\n", cmp->callInfo.C_afs_getfsdata);
- printf("\t%10d afs_gsymlink\n", cmp->callInfo.C_afs_gsymlink);
- printf("\t%10d afs_namei\n", cmp->callInfo.C_afs_namei);
- printf("\t%10d afs_gmount\n", cmp->callInfo.C_afs_gmount);
- printf("\t%10d afs_gget\n", cmp->callInfo.C_afs_gget);
- printf("\t%10d afs_glink\n", cmp->callInfo.C_afs_glink);
- printf("\t%10d afs_gmkdir\n", cmp->callInfo.C_afs_gmkdir);
- printf("\t%10d afs_unlink\n", cmp->callInfo.C_afs_unlink);
- printf("\t%10d afs_grmdir\n", cmp->callInfo.C_afs_grmdir);
- printf("\t%10d afs_makenode\n", cmp->callInfo.C_afs_makenode);
- printf("\t%10d afs_grename\n", cmp->callInfo.C_afs_grename);
- printf("\t%10d afs_rele\n", cmp->callInfo.C_afs_rele);
- printf("\t%10d afs_syncgp\n", cmp->callInfo.C_afs_syncgp);
- printf("\t%10d afs_getval\n", cmp->callInfo.C_afs_getval);
- printf("\t%10d afs_trunc\n", cmp->callInfo.C_afs_trunc);
- printf("\t%10d afs_rwgp\n", cmp->callInfo.C_afs_rwgp);
- printf("\t%10d afs_stat\n", cmp->callInfo.C_afs_stat);
- printf("\t%10d afsc_link\n", cmp->callInfo.C_afsc_link);
- printf("\t%10d afs_vfs_mount\n", cmp->callInfo.C_afs_vfs_mount);
- printf("\t%10d afs_uniqtime\n", cmp->callInfo.C_afs_uniqtime);
- printf("\t%10d iopen\n", cmp->callInfo.C_iopen);
- printf("\t%10d idec\n", cmp->callInfo.C_idec);
- printf("\t%10d iinc\n", cmp->callInfo.C_iinc);
- printf("\t%10d ireadwrite\n", cmp->callInfo.C_ireadwrite);
- printf("\t%10d iread\n", cmp->callInfo.C_iread);
- printf("\t%10d iwrite\n", cmp->callInfo.C_iwrite);
- printf("\t%10d iforget\n", cmp->callInfo.C_iforget);
- printf("\t%10d icreate\n", cmp->callInfo.C_icreate);
- printf("\t%10d igetinode\n", cmp->callInfo.C_igetinode);
- printf("\t%10d osi_SleepR\n", cmp->callInfo.C_osi_SleepR);
- printf("\t%10d osi_SleepS\n", cmp->callInfo.C_osi_SleepS);
- printf("\t%10d osi_SleepW\n", cmp->callInfo.C_osi_SleepW);
- printf("\t%10d osi_Sleep\n", cmp->callInfo.C_osi_Sleep);
- printf("\t%10d afs_LookupMCE\n", cmp->callInfo.C_afs_LookupMCE);
- printf("\t%10d afs_MemReadBlk\n", cmp->callInfo.C_afs_MemReadBlk);
- printf("\t%10d afs_MemReadUIO\n", cmp->callInfo.C_afs_MemReadUIO);
- printf("\t%10d afs_MemWriteBlk\n", cmp->callInfo.C_afs_MemWriteBlk);
- printf("\t%10d afs_MemWriteUIO\n", cmp->callInfo.C_afs_MemWriteUIO);
- printf("\t%10d afs_MemCacheStoreProc\n",
- cmp->callInfo.C_afs_MemCacheStoreProc);
- printf("\t%10d afs_MemCacheFetchProc\n",
- cmp->callInfo.C_afs_MemCacheFetchProc);
- printf("\t%10d afs_MemCacheTruncate\n",
- cmp->callInfo.C_afs_MemCacheTruncate);
- printf("\t%10d afs_MemCacheStoreProc\n",
- cmp->callInfo.C_afs_MemCacheStoreProc);
- printf("\t%10d afs_GetNfsClientPag\n",
- cmp->callInfo.C_afs_GetNfsClientPag);
- printf("\t%10d afs_FindNfsClientPag\n",
- cmp->callInfo.C_afs_FindNfsClientPag);
- printf("\t%10d afs_PutNfsClientPag\n",
- cmp->callInfo.C_afs_PutNfsClientPag);
- printf("\t%10d afs_nfsclient_reqhandler\n",
- cmp->callInfo.C_afs_nfsclient_reqhandler);
- printf("\t%10d afs_nfsclient_GC\n", cmp->callInfo.C_afs_nfsclient_GC);
- printf("\t%10d afs_nfsclient_hold\n", cmp->callInfo.C_afs_nfsclient_hold);
- printf("\t%10d afs_nfsclient_stats\n",
- cmp->callInfo.C_afs_nfsclient_stats);
- printf("\t%10d afs_nfsclient_sysname\n",
- cmp->callInfo.C_afs_nfsclient_sysname);
- printf("\t%10d afs_rfs_dispatch\n", cmp->callInfo.C_afs_rfs_dispatch);
- printf("\t%10d afs_nfs2afscall\n", cmp->callInfo.C_Nfs2AfsCall);
- printf("\t%10d afs_sun_xuntext\n", cmp->callInfo.C_afs_sun_xuntext);
- printf("\t%10d osi_Active\n", cmp->callInfo.C_osi_Active);
- printf("\t%10d osi_FlushPages\n", cmp->callInfo.C_osi_FlushPages);
- printf("\t%10d osi_FlushText\n", cmp->callInfo.C_osi_FlushText);
- printf("\t%10d osi_CallProc\n", cmp->callInfo.C_osi_CallProc);
- printf("\t%10d osi_CancelProc\n", cmp->callInfo.C_osi_CancelProc);
- printf("\t%10d osi_Invisible\n", cmp->callInfo.C_osi_Invisible);
- printf("\t%10d osi_Time\n", cmp->callInfo.C_osi_Time);
- printf("\t%10d osi_Alloc\n", cmp->callInfo.C_osi_Alloc);
- printf("\t%10d osi_SetTime\n", cmp->callInfo.C_osi_SetTime);
- printf("\t%10d osi_Dump\n", cmp->callInfo.C_osi_Dump);
- printf("\t%10d osi_Free\n", cmp->callInfo.C_osi_Free);
- printf("\t%10d osi_UFSOpen\n", cmp->callInfo.C_osi_UFSOpen);
- printf("\t%10d osi_Close\n", cmp->callInfo.C_osi_Close);
- printf("\t%10d osi_Stat\n", cmp->callInfo.C_osi_Stat);
- printf("\t%10d osi_Truncate\n", cmp->callInfo.C_osi_Truncate);
- printf("\t%10d osi_Read\n", cmp->callInfo.C_osi_Read);
- printf("\t%10d osi_Write\n", cmp->callInfo.C_osi_Write);
- printf("\t%10d osi_MapStrategy\n", cmp->callInfo.C_osi_MapStrategy);
- printf("\t%10d osi_AllocLargeSpace\n",
- cmp->callInfo.C_osi_AllocLargeSpace);
- printf("\t%10d osi_FreeLargeSpace\n", cmp->callInfo.C_osi_FreeLargeSpace);
- printf("\t%10d osi_AllocSmallSpace\n",
- cmp->callInfo.C_osi_AllocSmallSpace);
- printf("\t%10d osi_FreeSmallSpace\n", cmp->callInfo.C_osi_FreeSmallSpace);
- printf("\t%10d osi_CloseToTheEdge\n", cmp->callInfo.C_osi_CloseToTheEdge);
- printf("\t%10d osi_xgreedy\n", cmp->callInfo.C_osi_xgreedy);
- printf("\t%10d osi_FreeSocket\n", cmp->callInfo.C_osi_FreeSocket);
- printf("\t%10d osi_NewSocket\n", cmp->callInfo.C_osi_NewSocket);
- printf("\t%10d osi_NetSend\n", cmp->callInfo.C_osi_NetSend);
- printf("\t%10d WaitHack\n", cmp->callInfo.C_WaitHack);
- printf("\t%10d osi_CancelWait\n", cmp->callInfo.C_osi_CancelWait);
- printf("\t%10d osi_Wakeup\n", cmp->callInfo.C_osi_Wakeup);
- printf("\t%10d osi_Wait\n", cmp->callInfo.C_osi_Wait);
- printf("\t%10d dirp_Read\n", cmp->callInfo.C_dirp_Read);
- printf("\t%10d dirp_Cpy\n", cmp->callInfo.C_dirp_Cpy);
- printf("\t%10d dirp_Eq\n", cmp->callInfo.C_dirp_Eq);
- printf("\t%10d dirp_Write\n", cmp->callInfo.C_dirp_Write);
- printf("\t%10d dirp_Zap\n", cmp->callInfo.C_dirp_Zap);
- printf("\t%10d afs_ioctl\n", cmp->callInfo.C_afs_ioctl);
- printf("\t%10d handleIoctl\n", cmp->callInfo.C_HandleIoctl);
- printf("\t%10d afs_xioctl\n", cmp->callInfo.C_afs_xioctl);
- printf("\t%10d afs_pioctl\n", cmp->callInfo.C_afs_pioctl);
- printf("\t%10d HandlePioctl\n", cmp->callInfo.C_HandlePioctl);
- printf("\t%10d PGetVolumeStatus\n", cmp->callInfo.C_PGetVolumeStatus);
- printf("\t%10d PSetVolumeStatus\n", cmp->callInfo.C_PSetVolumeStatus);
- printf("\t%10d PFlush\n", cmp->callInfo.C_PFlush);
- printf("\t%10d PFlushVolumeData\n", cmp->callInfo.C_PFlushVolumeData);
- printf("\t%10d PNewStatMount\n", cmp->callInfo.C_PNewStatMount);
- printf("\t%10d PGetTokens\n", cmp->callInfo.C_PGetTokens);
- printf("\t%10d PSetTokens\n", cmp->callInfo.C_PSetTokens);
- printf("\t%10d PUnlog\n", cmp->callInfo.C_PUnlog);
- printf("\t%10d PCheckServers\n", cmp->callInfo.C_PCheckServers);
- printf("\t%10d PCheckAuth\n", cmp->callInfo.C_PCheckAuth);
- printf("\t%10d PCheckVolNames\n", cmp->callInfo.C_PCheckVolNames);
- printf("\t%10d PFindVolume\n", cmp->callInfo.C_PFindVolume);
- printf("\t%10d Prefetch\n", cmp->callInfo.C_Prefetch);
- printf("\t%10d PGetCacheSize\n", cmp->callInfo.C_PGetCacheSize);
- printf("\t%10d PSetCacheSize\n", cmp->callInfo.C_PSetCacheSize);
- printf("\t%10d PSetSysName\n", cmp->callInfo.C_PSetSysName);
- printf("\t%10d PExportAfs\n", cmp->callInfo.C_PExportAfs);
- printf("\t%10d HandleClientContext\n",
- cmp->callInfo.C_HandleClientContext);
- printf("\t%10d PViceAccess\n", cmp->callInfo.C_PViceAccess);
- printf("\t%10d PRemoveCallBack\n", cmp->callInfo.C_PRemoveCallBack);
- printf("\t%10d PRemoveMount\n", cmp->callInfo.C_PRemoveMount);
- printf("\t%10d PSetVolumeStatus\n", cmp->callInfo.C_PSetVolumeStatus);
- printf("\t%10d PListCells\n", cmp->callInfo.C_PListCells);
- printf("\t%10d PNewCell\n", cmp->callInfo.C_PNewCell);
- printf("\t%10d PGetUserCell\n", cmp->callInfo.C_PGetUserCell);
- printf("\t%10d PGetCellStatus\n", cmp->callInfo.C_PGetCellStatus);
- printf("\t%10d PSetCellStatus\n", cmp->callInfo.C_PSetCellStatus);
- printf("\t%10d PVenusLogging\n", cmp->callInfo.C_PVenusLogging);
- printf("\t%10d PGetAcl\n", cmp->callInfo.C_PGetAcl);
- printf("\t%10d PGetFID\n", cmp->callInfo.C_PGetFID);
- printf("\t%10d PSetAcl\n", cmp->callInfo.C_PSetAcl);
- printf("\t%10d PGetFileCell\n", cmp->callInfo.C_PGetFileCell);
- printf("\t%10d PGetWSCell\n", cmp->callInfo.C_PGetWSCell);
- printf("\t%10d PGetSPrefs\n", cmp->callInfo.C_PGetSPrefs);
- printf("\t%10d PSetSPrefs\n", cmp->callInfo.C_PSetSPrefs);
- printf("\t%10d afs_ResetAccessCache\n",
- cmp->callInfo.C_afs_ResetAccessCache);
- printf("\t%10d afs_FindUser\n", cmp->callInfo.C_afs_FindUser);
- printf("\t%10d afs_GetUser\n", cmp->callInfo.C_afs_GetUser);
- printf("\t%10d afs_GCUserData\n", cmp->callInfo.C_afs_GCUserData);
- printf("\t%10d afs_PutUser\n", cmp->callInfo.C_afs_PutUser);
- printf("\t%10d afs_SetPrimary\n", cmp->callInfo.C_afs_SetPrimary);
- printf("\t%10d afs_ResetUserConns\n", cmp->callInfo.C_afs_ResetUserConns);
- printf("\t%10d afs_RemoveUserConns\n", cmp->callInfo.C_RemoveUserConns);
- printf("\t%10d afs_ResourceInit\n", cmp->callInfo.C_afs_ResourceInit);
- printf("\t%10d afs_GetCell\n", cmp->callInfo.C_afs_GetCell);
- printf("\t%10d afs_GetCellByIndex\n", cmp->callInfo.C_afs_GetCellByIndex);
- printf("\t%10d afs_GetCellByName\n", cmp->callInfo.C_afs_GetCellByName);
- printf("\t%10d afs_GetRealCellByIndex\n",
- cmp->callInfo.C_afs_GetRealCellByIndex);
- printf("\t%10d afs_NewCell\n", cmp->callInfo.C_afs_NewCell);
- printf("\t%10d CheckVLDB\n", cmp->callInfo.C_CheckVLDB);
- printf("\t%10d afs_GetVolume\n", cmp->callInfo.C_afs_GetVolume);
- printf("\t%10d afs_PutVolume\n", cmp->callInfo.C_afs_PutVolume);
- printf("\t%10d afs_GetVolumeByName\n",
- cmp->callInfo.C_afs_GetVolumeByName);
- printf("\t%10d afs_random\n", cmp->callInfo.C_afs_random);
- printf("\t%10d InstallVolumeEntry\n", cmp->callInfo.C_InstallVolumeEntry);
- printf("\t%10d InstallVolumeInfo\n", cmp->callInfo.C_InstallVolumeInfo);
- printf("\t%10d afs_ResetVolumeInfo\n",
- cmp->callInfo.C_afs_ResetVolumeInfo);
- printf("\t%10d afs_FindServer\n", cmp->callInfo.C_afs_FindServer);
- printf("\t%10d afs_GetServer\n", cmp->callInfo.C_afs_GetServer);
- printf("\t%10d afs_SortServers\n", cmp->callInfo.C_afs_SortServers);
- printf("\t%10d afs_CheckServers\n", cmp->callInfo.C_afs_CheckServers);
- printf("\t%10d ServerDown\n", cmp->callInfo.C_ServerDown);
- printf("\t%10d afs_Conn\n", cmp->callInfo.C_afs_Conn);
- printf("\t%10d afs_PutConn\n", cmp->callInfo.C_afs_PutConn);
- printf("\t%10d afs_ConnByHost\n", cmp->callInfo.C_afs_ConnByHost);
- printf("\t%10d afs_ConnByMHosts\n", cmp->callInfo.C_afs_ConnByMHosts);
- printf("\t%10d afs_Analyze\n", cmp->callInfo.C_afs_Analyze);
- printf("\t%10d CheckVLServer\n", cmp->callInfo.C_CheckVLServer);
- printf("\t%10d afs_CheckCacheResets\n",
- cmp->callInfo.C_afs_CheckCacheResets);
- printf("\t%10d afs_CheckVolumeNames\n",
- cmp->callInfo.C_afs_CheckVolumeNames);
- printf("\t%10d afs_CheckCode\n", cmp->callInfo.C_afs_CheckCode);
- printf("\t%10d afs_CopyError\n", cmp->callInfo.C_afs_CopyError);
- printf("\t%10d afs_FinalizeReq\n", cmp->callInfo.C_afs_FinalizeReq);
- printf("\t%10d afs_GetVolCache\n", cmp->callInfo.C_afs_GetVolCache);
- printf("\t%10d afs_GetVolSlot\n", cmp->callInfo.C_afs_GetVolSlot);
- printf("\t%10d afs_UFSGetVolSlot\n", cmp->callInfo.C_afs_UFSGetVolSlot);
- printf("\t%10d afs_MemGetVolSlot\n", cmp->callInfo.C_afs_MemGetVolSlot);
- printf("\t%10d afs_WriteVolCache\n", cmp->callInfo.C_afs_WriteVolCache);
- printf("\t%10d haveCallbacksfrom\n", cmp->callInfo.C_HaveCallBacksFrom);
- printf("\t%10d afs_getpage\n", cmp->callInfo.C_afs_getpage);
- printf("\t%10d afs_putpage\n", cmp->callInfo.C_afs_putpage);
- printf("\t%10d afs_nfsrdwr\n", cmp->callInfo.C_afs_nfsrdwr);
- printf("\t%10d afs_map\n", cmp->callInfo.C_afs_map);
- printf("\t%10d afs_cmp\n", cmp->callInfo.C_afs_cmp);
- printf("\t%10d afs_PageLeft\n", cmp->callInfo.C_afs_PageLeft);
- printf("\t%10d afs_mount\n", cmp->callInfo.C_afs_mount);
- printf("\t%10d afs_unmount\n", cmp->callInfo.C_afs_unmount);
- printf("\t%10d afs_root\n", cmp->callInfo.C_afs_root);
- printf("\t%10d afs_statfs\n", cmp->callInfo.C_afs_statfs);
- printf("\t%10d afs_sync\n", cmp->callInfo.C_afs_sync);
- printf("\t%10d afs_vget\n", cmp->callInfo.C_afs_vget);
- printf("\t%10d afs_index\n", cmp->callInfo.C_afs_index);
- printf("\t%10d afs_setpag\n", cmp->callInfo.C_afs_setpag);
- printf("\t%10d genpag\n", cmp->callInfo.C_genpag);
- printf("\t%10d getpag\n", cmp->callInfo.C_getpag);
- printf("\t%10d genpag\n", cmp->callInfo.C_genpag);
- printf("\t%10d afs_GetMariner\n", cmp->callInfo.C_afs_GetMariner);
- printf("\t%10d afs_AddMarinerName\n", cmp->callInfo.C_afs_AddMarinerName);
- printf("\t%10d afs_open\n", cmp->callInfo.C_afs_open);
- printf("\t%10d afs_close\n", cmp->callInfo.C_afs_close);
- printf("\t%10d afs_closex\n", cmp->callInfo.C_afs_closex);
- printf("\t%10d afs_write\n", cmp->callInfo.C_afs_write);
- printf("\t%10d afs_UFSwrite\n", cmp->callInfo.C_afs_UFSWrite);
- printf("\t%10d afs_Memwrite\n", cmp->callInfo.C_afs_MemWrite);
- printf("\t%10d afs_rdwr\n", cmp->callInfo.C_afs_rdwr);
- printf("\t%10d afs_read\n", cmp->callInfo.C_afs_read);
- printf("\t%10d afs_UFSread\n", cmp->callInfo.C_afs_UFSRead);
- printf("\t%10d afs_Memread\n", cmp->callInfo.C_afs_MemRead);
- printf("\t%10d afs_CopyOutAttrs\n", cmp->callInfo.C_afs_CopyOutAttrs);
- printf("\t%10d afs_access\n", cmp->callInfo.C_afs_access);
- printf("\t%10d afs_getattr\n", cmp->callInfo.C_afs_getattr);
- printf("\t%10d afs_setattr\n", cmp->callInfo.C_afs_setattr);
- printf("\t%10d afs_VAttrToAS\n", cmp->callInfo.C_afs_VAttrToAS);
- printf("\t%10d EvalMountPoint\n", cmp->callInfo.C_EvalMountPoint);
- printf("\t%10d afs_lookup\n", cmp->callInfo.C_afs_lookup);
- printf("\t%10d afs_create\n", cmp->callInfo.C_afs_create);
- printf("\t%10d afs_LocalHero\n", cmp->callInfo.C_afs_LocalHero);
- printf("\t%10d afs_remove\n", cmp->callInfo.C_afs_remove);
- printf("\t%10d afs_link\n", cmp->callInfo.C_afs_link);
- printf("\t%10d afs_rename\n", cmp->callInfo.C_afs_rename);
- printf("\t%10d afs_InitReq\n", cmp->callInfo.C_afs_InitReq);
- printf("\t%10d afs_mkdir\n", cmp->callInfo.C_afs_mkdir);
- printf("\t%10d afs_rmdir\n", cmp->callInfo.C_afs_rmdir);
- printf("\t%10d afs_readdir\n", cmp->callInfo.C_afs_readdir);
- printf("\t%10d afs_read1dir\n", cmp->callInfo.C_afs_read1dir);
- printf("\t%10d afs_readdir_move\n", cmp->callInfo.C_afs_readdir_move);
- printf("\t%10d afs_readdir_iter\n", cmp->callInfo.C_afs_readdir_iter);
- printf("\t%10d afs_symlink\n", cmp->callInfo.C_afs_symlink);
- printf("\t%10d afs_HandleLink\n", cmp->callInfo.C_afs_HandleLink);
- printf("\t%10d afs_MemHandleLink\n", cmp->callInfo.C_afs_MemHandleLink);
- printf("\t%10d afs_UFSHandleLink\n", cmp->callInfo.C_afs_UFSHandleLink);
- printf("\t%10d HandleFlock\n", cmp->callInfo.C_HandleFlock);
- printf("\t%10d afs_readlink\n", cmp->callInfo.C_afs_readlink);
- printf("\t%10d afs_fsync\n", cmp->callInfo.C_afs_fsync);
- printf("\t%10d afs_inactive\n", cmp->callInfo.C_afs_inactive);
- printf("\t%10d afs_ustrategy\n", cmp->callInfo.C_afs_ustrategy);
- printf("\t%10d afs_strategy\n", cmp->callInfo.C_afs_strategy);
- printf("\t%10d afs_bread\n", cmp->callInfo.C_afs_bread);
- printf("\t%10d afs_brelse\n", cmp->callInfo.C_afs_brelse);
- printf("\t%10d afs_bmap\n", cmp->callInfo.C_afs_bmap);
- printf("\t%10d afs_fid\n", cmp->callInfo.C_afs_fid);
- printf("\t%10d afs_FakeOpen\n", cmp->callInfo.C_afs_FakeOpen);
- printf("\t%10d afs_FakeClose\n", cmp->callInfo.C_afs_FakeClose);
- printf("\t%10d afs_StoreOnLastReference\n",
- cmp->callInfo.C_afs_StoreOnLastReference);
- printf("\t%10d afs_AccessOK\n", cmp->callInfo.C_afs_AccessOK);
- printf("\t%10d afs_GetAccessBits\n", cmp->callInfo.C_afs_GetAccessBits);
- printf("\t%10d afsio_copy\n", cmp->callInfo.C_afsio_copy);
- printf("\t%10d afsio_trim\n", cmp->callInfo.C_afsio_trim);
- printf("\t%10d afsio_skip\n", cmp->callInfo.C_afsio_skip);
- printf("\t%10d afs_page_read\n", cmp->callInfo.C_afs_page_read);
- printf("\t%10d afs_page_write\n", cmp->callInfo.C_afs_page_write);
- printf("\t%10d afs_page_read\n", cmp->callInfo.C_afs_page_read);
- printf("\t%10d afs_get_groups_from_pag\n",
- cmp->callInfo.C_afs_get_groups_from_pag);
- printf("\t%10d afs_get_pag_from_groups\n",
- cmp->callInfo.C_afs_get_pag_from_groups);
- printf("\t%10d AddPag\n", cmp->callInfo.C_AddPag);
- printf("\t%10d PagInCred\n", cmp->callInfo.C_PagInCred);
- printf("\t%10d afs_getgroups\n", cmp->callInfo.C_afs_getgroups);
- printf("\t%10d afs_page_in\n", cmp->callInfo.C_afs_page_in);
- printf("\t%10d afs_page_out\n", cmp->callInfo.C_afs_page_out);
- printf("\t%10d afs_AdvanceFD\n", cmp->callInfo.C_afs_AdvanceFD);
- printf("\t%10d afs_lockf\n", cmp->callInfo.C_afs_lockf);
- printf("\t%10d afs_xsetgroups\n", cmp->callInfo.C_afs_xsetgroups);
- printf("\t%10d afs_nlinks\n", cmp->callInfo.C_afs_nlinks);
- printf("\t%10d afs_lockctl\n", cmp->callInfo.C_afs_lockctl);
- printf("\t%10d afs_xflock\n", cmp->callInfo.C_afs_xflock);
- printf("\t%10d PGetCPrefs\n", cmp->callInfo.C_PGetCPrefs);
- printf("\t%10d PSetCPrefs\n", cmp->callInfo.C_PSetCPrefs);
-#ifdef AFS_HPUX_ENV
- printf("\t%10d afs_pagein\n", cmp->callInfo.C_afs_pagein);
- printf("\t%10d afs_pageout\n", cmp->callInfo.C_afs_pageout);
- printf("\t%10d afs_hp_strategy\n", cmp->callInfo.C_afs_hp_strategy);
-#endif
-}
-
-#endif
+++ /dev/null
-#!/bin/sh
-# Copyright 2000, International Business Machines Corporation and others.
-# All Rights Reserved.
-#
-# This software has been released under the terms of the IBM Public
-# License. For details, see the LICENSE file in the top-level source
-# directory or online at http://www.openafs.org/dl/license10.html
-
-## Wrapper script for kdump on HP-UX 11.
-
-BITS=32
-if ans=`[ -x /usr/bin/getconf ] && /usr/bin/getconf KERNEL_BITS 2>/dev/null`
-then BITS=$ans
-fi
-
-exec $0${BITS} ${1+"$@"}
+++ /dev/null
-#!/bin/sh
-# Copyright 2000, International Business Machines Corporation and others.
-# All Rights Reserved.
-#
-# This software has been released under the terms of the IBM Public
-# License. For details, see the LICENSE file in the top-level source
-# directory or online at http://www.openafs.org/dl/license10.html
-
-## Wrapper script for kdump on Linux.
-
-REL=`uname -r`
-DASH='-'
-exec $0${DASH}${REL} ${1+"$@"}
+++ /dev/null
-#!/bin/sh
-# Copyright 2000, International Business Machines Corporation and others.
-# All Rights Reserved.
-#
-# This software has been released under the terms of the IBM Public
-# License. For details, see the LICENSE file in the top-level source
-# directory or online at http://www.openafs.org/dl/license10.html
-
-# kdump: front end script for AFS kdump.IPxx on SGI Irix platforms
-#
-
-IPNO=`uname -m`
-
-exec kdump.$IPNO ${1+"$@"}
+++ /dev/null
-#!/bin/sh
-# Copyright 2000, International Business Machines Corporation and others.
-# All Rights Reserved.
-#
-# This software has been released under the terms of the IBM Public
-# License. For details, see the LICENSE file in the top-level source
-# directory or online at http://www.openafs.org/dl/license10.html
-
-## Wrapper script for kdump on Solaris 7.
-
-BITS=32
-
-## Determine the bittedness of the OS
-
-if [ -x /bin/isalist ]
-then
- case `/bin/isalist` in
- *sparcv9* ) BITS=64 ;;
- esac
-else
- echo "/bin/isalist not executable"
- exit 1
-fi
-
-## Execute the appropriate kdump and pass it all arguments
-
-exec $0${BITS} ${1+"$@"}
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;
return code;
}
-afs_int32
-SRXAFS_StoreACL(struct rx_call * acall, struct AFSFid * Fid,
+static char *
+printableACL(struct AFSOpaque *AccessList)
+{
+ char *s;
+ size_t i;
+
+ s = calloc(1, AccessList->AFSOpaque_len + 1);
+ if (s == NULL)
+ return NULL;
+
+ for (i = 0; i < AccessList->AFSOpaque_len; i++) {
+ if (AccessList->AFSOpaque_val[i] == '\n')
+ s[i] = ' ';
+ else
+ s[i] = AccessList->AFSOpaque_val[i];
+ }
+ return s;
+}
+
+static afs_int32
+common_StoreACL(afs_uint64 opcode,
+ struct rx_call * acall, struct AFSFid * Fid,
struct AFSOpaque * AccessList,
struct AFSFetchStatus * OutStatus, struct AFSVolSync * Sync)
{
struct client *t_client = NULL; /* tmp ptr to client data */
struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct fsstats fsstats;
+ char *displayACL = NULL;
+ int newOpcode = (opcode == opcode_RXAFS_StoreACL);
fsstats_StartOp(&fsstats, FS_STATS_RPCIDX_STOREACL);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
logHostAddr.s_addr = rxr_HostOf(tcon);
- ViceLog(1,
- ("SAFS_StoreACL, Fid = %u.%u.%u, ACL=%s, Host %s:%d, Id %d\n",
- Fid->Volume, Fid->Vnode, Fid->Unique, AccessList->AFSOpaque_val,
+ displayACL = printableACL(AccessList);
+ ViceLog(newOpcode ? 1 : 0,
+ ("SAFS_StoreACL%s, Fid = %u.%u.%u, ACL=%s, Host %s:%d, Id %d\n",
+ newOpcode ? "" : " CVE-2018-7168",
+ Fid->Volume, Fid->Vnode, Fid->Unique,
+ displayACL == NULL ? AccessList->AFSOpaque_val : displayACL,
inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->z.ViceId));
FS_LOCK;
AFSCallStats.StoreACL++, AFSCallStats.TotalCalls++;
goto Bad_StoreACL;
}
+ if (opcode == opcode_RXAFS_OldStoreACL && !enable_old_store_acl) {
+ /* CVE-2018-7168 - administratively prohibited */
+ errorCode = EPERM;
+ goto Bad_StoreACL;
+ }
+
/* Build and store the new Access List for the dir */
if ((errorCode = RXStore_AccessList(targetptr, AccessList))) {
goto Bad_StoreACL;
/* Update and store volume/vnode and parent vnodes back */
PutVolumePackage(acall, parentwhentargetnotdir, targetptr, (Vnode *) 0,
volptr, &client);
- ViceLog(2, ("SAFS_StoreACL returns %d\n", errorCode));
+
+ ViceLog(2, ("%s returns %d\n",
+ opcode == opcode_RXAFS_StoreACL ? "SAFS_StoreACL"
+ : "SAFS_OldStoreACL",
+ errorCode));
errorCode = CallPostamble(tcon, errorCode, thost);
fsstats_FinishOp(&fsstats, errorCode);
osi_auditU(acall, StoreACLEvent, errorCode,
AUD_ID, t_client ? t_client->z.ViceId : 0,
- AUD_FID, Fid, AUD_ACL, AccessList->AFSOpaque_val, AUD_END);
+ AUD_FID, Fid, AUD_ACL,
+ displayACL == NULL ? AccessList->AFSOpaque_val : displayACL,
+ AUD_END);
+ free(displayACL);
return errorCode;
} /*SRXAFS_StoreACL */
+/* SRXAFS_OldStoreACL (Deprecated - CVE-2018-7168 */
+afs_int32
+SRXAFS_OldStoreACL(struct rx_call *acall, struct AFSFid *Fid,
+ struct AFSOpaque *AccessList,
+ struct AFSFetchStatus *OutStatus, struct AFSVolSync *Sync)
+{
+ return common_StoreACL(opcode_RXAFS_OldStoreACL, acall, Fid, AccessList,
+ OutStatus, Sync);
+}
+
+afs_int32
+SRXAFS_StoreACL(struct rx_call *acall, struct AFSFid *Fid,
+ struct AFSOpaque *AccessList,
+ struct AFSFetchStatus *OutStatus, struct AFSVolSync *Sync)
+{
+ return common_StoreACL(opcode_RXAFS_StoreACL, acall, Fid, AccessList,
+ OutStatus, Sync);
+}
/*
* Note: This routine is called exclusively from SRXAFS_StoreStatus(), and
FDH_CLOSE(lhp);
if (*lc < 0)
return -1;
- *size = OS_SIZE(fdP->fd_fd);
+ *size = FDH_SIZE(fdP);
return (*size == -1) ? -1 : 0;
#else
struct afs_stat status;
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 {
cbstuff.AddCallBacks, cbstuff.BreakCallBacks,
cbstuff.DeleteCallBacks, cbstuff.DeleteFiles, cbstuff.CBsTimedOut,
cbstuff.GotSomeSpaces, cbstuff.DeleteAllCallBacks);
- fprintf(stderr, "%d CBs, %d FEs, (%d of total of %d 16-byte blocks)\n",
+ fprintf(stderr, "%d CBs, %d FEs, (%d of total of %d %d-byte blocks)\n",
cbstuff.nCBs, cbstuff.nFEs, cbstuff.nCBs + cbstuff.nFEs,
- cbstuff.nblks);
+ cbstuff.nblks, (int) sizeof(struct CallBack));
fprintf(stderr, "%d GSS1, %d GSS2, %d GSS3, %d GSS4, %d GSS5 (internal counters)\n",
cbstuff.GSS1, cbstuff.GSS2, cbstuff.GSS3, cbstuff.GSS4, cbstuff.GSS5);
goto done;
}
if (chain_len > FS_STATE_HCB_MAX_LIST_LEN) {
- ViceLog(0, ("cb_stateVerifyFCBList: error: list length exceeds %d (h->index=%d); assuming there's a loop\n",
+ ViceLog(0, ("cb_stateVerifyHCBList: error: list length exceeds %d (h->index=%d); assuming there's a loop\n",
FS_STATE_HCB_MAX_LIST_LEN, hi));
ret = 1;
goto done;
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) +
/* setup FE map entry */
if (!in->index || (in->index >= state->fe_map.len)) {
- ViceLog(0, ("cb_stateDiskEntryToFE: index (%d) out of range",
+ ViceLog(0, ("cb_stateDiskEntryToFE: index (%d) out of range\n",
in->index));
ret = 1;
goto done;
multi_Abort;
}
}
- multi_End_Ignore;
+ multi_End;
H_LOCK;
/* Destroy all connections except the one on which we succeeded */
for (i = 0; i < j; i++)
FS_STATE_UNLOCK;
#endif
}
- multi_End_Ignore;
+ multi_End;
H_LOCK;
/* Destroy all connections except the one on which we succeeded */
for (i = 0; i < j; i++)
host->z.hcps.prlist_val = NULL;
host->z.hcps.prlist_len = 0;
host->z.interface = NULL;
-#ifdef undef
- host->z.hcpsfailed = 0; /* save cycles */
- h_gethostcps(host); /* do this under host hold/lock */
-#endif
host->z.FirstClient = NULL;
h_InsertList_r(host); /* update global host List */
/*
{
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;
}
int udpBufSize = 0; /* UDP buffer size for receive */
int sendBufSize = 16384; /* send buffer size */
int saneacls = 0; /* Sane ACLs Flag */
+int enable_old_store_acl = 1; /* -cve-2018-7168-enforce */
static int unsafe_attach = 0; /* avoid inUse check on vol attach? */
static int offline_timeout = -1; /* -offline-timeout option */
static int offline_shutdown_timeout = -1; /* -offline-shutdown-timeout option */
viced_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
{
afs_uint32 rcode;
-# ifndef AFS_LINUX20_ENV
+# ifndef AFS_LINUX_ENV
void (*old) (int);
old = (void (*)(int))signal(SIGSYS, SIG_IGN);
# endif
rcode = syscall(AFS_SYSCALL, 28 /* AFSCALL_CALL */ , a3, a4, a5);
-# ifndef AFS_LINUX20_ENV
+# ifndef AFS_LINUX_ENV
signal(SIGSYS, old);
# endif
code = opr_cv_timedwait(&fsync_cond, &fsync_glock_mutex,
&fsync_next);
- if (code != 0 && code != ETIMEDOUT)
- ViceLog(0, ("pthread_cond_timedwait returned %d\n", code));
FSYNC_UNLOCK;
#ifdef AFS_DEMAND_ATTACH_FS
OPT_readonly,
OPT_adminwrite,
OPT_saneacls,
+ OPT_cve_2018_7168,
OPT_buffers,
OPT_callbacks,
OPT_vcsize,
"from system:administrators");
cmd_AddParmAtOffset(opts, OPT_saneacls, "-saneacls", CMD_FLAG,
CMD_OPTIONAL, "set the saneacls capability bit");
+ cmd_AddParmAtOffset(opts, OPT_cve_2018_7168, "-cve-2018-7168-enforce", CMD_FLAG,
+ CMD_OPTIONAL, "disable (unreliable) old store acls rpc (opcode 134)");
cmd_AddParmAtOffset(opts, OPT_buffers, "-b", CMD_SINGLE,
CMD_OPTIONAL, "buffers");
cmd_OptionAsFlag(opts, OPT_readonly, &readonlyServer);
cmd_OptionAsFlag(opts, OPT_adminwrite, &adminwriteServer);
cmd_OptionAsFlag(opts, OPT_saneacls, &saneacls);
+ optval = 0;
+ cmd_OptionAsFlag(opts, OPT_cve_2018_7168, &optval);
+ if (optval != 0)
+ enable_old_store_acl = 0;
cmd_OptionAsInt(opts, OPT_buffers, &buffs);
if (cmd_OptionAsInt(opts, OPT_callbacks, &numberofcbs) == 0) {
}
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));
else if (stackSize > 44000)
stackSize = 44000;
#endif
-#if defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV) || defined(AFS_SGI51_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_XBSD_ENV)
rx_SetStackSize(1, stackSize);
#endif
if (udpBufSize)
extern int busyonrst;
extern int saneacls;
+extern int enable_old_store_acl;
#define RESTART_ORDINARY 1
#define RESTART_FAST 2
("\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",
hashindex = strlen(volname); /* really string length */
if (hashindex >= 8 && strcmp(volname + hashindex - 7, ".backup") == 0) {
/* this is a backup volume */
- strcpy(tname, volname);
+ if (strlcpy(tname, volname, sizeof(tname)) >= sizeof(tname)) {
+ *error = VL_BADNAME;
+ return 0;
+ }
tname[hashindex - 7] = 0; /* zap extension */
} else if (hashindex >= 10
&& strcmp(volname + hashindex - 9, ".readonly") == 0) {
/* this is a readonly volume */
- strcpy(tname, volname);
+ if (strlcpy(tname, volname, sizeof(tname)) >= sizeof(tname)) {
+ *error = VL_BADNAME;
+ return 0;
+ }
tname[hashindex - 9] = 0; /* zap extension */
- } else
- strcpy(tname, volname);
+ } else {
+ if (strlcpy(tname, volname, sizeof(tname)) >= sizeof(tname)) {
+ *error = VL_BADNAME;
+ return 0;
+ }
+ }
*error = 0;
hashindex = NameHash(tname);
/* 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 */
}
}
afs_int64 _##buf##_l[SYNC_PROTO_MAX_LEN/sizeof(afs_int64)]; \
char * buf = (char *)(_##buf##_l)
-#ifdef AFS_LINUX26_ENV
+#ifdef AFS_LINUX_ENV
/* Some Linux kernels have a bug where we are not woken up immediately from a
* select() when data is available. Work around this by having a low select()
* timeout, so we don't hang in those situations. */
#include <sys/resource.h>
#endif
+#ifdef AFS_AIX_ENV
+# include <sys/statfs.h>
+#endif
+
#include <afs/opr.h>
#ifdef AFS_PTHREAD_ENV
# include <opr/lock.h>
FdHandle_t *fdLruTail;
int ih_Inited = 0;
-int ih_PkgDefaultsSet = 0;
/* Most of the servers use fopen/fdopen. Since the FILE structure
* only has eight bits for the file descriptor, the cache size
/* start-time configurable I/O limits */
ih_init_params vol_io_params;
-void ih_PkgDefaults(void)
+void
+ih_PkgDefaults(void)
{
- /* once */
+ static int ih_PkgDefaultsSet = 0;
+
+ IH_LOCK;
+ if (ih_PkgDefaultsSet) {
+ IH_UNLOCK;
+ return;
+ }
+
ih_PkgDefaultsSet = 1;
/* default to well-known values */
vol_io_params.fd_max_cachesize = FD_MAX_CACHESIZE;
vol_io_params.sync_behavior = IH_SYNC_ONCLOSE;
+ IH_UNLOCK;
}
int
void
ih_UseLargeCache(void)
{
- IH_LOCK;
+ ih_PkgDefaults();
- if (!ih_PkgDefaultsSet) {
- ih_PkgDefaults();
- }
+ IH_LOCK;
if (!ih_Inited) {
ih_Initialize();
int ihash = IH_HASH(dev, vid, ino);
IHandle_t *ihP;
- if (!ih_PkgDefaultsSet) {
- ih_PkgDefaults();
- }
+ ih_PkgDefaults();
IH_LOCK;
if (!ih_Inited) {
int p3, int p4)
{
Inode ino;
+
+ ih_PkgDefaults();
+
#ifdef AFS_3DISPARES
/* See viceinode.h */
if (p2 == INODESPECIAL) {
opr_Assert(0);
}
}
+
+#ifdef AFS_NT40_ENV
+
+static int
+os_blocksize(FD_t fd, afs_sfsize_t *a_size, afs_sfsize_t *a_blksize)
+{
+ LARGE_INTEGER fileSize;
+
+ if (!GetFileSizeEx(fd, &fileSize)) {
+ return GetLastError();
+ }
+
+ *a_size = fileSize.QuadPart;
+ *a_blksize = 4096;
+
+ return 0;
+}
+
+#else /* AFS_NT40_ENV */
+
+# ifdef AFS_AIX_ENV
+static int
+get_blksize_aix(FD_t fd, afs_sfsize_t *a_blksize)
+{
+ int code;
+# ifdef AFS_AIX52_ENV
+ struct statfs64 tstatfs;
+ code = fstatfs64(fd, &tstatfs);
+# else
+ struct statfs tstatfs;
+ code = fstatfs(fd, &tstatfs);
+# endif
+ if (code != 0) {
+ return errno;
+ }
+ *a_blksize = tstatfs.f_bsize;
+ return 0;
+}
+# endif /* AFS_AIX_ENV */
+
+static int
+os_blocksize(FD_t fd, afs_sfsize_t *a_size, afs_sfsize_t *a_blksize)
+{
+ int code;
+ struct afs_stat status;
+ code = afs_fstat(fd, &status);
+ if (code < 0) {
+ return errno;
+ }
+
+ *a_size = status.st_size;
+
+# ifdef AFS_AIX_ENV
+ /* In AIX, st_blksize is not in struct stat; get it from fstatfs instead. */
+ return get_blksize_aix(fd, a_blksize);
+# else
+ *a_blksize = status.st_blksize;
+ return 0;
+# endif
+}
+
+#endif /* AFS_NT40_ENV */
+
+/**
+ * Get the size and blocksize for a file handle.
+ *
+ * @param[in] fdP The file handle to query
+ * @param[out] a_size The size of the underlying file
+ * @param[out] a_blksize The block size of the underlying file
+ *
+ * @return errno error codes
+ */
+int
+fd_blocksize(FdHandle_t *fdP, afs_sfsize_t *a_size, afs_sfsize_t *a_blksize)
+{
+ return os_blocksize(fdP->fd_fd, a_size, a_blksize);
+}
* IH_INC/IH_DEC - increment/decrement the link count.
*
* Replacements for C runtime file operations
- * FDH_READ/FDH_WRITE - read/write using the file descriptor.
- * FDH_READV/FDH_WRITEV - readv/writev (Unix only)
- * FDH_SEEK - set file handle's read/write position
* FDH_CLOSE - return a file descriptor to the cache
* FDH_REALLYCLOSE - Close a file descriptor, do not return to the cache
* FDH_SYNC - Unconditionally sync an open file.
*
* status information:
* FDH_SIZE - returns the size of the file.
+ * FDH_BLOCKSIZE - returns the size and blocksize of the file.
* FDH_NLINK - returns the link count of the file.
* FDH_ISUNLINKED - returns if the file has been unlinked out from under us
*
extern int ih_condsync(IHandle_t * ihP);
extern FdHandle_t *ih_attachfd(IHandle_t * ihP, FD_t fd);
+extern int fd_blocksize(FdHandle_t *fdP, afs_sfsize_t *a_size,
+ afs_sfsize_t *a_blksize);
+
/* Macros common to user space and inode API's. */
#define IH_INIT(H, D, V, I) ((H) = ih_init((D), (V), (I)))
#define IH_COPY(D, S) ((D) = ih_copy(S))
-#define IH_NLINK(H) ih_nlink(H)
-
#define IH_OPEN(H) ih_open(H)
#define FDH_CLOSE(H) (fd_close(H), (H)=NULL)
#define FDH_FDOPEN(H, A) stream_fdopen((H)->fd_fd)
-#define STREAM_FDOPEN(A, B) stream_fdopen(A)
-
#define STREAM_OPEN(A, B) stream_open(A, B)
#define STREAM_READ(A, B, C, H) stream_read(A, B, C, H)
# define IH_CREATE(H, D, P, N, P1, P2, P3, P4) \
ih_icreate(H, D, P, N, P1, P2, P3, P4)
-# ifdef AFS_LINUX22_ENV
+# ifdef AFS_LINUX_ENV
# define OS_IOPEN(H) -1
# else
# ifdef O_LARGEFILE
# define OS_SYNC(FD) fsync(FD)
-# ifdef AFS_LINUX22_ENV
+# ifdef AFS_LINUX_ENV
# define IH_INC(H, I, P) -1
# define IH_DEC(H, I, P) -1
# define IH_IREAD(H, O, B, S) -1
O, B, S)
# define IH_IWRITE(H, O, B, S) \
inode_write((H)->ih_dev, (H)->ih_ino, (H)->ih_vid, O, B, S)
-# endif /* AFS_LINUX22_ENV */
+# endif /* AFS_LINUX_ENV */
#endif /* AFS_NAMEI_ENV */
#define OS_SIZE(FD) ih_size(FD)
extern afs_sfsize_t ih_size(FD_t);
-#ifndef AFS_NT40_ENV
-# define FDH_READV(H, I, N) readv((H)->fd_fd, I, N)
-# define FDH_WRITEV(H, I, N) writev((H)->fd_fd, I, N)
-#endif
-
#ifdef HAVE_PIOV
# ifdef O_LARGEFILE
# define FDH_PREADV(H, I, N, O) preadv64((H)->fd_fd, I, N, O)
#define FDH_PREAD(H, B, S, O) OS_PREAD((H)->fd_fd, B, S, O)
#define FDH_PWRITE(H, B, S, O) OS_PWRITE((H)->fd_fd, B, S, O)
-#define FDH_READ(H, B, S) OS_READ((H)->fd_fd, B, S)
-#define FDH_WRITE(H, B, S) OS_WRITE((H)->fd_fd, B, S)
-#define FDH_SEEK(H, O, F) OS_SEEK((H)->fd_fd, O, F)
#define FDH_SYNC(H) ih_fdsync(H)
#define FDH_TRUNC(H, L) OS_TRUNC((H)->fd_fd, L)
#define FDH_SIZE(H) OS_SIZE((H)->fd_fd)
+#define FDH_BLOCKSIZE(H, S, B) fd_blocksize(H, S, B)
#define FDH_LOCKFILE(H, O) OS_LOCKFILE((H)->fd_fd, O)
#define FDH_UNLOCKFILE(H, O) OS_UNLOCKFILE((H)->fd_fd, O)
#define FDH_ISUNLINKED(H) OS_ISUNLINKED((H)->fd_fd)
#include <ctype.h>
#ifndef AFS_NAMEI_ENV
-#if defined(AFS_LINUX20_ENV)
+#if defined(AFS_LINUX_ENV)
/* ListViceInodes
*
* Return codes:
return 0;
}
-#endif /* AFS_LINUX20_ENV */
+#endif /* AFS_LINUX_ENV */
static afs_int32
convertVolumeInfo(FdHandle_t *fdhr, FdHandle_t *fdhw, VolumeId vid)
{
#ifdef AFS_SALSRV_ENV
#include <pthread.h>
#include <afs/work_queue.h>
-#include <afs/thread_pool.h>
#include <vol/vol-salvage.h>
#endif
memset((void *)&tmp, 0, sizeof(IHandle_t));
memset(&tfd, 0, sizeof(FdHandle_t));
+ ih_PkgDefaults();
+
tmp.ih_dev = nt_DriveToDev(part);
if (tmp.ih_dev == -1) {
errno = EINVAL;
memset((void *)&tmp, 0, sizeof(IHandle_t));
+ ih_PkgDefaults();
+
tmp.ih_dev = volutil_GetPartitionID(part);
if (tmp.ih_dev == -1) {
errno = EINVAL;
if (fdP == NULL)
return -1;
+ offset = (vno << LINKTABLE_SHIFT) + 8; /* * 2 + sizeof stamp */
+
/* Only one manipulates at a time. */
if (FDH_LOCKFILE(fdP, offset) != 0) {
FDH_REALLYCLOSE(fdP);
return -1;
}
- offset = (vno << LINKTABLE_SHIFT) + 8; /* * 2 + sizeof stamp */
-
nBytes = FDH_PREAD(fdP, (char *)&row, sizeof(row), offset);
if (nBytes != sizeof(row)) {
if (nBytes != 0)
* 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 ||
struct rx_queue resultlist;
#endif
+ memset(&linkHandle, 0, sizeof(linkHandle));
+
namei_HandleToVolDir(&name, &myIH);
strlcpy(path1, name.n_path, sizeof(path1));
char dirl;
VolumeId volid = myIH->ih_vid;
+ memset(&linkHandle, 0, sizeof(linkHandle));
+
snprintf(fpath, sizeof(fpath), "%s" OS_DIRSEP "%s", dpath, name);
dirH = FindFirstFileEx(fpath, FindExInfoStandard, &data,
return code;
}
-/* PrintInode
+/**
+ * Format a string to print inode numbers.
*
- * returns a static string used to print either 32 or 64 bit inode numbers.
+ * @param[out] s string buffer
+ * @param[in] ino inode number
+ * @returns pointer to formatted inode number string
*/
char *
-PrintInode(char *s, Inode ino)
+PrintInode(afs_ino_str_t s, Inode ino)
{
- static afs_ino_str_t result;
- if (!s)
- s = result;
-
snprintf(s, sizeof(afs_ino_str_t), "%llu", (afs_uintmax_t) ino);
-
return s;
}
#endif
#endif
#else /* AFS_VFSINCL_ENV */
-#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
#include <sys/fs.h>
#endif
#endif /* AFS_VFSINCL_ENV */
#include <sys/mnttab.h>
#include <sys/mntent.h>
#else
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
#include <mntent.h>
#include <sys/statfs.h>
#else
VCheckPartition(char *part, char *devname, int logging)
{
struct afs_stat_st status;
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_NT40_ENV)
char AFSIDatPath[MAXPATHLEN];
#endif
}
#endif
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_NT40_ENV)
strcpy(AFSIDatPath, part);
strcat(AFSIDatPath, "/AFSIDat");
#ifdef AFS_NAMEI_ENV
return -1;
#endif
#endif /* AFS_NAMEI_ENV */
-#endif /* !AFS_LINUX20_ENV && !AFS_NT40_ENV */
+#endif /* !AFS_LINUX_ENV && !AFS_NT40_ENV */
VInitPartition(part, devname, status.st_dev);
}
#endif
-#ifdef AFS_LINUX22_ENV
+#ifdef AFS_LINUX_ENV
int
VAttachPartitions(void)
{
return errors;
}
-#endif /* AFS_LINUX22_ENV */
+#endif /* AFS_LINUX_ENV */
/* This routine is to be called whenever the actual name of the partition
* is required. The canonical name is still in part->name.
#endif
#endif
#else /* AFS_VFSINCL_ENV */
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_DARWIN_ENV)
#include <sys/inode.h>
#endif
#endif /* AFS_VFSINCL_ENV */
#endif
#endif
#else /* AFS_VFSINCL_ENV */
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_DARWIN_ENV)
#include <sys/inode.h>
#endif
#endif /* AFS_VFSINCL_ENV */
struct versionStamp *vsn;
int bad = 0;
int code;
+ afs_ino_str_t inode_str;
vsn = (struct versionStamp *)to;
if (vsn->magic != magic) {
bad++;
fprintf(stderr, "%s: Inode %s: Bad magic %x (%x): IGNORED\n",
- progname, PrintInode(NULL, ih->ih_ino), vsn->magic, magic);
+ progname, PrintInode(inode_str, ih->ih_ino), vsn->magic, magic);
}
/* Check is conditional, in case caller wants to inspect version himself */
bad++;
fprintf(stderr, "%s: Inode %s: Bad version %x (%x): IGNORED\n",
progname,
- PrintInode(NULL, ih->ih_ino), vsn->version, version);
+ PrintInode(inode_str, ih->ih_ino), vsn->version, version);
}
if (bad && opt->fixHeader) {
vsn->magic = magic;
vsn->version = version;
printf("Special index inode %s has a bad header. Reconstructing...\n",
- PrintInode(NULL, ih->ih_ino));
+ PrintInode(inode_str, ih->ih_ino));
code = IH_IWRITE(ih, 0, to, size);
if (code != size) {
fprintf(stderr,
"%s: Write failed for inode %s; header left in damaged state\n",
- progname, PrintInode(NULL, ih->ih_ino));
+ progname, PrintInode(inode_str, ih->ih_ino));
}
}
if (!bad && opt->dumpInfo) {
printf("Inode %s: Good magic %x and version %x\n",
- PrintInode(NULL, ih->ih_ino), magic, version);
+ PrintInode(inode_str, ih->ih_ino), magic, version);
}
return 0;
}
afs_sfsize_t size = -1;
IHandle_t *ih = NULL;
FdHandle_t *fdP = NULL;
+ afs_ino_str_t inode_str;
#ifdef AFS_NAMEI_ENV
namei_t filename;
#endif /* AFS_NAMEI_ENV */
error:
if (opt->dumpInfo) {
- printf("\t%s inode\t= %s (size = ", name, PrintInode(NULL, inode));
+ printf("\t%s inode\t= %s (size = ", name, PrintInode(inode_str, inode));
if (size != -1) {
printf("%lld)\n", size);
} else {
afs_foff_t total;
ssize_t len;
Inode ino = VNDISK_GET_INO(vdp->vnode);
+ afs_ino_str_t inode_str;
if (!VALID_INO(ino)) {
return;
if (fdP == NULL) {
fprintf(stderr,
"%s: Can't open inode %s error %d (ignored)\n",
- progname, PrintInode(NULL, ino), errno);
+ progname, PrintInode(inode_str, ino), errno);
return;
}
- snprintf(nfile, sizeof nfile, "TmpInode.%s", PrintInode(NULL, ino));
+ snprintf(nfile, sizeof nfile, "TmpInode.%s", PrintInode(inode_str, ino));
ofd = afs_open(nfile, O_CREAT | O_RDWR | O_TRUNC, 0600);
if (ofd < 0) {
fprintf(stderr,
unlink(nfile);
fprintf(stderr,
"%s: Error while reading from inode %s (%d)\n",
- progname, PrintInode(NULL, ino), errno);
+ progname, PrintInode(inode_str, ino), errno);
return;
}
if (len == 0)
IH_RELEASE(ih);
close(ofd);
printf("... Copied inode %s to file %s (%lu bytes)\n",
- PrintInode(NULL, ino), nfile, (unsigned long)total);
+ PrintInode(inode_str, ino), nfile, (unsigned long)total);
}
/**
VnodeDiskObject *vnode = vdp->vnode;
afs_fsize_t fileLength;
Inode ino;
+ afs_ino_str_t inode_str;
ino = VNDISK_GET_INO(vnode);
VNDISK_GET_LEN(fileLength, vnode);
vnode->dataVersion, vnode->cloned, (afs_uintmax_t) fileLength,
vnode->linkCount, vnode->parent);
if (opt->dumpInodeNumber)
- printf(" inode: %s", PrintInode(NULL, ino));
+ printf(" inode: %s", PrintInode(inode_str, ino));
if (opt->dumpDate)
printf(" ServerModTime: %s", date(vnode->serverModifyTime));
#if defined(AFS_NAMEI_ENV)
#endif
#endif
#else /* AFS_VFSINCL_ENV */
-#if !defined(AFS_LINUX20_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_LINUX_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_DARWIN_ENV)
#include <sys/inode.h>
#endif
#endif /* AFS_VFSINCL_ENV */
file = FDH_FDOPEN(fdP, "r+");
opr_Assert(file != NULL);
vcp = &VnodeClassInfo[class];
- size = OS_SIZE(fdP->fd_fd);
+ size = FDH_SIZE(fdP);
opr_Assert(size != -1);
nVnodes = (size / vcp->diskSize) - 1;
if (nVnodes > 0) {
opr_Assert(fdP != NULL);
file = FDH_FDOPEN(fdP, "r+");
opr_Assert(file != NULL);
- size = OS_SIZE(fdP->fd_fd);
+ size = FDH_SIZE(fdP);
opr_Assert(size != -1);
vip->nVnodes = (size / vcp->diskSize) - 1;
if (vip->nVnodes > 0) {
#endif
#endif
#else /* AFS_VFSINCL_ENV */
-#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_DARWIN_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX_ENV) && !defined(AFS_XBSD_ENV) && !defined(AFS_DARWIN_ENV)
#include <sys/fs.h>
#endif
#endif /* AFS_VFSINCL_ENV */
#if defined(AFS_SGI_ENV)
#include <mntent.h>
#else
-#ifndef AFS_LINUX20_ENV
+#ifndef AFS_LINUX_ENV
#include <fstab.h> /* Need to find in libc 5, present in libc 6 */
#endif
#endif
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)) {
opr_Assert(file != NULL);
vnode = malloc(vcp->diskSize);
opr_Assert(vnode != NULL);
- size = OS_SIZE(fdP->fd_fd);
+ size = FDH_SIZE(fdP);
opr_Assert(size != -1);
nVnodes = (size <= vcp->diskSize ? 0 : size - vcp->diskSize)
>> vcp->logSize;
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;
}
DumpFile(struct iod *iodp, int vnode, FdHandle_t * handleP)
{
int code = 0, error = 0;
- afs_sfsize_t nbytes, howBig;
+ afs_sfsize_t nbytes, howBig, howMany;
ssize_t n = 0;
- size_t howMany;
afs_foff_t howFar = 0;
byte *p;
afs_uint32 hi, lo;
afs_ino_str_t stmp;
-#ifndef AFS_NT40_ENV
- struct afs_stat status;
-#else
- LARGE_INTEGER fileSize;
-#endif
-#ifdef AFS_AIX_ENV
-#include <sys/statfs.h>
-#if defined(AFS_AIX52_ENV)
- struct statfs64 tstatfs;
-#else /* !AFS_AIX52_ENV */
- struct statfs tstatfs;
-#endif /* !AFS_AIX52_ENV */
- int statfs_code;
-#endif
-#ifdef AFS_NT40_ENV
- if (!GetFileSizeEx(handleP->fd_fd, &fileSize)) {
- Log("DumpFile: GetFileSizeEx returned error code %d on descriptor %d\n", GetLastError(), handleP->fd_fd);
- return VOLSERDUMPERROR;
- }
- howBig = fileSize.QuadPart;
- howMany = 4096;
-
-#else
- afs_fstat(handleP->fd_fd, &status);
- howBig = status.st_size;
-
-#ifdef AFS_AIX_ENV
- /* Unfortunately in AIX valuable fields such as st_blksize are
- * gone from the stat structure.
- */
-#if defined(AFS_AIX52_ENV)
- statfs_code = fstatfs64(handleP->fd_fd, &tstatfs);
-#else /* !AFS_AIX52_ENV */
- statfs_code = fstatfs(handleP->fd_fd, &tstatfs);
-#endif /* !AFS_AIX52_ENV */
- if (statfs_code != 0) {
- Log("DumpFile: fstatfs returned error code %d on descriptor %d\n", errno, handleP->fd_fd);
+ code = FDH_BLOCKSIZE(handleP, &howBig, &howMany);
+ if (code != 0) {
+ Log("DumpFile: FDH_BLOCKSIZE returned error code %d on descriptor %d\n",
+ code, handleP->fd_fd);
return VOLSERDUMPERROR;
}
- howMany = tstatfs.f_bsize;
-#else
- howMany = status.st_blksize;
-#endif /* AFS_AIX_ENV */
-#endif /* AFS_NT40_ENV */
-
SplitInt64(howBig, hi, lo);
if (hi == 0L) {
opr_Assert(fdP != NULL);
file = FDH_FDOPEN(fdP, "r+");
opr_Assert(file != NULL);
- size = OS_SIZE(fdP->fd_fd);
+ size = FDH_SIZE(fdP);
opr_Assert(size != -1);
nVnodes = (size / vcp->diskSize) - 1;
if (nVnodes > 0) {
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) {
STREAM_FLUSH(afile); /* ensure 0s are on the disk */
OS_SYNC(afile->str_fd);
} else {
- size = OS_SIZE(fdP->fd_fd);
+ size = FDH_SIZE(fdP);
opr_Assert(size != -1);
nVnodes =
(size <=
}
if (vnode->type != vNull && VNDISK_GET_INO(vnode)) {
Buf[(offset >> vcp->logSize) - 1] = offset;
- cnt++;
}
offset += vcp->diskSize;
}
opr_Assert(fdP != NULL);
file = FDH_FDOPEN(fdP, "r+");
opr_Assert(file != NULL);
- size = OS_SIZE(fdP->fd_fd);
+ size = FDH_SIZE(fdP);
opr_Assert(size != -1);
nVnodes = (size / vcp->diskSize) - 1;
if (nVnodes > 0) {
AFSVolConvertROtoRWvolume
AFSVolEndTrans
AFSVolListOneVolume
+AFSVolListPartitions
+AFSVolPartitionInfo
+AFSVolPartitionInfo64
AFSVolTransCreate
+AFSVolXListPartitions
EnumerateEntry
Lp_GetRwIndex
Lp_ROMatch
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 code = 0;
afs_int32 pad = 0;
afs_foff_t offset = 0;
- afs_sfsize_t nbytes, howBig;
+ afs_sfsize_t nbytes, size, howMany;
ssize_t n = 0;
- size_t howMany;
afs_foff_t howFar = 0;
byte *p;
afs_uint32 hi, lo;
afs_ino_str_t stmp;
-#ifndef AFS_NT40_ENV
- struct afs_stat status;
-#else
- LARGE_INTEGER fileSize;
-#endif
- afs_sfsize_t size;
-#ifdef AFS_AIX_ENV
-#include <sys/statfs.h>
- struct statfs tstatfs;
-#endif
if (verbose)
fprintf(stderr, "dumping file for vnode %d\n", vnode);
-#ifdef AFS_NT40_ENV
- if (!GetFileSizeEx(handleP->fd_fd, &fileSize)) {
- Log("DumpFile: GetFileSizeEx returned error code %d on descriptor %d\n", GetLastError(), handleP->fd_fd);
- return VOLSERDUMPERROR;
+ code = FDH_BLOCKSIZE(handleP, &size, &howMany);
+ if (code != 0) {
+ fprintf(stderr, "FDH_BLOCKSIZE returned error code %d on descriptor %d\n",
+ code, handleP->fd_fd);
+ return VOLSERDUMPERROR;
}
- howBig = fileSize.QuadPart;
- howMany = 4096;
-
-#else
- afs_fstat(handleP->fd_fd, &status);
- howBig = status.st_size;
-
-#ifdef AFS_AIX_ENV
- /* Unfortunately in AIX valuable fields such as st_blksize are
- * gone from the stat structure.
- */
- fstatfs(handleP->fd_fd, &tstatfs);
- howMany = tstatfs.f_bsize;
-#else
- howMany = status.st_blksize;
-#endif /* AFS_AIX_ENV */
-#endif /* AFS_NT40_ENV */
-
-
- size = FDH_SIZE(handleP);
if (verbose)
- fprintf(stderr, " howBig = %u, howMany = %u, fdh size = %u\n",
- (unsigned int) howBig, (unsigned int) howMany,
- (unsigned int) size);
+ fprintf(stderr, " howMany = %u, fdh size = %u\n",
+ (unsigned int) howMany, (unsigned int) size);
SplitInt64(size, hi, lo);
if (hi == 0L) {
fdP = IH_OPEN(vp->vnodeIndex[class].handle);
file = FDH_FDOPEN(fdP, "r+");
- size = OS_SIZE(fdP->fd_fd);
+ size = FDH_SIZE(fdP);
nVnodes = (size / vcp->diskSize) - 1;
if (nVnodes > 0) {
volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
{
afs_uint32 rcode;
-#ifndef AFS_LINUX20_ENV
+#ifndef AFS_LINUX_ENV
void (*old) (int);
old = signal(SIGSYS, SIG_IGN);
rcode =
syscall(AFS_SYSCALL /* AFS_SYSCALL */ , 28 /* AFSCALL_CALL */ , a3,
a4, a5);
-#ifndef AFS_LINUX20_ENV
+#ifndef AFS_LINUX_ENV
signal(SIGSYS, old);
#endif
afs_int32 aspare2, afs_int32 aspare3,
afs_int32 aspare4, afs_uint32 * anewid,
afs_uint32 * aroid, afs_uint32 * abkid);
-extern int UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname,
- afs_uint32 aid);
extern int UV_MoveVolume(afs_uint32 afromvol, afs_uint32 afromserver,
afs_int32 afrompart, afs_uint32 atoserver,
afs_int32 atopart);
afs_uint32 volid);
extern int UV_ListPartitions(afs_uint32 aserver, struct partList *ptrPartList,
afs_int32 * cntp);
-extern int UV_ZapVolumeClones(afs_uint32 aserver, afs_int32 apart,
- struct volDescription *volPtr,
- afs_int32 arraySize);
-extern int UV_GenerateVolumeClones(afs_uint32 aserver, afs_int32 apart,
- struct volDescription *volPtr,
- afs_int32 arraySize);
extern int UV_ListVolumes(afs_uint32 aserver, afs_int32 apart, int all,
struct volintInfo **resultPtr, afs_int32 * size);
extern int UV_XListVolumes(afs_uint32 a_serverID, afs_int32 a_partID,
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");
return error;
}
-/* create a volume, given a server, partition number, volume name --> sends
-* back new vol id in <anewid>*/
-int
-UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname,
- afs_uint32 aid)
-{
- struct rx_connection *aconn;
- afs_int32 error;
- afs_int32 vcode;
- struct nvldbentry entry, storeEntry; /*the new vldb entry */
-
- memset(&storeEntry, 0, sizeof(struct nvldbentry));
-
- aconn = (struct rx_connection *)0;
- error = 0;
-
- /* set up the vldb entry for this volume */
- strncpy(entry.name, aname, VOLSER_OLDMAXVOLNAME);
- entry.nServers = 1;
- entry.serverNumber[0] = aserver; /* this should have another
- * level of indirection later */
- entry.serverPartition[0] = apart; /* this should also have
- * another indirection level */
- entry.flags = VLF_RWEXISTS; /* this records that rw volume exists */
- entry.serverFlags[0] = VLSF_RWVOL; /*this rep site has rw vol */
- entry.volumeId[RWVOL] = aid;
- entry.volumeId[ROVOL] = 0;
- entry.volumeId[BACKVOL] = 0;
- entry.cloneId = 0;
- /*map into right byte order, before passing to xdr, the stuff has to be in host
- * byte order. Xdr converts it into network order */
- MapNetworkToHost(&entry, &storeEntry);
- /* create the vldb entry */
- vcode = VLDB_CreateEntry(&storeEntry);
- if (vcode) {
- fprintf(STDERR,
- "Could not create a VLDB entry for the volume %s %lu\n",
- aname, (unsigned long)aid);
- error = vcode;
- goto cfail;
- }
- VPRINT2("Created the VLDB entry for the volume %s %u\n", aname, aid);
-
- cfail:
- if (aconn)
- rx_DestroyConnection(aconn);
- PrintError("", error);
- return error;
-}
-
/* Delete the volume <volid>on <aserver> <apart>
* the physical entry gets removed from the vldb only if the ref count
* becomes zero
return code;
}
-
-/*zap the list of volumes specified by volPtrArray (the volCloneId field).
- This is used by the backup system */
-int
-UV_ZapVolumeClones(afs_uint32 aserver, afs_int32 apart,
- struct volDescription *volPtr, afs_int32 arraySize)
-{
- struct rx_connection *aconn;
- struct volDescription *curPtr;
- int curPos;
- afs_int32 code = 0;
- afs_int32 success = 1;
-
- aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
- curPos = 0;
- for (curPtr = volPtr; curPos < arraySize; curPtr++) {
- if (curPtr->volFlags & CLONEVALID) {
- curPtr->volFlags &= ~CLONEZAPPED;
- success = 1;
-
- code = DoVolDelete(aconn, curPtr->volCloneId, apart,
- "clone", 0, NULL, NULL);
- if (code)
- success = 0;
-
- if (success)
- curPtr->volFlags |= CLONEZAPPED;
- if (!success)
- fprintf(STDERR, "Could not zap volume %lu\n",
- (unsigned long)curPtr->volCloneId);
- if (success)
- VPRINT2("Clone of %s %u deleted\n", curPtr->volName,
- curPtr->volCloneId);
- curPos++;
- }
- }
- if (aconn)
- rx_DestroyConnection(aconn);
- return 0;
-}
-
-/*return a list of clones of the volumes specified by volPtrArray. Used by the
- backup system */
-int
-UV_GenerateVolumeClones(afs_uint32 aserver, afs_int32 apart,
- struct volDescription *volPtr, afs_int32 arraySize)
-{
- struct rx_connection *aconn;
- struct volDescription *curPtr;
- int curPos;
- afs_int32 code = 0;
- afs_int32 rcode = 0;
- afs_int32 tid;
- int reuseCloneId = 0;
- afs_uint32 curCloneId = 0;
- char cloneName[256]; /*max vol name */
-
- aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
- curPos = 0;
- if ((volPtr->volFlags & REUSECLONEID) && (volPtr->volFlags & ENTRYVALID))
- reuseCloneId = 1;
- else { /*get a bunch of id's from vldb */
- code =
- ubik_VL_GetNewVolumeId(cstruct, 0, arraySize, &curCloneId);
- if (code) {
- fprintf(STDERR, "Could not get ID's for the clone from VLDB\n");
- PrintError("", code);
- return code;
- }
- }
-
- for (curPtr = volPtr; curPos < arraySize; curPtr++) {
- if (curPtr->volFlags & ENTRYVALID) {
-
- curPtr->volFlags |= CLONEVALID;
- /*make a clone of curParentId and record as curPtr->volCloneId */
- code =
- AFSVolTransCreate_retry(aconn, curPtr->volId, apart, ITOffline,
- &tid);
- if (code)
- VPRINT2("Clone for volume %s %u failed \n", curPtr->volName,
- curPtr->volId);
- if (code) {
- curPtr->volFlags &= ~CLONEVALID; /* can't clone */
- curPos++;
- continue;
- }
- if (strlen(curPtr->volName) < (VOLSER_OLDMAXVOLNAME - 9)) {
- strcpy(cloneName, curPtr->volName);
- strcat(cloneName, "-tmpClone-");
- } else
- strcpy(cloneName, "-tmpClone");
- if (reuseCloneId) {
- curPtr->volCloneId = curCloneId;
- curCloneId++;
- }
-
- code =
- AFSVolClone(aconn, tid, 0, readonlyVolume, cloneName,
- &(curPtr->volCloneId));
- if (code) {
- curPtr->volFlags &= ~CLONEVALID;
- curPos++;
- fprintf(STDERR, "Could not clone %s due to error %lu\n",
- curPtr->volName, (unsigned long)code);
- code = AFSVolEndTrans(aconn, tid, &rcode);
- if (code)
- fprintf(STDERR, "WARNING: could not end transaction\n");
- continue;
- }
- VPRINT2("********** Cloned %s temporary %u\n", cloneName,
- curPtr->volCloneId);
- code = AFSVolEndTrans(aconn, tid, &rcode);
- if (code || rcode) {
- curPtr->volFlags &= ~CLONEVALID;
- curPos++;
- continue;
- }
-
- curPos++;
- }
- }
- if (aconn)
- rx_DestroyConnection(aconn);
- return 0;
-}
-
-
/*list all the volumes on <aserver> and <apart>. If all = 1, then all the
* relevant fields of the volume are also returned. This is a heavy weight operation.*/
int
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);
xstat_fs_DecodeFullPerfStats
xstat_fs_ForceProbeNow
xstat_fs_Init
+xstat_fs_Results
xstat_fs_Wait
wait.tv_nsec = tv.tv_usec * 1000;
opr_mutex_enter(&xstat_cm_force_lock);
code = opr_cv_timedwait(&xstat_cm_force_cv, &xstat_cm_force_lock, &wait);
- opr_Assert(code == 0 || code == ETIMEDOUT);
opr_mutex_exit(&xstat_cm_force_lock);
} /*Continuous execution */
} /*Service loop */
wait.tv_nsec = tv.tv_usec * 1000;
opr_mutex_enter(&xstat_fs_force_lock);
code = opr_cv_timedwait(&xstat_fs_force_cv, &xstat_fs_force_lock, &wait);
- opr_Verify(code == 0 || code == ETIMEDOUT);
opr_mutex_exit(&xstat_fs_force_lock);
} /*Continuous execution */
} /*Service loop */
*/
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;
-}
runtests.o: $(srcdir)/runtests.c
$(AFS_CCRULE) $(srcdir)/runtests.c
-check test tests: runtests
- @for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done
+RUNTESTS_V0_DEFAULT=-l $(abs_top_srcdir)/tests/TESTS
+RUNTESTS_V1_DEFAULT=-v -l $(abs_top_srcdir)/tests/TESTS
+
+# If $(TESTS) is blank, RUNTESTS_ARGS will expand to RUNTESTS_DEFAULT_, so
+# we'll run our default list of tests. If $(TESTS) is not blank,
+# $(RUNTESTS_DEFAULT_$(TESTS)) will expand into nothing, so RUNTESTS_ARGS will
+# just become effectively $(TESTS).
+RUNTESTS_DEFAULT_=$(RUNTESTS_V$(V)_DEFAULT)
+RUNTESTS_ARGS=$(RUNTESTS_DEFAULT_$(TESTS)) $(TESTS)
+
+# To run specific tests, run e.g. 'make check TESTS="rx/foo opr/foo"'
+check test tests: all runtests
MAKECHECK=1 $(abs_top_srcdir)/tests/libwrap @TOP_OBJDIR@/lib \
- ./runtests -v -l $(abs_top_srcdir)/tests/TESTS
+ ./runtests $(RUNTESTS_ARGS)
install:
opr/uuid
ptserver/pt_util
ptserver/pts-man
+rx/atomic
rx/event
rx/perf
volser/vos-man
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread
-TESTS = authcon-t superuser-t keys-t realms-t writekeyfile
+BINS = authcon-t superuser-t keys-t realms-t writekeyfile
MODULE_CFLAGS=-I$(TOP_OBJDIR) -I$(srcdir)/../common/
-all check test tests: $(TESTS)
+all: $(BINS)
-MODULE_LIBS = ../tap/libtap.a \
+MODULE_LIBS = $(abs_top_builddir)/tests/common/libafstest_common.la \
$(abs_top_builddir)/src/auth/liboafs_auth.la \
- $(LIB_rfc3961) $(LIB_roken) \
$(XLIBS)
-authcon-t: authcon-t.o ../common/config.o ../common/network.o
- $(LT_LDRULE_static) authcon-t.o ../common/config.o ../common/network.o \
- $(MODULE_LIBS)
+authcon-t: authcon-t.o
+ $(LT_LDRULE_static) authcon-t.o $(MODULE_LIBS)
-superuser-t: superuser-t.o ../common/config.o ../common/rxkad.o \
- test.cs.o test.ss.o test.xdr.o ../common/network.o \
- ../common/misc.o
- $(LT_LDRULE_static) superuser-t.o ../common/config.o \
- ../common/rxkad.o ../common/servers.o \
- test.cs.o test.ss.o test.xdr.o ../common/network.o \
- ../common/misc.o $(MODULE_LIBS)
+superuser-t: superuser-t.o test.cs.o test.ss.o test.xdr.o
+ $(LT_LDRULE_static) superuser-t.o test.cs.o test.ss.o test.xdr.o \
+ $(MODULE_LIBS)
-keys-t: keys-t.o ../common/config.o ../common/network.o
- $(LT_LDRULE_static) keys-t.o ../common/config.o ../common/network.o $(MODULE_LIBS)
+keys-t: keys-t.o
+ $(LT_LDRULE_static) keys-t.o $(MODULE_LIBS)
-realms-t: realms-t.o ../common/config.o ../common/network.o
- $(LT_LDRULE_static) realms-t.o ../common/config.o ../common/network.o $(MODULE_LIBS)
+realms-t: realms-t.o
+ $(LT_LDRULE_static) realms-t.o $(MODULE_LIBS)
-writekeyfile: writekeyfile.o ../common/config.o
- $(LT_LDRULE_static) writekeyfile.o ../common/config.o $(MODULE_LIBS)
+writekeyfile: writekeyfile.o
+ $(LT_LDRULE_static) writekeyfile.o $(MODULE_LIBS)
test.cs.c: test.xg
$(RXGEN) -A -x -C -o $@ $(srcdir)/test.xg
clean:
$(LT_CLEAN)
rm -f *.o *.cs.c *.ss.c *.xdr.c test.h \
- $(TESTS)
+ $(BINS)
struct afsconf_typedKey *key;
int code = 0;
struct afsconf_bsso_info bsso;
+ struct afstest_configinfo bct;
memset(&bsso, 0, sizeof(bsso));
+ memset(&bct, 0, sizeof(bct));
afstest_SkipTestsIfBadHostname();
plan(8);
- dirname = afstest_BuildTestConfig();
+
+ bct.skipkeys = 1;
+ dirname = afstest_BuildTestConfig(&bct);
dir = afsconf_Open(dirname);
if (dir == NULL) {
ok(afsconf_UpToDate(dir), "afsconf_GetLatestKeyByTypes resest UpToDate");
out:
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
return code;
}
struct rx_opaque *keyMaterial;
struct afsconf_typedKey *typedKey;
struct afsconf_typedKeyList *typedKeyList;
+ struct afstest_configinfo bct;
char *dirname;
char *keyfile;
char *keyfilesrc;
int code;
int i;
+ memset(&bct, 0, sizeof(bct));
+
afstest_SkipTestsIfBadHostname();
plan(134);
/* Create a temporary afs configuration directory */
- dirname = afstest_BuildTestConfig();
+ bct.skipkeys = 1;
+ dirname = afstest_BuildTestConfig(&bct);
- if (asprintf(&keyfile, "%s/KeyFile", dirname) == -1)
- goto out;
+ keyfile = afstest_asprintf("%s/KeyFile", dirname);
- /* Work out the path to our KeyFile. If the test harness hasn't set
- * the C_TAP_SOURCE environment variable, then assume it is in our CWD */
- if (getenv("C_TAP_SOURCE") == NULL) {
- keyfilesrc = strdup("KeyFile");
- } else {
- if (asprintf(&keyfilesrc, "%s/auth/KeyFile", getenv("C_TAP_SOURCE")) == -1)
- goto out;
- }
+ keyfilesrc = afstest_src_path("tests/auth/KeyFile");
/* First, copy in a known keyfile */
code = copy(keyfilesrc, keyfile);
afsconf_Close(dir);
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
free(dirname);
free(keyfile);
/* Start a new test configuration */
- dirname = afstest_BuildTestConfig();
+ dirname = afstest_BuildTestConfig(&bct);
dir = afsconf_Open(dirname);
ok(dir != NULL, "Sucessfully opened brand new config directory");
if (dir == NULL)
" ... with the right key");
out:
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
return 0;
}
char *dirname;
/* run edge case tests */
- dirname = afstest_BuildTestConfig();
+ dirname = afstest_BuildTestConfig(NULL);
dir = afsconf_Open(dirname);
if (dir == NULL) {
fprintf(stderr, "Unable to configure directory.\n");
exit(1);
}
run_edge_tests(dir);
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
}
void
char *dirname;
/* run tests without config files */
- dirname = afstest_BuildTestConfig();
+ dirname = afstest_BuildTestConfig(NULL);
dir = afsconf_Open(dirname);
if (dir == NULL) {
fprintf(stderr, "Unable to configure directory.\n");
exit(1);
}
run_tests(dir, 0, "no config");
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
}
void
char *dirname;
/* run tests with config files */
- dirname = afstest_BuildTestConfig();
+ dirname = afstest_BuildTestConfig(NULL);
write_krb_conf(dirname, "MY.REALM.ORG MY.OTHER.REALM.ORG");
write_krb_excl(dirname);
dir = afsconf_Open(dirname);
exit(1);
}
run_tests(dir, 2, "config");
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
}
void
ok(afsconf_SetLocalRealm("MY.OTHER.REALM.ORG") == 0, "set local realm MY.OTHER.REALM.ORG");
/* run tests without config files */
- dirname = afstest_BuildTestConfig();
+ dirname = afstest_BuildTestConfig(NULL);
dir = afsconf_Open(dirname);
if (dir == NULL) {
fprintf(stderr, "Unable to configure directory.\n");
}
write_krb_conf(dirname, "SOME.REALM.ORG");
run_tests(dir, 1, "set realm test");
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
}
void
char *dirname;
afs_int32 local = -1;
- dirname = afstest_BuildTestConfig();
+ dirname = afstest_BuildTestConfig(NULL);
write_krb_conf(dirname, "SOME.REALM.ORG");
dir = afsconf_Open(dirname);
if (dir == NULL) {
code = afsconf_IsLocalRealmMatch(dir, &local, "admin", NULL, "MY.REALM.ORG");
ok(code == 0 && local == 0, "after update: admin@MY.REALM.ORG");
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
}
int
/* Start a connection to our test service with it */
he = gethostbyname("localhost");
if (!he) {
- printf("Couldn't look up server hostname");
+ fprintf(stderr, "Couldn't look up server hostname");
exit(1);
}
struct afsconf_dir *dir;
char *dirname;
int serverPid, clientPid, waited, stat;
- int code;
int ret = 0;
sigset_t set;
char *argv0 = afstest_GetProgname(argv);
startClient(argv[2]);
exit(0);
} else {
- printf("Bad option %s\n", argv[1]);
+ fprintf(stderr, "Bad option %s\n", argv[1]);
exit(1);
}
}
sigaddset(&set, SIGUSR1);
opr_Verify(sigprocmask(SIG_BLOCK, &set, NULL) == 0);
- dirname = afstest_BuildTestConfig();
+ dirname = afstest_BuildTestConfig(NULL);
dir = afsconf_Open(dirname);
if (dir == NULL) {
goto out;
}
- code = afstest_AddDESKeyFile(dir);
- if (code) {
- afs_com_err(argv0, code, "while adding new key\n");
- ret = 1;
- goto out;
- }
-
- printf("Config directory is %s\n", dirname);
+ diag("Config directory is %s\n", dirname);
serverPid = fork();
if (serverPid == -1) {
- /* Bang */
+ sysbail("fork");
+
} else if (serverPid == 0) {
execl(argv[0], argv[0], "-server", dirname, NULL);
ret = 1;
out:
/* Client and server are both done, so cleanup after everything */
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
return ret;
}
char *keyfile = NULL;
int in, out;
size_t len;
+ struct afstest_configinfo bct;
- dirname = afstest_BuildTestConfig();
+ memset(&bct, 0, sizeof(bct));
+
+ bct.skipkeys = 1;
+
+ dirname = afstest_BuildTestConfig(&bct);
if (dirname == NULL) {
fprintf(stderr, "Unable to create tmp config dir\n");
exit(1);
afsconf_Close(dir);
/* Copy out the resulting keyfile into our homedirectory */
- opr_Verify(asprintf(&keyfile, "%s/KeyFile", dirname) > 0);
+ keyfile = afstest_asprintf("%s/KeyFile", dirname);
in = open(keyfile, O_RDONLY);
out = open("KeyFile", O_WRONLY | O_CREAT, 0644);
close(in);
close(out);
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
return 0;
}
use strict;
use warnings;
+use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
+
+use afstest qw(src_path obj_path);
use Test::More;
use File::Temp qw/tempdir/;
-use FindBin qw($Bin);
use Cwd qw/abs_path/;
use File::Compare;
use Sys::Hostname;
}
plan tests => 1;
-my $cmd;
-if (defined($ENV{C_TAP_BUILD})) {
- $cmd = $ENV{C_TAP_BUILD} . "/auth/writekeyfile";
-} else {
- $cmd = $Bin . "/writekeyfile";
-}
+my $cmd = obj_path("tests/auth/writekeyfile");
$cmd = abs_path($cmd);
-my $keyfile;
-if (defined($ENV{C_TAP_SOURCE})) {
- $keyfile = $ENV{C_TAP_SOURCE} . "/auth/KeyFile.short";
-} else {
- $keyfile = $Bin . "/KeyFile.short";
-}
+my $keyfile = src_path("tests/auth/KeyFile.short");
$keyfile = abs_path($keyfile);
my $dir = tempdir('afs_XXXXXX', CLEANUP => 1);
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread
-MODULE_CFLAGS = -I$(TOP_OBJDIR)
+MODULE_CFLAGS = -I$(TOP_OBJDIR) -I$(srcdir)/../common/
-LIBS = ../tap/libtap.a \
+LIBS = $(abs_top_builddir)/tests/common/libafstest_common.la \
$(abs_top_builddir)/src/cmd/liboafs_cmd.la \
$(abs_top_builddir)/src/comerr/liboafs_comerr.la \
- $(abs_top_builddir)/src/opr/liboafs_opr.la \
$(abs_top_builddir)/src/opr/liboafs_opr.la
-tests = command-t
+BINS = command-t
-all check test tests: $(tests)
+all: $(BINS)
command-t: command-t.o $(LIBS)
$(LT_LDRULE_static) command-t.o $(LIBS) $(LIB_roken) $(XLIBS)
clean distclean:
$(LT_CLEAN)
- $(RM) -f $(tests) *.o core
+ $(RM) -f $(BINS) *.o core
#include <afs/cmd.h>
#include <tests/tap/basic.h>
+#include "common.h"
enum cmdOptions {
copt_flag = 0,
list = list->next;
el = va_arg(ap, char *);
}
+ va_end(ap);
if (el == NULL && list == NULL) {
ok(1, "List has correct number of elements");
cmd_FreeArgv(tv);
/* Now, try adding a configuration file into the mix */
- if (getenv("C_TAP_SOURCE") == NULL)
- path = strdup("test1.conf");
- else {
- if (asprintf(&path, "%s/cmd/test1.conf", getenv("C_TAP_SOURCE")) < 0)
- path = NULL;
- }
- if (path != NULL) {
- cmd_SetCommandName("test");
- code = cmd_OpenConfigFile(path);
- is_int(0, code, "cmd_OpenConfigFile succeeds");
- } else {
- skip("no memory to build config file path");
- }
+ path = afstest_src_path("tests/cmd/test1.conf");
+ cmd_SetCommandName("test");
+ code = cmd_OpenConfigFile(path);
+ is_int(0, code, "cmd_OpenConfigFile succeeds");
code = cmd_ParseLine("-first 1", tv, &tc, 100);
is_int(0, code, "cmd_ParseLine succeeds");
srcdir=@srcdir@
-abs_top_builddir=@abs_top_builddir@
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread
+include @TOP_OBJDIR@/src/config/Makefile.libtool
MODULE_CFLAGS=-I$(TOP_OBJDIR)
-all check test tests: config.o servers.o ubik.o rxkad.o network.o
+LT_objs = config.lo exec.lo files.lo misc.lo network.lo rxkad.lo servers.lo \
+ ubik.lo
+LT_libs = $(LIB_rfc3961) $(LIB_roken)
+LT_deps = $(top_builddir)/tests/tap/libafstest_tap.la \
+ $(top_builddir)/src/ubik/liboafs_ubik.la \
+ $(top_builddir)/src/util/liboafs_util.la
+
+all: libafstest_common.la
+
+# This library is just used internally for our tests, so use
+# LT_LDLIB_shlib_internal so we don't need to manage a .sym export list.
+libafstest_common.la: $(LT_objs) $(LT_deps)
+ $(LT_LDLIB_shlib_internal) $(LT_objs) $(LT_deps) $(LT_libs)
clean:
+ $(LT_CLEAN)
rm -f *.o
*/
/* config.c */
-extern char *afstest_BuildTestConfig(void);
-extern void afstest_UnlinkTestConfig(char *);
-extern char *afstest_mkdtemp(char *template);
+
+struct afstest_configinfo {
+ /* Skip adding keys to the created conf dir. */
+ int skipkeys;
+};
+extern char *afstest_BuildTestConfig(struct afstest_configinfo *info);
struct afsconf_dir;
extern int afstest_AddDESKeyFile(struct afsconf_dir *dir);
+/* exec.c */
+
+struct afstest_cmdinfo {
+ char *command; /**< command to run (as given to e.g. system()) */
+ int exit_code; /**< expected exit code */
+ const char *output; /**< expected command output */
+ int fd; /**< fd to read output from */
+
+ /* The following fields are not to be set by the caller; they are set when
+ * running the given command. */
+ char *fd_descr; /**< string description of 'fd' (e.g. "stdout") */
+ pid_t child; /**< child pid (after command has started) */
+ FILE *pipe_fh; /**< pipe from child (after started) */
+};
+
+extern int is_command(struct afstest_cmdinfo *cmdinfo,
+ const char *format, ...)
+ AFS_ATTRIBUTE_FORMAT(__printf__, 2, 3);
+extern int afstest_systemlp(char *command, ...);
+
+/* files.c */
+
+extern char *afstest_mkdtemp(void);
+extern void afstest_rmdtemp(char *path);
+extern char *afstest_src_path(char *path);
+extern char *afstest_obj_path(char *path);
+extern int afstest_file_contains(char *path, char *target);
+
/* rxkad.c */
extern struct rx_securityClass
extern int afstest_SkipTestsIfLoopbackNetIsDefault(void);
extern void afstest_SkipTestsIfBadHostname(void);
extern void afstest_SkipTestsIfServerRunning(char *name);
+extern afs_uint32 afstest_MyHostAddr(void);
/* misc.c */
extern char *afstest_GetProgname(char **argv);
+extern char *afstest_vasprintf(const char *fmt, va_list ap);
+extern char *afstest_asprintf(const char *fmt, ...)
+ AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
#include <roken.h>
#include <afs/cellconfig.h>
-#include <afs/afsutil.h>
#include <hcrypto/des.h>
char *path = NULL;
FILE *file;
- if (asprintf(&path, "%s/%s", dirname, filename) == -1)
- return NULL;
+ path = afstest_asprintf("%s/%s", dirname, filename);
file = fopen(path, "w");
free(path);
return file;
}
-static void
-unlinkConfigFile(char *dirname, char *filename) {
- char *path;
-
- if (asprintf(&path, "%s/%s", dirname, filename) != -1) {
- unlink(path);
- free(path);
- }
-}
-
-/*!
- * Wrapper for mkdtemp
- */
-
-char *
-afstest_mkdtemp(char *template)
-{
-#if defined(HAVE_MKDTEMP)
- return mkdtemp(template);
-#else
- /*
- * Note that using the following is not a robust replacement
- * for mkdtemp as there is a possible race condition between
- * creating the name and creating the directory itself. The
- * use of this routine is limited to running tests.
- */
- if (mktemp(template) == NULL)
- return NULL;
- if (mkdir(template, 0700))
- return NULL;
- return template;
-#endif
-}
-
/*!
* Build a test configuration directory, containing a CellServDB and ThisCell
- * file for the "example.org" cell
+ * file for the "example.org" cell. Also populates the KeyFile unless
+ * info->skipkeys is set.
*
+ * @param[in] info Various details for how to create the config dir. If NULL,
+ * use a default zeroed struct.
* @return
* The path to the configuration directory. This should be freed by the caller
* using free()
- *
*/
-
char *
-afstest_BuildTestConfig(void) {
+afstest_BuildTestConfig(struct afstest_configinfo *info)
+{
char *dir = NULL;
FILE *file;
- struct hostent *host;
- char hostname[255];
+ struct afsconf_dir *confdir = NULL;
+ struct afstest_configinfo info_defaults;
struct in_addr iaddr;
+ int code;
- if (asprintf(&dir, "%s/afs_XXXXXX", gettmpdir()) == -1)
- goto fail;
+ memset(&info_defaults, 0, sizeof(info_defaults));
+ memset(&iaddr, 0, sizeof(iaddr));
+
+ if (info == NULL) {
+ info = &info_defaults;
+ }
- if (afstest_mkdtemp(dir) == NULL)
- goto fail;
+ dir = afstest_mkdtemp();
+ if (dir == NULL) {
+ goto error;
+ }
/* Work out which IP address to use in our CellServDB. We figure this out
* according to the IP address which ubik is most likely to pick for one of
* our db servers */
-
- gethostname(hostname, sizeof(hostname));
- host = gethostbyname(hostname);
- if (!host)
- return NULL;
-
- memcpy(&iaddr, host->h_addr, 4);
+ iaddr.s_addr = afstest_MyHostAddr();
file = openConfigFile(dir, "CellServDB");
fprintf(file, ">example.org # An example cell\n");
fprintf(file, "example.org");
fclose(file);
- return dir;
+ if (!info->skipkeys) {
+ confdir = afsconf_Open(dir);
+ if (confdir == NULL) {
+ goto error;
+ }
-fail:
- if (dir)
- free(dir);
- return NULL;
-}
+ code = afstest_AddDESKeyFile(confdir);
+ if (code != 0) {
+ goto error;
+ }
-/*!
- * Delete at test configuration directory
- */
+ afsconf_Close(confdir);
+ confdir = NULL;
+ }
-void
-afstest_UnlinkTestConfig(char *dir)
-{
- DIR *dirp;
- struct dirent *de;
-
- /* Sanity check, only zap directories that look like ours */
- if (!strstr(dir, "afs_"))
- return;
- if (getenv("MAKECHECK") != NULL) {
- dirp = opendir(dir);
- if (!dirp)
- return;
- while ((de = readdir(dirp)))
- unlinkConfigFile(dir, de->d_name);
- rmdir(dir);
+ return dir;
+
+ error:
+ if (confdir != NULL) {
+ afsconf_Close(confdir);
+ }
+ if (dir != NULL) {
+ afstest_rmdtemp(dir);
+ free(dir);
}
+ return NULL;
}
int
--- /dev/null
+/*
+ * Copyright (c) 2020 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.
+ */
+
+/*!
+ * Common exec-related functions for testing programs
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+
+#include <roken.h>
+#include <afs/opr.h>
+
+#include <afs/opr.h>
+
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <tests/tap/basic.h>
+
+#include "common.h"
+
+static void
+afstest_command_start(struct afstest_cmdinfo *cmdinfo)
+{
+ int code;
+ int pipefd[2];
+
+ if (cmdinfo->fd == STDOUT_FILENO) {
+ cmdinfo->fd_descr = "stdout";
+ } else if (cmdinfo->fd == STDERR_FILENO) {
+ cmdinfo->fd_descr = "stderr";
+ } else {
+ bail("unknown exec fd %d", cmdinfo->fd);
+ }
+
+ code = pipe(pipefd);
+ if (code < 0) {
+ sysbail("pipe");
+ }
+
+ cmdinfo->child = fork();
+ if (cmdinfo->child < 0) {
+ sysbail("fork");
+ }
+
+ if (cmdinfo->child == 0) {
+ /* Child pid */
+ char *cmd = "/bin/sh";
+ char *argv[] = { "sh", "-c", cmdinfo->command, NULL };
+
+ /* Redirect stdout/stderr to our pipe */
+ code = dup2(pipefd[1], cmdinfo->fd);
+ if (code < 0) {
+ sysdiag("dup2");
+ exit(1);
+ }
+
+ close(pipefd[0]);
+ close(pipefd[1]);
+
+ execv(cmd, argv);
+ sysdiag("execv");
+ exit(1);
+ }
+
+ /* Parent pid */
+
+ close(pipefd[1]);
+
+ cmdinfo->pipe_fh = fdopen(pipefd[0], "r");
+ if (cmdinfo->pipe_fh == NULL) {
+ sysbail("fdopen");
+ }
+}
+
+static int
+command_end_v(struct afstest_cmdinfo *cmdinfo, const char *format, va_list args)
+{
+ int code;
+ int success;
+ size_t buflen;
+ char *buf = NULL;
+ int nbytes;
+ int status = -1;
+
+ opr_Assert(cmdinfo->child != 0);
+
+ /*
+ * Read 1 byte more than the 'cmdinfo->output' string. If that's less than
+ * 4095 bytes, read 4095 bytes (just so we read a decent amount of data, in
+ * case we unexpectedly get a lot of data back).
+ */
+ buflen = strlen(cmdinfo->output)+1;
+ if (buflen < 4095) {
+ buflen = 4095;
+ }
+ buf = calloc(1, buflen+1);
+ if (buf == NULL) {
+ sysbail("calloc");
+ }
+
+ /*
+ * Note that we must read the return value of fread() into something,
+ * because it's declared with warn_unused_result in some glibc. We don't
+ * actually care about the result, but pretend to care so we don't trigger
+ * a warning.
+ */
+ nbytes = fread(buf, 1, buflen, cmdinfo->pipe_fh);
+ if (ferror(cmdinfo->pipe_fh) != 0) {
+ bail("error reading from %s pipe (read %d bytes)",
+ cmdinfo->fd_descr, nbytes);
+ }
+ fclose(cmdinfo->pipe_fh);
+ cmdinfo->pipe_fh = NULL;
+
+ code = waitpid(cmdinfo->child, &status, 0);
+ if (code <= 0) {
+ sysbail("waitpid");
+ }
+
+ success = 0;
+
+ if (WIFEXITED(status) && WEXITSTATUS(status) != cmdinfo->exit_code) {
+ int code = WEXITSTATUS(status);
+ diag("command %s:", cmdinfo->command);
+ diag("exit code wanted: %d", cmdinfo->exit_code);
+ diag(" exit code seen: %d", code);
+ diag(" ");
+ diag("%s: %s", cmdinfo->fd_descr, buf);
+
+ } else if (WIFSIGNALED(status)) {
+ diag("command %s was killed by signal %d", cmdinfo->command,
+ WTERMSIG(status));
+
+ } else if (!WIFEXITED(status)) {
+ /* handle non-exited, non-signalled, just in case */
+ diag("command %s died with weird status 0x%x", cmdinfo->command,
+ status);
+
+ } else if (strcmp(cmdinfo->output, buf) != 0) {
+ diag("command %s:", cmdinfo->command);
+ diag("wanted %s: %s", cmdinfo->fd_descr, cmdinfo->output);
+ diag(" seen %s: %s", cmdinfo->fd_descr, buf);
+
+ } else {
+ success = 1;
+ }
+
+ okv(success, format, args);
+
+ cmdinfo->child = 0;
+ free(buf);
+ buf = NULL;
+
+ return success;
+}
+
+/**
+ * Test if running the given command matches the given output and exit code.
+ *
+ * @param[in] cmdinfo Command to run, and expected output and exit code
+ * @param[in] format Message to print for the test (a la 'is_int' etc)
+ * @return whether the test succeeded
+ */
+int
+is_command(struct afstest_cmdinfo *cmdinfo, const char *format, ...)
+{
+ va_list args;
+ int ret;
+
+ afstest_command_start(cmdinfo);
+
+ va_start(args, format);
+ ret = command_end_v(cmdinfo, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+static int
+do_systemvp(char *command, char **argv)
+{
+ pid_t child;
+
+ child = fork();
+ if (child < 0) {
+ sysbail("fork");
+ }
+
+ if (child > 0) {
+ int status = -1;
+ /* parent */
+ if (waitpid(child, &status, 0) <= 0) {
+ sysbail("waitpid");
+ }
+ return status;
+ }
+
+ execvp(command, argv);
+ sysbail("execvp");
+ exit(1);
+}
+
+/*
+ * This function is mostly the same as system(), in that the given command is
+ * run with the same stdout, stderr, etc, and we return the exit status when it
+ * finishes running. But instead of giving the command as a single string,
+ * interpreted by the shell, the command is given as a list of arguments, like
+ * execlp().
+ *
+ * For example, the following two are equivalent:
+ *
+ * code = afstest_systemlp("echo", "foo", "bar", (char*)NULL);
+ * code = system("echo foo bar");
+ *
+ * Except that with afstest_systemlp, the arguments don't go through the shell,
+ * so you don't need to worry about quoting arguments or escaping shell
+ * metacharacters.
+ */
+int
+afstest_systemlp(char *command, ...)
+{
+ va_list ap;
+ int n_args = 1;
+ int arg_i;
+ int status;
+ char **argv;
+
+ va_start(ap, command);
+ while (va_arg(ap, char*) != NULL) {
+ n_args++;
+ }
+ va_end(ap);
+
+ argv = calloc(n_args + 1, sizeof(argv[0]));
+ opr_Assert(argv != NULL);
+
+ argv[0] = command;
+
+ va_start(ap, command);
+ for (arg_i = 1; arg_i < n_args; arg_i++) {
+ argv[arg_i] = va_arg(ap, char*);
+ opr_Assert(argv[arg_i] != NULL);
+ }
+ va_end(ap);
+
+ /* Note that argv[n_args] is NULL, since we allocated an extra arg in
+ * calloc(), above. */
+
+ status = do_systemvp(command, argv);
+ free(argv);
+
+ return status;
+}
--- /dev/null
+/*
+ * Copyright (c) 2020 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.
+ */
+
+/*!
+ * Common file-related functions for test programs
+ */
+
+#include <afsconfig.h>
+#include <afs/param.h>
+#include <roken.h>
+
+#include <afs/opr.h>
+#include <afs/afsutil.h>
+
+#include <tests/tap/basic.h>
+
+#include "common.h"
+
+char *
+afstest_mkdtemp(void)
+{
+ char *template;
+ char *tmp;
+
+ tmp = afstest_obj_path("tests/tmp");
+
+ /* Try to make sure 'tmp' exists. */
+ (void)mkdir(tmp, 0700);
+
+ template = afstest_asprintf("%s/afs_XXXXXX", tmp);
+
+ free(tmp);
+
+#if defined(HAVE_MKDTEMP)
+ return mkdtemp(template);
+#else
+ /*
+ * Note that using the following is not a robust replacement
+ * for mkdtemp as there is a possible race condition between
+ * creating the name and creating the directory itself. The
+ * use of this routine is limited to running tests.
+ */
+ if (mktemp(template) == NULL)
+ return NULL;
+ if (mkdir(template, 0700))
+ return NULL;
+ return template;
+#endif
+}
+
+void
+afstest_rmdtemp(char *path)
+{
+ int code;
+ struct stat st;
+
+ /* Sanity check, only zap directories that look like ours */
+ opr_Assert(strstr(path, "afs_") != NULL);
+ if (getenv("MAKECHECK") == NULL) {
+ /* Don't delete tmp dirs if we're not running under 'make check'. */
+ return;
+ }
+ code = lstat(path, &st);
+ if (code != 0) {
+ /* Given path doesn't exist (or we can't access it?) */
+ return;
+ }
+ if (!S_ISDIR(st.st_mode)) {
+ /* Path isn't a dir; that's weird. Bail out to be on the safe side. */
+ return;
+ }
+ afstest_systemlp("rm", "-rf",
+#if defined(AFS_LINUX_ENV) || defined(AFS_SUN511_ENV)
+ "--one-file-system",
+#endif
+ path, (char*)NULL);
+}
+
+static char *
+path_from_tdir(char *env_var, char *filename)
+{
+ char *tdir;
+ char *path;
+ char *top_rel, *top_abs;
+
+ /* C_TAP_SOURCE/C_TAP_BUILD in the env points to 'tests/' in the
+ * srcdir/objdir. */
+
+ tdir = getenv(env_var);
+ if (tdir == NULL) {
+ /*
+ * If C_TAP_SOURCE/C_TAP_BUILD isn't set, we assume we're running from
+ * the same cwd as one of the test programs (e.g. 'tests/foo/'). So to
+ * get to 'tests/', just go up one level.
+ */
+ tdir = "..";
+ }
+
+ /* 'tdir' points to the 'tests' dir, so go up one level to get to the top
+ * srcdir/objdir. */
+ top_rel = afstest_asprintf("%s/..", tdir);
+ top_abs = realpath(top_rel, NULL);
+ free(top_rel);
+ if (top_abs == NULL) {
+ sysbail("realpath");
+ }
+
+ /*
+ * The given 'filename' is relative to the top srcdir/objdir, so to get the
+ * full path, append 'filename' to the top srcdir/objdir. Note that the
+ * given path may not exist yet, so we cannot run the full path through
+ * realpath().
+ */
+ path = afstest_asprintf("%s/%s", top_abs, filename);
+ free(top_abs);
+
+ return path;
+}
+
+char *
+afstest_src_path(char *path)
+{
+ return path_from_tdir("C_TAP_SOURCE", path);
+}
+
+char *
+afstest_obj_path(char *path)
+{
+ return path_from_tdir("C_TAP_BUILD", path);
+}
+
+/**
+ * Check if the given file contains a string. To keep things simple, the string
+ * to look for must appear on a single line, and must appear in the first 128
+ * bytes of that line.
+ *
+ * @param[in] path Path to the file to check.
+ * @param[in] target The string to look for in 'path'.
+ *
+ * @retval 1 The file contains the given string.
+ * @retval 0 The file does not contain the given string (or we encountered an
+ * error).
+ */
+int
+afstest_file_contains(char *path, char *target)
+{
+ FILE *fh;
+ char line[128];
+ int found = 0;
+
+ fh = fopen(path, "r");
+ if (fh == NULL) {
+ diag("%s: Failed to open %s", __func__, path);
+ goto done;
+ }
+
+ while (fgets(line, sizeof(line), fh) != NULL) {
+ if (strstr(line, target) != NULL) {
+ found = 1;
+ goto done;
+ }
+ }
+
+ done:
+ if (fh != NULL) {
+ fclose(fh);
+ }
+ return found;
+}
#include <afsconfig.h>
#include <afs/param.h>
#include <roken.h>
+#include <tests/tap/basic.h>
#include "common.h"
}
return argv[0];
}
+
+char *
+afstest_vasprintf(const char *fmt, va_list ap)
+{
+ char *str;
+ if (vasprintf(&str, fmt, ap) < 0) {
+ sysbail("vasprintf");
+ }
+ return str;
+}
+
+char *
+afstest_asprintf(const char *fmt, ...)
+{
+ char *str;
+ va_list ap;
+ va_start(ap, fmt);
+ str = afstest_vasprintf(fmt, ap);
+ va_end(ap);
+ return str;
+}
#include <tests/tap/basic.h>
#include "common.h"
+static afs_uint32
+gethostaddr(void)
+{
+ char hostname[256];
+ struct hostent *host;
+ static afs_uint32 addr = 0;
+
+ if (addr != 0) {
+ return addr;
+ }
+
+ memset(hostname, 0, sizeof(hostname));
+
+ gethostname(hostname, sizeof(hostname));
+ host = gethostbyname(hostname);
+ if (host == NULL) {
+ diag("gethostbyname(%s) error: %d", hostname, h_errno);
+ return 0;
+ }
+
+ memcpy(&addr, host->h_addr, sizeof(addr));
+ return addr;
+}
+
/*!
* Check if the current machine's hostname resolves to the loopback
* network.
int
afstest_IsLoopbackNetworkDefault(void)
{
- char hostname[MAXHOSTCHARS];
- afs_uint32 addr;
- struct hostent *host;
-
- gethostname(hostname, sizeof(hostname));
- host = gethostbyname(hostname);
- if (!host) {
- skip_all("Can't resolve hostname %s\n", hostname);
+ afs_uint32 addr = gethostaddr();
+ if (addr == 0) {
+ skip_all("Can't resolve hostname");
}
- memcpy(&addr, host->h_addr, sizeof(addr));
return(rx_IsLoopbackAddr(ntohl(addr)));
}
void
afstest_SkipTestsIfBadHostname(void)
{
- char hostname[MAXHOSTCHARS];
- struct hostent *host;
-
- gethostname(hostname, sizeof(hostname));
- host = gethostbyname(hostname);
- if (!host)
- skip_all("Can't resolve hostname %s\n", hostname);
+ if (gethostaddr() == 0)
+ skip_all("Can't resolve hostname");
}
/*!
}
close(sock);
}
+
+/*!
+ * Get the IP address of the local machine, for use with mock CellServDBs, etc.
+ *
+ * @return ipv4 address in net-byte order
+ */
+afs_uint32
+afstest_MyHostAddr(void)
+{
+ afs_uint32 addr = gethostaddr();
+ if (addr == 0) {
+ bail("cannot resolve hostname");
+ }
+ return addr;
+}
#include <afs/authcon.h>
#include <afs/cellconfig.h>
+#define UBIK_INTERNALS
+#include <ubik.h>
#include <tests/tap/basic.h>
#include "common.h"
+static void
+check_startup(pid_t pid, char *log, int *a_started, int *a_stopped)
+{
+ int status;
+ struct rx_connection *conn;
+ struct ubik_debug udebug;
+ afs_int32 isclone;
+ pid_t exited;
+ int code;
+
+ memset(&udebug, 0, sizeof(udebug));
+
+ opr_Assert(pid > 0);
+
+ exited = waitpid(pid, &status, WNOHANG);
+ if (exited < 0) {
+ opr_Assert(errno == ECHILD);
+ }
+
+ if (exited != 0) {
+ /* pid is no longer running; vlserver must have died during startup */
+ *a_stopped = 1;
+ return;
+ }
+
+ if (!afstest_file_contains(log, "Starting AFS vlserver")) {
+ /* vlserver hasn't logged the "Starting AFS vlserver" line yet, so it's
+ * presumably still starting up. */
+ return;
+ }
+
+ /*
+ * If we're going to write to the db, we also need to wait until recovery
+ * has the UBIK_RECHAVEDB state bit (without that, we won't be able to
+ * start write transactions). If we're just reading from the db, we
+ * wouldn't need to wait for this, but we don't know whether our caller
+ * will be writing to the db or not. It shouldn't take long for
+ * UBIK_RECHAVEDB to get set anyway, so just always check if it's been set
+ * (via VOTE_XDebug).
+ */
+
+ conn = rx_NewConnection(afstest_MyHostAddr(), htons(7003), VOTE_SERVICE_ID,
+ rxnull_NewClientSecurityObject(), 0);
+ code = VOTE_XDebug(conn, &udebug, &isclone);
+ rx_DestroyConnection(conn);
+ if (code != 0) {
+ diag("VOTE_XDebug returned %d while waiting for vlserver startup",
+ code);
+ return;
+ }
+
+ if (udebug.amSyncSite && (udebug.recoveryState & UBIK_RECHAVEDB) != 0) {
+ /* Okay, it's set! We have finished startup. */
+ *a_started = 1;
+ }
+}
+
/* Start up the VLserver, using the configuration in dirname, and putting our
* logs there too.
*/
afstest_StartVLServer(char *dirname, pid_t *serverPid)
{
pid_t pid;
- int status;
+ char *logPath;
+ int started = 0;
+ int stopped = 0;
+ int try;
+ FILE *fh;
+ int code = 0;
+
+ logPath = afstest_asprintf("%s/VLLog", dirname);
+
+ /* Create/truncate the log in advance (since we look at it to detect when
+ * the vlserver has started). */
+ fh = fopen(logPath, "w");
+ opr_Assert(fh != NULL);
+ fclose(fh);
pid = fork();
if (pid == -1) {
exit(1);
/* Argggggghhhhh */
} else if (pid == 0) {
- char *binPath, *logPath, *dbPath, *build;
+ char *binPath, *dbPath;
/* Child */
- build = getenv("C_TAP_BUILD");
-
- if (build == NULL)
- build = "..";
+ binPath = afstest_obj_path("src/tvlserver/vlserver");
+ dbPath = afstest_asprintf("%s/vldb", dirname);
- if (asprintf(&binPath, "%s/../src/tvlserver/vlserver", build) < 0 ||
- asprintf(&logPath, "%s/VLLog", dirname) < 0 ||
- asprintf(&dbPath, "%s/vldb", dirname) < 0) {
- fprintf(stderr, "Out of memory building vlserver arguments\n");
- exit(1);
- }
execl(binPath, "vlserver",
"-logfile", logPath, "-database", dbPath, "-config", dirname, NULL);
fprintf(stderr, "Running %s failed\n", binPath);
exit(1);
}
- if (waitpid(pid, &status, WNOHANG) != 0) {
- fprintf(stderr, "Error starting vlserver\n");
- return -1;
- }
+ /*
+ * Wait for the vlserver to startup. Try to check if the vlserver is ready
+ * by checking the log file and the urecovery_state (check_startup()), but
+ * if it's taking too long, just return success anyway. If the vlserver
+ * isn't ready yet, then the caller's tests may fail, but we can't wait
+ * forever.
+ */
+
+ diag("waiting for vlserver to startup");
+
+ usleep(5000); /* 5ms */
+ check_startup(pid, logPath, &started, &stopped);
+ for (try = 0; !started && !stopped; try++) {
+ if (try > 100 * 5) {
+ diag("waited too long for vlserver to finish starting up; "
+ "proceeding anyway");
+ goto done;
+ }
- diag("Sleeping for a few seconds to let the vlserver startup");
- sleep(5);
+ usleep(1000 * 10); /* 10ms */
+ check_startup(pid, logPath, &started, &stopped);
+ }
- if (waitpid(pid, &status, WNOHANG) != 0) {
+ if (stopped) {
fprintf(stderr, "vlserver died during startup\n");
- return -1;
+ code = -1;
+ goto done;
}
+ diag("vlserver started after try %d", try);
+
+ done:
*serverPid = pid;
- return 0;
+ free(logPath);
+
+ return code;
}
int
kill(serverPid, SIGTERM);
- waitpid(serverPid, &status, 0);
+ if (waitpid(serverPid, &status, 0) < 0) {
+ sysbail("waitpid");
+ }
if (WIFSIGNALED(status) && WTERMSIG(status) != SIGTERM) {
fprintf(stderr, "Server died exited on signal %d\n", WTERMSIG(status));
MODULE_CFLAGS = -I$(TOP_OBJDIR)
-LIBS=../tap/libtap.a $(abs_top_builddir)/src/opr/liboafs_opr.la
+LIBS= $(abs_top_builddir)/tests/common/libafstest_common.la \
+ $(abs_top_builddir)/src/opr/liboafs_opr.la
-tests = cache-t dict-t fmt-t jhash-t queues-t rbtree-t softsig-helper time-t \
- uuid-t
+BINS = cache-t dict-t fmt-t jhash-t queues-t rbtree-t softsig-helper time-t \
+ uuid-t
-all check test tests: $(tests)
+all: $(BINS)
-cache-t: cache-t.o
+cache-t: cache-t.o $(LIBS)
$(LT_LDRULE_static) cache-t.o $(LIBS) $(XLIBS)
-dict-t: dict-t.o
+dict-t: dict-t.o $(LIBS)
$(LT_LDRULE_static) dict-t.o $(LIBS) $(XLIBS)
fmt-t: fmt-t.o
$(LT_LDRULE_static) fmt-t.o $(LIBS) $(XLIBS)
-queues-t: queues-t.o
- $(LT_LDRULE_static) queues-t.o ../tap/libtap.a $(XLIBS)
+queues-t: queues-t.o $(LIBS)
+ $(LT_LDRULE_static) queues-t.o $(LIBS) $(XLIBS)
rbtree-t: rbtree-t.o $(LIBS)
- $(LT_LDRULE_static) rbtree-t.o ../tap/libtap.a $(LIBS) $(XLIBS)
+ $(LT_LDRULE_static) rbtree-t.o $(LIBS) $(XLIBS)
jhash-t: jhash-t.o
- $(LT_LDRULE_static) jhash-t.o ../tap/libtap.a $(XLIBS)
+ $(LT_LDRULE_static) jhash-t.o $(LIBS) $(XLIBS)
time-t: time-t.o
- $(LT_LDRULE_static) time-t.o ../tap/libtap.a $(XLIBS)
+ $(LT_LDRULE_static) time-t.o $(LIBS) $(XLIBS)
uuid-t: uuid-t.o
- $(LT_LDRULE_static) uuid-t.o ../tap/libtap.a $(LIBS) $(XLIBS)
+ $(LT_LDRULE_static) uuid-t.o $(LIBS) $(XLIBS)
softsig-helper: softsig-helper.o $(LIBS)
$(LT_LDRULE_static) softsig-helper.o $(LIBS) $(XLIBS)
clean distclean:
$(LT_CLEAN)
- $(RM) -f $(tests) *.o core
+ $(RM) -f $(BINS) *.o core
use strict;
use warnings;
+use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
+
+use afstest qw(obj_path);
use Test::More tests => 11;
use IO::File;
use POSIX qw(:signal_h);
# Start up our test process, and send it various signals. Check that these
# signals make it to it correctly, and are reported on the command line.
-my $softsig_helper;
-
-# Our softsig helper should be in $TOP_OBJDIR/tests/opr. To calculate that
-# path, use the C_TAP_BUILD env var if the test harness has set it; otherwise,
-# our next best guess is that it's in the same dir as this script.
-if (defined($ENV{C_TAP_BUILD})) {
- $softsig_helper = $ENV{C_TAP_BUILD} . "/opr/softsig-helper";
-} else {
- $softsig_helper = $Bin . "/softsig-helper";
-}
+my $softsig_helper = obj_path("tests/opr/softsig-helper");
# This -dummy argument prevents Perl from putting an intermediate sh
# -c between us and softsig-helper in the case where the build
use strict;
use warnings;
+use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
+use afstest qw(src_path obj_path);
use File::Basename;
-use Test::More tests=>2;
+use File::Temp qw(tempfile);
+use Test::More tests=>3;
-my $builddir = $ENV{C_TAP_BUILD};
-if (!$builddir) {
- $builddir = dirname($0)."/..";
-}
+my $pt_util = obj_path("src/ptserver/pt_util");
-$builddir.="/..";
-
-my $prdbfile = "/tmp/prdbtest.$$";
+(undef, my $prdb_tmp) = tempfile("prdbtest.XXXXXX", TMPDIR => 1, UNLINK => 1);
+my $prdb_test = src_path("tests/ptserver/db.prtiny/prdb.DB0");
my $instructions = <<EOF;
admin 128/20 1 -204 -204
EOF
my $fh;
+my $output;
-open $fh, '|-', "$builddir/src/ptserver/pt_util", '-w', '-p', $prdbfile
+open $fh, '|-', "$pt_util", '-w', '-p', $prdb_tmp
or die "Failed to start pt_util for DB creation\n";
print $fh $instructions;
close($fh)
or die "pt util failed while creating DB\n";
-open $fh, '-|', "$builddir/src/ptserver/pt_util", '-p', $prdbfile,
+open $fh, '-|', "$pt_util", '-p', $prdb_tmp,
'-user', '-group', '-members'
or die "Failed to start pt_util for DB reading\n";
+$output = join('', readline($fh));
+close($fh)
+ or die "pt_util failed while reading from $prdb_tmp\n";
+is($output, $expected, "pt_util produced expected output for generated db");
-my $output = join('', readline($fh));
+open $fh, '-|', "$pt_util", '-p', $prdb_test,
+ '-user', '-group', '-members'
+ or die "Failed to start pt_util for DB reading\n";
+$output = join('', readline($fh));
close($fh)
- or die "pt_util failed while reading from DB\n";
-is($output, $expected, "pt_util produced expected output");
-ok(1, "Completed sucessfully");
+ or die "pt_util failed while reading from $prdb_test\n";
+is($output, $expected, "pt_util produced expected output for test db");
-unlink($prdbfile);
+ok(1, "Completed sucessfully");
+++ /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
-#
-# Portions Copyright (c) 2003 Apple Computer, Inc.
-
-srcdir=@srcdir@
-include @TOP_OBJDIR@/src/config/Makefile.config
-include @TOP_OBJDIR@/src/config/Makefile.pthread
-
-RTL=@TOP_OBJDIR@/tests/rpctestlib
-RX = ${srcdir}/../../src/rx
-VICED=@TOP_OBJDIR@/src/viced
-FSINT=@TOP_OBJDIR@/src/fsint
-OSI=@TOP_OBJDIR@/src/osi
-
-MODULE_CFLAGS=-DNINTERFACE -DRXDEBUG -DFSSYNC_BUILD_SERVER \
- -DSALVSYNC_BUILD_CLIENT -I${RX} ${OSI_XCFLAGS} \
- -DSUBSYS_LOG_MACRO=RTLLog
-
-headers= ${RTL}/rpc_test_procs.h
-
-RTLOBJS= rpc_test_procs.o rpc_test_cb_procs.o
-
-FSINTOBJS= afscbint.ss.o afsint.cs.o afscbint.xdr.o \
- afsint.xdr.o
-
-RXOBJS = rx_pthread.o
-
-LIBOBJS= ${RTLOBJS} ${FSINTOBJS} ${RXOBJS}
-
-LIBS=${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/libopr.a \
- $(top_builddir)/src/util/liboafs_util.la
-
-all: xmpl_driver
-
-CFLAGS_rx_pthread.o = -DDPF_FSLOG
-
-rx_pthread.o: ${RX}/rx_pthread.c
- $(AFS_CCRULE) $(RX)/rx_pthread.c
-
-rpc_test_main.o: ${RTL}/rpc_test_main.c ${headers}
-rpc_test_procs.o: ${RTL}/rpc_test_procs.c ${headers}
-rpc_test_cb_procs.o: ${RTL}/rpc_test_cb_procs.c ${headers}
-
-afscbint.ss.o: ${FSINT}/afscbint.ss.c
- $(AFS_CCRULE) ${FSINT}/afscbint.ss.c
-afsint.cs.o: ${FSINT}/afsint.cs.c
- $(AFS_CCRULE) ${FSINT}/afsint.cs.c
-afsint.ss.o: ${FSINT}/afsint.ss.c
- $(AFS_CCRULE) ${FSINT}/afsint.ss.c
-afsint.xdr.o: ${FSINT}/afsint.xdr.c
- $(AFS_CCRULE) ${FSINT}/afsint.xdr.c
-afscbint.xdr.o: ${FSINT}/afscbint.xdr.c
- $(AFS_CCRULE) ${FSINT}/afscbint.xdr.c
-
-xmpl_driver: librpc_test_lib.a rpc_test_main.o ${LIBS}
- $(LT_LDRULE_static) rpc_test_main.o librpc_test_lib.a \
- ${LIBS} ${LIB_hcrypto} ${MT_LIBS}
-
-librpc_test_lib.a: ${LIBOBJS}
- $(RM) -f $@
- $(AR) crv $@ ${LIBOBJS}
- $(RANLIB) $@
-
-install:
-
-dest:
-
-clean:
- $(LT_CLEAN)
- $(RM) -f *.o *.a *.gch xmpl_driver core
-
-include @TOP_OBJDIR@/src/config/Makefile.version
+++ /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
-
-AFSDEV_AUXCDEFINES = -DAFS_PTHREAD_ENV -DRXDEBUG
-
-RELDIR=tests\rpctestlib
-!INCLUDE $(AFSROOT)\src\config\NTMakefile.$(SYS_NAME)
-!INCLUDE $(AFSROOT)\src\config\NTMakefile.version
-
-SRC_DIR = .
-
-############################################################################
-# Build rpc_test.lib and xmpl_driver.exe
-
-EXEFILE = $(OUT)\xmpl_driver.exe
-LIBFILE = $(OUT)\rpc_test.lib
-
-RTL = $(AFSROOT)\tests\rpctestlib
-RX = $(AFSROOT)\src\rx
-VICED = $(AFSROOT)\src\viced
-UTIL = $(AFSROOT)\src\util
-FSINT = $(AFSROOT)\src\fsint
-
-HEADERS = $(RTL)\rpc_test_procs.h
-
-RXOBJS = $(OUT)\xdr_int64.obj \
- $(OUT)\xdr_int32.obj
-
-RTLOBJS= $(OUT)\rpc_test_procs.obj $(OUT)\rpc_test_cb_procs.obj
-
-FSINTOBJS = $(OUT)\afscbint.ss.obj $(OUT)\afsint.cs.obj \
- $(OUT)\afscbint.xdr.obj $(OUT)\afsint.xdr.obj
-
-LIBOBJS = $(RTLOBJS) $(FSINTOBJS) $(RXOBJS)
-
-EXEOBJS = $(OUT)\rpc_test_main.obj
-
-all: $(EXEFILE)
-
-$(RTLOBJS) $(OUT)\rpc_test_main.obj: $(RTL)\$$(@B).c $(HEADERS)
- $(C2OBJ) -I$(RTL) $**
-
-$(RXOBJS): $(RX)\$$(@B).c
- $(C2OBJ) -I$(RX) $**
-
-$(FSINTOBJS): $(FSINT)\$$(@B).C
- $(C2OBJ) -I$(FSINT) $**
-
-$(LIBFILE): $(LIBOBJS)
- $(LIBARCH)
-
-EXELIBS = \
- $(DESTDIR)\lib\afsauthent.lib \
- $(DESTDIR)\lib\afsrpc.lib \
- $(DESTDIR)\lib\afs\afscmd.lib \
- $(DESTDIR)\lib\afs\afsaudit.lib \
- $(DESTDIR)\lib\afs\afscom_err.lib \
- $(DESTDIR)\lib\afs\afsreg.lib \
- $(DESTDIR)\lib\afs\afsprocmgmt.lib \
- $(DESTDIR)\lib\afs\afseventlog.lib \
- $(DESTDIR)\lib\afs\mtafsutil.lib \
- $(DESTDIR)\lib\afs\mtafsvol.lib \
- $(DESTDIR)\lib\afs\mtafsvldb.lib \
- $(DESTDIR)\lib\afspthread.lib \
- $(DESTDIR)\lib\afsroken.lib
-
-$(EXEFILE): $(EXEOBJS) $(EXELIBS) $(LIBFILE)
- $(EXECONLINK)
- $(_VC_MANIFEST_EMBED_EXE)
- $(EXEPREP)
- $(CODESIGN_USERLAND)
- $(SYMSTORE_IMPORT)
-
-install: $(EXEFILE)
-
-mkdir:
- $(ECHO) "(mkdir: no target)"
-clean::
- -$(DEL) $(EXEFILE) $(LIBFILE) $(LIBOBJS) $(EXEOBJS)
+++ /dev/null
-/*
- * Copyright (c) 2010, Linux Box Corporation.
- * All Rights Reserved.
- *
- * Portions Copyright (c) 2007, Hartmut Reuter,
- * RZG, Max-Planck-Institut f. Plasmaphysik.
- * 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 ``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
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-
-#include <afs/stds.h>
-
-#include "rpc_test_procs.h"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <signal.h>
-#include <afs/vice.h>
-#include <afs/cmd.h>
-#include <afs/auth.h>
-#include <afs/cellconfig.h>
-
-#include <afs/com_err.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#ifdef HAVE_DIRECT_H
-#include <direct.h>
-#endif
-#ifdef AFS_DARWIN_ENV
-#include <sys/malloc.h>
-#endif
-#include <afs/errors.h>
-#include <afs/sys_prototypes.h>
-#include <rx/rx_prototypes.h>
-#ifdef AFS_PTHREAD_ENV
-#include <assert.h>
-#endif
-
-extern const char *prog;
-extern pthread_key_t ctx_key;
-
-#if defined(AFS_EXTENDED_CALLBACK)
-#define RPC_TEST_EXTENDED_CALLBACK 1
-
-afs_int32 SRXAFSCB_ExtendedCallBack(
- /*IN */ struct rx_call *a_call,
- /*IN */ HostIdentifier * Server,
- /*IN */ AFSXCBInvocationSeq * Invocations_Array,
- /*OUT*/ AFSExtendedCallBackRSeq * CallBack_Result_Array)
-{
- rpc_test_request_ctx *ctx;
-
- ctx = CTX_FOR_RXCALL(a_call);
-
- printf("%s: SRXAFSCB_ExtendedCallBack: enter (%s)\n", prog,
- ctx->cb_svc_name);
-
- return (0);
-};
-#endif /* AFS_EXTENDED_CALLBACK */
-
-#if defined(AFS_BYTE_RANGE_FLOCKS)
-afs_int32 SRXAFSCB_AsyncIssueByteRangeLock(
- /*IN */ struct rx_call *a_call,
- /*IN */ HostIdentifier * Server,
- /*IN */ AFSByteRangeLockSeq Locks_Array)
-{
- rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call);
-
- printf("%s: SRXAFSCB_AsyncIssueByteRangeLock: enter (%s)\n", prog,
- ctx->cb_svc_name);
-
- return (0);
-}
-#endif /* AFS_BYTE_RANGE_FLOCKS */
-
-afs_int32
-SRXAFSCB_CallBack(struct rx_call *a_call, AFSCBFids *Fids_Array,
- AFSCBs *CallBack_Array)
-{
- rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call);
-
- printf("%s: SRXAFSCB_CallBack: enter (%s)\n", prog,
- ctx->cb_svc_name);
-
- return (0);
-}
-
-
-afs_int32
-SRXAFSCB_InitCallBackState(struct rx_call *a_call)
-{
- return (0);
-}
-
-
-afs_int32
-SRXAFSCB_Probe(struct rx_call *a_call)
-{
- return (0);
-}
-
-
-afs_int32
-SRXAFSCB_GetCE(struct rx_call *a_call,
- afs_int32 index,
- AFSDBCacheEntry * ce)
-{
- return(0);
-}
-
-
-afs_int32
-SRXAFSCB_GetLock(struct rx_call *a_call,
- afs_int32 index,
- AFSDBLock * lock)
-{
- return(0);
-}
-
-
-afs_int32
-SRXAFSCB_XStatsVersion(struct rx_call *a_call,
- afs_int32 * versionNumberP)
-{
- return(0);
-}
-
-
-afs_int32
-SRXAFSCB_GetXStats(struct rx_call *a_call,
- afs_int32 clientVersionNumber,
- afs_int32 collectionNumber,
- afs_int32 * srvVersionNumberP,
- afs_int32 * timeP,
- AFSCB_CollData * dataP)
-{
- return(0);
-}
-
-afs_int32
-SRXAFSCB_ProbeUuid(struct rx_call *a_call, afsUUID *a_uuid)
-{
- rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call);
- if ( !afs_uuid_equal(&ctx->cb_listen_addr.uuid, a_uuid) )
- return (1);
- else
- return (0);
-}
-
-
-afs_int32
-SRXAFSCB_WhoAreYou(struct rx_call *a_call, struct interfaceAddr *addr)
-{
- return SRXAFSCB_TellMeAboutYourself(a_call, addr, NULL);
-}
-
-
-afs_int32
-SRXAFSCB_InitCallBackState2(struct rx_call *a_call, struct interfaceAddr *
- addr)
-{
- return RXGEN_OPCODE;
-}
-
-
-afs_int32
-SRXAFSCB_InitCallBackState3(struct rx_call *a_call, afsUUID *a_uuid)
-{
- return (0);
-}
-
-
-afs_int32
-SRXAFSCB_GetCacheConfig(struct rx_call *a_call, afs_uint32 callerVersion,
- afs_uint32 *serverVersion, afs_uint32 *configCount,
- cacheConfig *config)
-{
- return RXGEN_OPCODE;
-}
-
-afs_int32
-SRXAFSCB_GetLocalCell(struct rx_call *a_call, char **a_name)
-{
- return RXGEN_OPCODE;
-}
-
-
-afs_int32
-SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index,
- char **a_name, serverList *a_hosts)
-{
- return RXGEN_OPCODE;
-}
-
-
-afs_int32
-SRXAFSCB_GetServerPrefs(struct rx_call *a_call, afs_int32 a_index,
- afs_int32 *a_srvr_addr, afs_int32 *a_srvr_rank)
-{
- return RXGEN_OPCODE;
-}
-
-
-afs_int32
-SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call, struct interfaceAddr *
- addr, Capabilities *capabilities)
-{
- rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call);
-
- printf("%s: SRXAFSCB_TellMeAboutYourself: enter (%s)\n", prog,
- ctx->cb_svc_name);
-
- addr->numberOfInterfaces = ctx->cb_listen_addr.numberOfInterfaces;
- addr->uuid = ctx->cb_listen_addr.uuid;
-
- if (capabilities) {
- afs_uint32 *dataBuffP;
- afs_int32 dataBytes;
-
- dataBytes = 1 * sizeof(afs_uint32);
- dataBuffP = (afs_uint32 *) xdr_alloc(dataBytes);
- dataBuffP[0] = CLIENT_CAPABILITY_ERRORTRANS;
-#if defined(AFS_EXTENDED_CALLBACK)
- if (ctx->flags & RPC_TEST_REQ_CTX_FLAG_XCB)
- dataBuffP[0] |= CLIENT_CAPABILITY_EXT_CALLBACK;
-#endif /* AFS_EXTENDED_CALLBACK */
- capabilities->Capabilities_len = dataBytes / sizeof(afs_uint32);
- capabilities->Capabilities_val = dataBuffP;
- }
-
- return (0);
-
-} /* SRXAFSCB_TellMeAboutYourself */
-
-
-afs_int32
-SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
- char **a_name, serverList *a_hosts)
-{
- return RXGEN_OPCODE;
-}
-
-
-afs_int32
-SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index,
- struct AFSDBCacheEntry64 *a_result)
-{
- return RXGEN_OPCODE;
-}
+++ /dev/null
-/*
- * Copyright (c) 2010, Linux Box Corporation.
- * All Rights Reserved.
- *
- * Portions Copyright (c) 2007, Hartmut Reuter,
- * RZG, Max-Planck-Institut f. Plasmaphysik.
- * 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 ``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
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-
-#include <afs/stds.h>
-
-#include "rpc_test_procs.h"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <signal.h>
-#include <afs/vice.h>
-#include <afs/cmd.h>
-#include <afs/auth.h>
-#include <afs/cellconfig.h>
-#include <afs/com_err.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#ifdef HAVE_DIRECT_H
-#include <direct.h>
-#endif
-#ifdef AFS_DARWIN_ENV
-#include <sys/malloc.h>
-#endif
-#include <afs/errors.h>
-#include <afs/sys_prototypes.h>
-#include <rx/rx_prototypes.h>
-#ifdef AFS_PTHREAD_ENV
-#include <assert.h>
-#endif
-
-const char *prog = "lockharness";
-
-#ifndef AFS_PTHREAD_ENV
-#error compilation without pthreads is not supported
-#endif
-
-
-int
-main(int argc, char **argv)
-{
- int i, code;
- rpc_test_request_ctx *c1, *c2;
- AFSFetchStatus outstatus;
-
- printf("%s: start\n", prog);
-
- code = rpc_test_PkgInit();
-
- /* replace with appropriate test addresses */
- code = init_fs_channel(&c1, "eth0", "10.1.1.213", "24",
- "10.1.1.81", /* fs */ RPC_TEST_REQ_CTX_FLAG_NONE);
- code = init_fs_channel(&c2, "eth0", "10.1.1.213", "24",
- "10.1.1.81" /* fs */, RPC_TEST_REQ_CTX_FLAG_XCB);
-
- printf("%s: channels initialized\n", prog);
-
- i = 0;
-repeat:
- {
- /* XXXX fid members should be...dynamic */
- AFSFid fid = { 536870915, 12, 4016};
- code = rpc_test_afs_fetch_status(c1, &fid, &outstatus);
- printf("%s: c1 call returned %d\n", prog, code);
- }
-
- {
- /* XXXX fid members should be...dynamic */
- AFSFid fid = { 536870915, 12, 4016};
- code = rpc_test_afs_fetch_status(c2, &fid, &outstatus);
- printf("%s: c2 call returned %d\n", prog, code);
- }
-
- /* force bcb at c1 */
- {
- AFSFid fid = { 536870915, 12, 4016};
- AFSStoreStatus instatus;
- instatus.Mask = 0;
- instatus.SegSize = 0;
- instatus.Owner = outstatus.Owner;
- instatus.Group = outstatus.Group;
- instatus.UnixModeBits = outstatus.UnixModeBits;
- instatus.ClientModTime = time(NULL);
- code = rpc_test_afs_store_status(c2, &fid, &instatus, &outstatus);
- printf("%s: c2 store status returned %d\n", prog, code);
- }
-
- /* force bcb at c2 */
- {
- AFSFid fid = { 536870915, 12, 4016};
- AFSStoreStatus instatus;
- instatus.Mask = 0;
- instatus.SegSize = 0;
- instatus.Owner = outstatus.Owner;
- instatus.Group = outstatus.Group;
- instatus.UnixModeBits = outstatus.UnixModeBits;
- instatus.ClientModTime = time(NULL);
- code = rpc_test_afs_store_status(c1, &fid, &instatus, &outstatus);
- printf("%s: c1 store status returned %d\n", prog, code);
- }
- i++;
- if (i < 10)
- goto repeat;
-
-#if defined(AFS_BYTE_RANGE_FLOCKS)
- /* set a lock on c1 */
- {
- AFSFid fid = { 536870915, 12, 4016};
- AFSByteRangeLock lock;
- memset(&lock, 0, sizeof(AFSByteRangeLock));
- lock.Fid = fid;
- lock.Type = LockWrite;
- lock.Flags = 0;
- lock.Owner = 1001;
- lock.Uniq = 1;
- lock.Offset = 50;
- lock.Length = 100;
- code = rpc_test_afs_set_byterangelock(c1, &lock);
- printf("%s: c1 set lock returned %d\n", prog, code);
- }
-
- /* try to set the same lock in c2 (should FAIL) */
- {
- AFSFid fid = { 536870915, 12, 4016};
- AFSByteRangeLock lock;
- memset(&lock, 0, sizeof(AFSByteRangeLock));
- lock.Fid = fid;
- lock.Type = LockWrite;
- lock.Flags = 0;
- lock.Owner = 1002;
- lock.Uniq = 2;
- lock.Offset = 50;
- lock.Length = 100;
- code = rpc_test_afs_set_byterangelock(c2, &lock);
- printf("%s: c2 set lock returned %d\n", prog, code);
- }
-
- /* release lock on c1 */
- {
- AFSFid fid = { 536870915, 12, 4016};
- AFSByteRangeLock lock;
- memset(&lock, 0, sizeof(AFSByteRangeLock));
- lock.Fid = fid;
- lock.Type = LockWrite;
- lock.Flags = 0;
- lock.Owner = 1001;
- lock.Uniq = 1;
- lock.Offset = 50;
- lock.Length = 100;
- code = rpc_test_afs_release_byterangelock(c1, &lock);
- printf("%s: c1 set lock returned %d\n", prog, code);
- }
-#endif /* AFS_BYTE_RANGE_FLOCKS */
-
- printf("%s: wait %d sec for processing\n", prog, 5);
- sleep(5);
-
- code = destroy_fs_channel(c1);
- code = destroy_fs_channel(c2);
-
- rpc_test_PkgShutdown();
-
- printf("%s: finish\n", prog);
-
- exit (0);
-
-} /* main */
+++ /dev/null
-/*
- * Copyright (c) 2010, Linux Box Corporation.
- * All Rights Reserved.
- *
- * Portions Copyright (c) 2007, Hartmut Reuter,
- * RZG, Max-Planck-Institut f. Plasmaphysik.
- * 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 ``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
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <afsconfig.h>
-#include <afs/param.h>
-
-#include <roken.h>
-
-#include <afs/stds.h>
-
-#include "rpc_test_procs.h"
-
-#ifdef AFS_NT40_ENV
-#include <windows.h>
-#include <WINNT/afsevent.h>
-#else
-#include <sys/file.h>
-#include <afs/venus.h>
-#include <sys/time.h>
-#endif
-#include <afs/afsint.h>
-#define FSINT_COMMON_XG 1
-#include <afs/vice.h>
-#include <afs/cmd.h>
-#include <afs/auth.h>
-#include <afs/cellconfig.h>
-
-#include <afs/com_err.h>
-#ifdef HAVE_DIRECT_H
-#include <direct.h>
-#endif
-#include <afs/errors.h>
-#include <afs/sys_prototypes.h>
-#include <rx/rx_prototypes.h>
-#ifdef AFS_PTHREAD_ENV
-#include <assert.h>
-#endif
-
-extern const char *prog;
-const int ctx_key = 1;
-
-#if 1
-#define RPC_TEST_GLOBAL_RX_INIT 1
-#else
-#undef RPC_TEST_GLOBAL_RX_INIT
-#endif
-
-const afs_uint32 fs_port = 7000;
-
-typedef struct rpc_test_pkg_params {
- pthread_mutex_t mtx;
- pthread_mutexattr_t mtx_attrs;
- afs_uint32 cb_next_port;
- afs_uint32 next_cno;
-} rpc_test_pkg_params;
-static rpc_test_pkg_params rpc_test_params;
-
-afs_int32 rpc_test_PkgInit(void)
-{
- afs_int32 code = 0;
- static afs_uint32 rpc_test_initialized = 0; /* once */
-
- if (!rpc_test_initialized) {
- rpc_test_initialized = 1;
- } else {
- printf("%s: rpc_test_PkgInit: package already initialized\n", prog);
- exit(1);
- }
-
-#ifndef AFS_NT40_ENV
- code = pthread_mutexattr_init(&rpc_test_params.mtx_attrs);
- if (code) {
- printf("%s: rpc_test_PkgInit: pthread_mutexattr_init failed\n", prog);
- exit(1);
- }
- code = pthread_mutex_init(&rpc_test_params.mtx, &rpc_test_params.mtx_attrs);
- if (code) {
- printf("%s: rpc_test_PkgInit: pthread_mutex_init failed\n", prog);
- exit(1);
- }
-#endif
-
- /* start connection sequence */
- rpc_test_params.next_cno = 1;
-
- /* set the starting port in sequence */
- rpc_test_params.cb_next_port = 7105;
-
-#if defined(RPC_TEST_GLOBAL_RX_INIT)
- rx_Init(0);
-#endif
-
- return (code);
-
-} /* rpc_test_PkgInit */
-
-static void *
-init_callback_service_lwp(void *arg)
-{
- struct rx_securityClass *sc;
- struct rx_service *svc;
-
- rpc_test_request_ctx *ctx = (rpc_test_request_ctx *) arg;
-
- printf("%s: init_callback_service_lwp: listen_addr: %s "
- "(%d) cb_port: %d\n",
- prog, ctx->cb_listen_addr_s, ctx->cb_listen_addr.addr_in[0],
- ctx->cb_port);
-
- sc = (struct rx_securityClass *) rxnull_NewServerSecurityObject();
- if (!sc) {
- fprintf(stderr,"rxnull_NewServerSecurityObject failed for callback "
- "service\n");
- exit(1);
- }
-
-#if defined(RPC_TEST_GLOBAL_RX_INIT)
- svc = rx_NewServiceHost(htonl(INADDR_ANY), htons(ctx->cb_port), 1,
- ctx->cb_svc_name, &sc, 1, RXAFSCB_ExecuteRequest);
-#else
- svc = rx_NewService(0, 1, ctx->cb_svc_name, &sc, 1, RXAFSCB_ExecuteRequest);
-#endif
- /* stash context */
- rx_SetServiceSpecific(svc, ctx_key, ctx);
-
- if (!svc) {
- fprintf(stderr,"rx_NewServiceHost failed for callback service\n");
- exit(1);
- }
-
- /* XXX stash service so we can hijack its rx_socket when inititiating
- * RPC calls */
- ctx->svc = svc;
-
- /* release pkg mutex before entering rx processing loop */
- pthread_mutex_unlock(&rpc_test_params.mtx);
-
- rx_StartServer(1);
-
- printf("%s: init_callback_service_lwp: finished", prog);
-
- return (NULL);
-
-} /* callback_service_lwp */
-
-afs_int32 init_callback_service(rpc_test_request_ctx *ctx)
-{
- pthread_t tid;
- pthread_attr_t tattr;
- afs_int32 code = 0;
-
- afs_uuid_create(&(ctx->cb_listen_addr.uuid));
-
-#if !defined(RPC_TEST_GLOBAL_RX_INIT)
- code = rx_Init((int) htons(ctx->cb_port));
-#endif /* RPC_TEST_GLOBAL_RX_INIT */
-
- assert(pthread_attr_init(&tattr) == 0);
- assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
- assert(pthread_create(&tid, &tattr, init_callback_service_lwp, ctx) == 0);
-
- return (code);
-
-} /* init_callback_service */
-
-afs_int32 init_fs_channel(rpc_test_request_ctx **octx, char *cb_if,
- char *listen_addr_s, char *prefix, char *fs_addr_s,
- afs_uint32 flags)
-{
- rpc_test_request_ctx *ctx;
- afs_int32 code = 0;
-#ifdef AFS_NT40_ENV
- afs_int32 sslen = sizeof(struct sockaddr);
-#endif
-
- ctx = *octx = (rpc_test_request_ctx *) malloc(sizeof(rpc_test_request_ctx));
- memset(ctx, 0, sizeof(rpc_test_request_ctx));
-
- /* initialize a local mutex */
- code = pthread_mutex_init(&ctx->mtx, &rpc_test_params.mtx_attrs);
-
- /* lock package before rx setup--which has global deps, atm */
- pthread_mutex_lock(&rpc_test_params.mtx);
-
- ctx->cno = rpc_test_params.next_cno++;
- ctx->flags = flags;
-
- /* afscbint (server) */
- sprintf(ctx->cb_svc_name, "cb_%d", ctx->cno);
- sprintf(ctx->cb_if_s, "%s", cb_if);
- sprintf(ctx->cb_listen_addr_s, "%s", listen_addr_s);
- sprintf(ctx->cb_prefix_s, "%s", prefix);
- sprintf(ctx->fs_addr_s, "%s", fs_addr_s);
-
-#if defined(RPC_TEST_ADD_ADDRESSES)
-#if defined(AFS_LINUX26_ENV)
- sprintf(cmd, "ip addr add %s/%s dev %s label %s", listen_addr_s, prefix,
- cb_if, cb_if);
- code = system(cmd);
-#endif
-#endif /* RPC_TEST_ADD_ADDRESSES */
-
- /* lock this */
- pthread_mutex_lock(&ctx->mtx);
-
- /* set up rx */
- ctx->cb_port = rpc_test_params.cb_next_port++;
- ctx->cb_listen_addr.numberOfInterfaces = 1;
-
-#ifdef AFS_NT40_ENV
- code = WSAStringToAddressA(listen_addr_s, AF_INET, NULL,
- (struct sockaddr*) &(ctx->cb_listen_addr), &sslen);
-#else
- code = inet_pton(AF_INET, listen_addr_s,
- (void*) &(ctx->cb_listen_addr.addr_in[0]));
-#endif
-
- code = init_callback_service(ctx /* LOCKED, && rpc_test_params->mtx LOCKED */);
-
- /* fsint (client) */
-
-#ifdef AFS_NT40_ENV
- code = WSAStringToAddressA(fs_addr_s, AF_INET, NULL,
- (struct sockaddr*) &(ctx->fs_addr.addr_in[0]), &sslen);
-#else
- code = inet_pton(AF_INET, fs_addr_s, (void*) &(ctx->fs_addr.addr_in[0]));
-#endif
- ctx->sc = rxnull_NewClientSecurityObject();
- ctx->sc_index = RX_SECIDX_NULL;
- ctx->conn = rx_NewConnection(ctx->fs_addr.addr_in[0], (int) htons(fs_port),
- 1, ctx->sc, ctx->sc_index);
-
- /* unlock this */
- pthread_mutex_unlock(&ctx->mtx);
-
- return (code);
-
-} /* init_fs_channel */
-
-/* XXX use the pkg lock to protect the state of rx_socket for
- * the duration of the call, switching it out for the stashed
- * rx_socket created by rx_NewService for this channel */
-#define RXCALL_WITH_SOCK(code, ctx, call) \
- do { \
- osi_socket prev_rx_socket; \
- pthread_mutex_lock(&rpc_test_params.mtx); \
- prev_rx_socket = rx_socket; \
- rx_socket = ctx->svc->socket; \
- code = call; \
- rx_socket = prev_rx_socket; \
- pthread_mutex_unlock(&rpc_test_params.mtx); \
-} while(0);
-
-afs_int32
-rpc_test_afs_fetch_status(rpc_test_request_ctx *ctx, AFSFid *fid,
- AFSFetchStatus *outstatus)
-{
- struct AFSVolSync tsync;
- struct AFSCallBack tcb;
- afs_int32 code = 0;
-
- RXCALL_WITH_SOCK(code, ctx,
- (RXAFS_FetchStatus(ctx->conn, fid, outstatus, &tcb, &tsync)));
-
- return (code);
-
-} /* rpc_test_afs_fetch_status */
-
-afs_int32
-rpc_test_afs_store_status(rpc_test_request_ctx *ctx, AFSFid *fid,
- AFSStoreStatus *instatus, AFSFetchStatus *outstatus)
-{
- struct AFSVolSync tsync;
- afs_int32 code = 0;
-
- RXCALL_WITH_SOCK(code, ctx,
- (RXAFS_StoreStatus(ctx->conn, fid, instatus, outstatus, &tsync)));
-
- return (code);
-
-} /* rpc_test_afs_fetch_status */
-
-#if defined(AFS_BYTE_RANGE_FLOCKS)
-afs_int32 rpc_test_afs_set_byterangelock(rpc_test_request_ctx *ctx,
- AFSByteRangeLock * lock)
-{
- struct rx_call *tcall;
- afs_int32 code = 0;
-
- RXCALL_WITH_SOCK(code, ctx,
- (RXAFS_SetByteRangeLock(ctx->conn, lock)));
-
- return (code);
-
-} /* rpc_test_afs_set_byterangelock */
-
-afs_int32 rpc_test_afs_release_byterangelock(rpc_test_request_ctx *ctx,
- AFSByteRangeLock * lock)
-{
- struct rx_call *tcall;
- afs_int32 code = 0;
-
- RXCALL_WITH_SOCK(code, ctx,
- (RXAFS_ReleaseByteRangeLock(ctx->conn, lock)));
-
- return (code);
-
-} /* rpc_test_afs_release_byterangelock */
-
-afs_int32 rpc_test_afs_upgrade_byterangelock(rpc_test_request_ctx *ctx,
- AFSByteRangeLock * lock)
-{
- afs_int32 code = 0;
-
- /* TODO: implement */
-
- return (code);
-
-} /* rpc_test_afs_upgrade_byterangelock */
-
-afs_int32 rpc_test_afs_downgrade_byterangelock(rpc_test_request_ctx *ctx,
- AFSByteRangeLock * Lock)
-{
- afs_int32 code = 0;
-
- /* TODO: implement */
-
- return (code);
-
-} /* rpc_test_afs_downgrade_byterangelock */
-#endif /* AFS_BYTE_RANGE_FLOCKS */
-
-afs_int32
-destroy_fs_channel(rpc_test_request_ctx *ctx)
-{
- afs_int32 code = 0;
-#if defined(RPC_TEST_ADD_ADDRESSES)
-#if defined(AFS_LINUX26_ENV)
- sprintf(cmd, "ip addr del %s/%s dev %s label %s", ctx->cb_listen_addr_s,
- ctx->cb_prefix_s, ctx->cb_if_s, ctx->cb_if_s);
- code = system(cmd);
-#endif
-#endif /* RPC_TEST_ADD_ADDRESSES */
- assert(ctx);
- free(ctx);
- return (code);
-
-} /* destroy_fs_channel */
-
-void
-rpc_test_PkgShutdown(void)
-{
-} /* rpc_test_PkgShutdown */
+++ /dev/null
-/*
- * Copyright (c) 2010, Linux Box Corporation.
- * All Rights Reserved.
- *
- * Portions Copyright (c) 2007, Hartmut Reuter,
- * RZG, Max-Planck-Institut f. Plasmaphysik.
- * 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 ``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
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RPC_TEST_PROCS_H
-#define _RPC_TEST_PROCS_H
-
-#include <afsconfig.h>
-#include <afs/param.h>
-#include <afs/stds.h>
-
-#include <afs/afsutil.h>
-#include <rx/rx.h>
-#include <rx/xdr.h>
-#include <afs/afs_consts.h>
-#include <afs/afsint.h>
-#define FSINT_COMMON_XG 1
-#include <afs/afscbint.h>
-#include <pthread.h>
-
-#define RPC_TEST_REQ_CTX_FLAG_NONE 0x0000
-#define RPC_TEST_REQ_CTX_FLAG_XCB 0x0001
-
-typedef struct rpc_test_request_ctx {
- afs_uint32 flags;
- /* sync */
- pthread_mutex_t mtx;
- /* local address */
- char cb_svc_name[256];
- char cb_if_s[256];
- char cb_listen_addr_s[256];
- char cb_prefix_s[256];
- char fs_addr_s[256];
- interfaceAddr cb_listen_addr;
- interfaceAddr fs_addr;
- /* rx connection */
- afs_uint32 cno;
- afs_uint32 cb_port;
- struct rx_connection *conn;
- struct rx_securityClass *sc;
- struct rx_service *svc; /* until rx fixes client socket mgmt */
- afs_int32 sc_index;
- /* stats */
- afs_uint32 calls;
-} rpc_test_request_ctx;
-
-
-#define CTX_FOR_RXCALL(call) \
- (rx_GetServiceSpecific((rx_ServiceOf(rx_ConnectionOf(call))), ctx_key))
-
-afs_int32 rpc_test_PkgInit(void);
-void rpc_test_PkgShutdown(void);
-
-/* call channel, callback RPC server multiplexing */
-afs_int32 init_fs_channel(rpc_test_request_ctx **ctx /* out */, char *cb_if,
- char *listen_addr_s, char *prefix, char *fs_addr_s, afs_uint32 flags);
-afs_int32 destroy_fs_channel(rpc_test_request_ctx *ctx);
-
-/* test proc wrappers */
-afs_int32 rpc_test_fetch_status(void);
-afs_int32 rpc_test_afs_fetch_status(rpc_test_request_ctx *ctx, AFSFid *fid,
- AFSFetchStatus *outstatus);
-#if defined(AFS_BYTE_RANGE_FLOCKS) /* when will then be now? soon. */
-afs_int32 rpc_test_afs_set_byterangelock(rpc_test_request_ctx *ctx,
- AFSByteRangeLock * Lock);
-afs_int32 rpc_test_afs_release_byterangelock(rpc_test_request_ctx *ctx,
- AFSByteRangeLock * Lock);
-afs_int32 rpc_test_afs_upgrade_byterangelock(rpc_test_request_ctx *ctx,
- AFSByteRangeLock * Lock);
-afs_int32 rpc_test_afs_downgrade_byterangelock(rpc_test_request_ctx *ctx,
- AFSByteRangeLock * Lock);
-#endif /* AFS_BYTE_RANGE_FLOCKS */
-
-afs_int32 rpc_test_afs_store_status(rpc_test_request_ctx *ctx, AFSFid *fid,
- AFSStoreStatus *instatus, AFSFetchStatus *outstatus);
-afs_int32 rpc_test_afs_storedata_range(rpc_test_request_ctx *ctx, AFSFid *fid,
- void *stuff);
-
-#endif /* _RPC_TEST_PROCS_H */
MODULE_CFLAGS = -I$(TOP_OBJDIR)
-LIBS = ../tap/libtap.a \
+LIBS = $(abs_top_builddir)/tests/common/libafstest_common.la \
$(abs_top_builddir)/src/rx/liboafs_rx.la
-tests = event-t
+BINS = atomic-t event-t
-all check test tests: $(tests)
+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)
clean distclean:
$(LT_CLEAN)
- $(RM) -f $(tests) *.o core
+ $(RM) -f $(BINS) *.o core
--- /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;
+}
+
use strict;
use warnings;
+use lib $ENV{C_TAP_SOURCE} . "/tests-lib/perl5";
+use afstest qw(obj_path);
use Test::More tests=>4;
use POSIX qw(:sys_wait_h :signal_h);
my $port = 4000;
-my $build = $ENV{C_TAP_BUILD};
-$build = ".." if (!defined($build));
-my $rxperf = $build."/../src/tools/rxperf/rxperf";
+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
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");
kill("TERM", $pid);
waitpid($pid, 0);
-if (WIFSIGNALED($?) && WTERMSIG($?) != SIGTERM) {
- fail("Server died with signal ".WTERMSIG($?));
-} elsif (WIFEXITED($?) && WEXITSTATUS($?) != 0) {
- fail("Server exited with code". WEXITSTATUS($?));
+my $ecode = ${^CHILD_ERROR_NATIVE};
+if (WIFSIGNALED($ecode) && WTERMSIG($ecode) != SIGTERM) {
+ fail("Server died with signal ".WTERMSIG($ecode));
+} elsif (WIFEXITED($ecode) && WEXITSTATUS($ecode) != 0) {
+ fail("Server exited with code". WEXITSTATUS($ecode));
} else {
pass("Server exited succesfully");
}
-
-
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread
-objects = basic.o
+LT_objs = basic.lo
-all check test tests: libtap.a basic.h macros.h libtap.sh
+all: libafstest_tap.la basic.h macros.h libtap.sh
-basic.o: $(tapdir)/basic.c $(tapdir)/basic.h
- $(CC) $(AFS_CFLAGS) @CFLAGS_NOERROR@ -I$(tapdir)/../.. -c $(tapdir)/basic.c
+CFLAGS_basic.lo = @CFLAGS_NOERROR@ -I$(tapdir)/../..
+basic.lo: $(tapdir)/basic.c $(tapdir)/basic.h
+ $(LT_CCRULE) $(tapdir)/basic.c
basic.h: $(tapdir)/basic.h
cp $(tapdir)/basic.h basic.h
libtap.sh: $(tapdir)/libtap.sh
cp $(tapdir)/libtap.sh libtap.sh
-libtap.a: $(objects)
- $(RM) -f libtap.a
- $(AR) crv libtap.a $(objects)
- $(RANLIB) libtap.a
-
-install:
+# Use LT_LDLIB_shlib_internal, since this is an internal-only library (just
+# used for the tests), so we don't need a symbol export list.
+libafstest_tap.la: $(LT_objs)
+ $(LT_LDLIB_shlib_internal) $(LT_objs)
clean distclean:
- $(RM) -f *.o *.a core basic.h macros.h libtap.sh
+ $(LT_CLEAN)
+ $(RM) -f *.o basic.h macros.h libtap.sh
--- /dev/null
+# Copyright (c) 2020 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.
+
+package afstest;
+require Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw(src_path obj_path);
+
+sub
+x_path($;$)
+{
+ my ($env_var, $path) = @_;
+ my $tdir = $ENV{$env_var};
+ if (!defined($tdir)) {
+ # If C_TAP_SOURCE/C_TAP_BUILD isn't set, we assume we're running from
+ # the same cwd as one of the test programs (e.g. 'tests/foo/'). So to
+ # get to 'tests/', just go up one level.
+ $tdir = "..";
+ }
+
+ # $tdir now represents the 'tests/' dir. Go one level up to get to the
+ # top-level dir.
+ if (defined($path)) {
+ return "$tdir/../$path";
+ } else {
+ return "$tdir/..";
+ }
+}
+
+sub
+src_path(;$)
+{
+ my $path = $_[0];
+ return x_path("C_TAP_SOURCE", $path);
+}
+
+sub
+obj_path(;$)
+{
+ my $path = $_[0];
+ return x_path("C_TAP_BUILD", $path);
+}
#
use File::Basename;
use Test::More;
+use afstest qw(src_path obj_path);
sub check_command_binary {
my $c = shift(@_);
sub run_manpage_tests($$) {
my ($subdir, $command) = @_;
- # When run from 'runtests', our cwd will be TOP_OBJDIR/tests. $C_TAP_SOURCE
- # is set to TOP_SRCDIR/tests, and $C_TAP_BUILD is set to TOP_OBJDIR/tests.
- # We want the top-level src and obj dirs, in order to find the relevant
- # binaries and manpages.
- my $srcdir = $ENV{C_TAP_SOURCE} . "/..";
- my $objdir = $ENV{C_TAP_BUILD} . "/..";
+ my $srcdir = src_path();
+ my $objdir = obj_path();
my @sub_commands = lookup_sub_commands("$objdir/$subdir", $command);
die("No subcommands found in $objdir/$subdir/$command?") unless(@sub_commands);
srcdir=@srcdir@
abs_top_builddir=@abs_top_builddir@
include @TOP_OBJDIR@/src/config/Makefile.config
-include @TOP_OBJDIR@/src/config/Makefile.lwp
+include @TOP_OBJDIR@/src/config/Makefile.pthread
+include @TOP_OBJDIR@/src/config/Makefile.libtool
MODULE_CFLAGS = -I$(TOP_OBJDIR)
-LIBS = ../tap/libtap.a \
- $(abs_top_builddir)/lib/util.a \
- $(abs_top_builddir)/lib/libopr.a
+LIBS = $(abs_top_builddir)/tests/common/libafstest_common.la \
+ $(abs_top_builddir)/src/util/liboafs_util.la \
+ $(abs_top_builddir)/src/opr/liboafs_opr.la
-tests = ktime-t exec-alt-t volutil-t
+BINS = ktime-t exec-alt-t volutil-t
-all check test tests: $(tests)
+all: $(BINS)
-ktime-t: ktime-t.o $(LIBS)
- $(AFS_LDRULE) ktime-t.o $(LIBS) $(XLIBS)
+ktime-t: ktime-t.lo $(LIBS)
+ $(LT_LDRULE_static) ktime-t.lo $(LIBS) $(XLIBS)
-exec-alt-t: exec-alt-t.o $(LIBS)
- $(AFS_LDRULE) exec-alt-t.o $(LIBS) $(XLIBS)
+exec-alt-t: exec-alt-t.lo $(LIBS)
+ $(LT_LDRULE_static) exec-alt-t.lo $(LIBS) $(XLIBS)
-volutil-t: volutil-t.o $(LIBS)
- $(AFS_LDRULE) volutil-t.o $(LIBS) $(LIB_roken) $(XLIBS)
+volutil-t: volutil-t.lo $(LIBS)
+ $(LT_LDRULE_static) volutil-t.lo $(LIBS) $(XLIBS)
install:
clean distclean:
- $(RM) -f $(tests) *.o core
+ $(LT_CLEAN)
+ $(RM) -f $(BINS) *.o core
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;
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread
-TESTS = vos-t
+BINS = vos-t
MODULE_CFLAGS=-I$(TOP_OBJDIR) -I$(srcdir)/../common/
-all check test tests: $(TESTS)
+all: $(BINS)
-MODULE_LIBS = ../tap/libtap.a \
+MODULE_LIBS = $(abs_top_builddir)/tests/common/libafstest_common.la \
$(abs_top_builddir)/src/vlserver/liboafs_vldb.la \
$(XLIBS)
-vos-t: vos-t.o ../common/config.o ../common/servers.o ../common/ubik.o \
- ../common/network.o ../common/misc.o
- $(LT_LDRULE_static) vos-t.o ../common/config.o ../common/servers.o \
- ../common/ubik.o ../common/network.o ../common/misc.o \
- $(MODULE_LIBS)
+vos-t: vos-t.o
+ $(LT_LDRULE_static) vos-t.o $(MODULE_LIBS)
clean:
$(LT_CLEAN)
- rm -f *.o $(TESTS)
+ rm -f *.o $(BINS)
{
int code;
bulkaddrs addrs;
- pid_t pid;
- int outpipe[2];
- int status;
- char *buffer;
- size_t len;
+ char *vos;
+ char *cmd = NULL;
+ struct afstest_cmdinfo cmdinfo;
afs_uint32 addrsA[] = {0x0a000000};
afs_uint32 addrsB[] = {0x0a000001, 0x0a000002, 0x0a000003, 0x0a000004,
is_int(0, code, "Second address registration succeeds");
/* Now we need to run vos ListAddrs and see what happens ... */
- if (pipe(outpipe) < 0) {
- perror("pipe");
- exit(1);
- }
- pid = fork();
- if (pid == 0) {
- char *build, *binPath;
-
- dup2(outpipe[1], STDOUT_FILENO); /* Redirect stdout into pipe */
- close(outpipe[0]);
- close(outpipe[1]);
-
- build = getenv("C_TAP_BUILD");
- if (build == NULL)
- build = "..";
-
- if (asprintf(&binPath, "%s/../src/volser/vos", build) < 0) {
- fprintf(stderr, "Out of memory building vos arguments\n");
- exit(1);
- }
- execl(binPath, "vos",
- "listaddrs", "-config", dirname, "-noauth", "-noresolve", NULL);
- exit(1);
- }
- close(outpipe[1]);
- buffer = malloc(4096);
- len = read(outpipe[0], buffer, 4096);
- waitpid(pid, &status, 0);
- buffer[len]='\0';
- is_string(expecting, buffer, "vos output matches");
- free(buffer);
+ vos = afstest_obj_path("src/volser/vos");
+
+ cmd = afstest_asprintf("'%s' listaddrs -config '%s' "
+ "-noauth -noresolve",
+ vos, dirname);
+
+ memset(&cmdinfo, 0, sizeof(cmdinfo));
+ cmdinfo.exit_code = 0;
+ cmdinfo.output = expecting;
+ cmdinfo.fd = STDOUT_FILENO;
+ cmdinfo.command = cmd;
+
+ is_command(&cmdinfo, "vos output matches");
+
+ free(vos);
+ free(cmd);
}
int
code = rx_Init(0);
- dirname = afstest_BuildTestConfig();
+ dirname = afstest_BuildTestConfig(NULL);
dir = afsconf_Open(dirname);
- code = afstest_AddDESKeyFile(dir);
- if (code) {
- afs_com_err(argv0, code, "while adding test DES keyfile");
- ret = 1;
- goto out;
- }
-
code = afstest_StartVLServer(dirname, &serverPid);
if (code) {
afs_com_err(argv0, code, "while starting the vlserver");
is_int(0, code, "Server exited cleanly");
}
- afstest_UnlinkTestConfig(dirname);
+ afstest_rmdtemp(dirname);
return ret;
}