Import am-utils 6.2-20140117
This commit is contained in:
parent
de8b484268
commit
8bae5d409d
9
external/bsd/am-utils/dist/COPYING
vendored
9
external/bsd/am-utils/dist/COPYING
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 1997-2009 Erez Zadok
|
||||
Copyright (c) 1997-2014 Erez Zadok
|
||||
Copyright (c) 1989 Jan-Simon Pendry
|
||||
Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -15,12 +15,7 @@ are met:
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. All advertising materials mentioning features or use of this software
|
||||
must display the following acknowledgment:
|
||||
This product includes software developed by the University of
|
||||
California, Berkeley and its contributors, as well as the Trustees of
|
||||
Columbia University.
|
||||
4. Neither the name of the University nor the names of its contributors
|
||||
3. Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
|
213
external/bsd/am-utils/dist/INSTALL
vendored
213
external/bsd/am-utils/dist/INSTALL
vendored
@ -1,19 +1,25 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
||||
2006, 2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
Briefly, the shell command `./configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package.
|
||||
instructions specific to this package. Some packages provide this
|
||||
`INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
@ -42,7 +48,7 @@ may remove or edit it.
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system.
|
||||
@ -53,12 +59,22 @@ The simplest way to compile this package is:
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the `make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
5. Optionally, type `make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior `make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
@ -67,15 +83,22 @@ The simplest way to compile this package is:
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
6. Often, you can also type `make uninstall' to remove the installed
|
||||
files again.
|
||||
7. Often, you can also type `make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide `make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like `make install' and `make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that the
|
||||
`configure' script does not know about. Run `./configure --help' for
|
||||
details on some of the pertinent environment variables.
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
@ -88,25 +111,41 @@ is an example:
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
source code in the directory that `configure' is in and in `..'. This
|
||||
is known as a "VPATH" build.
|
||||
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple `-arch' options to the
|
||||
compiler but only a single `-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the `lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' installs the package's commands under
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX'.
|
||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
@ -117,16 +156,47 @@ Documentation and other data files still use the regular prefix.
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
you can set and what kinds of files go in them. In general, the
|
||||
default for these options is expressed in terms of `${prefix}', so that
|
||||
specifying just `--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to `configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
`make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, `make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
`${prefix}'. Any directories that were specified during `configure',
|
||||
but not in terms of `${prefix}', must each be overridden at install
|
||||
time for the entire installation to be relocated. The approach of
|
||||
makefile variable overrides for each directory variable is required by
|
||||
the GNU Coding Standards, and ideally causes no recompilation.
|
||||
However, some platforms have known limitations with the semantics of
|
||||
shared libraries that end up requiring recompilation when using this
|
||||
method, particularly noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the `DESTDIR' variable. For
|
||||
example, `make install DESTDIR=/alternate/directory' will prepend
|
||||
`/alternate/directory' before all installation names. The approach of
|
||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of `${prefix}'
|
||||
at `configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
@ -138,14 +208,58 @@ find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of `make' will be. For these packages, running `./configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with `make V=1'; while running `./configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with `make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
||||
CC is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX `make' updates targets which have the same time stamps as
|
||||
their prerequisites, which makes it generally unusable when shipped
|
||||
generated files such as `configure' are involved. Use GNU `make'
|
||||
instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
|
||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
||||
to try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
|
||||
in your `PATH', put it _after_ `/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in `/boot/common',
|
||||
not `/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out automatically,
|
||||
but needs to determine by the type of machine the package will run on.
|
||||
Usually, assuming the package is built to be run on the _same_
|
||||
architectures, `configure' can figure that out, but if it prints a
|
||||
message saying it cannot guess the machine type, give it the
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
@ -153,7 +267,8 @@ type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
@ -171,9 +286,9 @@ eventually be run) with `--host=TYPE'.
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share, you
|
||||
can create a site shell script called `config.site' that gives default
|
||||
values for variables like `CC', `cache_file', and `prefix'.
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
@ -182,7 +297,7 @@ A warning: not all `configure' scripts look for a site script.
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
@ -194,18 +309,27 @@ causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
an Autoconf limitation. Until the limitation is lifted, you can use
|
||||
this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it operates.
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
Print a summary of all of the options to `configure', and exit.
|
||||
|
||||
`--help=short'
|
||||
`--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
`configure', and exit. The `short' variant lists options used
|
||||
only in the top level, while the `recursive' variant lists options
|
||||
also present in any nested packages.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
@ -232,6 +356,15 @@ an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names::
|
||||
for more details, including other options available for fine-tuning
|
||||
the installation locations.
|
||||
|
||||
`--no-create'
|
||||
`-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
||||
|
9
external/bsd/am-utils/dist/Makefile.am
vendored
9
external/bsd/am-utils/dist/Makefile.am
vendored
@ -6,6 +6,8 @@
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = \
|
||||
libamu \
|
||||
amd \
|
||||
@ -61,6 +63,7 @@ EXTRA_DIST_M4 = \
|
||||
m4/macros/check_mnt2_gen_opt.m4 \
|
||||
m4/macros/check_mnt2_nfs_opt.m4 \
|
||||
m4/macros/check_mnt2_pcfs_opt.m4 \
|
||||
m4/macros/check_mnt2_udf_opt.m4 \
|
||||
m4/macros/check_mnttab_file_name.m4 \
|
||||
m4/macros/check_mnttab_location.m4 \
|
||||
m4/macros/check_mnttab_opt.m4 \
|
||||
@ -284,7 +287,8 @@ EXTRA_DIST_INCLUDE = \
|
||||
include/am_defs.h \
|
||||
include/amq_defs.h \
|
||||
include/mount_headers1.h \
|
||||
include/mount_headers2.h
|
||||
include/mount_headers2.h \
|
||||
include/nfs_common.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(EXTRA_DIST_M4) \
|
||||
@ -310,7 +314,8 @@ EXTRA_DIST = \
|
||||
ldap-id.ms \
|
||||
ldap-id.txt \
|
||||
stamp-h.in \
|
||||
tasks
|
||||
tasks \
|
||||
ylwrap.amd
|
||||
|
||||
DISTCLEANFILES = amu_nfs_prot.h amu_autofs_prot.h config.cache.old dbgcf.h
|
||||
CLEANFILES = dbgcf.h
|
||||
|
26
external/bsd/am-utils/dist/NEWS
vendored
26
external/bsd/am-utils/dist/NEWS
vendored
@ -1,3 +1,29 @@
|
||||
*** Notes specific to am-utils version 6.2
|
||||
|
||||
- Removed license advertising clause
|
||||
- Removed expn program
|
||||
|
||||
*** Notes specific to am-utils version 6.2-rc1
|
||||
|
||||
Filesystem Support:
|
||||
- Add support for NFSv4
|
||||
- Add support for Lustre
|
||||
- Add support for ext{2,3,4}
|
||||
- Add support for linux autofs version 5
|
||||
- Add support for TMPFS and UDF
|
||||
New features:
|
||||
- Add amq -i (prints information about maps)
|
||||
- Add synchronous unmount code for amq -uu
|
||||
- Allow a comma-separated list of LDAP servers for failover
|
||||
Changes in behavior:
|
||||
- Empty variable assignments, now unset the variable value.
|
||||
- Share LDAP connections between different maps to save resources
|
||||
Portability fixes:
|
||||
- Changes to work with Linux-2.6.x, Linux-3.x and NetBSD-5.x, NetBSD-6.x,
|
||||
FreeBSD 7.x, Solaris
|
||||
Bug fixes:
|
||||
- Many bug fixes, see ChangeLog
|
||||
|
||||
*** Notes specific to am-utils version 6.2a3
|
||||
|
||||
- minor new ports:
|
||||
|
2
external/bsd/am-utils/dist/README
vendored
2
external/bsd/am-utils/dist/README
vendored
@ -81,7 +81,7 @@ or
|
||||
./buildall -K
|
||||
|
||||
To be a developer and be able to run "bootstrap", you must have
|
||||
autoconf-2.50, automake-1.5, and libtool 1.4 installed on your system (or
|
||||
autoconf-2.68, automake-1.11.1, and libtool 2.2.6b installed on your system (or
|
||||
later versions thereof). You no longer need to get my special version of
|
||||
automake. Contact me if you'd like to be a maintainer and get access to the
|
||||
CVS server.
|
||||
|
15
external/bsd/am-utils/dist/README.release
vendored
Normal file
15
external/bsd/am-utils/dist/README.release
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
- update vers.m4 to the new version you want to release: then rerun ./bootstrap
|
||||
- update NEWS w/ appropriate items
|
||||
- ./bootstrap && ./buildall && cd A.$ARCH.$VENDOR.$OSVERSION. && make check
|
||||
- cd A.$ARCH.$VENDOR.$OSVERSION make distcheck
|
||||
That generates a tar.gz w/ version number to drop into the ftp/http server
|
||||
- Make sure that all your files are committed at this point
|
||||
- Now tag the current trunk:
|
||||
git tag -a am-utils-X_Y[abc]Z
|
||||
or
|
||||
git tag -a am-utils-X_Y_rcZ
|
||||
If you want to move the tag, use --force
|
||||
- Push all commits and tags to the master repository
|
||||
git push --all
|
||||
- email announcement to am-utils-announce@am-utils.org. See
|
||||
README.release-announce as sample.
|
46
external/bsd/am-utils/dist/README.release-announce
vendored
Normal file
46
external/bsd/am-utils/dist/README.release-announce
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
To: am-utils-announce@am-utils.org
|
||||
Cc: am-utils@am-utils.org
|
||||
Subject: am-utils-6.2-rc1 released
|
||||
|
||||
We've released am-utils-6.2-rc1, first and only release candidate in the
|
||||
6.2 series (with nfsv4 support, autofs supports, and quite a few more
|
||||
features). This will be the first official release since 2006, so expect a
|
||||
lot of bug fixes and improvements.
|
||||
|
||||
You can download am-utils-6.2-rc1 as well as other releases from:
|
||||
|
||||
http://www.am-utils.org/
|
||||
|
||||
*** Notes specific to am-utils version 6.2-rc1
|
||||
|
||||
Filesystem Support:
|
||||
- Add support for NFSv4
|
||||
- Add support for Lustre
|
||||
- Add support for ext{2,3,4}
|
||||
- Add support for linux autofs version 5
|
||||
- Add support for TMPFS and UDF
|
||||
New features:
|
||||
- Add amq -i (prints information about maps)
|
||||
- Add synchronous unmount code for amq -uu
|
||||
- Allow a comma-separated list of LDAP servers for failover
|
||||
Changes in behavior:
|
||||
- Empty variable assignments, now unset the variable value.
|
||||
- Share LDAP connections between different maps to save resources
|
||||
Portability fixes:
|
||||
- Changes to work with Linux-2.6.x, Linux-3.x and NetBSD-5.x, NetBSD-6.x,
|
||||
FreeBSD 7.x, Solaris
|
||||
Bug fixes:
|
||||
- Many bug fixes, see ChangeLog
|
||||
|
||||
- minor new ports:
|
||||
* Please send us the 'config.guess' and 'amd -v' outputs
|
||||
so we can complete this list.
|
||||
|
||||
- Bugs fixed:
|
||||
* many race conditions found and fixed by Krisztian Kovacs.
|
||||
|
||||
Cheers,
|
||||
The am-utils team.
|
||||
|
||||
PS. Many thanks for Christos Zoulas for a huge amount of work he put in
|
||||
towards this long-awaited release.
|
10
external/bsd/am-utils/dist/amd/Makefile.am
vendored
10
external/bsd/am-utils/dist/amd/Makefile.am
vendored
@ -11,6 +11,8 @@ sbin_PROGRAMS = amd sun2amd
|
||||
# man pages
|
||||
man_MANS = amd.8 sun2amd.8
|
||||
|
||||
YLWRAP= $(top_srcdir)/ylwrap.amd
|
||||
|
||||
# test scripts
|
||||
TESTS = test1.sh
|
||||
|
||||
@ -98,14 +100,18 @@ EXTRA_amd_SOURCES = \
|
||||
ops_cachefs.c \
|
||||
ops_cdfs.c \
|
||||
ops_efs.c \
|
||||
ops_ext.c \
|
||||
ops_lofs.c \
|
||||
ops_lustre.c \
|
||||
ops_mfs.c \
|
||||
ops_nfs.c \
|
||||
ops_nfs3.c \
|
||||
ops_nfs4.c \
|
||||
ops_nullfs.c \
|
||||
ops_pcfs.c \
|
||||
ops_tfs.c \
|
||||
ops_tmpfs.c \
|
||||
ops_udf.c \
|
||||
ops_ufs.c \
|
||||
ops_umapfs.c \
|
||||
ops_unionfs.c \
|
||||
@ -139,11 +145,11 @@ DISTCLEANFILES = build_version.h ops_autofs.c
|
||||
dist-hook:
|
||||
(cd $(distdir) && rm -f $(BUILT_SOURCES))
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
# allow users to add their own flags via "configure --enable-am-flags=ARG"
|
||||
AMU_CFLAGS = @AMU_CFLAGS@
|
||||
AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
|
||||
AM_CFLAGS = $(AMU_CFLAGS)
|
||||
|
||||
# dependencies
|
||||
$(PROGRAMS): $(LDADD)
|
||||
|
33
external/bsd/am-utils/dist/amd/am_ops.c
vendored
33
external/bsd/am-utils/dist/amd/am_ops.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: am_ops.c,v 1.1.1.2 2009/03/20 20:26:48 christos Exp $ */
|
||||
/* $NetBSD: am_ops.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -98,6 +94,11 @@ static am_ops *vops[] =
|
||||
#ifdef HAVE_FS_XFS
|
||||
&xfs_ops, /* Unix (irix) F/S */
|
||||
#endif /* HAVE_FS_XFS */
|
||||
#ifdef HAVE_FS_EXT
|
||||
&ext2_ops, /* Unix (linux) F/S */
|
||||
&ext3_ops, /* Unix (linux) F/S */
|
||||
&ext4_ops, /* Unix (linux) F/S */
|
||||
#endif /* HAVE_FS_EXT */
|
||||
#ifdef HAVE_FS_EFS
|
||||
&efs_ops, /* Unix (irix) F/S */
|
||||
#endif /* HAVE_FS_EFS */
|
||||
@ -128,6 +129,9 @@ static am_ops *vops[] =
|
||||
#ifdef HAVE_FS_UDF
|
||||
&udf_ops, /* UDF F/S */
|
||||
#endif /* HAVE_FS_UDF */
|
||||
#ifdef HAVE_FS_LUSTRE
|
||||
&lustre_ops, /* Lustre */
|
||||
#endif /* HAVE_FS_LUSTRE */
|
||||
|
||||
/*
|
||||
* These 4 should be last, in the order:
|
||||
@ -324,7 +328,7 @@ merge_opts(const char *opts1, const char *opts2)
|
||||
char oneopt[80]; /* one option w/o value if any */
|
||||
char *revoneopt; /* reverse of oneopt */
|
||||
size_t len = strlen(opts1) + strlen(opts2) + 2; /* space for "," and NULL */
|
||||
char *s1 = strdup(opts1); /* copy of opts1 to munge */
|
||||
char *s1 = xstrdup(opts1); /* copy of opts1 to munge */
|
||||
|
||||
/* initialization */
|
||||
mnt2.mnt_opts = (char *) opts2;
|
||||
@ -337,11 +341,11 @@ merge_opts(const char *opts1, const char *opts2)
|
||||
/* copy option to temp buffer */
|
||||
xstrlcpy(oneopt, tmpstr, sizeof(oneopt));
|
||||
/* if option has a value such as rsize=1024, chop the value part */
|
||||
if ((eq = haseq(oneopt)))
|
||||
if ((eq = strchr(oneopt, '=')))
|
||||
*eq = '\0';
|
||||
/* find reverse option of oneopt */
|
||||
revoneopt = reverse_option(oneopt);
|
||||
/* if option orits reverse exist in opts2, ignore it */
|
||||
/* if option or its reverse exist in opts2, ignore it */
|
||||
if (amu_hasmntopt(&mnt2, oneopt) || amu_hasmntopt(&mnt2, revoneopt))
|
||||
continue;
|
||||
/* add option to returned string */
|
||||
@ -408,7 +412,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
|
||||
* Otherwise skip past any leading '-'.
|
||||
*/
|
||||
if (fo->opt_opts == 0)
|
||||
fo->opt_opts = strdup("rw,defaults");
|
||||
fo->opt_opts = xstrdup("rw,defaults");
|
||||
else if (*fo->opt_opts == '-') {
|
||||
/*
|
||||
* We cannot simply do fo->opt_opts++ here since the opts
|
||||
@ -416,7 +420,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
|
||||
* So just reallocate the thing -- stolcke 11/11/94
|
||||
*/
|
||||
char *old = fo->opt_opts;
|
||||
fo->opt_opts = strdup(old + 1);
|
||||
fo->opt_opts = xstrdup(old + 1);
|
||||
XFREE(old);
|
||||
}
|
||||
|
||||
@ -434,7 +438,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
|
||||
XFREE(fo->opt_opts);
|
||||
XFREE(fo->opt_remopts);
|
||||
fo->opt_opts = mergedstr;
|
||||
fo->opt_remopts = strdup(mergedstr);
|
||||
fo->opt_remopts = xstrdup(mergedstr);
|
||||
} else {
|
||||
char *mergedstr, *remmergedstr;
|
||||
mergedstr = merge_opts(fo->opt_opts, fo->opt_addopts);
|
||||
@ -468,8 +472,7 @@ ops_match(am_opts *fo, char *key, char *g_key, char *path, char *keym, char *map
|
||||
/*
|
||||
* Check the filesystem is happy
|
||||
*/
|
||||
if (fo->fs_mtab)
|
||||
XFREE(fo->fs_mtab);
|
||||
XFREE(fo->fs_mtab);
|
||||
|
||||
fo->fs_mtab = rop->fs_match(fo);
|
||||
if (fo->fs_mtab)
|
||||
|
14
external/bsd/am-utils/dist/amd/amd.c
vendored
14
external/bsd/am-utils/dist/amd/amd.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amd.c,v 1.1.1.2 2009/03/20 20:26:48 christos Exp $ */
|
||||
/* $NetBSD: amd.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -429,6 +425,7 @@ main(int argc, char *argv[])
|
||||
if (gethostname(hostname, sizeof(hostname)) < 0) {
|
||||
plog(XLOG_FATAL, "gethostname: %m");
|
||||
going_down(1);
|
||||
return 1;
|
||||
}
|
||||
hostname[sizeof(hostname) - 1] = '\0';
|
||||
|
||||
@ -438,6 +435,7 @@ main(int argc, char *argv[])
|
||||
if (!*hostname) {
|
||||
plog(XLOG_FATAL, "host name is not set");
|
||||
going_down(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -531,6 +529,7 @@ main(int argc, char *argv[])
|
||||
if (geteuid() != 0) {
|
||||
plog(XLOG_FATAL, "Must be root to mount filesystems (euid = %ld)", (long) geteuid());
|
||||
going_down(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MAP_NIS
|
||||
@ -542,6 +541,7 @@ main(int argc, char *argv[])
|
||||
if (gopt.nis_domain && yp_bind(gopt.nis_domain)) {
|
||||
plog(XLOG_FATAL, "Can't bind to NIS domain \"%s\"", gopt.nis_domain);
|
||||
going_down(1);
|
||||
return 1;
|
||||
}
|
||||
#endif /* HAVE_MAP_NIS */
|
||||
|
||||
|
63
external/bsd/am-utils/dist/amd/amd.h
vendored
63
external/bsd/am-utils/dist/amd/amd.h
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amd.h,v 1.1.1.2 2009/03/20 20:26:48 christos Exp $ */
|
||||
/* $NetBSD: amd.h,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -214,6 +210,7 @@ typedef struct cf_map cf_map_t;
|
||||
typedef struct kv kv;
|
||||
typedef struct am_node am_node;
|
||||
typedef struct mntfs mntfs;
|
||||
typedef struct am_loc am_loc;
|
||||
typedef struct am_opts am_opts;
|
||||
typedef struct am_ops am_ops;
|
||||
typedef struct am_stats am_stats;
|
||||
@ -247,13 +244,17 @@ typedef int (*vmount_fs) (am_node *, mntfs *);
|
||||
typedef int (*vumount_fs) (am_node *, mntfs *);
|
||||
typedef am_node *(*vlookup_child) (am_node *, char *, int *, int);
|
||||
typedef am_node *(*vmount_child) (am_node *, int *);
|
||||
typedef int (*vreaddir) (am_node *, nfscookie, nfsdirlist *, nfsentry *, u_int);
|
||||
typedef int (*vreaddir) (am_node *, voidp, voidp, voidp, u_int);
|
||||
typedef am_node *(*vreadlink) (am_node *, int *);
|
||||
typedef void (*vmounted) (mntfs *);
|
||||
typedef void (*vumounted) (mntfs *);
|
||||
typedef fserver *(*vffserver) (mntfs *);
|
||||
typedef wchan_t (*vget_wchan) (mntfs *);
|
||||
|
||||
/*
|
||||
* NFS progran dispatcher
|
||||
*/
|
||||
typedef void (*dispatcher_t)(struct svc_req *rqstp, SVCXPRT *transp);
|
||||
|
||||
|
||||
/*
|
||||
@ -316,6 +317,7 @@ struct amu_global_options {
|
||||
#endif /* HAVE_MAP_NIS */
|
||||
char *nfs_proto; /* NFS protocol (NULL, udp, tcp) */
|
||||
int nfs_vers; /* NFS version (0, 2, 3, 4) */
|
||||
int nfs_vers_ping; /* NFS rpc ping version (0, 2, 3, 4) */
|
||||
u_int exec_map_timeout; /* timeout (seconds) for executable maps */
|
||||
};
|
||||
|
||||
@ -351,6 +353,7 @@ struct mnt_map {
|
||||
short alloc; /* Allocation mode */
|
||||
time_t modify; /* Modify time of map */
|
||||
u_int reloads; /* Number of times map was reloaded */
|
||||
u_int nentries; /* Number of entries in the map */
|
||||
char *map_name; /* Name of this map */
|
||||
char *wildcard; /* Wildcard value */
|
||||
reload_fn *reload; /* Function to be used for reloads */
|
||||
@ -422,7 +425,7 @@ struct mntfs {
|
||||
am_opts *mf_fo; /* File opts */
|
||||
char *mf_mount; /* "/a/kiska/home/kiska" */
|
||||
char *mf_info; /* Mount info */
|
||||
char *mf_auto; /* Automount opts */
|
||||
char *mf_auto; /* Mount info */
|
||||
char *mf_mopts; /* FS mount opts */
|
||||
char *mf_remopts; /* Remote FS mount opts */
|
||||
char *mf_loopdev; /* loop device name for /dev/loop mounts */
|
||||
@ -436,6 +439,16 @@ struct mntfs {
|
||||
opaque_t mf_private; /* Private - per-fs data */
|
||||
};
|
||||
|
||||
/*
|
||||
* Locations: bindings between keys and mntfs
|
||||
*/
|
||||
struct am_loc {
|
||||
am_opts *al_fo;
|
||||
mntfs *al_mnt;
|
||||
int al_refc;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* List of fileservers
|
||||
*/
|
||||
@ -465,6 +478,8 @@ struct am_stats {
|
||||
int s_readdir; /* Count of readdirs */
|
||||
int s_readlink; /* Count of readlinks */
|
||||
int s_statfs; /* Count of statfs */
|
||||
int s_fsinfo; /* Count of fsinfo */
|
||||
int s_pathconf; /* Count of pathconf */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -484,8 +499,8 @@ extern struct amd_stats amd_stats;
|
||||
*/
|
||||
struct am_node {
|
||||
int am_mapno; /* Map number */
|
||||
mntfs *am_mnt; /* Mounted filesystem */
|
||||
mntfs **am_mfarray; /* Filesystem sources to try to mount */
|
||||
am_loc *am_al; /* Mounted filesystem */
|
||||
am_loc **am_alarray; /* Filesystem sources to try to mount */
|
||||
char *am_name; /* "kiska": name of this node */
|
||||
char *am_path; /* "/home/kiska": path of this node's mount point */
|
||||
char *am_link; /* "/a/kiska/home/kiska/this/that": link to sub-dir */
|
||||
@ -534,12 +549,14 @@ extern int *amqproc_umnt_1_svc(voidp argp, struct svc_req *rqstp);
|
||||
extern int *amqproc_sync_umnt_1_svc_parent(voidp argp, struct svc_req *rqstp);
|
||||
extern amq_sync_umnt *amqproc_sync_umnt_1_svc_child(voidp argp, struct svc_req *rqstp);
|
||||
extern amq_sync_umnt *amqproc_sync_umnt_1_svc_async(voidp argp, struct svc_req *rqstp);
|
||||
extern amq_map_info_list *amqproc_getmapinfo_1_svc(voidp argp, struct svc_req *rqstp);
|
||||
|
||||
/* other external definitions */
|
||||
extern am_nfs_fh *get_root_nfs_fh(char *dir);
|
||||
extern am_nfs_handle_t *get_root_nfs_fh(char *dir, am_nfs_handle_t *nfh);
|
||||
extern am_node *find_ap(char *);
|
||||
extern am_node *get_ap_child(am_node *, char *);
|
||||
extern bool_t xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead);
|
||||
extern bool_t xdr_amq_map_info_qelem(XDR *xdrs, qelem *qhead);
|
||||
extern fserver *find_nfs_srvr(mntfs *mf);
|
||||
extern int mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf);
|
||||
extern int process_all_regular_maps(void);
|
||||
@ -573,12 +590,15 @@ extern int get_mountd_port(fserver *, u_short *, wchan_t);
|
||||
extern void flush_nfs_fhandle_cache(fserver *);
|
||||
|
||||
extern mntfs *dup_mntfs(mntfs *);
|
||||
extern am_loc *dup_loc(am_loc *);
|
||||
extern mntfs *find_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *);
|
||||
extern mntfs *locate_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *);
|
||||
extern am_loc *new_loc(void);
|
||||
extern mntfs *new_mntfs(void);
|
||||
extern mntfs *realloc_mntfs(mntfs *, am_ops *, am_opts *, char *, char *, char *, char *, char *);
|
||||
extern void flush_mntfs(void);
|
||||
extern void free_mntfs(voidp);
|
||||
extern void free_loc(voidp);
|
||||
|
||||
|
||||
extern void amq_program_1(struct svc_req *rqstp, SVCXPRT *transp);
|
||||
@ -590,6 +610,7 @@ extern int file_read_line(char *, int, FILE *);
|
||||
extern void forcibly_timeout_mp(am_node *);
|
||||
extern void free_map(am_node *);
|
||||
extern void free_opts(am_opts *);
|
||||
extern am_opts *copy_opts(am_opts *);
|
||||
extern void free_srvr(fserver *);
|
||||
extern int fwd_init(void);
|
||||
extern int fwd_packet(int, char *, int, struct sockaddr_in *, struct sockaddr_in *, opaque_t, fwd_fun *);
|
||||
@ -616,6 +637,7 @@ extern int mount_auto_node(char *, opaque_t);
|
||||
extern int mount_automounter(int);
|
||||
extern int mount_exported(void);
|
||||
extern void mp_to_fh(am_node *, am_nfs_fh *);
|
||||
extern void mp_to_fh3(am_node *mp, am_nfs_fh3 *fhp);
|
||||
extern void new_ttl(am_node *);
|
||||
extern void nfs_quick_reply(am_node *mp, int error);
|
||||
extern void normalize_slash(char *);
|
||||
@ -649,6 +671,7 @@ extern char hostd[SIZEOF_HOSTD]; /* Host+domain */
|
||||
* Global variables.
|
||||
*/
|
||||
extern SVCXPRT *current_transp; /* For nfs_quick_reply() */
|
||||
extern dispatcher_t nfs_dispatcher;
|
||||
extern char *conf_tag;
|
||||
#define SIZEOF_UID_STR 12
|
||||
#define SIZEOF_GID_STR 12
|
||||
@ -740,6 +763,10 @@ extern am_ops pcfs_ops;
|
||||
extern am_ops udf_ops;
|
||||
#endif /* HAVE_FS_UDF */
|
||||
|
||||
#ifdef HAVE_FS_LUSTRE
|
||||
extern am_ops lustre_ops;
|
||||
#endif /* HAVE_FS_LUSTRE */
|
||||
|
||||
/*
|
||||
* Caching File System (Solaris)
|
||||
*/
|
||||
@ -776,6 +803,13 @@ extern am_ops ufs_ops; /* Un*x file system */
|
||||
extern am_ops xfs_ops; /* Un*x file system */
|
||||
#endif /* HAVE_FS_XFS */
|
||||
|
||||
/* Unix file system (ext*) */
|
||||
#ifdef HAVE_FS_EXT
|
||||
extern am_ops ext2_ops; /* Un*x file system */
|
||||
extern am_ops ext3_ops; /* Un*x file system */
|
||||
extern am_ops ext4_ops; /* Un*x file system */
|
||||
#endif /* HAVE_FS_EXT */
|
||||
|
||||
/* Unix file system (irix) */
|
||||
#ifdef HAVE_FS_EFS
|
||||
extern am_ops efs_ops; /* Un*x file system */
|
||||
@ -795,7 +829,7 @@ extern am_ops amfs_root_ops; /* Root file system */
|
||||
*/
|
||||
extern am_node *amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op);
|
||||
extern am_node *amfs_generic_mount_child(am_node *ap, int *error_return);
|
||||
extern int amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count);
|
||||
extern int amfs_generic_readdir(am_node *mp, voidp cookie, voidp dp, voidp ep, u_int count);
|
||||
extern int amfs_generic_umount(am_node *mp, mntfs *mf);
|
||||
extern void amfs_generic_mounted(mntfs *mf);
|
||||
extern char *amfs_generic_match(am_opts *fo);
|
||||
@ -831,7 +865,8 @@ extern am_ops amfs_direct_ops; /* Direct Automount file system (this too) */
|
||||
extern am_ops amfs_error_ops; /* Error file system */
|
||||
extern am_node *amfs_error_lookup_child(am_node *mp, char *fname, int *error_return, int op);
|
||||
extern am_node *amfs_error_mount_child(am_node *ap, int *error_return);
|
||||
extern int amfs_error_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count);
|
||||
extern int amfs_error_readdir(am_node *mp, voidp cookie, voidp dp, voidp ep, u_int count);
|
||||
|
||||
#endif /* HAVE_AMU_FS_ERROR */
|
||||
|
||||
/*
|
||||
|
18
external/bsd/am-utils/dist/amd/amfs_auto.c
vendored
18
external/bsd/am-utils/dist/amd/amfs_auto.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_auto.c,v 1.1.1.2 2009/03/20 20:26:48 christos Exp $ */
|
||||
/* $NetBSD: amfs_auto.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -103,6 +99,8 @@ am_ops amfs_auto_ops =
|
||||
static int
|
||||
amfs_auto_mount(am_node *mp, mntfs *mf)
|
||||
{
|
||||
if (mp->am_parent == NULL)
|
||||
return EINVAL;
|
||||
/*
|
||||
* Pseudo-directories are used to provide some structure
|
||||
* to the automounted directories instead
|
||||
@ -117,7 +115,7 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
|
||||
* Historical - not documented.
|
||||
*/
|
||||
if (mf->mf_info[0] == '.' && mf->mf_info[1] == '\0')
|
||||
mf->mf_info = strealloc(mf->mf_info, mp->am_parent->am_mnt->mf_info);
|
||||
mf->mf_info = strealloc(mf->mf_info, mp->am_parent->am_al->al_mnt->mf_info);
|
||||
|
||||
/*
|
||||
* Compute prefix:
|
||||
@ -133,12 +131,12 @@ amfs_auto_mount(am_node *mp, mntfs *mf)
|
||||
if (mf->mf_fo->opt_pref) {
|
||||
/* allow pref:=null to set a real null prefix */
|
||||
if (STREQ(mf->mf_fo->opt_pref, "null")) {
|
||||
mp->am_pref = strdup("");
|
||||
mp->am_pref = xstrdup("");
|
||||
} else {
|
||||
/*
|
||||
* the prefix specified as an option
|
||||
*/
|
||||
mp->am_pref = strdup(mf->mf_fo->opt_pref);
|
||||
mp->am_pref = xstrdup(mf->mf_fo->opt_pref);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
14
external/bsd/am-utils/dist/amd/amfs_direct.c
vendored
14
external/bsd/am-utils/dist/amd/amfs_direct.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_direct.c,v 1.1.1.2 2009/03/20 20:26:48 christos Exp $ */
|
||||
/* $NetBSD: amfs_direct.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -95,8 +91,8 @@ amfs_direct_readlink(am_node *mp, int *error_return)
|
||||
|
||||
xp = next_nonerror_node(mp->am_child);
|
||||
if (!xp) {
|
||||
if (!mp->am_mnt->mf_private)
|
||||
amfs_mkcacheref(mp->am_mnt); /* XXX */
|
||||
if (!mp->am_al->al_mnt->mf_private)
|
||||
amfs_mkcacheref(mp->am_al->al_mnt);
|
||||
xp = amfs_generic_lookup_child(mp, mp->am_path + 1, &rc, VLOOK_CREATE);
|
||||
if (xp && rc < 0)
|
||||
xp = amfs_generic_mount_child(xp, &rc);
|
||||
|
14
external/bsd/am-utils/dist/amd/amfs_error.c
vendored
14
external/bsd/am-utils/dist/amd/amfs_error.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_error.c,v 1.1.1.2 2009/03/20 20:26:48 christos Exp $ */
|
||||
/* $NetBSD: amfs_error.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -94,7 +90,7 @@ am_ops amfs_error_ops =
|
||||
static char *
|
||||
amfs_error_match(am_opts *fo)
|
||||
{
|
||||
return strdup("(error-hook)");
|
||||
return xstrdup("(error-hook)");
|
||||
}
|
||||
|
||||
|
||||
@ -147,7 +143,7 @@ amfs_error_mount_child(am_node *ap, int *error_return)
|
||||
* If we do then just give an error.
|
||||
*/
|
||||
int
|
||||
amfs_error_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count)
|
||||
amfs_error_readdir(am_node *mp, voidp cookie, voidp dp, voidp ep, u_int count)
|
||||
{
|
||||
return ESTALE;
|
||||
}
|
||||
|
225
external/bsd/am-utils/dist/amd/amfs_generic.c
vendored
225
external/bsd/am-utils/dist/amd/amfs_generic.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_generic.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_generic.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -57,7 +53,7 @@
|
||||
/****************************************************************************
|
||||
*** MACROS ***
|
||||
****************************************************************************/
|
||||
#define IN_PROGRESS(cp) ((cp)->mp->am_mnt->mf_flags & MFF_MOUNTING)
|
||||
#define IN_PROGRESS(cp) ((cp)->mp->am_al->al_mnt->mf_flags & MFF_MOUNTING)
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
@ -82,7 +78,7 @@ struct continuation {
|
||||
int retry; /* Try again? */
|
||||
time_t start; /* Time we started this mount */
|
||||
int callout; /* Callout identifier */
|
||||
mntfs **mf; /* Current mntfs */
|
||||
am_loc **al; /* Current location */
|
||||
};
|
||||
|
||||
|
||||
@ -90,9 +86,9 @@ struct continuation {
|
||||
*** FORWARD DEFINITIONS ***
|
||||
****************************************************************************/
|
||||
static am_node *amfs_lookup_node(am_node *mp, char *fname, int *error_return);
|
||||
static mntfs *amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
|
||||
static am_loc *amfs_lookup_one_location(am_node *new_mp, mntfs *mf, char *ivec,
|
||||
char *def_opts, char *pfname);
|
||||
static mntfs **amfs_lookup_mntfs(am_node *new_mp, int *error_return);
|
||||
static am_loc **amfs_lookup_loc(am_node *new_mp, int *error_return);
|
||||
static void amfs_cont(int rc, int term, opaque_t arg);
|
||||
static void amfs_retry(int rc, int term, opaque_t arg);
|
||||
static void free_continuation(struct continuation *cp);
|
||||
@ -120,7 +116,7 @@ amfs_lookup_node(am_node *mp, char *fname, int *error_return)
|
||||
* about the mount point.
|
||||
*/
|
||||
if (amd_state == Finishing) {
|
||||
if (mp->am_mnt == 0 || mp->am_mnt->mf_fsflags & FS_DIRECT) {
|
||||
if (mp->am_al == NULL || mp->am_al->al_mnt == NULL || mp->am_al->al_mnt->mf_fsflags & FS_DIRECT) {
|
||||
dlog("%s mount ignored - going down", fname);
|
||||
} else {
|
||||
dlog("%s/%s mount ignored - going down", mp->am_path, fname);
|
||||
@ -172,7 +168,7 @@ amfs_lookup_node(am_node *mp, char *fname, int *error_return)
|
||||
* If the error code is undefined then it must be
|
||||
* in progress.
|
||||
*/
|
||||
mf = new_mp->am_mnt;
|
||||
mf = new_mp->am_al->al_mnt;
|
||||
if (mf->mf_error < 0)
|
||||
goto in_progrss;
|
||||
|
||||
@ -251,12 +247,13 @@ amfs_lookup_node(am_node *mp, char *fname, int *error_return)
|
||||
|
||||
|
||||
|
||||
static mntfs *
|
||||
amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
|
||||
char *def_opts, char *pfname)
|
||||
static am_loc *
|
||||
amfs_lookup_one_location(am_node *new_mp, mntfs *mf, char *ivec,
|
||||
char *def_opts, char *pfname)
|
||||
{
|
||||
am_ops *p;
|
||||
am_opts *fs_opts;
|
||||
am_loc *new_al;
|
||||
mntfs *new_mf;
|
||||
char *mp_dir = NULL;
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
@ -264,6 +261,11 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
|
||||
/* match the operators */
|
||||
/*
|
||||
* although we alloc the fs_opts here, the pointer is 'owned' by the am_loc and will
|
||||
* be free'd on destruction of the am_loc. If we don't allocate a loc, then we need
|
||||
* to free this.
|
||||
*/
|
||||
fs_opts = CALLOC(am_opts);
|
||||
p = ops_match(fs_opts, ivec, def_opts, new_mp->am_path,
|
||||
pfname, mf->mf_info);
|
||||
@ -294,6 +296,9 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
|
||||
|
||||
/*
|
||||
* Find or allocate a filesystem for this node.
|
||||
* we search for a matching backend share, since
|
||||
* we will construct our own al_loc to handle
|
||||
* any customisations for this usage.
|
||||
*/
|
||||
new_mf = find_mntfs(p, fs_opts,
|
||||
mp_dir,
|
||||
@ -302,6 +307,7 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
|
||||
fs_opts->opt_opts,
|
||||
fs_opts->opt_remopts);
|
||||
|
||||
|
||||
/*
|
||||
* See whether this is a real filesystem
|
||||
*/
|
||||
@ -309,10 +315,16 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
|
||||
if (p == &amfs_error_ops) {
|
||||
plog(XLOG_MAP, "Map entry %s for %s did not match", ivec, new_mp->am_path);
|
||||
free_mntfs(new_mf);
|
||||
free_opts(fs_opts);
|
||||
XFREE(fs_opts);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dlog("Got a hit with %s", p->fs_type);
|
||||
new_al = new_loc();
|
||||
free_mntfs(new_al->al_mnt);
|
||||
new_al->al_mnt = new_mf;
|
||||
new_al->al_fo = fs_opts; /* now the loc is in charge of free'ing this mem */
|
||||
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
if (new_mp->am_flags & AMF_AUTOFS && on_autofs) {
|
||||
@ -334,12 +346,12 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
|
||||
new_mf->mf_flags |= MFF_IS_AUTOFS;
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
|
||||
return new_mf;
|
||||
return new_al;
|
||||
}
|
||||
|
||||
|
||||
static mntfs **
|
||||
amfs_lookup_mntfs(am_node *new_mp, int *error_return)
|
||||
static am_loc **
|
||||
amfs_lookup_loc(am_node *new_mp, int *error_return)
|
||||
{
|
||||
am_node *mp;
|
||||
char *info; /* Mount info - where to get the file system */
|
||||
@ -350,10 +362,11 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
|
||||
int error = 0; /* Error so far */
|
||||
char path_name[MAXPATHLEN]; /* General path name buffer */
|
||||
char *pfname; /* Path for database lookup */
|
||||
mntfs *mf, **mf_array;
|
||||
mntfs* mf; /* The mntfs for the map of our parent */
|
||||
am_loc **al_array; /* the generated list of locations */
|
||||
int count;
|
||||
|
||||
dlog("in amfs_lookup_mntfs");
|
||||
dlog("in amfs_lookup_loc");
|
||||
|
||||
mp = new_mp->am_parent;
|
||||
|
||||
@ -371,7 +384,7 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
|
||||
pfname = new_mp->am_name;
|
||||
}
|
||||
|
||||
mf = mp->am_mnt;
|
||||
mf = mp->am_al->al_mnt;
|
||||
|
||||
dlog("will search map info in %s to find %s", mf->mf_info, pfname);
|
||||
/*
|
||||
@ -406,8 +419,8 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
|
||||
else
|
||||
def_opts = "";
|
||||
|
||||
orig_def_opts = amfs_parse_defaults(mp, mf, strdup(def_opts));
|
||||
def_opts = strdup(orig_def_opts);
|
||||
orig_def_opts = amfs_parse_defaults(mp, mf, xstrdup(def_opts));
|
||||
def_opts = xstrdup(orig_def_opts);
|
||||
|
||||
/* first build our defaults */
|
||||
num_ivecs = 0;
|
||||
@ -425,11 +438,11 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
|
||||
num_ivecs++;
|
||||
}
|
||||
|
||||
mf_array = calloc(num_ivecs + 1, sizeof(mntfs *));
|
||||
al_array = calloc(num_ivecs + 1, sizeof(am_loc *));
|
||||
|
||||
/* construct the array of struct mntfs for this mount point */
|
||||
/* construct the array of struct locations for this key */
|
||||
for (count = 0, cur_ivec = ivecs; *cur_ivec; cur_ivec++) {
|
||||
mntfs *new_mf;
|
||||
am_loc *new_al;
|
||||
|
||||
if (**cur_ivec == '-') {
|
||||
XFREE(def_opts);
|
||||
@ -438,7 +451,7 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
|
||||
* If we have a single dash '-' than we need to reset the
|
||||
* default options.
|
||||
*/
|
||||
def_opts = strdup(orig_def_opts);
|
||||
def_opts = xstrdup(orig_def_opts);
|
||||
dlog("Resetting the default options, a single dash '-' was found.");
|
||||
} else {
|
||||
/* append options to /default options */
|
||||
@ -449,7 +462,7 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
|
||||
}
|
||||
|
||||
/*
|
||||
* If a mntfs has already been found, and we find
|
||||
* If a loc has already been found, and we find
|
||||
* a cut then don't try any more locations.
|
||||
*
|
||||
* XXX: we do not know when the "/" was added as an equivalent for "||".
|
||||
@ -457,16 +470,16 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
|
||||
*/
|
||||
if (STREQ(*cur_ivec, "/") || STREQ(*cur_ivec, "||")) {
|
||||
if (count > 0) {
|
||||
dlog("Cut: not trying any more locations for %s", mp->am_path);
|
||||
dlog("Cut: not trying any more locations for %s", pfname);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
new_mf = amfs_lookup_one_mntfs(new_mp, mf, *cur_ivec, def_opts, pfname);
|
||||
if (new_mf == NULL)
|
||||
new_al = amfs_lookup_one_location(new_mp, mf, *cur_ivec, def_opts, pfname);
|
||||
if (new_al == NULL)
|
||||
continue;
|
||||
mf_array[count++] = new_mf;
|
||||
al_array[count++] = new_al;
|
||||
}
|
||||
|
||||
/* We're done with ivecs */
|
||||
@ -475,11 +488,11 @@ amfs_lookup_mntfs(am_node *new_mp, int *error_return)
|
||||
XFREE(orig_def_opts);
|
||||
XFREE(def_opts);
|
||||
if (count == 0) { /* no match */
|
||||
XFREE(mf_array);
|
||||
XFREE(al_array);
|
||||
ereturn(ENOENT);
|
||||
}
|
||||
|
||||
return mf_array;
|
||||
return al_array;
|
||||
}
|
||||
|
||||
|
||||
@ -493,7 +506,7 @@ amfs_cont(int rc, int term, opaque_t arg)
|
||||
{
|
||||
struct continuation *cp = (struct continuation *) arg;
|
||||
am_node *mp = cp->mp;
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
|
||||
dlog("amfs_cont: '%s'", mp->am_path);
|
||||
|
||||
@ -558,7 +571,7 @@ amfs_cont(int rc, int term, opaque_t arg)
|
||||
mf->mf_error = rc;
|
||||
mf->mf_flags |= MFF_ERROR;
|
||||
errno = rc; /* XXX */
|
||||
if (!STREQ(mp->am_mnt->mf_ops->fs_type, "linkx"))
|
||||
if (!STREQ(mp->am_al->al_mnt->mf_ops->fs_type, "linkx"))
|
||||
plog(XLOG_ERROR, "%s: mount (amfs_cont): %m", mp->am_path);
|
||||
}
|
||||
}
|
||||
@ -570,7 +583,7 @@ amfs_cont(int rc, int term, opaque_t arg)
|
||||
* call the background mount routine again
|
||||
*/
|
||||
amd_stats.d_merr++;
|
||||
cp->mf++;
|
||||
cp->al++;
|
||||
}
|
||||
amfs_bgmount(cp);
|
||||
if (mp->am_error > 0)
|
||||
@ -610,13 +623,21 @@ amfs_retry(int rc, int term, opaque_t arg)
|
||||
*/
|
||||
plog(XLOG_INFO, "mount of \"%s\" has timed out", mp->am_path);
|
||||
error = ETIMEDOUT;
|
||||
while (*cp->mf)
|
||||
cp->mf++;
|
||||
while (*cp->al)
|
||||
cp->al++;
|
||||
/* explicitly forbid further retries after timeout */
|
||||
cp->retry = FALSE;
|
||||
}
|
||||
if (error || !IN_PROGRESS(cp))
|
||||
error = amfs_bgmount(cp);
|
||||
else
|
||||
/* Normally it's amfs_bgmount() which frees the continuation. However, if
|
||||
* the mount is already in progress and we're in amfs_retry() for another
|
||||
* node we don't try mounting the filesystem once again. Still, we have
|
||||
* to free the continuation as we won't get called again and thus would
|
||||
* leak the continuation structure and our am_loc references.
|
||||
*/
|
||||
free_continuation(cp);
|
||||
|
||||
reschedule_timeout_mp();
|
||||
}
|
||||
@ -628,7 +649,7 @@ amfs_retry(int rc, int term, opaque_t arg)
|
||||
static void
|
||||
free_continuation(struct continuation *cp)
|
||||
{
|
||||
mntfs **mfp;
|
||||
am_loc **alp;
|
||||
|
||||
dlog("free_continuation");
|
||||
if (cp->callout)
|
||||
@ -636,12 +657,12 @@ free_continuation(struct continuation *cp)
|
||||
/*
|
||||
* we must free the mntfs's in the list.
|
||||
* so free all of them if there was an error,
|
||||
* or free all but the used one, if the mount succeeded.
|
||||
*/
|
||||
for (mfp = cp->mp->am_mfarray; *mfp; mfp++) {
|
||||
free_mntfs(*mfp);
|
||||
for (alp = cp->mp->am_alarray; *alp; alp++) {
|
||||
free_loc(*alp);
|
||||
}
|
||||
XFREE(cp->mp->am_mfarray);
|
||||
XFREE(cp->mp->am_alarray);
|
||||
cp->mp->am_alarray = 0;
|
||||
XFREE(cp);
|
||||
}
|
||||
|
||||
@ -691,12 +712,13 @@ static int
|
||||
amfs_bgmount(struct continuation *cp)
|
||||
{
|
||||
am_node *mp = cp->mp;
|
||||
mntfs *mf; /* Current mntfs */
|
||||
am_loc *loc;
|
||||
mntfs *mf;
|
||||
int this_error = -1; /* Per-mount error */
|
||||
int hard_error = -1; /* Cumulative per-node error */
|
||||
|
||||
if (mp->am_mnt)
|
||||
free_mntfs(mp->am_mnt);
|
||||
if (mp->am_al)
|
||||
free_loc(mp->am_al);
|
||||
|
||||
/*
|
||||
* Try to mount each location.
|
||||
@ -705,10 +727,11 @@ amfs_bgmount(struct continuation *cp)
|
||||
* hard_error > 0 indicates everything failed with a hard error
|
||||
* hard_error < 0 indicates nothing could be mounted now
|
||||
*/
|
||||
for (mp->am_mnt = *cp->mf; *cp->mf; cp->mf++, mp->am_mnt = *cp->mf) {
|
||||
for (mp->am_al = *cp->al; *cp->al; cp->al++, mp->am_al = *cp->al) {
|
||||
am_ops *p;
|
||||
|
||||
mf = dup_mntfs(mp->am_mnt);
|
||||
loc = dup_loc(mp->am_al);
|
||||
mf = loc->al_mnt;
|
||||
p = mf->mf_ops;
|
||||
|
||||
if (hard_error < 0)
|
||||
@ -738,12 +761,11 @@ amfs_bgmount(struct continuation *cp)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (mp->am_link) {
|
||||
XFREE(mp->am_link);
|
||||
mp->am_link = NULL;
|
||||
}
|
||||
if (mf->mf_fo && mf->mf_fo->opt_sublink && mf->mf_fo->opt_sublink[0])
|
||||
mp->am_link = strdup(mf->mf_fo->opt_sublink);
|
||||
XFREE(mp->am_link);
|
||||
mp->am_link = NULL;
|
||||
|
||||
if (loc->al_fo && loc->al_fo->opt_sublink && loc->al_fo->opt_sublink[0])
|
||||
mp->am_link = xstrdup(loc->al_fo->opt_sublink);
|
||||
|
||||
/*
|
||||
* Will usually need to play around with the mount nodes
|
||||
@ -785,13 +807,13 @@ amfs_bgmount(struct continuation *cp)
|
||||
if (this_error < 0)
|
||||
goto retry;
|
||||
|
||||
if (mf->mf_fo && mf->mf_fo->opt_delay) {
|
||||
if (loc->al_fo && loc->al_fo->opt_delay) {
|
||||
/*
|
||||
* If there is a delay timer on the mount
|
||||
* If there is a delay timer on the location
|
||||
* then don't try to mount if the timer
|
||||
* has not expired.
|
||||
*/
|
||||
int i = atoi(mf->mf_fo->opt_delay);
|
||||
int i = atoi(loc->al_fo->opt_delay);
|
||||
time_t now = clocktime(NULL);
|
||||
if (i > 0 && now < (cp->start + i)) {
|
||||
dlog("Mount of %s delayed by %lds", mf->mf_mount, (long) (i - now + cp->start));
|
||||
@ -867,22 +889,25 @@ amfs_bgmount(struct continuation *cp)
|
||||
return -1;
|
||||
|
||||
failed:
|
||||
amd_stats.d_merr++;
|
||||
mf->mf_error = this_error;
|
||||
mf->mf_flags |= MFF_ERROR;
|
||||
if (!FSRV_ISDOWN(mf->mf_server)) {
|
||||
/* mark the mount as failed unless the server is down */
|
||||
amd_stats.d_merr++;
|
||||
mf->mf_error = this_error;
|
||||
mf->mf_flags |= MFF_ERROR;
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
if (mp->am_autofs_fh)
|
||||
autofs_release_fh(mp);
|
||||
if (mp->am_autofs_fh)
|
||||
autofs_release_fh(mp);
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
if (mf->mf_flags & MFF_MKMNT) {
|
||||
rmdirs(mf->mf_mount);
|
||||
mf->mf_flags &= ~MFF_MKMNT;
|
||||
if (mf->mf_flags & MFF_MKMNT) {
|
||||
rmdirs(mf->mf_mount);
|
||||
mf->mf_flags &= ~MFF_MKMNT;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Wakeup anything waiting for this mount
|
||||
*/
|
||||
wakeup(get_mntfs_wchan(mf));
|
||||
free_mntfs(mf);
|
||||
free_loc(loc);
|
||||
/* continue */
|
||||
}
|
||||
|
||||
@ -891,7 +916,10 @@ amfs_bgmount(struct continuation *cp)
|
||||
* there is no more mount information available.
|
||||
*/
|
||||
if (this_error) {
|
||||
mp->am_mnt = mf = new_mntfs();
|
||||
if (mp->am_al)
|
||||
free_loc(mp->am_al);
|
||||
mp->am_al = loc = new_loc();
|
||||
mf = loc->al_mnt;
|
||||
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
if (mp->am_flags & AMF_AUTOFS)
|
||||
@ -921,7 +949,7 @@ amfs_bgmount(struct continuation *cp)
|
||||
}
|
||||
new_ttl(mp);
|
||||
} else {
|
||||
mf = mp->am_mnt;
|
||||
mf = loc->al_mnt;
|
||||
/*
|
||||
* Wakeup anything waiting for this mount
|
||||
*/
|
||||
@ -963,7 +991,7 @@ amfs_parse_defaults(am_node *mp, mntfs *mf, char *def_opts)
|
||||
*/
|
||||
if (mm->cfm && mm->cfm->cfm_defaults) {
|
||||
dlog("map %s map_defaults override: %s", mf->mf_mount, mm->cfm->cfm_defaults);
|
||||
dflts = strdup(mm->cfm->cfm_defaults);
|
||||
dflts = xstrdup(mm->cfm->cfm_defaults);
|
||||
} else if (mapc_search(mm, "/defaults", &dflts) == 0) {
|
||||
dlog("/defaults gave %s", dflts);
|
||||
} else {
|
||||
@ -1001,7 +1029,7 @@ amfs_parse_defaults(am_node *mp, mntfs *mf, char *def_opts)
|
||||
* get expanded to "/defaults"
|
||||
*/
|
||||
pt = ops_match(&ap, *sp, "", mp->am_path, "/defaults",
|
||||
mp->am_parent->am_mnt->mf_info);
|
||||
mp->am_parent->am_al->al_mnt->mf_info);
|
||||
free_opts(&ap); /* don't leak */
|
||||
if (pt == &amfs_error_ops) {
|
||||
plog(XLOG_MAP, "did not match defaults for \"%s\"", *sp);
|
||||
@ -1068,8 +1096,9 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
|
||||
*error_return = error = 0; /* Error so far */
|
||||
|
||||
/* we have an errorfs attached to the am_node, free it */
|
||||
free_mntfs(new_mp->am_mnt);
|
||||
new_mp->am_mnt = NULL;
|
||||
if (new_mp->am_al)
|
||||
free_loc(new_mp->am_al);
|
||||
new_mp->am_al = NULL;
|
||||
|
||||
/*
|
||||
* Construct a continuation
|
||||
@ -1079,7 +1108,7 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
|
||||
cp->mp = new_mp;
|
||||
cp->retry = TRUE;
|
||||
cp->start = clocktime(NULL);
|
||||
cp->mf = new_mp->am_mfarray;
|
||||
cp->al = new_mp->am_alarray;
|
||||
|
||||
/*
|
||||
* Try and mount the file system. If this succeeds immediately (possible
|
||||
@ -1093,7 +1122,7 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
|
||||
|
||||
/*
|
||||
* Code for quick reply. If current_transp is set, then it's the
|
||||
* transp that's been passed down from nfs_program_2() or from
|
||||
* transp that's been passed down from nfs_dispatcher() or from
|
||||
* autofs_program_[123]().
|
||||
* If new_mp->am_transp is not already set, set it by copying in
|
||||
* current_transp. Once am_transp is set, nfs_quick_reply() and
|
||||
@ -1105,7 +1134,8 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
|
||||
new_mp->am_transp = (SVCXPRT *) xmalloc(sizeof(SVCXPRT));
|
||||
*(new_mp->am_transp) = *current_transp;
|
||||
}
|
||||
if (error && new_mp->am_mnt && (new_mp->am_mnt->mf_ops == &amfs_error_ops))
|
||||
if (error && new_mp->am_al && new_mp->am_al->al_mnt &&
|
||||
(new_mp->am_al->al_mnt->mf_ops == &amfs_error_ops))
|
||||
new_mp->am_error = error;
|
||||
|
||||
if (new_mp->am_error > 0)
|
||||
@ -1124,7 +1154,7 @@ am_node *
|
||||
amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op)
|
||||
{
|
||||
am_node *new_mp;
|
||||
mntfs **mf_array;
|
||||
am_loc **al_array;
|
||||
int mp_error;
|
||||
|
||||
dlog("in amfs_generic_lookup_child");
|
||||
@ -1137,7 +1167,7 @@ amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op)
|
||||
return new_mp;
|
||||
|
||||
/* also return if it's already mounted and known to be up */
|
||||
if (*error_return == 0 && FSRV_ISUP(new_mp->am_mnt->mf_server))
|
||||
if (*error_return == 0 && FSRV_ISUP(new_mp->am_al->al_mnt->mf_server))
|
||||
return new_mp;
|
||||
|
||||
switch (op) {
|
||||
@ -1153,42 +1183,15 @@ amfs_generic_lookup_child(am_node *mp, char *fname, int *error_return, int op)
|
||||
/* save error_return */
|
||||
mp_error = *error_return;
|
||||
|
||||
mf_array = amfs_lookup_mntfs(new_mp, error_return);
|
||||
if (!mf_array) {
|
||||
new_mp->am_error = new_mp->am_mnt->mf_error = *error_return;
|
||||
al_array = amfs_lookup_loc(new_mp, error_return);
|
||||
if (!al_array) {
|
||||
new_mp->am_error = new_mp->am_al->al_mnt->mf_error = *error_return;
|
||||
free_map(new_mp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Already mounted but known to be down:
|
||||
* check if we have any alternatives to mount
|
||||
*/
|
||||
if (mp_error == 0) {
|
||||
mntfs **mfp;
|
||||
for (mfp = mf_array; *mfp; mfp++)
|
||||
if (*mfp != new_mp->am_mnt)
|
||||
break;
|
||||
if (*mfp != NULL) {
|
||||
/*
|
||||
* we found an alternative, so try mounting again.
|
||||
*/
|
||||
*error_return = -1;
|
||||
} else {
|
||||
for (mfp = mf_array; *mfp; mfp++)
|
||||
free_mntfs(*mfp);
|
||||
XFREE(mf_array);
|
||||
if (new_mp->am_flags & AMF_SOFTLOOKUP) {
|
||||
ereturn(EIO);
|
||||
} else {
|
||||
*error_return = 0;
|
||||
return new_mp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* store the array inside the am_node */
|
||||
new_mp->am_mfarray = mf_array;
|
||||
new_mp->am_alarray = al_array;
|
||||
|
||||
/*
|
||||
* Note: while it might seem like a good idea to prioritize
|
||||
@ -1250,5 +1253,5 @@ amfs_generic_match(am_opts *fo)
|
||||
/*
|
||||
* mtab entry turns out to be the name of the mount map
|
||||
*/
|
||||
return strdup(fo->opt_rfs ? fo->opt_rfs : ".");
|
||||
return xstrdup(fo->opt_rfs ? fo->opt_rfs : ".");
|
||||
}
|
||||
|
25
external/bsd/am-utils/dist/amd/amfs_host.c
vendored
25
external/bsd/am-utils/dist/amd/amfs_host.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_host.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_host.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -229,7 +225,14 @@ fetch_fhandle(CLIENT *client, char *dir, am_nfs_handle_t *fhp, u_long nfs_versio
|
||||
|
||||
plog(XLOG_INFO, "fetch_fhandle: NFS version %d", (int) nfs_version);
|
||||
#ifdef HAVE_FS_NFS3
|
||||
if (nfs_version == NFS_VERSION3) {
|
||||
if (nfs_version == NFS_VERSION3
|
||||
#ifdef HAVE_FS_NFS4
|
||||
#ifndef NO_FALLBACK
|
||||
|| nfs_version == NFS_VERSION4
|
||||
#endif /* NO_FALLBACK */
|
||||
#endif /* HAVE_FS_NFS4 */
|
||||
) {
|
||||
|
||||
memset((char *) &res3, 0, sizeof(res3));
|
||||
clnt_stat = clnt_call(client,
|
||||
MOUNTPROC_MNT,
|
||||
@ -495,10 +498,8 @@ amfs_host_mount(am_node *am, mntfs *mf)
|
||||
*/
|
||||
out:
|
||||
discard_mntlist(mlist);
|
||||
if (ep)
|
||||
XFREE(ep);
|
||||
if (fp)
|
||||
XFREE(fp);
|
||||
XFREE(ep);
|
||||
XFREE(fp);
|
||||
if (sock != RPC_ANYSOCK)
|
||||
(void) amu_close(sock);
|
||||
if (client)
|
||||
|
14
external/bsd/am-utils/dist/amd/amfs_link.c
vendored
14
external/bsd/am-utils/dist/amd/amfs_link.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_link.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_link.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -112,12 +108,12 @@ amfs_link_match(am_opts *fo)
|
||||
if (fo->opt_fs[0] == '/') {
|
||||
char *link_hack = str3cat(NULL, ".", fo->opt_fs, "");
|
||||
if (fo->opt_sublink == NULL || fo->opt_sublink[0] == '\0')
|
||||
fo->opt_sublink = strdup(fo->opt_fs);
|
||||
fo->opt_sublink = xstrdup(fo->opt_fs);
|
||||
XFREE(fo->opt_fs);
|
||||
fo->opt_fs = link_hack;
|
||||
}
|
||||
|
||||
return strdup(fo->opt_fs);
|
||||
return xstrdup(fo->opt_fs);
|
||||
}
|
||||
|
||||
|
||||
|
10
external/bsd/am-utils/dist/amd/amfs_linkx.c
vendored
10
external/bsd/am-utils/dist/amd/amfs_linkx.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_linkx.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_linkx.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
27
external/bsd/am-utils/dist/amd/amfs_nfsl.c
vendored
27
external/bsd/am-utils/dist/amd/amfs_nfsl.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_nfsl.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_nfsl.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -118,8 +114,9 @@ amfs_nfsl_match(am_opts *fo)
|
||||
* call nfs_ops.fs_match().
|
||||
* If link value exists (or same host), call amfs_link_ops.fs_match().
|
||||
*/
|
||||
if (!STRCEQ(ho, am_get_hostname())) {
|
||||
plog(XLOG_INFO, "amfs_nfsl: \"%s\" is not local host, using type:=nfs", ho);
|
||||
if (!STRCEQ(ho, am_get_hostname()) && !STRCEQ(ho, hostd)) {
|
||||
plog(XLOG_INFO, "amfs_nfsl: \"%s\" is not the local host \"%s\", "
|
||||
"or \"%s\" using type:=nfs", ho, am_get_hostname(), hostd);
|
||||
retval = nfs_ops.fs_match(fo);
|
||||
} else if (lstat(cp, &stb) < 0) {
|
||||
plog(XLOG_INFO, "amfs_nfsl: \"%s\" does not exist, using type:=nfs", cp);
|
||||
@ -215,10 +212,15 @@ amfs_nfsl_umounted(mntfs *mf)
|
||||
static fserver *
|
||||
amfs_nfsl_ffserver(mntfs *mf)
|
||||
{
|
||||
char *cp;
|
||||
char *ho = mf->mf_fo->opt_rhost;
|
||||
char *cp, *ho;
|
||||
struct stat stb;
|
||||
|
||||
if (mf->mf_fo == NULL) {
|
||||
plog(XLOG_ERROR, "%s: NULL mf_fo", __func__);
|
||||
return NULL;
|
||||
}
|
||||
ho = mf->mf_fo->opt_rhost;
|
||||
|
||||
if (mf->mf_fo->opt_sublink && mf->mf_fo->opt_sublink[0])
|
||||
cp = mf->mf_fo->opt_sublink;
|
||||
else
|
||||
@ -229,7 +231,8 @@ amfs_nfsl_ffserver(mntfs *mf)
|
||||
* call amfs_link_ops.ffserver().
|
||||
* If link value exists (or same host), then call ops_nfs.ffserver().
|
||||
*/
|
||||
if (!STRCEQ(ho, am_get_hostname()) || lstat(cp, &stb) < 0) {
|
||||
if ((!STRCEQ(ho, am_get_hostname()) &&
|
||||
!STRCEQ(ho, hostd)) || lstat(cp, &stb) < 0) {
|
||||
return nfs_ops.ffserver(mf);
|
||||
} else {
|
||||
mf->mf_flags |= MFF_NFSLINK;
|
||||
|
27
external/bsd/am-utils/dist/amd/amfs_nfsx.c
vendored
27
external/bsd/am-utils/dist/amd/amfs_nfsx.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_nfsx.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_nfsx.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -197,7 +193,10 @@ amfs_nfsx_init(mntfs *mf)
|
||||
char *pref;
|
||||
int error = 0;
|
||||
|
||||
info = strdup(mf->mf_info);
|
||||
info = xstrdup(mf->mf_info);
|
||||
if (info == NULL)
|
||||
return errno;
|
||||
|
||||
host = strchr(info, ':');
|
||||
if (!host) {
|
||||
error = EINVAL;
|
||||
@ -253,18 +252,14 @@ amfs_nfsx_init(mntfs *mf)
|
||||
/* propagate the on_autofs flag */
|
||||
nx->nx_v[i].n_mnt->mf_flags |= mf->mf_flags & MFF_ON_AUTOFS;
|
||||
}
|
||||
if (rfs)
|
||||
XFREE(rfs);
|
||||
if (mp)
|
||||
XFREE(mp);
|
||||
if (xinfo)
|
||||
XFREE(xinfo);
|
||||
XFREE(rfs);
|
||||
XFREE(mp);
|
||||
XFREE(xinfo);
|
||||
}
|
||||
|
||||
XFREE(ivec);
|
||||
errexit:
|
||||
if (info)
|
||||
XFREE(info);
|
||||
XFREE(info);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
34
external/bsd/am-utils/dist/amd/amfs_program.c
vendored
34
external/bsd/am-utils/dist/amd/amfs_program.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_program.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_program.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -107,7 +103,7 @@ amfs_program_match(am_opts *fo)
|
||||
}
|
||||
prog = strchr(fo->opt_mount, ' ');
|
||||
|
||||
return strdup(prog ? prog + 1 : fo->opt_mount);
|
||||
return xstrdup(prog ? prog + 1 : fo->opt_mount);
|
||||
}
|
||||
|
||||
|
||||
@ -118,11 +114,14 @@ amfs_program_init(mntfs *mf)
|
||||
if (mf->mf_private != NULL)
|
||||
return 0;
|
||||
|
||||
if (mf->mf_fo == NULL)
|
||||
return 0;
|
||||
|
||||
/* save unmount (or umount) command */
|
||||
if (mf->mf_fo->opt_unmount != NULL)
|
||||
mf->mf_private = (opaque_t) strdup(mf->mf_fo->opt_unmount);
|
||||
mf->mf_private = (opaque_t) xstrdup(mf->mf_fo->opt_unmount);
|
||||
else
|
||||
mf->mf_private = (opaque_t) strdup(mf->mf_fo->opt_umount);
|
||||
mf->mf_private = (opaque_t) xstrdup(mf->mf_fo->opt_umount);
|
||||
mf->mf_prfree = (void (*)(opaque_t)) free;
|
||||
|
||||
return 0;
|
||||
@ -138,9 +137,7 @@ amfs_program_exec(char *info)
|
||||
/*
|
||||
* Split copy of command info string
|
||||
*/
|
||||
info = strdup(info);
|
||||
if (info == 0)
|
||||
return ENOBUFS;
|
||||
info = xstrdup(info);
|
||||
xivec = strsplit(info, ' ', '\'');
|
||||
|
||||
/*
|
||||
@ -149,10 +146,12 @@ amfs_program_exec(char *info)
|
||||
(void) fclose(stdout);
|
||||
if (!logfp)
|
||||
logfp = stderr; /* initialize before possible first use */
|
||||
(void) dup(fileno(logfp));
|
||||
if (dup(fileno(logfp)) == -1)
|
||||
goto out;
|
||||
if (fileno(logfp) != fileno(stderr)) {
|
||||
(void) fclose(stderr);
|
||||
(void) dup(fileno(logfp));
|
||||
if (dup(fileno(logfp)) == -1)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -172,13 +171,16 @@ amfs_program_exec(char *info)
|
||||
plog(XLOG_USER, "1st/2nd args missing to (un)mount program");
|
||||
} else {
|
||||
(void) execv(xivec[0], xivec + 1);
|
||||
error = errno;
|
||||
plog(XLOG_ERROR, "exec failed: %m");
|
||||
errno = error;
|
||||
}
|
||||
|
||||
out:
|
||||
/*
|
||||
* Save error number
|
||||
*/
|
||||
error = errno;
|
||||
plog(XLOG_ERROR, "exec failed: %m");
|
||||
|
||||
/*
|
||||
* Free allocate memory
|
||||
|
10
external/bsd/am-utils/dist/amd/amfs_root.c
vendored
10
external/bsd/am-utils/dist/amd/amfs_root.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_root.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_root.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
10
external/bsd/am-utils/dist/amd/amfs_toplvl.c
vendored
10
external/bsd/am-utils/dist/amd/amfs_toplvl.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_toplvl.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_toplvl.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
16
external/bsd/am-utils/dist/amd/amfs_union.c
vendored
16
external/bsd/am-utils/dist/amd/amfs_union.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amfs_union.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amfs_union.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -97,7 +93,7 @@ create_amfs_union_node(char *dir, opaque_t arg)
|
||||
am_node *am;
|
||||
am = amfs_generic_lookup_child(arg, dir, &error, VLOOK_CREATE);
|
||||
if (am && error < 0)
|
||||
am = amfs_generic_mount_child(am, &error);
|
||||
(void)amfs_generic_mount_child(am, &error);
|
||||
if (error > 0) {
|
||||
errno = error; /* XXX */
|
||||
plog(XLOG_ERROR, "unionfs: could not mount %s: %m", dir);
|
||||
@ -123,9 +119,9 @@ amfs_union_mounted(mntfs *mf)
|
||||
for (mp = get_first_exported_ap(&index);
|
||||
mp;
|
||||
mp = get_next_exported_ap(&index)) {
|
||||
if (mp->am_mnt == mf) {
|
||||
if (mp->am_al->al_mnt == mf) {
|
||||
/* return value from create_amfs_union_node is ignored by mapc_keyiter */
|
||||
(void) mapc_keyiter((mnt_map *) mp->am_mnt->mf_private,
|
||||
(void) mapc_keyiter((mnt_map *) mp->am_al->al_mnt->mf_private,
|
||||
create_amfs_union_node,
|
||||
mp);
|
||||
break;
|
||||
|
99
external/bsd/am-utils/dist/amd/amq_subr.c
vendored
99
external/bsd/am-utils/dist/amd/amq_subr.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amq_subr.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amq_subr.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -224,6 +220,12 @@ amqproc_getmntfs_1_svc(voidp argp, struct svc_req *rqstp)
|
||||
return (amq_mount_info_list *) ((void *)&mfhead); /* XXX */
|
||||
}
|
||||
|
||||
extern qelem map_list_head;
|
||||
amq_map_info_list *
|
||||
amqproc_getmapinfo_1_svc(voidp argp, struct svc_req *rqstp)
|
||||
{
|
||||
return (amq_map_info_list *) ((void *)&map_list_head); /* XXX */
|
||||
}
|
||||
|
||||
amq_string *
|
||||
amqproc_getvers_1_svc(voidp argp, struct svc_req *rqstp)
|
||||
@ -272,11 +274,11 @@ amqproc_pawd_1_svc(voidp argp, struct svc_req *rqstp)
|
||||
for (mp = get_first_exported_ap(&index);
|
||||
mp;
|
||||
mp = get_next_exported_ap(&index)) {
|
||||
if (STREQ(mp->am_mnt->mf_ops->fs_type, "toplvl"))
|
||||
if (STREQ(mp->am_al->al_mnt->mf_ops->fs_type, "toplvl"))
|
||||
continue;
|
||||
if (STREQ(mp->am_mnt->mf_ops->fs_type, "auto"))
|
||||
if (STREQ(mp->am_al->al_mnt->mf_ops->fs_type, "auto"))
|
||||
continue;
|
||||
mountpoint = (mp->am_link ? mp->am_link : mp->am_mnt->mf_mount);
|
||||
mountpoint = (mp->am_link ? mp->am_link : mp->am_al->al_mnt->mf_mount);
|
||||
len = strlen(mountpoint);
|
||||
if (len == 0)
|
||||
continue;
|
||||
@ -331,16 +333,16 @@ xdr_amq_mount_tree_node(XDR *xdrs, amq_mount_tree *objp)
|
||||
am_node *mp = (am_node *) objp;
|
||||
long mtime;
|
||||
|
||||
if (!xdr_amq_string(xdrs, &mp->am_mnt->mf_info)) {
|
||||
if (!xdr_amq_string(xdrs, &mp->am_al->al_mnt->mf_info)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_amq_string(xdrs, &mp->am_path)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_amq_string(xdrs, mp->am_link ? &mp->am_link : &mp->am_mnt->mf_mount)) {
|
||||
if (!xdr_amq_string(xdrs, mp->am_link ? &mp->am_link : &mp->am_al->al_mnt->mf_mount)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_amq_string(xdrs, &mp->am_mnt->mf_ops->fs_type)) {
|
||||
if (!xdr_amq_string(xdrs, &mp->am_al->al_mnt->mf_ops->fs_type)) {
|
||||
return (FALSE);
|
||||
}
|
||||
mtime = mp->am_stats.s_mtime;
|
||||
@ -466,16 +468,15 @@ xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Compute length of list
|
||||
*/
|
||||
bool_t
|
||||
xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead)
|
||||
{
|
||||
mntfs *mf;
|
||||
u_int len = 0;
|
||||
|
||||
/*
|
||||
* Compute length of list
|
||||
*/
|
||||
for (mf = AM_LAST(mntfs, qhead); mf != HEAD(mntfs, qhead); mf = PREV(mntfs, mf)) {
|
||||
if (!(mf->mf_fsflags & FS_AMQINFO))
|
||||
continue;
|
||||
@ -522,6 +523,70 @@ xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_amq_map_info_qelem(XDR *xdrs, qelem *qhead)
|
||||
{
|
||||
mnt_map *m;
|
||||
u_int len = 0;
|
||||
int x;
|
||||
char *n;
|
||||
|
||||
/*
|
||||
* Compute length of list
|
||||
*/
|
||||
ITER(m, mnt_map, qhead) {
|
||||
len++;
|
||||
}
|
||||
|
||||
if (!xdr_u_int(xdrs, &len))
|
||||
return (FALSE);
|
||||
|
||||
/*
|
||||
* Send individual data items
|
||||
*/
|
||||
ITER(m, mnt_map, qhead) {
|
||||
if (!xdr_amq_string(xdrs, &m->map_name)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
n = m->wildcard ? m->wildcard : "";
|
||||
if (!xdr_amq_string(xdrs, &n)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!xdr_long(xdrs, &m->modify)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
x = m->flags;
|
||||
if (!xdr_int(xdrs, &x)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
x = m->nentries;
|
||||
if (!xdr_int(xdrs, &x)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
x = m->reloads;
|
||||
if (!xdr_int(xdrs, &x)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!xdr_int(xdrs, &m->refc)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (m->isup)
|
||||
x = (*m->isup)(m, m->map_name);
|
||||
else
|
||||
x = -1;
|
||||
if (!xdr_int(xdrs, &x)) {
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_pri_free(XDRPROC_T_TYPE xdr_args, caddr_t args_ptr)
|
||||
|
64
external/bsd/am-utils/dist/amd/amq_svc.c
vendored
64
external/bsd/am-utils/dist/amd/amq_svc.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amq_svc.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: amq_svc.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -67,47 +63,17 @@ int allow_severity=0, deny_severity=0, rfc931_timeout=0;
|
||||
* Returns: 1=allowed, 0=denied.
|
||||
*/
|
||||
static int
|
||||
amqsvc_is_client_allowed(const struct sockaddr_in *addr, char *remote)
|
||||
amqsvc_is_client_allowed(const struct sockaddr_in *addr)
|
||||
{
|
||||
struct hostent *h;
|
||||
char *name = NULL, **ad;
|
||||
int ret = 0; /* default is 0==denied */
|
||||
struct request_info req;
|
||||
|
||||
/* Check IP address */
|
||||
if (hosts_ctl(AMD_SERVICE_NAME, "", remote, "")) {
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
/* Get address */
|
||||
if (!(h = gethostbyaddr((const char *)&(addr->sin_addr),
|
||||
sizeof(addr->sin_addr),
|
||||
AF_INET)))
|
||||
goto out;
|
||||
if (!(name = strdup(h->h_name)))
|
||||
goto out;
|
||||
/* Paranoia check */
|
||||
if (!(h = gethostbyname(name)))
|
||||
goto out;
|
||||
for (ad = h->h_addr_list; *ad; ad++)
|
||||
if (!memcmp(*ad, &(addr->sin_addr), h->h_length))
|
||||
break;
|
||||
if (!*ad)
|
||||
goto out;
|
||||
if (hosts_ctl(AMD_SERVICE_NAME, "", h->h_name, "")) {
|
||||
return 1;
|
||||
goto out;
|
||||
}
|
||||
/* Check aliases */
|
||||
for (ad = h->h_aliases; *ad; ad++)
|
||||
if (hosts_ctl(AMD_SERVICE_NAME, "", *ad, "")) {
|
||||
return 1;
|
||||
goto out;
|
||||
}
|
||||
request_init(&req, RQ_DAEMON, AMD_SERVICE_NAME, RQ_CLIENT_SIN, addr, 0);
|
||||
sock_methods(&req);
|
||||
|
||||
out:
|
||||
if (name)
|
||||
XFREE(name);
|
||||
return ret;
|
||||
if (hosts_access(&req))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
|
||||
|
||||
@ -201,7 +167,7 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
|
||||
struct sockaddr_in *remote_addr = svc_getcaller(rqstp->rq_xprt);
|
||||
char *remote_hostname = inet_ntoa(remote_addr->sin_addr);
|
||||
|
||||
if (!amqsvc_is_client_allowed(remote_addr, remote_hostname)) {
|
||||
if (!amqsvc_is_client_allowed(remote_addr)) {
|
||||
plog(XLOG_WARNING, "Amd denied remote amq service to %s", remote_hostname);
|
||||
svcerr_auth(transp, AUTH_FAILED);
|
||||
return;
|
||||
@ -286,6 +252,12 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
|
||||
local = (amqsvcproc_t) amqproc_sync_umnt_1_svc_async;
|
||||
break;
|
||||
|
||||
case AMQPROC_GETMAPINFO:
|
||||
xdr_argument = (xdrproc_t) xdr_void;
|
||||
xdr_result = (xdrproc_t) xdr_amq_map_info_qelem;
|
||||
local = (amqsvcproc_t) amqproc_getmapinfo_1_svc;
|
||||
break;
|
||||
|
||||
default:
|
||||
svcerr_noproc(transp);
|
||||
return;
|
||||
|
89
external/bsd/am-utils/dist/amd/autil.c
vendored
89
external/bsd/am-utils/dist/amd/autil.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: autil.c,v 1.1.1.2 2009/03/20 20:26:48 christos Exp $ */
|
||||
/* $NetBSD: autil.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -162,7 +158,7 @@ valid_key(char *key)
|
||||
void
|
||||
forcibly_timeout_mp(am_node *mp)
|
||||
{
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
/*
|
||||
* Arrange to timeout this node
|
||||
*/
|
||||
@ -216,24 +212,11 @@ mf_mounted(mntfs *mf, bool_t call_free_opts)
|
||||
mf->mf_ops->mounted(mf);
|
||||
|
||||
/*
|
||||
* Be careful when calling free_ops and XFREE here. Some pseudo file
|
||||
* systems like nfsx call this function (mf_mounted), even though it
|
||||
* would be called by the lower-level amd file system functions. nfsx
|
||||
* needs to call this function because of the other actions it takes.
|
||||
* So we pass a boolean from the caller (yes, not so clean workaround)
|
||||
* to determine if we should free or not. If we're not freeing (often
|
||||
* because we're called from a callback function), then just to be sure,
|
||||
* we'll zero out the am_opts structure and set the pointer to NULL.
|
||||
* The parent mntfs node owns this memory and is going to free it with a
|
||||
* call to mf_mounted(mntfs,TRUE) (see comment in the am_mounted code).
|
||||
* We used to free the mf_mo (options) here, however they're now stored
|
||||
* and managed with the mntfs and do not need to be free'd here (this ensures
|
||||
* that we use the same options to monitor/unmount the system as we used
|
||||
* to mount it).
|
||||
*/
|
||||
if (call_free_opts) {
|
||||
free_opts(mf->mf_fo); /* this free is needed to prevent leaks */
|
||||
XFREE(mf->mf_fo); /* (also this one) */
|
||||
} else {
|
||||
memset(mf->mf_fo, 0, sizeof(am_opts));
|
||||
mf->mf_fo = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (mf->mf_flags & MFF_RESTART) {
|
||||
@ -258,7 +241,7 @@ void
|
||||
am_mounted(am_node *mp)
|
||||
{
|
||||
int notimeout = 0; /* assume normal timeouts initially */
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
|
||||
/*
|
||||
* This is the parent mntfs which does the mf->mf_fo (am_opts type), and
|
||||
@ -275,7 +258,7 @@ am_mounted(am_node *mp)
|
||||
/*
|
||||
* Patch up path for direct mounts
|
||||
*/
|
||||
if (mp->am_parent && mp->am_parent->am_mnt->mf_fsflags & FS_DIRECT)
|
||||
if (mp->am_parent && mp->am_parent->am_al->al_mnt->mf_fsflags & FS_DIRECT)
|
||||
mp->am_path = str3cat(mp->am_path, mp->am_parent->am_path, "/", ".");
|
||||
|
||||
/*
|
||||
@ -286,6 +269,7 @@ am_mounted(am_node *mp)
|
||||
if (mf->mf_fsflags & FS_NOTIMEOUT)
|
||||
notimeout = 1;
|
||||
/* next, alter that decision by map flags */
|
||||
|
||||
if (mf->mf_mopts) {
|
||||
mntent_t mnt;
|
||||
mnt.mnt_opts = mf->mf_mopts;
|
||||
@ -330,7 +314,7 @@ am_mounted(am_node *mp)
|
||||
/*
|
||||
* Update mtime of parent node (copying "struct nfstime" in '=' below)
|
||||
*/
|
||||
if (mp->am_parent && mp->am_parent->am_mnt)
|
||||
if (mp->am_parent && mp->am_parent->am_al->al_mnt)
|
||||
mp->am_parent->am_fattr.na_mtime = mp->am_fattr.na_mtime;
|
||||
|
||||
/*
|
||||
@ -369,21 +353,27 @@ assign_error_mntfs(am_node *mp)
|
||||
{
|
||||
int error;
|
||||
dlog("assign_error_mntfs");
|
||||
|
||||
if (mp->am_al == NULL) {
|
||||
plog(XLOG_ERROR, "%s: Can't assign error", __func__);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Save the old error code
|
||||
*/
|
||||
error = mp->am_error;
|
||||
if (error <= 0)
|
||||
error = mp->am_mnt->mf_error;
|
||||
error = mp->am_al->al_mnt->mf_error;
|
||||
/*
|
||||
* Allocate a new error reference
|
||||
*/
|
||||
mp->am_mnt = new_mntfs();
|
||||
free_loc(mp->am_al);
|
||||
mp->am_al = new_loc();
|
||||
/*
|
||||
* Put back the error code
|
||||
*/
|
||||
mp->am_mnt->mf_error = error;
|
||||
mp->am_mnt->mf_flags |= MFF_ERROR;
|
||||
mp->am_al->al_mnt->mf_error = error;
|
||||
mp->am_al->al_mnt->mf_flags |= MFF_ERROR;
|
||||
/*
|
||||
* Zero the error in the mount point
|
||||
*/
|
||||
@ -428,7 +418,7 @@ next_nonerror_node(am_node *xp)
|
||||
* containing hung automounts.
|
||||
*/
|
||||
while (xp &&
|
||||
(!(mf = xp->am_mnt) || /* No mounted filesystem */
|
||||
(!(mf = xp->am_al->al_mnt) || /* No mounted filesystem */
|
||||
mf->mf_error != 0 || /* There was a mntfs error */
|
||||
xp->am_error != 0 || /* There was a mount error */
|
||||
!(mf->mf_flags & MFF_MOUNTED) || /* The fs is not mounted */
|
||||
@ -463,8 +453,9 @@ amfs_mount(am_node *mp, mntfs *mf, char *opts)
|
||||
mntent_t mnt;
|
||||
MTYPE_TYPE type;
|
||||
int forced_unmount = 0; /* are we using forced unmounts? */
|
||||
u_long nfs_version = get_nfs_dispatcher_version(nfs_dispatcher);
|
||||
|
||||
memset((voidp) &mnt, 0, sizeof(mnt));
|
||||
memset(&mnt, 0, sizeof(mnt));
|
||||
mnt.mnt_dir = dir;
|
||||
mnt.mnt_fsname = pid_fsname;
|
||||
mnt.mnt_opts = opts;
|
||||
@ -535,8 +526,7 @@ amfs_mount(am_node *mp, mntfs *mf, char *opts)
|
||||
again:
|
||||
if (!(mf->mf_flags & MFF_IS_AUTOFS)) {
|
||||
nfs_args_t nfs_args;
|
||||
am_nfs_fh *fhp;
|
||||
am_nfs_handle_t anh;
|
||||
am_nfs_handle_t *fhp, anh;
|
||||
#ifndef HAVE_TRANSPORT_TYPE_TLI
|
||||
u_short port;
|
||||
struct sockaddr_in sin;
|
||||
@ -545,7 +535,7 @@ again:
|
||||
/*
|
||||
* get fhandle of remote path for automount point
|
||||
*/
|
||||
fhp = get_root_nfs_fh(dir);
|
||||
fhp = get_root_nfs_fh(dir, &anh);
|
||||
if (!fhp) {
|
||||
plog(XLOG_FATAL, "Can't find root file handle for %s", dir);
|
||||
return EINVAL;
|
||||
@ -555,7 +545,7 @@ again:
|
||||
/*
|
||||
* Create sockaddr to point to the local machine.
|
||||
*/
|
||||
memset((voidp) &sin, 0, sizeof(sin));
|
||||
memset(&sin, 0, sizeof(sin));
|
||||
/* as per POSIX, sin_len need not be set (used internally by kernel) */
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_addr = myipaddr;
|
||||
@ -569,16 +559,15 @@ again:
|
||||
#endif /* not HAVE_TRANSPORT_TYPE_TLI */
|
||||
|
||||
/* setup the many fields and flags within nfs_args */
|
||||
memmove(&anh.v2, fhp, sizeof(*fhp));
|
||||
#ifdef HAVE_TRANSPORT_TYPE_TLI
|
||||
compute_nfs_args(&nfs_args,
|
||||
&mnt,
|
||||
genflags,
|
||||
nfsncp,
|
||||
NULL, /* remote host IP addr is set below */
|
||||
NFS_VERSION, /* version 2 */
|
||||
nfs_version,
|
||||
"udp",
|
||||
&anh,
|
||||
fhp,
|
||||
fs_hostname,
|
||||
pid_fsname);
|
||||
/*
|
||||
@ -597,9 +586,9 @@ again:
|
||||
genflags,
|
||||
NULL,
|
||||
&sin,
|
||||
NFS_VERSION, /* version 2 */
|
||||
nfs_version,
|
||||
"udp",
|
||||
&anh,
|
||||
fhp,
|
||||
fs_hostname,
|
||||
pid_fsname);
|
||||
#endif /* not HAVE_TRANSPORT_TYPE_TLI */
|
||||
@ -666,7 +655,7 @@ again:
|
||||
void
|
||||
am_unmounted(am_node *mp)
|
||||
{
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
|
||||
if (!foreground) { /* firewall - should never happen */
|
||||
/*
|
||||
@ -724,13 +713,13 @@ am_unmounted(am_node *mp)
|
||||
/*
|
||||
* Update mtime of parent node
|
||||
*/
|
||||
if (mp->am_parent && mp->am_parent->am_mnt)
|
||||
if (mp->am_parent && mp->am_parent->am_al->al_mnt)
|
||||
clocktime(&mp->am_parent->am_fattr.na_mtime);
|
||||
|
||||
if (mp->am_parent && (mp->am_flags & AMF_REMOUNT)) {
|
||||
char *fname = strdup(mp->am_name);
|
||||
char *fname = xstrdup(mp->am_name);
|
||||
am_node *mp_parent = mp->am_parent;
|
||||
mntfs *mf_parent = mp_parent->am_mnt;
|
||||
mntfs *mf_parent = mp_parent->am_al->al_mnt;
|
||||
am_node fake_mp;
|
||||
int error = 0;
|
||||
|
||||
@ -745,7 +734,7 @@ am_unmounted(am_node *mp)
|
||||
plog(XLOG_INFO, "am_unmounted: remounting %s", fname);
|
||||
mp = mf_parent->mf_ops->lookup_child(mp_parent, fname, &error, VLOOK_CREATE);
|
||||
if (mp && error < 0)
|
||||
mp = mf_parent->mf_ops->mount_child(mp, &error);
|
||||
(void)mf_parent->mf_ops->mount_child(mp, &error);
|
||||
if (error > 0) {
|
||||
errno = error;
|
||||
plog(XLOG_ERROR, "am_unmounted: could not remount %s: %m", fname);
|
||||
@ -762,10 +751,10 @@ am_unmounted(am_node *mp)
|
||||
* while a struct continuation still has a reference to it. So when
|
||||
* amfs_cont is called, it blows up.
|
||||
* We avoid the race by refusing to free any nodes that have
|
||||
* pending mounts (defined as having a non-NULL am_mfarray).
|
||||
* pending mounts (defined as having a non-NULL am_alarray).
|
||||
*/
|
||||
notify_child(mp, AMQ_UMNT_OK, 0, 0); /* do this regardless */
|
||||
if (!mp->am_mfarray)
|
||||
if (!mp->am_alarray)
|
||||
free_map(mp);
|
||||
}
|
||||
}
|
||||
|
10
external/bsd/am-utils/dist/amd/clock.c
vendored
10
external/bsd/am-utils/dist/amd/clock.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: clock.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
100
external/bsd/am-utils/dist/amd/conf.c
vendored
100
external/bsd/am-utils/dist/amd/conf.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: conf.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -79,6 +75,7 @@ struct _func_map {
|
||||
static int gopt_arch(const char *val);
|
||||
static int gopt_auto_attrcache(const char *val);
|
||||
static int gopt_auto_dir(const char *val);
|
||||
static int gopt_auto_nfs_version(const char *val);
|
||||
static int gopt_autofs_use_lofs(const char *val);
|
||||
static int gopt_browsable_dirs(const char *val);
|
||||
static int gopt_cache_duration(const char *val);
|
||||
@ -122,6 +119,7 @@ static int gopt_nfs_retry_interval_udp(const char *val);
|
||||
static int gopt_nfs_retry_interval_tcp(const char *val);
|
||||
static int gopt_nfs_retry_interval_toplvl(const char *val);
|
||||
static int gopt_nfs_vers(const char *val);
|
||||
static int gopt_nfs_vers_ping(const char *val);
|
||||
static int gopt_nis_domain(const char *val);
|
||||
static int gopt_normalize_hostnames(const char *val);
|
||||
static int gopt_normalize_slashes(const char *val);
|
||||
@ -163,6 +161,7 @@ static struct _func_map glob_functable[] = {
|
||||
{"arch", gopt_arch},
|
||||
{"auto_attrcache", gopt_auto_attrcache},
|
||||
{"auto_dir", gopt_auto_dir},
|
||||
{"auto_nfs_version", gopt_auto_nfs_version},
|
||||
{"autofs_use_lofs", gopt_autofs_use_lofs},
|
||||
{"browsable_dirs", gopt_browsable_dirs},
|
||||
{"cache_duration", gopt_cache_duration},
|
||||
@ -206,6 +205,7 @@ static struct _func_map glob_functable[] = {
|
||||
{"nfs_retry_interval_tcp", gopt_nfs_retry_interval_tcp},
|
||||
{"nfs_retry_interval_toplvl", gopt_nfs_retry_interval_toplvl},
|
||||
{"nfs_vers", gopt_nfs_vers},
|
||||
{"nfs_vers_ping", gopt_nfs_vers_ping},
|
||||
{"nis_domain", gopt_nis_domain},
|
||||
{"normalize_hostnames", gopt_normalize_hostnames},
|
||||
{"normalize_slashes", gopt_normalize_slashes},
|
||||
@ -373,7 +373,7 @@ process_global_option(const char *key, const char *val)
|
||||
static int
|
||||
gopt_arch(const char *val)
|
||||
{
|
||||
gopt.arch = strdup((char *)val);
|
||||
gopt.arch = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -393,10 +393,23 @@ gopt_auto_attrcache(const char *val)
|
||||
static int
|
||||
gopt_auto_dir(const char *val)
|
||||
{
|
||||
gopt.auto_dir = strdup((char *)val);
|
||||
gopt.auto_dir = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
gopt_auto_nfs_version(const char *val)
|
||||
{
|
||||
if (strcmp(val, "2") == 0)
|
||||
nfs_dispatcher = nfs_program_2;
|
||||
else if (strcmp(val, "3") == 0)
|
||||
nfs_dispatcher = nfs_program_3;
|
||||
else {
|
||||
fprintf(stderr, "conf: bad auto nfs version : \"%s\"\n", val);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
gopt_autofs_use_lofs(const char *val)
|
||||
@ -446,7 +459,7 @@ gopt_cache_duration(const char *val)
|
||||
static int
|
||||
gopt_cluster(const char *val)
|
||||
{
|
||||
gopt.cluster = strdup((char *)val);
|
||||
gopt.cluster = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -454,7 +467,7 @@ gopt_cluster(const char *val)
|
||||
static int
|
||||
gopt_debug_mtab_file(const char *val)
|
||||
{
|
||||
gopt.debug_mtab_file = strdup((char*)val);
|
||||
gopt.debug_mtab_file = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -554,7 +567,7 @@ gopt_forced_unmounts(const char *val)
|
||||
static int
|
||||
gopt_full_os(const char *val)
|
||||
{
|
||||
gopt.op_sys_full = strdup((char *)val);
|
||||
gopt.op_sys_full = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -579,7 +592,7 @@ static int
|
||||
gopt_hesiod_base(const char *val)
|
||||
{
|
||||
#ifdef HAVE_MAP_HESIOD
|
||||
gopt.hesiod_base = strdup((char *)val);
|
||||
gopt.hesiod_base = xstrdup(val);
|
||||
return 0;
|
||||
#else /* not HAVE_MAP_HESIOD */
|
||||
fprintf(stderr, "conf: hesiod_base option ignored. No Hesiod support available.\n");
|
||||
@ -591,7 +604,7 @@ gopt_hesiod_base(const char *val)
|
||||
static int
|
||||
gopt_karch(const char *val)
|
||||
{
|
||||
gopt.karch = strdup((char *)val);
|
||||
gopt.karch = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -599,7 +612,7 @@ gopt_karch(const char *val)
|
||||
static int
|
||||
gopt_pid_file(const char *val)
|
||||
{
|
||||
gopt.pid_file = strdup((char *)val);
|
||||
gopt.pid_file = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -607,7 +620,7 @@ gopt_pid_file(const char *val)
|
||||
static int
|
||||
gopt_local_domain(const char *val)
|
||||
{
|
||||
gopt.sub_domain = strdup((char *)val);
|
||||
gopt.sub_domain = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -615,7 +628,7 @@ gopt_local_domain(const char *val)
|
||||
static int
|
||||
gopt_localhost_address(const char *val)
|
||||
{
|
||||
gopt.localhost_address = strdup((char *)val);
|
||||
gopt.localhost_address = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -624,7 +637,7 @@ static int
|
||||
gopt_ldap_base(const char *val)
|
||||
{
|
||||
#ifdef HAVE_MAP_LDAP
|
||||
gopt.ldap_base = strdup((char *)val);
|
||||
gopt.ldap_base = xstrdup(val);
|
||||
return 0;
|
||||
#else /* not HAVE_MAP_LDAP */
|
||||
fprintf(stderr, "conf: ldap_base option ignored. No LDAP support available.\n");
|
||||
@ -675,7 +688,7 @@ static int
|
||||
gopt_ldap_hostports(const char *val)
|
||||
{
|
||||
#ifdef HAVE_MAP_LDAP
|
||||
gopt.ldap_hostports = strdup((char *)val);
|
||||
gopt.ldap_hostports = xstrdup(val);
|
||||
return 0;
|
||||
#else /* not HAVE_MAP_LDAP */
|
||||
fprintf(stderr, "conf: ldap_hostports option ignored. No LDAP support available.\n");
|
||||
@ -726,7 +739,7 @@ gopt_ldap_proto_version(const char *val)
|
||||
static int
|
||||
gopt_log_file(const char *val)
|
||||
{
|
||||
gopt.logfile = strdup((char *)val);
|
||||
gopt.logfile = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -742,7 +755,7 @@ gopt_log_options(const char *val)
|
||||
static int
|
||||
gopt_map_defaults(const char *val)
|
||||
{
|
||||
gopt.map_defaults = strdup((char *)val);
|
||||
gopt.map_defaults = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -750,7 +763,7 @@ gopt_map_defaults(const char *val)
|
||||
static int
|
||||
gopt_map_options(const char *val)
|
||||
{
|
||||
gopt.map_options = strdup((char *)val);
|
||||
gopt.map_options = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -773,7 +786,7 @@ gopt_map_type(const char *val)
|
||||
fprintf(stderr, "conf: no such map type \"%s\"\n", val);
|
||||
return 1;
|
||||
}
|
||||
gopt.map_type = strdup((char *)val);
|
||||
gopt.map_type = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -870,7 +883,7 @@ static int
|
||||
gopt_nfs_proto(const char *val)
|
||||
{
|
||||
if (STREQ(val, "udp") || STREQ(val, "tcp")) {
|
||||
gopt.nfs_proto = strdup((char *)val);
|
||||
gopt.nfs_proto = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, "conf: illegal nfs_proto \"%s\"\n", val);
|
||||
@ -953,7 +966,7 @@ gopt_nfs_vers(const char *val)
|
||||
{
|
||||
int i = atoi(val);
|
||||
|
||||
if (i == 2 || i == 3) {
|
||||
if (i == 2 || i == 3 || i == 4) {
|
||||
gopt.nfs_vers = i;
|
||||
return 0;
|
||||
}
|
||||
@ -962,11 +975,24 @@ gopt_nfs_vers(const char *val)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
gopt_nfs_vers_ping(const char *val)
|
||||
{
|
||||
int i = atoi(val);
|
||||
|
||||
if (i == 2 || i == 3 || i == 4) {
|
||||
gopt.nfs_vers_ping = i;
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, "conf: illegal nfs_vers_ping \"%s\"\n", val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
gopt_nis_domain(const char *val)
|
||||
{
|
||||
#ifdef HAVE_MAP_NIS
|
||||
gopt.nis_domain = strdup((char *)val);
|
||||
gopt.nis_domain = xstrdup(val);
|
||||
return 0;
|
||||
#else /* not HAVE_MAP_NIS */
|
||||
fprintf(stderr, "conf: nis_domain option ignored. No NIS support available.\n");
|
||||
@ -1010,7 +1036,7 @@ gopt_normalize_slashes(const char *val)
|
||||
static int
|
||||
gopt_os(const char *val)
|
||||
{
|
||||
gopt.op_sys = strdup((char *)val);
|
||||
gopt.op_sys = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1018,7 +1044,7 @@ gopt_os(const char *val)
|
||||
static int
|
||||
gopt_osver(const char *val)
|
||||
{
|
||||
gopt.op_sys_ver = strdup((char *)val);
|
||||
gopt.op_sys_ver = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1091,7 +1117,7 @@ gopt_restart_mounts(const char *val)
|
||||
static int
|
||||
gopt_search_path(const char *val)
|
||||
{
|
||||
gopt.search_path = strdup((char *)val);
|
||||
gopt.search_path = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1200,7 +1226,7 @@ gopt_use_tcpwrappers(const char *val)
|
||||
static int
|
||||
gopt_vendor(const char *val)
|
||||
{
|
||||
gopt.op_sys_vendor = strdup((char *)val);
|
||||
gopt.op_sys_vendor = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1222,7 +1248,7 @@ process_regular_option(const char *section, const char *key, const char *val, cf
|
||||
|
||||
/* check if initializing a new map */
|
||||
if (!cfm->cfm_dir)
|
||||
cfm->cfm_dir = strdup((char *)section);
|
||||
cfm->cfm_dir = xstrdup(section);
|
||||
|
||||
/* check for each possible field */
|
||||
if (STREQ(key, "browsable_dirs"))
|
||||
@ -1280,7 +1306,7 @@ ropt_browsable_dirs(const char *val, cf_map_t *cfm)
|
||||
static int
|
||||
ropt_map_name(const char *val, cf_map_t *cfm)
|
||||
{
|
||||
cfm->cfm_name = strdup((char *)val);
|
||||
cfm->cfm_name = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1288,7 +1314,7 @@ ropt_map_name(const char *val, cf_map_t *cfm)
|
||||
static int
|
||||
ropt_map_defaults(const char *val, cf_map_t *cfm)
|
||||
{
|
||||
cfm->cfm_defaults = strdup((char *)val);
|
||||
cfm->cfm_defaults = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1296,7 +1322,7 @@ ropt_map_defaults(const char *val, cf_map_t *cfm)
|
||||
static int
|
||||
ropt_map_options(const char *val, cf_map_t *cfm)
|
||||
{
|
||||
cfm->cfm_opts = strdup((char *)val);
|
||||
cfm->cfm_opts = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1309,7 +1335,7 @@ ropt_map_type(const char *val, cf_map_t *cfm)
|
||||
fprintf(stderr, "conf: no such map type \"%s\"\n", val);
|
||||
return 1;
|
||||
}
|
||||
cfm->cfm_type = strdup((char *)val);
|
||||
cfm->cfm_type = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1339,7 +1365,7 @@ ropt_mount_type(const char *val, cf_map_t *cfm)
|
||||
static int
|
||||
ropt_search_path(const char *val, cf_map_t *cfm)
|
||||
{
|
||||
cfm->cfm_search_path = strdup((char *)val);
|
||||
cfm->cfm_search_path = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1364,7 +1390,7 @@ ropt_sun_map_syntax(const char *val, cf_map_t *cfm)
|
||||
static int
|
||||
ropt_tag(const char *val, cf_map_t *cfm)
|
||||
{
|
||||
cfm->cfm_tag = strdup((char *)val);
|
||||
cfm->cfm_tag = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
10
external/bsd/am-utils/dist/amd/conf_parse.y
vendored
10
external/bsd/am-utils/dist/amd/conf_parse.y
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: conf_parse.y,v 1.1.1.2 2009/03/20 20:26:48 christos Exp $ */
|
||||
/* $NetBSD: conf_parse.y,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
12
external/bsd/am-utils/dist/amd/get_args.c
vendored
12
external/bsd/am-utils/dist/amd/get_args.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: get_args.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: get_args.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -86,7 +82,7 @@ get_version_string(void)
|
||||
len = 2048 + wire_buf_len;
|
||||
vers = xmalloc(len);
|
||||
xsnprintf(vers, len, "%s\n%s\n%s\n%s\n",
|
||||
"Copyright (c) 1997-2009 Erez Zadok",
|
||||
"Copyright (c) 1997-2014 Erez Zadok",
|
||||
"Copyright (c) 1990 Jan-Simon Pendry",
|
||||
"Copyright (c) 1990 Imperial College of Science, Technology & Medicine",
|
||||
"Copyright (c) 1990 The Regents of the University of California.");
|
||||
|
12
external/bsd/am-utils/dist/amd/info_exec.c
vendored
12
external/bsd/am-utils/dist/amd/info_exec.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_exec.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_exec.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -212,7 +208,7 @@ exec_parse_qanswer(mnt_map *m, int fd, char *map, char *key, char **pval, time_t
|
||||
if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX))
|
||||
dc = sun_entry2amd(key, cp);
|
||||
else
|
||||
dc = strdup(cp);
|
||||
dc = xstrdup(cp);
|
||||
*pval = dc;
|
||||
dlog("%s returns %s", key, dc);
|
||||
|
||||
|
14
external/bsd/am-utils/dist/amd/info_file.c
vendored
14
external/bsd/am-utils/dist/amd/info_file.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_file.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_file.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -166,9 +162,9 @@ file_search_or_reload(mnt_map *m,
|
||||
if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX))
|
||||
dc = sun_entry2amd(kp, cp);
|
||||
else
|
||||
dc = strdup(cp);
|
||||
dc = xstrdup(cp);
|
||||
if (fn) {
|
||||
(*fn) (m, strdup(kp), dc);
|
||||
(*fn) (m, xstrdup(kp), dc);
|
||||
} else {
|
||||
*val = dc;
|
||||
dlog("%s returns %s", key, dc);
|
||||
|
10
external/bsd/am-utils/dist/amd/info_hesiod.c
vendored
10
external/bsd/am-utils/dist/amd/info_hesiod.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_hesiod.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_hesiod.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
36
external/bsd/am-utils/dist/amd/info_ldap.c
vendored
36
external/bsd/am-utils/dist/amd/info_ldap.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_ldap.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_ldap.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -121,6 +117,8 @@ struct he_ent {
|
||||
struct he_ent *next;
|
||||
};
|
||||
|
||||
static ALD *ldap_connection;
|
||||
|
||||
/*
|
||||
* FORWARD DECLARATIONS:
|
||||
*/
|
||||
@ -152,8 +150,9 @@ string2he(char *s_orig)
|
||||
char *s;
|
||||
HE_ENT *first = NULL, *cur = NULL;
|
||||
|
||||
if (NULL == s_orig || NULL == (s = strdup(s_orig)))
|
||||
if (NULL == s_orig)
|
||||
return NULL;
|
||||
s = xstrdup(s_orig);
|
||||
for (p = strtok(s, ","); p; p = strtok(NULL, ",")) {
|
||||
if (cur != NULL) {
|
||||
cur->next = ALLOC(HE_ENT);
|
||||
@ -165,10 +164,10 @@ string2he(char *s_orig)
|
||||
c = strchr(p, ':');
|
||||
if (c) { /* Host and port */
|
||||
*c++ = '\0';
|
||||
cur->host = strdup(p);
|
||||
cur->host = xstrdup(p);
|
||||
cur->port = atoi(c);
|
||||
} else {
|
||||
cur->host = strdup(p);
|
||||
cur->host = xstrdup(p);
|
||||
cur->port = LDAP_PORT;
|
||||
}
|
||||
plog(XLOG_USER, "Adding ldap server %s:%d",
|
||||
@ -256,10 +255,18 @@ amu_ldap_init(mnt_map *m, char *map, time_t *ts)
|
||||
if (!gopt.map_type || !STREQ(gopt.map_type, AMD_LDAP_TYPE)) {
|
||||
dlog("amu_ldap_init called with map_type <%s>\n",
|
||||
(gopt.map_type ? gopt.map_type : "null"));
|
||||
return ENOENT;
|
||||
} else {
|
||||
dlog("Map %s is ldap\n", map);
|
||||
}
|
||||
|
||||
#ifndef LDAP_CONNECTION_PER_MAP
|
||||
if (ldap_connection != NULL) {
|
||||
m->map_data = (void *) ldap_connection;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
aldh = ALLOC(ALD);
|
||||
creds = ALLOC(CR);
|
||||
aldh->ldap = NULL;
|
||||
@ -282,11 +289,14 @@ amu_ldap_init(mnt_map *m, char *map, time_t *ts)
|
||||
ald_free(aldh);
|
||||
return (ENOENT);
|
||||
}
|
||||
m->map_data = (void *) aldh;
|
||||
dlog("Bound to %s:%d\n", aldh->hostent->host, aldh->hostent->port);
|
||||
if (get_ldap_timestamp(aldh, map, ts))
|
||||
if (get_ldap_timestamp(aldh, map, ts)) {
|
||||
ald_free(aldh);
|
||||
return (ENOENT);
|
||||
}
|
||||
dlog("Got timestamp for map %s: %ld\n", map, (u_long) *ts);
|
||||
ldap_connection = aldh;
|
||||
m->map_data = (void *) ldap_connection;
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -552,7 +562,7 @@ amu_ldap_search(mnt_map *m, char *map, char *key, char **pval, time_t *ts)
|
||||
if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX))
|
||||
*pval = sun_entry2amd(key, vals[0]);
|
||||
else
|
||||
*pval = strdup(vals[0]);
|
||||
*pval = xstrdup(vals[0]);
|
||||
err = 0;
|
||||
} else {
|
||||
plog(XLOG_USER, "Empty value for %s in map %s\n", key, map);
|
||||
|
12
external/bsd/am-utils/dist/amd/info_ndbm.c
vendored
12
external/bsd/am-utils/dist/amd/info_ndbm.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_ndbm.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_ndbm.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -72,7 +68,7 @@ search_ndbm(mnt_map *m, DBM *db, char *key, char **val)
|
||||
if (m->cfm && (m->cfm->cfm_flags & CFM_SUN_MAP_SYNTAX))
|
||||
*val = sun_entry2amd(key, v.dptr);
|
||||
else
|
||||
*val = strdup(v.dptr);
|
||||
*val = xstrdup(v.dptr);
|
||||
return 0;
|
||||
}
|
||||
return ENOENT;
|
||||
|
13
external/bsd/am-utils/dist/amd/info_nis.c
vendored
13
external/bsd/am-utils/dist/amd/info_nis.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_nis.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_nis.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -112,7 +108,7 @@ determine_nis_domain(void)
|
||||
plog(XLOG_WARNING, "NIS domain name is not set. NIS ignored.");
|
||||
return ENOENT;
|
||||
}
|
||||
gopt.nis_domain = strdup(default_domain);
|
||||
gopt.nis_domain = xstrdup(default_domain);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -170,6 +166,7 @@ nis_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
|
||||
cbinfo.data = (voidp) &data;
|
||||
cbinfo.foreach = (ypall_callback_fxn_t) callback;
|
||||
|
||||
plog(XLOG_INFO, "NIS map %s reloading using yp_all", map);
|
||||
/*
|
||||
* If you are using NIS and your yp_all function is "broken", you have to
|
||||
* get it fixed. The bug in yp_all() is that it does not close a TCP
|
||||
|
10
external/bsd/am-utils/dist/amd/info_nisplus.c
vendored
10
external/bsd/am-utils/dist/amd/info_nisplus.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_nisplus.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_nisplus.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
19
external/bsd/am-utils/dist/amd/info_passwd.c
vendored
19
external/bsd/am-utils/dist/amd/info_passwd.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_passwd.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_passwd.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -100,7 +96,7 @@ passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
|
||||
struct passwd *pw;
|
||||
|
||||
if (STREQ(key, "/defaults")) {
|
||||
*pval = strdup("type:=nfs");
|
||||
*pval = xstrdup("type:=nfs");
|
||||
return 0;
|
||||
}
|
||||
pw = getpwnam(key);
|
||||
@ -125,7 +121,7 @@ passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
|
||||
char *p, *q;
|
||||
char val[MAXPATHLEN];
|
||||
char rhost[MAXHOSTNAMELEN];
|
||||
dir = strdup(pw->pw_dir);
|
||||
dir = xstrdup(pw->pw_dir);
|
||||
|
||||
/*
|
||||
* Find user name. If no / then Invalid...
|
||||
@ -182,13 +178,12 @@ passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
|
||||
dlog("passwd_search: map=%s key=%s -> %s", map, key, val);
|
||||
if (q)
|
||||
*q = '.';
|
||||
*pval = strdup(val);
|
||||
*pval = xstrdup(val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
enoent:
|
||||
if (dir)
|
||||
XFREE(dir);
|
||||
XFREE(dir);
|
||||
|
||||
return ENOENT;
|
||||
}
|
||||
|
10
external/bsd/am-utils/dist/amd/info_sun.c
vendored
10
external/bsd/am-utils/dist/amd/info_sun.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_sun.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_sun.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
29
external/bsd/am-utils/dist/amd/info_union.c
vendored
29
external/bsd/am-utils/dist/amd/info_union.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: info_union.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: info_union.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -79,7 +75,7 @@ union_init(mnt_map *m, char *map, time_t *tp)
|
||||
int
|
||||
union_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
|
||||
{
|
||||
char *mapd = strdup(map + UNION_PREFLEN);
|
||||
char *mapd = xstrdup(map + UNION_PREFLEN);
|
||||
char **v = strsplit(mapd, ':', '\"');
|
||||
char **p;
|
||||
size_t l;
|
||||
@ -97,14 +93,15 @@ union_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
|
||||
int
|
||||
union_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
|
||||
{
|
||||
char *mapd = strdup(map + UNION_PREFLEN);
|
||||
static const char fseq[] = "fs:=";
|
||||
char *mapd = xstrdup(map + UNION_PREFLEN);
|
||||
char **v = strsplit(mapd, ':', '\"');
|
||||
char **dir;
|
||||
|
||||
/*
|
||||
* Add fake /defaults entry
|
||||
*/
|
||||
(*fn) (m, strdup("/defaults"), strdup("type:=link;opts:=nounmount;sublink:=${key}"));
|
||||
(*fn) (m, xstrdup("/defaults"), xstrdup("type:=link;opts:=nounmount;sublink:=${key}"));
|
||||
|
||||
for (dir = v; *dir; dir++) {
|
||||
size_t l;
|
||||
@ -115,7 +112,7 @@ union_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
|
||||
plog(XLOG_USER, "Cannot read directory %s: %m", *dir);
|
||||
continue;
|
||||
}
|
||||
l = strlen(*dir) + 5;
|
||||
l = strlen(*dir) + sizeof(fseq);
|
||||
|
||||
dlog("Reading directory %s...", *dir);
|
||||
while ((dp = readdir(dirp))) {
|
||||
@ -127,8 +124,8 @@ union_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
|
||||
|
||||
dlog("... gives %s", dp->d_name);
|
||||
val = xmalloc(l);
|
||||
xsnprintf(val, l + 5, "fs:=%s", *dir);
|
||||
(*fn) (m, strdup(dp->d_name), val);
|
||||
xsnprintf(val, l, "%s%s", fseq, *dir);
|
||||
(*fn) (m, xstrdup(dp->d_name), val);
|
||||
}
|
||||
closedir(dirp);
|
||||
}
|
||||
@ -137,11 +134,11 @@ union_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *))
|
||||
* Add wildcard entry
|
||||
*/
|
||||
{
|
||||
size_t l = strlen(*(dir-1)) + 5;
|
||||
size_t l = strlen(*(dir-1)) + sizeof(fseq);
|
||||
char *val = xmalloc(l);
|
||||
|
||||
xsnprintf(val, l, "fs:=%s", *(dir-1));
|
||||
(*fn) (m, strdup("*"), val);
|
||||
xsnprintf(val, l, "%s%s", fseq, *(dir-1));
|
||||
(*fn) (m, xstrdup("*"), val);
|
||||
}
|
||||
XFREE(mapd);
|
||||
XFREE(v);
|
||||
|
261
external/bsd/am-utils/dist/amd/map.c
vendored
261
external/bsd/am-utils/dist/amd/map.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: map.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: map.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -192,7 +188,7 @@ am_node *
|
||||
get_ap_child(am_node *mp, char *fname)
|
||||
{
|
||||
am_node *new_mp;
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
|
||||
/*
|
||||
* Allocate a new map
|
||||
@ -327,7 +323,7 @@ insert_am(am_node *mp, am_node *p_mp)
|
||||
mp->am_osib->am_ysib = mp;
|
||||
p_mp->am_child = mp;
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
if (p_mp->am_mnt->mf_flags & MFF_IS_AUTOFS)
|
||||
if (p_mp->am_al->al_mnt->mf_flags & MFF_IS_AUTOFS)
|
||||
mp->am_flags |= AMF_AUTOFS;
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
}
|
||||
@ -410,10 +406,11 @@ init_map(am_node *mp, char *dir)
|
||||
* mp->am_mapno is initialized by exported_ap_alloc
|
||||
* other fields don't need to be set to zero.
|
||||
*/
|
||||
mp->am_mnt = new_mntfs();
|
||||
mp->am_mfarray = NULL;
|
||||
mp->am_name = strdup(dir);
|
||||
mp->am_path = strdup(dir);
|
||||
|
||||
mp->am_al = new_loc();
|
||||
mp->am_alarray = NULL;
|
||||
mp->am_name = xstrdup(dir);
|
||||
mp->am_path = xstrdup(dir);
|
||||
mp->am_gen = new_gen();
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
mp->am_autofs_fh = NULL;
|
||||
@ -441,13 +438,18 @@ void
|
||||
notify_child(am_node *mp, au_etype au_etype, int au_errno, int au_signal)
|
||||
{
|
||||
amq_sync_umnt rv;
|
||||
int err;
|
||||
|
||||
if (mp->am_fd[1] >= 0) { /* we have a child process */
|
||||
rv.au_etype = au_etype;
|
||||
rv.au_signal = au_signal;
|
||||
rv.au_errno = au_errno;
|
||||
|
||||
write(mp->am_fd[1], &rv, sizeof(rv));
|
||||
err = write(mp->am_fd[1], &rv, sizeof(rv));
|
||||
/* XXX: do something else on err? */
|
||||
if (err < sizeof(rv))
|
||||
plog(XLOG_INFO, "notify_child: write returned %d instead of %d.",
|
||||
err, (int) sizeof(rv));
|
||||
close(mp->am_fd[1]);
|
||||
mp->am_fd[1] = -1;
|
||||
}
|
||||
@ -467,25 +469,20 @@ free_map(am_node *mp)
|
||||
plog(XLOG_FATAL, "free_map: called prior to notifying the child for %s.",
|
||||
mp->am_path);
|
||||
|
||||
if (mp->am_link)
|
||||
XFREE(mp->am_link);
|
||||
if (mp->am_name)
|
||||
XFREE(mp->am_name);
|
||||
if (mp->am_path)
|
||||
XFREE(mp->am_path);
|
||||
if (mp->am_pref)
|
||||
XFREE(mp->am_pref);
|
||||
if (mp->am_transp)
|
||||
XFREE(mp->am_transp);
|
||||
XFREE(mp->am_link);
|
||||
XFREE(mp->am_name);
|
||||
XFREE(mp->am_path);
|
||||
XFREE(mp->am_pref);
|
||||
XFREE(mp->am_transp);
|
||||
|
||||
if (mp->am_mnt)
|
||||
free_mntfs(mp->am_mnt);
|
||||
if (mp->am_al)
|
||||
free_loc(mp->am_al);
|
||||
|
||||
if (mp->am_mfarray) {
|
||||
mntfs **temp_mf;
|
||||
for (temp_mf = mp->am_mfarray; *temp_mf; temp_mf++)
|
||||
free_mntfs(*temp_mf);
|
||||
XFREE(mp->am_mfarray);
|
||||
if (mp->am_alarray) {
|
||||
am_loc **temp_al;
|
||||
for (temp_al = mp->am_alarray; *temp_al; temp_al++)
|
||||
free_loc(*temp_al);
|
||||
XFREE(mp->am_alarray);
|
||||
}
|
||||
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
@ -505,8 +502,8 @@ find_ap_recursive(char *dir, am_node *mp)
|
||||
if (STREQ(mp->am_path, dir))
|
||||
return mp;
|
||||
|
||||
if ((mp->am_mnt->mf_flags & MFF_MOUNTED) &&
|
||||
STREQ(mp->am_mnt->mf_mount, dir))
|
||||
if ((mp->am_al->al_mnt->mf_flags & MFF_MOUNTED) &&
|
||||
STREQ(mp->am_al->al_mnt->mf_mount, dir))
|
||||
return mp;
|
||||
|
||||
mp2 = find_ap_recursive(dir, mp->am_osib);
|
||||
@ -542,38 +539,21 @@ find_ap(char *dir)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find the mount node corresponding
|
||||
* to the mntfs structure.
|
||||
*/
|
||||
am_node *
|
||||
find_mf(mntfs *mf)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = last_used_map; i >= 0; --i) {
|
||||
am_node *mp = exported_ap[i];
|
||||
if (mp && mp->am_mnt == mf)
|
||||
return mp;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the filehandle for a particular named directory.
|
||||
* This is used during the bootstrap to tell the kernel
|
||||
* the filehandles of the initial automount points.
|
||||
*/
|
||||
am_nfs_fh *
|
||||
get_root_nfs_fh(char *dir)
|
||||
am_nfs_handle_t *
|
||||
get_root_nfs_fh(char *dir, am_nfs_handle_t *nfh)
|
||||
{
|
||||
static am_nfs_fh nfh;
|
||||
am_node *mp = get_root_ap(dir);
|
||||
if (mp) {
|
||||
mp_to_fh(mp, &nfh);
|
||||
return &nfh;
|
||||
if (nfs_dispatcher == nfs_program_2)
|
||||
mp_to_fh(mp, &nfh->v2);
|
||||
else
|
||||
mp_to_fh3(mp, &nfh->v3);
|
||||
return nfh;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -609,7 +589,8 @@ map_flush_srvr(fserver *fs)
|
||||
|
||||
for (i = last_used_map; i >= 0; --i) {
|
||||
am_node *mp = exported_ap[i];
|
||||
if (mp && mp->am_mnt && mp->am_mnt->mf_server == fs) {
|
||||
|
||||
if (mp && mp->am_al->al_mnt && mp->am_al->al_mnt->mf_server == fs) {
|
||||
plog(XLOG_INFO, "Flushed %s; dependent on %s", mp->am_path, fs->fs_host);
|
||||
mp->am_ttl = clocktime(NULL);
|
||||
done = 1;
|
||||
@ -633,7 +614,7 @@ mount_auto_node(char *dir, opaque_t arg)
|
||||
am_node *mp = (am_node *) arg;
|
||||
am_node *new_mp;
|
||||
|
||||
new_mp = mp->am_mnt->mf_ops->lookup_child(mp, dir, &error, VLOOK_CREATE);
|
||||
new_mp = mp->am_al->al_mnt->mf_ops->lookup_child(mp, dir, &error, VLOOK_CREATE);
|
||||
if (new_mp && error < 0) {
|
||||
/*
|
||||
* We can't allow the fileid of the root node to change.
|
||||
@ -641,7 +622,7 @@ mount_auto_node(char *dir, opaque_t arg)
|
||||
*/
|
||||
new_mp->am_gen = new_mp->am_fattr.na_fileid = 1;
|
||||
|
||||
new_mp = mp->am_mnt->mf_ops->mount_child(new_mp, &error);
|
||||
(void) mp->am_al->al_mnt->mf_ops->mount_child(new_mp, &error);
|
||||
}
|
||||
|
||||
if (error > 0) {
|
||||
@ -672,7 +653,7 @@ mount_exported(void)
|
||||
void
|
||||
make_root_node(void)
|
||||
{
|
||||
mntfs *root_mnt;
|
||||
mntfs *root_mf;
|
||||
char *rootmap = ROOT_MAP;
|
||||
root_node = exported_ap_alloc();
|
||||
|
||||
@ -684,24 +665,24 @@ make_root_node(void)
|
||||
/*
|
||||
* Allocate a new mounted filesystem
|
||||
*/
|
||||
root_mnt = find_mntfs(&amfs_root_ops, (am_opts *) NULL, "", rootmap, "", "", "");
|
||||
root_mf = find_mntfs(&amfs_root_ops, (am_opts *) NULL, "", rootmap, "", "", "");
|
||||
|
||||
/*
|
||||
* Replace the initial null reference
|
||||
*/
|
||||
free_mntfs(root_node->am_mnt);
|
||||
root_node->am_mnt = root_mnt;
|
||||
free_mntfs(root_node->am_al->al_mnt);
|
||||
root_node->am_al->al_mnt = root_mf;
|
||||
|
||||
/*
|
||||
* Initialize the root
|
||||
*/
|
||||
if (root_mnt->mf_ops->fs_init)
|
||||
(*root_mnt->mf_ops->fs_init) (root_mnt);
|
||||
if (root_mf->mf_ops->fs_init)
|
||||
(*root_mf->mf_ops->fs_init) (root_mf);
|
||||
|
||||
/*
|
||||
* Mount the root
|
||||
*/
|
||||
root_mnt->mf_error = root_mnt->mf_ops->mount_fs(root_node, root_mnt);
|
||||
root_mf->mf_error = root_mf->mf_ops->mount_fs(root_node, root_mf);
|
||||
}
|
||||
|
||||
|
||||
@ -712,68 +693,81 @@ make_root_node(void)
|
||||
void
|
||||
umount_exported(void)
|
||||
{
|
||||
int i;
|
||||
int i, work_done;
|
||||
|
||||
for (i = last_used_map; i >= 0; --i) {
|
||||
am_node *mp = exported_ap[i];
|
||||
mntfs *mf;
|
||||
do {
|
||||
work_done = 0;
|
||||
|
||||
if (!mp)
|
||||
continue;
|
||||
for (i = last_used_map; i >= 0; --i) {
|
||||
am_node *mp = exported_ap[i];
|
||||
mntfs *mf;
|
||||
|
||||
mf = mp->am_mnt;
|
||||
if (mf->mf_flags & MFF_UNMOUNTING) {
|
||||
/*
|
||||
* If this node is being unmounted then just ignore it. However,
|
||||
* this could prevent amd from finishing if the unmount gets blocked
|
||||
* since the am_node will never be free'd. am_unmounted needs
|
||||
* telling about this possibility. - XXX
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(mf->mf_fsflags & FS_DIRECTORY))
|
||||
/*
|
||||
* When shutting down this had better
|
||||
* look like a directory, otherwise it
|
||||
* can't be unmounted!
|
||||
*/
|
||||
mk_fattr(&mp->am_fattr, NFDIR);
|
||||
|
||||
if ((--immediate_abort < 0 &&
|
||||
!(mp->am_flags & AMF_ROOT) && mp->am_parent) ||
|
||||
(mf->mf_flags & MFF_RESTART)) {
|
||||
if (!mp)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Just throw this node away without bothering to unmount it. If
|
||||
* the server is not known to be up then don't discard the mounted
|
||||
* on directory or Amd might hang...
|
||||
* Wait for children to be removed first
|
||||
*/
|
||||
if (mf->mf_server &&
|
||||
(mf->mf_server->fs_flags & (FSF_DOWN | FSF_VALID)) != FSF_VALID)
|
||||
mf->mf_flags &= ~MFF_MKMNT;
|
||||
if (gopt.flags & CFM_UNMOUNT_ON_EXIT || mp->am_flags & AMF_AUTOFS) {
|
||||
plog(XLOG_INFO, "on-exit attempt to unmount %s", mf->mf_mount);
|
||||
if (mp->am_child)
|
||||
continue;
|
||||
|
||||
mf = mp->am_al->al_mnt;
|
||||
if (mf->mf_flags & MFF_UNMOUNTING) {
|
||||
/*
|
||||
* use unmount_mp, not unmount_node, so that unmounts be
|
||||
* backgrounded as needed.
|
||||
* If this node is being unmounted then just ignore it. However,
|
||||
* this could prevent amd from finishing if the unmount gets blocked
|
||||
* since the am_node will never be free'd. am_unmounted needs
|
||||
* telling about this possibility. - XXX
|
||||
*/
|
||||
unmount_mp((opaque_t) mp);
|
||||
} else {
|
||||
am_unmounted(mp);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(mf->mf_fsflags & FS_DIRECTORY))
|
||||
/*
|
||||
* When shutting down this had better
|
||||
* look like a directory, otherwise it
|
||||
* can't be unmounted!
|
||||
*/
|
||||
mk_fattr(&mp->am_fattr, NFDIR);
|
||||
|
||||
if ((--immediate_abort < 0 &&
|
||||
!(mp->am_flags & AMF_ROOT) && mp->am_parent) ||
|
||||
(mf->mf_flags & MFF_RESTART)) {
|
||||
|
||||
work_done++;
|
||||
|
||||
/*
|
||||
* Just throw this node away without bothering to unmount it. If
|
||||
* the server is not known to be up then don't discard the mounted
|
||||
* on directory or Amd might hang...
|
||||
*/
|
||||
if (mf->mf_server &&
|
||||
(mf->mf_server->fs_flags & (FSF_DOWN | FSF_VALID)) != FSF_VALID)
|
||||
mf->mf_flags &= ~MFF_MKMNT;
|
||||
if (gopt.flags & CFM_UNMOUNT_ON_EXIT || mp->am_flags & AMF_AUTOFS) {
|
||||
plog(XLOG_INFO, "on-exit attempt to unmount %s", mf->mf_mount);
|
||||
/*
|
||||
* use unmount_mp, not unmount_node, so that unmounts be
|
||||
* backgrounded as needed.
|
||||
*/
|
||||
unmount_mp((opaque_t) mp);
|
||||
} else {
|
||||
am_unmounted(mp);
|
||||
}
|
||||
if (!(mf->mf_flags && (MFF_UNMOUNTING|MFF_MOUNTED)))
|
||||
exported_ap[i] = NULL;
|
||||
} else {
|
||||
/*
|
||||
* Any other node gets forcibly timed out.
|
||||
*/
|
||||
mp->am_flags &= ~AMF_NOTIMEOUT;
|
||||
mp->am_al->al_mnt->mf_flags &= ~MFF_RSTKEEP;
|
||||
mp->am_ttl = 0;
|
||||
mp->am_timeo = 1;
|
||||
mp->am_timeo_w = 0;
|
||||
}
|
||||
exported_ap[i] = NULL;
|
||||
} else {
|
||||
/*
|
||||
* Any other node gets forcibly timed out.
|
||||
*/
|
||||
mp->am_flags &= ~AMF_NOTIMEOUT;
|
||||
mp->am_mnt->mf_flags &= ~MFF_RSTKEEP;
|
||||
mp->am_ttl = 0;
|
||||
mp->am_timeo = 1;
|
||||
mp->am_timeo_w = 0;
|
||||
}
|
||||
}
|
||||
} while (work_done);
|
||||
}
|
||||
|
||||
|
||||
@ -787,7 +781,7 @@ int
|
||||
mount_node(opaque_t arg)
|
||||
{
|
||||
am_node *mp = (am_node *) arg;
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
int error = 0;
|
||||
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
@ -809,7 +803,7 @@ static int
|
||||
unmount_node(opaque_t arg)
|
||||
{
|
||||
am_node *mp = (am_node *) arg;
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
int error = 0;
|
||||
|
||||
if (mf->mf_flags & MFF_ERROR) {
|
||||
@ -830,7 +824,7 @@ unmount_node(opaque_t arg)
|
||||
}
|
||||
|
||||
/* do this again, it might have changed */
|
||||
mf = mp->am_mnt;
|
||||
mf = mp->am_al->al_mnt;
|
||||
if (error) {
|
||||
errno = error; /* XXX */
|
||||
dlog("%s: unmount: %m", mf->mf_mount);
|
||||
@ -844,7 +838,7 @@ static void
|
||||
free_map_if_success(int rc, int term, opaque_t arg)
|
||||
{
|
||||
am_node *mp = (am_node *) arg;
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
wchan_t wchan = get_mntfs_wchan(mf);
|
||||
|
||||
/*
|
||||
@ -884,10 +878,12 @@ free_map_if_success(int rc, int term, opaque_t arg)
|
||||
else
|
||||
plog(XLOG_ERROR, "%s: unmount: %s", mp->am_path, strerror(rc));
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
if (mf->mf_flags & MFF_IS_AUTOFS)
|
||||
autofs_get_mp(mp);
|
||||
if (mp->am_flags & AMF_AUTOFS)
|
||||
autofs_umount_failed(mp);
|
||||
if (rc != ENOENT) {
|
||||
if (mf->mf_flags & MFF_IS_AUTOFS)
|
||||
autofs_get_mp(mp);
|
||||
if (mp->am_flags & AMF_AUTOFS)
|
||||
autofs_umount_failed(mp);
|
||||
}
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
amd_stats.d_uerr++;
|
||||
} else {
|
||||
@ -908,11 +904,11 @@ int
|
||||
unmount_mp(am_node *mp)
|
||||
{
|
||||
int was_backgrounded = 0;
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
|
||||
#ifdef notdef
|
||||
plog(XLOG_INFO, "\"%s\" on %s timed out (flags 0x%x)",
|
||||
mp->am_path, mp->am_mnt->mf_mount, (int) mf->mf_flags);
|
||||
mp->am_path, mf->mf_mount, (int) mf->mf_flags);
|
||||
#endif /* notdef */
|
||||
|
||||
#ifndef MNT2_NFS_OPT_SYMTTL
|
||||
@ -948,7 +944,7 @@ unmount_mp(am_node *mp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
dlog("\"%s\" on %s timed out", mp->am_path, mp->am_mnt->mf_mount);
|
||||
dlog("\"%s\" on %s timed out", mp->am_path, mf->mf_mount);
|
||||
mf->mf_flags |= MFF_UNMOUNTING;
|
||||
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
@ -957,7 +953,8 @@ unmount_mp(am_node *mp)
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
|
||||
if ((mf->mf_fsflags & FS_UBACKGROUND) &&
|
||||
(mf->mf_flags & MFF_MOUNTED)) {
|
||||
(mf->mf_flags & MFF_MOUNTED) &&
|
||||
!(mf->mf_flags & MFF_ON_AUTOFS)) {
|
||||
dlog("Trying unmount in background");
|
||||
run_task(unmount_node, (opaque_t) mp,
|
||||
free_map_if_success, (opaque_t) mp);
|
||||
@ -995,7 +992,7 @@ timeout_mp(opaque_t v) /* argument not used?! */
|
||||
/*
|
||||
* Pick up mounted filesystem
|
||||
*/
|
||||
mf = mp->am_mnt;
|
||||
mf = mp->am_al->al_mnt;
|
||||
if (!mf)
|
||||
continue;
|
||||
|
||||
|
70
external/bsd/am-utils/dist/amd/mapc.c
vendored
70
external/bsd/am-utils/dist/amd/mapc.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: mapc.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: mapc.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -139,6 +135,7 @@ static const char *get_full_path(const char *map, const char *path, const char *
|
||||
static int mapc_meta_search(mnt_map *, char *, char **, int);
|
||||
static void mapc_sync(mnt_map *);
|
||||
static void mapc_clear(mnt_map *);
|
||||
static void mapc_clear_kvhash(kv **);
|
||||
|
||||
/* ROOT MAP */
|
||||
static int root_init(mnt_map *, char *, time_t *);
|
||||
@ -329,6 +326,7 @@ static map_type maptypes[] =
|
||||
MAPC_INC
|
||||
},
|
||||
#endif /* HAVE_MAP_EXEC */
|
||||
#ifdef notyet /* probe function needs to be there or SEGV */
|
||||
#ifdef HAVE_MAP_SUN
|
||||
{
|
||||
/* XXX: fill in */
|
||||
@ -341,6 +339,7 @@ static map_type maptypes[] =
|
||||
0
|
||||
},
|
||||
#endif /* HAVE_MAP_SUN */
|
||||
#endif
|
||||
{
|
||||
"error",
|
||||
error_init,
|
||||
@ -446,7 +445,7 @@ mapc_add_kv(mnt_map *m, char *key, char *val)
|
||||
* this entry is the key passed into this function.
|
||||
*/
|
||||
if ((tok = strtok(val, "\n")) != NULL) {
|
||||
mapc_add_kv(m, key, strdup(tok));
|
||||
mapc_add_kv(m, key, xstrdup(tok));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -461,7 +460,7 @@ mapc_add_kv(mnt_map *m, char *key, char *val)
|
||||
*entry++ = '\0';
|
||||
}
|
||||
|
||||
mapc_add_kv(m, strdup(key), strdup(entry));
|
||||
mapc_add_kv(m, xstrdup(key), xstrdup(entry));
|
||||
}
|
||||
|
||||
XFREE(val);
|
||||
@ -487,7 +486,8 @@ mapc_add_kv(mnt_map *m, char *key, char *val)
|
||||
plog(XLOG_USER, "error compiling RE \"%s\": %s", pattern, errstr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else
|
||||
memset(&re, 0, sizeof(re));
|
||||
#endif /* HAVE_REGEXEC */
|
||||
|
||||
h = &m->kvhash[hash];
|
||||
@ -499,6 +499,7 @@ mapc_add_kv(mnt_map *m, char *key, char *val)
|
||||
n->val = val;
|
||||
n->next = *h;
|
||||
*h = n;
|
||||
m->nentries++;
|
||||
}
|
||||
|
||||
|
||||
@ -576,7 +577,7 @@ static int
|
||||
mapc_reload_map(mnt_map *m)
|
||||
{
|
||||
int error, ret = 0;
|
||||
kv *maphash[NKVHASH], *tmphash[NKVHASH];
|
||||
kv *maphash[NKVHASH];
|
||||
time_t t;
|
||||
|
||||
error = (*m->mtime) (m, m->map_name, &t);
|
||||
@ -602,6 +603,7 @@ mapc_reload_map(mnt_map *m)
|
||||
memset((voidp) m->kvhash, 0, sizeof(m->kvhash));
|
||||
|
||||
dlog("calling map reload on %s", m->map_name);
|
||||
m->nentries = 0;
|
||||
error = (*m->reload) (m, m->map_name, mapc_add_kv);
|
||||
if (error) {
|
||||
if (m->reloads == 0)
|
||||
@ -617,14 +619,14 @@ mapc_reload_map(mnt_map *m)
|
||||
else
|
||||
plog(XLOG_INFO, "reload #%d of map %s succeeded",
|
||||
m->reloads, m->map_name);
|
||||
memcpy((voidp) tmphash, (voidp) m->kvhash, sizeof(m->kvhash));
|
||||
memcpy((voidp) m->kvhash, (voidp) maphash, sizeof(m->kvhash));
|
||||
mapc_clear(m);
|
||||
memcpy((voidp) m->kvhash, (voidp) tmphash, sizeof(m->kvhash));
|
||||
mapc_clear_kvhash(maphash);
|
||||
if (m->wildcard) {
|
||||
XFREE(m->wildcard);
|
||||
m->wildcard = NULL;
|
||||
}
|
||||
m->modify = t;
|
||||
ret = 1;
|
||||
}
|
||||
m->wildcard = NULL;
|
||||
|
||||
dlog("calling mapc_search for wildcard");
|
||||
error = mapc_search(m, wildcard, &m->wildcard);
|
||||
@ -688,6 +690,7 @@ mapc_create(char *map, char *opt, const char *type, const char *mntpt)
|
||||
/* assert: mt in maptypes */
|
||||
|
||||
m->flags = alloc & ~MAPC_CACHE_MASK;
|
||||
m->nentries = 0;
|
||||
alloc &= MAPC_CACHE_MASK;
|
||||
|
||||
if (alloc == MAPC_DFLT)
|
||||
@ -734,7 +737,7 @@ mapc_create(char *map, char *opt, const char *type, const char *mntpt)
|
||||
m->search = alloc >= MAPC_ALL ? error_search : mt->search;
|
||||
m->mtime = mt->mtime;
|
||||
memset((voidp) m->kvhash, 0, sizeof(m->kvhash));
|
||||
m->map_name = strdup(map);
|
||||
m->map_name = xstrdup(map);
|
||||
m->refc = 1;
|
||||
m->wildcard = NULL;
|
||||
m->reloads = 0;
|
||||
@ -751,10 +754,10 @@ mapc_create(char *map, char *opt, const char *type, const char *mntpt)
|
||||
|
||||
|
||||
/*
|
||||
* Free the cached data in a map
|
||||
* Free the cached data in a map hash
|
||||
*/
|
||||
static void
|
||||
mapc_clear(mnt_map *m)
|
||||
mapc_clear_kvhash(kv **kvhash)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -763,16 +766,25 @@ mapc_clear(mnt_map *m)
|
||||
* along free'ing the data.
|
||||
*/
|
||||
for (i = 0; i < NKVHASH; i++) {
|
||||
kv *k = m->kvhash[i];
|
||||
kv *k = kvhash[i];
|
||||
while (k) {
|
||||
kv *n = k->next;
|
||||
XFREE(k->key);
|
||||
if (k->val)
|
||||
XFREE(k->val);
|
||||
XFREE(k->val);
|
||||
XFREE(k);
|
||||
k = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Free the cached data in a map
|
||||
*/
|
||||
static void
|
||||
mapc_clear(mnt_map *m)
|
||||
{
|
||||
mapc_clear_kvhash(m->kvhash);
|
||||
|
||||
/*
|
||||
* Zero the hash slots
|
||||
@ -782,8 +794,10 @@ mapc_clear(mnt_map *m)
|
||||
/*
|
||||
* Free the wildcard if it exists
|
||||
*/
|
||||
if (m->wildcard)
|
||||
XFREE(m->wildcard);
|
||||
XFREE(m->wildcard);
|
||||
m->wildcard = NULL;
|
||||
|
||||
m->nentries = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -917,7 +931,7 @@ mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
|
||||
*/
|
||||
if (k) {
|
||||
if (k->val)
|
||||
*pval = strdup(k->val);
|
||||
*pval = xstrdup(k->val);
|
||||
else
|
||||
error = ENOENT;
|
||||
} else if (m->alloc >= MAPC_ALL) {
|
||||
@ -934,7 +948,7 @@ mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
|
||||
*/
|
||||
error = search_map(m, key, pval);
|
||||
if (!error && m->alloc == MAPC_INC)
|
||||
mapc_add_kv(m, strdup(key), strdup(*pval));
|
||||
mapc_add_kv(m, xstrdup(key), xstrdup(*pval));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -969,7 +983,7 @@ mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
|
||||
}
|
||||
|
||||
if (error > 0 && m->wildcard) {
|
||||
*pval = strdup(m->wildcard);
|
||||
*pval = xstrdup(m->wildcard);
|
||||
error = 0;
|
||||
}
|
||||
}
|
||||
@ -1125,7 +1139,7 @@ root_newmap(const char *dir, const char *opts, const char *map, const cf_map_t *
|
||||
else
|
||||
xstrlcpy(str, opts, sizeof(str));
|
||||
}
|
||||
mapc_repl_kv(root_map, strdup((char *)dir), strdup(str));
|
||||
mapc_repl_kv(root_map, xstrdup(dir), xstrdup(str));
|
||||
}
|
||||
|
||||
|
||||
|
94
external/bsd/am-utils/dist/amd/mntfs.c
vendored
94
external/bsd/am-utils/dist/amd/mntfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: mntfs.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: mntfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -54,6 +50,16 @@ qelem mfhead = {&mfhead, &mfhead};
|
||||
int mntfs_allocated;
|
||||
|
||||
|
||||
am_loc *
|
||||
dup_loc(am_loc *loc)
|
||||
{
|
||||
loc->al_refc++;
|
||||
if (loc->al_mnt) {
|
||||
dup_mntfs(loc->al_mnt);
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
|
||||
mntfs *
|
||||
dup_mntfs(mntfs *mf)
|
||||
{
|
||||
@ -73,12 +79,15 @@ init_mntfs(mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, char *auto
|
||||
{
|
||||
mf->mf_ops = ops;
|
||||
mf->mf_fsflags = ops->nfs_fs_flags;
|
||||
mf->mf_fo = mo;
|
||||
mf->mf_mount = strdup(mp);
|
||||
mf->mf_info = strdup(info);
|
||||
mf->mf_auto = strdup(auto_opts);
|
||||
mf->mf_mopts = strdup(mopts);
|
||||
mf->mf_remopts = strdup(remopts);
|
||||
mf->mf_fo = 0;
|
||||
if (mo)
|
||||
mf->mf_fo = copy_opts(mo);
|
||||
|
||||
mf->mf_mount = xstrdup(mp);
|
||||
mf->mf_info = xstrdup(info);
|
||||
mf->mf_auto = xstrdup(auto_opts);
|
||||
mf->mf_mopts = xstrdup(mopts);
|
||||
mf->mf_remopts = xstrdup(remopts);
|
||||
mf->mf_loopdev = NULL;
|
||||
mf->mf_refc = 1;
|
||||
mf->mf_flags = 0;
|
||||
@ -140,7 +149,7 @@ locate_mntfs(am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, ch
|
||||
}
|
||||
|
||||
dlog("mf->mf_flags = %#x", mf->mf_flags);
|
||||
mf->mf_fo = mo;
|
||||
|
||||
if ((mf->mf_flags & MFF_RESTART) && amd_state < Finishing) {
|
||||
/*
|
||||
* Restart a previously mounted filesystem.
|
||||
@ -207,23 +216,32 @@ new_mntfs(void)
|
||||
return alloc_mntfs(&amfs_error_ops, (am_opts *) NULL, "//nil//", ".", "", "", "");
|
||||
}
|
||||
|
||||
am_loc *
|
||||
new_loc(void)
|
||||
{
|
||||
am_loc *loc = CALLOC(struct am_loc);
|
||||
loc->al_fo = 0;
|
||||
loc->al_mnt = new_mntfs();
|
||||
loc->al_refc = 1;
|
||||
return loc;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
uninit_mntfs(mntfs *mf)
|
||||
{
|
||||
if (mf->mf_auto)
|
||||
XFREE(mf->mf_auto);
|
||||
if (mf->mf_mopts)
|
||||
XFREE(mf->mf_mopts);
|
||||
if (mf->mf_remopts)
|
||||
XFREE(mf->mf_remopts);
|
||||
if (mf->mf_info)
|
||||
XFREE(mf->mf_info);
|
||||
if (mf->mf_fo) {
|
||||
free_opts(mf->mf_fo);
|
||||
XFREE(mf->mf_fo);
|
||||
}
|
||||
XFREE(mf->mf_auto);
|
||||
XFREE(mf->mf_mopts);
|
||||
XFREE(mf->mf_remopts);
|
||||
XFREE(mf->mf_info);
|
||||
if (mf->mf_private && mf->mf_prfree)
|
||||
(*mf->mf_prfree) (mf->mf_private);
|
||||
|
||||
if (mf->mf_mount)
|
||||
XFREE(mf->mf_mount);
|
||||
XFREE(mf->mf_mount);
|
||||
|
||||
/*
|
||||
* Clean up the file server
|
||||
@ -257,6 +275,16 @@ discard_mntfs(voidp v)
|
||||
--mntfs_allocated;
|
||||
}
|
||||
|
||||
static void
|
||||
discard_loc(voidp v)
|
||||
{
|
||||
am_loc *loc = v;
|
||||
if (loc->al_fo) {
|
||||
free_opts(loc->al_fo);
|
||||
XFREE(loc->al_fo);
|
||||
}
|
||||
XFREE(loc);
|
||||
}
|
||||
|
||||
void
|
||||
flush_mntfs(void)
|
||||
@ -272,6 +300,23 @@ flush_mntfs(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
free_loc(opaque_t arg)
|
||||
{
|
||||
am_loc *loc = (am_loc *) arg;
|
||||
dlog("free_loc %p", loc);
|
||||
|
||||
if (loc->al_refc <= 0) {
|
||||
plog(XLOG_ERROR, "IGNORING free_loc for 0x%p", loc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (loc->al_mnt)
|
||||
free_mntfs(loc->al_mnt);
|
||||
if (--loc->al_refc == 0) {
|
||||
discard_loc(loc);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
free_mntfs(opaque_t arg)
|
||||
@ -358,7 +403,6 @@ realloc_mntfs(mntfs *mf, am_ops *ops, am_opts *mo, char *mp, char *info, char *a
|
||||
if (mf->mf_ops != &amfs_error_ops &&
|
||||
(mf->mf_flags & MFF_MOUNTED) &&
|
||||
!FSRV_ISDOWN(mf->mf_server)) {
|
||||
mf->mf_fo = mo;
|
||||
return mf;
|
||||
}
|
||||
|
||||
|
201
external/bsd/am-utils/dist/amd/nfs_prot_svc.c
vendored
201
external/bsd/am-utils/dist/amd/nfs_prot_svc.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: nfs_prot_svc.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: nfs_prot_svc.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -71,6 +67,7 @@ extern nfsstatfsres *nfsproc_statfs_2_svc(am_nfs_fh *, struct svc_req *);
|
||||
|
||||
/* global variables */
|
||||
SVCXPRT *current_transp;
|
||||
dispatcher_t nfs_dispatcher = nfs_program_2;
|
||||
|
||||
/* typedefs */
|
||||
typedef char *(*nfssvcproc_t)(voidp, struct svc_req *);
|
||||
@ -301,3 +298,193 @@ nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp)
|
||||
going_down(1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nfs_program_3(struct svc_req *rqstp, register SVCXPRT *transp)
|
||||
{
|
||||
union {
|
||||
am_GETATTR3args am_nfs3_getattr_3_arg;
|
||||
am_SETATTR3args am_nfs3_setattr_3_arg;
|
||||
am_LOOKUP3args am_nfs3_lookup_3_arg;
|
||||
am_ACCESS3args am_nfs3_access_3_arg;
|
||||
am_READLINK3args am_nfs3_readlink_3_arg;
|
||||
am_READ3args am_nfs3_read_3_arg;
|
||||
am_WRITE3args am_nfs3_write_3_arg;
|
||||
am_CREATE3args am_nfs3_create_3_arg;
|
||||
am_MKDIR3args am_nfs3_mkdir_3_arg;
|
||||
am_SYMLINK3args am_nfs3_symlink_3_arg;
|
||||
am_MKNOD3args am_nfs3_mknod_3_arg;
|
||||
am_REMOVE3args am_nfs3_remove_3_arg;
|
||||
am_RMDIR3args am_nfs3_rmdir_3_arg;
|
||||
am_RENAME3args am_nfs3_rename_3_arg;
|
||||
am_LINK3args am_nfs3_link_3_arg;
|
||||
am_READDIR3args am_nfs3_readdir_3_arg;
|
||||
am_READDIRPLUS3args am_nfs3_readdirplus_3_arg;
|
||||
am_FSSTAT3args am_nfs3_fsstat_3_arg;
|
||||
am_FSINFO3args am_nfs3_fsinfo_3_arg;
|
||||
am_PATHCONF3args am_nfs3_pathconf_3_arg;
|
||||
am_COMMIT3args am_nfs3_commit_3_arg;
|
||||
} argument;
|
||||
char *result;
|
||||
xdrproc_t _xdr_argument, _xdr_result;
|
||||
nfssvcproc_t local;
|
||||
|
||||
switch (rqstp->rq_proc) {
|
||||
case AM_NFS3_NULL:
|
||||
_xdr_argument = (xdrproc_t) xdr_void;
|
||||
_xdr_result = (xdrproc_t) xdr_void;
|
||||
local = (nfssvcproc_t) am_nfs3_null_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_GETATTR:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_GETATTR3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_GETATTR3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_getattr_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_SETATTR:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_SETATTR3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_SETATTR3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_setattr_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_LOOKUP:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_LOOKUP3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_LOOKUP3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_lookup_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_ACCESS:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_ACCESS3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_ACCESS3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_access_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_READLINK:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_READLINK3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_READLINK3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_readlink_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_READ:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_READ3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_READ3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_read_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_WRITE:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_WRITE3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_WRITE3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_write_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_CREATE:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_CREATE3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_CREATE3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_create_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_MKDIR:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_MKDIR3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_MKDIR3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_mkdir_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_SYMLINK:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_SYMLINK3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_SYMLINK3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_symlink_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_MKNOD:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_MKNOD3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_MKNOD3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_mknod_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_REMOVE:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_REMOVE3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_REMOVE3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_remove_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_RMDIR:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_RMDIR3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_RMDIR3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_rmdir_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_RENAME:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_RENAME3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_RENAME3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_rename_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_LINK:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_LINK3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_LINK3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_link_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_READDIR:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_READDIR3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_READDIR3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_readdir_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_READDIRPLUS:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_READDIRPLUS3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_READDIRPLUS3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_readdirplus_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_FSSTAT:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_FSSTAT3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_FSSTAT3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_fsstat_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_FSINFO:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_FSINFO3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_FSINFO3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_fsinfo_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_PATHCONF:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_PATHCONF3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_PATHCONF3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_pathconf_3_svc;
|
||||
break;
|
||||
|
||||
case AM_NFS3_COMMIT:
|
||||
_xdr_argument = (xdrproc_t) xdr_am_COMMIT3args;
|
||||
_xdr_result = (xdrproc_t) xdr_am_COMMIT3res;
|
||||
local = (nfssvcproc_t) (char *(*)(char *, struct svc_req *)) am_nfs3_commit_3_svc;
|
||||
break;
|
||||
|
||||
default:
|
||||
svcerr_noproc (transp);
|
||||
return;
|
||||
}
|
||||
|
||||
memset ((char *)&argument, 0, sizeof (argument));
|
||||
|
||||
if (!svc_getargs(transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
|
||||
plog(XLOG_ERROR,
|
||||
"NFS xdr decode failed for %d %d %d",
|
||||
(int) rqstp->rq_prog, (int) rqstp->rq_vers, (int) rqstp->rq_proc);
|
||||
svcerr_decode(transp);
|
||||
return;
|
||||
}
|
||||
|
||||
result = (*local) (&argument, rqstp);
|
||||
if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
|
||||
svcerr_systemerr (transp);
|
||||
}
|
||||
|
||||
if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
|
||||
plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program_3");
|
||||
going_down(1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
13
external/bsd/am-utils/dist/amd/nfs_start.c
vendored
13
external/bsd/am-utils/dist/amd/nfs_start.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: nfs_start.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: nfs_start.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -366,7 +362,8 @@ mount_automounter(int ppid)
|
||||
* already created the service during restart_automounter_nodes().
|
||||
*/
|
||||
if (nfs_port == 0) {
|
||||
ret = create_nfs_service(&soNFS, &nfs_port, &nfsxprt, nfs_program_2);
|
||||
ret = create_nfs_service(&soNFS, &nfs_port, &nfsxprt, nfs_dispatcher,
|
||||
get_nfs_dispatcher_version(nfs_dispatcher));
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
|
1170
external/bsd/am-utils/dist/amd/nfs_subr.c
vendored
1170
external/bsd/am-utils/dist/amd/nfs_subr.c
vendored
File diff suppressed because it is too large
Load Diff
14
external/bsd/am-utils/dist/amd/ops_TEMPLATE.c
vendored
14
external/bsd/am-utils/dist/amd/ops_TEMPLATE.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_TEMPLATE.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: ops_TEMPLATE.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -66,7 +62,7 @@ static int foofs_init(mntfs *mf);
|
||||
static int foofs_mount(am_node *mp, mntfs *mf);
|
||||
static int foofs_umount(am_node *mp, mntfs *mf);
|
||||
static am_node *foofs_lookuppn(am_node *mp, char *fname, int *error_return, int op);
|
||||
static int foofs_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count);
|
||||
static int foofs_readdir(am_node *mp, void cookie, voidp dp, voidp ep, u_int count);
|
||||
static am_node *foofs_readlink(am_node *mp, int *error_return);
|
||||
static void foofs_mounted(am_node *am, mntfs *mf);
|
||||
static void foofs_umounted(am_node *mp, mntfs *mf);
|
||||
@ -222,7 +218,7 @@ foofs_lookuppn(am_node *mp, char *fname, int *error_return, int op)
|
||||
* If OK, fills in ep with chain of directory entries.
|
||||
*/
|
||||
static int
|
||||
foofs_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count)
|
||||
foofs_readdir(am_node *mp, void cookie, voidp dp, voidp ep, u_int count)
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
|
14
external/bsd/am-utils/dist/amd/ops_cachefs.c
vendored
14
external/bsd/am-utils/dist/amd/ops_cachefs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_cachefs.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: ops_cachefs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -101,7 +97,7 @@ cachefs_match(am_opts *fo)
|
||||
dlog("CACHEFS: using cache directory \"%s\"", fo->opt_cachedir);
|
||||
|
||||
/* determine magic cookie to put in mtab */
|
||||
return strdup(fo->opt_cachedir);
|
||||
return xstrdup(fo->opt_cachedir);
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +112,7 @@ cachefs_init(mntfs *mf)
|
||||
* Save cache directory name
|
||||
*/
|
||||
if (!mf->mf_private) {
|
||||
mf->mf_private = (voidp) strdup(mf->mf_fo->opt_cachedir);
|
||||
mf->mf_private = (voidp) xstrdup(mf->mf_fo->opt_cachedir);
|
||||
mf->mf_prfree = (void (*)(voidp)) free;
|
||||
}
|
||||
|
||||
|
12
external/bsd/am-utils/dist/amd/ops_efs.c
vendored
12
external/bsd/am-utils/dist/amd/ops_efs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_efs.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: ops_efs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -100,7 +96,7 @@ efs_match(am_opts *fo)
|
||||
/*
|
||||
* Determine magic cookie to put in mtab
|
||||
*/
|
||||
return strdup(fo->opt_dev);
|
||||
return xstrdup(fo->opt_dev);
|
||||
}
|
||||
|
||||
|
||||
|
225
external/bsd/am-utils/dist/amd/ops_ext.c
vendored
Normal file
225
external/bsd/am-utils/dist/amd/ops_ext.c
vendored
Normal file
@ -0,0 +1,225 @@
|
||||
/* $NetBSD: ops_ext.c,v 1.1.1.1 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Jan-Simon Pendry at Imperial College, London.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* File: am-utils/amd/ops_ext.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Irix UN*X file system: EXT (Extended File System)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
#include <am_defs.h>
|
||||
#include <amd.h>
|
||||
|
||||
/* forward declarations */
|
||||
static char *ext_match(am_opts *fo);
|
||||
static int ext2_mount(am_node *am, mntfs *mf);
|
||||
static int ext3_mount(am_node *am, mntfs *mf);
|
||||
static int ext4_mount(am_node *am, mntfs *mf);
|
||||
static int ext_umount(am_node *am, mntfs *mf);
|
||||
|
||||
/*
|
||||
* Ops structure
|
||||
*/
|
||||
am_ops ext2_ops =
|
||||
{
|
||||
"ext2",
|
||||
ext_match,
|
||||
0, /* ext_init */
|
||||
ext2_mount,
|
||||
ext_umount,
|
||||
amfs_error_lookup_child,
|
||||
amfs_error_mount_child,
|
||||
amfs_error_readdir,
|
||||
0, /* ext_readlink */
|
||||
0, /* ext_mounted */
|
||||
0, /* ext_umounted */
|
||||
amfs_generic_find_srvr,
|
||||
0, /* ext_get_wchan */
|
||||
FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
AUTOFS_EXT_FS_FLAGS,
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
};
|
||||
|
||||
am_ops ext3_ops =
|
||||
{
|
||||
"ext3",
|
||||
ext_match,
|
||||
0, /* ext_init */
|
||||
ext3_mount,
|
||||
ext_umount,
|
||||
amfs_error_lookup_child,
|
||||
amfs_error_mount_child,
|
||||
amfs_error_readdir,
|
||||
0, /* ext_readlink */
|
||||
0, /* ext_mounted */
|
||||
0, /* ext_umounted */
|
||||
amfs_generic_find_srvr,
|
||||
0, /* ext_get_wchan */
|
||||
FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
AUTOFS_EXT_FS_FLAGS,
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
};
|
||||
|
||||
am_ops ext4_ops =
|
||||
{
|
||||
"ext4",
|
||||
ext_match,
|
||||
0, /* ext_init */
|
||||
ext4_mount,
|
||||
ext_umount,
|
||||
amfs_error_lookup_child,
|
||||
amfs_error_mount_child,
|
||||
amfs_error_readdir,
|
||||
0, /* ext_readlink */
|
||||
0, /* ext_mounted */
|
||||
0, /* ext_umounted */
|
||||
amfs_generic_find_srvr,
|
||||
0, /* ext_get_wchan */
|
||||
FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
AUTOFS_EXT_FS_FLAGS,
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
};
|
||||
|
||||
/*
|
||||
* EXT needs local filesystem and device.
|
||||
*/
|
||||
static char *
|
||||
ext_match(am_opts *fo)
|
||||
{
|
||||
|
||||
if (!fo->opt_dev) {
|
||||
plog(XLOG_USER, "ext: no device specified");
|
||||
return 0;
|
||||
}
|
||||
|
||||
dlog("EXT: mounting device \"%s\" on \"%s\"", fo->opt_dev, fo->opt_fs);
|
||||
|
||||
/*
|
||||
* Determine magic cookie to put in mtab
|
||||
*/
|
||||
return xstrdup(fo->opt_dev);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
mount_ext(char *mntdir, char *fs_name, char *opts, int on_autofs, char *
|
||||
mount_type, const char *mnttab_type)
|
||||
{
|
||||
ext_args_t ext_args;
|
||||
mntent_t mnt;
|
||||
int flags;
|
||||
|
||||
/*
|
||||
* Figure out the name of the file system type.
|
||||
*/
|
||||
MTYPE_TYPE type = mount_type;
|
||||
|
||||
memset((voidp) &ext_args, 0, sizeof(ext_args)); /* Paranoid */
|
||||
|
||||
/*
|
||||
* Fill in the mount structure
|
||||
*/
|
||||
memset((voidp) &mnt, 0, sizeof(mnt));
|
||||
mnt.mnt_dir = mntdir;
|
||||
mnt.mnt_fsname = fs_name;
|
||||
mnt.mnt_type = mnttab_type;
|
||||
mnt.mnt_opts = opts;
|
||||
|
||||
flags = compute_mount_flags(&mnt);
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
if (on_autofs)
|
||||
flags |= autofs_compute_mount_flags(&mnt);
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
|
||||
/*
|
||||
* Call generic mount routine
|
||||
*/
|
||||
return mount_fs(&mnt, flags, (caddr_t) &ext_args, 0, type, 0, NULL, mnttab_file_name, on_autofs);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ext_mount(am_node *am, mntfs *mf, char *mount_type,
|
||||
const char *mnttab_type)
|
||||
{
|
||||
int on_autofs = mf->mf_flags & MFF_ON_AUTOFS;
|
||||
int error;
|
||||
|
||||
error = mount_ext(mf->mf_mount, mf->mf_info, mf->mf_mopts, on_autofs,
|
||||
mount_type, mnttab_type);
|
||||
if (error) {
|
||||
errno = error;
|
||||
plog(XLOG_ERROR, "mount_ext: %m");
|
||||
return error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ext2_mount(am_node *am, mntfs *mf)
|
||||
{
|
||||
return ext_mount(am, mf, MOUNT_TYPE_EXT2, MNTTAB_TYPE_EXT2);
|
||||
}
|
||||
|
||||
static int
|
||||
ext3_mount(am_node *am, mntfs *mf)
|
||||
{
|
||||
return ext_mount(am, mf, MOUNT_TYPE_EXT3, MNTTAB_TYPE_EXT3);
|
||||
}
|
||||
|
||||
static int
|
||||
ext4_mount(am_node *am, mntfs *mf)
|
||||
{
|
||||
return ext_mount(am, mf, MOUNT_TYPE_EXT4, MNTTAB_TYPE_EXT4);
|
||||
}
|
||||
|
||||
static int
|
||||
ext_umount(am_node *am, mntfs *mf)
|
||||
{
|
||||
int unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0;
|
||||
|
||||
return UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags);
|
||||
}
|
12
external/bsd/am-utils/dist/amd/ops_lofs.c
vendored
12
external/bsd/am-utils/dist/amd/ops_lofs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_lofs.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: ops_lofs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -99,7 +95,7 @@ lofs_match(am_opts *fo)
|
||||
/*
|
||||
* Determine magic cookie to put in mtab
|
||||
*/
|
||||
return strdup(fo->opt_rfs);
|
||||
return xstrdup(fo->opt_rfs);
|
||||
}
|
||||
|
||||
|
||||
|
205
external/bsd/am-utils/dist/amd/ops_lustre.c
vendored
Normal file
205
external/bsd/am-utils/dist/amd/ops_lustre.c
vendored
Normal file
@ -0,0 +1,205 @@
|
||||
/* $NetBSD: ops_lustre.c,v 1.1.1.1 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Christos Zoulas
|
||||
* 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* File: am-utils/amd/ops_lustre.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Lustre file system
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
#ifdef HAVE_FS_LUSTRE
|
||||
#include <am_defs.h>
|
||||
#include <amd.h>
|
||||
|
||||
/* forward declarations */
|
||||
static char *lustre_match(am_opts *fo);
|
||||
static int lustre_mount(am_node *am, mntfs *mf);
|
||||
static int lustre_umount(am_node *am, mntfs *mf);
|
||||
|
||||
/*
|
||||
* Ops structure
|
||||
*/
|
||||
am_ops lustre_ops =
|
||||
{
|
||||
"lustre",
|
||||
lustre_match,
|
||||
0, /* lustre_init */
|
||||
lustre_mount,
|
||||
lustre_umount,
|
||||
amfs_error_lookup_child,
|
||||
amfs_error_mount_child,
|
||||
amfs_error_readdir,
|
||||
0, /* lustre_readlink */
|
||||
0, /* lustre_mounted */
|
||||
0, /* lustre_umounted */
|
||||
amfs_generic_find_srvr,
|
||||
0, /* lustre_get_wchan */
|
||||
FS_MKMNT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
AUTOFS_LUSTRE_FS_FLAGS,
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Lustre needs remote filesystem and host.
|
||||
*/
|
||||
static char *
|
||||
lustre_match(am_opts *fo)
|
||||
{
|
||||
char *xmtab, *cp;
|
||||
size_t l;
|
||||
char *rhost, *ptr, *remhost;
|
||||
struct in_addr addr;
|
||||
|
||||
if (fo->opt_fs && !fo->opt_rfs)
|
||||
fo->opt_rfs = fo->opt_fs;
|
||||
if (!fo->opt_rfs) {
|
||||
plog(XLOG_USER, "lustre: no remote filesystem specified");
|
||||
return NULL;
|
||||
}
|
||||
if (!fo->opt_rhost) {
|
||||
plog(XLOG_USER, "lustre: no remote host specified");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine magic cookie to put in mtab
|
||||
*/
|
||||
rhost = xstrdup(fo->opt_rhost);
|
||||
remhost = NULL;
|
||||
for (ptr = strtok(rhost, ":"); ptr; ptr = strtok(NULL, ":")) {
|
||||
char *at = strchr(ptr, '@');
|
||||
if (at == NULL) {
|
||||
plog(XLOG_USER, "lustre: missing protocol in host `%s'", ptr);
|
||||
XFREE(rhost);
|
||||
return NULL;
|
||||
}
|
||||
*at = '\0';
|
||||
/*
|
||||
* Convert symbolic addresses to numbers that the kernel likes
|
||||
*/
|
||||
if (inet_aton(ptr, &addr) == 0) {
|
||||
struct hostent *hp;
|
||||
if ((hp = gethostbyname(ptr)) == NULL) {
|
||||
plog(XLOG_USER, "lustre: unknown host `%s'", ptr);
|
||||
XFREE(rhost);
|
||||
return NULL;
|
||||
}
|
||||
if (hp->h_length != sizeof(addr.s_addr)) {
|
||||
plog(XLOG_USER, "lustre: bad address length %zu != %d for %s",
|
||||
sizeof(addr), hp->h_length, ptr);
|
||||
XFREE(rhost);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(&addr.s_addr, hp->h_addr, sizeof(addr));
|
||||
}
|
||||
*at = '@';
|
||||
|
||||
cp = remhost;
|
||||
if (remhost)
|
||||
remhost = strvcat(cp, ":", inet_ntoa(addr), at, NULL);
|
||||
else
|
||||
remhost = strvcat(inet_ntoa(addr), at, NULL);
|
||||
XFREE(cp);
|
||||
}
|
||||
if (remhost == NULL) {
|
||||
plog(XLOG_USER, "lustre: empty host");
|
||||
XFREE(rhost);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XFREE(rhost);
|
||||
XFREE(fo->opt_rhost);
|
||||
fo->opt_rhost = remhost;
|
||||
|
||||
l = strlen(fo->opt_rhost) + strlen(fo->opt_rfs) + 2;
|
||||
xmtab = xmalloc(l);
|
||||
xsnprintf(xmtab, l, "%s:%s", fo->opt_rhost, fo->opt_rfs);
|
||||
dlog("lustre: mounting remote server \"%s\", remote fs \"%s\" on \"%s\"",
|
||||
fo->opt_rhost, fo->opt_rfs, fo->opt_fs);
|
||||
|
||||
|
||||
return xmtab;
|
||||
}
|
||||
|
||||
static int
|
||||
lustre_mount(am_node *am, mntfs *mf)
|
||||
{
|
||||
mntent_t mnt;
|
||||
int genflags, error;
|
||||
int on_autofs = mf->mf_flags & MFF_ON_AUTOFS;
|
||||
|
||||
/*
|
||||
* Figure out the name of the file system type.
|
||||
*/
|
||||
MTYPE_TYPE type = MOUNT_TYPE_LUSTRE;
|
||||
|
||||
/*
|
||||
* Fill in the mount structure
|
||||
*/
|
||||
memset(&mnt, 0, sizeof(mnt));
|
||||
mnt.mnt_dir = mf->mf_mount;
|
||||
mnt.mnt_fsname = mf->mf_info;
|
||||
mnt.mnt_type = MNTTAB_TYPE_LUSTRE;
|
||||
mnt.mnt_opts = mf->mf_mopts;
|
||||
|
||||
genflags = compute_mount_flags(&mnt);
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
if (on_autofs)
|
||||
genflags |= autofs_compute_mount_flags(&mnt);
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
|
||||
/*
|
||||
* Call generic mount routine
|
||||
*/
|
||||
error = mount_fs(&mnt, genflags, NULL, 0, type, 0,
|
||||
NULL, mnttab_file_name, on_autofs);
|
||||
if (error) {
|
||||
errno = error;
|
||||
plog(XLOG_ERROR, "mount_lustre: %m");
|
||||
return error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
lustre_umount(am_node *am, mntfs *mf)
|
||||
{
|
||||
int unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0;
|
||||
|
||||
return UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags);
|
||||
}
|
||||
#endif
|
10
external/bsd/am-utils/dist/amd/ops_mfs.c
vendored
10
external/bsd/am-utils/dist/amd/ops_mfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_mfs.c,v 1.1.1.2 2009/03/20 20:26:49 christos Exp $ */
|
||||
/* $NetBSD: ops_mfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
130
external/bsd/am-utils/dist/amd/ops_nfs.c
vendored
130
external/bsd/am-utils/dist/amd/ops_nfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_nfs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_nfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -115,6 +111,13 @@ static int call_mountd(fh_cache *fp, u_long proc, fwd_fun f, wchan_t wchan);
|
||||
static int webnfs_lookup(fh_cache *fp, fwd_fun f, wchan_t wchan);
|
||||
static int fh_id = 0;
|
||||
|
||||
/*
|
||||
* clamp the filehandle version to 3, so that we can fail back to nfsv3
|
||||
* since nfsv4 does not have file handles
|
||||
*/
|
||||
#define SET_FH_VERSION(fs) \
|
||||
(fs)->fs_version > NFS_VERSION3 ? NFS_VERSION3 : (fs)->fs_version;
|
||||
|
||||
/* globals */
|
||||
AUTH *nfs_auth;
|
||||
qelem fh_head = {&fh_head, &fh_head};
|
||||
@ -203,6 +206,10 @@ got_nfs_fh_mount(voidp pkt, int len, struct sockaddr_in *sa, struct sockaddr_in
|
||||
memmove(fp->fh_nfs_handle.v3.am_fh3_data,
|
||||
res3.mountres3_u.mountinfo.fhandle.fhandle3_val,
|
||||
fp->fh_nfs_handle.v3.am_fh3_length);
|
||||
|
||||
XFREE(res3.mountres3_u.mountinfo.fhandle.fhandle3_val);
|
||||
if (res3.mountres3_u.mountinfo.auth_flavors.auth_flavors_val)
|
||||
XFREE(res3.mountres3_u.mountinfo.auth_flavors.auth_flavors_val);
|
||||
} else {
|
||||
#endif /* HAVE_FS_NFS3 */
|
||||
memset(&res, 0, sizeof(res));
|
||||
@ -328,8 +335,7 @@ discard_fh(opaque_t arg)
|
||||
dlog("Discarding filehandle for %s:%s", fp->fh_fs->fs_host, fp->fh_path);
|
||||
free_srvr(fp->fh_fs);
|
||||
}
|
||||
if (fp->fh_path)
|
||||
XFREE(fp->fh_path);
|
||||
XFREE(fp->fh_path);
|
||||
XFREE(fp);
|
||||
}
|
||||
|
||||
@ -468,11 +474,11 @@ prime_nfs_fhandle_cache(char *path, fserver *fs, am_nfs_handle_t *fhbuf, mntfs *
|
||||
fp->fh_sin = *fs->fs_ip;
|
||||
if (!(mf->mf_flags & MFF_WEBNFS))
|
||||
fp->fh_sin.sin_port = 0;
|
||||
fp->fh_nfs_version = fs->fs_version;
|
||||
fp->fh_nfs_version = SET_FH_VERSION(fs);
|
||||
}
|
||||
|
||||
fp->fh_fs = dup_srvr(fs);
|
||||
fp->fh_path = strdup(path);
|
||||
fp->fh_path = xstrdup(path);
|
||||
|
||||
if (mf->mf_flags & MFF_WEBNFS)
|
||||
error = webnfs_lookup(fp, got_nfs_fh_webnfs, get_mntfs_wchan(mf));
|
||||
@ -546,7 +552,9 @@ call_mountd(fh_cache *fp, u_long proc, fwd_fun fun, wchan_t wchan)
|
||||
if (error)
|
||||
return error;
|
||||
fp->fh_sin.sin_port = mountd_port;
|
||||
}
|
||||
dlog("%s: New %d mountd port", __func__, fp->fh_sin.sin_port);
|
||||
} else
|
||||
dlog("%s: Already had %d mountd port", __func__, fp->fh_sin.sin_port);
|
||||
|
||||
/* find the right version of the mount protocol */
|
||||
#ifdef HAVE_FS_NFS3
|
||||
@ -726,6 +734,17 @@ nfs_init(mntfs *mf)
|
||||
am_nfs_handle_t fhs;
|
||||
char *colon;
|
||||
|
||||
#ifdef NO_FALLBACK
|
||||
/*
|
||||
* We don't need file handles for NFS version 4, but we can fall back to
|
||||
* version 3, so we allocate anyway
|
||||
*/
|
||||
#ifdef HAVE_FS_NFS4
|
||||
if (mf->mf_server->fs_version == NFS_VERSION4)
|
||||
return 0;
|
||||
#endif /* HAVE_FS_NFS4 */
|
||||
#endif /* NO_FALLBACK */
|
||||
|
||||
if (mf->mf_private) {
|
||||
if (mf->mf_flags & MFF_NFS_SCALEDOWN) {
|
||||
fserver *fs;
|
||||
@ -734,6 +753,9 @@ nfs_init(mntfs *mf)
|
||||
mf->mf_ops->umounted(mf);
|
||||
|
||||
mf->mf_prfree(mf->mf_private);
|
||||
mf->mf_private = NULL;
|
||||
mf->mf_prfree = NULL;
|
||||
|
||||
fs = mf->mf_ops->ffserver(mf);
|
||||
free_srvr(mf->mf_server);
|
||||
mf->mf_server = fs;
|
||||
@ -771,7 +793,11 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
|
||||
int retry;
|
||||
int proto = AMU_TYPE_NONE;
|
||||
mntent_t mnt;
|
||||
void *argsp;
|
||||
nfs_args_t nfs_args;
|
||||
#ifdef HAVE_FS_NFS4
|
||||
nfs4_args_t nfs4_args;
|
||||
#endif /* HAVE_FS_NFS4 */
|
||||
|
||||
/*
|
||||
* Extract HOST name to give to kernel.
|
||||
@ -831,10 +857,7 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
|
||||
/*
|
||||
* Set mount types accordingly
|
||||
*/
|
||||
#ifndef HAVE_FS_NFS3
|
||||
type = MOUNT_TYPE_NFS;
|
||||
mnt.mnt_type = MNTTAB_TYPE_NFS;
|
||||
#else /* HAVE_FS_NFS3 */
|
||||
#ifdef HAVE_FS_NFS3
|
||||
if (nfs_version == NFS_VERSION3) {
|
||||
type = MOUNT_TYPE_NFS3;
|
||||
/*
|
||||
@ -845,16 +868,25 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
|
||||
* So on those systems, set it to "nfs".
|
||||
* Note: MNTTAB_OPT_VERS is always set for NFS3 (see am_compat.h).
|
||||
*/
|
||||
argsp = &nfs_args;
|
||||
# if defined(MNTTAB_OPT_VERS) && defined(MOUNT_TABLE_ON_FILE)
|
||||
mnt.mnt_type = MNTTAB_TYPE_NFS;
|
||||
# else /* defined(MNTTAB_OPT_VERS) && defined(MOUNT_TABLE_ON_FILE) */
|
||||
mnt.mnt_type = MNTTAB_TYPE_NFS3;
|
||||
# endif /* defined(MNTTAB_OPT_VERS) && defined(MOUNT_TABLE_ON_FILE) */
|
||||
} else {
|
||||
# ifdef HAVE_FS_NFS4
|
||||
} else if (nfs_version == NFS_VERSION4) {
|
||||
argsp = &nfs4_args;
|
||||
type = MOUNT_TYPE_NFS4;
|
||||
mnt.mnt_type = MNTTAB_TYPE_NFS4;
|
||||
# endif /* HAVE_FS_NFS4 */
|
||||
} else
|
||||
#endif /* HAVE_FS_NFS3 */
|
||||
{
|
||||
argsp = &nfs_args;
|
||||
type = MOUNT_TYPE_NFS;
|
||||
mnt.mnt_type = MNTTAB_TYPE_NFS;
|
||||
}
|
||||
#endif /* HAVE_FS_NFS3 */
|
||||
plog(XLOG_INFO, "mount_nfs_fh: NFS version %d", (int) nfs_version);
|
||||
plog(XLOG_INFO, "mount_nfs_fh: using NFS transport %s", nfs_proto);
|
||||
|
||||
@ -868,32 +900,44 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *mntdir, char *fs_name, mntfs *mf)
|
||||
genflags |= autofs_compute_mount_flags(&mnt);
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
|
||||
/* setup the many fields and flags within nfs_args */
|
||||
compute_nfs_args(&nfs_args,
|
||||
&mnt,
|
||||
genflags,
|
||||
NULL, /* struct netconfig *nfsncp */
|
||||
fs->fs_ip,
|
||||
nfs_version,
|
||||
nfs_proto,
|
||||
fhp,
|
||||
host,
|
||||
fs_name);
|
||||
/* setup the many fields and flags within nfs_args */
|
||||
compute_nfs_args(argsp,
|
||||
&mnt,
|
||||
genflags,
|
||||
NULL, /* struct netconfig *nfsncp */
|
||||
fs->fs_ip,
|
||||
nfs_version,
|
||||
nfs_proto,
|
||||
fhp,
|
||||
host,
|
||||
fs_name);
|
||||
|
||||
/* finally call the mounting function */
|
||||
if (amuDebug(D_TRACE)) {
|
||||
print_nfs_args(&nfs_args, nfs_version);
|
||||
print_nfs_args(argsp, nfs_version);
|
||||
plog(XLOG_DEBUG, "Generic mount flags 0x%x used for NFS mount", genflags);
|
||||
}
|
||||
error = mount_fs(&mnt, genflags, (caddr_t) &nfs_args, retry, type,
|
||||
nfs_version, nfs_proto, mnttab_file_name, on_autofs);
|
||||
XFREE(xopts);
|
||||
error = mount_fs(&mnt, genflags, argsp, retry, type,
|
||||
nfs_version, nfs_proto, mnttab_file_name, on_autofs);
|
||||
XFREE(mnt.mnt_opts);
|
||||
discard_nfs_args(argsp, nfs_version);
|
||||
|
||||
#ifdef HAVE_TRANSPORT_TYPE_TLI
|
||||
free_knetconfig(nfs_args.knconf);
|
||||
if (nfs_args.addr)
|
||||
XFREE(nfs_args.addr); /* allocated in compute_nfs_args() */
|
||||
#endif /* HAVE_TRANSPORT_TYPE_TLI */
|
||||
#ifdef HAVE_FS_NFS4
|
||||
# ifndef NO_FALLBACK
|
||||
/*
|
||||
* If we are using a v4 file handle, we try a v3 if we get back:
|
||||
* ENOENT: NFS v4 has a different export list than v3
|
||||
* EPERM: Kernels <= 2.6.18 return that, instead of ENOENT
|
||||
*/
|
||||
if ((error == ENOENT || error == EPERM) && nfs_version == NFS_VERSION4) {
|
||||
plog(XLOG_DEBUG, "Could not find NFS 4 mount, trying again with NFS 3");
|
||||
fs->fs_version = NFS_VERSION3;
|
||||
error = mount_nfs_fh(fhp, mntdir, fs_name, mf);
|
||||
if (error)
|
||||
fs->fs_version = NFS_VERSION4;
|
||||
}
|
||||
# endif /* NO_FALLBACK */
|
||||
#endif /* HAVE_FS_NFS4 */
|
||||
|
||||
return error;
|
||||
}
|
||||
@ -905,11 +949,16 @@ nfs_mount(am_node *am, mntfs *mf)
|
||||
int error = 0;
|
||||
mntent_t mnt;
|
||||
|
||||
if (!mf->mf_private) {
|
||||
if (!mf->mf_private && mf->mf_server->fs_version != 4) {
|
||||
plog(XLOG_ERROR, "Missing filehandle for %s", mf->mf_info);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (mf->mf_mopts == NULL) {
|
||||
plog(XLOG_ERROR, "Missing mount options for %s", mf->mf_info);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
mnt.mnt_opts = mf->mf_mopts;
|
||||
if (amu_hasmntopt(&mnt, "softlookup") ||
|
||||
(amu_hasmntopt(&mnt, "soft") && !amu_hasmntopt(&mnt, "nosoftlookup")))
|
||||
@ -934,6 +983,7 @@ nfs_umount(am_node *am, mntfs *mf)
|
||||
{
|
||||
int unmount_flags, new_unmount_flags, error;
|
||||
|
||||
dlog("attempting nfs umount");
|
||||
unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0;
|
||||
error = UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags);
|
||||
|
||||
@ -1033,7 +1083,7 @@ nfs_umounted(mntfs *mf)
|
||||
f.fh_path = path;
|
||||
f.fh_sin = *fs->fs_ip;
|
||||
f.fh_sin.sin_port = (u_short) 0;
|
||||
f.fh_nfs_version = fs->fs_version;
|
||||
f.fh_nfs_version = SET_FH_VERSION(fs);
|
||||
f.fh_fs = fs;
|
||||
f.fh_id = 0;
|
||||
f.fh_error = 0;
|
||||
|
10
external/bsd/am-utils/dist/amd/ops_nfs3.c
vendored
10
external/bsd/am-utils/dist/amd/ops_nfs3.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_nfs3.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_nfs3.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
52
external/bsd/am-utils/dist/amd/ops_nfs4.c
vendored
Normal file
52
external/bsd/am-utils/dist/amd/ops_nfs4.c
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
/* $NetBSD: ops_nfs4.c,v 1.1.1.1 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Jan-Simon Pendry at Imperial College, London.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* File: am-utils/amd/ops_nfs4.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Network file system version 4.0
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
#include <am_defs.h>
|
||||
#include <amd.h>
|
||||
|
||||
/* FEEL FREE TO IMPLEMENT THIS... :-) */
|
10
external/bsd/am-utils/dist/amd/ops_nullfs.c
vendored
10
external/bsd/am-utils/dist/amd/ops_nullfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_nullfs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_nullfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
12
external/bsd/am-utils/dist/amd/ops_pcfs.c
vendored
12
external/bsd/am-utils/dist/amd/ops_pcfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_pcfs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_pcfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -99,7 +95,7 @@ pcfs_match(am_opts *fo)
|
||||
/*
|
||||
* Determine magic cookie to put in mtab
|
||||
*/
|
||||
return strdup(fo->opt_dev);
|
||||
return xstrdup(fo->opt_dev);
|
||||
}
|
||||
|
||||
|
||||
|
10
external/bsd/am-utils/dist/amd/ops_tfs.c
vendored
10
external/bsd/am-utils/dist/amd/ops_tfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_tfs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_tfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
14
external/bsd/am-utils/dist/amd/ops_tmpfs.c
vendored
14
external/bsd/am-utils/dist/amd/ops_tmpfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_tmpfs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_tmpfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -77,7 +73,7 @@ am_ops tmpfs_ops =
|
||||
amfs_generic_find_srvr,
|
||||
0, /* tmpfs_get_wchan */
|
||||
FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
|
||||
#ifdef HAVE_FS_AUTOFS
|
||||
#if defined(HAVE_FS_AUTOFS) && defined(AUTOFS_TMPFS_FS_FLAGS)
|
||||
AUTOFS_TMPFS_FS_FLAGS,
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
};
|
||||
@ -100,7 +96,7 @@ tmpfs_match(am_opts *fo)
|
||||
/*
|
||||
* Determine magic cookie to put in mtab
|
||||
*/
|
||||
return strdup(fo->opt_dev);
|
||||
return xstrdup(fo->opt_dev);
|
||||
}
|
||||
|
||||
|
||||
|
12
external/bsd/am-utils/dist/amd/ops_udf.c
vendored
12
external/bsd/am-utils/dist/amd/ops_udf.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_udf.c,v 1.1.1.1 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_udf.c,v 1.1.1.2 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -138,7 +134,7 @@ udf_match(am_opts *fo)
|
||||
/*
|
||||
* Determine magic cookie to put in mtab
|
||||
*/
|
||||
return strdup(fo->opt_dev);
|
||||
return xstrdup(fo->opt_dev);
|
||||
}
|
||||
|
||||
static int
|
||||
|
12
external/bsd/am-utils/dist/amd/ops_ufs.c
vendored
12
external/bsd/am-utils/dist/amd/ops_ufs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_ufs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_ufs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -104,7 +100,7 @@ ufs_match(am_opts *fo)
|
||||
/*
|
||||
* Determine magic cookie to put in mtab
|
||||
*/
|
||||
return strdup(fo->opt_dev);
|
||||
return xstrdup(fo->opt_dev);
|
||||
}
|
||||
|
||||
|
||||
|
10
external/bsd/am-utils/dist/amd/ops_umapfs.c
vendored
10
external/bsd/am-utils/dist/amd/ops_umapfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_umapfs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_umapfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
10
external/bsd/am-utils/dist/amd/ops_unionfs.c
vendored
10
external/bsd/am-utils/dist/amd/ops_unionfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_unionfs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_unionfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
12
external/bsd/am-utils/dist/amd/ops_xfs.c
vendored
12
external/bsd/am-utils/dist/amd/ops_xfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ops_xfs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: ops_xfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -100,7 +96,7 @@ xfs_match(am_opts *fo)
|
||||
/*
|
||||
* Determine magic cookie to put in mtab
|
||||
*/
|
||||
return strdup(fo->opt_dev);
|
||||
return xstrdup(fo->opt_dev);
|
||||
}
|
||||
|
||||
|
||||
|
65
external/bsd/am-utils/dist/amd/opts.c
vendored
65
external/bsd/am-utils/dist/amd/opts.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: opts.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: opts.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -541,7 +537,7 @@ eval_selectors(char *opts, char *mapkey)
|
||||
char *f;
|
||||
int ret = 0;
|
||||
|
||||
o = old_o = strdup(opts);
|
||||
o = old_o = xstrdup(opts);
|
||||
|
||||
/*
|
||||
* For each user-specified option
|
||||
@ -572,7 +568,7 @@ eval_selectors(char *opts, char *mapkey)
|
||||
/* null-terminate the argument */
|
||||
*arg++ = '\0';
|
||||
fx = strchr(arg, ')');
|
||||
if (!arg || fx == arg) {
|
||||
if (fx == NULL || fx == arg) {
|
||||
plog(XLOG_USER, "key %s: Malformed function in \"%s\"", mapkey, f);
|
||||
continue;
|
||||
}
|
||||
@ -608,8 +604,10 @@ eval_selectors(char *opts, char *mapkey)
|
||||
}
|
||||
} else {
|
||||
if (eq[1] == '\0' || eq == f) {
|
||||
/* misformed selector */
|
||||
#ifdef notdef
|
||||
/* We allow empty assignments */
|
||||
plog(XLOG_USER, "key %s: Bad selector \"%s\"", mapkey, f);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -970,9 +968,7 @@ f_true(char *arg)
|
||||
static void
|
||||
free_op(opt_apply *p, int b)
|
||||
{
|
||||
if (*p->opt) {
|
||||
XFREE(*p->opt);
|
||||
}
|
||||
XFREE(*p->opt);
|
||||
}
|
||||
|
||||
|
||||
@ -1300,7 +1296,7 @@ out:
|
||||
* Handle common case - no expansion
|
||||
*/
|
||||
if (cp == opt) {
|
||||
opt = strdup(cp);
|
||||
opt = xstrdup(cp);
|
||||
} else {
|
||||
/*
|
||||
* Finish off the expansion
|
||||
@ -1316,7 +1312,7 @@ out:
|
||||
/*
|
||||
* Save the expansion
|
||||
*/
|
||||
opt = strdup(expbuf);
|
||||
opt = xstrdup(expbuf);
|
||||
}
|
||||
|
||||
normalize_slash(opt);
|
||||
@ -1380,6 +1376,45 @@ free_opts(am_opts *fo)
|
||||
apply_opts(free_op, to_free, FALSE);
|
||||
}
|
||||
|
||||
am_opts *
|
||||
copy_opts(am_opts *old)
|
||||
{
|
||||
am_opts *newopts;
|
||||
newopts = CALLOC(struct am_opts);
|
||||
|
||||
#define _AM_OPT_COPY(field) do { \
|
||||
if (old->field) \
|
||||
newopts->field = xstrdup(old->field); \
|
||||
} while (0)
|
||||
|
||||
_AM_OPT_COPY(fs_glob);
|
||||
_AM_OPT_COPY(fs_local);
|
||||
_AM_OPT_COPY(fs_mtab);
|
||||
_AM_OPT_COPY(opt_dev);
|
||||
_AM_OPT_COPY(opt_delay);
|
||||
_AM_OPT_COPY(opt_dir);
|
||||
_AM_OPT_COPY(opt_fs);
|
||||
_AM_OPT_COPY(opt_group);
|
||||
_AM_OPT_COPY(opt_mount);
|
||||
_AM_OPT_COPY(opt_opts);
|
||||
_AM_OPT_COPY(opt_remopts);
|
||||
_AM_OPT_COPY(opt_pref);
|
||||
_AM_OPT_COPY(opt_cache);
|
||||
_AM_OPT_COPY(opt_rfs);
|
||||
_AM_OPT_COPY(opt_rhost);
|
||||
_AM_OPT_COPY(opt_sublink);
|
||||
_AM_OPT_COPY(opt_type);
|
||||
_AM_OPT_COPY(opt_mount_type);
|
||||
_AM_OPT_COPY(opt_unmount);
|
||||
_AM_OPT_COPY(opt_umount);
|
||||
_AM_OPT_COPY(opt_user);
|
||||
_AM_OPT_COPY(opt_maptype);
|
||||
_AM_OPT_COPY(opt_cachedir);
|
||||
_AM_OPT_COPY(opt_addopts);
|
||||
|
||||
return newopts;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Expand selectors (variables that cannot be assigned to or overridden)
|
||||
|
28
external/bsd/am-utils/dist/amd/restart.c
vendored
28
external/bsd/am-utils/dist/amd/restart.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: restart.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: restart.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -66,16 +62,16 @@ restart_fake_mntfs(mntent_t *me, am_ops *fs_ops)
|
||||
cp = strchr(me->mnt_fsname, ':');
|
||||
if (cp) {
|
||||
*cp = '\0';
|
||||
mo.opt_rhost = strdup(me->mnt_fsname);
|
||||
mo.opt_rfs = strdup(cp + 1);
|
||||
mo.opt_rhost = xstrdup(me->mnt_fsname);
|
||||
mo.opt_rfs = xstrdup(cp + 1);
|
||||
*cp = ':';
|
||||
} else if (STREQ(me->mnt_type, MNTTAB_TYPE_NFS)) {
|
||||
/*
|
||||
* Hacky workaround for mnttab NFS entries that only list the server
|
||||
*/
|
||||
plog(XLOG_WARNING, "NFS server entry assumed to be %s:/", me->mnt_fsname);
|
||||
mo.opt_rhost = strdup(me->mnt_fsname);
|
||||
mo.opt_rfs = strdup("/");
|
||||
mo.opt_rhost = xstrdup(me->mnt_fsname);
|
||||
mo.opt_rfs = xstrdup("/");
|
||||
me->mnt_fsname = str3cat(me->mnt_fsname, mo.opt_rhost, ":", "/");
|
||||
}
|
||||
mo.opt_fs = me->mnt_dir;
|
||||
@ -89,7 +85,6 @@ restart_fake_mntfs(mntent_t *me, am_ops *fs_ops)
|
||||
if (mf->mf_refc == 1) {
|
||||
mf->mf_flags |= MFF_RESTART | MFF_MOUNTED;
|
||||
mf->mf_error = 0; /* Already mounted correctly */
|
||||
mf->mf_fo = NULL;
|
||||
/*
|
||||
* Only timeout non-NFS entries
|
||||
*/
|
||||
@ -112,10 +107,8 @@ restart_fake_mntfs(mntent_t *me, am_ops *fs_ops)
|
||||
/*
|
||||
* Clean up mo
|
||||
*/
|
||||
if (mo.opt_rhost)
|
||||
XFREE(mo.opt_rhost);
|
||||
if (mo.opt_rfs)
|
||||
XFREE(mo.opt_rfs);
|
||||
XFREE(mo.opt_rhost);
|
||||
XFREE(mo.opt_rfs);
|
||||
}
|
||||
|
||||
|
||||
@ -265,7 +258,8 @@ restart_automounter_nodes(void)
|
||||
if (old_ports[i] == 0) {
|
||||
int soNFS;
|
||||
SVCXPRT *nfsxprt;
|
||||
if (create_nfs_service(&soNFS, &port, &nfsxprt, nfs_program_2) != 0) {
|
||||
if (create_nfs_service(&soNFS, &port, &nfsxprt, nfs_dispatcher,
|
||||
get_nfs_dispatcher_version(nfs_dispatcher)) != 0) {
|
||||
plog(XLOG_WARNING, "Can't bind to port %u", port);
|
||||
goto give_up;
|
||||
}
|
||||
|
10
external/bsd/am-utils/dist/amd/rpc_fwd.c
vendored
10
external/bsd/am-utils/dist/amd/rpc_fwd.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: rpc_fwd.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: rpc_fwd.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
10
external/bsd/am-utils/dist/amd/sched.c
vendored
10
external/bsd/am-utils/dist/amd/sched.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: sched.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: sched.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
15
external/bsd/am-utils/dist/amd/srvr_amfs_auto.c
vendored
15
external/bsd/am-utils/dist/amd/srvr_amfs_auto.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: srvr_amfs_auto.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: srvr_amfs_auto.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -71,7 +67,7 @@ amfs_generic_find_srvr(mntfs *mf)
|
||||
if (!fs) {
|
||||
fs = ALLOC(struct fserver);
|
||||
fs->fs_refc = 0;
|
||||
fs->fs_host = strdup("localhost");
|
||||
fs->fs_host = xstrdup("localhost");
|
||||
fs->fs_ip = NULL;
|
||||
fs->fs_cid = 0;
|
||||
fs->fs_pinger = AM_PINGER;
|
||||
@ -137,8 +133,7 @@ timeout_srvr(voidp v)
|
||||
/*
|
||||
* Free the net address
|
||||
*/
|
||||
if (fs->fs_ip)
|
||||
XFREE(fs->fs_ip);
|
||||
XFREE(fs->fs_ip);
|
||||
|
||||
/*
|
||||
* Free the host name.
|
||||
|
155
external/bsd/am-utils/dist/amd/srvr_nfs.c
vendored
155
external/bsd/am-utils/dist/amd/srvr_nfs.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: srvr_nfs.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: srvr_nfs.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -77,6 +73,7 @@
|
||||
typedef struct nfs_private {
|
||||
u_short np_mountd; /* Mount daemon port number */
|
||||
char np_mountd_inval; /* Port *may* be invalid */
|
||||
/* 'Y' invalid, 'N' valid, 'P' permanent */
|
||||
int np_ping; /* Number of failed ping attempts */
|
||||
time_t np_ttl; /* Time when server is thought dead */
|
||||
int np_xid; /* RPC transaction id for pings */
|
||||
@ -90,7 +87,9 @@ qelem nfs_srvr_list = {&nfs_srvr_list, &nfs_srvr_list};
|
||||
static int global_xid; /* For NFS pings */
|
||||
#define XID_ALLOC() (++global_xid)
|
||||
|
||||
#ifdef HAVE_FS_NFS3
|
||||
#if defined(HAVE_FS_NFS4)
|
||||
# define NUM_NFS_VERS 3
|
||||
#elif defined(HAVE_FS_NFS3)
|
||||
# define NUM_NFS_VERS 2
|
||||
#else /* not HAVE_FS_NFS3 */
|
||||
# define NUM_NFS_VERS 1
|
||||
@ -126,8 +125,8 @@ flush_srvr_nfs_cache(fserver *fs)
|
||||
ITER(fs2, fserver, &nfs_srvr_list) {
|
||||
if (fs == NULL || fs == fs2) {
|
||||
nfs_private *np = (nfs_private *) fs2->fs_private;
|
||||
if (np) {
|
||||
np->np_mountd_inval = TRUE;
|
||||
if (np && np->np_mountd_inval != 'P') {
|
||||
np->np_mountd_inval = 'Y';
|
||||
np->np_error = -1;
|
||||
}
|
||||
}
|
||||
@ -149,9 +148,9 @@ create_ping_payload(u_long nfs_version)
|
||||
*/
|
||||
if (nfs_version == 0) {
|
||||
nfs_version = NFS_VERSION;
|
||||
plog(XLOG_WARNING, "create_ping_payload: nfs_version = 0, changed to 2");
|
||||
plog(XLOG_WARNING, "%s: nfs_version = 0, changed to 2", __func__);
|
||||
} else
|
||||
plog(XLOG_INFO, "create_ping_payload: nfs_version: %d", (int) nfs_version);
|
||||
plog(XLOG_INFO, "%s: nfs_version: %d", __func__, (int) nfs_version);
|
||||
|
||||
rpc_msg_init(&ping_msg, NFS_PROGRAM, nfs_version, NFSPROC_NULL);
|
||||
|
||||
@ -166,6 +165,7 @@ create_ping_payload(u_long nfs_version)
|
||||
if (!xdr_callmsg(&ping_xdr, &ping_msg)) {
|
||||
plog(XLOG_ERROR, "Couldn't create ping RPC message");
|
||||
going_down(3);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Find out how long it is
|
||||
@ -209,7 +209,7 @@ got_portmap(voidp pkt, int len, struct sockaddr_in *sa, struct sockaddr_in *ia,
|
||||
* network ordering.
|
||||
*/
|
||||
np->np_mountd = htons((u_short) port);
|
||||
np->np_mountd_inval = FALSE;
|
||||
np->np_mountd_inval = 'N';
|
||||
np->np_error = 0;
|
||||
} else {
|
||||
dlog("Error fetching port for mountd on %s", fs->fs_host);
|
||||
@ -293,9 +293,9 @@ recompute_portmap(fserver *fs)
|
||||
}
|
||||
|
||||
if (fs->fs_version == 0)
|
||||
plog(XLOG_WARNING, "recompute_portmap: nfs_version = 0 fixed");
|
||||
plog(XLOG_WARNING, "%s: nfs_version = 0 fixed", __func__);
|
||||
|
||||
plog(XLOG_INFO, "recompute_portmap: NFS version %d on %s",
|
||||
plog(XLOG_INFO, "%s: NFS version %d on %s", __func__,
|
||||
(int) fs->fs_version, fs->fs_host);
|
||||
#ifdef HAVE_FS_NFS3
|
||||
if (fs->fs_version == NFS_VERSION3)
|
||||
@ -313,6 +313,7 @@ int
|
||||
get_mountd_port(fserver *fs, u_short *port, wchan_t wchan)
|
||||
{
|
||||
int error = -1;
|
||||
|
||||
if (FSRV_ISDOWN(fs))
|
||||
return EWOULDBLOCK;
|
||||
|
||||
@ -331,10 +332,18 @@ get_mountd_port(fserver *fs, u_short *port, wchan_t wchan)
|
||||
* indication that the mountd may be invalid, not
|
||||
* that it is known to be invalid.
|
||||
*/
|
||||
if (np->np_mountd_inval)
|
||||
switch (np->np_mountd_inval) {
|
||||
case 'Y':
|
||||
recompute_portmap(fs);
|
||||
else
|
||||
np->np_mountd_inval = TRUE;
|
||||
break;
|
||||
case 'N':
|
||||
np->np_mountd_inval = 'Y';
|
||||
break;
|
||||
case 'P':
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
if (error < 0 && wchan && !(fs->fs_flags & FSF_WANT)) {
|
||||
/*
|
||||
@ -427,7 +436,7 @@ nfs_keepalive_callback(voidp pkt, int len, struct sockaddr_in *sp, struct sockad
|
||||
/*
|
||||
* Recompute portmap information if not known
|
||||
*/
|
||||
if (np->np_mountd_inval)
|
||||
if (np->np_mountd_inval == 'Y')
|
||||
recompute_portmap(fs);
|
||||
|
||||
found_map++;
|
||||
@ -456,7 +465,7 @@ check_fs_addr_change(fserver *fs)
|
||||
sizeof(fs->fs_ip->sin_addr)) == 0)
|
||||
return;
|
||||
/* if got here: downed server changed IP address */
|
||||
old_ipaddr = strdup(inet_ntoa(fs->fs_ip->sin_addr));
|
||||
old_ipaddr = xstrdup(inet_ntoa(fs->fs_ip->sin_addr));
|
||||
memmove((voidp) &ia, (voidp) hp->h_addr, sizeof(struct in_addr));
|
||||
new_ipaddr = inet_ntoa(ia); /* ntoa uses static buf */
|
||||
plog(XLOG_WARNING, "EZK: down fileserver %s changed ip: %s -> %s",
|
||||
@ -564,20 +573,22 @@ nfs_keepalive(voidp v)
|
||||
int error;
|
||||
nfs_private *np = (nfs_private *) fs->fs_private;
|
||||
int fstimeo = -1;
|
||||
int fs_version = nfs_valid_version(gopt.nfs_vers_ping) &&
|
||||
gopt.nfs_vers_ping < fs->fs_version ? gopt.nfs_vers_ping : fs->fs_version;
|
||||
|
||||
/*
|
||||
* Send an NFS ping to this node
|
||||
*/
|
||||
|
||||
if (ping_len[fs->fs_version - NFS_VERSION] == 0)
|
||||
create_ping_payload(fs->fs_version);
|
||||
if (ping_len[fs_version - NFS_VERSION] == 0)
|
||||
create_ping_payload(fs_version);
|
||||
|
||||
/*
|
||||
* Queue the packet...
|
||||
*/
|
||||
error = fwd_packet(MK_RPC_XID(RPC_XID_NFSPING, np->np_xid),
|
||||
ping_buf[fs->fs_version - NFS_VERSION],
|
||||
ping_len[fs->fs_version - NFS_VERSION],
|
||||
ping_buf[fs_version - NFS_VERSION],
|
||||
ping_len[fs_version - NFS_VERSION],
|
||||
fs->fs_ip,
|
||||
(struct sockaddr_in *) NULL,
|
||||
(voidp) ((long) np->np_xid), /* cast needed for 64-bit archs */
|
||||
@ -675,7 +686,7 @@ start_nfs_pings(fserver *fs, int pingval)
|
||||
fserver *
|
||||
find_nfs_srvr(mntfs *mf)
|
||||
{
|
||||
char *host = mf->mf_fo->opt_rhost;
|
||||
char *host;
|
||||
fserver *fs;
|
||||
int pingval;
|
||||
mntent_t mnt;
|
||||
@ -689,6 +700,11 @@ find_nfs_srvr(mntfs *mf)
|
||||
int nfs_port_opt = 0;
|
||||
int fserver_is_down = 0;
|
||||
|
||||
if (mf->mf_fo == NULL) {
|
||||
plog(XLOG_ERROR, "%s: NULL mf_fo", __func__);
|
||||
return NULL;
|
||||
}
|
||||
host = mf->mf_fo->opt_rhost;
|
||||
/*
|
||||
* Get ping interval from mount options.
|
||||
* Current only used to decide whether pings
|
||||
@ -704,7 +720,8 @@ find_nfs_srvr(mntfs *mf)
|
||||
*/
|
||||
nfs_version = NFS_VERSION;
|
||||
nfs_proto = "udp";
|
||||
plog(XLOG_WARNING, "find_nfs_srvr: NFS mount failed, trying again with NFSv2/UDP");
|
||||
plog(XLOG_WARNING, "%s: NFS mount failed, trying again with NFSv2/UDP",
|
||||
__func__);
|
||||
mf->mf_flags &= ~MFF_NFS_SCALEDOWN;
|
||||
} else {
|
||||
/*
|
||||
@ -744,12 +761,13 @@ find_nfs_srvr(mntfs *mf)
|
||||
/* check if we've globally overridden the NFS version/protocol */
|
||||
if (gopt.nfs_vers) {
|
||||
nfs_version = gopt.nfs_vers;
|
||||
plog(XLOG_INFO, "find_nfs_srvr: force NFS version to %d",
|
||||
plog(XLOG_INFO, "%s: force NFS version to %d", __func__,
|
||||
(int) nfs_version);
|
||||
}
|
||||
if (gopt.nfs_proto) {
|
||||
nfs_proto = gopt.nfs_proto;
|
||||
plog(XLOG_INFO, "find_nfs_srvr: force NFS protocol transport to %s", nfs_proto);
|
||||
plog(XLOG_INFO, "%s: force NFS protocol transport to %s", __func__,
|
||||
nfs_proto);
|
||||
}
|
||||
}
|
||||
|
||||
@ -771,7 +789,7 @@ find_nfs_srvr(mntfs *mf)
|
||||
if (hp) {
|
||||
switch (hp->h_addrtype) {
|
||||
case AF_INET:
|
||||
ip = ALLOC(struct sockaddr_in);
|
||||
ip = CALLOC(struct sockaddr_in);
|
||||
memset((voidp) ip, 0, sizeof(*ip));
|
||||
/* as per POSIX, sin_len need not be set (used internally by kernel) */
|
||||
ip->sin_family = AF_INET;
|
||||
@ -797,8 +815,7 @@ find_nfs_srvr(mntfs *mf)
|
||||
STREQ(host, fs->fs_host)) {
|
||||
plog(XLOG_WARNING, "fileserver %s is already hung - not running NFS proto/version discovery", host);
|
||||
fs->fs_refc++;
|
||||
if (ip)
|
||||
XFREE(ip);
|
||||
XFREE(ip);
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
@ -823,10 +840,12 @@ find_nfs_srvr(mntfs *mf)
|
||||
plog(XLOG_INFO, "%s option used, NOT contacting the portmapper on %s",
|
||||
MNTTAB_OPT_PUBLIC, host);
|
||||
/*
|
||||
* Prefer NFSv3/tcp if the client supports it (cf. RFC 2054, 7).
|
||||
* Prefer NFSv4/tcp if the client supports it (cf. RFC 2054, 7).
|
||||
*/
|
||||
if (!nfs_version) {
|
||||
#ifdef HAVE_FS_NFS3
|
||||
#if defined(HAVE_FS_NFS4)
|
||||
nfs_version = NFS_VERSION4;
|
||||
#elif defined(HAVE_FS_NFS3)
|
||||
nfs_version = NFS_VERSION3;
|
||||
#else /* not HAVE_FS_NFS3 */
|
||||
nfs_version = NFS_VERSION;
|
||||
@ -835,11 +854,11 @@ find_nfs_srvr(mntfs *mf)
|
||||
(int) nfs_version);
|
||||
}
|
||||
if (!nfs_proto) {
|
||||
#if defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3)
|
||||
#if defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3) || defined(HAVE_FS_NFS4)
|
||||
nfs_proto = "tcp";
|
||||
#else /* not defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3) */
|
||||
#else /* not defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3) || defined(HAVE_FS_NFS4) */
|
||||
nfs_proto = "udp";
|
||||
#endif /* not defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3) */
|
||||
#endif /* not defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3) || defined(HAVE_FS_NFS4) */
|
||||
plog(XLOG_INFO, "No NFS protocol transport specified, will use %s",
|
||||
nfs_proto);
|
||||
}
|
||||
@ -851,7 +870,8 @@ find_nfs_srvr(mntfs *mf)
|
||||
*/
|
||||
if (check_pmap_up(host, ip)) {
|
||||
if (nfs_proto) {
|
||||
best_nfs_version = get_nfs_version(host, ip, nfs_version, nfs_proto);
|
||||
best_nfs_version = get_nfs_version(host, ip, nfs_version, nfs_proto,
|
||||
gopt.nfs_vers);
|
||||
nfs_port = ip->sin_port;
|
||||
}
|
||||
#ifdef MNTTAB_OPT_PROTO
|
||||
@ -860,8 +880,8 @@ find_nfs_srvr(mntfs *mf)
|
||||
char **p;
|
||||
|
||||
for (p = protocols; *p; p++) {
|
||||
proto_nfs_version = get_nfs_version(host, ip, nfs_version, *p);
|
||||
|
||||
proto_nfs_version = get_nfs_version(host, ip, nfs_version, *p,
|
||||
gopt.nfs_vers);
|
||||
if (proto_nfs_version > best_nfs_version) {
|
||||
best_nfs_version = proto_nfs_version;
|
||||
nfs_proto = *p;
|
||||
@ -910,8 +930,8 @@ find_nfs_srvr(mntfs *mf)
|
||||
if (!nfs_port)
|
||||
nfs_port = htons(NFS_PORT);
|
||||
|
||||
dlog("find_nfs_srvr: using port %d for nfs on %s",
|
||||
(int) ntohs(nfs_port), host);
|
||||
dlog("%s: using port %d for nfs on %s", __func__,
|
||||
(int) ntohs(nfs_port), host);
|
||||
ip->sin_port = nfs_port;
|
||||
|
||||
no_dns:
|
||||
@ -937,7 +957,7 @@ no_dns:
|
||||
sizeof(fs->fs_ip->sin_addr)) != 0) {
|
||||
struct in_addr ia;
|
||||
char *old_ipaddr, *new_ipaddr;
|
||||
old_ipaddr = strdup(inet_ntoa(fs->fs_ip->sin_addr));
|
||||
old_ipaddr = xstrdup(inet_ntoa(fs->fs_ip->sin_addr));
|
||||
memmove((voidp) &ia, (voidp) hp->h_addr, sizeof(struct in_addr));
|
||||
new_ipaddr = inet_ntoa(ia); /* ntoa uses static buf */
|
||||
plog(XLOG_WARNING, "fileserver %s changed ip: %s -> %s",
|
||||
@ -964,24 +984,28 @@ no_dns:
|
||||
*/
|
||||
if (!(fs->fs_flags & FSF_PINGING)) {
|
||||
np = (nfs_private *) fs->fs_private;
|
||||
np->np_mountd_inval = TRUE;
|
||||
np->np_xid = XID_ALLOC();
|
||||
np->np_error = -1;
|
||||
np->np_ping = 0;
|
||||
/*
|
||||
* Initially the server will be deemed dead
|
||||
* after MAX_ALLOWED_PINGS of the fast variety
|
||||
* have failed.
|
||||
*/
|
||||
np->np_ttl = MAX_ALLOWED_PINGS * FAST_NFS_PING + clocktime(NULL) - 1;
|
||||
start_nfs_pings(fs, pingval);
|
||||
if (fserver_is_down)
|
||||
fs->fs_flags |= FSF_VALID | FSF_DOWN;
|
||||
if (np->np_mountd_inval != 'P') {
|
||||
np->np_mountd_inval = TRUE;
|
||||
np->np_xid = XID_ALLOC();
|
||||
np->np_error = -1;
|
||||
np->np_ping = 0;
|
||||
/*
|
||||
* Initially the server will be deemed dead
|
||||
* after MAX_ALLOWED_PINGS of the fast variety
|
||||
* have failed.
|
||||
*/
|
||||
np->np_ttl = MAX_ALLOWED_PINGS * FAST_NFS_PING + clocktime(NULL) - 1;
|
||||
start_nfs_pings(fs, pingval);
|
||||
if (fserver_is_down)
|
||||
fs->fs_flags |= FSF_VALID | FSF_DOWN;
|
||||
} else {
|
||||
fs->fs_flags = FSF_VALID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fs->fs_refc++;
|
||||
if (ip)
|
||||
XFREE(ip);
|
||||
XFREE(ip);
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
@ -995,7 +1019,7 @@ no_dns:
|
||||
*/
|
||||
fs = ALLOC(struct fserver);
|
||||
fs->fs_refc = 1;
|
||||
fs->fs_host = strdup(hp ? hp->h_name : "unknown_hostname");
|
||||
fs->fs_host = xstrdup(hp ? hp->h_name : "unknown_hostname");
|
||||
if (gopt.flags & CFM_NORMALIZE_HOSTNAMES)
|
||||
host_normalize(&fs->fs_host);
|
||||
fs->fs_ip = ip;
|
||||
@ -1016,9 +1040,18 @@ no_dns:
|
||||
fs->fs_flags |= FSF_PING_UNINIT; /* pinger hasn't been initialized */
|
||||
np = ALLOC(struct nfs_private);
|
||||
memset((voidp) np, 0, sizeof(*np));
|
||||
np->np_mountd_inval = TRUE;
|
||||
np->np_xid = XID_ALLOC();
|
||||
np->np_error = -1;
|
||||
np->np_mountd = htons(hasmntval(&mnt, "mountport"));
|
||||
if (np->np_mountd == 0) {
|
||||
np->np_mountd_inval = 'Y';
|
||||
np->np_xid = XID_ALLOC();
|
||||
np->np_error = -1;
|
||||
} else {
|
||||
plog(XLOG_INFO, "%s: using mountport: %d", __func__,
|
||||
(int) ntohs(np->np_mountd));
|
||||
np->np_mountd_inval = 'P';
|
||||
np->np_xid = 0;
|
||||
np->np_error = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initially the server will be deemed dead after
|
||||
|
10
external/bsd/am-utils/dist/amd/sun2amd.8
vendored
10
external/bsd/am-utils/dist/amd/sun2amd.8
vendored
@ -1,7 +1,7 @@
|
||||
.\" $NetBSD: sun2amd.8,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $
|
||||
.\" $NetBSD: sun2amd.8,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $
|
||||
.\"
|
||||
.\"
|
||||
.\" Copyright (c) 1997-2009 Erez Zadok
|
||||
.\" Copyright (c) 1997-2014 Erez Zadok
|
||||
.\" Copyright (c) 2005 Daniel P. Ottavio
|
||||
.\" Copyright (c) 1990 Jan-Simon Pendry
|
||||
.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
@ -19,11 +19,7 @@
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgment:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" 3. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
|
10
external/bsd/am-utils/dist/amd/sun2amd.c
vendored
10
external/bsd/am-utils/dist/amd/sun2amd.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: sun2amd.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: sun2amd.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 2005 Daniel P. Ottavio
|
||||
* Copyright (c) 1989 Jan-Simon Pendry
|
||||
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
40
external/bsd/am-utils/dist/amd/sun_map.c
vendored
40
external/bsd/am-utils/dist/amd/sun_map.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: sun_map.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: sun_map.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 2005 Daniel P. Ottavio
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -169,7 +165,7 @@ sun_strsub(const char *src, const char *str, const char *sub)
|
||||
(void)strncat(retval, sub, sub_size);
|
||||
(void)strncat(retval, str_end + 1, second_half);
|
||||
|
||||
if ((str_start = strstr(retval, str)) != NULL) {
|
||||
if (strstr(retval, str) != NULL) {
|
||||
/*
|
||||
* If there is another occurrences of str call this function
|
||||
* recursively.
|
||||
@ -208,7 +204,7 @@ sun_expand2amd(const char *str)
|
||||
* each of the replace attempt will fail and we'll move on to the
|
||||
* next char.
|
||||
*/
|
||||
tmp = strdup(str);
|
||||
tmp = xstrdup(str);
|
||||
for (pos = str; *pos != '\0'; pos++) {
|
||||
if (*pos != '$') {
|
||||
continue;
|
||||
@ -260,9 +256,7 @@ sun_expand2amd(const char *str)
|
||||
}
|
||||
else {
|
||||
retval = tmp2;
|
||||
if (tmp != NULL) {
|
||||
XFREE(tmp);
|
||||
}
|
||||
XFREE(tmp);
|
||||
}
|
||||
|
||||
return retval;
|
||||
@ -313,19 +307,15 @@ sun_append_str(char *dest,
|
||||
* Try to convert any variable substitutions. If this function
|
||||
* returns a new string one or more var subs where expanded.
|
||||
*/
|
||||
else if ((sub = sun_expand2amd(out)) != NULL) {
|
||||
else if (out != NULL && (sub = sun_expand2amd(out)) != NULL) {
|
||||
out = sub;
|
||||
}
|
||||
|
||||
if (out != NULL) {
|
||||
xstrlcat(dest, out, destlen);
|
||||
}
|
||||
if (sub != NULL) {
|
||||
XFREE(sub);
|
||||
}
|
||||
if (sub2 != NULL) {
|
||||
XFREE(sub2);
|
||||
}
|
||||
XFREE(sub);
|
||||
XFREE(sub2);
|
||||
}
|
||||
|
||||
|
||||
@ -557,7 +547,7 @@ sun_entry2amd(const char *key, const char *s_entry_str)
|
||||
if (s_entry->mountpt_list != NULL) {
|
||||
/* multi-mount point */
|
||||
sun_multi2amd(line_buff, sizeof(line_buff), key, s_entry);
|
||||
retval = strdup(line_buff);
|
||||
retval = xstrdup(line_buff);
|
||||
}
|
||||
else {
|
||||
/* single mount point */
|
||||
@ -565,12 +555,12 @@ sun_entry2amd(const char *key, const char *s_entry_str)
|
||||
if (NSTREQ(s_entry->fstype, SUN_NFS_TYPE, strlen(SUN_NFS_TYPE))) {
|
||||
/* NFS Type */
|
||||
sun_nfs2amd(line_buff, sizeof(line_buff), key, s_entry);
|
||||
retval = strdup(line_buff);
|
||||
retval = xstrdup(line_buff);
|
||||
}
|
||||
else if (NSTREQ(s_entry->fstype, SUN_HSFS_TYPE, strlen(SUN_HSFS_TYPE))) {
|
||||
/* HSFS Type (CD fs) */
|
||||
sun_hsfs2amd(line_buff, sizeof(line_buff), key, s_entry);
|
||||
retval = strdup(line_buff);
|
||||
retval = xstrdup(line_buff);
|
||||
}
|
||||
/*
|
||||
* XXX: The following fstypes are not yet supported.
|
||||
@ -597,13 +587,11 @@ sun_entry2amd(const char *key, const char *s_entry_str)
|
||||
else {
|
||||
plog(XLOG_INFO, "No SUN fstype specified defaulting to NFS.");
|
||||
sun_nfs2amd(line_buff, sizeof(line_buff), key, s_entry);
|
||||
retval = strdup(line_buff);
|
||||
retval = xstrdup(line_buff);
|
||||
}
|
||||
}
|
||||
|
||||
err:
|
||||
if (s_entry != NULL) {
|
||||
XFREE(s_entry);
|
||||
}
|
||||
XFREE(s_entry);
|
||||
return retval;
|
||||
}
|
||||
|
10
external/bsd/am-utils/dist/amd/sun_map.h
vendored
10
external/bsd/am-utils/dist/amd/sun_map.h
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: sun_map.h,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: sun_map.h,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 2005 Daniel P. Ottavio
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
4
external/bsd/am-utils/dist/amq/Makefile.am
vendored
4
external/bsd/am-utils/dist/amq/Makefile.am
vendored
@ -18,11 +18,11 @@ pawd_SOURCES = amq_clnt.c amq_xdr.c pawd.c
|
||||
|
||||
LDADD = ../libamu/libamu.la
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
# allow users to add their own flags via "configure --enable-am-flags=ARG"
|
||||
AMU_CFLAGS = @AMU_CFLAGS@
|
||||
AM_CFLAGS = @CFLAGS@ $(AMU_CFLAGS)
|
||||
AM_CFLAGS = $(AMU_CFLAGS)
|
||||
|
||||
# additional files to distribute and clean
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
|
134
external/bsd/am-utils/dist/amq/amq.c
vendored
134
external/bsd/am-utils/dist/amq/amq.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amq.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: amq.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -59,6 +55,7 @@ static int getpid_flag;
|
||||
static int getpwd_flag;
|
||||
static int getvers_flag;
|
||||
static int minfo_flag;
|
||||
static int mapinfo_flag;
|
||||
static int quiet_flag;
|
||||
static int stats_flag;
|
||||
static int unmount_flag;
|
||||
@ -81,6 +78,17 @@ enum show_opt {
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
time_print(time_type tt)
|
||||
{
|
||||
time_t t = (time_t)tt;
|
||||
struct tm *tp = localtime(&t);
|
||||
printf("%02d/%02d/%04d %02d:%02d:%02d",
|
||||
tp->tm_mon + 1, tp->tm_mday,
|
||||
tp->tm_year < 1900 ? tp->tm_year + 1900 : tp->tm_year,
|
||||
tp->tm_hour, tp->tm_min, tp->tm_sec);
|
||||
}
|
||||
|
||||
/*
|
||||
* If (e) is Calc then just calculate the sizes
|
||||
* Otherwise display the mount node on stdout
|
||||
@ -105,8 +113,7 @@ show_mti(amq_mount_tree *mt, enum show_opt e, int *mwid, int *dwid, int *twid)
|
||||
|
||||
case Full:
|
||||
{
|
||||
struct tm *tp = localtime((time_t *) ((voidp) &mt->mt_mounttime));
|
||||
printf("%-*.*s %-*.*s %-*.*s %s\n\t%-5d %-7d %-6d %-7d %-7d %-6d %02d/%02d/%04d %02d:%02d:%02d\n",
|
||||
printf("%-*.*s %-*.*s %-*.*s %s\n\t%-5d %-7d %-6d %-7d %-7d %-6d",
|
||||
*dwid, *dwid,
|
||||
*mt->mt_directory ? mt->mt_directory : "/", /* XXX */
|
||||
*twid, *twid,
|
||||
@ -120,18 +127,15 @@ show_mti(amq_mount_tree *mt, enum show_opt e, int *mwid, int *dwid, int *twid)
|
||||
mt->mt_lookup,
|
||||
mt->mt_readdir,
|
||||
mt->mt_readlink,
|
||||
mt->mt_statfs,
|
||||
|
||||
tp->tm_mon + 1, tp->tm_mday,
|
||||
tp->tm_year < 1900 ? tp->tm_year + 1900 : tp->tm_year,
|
||||
tp->tm_hour, tp->tm_min, tp->tm_sec);
|
||||
mt->mt_statfs);
|
||||
time_print(mt->mt_mounttime);
|
||||
printf("\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case Stats:
|
||||
{
|
||||
struct tm *tp = localtime((time_t *) ((voidp) &mt->mt_mounttime));
|
||||
printf("%-*.*s %-5d %-7d %-6d %-7d %-7d %-6d %02d/%02d/%02d %02d:%02d:%04d\n",
|
||||
printf("%-*.*s %-5d %-7d %-6d %-7d %-7d %-6d ",
|
||||
*dwid, *dwid,
|
||||
*mt->mt_directory ? mt->mt_directory : "/", /* XXX */
|
||||
|
||||
@ -140,11 +144,9 @@ show_mti(amq_mount_tree *mt, enum show_opt e, int *mwid, int *dwid, int *twid)
|
||||
mt->mt_lookup,
|
||||
mt->mt_readdir,
|
||||
mt->mt_readlink,
|
||||
mt->mt_statfs,
|
||||
|
||||
tp->tm_mon + 1, tp->tm_mday,
|
||||
tp->tm_year < 1900 ? tp->tm_year + 1900 : tp->tm_year,
|
||||
tp->tm_hour, tp->tm_min, tp->tm_sec);
|
||||
mt->mt_statfs);
|
||||
time_print(mt->mt_mounttime);
|
||||
printf("\n");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -233,7 +235,7 @@ show_mi(amq_mount_info_list *ml, enum show_opt e, int *mwid, int *dwid, int *twi
|
||||
{
|
||||
for (i = 0; i < ml->amq_mount_info_list_len; i++) {
|
||||
amq_mount_info *mi = &ml->amq_mount_info_list_val[i];
|
||||
printf("%-*.*s %-*.*s %-*.*s %-3d %s is %s",
|
||||
printf("%-*.*s %-*.*s %-*.*s %-3d %s is %s ",
|
||||
*mwid, *mwid, mi->mi_mountinfo,
|
||||
*dwid, *dwid, mi->mi_mountpt,
|
||||
*twid, *twid, mi->mi_type,
|
||||
@ -255,6 +257,55 @@ show_mi(amq_mount_info_list *ml, enum show_opt e, int *mwid, int *dwid, int *twi
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
show_map(amq_map_info *mi)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
show_mapinfo(amq_map_info_list *ml, enum show_opt e, int *nwid, int *wwid)
|
||||
{
|
||||
u_int i;
|
||||
|
||||
switch (e) {
|
||||
|
||||
case Calc:
|
||||
{
|
||||
for (i = 0; i < ml->amq_map_info_list_len; i++) {
|
||||
amq_map_info *mi = &ml->amq_map_info_list_val[i];
|
||||
int nw = strlen(mi->mi_name);
|
||||
int ww = strlen(mi->mi_wildcard ? mi->mi_wildcard : "(null");
|
||||
if (nw > *nwid)
|
||||
*nwid = nw;
|
||||
if (ww > *wwid)
|
||||
*wwid = ww;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Full:
|
||||
{
|
||||
printf("%-*.*s %-*.*s %-8.8s %-7.7s %-7.7s %-7.7s %-s Modified\n",
|
||||
*nwid, *nwid, "Name",
|
||||
*wwid, *wwid, "Wild",
|
||||
"Flags", "Refcnt", "Entries", "Reloads", "Stat");
|
||||
for (i = 0; i < ml->amq_map_info_list_len; i++) {
|
||||
amq_map_info *mi = &ml->amq_map_info_list_val[i];
|
||||
printf("%-*.*s %*.*s %-8x %-7d %-7d %-7d %s ",
|
||||
*nwid, *nwid, mi->mi_name,
|
||||
*wwid, *wwid, mi->mi_wildcard,
|
||||
mi->mi_flags, mi->mi_refc, mi->mi_nentries, mi->mi_reloads,
|
||||
mi->mi_up == -1 ? "root" : (mi->mi_up ? " up" : "down"));
|
||||
time_print(mi->mi_modify);
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Display general mount statistics
|
||||
@ -341,6 +392,7 @@ amu_sync_umnt_to_retval(amq_sync_umnt *rv)
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
/*FALLTHROUGH*/
|
||||
default:
|
||||
return rv->au_etype;
|
||||
}
|
||||
@ -389,7 +441,7 @@ main(int argc, char *argv[])
|
||||
/*
|
||||
* Parse arguments
|
||||
*/
|
||||
while ((opt_ch = getopt(argc, argv, "Hfh:l:mqsuvx:D:pP:TUw")) != -1)
|
||||
while ((opt_ch = getopt(argc, argv, "Hfh:il:mqsuvx:D:pP:TUw")) != -1)
|
||||
switch (opt_ch) {
|
||||
case 'H':
|
||||
goto show_usage;
|
||||
@ -404,6 +456,11 @@ main(int argc, char *argv[])
|
||||
def_server = optarg;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
mapinfo_flag = 1;
|
||||
nodefault = 1;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
amq_logfile = optarg;
|
||||
nodefault = 1;
|
||||
@ -477,7 +534,7 @@ main(int argc, char *argv[])
|
||||
if (errs) {
|
||||
show_usage:
|
||||
fprintf(stderr, "\
|
||||
Usage: %s [-fmpqsvwHTU] [-h hostname] [-l log_file|\"syslog\"]\n\
|
||||
Usage: %s [-fimpqsvwHTU] [-h hostname] [-l log_file|\"syslog\"]\n\
|
||||
\t[-x log_options] [-D debug_options]\n\
|
||||
\t[-P program_number] [[-u[u]] directory ...]\n",
|
||||
am_get_progname()
|
||||
@ -612,16 +669,19 @@ Usage: %s [-fmpqsvwHTU] [-h hostname] [-l log_file|\"syslog\"]\n\
|
||||
*/
|
||||
if (getpwd_flag) {
|
||||
char path[MAXPATHLEN+1];
|
||||
char *wd = getcwd(path, MAXPATHLEN+1);
|
||||
amq_mount_tree_list *mlp = amqproc_export_1((voidp) 0, clnt);
|
||||
char *wd;
|
||||
amq_mount_tree_list *mlp;
|
||||
amq_mount_tree_p mt;
|
||||
u_int i;
|
||||
int flag;
|
||||
|
||||
wd = getcwd(path, MAXPATHLEN+1);
|
||||
if (!wd) {
|
||||
perror("getcwd");
|
||||
fprintf(stderr, "%s: getcwd failed (%s)", am_get_progname(),
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
mlp = amqproc_export_1((voidp) 0, clnt);
|
||||
for (i = 0; mlp && i < mlp->amq_mount_tree_list_len; i++) {
|
||||
mt = mlp->amq_mount_tree_list_val[i];
|
||||
while (1) {
|
||||
@ -656,6 +716,26 @@ Usage: %s [-fmpqsvwHTU] [-h hostname] [-l log_file|\"syslog\"]\n\
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Map
|
||||
*/
|
||||
if (mapinfo_flag) {
|
||||
int dummy;
|
||||
amq_map_info_list *ml = amqproc_getmapinfo_1(&dummy, clnt);
|
||||
if (ml) {
|
||||
int mwid = 0, wwid = 0;
|
||||
show_mapinfo(ml, Calc, &mwid, &wwid);
|
||||
mwid++;
|
||||
if (wwid)
|
||||
wwid++;
|
||||
show_mapinfo(ml, Full, &mwid, &wwid);
|
||||
} else {
|
||||
fprintf(stderr, "%s: amd on %s cannot provide map info\n",
|
||||
am_get_progname(), server);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get Version
|
||||
*/
|
||||
|
11
external/bsd/am-utils/dist/amq/amq.h
vendored
11
external/bsd/am-utils/dist/amq/amq.h
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amq.h,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: amq.h,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -58,6 +54,7 @@ extern amq_mount_stats *amqproc_stats_1(voidp argp, CLIENT *rqstp);
|
||||
extern amq_mount_tree_list *amqproc_export_1(voidp argp, CLIENT *rqstp);
|
||||
extern int *amqproc_setopt_1(amq_setopt *argp, CLIENT *rqstp);
|
||||
extern amq_mount_info_list *amqproc_getmntfs_1(voidp argp, CLIENT *rqstp);
|
||||
extern amq_map_info_list *amqproc_getmapinfo_1(voidp argp, CLIENT *rqstp);
|
||||
extern int *amqproc_mount_1(voidp argp, CLIENT *rqstp);
|
||||
extern amq_string *amqproc_getvers_1(voidp argp, CLIENT *rqstp);
|
||||
extern int *amqproc_getpid_1(voidp argp, CLIENT *rqstp);
|
||||
|
26
external/bsd/am-utils/dist/amq/amq_clnt.c
vendored
26
external/bsd/am-utils/dist/amq/amq_clnt.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amq_clnt.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: amq_clnt.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -110,7 +106,7 @@ amqproc_sync_umnt_1(amq_string *argp, CLIENT *clnt)
|
||||
memset((char *) &res, 0, sizeof(res));
|
||||
if ((rv = clnt_call(clnt, AMQPROC_SYNC_UMNT,
|
||||
(XDRPROC_T_TYPE) xdr_amq_string, (SVC_IN_ARG_TYPE) argp,
|
||||
(XDRPROC_T_TYPE) xdr_amq_sync_umnt, &res,
|
||||
(XDRPROC_T_TYPE) xdr_amq_sync_umnt, (SVC_IN_ARG_TYPE) &res,
|
||||
TIMEOUT)) != RPC_SUCCESS) {
|
||||
return (NULL);
|
||||
}
|
||||
@ -180,6 +176,20 @@ amqproc_getmntfs_1(voidp argp, CLIENT *clnt)
|
||||
return (&res);
|
||||
}
|
||||
|
||||
amq_map_info_list *
|
||||
amqproc_getmapinfo_1(voidp argp, CLIENT *clnt)
|
||||
{
|
||||
static amq_map_info_list res;
|
||||
|
||||
memset((char *) &res, 0, sizeof(res));
|
||||
if (clnt_call(clnt, AMQPROC_GETMAPINFO, (XDRPROC_T_TYPE) xdr_void, argp,
|
||||
(XDRPROC_T_TYPE) xdr_amq_map_info_list,
|
||||
(SVC_IN_ARG_TYPE) &res, TIMEOUT) != RPC_SUCCESS) {
|
||||
return (NULL);
|
||||
}
|
||||
return (&res);
|
||||
}
|
||||
|
||||
|
||||
int *
|
||||
amqproc_mount_1(voidp argp, CLIENT *clnt)
|
||||
|
63
external/bsd/am-utils/dist/amq/amq_xdr.c
vendored
63
external/bsd/am-utils/dist/amq/amq_xdr.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: amq_xdr.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: amq_xdr.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -189,6 +185,59 @@ xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_amq_map_info(XDR *xdrs, amq_map_info *objp)
|
||||
{
|
||||
if (!xdr_amq_string(xdrs, &objp->mi_name)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!xdr_amq_string(xdrs, &objp->mi_wildcard)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!xdr_time_type(xdrs, &objp->mi_modify)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!xdr_int(xdrs, &objp->mi_flags)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!xdr_int(xdrs, &objp->mi_nentries)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!xdr_int(xdrs, &objp->mi_reloads)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!xdr_int(xdrs, &objp->mi_refc)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!xdr_int(xdrs, &objp->mi_up)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
bool_t
|
||||
xdr_amq_map_info_list(XDR *xdrs, amq_map_info_list *objp)
|
||||
{
|
||||
if (!xdr_array(xdrs,
|
||||
(char **) ((voidp) &objp->amq_map_info_list_val),
|
||||
(u_int *) &objp->amq_map_info_list_len,
|
||||
~0,
|
||||
sizeof(amq_map_info),
|
||||
(XDRPROC_T_TYPE) xdr_amq_map_info)) {
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
bool_t
|
||||
xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp)
|
||||
|
10
external/bsd/am-utils/dist/amq/pawd.1
vendored
10
external/bsd/am-utils/dist/amq/pawd.1
vendored
@ -1,7 +1,7 @@
|
||||
.\" $NetBSD: pawd.1,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $
|
||||
.\" $NetBSD: pawd.1,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $
|
||||
.\"
|
||||
.\"
|
||||
.\" Copyright (c) 1997-2009 Erez Zadok
|
||||
.\" Copyright (c) 1997-2014 Erez Zadok
|
||||
.\" Copyright (c) 1990 Jan-Simon Pendry
|
||||
.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
.\" Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgment:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" 3. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
|
10
external/bsd/am-utils/dist/amq/pawd.c
vendored
10
external/bsd/am-utils/dist/amq/pawd.c
vendored
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: pawd.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: pawd.c,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
74
external/bsd/am-utils/dist/bootstrap
vendored
74
external/bsd/am-utils/dist/bootstrap
vendored
@ -5,6 +5,16 @@
|
||||
# this is not meant to go into the distributions
|
||||
# Erez Zadok <ezk@cs.columbia.edu>
|
||||
|
||||
validateversion() {
|
||||
local v="$(autoreconf --version 2>&1 | head -1)"
|
||||
case "$v" in
|
||||
*2.69) ;;
|
||||
*) echo "am-utils requires autoconf 2.69, you have:"
|
||||
echo " $v"
|
||||
exit 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
# test cwd
|
||||
test -f ../amd/amd.c && cd ..
|
||||
if [ ! -f amd/amd.c ]; then
|
||||
@ -37,67 +47,13 @@ test -f acinclude.m4 && mv -f acinclude.m4 acinclude.m4.old
|
||||
cat TRAILER
|
||||
) > acinclude.m4
|
||||
|
||||
# generate aclocal.m4 file
|
||||
echo "AMU: aclocal..."
|
||||
test -f aclocal.m4 && mv -f aclocal.m4 aclocal.m4.old
|
||||
# show version
|
||||
aclocal --version 2>&1 | head -1
|
||||
if aclocal ; then
|
||||
# generate the rest of the scripts
|
||||
echo "AMU: autoreconf..."
|
||||
validateversion
|
||||
if autoreconf -f -i; then
|
||||
:
|
||||
else
|
||||
echo "aclocal command failed. fix errors and rerun $0."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# produce new configure.in (temp) script
|
||||
echo "AMU: autoconf..."
|
||||
# show version
|
||||
autoconf --version 2>&1 | head -1
|
||||
LOG=/tmp/amu-$$.log
|
||||
rm -f ${LOG}
|
||||
autoconf configure.in > configure.new 2> ${LOG}
|
||||
# until Automake requires Autoconf 2.50, manual says to ignore this
|
||||
CUTWARNMSG1="warning: AC_PROG_LEX invoked multiple times|do not use m4_(patsubst|regexp):"
|
||||
egrep -v "${CUTWARNMSG1}" ${LOG} > ${LOG}.new
|
||||
mv ${LOG}.new ${LOG}
|
||||
if test -s ${LOG}; then
|
||||
echo "AUTOCONF ERRORS (MUST FIX):"
|
||||
cat ${LOG}
|
||||
rm -f ${LOG}
|
||||
exit 2
|
||||
fi
|
||||
# now prepare the real configure script
|
||||
test -f configure && mv -f configure configure.old
|
||||
mv -f configure.new configure
|
||||
chmod a+rx configure
|
||||
rm -f configure.old
|
||||
|
||||
# run autoheader to produce C header .in files
|
||||
echo "AMU: autoheader..."
|
||||
# show version
|
||||
autoheader --version 2>&1 | head -1
|
||||
autoheader configure.in > config.h.in 2> ${LOG}
|
||||
CUTWARNMSG2="autoheader: \`config.h.in' is updated"
|
||||
egrep -v "${CUTWARNMSG2}" ${LOG} > ${LOG}.new
|
||||
mv ${LOG}.new ${LOG}
|
||||
if test -s ${LOG}; then
|
||||
echo "AUTOHEADER ERRORS (MUST FIX):"
|
||||
cat ${LOG}
|
||||
rm -f ${LOG}
|
||||
exit 2
|
||||
fi
|
||||
rm -f ${LOG}
|
||||
|
||||
# generate makefiles
|
||||
cmd="automake --add-missing --copy --ignore-deps"
|
||||
#cmd="automake --add-missing"
|
||||
echo "AMU: $cmd..."
|
||||
# show version
|
||||
automake --version 2>&1 | head -1
|
||||
if ${cmd} ; then
|
||||
:
|
||||
else
|
||||
echo "automake command failed. fix errors and rerun $0."
|
||||
echo "autoreconf command failed. fix errors and rerun $0."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
12
external/bsd/am-utils/dist/buildall
vendored
12
external/bsd/am-utils/dist/buildall
vendored
@ -12,8 +12,8 @@
|
||||
# change to the right directory
|
||||
test -f ../config.guess && cd ..
|
||||
test -f ../../config.guess && cd ../..
|
||||
pwd=`pwd`
|
||||
host_alias=`(cd /tmp; $pwd/config.guess.long)`
|
||||
pwd=$(pwd)
|
||||
host_alias=$(cd /tmp; $pwd/config.guess.long)
|
||||
if test -z "$host_alias" ; then
|
||||
echo "$0: must run from the source or the A. directory."
|
||||
echo "$0: cannot find $pwd/config.guess"
|
||||
@ -244,7 +244,7 @@ done
|
||||
|
||||
# if AM_CFLAGS was set before, then add it to the configure option
|
||||
if test -n "${AM_CFLAGS}"; then
|
||||
extra_cnf_flags="--enable-am-cflags=${AM_CFLAGS}"
|
||||
extra_cnf_flags="--enable-am-cflags=\"${AM_CFLAGS}\""
|
||||
else
|
||||
:
|
||||
fi
|
||||
@ -334,10 +334,10 @@ if test -n "$cnf_cmd"; then
|
||||
fi
|
||||
if test -z "${cnf_flags}${extra_cnf_flags}"; then
|
||||
echo $cnf_cmd $cmdline_cnf_flags
|
||||
$cnf_cmd $cmdline_cnf_flags || exit 1
|
||||
eval $cnf_cmd $cmdline_cnf_flags || exit 1
|
||||
else
|
||||
echo $cnf_cmd "$cnf_flags" "$extra_cnf_flags" $cmdline_cnf_flags
|
||||
$cnf_cmd "$cnf_flags" "$extra_cnf_flags" $cmdline_cnf_flags || exit 1
|
||||
echo $cnf_cmd $cnf_flags $extra_cnf_flags $cmdline_cnf_flags
|
||||
eval $cnf_cmd $cnf_flags $extra_cnf_flags $cmdline_cnf_flags || exit 1
|
||||
fi
|
||||
else
|
||||
:
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: autofs_default.c,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $ */
|
||||
/* $NetBSD: autofs_default.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Ion Badulescu
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: autofs_default.h,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $ */
|
||||
/* $NetBSD: autofs_default.h,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Ion Badulescu
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: autofs_linux.c,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $ */
|
||||
/* $NetBSD: autofs_linux.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Ion Badulescu
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -61,8 +57,15 @@
|
||||
*/
|
||||
|
||||
#define AUTOFS_MIN_VERSION 3
|
||||
#if AUTOFS_MAX_PROTO_VERSION >= 5
|
||||
/*
|
||||
* Autofs version 5 support is experimental; change this to 5 you want
|
||||
* to play with, it. There are reports it does not work.
|
||||
*/
|
||||
#define AUTOFS_MAX_VERSION 4 /* we only know up to version 5 */
|
||||
#else
|
||||
#define AUTOFS_MAX_VERSION AUTOFS_MAX_PROTO_VERSION
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* STRUCTURES:
|
||||
@ -274,10 +277,10 @@ autofs_add_fdset(fd_set *readfds)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
autofs_get_pkt(int fd, char *buf, int bytes)
|
||||
static ssize_t
|
||||
autofs_get_pkt(int fd, void *buf, size_t bytes)
|
||||
{
|
||||
int i;
|
||||
ssize_t i;
|
||||
|
||||
do {
|
||||
i = read(fd, buf, bytes);
|
||||
@ -285,7 +288,7 @@ autofs_get_pkt(int fd, char *buf, int bytes)
|
||||
if (i <= 0)
|
||||
break;
|
||||
|
||||
buf += i;
|
||||
buf = (char *)buf + i;
|
||||
bytes -= i;
|
||||
} while (bytes);
|
||||
|
||||
@ -294,7 +297,7 @@ autofs_get_pkt(int fd, char *buf, int bytes)
|
||||
|
||||
|
||||
static void
|
||||
send_fail(int fd, unsigned long token)
|
||||
send_fail(int fd, autofs_wqt_t token)
|
||||
{
|
||||
if (token == 0)
|
||||
return;
|
||||
@ -304,7 +307,7 @@ send_fail(int fd, unsigned long token)
|
||||
|
||||
|
||||
static void
|
||||
send_ready(int fd, unsigned long token)
|
||||
send_ready(int fd, autofs_wqt_t token)
|
||||
{
|
||||
if (token == 0)
|
||||
return;
|
||||
@ -338,7 +341,7 @@ autofs_lookup_failed(am_node *mp, char *name)
|
||||
|
||||
|
||||
static void
|
||||
autofs_expire_one(am_node *mp, char *name, unsigned long token)
|
||||
autofs_expire_one(am_node *mp, char *name, autofs_wqt_t token)
|
||||
{
|
||||
autofs_fh_t *fh;
|
||||
am_node *ap;
|
||||
@ -371,7 +374,7 @@ autofs_expire_one(am_node *mp, char *name, unsigned long token)
|
||||
|
||||
p = ALLOC(struct autofs_pending_umount);
|
||||
p->wait_queue_token = token;
|
||||
p->name = strdup(name);
|
||||
p->name = xstrdup(name);
|
||||
p->next = fh->pending_umounts;
|
||||
fh->pending_umounts = p;
|
||||
|
||||
@ -383,23 +386,7 @@ out:
|
||||
|
||||
|
||||
static void
|
||||
autofs_handle_expire(am_node *mp, struct autofs_packet_expire *pkt)
|
||||
{
|
||||
autofs_expire_one(mp, pkt->name, 0);
|
||||
}
|
||||
|
||||
|
||||
#if AUTOFS_MAX_VERSION >= 4
|
||||
static void
|
||||
autofs_handle_expire_multi(am_node *mp, struct autofs_packet_expire_multi *pkt)
|
||||
{
|
||||
autofs_expire_one(mp, pkt->name, pkt->wait_queue_token);
|
||||
}
|
||||
#endif /* AUTOFS_MAX_VERSION >= 4 */
|
||||
|
||||
|
||||
static void
|
||||
autofs_handle_missing(am_node *mp, struct autofs_packet_missing *pkt)
|
||||
autofs_missing_one(am_node *mp, autofs_wqt_t wait_queue_token, char *name)
|
||||
{
|
||||
autofs_fh_t *fh;
|
||||
mntfs *mf;
|
||||
@ -407,30 +394,30 @@ autofs_handle_missing(am_node *mp, struct autofs_packet_missing *pkt)
|
||||
struct autofs_pending_mount *p;
|
||||
int error;
|
||||
|
||||
mf = mp->am_mnt;
|
||||
mf = mp->am_al->al_mnt;
|
||||
fh = mp->am_autofs_fh;
|
||||
|
||||
p = fh->pending_mounts;
|
||||
while (p && p->wait_queue_token != pkt->wait_queue_token)
|
||||
while (p && p->wait_queue_token != wait_queue_token)
|
||||
p = p->next;
|
||||
|
||||
if (p) {
|
||||
/* already pending */
|
||||
dlog("Mounting of %s/%s already pending",
|
||||
mp->am_path, pkt->name);
|
||||
mp->am_path, name);
|
||||
amd_stats.d_drops++;
|
||||
return;
|
||||
}
|
||||
|
||||
p = ALLOC(struct autofs_pending_mount);
|
||||
p->wait_queue_token = pkt->wait_queue_token;
|
||||
p->name = strdup(pkt->name);
|
||||
p->wait_queue_token = wait_queue_token;
|
||||
p->name = xstrdup(name);
|
||||
p->next = fh->pending_mounts;
|
||||
fh->pending_mounts = p;
|
||||
|
||||
if (amuDebug(D_TRACE))
|
||||
plog(XLOG_DEBUG, "\tlookup(%s, %s)", mp->am_path, pkt->name);
|
||||
ap = mf->mf_ops->lookup_child(mp, pkt->name, &error, VLOOK_CREATE);
|
||||
plog(XLOG_DEBUG, "\tlookup(%s, %s)", mp->am_path, name);
|
||||
ap = mf->mf_ops->lookup_child(mp, name, &error, VLOOK_CREATE);
|
||||
if (ap && error < 0)
|
||||
ap = mf->mf_ops->mount_child(ap, &error);
|
||||
|
||||
@ -441,19 +428,81 @@ autofs_handle_missing(am_node *mp, struct autofs_packet_missing *pkt)
|
||||
dlog("Mount still pending, not sending autofs reply yet");
|
||||
return;
|
||||
}
|
||||
autofs_lookup_failed(mp, pkt->name);
|
||||
autofs_lookup_failed(mp, name);
|
||||
}
|
||||
mp->am_stats.s_lookup++;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
autofs_handle_expire(am_node *mp, struct autofs_packet_expire *pkt)
|
||||
{
|
||||
autofs_expire_one(mp, pkt->name, 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
autofs_handle_missing(am_node *mp, struct autofs_packet_missing *pkt)
|
||||
{
|
||||
autofs_missing_one(mp, pkt->wait_queue_token, pkt->name);
|
||||
}
|
||||
|
||||
|
||||
#if AUTOFS_MAX_PROTO_VERSION >= 4
|
||||
static void
|
||||
autofs_handle_expire_multi(am_node *mp, struct autofs_packet_expire_multi *pkt)
|
||||
{
|
||||
autofs_expire_one(mp, pkt->name, pkt->wait_queue_token);
|
||||
}
|
||||
#endif /* AUTOFS_MAX_PROTO_VERSION >= 4 */
|
||||
|
||||
|
||||
#if AUTOFS_MAX_PROTO_VERSION >= 5
|
||||
static void
|
||||
autofs_handle_expire_direct(am_node *mp,
|
||||
autofs_packet_expire_direct_t *pkt)
|
||||
{
|
||||
autofs_expire_one(mp, pkt->name, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
autofs_handle_expire_indirect(am_node *mp,
|
||||
autofs_packet_expire_indirect_t *pkt)
|
||||
{
|
||||
autofs_expire_one(mp, pkt->name, 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
autofs_handle_missing_direct(am_node *mp,
|
||||
autofs_packet_missing_direct_t *pkt)
|
||||
{
|
||||
autofs_missing_one(mp, pkt->wait_queue_token, pkt->name);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
autofs_handle_missing_indirect(am_node *mp,
|
||||
autofs_packet_missing_indirect_t *pkt)
|
||||
{
|
||||
autofs_missing_one(mp, pkt->wait_queue_token, pkt->name);
|
||||
}
|
||||
#endif /* AUTOFS_MAX_PROTO_VERSION >= 5 */
|
||||
|
||||
|
||||
int
|
||||
autofs_handle_fdset(fd_set *readfds, int nsel)
|
||||
{
|
||||
int i;
|
||||
union autofs_packet_union pkt;
|
||||
union {
|
||||
#if AUTOFS_MAX_PROTO_VERSION >= 5
|
||||
union autofs_v5_packet_union pkt5;
|
||||
#endif
|
||||
union autofs_packet_union pkt;
|
||||
} p;
|
||||
autofs_fh_t *fh;
|
||||
am_node *mp;
|
||||
size_t len;
|
||||
|
||||
for (i = 0; nsel && i < numfds; i++) {
|
||||
if (!FD_ISSET(list[i], readfds))
|
||||
@ -464,25 +513,48 @@ autofs_handle_fdset(fd_set *readfds, int nsel)
|
||||
mp = hash[list[i]];
|
||||
fh = mp->am_autofs_fh;
|
||||
|
||||
if (autofs_get_pkt(fh->fd, (char *) &pkt,
|
||||
sizeof(union autofs_packet_union)))
|
||||
#if AUTOFS_MAX_PROTO_VERSION >= 5
|
||||
if (fh->version < 5) {
|
||||
len = sizeof(p.pkt);
|
||||
} else {
|
||||
len = sizeof(p.pkt5);
|
||||
}
|
||||
#else
|
||||
len = sizeof(p.pkt);
|
||||
#endif /* AUTOFS_MAX_PROTO_VERSION >= 5 */
|
||||
|
||||
if (autofs_get_pkt(fh->fd, &p, len))
|
||||
continue;
|
||||
|
||||
switch (pkt.hdr.type) {
|
||||
switch (p.pkt.hdr.type) {
|
||||
case autofs_ptype_missing:
|
||||
autofs_handle_missing(mp, &pkt.missing);
|
||||
autofs_handle_missing(mp, &p.pkt.missing);
|
||||
break;
|
||||
case autofs_ptype_expire:
|
||||
autofs_handle_expire(mp, &pkt.expire);
|
||||
autofs_handle_expire(mp, &p.pkt.expire);
|
||||
break;
|
||||
#if AUTOFS_MAX_VERSION >= 4
|
||||
#if AUTOFS_MAX_PROTO_VERSION >= 4
|
||||
case autofs_ptype_expire_multi:
|
||||
autofs_handle_expire_multi(mp, &pkt.expire_multi);
|
||||
autofs_handle_expire_multi(mp, &p.pkt.expire_multi);
|
||||
break;
|
||||
#endif /* AUTOFS_MAX_VERSION >= 4 */
|
||||
#endif /* AUTOFS_MAX_PROTO_VERSION >= 4 */
|
||||
#if AUTOFS_MAX_PROTO_VERSION >= 5
|
||||
case autofs_ptype_expire_indirect:
|
||||
autofs_handle_expire_indirect(mp, &p.pkt5.expire_direct);
|
||||
break;
|
||||
case autofs_ptype_expire_direct:
|
||||
autofs_handle_expire_direct(mp, &p.pkt5.expire_direct);
|
||||
break;
|
||||
case autofs_ptype_missing_indirect:
|
||||
autofs_handle_missing_indirect(mp, &p.pkt5.missing_direct);
|
||||
break;
|
||||
case autofs_ptype_missing_direct:
|
||||
autofs_handle_missing_direct(mp, &p.pkt5.missing_direct);
|
||||
break;
|
||||
#endif /* AUTOFS_MAX_PROTO_VERSION >= 5 */
|
||||
default:
|
||||
plog(XLOG_ERROR, "Unknown autofs packet type %d",
|
||||
pkt.hdr.type);
|
||||
p.pkt.hdr.type);
|
||||
}
|
||||
}
|
||||
return nsel;
|
||||
@ -593,7 +665,7 @@ autofs_mount_fs(am_node *mp, mntfs *mf)
|
||||
if (target[0] != '/')
|
||||
target2 = str3cat(NULL, mp->am_parent->am_path, "/", target);
|
||||
else
|
||||
target2 = strdup(target);
|
||||
target2 = xstrdup(target);
|
||||
|
||||
/*
|
||||
* We need to stat() the destination, because the bind mount does not
|
||||
@ -683,6 +755,10 @@ autofs_umount_succeeded(am_node *mp)
|
||||
autofs_fh_t *fh = mp->am_parent->am_autofs_fh;
|
||||
struct autofs_pending_umount **pp, *p;
|
||||
|
||||
/* Already gone? */
|
||||
if (fh == NULL)
|
||||
return 0;
|
||||
|
||||
pp = &fh->pending_umounts;
|
||||
while (*pp && !STREQ((*pp)->name, mp->am_name))
|
||||
pp = &(*pp)->next;
|
||||
@ -739,7 +815,7 @@ autofs_mount_succeeded(am_node *mp)
|
||||
* but it won't do autofs filesystems, so we expire them the old
|
||||
* fashioned way instead.
|
||||
*/
|
||||
if (!(mp->am_mnt->mf_flags & MFF_IS_AUTOFS))
|
||||
if (!(mp->am_al->al_mnt->mf_flags & MFF_IS_AUTOFS))
|
||||
mp->am_flags |= AMF_NOTIMEOUT;
|
||||
|
||||
pp = &fh->pending_mounts;
|
||||
@ -799,7 +875,7 @@ autofs_compute_mount_flags(mntent_t *mnt)
|
||||
}
|
||||
|
||||
|
||||
#if AUTOFS_MAX_VERSION >= 4
|
||||
#if AUTOFS_MAX_PROTO_VERSION >= 4
|
||||
static int autofs_timeout_mp_task(void *arg)
|
||||
{
|
||||
am_node *mp = (am_node *)arg;
|
||||
@ -809,7 +885,7 @@ static int autofs_timeout_mp_task(void *arg)
|
||||
while (ioctl(fh->ioctlfd, AUTOFS_IOC_EXPIRE_MULTI, &now) == 0);
|
||||
return 0;
|
||||
}
|
||||
#endif /* AUTOFS_MAX_VERSION >= 4 */
|
||||
#endif /* AUTOFS_MAX_PROTO_VERSION >= 4 */
|
||||
|
||||
|
||||
void autofs_timeout_mp(am_node *mp)
|
||||
@ -827,9 +903,9 @@ void autofs_timeout_mp(am_node *mp)
|
||||
return;
|
||||
}
|
||||
|
||||
#if AUTOFS_MAX_VERSION >= 4
|
||||
#if AUTOFS_MAX_PROTO_VERSION >= 4
|
||||
run_task(autofs_timeout_mp_task, mp, NULL, NULL);
|
||||
#endif /* AUTOFS_MAX_VERSION >= 4 */
|
||||
#endif /* AUTOFS_MAX_PROTO_VERSION >= 4 */
|
||||
}
|
||||
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: autofs_linux.h,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $ */
|
||||
/* $NetBSD: autofs_linux.h,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Ion Badulescu
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -83,6 +79,8 @@ union autofs_packet_union {
|
||||
struct autofs_packet_missing missing;
|
||||
struct autofs_packet_expire expire;
|
||||
};
|
||||
|
||||
/* typedef unsigned long autofs_wqt_t; */
|
||||
#endif /* not HAVE_LINUX_AUTO_FS4_H */
|
||||
|
||||
#define AUTOFS_AUTO_FS_FLAGS (FS_AMQINFO | FS_DIRECTORY | FS_AUTOFS | FS_ON_AUTOFS)
|
||||
@ -101,11 +99,13 @@ union autofs_packet_union {
|
||||
#define AUTOFS_CACHEFS_FS_FLAGS (FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_CDFS_FS_FLAGS (FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_UDF_FS_FLAGS (FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_LUSTRE_FS_FLAGS (FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_EFS_FS_FLAGS (FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_LOFS_FS_FLAGS (FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_NFS_FS_FLAGS (FS_BACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_PCFS_FS_FLAGS (FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_UFS_FS_FLAGS (FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_XFS_FS_FLAGS (FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_EXT_FS_FLAGS (FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#define AUTOFS_TMPFS_FS_FLAGS (FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
|
||||
#endif /* HAVE_FS_AUTOFS */
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: autofs_solaris_v1.c,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $ */
|
||||
/* $NetBSD: autofs_solaris_v1.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Ion Badulescu
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -208,7 +204,7 @@ autofs_mount_1_req(struct mntrequest *m,
|
||||
goto out;
|
||||
}
|
||||
|
||||
mf = mp->am_mnt;
|
||||
mf = mp->am_al->al_mnt;
|
||||
isdirect = (mf->mf_fsflags & FS_DIRECT) ? 1 : 0;
|
||||
ap = mf->mf_ops->lookup_child(mp, m->name + isdirect, &err, VLOOK_CREATE);
|
||||
if (ap && err < 0)
|
||||
@ -375,7 +371,7 @@ autofs_get_fh(am_node *mp)
|
||||
{
|
||||
autofs_fh_t *fh;
|
||||
char buf[MAXHOSTNAMELEN];
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
struct utsname utsname;
|
||||
|
||||
plog(XLOG_DEBUG, "autofs_get_fh for %s", mp->am_path);
|
||||
@ -392,7 +388,7 @@ autofs_get_fh(am_node *mp)
|
||||
xstrlcat(buf, ".autofs", sizeof(buf));
|
||||
}
|
||||
#ifdef HAVE_AUTOFS_ARGS_T_ADDR
|
||||
fh->addr.buf = strdup(buf);
|
||||
fh->addr.buf = xstrdup(buf);
|
||||
fh->addr.len = fh->addr.maxlen = strlen(buf);
|
||||
#endif /* HAVE_AUTOFS_ARGS_T_ADDR */
|
||||
|
||||
@ -519,7 +515,7 @@ autofs_mount_fs(am_node *mp, mntfs *mf)
|
||||
if (target[0] != '/')
|
||||
target2 = str3cat(NULL, mp->am_parent->am_path, "/", target);
|
||||
else
|
||||
target2 = strdup(target);
|
||||
target2 = xstrdup(target);
|
||||
|
||||
plog(XLOG_INFO, "autofs: converting from link to lofs (%s -> %s)", mp->am_path, target2);
|
||||
/*
|
||||
@ -608,7 +604,7 @@ autofs_umount_succeeded(am_node *mp)
|
||||
(SVC_IN_ARG_TYPE) &res))
|
||||
svcerr_systemerr(transp);
|
||||
|
||||
dlog("Quick reply sent for %s", mp->am_mnt->mf_mount);
|
||||
dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
|
||||
XFREE(transp);
|
||||
mp->am_transp = NULL;
|
||||
}
|
||||
@ -632,7 +628,7 @@ autofs_umount_failed(am_node *mp)
|
||||
(SVC_IN_ARG_TYPE) &res))
|
||||
svcerr_systemerr(transp);
|
||||
|
||||
dlog("Quick reply sent for %s", mp->am_mnt->mf_mount);
|
||||
dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
|
||||
XFREE(transp);
|
||||
mp->am_transp = NULL;
|
||||
}
|
||||
@ -659,7 +655,7 @@ autofs_mount_succeeded(am_node *mp)
|
||||
(SVC_IN_ARG_TYPE) &res))
|
||||
svcerr_systemerr(transp);
|
||||
|
||||
dlog("Quick reply sent for %s", mp->am_mnt->mf_mount);
|
||||
dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
|
||||
XFREE(transp);
|
||||
mp->am_transp = NULL;
|
||||
}
|
||||
@ -692,7 +688,7 @@ autofs_mount_failed(am_node *mp)
|
||||
(SVC_IN_ARG_TYPE) &res))
|
||||
svcerr_systemerr(transp);
|
||||
|
||||
dlog("Quick reply sent for %s", mp->am_mnt->mf_mount);
|
||||
dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
|
||||
XFREE(transp);
|
||||
mp->am_transp = NULL;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: autofs_solaris_v1.h,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $ */
|
||||
/* $NetBSD: autofs_solaris_v1.h,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Ion Badulescu
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: autofs_solaris_v2_v3.c,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $ */
|
||||
/* $NetBSD: autofs_solaris_v2_v3.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Ion Badulescu
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -519,7 +515,7 @@ autofs_lookup_2_req(autofs_lookupargs *m,
|
||||
goto out;
|
||||
}
|
||||
|
||||
mf = mp->am_mnt;
|
||||
mf = mp->am_al->al_mnt;
|
||||
new_mp = mf->mf_ops->lookup_child(mp, m->name, &err, VLOOK_LOOKUP);
|
||||
if (!new_mp) {
|
||||
err = AUTOFS_NOENT;
|
||||
@ -588,7 +584,7 @@ autofs_mount_2_req(autofs_lookupargs *m,
|
||||
goto out;
|
||||
}
|
||||
|
||||
mf = mp->am_mnt;
|
||||
mf = mp->am_al->al_mnt;
|
||||
new_mp = mf->mf_ops->lookup_child(mp, m->name + m->isdirect, &err, VLOOK_CREATE);
|
||||
if (new_mp && err < 0) {
|
||||
/* new_mp->am_transp = transp; */
|
||||
@ -606,7 +602,7 @@ autofs_mount_2_req(autofs_lookupargs *m,
|
||||
}
|
||||
|
||||
if (gopt.flags & CFM_AUTOFS_USE_LOFS ||
|
||||
new_mp->am_mnt->mf_flags & MFF_ON_AUTOFS) {
|
||||
new_mp->am_al->al_mnt->mf_flags & MFF_ON_AUTOFS) {
|
||||
res->mr_type.status = AUTOFS_DONE;
|
||||
res->mr_type.mount_result_type_u.error = AUTOFS_OK;
|
||||
} else {
|
||||
@ -615,10 +611,10 @@ autofs_mount_2_req(autofs_lookupargs *m,
|
||||
if (new_mp->am_link)
|
||||
target = new_mp->am_link;
|
||||
else
|
||||
target = new_mp->am_mnt->mf_mount;
|
||||
target = new_mp->am_al->al_mnt->mf_mount;
|
||||
list->action.action = AUTOFS_LINK_RQ;
|
||||
list->action.action_list_entry_u.linka.dir = strdup(new_mp->am_name);
|
||||
list->action.action_list_entry_u.linka.link = strdup(target);
|
||||
list->action.action_list_entry_u.linka.dir = xstrdup(new_mp->am_name);
|
||||
list->action.action_list_entry_u.linka.link = xstrdup(target);
|
||||
list->next = NULL;
|
||||
res->mr_type.status = AUTOFS_ACTION;
|
||||
res->mr_type.mount_result_type_u.list = list;
|
||||
@ -818,7 +814,7 @@ autofs_readdir_2_req(struct autofs_rddirargs *req,
|
||||
|
||||
mp->am_stats.s_readdir++;
|
||||
req->rda_offset -= AUTOFS_DAEMONCOOKIE;
|
||||
err = mp->am_mnt->mf_ops->readdir(mp, (char *)&req->rda_offset,
|
||||
err = mp->am_al->al_mnt->mf_ops->readdir(mp, (char *)&req->rda_offset,
|
||||
&res->rd_dl, e_res, req->rda_count);
|
||||
if (err) {
|
||||
res->rd_status = AUTOFS_ECOMM;
|
||||
@ -965,7 +961,7 @@ autofs_get_fh(am_node *mp)
|
||||
{
|
||||
autofs_fh_t *fh;
|
||||
char buf[MAXHOSTNAMELEN];
|
||||
mntfs *mf = mp->am_mnt;
|
||||
mntfs *mf = mp->am_al->al_mnt;
|
||||
struct utsname utsname;
|
||||
|
||||
plog(XLOG_DEBUG, "autofs_get_fh for %s", mp->am_path);
|
||||
@ -982,7 +978,7 @@ autofs_get_fh(am_node *mp)
|
||||
xstrlcat(buf, ".autofs", sizeof(buf));
|
||||
}
|
||||
#ifdef HAVE_AUTOFS_ARGS_T_ADDR
|
||||
fh->addr.buf = strdup(buf);
|
||||
fh->addr.buf = xstrdup(buf);
|
||||
fh->addr.len = fh->addr.maxlen = strlen(buf);
|
||||
#endif /* HAVE_AUTOFS_ARGS_T_ADDR */
|
||||
|
||||
@ -1101,7 +1097,7 @@ autofs_mount_fs(am_node *mp, mntfs *mf)
|
||||
if (target[0] != '/')
|
||||
target2 = str3cat(NULL, mp->am_parent->am_path, "/", target);
|
||||
else
|
||||
target2 = strdup(target);
|
||||
target2 = xstrdup(target);
|
||||
|
||||
plog(XLOG_INFO, "autofs: converting from link to lofs (%s -> %s)", mp->am_path, target2);
|
||||
|
||||
@ -1177,7 +1173,7 @@ autofs_umount_succeeded(am_node *mp)
|
||||
(SVC_IN_ARG_TYPE) &res))
|
||||
svcerr_systemerr(transp);
|
||||
|
||||
dlog("Quick reply sent for %s", mp->am_mnt->mf_mount);
|
||||
dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
|
||||
XFREE(transp);
|
||||
mp->am_transp = NULL;
|
||||
}
|
||||
@ -1201,7 +1197,7 @@ autofs_umount_failed(am_node *mp)
|
||||
(SVC_IN_ARG_TYPE) &res))
|
||||
svcerr_systemerr(transp);
|
||||
|
||||
dlog("Quick reply sent for %s", mp->am_mnt->mf_mount);
|
||||
dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
|
||||
XFREE(transp);
|
||||
mp->am_transp = NULL;
|
||||
}
|
||||
@ -1221,7 +1217,7 @@ autofs_mount_succeeded(am_node *mp)
|
||||
* Store dev and rdev -- but not for symlinks
|
||||
*/
|
||||
if (gopt.flags & CFM_AUTOFS_USE_LOFS ||
|
||||
mp->am_mnt->mf_flags & MFF_ON_AUTOFS) {
|
||||
mp->am_al->al_mnt->mf_flags & MFF_ON_AUTOFS) {
|
||||
if (!lstat(mp->am_path, &stb)) {
|
||||
mp->am_dev = stb.st_dev;
|
||||
mp->am_rdev = stb.st_rdev;
|
||||
@ -1241,7 +1237,7 @@ autofs_mount_succeeded(am_node *mp)
|
||||
(SVC_IN_ARG_TYPE) &res))
|
||||
svcerr_systemerr(transp);
|
||||
|
||||
dlog("Quick reply sent for %s", mp->am_mnt->mf_mount);
|
||||
dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
|
||||
XFREE(transp);
|
||||
mp->am_transp = NULL;
|
||||
}
|
||||
@ -1266,7 +1262,7 @@ autofs_mount_failed(am_node *mp)
|
||||
(SVC_IN_ARG_TYPE) &res))
|
||||
svcerr_systemerr(transp);
|
||||
|
||||
dlog("Quick reply sent for %s", mp->am_mnt->mf_mount);
|
||||
dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
|
||||
XFREE(transp);
|
||||
mp->am_transp = NULL;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: autofs_solaris_v2_v3.h,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $ */
|
||||
/* $NetBSD: autofs_solaris_v2_v3.h,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2003 Ion Badulescu
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -19,11 +19,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: checkmount_aix.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: checkmount_aix.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: checkmount_bsd44.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: checkmount_bsd44.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: checkmount_default.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: checkmount_default.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: checkmount_osf.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: checkmount_osf.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: checkmount_svr4.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: checkmount_svr4.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: checkmount_ultrix.c,v 1.1.1.2 2009/03/20 20:26:50 christos Exp $ */
|
||||
/* $NetBSD: checkmount_ultrix.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: mount_aix.c,v 1.1.1.2 2009/03/20 20:26:51 christos Exp $ */
|
||||
/* $NetBSD: mount_aix.c,v 1.1.1.3 2015/01/17 16:34:16 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2009 Erez Zadok
|
||||
* Copyright (c) 1997-2014 Erez Zadok
|
||||
* Copyright (c) 1990 Jan-Simon Pendry
|
||||
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
@ -18,11 +18,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgment:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -152,12 +148,12 @@ mount_aix3(char *fsname, char *dir, int flags, int type, void *data, char *mnt_o
|
||||
idx = strchr(fsname, ':');
|
||||
if (idx) {
|
||||
*idx = '\0';
|
||||
rfs = strdup(idx + 1);
|
||||
host = strdup(fsname);
|
||||
rfs = xstrdup(idx + 1);
|
||||
host = xstrdup(fsname);
|
||||
*idx = ':';
|
||||
} else {
|
||||
rfs = strdup(fsname);
|
||||
host = strdup(am_get_hostname());
|
||||
rfs = xstrdup(fsname);
|
||||
host = xstrdup(am_get_hostname());
|
||||
}
|
||||
|
||||
size = aix5_mkvp(buf, type, flags, rfs, dir, host,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user