Resolve conflicts.

This commit is contained in:
christos 1997-09-22 22:09:51 +00:00
parent 4ed600dbd0
commit 2903fbdf71
49 changed files with 2056 additions and 11870 deletions

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile.inc,v 1.3 1997/07/25 00:29:21 christos Exp $
# $NetBSD: Makefile.inc,v 1.4 1997/09/22 22:09:51 christos Exp $
LIBAMU != cd ${.CURDIR}/../libamu;\
printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -s -f-
CFLAGS += -I${.CURDIR}/../include -I${.CURDIR} -I${LIBAMU} -I. -DHAVE_CONFIG_H
LDADD += -L${LIBAMU} -lamu -lrpcsvc
DPADD += ${LIBAMU}/libamu.a
LDADD += -L${LIBAMU} -lamu -lrpcsvc -ll
DPADD += ${LIBAMU}/libamu.a ${LIBRPCSVC} ${LIBL}
BINDIR = /usr/sbin

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.12 1997/07/28 00:46:57 christos Exp $
# $NetBSD: Makefile,v 1.13 1997/09/22 22:10:01 christos Exp $
PROG= amd
SRCS= conf_parse.c conf_tok.c srvr_nfs.c srvr_afs.c sched.c rpc_fwd.c \

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: am_ops.c,v 1.4 1997/07/24 23:16:15 christos Exp $
* $Id: am_ops.c,v 1.5 1997/09/22 22:10:02 christos Exp $
*
*/
@ -104,13 +104,13 @@ static am_ops *vops[] =
&pcfs_ops, /* Floppy/MSDOS F/S */
#endif /* HAVE_FS_PCFS */
#ifdef HAVE_FS_NULLFS
/* null (loopback) F/S */
/* FILL IN */ /* null (loopback) F/S */
#endif /* HAVE_FS_NULLFS */
#ifdef HAVE_FS_UNIONFS
/* union (bsd44) F/S */
/* FILL IN */ /* union (bsd44) F/S */
#endif /* HAVE_FS_UNIONFS */
#ifdef HAVE_FS_UMAPFS
/* uid/gid mapping F/S */
/* FILL IN */ /* uid/gid mapping F/S */
#endif /* HAVE_FS_UMAPFS */
@ -119,7 +119,8 @@ static am_ops *vops[] =
* (1) afs
* (2) dfs
* (3) toplvl
* (4) efs
* (4) autofs
* (5) efs
*/
#ifdef HAVE_AM_FS_AFS
&afs_ops, /* Automounter F/S */
@ -130,6 +131,9 @@ static am_ops *vops[] =
#ifdef HAVE_AM_FS_TOPLVL
&toplvl_ops, /* top-level mount F/S */
#endif /* HAVE_AM_FS_TOPLVL */
#ifdef HAVE_AM_FS_AUTOFS
&autofs_ops, /* autofs mount F/S */
#endif /* HAVE_AM_FS_AUTOFS */
#ifdef HAVE_AM_FS_EFS
&efs_ops, /* error F/S */
#endif /* HAVE_AM_FS_EFS */

View File

@ -1,4 +1,5 @@
.\"
.\" Copyright (c) 1997 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.
@ -16,7 +17,7 @@
.\" 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 acknowledgement:
.\" 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
@ -37,7 +38,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" $Id: amd.8,v 1.8 1997/07/24 23:16:16 christos Exp $
.\" $Id: amd.8,v 1.9 1997/09/22 22:10:04 christos Exp $
.\"
.TH AMD 8 "3 November 1989"
.SH NAME
@ -45,7 +46,7 @@ amd \- automatically mount file systems
.SH SYNOPSIS
.B amd
[
.B \-nprv
.B \-nprvHS
] [
.BI \-a " mount_point"
] [
@ -57,6 +58,8 @@ amd \- automatically mount file systems
] [
.BI \-l " logfile"
] [
.BI \-o " op_sys_name"
] [
.BI \-t " interval.interval"
] [
.BI \-w " interval"
@ -68,6 +71,10 @@ amd \- automatically mount file systems
.BI \-C " cluster-name"
] [
.BI \-D " option"
] [
.BI \-F " conf_file"
] [
.BI \-T " tag"
]
[
.I directory
@ -96,18 +103,63 @@ to determine how to resolve the lookup.
Generally, this will be a host name, some filesystem information
and some mount options for the given filesystem.
.SH OPTIONS
.\"*******************************************************"
.TP
.BI \-a " temporary-directory"
Specify an alternative location for the real mount points.
The default is
.BR /a .
.TP
.BI \-c " duration"
Specify a
.IR duration ,
in seconds, that a looked up name remains
cached when not in use. The default is 5 minutes.
.TP
.BI \-d " domain"
Specify the local domain name. If this option is not
given the domain name is determined from the hostname.
.TP
.BI \-k " kernel-arch"
Specifies the kernel architecture. This is used solely
to set the ${karch} selector.
.TP
.BI \-l " logfile"
Specify a logfile in which to record mount and unmount events.
If
.I logfile
is the string
.B syslog
then the log messages will be sent to the system log daemon by
.IR syslog (3).
.TP
.B \-n
Normalize hostnames.
The name refered to by ${rhost} is normalized relative to the
The name refereed to by ${rhost} is normalized relative to the
host database before being used. The effect is to translate
aliases into ``official'' names.
.TP
.BI \-o " op_sys_name"
Override the compiled-in name of the operating system. Useful when the
built in name is not desired for backward compatibility reasons. For
example, if the build in name is ``sunos5'', you can override it to
``sos5'', and use older maps which were written with the latter in mind.
.TP
.B \-p
Print PID.
Outputs the process-id of
.B amd
to standard output where it can be saved into a file.
.TP
.B \-r
Restart existing mounts.
@ -118,37 +170,7 @@ been auto-mounted,
.B amd
.I inherits
it.
.TP
.B \-v
Version. Displays version and configuration information on standard error.
.TP
.BI \-a " temporary-directory"
Specify an alternative location for the real mount points.
The default is
.BR /a .
.TP
.BI \-c " duration"
Specify a
.IR duration ,
in seconds, that a looked up name remains
cached when not in use. The default is 5 minutes.
.TP
.BI \-d " domain"
Specify the local domain name. If this option is not
given the domain name is determined from the hostname.
.TP
.BI \-k " kernel-arch"
Specifies the kernel architecture. This is used solely
to set the ${karch} selector.
.TP
.BI \-l " logfile"
Specify a logfile in which to record mount and unmount events.
If
.I logfile
is the string
.B syslog
then the log messages will be sent to the system log daemon by
.IR syslog (3).
.TP
.BI \-t " interval.interval"
Specify the
@ -158,6 +180,11 @@ The default is 0.8 seconds.
The second values alters the restransmit counter.
Useful defaults are supplied if either or both
values are missing.
.TP
.B \-v
Version. Displays version and configuration information on standard error.
.TP
.BI \-w " interval"
Specify an
@ -165,15 +192,22 @@ Specify an
in seconds, between attempts to dismount
filesystems that have exceeded their cached times.
The default is 2 minutes.
.TP
.BI \-x " options"
Specify run-time logging options. The options are a comma separated
list chosen from: fatal, error, user, warn, info, map, stats, all.
.TP
.BI \-y " domain"
Specify an alternative NIS domain from which to fetch the NIS maps.
The default is the system domain name. This option is ignored if NIS
support is not available.
.TP
.BI \-x " options"
Specify run-time logging options. The options are a comma separated
list chosen from: fatal, error, user, warn, info, map, stats, all.
.BI \-C " cluster-name"
Specify an alternative HP-UX cluster name to use.
.TP
.BI \-D " option"
Select from a variety of debug options. Prefixing an
@ -187,11 +221,53 @@ Since
is only used for debugging other options are not documented here:
the current supported set of options is listed by the \-v option
and a fuller description is available in the program source.
.TP
.BI \-F " conf_file"
Specify an amd configuration file to use. See
.BR amd.conf (5)
for description of this file's format. This configuration file is used to
specify any options in lieu of typing many of them on the command line. The
.I amd.conf
file includes directives for every command line option amd has, and many
more that are only available via the configuration file facility.
.TP
.B \-H
Print help and usage string.
.TP
.B \-S
Do not lock the running executable pages of amd into memory. To improve
amd's performance, systems that support the
.BR plock (3)
call, could lock the amd process into memory. This way there is less chance
the operating system will schedule, page out, and swap the amd process as
needed. This tends improves amd's performance, at the cost of reserving the
memory used by the amd process (making it unavailable for other processes).
If this behavior is not desired, use the
.B \-S
option.
.TP
.BI \-T " tag"
Specify a tag to use with
.BR amd.conf (5).
All map entries tagged with
.I tag
will be processed. Map entries that are not tagged are always processed.
Map entries that are tagged with a tag other than
.I tag
will not be processed.
.SH FILES
.PD 0
.TP 5
.B /a
directory under which filesystems are dynamically mounted
.TP 5
.B amd.conf
amd configuration file
.PD
.SH CAVEATS
Some care may be required when creating a mount map.
@ -210,6 +286,7 @@ number of process context switches.
A weird imagination is most useful to gain full advantage of all
the features.
.SH "SEE ALSO"
.BR amd.conf (5),
.BR amq (8),
.BR domainname (1),
.BR hostname (1),
@ -219,5 +296,12 @@ the features.
.BR mtab (5),
.LP
.I "Amd \- The 4.4 BSD Automounter"
.SH AUTHOR
.SH AUTHORS
Jan-Simon Pendry <jsp@doc.ic.ac.uk>, Department of Computing, Imperial College, London, UK.
.P
Erez Zadok <ezk@cs.columbia.edu>, Department of Computer Science, Columbia
University, New York, USA.
.P
Other authors and contributors to am-utils are listed in the
.B AUTHORS
file distributed with am-utils.

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: amd.c,v 1.4 1997/07/24 23:16:17 christos Exp $
* $Id: amd.c,v 1.5 1997/09/22 22:10:06 christos Exp $
*
*/
@ -228,6 +228,10 @@ daemon_mode(void)
static void
init_global_options(void)
{
#if defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
static struct utsname un;
#endif /* defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME) */
memset(&gopt, 0, sizeof(struct amu_global_options));
/* name of current architecture */
@ -239,8 +243,15 @@ init_global_options(void)
/* cluster name */
gopt.cluster = NULL;
/* kernel architecture */
gopt.karch = HOST_ARCH;
/*
* kernel architecture: this you must get from uname() if possible.
*/
#if defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
if (uname(&un) >= 0)
gopt.karch = un.machine;
else
#endif /* defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME) */
gopt.karch = HOST_ARCH;
/* amd log file */
gopt.logfile = NULL;
@ -266,8 +277,11 @@ init_global_options(void)
/* dismount interval */
gopt.am_timeo_w = AM_TTL_W;
/* various CFM_* flags */
gopt.flags = 0;
/*
* various CFM_* flags.
* by default, only the "plock" option is on (if available).
*/
gopt.flags = CFM_PROCESS_LOCK;
#ifdef HAVE_MAP_LDAP
/* LDAP base */
@ -275,6 +289,10 @@ init_global_options(void)
/* LDAP host ports */
gopt.ldap_hostports = NULL;
/* LDAP cache */
gopt.ldap_cache_seconds = 0;
gopt.ldap_cache_maxmem = 131072;
#endif /* HAVE_MAP_LDAP */
#ifdef HAVE_MAP_NIS
@ -287,7 +305,7 @@ init_global_options(void)
int
main(int argc, char *argv[])
{
char *domdot;
char *domdot, *verstr;
int ppid = 0;
int error;
#ifdef HAVE_SIGACTION
@ -442,6 +460,16 @@ main(int argc, char *argv[])
*/
get_args(argc, argv);
/*
* Log version information.
*/
verstr = strtok(get_version_string(), "\n");
plog(XLOG_INFO, "AM-UTILS VERSION INFORMATION:");
while (verstr) {
plog(XLOG_INFO, verstr);
verstr = strtok(NULL, "\n");
}
/*
* Get our own IP address so that we
* can mount the automounter.
@ -461,11 +489,11 @@ main(int argc, char *argv[])
* Lock process text and data segment in memory.
*/
#ifdef HAVE_PLOCK
if (gopt.flags & CFM_NOSWAP)
if (gopt.flags & CFM_PROCESS_LOCK)
if (plock(PROCLOCK) != 0) {
plog(XLOG_WARNING, "Couldn't lock process text and data segment in memory: %m");
} else {
plog(XLOG_INFO, "Locked process text and data segment in memory: %m");
plog(XLOG_INFO, "Locked process text and data segment in memory");
}
#endif /* HAVE_PLOCK */

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: amq_subr.c,v 1.5 1997/07/24 23:16:18 christos Exp $
* $Id: amq_subr.c,v 1.6 1997/09/22 22:10:07 christos Exp $
*
*/
/*
@ -263,6 +263,17 @@ amqproc_getvers_1_svc(voidp argp, struct svc_req *rqstp)
}
/* get PID of remote amd */
int *
amqproc_getpid_1_svc(voidp argp, struct svc_req *rqstp)
{
static int res;
res = getpid();
return &res;
}
/*
* XDR routines.
*/

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: amq_svc.c,v 1.2 1997/07/24 23:16:20 christos Exp $
* $Id: amq_svc.c,v 1.3 1997/09/22 22:10:09 christos Exp $
*
*/
@ -118,6 +118,12 @@ amq_program_1(struct svc_req *rqstp, SVCXPRT *transp)
local = (char *(*)()) amqproc_getvers_1_svc;
break;
case AMQPROC_GETPID:
xdr_argument = xdr_void;
xdr_result = xdr_int;
local = (char *(*)()) amqproc_getpid_1_svc;
break;
default:
svcerr_noproc(transp);
return;

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: autil.c,v 1.2 1997/07/24 23:16:21 christos Exp $
* $Id: autil.c,v 1.3 1997/09/22 22:10:11 christos Exp $
*
*/
@ -334,10 +334,11 @@ int
mount_node(am_node *mp)
{
mntfs *mf = mp->am_mnt;
int error;
int error = 0;
mf->mf_flags |= MFF_MOUNTING;
error = (*mf->mf_ops->mount_fs) (mp);
mf = mp->am_mnt;
if (error >= 0)
mf->mf_flags &= ~MFF_MOUNTING;
@ -345,6 +346,7 @@ mount_node(am_node *mp)
/* ...but see ifs_mount */
am_mounted(mp);
}
return error;
}
@ -409,45 +411,8 @@ top:
if (pid == 0) { /* child process (foreground==false) */
mypid = getpid();
foreground = 0;
#ifdef HAVE_TRANSPORT_TYPE_TLI_off
/*
* The sleep() right here is a hacky solution to some race conditions on
* some systems, esp. Solaris with TLI on fast CPUs. Without it, all
* top-level mounts bombard the system very fast, and some of them,
* possibly the non-blocking RPCs, get lost. It is not guaranteed who
* and how many get lost; sometimes none, sometimes all but one. I've
* seen things like that under older systems like Mach-3 Either way.
* This hack seems to solve the problem. Note that the sleep() is
* progressively greater as there are more children, so as to
* "randomize" the order in which they will reply back to the parent amd
* process. It helps in getting the replies delivered back in order.
* These hopefully don't slow down amd by much overall. For the time
* being, I'm going to make this code dependent on TLI, because I have
* no evidence that it is needed on any other system. Anyone is welcome
* to figure out the bug or race condition.
*
* It is also possible that if there are too many children sending out
* their (unreliable) UDP datagrams over the fwd_sock, that some of them
* simply get lost. Then there's always the possibility that this is a
* kernel networking bug.
*
* -Erez Zadok <ezk@cs.columbia.edu>
*/
if (NumChild > 0) {
plog(XLOG_INFO,"too many background children(%d). sleep %d mSec...",
NumChild, PARENT_USLEEP_TIME*NumChild);
usleep(PARENT_USLEEP_TIME*NumChild);
}
#endif /* HAVE_TRANSPORT_TYPE_TLI */
} else { /* parent process, has one more child */
NumChild++;
#ifdef HAVE_TRANSPORT_TYPE_TLI_off
if (NumChild > 1) {
plog(XLOG_INFO,"parent sleeps for %d mSec...",
PARENT_USLEEP_TIME*NumChild);
usleep(PARENT_USLEEP_TIME*NumChild);
}
#endif /* HAVE_TRANSPORT_TYPE_TLI */
}
return pid;

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: conf.c,v 1.2 1997/07/24 23:16:23 christos Exp $
* $Id: conf.c,v 1.3 1997/09/22 22:10:14 christos Exp $
*
*/
@ -82,8 +82,11 @@ static int gopt_cache_duration(const char *val);
static int gopt_cluster(const char *val);
static int gopt_debug_options(const char *val);
static int gopt_dismount_interval(const char *val);
static int gopt_fully_qualified_hosts(const char *val);
static int gopt_karch(const char *val);
static int gopt_ldap_base(const char *val);
static int gopt_ldap_cache_maxmem(const char *val);
static int gopt_ldap_cache_seconds(const char *val);
static int gopt_ldap_hostports(const char *val);
static int gopt_local_domain(const char *val);
static int gopt_log_file(const char *val);
@ -91,6 +94,7 @@ static int gopt_log_options(const char *val);
static int gopt_map_options(const char *val);
static int gopt_map_type(const char *val);
static int gopt_mount_type(const char *val);
static int gopt_portmap_program(const char *val);
static int gopt_nfs_retransmit_counter(const char *val);
static int gopt_nfs_retry_interval(const char *val);
static int gopt_nis_domain(const char *val);
@ -103,6 +107,7 @@ static int gopt_print_version(const char *val);
static int gopt_restart_mounts(const char *val);
static int gopt_search_path(const char *val);
static int gopt_selectors_on_default(const char *val);
static int gopt_show_statfs_entries(const char *val);
static int process_global_option(const char *key, const char *val);
static int process_regular_map(cf_map_t *cfm);
static int process_regular_option(const char *section, const char *key, const char *val, cf_map_t *cfm);
@ -128,8 +133,11 @@ static struct _func_map glob_functable[] = {
{"cluster", gopt_cluster},
{"debug_options", gopt_debug_options},
{"dismount_interval", gopt_dismount_interval},
{"fully_qualified_hosts", gopt_fully_qualified_hosts},
{"karch", gopt_karch},
{"ldap_base", gopt_ldap_base},
{"ldap_cache_maxmem", gopt_ldap_cache_maxmem},
{"ldap_cache_seconds", gopt_ldap_cache_seconds},
{"ldap_hostports", gopt_ldap_hostports},
{"local_domain", gopt_local_domain},
{"log_file", gopt_log_file},
@ -137,6 +145,7 @@ static struct _func_map glob_functable[] = {
{"map_options", gopt_map_options},
{"map_type", gopt_map_type},
{"mount_type", gopt_mount_type},
{"portmap_program", gopt_portmap_program},
{"nfs_retransmit_counter", gopt_nfs_retransmit_counter},
{"nfs_retry_interval", gopt_nfs_retry_interval},
{"nis_domain", gopt_nis_domain},
@ -149,6 +158,7 @@ static struct _func_map glob_functable[] = {
{"restart_mounts", gopt_restart_mounts},
{"search_path", gopt_search_path},
{"selectors_on_default", gopt_selectors_on_default},
{"show_statfs_entries", gopt_show_statfs_entries},
{NULL, NULL}
};
@ -172,6 +182,11 @@ reset_cf_map(cf_map_t *cfm)
cfm->cfm_name = NULL;
}
if (cfm->cfm_tag) {
free(cfm->cfm_tag);
cfm->cfm_tag = NULL;
}
/*
* reset/initialize a regular map's flags and other variables from the
* global ones, so that they are applied to all maps. Of course, each map
@ -364,6 +379,22 @@ gopt_dismount_interval(const char *val)
}
static int
gopt_fully_qualified_hosts(const char *val)
{
if (STREQ(val, "yes")) {
gopt.flags |= CFM_FULLY_QUALIFIED_HOSTS;
return 0;
} else if (STREQ(val, "no")) {
gopt.flags &= ~CFM_FULLY_QUALIFIED_HOSTS;
return 0;
}
fprintf(stderr, "conf: unknown value to fully_qualified_hosts \"%s\"\n", val);
return 1; /* unknown value */
}
static int
gopt_karch(const char *val)
{
@ -393,6 +424,44 @@ gopt_ldap_base(const char *val)
}
static int
gopt_ldap_cache_seconds(const char *val)
{
#ifdef HAVE_MAP_LDAP
char *end;
gopt.ldap_cache_seconds = strtol((char *)val, &end, 10);
if (end == val) {
fprintf(stderr, "conf: bad LDAP cache (seconds) option: %s\n",val);
return 1;
}
return 0;
#else /* not HAVE_MAP_LDAP */
fprintf(stderr, "conf: ldap_cache option ignored. No LDAP support available.\n");
return 1;
#endif /* not HAVE_MAP_LDAP */
}
static int
gopt_ldap_cache_maxmem(const char *val)
{
#ifdef HAVE_MAP_LDAP
char *end;
gopt.ldap_cache_maxmem = strtol((char *)val, &end, 10);
if (end == val) {
fprintf(stderr, "conf: bad LDAP cache (maxmem) option: %s\n",val);
return 1;
}
return 0;
#else /* not HAVE_MAP_LDAP */
fprintf(stderr, "conf: ldap_cache option ignored. No LDAP support available.\n");
return 1;
#endif /* not HAVE_MAP_LDAP */
}
static int
gopt_ldap_hostports(const char *val)
{
@ -443,8 +512,13 @@ static int
gopt_mount_type(const char *val)
{
if (STREQ(val, "autofs")) {
#ifdef HAVE_FS_AUTOFS
gopt.flags |= CFM_MOUNT_TYPE_AUTOFS;
return 0;
#else /* not HAVE_FS_AUTOFS */
fprintf(stderr, "conf: no autofs support available\n");
return 1;
#endif /* not HAVE_FS_AUTOFS */
} else if (STREQ(val, "nfs")) {
gopt.flags &= ~CFM_MOUNT_TYPE_AUTOFS;
return 0;
@ -455,6 +529,27 @@ gopt_mount_type(const char *val)
}
static int
gopt_portmap_program(const char *val)
{
gopt.portmap_program = atoi(val);
/*
* allow alternate program numbers to be no more than 10 offset from
* official amd program number (300019).
*/
if (gopt.portmap_program < AMQ_PROGRAM ||
gopt.portmap_program > AMQ_PROGRAM + 10) {
gopt.portmap_program = AMQ_PROGRAM;
set_amd_program_number(gopt.portmap_program);
fprintf(stderr, "conf: illegal amd program numver \"%s\"\n", val);
return 1;
}
set_amd_program_number(gopt.portmap_program);
return 0; /* all is OK */
}
static int
gopt_nfs_retransmit_counter(const char *val)
{
@ -520,10 +615,10 @@ static int
gopt_plock(const char *val)
{
if (STREQ(val, "yes")) {
gopt.flags |= CFM_NOSWAP;
gopt.flags |= CFM_PROCESS_LOCK;
return 0;
} else if (STREQ(val, "no")) {
gopt.flags &= ~CFM_NOSWAP;
gopt.flags &= ~CFM_PROCESS_LOCK;
return 0;
}
@ -603,6 +698,22 @@ gopt_selectors_on_default(const char *val)
}
static int
gopt_show_statfs_entries(const char *val)
{
if (STREQ(val, "yes")) {
gopt.flags |= CFM_SHOW_STATFS_ENTRIES;
return 0;
} else if (STREQ(val, "no")) {
gopt.flags &= ~CFM_SHOW_STATFS_ENTRIES;
return 0;
}
fprintf(stderr, "conf: unknown value to show_statfs_entries \"%s\"\n", val);
return 1; /* unknown value */
}
/*
* Collect one entry for a regular map
*/
@ -694,8 +805,13 @@ static int
ropt_mount_type(const char *val, cf_map_t *cfm)
{
if (STREQ(val, "autofs")) {
#ifdef HAVE_FS_AUTOFS
cfm->cfm_flags |= CFM_MOUNT_TYPE_AUTOFS;
return 0;
#else /* not HAVE_FS_AUTOFS */
fprintf(stderr, "conf: no autofs support available\n");
return 1;
#endif /* not HAVE_FS_AUTOFS */
} else if (STREQ(val, "nfs")) {
cfm->cfm_flags &= ~CFM_MOUNT_TYPE_AUTOFS;
return 0;
@ -758,10 +874,16 @@ process_regular_map(cf_map_t *cfm)
/*
* Process last map in conf file
* Process last map in conf file (if any)
*/
int
process_last_regular_map(void)
{
/*
* If the amd.conf file only has a [global] section (pretty useless
* IMHO), do not try to process a map that does not exist.
*/
if (!cur_map.cfm_dir)
return 0;
return process_regular_map(&cur_map);
}

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: get_args.c,v 1.4 1997/07/24 23:16:28 christos Exp $
* $Id: get_args.c,v 1.5 1997/09/22 22:10:16 christos Exp $
*
*/
@ -59,9 +59,7 @@ char *conf_file = NULL; /* default amd configuration file */
char *conf_tag = NULL; /* default conf file tags to use */
int usage = 0;
int use_conf_file = 0; /* use amd configuration file */
#ifdef MOUNT_TABLE_ON_FILE
char *mtab;
#endif /* MOUNT_TABLE_ON_FILE */
char *mnttab_file_name = NULL; /* symbol must be available always */
#ifdef DEBUG
int debug_flags = D_AMQ /* Register AMQ */
| D_DAEMON; /* Enter daemon mode */
@ -126,7 +124,7 @@ get_args(int c, char *v[])
int opt_ch;
FILE *fp = stdin;
while ((opt_ch = getopt(c, v, "nprvSa:c:d:h:k:l:o:t:w:x:y:C:D:F:T:H")) != EOF)
while ((opt_ch = getopt(c, v, "nprvSa:c:d:k:l:o:t:w:x:y:C:D:F:T:H")) != EOF)
switch (opt_ch) {
@ -149,10 +147,6 @@ get_args(int c, char *v[])
gopt.sub_domain = optarg;
break;
case 'h':
plog(XLOG_USER, "-h: option ignored. HOST_EXEC is not enabled.");
break;
case 'k':
gopt.karch = optarg;
break;
@ -229,7 +223,7 @@ get_args(int c, char *v[])
break;
case 'S':
gopt.flags |= CFM_NOSWAP;
gopt.flags &= ~CFM_PROCESS_LOCK; /* turn process locking off */
break;
case 'F':
@ -309,10 +303,10 @@ get_args(int c, char *v[])
#ifdef MOUNT_TABLE_ON_FILE
# ifdef DEBUG
if (debug_flags & D_MTAB)
mtab = DEBUG_MNTTAB;
mnttab_file_name = DEBUG_MNTTAB;
else
# endif /* DEBUG */
mtab = MNTTAB_FILE_NAME;
mnttab_file_name = MNTTAB_FILE_NAME;
#else /* not MOUNT_TABLE_ON_FILE */
# ifdef DEBUG
if (debug_flags & D_MTAB)

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: info_nis.c,v 1.7 1997/08/26 19:47:19 thorpej Exp $
* $Id: info_nis.c,v 1.8 1997/09/22 22:10:18 christos Exp $
*
*/
@ -51,7 +51,6 @@
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amd.h>
#include <time.h>
/*
* NIS+ servers in NIS compat mode don't have yp_order()
@ -162,7 +161,7 @@ nis_reload(mnt_map *m, char *map, void (*fn) (int, char *, int, char *, int, cha
* 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
* connection to ypserv, and this ypserv runs out of open filedescriptors,
* getting into an infinite loop, thus all YP clients enevtually unbind
* getting into an infinite loop, thus all YP clients eventually unbind
* and hang too.
*/
error = yp_all(gopt.nis_domain, map, &cbinfo);
@ -195,26 +194,27 @@ nis_search(mnt_map *m, char *map, char *key, char **val, time_t *tp)
if (has_yp_order) {
/*
* Check if map has changed
*/
if (yp_order(gopt.nis_domain, map, &order))
return EIO;
if ((time_t) order > *tp) {
*tp = (time_t) order;
return -1;
}
/*
* Check if map has changed
*/
if (yp_order(gopt.nis_domain, map, &order))
return EIO;
if ((time_t) order > *tp) {
*tp = (time_t) order;
return -1;
}
} else {
/*
* NIS+ server without yp_order
* Check if timeout has expired to invalidate the cache
*/
order = time(NULL);
if ((time_t)order - *tp > gopt.am_timeo) {
*tp = (time_t)order;
return(-1);
}
/*
* NIS+ server without yp_order
* Check if timeout has expired to invalidate the cache
*/
order = time(NULL);
if ((time_t)order - *tp > gopt.am_timeo) {
*tp = (time_t)order;
return(-1);
}
}
/*
* Lookup key
*/
@ -249,37 +249,36 @@ nis_init(mnt_map *m, char *map, time_t *tp)
if (error)
return error;
}
/*
* To see if the map exists, try to find
* a master for it.
*/
yp_order_result = yp_order(gopt.nis_domain, map, &order);
switch (yp_order_result) {
case 0:
has_yp_order = TRUE;
*tp = (time_t)order;
case 0:
has_yp_order = TRUE;
*tp = (time_t) order;
#ifdef DEBUG
dlog("NIS master for %s@%s has order %d", map, gopt.nis_domain, order);
dlog("NIS master for %s@%s has order %d", map, gopt.nis_domain, order);
#endif /* DEBUG */
break;
case YPERR_YPERR:
/* NIS+ server found ! */
has_yp_order = FALSE;
/* try yp_master() instead */
if (yp_master(gopt.nis_domain, map, &master)) {
return ENOENT;
} else {
#ifdef DEBUG
dlog("NIS master for %s@%s is a NIS+ server",
map, domain);
#endif
/* Use fake timestamps */
*tp = time(NULL);
}
break;
default:
break;
case YPERR_YPERR:
/* NIS+ server found ! */
has_yp_order = FALSE;
/* try yp_master() instead */
if (yp_master(gopt.nis_domain, map, &master)) {
return ENOENT;
} else {
#ifdef DEBUG
dlog("NIS master for %s@%s is a NIS+ server", map, gopt.nis_domain);
#endif /* DEBUG */
/* Use fake timestamps */
*tp = time(NULL);
}
break;
default:
return ENOENT;
}
return 0;
}

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: info_passwd.c,v 1.4 1997/07/24 23:16:37 christos Exp $
* $Id: info_passwd.c,v 1.5 1997/09/22 22:10:19 christos Exp $
*
*/
@ -64,7 +64,23 @@ int
passwd_init(mnt_map *m, char *map, time_t *tp)
{
*tp = 0;
return STREQ(map, PASSWD_MAP) ? 0 : ENOENT;
/*
* Recognize the old format "PASSWD_MAP"
* Uses default return string
* "type:=nfs;rfs:=/${var0}/${var1};rhost:=${var1};sublink:=${var2};fs:=${autodir}${var3}"
*/
if (STREQ(map, PASSWD_MAP))
return 0;
/*
* Recognize the new format "PASSWD_MAP:pval-format"
*/
if (strncmp(map, PASSWD_MAP, sizeof(PASSWD_MAP)-1) != 0)
return ENOENT;
if (map[sizeof(PASSWD_MAP)-1] != ':')
return ENOENT;
return 0;
}
@ -91,6 +107,11 @@ passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
*
* and return
* rfs:=/anydir/dom3;rhost:=dom3.dom2.dom1;sublink:=user
* and now have
* var0:=pw-prefix:=anydir
* var1:=pw-rhost:=dom3.dom2.dom1
* var2:=pw-user:=user
* var3:=pw-home:=/anydir/dom1/dom2/dom3/user
*
* This allows cross-domain entries in your passwd file.
* ... but forget about security!
@ -146,8 +167,16 @@ passwd_search(mnt_map *m, char *map, char *key, char **pval, time_t *tp)
q = strchr(rhost, '.');
if (q)
*q = '\0';
sprintf(val, "rfs:=%s/%s;rhost:=%s;sublink:=%s;fs:=${autodir}%s",
dir, rhost, rhost, user, pw->pw_dir);
p = strchr(map, ':');
if (p)
p++;
else
p = "type:=nfs;rfs:=/${var0}/${var1};rhost:=${var1};sublink:=${var2};fs:=${autodir}${var3}";
sprintf(val, "var0:=%s;var1:=%s;var2:=%s;var3:=%s;%s",
dir+1, rhost, user, pw->pw_dir, p);
#ifdef DEBUG
dlog("passwd_search: map=%s key=%s -> %s", map, key, val);
#endif /* DEBUG */
if (q)
*q = '.';
*pval = strdup(val);

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: map.c,v 1.6 1997/07/24 23:16:39 christos Exp $
* $Id: map.c,v 1.7 1997/09/22 22:10:21 christos Exp $
*
*/
@ -352,8 +352,7 @@ free_map(am_node *mp)
/*
* Convert from file handle to
* automount node.
* Convert from file handle to automount node.
*/
am_node *
fh_to_mp3(am_nfs_fh *fhp, int *rp, int c_or_d)
@ -495,8 +494,7 @@ fh_to_mp(am_nfs_fh *fhp)
/*
* Convert from automount node to
* file handle.
* Convert from automount node to file handle.
*/
void
mp_to_fh(am_node *mp, am_nfs_fh *fhp)
@ -529,7 +527,7 @@ mp_to_fh(am_node *mp, am_nfs_fh *fhp)
}
static am_node *
am_node *
find_ap2(char *dir, am_node *mp)
{
if (mp) {
@ -552,10 +550,8 @@ find_ap2(char *dir, am_node *mp)
/*
* Find the mount node corresponding
* to dir. dir can match either the
* automount path or, if the node is
* mounted, the mount location.
* Find the mount node corresponding to dir. dir can match either the
* automount path or, if the node is mounted, the mount location.
*/
am_node *
find_ap(char *dir)
@ -566,8 +562,9 @@ find_ap(char *dir)
am_node *mp = exported_ap[i];
if (mp && (mp->am_flags & AMF_ROOT)) {
mp = find_ap2(dir, exported_ap[i]);
if (mp)
if (mp) {
return mp;
}
}
}
@ -837,8 +834,6 @@ unmount_node(am_node *mp)
}
static int
unmount_node_wrap(voidp vp)
{

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: mapc.c,v 1.6 1997/07/24 23:16:40 christos Exp $
* $Id: mapc.c,v 1.7 1997/09/22 22:10:23 christos Exp $
*
*/
@ -85,7 +85,7 @@
#define MREC_PART 1
#define MREC_NONE 0
#define MAX_CHAIN 256
#define MAX_CHAIN 1024
static struct opt_tab mapc_opt[] =
{
@ -157,11 +157,6 @@ extern int passwd_search(mnt_map *, char *, char *, char **, time_t *);
#ifdef HAVE_MAP_HESIOD
extern int amu_hesiod_init(mnt_map *, char *map, time_t *tp);
extern int hesiod_search(mnt_map *, char *, char *, char **, time_t *);
# ifdef HAS_HESIOD_RELOAD
extern int hesiod_reload(mnt_map *, char *, add_fn *);
# else /* not HAS_HESIOD_RELOAD */
# define hesiod_reload error_reload
# endif /* not HAS_HESIOD_RELOAD */
#endif /* HAVE_MAP_HESIOD */
/* LDAP MAPS */
@ -220,7 +215,7 @@ static map_type maptypes[] =
#endif /* HAVE_MAP_PASSWD */
#ifdef HAVE_MAP_HESIOD
{"hesiod", amu_hesiod_init, hesiod_reload, hesiod_search, error_mtime, MAPC_ALL},
{"hesiod", amu_hesiod_init, error_reload, hesiod_search, error_mtime, MAPC_ALL},
#endif /* HAVE_MAP_HESIOD */
#ifdef HAVE_MAP_LDAP
@ -623,9 +618,8 @@ mapc_free(mnt_map *m)
/*
* Search the map for the key.
* Put a safe copy in *pval or return
* an error code
* Search the map for the key. Put a safe (malloc'ed) copy in *pval or
* return an error code
*/
int
mapc_meta_search(mnt_map *m, char *key, char **pval, int recurse)
@ -926,12 +920,12 @@ root_keyiter(void (*fn)(char *, voidp), voidp arg)
* -Erez Zadok <ezk@cs.columbia.edu>
*/
static int
key_already_in_chain(char *name, const nfsentry *chain)
key_already_in_chain(char *keyname, const nfsentry *chain)
{
const nfsentry *tmpchain = chain;
while (tmpchain) {
if (name && tmpchain->ne_name && STREQ(name, tmpchain->ne_name))
if (keyname && tmpchain->ne_name && STREQ(keyname, tmpchain->ne_name))
return 1;
tmpchain = tmpchain->ne_nextentry;
}
@ -950,7 +944,8 @@ make_entry_chain(am_node *mp, const nfsentry *current_chain)
static u_int last_cookie = ~(u_int) 0 - 1;
static nfsentry chain[MAX_CHAIN];
static int max_entries = MAX_CHAIN;
int num_entries = 0, i;
char *key;
int num_entries = 0, preflen = 0, i;
nfsentry *retval = (nfsentry *) NULL;
mntfs *mf;
mnt_map *mmp;
@ -972,25 +967,46 @@ make_entry_chain(am_node *mp, const nfsentry *current_chain)
/* iterate over keys */
for (i = 0; i < NKVHASH; i++) {
kv *k = mmp->kvhash[i];
while (k) {
kv *k;
for (k = mmp->kvhash[i]; k ; k = k->next) {
/*
* Skip unwanted entries which are either not real entries or
* very difficult to interpret (wildcards...) This test needs
* lots of improvement. Any takers?
*/
if (k->key && (strchr(k->key, '*') ||
strchr(k->key, '/') ||
key_already_in_chain(k->key, current_chain))) {
k = k->next;
key = k->key;
if (!key)
continue;
/* Skip '*' */
if (strchr(key, '*'))
continue;
/*
* If the map has a prefix-string then check if the key starts with
* this * string, and if it does, skip over this prefix.
*/
if (preflen) {
if (strncmp(key, mp->am_pref, preflen))
continue;
key += preflen;
}
/*
* No more '/' are allowed.
*/
if (strchr(key, '/') || key_already_in_chain(key, current_chain))
continue;
/* fill in a cell and link the entry */
if (num_entries >= max_entries) {
/* out of luck. send what you've got */
/* out of space */
plog(XLOG_DEBUG, "make_entry_chain: no more space in chain");
if (num_entries > 0) {
chain[num_entries - 1].ne_nextentry = 0;
retval = &chain[0];
}
return retval;
}
@ -999,12 +1015,11 @@ make_entry_chain(am_node *mp, const nfsentry *current_chain)
chain[num_entries].ne_fileid = (u_int) last_cookie;
*(u_int *) chain[num_entries].ne_cookie =
(u_int) last_cookie;
chain[num_entries].ne_name = k->key;
chain[num_entries].ne_name = key;
if (num_entries < max_entries - 1) { /* link to next one */
chain[num_entries].ne_nextentry = &chain[num_entries + 1];
}
++num_entries;
k = k->next;
} /* end of "while (k)" */
} /* end of "for (i ... NKVHASH ..." */

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: mntfs.c,v 1.4 1997/07/24 23:16:42 christos Exp $
* $Id: mntfs.c,v 1.5 1997/09/22 22:10:25 christos Exp $
*
*/
@ -168,7 +168,7 @@ find_mntfs(am_ops *ops, am_opts *mo, char *mp, char *info, char *auto_opts, char
mf->mf_private = 0;
}
fs = ops->ffserver ? (*ops->ffserver) (mf) : (fserver *) 0;
fs = ops->ffserver ? (*ops->ffserver) (mf) : (fserver *) NULL;
if (mf->mf_server)
free_srvr(mf->mf_server);
mf->mf_server = fs;

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: nfs_prot_svc.c,v 1.2 1997/07/24 23:16:47 christos Exp $
* $Id: nfs_prot_svc.c,v 1.3 1997/09/22 22:10:26 christos Exp $
*
*/
@ -91,7 +91,7 @@ nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp)
am_nfs_fh nfsproc_statfs_2_arg;
} argument;
char *result;
bool_t(*xdr_argument) (), (*xdr_result) ();
bool_t (*xdr_argument)(), (*xdr_result)();
char *(*local) ();
nfs_program_2_transp = NULL;
@ -220,7 +220,7 @@ nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp)
memset((char *) &argument, 0, sizeof(argument));
if (!svc_getargs(transp,
(XDRPROC_T_TYPE) xdr_argument,
(SVC_IN_ARG_TYPE) & argument)) {
(SVC_IN_ARG_TYPE) &argument)) {
plog(XLOG_ERROR,
"NFS xdr decode failed for %d %d %d",
rqstp->rq_prog, rqstp->rq_vers, rqstp->rq_proc);
@ -239,7 +239,7 @@ nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp)
if (!svc_freeargs(transp,
(XDRPROC_T_TYPE) xdr_argument,
(SVC_IN_ARG_TYPE) & argument)) {
plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program_1");
plog(XLOG_FATAL, "unable to free rpc arguments in nfs_program_2");
going_down(1);
}
}

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: nfs_start.c,v 1.5 1997/07/24 23:16:48 christos Exp $
* $Id: nfs_start.c,v 1.6 1997/09/22 22:10:30 christos Exp $
*
*/
@ -55,6 +55,11 @@
SVCXPRT *nfsxprt;
u_short nfs_port;
#ifdef HAVE_FS_AUTOFS
SVCXPRT *autofsxprt = NULL;
u_short autofs_port = 0;
#endif /* HAVE_FS_AUTOFS */
#ifndef HAVE_SIGACTION
# define MASKED_SIGS (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGCHLD)|sigmask(SIGHUP))
#endif /* not HAVE_SIGACTION */
@ -346,6 +351,9 @@ mount_automounter(int ppid)
#ifdef HAVE_TRANSPORT_TYPE_TLI
struct netconfig *udp_amqncp, *tcp_amqncp;
#endif /* HAVE_TRANSPORT_TYPE_TLI */
#ifdef HAVE_FS_AUTOFS
int soAUTOFS;
#endif /* HAVE_FS_AUTOFS */
/*
* Create the nfs service for amd
@ -364,26 +372,22 @@ mount_automounter(int ppid)
if (ret != 0)
return ret;
#ifdef HAVE_FS_AUTOFS
/*
* Create the autofs service for amd.
*/
plog(XLOG_INFO, "creating autofs service listener");
ret = create_autofs_service(&soAUTOFS, &autofs_port, &autofsxprt, autofs_program_1);
if (ret != 0)
return ret;
#endif /* HAVE_FS_AUTOFS */
/*
* Start RPC forwarding
*/
if (fwd_init() != 0)
return 3;
#if 0
/*
* One or other of so, fwd_sock
* must be the highest fd on
* which to select.
*/
if (soNFS > max_fds)
max_fds = soNFS;
if (soAMQ > max_fds)
max_fds = soAMQ;
if (fwd_sock > max_fds)
max_fds = fwd_sock;
#endif
/*
* Construct the root automount node
*/
@ -423,22 +427,26 @@ mount_automounter(int ppid)
unregister_amq();
#ifdef HAVE_TRANSPORT_TYPE_TLI
ret = svc_reg(tcp_amqp, AMQ_PROGRAM, AMQ_VERSION, amq_program_1, tcp_amqncp);
ret = svc_reg(tcp_amqp, get_amd_program_number(), AMQ_VERSION,
amq_program_1, tcp_amqncp);
#else /* not HAVE_TRANSPORT_TYPE_TLI */
ret = svc_register(tcp_amqp, AMQ_PROGRAM, AMQ_VERSION, amq_program_1, IPPROTO_TCP);
ret = svc_register(tcp_amqp, get_amd_program_number(), AMQ_VERSION,
amq_program_1, IPPROTO_TCP);
#endif /* not HAVE_TRANSPORT_TYPE_TLI */
if (ret != 1) {
plog(XLOG_FATAL, "unable to register (AMQ_PROGRAM, AMQ_VERSION, tcp)");
plog(XLOG_FATAL, "unable to register (AMQ_PROGRAM=%d, AMQ_VERSION, tcp)", get_amd_program_number());
return 3;
}
#ifdef HAVE_TRANSPORT_TYPE_TLI
ret = svc_reg(udp_amqp, AMQ_PROGRAM, AMQ_VERSION, amq_program_1, udp_amqncp);
ret = svc_reg(udp_amqp, get_amd_program_number(), AMQ_VERSION,
amq_program_1, udp_amqncp);
#else /* not HAVE_TRANSPORT_TYPE_TLI */
ret = svc_register(udp_amqp, AMQ_PROGRAM, AMQ_VERSION, amq_program_1, IPPROTO_UDP);
ret = svc_register(udp_amqp, get_amd_program_number(), AMQ_VERSION,
amq_program_1, IPPROTO_UDP);
#endif /* not HAVE_TRANSPORT_TYPE_TLI */
if (ret != 1) {
plog(XLOG_FATAL, "unable to register (AMQ_PROGRAM, AMQ_VERSION, udp)");
plog(XLOG_FATAL, "unable to register (AMQ_PROGRAM=%d, AMQ_VERSION, udp)", get_amd_program_number());
return 4;
}

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: nfs_subr.c,v 1.4 1997/07/24 23:16:50 christos Exp $
* $Id: nfs_subr.c,v 1.5 1997/09/22 22:10:31 christos Exp $
*
*/
@ -49,9 +49,16 @@
#include <amd.h>
/*
* Convert from UN*X to NFS error code
* Convert from UN*X to NFS error code.
* Some systems like linux define their own (see
* conf/mount/mount_linux.h).
*/
#define nfs_error(e) ((nfsstat)(e))
#ifndef nfs_error
# define nfs_error(e) ((nfsstat)(e))
#endif /* nfs_error */
/* forward declarations */
static void count_map_entries(const am_node *mp, u_int *out_blocks, u_int *out_bfree, u_int *out_bavail);
static char *
@ -221,7 +228,7 @@ quick_reply(am_node *mp, int error)
{
SVCXPRT *transp = mp->am_transp;
nfsdiropres res;
bool_t(*xdr_result) () = xdr_diropres;
bool_t (*xdr_result)() = xdr_diropres;
/*
* If there's a transp structure then we can reply to the client's
@ -510,6 +517,7 @@ nfsproc_statfs_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
static nfsstatfsres res;
am_node *mp;
int retry;
mntent_t mnt;
#ifdef DEBUG
amuDebug(D_TRACE)
@ -534,10 +542,23 @@ nfsproc_statfs_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
fp = &res.sfr_u.sfr_reply_u;
fp->sfrok_tsize = 1024;
fp->sfrok_bsize = 4096;
fp->sfrok_blocks = 0; /* set to 1 if you don't want empty automounts */
fp->sfrok_bfree = 0;
fp->sfrok_bavail = 0;
fp->sfrok_bsize = 1024;
/* check if map is browsable and show_statfs_entries=yes */
if ((gopt.flags & CFM_SHOW_STATFS_ENTRIES) &&
mp->am_mnt && mp->am_mnt->mf_mopts) {
mnt.mnt_opts = mp->am_mnt->mf_mopts;
if (hasmntopt(&mnt, "browsable")) {
count_map_entries(mp,
&fp->sfrok_blocks,
&fp->sfrok_bfree,
&fp->sfrok_bavail);
}
} else {
fp->sfrok_blocks = 0; /* set to 1 if you don't want empty automounts */
fp->sfrok_bfree = 0;
fp->sfrok_bavail = 0;
}
res.sfr_status = NFS_OK;
mp->am_stats.s_statfs++;
@ -545,3 +566,45 @@ nfsproc_statfs_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
return &res;
}
/*
* count how many total entries there are in a map, and how many
* of them are in use.
*/
static void
count_map_entries(const am_node *mp, u_int *out_blocks, u_int *out_bfree, u_int *out_bavail)
{
u_int blocks, bfree, bavail, i;
mntfs *mf;
mnt_map *mmp;
kv *k;
blocks = bfree = bavail = 0;
if (!mp)
goto out;
mf = mp->am_mnt;
if (!mf)
goto out;
mmp = (mnt_map *) mf->mf_private;
if (!mmp)
goto out;
/* iterate over keys */
for (i = 0; i < NKVHASH; i++) {
for (k = mmp->kvhash[i]; k ; k = k->next) {
if (!k->key)
continue;
blocks++;
/*
* XXX: Need to count how many are actively in use and recompute
* bfree and bavail based on it.
*/
}
}
out:
*out_blocks = blocks;
*out_bfree = bfree;
*out_bavail = bavail;
}

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: ops_afs.c,v 1.2 1997/07/24 23:16:52 christos Exp $
* $Id: ops_afs.c,v 1.3 1997/09/22 22:10:33 christos Exp $
*
*/
@ -226,8 +226,30 @@ am_ops union_ops =
#endif /* HAVE_AM_FS_UNION */
#ifdef HAVE_AM_FS_AUTOFS
/* Sun's kernel-based automounter-supporting file system */
am_ops autofs_ops =
{
"autofs",
afs_match,
0, /* afs_init */
autofs_mount,
0,
autofs_umount,
0,
afs_lookuppn,
afs_readdir, /* the browsable version of afs_readdir */
0, /* autofs_readlink */
autofs_mounted,
0, /* autofs_umounted */
find_afs_srvr,
FS_MKMNT | FS_NOTIMEOUT | FS_BACKGROUND | FS_AMQINFO | FS_DIRECTORY
};
#endif /* HAVE_AM_FS_AUTOFS */
/****************************************************************************
*** FUNCIONS ***
*** FUNCTIONS ***
****************************************************************************/
/*
* AFS needs nothing in particular.
@ -277,10 +299,9 @@ mount_toplvl(char *dir, char *opts)
am_nfs_fh *fhp;
struct sockaddr_in sin;
u_short port;
MTYPE_TYPE type = MOUNT_TYPE_NFS;
memset((voidp) &nfs_args, 0, sizeof(nfs_args)); /* Paranoid */
mnt.mnt_dir = dir;
@ -294,6 +315,10 @@ mount_toplvl(char *dir, char *opts)
* option entry, or the "auto" one, set the mount type to "nfs".
*/
mnt.mnt_type = HIDE_MOUNT_TYPE;
/* some systems don't have a mount type, but a mount flag */
#ifdef MNT2_NFS_OPT_AUTO
nfs_args.flags |= MNT2_NFS_OPT_AUTO;
#endif /* MNT2_NFS_OPT_AUTO */
retry = hasmntval(&mnt, "retry");
if (retry <= 0)
@ -482,7 +507,7 @@ mount_toplvl(char *dir, char *opts)
/*
* This is it! Here we try to mount amd on its mount points.
*/
error = mount_fs(&mnt, flags, (caddr_t) & nfs_args, retry, type, 0, NULL);
error = mount_fs(&mnt, flags, (caddr_t) & nfs_args, retry, type, 0, NULL, mnttab_file_name);
#ifdef HAVE_TRANSPORT_TYPE_TLI
free_knetconfig(nfs_args.knconf);
@ -496,7 +521,7 @@ mount_toplvl(char *dir, char *opts)
* Build a new map cache for this node, or re-use
* an existing cache for the same map.
*/
static void
void
afs_mkcacheref(mntfs *mf)
{
char *cache;
@ -705,7 +730,7 @@ again:
dlog("lstat(%s): %m", mp->am_path);
#endif /* DEBUG */
}
error = UMOUNT_FS(mp->am_path);
error = UMOUNT_FS(mp->am_path, mnttab_file_name);
if (error == EBUSY) {
plog(XLOG_WARNING, "afs_unmount retrying %s in 1s", mp->am_path);
sleep(1); /* XXX */
@ -872,17 +897,16 @@ afs_retry(int rc, int term, voidp closure)
if ((cp->start + ALLOWED_MOUNT_TIME) < clocktime()) {
/*
* The entire mount has timed out.
* Set the error code and skip past
* all the info vectors so that
* afs_bgmount will not have any more
* ways to try the mount, so causing
* an error.
* The entire mount has timed out. Set the error code and skip past all
* the info vectors so that afs_bgmount will not have any more ways to
* try the mount, so causing an error.
*/
plog(XLOG_INFO, "mount of \"%s\" has timed out", cp->mp->am_path);
error = ETIMEDOUT;
while (*cp->ivec)
cp->ivec++;
/* explicitly forbid further retries after timeout */
cp->retry = FALSE;
}
if (error || !IN_PROGRESS(cp)) {
(void) afs_bgmount(cp, error);
@ -898,18 +922,15 @@ afs_retry(int rc, int term, voidp closure)
static int
try_mount(voidp mvp)
{
int error;
int error = 0;
am_node *mp = (am_node *) mvp;
mntfs *mf = mp->am_mnt;
/*
* If the directory is not yet made and
* it needs to be made, then make it!
* This may be run in a backgroun process
* in which case the flag setting won't be
* noticed later - but it is set anyway
* just after run_task is called. It
* should probably go away totally...
* If the directory is not yet made and it needs to be made, then make it!
* This may be run in a background process in which case the flag setting
* won't be noticed later - but it is set anyway just after run_task is
* called. It should probably go away totally...
*/
if (!(mf->mf_flags & MFF_MKMNT) && mf->mf_ops->fs_flags & FS_MKMNT) {
error = mkdirs(mf->mf_mount, 0555);
@ -1302,10 +1323,10 @@ afs_bgmount(struct continuation * cp, int mpe)
switch (hard_error) {
case ETIMEDOUT:
case EWOULDBLOCK:
cp->mp->am_timeo = 5;
cp->mp->am_timeo = 17;
break;
default:
cp->mp->am_timeo = 17;
cp->mp->am_timeo = 5;
break;
}
new_ttl(cp->mp);
@ -1606,7 +1627,6 @@ afs_lookuppn(am_node *mp, char *fname, int *error_return, int op)
* Pick whichever first entry matched the list of selectors.
* Strip the selectors from the string, and assign to dfl the
* rest of the string.
* -Erez Zadok <ezk@cs.columbia.edu>
*/
if (rvec) {
am_opts ap;
@ -1715,10 +1735,8 @@ afs_lookuppn(am_node *mp, char *fname, int *error_return, int op)
memset((voidp) &cp->fs_opts, 0, sizeof(cp->fs_opts));
/*
* Try and mount the file system
* If this succeeds immediately (possible
* for a ufs file system) then return
* the attributes, otherwise just
* Try and mount the file system. If this succeeds immediately (possible
* for a ufs file system) then return the attributes, otherwise just
* return an error.
*/
error = afs_bgmount(cp, error);
@ -2125,3 +2143,831 @@ union_mounted(mntfs *mf)
}
}
#endif /* HAVE_AM_FS_UNION */
#ifdef HAVE_FS_AUTOFS
/*
* Pick a file system to try mounting and
* do that in the background if necessary
*
For each location:
if it is new -defaults then
extract and process
continue;
fi
if it is a cut then
if a location has been tried then
break;
fi
continue;
fi
parse mount location
discard previous mount location if required
find matching mounted filesystem
if not applicable then
this_error = No such file or directory
continue
fi
if the filesystem failed to be mounted then
this_error = error from filesystem
elif the filesystem is mounting or unmounting then
this_error = -1
elif the fileserver is down then
this_error = -1
elif the filesystem is already mounted
this_error = 0
break
fi
if no error on this mount then
this_error = initialise mount point
fi
if no error on this mount and mount is delayed then
this_error = -1
fi
if this_error < 0 then
retry = true
fi
if no error on this mount then
make mount point if required
fi
if no error on this mount then
if mount in background then
run mount in background
return -1
else
this_error = mount in foreground
fi
fi
if an error occured on this mount then
update stats
save error in mount point
fi
endfor
*/
static int
autofs_bgmount(struct continuation * cp, int mpe)
{
mntfs *mf = cp->mp->am_mnt; /* Current mntfs */
mntfs *mf_retry = 0; /* First mntfs which needed retrying */
int this_error = -1; /* Per-mount error */
int hard_error = -1;
int mp_error = mpe;
/*
* Try to mount each location.
* At the end:
* hard_error == 0 indicates something was mounted.
* hard_error > 0 indicates everything failed with a hard error
* hard_error < 0 indicates nothing could be mounted now
*/
for (; this_error && *cp->ivec; cp->ivec++) {
am_ops *p;
am_node *mp = cp->mp;
char *link_dir;
int dont_retry;
if (hard_error < 0)
hard_error = this_error;
this_error = -1;
if (**cp->ivec == '-') {
/*
* Pick up new defaults
*/
if (cp->auto_opts && *cp->auto_opts)
cp->def_opts = str3cat(cp->def_opts, cp->auto_opts, ";", *cp->ivec + 1);
else
cp->def_opts = strealloc(cp->def_opts, *cp->ivec + 1);
#ifdef DEBUG
dlog("Setting def_opts to \"%s\"", cp->def_opts);
#endif /* DEBUG */
continue;
}
/*
* If a mount has been attempted, and we find
* a cut then don't try any more locations.
*/
if (STREQ(*cp->ivec, "/") || STREQ(*cp->ivec, "||")) {
if (cp->tried) {
#ifdef DEBUG
dlog("Cut: not trying any more locations for %s",
mp->am_path);
#endif /* DEBUG */
break;
}
continue;
}
/* match the operators */
p = ops_match(&cp->fs_opts, *cp->ivec, cp->def_opts, mp->am_path, cp->key, mp->am_parent->am_mnt->mf_info);
/*
* Find a mounted filesystem for this node.
*/
mp->am_mnt = mf = realloc_mntfs(mf, p, &cp->fs_opts,
cp->fs_opts.opt_fs,
cp->fs_opts.fs_mtab,
cp->auto_opts,
cp->fs_opts.opt_opts,
cp->fs_opts.opt_remopts);
p = mf->mf_ops;
#ifdef DEBUG
dlog("Got a hit with %s", p->fs_type);
#endif /* DEBUG */
/*
* Note whether this is a real mount attempt
*/
if (p == &efs_ops) {
plog(XLOG_MAP, "Map entry %s for %s failed to match", *cp->ivec, mp->am_path);
if (this_error <= 0)
this_error = ENOENT;
continue;
} else {
if (cp->fs_opts.fs_mtab) {
plog(XLOG_MAP, "Trying mount of %s on \"%s\" fstype %s",
cp->fs_opts.fs_mtab, mp->am_path, p->fs_type);
}
cp->tried = TRUE;
}
this_error = 0;
dont_retry = FALSE;
if (mp->am_link) {
free(mp->am_link);
mp->am_link = 0;
}
link_dir = mf->mf_fo->opt_sublink;
if (link_dir && *link_dir) {
if (*link_dir == '/') {
mp->am_link = strdup(link_dir);
} else {
/*
* try getting fs option from continuation, not mountpoint!
* Don't try logging the string from mf, since it may be bad!
*/
if (cp->fs_opts.opt_fs != mf->mf_fo->opt_fs)
plog(XLOG_ERROR, "use %s instead of 0x%x",
cp->fs_opts.opt_fs, mf->mf_fo->opt_fs);
mp->am_link = str3cat((char *) 0,
cp->fs_opts.opt_fs, "/", link_dir);
normalize_slash(mp->am_link);
}
}
if (mf->mf_error > 0) {
this_error = mf->mf_error;
} else if (mf->mf_flags & (MFF_MOUNTING | MFF_UNMOUNTING)) {
/*
* Still mounting - retry later
*/
#ifdef DEBUG
dlog("Duplicate pending mount fstype %s", p->fs_type);
#endif /* DEBUG */
this_error = -1;
} else if (FSRV_ISDOWN(mf->mf_server)) {
/*
* Would just mount from the same place
* as a hung mount - so give up
*/
#ifdef DEBUG
dlog("%s is already hung - giving up", mf->mf_mount);
#endif /* DEBUG */
mp_error = EWOULDBLOCK;
dont_retry = TRUE;
this_error = -1;
} else if (mf->mf_flags & MFF_MOUNTED) {
#ifdef DEBUG
dlog("duplicate mount of \"%s\" ...", mf->mf_info);
#endif /* DEBUG */
/*
* Just call mounted()
*/
am_mounted(mp);
this_error = 0;
break;
}
/*
* Will usually need to play around with the mount nodes
* file attribute structure. This must be done here.
* Try and get things initialised, even if the fileserver
* is not known to be up. In the common case this will
* progress things faster.
*/
if (!this_error) {
/*
* Fill in attribute fields.
*/
if (mf->mf_ops->fs_flags & FS_DIRECTORY)
mk_fattr(mp, NFDIR);
else
mk_fattr(mp, NFLNK);
mp->am_fattr.na_fileid = mp->am_gen;
if (p->fs_init)
this_error = (*p->fs_init) (mf);
}
/*
* Make sure the fileserver is UP before doing any more work
*/
if (!FSRV_ISUP(mf->mf_server)) {
#ifdef DEBUG
dlog("waiting for server %s to become available", mf->mf_server->fs_host);
#endif /* DEBUG */
this_error = -1;
}
if (!this_error && mf->mf_fo->opt_delay) {
/*
* If there is a delay timer on the mount
* then don't try to mount if the timer
* has not expired.
*/
int i = atoi(mf->mf_fo->opt_delay);
if (i > 0 && clocktime() < (cp->start + i)) {
#ifdef DEBUG
dlog("Mount of %s delayed by %ds", mf->mf_mount, i - clocktime() + cp->start);
#endif /* DEBUG */
this_error = -1;
}
}
if (this_error < 0 && !dont_retry) {
if (!mf_retry)
mf_retry = dup_mntfs(mf);
cp->retry = TRUE;
}
if (!this_error)
if (p->fs_flags & FS_MBACKGROUND) {
mf->mf_flags |= MFF_MOUNTING; /* XXX */
#ifdef DEBUG
dlog("backgrounding mount of \"%s\"", mf->mf_mount);
#endif /* DEBUG */
if (cp->callout) {
untimeout(cp->callout);
cp->callout = 0;
}
run_task(try_mount, (voidp) mp, afs_cont, (voidp) cp);
mf->mf_flags |= MFF_MKMNT; /* XXX */
if (mf_retry)
free_mntfs(mf_retry);
return -1;
} else {
#ifdef DEBUG
dlog("foreground mount of \"%s\" ...", mf->mf_info);
#endif /* DEBUG */
this_error = try_mount((voidp) mp);
if (this_error < 0) {
if (!mf_retry)
mf_retry = dup_mntfs(mf);
cp->retry = TRUE;
}
}
if (this_error >= 0) {
if (this_error > 0) {
amd_stats.d_merr++;
if (mf != mf_retry) {
mf->mf_error = this_error;
mf->mf_flags |= MFF_ERROR;
}
}
/*
* Wakeup anything waiting for this mount
*/
wakeup((voidp) mf);
}
}
if (this_error && cp->retry) {
free_mntfs(mf);
mf = cp->mp->am_mnt = mf_retry;
/*
* Not retrying again (so far)
*/
cp->retry = FALSE;
cp->tried = FALSE;
/*
* Start at the beginning.
* Rewind the location vector and
* reset the default options.
*/
cp->ivec = cp->xivec;
cp->def_opts = strealloc(cp->def_opts, cp->auto_opts);
/*
* Arrange that autofs_bgmount is called
* after anything else happens.
*/
#ifdef DEBUG
dlog("Arranging to retry mount of %s", cp->mp->am_path);
#endif /* DEBUG */
sched_task(afs_retry, (voidp) cp, (voidp) mf);
if (cp->callout)
untimeout(cp->callout);
cp->callout = timeout(RETRY_INTERVAL, wakeup, (voidp) mf);
cp->mp->am_ttl = clocktime() + RETRY_INTERVAL;
/*
* Not done yet - so don't return anything
*/
return -1;
}
if (hard_error < 0 || this_error == 0)
hard_error = this_error;
/*
* Discard handle on duff filesystem.
* This should never happen since it
* should be caught by the case above.
*/
if (mf_retry) {
if (hard_error)
plog(XLOG_ERROR, "discarding a retry mntfs for %s", mf_retry->mf_mount);
free_mntfs(mf_retry);
}
/*
* If we get here, then either the mount succeeded or
* there is no more mount information available.
*/
if (hard_error < 0 && mp_error)
hard_error = cp->mp->am_error = mp_error;
if (hard_error > 0) {
/*
* Set a small(ish) timeout on an error node if
* the error was not a time out.
*/
switch (hard_error) {
case ETIMEDOUT:
case EWOULDBLOCK:
cp->mp->am_timeo = 17;
break;
default:
cp->mp->am_timeo = 5;
break;
}
new_ttl(cp->mp);
}
/*
* Make sure that the error value in the mntfs has a
* reasonable value.
*/
if (mf->mf_error < 0) {
mf->mf_error = hard_error;
if (hard_error)
mf->mf_flags |= MFF_ERROR;
}
/*
* In any case we don't need the continuation any more
*/
free_continuation(cp);
return hard_error;
}
/*
* Automount interface to RPC lookup routine
* Find the corresponding entry and return
* the file handle for it.
*/
am_node *
autofs_lookuppn(am_node *mp, char *fname, int *error_return, int op)
{
am_node *ap, *new_mp, *ap_hung;
char *info; /* Mount info - where to get the file system */
char **ivec, **xivec; /* Split version of info */
char *auto_opts; /* Automount options */
int error = 0; /* Error so far */
char path_name[MAXPATHLEN]; /* General path name buffer */
char apath[MAXPATHLEN]; /* authofs path (added space) */
char *pfname; /* Path for database lookup */
struct continuation *cp; /* Continuation structure if need to mount */
int in_progress = 0; /* # of (un)mount in progress */
char *dflts;
mntfs *mf;
#ifdef DEBUG
dlog("in autofs_lookuppn");
#endif /* DEBUG */
/*
* If the server is shutting down
* then don't return information
* about the mount point.
*/
if (amd_state == Finishing) {
#ifdef DEBUG
if ((mf = mp->am_mnt) == 0 || mf->mf_ops == &dfs_ops)
dlog("%s mount ignored - going down", fname);
else
dlog("%s/%s mount ignored - going down", mp->am_path, fname);
#endif /* DEBUG */
ereturn(ENOENT);
}
/*
* Handle special case of "." and ".."
*/
if (fname[0] == '.') {
if (fname[1] == '\0')
return mp; /* "." is the current node */
if (fname[1] == '.' && fname[2] == '\0') {
if (mp->am_parent) {
#ifdef DEBUG
dlog(".. in %s gives %s", mp->am_path, mp->am_parent->am_path);
#endif /* DEBUG */
return mp->am_parent; /* ".." is the parent node */
}
ereturn(ESTALE);
}
}
/*
* Check for valid key name.
* If it is invalid then pretend it doesn't exist.
*/
if (!valid_key(fname)) {
plog(XLOG_WARNING, "Key \"%s\" contains a disallowed character", fname);
ereturn(ENOENT);
}
/*
* Expand key name.
* fname is now a private copy.
*/
fname = expand_key(fname);
for (ap_hung = 0, ap = mp->am_child; ap; ap = ap->am_osib) {
/*
* Otherwise search children of this node
*/
if (FSTREQ(ap->am_name, fname)) {
mf = ap->am_mnt;
if (ap->am_error) {
error = ap->am_error;
continue;
}
/*
* If the error code is undefined then it must be
* in progress.
*/
if (mf->mf_error < 0)
goto in_progrss;
/*
* Check for a hung node
*/
if (FSRV_ISDOWN(mf->mf_server)) {
#ifdef DEBUG
dlog("server hung");
#endif /* DEBUG */
error = ap->am_error;
ap_hung = ap;
continue;
}
/*
* If there was a previous error with this node
* then return that error code.
*/
if (mf->mf_flags & MFF_ERROR) {
error = mf->mf_error;
continue;
}
if (!(mf->mf_flags & MFF_MOUNTED) || (mf->mf_flags & MFF_UNMOUNTING)) {
in_progrss:
/*
* If the fs is not mounted or it is unmounting then there
* is a background (un)mount in progress. In this case
* we just drop the RPC request (return nil) and
* wait for a retry, by which time the (un)mount may
* have completed.
*/
#ifdef DEBUG
dlog("ignoring mount of %s in %s -- flags (%x) in progress",
fname, mf->mf_mount, mf->mf_flags);
#endif /* DEBUG */
in_progress++;
continue;
}
/*
* Otherwise we have a hit: return the current mount point.
*/
#ifdef DEBUG
dlog("matched %s in %s", fname, ap->am_path);
#endif /* DEBUG */
free(fname);
return ap;
}
}
if (in_progress) {
#ifdef DEBUG
dlog("Waiting while %d mount(s) in progress", in_progress);
#endif /* DEBUG */
free(fname);
ereturn(-1);
}
/*
* If an error occured then return it.
*/
if (error) {
#ifdef DEBUG
errno = error; /* XXX */
dlog("Returning error: %m", error);
#endif /* DEBUG */
free(fname);
ereturn(error);
}
/*
* If doing a delete then don't create again!
*/
switch (op) {
case VLOOK_DELETE:
ereturn(ENOENT);
case VLOOK_CREATE:
break;
default:
plog(XLOG_FATAL, "Unknown op to autofs_lookuppn: 0x%x", op);
ereturn(EINVAL);
}
/*
* If the server is going down then just return,
* don't try to mount any more file systems
*/
if ((int) amd_state >= (int) Finishing) {
#ifdef DEBUG
dlog("not found - server going down anyway");
#endif /* DEBUG */
free(fname);
ereturn(ENOENT);
}
/*
* If we get there then this is a reference to an,
* as yet, unknown name so we need to search the mount
* map for it.
*/
if (mp->am_pref) {
sprintf(path_name, "%s%s", mp->am_pref, fname);
pfname = path_name;
} else {
pfname = fname;
}
mf = mp->am_mnt;
#ifdef DEBUG
dlog("will search map info in %s to find %s", mf->mf_info, pfname);
#endif /* DEBUG */
/*
* Consult the oracle for some mount information.
* info is malloc'ed and belongs to this routine.
* It ends up being free'd in free_continuation().
*
* Note that this may return -1 indicating that information
* is not yet available.
*/
error = mapc_search((mnt_map *) mf->mf_private, pfname, &info);
if (error) {
if (error > 0)
plog(XLOG_MAP, "No map entry for %s", pfname);
else
plog(XLOG_MAP, "Waiting on map entry for %s", pfname);
free(fname);
ereturn(error);
}
#ifdef DEBUG
dlog("mount info is %s", info);
#endif /* DEBUG */
/*
* Split info into an argument vector.
* The vector is malloc'ed and belongs to
* this routine. It is free'd in free_continuation()
*/
xivec = ivec = strsplit(info, ' ', '\"');
/*
* Default error code...
*/
if (ap_hung)
error = EWOULDBLOCK;
else
error = ENOENT;
/*
* Allocate a new map
*/
new_mp = exported_ap_alloc();
if (new_mp == 0) {
free((voidp) xivec);
free((voidp) info);
free((voidp) fname);
ereturn(ENOSPC);
}
if (mf->mf_auto)
auto_opts = mf->mf_auto;
else
auto_opts = "";
auto_opts = strdup(auto_opts);
#ifdef DEBUG
dlog("searching for /defaults entry");
#endif /* DEBUG */
if (mapc_search((mnt_map *) mf->mf_private, "/defaults", &dflts) == 0) {
char *dfl;
char **rvec;
#ifdef DEBUG
dlog("/defaults gave %s", dflts);
#endif /* DEBUG */
if (*dflts == '-')
dfl = dflts + 1;
else
dfl = dflts;
/*
* Chop the defaults up
*/
rvec = strsplit(dfl, ' ', '\"');
if (gopt.flags & CFM_ENABLE_DEFAULT_SELECTORS) {
/*
* Pick whichever first entry matched the list of selectors.
* Strip the selectors from the string, and assign to dfl the
* rest of the string.
*/
if (rvec) {
am_opts ap;
am_ops *pt;
char **sp = rvec;
while (*sp) { /* loop until you find something, if any */
memset((char *) &ap, 0, sizeof(am_opts));
pt = ops_match(&ap, *sp, "", mp->am_path, "/defaults",
mp->am_parent->am_mnt->mf_info);
if (pt == &efs_ops) {
plog(XLOG_MAP, "failed to match defaults for \"%s\"", *sp);
} else {
dfl = strip_selectors(*sp, "/defaults");
plog(XLOG_MAP, "matched default selectors \"%s\"", dfl);
break;
}
++sp;
}
}
} else { /* not enable_default_selectors */
/*
* Extract first value
*/
dfl = rvec[0];
}
/*
* If there were any values at all...
*/
if (dfl) {
/*
* Log error if there were other values
*/
if (!(gopt.flags & CFM_ENABLE_DEFAULT_SELECTORS) && rvec[1]) {
# ifdef DEBUG
dlog("/defaults chopped into %s", dfl);
# endif /* DEBUG */
plog(XLOG_USER, "More than a single value for /defaults in %s", mf->mf_info);
}
/*
* Prepend to existing defaults if they exist,
* otherwise just use these defaults.
*/
if (*auto_opts && *dfl) {
char *nopts = (char *) xmalloc(strlen(auto_opts) + strlen(dfl) + 2);
sprintf(nopts, "%s;%s", dfl, auto_opts);
free(auto_opts);
auto_opts = nopts;
} else if (*dfl) {
auto_opts = strealloc(auto_opts, dfl);
}
}
free(dflts);
/*
* Don't need info vector any more
*/
free((voidp) rvec);
}
/*
* Fill it in
*/
init_map(new_mp, fname);
/*
* Turn on autofs flag if needed.
*/
if (mp->am_flags & AMF_AUTOFS) {
new_mp->am_flags |= AMF_AUTOFS;
}
/*
* Put it in the table
*/
insert_am(new_mp, mp);
/*
* Fill in some other fields,
* path and mount point.
*
* bugfix: do not prepend old am_path if direct map
* <wls@astro.umd.edu> William Sebok
*/
strcpy(apath, fname);
strcat(apath, " ");
new_mp->am_path = str3cat(new_mp->am_path,
mf->mf_ops == &dfs_ops ? "" : mp->am_path,
*fname == '/' ? "" : "/",
apath);
#ifdef DEBUG
dlog("setting path to \"%s\"", new_mp->am_path);
#endif /* DEBUG */
/*
* Take private copy of pfname
*/
pfname = strdup(pfname);
/*
* Construct a continuation
*/
cp = ALLOC(struct continuation);
cp->callout = 0;
cp->mp = new_mp;
cp->xivec = xivec;
cp->ivec = ivec;
cp->info = info;
cp->key = pfname;
cp->auto_opts = auto_opts;
cp->retry = FALSE;
cp->tried = FALSE;
cp->start = clocktime();
cp->def_opts = strdup(auto_opts);
memset((voidp) &cp->fs_opts, 0, sizeof(cp->fs_opts));
/*
* Try and mount the file system. If this succeeds immediately (possible
* for a ufs file system) then return the attributes, otherwise just
* return an error.
*/
error = autofs_bgmount(cp, error);
reschedule_timeout_mp();
if (!error) {
free(fname);
return new_mp;
}
/*
* Code for quick reply. If nfs_program_2_transp is set, then
* its the transp that's been passed down from nfs_program_2().
* If new_mp->am_transp is not already set, set it by copying in
* nfs_program_2_transp. Once am_transp is set, quick_reply() can
* use it to send a reply to the client that requested this mount.
*/
if (nfs_program_2_transp && !new_mp->am_transp) {
new_mp->am_transp = (SVCXPRT *) xmalloc(sizeof(SVCXPRT));
*(new_mp->am_transp) = *nfs_program_2_transp;
}
if (error && (new_mp->am_mnt->mf_ops == &efs_ops))
new_mp->am_error = error;
assign_error_mntfs(new_mp);
free(fname);
ereturn(error);
}
#endif /* HAVE_FS_AUTOFS */

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: ops_cdfs.c,v 1.2 1997/07/24 23:16:53 christos Exp $
* $Id: ops_cdfs.c,v 1.3 1997/09/22 22:10:35 christos Exp $
*
*/
@ -140,7 +140,7 @@ mount_cdfs(char *dir, char *fs_name, char *opts)
/*
* Call generic mount routine
*/
return mount_fs(&mnt, flags, (caddr_t) &cdfs_args, 0, type, 0, NULL);
return mount_fs(&mnt, flags, (caddr_t) &cdfs_args, 0, type, 0, NULL, mnttab_file_name);
}
@ -162,5 +162,5 @@ cdfs_fmount(mntfs *mf)
static int
cdfs_fumount(mntfs *mf)
{
return UMOUNT_FS(mf->mf_mount);
return UMOUNT_FS(mf->mf_mount, mnttab_file_name);
}

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: ops_host.c,v 1.2 1997/07/24 23:16:56 christos Exp $
* $Id: ops_host.c,v 1.3 1997/09/22 22:10:36 christos Exp $
*
*/
@ -320,7 +320,7 @@ host_fmount(mntfs *mf)
/*
* Read the mount list
*/
mlist = read_mtab(mf->mf_mount);
mlist = read_mtab(mf->mf_mount, mnttab_file_name);
#ifdef MOUNT_TABLE_ON_FILE
/*
@ -525,7 +525,7 @@ host_fumount(mntfs *mf)
/*
* Read the mount list
*/
mntlist *mlist = read_mtab(mf->mf_mount);
mntlist *mlist = read_mtab(mf->mf_mount, mnttab_file_name);
#ifdef MOUNT_TABLE_ON_FILE
/*
@ -560,7 +560,7 @@ host_fumount(mntfs *mf)
/*
* Unmount "dir"
*/
error = UMOUNT_FS(dir);
error = UMOUNT_FS(dir, mnttab_file_name);
/*
* Keep track of errors
*/

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: ops_nfs.c,v 1.2 1997/07/24 23:17:01 christos Exp $
* $Id: ops_nfs.c,v 1.3 1997/09/22 22:10:38 christos Exp $
*
*/
@ -228,11 +228,14 @@ static void
discard_fh(fh_cache *fp)
{
rem_que(&fp->fh_q);
if (fp->fh_fs) {
#ifdef DEBUG
dlog("Discarding filehandle for %s:%s", fp->fh_fs->fs_host, fp->fh_path);
dlog("Discarding filehandle for %s:%s", fp->fh_fs->fs_host, fp->fh_path);
#endif /* DEBUG */
free_srvr(fp->fh_fs);
free((voidp) fp->fh_path);
free_srvr(fp->fh_fs);
}
if (fp->fh_path)
free((voidp) fp->fh_path);
free((voidp) fp);
}
@ -346,6 +349,17 @@ prime_nfs_fhandle_cache(char *path, fserver *fs, am_nfs_handle_t *fhbuf, voidp w
fp->fh_error = -1;
fp->fh_cid = timeout(FH_TTL, discard_fh, (voidp) fp);
/*
* if fs->fs_ip is null, remote server is probably down.
*/
if (!fs->fs_ip) {
/* Mark the fileserver down and invalid again */
fs->fs_flags &= ~FSF_VALID;
fs->fs_flags |= FSF_DOWN;
error = AM_ERRNO_HOST_DOWN;
return error;
}
/*
* If the address has changed then don't try to re-use the
* port information
@ -379,11 +393,24 @@ prime_nfs_fhandle_cache(char *path, fserver *fs, am_nfs_handle_t *fhbuf, voidp w
int
make_nfs_auth(void)
{
AUTH_CREATE_GIDLIST_TYPE group_wheel = 0;
/* Some NFS mounts (particularly cross-domain) require FQDNs to succeed */
#ifdef HAVE_TRANSPORT_TYPE_TLI
nfs_auth = authsys_create_default();
if (gopt.flags & CFM_FULLY_QUALIFIED_HOSTS) {
plog(XLOG_INFO, "Using NFS auth for fqhn \"%s\"", hostd);
nfs_auth = authsys_create(hostd, 0, 0, 1, &group_wheel);
} else {
nfs_auth = authsys_create_default();
}
#else /* not HAVE_TRANSPORT_TYPE_TLI */
nfs_auth = authunix_create_default();
if (gopt.flags & CFM_FULLY_QUALIFIED_HOSTS) {
plog(XLOG_INFO, "Using NFS auth for fqhn \"%s\"", hostd);
nfs_auth = authunix_create(hostd, 0, 0, 1, &group_wheel);
} else {
nfs_auth = authunix_create_default();
}
#endif /* not HAVE_TRANSPORT_TYPE_TLI */
if (!nfs_auth)
@ -546,7 +573,7 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *dir, char *fs_name, char *opts, mntfs *
struct netbuf nb; /* automatic space for addr field of nfs_args */
#endif /* HAVE_TRANSPORT_TYPE_TLI */
#if defined(HAVE_FS_NFS3) || defined(HAVE_TRANSPORT_TYPE_TLI)
char *nc_protoname;
char *nc_protoname = NULL;
#endif /* defined(HAVE_FS_NFS3) || defined(HAVE_TRANSPORT_TYPE_TLI) */
#if defined(MNTTAB_OPT_ACREGMIN) || defined(MNTTAB_OPT_ACTIMEO)
int acval = 0;
@ -595,10 +622,10 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *dir, char *fs_name, char *opts, mntfs *
#endif /* HAVE_FS_NFS3 */
plog(XLOG_INFO, "mount_nfs_fh: NFS version %d", nfs_version);
#if defined(HAVE_FS_NFS3) && defined(HAVE_TRANSPORT_TYPE_TLI)
#if defined(HAVE_FS_NFS3) || defined(HAVE_TRANSPORT_TYPE_TLI)
nc_protoname = nfs_proto;
plog(XLOG_INFO, "mount_nfs_fh: using NFS transport %s", nc_protoname);
#endif /* defined(HAVE_FS_NFS3) && defined(HAVE_TRANSPORT_TYPE_TLI) */
#endif /* defined(HAVE_FS_NFS3) || defined(HAVE_TRANSPORT_TYPE_TLI) */
#ifdef MNT2_NFS_OPT_TCP
if (STREQ(nfs_proto, "tcp"))
@ -650,7 +677,6 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *dir, char *fs_name, char *opts, mntfs *
#endif /* HAVE_FS_NFS3 */
NFS_FH_DREF(nfs_args.NFS_FH_FIELD, &(fhp->v2.fhs_fh));
#ifdef HAVE_FIELD_NFS_ARGS_T_FHSIZE
# ifdef HAVE_FS_NFS3
if (nfs_version == NFS_VERSION3)
@ -767,10 +793,22 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *dir, char *fs_name, char *opts, mntfs *
nfs_args.flags |= MNT2_NFS_OPT_COMPRESS;
#endif /* MNTTAB_OPT_COMPRESS */
#ifdef MNTTAB_OPT_NOCONN
#ifdef MNT2_NFS_OPT_NOCONN
/* check if user specified to use unconnected or connected sockets */
if (hasmntopt(&mnt, MNTTAB_OPT_NOCONN) != NULL)
nfs_args.flags |= MNT2_NFS_OPT_NOCONN;
#endif /* MNTTAB_OPT_NOCONN */
else if (hasmntopt(&mnt, MNTTAB_OPT_CONN) != NULL)
nfs_args.flags &= ~MNT2_NFS_OPT_NOCONN;
else
/*
* If "noconn" option exists and we're using NFS V.3, then define
* it. Otherwise NFS mounts cause hangs of mounts from
* multi-homed hosts when the return route is not the same as the
* outgoing route. This is especially important for some versions
* of NetBSD, and even for FreeBSD that does not have NFS V.3.
*/
nfs_args.flags |= MNT2_NFS_OPT_NOCONN;
#endif /* MNT2_NFS_OPT_NOCONN */
#ifdef MNT2_NFS_OPT_RESVPORT
# ifdef MNTTAB_OPT_RESVPORT
@ -888,8 +926,18 @@ mount_nfs_fh(am_nfs_handle_t *fhp, char *dir, char *fs_name, char *opts, mntfs *
# endif /* DG_MOUNT_NFS_VERSION */
#endif /* HAVE_FIELD_NFS_ARGS_VERSION */
error = mount_fs(&mnt, flags, (caddr_t) & nfs_args, retry, type,
nfs_version, nfs_proto);
#if defined(MNT2_GEN_OPT_OVERLAY) && defined(MNTTAB_OPT_OVERLAY)
/*
* Overlay this nfs mount: a must for autofs to work.
*/
if (hasmntopt(&mnt, MNTTAB_OPT_OVERLAY) != NULL) {
flags |= MNT2_GEN_OPT_OVERLAY;
plog(XLOG_INFO, "using an overlay nfs mount");
}
#endif /* defined(MNT2_GEN_OPT_OVERLAY) && defined(MNTTAB_OPT_OVERLAY) */
error = mount_fs(&mnt, flags, (caddr_t) &nfs_args, retry, type,
nfs_version, nfs_proto, mnttab_file_name);
free(xopts);
#ifdef HAVE_TRANSPORT_TYPE_TLI
@ -915,7 +963,7 @@ mount_nfs(char *dir, char *fs_name, char *opts, mntfs *mf)
static int
nfs_fmount(mntfs *mf)
{
int error;
int error = 0;
error = mount_nfs(mf->mf_mount, mf->mf_info, mf->mf_mopts, mf);
@ -933,7 +981,7 @@ nfs_fmount(mntfs *mf)
static int
nfs_fumount(mntfs *mf)
{
int error = UMOUNT_FS(mf->mf_mount);
int error = UMOUNT_FS(mf->mf_mount, mnttab_file_name);
/*
* Here is some code to unmount 'restarted' file systems.
@ -962,12 +1010,12 @@ nfs_fumount(mntfs *mf)
if (strncmp(mf->mf_mount, new_mf->mf_mount, len) == 0 &&
new_mf->mf_mount[len] == '/') {
UMOUNT_FS(new_mf->mf_mount);
UMOUNT_FS(new_mf->mf_mount, mnttab_file_name);
didsome = 1;
}
}
if (didsome)
error = UMOUNT_FS(mf->mf_mount);
error = UMOUNT_FS(mf->mf_mount, mnttab_file_name);
}
if (error)
return error;

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: ops_pcfs.c,v 1.2 1997/07/24 23:17:05 christos Exp $
* $Id: ops_pcfs.c,v 1.3 1997/09/22 22:10:39 christos Exp $
*
*/
@ -139,7 +139,7 @@ mount_pcfs(char *dir, char *fs_name, char *opts)
/*
* Call generic mount routine
*/
return mount_fs(&mnt, flags, (caddr_t) & pcfs_args, 0, type, 0, NULL);
return mount_fs(&mnt, flags, (caddr_t) & pcfs_args, 0, type, 0, NULL, mnttab_file_name);
}
@ -162,5 +162,5 @@ pcfs_fmount(mntfs *mf)
static int
pcfs_fumount(mntfs *mf)
{
return UMOUNT_FS(mf->mf_mount);
return UMOUNT_FS(mf->mf_mount, mnttab_file_name);
}

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: ops_ufs.c,v 1.2 1997/07/24 23:17:09 christos Exp $
* $Id: ops_ufs.c,v 1.3 1997/09/22 22:10:41 christos Exp $
*
*/
@ -135,7 +135,7 @@ mount_ufs(char *dir, char *fs_name, char *opts)
/*
* Call generic mount routine
*/
return mount_fs(&mnt, flags, (caddr_t) &ufs_args, 0, type, 0, NULL);
return mount_fs(&mnt, flags, (caddr_t) &ufs_args, 0, type, 0, NULL, mnttab_file_name);
}
@ -159,5 +159,5 @@ ufs_fmount(mntfs *mf)
static int
ufs_fumount(mntfs *mf)
{
return UMOUNT_FS(mf->mf_mount);
return UMOUNT_FS(mf->mf_mount, mnttab_file_name);
}

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: restart.c,v 1.4 1997/07/24 23:17:13 christos Exp $
* $Id: restart.c,v 1.5 1997/09/22 22:10:42 christos Exp $
*
*/
@ -73,7 +73,9 @@ restart(void)
* For each entry, find nfs, ufs or auto mounts
* and create a partial am_node to represent it.
*/
for (mlp = ml = read_mtab("restart"); mlp; mlp = mlp->mnext) {
for (mlp = ml = read_mtab("restart", mnttab_file_name);
mlp;
mlp = mlp->mnext) {
mntent_t *me = mlp->mnt;
am_ops *fs_ops = 0;
if (STREQ(me->mnt_type, MNTTAB_TYPE_UFS)) {

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: rpc_fwd.c,v 1.4 1997/07/24 23:17:15 christos Exp $
* $Id: rpc_fwd.c,v 1.5 1997/09/22 22:10:43 christos Exp $
*
*/
@ -300,10 +300,20 @@ fwd_packet(int type_id, voidp pkt, int len, struct sockaddr_in *fwdto, struct so
#ifdef DEBUG
{
char dq[20];
dlog("Sending packet id %#x to %s.%d", p->rf_xid, inet_dquad(dq, fwdto->sin_addr.s_addr), ntohs(fwdto->sin_port));
if (p && fwdto)
dlog("Sending packet id %#x to %s.%d",
p->rf_xid,
inet_dquad(dq, fwdto->sin_addr.s_addr),
ntohs(fwdto->sin_port));
}
#endif /* DEBUG */
/* if NULL, remote server probably down */
if (!fwdto) {
error = AM_ERRNO_HOST_DOWN;
goto out;
}
#ifdef HAVE_TRANSPORT_TYPE_TLI
ud.addr.buf = (char *) fwdto;
if (fwdto) /* if NULL, set sizes to zero */
@ -320,14 +330,14 @@ fwd_packet(int type_id, voidp pkt, int len, struct sockaddr_in *fwdto, struct so
}
#else /* not HAVE_TRANSPORT_TYPE_TLI */
if (sendto(fwd_sock, (char *) pkt, len, 0,
(struct sockaddr *) fwdto, sizeof(*fwdto)) < 0) {
(struct sockaddr *) fwdto, sizeof(*fwdto)) < 0)
error = errno;
}
#endif /* not HAVE_TRANSPORT_TYPE_TLI */
/*
* Save callback function and return address
*/
out:
p->rf_fwd = cb;
if (replyto)
p->rf_sin = *replyto;

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: sched.c,v 1.4 1997/07/24 23:17:16 christos Exp $
* $Id: sched.c,v 1.5 1997/09/22 22:10:44 christos Exp $
*
*/
@ -60,11 +60,7 @@ struct pjob {
int pid; /* Process ID of job */
cb_fun cb_fun; /* Callback function */
voidp cb_closure; /* Closure for callback */
#ifdef HAVE_SIGACTION
int w;
#else /* not HAVE_SIGACTION */
union wait w; /* Status filled in by sigchld */
#endif /* not HAVE_SIGACTION */
int w; /* everyone these days uses int, not a "union wait" */
voidp wchan; /* Wait channel */
};
@ -239,14 +235,10 @@ do_task_notify(void)
* Do callback if it exists
*/
if (p->cb_fun) {
#ifdef HAVE_SIGACTION
/* these two trigraphs will ensure compatibity with strict POSIX.1 */
(*p->cb_fun) (WIFEXITED(p->w) ? WEXITSTATUS(p->w) : 0,
WIFSIGNALED(p->w) ? WTERMSIG(p->w) : 0,
p->cb_closure);
#else /* not HAVE_SIGACTION */
(*p->cb_fun) (p->w.w_retcode, p->w.w_termsig, p->cb_closure);
#endif /* not HAVE_SIGACTION */
}
free((voidp) p);
}
@ -256,11 +248,7 @@ do_task_notify(void)
RETSIGTYPE
sigchld(int sig)
{
#ifdef HAVE_SIGACTION
int w;
#else /* not HAVE_SIGACTION */
union wait w;
#endif /* not HAVE_SIGACTION */
int w; /* everyone these days uses int, not a "union wait" */
int pid;
#ifdef HAVE_WAITPID
@ -272,21 +260,11 @@ sigchld(int sig)
if (WIFSIGNALED(w))
plog(XLOG_ERROR, "Process %d exited with signal %d",
#ifdef HAVE_SIGACTION
pid, WTERMSIG(w));
#else /* not HAVE_SIGACTION */
pid, w.w_termsig);
#endif /* not HAVE_SIGACTION */
#ifdef DEBUG
else
dlog("Process %d exited with status %d",
# ifdef HAVE_SIGACTION
pid, WEXITSTATUS(w));
# else /* not HAVE_SIGACTION */
pid, w.w_retcode);
# endif /* not HAVE_SIGACTION */
#endif /* DEBUG */
for (p = AM_FIRST(pjob, &proc_wait_list);

View File

@ -1,6 +1,6 @@
#!/usr/local/bin/perl
#
# $NetBSD: amd2netbsd,v 1.4 1997/09/07 21:56:12 veego Exp $
# $NetBSD: amd2netbsd,v 1.5 1997/09/22 22:09:55 christos Exp $
#
# Perl script to convert a standard distribution directory for am-utils into
# a NetBSD source tree.
@ -25,14 +25,15 @@ $version = "6.0a8";
@subdirs = ("usr.sbin/amd/libamu", "usr.sbin/amd/include",
"usr.sbin/amd/amd", "usr.sbin/amd/hlfsd",
"usr.sbin/amd/amq", "usr.sbin/amd/fsinfo",
"usr.sbin/amd/fixmount", "usr.sbin/amd/mk-amd-map");
"usr.sbin/amd/fixmount", "usr.sbin/amd/mk-amd-map",
"usr.sbin/amd/doc");
@includef = ("am_compat.h", "am_defs.h", "am_utils.h", "amq_defs.h");
@libamuf = ("hasmntopt.c", "misc_rpc.c", "mount_fs.c", "mtab.c",
"nfs_prot_xdr.c", "util.c", "wire.c", "xdr_mountres3.c",
"nfs_prot_xdr.c", "util.c", "wire.c", "xdr_func.c",
"xutil.c");
@libamudf = ("amu.h");
@ -95,6 +96,15 @@ $version = "6.0a8";
@mkamdmapef = ();
@docf = ("am-utils.info", "am-utils.info-1", "am-utils.info-2",
"am-utils.info-3", "am-utils.info-4", "am-utils.info-5",
"am-utils.info-6", "am-utils.texi", "hlfsd.ps", "texinfo.tex",
"version.texi");
@docdf = ();
@docef = ();
#
# Utility Subroutines
#
@ -206,6 +216,10 @@ print "Populating the usr.sbin/amd/fixmount directory.\n";
&copyfile("$srcdir/conf/checkmount/checkmount_bsd44.c",
"$targetdir/usr.sbin/amd/fixmount/check_mount.c");
print "Populating the usr.sbin/amd/doc directory.\n";
&copyfiles ("$srcdir/doc", "$targetdir/usr.sbin/amd/doc",
@docf, @docdf);
print "Populating the usr.sbin/amd/fsinfo directory.\n";
&copyfiles ("$srcdir/fsinfo", "$targetdir/usr.sbin/amd/fsinfo", @fsinfof,
@fsinfodf);
@ -255,6 +269,8 @@ while ($line = <DATA>) {
&dumpsrcs (@libamuf, @libamuef);
} elsif ($cmd[2] eq "mk-amd-map") {
&dumpsrcs (@mkamdmapf, @mkamdmapef);
} elsif ($cmd[2] eq "doc") {
&dumpsrcs (@docf, @docef);
} else {
die "Unknown SRCS command";
}
@ -300,8 +316,8 @@ SUBDIR= libamu amd amq hlfsd fixmount fsinfo mk-amd-map
LIBAMU != cd ${.CURDIR}/../libamu;\
printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -s -f-
CFLAGS += -I${.CURDIR}/../include -I${.CURDIR} -I${LIBAMU} -I. -DHAVE_CONFIG_H
LDADD += -L${LIBAMU} -lamu -lrpcsvc
DPADD += ${LIBAMU}/libamu.a
LDADD += -L${LIBAMU} -lamu -lrpcsvc -ll
DPADD += ${LIBAMU}/libamu.a ${LIBRPCSVC} ${LIBL}
BINDIR = /usr/sbin
%% file usr.sbin/amd/amd/Makefile
%% NetBSD #
@ -371,7 +387,7 @@ fsi_gram.c fsi_gram.h: fsi_gram.y
%% NetBSD #
LIB= amu
%% srcs libamu config_local.h
%% srcs libamu
config_local.h: mkconf
@rm -f ${.TARGET}
@ -411,6 +427,22 @@ cat << __EOF
#define HOST_OS "`uname -s | tr '[A-Z]' '[a-z]'``uname -r`"
__EOF
%% file usr.sbin/amd/doc/Makefile
%% NetBSD #
PROG = am-utils
SRCS = am-utils.texinfo
${PROG}: am-utils.dvi
am-utils.dvi: ${SRCS}
-tex am-utils.texinfo; tex am-utils.texinfo
clean:
-rm -f am-utils.aux am-utils.cp am-utils.cps am-utils.dvi am-utils.fn \
am-utils.fns am-utils.ky am-utils.kys am-utils.log am-utils.pg \
am-utils.pgs am-utils.toc am-utils.tp am-utils.tps am-utils.vr \
am-utils.vrs
%% file usr.sbin/amd/include/config.h
/* config.h. Generated automatically by configure. */
/* aux/config.h.in. Generated automatically from ./aux/configure.in by autoheader. */
@ -463,6 +495,9 @@ __EOF
/* Define if have union filesystem */
#define HAVE_AM_FS_UNION 1
/* Define if have Sun's autofs filesystem */
/* #undef HAVE_AM_FS_AUTOFS */
/*
* Check for types of maps available.
@ -603,8 +638,6 @@ __EOF
#define MOUNT_TYPE_UMAPFS MOUNT_UMAP
/*
* Check for the string name for the mount-table of a filesystem.
/*
* Check for the string name for the mount-table of a filesystem.
*/
@ -903,6 +936,9 @@ __EOF
* NFS-specific mount(2) options (hex numbers)
*/
/* hide mount type from df(1) */
/* #undef MNT2_NFS_OPT_AUTO */
/* set max secs for dir attr cache */
/* #undef MNT2_NFS_OPT_ACDIRMAX */
@ -1120,6 +1156,12 @@ __EOF
/* does struct sockaddr have field sa_len? */
#define HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN 1
/* does struct autofs_args have an addr field? */
/* #undef HAVE_FIELD_AUTOFS_ARGS_T_ADDR */
/* does umntrequest have an rdevid field? */
/* #undef HAVE_FIELD_UMNTREQUEST_RDEVID */
/* should signal handlers be reinstalled? */
/* #undef REINSTALL_SIGNAL_HANDLER */
@ -1215,6 +1257,9 @@ __EOF
#define WORDS_BIGENDIAN
#endif
/* Define if lex declares yytext as a char * by default, not a char[]. */
#define YYTEXT_POINTER 1
/* Turn off general debugging by default */
/* #undef DEBUG */
@ -1228,7 +1273,7 @@ __EOF
#define PACKAGE "am-utils"
/* Define version of package (must be defined by configure.in) */
#define VERSION "6.0a8"
#define VERSION "6.0a10"
/* Define name of host machine's cpu (eg. sparc) */
#define HOST_CPU MACHINE
@ -1296,6 +1341,9 @@ __EOF
/* Type of the 3rd argument to yp_order() */
#define YP_ORDER_OUTORDER_TYPE int
/* Type of the 5rd argument to authunix_create() */
#define AUTH_CREATE_GIDLIST_TYPE gid_t
/* The string used in printf to print the mount-type field of mount(2) */
#define MTYPE_PRINTF_TYPE "%s"
@ -1329,6 +1377,9 @@ __EOF
/* Define a type for the rfs_args structure */
/* #undef rfs_args_t */
/* define if have a bad version of memcmp() */
/* #undef HAVE_BAD_MEMCMP */
/* Define if you have the __seterr_reply function. */
/* #undef HAVE___SETERR_REPLY */
@ -1347,6 +1398,9 @@ __EOF
/* Define if you have the clnt_sperrno function. */
#define HAVE_CLNT_SPERRNO 1
/* Define if you have the clnt_tp_create_timed function. */
/* #undef HAVE_CLNT_TP_CREATE_TIMED */
/* Define if you have the cnodeid function. */
/* #undef HAVE_CNODEID */
@ -1398,15 +1452,15 @@ __EOF
/* Define if you have the hasmntopt function. */
/* #undef HAVE_HASMNTOPT */
/* Define if you have the hes_resolve function. */
/* #undef HAVE_HES_RESOLVE */
/* Define if you have the hes_init function. */
/* #undef HAVE_HES_INIT */
/* Define if you have the hesiod_init function. */
/* #undef HAVE_HESIOD_INIT */
/* Define if you have the hesiod_reload function. */
/* #undef HAVE_HESIOD_RELOAD */
/* Define if you have the hesiod_resolve function. */
/* #undef HAVE_HESIOD_RESOLVE */
/* Define if you have the hesiod_to_bind function. */
/* #undef HAVE_HESIOD_TO_BIND */
@ -1515,6 +1569,9 @@ __EOF
/* Define if you have the umount function. */
/* #undef HAVE_UMOUNT */
/* Define if you have the uname function. */
#define HAVE_UNAME 1
/* Define if you have the unmount function. */
#define HAVE_UNMOUNT 1
@ -1590,6 +1647,12 @@ __EOF
/* Define if you have the xdr_linkargs function. */
#define HAVE_XDR_LINKARGS 1
/* Define if you have the xdr_mntrequest function. */
/* #undef HAVE_XDR_MNTREQUEST */
/* Define if you have the xdr_mntres function. */
/* #undef HAVE_XDR_MNTRES */
/* Define if you have the xdr_mountbody function. */
#define HAVE_XDR_MOUNTBODY 1
@ -1656,6 +1719,12 @@ __EOF
/* Define if you have the xdr_symlinkargs function. */
#define HAVE_XDR_SYMLINKARGS 1
/* Define if you have the xdr_umntrequest function. */
/* #undef HAVE_XDR_UMNTREQUEST */
/* Define if you have the xdr_umntres function. */
/* #undef HAVE_XDR_UMNTRES */
/* Define if you have the xdr_writeargs function. */
#define HAVE_XDR_WRITEARGS 1
@ -1674,6 +1743,9 @@ __EOF
/* Define if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define if you have the <bsd/rpc/rpc.h> header file. */
/* #undef HAVE_BSD_RPC_RPC_H */
/* Define if you have the <cluster.h> header file. */
/* #undef HAVE_CLUSTER_H */
@ -1710,6 +1782,9 @@ __EOF
/* Define if you have the <libgen.h> header file. */
/* #undef HAVE_LIBGEN_H */
/* Define if you have the <linux/auto_fs.h> header file. */
/* #undef HAVE_LINUX_AUTO_FS_H */
/* Define if you have the <linux/fs.h> header file. */
/* #undef HAVE_LINUX_FS_H */
@ -1765,7 +1840,7 @@ __EOF
/* #undef HAVE_NETDIR_H */
/* Define if you have the <netinet/if_ether.h> header file. */
/* #undef HAVE_NETINET_IF_ETHER_H */
#define HAVE_NETINET_IF_ETHER_H 1
/* Define if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
@ -1887,6 +1962,9 @@ __EOF
/* Define if you have the <sys/fs/autofs.h> header file. */
/* #undef HAVE_SYS_FS_AUTOFS_H */
/* Define if you have the <sys/fs/autofs_prot.h> header file. */
/* #undef HAVE_SYS_FS_AUTOFS_PROT_H */
/* Define if you have the <sys/fs/cachefs_fs.h> header file. */
/* #undef HAVE_SYS_FS_CACHEFS_FS_H */
@ -2007,6 +2085,9 @@ __EOF
/* Define if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
/* Define if you have the <sys/vfs.h> header file. */
/* #undef HAVE_SYS_VFS_H */
@ -2037,8 +2118,8 @@ __EOF
/* Define if you have the <varargs.h> header file. */
#define HAVE_VARARGS_H 1
/* Define if you have the c library (-lc). */
#define HAVE_LIBC 1
/* Define if you have the gdbm library (-lgdbm). */
/* #undef HAVE_LIBGDBM */
/* Define if you have the rpc library (-lrpc). */
/* #undef HAVE_LIBRPC */
@ -2075,6 +2156,9 @@ __EOF
/* does gethostname() exist? */
#define HAVE_EXTERN_GETHOSTNAME 1
/* does getlogin() exist? */
#define HAVE_EXTERN_GETLOGIN 1
/* does gettablesize() exist? */
/* #undef HAVE_EXTERN_GETTABLESIZE */

View File

@ -1,4 +1,5 @@
.\"
.\" Copyright (c) 1997 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.
@ -16,7 +17,7 @@
.\" 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 acknowledgement:
.\" 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
@ -37,7 +38,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
.\" $Id: amq.8,v 1.8 1997/07/24 23:17:27 christos Exp $
.\" $Id: amq.8,v 1.9 1997/09/22 22:10:45 christos Exp $
.\"
.TH AMQ 8 "25 April 1989"
.SH NAME
@ -45,21 +46,20 @@ amq \- automounter query tool
.SH SYNOPSIS
.B amq
[
.BI \-fmpsuv
] [
.BI \-h " hostname"
] [
.BI \-l " log_file"
] [
.BI \-x " log_options"
] [
.BI \-D " debug_options"
] [
.BI \-M " mountmap entry"
] [
.B \-f
.BI \-P " program_number"
] [
.B \-m
] [
.B \-s
] [
.B \-u
] [
.B \-v
]
[
.I directory
] .\|.\|.
.SH DESCRIPTION
@ -69,58 +69,108 @@ provides a simple way of determining the current state of
program.
Communication is by
.SM RPC.
Three modes of operation are supported by the current protocol.
By default a list of mount points and auto-mounted filesystems
is output.
An alternative host can be specified using the
Three modes of operation are supported by the current protocol. By default
a list of mount points and auto-mounted filesystems is output. An
alternative host can be specified using the
.I \-h
option.
.LP
If directory names are given, as output by default,
then per-filesystem information is displayed.
If
.I directory
names are given, as output by default, then per-filesystem
information is displayed.
.SH OPTIONS
The
.I \-h
option specifies an alternate host to query.
By default the local host is used. In an
.TP
.B \-f
Ask the automounter to flush the internal caches.
.TP
.BI \-h " hostname"
Specify an alternate host to query. By default the local host is used. In
an
.SM HP-UX
cluster, the root server is queried by default, since
that is the system on which the automounter is normally run.
.LP
The
.I \-f
option asks the automounter to flush the internal caches.
The
.I \-m
option asks the automounter to provide a list of mounted filesystems,
including the number of references to each filesystem and any error
which occured while mounting.
The
.I \-s
option asks the automounter to provide system-wide mount statistics.
.LP
The
.I \-u
option asks the automounter to unmount the named filesystems
instead of providing information about them. Unmounts are requested,
not forced. They merely cause the mounted filesystem to timeout,
which will be picked up by
cluster, the root server is queried by default, since that is the system on
which the automounter is normally run.
.TP
.BI \-l " log_file"
Tell amd to use
.I log_file
as the log file name. For security reasons, this must be the same log file
which amd used when started. This option is therefore only useful to
refresh amd's open file handle on the log file, so that it can be rotated
and compressed via daily cron jobs.
.TP
.B \-m
Ask the automounter to provide a list of mounted filesystems, including the
number of references to each filesystem and any error which occurred while
mounting.
.TP
.B \-p
Return the process ID of the remote or locally running amd. Useful when you
need to send a signal to the local amd process, and would rather not have to
search through the process table. This option is used in the
.I ctl-amd
script.
.TP
.B \-s
Ask the automounter to provide system-wide mount statistics.
.TP
.B \-u
Ask the automounter to unmount the filesystems named in
.I directory
instead of providing
information about them. Unmounts are requested, not forced. They merely
cause the mounted filesystem to timeout, which will be picked up by
.BR amd 's
main scheduler thus causing the normal timeout action to be taken.
.LP
The
.I \-v
option asks the automounter for its version information. This is a
subset of the information output by
.TP
.B \-v
Ask the automounter for its version information. This is a subset of the
information output by
.BR amd 's
.I -v
option.
.LP
The
.I \-M
option passes a mount map entry to
.TP
.BI \-x " log_options"
Ask the automounter to use the logging options specified in
.I log_options
from now on.
.TP
.BI \-D " log_options"
Ask the automounter to use the debugging options specified in
.I debug_options
from now on.
.TP
.BI \-M " map_ent"
Pass a mount map entry to
.B amd
and waits for it to be evaluated, possible causing a mount.
and wait for it to be evaluated, possible causing a mount. This option is
highly insecure. By default, amd and amq do not support it. You have to
configure am-utils with
.I \-\-enable\-amq\-mount
to enable this option.
.TP
.BI \-P " program_number"
Contact an alternate running amd that had registered itself on a different
RPC
.I program_number
and apply all other operations to that instance of the automounter. This is
useful when you run multiple copies of amd, and need to manage each
one separately. If not specified, amq will use the default program number
for amd, 300019. For security reasons, the only alternate program numbers
amd can use range from 300019 to 300029, inclusive.
.SH FILES
.PD 0
.TP 20
@ -134,6 +184,15 @@ uses a Sun registered
program number (300019 decimal) which may not
be in the /etc/rpc database.
.SH "SEE ALSO"
.BR amd (8)
.SH AUTHOR
.BR amd (8),
.BR ctl-amd (8),
.BR amd.conf (5).
.SH AUTHORS
Jan-Simon Pendry <jsp@doc.ic.ac.uk>, Department of Computing, Imperial College, London, UK.
.P
Erez Zadok <ezk@cs.columbia.edu>, Department of Computer Science, Columbia
University, New York, USA.
.P
Other authors and contributors to am-utils are listed in the
.B AUTHORS
file distributed with am-utils.

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: amq.c,v 1.5 1997/07/24 23:17:29 christos Exp $
* $Id: amq.c,v 1.6 1997/09/22 22:10:46 christos Exp $
*
*/
@ -54,7 +54,7 @@ char copyright[] = "\
@(#)Copyright (c) 1990 The Regents of the University of California.\n\
@(#)All rights reserved.\n";
#if __GNUC__ < 2
static char rcsid[] = "$Id: amq.c,v 1.5 1997/07/24 23:17:29 christos Exp $";
static char rcsid[] = "$Id: amq.c,v 1.6 1997/09/22 22:10:46 christos Exp $";
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* __GNUC__ < 2 */
#endif /* not lint */
@ -69,9 +69,11 @@ static char sccsid[] = "%W% (Berkeley) %G%";
char *progname;
static int flush_flag;
static int minfo_flag;
static int getpid_flag;
static int unmount_flag;
static int stats_flag;
static int getvers_flag;
static int amd_program_number = AMQ_PROGRAM;
static char *debug_opts;
static char *amq_logfile;
static char *mount_map;
@ -328,7 +330,7 @@ main(int argc, char *argv[])
/*
* Parse arguments
*/
while ((opt_ch = getopt(argc, argv, "fh:l:msuvx:D:M:")) != EOF)
while ((opt_ch = getopt(argc, argv, "fh:l:msuvx:D:M:pP:")) != EOF)
switch (opt_ch) {
case 'f':
flush_flag = 1;
@ -349,6 +351,11 @@ main(int argc, char *argv[])
nodefault = 1;
break;
case 'p':
getpid_flag = 1;
nodefault = 1;
break;
case 's':
stats_flag = 1;
nodefault = 1;
@ -379,6 +386,10 @@ main(int argc, char *argv[])
nodefault = 1;
break;
case 'P':
amd_program_number = atoi(optarg);
break;
default:
errs = 1;
break;
@ -391,8 +402,9 @@ main(int argc, char *argv[])
if (errs) {
show_usage:
fprintf(stderr, "\
Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
\t[-l logfile|\"syslog\"] [-x log_flags] [-D dbg_opts] [-M mapent]\n", progname);
Usage: %s [-h host] [[-f] [-m] [-p] [-v] [-s]] | [[-u] directory ...]]\n\
\t[-l logfile|\"syslog\"] [-x log_flags] [-D dbg_opts] [-M mapent]\n\
\t[-P prognum]\n", progname);
exit(1);
}
#if defined(HAVE_CLUSTER_H) && defined(HAVE_CNODEID) && defined(HAVE_GETCCENT)
@ -432,9 +444,9 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
clnt = get_secure_amd_client(server, &tv, &s);
if (clnt == NULL) {
clnt = clnt_create(server, AMQ_PROGRAM, AMQ_VERSION, "tcp");
clnt = clnt_create(server, amd_program_number, AMQ_VERSION, "tcp");
if (clnt == 0) {
clnt = clnt_create(server, AMQ_PROGRAM, AMQ_VERSION, "udp");
clnt = clnt_create(server, amd_program_number, AMQ_VERSION, "udp");
if (clnt)
clnt_control(clnt, CLSET_RETRY_TIMEOUT, (char *) &tv);
}
@ -448,7 +460,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
/* first check if remote portmapper is up */
cs = pmap_rmtcall(&server_addr,
AMQ_PROGRAM,
amd_program_number,
AMQ_VERSION,
AMQPROC_NULL,
(XDRPROC_T_TYPE) xdr_void,
@ -465,11 +477,11 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
/* portmapper exists: get remote amd info from it */
s = RPC_ANYSOCK;
clnt = clnttcp_create(&server_addr, AMQ_PROGRAM, AMQ_VERSION, &s, 0, 0);
clnt = clnttcp_create(&server_addr, amd_program_number, AMQ_VERSION, &s, 0, 0);
if (clnt == 0) {
close(s);
s = privsock(SOCK_DGRAM);
clnt = clntudp_create(&server_addr, AMQ_PROGRAM, AMQ_VERSION, tv, &s);
clnt = clntudp_create(&server_addr, amd_program_number, AMQ_VERSION, tv, &s);
}
if (clnt == 0) {
fprintf(stderr, "%s: ", progname);
@ -495,6 +507,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
errs = 1;
}
}
/*
* Control logging
*/
@ -509,6 +522,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
errs = 1;
}
}
/*
* Control log file
*/
@ -523,6 +537,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
errs = 1;
}
}
/*
* Flush map cache
*/
@ -537,6 +552,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
errs = 1;
}
}
/*
* Mount info
*/
@ -555,6 +571,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
fprintf(stderr, "%s: amd on %s cannot provide mount info\n", progname, server);
}
}
/*
* Mount map
*/
@ -572,6 +589,7 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
perror("autmount point");
}
}
/*
* Get Version
*/
@ -585,6 +603,20 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\
errs = 1;
}
}
/*
* Get PID of amd
*/
if (getpid_flag) {
int *ip = amqproc_getpid_1((voidp) 0, clnt);
if (ip && *ip) {
printf("%d\n", *ip);
} else {
fprintf(stderr, "%s: failed to get PID of amd\n", progname);
errs = 1;
}
}
/*
* Apply required operation to all remaining arguments
*/
@ -748,7 +780,7 @@ get_secure_amd_client(char *host, struct timeval *tv, int *sock)
cs = rpcb_rmtcall(pm_nc,
host,
AMQ_PROGRAM,
amd_program_number,
AMQ_VERSION,
AMQPROC_NULL,
(XDRPROC_T_TYPE) xdr_void,
@ -776,7 +808,7 @@ get_secure_amd_client(char *host, struct timeval *tv, int *sock)
goto tryudp;
}
if (!rpcb_getaddr(AMQ_PROGRAM, AMQ_VERSION, nc, &nb, host)) {
if (!rpcb_getaddr(amd_program_number, AMQ_VERSION, nc, &nb, host)) {
/*
* don't pring error messages here, since amd might legitimately
* serve udp only
@ -795,7 +827,7 @@ get_secure_amd_client(char *host, struct timeval *tv, int *sock)
if (amq_bind_resv_port(*sock, (u_short *) 0) < 0)
goto tryudp;
if ((client = clnt_vc_create(*sock, &nb, AMQ_PROGRAM, AMQ_VERSION, 0, 0))
if ((client = clnt_vc_create(*sock, &nb, amd_program_number, AMQ_VERSION, 0, 0))
== (CLIENT *) NULL) {
fprintf(stderr, "clnt_vc_create failed");
t_close(*sock);
@ -819,7 +851,7 @@ tryudp:
fprintf(stderr, "getnetconfig for udp failed: %s\n", nc_sperror());
return NULL;
}
if (!rpcb_getaddr(AMQ_PROGRAM, AMQ_VERSION, nc, &nb, host)) {
if (!rpcb_getaddr(amd_program_number, AMQ_VERSION, nc, &nb, host)) {
fprintf(stderr, "%s\n",
clnt_spcreateerror("couldn't get amd address on udp"));
return NULL;
@ -836,7 +868,7 @@ tryudp:
if (amq_bind_resv_port(*sock, (u_short *) 0) < 0)
return NULL;
if ((client = clnt_dg_create(*sock, &nb, AMQ_PROGRAM, AMQ_VERSION, 0, 0))
if ((client = clnt_dg_create(*sock, &nb, amd_program_number, AMQ_VERSION, 0, 0))
== (CLIENT *) NULL) {
fprintf(stderr, "clnt_dg_create failed\n");
t_close(*sock);

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: amq.h,v 1.2 1997/07/24 23:17:30 christos Exp $
* $Id: amq.h,v 1.3 1997/09/22 22:10:47 christos Exp $
*
*/
@ -58,5 +58,6 @@ extern int *amqproc_setopt_1(amq_setopt *argp, CLIENT *rqstp);
extern amq_mount_info_list *amqproc_getmntfs_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);
#endif /* not _AMQ_H */

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: amq_clnt.c,v 1.3 1997/07/25 00:29:23 christos Exp $
* $Id: amq_clnt.c,v 1.4 1997/09/22 22:10:48 christos Exp $
*
*/
@ -191,3 +191,18 @@ amqproc_getvers_1(voidp argp, CLIENT *clnt)
}
return (&res);
}
int *
amqproc_getpid_1(voidp argp, CLIENT *clnt)
{
static int res;
memset((char *) &res, 0, sizeof(res));
if (clnt_call(clnt, AMQPROC_GETPID, (XDRPROC_T_TYPE) xdr_void, argp,
(XDRPROC_T_TYPE) xdr_int, (SVC_IN_ARG_TYPE) & res,
TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
return (&res);
}

View File

@ -1,54 +1,15 @@
#
# $Id: Makefile,v 1.4 1995/03/17 06:10:14 jtc Exp $
#
# 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. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# 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
# 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.
#
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
# $Id: Makefile,v 1.4 1995/03/17 06:10:14 jtc Exp $
# $NetBSD: Makefile,v 1.5 1997/09/22 22:10:49 christos Exp $
PROG = amdref
SRCS = amdref.texinfo
PROG = am-utils
SRCS = am-utils.texinfo
${PROG}: amdref.dvi
${PROG}: am-utils.dvi
amdref.dvi: ${SRCS}
-tex amdref.texinfo; tex amdref.texinfo
am-utils.dvi: ${SRCS}
-tex am-utils.texinfo; tex am-utils.texinfo
clean:
-rm -f amdref.aux amdref.cp amdref.cps amdref.dvi amdref.fn \
amdref.fns amdref.ky amdref.kys amdref.log amdref.pg amdref.pgs \
amdref.toc amdref.tp amdref.tps amdref.vr amdref.vrs
-rm -f am-utils.aux am-utils.cp am-utils.cps am-utils.dvi am-utils.fn \
am-utils.fns am-utils.ky am-utils.kys am-utils.log am-utils.pg \
am-utils.pgs am-utils.toc am-utils.tp am-utils.tps am-utils.vr \
am-utils.vrs

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
%% TeX macros to handle Texinfo files.
%% $Id: texinfo.tex,v 1.1.1.2 1997/09/22 21:13:24 christos Exp $
%% $Id: texinfo.tex,v 1.2 1997/09/22 22:10:58 christos Exp $
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
% 94, 95, 96, 97 Free Software Foundation, Inc.
@ -36,7 +36,7 @@
% This automatically updates the version number based on RCS.
\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
\deftexinfoversion$Revision: 1.1.1.2 $
\deftexinfoversion$Revision: 1.2 $
\message{Loading texinfo package [Version \texinfoversion]:}
% If in a .fmt file, print the version number

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.11 1997/07/28 00:46:59 christos Exp $
# $NetBSD: Makefile,v 1.12 1997/09/22 22:11:00 christos Exp $
PROG= fsinfo
SRCS= fsi_gram.c fsi_lex.c wr_fstab.c wr_exportfs.c wr_dumpset.c wr_bparam.c \

View File

@ -39,7 +39,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: fsi_lex.l,v 1.5 1997/07/24 23:18:27 christos Exp $
* $Id: fsi_lex.l,v 1.6 1997/09/22 22:11:01 christos Exp $
*
*/
@ -48,25 +48,8 @@
* TODO: Needs rewriting.
*/
static int xinput();
static void xunput();
#ifdef FLEX_SCANNER
static int yylineno;
/* Flex support with help from Vern Paxson <vern@helios.ee.lbl.gov> */
# undef YY_INPUT
# define YY_INPUT(buf,result,max_size) \
{ \
int i; \
for (i = 0; i < max_size; i++) { \
int ch = xinput(i == 0); \
if (ch == 0) \
break; \
buf[i] = ch; \
} \
result = i; \
}
# define INIT_STATE { \
switch ((yy_start - 1) / 2) { \
case 0: \
@ -75,17 +58,11 @@ static int yylineno;
} \
}
#else /* not FLEX_SCANNER */
/*
* Using old lex...
*/
# undef unput
# define unput(ch) xunput(ch)
# undef input
# define input() xinput(1)
# define INIT_STATE { \
switch (yybgin - yysvec - 1) { \
case 0: \
@ -119,10 +96,7 @@ static char *fsi_filename;
static char *optr;
static char ostr[1024];
static find_resword();
static unsigned char ibuf[64];
static unsigned char *iptr = ibuf;
static int quoted;
static int lastch, nextch = '\n';
YYSTYPE yylval;
struct r {
@ -258,186 +232,3 @@ current_location(void)
ip->i_file = fsi_filename;
return ip;
}
#ifdef FLEX_SCANNER
# undef yywrap
#endif /* FLEX_SCANNER */
int
yywrap(void)
{
static int first = 1;
if (first) {
char prog[16*1024];
strcpy(prog, "for file in ");
while (*++g_argv) {
if (access(*g_argv, 4) < 0) {
error("\"%s\": Cannot open for reading", *g_argv);
file_io_errors++;
} else {
strcat(prog, *g_argv);
strcat(prog, " ");
}
}
strcat(prog, "; do /lib/cpp ");
strcat(prog, idvbuf);
strcat(prog, " -DHOSTNAME=\'");
strcat(prog, hostname);
strcat(prog, "\' \"$file\"; done");
yyin = popen(prog, "r");
if (yyin) {
fsi_filename = strdup("unknown");
yylineno = 1;
first = 0;
return 0;
} else {
perror(prog);
}
}
if (!first && yyin && pclose(yyin) != 0)
parse_errors++;
return 1;
}
#define xgetc(fp) ((iptr > ibuf) ? (*--iptr) : (lastch = nextch, nextch = getc(fp), (nextch == EOF ? nextch = lastch, EOF : nextch)))
static int
xinput(int need)
{
static int c_comment = 0;
int ch, ch2;
do {
ch = xgetc(yyin);
if (ch == EOF) return 0;
if (quoted)
return ch;
if (c_comment) {
ch2 = ch;
do {
if (ch2 == '\n') {
nextch = '\n';
return ch2;
}
/* C style comment */
do {
ch2 = getc(yyin);
if (ch2 == '\n') {
nextch = '\n';
return ch2;
}
} while (ch2 != '*' && ch2 != EOF);
while (ch2 == '*')
ch2 = getc(yyin);
} while (ch2 != '/' && ch2 != EOF);
c_comment = 0;
if (ch2 == EOF)
break;
continue;
}
if (ch == '#') {
if (lastch == '\n') {
char fname[MAXPATHLEN];
char *fptr;
if (!need) {
xunput('#');
nextch = '\n';
return 0;
}
fname[0] = '\0';
/* Skip past space */
do {
ch2 = getc(yyin);
} while (ch2 != EOF && ch2 != '\n' && !isdigit(ch2));
if (isdigit(ch2)) {
/* Read in line number */
fptr = fname;
do {
*fptr++ = ch2;
ch2 = getc(yyin);
} while (isdigit(ch2));
*fptr = '\0';
if (fptr != fname)
yylineno = atoi(fname) - 1;
}
/* Skip past space */
while (ch2 != EOF && ch2 != '\"' && ch2 != '\n')
ch2 = getc(yyin);
if (ch2 == '\"') {
/* Read file name */
fptr = fname;
ch2 = getc(yyin);
while (ch2 != '\"' && ch2 != EOF && ch2 != EOF) {
*fptr++ = ch2;
ch2 = getc(yyin);
}
*fptr = '\0';
if (fname[0]) {
log("Setting filename to \"%s\"", fname);
fsi_filename = strdup(fname);
}
}
while (ch2 != '\n' && ch2 != EOF)
ch2 = getc(yyin);
} else do {
ch2 = getc(yyin);
} while (ch2 != '\n' && ch2 != EOF);
if (ch2 == '\n') {
nextch = '\n';
return ch2;
}
} else if (ch == '/') {
ch2 = getc(yyin);
if (ch2 == '/') {
/* C++ style comment */
do {
ch2 = getc(yyin);
} while (ch2 != '\n' && ch2 != EOF);
if (ch2 == '\n') {
nextch = '\n';
return ch2;
}
} else if (ch2 == '*') {
c_comment = 1;
continue;
} else {
xunput(ch2);
return ch;
}
} else {
return ch;
}
} while (ch2 != EOF);
error("End of file within comment");
return 0;
}
static void
xunput(int c)
{
if (c && c != EOF) {
if (iptr == ibuf + sizeof(ibuf) - 1)
fatal("Out of space in lexical pushback");
*iptr++ = c;
}
}

View File

@ -1,3 +1,5 @@
.\"
.\" Copyright (c) 1997 Erez Zadok
.\" Copyright (c) 1993 Jan-Simon Pendry.
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -11,7 +13,7 @@
.\" 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 acknowledgement:
.\" 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
@ -31,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)fsinfo.8 8.1 (Berkeley) 6/28/93
.\" $Id: fsinfo.8,v 1.3 1997/07/24 23:18:30 christos Exp $
.\" $Id: fsinfo.8,v 1.4 1997/09/22 22:11:02 christos Exp $
.\"
.TH FSINFO 8 "June 28, 1993"
.SH NAME

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: wr_atab.c,v 1.4 1997/07/24 23:18:34 christos Exp $
* $Id: wr_atab.c,v 1.5 1997/09/22 22:11:03 christos Exp $
*
*/
@ -325,7 +325,7 @@ write_atab(qelem *q)
if (mount_pref) {
auto_tree *tp;
show_area_being_processed("write automount", 0);
show_area_being_processed("write automount", 5);
ITER(tp, auto_tree, q)
errors += write_amount(tp->t_mount, tp->t_defaults);
}

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: wr_exportfs.c,v 1.4 1997/07/24 23:18:38 christos Exp $
* $Id: wr_exportfs.c,v 1.5 1997/09/22 22:11:03 christos Exp $
*
*/
@ -89,7 +89,7 @@ write_exportfs(qelem *q)
if (exportfs_pref) {
host *hp;
show_area_being_processed("write exportfs", 0);
show_area_being_processed("write exportfs", 5);
ITER(hp, host, q) {
if (hp->h_disk_fs) {
FILE *ef = pref_open(exportfs_pref, hp->h_hostname, gen_hdr, hp->h_hostname);

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: am_defs.h,v 1.2 1997/07/24 23:18:43 christos Exp $
* $Id: am_defs.h,v 1.3 1997/09/22 22:11:05 christos Exp $
*
*/
@ -280,6 +280,13 @@ extern int errno;
# include <sys/fsid.h>
#endif /* HAVE_SYS_FSID_H */
/*
* Actions to take if <sys/utsname.h> exists.
*/
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif /* HAVE_SYS_UTSNAME_H */
/*
* Actions to take if <sys/mntent.h> exists.
*/
@ -453,6 +460,27 @@ extern int errno;
# include <linux/fs.h>
#endif /* HAVE_LINUX_FS_H */
/*
* Actions to take if <linux/auto_fs.h> exists.
*/
#ifdef HAVE_LINUX_AUTO_FS_H
# include <linux/auto_fs.h>
#endif /* HAVE_LINUX_AUTO_FS_H */
/*
* Actions to take if <sys/fs/autofs.h> exists.
*/
#ifdef HAVE_SYS_FS_AUTOFS_H
# include <sys/fs/autofs.h>
#endif /* HAVE_SYS_FS_AUTOFS_H */
/*
* Actions to take if <sys/fs/autofs_prot.h> exists.
*/
#ifdef HAVE_SYS_FS_AUTOFS_PROT_H
# include <sys/fs/autofs_prot.h>
#endif /* HAVE_SYS_FS_AUTOFS_PROT_H */
/*
* NFS PROTOCOL HEADER FILES:
*/
@ -493,7 +521,7 @@ extern int errno;
#ifdef HAVE_NFS_MOUNT_H
# include <nfs/mount.h>
#endif /* HAVE_NFS_MOUNT_H */
#ifdef HAVE_NFS_NFS_MOUNT_H
#ifdef HAVE_NFS_NFS_MOUNT_H_off
# include <nfs/nfs_mount.h>
#endif /* HAVE_NFS_NFS_MOUNT_H */
#ifdef HAVE_NFS_PATHCONF_H
@ -573,13 +601,6 @@ extern int errno;
# include <sys/uio.h>
#endif /* HAVE_SYS_UIO_H */
/*
* Actions to take if <sys/fs/autofs.h> exists.
*/
#ifdef HAVE_SYS_FS_AUTOFS_H
# include <sys/fs/autofs.h>
#endif /* HAVE_SYS_FS_AUTOFS_H */
/*
* Actions to take if <sys/fs/cachefs_fs.h> exists.
*/
@ -987,12 +1008,22 @@ extern char *nc_sperror(void);
# endif /* not HAVE_BCOPY */
#endif /* not HAVE_MEMMOVE */
#ifndef HAVE_MEMCMP
/*
* memcmp() is more problematic:
* Systems that don't have it, but have bcmp(), will use bcmp() instead.
* Those that have it, but it is bad (SunOS 4 doesn't handle
* 8 bit comparisons correctly), will get to use am_memcmp().
* Otherwise if you have memcmp() and it is good, use it.
*/
#ifdef HAVE_MEMCMP
# ifdef HAVE_BAD_MEMCMP
# define memcmp am_memcmp
extern int am_memcmp(const voidp s1, const voidp s2, size_t len);
# endif /* HAVE_BAD_MEMCMP */
#else /* not HAVE_MEMCMP */
# ifdef HAVE_BCMP
# define memcmp(a, b, len) bcmp((a), (b), (len))
# else /* not HAVE_BCMP */
# error Cannot find either memcmp or bcmp!
# endif /* not HAVE_BCMP */
# endif /* HAVE_BCMP */
#endif /* not HAVE_MEMCMP */
#ifndef HAVE_SETEUID
@ -1100,6 +1131,9 @@ extern int wait3(int *statusp, int options, struct rusage *rusage);
extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
#endif /* not HAVE_EXTERN_XDR_OPAQUE_AUTH */
#ifndef HAVE_EXTERN_GETLOGIN
extern char *getlogin(void);
#endif /* not HAVE_EXTERN_GETLOGIN */
/****************************************************************************/
/*

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: am_utils.h,v 1.2 1997/07/24 23:18:44 christos Exp $
* $Id: am_utils.h,v 1.3 1997/09/22 22:11:07 christos Exp $
*
*/
@ -134,8 +134,9 @@
* Systems which have the mount table in a file need to read it before
* they can perform an unmount() system call.
*/
#define UMOUNT_FS(dir) umount_fs(dir)
extern int umount_fs(char *fs_name); /* imported via $srcdir/conf/umount */
#define UMOUNT_FS(dir, mtb_name) umount_fs(dir, mtb_name)
/* imported via $srcdir/conf/umount/umount_*.c */
extern int umount_fs(char *fs_name, const char *mnttabname);
/*
* macros for automounter vfs/vnode operations.
@ -180,6 +181,9 @@ extern int umount_fs(char *fs_name); /* imported via $srcdir/conf/umount */
*/
#define AMF_NOTIMEOUT 0x0001 /* This node never times out */
#define AMF_ROOT 0x0002 /* This is a root node */
#ifdef HAVE_FS_AUTOFS
# define AMF_AUTOFS 0x0004 /* this node is of type autofs */
#endif /* HAVE_FS_AUTOFS */
/*
* The following values can be tuned...
@ -211,6 +215,20 @@ extern int umount_fs(char *fs_name); /* imported via $srcdir/conf/umount */
*/
#define AMD_COMPAT 5000000 /* 5.0 */
/*
* Error to return if remote host is not available.
* Try, in order, "host down", "host unreachable", "invalid argument".
*/
#ifdef EHOSTDOWN
# define AM_ERRNO_HOST_DOWN EHOSTDOWN
# else /* not EHOSTDOWN */
# ifdef EHOSTUNREACH
# define AM_ERRNO_HOST_DOWN EHOSTUNREACH
# else /* not EHOSTUNREACH */
# define AM_ERRNO_HOST_DOWN EINVAL
# endif /* not EHOSTUNREACH */
#endif /* not EHOSTDOWN */
/**************************************************************************/
/*** STRUCTURES AND TYPEDEFS ***/
@ -295,7 +313,7 @@ struct mntfs {
char *mf_mopts; /* FS mount opts */
char *mf_remopts; /* Remote FS mount opts */
fserver *mf_server; /* File server */
int mf_flags; /* Flags */
int mf_flags; /* Flags MFF_* */
int mf_error; /* Error code from background mount */
int mf_refc; /* Number of references to this node */
int mf_cid; /* Callout id */
@ -357,8 +375,8 @@ struct am_ops {
vlookuppn lookuppn; /* fxn: lookup path-name */
vreaddir readdir; /* fxn: read directory */
vreadlink readlink; /* fxn: read link */
vmounted mounted; /* fxn: */
vumounted umounted; /* fxn: */
vmounted mounted; /* fxn: (async callback?) */
vumounted umounted; /* fxn: (async callback?) */
vffserver ffserver; /* fxn: find a file server */
int fs_flags; /* filesystem flags FS_* */
};
@ -455,28 +473,26 @@ struct fserver {
* Map of auto-mount points.
*/
struct am_node {
int am_mapno; /* Map number */
mntfs *am_mnt; /* Mounted filesystem */
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-directory */
am_node *am_parent; /* Parent of this node */
am_node *am_ysib; /* Younger sibling of this node */
am_node *am_osib; /* Older sibling of this node */
am_node *am_child; /* First child of this node */
nfsattrstat am_attr; /* File attributes */
int am_mapno; /* Map number */
mntfs *am_mnt; /* Mounted filesystem */
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 */
am_node *am_parent; /* Parent of this node */
am_node *am_ysib; /* Younger sibling of this node */
am_node *am_osib; /* Older sibling of this node */
am_node *am_child; /* First child of this node */
nfsattrstat am_attr; /* File attributes */
#define am_fattr am_attr.ns_u.ns_attr_u
int am_flags; /* Boolean flags */
int am_error; /* Specific mount error */
time_t am_ttl; /* Time to live */
int am_timeo_w; /* Wait interval */
int am_timeo; /* Timeout interval */
u_int am_gen; /* Generation number */
char *am_pref; /* Mount info prefix */
am_stats am_stats; /* Statistics gathering */
SVCXPRT *am_transp; /* Info for quick reply */
int am_flags; /* Boolean flags AMF_* */
int am_error; /* Specific mount error */
time_t am_ttl; /* Time to live */
int am_timeo_w; /* Wait interval */
int am_timeo; /* Timeout interval */
u_int am_gen; /* Generation number */
char *am_pref; /* Mount info prefix */
am_stats am_stats; /* Statistics gathering */
SVCXPRT *am_transp; /* Info for quick reply */
};
@ -487,7 +503,7 @@ struct am_node {
/*
* Useful constants
*/
extern char *mtab; /* Mount table */
extern char *mnttab_file_name; /* Mount table */
extern char *cpu; /* "CPU type" */
extern char *endian; /* "big" */
extern char *hostdomain; /* "southseas.nz" */
@ -536,7 +552,6 @@ extern am_node *efs_lookuppn(am_node *, char *, int *, int);
extern am_node *exported_ap_alloc(void);
extern am_node *fh_to_mp(am_nfs_fh *);
extern am_node *fh_to_mp3(am_nfs_fh *, int *, int);
extern am_node *find_ap(char *);
extern am_node *find_mf(mntfs *);
extern am_node *next_map(int *);
extern am_node *root_ap(char *, int);
@ -563,6 +578,7 @@ extern int efs_readdir(am_node *, nfscookie, nfsdirlist *, nfsentry *, int);
extern int eval_fs_opts(am_opts *, char *, char *, char *, char *, char *);
extern int fwd_init(void);
extern int fwd_packet(int, voidp, int, struct sockaddr_in *, struct sockaddr_in *, voidp, fwd_fun);
extern int get_amd_program_number(void);
extern int hasmntval(mntent_t *, char *);
extern int islocalnet(u_long);
extern int make_nfs_auth(void);
@ -573,7 +589,7 @@ extern int mkdirs(char *, int);
extern int mount_auto_node(char *, voidp);
extern int mount_automounter(int);
extern int mount_exported(void);
extern int mount_fs(mntent_t *, int, caddr_t, int, MTYPE_TYPE, u_long, const char *);
extern int mount_fs(mntent_t *, int, caddr_t, int, MTYPE_TYPE, u_long, const char *, const char *);
extern int mount_node(am_node *);
extern int nfs_srvr_port(fserver *, u_short *, voidp);
extern int pickup_rpc_reply(voidp, int, voidp, XDRPROC_T_TYPE);
@ -582,14 +598,13 @@ extern int softclock(void);
extern int switch_option(char *);
extern int switch_to_logfile(char *);
extern int timeout(u_int, void(*fn)(), voidp);
extern int umount_fs(char *);
extern int valid_key(char *);
extern mnt_map *mapc_find(char *, char *, const char *);
extern mntfs *dup_mntfs(mntfs *);
extern mntfs *find_mntfs(am_ops *, am_opts *, char *, char *, char *, char *, char *);
extern mntfs *new_mntfs(void);
extern mntfs *realloc_mntfs(mntfs *, am_ops *, am_opts *, char *, char *, char *, char *, char *);
extern mntlist *read_mtab(char *);
extern mntlist *read_mtab(char *, const char *);
extern struct sockaddr_in *amu_svc_getcaller(SVCXPRT *xprt);
extern time_t time(time_t *);
extern void am_mounted(am_node *);
@ -637,25 +652,26 @@ extern void rmdirs(char *);
extern void rpc_msg_init(struct rpc_msg *, u_long, u_long, u_long);
extern void run_task(task_fun, voidp, cb_fun, voidp);
extern void sched_task(cb_fun, voidp, voidp);
extern void set_amd_program_number(int program);
extern void show_opts(int ch, struct opt_tab *);
extern void show_rcs_info(const char *, char *);
extern void srvrlog(fserver *, char *);
extern void timeout_mp(void);
extern void umount_exported(void);
extern void unregister_amq(void);
extern void unregister_amq();
extern void untimeout(int);
extern void wakeup(voidp);
extern void wakeup_srvr(fserver *);
extern void wakeup_task(int, int, voidp);
extern void write_mntent(mntent_t *);
extern voidp xmalloc(int);
extern voidp xrealloc(voidp, int);
extern u_long get_nfs_version(char *host, struct sockaddr_in *sin, u_long nfs_version, const char *proto);
#ifdef MOUNT_TABLE_ON_FILE
extern void rewrite_mtab(mntlist *);
extern void rewrite_mtab(mntlist *, const char *);
extern void unlock_mntlist(void);
extern void write_mntent(mntent_t *, const char *);
#endif /* MOUNT_TABLE_ON_FILE */
#if defined(HAVE_SYSLOG_H) || defined(HAVE_SYS_SYSLOG_H)
@ -821,6 +837,13 @@ extern am_ops sfsx_ops; /* Symlink FS with existence check */
extern am_ops union_ops; /* Union FS */
#endif /* HAVE_AM_FS_UNION */
/*
* Autofs file system
*/
#ifdef HAVE_AM_FS_AUTOFS
extern am_ops autofs_ops; /* Autofs FS */
#endif /* HAVE_AM_FS_AUTOFS */
/**************************************************************************/
/*** DEBUGGING ***/

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: amd.h,v 1.2 1997/07/24 23:18:46 christos Exp $
* $Id: amd.h,v 1.3 1997/09/22 22:11:09 christos Exp $
*
*/
@ -55,9 +55,11 @@
#define CFM_MOUNT_TYPE_AUTOFS 0x0002
#define CFM_ENABLE_DEFAULT_SELECTORS 0x0004
#define CFM_NORMALIZE_HOSTNAMES 0x0008
#define CFM_NOSWAP 0x0010
#define CFM_PROCESS_LOCK 0x0010
#define CFM_PRINT_PID 0x0020
#define CFM_RESTART_EXISTING_MOUNTS 0x0040
#define CFM_SHOW_STATFS_ENTRIES 0x0080
#define CFM_FULLY_QUALIFIED_HOSTS 0x0100
/* some systems (SunOS 4.x) neglect to define the mount null message */
@ -109,15 +111,19 @@ struct amu_global_options {
int afs_timeo; /* NFS retry interval */
int am_timeo; /* cache duration */
int am_timeo_w; /* dismount interval */
int portmap_program; /* amd RPC program number */
#ifdef HAVE_MAP_LDAP
char *ldap_base; /* LDAP base */
char *ldap_hostports; /* LDAP host ports */
long ldap_cache_seconds; /* LDAP internal cache - keep seconds */
long ldap_cache_maxmem; /* LDAP internal cache - max memory (bytes) */
#endif /* HAVE_MAP_LDAP */
#ifdef HAVE_MAP_NIS
char *nis_domain; /* YP domain name */
#endif /* HAVE_MAP_NIS */
};
/* if you add anything here, update conf.c:reset_cf_map() */
struct cf_map {
char *cfm_dir; /* /home, /u, /src */
char *cfm_name; /* amd.home, /etc/amd.home ... */
@ -170,26 +176,33 @@ extern amq_mount_stats *amqproc_stats_1_svc(voidp argp, struct svc_req *rqstp);
extern amq_mount_tree_list *amqproc_export_1_svc(voidp argp, struct svc_req *rqstp);
extern amq_mount_tree_p *amqproc_mnttree_1_svc(voidp argp, struct svc_req *rqstp);
extern amq_string *amqproc_getvers_1_svc(voidp argp, struct svc_req *rqstp);
extern int *amqproc_getpid_1_svc(voidp argp, struct svc_req *rqstp);
extern int *amqproc_mount_1_svc(voidp argp, struct svc_req *rqstp);
extern int *amqproc_setopt_1_svc(voidp argp, struct svc_req *rqstp);
extern voidp amqproc_null_1_svc(voidp argp, struct svc_req *rqstp);
extern voidp amqproc_umnt_1_svc(voidp argp, struct svc_req *rqstp);
extern SVCXPRT *nfs_program_2_transp; /* For quick_reply() */
extern am_nfs_fh *root_fh(char *dir);
extern am_node * autofs_lookuppn(am_node *mp, char *fname, int *error_return, int op);
extern am_node *find_ap(char *);
extern am_node *find_ap2(char *, am_node *);
extern bool_t xdr_amq_mount_info_qelem(XDR *xdrs, qelem *qhead);
extern fserver *find_nfs_srvr(mntfs *mf);
extern int mount_nfs_fh(am_nfs_handle_t *fhp, char *dir, char *fs_name, char *opts, mntfs *mf);
extern int process_last_regular_map(void);
extern int set_conf_kv(const char *section, const char *k, const char *v);
extern int yyparse (void);
extern nfsentry *make_entry_chain(am_node *mp, const nfsentry *current_chain);
extern void afs_mkcacheref(mntfs *mf);
extern void flush_srvr_nfs_cache(void);
extern void mf_mounted(mntfs *mf);
extern void quick_reply(am_node *mp, int error);
extern void root_newmap(const char *, const char *, const char *, const cf_map_t *);
/* amd global variables */
extern struct amu_global_options gopt; /* where global options are stored */
extern FILE *yyin;
extern SVCXPRT *nfs_program_2_transp; /* For quick_reply() */
extern am_ops cdfs_ops;
extern am_ops lofs_ops;
extern am_ops nfs_ops;
@ -201,10 +214,9 @@ extern int fwd_sock;
extern int select_intr_valid;
extern int usage;
extern int use_conf_file; /* use amd configuration file */
extern int yyparse (void);
extern jmp_buf select_intr;
extern qelem mfhead;
extern void root_newmap(const char *, const char *, const char *, const cf_map_t *);
extern struct amu_global_options gopt; /* where global options are stored */
#ifdef HAVE_SIGACTION
extern sigset_t masked_sigs;
@ -219,4 +231,16 @@ extern int sfs_fumount(mntfs *mf);
extern bool_t xdr_mountres3(XDR *xdrs, mountres3 *objp);
#endif /* defined(HAVE_FS_NFS3) && !defined(HAVE_XDR_MOUNTRES3) */
#ifdef HAVE_FS_AUTOFS
extern SVCXPRT *autofsxprt;
extern u_short autofs_port;
extern int autofs_mount(am_node *mp);
extern int autofs_umount(am_node *mp);
extern int create_autofs_service(int *soAUTOFSp, u_short *autofs_portp, SVCXPRT **autofs_xprtp, void (*dispatch_fxn)(struct svc_req *rqstp, SVCXPRT *transp));
extern int svc_create_local_service(void (*dispatch) (), u_long prognum, u_long versnum, char *nettype, char *servname);
extern void autofs_mounted(mntfs *mf);
extern void autofs_program_1(struct svc_req *rqstp, SVCXPRT *transp);
#endif /* HAVE_FS_AUTOFS */
#endif /* not _AMD_H */

View File

@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
* $Id: amq_defs.h,v 1.2 1997/07/24 23:18:47 christos Exp $
* $Id: amq_defs.h,v 1.3 1997/09/22 22:11:10 christos Exp $
*
*/
@ -63,6 +63,7 @@
#define AMQPROC_GETMNTFS ((u_long)6)
#define AMQPROC_MOUNT ((u_long)7)
#define AMQPROC_GETVERS ((u_long)8)
#define AMQPROC_GETPID ((u_long)9)
/*
* TYPEDEFS

View File

@ -49,6 +49,9 @@
/* Define if have union filesystem */
#define HAVE_AM_FS_UNION 1
/* Define if have Sun's autofs filesystem */
/* #undef HAVE_AM_FS_AUTOFS */
/*
* Check for types of maps available.
@ -189,8 +192,6 @@
#define MOUNT_TYPE_UMAPFS MOUNT_UMAP
/*
* Check for the string name for the mount-table of a filesystem.
/*
* Check for the string name for the mount-table of a filesystem.
*/
@ -489,6 +490,9 @@
* NFS-specific mount(2) options (hex numbers)
*/
/* hide mount type from df(1) */
/* #undef MNT2_NFS_OPT_AUTO */
/* set max secs for dir attr cache */
/* #undef MNT2_NFS_OPT_ACDIRMAX */
@ -706,6 +710,12 @@
/* does struct sockaddr have field sa_len? */
#define HAVE_FIELD_STRUCT_SOCKADDR_SA_LEN 1
/* does struct autofs_args have an addr field? */
/* #undef HAVE_FIELD_AUTOFS_ARGS_T_ADDR */
/* does umntrequest have an rdevid field? */
/* #undef HAVE_FIELD_UMNTREQUEST_RDEVID */
/* should signal handlers be reinstalled? */
/* #undef REINSTALL_SIGNAL_HANDLER */
@ -801,6 +811,9 @@
#define WORDS_BIGENDIAN
#endif
/* Define if lex declares yytext as a char * by default, not a char[]. */
#define YYTEXT_POINTER 1
/* Turn off general debugging by default */
/* #undef DEBUG */
@ -814,7 +827,7 @@
#define PACKAGE "am-utils"
/* Define version of package (must be defined by configure.in) */
#define VERSION "6.0a8"
#define VERSION "6.0a10"
/* Define name of host machine's cpu (eg. sparc) */
#define HOST_CPU MACHINE
@ -882,6 +895,9 @@
/* Type of the 3rd argument to yp_order() */
#define YP_ORDER_OUTORDER_TYPE int
/* Type of the 5rd argument to authunix_create() */
#define AUTH_CREATE_GIDLIST_TYPE gid_t
/* The string used in printf to print the mount-type field of mount(2) */
#define MTYPE_PRINTF_TYPE "%s"
@ -915,6 +931,9 @@
/* Define a type for the rfs_args structure */
/* #undef rfs_args_t */
/* define if have a bad version of memcmp() */
/* #undef HAVE_BAD_MEMCMP */
/* Define if you have the __seterr_reply function. */
/* #undef HAVE___SETERR_REPLY */
@ -933,6 +952,9 @@
/* Define if you have the clnt_sperrno function. */
#define HAVE_CLNT_SPERRNO 1
/* Define if you have the clnt_tp_create_timed function. */
/* #undef HAVE_CLNT_TP_CREATE_TIMED */
/* Define if you have the cnodeid function. */
/* #undef HAVE_CNODEID */
@ -984,15 +1006,15 @@
/* Define if you have the hasmntopt function. */
/* #undef HAVE_HASMNTOPT */
/* Define if you have the hes_resolve function. */
/* #undef HAVE_HES_RESOLVE */
/* Define if you have the hes_init function. */
/* #undef HAVE_HES_INIT */
/* Define if you have the hesiod_init function. */
/* #undef HAVE_HESIOD_INIT */
/* Define if you have the hesiod_reload function. */
/* #undef HAVE_HESIOD_RELOAD */
/* Define if you have the hesiod_resolve function. */
/* #undef HAVE_HESIOD_RESOLVE */
/* Define if you have the hesiod_to_bind function. */
/* #undef HAVE_HESIOD_TO_BIND */
@ -1101,6 +1123,9 @@
/* Define if you have the umount function. */
/* #undef HAVE_UMOUNT */
/* Define if you have the uname function. */
#define HAVE_UNAME 1
/* Define if you have the unmount function. */
#define HAVE_UNMOUNT 1
@ -1176,6 +1201,12 @@
/* Define if you have the xdr_linkargs function. */
#define HAVE_XDR_LINKARGS 1
/* Define if you have the xdr_mntrequest function. */
/* #undef HAVE_XDR_MNTREQUEST */
/* Define if you have the xdr_mntres function. */
/* #undef HAVE_XDR_MNTRES */
/* Define if you have the xdr_mountbody function. */
#define HAVE_XDR_MOUNTBODY 1
@ -1242,6 +1273,12 @@
/* Define if you have the xdr_symlinkargs function. */
#define HAVE_XDR_SYMLINKARGS 1
/* Define if you have the xdr_umntrequest function. */
/* #undef HAVE_XDR_UMNTREQUEST */
/* Define if you have the xdr_umntres function. */
/* #undef HAVE_XDR_UMNTRES */
/* Define if you have the xdr_writeargs function. */
#define HAVE_XDR_WRITEARGS 1
@ -1260,6 +1297,9 @@
/* Define if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define if you have the <bsd/rpc/rpc.h> header file. */
/* #undef HAVE_BSD_RPC_RPC_H */
/* Define if you have the <cluster.h> header file. */
/* #undef HAVE_CLUSTER_H */
@ -1296,6 +1336,9 @@
/* Define if you have the <libgen.h> header file. */
/* #undef HAVE_LIBGEN_H */
/* Define if you have the <linux/auto_fs.h> header file. */
/* #undef HAVE_LINUX_AUTO_FS_H */
/* Define if you have the <linux/fs.h> header file. */
/* #undef HAVE_LINUX_FS_H */
@ -1351,7 +1394,7 @@
/* #undef HAVE_NETDIR_H */
/* Define if you have the <netinet/if_ether.h> header file. */
/* #undef HAVE_NETINET_IF_ETHER_H */
#define HAVE_NETINET_IF_ETHER_H 1
/* Define if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
@ -1473,6 +1516,9 @@
/* Define if you have the <sys/fs/autofs.h> header file. */
/* #undef HAVE_SYS_FS_AUTOFS_H */
/* Define if you have the <sys/fs/autofs_prot.h> header file. */
/* #undef HAVE_SYS_FS_AUTOFS_PROT_H */
/* Define if you have the <sys/fs/cachefs_fs.h> header file. */
/* #undef HAVE_SYS_FS_CACHEFS_FS_H */
@ -1593,6 +1639,9 @@
/* Define if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
/* Define if you have the <sys/vfs.h> header file. */
/* #undef HAVE_SYS_VFS_H */
@ -1623,8 +1672,8 @@
/* Define if you have the <varargs.h> header file. */
#define HAVE_VARARGS_H 1
/* Define if you have the c library (-lc). */
#define HAVE_LIBC 1
/* Define if you have the gdbm library (-lgdbm). */
/* #undef HAVE_LIBGDBM */
/* Define if you have the rpc library (-lrpc). */
/* #undef HAVE_LIBRPC */
@ -1661,6 +1710,9 @@
/* does gethostname() exist? */
#define HAVE_EXTERN_GETHOSTNAME 1
/* does getlogin() exist? */
#define HAVE_EXTERN_GETLOGIN 1
/* does gettablesize() exist? */
/* #undef HAVE_EXTERN_GETTABLESIZE */

View File

@ -1,14 +1,14 @@
# $NetBSD: Makefile,v 1.3 1997/07/28 13:08:05 veego Exp $
# $NetBSD: Makefile,v 1.4 1997/09/22 22:11:14 christos Exp $
LIB= amu
SRCS= mtabutil.c tranputil.c umount_fs.c xutil.c xdr_mountres3.c wire.c \
util.c nfs_prot_xdr.c mtab.c mount_fs.c misc_rpc.c hasmntopt.c config_local.h
SRCS= mtabutil.c tranputil.c umount_fs.c xutil.c xdr_func.c wire.c \
util.c nfs_prot_xdr.c mtab.c mount_fs.c misc_rpc.c hasmntopt.c
config_local.h: mkconf
@rm -f ${.TARGET}
sh ${.ALLSRC} > ${.TARGET}
CLEANFILES+= config_local.h
CLEANFILES+=config_local.h
.include <bsd.lib.mk>
LDADD=

View File

@ -1,117 +0,0 @@
/*
* Copyright (c) 1997 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* 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
* 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.
*
* %W% (Berkeley) %G%
*
* $Id: xdr_mountres3.c,v 1.1.1.1 1997/07/24 21:20:09 christos Exp $
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <am_defs.h>
#include <amu.h>
/*
* This ifdef is a hack: this whole file needs to be compiled
* only if the system has NFS V3 and does not have the xdr_mountres3
* function. Autoconf should pick this source file to compile only
* if these two conditions apply.
*/
#ifdef HAVE_FS_NFS3
bool_t
xdr_fhandle3(XDR *xdrs, fhandle3 *objp)
{
long *buf;
if (!xdr_bytes(xdrs,
(char **) &objp->fhandle3_val,
(u_int *) &objp->fhandle3_len,
FHSIZE3))
return (FALSE);
return (TRUE);
}
bool_t
xdr_mountstat3(XDR *xdrs, mountstat3 *objp)
{
long *buf;
if (!xdr_enum(xdrs, (enum_t *)objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_mountres3_ok(XDR *xdrs, mountres3_ok *objp)
{
long *buf;
if (!xdr_fhandle3(xdrs, &objp->fhandle))
return (FALSE);
if (!xdr_array(xdrs,
(char **)&objp->auth_flavors.auth_flavors_val,
(u_int *) &objp->auth_flavors.auth_flavors_len,
~0,
sizeof (int),
(xdrproc_t) xdr_int))
return (FALSE);
return (TRUE);
}
bool_t
xdr_mountres3(XDR *xdrs, mountres3 *objp)
{
long *buf;
if (!xdr_mountstat3(xdrs, &objp->fhs_status))
return (FALSE);
switch (objp->fhs_status) {
case 0: /* 0 == MNT_OK or MNT3_OK */
if (!xdr_mountres3_ok(xdrs, &objp->mountres3_u.mountinfo))
return (FALSE);
break;
}
return (TRUE);
}
#endif /* HAVE_FS_NFS3 */

View File

@ -1,3 +1,5 @@
.\"
.\" Copyright (c) 1997 Erez Zadok
.\" Copyright (c) 1993 Jan-Simon Pendry
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -11,7 +13,7 @@
.\" 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 acknowledgement:
.\" 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
@ -31,30 +33,30 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)mk-amd-map.8 8.1 (Berkeley) 6/28/93
.\" $Id: mk-amd-map.8,v 1.3 1997/05/29 01:48:43 cgd Exp $
.\" $Id: mk-amd-map.8,v 1.4 1997/09/22 22:11:17 christos Exp $
.\"
.Dd June 28, 1993
.Dt MK-AMD-MAP 8
.Os BSD 4.4
.Sh NAME
.Nm mk-amd-map
.Nd create database maps for Amd
.Sh SYNOPSIS
.Nm
.Op Fl p
.Ar mapname
.Sh DESCRIPTION
.Nm
.TH MK-AMD-MAP 8 "June 28, 1993"
.SH NAME
.B mk-amd-map
\- create database maps for Amd
.SH SYNOPSIS
.B mk-amd-map
[
.B \-p
]
.I mapname
.SH DESCRIPTION
.B mk-amd-map
creates the database maps used by the keyed map lookups in
.Xr amd 8 .
amd(8).
It reads input from the named file
and outputs them to a correspondingly named
hashed database.
.Pp
The
.Fl p
.TP
.B \-p
This
option prints the map on standard output instead of generating
a database. This is usually used to merge continuation lines
into one physical line.
.Sh SEE ALSO
.Xr amd 8
.SH SEE ALSO
.BR amd (8).