[comp.sources.unix] v21i090: An Automounter for NFS systems, Part02/13

rsalz@uunet.uu.net (Rich Salz) (04/11/90)

Submitted-by: Jan-Simon Pendry <jsp@doc.ic.ac.uk>
Posting-number: Volume 21, Issue 90
Archive-name: amd/part02

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 2 (of 13)."
# Contents:  Makefile Makefile.config a_master amq-man amq_svc.c
#   efs_ops.c fs.h hpux.h info_hes.c info_yp.c os-aux.h os-defaults.h
#   os-hpux.h os-type os-xinu43.h sfs_ops.c umount_fs.c uwait.h
# Wrapped by rsalz@papaya.bbn.com on Tue Apr 10 15:11:59 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(2901 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X#
X# $Id: Makefile,v 5.1.1.2 90/01/11 16:46:02 jsp Exp Locker: jsp $
X#
X# Copyright (c) 1989 Jan-Simon Pendry
X# Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X# Copyright (c) 1989 The Regents of the University of California.
X# All rights reserved.
X#
X# This code is derived from software contributed to Berkeley by
X# Jan-Simon Pendry at Imperial College, London.
X#
X# Redistribution and use in source and binary forms are permitted
X# provided that the above copyright notice and this paragraph are
X# duplicated in all such forms and that any documentation,
X# advertising materials, and other materials related to such
X# distribution and use acknowledge that the software was developed
X# by Imperial College of Science, Technology and Medicine, London, UK.
X# The names of the College and University may not be used to endorse
X# or promote products derived from this software without specific
X# prior written permission.
X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X#
X#	%W% (Berkeley) %G%
X#
X
X# -------- Users may care to over ride these values --------
XVER = ${REL}
XSHELL = /bin/sh
X
X# Machine architecture
XARCH = `PATH=$${PATH}:. sh arch`
X
X# O/S Name
XOS = `PATH=$${PATH}:. sh os-type`
X
X# version of make
XMAKE = make
XMKCOM = Makefile.com
XMKARGS = -f ${MKCOM}
X
X# -------- Users should leave the rest alone! --------
X
XOS_SUPPORTED = acis43 aix2 aux bsd44 concentrix hlh42 hpux riscix sos3 sos4 u2_2 u3_0 umax43 utx32 xinu43
XCHECK_OS = \
X	case " ${OS_SUPPORTED} " in *" $${OS} "*) ;; \
X	*) case "$${OS}" in unknown);; *) echo "Unknown OS '$${OS}'";; esac; \
X	   echo "OS should be one of ${OS_SUPPORTED}"; \
X	   exit 1;; \
X	esac
X
X#
X# "all" and "install" work in the architecture specific sub-directory.
X# The other make rules work in the source directory.
X#
X
Xall install clean lint:
X	@OS="${OS}" ARCH="${ARCH}" MKARGS="-f ../${MKCOM}"; \
X	${CHECK_OS}; \
X	case "`echo M?kefile.config`" in \
X	Makefile.config) MKARGS="$${MKARGS} -f ../Makefile.config";; \
X	esac; \
X	case "`echo M?kefile.$${OS}`" in \
X	Makefile.$${OS}) MKARGS="$${MKARGS} -f ../Makefile.$${OS}";; \
X	esac; \
X	case "`echo M?kefile.local`" in \
X	Makefile.local) MKARGS="$${MKARGS} -f ../Makefile.local";; \
X	esac; \
X	case "`echo M?kefile.local.$${OS}`" in \
X	Makefile.local.$${OS}) MKARGS="$${MKARGS} -f ../Makefile.local.$${OS}";; \
X	esac; \
X	case "`echo $${ARCH}?$${OS}`" in $${ARCH}_$${OS});; *) mkdir $${ARCH}_$${OS}; esac; \
X	echo cd $${ARCH}_$${OS}; \
X	cd $${ARCH}_$${OS}; \
X	echo $(MAKE) $${MKARGS} ARCH=$${ARCH} OS=$${OS} $@; \
X	$(MAKE) $${MKARGS} ARCH=$${ARCH} OS=$${OS} $@
X
Xco diffs release count: FRC
X	$(MAKE) ${MKARGS} ${MFLAGS} $@ OS=undef NAME=${NAME} REL=${REL} "VER=${VER}"
X
Xpat print tarfile sharfile: FRC
X	@$(MAKE) ${MKARGS} ${MFLAGS} $@ OS=undef
X
XFRC:
END_OF_FILE
if test 2901 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'Makefile.config' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile.config'\"
else
echo shar: Extracting \"'Makefile.config'\" \(2576 characters\)
sed "s/^X//" >'Makefile.config' <<'END_OF_FILE'
X#
X# $Id: Makefile.config,v 5.1.1.2 90/01/11 16:48:18 jsp Exp Locker: jsp $
X#
X# Copyright (c) 1990 Jan-Simon Pendry
X# Copyright (c) 1990 Imperial College of Science, Technology & Medicine
X# Copyright (c) 1990 The Regents of the University of California.
X# All rights reserved.
X#
X# This code is derived from software contributed to Berkeley by
X# Jan-Simon Pendry at Imperial College, London.
X#
X# Redistribution and use in source and binary forms are permitted
X# provided that the above copyright notice and this paragraph are
X# duplicated in all such forms and that any documentation,
X# advertising materials, and other materials related to such
X# distribution and use acknowledge that the software was developed
X# by Imperial College of Science, Technology and Medicine, London, UK.
X# The names of the College and University may not be used to endorse
X# or promote products derived from this software without specific
X# prior written permission.
X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X#
X#	%W% (Berkeley) %G%
X#
X
X#
X# Comment/uncomment the following lines as required
X#
X
X#
X# Where local include files are stored
X#
X#XINCLUDE = -I/usr/local/athena/include
X
X#
X# Define RESOLV if your C library does not include support
X# for Hesiod and/or Named.
X#
X#RESOLV = -lhesiod -lresolv
X
X#
X# Define XLIBDIR if you have libraries not on the standard
X# search path.
X#
X#XLIBDIR = -L/usr/local/athena/lib
X
X#
X# Define DBM if your C library does not include
X# support for gdbm and/or ndbm.
X#
X#DBM = -lgdbm #-lndbm
X
X#
X# Define RPCLIB if your C library does not include
X# support for RPC
X#
X#RPCLIB = -lrpc
X
X#
X# Include support for Yellow Pages
X#
XHAS_YP_MAPS = -DHAS_YP_MAPS
X
X#
X# Include support for file maps
X#
XHAS_FILE_MAPS = -DHAS_FILE_MAPS
X
X#
X# Include support for Hesiod
X#
X#HAS_HESIOD_MAPS = -DHAS_HESIOD_MAPS
X
X#
X# Include support for mountd
X# Not released - design not complete...
X#
X#HAS_MOUNTD_MAPS = -DHAS_MOUNTD_MAPS
X
X#
X# Include support for ndbm.
X# This removes support for gdbm and is only supported
X# if your operating system supports ndbm
X#
X#HAS_NDBM_MAPS = -DHAS_NDBM_MAPS
X
X#
X# Include support for gdbm.
X# This removes support for ndbm if your system supports it
X#
X#HAS_GDBM_MAPS = -DHAS_GDBM_MAPS
X
X
X##############################################################
X# Do NOT edit the following lines
X#
XCONFIG = ${XINCLUDE} ${HAS_YP_MAPS} ${HAS_FILE_MAPS} ${HAS_HESIOD_MAPS} \
X		${HAS_NDBM_MAPS} ${HAS_GDBM_MAPS} ${HAS_MOUNTD_MAPS}
END_OF_FILE
if test 2576 -ne `wc -c <'Makefile.config'`; then
    echo shar: \"'Makefile.config'\" unpacked with wrong size!
fi
# end of 'Makefile.config'
fi
if test -f 'a_master' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'a_master'\"
else
echo shar: Extracting \"'a_master'\" \(2535 characters\)
sed "s/^X//" >'a_master' <<'END_OF_FILE'
X#machine	opts info
Xachilles	-opts:=rw,grpid,nosuid \
X		type:=ufs;hostd==achilles.doc;dev:=/dev/xy1g \
X		type:=nfs;hostd!=achilles.doc;rhost:=achilles.doc;rfs:=/home/achilles
X#
Xdougal		-opts:=rw,grpid,nosuid \
X		type:=ufs;hostd==dougal.doc;dev:=/dev/dsk/1s0 \
X		type:=nfs;hostd!=dougal.doc;rhost:=dougal.doc;rfs:=/home/dougal
X#
Xdylan		type:=auto;fs:=${map};pref:=${key}/
Xdylan/dk2	-opts:=rw,grpid,nosuid \
X		hostd==dylan.doc;type:=ufs;dev:=/dev/dsk/2s0 \
X		hostd!=dylan.doc;type:=nfs;rhost:=dylan.doc;rfs:=/home/dylan/dk2
X#
Xdylan/dk3	-opts:=rw,grpid,nosuid \
X		hostd==dylan.doc;type:=ufs;dev:=/dev/dsk/3s0 \
X		hostd!=dylan.doc;type:=nfs;rhost:=dylan.doc;rfs:=/home/dylan/dk3
X#
Xdylan/dk5	-opts:=rw,grpid,nosuid \
X		hostd==dylan.doc;type:=ufs;dev:=/dev/dsk/5s0 \
X		hostd!=dylan.doc;type:=nfs;rhost:=dylan.doc;rfs:=/home/dylan/dk5
X#
Xganymede	-opts:=rw,grpid,nosuid \
X		hostd!=${key}.${domain};type:=nfs;rhost:=${key}.${domain};rfs:=/home/${key}
Xgummo		-opts:=rw,grpid,nosuid \
X		hostd!=gummo.doc;type:=nfs;rhost:=gummo.doc;rfs:=/home/gummo
X#
X# Wildcard match
X*		-opts:=rw,grpid,nosuid \
X		hostd!=${key}.${domain};type:=nfs;rhost:=${key}.${domain};rfs:=/home/${key}
X#
X#
Xgould		-opts:=rw,grpid,nosuid \
X		hostd!=gould.doc;type:=nfs;rhost:=gould.doc;rfs:=/home/gould
Xtoytown		-opts:=rw,grpid,nosuid \
X		hostd!=toytown.doc;type:=nfs;rhost:=toytown.doc;rfs:=/home/${key}
Xzebedee		-opts:=rw,grpid,nosuid \
X		hostd!=zebedee.doc;type:=nfs;rhost:=zebedee.doc;rfs:=/home/zebedee
X#
X# Should be ENOENT from mountd on toytown...
X#
Xtesting		-opts:=rw,grpid,nosuid \
X		hostd!=toytown.doc;type:=nfs;rhost:=toytown.doc;rfs:=/this/that
X#
X# Somewhere else
X#
Xpebbles		-opts:=rw,grpid,nosuid \
X		hostd!=pebbles.cc;type:=nfs;rhost:=pebbles.cc;rfs:=/home/cc/pebbles
X#
X# Specify where to mount
X#
Xxtoy		-opts:=rw,grpid,nosuid \
X		type:=nfs;rhost:=toytown.doc;rfs:=/home/toytown;fs:=/tmp/junk99
X#
X# Links...
X#
Xalink		type:=link;hostd==achilles.doc;fs:=/etc
Xtlink		type:=link;hostd==truth.doc;fs:=/etc
Xuucp		type:=link;hostd==truth.doc;fs:=/etc;sublink:=uucp
X#
X# Duplicate mounts to the same place
X#
Xdup1		-opts:=rw,grpid,nosuid \
X		type:=nfs;rhost:=toytown.doc;rfs:=/home/toytown;fs:=/tmp/tt-home
Xdup2		-opts:=rw,grpid,nosuid \
X		type:=nfs;rhost:=ganymede.doc;rfs:=/home/ganymede;fs:=/tmp/tt-home
X#
X# Symlink
X#
Xlink		type:=link;fs:=dylan/dk2/adh
X#
X# Program mount
X#
Xexec		type:=program;mount:="/bin/true false";unmount:="/bin/true true"
X#
X# Alternate mount locations.
X#
Xalt		-host==truth;type:=nfs;rfs:=/var/spool/mail \
X			rhost:=toytown rhost:=charm rhost:=gummo
END_OF_FILE
if test 2535 -ne `wc -c <'a_master'`; then
    echo shar: \"'a_master'\" unpacked with wrong size!
fi
# end of 'a_master'
fi
if test -f 'amq-man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'amq-man'\"
else
echo shar: Extracting \"'amq-man'\" \(2965 characters\)
sed "s/^X//" >'amq-man' <<'END_OF_FILE'
X'\" $Id: amq-man,v 5.1.1.1 90/01/11 16:59:39 jsp Exp Locker: jsp $
X'\" Copyright (c) 1990 Jan-Simon Pendry
X'\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
X'\" Copyright (c) 1990 The Regents of the University of California.
X'\" All rights reserved.
X'\"
X'\" This code is derived from software contributed to Berkeley by
X'\" Jan-Simon Pendry at Imperial College, London.
X'\"
X'\" Redistribution and use in source and binary forms are permitted
X'\" provided that the above copyright notice and this paragraph are
X'\" duplicated in all such forms and that any documentation,
X'\" advertising materials, and other materials related to such
X'\" distribution and use acknowledge that the software was developed
X'\" by Imperial College of Science, Technology and Medicine, London, UK.
X'\" The names of the College and University may not be used to endorse
X'\" or promote products derived from this software without specific
X'\" prior written permission.
X'\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X'\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X'\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X'\"
X'\"	%W% (Berkeley) %G%
X'\"
X.TH AMQ 8 "25 April 1989"
X.SH NAME
Xamq \- automounter query tool
X.SH SYNOPSIS
X.B amq
X[
X.BI \-h " hostname"
X] [
X.B \-f
X] [
X.B \-m
X] [
X.B \-s
X] [
X.B \-u
X]
X[
X.I directory
X] .\|.\|.
X.SH DESCRIPTION
X.B Amq
Xprovides a simple way of determining the current state of
X.B amd
Xprogram.
XCommunication is by
X.SM RPC.
XThree modes of operation are supported by the current protocol.
XBy default a list of mount points and auto-mounted filesystems
Xis output.
XAn alternative host can be specified using the
X.I \-h
Xoption.
X.LP
XIf directory names are given, as output by default,
Xthen per-filesystem information is displayed.
X.SH OPTIONS
XThe
X.I \-h
Xoption specifies an alternate host to query.
XBy default the local host is used.  In an
X.SM HP-UX
Xcluster, the root server is queried by default, since
Xthat is the system on which the automounter is normally run.
X.LP
XThe
X.I \-f option asks the automounter to flush the internal
Xmount map cache.
XThe
X.I \-m
Xoption asks the automounter to provide a list of mounted filesystems,
Xincluding the number of references to each filesystem and any error
Xwhich occured while mounting.
XThe
X.I \-s
Xoption asks the automounter to provide system-wide mount statistics.
X.LP
XThe
X.I \-u
Xoption asks the automounter to unmount the named filesystems
Xinstead of providing information about them.  Unmounts are requested,
Xnot forced.  They merely cause the mounted filesystem to timeout,
Xwhich will be picked up by
X.BR amd 's
Xmain scheduler thus causing the normal timeout action to be taken.
X.SH FILES
X.PD 0
X.TP 20
X.B amq.x
X.SM RPC
Xprotocol description.
X.SH CAVEATS
X.B Amq
Xuses a Sun registered
X.SM RPC
Xprogram number (300019 decimal) which may not
Xbe in the /etc/rpc database.
X.SH "SEE ALSO"
X.BR amd (8)
X.SH AUTHOR
XJan-Simon Pendry <jsp@doc.ic.ac.uk>
END_OF_FILE
if test 2965 -ne `wc -c <'amq-man'`; then
    echo shar: \"'amq-man'\" unpacked with wrong size!
fi
# end of 'amq-man'
fi
if test -f 'amq_svc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'amq_svc.c'\"
else
echo shar: Extracting \"'amq_svc.c'\" \(2993 characters\)
sed "s/^X//" >'amq_svc.c' <<'END_OF_FILE'
X/*
X * $Id: amq_svc.c,v 5.1.1.1 90/01/11 17:04:11 jsp Exp Locker: jsp $
X *
X * Copyright (c) 1990 Jan-Simon Pendry
X * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1990 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X#include "am.h"
X#include "amq.h"
Xextern bool_t xdr_amq_mount_info_qelem();
X
Xvoid
Xamq_program_1(rqstp, transp)
X	struct svc_req *rqstp;
X	SVCXPRT *transp;
X{
X	union {
X		amq_string amqproc_mnttree_1_arg;
X		amq_string amqproc_umnt_1_arg;
X		amq_setopt amqproc_setopt_1_arg;
X	} argument;
X	char *result;
X	bool_t (*xdr_argument)(), (*xdr_result)();
X	char *(*local)();
X
X	switch (rqstp->rq_proc) {
X	case AMQPROC_NULL:
X		xdr_argument = xdr_void;
X		xdr_result = xdr_void;
X		local = (char *(*)()) amqproc_null_1;
X		break;
X
X	case AMQPROC_MNTTREE:
X		xdr_argument = xdr_amq_string;
X		xdr_result = xdr_amq_mount_tree_p;
X		local = (char *(*)()) amqproc_mnttree_1;
X		break;
X
X	case AMQPROC_UMNT:
X		xdr_argument = xdr_amq_string;
X		xdr_result = xdr_void;
X		local = (char *(*)()) amqproc_umnt_1;
X		break;
X
X	case AMQPROC_STATS:
X		xdr_argument = xdr_void;
X		xdr_result = xdr_amq_mount_stats;
X		local = (char *(*)()) amqproc_stats_1;
X		break;
X
X	case AMQPROC_EXPORT:
X		xdr_argument = xdr_void;
X		xdr_result = xdr_amq_mount_tree_list;
X		local = (char *(*)()) amqproc_export_1;
X		break;
X
X	case AMQPROC_SETOPT:
X		xdr_argument = xdr_amq_setopt;
X		xdr_result = xdr_int;
X		local = (char *(*)()) amqproc_setopt_1;
X		break;
X
X	case AMQPROC_GETMNTFS:
X		xdr_argument = xdr_void;
X		xdr_result = xdr_amq_mount_info_qelem;
X		local = (char *(*)()) amqproc_getmntfs_1;
X		break;
X
X	default:
X		svcerr_noproc(transp);
X		return;
X	}
X	bzero((char *)&argument, sizeof(argument));
X	if (!svc_getargs(transp, xdr_argument, &argument)) {
X		svcerr_decode(transp);
X		return;
X	}
X	result = (*local)(&argument, rqstp);
X	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
X		svcerr_systemerr(transp);
X	}
X	if (!svc_freeargs(transp, xdr_argument, &argument)) {
X		plog(XLOG_FATAL, "unable to free rpc arguments in amqprog_1");
X		going_down(1);
X	}
X}
X
END_OF_FILE
if test 2993 -ne `wc -c <'amq_svc.c'`; then
    echo shar: \"'amq_svc.c'\" unpacked with wrong size!
fi
# end of 'amq_svc.c'
fi
if test -f 'efs_ops.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'efs_ops.c'\"
else
echo shar: Extracting \"'efs_ops.c'\" \(2545 characters\)
sed "s/^X//" >'efs_ops.c' <<'END_OF_FILE'
X/*
X * $Id: efs_ops.c,v 5.1.1.2 90/01/11 17:06:03 jsp Exp Locker: jsp $
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X#include "am.h"
X
X#ifdef HAS_EFS
X
X/*
X * Error file system.
X * This is used as a last resort catchall if
X * nothing else worked.  EFS just returns lots
X * of error codes, except for unmount which
X * always works of course.
X */
X
X/*
X * EFS file system always matches
X */
Xstatic int efs_match(fo)
Xam_opts *fo;
X{
X	fo->fs_mtab = strealloc(fo->fs_mtab, "(error-hook)");
X	return 1;
X}
X
X/*ARGSUSED*/
Xstatic int efs_mount(mp)
Xam_node *mp;
X{
X	return ENOENT;
X}
X
X/*ARGSUSED*/
Xstatic int efs_umount(mp)
Xam_node *mp;
X{
X	/*
X	 * Always succeed
X	 */
X
X	return 0;
X}
X
X/*
X * EFS interface to RPC lookup() routine.
X * Should never get here in the automounter.
X * If we do then just give an error.
X */
X/*ARGSUSED*/
Xam_node *efs_lookuppn(mp, fname, error_return, op)
Xam_node *mp;
Xchar *fname;
Xint *error_return;
Xint op;
X{
X	*error_return = ESTALE;
X	return 0;
X}
X
X/*
X * EFS interface to RPC readdir() routine.
X * Should never get here in the automounter.
X * If we do then just give an error.
X */
X/*ARGSUSED*/
Xint efs_readdir(mp, cookie, dp, ep)
Xam_node *mp;
Xnfscookie cookie;
Xdirlist *dp;
Xentry *ep;
X{
X	return ESTALE;
X}
X
X/*
X * Ops structure
X */
Xam_ops efs_ops = {
X	"error",
X	efs_match,
X	0, /* efs_init */
X	efs_mount,
X	efs_umount,
X	efs_lookuppn,
X	efs_readdir,
X	0, /* efs_readlink */
X	0, /* efs_mounted */
X	0, /* efs_umounted */
X	find_afs_srvr,
X	FS_DISCARD,
X	&afs_srvr_list
X};
X
X#endif
END_OF_FILE
if test 2545 -ne `wc -c <'efs_ops.c'`; then
    echo shar: \"'efs_ops.c'\" unpacked with wrong size!
fi
# end of 'efs_ops.c'
fi
if test -f 'fs.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fs.h'\"
else
echo shar: Extracting \"'fs.h'\" \(2806 characters\)
sed "s/^X//" >'fs.h' <<'END_OF_FILE'
X/* $Id: fs.h,v 5.1 89/11/17 18:19:58 jsp Exp Locker: jsp $ */
X
X/*
X * File system types
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X/*
X * Automount File System
X */
X#define HAS_AFS
Xextern am_ops	afs_ops;	/* Automount file system (this!) */
Xextern qelem	afs_srvr_list;
Xextern fserver *find_afs_srvr P((mntfs*));
X
X
X/*
X * Direct Automount File System
X */
X#define	HAS_DFS
Xextern am_ops	dfs_ops;	/* Direct Automount file system (this too) */
X
X/*
X * Error File System
X */
X#define HAS_EFS
Xextern am_ops	efs_ops;	/* Error file system */
X
X/*
X * Inheritance File System
X */
X#define HAS_IFS
Xextern am_ops	ifs_ops;	/* Inheritance file system */
X
X/*
X * Loopback File System
X * LOFS is optional - you can compile without it.
X */
X#ifdef OS_HAS_LOFS
X/*
X * Most systems can't support this, and in
X * any case most of the functionality is
X * available with Symlink FS.  In fact,
X * lofs_ops is not yet available.
X */
X#define HAS_LOFS
Xextern am_ops lofs_ops;
X#endif
X
X/*
X * Netw*rk File System
X * Good, slow, NFS.
X */
X#define HAS_NFS
Xextern am_ops	nfs_ops;	/* NFS */
Xextern qelem	nfs_srvr_list;
Xextern fserver *find_nfs_srvr P((mntfs*));
X
X/*
X * Program File System
X * PFS is optional - you can compile without it.
X * This is useful for things like RVD.
X */
X#define HAS_PFS
Xextern am_ops	pfs_ops;	/* PFS */
X
X/*
X * Translucent File System
X * TFS is optional - you can compile without it.
X * This is just plain cute.
X */
X#ifdef notdef
Xextern am_ops	tfs_ops;	/* TFS */
X#endif
X#undef	HAS_TFS
X
X/*
X * Un*x File System
X * Normal local disk file system.
X */
X#define HAS_UFS
Xextern am_ops	ufs_ops;	/* Un*x file system */
X
X/*
X * Symbolic-link file system
X * A "filesystem" which is just a symbol link.
X */
X#define HAS_SFS
Xextern am_ops	sfs_ops;	/* Symlink FS */
END_OF_FILE
if test 2806 -ne `wc -c <'fs.h'`; then
    echo shar: \"'fs.h'\" unpacked with wrong size!
fi
# end of 'fs.h'
fi
if test -f 'hpux.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'hpux.h'\"
else
echo shar: Extracting \"'hpux.h'\" \(2335 characters\)
sed "s/^X//" >'hpux.h' <<'END_OF_FILE'
X/*
X * $Id: hpux.h,v 5.1 89/11/17 18:23:04 jsp Exp Locker: jsp $
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X/*
X * These definitions are from <nfs/nfs.h>
X * Unfortunately, that file cannot be included
X * because it contains lots of structure definitions
X * that are not wanted (they produce name clashes).
X * Isn't HP-UX wonderful!
X */
X
X/*
X * HP-UX specific definitions
X */
Xstruct nfs_args {
X	struct sockaddr_in	*addr;		/* file server address */
X	fhandle_t		*fh;		/* File handle to be mounted */
X	int			flags;		/* flags */
X	int			wsize;		/* write size in bytes */
X	int			rsize;		/* read size in bytes */
X	int			timeo;		/* initial timeout in .1 secs */
X	int			retrans;	/* times to retry send */
X	char			*hostname;	/* server's name */
X};
X
X/*
X * NFS mount option flags
X */
X#define	NFSMNT_SOFT	0x001	/* soft mount (hard is default) */
X#define	NFSMNT_WSIZE	0x002	/* set write size */
X#define	NFSMNT_RSIZE	0x004	/* set read size */
X#define	NFSMNT_TIMEO	0x008	/* set initial timeout */
X#define	NFSMNT_RETRANS	0x010	/* set number of request retrys */
X#define	NFSMNT_HOSTNAME	0x020	/* set hostname for error printf */
X#define	NFSMNT_INT	0x040	/* set option to have interruptable mounts */
X#define	NFSMNT_NODEVS   0x080   /* turn off device file access (default on) */
END_OF_FILE
if test 2335 -ne `wc -c <'hpux.h'`; then
    echo shar: \"'hpux.h'\" unpacked with wrong size!
fi
# end of 'hpux.h'
fi
if test -f 'info_hes.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'info_hes.c'\"
else
echo shar: Extracting \"'info_hes.c'\" \(2595 characters\)
sed "s/^X//" >'info_hes.c' <<'END_OF_FILE'
X/*
X * $Id: info_hes.c,v 5.1.1.1 89/11/28 17:46:59 jsp Exp Locker: jsp $
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X/*
X * Get info from Hesiod
X */
X
X#include "am.h"
X
X#ifdef HAS_HESIOD_MAPS
X#include <hesiod.h>
X
X#define	HES_PREFIX	"hesiod."
X#define	HES_PREFLEN	7
X
X/*
X * No way to probe the server - check the map name begins with "hesiod."
X */
Xhesiod_init(map)
Xchar *map;
X{
X	return strncmp(map, HES_PREFIX, HES_PREFLEN) == 0 ? 0 : ENOENT;
X}
X
X
X/*
X * Do a Hesiod nameserver call.
X * Modify time is ignored by Hesiod - XXX
X */
Xint hesiod_search(m, map, key, pval, tp)
Xmnt_map *m;
Xchar *map;
Xchar *key;
Xchar **pval;
Xtime_t *tp;
X{
X	int error;
X	char hes_map[MAXPATHLEN];
X	char **rvec;
X	/*
X	 * Make Hesiod name.  Skip past the "hesiod."
X	 * at the start of the map name and append
X	 * ".automount".  The net effect is that a lookup
X	 * of /defaults in hesiod.home will result in a
X	 * call to hes_resolve("/defaults", "home.automount");
X	 */
X	sprintf(hes_map, "%s%s", map + HES_PREFLEN, ".automount");
X	/*
X	 * Call the resolver
X	 */
X	rvec = hes_resolve(key, hes_map);
X	/*
X	 * If a reply was forthcoming then return
X	 * it (and free subsequent replies)
X	 */
X	if (rvec && *rvec) {
X		*pval = *rvec;
X		while (*++rvec)
X			free(*rvec);
X		return 0;
X	}
X
X	/*
X	 * Otherwise reflect the hesiod error into a Un*x error
X	 */
X	switch (hes_error()) {
X	case HES_ER_NOTFOUND:	error = ENOENT; break;
X	case HES_ER_CONFIG:	error = EIO; break;
X	case HES_ER_NET:	error = ETIMEDOUT; break;
X	default:		error = EINVAL; break;
X	}
X	return error;
X}
X#endif
END_OF_FILE
if test 2595 -ne `wc -c <'info_hes.c'`; then
    echo shar: \"'info_hes.c'\" unpacked with wrong size!
fi
# end of 'info_hes.c'
fi
if test -f 'info_yp.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'info_yp.c'\"
else
echo shar: Extracting \"'info_yp.c'\" \(2555 characters\)
sed "s/^X//" >'info_yp.c' <<'END_OF_FILE'
X/*
X * $Id: info_yp.c,v 5.1 89/11/17 18:20:22 jsp Exp Locker: jsp $
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X/*
X * Get info from YP map
X */
X
X#include "am.h"
X
X#ifdef HAS_YP_MAPS
X#include <rpcsvc/yp_prot.h>
X#include <rpcsvc/ypclnt.h>
X
X/*
X * Figure out the yp domain name
X */
Xstatic int determine_yp_domain(P_void)
X{
Xstatic	 char default_domain[YPMAXDOMAIN];
X
X	if (getdomainname(default_domain, sizeof(default_domain)) < 0) {
X		plog(XLOG_ERROR, "getdomainname: %m");
X		return EIO;
X	}
X
X	domain = default_domain;
X	if (!*domain) {
X		plog(XLOG_ERROR, "YP domain name is not set");
X		return ENOENT;
X	}
X
X	return 0;
X}
X
X/*
X * Try to locate a key using Yellow Pages.
X * Modify time is ignored in YP - XXX
X */
Xint yp_search(m, map, key, val, tp)
Xmnt_map *m;
Xchar *map;
Xchar *key;
Xchar **val;
Xtime_t *tp;
X{
X	int outlen;
X	int res;
X
X	if (!domain) {
X		int error = determine_yp_domain();
X		if (error)
X			return error;
X	}
X
X	res = yp_match(domain, map, key, strlen(key), val, &outlen);
X
X	/*
X	 * Do something interesting with the return code
X	 */
X	switch (res) {
X	case 0:
X		return 0;
X
X	case YPERR_KEY:
X		return ENOENT;
X
X	default:
X		plog(XLOG_ERROR, "%s: %s", map, yperr_string(res));
X		return EIO;
X	}
X}
X
Xint yp_init(map)
Xchar *map;
X{
X	char *name = 0;
X
X	if (!domain) {
X		int error = determine_yp_domain();
X		if (error)
X			return error;
X	}
X
X	/*
X	 * To see if the map exists, try to find
X	 * a master for it.
X	 */
X	if (yp_master(domain, map, &name))
X		return ENOENT;
X	free(name);
X	return 0;
X}
X#endif
END_OF_FILE
if test 2555 -ne `wc -c <'info_yp.c'`; then
    echo shar: \"'info_yp.c'\" unpacked with wrong size!
fi
# end of 'info_yp.c'
fi
if test -f 'os-aux.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'os-aux.h'\"
else
echo shar: Extracting \"'os-aux.h'\" \(2713 characters\)
sed "s/^X//" >'os-aux.h' <<'END_OF_FILE'
X/* $Id: os-aux.h,v 5.1 89/11/17 18:22:42 jsp Exp Locker: jsp $ */
X
X/*
X * A/UX macII definitions for Amd (automounter)
X * Contributed by Julian Onions <jpo@cs.nott.ac.uk>
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X/*
X * Does the compiler grok void *
X */
X#define	VOIDP
X
X/*
X * Which version of the Sun RPC library we are using
X * This is the implementation release number, not
X * the protocol revision number.
X */
X#define	RPC_3
X
X/*
X * Which version of the NFS interface are we using.
X * This is the implementation release number, not
X * the protocol revision number.
X */
X#define	NFS_3
X
X/*
X * Byte ordering
X */
X#undef ARCH_ENDIAN
X#define	ARCH_ENDIAN	"big"
X
X/*
X * Has support for syslog()
X */
X#define HAS_SYSLOG
X
X/*
X * No support for ndbm
X */
X#undef OS_HAS_NDBM
X
X/*
X * Name of filesystem types
X */
X#define	MOUNT_TYPE_UFS	MOUNT_UFS
X#define MOUNT_TYPE_NFS MOUNT_NFS
X
X#undef MTAB_TYPE_UFS
X#define	MTAB_TYPE_UFS	"5.2"
X
X#define SIGCHLD	SIGCLD
X#define	SYS5_SIGNALS
X
X/*
X * Use <fcntl.h> rather than <sys/file.h>
X */
X#define USE_FCNTL
X
X/*
X * Use fcntl() rather than flock()
X */
X#define LOCK_FCNTL
X
X#ifdef __GNUC__
X#define alloca(sz) __builtin_alloca(sz)
X#endif
X
X#define	bzero(ptr, len)	memset(ptr, 0, len)
X#define bcopy(from, to, len) memcpy(to, from, len)
X#define getpagesize() (2048)
X#undef MOUNT_TRAP
X#define MOUNT_TRAP(type, mnt, flags, mnt_data) \
X	fsmount(type, mnt->mnt_dir, flags, mnt_data)
X#undef UNMOUNT_TRAP
X#define	UNMOUNT_TRAP(mnt)	unmount(mnt->mnt_dir)
X#define NFDS	30	/* conservative */
X
X/* not included in sys/param.h */
X#include <sys/types.h>
X/* not part of sys/time.h */
X#include <time.h>
X/* for NMOUNT */
X#include <sys/config.h>
END_OF_FILE
if test 2713 -ne `wc -c <'os-aux.h'`; then
    echo shar: \"'os-aux.h'\" unpacked with wrong size!
fi
# end of 'os-aux.h'
fi
if test -f 'os-defaults.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'os-defaults.h'\"
else
echo shar: Extracting \"'os-defaults.h'\" \(2660 characters\)
sed "s/^X//" >'os-defaults.h' <<'END_OF_FILE'
X/* $Id: os-defaults.h,v 5.1.1.1 89/11/28 18:02:38 jsp Exp Locker: jsp $ */
X
X/*
X * Common OS definitions.  These may be overridden in
X * the OS specific files ("os-foo.h").
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X/*
X * What level of AMD are we backward compatible with?
X * This only applies to externally visible characteristics.
X * Rev.Minor.Branch.Patch (2 digits each)
X */
X#define	AMD_COMPAT	5000000		/* 5.0 */
X
X/*
X * Is the mount table mirrored in software
X */
X#define	UPDATE_MTAB
X
X/*
X * Where to get union wait
X */
X#define	WAIT	<sys/wait.h>
X
X/*
X * Where to get mount entry info
X */
X#define	MNTENT_HDR	<mntent.h>
X
X/*
X * Include support for syslog()
X */
X#define	HAS_SYSLOG
X
X/*
X * Byte ordering
X */
X#define	ARCH_ENDIAN	"unknown"
X
X/*
X * Name of filesystem types
X */
X#define	MTAB_TYPE_NFS	"nfs"
X#define	MTAB_TYPE_UFS	"4.2"
X
X/*
X * Name of mount & unmount system calls
X *
X * NOTE:
X *  UNMOUNT_TRAP takes a struct mntent *
X */
X#define	MOUNT_TRAP(type, mnt, flags, mnt_data) \
X	mount(type, mnt->mnt_dir, flags, mnt_data)
X#define	UNMOUNT_TRAP(mnt)	unmount(mnt->mnt_dir)
X
X/*
X * How to unmount filesystems.
X * NEED_UMOUNT_FS includes code to scan the mount table
X * to find the correct information for the unmount system
X * call.  Some systems, such as 4.4bsd, do not require
X * this - they can just do an unmount system call directly.
X */
X#define	NEED_UMOUNT_FS
X#define	UMOUNT_FS(dir)	umount_fs(dir)
X
X/*
X * Type of a file handle
X */
X#define	NFS_FH_TYPE	fhandle_t *
X
X/*
X * Type of filesystem type
X */
X#define	MTYPE_TYPE	int
X
X/*
X * How to get a mount list
X */
X#define	READ_MTAB_FROM_FILE
END_OF_FILE
if test 2660 -ne `wc -c <'os-defaults.h'`; then
    echo shar: \"'os-defaults.h'\" unpacked with wrong size!
fi
# end of 'os-defaults.h'
fi
if test -f 'os-hpux.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'os-hpux.h'\"
else
echo shar: Extracting \"'os-hpux.h'\" \(2885 characters\)
sed "s/^X//" >'os-hpux.h' <<'END_OF_FILE'
X/* $Id: os-hpux.h,v 5.1.1.1 89/11/28 18:04:01 jsp Exp Locker: jsp $ */
X
X/*
X * HP/9000 HP-UX definitions for Amd (automounter)
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X/*
X * Does the compiler grok void *
X */
X#ifdef __GNUC__
X#define	VOIDP
X#endif
X
X/*
X * Which version of the Sun RPC library we are using
X * This is the implementation release number, not
X * the protocol revision number.
X */
X#define	RPC_3
X
X/*
X * Which version of the NFS interface are we using.
X * This is the implementation release number, not
X * the protocol revision number.
X */
X#define	NFS_3
X
X/*
X * Byte ordering
X */
X#undef ARCH_ENDIAN
X#if defined(hp9000s200) || defined(hp9000s300)
X#define	ARCH_ENDIAN	"big"
X#endif
X/*
X#if defined(hp9000s800)
X#define ARCH_ENDIAN	"unknown"
X#endif
X*/
X
X/*
X * No support for syslog()
X */
X#undef HAS_SYSLOG
X
X/*
X * No support for ndbm
X */
X#undef OS_HAS_NDBM
X
X/*
X * Name of filesystem types
X */
X#define	MOUNT_TYPE_UFS	MOUNT_UFS
X#define MOUNT_TYPE_NFS MOUNT_NFS
X#undef MTAB_TYPE_UFS
X#define	MTAB_TYPE_UFS	"hfs"
X
X/*
X * Where to get NFS definitions
X */
X#define	NFS_HDR "hpux.h"
X
X/*
X * Where to get union wait
X */
X#undef WAIT
X#define	WAIT	"uwait.h"
X#define SIGCHLD	SIGCLD
X#define	SYS5_SIGNALS
X
X/*
X * Miscellaneous HP-UX definitions
X */
X
X#define	MISC_RPC
X
X/*
X * Use <fcntl.h> rather than <sys/file.h>
X */
X#define USE_FCNTL
X
X/*
X * Use fcntl() rather than flock()
X */
X#define LOCK_FCNTL
X
X#ifdef __GNUC__
X#define alloca(sz) __builtin_alloca(sz)
X#endif
X#define	bzero(ptr, len)	memset(ptr, 0, len)
X#define bcopy(from, to, len) memcpy(to, from, len)
X#define getpagesize() (2048)
X#undef MOUNT_TRAP
X#define MOUNT_TRAP(type, mnt, flags, mnt_data) \
X	vfsmount(type, mnt->mnt_dir, flags, mnt_data)
X#undef UNMOUNT_TRAP
X#define	UNMOUNT_TRAP(mnt)	umount(mnt->mnt_dir)
X#define NFDS	30	/* conservative */
X#define	MOUNTED MNT_MNTTAB
END_OF_FILE
if test 2885 -ne `wc -c <'os-hpux.h'`; then
    echo shar: \"'os-hpux.h'\" unpacked with wrong size!
fi
# end of 'os-hpux.h'
fi
if test -f 'os-type' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'os-type'\"
else
echo shar: Extracting \"'os-type'\" \(2728 characters\)
sed "s/^X//" >'os-type' <<'END_OF_FILE'
X#!/bin/sh
X#
X# $Id: os-type,v 5.1.1.2 90/01/11 17:16:09 jsp Exp Locker: jsp $
X#
X# Copyright (c) 1989 Jan-Simon Pendry
X# Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X# Copyright (c) 1989 The Regents of the University of California.
X# All rights reserved.
X#
X# This code is derived from software contributed to Berkeley by
X# Jan-Simon Pendry at Imperial College, London.
X#
X# Redistribution and use in source and binary forms are permitted
X# provided that the above copyright notice and this paragraph are
X# duplicated in all such forms and that any documentation,
X# advertising materials, and other materials related to such
X# distribution and use acknowledge that the software was developed
X# by Imperial College of Science, Technology and Medicine, London, UK.
X# The names of the College and University may not be used to endorse
X# or promote products derived from this software without specific
X# prior written permission.
X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X#
X#	%W% (Berkeley) %G%
X#
X
X#
X# Take a pot-shot at your os type
X#
Xecho "	... No OS= option specified; dynamically determining OS type" >&2
X
X#
X# First try poking around in /etc/motd
X#
X
Xcase "`exec 2>/dev/null; head -2 /etc/motd`" in
X*"Sun UNIX 4.2 Release 3."*)	OS=sos3;;
X*"SunOS Release 4."*)		OS=sos4;;
X*"HP-UX on the HP"*)		OS=hpux;;
X*"Ultrix V2."*)			OS=u2_2;;
X*"Ultrix-32 V3."*)		OS=u3_0;;
X*"Ultrix Worksystem V2.0"*)	OS=u3_0;;
X*"HLH OTS Version 1."*)		OS=hlh42;;
X*"RISC iX release 1."*)		OS=riscix;;
X*"4.4 BSD UNIX"*)		OS=bsd44;;
X*"4.3 BSD UNIX"*)		if [ -f /etc/minidisk ]; then
X					OS=acis43
X				elif [ -f /sbin/nfsiod ]; then
X					OS=bsd44	# prototype
X				else
X					OS=xinu43
X				fi;;
X*"Alliant Concentrix"*)		OS=concentrix;;
X*"Umax 4.3"*)			OS=umax43;;
X*)
X#
X# Well, that didn't work so apply some heuristics
X# to the filesystem name space...
X#
X				echo "	... inspecting File system ..." >&2
X				if [ -f /usr/bin/cat ]; then
X					OS=sos4
X				elif [ -f /etc/nd ]; then
X					OS=sos3
X				elif [ -f /etc/elcsd ]; then
X					echo "	... Ultrix - assuming U3.0 ..." >&2
X					OS=u3_0
X				elif [ -f /hp-ux ]; then
X					OS=hpux
X				elif [ -f /etc/ttylocal ]; then
X					OS=xinu43
X				elif [ -f /etc/minidisk ]; then
X					OS=acis43
X				elif [ -f /etc/toolboxdaemon ]; then
X					OS=aux
X				elif [ -f /sbin/nfsiod ]; then
X					OS=bsd44
X				elif [ -d /vrm ]; then
X					OS=aix2
X				else
X					case "`(sh arch)2>/dev/null`" in
X					powernode) OS=utx32;;
X					ibm032)    OS=acis43;;
X					*)	   OS=unknown;;
X					esac
X				fi;;
Xesac
X
Xecho "	... OS appears to be \"${OS}\"" >&2
Xecho "${OS}"
Xexit 0
END_OF_FILE
if test 2728 -ne `wc -c <'os-type'`; then
    echo shar: \"'os-type'\" unpacked with wrong size!
fi
chmod +x 'os-type'
# end of 'os-type'
fi
if test -f 'os-xinu43.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'os-xinu43.h'\"
else
echo shar: Extracting \"'os-xinu43.h'\" \(2563 characters\)
sed "s/^X//" >'os-xinu43.h' <<'END_OF_FILE'
X/* $Id: os-xinu43.h,v 5.1.1.2 89/11/28 18:05:43 jsp Exp Locker: jsp $ */
X
X/*
X * mt Xinu 4.3 (MORE/bsd) definitions for Amd (automounter)
X * Should work on both Vax and HP ...
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X/*
X * Does the compiler grok void *
X */
X#define	VOIDP
X
X/*
X * Which version of the Sun RPC library we are using
X * This is the implementation release number, not
X * the protocol revision number.
X */
X#define	RPC_4
X
X/*
X * mt Xinu have a compatibility problem
X * with getreq vs. getreqset.  On SunOS
X * getreqset takes a pointer to an fd_set,
X * whereas on MORE/bsd, getreq takes a
X * fd_set directly (cf. an integer on SunOS).
X */
X#define	svc_getreqset(p)	svc_getreq(*p)
X
X/*
X * Which version of the NFS interface are we using.
X * This is the implementation release number, not
X * the protocol revision number.
X */
X#define	NFS_4
X
X/*
X * Name of filesystem types
X */
X#define	MOUNT_TYPE_NFS	"nfs"
X#define	MOUNT_TYPE_UFS	"ufs"
X#undef MTAB_TYPE_UFS
X#define	MTAB_TYPE_UFS	"ufs"
X
X/*
X * Byte ordering
X */
X#ifndef BYTE_ORDER
X#include <machine/endian.h>
X#endif /* BYTE_ORDER */
X
X#undef ARCH_ENDIAN
X#if BYTE_ORDER == LITTLE_ENDIAN
X#define ARCH_ENDIAN "little"
X#else
X#if BYTE_ORDER == BIG_ENDIAN
X#define ARCH_ENDIAN "big"
X#else
XXXX - Probably no hope of running Amd on this machine!
X#endif /* BIG */
X#endif /* LITTLE */
X
X/*
X * Type of a file handle
X */
X#undef NFS_FH_TYPE
X#define NFS_FH_TYPE     caddr_t
X
X/*
X * Type of filesystem type
X */
X#undef MTYPE_TYPE
X#define	MTYPE_TYPE	char *
END_OF_FILE
if test 2563 -ne `wc -c <'os-xinu43.h'`; then
    echo shar: \"'os-xinu43.h'\" unpacked with wrong size!
fi
# end of 'os-xinu43.h'
fi
if test -f 'sfs_ops.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sfs_ops.c'\"
else
echo shar: Extracting \"'sfs_ops.c'\" \(2795 characters\)
sed "s/^X//" >'sfs_ops.c' <<'END_OF_FILE'
X/*
X * $Id: sfs_ops.c,v 5.1.1.1 90/01/11 17:20:21 jsp Exp Locker: jsp $
X *
X * Copyright (c) 1990 Jan-Simon Pendry
X * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1990 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X#include "am.h"
X
X#ifdef HAS_SFS
X
X/*
X * Symbol-link file system
X */
X
X/*
X * SFS needs a link.
X */
Xstatic int sfs_match(fo)
Xam_opts *fo;
X{
X	if (!fo->opt_fs) {
X		plog(XLOG_USER, "link: no fs specified");
X		return 0;
X	}
X
X	/*
X	 * Bug report (14/12/89) from Jay Plett <jay@princeton.edu>
X	 * If an automount point has the same name as an existing
X	 * link type mount Amd hits a race condition and either hangs
X	 * or causes a symlink loop.
X	 *
X	 * If fs begins with a '/' change the opt_fs & opt_sublink
X	 * fields so that the fs option doesn't end up pointing at
X	 * an existing symlink.
X	 *
X	 * If sublink is nil then set sublink to fs
X	 * else set sublink to fs / sublink
X	 *
X	 * Finally set fs to ".".
X	 */
X	if (*fo->opt_fs == '/') {
X		char *fullpath;
X		char *link = fo->opt_sublink;
X		if (link) {
X			if (*link == '/')
X				fullpath = strdup(link);
X			else
X				fullpath = str3cat((char *)0, fo->opt_fs, "/", link);
X		} else {
X			fullpath = strdup(fo->opt_fs);
X		}
X
X		if (fo->opt_sublink)
X			free(fo->opt_sublink);
X		fo->opt_sublink = fullpath;
X		free(fo->opt_fs);
X		fo->opt_fs = strdup(".");
X	}
X
X	fo->fs_mtab = strealloc(fo->fs_mtab, fo->opt_fs);
X
X	return 1;
X}
X
X/*ARGUSED*/
Xstatic int sfs_mount(mp)
Xam_node *mp;
X{
X	/*
X	 * Wow - this is hard to implement!
X	 */
X
X	return 0;
X}
X
X/*ARGUSED*/
Xstatic int sfs_umount(mp)
Xam_node *mp;
X{
X	return 0;
X}
X
X/*
X * Ops structure
X */
Xam_ops sfs_ops = {
X	"link",
X	sfs_match,
X	0, /* sfs_init */
X	sfs_mount,
X	sfs_umount,
X	efs_lookuppn,
X	efs_readdir,
X	0, /* sfs_readlink */
X	0, /* sfs_mounted */
X	0, /* sfs_umounted */
X	find_afs_srvr,
X	FS_UBACKGROUND,
X	&afs_srvr_list
X};
X
X#endif
END_OF_FILE
if test 2795 -ne `wc -c <'sfs_ops.c'`; then
    echo shar: \"'sfs_ops.c'\" unpacked with wrong size!
fi
# end of 'sfs_ops.c'
fi
if test -f 'umount_fs.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'umount_fs.c'\"
else
echo shar: Extracting \"'umount_fs.c'\" \(3093 characters\)
sed "s/^X//" >'umount_fs.c' <<'END_OF_FILE'
X/*
X * $Id: umount_fs.c,v 5.1.1.2 90/01/11 17:22:48 jsp Exp Locker: jsp $
X *
X * Copyright (c) 1990 Jan-Simon Pendry
X * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1990 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X#include "am.h"
X
X#ifdef NEED_UMOUNT_BSD
X
X#include <sys/mount.h>		/* For MNT_NOFORCE */
X
Xint umount_fs(fs_name)
Xchar *fs_name;
X{
X	int error;
X
Xeintr:
X	error = unmount(fs_name, MNT_NOFORCE);
X	if (error < 0)
X		error = errno;
X
X	switch (error) {
X	case EINVAL:
X	case ENOTBLK:
X		plog(XLOG_WARNING, "unmount: %s is not mounted", fs_name);
X		error = 0;	/* Not really an error */
X		break;
X
X	case ENOENT:
X		plog(XLOG_ERROR, "mount point %s: %m", fs_name);
X		break;
X
X	case EINTR:
X#ifdef DEBUG
X		dlog("%s: unmount: %m", fs_name);
X#endif
X		goto eintr;
X
X#ifdef DEBUG
X	default:
X		dlog("%s: unmount: %m", fs_name);
X		break;
X#endif
X	}
X
X	return error;
X}
X
X#endif /* NEED_UMOUNT_BSD */
X
X#ifdef NEED_UMOUNT_FS
X
Xint umount_fs(fs_name)
Xchar *fs_name;
X{
X	mntlist *mlist, *mp, *mp_save = 0;
X	int error = 0;
X
X	mp = mlist = read_mtab(fs_name);
X
X	/*
X	 * Search the mount table looking for
X	 * the correct (ie last) matching entry
X	 */
X	while (mp) {
X		if (strcmp(mp->mnt->mnt_fsname, fs_name) == 0 ||
X				strcmp(mp->mnt->mnt_dir, fs_name) == 0)
X			mp_save = mp;
X		mp = mp->mnext;
X	}
X
X	if (mp_save) {
X#ifdef DEBUG
X		dlog("Trying unmount(%s)", mp_save->mnt->mnt_dir);
X#endif
X		if (UNMOUNT_TRAP(mp_save->mnt) < 0) {
X			switch (error = errno) {
X			case EINVAL:
X			case ENOTBLK:
X				plog(XLOG_WARNING, "unmount: %s is not mounted", mp_save->mnt->mnt_dir);
X				error = 0;	/* Not really an error */
X				break;
X
X			case ENOENT:
X				plog(XLOG_ERROR, "mount point %s: %m", mp_save->mnt->mnt_dir);
X				break;
X
X			default:
X#ifdef DEBUG
X				dlog("%s: unmount: %m", mp_save->mnt->mnt_dir);
X#endif
X				break;
X			}
X		}
X
X#ifdef UPDATE_MTAB
X		if (!error) {
X			mnt_free(mp_save->mnt);
X			mp_save->mnt = 0;
X
X			rewrite_mtab(mlist);
X		}
X#endif
X	} else {
X		plog(XLOG_ERROR, "Couldn't find how to unmount %s", fs_name);
X		/*
X		 * Assume it is already unmounted
X		 */
X		error = 0;
X	}
X
X	free_mntlist(mlist);
X
X	return error;
X}
X
X#endif /* NEED_UMOUNT_FS */
END_OF_FILE
if test 3093 -ne `wc -c <'umount_fs.c'`; then
    echo shar: \"'umount_fs.c'\" unpacked with wrong size!
fi
# end of 'umount_fs.c'
fi
if test -f 'uwait.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'uwait.h'\"
else
echo shar: Extracting \"'uwait.h'\" \(2465 characters\)
sed "s/^X//" >'uwait.h' <<'END_OF_FILE'
X/*
X * $Id: uwait.h,v 5.1 89/11/17 18:22:37 jsp Exp Locker: jsp $
X *
X * Copyright (c) 1989 Jan-Simon Pendry
X * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
X * Copyright (c) 1989 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Jan-Simon Pendry at Imperial College, London.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Imperial College of Science, Technology and Medicine, London, UK.
X * The names of the College and University may not be used to endorse
X * or promote products derived from this software without specific
X * prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X *	%W% (Berkeley) %G%
X */
X
X#if defined(mc68k) || defined(mc68000) || defined(mc68020) || defined(sparc) || defined(hp9000s300)
X#define BITS_BIGENDIAN
X#endif
X#if defined(vax) || defined(i386)
X#define BITS_LITTLENDIAN
X#endif
X#if !defined BITS_BIGENDIAN && !defined BITS_LITTLENDIAN
X #error Do not know my byte ordering
X#endif
X
X/*
X * Structure of the information in the first word returned by both
X * wait and wait3.  If w_stopval==WSTOPPED, then the second structure
X * describes the information returned, else the first.  See WUNTRACED below.
X */
Xunion wait	{
X	int	w_status;		/* used in syscall */
X	/*
X	 * Terminated process status.
X	 */
X	struct {
X#ifdef BITS_LITTLENDIAN
X		unsigned short	w_Termsig:7;	/* termination signal */
X		unsigned short	w_Coredump:1;	/* core dump indicator */
X		unsigned short	w_Retcode:8;	/* exit code if w_termsig==0 */
X#endif
X#ifdef BITS_BIGENDIAN
X		unsigned short	w_Fill1:16;	/* high 16 bits unused */
X		unsigned short	w_Retcode:8;	/* exit code if w_termsig==0 */
X		unsigned short	w_Coredump:1;	/* core dump indicator */
X		unsigned short	w_Termsig:7;	/* termination signal */
X#endif
X	} w_U;
X};
X#define	w_termsig	w_U.w_Termsig
X#define w_coredump	w_U.w_Coredump
X#define w_retcode	w_U.w_Retcode
X
X#define WIFSIGNALED(x)	((x).w_termsig != 0)
X#define WIFEXITED(x)	((x).w_termsig == 0)
END_OF_FILE
if test 2465 -ne `wc -c <'uwait.h'`; then
    echo shar: \"'uwait.h'\" unpacked with wrong size!
fi
# end of 'uwait.h'
fi
echo shar: End of archive 2 \(of 13\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 13 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
exit 0 # Just in case...
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.